From 45b24e98fde2e40553455a4a70d35ffe7292a590 Mon Sep 17 00:00:00 2001 From: Mati Dastugue Date: Mon, 22 Feb 2021 06:01:51 -0300 Subject: [PATCH 1/4] Removed deprecated wallets (#1922) * Remove deprecated wallets * Bump new onboardjs version --- docs/networks.md | 2 - package.json | 2 +- .../WalletIcon/icons/icon-dapper.png | Bin 1268 -> 0 bytes .../WalletIcon/icons/icon-unilogin.svg | 77 -------------- .../components/WalletIcon/icons/index.ts | 10 -- src/config/networks/energy_web_chain.ts | 2 - src/config/networks/network.d.ts | 2 - src/config/networks/volta.ts | 2 - src/config/networks/xdai.ts | 2 - src/logic/wallets/getWeb3.ts | 2 - src/logic/wallets/utils/walletList.ts | 2 - yarn.lock | 99 ++++-------------- 12 files changed, 23 insertions(+), 179 deletions(-) delete mode 100644 src/components/AppLayout/Header/components/WalletIcon/icons/icon-dapper.png delete mode 100644 src/components/AppLayout/Header/components/WalletIcon/icons/icon-unilogin.svg diff --git a/docs/networks.md b/docs/networks.md index 1990b7e6..c048955a 100644 --- a/docs/networks.md +++ b/docs/networks.md @@ -92,12 +92,10 @@ export enum WALLETS { TREZOR = 'trezor', LEDGER = 'ledger', TRUST = 'trust', - DAPPER = 'dapper', FORTMATIC = 'fortmatic', PORTIS = 'portis', AUTHEREUM = 'authereum', TORUS = 'torus', - UNILOGIN = 'unilogin', COINBASE = 'coinbase', WALLET_LINK = 'walletLink', OPERA = 'opera', diff --git a/package.json b/package.json index d803edc4..60a25803 100644 --- a/package.json +++ b/package.json @@ -175,7 +175,7 @@ "async-sema": "^3.1.0", "axios": "0.21.1", "bignumber.js": "9.0.1", - "bnc-onboard": "^1.16.1", + "bnc-onboard": "1.19.2", "classnames": "^2.2.6", "concurrently": "^5.3.0", "connected-react-router": "6.8.0", diff --git a/src/components/AppLayout/Header/components/WalletIcon/icons/icon-dapper.png b/src/components/AppLayout/Header/components/WalletIcon/icons/icon-dapper.png deleted file mode 100644 index ea7997987910f380e5eceefb44cd0927298e337c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1268 zcmVEqky;oaun-RAGh@8HeTJvDuk6V(Nq;;P>$T@#g%&knp#C z?WbbtrC#XwmB#GW@$T01^3(MCiNKsq=Je0?`KsIZyy^AL_4dZ__RaVCpw#uw_w>y4 z@yhY_&Gqxj^YzX4^vv}5v*Y#5_3g{;^vv}0%k%Wi^a+|z(*OVfV{}qZQveAtM`Vat zBNM0H?DX!%_jm2M@$>fh`aAFZ|NsC0|Ng80|MCC-|NsC0|NsC0|Nrj)|NsC0|NsC0 z|NsC0|L_0*|NsC0|Nr*w@^JY7?ep;S@9y;3R-wkP*QfHeSGuua=!Ogy0009QNklGrPn7)n^*S3|<{ z$QC5W-g%Da!r7R%8EnhO%wHXrmUMDcz(dw`_LoCB?2|!+k?F(e=qkS$mUS=0ekL0L z-_RBe(vJRIc>Y)=PFtK*TrJ2t_vp#%?UQiVSyhh|nJ1WsCbSmTQyBm>s}!@sgFbgo z4HV;;&$S~Uz^pJSN)5bB_AU?I@MuN}vKL?3q12tl>{EC?DOW1gWnchZs&EMNDcED;sUUv=obw-RrT(dOfzF;ndMG&6PUFI2uqidu1+*7*hws zfplfKvglPKH)2&&7e%rj+U2DbNhuj(b>>u32IFJ6t)Idtha;*bo3d+@!p@-S)=Q`2 z9}tDZf9Tm!P78uh9UB7-Ib=_(3h4re+A)z0I2s-qwa{%pUn^AfN8Fsz0d(pl-x!nm zJ>0el3Iw_C*fbT|-t@8BShKSpH~W-bm@S|3TYX4-ZR}gB(~<00CYD4 z!@~#X+67+SABQq+ja!gxS@ffTlK7Oc%%?PQt553po1iP(+D%XM)orqrKpc{cY|5cX zUaiKq9|PLooz>lPXe&;z`q|1LUG~0*eihfgfKDKR}Rd78zVN(JBVLv`zHYkcJx5z z!_y56hu<3ld?#yTiyM0jCiYo^A~2NtgE57a^Zyt41McnLAc7UCl;m3W15x5~{EA(U e-P1t#f*AnDwv_yrg^yVP0000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/components/AppLayout/Header/components/WalletIcon/icons/index.ts b/src/components/AppLayout/Header/components/WalletIcon/icons/index.ts index 563cef63..71642f95 100644 --- a/src/components/AppLayout/Header/components/WalletIcon/icons/index.ts +++ b/src/components/AppLayout/Header/components/WalletIcon/icons/index.ts @@ -4,12 +4,10 @@ import walletConnectIcon from './icon-wallet-connect.svg' import trezorIcon from './icon-trezor.svg' import ledgerIcon from './icon-ledger.svg' import latticeIcon from './icon-lattice.svg' -import dapperIcon from './icon-dapper.png' import fortmaticIcon from './icon-fortmatic.svg' import portisIcon from './icon-portis.svg' import authereumIcon from './icon-authereum.png' import torusIcon from './icon-torus.svg' -import uniloginIcon from './icon-unilogin.svg' import coinbaseIcon from './icon-coinbase.svg' import operaIcon from './icon-opera.png' @@ -47,10 +45,6 @@ const WALLET_ICONS: WalletObjectsProps = { src: latticeIcon, height: 41, }, - [WALLET_PROVIDER.DAPPER]: { - src: dapperIcon, - height: 25, - }, [WALLET_PROVIDER.FORTMATIC]: { src: fortmaticIcon, height: 25, @@ -67,10 +61,6 @@ const WALLET_ICONS: WalletObjectsProps = { src: torusIcon, height: 30, }, - [WALLET_PROVIDER.UNILOGIN]: { - src: uniloginIcon, - height: 25, - }, [WALLET_PROVIDER.OPERA]: { src: operaIcon, height: 25, diff --git a/src/config/networks/energy_web_chain.ts b/src/config/networks/energy_web_chain.ts index 2db43be1..8a340c81 100644 --- a/src/config/networks/energy_web_chain.ts +++ b/src/config/networks/energy_web_chain.ts @@ -49,14 +49,12 @@ const mainnet: NetworkConfig = { WALLETS.TREZOR, WALLETS.LEDGER, WALLETS.COINBASE, - WALLETS.DAPPER, WALLETS.FORTMATIC, WALLETS.OPERA, WALLETS.OPERA_TOUCH, WALLETS.PORTIS, WALLETS.TORUS, WALLETS.TRUST, - WALLETS.UNILOGIN, WALLETS.WALLET_CONNECT, WALLETS.WALLET_LINK, WALLETS.AUTHEREUM, diff --git a/src/config/networks/network.d.ts b/src/config/networks/network.d.ts index 3a5b973d..6e4ac6ad 100644 --- a/src/config/networks/network.d.ts +++ b/src/config/networks/network.d.ts @@ -6,12 +6,10 @@ export enum WALLETS { TREZOR = 'trezor', LEDGER = 'ledger', TRUST = 'trust', - DAPPER = 'dapper', FORTMATIC = 'fortmatic', PORTIS = 'portis', AUTHEREUM = 'authereum', TORUS = 'torus', - UNILOGIN = 'unilogin', COINBASE = 'coinbase', WALLET_LINK = 'walletLink', OPERA = 'opera', diff --git a/src/config/networks/volta.ts b/src/config/networks/volta.ts index f36a09af..e41c18cf 100644 --- a/src/config/networks/volta.ts +++ b/src/config/networks/volta.ts @@ -46,14 +46,12 @@ const mainnet: NetworkConfig = { WALLETS.TREZOR, WALLETS.LEDGER, WALLETS.COINBASE, - WALLETS.DAPPER, WALLETS.FORTMATIC, WALLETS.OPERA, WALLETS.OPERA_TOUCH, WALLETS.PORTIS, WALLETS.TORUS, WALLETS.TRUST, - WALLETS.UNILOGIN, WALLETS.WALLET_LINK, WALLETS.AUTHEREUM, WALLETS.LATTICE, diff --git a/src/config/networks/xdai.ts b/src/config/networks/xdai.ts index 3806260b..e0763b78 100644 --- a/src/config/networks/xdai.ts +++ b/src/config/networks/xdai.ts @@ -40,13 +40,11 @@ const xDai: NetworkConfig = { WALLETS.TREZOR, WALLETS.LEDGER, WALLETS.COINBASE, - WALLETS.DAPPER, WALLETS.FORTMATIC, WALLETS.OPERA, WALLETS.OPERA_TOUCH, WALLETS.TORUS, WALLETS.TRUST, - WALLETS.UNILOGIN, WALLETS.WALLET_CONNECT, WALLETS.WALLET_LINK, WALLETS.AUTHEREUM, diff --git a/src/logic/wallets/getWeb3.ts b/src/logic/wallets/getWeb3.ts index c1738032..d9e32aad 100644 --- a/src/logic/wallets/getWeb3.ts +++ b/src/logic/wallets/getWeb3.ts @@ -17,10 +17,8 @@ export const WALLET_PROVIDER = { PORTIS: 'PORTIS', FORTMATIC: 'FORTMATIC', SQUARELINK: 'SQUARELINK', - UNILOGIN: 'UNILOGIN', WALLETCONNECT: 'WALLETCONNECT', OPERA: 'OPERA', - DAPPER: 'DAPPER', WALLETLINK: 'WALLETLINK', AUTHEREUM: 'AUTHEREUM', LEDGER: 'LEDGER', diff --git a/src/logic/wallets/utils/walletList.ts b/src/logic/wallets/utils/walletList.ts index f1e7c16c..eb978adc 100644 --- a/src/logic/wallets/utils/walletList.ts +++ b/src/logic/wallets/utils/walletList.ts @@ -39,7 +39,6 @@ const wallets: Wallet[] = [ LedgerTransport: (window as any).TransportNodeHid, }, { walletName: WALLETS.TRUST, preferred: true, desktop: false }, - { walletName: WALLETS.DAPPER, desktop: false }, { walletName: WALLETS.LATTICE, rpcUrl, @@ -58,7 +57,6 @@ const wallets: Wallet[] = [ }, { walletName: WALLETS.AUTHEREUM, desktop: false }, { walletName: WALLETS.TORUS, desktop: true }, - { walletName: WALLETS.UNILOGIN, desktop: true }, { walletName: WALLETS.COINBASE, desktop: false }, { walletName: WALLETS.WALLET_LINK, rpcUrl, desktop: false }, { walletName: WALLETS.OPERA, desktop: false }, diff --git a/yarn.lock b/yarn.lock index 09c3a699..3eef89a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2106,11 +2106,6 @@ dependencies: ramda "^0.26.0" -"@restless/sanitizers@^0.2.5": - version "0.2.5" - resolved "https://registry.yarnpkg.com/@restless/sanitizers/-/sanitizers-0.2.5.tgz#96a5cfa3edb52abd8fa14e77798738f3a067dbec" - integrity sha512-utsOFwv5owNnbj8HijF7uML/AURgUl5YvY4S2gpxQsrp2D1EP/4rQU/HSyYdIQaL89BoZ/5NHveRJrcFyuHo/w== - "@rollup/plugin-node-resolve@^7.1.1": version "7.1.3" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz#80de384edfbd7bfc9101164910f86078151a3eca" @@ -3695,14 +3690,6 @@ "@typescript-eslint/types" "4.14.2" eslint-visitor-keys "^2.0.0" -"@unilogin/provider@^0.6.1": - version "0.6.1" - resolved "https://registry.yarnpkg.com/@unilogin/provider/-/provider-0.6.1.tgz#427247f0cb0899d8b0d00c04a4b90ae2a3c2cb40" - integrity sha512-S96uBfoh+/nk8L6Yr+YgEV+FwQgtRnozWhgJpOhmRz128ri5Qv2SXLx5Sac33NGbs8g27PgKOyHX3dKJCvcP3g== - dependencies: - "@restless/sanitizers" "^0.2.5" - reactive-properties "^0.1.11" - "@unstoppabledomains/resolution@^1.17.0": version "1.17.0" resolved "https://registry.yarnpkg.com/@unstoppabledomains/resolution/-/resolution-1.17.0.tgz#3614e00ce241b1237ca6236e85512fcec7920549" @@ -5777,38 +5764,37 @@ bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.1.2, bn.js@^5.1.3: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b" integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ== -bnc-onboard@^1.16.1: - version "1.17.1" - resolved "https://registry.yarnpkg.com/bnc-onboard/-/bnc-onboard-1.17.1.tgz#b1178b2501fdabc9858458b6672af92697049dc2" - integrity sha512-moK0trz6bsLvd2ZHjkwJjg6jTZRslA9Q7FYcF3wKpS29Qgb64Xyypwj+6S9LtEptXtmWPPEweONAoAwQkiWcOw== +bnc-onboard@1.19.2: + version "1.19.2" + resolved "https://registry.yarnpkg.com/bnc-onboard/-/bnc-onboard-1.19.2.tgz#bc293dfebfeadc834c4219b3eae7ff827f9ff9f9" + integrity sha512-+vsc70ViYz2mJbhTXhIuVMHIqlmvGVKZVWTkI8+5xnUVoFh65GubdxuN55l/J+kgEodUHejPecswgYWUTElz8A== dependencies: "@ledgerhq/hw-app-eth" "^5.21.0" "@ledgerhq/hw-transport-u2f" "^5.21.0" "@portis/web3" "^2.0.0-beta.57" "@toruslabs/torus-embed" "^1.9.2" - "@unilogin/provider" "^0.6.1" "@walletconnect/web3-provider" "^1.3.1" authereum "^0.1.12" bignumber.js "^9.0.0" - bnc-sdk "^2.1.4" + bnc-sdk "^3.1.0" bowser "^2.10.0" - eth-lattice-keyring "^0.2.4" + eth-lattice-keyring "^0.2.7" ethereumjs-tx "^2.1.2" ethereumjs-util "^7.0.3" fortmatic "^2.2.1" hdkey "^2.0.1" regenerator-runtime "^0.13.7" - squarelink "^1.1.4" trezor-connect "^8.1.9" walletlink "^2.0.2" web3-provider-engine "^15.0.4" -bnc-sdk@^2.1.4: - version "2.1.5" - resolved "https://registry.yarnpkg.com/bnc-sdk/-/bnc-sdk-2.1.5.tgz#7f40bcf98eb0238882f5436c0e860e60be2867c0" - integrity sha512-rtwOGKjal1LQyYrdESdOfCK5L2ocS3tjoWtNacm3rkb+xjDusVnUpF/NgudJpCnv3Mwu9YDWjsLKIPKjwbJL7A== +bnc-sdk@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/bnc-sdk/-/bnc-sdk-3.1.1.tgz#60f4a56ee4d7a7a0a6ccb7ae132b7f3a63297eb3" + integrity sha512-bfQmWf8GlLBnZH0JwioImdU1PqDCjkpddwALBavOYDuKx/NMtJFwUzZP8525xxRrdGX0Lmn0BkJDAvdzJPVklg== dependencies: crypto-es "^1.2.2" + rxjs "^6.6.3" sturdy-websocket "^0.1.12" body-parser@1.19.0, body-parser@^1.16.0: @@ -8914,7 +8900,7 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -eth-block-tracker@^4.2.0, eth-block-tracker@^4.4.1, eth-block-tracker@^4.4.2: +eth-block-tracker@^4.2.0, eth-block-tracker@^4.4.2: version "4.4.3" resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-4.4.3.tgz#766a0a0eb4a52c867a28328e9ae21353812cf626" integrity sha512-A8tG4Z4iNg4mw5tP1Vung9N9IjgMNqpiMoJ/FouSFwNCGHv2X0mmOYwtQOJzki6XN7r7Tyo01S29p7b224I4jw== @@ -9009,7 +8995,7 @@ eth-json-rpc-middleware@^1.5.0: promise-to-callback "^1.0.0" tape "^4.6.3" -eth-json-rpc-middleware@^4.1.1, eth-json-rpc-middleware@^4.1.5, eth-json-rpc-middleware@^4.4.0: +eth-json-rpc-middleware@^4.1.5, eth-json-rpc-middleware@^4.4.0: version "4.4.1" resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-4.4.1.tgz#07d3dd0724c24a8d31e4a172ee96271da71b4228" integrity sha512-yoSuRgEYYGFdVeZg3poWOwAlRI+MoBIltmOB86MtpoZjvLbou9EB/qWMOWSmH2ryCWLW97VYY6NWsmWm3OAA7A== @@ -9066,12 +9052,12 @@ eth-json-rpc-middleware@^6.0.0: pify "^3.0.0" safe-event-emitter "^1.0.1" -eth-lattice-keyring@^0.2.4: - version "0.2.7" - resolved "https://registry.yarnpkg.com/eth-lattice-keyring/-/eth-lattice-keyring-0.2.7.tgz#71884f05593ca2cc11b8f4b4e4671fb55ff3f512" - integrity sha512-rKvW1sjrcXD4L7dXs+8yyvPu2WownxYSKWRDGUft/pSJxjfWG5GVCbyHQQx1+J95J1SdYamWzJmoFXNCPPFPzA== +eth-lattice-keyring@^0.2.7: + version "0.2.9" + resolved "https://registry.yarnpkg.com/eth-lattice-keyring/-/eth-lattice-keyring-0.2.9.tgz#79849fd8358542031739874b1e3a8be7ade065bc" + integrity sha512-3B2/UiQrChaAL/zOqr/g0ALYTupiGqKEqB09OaB4iLW2Yfog4EBzcK3rBdZg0MkYlesTrsN4X9zKFkvLCv3QmQ== dependencies: - gridplus-sdk latest + gridplus-sdk "^0.7.2" eth-lib@0.2.7: version "0.2.7" @@ -10667,10 +10653,10 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== -gridplus-sdk@latest: - version "0.7.1" - resolved "https://registry.yarnpkg.com/gridplus-sdk/-/gridplus-sdk-0.7.1.tgz#314619b4f9e7942f5f45b42032249ff6f08b3b67" - integrity sha512-JYsWCJ01zOmgGbsmGjrKcQRQ6MIDmYo7gZmUf2rzHDEPOmLQA9BJJxZ+36R9jHWkdttKCd9g1zFHtAzaulk+Sg== +gridplus-sdk@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/gridplus-sdk/-/gridplus-sdk-0.7.2.tgz#ea46c565ea7f8e029b7a61283f25e9f175ddfa47" + integrity sha512-fCo9QGvpwTVbqobKmkkKQxRA/zgSy5KOfQrRv9jhnmlP4uHvURKuuqnJ07mRZr+0EbGifRJp9VRmZkKjKffp+Q== dependencies: aes-js "^3.1.1" bignumber.js "^9.0.1" @@ -16935,11 +16921,6 @@ react@^16.8.3: object-assign "^4.1.1" prop-types "^15.6.2" -reactive-properties@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/reactive-properties/-/reactive-properties-0.1.12.tgz#35000ddb9b516bf5ea5b4c41154a45a7a38fdedf" - integrity sha512-jPpTyoAZOvMhq3pt87X/kZ1zT4j1aad8iafSRHOziYfhBYVYTiUjmIYAxZPmcFziF/4JbEsA7DXA91ZzdosQyQ== - read-config-file@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/read-config-file/-/read-config-file-6.0.0.tgz#224b5dca6a5bdc1fb19e63f89f342680efdb9299" @@ -18483,42 +18464,6 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -squarelink-provider-engine@^15.0.5: - version "15.0.5" - resolved "https://registry.yarnpkg.com/squarelink-provider-engine/-/squarelink-provider-engine-15.0.5.tgz#93a440c5daec517b1b494424d1c279f195cd781c" - integrity sha512-rl9586BLpN/ldujibbMsCfq+lEyY/YMkmWqYcbmKs6VUvB56fsIG23HvVFl1mPRUu7XIq4dOt+V+4G6+GcKTtQ== - dependencies: - async "^2.5.0" - backoff "^2.5.0" - clone "^2.0.0" - cross-fetch "^2.1.0" - eth-block-tracker "^4.4.1" - eth-json-rpc-filters "^4.0.2" - eth-json-rpc-infura "^3.1.0" - eth-json-rpc-middleware "^4.1.1" - eth-sig-util "^1.4.2" - ethereumjs-block "^1.2.2" - ethereumjs-tx "^1.2.0" - ethereumjs-util "^5.1.5" - ethereumjs-vm "^2.3.4" - json-rpc-error "^2.0.0" - json-stable-stringify "^1.0.1" - promise-to-callback "^1.0.0" - readable-stream "^2.2.9" - request "^2.85.0" - semaphore "^1.0.3" - ws "^5.1.1" - xhr "^2.2.0" - xtend "^4.0.1" - -squarelink@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/squarelink/-/squarelink-1.1.4.tgz#5303abf1f4a2765accf0b0de7d8b45ba19c270f8" - integrity sha512-VOLwNWhz/QgrGg5INvd7y/TddKDdS6/6FfjqtMys6nLVJA8h+h05WW5/YJLidHCSD0A+2VnPuL8m/lkP1bUk2g== - dependencies: - bignumber.js "^9.0.0" - squarelink-provider-engine "^15.0.5" - sshpk@^1.7.0: version "1.16.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" From 8e52ec5f6020fdc1d1efe9d088b65694fa600ffc Mon Sep 17 00:00:00 2001 From: nicolas Date: Mon, 22 Feb 2021 07:09:48 -0300 Subject: [PATCH 2/4] Fix notification re-appears (#1925) Co-authored-by: Daniel Sanchez --- .../store/middleware/notificationsMiddleware.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/logic/safe/store/middleware/notificationsMiddleware.ts b/src/logic/safe/store/middleware/notificationsMiddleware.ts index a3edabf5..3f7972a3 100644 --- a/src/logic/safe/store/middleware/notificationsMiddleware.ts +++ b/src/logic/safe/store/middleware/notificationsMiddleware.ts @@ -32,6 +32,8 @@ const watchedActions = [ ADD_QUEUED_TRANSACTIONS, ] +const LAST_TIME_USED_LOGGED_IN_ID = 'LAST_TIME_USED_LOGGED_IN_ID' + const sendAwaitingTransactionNotification = async ( dispatch, safeAddress, @@ -39,7 +41,6 @@ const sendAwaitingTransactionNotification = async ( notificationKey, notificationClickedCb, ) => { - const LAST_TIME_USED_LOGGED_IN_ID = 'LAST_TIME_USED_LOGGED_IN_ID' if (!dispatch || !safeAddress || !awaitingTxsSubmissionDateList || !notificationKey) { return } @@ -48,25 +49,25 @@ const sendAwaitingTransactionNotification = async ( } let lastTimeUserLoggedInForSafes = (await loadFromStorage>(LAST_TIME_USED_LOGGED_IN_ID)) || {} - const lastTimeUserLoggedIn = - lastTimeUserLoggedInForSafes && lastTimeUserLoggedInForSafes[safeAddress] - ? lastTimeUserLoggedInForSafes[safeAddress] - : null + const lastTimeUserLoggedIn = lastTimeUserLoggedInForSafes[safeAddress] + ? lastTimeUserLoggedInForSafes[safeAddress] + : null const filteredDuplicatedAwaitingTxList = awaitingTxsSubmissionDateList.filter((submissionDate) => { return lastTimeUserLoggedIn ? new Date(submissionDate) > new Date(lastTimeUserLoggedIn) : true }) - if (filteredDuplicatedAwaitingTxList.length === 0) { + if (!filteredDuplicatedAwaitingTxList.length) { return } + dispatch( enqueueSnackbar(enhanceSnackbarForAction(NOTIFICATIONS.TX_WAITING_MSG, notificationKey, notificationClickedCb)), ) lastTimeUserLoggedInForSafes = { ...lastTimeUserLoggedInForSafes, - [safeAddress]: lastTimeUserLoggedIn || new Date(), + [safeAddress]: new Date(), } await saveToStorage(LAST_TIME_USED_LOGGED_IN_ID, lastTimeUserLoggedInForSafes) } From 5665d69145b097b7783b64b3e00886beb97b2ec1 Mon Sep 17 00:00:00 2001 From: Agustin Pane Date: Mon, 22 Feb 2021 07:44:20 -0300 Subject: [PATCH 3/4] (Fix) - #1775 Nonce of cancel transaction calculation (#1886) * Fix how the nonce of the cancel transaction is calculated * make use useState to handle nonce state * fix to prevent "0" being treated as undefined Co-authored-by: nicolas Co-authored-by: Daniel Sanchez --- src/logic/safe/store/actions/createTransaction.ts | 7 ++++++- .../safe/container/hooks/useTransactionParameters.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/logic/safe/store/actions/createTransaction.ts b/src/logic/safe/store/actions/createTransaction.ts index 54d43740..81b48d91 100644 --- a/src/logic/safe/store/actions/createTransaction.ts +++ b/src/logic/safe/store/actions/createTransaction.ts @@ -80,7 +80,12 @@ export const createTransaction = ( const safeInstance = await getGnosisSafeInstanceAt(safeAddress) const lastTx = await getLastTx(safeAddress) const nextNonce = await getNewTxNonce(lastTx, safeInstance) - const nonce = txNonce ? txNonce.toString() : nextNonce + + let nonce = nextNonce + if (txNonce !== undefined) { + nonce = txNonce.toString() + } + const isExecution = await shouldExecuteTransaction(safeInstance, nonce, lastTx) const safeVersion = await getCurrentSafeVersion(safeInstance) let safeTxGas diff --git a/src/routes/safe/container/hooks/useTransactionParameters.ts b/src/routes/safe/container/hooks/useTransactionParameters.ts index 28250406..0c84a34d 100644 --- a/src/routes/safe/container/hooks/useTransactionParameters.ts +++ b/src/routes/safe/container/hooks/useTransactionParameters.ts @@ -89,7 +89,7 @@ export const useTransactionParameters = (props?: Props): TxParameters => { } const safeNonce = Number(props?.initialSafeNonce || 0) - if (!safeNonce) { + if (safeNonce === undefined) { getSafeNonce() } }, [safeAddress, props?.initialSafeNonce]) From 38ed173a84a0ffddde51c51d23b5270e701d1457 Mon Sep 17 00:00:00 2001 From: Agustin Pane Date: Mon, 22 Feb 2021 09:42:42 -0300 Subject: [PATCH 4/4] (Fix) - #1707 Cannot use larger numbers in contract interaction (#1863) * Remove withStyles from TextAreaField and fix name * Remove any type in handleSubmit from contractInteraction review * Parses the bignumber value to string --- .../{TextareaField => TextAreaField}/index.tsx | 15 ++++++++------- .../ContractInteraction/ContractABI/index.tsx | 4 ++-- .../InputComponent/ArrayTypeInput.tsx | 4 ++-- .../ContractInteraction/SendCustomTx/index.tsx | 4 ++-- .../screens/ContractInteraction/index.tsx | 2 +- .../screens/ContractInteraction/utils/index.ts | 11 +++++++++-- 6 files changed, 24 insertions(+), 16 deletions(-) rename src/components/forms/{TextareaField => TextAreaField}/index.tsx (51%) diff --git a/src/components/forms/TextareaField/index.tsx b/src/components/forms/TextAreaField/index.tsx similarity index 51% rename from src/components/forms/TextareaField/index.tsx rename to src/components/forms/TextAreaField/index.tsx index d0da397b..72bbe0db 100644 --- a/src/components/forms/TextareaField/index.tsx +++ b/src/components/forms/TextAreaField/index.tsx @@ -1,10 +1,10 @@ -import { withStyles } from '@material-ui/core/styles' -import React from 'react' +import { createStyles, makeStyles } from '@material-ui/core/styles' +import React, { ReactElement } from 'react' import Field from 'src/components/forms/Field' import TextField from 'src/components/forms/TextField' -const styles = () => ({ +const styles = createStyles({ textarea: { '& > div': { height: '140px', @@ -21,8 +21,9 @@ const styles = () => ({ }, }) -const TextareaField = ({ classes, ...props }) => ( - -) +const useStyles = makeStyles(styles) -export default withStyles(styles as any)(TextareaField) +export const TextAreaField = ({ ...props }): ReactElement => { + const classes = useStyles() + return +} diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx index 0df470c8..d31a1485 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/ContractABI/index.tsx @@ -1,7 +1,7 @@ import React from 'react' import { useField, useForm } from 'react-final-form' -import TextareaField from 'src/components/forms/TextareaField' +import { TextAreaField } from 'src/components/forms/TextAreaField' import { mustBeEthereumAddress, mustBeEthereumContractAddress } from 'src/components/forms/validator' import Col from 'src/components/layout/Col' import Row from 'src/components/layout/Row' @@ -54,7 +54,7 @@ const ContractABI = (): React.ReactElement => { return ( - + ) diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/RenderInputParams/InputComponent/ArrayTypeInput.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/RenderInputParams/InputComponent/ArrayTypeInput.tsx index 7180edcb..43a115f4 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/RenderInputParams/InputComponent/ArrayTypeInput.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/RenderInputParams/InputComponent/ArrayTypeInput.tsx @@ -1,6 +1,6 @@ import React from 'react' -import TextareaField from 'src/components/forms/TextareaField' +import { TextAreaField } from 'src/components/forms/TextAreaField' import { isAddress, isBoolean, @@ -46,7 +46,7 @@ const typePlaceholder = (text: string, type: string): string => { } const ArrayTypeInput = ({ name, text, type }: { name: string; text: string; type: string }): React.ReactElement => ( - + ) export default ArrayTypeInput diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/SendCustomTx/index.tsx b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/SendCustomTx/index.tsx index b06eb899..37a25e9f 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/SendCustomTx/index.tsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/SendCustomTx/index.tsx @@ -10,7 +10,7 @@ import QRIcon from 'src/assets/icons/qrcode.svg' import CopyBtn from 'src/components/CopyBtn' import Field from 'src/components/forms/Field' import GnoForm from 'src/components/forms/GnoForm' -import TextareaField from 'src/components/forms/TextareaField' +import { TextAreaField } from 'src/components/forms/TextAreaField' import TextField from 'src/components/forms/TextField' import { composeValidators, maxValue, minValue, mustBeFloat } from 'src/components/forms/validator' import Identicon from 'src/components/Identicon' @@ -247,7 +247,7 @@ const SendCustomTx: React.FC = ({ initialValues, onClose, onNext, contrac - = ({ const handleSubmit = async ( { contractAddress, selectedMethod, value, ...values }, submit = true, - ): Promise => { + ): Promise> => { if (value || (contractAddress && selectedMethod)) { try { const txObject = createTxObject(selectedMethod, contractAddress, values) diff --git a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/utils/index.ts b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/utils/index.ts index 354bf199..01e289d1 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/utils/index.ts +++ b/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/utils/index.ts @@ -6,6 +6,7 @@ import { AbiItemExtended } from 'src/logic/contractInteraction/sources/ABIServic import { getAddressFromDomain, getWeb3 } from 'src/logic/wallets/getWeb3' import { TransactionReviewType } from 'src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/Review' import { isValidCryptoDomainName, isValidEnsName } from 'src/logic/wallets/ethAddresses' +import { BigNumber } from 'bignumber.js' export const NO_CONTRACT = 'no contract' @@ -67,7 +68,13 @@ export const isByte = (type: string): boolean => type.indexOf('byte') === 0 export const isArrayParameter = (parameter: string): boolean => /(\[\d*])+$/.test(parameter) export const getParsedJSONOrArrayFromString = (parameter: string): (string | number)[] | null => { try { - return JSON.parse(parameter) + const arrayResult = JSON.parse(parameter) + return arrayResult.map((value) => { + if (Number.isInteger(value)) { + return new BigNumber(value).toString() + } + return value + }) } catch (err) { return null } @@ -101,7 +108,7 @@ export const createTxObject = ( values: Record, ): ContractSendMethod => { const web3 = getWeb3() - const contract: any = new web3.eth.Contract([method], contractAddress) + const contract = new web3.eth.Contract([method], contractAddress) const { inputs, name = '', signatureHash } = method const args = inputs?.map(extractMethodArgs(signatureHash, values)) || []