diff options
author | Florian Dold <florian@dold.me> | 2022-10-20 15:31:24 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-10-20 15:31:24 +0200 |
commit | c17cccd386d3784ea0862124d1962ec9efe605fa (patch) | |
tree | e3a08685ab993dad41947ed0497617ccff1cf30b | |
parent | 447708b1262fbbbdcd9257751bbf86372a5ae7d9 (diff) | |
download | docs-c17cccd386d3784ea0862124d1962ec9efe605fa.tar.gz docs-c17cccd386d3784ea0862124d1962ec9efe605fa.tar.bz2 docs-c17cccd386d3784ea0862124d1962ec9efe605fa.zip |
update wallet-core API docs
-rw-r--r-- | wallet/wallet-core.md | 1390 |
1 files changed, 973 insertions, 417 deletions
diff --git a/wallet/wallet-core.md b/wallet/wallet-core.md index 09619dc0..98f22c17 100644 --- a/wallet/wallet-core.md +++ b/wallet/wallet-core.md @@ -3,10 +3,13 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core ## Overview ### Initialization * [InitWalletOp](#initwalletop) +* [GetVersionOp](#getversionop) ### Basic Wallet Information * [GetBalancesOp](#getbalancesop) ### Managing Transactions * [GetTransactionsOp](#gettransactionsop) +* [GetTransactionByIdOp](#gettransactionbyidop) +* [RetryPendingNowOp](#retrypendingnowop) * [DeleteTransactionOp](#deletetransactionop) * [RetryTransactionOp](#retrytransactionop) ### Withdrawals @@ -16,26 +19,37 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core * [AcceptManualWithdrawalOp](#acceptmanualwithdrawalop) ### Merchant Payments * [PreparePayForUriOp](#preparepayforuriop) +* [GetContractTermsDetailsOp](#getcontracttermsdetailsop) * [ConfirmPayOp](#confirmpayop) * [AbortPayWithRefundOp](#abortpaywithrefundop) * [ApplyRefundOp](#applyrefundop) +* [ApplyRefundFromPurchaseIdOp](#applyrefundfrompurchaseidop) +* [PrepareRefundOp](#preparerefundop) ### Tipping * [PrepareTipOp](#preparetipop) * [AcceptTipOp](#accepttipop) ### Exchange Management * [ListExchangesOp](#listexchangesop) * [AddExchangeOp](#addexchangeop) +* [ListKnownBankAccountsOp](#listknownbankaccountsop) +* [AddKnownBankAccountsOp](#addknownbankaccountsop) +* [ForgetKnownBankAccountsOp](#forgetknownbankaccountsop) * [SetExchangeTosAcceptedOp](#setexchangetosacceptedop) * [GetExchangeTosOp](#getexchangetosop) +* [GetExchangeDetailedInfoOp](#getexchangedetailedinfoop) * [ListCurrenciesOp](#listcurrenciesop) ### Deposits * [CreateDepositGroupOp](#createdepositgroupop) * [TrackDepositGroupOp](#trackdepositgroupop) +* [GetFeeForDepositOp](#getfeefordepositop) +* [PrepareDepositOp](#preparedepositop) ### Backups * [ExportBackupRecoveryOp](#exportbackuprecoveryop) * [ImportBackupRecoveryOp](#importbackuprecoveryop) * [RunBackupCycleOp](#runbackupcycleop) +* [ExportBackupOp](#exportbackupop) * [AddBackupProviderOp](#addbackupproviderop) +* [RemoveBackupProviderOp](#removebackupproviderop) * [GetBackupInfoOp](#getbackupinfoop) * [SetWalletDeviceIdOp](#setwalletdeviceidop) * [ExportBackupPlainOp](#exportbackupplainop) @@ -48,10 +62,14 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core * [AcceptPeerPullPaymentOp](#acceptpeerpullpaymentop) ### Database Management * [ExportDbOp](#exportdbop) +* [ImportDbOp](#importdbop) * [ClearDbOp](#cleardbop) * [RecycleOp](#recycleop) ### Testing and Debugging +* [ApplyDevExperimentOp](#applydevexperimentop) +* [SetDevModeOp](#setdevmodeop) * [RunIntegrationTestOp](#runintegrationtestop) +* [TestCryptoOp](#testcryptoop) * [WithdrawTestBalanceOp](#withdrawtestbalanceop) * [WithdrawTestkudosOp](#withdrawtestkudosop) * [TestPayOp](#testpayop) @@ -71,11 +89,28 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core export type InitWalletOp = { op: WalletApiOperation.InitWallet; request: {}; - response: {}; + response: InitResponse; }; // InitWallet = "initWallet" ``` +```typescript +export interface InitResponse { + versionInfo: WalletCoreVersion; +} + +``` + +### GetVersionOp +```typescript +export type GetVersionOp = { + op: WalletApiOperation.GetVersion; + request: {}; + response: WalletCoreVersion; +}; +// GetVersion = "getVersion" + +``` ### GetBalancesOp ```typescript @@ -139,340 +174,32 @@ export interface TransactionsResponse { } ``` -```typescript -export declare type Transaction = - | TransactionWithdrawal - | TransactionPayment - | TransactionRefund - | TransactionTip - | TransactionRefresh - | TransactionDeposit - | TransactionPeerPullCredit - | TransactionPeerPullDebit - | TransactionPeerPushCredit - | TransactionPeerPushDebit; - -``` -```typescript -export 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; -} - -``` -```typescript -export interface TransactionCommon { - transactionId: string; - type: TransactionType; - timestamp: TalerProtocolTimestamp; - pending: boolean; - /** - * True if the transaction encountered a problem that might be - * permanent. A frozen transaction won't be automatically retried. - */ - frozen: 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?: TalerErrorDetail; -} - -``` -```typescript -export declare enum TransactionType { - Withdrawal = "withdrawal", - Payment = "payment", - Refund = "refund", - Refresh = "refresh", - Tip = "tip", - Deposit = "deposit", - PeerPushDebit = "peer-push-debit", - PeerPushCredit = "peer-push-credit", - PeerPullDebit = "peer-pull-debit", - PeerPullCredit = "peer-pull-credit", -} - -``` -```typescript -export declare type WithdrawalDetails = - | WithdrawalDetailsForManualTransfer - | WithdrawalDetailsForTalerBankIntegrationApi; - -``` -```typescript -interface WithdrawalDetailsForManualTransfer { - type: WithdrawalType.ManualTransfer; - /** - * Payto URIs that the exchange supports. - * - * Already contains the amount and message. - */ - exchangePaytoUris: string[]; - reservePub: string; -} - -``` -```typescript -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; - reservePub: string; -} - -``` -```typescript -export interface TransactionPayment extends TransactionCommon { - type: TransactionType.Payment; - /** - * Additional information about the payment. - */ - info: OrderShortInfo; - /** - * Wallet-internal end-to-end identifier for the payment. - */ - proposalId: string; - /** - * 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; - /** - * Amount that has been refunded by the merchant - */ - totalRefundRaw: AmountString; - /** - * Amount will be added to the wallet's balance after fees and refreshing - */ - totalRefundEffective: AmountString; - /** - * Amount pending to be picked up - */ - refundPending: AmountString | undefined; - /** - * Reference to applied refunds - */ - refunds: RefundInfoShort[]; -} -``` +### GetTransactionByIdOp ```typescript -export declare 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 type GetTransactionByIdOp = { + op: WalletApiOperation.GetTransactionById; + request: TransactionByIdRequest; + response: Transaction; +}; +// GetTransactionById = "getTransactionById" ``` ```typescript -export interface RefundInfoShort { +export interface TransactionByIdRequest { transactionId: string; - timestamp: TalerProtocolTimestamp; - amountEffective: AmountString; - amountRaw: AmountString; -} - -``` -```typescript -export interface TransactionRefund extends TransactionCommon { - type: TransactionType.Refund; - refundedTransactionId: string; - info: OrderShortInfo; - /** - * Amount pending to be picked up - */ - refundPending: AmountString | undefined; - amountRaw: AmountString; - amountEffective: AmountString; -} - -``` -```typescript -export interface TransactionTip extends TransactionCommon { - type: TransactionType.Tip; - amountRaw: AmountString; - /** - * More information about the merchant - */ - amountEffective: AmountString; - merchantBaseUrl: string; -} - -``` -```typescript -export interface TransactionRefresh extends TransactionCommon { - type: TransactionType.Refresh; - exchangeBaseUrl: string; - amountRaw: AmountString; - amountEffective: AmountString; -} - -``` -```typescript -/** - * Deposit transaction, which effectively sends - * money from this wallet somewhere else. - */ -export interface TransactionDeposit extends TransactionCommon { - type: TransactionType.Deposit; - depositGroupId: string; - /** - * Target for the deposit. - */ - targetPaytoUri: string; - /** - * Raw amount that is being deposited - */ - amountRaw: AmountString; - /** - * Effective amount that is being deposited - */ - amountEffective: AmountString; -} - -``` -```typescript -/** - * Credit because we were paid for a P2P invoice we created. - */ -export interface TransactionPeerPullCredit extends TransactionCommon { - type: TransactionType.PeerPullCredit; - info: PeerInfoShort; - /** - * Exchange used. - */ - 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; - /** - * URI to send to the other party. - */ - talerUri: string; } ``` -```typescript -export interface PeerInfoShort { - expiration: TalerProtocolTimestamp | undefined; - summary: string | undefined; -} - -``` -```typescript -/** - * Debit because we paid someone's invoice. - */ -export interface TransactionPeerPullDebit extends TransactionCommon { - type: TransactionType.PeerPullDebit; - info: PeerInfoShort; - /** - * Exchange used. - */ - exchangeBaseUrl: string; - amountRaw: AmountString; - amountEffective: AmountString; -} - -``` -```typescript -/** - * We received money via a P2P payment. - */ -export interface TransactionPeerPushCredit extends TransactionCommon { - type: TransactionType.PeerPushCredit; - info: PeerInfoShort; - /** - * Exchange used. - */ - 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; -} -``` +### RetryPendingNowOp ```typescript -/** - * We sent money via a P2P payment. - */ -export interface TransactionPeerPushDebit extends TransactionCommon { - type: TransactionType.PeerPushDebit; - info: PeerInfoShort; - /** - * Exchange used. - */ - 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; - /** - * URI to accept the payment. - */ - talerUri: string; -} +export type RetryPendingNowOp = { + op: WalletApiOperation.RetryPendingNow; + request: {}; + response: {}; +}; +// RetryPendingNow = "retryPendingNow" ``` @@ -556,6 +283,11 @@ export interface ManualWithdrawalDetails { * Ways to pay the exchange. */ paytoUris: string[]; + /** + * If the exchange supports age-restricted coins it will return + * the array of ages. + */ + ageRestrictionOptions?: number[]; } ``` @@ -723,6 +455,82 @@ export interface PreparePayResultPaymentPossible { ``` +### GetContractTermsDetailsOp +```typescript +export type GetContractTermsDetailsOp = { + op: WalletApiOperation.GetContractTermsDetails; + request: GetContractTermsDetailsRequest; + response: WalletContractData; +}; +// GetContractTermsDetails = "getContractTermsDetails" + +``` +```typescript +export interface GetContractTermsDetailsRequest { + proposalId: string; +} + +``` +```typescript +/** + * 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; + /** + * Fulfillment URL, or the empty string if the order has no fulfillment URL. + * + * Stored as a non-nullable string as we use this field for IndexedDB indexing. + */ + fulfillmentUrl: string; + contractTermsHash: string; + fulfillmentMessage?: string; + fulfillmentMessageI18n?: InternationalizedString; + merchantSig: string; + merchantPub: string; + merchant: MerchantInfo; + amount: AmountJson; + orderId: string; + merchantBaseUrl: string; + summary: string; + autoRefund: TalerProtocolDuration | undefined; + maxWireFee: AmountJson; + wireFeeAmortization: number; + payDeadline: TalerProtocolTimestamp; + refundDeadline: TalerProtocolTimestamp; + allowedAuditors: AllowedAuditorInfo[]; + allowedExchanges: AllowedExchangeInfo[]; + timestamp: TalerProtocolTimestamp; + wireMethod: string; + wireInfoHash: string; + maxDepositFee: AmountJson; + minimumAge?: number; + deliveryDate: TalerProtocolTimestamp | undefined; + deliveryLocation: Location | undefined; +} + +``` +```typescript +export interface AllowedAuditorInfo { + auditorBaseUrl: string; + auditorPub: string; +} + +``` +```typescript +export interface AllowedExchangeInfo { + exchangeBaseUrl: string; + exchangePub: string; +} + +``` + ### ConfirmPayOp ```typescript /** @@ -810,15 +618,48 @@ export interface ApplyRefundRequest { } ``` + +### ApplyRefundFromPurchaseIdOp ```typescript -export interface ApplyRefundResponse { - contractTermsHash: string; - transactionId: string; +export type ApplyRefundFromPurchaseIdOp = { + op: WalletApiOperation.ApplyRefundFromPurchaseId; + request: ApplyRefundFromPurchaseIdRequest; + response: ApplyRefundResponse; +}; +// ApplyRefundFromPurchaseId = "applyRefundFromPurchaseId" + +``` +```typescript +export interface ApplyRefundFromPurchaseIdRequest { + purchaseId: string; +} + +``` + +### PrepareRefundOp +```typescript +export type PrepareRefundOp = { + op: WalletApiOperation.PrepareRefund; + request: PrepareRefundRequest; + response: PrepareRefundResult; +}; +// PrepareRefund = "prepareRefund" + +``` +```typescript +export interface PrepareRefundRequest { + talerRefundUri: string; +} + +``` +```typescript +export interface PrepareRefundResult { proposalId: string; - amountEffectivePaid: AmountString; - amountRefundGranted: AmountString; - amountRefundGone: AmountString; - pendingAtExchange: boolean; + effectivePaid: AmountString; + gone: AmountString; + granted: AmountString; + pending: boolean; + awaiting: AmountString; info: OrderShortInfo; } @@ -934,10 +775,120 @@ export type AddExchangeOp = { // AddExchange = "addExchange" ``` + +### ListKnownBankAccountsOp ```typescript -export interface AddExchangeRequest { - exchangeBaseUrl: string; - forceUpdate?: boolean; +export type ListKnownBankAccountsOp = { + op: WalletApiOperation.ListKnownBankAccounts; + request: ListKnownBankAccountsRequest; + response: KnownBankAccounts; +}; +// ListKnownBankAccounts = "listKnownBankAccounts" + +``` +```typescript +export interface ListKnownBankAccountsRequest { + currency?: string; +} + +``` +```typescript +export interface KnownBankAccounts { + accounts: KnownBankAccountsInfo[]; +} + +``` +```typescript +export interface KnownBankAccountsInfo { + uri: PaytoUri; + kyc_completed: boolean; + currency: string; + alias: string; +} + +``` +```typescript +export declare type PaytoUri = + | PaytoUriUnknown + | PaytoUriIBAN + | PaytoUriTalerBank + | PaytoUriBitcoin; + +``` +```typescript +export interface PaytoUriUnknown extends PaytoUriGeneric { + isKnown: false; +} + +``` +```typescript +export interface PaytoUriGeneric { + targetType: string; + targetPath: string; + params: { + [name: string]: string; + }; +} + +``` +```typescript +export interface PaytoUriIBAN extends PaytoUriGeneric { + isKnown: true; + targetType: "iban"; + iban: string; +} + +``` +```typescript +export interface PaytoUriTalerBank extends PaytoUriGeneric { + isKnown: true; + targetType: "x-taler-bank"; + host: string; + account: string; +} + +``` +```typescript +export interface PaytoUriBitcoin extends PaytoUriGeneric { + isKnown: true; + targetType: "bitcoin"; + segwitAddrs: Array<string>; +} + +``` + +### AddKnownBankAccountsOp +```typescript +export type AddKnownBankAccountsOp = { + op: WalletApiOperation.AddKnownBankAccounts; + request: AddKnownBankAccountsRequest; + response: {}; +}; +// AddKnownBankAccounts = "addKnownBankAccounts" + +``` +```typescript +export interface AddKnownBankAccountsRequest { + payto: string; + alias: string; + currency: string; +} + +``` + +### ForgetKnownBankAccountsOp +```typescript +export type ForgetKnownBankAccountsOp = { + op: WalletApiOperation.ForgetKnownBankAccounts; + request: ForgetKnownBankAccountsRequest; + response: {}; +}; +// ForgetKnownBankAccounts = "forgetKnownBankAccounts" + +``` +```typescript +export interface ForgetKnownBankAccountsRequest { + payto: string; } ``` @@ -1002,6 +953,76 @@ export interface GetExchangeTosResult { * Accepted content type */ contentType: string; + tosStatus: ExchangeTosStatus; +} + +``` + +### GetExchangeDetailedInfoOp +```typescript +/** + * Get the current terms of a service of an exchange. + */ +export type GetExchangeDetailedInfoOp = { + op: WalletApiOperation.GetExchangeDetailedInfo; + request: AddExchangeRequest; + response: ExchangeDetailedResponse; +}; +// GetExchangeDetailedInfo = "getExchangeDetailedInfo" + +``` +```typescript +export interface ExchangeDetailedResponse { + exchange: ExchangeFullDetails; +} + +``` +```typescript +export interface ExchangeFullDetails { + exchangeBaseUrl: string; + currency: string; + paytoUris: string[]; + tos: ExchangeTosStatusDetails; + auditors: ExchangeAuditor[]; + wireInfo: WireInfo; + denomFees: DenomOperationMap<FeeDescription[]>; + transferFees: Record<string, FeeDescription[]>; + globalFees: FeeDescription[]; +} + +``` +```typescript +export interface ExchangeTosStatusDetails { + acceptedVersion?: string; + currentVersion?: string; + contentType?: string; + content?: string; +} + +``` +```typescript +export interface WireInfo { + feesForType: WireFeeMap; + accounts: ExchangeAccount[]; +} + +``` +```typescript +/** + * Information about one of the exchange's bank accounts. + */ +export interface ExchangeAccount { + payto_uri: string; + master_sig: string; +} + +``` +```typescript +export interface FeeDescription { + group: string; + from: AbsoluteTime; + until: AbsoluteTime; + fee?: AmountJson; } ``` @@ -1095,6 +1116,57 @@ export interface TrackDepositGroupResponse { ``` +### GetFeeForDepositOp +```typescript +export type GetFeeForDepositOp = { + op: WalletApiOperation.GetFeeForDeposit; + request: GetFeeForDepositRequest; + response: DepositGroupFees; +}; +// GetFeeForDeposit = "getFeeForDeposit" + +``` +```typescript +export interface GetFeeForDepositRequest { + depositPaytoUri: string; + amount: AmountString; +} + +``` +```typescript +export interface DepositGroupFees { + coin: AmountJson; + wire: AmountJson; + refresh: AmountJson; +} + +``` + +### PrepareDepositOp +```typescript +export type PrepareDepositOp = { + op: WalletApiOperation.PrepareDeposit; + request: PrepareDepositRequest; + response: PrepareDepositResponse; +}; +// PrepareDeposit = "prepareDeposit" + +``` +```typescript +export interface PrepareDepositRequest { + depositPaytoUri: string; + amount: AmountString; +} + +``` +```typescript +export interface PrepareDepositResponse { + totalDepositCost: AmountJson; + effectiveDepositAmount: AmountJson; +} + +``` + ### ExportBackupRecoveryOp ```typescript /** @@ -1163,6 +1235,17 @@ export type RunBackupCycleOp = { ``` +### ExportBackupOp +```typescript +export type ExportBackupOp = { + op: WalletApiOperation.ExportBackup; + request: {}; + response: {}; +}; +// ExportBackup = "exportBackup" + +``` + ### AddBackupProviderOp ```typescript /** @@ -1189,6 +1272,23 @@ export interface AddBackupProviderRequest { ``` +### RemoveBackupProviderOp +```typescript +export type RemoveBackupProviderOp = { + op: WalletApiOperation.RemoveBackupProvider; + request: RemoveBackupProviderRequest; + response: {}; +}; +// RemoveBackupProvider = "removeBackupProvider" + +``` +```typescript +export interface RemoveBackupProviderRequest { + provider: string; +} + +``` + ### GetBackupInfoOp ```typescript /** @@ -1519,7 +1619,7 @@ export interface AcceptPeerPullPaymentRequest { ### ExportDbOp ```typescript /** - * Exoport the wallet database's contents to JSON. + * Export the wallet database's contents to JSON. */ export type ExportDbOp = { op: WalletApiOperation.ExportDb; @@ -1530,6 +1630,17 @@ export type ExportDbOp = { ``` +### ImportDbOp +```typescript +export type ImportDbOp = { + op: WalletApiOperation.ImportDb; + request: any; + response: any; +}; +// ImportDb = "importDb" + +``` + ### ClearDbOp ```typescript /** @@ -1558,6 +1669,46 @@ export type RecycleOp = { ``` +### ApplyDevExperimentOp +```typescript +/** + * Apply a developer experiment to the current wallet state. + * + * This allows UI developers / testers to play around without + * an elaborate test environment. + */ +export type ApplyDevExperimentOp = { + op: WalletApiOperation.ApplyDevExperiment; + request: ApplyDevExperimentRequest; + response: {}; +}; +// ApplyDevExperiment = "applyDevExperiment" + +``` +```typescript +export interface ApplyDevExperimentRequest { + devExperimentUri: string; +} + +``` + +### SetDevModeOp +```typescript +export type SetDevModeOp = { + op: WalletApiOperation.SetDevMode; + request: SetDevModeRequest; + response: {}; +}; +// SetDevMode = "setDevMode" + +``` +```typescript +export interface SetDevModeRequest { + devModeEnabled: boolean; +} + +``` + ### RunIntegrationTestOp ```typescript /** @@ -1585,6 +1736,20 @@ export interface IntegrationTestArgs { ``` +### TestCryptoOp +```typescript +/** + * Test crypto worker. + */ +export type TestCryptoOp = { + op: WalletApiOperation.TestCrypto; + request: {}; + response: any; +}; +// TestCrypto = "testCrypto" + +``` + ### WithdrawTestBalanceOp ```typescript /** @@ -1686,27 +1851,6 @@ export interface PayCoinSelection { } ``` -```typescript -/** - * Non-negative financial amount. Fractional values are expressed as multiples - * of 1e-8. - */ -export interface AmountJson { - /** - * Value, must be an integer. - */ - readonly value: number; - /** - * Fraction, must be an integer. Represent 1/1e8 of a unit. - */ - readonly fraction: number; - /** - * Currency of the amount. - */ - readonly currency: string; -} - -``` ### WithdrawFakebankOp ```typescript @@ -1765,10 +1909,8 @@ export type PendingTaskInfo = PendingTaskInfoCommon & ( | PendingExchangeUpdateTask | PendingExchangeCheckRefreshTask - | PendingPayTask - | PendingProposalDownloadTask + | PendingPurchaseTask | PendingRefreshTask - | PendingRefundQueryTask | PendingTipPickupTask | PendingWithdrawTask | PendingRecoupTask @@ -1796,6 +1938,14 @@ export interface PendingTaskInfoCommon { */ givesLifeness: boolean; /** + * Operation is active and waiting for a longpoll result. + */ + isLongpolling: boolean; + /** + * Operation is waiting to be executed. + */ + isDue: boolean; + /** * Timestamp when the pending operation should be executed next. */ timestampDue: AbsoluteTime; @@ -1811,11 +1961,9 @@ export interface PendingTaskInfoCommon { export enum PendingTaskType { ExchangeUpdate = "exchange-update", ExchangeCheckRefresh = "exchange-check-refresh", - Pay = "pay", - ProposalDownload = "proposal-download", + Purchase = "purchase", Refresh = "refresh", Recoup = "recoup", - RefundQuery = "refund-query", TipPickup = "tip-pickup", Withdraw = "withdraw", Deposit = "deposit", @@ -1944,35 +2092,22 @@ export interface PendingExchangeCheckRefreshTask { ``` ```typescript /** - * The wallet is signing coins and then sending them to - * the merchant. + * A purchase needs to be processed (i.e. for download / payment / refund). */ -export interface PendingPayTask { - type: PendingTaskType.Pay; +export interface PendingPurchaseTask { + type: PendingTaskType.Purchase; proposalId: string; - isReplay: boolean; retryInfo?: RetryInfo; + /** + * Status of the payment as string, used only for debugging. + */ + statusStr: string; lastError: TalerErrorDetail | undefined; } ``` ```typescript /** - * Status of downloading signed contract terms from a merchant. - */ -export interface PendingProposalDownloadTask { - type: PendingTaskType.ProposalDownload; - merchantBaseUrl: string; - proposalTimestamp: TalerProtocolTimestamp; - proposalId: string; - orderId: string; - lastError?: TalerErrorDetail; - retryInfo?: RetryInfo; -} - -``` -```typescript -/** * Status of an ongoing withdrawal operation. */ export interface PendingRefreshTask { @@ -1986,19 +2121,6 @@ export interface PendingRefreshTask { ``` ```typescript /** - * The wallet is querying the merchant about whether any refund - * permissions are available for a purchase. - */ -export interface PendingRefundQueryTask { - type: PendingTaskType.RefundQuery; - proposalId: string; - retryInfo?: RetryInfo; - lastError: TalerErrorDetail | undefined; -} - -``` -```typescript -/** * The wallet is picking up a tip that the user has accepted. */ export interface PendingTipPickupTask { @@ -2092,11 +2214,6 @@ export interface CoinDumpJson { */ 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. */ @@ -2106,11 +2223,13 @@ export interface CoinDumpJson { * 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; + coin_status: CoinStatus; + spend_allocation: + | { + id: string; + amount: string; + } + | undefined; /** * Information about the age restriction */ @@ -2142,6 +2261,27 @@ export interface CsDenominationPubKey { ``` ```typescript +/** + * Status of a coin. + */ +export declare enum CoinStatus { + /** + * Withdrawn and never shown to anybody. + */ + Fresh = "fresh", + /** + * Fresh, but currently marked as "suspended", thus won't be used + * for spending. Used for testing. + */ + FreshSuspended = "fresh-suspended", + /** + * A coin that has been spent and refreshed. + */ + Dormant = "dormant", +} + +``` +```typescript export interface AgeCommitmentProof { commitment: AgeCommitment; proof: AgeProof; @@ -2237,6 +2377,83 @@ export interface ForceRefreshRequest { ## Common Declarations ```typescript +export interface WalletCoreVersion { + hash: string | undefined; + version: string; + exchange: string; + merchant: string; + bank: string; + devMode?: boolean; +} +``` +```typescript +export declare type Transaction = + | TransactionWithdrawal + | TransactionPayment + | TransactionRefund + | TransactionTip + | TransactionRefresh + | TransactionDeposit + | TransactionPeerPullCredit + | TransactionPeerPullDebit + | TransactionPeerPushCredit + | TransactionPeerPushDebit; +``` +```typescript +export 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; +} +``` +```typescript +export interface TransactionCommon { + transactionId: TransactionIdStr; + type: TransactionType; + timestamp: TalerProtocolTimestamp; + pending: boolean; + /** + * True if the transaction encountered a problem that might be + * permanent. A frozen transaction won't be automatically retried. + */ + frozen: 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?: TalerErrorDetail; +} +``` +```typescript +export declare enum TransactionType { + Withdrawal = "withdrawal", + Payment = "payment", + Refund = "refund", + Refresh = "refresh", + Tip = "tip", + Deposit = "deposit", + PeerPushDebit = "peer-push-debit", + PeerPushCredit = "peer-push-credit", + PeerPullDebit = "peer-pull-debit", + PeerPullCredit = "peer-pull-credit", +} +``` +```typescript export interface TalerProtocolTimestamp { readonly t_s: number | "never"; } @@ -2249,6 +2466,81 @@ export interface TalerErrorDetail { } ``` ```typescript +export declare type WithdrawalDetails = + | WithdrawalDetailsForManualTransfer + | WithdrawalDetailsForTalerBankIntegrationApi; +``` +```typescript +interface WithdrawalDetailsForManualTransfer { + type: WithdrawalType.ManualTransfer; + /** + * Payto URIs that the exchange supports. + * + * Already contains the amount and message. + */ + exchangePaytoUris: string[]; + reservePub: string; +} +``` +```typescript +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; + reservePub: string; +} +``` +```typescript +export interface TransactionPayment extends TransactionCommon { + type: TransactionType.Payment; + /** + * Additional information about the payment. + */ + info: OrderShortInfo; + /** + * Wallet-internal end-to-end identifier for the payment. + */ + proposalId: string; + /** + * 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; + /** + * Amount that has been refunded by the merchant + */ + totalRefundRaw: AmountString; + /** + * Amount will be added to the wallet's balance after fees and refreshing + */ + totalRefundEffective: AmountString; + /** + * Amount pending to be picked up + */ + refundPending: AmountString | undefined; + /** + * Reference to applied refunds + */ + refunds: RefundInfoShort[]; +} +``` +```typescript export interface OrderShortInfo { /** * Order ID, uniquely identifies the order within a merchant instance @@ -2349,19 +2641,245 @@ export interface Tax { } ``` ```typescript +export declare 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", +} +``` +```typescript +export interface RefundInfoShort { + transactionId: string; + timestamp: TalerProtocolTimestamp; + amountEffective: AmountString; + amountRaw: AmountString; +} +``` +```typescript +export interface TransactionRefund extends TransactionCommon { + type: TransactionType.Refund; + refundedTransactionId: string; + info: OrderShortInfo; + /** + * Amount pending to be picked up + */ + refundPending: AmountString | undefined; + amountRaw: AmountString; + amountEffective: AmountString; +} +``` +```typescript +export interface TransactionTip extends TransactionCommon { + type: TransactionType.Tip; + amountRaw: AmountString; + /** + * More information about the merchant + */ + amountEffective: AmountString; + merchantBaseUrl: string; +} +``` +```typescript +/** + * A transaction shown for refreshes. + * Only shown for (1) refreshes not associated with other transactions + * and (2) refreshes in an error state. + */ +export interface TransactionRefresh extends TransactionCommon { + type: TransactionType.Refresh; + /** + * Exchange that the coins are refreshed with + */ + exchangeBaseUrl: string; + refreshReason: RefreshReason; + /** + * Transaction ID that caused this refresh. + */ + originatingTransactionId?: string; + /** + * Always zero for refreshes + */ + amountRaw: AmountString; + /** + * Fees, i.e. the effective, negative effect of the refresh + * on the balance. + */ + amountEffective: AmountString; +} +``` +```typescript +/** + * Reasons for why a coin is being refreshed. + */ +export declare enum RefreshReason { + Manual = "manual", + PayMerchant = "pay-merchant", + PayDeposit = "pay-deposit", + PayPeerPush = "pay-peer-push", + PayPeerPull = "pay-peer-pull", + Refund = "refund", + AbortPay = "abort-pay", + Recoup = "recoup", + BackupRestored = "backup-restored", + Scheduled = "scheduled", +} +``` +```typescript +/** + * Deposit transaction, which effectively sends + * money from this wallet somewhere else. + */ +export interface TransactionDeposit extends TransactionCommon { + type: TransactionType.Deposit; + depositGroupId: string; + /** + * Target for the deposit. + */ + targetPaytoUri: string; + /** + * Raw amount that is being deposited + */ + amountRaw: AmountString; + /** + * Effective amount that is being deposited + */ + amountEffective: AmountString; +} +``` +```typescript +/** + * Credit because we were paid for a P2P invoice we created. + */ +export interface TransactionPeerPullCredit extends TransactionCommon { + type: TransactionType.PeerPullCredit; + info: PeerInfoShort; + /** + * Exchange used. + */ + 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; + /** + * URI to send to the other party. + */ + talerUri: string; +} +``` +```typescript +export interface PeerInfoShort { + expiration: TalerProtocolTimestamp | undefined; + summary: string | undefined; +} +``` +```typescript +/** + * Debit because we paid someone's invoice. + */ +export interface TransactionPeerPullDebit extends TransactionCommon { + type: TransactionType.PeerPullDebit; + info: PeerInfoShort; + /** + * Exchange used. + */ + exchangeBaseUrl: string; + amountRaw: AmountString; + amountEffective: AmountString; +} +``` +```typescript +/** + * We received money via a P2P payment. + */ +export interface TransactionPeerPushCredit extends TransactionCommon { + type: TransactionType.PeerPushCredit; + info: PeerInfoShort; + /** + * Exchange used. + */ + 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; +} +``` +```typescript +/** + * We sent money via a P2P payment. + */ +export interface TransactionPeerPushDebit extends TransactionCommon { + type: TransactionType.PeerPushDebit; + info: PeerInfoShort; + /** + * Exchange used. + */ + 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; + /** + * URI to accept the payment. + */ + talerUri: string; +} +``` +```typescript export interface ExchangeListItem { exchangeBaseUrl: string; - currency: string; + currency: string | undefined; paytoUris: string[]; - tos: ExchangeTos; + tosStatus: ExchangeTosStatus; + exchangeStatus: ExchangeEntryStatus; + /** + * Permanently added to the wallet, as opposed to just + * temporarily queried. + */ + permanent: boolean; } ``` ```typescript -export interface ExchangeTos { - acceptedVersion?: string; - currentVersion?: string; - contentType?: string; - content?: string; +export declare enum ExchangeTosStatus { + New = "new", + Accepted = "accepted", + Changed = "changed", + NotFound = "not-found", + Unknown = "unknown", +} +``` +```typescript +export declare enum ExchangeEntryStatus { + Unknown = "unknown", + Outdated = "outdated", + Ok = "ok", } ``` ```typescript @@ -2531,6 +3049,26 @@ export interface ExchangeHandle { ``` ```typescript /** + * Non-negative financial amount. Fractional values are expressed as multiples + * of 1e-8. + */ +export interface AmountJson { + /** + * Value, must be an integer. + */ + readonly value: number; + /** + * Fraction, must be an integer. Represent 1/1e8 of a unit. + */ + readonly fraction: number; + /** + * Currency of the amount. + */ + readonly currency: string; +} +``` +```typescript +/** * Forced coin selection for deposits/payments. */ export interface ForcedCoinSel { @@ -2541,11 +3079,21 @@ export interface ForcedCoinSel { } ``` ```typescript -export interface BackupRecovery { - walletRootPriv: string; - providers: { - url: string; - }[]; +export interface ApplyRefundResponse { + contractTermsHash: string; + transactionId: string; + proposalId: string; + amountEffectivePaid: AmountString; + amountRefundGranted: AmountString; + amountRefundGone: AmountString; + pendingAtExchange: boolean; + info: OrderShortInfo; +} +``` +```typescript +export interface AddExchangeRequest { + exchangeBaseUrl: string; + forceUpdate?: boolean; } ``` ```typescript @@ -2564,3 +3112,11 @@ export interface Duration { readonly d_ms: number | "forever"; } ``` +```typescript +export interface BackupRecovery { + walletRootPriv: string; + providers: { + url: string; + }[]; +} +``` |