Ethereum
This page guides to create and use Ethereum Wallet instance in multichain-wallet-sdk.
Import Ethereum Wallet
import { EthereumWallet } from 'multichain-wallet-sdk';Reference
Create wallet SDK instance
class EthereumWallet(rpcUrl: string, privateKey?: string)
const ethereumWallet = new EthereumWallet("https://eth-mainnet.public.blastapi.io")Create new wallet
ethereumWallet.createWallet(nonce?: string) => EvmWallet
const wallet = ethereumWallet.createWallet()Recover wallet
ethereumWallet.recoverWallet(mnemonic: string, nonce?: number) => EvmWallet
Create master seed
ethereumWallet.createMasterSeedFromMnemonic(mnemonic: string) => Promise<Buffer>
Create account
ethereumWallet.createAccount(rootSeed: Buffer, nonce?: numer) => Promise<EvmAccount>
Recover account
ethereumWallet.importAccount(privateKey: string) => EvmAccount
Get ETH balance
ethereumWallet.getBalance(address?: string) => Promise<BigNumberish>
Get token detail
ethereumWallet.getToken(tokenAddress: string, address?: string, tokenId?: number) => Promise<EvmTokenDetail>
Get token balance
ethereumWallet.getTokenBalance(tokenAddress: string, address?: string) => Promise<BigInt>
Send payment transaction
ethereumWallet.sendEther(recipient: string, amount: string, gasPrice?: any, gasLimite?: any) => Promise<TransactionResponse>
Approve token
ethereumWallet.tokenApprove(tokenAddress: string, amount: string, recipient: string, gasPrice?: any, gasLimite?: any) => Promise<TransactionResponse>
Transfer token
ethereumWallet.tokenTransfer(tokenAddress: string, amount: any, recipient: string, gasPrice?: any, gasLimite?: any) => Promise<TransactionResponse>
Check contract address
ethereumWallet.isContractAddress(address: string) => Promise<boolean>
Check NFT contract address
ethereumWallet.isNftContrat(address: string) => Promise<IsNFT>
Check ERC721 contract
ethereumWallet.isERC721NFT(address: string) => Promise<boolean>
Check ERC1155 contract
ethereumWallet.isERC1155NFT(address: string) => Promise<boolean>
Get contract instance
ethereumWallet.getContract(address: string, abi: InterfaceAbi) => Contract
Convert gwei to wei
ethereumWallet.util.gweiToWei(amount: string | number) => BigNumberish
Convert gwei to eth
ethereumWallet.util.gweiToEther(amount: string | number) => string
Convert wei to eth
ethereumWallet.util.weiToEther(amount: string | number) => string
Get JSON RPC server latency
ethereumWallet.util.getJsonRPCLatency(rpcUrl: string) => Promise<number>
Get WebSocket RPC server latency
ethereumWallet.util.getWebSocketRPCLatency(rpcUrl: string) => Promise<number>
Last updated