From 66d53d80049fe09491d55ea285cb7dcce10ae14c Mon Sep 17 00:00:00 2001 From: Christian Henriksen Date: Sun, 16 Jul 2023 21:35:19 +0200 Subject: [PATCH 1/2] Add contracts to subStoreNames to avoid Error in line 309 --- src/stores.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/stores.js b/src/stores.js index bc1cfe7..e7e9cb5 100644 --- a/src/stores.js +++ b/src/stores.js @@ -41,6 +41,7 @@ const getWindowEthereum = () => { // always get chainId as number EDIT: Always as hex const alwaysHex = (n) => (Web3.utils.isHex(n) ? n : Web3.utils.toHex(n)) +// const alwaysHex = (n) => (Web3.utils.isHex(n) ? Web3.utils.hexToNumber(n) : n) export const createStore = () => { const { emit, get, subscribe, assign, deleteAll } = proxied() @@ -211,7 +212,13 @@ const getData = (id) => { return noData } -const subStoreNames = ['web3', 'selectedAccount', 'connected', 'chainId'] +const subStoreNames = [ + 'web3', + 'selectedAccount', + 'connected', + 'chainId', + 'contracts' +] export const makeEvmStores = (name) => { const evmStore = (allStores[name] = createStore()) From 9e5fe4213e32c29e84b21b194c919bcc1b53e577 Mon Sep 17 00:00:00 2001 From: Christian Henriksen Date: Sun, 16 Jul 2023 21:42:03 +0200 Subject: [PATCH 2/2] Fix outcommented code and comment --- src/stores.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/stores.js b/src/stores.js index e7e9cb5..6a4ce3c 100644 --- a/src/stores.js +++ b/src/stores.js @@ -39,9 +39,8 @@ const getWindowEthereum = () => { } } -// always get chainId as number EDIT: Always as hex +// always get chainId as hex (required since web3js 4.x.x) const alwaysHex = (n) => (Web3.utils.isHex(n) ? n : Web3.utils.toHex(n)) -// const alwaysHex = (n) => (Web3.utils.isHex(n) ? Web3.utils.hexToNumber(n) : n) export const createStore = () => { const { emit, get, subscribe, assign, deleteAll } = proxied()