Management API Reference

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#


_31
type 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#


_10
type 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.


_15
import RapidfireID from '@rapidfire/id'
_15
_15
const rapidfire = new RapidfireID()
_15
const provider = rapidfire.getEthereumProvider()
_15
_15
_15
const 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.


_26
import RapidfireID from '@rapidfire/id'
_26
import { encodeFunctionData, parseAbi, parseEther } from 'viem'
_26
_26
const rapidfire = new RapidfireID()
_26
const provider = rapidfire.getEthereumProvider()
_26
_26
_26
const [account] = await provider.request({
_26
method: 'eth_accounts',
_26
})
_26
_26
const 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
})