From 9639f1eddd8d6d12395b9cc9a7dca1d67d6c5a45 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Tue, 21 May 2019 14:12:12 +0200 Subject: [PATCH 1/5] change networkChanged to chainChanged on EIP-1193 --- EIPS/eip-1193.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-1193.md b/EIPS/eip-1193.md index 7398f75db8804..f523d2d7328d6 100644 --- a/EIPS/eip-1193.md +++ b/EIPS/eip-1193.md @@ -7,6 +7,7 @@ status: Draft type: Standards Track category: Interface created: 2018-06-30 +requires: 155, 695, 1474 --- ## Summary @@ -85,15 +86,15 @@ ethereum.on('close', listener: (code: Number, reason: String) => void): this; The event emits with `code` and `reason`. The code follows the table of [`CloseEvent` status codes](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes). -#### networkChanged +#### chainChanged -The provider emits `networkChanged` on connect to a new network. +The provider emits `chainChanged` on connect to a new chain. ```js -ethereum.on('networkChanged', listener: (networkId: String) => void): this; +ethereum.on('chainChanged', listener: (chainId: String) => void): this; ``` -The event emits with `networkId`, the new network returned from `net_version`. +The event emits with `chainId`, the new chain returned from `eth_chainId`. #### accountsChanged From 4a4ac662c480ccec8f2d4406a503ebd22aea9dee Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Tue, 21 May 2019 21:18:48 +0200 Subject: [PATCH 2/5] Update eip-1193.md --- EIPS/eip-1193.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-1193.md b/EIPS/eip-1193.md index f523d2d7328d6..244d17b31e41b 100644 --- a/EIPS/eip-1193.md +++ b/EIPS/eip-1193.md @@ -7,7 +7,7 @@ status: Draft type: Standards Track category: Interface created: 2018-06-30 -requires: 155, 695, 1474 +requires: 155, 695, 1102 1474 --- ## Summary From 914d9f96bcc4af5b4867ac273b5fcf15680b0d71 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Tue, 21 May 2019 21:22:41 +0200 Subject: [PATCH 3/5] fix build --- EIPS/eip-1193.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-1193.md b/EIPS/eip-1193.md index 244d17b31e41b..d5f7527981c8b 100644 --- a/EIPS/eip-1193.md +++ b/EIPS/eip-1193.md @@ -7,7 +7,7 @@ status: Draft type: Standards Track category: Interface created: 2018-06-30 -requires: 155, 695, 1102 1474 +requires: 155, 695, 1102, 1474 --- ## Summary From 24ddf4c28635d585b5d43ff669d5b2a42436a77d Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Fri, 24 May 2019 14:49:45 +0200 Subject: [PATCH 4/5] Update eip-1193.md --- EIPS/eip-1193.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-1193.md b/EIPS/eip-1193.md index d5f7527981c8b..7ce5522b1a873 100644 --- a/EIPS/eip-1193.md +++ b/EIPS/eip-1193.md @@ -256,9 +256,9 @@ If the network connects, the Ethereum Provider **MUST** emit an event named `con If the network connection closes, the Ethereum Provider **MUST** emit an event named `close` with args `code: Number, reason: String` following the [status codes for `CloseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes). -#### networkChanged +#### chainChanged -If the network the provider is connected to changes, the provider **MUST** emit an event named `networkChanged` with args `networkId: String` containing the ID of the new network (using the Ethereum JSON-RPC call `net_version`). +If the chain the provider is connected to changes, the provider **MUST** emit an event named `chainChanged` with args `chainId: String` containing the ID of the new chain (using the Ethereum JSON-RPC call `eth_chainId`). #### accountsChanged From 1806b29f9b34ac6b209e0b672d9d7ca205ff7927 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 12 Jun 2019 14:35:16 +0200 Subject: [PATCH 5/5] Put networkChanged event back on EIP-1193 --- EIPS/eip-1193.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/EIPS/eip-1193.md b/EIPS/eip-1193.md index 7ce5522b1a873..5e40a7322471b 100644 --- a/EIPS/eip-1193.md +++ b/EIPS/eip-1193.md @@ -96,6 +96,16 @@ ethereum.on('chainChanged', listener: (chainId: String) => void): this; The event emits with `chainId`, the new chain returned from `eth_chainId`. +#### networkChanged + +The provider emits `networkChanged` on connect to a new network. + +```js +ethereum.on('networkChanged', listener: (networkId: String) => void): this; +``` + +The event emits with `networkId`, the new network returned from `net_version`. + #### accountsChanged The provider emits `accountsChanged` if the accounts returned from the provider (`eth_accounts`) changes. @@ -260,6 +270,10 @@ If the network connection closes, the Ethereum Provider **MUST** emit an event n If the chain the provider is connected to changes, the provider **MUST** emit an event named `chainChanged` with args `chainId: String` containing the ID of the new chain (using the Ethereum JSON-RPC call `eth_chainId`). +#### networkChanged + +If the network the provider is connected to changes, the provider **MUST** emit an event named `networkChanged` with args `networkId: String` containing the ID of the new network (using the Ethereum JSON-RPC call `net_version`). + #### accountsChanged 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` containing the accounts' addresses.