diff --git a/apps/console/package.json b/apps/console/package.json index 17a8ffdea..8939e2ed6 100644 --- a/apps/console/package.json +++ b/apps/console/package.json @@ -95,7 +95,7 @@ "database": "*", "filepond": "^4.30.4", "filepond-plugin-file-validate-type": "^1.2.8", - "neverthrow": "^6.2.1", + "neverthrow": "^8.0.0", "ramda": "^0.28.0", "sanitize-html": "^2.11.0", "svelte-filepond": "^0.2.0", diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index 5aac5edc9..fa51a276a 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -100,7 +100,7 @@ "filepond": "^4.30.4", "filepond-plugin-file-validate-type": "^1.2.8", "jsonwebtoken": "^9.0.2", - "neverthrow": "^6.2.1", + "neverthrow": "^8.0.0", "ramda": "^0.28.0", "sanitize-html": "^2.11.0", "svelte-filepond": "^0.2.0", diff --git a/apps/sandbox/src/data-request/PersonaDataCard.tsx b/apps/sandbox/src/data-request/PersonaDataCard.tsx index 61c12b8bc..91b5fe84d 100644 --- a/apps/sandbox/src/data-request/PersonaDataCard.tsx +++ b/apps/sandbox/src/data-request/PersonaDataCard.tsx @@ -76,7 +76,6 @@ export const PersonaDataCard = () => { ) } )} - ; void +}) => { + const enabled = !!state.enabled + return ( + { + updateState({ ...state, enabled: ev.target.checked }) + }} + /> + } + > + + + {state.data.addresses.map((address, index) => ( + + { + const addresses = [...state.data.addresses] + addresses[index] = ev.target.value + updateState({ + ...state, + data: { + addresses + } + }) + }} + /> + + + ))} + + + ) +} diff --git a/apps/sandbox/src/one-time-data-request/OneTimeDataRequestsPage.tsx b/apps/sandbox/src/one-time-data-request/OneTimeDataRequestsPage.tsx index cf12d4939..aac29c67b 100644 --- a/apps/sandbox/src/one-time-data-request/OneTimeDataRequestsPage.tsx +++ b/apps/sandbox/src/one-time-data-request/OneTimeDataRequestsPage.tsx @@ -12,6 +12,8 @@ import { OneTimeDataRequestBuilderItem } from '@common/rdt' import { useState } from 'react' +import { PersonaProofCard } from './PersonaProof' +import { AccountsProofCard } from './AccountsProof' export const OneTimeDataRequestsPage = () => { const [state, setState] = useState<{ accounts: { @@ -32,6 +34,18 @@ export const OneTimeDataRequestsPage = () => { phoneNumbers: boolean } } + personaProof: { + enabled: boolean + data: { + address: string + } + } + accountsProof: { + enabled: boolean + data: { + addresses: string[] + } + } }>({ accounts: { enabled: true, @@ -47,6 +61,18 @@ export const OneTimeDataRequestsPage = () => { emailAddresses: false, phoneNumbers: false } + }, + personaProof: { + enabled: false, + data: { + address: '' + } + }, + accountsProof: { + enabled: false, + data: { + addresses: [] + } } }) @@ -54,7 +80,8 @@ export const OneTimeDataRequestsPage = () => { @@ -77,6 +104,25 @@ export const OneTimeDataRequestsPage = () => { }} /> + + { + setState((prev) => ({ ...prev, personaProof })) + }} + /> + { + setState((prev) => ({ ...prev, accountsProof })) + }} + /> + { dataRequest.push(personaDataRequest) } + if ( + state.personaProof.enabled || + state.accountsProof.enabled + ) { + let poo = OneTimeDataRequestBuilder.proofOfOwnership() + if ( + state.personaProof.enabled && + state.accountsProof.enabled + ) { + dataRequest.push( + poo + .accounts( + state.accountsProof.data.addresses.filter(Boolean) + ) + .identity(state.personaProof.data.address) + ) + } else if (state.personaProof.enabled) { + dataRequest.push( + poo.identity(state.personaProof.data.address) + ) + } else if (state.accountsProof.enabled) { + dataRequest.push( + poo.accounts( + state.accountsProof.data.addresses.filter(Boolean) + ) + ) + } + } + rdt.walletApi.sendOneTimeRequest(...dataRequest) }} sx={{ alignSelf: 'center', width: '150px' }} diff --git a/apps/sandbox/src/one-time-data-request/PersonaProof.tsx b/apps/sandbox/src/one-time-data-request/PersonaProof.tsx new file mode 100644 index 000000000..cb603c5bb --- /dev/null +++ b/apps/sandbox/src/one-time-data-request/PersonaProof.tsx @@ -0,0 +1,49 @@ +import Box from '@mui/joy/Box' +import Checkbox from '@mui/joy/Checkbox' +import { Card } from '../components/Card' +import { Input } from '@mui/joy' + +export const PersonaProofCard = ({ + state, + updateState +}: { + state: { + enabled: boolean + data: { + address: string + } + } + updateState: (state: { + enabled: boolean + data: { + address: string + } + }) => void +}) => { + const enabled = !!state.enabled + return ( + { + updateState({ ...state, enabled: ev.target.checked }) + }} + /> + } + > + + { + updateState({ + ...state, + data: { address: event.target.value.toString() } + }) + }} + /> + + + ) +} diff --git a/apps/sandbox/src/rdt/rdt.ts b/apps/sandbox/src/rdt/rdt.ts index eb0329b45..e0818b213 100644 --- a/apps/sandbox/src/rdt/rdt.ts +++ b/apps/sandbox/src/rdt/rdt.ts @@ -1,6 +1,7 @@ import { BehaviorSubject, tap } from 'rxjs' import { DataRequestBuilder, + EnvironmentModule, GatewayModule, LocalStorageModule, RadixDappToolkit, @@ -87,8 +88,15 @@ export const gatewayApi = GatewayApiClient({ applicationVersion }) +const environmentModule = EnvironmentModule() + const storageModule = LocalStorageModule( - `rdt:${dAppDefinitionAddress.value}:${networkId}` + `rdt:${dAppDefinitionAddress.value}:${networkId}`, + { + providers: { + environmentModule + } + } ) const stateModule = StateModule({ @@ -116,7 +124,8 @@ const walletRequestModule = WalletRequestModule({ providers: { stateModule, storageModule, - gatewayModule + gatewayModule, + environmentModule } }) diff --git a/package-lock.json b/package-lock.json index 0445729fd..477c63a06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "database": "*", "filepond": "^4.30.4", "filepond-plugin-file-validate-type": "^1.2.8", - "neverthrow": "^6.2.1", + "neverthrow": "^8.0.0", "ramda": "^0.28.0", "sanitize-html": "^2.11.0", "svelte-filepond": "^0.2.0", @@ -727,7 +727,7 @@ "filepond": "^4.30.4", "filepond-plugin-file-validate-type": "^1.2.8", "jsonwebtoken": "^9.0.2", - "neverthrow": "^6.2.1", + "neverthrow": "^8.0.0", "ramda": "^0.28.0", "sanitize-html": "^2.11.0", "svelte-filepond": "^0.2.0", @@ -8912,23 +8912,22 @@ } }, "node_modules/@radixdlt/radix-dapp-toolkit": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@radixdlt/radix-dapp-toolkit/-/radix-dapp-toolkit-2.1.1.tgz", - "integrity": "sha512-HgKio/tDY31/E/t+eF/4B1xPiOdQRhxgR+sZ4nKmFPQPEgTfkckrvaIgkYnI4NfZfuQC/Nb+ODSimKIWSzkNHw==", + "version": "2.2.0-dev.19", + "resolved": "https://registry.npmjs.org/@radixdlt/radix-dapp-toolkit/-/radix-dapp-toolkit-2.2.0-dev.19.tgz", + "integrity": "sha512-8DKBgQIp6FfJGDo0iDPN7BBdeXhkhY/H8mOX5BHWGkdsUpNhVWbTD86L9txrsYIz3et1ud4VBlZg1lBx3lfvAw==", "dependencies": { "@noble/curves": "^1.4.0", "base64url": "^3.0.1", "blakejs": "^1.2.1", - "bowser": "^2.11.0", "buffer": "^6.0.3", "immer": "^10.0.4", "lit": "^3.1.2", "lit-html": "^3.1.2", - "neverthrow": "^6.1.0", + "neverthrow": "^8.0.0", "rxjs": "^7.8.1", "tslog": ">=4.8.0", "uuid": "^10.0.0", - "valibot": "0.30.0" + "valibot": "0.42.1" }, "engines": { "node": ">=18" @@ -9021,6 +9020,21 @@ "secp256k1": "5.0.0" } }, + "node_modules/@radixdlt/rola": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@radixdlt/rola/-/rola-2.1.0.tgz", + "integrity": "sha512-6RmKXM1EodtNFnRIjWPCaU1WiF5oOSeJhV+5SFFH8ttCpV/WmNcP010ARHDyFZGMCsK0fvpS7w5gdCMeKECNew==", + "dependencies": { + "@noble/curves": "^1.4.0", + "@radixdlt/babylon-gateway-api-sdk": "^1.4.1", + "@radixdlt/radix-engine-toolkit": "^1.0.5", + "blakejs": "^1.2.1", + "neverthrow": "^6 || ^7 || ^8" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@remix-run/router": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.10.0.tgz", @@ -15055,11 +15069,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/bowser": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", - "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" - }, "node_modules/bplist-parser": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", @@ -26180,9 +26189,12 @@ "dev": true }, "node_modules/neverthrow": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/neverthrow/-/neverthrow-6.2.1.tgz", - "integrity": "sha512-amlnNvPXmiUOmNsDfUngNWPdZYOmCUGExQy/kuPCmLbhrXVXIYhY4bnE4D3dWl7OMhSEr9NndUrl4aKGFhFIQg==" + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/neverthrow/-/neverthrow-8.0.0.tgz", + "integrity": "sha512-SX2Z50+U27I+CF3NwHE9J8MB6+bYRRub3U+1nAKxnL6c+2vW2l/WsYEC0e3Wqg8DwiJvrquqE0YhxlVTzGJGsg==", + "engines": { + "node": ">=18" + } }, "node_modules/no-case": { "version": "3.0.4", @@ -31315,9 +31327,17 @@ } }, "node_modules/valibot": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.30.0.tgz", - "integrity": "sha512-5POBdbSkM+3nvJ6ZlyQHsggisfRtyT4tVTo1EIIShs6qCdXJnyWU5TJ68vr8iTg5zpOLjXLRiBqNx+9zwZz/rA==" + "version": "0.42.1", + "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.42.1.tgz", + "integrity": "sha512-3keXV29Ar5b//Hqi4MbSdV7lfVp6zuYLZuA9V1PvQUsXqogr+u5lvLPLk3A4f74VUXDnf/JfWMN6sB+koJ/FFw==", + "peerDependencies": { + "typescript": ">=5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } }, "node_modules/validate-npm-package-license": { "version": "3.0.4", @@ -32225,9 +32245,9 @@ "@floating-ui/dom": "^1.5.3", "@radixdlt/babylon-core-api-sdk": "^1.2.3", "@radixdlt/babylon-gateway-api-sdk": "^1.8.1", - "@radixdlt/radix-dapp-toolkit": "^2.1.1", + "@radixdlt/radix-dapp-toolkit": "2.2.0-dev.19", "@radixdlt/radix-engine-toolkit": "^1.0.5", - "@radixdlt/rola": "^2.0.0", + "@radixdlt/rola": "^2.1.0", "dayjs": "^1.11.10", "zod": "^3.22.4" }, @@ -32235,21 +32255,6 @@ "typescript": "^5.1.6" } }, - "packages/common/node_modules/@radixdlt/rola": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@radixdlt/rola/-/rola-2.0.0.tgz", - "integrity": "sha512-W3UDtLpj59kxSntPgjv4niixTQ6MnTe6ZhP9WN8PSMFrbq7/SExJ22TQ8AobMDcv5yYS4wrG1UPg4V6mBEL7Xg==", - "dependencies": { - "@noble/curves": "^1.4.0", - "@radixdlt/babylon-gateway-api-sdk": "^1.4.1", - "@radixdlt/radix-engine-toolkit": "^1.0.3", - "blakejs": "^1.2.1", - "neverthrow": "^6.1.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, "packages/configs": { "version": "0.0.0", "extraneous": true, @@ -32275,7 +32280,7 @@ "filepond": "^4.30.4", "filepond-plugin-file-validate-type": "^1.2.8", "jsonwebtoken": "^9.0.0", - "neverthrow": "^6.2.1", + "neverthrow": "^8.0.0", "ramda": "^0.28.0", "sanitize-html": "^2.11.0", "svelte-filepond": "^0.2.0", diff --git a/packages/common/package.json b/packages/common/package.json index 1dad50d6c..685ee9c80 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -7,9 +7,9 @@ "@floating-ui/dom": "^1.5.3", "@radixdlt/babylon-core-api-sdk": "^1.2.3", "@radixdlt/babylon-gateway-api-sdk": "^1.8.1", - "@radixdlt/radix-dapp-toolkit": "^2.1.1", + "@radixdlt/radix-dapp-toolkit": "2.2.0-dev.19", "@radixdlt/radix-engine-toolkit": "^1.0.5", - "@radixdlt/rola": "^2.0.0", + "@radixdlt/rola": "^2.1.0", "dayjs": "^1.11.10", "zod": "^3.22.4" }, diff --git a/packages/ui/package.json b/packages/ui/package.json index 2d74b3467..f4c0de82e 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -94,7 +94,7 @@ "filepond": "^4.30.4", "filepond-plugin-file-validate-type": "^1.2.8", "jsonwebtoken": "^9.0.0", - "neverthrow": "^6.2.1", + "neverthrow": "^8.0.0", "ramda": "^0.28.0", "sanitize-html": "^2.11.0", "svelte-filepond": "^0.2.0",