From ff99c77a8168d4d1b4b26fef2ad4ed68003e4d74 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Tue, 23 Nov 2021 20:31:09 -0700 Subject: [PATCH 1/5] Added popular networks to enum --- src/networkEnum.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/networkEnum.js b/src/networkEnum.js index 8bb867f2..8ecb0c00 100644 --- a/src/networkEnum.js +++ b/src/networkEnum.js @@ -1,10 +1,14 @@ const networkEnum = Object.freeze({ - 1: 'main', - 3: 'ropsten', - 4: 'rinkeby', - 5: 'goerli', - 42: 'kovan', - 100: 'xdai', - 'localhost': 'localhost' -}); -export default networkEnum; \ No newline at end of file + 1: 'Ethereum', + 3: 'Ropsten', + 4: 'Rinkeby', + 5: 'Goerli', + 25: 'Cronos', + 42: 'Kovan', + 56: 'BSC', + 100: 'XDai', + 137: 'Polygon', + 250: 'Fantom', + localhost: 'localhost' +}) +export default networkEnum From f0637f5bbb0c93f0279950dec74d82f6bcbc52bb Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Tue, 23 Nov 2021 20:42:18 -0700 Subject: [PATCH 2/5] Reformat code using prettier --- src/App.js | 13 ++++++++----- src/networkEnum.js | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/App.js b/src/App.js index ca745dd6..ef0ab490 100644 --- a/src/App.js +++ b/src/App.js @@ -74,6 +74,7 @@ const App = () => { ) window.localStorage.setItem('selectedWallet', wallet.name) + console.log(wallet) } else { provider = null setWallet({}) @@ -171,13 +172,15 @@ const App = () => { value: 1000000000000000 } - const sendTransaction = () => + const sendTransaction = () => { signer.sendTransaction(txDetails).then(tx => tx.hash) + } const gasPrice = () => provider.getGasPrice().then(res => res.toString()) - const estimateGas = () => + const estimateGas = () => { provider.estimateGas(txDetails).then(res => res.toString()) + } const { emitter } = await notify.transaction({ sendTransaction, @@ -203,7 +206,9 @@ const App = () => { emitter.on('txFailed', console.log) } - return onboard && notify ? ( + if (!onboard || !notify) return
Loading...
+ + return (
{ens && ens.name ? ( @@ -530,8 +535,6 @@ const App = () => {
- ) : ( -
Loading...
) } diff --git a/src/networkEnum.js b/src/networkEnum.js index 8ecb0c00..c6fffcbf 100644 --- a/src/networkEnum.js +++ b/src/networkEnum.js @@ -10,5 +10,5 @@ const networkEnum = Object.freeze({ 137: 'Polygon', 250: 'Fantom', localhost: 'localhost' -}) -export default networkEnum +}); +export default networkEnum; From ca5d361767aeafb53ba1f668830653638ef534db Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Tue, 23 Nov 2021 20:47:00 -0700 Subject: [PATCH 3/5] increment version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc31d5df..e2047a45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onboard-notify-react", - "version": "0.13.2-0.0.1", + "version": "0.13.2-0.0.3", "dependencies": { "bnc-notify": "^1.9.1", "bnc-notify-staging": "https://github.com/blocknative/notify#develop", From 82c44d83a30196a19bda4a5c12c1cb9336b633d3 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Tue, 23 Nov 2021 20:50:30 -0700 Subject: [PATCH 4/5] Add Main tag to Eth network --- src/networkEnum.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/networkEnum.js b/src/networkEnum.js index c6fffcbf..31cde2d1 100644 --- a/src/networkEnum.js +++ b/src/networkEnum.js @@ -1,5 +1,5 @@ const networkEnum = Object.freeze({ - 1: 'Ethereum', + 1: 'Ethereum Main', 3: 'Ropsten', 4: 'Rinkeby', 5: 'Goerli', From c80e3269acf931a47d4f50d4908c35b15048f621 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Wed, 24 Nov 2021 16:00:46 -0700 Subject: [PATCH 5/5] add returns to new blocks and remove consoleLog --- src/App.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index ef0ab490..1f2df723 100644 --- a/src/App.js +++ b/src/App.js @@ -74,7 +74,6 @@ const App = () => { ) window.localStorage.setItem('selectedWallet', wallet.name) - console.log(wallet) } else { provider = null setWallet({}) @@ -173,13 +172,13 @@ const App = () => { } const sendTransaction = () => { - signer.sendTransaction(txDetails).then(tx => tx.hash) + return signer.sendTransaction(txDetails).then(tx => tx.hash) } const gasPrice = () => provider.getGasPrice().then(res => res.toString()) const estimateGas = () => { - provider.estimateGas(txDetails).then(res => res.toString()) + return provider.estimateGas(txDetails).then(res => res.toString()) } const { emitter } = await notify.transaction({