Skip to main content

Wallet API documentation

Directly integrate your dapp with the MetaMask extension.

MetaMask

wallet_sendCalls

Summary: Sends a batch of calls.

Requests that the wallet submits a batch of calls. Specified by EIP-5792.

Parameters

Calls
object
required

An object containing information about a batch of calls.

version
string
required

The version of the API format. This must be 2.0.0.

id
string

The ID of the batch of calls.

from
string
required

The sender's address.

Pattern: ^0x[0-9a-fA-F]{40}$

chainId
string
required

The EIP-155 chain ID of the calls. This must match the currently selected network in the wallet.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

atomicRequired
boolean
required

true if the wallet must execute all calls atomically. If false, the wallet may execute the calls sequentially without atomicity. If false and the wallet is capable of executing the calls atomically, it may do so.

calls
array
required

An array of call objects.

Call
object

An object containing information about the call.

to
string

The address of the call's recipient.

Pattern: ^0x[0-9a-fA-F]{40}$

data
string

The data to send with the call.

Pattern: ^0x[0-9a-f]*$

value
string

The value to send with the call.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

capabilities
object

Dapps can use this object to communicate with the wallet about supported capabilities.

capabilities
object

Dapps can use this object to communicate with the wallet about supported capabilities.

Returns

Batch result
object

An object containing information about the sent batch.

id
string

The ID of the batch of calls.

capabilities
object

Wallets can use this object to attach capability-specific metadata.

Errors

Code
Message
-32602
The wallet cannot parse the request.
-32000
Version not supported.
4001
User rejected the request.
4100
The requested account and/or method has not been authorized by the user.
5700
The wallet does not support a capability that was not marked as optional.
5710
EIP-7702 not supported on the specified chain ID.
5720
There is already a batch submitted with the specified batch ID.
5740
The batch is too large for the wallet to process.
5750
EIP-7702 upgrade rejected for this chain and account.
Customize request
Parameter
Value
string
string
string
string
trueboolean
[ { "to": "0x54f1C1965B355e1AB9ec3465616136be35bb5Ff7", "value": "0x0" }, { "to": "0x2D48e6f5Ae053e4E918d2be53570961D880905F2", "value": "0x0" } ]
array
{}
object

Connect your MetaMask wallet to run requests successfully.

Request

await window.ethereum.request({
"method": "wallet_sendCalls",
"params": [
{
version: "2.0.0",
from: "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
chainId: "0xaa36a7",
atomicRequired: true,
calls: [
{
to: "0x54f1C1965B355e1AB9ec3465616136be35bb5Ff7",
value: "0x0"
},
{
to: "0x2D48e6f5Ae053e4E918d2be53570961D880905F2",
value: "0x0"
}
]
}
],
});

Example response

{
"id": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}