wallet_snap
Calls the specified JSON-RPC API method of the specified Snap. The Snap must be installed and the dapp must have permission to communicate with the Snap, or the request is rejected. The dapp can install the Snap and request permission to communicate with it using wallet_requestSnaps
.
This method is synonymous to wallet_invokeSnap
.
Params
(1)1. SnapParameter (required)
snapId
stringThe ID of the Snap to invoke.
request
objectThe JSON-RPC request object to send to the invoked Snap.
method
stringparams
objectResult
(SnapResult)Result of the Snap method call.
Example
Request
await window.ethereum.request({
"method": "wallet_snap",
"params": [
{
"snapId": "npm:@metamask/example-snap",
"request": {
"method": "hello"
}
}
]
});
Result
{}