From 8dd7e32590baee2c76a17d9cb6be854c0b641106 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Tue, 23 Nov 2021 17:11:03 -0700 Subject: [PATCH 1/5] 0.13.2-0.0.1: [fix] - Circle CI build (#108) * Update CI node version * Change node version CI * Fix build issue by upping resources for yarn build in config.yml, small refactors to create a networks enum, es6 arrow func standards * bump version * fix naming of network enum file * fix naming of network enum file Co-authored-by: Adam Carpenter --- .circleci/config.yml | 1 + package.json | 2 +- src/App.js | 51 ++++++++++++++++---------------------------- src/networkEnum.js | 10 +++++++++ 4 files changed, 30 insertions(+), 34 deletions(-) create mode 100644 src/networkEnum.js diff --git a/.circleci/config.yml b/.circleci/config.yml index f6a04f64..0da8fb55 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,6 +3,7 @@ jobs: deploy_stage: docker: - image: cimg/node:14.17.3 + resource_class: medium+ steps: - checkout - run: rm yarn.lock && yarn install --network-concurrency 1 diff --git a/package.json b/package.json index ca3c5d84..fc31d5df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onboard-notify-react", - "version": "0.13.2", + "version": "0.13.2-0.0.1", "dependencies": { "bnc-notify": "^1.9.1", "bnc-notify-staging": "https://github.com/blocknative/notify#develop", diff --git a/src/App.js b/src/App.js index 1a8dffbb..ca745dd6 100644 --- a/src/App.js +++ b/src/App.js @@ -5,6 +5,7 @@ import getSigner from './signer' import { initOnboard, initNotify } from './services' import { version, dependencies } from '../package.json' import avatarPlaceholder from './avatar-placeholder.png' +import networkEnum from './networkEnum' import './App.css' @@ -34,7 +35,7 @@ const internalTransferABI = [ let internalTransferContract -function App() { +const App = () => { const [address, setAddress] = useState(null) const [ens, setEns] = useState(null) const [network, setNetwork] = useState(null) @@ -86,16 +87,15 @@ function App() { }, []) useEffect(() => { - const previouslySelectedWallet = window.localStorage.getItem( - 'selectedWallet' - ) + const previouslySelectedWallet = + window.localStorage.getItem('selectedWallet') if (previouslySelectedWallet && onboard) { onboard.walletSelect(previouslySelectedWallet) } }, [onboard]) - async function readyToTransact() { + const readyToTransact = async () => { if (!provider) { const walletSelected = await onboard.walletSelect() if (!walletSelected) return false @@ -105,7 +105,7 @@ function App() { return ready } - async function sendHash() { + const sendHash = async () => { if (!toAddress) { alert('An Ethereum address to send Eth to is required.') return @@ -136,7 +136,7 @@ function App() { emitter.on('txFailed', console.log) } - async function sendInternalTransaction() { + const sendInternalTransaction = async () => { if (!toAddress) { alert('An Ethereum address to send Eth to is required.') return @@ -159,7 +159,7 @@ function App() { emitter.on('txFailed', console.log) } - async function sendTransaction() { + const sendTransaction = async () => { if (!toAddress) { alert('An Ethereum address to send Eth to is required.') } @@ -213,9 +213,13 @@ function App() { src={ens.avatar ? ens.avatar : avatarPlaceholder} alt="avatar" > -
{ens.name}
+
+ {ens.name} +
) : ( address && {address} @@ -225,7 +229,9 @@ function App() { {Number(balance) > 0 ? balance / 1000000000000000000 : balance} ETH )} - {network && {networkName(network)} network} + {network && ( + {networkEnum?.[Number(network)] || 'local'} network + )}
@@ -529,25 +535,4 @@ function App() { ) } -function networkName(id) { - switch (Number(id)) { - case 1: - return 'main' - case 3: - return 'ropsten' - case 4: - return 'rinkeby' - case 5: - return 'goerli' - case 42: - return 'kovan' - case 100: - return 'xdai' - case 'localhost': - return 'localhost' - default: - return 'local' - } -} - export default App diff --git a/src/networkEnum.js b/src/networkEnum.js new file mode 100644 index 00000000..8bb867f2 --- /dev/null +++ b/src/networkEnum.js @@ -0,0 +1,10 @@ +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 From 537828c96caccfa03fc851b7d794e07ea9dae7fd Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Mon, 29 Nov 2021 10:44:35 -0700 Subject: [PATCH 2/5] 0.13.2-0.0.2: [fix] - Increase resources for circleCI prod build (#109) * Increase resources for circleCI prod build * increment version Co-authored-by: Adam Carpenter --- .circleci/config.yml | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0da8fb55..53bd8dca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,9 +11,11 @@ jobs: - run: ssh -oStrictHostKeyChecking=no -v $EC2_PROD_USER@$EC2_PROD_IP "sh /home/ubuntu/remove.sh reactdemo-staging" - run: scp -oStrictHostKeyChecking=no -v -r /home/circleci/project/build/* $EC2_PROD_USER@$EC2_PROD_IP:/home/ubuntu/reactdemo-staging/ - run: ssh -oStrictHostKeyChecking=no -v $EC2_PROD_USER@$EC2_PROD_IP "sh /home/ubuntu/move.sh reactdemo-staging" + deploy_prod: docker: - image: cimg/node:14.17.3 + resource_class: medium+ steps: - checkout - run: yarn cache clean && yarn install --network-concurrency 1 diff --git a/package.json b/package.json index fc31d5df..9c9e229c 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.2", "dependencies": { "bnc-notify": "^1.9.1", "bnc-notify-staging": "https://github.com/blocknative/notify#develop", From e926394bc5390170a5ea3a06df08716ea961a150 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Mon, 29 Nov 2021 11:02:45 -0700 Subject: [PATCH 3/5] 0.13.2-0.0.3: [enhancement] - Add popular networks support, reformatting using prettier (#110) * Added popular networks to enum * Reformat code using prettier * increment version * Add Main tag to Eth network * add returns to new blocks and remove consoleLog Co-authored-by: Adam Carpenter --- package.json | 2 +- src/App.js | 16 +++++++++------- src/networkEnum.js | 20 ++++++++++++-------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 9c9e229c..e2047a45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onboard-notify-react", - "version": "0.13.2-0.0.2", + "version": "0.13.2-0.0.3", "dependencies": { "bnc-notify": "^1.9.1", "bnc-notify-staging": "https://github.com/blocknative/notify#develop", diff --git a/src/App.js b/src/App.js index ca745dd6..1f2df723 100644 --- a/src/App.js +++ b/src/App.js @@ -171,13 +171,15 @@ const App = () => { value: 1000000000000000 } - const sendTransaction = () => - signer.sendTransaction(txDetails).then(tx => tx.hash) + const sendTransaction = () => { + 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()) + const estimateGas = () => { + return provider.estimateGas(txDetails).then(res => res.toString()) + } const { emitter } = await notify.transaction({ sendTransaction, @@ -203,7 +205,9 @@ const App = () => { emitter.on('txFailed', console.log) } - return onboard && notify ? ( + if (!onboard || !notify) return
Loading...
+ + return (
{ens && ens.name ? ( @@ -530,8 +534,6 @@ const App = () => {
- ) : ( -
Loading...
) } diff --git a/src/networkEnum.js b/src/networkEnum.js index 8bb867f2..31cde2d1 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' + 1: 'Ethereum Main', + 3: 'Ropsten', + 4: 'Rinkeby', + 5: 'Goerli', + 25: 'Cronos', + 42: 'Kovan', + 56: 'BSC', + 100: 'XDai', + 137: 'Polygon', + 250: 'Fantom', + localhost: 'localhost' }); -export default networkEnum; \ No newline at end of file +export default networkEnum; From 384ba389331b50282f711b941c85cab92abbcf23 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Mon, 29 Nov 2021 11:56:36 -0700 Subject: [PATCH 4/5] Increase circleCI build resources, code enhancements --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e2047a45..aad8176d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onboard-notify-react", - "version": "0.13.2-0.0.3", + "version": "0.13.3", "dependencies": { "bnc-notify": "^1.9.1", "bnc-notify-staging": "https://github.com/blocknative/notify#develop", From 050e6579f1736ff249feb7ab7b91d28ac3bd81df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Nov 2021 10:42:05 -0700 Subject: [PATCH 5/5] 0.13.2-0.0.4: Depandabot - Bump tmpl from 1.0.4 to 1.0.5 (#107) * Update CI node version * Change node version CI * Bump tmpl from 1.0.4 to 1.0.5 Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/daaku/nodejs-tmpl/releases) - [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5) --- updated-dependencies: - dependency-name: tmpl dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: Aaron Barnard Co-authored-by: Taylor Dawson Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a2a5e846..d738b89b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14391,9 +14391,9 @@ tmp@^0.0.33: os-tmpdir "~1.0.2" tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-arraybuffer@^1.0.0: version "1.0.1"