summaryrefslogtreecommitdiff
path: root/packages/taler-util/src/walletTypes.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-10-14 18:40:04 +0200
committerFlorian Dold <florian@dold.me>2022-10-14 18:48:03 +0200
commit6acddd6d70abc568e4b3740f56662691278aa645 (patch)
tree2733a5669090e54a864ad7c1052ef21fffc5aa06 /packages/taler-util/src/walletTypes.ts
parentda9ec5eb16298d8ca5690800eca1c15f5a6cfaa5 (diff)
downloadwallet-core-6acddd6d70abc568e4b3740f56662691278aa645.tar.gz
wallet-core-6acddd6d70abc568e4b3740f56662691278aa645.tar.bz2
wallet-core-6acddd6d70abc568e4b3740f56662691278aa645.zip
wallet-core: get rid of duplicated withdrawal info API
Diffstat (limited to 'packages/taler-util/src/walletTypes.ts')
-rw-r--r--packages/taler-util/src/walletTypes.ts124
1 files changed, 106 insertions, 18 deletions
diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts
index d0765ae31..0891f5cf9 100644
--- a/packages/taler-util/src/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -68,6 +68,7 @@ import { BackupRecovery } from "./backupTypes.js";
import { PaytoUri } from "./payto.js";
import { TalerErrorCode } from "./taler-error-codes.js";
import { AgeCommitmentProof } from "./talerCrypto.js";
+import { VersionMatchResult } from "./libtool-version.js";
/**
* Response for the create reserve request to the wallet.
@@ -692,6 +693,7 @@ export interface ExchangeGlobalFees {
signature: string;
}
+
const codecForExchangeAccount = (): Codec<ExchangeAccount> =>
buildCodecForObject<ExchangeAccount>()
.property("payto_uri", codecForString())
@@ -929,6 +931,110 @@ export interface ManualWithdrawalDetails {
* Ways to pay the exchange.
*/
paytoUris: string[];
+
+ /**
+ * If the exchange supports age-restricted coins it will return
+ * the array of ages.
+ */
+ ageRestrictionOptions?: number[];
+}
+
+/**
+ * Selected denominations withn some extra info.
+ */
+ export interface DenomSelectionState {
+ totalCoinValue: AmountJson;
+ totalWithdrawCost: AmountJson;
+ selectedDenoms: {
+ denomPubHash: string;
+ count: number;
+ }[];
+}
+
+/**
+ * Information about what will happen doing a withdrawal.
+ *
+ * Sent to the wallet frontend to be rendered and shown to the user.
+ */
+ export interface ExchangeWithdrawalDetails {
+ exchangePaytoUris: string[];
+
+ /**
+ * Filtered wire info to send to the bank.
+ */
+ exchangeWireAccounts: string[];
+
+ /**
+ * Selected denominations for withdraw.
+ */
+ selectedDenoms: DenomSelectionState;
+
+ /**
+ * Does the wallet know about an auditor for
+ * the exchange that the reserve.
+ */
+ isAudited: boolean;
+
+ /**
+ * Did the user already accept the current terms of service for the exchange?
+ */
+ termsOfServiceAccepted: boolean;
+
+ /**
+ * The exchange is trusted directly.
+ */
+ isTrusted: boolean;
+
+ /**
+ * The earliest deposit expiration of the selected coins.
+ */
+ earliestDepositExpiration: TalerProtocolTimestamp;
+
+ /**
+ * Number of currently offered denominations.
+ */
+ numOfferedDenoms: number;
+
+ /**
+ * Public keys of trusted auditors for the currency we're withdrawing.
+ */
+ trustedAuditorPubs: string[];
+
+ /**
+ * Result of checking the wallet's version
+ * against the exchange's version.
+ *
+ * Older exchanges don't return version information.
+ */
+ versionMatch: VersionMatchResult | undefined;
+
+ /**
+ * Libtool-style version string for the exchange or "unknown"
+ * for older exchanges.
+ */
+ exchangeVersion: string;
+
+ /**
+ * Libtool-style version string for the wallet.
+ */
+ walletVersion: string;
+
+ /**
+ * Amount that will be subtracted from the reserve's balance.
+ */
+ withdrawalAmountRaw: AmountString;
+
+ /**
+ * Amount that will actually be added to the wallet's balance.
+ */
+ withdrawalAmountEffective: AmountString;
+
+ /**
+ * If the exchange supports age-restricted coins it will return
+ * the array of ages.
+ *
+ */
+ ageRestrictionOptions?: number[];
}
export interface GetExchangeTosResult {
@@ -1142,24 +1248,6 @@ export const codecForForgetKnownBankAccounts =
.property("payto", codecForString())
.build("ForgetKnownBankAccountsRequest");
-export interface GetExchangeWithdrawalInfo {
- exchangeBaseUrl: string;
- amount: AmountJson;
- tosAcceptedFormat?: string[];
- ageRestricted?: number;
-}
-
-export const codecForGetExchangeWithdrawalInfo =
- (): Codec<GetExchangeWithdrawalInfo> =>
- buildCodecForObject<GetExchangeWithdrawalInfo>()
- .property("exchangeBaseUrl", codecForString())
- .property("amount", codecForAmountJson())
- .property(
- "tosAcceptedFormat",
- codecOptional(codecForList(codecForString())),
- )
- .build("GetExchangeWithdrawalInfo");
-
export interface AbortProposalRequest {
proposalId: string;
}