Skip to content

wallet_sendCalls Usage

If you want to sponsor your users' transactions, you can do so by passing a paymaster service URL along with EIP-5792 wallet_sendCalls requests. Specifically, you will need to include a paymasterService object in capabilities. This object should have a url field that points to your paymaster service, and, optionally, a context object with fields specified by your paymaster service provider.

Smart wallets that support EIP-5792 and ERC-7677 will then communicate with the provided URL according to ERC-7677 to attempt to obtain paymaster values during user operation construction.

Example

provider.request({
  method: 'wallet_sendCalls',
  params: [{
    version: '1.0',
    chainId: '0x01',
    from: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
    calls: [
      {
        to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
        value: '0x9184e72a',
        data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
      },
      {
        to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
        value: '0x182183',
        data: '0xfbadbaf01'
      }
    ],
    capabilities: { 
      paymasterService: { 
        url: process.env.PAYMASTER_URL, 
        context: { 
          policyId: '631528b0-d444-4a9b-a575-40dd3aa4a13a'
        } 
      } 
    } 
  }]
})