mirror of https://github.com/status-im/EIPs.git
Automatically merged updates to draft EIP(s) 1193
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:
parent
f27695249c
commit
b9d464a122
|
@ -101,11 +101,13 @@ ethereum.on('accountsChanged', listener: (accounts: Array<String>) => void): thi
|
|||
|
||||
The event emits with `accounts`, an array of the accounts' addresses.
|
||||
|
||||
### Constructor
|
||||
### isEIP1193
|
||||
|
||||
`isEIP1193` is a public read-only value on the provider to help distinguish itself.
|
||||
|
||||
```js
|
||||
ethereum.constructor.name;
|
||||
> 'EthereumProvider'
|
||||
ethereum.isEIP1193;
|
||||
> true
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
@ -242,6 +244,8 @@ The `eth_requestAccounts` method **MUST** resolve with an array of the account(s
|
|||
|
||||
### Events
|
||||
|
||||
The provider **SHOULD** extend from `EventEmitter` to provide dapps flexibility in listening to events. In place of full `EventEmitter` functionality, the provider **MAY** provide as many methods as it can reasonably provide, but **MUST** provide at least `on`, `emit`, and `removeListener`.
|
||||
|
||||
#### notification
|
||||
|
||||
All subscriptions received from the node **MUST** emit the `message.params` to the eventName `notification` without modification.
|
||||
|
@ -262,9 +266,9 @@ If the network the provider is connected to changes, the provider **MUST** emit
|
|||
|
||||
If the accounts connected to the Ethereum Provider change at any time, the Ethereum Provider **MUST** send an event with the name `accountsChanged` with args `accounts: Array<String>` containing the accounts' addresses.
|
||||
|
||||
### Class
|
||||
### isEIP1193
|
||||
|
||||
The name of the constructor of the Ethereum Provider **MUST** be `EthereumProvider`.
|
||||
The provider **MUST** define `public readonly ethereum.isEIP1193: Boolean`
|
||||
|
||||
### web3.js Backwards Compatibility
|
||||
|
||||
|
@ -303,6 +307,10 @@ class EthereumProvider extends EventEmitter {
|
|||
window.addEventListener('message', this._handleJsonrpcMessage.bind(this));
|
||||
}
|
||||
|
||||
static get isEIP1193() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Methods */
|
||||
|
||||
send(method, params = []) {
|
||||
|
|
Loading…
Reference in New Issue