Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
([freeBalance, reservedBalance]: [Balance | undefined, Balance | undefined]): RxBalance => ({
address: accountId,
freeBalance: freeBalance || new Balance(0),
nominatedBalance: new Balance(0),
reservedBalance: reservedBalance || new Balance(0),
stakingBalance: new Balance(0),
votingBalance: new Balance(
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
)
})
);
([balance, nominators = []]: [RxBalance, Array]): RxBalance => {
const nominatedBalance = nominators.reduce((total, nominator: RxBalance) => {
return total.add(nominator.votingBalance);
}, new BN(0));
const result = {
...balance,
nominators,
nominatedBalance: new Balance(nominatedBalance),
stakingBalance: new Balance(
nominatedBalance.add(balance.votingBalance)
)
};
return result;
}
);
([freeBalance, reservedBalance]: [Balance | undefined, Balance | undefined]): RxBalance => ({
address: accountId,
freeBalance: freeBalance || new Balance(0),
nominatedBalance: new Balance(0),
reservedBalance: reservedBalance || new Balance(0),
stakingBalance: new Balance(0),
votingBalance: new Balance(
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
)
})
);
([freeBalance, reservedBalance]: [Balance | undefined, Balance | undefined]): RxBalance => ({
address: accountId,
freeBalance: freeBalance || new Balance(0),
nominatedBalance: new Balance(0),
reservedBalance: reservedBalance || new Balance(0),
stakingBalance: new Balance(0),
votingBalance: new Balance(
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
)
})
);
([freeBalance, reservedBalance]: [Balance | undefined, Balance | undefined]): RxBalance => ({
address: accountId,
freeBalance: freeBalance || new Balance(0),
nominatedBalance: new Balance(0),
reservedBalance: reservedBalance || new Balance(0),
stakingBalance: new Balance(0),
votingBalance: new Balance(
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
)
})
);
map(([baseFee, byteFee, creationFee, existentialDeposit, transferFee]: [Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined]) => ({
baseFee: baseFee || new Balance(0),
byteFee: byteFee || new Balance(0),
creationFee: creationFee || new Balance(0),
existentialDeposit: existentialDeposit || new Balance(0),
transferFee: transferFee || new Balance(0)
}))
);
map(([baseFee, byteFee, creationFee, existentialDeposit, transferFee]: [Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined]) => ({
baseFee: baseFee || new Balance(0),
byteFee: byteFee || new Balance(0),
creationFee: creationFee || new Balance(0),
existentialDeposit: existentialDeposit || new Balance(0),
transferFee: transferFee || new Balance(0)
}))
);
([freeBalance, reservedBalance]: [Balance | undefined, Balance | undefined]): RxBalance => ({
address: accountId,
freeBalance: freeBalance || new Balance(0),
nominatedBalance: new Balance(0),
reservedBalance: reservedBalance || new Balance(0),
stakingBalance: new Balance(0),
votingBalance: new Balance(
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
)
})
);
map(([baseFee, byteFee, creationFee, existentialDeposit, transferFee]: [Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined]) => ({
baseFee: baseFee || new Balance(0),
byteFee: byteFee || new Balance(0),
creationFee: creationFee || new Balance(0),
existentialDeposit: existentialDeposit || new Balance(0),
transferFee: transferFee || new Balance(0)
}))
);
([balance, nominators = []]: [RxBalance, Array]): RxBalance => {
const nominatedBalance = nominators.reduce((total, nominator: RxBalance) => {
return total.add(nominator.votingBalance);
}, new BN(0));
const result = {
...balance,
nominators,
nominatedBalance: new Balance(nominatedBalance),
stakingBalance: new Balance(
nominatedBalance.add(balance.votingBalance)
)
};
return result;
}
);