Skip to main content

Wallet API documentation

Directly integrate your dapp with the MetaMask extension.

Ethereum API
Multichain API

eth_call

Summary: Executes a new message call immediately without creating a transaction on the block chain.

Parameters

Transaction
object

Transaction object generic to all types

type
string
Pattern: ^0x([0-9a-fA-F]?){1,2}$

type

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

nonce

to
oneOf

to address

Contract Creation (null)
null

Contract Creation (null)

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

hex encoded address

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

hex encoded address

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

gas limit

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

value

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

hex encoded bytes

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

The gas price willing to be paid by the sender in wei

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

Maximum fee per gas the sender is willing to pay to miners in wei

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

The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei

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

The maximum total fee per gas the sender is willing to pay for blob gas in wei

accessList
array of objects

EIP-2930 access list

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

hex encoded address

storageKeys
array of strings

blobVersionedHashes
array of strings

List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.

blobs
array of strings

Raw blob data.

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

Chain ID that this transaction is valid on.


Block
anyOf

Block number, tag, or block hash

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

Block number

Block tag
enum: earliest | finalized | safe | latest | pending

earliest: The lowest numbered block the client has available; finalized: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; safe: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; latest: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; pending: A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for finalized or safe block MUST be responded to with -39001: Unknown block error

32 byte hex value
string
Pattern: ^0x[0-9a-f]{64}$

32 byte hex value

Returns

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

hex encoded bytes

Customize request
Parameter
Value
string
string
0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13
oneOf
string
string
string
string
string
string
string
string
[]
array
[]
array
[]
array
string
latest
anyOf

Connect your MetaMask wallet to run requests successfully.

Request

await window.ethereum.request({
"method": "eth_call",
"params": [
{
to: "0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13",
value: "0x1"
},
"latest"
],
});

Example response

"0x"