Contract class

A wrapper for interacting with deployed Ethereum contracts through JsonRPCProvider.

Constructors

Contract.new(RPCBase rpc)

Properties

hashCode int
The hash code for this object.
no setterinherited
rpc RPCBase
The remote procedure call (RPC) client used to communicate with the bundler.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

deployed(EthereumAddress? address, {BlockNum atBlock = const BlockNum.current()}) Future<bool>
Asynchronously checks whether a smart contract is deployed at the specified address.
getBalance(EthereumAddress? address, {BlockNum atBlock = const BlockNum.current()}) Future<EtherAmount>
Asynchronously retrieves the balance of an Ethereum address.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(EthereumAddress contractAddress, ContractAbi abi, String methodName, {List? params, EthereumAddress? sender}) Future<List>
Asynchronously calls a function on a smart contract with the provided parameters.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

encodeERC20ApproveCall(EthereumAddress address, EthereumAddress spender, EtherAmount amount) Uint8List
Encodes an ERC-20 token approval function call.
encodeERC20TransferCall(EthereumAddress address, EthereumAddress recipient, EtherAmount amount) Uint8List
Encodes an ERC-20 token transfer function call.
encodeERC721ApproveCall(EthereumAddress contractAddress, EthereumAddress to, BigInt tokenId) Uint8List
Encodes an ERC-721 token approval function call.
encodeERC721SafeTransferCall(EthereumAddress contractAddress, EthereumAddress from, EthereumAddress to, BigInt tokenId) Uint8List
Encodes an ERC-721 token safe transfer function call.
encodeFunctionCall(String methodName, EthereumAddress contractAddress, ContractAbi abi, List params) Uint8List
Encodes a function call for a smart contract.
execute(EthereumAddress walletAddress, {required EthereumAddress to, EtherAmount? amount, Uint8List? innerCallData, bool isSafe = false}) Uint8List
Encodes a function call to execute a user operation in a smart wallet.
executeBatch({required EthereumAddress walletAddress, required List<EthereumAddress> recipients, List<EtherAmount>? amounts, List<Uint8List>? innerCalls, bool isSafe = false}) Uint8List
Encodes a function call to execute a batch of operations in a smart wallet.
getContractFunction(String methodName, EthereumAddress contractAddress, ContractAbi abi) → ContractFunction
Retrieves a smart contract function by name from its ABI.
nftApproveUserOperation(EthereumAddress contractAddress, EthereumAddress owner, EthereumAddress spender, BigInt tokenId) UserOperation
Generates a user operation for approving the transfer of an ERC-721 token.
nftTransferUserOperation(EthereumAddress contractAddress, EthereumAddress owner, EthereumAddress recipient, BigInt tokenId) UserOperation
Generates a user operation for transferring an ERC-721 token.
tokenApproveUserOperation(EthereumAddress contractAddress, EthereumAddress owner, EthereumAddress spender, EtherAmount amount) UserOperation
Generates a user operation for approving the transfer of ERC-20 tokens.
tokenTransferUserOperation(EthereumAddress contractAddress, EthereumAddress owner, EthereumAddress recipient, EtherAmount amount) UserOperation
Generates a user operation for transferring ERC-20 tokens.