wallet_sendCalls
Send multiple blockchain calls in a single bundled transaction.
Requests for the Wallet to broadcast a bundle of calls to the network.
Request#
_31type Request = {_31 method: 'wallet_sendCalls',_31 params: [{_31 /** Calls to prepare. */_31 calls: {_31 /** Recipient. */_31 to: `0x${string}`;_31 /** Calldata. */_31 data?: `0x${string}`;_31 /** Value to transfer. */_31 value?: `0x${string}`;_31 }[];_31 /** _31 * Chain ID to send the calls to._31 * If not provided, the current chain will be used._31 */_31 chainId?: `0x${string}`;_31 /** _31 * Address of the account to send the calls from._31 * If not provided, the Account will be filled by the Wallet._31 */_31 from?: `0x${string}`;_31 /** Capabilities. */_31 capabilities?: {_31 permissions?: {_31 /** ID of the permission to use. */_31 id: `0x${string}`;_31 };_31 };_31 }]_31}
Response#
_10type Response = {_10 /** ID of the bundle. */_10 id: string;_10}
Example#
To make these instructions concrete, we have created a sample cross-app wallet called Rapidfire ID. To interact with it, you can find its SDK in the NPM package directory: @rapidfire/id.
You can check out the GitHub repository for Rapidfire Wallet to learn how to create your own wallet.
_15import RapidfireID from '@rapidfire/id'_15_15const rapidfire = new RapidfireID()_15const provider = rapidfire.getEthereumProvider()_15_15_15const response = await provider.request({ _15 method: 'wallet_sendCalls', _15 params: [{ _15 calls: [{ _15 to: '0xcafebabecafebabecafebabecafebabecafebabe', _15 value: '0x12345678', _15 }], _15 }] _15})
Mint ERC20 Tokens#
The example below demonstrates minting 100 EXP on the Odyssey testnet.
_26import RapidfireID from '@rapidfire/id'_26import { encodeFunctionData, parseAbi, parseEther } from 'viem'_26_26const rapidfire = new RapidfireID()_26const provider = rapidfire.getEthereumProvider()_26_26_26const [account] = await provider.request({_26 method: 'eth_accounts',_26})_26_26const hash = await provider.request({ _26 method: 'wallet_sendCalls', _26 params: [{ _26 calls: [{ _26 to: '0x706aa5c8e5cc2c67da21ee220718f6f6b154e75c', _26 data: encodeFunctionData({ _26 abi: parseAbi([ _26 'function mint(address, uint256)', _26 ]), _26 functionName: 'mint', _26 args: [account, parseEther('100')], _26 }), _26 }], _26 }], _26})