Cleanup with defaults for fees/balances (#274)
This commit is contained in:
@@ -297,14 +297,14 @@ export default class ApiCombined extends ApiCalls {
|
||||
this.balanceFree(address),
|
||||
this.balanceReserved(address)
|
||||
],
|
||||
([freeBalance = new Balance(0), reservedBalance = new Balance(0)]: [Balance | undefined, Balance | undefined]): RxBalance => ({
|
||||
([freeBalance, reservedBalance]: [Balance | undefined, Balance | undefined]): RxBalance => ({
|
||||
address,
|
||||
freeBalance,
|
||||
freeBalance: freeBalance || new Balance(0),
|
||||
nominatedBalance: new Balance(0),
|
||||
reservedBalance,
|
||||
reservedBalance: reservedBalance || new Balance(0),
|
||||
stakingBalance: new Balance(0),
|
||||
votingBalance: new Balance(
|
||||
freeBalance.add(reservedBalance)
|
||||
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
@@ -127,12 +127,12 @@ export default class ApiQueries extends ApiBase {
|
||||
)
|
||||
.pipe(
|
||||
// @ts-ignore After upgrade to 6.3.2
|
||||
map(([baseFee = new Balance(0), byteFee = new Balance(0), creationFee = new Balance(0), existentialDeposit = new Balance(0), transferFee = new Balance(0)]: [Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined, Balance | undefined]) => ({
|
||||
baseFee,
|
||||
byteFee,
|
||||
creationFee,
|
||||
existentialDeposit,
|
||||
transferFee
|
||||
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)
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user