summaryrefslogtreecommitdiff
path: root/packages/taler-util/src/ReserveTransaction.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src/ReserveTransaction.ts')
-rw-r--r--packages/taler-util/src/ReserveTransaction.ts99
1 files changed, 54 insertions, 45 deletions
diff --git a/packages/taler-util/src/ReserveTransaction.ts b/packages/taler-util/src/ReserveTransaction.ts
index b282ef189..7a3c69d07 100644
--- a/packages/taler-util/src/ReserveTransaction.ts
+++ b/packages/taler-util/src/ReserveTransaction.ts
@@ -23,6 +23,7 @@
/**
* Imports.
*/
+import { codecForAmountString } from "./amounts.js";
import {
codecForString,
buildCodecForObject,
@@ -37,8 +38,12 @@ import {
EddsaSignatureString,
EddsaPublicKeyString,
CoinPublicKeyString,
-} from "./talerTypes";
-import { Timestamp, codecForTimestamp } from "./time.js";
+} from "./taler-types.js";
+import {
+ AbsoluteTime,
+ codecForTimestamp,
+ TalerProtocolTimestamp,
+} from "./time.js";
export enum ReserveTransactionType {
Withdraw = "WITHDRAW",
@@ -98,7 +103,7 @@ export interface ReserveCreditTransaction {
/**
* Timestamp of the incoming wire transfer.
*/
- timestamp: Timestamp;
+ timestamp: TalerProtocolTimestamp;
}
export interface ReserveClosingTransaction {
@@ -139,7 +144,7 @@ export interface ReserveClosingTransaction {
/**
* Time when the reserve was closed.
*/
- timestamp: Timestamp;
+ timestamp: TalerProtocolTimestamp;
}
export interface ReserveRecoupTransaction {
@@ -165,7 +170,7 @@ export interface ReserveRecoupTransaction {
/**
* Time when the funds were paid back into the reserve.
*/
- timestamp: Timestamp;
+ timestamp: TalerProtocolTimestamp;
/**
* Public key of the coin that was paid back.
@@ -182,46 +187,50 @@ export type ReserveTransaction =
| ReserveClosingTransaction
| ReserveRecoupTransaction;
-export const codecForReserveWithdrawTransaction = (): Codec<ReserveWithdrawTransaction> =>
- buildCodecForObject<ReserveWithdrawTransaction>()
- .property("amount", codecForString())
- .property("h_coin_envelope", codecForString())
- .property("h_denom_pub", codecForString())
- .property("reserve_sig", codecForString())
- .property("type", codecForConstString(ReserveTransactionType.Withdraw))
- .property("withdraw_fee", codecForString())
- .build("ReserveWithdrawTransaction");
-
-export const codecForReserveCreditTransaction = (): Codec<ReserveCreditTransaction> =>
- buildCodecForObject<ReserveCreditTransaction>()
- .property("amount", codecForString())
- .property("sender_account_url", codecForString())
- .property("timestamp", codecForTimestamp)
- .property("wire_reference", codecForNumber())
- .property("type", codecForConstString(ReserveTransactionType.Credit))
- .build("ReserveCreditTransaction");
-
-export const codecForReserveClosingTransaction = (): Codec<ReserveClosingTransaction> =>
- buildCodecForObject<ReserveClosingTransaction>()
- .property("amount", codecForString())
- .property("closing_fee", codecForString())
- .property("exchange_pub", codecForString())
- .property("exchange_sig", codecForString())
- .property("h_wire", codecForString())
- .property("timestamp", codecForTimestamp)
- .property("type", codecForConstString(ReserveTransactionType.Closing))
- .property("wtid", codecForString())
- .build("ReserveClosingTransaction");
-
-export const codecForReserveRecoupTransaction = (): Codec<ReserveRecoupTransaction> =>
- buildCodecForObject<ReserveRecoupTransaction>()
- .property("amount", codecForString())
- .property("coin_pub", codecForString())
- .property("exchange_pub", codecForString())
- .property("exchange_sig", codecForString())
- .property("timestamp", codecForTimestamp)
- .property("type", codecForConstString(ReserveTransactionType.Recoup))
- .build("ReserveRecoupTransaction");
+export const codecForReserveWithdrawTransaction =
+ (): Codec<ReserveWithdrawTransaction> =>
+ buildCodecForObject<ReserveWithdrawTransaction>()
+ .property("amount", codecForAmountString())
+ .property("h_coin_envelope", codecForString())
+ .property("h_denom_pub", codecForString())
+ .property("reserve_sig", codecForString())
+ .property("type", codecForConstString(ReserveTransactionType.Withdraw))
+ .property("withdraw_fee", codecForAmountString())
+ .build("ReserveWithdrawTransaction");
+
+export const codecForReserveCreditTransaction =
+ (): Codec<ReserveCreditTransaction> =>
+ buildCodecForObject<ReserveCreditTransaction>()
+ .property("amount", codecForAmountString())
+ .property("sender_account_url", codecForString())
+ .property("timestamp", codecForTimestamp)
+ .property("wire_reference", codecForNumber())
+ .property("type", codecForConstString(ReserveTransactionType.Credit))
+ .build("ReserveCreditTransaction");
+
+export const codecForReserveClosingTransaction =
+ (): Codec<ReserveClosingTransaction> =>
+ buildCodecForObject<ReserveClosingTransaction>()
+ .property("amount", codecForAmountString())
+ .property("closing_fee", codecForAmountString())
+ .property("exchange_pub", codecForString())
+ .property("exchange_sig", codecForString())
+ .property("h_wire", codecForString())
+ .property("timestamp", codecForTimestamp)
+ .property("type", codecForConstString(ReserveTransactionType.Closing))
+ .property("wtid", codecForString())
+ .build("ReserveClosingTransaction");
+
+export const codecForReserveRecoupTransaction =
+ (): Codec<ReserveRecoupTransaction> =>
+ buildCodecForObject<ReserveRecoupTransaction>()
+ .property("amount", codecForAmountString())
+ .property("coin_pub", codecForString())
+ .property("exchange_pub", codecForString())
+ .property("exchange_sig", codecForString())
+ .property("timestamp", codecForTimestamp)
+ .property("type", codecForConstString(ReserveTransactionType.Recoup))
+ .build("ReserveRecoupTransaction");
export const codecForReserveTransaction = (): Codec<ReserveTransaction> =>
buildCodecForUnion<ReserveTransaction>()