aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/operations/balance.ts36
-rw-r--r--src/operations/transactions.ts10
2 files changed, 23 insertions, 23 deletions
diff --git a/src/operations/balance.ts b/src/operations/balance.ts
index b503b7546..26f0aaeee 100644
--- a/src/operations/balance.ts
+++ b/src/operations/balance.ts
@@ -40,7 +40,6 @@ export async function getBalancesInsideTransaction(
ws: InternalWalletState,
tx: TransactionHandle,
): Promise<BalancesResponse> {
-
const balanceStore: Record<string, WalletBalance> = {};
/**
@@ -57,11 +56,17 @@ export async function getBalancesInsideTransaction(
};
}
return balanceStore[currency];
- }
+ };
// Initialize balance to zero, even if we didn't start withdrawing yet.
await tx.iter(Stores.reserves).forEach((r) => {
- initBalance(r.currency);
+ const b = initBalance(r.currency);
+ if (!r.initialWithdrawalStarted) {
+ b.pendingIncoming = Amounts.add(
+ b.pendingIncoming,
+ r.initialDenomSel.totalCoinValue,
+ ).amount;
+ }
});
await tx.iter(Stores.coins).forEach((c) => {
@@ -95,23 +100,28 @@ export async function getBalancesInsideTransaction(
return;
}
const b = initBalance(wds.denomsSel.totalWithdrawCost.currency);
- b.pendingIncoming = Amounts.add(b.pendingIncoming, wds.denomsSel.totalCoinValue).amount;
+ b.pendingIncoming = Amounts.add(
+ b.pendingIncoming,
+ wds.denomsSel.totalCoinValue,
+ ).amount;
});
const balancesResponse: BalancesResponse = {
balances: [],
};
- Object.keys(balanceStore).sort().forEach((c) => {
- const v = balanceStore[c];
- balancesResponse.balances.push({
- available: Amounts.stringify(v.available),
- pendingIncoming: Amounts.stringify(v.pendingIncoming),
- pendingOutgoing: Amounts.stringify(v.pendingOutgoing),
- hasPendingTransactions: false,
- requiresUserInput: false,
+ Object.keys(balanceStore)
+ .sort()
+ .forEach((c) => {
+ const v = balanceStore[c];
+ balancesResponse.balances.push({
+ available: Amounts.stringify(v.available),
+ pendingIncoming: Amounts.stringify(v.pendingIncoming),
+ pendingOutgoing: Amounts.stringify(v.pendingOutgoing),
+ hasPendingTransactions: false,
+ requiresUserInput: false,
+ });
});
- })
return balancesResponse;
}
diff --git a/src/operations/transactions.ts b/src/operations/transactions.ts
index fb0629660..647949d22 100644
--- a/src/operations/transactions.ts
+++ b/src/operations/transactions.ts
@@ -20,8 +20,6 @@
import { InternalWalletState } from "./state";
import {
Stores,
- ReserveRecordStatus,
- PurchaseRecord,
WithdrawalSourceType,
} from "../types/dbTypes";
import { Amounts, AmountJson } from "../util/amounts";
@@ -182,14 +180,6 @@ export async function getTransactions(
if (shouldSkipSearch(transactionsRequest, [])) {
return;
}
- switch (r.reserveStatus) {
- case ReserveRecordStatus.WAIT_CONFIRM_BANK:
- break;
- case ReserveRecordStatus.WITHDRAWING:
- break;
- default:
- return;
- }
if (r.initialWithdrawalStarted) {
return;
}