manifoldfinance / manifoldfinance/libsushi

Feature: add Transaction Replacement support

Open
#6 0 comments 0 reactions 1 assignee View on GitHub

@sambacha is already working on this.

Since Apr 18, 2022.

enhancement
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

When using tx.wait() on a transaction made from the sendTransaction() method of a Signer (including non-constant methods on Contract), if the transaction is repriced or cancelled, a TRANSACTION_REPLACED error is thrown along with some extra details of what happened, allowing for appropriate “next steps” to be taken.

Error {
  code: "TRANSACTION_REPLACED",
  // The reason why the transaction was replaced
  // - "repriced" is generally nothing of concern, the 
  //   only difference in the transaction is the gasPrice
  // - "cancelled" means the `to` has been set to the `from`,
  //   the data has been set to `0x` and value set to 0
  // - "replaced" means that the transaction is unrelated to
  //   the original transaction
  reason: "repriced" | "cancelled" | "replaced",
  // This is a short-hand property as the effects of either a
  // "cancelled" or "replaced" tx are effectively cancelled
  cancelled: (reason === "cancelled" || reason === "replaced"),
  // The TransactionResponse which replaced the original
  replacement: [ the replacement transaction response ]
  // The TransactionReceipt of the replacement transaction
  receipt: [ the receipt for the replacement transaction ],
}

This should be supported 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.