Cancelling Transactions

Engine submits transactions to the blockchain within 5-10 seconds of receiving a request. During gas or traffic spikes, transactions may take longer to be mined.

In some cases, your application may want to cancel the transaction, such as:

  • The transaction was sent in error.
  • An NFT collection's supply has run out.
  • The transaction's exchange rate has changed and should be re-attempted with a new exchange rate.

When Engine receives a cancellation request:

  • If the transaction is completed (mined, errored, or canceled), this endpoint returns an error.
  • If the transaction is already submitted to RPC, this endpoint sends a no-op transaction with aggressive gas options to "replace" the original transaction.
  • If the transaction is not yet submitted, this endpoint will remove it from the queue.

When canceled, the transaction will not be re-attempted. Your backend may safely re-attempt this transaction.

Cancel a transaction from the API

// queueId was returned from a previous write request.
const resp = await fetch("<engine_url>/transaction/cancel", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <access_token>",
},
body: JSON.stringify({ queueId }),
});
if (resp.status === 200) {
console.log(`Transaction ${queueId} was canceled.`);
}

Reference: Cancel Transaction

Cancel a transaction from the dashboard

Select the Cancel icon next to a queued transaction in the Tranasctions table.

Cancel all queued transactions

Coming soon.