ERC20Contract class
ERC-20 token contract implementation.
Constructors
- ERC20Contract({required String address, required PublicClient publicClient, WalletClient? walletClient})
Properties
- address → String
-
The contract address.
finalinherited
-
errors
→ List<
AbiError> -
The contract errors.
finalinherited
-
events
→ List<
AbiEvent> -
The contract events.
finalinherited
-
functions
→ List<
AbiFunction> -
The contract functions.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- publicClient → PublicClient
-
The public client for read operations.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- walletClient → WalletClient?
-
The wallet client for write operations (optional).
finalinherited
Methods
-
allowance(
String owner, String spender) → Future< BigInt> - Gets the allowance from owner to spender.
-
approvalFilter(
{String? owner, String? spender}) → EventFilter - Creates a filter for Approval events.
-
approve(
String spender, BigInt amount) → Future< String> - Approves a spender to spend tokens.
-
balanceOf(
String account) → Future< BigInt> - Gets the balance of an account.
-
createEventFilter(
String eventName, {Map< String, dynamic> ? indexedArgs, String? fromBlock, String? toBlock}) → EventFilter -
Creates an event filter for the specified event.
inherited
-
decimals(
) → Future< int> - Gets the token decimals.
-
decodeError(
Uint8List data) → String? -
Decodes an error from revert data.
inherited
-
decodeEventLog(
Log log) → Map< String, dynamic> ? -
Decodes an event log.
inherited
-
estimateGas(
String functionName, List args, {String? from, BigInt? value}) → Future< BigInt> -
Estimates gas for a contract function call.
inherited
-
name(
) → Future< String> - Gets the token name.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String functionName, List args, [String block = 'latest']) → Future< List> -
Executes a read-only contract function call.
inherited
-
simulate(
String functionName, List args, {String? from, BigInt? value, String block = 'latest'}) → Future< SimulateResult> -
Simulates a contract function call.
inherited
-
symbol(
) → Future< String> - Gets the token symbol.
-
toString(
) → String -
A string representation of this object.
inherited
-
totalSupply(
) → Future< BigInt> - Gets the total supply.
-
transfer(
String to, BigInt amount) → Future< String> - Transfers tokens to another account.
-
transferFilter(
{String? from, String? to}) → EventFilter - Creates a filter for Transfer events.
-
transferFrom(
String from, String to, BigInt amount) → Future< String> - Transfers tokens from one account to another (requires allowance).
-
write(
String functionName, List args, {BigInt? value, BigInt? gasLimit, BigInt? gasPrice, BigInt? maxFeePerGas, BigInt? maxPriorityFeePerGas}) → Future< String> -
Executes a state-changing contract function.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited