wallet-core: consistently rename to failTransaction

This commit is contained in:
Florian Dold 2023-06-20 19:41:36 +02:00
parent 32937795c5
commit 8d20ab87fa
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
5 changed files with 23 additions and 24 deletions

View File

@ -1920,15 +1920,15 @@ export const codecForAcceptTipRequest = (): Codec<AcceptTipRequest> =>
.property("walletTipId", codecForString()) .property("walletTipId", codecForString())
.build("AcceptTipRequest"); .build("AcceptTipRequest");
export interface CancelAbortingTransactionRequest { export interface FailTransactionRequest {
transactionId: TransactionIdStr; transactionId: TransactionIdStr;
} }
export const codecForCancelAbortingTransactionRequest = export const codecForFailTransactionRequest =
(): Codec<CancelAbortingTransactionRequest> => (): Codec<FailTransactionRequest> =>
buildCodecForObject<CancelAbortingTransactionRequest>() buildCodecForObject<FailTransactionRequest>()
.property("transactionId", codecForTransactionIdStr()) .property("transactionId", codecForTransactionIdStr())
.build("CancelAbortingTransactionRequest"); .build("FailTransactionRequest");
export interface SuspendTransactionRequest { export interface SuspendTransactionRequest {
transactionId: TransactionIdStr; transactionId: TransactionIdStr;
@ -1953,7 +1953,7 @@ export interface AbortTransactionRequest {
transactionId: TransactionIdStr; transactionId: TransactionIdStr;
} }
export interface CancelAbortingTransactionRequest { export interface FailTransactionRequest {
transactionId: TransactionIdStr; transactionId: TransactionIdStr;
} }

View File

@ -446,17 +446,16 @@ transactionsCli
}); });
transactionsCli transactionsCli
.subcommand("cancelAbortingTransaction", "cancel-aborting", { .subcommand("fail", "fail", {
help: "Cancel the attempt of properly aborting a transaction.", help: "Fail a transaction (when it can't be aborted).",
}) })
.requiredArgument("transactionId", clk.STRING, { .requiredArgument("transactionId", clk.STRING, {
help: "Identifier of the transaction to cancel aborting.", help: "Identifier of the transaction to fail.",
}) })
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
await wallet.client.call(WalletApiOperation.CancelAbortingTransaction, { await wallet.client.call(WalletApiOperation.FailTransaction, {
transactionId: args.cancelAbortingTransaction transactionId: args.fail.transactionId as TransactionIdStr,
.transactionId as TransactionIdStr,
}); });
}); });
}); });

View File

@ -38,7 +38,7 @@ import {
ApplyDevExperimentRequest, ApplyDevExperimentRequest,
BackupRecovery, BackupRecovery,
BalancesResponse, BalancesResponse,
CancelAbortingTransactionRequest, FailTransactionRequest,
CheckPeerPullCreditRequest, CheckPeerPullCreditRequest,
CheckPeerPullCreditResponse, CheckPeerPullCreditResponse,
CheckPeerPushDebitRequest, CheckPeerPushDebitRequest,
@ -166,9 +166,11 @@ export enum WalletApiOperation {
GetExchangeDetailedInfo = "getExchangeDetailedInfo", GetExchangeDetailedInfo = "getExchangeDetailedInfo",
RetryPendingNow = "retryPendingNow", RetryPendingNow = "retryPendingNow",
AbortTransaction = "abortTransaction", AbortTransaction = "abortTransaction",
CancelAbortingTransaction = "cancelAbortingTransaction", FailTransaction = "failTransaction",
SuspendTransaction = "suspendTransaction", SuspendTransaction = "suspendTransaction",
ResumeTransaction = "resumeTransaction", ResumeTransaction = "resumeTransaction",
DeleteTransaction = "deleteTransaction",
RetryTransaction = "retryTransaction",
ConfirmPay = "confirmPay", ConfirmPay = "confirmPay",
DumpCoins = "dumpCoins", DumpCoins = "dumpCoins",
SetCoinSuspended = "setCoinSuspended", SetCoinSuspended = "setCoinSuspended",
@ -184,8 +186,6 @@ export enum WalletApiOperation {
GetBackupInfo = "getBackupInfo", GetBackupInfo = "getBackupInfo",
PrepareDeposit = "prepareDeposit", PrepareDeposit = "prepareDeposit",
GetVersion = "getVersion", GetVersion = "getVersion",
DeleteTransaction = "deleteTransaction",
RetryTransaction = "retryTransaction",
ListCurrencies = "listCurrencies", ListCurrencies = "listCurrencies",
GenerateDepositGroupTxId = "generateDepositGroupTxId", GenerateDepositGroupTxId = "generateDepositGroupTxId",
CreateDepositGroup = "createDepositGroup", CreateDepositGroup = "createDepositGroup",
@ -384,9 +384,9 @@ export type AbortTransactionOp = {
* *
* For payment transactions, it puts the payment into an "aborting" state. * For payment transactions, it puts the payment into an "aborting" state.
*/ */
export type CancelAbortingTransactionOp = { export type FailTransactionOp = {
op: WalletApiOperation.CancelAbortingTransaction; op: WalletApiOperation.FailTransaction;
request: CancelAbortingTransactionRequest; request: FailTransactionRequest;
response: EmptyObject; response: EmptyObject;
}; };
@ -979,7 +979,7 @@ export type WalletOperations = {
[WalletApiOperation.WithdrawTestkudos]: WithdrawTestkudosOp; [WalletApiOperation.WithdrawTestkudos]: WithdrawTestkudosOp;
[WalletApiOperation.ConfirmPay]: ConfirmPayOp; [WalletApiOperation.ConfirmPay]: ConfirmPayOp;
[WalletApiOperation.AbortTransaction]: AbortTransactionOp; [WalletApiOperation.AbortTransaction]: AbortTransactionOp;
[WalletApiOperation.CancelAbortingTransaction]: CancelAbortingTransactionOp; [WalletApiOperation.FailTransaction]: FailTransactionOp;
[WalletApiOperation.SuspendTransaction]: SuspendTransactionOp; [WalletApiOperation.SuspendTransaction]: SuspendTransactionOp;
[WalletApiOperation.ResumeTransaction]: ResumeTransactionOp; [WalletApiOperation.ResumeTransaction]: ResumeTransactionOp;
[WalletApiOperation.GetBalances]: GetBalancesOp; [WalletApiOperation.GetBalances]: GetBalancesOp;

View File

@ -64,7 +64,7 @@ import {
codecForAddKnownBankAccounts, codecForAddKnownBankAccounts,
codecForAny, codecForAny,
codecForApplyDevExperiment, codecForApplyDevExperiment,
codecForCancelAbortingTransactionRequest, codecForFailTransactionRequest,
codecForCheckPeerPullPaymentRequest, codecForCheckPeerPullPaymentRequest,
codecForCheckPeerPushDebitRequest, codecForCheckPeerPushDebitRequest,
codecForConfirmPayRequest, codecForConfirmPayRequest,
@ -1237,8 +1237,8 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
await suspendTransaction(ws, req.transactionId); await suspendTransaction(ws, req.transactionId);
return {}; return {};
} }
case WalletApiOperation.CancelAbortingTransaction: { case WalletApiOperation.FailTransaction: {
const req = codecForCancelAbortingTransactionRequest().decode(payload); const req = codecForFailTransactionRequest().decode(payload);
await failTransaction(ws, req.transactionId); await failTransaction(ws, req.transactionId);
return {}; return {};
} }

View File

@ -121,7 +121,7 @@ export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
<TransactionView <TransactionView
transaction={state.response} transaction={state.response}
onCancel={async () => { onCancel={async () => {
await api.wallet.call(WalletApiOperation.CancelAbortingTransaction, { await api.wallet.call(WalletApiOperation.FailTransaction, {
transactionId, transactionId,
}); });
goToWalletHistory(currency); goToWalletHistory(currency);