Skip to content

SaucerSwap Plugin#1474

Open
DivyanshGoel20 wants to merge 3 commits into
hiero-ledger:mainfrom
DivyanshGoel20:swap-branch
Open

SaucerSwap Plugin#1474
DivyanshGoel20 wants to merge 3 commits into
hiero-ledger:mainfrom
DivyanshGoel20:swap-branch

Conversation

@DivyanshGoel20

Copy link
Copy Markdown

SaucerSwap Plugin

Summary

Adds a SaucerSwap plugin so you can get swap quotes and execute HBAR ↔ token or token ↔ token swaps on SaucerSwap V2 from the CLI. Supports Hedera mainnet and testnet. You can quote without sending a transaction, then execute with configurable slippage.

Commands

Command Description
saucerswap quote Get expected output amount for an exact input swap (read-only)
saucerswap execute Execute a swap on-chain (HBAR → token or token → HBAR; applies slippage to minimum output)

Why This Plugin?

Swapping on SaucerSwap usually means using the UI or writing custom code against the router and quoter contracts. This plugin lets you quote and execute from the CLI with a payer (operator or --payer), so you can script swaps or run one-off trades without leaving the terminal.

What's Included

  • 2 commands following the existing plugin contract: Zod input/output schemas and Handlebars templates for human-readable output.
  • Quote — Uses SaucerSwap Quoter contract; input/output as HBAR or token ID (0.0.x); amount in display units (e.g. 10) or tinybar (100t).
  • Execute — Uses Router (and WhbarHelper for HBAR → WHBAR); optional --slippage (default 0.5%); applies slippage to minimum received.
  • Network support — Mainnet and testnet only (uses current network or global --network); constants for Quoter, Router, WHBAR, and WhbarHelper per network.
  • Payer — Uses CLI operator or --payer; execute signs and sends with that account.

Architecture

  • Manifest-driven registration via PluginManifest.
  • Handlers return CommandExecutionResult (ADR-003).
  • Reuses core: api.contract (contract query), api.txExecution (sign and send), api.keyResolver, api.network; plugin provides constants and path-encoding utils.

Prerequisites

  • Node.js and a configured operator (or --payer) for execute.
  • Network — Set or pass --network mainnet or --network testnet; SaucerSwap is not supported on previewnet/localnet.
  • For token → HBAR or token → token: operator must have the input token associated; for HBAR → WHBAR, operator must have WHBAR associated (e.g. hcli token associate …).

References

@DivyanshGoel20
DivyanshGoel20 requested review from a team as code owners February 21, 2026 14:25
@devmab devmab moved this to In Progress in Hiero CLI Feb 26, 2026
@devmab devmab added this to Hiero CLI Feb 26, 2026
@devmab devmab moved this from In Progress to Backlog in Hiero CLI Mar 2, 2026
@devmab devmab moved this from Backlog to Paused in Hiero CLI May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Paused

Development

Successfully merging this pull request may close these issues.

2 participants