taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

commit f1b3d8742d5675423d84a9f6185b5fdfa5cb9b45
parent 271b7140cbe5774e64fbe3d669d0bce6cde3985b
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 21 Feb 2023 13:01:24 +0100

Merge branch 'master' of git+ssh://git.taler.net/docs

Diffstat:
Mdesign-documents/037-wallet-transactions-lifecycle.rst | 2+-
Mlibeufin/api-sandbox.rst | 4++--
Mwallet/wallet-core.md | 753++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
3 files changed, 579 insertions(+), 180 deletions(-)

diff --git a/design-documents/037-wallet-transactions-lifecycle.rst b/design-documents/037-wallet-transactions-lifecycle.rst @@ -180,7 +180,7 @@ user. So special-casing this and testing this is IMO just not worth it. * ``aborted(after-wired)``: In this state, the wallet should show to the user that the money from the withdrawal - reserve will be sent back to the originating bank account after `$closing_delay`. + reserve will be sent back to the originating bank account after ``$closing_delay``. * ``done`` diff --git a/libeufin/api-sandbox.rst b/libeufin/api-sandbox.rst @@ -276,7 +276,7 @@ Cashouts Initiates a conversion to fiat currency. The account to be credited is the one specified at registration time via the - `cashout_address` parameter. The account to be + *cashout_address* parameter. The account to be debited is extracted from the authentication credentials. The bank sends a TAN to the customer to let them confirm the operation. The request is only available to ordinary users, not @@ -433,7 +433,7 @@ Cashouts ratios_and_fees: RatiosAndFees; // Fiat currency. That is the currency in which // cash-out operations ultimately wire money. - fiat_currency: String; + fiat_currency: string; } .. ts:def:: RatiosAndFees diff --git a/wallet/wallet-core.md b/wallet/wallet-core.md @@ -6,12 +6,16 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core * [GetVersionOp](#getversionop) ### Basic Wallet Information * [GetBalancesOp](#getbalancesop) +* [GetBalancesDetailOp](#getbalancesdetailop) ### Managing Transactions * [GetTransactionsOp](#gettransactionsop) * [GetTransactionByIdOp](#gettransactionbyidop) * [RetryPendingNowOp](#retrypendingnowop) * [DeleteTransactionOp](#deletetransactionop) * [RetryTransactionOp](#retrytransactionop) +* [AbortTransactionOp](#aborttransactionop) +* [SuspendTransactionOp](#suspendtransactionop) +* [ResumeTransactionOp](#resumetransactionop) ### Withdrawals * [GetWithdrawalDetailsForAmountOp](#getwithdrawaldetailsforamountop) * [GetWithdrawalDetailsForUriOp](#getwithdrawaldetailsforuriop) @@ -19,9 +23,9 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core * [AcceptManualWithdrawalOp](#acceptmanualwithdrawalop) ### Merchant Payments * [PreparePayForUriOp](#preparepayforuriop) +* [PreparePayForTemplateOp](#preparepayfortemplateop) * [GetContractTermsDetailsOp](#getcontracttermsdetailsop) * [ConfirmPayOp](#confirmpayop) -* [AbortPayWithRefundOp](#abortpaywithrefundop) * [ApplyRefundOp](#applyrefundop) * [ApplyRefundFromPurchaseIdOp](#applyrefundfrompurchaseidop) * [PrepareRefundOp](#preparerefundop) @@ -54,12 +58,14 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core * [SetWalletDeviceIdOp](#setwalletdeviceidop) * [ExportBackupPlainOp](#exportbackupplainop) ### Peer Payments -* [InitiatePeerPushPaymentOp](#initiatepeerpushpaymentop) -* [CheckPeerPushPaymentOp](#checkpeerpushpaymentop) -* [AcceptPeerPushPaymentOp](#acceptpeerpushpaymentop) -* [InitiatePeerPullPaymentOp](#initiatepeerpullpaymentop) -* [CheckPeerPullPaymentOp](#checkpeerpullpaymentop) -* [AcceptPeerPullPaymentOp](#acceptpeerpullpaymentop) +* [CheckPeerPushDebitOp](#checkpeerpushdebitop) +* [InitiatePeerPushDebitOp](#initiatepeerpushdebitop) +* [PreparePeerPushCreditOp](#preparepeerpushcreditop) +* [ConfirmPeerPushCreditOp](#confirmpeerpushcreditop) +* [CheckPeerPullCreditOp](#checkpeerpullcreditop) +* [InitiatePeerPullCreditOp](#initiatepeerpullcreditop) +* [PreparePeerPullDebitOp](#preparepeerpulldebitop) +* [ConfirmPeerPullDebitOp](#confirmpeerpulldebitop) ### Database Management * [ExportDbOp](#exportdbop) * [ImportDbOp](#importdbop) @@ -88,13 +94,19 @@ This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core */ export type InitWalletOp = { op: WalletApiOperation.InitWallet; - request: EmptyObject; + request: InitRequest; response: InitResponse; }; // InitWallet = "initWallet" ``` ```typescript +export interface InitRequest { + skipDefaults?: boolean; +} + +``` +```typescript export interface InitResponse { versionInfo: WalletCoreVersion; } @@ -133,6 +145,7 @@ export interface BalancesResponse { ``` ```typescript export interface Balance { + scopeInfo: ScopeInfo; available: AmountString; pendingIncoming: AmountString; pendingOutgoing: AmountString; @@ -141,6 +154,87 @@ export interface Balance { } ``` +```typescript +export type ScopeInfo = + | { + type: ScopeType.Global; + currency: string; + } + | { + type: ScopeType.Exchange; + currency: string; + url: string; + } + | { + type: ScopeType.Auditor; + currency: string; + url: string; + }; + +``` + +### GetBalancesDetailOp +```typescript +export type GetBalancesDetailOp = { + op: WalletApiOperation.GetBalanceDetail; + request: GetBalanceDetailRequest; + response: MerchantPaymentBalanceDetails; +}; +// GetBalanceDetail = "getBalanceDetail" + +``` +```typescript +export interface GetBalanceDetailRequest { + currency: string; +} + +``` +```typescript +export interface MerchantPaymentBalanceDetails { + /** + * Balance of type "available" (see balance.ts for definition). + */ + balanceAvailable: AmountJson; + /** + * Balance of type "material" (see balance.ts for definition). + */ + balanceMaterial: AmountJson; + /** + * Balance of type "age-acceptable" (see balance.ts for definition). + */ + balanceAgeAcceptable: AmountJson; + /** + * Balance of type "merchant-acceptable" (see balance.ts for definition). + */ + balanceMerchantAcceptable: AmountJson; + /** + * Balance of type "merchant-depositable" (see balance.ts for definition). + */ + balanceMerchantDepositable: AmountJson; +} + +``` +```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; +} + +``` ### GetTransactionsOp ```typescript @@ -165,6 +259,10 @@ export interface TransactionsRequest { * if present, results will be limited to transactions related to the given search string */ search?: string; + /** + * If true, include all refreshes in the transactions list. + */ + includeRefreshes?: boolean; } ``` @@ -243,6 +341,50 @@ export interface RetryTransactionRequest { ``` +### AbortTransactionOp +```typescript +/** + * Abort a transaction + * + * For payment transactions, it puts the payment into an "aborting" state. + */ +export type AbortTransactionOp = { + op: WalletApiOperation.AbortTransaction; + request: AbortTransactionRequest; + response: EmptyObject; +}; +// AbortTransaction = "abortTransaction" + +``` + +### SuspendTransactionOp +```typescript +/** + * Suspend a transaction + */ +export type SuspendTransactionOp = { + op: WalletApiOperation.SuspendTransaction; + request: AbortTransactionRequest; + response: EmptyObject; +}; +// SuspendTransaction = "suspendTransaction" + +``` + +### ResumeTransactionOp +```typescript +/** + * Resume a transaction + */ +export type ResumeTransactionOp = { + op: WalletApiOperation.ResumeTransaction; + request: AbortTransactionRequest; + response: EmptyObject; +}; +// ResumeTransaction = "resumeTransaction" + +``` + ### GetWithdrawalDetailsForAmountOp ```typescript /** @@ -391,7 +533,7 @@ export interface AcceptManualWithdrawalResult { ### PreparePayForUriOp ```typescript /** - * Prepare to make a payment + * Prepare to make a payment based on a taler://pay/ URI. */ export type PreparePayForUriOp = { op: WalletApiOperation.PreparePayForUri; @@ -407,50 +549,24 @@ export interface PreparePayRequest { } ``` + +### PreparePayForTemplateOp ```typescript /** - * Result of a prepare pay operation. + * Prepare to make a payment based on a taler://pay-template/ URI. */ -export declare type PreparePayResult = - | PreparePayResultInsufficientBalance - | PreparePayResultAlreadyConfirmed - | PreparePayResultPaymentPossible; +export type PreparePayForTemplateOp = { + op: WalletApiOperation.PreparePayForTemplate; + request: PreparePayTemplateRequest; + response: PreparePayResult; +}; +// PreparePayForTemplate = "preparePayForTemplate" ``` ```typescript -export interface PreparePayResultInsufficientBalance { - status: PreparePayResultType.InsufficientBalance; - proposalId: string; - contractTerms: MerchantContractTerms; - amountRaw: string; - noncePriv: string; -} - -``` -```typescript -export interface PreparePayResultAlreadyConfirmed { - status: PreparePayResultType.AlreadyConfirmed; - contractTerms: MerchantContractTerms; - paid: boolean; - amountRaw: string; - amountEffective: string; - contractTermsHash: string; - proposalId: string; -} - -``` -```typescript -/** - * Payment is possible. - */ -export interface PreparePayResultPaymentPossible { - status: PreparePayResultType.PaymentPossible; - proposalId: string; - contractTerms: MerchantContractTerms; - contractTermsHash: string; - amountRaw: string; - amountEffective: string; - noncePriv: string; +export interface PreparePayTemplateRequest { + talerPayTemplateUri: string; + templateParams: Record<string, string>; } ``` @@ -554,9 +670,7 @@ export interface ConfirmPayRequest { ``` ```typescript -export declare type ConfirmPayResult = - | ConfirmPayResultDone - | ConfirmPayResultPending; +export type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending; ``` ```typescript @@ -579,26 +693,6 @@ export interface ConfirmPayResultPending { ``` -### AbortPayWithRefundOp -```typescript -/** - * Abort a pending payment with a refund. - */ -export type AbortPayWithRefundOp = { - op: WalletApiOperation.AbortFailedPayWithRefund; - request: AbortPayWithRefundRequest; - response: EmptyObject; -}; -// AbortFailedPayWithRefund = "abortFailedPayWithRefund" - -``` -```typescript -export interface AbortPayWithRefundRequest { - proposalId: string; -} - -``` - ### ApplyRefundOp ```typescript /** @@ -730,7 +824,7 @@ export interface PrepareTipResult { export type AcceptTipOp = { op: WalletApiOperation.AcceptTip; request: AcceptTipRequest; - response: EmptyObject; + response: AcceptTipResponse; }; // AcceptTip = "acceptTip" @@ -741,6 +835,13 @@ export interface AcceptTipRequest { } ``` +```typescript +export interface AcceptTipResponse { + transactionId: string; + next_url?: string; +} + +``` ### ListExchangesOp ```typescript @@ -808,7 +909,7 @@ export interface KnownBankAccountsInfo { ``` ```typescript -export declare type PaytoUri = +export type PaytoUri = | PaytoUriUnknown | PaytoUriIBAN | PaytoUriTalerBank @@ -836,6 +937,7 @@ export interface PaytoUriIBAN extends PaytoUriGeneric { isKnown: true; targetType: "iban"; iban: string; + bic?: string; } ``` @@ -1108,10 +1210,35 @@ export interface TrackDepositGroupRequest { ``` ```typescript export interface TrackDepositGroupResponse { - responses: { - status: number; - body: any; - }[]; + responses: TrackTransaction[]; +} + +``` +```typescript +export type TrackTransaction = + | ({ + type: "accepted"; + } & TrackTransactionAccepted) + | ({ + type: "wired"; + } & TrackTransactionWired); + +``` +```typescript +interface TrackTransactionAccepted { + requirement_row?: number; + kyc_ok: boolean; + execution_time: TalerProtocolTimestamp; +} + +``` +```typescript +export interface TrackTransactionWired { + wtid: Base32String; + execution_time: TalerProtocolTimestamp; + coin_contribution: AmountString; + exchange_sig: EddsaSignatureString; + exchange_pub: EddsaPublicKeyString; } ``` @@ -1263,7 +1390,7 @@ export type ExportBackupOp = { export type AddBackupProviderOp = { op: WalletApiOperation.AddBackupProvider; request: AddBackupProviderRequest; - response: EmptyObject; + response: AddBackupProviderResponse; }; // AddBackupProvider = "addBackupProvider" @@ -1280,6 +1407,25 @@ export interface AddBackupProviderRequest { } ``` +```typescript +export type AddBackupProviderResponse = + | AddBackupProviderOk + | AddBackupProviderPaymentRequired; + +``` +```typescript +interface AddBackupProviderOk { + status: "ok"; +} + +``` +```typescript +interface AddBackupProviderPaymentRequired { + status: "payment-required"; + talerUri?: string; +} + +``` ### RemoveBackupProviderOp ```typescript @@ -1400,6 +1546,7 @@ export interface ProviderPaymentPaid { ```typescript export interface ProviderPaymentInsufficientBalance { type: ProviderPaymentType.InsufficientBalance; + amount: AmountString; } ``` @@ -1412,6 +1559,7 @@ export interface ProviderPaymentUnpaid { ```typescript export interface ProviderPaymentPending { type: ProviderPaymentType.Pending; + talerUri?: string; } ``` @@ -1455,17 +1603,54 @@ export type ExportBackupPlainOp = { ``` -### InitiatePeerPushPaymentOp +### CheckPeerPushDebitOp +```typescript +/** + * Check if initiating a peer push payment is possible + * based on the funds in the wallet. + */ +export type CheckPeerPushDebitOp = { + op: WalletApiOperation.CheckPeerPushDebit; + request: CheckPeerPushDebitRequest; + response: CheckPeerPushDebitResponse; +}; +// CheckPeerPushDebit = "checkPeerPushDebit" + +``` +```typescript +export interface CheckPeerPushDebitRequest { + /** + * Preferred exchange to use for the p2p payment. + */ + exchangeBaseUrl?: string; + /** + * Instructed amount. + * + * FIXME: Allow specifying the instructed amount type. + */ + amount: AmountString; +} + +``` +```typescript +export interface CheckPeerPushDebitResponse { + amountRaw: AmountString; + amountEffective: AmountString; +} + +``` + +### InitiatePeerPushDebitOp ```typescript /** * Initiate an outgoing peer push payment. */ -export type InitiatePeerPushPaymentOp = { - op: WalletApiOperation.InitiatePeerPushPayment; +export type InitiatePeerPushDebitOp = { + op: WalletApiOperation.InitiatePeerPushDebit; request: InitiatePeerPushPaymentRequest; response: InitiatePeerPushPaymentResponse; }; -// InitiatePeerPushPayment = "initiatePeerPushPayment" +// InitiatePeerPushDebit = "initiatePeerPushDebit" ``` ```typescript @@ -1486,62 +1671,49 @@ export interface InitiatePeerPushPaymentResponse { } ``` -```typescript -/** - * Contract terms between two wallets (as opposed to a merchant and wallet). - */ -export interface PeerContractTerms { - amount: AmountString; - summary: string; - purse_expiration: TalerProtocolTimestamp; -} - -``` - -### CheckPeerPushPaymentOp +### PreparePeerPushCreditOp ```typescript /** * Check an incoming peer push payment. */ -export type CheckPeerPushPaymentOp = { - op: WalletApiOperation.CheckPeerPushPayment; - request: CheckPeerPushPaymentRequest; - response: CheckPeerPushPaymentResponse; +export type PreparePeerPushCreditOp = { + op: WalletApiOperation.PreparePeerPushCredit; + request: PreparePeerPushCredit; + response: PreparePeerPushCreditResponse; }; -// CheckPeerPushPayment = "checkPeerPushPayment" +// PreparePeerPushCredit = "preparePeerPushCredit" ``` ```typescript -export interface CheckPeerPushPaymentRequest { - talerUri: string; -} - -``` -```typescript -export interface CheckPeerPushPaymentResponse { +export interface PreparePeerPushCreditResponse { contractTerms: PeerContractTerms; + /** + * @deprecated + */ amount: AmountString; + amountRaw: AmountString; + amountEffective: AmountString; peerPushPaymentIncomingId: string; } ``` -### AcceptPeerPushPaymentOp +### ConfirmPeerPushCreditOp ```typescript /** * Accept an incoming peer push payment. */ -export type AcceptPeerPushPaymentOp = { - op: WalletApiOperation.AcceptPeerPushPayment; - request: AcceptPeerPushPaymentRequest; +export type ConfirmPeerPushCreditOp = { + op: WalletApiOperation.ConfirmPeerPushCredit; + request: ConfirmPeerPushCreditRequest; response: EmptyObject; }; -// AcceptPeerPushPayment = "acceptPeerPushPayment" +// ConfirmPeerPushCredit = "confirmPeerPushCredit" ``` ```typescript -export interface AcceptPeerPushPaymentRequest { +export interface ConfirmPeerPushCreditRequest { /** * Transparent identifier of the incoming peer push payment. */ @@ -1550,31 +1722,57 @@ export interface AcceptPeerPushPaymentRequest { ``` -### InitiatePeerPullPaymentOp +### CheckPeerPullCreditOp ```typescript /** - * Initiate an outgoing peer pull payment. + * Check fees for an outgoing peer pull payment. */ -export type InitiatePeerPullPaymentOp = { - op: WalletApiOperation.InitiatePeerPullPayment; - request: InitiatePeerPullPaymentRequest; - response: InitiatePeerPullPaymentResponse; +export type CheckPeerPullCreditOp = { + op: WalletApiOperation.CheckPeerPullCredit; + request: CheckPeerPullCreditRequest; + response: CheckPeerPullCreditResponse; }; -// InitiatePeerPullPayment = "initiatePeerPullPayment" +// CheckPeerPullCredit = "checkPeerPullCredit" ``` ```typescript -export interface InitiatePeerPullPaymentRequest { - /** - * FIXME: Make this optional? - */ +export interface CheckPeerPullCreditRequest { + exchangeBaseUrl?: string; + amount: AmountString; +} + +``` +```typescript +export interface CheckPeerPullCreditResponse { exchangeBaseUrl: string; + amountRaw: AmountString; + amountEffective: AmountString; +} + +``` + +### InitiatePeerPullCreditOp +```typescript +/** + * Initiate an outgoing peer pull payment. + */ +export type InitiatePeerPullCreditOp = { + op: WalletApiOperation.InitiatePeerPullCredit; + request: InitiatePeerPullCreditRequest; + response: InitiatePeerPullCreditResponse; +}; +// InitiatePeerPullCredit = "initiatePeerPullCredit" + +``` +```typescript +export interface InitiatePeerPullCreditRequest { + exchangeBaseUrl?: string; partialContractTerms: PeerContractTerms; } ``` ```typescript -export interface InitiatePeerPullPaymentResponse { +export interface InitiatePeerPullCreditResponse { /** * Taler URI for the other party to make the payment * that was requested. @@ -1585,49 +1783,54 @@ export interface InitiatePeerPullPaymentResponse { ``` -### CheckPeerPullPaymentOp +### PreparePeerPullDebitOp ```typescript /** * Prepare for an incoming peer pull payment. */ -export type CheckPeerPullPaymentOp = { - op: WalletApiOperation.CheckPeerPullPayment; - request: CheckPeerPullPaymentRequest; - response: CheckPeerPullPaymentResponse; +export type PreparePeerPullDebitOp = { + op: WalletApiOperation.PreparePeerPullDebit; + request: PreparePeerPullDebitRequest; + response: PreparePeerPullDebitResponse; }; -// CheckPeerPullPayment = "checkPeerPullPayment" +// PreparePeerPullDebit = "preparePeerPullDebit" ``` ```typescript -export interface CheckPeerPullPaymentRequest { +export interface PreparePeerPullDebitRequest { talerUri: string; } ``` ```typescript -export interface CheckPeerPullPaymentResponse { +export interface PreparePeerPullDebitResponse { contractTerms: PeerContractTerms; + /** + * @deprecated Redundant field with bad name, will be removed soon. + */ amount: AmountString; + amountRaw: AmountString; + amountEffective: AmountString; peerPullPaymentIncomingId: string; } ``` -### AcceptPeerPullPaymentOp +### ConfirmPeerPullDebitOp ```typescript /** - * Accept an incoming peer pull payment. + * Accept an incoming peer pull payment (i.e. pay the other party). */ -export type AcceptPeerPullPaymentOp = { - op: WalletApiOperation.AcceptPeerPullPayment; - request: AcceptPeerPullPaymentRequest; +export type ConfirmPeerPullDebitOp = { + op: WalletApiOperation.ConfirmPeerPullDebit; + request: ConfirmPeerPullDebitRequest; response: EmptyObject; }; -// AcceptPeerPullPayment = "acceptPeerPullPayment" +// ConfirmPeerPullDebit = "confirmPeerPullDebit" ``` ```typescript -export interface AcceptPeerPullPaymentRequest { +export interface ConfirmPeerPullDebitRequest { /** * Transparent identifier of the incoming peer pull payment. */ @@ -1936,6 +2139,10 @@ export type PendingTaskInfo = PendingTaskInfoCommon & | PendingRecoupTask | PendingDepositTask | PendingBackupTask + | PendingPeerPushInitiationTask + | PendingPeerPullInitiationTask + | PendingPeerPullDebitTask + | PendingPeerPushCreditTask ); ``` @@ -1988,6 +2195,11 @@ export enum PendingTaskType { Withdraw = "withdraw", Deposit = "deposit", Backup = "backup", + // FIXME: Rename to peer-push-debit and peer-pull-debit + PeerPushInitiation = "peer-push-initiation", + PeerPullInitiation = "peer-pull-initiation", + PeerPushCredit = "peer-push-credit", + PeerPullDebit = "peer-pull-debit", } ``` @@ -2192,6 +2404,45 @@ export interface PendingBackupTask { } ``` +```typescript +/** + * The wallet wants to send a peer push payment. + */ +export interface PendingPeerPushInitiationTask { + type: PendingTaskType.PeerPushInitiation; + pursePub: string; +} + +``` +```typescript +/** + * The wallet wants to send a peer pull payment. + */ +export interface PendingPeerPullInitiationTask { + type: PendingTaskType.PeerPullInitiation; + pursePub: string; +} + +``` +```typescript +/** + * The wallet wants to send a peer pull payment. + */ +export interface PendingPeerPullDebitTask { + type: PendingTaskType.PeerPullDebit; + peerPullPaymentIncomingId: string; +} + +``` +```typescript +/** + */ +export interface PendingPeerPushCreditTask { + type: PendingTaskType.PeerPushCredit; + peerPushPaymentIncomingId: string; +} + +``` ### DumpCoinsOp ```typescript @@ -2259,9 +2510,7 @@ export interface CoinDumpJson { ``` ```typescript -export declare type DenominationPubKey = - | RsaDenominationPubKey - | CsDenominationPubKey; +export type DenominationPubKey = RsaDenominationPubKey | CsDenominationPubKey; ``` ```typescript @@ -2319,15 +2568,11 @@ export interface AgeCommitment { ``` ```typescript -export declare type Edx25519PublicKeyEnc = FlavorP< - string, - "Edx25519PublicKeyEnc", - 32 ->; +export type Edx25519PublicKeyEnc = FlavorP<string, "Edx25519PublicKeyEnc", 32>; ``` ```typescript -export declare type FlavorP<T, FlavorT extends string, S extends number> = T & { +export type FlavorP<T, FlavorT extends string, S extends number> = T & { _flavor?: `taler.${FlavorT}`; _size?: S; }; @@ -2344,7 +2589,7 @@ export interface AgeProof { ``` ```typescript -export declare type Edx25519PrivateKeyEnc = FlavorP< +export type Edx25519PrivateKeyEnc = FlavorP< string, "Edx25519PrivateKeyEnc", 64 @@ -2407,7 +2652,7 @@ export interface WalletCoreVersion { } ``` ```typescript -export declare type Transaction = +export type Transaction = | TransactionWithdrawal | TransactionPayment | TransactionRefund @@ -2442,10 +2687,20 @@ export interface TransactionCommon { transactionId: TransactionIdStr; type: TransactionType; timestamp: TalerProtocolTimestamp; + extendedStatus: ExtendedStatus; + /** + * 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 + * + * @deprecated show extendedStatus + */ pending: boolean; /** * True if the transaction encountered a problem that might be * permanent. A frozen transaction won't be automatically retried. + * + * @deprecated show extendedStatus */ frozen: boolean; /** @@ -2479,14 +2734,46 @@ export interface TalerProtocolTimestamp { } ``` ```typescript +export declare enum ExtendedStatus { + Pending = "pending", + Done = "done", + Aborting = "aborting", + Aborted = "aborted", + Failed = "failed", + KycRequired = "kyc-required", +} +``` +```typescript export interface TalerErrorDetail { code: TalerErrorCode; + when?: AbsoluteTime; hint?: string; [x: string]: unknown; } ``` ```typescript -export declare type WithdrawalDetails = +export interface AbsoluteTime { + /** + * Timestamp in milliseconds. + */ + readonly t_ms: number | "never"; +} +``` +```typescript +export interface Duration { + /** + * Duration in milliseconds. + */ + readonly d_ms: number | "forever"; +} +``` +```typescript +export interface TalerProtocolDuration { + readonly d_us: number | "forever"; +} +``` +```typescript +export type WithdrawalDetails = | WithdrawalDetailsForManualTransfer | WithdrawalDetailsForTalerBankIntegrationApi; ``` @@ -2500,6 +2787,10 @@ interface WithdrawalDetailsForManualTransfer { */ exchangePaytoUris: string[]; reservePub: string; + /** + * Is the reserve ready for withdrawal? + */ + reserveIsReady: boolean; } ``` ```typescript @@ -2517,6 +2808,10 @@ interface WithdrawalDetailsForTalerBankIntegrationApi { */ bankConfirmationUrl?: string; reservePub: string; + /** + * Is the reserve ready for withdrawal? + */ + reserveIsReady: boolean; } ``` ```typescript @@ -2532,6 +2827,8 @@ export interface TransactionPayment extends TransactionCommon { proposalId: string; /** * How far did the wallet get with processing the payment? + * + * @deprecated use extendedStatus */ status: PaymentStatus; /** @@ -2558,6 +2855,10 @@ export interface TransactionPayment extends TransactionCommon { * Reference to applied refunds */ refunds: RefundInfoShort[]; + /** + * Is the wallet currently checking for a refund? + */ + refundQueryActive: boolean; } ``` ```typescript @@ -2721,10 +3022,6 @@ export interface TransactionTip extends TransactionCommon { */ 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. @@ -2737,8 +3034,14 @@ export interface TransactionRefresh extends TransactionCommon { /** * Fees, i.e. the effective, negative effect of the refresh * on the balance. + * + * Only applicable for stand-alone refreshes, and zero for + * other refreshes where the transaction itself accounts for the + * refresh fee. */ amountEffective: AmountString; + refreshInputAmount: AmountString; + refreshOutputAmount: AmountString; } ``` ```typescript @@ -2778,6 +3081,12 @@ export interface TransactionDeposit extends TransactionCommon { * Effective amount that is being deposited */ amountEffective: AmountString; + wireTransferDeadline: TalerProtocolTimestamp; + wireTransferProgress: number; + /** + * Did all the deposit requests succeed? + */ + deposited: boolean; } ``` ```typescript @@ -2873,6 +3182,19 @@ export interface TransactionPeerPushDebit extends TransactionCommon { } ``` ```typescript +export interface AbortTransactionRequest { + transactionId: string; + /** + * Move the payment immediately into an aborted state. + * The UI should warn the user that this might lead + * to money being lost. + * + * Defaults to false. + */ + forceImmediateAbort?: boolean; +} +``` +```typescript export interface ExchangeListItem { exchangeBaseUrl: string; currency: string | undefined; @@ -2886,7 +3208,7 @@ export interface ExchangeListItem { */ permanent: boolean; /** - * Information about the last error that occured when trying + * Information about the last error that occurred when trying * to update the exchange info. */ lastUpdateErrorInfo?: OperationErrorInfo; @@ -2923,6 +3245,26 @@ export interface ForcedDenomSel { ``` ```typescript /** + * Result of a prepare pay operation. + */ +export type PreparePayResult = + | PreparePayResultInsufficientBalance + | PreparePayResultAlreadyConfirmed + | PreparePayResultPaymentPossible; +``` +```typescript +export interface PreparePayResultInsufficientBalance { + status: PreparePayResultType.InsufficientBalance; + proposalId: string; + contractTerms: MerchantContractTerms; + amountRaw: string; + noncePriv: string; + talerUri: string; + balanceDetails: PayMerchantInsufficientBalanceDetails; +} +``` +```typescript +/** * Contract terms from a merchant. * FIXME: Add type field! */ @@ -3043,11 +3385,6 @@ export interface MerchantContractTerms { } ``` ```typescript -export interface TalerProtocolDuration { - readonly d_us: number | "forever"; -} -``` -```typescript export interface AuditorHandle { /** * Official name of the auditor. @@ -3081,6 +3418,74 @@ export interface ExchangeHandle { ``` ```typescript /** + * Detailed reason for why the wallet's balance is insufficient. + */ +export interface PayMerchantInsufficientBalanceDetails { + /** + * Amount requested by the merchant. + */ + amountRequested: AmountString; + /** + * Balance of type "available" (see balance.ts for definition). + */ + balanceAvailable: AmountString; + /** + * Balance of type "material" (see balance.ts for definition). + */ + balanceMaterial: AmountString; + /** + * Balance of type "age-acceptable" (see balance.ts for definition). + */ + balanceAgeAcceptable: AmountString; + /** + * Balance of type "merchant-acceptable" (see balance.ts for definition). + */ + balanceMerchantAcceptable: AmountString; + /** + * Balance of type "merchant-depositable" (see balance.ts for definition). + */ + balanceMerchantDepositable: AmountString; + /** + * If the payment would succeed without fees + * (i.e. balanceMechantWireable >= amountRequested), + * this field contains an estimate of the amount that would additionally + * be required to cover the fees. + * + * It is not possible to give an exact value here, since it depends + * on the coin selection for the amount that would be additionally withdrawn. + */ + feeGapEstimate: AmountString; +} +``` +```typescript +export interface PreparePayResultAlreadyConfirmed { + status: PreparePayResultType.AlreadyConfirmed; + contractTerms: MerchantContractTerms; + paid: boolean; + amountRaw: string; + amountEffective: string; + contractTermsHash: string; + proposalId: string; + talerUri?: string; +} +``` +```typescript +/** + * Payment is possible. + */ +export interface PreparePayResultPaymentPossible { + status: PreparePayResultType.PaymentPossible; + proposalId: string; + contractTerms: MerchantContractTerms; + contractTermsHash: string; + amountRaw: string; + amountEffective: string; + noncePriv: string; + talerUri: string; +} +``` +```typescript +/** * Forced coin selection for deposits/payments. */ export interface ForcedCoinSel { @@ -3109,22 +3514,6 @@ export interface AddExchangeRequest { } ``` ```typescript -export interface AbsoluteTime { - /** - * Timestamp in milliseconds. - */ - readonly t_ms: number | "never"; -} -``` -```typescript -export interface Duration { - /** - * Duration in milliseconds. - */ - readonly d_ms: number | "forever"; -} -``` -```typescript export interface BackupRecovery { walletRootPriv: string; providers: { @@ -3133,3 +3522,13 @@ export interface BackupRecovery { }[]; } ``` +```typescript +/** + * Contract terms between two wallets (as opposed to a merchant and wallet). + */ +export interface PeerContractTerms { + amount: AmountString; + summary: string; + purse_expiration: TalerProtocolTimestamp; +} +```