From aeddc461c5a1c3ea057c91172b6d3de6be393127 Mon Sep 17 00:00:00 2001 From: Joan E <153745173+joaniefromtheblock@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:42:47 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"fix=20the=20MetaMask=20-=20RPC=20Erro?= =?UTF-8?q?r:=20Invalid=20JSON-RPC=20request=20in=20the=20tutoria=E2=80=A6?= =?UTF-8?q?"=20(#1362)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5bfa1600a0d151403f85b7afe313501aed34f91e. --- snaps/learn/tutorials/gas-estimation.md | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/snaps/learn/tutorials/gas-estimation.md b/snaps/learn/tutorials/gas-estimation.md index ff09bc47362..424736f7d18 100644 --- a/snaps/learn/tutorials/gas-estimation.md +++ b/snaps/learn/tutorials/gas-estimation.md @@ -150,7 +150,7 @@ Open `packages/snap/src/index.ts`. This is the main code file for your Snap. To get a gas fee estimate, use the public API endpoint provided by [Open Source Ethereum Explorer](https://beaconcha.in/). -If it not already present, add the following `getFees()` function to the beginning of the `/packages/snap/src/index.ts` file: +Add the following `getFees()` function to the beginning of the `/packages/snap/src/index.ts` file: ```typescript title="index.ts" import type { OnRpcRequestHandler } from "@metamask/snaps-sdk"; @@ -235,29 +235,12 @@ To build and test your Snap: You have integrated a public API into MetaMask and displayed real-time gas fee estimates. -## Troubleshoot +### 6. Next steps -If you click the **Send message** button and receive an error message similar to the following, update `packages/site/src/pages/index.tsx`: - -

-An error happened -

- -Replace `await invokeSnap({ method: 'hello' })` on line 114 of `packages/site/src/pages/index.tsx` with the following code: -```typescript title="index.tsx" - await invokeSnap({ method: 'hello', params: {} }); -``` -This ensures the `invokeSnap` function calls an additional `params` property. - -The **Send message** button on the page should now be enabled. - -## Next steps - -This tutorial walked you through creating a Snap to estimate gas fees using the `fetch` API and display results in an alert. -Next, you can try the following: +Next, you can try: - Parsing the JSON response from the remote API. -- Displaying the fees in a clear and well-structured format. +- Displaying the fees in a nicely formatted way. You can also update the fields in `snap.manifest.json` to match your custom Snap: