Sunpump add#34
Merged
Merged
Conversation
- New `sun sunpump` command group covering token info, transactions, klines, portfolio, red-packet, referral, home, campaign and admin endpoints. Default base URL is mainnet (api-v2.sunpump.meme); pass global `--network nile` to hit the Nile testnet (tn-api.sunpump.meme), or `SUNPUMP_API_BASE_URL` for a custom host. - Pretty rendering: dedicated table configs for tokens, holders, txs, klines, portfolio and campaigns; key/value detail view for `token get`; curated price/MCap fallback so missing `trxPriceInUsd` no longer produces `$0`. - Shared helpers: `extractList` recognizes `campaigns`/`banners`; `readPagination` descends into `pageData`/`metadata` and accepts `size` as a `pageSize` alias. - Better error surfacing: HTTP-error messages now include the SunPump `msg` body so failures like an unknown `rankingType` are explicit. - README + docs note the mainnet/nile URLs, valid ranking enums (`MARKET_CAP`/`VOLUME_24H`/`PRICE_CHANGE_24H`) and the server-side 15-row cap on `tx ticker`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New write commands (writeAction → wallet + confirm + dry-run + Tronscan link): - `sunpump buy <addr> --trx <decimal>` spends TRX on a bonding-curve token - `sunpump sell <addr> --amount <decimal> [--decimals 18]` sells back to TRX - Both accept `--slippage` (default 5%) and `--min-out <raw>`. The summary shown before the confirmation prompt includes a live quote. Read commands: - `sunpump state <addr>` prints the on-chain state with named labels (0 NOT_EXIST / 1 TRADING / 2 READY_TO_LAUNCH / 3 LAUNCHED). The sun-kit enum only documents 0-2 but the contract uses 3 for launched-on-DEX, so labels fall back to `UNKNOWN (n)` for anything we don't recognise. - `sunpump quote-buy` / `sunpump quote-sell` preview a trade without sending. Wraps `kit.sunpumpBuy/Sell/QuoteBuy/QuoteSell/getSunPumpTokenState/Info`. Decimal inputs are scaled CLI-side (TRX × 1e6 to Sun; tokens × 10^decimals) so users never have to type raw base units. State enum mapping plus the existing `--network nile` switch route to mainnet/testnet SunPump deployments. README documents the trade commands, decimal handling and slippage default. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
These endpoint groups didn't earn their keep: - `sunpump home` (stats/data/banners) — site-chrome data agents don't need - `sunpump tx ticker` — server hard-caps at 15 rows regardless of N - `sunpump kline` (v1/v2/v3) — three near-identical OHLCV variants - `sunpump red-packet` (get/remain/by-user/summary) — Sun Agent campaign feature, not core trading - `sunpump campaign` (list/banners) — marketing assets, not on-chain data Removes the CLI registrations, the SunPump client methods, the unused table configs and helpers (`klineTable`, `campaignTable`, `truncate`, `campaignStatus`, `toNumOrUndef`), and the matching `extractList` branches in `lib/output.ts`. README examples and the signed-message note in the SunPump section are pruned to match. What stays: `token` (info/search/holders/ranking/king-of-hill/etc), `tx token` + `tx user`, `portfolio`, `referral`, `admin-summary`, `quota`, plus the trading commands `state` / `quote-buy` / `quote-sell` / `buy` / `sell`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes the `sun sunpump admin-summary` command and the matching `adminSummary()` method on the SunPump client. The endpoint (`/data/summaryLaunchedTokenInfo`) requires an admin password and is not appropriate for an end-user CLI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes `sun sunpump referral rewards` / `sunpump referral invites` and the `referralRewards()` / `referralInvites()` SDK methods. Referral program data is internal-account-management surface, not part of the core trading + discovery loop this CLI is for. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes `sun sunpump quota` and the `thirdPlatQuota()` SDK method. The endpoint queries SunPump's internal third-platform integration quota — not relevant to end-user trading or discovery. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Nile-equivalent host `tn-api.sunpump.meme` is an internal-only
service — not publicly reachable. The SunPump bonding-curve contract
on Nile is being retired too. Removing nile from every SunPump path:
- `lib/sunpump.ts`: drop `SUNPUMP_NILE_BASE_URL`, `SUNPUMP_MAINNET_BASE_URL`,
`SunPumpNetwork` type, `sunPumpBaseUrlFor()`, and the network-aware
client cache. `getSunPump()` is back to a plain singleton; the
constructor resolves the base URL from `baseUrl` arg → env
`SUNPUMP_API_BASE_URL` → `SUNPUMP_DEFAULT_BASE_URL` (mainnet).
- `commands/sunpump.ts`: replace the `currentNetwork` / preAction
network-switching machinery with `assertMainnet()`, which the `sp`
preAction hook calls so every sunpump subcommand (read or trade)
bails fast on non-mainnet with:
SunPump is only available on mainnet (got "<network>").
Drop --network or pass --network mainnet.
- README + SunPump section: reflect mainnet-only behaviour; drop the
nile URL line and the "switch with --network nile" hint.
Behaviour verified locally: `sun sunpump token list` works on mainnet,
`sun --network nile sunpump token list` and `sun --network nile sunpump
state ...` both fail fast with the new error.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Will-Guan
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add sunpump get apis