Skip to content

Commit 904cca2

Browse files
bgravenorstDahka2321AndyMBridgesfutreallsky-coderay
authored
Add state overrides for linea_estimateGas. (#1809)
* Add state overrides. Signed-off-by: bgravenorst <[email protected]> * Update dag_import.md (#1810) * Update pricing (#1800) * Update endpoints.md (#1812) * chore: correct (#1813) * Update credit-usage.md * Update avoid-rate-limiting.md * Add tech-writers as default codeowners (#1815) * Remove duplication of result descriptions in API reference (#1781) * Remove duplication of result descriptions in API reference * remove empty div --------- Co-authored-by: Andy Bridges <[email protected]> * Fix syntax errors in Starknet transaction documentation (#1811) * Update send-starknet-transactions.md * Update wallet/how-to/use-non-evm-networks/starknet/send-starknet-transactions.md --------- Co-authored-by: Alexandra Carrillo <[email protected]> * Fix typographical errors (#1820) * fix typos * fix typo * fix typo * fix typos * Fix typos in documentation (#1821) * Update sdk-js-options.md * Update create-api.md * chore(deps): bump @mdx-js/react from 3.0.1 to 3.1.0 (#1695) Bumps [@mdx-js/react](https://github.com/mdx-js/mdx/tree/HEAD/packages/react) from 3.0.1 to 3.1.0. - [Release notes](https://github.com/mdx-js/mdx/releases) - [Changelog](https://github.com/mdx-js/mdx/blob/main/changelog.md) - [Commits](https://github.com/mdx-js/mdx/commits/3.1.0/packages/react) --- updated-dependencies: - dependency-name: "@mdx-js/react" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandra Carrillo <[email protected]> * chore(deps): bump the npm_and_yarn group across 1 directory with 3 updates (#1763) Bumps the npm_and_yarn group with 3 updates in the / directory: [elliptic](https://github.com/indutny/elliptic), [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) and [mermaid](https://github.com/mermaid-js/mermaid). Updates `elliptic` from 6.5.7 to 6.6.1 - [Commits](indutny/elliptic@v6.5.7...v6.6.1) Updates `http-proxy-middleware` from 2.0.6 to 2.0.7 - [Release notes](https://github.com/chimurai/http-proxy-middleware/releases) - [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.7/CHANGELOG.md) - [Commits](chimurai/http-proxy-middleware@v2.0.6...v2.0.7) Updates `mermaid` from 10.9.1 to 10.9.3 - [Release notes](https://github.com/mermaid-js/mermaid/releases) - [Changelog](https://github.com/mermaid-js/mermaid/blob/develop/CHANGELOG.md) - [Commits](mermaid-js/mermaid@v10.9.1...v10.9.3) --- updated-dependencies: - dependency-name: elliptic dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: http-proxy-middleware dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: mermaid dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandra Carrillo <[email protected]> * chore(deps): bump @rjsf/validator-ajv8 from 5.21.1 to 5.24.1 (#1802) Bumps [@rjsf/validator-ajv8](https://github.com/rjsf-team/react-jsonschema-form) from 5.21.1 to 5.24.1. - [Release notes](https://github.com/rjsf-team/react-jsonschema-form/releases) - [Changelog](https://github.com/rjsf-team/react-jsonschema-form/blob/main/CHANGELOG.md) - [Commits](rjsf-team/react-jsonschema-form@5.21.1...5.24.1) --- updated-dependencies: - dependency-name: "@rjsf/validator-ajv8" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandra Carrillo <[email protected]> * chore(deps): bump @rjsf/core from 5.22.1 to 5.24.1 (#1803) Bumps [@rjsf/core](https://github.com/rjsf-team/react-jsonschema-form) from 5.22.1 to 5.24.1. - [Release notes](https://github.com/rjsf-team/react-jsonschema-form/releases) - [Changelog](https://github.com/rjsf-team/react-jsonschema-form/blob/main/CHANGELOG.md) - [Commits](rjsf-team/react-jsonschema-form@5.22.1...5.24.1) --- updated-dependencies: - dependency-name: "@rjsf/core" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandra Carrillo <[email protected]> * chore(deps-dev): bump eslint from 8.57.1 to 9.18.0 (#1804) Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.18.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v8.57.1...v9.18.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandra Carrillo <[email protected]> * chore(deps): bump @metamask/profile-sync-controller from 0.9.8 to 4.1.0 (#1816) Bumps [@metamask/profile-sync-controller](https://github.com/MetaMask/core) from 0.9.8 to 4.1.0. - [Release notes](https://github.com/MetaMask/core/releases) - [Changelog](https://github.com/MetaMask/core/blob/main/docs/reviewing-release-prs.md) - [Commits](https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]) --- updated-dependencies: - dependency-name: "@metamask/profile-sync-controller" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexandra Carrillo <[email protected]> * chore(deps): bump the npm_and_yarn group across 1 directory with 4 updates (#1823) Bumps the npm_and_yarn group with 3 updates in the / directory: [express](https://github.com/expressjs/express), [katex](https://github.com/KaTeX/KaTeX) and [serve-handler](https://github.com/vercel/serve-handler). Updates `express` from 4.21.1 to 4.21.2 - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/4.21.2/History.md) - [Commits](expressjs/express@4.21.1...4.21.2) Updates `path-to-regexp` from 0.1.10 to 0.1.12 - [Release notes](https://github.com/pillarjs/path-to-regexp/releases) - [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md) - [Commits](pillarjs/path-to-regexp@v0.1.10...v0.1.12) Updates `katex` from 0.16.11 to 0.16.21 - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/main/CHANGELOG.md) - [Commits](KaTeX/KaTeX@v0.16.11...v0.16.21) Updates `serve-handler` from 6.1.5 to 6.1.6 - [Release notes](https://github.com/vercel/serve-handler/releases) - [Commits](vercel/serve-handler@6.1.5...6.1.6) --- updated-dependencies: - dependency-name: express dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: path-to-regexp dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: katex dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: serve-handler dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update quickstart.md (#1826) * Update example. Signed-off-by: bgravenorst <[email protected]> * Update services/reference/linea/json-rpc-methods/linea_estimategas.mdx Co-authored-by: Alexandra Carrillo <[email protected]> * Update services/reference/linea/json-rpc-methods/linea_estimategas.mdx Co-authored-by: Alexandra Carrillo <[email protected]> --------- Signed-off-by: bgravenorst <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Woolfgm <[email protected]> Co-authored-by: Andy Bridges <[email protected]> Co-authored-by: futreall <[email protected]> Co-authored-by: Skylar Ray <[email protected]> Co-authored-by: Alexandra Carrillo <[email protected]> Co-authored-by: CrazyFrog <[email protected]> Co-authored-by: Ocenka <[email protected]> Co-authored-by: Huberto <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Fallengirl <[email protected]>
1 parent 8e15d32 commit 904cca2

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

services/reference/linea/json-rpc-methods/linea_estimategas.mdx

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ We recommend using `linea_estimateGas` for more accurate results.
3030

3131
## Parameters
3232

33-
- `TRANSACTION CALL OBJECT` _\[required]_
33+
- `call`: _\[required]_ Transaction call object:
3434
- `from`: _\[optional]_ 20 bytes - The address the transaction is sent from.
3535
- `to`: _\[optional]_ 20 bytes - The address the transaction is directed to.
3636
- `gas`: _\[optional]_ Hexadecimal value of the gas provided for the transaction execution. `linea_estimateGas` consumes
@@ -41,11 +41,12 @@ We recommend using `linea_estimateGas` for more accurate results.
4141
- `value`: _\[optional]_ Hexadecimal value of the value sent with this transaction.
4242
- `data`: _\[optional]_ Hash of the method signature and encoded parameters. See the
4343
[Ethereum contract ABI specification](https://docs.soliditylang.org/en/latest/abi-spec.html).
44-
- `blockParameter`: (string) [_optional_] A hexadecimal block number, or one of the tags `latest`, `earliest`, `pending` or `finalized`. See the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block).
45-
:::warning
46-
`safe` isn't supported. Use `finalized` instead.
47-
Learn more about [Linea's layer 2 finalization](https://docs.linea.build/developers/guides/finalized-block).
48-
:::
44+
- `stateOverride`: _\[optional]_ Object that contains the address-to-state mapping to [override state values](#override-state-values).
45+
Each entry specifies a state that will be temporarily overridden before executing the call:
46+
- `balance`: _\[optional]_ Hexadecimal value of the temporary account balance for the call execution.
47+
- `nonce`: _\[optional]_ Hexadecimal value of the temporary nonce for the call execution.
48+
- `code` : _\[optional]_ Bytecode to inject into the account.
49+
- `stateDiff`: `key:value` pairs to override individual slots in the account storage.
4950

5051
## Returns
5152

@@ -95,3 +96,42 @@ Replace `<YOUR-API-KEY>` with an API key from your [MetaMask Developer dashboard
9596
```
9697
</TabItem>
9798
</Tabs>
99+
100+
## Override state values
101+
102+
You can override an account with temporary state values before making the call. This allows you to
103+
make temporary state changes without affecting the actual blockchain state.
104+
105+
The following example estimates the cost for transferring an ERC-20 token for an account which does not
106+
have the required assets onchain.
107+
108+
The example sets a custom ETH balance for the sender (to cover gas costs) and modifies the account's
109+
balance within the ERC-20 contract's storage for the duration of the call.
110+
111+
```json
112+
curl https://linea-mainnet.infura.io/v3/<YOUR-API-KEY> \
113+
-X POST \
114+
-H "Content-Type: application/json" \
115+
-d '{
116+
"jsonrpc":"2.0",
117+
"method":"linea_estimateGas",
118+
"params":[
119+
{
120+
"from":"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
121+
"to":"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
122+
"data":"0xa9059cbb000000000000000000000000627306090abaB3A6e1400e9345bC60c78a8BEf570000000000000000000000000000000000000000000000001bc16d674ec80000"
123+
},
124+
{
125+
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": {
126+
"balance": "0x16345785d8a0000"
127+
},
128+
"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f": {
129+
"stateDiff": {
130+
"0x2d206e5210c119b1cbed144f517f1f1dfd586eed26793a233e6afc261f4cf97f":"0x0000000000000000000000000000000000000000000000001bc16d674ec80000"
131+
}
132+
}
133+
}
134+
],
135+
"id":53
136+
}'
137+
```

0 commit comments

Comments
 (0)