From 3fa1a096e60d203db6efef4ff52dc11ed3f8ee48 Mon Sep 17 00:00:00 2001 From: Adam Hodges Date: Fri, 20 Mar 2026 09:23:31 -0400 Subject: [PATCH 1/2] Add ERC-8132 gasLimitOverride capability docs --- .../core/capabilities/gasLimitOverride.mdx | 199 ++++++++++++++++++ .../reference/core/capabilities/overview.mdx | 2 + .../wallet_getCapabilities.mdx | 22 +- .../provider-rpc-methods/wallet_sendCalls.mdx | 40 ++++ docs/docs.json | 3 +- 5 files changed, 263 insertions(+), 3 deletions(-) create mode 100644 docs/base-account/reference/core/capabilities/gasLimitOverride.mdx diff --git a/docs/base-account/reference/core/capabilities/gasLimitOverride.mdx b/docs/base-account/reference/core/capabilities/gasLimitOverride.mdx new file mode 100644 index 000000000..962782421 --- /dev/null +++ b/docs/base-account/reference/core/capabilities/gasLimitOverride.mdx @@ -0,0 +1,199 @@ +--- +title: "gasLimitOverride" +description: "Override gas limits for individual calls in a wallet_sendCalls batch" +--- + +Defined in [ERC-8132](https://github.com/ethereum/ERCs/pull/1485) + + +The gasLimitOverride capability allows apps to specify gas limits for individual calls within a `wallet_sendCalls` batch. Gas limits can be partially specified — you can provide overrides for only the calls you have context about, and the wallet estimates gas for the rest. Apps often have more context about the gas requirements of their own contract calls than the wallet, making app-provided gas limits more accurate. + + +## Parameters + +This is a **call-level capability**, meaning it is specified on individual calls within a `wallet_sendCalls` batch rather than at the top level. + + +Hex-encoded gas limit for the call. Must be a non-zero value that does not exceed the block gas limit of the target chain. + + +## Returns + + +The gasLimitOverride capability configuration. + + + +Indicates whether the wallet supports app-provided gas limit overrides. Reported for all chains (`0x0`) when supported. + + + + +## Example usage + + +```typescript Check gasLimitOverride support +const capabilities = await provider.request({ + method: 'wallet_getCapabilities', + params: [userAddress] +}); + +const gasLimitOverrideSupport = capabilities["0x0"]?.gasLimitOverride; +``` + +```typescript Send calls with a gas limit override +const result = await provider.request({ + method: "wallet_sendCalls", + params: [{ + version: "1.0", + chainId: "0x2105", + from: userAddress, + atomicRequired: true, + calls: [ + { + // Approval — no override, wallet estimates gas + to: tokenAddress, + value: "0x0", + data: approveCallData + }, + { + // Swap — app provides a known gas limit + to: swapContractAddress, + value: "0x0", + data: swapCallData, + capabilities: { + gasLimitOverride: { + value: "0x30D40" // 200,000 gas + } + } + } + ] + }] +}); +``` + + + +```json Capability response (supported) +{ + "0x0": { + "gasLimitOverride": { + "supported": true + } + } +} +``` + +```json Capability response (unsupported) +{ + "0x0": { + "gasLimitOverride": { + "supported": false + } + } +} +``` + + +## Error handling + +| Code | Message | Description | +| ------ | -------------------- | --------------------------------------------------------------------------- | +| -32602 | Invalid params | Gas limit is zero or exceeds the block gas limit of the target chain | +| 5700 | Capability required | Call includes gasLimitOverride but wallet doesn't support it | + +## How it works + +When a wallet receives calls with `gasLimitOverride` capabilities: + +1. The wallet uses the app-provided gas limit for that call's portion of the batch gas limit. +2. For calls **without** a `gasLimitOverride`, the wallet estimates gas as usual. +3. The wallet may add additional gas to account for batch processing overhead (such as smart account execution or EIP-7702 delegation). + +This is a call-level capability, so you can specify gas limits for only some calls in a batch. The wallet handles estimation for the rest. + +## Use cases + +### Nondeterministic gas usage + +Some contract calls have nondeterministic gas costs that are difficult for wallets to estimate accurately. Apps with deep knowledge of their contracts can provide better gas limits: + +```typescript +// A complex DeFi operation where gas usage depends on pool state +const result = await provider.request({ + method: "wallet_sendCalls", + params: [{ + version: "1.0", + chainId: "0x2105", + from: userAddress, + atomicRequired: true, + calls: [ + { + to: routerAddress, + value: "0x0", + data: swapCallData, + capabilities: { + gasLimitOverride: { + value: "0x7A120" // 500,000 gas — app knows the swap is complex + } + } + } + ] + }] +}); +``` + +### Partial gas limit specification + +You can specify gas limits for only the calls you have context about and let the wallet estimate the rest: + +```typescript +const result = await provider.request({ + method: "wallet_sendCalls", + params: [{ + version: "1.0", + chainId: "0x2105", + from: userAddress, + atomicRequired: true, + calls: [ + { + // Approval — let the wallet estimate gas + to: tokenAddress, + value: "0x0", + data: approveCallData + }, + { + // Swap — app provides a known gas limit + to: swapContractAddress, + value: "0x0", + data: swapCallData, + capabilities: { + gasLimitOverride: { + value: "0x30D40" // 200,000 gas + } + } + } + ] + }] +}); +``` + +## Best practices + +1. **Check capabilities first**: Verify `gasLimitOverride` support via `wallet_getCapabilities` before including it in calls +2. **Use `optional: true` for compatibility**: Mark the capability as optional if your app can function without it, so wallets that don't support it can still process the batch +3. **Provide accurate limits**: Use gas limits based on your contract's actual requirements — overly tight limits cause reverts, overly generous limits waste block space +4. **Let the wallet handle overhead**: Only specify gas for the call itself. The wallet accounts for batch processing overhead separately + + +The wallet returns an invalid params error (`-32602`) if a provided gas limit is zero or exceeds the block gas limit of the target chain. + + +## Related capabilities + +- [atomic](/base-account/reference/core/capabilities/atomic) - Use with atomic batch transactions +- [paymasterService](/base-account/reference/core/capabilities/paymasterService) - Combine with sponsored transactions + +import PolicyBanner from "/snippets/PolicyBanner.mdx"; + + diff --git a/docs/base-account/reference/core/capabilities/overview.mdx b/docs/base-account/reference/core/capabilities/overview.mdx index 8c127f6ee..fbb0dcabf 100644 --- a/docs/base-account/reference/core/capabilities/overview.mdx +++ b/docs/base-account/reference/core/capabilities/overview.mdx @@ -33,6 +33,7 @@ const baseCapabilities = capabilities["0x2105"]; // Base mainnet chain ID | [flowControl](/base-account/reference/core/capabilities/flowControl) | `wallet_sendCalls` | Flow control | | [datacallback](/base-account/reference/core/capabilities/datacallback) | `wallet_sendCalls` | Data callback | | [dataSuffix](/base-account/reference/core/capabilities/dataSuffix) | `wallet_sendCalls` | Transaction attribution | +| [gasLimitOverride](/base-account/reference/core/capabilities/gasLimitOverride) | `wallet_sendCalls` | Call-level gas limit overrides | ## Using with wallet_connect @@ -201,6 +202,7 @@ For detailed information on each capability: - [auxiliaryFunds](/base-account/reference/core/capabilities/auxiliaryFunds) - Auxiliary funding support - [atomic](/base-account/reference/core/capabilities/atomic) - Atomic batch transactions - [paymasterService](/base-account/reference/core/capabilities/paymasterService) - Gasless transactions +- [gasLimitOverride](/base-account/reference/core/capabilities/gasLimitOverride) - Call-level gas limit overrides ## Related Methods diff --git a/docs/base-account/reference/core/provider-rpc-methods/wallet_getCapabilities.mdx b/docs/base-account/reference/core/provider-rpc-methods/wallet_getCapabilities.mdx index 7c9ea47a9..cac568900 100644 --- a/docs/base-account/reference/core/provider-rpc-methods/wallet_getCapabilities.mdx +++ b/docs/base-account/reference/core/provider-rpc-methods/wallet_getCapabilities.mdx @@ -75,6 +75,16 @@ Whether data callbacks are supported for this account on this chain. + + +Indicates support for app-provided gas limit overrides on individual calls. Defined in [ERC-8132](https://github.com/ethereum/ERCs/pull/1485). Reported for all chains (`0x0`). + + + +Whether gas limit overrides are supported. + + + @@ -108,11 +118,13 @@ const baseCapabilities = capabilities["0x2105"]; // Base Mainnet const hasAuxiliaryFunds = baseCapabilities?.auxiliaryFunds?.supported; const supportsAtomic = baseCapabilities?.atomic?.supported === "supported"; const hasPaymaster = baseCapabilities?.paymasterService?.supported; +const hasGasLimitOverride = capabilities["0x0"]?.gasLimitOverride?.supported; console.log('Capabilities:', { hasAuxiliaryFunds, supportsAtomic, - hasPaymaster + hasPaymaster, + hasGasLimitOverride }); ``` @@ -140,6 +152,11 @@ console.log('Capabilities:', { "supported": false } }, + "0x0": { + "gasLimitOverride": { + "supported": true + } + }, "0x14A34": { "auxiliaryFunds": { "supported": false @@ -212,7 +229,8 @@ async function getWalletCapabilities(userAddress: string) { hasAtomicBatch: baseCapabilities.atomic?.supported === "supported", hasPaymaster: !!baseCapabilities.paymasterService?.supported, hasFlowControl: !!baseCapabilities.flowControl?.supported, - hasDataCallback: !!baseCapabilities.datacallback?.supported + hasDataCallback: !!baseCapabilities.datacallback?.supported, + hasGasLimitOverride: !!capabilities["0x0"]?.gasLimitOverride?.supported }; } ``` diff --git a/docs/base-account/reference/core/provider-rpc-methods/wallet_sendCalls.mdx b/docs/base-account/reference/core/provider-rpc-methods/wallet_sendCalls.mdx index c465f587c..273f88f7b 100644 --- a/docs/base-account/reference/core/provider-rpc-methods/wallet_sendCalls.mdx +++ b/docs/base-account/reference/core/provider-rpc-methods/wallet_sendCalls.mdx @@ -48,6 +48,10 @@ The value to send with the call (in wei, hex format). The call data (optional, hex format). + + +Optional call-level capabilities. For example, [`gasLimitOverride`](/base-account/reference/core/capabilities/gasLimitOverride) allows you to specify a gas limit for an individual call. + @@ -87,6 +91,42 @@ An object containing information about the sent batch, including transaction det }] } ``` + +```json Request with call-level gas limit overrides +{ + "id": 1, + "jsonrpc": "2.0", + "method": "wallet_sendCalls", + "params": [{ + "version": "2.0.0", + "from": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", + "chainId": "0x2105", + "atomicRequired": true, + "calls": [ + { + "to": "0x54f1C1965B355e1AB9ec3465616136be35bb5Ff7", + "value": "0x0", + "data": "0x095ea7b3...", + "capabilities": { + "gasLimitOverride": { + "value": "0x13880" + } + } + }, + { + "to": "0x2D48e6f5Ae053e4E918d2be53570961D880905F2", + "value": "0x0", + "data": "0x38ed1739...", + "capabilities": { + "gasLimitOverride": { + "value": "0x30D40" + } + } + } + ] + }] +} +``` diff --git a/docs/docs.json b/docs/docs.json index 66442d281..7789898e6 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -402,7 +402,8 @@ "base-account/reference/core/capabilities/paymasterService", "base-account/reference/core/capabilities/auxiliaryFunds", "base-account/reference/core/capabilities/datacallback", - "base-account/reference/core/capabilities/dataSuffix" + "base-account/reference/core/capabilities/dataSuffix", + "base-account/reference/core/capabilities/gasLimitOverride" ] } ] From 31e7d7b29499d555a6a4210ad319da82285e6ae3 Mon Sep 17 00:00:00 2001 From: Adam Hodges Date: Fri, 20 Mar 2026 09:46:28 -0400 Subject: [PATCH 2/2] Add gasLimitOverride callout to batch transactions guide --- docs/base-account/improve-ux/batch-transactions.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/base-account/improve-ux/batch-transactions.mdx b/docs/base-account/improve-ux/batch-transactions.mdx index 17da1c563..aada79957 100644 --- a/docs/base-account/improve-ux/batch-transactions.mdx +++ b/docs/base-account/improve-ux/batch-transactions.mdx @@ -334,6 +334,13 @@ async function trackBatchTransaction( You can learn more about `wallet_getCallsStatus` in the [reference documentation](/base-account/reference/core/provider-rpc-methods/wallet_getCallsStatus). + +**Need more control over gas?** + +You can override the gas limit for individual calls in a batch using the [`gasLimitOverride`](/base-account/reference/core/capabilities/gasLimitOverride) capability. This is useful for calls with nondeterministic gas consumption, such as swaps. See the [capabilities overview](/base-account/reference/core/capabilities/overview) for the full list of supported capabilities. + + + ## Video Guide