Skip to content

Commit

Permalink
[uma-bridge] Add UMA address validation to send page. Upgrade UMA SDK…
Browse files Browse the repository at this point in the history
… (#13147)

GitOrigin-RevId: cf2f33b84b464a08e2e4edac4c8a94a6e2d870de
  • Loading branch information
coreymartin authored and Lightspark Eng committed Nov 5, 2024
1 parent ca1779f commit 87f46ef
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/examples/uma-vasp-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@inquirer/prompts": "^1.1.3",
"@lightsparkdev/core": "1.2.6",
"@lightsparkdev/lightspark-sdk": "1.8.8",
"@uma-sdk/core": "^1.2.0",
"@uma-sdk/core": "^1.2.3",
"chalk": "^5.3.0",
"commander": "^11.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/examples/uma-vasp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@lightsparkdev/core": "1.2.6",
"@lightsparkdev/lightspark-sdk": "1.8.8",
"@uma-sdk/core": "^1.2.0",
"@uma-sdk/core": "^1.2.3",
"express": "^4.18.2",
"uuid": "^9.0.0",
"zod": "^3.22.4"
Expand Down
4 changes: 2 additions & 2 deletions apps/examples/uma-vasp/src/SendingVasp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ export default class SendingVasp {
requestUrl: requestUrl,
senderProfile: payerPofile,
pubKeys: pubKeys,
umaVersion: invoice.umaVersion,
umaVersion: invoice.umaVersions,
invoiceUUID: invoice.invoiceUUID
});
}
Expand Down Expand Up @@ -998,7 +998,7 @@ export default class SendingVasp {
// invoice data / utxo callback / etc not required
undefined, undefined, undefined
)
// In a real VASP, here you might push a notification to inform the sender that
// In a real VASP, here you might push a notification to inform the sender that
// a new invoice has arrived.
return {
httpStatus: 200
Expand Down
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@simbathesailor/use-what-changed": "^2.0.0",
"@svgr/core": "^8.1.0",
"@tanstack/react-table": "^8.20.5",
"@uma-sdk/core": "^1.2.3",
"@wojtekmaj/react-daterange-picker": "^5.5.0",
"@wojtekmaj/react-datetimerange-picker": "^5.5.0",
"@zxing/browser": "^0.1.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/ui/src/hooks/useFields.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isValidUmaAddress } from "@uma-sdk/core";
import { diff } from "deep-object-diff";
import { isObject } from "lodash-es";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
Expand All @@ -21,6 +22,7 @@ const defaultMsgs = {
code: "Code must be eight characters long.",
password: "Password must be at least eight characters.",
required: "This field is required.",
umaAddress: "Please enter a valid UMA address.",
};

const regexp = {
Expand Down Expand Up @@ -56,6 +58,10 @@ export const v: Validators = {
(msg = defaultMsgs.code) =>
(value) =>
value.trim().length !== 8 ? msg : false,
umaAddress:
(msg = defaultMsgs.umaAddress) =>
(value) =>
!isValidUmaAddress(value) ? msg : false,
required:
(msg = defaultMsgs.required) =>
(value) =>
Expand Down

0 comments on commit 87f46ef

Please sign in to comment.