UNPKG

parsec-node

Version:

https://parseclabs.readthedocs.io/en/latest/

16 lines (14 loc) 488 B
const { INVALID_PARAMS } = require('./constants'); 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${balance.toString(16)}`; };