Align Connect with Dusk Send provider surface#1
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the Dusk wallet SDK to support “payment profiles” (public account + optional approved shielded receive address), selective disclosure bundles/receipts, settlement encryption keys, and gateway Phoenix withdraw flows, and threads these capabilities through the SDK, examples, mocks, tests, and docs.
Changes:
- Added profile-aware connection and state (
profiles,selectedProfile) plus new wallet APIs (requestProfiles,requestShieldedAddress,requestDisclosureBundle,requestSettlementEncryptionKey,requestShieldedSettlementReceipt,requestGatewayWithdraw). - Normalized contract-call transaction params before forwarding to the provider (privacy defaulting/validation, contractId normalization, fnName trimming, fnArgs hex encoding).
- Updated UI components, mocks/reference wallet, tests, and documentation to reflect the new provider RPC surface and feature flags.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/wallet.ts | Implements profile state + new RPC helpers; normalizes tx params before sending. |
| src/wallet.test.ts | Adds test coverage for new profile/shielded/disclosure/gateway behaviors and tx normalization. |
| src/ui/modal.ts | Allows passing connectOptions through the connect modal into wallet.connect(...). |
| src/ui/connect-button.ts | Adds connectOptions plumbing from the connect button to the modal and connect call. |
| src/types.ts | Introduces new profile/disclosure/settlement/gateway types and capability feature flags; adds privacy to transfer params. |
| src/test/referenceWallet.ts | Extends the reference wallet test provider with new RPC methods/features. |
| src/test/mocks.ts | Extends mock provider + mock UI wallet to support profiles, shielded address flows, disclosure, settlement keys, and gateway withdraw. |
| src/contract.ts | Adds privacy to contract tx overrides so contract writes can request shielded calls. |
| src/contract.test.ts | Updates contract facade tests to assert privacy is propagated. |
| src/app.ts | Extends tx override parsing to include privacy. |
| README.md | Documents the new RPC methods and shows updated usage examples for profiles, shielded addresses, and disclosure bundles. |
| examples/reference-wallet/main.js | Updates the example wallet provider to implement the new profile/shielded RPCs and feature flag. |
| examples/discovery-demo/main.js | Updates the discovery demo mock provider with profile/shielded RPCs and feature flag. |
| docs/wallet-implementer.md | Adds implementer guidance and example code for profiles, shielded pairing, disclosure bundles, and signing requirements. |
| docs/wallet-discovery.md | Updates discovery docs with the newly supported RPC methods. |
Comments suppressed due to low confidence (1)
src/test/mocks.ts:452
createMockUiWallet.connectis typed as(options?: { shieldedReceiveAddress?: boolean }), but the production API now usesConnectOptions(also includesreason/label). Keeping this narrower type can cause excess-property TypeScript errors in UI tests when passing the real connect options object. Consider reusingConnectOptionshere (or at leastPartial<ConnectOptions>).
connect: vi.fn(async (options?: { shieldedReceiveAddress?: boolean }) => {
const accounts = state.accounts.length ? [...state.accounts] : ["dusk1connectedacct"];
const profiles = [
{
profileId: "profile:0",
account: accounts[0] ?? "dusk1connectedacct",
...(options?.shieldedReceiveAddress ? { shieldedAddress: "dusk1connectedshielded" } : {}),
},
];
state = {
...state,
authorized: true,
accounts,
profiles,
selectedAddress: accounts[0] ?? null,
selectedProfile: profiles[0] ?? null,
lastUpdated: Date.now(),
};
notify();
return [...state.accounts];
}),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
af30b5c to
f3d7b93
Compare
f3d7b93 to
9493ee1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the Dusk wallet provider and integration documentation, demos, and reference implementations to use a new "profile"-based model instead of the previous "account"-based model. The main change is the introduction of profiles as the primary identity object, replacing accounts throughout the API, events, and documentation. This brings improved privacy and flexibility, especially around shielded addresses. The changes also expand and clarify the required provider methods, events, and conformance guidance for wallet implementers.
API and Identity Model Update
profilesinstead ofselectedAddress, and emitsprofilesChangedrather thanaccountsChanged. The primary connect method is nowdusk_requestProfiles, and passive reads usedusk_profiles. [1] [2] [3] [4]DuskProfiletype, which includes aprofileId,account, and an optionalshieldedAddress. Shielded receive addresses are now profile-scoped and must be explicitly requested. [1] [2] [3]Provider and RPC Method Surface
dusk_requestProfiles,dusk_profiles,dusk_requestShieldedAddress, etc.) and clarified required features and event semantics. [1] [2] [3] [4]profilesChangedreplacesaccountsChanged, and emittingprofilesChanged([])is now the standard for lock or loss of visibility, not just disconnection. [1] [2] [3]Documentation and Examples
README.md,wallet-discovery.md,wallet-implementer.md) to reflect the new profiles model, including code samples, event descriptions, and conformance testing instructions. [1] [2] [3] [4] [5]Demo and Reference Implementation Updates
Code and Example Cleanups
enable()andselectedAddress) from provider implementations and examples. [1] [2]These changes bring the Dusk wallet integration model in line with the new privacy-focused profile approach and provide clearer guidance and improved conformance tooling for wallet developers.