mirror of
https://github.com/status-im/EIPs.git
synced 2025-01-27 15:15:03 +00:00
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
5e71d200da
commit
5508f14208
@ -1,6 +1,6 @@
|
||||
---
|
||||
eip: 1193
|
||||
title: Ethereum Provider API
|
||||
title: Ethereum Provider JavaScript API
|
||||
author: Ryan Ghods (@ryanio), Marc Garreau (@marcgarreau)
|
||||
discussions-to: https://ethereum-magicians.org/t/eip-1193-ethereum-provider/640
|
||||
status: Draft
|
||||
@ -12,7 +12,7 @@ requires: 1102
|
||||
|
||||
## Summary
|
||||
|
||||
This proposal formalizes an Ethereum Provider API.
|
||||
This proposal formalizes an Ethereum Provider JavaScript API.
|
||||
|
||||
The provider is designed to be minimal, containing 3 methods: `send`, `subscribe`, and `unsubscribe`. It emits 4 types of events: `connect`, `close`, `networkChanged`, and `accountsChanged`.
|
||||
|
||||
@ -220,23 +220,23 @@ If the Ethereum JSON-RPC API returns a response object with no error, then the P
|
||||
|
||||
If the Ethereum JSON-RPC API returns response object that contains an error property then the Promise **MUST** be rejected with an Error object containing the `response.error.message` as the Error message, `response.error.code` as a code property on the error and `response.error.data` as a data property on the error.
|
||||
|
||||
If an error occurs during processing, such as an HTTP error or internal parsing error then the Promise **MUST** be rejected with an Error object containing a human readable string message describing the error and **SHOULD** populate code and data properties on the error object with additional error details.
|
||||
If an error occurs during processing, such as an HTTP error or internal parsing error then the Promise **MUST** be rejected with an Error object containing a human readable string message describing the error and **SHOULD** populate the `code` and `data` properties on the error object with additional error details.
|
||||
|
||||
If the implementing Ethereum Provider is not talking to an external Ethereum JSON-RPC API provider then it **MUST** resolve with an object that matches the JSON-RPC API object as specified in the [Ethereum JSON-RPC documentation](https://github.com/ethereum/wiki/wiki/JSON-RPC). In case of an error, ensure that the Promise is rejected with an Error that matches the above shape.
|
||||
|
||||
### Subscriptions
|
||||
|
||||
The `subscribe` method **MUST** send a properly formatted [JSON-RPC request](https://www.jsonrpc.org/specification#request_object) with method `eth_subscribe` and params `[subscriptionType: String, {...params: Array<any>}]` and **MUST** return a Promise that resolves with `subscriptionId: String` or rejected with an Error object containing a human readable string message describing the error and **SHOULD** populate code and data properties on the error object with additional error details.
|
||||
The `subscribe` method **MUST** send a properly formatted [JSON-RPC request](https://www.jsonrpc.org/specification#request_object) with method `eth_subscribe` and params `[subscriptionType: String, {...params: Array<any>}]` and **MUST** return a Promise that resolves with `subscriptionId: String` or rejected with an Error object containing a human readable string message describing the error and **SHOULD** populate the `code` and `data` properties on the error object with additional error details.
|
||||
|
||||
The `unsubscribe` method **MUST** send a properly formatted [JSON-RPC request](https://www.jsonrpc.org/specification#request_object) with method `eth_unsubscribe` and params `[subscriptionId: String]` and **MUST** return a Promise that resolves with `result: Boolean` or rejected with an Error object containing a human readable string message describing the error and **SHOULD** populate code and data properties on the error object with additional error details.
|
||||
The `unsubscribe` method **MUST** send a properly formatted [JSON-RPC request](https://www.jsonrpc.org/specification#request_object) with method `eth_unsubscribe` and params `[subscriptionId: String]` and **MUST** return a Promise that resolves with `result: Boolean` or rejected with an Error object containing a human readable string message describing the error and **SHOULD** populate the `code` and `data` properties on the error object with additional error details.
|
||||
|
||||
If the `unsubscribe` method returns successfully with a `True` result, the implementing provider **MUST** remove all listeners on the `subscriptionId` using `ethereum.removeAllListeners(subscriptionId);`.
|
||||
|
||||
If an error occurs during processing of the subscription, such as an HTTP error or internal parsing error then the Promise **MUST** return with an Error object containing a human readable string message describing the error and **SHOULD** populate code and data properties on the error object with additional error details.
|
||||
If an error occurs during processing of the subscription, such as an HTTP error or internal parsing error then the Promise **MUST** return with an Error object containing a human readable string message describing the error and **SHOULD** populate the `code` and `data` properties on the error object with additional error details.
|
||||
|
||||
The implementing Ethereum Provider **MUST** emit every subscription response `result` with the eventName `subscriptionId`.
|
||||
|
||||
If an error occurs during the listening of the subscription, the Ethereum Provider **MUST** emit an Error object to the eventName `subscriptionId` containing a human readable string message describing the error and **SHOULD** populate code and data properties on the error object with additional error details.
|
||||
If an error occurs or the network changes during the listening of the subscription, the Ethereum Provider **MUST** emit an Error object to the eventName `subscriptionId` containing a human readable string message describing the error and **SHOULD** populate the `code` and `data` properties on the error object with additional error details.
|
||||
|
||||
If the implementing provider does not support subscriptions, then it **MUST** leave the `subscribe` and `unsubscribe` methods undefined.
|
||||
|
||||
@ -254,12 +254,6 @@ If the accounts connected to the Ethereum Provider change, the Ethereum Provider
|
||||
|
||||
The name of the constructor of the Ethereum Provider **MUST** be `EthereumProvider`.
|
||||
|
||||
## Topics
|
||||
|
||||
### Multiple chain support
|
||||
|
||||
As per discussion in [ethereum/interfaces#16](https://github.com/ethereum/interfaces/issues/16), to handle support of changing networks we recommend introducing a new RPC method `eth_changeNetwork`. In the future depending on the implementation of sharding, an additional method could be `eth_changeShard`.
|
||||
|
||||
## Copyright
|
||||
|
||||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
|
||||
|
Loading…
x
Reference in New Issue
Block a user