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())
.build("AcceptTipRequest");
export interface CancelAbortingTransactionRequest {
export interface FailTransactionRequest {
transactionId: TransactionIdStr;
}
export const codecForCancelAbortingTransactionRequest =
(): Codec<CancelAbortingTransactionRequest> =>
buildCodecForObject<CancelAbortingTransactionRequest>()
export const codecForFailTransactionRequest =
(): Codec<FailTransactionRequest> =>
buildCodecForObject<FailTransactionRequest>()
.property("transactionId", codecForTransactionIdStr())
.build("CancelAbortingTransactionRequest");
.build("FailTransactionRequest");
export interface SuspendTransactionRequest {
transactionId: TransactionIdStr;
@ -1953,7 +1953,7 @@ export interface AbortTransactionRequest {
transactionId: TransactionIdStr;
}
export interface CancelAbortingTransactionRequest {
export interface FailTransactionRequest {
transactionId: TransactionIdStr;
}

View File

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

View File

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

View File

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

View File

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