Skip to content

feat: add launch token support and require node 22 - #31

Merged
pbennett merged 5 commits into
mainfrom
feat/sdk-refresh
Oct 16, 2026
Merged

pbennett merged 5 commits into
mainfrom
feat/sdk-refresh

Conversation

@pbennett

@pbennett pbennett commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Breaking change

@txnlab/haystack-router now requires Node.js 22 or later (engines.node >=22, build target node22). This releases as 3.0.0.

Squash-merge note: semantic-release reads only the squash commit, and the BREAKING CHANGE: footer is what triggers the major bump. Keep this footer in the squash message. Don't add ! to the title: the angular preset's header pattern doesn't accept it, and the commit would drop out of the Features section.

BREAKING CHANGE: @txnlab/haystack-router now requires Node.js 22 or later.

Published SDK

Launch tokens (HayLaunch, before bonding completes)

  • fetchQuote/newQuote accept an optional slippage (at least 0, under 100), validated before the API call.
  • quote.launch is normalized to bigints (side, tokenNum, bondingTokenId, bondingSurplus, refund, graduates), including in the quote middleware sees.
  • The SwapQuote from newQuote records the slippage it was fetched with; newSwap warns if a launch quote is executed at a different slippage.
  • getSummary().launch reports side, tokenNum, curveTxnId, bondingAmount and refund. A buy's output is the curve call's ARC-4 return value; a sell's input is the launch tokens sold.
  • New "Launch Tokens (Pre-Bonding)" section in the SDK README.

Behavior change for all swaps: getInputTransactionId() and the optional note now go on the user-signed transfer to the router's app address, falling back to the last user-signed transaction. Regular swaps have one user-signed transaction, so they are unaffected.

Other: two re-thrown composer errors now keep the original as cause.

Examples (not published)

  • use-wallet v5 with per-wallet packages (Pera, Defly, and Lute via @galaxypay/use-wallet-lute, replacing the deprecated lute-connect). resetNetwork dropped, since v5 no longer persists the network by default.
  • React 19, Vite 8, plugin-react 6, dotenv 18 (CLI example uses quiet: true).
  • READMEs updated to Node 22 or later.

Repo tooling

  • Root engines: ^22.22.2 || >=24.15 (required by the semantic-release plugins).
  • TypeScript 6.0.3 (typescript-eslint doesn't support 6.1 yet), ESLint 10, Vitest 5, tsdown 0.23.1, semantic-release changelog 7 / git 11.
  • .claude/CLAUDE.md rewritten; the unloaded commit-message skill file is folded into it.

Testing

  • Launch tests with buy/sell fixtures from mainnet groups (router signatures redacted), plus launch cases in client.test.ts. 232 tests; pnpm run ci and the example builds pass.
  • Three mutation-testing rounds found no production bugs; the remaining coverage gaps were closed and each new test checked against its mutation.

Note for the router team (not blocking)

Quote amounts above 2^53 lose precision as JSON numbers.

Fix the single-test command (pnpm --filter ... exec vitest) and the middleware hook names (adjustQuoteParams/beforeSwap/afterSwap). Document the swap flow, group ordering, swap-txn re-signing, Tinyman v1 and logger gotchas, the examples build CI runs, and the release process.

Fold the commit conventions from .claude/skills/commit-messages.md into CLAUDE.md and delete that file; as a flat .md under skills/ it was never loaded as a skill.
- algosdk 3.8.0; React examples on @txnlab/use-wallet-react v5 with per-wallet adapter packages (@txnlab/use-wallet-pera, @txnlab/use-wallet-defly, @galaxypay/use-wallet-lute) replacing the direct connector deps and the deprecated lute-connect
- React 19, Vite 8, @vitejs/plugin-react 6, ESLint 10, Vitest 5, tsdown 0.23, dotenv 18, semantic-release changelog 7 / git 11
- TypeScript 6.0.3 (typescript-eslint supports <6.1); @types/node stays on 22.x per renovate pin
- composer: attach the caught error as cause when re-throwing (ESLint 10 preserve-caught-error)
- node-cli: call dotenv config({ quiet: true }) to suppress dotenv 18's startup log
- Node 22 baseline: SDK engines >=22 (build target node22); root engines ^22.22.2 || >=24.15 for tooling; READMEs updated
Conflicts in package.json files and the lockfile resolved to the newer version on each side: main's algosdk 3.9.0, tsdown 0.23.1, prettier 3.9.10 and typescript-eslint 8.71.2, and this branch's majors (ESLint 10, Vitest 5, TypeScript 6, semantic-release plugins, React 19, use-wallet v5, dotenv 18). Lockfile regenerated from main's.
Support quoting and executing swaps of HayLaunch launch tokens before
bonding completes.

- fetchQuote/newQuote accept an optional slippage (0 to under 100),
  validated before the API call; newQuote records it on the SwapQuote.
- quote.launch is normalized to bigints, including for middleware.
- newSwap warns when a launch quote is executed at a different slippage
  than it was fetched with.
- getSummary() adds launch details (side, tokenNum, curveTxnId,
  bondingAmount, refund). A buy's output is the curve call's ARC-4
  return value; a sell's input is the number of launch tokens sold.

Behavior change for all swaps: getInputTransactionId() and the optional
note now go on the user-signed transfer to the router's app address,
falling back to the last user-signed transaction. Before, they went on
whichever transaction the user signed. Regular swaps have one
user-signed transaction, so they are unaffected.

BREAKING CHANGE: @txnlab/haystack-router now requires Node.js 22 or
later.
@pbennett
pbennett requested a review from drichar October 15, 2026 03:23
drichar
drichar previously approved these changes Oct 15, 2026

@drichar drichar left a comment

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.

Nice work on this, review of the code changes looks good. Left some minor inline comments.

About the commit/release: the semantic release preset we use (angular) doesn't recognize feat!: (TIL). I ran the commit-analyzer and release-notes-generator against a few versions:

  • feat!: with no footer: no release at all
  • feat!: with the BREAKING CHANGE: footer: 3.0.0, but the entry shows up as a raw line with no "Features" heading
  • feat: with the BREAKING CHANGE: footer: 3.0.0 with correct notes

So the footer is what triggers the major bump, but the ! messes up the changelog. Let's squash with:

feat: add launch token support and require node 22 (#31)

BREAKING CHANGE: @txnlab/haystack-router now requires Node.js 22 or later.

(Trim GitHub's default squash body down to just that so all the individual commits don't end up in the notes.)

I can address the minor comments myself and merge if it's easier, lmk. Approved 👍

Comment thread packages/haystack/README.md Outdated
Comment thread README.md Outdated
@pbennett pbennett changed the title feat!: add launch token support and require node 22 feat: add launch token support and require node 22 Oct 15, 2026
@pbennett
pbennett merged commit 359eea6 into main Oct 16, 2026
1 check passed
@pbennett
pbennett deleted the feat/sdk-refresh branch October 16, 2026 02:53
txnlab-release-bot Bot added a commit that referenced this pull request Oct 16, 2026
# [3.0.0](v2.0.5...v3.0.0) (2026-10-16)

### Features

* add launch token support and require node 22 ([#31](#31)) ([359eea6](359eea6))

### BREAKING CHANGES

* @txnlab/haystack-router now requires Node.js 22 or later.
@txnlab-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

2 participants