# Wallet-Core API Documentation This file is auto-generated from [wallet-core](https://git.taler.net/wallet-core.git/tree/packages/taler-wallet-core/src/wallet-api-types.ts). ## Overview ### Unknown Group * [InitWalletOp](#initwalletop) * [GetVersionOp](#getversionop) ### Basic Wallet Information * [GetBalancesOp](#getbalancesop) ### Managing Transactions * [GetTransactionsOp](#gettransactionsop) * [GetTransactionByIdOp](#gettransactionbyidop) * [RetryPendingNowOp](#retrypendingnowop) * [DeleteTransactionOp](#deletetransactionop) * [RetryTransactionOp](#retrytransactionop) ### Withdrawals * [GetWithdrawalDetailsForAmountOp](#getwithdrawaldetailsforamountop) * [GetWithdrawalDetailsForUriOp](#getwithdrawaldetailsforuriop) * [AcceptBankIntegratedWithdrawalOp](#acceptbankintegratedwithdrawalop) * [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) ### Peer Payments * [InitiatePeerPushPaymentOp](#initiatepeerpushpaymentop) * [CheckPeerPushPaymentOp](#checkpeerpushpaymentop) * [AcceptPeerPushPaymentOp](#acceptpeerpushpaymentop) * [InitiatePeerPullPaymentOp](#initiatepeerpullpaymentop) * [CheckPeerPullPaymentOp](#checkpeerpullpaymentop) * [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) * [WithdrawFakebankOp](#withdrawfakebankop) * [GetPendingTasksOp](#getpendingtasksop) * [DumpCoinsOp](#dumpcoinsop) * [SetCoinSuspendedOp](#setcoinsuspendedop) * [ForceRefreshOp](#forcerefreshop) ## Operation Reference ### InitWalletOp ```typescript /** * Initialize wallet-core. * * Must be the request before any other operations. */ export type InitWalletOp = { op: WalletApiOperation.InitWallet; request: EmptyObject; response: InitResponse; }; // InitWallet = "initWallet" ``` ```typescript export interface InitResponse { versionInfo: WalletCoreVersion; } ``` ### GetVersionOp ```typescript export type GetVersionOp = { op: WalletApiOperation.GetVersion; request: EmptyObject; response: WalletCoreVersion; }; // GetVersion = "getVersion" ``` ### GetBalancesOp ```typescript /** * Get current wallet balance. */ export type GetBalancesOp = { op: WalletApiOperation.GetBalances; request: EmptyObject; response: BalancesResponse; }; // GetBalances = "getBalances" ``` ```typescript export interface BalancesResponse { balances: Balance[]; } ``` ```typescript export interface Balance { available: AmountString; pendingIncoming: AmountString; pendingOutgoing: AmountString; hasPendingTransactions: boolean; requiresUserInput: boolean; } ``` ### GetTransactionsOp ```typescript /** * Get transactions. */ export type GetTransactionsOp = { op: WalletApiOperation.GetTransactions; request: TransactionsRequest; response: TransactionsResponse; }; // GetTransactions = "getTransactions" ``` ```typescript 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; } ``` ```typescript export interface TransactionsResponse { transactions: Transaction[]; } ``` ### GetTransactionByIdOp ```typescript export type GetTransactionByIdOp = { op: WalletApiOperation.GetTransactionById; request: TransactionByIdRequest; response: Transaction; }; // GetTransactionById = "getTransactionById" ``` ```typescript export interface TransactionByIdRequest { transactionId: string; } ``` ### RetryPendingNowOp ```typescript export type RetryPendingNowOp = { op: WalletApiOperation.RetryPendingNow; request: EmptyObject; response: EmptyObject; }; // RetryPendingNow = "retryPendingNow" ``` ### DeleteTransactionOp ```typescript /** * Delete a transaction locally in the wallet. */ export type DeleteTransactionOp = { op: WalletApiOperation.DeleteTransaction; request: DeleteTransactionRequest; response: EmptyObject; }; // DeleteTransaction = "deleteTransaction" ``` ```typescript export interface DeleteTransactionRequest { transactionId: string; } ``` ### RetryTransactionOp ```typescript /** * Immediately retry a transaction. */ export type RetryTransactionOp = { op: WalletApiOperation.RetryTransaction; request: RetryTransactionRequest; response: EmptyObject; }; // RetryTransaction = "retryTransaction" ``` ```typescript export interface RetryTransactionRequest { transactionId: string; } ``` ### GetWithdrawalDetailsForAmountOp ```typescript /** * Get details for withdrawing a particular amount (manual withdrawal). */ export type GetWithdrawalDetailsForAmountOp = { op: WalletApiOperation.GetWithdrawalDetailsForAmount; request: GetWithdrawalDetailsForAmountRequest; response: ManualWithdrawalDetails; }; // GetWithdrawalDetailsForAmount = "getWithdrawalDetailsForAmount" ``` ```typescript export interface GetWithdrawalDetailsForAmountRequest { exchangeBaseUrl: string; amount: string; restrictAge?: number; } ``` ```typescript 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[]; /** * If the exchange supports age-restricted coins it will return * the array of ages. */ ageRestrictionOptions?: number[]; } ``` ### GetWithdrawalDetailsForUriOp ```typescript /** * Get details for withdrawing via a particular taler:// URI. */ export type GetWithdrawalDetailsForUriOp = { op: WalletApiOperation.GetWithdrawalDetailsForUri; request: GetWithdrawalDetailsForUriRequest; response: WithdrawUriInfoResponse; }; // GetWithdrawalDetailsForUri = "getWithdrawalDetailsForUri" ``` ```typescript export interface GetWithdrawalDetailsForUriRequest { talerWithdrawUri: string; restrictAge?: number; } ``` ```typescript export interface WithdrawUriInfoResponse { amount: AmountString; defaultExchangeBaseUrl?: string; possibleExchanges: ExchangeListItem[]; } ``` ### AcceptBankIntegratedWithdrawalOp ```typescript /** * Accept a bank-integrated withdrawal. */ export type AcceptBankIntegratedWithdrawalOp = { op: WalletApiOperation.AcceptBankIntegratedWithdrawal; request: AcceptBankIntegratedWithdrawalRequest; response: AcceptWithdrawalResponse; }; // AcceptBankIntegratedWithdrawal = "acceptBankIntegratedWithdrawal" ``` ```typescript export interface AcceptBankIntegratedWithdrawalRequest { talerWithdrawUri: string; exchangeBaseUrl: string; forcedDenomSel?: ForcedDenomSel; restrictAge?: number; } ``` ```typescript export interface AcceptWithdrawalResponse { reservePub: string; confirmTransferUrl?: string; transactionId: string; } ``` ### AcceptManualWithdrawalOp ```typescript /** * Create a manual withdrawal. */ export type AcceptManualWithdrawalOp = { op: WalletApiOperation.AcceptManualWithdrawal; request: AcceptManualWithdrawalRequest; response: AcceptManualWithdrawalResult; }; // AcceptManualWithdrawal = "acceptManualWithdrawal" ``` ```typescript export interface AcceptManualWithdrawalRequest { exchangeBaseUrl: string; amount: string; restrictAge?: number; } ``` ```typescript export interface AcceptManualWithdrawalResult { /** * Payto URIs that can be used to fund the withdrawal. */ exchangePaytoUris: string[]; /** * Public key of the newly created reserve. */ reservePub: string; transactionId: string; } ``` ### PreparePayForUriOp ```typescript /** * Prepare to make a payment */ export type PreparePayForUriOp = { op: WalletApiOperation.PreparePayForUri; request: PreparePayRequest; response: PreparePayResult; }; // PreparePayForUri = "preparePayForUri" ``` ```typescript export interface PreparePayRequest { talerPayUri: string; } ``` ```typescript /** * Result of a prepare pay operation. */ export declare type PreparePayResult = | PreparePayResultInsufficientBalance | PreparePayResultAlreadyConfirmed | PreparePayResultPaymentPossible; ``` ```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; } ``` ### 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: AmountString; orderId: string; merchantBaseUrl: string; summary: string; autoRefund: TalerProtocolDuration | undefined; maxWireFee: AmountString; wireFeeAmortization: number; payDeadline: TalerProtocolTimestamp; refundDeadline: TalerProtocolTimestamp; allowedAuditors: AllowedAuditorInfo[]; allowedExchanges: AllowedExchangeInfo[]; timestamp: TalerProtocolTimestamp; wireMethod: string; wireInfoHash: string; maxDepositFee: AmountString; 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 /** * Confirm a payment that was previously prepared with * {@link PreparePayForUriOp} */ export type ConfirmPayOp = { op: WalletApiOperation.ConfirmPay; request: ConfirmPayRequest; response: ConfirmPayResult; }; // ConfirmPay = "confirmPay" ``` ```typescript export interface ConfirmPayRequest { proposalId: string; sessionId?: string; forcedCoinSel?: ForcedCoinSel; } ``` ```typescript export declare type ConfirmPayResult = | ConfirmPayResultDone | ConfirmPayResultPending; ``` ```typescript /** * Result for confirmPay */ export interface ConfirmPayResultDone { type: ConfirmPayResultType.Done; contractTerms: MerchantContractTerms; transactionId: string; } ``` ```typescript export interface ConfirmPayResultPending { type: ConfirmPayResultType.Pending; transactionId: string; lastError: TalerErrorDetail | undefined; } ``` ### 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 /** * Check for a refund based on a taler://refund URI. */ export type ApplyRefundOp = { op: WalletApiOperation.ApplyRefund; request: ApplyRefundRequest; response: ApplyRefundResponse; }; // ApplyRefund = "applyRefund" ``` ```typescript export interface ApplyRefundRequest { talerRefundUri: string; } ``` ### ApplyRefundFromPurchaseIdOp ```typescript 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; effectivePaid: AmountString; gone: AmountString; granted: AmountString; pending: boolean; awaiting: AmountString; info: OrderShortInfo; } ``` ### PrepareTipOp ```typescript /** * Query and store information about a tip. */ export type PrepareTipOp = { op: WalletApiOperation.PrepareTip; request: PrepareTipRequest; response: PrepareTipResult; }; // PrepareTip = "prepareTip" ``` ```typescript export interface PrepareTipRequest { talerTipUri: string; } ``` ```typescript export interface PrepareTipResult { /** * Unique ID for the tip assigned by the wallet. * Typically different from the merchant-generated tip ID. */ walletTipId: string; /** * Has the tip already been accepted? */ accepted: boolean; /** * Amount that the merchant gave. */ tipAmountRaw: AmountString; /** * Amount that arrived at the wallet. * Might be lower than the raw amount due to fees. */ tipAmountEffective: AmountString; /** * Base URL of the merchant backend giving then tip. */ merchantBaseUrl: string; /** * Base URL of the exchange that is used to withdraw the tip. * Determined by the merchant, the wallet/user has no choice here. */ exchangeBaseUrl: string; /** * Time when the tip will expire. After it expired, it can't be picked * up anymore. */ expirationTimestamp: TalerProtocolTimestamp; } ``` ### AcceptTipOp ```typescript /** * Accept a tip. */ export type AcceptTipOp = { op: WalletApiOperation.AcceptTip; request: AcceptTipRequest; response: EmptyObject; }; // AcceptTip = "acceptTip" ``` ```typescript export interface AcceptTipRequest { walletTipId: string; } ``` ### ListExchangesOp ```typescript /** * List exchanges known to the wallet. */ export type ListExchangesOp = { op: WalletApiOperation.ListExchanges; request: EmptyObject; response: ExchangesListResponse; }; // ListExchanges = "listExchanges" ``` ```typescript export interface ExchangesListResponse { exchanges: ExchangeListItem[]; } ``` ### AddExchangeOp ```typescript /** * Add / force-update an exchange. */ export type AddExchangeOp = { op: WalletApiOperation.AddExchange; request: AddExchangeRequest; response: EmptyObject; }; // AddExchange = "addExchange" ``` ### ListKnownBankAccountsOp ```typescript 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; } ``` ### AddKnownBankAccountsOp ```typescript export type AddKnownBankAccountsOp = { op: WalletApiOperation.AddKnownBankAccounts; request: AddKnownBankAccountsRequest; response: EmptyObject; }; // AddKnownBankAccounts = "addKnownBankAccounts" ``` ```typescript export interface AddKnownBankAccountsRequest { payto: string; alias: string; currency: string; } ``` ### ForgetKnownBankAccountsOp ```typescript export type ForgetKnownBankAccountsOp = { op: WalletApiOperation.ForgetKnownBankAccounts; request: ForgetKnownBankAccountsRequest; response: EmptyObject; }; // ForgetKnownBankAccounts = "forgetKnownBankAccounts" ``` ```typescript export interface ForgetKnownBankAccountsRequest { payto: string; } ``` ### SetExchangeTosAcceptedOp ```typescript /** * Accept a particular version of the exchange terms of service. */ export type SetExchangeTosAcceptedOp = { op: WalletApiOperation.SetExchangeTosAccepted; request: AcceptExchangeTosRequest; response: EmptyObject; }; // SetExchangeTosAccepted = "setExchangeTosAccepted" ``` ```typescript export interface AcceptExchangeTosRequest { exchangeBaseUrl: string; etag: string | undefined; } ``` ### GetExchangeTosOp ```typescript /** * Get the current terms of a service of an exchange. */ export type GetExchangeTosOp = { op: WalletApiOperation.GetExchangeTos; request: GetExchangeTosRequest; response: GetExchangeTosResult; }; // GetExchangeTos = "getExchangeTos" ``` ```typescript export interface GetExchangeTosRequest { exchangeBaseUrl: string; acceptedFormat?: string[]; } ``` ```typescript export interface GetExchangeTosResult { /** * Markdown version of the current ToS. */ content: 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; /** * 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; transferFees: Record; 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?: AmountString; } ``` ### ListCurrenciesOp ```typescript /** * List currencies known to the wallet. */ export type ListCurrenciesOp = { op: WalletApiOperation.ListCurrencies; request: EmptyObject; response: WalletCurrencyInfo; }; // ListCurrencies = "listCurrencies" ``` ```typescript export interface WalletCurrencyInfo { trustedAuditors: { currency: string; auditorPub: string; auditorBaseUrl: string; }[]; trustedExchanges: { currency: string; exchangeMasterPub: string; exchangeBaseUrl: string; }[]; } ``` ### CreateDepositGroupOp ```typescript /** * Create a new deposit group. * * Deposit groups are used to deposit multiple coins to a bank * account, usually the wallet user's own bank account. */ export type CreateDepositGroupOp = { op: WalletApiOperation.CreateDepositGroup; request: CreateDepositGroupRequest; response: CreateDepositGroupResponse; }; // CreateDepositGroup = "createDepositGroup" ``` ```typescript export interface CreateDepositGroupRequest { depositPaytoUri: string; amount: AmountString; } ``` ```typescript export interface CreateDepositGroupResponse { depositGroupId: string; transactionId: string; } ``` ### TrackDepositGroupOp ```typescript /** * Track the status of a deposit group by querying the exchange. */ export type TrackDepositGroupOp = { op: WalletApiOperation.TrackDepositGroup; request: TrackDepositGroupRequest; response: TrackDepositGroupResponse; }; // TrackDepositGroup = "trackDepositGroup" ``` ```typescript export interface TrackDepositGroupRequest { depositGroupId: string; } ``` ```typescript export interface TrackDepositGroupResponse { responses: { status: number; body: any; }[]; } ``` ### 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: AmountString; wire: AmountString; refresh: AmountString; } ``` ### 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: AmountString; effectiveDepositAmount: AmountString; } ``` ### ExportBackupRecoveryOp ```typescript /** * Export the recovery information for the wallet. */ export type ExportBackupRecoveryOp = { op: WalletApiOperation.ExportBackupRecovery; request: EmptyObject; response: BackupRecovery; }; // ExportBackupRecovery = "exportBackupRecovery" ``` ### ImportBackupRecoveryOp ```typescript /** * Import recovery information into the wallet. */ export type ImportBackupRecoveryOp = { op: WalletApiOperation.ImportBackupRecovery; request: RecoveryLoadRequest; response: EmptyObject; }; // ImportBackupRecovery = "importBackupRecovery" ``` ```typescript /** * Load recovery information into the wallet. */ export interface RecoveryLoadRequest { recovery: BackupRecovery; strategy?: RecoveryMergeStrategy; } ``` ```typescript /** * Strategy for loading recovery information. */ export declare enum RecoveryMergeStrategy { /** * Keep the local wallet root key, import and take over providers. */ Ours = "ours", /** * Migrate to the wallet root key from the recovery information. */ Theirs = "theirs", } ``` ### RunBackupCycleOp ```typescript /** * Manually make and upload a backup. */ export type RunBackupCycleOp = { op: WalletApiOperation.RunBackupCycle; request: RunBackupCycleRequest; response: EmptyObject; }; // RunBackupCycle = "runBackupCycle" ``` ```typescript export interface RunBackupCycleRequest { /** * List of providers to backup or empty for all known providers. */ providers?: Array; } ``` ### ExportBackupOp ```typescript export type ExportBackupOp = { op: WalletApiOperation.ExportBackup; request: EmptyObject; response: EmptyObject; }; // ExportBackup = "exportBackup" ``` ### AddBackupProviderOp ```typescript /** * Add a new backup provider. */ export type AddBackupProviderOp = { op: WalletApiOperation.AddBackupProvider; request: AddBackupProviderRequest; response: EmptyObject; }; // AddBackupProvider = "addBackupProvider" ``` ```typescript export interface AddBackupProviderRequest { backupProviderBaseUrl: string; name: string; /** * Activate the provider. Should only be done after * the user has reviewed the provider. */ activate?: boolean; } ``` ### RemoveBackupProviderOp ```typescript export type RemoveBackupProviderOp = { op: WalletApiOperation.RemoveBackupProvider; request: RemoveBackupProviderRequest; response: EmptyObject; }; // RemoveBackupProvider = "removeBackupProvider" ``` ```typescript export interface RemoveBackupProviderRequest { provider: string; } ``` ### GetBackupInfoOp ```typescript /** * Get some useful stats about the backup state. */ export type GetBackupInfoOp = { op: WalletApiOperation.GetBackupInfo; request: EmptyObject; response: BackupInfo; }; // GetBackupInfo = "getBackupInfo" ``` ```typescript export interface BackupInfo { walletRootPub: string; deviceId: string; providers: ProviderInfo[]; } ``` ```typescript /** * Information about one provider. * * We don't store the account key here, * as that's derived from the wallet root key. */ export interface ProviderInfo { active: boolean; syncProviderBaseUrl: string; name: string; terms?: BackupProviderTerms; /** * Last communication issue with the provider. */ lastError?: TalerErrorDetail; lastSuccessfulBackupTimestamp?: TalerProtocolTimestamp; lastAttemptedBackupTimestamp?: TalerProtocolTimestamp; paymentProposalIds: string[]; backupProblem?: BackupProblem; paymentStatus: ProviderPaymentStatus; } ``` ```typescript export interface BackupProviderTerms { supportedProtocolVersion: string; annualFee: AmountString; storageLimitInMegabytes: number; } ``` ```typescript export type BackupProblem = | BackupUnreadableProblem | BackupConflictingDeviceProblem; ``` ```typescript export interface BackupUnreadableProblem { type: "backup-unreadable"; } ``` ```typescript export interface BackupConflictingDeviceProblem { type: "backup-conflicting-device"; otherDeviceId: string; myDeviceId: string; backupTimestamp: AbsoluteTime; } ``` ```typescript export type ProviderPaymentStatus = | ProviderPaymentTermsChanged | ProviderPaymentPaid | ProviderPaymentInsufficientBalance | ProviderPaymentUnpaid | ProviderPaymentPending; ``` ```typescript export interface ProviderPaymentTermsChanged { type: ProviderPaymentType.TermsChanged; paidUntil: AbsoluteTime; oldTerms: BackupProviderTerms; newTerms: BackupProviderTerms; } ``` ```typescript export interface ProviderPaymentPaid { type: ProviderPaymentType.Paid; paidUntil: AbsoluteTime; } ``` ```typescript export interface ProviderPaymentInsufficientBalance { type: ProviderPaymentType.InsufficientBalance; } ``` ```typescript export interface ProviderPaymentUnpaid { type: ProviderPaymentType.Unpaid; } ``` ```typescript export interface ProviderPaymentPending { type: ProviderPaymentType.Pending; } ``` ### SetWalletDeviceIdOp ```typescript /** * Set the internal device ID of the wallet, used to * identify whether a different/new wallet is accessing * the backup of another wallet. */ export type SetWalletDeviceIdOp = { op: WalletApiOperation.SetWalletDeviceId; request: SetWalletDeviceIdRequest; response: EmptyObject; }; // SetWalletDeviceId = "setWalletDeviceId" ``` ```typescript export interface SetWalletDeviceIdRequest { /** * New wallet device ID to set. */ walletDeviceId: string; } ``` ### ExportBackupPlainOp ```typescript /** * Export a backup JSON, mostly useful for testing. */ export type ExportBackupPlainOp = { op: WalletApiOperation.ExportBackupPlain; request: EmptyObject; response: WalletBackupContentV1; }; // ExportBackupPlain = "exportBackupPlain" ``` ### InitiatePeerPushPaymentOp ```typescript /** * Initiate an outgoing peer push payment. */ export type InitiatePeerPushPaymentOp = { op: WalletApiOperation.InitiatePeerPushPayment; request: InitiatePeerPushPaymentRequest; response: InitiatePeerPushPaymentResponse; }; // InitiatePeerPushPayment = "initiatePeerPushPayment" ``` ```typescript export interface InitiatePeerPushPaymentRequest { amount: AmountString; partialContractTerms: any; } ``` ```typescript export interface InitiatePeerPushPaymentResponse { exchangeBaseUrl: string; pursePub: string; mergePriv: string; contractPriv: string; talerUri: string; transactionId: string; } ``` ### CheckPeerPushPaymentOp ```typescript /** * Check an incoming peer push payment. */ export type CheckPeerPushPaymentOp = { op: WalletApiOperation.CheckPeerPushPayment; request: CheckPeerPushPaymentRequest; response: CheckPeerPushPaymentResponse; }; // CheckPeerPushPayment = "checkPeerPushPayment" ``` ```typescript export interface CheckPeerPushPaymentRequest { talerUri: string; } ``` ```typescript export interface CheckPeerPushPaymentResponse { contractTerms: any; amount: AmountString; peerPushPaymentIncomingId: string; } ``` ### AcceptPeerPushPaymentOp ```typescript /** * Accept an incoming peer push payment. */ export type AcceptPeerPushPaymentOp = { op: WalletApiOperation.AcceptPeerPushPayment; request: AcceptPeerPushPaymentRequest; response: EmptyObject; }; // AcceptPeerPushPayment = "acceptPeerPushPayment" ``` ```typescript export interface AcceptPeerPushPaymentRequest { /** * Transparent identifier of the incoming peer push payment. */ peerPushPaymentIncomingId: string; } ``` ### InitiatePeerPullPaymentOp ```typescript /** * Initiate an outgoing peer pull payment. */ export type InitiatePeerPullPaymentOp = { op: WalletApiOperation.InitiatePeerPullPayment; request: InitiatePeerPullPaymentRequest; response: InitiatePeerPullPaymentResponse; }; // InitiatePeerPullPayment = "initiatePeerPullPayment" ``` ```typescript export interface InitiatePeerPullPaymentRequest { /** * FIXME: Make this optional? */ exchangeBaseUrl: string; amount: AmountString; partialContractTerms: any; } ``` ```typescript export interface InitiatePeerPullPaymentResponse { /** * Taler URI for the other party to make the payment * that was requested. */ talerUri: string; transactionId: string; } ``` ### CheckPeerPullPaymentOp ```typescript /** * Prepare for an incoming peer pull payment. */ export type CheckPeerPullPaymentOp = { op: WalletApiOperation.CheckPeerPullPayment; request: CheckPeerPullPaymentRequest; response: CheckPeerPullPaymentResponse; }; // CheckPeerPullPayment = "checkPeerPullPayment" ``` ```typescript export interface CheckPeerPullPaymentRequest { talerUri: string; } ``` ```typescript export interface CheckPeerPullPaymentResponse { contractTerms: any; amount: AmountString; peerPullPaymentIncomingId: string; } ``` ### AcceptPeerPullPaymentOp ```typescript /** * Accept an incoming peer pull payment. */ export type AcceptPeerPullPaymentOp = { op: WalletApiOperation.AcceptPeerPullPayment; request: AcceptPeerPullPaymentRequest; response: EmptyObject; }; // AcceptPeerPullPayment = "acceptPeerPullPayment" ``` ```typescript export interface AcceptPeerPullPaymentRequest { /** * Transparent identifier of the incoming peer pull payment. */ peerPullPaymentIncomingId: string; } ``` ### ExportDbOp ```typescript /** * Export the wallet database's contents to JSON. */ export type ExportDbOp = { op: WalletApiOperation.ExportDb; request: EmptyObject; response: any; }; // ExportDb = "exportDb" ``` ### ImportDbOp ```typescript export type ImportDbOp = { op: WalletApiOperation.ImportDb; request: any; response: any; }; // ImportDb = "importDb" ``` ### ClearDbOp ```typescript /** * Dangerously clear the whole wallet database. */ export type ClearDbOp = { op: WalletApiOperation.ClearDb; request: EmptyObject; response: EmptyObject; }; // ClearDb = "clearDb" ``` ### RecycleOp ```typescript /** * Export a backup, clear the database and re-import it. */ export type RecycleOp = { op: WalletApiOperation.Recycle; request: EmptyObject; response: EmptyObject; }; // Recycle = "recycle" ``` ### 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: EmptyObject; }; // ApplyDevExperiment = "applyDevExperiment" ``` ```typescript export interface ApplyDevExperimentRequest { devExperimentUri: string; } ``` ### SetDevModeOp ```typescript export type SetDevModeOp = { op: WalletApiOperation.SetDevMode; request: SetDevModeRequest; response: EmptyObject; }; // SetDevMode = "setDevMode" ``` ```typescript export interface SetDevModeRequest { devModeEnabled: boolean; } ``` ### RunIntegrationTestOp ```typescript /** * Run a simple integration test on a test deployment * of the exchange and merchant. */ export type RunIntegrationTestOp = { op: WalletApiOperation.RunIntegrationTest; request: IntegrationTestArgs; response: EmptyObject; }; // RunIntegrationTest = "runIntegrationTest" ``` ```typescript export interface IntegrationTestArgs { exchangeBaseUrl: string; bankBaseUrl: string; bankAccessApiBaseUrl?: string; merchantBaseUrl: string; merchantAuthToken?: string; amountToWithdraw: string; amountToSpend: string; } ``` ### TestCryptoOp ```typescript /** * Test crypto worker. */ export type TestCryptoOp = { op: WalletApiOperation.TestCrypto; request: EmptyObject; response: any; }; // TestCrypto = "testCrypto" ``` ### WithdrawTestBalanceOp ```typescript /** * Make withdrawal on a test deployment of the exchange * and merchant. */ export type WithdrawTestBalanceOp = { op: WalletApiOperation.WithdrawTestBalance; request: WithdrawTestBalanceRequest; response: EmptyObject; }; // WithdrawTestBalance = "withdrawTestBalance" ``` ```typescript export interface WithdrawTestBalanceRequest { amount: string; bankBaseUrl: string; /** * Bank access API base URL. Defaults to the bankBaseUrl. */ bankAccessApiBaseUrl?: string; exchangeBaseUrl: string; forcedDenomSel?: ForcedDenomSel; } ``` ### WithdrawTestkudosOp ```typescript /** * Make a withdrawal of testkudos on test.taler.net. */ export type WithdrawTestkudosOp = { op: WalletApiOperation.WithdrawTestkudos; request: EmptyObject; response: EmptyObject; }; // WithdrawTestkudos = "withdrawTestkudos" ``` ### TestPayOp ```typescript /** * Make a test payment using a test deployment of * the exchange and merchant. */ export type TestPayOp = { op: WalletApiOperation.TestPay; request: TestPayArgs; response: TestPayResult; }; // TestPay = "testPay" ``` ```typescript export interface TestPayArgs { merchantBaseUrl: string; merchantAuthToken?: string; amount: string; summary: string; forcedCoinSel?: ForcedCoinSel; } ``` ```typescript export interface TestPayResult { payCoinSelection: PayCoinSelection; } ``` ```typescript /** * Result of selecting coins, contains the exchange, and selected * coins with their denomination. */ export interface PayCoinSelection { /** * Amount requested by the merchant. */ paymentAmount: AmountString; /** * Public keys of the coins that were selected. */ coinPubs: string[]; /** * Amount that each coin contributes. */ coinContributions: AmountString[]; /** * How much of the wire fees is the customer paying? */ customerWireFees: AmountString; /** * How much of the deposit fees is the customer paying? */ customerDepositFees: AmountString; } ``` ### WithdrawFakebankOp ```typescript /** * Make a withdrawal from a fakebank, i.e. * a bank where test users can be registered freely * and testing APIs are available. */ export type WithdrawFakebankOp = { op: WalletApiOperation.WithdrawFakebank; request: WithdrawFakebankRequest; response: EmptyObject; }; // WithdrawFakebank = "withdrawFakebank" ``` ```typescript export interface WithdrawFakebankRequest { amount: AmountString; exchange: string; bank: string; } ``` ### GetPendingTasksOp ```typescript /** * Get wallet-internal pending tasks. */ export type GetPendingTasksOp = { op: WalletApiOperation.GetPendingOperations; request: EmptyObject; response: PendingTasksResponse; }; // GetPendingOperations = "getPendingOperations" ``` ```typescript /** * Response returned from the pending operations API. */ export interface PendingOperationsResponse { /** * List of pending operations. */ pendingOperations: PendingTaskInfo[]; } ``` ```typescript /** * Information about a pending operation. */ export type PendingTaskInfo = PendingTaskInfoCommon & ( | PendingExchangeUpdateTask | PendingExchangeCheckRefreshTask | PendingPurchaseTask | PendingRefreshTask | PendingTipPickupTask | PendingWithdrawTask | PendingRecoupTask | PendingDepositTask | PendingBackupTask ); ``` ```typescript /** * Fields that are present in every pending operation. */ export interface PendingTaskInfoCommon { /** * Type of the pending operation. */ type: PendingTaskType; /** * Unique identifier for the pending task. */ id: string; /** * Set to true if the operation indicates that something is really in progress, * as opposed to some regular scheduled operation that can be tried later. */ 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; /** * Retry info. Currently used to stop the wallet after any operation * exceeds a number of retries. */ retryInfo?: RetryInfo; } ``` ```typescript export enum PendingTaskType { ExchangeUpdate = "exchange-update", ExchangeCheckRefresh = "exchange-check-refresh", Purchase = "purchase", Refresh = "refresh", Recoup = "recoup", TipPickup = "tip-pickup", Withdraw = "withdraw", Deposit = "deposit", Backup = "backup", } ``` ```typescript export interface RetryInfo { firstTry: AbsoluteTime; nextRetry: AbsoluteTime; retryCounter: number; } ``` ```typescript export interface RetryPolicy { readonly backoffDelta: Duration; readonly backoffBase: number; readonly maxTimeout: Duration; } ``` ```typescript // Declare "static" methods in Error interface ErrorConstructor { /** Create .stack property on a target object */ captureStackTrace(targetObject: object, constructorOpt?: Function): void; /** * Optional override for formatting stack traces * * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces */ prepareStackTrace?: | ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; stackTraceLimit: number; } ``` ```typescript interface CallSite { /** * Value of "this" */ getThis(): unknown; /** * Type of "this" as a string. * This is the name of the function stored in the constructor field of * "this", if available. Otherwise the object's [[Class]] internal * property. */ getTypeName(): string | null; /** * Current function */ getFunction(): Function | undefined; /** * Name of the current function, typically its name property. * If a name property is not available an attempt will be made to try * to infer a name from the function's context. */ getFunctionName(): string | null; /** * Name of the property [of "this" or one of its prototypes] that holds * the current function */ getMethodName(): string | null; /** * Name of the script [if this function was defined in a script] */ getFileName(): string | null; /** * Current line number [if this function was defined in a script] */ getLineNumber(): number | null; /** * Current column number [if this function was defined in a script] */ getColumnNumber(): number | null; /** * A call site object representing the location where eval was called * [if this function was created using a call to eval] */ getEvalOrigin(): string | undefined; /** * Is this a toplevel invocation, that is, is "this" the global object? */ isToplevel(): boolean; /** * Does this call take place in code defined by a call to eval? */ isEval(): boolean; /** * Is this call in native V8 code? */ isNative(): boolean; /** * Is this a constructor call? */ isConstructor(): boolean; } ``` ```typescript /** * The wallet is currently updating information about an exchange. */ export interface PendingExchangeUpdateTask { type: PendingTaskType.ExchangeUpdate; exchangeBaseUrl: string; lastError: TalerErrorDetail | undefined; } ``` ```typescript /** * The wallet should check whether coins from this exchange * need to be auto-refreshed. */ export interface PendingExchangeCheckRefreshTask { type: PendingTaskType.ExchangeCheckRefresh; exchangeBaseUrl: string; } ``` ```typescript /** * A purchase needs to be processed (i.e. for download / payment / refund). */ export interface PendingPurchaseTask { type: PendingTaskType.Purchase; proposalId: string; retryInfo?: RetryInfo; /** * Status of the payment as string, used only for debugging. */ statusStr: string; lastError: TalerErrorDetail | undefined; } ``` ```typescript /** * Status of an ongoing withdrawal operation. */ export interface PendingRefreshTask { type: PendingTaskType.Refresh; lastError?: TalerErrorDetail; refreshGroupId: string; finishedPerCoin: boolean[]; retryInfo?: RetryInfo; } ``` ```typescript /** * The wallet is picking up a tip that the user has accepted. */ export interface PendingTipPickupTask { type: PendingTaskType.TipPickup; tipId: string; merchantBaseUrl: string; merchantTipId: string; } ``` ```typescript /** * Status of an ongoing withdrawal operation. */ export interface PendingWithdrawTask { type: PendingTaskType.Withdraw; lastError: TalerErrorDetail | undefined; retryInfo?: RetryInfo; withdrawalGroupId: string; } ``` ```typescript export interface PendingRecoupTask { type: PendingTaskType.Recoup; recoupGroupId: string; retryInfo?: RetryInfo; lastError: TalerErrorDetail | undefined; } ``` ```typescript /** * Status of an ongoing deposit operation. */ export interface PendingDepositTask { type: PendingTaskType.Deposit; lastError: TalerErrorDetail | undefined; retryInfo: RetryInfo | undefined; depositGroupId: string; } ``` ```typescript export interface PendingBackupTask { type: PendingTaskType.Backup; backupProviderBaseUrl: string; lastError: TalerErrorDetail | undefined; } ``` ### DumpCoinsOp ```typescript /** * Dump all coins of the wallet in a simple JSON format. */ export type DumpCoinsOp = { op: WalletApiOperation.DumpCoins; request: EmptyObject; response: CoinDumpJson; }; // DumpCoins = "dumpCoins" ``` ```typescript /** * 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: DenominationPubKey; /** * 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; /** * 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; coin_status: CoinStatus; spend_allocation: | { id: string; amount: string; } | undefined; /** * Information about the age restriction */ ageCommitmentProof: AgeCommitmentProof | undefined; }>; } ``` ```typescript export declare type DenominationPubKey = | RsaDenominationPubKey | CsDenominationPubKey; ``` ```typescript export interface RsaDenominationPubKey { readonly cipher: DenomKeyType.Rsa; readonly rsa_public_key: string; readonly age_mask: number; } ``` ```typescript export interface CsDenominationPubKey { readonly cipher: DenomKeyType.ClauseSchnorr; readonly age_mask: number; readonly cs_public_key: string; } ``` ```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; } ``` ```typescript export interface AgeCommitment { mask: number; /** * Public keys, one for each age group specified in the age mask. */ publicKeys: Edx25519PublicKeyEnc[]; } ``` ```typescript export declare type Edx25519PublicKeyEnc = FlavorP< string, "Edx25519PublicKeyEnc", 32 >; ``` ```typescript export declare type FlavorP = T & { _flavor?: `taler.${FlavorT}`; _size?: S; }; ``` ```typescript export interface AgeProof { /** * Private keys. Typically smaller than the number of public keys, * because we drop private keys from age groups that are restricted. */ privateKeys: Edx25519PrivateKeyEnc[]; } ``` ```typescript export declare type Edx25519PrivateKeyEnc = FlavorP< string, "Edx25519PrivateKeyEnc", 64 >; ``` ### SetCoinSuspendedOp ```typescript /** * Set a coin as (un-)suspended. * Suspended coins won't be used for payments. */ export type SetCoinSuspendedOp = { op: WalletApiOperation.SetCoinSuspended; request: SetCoinSuspendedRequest; response: EmptyObject; }; // SetCoinSuspended = "setCoinSuspended" ``` ```typescript export interface SetCoinSuspendedRequest { coinPub: string; suspended: boolean; } ``` ### ForceRefreshOp ```typescript /** * Force a refresh on coins where it would not * be necessary. */ export type ForceRefreshOp = { op: WalletApiOperation.ForceRefresh; request: ForceRefreshRequest; response: EmptyObject; }; // ForceRefresh = "forceRefresh" ``` ```typescript export interface ForceRefreshRequest { coinPubList: string[]; } ``` ## 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"; } ``` ```typescript export interface TalerErrorDetail { code: TalerErrorCode; hint?: string; [x: string]: unknown; } ``` ```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 */ orderId: string; /** * Hash of the contract terms. */ contractTermsHash: string; /** * More information about the merchant */ merchant: MerchantInfo; /** * Summary of the order, given by the merchant */ summary: string; /** * Map from IETF BCP 47 language tags to localized summaries */ summary_i18n?: InternationalizedString; /** * List of products that are part of the order */ products: Product[] | undefined; /** * Time indicating when the order should be delivered. * May be overwritten by individual products. */ delivery_date?: TalerProtocolTimestamp; /** * Delivery location for (all!) products. */ delivery_location?: Location; /** * URL of the fulfillment, given by the merchant */ fulfillmentUrl?: string; /** * Plain text message that should be shown to the user * when the payment is complete. */ fulfillmentMessage?: string; /** * Translations of fulfillmentMessage. */ fulfillmentMessage_i18n?: InternationalizedString; } ``` ```typescript export interface MerchantInfo { name: string; jurisdiction?: Location; address?: Location; logo?: string; website?: string; email?: string; } ``` ```typescript export interface Location { country?: string; country_subdivision?: string; district?: string; town?: string; town_location?: string; post_code?: string; street?: string; building_name?: string; building_number?: string; address_lines?: string[]; } ``` ```typescript export interface InternationalizedString { [lang_tag: string]: string; } ``` ```typescript export interface Product { product_id?: string; description: string; description_i18n?: { [lang_tag: string]: string; }; quantity?: number; unit?: string; price?: AmountString; image?: string; taxes?: Tax[]; delivery_date?: TalerProtocolTimestamp; } ``` ```typescript export interface Tax { name: string; tax: AmountString; } ``` ```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 | undefined; paytoUris: string[]; tosStatus: ExchangeTosStatus; exchangeStatus: ExchangeEntryStatus; ageRestrictionOptions: number[]; /** * Permanently added to the wallet, as opposed to just * temporarily queried. */ permanent: boolean; /** * Information about the last error that occured when trying * to update the exchange info. */ lastUpdateErrorInfo?: OperationErrorInfo; } ``` ```typescript 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 export interface OperationErrorInfo { error: TalerErrorDetail; } ``` ```typescript export interface ForcedDenomSel { denoms: { value: AmountString; count: number; }[]; } ``` ```typescript /** * Contract terms from a merchant. * FIXME: Add type field! */ export interface MerchantContractTerms { /** * Hash of the merchant's wire details. */ h_wire: string; /** * Hash of the merchant's wire details. */ auto_refund?: TalerProtocolDuration; /** * Wire method the merchant wants to use. */ wire_method: string; /** * Human-readable short summary of the contract. */ summary: string; summary_i18n?: InternationalizedString; /** * 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: TalerProtocolTimestamp; /** * Maximum deposit fee covered by the merchant. */ max_fee: string; /** * Information about the merchant. */ merchant: MerchantInfo; /** * Public key of the merchant. */ merchant_pub: string; /** * Time indicating when the order should be delivered. * May be overwritten by individual products. */ delivery_date?: TalerProtocolTimestamp; /** * Delivery location for (all!) products. */ delivery_location?: Location; /** * List of accepted exchanges. */ exchanges: ExchangeHandle[]; /** * Products that are sold in this contract. */ products?: Product[]; /** * Deadline for refunds. */ refund_deadline: TalerProtocolTimestamp; /** * Deadline for the wire transfer. */ wire_transfer_deadline: TalerProtocolTimestamp; /** * Time when the contract was generated by the merchant. */ timestamp: TalerProtocolTimestamp; /** * 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; /** * URL meant to share the shopping cart. */ public_reorder_url?: string; /** * Plain text fulfillment message in the merchant's default language. */ fulfillment_message?: string; /** * Internationalized fulfillment messages. */ fulfillment_message_i18n?: InternationalizedString; /** * 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; minimum_age?: number; /** * Extra data, interpreted by the mechant only. */ extra?: any; } ``` ```typescript export interface TalerProtocolDuration { readonly d_us: number | "forever"; } ``` ```typescript export interface AuditorHandle { /** * Official name of the auditor. */ name: string; /** * Master public signing key of the auditor. */ auditor_pub: string; /** * Base URL of the auditor. */ url: string; } ``` ```typescript /** * Information about an exchange as stored inside a * merchant's contract terms. */ export interface ExchangeHandle { /** * Master public signing key of the exchange. */ master_pub: string; /** * Base URL of the exchange. */ url: string; } ``` ```typescript /** * Forced coin selection for deposits/payments. */ export interface ForcedCoinSel { coins: { value: AmountString; contribution: AmountString; }[]; } ``` ```typescript 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 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: { name: string; url: string; }[]; } ```