UNPKG

@ledgerhq/coin-icon

Version:
35 lines 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toIconResourcesRaw = toIconResourcesRaw; exports.fromIconResourcesRaw = fromIconResourcesRaw; exports.assignToAccountRaw = assignToAccountRaw; exports.assignFromAccountRaw = assignFromAccountRaw; const bignumber_js_1 = require("bignumber.js"); function toIconResourcesRaw(resources) { const { nonce, votingPower, totalDelegated } = resources; return { nonce, votingPower: votingPower.toString(), totalDelegated: totalDelegated.toString(), }; } function fromIconResourcesRaw(rawResources) { const { nonce, votingPower, totalDelegated } = rawResources; return { nonce, votingPower: new bignumber_js_1.BigNumber(votingPower || 0), totalDelegated: new bignumber_js_1.BigNumber(totalDelegated || 0), }; } function assignToAccountRaw(account, accountRaw) { const iconAccount = account; if (iconAccount.iconResources) { accountRaw.iconResources = toIconResourcesRaw(iconAccount.iconResources); } } function assignFromAccountRaw(accountRaw, account) { const iconResourcesRaw = accountRaw.iconResources; if (iconResourcesRaw) account.iconResources = fromIconResourcesRaw(iconResourcesRaw); } //# sourceMappingURL=serialization.js.map