Skip to content

CLI + SDK Improvements#430

Merged
its-everdred merged 80 commits into
mainfrom
kevin/swap-perf
May 8, 2026
Merged

CLI + SDK Improvements#430
its-everdred merged 80 commits into
mainfrom
kevin/swap-perf

Conversation

@its-everdred
Copy link
Copy Markdown
Collaborator

@its-everdred its-everdred commented Apr 27, 2026

Summary

Three SDK performance wins that cut a USDC→OP swap on Base Sepolia from ~18s to ~6-9s wall time, plus a CLI demo config tweak so recurring swaps skip the per-call approval cost. A handful of incidental SDK cleanups along the way.

Performance

  • Drop redundant double-wait in EOAWallet.sendBatch. Was waiting for 2 confirmations between txs; one is enough. Saves a full block-time per sub-tx in a multi-tx batch.
  • Lower receipt polling for fast L2s. viem's default pollingInterval is 4000ms (sized for L1 mainnet). Default to 1500ms for fast chains; mainnet stays at 4000ms. Configurable per-chain. Bundler client shares the same default.
  • Attach a nonce manager to the EOA wallet. Avoids nonce contention when the same signer dispatches concurrent txs.
  • Demo CLI opts into approvalMode: 'max' for both lend and swap settings in packages/cli/src/demo/config.ts. Subsequent swaps for the same token pair skip Permit2 + ERC-20 approval txs entirely.

SDK / demo cleanup

  • New SDK helpers: getLendMarketAllowlist, Wallet.has(namespace) capability check, CHAIN_SHORTNAMES constant.
  • Barrel exports: LEND_ACTIONS, LendProviderName, ApprovalMode / APPROVAL_MODES.
  • getMarket now takes the market directly.
  • Demo markets switched to getAssetAddress.
  • Lend help examples derived from the live config instead of hardcoded.
  • Lend providers iterator narrowed to skip the settings key.
  • Demo config guarded against mainnet; unichain dropped from the demo chain set and CLI resolver.
  • format DeployMorphoMarket prettier drift.

Test plan

  • SDK unit tests pass
  • CLI tests pass (195 / 195)
  • Backend + frontend tests pass
  • Local CLI smoke: USDC→OP swap on Base Sepolia, first run includes approvals, second run is approval-free
  • Verify wall-time reduction vs `feat/cli-swap` baseline

Notes

  • Targets `feat/cli-swap` (the upstream CLI base) rather than `main` so it can land alongside the CLI work.
  • The Velodrome universal-router EOA fix and Uniswap v4 exact-out action-byte fix have already shipped via separate PRs (fix(sdk): correct V4 SWAP_EXACT_OUT_SINGLE action byte #441 et al.); duplicate commits will drop out when this branch is rebased after `feat/cli-swap` next merges `main`.

@its-everdred its-everdred changed the title perf(sdk): faster swap dispatch + max approval default for demo CLI CLI Improvements May 7, 2026
Comment on lines 96 to -91
const receipt = await this.send(tx, chainId)
const publicClient = this.chainManager.getPublicClient(chainId)
// wait an extra confirmation so give time for nonce to be updated
await publicClient.waitForTransactionReceipt({
hash: receipt.transactionHash,
confirmations: 2,
})
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safe to remove the waitForTransactionReceipt altogether because this.send() already awaits confirmation.

@its-everdred its-everdred changed the title CLI Improvements CLI + SDK Improvements May 7, 2026
@its-everdred its-everdred marked this pull request as ready for review May 7, 2026 22:42
@its-everdred its-everdred requested a review from a team as a code owner May 7, 2026 22:42
@its-everdred its-everdred requested review from lucasmoore and removed request for a team May 7, 2026 22:42
@its-everdred its-everdred requested a review from a team May 7, 2026 23:39
Copy link
Copy Markdown
Contributor

@jefr90 jefr90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 lgtm

Base automatically changed from feat/cli-swap to main May 8, 2026 20:47
@its-everdred its-everdred merged commit 72bd629 into main May 8, 2026
7 checks passed
@its-everdred its-everdred deleted the kevin/swap-perf branch May 8, 2026 20:48
@opgitgovernance opgitgovernance mentioned this pull request May 8, 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.

2 participants