From 58e8fe1bc030ef167985d4f2bfff6074f4cd8f20 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Mon, 14 Mar 2022 16:24:49 +0100 Subject: [PATCH 01/27] Adds baseUrl to tsconfig --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index bf33c4c2..47883185 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "resolveJsonModule": true, "jsx": "preserve", "isolatedModules": true, - "incremental": true + "incremental": true, + "baseUrl": "." }, "exclude": ["node_modules", ".next", "out", "public/datafeeds"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"] From 9dbc6f452dbdede82ea879f8b4782970b42b64e4 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Mon, 14 Mar 2022 16:25:04 +0100 Subject: [PATCH 02/27] Adds solana wallet adapter packages --- package.json | 6 +- yarn.lock | 765 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 748 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 70bbfc6e..b60a6e30 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,11 @@ "@jup-ag/react-hook": "^1.0.0-beta.16", "@project-serum/serum": "0.13.55", "@project-serum/sol-wallet-adapter": "0.2.0", - "@solana/web3.js": "^1.31.0", + "@solana/wallet-adapter-base": "^0.9.5", + "@solana/wallet-adapter-react": "^0.15.4", + "@solana/wallet-adapter-react-ui": "^0.9.6", + "@solana/wallet-adapter-wallets": "^0.15.5", + "@solana/web3.js": "^1.36.0", "@solflare-wallet/pfp": "^0.0.6", "@solflare-wallet/sdk": "^1.0.10", "@tippyjs/react": "^4.2.5", diff --git a/yarn.lock b/yarn.lock index c66434b7..818bbc32 100644 --- a/yarn.lock +++ b/yarn.lock @@ -975,7 +975,7 @@ dependencies: regenerator-runtime "^0.12.0" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.17", "@babel/runtime@^7.14.5", "@babel/runtime@^7.2.0", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.17", "@babel/runtime@^7.14.5", "@babel/runtime@^7.16.0", "@babel/runtime@^7.2.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": version "7.17.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.2.tgz#66f68591605e59da47523c631416b18508779941" integrity sha512-hzeyJyMA1YGdJTuWU0e/j4wKXrU4OMFvY2MSlaI9B7VQb0r5cxTE3EAIS2Q7Tn2RIcDkRvTA/v2JsAEhxe99uw== @@ -1020,9 +1020,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@blockworks-foundation/mango-client@git+https://github.com/blockworks-foundation/mango-client-v3.git": +"@blockworks-foundation/mango-client@^3.3.18": version "3.3.19" - resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#ee1adfcddeb3dfe04851dcbc784aad741963359d" + resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-client/-/mango-client-3.3.19.tgz#6c06eaa04ac848384fda4abb6b1219f9022970ce" + integrity sha512-Us/8wYfDjvPwAUvO63Q8vHE+shTqd0BfZRzdHiWGkWh0Pwyj/Z2Kv9usNL0QN8Jk2bME+jkzqefCZSWCPKv8gQ== dependencies: "@project-serum/anchor" "^0.21.0" "@project-serum/serum" "0.13.55" @@ -1036,6 +1037,17 @@ dotenv "^10.0.0" yargs "^17.0.1" +"@blocto/sdk@^0.2.21": + version "0.2.21" + resolved "https://registry.yarnpkg.com/@blocto/sdk/-/sdk-0.2.21.tgz#40b729f0ef6b2e46942dfe992f5cccb6abaa4403" + integrity sha512-yolSah+bYEZGzbBYr0GuQ2Pca1h95aF/btDJvcEyranosyR27kokvRKiPTX4Sost+giAD+Z6vrD8/hM6E+LnUw== + dependencies: + "@solana/web3.js" "^1.30.2" + bs58 "^4.0.1" + buffer "^6.0.3" + eip1193-provider "^1.0.1" + js-sha3 "^0.8.0" + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -1310,6 +1322,31 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@json-rpc-tools/provider@^1.5.5": + version "1.7.6" + resolved "https://registry.yarnpkg.com/@json-rpc-tools/provider/-/provider-1.7.6.tgz#8a17c34c493fa892632e278fd9331104e8491ec6" + integrity sha512-z7D3xvJ33UfCGv77n40lbzOYjZKVM3k2+5cV7xS8G6SCvKTzMkhkUYuD/qzQUNT4cG/lv0e9mRToweEEVLVVmA== + dependencies: + "@json-rpc-tools/utils" "^1.7.6" + axios "^0.21.0" + safe-json-utils "^1.1.1" + ws "^7.4.0" + +"@json-rpc-tools/types@^1.7.6": + version "1.7.6" + resolved "https://registry.yarnpkg.com/@json-rpc-tools/types/-/types-1.7.6.tgz#5abd5fde01364a130c46093b501715bcce5bdc0e" + integrity sha512-nDSqmyRNEqEK9TZHtM15uNnDljczhCUdBmRhpNZ95bIPKEDQ+nTDmGMFd2lLin3upc5h2VVVd9tkTDdbXUhDIQ== + dependencies: + keyvaluestorage-interface "^1.0.0" + +"@json-rpc-tools/utils@^1.7.6": + version "1.7.6" + resolved "https://registry.yarnpkg.com/@json-rpc-tools/utils/-/utils-1.7.6.tgz#67f04987dbaa2e7adb6adff1575367b75a9a9ba1" + integrity sha512-HjA8x/U/Q78HRRe19yh8HVKoZ+Iaoo3YZjakJYxR+rw52NHo6jM+VE9b8+7ygkCFXl/EHID5wh/MkXaE/jGyYw== + dependencies: + "@json-rpc-tools/types" "^1.7.6" + "@pedrouid/environment" "^1.0.1" + "@jup-ag/core@1.0.0-beta.16": version "1.0.0-beta.16" resolved "https://registry.yarnpkg.com/@jup-ag/core/-/core-1.0.0-beta.16.tgz#76e0f9a4adbe261675ab99a438dac43f20ab28ec" @@ -1374,6 +1411,45 @@ dependencies: "@jup-ag/core" "1.0.0-beta.16" +"@ledgerhq/devices@^6.24.1": + version "6.24.1" + resolved "https://registry.yarnpkg.com/@ledgerhq/devices/-/devices-6.24.1.tgz#9696d7831aa1a1a8204cdfa55df13f892b7da162" + integrity sha512-6SNXWXxojUF6WKXMVIbRs15Mveg+9k0RKJK/PKlwZh929Lnr/NcbONWdwPjWKZAp1g82eEPT4jIkG6qc4QXlcA== + dependencies: + "@ledgerhq/errors" "^6.10.0" + "@ledgerhq/logs" "^6.10.0" + rxjs "6" + semver "^7.3.5" + +"@ledgerhq/errors@^6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.10.0.tgz#dda9127b65f653fbb2f74a55e8f0e550d69de6e4" + integrity sha512-fQFnl2VIXh9Yd41lGjReCeK+Q2hwxQJvLZfqHnKqWapTz68NHOv5QcI0OHuZVNEbv0xhgdLhi5b65kgYeQSUVg== + +"@ledgerhq/hw-transport-webhid@^6.11.2": + version "6.24.1" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-webhid/-/hw-transport-webhid-6.24.1.tgz#6ffcf42140023be8e5c6365b944656de2e3efd82" + integrity sha512-jeOB4oSQyytJD99FU+xNUkEflgSB6hWUbzhEqnz7fExnGJhMrRT39035dEmSdwshsOFBhzR/IwTUzlwNZzhNxQ== + dependencies: + "@ledgerhq/devices" "^6.24.1" + "@ledgerhq/errors" "^6.10.0" + "@ledgerhq/hw-transport" "^6.24.1" + "@ledgerhq/logs" "^6.10.0" + +"@ledgerhq/hw-transport@^6.11.2", "@ledgerhq/hw-transport@^6.24.1": + version "6.24.1" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.24.1.tgz#5e787268e6d5ce4f9f0d53b0d520c1f071c2d1ae" + integrity sha512-cOhxkQJrN7DvPFLLXAS2nqAZ7NIDaFqnbgu9ugTccgbJm2/z7ClRZX/uQoI4FscswZ47MuJQdXqz4nK48phteQ== + dependencies: + "@ledgerhq/devices" "^6.24.1" + "@ledgerhq/errors" "^6.10.0" + events "^3.3.0" + +"@ledgerhq/logs@^6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/logs/-/logs-6.10.0.tgz#c012c1ecc1a0e53d50e6af381618dca5268461c1" + integrity sha512-lLseUPEhSFUXYTKj6q7s2O3s2vW2ebgA11vMAlKodXGf5AFw4zUoEbTz9CoFOC9jS6xY4Qr8BmRnxP/odT4Uuw== + "@mercurial-finance/optimist@~0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@mercurial-finance/optimist/-/optimist-0.1.0.tgz#853f8032f4a48a94ae91d6a39251e975ebcfbe0f" @@ -1593,6 +1669,11 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@pedrouid/environment@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@pedrouid/environment/-/environment-1.0.1.tgz#858f0f8a057340e0b250398b75ead77d6f4342ec" + integrity sha512-HaW78NszGzRZd9SeoI3JD11JqY+lubnaOx7Pewj5pfjqWXOEATpeKIFb9Z4t2WBUK2iryiXX3lzWwmYWgUL0Ug== + "@popperjs/core@^2.9.0": version "2.11.2" resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.2.tgz#830beaec4b4091a9e9398ac50f865ddea52186b9" @@ -1697,7 +1778,7 @@ bs58 "^4.0.1" eventemitter3 "^4.0.4" -"@project-serum/sol-wallet-adapter@^0.2.0": +"@project-serum/sol-wallet-adapter@^0.2.0", "@project-serum/sol-wallet-adapter@^0.2.6": version "0.2.6" resolved "https://registry.yarnpkg.com/@project-serum/sol-wallet-adapter/-/sol-wallet-adapter-0.2.6.tgz#b4cd25a566294354427c97c26d716112b91a0107" integrity sha512-cpIb13aWPW8y4KzkZAPDgw+Kb+DXjCC6rZoH74MGm3I/6e/zKyGnfAuW5olb2zxonFqsYgnv7ev8MQnvSgJ3/g== @@ -1789,7 +1870,213 @@ buffer-layout "^1.2.0" dotenv "10.0.0" -"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0": +"@solana/wallet-adapter-base@^0.9.3", "@solana/wallet-adapter-base@^0.9.4", "@solana/wallet-adapter-base@^0.9.5": + version "0.9.5" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.5.tgz#6780dd096d30f0e1ffc9c7869029ec37b2a2fc9e" + integrity sha512-KCrSB2s8lA38Bd+aPvHlwPEHZU1owD6LSCikjumUaR3HCcpv+V1lxgQX+tdNaDyEVTKlAYNd0uJU+yQfQlkiOA== + dependencies: + "@solana/web3.js" "^1.36.0" + eventemitter3 "^4.0.0" + +"@solana/wallet-adapter-bitkeep@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-bitkeep/-/wallet-adapter-bitkeep-0.3.3.tgz#a531f3ba98918708ee885bee07897b13c1911313" + integrity sha512-4oUqAANJ0smSj+ukjzZyjSf+nM6/vN6aPT9OppP8zZegUHoVp0TeHs5/AZ+s+nxs0Wiv1Es8x8GXAy1FLrSAxg== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-bitpie@^0.5.2": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-bitpie/-/wallet-adapter-bitpie-0.5.3.tgz#af6740a4ec9c531e55f6adcdb45dfda0191c4267" + integrity sha512-hRD91Pfj47taJgIwYaqLVNZ3bJqmlL9SpvL2RVWBqKDIRZ0zwSuiv0+QyOWfcwAJUCxZh4qT1Hr4Fd9EnC1OOQ== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-blocto@^0.5.2": + version "0.5.4" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-blocto/-/wallet-adapter-blocto-0.5.4.tgz#a122b40a1cd6a0443033ab7256ed3bfbdc39763d" + integrity sha512-P4CDZtdnt2hkLEU3foNhj4vm/lGsrHcE1ljAUKRZnS+jhI81q7592o07Sbp1xFYO+OTDu6rI9hS5JfngDzrK7Q== + dependencies: + "@blocto/sdk" "^0.2.21" + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-clover@^0.4.2": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-clover/-/wallet-adapter-clover-0.4.4.tgz#5951147fdb6e789b62ec2098b6f36c2106c7b8b5" + integrity sha512-QNU3/gR/ODbwlFPis+wNrQbSS5lgaownlz9V4Af4iC2AZlbuUSArxk6pCGt+3o6hxBBd+gk+lnadt1uICOfc5w== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-coin98@^0.5.2": + version "0.5.4" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-coin98/-/wallet-adapter-coin98-0.5.4.tgz#0bbc4ae1ffac7566f29c14a3de6669a005c39ed6" + integrity sha512-sVcJnoy9tcq5X362812OW7dIuppYSXQvDAVoh783odWLNZsEHaGSGNXLNf2PM4xYfZEU6ZddW77IwIabFim/zg== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.36.0" + bs58 "^4.0.0" + +"@solana/wallet-adapter-coinhub@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-coinhub/-/wallet-adapter-coinhub-0.3.3.tgz#9a6e1cfc96b5eca5340de4df8f5023f13e7b141a" + integrity sha512-6TDj2/uObM/MoPO4DS/0qsKI/JIRUVl/KKST31HYIGWvQeP+oLRWMvCXwgczCxvLvxe/xAndtwxA4PbaiwhG3g== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-glow@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-glow/-/wallet-adapter-glow-0.1.0.tgz#86c97ada8b197bcdf9efe831bef121b399ab4e07" + integrity sha512-gmML6XuHI/oIos8JpLQF21+xrNStaQrdS2wurQhOgH20V6AVczAH+8+GfmD4bVJ6MRo+h981N6/K0I5NuEbVOg== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-huobi@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-huobi/-/wallet-adapter-huobi-0.1.0.tgz#aa5158e9b2d79e753c2da55f26609777eb4651c6" + integrity sha512-VdJT/eSO1qhVYODV+BYEptqlZoy3YhZHJsP0+4EdrBcyFqg8MHu1+kZujhMThccWoZmpl+CcetnYHuxz7EYZdg== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-ledger@^0.9.8": + version "0.9.9" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-ledger/-/wallet-adapter-ledger-0.9.9.tgz#5f24e8275c9b3420f9c91da08440eaf974b669c7" + integrity sha512-eROwgjycBq54FaVlHEdkb+M7TwE06gnhH6YzjLNF+hJydUpErCRxRgrVUsUehxQIbFSJ0YdvF181arLvxG/X2A== + dependencies: + "@ledgerhq/hw-transport" "^6.11.2" + "@ledgerhq/hw-transport-webhid" "^6.11.2" + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.20.0" + buffer "^6.0.3" + +"@solana/wallet-adapter-mathwallet@^0.9.2": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-mathwallet/-/wallet-adapter-mathwallet-0.9.3.tgz#fada9c5aafec74fcb872baea02de04cb9784209c" + integrity sha512-V0YIzhFwITy6mezLXjQKMK6XWkHUOwtMZO2Ar7MoFGWizD/lHvMYPbcyLCL5NVzQO1f/YCV2UfG5E6sdVpyEBQ== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-phantom@^0.9.2": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-phantom/-/wallet-adapter-phantom-0.9.3.tgz#68832deccf43af0043d70498fcd11a9006e27b46" + integrity sha512-XBDgG5BzxRolHW2OchaIccvsPeQ0PKl/Xy303x7oHS3rW+HUwjIMqaKKpmV66A6rMr1x+ytL+tp6p7t3M2oD3Q== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-react-ui@^0.9.6": + version "0.9.6" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-react-ui/-/wallet-adapter-react-ui-0.9.6.tgz#93420096b57acb7d3881095defdba1487814559b" + integrity sha512-nGI1rRA318yHc19x8tvhsouDss+7olHdxyGpZGtZN6/SUQzoRk94OB/+4XMkPL4Aosv3GIqWHFqqQfhcxCbOTQ== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/wallet-adapter-react" "^0.15.3" + "@solana/web3.js" "^1.36.0" + +"@solana/wallet-adapter-react@^0.15.3", "@solana/wallet-adapter-react@^0.15.4": + version "0.15.4" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-react/-/wallet-adapter-react-0.15.4.tgz#413c3fa6893e9d809e5a6dd4730695fba942967b" + integrity sha512-QB8tE1IqYxvHrdDZP3DGICuCq6xydvjUYhW+usIahORmHniFF62Mp/LPfdAGZRDFF7U2/rZPktGFiOxWUJA7Qw== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.36.0" + +"@solana/wallet-adapter-safepal@^0.5.2": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-safepal/-/wallet-adapter-safepal-0.5.3.tgz#01c8e9be225e420bc6000968c0cf84355605a4ad" + integrity sha512-30EOCDYJ/bq1HqKSkBlzCHsWITa82WJml2O46/CMUl1mOhxOJ1ghFSmIhqyHlgqQPcd5Orqvp1db+uj8v/i58w== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-slope@^0.5.2": + version "0.5.4" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-slope/-/wallet-adapter-slope-0.5.4.tgz#41056cbd870b8a0866e4e908cfe6575773fb0383" + integrity sha512-I8WgeomiQSnhxn1ebsPNhiHqzNx0clWGwQG0fOEFcoxxE3puKpNF27Vk+XFx8XS1igWPTPntFbiOUocKT3A63A== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.20.0" + bs58 "^4.0.0" + +"@solana/wallet-adapter-solflare@^0.6.3": + version "0.6.6" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-solflare/-/wallet-adapter-solflare-0.6.6.tgz#70ffd87db78e65bd7f53910996f8c50c032a0b54" + integrity sha512-4H4FbRpvUeCGQ9HevLpCc9hCtwjRL4pf7kk/4QoGdu+jLbXo1doKTiT8sY1svksNS8JWrcr0kn7SpePmiy7xhg== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.20.0" + "@solflare-wallet/sdk" "^1.0.11" + +"@solana/wallet-adapter-sollet@^0.11.0": + version "0.11.1" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-sollet/-/wallet-adapter-sollet-0.11.1.tgz#021ec1c8f402601c8898175e1fb39b504a25cb43" + integrity sha512-lRgz8+57g2piBqxYHA4HqKuHY/gDCVY5vCqEa2pColfKtIETqKRcpF1P34R4MD5mLuMjLEQP9Hjt285NIOeVjQ== + dependencies: + "@project-serum/sol-wallet-adapter" "^0.2.6" + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-solong@^0.9.2": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-solong/-/wallet-adapter-solong-0.9.3.tgz#272e11b3b3c8ef596a223eda42657d1b6441a76d" + integrity sha512-TFdKK7/Vsta9ajY6+cQ9NGuhmhgsEJ8PR4Y9GWb9ao9OdcLhTFIwOV+IOeD1Ats1ORyukpzjSjsW/VA2UZkTVQ== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-tokenpocket@^0.4.2": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-tokenpocket/-/wallet-adapter-tokenpocket-0.4.3.tgz#21cad947dc082b064602ed917b24d91d31253292" + integrity sha512-D40nNp92bFwcDw/aQ3bKZMvoxk2s65PJiR9t3JBb4DOtlEafa9GFhwmRYkSH6SB7gRGFUKWWjBWpACRRirFjDA== + dependencies: + "@solana/wallet-adapter-base" "^0.9.3" + "@solana/web3.js" "^1.20.0" + +"@solana/wallet-adapter-torus@^0.11.10": + version "0.11.11" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-torus/-/wallet-adapter-torus-0.11.11.tgz#74092f409df97eab964b73b8992a59a6d97f1c56" + integrity sha512-U6qt2QEkMwOVUV19jbsXlzW8a2ff/vo34SXEGekFXe8hg847u2N8GmByDRdnEyAqbQ9TZPbbiPjID7xhLZY6Wg== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/web3.js" "^1.20.0" + "@toruslabs/solana-embed" "^0.1.5" + assert "^2.0.0" + process "^0.11.10" + stream-browserify "^3.0.0" + +"@solana/wallet-adapter-wallets@^0.15.5": + version "0.15.5" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-wallets/-/wallet-adapter-wallets-0.15.5.tgz#a4f0cb38430705d89b45872a0b4883c7ea32aa9a" + integrity sha512-wDy3AhfoXemIPubKasQm/yhWyA0/2mjLJbQpn9jQ/JcxSEwSeUjSrebNE3tYMZ9Pi94ShLmtN/bEHSwo7nCoug== + dependencies: + "@solana/wallet-adapter-base" "^0.9.4" + "@solana/wallet-adapter-bitkeep" "^0.3.2" + "@solana/wallet-adapter-bitpie" "^0.5.2" + "@solana/wallet-adapter-blocto" "^0.5.2" + "@solana/wallet-adapter-clover" "^0.4.2" + "@solana/wallet-adapter-coin98" "^0.5.2" + "@solana/wallet-adapter-coinhub" "^0.3.2" + "@solana/wallet-adapter-glow" "^0.1.0" + "@solana/wallet-adapter-huobi" "^0.1.0" + "@solana/wallet-adapter-ledger" "^0.9.8" + "@solana/wallet-adapter-mathwallet" "^0.9.2" + "@solana/wallet-adapter-phantom" "^0.9.2" + "@solana/wallet-adapter-safepal" "^0.5.2" + "@solana/wallet-adapter-slope" "^0.5.2" + "@solana/wallet-adapter-solflare" "^0.6.3" + "@solana/wallet-adapter-sollet" "^0.11.0" + "@solana/wallet-adapter-solong" "^0.9.2" + "@solana/wallet-adapter-tokenpocket" "^0.4.2" + "@solana/wallet-adapter-torus" "^0.11.10" + +"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.20.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.34.0", "@solana/web3.js@^1.36.0": version "1.36.0" resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.36.0.tgz#79d7d5217b49b80139f4de68953adc5b9a9a264f" integrity sha512-RNT1451iRR7TyW7EJKMCrH/0OXawIe4zVm0DWQASwXlR/u1jmW6FrmH0lujIh7cGTlfOVbH+2ZU9AVUPLBFzwA== @@ -1892,6 +2179,16 @@ eventemitter3 "^4.0.7" uuid "^8.3.2" +"@solflare-wallet/sdk@^1.0.11": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@solflare-wallet/sdk/-/sdk-1.0.11.tgz#2eaf3d5935f96dc4286ae356c4c83f6866947ff2" + integrity sha512-zm+snfxpxfEvPytz0CdPn+LSMLrtYIl8qDjC2jhey4hWTkkZmumgKMKfNb9w6cpHtGgWiQkxSP2KI48xuKmuxw== + dependencies: + "@project-serum/sol-wallet-adapter" "0.2.0" + bs58 "^4.0.1" + eventemitter3 "^4.0.7" + uuid "^8.3.2" + "@svgr/babel-plugin-add-jsx-attribute@^6.0.0": version "6.0.0" resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-6.0.0.tgz#bd6d1ff32a31b82b601e73672a789cc41e84fe18" @@ -2030,6 +2327,69 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== +"@toruslabs/base-controllers@^1.4.2": + version "1.6.6" + resolved "https://registry.yarnpkg.com/@toruslabs/base-controllers/-/base-controllers-1.6.6.tgz#7a11947e70f096e35ddd657892922734795d1253" + integrity sha512-+pvb2niNDT/Fgt+ACqliHCXhS9dfflIsBzRTcQoqJe5PwoKQ5mKly0pX4Ks8QW1Ykc2b2JGCPKj8bhBijymzkQ== + dependencies: + "@toruslabs/http-helpers" "^2.2.0" + "@toruslabs/openlogin-jrpc" "^1.6.0" + async-mutex "^0.3.2" + bignumber.js "^9.0.2" + bowser "^2.11.0" + broadcast-channel "^4.10.0" + eth-rpc-errors "^4.0.3" + ethereumjs-util "^7.1.4" + json-rpc-random-id "^1.0.1" + lodash "^4.17.21" + loglevel "^1.8.0" + +"@toruslabs/http-helpers@^2.1.4", "@toruslabs/http-helpers@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@toruslabs/http-helpers/-/http-helpers-2.2.0.tgz#c494984701ff60eb93c0eaef279daa93b5bcea81" + integrity sha512-xkzZZuE+DmWmJBTYneCrMJY24izNQCOdoJMpsXKQx20Va/rTQvNPbdkpx9LBf/pisk8jOwETNAfFQ8YTBc/bZw== + dependencies: + lodash.merge "^4.6.2" + loglevel "^1.8.0" + +"@toruslabs/openlogin-jrpc@^1.3.3", "@toruslabs/openlogin-jrpc@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@toruslabs/openlogin-jrpc/-/openlogin-jrpc-1.6.0.tgz#579307a97d7a9d173863c6dcd4dc178e83d4a663" + integrity sha512-lUpzGhmg1x0TwAxS1FE9y7dDbqNCACi2cXyNEaQdvHRQYLQnN46cq75nAAbLKCjKwM5ThhrRpO+p/iH9ESjgYQ== + dependencies: + "@toruslabs/openlogin-utils" "^1.6.0" + end-of-stream "^1.4.4" + events "^3.3.0" + fast-safe-stringify "^2.1.1" + once "^1.4.0" + pump "^3.0.0" + readable-stream "^3.6.0" + +"@toruslabs/openlogin-utils@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@toruslabs/openlogin-utils/-/openlogin-utils-1.6.0.tgz#dd0b65d47e89d741c58506c1119a0390a3fdf1ba" + integrity sha512-CeIrizKgpoD6p95bOxjm4ZJ/5qNl+3i5dH8pczp6v3k8LHUAm2pDZFGXLPeK1DAdTnRU99/YOnipkjxPR1bvoA== + dependencies: + base64url "^3.0.1" + keccak "^3.0.2" + randombytes "^2.1.0" + +"@toruslabs/solana-embed@^0.1.5": + version "0.1.5" + resolved "https://registry.yarnpkg.com/@toruslabs/solana-embed/-/solana-embed-0.1.5.tgz#3b65090c056e9b6d8552d88bb407f82551a2c5ef" + integrity sha512-EVqOwqGGDwC1xgfgNv51y+xTy7tsSoZ3DXaCC2lFqWGnKWJ6W17dV4uD7/mBjMmHYUKaq3yJ+EDpnSSZ3xy6Dg== + dependencies: + "@solana/web3.js" "^1.34.0" + "@toruslabs/base-controllers" "^1.4.2" + "@toruslabs/http-helpers" "^2.1.4" + "@toruslabs/openlogin-jrpc" "^1.3.3" + eth-rpc-errors "^4.0.3" + fast-deep-equal "^3.1.3" + is-stream "^3.0.0" + lodash-es "^4.17.21" + loglevel "^1.8.0" + pump "^3.0.0" + "@trysound/sax@0.2.0": version "0.2.0" resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" @@ -2078,7 +2438,7 @@ dependencies: "@babel/types" "^7.3.0" -"@types/bn.js@5.1.0", "@types/bn.js@^4.11.5": +"@types/bn.js@5.1.0", "@types/bn.js@^4.11.5", "@types/bn.js@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.0.tgz#32c5d271503a12653c62cf4d2b45e6eab8cebc68" integrity sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA== @@ -2209,6 +2569,13 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== +"@types/pbkdf2@^3.0.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" + integrity sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ== + dependencies: + "@types/node" "*" + "@types/prettier@^2.1.5": version "2.4.4" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.4.tgz#5d9b63132df54d8909fce1c3f8ca260fdd693e17" @@ -2260,6 +2627,13 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== +"@types/secp256k1@^4.0.1": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.3.tgz#1b8e55d8e00f08ee7220b4d59a6abe89c37a901c" + integrity sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w== + dependencies: + "@types/node" "*" + "@types/stack-utils@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" @@ -2589,6 +2963,13 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== +async-mutex@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.3.2.tgz#1485eda5bda1b0ec7c8df1ac2e815757ad1831df" + integrity sha512-HuTK7E7MT7jZEh1P9GtRW9+aTWiDWWi9InbZ5hjxrnRa39KS4BW04+xLBhYNS2aXhHUIKZSw3gj4Pn1pj+qGAA== + dependencies: + tslib "^2.3.1" + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -2611,6 +2992,13 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== +axios@^0.21.0: + version "0.21.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" + integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== + dependencies: + follow-redirects "^1.14.0" + babel-jest@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.5.1.tgz#a1bf8d61928edfefd21da27eb86a695bfd691444" @@ -2729,6 +3117,16 @@ base64-js@^1.3.1, base64-js@^1.5.1: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== +base64url@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/base64url/-/base64url-3.0.1.tgz#6399d572e2bc3f90a9a8b22d5dbb0a32d33f788d" + integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== + +big-integer@^1.6.16: + version "1.6.51" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" + integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== + big.js@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/big.js/-/big.js-6.1.1.tgz#63b35b19dc9775c94991ee5db7694880655d5537" @@ -2753,16 +3151,16 @@ bl@^4.0.3: inherits "^2.0.4" readable-stream "^3.4.0" -bn.js@5.1.3, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@~5.2.0: +blakejs@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.1.tgz#bf313053978b2cd4c444a48795710be05c785702" + integrity sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg== + +bn.js@5.1.3, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@~5.2.0: version "5.1.3" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b" integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ== -bn.js@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" - integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== - boolbase@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" @@ -2778,6 +3176,11 @@ borsh@^0.4.0: bs58 "^4.0.0" text-encoding-utf-8 "^1.0.2" +bowser@^2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f" + integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -2793,6 +3196,20 @@ braces@^3.0.1, braces@~3.0.2: dependencies: fill-range "^7.0.1" +broadcast-channel@^4.10.0: + version "4.10.0" + resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.10.0.tgz#d19fb902df227df40b1b580351713d30c302d198" + integrity sha512-hOUh312XyHk6JTVyX9cyXaH1UYs+2gHVtnW16oQAu9FL7ALcXGXc/YoJWqlkV8vUn14URQPMmRi4A9q4UrwVEQ== + dependencies: + "@babel/runtime" "^7.16.0" + detect-node "^2.1.0" + microseconds "0.2.0" + nano-time "1.0.0" + oblivious-set "1.0.0" + p-queue "6.6.2" + rimraf "3.0.2" + unload "2.3.1" + brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" @@ -2803,6 +3220,18 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== +browserify-aes@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + dependencies: + buffer-xor "^1.0.3" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.3" + inherits "^2.0.1" + safe-buffer "^5.0.1" + browserslist@^4.17.5, browserslist@^4.19.1: version "4.19.1" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.19.1.tgz#4ac0435b35ab655896c31d53018b6dd5e9e4c9a3" @@ -2821,6 +3250,15 @@ bs58@^4.0.0, bs58@^4.0.1: dependencies: base-x "^3.0.2" +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + bser@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" @@ -2843,6 +3281,11 @@ buffer-layout@^1.2.0, buffer-layout@^1.2.1, buffer-layout@^1.2.2: resolved "https://registry.yarnpkg.com/buffer-layout/-/buffer-layout-1.2.2.tgz#b9814e7c7235783085f9ca4966a0cfff112259d5" integrity sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA== +buffer-xor@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + buffer@6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.1.tgz#3cbea8c1463e5a0779e30b66d4c88c6ffa182ac2" @@ -2971,6 +3414,14 @@ ci-info@^3.2.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.0.tgz#b4ed1fb6818dea4803a55c623041f9165d2066b2" integrity sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw== +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + circular-json@^0.5.9: version "0.5.9" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.5.9.tgz#932763ae88f4f7dead7a0d09c8a51a4743a53b1d" @@ -3201,6 +3652,29 @@ cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: path-type "^4.0.0" yaml "^1.10.0" +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.4, create-hmac@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + cross-fetch@3.0.6: version "3.0.6" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.6.tgz#3a4040bc8941e653e0e9cf17f29ebcd177d3365c" @@ -3495,6 +3969,11 @@ detect-newline@^3.0.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== +detect-node@2.1.0, detect-node@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" + integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== + detective@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.0.tgz#feb2a77e85b904ecdea459ad897cc90a99bd2a7b" @@ -3617,6 +4096,13 @@ dset@^2.0.1: resolved "https://registry.yarnpkg.com/dset/-/dset-2.1.0.tgz#cd1e99e55cf32366d8f144f906c42f7fb3bf431e" integrity sha512-hlQYwNEdW7Qf8zxysy+yN1E8C/SxRst3Z9n+IvXOR35D9bPVwNHhnL8ZBeoZjvinuGrlvGg6pAMDwhmjqFDgjA== +eip1193-provider@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/eip1193-provider/-/eip1193-provider-1.0.1.tgz#420d29cf4f6c443e3f32e718fb16fafb250637c3" + integrity sha512-kSuqwQ26d7CzuS/t3yRXo2Su2cVH0QfvyKbr2H7Be7O5YDyIq4hQGCNTo5wRdP07bt+E2R/8nPCzey4ojBHf7g== + dependencies: + "@json-rpc-tools/provider" "^1.5.5" + electron-to-chromium@^1.4.17: version "1.4.68" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.68.tgz#d79447b6bd1bec9183f166bb33d4bef0d5e4e568" @@ -3645,7 +4131,7 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -end-of-stream@^1.1.0, end-of-stream@^1.4.1: +end-of-stream@^1.1.0, end-of-stream@^1.4.1, end-of-stream@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== @@ -3921,11 +4407,63 @@ etag@^1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -eventemitter3@^4.0.1, eventemitter3@^4.0.4, eventemitter3@^4.0.7: +eth-rpc-errors@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" + integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== + dependencies: + fast-safe-stringify "^2.0.6" + +ethereum-cryptography@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" + integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== + dependencies: + "@types/pbkdf2" "^3.0.0" + "@types/secp256k1" "^4.0.1" + blakejs "^1.1.0" + browserify-aes "^1.2.0" + bs58check "^2.1.2" + create-hash "^1.2.0" + create-hmac "^1.1.7" + hash.js "^1.1.7" + keccak "^3.0.0" + pbkdf2 "^3.0.17" + randombytes "^2.1.0" + safe-buffer "^5.1.2" + scrypt-js "^3.0.0" + secp256k1 "^4.0.1" + setimmediate "^1.0.5" + +ethereumjs-util@^7.1.4: + version "7.1.4" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz#a6885bcdd92045b06f596c7626c3e89ab3312458" + integrity sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A== + dependencies: + "@types/bn.js" "^5.1.0" + bn.js "^5.1.2" + create-hash "^1.1.2" + ethereum-cryptography "^0.1.3" + rlp "^2.2.4" + +eventemitter3@^4.0.0, eventemitter3@^4.0.1, eventemitter3@^4.0.4, eventemitter3@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== +events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + +evp_bytestokey@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== + dependencies: + md5.js "^1.3.4" + safe-buffer "^5.1.1" + execa@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" @@ -4017,6 +4555,11 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-safe-stringify@^2.0.6, fast-safe-stringify@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" + integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== + fastq@^1.6.0: version "1.13.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" @@ -4081,6 +4624,11 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== +follow-redirects@^1.14.0: + version "1.14.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" + integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== + foreach@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" @@ -4335,7 +4883,16 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== @@ -4520,7 +5077,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -4783,6 +5340,11 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== +is-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" + integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== + is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" @@ -5433,6 +5995,11 @@ json-parse-even-better-errors@^2.3.0: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== +json-rpc-random-id@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-rpc-random-id/-/json-rpc-random-id-1.0.1.tgz#ba49d96aded1444dbb8da3d203748acbbcdec8c8" + integrity sha1-uknZat7RRE27jaPSA3SKy7zeyMg= + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -5482,11 +6049,25 @@ jsonparse@^1.2.0: array-includes "^3.1.3" object.assign "^4.1.2" +keccak@^3.0.0, keccak@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" + integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + keycode@^2.1.7: version "2.2.1" resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.2.1.tgz#09c23b2be0611d26117ea2501c2c391a01f39eff" integrity sha512-Rdgz9Hl9Iv4QKi8b0OlCRQEzp4AgVxyCtz5S/+VIHezDmrDhkp2N2TqBWOLz0/gbeREXOOiI9/4b8BY9uw2vFg== +keyvaluestorage-interface@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz#13ebdf71f5284ad54be94bd1ad9ed79adad515ff" + integrity sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g== + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -5578,6 +6159,11 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +lodash-es@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -5656,6 +6242,11 @@ log-update@^4.0.0: slice-ansi "^4.0.0" wrap-ansi "^6.2.0" +loglevel@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.8.0.tgz#e7ec73a57e1e7b419cb6c6ac06bf050b67356114" + integrity sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA== + loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -5696,6 +6287,15 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + mdn-data@2.0.14: version "2.0.14" resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" @@ -5729,6 +6329,11 @@ micromatch@^4.0.2, micromatch@^4.0.4: braces "^3.0.1" picomatch "^2.2.3" +microseconds@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/microseconds/-/microseconds-0.2.0.tgz#233b25f50c62a65d861f978a4a4f8ec18797dc39" + integrity sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA== + mime-db@1.51.0: version "1.51.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" @@ -5811,6 +6416,13 @@ murmurhash@^2.0.0: resolved "https://registry.yarnpkg.com/murmurhash/-/murmurhash-2.0.0.tgz#556779daf7c39a0d2a3f5a9d080d84bf4833f9ee" integrity sha512-Uo7ZHw+PLe2Q8/qbPIVYxAaoi+TYGZwu1a8ryeeASRXJLRSaLCblAGfjh02eu4+/9aUJBpkHXZv42AXmzOW2kw== +nano-time@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/nano-time/-/nano-time-1.0.0.tgz#b0554f69ad89e22d0907f7a12b0993a5d96137ef" + integrity sha1-sFVPaa2J4i0JB/ehKwmTpdlhN+8= + dependencies: + big-integer "^1.6.16" + nanoid@^3.1.30, nanoid@^3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.1.tgz#6347a18cac88af88f58af0b3594b723d5e99bb35" @@ -6095,6 +6707,11 @@ object.values@^1.1.5: define-properties "^1.1.3" es-abstract "^1.19.1" +oblivious-set@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/oblivious-set/-/oblivious-set-1.0.0.tgz#c8316f2c2fb6ff7b11b6158db3234c49f733c566" + integrity sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw== + ohmyfetch@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/ohmyfetch/-/ohmyfetch-0.3.2.tgz#841293cb11256779a78fc9a91a7f3f4ae3671970" @@ -6166,6 +6783,11 @@ outdent@^0.8.0: resolved "https://registry.yarnpkg.com/outdent/-/outdent-0.8.0.tgz#2ebc3e77bf49912543f1008100ff8e7f44428eb0" integrity sha512-KiOAIsdpUTcAXuykya5fnVVT+/5uS0Q1mrkRHcF89tpieSmY33O/tmc54CqwA+bfhbtEfZUNLHaPUiB9X3jt1A== +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -6199,6 +6821,21 @@ p-map@^4.0.0: dependencies: aggregate-error "^3.0.0" +p-queue@6.6.2: + version "6.6.2" + resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-6.6.2.tgz#2068a9dcf8e67dd0ec3e7a2bcb76810faa85e426" + integrity sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ== + dependencies: + eventemitter3 "^4.0.4" + p-timeout "^3.2.0" + +p-timeout@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-3.2.0.tgz#c7e17abc971d2a7962ef83626b35d635acf23dfe" + integrity sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg== + dependencies: + p-finally "^1.0.0" + p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" @@ -6261,6 +6898,17 @@ pathe@^0.2.0: resolved "https://registry.yarnpkg.com/pathe/-/pathe-0.2.0.tgz#30fd7bbe0a0d91f0e60bae621f5d19e9e225c339" integrity sha512-sTitTPYnn23esFR3RlqYBWn4c45WGeLcsKzQiUpXJAyfcWkolvlYpV8FLo7JishK946oQwMFUCHXQ9AjGPKExw== +pbkdf2@^3.0.17: + version "3.1.2" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" + integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -6443,6 +7091,11 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= + progress@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" @@ -6518,6 +7171,13 @@ raf@^3.4.0: dependencies: performance-now "^2.1.0" +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + rc-align@^4.0.0: version "4.0.11" resolved "https://registry.yarnpkg.com/rc-align/-/rc-align-4.0.11.tgz#8198c62db266bc1b8ef05e56c13275bf72628a5e" @@ -6767,7 +7427,7 @@ readable-stream@^2.0.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.1.1, readable-stream@^3.4.0: +readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -6993,13 +7653,28 @@ rgba-regex@^1.0.0: resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= -rimraf@^3.0.0, rimraf@^3.0.2: +rimraf@3.0.2, rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rlp@^2.2.4: + version "2.2.7" + resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" + integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== + dependencies: + bn.js "^5.2.0" + rpc-websockets@^7.4.2: version "7.4.17" resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.4.17.tgz#f38845dd96db0442bff9e15fba9df781beb44cc0" @@ -7021,6 +7696,13 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +rxjs@6: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + rxjs@^7.5.1: version "7.5.4" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.4.tgz#3d6bd407e6b7ce9a123e76b1e770dc5761aa368d" @@ -7028,7 +7710,7 @@ rxjs@^7.5.1: dependencies: tslib "^2.1.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -7038,6 +7720,11 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-json-utils@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/safe-json-utils/-/safe-json-utils-1.1.1.tgz#0e883874467d95ab914c3f511096b89bfb3e63b1" + integrity sha512-SAJWGKDs50tAbiDXLf89PDwt9XYkWyANFWVzn4dTXl5QyI8t2o/bW5/OJl3lvc2WVU4MEpTo9Yz5NVFNsp+OJQ== + "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -7058,7 +7745,12 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" -secp256k1@^4.0.2: +scrypt-js@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +secp256k1@^4.0.1, secp256k1@^4.0.2: version "4.0.3" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== @@ -7101,6 +7793,19 @@ set-blocking@~2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= + +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + shallow-equal@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/shallow-equal/-/shallow-equal-1.2.1.tgz#4c16abfa56043aa20d050324efa68940b0da79da" @@ -7258,6 +7963,14 @@ standard-as-callback@^2.1.0: resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== +stream-browserify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" + integrity sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA== + dependencies: + inherits "~2.0.4" + readable-stream "^3.5.0" + string-argv@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" @@ -7667,7 +8380,7 @@ traverse-chain@~0.1.0: resolved "https://registry.yarnpkg.com/traverse-chain/-/traverse-chain-0.1.0.tgz#61dbc2d53b69ff6091a12a168fd7d433107e40f1" integrity sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE= -tslib@^1.8.1: +tslib@^1.8.1, tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -7816,6 +8529,14 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== +unload@2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/unload/-/unload-2.3.1.tgz#9d16862d372a5ce5cb630ad1309c2fd6e35dacfe" + integrity sha512-MUZEiDqvAN9AIDRbbBnVYVvfcR6DrjCqeU2YQMmliFZl9uaBUjTkhuDQkBiyAy8ad5bx1TXVbqZ3gg7namsWjA== + dependencies: + "@babel/runtime" "^7.6.2" + detect-node "2.1.0" + unstorage@^0.2.8: version "0.2.9" resolved "https://registry.yarnpkg.com/unstorage/-/unstorage-0.2.9.tgz#6b8dc167d8baf6f6073caf8f7a6b1dcc10db7896" @@ -8046,7 +8767,7 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" -ws@^7.4.5, ws@^7.4.6: +ws@^7.4.0, ws@^7.4.5, ws@^7.4.6: version "7.5.7" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.7.tgz#9e0ac77ee50af70d58326ecff7e85eb3fa375e67" integrity sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A== From 4fc35db429388c4e4642340a748f8eab1d0b8cd2 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 14:40:54 +0100 Subject: [PATCH 03/27] Adds component index file --- components/index.tsx | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 components/index.tsx diff --git a/components/index.tsx b/components/index.tsx new file mode 100644 index 00000000..562fe903 --- /dev/null +++ b/components/index.tsx @@ -0,0 +1,85 @@ +export * from './AccountInfo' +export * from './AccountNameModal' +export * from './AccountSelect' +export * from './AccountsModal' +export * from './AlphaModal' +export * from './BalancesTable' +export * from './Button' +export * from './ButtonGroup' +export * from './Chart' +export * from './Checkbox' +export * from './CloseAccountModal' +export * from './ConnectWalletButton' +export * from './CreateAlertModal' +export * from './DayHighLow' +export * from './DelegateModal' +export * from './DepositModal' +export * from './DepositMsrmModal' +export * from './DropMenu' +export * from './EmptyState' +export * from './ErrorBoundary' +export * from './FavoritesShortcutBar' +export * from './FeeDiscountsTable' +export * from './FlipCard' +export * from './FloatingElement' +export * from './GlobalNotification' +export * from './icons' +export * from './ImageWithFallback' +export * from './InlineNotification' +export * from './Input' +export * from './IntroTips' +export * from './JupiterForm' +export * from './LanguageSwitch' +export * from './LeverageSlider' +export * from './Loading' +export * from './MangoAccountSelect' +export * from './MangoIcon' +export * from './ManualRefresh' +export * from './MarketBalances' +export * from './MarketCloseModal' +export * from './MarketDetails' +export * from './MarketFee' +export * from './MarketMenuItem' +export * from './MarketNavItem' +export * from './MarketSelect' +export * from './MarketsModal' +export * from './MenuItem' +export * from './Modal' +export * from './NavDropMenu' +export * from './NewAccount' +export * from './Notification' +export * from './OpenOrdersTable' +export * from './Orderbook' +export * from './PageBodyContainer' +export * from './Pagination' +export * from './PerpPositionsTable' +export * from './PerpSideBadge' +export * from './PnlText' +export * from './RecentMarketTrades' +export * from './ResetLayout' +export * from './Select' +export * from './Settings' +export * from './SettingsModal' +export * from './SideBadge' +export * from './Slider' +export * from './styles' +export * from './SwapSettingsModal' +export * from './SwapTokenInfo' +export * from './SwapTokenInsights' +export * from './SwapTokenSelect' +export * from './Switch' +export * from './SwitchMarketDropdown' +export * from './TableElements' +export * from './Tabs' +export * from './ThemeSwitch' +export * from './Tooltip' +export * from './TopBar' +export * from './TradeHistoryTable' +export * from './TradeNavMenu' +export * from './TradePageGrid' +export * from './UiLock' +export * from './UserInfo' +export * from './UserMarketInfo' +export * from './WalletProvider' +export * from './WithdrawModal' +export * from './WithdrawMsrmModal' From d46376649c7ecf222f7daace8d8a47fbd4ae2685 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 14:52:28 +0100 Subject: [PATCH 04/27] Updates WalletAdapter type --- @types/types.tsx | 2 - components/WalletSelect.tsx | 60 ---------- hooks/useWallet.tsx | 103 ----------------- utils/wallet-adapters/bitpie.ts | 116 ------------------- utils/wallet-adapters/glow.ts | 101 ----------------- utils/wallet-adapters/huobi.ts | 94 --------------- utils/wallet-adapters/index.ts | 61 ---------- utils/wallet-adapters/phantom.ts | 104 ----------------- utils/wallet-adapters/slope.ts | 132 ---------------------- utils/wallet-adapters/solflare.ts | 5 - utils/wallet-adapters/sollet-extension.ts | 21 ---- 11 files changed, 799 deletions(-) delete mode 100644 components/WalletSelect.tsx delete mode 100644 hooks/useWallet.tsx delete mode 100644 utils/wallet-adapters/bitpie.ts delete mode 100644 utils/wallet-adapters/glow.ts delete mode 100644 utils/wallet-adapters/huobi.ts delete mode 100644 utils/wallet-adapters/index.ts delete mode 100644 utils/wallet-adapters/phantom.ts delete mode 100644 utils/wallet-adapters/slope.ts delete mode 100644 utils/wallet-adapters/solflare.ts delete mode 100644 utils/wallet-adapters/sollet-extension.ts diff --git a/@types/types.tsx b/@types/types.tsx index 28bb7130..7f85720c 100644 --- a/@types/types.tsx +++ b/@types/types.tsx @@ -124,13 +124,11 @@ export const DEFAULT_PUBLIC_KEY = new PublicKey( export interface WalletAdapter { publicKey: PublicKey - autoApprove: boolean connected: boolean signTransaction: (transaction: Transaction) => Promise signAllTransactions: (transaction: Transaction[]) => Promise connect: () => any disconnect: () => any - on(event: string, fn: () => void): this } export interface PerpTriggerOrder { diff --git a/components/WalletSelect.tsx b/components/WalletSelect.tsx deleted file mode 100644 index 89a252fc..00000000 --- a/components/WalletSelect.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { Fragment } from 'react' -import { Menu, Transition } from '@headlessui/react' -import { ChevronDownIcon } from '@heroicons/react/solid' -import useMangoStore from '../stores/useMangoStore' -import { WALLET_PROVIDERS } from '../utils/wallet-adapters' - -export default function WalletSelect() { - const setMangoStore = useMangoStore((s) => s.set) - - const handleSelectProvider = (url) => { - setMangoStore((state) => { - state.wallet.providerUrl = url - }) - } - - return ( - - {({ open }) => ( - <> - - - - - - {WALLET_PROVIDERS.map(({ name, url, icon }) => ( - - - - ))} - - - - )} - - ) -} diff --git a/hooks/useWallet.tsx b/hooks/useWallet.tsx deleted file mode 100644 index de671592..00000000 --- a/hooks/useWallet.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { useEffect, useMemo } from 'react' -import Wallet from '@project-serum/sol-wallet-adapter' -import useLocalStorageState from './useLocalStorageState' -import useMangoStore from '../stores/useMangoStore' -import { notify } from '../utils/notifications' -import { WalletAdapter } from '../@types/types' -import { useTranslation } from 'next-i18next' -import { DEFAULT_PROVIDER, WALLET_PROVIDERS } from '../utils/wallet-adapters' - -export const PROVIDER_LOCAL_STORAGE_KEY = 'walletProvider-0.1' - -export default function useWallet() { - const { t } = useTranslation('common') - const setMangoStore = useMangoStore((state) => state.set) - const { - current: wallet, - connected, - providerUrl: selectedProviderUrl, - } = useMangoStore((state) => state.wallet) - const endpoint = useMangoStore((state) => state.connection.endpoint) - const actions = useMangoStore((s) => s.actions) - const [savedProviderUrl, setSavedProviderUrl] = useLocalStorageState( - PROVIDER_LOCAL_STORAGE_KEY, - DEFAULT_PROVIDER.url - ) - const provider = useMemo( - () => WALLET_PROVIDERS.find(({ url }) => url === savedProviderUrl), - [savedProviderUrl] - ) - - useEffect(() => { - if (selectedProviderUrl) { - setSavedProviderUrl(selectedProviderUrl) - } - }, [selectedProviderUrl]) - - useEffect(() => { - if (provider) { - const updateWallet = () => { - // hack to also update wallet synchronously in case it disconnects - // eslint-disable-next-line react-hooks/exhaustive-deps - const wallet = new (provider.adapter || Wallet)( - savedProviderUrl, - endpoint - ) as WalletAdapter - setMangoStore((state) => { - state.wallet.current = wallet - }) - } - - if (document.readyState !== 'complete') { - // wait to ensure that browser extensions are loaded - const listener = () => { - updateWallet() - window.removeEventListener('load', listener) - } - window.addEventListener('load', listener) - return () => window.removeEventListener('load', listener) - } else { - updateWallet() - } - } - }, [provider, savedProviderUrl, endpoint]) - - useEffect(() => { - if (!wallet) return - wallet.on('connect', async () => { - setMangoStore((state) => { - state.wallet.connected = true - }) - // set connected before fetching data - await actions.fetchAllMangoAccounts() - actions.fetchProfilePicture() - actions.reloadOrders() - actions.fetchTradeHistory() - actions.fetchWalletTokens() - - // notify({ - // title: t('wallet-connected'), - // description: - // t('connected-to') + - // wallet.publicKey.toString().substr(0, 5) + - // '...' + - // wallet.publicKey.toString().substr(-5), - // }) - }) - wallet.on('disconnect', () => { - console.log('disconnecting wallet') - setMangoStore((state) => { - state.wallet.connected = false - state.mangoAccounts = [] - state.selectedMangoAccount.current = null - state.tradeHistory = { spot: [], perp: [] } - }) - notify({ - type: 'info', - title: t('wallet-disconnected'), - }) - }) - }, [wallet, setMangoStore]) - - return { connected, wallet } -} diff --git a/utils/wallet-adapters/bitpie.ts b/utils/wallet-adapters/bitpie.ts deleted file mode 100644 index 80a7edef..00000000 --- a/utils/wallet-adapters/bitpie.ts +++ /dev/null @@ -1,116 +0,0 @@ -import EventEmitter from 'eventemitter3' -import { PublicKey, Transaction } from '@solana/web3.js' -import { notify } from '../../utils/notifications' -import { WalletAdapter } from '../../@types/types' - -interface BitpieWallet { - getAccount(): Promise - signTransaction(transaction: Transaction): Promise - signAllTransactions(transactions: Transaction[]): Promise -} - -interface BitpieWalletWindow extends Window { - bitpie?: BitpieWallet -} - -declare const window: BitpieWalletWindow - -export class BitpieWalletAdapter extends EventEmitter implements WalletAdapter { - private _connecting: boolean - private _wallet: BitpieWallet | null - private _publicKey: PublicKey | null - - constructor() { - super() - this._connecting = false - this._wallet = null - this._publicKey = null - } - - get publicKey(): PublicKey | null { - return this._publicKey - } - - get ready(): boolean { - return typeof window !== 'undefined' && !!window.bitpie - } - - get connecting(): boolean { - return this._connecting - } - - get connected(): boolean { - return !!this._wallet - } - - get autoApprove() { - return true - } - - async connect(): Promise { - try { - if (this.connected || this.connecting) return - this._connecting = true - - const wallet = typeof window !== 'undefined' && window.bitpie - if (!wallet) return - - let account: string - try { - account = await wallet.getAccount() - } catch (error: any) { - notify({ - title: 'Connection Error', - type: 'error', - description: - 'Please install Bitpie wallet and then reload this page.', - }) - } - - this._wallet = wallet - this._publicKey = new PublicKey(account) - - this.emit('connect') - } catch (error: any) { - this.emit('error', error) - throw error - } finally { - this._connecting = false - } - } - - async disconnect(): Promise { - if (this._wallet) { - this._wallet = null - this._publicKey = null - } - - this.emit('disconnect') - } - - async signTransaction(transaction: Transaction): Promise { - try { - const wallet = this._wallet - if (!wallet) return - - return (await wallet.signTransaction(transaction)) || transaction - } catch (error: any) { - this.emit('error', error) - throw error - } - } - - async signAllTransactions( - transactions: Transaction[] - ): Promise { - try { - const wallet = this._wallet - if (!wallet) return - - return (await wallet.signAllTransactions(transactions)) || transactions - } catch (error: any) { - this.emit('error', error) - throw error - } - } -} diff --git a/utils/wallet-adapters/glow.ts b/utils/wallet-adapters/glow.ts deleted file mode 100644 index c68b5d53..00000000 --- a/utils/wallet-adapters/glow.ts +++ /dev/null @@ -1,101 +0,0 @@ -import EventEmitter from 'eventemitter3' -import { PublicKey, Transaction } from '@solana/web3.js' -import { notify } from '../../utils/notifications' -import { DEFAULT_PUBLIC_KEY, WalletAdapter } from '../../@types/types' - -type GlowEvent = 'disconnect' | 'connect' -type GlowRequestMethod = - | 'connect' - | 'disconnect' - | 'signTransaction' - | 'signAllTransactions' - -interface GlowProvider { - publicKey?: PublicKey - isConnected?: boolean - autoApprove?: boolean - signTransaction: (transaction: Transaction) => Promise - signAllTransactions: (transactions: Transaction[]) => Promise - connect: () => Promise - disconnect: () => Promise - on: (event: GlowEvent, handler: (args: any) => void) => void - request: (method: GlowRequestMethod, params: any) => Promise - listeners: (event: GlowEvent) => (() => void)[] -} - -export class GlowWalletAdapter extends EventEmitter implements WalletAdapter { - constructor() { - super() - this.connect = this.connect.bind(this) - } - - private get _provider(): GlowProvider | undefined { - if ((window as any)?.glowSolana?.isGlow) { - return (window as any).glowSolana - } - return undefined - } - - private _handleConnect = (...args) => { - this.emit('connect', ...args) - } - - private _handleDisconnect = (...args) => { - this.emit('disconnect', ...args) - } - - get connected() { - return this._provider?.isConnected || false - } - - get autoApprove() { - return this._provider?.autoApprove || false - } - - async signAllTransactions( - transactions: Transaction[] - ): Promise { - if (!this._provider) { - return transactions - } - - return this._provider.signAllTransactions(transactions) - } - - get publicKey() { - return this._provider?.publicKey || DEFAULT_PUBLIC_KEY - } - - async signTransaction(transaction: Transaction) { - if (!this._provider) { - return transaction - } - - return this._provider.signTransaction(transaction) - } - - connect() { - if (!this._provider) { - window.open('https://glow.app/', '_blank') - notify({ - title: 'Connection Error', - type: 'error', - description: 'Please install Glow wallet and then reload this page.', - }) - return - } - if (!this._provider.listeners('connect').length) { - this._provider?.on('connect', this._handleConnect) - } - if (!this._provider.listeners('disconnect').length) { - this._provider?.on('disconnect', this._handleDisconnect) - } - return this._provider?.connect() - } - - disconnect() { - if (this._provider) { - this._provider.disconnect() - } - } -} diff --git a/utils/wallet-adapters/huobi.ts b/utils/wallet-adapters/huobi.ts deleted file mode 100644 index b762f8bb..00000000 --- a/utils/wallet-adapters/huobi.ts +++ /dev/null @@ -1,94 +0,0 @@ -import EventEmitter from 'eventemitter3' -import { PublicKey, Transaction } from '@solana/web3.js' -import { DEFAULT_PUBLIC_KEY, WalletAdapter } from '../../@types/types' - -type HuobiEvent = 'disconnect' | 'connect' -type HuobiRequestMethod = - | 'connect' - | 'disconnect' - | 'signTransaction' - | 'signAllTransactions' - -interface HuobiProvider { - publicKey?: PublicKey - isConnected?: boolean - autoApprove?: boolean - signTransaction: (transaction: Transaction) => Promise - signAllTransactions: (transactions: Transaction[]) => Promise - connect: () => Promise - disconnect: () => Promise - on: (event: HuobiEvent, handler: (args: any) => void) => void - request: (method: HuobiRequestMethod, params: any) => Promise - listeners: (event: HuobiEvent) => (() => void)[] -} - -export class HuobiWalletAdapter extends EventEmitter implements WalletAdapter { - constructor() { - super() - this.connect = this.connect.bind(this) - } - - private get _provider(): HuobiProvider | undefined { - if ((window as any)?.huobiWallet?.isHuobiWallet) { - return (window as any).huobiWallet - } - return undefined - } - - private _handleConnect = (...args) => { - this.emit('connect', ...args) - } - - private _handleDisconnect = (...args) => { - this.emit('disconnect', ...args) - } - - get connected() { - return this._provider?.isConnected || false - } - - get autoApprove() { - return this._provider?.autoApprove || false - } - - async signAllTransactions( - transactions: Transaction[] - ): Promise { - if (!this._provider) { - return transactions - } - - return this._provider.signAllTransactions(transactions) - } - - get publicKey() { - return this._provider?.publicKey || DEFAULT_PUBLIC_KEY - } - - async signTransaction(transaction: Transaction) { - if (!this._provider) { - return transaction - } - - return this._provider.signTransaction(transaction) - } - - connect() { - if (!this._provider) { - return - } - if (!this._provider.listeners('connect').length) { - this._provider?.on('connect', this._handleConnect) - } - if (!this._provider.listeners('disconnect').length) { - this._provider?.on('disconnect', this._handleDisconnect) - } - return this._provider?.connect() - } - - disconnect() { - if (this._provider) { - this._provider.disconnect() - } - } -} diff --git a/utils/wallet-adapters/index.ts b/utils/wallet-adapters/index.ts deleted file mode 100644 index ea0ccfb1..00000000 --- a/utils/wallet-adapters/index.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { PhantomWalletAdapter } from './phantom' -import { SolflareWalletAdapter } from './solflare' -import { SolletExtensionAdapter } from './sollet-extension' -import { SlopeWalletAdapter } from './slope' -import { BitpieWalletAdapter } from './bitpie' -import { HuobiWalletAdapter } from './huobi' -import { GlowWalletAdapter } from './glow' - -const ASSET_URL = - 'https://cdn.jsdelivr.net/gh/solana-labs/oyster@main/assets/wallets' - -export const WALLET_PROVIDERS = [ - { - name: 'Phantom', - url: 'https://www.phantom.app', - icon: `https://www.phantom.app/img/logo.png`, - adapter: PhantomWalletAdapter, - }, - { - name: 'Solflare', - url: 'https://solflare.com', - icon: `${ASSET_URL}/solflare.svg`, - adapter: SolflareWalletAdapter, - }, - { - name: 'Sollet.io', - url: 'https://www.sollet.io', - icon: `${ASSET_URL}/sollet.svg`, - }, - { - name: 'Sollet Extension', - url: 'https://www.sollet.io/extension', - icon: `${ASSET_URL}/sollet.svg`, - adapter: SolletExtensionAdapter as any, - }, - { - name: 'Slope', - url: 'https://www.slope.finance/#/wallet', - icon: 'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHdpZHRoPSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iNjQiIGN5PSI2NCIgZmlsbD0iIzZlNjZmYSIgcj0iNjQiLz48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJtMzUuMTk2MyA1NC4zOTk4aDE5LjJ2MTkuMmgtMTkuMnoiLz48cGF0aCBkPSJtNzMuNTk3IDU0LjM5OTgtMTkuMiAxOS4ydi0xOS4ybDE5LjItMTkuMnoiIGZpbGwtb3BhY2l0eT0iLjQiLz48cGF0aCBkPSJtNzMuNTk3IDczLjU5OTgtMTkuMiAxOS4ydi0xOS4ybDE5LjItMTkuMnoiIGZpbGwtb3BhY2l0eT0iLjc1Ii8+PHBhdGggZD0ibTczLjYwNCA1NC4zOTk4aDE5LjJ2MTkuMmgtMTkuMnoiLz48cGF0aCBkPSJtNTQuMzk2OCAzNS4yIDE5LjItMTkuMnYxOS4ybC0xOS4yIDE5LjJoLTE5LjJ6IiBmaWxsLW9wYWNpdHk9Ii43NSIvPjxwYXRoIGQ9Im03My41OTE1IDkyLjgtMTkuMiAxOS4ydi0xOS4ybDE5LjItMTkuMmgxOS4yeiIgZmlsbC1vcGFjaXR5PSIuNCIvPjwvZz48L3N2Zz4=', - adapter: SlopeWalletAdapter, - }, - { - name: 'Bitpie', - url: 'https://bitpie.com', - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNjRweCIgaGVpZ2h0PSI2NHB4IiB2aWV3Qm94PSIwIDAgNjQgNjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYzLjEgKDkyNDUyKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5pY29uX2xvZ29AMng8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjUyLjU0NTc1MDElIiB5MT0iMTAwJSIgeDI9IjUyLjU0NTc1MDQlIiB5Mj0iMCUiIGlkPSJsaW5lYXJHcmFkaWVudC0xIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzFFM0RBMCIgb2Zmc2V0PSIwJSI+PC9zdG9wPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjMzc1MERFIiBvZmZzZXQ9IjEwMCUiPjwvc3RvcD4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCB4MT0iNTAlIiB5MT0iMCUiIHgyPSI1MCUiIHkyPSIxMDAlIiBpZD0ibGluZWFyR3JhZGllbnQtMiI+CiAgICAgICAgICAgIDxzdG9wIHN0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HD8hoIyvgwYGZCFM1PATdDuO+EJcH4+6TeXPv4zCrp93QAMFPnZHF7ZHZ/tic3YwDrKCizAEloKxjRVGjjjwDIAF6cGwvGf5VWvX3v/GuOvMk+pSgGELww4vgzQSh9lyB9tCRZA1Q1IAsuD4C9Ui6vrV53/4uLVZa/ftwGqld/o/GlDfro1A47vp8A4vxXIwZGbwMZe46Zqi7i6enfdPXn2fwFV8KRoVHneowAAAABJRU5ErkJggg==`, - adapter: GlowWalletAdapter, - }, -] -export const DEFAULT_PROVIDER = WALLET_PROVIDERS[0] diff --git a/utils/wallet-adapters/phantom.ts b/utils/wallet-adapters/phantom.ts deleted file mode 100644 index 25f056a0..00000000 --- a/utils/wallet-adapters/phantom.ts +++ /dev/null @@ -1,104 +0,0 @@ -import EventEmitter from 'eventemitter3' -import { PublicKey, Transaction } from '@solana/web3.js' -import { notify } from '../../utils/notifications' -import { DEFAULT_PUBLIC_KEY, WalletAdapter } from '../../@types/types' - -type PhantomEvent = 'disconnect' | 'connect' -type PhantomRequestMethod = - | 'connect' - | 'disconnect' - | 'signTransaction' - | 'signAllTransactions' - -interface PhantomProvider { - publicKey?: PublicKey - isConnected?: boolean - autoApprove?: boolean - signTransaction: (transaction: Transaction) => Promise - signAllTransactions: (transactions: Transaction[]) => Promise - connect: () => Promise - disconnect: () => Promise - on: (event: PhantomEvent, handler: (args: any) => void) => void - request: (method: PhantomRequestMethod, params: any) => Promise - listeners: (event: PhantomEvent) => (() => void)[] -} - -export class PhantomWalletAdapter - extends EventEmitter - implements WalletAdapter -{ - constructor() { - super() - this.connect = this.connect.bind(this) - } - - private get _provider(): PhantomProvider | undefined { - if ((window as any)?.solana?.isPhantom) { - return (window as any).solana - } - return undefined - } - - private _handleConnect = (...args) => { - this.emit('connect', ...args) - } - - private _handleDisconnect = (...args) => { - this.emit('disconnect', ...args) - } - - get connected() { - return this._provider?.isConnected || false - } - - get autoApprove() { - return this._provider?.autoApprove || false - } - - async signAllTransactions( - transactions: Transaction[] - ): Promise { - if (!this._provider) { - return transactions - } - - return this._provider.signAllTransactions(transactions) - } - - get publicKey() { - return this._provider?.publicKey || DEFAULT_PUBLIC_KEY - } - - async signTransaction(transaction: Transaction) { - if (!this._provider) { - return transaction - } - - return this._provider.signTransaction(transaction) - } - - connect() { - if (!this._provider) { - window.open('https://phantom.app/', '_blank') - notify({ - title: 'Connection Error', - type: 'error', - description: 'Please install Phantom wallet and then reload this page.', - }) - return - } - if (!this._provider.listeners('connect').length) { - this._provider?.on('connect', this._handleConnect) - } - if (!this._provider.listeners('disconnect').length) { - this._provider?.on('disconnect', this._handleDisconnect) - } - return this._provider?.connect() - } - - disconnect() { - if (this._provider) { - this._provider.disconnect() - } - } -} diff --git a/utils/wallet-adapters/slope.ts b/utils/wallet-adapters/slope.ts deleted file mode 100644 index a8f64ca3..00000000 --- a/utils/wallet-adapters/slope.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { PublicKey, Transaction } from '@solana/web3.js' -import bs58 from 'bs58' -import EventEmitter from 'events' -import { WalletAdapter } from '../../@types/types' -import { notify } from '../notifications' - -interface SlopeWallet { - connect(): Promise<{ - msg: string - data: { - publicKey?: string - } - }> - disconnect(): Promise<{ msg: string }> - signTransaction(message: string): Promise<{ - msg: string - data: { - publicKey?: string - signature?: string - } - }> - signAllTransactions(messages: string[]): Promise<{ - msg: string - data: { - publicKey?: string - signatures?: string[] - } - }> -} - -interface SlopeWindow extends Window { - Slope?: { - new (): SlopeWallet - } -} - -declare const window: SlopeWindow - -export class SlopeWalletAdapter extends EventEmitter implements WalletAdapter { - private _connecting: boolean - private _wallet: SlopeWallet | null - private _publicKey: PublicKey | null - - constructor() { - super() - this._connecting = false - this._wallet = null - this._publicKey = null - } - - get publicKey(): PublicKey | null { - return this._publicKey - } - - get ready(): boolean { - return typeof window !== 'undefined' && !!window.Slope - } - - get connecting(): boolean { - return this._connecting - } - - get connected(): boolean { - return !!this._publicKey - } - - get autoApprove() { - return true - } - - async connect(): Promise { - try { - if (this.connected || this.connecting) return - this._connecting = true - - const wallet = new window.Slope() - const { data } = await wallet.connect() - this._wallet = wallet - this._publicKey = new PublicKey(data.publicKey) - - this.emit('connect') - } catch (error: any) { - notify({ - title: 'Connection Error', - type: 'error', - description: 'Please install Slope wallet and then reload this page.', - }) - } finally { - this._connecting = false - } - } - - async disconnect(): Promise { - const wallet = this._wallet - if (wallet) { - this._wallet = null - this._publicKey = null - await wallet.disconnect() - this.emit('disconnect') - } - } - - async signTransaction(transaction: Transaction): Promise { - const wallet = this._wallet - const message = bs58.encode(transaction.serializeMessage()) - const { data } = await wallet.signTransaction(message) - const publicKey = new PublicKey(data.publicKey) - const signature = bs58.decode(data.signature) - - transaction.addSignature(publicKey, signature) - return transaction - } - - async signAllTransactions( - transactions: Transaction[] - ): Promise { - const wallet = this._wallet - const messages = transactions.map((transaction) => - bs58.encode(transaction.serializeMessage()) - ) - const { data } = await wallet.signAllTransactions(messages) - - const length = transactions.length - const publicKey = new PublicKey(data.publicKey) - - for (let i = 0; i < length; i++) { - transactions[i].addSignature(publicKey, bs58.decode(data.signatures[i])) - } - - return transactions - } -} diff --git a/utils/wallet-adapters/solflare.ts b/utils/wallet-adapters/solflare.ts deleted file mode 100644 index 9fff7786..00000000 --- a/utils/wallet-adapters/solflare.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Solflare from '@solflare-wallet/sdk' - -export function SolflareWalletAdapter(_, network) { - return new Solflare({ network }) -} diff --git a/utils/wallet-adapters/sollet-extension.ts b/utils/wallet-adapters/sollet-extension.ts deleted file mode 100644 index e49752ee..00000000 --- a/utils/wallet-adapters/sollet-extension.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Wallet from '@project-serum/sol-wallet-adapter' -import { notify } from '../../utils/notifications' - -export function SolletExtensionAdapter(_, network) { - const sollet = (window as any).sollet - if (sollet) { - return new Wallet(sollet, network) - } - - return { - on: () => {}, - connect: () => { - notify({ - title: 'Sollet Extension Error', - type: 'error', - description: - 'Please install the Sollet Extension for Chrome and then reload this page.', - }) - }, - } -} From b83655a0158b69c0c2d79c1a3a71f254ca8d4aee Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 14:54:26 +0100 Subject: [PATCH 05/27] Adds WalletProvider --- components/WalletProvider.tsx | 114 ++++++++++++++++++++++++++++++++++ pages/_app.tsx | 38 +++++------- 2 files changed, 131 insertions(+), 21 deletions(-) create mode 100644 components/WalletProvider.tsx diff --git a/components/WalletProvider.tsx b/components/WalletProvider.tsx new file mode 100644 index 00000000..10901d38 --- /dev/null +++ b/components/WalletProvider.tsx @@ -0,0 +1,114 @@ +import React, { useEffect, useMemo } from 'react' +import { + ConnectionProvider, + useWallet, + WalletProvider as SolanaWalletProvider, +} from '@solana/wallet-adapter-react' +import { useTranslation } from 'next-i18next' +import { WalletAdapterNetwork } from '@solana/wallet-adapter-base' +import { getWalletAdapters } from '@solana/wallet-adapter-wallets' +import { clusterApiUrl } from '@solana/web3.js' +import { notify } from 'utils/notifications' + +import useMangoStore from 'stores/useMangoStore' +import { WalletModalProvider } from '@solana/wallet-adapter-react-ui' + +require('@solana/wallet-adapter-react-ui/styles.css') + +const WalletListener: React.FC = () => { + const set = useMangoStore((s) => s.set) + const { t } = useTranslation('common') + + const actions = useMangoStore((s) => s.actions) + + const { + publicKey, + wallet, + signTransaction, + signAllTransactions, + connect, + disconnect, + disconnecting, + connecting, + } = useWallet() + + useEffect(() => { + const onConnect = async () => { + set((state) => { + state.selectedMangoAccount.initialLoad = true + state.wallet.providerUrl = wallet.adapter.url + state.wallet.connected = true + state.wallet.current = { + publicKey, + connected: true, + signTransaction, + signAllTransactions, + connect, + disconnect, + } + }) + + await actions.fetchMangoGroup() + + await actions.fetchAllMangoAccounts() + + actions.fetchProfilePicture() + actions.reloadOrders() + actions.fetchTradeHistory() + actions.fetchWalletTokens() + } + + if (connecting) { + onConnect() + } + }, [ + connecting, + set, + actions, + wallet, + publicKey, + signAllTransactions, + signTransaction, + connect, + disconnect, + ]) + + useEffect(() => { + if (disconnecting) { + set((state) => { + state.wallet.connected = false + state.mangoAccounts = [] + state.selectedMangoAccount.current = null + state.tradeHistory = { spot: [], perp: [] } + }) + notify({ + type: 'info', + title: t('wallet-disconnected'), + }) + } + }, [disconnecting, set, t]) + + return null +} + +export const WalletProvider: React.FC = ({ children }) => { + // The network can be set to 'devnet', 'testnet', or 'mainnet-beta'. + const network = WalletAdapterNetwork.Mainnet + + // You can also provide a custom RPC endpoint. + const endpoint = useMemo(() => clusterApiUrl(network), [network]) + + // @solana/wallet-adapter-wallets includes all the adapters but supports tree shaking and lazy loading -- + // Only the wallets you configure here will be compiled into your application, and only the dependencies + // of wallets that your users connect to will be loaded. + const wallets = getWalletAdapters({ network }) + + return ( + + + + {children} + + + ) +} diff --git a/pages/_app.tsx b/pages/_app.tsx index 6936e68f..e75656e9 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -4,7 +4,6 @@ import '../node_modules/react-grid-layout/css/styles.css' import '../node_modules/react-resizable/css/styles.css' import 'intro.js/introjs.css' import '../styles/index.css' -import useWallet from '../hooks/useWallet' import useHydrateStore from '../hooks/useHydrateStore' import Notifications from '../components/Notification' import useMangoStore from '../stores/useMangoStore' @@ -29,17 +28,13 @@ import { ReferrerIdRecordLayout, ReferrerIdRecord, } from '@blockworks-foundation/mango-client' +import { WalletProvider } from 'components' const MangoStoreUpdater = () => { useHydrateStore() return null } -const WalletStoreUpdater = () => { - useWallet() - return null -} - const OpenOrdersStoreUpdater = () => { useOpenOrders() return null @@ -156,28 +151,29 @@ function App({ Component, pageProps }) { - - -
- - - - -
-
- - - -
+ + +
+ + + + +
+
+ + + +
- -
+ +
+
From 259b0bb1b0eb0e58f0b3c7445f96d4bd6ca1b15f Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 14:56:38 +0100 Subject: [PATCH 06/27] Updates ConnectWalletButton with new wallet adapter --- components/ConnectWalletButton.tsx | 73 +++++++++++------------------- 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/components/ConnectWalletButton.tsx b/components/ConnectWalletButton.tsx index 3b3b0d16..0c44ad38 100644 --- a/components/ConnectWalletButton.tsx +++ b/components/ConnectWalletButton.tsx @@ -1,46 +1,34 @@ -import { Fragment, useCallback, useState } from 'react' -import useMangoStore from '../stores/useMangoStore' +import React, { + Fragment, + MouseEventHandler, + useCallback, + useState, +} from 'react' import { Menu, Transition } from '@headlessui/react' import { CurrencyDollarIcon, DuplicateIcon, LogoutIcon, } from '@heroicons/react/outline' -import { PROVIDER_LOCAL_STORAGE_KEY } from '../hooks/useWallet' -import useLocalStorageState from '../hooks/useLocalStorageState' -import { abbreviateAddress, copyToClipboard } from '../utils' -import WalletSelect from './WalletSelect' -import { WalletIcon, ProfileIcon } from './icons' -import AccountsModal from './AccountsModal' -import { useEffect } from 'react' +import { abbreviateAddress, copyToClipboard } from 'utils' +import AccountsModal from 'components/AccountsModal' +import { useWallet } from '@solana/wallet-adapter-react' +import useMangoStore from 'stores/useMangoStore' +import { ProfileIcon, WalletIcon } from './icons' import { useTranslation } from 'next-i18next' -import { DEFAULT_PROVIDER, WALLET_PROVIDERS } from '../utils/wallet-adapters' +import { useWalletModal } from '@solana/wallet-adapter-react-ui' -const ConnectWalletButton = () => { +export const ConnectWalletButton: React.FC = () => { + const { connected, publicKey, disconnect } = useWallet() const { t } = useTranslation('common') - const wallet = useMangoStore((s) => s.wallet.current) - const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) const pfp = useMangoStore((s) => s.wallet.pfp) - const connected = useMangoStore((s) => s.wallet.connected) - const set = useMangoStore((s) => s.set) const [showAccountsModal, setShowAccountsModal] = useState(false) - const [selectedWallet, setSelectedWallet] = useState(DEFAULT_PROVIDER.url) - const [savedProviderUrl] = useLocalStorageState( - PROVIDER_LOCAL_STORAGE_KEY, - DEFAULT_PROVIDER.url - ) + const { setVisible } = useWalletModal() - // update in useEffect to prevent SRR error from next.js - useEffect(() => { - setSelectedWallet(savedProviderUrl) - }, [savedProviderUrl]) - - const handleWalletConect = () => { - wallet.connect() - set((state) => { - state.selectedMangoAccount.initialLoad = true - }) - } + const handleConnect: MouseEventHandler = + useCallback(() => { + setVisible(true) + }, [setVisible]) const handleCloseAccounts = useCallback(() => { setShowAccountsModal(false) @@ -48,7 +36,7 @@ const ConnectWalletButton = () => { return ( <> - {connected && wallet?.publicKey ? ( + {connected && publicKey ? ( {({ open }) => (
@@ -83,7 +71,7 @@ const ConnectWalletButton = () => { @@ -114,8 +102,7 @@ const ConnectWalletButton = () => { id="connect-wallet-tip" >
-
- -
)} - {showAccountsModal ? ( + {showAccountsModal && ( - ) : null} + )} ) } - -export default ConnectWalletButton From d2b4a878bbfeee6e525f6d23174c2fa692e38bd7 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 14:59:32 +0100 Subject: [PATCH 07/27] Updates componets with useWalletModal --- components/FloatingElement.tsx | 28 ++------------ components/TopBar.tsx | 19 +-------- pages/account.tsx | 70 +++++++++++++++------------------- pages/referral.tsx | 6 ++- 4 files changed, 41 insertions(+), 82 deletions(-) diff --git a/components/FloatingElement.tsx b/components/FloatingElement.tsx index 7582d18d..41eb6305 100644 --- a/components/FloatingElement.tsx +++ b/components/FloatingElement.tsx @@ -1,31 +1,10 @@ import React, { FunctionComponent } from 'react' -// import styled from '@emotion/styled' import { LinkIcon } from '@heroicons/react/outline' import useMangoStore from '../stores/useMangoStore' import { MoveIcon } from './icons' import EmptyState from './EmptyState' import { useTranslation } from 'next-i18next' - -// const StyledDragWrapperContent = styled.div` -// transition: all 0.25s ease-in; -// opacity: 0; -// ` - -// const StyledDragBkg = styled.div` -// transition: all 0.25s ease-in; -// opacity: 0; -// ` - -// const StyledDragWrapper = styled.div` -// :hover { -// ${StyledDragWrapperContent} { -// opacity: 1; -// } -// ${StyledDragBkg} { -// opacity: 0.9; -// } -// } -// ` +import { useWalletModal } from '@solana/wallet-adapter-react-ui' interface FloatingElementProps { className?: string @@ -40,7 +19,8 @@ const FloatingElement: FunctionComponent = ({ const { t } = useTranslation('common') const { uiLocked } = useMangoStore((s) => s.settings) const connected = useMangoStore((s) => s.wallet.connected) - const wallet = useMangoStore((s) => s.wallet.current) + const { setVisible } = useWalletModal() + return (
= ({ } - onClickButton={() => (wallet ? wallet.connect() : null)} + onClickButton={() => setVisible(true)} title={t('connect-wallet')} />
diff --git a/components/TopBar.tsx b/components/TopBar.tsx index 5b248b75..f0094403 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -5,7 +5,7 @@ import useLocalStorageState from '../hooks/useLocalStorageState' import MenuItem from './MenuItem' import ThemeSwitch from './ThemeSwitch' import useMangoStore from '../stores/useMangoStore' -import ConnectWalletButton from './ConnectWalletButton' +import { ConnectWalletButton } from 'components' import NavDropMenu from './NavDropMenu' import AccountsModal from './AccountsModal' import LanguageSwitch from './LanguageSwitch' @@ -16,23 +16,6 @@ import TradeNavMenu from './TradeNavMenu' import { CalculatorIcon, LightBulbIcon } from '@heroicons/react/outline' import { MangoIcon } from './icons' -// const StyledNewLabel = ({ children, ...props }) => ( -//
-// {children} -//
-// ) - -//
-// -// {t('referrals')} -//
-// -// new -// -//
-//
-//
- const TopBar = () => { const { t } = useTranslation('common') const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) diff --git a/pages/account.tsx b/pages/account.tsx index 4c15003d..15f43ed5 100644 --- a/pages/account.tsx +++ b/pages/account.tsx @@ -19,43 +19,41 @@ import { } from '@heroicons/react/outline' import { ChevronDownIcon } from '@heroicons/react/solid' import { nativeToUi, ZERO_BN } from '@blockworks-foundation/mango-client' -import useMangoStore, { - serumProgramId, - MNGO_INDEX, -} from '../stores/useMangoStore' -import PageBodyContainer from '../components/PageBodyContainer' -import TopBar from '../components/TopBar' -import AccountOrders from '../components/account_page/AccountOrders' -import AccountHistory from '../components/account_page/AccountHistory' -import AccountsModal from '../components/AccountsModal' -import AccountOverview from '../components/account_page/AccountOverview' -import AccountInterest from '../components/account_page/AccountInterest' -import AccountFunding from '../components/account_page/AccountFunding' -import AccountNameModal from '../components/AccountNameModal' -import { IconButton, LinkButton } from '../components/Button' -import EmptyState from '../components/EmptyState' -import Loading from '../components/Loading' -import Swipeable from '../components/mobile/Swipeable' -import Tabs from '../components/Tabs' -import { useViewport } from '../hooks/useViewport' -import { breakpoints } from '../components/TradePageGrid' +import useMangoStore, { serumProgramId, MNGO_INDEX } from 'stores/useMangoStore' +import PageBodyContainer from 'components/PageBodyContainer' +import TopBar from 'components/TopBar' +import AccountOrders from 'components/account_page/AccountOrders' +import AccountHistory from 'components/account_page/AccountHistory' +import AccountsModal from 'components/AccountsModal' +import AccountOverview from 'components/account_page/AccountOverview' +import AccountInterest from 'components/account_page/AccountInterest' +import AccountFunding from 'components/account_page/AccountFunding' +import AccountNameModal from 'components/AccountNameModal' +import { IconButton, LinkButton } from 'components/Button' +import EmptyState from 'components/EmptyState' +import Loading from 'components/Loading' +import Swipeable from 'components/mobile/Swipeable' +import Tabs from 'components/Tabs' +import { useViewport } from 'hooks/useViewport' +import { breakpoints } from 'components/TradePageGrid' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { useTranslation } from 'next-i18next' -import Select from '../components/Select' +import Select from 'components/Select' import { useRouter } from 'next/router' import { PublicKey } from '@solana/web3.js' -import CloseAccountModal from '../components/CloseAccountModal' -import { notify } from '../utils/notifications' +import CloseAccountModal from 'components/CloseAccountModal' +import { notify } from 'utils/notifications' import { actionsSelector, mangoAccountSelector, mangoGroupSelector, - walletConnectedSelector, -} from '../stores/selectors' -import CreateAlertModal from '../components/CreateAlertModal' -import { copyToClipboard } from '../utils' -import DelegateModal from '../components/DelegateModal' +} from 'stores/selectors' +import CreateAlertModal from 'components/CreateAlertModal' +import { copyToClipboard } from 'utils' +import DelegateModal from 'components/DelegateModal' import { Menu, Transition } from '@headlessui/react' +import { useWalletModal } from '@solana/wallet-adapter-react-ui' +import { useWallet } from '@solana/wallet-adapter-react' export async function getStaticProps({ locale }) { return { @@ -77,16 +75,15 @@ export default function Account() { const { t } = useTranslation(['common', 'close-account', 'delegate']) const { width } = useViewport() const router = useRouter() - - const connected = useMangoStore(walletConnectedSelector) + const { connected } = useWallet() + const isLoading = useMangoStore((s) => s.selectedMangoAccount.initialLoad) const mangoAccount = useMangoStore(mangoAccountSelector) const mangoClient = useMangoStore((s) => s.connection.client) const mangoGroup = useMangoStore(mangoGroupSelector) const wallet = useMangoStore((s) => s.wallet.current) - const isLoading = useMangoStore((s) => s.selectedMangoAccount.initialLoad) const actions = useMangoStore(actionsSelector) const setMangoStore = useMangoStore((s) => s.set) - + const { setVisible } = useWalletModal() const [showAccountsModal, setShowAccountsModal] = useState(false) const [showNameModal, setShowNameModal] = useState(false) const [showCloseAccountModal, setShowCloseAccountModal] = useState(false) @@ -153,12 +150,6 @@ export default function Account() { } }, [pubkey, mangoGroup]) - useEffect(() => { - if (connected) { - router.push('/account') - } - }, [connected]) - useEffect(() => { const handleRouteChange = () => { if (resetOnLeave) { @@ -444,6 +435,7 @@ export default function Account() { icon={} onClickButton={() => setShowAccountsModal(true)} title={t('no-account-found')} + disabled={!wallet || !mangoGroup} /> ) ) : ( @@ -451,7 +443,7 @@ export default function Account() { buttonText={t('connect')} desc={t('connect-view')} icon={} - onClickButton={() => wallet.connect()} + onClickButton={() => setVisible(true)} title={t('connect-wallet')} /> )} diff --git a/pages/referral.tsx b/pages/referral.tsx index fc50dc25..852b3e52 100644 --- a/pages/referral.tsx +++ b/pages/referral.tsx @@ -18,6 +18,7 @@ import { ReferrerIdRecord, } from '@blockworks-foundation/mango-client' import { useTranslation } from 'next-i18next' +import { useWalletModal } from '@solana/wallet-adapter-react-ui' import EmptyState from '../components/EmptyState' import { CheckIcon, @@ -100,6 +101,8 @@ export default function Referral() { >([]) const [hasCopied, setHasCopied] = useState(null) const [showAccountsModal, setShowAccountsModal] = useState(false) + const { setVisible } = useWalletModal() + // const [hasReferrals] = useState(false) // Placeholder to show/hide users referral stats const [loading, setLoading] = useState(false) const [inputError, setInputError] = useState('') @@ -517,6 +520,7 @@ export default function Referral() { icon={} onClickButton={() => setShowAccountsModal(true)} title={t('no-account-found')} + disabled={!wallet || !mangoGroup} /> @@ -530,7 +534,7 @@ export default function Referral() { } - onClickButton={() => wallet.connect()} + onClickButton={() => setVisible(true)} title={t('connect-wallet')} /> From 95e94f5cb09e0e41a4af7b215f5bfe828c9499f3 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 15:00:14 +0100 Subject: [PATCH 08/27] Refactor EmptyState component --- components/EmptyState.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/components/EmptyState.tsx b/components/EmptyState.tsx index 1aded15a..878a49ee 100644 --- a/components/EmptyState.tsx +++ b/components/EmptyState.tsx @@ -1,5 +1,4 @@ import { FunctionComponent, ReactNode } from 'react' -import useMangoStore from '../stores/useMangoStore' import Button from './Button' interface EmptyStateProps { @@ -8,6 +7,7 @@ interface EmptyStateProps { onClickButton?: () => void desc?: string title: string + disabled?: boolean } const EmptyState: FunctionComponent = ({ @@ -16,10 +16,8 @@ const EmptyState: FunctionComponent = ({ onClickButton, desc, title, + disabled = false, }) => { - const wallet = useMangoStore((s) => s.wallet.current) - const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) - return (
{icon}
@@ -34,11 +32,7 @@ const EmptyState: FunctionComponent = ({

) : null} {buttonText && onClickButton ? ( - ) : null} From f9f0d87a5b728ba25818c08c81b52e1b2158bb9e Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 15:00:59 +0100 Subject: [PATCH 09/27] Adds note to mangoStore --- stores/useMangoStore.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stores/useMangoStore.tsx b/stores/useMangoStore.tsx index 40c5a165..eb7ad6f8 100644 --- a/stores/useMangoStore.tsx +++ b/stores/useMangoStore.tsx @@ -55,7 +55,7 @@ export const ENDPOINTS: EndpointInfo[] = [ ] type ClusterType = 'mainnet' | 'devnet' -const DEFAULT_MANGO_GROUP_NAME = process.env.NEXT_PUBLIC_GROUP || 'mainnet.1' +const DEFAULT_MANGO_GROUP_NAME = process.env.NEXT_PUBLIC_GROUP || 'devnet.2' export const CLUSTER = DEFAULT_MANGO_GROUP_NAME.split('.')[0] as ClusterType const ENDPOINT = ENDPOINTS.find((e) => e.name === CLUSTER) @@ -299,6 +299,7 @@ const useMangoStore = create((set, get) => { triggerPrice: '', triggerCondition: 'above', }, + // TODO: Deprecate wallet once useWallet hook is fully implemented wallet: INITIAL_STATE.WALLET, settings: { uiLocked: true, @@ -385,19 +386,19 @@ const useMangoStore = create((set, get) => { const wallet = get().wallet.current const actions = get().actions + if (!wallet?.publicKey || !mangoGroup) return + const delegateFilter = [ { memcmp: { offset: MangoAccountLayout.offsetOf('delegate'), - bytes: wallet?.publicKey.toBase58(), + bytes: wallet?.publicKey?.toBase58(), }, }, ] const accountSorter = (a, b) => a.publicKey.toBase58() > b.publicKey.toBase58() ? 1 : -1 - if (!wallet?.publicKey || !mangoGroup) return - return Promise.all([ mangoClient.getMangoAccountsForOwner( mangoGroup, From c65ba200cbf4512bb0db8dcb5bdaa8cc8b54d231 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 15:15:40 +0100 Subject: [PATCH 10/27] Updates yarn.lock --- yarn.lock | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index b5760273..c27ac386 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3156,11 +3156,16 @@ blakejs@^1.1.0: resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.1.tgz#bf313053978b2cd4c444a48795710be05c785702" integrity sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg== -bn.js@5.1.3, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@~5.2.0: +bn.js@5.1.3, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@~5.2.0: version "5.1.3" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b" integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ== +bn.js@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" + integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== + boolbase@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" From db5bdd1488a90c3987cb2e246a77f5edff2bdbb0 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 15:25:14 +0100 Subject: [PATCH 11/27] Removes typing on handleConnect --- components/ConnectWalletButton.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/components/ConnectWalletButton.tsx b/components/ConnectWalletButton.tsx index 0c44ad38..f2c241e0 100644 --- a/components/ConnectWalletButton.tsx +++ b/components/ConnectWalletButton.tsx @@ -1,9 +1,4 @@ -import React, { - Fragment, - MouseEventHandler, - useCallback, - useState, -} from 'react' +import React, { Fragment, useCallback, useState } from 'react' import { Menu, Transition } from '@headlessui/react' import { CurrencyDollarIcon, @@ -25,10 +20,9 @@ export const ConnectWalletButton: React.FC = () => { const [showAccountsModal, setShowAccountsModal] = useState(false) const { setVisible } = useWalletModal() - const handleConnect: MouseEventHandler = - useCallback(() => { - setVisible(true) - }, [setVisible]) + const handleConnect = useCallback(() => { + setVisible(true) + }, [setVisible]) const handleCloseAccounts = useCallback(() => { setShowAccountsModal(false) From ceb0e8a2ec4c32f4c046e8d29bb95eae322306c1 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Tue, 15 Mar 2022 16:07:28 +0100 Subject: [PATCH 12/27] Fixes change to group name --- stores/useMangoStore.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stores/useMangoStore.tsx b/stores/useMangoStore.tsx index e5e38993..3ff51d23 100644 --- a/stores/useMangoStore.tsx +++ b/stores/useMangoStore.tsx @@ -56,7 +56,7 @@ export const ENDPOINTS: EndpointInfo[] = [ ] type ClusterType = 'mainnet' | 'devnet' -const DEFAULT_MANGO_GROUP_NAME = process.env.NEXT_PUBLIC_GROUP || 'devnet.2' +const DEFAULT_MANGO_GROUP_NAME = process.env.NEXT_PUBLIC_GROUP || 'mainnet.1' export const CLUSTER = DEFAULT_MANGO_GROUP_NAME.split('.')[0] as ClusterType const ENDPOINT = ENDPOINTS.find((e) => e.name === CLUSTER) From 94677c34762e64f39c7b26fa1ad97addfff0104c Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Wed, 16 Mar 2022 11:25:19 +0100 Subject: [PATCH 13/27] Removes wallet adapter react ui --- package.json | 1 - yarn.lock | 11 +---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/package.json b/package.json index 6eff441b..1600ac96 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "@project-serum/sol-wallet-adapter": "0.2.0", "@solana/wallet-adapter-base": "^0.9.5", "@solana/wallet-adapter-react": "^0.15.4", - "@solana/wallet-adapter-react-ui": "^0.9.6", "@solana/wallet-adapter-wallets": "^0.15.5", "@solana/web3.js": "^1.36.0", "@solflare-wallet/pfp": "^0.0.6", diff --git a/yarn.lock b/yarn.lock index c27ac386..bce0690e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1971,16 +1971,7 @@ "@solana/wallet-adapter-base" "^0.9.3" "@solana/web3.js" "^1.20.0" -"@solana/wallet-adapter-react-ui@^0.9.6": - version "0.9.6" - resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-react-ui/-/wallet-adapter-react-ui-0.9.6.tgz#93420096b57acb7d3881095defdba1487814559b" - integrity sha512-nGI1rRA318yHc19x8tvhsouDss+7olHdxyGpZGtZN6/SUQzoRk94OB/+4XMkPL4Aosv3GIqWHFqqQfhcxCbOTQ== - dependencies: - "@solana/wallet-adapter-base" "^0.9.4" - "@solana/wallet-adapter-react" "^0.15.3" - "@solana/web3.js" "^1.36.0" - -"@solana/wallet-adapter-react@^0.15.3", "@solana/wallet-adapter-react@^0.15.4": +"@solana/wallet-adapter-react@^0.15.4": version "0.15.4" resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-react/-/wallet-adapter-react-0.15.4.tgz#413c3fa6893e9d809e5a6dd4730695fba942967b" integrity sha512-QB8tE1IqYxvHrdDZP3DGICuCq6xydvjUYhW+usIahORmHniFF62Mp/LPfdAGZRDFF7U2/rZPktGFiOxWUJA7Qw== From 1a49be860e104fee45f6c19bbc4f5951f302bfab Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Wed, 16 Mar 2022 13:54:00 +0100 Subject: [PATCH 14/27] Updates connect to use wallet adapter directly --- components/ConnectWalletButton.tsx | 75 ++++++++++++++++++++++++++---- components/FloatingElement.tsx | 8 ++-- components/JupiterForm.tsx | 15 +++--- components/WalletProvider.tsx | 14 +++--- pages/account.tsx | 12 ++--- pages/referral.tsx | 10 ++-- 6 files changed, 94 insertions(+), 40 deletions(-) diff --git a/components/ConnectWalletButton.tsx b/components/ConnectWalletButton.tsx index f2c241e0..115cfa29 100644 --- a/components/ConnectWalletButton.tsx +++ b/components/ConnectWalletButton.tsx @@ -1,33 +1,75 @@ -import React, { Fragment, useCallback, useState } from 'react' +import React, { Fragment, useCallback, useState, useMemo } from 'react' import { Menu, Transition } from '@headlessui/react' +import { useWallet, Wallet } from '@solana/wallet-adapter-react' +import { WalletReadyState } from '@solana/wallet-adapter-base' import { CurrencyDollarIcon, DuplicateIcon, LogoutIcon, } from '@heroicons/react/outline' +import { notify } from 'utils/notifications' import { abbreviateAddress, copyToClipboard } from 'utils' -import AccountsModal from 'components/AccountsModal' -import { useWallet } from '@solana/wallet-adapter-react' import useMangoStore from 'stores/useMangoStore' import { ProfileIcon, WalletIcon } from './icons' import { useTranslation } from 'next-i18next' -import { useWalletModal } from '@solana/wallet-adapter-react-ui' +import { WalletSelect } from 'components/WalletSelect' +import { WalletSuggestionModal } from 'components' +import AccountsModal from './AccountsModal' export const ConnectWalletButton: React.FC = () => { - const { connected, publicKey, disconnect } = useWallet() + const { connected, publicKey, wallet, wallets } = useWallet() const { t } = useTranslation('common') const pfp = useMangoStore((s) => s.wallet.pfp) + const set = useMangoStore((s) => s.set) + const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) const [showAccountsModal, setShowAccountsModal] = useState(false) - const { setVisible } = useWalletModal() + const [showWalletSuggestionModal, setShowWalletSuggestionModal] = + useState(false) + + const [installedWallets] = useMemo(() => { + const installed: Wallet[] = [] + const notDetected: Wallet[] = [] + const loadable: Wallet[] = [] + + for (const wallet of wallets) { + if (wallet.readyState === WalletReadyState.NotDetected) { + notDetected.push(wallet) + } else if (wallet.readyState === WalletReadyState.Loadable) { + loadable.push(wallet) + } else if (wallet.readyState === WalletReadyState.Installed) { + installed.push(wallet) + } + } + + return [installed, [...loadable, ...notDetected]] + }, [wallets]) const handleConnect = useCallback(() => { - setVisible(true) - }, [setVisible]) + if (!installedWallets?.length) { + setShowWalletSuggestionModal(true) + } else { + wallet?.adapter?.connect().catch(() => {}) + } + }, [installedWallets, setShowWalletSuggestionModal, wallet]) const handleCloseAccounts = useCallback(() => { setShowAccountsModal(false) }, []) + const handleDisconnect = useCallback(() => { + wallet?.adapter?.disconnect() + set((state) => { + state.wallet.connected = false + state.mangoAccounts = [] + state.selectedMangoAccount.current = null + state.tradeHistory = { spot: [], perp: [] } + }) + notify({ + type: 'info', + title: t('wallet-disconnected'), + }) + }, [wallet, set, t]) + return ( <> {connected && publicKey ? ( @@ -74,7 +116,7 @@ export const ConnectWalletButton: React.FC = () => {
+
+ +
)} {showAccountsModal && ( @@ -116,6 +167,12 @@ export const ConnectWalletButton: React.FC = () => { isOpen={showAccountsModal} /> )} + {showWalletSuggestionModal && ( + setShowWalletSuggestionModal(false)} + isOpen={showWalletSuggestionModal} + /> + )} ) } diff --git a/components/FloatingElement.tsx b/components/FloatingElement.tsx index 41eb6305..b8bb1940 100644 --- a/components/FloatingElement.tsx +++ b/components/FloatingElement.tsx @@ -4,7 +4,7 @@ import useMangoStore from '../stores/useMangoStore' import { MoveIcon } from './icons' import EmptyState from './EmptyState' import { useTranslation } from 'next-i18next' -import { useWalletModal } from '@solana/wallet-adapter-react-ui' +import { useWallet } from '@solana/wallet-adapter-react' interface FloatingElementProps { className?: string @@ -17,9 +17,10 @@ const FloatingElement: FunctionComponent = ({ showConnect, }) => { const { t } = useTranslation('common') + const { wallet } = useWallet() const { uiLocked } = useMangoStore((s) => s.settings) + const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) const connected = useMangoStore((s) => s.wallet.connected) - const { setVisible } = useWalletModal() return (
= ({
} - onClickButton={() => setVisible(true)} + onClickButton={() => wallet?.adapter?.connect()} title={t('connect-wallet')} />
diff --git a/components/JupiterForm.tsx b/components/JupiterForm.tsx index 9989a232..38091308 100644 --- a/components/JupiterForm.tsx +++ b/components/JupiterForm.tsx @@ -12,7 +12,6 @@ import useMangoStore from '../stores/useMangoStore' import { connectionSelector, walletConnectedSelector, - walletSelector, } from '../stores/selectors' import { sortBy, sum } from 'lodash' import { @@ -46,6 +45,7 @@ import { numberFormatter } from './SwapTokenInfo' import { useTranslation } from 'next-i18next' import Tabs from './Tabs' import SwapTokenInsights from './SwapTokenInsights' +import { useWallet } from '@solana/wallet-adapter-react' const TABS = ['Market Data', 'Performance Insights'] @@ -53,10 +53,9 @@ type UseJupiterProps = Parameters[0] const JupiterForm: FunctionComponent = () => { const { t } = useTranslation(['common', 'swap']) - const wallet = useMangoStore(walletSelector) const connection = useMangoStore(connectionSelector) const connected = useMangoStore(walletConnectedSelector) - + const { wallet, publicKey } = useWallet() const [showSettings, setShowSettings] = useState(false) const [depositAndFee, setDepositAndFee] = useState(null) const [selectedRoute, setSelectedRoute] = useState(null) @@ -93,7 +92,7 @@ const JupiterForm: FunctionComponent = () => { const ownedTokens = [] const ownedTokenAccounts = await getTokenAccountsByOwnerWithWrappedSol( connection, - wallet.publicKey + publicKey ) ownedTokenAccounts.forEach((account) => { @@ -373,11 +372,11 @@ const JupiterForm: FunctionComponent = () => {
- {abbreviateAddress(wallet.publicKey)} + {abbreviateAddress(publicKey)}
@@ -945,8 +944,8 @@ const JupiterForm: FunctionComponent = () => { + + ))} + + + + )} +
+ ) +} From fefabfebf94832a9ac376110f895f1492481e4cf Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Wed, 16 Mar 2022 13:54:57 +0100 Subject: [PATCH 16/27] Adds WalletSuggestionModal --- components/WalletSuggestionModal.tsx | 19 +++++++++++++++++++ components/index.tsx | 1 + 2 files changed, 20 insertions(+) create mode 100644 components/WalletSuggestionModal.tsx diff --git a/components/WalletSuggestionModal.tsx b/components/WalletSuggestionModal.tsx new file mode 100644 index 00000000..c81a11c1 --- /dev/null +++ b/components/WalletSuggestionModal.tsx @@ -0,0 +1,19 @@ +import { useWallet } from '@solana/wallet-adapter-react' +import React from 'react' +import Modal from './Modal' + +interface Props { + onClose: () => void + isOpen: boolean +} + +export const WalletSuggestionModal: React.FC = ({ isOpen, onClose }) => { + const { wallets } = useWallet() + + console.log('wallets', wallets) + return ( + +
+
+ ) +} diff --git a/components/index.tsx b/components/index.tsx index 562fe903..0b99abef 100644 --- a/components/index.tsx +++ b/components/index.tsx @@ -81,5 +81,6 @@ export * from './UiLock' export * from './UserInfo' export * from './UserMarketInfo' export * from './WalletProvider' +export * from './WalletSuggestionModal' export * from './WithdrawModal' export * from './WithdrawMsrmModal' From 63aa1c255600bb51b91c2646471bb3ed449844c9 Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Wed, 16 Mar 2022 15:12:39 +0100 Subject: [PATCH 17/27] Adds catch to connect buttons --- components/FloatingElement.tsx | 2 +- components/JupiterForm.tsx | 2 +- pages/account.tsx | 2 +- pages/referral.tsx | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/FloatingElement.tsx b/components/FloatingElement.tsx index b8bb1940..ba8da98d 100644 --- a/components/FloatingElement.tsx +++ b/components/FloatingElement.tsx @@ -33,7 +33,7 @@ const FloatingElement: FunctionComponent = ({ disabled={!wallet || !mangoGroup} buttonText={t('connect')} icon={} - onClickButton={() => wallet?.adapter?.connect()} + onClickButton={() => wallet?.adapter?.connect().catch(() => {})} title={t('connect-wallet')} /> diff --git a/components/JupiterForm.tsx b/components/JupiterForm.tsx index 38091308..43fa003b 100644 --- a/components/JupiterForm.tsx +++ b/components/JupiterForm.tsx @@ -945,7 +945,7 @@ const JupiterForm: FunctionComponent = () => { disabled={swapDisabled} onClick={async () => { if (!connected && zeroKey !== publicKey) { - wallet?.adapter?.connect() + wallet?.adapter?.connect().catch(() => {}) } else if (!loading && selectedRoute && connected) { setSwapping(true) let txCount = 1 diff --git a/pages/account.tsx b/pages/account.tsx index 81f66aeb..0249aa99 100644 --- a/pages/account.tsx +++ b/pages/account.tsx @@ -444,7 +444,7 @@ export default function Account() { desc={t('connect-view')} disabled={!wallet || !mangoGroup} icon={} - onClickButton={() => wallet?.adapter?.connect()} + onClickButton={() => wallet?.adapter?.connect().catch(() => {})} title={t('connect-wallet')} /> )} diff --git a/pages/referral.tsx b/pages/referral.tsx index 806e1611..f285afbe 100644 --- a/pages/referral.tsx +++ b/pages/referral.tsx @@ -536,7 +536,9 @@ export default function Referral() { buttonText={t('connect')} disabled={!wallet || !mangoGroup} icon={} - onClickButton={() => wallet?.adapter?.connect()} + onClickButton={() => + wallet?.adapter?.connect().catch(() => {}) + } title={t('connect-wallet')} /> From 71ce5a2bde20ebba1db5ca3130df7a44e168d7cd Mon Sep 17 00:00:00 2001 From: Kieran Gillen Date: Wed, 16 Mar 2022 17:00:13 +0100 Subject: [PATCH 18/27] Fixes build --- components/WalletProvider.tsx | 19 ------------------- package.json | 2 +- pages/referral.tsx | 3 ++- yarn.lock | 7 +++---- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/components/WalletProvider.tsx b/components/WalletProvider.tsx index a8a38630..1da52a2b 100644 --- a/components/WalletProvider.tsx +++ b/components/WalletProvider.tsx @@ -4,17 +4,14 @@ import { useWallet, WalletProvider as SolanaWalletProvider, } from '@solana/wallet-adapter-react' -import { useTranslation } from 'next-i18next' import { WalletAdapterNetwork } from '@solana/wallet-adapter-base' import { getWalletAdapters } from '@solana/wallet-adapter-wallets' import { clusterApiUrl } from '@solana/web3.js' -import { notify } from 'utils/notifications' import useMangoStore from 'stores/useMangoStore' const WalletListener: React.FC = () => { const set = useMangoStore((s) => s.set) - const { t } = useTranslation('common') const actions = useMangoStore((s) => s.actions) @@ -25,7 +22,6 @@ const WalletListener: React.FC = () => { signAllTransactions, connect, disconnect, - disconnecting, connected, } = useWallet() @@ -71,21 +67,6 @@ const WalletListener: React.FC = () => { disconnect, ]) - useEffect(() => { - if (disconnecting) { - set((state) => { - state.wallet.connected = false - state.mangoAccounts = [] - state.selectedMangoAccount.current = null - state.tradeHistory = { spot: [], perp: [] } - }) - notify({ - type: 'info', - title: t('wallet-disconnected'), - }) - } - }, [disconnecting, set, t]) - return null } diff --git a/package.json b/package.json index 1600ac96..bfda5f81 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ ] }, "dependencies": { - "@blockworks-foundation/mango-client": "^3.3.20", + "@blockworks-foundation/mango-client": "git+https://github.com/blockworks-foundation/mango-client-v3.git#update-wallet-adapter-type", "@headlessui/react": "^1.2.0", "@heroicons/react": "^1.0.0", "@jup-ag/react-hook": "^1.0.0-beta.16", diff --git a/pages/referral.tsx b/pages/referral.tsx index f285afbe..fc7ac746 100644 --- a/pages/referral.tsx +++ b/pages/referral.tsx @@ -92,6 +92,7 @@ export default function Referral() { const connected = useMangoStore((s) => s.wallet.connected) const { wallet } = useWallet() + const mangoStoreWallet = useMangoStore.getState().wallet.current const [customRefLinkInput, setCustomRefLinkInput] = useState('') const [existingCustomRefLinks, setexistingCustomRefLinks] = useState< @@ -169,7 +170,7 @@ export default function Referral() { const txid = await mangoClient.registerReferrerId( mangoGroup, mangoAccount, - wallet, + mangoStoreWallet, encodedRefLink ) notify({ diff --git a/yarn.lock b/yarn.lock index bce0690e..5dc45510 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1020,10 +1020,9 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@blockworks-foundation/mango-client@^3.3.20": - version "3.3.20" - resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-client/-/mango-client-3.3.20.tgz#3deff1f8df9f0231947867065ce7a80eb734e8a0" - integrity sha512-/QN3d6fSJw5SZRyn4Fp9nrZHMNdWBfh/ctagNHTPIWpap34U/2Z5E1UM0DP/BX1vbIqtISBtWS23NpmIqxxIxA== +"@blockworks-foundation/mango-client@git+https://github.com/blockworks-foundation/mango-client-v3.git#update-wallet-adapter-type": + version "3.3.19" + resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#0cab567637a5e14169625ae4ac73a22e770e0715" dependencies: "@project-serum/anchor" "^0.21.0" "@project-serum/serum" "0.13.55" From 398f8af80ee10ec733f98a6e1b3c977feceedb5e Mon Sep 17 00:00:00 2001 From: saml33 Date: Thu, 17 Mar 2022 10:04:54 +1100 Subject: [PATCH 19/27] increase y axis width --- components/stats_page/StatsPerps.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/stats_page/StatsPerps.tsx b/components/stats_page/StatsPerps.tsx index 83b05702..1a318bc9 100644 --- a/components/stats_page/StatsPerps.tsx +++ b/components/stats_page/StatsPerps.tsx @@ -174,6 +174,7 @@ export default function StatsPerps({ perpStats }) { x.toLocaleString(undefined, { maximumFractionDigits: 4 }) } type="area" + yAxisWidth={70} />
Date: Thu, 17 Mar 2022 12:43:09 +0100 Subject: [PATCH 20/27] Updates onConnect call and adds featured wallets --- components/ConnectWalletButton.tsx | 82 ++++++++++++++++++++---------- components/FloatingElement.tsx | 9 +++- components/JupiterForm.tsx | 7 ++- components/WalletSelect.tsx | 8 ++- pages/account.tsx | 7 ++- pages/referral.tsx | 9 ++-- 6 files changed, 83 insertions(+), 39 deletions(-) diff --git a/components/ConnectWalletButton.tsx b/components/ConnectWalletButton.tsx index 115cfa29..1a5cc1c4 100644 --- a/components/ConnectWalletButton.tsx +++ b/components/ConnectWalletButton.tsx @@ -1,4 +1,10 @@ -import React, { Fragment, useCallback, useState, useMemo } from 'react' +import React, { + Fragment, + useCallback, + useState, + useMemo, + useEffect, +} from 'react' import { Menu, Transition } from '@headlessui/react' import { useWallet, Wallet } from '@solana/wallet-adapter-react' import { WalletReadyState } from '@solana/wallet-adapter-base' @@ -13,44 +19,64 @@ import useMangoStore from 'stores/useMangoStore' import { ProfileIcon, WalletIcon } from './icons' import { useTranslation } from 'next-i18next' import { WalletSelect } from 'components/WalletSelect' -import { WalletSuggestionModal } from 'components' import AccountsModal from './AccountsModal' +import { uniqBy } from 'lodash' + +export const handleWalletConnect = (wallet: Wallet) => { + if (wallet.readyState === WalletReadyState.NotDetected) { + window.open(wallet.adapter.url, '_blank') + } else { + wallet?.adapter?.connect().catch((e) => { + if (e.name.includes('WalletLoadError')) { + notify({ + title: `${wallet.adapter.name} Error`, + type: 'error', + description: `Please install ${wallet.adapter.name} and then reload this page.`, + }) + } + }) + } +} export const ConnectWalletButton: React.FC = () => { - const { connected, publicKey, wallet, wallets } = useWallet() + const { connected, publicKey, wallet, wallets, select } = useWallet() const { t } = useTranslation('common') const pfp = useMangoStore((s) => s.wallet.pfp) const set = useMangoStore((s) => s.set) const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) const [showAccountsModal, setShowAccountsModal] = useState(false) - const [showWalletSuggestionModal, setShowWalletSuggestionModal] = - useState(false) - const [installedWallets] = useMemo(() => { + const defaultWallets = useMemo(() => { + return ['Phantom', 'Solflare', 'Sollet'] + }, []) + + const installedWallets = useMemo(() => { const installed: Wallet[] = [] - const notDetected: Wallet[] = [] - const loadable: Wallet[] = [] for (const wallet of wallets) { - if (wallet.readyState === WalletReadyState.NotDetected) { - notDetected.push(wallet) - } else if (wallet.readyState === WalletReadyState.Loadable) { - loadable.push(wallet) - } else if (wallet.readyState === WalletReadyState.Installed) { + if (wallet.readyState === WalletReadyState.Installed) { installed.push(wallet) } } - return [installed, [...loadable, ...notDetected]] + return installed }, [wallets]) + const displayedWallets = useMemo(() => { + return uniqBy( + [ + ...installedWallets, + ...wallets.filter((w) => defaultWallets.includes(w.adapter.name)), + ], + (w) => { + return w.adapter.name + } + ) + }, [wallets, installedWallets, defaultWallets]) + const handleConnect = useCallback(() => { - if (!installedWallets?.length) { - setShowWalletSuggestionModal(true) - } else { - wallet?.adapter?.connect().catch(() => {}) - } - }, [installedWallets, setShowWalletSuggestionModal, wallet]) + handleWalletConnect(wallet) + }, [wallet]) const handleCloseAccounts = useCallback(() => { setShowAccountsModal(false) @@ -70,6 +96,14 @@ export const ConnectWalletButton: React.FC = () => { }) }, [wallet, set, t]) + useEffect(() => { + if (!wallet && displayedWallets?.length) { + select(displayedWallets[0].adapter.name) + } + }, [wallet, displayedWallets, select]) + + console.log('wallet', wallet) + return ( <> {connected && publicKey ? ( @@ -157,7 +191,7 @@ export const ConnectWalletButton: React.FC = () => {
- +
)} @@ -167,12 +201,6 @@ export const ConnectWalletButton: React.FC = () => { isOpen={showAccountsModal} /> )} - {showWalletSuggestionModal && ( - setShowWalletSuggestionModal(false)} - isOpen={showWalletSuggestionModal} - /> - )} ) } diff --git a/components/FloatingElement.tsx b/components/FloatingElement.tsx index ba8da98d..f277ed35 100644 --- a/components/FloatingElement.tsx +++ b/components/FloatingElement.tsx @@ -1,10 +1,11 @@ -import React, { FunctionComponent } from 'react' +import React, { FunctionComponent, useCallback } from 'react' import { LinkIcon } from '@heroicons/react/outline' import useMangoStore from '../stores/useMangoStore' import { MoveIcon } from './icons' import EmptyState from './EmptyState' import { useTranslation } from 'next-i18next' import { useWallet } from '@solana/wallet-adapter-react' +import { handleWalletConnect } from 'components/ConnectWalletButton' interface FloatingElementProps { className?: string @@ -22,6 +23,10 @@ const FloatingElement: FunctionComponent = ({ const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) const connected = useMangoStore((s) => s.wallet.connected) + const handleConnect = useCallback(() => { + handleWalletConnect(wallet) + }, [wallet]) + return (
= ({ disabled={!wallet || !mangoGroup} buttonText={t('connect')} icon={} - onClickButton={() => wallet?.adapter?.connect().catch(() => {})} + onClickButton={handleConnect} title={t('connect-wallet')} />
diff --git a/components/JupiterForm.tsx b/components/JupiterForm.tsx index 43fa003b..68ddf905 100644 --- a/components/JupiterForm.tsx +++ b/components/JupiterForm.tsx @@ -46,6 +46,7 @@ import { useTranslation } from 'next-i18next' import Tabs from './Tabs' import SwapTokenInsights from './SwapTokenInsights' import { useWallet } from '@solana/wallet-adapter-react' +import { handleWalletConnect } from 'components/ConnectWalletButton' const TABS = ['Market Data', 'Performance Insights'] @@ -236,6 +237,10 @@ const JupiterForm: FunctionComponent = () => { } }, [routeMap, tokens, formValue.inputMint]) + const handleConnect = useCallback(() => { + handleWalletConnect(wallet) + }, [wallet]) + const inputWalletBalance = () => { if (walletTokens.length) { const walletToken = walletTokens.filter((t) => { @@ -945,7 +950,7 @@ const JupiterForm: FunctionComponent = () => { disabled={swapDisabled} onClick={async () => { if (!connected && zeroKey !== publicKey) { - wallet?.adapter?.connect().catch(() => {}) + handleConnect() } else if (!loading && selectedRoute && connected) { setSwapping(true) let txCount = 1 diff --git a/components/WalletSelect.tsx b/components/WalletSelect.tsx index 57633d6a..b3767eec 100644 --- a/components/WalletSelect.tsx +++ b/components/WalletSelect.tsx @@ -3,12 +3,10 @@ import { Menu, Transition } from '@headlessui/react' import { ChevronDownIcon } from '@heroicons/react/solid' import { useWallet, Wallet } from '@solana/wallet-adapter-react' -export const WalletSelect: React.FC<{ installedWallets: Wallet[] }> = ({ - installedWallets, -}) => { +export const WalletSelect: React.FC<{ wallets: Wallet[] }> = ({ wallets }) => { const { select } = useWallet() - if (!installedWallets?.length) { + if (!wallets?.length) { return null } @@ -37,7 +35,7 @@ export const WalletSelect: React.FC<{ installedWallets: Wallet[] }> = ({ leaveTo="opacity-0" > - {installedWallets?.map((wallet, index) => ( + {wallets?.map((wallet, index) => (