Automatically merged updates to draft EIP(s) 1102

Hi, I'm a bot! This change was automatically merged because:

 - It only modifies existing Draft or Last Call EIP(s)
 - The PR was approved or written by at least one author of each modified EIP
 - The build is passing
This commit is contained in:
Paul Bouchon 2018-10-08 14:32:30 -04:00 committed by EIP Automerge Bot
parent 07da9ea0dc
commit caec3547dd

View File

@ -21,23 +21,27 @@ This proposal outlines a protocol in which DOM environments expose a read-only p
## Specification
### Definitions
### Concepts
1. **Read-only provider**
#### RFC-2119
A read-only provider has no populated accounts and any RPC request that requires an account will fail.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC-2119](https://www.ietf.org/rfc/rfc2119.txt).
2. **Full provider**
#### Read-only provider
A full provider has populated accounts and any RPC request that requires an account will succeed.
A read-only provider has no populated accounts and any RPC request that requires an account will fail.
3. **`Provider#enable`**
#### Full provider
Providers exposed by DOM environments define a new `enable` method that returns a Promise. Calling this method triggers a user interface that allows the user to approve or deny full provider access for a given dapp. The returned Promise is resolved if the user approves full provider access or rejected if the user denies full provider access.
A full provider has populated accounts and any RPC request that requires an account will succeed.
```js
ethereum.enable(): Promise<any>
```
#### `Provider#enable`
Providers exposed by DOM environments define a new `enable` method that returns a Promise. Calling this method triggers a user interface that allows the user to approve or deny full provider access for a given dapp. The returned Promise is resolved if the user approves full provider access or rejected if the user denies full provider access.
```js
ethereum.enable(): Promise<any>
```
### Protocol
@ -71,15 +75,15 @@ IF provider is undefined
##### `[1] ENABLE`
Dapps MUST request a full provider by calling the `enable` method on the default read-only provider. This method MUST trigger a user interface that allows the user to approve or deny full provider access for a given dapp. This method MUST return a Promise that is resolved with an array of the user's public addresses if the user approves full provider access or rejected if the user denies full provider access.
Dapps **MUST** request a full provider by calling the `enable` method on the default read-only provider. This method **MUST** trigger a user interface that allows the user to approve or deny full provider access for a given dapp. This method **MUST** return a Promise that is resolved with an array of the user's public addresses if the user approves full provider access or rejected if the user denies full provider access.
##### `[2] RESOLVE`
If a user approves full provider access, DOM environments MUST expose a fully-enabled provider at `window.ethereum` that is populated with accounts. The Promise returned when calling the `enable` method MUST be resolved with an array of the user's public addresses.
If a user approves full provider access, DOM environments **MUST** expose a fully-enabled provider at `window.ethereum` that is populated with accounts. The Promise returned when calling the `enable` method **MUST** be resolved with an array of the user's public addresses.
##### `[3] REJECT`
If a user denies full provider access, the Promise returned when calling the `enable` method MUST be rejected with an informative Error.
If a user denies full provider access, the Promise returned when calling the `enable` method **MUST** be rejected with an informative Error.
### Example initialization
@ -100,13 +104,13 @@ window.addEventListener('load', async () => {
### Constraints
* Browsers MUST expose a read-only provider at `window.ethereum` by default.
* Browsers MUST NOT expose a full provider globally by default.
* Dapps MUST request access to a full provider.
* Users MUST be able to approve or deny full provider access.
* A full provider MUST be exposed at `window.ethereum` after user approval.
* Dapps MUST be notified of user approval of full provider access.
* Dapps MUST be notified of user denial of full provider access.
* Browsers **MUST** expose a read-only provider at `window.ethereum` by default.
* Browsers **MUST** NOT expose a full provider globally by default.
* Dapps **MUST** request access to a full provider.
* Users **MUST** be able to approve or deny full provider access.
* A full provider **MUST** be exposed at `window.ethereum` after user approval.
* Dapps **MUST** be notified of user approval of full provider access.
* Dapps **MUST** be notified of user denial of full provider access.
## Rationale