aboutsummaryrefslogtreecommitdiff
path: root/src/walletTypes.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-29 23:12:55 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-29 23:12:55 +0200
commitdefbf625bdef0f8a666b72b8ce99de5e01af6b91 (patch)
tree1bfe7c1ae0b56721d764893f62aca17271a20dbd /src/walletTypes.ts
parent1390175a9afc53948dd1d6f8a2f88e51c1bf53cc (diff)
downloadwallet-core-defbf625bdef0f8a666b72b8ce99de5e01af6b91.tar.gz
wallet-core-defbf625bdef0f8a666b72b8ce99de5e01af6b91.tar.bz2
wallet-core-defbf625bdef0f8a666b72b8ce99de5e01af6b91.zip
url-based pay/withdraw, use react hooks
Diffstat (limited to 'src/walletTypes.ts')
-rw-r--r--src/walletTypes.ts76
1 files changed, 45 insertions, 31 deletions
diff --git a/src/walletTypes.ts b/src/walletTypes.ts
index abe9f2712..c657ac02a 100644
--- a/src/walletTypes.ts
+++ b/src/walletTypes.ts
@@ -37,12 +37,7 @@ import {
ExchangeWireFeesRecord,
TipRecord,
} from "./dbTypes";
-import {
- CoinPaySig,
- ContractTerms,
- PayReq,
-} from "./talerTypes";
-
+import { CoinPaySig, ContractTerms, PayReq } from "./talerTypes";
/**
* Response for the create reserve request to the wallet.
@@ -69,7 +64,6 @@ export class CreateReserveResponse {
static checked: (obj: any) => CreateReserveResponse;
}
-
/**
* Information about what will happen when creating a reserve.
*
@@ -138,7 +132,7 @@ export interface ReserveCreationInfo {
*
* Older exchanges don't return version information.
*/
- versionMatch: LibtoolVersion.VersionMatchResult|undefined;
+ versionMatch: LibtoolVersion.VersionMatchResult | undefined;
/**
* Libtool-style version string for the exchange or "unknown"
@@ -152,6 +146,10 @@ export interface ReserveCreationInfo {
walletVersion: string;
}
+export interface WithdrawDetails {
+ withdrawInfo: DownloadedWithdrawInfo;
+ reserveCreationInfo: ReserveCreationInfo | undefined;
+}
/**
* Mapping from currency/exchange to detailed balance
@@ -169,7 +167,6 @@ export interface WalletBalance {
byCurrency: { [currency: string]: WalletBalanceEntry };
}
-
/**
* Detailed wallet balance for a particular currency.
*/
@@ -192,7 +189,6 @@ export interface WalletBalanceEntry {
paybackAmount: AmountJson;
}
-
/**
* Coins used for a payment, with signatures authorizing the payment and the
* coins with remaining value updated to accomodate for a payment.
@@ -203,7 +199,6 @@ export interface PayCoinInfo {
sigs: CoinPaySig[];
}
-
/**
* Listener for notifications from the wallet.
*/
@@ -214,15 +209,17 @@ export interface Notifier {
notify(): void;
}
-
/**
* For terseness.
*/
-export function mkAmount(value: number, fraction: number, currency: string): AmountJson {
- return {value, fraction, currency};
+export function mkAmount(
+ value: number,
+ fraction: number,
+ currency: string,
+): AmountJson {
+ return { value, fraction, currency };
}
-
/**
* Possible results for checkPay.
*/
@@ -231,7 +228,6 @@ export interface CheckPayResult {
coinSelection?: CoinSelectionResult;
}
-
/**
* Result for confirmPay
*/
@@ -239,7 +235,6 @@ export interface ConfirmPayResult {
nextUrl: string;
}
-
/**
* Activity history record.
*/
@@ -266,7 +261,6 @@ export interface HistoryRecord {
detail: any;
}
-
/**
* Query payment response when the payment was found.
*/
@@ -274,7 +268,6 @@ export interface QueryPaymentNotFound {
found: false;
}
-
/**
* Query payment response when the payment wasn't found.
*/
@@ -288,7 +281,6 @@ export interface QueryPaymentFound {
proposalId: number;
}
-
/**
* Information about all sender wire details known to the wallet,
* as well as exchanges that accept these wire types.
@@ -306,7 +298,6 @@ export interface SenderWireInfos {
senderWires: string[];
}
-
/**
* Request to mark a reserve as confirmed.
*/
@@ -351,7 +342,6 @@ export class CreateReserveRequest {
static checked: (obj: any) => CreateReserveRequest;
}
-
/**
* Request to mark a reserve as confirmed.
*/
@@ -371,7 +361,6 @@ export class ConfirmReserveRequest {
static checked: (obj: any) => ConfirmReserveRequest;
}
-
/**
* Wire coins to the user's own bank account.
*/
@@ -403,7 +392,6 @@ export class ReturnCoinsRequest {
static checked: (obj: any) => ReturnCoinsRequest;
}
-
/**
* Result of selecting coins, contains the exchange, and selected
* coins with their denomination.
@@ -418,7 +406,6 @@ export interface CoinSelectionResult {
totalAmount: AmountJson;
}
-
/**
* Named tuple of coin and denomination.
*/
@@ -446,7 +433,6 @@ export interface TipStatus {
tipRecord?: TipRecord;
}
-
/**
* Badge that shows activity for the wallet.
*/
@@ -477,7 +463,6 @@ export interface BenchmarkResult {
repetitions: number;
}
-
/**
* Cached next URL for a particular session id.
*/
@@ -486,14 +471,38 @@ export interface NextUrlResult {
lastSessionId: string | undefined;
}
-export interface PreparePayResult {
- status: "paid" | "session-replayed" | "insufficient-balance" | "payment-possible" | "error";
+export type PreparePayResult =
+ | PreparePayResultError
+ | PreparePayResultInsufficientBalance
+ | PreparePayResultPaid
+ | PreparePayResultPaymentPossible;
+
+export interface PreparePayResultPaymentPossible {
+ status: "payment-possible";
+ proposalId?: number;
contractTerms?: ContractTerms;
- error?: string;
+ totalFees?: AmountJson;
+}
+
+export interface PreparePayResultInsufficientBalance {
+ status: "insufficient-balance";
proposalId?: number;
+ contractTerms?: ContractTerms;
totalFees?: AmountJson;
}
+export interface PreparePayResultError {
+ status: "error";
+ error: string;
+}
+
+export interface PreparePayResultPaid {
+ status: "paid";
+ proposalId?: number;
+ contractTerms?: ContractTerms;
+ nextUrl: string;
+}
+
export interface DownloadedWithdrawInfo {
selectionDone: boolean;
transferDone: boolean;
@@ -503,4 +512,9 @@ export interface DownloadedWithdrawInfo {
confirmTransferUrl?: string;
wireTypes: string[];
extractedStatusUrl: string;
-} \ No newline at end of file
+}
+
+export interface AcceptWithdrawalResponse {
+ reservePub: string;
+ confirmTransferUrl?: string;
+}