UNPKG

leap-node

Version:

[![codecov](https://codecov.io/gh/leapdao/leap-node/branch/master/graph/badge.svg)](https://codecov.io/gh/leapdao/leap-node) [![Docker Repository on Quay](https://quay.io/repository/leapdao/leap-node/status "Docker Repository on Quay")](https://quay.io/re

17 lines (15 loc) 538 B
const { INVALID_PARAMS } = require('./constants'); const { BigInt } = require('jsbi-utils'); module.exports = async (bridgeState, address, tag = 'latest') => { if (tag !== 'latest') { /* eslint-disable no-throw-literal */ throw { code: INVALID_PARAMS, message: 'Only balance for latest block is supported', }; /* eslint-enable no-throw-literal */ } const balances = bridgeState.currentState.balances['0'] || {}; const balance = balances[address] || 0; return `0x${BigInt(balance).toString(16)}`; };