EIP5792.sendAndConfirmCalls

Send and confirm calls in a single transaction.

This is a convenience function that sends the calls with sendCalls and then waits for the receipts with waitForCallsReceipt.

Example

const call1 = approve({
contract: USDT_CONTRACT,
amount: 100,
spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
});
const call2 = transfer({
contract: USDT_CONTRACT,
to: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
amount: 100,
});
const result = await sendAndConfirmCalls({
calls: [call1, call2],
wallet: wallet,
});
console.log("Transaction receipts:", result.receipts);
function sendAndConfirmCalls(
options: {
atomicRequired?: boolean;
calls: Array<PreparedSendCall<[], AbiFunction>>;
capabilities?: WalletCapabilities;
chain?: Readonly<ChainOptions & { rpc: string }>;
version?: string;
wallet: Wallet<ID>;
} & { maxBlocksWaitTime?: number },
): Promise<{
atomic: boolean;
chainId: number;
id: string;
receipts?: Array<WalletCallReceipt<bigint, "success" | "reverted">>;
status: undefined | "pending" | "success" | "failure";
statusCode: number;
version: string;
}>;

Parameters

The options for sending and confirming calls.

Type

let options: {
atomicRequired?: boolean;
calls: Array<PreparedSendCall<[], AbiFunction>>;
capabilities?: WalletCapabilities;
chain?: Readonly<ChainOptions & { rpc: string }>;
version?: string;
wallet: Wallet<ID>;
} & { maxBlocksWaitTime?: number };

Returns

let returnType: {
blockHash: Hex;
blockNumber: quantity;
gasUsed: quantity;
logs: Array<{ address: string; data: Hex; topics: Array<Hex> }>;
transactionHash: Hex;
};

The receipts of the calls.