-
Notifications
You must be signed in to change notification settings - Fork 698
feat: prepare wallet rpcs #1554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cb-jake
merged 9 commits into
coinbase:master
from
stephancill:feat/prepare-wallet-rpcs
Mar 26, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
34a85ae
feat: replace wallet_sendCalls with wallet_prepareCalls + wallet_send…
stephancill 9bcc91d
fix: tests
stephancill a13ac7c
fix: pr feedback
stephancill a4b90cb
fix: persist test secp256k1 key in localstorage
stephancill 8c0223e
fix: strict validation for hex chain id
stephancill 0a4034b
fix: pr comments
stephancill ac53c2f
fix: tests after rebase
stephancill 865ce9c
fix: refactor credential serialization
stephancill 6f05723
fix: pr comments
stephancill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { Hex } from 'viem'; | ||
|
|
||
| export type PrepareCallsParams = [ | ||
| { | ||
| from: Hex; | ||
| chainId: Hex; | ||
| calls: { | ||
| to: Hex; | ||
| data: Hex; | ||
| value: Hex; | ||
| }[]; | ||
| capabilities: Record<string, any>; | ||
| }, | ||
| ]; | ||
|
|
||
| export type PrepareCallsReturnValue = { | ||
| type: string; | ||
| chainId: Hex; | ||
| signatureRequest: { | ||
| hash: Hex; | ||
| }; | ||
| capabilities: Record<string, any>; | ||
| userOp: any; | ||
| }; | ||
|
|
||
| export type PrepareCallsSchema = { | ||
| Method: 'wallet_prepareCalls'; | ||
| Parameters: PrepareCallsParams; | ||
| ReturnType: PrepareCallsReturnValue; | ||
| }; |
51 changes: 51 additions & 0 deletions
51
packages/wallet-sdk/src/core/rpc/wallet_sendPreparedCalls.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { Hex } from 'viem'; | ||
|
|
||
| export type WebauthnSignatureType = { | ||
| type: 'webauthn'; | ||
| data: { | ||
| /** | ||
| * The signature is the stringified JSON of the webauthn signature | ||
| * @example | ||
| * ```json | ||
| * { | ||
| * "id": "string", | ||
| * "rawId": "string", | ||
| * "response": { | ||
| * "authenticatorData": "string", | ||
| * "clientDataJSON": "string", | ||
| * "signature": "string" | ||
| * }, | ||
| * "type": "string" | ||
| * } | ||
| * ``` | ||
| */ | ||
| signature: string; | ||
| publicKey: Hex; | ||
| }; | ||
| }; | ||
|
|
||
| export type Secp256k1SignatureType = { | ||
| type: 'secp256k1'; | ||
| data: { | ||
| address: Hex; | ||
| signature: Hex; | ||
| }; | ||
| }; | ||
|
|
||
| export type SendPreparedCallsParams = [ | ||
| { | ||
| version: string; | ||
| type: string; | ||
| data: any; | ||
| chainId: Hex; | ||
| signature: WebauthnSignatureType | Secp256k1SignatureType; | ||
| }, | ||
| ]; | ||
|
|
||
| export type SendPreparedCallsReturnValue = string[]; | ||
|
|
||
| export type SendPreparedCallsSchema = { | ||
| Method: 'wallet_sendPreparedCalls'; | ||
| Parameters: SendPreparedCallsParams; | ||
| ReturnType: SendPreparedCallsReturnValue; | ||
| }; | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.