show reserve amount for reserve withdrawal via bank
This commit is contained in:
parent
6efc7e5600
commit
cf3aaee28a
@ -18,7 +18,7 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { InternalWalletState } from "./state";
|
import { InternalWalletState } from "./state";
|
||||||
import { Stores, ReserveRecordStatus, PurchaseRecord } from "../types/dbTypes";
|
import { Stores, ReserveRecordStatus, PurchaseRecord, WithdrawalSourceType } from "../types/dbTypes";
|
||||||
import { Amounts, AmountJson } from "../util/amounts";
|
import { Amounts, AmountJson } from "../util/amounts";
|
||||||
import { timestampCmp } from "../util/time";
|
import { timestampCmp } from "../util/time";
|
||||||
import {
|
import {
|
||||||
@ -152,7 +152,7 @@ export async function getTransactions(
|
|||||||
Stores.recoupGroups,
|
Stores.recoupGroups,
|
||||||
],
|
],
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
tx.iter(Stores.withdrawalGroups).forEach((wsr) => {
|
tx.iter(Stores.withdrawalGroups).forEachAsync(async (wsr) => {
|
||||||
if (
|
if (
|
||||||
shouldSkipCurrency(
|
shouldSkipCurrency(
|
||||||
transactionsRequest,
|
transactionsRequest,
|
||||||
@ -166,10 +166,22 @@ export async function getTransactions(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let amountRaw: AmountJson | undefined = undefined;
|
||||||
|
|
||||||
|
if (wsr.source.type === WithdrawalSourceType.Reserve) {
|
||||||
|
const r = await tx.get(Stores.reserves, wsr.source.reservePub);
|
||||||
|
if (r?.bankInfo?.amount) {
|
||||||
|
amountRaw = r.bankInfo.amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!amountRaw) {
|
||||||
|
amountRaw = wsr.denomsSel.totalWithdrawCost;
|
||||||
|
}
|
||||||
|
|
||||||
transactions.push({
|
transactions.push({
|
||||||
type: TransactionType.Withdrawal,
|
type: TransactionType.Withdrawal,
|
||||||
amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
|
amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
|
||||||
amountRaw: Amounts.stringify(wsr.denomsSel.totalWithdrawCost),
|
amountRaw: Amounts.stringify(amountRaw),
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
exchangeBaseUrl: wsr.exchangeBaseUrl,
|
exchangeBaseUrl: wsr.exchangeBaseUrl,
|
||||||
pending: !wsr.timestampFinish,
|
pending: !wsr.timestampFinish,
|
||||||
@ -202,7 +214,7 @@ export async function getTransactions(
|
|||||||
transactions.push({
|
transactions.push({
|
||||||
type: TransactionType.Withdrawal,
|
type: TransactionType.Withdrawal,
|
||||||
confirmed: false,
|
confirmed: false,
|
||||||
amountRaw: Amounts.stringify(r.bankInfo.denomSel.totalWithdrawCost),
|
amountRaw: Amounts.stringify(r.bankInfo.amount),
|
||||||
amountEffective: Amounts.stringify(
|
amountEffective: Amounts.stringify(
|
||||||
r.bankInfo.denomSel.totalCoinValue,
|
r.bankInfo.denomSel.totalCoinValue,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user