sendCalls

Send EIP-5792 calls to a wallet. This function works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792. Transactions will be bundled and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions.

This function is dependent on the wallet's support for EIP-5792 and could fail.

Example

import { createThirdwebClient } from "thirdweb";
import { sendCalls } from "thirdweb/wallets/eip5792";
const client = createThirdwebClient({ clientId: ... });
const wallet = createWallet("com.coinbase.wallet");
const sendTx1 = approve({
contract: USDT_CONTRACT,
amount: 100,
spender: "0x33d9B8BEfE81027E2C859EDc84F5636cbb202Ed6",
});
const sendTx2 = approve({
contract: USDT_CONTRACT,
amount: 100,
spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
});
const bundleId = await sendCalls({
wallet,
client,
calls: [sendTx1, sendTx2],
});

Sponsor transactions with a paymaster:

const bundleId = await sendCalls({
wallet,
client,
calls: [send1, send2],
capabilities: {
paymasterService: {
url: `https://${CHAIN.id}.bundler.thirdweb.com/${client.clientId}`
}
}
});
We recommend proxying any paymaster calls via an API route you setup and control.
function sendCalls(
options: SendCallsOptions<ID, [], AbiFunction>,
): Promise<SendCallsResult>;

Parameters

Type

let options: SendCallsOptions<ID, [], AbiFunction>;

Returns

let returnType: WalletSendCallsId;

The ID of the bundle of the calls.