-
Notifications
You must be signed in to change notification settings - Fork 645
docs: Update documentation RPC methods #3868
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
+831
−80
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
23b6766
Update documentation for all restricted and some permitted methods
Mrtenz d77876b
Update documentation for all remaining methods
Mrtenz 590cf0a
Update packages/snaps-sdk/src/types/methods/get-snaps.ts
Mrtenz 600b2ac
Update docs for `snap_clearState`
Mrtenz 2ba8ef1
Update packages/snaps-sdk/src/types/methods/notify.ts
Mrtenz 4c18548
Update `snap_listEntropySources` docs
Mrtenz 4ffe36b
Make `wallet_requestSnaps` docs more explicit
Mrtenz 65edb95
Update `snap_openWebSockets` example
Mrtenz 65d6bbb
Update state method docs
Mrtenz 741262b
Update `snap_getBip32Entropy` docs
Mrtenz 1b743b3
Fix typo in `snap_getState` docs
Mrtenz 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
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
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
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 |
|---|---|---|
|
|
@@ -8,11 +8,33 @@ import type { InvokeSnapParams, InvokeSnapResult } from '@metamask/snaps-sdk'; | |
| import type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils'; | ||
| import { isObject } from '@metamask/utils'; | ||
|
|
||
| /** | ||
| * `wallet_invokeSnap` attempts to invoke an RPC method of the specified Snap. | ||
| */ | ||
| const methodName = 'wallet_invokeSnap'; | ||
|
|
||
| /** | ||
| * Invoke a method of a Snap, designated by the `snapId` parameter, with a | ||
| * JSON-RPC request specified in the `request` parameter. This is effectively a | ||
| * wrapper around [`wallet_snap`](https://docs.metamask.io/snaps/reference/snaps-api/wallet_snap) | ||
| * that allows for more convenient invocation of Snap methods without needing to | ||
| * specify the full `wallet_snap` parameters. | ||
| * | ||
| * The Snap must be installed and the dapp must have permission to communicate | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically Snaps can call this too, not sure if we need to explain that too much though 😄 |
||
| * with the Snap, or the request is rejected. The dapp can install the Snap and | ||
| * request permission to communicate with it using [`wallet_requestSnaps`](https://docs.metamask.io/snaps/reference/snaps-api/wallet_requestsnaps). | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * const result = await snap.request({ | ||
| * method: 'wallet_invokeSnap', | ||
| * params: { | ||
| * snapId: 'npm:@metamask/example-snap', | ||
| * request: { | ||
| * method: 'someMethod', | ||
| * params: { some: 'params' }, | ||
| * }, | ||
| * }, | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export const invokeSnapSugarHandler = { | ||
| methodNames: [methodName] as const, | ||
| implementation: invokeSnapSugar, | ||
|
|
||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these URLs guaranteed? I worry about them changing and we don't notice in this repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guaranteed in what sense? This is the format of the new URLs based on the schema. They could of course break if we make changes somewhere, but we should set up redirects in that case.