feat(cast): add --sponsor-url for remote Tempo fee payer sponsorship#14790
Draft
decofe wants to merge 9 commits into
Draft
feat(cast): add --sponsor-url for remote Tempo fee payer sponsorship#14790decofe wants to merge 9 commits into
decofe wants to merge 9 commits into
Conversation
Adds --sponsor-url (alias --tempo.sponsor-url) to cast send. When set, the transaction is signed locally and forwarded to the remote sponsor service via eth_sendRawTransaction. The service adds its fee payer signature and broadcasts the sponsored transaction. Usage: cast send 0x... --sponsor-url https://sponsor.tempo.xyz/tp_abc123 This works with the existing fee-payer service in tempo-apps without any changes — no new RPC methods required. The sponsor URL can also be set via TEMPO_SPONSOR_URL env var. Amp-Thread-ID: https://ampcode.com/threads/T-019e2d8c-7750-71a5-924c-2394c0c4e070
…nsor_url - Use eth_signRawTransaction to get the sponsored tx from the service, then submit via the regular RPC's send_raw_transaction. This matches the viem withFeePayer sign-only protocol. - Clone sponsor_url instead of take() so it's still present when TempoOpts::apply() runs, ensuring nonce_key=0 is set and the tx builds as a Tempo AA (0x76) type instead of EIP-1559 (0x02). - Handle sponsor service error responses that have name/code but no message field. Amp-Thread-ID: https://ampcode.com/threads/T-019e2d8c-7750-71a5-924c-2394c0c4e070
- Sign sponsored Tempo payload by setting a placeholder fee_payer_signature before local signing, so the sender commits to the sponsored variant - Bail out when --sponsor-url is combined with --unlocked, --browser, or a Tempo access key instead of silently ignoring it - Validate sponsor URL scheme (require https://, allow http only for localhost/127.0.0.1) - Tighten JSON-RPC response parsing: accept arbitrary result types, drop non-standard 'name' error field Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--sponsor-url(alias--tempo.sponsor-url) tocast send. When set, the transaction is signed locally, then the raw signed bytes are forwarded to the remote sponsor service viaeth_sendRawTransaction. The service adds its fee payer signature and broadcasts the fully-sponsored transaction.Usage
Or via env var:
How it works
TxEnvelopeto raw RLP byteseth_sendRawTransactionto the sponsor URLNo new RPC methods required — works with the existing fee-payer service as-is.
Changes
crates/cli/src/opts/tempo.rs: New--sponsor-url/--tempo.sponsor-urlarg onTempoOpts, conflicts with--tempo.sponsor/--tempo.sponsor-signer/--tempo.sponsor-sig. Forces AA tx type (sets nonce_key=0) like the existing sponsor flow.crates/cast/src/cmd/send.rs: New case inrun_genericthat signs locally, encodes, and sends to the sponsor URL. Addedsend_via_sponsor_urlhelper.crates/cast/Cargo.toml: Addedreqwestdirect dependency for the HTTP call.