Extends
Constructors
new EVMWallet()
new EVMWallet(Defined in: packages/wallets/src/wallets/evm.ts:21wallet):EVMWallet
Parameters
| Parameter | Type |
|---|---|
wallet | Wallet<EVMSmartWalletChain> |
Returns
EVMWallet
Overrides
Wallet.constructor
Properties
| Property | Type | Inherited from | Defined in |
|---|---|---|---|
address | string | Wallet.address | packages/wallets/src/wallets/wallet.ts:62 |
alias? | string | Wallet.alias | packages/wallets/src/wallets/wallet.ts:64 |
chain | EVMSmartWalletChain | Wallet.chain | packages/wallets/src/wallets/wallet.ts:61 |
owner? | string | Wallet.owner | packages/wallets/src/wallets/wallet.ts:63 |
signer | Signer | Wallet.signer | packages/wallets/src/wallets/wallet.ts:65 |
Methods
addDelegatedSigner()
addDelegatedSigner<Defined in: packages/wallets/src/wallets/wallet.ts:465 Add a delegated signer to the walletT>(params):Promise<TextendsPrepareOnly<true> ?object:void>
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends AddDelegatedSignerOptions | undefined | undefined |
Parameters
| Parameter | Type |
|---|---|
params | { options: T; signer: string | { id: string; name: string; publicKey: { x: string; y: string; }; type: "passkey"; }; } |
params.options? | T |
params.signer | string | { id: string; name: string; publicKey: { x: string; y: string; }; type: "passkey"; } |
Returns
Promise<T extends PrepareOnly<true> ? object : void>
Inherited from
Wallet.addDelegatedSigner
approve()
approve<Defined in: packages/wallets/src/wallets/wallet.ts:423 Approve a transaction or signatureT>(params):Promise<ApproveResult<T>>
Type Parameters
| Type Parameter |
|---|
T extends ApproveParams |
Parameters
| Parameter | Type | Description |
|---|---|---|
params | T | The parameters |
Returns
Promise<ApproveResult<T>>
The transaction or signature
Inherited from
Wallet.approve
approveTransaction()
approveTransaction(Defined in: packages/wallets/src/wallets/wallet.ts:399params):Promise<Error>
Parameters
| Parameter | Type | Description |
|---|---|---|
params | ApproveParams | The parameters |
Returns
Promise<Error>
The transaction
Deprecated
Useapprove instead.
Approve a transaction
Inherited from
Wallet.approveTransaction
balances()
balances(Defined in: packages/wallets/src/wallets/wallet.ts:118 Get the wallet balances - always includes USDC and native token (ETH/SOL)tokens?):Promise<Balances<EVMSmartWalletChain>>
Parameters
| Parameter | Type | Description |
|---|---|---|
tokens? | string[] | Additional tokens to request (optional: native token and usdc are always included) |
Returns
Promise<Balances<EVMSmartWalletChain>>
The balances returns nativeToken, usdc, tokens
Throws
If the balances cannot be retrievedInherited from
Wallet.balances
delegatedSigners()
delegatedSigners():Defined in: packages/wallets/src/wallets/wallet.ts:554 List the delegated signers for this wallet.Promise<DelegatedSigner[]>
Returns
Promise<DelegatedSigner[]>
The delegated signers
Inherited from
Wallet.delegatedSigners
experimental_activity()
experimental_activity():Defined in: packages/wallets/src/wallets/wallet.ts:312Promise<WalletsV1Alpha2ActivityResponseDto>
Experimental
Get the wallet activity
Returns
Promise<WalletsV1Alpha2ActivityResponseDto>
The activity
This API is experimental and may change in the future
Throws
If the activity cannot be retrievedInherited from
Wallet.experimental_activity
experimental_apiClient()
experimental_apiClient(): WalletsApiClient
Defined in: packages/wallets/src/wallets/wallet.ts:101
Experimental
Get the API client
Returns
WalletsApiClient
The API client
This API is experimental and may change in the future
Inherited from
Wallet.experimental_apiClient
experimental_nfts()
experimental_nfts(Defined in: packages/wallets/src/wallets/wallet.ts:272params):Promise<WalletNftsResponseDto>
Experimental
Get the wallet NFTs
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { page: number; perPage: number; } | The parameters |
params.page | number | The page number |
params.perPage | number | The number of NFTs per page |
Returns
Promise<WalletNftsResponseDto>
The NFTs
This API is experimental and may change in the future
Inherited from
Wallet.experimental_nfts
experimental_transaction()
experimental_transaction(Defined in: packages/wallets/src/wallets/wallet.ts:298 Get a transaction by idtransactionId):Promise<WalletsTransactionV2025ResponseDto>
Parameters
| Parameter | Type |
|---|---|
transactionId | string |
Returns
Promise<WalletsTransactionV2025ResponseDto>
The transaction
Throws
If the transaction cannot be retrievedInherited from
Wallet.experimental_transaction
experimental_transactions()
experimental_transactions():Defined in: packages/wallets/src/wallets/wallet.ts:285 Get the wallet transactionsPromise<GetTransactionsResponse>
Returns
Promise<GetTransactionsResponse>
The transactions
Throws
If the transactions cannot be retrievedInherited from
Wallet.experimental_transactions
getViemClient()
getViemClient(Defined in: packages/wallets/src/wallets/evm.ts:203 Get a Viem public client instance configured for this wallet’s chain.params?):object
Parameters
| Parameter | Type | Description |
|---|---|---|
params? | { transport: HttpTransport; } | Optional transport configuration |
params.transport? | HttpTransport | - |
Returns
object
A Viem public client
account
account: undefined
The Account of the Client.
batch?
Flags for batch settings.optionalbatch:object
batch.multicall?
Toggle to enableoptionalmulticall:boolean| {batchSize:number;wait:number; }
eth_call multicall aggregation.
Type Declaration
boolean
{ batchSize: number; wait: number; }
cacheTime
cacheTime: number
Time (in ms) that cached data will remain in memory.
call()
call: (Executes a new message call immediately without submitting a transaction to the network.parameters) =>Promise<CallReturnType>
- Docs: https://viem.sh/docs/actions/public/call
- JSON-RPC Methods:
eth_call
Parameters
| Parameter | Type |
|---|---|
parameters | CallParameters<Chain> |
Returns
Promise<CallReturnType>
The call data. CallReturnType
Example
ccipRead?
CCIP Read configuration.optionalccipRead:false| {request: (parameters) =>Promise<`0x${string}`>; }
Type Declaration
false
{ request: (parameters) => Promise<`0x${string}`>; }
chain
chain: Chain
Chain for the client.
createAccessList()
createAccessList: (Creates an EIP-2930 access list that you can include in a transaction.parameters) =>Promise<{accessList:AccessList;gasUsed:bigint; }>
- Docs: https://viem.sh/docs/actions/public/createAccessList
- JSON-RPC Methods:
eth_createAccessList
Parameters
| Parameter | Type |
|---|---|
parameters | CreateAccessListParameters<Chain> |
Returns
Promise<{ accessList: AccessList; gasUsed: bigint; }>
The call data. CreateAccessListReturnType
Example
createBlockFilter()
createBlockFilter: () =>Creates a Filter to listen for new block hashes that can be used withPromise<{id:`0x${string}`;request:EIP1193RequestFn<readonly [{Method:"eth_getFilterChanges";Parameters: [`0x${string}`];ReturnType:`0x${string}`[] |RpcLog[]; }, {Method:"eth_getFilterLogs";Parameters: [`0x${string}`];ReturnType:RpcLog[]; }, {Method:"eth_uninstallFilter";Parameters: [`0x${string}`];ReturnType:boolean; }]>;type:"block"; }>
getFilterChanges.
- Docs: https://viem.sh/docs/actions/public/createBlockFilter
- JSON-RPC Methods:
eth_newBlockFilter
Returns
Promise<{ id: `0x${string}`; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges"; Parameters: [`0x${string}`]; ReturnType: `0x${string}`[] | RpcLog[]; }, { Method: "eth_getFilterLogs"; Parameters: [`0x${string}`]; ReturnType: RpcLog[]; }, { Method: "eth_uninstallFilter"; Parameters: [`0x${string}`]; ReturnType: boolean; }]>; type: "block"; }>
Filter. CreateBlockFilterReturnType
Example
createContractEventFilter()
createContractEventFilter: <Creates a Filter to retrieve event logs that can be used withabi,eventName,args,strict,fromBlock,toBlock>(args) =>Promise<CreateContractEventFilterReturnType<abi,eventName,args,strict,fromBlock,toBlock>>
getFilterChanges or getFilterLogs.
Type Parameters
| Type Parameter | Default type |
|---|---|
abi extends readonly unknown[] | Abi | - |
eventName extends string | undefined | - |
args extends readonly unknown[] | Record<string, unknown> | undefined | - |
strict extends boolean | undefined | undefined |
fromBlock extends bigint | BlockTag | undefined | undefined |
toBlock extends bigint | BlockTag | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | CreateContractEventFilterParameters<abi, eventName, args, strict, fromBlock, toBlock> | CreateContractEventFilterParameters |
Returns
Promise<CreateContractEventFilterReturnType<abi, eventName, args, strict, fromBlock, toBlock>>
Filter. CreateContractEventFilterReturnType
Example
createEventFilter()
createEventFilter: <Creates aabiEvent,abiEvents,strict,fromBlock,toBlock,_EventName,_Args>(args?) =>Promise<{ [K in string | number | symbol]: Filter<“event”, abiEvents, _EventName, _Args, strict, fromBlock, toBlock>[K] }>
Filter to listen for new events that can be used with getFilterChanges.
- Docs: https://viem.sh/docs/actions/public/createEventFilter
- JSON-RPC Methods:
eth_newFilter
Type Parameters
| Type Parameter | Default type |
|---|---|
abiEvent extends AbiEvent | undefined | undefined |
abiEvents extends readonly unknown[] | readonly AbiEvent[] | undefined | abiEvent extends AbiEvent ? [abiEvent] : undefined |
strict extends boolean | undefined | undefined |
fromBlock extends bigint | BlockTag | undefined | undefined |
toBlock extends bigint | BlockTag | undefined | undefined |
_EventName extends string | undefined | MaybeAbiEventName<abiEvent> |
_Args extends readonly unknown[] | Record<string, unknown> | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args? | CreateEventFilterParameters<abiEvent, abiEvents, strict, fromBlock, toBlock, _EventName, _Args> | CreateEventFilterParameters |
Returns
Promise<{ [K in string | number | symbol]: Filter<“event”, abiEvents, _EventName, _Args, strict, fromBlock, toBlock>[K] }>
Filter. CreateEventFilterReturnType
Example
createPendingTransactionFilter()
createPendingTransactionFilter: () =>Creates a Filter to listen for new pending transaction hashes that can be used withPromise<{id:`0x${string}`;request:EIP1193RequestFn<readonly [{Method:"eth_getFilterChanges";Parameters: [`0x${string}`];ReturnType:`0x${string}`[] |RpcLog[]; }, {Method:"eth_getFilterLogs";Parameters: [`0x${string}`];ReturnType:RpcLog[]; }, {Method:"eth_uninstallFilter";Parameters: [`0x${string}`];ReturnType:boolean; }]>;type:"transaction"; }>
getFilterChanges.
- Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter
- JSON-RPC Methods:
eth_newPendingTransactionFilter
Returns
Promise<{ id: `0x${string}`; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges"; Parameters: [`0x${string}`]; ReturnType: `0x${string}`[] | RpcLog[]; }, { Method: "eth_getFilterLogs"; Parameters: [`0x${string}`]; ReturnType: RpcLog[]; }, { Method: "eth_uninstallFilter"; Parameters: [`0x${string}`]; ReturnType: boolean; }]>; type: "transaction"; }>
Filter. CreateBlockFilterReturnType
Example
estimateContractGas()
estimateContractGas: <Estimates the gas required to successfully execute a contract write function call.chain,abi,functionName,args>(args) =>Promise<bigint>
Type Parameters
| Type Parameter |
|---|
chain extends Chain | undefined |
abi extends readonly unknown[] | Abi |
functionName extends string |
args extends unknown |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | EstimateContractGasParameters<abi, functionName, args, chain> | EstimateContractGasParameters |
Returns
Promise<bigint>
The gas estimate (in wei). EstimateContractGasReturnType
Remarks
Internally, uses a Public Client to call theestimateGas action with ABI-encoded data.
Example
estimateFeesPerGas()
estimateFeesPerGas: <Returns an estimate for the fees per gas for a transaction to be included in the next block.chainOverride,type>(args?) =>Promise<EstimateFeesPerGasReturnType<type>>
Type Parameters
| Type Parameter | Default type |
|---|---|
chainOverride extends Chain | undefined | undefined |
type extends FeeValuesType | "eip1559" |
Parameters
| Parameter | Type |
|---|---|
args? | EstimateFeesPerGasParameters<Chain, chainOverride, type> |
Returns
Promise<EstimateFeesPerGasReturnType<type>>
An estimate (in wei) for the fees per gas. EstimateFeesPerGasReturnType
Example
estimateGas()
estimateGas: (Estimates the gas necessary to complete a transaction without submitting it to the network.args) =>Promise<bigint>
- Docs: https://viem.sh/docs/actions/public/estimateGas
- JSON-RPC Methods:
eth_estimateGas
Parameters
| Parameter | Type | Description |
|---|---|---|
args | EstimateGasParameters<Chain> | EstimateGasParameters |
Returns
Promise<bigint>
The gas estimate (in wei). EstimateGasReturnType
Example
estimateMaxPriorityFeePerGas()
estimateMaxPriorityFeePerGas: <Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block.chainOverride>(args?) =>Promise<bigint>
Type Parameters
| Type Parameter | Default type |
|---|---|
chainOverride extends Chain | undefined | undefined |
Parameters
| Parameter | Type |
|---|---|
args? | { chain: chainOverride | null; } |
args.chain? | chainOverride | null |
Returns
Promise<bigint>
An estimate (in wei) for the max priority fee per gas. EstimateMaxPriorityFeePerGasReturnType
Example
experimental_blockTag?
Default block tag to use for RPC requests.optionalexperimental_blockTag:BlockTag
extend()
extend: <client>(fn) =>Client<HttpTransport,Chain,undefined,PublicRpcSchema, { [K in string | number | symbol]: client[K] } &PublicActions<HttpTransport,Chain>>
Type Parameters
| Type Parameter |
|---|
client extends object & ExactPartial<ExtendableProtectedActions<HttpTransport, Chain, undefined>> |
Parameters
| Parameter | Type |
|---|---|
fn | (client) => client |
Returns
Client<HttpTransport, Chain, undefined, PublicRpcSchema, { [K in string | number | symbol]: client[K] } & PublicActions<HttpTransport, Chain>>
getBalance()
getBalance: (Returns the balance of an address in wei.args) =>Promise<bigint>
- Docs: https://viem.sh/docs/actions/public/getBalance
- JSON-RPC Methods:
eth_getBalance
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetBalanceParameters | GetBalanceParameters |
Returns
Promise<bigint>
The balance of the address in wei. GetBalanceReturnType
Remarks
You can convert the balance to ether units withformatEther.
Example
getBlobBaseFee()
getBlobBaseFee: () =>Returns the base fee per blob gas in wei.Promise<bigint>
- Docs: https://viem.sh/docs/actions/public/getBlobBaseFee
- JSON-RPC Methods:
eth_blobBaseFee
Returns
Promise<bigint>
The blob base fee (in wei). GetBlobBaseFeeReturnType
Example
getBlock()
getBlock: <Returns information about a block at a block number, hash, or tag.includeTransactions,blockTag>(args?) =>Promise<{baseFeePerGas:bigint|null;blobGasUsed:bigint;difficulty:bigint;excessBlobGas:bigint;extraData:`0x${string}`;gasLimit:bigint;gasUsed:bigint;hash:blockTagextends"pending"?null:`0x${string}`;logsBloom:blockTagextends"pending"?null:`0x${string}`;miner:`0x${string}`;mixHash:`0x${string}`;nonce:blockTagextends"pending"?null:`0x${string}`;number:blockTagextends"pending"?null:bigint;parentBeaconBlockRoot:`0x${string}`;parentHash:`0x${string}`;receiptsRoot:`0x${string}`;sealFields:`0x${string}`[];sha3Uncles:`0x${string}`;size:bigint;stateRoot:`0x${string}`;timestamp:bigint;totalDifficulty:bigint|null;transactions:includeTransactionsextendstrue? ({accessList:undefined;authorizationList:undefined;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:bigint;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:undefined;maxPriorityFeePerGas:undefined;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"legacy";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:undefined; } | {accessList:AccessList;authorizationList:undefined;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:bigint;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:undefined;maxPriorityFeePerGas:undefined;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip2930";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; } | {accessList:AccessList;authorizationList:undefined;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:undefined;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:bigint;maxPriorityFeePerGas:bigint;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip1559";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; } | {accessList:AccessList;authorizationList:undefined;blobVersionedHashes: readonly`0x${string}`[];blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:undefined;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:bigint;maxFeePerGas:bigint;maxPriorityFeePerGas:bigint;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip4844";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; } | {accessList:AccessList;authorizationList:SignedAuthorizationList;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:undefined;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:bigint;maxPriorityFeePerGas:bigint;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip7702";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; })[] :`0x${string}`[];transactionsRoot:`0x${string}`;uncles:`0x${string}`[];withdrawals:Withdrawal[];withdrawalsRoot:`0x${string}`; }>
- Docs: https://viem.sh/docs/actions/public/getBlock
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
- JSON-RPC Methods:
- Calls
eth_getBlockByNumberforblockNumber&blockTag. - Calls
eth_getBlockByHashforblockHash.
- Calls
Type Parameters
| Type Parameter | Default type |
|---|---|
includeTransactions extends boolean | false |
blockTag extends BlockTag | "latest" |
Parameters
| Parameter | Type | Description |
|---|---|---|
args? | GetBlockParameters<includeTransactions, blockTag> | GetBlockParameters |
Returns
Promise<{ baseFeePerGas: bigint | null; blobGasUsed: bigint; difficulty: bigint; excessBlobGas: bigint; extraData: `0x${string}`; gasLimit: bigint; gasUsed: bigint; hash: blockTag extends "pending" ? null : `0x${string}`; logsBloom: blockTag extends "pending" ? null : `0x${string}`; miner: `0x${string}`; mixHash: `0x${string}`; nonce: blockTag extends "pending" ? null : `0x${string}`; number: blockTag extends "pending" ? null : bigint; parentBeaconBlockRoot: `0x${string}`; parentHash: `0x${string}`; receiptsRoot: `0x${string}`; sealFields: `0x${string}`[]; sha3Uncles: `0x${string}`; size: bigint; stateRoot: `0x${string}`; timestamp: bigint; totalDifficulty: bigint | null; transactions: includeTransactions extends true ? ({ accessList: undefined; authorizationList: undefined; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: undefined; maxPriorityFeePerGas: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "legacy"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: undefined; } | { accessList: AccessList; authorizationList: undefined; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: undefined; maxPriorityFeePerGas: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip2930"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; } | { accessList: AccessList; authorizationList: undefined; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip1559"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; } | { accessList: AccessList; authorizationList: undefined; blobVersionedHashes: readonly `0x${string}`[]; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip4844"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; } | { accessList: AccessList; authorizationList: SignedAuthorizationList; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip7702"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; })[] : `0x${string}`[]; transactionsRoot: `0x${string}`; uncles: `0x${string}`[]; withdrawals: Withdrawal[]; withdrawalsRoot: `0x${string}`; }>
Information about the block. GetBlockReturnType
Example
getBlockNumber()
getBlockNumber: (Returns the number of the most recent block seen.args?) =>Promise<bigint>
- Docs: https://viem.sh/docs/actions/public/getBlockNumber
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks
- JSON-RPC Methods:
eth_blockNumber
Parameters
| Parameter | Type | Description |
|---|---|---|
args? | GetBlockNumberParameters | GetBlockNumberParameters |
Returns
Promise<bigint>
The number of the block. GetBlockNumberReturnType
Example
getBlockTransactionCount()
getBlockTransactionCount: (Returns the number of Transactions at a block number, hash, or tag.args?) =>Promise<number>
- Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount
- JSON-RPC Methods:
- Calls
eth_getBlockTransactionCountByNumberforblockNumber&blockTag. - Calls
eth_getBlockTransactionCountByHashforblockHash.
- Calls
Parameters
| Parameter | Type | Description |
|---|---|---|
args? | GetBlockTransactionCountParameters | GetBlockTransactionCountParameters |
Returns
Promise<number>
The block transaction count. GetBlockTransactionCountReturnType
Example
getBytecode()
getBytecode: (args) =>Promise<GetCodeReturnType>
Parameters
| Parameter | Type |
|---|---|
args | GetCodeParameters |
Returns
Promise<GetCodeReturnType>
Deprecated
UsegetCode instead.
getChainId()
getChainId: () =>Returns the chain ID associated with the current network.Promise<number>
- Docs: https://viem.sh/docs/actions/public/getChainId
- JSON-RPC Methods:
eth_chainId
Returns
Promise<number>
The current chain ID. GetChainIdReturnType
Example
getCode()
getCode: (Retrieves the bytecode at an address.args) =>Promise<GetCodeReturnType>
- Docs: https://viem.sh/docs/contract/getCode
- JSON-RPC Methods:
eth_getCode
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetCodeParameters | GetBytecodeParameters |
Returns
Promise<GetCodeReturnType>
The contract’s bytecode. GetBytecodeReturnType
Example
getContractEvents()
getContractEvents: <Returns a list of event logs emitted by a contract.abi,eventName,strict,fromBlock,toBlock>(args) =>Promise<GetContractEventsReturnType<abi,eventName,strict,fromBlock,toBlock>>
- Docs: https://viem.sh/docs/actions/public/getContractEvents
- JSON-RPC Methods:
eth_getLogs
Type Parameters
| Type Parameter | Default type |
|---|---|
abi extends readonly unknown[] | Abi | - |
eventName extends string | undefined | undefined |
strict extends boolean | undefined | undefined |
fromBlock extends bigint | BlockTag | undefined | undefined |
toBlock extends bigint | BlockTag | undefined | undefined |
Parameters
| Parameter | Type |
|---|---|
args | GetContractEventsParameters<abi, eventName, strict, fromBlock, toBlock> |
Returns
Promise<GetContractEventsReturnType<abi, eventName, strict, fromBlock, toBlock>>
A list of event logs. GetContractEventsReturnType
Example
getEip712Domain()
getEip712Domain: (Reads the EIP-712 domain from a contract, based on the ERC-5267 specification.args) =>Promise<GetEip712DomainReturnType>
Parameters
| Parameter | Type |
|---|---|
args | GetEip712DomainParameters |
Returns
Promise<GetEip712DomainReturnType>
The EIP-712 domain, fields, and extensions. GetEip712DomainReturnType
Example
getEnsAddress()
getEnsAddress: (Gets address for ENS name.args) =>Promise<GetEnsAddressReturnType>
- Docs: https://viem.sh/docs/ens/actions/getEnsAddress
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { blockNumber: bigint; blockTag: BlockTag; coinType: number; gatewayUrls: string[]; name: string; strict: boolean; universalResolverAddress: `0x${string}`; } | GetEnsAddressParameters |
args.blockNumber? | bigint | The balance of the account at a block number. |
args.blockTag? | BlockTag | The balance of the account at a block tag. Default 'latest' |
args.coinType? | number | ENSIP-9 compliant coinType used to resolve addresses for other chains |
args.gatewayUrls? | string[] | Universal Resolver gateway URLs to use for resolving CCIP-read requests. |
args.name | string | Name to get the address for. |
args.strict? | boolean | Whether or not to throw errors propagated from the ENS Universal Resolver Contract. |
args.universalResolverAddress? | `0x${string}` | Address of ENS Universal Resolver Contract. |
Returns
Promise<GetEnsAddressReturnType>
Address for ENS name or null if not found. GetEnsAddressReturnType
Remarks
Callsresolve(bytes, bytes) on ENS Universal Resolver Contract.
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this.
Example
getEnsAvatar()
getEnsAvatar: (Gets the avatar of an ENS name.args) =>Promise<GetEnsAvatarReturnType>
- Docs: https://viem.sh/docs/ens/actions/getEnsAvatar
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { assetGatewayUrls: AssetGatewayUrls; blockNumber: bigint; blockTag: BlockTag; gatewayUrls: string[]; name: string; strict: boolean; universalResolverAddress: `0x${string}`; } | GetEnsAvatarParameters |
args.assetGatewayUrls? | AssetGatewayUrls | Gateway urls to resolve IPFS and/or Arweave assets. |
args.blockNumber? | bigint | The balance of the account at a block number. |
args.blockTag? | BlockTag | The balance of the account at a block tag. Default 'latest' |
args.gatewayUrls? | string[] | Universal Resolver gateway URLs to use for resolving CCIP-read requests. |
args.name | string | ENS name to get Text for. |
args.strict? | boolean | Whether or not to throw errors propagated from the ENS Universal Resolver Contract. |
args.universalResolverAddress? | `0x${string}` | Address of ENS Universal Resolver Contract. |
Returns
Promise<GetEnsAvatarReturnType>
Avatar URI or null if not found. GetEnsAvatarReturnType
Remarks
CallsgetEnsText with key set to 'avatar'.
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this.
Example
getEnsName()
getEnsName: (Gets primary name for specified address.args) =>Promise<GetEnsNameReturnType>
- Docs: https://viem.sh/docs/ens/actions/getEnsName
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { address: `0x${string}`; blockNumber: bigint; blockTag: BlockTag; gatewayUrls: string[]; strict: boolean; universalResolverAddress: `0x${string}`; } | GetEnsNameParameters |
args.address | `0x${string}` | Address to get ENS name for. |
args.blockNumber? | bigint | The balance of the account at a block number. |
args.blockTag? | BlockTag | The balance of the account at a block tag. Default 'latest' |
args.gatewayUrls? | string[] | Universal Resolver gateway URLs to use for resolving CCIP-read requests. |
args.strict? | boolean | Whether or not to throw errors propagated from the ENS Universal Resolver Contract. |
args.universalResolverAddress? | `0x${string}` | Address of ENS Universal Resolver Contract. |
Returns
Promise<GetEnsNameReturnType>
Name or null if not found. GetEnsNameReturnType
Remarks
Callsreverse(bytes) on ENS Universal Resolver Contract to “reverse resolve” the address to the primary ENS name.
Example
getEnsResolver()
getEnsResolver: (Gets resolver for ENS name.args) =>Promise<`0x${string}`>
- Docs: https://viem.sh/docs/ens/actions/getEnsResolver
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { blockNumber: bigint; blockTag: BlockTag; name: string; universalResolverAddress: `0x${string}`; } | GetEnsResolverParameters |
args.blockNumber? | bigint | The balance of the account at a block number. |
args.blockTag? | BlockTag | The balance of the account at a block tag. Default 'latest' |
args.name | string | Name to get the address for. |
args.universalResolverAddress? | `0x${string}` | Address of ENS Universal Resolver Contract. |
Returns
Promise<`0x${string}`>
Address for ENS resolver. GetEnsResolverReturnType
Remarks
CallsfindResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name.
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this.
Example
getEnsText()
getEnsText: (Gets a text record for specified ENS name.args) =>Promise<GetEnsTextReturnType>
- Docs: https://viem.sh/docs/ens/actions/getEnsResolver
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { blockNumber: bigint; blockTag: BlockTag; gatewayUrls: string[]; key: string; name: string; strict: boolean; universalResolverAddress: `0x${string}`; } | GetEnsTextParameters |
args.blockNumber? | bigint | The balance of the account at a block number. |
args.blockTag? | BlockTag | The balance of the account at a block tag. Default 'latest' |
args.gatewayUrls? | string[] | Universal Resolver gateway URLs to use for resolving CCIP-read requests. |
args.key | string | Text record to retrieve. |
args.name | string | ENS name to get Text for. |
args.strict? | boolean | Whether or not to throw errors propagated from the ENS Universal Resolver Contract. |
args.universalResolverAddress? | `0x${string}` | Address of ENS Universal Resolver Contract. |
Returns
Promise<GetEnsTextReturnType>
Address for ENS resolver. GetEnsTextReturnType
Remarks
Callsresolve(bytes, bytes) on ENS Universal Resolver Contract.
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this.
Example
getFeeHistory()
getFeeHistory: (Returns a collection of historical gas information.args) =>Promise<GetFeeHistoryReturnType>
- Docs: https://viem.sh/docs/actions/public/getFeeHistory
- JSON-RPC Methods:
eth_feeHistory
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetFeeHistoryParameters | GetFeeHistoryParameters |
Returns
Promise<GetFeeHistoryReturnType>
The gas estimate (in wei). GetFeeHistoryReturnType
Example
getFilterChanges()
getFilterChanges: <Returns a list of logs or hashes based on a Filter since the last time it was called.filterType,abi,eventName,strict,fromBlock,toBlock>(args) =>Promise<GetFilterChangesReturnType<filterType,abi,eventName,strict,fromBlock,toBlock>>
- Docs: https://viem.sh/docs/actions/public/getFilterChanges
- JSON-RPC Methods:
eth_getFilterChanges
Type Parameters
| Type Parameter | Default type |
|---|---|
filterType extends FilterType | - |
abi extends readonly unknown[] | Abi | undefined | - |
eventName extends string | undefined | - |
strict extends boolean | undefined | undefined |
fromBlock extends bigint | BlockTag | undefined | undefined |
toBlock extends bigint | BlockTag | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetFilterChangesParameters<filterType, abi, eventName, strict, fromBlock, toBlock> | GetFilterChangesParameters |
Returns
Promise<GetFilterChangesReturnType<filterType, abi, eventName, strict, fromBlock, toBlock>>
Logs or hashes. GetFilterChangesReturnType
Remarks
A Filter can be created from the following actions: Depending on the type of filter, the return value will be different:- If the filter was created with
createContractEventFilterorcreateEventFilter, it returns a list of logs. - If the filter was created with
createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with
createBlockFilter, it returns a list of block hashes.
Examples
getFilterLogs()
getFilterLogs: <Returns a list of event logs since the filter was created.abi,eventName,strict,fromBlock,toBlock>(args) =>Promise<GetFilterLogsReturnType<abi,eventName,strict,fromBlock,toBlock>>
- Docs: https://viem.sh/docs/actions/public/getFilterLogs
- JSON-RPC Methods:
eth_getFilterLogs
Type Parameters
| Type Parameter | Default type |
|---|---|
abi extends readonly unknown[] | Abi | undefined | - |
eventName extends string | undefined | - |
strict extends boolean | undefined | undefined |
fromBlock extends bigint | BlockTag | undefined | undefined |
toBlock extends bigint | BlockTag | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetFilterLogsParameters<abi, eventName, strict, fromBlock, toBlock> | GetFilterLogsParameters |
Returns
Promise<GetFilterLogsReturnType<abi, eventName, strict, fromBlock, toBlock>>
A list of event logs. GetFilterLogsReturnType
Remarks
getFilterLogs is only compatible with event filters.
Example
getGasPrice()
getGasPrice: () =>Returns the current price of gas (in wei).Promise<bigint>
- Docs: https://viem.sh/docs/actions/public/getGasPrice
- JSON-RPC Methods:
eth_gasPrice
Returns
Promise<bigint>
The gas price (in wei). GetGasPriceReturnType
Example
getLogs()
getLogs: <Returns a list of event logs matching the provided parameters.abiEvent,abiEvents,strict,fromBlock,toBlock>(args?) =>Promise<GetLogsReturnType<abiEvent,abiEvents,strict,fromBlock,toBlock>>
- Docs: https://viem.sh/docs/actions/public/getLogs
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/logs_event-logs
- JSON-RPC Methods:
eth_getLogs
Type Parameters
| Type Parameter | Default type |
|---|---|
abiEvent extends AbiEvent | undefined | undefined |
abiEvents extends readonly unknown[] | readonly AbiEvent[] | undefined | abiEvent extends AbiEvent ? [abiEvent] : undefined |
strict extends boolean | undefined | undefined |
fromBlock extends bigint | BlockTag | undefined | undefined |
toBlock extends bigint | BlockTag | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args? | GetLogsParameters<abiEvent, abiEvents, strict, fromBlock, toBlock> | GetLogsParameters |
Returns
Promise<GetLogsReturnType<abiEvent, abiEvents, strict, fromBlock, toBlock>>
A list of event logs. GetLogsReturnType
Example
getProof()
getProof: (Returns the account and storage values of the specified account including the Merkle-proof.args) =>Promise<GetProofReturnType>
- Docs: https://viem.sh/docs/actions/public/getProof
- JSON-RPC Methods:
- Calls
eth_getProof
- Calls
Parameters
| Parameter | Type |
|---|---|
args | GetProofParameters |
Returns
Promise<GetProofReturnType>
Proof data. GetProofReturnType
Example
getStorageAt()
getStorageAt: (Returns the value from a storage slot at a given address.args) =>Promise<GetStorageAtReturnType>
- Docs: https://viem.sh/docs/contract/getStorageAt
- JSON-RPC Methods:
eth_getStorageAt
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetStorageAtParameters | GetStorageAtParameters |
Returns
Promise<GetStorageAtReturnType>
The value of the storage slot. GetStorageAtReturnType
Example
getTransaction()
getTransaction: <Returns information about a Transaction given a hash or block identifier.blockTag>(args) =>Promise<{accessList:undefined;authorizationList:undefined;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:bigint;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:undefined;maxPriorityFeePerGas:undefined;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"legacy";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:undefined; } | {accessList:AccessList;authorizationList:undefined;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:bigint;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:undefined;maxPriorityFeePerGas:undefined;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip2930";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; } | {accessList:AccessList;authorizationList:undefined;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:undefined;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:bigint;maxPriorityFeePerGas:bigint;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip1559";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; } | {accessList:AccessList;authorizationList:undefined;blobVersionedHashes: readonly`0x${string}`[];blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:undefined;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:bigint;maxFeePerGas:bigint;maxPriorityFeePerGas:bigint;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip4844";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; } | {accessList:AccessList;authorizationList:SignedAuthorizationList;blobVersionedHashes:undefined;blockHash:blockTagextends"pending"?true:falseextendstrue?null:`0x${string}`;blockNumber:blockTagextends"pending"?true:falseextendstrue?null:bigint;chainId:number;from:`0x${string}`;gas:bigint;gasPrice:undefined;hash:`0x${string}`;input:`0x${string}`;maxFeePerBlobGas:undefined;maxFeePerGas:bigint;maxPriorityFeePerGas:bigint;nonce:number;r:`0x${string}`;s:`0x${string}`;to:`0x${string}`|null;transactionIndex:blockTagextends"pending"?true:falseextendstrue?null:number;type:"eip7702";typeHex:`0x${string}`|null;v:bigint;value:bigint;yParity:number; }>
- Docs: https://viem.sh/docs/actions/public/getTransaction
- Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
- JSON-RPC Methods:
eth_getTransactionByHash
Type Parameters
| Type Parameter | Default type |
|---|---|
blockTag extends BlockTag | "latest" |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetTransactionParameters<blockTag> | GetTransactionParameters |
Returns
Promise<{ accessList: undefined; authorizationList: undefined; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: undefined; maxPriorityFeePerGas: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "legacy"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: undefined; } | { accessList: AccessList; authorizationList: undefined; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: bigint; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: undefined; maxPriorityFeePerGas: undefined; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip2930"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; } | { accessList: AccessList; authorizationList: undefined; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip1559"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; } | { accessList: AccessList; authorizationList: undefined; blobVersionedHashes: readonly `0x${string}`[]; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip4844"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; } | { accessList: AccessList; authorizationList: SignedAuthorizationList; blobVersionedHashes: undefined; blockHash: blockTag extends "pending" ? true : false extends true ? null : `0x${string}`; blockNumber: blockTag extends "pending" ? true : false extends true ? null : bigint; chainId: number; from: `0x${string}`; gas: bigint; gasPrice: undefined; hash: `0x${string}`; input: `0x${string}`; maxFeePerBlobGas: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; r: `0x${string}`; s: `0x${string}`; to: `0x${string}` | null; transactionIndex: blockTag extends "pending" ? true : false extends true ? null : number; type: "eip7702"; typeHex: `0x${string}` | null; v: bigint; value: bigint; yParity: number; }>
The transaction information. GetTransactionReturnType
Example
getTransactionConfirmations()
getTransactionConfirmations: (Returns the number of blocks passed (confirmations) since the transaction was processed on a block.args) =>Promise<bigint>
- Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations
- Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
- JSON-RPC Methods:
eth_getTransactionConfirmations
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetTransactionConfirmationsParameters<Chain> | GetTransactionConfirmationsParameters |
Returns
Promise<bigint>
The number of blocks passed since the transaction was processed. If confirmations is 0, then the Transaction has not been confirmed & processed yet. GetTransactionConfirmationsReturnType
Example
getTransactionCount()
getTransactionCount: (Returns the number of Transactions an Account has broadcast / sent.args) =>Promise<number>
- Docs: https://viem.sh/docs/actions/public/getTransactionCount
- JSON-RPC Methods:
eth_getTransactionCount
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetTransactionCountParameters | GetTransactionCountParameters |
Returns
Promise<number>
The number of transactions an account has sent. GetTransactionCountReturnType
Example
getTransactionReceipt()
getTransactionReceipt: (Returns the Transaction Receipt given a Transaction hash.args) =>Promise<TransactionReceipt>
- Docs: https://viem.sh/docs/actions/public/getTransactionReceipt
- Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_fetching-transactions
- JSON-RPC Methods:
eth_getTransactionReceipt
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetTransactionReceiptParameters | GetTransactionReceiptParameters |
Returns
Promise<TransactionReceipt>
The transaction receipt. GetTransactionReceiptReturnType
Example
key
key: string
A key for the client.
multicall()
multicall: <Similar tocontracts,allowFailure>(args) =>Promise<MulticallReturnType<contracts,allowFailure>>
readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract.
Type Parameters
| Type Parameter | Default type |
|---|---|
contracts extends readonly unknown[] | - |
allowFailure extends boolean | true |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | MulticallParameters<contracts, allowFailure> | MulticallParameters |
Returns
Promise<MulticallReturnType<contracts, allowFailure>>
An array of results with accompanying status. MulticallReturnType
Example
name
name: string
A name for the client.
pollingInterval
pollingInterval: number
Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
prepareTransactionRequest()
prepareTransactionRequest: <Prepares a transaction request for signing.request,chainOverride,accountOverride>(args) =>Promise<{ [K in string | number | symbol]: (UnionRequiredBy<Extract<UnionOmit<(…), (…)> & ((…) extends (…) ? (…) : (…)) & ((…) extends (…) ? (…) : (…)), IsNever<(…)> extends true ? unknown : ExactPartial<(…)>> & { chainId?: number }, ParameterTypeToParameters<request[“parameters”] extends readonly PrepareTransactionRequestParameterType[] ? any[any][number] : “fees” | “gas” | “nonce” | “blobVersionedHashes” | “chainId” | “type”>> & (unknown extends request[“kzg”] ? {} : Pick<request, “kzg”>))[K] }>
Type Parameters
| Type Parameter | Default type |
|---|---|
request extends Omit<{ accessList: undefined; authorizationList: undefined; blobs: undefined; blobVersionedHashes: undefined; data: `0x${string}`; from: `0x${string}`; gas: bigint; gasPrice: bigint; kzg: undefined; maxFeePerBlobGas: undefined; maxFeePerGas: undefined; maxPriorityFeePerGas: undefined; nonce: number; sidecars: undefined; to: `0x${string}` | null; type: "legacy"; value: bigint; }, "from"> | Omit<{ accessList: AccessList; authorizationList: undefined; blobs: undefined; blobVersionedHashes: undefined; data: `0x${string}`; from: `0x${string}`; gas: bigint; gasPrice: bigint; kzg: undefined; maxFeePerBlobGas: undefined; maxFeePerGas: undefined; maxPriorityFeePerGas: undefined; nonce: number; sidecars: undefined; to: `0x${string}` | null; type: "eip2930"; value: bigint; }, "from"> | Omit<{ accessList: AccessList; authorizationList: undefined; blobs: undefined; blobVersionedHashes: undefined; data: `0x${string}`; from: `0x${string}`; gas: bigint; gasPrice: undefined; kzg: undefined; maxFeePerBlobGas: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; sidecars: undefined; to: `0x${string}` | null; type: "eip1559"; value: bigint; }, "from"> | Omit<{ accessList: AccessList; authorizationList: undefined; blobs: readonly `0x${string}`[] | readonly ByteArray[]; blobVersionedHashes: readonly `0x${string}`[]; data: `0x${string}`; from: `0x${string}`; gas: bigint; gasPrice: undefined; kzg: Kzg; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; sidecars: readonly BlobSidecar<`0x${string}`>[]; to: `0x${string}` | null; type: "eip4844"; value: bigint; }, "from"> | Omit<{ accessList: AccessList; authorizationList: AuthorizationList<number, boolean>; blobs: undefined; blobVersionedHashes: undefined; data: `0x${string}`; from: `0x${string}`; gas: bigint; gasPrice: undefined; kzg: undefined; maxFeePerBlobGas: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; nonce: number; sidecars: undefined; to: `0x${string}` | null; type: "eip7702"; value: bigint; }, "from"> & object & object | - |
chainOverride extends Chain | undefined | undefined |
accountOverride extends `0x${string}` | Account | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | PrepareTransactionRequestParameters<Chain, Account | undefined, chainOverride, accountOverride, request> | PrepareTransactionRequestParameters |
Returns
Promise<{ [K in string | number | symbol]: (UnionRequiredBy<Extract<UnionOmit<(…), (…)> & ((…) extends (…) ? (…) : (…)) & ((…) extends (…) ? (…) : (…)), IsNever<(…)> extends true ? unknown : ExactPartial<(…)>> & { chainId?: number }, ParameterTypeToParameters<request[“parameters”] extends readonly PrepareTransactionRequestParameterType[] ? any[any][number] : “fees” | “gas” | “nonce” | “blobVersionedHashes” | “chainId” | “type”>> & (unknown extends request[“kzg”] ? {} : Pick<request, “kzg”>))[K] }>
The transaction request. PrepareTransactionRequestReturnType
Examples
readContract()
readContract: <Calls a read-only function on a contract, and returns the response.abi,functionName,args>(args) =>Promise<ReadContractReturnType<abi,functionName,args>>
- Docs: https://viem.sh/docs/contract/readContract
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_reading-contracts
Type Parameters
| Type Parameter |
|---|
abi extends readonly unknown[] | Abi |
functionName extends string |
args extends unknown |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | ReadContractParameters<abi, functionName, args> | ReadContractParameters |
Returns
Promise<ReadContractReturnType<abi, functionName, args>>
The response from the contract. Type is inferred. ReadContractReturnType
Remarks
A “read-only” function (constant function) on a Solidity contract is denoted by aview or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
Internally, uses a Public Client to call the call action with ABI-encoded data.
Example
request
request:Request function wrapped with friendly error handlingEIP1193RequestFn<PublicRpcSchema>
sendRawTransaction()
sendRawTransaction: (Sends a signed transaction to the networkargs) =>Promise<`0x${string}`>
- Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction
- JSON-RPC Method:
eth_sendRawTransaction
Parameters
| Parameter | Type |
|---|---|
args | SendRawTransactionParameters |
Returns
Promise<`0x${string}`>
The transaction hash. SendRawTransactionReturnType
Example
simulate()
simulate: <calls>(args) =>Promise<SimulateBlocksReturnType<calls>>
Type Parameters
| Type Parameter |
|---|
calls extends readonly unknown[] |
Parameters
| Parameter | Type |
|---|---|
args | SimulateBlocksParameters<calls> |
Returns
Promise<SimulateBlocksReturnType<calls>>
Deprecated
UsesimulateBlocks instead.
simulateBlocks()
simulateBlocks: <Simulates a set of calls on block(s) with optional block and state overrides.calls>(args) =>Promise<SimulateBlocksReturnType<calls>>
Type Parameters
| Type Parameter |
|---|
calls extends readonly unknown[] |
Parameters
| Parameter | Type |
|---|---|
args | SimulateBlocksParameters<calls> |
Returns
Promise<SimulateBlocksReturnType<calls>>
Simulated blocks. SimulateReturnType
Example
simulateCalls()
simulateCalls: <Simulates a set of calls.calls>(args) =>Promise<SimulateCallsReturnType<calls>>
Type Parameters
| Type Parameter |
|---|
calls extends readonly unknown[] |
Parameters
| Parameter | Type |
|---|---|
args | SimulateCallsParameters<calls> |
Returns
Promise<SimulateCallsReturnType<calls>>
Results. SimulateCallsReturnType
Example
simulateContract()
simulateContract: <Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions.abi,functionName,args,chainOverride,accountOverride>(args) =>Promise<SimulateContractReturnType<abi,functionName,args,Chain,Account|undefined,chainOverride,accountOverride>>
- Docs: https://viem.sh/docs/contract/simulateContract
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts_writing-to-contracts
Type Parameters
| Type Parameter | Default type |
|---|---|
abi extends readonly unknown[] | Abi | - |
functionName extends string | - |
args extends unknown | - |
chainOverride extends Chain | undefined | - |
accountOverride extends `0x${string}` | Account | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | SimulateContractParameters<abi, functionName, args, Chain, chainOverride, accountOverride> | SimulateContractParameters |
Returns
Promise<SimulateContractReturnType<abi, functionName, args, Chain, Account | undefined, chainOverride, accountOverride>>
The simulation result and write request. SimulateContractReturnType
Remarks
This function does not require gas to execute and does not change the state of the blockchain. It is almost identical toreadContract, but also supports contract write functions.
Internally, uses a Public Client to call the call action with ABI-encoded data.
Example
transport
transport:The RPC transportTransportConfig<"http",EIP1193RequestFn> &object
Type Declaration
fetchOptions?
optionalfetchOptions:Omit<RequestInit,"body">
url?
optionalurl:string
type
type: string
The type of client.
uid
uid: string
A unique ID for the client.
uninstallFilter()
uninstallFilter: (Destroys a Filter that was created from one of the following Actions:args) =>Promise<boolean>
-
createBlockFilter -
createEventFilter -
createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter
-
JSON-RPC Methods:
eth_uninstallFilter
Parameters
| Parameter | Type | Description |
|---|---|---|
args | UninstallFilterParameters | UninstallFilterParameters |
Returns
Promise<boolean>
A boolean indicating if the Filter was successfully uninstalled. UninstallFilterReturnType
Example
verifyMessage()
verifyMessage: (Verify that a message was signed by the provided address. Compatible with Smart Contract Accounts & Externally Owned Accounts via ERC-6492.args) =>Promise<boolean>
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { address: `0x${string}`; blockNumber: bigint; blockTag: BlockTag; factory: `0x${string}`; factoryData: `0x${string}`; message: SignableMessage; signature: `0x${string}` | Signature | ByteArray; universalSignatureVerifierAddress: `0x${string}`; } | - |
args.address | `0x${string}` | The address that signed the original message. |
args.blockNumber? | bigint | The balance of the account at a block number. |
args.blockTag? | BlockTag | The balance of the account at a block tag. Default 'latest' |
args.factory? | `0x${string}` | - |
args.factoryData? | `0x${string}` | - |
args.message | SignableMessage | The message to be verified. |
args.signature | `0x${string}` | Signature | ByteArray | The signature that was generated by signing the message with the address’s private key. |
args.universalSignatureVerifierAddress? | `0x${string}` | - |
Returns
Promise<boolean>
Whether or not the signature is valid. VerifyMessageReturnType
verifySiweMessage()
verifySiweMessage: (Verifies EIP-4361 formatted message was signed. Compatible with Smart Contract Accounts & Externally Owned Accounts via ERC-6492.args) =>Promise<boolean>
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { address: `0x${string}`; blockNumber: bigint; blockTag: BlockTag; domain: string; message: string; nonce: string; scheme: string; signature: `0x${string}`; time: Date; } | - |
args.address? | `0x${string}` | Ethereum address to check against. |
args.blockNumber? | bigint | The balance of the account at a block number. |
args.blockTag? | BlockTag | The balance of the account at a block tag. Default 'latest' |
args.domain? | string | RFC 3986 authority to check against. |
args.message | string | EIP-4361 formatted message. |
args.nonce? | string | Random string to check against. |
args.scheme? | string | RFC 3986 URI scheme to check against. |
args.signature | `0x${string}` | Signature to check against. |
args.time? | Date | Current time to check optional expirationTime and notBefore fields. Default new Date() |
Returns
Promise<boolean>
Whether or not the signature is valid. VerifySiweMessageReturnType
verifyTypedData()
verifyTypedData: (Verify that typed data was signed by the provided address.args) =>Promise<boolean>
Parameters
| Parameter | Type |
|---|---|
args | VerifyTypedDataParameters |
Returns
Promise<boolean>
Whether or not the signature is valid. VerifyTypedDataReturnType
waitForTransactionReceipt()
waitForTransactionReceipt: (Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error.args) =>Promise<TransactionReceipt>
- Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt
- Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions_sending-transactions
- JSON-RPC Methods:
- Polls
eth_getTransactionReceipton each block until it has been processed. - If a Transaction has been replaced:
- Calls
eth_getBlockByNumberand extracts the transactions - Checks if one of the Transactions is a replacement
- If so, calls
eth_getTransactionReceipt.
- Calls
- Polls
Parameters
| Parameter | Type | Description |
|---|---|---|
args | WaitForTransactionReceiptParameters<Chain> | WaitForTransactionReceiptParameters |
Returns
Promise<TransactionReceipt>
The transaction receipt. WaitForTransactionReceiptReturnType
Remarks
ThewaitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions).
Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce.
There are 3 types of Transaction Replacement reasons:
repriced: The gas price has been modified (e.g. differentmaxFeePerGas)cancelled: The Transaction has been cancelled (e.g.value === 0n)replaced: The Transaction has been replaced (e.g. differentvalueordata)
Example
watchBlockNumber()
watchBlockNumber: (Watches and returns incoming block numbers.args) =>WatchBlockNumberReturnType
- Docs: https://viem.sh/docs/actions/public/watchBlockNumber
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
- JSON-RPC Methods:
- When
poll: true, callseth_blockNumberon a polling interval. - When
poll: false& WebSocket Transport, uses a WebSocket subscription viaeth_subscribeand the"newHeads"event.
- When
Parameters
| Parameter | Type | Description |
|---|---|---|
args | WatchBlockNumberParameters | WatchBlockNumberParameters |
Returns
WatchBlockNumberReturnType
A function that can be invoked to stop watching for new block numbers. WatchBlockNumberReturnType
Example
watchBlocks()
watchBlocks: <Watches and returns information for incoming blocks.includeTransactions,blockTag>(args) =>WatchBlocksReturnType
- Docs: https://viem.sh/docs/actions/public/watchBlocks
- Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_watching-blocks
- JSON-RPC Methods:
- When
poll: true, callseth_getBlockByNumberon a polling interval. - When
poll: false& WebSocket Transport, uses a WebSocket subscription viaeth_subscribeand the"newHeads"event.
- When
Type Parameters
| Type Parameter | Default type |
|---|---|
includeTransactions extends boolean | false |
blockTag extends BlockTag | "latest" |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | WatchBlocksParameters<HttpTransport, Chain, includeTransactions, blockTag> | WatchBlocksParameters |
Returns
WatchBlocksReturnType
A function that can be invoked to stop watching for new block numbers. WatchBlocksReturnType
Example
watchContractEvent()
watchContractEvent: <Watches and returns emitted contract event logs.abi,eventName,strict>(args) =>WatchContractEventReturnType
Type Parameters
| Type Parameter | Default type |
|---|---|
abi extends readonly unknown[] | Abi | - |
eventName extends string | - |
strict extends boolean | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | WatchContractEventParameters<abi, eventName, strict, HttpTransport> | WatchContractEventParameters |
Returns
WatchContractEventReturnType
A function that can be invoked to stop watching for new event logs. WatchContractEventReturnType
Remarks
This Action will batch up all the event logs found within thepollingInterval, and invoke them via onLogs.
watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead.
Example
watchEvent()
watchEvent: <Watches and returns emitted Event Logs.abiEvent,abiEvents,strict>(args) =>WatchEventReturnType
- Docs: https://viem.sh/docs/actions/public/watchEvent
- JSON-RPC Methods:
- RPC Provider supports
eth_newFilter:- Calls
eth_newFilterto create a filter (called on initialize). - On a polling interval, it will call
eth_getFilterChanges.
- Calls
- RPC Provider does not support
eth_newFilter:- Calls
eth_getLogsfor each block between the polling interval.
- Calls
- RPC Provider supports
Type Parameters
| Type Parameter | Default type |
|---|---|
abiEvent extends AbiEvent | undefined | undefined |
abiEvents extends readonly unknown[] | readonly AbiEvent[] | undefined | abiEvent extends AbiEvent ? [abiEvent] : undefined |
strict extends boolean | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | WatchEventParameters<abiEvent, abiEvents, strict, HttpTransport> | WatchEventParameters |
Returns
WatchEventReturnType
A function that can be invoked to stop watching for new Event Logs. WatchEventReturnType
Remarks
This Action will batch up all the Event Logs found within thepollingInterval, and invoke them via onLogs.
watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead.
Example
watchPendingTransactions()
watchPendingTransactions: (Watches and returns pending transaction hashes.args) =>WatchPendingTransactionsReturnType
- Docs: https://viem.sh/docs/actions/public/watchPendingTransactions
- JSON-RPC Methods:
- When
poll: true- Calls
eth_newPendingTransactionFilterto initialize the filter. - Calls
eth_getFilterChangeson a polling interval.
- Calls
- When
poll: false& WebSocket Transport, uses a WebSocket subscription viaeth_subscribeand the"newPendingTransactions"event.
- When
Parameters
| Parameter | Type | Description |
|---|---|---|
args | WatchPendingTransactionsParameters<HttpTransport> | WatchPendingTransactionsParameters |
Returns
WatchPendingTransactionsReturnType
A function that can be invoked to stop watching for new pending transaction hashes. WatchPendingTransactionsReturnType
Remarks
This Action will batch up all the pending transactions found within thepollingInterval, and invoke them via onTransactions.
Example
send()
send<Defined in: packages/wallets/src/wallets/wallet.ts:335 Send a token to a wallet or user locatorT>(to,token,amount,options?):Promise<Transaction<TextendsPrepareOnly<true> ?true:false>>
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends SendTokenTransactionOptions | undefined | undefined |
Parameters
| Parameter | Type | Description |
|---|---|---|
to | string | UserLocator | The recipient (address or user locator) |
token | string | The token (address or currency symbol) |
amount | string | The amount to send (decimal units) |
options? | T | The options for the transaction |
Returns
Promise<Transaction<T extends PrepareOnly<true> ? true : false>>
The transaction
Inherited from
Wallet.send
sendTransaction()
sendTransaction<Defined in: packages/wallets/src/wallets/evm.ts:55 Send a raw EVM transaction.T>(params):Promise<Transaction<T["options"] extendsPrepareOnly<true> ?true:false>>
Type Parameters
| Type Parameter |
|---|
T extends EVMTransactionInput |
Parameters
| Parameter | Type | Description |
|---|---|---|
params | T | The transaction parameters (raw transaction, ABI call, or encoded data) |
Returns
Promise<Transaction<T["options"] extends PrepareOnly<true> ? true : false>>
The transaction result
signMessage()
signMessage<Defined in: packages/wallets/src/wallets/evm.ts:95 Sign a message with the wallet’s private key.T>(params):Promise<Signature<T["options"] extendsPrepareOnly<true> ?true:false>>
Type Parameters
| Type Parameter |
|---|
T extends SignMessageInput |
Parameters
| Parameter | Type | Description |
|---|---|---|
params | T | The message to sign |
Returns
Promise<Signature<T["options"] extends PrepareOnly<true> ? true : false>>
The signature
signTypedData()
signTypedData<Defined in: packages/wallets/src/wallets/evm.ts:141 Sign EIP-712 typed data.T>(params):Promise<Signature<T["options"] extendsPrepareOnly<true> ?true:false>>
Type Parameters
| Type Parameter |
|---|
T extends SignTypedDataInput |
Parameters
| Parameter | Type | Description |
|---|---|---|
params | T | The typed data parameters (domain, types, message, primaryType, chain) |
Returns
Promise<Signature<T["options"] extends PrepareOnly<true> ? true : false>>
The signature
stagingFund()
stagingFund(Defined in: packages/wallets/src/wallets/wallet.ts:166 Funds the wallet with Crossmint’s stablecoin (USDXM). Note: This method is only available in staging environments and exclusively supports USDXM tokens. It cannot be used in production environments.amount,chain?):Promise<FundWalletResponse>
Parameters
| Parameter | Type | Description |
|---|---|---|
amount | number | The amount of USDXM to fund the wallet with |
chain? | Chain | Optional chain to fund on. If not provided, uses the wallet’s default chain |
Returns
Promise<FundWalletResponse>
The funding response
Throws
If the funding operation fails or if called in a production environmentInherited from
Wallet.stagingFund
from()
Defined in: packages/wallets/src/wallets/evm.ts:35staticfrom(wallet):EVMWallet
Parameters
Returns
EVMWallet
