summaryrefslogtreecommitdiff
path: root/src/types
diff options
context:
space:
mode:
Diffstat (limited to 'src/types')
-rw-r--r--src/types/dbTypes.ts70
-rw-r--r--src/types/history.ts16
-rw-r--r--src/types/notifications.ts28
-rw-r--r--src/types/pending.ts3
-rw-r--r--src/types/types-test.ts18
-rw-r--r--src/types/walletTypes.ts1
6 files changed, 66 insertions, 70 deletions
diff --git a/src/types/dbTypes.ts b/src/types/dbTypes.ts
index 9c2b3ca3e..b87ada115 100644
--- a/src/types/dbTypes.ts
+++ b/src/types/dbTypes.ts
@@ -151,7 +151,7 @@ export interface WalletReserveHistoryCreditItem {
/**
* Amount we expect to see credited.
*/
- expectedAmount?: string;
+ expectedAmount?: AmountJson;
/**
* Item from the reserve transaction history that this
@@ -161,7 +161,15 @@ export interface WalletReserveHistoryCreditItem {
}
export interface WalletReserveHistoryWithdrawItem {
- expectedAmount?: string;
+ expectedAmount?: AmountJson;
+
+ /**
+ * Hash of the blinded coin.
+ *
+ * When this value is set, it indicates that a withdrawal is active
+ * in the wallet for the
+ */
+ expectedCoinEvHash?: string;
type: WalletReserveHistoryItemType.Withdraw;
@@ -188,7 +196,7 @@ export interface WalletReserveHistoryRecoupItem {
/**
* Amount we expect to see recouped.
*/
- expectedAmount?: string;
+ expectedAmount?: AmountJson;
/**
* Item from the reserve transaction history that this
@@ -223,6 +231,11 @@ export interface ReserveRecord {
exchangeBaseUrl: string;
/**
+ * Currency of the reserve.
+ */
+ currency: string;
+
+ /**
* Time when the reserve was created.
*/
timestampCreated: Timestamp;
@@ -237,35 +250,14 @@ export interface ReserveRecord {
timestampReserveInfoPosted: Timestamp | undefined;
/**
- * Time when the reserve was confirmed.
+ * Time when the reserve was confirmed, either manually by the user
+ * or by the bank.
*
- * Set to 0 if not confirmed yet.
+ * Set to undefined if not confirmed yet.
*/
timestampConfirmed: Timestamp | undefined;
/**
- * Amount that's still available for withdrawing
- * from this reserve.
- */
- amountWithdrawRemaining: AmountJson;
-
- /**
- * Amount allocated for withdrawing.
- * The corresponding withdraw operation may or may not
- * have been completed yet.
- */
- amountWithdrawAllocated: AmountJson;
-
- amountWithdrawCompleted: AmountJson;
-
- /**
- * Amount requested when the reserve was created.
- * When a reserve is re-used (rare!) the current_amount can
- * be higher than the requested_amount
- */
- amountInitiallyRequested: AmountJson;
-
- /**
* Wire information (as payto URI) for the bank account that
* transfered funds for this reserve.
*/
@@ -305,7 +297,7 @@ export interface ReserveRecord {
*/
lastError: OperationError | undefined;
- reserveTransactions: ReserveTransaction[];
+ reserveTransactions: WalletReserveHistoryItem[];
}
/**
@@ -627,6 +619,7 @@ export interface PlanchetRecord {
blindingKey: string;
withdrawSig: string;
coinEv: string;
+ coinEvHash: string;
coinValue: AmountJson;
isFromTip: boolean;
}
@@ -675,7 +668,7 @@ export const enum CoinSourceType {
export interface WithdrawCoinSource {
type: CoinSourceType.Withdraw;
- withdrawSessionId: string;
+ withdrawalGroupId: string;
/**
* Index of the coin in the withdrawal session.
@@ -1362,20 +1355,25 @@ export interface CoinsReturnRecord {
wire: any;
}
+export const enum WithdrawalSourceType {
+ Tip = "tip",
+ Reserve = "reserve",
+}
+
export interface WithdrawalSourceTip {
- type: "tip";
+ type: WithdrawalSourceType.Tip;
tipId: string;
}
export interface WithdrawalSourceReserve {
- type: "reserve";
+ type: WithdrawalSourceType.Reserve;
reservePub: string;
}
export type WithdrawalSource = WithdrawalSourceTip | WithdrawalSourceReserve;
-export interface WithdrawalSessionRecord {
- withdrawSessionId: string;
+export interface WithdrawalGroupRecord {
+ withdrawalGroupId: string;
/**
* Withdrawal source. Fields that don't apply to the respective
@@ -1636,9 +1634,9 @@ export namespace Stores {
}
}
- class WithdrawalSessionsStore extends Store<WithdrawalSessionRecord> {
+ class WithdrawalGroupsStore extends Store<WithdrawalGroupRecord> {
constructor() {
- super("withdrawals", { keyPath: "withdrawSessionId" });
+ super("withdrawals", { keyPath: "withdrawalGroupId" });
}
}
@@ -1697,7 +1695,7 @@ export namespace Stores {
export const purchases = new PurchasesStore();
export const tips = new TipsStore();
export const senderWires = new SenderWiresStore();
- export const withdrawalSession = new WithdrawalSessionsStore();
+ export const withdrawalGroups = new WithdrawalGroupsStore();
export const bankWithdrawUris = new BankWithdrawUrisStore();
export const refundEvents = new RefundEventsStore();
export const payEvents = new PayEventsStore();
diff --git a/src/types/history.ts b/src/types/history.ts
index f4f3872ca..8179f6261 100644
--- a/src/types/history.ts
+++ b/src/types/history.ts
@@ -119,8 +119,6 @@ export interface HistoryReserveBalanceUpdatedEvent {
*/
timestamp: Timestamp;
- newHistoryTransactions: ReserveTransaction[];
-
/**
* Condensed information about the reserve.
*/
@@ -129,13 +127,17 @@ export interface HistoryReserveBalanceUpdatedEvent {
/**
* Amount currently left in the reserve.
*/
- amountReserveBalance: string;
+ reserveBalance: string;
+
+ /**
+ * Amount we still expect to be added to the reserve.
+ */
+ reserveAwaitedAmount: string;
/**
- * Amount we expected to be in the reserve at that time,
- * considering ongoing withdrawals from that reserve.
+ * Amount that hasn't been withdrawn yet.
*/
- amountExpected: string;
+ reserveUnclaimedAmount: string;
}
/**
@@ -612,7 +614,7 @@ export interface HistoryWithdrawnEvent {
* Unique identifier for the withdrawal session, can be used to
* query more detailed information from the wallet.
*/
- withdrawSessionId: string;
+ withdrawalGroupId: string;
withdrawalSource: WithdrawalSource;
diff --git a/src/types/notifications.ts b/src/types/notifications.ts
index 39930dcca..05d3c273a 100644
--- a/src/types/notifications.ts
+++ b/src/types/notifications.ts
@@ -1,4 +1,5 @@
import { OperationError } from "./walletTypes";
+import { WithdrawCoinSource, WithdrawalSource } from "./dbTypes";
/*
This file is part of GNU Taler
@@ -34,10 +35,9 @@ export const enum NotificationType {
RefreshUnwarranted = "refresh-unwarranted",
ReserveUpdated = "reserve-updated",
ReserveConfirmed = "reserve-confirmed",
- ReserveDepleted = "reserve-depleted",
ReserveCreated = "reserve-created",
- WithdrawSessionCreated = "withdraw-session-created",
- WithdrawSessionFinished = "withdraw-session-finished",
+ WithdrawGroupCreated = "withdraw-group-created",
+ WithdrawGroupFinished = "withdraw-group-finished",
WaitingForRetry = "waiting-for-retry",
RefundStarted = "refund-started",
RefundQueried = "refund-queried",
@@ -114,19 +114,14 @@ export interface ReserveConfirmedNotification {
type: NotificationType.ReserveConfirmed;
}
-export interface WithdrawSessionCreatedNotification {
- type: NotificationType.WithdrawSessionCreated;
- withdrawSessionId: string;
+export interface WithdrawalGroupCreatedNotification {
+ type: NotificationType.WithdrawGroupCreated;
+ withdrawalGroupId: string;
}
-export interface WithdrawSessionFinishedNotification {
- type: NotificationType.WithdrawSessionFinished;
- withdrawSessionId: string;
-}
-
-export interface ReserveDepletedNotification {
- type: NotificationType.ReserveDepleted;
- reservePub: string;
+export interface WithdrawalGroupFinishedNotification {
+ type: NotificationType.WithdrawGroupFinished;
+ withdrawalSource: WithdrawalSource;
}
export interface WaitingForRetryNotification {
@@ -210,13 +205,12 @@ export type WalletNotification =
| ReserveUpdatedNotification
| ReserveCreatedNotification
| ReserveConfirmedNotification
- | WithdrawSessionFinishedNotification
- | ReserveDepletedNotification
+ | WithdrawalGroupFinishedNotification
| WaitingForRetryNotification
| RefundStartedNotification
| RefundFinishedNotification
| RefundQueriedNotification
- | WithdrawSessionCreatedNotification
+ | WithdrawalGroupCreatedNotification
| CoinWithdrawnNotification
| WildcardNotification
| RecoupOperationErrorNotification;
diff --git a/src/types/pending.ts b/src/types/pending.ts
index d9d17a3b9..1471fa19a 100644
--- a/src/types/pending.ts
+++ b/src/types/pending.ts
@@ -214,7 +214,8 @@ export interface PendingRecoupOperation {
export interface PendingWithdrawOperation {
type: PendingOperationType.Withdraw;
source: WithdrawalSource;
- withdrawSessionId: string;
+ lastError: OperationError | undefined;
+ withdrawalGroupId: string;
numCoinsWithdrawn: number;
numCoinsTotal: number;
}
diff --git a/src/types/types-test.ts b/src/types/types-test.ts
index 885371a1a..ce3092497 100644
--- a/src/types/types-test.ts
+++ b/src/types/types-test.ts
@@ -15,14 +15,14 @@
*/
import test from "ava";
-import * as Amounts from "../util/amounts";
-import { ContractTerms, codecForContractTerms } from "./talerTypes";
+import { Amounts, AmountJson } from "../util/amounts";
+import { codecForContractTerms } from "./talerTypes";
const amt = (
value: number,
fraction: number,
currency: string,
-): Amounts.AmountJson => ({ value, fraction, currency });
+): AmountJson => ({ value, fraction, currency });
test("amount addition (simple)", (t) => {
const a1 = amt(1, 0, "EUR");
@@ -118,13 +118,13 @@ test("amount parsing", (t) => {
});
test("amount stringification", (t) => {
- t.is(Amounts.toString(amt(0, 0, "TESTKUDOS")), "TESTKUDOS:0");
- t.is(Amounts.toString(amt(4, 94000000, "TESTKUDOS")), "TESTKUDOS:4.94");
- t.is(Amounts.toString(amt(0, 10000000, "TESTKUDOS")), "TESTKUDOS:0.1");
- t.is(Amounts.toString(amt(0, 1, "TESTKUDOS")), "TESTKUDOS:0.00000001");
- t.is(Amounts.toString(amt(5, 0, "TESTKUDOS")), "TESTKUDOS:5");
+ t.is(Amounts.stringify(amt(0, 0, "TESTKUDOS")), "TESTKUDOS:0");
+ t.is(Amounts.stringify(amt(4, 94000000, "TESTKUDOS")), "TESTKUDOS:4.94");
+ t.is(Amounts.stringify(amt(0, 10000000, "TESTKUDOS")), "TESTKUDOS:0.1");
+ t.is(Amounts.stringify(amt(0, 1, "TESTKUDOS")), "TESTKUDOS:0.00000001");
+ t.is(Amounts.stringify(amt(5, 0, "TESTKUDOS")), "TESTKUDOS:5");
// denormalized
- t.is(Amounts.toString(amt(1, 100000000, "TESTKUDOS")), "TESTKUDOS:2");
+ t.is(Amounts.stringify(amt(1, 100000000, "TESTKUDOS")), "TESTKUDOS:2");
t.pass();
});
diff --git a/src/types/walletTypes.ts b/src/types/walletTypes.ts
index 7b58ba500..5d28c5ae7 100644
--- a/src/types/walletTypes.ts
+++ b/src/types/walletTypes.ts
@@ -427,6 +427,7 @@ export interface PlanchetCreationResult {
withdrawSig: string;
coinEv: string;
coinValue: AmountJson;
+ coinEvHash: string;
}
export interface PlanchetCreationRequest {