Skip to content

feat: stateless build and submit, one signer seam per chain, Privy wallets (#682) - #734

Draft
fengtality wants to merge 1 commit into
feat/launch-connectorsfrom
feat/build-and-submit
Draft

fengtality wants to merge 1 commit into
feat/launch-connectorsfrom
feat/build-and-submit

Conversation

@fengtality

Copy link
Copy Markdown
Contributor

Draft. This PR holds all of the stateless build-and-submit work in one place. We are not yet sure it is needed upstream, so it stays a draft.

It replaces these PRs: #727 (Solana build coverage), #730 (signer seam), #728 (EVM build + submit), #732 (last build twins), #729 (Privy signer), and the build half of #721.

What it adds

  • Solana build mode. A build-* route runs the connector's own code and captures the transaction at the signing chokepoint, without broadcasting it. Every Solana transaction route has a build twin: router, clmm, amm and launch, including create-pool, create-token, claims, migrate, wrap and unwrap. It also adds multi-transaction builds and lookup tables, POST /chains/solana/build-transaction and POST /chains/solana/submit.
  • EVM build mode. Every EVM send goes through Ethereum.sendTransactionForWallet. A build returns the unsigned transaction, plus any approvals to send first. It adds POST /chains/ethereum/submit.
  • Signer seam (Wallet security architecture: unified signer seam, generate-in-place keys with restore proof, per-wallet signing policy #673 proposal 1). One signer interface per chain, with local, hardware, external (build-only) and privy backends.
  • Privy. Privy server wallets as a signer backend. Credentials come only from env (PRIVY_APP_ID, PRIVY_APP_SECRET, PRIVY_AUTHORIZATION_KEY).
  • Build options. Build routes take feePayer, format, memo, references, priority and platformFee.
  • Route-coverage test (test/wallet/transaction-routes.test.ts). Every transaction route has a build twin, with no gaps.

Base. feat/launch-connectors-only (launch connectors only). When #721 is reduced to that, retarget this PR onto #721. The CI workflow does not run on stacked bases, so only Greptile reviews this PR until it targets development.

Local results. pnpm build passes, pnpm lint has 0 errors, and pnpm test -w 3 passes 209 suites (1972 tests).

Closes #682

🤖 Generated with Claude Code

…and Privy wallets (#673, #682)

Every Gateway route that sends a transaction gets a build-* twin that
returns the unsigned transaction, and POST /chains/{chain}/submit
broadcasts what the caller signed. Every execute route signs through one
signer seam per chain, with local, hardware, external and Privy wallets
behind it. This is the build half of the old #721 and the content of
#727, #730, #728, #732 and #729, on top of the launch connectors.

Solana build mode (from #721)
- A build-* route runs the connector's own code and captures the
  transaction at Solana.sendAndConfirmTransactionForWallet instead of
  signing it: simulated, compute budget sized, fresh blockhash, ephemeral
  keypairs partial-signed, fee-payer slot empty. A broadcast attempted
  during a build throws; nothing is sent.
- Routes: router build-swap and build-quote; clmm build-swap, build-open,
  build-add, build-remove, build-collect-fees, build-close and
  build-create-pool; amm build-swap, build-add, build-remove and
  build-create-pool; launch build-swap and build-create-token;
  POST /chains/{chain}/build-transaction for caller instructions; and
  POST /chains/{chain}/submit, which re-merges the ephemeral signatures and
  verifies every signature and the blockhash before it broadcasts.
- The build shape on every build route: extraInstructions, feePayer,
  format (transaction or instructions), memo, references (Solana Pay) and
  priority (normal, high, urgent).
- platformFee on builds, paid to a recipient the caller names (Jupiter
  through its feeAccount, other venues by a transfer after the
  operation). Router quotes take platformFeeBps.
- pancakeswap-sol build routes are refused by name. poll reports
  currentBlockHeight beside the slot.
- Build routes are behind the API-token gate with their execute routes;
  submit stays public like poll.

Build coverage (#727)
- One build response for an operation of several transactions; a wide
  Meteora DLMM open, add, remove, close or collect builds as one response.
- collect-fees and build-collect-fees for Meteora DAMM v2.
- build-claim-creator-fees and build-migrate; creator-fee claims on
  meteora and raydium.
- pump: a dev-buy create names its lookup table, or has one made for it;
  each new lookup table gets its own slot, and a create after a new table
  compiles with the build's fee payer.
- build-transaction takes feePayer, memo and priority. A legacy build's
  compute is sized against the RPC's own blockhash.
- raydium AMM v4 add gives the non-limiting side its slippage headroom.

Signer seam (#730)
- The signer seam interface and the wallet record. Every Solana and EVM
  transaction is signed through it.
- External wallets: Gateway holds no key, and a route that would sign for
  one refuses and names its build twin.
- The key-handling helpers the seam replaced are deleted, with the old
  ledger helpers.
- The route-coverage test: every route that sends a transaction is listed
  with its build twin, and only the seam signs.

EVM build and submit (#728)
- build-* twins and submit for every EVM transaction route. A build
  returns the unsigned transaction with the approvals it needs first.
- Tests for build mode, approvals, submit and the EVM build routes.
- The uniswap execute-quote Permit2 check moved to
  Ethereum.requirePermit2Allowance, so its own test
  (executeQuote-permit2-expiration.test.ts) is deleted; the EVM build-mode
  tests cover the Permit2 path with the max uint48 expiration.

The last build twins (#732)
- Solana build-wrap and build-unwrap, and launch build-quote. The route
  table has no gaps.

Privy wallets (#729)
- A Privy server-wallet REST client with request signing and error
  mapping.
- The privy signer backend on the seam, and the add-privy and
  create-privy routes.
- EVM quantities go to Privy as minimal hex. Wallet list stores change
  through updateListStore, one update at a time.
- The Privy seam test calls the EVM chokepoint the way #728 left it.

openapi.json is regenerated.

Closes #682
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.

2 participants