Skip to content

feat(cli): bb swap execute — BitBadges-only auto-deploy, throw on Skip:Go-rerouted#249

Merged
trevormil merged 1 commit into
mainfrom
feat/swap-execute-auto-deploy
May 17, 2026
Merged

feat(cli): bb swap execute — BitBadges-only auto-deploy, throw on Skip:Go-rerouted#249
trevormil merged 1 commit into
mainfrom
feat/swap-execute-auto-deploy

Conversation

@trevormil
Copy link
Copy Markdown
Collaborator

Summary

Implements backlog ticket 0440: closes the estimate→swap gap in bb swap without adding a second keyring or a cross-chain orchestrator.

  • New bb swap execute [estimate] (stdin - / @file / inline JSON) and bb swap estimate --execute.
  • Whole-route detection (not per-msg first-hop): a route is BitBadges-only iff it is a single native gamm SwapExactAmountIn on a bitbadges-* chain, every assetPath chainId is bitbadges-*, and there is no Skip:Go reroute / EVM tx / IBC-transfer leg / WETH redirect.
  • BitBadges-only → reuse the shared addDeployOptions signing flags. Default (no deploy flag) emits the signable {typeUrl,value} so bb swap execute … | bb deploy and scripting keep working; --browser broadcasts via the canonical /sign handoff. --track auto-seeds the swap activity row; --force gates compliance/low-liquidity-flagged routes.
  • Routed through any other chain → the estimate is still returned, but the execute path throws an explicit NOT_IMPLEMENTED pointing at /sign + bb swap track. No partial execution, no orchestrator.
  • The signable typeUrl is the TxModal alias gamm/SwapExactAmountIn that the /sign page's messageTypes registry is keyed by (mirrors the frontend parseSkipGoMsgsToTxInfo); the proto type URL would be a registry miss and the wallet could not reconstruct the msg.
  • --burner is explicitly refused for swaps (it is CREATE-collection only) rather than failing opaquely downstream.

Test plan

  • swap.spec.ts: command-shape (new execute subcommand + --execute/--force/--track + reused --browser/--burner/--sign-only on estimate).
  • swap.spec.ts: exported pure classifyBitBadgesOnlySwap covering the three routing branches — BitBadges-only executable; rerouted/EVM/IBC/WETH/non-bitbadges refused; multi-hop refused; failed-estimate refused; bare-vs-wrapped estimate input.
  • Full swap.spec.ts green (19/19). (Pre-existing src/cli/integration/ suites need a built dist/ and are excluded by the repo's own npm test.)
  • Docs: for-developers/cli/ swap docs update tracked separately in the docs repo.

🤖 Generated with Claude Code

…outed

`bb swap execute` and `bb swap estimate --execute` take a swap estimate,
detect whether the whole route is BitBadges-only (single native gamm
SwapExactAmountIn on a bitbadges chain, no Skip:Go rerouting / EVM / IBC
leg / WETH redirect), and if so sign+broadcast it by reusing the
existing shared deploy signing flags (--browser via the /sign handoff;
default emits the signable msg for `| bb deploy`). Optional --track
seeds the swap activity row; --force gates flagged routes.

Anything routed through another chain still returns the estimate but the
execute path throws an explicit NOT_IMPLEMENTED — no orchestrator, no
partial execution, no second/EVM keyring (ticket 0440 design).

The signable typeUrl is the TxModal alias `gamm/SwapExactAmountIn` the
/sign messageTypes registry is keyed by (mirrors the frontend
parseSkipGoMsgsToTxInfo) — the proto type URL would be a registry miss.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@trevormil trevormil merged commit 77b087a into main May 17, 2026
3 checks passed
@trevormil trevormil deleted the feat/swap-execute-auto-deploy branch May 17, 2026 12:39
trevormil added a commit that referenced this pull request May 17, 2026
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.

1 participant