Skip to content

Convert ts-sdk to pnpm monorepo with boltz-swap#427

Draft
pietro909 wants to merge 442 commits into
masterfrom
monorepo-pr
Draft

Convert ts-sdk to pnpm monorepo with boltz-swap#427
pietro909 wants to merge 442 commits into
masterfrom
monorepo-pr

Conversation

@pietro909
Copy link
Copy Markdown
Contributor

Summary

Converts this repository into a pnpm workspace monorepo that hosts both @arkade-os/sdk (unchanged in behavior) and @arkade-os/boltz-swap as sibling packages, with shared regtest/CI/release tooling at the root.

All ts-sdk sources now live at packages/ts-sdk/; boltz-swap joins at packages/boltz-swap/ via a subtree merge so its full commit history is preserved and reachable through the merge's second parent.

Structure (4 first-parent commits on top of master)

  1. Move @arkade-os/sdk under packages/ts-sdk/ — pure renames; git log --follow and git blame continue to work.
  2. Add monorepo scaffoldingpnpm-workspace.yaml, root package.json with workspace scripts, shared config/ (tsconfig/vitest/eslint bases), monorepo CI workflows, root scripts/release.sh orchestrator, root README / AGENTS / CLAUDE.
  3. Merge boltz-swap history into packages/boltz-swap/ (subtree) — two-parent merge; second parent is arkade-os/boltz-swap@d30cfbde (v0.3.16 tip at time of PR). Full boltz-swap history available at packages/boltz-swap/ with rename detection.
  4. Adapt boltz-swap for monorepo — drops per-package files now hoisted (.env.regtest, .github/, .gitmodules, regtest submodule) and switches @arkade-os/sdk dep to workspace:*.

How to review

The Commits tab shows ~1100 commits because the boltz-swap subtree merge brings its full history into this PR. That's intentional and desirable for preserving history — but it means the commit tab is not the right place to review the monorepo conversion.

  • For the actual changes, review the Files changed tab against master, or locally:
    • git log --first-parent master..monorepo-pr — the 4 conversion commits
    • git diff master..monorepo-pr — total tree diff

Merge strategy

Use Create a merge commit — do NOT squash or rebase. Squashing flattens the subtree merge and loses the boltz-swap history we worked to preserve.

Test plan

  • pnpm install (root, workspace mode)
  • pnpm run build (ts-sdk + boltz-swap, ts-sdk builds first)
  • pnpm run lint
  • pnpm run test:unit (ts-sdk: 47 files / 790 passing; boltz-swap: 10 files / 255 passing)
  • pnpm run regtest:up && pnpm run regtest:setup && pnpm run test:integration — needs Docker; not run locally by me
  • CI green on this PR

Follow-ups (not in this PR)

  • Hoist remaining duplicated devDeps / per-package pnpm.* overrides to the root (pnpm currently warns about pnpm.onlyBuiltDependencies in package-level package.json)
  • Remove duplicated per-package .prettierrc / .husky / .gitignore now that root versions exist
  • Drop stale per-package pnpm-lock.yaml files once workspace install is the source of truth

Kukks and others added 30 commits February 24, 2026 12:13
The Actions type in swap-manager now includes "signServerClaim" but
the service worker message handler and runtime had hardcoded action
union types that didn't include it, causing DTS build failure.
…untime

The onActionExecuted listener callback type at line 330 also had the
hardcoded action union without signServerClaim.
* fix: make signServerClaim error handling non-fatal

Cooperative server claim signing is a courtesy action — if it fails,
the server can still claim unilaterally. Previously, a failure in
executeSignServerClaimAction would bubble to the outer try/catch in
executeAutonomousAction, triggering swapFailedListeners and making
consumers think the swap failed. Additionally, if no callback was set,
actionExecutedListeners would fire despite nothing actually happening.

Changes:
- executeSignServerClaimAction now returns boolean (true on success)
- Wrap invocation in local try/catch so failures are logged but don't
  propagate to the outer handler or emit swapFailed
- Only emit actionExecutedListeners when the action actually succeeded

* Update src/swap-manager.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Andrew Camilleri <[email protected]>

---------

Signed-off-by: Andrew Camilleri <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Replace the heavy boltz-core (AGPL-3.0, ~2.7MB with transitive deps)
with two lightweight local utilities built on @scure/btc-signer and
@noble/curves — the same libraries boltz-core itself wraps.

New files:
- src/utils/musig.ts: MuSig2 signing wrapper over @scure/btc-signer/musig2.js
- src/utils/boltz-swap-tx.ts: swap tree, taproot utils, claim tx, fee targeting

All 8 boltz-core imports in arkade-chainswap.ts replaced with local equivalents.
Resolve conflicts:
- arkade-chainswap.ts: deleted in refactor (merged into arkade-swaps.ts),
  applied boltz-core removal to arkade-swaps.ts instead
- pnpm-lock.yaml: regenerated without boltz-core
Unify ArkadeLightning + ArkadeChainSwap into ArkadeSwaps
pietro909 and others added 11 commits April 28, 2026 12:31
Mirrors #446: flows that surrender control to remote
peers (Boltz, Ark server, batch participants) can sit idle longer than
the bus deadline. Both page and worker now skip the timeout for them;
worker liveness stays covered by the existing PING /
MESSAGE_BUS_NOT_INITIALIZED path on concurrent short requests.
fix(serviceWorker): exempt long-running messages from timeouts
Lets a user inspect and refund funds stranded at submarine swap lockup
addresses — both successful swaps with extra deposits and failed
swaps that never got refunded. Recovery is explicit; nothing scans on
startup or in the background.

Inspection is Boltz-amnesia-tolerant: it queries only the local repo
and the Ark indexer. Post-CLTV recovery uses the unilateral
refundWithoutReceiver path, so funds remain reachable even if Boltz
purges the swap from its DB.

- inspectSubmarineRecovery / scanRecoverableSubmarineSwaps return a
  structured SubmarineRecoveryInfo (recoverable / pre_cltv / none /
  already_spent / invalid_swap) with no side effects.
- recoverSubmarineFunds wraps refundVHTLC; recoverAllSubmarineFunds
  runs sequentially with per-swap SubmarineRecoveryResult so a single
  failure never aborts the batch.
- refundVHTLC skips the refundable/refunded flag write on
  transaction.claimed swaps to avoid muddling history when sweeping
  stranded extras.
- Wired through IArkadeSwaps, ExpoArkadeSwaps, ServiceWorker message
  handler + runtime; new types exported from src/index.ts.
pietro909 and others added 18 commits April 30, 2026 11:10
  Boltz Ark VHTLCs encode `refund` as an absolute Unix timestamp (CLTV
  timestamp semantics, BIP65 ≥ 500_000_000) and the unilateral fields as
  BIP68 relative delays (seconds when ≥ 512). The block-height locktime
  branch was dead in practice, and the getChainHeight() round trip was
  unnecessary noise.
…os-manual

Add user-initiated submarine VHTLC recovery APIs
Resolved conflicts: keep monorepo root package.json and README; take
arkd v0.9.4 image bump from master in .env.regtest; merge .gitignore
additions from both sides. Applied master packages/ts-sdk/package.json
(v0.4.23) and README directly — rename detection missed those.
Added better-sqlite3 to root onlyBuiltDependencies for new SQLite
migration tests introduced in master.
Subtree pull of 48 upstream boltz-swap commits. Resolved conflicts:
- package.json: keep workspace:* for @arkade-os/sdk (monorepo dep)
- regtest submodule: keep deleted (hoisted to monorepo root)
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.

5 participants