Ethereum
A plugin for interacting with the Ethereum blockchain
Last updated
Was this helpful?
A plugin for interacting with the Ethereum blockchain
Last updated
Was this helpful?
To use this plugin, you must include an ethereumConfig
object as a part of the LearnCardConfig parameter for initLearnCard
The Ethereum network to connect to. This is an ethers type, which can be a object, the name of a network as a string, or the chain ID of a network as a number.
Defaults to 'mainnet' if not provided
Returns the Ethereum public address associated with this wallet
Returns the token balance for this wallet for the given symbol or token address
await learnCard.getBalance('ETH')
symbolOrAddress - string (optional)
The ERC20 token address for the token you wish to check the balance of
learnCard.getBalance('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48') // USDC on mainnet
The token symbol for the token you wish to check the balance of
learnCard.getBalance('USDC')
Note: this will only work if the given symbol is recognized.
Defaults to 'ETH' if omitted
Returns the token balance for the given wallet address for the given symbol/token address
await learnCard.getBalanceForAddress('0xAddressToCheck', 'DAI')
walletAddress - string
The public address you wish to check the balance for
symbolOrAddress - string (optional)
Transfers tokens from this wallet to another wallet. Returns the transaction hash.
await wallet.transferTokens('USDC', 2.2, '0xAddressToSendTo')
tokenSymbolOrAddress - string
amount - number
The number of tokens you wish to transfer
toAddress - string
The address that you wish to send tokens to
Get the current gas price for the network
await wallet.getGasPrice()
Changes the current Ethereum network
Add or change the Infura project ID
infuraProjectId - string
The new infura project ID that you wish to use
The project ID that you would like to use to access the Ethereum network.
If not provided, the will be used.
Same as
Same as
Returns the current Ethereum network (type: )
_network -