How to use the eth-connect.fromWei function in eth-connect

To help you get started, we’ve selected a few eth-connect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentraland / explorer / kernel / packages / shared / ethereum / EthereumService.ts View on Github external
export async function getERC20Balance(
  address: string,
  tokenAddress: string,
  inWei: boolean = false
): Promise {
  const contract = await getERC20(requestManager, tokenAddress)

  const balance = await contract.balanceOf(address)

  if (inWei) {
    return balance
  }

  return fromWei(balance as any, 'ether') as any
}

eth-connect

Ethereum TypeScript API, middleware to talk to a ethereum node using an async provider

LGPL-3.0
Latest version published 11 months ago

Package Health Score

62 / 100
Full package analysis