restructure api types

This commit is contained in:
Florian Dold 2022-10-04 13:12:15 +02:00
parent bbde2a9bb9
commit 37d27ba437
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 303 additions and 193 deletions

View File

@ -423,11 +423,17 @@ export const codecForPreparePayResult = (): Codec<PreparePayResult> =>
)
.build("PreparePayResult");
/**
* Result of a prepare pay operation.
*/
export type PreparePayResult =
| PreparePayResultInsufficientBalance
| PreparePayResultAlreadyConfirmed
| PreparePayResultPaymentPossible;
/**
* Payment is possible.
*/
export interface PreparePayResultPaymentPossible {
status: PreparePayResultType.PaymentPossible;
proposalId: string;
@ -604,7 +610,7 @@ export interface KnownBankAccountsInfo {
uri: PaytoUri;
kyc_completed: boolean;
currency: string;
alias: string,
alias: string;
}
export interface KnownBankAccounts {
@ -1092,9 +1098,9 @@ export interface AddKnownBankAccountsRequest {
export const codecForAddKnownBankAccounts =
(): Codec<AddKnownBankAccountsRequest> =>
buildCodecForObject<AddKnownBankAccountsRequest>()
.property("payto", (codecForString()))
.property("alias", (codecForString()))
.property("currency", (codecForString()))
.property("payto", codecForString())
.property("alias", codecForString())
.property("currency", codecForString())
.build("AddKnownBankAccountsRequest");
export interface ForgetKnownBankAccountsRequest {
@ -1104,7 +1110,7 @@ export interface ForgetKnownBankAccountsRequest {
export const codecForForgetKnownBankAccounts =
(): Codec<ForgetKnownBankAccountsRequest> =>
buildCodecForObject<ForgetKnownBankAccountsRequest>()
.property("payto", (codecForString()))
.property("payto", codecForString())
.build("ForgetKnownBankAccountsRequest");
export interface GetExchangeWithdrawalInfo {

View File

@ -138,195 +138,299 @@ export enum WalletApiOperation {
Recycle = "recycle",
}
export type WalletOperations = {
[WalletApiOperation.InitWallet]: {
/**
* Initialize wallet-core.
*
* Must be the first message sent before any other operations.
*/
export type InitWalletOp = {
op: WalletApiOperation.InitWallet;
request: {};
response: {};
};
[WalletApiOperation.WithdrawFakebank]: {
};
export type WithdrawFakebankOp = {
op: WalletApiOperation.WithdrawFakebank;
request: WithdrawFakebankRequest;
response: {};
};
[WalletApiOperation.PreparePayForUri]: {
};
export type PreparePayForUriOp = {
op: WalletApiOperation.PreparePayForUri;
request: PreparePayRequest;
response: PreparePayResult;
};
[WalletApiOperation.WithdrawTestkudos]: {
};
export type WithdrawTestkudosOp = {
op: WalletApiOperation.WithdrawTestkudos;
request: {};
response: {};
};
[WalletApiOperation.ConfirmPay]: {
};
export type ConfirmPayOp = {
op: WalletApiOperation.ConfirmPay;
request: ConfirmPayRequest;
response: ConfirmPayResult;
};
[WalletApiOperation.AbortFailedPayWithRefund]: {
};
export type AbortPayWithRefundOp = {
request: AbortPayWithRefundRequest;
response: {};
};
[WalletApiOperation.GetBalances]: {
};
export type GetBalancesOp = {
request: {};
response: BalancesResponse;
};
[WalletApiOperation.GetTransactions]: {
};
export type GetTransactionsOp = {
request: TransactionsRequest;
response: TransactionsResponse;
};
[WalletApiOperation.GetPendingOperations]: {
};
export type GetPendingOperationsOp = {
request: {};
response: PendingOperationsResponse;
};
[WalletApiOperation.DumpCoins]: {
};
export type DumpCoinsOp = {
request: {};
response: CoinDumpJson;
};
[WalletApiOperation.SetCoinSuspended]: {
};
export type SetCoinSuspendedOp = {
request: SetCoinSuspendedRequest;
response: {};
};
[WalletApiOperation.ForceRefresh]: {
};
export type ForceRefreshOp = {
request: ForceRefreshRequest;
response: {};
};
[WalletApiOperation.DeleteTransaction]: {
};
export type DeleteTransactionOp = {
request: DeleteTransactionRequest;
response: {};
};
[WalletApiOperation.RetryTransaction]: {
};
export type RetryTransactionOp = {
request: RetryTransactionRequest;
response: {};
};
[WalletApiOperation.PrepareTip]: {
};
export type PrepareTipOp = {
request: PrepareTipRequest;
response: PrepareTipResult;
};
[WalletApiOperation.AcceptTip]: {
};
export type AcceptTipOp = {
request: AcceptTipRequest;
response: {};
};
[WalletApiOperation.ApplyRefund]: {
};
export type ApplyRefundOp = {
request: ApplyRefundRequest;
response: ApplyRefundResponse;
};
[WalletApiOperation.ListCurrencies]: {
};
export type ListCurrenciesOp = {
request: {};
response: WalletCurrencyInfo;
};
[WalletApiOperation.GetWithdrawalDetailsForAmount]: {
};
export type GetWithdrawalDetailsForAmountOp = {
request: GetWithdrawalDetailsForAmountRequest;
response: ManualWithdrawalDetails;
};
[WalletApiOperation.GetWithdrawalDetailsForUri]: {
};
export type GetWithdrawalDetailsForUriOp = {
request: GetWithdrawalDetailsForUriRequest;
response: WithdrawUriInfoResponse;
};
[WalletApiOperation.AcceptBankIntegratedWithdrawal]: {
};
export type AcceptBankIntegratedWithdrawalOp = {
request: AcceptBankIntegratedWithdrawalRequest;
response: AcceptWithdrawalResponse;
};
[WalletApiOperation.AcceptManualWithdrawal]: {
};
export type AcceptManualWithdrawalOp = {
request: AcceptManualWithdrawalRequest;
response: AcceptManualWithdrawalResult;
};
[WalletApiOperation.ListExchanges]: {
};
export type ListExchangesOp = {
request: {};
response: ExchangesListResponse;
};
[WalletApiOperation.AddExchange]: {
};
export type AddExchangeOp = {
request: AddExchangeRequest;
response: {};
};
[WalletApiOperation.SetExchangeTosAccepted]: {
};
export type SetExchangeTosAcceptedOp = {
request: AcceptExchangeTosRequest;
response: {};
};
[WalletApiOperation.GetExchangeTos]: {
};
export type GetExchangeTosOp = {
request: GetExchangeTosRequest;
response: GetExchangeTosResult;
};
[WalletApiOperation.TrackDepositGroup]: {
};
export type TrackDepositGroupOp = {
request: TrackDepositGroupRequest;
response: TrackDepositGroupResponse;
};
[WalletApiOperation.CreateDepositGroup]: {
};
export type CreateDepositGroupOp = {
request: CreateDepositGroupRequest;
response: CreateDepositGroupResponse;
};
[WalletApiOperation.SetWalletDeviceId]: {
};
export type SetWalletDeviceIdOp = {
request: SetWalletDeviceIdRequest;
response: {};
};
[WalletApiOperation.ExportBackupPlain]: {
};
export type ExportBackupPlainOp = {
request: {};
response: WalletBackupContentV1;
};
[WalletApiOperation.ExportBackupRecovery]: {
};
export type ExportBackupRecoveryOp = {
request: {};
response: BackupRecovery;
};
[WalletApiOperation.ImportBackupRecovery]: {
};
export type ImportBackupRecoveryOp = {
request: RecoveryLoadRequest;
response: {};
};
[WalletApiOperation.RunBackupCycle]: {
};
export type RunBackupCycleOp = {
request: {};
response: {};
};
[WalletApiOperation.AddBackupProvider]: {
};
export type AddBackupProviderOp = {
request: AddBackupProviderRequest;
response: {};
};
[WalletApiOperation.GetBackupInfo]: {
};
export type GetBackupInfoOp = {
request: {};
response: BackupInfo;
};
[WalletApiOperation.RunIntegrationTest]: {
};
export type RunIntegrationTestOp = {
request: IntegrationTestArgs;
response: {};
};
[WalletApiOperation.WithdrawTestBalance]: {
};
export type WithdrawTestBalanceOp = {
request: WithdrawTestBalanceRequest;
response: {};
};
[WalletApiOperation.TestPay]: {
};
export type TestPayOp = {
request: TestPayArgs;
response: TestPayResult;
};
[WalletApiOperation.ExportDb]: {
};
export type ExportDbOp = {
request: {};
response: any;
};
[WalletApiOperation.InitiatePeerPushPayment]: {
};
export type InitiatePeerPushPaymentOp = {
request: InitiatePeerPushPaymentRequest;
response: InitiatePeerPushPaymentResponse;
};
[WalletApiOperation.CheckPeerPushPayment]: {
};
export type CheckPeerPushPaymentOp = {
request: CheckPeerPushPaymentRequest;
response: CheckPeerPushPaymentResponse;
};
[WalletApiOperation.AcceptPeerPushPayment]: {
};
export type AcceptPeerPushPaymentOp = {
request: AcceptPeerPushPaymentRequest;
response: {};
};
[WalletApiOperation.InitiatePeerPullPayment]: {
};
export type InitiatePeerPullPaymentOp = {
request: InitiatePeerPullPaymentRequest;
response: InitiatePeerPullPaymentResponse;
};
[WalletApiOperation.CheckPeerPullPayment]: {
};
export type CheckPeerPullPaymentOp = {
request: CheckPeerPullPaymentRequest;
response: CheckPeerPullPaymentResponse;
};
[WalletApiOperation.AcceptPeerPullPayment]: {
};
export type AcceptPeerPullPaymentOp = {
request: AcceptPeerPullPaymentRequest;
response: {};
};
[WalletApiOperation.ClearDb]: {
};
export type ClearDbOp = {
request: {};
response: {};
};
[WalletApiOperation.Recycle]: {
};
export type RecycleOp = {
request: {};
response: {};
};
};
export type WalletOperations = {
[WalletApiOperation.InitWallet]: InitWalletOp;
[WalletApiOperation.WithdrawFakebank]: WithdrawFakebankOp;
[WalletApiOperation.PreparePayForUri]: PreparePayForUriOp;
[WalletApiOperation.WithdrawTestkudos]: WithdrawTestkudosOp;
[WalletApiOperation.ConfirmPay]: ConfirmPayOp;
[WalletApiOperation.AbortFailedPayWithRefund]: AbortPayWithRefundOp;
[WalletApiOperation.GetBalances]: GetBalancesOp;
[WalletApiOperation.GetTransactions]: GetTransactionsOp;
[WalletApiOperation.GetPendingOperations]: GetPendingOperationsOp;
[WalletApiOperation.DumpCoins]: DumpCoinsOp;
[WalletApiOperation.SetCoinSuspended]: SetCoinSuspendedOp;
[WalletApiOperation.ForceRefresh]: ForceRefreshOp;
[WalletApiOperation.DeleteTransaction]: DeleteTransactionOp;
[WalletApiOperation.RetryTransaction]: RetryTransactionOp;
[WalletApiOperation.PrepareTip]: PrepareTipOp;
[WalletApiOperation.AcceptTip]: AcceptTipOp;
[WalletApiOperation.ApplyRefund]: ApplyRefundOp;
[WalletApiOperation.ListCurrencies]: ListCurrenciesOp;
[WalletApiOperation.GetWithdrawalDetailsForAmount]: GetWithdrawalDetailsForAmountOp;
[WalletApiOperation.GetWithdrawalDetailsForUri]: GetWithdrawalDetailsForUriOp;
[WalletApiOperation.AcceptBankIntegratedWithdrawal]: AcceptBankIntegratedWithdrawalOp;
[WalletApiOperation.AcceptManualWithdrawal]: AcceptManualWithdrawalOp;
[WalletApiOperation.ListExchanges]: ListExchangesOp;
[WalletApiOperation.AddExchange]: AddExchangeOp;
[WalletApiOperation.SetExchangeTosAccepted]: SetExchangeTosAcceptedOp;
[WalletApiOperation.GetExchangeTos]: GetExchangeTosOp;
[WalletApiOperation.TrackDepositGroup]: TrackDepositGroupOp;
[WalletApiOperation.CreateDepositGroup]: CreateDepositGroupOp;
[WalletApiOperation.SetWalletDeviceId]: SetWalletDeviceIdOp;
[WalletApiOperation.ExportBackupPlain]: ExportBackupPlainOp;
[WalletApiOperation.ExportBackupRecovery]: ExportBackupRecoveryOp;
[WalletApiOperation.ImportBackupRecovery]: ImportBackupRecoveryOp;
[WalletApiOperation.RunBackupCycle]: RunBackupCycleOp;
[WalletApiOperation.AddBackupProvider]: AddBackupProviderOp;
[WalletApiOperation.GetBackupInfo]: GetBackupInfoOp;
[WalletApiOperation.RunIntegrationTest]: RunIntegrationTestOp;
[WalletApiOperation.WithdrawTestBalance]: WithdrawTestBalanceOp;
[WalletApiOperation.TestPay]: TestPayOp;
[WalletApiOperation.ExportDb]: ExportDbOp;
[WalletApiOperation.InitiatePeerPushPayment]: InitiatePeerPushPaymentOp;
[WalletApiOperation.CheckPeerPushPayment]: CheckPeerPushPaymentOp;
[WalletApiOperation.AcceptPeerPushPayment]: AcceptPeerPushPaymentOp;
[WalletApiOperation.InitiatePeerPullPayment]: InitiatePeerPullPaymentOp;
[WalletApiOperation.CheckPeerPullPayment]: CheckPeerPullPaymentOp;
[WalletApiOperation.AcceptPeerPullPayment]: AcceptPeerPullPaymentOp;
[WalletApiOperation.ClearDb]: ClearDbOp;
[WalletApiOperation.Recycle]: RecycleOp;
};
export type RequestType<