Skip to main content

ERC20

Functionality available for contracts that implement the IERC20 interface.

Allowance

Get the allowance of another wallet address over the connected wallet's funds.

"Allowance" refers to the number of tokens that another wallet is allowed to spend on behalf of the connected wallet.

var data = await contract.ERC20.Allowance("{{spender_address}}");
Configuration

spender

The address of the wallet to check the allowance of.

Must be a string.

Return Value

A CurrencyValue struct is returned with the allowance available in the value property.

{
string name;
string symbol;
string decimals;
string value;
string displayValue;
}

AllowanceOf

The same as allowance, but allows you to specify the owner wallet to check, instead of using the connected wallet.

var data = await contract.ERC20.AllowanceOf("{{owner_address}}", "{{spender_address}}");
Configuration

owner

The address of the wallet that owns the funds.

Must be a string.

spender

The address of the wallet to check the allowance of.

Must be a string.

Return Value

A CurrencyValue struct is returned with the allowance available in the value property.

{
string name;
string symbol;
string decimals;
string value;
string displayValue;
}

Balance

View the balance (i.e. number of tokens) the connected wallet has in their wallet from this contract.

var data = await contract.ERC20.Balance();
Configuration

Return Value

A CurrencyValue struct is returned with the allowance available in the value property.

{
string name;
string symbol;
string decimals;
string value;
string displayValue;
}

BalanceOf

The same as balance, but allows you to specify the wallet address to check, instead of using the connected wallet.

var data = await contract.ERC20.BalanceOf("{{wallet_address}}");
Configuration

address

The address of the wallet to check the balance of.

Must be a string.

Return Value

A CurrencyValue struct is returned with the allowance available in the value property.

{
string name;
string symbol;
string decimals;
string value;
string displayValue;
}

Get

Get the metadata of the token smart contract, such as the name, symbol, and decimals.

var data = await contract.ERC20.Get();
Configuration

Return Value

{
string name;
string symbol;
string decimals;
}

SetAllowance

Grant allowance to another wallet address to spend the connected wallet's funds (of this token).

var data = await contract.ERC20.SetAllowance("{{spender_address}}", 1);
Configuration

spender

The address of the wallet to grant allowance to.

Must be a string.

amount

The number of tokens to give as allowance.

Must be an int.

TotalSupply

Get the number of tokens in circulation for this contract.

var data = await contract.ERC20.TotalSupply();
Configuration

Return Value

A CurrencyValue struct is returned with the allowance available in the value property.

{
string name;
string symbol;
string decimals;
}

Transfer

Transfer tokens from the connected wallet to another wallet.

var data = await contract.ERC20.Transfer("{{wallet_address}}", "{{amount}}");
Configuration

to

The address of the wallet to send the tokens to.

Must be a string.

amount

The amount of tokens to send.

Must be a string.