aboutsummaryrefslogtreecommitdiff
path: root/src/types
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-03 13:00:48 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-03 13:01:05 +0530
commitffd2a62c3f7df94365980302fef3bc3376b48182 (patch)
tree270af6f16b4cc7f5da2afdba55c8bc9dbea5eca5 /src/types
parentaa481e42675fb7c4dcbbeec0ba1c61e1953b9596 (diff)
downloadwallet-core-ffd2a62c3f7df94365980302fef3bc3376b48182.tar.xz
modularize repo, use pnpm, improve typechecking
Diffstat (limited to 'src/types')
-rw-r--r--src/types/ReserveStatus.ts57
-rw-r--r--src/types/ReserveTransaction.ts250
-rw-r--r--src/types/dbTypes.ts1818
-rw-r--r--src/types/notifications.ts255
-rw-r--r--src/types/pending.ts258
-rw-r--r--src/types/schemacore.ts58
-rw-r--r--src/types/talerTypes.ts1271
-rw-r--r--src/types/transactions.ts310
-rw-r--r--src/types/types-test.ts55
-rw-r--r--src/types/walletTypes.ts522
10 files changed, 0 insertions, 4854 deletions
diff --git a/src/types/ReserveStatus.ts b/src/types/ReserveStatus.ts
deleted file mode 100644
index 18601b9a7..000000000
--- a/src/types/ReserveStatus.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * @author Florian Dold <dold@taler.net>
- */
-
-/**
- * Imports.
- */
-import {
- codecForString,
- makeCodecForObject,
- makeCodecForList,
- Codec,
-} from "../util/codec";
-import { AmountString } from "./talerTypes";
-import {
- ReserveTransaction,
- codecForReserveTransaction,
-} from "./ReserveTransaction";
-
-/**
- * Status of a reserve.
- *
- * Schema type for the exchange's response to "/reserve/status".
- */
-export interface ReserveStatus {
- /**
- * Balance left in the reserve.
- */
- balance: AmountString;
-
- /**
- * Transaction history for the reserve.
- */
- history: ReserveTransaction[];
-}
-
-export const codecForReserveStatus = (): Codec<ReserveStatus> =>
- makeCodecForObject<ReserveStatus>()
- .property("balance", codecForString)
- .property("history", makeCodecForList(codecForReserveTransaction()))
- .build("ReserveStatus");
diff --git a/src/types/ReserveTransaction.ts b/src/types/ReserveTransaction.ts
deleted file mode 100644
index bdd9b0f93..000000000
--- a/src/types/ReserveTransaction.ts
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * @author Florian Dold <dold@taler.net>
- */
-
-/**
- * Imports.
- */
-import {
- codecForString,
- makeCodecForObject,
- makeCodecForConstString,
- makeCodecForUnion,
- Codec,
-} from "../util/codec";
-import {
- AmountString,
- Base32String,
- EddsaSignatureString,
- EddsaPublicKeyString,
- CoinPublicKeyString,
-} from "./talerTypes";
-import { Timestamp, codecForTimestamp } from "../util/time";
-
-export const enum ReserveTransactionType {
- Withdraw = "WITHDRAW",
- Credit = "CREDIT",
- Recoup = "RECOUP",
- Closing = "CLOSING",
-}
-
-export interface ReserveWithdrawTransaction {
- type: ReserveTransactionType.Withdraw;
-
- /**
- * Amount withdrawn.
- */
- amount: AmountString;
-
- /**
- * Hash of the denomination public key of the coin.
- */
- h_denom_pub: Base32String;
-
- /**
- * Hash of the blinded coin to be signed
- */
- h_coin_envelope: Base32String;
-
- /**
- * Signature of 'TALER_WithdrawRequestPS' created with the reserves's
- * private key.
- */
- reserve_sig: EddsaSignatureString;
-
- /**
- * Fee that is charged for withdraw.
- */
- withdraw_fee: AmountString;
-}
-
-export interface ReserveCreditTransaction {
- type: ReserveTransactionType.Credit;
-
- /**
- * Amount withdrawn.
- */
- amount: AmountString;
-
- /**
- * Sender account payto://-URL
- */
- sender_account_url: string;
-
- /**
- * Transfer details uniquely identifying the transfer.
- */
- wire_reference: string;
-
- /**
- * Timestamp of the incoming wire transfer.
- */
- timestamp: Timestamp;
-}
-
-export interface ReserveClosingTransaction {
- type: ReserveTransactionType.Closing;
-
- /**
- * Closing balance.
- */
- amount: AmountString;
-
- /**
- * Closing fee charged by the exchange.
- */
- closing_fee: AmountString;
-
- /**
- * Wire transfer subject.
- */
- wtid: string;
-
- /**
- * Hash of the wire account into which the funds were returned to.
- */
- h_wire: string;
-
- /**
- * This is a signature over a
- * struct TALER_ReserveCloseConfirmationPS with purpose
- * TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED.
- */
- exchange_sig: EddsaSignatureString;
-
- /**
- * Public key used to create exchange_sig.
- */
- exchange_pub: EddsaPublicKeyString;
-
- /**
- * Time when the reserve was closed.
- */
- timestamp: Timestamp;
-}
-
-export interface ReserveRecoupTransaction {
- type: ReserveTransactionType.Recoup;
-
- /**
- * Amount paid back.
- */
- amount: AmountString;
-
- /**
- * This is a signature over
- * a struct TALER_PaybackConfirmationPS with purpose
- * TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK.
- */
- exchange_sig: EddsaSignatureString;
-
- /**
- * Public key used to create exchange_sig.
- */
- exchange_pub: EddsaPublicKeyString;
-
- /**
- * Time when the funds were paid back into the reserve.
- */
- timestamp: Timestamp;
-
- /**
- * Public key of the coin that was paid back.
- */
- coin_pub: CoinPublicKeyString;
-}
-
-/**
- * Format of the exchange's transaction history for a reserve.
- */
-export type ReserveTransaction =
- | ReserveWithdrawTransaction
- | ReserveCreditTransaction
- | ReserveClosingTransaction
- | ReserveRecoupTransaction;
-
-export const codecForReserveWithdrawTransaction = (): Codec<
- ReserveWithdrawTransaction
-> =>
- makeCodecForObject<ReserveWithdrawTransaction>()
- .property("amount", codecForString)
- .property("h_coin_envelope", codecForString)
- .property("h_denom_pub", codecForString)
- .property("reserve_sig", codecForString)
- .property("type", makeCodecForConstString(ReserveTransactionType.Withdraw))
- .property("withdraw_fee", codecForString)
- .build("ReserveWithdrawTransaction");
-
-export const codecForReserveCreditTransaction = (): Codec<
- ReserveCreditTransaction
-> =>
- makeCodecForObject<ReserveCreditTransaction>()
- .property("amount", codecForString)
- .property("sender_account_url", codecForString)
- .property("timestamp", codecForTimestamp)
- .property("wire_reference", codecForString)
- .property("type", makeCodecForConstString(ReserveTransactionType.Credit))
- .build("ReserveCreditTransaction");
-
-export const codecForReserveClosingTransaction = (): Codec<
- ReserveClosingTransaction
-> =>
- makeCodecForObject<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", makeCodecForConstString(ReserveTransactionType.Closing))
- .property("wtid", codecForString)
- .build("ReserveClosingTransaction");
-
-export const codecForReserveRecoupTransaction = (): Codec<
- ReserveRecoupTransaction
-> =>
- makeCodecForObject<ReserveRecoupTransaction>()
- .property("amount", codecForString)
- .property("coin_pub", codecForString)
- .property("exchange_pub", codecForString)
- .property("exchange_sig", codecForString)
- .property("timestamp", codecForTimestamp)
- .property("type", makeCodecForConstString(ReserveTransactionType.Recoup))
- .build("ReserveRecoupTransaction");
-
-export const codecForReserveTransaction = (): Codec<ReserveTransaction> =>
- makeCodecForUnion<ReserveTransaction>()
- .discriminateOn("type")
- .alternative(
- ReserveTransactionType.Withdraw,
- codecForReserveWithdrawTransaction(),
- )
- .alternative(
- ReserveTransactionType.Closing,
- codecForReserveClosingTransaction(),
- )
- .alternative(
- ReserveTransactionType.Recoup,
- codecForReserveRecoupTransaction(),
- )
- .alternative(
- ReserveTransactionType.Credit,
- codecForReserveCreditTransaction(),
- )
- .build<ReserveTransaction>("ReserveTransaction");
diff --git a/src/types/dbTypes.ts b/src/types/dbTypes.ts
deleted file mode 100644
index e03d46417..000000000
--- a/src/types/dbTypes.ts
+++ /dev/null
@@ -1,1818 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2018-2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Types for records stored in the wallet's database.
- *
- * Types for the objects in the database should end in "-Record".
- */
-
-/**
- * Imports.
- */
-import { AmountJson } from "../util/amounts";
-import {
- Auditor,
- CoinDepositPermission,
- TipResponse,
- ExchangeSignKeyJson,
- MerchantInfo,
- Product,
-} from "./talerTypes";
-
-import { Index, Store } from "../util/query";
-import { OperationErrorDetails, RefreshReason } from "./walletTypes";
-import {
- ReserveTransaction,
- ReserveCreditTransaction,
- ReserveWithdrawTransaction,
- ReserveClosingTransaction,
- ReserveRecoupTransaction,
-} from "./ReserveTransaction";
-import { Timestamp, Duration, getTimestampNow } from "../util/time";
-import { PayCoinSelection, PayCostInfo } from "../operations/pay";
-
-export enum ReserveRecordStatus {
- /**
- * Reserve must be registered with the bank.
- */
- REGISTERING_BANK = "registering-bank",
-
- /**
- * We've registered reserve's information with the bank
- * and are now waiting for the user to confirm the withdraw
- * with the bank (typically 2nd factor auth).
- */
- WAIT_CONFIRM_BANK = "wait-confirm-bank",
-
- /**
- * Querying reserve status with the exchange.
- */
- QUERYING_STATUS = "querying-status",
-
- /**
- * Status is queried, the wallet must now select coins
- * and start withdrawing.
- */
- WITHDRAWING = "withdrawing",
-
- /**
- * The corresponding withdraw record has been created.
- * No further processing is done, unless explicitly requested
- * by the user.
- */
- DORMANT = "dormant",
-}
-
-export interface RetryInfo {
- firstTry: Timestamp;
- nextRetry: Timestamp;
- retryCounter: number;
- active: boolean;
-}
-
-export interface RetryPolicy {
- readonly backoffDelta: Duration;
- readonly backoffBase: number;
-}
-
-const defaultRetryPolicy: RetryPolicy = {
- backoffBase: 1.5,
- backoffDelta: { d_ms: 200 },
-};
-
-export function updateRetryInfoTimeout(
- r: RetryInfo,
- p: RetryPolicy = defaultRetryPolicy,
-): void {
- const now = getTimestampNow();
- if (now.t_ms === "never") {
- throw Error("assertion failed");
- }
- if (p.backoffDelta.d_ms === "forever") {
- r.nextRetry = { t_ms: "never" };
- return;
- }
- const t =
- now.t_ms + p.backoffDelta.d_ms * Math.pow(p.backoffBase, r.retryCounter);
- r.nextRetry = { t_ms: t };
-}
-
-export function initRetryInfo(
- active = true,
- p: RetryPolicy = defaultRetryPolicy,
-): RetryInfo {
- if (!active) {
- return {
- active: false,
- firstTry: { t_ms: Number.MAX_SAFE_INTEGER },
- nextRetry: { t_ms: Number.MAX_SAFE_INTEGER },
- retryCounter: 0,
- };
- }
- const info = {
- firstTry: getTimestampNow(),
- active: true,
- nextRetry: { t_ms: 0 },
- retryCounter: 0,
- };
- updateRetryInfoTimeout(info, p);
- return info;
-}
-
-export const enum WalletReserveHistoryItemType {
- Credit = "credit",
- Withdraw = "withdraw",
- Closing = "closing",
- Recoup = "recoup",
-}
-
-export interface WalletReserveHistoryCreditItem {
- type: WalletReserveHistoryItemType.Credit;
-
- /**
- * Amount we expect to see credited.
- */
- expectedAmount?: AmountJson;
-
- /**
- * Item from the reserve transaction history that this
- * wallet reserve history item matches up with.
- */
- matchedExchangeTransaction?: ReserveCreditTransaction;
-}
-
-export interface WalletReserveHistoryWithdrawItem {
- 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;
-
- /**
- * Item from the reserve transaction history that this
- * wallet reserve history item matches up with.
- */
- matchedExchangeTransaction?: ReserveWithdrawTransaction;
-}
-
-export interface WalletReserveHistoryClosingItem {
- type: WalletReserveHistoryItemType.Closing;
-
- /**
- * Item from the reserve transaction history that this
- * wallet reserve history item matches up with.
- */
- matchedExchangeTransaction?: ReserveClosingTransaction;
-}
-
-export interface WalletReserveHistoryRecoupItem {
- type: WalletReserveHistoryItemType.Recoup;
-
- /**
- * Amount we expect to see recouped.
- */
- expectedAmount?: AmountJson;
-
- /**
- * Item from the reserve transaction history that this
- * wallet reserve history item matches up with.
- */
- matchedExchangeTransaction?: ReserveRecoupTransaction;
-}
-
-export type WalletReserveHistoryItem =
- | WalletReserveHistoryCreditItem
- | WalletReserveHistoryWithdrawItem
- | WalletReserveHistoryRecoupItem
- | WalletReserveHistoryClosingItem;
-
-export interface ReserveHistoryRecord {
- reservePub: string;
- reserveTransactions: WalletReserveHistoryItem[];
-}
-
-export interface ReserveBankInfo {
- /**
- * Status URL that the wallet will use to query the status
- * of the Taler withdrawal operation on the bank's side.
- */
- statusUrl: string;
-
- confirmUrl?: string;
-
- /**
- * Exchange payto URI that the bank will use to fund the reserve.
- */
- exchangePaytoUri: string;
-}
-
-/**
- * A reserve record as stored in the wallet's database.
- */
-export interface ReserveRecord {
- /**
- * The reserve public key.
- */
- reservePub: string;
-
- /**
- * The reserve private key.
- */
- reservePriv: string;
-
- /**
- * The exchange base URL.
- */
- exchangeBaseUrl: string;
-
- /**
- * Currency of the reserve.
- */
- currency: string;
-
- /**
- * Time when the reserve was created.
- */
- timestampCreated: Timestamp;
-
- /**
- * Time when the information about this reserve was posted to the bank.
- *
- * Only applies if bankWithdrawStatusUrl is defined.
- *
- * Set to 0 if that hasn't happened yet.
- */
- timestampReserveInfoPosted: Timestamp | undefined;
-
- /**
- * Time when the reserve was confirmed by the bank.
- *
- * Set to undefined if not confirmed yet.
- */
- timestampBankConfirmed: Timestamp | undefined;
-
- /**
- * Wire information (as payto URI) for the bank account that
- * transfered funds for this reserve.
- */
- senderWire?: string;
-
- /**
- * Amount that was sent by the user to fund the reserve.
- */
- instructedAmount: AmountJson;
-
- /**
- * Extra state for when this is a withdrawal involving
- * a Taler-integrated bank.
- */
- bankInfo?: ReserveBankInfo;
-
- initialWithdrawalGroupId: string;
-
- /**
- * Did we start the first withdrawal for this reserve?
- *
- * We only report a pending withdrawal for the reserve before
- * the first withdrawal has started.
- */
- initialWithdrawalStarted: boolean;
- initialDenomSel: DenomSelectionState;
-
- reserveStatus: ReserveRecordStatus;
-
- /**
- * Time of the last successful status query.
- */
- lastSuccessfulStatusQuery: Timestamp | undefined;
-
- /**
- * Retry info. This field is present even if no retry is scheduled,
- * because we need it to be present for the index on the object store
- * to work.
- */
- retryInfo: RetryInfo;
-
- /**
- * Last error that happened in a reserve operation
- * (either talking to the bank or the exchange).
- */
- lastError: OperationErrorDetails | undefined;
-}
-
-/**
- * Auditor record as stored with currencies in the exchange database.
- */
-export interface AuditorRecord {
- /**
- * Base url of the auditor.
- */
- baseUrl: string;
- /**
- * Public signing key of the auditor.
- */
- auditorPub: string;
- /**
- * Time when the auditing expires.
- */
- expirationStamp: number;
-}
-
-/**
- * Exchange for currencies as stored in the wallet's currency
- * information database.
- */
-export interface ExchangeForCurrencyRecord {
- /**
- * FIXME: unused?
- */
- exchangePub: string;
- /**
- * Base URL of the exchange.
- */
- baseUrl: string;
-}
-
-/**
- * Information about a currency as displayed in the wallet's database.
- */
-export interface CurrencyRecord {
- /**
- * Name of the currency.
- */
- name: string;
- /**
- * Number of fractional digits to show when rendering the currency.
- */
- fractionalDigits: number;
- /**
- * Auditors that the wallet trusts for this currency.
- */
- auditors: AuditorRecord[];
- /**
- * Exchanges that the wallet trusts for this currency.
- */
- exchanges: ExchangeForCurrencyRecord[];
-}
-
-/**
- * Status of a denomination.
- */
-export enum DenominationStatus {
- /**
- * Verification was delayed.
- */
- Unverified,
- /**
- * Verified as valid.
- */
- VerifiedGood,
- /**
- * Verified as invalid.
- */
- VerifiedBad,
-}
-
-/**
- * Denomination record as stored in the wallet's database.
- */
-export interface DenominationRecord {
- /**
- * Value of one coin of the denomination.
- */
- value: AmountJson;
-
- /**
- * The denomination public key.
- */
- denomPub: string;
-
- /**
- * Hash of the denomination public key.
- * Stored in the database for faster lookups.
- */
- denomPubHash: string;
-
- /**
- * Fee for withdrawing.
- */
- feeWithdraw: AmountJson;
-
- /**
- * Fee for depositing.
- */
- feeDeposit: AmountJson;
-
- /**
- * Fee for refreshing.
- */
- feeRefresh: AmountJson;
-
- /**
- * Fee for refunding.
- */
- feeRefund: AmountJson;
-
- /**
- * Validity start date of the denomination.
- */
- stampStart: Timestamp;
-
- /**
- * Date after which the currency can't be withdrawn anymore.
- */
- stampExpireWithdraw: Timestamp;
-
- /**
- * Date after the denomination officially doesn't exist anymore.
- */
- stampExpireLegal: Timestamp;
-
- /**
- * Data after which coins of this denomination can't be deposited anymore.
- */
- stampExpireDeposit: Timestamp;
-
- /**
- * Signature by the exchange's master key over the denomination
- * information.
- */
- masterSig: string;
-
- /**
- * Did we verify the signature on the denomination?
- *
- * FIXME: Rename to "verificationStatus"?
- */
- status: DenominationStatus;
-
- /**
- * Was this denomination still offered by the exchange the last time
- * we checked?
- * Only false when the exchange redacts a previously published denomination.
- */
- isOffered: boolean;
-
- /**
- * Did the exchange revoke the denomination?
- * When this field is set to true in the database, the same transaction
- * should also mark all affected coins as revoked.
- */
- isRevoked: boolean;
-
- /**
- * Base URL of the exchange.
- */
- exchangeBaseUrl: string;
-}
-
-/**
- * Details about the exchange that we only know after
- * querying /keys and /wire.
- */
-export interface ExchangeDetails {
- /**
- * Master public key of the exchange.
- */
- masterPublicKey: string;
-
- /**
- * Auditors (partially) auditing the exchange.
- */
- auditors: Auditor[];
-
- /**
- * Currency that the exchange offers.
- */
- currency: string;
-
- /**
- * Last observed protocol version.
- */
- protocolVersion: string;
-
- /**
- * Signing keys we got from the exchange, can also contain
- * older signing keys that are not returned by /keys anymore.
- */
- signingKeys: ExchangeSignKeyJson[];
-
- /**
- * Timestamp for last update.
- */
- lastUpdateTime: Timestamp;
-}
-
-export const enum ExchangeUpdateStatus {
- FetchKeys = "fetch-keys",
- FetchWire = "fetch-wire",
- FetchTerms = "fetch-terms",
- FinalizeUpdate = "finalize-update",
- Finished = "finished",
-}
-
-export interface ExchangeBankAccount {
- payto_uri: string;
-}
-
-export interface ExchangeWireInfo {
- feesForType: { [wireMethod: string]: WireFee[] };
- accounts: ExchangeBankAccount[];
-}
-
-/**
- * Summary of updates to the exchange.
- */
-// eslint-disable-next-line @typescript-eslint/no-empty-interface
-export interface ExchangeUpdateDiff {
- // FIXME: implement!
-}
-
-export const enum ExchangeUpdateReason {
- Initial = "initial",
- Forced = "forced",
- Scheduled = "scheduled",
-}
-
-/**
- * Exchange record as stored in the wallet's database.
- */
-export interface ExchangeRecord {
- /**
- * Base url of the exchange.
- */
- baseUrl: string;
-
- /**
- * Did we finish adding the exchange?
- */
- addComplete: boolean;
-
- /**
- * Is this a permanent or temporary exchange record?
- */
- permanent: boolean;
-
- /**
- * Was the exchange added as a built-in exchange?
- */
- builtIn: boolean;
-
- /**
- * Details, once known.
- */
- details: ExchangeDetails | undefined;
-
- /**
- * Mapping from wire method type to the wire fee.
- */
- wireInfo: ExchangeWireInfo | undefined;
-
- /**
- * When was the exchange added to the wallet?
- */
- timestampAdded: Timestamp;
-
- /**
- * Terms of service text or undefined if not downloaded yet.
- */
- termsOfServiceText: string | undefined;
-
- /**
- * ETag for last terms of service download.
- */
- termsOfServiceLastEtag: string | undefined;
-
- /**
- * ETag for last terms of service download.
- */
- termsOfServiceAcceptedEtag: string | undefined;
-
- /**
- * ETag for last terms of service download.
- */
- termsOfServiceAcceptedTimestamp: Timestamp | undefined;
-
- /**
- * Time when the update to the exchange has been started or
- * undefined if no update is in progress.
- */
- updateStarted: Timestamp | undefined;
-
- /**
- * Status of updating the info about the exchange.
- */
- updateStatus: ExchangeUpdateStatus;
-
- updateReason?: ExchangeUpdateReason;
-
- /**
- * Update diff, will be incorporated when the update is finalized.
- */
- updateDiff: ExchangeUpdateDiff | undefined;
-
- lastError?: OperationErrorDetails;
-}
-
-/**
- * A coin that isn't yet signed by an exchange.
- */
-export interface PlanchetRecord {
- /**
- * Public key of the coin.
- */
- coinPub: string;
-
- /**
- * Private key of the coin.
- */
- coinPriv: string;
-
- /**
- * Withdrawal group that this planchet belongs to
- * (or the empty string).
- */
- withdrawalGroupId: string;
-
- /**
- * Index within the withdrawal group (or -1).
- */
- coinIdx: number;
-
- withdrawalDone: boolean;
-
- /**
- * Public key of the reserve, this might be a reserve not
- * known to the wallet if the planchet is from a tip.
- */
- reservePub: string;
- denomPubHash: string;
- denomPub: string;
- blindingKey: string;
- withdrawSig: string;
- coinEv: string;
- coinEvHash: string;
- coinValue: AmountJson;
- isFromTip: boolean;
-}
-
-/**
- * Planchet for a coin during refrehs.
- */
-export interface RefreshPlanchetRecord {
- /**
- * Public key for the coin.
- */
- publicKey: string;
- /**
- * Private key for the coin.
- */
- privateKey: string;
- /**
- * Blinded public key.
- */
- coinEv: string;
- /**
- * Blinding key used.
- */
- blindingKey: string;
-}
-
-/**
- * Status of a coin.
- */
-export const enum CoinStatus {
- /**
- * Withdrawn and never shown to anybody.
- */
- Fresh = "fresh",
- /**
- * A coin that has been spent and refreshed.
- */
- Dormant = "dormant",
-}
-
-export const enum CoinSourceType {
- Withdraw = "withdraw",
- Refresh = "refresh",
- Tip = "tip",
-}
-
-export interface WithdrawCoinSource {
- type: CoinSourceType.Withdraw;
- withdrawalGroupId: string;
-
- /**
- * Index of the coin in the withdrawal session.
- */
- coinIndex: number;
-
- /**
- * Reserve public key for the reserve we got this coin from.
- */
- reservePub: string;
-}
-
-export interface RefreshCoinSource {
- type: CoinSourceType.Refresh;
- oldCoinPub: string;
-}
-
-export interface TipCoinSource {
- type: CoinSourceType.Tip;
-}
-
-export type CoinSource = WithdrawCoinSource | RefreshCoinSource | TipCoinSource;
-
-/**
- * CoinRecord as stored in the "coins" data store
- * of the wallet database.
- */
-export interface CoinRecord {
- /**
- * Where did the coin come from? Used for recouping coins.
- */
- coinSource: CoinSource;
-
- /**
- * Public key of the coin.
- */
- coinPub: string;
-
- /**
- * Private key to authorize operations on the coin.
- */
- coinPriv: string;
-
- /**
- * Key used by the exchange used to sign the coin.
- */
- denomPub: string;
-
- /**
- * Hash of the public key that signs the coin.
- */
- denomPubHash: string;
-
- /**
- * Unblinded signature by the exchange.
- */
- denomSig: string;
-
- /**
- * Amount that's left on the coin.
- */
- currentAmount: AmountJson;
-
- /**
- * Base URL that identifies the exchange from which we got the
- * coin.
- */
- exchangeBaseUrl: string;
-
- /**
- * The coin is currently suspended, and will not be used for payments.
- */
- suspended: boolean;
-
- /**
- * Blinding key used when withdrawing the coin.
- * Potentionally sed again during payback.
- */
- blindingKey: string;
-
- /**
- * Status of the coin.
- */
- status: CoinStatus;
-}
-
-export const enum ProposalStatus {
- /**
- * Not downloaded yet.
- */
- DOWNLOADING = "downloading",
- /**
- * Proposal downloaded, but the user needs to accept/reject it.
- */
- PROPOSED = "proposed",
- /**
- * The user has accepted the proposal.
- */
- ACCEPTED = "accepted",
- /**
- * The user has rejected the proposal.
- */
- REFUSED = "refused",
- /**
- * Downloaded proposal was detected as a re-purchase.
- */
- REPURCHASE = "repurchase",
-}
-
-export interface ProposalDownload {
- /**
- * The contract that was offered by the merchant.
- */
- contractTermsRaw: string;
-
- contractData: WalletContractData;
-}
-
-/**
- * Record for a downloaded order, stored in the wallet's database.
- */
-export interface ProposalRecord {
- orderId: string;
-
- merchantBaseUrl: string;
-
- /**
- * Downloaded data from the merchant.
- */
- download: ProposalDownload | undefined;
-
- /**
- * Unique ID when the order is stored in the wallet DB.
- */
- proposalId: string;
-
- /**
- * Timestamp (in ms) of when the record
- * was created.
- */
- timestamp: Timestamp;
-
- /**
- * Private key for the nonce.
- */
- noncePriv: string;
-
- /**
- * Public key for the nonce.
- */
- noncePub: string;
-
- claimToken: string | undefined;
-
- proposalStatus: ProposalStatus;
-
- repurchaseProposalId: string | undefined;
-
- /**
- * Session ID we got when downloading the contract.
- */
- downloadSessionId?: string;
-
- /**
- * Retry info, even present when the operation isn't active to allow indexing
- * on the next retry timestamp.
- */
- retryInfo: RetryInfo;
-
- lastError: OperationErrorDetails | undefined;
-}
-
-/**
- * Status of a tip we got from a merchant.
- */
-export interface TipRecord {
- lastError: OperationErrorDetails | undefined;
-
- /**
- * Has the user accepted the tip? Only after the tip has been accepted coins
- * withdrawn from the tip may be used.
- */
- acceptedTimestamp: Timestamp | undefined;
-
- /**
- * Has the user rejected the tip?
- */
- rejectedTimestamp: Timestamp | undefined;
-
- /**
- * Have we picked up the tip record from the merchant already?
- */
- pickedUp: boolean;
-
- /**
- * The tipped amount.
- */
- amount: AmountJson;
-
- totalFees: AmountJson;
-
- /**
- * Timestamp, the tip can't be picked up anymore after this deadline.
- */
- deadline: Timestamp;
-
- /**
- * The exchange that will sign our coins, chosen by the merchant.
- */
- exchangeUrl: string;
-
- /**
- * Base URL of the merchant that is giving us the tip.
- */
- merchantBaseUrl: string;
-
- /**
- * Planchets, the members included in TipPlanchetDetail will be sent to the
- * merchant.
- */
- planchets?: TipPlanchet[];
-
- denomsSel: DenomSelectionState;
-
- /**
- * Response if the merchant responded,
- * undefined otherwise.
- */
- response?: TipResponse[];
-
- /**
- * Tip ID chosen by the wallet.
- */
- tipId: string;
-
- /**
- * The merchant's identifier for this tip.
- */
- merchantTipId: string;
-
- /**
- * URL to go to once the tip has been accepted.
- */
- nextUrl?: string;
-
- createdTimestamp: Timestamp;
-
- /**
- * Retry info, even present when the operation isn't active to allow indexing
- * on the next retry timestamp.
- */
- retryInfo: RetryInfo;
-}
-
-export interface RefreshGroupRecord {
- /**
- * Retry info, even present when the operation isn't active to allow indexing
- * on the next retry timestamp.
- */
- retryInfo: RetryInfo;
-
- lastError: OperationErrorDetails | undefined;
-
- lastErrorPerCoin: { [coinIndex: number]: OperationErrorDetails };
-
- refreshGroupId: string;
-
- reason: RefreshReason;
-
- oldCoinPubs: string[];
-
- refreshSessionPerCoin: (RefreshSessionRecord | undefined)[];
-
- /**
- * Flag for each coin whether refreshing finished.
- * If a coin can't be refreshed (remaining value too small),
- * it will be marked as finished, but no refresh session will
- * be created.
- */
- finishedPerCoin: boolean[];
-
- /**
- * Timestamp when the refresh session finished.
- */
- timestampFinished: Timestamp | undefined;
-}
-
-/**
- * Ongoing refresh
- */
-export interface RefreshSessionRecord {
- lastError: OperationErrorDetails | undefined;
-
- /**
- * Public key that's being melted in this session.
- */
- meltCoinPub: string;
-
- /**
- * How much of the coin's value is melted away
- * with this refresh session?
- */
- amountRefreshInput: AmountJson;
-
- /**
- * Sum of the value of denominations we want
- * to withdraw in this session, without fees.
- */
- amountRefreshOutput: AmountJson;
-
- /**
- * Signature to confirm the melting.
- */
- confirmSig: string;
-
- /**
- * Hased denominations of the newly requested coins.
- */
- newDenomHashes: string[];
-
- /**
- * Denominations of the newly requested coins.
- */
- newDenoms: string[];
-
- /**
- * Planchets for each cut-and-choose instance.
- */
- planchetsForGammas: RefreshPlanchetRecord[][];
-
- /**
- * The transfer keys, kappa of them.
- */
- transferPubs: string[];
-
- /**
- * Private keys for the transfer public keys.
- */
- transferPrivs: string[];
-
- /**
- * The no-reveal-index after we've done the melting.
- */
- norevealIndex?: number;
-
- /**
- * Hash of the session.
- */
- hash: string;
-
- /**
- * Timestamp when the refresh session finished.
- */
- finishedTimestamp: Timestamp | undefined;
-
- /**
- * When has this refresh session been created?
- */
- timestampCreated: Timestamp;
-
- /**
- * Base URL for the exchange we're doing the refresh with.
- */
- exchangeBaseUrl: string;
-}
-
-/**
- * Tipping planchet stored in the database.
- */
-export interface TipPlanchet {
- blindingKey: string;
- coinEv: string;
- coinPriv: string;
- coinPub: string;
- coinValue: AmountJson;
- denomPubHash: string;
- denomPub: string;
-}
-
-/**
- * Wire fee for one wire method as stored in the
- * wallet's database.
- */
-export interface WireFee {
- /**
- * Fee for wire transfers.
- */
- wireFee: AmountJson;
-
- /**
- * Fees to close and refund a reserve.
- */
- closingFee: AmountJson;
-
- /**
- * Start date of the fee.
- */
- startStamp: Timestamp;
-
- /**
- * End date of the fee.
- */
- endStamp: Timestamp;
-
- /**
- * Signature made by the exchange master key.
- */
- sig: string;
-}
-
-/**
- * Record to store information about a refund event.
- *
- * All information about a refund is stored with the purchase,
- * this event is just for the history.
- *
- * The event is only present for completed refunds.
- */
-export interface RefundEventRecord {
- timestamp: Timestamp;
- merchantExecutionTimestamp: Timestamp;
- refundGroupId: string;
- proposalId: string;
-}
-
-export const enum RefundState {
- Failed = "failed",
- Applied = "applied",
- Pending = "pending",
-}
-
-/**
- * State of one refund from the merchant, maintained by the wallet.
- */
-export type WalletRefundItem =
- | WalletRefundFailedItem
- | WalletRefundPendingItem
- | WalletRefundAppliedItem;
-
-export interface WalletRefundItemCommon {
- executionTime: Timestamp;
- refundAmount: AmountJson;
- refundFee: AmountJson;
-
- /**
- * Upper bound on the refresh cost incurred by
- * applying this refund.
- *
- * Might be lower in practice when two refunds on the same
- * coin are refreshed in the same refresh operation.
- */
- totalRefreshCostBound: AmountJson;
-}
-
-/**
- * Failed refund, either because the merchant did
- * something wrong or it expired.
- */
-export interface WalletRefundFailedItem extends WalletRefundItemCommon {
- type: RefundState.Failed;
-}
-
-export interface WalletRefundPendingItem extends WalletRefundItemCommon {
- type: RefundState.Pending;
-}
-
-export interface WalletRefundAppliedItem extends WalletRefundItemCommon {
- type: RefundState.Applied;
-}
-
-export const enum RefundReason {
- /**
- * Normal refund given by the merchant.
- */
- NormalRefund = "normal-refund",
- /**
- * Refund from an aborted payment.
- */
- AbortRefund = "abort-pay-refund",
-}
-
-/**
- * Record stored for every time we successfully submitted
- * a payment to the merchant (both first time and re-play).
- */
-export interface PayEventRecord {
- proposalId: string;
- sessionId: string | undefined;
- isReplay: boolean;
- timestamp: Timestamp;
-}
-
-export interface ExchangeUpdatedEventRecord {
- exchangeBaseUrl: string;
- timestamp: Timestamp;
-}
-
-export interface ReserveUpdatedEventRecord {
- amountReserveBalance: string;
- amountExpected: string;
- reservePub: string;
- timestamp: Timestamp;
- reserveUpdateId: string;
- newHistoryTransactions: ReserveTransaction[];
-}
-
-export interface AllowedAuditorInfo {
- auditorBaseUrl: string;
- auditorPub: string;
-}
-
-export interface AllowedExchangeInfo {
- exchangeBaseUrl: string;
- exchangePub: string;
-}
-
-/**
- * Data extracted from the contract terms that is relevant for payment
- * processing in the wallet.
- */
-export interface WalletContractData {
- products?: Product[];
- summaryI18n: { [lang_tag: string]: string } | undefined;
- fulfillmentUrl: string;
- contractTermsHash: string;
- merchantSig: string;
- merchantPub: string;
- merchant: MerchantInfo;
- amount: AmountJson;
- orderId: string;
- merchantBaseUrl: string;
- summary: string;
- autoRefund: Duration | undefined;
- maxWireFee: AmountJson;
- wireFeeAmortization: number;
- payDeadline: Timestamp;
- refundDeadline: Timestamp;
- allowedAuditors: AllowedAuditorInfo[];
- allowedExchanges: AllowedExchangeInfo[];
- timestamp: Timestamp;
- wireMethod: string;
- wireInfoHash: string;
- maxDepositFee: AmountJson;
-}
-
-/**
- * Record that stores status information about one purchase, starting from when
- * the customer accepts a proposal. Includes refund status if applicable.
- */
-export interface PurchaseRecord {
- /**
- * Proposal ID for this purchase. Uniquely identifies the
- * purchase and the proposal.
- */
- proposalId: string;
-
- /**
- * Contract terms we got from the merchant.
- */
- contractTermsRaw: string;
-
- contractData: WalletContractData;
-
- /**
- * Deposit permissions, available once the user has accepted the payment.
- */
- coinDepositPermissions: CoinDepositPermission[];
-
- payCoinSelection: PayCoinSelection;
-
- payCostInfo: PayCostInfo;
-
- /**
- * Timestamp of the first time that sending a payment to the merchant
- * for this purchase was successful.
- */
- timestampFirstSuccessfulPay: Timestamp | undefined;
-
- /**
- * When was the purchase made?
- * Refers to the time that the user accepted.
- */
- timestampAccept: Timestamp;
-
- /**
- * Pending refunds for the purchase. A refund is pending
- * when the merchant reports a transient error from the exchange.
- */
- refunds: { [refundKey: string]: WalletRefundItem };
-
- /**
- * When was the last refund made?
- * Set to 0 if no refund was made on the purchase.
- */
- timestampLastRefundStatus: Timestamp | undefined;
-
- /**
- * Last session signature that we submitted to /pay (if any).
- */
- lastSessionId: string | undefined;
-
- /**
- * Set for the first payment, or on re-plays.
- */
- paymentSubmitPending: boolean;
-
- /**
- * Do we need to query the merchant for the refund status
- * of the payment?
- */
- refundStatusRequested: boolean;
-
- /**
- * An abort (with refund) was requested for this (incomplete!) purchase.
- */
- abortRequested: boolean;
-
- /**
- * The abort (with refund) was completed for this (incomplete!) purchase.
- */
- abortDone: boolean;
-
- payRetryInfo: RetryInfo;
-
- lastPayError: OperationErrorDetails | undefined;
-
- /**
- * Retry information for querying the refund status with the merchant.
- */
- refundStatusRetryInfo: RetryInfo;
-
- /**
- * Last error (or undefined) for querying the refund status with the merchant.
- */
- lastRefundStatusError: OperationErrorDetails | undefined;
-
- /**
- * Continue querying the refund status until this deadline has expired.
- */
- autoRefundDeadline: Timestamp | undefined;
-}
-
-/**
- * Information about wire information for bank accounts we withdrew coins from.
- */
-export interface SenderWireRecord {
- paytoUri: string;
-}
-
-/**
- * Configuration key/value entries to configure
- * the wallet.
- */
-export interface ConfigRecord {
- key: string;
- value: any;
-}
-
-/**
- * Coin that we're depositing ourselves.
- */
-export interface DepositCoin {
- coinPaySig: CoinDepositPermission;
-
- /**
- * Undefined if coin not deposited, otherwise signature
- * from the exchange confirming the deposit.
- */
- depositedSig?: string;
-}
-
-/**
- * Record stored in the wallet's database when the user sends coins back to
- * their own bank account. Stores the status of coins that are deposited to
- * the wallet itself, where the wallet acts as a "merchant" for the customer.
- */
-export interface CoinsReturnRecord {
- contractTermsRaw: string;
-
- contractData: WalletContractData;
-
- /**
- * Private key where corresponding
- * public key is used in the contract terms
- * as merchant pub.
- */
- merchantPriv: string;
-
- coins: DepositCoin[];
-
- /**
- * Exchange base URL to deposit coins at.
- */
- exchange: string;
-
- /**
- * Our own wire information for the deposit.
- */
- wire: any;
-}
-
-export const enum WithdrawalSourceType {
- Tip = "tip",
- Reserve = "reserve",
-}
-
-export interface WithdrawalSourceTip {
- type: WithdrawalSourceType.Tip;
- tipId: string;
-}
-
-export interface WithdrawalSourceReserve {
- type: WithdrawalSourceType.Reserve;
- reservePub: string;
-}
-
-export type WithdrawalSource = WithdrawalSourceTip | WithdrawalSourceReserve;
-
-export interface DenominationSelectionInfo {
- totalCoinValue: AmountJson;
- totalWithdrawCost: AmountJson;
- selectedDenoms: {
- /**
- * How many times do we withdraw this denomination?
- */
- count: number;
- denom: DenominationRecord;
- }[];
-}
-
-export interface DenomSelectionState {
- totalCoinValue: AmountJson;
- totalWithdrawCost: AmountJson;
- selectedDenoms: {
- denomPubHash: string;
- count: number;
- }[];
-}
-
-/**
- * Group of withdrawal operations that need to be executed.
- * (Either for a normal withdrawal or from a tip.)
- *
- * The withdrawal group record is only created after we know
- * the coin selection we want to withdraw.
- */
-export interface WithdrawalGroupRecord {
- withdrawalGroupId: string;
-
- /**
- * Withdrawal source. Fields that don't apply to the respective
- * withdrawal source type must be null (i.e. can't be absent),
- * otherwise the IndexedDB indexing won't like us.
- */
- source: WithdrawalSource;
-
- exchangeBaseUrl: string;
-
- /**
- * When was the withdrawal operation started started?
- * Timestamp in milliseconds.
- */
- timestampStart: Timestamp;
-
- /**
- * When was the withdrawal operation completed?
- */
- timestampFinish?: Timestamp;
-
- /**
- * Amount including fees (i.e. the amount subtracted from the
- * reserve to withdraw all coins in this withdrawal session).
- */
- rawWithdrawalAmount: AmountJson;
-
- denomsSel: DenomSelectionState;
-
- /**
- * Retry info, always present even on completed operations so that indexing works.
- */
- retryInfo: RetryInfo;
-
- /**
- * Last error per coin/planchet, or undefined if no error occured for
- * the coin/planchet.
- */
- lastErrorPerCoin: { [coinIndex: number]: OperationErrorDetails };
-
- lastError: OperationErrorDetails | undefined;
-}
-
-export interface BankWithdrawUriRecord {
- /**
- * The withdraw URI we got from the bank.
- */
- talerWithdrawUri: string;
-
- /**
- * Reserve that was created for the withdraw URI.
- */
- reservePub: string;
-}
-
-/**
- * Status of recoup operations that were grouped together.
- *
- * The remaining amount of involved coins should be set to zero
- * in the same transaction that inserts the RecoupGroupRecord.
- */
-export interface RecoupGroupRecord {
- /**
- * Unique identifier for the recoup group record.
- */
- recoupGroupId: string;
-
- timestampStarted: Timestamp;
-
- timestampFinished: Timestamp | undefined;
-
- /**
- * Public keys that identify the coins being recouped
- * as part of this session.
- *
- * (Structured like this to enable multiEntry indexing in IndexedDB.)
- */
- coinPubs: string[];
-
- /**
- * Array of flags to indicate whether the recoup finished on each individual coin.
- */
- recoupFinishedPerCoin: boolean[];
-
- /**
- * We store old amount (i.e. before recoup) of recouped coins here,
- * as the balance of a recouped coin is set to zero when the
- * recoup group is created.
- */
- oldAmountPerCoin: AmountJson[];
-
- /**
- * Public keys of coins that should be scheduled for refreshing
- * after all individual recoups are done.
- */
- scheduleRefreshCoins: string[];
-
- /**
- * Retry info.
- */
- retryInfo: RetryInfo;
-
- /**
- * Last error that occured, if any.
- */
- lastError: OperationErrorDetails | undefined;
-}
-
-export const enum ImportPayloadType {
- CoreSchema = "core-schema",
-}
-
-/**
- * Record to keep track of data imported into the wallet.
- */
-export class WalletImportRecord {
- /**
- * Unique ID to reference this import record.
- */
- walletImportId: string;
-
- /**
- * When was the data imported?
- */
- timestampImportStarted: Timestamp;
-
- timestampImportFinished: Timestamp | undefined;
-
- payloadType: ImportPayloadType;
-
- /**
- * The actual data to import.
- */
- payload: any;
-}
-
-/* tslint:disable:completed-docs */
-
-/**
- * The stores and indices for the wallet database.
- */
-// eslint-disable-next-line @typescript-eslint/no-namespace
-export namespace Stores {
- class ExchangesStore extends Store<ExchangeRecord> {
- constructor() {
- super("exchanges", { keyPath: "baseUrl" });
- }
- }
-
- class CoinsStore extends Store<CoinRecord> {
- constructor() {
- super("coins", { keyPath: "coinPub" });
- }
-
- exchangeBaseUrlIndex = new Index<string, CoinRecord>(
- this,
- "exchangeBaseUrl",
- "exchangeBaseUrl",
- );
- denomPubIndex = new Index<string, CoinRecord>(
- this,
- "denomPubIndex",
- "denomPub",
- );
- denomPubHashIndex = new Index<string, CoinRecord>(
- this,
- "denomPubHashIndex",
- "denomPubHash",
- );
- }
-
- class ProposalsStore extends Store<ProposalRecord> {
- constructor() {
- super("proposals", { keyPath: "proposalId" });
- }
- urlAndOrderIdIndex = new Index<string, ProposalRecord>(this, "urlIndex", [
- "merchantBaseUrl",
- "orderId",
- ]);
- }
-
- class PurchasesStore extends Store<PurchaseRecord> {
- constructor() {
- super("purchases", { keyPath: "proposalId" });
- }
-
- fulfillmentUrlIndex = new Index<string, PurchaseRecord>(
- this,
- "fulfillmentUrlIndex",
- "contractData.fulfillmentUrl",
- );
- orderIdIndex = new Index<string, PurchaseRecord>(this, "orderIdIndex", [
- "contractData.merchantBaseUrl",
- "contractData.orderId",
- ]);
- }
-
- class DenominationsStore extends Store<DenominationRecord> {
- constructor() {
- // cast needed because of bug in type annotations
- super("denominations", {
- keyPath: (["exchangeBaseUrl", "denomPub"] as any) as IDBKeyPath,
- });
- }
-
- denomPubHashIndex = new Index<string, DenominationRecord>(
- this,
- "denomPubHashIndex",
- "denomPubHash",
- );
- exchangeBaseUrlIndex = new Index<string, DenominationRecord>(
- this,
- "exchangeBaseUrlIndex",
- "exchangeBaseUrl",
- );
- denomPubIndex = new Index<string, DenominationRecord>(
- this,
- "denomPubIndex",
- "denomPub",
- );
- }
-
- class CurrenciesStore extends Store<CurrencyRecord> {
- constructor() {
- super("currencies", { keyPath: "name" });
- }
- }
-
- class ConfigStore extends Store<ConfigRecord> {
- constructor() {
- super("config", { keyPath: "key" });
- }
- }
-
- class ReservesStore extends Store<ReserveRecord> {
- constructor() {
- super("reserves", { keyPath: "reservePub" });
- }
- }
-
- class ReserveHistoryStore extends Store<ReserveHistoryRecord> {
- constructor() {
- super("reserveHistory", { keyPath: "reservePub" });
- }
- }
-
- class TipsStore extends Store<TipRecord> {
- constructor() {
- super("tips", { keyPath: "tipId" });
- }
- }
-
- class SenderWiresStore extends Store<SenderWireRecord> {
- constructor() {
- super("senderWires", { keyPath: "paytoUri" });
- }
- }
-
- class WithdrawalGroupsStore extends Store<WithdrawalGroupRecord> {
- constructor() {
- super("withdrawals", { keyPath: "withdrawalGroupId" });
- }
- }
-
- class PlanchetsStore extends Store<PlanchetRecord> {
- constructor() {
- super("planchets", { keyPath: "coinPub" });
- }
- byGroupAndIndex = new Index<string, PlanchetRecord>(
- this,
- "withdrawalGroupAndCoinIdxIndex",
- ["withdrawalGroupId", "coinIdx"],
- );
- byGroup = new Index<string, PlanchetRecord>(
- this,
- "withdrawalGroupIndex",
- "withdrawalGroupId",
- );
- }
-
- class RefundEventsStore extends Store<RefundEventRecord> {
- constructor() {
- super("refundEvents", { keyPath: "refundGroupId" });
- }
- }
-
- class PayEventsStore extends Store<PayEventRecord> {
- constructor() {
- super("payEvents", { keyPath: "proposalId" });
- }
- }
-
- class ExchangeUpdatedEventsStore extends Store<ExchangeUpdatedEventRecord> {
- constructor() {
- super("exchangeUpdatedEvents", { keyPath: "exchangeBaseUrl" });
- }
- }
-
- class ReserveUpdatedEventsStore extends Store<ReserveUpdatedEventRecord> {
- constructor() {
- super("reserveUpdatedEvents", { keyPath: "reservePub" });
- }
- }
-
- class BankWithdrawUrisStore extends Store<BankWithdrawUriRecord> {
- constructor() {
- super("bankWithdrawUris", { keyPath: "talerWithdrawUri" });
- }
- }
-
- class WalletImportsStore extends Store<WalletImportRecord> {
- constructor() {
- super("walletImports", { keyPath: "walletImportId" });
- }
- }
-
- export const coins = new CoinsStore();
- export const coinsReturns = new Store<CoinsReturnRecord>("coinsReturns", {
- keyPath: "contractTermsHash",
- });
- export const config = new ConfigStore();
- export const currencies = new CurrenciesStore();
- export const denominations = new DenominationsStore();
- export const exchanges = new ExchangesStore();
- export const proposals = new ProposalsStore();
- export const refreshGroups = new Store<RefreshGroupRecord>("refreshGroups", {
- keyPath: "refreshGroupId",
- });
- export const recoupGroups = new Store<RecoupGroupRecord>("recoupGroups", {
- keyPath: "recoupGroupId",
- });
- export const reserves = new ReservesStore();
- export const reserveHistory = new ReserveHistoryStore();
- export const purchases = new PurchasesStore();
- export const tips = new TipsStore();
- export const senderWires = new SenderWiresStore();
- export const withdrawalGroups = new WithdrawalGroupsStore();
- export const planchets = new PlanchetsStore();
- export const bankWithdrawUris = new BankWithdrawUrisStore();
- export const refundEvents = new RefundEventsStore();
- export const payEvents = new PayEventsStore();
- export const reserveUpdatedEvents = new ReserveUpdatedEventsStore();
- export const exchangeUpdatedEvents = new ExchangeUpdatedEventsStore();
- export const walletImports = new WalletImportsStore();
-}
-
-/* tslint:enable:completed-docs */
diff --git a/src/types/notifications.ts b/src/types/notifications.ts
deleted file mode 100644
index 945b86eea..000000000
--- a/src/types/notifications.ts
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 GNUnet e.V.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Type and schema definitions for notifications from the wallet to clients
- * of the wallet.
- */
-
-/**
- * Imports.
- */
-import { OperationErrorDetails } from "./walletTypes";
-import { WithdrawalSource } from "./dbTypes";
-
-export const enum NotificationType {
- CoinWithdrawn = "coin-withdrawn",
- ProposalAccepted = "proposal-accepted",
- ProposalDownloaded = "proposal-downloaded",
- RefundsSubmitted = "refunds-submitted",
- RecoupStarted = "recoup-started",
- RecoupFinished = "recoup-finished",
- RefreshRevealed = "refresh-revealed",
- RefreshMelted = "refresh-melted",
- RefreshStarted = "refresh-started",
- RefreshUnwarranted = "refresh-unwarranted",
- ReserveUpdated = "reserve-updated",
- ReserveConfirmed = "reserve-confirmed",
- ReserveCreated = "reserve-created",
- WithdrawGroupCreated = "withdraw-group-created",
- WithdrawGroupFinished = "withdraw-group-finished",
- WaitingForRetry = "waiting-for-retry",
- RefundStarted = "refund-started",
- RefundQueried = "refund-queried",
- RefundFinished = "refund-finished",
- ExchangeOperationError = "exchange-operation-error",
- RefreshOperationError = "refresh-operation-error",
- RecoupOperationError = "recoup-operation-error",
- RefundApplyOperationError = "refund-apply-error",
- RefundStatusOperationError = "refund-status-error",
- ProposalOperationError = "proposal-error",
- TipOperationError = "tip-error",
- PayOperationError = "pay-error",
- WithdrawOperationError = "withdraw-error",
- ReserveNotYetFound = "reserve-not-yet-found",
- ReserveOperationError = "reserve-error",
- InternalError = "internal-error",
- PendingOperationProcessed = "pending-operation-processed",
- ProposalRefused = "proposal-refused",
- ReserveRegisteredWithBank = "reserve-registered-with-bank",
-}
-
-export interface ProposalAcceptedNotification {
- type: NotificationType.ProposalAccepted;
- proposalId: string;
-}
-
-export interface InternalErrorNotification {
- type: NotificationType.InternalError;
- message: string;
- exception: any;
-}
-
-export interface ReserveNotYetFoundNotification {
- type: NotificationType.ReserveNotYetFound;
- reservePub: string;
-}
-
-export interface CoinWithdrawnNotification {
- type: NotificationType.CoinWithdrawn;
-}
-
-export interface RefundStartedNotification {
- type: NotificationType.RefundStarted;
-}
-
-export interface RefundQueriedNotification {
- type: NotificationType.RefundQueried;
-}
-
-export interface ProposalDownloadedNotification {
- type: NotificationType.ProposalDownloaded;
- proposalId: string;
-}
-
-export interface RefundsSubmittedNotification {
- type: NotificationType.RefundsSubmitted;
- proposalId: string;
-}
-
-export interface RecoupStartedNotification {
- type: NotificationType.RecoupStarted;
-}
-
-export interface RecoupFinishedNotification {
- type: NotificationType.RecoupFinished;
-}
-
-export interface RefreshMeltedNotification {
- type: NotificationType.RefreshMelted;
-}
-
-export interface RefreshRevealedNotification {
- type: NotificationType.RefreshRevealed;
-}
-
-export interface RefreshStartedNotification {
- type: NotificationType.RefreshStarted;
-}
-
-export interface RefreshRefusedNotification {
- type: NotificationType.RefreshUnwarranted;
-}
-
-export interface ReserveUpdatedNotification {
- type: NotificationType.ReserveUpdated;
-}
-
-export interface ReserveConfirmedNotification {
- type: NotificationType.ReserveConfirmed;
-}
-
-export interface WithdrawalGroupCreatedNotification {
- type: NotificationType.WithdrawGroupCreated;
- withdrawalGroupId: string;
-}
-
-export interface WithdrawalGroupFinishedNotification {
- type: NotificationType.WithdrawGroupFinished;
- withdrawalSource: WithdrawalSource;
-}
-
-export interface WaitingForRetryNotification {
- type: NotificationType.WaitingForRetry;
- numPending: number;
- numGivingLiveness: number;
-}
-
-export interface RefundFinishedNotification {
- type: NotificationType.RefundFinished;
-}
-
-export interface ExchangeOperationErrorNotification {
- type: NotificationType.ExchangeOperationError;
- error: OperationErrorDetails;
-}
-
-export interface RefreshOperationErrorNotification {
- type: NotificationType.RefreshOperationError;
- error: OperationErrorDetails;
-}
-
-export interface RefundStatusOperationErrorNotification {
- type: NotificationType.RefundStatusOperationError;
- error: OperationErrorDetails;
-}
-
-export interface RefundApplyOperationErrorNotification {
- type: NotificationType.RefundApplyOperationError;
- error: OperationErrorDetails;
-}
-
-export interface PayOperationErrorNotification {
- type: NotificationType.PayOperationError;
- error: OperationErrorDetails;
-}
-
-export interface ProposalOperationErrorNotification {
- type: NotificationType.ProposalOperationError;
- error: OperationErrorDetails;
-}
-
-export interface TipOperationErrorNotification {
- type: NotificationType.TipOperationError;
-}
-
-export interface WithdrawOperationErrorNotification {
- type: NotificationType.WithdrawOperationError;
- error: OperationErrorDetails;
-}
-
-export interface RecoupOperationErrorNotification {
- type: NotificationType.RecoupOperationError;
- error: OperationErrorDetails;
-}
-
-export interface ReserveOperationErrorNotification {
- type: NotificationType.ReserveOperationError;
- error: OperationErrorDetails;
-}
-
-export interface ReserveCreatedNotification {
- type: NotificationType.ReserveCreated;
- reservePub: string;
-}
-
-export interface PendingOperationProcessedNotification {
- type: NotificationType.PendingOperationProcessed;
-}
-
-export interface ProposalRefusedNotification {
- type: NotificationType.ProposalRefused;
-}
-
-export interface ReserveRegisteredWithBankNotification {
- type: NotificationType.ReserveRegisteredWithBank;
-}
-
-export type WalletNotification =
- | WithdrawOperationErrorNotification
- | ReserveOperationErrorNotification
- | ExchangeOperationErrorNotification
- | RefreshOperationErrorNotification
- | RefundStatusOperationErrorNotification
- | RefundApplyOperationErrorNotification
- | ProposalOperationErrorNotification
- | PayOperationErrorNotification
- | TipOperationErrorNotification
- | ProposalAcceptedNotification
- | ProposalDownloadedNotification
- | RefundsSubmittedNotification
- | RecoupStartedNotification
- | RecoupFinishedNotification
- | RefreshMeltedNotification
- | RefreshRevealedNotification
- | RefreshStartedNotification
- | RefreshRefusedNotification
- | ReserveUpdatedNotification
- | ReserveCreatedNotification
- | ReserveConfirmedNotification
- | WithdrawalGroupFinishedNotification
- | WaitingForRetryNotification
- | RefundStartedNotification
- | RefundFinishedNotification
- | RefundQueriedNotification
- | WithdrawalGroupCreatedNotification
- | CoinWithdrawnNotification
- | RecoupOperationErrorNotification
- | InternalErrorNotification
- | PendingOperationProcessedNotification
- | ProposalRefusedNotification
- | ReserveRegisteredWithBankNotification
- | ReserveNotYetFoundNotification;
diff --git a/src/types/pending.ts b/src/types/pending.ts
deleted file mode 100644
index 85f7585c5..000000000
--- a/src/types/pending.ts
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 GNUnet e.V.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Type and schema definitions for pending operations in the wallet.
- */
-
-/**
- * Imports.
- */
-import { OperationErrorDetails, BalancesResponse } from "./walletTypes";
-import { WithdrawalSource, RetryInfo, ReserveRecordStatus } from "./dbTypes";
-import { Timestamp, Duration } from "../util/time";
-
-export const enum PendingOperationType {
- Bug = "bug",
- ExchangeUpdate = "exchange-update",
- Pay = "pay",
- ProposalChoice = "proposal-choice",
- ProposalDownload = "proposal-download",
- Refresh = "refresh",
- Reserve = "reserve",
- Recoup = "recoup",
- RefundQuery = "refund-query",
- TipChoice = "tip-choice",
- TipPickup = "tip-pickup",
- Withdraw = "withdraw",
-}
-
-/**
- * Information about a pending operation.
- */
-export type PendingOperationInfo = PendingOperationInfoCommon &
- (
- | PendingBugOperation
- | PendingExchangeUpdateOperation
- | PendingPayOperation
- | PendingProposalChoiceOperation
- | PendingProposalDownloadOperation
- | PendingRefreshOperation
- | PendingRefundQueryOperation
- | PendingReserveOperation
- | PendingTipChoiceOperation
- | PendingTipPickupOperation
- | PendingWithdrawOperation
- | PendingRecoupOperation
- );
-
-/**
- * The wallet is currently updating information about an exchange.
- */
-export interface PendingExchangeUpdateOperation {
- type: PendingOperationType.ExchangeUpdate;
- stage: ExchangeUpdateOperationStage;
- reason: string;
- exchangeBaseUrl: string;
- lastError: OperationErrorDetails | undefined;
-}
-
-/**
- * Some interal error happened in the wallet. This pending operation
- * should *only* be reported for problems in the wallet, not when
- * a problem with a merchant/exchange/etc. occurs.
- */
-export interface PendingBugOperation {
- type: PendingOperationType.Bug;
- message: string;
- details: any;
-}
-
-/**
- * Current state of an exchange update operation.
- */
-export const enum ExchangeUpdateOperationStage {
- FetchKeys = "fetch-keys",
- FetchWire = "fetch-wire",
- FinalizeUpdate = "finalize-update",
-}
-
-export const enum ReserveType {
- /**
- * Manually created.
- */
- Manual = "manual",
- /**
- * Withdrawn from a bank that has "tight" Taler integration
- */
- TalerBankWithdraw = "taler-bank-withdraw",
-}
-
-/**
- * Status of processing a reserve.
- *
- * Does *not* include the withdrawal operation that might result
- * from this.
- */
-export interface PendingReserveOperation {
- type: PendingOperationType.Reserve;
- retryInfo: RetryInfo | undefined;
- stage: ReserveRecordStatus;
- timestampCreated: Timestamp;
- reserveType: ReserveType;
- reservePub: string;
- bankWithdrawConfirmUrl?: string;
-}
-
-/**
- * Status of an ongoing withdrawal operation.
- */
-export interface PendingRefreshOperation {
- type: PendingOperationType.Refresh;
- lastError?: OperationErrorDetails;
- refreshGroupId: string;
- finishedPerCoin: boolean[];
- retryInfo: RetryInfo;
-}
-
-/**
- * Status of downloading signed contract terms from a merchant.
- */
-export interface PendingProposalDownloadOperation {
- type: PendingOperationType.ProposalDownload;
- merchantBaseUrl: string;
- proposalTimestamp: Timestamp;
- proposalId: string;
- orderId: string;
- lastError?: OperationErrorDetails;
- retryInfo: RetryInfo;
-}
-
-/**
- * User must choose whether to accept or reject the merchant's
- * proposed contract terms.
- */
-export interface PendingProposalChoiceOperation {
- type: PendingOperationType.ProposalChoice;
- merchantBaseUrl: string;
- proposalTimestamp: Timestamp;
- proposalId: string;
-}
-
-/**
- * The wallet is picking up a tip that the user has accepted.
- */
-export interface PendingTipPickupOperation {
- type: PendingOperationType.TipPickup;
- tipId: string;
- merchantBaseUrl: string;
- merchantTipId: string;
-}
-
-/**
- * The wallet has been offered a tip, and the user now needs to
- * decide whether to accept or reject the tip.
- */
-export interface PendingTipChoiceOperation {
- type: PendingOperationType.TipChoice;
- tipId: string;
- merchantBaseUrl: string;
- merchantTipId: string;
-}
-
-/**
- * The wallet is signing coins and then sending them to
- * the merchant.
- */
-export interface PendingPayOperation {
- type: PendingOperationType.Pay;
- proposalId: string;
- isReplay: boolean;
- retryInfo: RetryInfo;
- lastError: OperationErrorDetails | undefined;
-}
-
-/**
- * The wallet is querying the merchant about whether any refund
- * permissions are available for a purchase.
- */
-export interface PendingRefundQueryOperation {
- type: PendingOperationType.RefundQuery;
- proposalId: string;
- retryInfo: RetryInfo;
- lastError: OperationErrorDetails | undefined;
-}
-
-export interface PendingRecoupOperation {
- type: PendingOperationType.Recoup;
- recoupGroupId: string;
- retryInfo: RetryInfo;
- lastError: OperationErrorDetails | undefined;
-}
-
-/**
- * Status of an ongoing withdrawal operation.
- */
-export interface PendingWithdrawOperation {
- type: PendingOperationType.Withdraw;
- source: WithdrawalSource;
- lastError: OperationErrorDetails | undefined;
- withdrawalGroupId: string;
- numCoinsWithdrawn: number;
- numCoinsTotal: number;
-}
-
-/**
- * Fields that are present in every pending operation.
- */
-export interface PendingOperationInfoCommon {
- /**
- * Type of the pending operation.
- */
- type: PendingOperationType;
-
- /**
- * Set to true if the operation indicates that something is really in progress,
- * as opposed to some regular scheduled operation or a permanent failure.
- */
- givesLifeness: boolean;
-}
-
-/**
- * Response returned from the pending operations API.
- */
-export interface PendingOperationsResponse {
- /**
- * List of pending operations.
- */
- pendingOperations: PendingOperationInfo[];
-
- /**
- * Current wallet balance, including pending balances.
- */
- walletBalance: BalancesResponse;
-
- /**
- * When is the next pending operation due to be re-tried?
- */
- nextRetryDelay: Duration;
-
- /**
- * Does this response only include pending operations that
- * are due to be executed right now?
- */
- onlyDue: boolean;
-}
diff --git a/src/types/schemacore.ts b/src/types/schemacore.ts
deleted file mode 100644
index 820f68d18..000000000
--- a/src/types/schemacore.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Core of the wallet's schema, used for painless export, import
- * and schema migration.
- *
- * If this schema is extended, it must be extended in a completely
- * backwards-compatible way.
- */
-
-interface CoreCoin {
- exchangeBaseUrl: string;
- coinPub: string;
- coinPriv: string;
- amountRemaining: string;
-}
-
-interface CorePurchase {
- noncePub: string;
- noncePriv: string;
- paySig: string;
- contractTerms: any;
-}
-
-interface CoreReserve {
- reservePub: string;
- reservePriv: string;
- exchangeBaseUrl: string;
-}
-
-interface SchemaCore {
- coins: CoreCoin[];
- purchases: CorePurchase[];
-
- /**
- * Schema version (of full schema) of wallet that exported the core schema.
- */
- versionExporter: number;
-
- /**
- * Schema version of the database that has been exported to the core schema
- */
- versionSourceDatabase: number;
-}
diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts
deleted file mode 100644
index 95c1a711c..000000000
--- a/src/types/talerTypes.ts
+++ /dev/null
@@ -1,1271 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 GNUnet e.V.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Type and schema definitions and helpers for the core GNU Taler protocol.
- *
- * All types here should be "@Checkable".
- *
- * Even though the rest of the wallet uses camelCase for fields, use snake_case
- * here, since that's the convention for the Taler JSON+HTTP API.
- */
-
-/**
- * Imports.
- */
-
-import {
- makeCodecForObject,
- codecForString,
- makeCodecForList,
- makeCodecOptional,
- codecForAny,
- codecForNumber,
- codecForBoolean,
- makeCodecForMap,
- Codec,
- makeCodecForConstNumber,
- makeCodecForUnion,
- makeCodecForConstString,
-} from "../util/codec";
-import {
- Timestamp,
- codecForTimestamp,
- Duration,
- codecForDuration,
-} from "../util/time";
-import { ExchangeListItem } from "./walletTypes";
-
-/**
- * Denomination as found in the /keys response from the exchange.
- */
-export class Denomination {
- /**
- * Value of one coin of the denomination.
- */
- value: string;
-
- /**
- * Public signing key of the denomination.
- */
- denom_pub: string;
-
- /**
- * Fee for withdrawing.
- */
- fee_withdraw: string;
-
- /**
- * Fee for depositing.
- */
- fee_deposit: string;
-
- /**
- * Fee for refreshing.
- */
- fee_refresh: string;
-
- /**
- * Fee for refunding.
- */
- fee_refund: string;
-
- /**
- * Start date from which withdraw is allowed.
- */
- stamp_start: Timestamp;
-
- /**
- * End date for withdrawing.
- */
- stamp_expire_withdraw: Timestamp;
-
- /**
- * Expiration date after which the exchange can forget about
- * the currency.
- */
- stamp_expire_legal: Timestamp;
-
- /**
- * Date after which the coins of this denomination can't be
- * deposited anymore.
- */
- stamp_expire_deposit: Timestamp;
-
- /**
- * Signature over the denomination information by the exchange's master
- * signing key.
- */
- master_sig: string;
-}
-
-/**
- * Signature by the auditor that a particular denomination key is audited.
- */
-export class AuditorDenomSig {
- /**
- * Denomination public key's hash.
- */
- denom_pub_h: string;
-
- /**
- * The signature.
- */
- auditor_sig: string;
-}
-
-/**
- * Auditor information as given by the exchange in /keys.
- */
-export class Auditor {
- /**
- * Auditor's public key.
- */
- auditor_pub: string;
-
- /**
- * Base URL of the auditor.
- */
- auditor_url: string;
-
- /**
- * List of signatures for denominations by the auditor.
- */
- denomination_keys: AuditorDenomSig[];
-}
-
-/**
- * Request that we send to the exchange to get a payback.
- */
-export interface RecoupRequest {
- /**
- * Hashed enomination public key of the coin we want to get
- * paid back.
- */
- denom_pub_hash: string;
-
- /**
- * Signature over the coin public key by the denomination.
- */
- denom_sig: string;
-
- /**
- * Coin public key of the coin we want to refund.
- */
- coin_pub: string;
-
- /**
- * Blinding key that was used during withdraw,
- * used to prove that we were actually withdrawing the coin.
- */
- coin_blind_key_secret: string;
-
- /**
- * Signature made by the coin, authorizing the payback.
- */
- coin_sig: string;
-
- /**
- * Was the coin refreshed (and thus the recoup should go to the old coin)?
- */
- refreshed: boolean;
-}
-
-/**
- * Response that we get from the exchange for a payback request.
- */
-export class RecoupConfirmation {
- /**
- * Public key of the reserve that will receive the payback.
- */
- reserve_pub?: string;
-
- /**
- * Public key of the old coin that will receive the recoup,
- * provided if refreshed was true.
- */
- old_coin_pub?: string;
-}
-
-/**
- * Deposit permission for a single coin.
- */
-export interface CoinDepositPermission {
- /**
- * Signature by the coin.
- */
- coin_sig: string;
- /**
- * Public key of the coin being spend.
- */
- coin_pub: string;
- /**
- * Signature made by the denomination public key.
- */
- ub_sig: string;
- /**
- * The denomination public key associated with this coin.
- */
- h_denom: string;
- /**
- * The amount that is subtracted from this coin with this payment.
- */
- contribution: string;
-
- /**
- * URL of the exchange this coin was withdrawn from.
- */
- exchange_url: string;
-}
-
-/**
- * Information about an exchange as stored inside a
- * merchant's contract terms.
- */
-export class ExchangeHandle {
- /**
- * Master public signing key of the exchange.
- */
- master_pub: string;
-
- /**
- * Base URL of the exchange.
- */
- url: string;
-}
-
-export class AuditorHandle {
- /**
- * Official name of the auditor.
- */
- name: string;
-
- /**
- * Master public signing key of the auditor.
- */
- master_pub: string;
-
- /**
- * Base URL of the auditor.
- */
- url: string;
-}
-
-export interface MerchantInfo {
- name: string;
- jurisdiction: string | undefined;
- address: string | undefined;
-}
-
-export interface Tax {
- // the name of the tax
- name: string;
-
- // amount paid in tax
- tax: AmountString;
-}
-
-export interface Product {
- // merchant-internal identifier for the product.
- product_id?: string;
-
- // Human-readable product description.
- description: string;
-
- // Map from IETF BCP 47 language tags to localized descriptions
- description_i18n?: { [lang_tag: string]: string };
-
- // The number of units of the product to deliver to the customer.
- quantity?: number;
-
- // The unit in which the product is measured (liters, kilograms, packages, etc.)
- unit?: string;
-
- // The price of the product; this is the total price for quantity times unit of this product.
- price?: AmountString;
-
- // An optional base64-encoded product image
- image?: string;
-
- // a list of taxes paid by the merchant for this product. Can be empty.
- taxes?: Tax[];
-
- // time indicating when this product should be delivered
- delivery_date?: Timestamp;
-
- // where to deliver this product. This may be an URL for online delivery
- // (i.e. 'http://example.com/download' or 'mailto:customer@example.com'),
- // or a location label defined inside the proposition's 'locations'.
- // The presence of a colon (':') indicates the use of an URL.
- delivery_location?: string;
-}
-
-/**
- * Contract terms from a merchant.
- */
-export class ContractTerms {
- /**
- * Hash of the merchant's wire details.
- */
- h_wire: string;
-
- /**
- * Hash of the merchant's wire details.
- */
- auto_refund?: Duration;
-
- /**
- * Wire method the merchant wants to use.
- */
- wire_method: string;
-
- /**
- * Human-readable short summary of the contract.
- */
- summary: string;
-
- summary_i18n?: { [lang_tag: string]: string };
-
- /**
- * Nonce used to ensure freshness.
- */
- nonce: string;
-
- /**
- * Total amount payable.
- */
- amount: string;
-
- /**
- * Auditors accepted by the merchant.
- */
- auditors: AuditorHandle[];
-
- /**
- * Deadline to pay for the contract.
- */
- pay_deadline: Timestamp;
-
- /**
- * Delivery locations.
- */
- locations: any;
-
- /**
- * Maximum deposit fee covered by the merchant.
- */
- max_fee: string;
-
- /**
- * Information about the merchant.
- */
- merchant: MerchantInfo;
-
- /**
- * Public key of the merchant.
- */
- merchant_pub: string;
-
- /**
- * List of accepted exchanges.
- */
- exchanges: ExchangeHandle[];
-
- /**
- * Products that are sold in this contract.
- */
- products?: Product[];
-
- /**
- * Deadline for refunds.
- */
- refund_deadline: Timestamp;
-
- /**
- * Deadline for the wire transfer.
- */
- wire_transfer_deadline: Timestamp;
-
- /**
- * Time when the contract was generated by the merchant.
- */
- timestamp: Timestamp;
-
- /**
- * Order id to uniquely identify the purchase within
- * one merchant instance.
- */
- order_id: string;
-
- /**
- * Base URL of the merchant's backend.
- */
- merchant_base_url: string;
-
- /**
- * Fulfillment URL to view the product or
- * delivery status.
- */
- fulfillment_url: string;
-
- /**
- * Share of the wire fee that must be settled with one payment.
- */
- wire_fee_amortization?: number;
-
- /**
- * Maximum wire fee that the merchant agrees to pay for.
- */
- max_wire_fee?: string;
-
- /**
- * Extra data, interpreted by the mechant only.
- */
- extra: any;
-}
-
-/**
- * Refund permission in the format that the merchant gives it to us.
- */
-export class MerchantAbortPayRefundDetails {
- /**
- * Amount to be refunded.
- */
- refund_amount: string;
-
- /**
- * Fee for the refund.
- */
- refund_fee: string;
-
- /**
- * Public key of the coin being refunded.
- */
- coin_pub: string;
-
- /**
- * Refund transaction ID between merchant and exchange.
- */
- rtransaction_id: number;
-
- /**
- * Exchange's key used for the signature.
- */
- exchange_pub?: string;
-
- /**
- * Exchange's signature to confirm the refund.
- */
- exchange_sig?: string;
-
- /**
- * Error replay from the exchange (if any).
- */
- exchange_reply?: any;
-
- /**
- * Error code from the exchange (if any).
- */
- exchange_code?: number;
-
- /**
- * HTTP status code of the exchange's response
- * to the merchant's refund request.
- */
- exchange_http_status: number;
-}
-
-/**
- * Response for a refund pickup or a /pay in abort mode.
- */
-export class MerchantRefundResponse {
- /**
- * Public key of the merchant
- */
- merchant_pub: string;
-
- /**
- * Contract terms hash of the contract that
- * is being refunded.
- */
- h_contract_terms: string;
-
- /**
- * The signed refund permissions, to be sent to the exchange.
- */
- refunds: MerchantAbortPayRefundDetails[];
-}
-
-/**
- * Planchet detail sent to the merchant.
- */
-export interface TipPlanchetDetail {
- /**
- * Hashed denomination public key.
- */
- denom_pub_hash: string;
-
- /**
- * Coin's blinded public key.
- */
- coin_ev: string;
-}
-
-/**
- * Request sent to the merchant to pick up a tip.
- */
-export interface TipPickupRequest {
- /**
- * Identifier of the tip.
- */
- tip_id: string;
-
- /**
- * List of planchets the wallet wants to use for the tip.
- */
- planchets: TipPlanchetDetail[];
-}
-
-/**
- * Reserve signature, defined as separate class to facilitate
- * schema validation with "@Checkable".
- */
-export class ReserveSigSingleton {
- /**
- * Reserve signature.
- */
- reserve_sig: string;
-}
-
-/**
- * Response of the merchant
- * to the TipPickupRequest.
- */
-export class TipResponse {
- /**
- * Public key of the reserve
- */
- reserve_pub: string;
-
- /**
- * The order of the signatures matches the planchets list.
- */
- reserve_sigs: ReserveSigSingleton[];
-}
-
-/**
- * Element of the payback list that the
- * exchange gives us in /keys.
- */
-export class Recoup {
- /**
- * The hash of the denomination public key for which the payback is offered.
- */
- h_denom_pub: string;
-}
-
-/**
- * Structure of one exchange signing key in the /keys response.
- */
-export class ExchangeSignKeyJson {
- stamp_start: Timestamp;
- stamp_expire: Timestamp;
- stamp_end: Timestamp;
- key: EddsaPublicKeyString;
- master_sig: EddsaSignatureString;
-}
-
-/**
- * Structure that the exchange gives us in /keys.
- */
-export class ExchangeKeysJson {
- /**
- * List of offered denominations.
- */
- denoms: Denomination[];
-
- /**
- * The exchange's master public key.
- */
- master_public_key: string;
-
- /**
- * The list of auditors (partially) auditing the exchange.
- */
- auditors: Auditor[];
-
- /**
- * Timestamp when this response was issued.
- */
- list_issue_date: Timestamp;
-
- /**
- * List of revoked denominations.
- */
- recoup?: Recoup[];
-
- /**
- * Short-lived signing keys used to sign online
- * responses.
- */
- signkeys: ExchangeSignKeyJson[];
-
- /**
- * Protocol version.
- */
- version: string;
-}
-
-/**
- * Wire fees as anounced by the exchange.
- */
-export class WireFeesJson {
- /**
- * Cost of a wire transfer.
- */
- wire_fee: string;
-
- /**
- * Cost of clising a reserve.
- */
- closing_fee: string;
-
- /**
- * Signature made with the exchange's master key.
- */
- sig: string;
-
- /**
- * Date from which the fee applies.
- */
- start_date: Timestamp;
-
- /**
- * Data after which the fee doesn't apply anymore.
- */
- end_date: Timestamp;
-}
-
-export class AccountInfo {
- payto_uri: string;
- master_sig: string;
-}
-
-export class ExchangeWireJson {
- accounts: AccountInfo[];
- fees: { [methodName: string]: WireFeesJson[] };
-}
-
-/**
- * Proposal returned from the contract URL.
- */
-export class Proposal {
- /**
- * Contract terms for the propoal.
- * Raw, un-decoded JSON object.
- */
- contract_terms: any;
-
- /**
- * Signature over contract, made by the merchant. The public key used for signing
- * must be contract_terms.merchant_pub.
- */
- sig: string;
-}
-
-/**
- * Response from the internal merchant API.
- */
-export class CheckPaymentResponse {
- order_status: string;
- refunded: boolean | undefined;
- refunded_amount: string | undefined;
- contract_terms: any | undefined;
- taler_pay_uri: string | undefined;
- contract_url: string | undefined;
-}
-
-/**
- * Response from the bank.
- */
-export class WithdrawOperationStatusResponse {
- selection_done: boolean;
-
- transfer_done: boolean;
-
- amount: string;
-
- sender_wire?: string;
-
- suggested_exchange?: string;
-
- confirm_transfer_url?: string;
-
- wire_types: string[];
-}
-
-/**
- * Response from the merchant.
- */
-export class TipPickupGetResponse {
- extra: any;
-
- amount: string;
-
- amount_left: string;
-
- exchange_url: string;
-
- stamp_expire: Timestamp;
-
- stamp_created: Timestamp;
-}
-
-export class WithdrawResponse {
- ev_sig: string;
-}
-
-/**
- * Easy to process format for the public data of coins
- * managed by the wallet.
- */
-export interface CoinDumpJson {
- coins: Array<{
- /**
- * The coin's denomination's public key.
- */
- denom_pub: string;
- /**
- * Hash of denom_pub.
- */
- denom_pub_hash: string;
- /**
- * Value of the denomination (without any fees).
- */
- denom_value: string;
- /**
- * Public key of the coin.
- */
- coin_pub: string;
- /**
- * Base URL of the exchange for the coin.
- */
- exchange_base_url: string;
- /**
- * Remaining value on the coin, to the knowledge of
- * the wallet.
- */
- remaining_value: string;
- /**
- * Public key of the parent coin.
- * Only present if this coin was obtained via refreshing.
- */
- refresh_parent_coin_pub: string | undefined;
- /**
- * Public key of the reserve for this coin.
- * Only present if this coin was obtained via refreshing.
- */
- withdrawal_reserve_pub: string | undefined;
- /**
- * Is the coin suspended?
- * Suspended coins are not considered for payments.
- */
- coin_suspended: boolean;
- }>;
-}
-
-export interface MerchantPayResponse {
- sig: string;
-}
-
-export interface ExchangeMeltResponse {
- /**
- * Which of the kappa indices does the client not have to reveal.
- */
- noreveal_index: number;
-
- /**
- * Signature of TALER_RefreshMeltConfirmationPS whereby the exchange
- * affirms the successful melt and confirming the noreveal_index
- */
- exchange_sig: EddsaSignatureString;
-
- /*
- * public EdDSA key of the exchange that was used to generate the signature.
- * Should match one of the exchange's signing keys from /keys. Again given
- * explicitly as the client might otherwise be confused by clock skew as to
- * which signing key was used.
- */
- exchange_pub: EddsaPublicKeyString;
-
- /*
- * Base URL to use for operations on the refresh context
- * (so the reveal operation). If not given,
- * the base URL is the same as the one used for this request.
- * Can be used if the base URL for /refreshes/ differs from that
- * for /coins/, i.e. for load balancing. Clients SHOULD
- * respect the refresh_base_url if provided. Any HTTP server
- * belonging to an exchange MUST generate a 307 or 308 redirection
- * to the correct base URL should a client uses the wrong base
- * URL, or if the base URL has changed since the melt.
- *
- * When melting the same coin twice (technically allowed
- * as the response might have been lost on the network),
- * the exchange may return different values for the refresh_base_url.
- */
- refresh_base_url?: string;
-}
-
-export interface ExchangeRevealItem {
- ev_sig: string;
-}
-
-export interface ExchangeRevealResponse {
- // List of the exchange's blinded RSA signatures on the new coins.
- ev_sigs: ExchangeRevealItem[];
-}
-
-interface MerchantOrderStatusPaid {
-
- /**
- * Was the payment refunded (even partially, via refund or abort)?
- */
- refunded: boolean;
-
- /**
- * Amount that was refunded in total.
- */
- refund_amount: AmountString;
-
- /**
- * Successful refunds for this payment, empty array for none.
- */
- refunds: MerchantCoinRefundStatus[];
-
- /**
- * Public key of the merchant.
- */
- merchant_pub: EddsaPublicKeyString;
-}
-
-export type MerchantCoinRefundStatus =
- | MerchantCoinRefundSuccessStatus
- | MerchantCoinRefundFailureStatus;
-
-export interface MerchantCoinRefundSuccessStatus {
- type: "success";
-
- // HTTP status of the exchange request, 200 (integer) required for refund confirmations.
- exchange_status: 200;
-
- // the EdDSA :ref:signature (binary-only) with purpose
- // TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the
- // exchange affirming the successful refund
- exchange_sig: EddsaSignatureString;
-
- // public EdDSA key of the exchange that was used to generate the signature.
- // Should match one of the exchange's signing keys from /keys. It is given
- // explicitly as the client might otherwise be confused by clock skew as to
- // which signing key was used.
- exchange_pub: EddsaPublicKeyString;
-
- // Refund transaction ID.
- rtransaction_id: number;
-
- // public key of a coin that was refunded
- coin_pub: EddsaPublicKeyString;
-
- // Amount that was refunded, including refund fee charged by the exchange
- // to the customer.
- refund_amount: AmountString;
-
- execution_time: Timestamp;
-}
-
-export interface MerchantCoinRefundFailureStatus {
- type: "failure";
-
- // HTTP status of the exchange request, must NOT be 200.
- exchange_status: number;
-
- // Taler error code from the exchange reply, if available.
- exchange_code?: number;
-
- // If available, HTTP reply from the exchange.
- exchange_reply?: any;
-
- // Refund transaction ID.
- rtransaction_id: number;
-
- // public key of a coin that was refunded
- coin_pub: EddsaPublicKeyString;
-
- // Amount that was refunded, including refund fee charged by the exchange
- // to the customer.
- refund_amount: AmountString;
-
- execution_time: Timestamp;
-}
-
-export interface MerchantOrderStatusUnpaid {
- /**
- * URI that the wallet must process to complete the payment.
- */
- taler_pay_uri: string;
-
- /**
- * Alternative order ID which was paid for already in the same session.
- *
- * Only given if the same product was purchased before in the same session.
- */
- already_paid_order_id?: string;
-}
-
-export interface WithdrawUriInfoResponse {
- amount: AmountString;
- defaultExchangeBaseUrl?: string;
- possibleExchanges: ExchangeListItem[];
-}
-
-/**
- * Response body for the following endpoint:
- *
- * POST {talerBankIntegrationApi}/withdrawal-operation/{wopid}
- */
-export interface BankWithdrawalOperationPostResponse {
- transfer_done: boolean;
-}
-
-export const codecForBankWithdrawalOperationPostResponse = (): Codec<BankWithdrawalOperationPostResponse> =>
- makeCodecForObject<BankWithdrawalOperationPostResponse>()
- .property("transfer_done", codecForBoolean)
- .build("BankWithdrawalOperationPostResponse");
-
-export type AmountString = string;
-export type Base32String = string;
-export type EddsaSignatureString = string;
-export type EddsaPublicKeyString = string;
-export type CoinPublicKeyString = string;
-
-export const codecForDenomination = (): Codec<Denomination> =>
- makeCodecForObject<Denomination>()
- .property("value", codecForString)
- .property("denom_pub", codecForString)
- .property("fee_withdraw", codecForString)
- .property("fee_deposit", codecForString)
- .property("fee_refresh", codecForString)
- .property("fee_refund", codecForString)
- .property("stamp_start", codecForTimestamp)
- .property("stamp_expire_withdraw", codecForTimestamp)
- .property("stamp_expire_legal", codecForTimestamp)
- .property("stamp_expire_deposit", codecForTimestamp)
- .property("master_sig", codecForString)
- .build("Denomination");
-
-export const codecForAuditorDenomSig = (): Codec<AuditorDenomSig> =>
- makeCodecForObject<AuditorDenomSig>()
- .property("denom_pub_h", codecForString)
- .property("auditor_sig", codecForString)
- .build("AuditorDenomSig");
-
-export const codecForAuditor = (): Codec<Auditor> =>
- makeCodecForObject<Auditor>()
- .property("auditor_pub", codecForString)
- .property("auditor_url", codecForString)
- .property("denomination_keys", makeCodecForList(codecForAuditorDenomSig()))
- .build("Auditor");
-
-export const codecForExchangeHandle = (): Codec<ExchangeHandle> =>
- makeCodecForObject<ExchangeHandle>()
- .property("master_pub", codecForString)
- .property("url", codecForString)
- .build("ExchangeHandle");
-
-export const codecForAuditorHandle = (): Codec<AuditorHandle> =>
- makeCodecForObject<AuditorHandle>()
- .property("name", codecForString)
- .property("master_pub", codecForString)
- .property("url", codecForString)
- .build("AuditorHandle");
-
-export const codecForMerchantInfo = (): Codec<MerchantInfo> =>
- makeCodecForObject<MerchantInfo>()
- .property("name", codecForString)
- .property("address", makeCodecOptional(codecForString))
- .property("jurisdiction", makeCodecOptional(codecForString))
- .build("MerchantInfo");
-
-export const codecForTax = (): Codec<Tax> =>
- makeCodecForObject<Tax>()
- .property("name", codecForString)
- .property("tax", codecForString)
- .build("Tax");
-
-export const codecForI18n = (): Codec<{ [lang_tag: string]: string }> =>
- makeCodecForMap(codecForString);
-
-export const codecForProduct = (): Codec<Product> =>
- makeCodecForObject<Product>()
- .property("product_id", makeCodecOptional(codecForString))
- .property("description", codecForString)
- .property("description_i18n", makeCodecOptional(codecForI18n()))
- .property("quantity", makeCodecOptional(codecForNumber))
- .property("unit", makeCodecOptional(codecForString))
- .property("price", makeCodecOptional(codecForString))
- .property("delivery_date", makeCodecOptional(codecForTimestamp))
- .property("delivery_location", makeCodecOptional(codecForString))
- .build("Tax");
-
-export const codecForContractTerms = (): Codec<ContractTerms> =>
- makeCodecForObject<ContractTerms>()
- .property("order_id", codecForString)
- .property("fulfillment_url", codecForString)
- .property("merchant_base_url", codecForString)
- .property("h_wire", codecForString)
- .property("auto_refund", makeCodecOptional(codecForDuration))
- .property("wire_method", codecForString)
- .property("summary", codecForString)
- .property("summary_i18n", makeCodecOptional(codecForI18n()))
- .property("nonce", codecForString)
- .property("amount", codecForString)
- .property("auditors", makeCodecForList(codecForAuditorHandle()))
- .property("pay_deadline", codecForTimestamp)
- .property("refund_deadline", codecForTimestamp)
- .property("wire_transfer_deadline", codecForTimestamp)
- .property("timestamp", codecForTimestamp)
- .property("locations", codecForAny)
- .property("max_fee", codecForString)
- .property("max_wire_fee", makeCodecOptional(codecForString))
- .property("merchant", codecForMerchantInfo())
- .property("merchant_pub", codecForString)
- .property("exchanges", makeCodecForList(codecForExchangeHandle()))
- .property(
- "products",
- makeCodecOptional(makeCodecForList(codecForProduct())),
- )
- .property("extra", codecForAny)
- .build("ContractTerms");
-
-export const codecForMerchantRefundPermission = (): Codec<
- MerchantAbortPayRefundDetails
-> =>
- makeCodecForObject<MerchantAbortPayRefundDetails>()
- .property("refund_amount", codecForString)
- .property("refund_fee", codecForString)
- .property("coin_pub", codecForString)
- .property("rtransaction_id", codecForNumber)
- .property("exchange_http_status", codecForNumber)
- .property("exchange_code", makeCodecOptional(codecForNumber))
- .property("exchange_reply", makeCodecOptional(codecForAny))
- .property("exchange_sig", makeCodecOptional(codecForString))
- .property("exchange_pub", makeCodecOptional(codecForString))
- .build("MerchantRefundPermission");
-
-export const codecForMerchantRefundResponse = (): Codec<
- MerchantRefundResponse
-> =>
- makeCodecForObject<MerchantRefundResponse>()
- .property("merchant_pub", codecForString)
- .property("h_contract_terms", codecForString)
- .property("refunds", makeCodecForList(codecForMerchantRefundPermission()))
- .build("MerchantRefundResponse");
-
-export const codecForReserveSigSingleton = (): Codec<ReserveSigSingleton> =>
- makeCodecForObject<ReserveSigSingleton>()
- .property("reserve_sig", codecForString)
- .build("ReserveSigSingleton");
-
-export const codecForTipResponse = (): Codec<TipResponse> =>
- makeCodecForObject<TipResponse>()
- .property("reserve_pub", codecForString)
- .property("reserve_sigs", makeCodecForList(codecForReserveSigSingleton()))
- .build("TipResponse");
-
-export const codecForRecoup = (): Codec<Recoup> =>
- makeCodecForObject<Recoup>()
- .property("h_denom_pub", codecForString)
- .build("Recoup");
-
-export const codecForExchangeSigningKey = (): Codec<ExchangeSignKeyJson> =>
- makeCodecForObject<ExchangeSignKeyJson>()
- .property("key", codecForString)
- .property("master_sig", codecForString)
- .property("stamp_end", codecForTimestamp)
- .property("stamp_start", codecForTimestamp)
- .property("stamp_expire", codecForTimestamp)
- .build("ExchangeSignKeyJson");
-
-export const codecForExchangeKeysJson = (): Codec<ExchangeKeysJson> =>
- makeCodecForObject<ExchangeKeysJson>()
- .property("denoms", makeCodecForList(codecForDenomination()))
- .property("master_public_key", codecForString)
- .property("auditors", makeCodecForList(codecForAuditor()))
- .property("list_issue_date", codecForTimestamp)
- .property("recoup", makeCodecOptional(makeCodecForList(codecForRecoup())))
- .property("signkeys", makeCodecForList(codecForExchangeSigningKey()))
- .property("version", codecForString)
- .build("KeysJson");
-
-export const codecForWireFeesJson = (): Codec<WireFeesJson> =>
- makeCodecForObject<WireFeesJson>()
- .property("wire_fee", codecForString)
- .property("closing_fee", codecForString)
- .property("sig", codecForString)
- .property("start_date", codecForTimestamp)
- .property("end_date", codecForTimestamp)
- .build("WireFeesJson");
-
-export const codecForAccountInfo = (): Codec<AccountInfo> =>
- makeCodecForObject<AccountInfo>()
- .property("payto_uri", codecForString)
- .property("master_sig", codecForString)
- .build("AccountInfo");
-
-export const codecForExchangeWireJson = (): Codec<ExchangeWireJson> =>
- makeCodecForObject<ExchangeWireJson>()
- .property("accounts", makeCodecForList(codecForAccountInfo()))
- .property("fees", makeCodecForMap(makeCodecForList(codecForWireFeesJson())))
- .build("ExchangeWireJson");
-
-export const codecForProposal = (): Codec<Proposal> =>
- makeCodecForObject<Proposal>()
- .property("contract_terms", codecForAny)
- .property("sig", codecForString)
- .build("Proposal");
-
-export const codecForCheckPaymentResponse = (): Codec<CheckPaymentResponse> =>
- makeCodecForObject<CheckPaymentResponse>()
- .property("order_status", codecForString)
- .property("refunded", makeCodecOptional(codecForBoolean))
- .property("refunded_amount", makeCodecOptional(codecForString))
- .property("contract_terms", makeCodecOptional(codecForAny))
- .property("taler_pay_uri", makeCodecOptional(codecForString))
- .property("contract_url", makeCodecOptional(codecForString))
- .build("CheckPaymentResponse");
-
-export const codecForWithdrawOperationStatusResponse = (): Codec<
- WithdrawOperationStatusResponse
-> =>
- makeCodecForObject<WithdrawOperationStatusResponse>()
- .property("selection_done", codecForBoolean)
- .property("transfer_done", codecForBoolean)
- .property("amount", codecForString)
- .property("sender_wire", makeCodecOptional(codecForString))
- .property("suggested_exchange", makeCodecOptional(codecForString))
- .property("confirm_transfer_url", makeCodecOptional(codecForString))
- .property("wire_types", makeCodecForList(codecForString))
- .build("WithdrawOperationStatusResponse");
-
-export const codecForTipPickupGetResponse = (): Codec<TipPickupGetResponse> =>
- makeCodecForObject<TipPickupGetResponse>()
- .property("extra", codecForAny)
- .property("amount", codecForString)
- .property("amount_left", codecForString)
- .property("exchange_url", codecForString)
- .property("stamp_expire", codecForTimestamp)
- .property("stamp_created", codecForTimestamp)
- .build("TipPickupGetResponse");
-
-export const codecForRecoupConfirmation = (): Codec<RecoupConfirmation> =>
- makeCodecForObject<RecoupConfirmation>()
- .property("reserve_pub", makeCodecOptional(codecForString))
- .property("old_coin_pub", makeCodecOptional(codecForString))
- .build("RecoupConfirmation");
-
-export const codecForWithdrawResponse = (): Codec<WithdrawResponse> =>
- makeCodecForObject<WithdrawResponse>()
- .property("ev_sig", codecForString)
- .build("WithdrawResponse");
-
-export const codecForMerchantPayResponse = (): Codec<MerchantPayResponse> =>
- makeCodecForObject<MerchantPayResponse>()
- .property("sig", codecForString)
- .build("MerchantPayResponse");
-
-export const codecForExchangeMeltResponse = (): Codec<ExchangeMeltResponse> =>
- makeCodecForObject<ExchangeMeltResponse>()
- .property("exchange_pub", codecForString)
- .property("exchange_sig", codecForString)
- .property("noreveal_index", codecForNumber)
- .property("refresh_base_url", makeCodecOptional(codecForString))
- .build("ExchangeMeltResponse");
-
-export const codecForExchangeRevealItem = (): Codec<ExchangeRevealItem> =>
- makeCodecForObject<ExchangeRevealItem>()
- .property("ev_sig", codecForString)
- .build("ExchangeRevealItem");
-
-export const codecForExchangeRevealResponse = (): Codec<
- ExchangeRevealResponse
-> =>
- makeCodecForObject<ExchangeRevealResponse>()
- .property("ev_sigs", makeCodecForList(codecForExchangeRevealItem()))
- .build("ExchangeRevealResponse");
-
-export const codecForMerchantCoinRefundSuccessStatus = (): Codec<
- MerchantCoinRefundSuccessStatus
-> =>
- makeCodecForObject<MerchantCoinRefundSuccessStatus>()
- .property("type", makeCodecForConstString("success"))
- .property("coin_pub", codecForString)
- .property("exchange_status", makeCodecForConstNumber(200))
- .property("exchange_sig", codecForString)
- .property("rtransaction_id", codecForNumber)
- .property("refund_amount", codecForString)
- .property("exchange_pub", codecForString)
- .property("execution_time", codecForTimestamp)
- .build("MerchantCoinRefundSuccessStatus");
-
-export const codecForMerchantCoinRefundFailureStatus = (): Codec<
- MerchantCoinRefundFailureStatus
-> =>
- makeCodecForObject<MerchantCoinRefundFailureStatus>()
- .property("type", makeCodecForConstString("failure"))
- .property("coin_pub", codecForString)
- .property("exchange_status", makeCodecForConstNumber(200))
- .property("rtransaction_id", codecForNumber)
- .property("refund_amount", codecForString)
- .property("exchange_code", makeCodecOptional(codecForNumber))
- .property("exchange_reply", makeCodecOptional(codecForAny))
- .property("execution_time", codecForTimestamp)
- .build("MerchantCoinRefundSuccessStatus");
-
-export const codecForMerchantCoinRefundStatus = (): Codec<
- MerchantCoinRefundStatus
-> =>
- makeCodecForUnion<MerchantCoinRefundStatus>()
- .discriminateOn("type")
- .alternative("success", codecForMerchantCoinRefundSuccessStatus())
- .alternative("failure", codecForMerchantCoinRefundFailureStatus())
- .build("MerchantCoinRefundStatus");
-
-export const codecForMerchantOrderStatusPaid = (): Codec<
- MerchantOrderStatusPaid
-> =>
- makeCodecForObject<MerchantOrderStatusPaid>()
- .property("merchant_pub", codecForString)
- .property("refund_amount", codecForString)
- .property("refunded", codecForBoolean)
- .property("refunds", makeCodecForList(codecForMerchantCoinRefundStatus()))
- .build("MerchantOrderStatusPaid");
-
-export const codecForMerchantOrderStatusUnpaid = (): Codec<
- MerchantOrderStatusUnpaid
-> =>
- makeCodecForObject<MerchantOrderStatusUnpaid>()
- .property("taler_pay_uri", codecForString)
- .property("already_paid_order_id", makeCodecOptional(codecForString))
- .build("MerchantOrderStatusUnpaid");
diff --git a/src/types/transactions.ts b/src/types/transactions.ts
deleted file mode 100644
index a6ea37e7a..000000000
--- a/src/types/transactions.ts
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Type and schema definitions for the wallet's transaction list.
- *
- * @author Florian Dold
- * @author Torsten Grote
- */
-
-/**
- * Imports.
- */
-import { Timestamp } from "../util/time";
-import { AmountString, Product } from "./talerTypes";
-import { Codec, makeCodecForObject, makeCodecOptional, codecForString } from "../util/codec";
-
-export interface TransactionsRequest {
- /**
- * return only transactions in the given currency
- */
- currency?: string;
-
- /**
- * if present, results will be limited to transactions related to the given search string
- */
- search?: string;
-}
-
-export interface TransactionsResponse {
- // a list of past and pending transactions sorted by pending, timestamp and transactionId.
- // In case two events are both pending and have the same timestamp,
- // they are sorted by the transactionId
- // (lexically ascending and locale-independent comparison).
- transactions: Transaction[];
-}
-
-interface TransactionError {
- /**
- * TALER_EC_* unique error code.
- * The action(s) offered and message displayed on the transaction item depend on this code.
- */
- ec: number;
-
- /**
- * English-only error hint, if available.
- */
- hint?: string;
-
- /**
- * Error details specific to "ec", if applicable/available
- */
- details?: any;
-}
-
-export interface TransactionCommon {
- // opaque unique ID for the transaction, used as a starting point for paginating queries
- // and for invoking actions on the transaction (e.g. deleting/hiding it from the history)
- transactionId: string;
-
- // the type of the transaction; different types might provide additional information
- type: TransactionType;
-
- // main timestamp of the transaction
- timestamp: Timestamp;
-
- // true if the transaction is still pending, false otherwise
- // If a transaction is not longer pending, its timestamp will be updated,
- // but its transactionId will remain unchanged
- pending: boolean;
-
- // Raw amount of the transaction (exclusive of fees or other extra costs)
- amountRaw: AmountString;
-
- // Amount added or removed from the wallet's balance (including all fees and other costs)
- amountEffective: AmountString;
-
- error?: TransactionError;
-}
-
-export type Transaction =
- | TransactionWithdrawal
- | TransactionPayment
- | TransactionRefund
- | TransactionTip
- | TransactionRefresh;
-
-export const enum TransactionType {
- Withdrawal = "withdrawal",
- Payment = "payment",
- Refund = "refund",
- Refresh = "refresh",
- Tip = "tip",
-}
-
-export const enum WithdrawalType {
- TalerBankIntegrationApi = "taler-bank-integration-api",
- ManualTransfer = "manual-transfer",
-}
-
-export type WithdrawalDetails =
- | WithdrawalDetailsForManualTransfer
- | WithdrawalDetailsForTalerBankIntegrationApi;
-
-interface WithdrawalDetailsForManualTransfer {
- type: WithdrawalType.ManualTransfer;
-
- /**
- * Payto URIs that the exchange supports.
- *
- * Already contains the amount and message.
- */
- exchangePaytoUris: string[];
-}
-
-interface WithdrawalDetailsForTalerBankIntegrationApi {
- type: WithdrawalType.TalerBankIntegrationApi;
-
- /**
- * Set to true if the bank has confirmed the withdrawal, false if not.
- * An unconfirmed withdrawal usually requires user-input and should be highlighted in the UI.
- * See also bankConfirmationUrl below.
- */
- confirmed: boolean;
-
- /**
- * If the withdrawal is unconfirmed, this can include a URL for user
- * initiated confirmation.
- */
- bankConfirmationUrl?: string;
-}
-
-// This should only be used for actual withdrawals
-// and not for tips that have their own transactions type.
-interface TransactionWithdrawal extends TransactionCommon {
- type: TransactionType.Withdrawal;
-
- /**
- * Exchange of the withdrawal.
- */
- exchangeBaseUrl: string;
-
- /**
- * Amount that got subtracted from the reserve balance.
- */
- amountRaw: AmountString;
-
- /**
- * Amount that actually was (or will be) added to the wallet's balance.
- */
- amountEffective: AmountString;
-
- withdrawalDetails: WithdrawalDetails;
-}
-
-export const enum PaymentStatus {
- /**
- * Explicitly aborted after timeout / failure
- */
- Aborted = "aborted",
-
- /**
- * Payment failed, wallet will auto-retry.
- * User should be given the option to retry now / abort.
- */
- Failed = "failed",
-
- /**
- * Paid successfully
- */
- Paid = "paid",
-
- /**
- * User accepted, payment is processing.
- */
- Accepted = "accepted",
-}
-
-export interface TransactionPayment extends TransactionCommon {
- type: TransactionType.Payment;
-
- /**
- * Additional information about the payment.
- */
- info: PaymentShortInfo;
-
- /**
- * How far did the wallet get with processing the payment?
- */
- status: PaymentStatus;
-
- /**
- * Amount that must be paid for the contract
- */
- amountRaw: AmountString;
-
- /**
- * Amount that was paid, including deposit, wire and refresh fees.
- */
- amountEffective: AmountString;
-}
-
-interface PaymentShortInfo {
- /**
- * Order ID, uniquely identifies the order within a merchant instance
- */
- orderId: string;
-
- /**
- * More information about the merchant
- */
- merchant: any;
-
- /**
- * Summary of the order, given by the merchant
- */
- summary: string;
-
- /**
- * Map from IETF BCP 47 language tags to localized summaries
- */
- summary_i18n?: { [lang_tag: string]: string };
-
- /**
- * List of products that are part of the order
- */
- products: Product[] | undefined;
-
- /**
- * URL of the fulfillment, given by the merchant
- */
- fulfillmentUrl: string;
-}
-
-interface TransactionRefund extends TransactionCommon {
- type: TransactionType.Refund;
-
- // ID for the transaction that is refunded
- refundedTransactionId: string;
-
- // Additional information about the refunded payment
- info: PaymentShortInfo;
-
- // Part of the refund that couldn't be applied because the refund permissions were expired
- amountInvalid: AmountString;
-
- // Amount that has been refunded by the merchant
- amountRaw: AmountString;
-
- // Amount will be added to the wallet's balance after fees and refreshing
- amountEffective: AmountString;
-}
-
-interface TransactionTip extends TransactionCommon {
- type: TransactionType.Tip;
-
- // true if the user still needs to accept/decline this tip
- waiting: boolean;
-
- // true if the user has accepted this top, false otherwise
- accepted: boolean;
-
- // Exchange that the tip will be (or was) withdrawn from
- exchangeBaseUrl: string;
-
- // More information about the merchant that sent the tip
- merchant: any;
-
- // Raw amount of the tip, without extra fees that apply
- amountRaw: AmountString;
-
- // Amount will be (or was) added to the wallet's balance after fees and refreshing
- amountEffective: AmountString;
-}
-
-// A transaction shown for refreshes that are not associated to other transactions
-// such as a refresh necessary before coin expiration.
-// It should only be returned by the API if the effective amount is different from zero.
-interface TransactionRefresh extends TransactionCommon {
- type: TransactionType.Refresh;
-
- // Exchange that the coins are refreshed with
- exchangeBaseUrl: string;
-
- // Raw amount that is refreshed
- amountRaw: AmountString;
-
- // Amount that will be paid as fees for the refresh
- amountEffective: AmountString;
-}
-
-
-export const codecForTransactionsRequest = (): Codec<TransactionsRequest> =>
- makeCodecForObject<TransactionsRequest>()
- .property("currency", makeCodecOptional(codecForString))
- .property("search", makeCodecOptional(codecForString))
- .build("TransactionsRequest"); \ No newline at end of file
diff --git a/src/types/types-test.ts b/src/types/types-test.ts
deleted file mode 100644
index afdc01844..000000000
--- a/src/types/types-test.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- This file is part of TALER
- (C) 2017 Inria and GNUnet e.V.
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-import test from "ava";
-import { codecForContractTerms } from "./talerTypes";
-
-test("contract terms validation", (t) => {
- const c = {
- nonce: "123123123",
- h_wire: "123",
- amount: "EUR:1.5",
- auditors: [],
- exchanges: [{ master_pub: "foo", url: "foo" }],
- fulfillment_url: "foo",
- max_fee: "EUR:1.5",
- merchant_pub: "12345",
- merchant: { name: "Foo" },
- order_id: "test_order",
- pay_deadline: { t_ms: 42 },
- wire_transfer_deadline: { t_ms: 42 },
- merchant_base_url: "https://example.com/pay",
- products: [],
- refund_deadline: { t_ms: 42 },
- summary: "hello",
- timestamp: { t_ms: 42 },
- wire_method: "test",
- };
-
- codecForContractTerms().decode(c);
-
- const c1 = JSON.parse(JSON.stringify(c));
- c1.pay_deadline = "foo";
-
- try {
- codecForContractTerms().decode(c1);
- } catch (e) {
- t.pass();
- return;
- }
-
- t.fail();
-});
diff --git a/src/types/walletTypes.ts b/src/types/walletTypes.ts
deleted file mode 100644
index 767b4c703..000000000
--- a/src/types/walletTypes.ts
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2015-2020 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Types used by clients of the wallet.
- *
- * These types are defined in a separate file make tree shaking easier, since
- * some components use these types (via RPC) but do not depend on the wallet
- * code directly.
- *
- * @author Florian Dold <dold@taler.net>
- */
-
-/**
- * Imports.
- */
-import { AmountJson, codecForAmountJson } from "../util/amounts";
-import * as LibtoolVersion from "../util/libtoolVersion";
-import {
- ExchangeRecord,
- ExchangeWireInfo,
- DenominationSelectionInfo,
-} from "./dbTypes";
-import { Timestamp } from "../util/time";
-import {
- makeCodecForObject,
- codecForString,
- makeCodecOptional,
- Codec,
-} from "../util/codec";
-import { AmountString } from "./talerTypes";
-
-/**
- * Response for the create reserve request to the wallet.
- */
-export class CreateReserveResponse {
- /**
- * Exchange URL where the bank should create the reserve.
- * The URL is canonicalized in the response.
- */
- exchange: string;
-
- /**
- * Reserve public key of the newly created reserve.
- */
- reservePub: string;
-}
-
-/**
- * Information about what will happen when creating a reserve.
- *
- * Sent to the wallet frontend to be rendered and shown to the user.
- */
-export interface ExchangeWithdrawDetails {
- /**
- * Exchange that the reserve will be created at.
- */
- exchangeInfo: ExchangeRecord;
-
- /**
- * Filtered wire info to send to the bank.
- */
- exchangeWireAccounts: string[];
-
- /**
- * Selected denominations for withdraw.
- */
- selectedDenoms: DenominationSelectionInfo;
-
- /**
- * Fees for withdraw.
- */
- withdrawFee: AmountJson;
-
- /**
- * Remaining balance that is too small to be withdrawn.
- */
- overhead: AmountJson;
-
- /**
- * Wire fees from the exchange.
- */
- wireFees: ExchangeWireInfo;
-
- /**
- * 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: Timestamp;
-
- /**
- * 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: LibtoolVersion.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;
-}
-
-
-export interface Balance {
- available: AmountString;
- pendingIncoming: AmountString;
- pendingOutgoing: AmountString;
-
- // Does the balance for this currency have a pending
- // transaction?
- hasPendingTransactions: boolean;
-
- // Is there a pending transaction that would affect the balance
- // and requires user input?
- requiresUserInput: boolean;
-}
-
-export interface BalancesResponse {
- balances: Balance[];
-}
-
-
-/**
- * For terseness.
- */
-export function mkAmount(
- value: number,
- fraction: number,
- currency: string,
-): AmountJson {
- return { value, fraction, currency };
-}
-
-/**
- * Result for confirmPay
- */
-export interface ConfirmPayResult {
- nextUrl: string;
-}
-
-/**
- * Information about all sender wire details known to the wallet,
- * as well as exchanges that accept these wire types.
- */
-export interface SenderWireInfos {
- /**
- * Mapping from exchange base url to list of accepted
- * wire types.
- */
- exchangeWireTypes: { [exchangeBaseUrl: string]: string[] };
-
- /**
- * Sender wire information stored in the wallet.
- */
- senderWires: string[];
-}
-
-/**
- * Request to create a reserve.
- */
-export interface CreateReserveRequest {
- /**
- * The initial amount for the reserve.
- */
- amount: AmountJson;
-
- /**
- * Exchange URL where the bank should create the reserve.
- */
- exchange: string;
-
- /**
- * Payto URI that identifies the exchange's account that the funds
- * for this reserve go into.
- */
- exchangePaytoUri?: string;
-
- /**
- * Wire details (as a payto URI) for the bank account that sent the funds to
- * the exchange.
- */
- senderWire?: string;
-
- /**
- * URL to fetch the withdraw status from the bank.
- */
- bankWithdrawStatusUrl?: string;
-}
-
-export const codecForCreateReserveRequest = (): Codec<CreateReserveRequest> =>
- makeCodecForObject<CreateReserveRequest>()
- .property("amount", codecForAmountJson())
- .property("exchange", codecForString)
- .property("exchangePaytoUri", codecForString)
- .property("senderWire", makeCodecOptional(codecForString))
- .property("bankWithdrawStatusUrl", makeCodecOptional(codecForString))
- .build("CreateReserveRequest");
-
-/**
- * Request to mark a reserve as confirmed.
- */
-export interface ConfirmReserveRequest {
- /**
- * Public key of then reserve that should be marked
- * as confirmed.
- */
- reservePub: string;
-}
-
-export const codecForConfirmReserveRequest = (): Codec<ConfirmReserveRequest> =>
- makeCodecForObject<ConfirmReserveRequest>()
- .property("reservePub", codecForString)
- .build("ConfirmReserveRequest");
-
-/**
- * Wire coins to the user's own bank account.
- */
-export class ReturnCoinsRequest {
- /**
- * The amount to wire.
- */
- amount: AmountJson;
-
- /**
- * The exchange to take the coins from.
- */
- exchange: string;
-
- /**
- * Wire details for the bank account of the customer that will
- * receive the funds.
- */
- senderWire?: string;
-
- /**
- * Verify that a value matches the schema of this class and convert it into a
- * member.
- */
- static checked: (obj: any) => ReturnCoinsRequest;
-}
-
-/**
- * Status of processing a tip.
- */
-export interface TipStatus {
- accepted: boolean;
- amount: AmountJson;
- amountLeft: AmountJson;
- nextUrl: string;
- exchangeUrl: string;
- tipId: string;
- merchantTipId: string;
- merchantOrigin: string;
- expirationTimestamp: Timestamp;
- timestamp: Timestamp;
- totalFees: AmountJson;
-}
-
-export interface BenchmarkResult {
- time: { [s: string]: number };
- repetitions: number;
-}
-
-/**
- * Cached next URL for a particular session id.
- */
-export interface NextUrlResult {
- nextUrl: string;
- lastSessionId: string | undefined;
-}
-
-export const enum PreparePayResultType {
- PaymentPossible = "payment-possible",
- InsufficientBalance = "insufficient-balance",
- AlreadyConfirmed = "already-confirmed",
-}
-
-export type PreparePayResult =
- | PreparePayResultInsufficientBalance
- | PreparePayResultAlreadyConfirmed
- | PreparePayResultPaymentPossible;
-
-export interface PreparePayResultPaymentPossible {
- status: PreparePayResultType.PaymentPossible;
- proposalId: string;
- contractTerms: Record<string, unknown>;
- amountRaw: string;
- amountEffective: string;
-}
-
-export interface PreparePayResultInsufficientBalance {
- status: PreparePayResultType.InsufficientBalance;
- proposalId: string;
- contractTerms: Record<string, unknown>;
-}
-
-export interface PreparePayResultAlreadyConfirmed {
- status: PreparePayResultType.AlreadyConfirmed;
- contractTerms: Record<string, unknown>;
- paid: boolean;
- // Only specified if paid.
- nextUrl?: string;
-}
-
-export interface BankWithdrawDetails {
- selectionDone: boolean;
- transferDone: boolean;
- amount: AmountJson;
- senderWire?: string;
- suggestedExchange?: string;
- confirmTransferUrl?: string;
- wireTypes: string[];
- extractedStatusUrl: string;
-}
-
-export interface AcceptWithdrawalResponse {
- reservePub: string;
- confirmTransferUrl?: string;
-}
-
-/**
- * Details about a purchase, including refund status.
- */
-export interface PurchaseDetails {
- contractTerms: Record<string, undefined>;
- hasRefund: boolean;
- totalRefundAmount: AmountJson;
- totalRefundAndRefreshFees: AmountJson;
-}
-
-export interface WalletDiagnostics {
- walletManifestVersion: string;
- walletManifestDisplayVersion: string;
- errors: string[];
- firefoxIdbProblem: boolean;
- dbOutdated: boolean;
-}
-
-export interface OperationErrorDetails {
- talerErrorCode: number;
- talerErrorHint: string;
- message: string;
- details: unknown;
-}
-
-export interface PlanchetCreationResult {
- coinPub: string;
- coinPriv: string;
- reservePub: string;
- denomPubHash: string;
- denomPub: string;
- blindingKey: string;
- withdrawSig: string;
- coinEv: string;
- coinValue: AmountJson;
- coinEvHash: string;
-}
-
-export interface PlanchetCreationRequest {
- value: AmountJson;
- feeWithdraw: AmountJson;
- denomPub: string;
- reservePub: string;
- reservePriv: string;
-}
-
-/**
- * Reasons for why a coin is being refreshed.
- */
-export const enum RefreshReason {
- Manual = "manual",
- Pay = "pay",
- Refund = "refund",
- AbortPay = "abort-pay",
- Recoup = "recoup",
- BackupRestored = "backup-restored",
-}
-
-/**
- * Wrapper for coin public keys.
- */
-export interface CoinPublicKey {
- readonly coinPub: string;
-}
-
-/**
- * Wrapper for refresh group IDs.
- */
-export interface RefreshGroupId {
- readonly refreshGroupId: string;
-}
-
-/**
- * Private data required to make a deposit permission.
- */
-export interface DepositInfo {
- exchangeBaseUrl: string;
- contractTermsHash: string;
- coinPub: string;
- coinPriv: string;
- spendAmount: AmountJson;
- timestamp: Timestamp;
- refundDeadline: Timestamp;
- merchantPub: string;
- feeDeposit: AmountJson;
- wireInfoHash: string;
- denomPubHash: string;
- denomSig: string;
-}
-
-export interface ExtendedPermissionsResponse {
- newValue: boolean;
-}
-
-export interface ExchangesListRespose {
- exchanges: ExchangeListItem[];
-}
-
-export interface ExchangeListItem {
- exchangeBaseUrl: string;
- currency: string;
- paytoUris: string[];
-}
-
-export interface AcceptManualWithdrawalResult {
- /**
- * Payto URIs that can be used to fund the withdrawal.
- */
- exchangePaytoUris: string[];
-
- /**
- * Public key of the newly created reserve.
- */
- reservePub: string;
-}
-
-export interface ManualWithdrawalDetails {
- /**
- * Did the user accept the current version of the exchange's
- * terms of service?
- */
- tosAccepted: boolean;
-
- /**
- * Amount that the user will transfer to the exchange.
- */
- amountRaw: AmountString;
-
- /**
- * Amount that will be added to the user's wallet balance.
- */
- amountEffective: AmountString;
-
- /**
- * Ways to pay the exchange.
- */
- paytoUris: string[];
-}
-
-export interface GetExchangeTosResult {
- /**
- * Markdown version of the current ToS.
- */
- tos: string;
-
- /**
- * Version tag of the current ToS.
- */
- currentEtag: string;
-
- /**
- * Version tag of the last ToS that the user has accepted,
- * if any.
- */
- acceptedEtag: string | undefined;
-}