@sun-protocol/wallet-cli-sunswap-plugin
v0.1.0-next.1
Published
SunSwap commands for wallet-cli
Readme
@sun-protocol/wallet-cli-sunswap-plugin
sunswap is a plugin for wallet-cli. SunSwap is a decentralized exchange (DEX) on
TRON. The plugin swaps tokens, adds and removes SunSwap liquidity and collects its fees, and looks up pools,
positions, tokens and prices.
It needs wallet-cli with plugin support (Requirements) and a TRON network. With the
built-in configuration the market queries and swap run on mainnet, the liquidity commands and
position-info on mainnet and Nile; a network's settings change that. No credentials; the settings are in
Credentials and settings.
Requirements
- wallet-cli with plugin support and a plugin SDK of version 1.0 or a later 1.x (this package declares
sdkVersion^1.0.0). Plugin support is on wallet-cli'sfeat/plugin-architecturebranch and not yet in a release. - Node.js 22.23.4+, 24.22.1+ or 26.12.1+.
Install
wallet-cli installs a plugin only by its npm package name. This package is not on npm yet; until it is,
publish it to a private or local npm registry and set pluginRegistry to it, as the
wallet-cli plugins guide describes.
wallet-cli plugin install @sun-protocol/wallet-cli-sunswap-plugin
wallet-cli plugin listCommands
| Command | What it does |
|---|---|
| sunswap add-liquidity | Add liquidity to a pool |
| sunswap remove-liquidity | Withdraw liquidity from a pool |
| sunswap collect-fees | Collect a position's earned fees |
| sunswap swap | Swap tokens through SunSwap or a SunPump curve |
| sunswap position-list | List the liquidity positions held by an address |
| sunswap position-info | Show one SunSwap V3 or V4 position |
| sunswap pool-list | List pools, ranked by TVL, volume, fees or APR |
| sunswap pool-search | Search pools by token symbol or pool address |
| sunswap token-list | List the tokens traded on SunSwap |
| sunswap token-search | Search the tokens traded on SunSwap by symbol |
| sunswap price | Show the USD price of one or more tokens |
wallet-cli sunswap <command> --help shows the options of each command. What the plugin adds to wallet-cli's
JSON output and error codes is in machine-interface.md.
Credentials and settings
No credentials. The plugin reads the sunswap block of a network in wallet-cli's config.yaml, merged
over the builtin defaults field by field, so an explicit false turns a default off:
networks:
nile:
sunswap:
marketApiBaseUrl: https://example.test # http(s) URL; the market API and price source
routerApiBaseUrl: https://example.test # http(s) URL; the swap route service
liquidity: true # contract-backed liquidity
sunpump:
curve: true # bonding-curve tradesswap also reads curve from the sunpump block, which turns on trades on the bonding curve of a
SunPump token; the separate sunpump plugin need not be installed. Mainnet has every service by default;
Nile has liquidity only. An invalid sunswap or sunpump block fails the commands with invalid_value.
License
MIT. The licences of the third-party packages bundled into dist/index.mjs are in
dist/THIRD_PARTY_LICENSES.txt.
