Skip to main content

ERC20 Standard

You can utilize these features of the SDK if your contract implements the ERC20 standard.

Get Token Metadata

const token = await contract.erc20.get();

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation

Total Supply

Get how much supply has been minted

const balance = await contract.erc20.totalSupply();

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation

View Token Balance

Get the balance of this token for the given address.

// Address of the wallet to check token balance
const walletAddress = "{{wallet_address}}";
const balance = await contract.erc20.balanceOf(walletAddress);

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation

Transfer

Transfer tokens from one wallet to another

// Address of the wallet you want to send the tokens to
const toAddress = "0x...";
// The amount of tokens you want to send
const amount = 0.1;
await contract.erc20.transfer(toAddress, amount);

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation

Batch Transfer

Transfer tokens from the connected wallet to many wallets in one transaction.

This feature is missing a code snippet or might not be supported yet.

Check the React SDK documentation for more information.

Reach out on Discord for further assistance!
View React SDK Documentation

Token Allowance

Allowance refers to the number of tokens that a wallet is allowed to transfer on behalf of another wallet.

Grant Allowance

Allows the specified spender wallet to transfer the given amount of tokens to another wallet

// Address of the wallet to allow transfers from
const spenderAddress = "0x...";
// The number of tokens to give as allowance
const amount = 100
await contract.erc20.setAllowance(spenderAddress, amount);

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation

View Token Allowance

Get the allowance of one wallet over another wallet's funds - the allowance of a different address for a token is the amount of tokens that the wallet is allowed to spend on behalf of the specified wallet.

// Address of the wallet who owns the funds
const owner = "{{wallet_address}}";
// Address of the wallet to check token allowance
const spender = "0x...";
const allowance = await contract.erc20.allowanceOf(owner, spender);

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation