Skip to content

feat: improve swap-cli UX#180

Merged
zizou0x merged 9 commits intomainfrom
zz/improve-quickstart
Apr 3, 2026
Merged

feat: improve swap-cli UX#180
zizou0x merged 9 commits intomainfrom
zz/improve-quickstart

Conversation

@zizou0x
Copy link
Copy Markdown
Collaborator

@zizou0x zizou0x commented Apr 2, 2026

Summary

  • Return transaction hash from execute_swap in the Rust client instead of discarding it
  • Add AllowanceCheck enum to control ERC-20 approval behavior — supports skipping checks or checking against a minimum threshold, so users can approve once (e.g. unlimited for Permit2) and skip redundant approvals on subsequent swaps
  • Approve unlimited amount for Permit2 in the swap CLI to avoid repeated approval transactions
  • Improve swap CLI console output with progress messages for allowance checks, transaction submissions, token addresses, and transaction hashes
  • Update protocol list in docs (replace vm:curve with ekubo and fluid)

zizou0x added 5 commits April 2, 2026 14:49
Transaction hash was being lost inside the helper function from fynd client.
The current verbosity wasn't great, in docker we would only see the quote, everything happening in the background was hidden (approvals, ect..) making it feel slow.

In this commit we:
- Added console messages to indicate ERC-20 allowance checks and transaction submissions.
- Enhanced output formatting for swap details, including token addresses and transaction hashes.
…ture swaps

This change ensures that the full unlimited amount is approved for Permit2, eliminating the need for repeated approvals during subsequent swaps. This enhancement improves the efficiency of the swap process.
With the current design, an approval is always required because the check amount always match the approval amount. This means if we approve x and swap, on the next try we will have allowance < x and the check won't skip even if we still have enough allowance.

This update adds the `AllowanceCheck` enum to control ERC-20 approval behavior in the `FyndClient`. It allows users to specify whether to skip allowance checks or to check against a minimum threshold before building approval transactions.

With this we can approve a bigger amount against permit2 and skip approval in subsequent tries.
vm:curve is not available from Fynd endpoint, change it to ekubo and fluid.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

No API Breaking Changes Detected

The PR title signals breaking changes, but cargo-semver-checks found none.
If the breaking change is behavioral, CLI, or config-level (not public Rust API), this is expected.
Otherwise, consider using fix: instead of feat: in the PR title.

Copy link
Copy Markdown
Contributor

@Troshchk Troshchk left a comment

Choose a reason for hiding this comment

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

Thank you!
Just have one question

Copy link
Copy Markdown
Collaborator

@tvinagre tvinagre left a comment

Choose a reason for hiding this comment

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

LGTM
I agree with the comment on max approval, we can maybe 3x the swap amount instead

&signer,
sell_token_bytes.clone(),
amount.clone(),
max_uint160(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this approving Max to Permit2 or the router?
If permit2, then it's fine for me. If it is the router, I'd stick to amount

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need to approve more than the swap amount?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

When the router transfer_from it consumes the allowance. So swapping becomes 2 transaction every time (approve then swap) instead of just one transaction

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Update: we decided to not approve more than needed even if it's against Permit2 for security reasons. See 03bad3a

@zizou0x zizou0x enabled auto-merge April 3, 2026 14:46
@zizou0x zizou0x merged commit 3db0fe8 into main Apr 3, 2026
17 checks passed
@zizou0x zizou0x deleted the zz/improve-quickstart branch April 3, 2026 14:48
@propellerci
Copy link
Copy Markdown

propellerci bot commented Apr 3, 2026

This PR is included in version 0.47.0 🎉

@propellerci propellerci bot added the true label Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants