wallet-core: better API docs

This commit is contained in:
Florian Dold 2022-10-04 15:30:18 +02:00
parent 37d27ba437
commit 3cecb7e4b4
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -16,6 +16,8 @@
/** /**
* Type declarations for the high-level interface to wallet-core. * Type declarations for the high-level interface to wallet-core.
*
* Documentation is auto-generated from this file.
*/ */
/** /**
@ -82,7 +84,7 @@ import {
AddBackupProviderRequest, AddBackupProviderRequest,
BackupInfo, BackupInfo,
} from "./operations/backup/index.js"; } from "./operations/backup/index.js";
import { PendingOperationsResponse } from "./pending-types.js"; import { PendingOperationsResponse as PendingTasksResponse } from "./pending-types.js";
export enum WalletApiOperation { export enum WalletApiOperation {
InitWallet = "initWallet", InitWallet = "initWallet",
@ -138,10 +140,12 @@ export enum WalletApiOperation {
Recycle = "recycle", Recycle = "recycle",
} }
// group: Initialization
/** /**
* Initialize wallet-core. * Initialize wallet-core.
* *
* Must be the first message sent before any other operations. * Must be the request before any other operations.
*/ */
export type InitWalletOp = { export type InitWalletOp = {
op: WalletApiOperation.InitWallet; op: WalletApiOperation.InitWallet;
@ -149,240 +153,413 @@ export type InitWalletOp = {
response: {}; response: {};
}; };
export type WithdrawFakebankOp = { // group: Basic Wallet Information
op: WalletApiOperation.WithdrawFakebank;
request: WithdrawFakebankRequest; /**
* Get current wallet balance.
*/
export type GetBalancesOp = {
request: {};
response: BalancesResponse;
};
// group: Managing Transactions
/**
* Get transactions.
*/
export type GetTransactionsOp = {
request: TransactionsRequest;
response: TransactionsResponse;
};
/**
* Delete a transaction locally in the wallet.
*/
export type DeleteTransactionOp = {
request: DeleteTransactionRequest;
response: {}; response: {};
}; };
/**
* Immediately retry a transaction.
*/
export type RetryTransactionOp = {
request: RetryTransactionRequest;
response: {};
};
// group: Withdrawals
/**
* Get details for withdrawing a particular amount (manual withdrawal).
*/
export type GetWithdrawalDetailsForAmountOp = {
request: GetWithdrawalDetailsForAmountRequest;
response: ManualWithdrawalDetails;
};
/**
* Get details for withdrawing via a particular taler:// URI.
*/
export type GetWithdrawalDetailsForUriOp = {
request: GetWithdrawalDetailsForUriRequest;
response: WithdrawUriInfoResponse;
};
/**
* Accept a bank-integrated withdrawal.
*/
export type AcceptBankIntegratedWithdrawalOp = {
request: AcceptBankIntegratedWithdrawalRequest;
response: AcceptWithdrawalResponse;
};
/**
* Create a manual withdrawal.
*/
export type AcceptManualWithdrawalOp = {
request: AcceptManualWithdrawalRequest;
response: AcceptManualWithdrawalResult;
};
// group: Merchant Payments
/**
* Prepare to make a payment
*/
export type PreparePayForUriOp = { export type PreparePayForUriOp = {
op: WalletApiOperation.PreparePayForUri; op: WalletApiOperation.PreparePayForUri;
request: PreparePayRequest; request: PreparePayRequest;
response: PreparePayResult; response: PreparePayResult;
}; };
export type WithdrawTestkudosOp = { /**
op: WalletApiOperation.WithdrawTestkudos; * Confirm a payment that was previously prepared with
request: {}; * {@link PreparePayForUriOp}
response: {}; */
};
export type ConfirmPayOp = { export type ConfirmPayOp = {
op: WalletApiOperation.ConfirmPay; op: WalletApiOperation.ConfirmPay;
request: ConfirmPayRequest; request: ConfirmPayRequest;
response: ConfirmPayResult; response: ConfirmPayResult;
}; };
/**
* Abort a pending payment with a refund.
*/
export type AbortPayWithRefundOp = { export type AbortPayWithRefundOp = {
request: AbortPayWithRefundRequest; request: AbortPayWithRefundRequest;
response: {}; response: {};
}; };
export type GetBalancesOp = { /**
request: {}; * Check for a refund based on a taler://refund URI.
response: BalancesResponse; */
};
export type GetTransactionsOp = {
request: TransactionsRequest;
response: TransactionsResponse;
};
export type GetPendingOperationsOp = {
request: {};
response: PendingOperationsResponse;
};
export type DumpCoinsOp = {
request: {};
response: CoinDumpJson;
};
export type SetCoinSuspendedOp = {
request: SetCoinSuspendedRequest;
response: {};
};
export type ForceRefreshOp = {
request: ForceRefreshRequest;
response: {};
};
export type DeleteTransactionOp = {
request: DeleteTransactionRequest;
response: {};
};
export type RetryTransactionOp = {
request: RetryTransactionRequest;
response: {};
};
export type PrepareTipOp = {
request: PrepareTipRequest;
response: PrepareTipResult;
};
export type AcceptTipOp = {
request: AcceptTipRequest;
response: {};
};
export type ApplyRefundOp = { export type ApplyRefundOp = {
request: ApplyRefundRequest; request: ApplyRefundRequest;
response: ApplyRefundResponse; response: ApplyRefundResponse;
}; };
export type ListCurrenciesOp = { // group: Tipping
request: {};
response: WalletCurrencyInfo; /**
* Query and store information about a tip.
*/
export type PrepareTipOp = {
request: PrepareTipRequest;
response: PrepareTipResult;
}; };
export type GetWithdrawalDetailsForAmountOp = { /**
request: GetWithdrawalDetailsForAmountRequest; * Accept a tip.
response: ManualWithdrawalDetails; */
export type AcceptTipOp = {
request: AcceptTipRequest;
response: {};
}; };
export type GetWithdrawalDetailsForUriOp = { // group: Exchange Management
request: GetWithdrawalDetailsForUriRequest;
response: WithdrawUriInfoResponse;
};
export type AcceptBankIntegratedWithdrawalOp = {
request: AcceptBankIntegratedWithdrawalRequest;
response: AcceptWithdrawalResponse;
};
export type AcceptManualWithdrawalOp = {
request: AcceptManualWithdrawalRequest;
response: AcceptManualWithdrawalResult;
};
/**
* List exchanges known to the wallet.
*/
export type ListExchangesOp = { export type ListExchangesOp = {
request: {}; request: {};
response: ExchangesListResponse; response: ExchangesListResponse;
}; };
/**
* Add / force-update an exchange.
*/
export type AddExchangeOp = { export type AddExchangeOp = {
request: AddExchangeRequest; request: AddExchangeRequest;
response: {}; response: {};
}; };
/**
* Accept a particular version of the exchange terms of service.
*/
export type SetExchangeTosAcceptedOp = { export type SetExchangeTosAcceptedOp = {
request: AcceptExchangeTosRequest; request: AcceptExchangeTosRequest;
response: {}; response: {};
}; };
/**
* Get the current terms of a service of an exchange.
*/
export type GetExchangeTosOp = { export type GetExchangeTosOp = {
request: GetExchangeTosRequest; request: GetExchangeTosRequest;
response: GetExchangeTosResult; response: GetExchangeTosResult;
}; };
export type TrackDepositGroupOp = { /**
request: TrackDepositGroupRequest; * List currencies known to the wallet.
response: TrackDepositGroupResponse; */
export type ListCurrenciesOp = {
request: {};
response: WalletCurrencyInfo;
}; };
// group: Deposits
/**
* 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 = { export type CreateDepositGroupOp = {
request: CreateDepositGroupRequest; request: CreateDepositGroupRequest;
response: CreateDepositGroupResponse; response: CreateDepositGroupResponse;
}; };
export type SetWalletDeviceIdOp = { /**
request: SetWalletDeviceIdRequest; * Track the status of a deposit group by querying the exchange.
response: {}; */
export type TrackDepositGroupOp = {
request: TrackDepositGroupRequest;
response: TrackDepositGroupResponse;
}; };
export type ExportBackupPlainOp = { // group: Backups
request: {};
response: WalletBackupContentV1;
};
/**
* Export the recovery information for the wallet.
*/
export type ExportBackupRecoveryOp = { export type ExportBackupRecoveryOp = {
request: {}; request: {};
response: BackupRecovery; response: BackupRecovery;
}; };
/**
* Import recovery information into the wallet.
*/
export type ImportBackupRecoveryOp = { export type ImportBackupRecoveryOp = {
request: RecoveryLoadRequest; request: RecoveryLoadRequest;
response: {}; response: {};
}; };
/**
* Manually make and upload a backup.
*/
export type RunBackupCycleOp = { export type RunBackupCycleOp = {
request: {}; request: {};
response: {}; response: {};
}; };
/**
* Add a new backup provider.
*/
export type AddBackupProviderOp = { export type AddBackupProviderOp = {
request: AddBackupProviderRequest; request: AddBackupProviderRequest;
response: {}; response: {};
}; };
/**
* Get some useful stats about the backup state.
*/
export type GetBackupInfoOp = { export type GetBackupInfoOp = {
request: {}; request: {};
response: BackupInfo; response: BackupInfo;
}; };
export type RunIntegrationTestOp = { /**
request: IntegrationTestArgs; * 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 = {
request: SetWalletDeviceIdRequest;
response: {}; response: {};
}; };
export type WithdrawTestBalanceOp = { /**
request: WithdrawTestBalanceRequest; * Export a backup JSON, mostly useful for testing.
response: {}; */
}; export type ExportBackupPlainOp = {
export type TestPayOp = {
request: TestPayArgs;
response: TestPayResult;
};
export type ExportDbOp = {
request: {}; request: {};
response: any; response: WalletBackupContentV1;
}; };
// group: Peer Payments
/**
* Initiate an outgoing peer push payment.
*/
export type InitiatePeerPushPaymentOp = { export type InitiatePeerPushPaymentOp = {
request: InitiatePeerPushPaymentRequest; request: InitiatePeerPushPaymentRequest;
response: InitiatePeerPushPaymentResponse; response: InitiatePeerPushPaymentResponse;
}; };
/**
* Check an incoming peer push payment.
*/
export type CheckPeerPushPaymentOp = { export type CheckPeerPushPaymentOp = {
request: CheckPeerPushPaymentRequest; request: CheckPeerPushPaymentRequest;
response: CheckPeerPushPaymentResponse; response: CheckPeerPushPaymentResponse;
}; };
/**
* Accept an incoming peer push payment.
*/
export type AcceptPeerPushPaymentOp = { export type AcceptPeerPushPaymentOp = {
request: AcceptPeerPushPaymentRequest; request: AcceptPeerPushPaymentRequest;
response: {}; response: {};
}; };
/**
* Initiate an outgoing peer pull payment.
*/
export type InitiatePeerPullPaymentOp = { export type InitiatePeerPullPaymentOp = {
request: InitiatePeerPullPaymentRequest; request: InitiatePeerPullPaymentRequest;
response: InitiatePeerPullPaymentResponse; response: InitiatePeerPullPaymentResponse;
}; };
/**
* Prepare for an incoming peer pull payment.
*/
export type CheckPeerPullPaymentOp = { export type CheckPeerPullPaymentOp = {
request: CheckPeerPullPaymentRequest; request: CheckPeerPullPaymentRequest;
response: CheckPeerPullPaymentResponse; response: CheckPeerPullPaymentResponse;
}; };
/**
* Accept an incoming peer pull payment.
*/
export type AcceptPeerPullPaymentOp = { export type AcceptPeerPullPaymentOp = {
request: AcceptPeerPullPaymentRequest; request: AcceptPeerPullPaymentRequest;
response: {}; response: {};
}; };
// group: Database Management
/**
* Exoport the wallet database's contents to JSON.
*/
export type ExportDbOp = {
request: {};
response: any;
};
/**
* Dangerously clear the whole wallet database.
*/
export type ClearDbOp = { export type ClearDbOp = {
request: {}; request: {};
response: {}; response: {};
}; };
/**
* Export a backup, clear the database and re-import it.
*/
export type RecycleOp = { export type RecycleOp = {
request: {}; request: {};
response: {}; response: {};
}; };
// group: Testing and Debugging
/**
* Run a simple integration test on a test deployment
* of the exchange and merchant.
*/
export type RunIntegrationTestOp = {
request: IntegrationTestArgs;
response: {};
};
/**
* Make withdrawal on a test deployment of the exchange
* and merchant.
*/
export type WithdrawTestBalanceOp = {
request: WithdrawTestBalanceRequest;
response: {};
};
/**
* Make a withdrawal of testkudos on test.taler.net.
*/
export type WithdrawTestkudosOp = {
op: WalletApiOperation.WithdrawTestkudos;
request: {};
response: {};
};
/**
* Make a test payment using a test deployment of
* the exchange and merchant.
*/
export type TestPayOp = {
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: {};
};
/**
* Get wallet-internal pending tasks.
*/
export type GetPendingTasksOp = {
request: {};
response: PendingTasksResponse;
};
/**
* Dump all coins of the wallet in a simple JSON format.
*/
export type DumpCoinsOp = {
request: {};
response: CoinDumpJson;
};
/**
* Set a coin as (un-)suspended.
* Suspended coins won't be used for payments.
*/
export type SetCoinSuspendedOp = {
request: SetCoinSuspendedRequest;
response: {};
};
/**
* Force a refresh on coins where it would not
* be necessary.
*/
export type ForceRefreshOp = {
request: ForceRefreshRequest;
response: {};
};
export type WalletOperations = { export type WalletOperations = {
[WalletApiOperation.InitWallet]: InitWalletOp; [WalletApiOperation.InitWallet]: InitWalletOp;
[WalletApiOperation.WithdrawFakebank]: WithdrawFakebankOp; [WalletApiOperation.WithdrawFakebank]: WithdrawFakebankOp;
@ -392,7 +569,7 @@ export type WalletOperations = {
[WalletApiOperation.AbortFailedPayWithRefund]: AbortPayWithRefundOp; [WalletApiOperation.AbortFailedPayWithRefund]: AbortPayWithRefundOp;
[WalletApiOperation.GetBalances]: GetBalancesOp; [WalletApiOperation.GetBalances]: GetBalancesOp;
[WalletApiOperation.GetTransactions]: GetTransactionsOp; [WalletApiOperation.GetTransactions]: GetTransactionsOp;
[WalletApiOperation.GetPendingOperations]: GetPendingOperationsOp; [WalletApiOperation.GetPendingOperations]: GetPendingTasksOp;
[WalletApiOperation.DumpCoins]: DumpCoinsOp; [WalletApiOperation.DumpCoins]: DumpCoinsOp;
[WalletApiOperation.SetCoinSuspended]: SetCoinSuspendedOp; [WalletApiOperation.SetCoinSuspended]: SetCoinSuspendedOp;
[WalletApiOperation.ForceRefresh]: ForceRefreshOp; [WalletApiOperation.ForceRefresh]: ForceRefreshOp;