Skip to content

Commit 364bfb2

Browse files
committed
Return chain ID from Ethereum Provider example instead of network version
1 parent bc050af commit 364bfb2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/examples/packages/ethereum-provider/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "7i20r0cCFwMESzBcTMgRNOt82AjwHneiM6LtD7vXCGw=",
10+
"shasum": "ZvZeD71njHCYz1luaRATtzJgNbu7S/Kq4zjyAw2nzGY=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/ethereum-provider/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ async function getGasPrice() {
4747
}
4848

4949
/**
50-
* Get the current network version using the `ethereum` global. This is
51-
* essentially the same as the `window.ethereum` global, but does not have
52-
* access to all methods.
50+
* Get the current chain ID using the `ethereum` global. This is essentially
51+
* the same as the `window.ethereum` global, but does not have access to all
52+
* methods.
5353
*
5454
* Note that using the `ethereum` global requires the
5555
* `endowment:ethereum-provider` permission.
@@ -58,8 +58,8 @@ async function getGasPrice() {
5858
* @see https://docs.metamask.io/snaps/reference/permissions/#endowmentethereum-provider
5959
*/
6060
async function getVersion() {
61-
const version = await ethereum.request<string>({ method: 'net_version' });
62-
assert(version, 'Ethereum provider did not return a version.');
61+
const version = await ethereum.request<string>({ method: 'eth_chainId' });
62+
assert(version, 'Ethereum provider did not return a chain ID.');
6363

6464
return version;
6565
}

0 commit comments

Comments
 (0)