Skip to content

Commit

Permalink
Add state overrides for linea_estimateGas. (#1809)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
11 people committed Jan 23, 2025
1 parent c4d6ec5 commit 2b24f23
Showing 1 changed file with 46 additions and 6 deletions.
52 changes: 46 additions & 6 deletions services/reference/linea/json-rpc-methods/linea_estimategas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ We recommend using `linea_estimateGas` for more accurate results.

## Parameters

- `TRANSACTION CALL OBJECT` _\[required]_
- `call`: _\[required]_ Transaction call object:
- `from`: _\[optional]_ 20 bytes - The address the transaction is sent from.
- `to`: _\[optional]_ 20 bytes - The address the transaction is directed to.
- `gas`: _\[optional]_ Hexadecimal value of the gas provided for the transaction execution. `linea_estimateGas` consumes
Expand All @@ -41,11 +41,12 @@ We recommend using `linea_estimateGas` for more accurate results.
- `value`: _\[optional]_ Hexadecimal value of the value sent with this transaction.
- `data`: _\[optional]_ Hash of the method signature and encoded parameters. See the
[Ethereum contract ABI specification](https://docs.soliditylang.org/en/latest/abi-spec.html).
- `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).
:::warning
`safe` isn't supported. Use `finalized` instead.
Learn more about [Linea's layer 2 finalization](https://docs.linea.build/developers/guides/finalized-block).
:::
- `stateOverride`: _\[optional]_ Object that contains the address-to-state mapping to [override state values](#override-state-values).
Each entry specifies a state that will be temporarily overridden before executing the call:
- `balance`: _\[optional]_ Hexadecimal value of the temporary account balance for the call execution.
- `nonce`: _\[optional]_ Hexadecimal value of the temporary nonce for the call execution.
- `code` : _\[optional]_ Bytecode to inject into the account.
- `stateDiff`: `key:value` pairs to override individual slots in the account storage.

## Returns

Expand Down Expand Up @@ -95,3 +96,42 @@ Replace `<YOUR-API-KEY>` with an API key from your [MetaMask Developer dashboard
```
</TabItem>
</Tabs>

## Override state values

You can override an account with temporary state values before making the call. This allows you to
make temporary state changes without affecting the actual blockchain state.

The following example estimates the cost for transferring an ERC-20 token for an account which does not
have the required assets onchain.

The example sets a custom ETH balance for the sender (to cover gas costs) and modifies the account's
balance within the ERC-20 contract's storage for the duration of the call.

```json
curl https://linea-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"linea_estimateGas",
"params":[
{
"from":"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"to":"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
"data":"0xa9059cbb000000000000000000000000627306090abaB3A6e1400e9345bC60c78a8BEf570000000000000000000000000000000000000000000000001bc16d674ec80000"
},
{
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": {
"balance": "0x16345785d8a0000"
},
"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f": {
"stateDiff": {
"0x2d206e5210c119b1cbed144f517f1f1dfd586eed26793a233e6afc261f4cf97f":"0x0000000000000000000000000000000000000000000000001bc16d674ec80000"
}
}
}
],
"id":53
}'
```

0 comments on commit 2b24f23

Please sign in to comment.