Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cancel transaction, ref #LEA-958 #5920

Merged
merged 1 commit into from
Oct 30, 2024
Merged

feat: add cancel transaction, ref #LEA-958 #5920

merged 1 commit into from
Oct 30, 2024

Conversation

alter-eggo
Copy link
Contributor

@alter-eggo alter-eggo commented Oct 24, 2024

Try out Leather build 53a7e31Extension build, Test report, Storybook, Chromatic

This pr adds option to cancel stx transaction, also adds tests for increase and cancel stx transaction

@Aman-zishan thanks a lot for your work on this

Copy link

linear bot commented Oct 24, 2024

@alter-eggo alter-eggo marked this pull request as ready for review October 29, 2024 10:02
if (!transaction) return;

const routeUrl = RouteUrls.IncreaseStxFee.replace(':txid', transaction.tx_id);
const routeUrl =
action === 'increaseFee'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe pull this out as a defined type and use increase-fee?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added enum

@pete-watters
Copy link
Contributor

pete-watters commented Oct 29, 2024

This code looks good but I am confused about how to cancel a transaction.

I tried to cancel a stacks transfer and I see this:
Screenshot 2024-10-29 at 13 36 13

Do I need to choose a fee and then submit to cancel? 🤔 So you make a new reversed transaction?

Copy link
Contributor

@pete-watters pete-watters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alter-eggo
Copy link
Contributor Author

@314159265359879 could you test this build please

@alter-eggo
Copy link
Contributor Author

@pete-watters yeah, as I understand you need to increase fee a bit to cancel tx

@314159265359879
Copy link
Contributor

314159265359879 commented Oct 30, 2024

Thanks for this @alter-eggo
The prefilled fee here should default to 0.000001 STX more than the current fee for the transaction being replaced. That way the user can already click submit (now it is not allowed unless they click atleast 2x, which will be excessive in most cases).
With a 0.000001 STX increase the "submit" button can be light up right away (ready to click, and then increasing the fee further is optional).

image

For context, STX transfers don't usually need a higher fee to get included in a block (unlike some contract calls and contract deployments) they require very little of the "block space".

image

With the change above. I opt to remove "A higher fee can help replace the old transaction." from the explainer. Because in most cases we'll set the right fee (just 0.000001 STX more then current). Leaving it in there may make users think that they have to set a much higher fee, which is not actually the case. There is always still a chance the old transaction gets processed anyway, because it reaches a miner first or before it is replaced by the new transaction with the higher fee.

"To cancel the transaction we replace it with a minimal STX transfer." Could be a good add here so users are not surprised that the "cancelled" transaction goes away and a small STX transfer is displayed in its place.

I think this is out of scope now: Later we can create an enhancement to label the transaction differently (based on the memo) used in the cancel transaction. "Pending Cancellation" instead of the normal "Pending".

Copy link
Contributor

@314159265359879 314159265359879 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above.

@alter-eggo
Copy link
Contributor Author

thanks @314159265359879 fixed this

Copy link
Contributor

@314159265359879 314159265359879 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

@alter-eggo alter-eggo added this pull request to the merge queue Oct 30, 2024
Merged via the queue into dev with commit 7e16463 Oct 30, 2024
32 checks passed
@alter-eggo alter-eggo deleted the feat/cancel-tx branch October 30, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants