The AbstractClient includes a writeContract method that can be used to call functions on a smart contract using the connected Abstract Global Wallet.

Usage

Parameters

address
Address
required

The address of the contract to write to.

abi
Abi
required

The ABI of the contract to write to.

functionName
string
required

The name of the function to call on the contract.

args
unknown[]

The arguments to pass to the function.

account
Account

The account to use for the transaction. By default, this is set to the Abstract Global Wallet’s account.

chain
Chain

The chain to use for the transaction. By default, this is set to the chain specified in the AbstractClient.

value
bigint

The amount of native token to send with the transaction (in wei).

dataSuffix
Hex

Data to append to the end of the calldata. Useful for adding a “domain” tag.

gasPerPubdata
bigint

The amount of gas for publishing one byte of data on Ethereum.

paymaster
Account | Address

Address of the paymaster smart contract that will pay the gas fees of the transaction.

paymasterInput
Hex

Input data to the paymaster. Required if paymaster is provided.

Returns

Returns a Promise<Hex> containing the transaction hash of the contract write operation.