feat(stellar-wallet-snap): add signProofOfOwnership client request RPC - #186
feat(stellar-wallet-snap): add signProofOfOwnership client request RPC#186stanleyyconsensys wants to merge 5 commits into
signProofOfOwnership client request RPC#186Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Stellar Wallet Snap SIP-31 onClientRequest method, signProofOfOwnership, to silently sign a constrained proof-of-ownership message (SEP-0053) for MetaMask client usage (e.g., profile-metrics ownership proofs).
Changes:
- Introduces
signProofOfOwnershipJSON-RPC method, request/response validation structs, and handler wiring. - Adds parsing/validation for
metamask:proof-of-ownership:{nonce}:{address}messages (nonce supports colons). - Adds unit tests, docs for the new handler flow, and a changelog entry.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/stellar-wallet-snap/src/handlers/clientRequest/utils.ts | Adds proof-of-ownership message parsing + Stellar address validation helper. |
| packages/stellar-wallet-snap/src/handlers/clientRequest/signProofOfOwnership.ts | Implements the silent signing handler and enforces message-address matches signing account. |
| packages/stellar-wallet-snap/src/handlers/clientRequest/signProofOfOwnership.test.ts | Adds unit tests covering success and address-mismatch failure behavior. |
| packages/stellar-wallet-snap/src/handlers/clientRequest/api.ts | Adds method enum entry plus request/response structs (including coercion of nonce/address from message). |
| packages/stellar-wallet-snap/src/handlers/clientRequest/api.test.ts | Adds struct validation tests for the new request/response shapes. |
| packages/stellar-wallet-snap/src/context.ts | Registers the new handler in the client request routing table. |
| packages/stellar-wallet-snap/snap.manifest.json | Updates bundle shasum for the new build output. |
| packages/stellar-wallet-snap/docs/use-cases/README.md | Adds the new use-case entry to the handler documentation index. |
| packages/stellar-wallet-snap/docs/use-cases/client-request/signProofOfOwnership.md | Documents the new handler’s behavior, constraints, and flow. |
| packages/stellar-wallet-snap/CHANGELOG.md | Adds an Unreleased changelog entry describing the new client request method. |
Suppressed comments (1)
packages/stellar-wallet-snap/docs/use-cases/client-request/signProofOfOwnership.md:43
- This step says
BaseClientRequestHandlerresolves the account + wallet, butSignProofOfOwnershipHandlerextendsBaseHandlerand resolves viaAccountResolverdirectly. Updating this avoids confusion when tracing the implementation.
3. **Resolve** — `BaseClientRequestHandler` loads keyring account and wallet only (`RESOLVE_ACCOUNT_KEYRING_AND_WALLET`). The destination account does not need to be activated on-chain.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| * @returns The parsed nonce and Stellar address. | ||
| * @throws Error if the message format is invalid. | ||
| */ | ||
| export function parseProofOfOwnershipMessage(message: string): { |
There was a problem hiding this comment.
align the same method as solana
|
|
||
| 1. **Route** — `onClientRequest` dispatches to `SignProofOfOwnershipHandler`. | ||
| 2. **Validate** — Request must match `SignProofOfOwnershipJsonRpcRequestStruct` (prefix, nonce, Stellar address). `nonce` and `address` are coerced from `message`. | ||
| 3. **Resolve** — `BaseClientRequestHandler` loads keyring account and wallet only (`RESOLVE_ACCOUNT_KEYRING_AND_WALLET`). The destination account does not need to be activated on-chain. |
There was a problem hiding this comment.
Replace BaseClientRequestHandler with SignProofOfOwnershipHandler (or AccountResolver). That class is the one that actually calls resolveAccount with RESOLVE_ACCOUNT_KEYRING_AND_WALLET.
There was a problem hiding this comment.
yup the doc is not update, let me update it
Explanation
Adds a new Stellar Wallet Snap SIP-31 onClientRequest method, signProofOfOwnership, to silently sign a constrained proof-of-ownership message (SEP-0053) for MetaMask client usage (e.g., profile-metrics ownership proofs).
Changes:
Introduces signProofOfOwnership JSON-RPC method, request/response validation structs, and handler wiring.
Adds parsing/validation for metamask:proof-of-ownership:{nonce}:{address} messages (nonce supports colons).
Adds unit tests, docs for the new handler flow, and a changelog entry.
References
Checklist