Skip to content

Requesting signatures and transactions ‚Äč

TIP

To request signatures and transactions from a wallet, you must first get an EIP1193 provider for the wallet.

Once you have the embedded wallet's EIP-1193 provider, you can use the provider's request method to send JSON-RPC requests that request signatures and transactions from the wallet.

The request method accepts an object with the fields:

  • method (required): the name of the JSON-RPC method as a string (e.g. personal_sign or eth_sendTransaction)
  • params (optional): an array of arguments for the JSON-RPC method specified by method
ts
// Get address
const accounts = await wallet.provider.request({
  method: 'eth_requestAccounts',
});

// Sign message
const message = 'I hereby vote for foobar';
const signature = await wallet.provider.request({
  method: 'personal_sign',
  params: [message, accounts[0]],
});