Files
zeekay c1c743cb98 feat(tx): non-EVM unsigned-tx builders for every bridge chain
Implement transfer builders for the six external bridge chains so the
wallet can SEND/bridge beyond EVM. Each is one file over a permissive
offline lib; signing stays in @luxwallet/keyring (builders emit only the
canonical UNSIGNED encoding + the bytes-to-sign).

Ready (broadcastable from the intent alone):
- solana   @solana/web3.js (MIT)  — SystemProgram.transfer -> message bytes
- xrp      xrpl (ISC)             — Payment -> encodeForSigning blob
- ton      @ton/core (MIT)        — internal transfer message -> Cell/BOC + hash
- bitcoin  @scure/btc-signer (MIT)— P2WPKH/P2TR PSBT from UTXOs+outputs

Partial (real payload, caller supplies chain state the builder can't
derive offline — honestly marked "partial", not "ready"):
- polkadot @polkadot/types (Apache-2.0) — balances.transferKeepAlive
           signing payload; needs runtime metadata + era/nonce/versions
- cardano  @emurgo/cardano-serialization-lib (MIT) — tx body + blake2b
           body hash; needs UTXO set + fee/ttl. Async, lazy WASM load.

types.ts: per-chain Intent types; UnsignedTx gains optional `digest`
(bytes-to-sign when != serialized); local BuilderStatus superset adds
"partial". index.ts: BUILDER_STATUS table (5 ready / 2 partial / 4 todo).
stubs.ts: only Lux-native families (P/X/atomic/Z) remain "todo"; svm stub
removed (Solana real). Each builder has a vitest with real round-trip /
byte-equality assertions (Polkadot uses real Polkadot V14 metadata).

All deps MIT/Apache/ISC (verify-clean gate passes; LGPL rpc-websockets is
a transitive @solana/web3.js dep off the offline code path). Bump 0.2.0.

typecheck + 34 tests pass; full workspace green.
2026-06-24 15:28:35 -07:00

3.4 KiB

@luxwallet/sdk

The unified Lux Wallet shared core. One TypeScript codebase that the web wallet, the browser extension, and (via WASM/UniFFI) the native iOS/Android wallets build on — so chain metadata, RPC routing, crypto, the account model, and tx construction are defined once.

MIT licensed. pnpm workspace.

Architecture

@luxwallet/sdk is an umbrella that re-exports independent modules. Use the umbrella for convenience, or depend on a single module directly for tighter trees.

Package What it is Status
@luxwallet/chains Chain registry — ONE source of truth. Emits chains.json for native consumers. real
@luxwallet/rpc Gateway RPC client: https://<gateway>/v1/rpc/<chainId>. real
@luxwallet/crypto Facade over the luxfi/crypto C core (classical + PQ). interface real, impl pending WASM/native bind
@luxwallet/keyring Account model + keystore (classical + ML-DSA-65 + SLH-DSA recovery). store real, crypto calls pending
@luxwallet/tx Per-VM unsigned-tx builders. EVM + Solana/XRP/TON/Bitcoin real; Polkadot/Cardano partial (caller-supplied chain state); Lux P/X/UTXO/ZK stubbed. 5 ready, 2 partial, Lux-native todo
@luxwallet/sdk Umbrella barrel re-exporting the modules. real

connect / SIWx is a separate module

Wallet connection + Sign-In-With-X lives in its own repo, luxwallet/connect — npm @luxwallet/connect, Go github.com/luxwallet/connect/go. This SDK does not duplicate or vendor it. Install it alongside and import it directly:

pnpm add @luxwallet/sdk @luxwallet/connect
import { chains, rpc, tx } from "@luxwallet/sdk";
import { /* SIWx */ } from "@luxwallet/connect";

Cross-language plan

The same primitives reach native wallets without a second implementation:

  • JS (web + extension): luxfi/crypto compiled to WASM, wrapped to the @luxwallet/crypto CryptoBackend interface and injected via setBackend.
  • Native (iOS/Android): luxfi/crypto bound via UniFFI over its C ABI, exposing the identical CryptoBackend.
  • Chain data: @luxwallet/chains emits chains.json; Kotlin/Swift read that artifact so every platform keys on the same chain ids.
  • UI lives in a separate repo, luxwallet/ui, built on @hanzo/gui. This SDK is headless.

The crypto used by the wallet is the same luxfi/crypto the chain uses — never @noble/post-quantum, never a hand-rolled precompile wire format. See packages/crypto/LLM.md.

Develop

pnpm install              # workspace install
pnpm -r typecheck         # tsc --build across all packages (project refs)
pnpm -r test              # vitest across all packages
pnpm verify               # license/dep hygiene gate (no @noble PQ, no GPL)
pnpm chains:emit          # regenerate packages/chains/chains.json

Each package is @luxwallet/<name>, MIT, ESM, with a react-native + browser/default export condition so native runtimes can consume it.

Status

Scaffold. The registry, RPC routing, and the EVM unsigned-tx builder are real and tested. The crypto facade and keyring define exact interfaces with stubs that throw "not yet bound"; the WASM/native crypto binding and the non-EVM tx builders are tracked in each package's LLM.md.