@ledgerhq/coin-icon
Version:
Ledger Icon Coin integration
29 lines • 1.03 kB
JavaScript
import { BigNumber } from "bignumber.js";
export function toIconResourcesRaw(resources) {
const { nonce, votingPower, totalDelegated } = resources;
return {
nonce,
votingPower: votingPower.toString(),
totalDelegated: totalDelegated.toString(),
};
}
export function fromIconResourcesRaw(rawResources) {
const { nonce, votingPower, totalDelegated } = rawResources;
return {
nonce,
votingPower: new BigNumber(votingPower || 0),
totalDelegated: new BigNumber(totalDelegated || 0),
};
}
export function assignToAccountRaw(account, accountRaw) {
const iconAccount = account;
if (iconAccount.iconResources) {
accountRaw.iconResources = toIconResourcesRaw(iconAccount.iconResources);
}
}
export function assignFromAccountRaw(accountRaw, account) {
const iconResourcesRaw = accountRaw.iconResources;
if (iconResourcesRaw)
account.iconResources = fromIconResourcesRaw(iconResourcesRaw);
}
//# sourceMappingURL=serialization.js.map