/*
This file is part of GNU Taler
(C) 2021 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see
*/
/**
* Type declarations for the high-level interface to wallet-core.
*
* Documentation is auto-generated from this file.
*/
/**
* Imports.
*/
import {
AbortTransactionRequest,
AcceptBankIntegratedWithdrawalRequest,
AcceptExchangeTosRequest,
AcceptManualWithdrawalRequest,
AcceptManualWithdrawalResult,
AcceptRewardRequest,
AcceptTipResponse,
AcceptWithdrawalResponse,
AddExchangeRequest,
AddKnownBankAccountsRequest,
AmountResponse,
ApplyDevExperimentRequest,
BackupRecovery,
BalancesResponse,
FailTransactionRequest,
CheckPeerPullCreditRequest,
CheckPeerPullCreditResponse,
CheckPeerPushDebitRequest,
CheckPeerPushDebitResponse,
CoinDumpJson,
ConfirmPayRequest,
ConfirmPayResult,
ConfirmPeerPullDebitRequest,
ConfirmPeerPushCreditRequest,
ConvertAmountRequest,
CreateDepositGroupRequest,
CreateDepositGroupResponse,
DeleteTransactionRequest,
ExchangeDetailedResponse,
ExchangesListResponse,
ForceRefreshRequest,
ForgetKnownBankAccountsRequest,
GetAmountRequest,
GetBalanceDetailRequest,
GetContractTermsDetailsRequest,
GetExchangeTosRequest,
GetExchangeTosResult,
GetPlanForOperationRequest,
GetPlanForOperationResponse,
GetWithdrawalDetailsForAmountRequest,
GetWithdrawalDetailsForUriRequest,
InitRequest,
InitResponse,
InitiatePeerPullCreditRequest,
InitiatePeerPullCreditResponse,
InitiatePeerPushDebitRequest,
InitiatePeerPushDebitResponse,
IntegrationTestArgs,
KnownBankAccounts,
ListKnownBankAccountsRequest,
ManualWithdrawalDetails,
PrepareDepositRequest,
PrepareDepositResponse,
PreparePayRequest,
PreparePayResult,
PreparePayTemplateRequest,
PreparePeerPullDebitRequest,
PreparePeerPullDebitResponse,
PreparePeerPushCreditRequest,
PreparePeerPushCreditResponse,
PrepareRefundRequest,
PrepareRewardRequest as PrepareRewardRequest,
PrepareTipResult as PrepareRewardResult,
RecoveryLoadRequest,
RetryTransactionRequest,
SetCoinSuspendedRequest,
SetWalletDeviceIdRequest,
StartRefundQueryForUriResponse,
StartRefundQueryRequest,
TestPayArgs,
TestPayResult,
Transaction,
TransactionByIdRequest,
TransactionsRequest,
TransactionsResponse,
TxIdResponse,
UserAttentionByIdRequest,
UserAttentionsCountResponse,
UserAttentionsRequest,
UserAttentionsResponse,
ValidateIbanRequest,
ValidateIbanResponse,
WalletBackupContentV1,
WalletCoreVersion,
WalletCurrencyInfo,
WithdrawFakebankRequest,
WithdrawTestBalanceRequest,
WithdrawUriInfoResponse,
SharePaymentRequest,
SharePaymentResult,
} from "@gnu-taler/taler-util";
import { AuditorTrustRecord, WalletContractData } from "./db.js";
import {
AddBackupProviderRequest,
AddBackupProviderResponse,
BackupInfo,
RemoveBackupProviderRequest,
RunBackupCycleRequest,
} from "./operations/backup/index.js";
import { MerchantPaymentBalanceDetails } from "./operations/balance.js";
import { PendingOperationsResponse as PendingTasksResponse } from "./pending-types.js";
export enum WalletApiOperation {
InitWallet = "initWallet",
WithdrawTestkudos = "withdrawTestkudos",
WithdrawTestBalance = "withdrawTestBalance",
PreparePayForUri = "preparePayForUri",
SharePayment = "sharePayment",
PreparePayForTemplate = "preparePayForTemplate",
GetContractTermsDetails = "getContractTermsDetails",
RunIntegrationTest = "runIntegrationTest",
RunIntegrationTestV2 = "runIntegrationTestV2",
TestCrypto = "testCrypto",
TestPay = "testPay",
AddExchange = "addExchange",
GetTransactions = "getTransactions",
GetTransactionById = "getTransactionById",
TestingGetSampleTransactions = "testingGetSampleTransactions",
ListExchanges = "listExchanges",
ListKnownBankAccounts = "listKnownBankAccounts",
AddKnownBankAccounts = "addKnownBankAccounts",
ForgetKnownBankAccounts = "forgetKnownBankAccounts",
GetWithdrawalDetailsForUri = "getWithdrawalDetailsForUri",
GetWithdrawalDetailsForAmount = "getWithdrawalDetailsForAmount",
AcceptManualWithdrawal = "acceptManualWithdrawal",
GetBalances = "getBalances",
GetBalanceDetail = "getBalanceDetail",
GetPlanForOperation = "getPlanForOperation",
ConvertDepositAmount = "ConvertDepositAmount",
GetMaxDepositAmount = "GetMaxDepositAmount",
ConvertPeerPushAmount = "ConvertPeerPushAmount",
GetMaxPeerPushAmount = "GetMaxPeerPushAmount",
ConvertWithdrawalAmount = "ConvertWithdrawalAmount",
GetUserAttentionRequests = "getUserAttentionRequests",
GetUserAttentionUnreadCount = "getUserAttentionUnreadCount",
MarkAttentionRequestAsRead = "markAttentionRequestAsRead",
GetPendingOperations = "getPendingOperations",
SetExchangeTosAccepted = "setExchangeTosAccepted",
StartRefundQueryForUri = "startRefundQueryForUri",
StartRefundQuery = "startRefundQuery",
AcceptBankIntegratedWithdrawal = "acceptBankIntegratedWithdrawal",
GetExchangeTos = "getExchangeTos",
GetExchangeDetailedInfo = "getExchangeDetailedInfo",
RetryPendingNow = "retryPendingNow",
AbortTransaction = "abortTransaction",
FailTransaction = "failTransaction",
SuspendTransaction = "suspendTransaction",
ResumeTransaction = "resumeTransaction",
DeleteTransaction = "deleteTransaction",
RetryTransaction = "retryTransaction",
ConfirmPay = "confirmPay",
DumpCoins = "dumpCoins",
SetCoinSuspended = "setCoinSuspended",
ForceRefresh = "forceRefresh",
PrepareReward = "prepareReward",
AcceptReward = "acceptReward",
ExportBackup = "exportBackup",
AddBackupProvider = "addBackupProvider",
RemoveBackupProvider = "removeBackupProvider",
RunBackupCycle = "runBackupCycle",
ExportBackupRecovery = "exportBackupRecovery",
ImportBackupRecovery = "importBackupRecovery",
GetBackupInfo = "getBackupInfo",
PrepareDeposit = "prepareDeposit",
GetVersion = "getVersion",
ListCurrencies = "listCurrencies",
GenerateDepositGroupTxId = "generateDepositGroupTxId",
CreateDepositGroup = "createDepositGroup",
SetWalletDeviceId = "setWalletDeviceId",
ExportBackupPlain = "exportBackupPlain",
WithdrawFakebank = "withdrawFakebank",
ImportDb = "importDb",
ExportDb = "exportDb",
PreparePeerPushCredit = "preparePeerPushCredit",
CheckPeerPushDebit = "checkPeerPushDebit",
InitiatePeerPushDebit = "initiatePeerPushDebit",
ConfirmPeerPushCredit = "confirmPeerPushCredit",
CheckPeerPullCredit = "checkPeerPullCredit",
InitiatePeerPullCredit = "initiatePeerPullCredit",
PreparePeerPullDebit = "preparePeerPullDebit",
ConfirmPeerPullDebit = "confirmPeerPullDebit",
ClearDb = "clearDb",
Recycle = "recycle",
ApplyDevExperiment = "applyDevExperiment",
ValidateIban = "validateIban",
TestingWaitTransactionsFinal = "testingWaitTransactionsFinal",
}
// group: Initialization
type EmptyObject = Record;
/**
* Initialize wallet-core.
*
* Must be the request before any other operations.
*/
export type InitWalletOp = {
op: WalletApiOperation.InitWallet;
request: InitRequest;
response: InitResponse;
};
export type GetVersionOp = {
op: WalletApiOperation.GetVersion;
request: EmptyObject;
response: WalletCoreVersion;
};
/**
* Configurations options for the Wallet
*
* All missing values of the config will be replaced with default values
* Default values are defined by Wallet.getDefaultConfig()
*/
export type WalletConfigParameter = RecursivePartial;
export interface WalletConfig {
/**
* Initialization values useful for a complete startup.
*
* These are values may be overridden by different wallets
*/
builtin: {
exchanges: string[];
auditors: AuditorTrustRecord[];
};
/**
* Unsafe options which it should only be used to create
* testing environment.
*/
testing: {
/**
* Allow withdrawal of denominations even though they are about to expire.
*/
denomselAllowLate: boolean;
devModeActive: boolean;
insecureTrustExchange: boolean;
preventThrottling: boolean;
};
/**
* Configurations values that may be safe to show to the user
*/
features: {
batchWithdrawal: boolean;
allowHttp: boolean;
};
}
// group: Basic Wallet Information
/**
* Get current wallet balance.
*/
export type GetBalancesOp = {
op: WalletApiOperation.GetBalances;
request: EmptyObject;
response: BalancesResponse;
};
export type GetBalancesDetailOp = {
op: WalletApiOperation.GetBalanceDetail;
request: GetBalanceDetailRequest;
response: MerchantPaymentBalanceDetails;
};
export type GetPlanForOperationOp = {
op: WalletApiOperation.GetPlanForOperation;
request: GetPlanForOperationRequest;
response: GetPlanForOperationResponse;
};
export type ConvertDepositAmountOp = {
op: WalletApiOperation.ConvertDepositAmount;
request: ConvertAmountRequest;
response: AmountResponse;
};
export type GetMaxDepositAmountOp = {
op: WalletApiOperation.GetMaxDepositAmount;
request: GetAmountRequest;
response: AmountResponse;
};
export type ConvertPeerPushAmountOp = {
op: WalletApiOperation.ConvertPeerPushAmount;
request: ConvertAmountRequest;
response: AmountResponse;
};
export type GetMaxPeerPushAmountOp = {
op: WalletApiOperation.GetMaxPeerPushAmount;
request: GetAmountRequest;
response: AmountResponse;
};
export type ConvertWithdrawalAmountOp = {
op: WalletApiOperation.ConvertWithdrawalAmount;
request: ConvertAmountRequest;
response: AmountResponse;
};
// group: Managing Transactions
/**
* Get transactions.
*/
export type GetTransactionsOp = {
op: WalletApiOperation.GetTransactions;
request: TransactionsRequest;
response: TransactionsResponse;
};
/**
* Get sample transactions.
*/
export type TestingGetSampleTransactionsOp = {
op: WalletApiOperation.TestingGetSampleTransactions;
request: EmptyObject;
response: TransactionsResponse;
};
export type GetTransactionByIdOp = {
op: WalletApiOperation.GetTransactionById;
request: TransactionByIdRequest;
response: Transaction;
};
export type RetryPendingNowOp = {
op: WalletApiOperation.RetryPendingNow;
request: EmptyObject;
response: EmptyObject;
};
/**
* Delete a transaction locally in the wallet.
*/
export type DeleteTransactionOp = {
op: WalletApiOperation.DeleteTransaction;
request: DeleteTransactionRequest;
response: EmptyObject;
};
/**
* Immediately retry a transaction.
*/
export type RetryTransactionOp = {
op: WalletApiOperation.RetryTransaction;
request: RetryTransactionRequest;
response: EmptyObject;
};
/**
* Abort a transaction
*
* For payment transactions, it puts the payment into an "aborting" state.
*/
export type AbortTransactionOp = {
op: WalletApiOperation.AbortTransaction;
request: AbortTransactionRequest;
response: EmptyObject;
};
/**
* Cancel aborting a transaction
*
* For payment transactions, it puts the payment into an "aborting" state.
*/
export type FailTransactionOp = {
op: WalletApiOperation.FailTransaction;
request: FailTransactionRequest;
response: EmptyObject;
};
/**
* Suspend a transaction
*/
export type SuspendTransactionOp = {
op: WalletApiOperation.SuspendTransaction;
request: AbortTransactionRequest;
response: EmptyObject;
};
/**
* Resume a transaction
*/
export type ResumeTransactionOp = {
op: WalletApiOperation.ResumeTransaction;
request: AbortTransactionRequest;
response: EmptyObject;
};
// group: Withdrawals
/**
* Get details for withdrawing a particular amount (manual withdrawal).
*/
export type GetWithdrawalDetailsForAmountOp = {
op: WalletApiOperation.GetWithdrawalDetailsForAmount;
request: GetWithdrawalDetailsForAmountRequest;
response: ManualWithdrawalDetails;
};
/**
* Get details for withdrawing via a particular taler:// URI.
*/
export type GetWithdrawalDetailsForUriOp = {
op: WalletApiOperation.GetWithdrawalDetailsForUri;
request: GetWithdrawalDetailsForUriRequest;
response: WithdrawUriInfoResponse;
};
/**
* Accept a bank-integrated withdrawal.
*/
export type AcceptBankIntegratedWithdrawalOp = {
op: WalletApiOperation.AcceptBankIntegratedWithdrawal;
request: AcceptBankIntegratedWithdrawalRequest;
response: AcceptWithdrawalResponse;
};
/**
* Create a manual withdrawal.
*/
export type AcceptManualWithdrawalOp = {
op: WalletApiOperation.AcceptManualWithdrawal;
request: AcceptManualWithdrawalRequest;
response: AcceptManualWithdrawalResult;
};
// group: Merchant Payments
/**
* Prepare to make a payment based on a taler://pay/ URI.
*/
export type PreparePayForUriOp = {
op: WalletApiOperation.PreparePayForUri;
request: PreparePayRequest;
response: PreparePayResult;
};
export type SharePaymentOp = {
op: WalletApiOperation.SharePayment;
request: SharePaymentRequest;
response: SharePaymentResult;
};
/**
* Prepare to make a payment based on a taler://pay-template/ URI.
*/
export type PreparePayForTemplateOp = {
op: WalletApiOperation.PreparePayForTemplate;
request: PreparePayTemplateRequest;
response: PreparePayResult;
};
export type GetContractTermsDetailsOp = {
op: WalletApiOperation.GetContractTermsDetails;
request: GetContractTermsDetailsRequest;
response: WalletContractData;
};
/**
* Confirm a payment that was previously prepared with
* {@link PreparePayForUriOp}
*/
export type ConfirmPayOp = {
op: WalletApiOperation.ConfirmPay;
request: ConfirmPayRequest;
response: ConfirmPayResult;
};
/**
* Check for a refund based on a taler://refund URI.
*/
export type StartRefundQueryForUriOp = {
op: WalletApiOperation.StartRefundQueryForUri;
request: PrepareRefundRequest;
response: StartRefundQueryForUriResponse;
};
export type StartRefundQueryOp = {
op: WalletApiOperation.StartRefundQuery;
request: StartRefundQueryRequest;
response: EmptyObject;
};
// group: Rewards
/**
* Query and store information about a reward.
*/
export type PrepareTipOp = {
op: WalletApiOperation.PrepareReward;
request: PrepareRewardRequest;
response: PrepareRewardResult;
};
/**
* Accept a reward.
*/
export type AcceptTipOp = {
op: WalletApiOperation.AcceptReward;
request: AcceptRewardRequest;
response: AcceptTipResponse;
};
// group: Exchange Management
/**
* List exchanges known to the wallet.
*/
export type ListExchangesOp = {
op: WalletApiOperation.ListExchanges;
request: EmptyObject;
response: ExchangesListResponse;
};
/**
* Add / force-update an exchange.
*/
export type AddExchangeOp = {
op: WalletApiOperation.AddExchange;
request: AddExchangeRequest;
response: EmptyObject;
};
export type ListKnownBankAccountsOp = {
op: WalletApiOperation.ListKnownBankAccounts;
request: ListKnownBankAccountsRequest;
response: KnownBankAccounts;
};
export type AddKnownBankAccountsOp = {
op: WalletApiOperation.AddKnownBankAccounts;
request: AddKnownBankAccountsRequest;
response: EmptyObject;
};
export type ForgetKnownBankAccountsOp = {
op: WalletApiOperation.ForgetKnownBankAccounts;
request: ForgetKnownBankAccountsRequest;
response: EmptyObject;
};
/**
* Accept a particular version of the exchange terms of service.
*/
export type SetExchangeTosAcceptedOp = {
op: WalletApiOperation.SetExchangeTosAccepted;
request: AcceptExchangeTosRequest;
response: EmptyObject;
};
/**
* Get the current terms of a service of an exchange.
*/
export type GetExchangeTosOp = {
op: WalletApiOperation.GetExchangeTos;
request: GetExchangeTosRequest;
response: GetExchangeTosResult;
};
/**
* Get the current terms of a service of an exchange.
*/
export type GetExchangeDetailedInfoOp = {
op: WalletApiOperation.GetExchangeDetailedInfo;
request: AddExchangeRequest;
response: ExchangeDetailedResponse;
};
/**
* List currencies known to the wallet.
*/
export type ListCurrenciesOp = {
op: WalletApiOperation.ListCurrencies;
request: EmptyObject;
response: WalletCurrencyInfo;
};
// group: Deposits
/**
* Generate a fresh transaction ID for a deposit group.
*
* The resulting transaction ID can be specified when creating
* a deposit group, so that the client can already start waiting for notifications
* on that specific deposit group before the GreateDepositGroup request returns.
*/
export type GenerateDepositGroupTxIdOp = {
op: WalletApiOperation.GenerateDepositGroupTxId;
request: EmptyObject;
response: TxIdResponse;
};
/**
* 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;
};
export type PrepareDepositOp = {
op: WalletApiOperation.PrepareDeposit;
request: PrepareDepositRequest;
response: PrepareDepositResponse;
};
// group: Backups
/**
* Export the recovery information for the wallet.
*/
export type ExportBackupRecoveryOp = {
op: WalletApiOperation.ExportBackupRecovery;
request: EmptyObject;
response: BackupRecovery;
};
/**
* Import recovery information into the wallet.
*/
export type ImportBackupRecoveryOp = {
op: WalletApiOperation.ImportBackupRecovery;
request: RecoveryLoadRequest;
response: EmptyObject;
};
/**
* Manually make and upload a backup.
*/
export type RunBackupCycleOp = {
op: WalletApiOperation.RunBackupCycle;
request: RunBackupCycleRequest;
response: EmptyObject;
};
export type ExportBackupOp = {
op: WalletApiOperation.ExportBackup;
request: EmptyObject;
response: EmptyObject;
};
/**
* Add a new backup provider.
*/
export type AddBackupProviderOp = {
op: WalletApiOperation.AddBackupProvider;
request: AddBackupProviderRequest;
response: AddBackupProviderResponse;
};
export type RemoveBackupProviderOp = {
op: WalletApiOperation.RemoveBackupProvider;
request: RemoveBackupProviderRequest;
response: EmptyObject;
};
/**
* Get some useful stats about the backup state.
*/
export type GetBackupInfoOp = {
op: WalletApiOperation.GetBackupInfo;
request: EmptyObject;
response: BackupInfo;
};
/**
* 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;
};
/**
* Export a backup JSON, mostly useful for testing.
*/
export type ExportBackupPlainOp = {
op: WalletApiOperation.ExportBackupPlain;
request: EmptyObject;
response: WalletBackupContentV1;
};
// group: Peer Payments
/**
* 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;
};
/**
* Initiate an outgoing peer push payment.
*/
export type InitiatePeerPushDebitOp = {
op: WalletApiOperation.InitiatePeerPushDebit;
request: InitiatePeerPushDebitRequest;
response: InitiatePeerPushDebitResponse;
};
/**
* Check an incoming peer push payment.
*/
export type PreparePeerPushCreditOp = {
op: WalletApiOperation.PreparePeerPushCredit;
request: PreparePeerPushCreditRequest;
response: PreparePeerPushCreditResponse;
};
/**
* Accept an incoming peer push payment.
*/
export type ConfirmPeerPushCreditOp = {
op: WalletApiOperation.ConfirmPeerPushCredit;
request: ConfirmPeerPushCreditRequest;
response: EmptyObject;
};
/**
* Check fees for an outgoing peer pull payment.
*/
export type CheckPeerPullCreditOp = {
op: WalletApiOperation.CheckPeerPullCredit;
request: CheckPeerPullCreditRequest;
response: CheckPeerPullCreditResponse;
};
/**
* Initiate an outgoing peer pull payment.
*/
export type InitiatePeerPullCreditOp = {
op: WalletApiOperation.InitiatePeerPullCredit;
request: InitiatePeerPullCreditRequest;
response: InitiatePeerPullCreditResponse;
};
/**
* Prepare for an incoming peer pull payment.
*/
export type PreparePeerPullDebitOp = {
op: WalletApiOperation.PreparePeerPullDebit;
request: PreparePeerPullDebitRequest;
response: PreparePeerPullDebitResponse;
};
/**
* Accept an incoming peer pull payment (i.e. pay the other party).
*/
export type ConfirmPeerPullDebitOp = {
op: WalletApiOperation.ConfirmPeerPullDebit;
request: ConfirmPeerPullDebitRequest;
response: EmptyObject;
};
// group: Data Validation
export type ValidateIbanOp = {
op: WalletApiOperation.ValidateIban;
request: ValidateIbanRequest;
response: ValidateIbanResponse;
};
// group: Database Management
/**
* Export the wallet database's contents to JSON.
*/
export type ExportDbOp = {
op: WalletApiOperation.ExportDb;
request: EmptyObject;
response: any;
};
export type ImportDbOp = {
op: WalletApiOperation.ImportDb;
request: any;
response: any;
};
/**
* Dangerously clear the whole wallet database.
*/
export type ClearDbOp = {
op: WalletApiOperation.ClearDb;
request: EmptyObject;
response: EmptyObject;
};
/**
* Export a backup, clear the database and re-import it.
*/
export type RecycleOp = {
op: WalletApiOperation.Recycle;
request: EmptyObject;
response: EmptyObject;
};
// group: Testing and Debugging
/**
* 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;
};
/**
* Run a simple integration test on a test deployment
* of the exchange and merchant.
*/
export type RunIntegrationTestOp = {
op: WalletApiOperation.RunIntegrationTest;
request: IntegrationTestArgs;
response: EmptyObject;
};
/**
* Run a simple integration test on a test deployment
* of the exchange and merchant.
*/
export type RunIntegrationTestV2Op = {
op: WalletApiOperation.RunIntegrationTestV2;
request: IntegrationTestArgs;
response: EmptyObject;
};
/**
* Test crypto worker.
*/
export type TestCryptoOp = {
op: WalletApiOperation.TestCrypto;
request: EmptyObject;
response: any;
};
/**
* Make withdrawal on a test deployment of the exchange
* and merchant.
*/
export type WithdrawTestBalanceOp = {
op: WalletApiOperation.WithdrawTestBalance;
request: WithdrawTestBalanceRequest;
response: EmptyObject;
};
/**
* Make a withdrawal of testkudos on test.taler.net.
*/
export type WithdrawTestkudosOp = {
op: WalletApiOperation.WithdrawTestkudos;
request: EmptyObject;
response: EmptyObject;
};
/**
* Make a test payment using a test deployment of
* the exchange and merchant.
*/
export type TestPayOp = {
op: WalletApiOperation.TestPay;
request: TestPayArgs;
response: TestPayResult;
};
/**
* 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;
};
/**
* Get wallet-internal pending tasks.
*/
export type GetUserAttentionRequests = {
op: WalletApiOperation.GetUserAttentionRequests;
request: UserAttentionsRequest;
response: UserAttentionsResponse;
};
/**
* Get wallet-internal pending tasks.
*/
export type MarkAttentionRequestAsRead = {
op: WalletApiOperation.MarkAttentionRequestAsRead;
request: UserAttentionByIdRequest;
response: EmptyObject;
};
/**
* Get wallet-internal pending tasks.
*/
export type GetUserAttentionsUnreadCount = {
op: WalletApiOperation.GetUserAttentionUnreadCount;
request: UserAttentionsRequest;
response: UserAttentionsCountResponse;
};
/**
* Get wallet-internal pending tasks.
*/
export type GetPendingTasksOp = {
op: WalletApiOperation.GetPendingOperations;
request: EmptyObject;
response: PendingTasksResponse;
};
/**
* Dump all coins of the wallet in a simple JSON format.
*/
export type DumpCoinsOp = {
op: WalletApiOperation.DumpCoins;
request: EmptyObject;
response: CoinDumpJson;
};
/**
* Wait until all transactions are in a final state.
*/
export type TestingWaitTransactionsFinal = {
op: WalletApiOperation.TestingWaitTransactionsFinal;
request: EmptyObject;
response: EmptyObject;
};
/**
* Set a coin as (un-)suspended.
* Suspended coins won't be used for payments.
*/
export type SetCoinSuspendedOp = {
op: WalletApiOperation.SetCoinSuspended;
request: SetCoinSuspendedRequest;
response: EmptyObject;
};
/**
* Force a refresh on coins where it would not
* be necessary.
*/
export type ForceRefreshOp = {
op: WalletApiOperation.ForceRefresh;
request: ForceRefreshRequest;
response: EmptyObject;
};
export type WalletOperations = {
[WalletApiOperation.InitWallet]: InitWalletOp;
[WalletApiOperation.GetVersion]: GetVersionOp;
[WalletApiOperation.WithdrawFakebank]: WithdrawFakebankOp;
[WalletApiOperation.PreparePayForUri]: PreparePayForUriOp;
[WalletApiOperation.SharePayment]: SharePaymentOp;
[WalletApiOperation.PreparePayForTemplate]: PreparePayForTemplateOp;
[WalletApiOperation.GetContractTermsDetails]: GetContractTermsDetailsOp;
[WalletApiOperation.WithdrawTestkudos]: WithdrawTestkudosOp;
[WalletApiOperation.ConfirmPay]: ConfirmPayOp;
[WalletApiOperation.AbortTransaction]: AbortTransactionOp;
[WalletApiOperation.FailTransaction]: FailTransactionOp;
[WalletApiOperation.SuspendTransaction]: SuspendTransactionOp;
[WalletApiOperation.ResumeTransaction]: ResumeTransactionOp;
[WalletApiOperation.GetBalances]: GetBalancesOp;
[WalletApiOperation.ConvertDepositAmount]: ConvertDepositAmountOp;
[WalletApiOperation.GetMaxDepositAmount]: GetMaxDepositAmountOp;
[WalletApiOperation.ConvertPeerPushAmount]: ConvertPeerPushAmountOp;
[WalletApiOperation.GetMaxPeerPushAmount]: GetMaxPeerPushAmountOp;
[WalletApiOperation.ConvertWithdrawalAmount]: ConvertWithdrawalAmountOp;
[WalletApiOperation.GetPlanForOperation]: GetPlanForOperationOp;
[WalletApiOperation.GetBalanceDetail]: GetBalancesDetailOp;
[WalletApiOperation.GetTransactions]: GetTransactionsOp;
[WalletApiOperation.TestingGetSampleTransactions]: TestingGetSampleTransactionsOp;
[WalletApiOperation.GetTransactionById]: GetTransactionByIdOp;
[WalletApiOperation.RetryPendingNow]: RetryPendingNowOp;
[WalletApiOperation.GetPendingOperations]: GetPendingTasksOp;
[WalletApiOperation.GetUserAttentionRequests]: GetUserAttentionRequests;
[WalletApiOperation.GetUserAttentionUnreadCount]: GetUserAttentionsUnreadCount;
[WalletApiOperation.MarkAttentionRequestAsRead]: MarkAttentionRequestAsRead;
[WalletApiOperation.DumpCoins]: DumpCoinsOp;
[WalletApiOperation.SetCoinSuspended]: SetCoinSuspendedOp;
[WalletApiOperation.ForceRefresh]: ForceRefreshOp;
[WalletApiOperation.DeleteTransaction]: DeleteTransactionOp;
[WalletApiOperation.RetryTransaction]: RetryTransactionOp;
[WalletApiOperation.PrepareReward]: PrepareTipOp;
[WalletApiOperation.AcceptReward]: AcceptTipOp;
[WalletApiOperation.StartRefundQueryForUri]: StartRefundQueryForUriOp;
[WalletApiOperation.StartRefundQuery]: StartRefundQueryOp;
[WalletApiOperation.ListCurrencies]: ListCurrenciesOp;
[WalletApiOperation.GetWithdrawalDetailsForAmount]: GetWithdrawalDetailsForAmountOp;
[WalletApiOperation.GetWithdrawalDetailsForUri]: GetWithdrawalDetailsForUriOp;
[WalletApiOperation.AcceptBankIntegratedWithdrawal]: AcceptBankIntegratedWithdrawalOp;
[WalletApiOperation.AcceptManualWithdrawal]: AcceptManualWithdrawalOp;
[WalletApiOperation.ListExchanges]: ListExchangesOp;
[WalletApiOperation.AddExchange]: AddExchangeOp;
[WalletApiOperation.ListKnownBankAccounts]: ListKnownBankAccountsOp;
[WalletApiOperation.AddKnownBankAccounts]: AddKnownBankAccountsOp;
[WalletApiOperation.ForgetKnownBankAccounts]: ForgetKnownBankAccountsOp;
[WalletApiOperation.SetExchangeTosAccepted]: SetExchangeTosAcceptedOp;
[WalletApiOperation.GetExchangeTos]: GetExchangeTosOp;
[WalletApiOperation.GetExchangeDetailedInfo]: GetExchangeDetailedInfoOp;
[WalletApiOperation.PrepareDeposit]: PrepareDepositOp;
[WalletApiOperation.GenerateDepositGroupTxId]: GenerateDepositGroupTxIdOp;
[WalletApiOperation.CreateDepositGroup]: CreateDepositGroupOp;
[WalletApiOperation.SetWalletDeviceId]: SetWalletDeviceIdOp;
[WalletApiOperation.ExportBackupPlain]: ExportBackupPlainOp;
[WalletApiOperation.ExportBackupRecovery]: ExportBackupRecoveryOp;
[WalletApiOperation.ImportBackupRecovery]: ImportBackupRecoveryOp;
[WalletApiOperation.RunBackupCycle]: RunBackupCycleOp;
[WalletApiOperation.ExportBackup]: ExportBackupOp;
[WalletApiOperation.AddBackupProvider]: AddBackupProviderOp;
[WalletApiOperation.RemoveBackupProvider]: RemoveBackupProviderOp;
[WalletApiOperation.GetBackupInfo]: GetBackupInfoOp;
[WalletApiOperation.RunIntegrationTest]: RunIntegrationTestOp;
[WalletApiOperation.RunIntegrationTestV2]: RunIntegrationTestV2Op;
[WalletApiOperation.TestCrypto]: TestCryptoOp;
[WalletApiOperation.WithdrawTestBalance]: WithdrawTestBalanceOp;
[WalletApiOperation.TestPay]: TestPayOp;
[WalletApiOperation.ExportDb]: ExportDbOp;
[WalletApiOperation.ImportDb]: ImportDbOp;
[WalletApiOperation.CheckPeerPushDebit]: CheckPeerPushDebitOp;
[WalletApiOperation.InitiatePeerPushDebit]: InitiatePeerPushDebitOp;
[WalletApiOperation.PreparePeerPushCredit]: PreparePeerPushCreditOp;
[WalletApiOperation.ConfirmPeerPushCredit]: ConfirmPeerPushCreditOp;
[WalletApiOperation.CheckPeerPullCredit]: CheckPeerPullCreditOp;
[WalletApiOperation.InitiatePeerPullCredit]: InitiatePeerPullCreditOp;
[WalletApiOperation.PreparePeerPullDebit]: PreparePeerPullDebitOp;
[WalletApiOperation.ConfirmPeerPullDebit]: ConfirmPeerPullDebitOp;
[WalletApiOperation.ClearDb]: ClearDbOp;
[WalletApiOperation.Recycle]: RecycleOp;
[WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp;
[WalletApiOperation.ValidateIban]: ValidateIbanOp;
[WalletApiOperation.TestingWaitTransactionsFinal]: TestingWaitTransactionsFinal;
};
export type WalletCoreRequestType<
Op extends WalletApiOperation & keyof WalletOperations,
> = WalletOperations[Op] extends { request: infer T } ? T : never;
export type WalletCoreResponseType<
Op extends WalletApiOperation & keyof WalletOperations,
> = WalletOperations[Op] extends { response: infer T } ? T : never;
export type WalletCoreOpKeys = WalletApiOperation & keyof WalletOperations;
export interface WalletCoreApiClient {
call(
operation: Op,
payload: WalletCoreRequestType,
): Promise>;
}
type Primitives = string | number | boolean;
type RecursivePartial = {
[P in keyof T]?: T[P] extends Array
? Array>
: T[P] extends Array
? Array
: T[P] extends object
? RecursivePartial
: T[P];
} & object;