summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-06-16 09:40:10 -0300
committerSebastian <sebasjm@gmail.com>2023-06-16 09:40:10 -0300
commitd97f440f255966c4231c6c4923a3fff9662a58fd (patch)
tree0d31bc0582492a75e45b42c4c5bfef57c63c05bf
parentd0d7685f169ecad5ba29210973a9e59834c979c7 (diff)
downloadwallet-core-d97f440f255966c4231c6c4923a3fff9662a58fd.tar.gz
wallet-core-d97f440f255966c4231c6c4923a3fff9662a58fd.tar.bz2
wallet-core-d97f440f255966c4231c6c4923a3fff9662a58fd.zip
remove type literal
-rw-r--r--packages/taler-util/src/wallet-types.ts18
1 files changed, 15 insertions, 3 deletions
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index e33f9318d..b17860fc8 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -159,6 +159,18 @@ export const codecForGetBalanceDetailRequest =
.property("currency", codecForString())
.build("GetBalanceDetailRequest");
+/**
+ * How the amount should be interpreted in a transaction
+ * Effective = how the balance is change
+ * Raw = effective amount without fee
+ *
+ * Depending on the transaction, raw can be higher than effective
+ */
+export enum TransactionAmountMode {
+ Effective = "effective",
+ Raw = "raw",
+}
+
export type GetPlanForOperationRequest =
| GetPlanForWithdrawRequest
| GetPlanForDepositRequest;
@@ -172,7 +184,7 @@ export type GetPlanForOperationRequest =
interface GetPlanForWalletInitiatedOperation {
instructedAmount: AmountString;
- mode: "raw" | "effective";
+ mode: TransactionAmountMode;
}
interface GetPlanToCompleteOperation {
@@ -186,8 +198,8 @@ const codecForGetPlanForWalletInitiatedOperation = <
.property(
"mode",
codecForEither(
- codecForConstString("raw"),
- codecForConstString("effective"),
+ codecForConstString(TransactionAmountMode.Raw),
+ codecForConstString(TransactionAmountMode.Effective),
),
)
.property("instructedAmount", codecForAmountString());