From c189f8588cd0c8f3c59af27891b1388abc4a7ad9 Mon Sep 17 00:00:00 2001 From: Apotheosis <97164662+0xApotheosis@users.noreply.github.com> Date: Tue, 19 Jul 2022 08:30:22 +1000 Subject: [PATCH 1/8] fix: avoid infinite render (#2184) --- src/context/WalletProvider/WalletViewsSwitch.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/context/WalletProvider/WalletViewsSwitch.tsx b/src/context/WalletProvider/WalletViewsSwitch.tsx index bc1db9f8c85..7793ec99af9 100644 --- a/src/context/WalletProvider/WalletViewsSwitch.tsx +++ b/src/context/WalletProvider/WalletViewsSwitch.tsx @@ -59,6 +59,10 @@ export const WalletViewsSwitch = () => { await cancelWalletRequests() } + const onContinue = useCallback(() => { + history.push('/select') + }, [history]) + useEffect(() => { if (initialRoute) { history.push(initialRoute) @@ -107,10 +111,7 @@ export const WalletViewsSwitch = () => { })} } /> - history.push('/select')} />} - /> + } /> From 24ed631fcc4a7a9d2d56ef6e87d5a15e537ebae3 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 19 Jul 2022 00:52:18 +0200 Subject: [PATCH 2/8] feat: bump lib packages to latest (#2176) * feat: bump lib packages to latest * feat: bump hdwallet packages * feat: bump asset-service * chore: update yarn.lock --- package.json | 28 +++++------ yarn.lock | 136 +++++++++++++++++++++++++++------------------------ 2 files changed, 87 insertions(+), 77 deletions(-) diff --git a/package.json b/package.json index 0a3982c0730..362b2f405b0 100644 --- a/package.json +++ b/package.json @@ -86,24 +86,24 @@ "@formatjs/intl-pluralrules": "^5.0.2", "@metamask/detect-provider": "^1.2.0", "@reduxjs/toolkit": "^1.8.0", - "@shapeshiftoss/asset-service": "^6.3.1", + "@shapeshiftoss/asset-service": "^6.4.0", "@shapeshiftoss/caip": "^6.3.0", "@shapeshiftoss/chain-adapters": "^7.7.0", "@shapeshiftoss/errors": "^1.1.2", - "@shapeshiftoss/hdwallet-core": "^1.25.0", - "@shapeshiftoss/hdwallet-keepkey": "^1.25.0", - "@shapeshiftoss/hdwallet-keepkey-webusb": "^1.25.0", - "@shapeshiftoss/hdwallet-keplr": "^1.25.0", - "@shapeshiftoss/hdwallet-metamask": "^1.25.0", - "@shapeshiftoss/hdwallet-native": "^1.25.0", - "@shapeshiftoss/hdwallet-native-vault": "^1.25.0", - "@shapeshiftoss/hdwallet-portis": "^1.25.0", - "@shapeshiftoss/hdwallet-tallyho": "^1.25.0", - "@shapeshiftoss/hdwallet-xdefi": "^1.25.0", - "@shapeshiftoss/investor-foxy": "^4.0.3", - "@shapeshiftoss/investor-yearn": "^4.0.3", + "@shapeshiftoss/hdwallet-core": "^1.27.0", + "@shapeshiftoss/hdwallet-keepkey": "^1.27.0", + "@shapeshiftoss/hdwallet-keepkey-webusb": "^1.27.0", + "@shapeshiftoss/hdwallet-keplr": "^1.27.0", + "@shapeshiftoss/hdwallet-metamask": "^1.27.0", + "@shapeshiftoss/hdwallet-native": "^1.27.0", + "@shapeshiftoss/hdwallet-native-vault": "^1.27.0", + "@shapeshiftoss/hdwallet-portis": "^1.27.0", + "@shapeshiftoss/hdwallet-tallyho": "^1.27.0", + "@shapeshiftoss/hdwallet-xdefi": "^1.27.0", + "@shapeshiftoss/investor-foxy": "^4.0.4", + "@shapeshiftoss/investor-yearn": "^4.0.4", "@shapeshiftoss/logger": "^1.1.2", - "@shapeshiftoss/market-service": "^6.4.1", + "@shapeshiftoss/market-service": "^6.4.2", "@shapeshiftoss/swapper": "^8.4.0", "@shapeshiftoss/types": "^7.0.0", "@shapeshiftoss/unchained-client": "^9.2.0", diff --git a/yarn.lock b/yarn.lock index 22ea96ce9e9..a72511d6d22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3737,10 +3737,10 @@ resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.1.0.tgz#7f698254aadf921e48dda8c0a6b304026b8a9323" integrity sha512-JLo+Y592QzIE+q7Dl2pMUtt4q8SKYI5jDrZxrozEQxnGVOyYE+GWK9eLkwTaeN9DDctlaRAQ3TBmzZ1qdLE30A== -"@shapeshiftoss/asset-service@^6.3.1": - version "6.3.1" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/asset-service/-/asset-service-6.3.1.tgz#303c6a09d8e52d79da510575d9541eb4e0dcf754" - integrity sha512-BWH+ruCCqqCeG7qHFySpJa2jWDandHCKhG1Rx/rQO2eHR2WKBmPirfa2ibOx0AWfgmr0AF7jCsmlxdJhb8NwUQ== +"@shapeshiftoss/asset-service@^6.4.0": + version "6.4.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/asset-service/-/asset-service-6.4.0.tgz#d3c3dd6fe206d3137fb8b7e6d825195ff50b82d8" + integrity sha512-EXeyAodlnTiuAIJ8Dx1OlAC3vvS/nDmS8XRiHky2zDrI2EbM6ZrwTJfOhOPxK2ndi1SEFnsZWg5CFHaRUrmELg== dependencies: axios "^0.26.1" identicon.js "^2.3.3" @@ -3831,7 +3831,7 @@ web-encoding "^1.1.0" wif "^2.0.6" -"@shapeshiftoss/hdwallet-core@1.25.0", "@shapeshiftoss/hdwallet-core@^1.25.0", "@shapeshiftoss/hdwallet-core@latest": +"@shapeshiftoss/hdwallet-core@1.25.0", "@shapeshiftoss/hdwallet-core@latest": version "1.25.0" resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-core/-/hdwallet-core-1.25.0.tgz#97b4e29f124ef6600f182af33e620b10bb4b0e60" integrity sha512-o4o9ww4ux7NmoBIjT3AlP6gmxKzRHvyfxpkVGuaM5bHuPa44GItO5duZwK9s38QqC0EX4z8USG1/44E2e+YaXw== @@ -3841,24 +3841,34 @@ rxjs "^6.4.0" type-assertions "^1.1.0" -"@shapeshiftoss/hdwallet-keepkey-webusb@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-keepkey-webusb/-/hdwallet-keepkey-webusb-1.25.0.tgz#cd8f5c4090695470c630e9e2e4632c940f8b6e93" - integrity sha512-rkxcrlxin12a1q/VwFFWpI93fD5qlJXd+iF1pL+4mPq0Unj1uOQMYB+rY82gF6PZ9bV56+/jYUvL36xiaBvBDw== +"@shapeshiftoss/hdwallet-core@1.27.0", "@shapeshiftoss/hdwallet-core@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-core/-/hdwallet-core-1.27.0.tgz#63ab356040f00980fbbc5d60435a7a8ea697fc7b" + integrity sha512-NmucwcYTB3uq2SmsWK6rg+bywpDDn6CFAiiYkDR52CxSxxfKSWNkV0Pq+ZeHTvd5NZ9VGL2fft4WXGMjQ0fyzA== dependencies: - "@shapeshiftoss/hdwallet-core" "1.25.0" - "@shapeshiftoss/hdwallet-keepkey" "1.25.0" + eventemitter2 "^5.0.1" + lodash "^4.17.21" + rxjs "^6.4.0" + type-assertions "^1.1.0" -"@shapeshiftoss/hdwallet-keepkey@1.25.0", "@shapeshiftoss/hdwallet-keepkey@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-keepkey/-/hdwallet-keepkey-1.25.0.tgz#52a059d2c2e111320364f425a84d816dc00b18a5" - integrity sha512-CYN0gaUegnb2rVvbBWqYJblUR4RZwDcxxWS4ig4cuYgIpOthASROJDdFnLUVXSw6WSOjTAxF06E0bCQ+ARhzvg== +"@shapeshiftoss/hdwallet-keepkey-webusb@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-keepkey-webusb/-/hdwallet-keepkey-webusb-1.27.0.tgz#1ae493296db0511883ca3fdf9ff3ff2e06769845" + integrity sha512-UOAwPHTr4Fo2dpgOtxQ0jV71jrTf89JlEzVETRcqbePlpcaNoYsgad7RrOwRoK0t7SWtckZkOQOzg23ehQrClA== + dependencies: + "@shapeshiftoss/hdwallet-core" "1.27.0" + "@shapeshiftoss/hdwallet-keepkey" "1.27.0" + +"@shapeshiftoss/hdwallet-keepkey@1.27.0", "@shapeshiftoss/hdwallet-keepkey@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-keepkey/-/hdwallet-keepkey-1.27.0.tgz#c74cad61a62c194499941cce669ae42803ca89e2" + integrity sha512-dTpJFXWOn7g+GmgaFk8F+Ge8S0pCD1WphfdjOfbsCgfNGeqjW9BNnhxC747qq0mEwfXDiHdv+vZlU6MfprDbvQ== dependencies: "@ethereumjs/common" "^2.4.0" "@ethereumjs/tx" "^3.3.0" "@keepkey/device-protocol" "^7.8.1" "@shapeshiftoss/bitcoinjs-lib" "5.2.0-shapeshift.2" - "@shapeshiftoss/hdwallet-core" "1.25.0" + "@shapeshiftoss/hdwallet-core" "1.27.0" "@shapeshiftoss/proto-tx-builder" "^0.2.1" bignumber.js "^9.0.1" bnb-javascript-sdk-nobroadcast "^2.16.14" @@ -3871,35 +3881,35 @@ semver "^6.3.0" tiny-secp256k1 "^1.1.6" -"@shapeshiftoss/hdwallet-keplr@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-keplr/-/hdwallet-keplr-1.25.0.tgz#1838ae319c5ec2e10a32c30daea77ebf4349e102" - integrity sha512-HtRghu1rfvpRnedUDx71BypC6x+uHNlfVMP+HWpZyx+jXZ1zM4PLE0kTs5OMGmH7NAP2/C23hh6m7++nPgkt6g== +"@shapeshiftoss/hdwallet-keplr@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-keplr/-/hdwallet-keplr-1.27.0.tgz#3664ffffcc10e00e6aefdef56253436a50d0c696" + integrity sha512-uXZ4T9+3p8ePuc0P1OMzHDEQOoAWOsuOTcvU4LGSCtGpGOS5xTiypepMp7Ei+2QdcGB8IkYn2/Y/NmGIpVz8ZA== dependencies: "@shapeshiftoss/caip" "3.0.0" - "@shapeshiftoss/hdwallet-core" "1.25.0" + "@shapeshiftoss/hdwallet-core" "1.27.0" "@shapeshiftoss/proto-tx-builder" "0.2.1" "@shapeshiftoss/types" "3.1.3" base64-js "^1.5.1" lodash "^4.17.21" -"@shapeshiftoss/hdwallet-metamask@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-metamask/-/hdwallet-metamask-1.25.0.tgz#ba103270c5e006698823c45a145c87c8f7c57d0d" - integrity sha512-6+gKJrl1rVxWa+3ONf9riA19zHSvNfw+r7598TrkBhu7/87lEJHqRtG1xdX8CE10+DwGT0sYgUnCuUgdzwcx1g== +"@shapeshiftoss/hdwallet-metamask@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-metamask/-/hdwallet-metamask-1.27.0.tgz#9bb28f2e5b24e5c46ec844e0077a009892865570" + integrity sha512-gF2lrahrYWlTBLhUlR5YxldxusebleLIM8cLjax9q4n3qbhLGxjBcxD7khdL9SmgWwhvUsGW/40nq/64FvtNpw== dependencies: "@metamask/detect-provider" "^1.2.0" "@metamask/onboarding" "^1.0.1" - "@shapeshiftoss/hdwallet-core" "1.25.0" + "@shapeshiftoss/hdwallet-core" "1.27.0" eth-rpc-errors "^4.0.3" lodash "^4.17.21" -"@shapeshiftoss/hdwallet-native-vault@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-native-vault/-/hdwallet-native-vault-1.25.0.tgz#31f6ed10851ee68d3e128bdde0033186ef3b2d60" - integrity sha512-bEi9pNHGl8nAcxNzkfywuex5+cmPCaaPlnOqCHItDHATdqliwCfKFk+gJ9WHGOe88hiqMrBcY8bBOsPW8tyvIA== +"@shapeshiftoss/hdwallet-native-vault@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-native-vault/-/hdwallet-native-vault-1.27.0.tgz#7fb6bf5b16c9a5d018c8e7b5495207776187b446" + integrity sha512-GKjjXHzXRK0pcUz3b09ITfDc7KJtg3RTCXgqrWj1h3Tvnq82LreOaYwXqtMDcofUpbDEZZ08GW2dfBrGJbHulg== dependencies: - "@shapeshiftoss/hdwallet-native" "1.25.0" + "@shapeshiftoss/hdwallet-native" "1.27.0" bip39 "^3.0.4" hash-wasm "^4.9.0" idb-keyval "^6.0.3" @@ -3909,14 +3919,14 @@ uuid "^8.3.2" web-encoding "^1.1.0" -"@shapeshiftoss/hdwallet-native@1.25.0", "@shapeshiftoss/hdwallet-native@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-native/-/hdwallet-native-1.25.0.tgz#87d738c083d000a1298a5d92beb3e6a267c1129b" - integrity sha512-yZZ9GOayD6MXzIlP79OoX1Xd4ZLub2ygGAl1x6uSWBiO1XXQmJY7W05roVYpRAqnduUMAUIMuc0KhHN1RzLs6w== +"@shapeshiftoss/hdwallet-native@1.27.0", "@shapeshiftoss/hdwallet-native@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-native/-/hdwallet-native-1.27.0.tgz#7179feca54357bdde9eb5c0554639317d3e74eb6" + integrity sha512-qv+qJWoC9SiSp392fjlxp02czDRC4t6xoN0TPcv0DjlW2hEqYR0bTRIut7sDBOKUVoYwu89/emqISczEaAbPWw== dependencies: "@shapeshiftoss/bitcoinjs-lib" "5.2.0-shapeshift.2" "@shapeshiftoss/fiosdk" "1.2.1-shapeshift.6" - "@shapeshiftoss/hdwallet-core" "1.25.0" + "@shapeshiftoss/hdwallet-core" "1.27.0" "@shapeshiftoss/proto-tx-builder" "^0.2.1" "@zxing/text-encoding" "^0.9.0" bchaddrjs "^0.4.9" @@ -3936,13 +3946,13 @@ tiny-secp256k1 "^1.1.6" web-encoding "^1.1.0" -"@shapeshiftoss/hdwallet-portis@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-portis/-/hdwallet-portis-1.25.0.tgz#31f927f0848b4b7c4e14ea0f97be3040e6c63efd" - integrity sha512-3Jyzjk3r6aYKDyaFf8E5goMnlDXc3R9lXbsZ0KRe9Z1otOw0Z7J7reCqEPdIwS45QJKHQ/qg8ydJA0sXEGmMuw== +"@shapeshiftoss/hdwallet-portis@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-portis/-/hdwallet-portis-1.27.0.tgz#e75a4c5b06f62fd676f00e3f0ed5ee2c96c3826b" + integrity sha512-ueAi5SNFQxzS5VaBHLsoTMTIHvOgBm0ORqz+292sSbGq9U6syfzs5/ilNrZyuD1XeTUF1ngHecSOo9oocVrYRw== dependencies: "@portis/web3" "3.0.10" - "@shapeshiftoss/hdwallet-core" "1.25.0" + "@shapeshiftoss/hdwallet-core" "1.27.0" base64-js "^1.5.1" bip32 "^2.0.4" bitcoinjs-lib "^5.1.6" @@ -3951,27 +3961,27 @@ p-lazy "^3.1.0" web3 "^1.5.1" -"@shapeshiftoss/hdwallet-tallyho@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-tallyho/-/hdwallet-tallyho-1.25.0.tgz#0592b17079c6afe97813251c83b3832deffa1b03" - integrity sha512-VpB/+zrg7CSc+BCcLHntnCHmz6wXu3O9q6yHCjuGDA1+7L5ElAHgSQ6EVzTvvfuef/aaDUzMEVAtaDFZRNluYA== +"@shapeshiftoss/hdwallet-tallyho@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-tallyho/-/hdwallet-tallyho-1.27.0.tgz#5ce1d7270f760f359c462ff027cb28c4cc8d875f" + integrity sha512-hihl5BFir82bYT9v6WpKenFELVcgYKLd1z/CsRE6cTgONQqTb1FA2hFssOq0rvtOrsxwGtKFhYqQH+Q7HMBsBA== dependencies: - "@shapeshiftoss/hdwallet-core" "1.25.0" + "@shapeshiftoss/hdwallet-core" "1.27.0" lodash "^4.17.21" tallyho-onboarding "^1.0.2" -"@shapeshiftoss/hdwallet-xdefi@^1.25.0": - version "1.25.0" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-xdefi/-/hdwallet-xdefi-1.25.0.tgz#5e73bc4f0f5c724827859f3992135689bc03cf25" - integrity sha512-F3PbEnS5Od5TIzDPebVFWarhYpr4OjBWBU9yFzUoWl1lPq0qlvpUyv9DYo3W2lZr0cTBfWmqTGWl4cYMBkVqVw== +"@shapeshiftoss/hdwallet-xdefi@^1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-xdefi/-/hdwallet-xdefi-1.27.0.tgz#9803bb66e7ae011d6ebb14440d7a94bd572e01d0" + integrity sha512-BsGrtUukcwJyWQ9OZq6kQbGNITLsHjnIyzmDFob1aovpXFsSFTQ685EdIOS0XkYxcX+KXpzyVqWD8iWeYJ+XWA== dependencies: - "@shapeshiftoss/hdwallet-core" "1.25.0" + "@shapeshiftoss/hdwallet-core" "1.27.0" lodash "^4.17.21" -"@shapeshiftoss/investor-foxy@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/investor-foxy/-/investor-foxy-4.0.3.tgz#700b2731a652882719d2a2c0ba984d18b22c6071" - integrity sha512-Oha8+Dlwh2UfsL4tR6Iv2DqdAOgn0gVXzKq/LA4MtMy7c42VaCozkqj9AXvHsxC9N5z6rQ7fRZnsdxlgTeMyaA== +"@shapeshiftoss/investor-foxy@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/investor-foxy/-/investor-foxy-4.0.4.tgz#5dd6e11c6b93e40a57a0a6420b662885ab16b9ad" + integrity sha512-OLCpBiDAWB6Ty+Ep09YGMzkw88tyr+oDq36gX23+oi6x1gWjJLbevnRWHkMoeacVAbYxVQD77rXOneQ9VJVsGg== dependencies: "@ethersproject/providers" "^5.5.3" axios "^0.26.1" @@ -3981,10 +3991,10 @@ web3-core "1.7.4" web3-utils "1.7.4" -"@shapeshiftoss/investor-yearn@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/investor-yearn/-/investor-yearn-4.0.3.tgz#c8ade423b060a13d8dc74def8a51cd809947d926" - integrity sha512-ytjfBGCZ/OKBstnaCUmlB+NCwfZkP1GP+dROlF6R6xcMkRwWQQIB+dzuKJqx1obum01vmVZ24IZXbWZ5qFQ1+g== +"@shapeshiftoss/investor-yearn@^4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/investor-yearn/-/investor-yearn-4.0.4.tgz#b93455c1b4d0d230ae845d00437281675cba1029" + integrity sha512-78ODcG5XrCdjh6jFKpxpoYg2a6ndfPtIPxjB5p598kJFb8MR3m6g3bYo98/GvCRTFT5ihHdROlOJEmdoCOR44g== dependencies: "@ethersproject/providers" "^5.5.3" "@yfi/sdk" "^1.0.30" @@ -3999,10 +4009,10 @@ resolved "https://registry.yarnpkg.com/@shapeshiftoss/logger/-/logger-1.1.2.tgz#abbcc087387823448f8ea404722aab44048460a2" integrity sha512-6P3lM5aCjQse1NoPMgniXJvz0ccEcBisyHmu+q45eyStD7qap3S953esc+l9e9cjWGNuO48+97tQh8tkfY0Wsg== -"@shapeshiftoss/market-service@^6.4.1": - version "6.4.1" - resolved "https://registry.yarnpkg.com/@shapeshiftoss/market-service/-/market-service-6.4.1.tgz#9fbc737f8afacbb4d334e645f0ef79d19c00cc2f" - integrity sha512-JPztrlPg0xspfUnLI7cRrM7ehmN0GEmGR1f/sVblpNJJQmdrjADN61shZBj4s6k5jkqPWwmF5YWLukvW3zcfsw== +"@shapeshiftoss/market-service@^6.4.2": + version "6.4.2" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/market-service/-/market-service-6.4.2.tgz#859a4a67ee971cc4d510788df84b933d5fb6077d" + integrity sha512-qamZey0ZFSehdrORi/zHMj2MYkYVSbtWxzP3dXn+ci4p0pwIF8ESzBkz+Nqil2ARAru56zTHH+BWv7BO4VMn/Q== dependencies: "@ethersproject/providers" "^5.5.3" "@yfi/sdk" "^1.0.30" From 76ffcb8cacbaf4892ee441ee0c7cd3d4806bd354 Mon Sep 17 00:00:00 2001 From: Apotheosis <97164662+0xApotheosis@users.noreply.github.com> Date: Wed, 20 Jul 2022 02:05:09 +1000 Subject: [PATCH 3/8] fix(pendo): selectively fire `onContinue` (#2187) * fix: only push if initialRoute not set * fix: add "/" initial route to logic * chore: add explanitory comment --- src/context/WalletProvider/WalletViewsSwitch.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/context/WalletProvider/WalletViewsSwitch.tsx b/src/context/WalletProvider/WalletViewsSwitch.tsx index 7793ec99af9..80b7abf397b 100644 --- a/src/context/WalletProvider/WalletViewsSwitch.tsx +++ b/src/context/WalletProvider/WalletViewsSwitch.tsx @@ -60,8 +60,9 @@ export const WalletViewsSwitch = () => { } const onContinue = useCallback(() => { - history.push('/select') - }, [history]) + // Without this check we'll fire again once a KeepKey initializes and ask the user to select a wallet again + if (!initialRoute || initialRoute === '/') history.push('/select') + }, [history, initialRoute]) useEffect(() => { if (initialRoute) { From 42fc696f2da3665115140a08c128ed2509d7e87b Mon Sep 17 00:00:00 2001 From: Apotheosis <97164662+0xApotheosis@users.noreply.github.com> Date: Wed, 20 Jul 2022 02:05:20 +1000 Subject: [PATCH 4/8] refactor: use caip helpers (#2188) --- .../Modals/FiatRamps/views/Overview.tsx | 8 ++--- src/state/slices/portfolioSlice/selectors.ts | 4 ++- src/state/slices/portfolioSlice/utils.test.ts | 34 +------------------ src/state/slices/portfolioSlice/utils.ts | 15 ++------ 4 files changed, 11 insertions(+), 50 deletions(-) diff --git a/src/components/Modals/FiatRamps/views/Overview.tsx b/src/components/Modals/FiatRamps/views/Overview.tsx index 912e55eb346..0239c67cd50 100644 --- a/src/components/Modals/FiatRamps/views/Overview.tsx +++ b/src/components/Modals/FiatRamps/views/Overview.tsx @@ -12,7 +12,7 @@ import { Text as RawText, useToast, } from '@chakra-ui/react' -import { btcChainId, cosmosChainId, ethChainId } from '@shapeshiftoss/caip' +import { btcChainId, cosmosChainId, ethChainId, fromAssetId } from '@shapeshiftoss/caip' import { ChainAdapterManager } from '@shapeshiftoss/chain-adapters' import { Dispatch, SetStateAction, useEffect, useMemo, useState } from 'react' import { useTranslate } from 'react-polyglot' @@ -22,7 +22,7 @@ import { SlideTransition } from 'components/SlideTransition' import { Text } from 'components/Text' import { useModal } from 'hooks/useModal/useModal' import { useWallet } from 'hooks/useWallet/useWallet' -import { assetIdToChainId, ChainIdType } from 'state/slices/portfolioSlice/utils' +import { ChainIdType } from 'state/slices/portfolioSlice/utils' import { FiatRampActionButtons } from '../components/FiatRampActionButtons' import { FiatRamp, supportedFiatRamps } from '../config' @@ -62,7 +62,7 @@ const generateAddresses: GenerateAddresses = props => { const assetId = selectedAsset?.assetId const empty: GenerateAddressesReturn = ['', '', ''] if (!assetId) return empty - const chainId = assetIdToChainId(assetId) + const chainId = fromAssetId(assetId).chainId switch (chainId) { case ethChainId: return [ensName || ethAddress, ethAddress, ensName || middleEllipsis(ethAddress, 11)] @@ -112,7 +112,7 @@ export const Overview: React.FC = ({ useEffect(() => { if (!wallet) return supportsAddressVerifying && setSupportsAddressVerifying(true) - setChainId(assetIdToChainId(selectedAsset?.assetId ?? '') ?? ethChainId) + setChainId(fromAssetId(selectedAsset?.assetId ?? '').chainId ?? ethChainId) // supportsAddressVerifying will cause infinite loop // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedAsset, setChainId, setSupportsAddressVerifying, wallet]) diff --git a/src/state/slices/portfolioSlice/selectors.ts b/src/state/slices/portfolioSlice/selectors.ts index 131674c808c..f5aed305f84 100644 --- a/src/state/slices/portfolioSlice/selectors.ts +++ b/src/state/slices/portfolioSlice/selectors.ts @@ -3,8 +3,10 @@ import { AccountId, AssetId, btcAssetId, + ChainId, cosmosAssetId, ethAssetId, + fromAssetId, osmosisAssetId, } from '@shapeshiftoss/caip' import { cosmos } from '@shapeshiftoss/chain-adapters' @@ -46,7 +48,6 @@ import { PortfolioBalancesById, } from './portfolioSliceCommon' import { - assetIdToChainId, findAccountsByAssetId, makeBalancesByChainBucketsFlattened, makeSortedAccountBalances, @@ -123,6 +124,7 @@ export const selectIsPortfolioLoaded = createSelector( * until the portfolioAssetIds includes supported chains fee assets, it's not fully loaded * the golf below ensures that's the case */ + const assetIdToChainId = (assetId: AssetId): ChainId => fromAssetId(assetId).chainId return !size( difference( diff --git a/src/state/slices/portfolioSlice/utils.test.ts b/src/state/slices/portfolioSlice/utils.test.ts index 5c5a6a9eead..e80d48a3681 100644 --- a/src/state/slices/portfolioSlice/utils.test.ts +++ b/src/state/slices/portfolioSlice/utils.test.ts @@ -1,31 +1,15 @@ -import { AssetId, btcChainId, ethChainId } from '@shapeshiftoss/caip' +import { AssetId } from '@shapeshiftoss/caip' import { Asset, KnownChainIds } from '@shapeshiftoss/types' import { - accountIdToChainId, accountIdToLabel, accountIdToSpecifier, - assetIdToChainId, findAccountsByAssetId, makeBalancesByChainBucketsFlattened, makeSortedAccountBalances, trimWithEndEllipsis, } from './utils' -describe('accountIdToChainId', () => { - it('can get eth chainId from accountId', () => { - const accountId = 'eip155:1:0xdef1cafe' - const chainId = accountIdToChainId(accountId) - expect(chainId).toEqual(ethChainId) - }) - - it('can get btc chainId from accountId', () => { - const accountId = 'bip122:000000000019d6689c085ae165831e93:xpubfoobarbaz' - const chainId = accountIdToChainId(accountId) - expect(chainId).toEqual(btcChainId) - }) -}) - describe('accountIdToSpecifier', () => { it('can get eth address from accountId', () => { const address = '0xdef1cafe' @@ -72,22 +56,6 @@ describe('accountIdToLabel', () => { }) }) -describe('assetIdToChainId', () => { - it('returns a ETH chainId for a given ETH assetId', () => { - const ethAssetId = 'eip155:1/erc20:0x3155ba85d5f96b2d030a4966af206230e46849cb' - const chainId = 'eip155:1' - const result = assetIdToChainId(ethAssetId) - expect(result).toEqual(chainId) - }) - - it('returns a BTC chainId for a given BTC assetId', () => { - const btcAssetId = 'bip122:000000000019d6689c085ae165831e93/slip44:0' - const btcChainId = 'bip122:000000000019d6689c085ae165831e93' - const result = assetIdToChainId(btcAssetId) - expect(result).toEqual(btcChainId) - }) -}) - describe('findAccountsByAssetId', () => { const ethAccountId = 'eip155:1:0xdef1cafe' const ethAccount2Id = 'eip155:1:0xryankk' diff --git a/src/state/slices/portfolioSlice/utils.ts b/src/state/slices/portfolioSlice/utils.ts index 479e941da99..2924d320ed1 100644 --- a/src/state/slices/portfolioSlice/utils.ts +++ b/src/state/slices/portfolioSlice/utils.ts @@ -37,15 +37,6 @@ import { export const chainIds = [ethChainId, btcChainId, cosmosChainId, osmosisChainId] as const export type ChainIdType = typeof chainIds[number] -export const assetIdToChainId = (assetId: AssetId): ChainIdType => - assetId.split('/')[0] as ChainIdType - -export const accountIdToChainId = (accountId: AccountSpecifier): ChainId => { - // accountId = 'eip155:1:0xdef1...cafe - const [chain, network] = accountId.split(':') - return `${chain}:${network}` -} - export const accountIdToSpecifier = (accountId: AccountSpecifier): string => { // in the case of account based chains (eth), this is an address // in the case of utxo based chains, this is an x/y/zpub @@ -84,7 +75,7 @@ export const accountIdToLabel = (accountId: AccountSpecifier): string => { * for now, for all intents and purposes, this is sufficient and works. * */ - const chainId = accountIdToChainId(accountId) + const chainId = fromAccountId(accountId).chainId const specifier = accountIdToSpecifier(accountId) switch (chainId) { case ethChainId: { @@ -112,7 +103,7 @@ export const accountIdToLabel = (accountId: AccountSpecifier): string => { // note - this is not really a selector, more of a util export const accountIdToFeeAssetId = (accountId: AccountSpecifier): AssetId => - chainIdToFeeAssetId(accountIdToChainId(accountId)) + chainIdToFeeAssetId(fromAccountId(accountId).chainId) export const accountIdToAccountType = (accountId: AccountSpecifier): UtxoAccountType | null => { const pubkeyVariant = last(accountId.split(':')) @@ -146,7 +137,7 @@ export const findAccountsByAssetId = ( // return the account(s) for that given assets chain if (result.length === 0) { return Object.keys(portfolioAccounts).filter( - accountId => assetIdToChainId(assetId) === accountIdToChainId(accountId), + accountId => fromAssetId(assetId).chainId === fromAccountId(accountId).chainId, ) } return result From b8ccb5cc740487aef78aa1fd3d4760495015cea2 Mon Sep 17 00:00:00 2001 From: Sankha <61096193+SankhaChak@users.noreply.github.com> Date: Tue, 19 Jul 2022 21:36:40 +0530 Subject: [PATCH 5/8] feat: show order routing protocol in confirm trade modal (#2183) * feat: show order routing protocol in confirm trade modal * fix: linting error --- src/components/Trade/TradeConfirm/TradeConfirm.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Trade/TradeConfirm/TradeConfirm.tsx b/src/components/Trade/TradeConfirm/TradeConfirm.tsx index f4b4b07c2fa..be28af17eb9 100644 --- a/src/components/Trade/TradeConfirm/TradeConfirm.tsx +++ b/src/components/Trade/TradeConfirm/TradeConfirm.tsx @@ -163,6 +163,9 @@ export const TradeConfirm = ({ history }: RouterProps) => { {`1 ${trade.sellAsset.symbol} = ${firstNonZeroDecimal( bnOrZero(trade?.rate), )} ${trade?.buyAsset?.symbol}`} + {!!fees?.tradeFeeSource && ( + @{fees?.tradeFeeSource} + )} @@ -180,10 +183,7 @@ export const TradeConfirm = ({ history }: RouterProps) => { From ff22fff27cac6be376be654da926a9a62817eceb Mon Sep 17 00:00:00 2001 From: 0xdef1cafe <88504456+0xdef1cafe@users.noreply.github.com> Date: Tue, 19 Jul 2022 10:48:22 -0600 Subject: [PATCH 6/8] fix: pendo modal copy changes --- src/assets/translations/en/main.json | 2 +- src/plugins/pendo/components/OptInModal/OptInModalBody.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/translations/en/main.json b/src/assets/translations/en/main.json index a46d96640e6..70d2264cf8f 100644 --- a/src/assets/translations/en/main.json +++ b/src/assets/translations/en/main.json @@ -1166,7 +1166,7 @@ "title": "Help us improve ShapeShift", "description": "ShapeShift would like to gather usage data to better understand how our users interact with the app. This data will be used to continually improve the usability and user experience of our product.", "actionsSentence": "ShapeShift will...", - "noThanks": "No Thanks, take me to the private version", + "noThanks": "No thanks, take me to the private version", "sendEvents": "Send anonymized click and pageview events", "neverCollectPersonalInformations": "Never collect keys, addresses, transactions, balances, or any personal information ", "neverCollectIp": "Never collect your full IP address", diff --git a/src/plugins/pendo/components/OptInModal/OptInModalBody.tsx b/src/plugins/pendo/components/OptInModal/OptInModalBody.tsx index 7dd1814baa5..27f9c20ad98 100644 --- a/src/plugins/pendo/components/OptInModal/OptInModalBody.tsx +++ b/src/plugins/pendo/components/OptInModal/OptInModalBody.tsx @@ -148,7 +148,7 @@ export const OptInModalBody: React.FC = ({ onContinue }) => { onClick={handleConfirm} data-test='consent-optin-continue-button' > - +