TransactionsSend transactions

Send parallel transactions

This quide explains how to send multiple parallel transactions. Note that you don’t need to send parallel transactions for batching calls. This is for sending new transactions when, for example, there’s already a transaction in the mempool for a certain account.

Prerequisites

The nonceKey override must fit into a uint152!
Required SDK version: ^v4.61.0

See the sendCalls SDK reference for full descriptions of the parameters used in the following example.

Use the nonceOverride capability on the smart wallet client’s sendCalls or prepareCalls action.

You’ll need the following env variables:

1import { client, config } from "./client.ts";
2
3const [
4 { preparedCallIds: preparedCallIdsOne },
5 { preparedCallIds: preparedCallIdsTwo },
6] = await Promise.all([
7 client.sendCalls({
8 capabilities: {
9 paymasterService: {
10 policyId: config.policyId,
11 },
12 nonceOverride: {
13 nonceKey: "0x01",
14 },
15 },
16 calls: [
17 {
18 to: "0x0000000000000000000000000000000000000000",
19 value: "0x00",
20 data: "0x",
21 },
22 ],
23 }),
24 client.sendCalls({
25 capabilities: {
26 paymasterService: {
27 policyId: config.policyId,
28 },
29 nonceOverride: {
30 nonceKey: "0x02",
31 },
32 },
33 calls: [
34 {
35 to: "0x0000000000000000000000000000000000000000",
36 value: "0x00",
37 data: "0x",
38 },
39 ],
40 }),
41]);
42
43console.log("sendCalls result:", { preparedCallIdsOne, preparedCallIdsTwo });
44
45const callStatusResults = await Promise.all([
46 client.waitForCallsStatus({ id: preparedCallIdsOne[0]! }),
47 client.waitForCallsStatus({ id: preparedCallIdsTwo[0]! }),
48]);
49
50console.log("Calls status results:", callStatusResults);