From 568d55af2a12f4741371c7a1d1ea31897a3fb377 Mon Sep 17 00:00:00 2001 From: Christian Montoya Date: Fri, 25 Aug 2023 01:03:31 -0400 Subject: [PATCH 1/4] Ethereum provider clarification - fixes #882 Clarifies what you can and cannot do with the ethereum provider in Snaps with the addition of a note section --- snaps/reference/permissions.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snaps/reference/permissions.md b/snaps/reference/permissions.md index e3eddc88af2..91589e735a0 100644 --- a/snaps/reference/permissions.md +++ b/snaps/reference/permissions.md @@ -81,6 +81,13 @@ Specify this permission in the manifest file as follows: }, ``` +:::note +The global `ethereum` API in Snaps has fewer capabilities than `window.ethereum`. +You can only use it to make read requests from the RPC provider, not to write to the blockchain or initiate transactions. +You can also use it to access Ethereum accounts with `eth_requestAccounts` and then use `personal_sign` with +those connected accounts. +::: + ### endowment:long-running :::caution From 6c9acf4b00599adc0590f17e3f38672c8c405e13 Mon Sep 17 00:00:00 2001 From: Christian Montoya Date: Fri, 25 Aug 2023 01:35:07 -0400 Subject: [PATCH 2/4] Specify that window.ethereum is for dapps --- snaps/reference/permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snaps/reference/permissions.md b/snaps/reference/permissions.md index 91589e735a0..038b9a40dcf 100644 --- a/snaps/reference/permissions.md +++ b/snaps/reference/permissions.md @@ -82,7 +82,7 @@ Specify this permission in the manifest file as follows: ``` :::note -The global `ethereum` API in Snaps has fewer capabilities than `window.ethereum`. +The global `ethereum` API in Snaps has fewer capabilities than `window.ethereum` for dapps. You can only use it to make read requests from the RPC provider, not to write to the blockchain or initiate transactions. You can also use it to access Ethereum accounts with `eth_requestAccounts` and then use `personal_sign` with those connected accounts. From 3de78e8d17ee90843146bfd90fb0bf52245afa53 Mon Sep 17 00:00:00 2001 From: Christian Montoya Date: Fri, 25 Aug 2023 01:42:08 -0400 Subject: [PATCH 3/4] Update rpc-api.md Better explain how to connect to Ethereum accounts --- snaps/reference/rpc-api.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/snaps/reference/rpc-api.md b/snaps/reference/rpc-api.md index 0d11fe10374..88838b26677 100644 --- a/snaps/reference/rpc-api.md +++ b/snaps/reference/rpc-api.md @@ -428,9 +428,11 @@ derive an address for the relevant protocol or sign a transaction for the user. This method is only callable by snaps. -:::danger important -Coin type 60 is reserved for MetaMask accounts and is blocked for snaps. -If you wish to connect to MetaMask accounts in a snap, use `eth_accounts`. +:::caution +Coin type 60 is reserved for MetaMask accounts and blocked for snaps. +If you wish to connect to MetaMask accounts in a snap, use +[`endowment:ethereum-provider`](../reference/permissions.md/#endowmentethereum-provider) and +`eth_requestAccounts`. ::: #### Parameters From cf12f0042e1d584ec19fb93b87126e0dda6a5a03 Mon Sep 17 00:00:00 2001 From: Christian Montoya Date: Fri, 25 Aug 2023 01:45:01 -0400 Subject: [PATCH 4/4] Update permissions.md Slightly better language --- snaps/reference/permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snaps/reference/permissions.md b/snaps/reference/permissions.md index 038b9a40dcf..124f627b7f2 100644 --- a/snaps/reference/permissions.md +++ b/snaps/reference/permissions.md @@ -84,7 +84,7 @@ Specify this permission in the manifest file as follows: :::note The global `ethereum` API in Snaps has fewer capabilities than `window.ethereum` for dapps. You can only use it to make read requests from the RPC provider, not to write to the blockchain or initiate transactions. -You can also use it to access Ethereum accounts with `eth_requestAccounts` and then use `personal_sign` with +You can also use it to connect to Ethereum accounts with `eth_requestAccounts` and then use `personal_sign` with those connected accounts. :::