Skip to content

feat: add sendCalls execution logic and request normalization helpers#2235

Merged
DanielSinclair merged 2 commits intomasterfrom
03-06-feat_sendcalls_execution_and_normalization
Mar 20, 2026
Merged

feat: add sendCalls execution logic and request normalization helpers#2235
DanielSinclair merged 2 commits intomasterfrom
03-06-feat_sendcalls_execution_and_normalization

Conversation

@janek26
Copy link
Contributor

@janek26 janek26 commented Mar 16, 2026

Add sendCalls execution logic and request normalization helpers

Pure library code for executing EIP-5792 batches and normalising provider requests into a shape the existing SendTransaction UI can work with. No UI changes, no wiring — just functions.

What's included

  • executeSendCallsBatch – Takes SendCallsParams + sender address, executes via the delegation SDK's executeBatchedTransaction, records the resulting tx with addNewTransaction, and returns { success, txHashes } or { success: false, error }.
  • normalizeRequest.ts – Helpers that let the approval screen handle both eth_sendTransaction and wallet_sendCalls uniformly:
    • isSendCallsParams / isWalletSendCallsRequest – type guards
    • getTransactionRequestFromRequest – extracts the first call as a TransactionRequest for single-tx display
    • getTransactionRequestsFromRequest – returns all calls as TransactionRequest[] for simulation and gas estimation
    • getChainIdForRequest – prefers the batch's explicit chainId over the session default

Design choices & review focus

  • Delegation-only pathexecuteSendCallsBatch requires delegation support. If the wallet or chain doesn't support it, it returns a clean error rather than falling back to sequential sends. This is intentional: EIP-5792 atomic means all-or-nothing.
  • Gas from store – Uses useGasStore.getState().selectedGas to get EIP-1559 params. This works because the approval popup has already populated the gas store by the time execution runs.

PR-Codex overview

This PR enhances the sendCalls functionality by introducing a new batch execution method, improving type definitions, and adding validation for wallet_sendCalls requests. It also includes error handling for delegation support and gas parameters.

Detailed summary

  • Added SendCallsParams and RequestCapability exports in src/core/sendCalls/types.ts.
  • Implemented executeSendCallsBatch in src/core/sendCalls/executeSendCallsBatch.ts for batch execution.
  • Enhanced error handling and validation for delegation and gas parameters.
  • Updated request normalization functions in src/entries/popup/pages/messages/SendTransaction/normalizeRequest.ts to support wallet_sendCalls.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@janek26
Copy link
Contributor Author

janek26 commented Mar 16, 2026


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Collaborator

@DanielSinclair DanielSinclair left a comment

Choose a reason for hiding this comment

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

Small tweak recommendations

@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from 5209c0d to bd35a1f Compare March 18, 2026 09:02
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from f4d3ec4 to 0362aa5 Compare March 18, 2026 09:02
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from bd35a1f to d5cab8b Compare March 18, 2026 12:42
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 0362aa5 to 1b7bafe Compare March 18, 2026 12:42
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from d5cab8b to f69cac9 Compare March 18, 2026 13:00
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 1b7bafe to 7648d8d Compare March 18, 2026 13:00
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 7648d8d to d437e46 Compare March 19, 2026 12:38
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from f69cac9 to 95008ea Compare March 19, 2026 12:38
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from d437e46 to b03d66d Compare March 19, 2026 12:59
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch 2 times, most recently from 51c5d42 to d92ac43 Compare March 19, 2026 13:30
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from b03d66d to 68f2cad Compare March 19, 2026 13:30
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from d92ac43 to 7d70b1a Compare March 19, 2026 13:57
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 68f2cad to 7adfc78 Compare March 19, 2026 13:57
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from 7d70b1a to 1ade1de Compare March 19, 2026 14:25
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch 2 times, most recently from 1b1c638 to de6d0d0 Compare March 19, 2026 15:46
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 8307322 to 6a782f5 Compare March 19, 2026 15:47
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from de6d0d0 to 9a21993 Compare March 19, 2026 15:54
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 6a782f5 to 801b74e Compare March 19, 2026 15:54
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from 9a21993 to 9f73419 Compare March 20, 2026 07:10
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 801b74e to a1a841f Compare March 20, 2026 07:11
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from a1a841f to 717ec49 Compare March 20, 2026 07:15
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_batch_store_and_validation branch from 9f73419 to 1055c40 Compare March 20, 2026 07:15
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch 2 times, most recently from fa47824 to eb4f795 Compare March 20, 2026 07:31
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_batch_store_and_validation branch from 3c115f1 to 1ca8e4e Compare March 20, 2026 07:31
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from eb4f795 to 61971a1 Compare March 20, 2026 07:43
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_batch_store_and_validation branch from 1ca8e4e to 1cb0e8f Compare March 20, 2026 07:43
@janek26 janek26 force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 61971a1 to ddacaad Compare March 20, 2026 10:42
@janek26 janek26 force-pushed the 03-06-feat_batch_store_and_validation branch from 1cb0e8f to 1bdfee1 Compare March 20, 2026 10:42
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_batch_store_and_validation branch 2 times, most recently from d4e3f6e to f01d42c Compare March 20, 2026 20:17
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from ddacaad to 77f88d3 Compare March 20, 2026 20:17
@DanielSinclair DanielSinclair changed the base branch from 03-06-feat_batch_store_and_validation to graphite-base/2235 March 20, 2026 22:34
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 77f88d3 to 9ed0fb5 Compare March 20, 2026 22:35
@graphite-app graphite-app bot changed the base branch from graphite-base/2235 to master March 20, 2026 22:35
@DanielSinclair DanielSinclair force-pushed the 03-06-feat_sendcalls_execution_and_normalization branch from 9ed0fb5 to c6402cf Compare March 20, 2026 22:36
Copy link
Collaborator

DanielSinclair commented Mar 20, 2026

Merge activity

  • Mar 20, 10:49 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 20, 10:50 PM UTC: @DanielSinclair merged this pull request with Graphite.

@DanielSinclair DanielSinclair merged commit 2dad961 into master Mar 20, 2026
6 checks passed
@DanielSinclair DanielSinclair deleted the 03-06-feat_sendcalls_execution_and_normalization branch March 20, 2026 22:50
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