Skip to content

feat(fee-payer): upgrade to accounts SDK relay handler#970

Open
decofe wants to merge 3 commits into
mainfrom
feat/fee-payer-relay-handler
Open

feat(fee-payer): upgrade to accounts SDK relay handler#970
decofe wants to merge 3 commits into
mainfrom
feat/fee-payer-relay-handler

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented May 15, 2026

Summary

Replaces Handler.feePayer from tempo.ts/server with Handler.relay from accounts/server (same handler wallet-next uses).

Why

The old tempo.ts handler lacks fee token resolution — clients had to manually set feeToken on the chain config or the transaction would be sent without one, causing FeeAMM swap errors even when validators accept pathUSD.

What changes

  • Dependency: tempo.tsaccounts (already in workspace catalog at ~0.8.1)
  • Handler: Handler.feePayer()Handler.relay() with features: "all"
  • Multi-chain: Transports for mainnet, moderato, and devnet (resolves chain from tx chainId)
  • Fee token resolution: Relay auto-detects the best fee token from sender balances
  • Auto-swap: Built-in cross-token fee payment when needed
  • Simulation: Balance diffs + fee breakdown in eth_fillTransaction responses

Handler config

Handler.relay({
  cors: false,
  features: "all",
  feePayer: {
    account: privateKeyToAccount(env.SPONSOR_PRIVATE_KEY),
    name: "Tempo Sponsor",
    url: "https://sponsor.tempo.xyz",
  },
  transports: {
    [tempo.id]: http(env.TEMPO_RPC_URL ?? ...),
    [tempoModerato.id]: http(...),
    [tempoDevnet.id]: http(...),
  },
})

Backward-compatible

  • API key auth, admin endpoints, rate limiting — all unchanged
  • Open access at / still works
  • Keyed access at /tp_* still works

…andler.relay

Handler.relay from the accounts SDK provides:
- Fee token resolution (auto-detects best fee token from balances)
- Auto-swap support for cross-token fee payment
- Simulation with balance diffs and fee breakdown
- Multi-chain transport support (mainnet, moderato, devnet)
- Proper AMM liquidity handling

This replaces the older tempo.ts Handler.feePayer which lacked fee
token resolution and could produce transactions with missing/wrong
feeToken fields.

Amp-Thread-ID: https://ampcode.com/threads/T-019e2d80-38fe-76d6-91b5-f1aef2e1caf9
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Cloudflare Deployments

App Environment Status Preview
explorer devnet [OK] Deployed View Preview
explorer mainnet [OK] Deployed View Preview
explorer testnet [OK] Deployed View Preview
fee-payer devnet [OK] Deployed View Preview
fee-payer moderato [OK] Deployed View Preview
fee-payer privy [OK] Deployed View Preview
og - [OK] Deployed View Preview
perf - [OK] Deployed View Preview
reth-snapshots-viewer - [OK] Deployed View Preview
tempo-snapshots-viewer - [OK] Deployed View Preview
tokenlist - [OK] Deployed View Preview

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Bundle Size Report

Metric Size Δ Change
Total 4.6 MB +409.0 KB (+9.4%)
Gzip 1.3 MB +121.8 KB (+9.8%)
Brotli 1.2 MB +106.5 KB (+9.8%)
Chunk changes (>1KB)
Chunk Change
assets/chains.js (removed) -360.7 KB
assets/export-rate-limit.js (removed) -177.3 KB
assets/wagmi.config.js -29.5 KB
assets/AbiItem.js (removed) -27.1 KB
assets/env.js -9.7 KB
assets/validators.js (removed) -5.1 KB
assets/call.js +1.2 KB
assets/parseAbiItem.js (new) +1.6 KB
assets/.js +1.7 KB
assets/_address.js +1.7 KB
assets/router.js +1.9 KB
assets/known-event-totals.js (new) +2.0 KB
assets/tempo-queries.js +2.7 KB
assets/Addresses.js (new) +9.1 KB
assets/schemas.js +22.7 KB
assets/structs.js (new) +23.9 KB
assets/queries.js +26.4 KB
assets/Connectors.js (new) +55.5 KB
assets/token.js +56.1 KB
assets/manifest.js (new) +173.8 KB
...and 2 more

Compared against main branch (baseline from 4/27/2026, 4:02:54 PM)

Handler.relay proxies eth_chainId instead of rejecting with
MethodNotSupportedError. Updated assertions to expect a successful
result instead of an error.

Amp-Thread-ID: https://ampcode.com/threads/T-019e2d80-38fe-76d6-91b5-f1aef2e1caf9
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.

1 participant