request
Sends a JSON RPC request to the wallet
Last updated
Sends a JSON RPC request to the wallet
Last updated
Params: method: string;
params?: unknown[] | object;
Returns: Promise<unknown>
Example:
The code above demonstrates how you can use the request
method to ask the user to connect to your dapp.
The request
method is the go to way for you to interface with the wallet in your dapp. It accepts most that would need to interact with the wallet.
However it will not work for methods that don't make sense for a wallet. E.g. you can't use the provider object Phantom injects to call something like eth_getTransactionByHash
. If you send a method that the provider object does not support, it will throw an error. You can see a list of errors, and the shape that they will take on page.