aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-03-31 14:50:59 -0300
committerSebastian <sebasjm@gmail.com>2023-03-31 14:50:59 -0300
commitb08bb05a40ac42399bae12d65af4c5489c216786 (patch)
tree207fd85850e2fa2c11211c3345f60057c5afb405
parenta8d30ef0f91cd7d36a30aeaad1d2df98d444692e (diff)
downloadwallet-core-b08bb05a40ac42399bae12d65af4c5489c216786.tar.xz
save wire fee instead of effective amount
-rw-r--r--packages/taler-util/src/transactions-types.ts4
-rw-r--r--packages/taler-wallet-core/src/db.ts4
-rw-r--r--packages/taler-wallet-core/src/dbless.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/deposits.ts3
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.test.ts2
6 files changed, 8 insertions, 9 deletions
diff --git a/packages/taler-util/src/transactions-types.ts b/packages/taler-util/src/transactions-types.ts
index 1d7e6ef30..d3b68b114 100644
--- a/packages/taler-util/src/transactions-types.ts
+++ b/packages/taler-util/src/transactions-types.ts
@@ -586,8 +586,8 @@ export interface TransactionDeposit extends TransactionCommon {
timestampExecuted: TalerProtocolTimestamp;
// Total amount transfer for this wtid (including fees)
amountRaw: AmountString;
- // Total amount received for this wtid (without fees)
- amountEffective: AmountString;
+ // Wire fee amount for this exchange
+ wireFee: AmountString;
}>;
}
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index fb5ea025a..9ee157a2a 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1680,8 +1680,8 @@ export interface DepositGroupRecord {
timestampExecuted: TalerProtocolTimestamp;
// Total amount transfer for this wtid (including fees)
amountRaw: AmountString;
- // Total amount received for this wtid (without fees)
- amountEffective: AmountString;
+ // Wire fee amount for this exchange
+ wireFee: AmountString;
exchangePub: string;
};
};
diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts
index 99596edd8..fe5eb6e3f 100644
--- a/packages/taler-wallet-core/src/dbless.ts
+++ b/packages/taler-wallet-core/src/dbless.ts
@@ -62,10 +62,10 @@ import {
import {
getBankStatusUrl,
getBankWithdrawalInfo,
- isWithdrawableDenom,
} from "./operations/withdraw.js";
import { ExchangeInfo } from "./operations/exchanges.js";
import { assembleRefreshRevealRequest } from "./operations/refresh.js";
+import { isWithdrawableDenom } from "./index.js";
const logger = new Logger("dbless.ts");
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts
index 64217acab..47efbb213 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -234,12 +234,11 @@ export async function processDepositGroup(
);
const raw = Amounts.parseOrThrow(track.coin_contribution);
const wireFee = Amounts.parseOrThrow(fee.wireFee);
- const effective = Amounts.sub(raw, wireFee).amount;
newWiredTransaction = {
value: {
amountRaw: Amounts.stringify(raw),
- amountEffective: Amounts.stringify(effective),
+ wireFee: Amounts.stringify(wireFee),
exchangePub: track.exchange_pub,
timestampExecuted: track.execution_time,
wireTransferId: track.wtid,
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index 28c3cda52..b37288079 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -61,9 +61,9 @@ import { updateExchangeFromUrl } from "./exchanges.js";
import {
getCandidateWithdrawalDenoms,
getExchangeWithdrawalInfo,
- selectWithdrawalDenominations,
updateWithdrawalDenoms,
} from "./withdraw.js";
+import { selectWithdrawalDenominations } from "../util/coinSelection.js";
const logger = new Logger("operations/tip.ts");
diff --git a/packages/taler-wallet-core/src/operations/withdraw.test.ts b/packages/taler-wallet-core/src/operations/withdraw.test.ts
index c77f75b9d..5a557b5de 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.test.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.test.ts
@@ -17,7 +17,7 @@
import { Amounts, DenomKeyType } from "@gnu-taler/taler-util";
import test from "ava";
import { DenominationRecord, DenominationVerificationStatus } from "../db.js";
-import { selectWithdrawalDenominations } from "./withdraw.js";
+import { selectWithdrawalDenominations } from "../util/coinSelection.js";
test("withdrawal selection bug repro", (t) => {
const amount = {