diff --git a/package-lock.json b/package-lock.json index 2ade83ce7..fe526b59e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,8 @@ "@material-ui/lab": "^4.0.0-alpha.60", "@paraswap/sdk": "^5.6.0-alpha.6", "@venly/web3-provider": "3.1.0-develop.0", + "@walletconnect/ethereum-provider": "^2.8.5", + "@walletconnect/modal": "^2.5.4", "apexcharts": "3.32.1", "i18next-http-backend": "^1.4.1", "numbro": "^2.3.5", @@ -64,7 +66,6 @@ "@web3-react/metamask": "^8.2.0", "@web3-react/network": "^8.2.0", "@web3-react/types": "^8.2.0", - "@web3-react/walletconnect": "^8.2.0", "ajv": "^6.12.3", "cids": "^1.1.9", "copy-to-clipboard": "^3.2.0", @@ -10271,9 +10272,9 @@ } }, "node_modules/@walletconnect/core": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.8.3.tgz", - "integrity": "sha512-uQG3XoGJscnxOWTO/W39QOXQszNpSbV8b/BFJoful9D1IUGeTracGc8FdKtNQFfvyhrx3gooZ+HwOK6QBirXzQ==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.8.5.tgz", + "integrity": "sha512-p+hrz9cVyqgBEitV1iIHrmw9ZLz7d85bIPu4DpqktRzmew6OpHzZvmnZ/hpI4fqADsbYBMjP1wH8FBBzwJeB8w==", "dependencies": { "@walletconnect/heartbeat": "1.2.1", "@walletconnect/jsonrpc-provider": "1.0.13", @@ -10286,8 +10287,8 @@ "@walletconnect/relay-auth": "^1.0.4", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/types": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0", "lodash.isequal": "4.5.0", "uint8arrays": "^3.1.0" @@ -10334,18 +10335,18 @@ "license": "0BSD" }, "node_modules/@walletconnect/ethereum-provider": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/ethereum-provider/-/ethereum-provider-2.8.3.tgz", - "integrity": "sha512-OdD1G7xWAqJy2G/C5uoLHNw6oPs3+epXjt1J0WF8984f34GBse7iCCC6vB3ImvtzO2Jc/B08LUUnATdyDMxYMw==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/ethereum-provider/-/ethereum-provider-2.8.5.tgz", + "integrity": "sha512-wNQghH/NdxT5t+Pv3tBgIyailA1bQ5BB5KBOzy4IwyP1Tt+tSZzo8xI5pvf7mbTA4/DXXr2As0vCC6OerVHZug==", "dependencies": { "@walletconnect/jsonrpc-http-connection": "^1.0.7", "@walletconnect/jsonrpc-provider": "^1.0.13", "@walletconnect/jsonrpc-types": "^1.0.3", "@walletconnect/jsonrpc-utils": "^1.0.8", - "@walletconnect/sign-client": "2.8.3", - "@walletconnect/types": "2.8.3", - "@walletconnect/universal-provider": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/sign-client": "2.8.5", + "@walletconnect/types": "2.8.5", + "@walletconnect/universal-provider": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0" }, "peerDependencies": { @@ -10600,6 +10601,78 @@ "version": "1.4.0", "license": "MIT" }, + "node_modules/@walletconnect/modal": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@walletconnect/modal/-/modal-2.5.4.tgz", + "integrity": "sha512-JAKMcCd4JQvSEr7pNitg3OBke4DN1JyaQ7bdi3x4T7oLgOr9Y88qdkeOXko/0aJonDHJsM88hZ10POQWmKfEMA==", + "dependencies": { + "@walletconnect/modal-core": "2.5.4", + "@walletconnect/modal-ui": "2.5.4" + } + }, + "node_modules/@walletconnect/modal-core": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@walletconnect/modal-core/-/modal-core-2.5.4.tgz", + "integrity": "sha512-ISe4LqmEDFU7b6rLgonqaEtMXzG6ko13HA7S8Ty3d7GgfAEe29LM1dq3zo8ehEOghhofhj1PiiNfvaogZKzT1g==", + "dependencies": { + "buffer": "6.0.3", + "valtio": "1.10.6" + } + }, + "node_modules/@walletconnect/modal-core/node_modules/valtio": { + "version": "1.10.6", + "resolved": "https://registry.npmjs.org/valtio/-/valtio-1.10.6.tgz", + "integrity": "sha512-SxN1bHUmdhW6V8qsQTpCgJEwp7uHbntuH0S9cdLQtiohuevwBksbpXjwj5uDMA7bLwg1WKyq9sEpZrx3TIMrkA==", + "dependencies": { + "proxy-compare": "2.5.1", + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + } + }, + "node_modules/@walletconnect/modal-ui": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@walletconnect/modal-ui/-/modal-ui-2.5.4.tgz", + "integrity": "sha512-5qLLjwbE3YC4AsCVhf8J87otklkApcQ5DCMykOcS0APPv8lKQ46JxpQhfWwRYaUkuIiHonI9h1YxFARDkoaI9g==", + "dependencies": { + "@walletconnect/modal-core": "2.5.4", + "lit": "2.7.5", + "motion": "10.16.2", + "qrcode": "1.5.3" + } + }, + "node_modules/@walletconnect/modal-ui/node_modules/lit": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.7.5.tgz", + "integrity": "sha512-i/cH7Ye6nBDUASMnfwcictBnsTN91+aBjXoTHF2xARghXScKxpD4F4WYI+VLXg9lqbMinDfvoI7VnZXjyHgdfQ==", + "dependencies": { + "@lit/reactive-element": "^1.6.0", + "lit-element": "^3.3.0", + "lit-html": "^2.7.0" + } + }, + "node_modules/@walletconnect/modal-ui/node_modules/motion": { + "version": "10.16.2", + "resolved": "https://registry.npmjs.org/motion/-/motion-10.16.2.tgz", + "integrity": "sha512-p+PurYqfUdcJZvtnmAqu5fJgV2kR0uLFQuBKtLeFVTrYEVllI99tiOTSefVNYuip9ELTEkepIIDftNdze76NAQ==", + "dependencies": { + "@motionone/animation": "^10.15.1", + "@motionone/dom": "^10.16.2", + "@motionone/svelte": "^10.16.2", + "@motionone/types": "^10.15.1", + "@motionone/utils": "^10.15.1", + "@motionone/vue": "^10.16.2" + } + }, "node_modules/@walletconnect/qrcode-modal": { "version": "1.8.0", "license": "Apache-2.0", @@ -10874,18 +10947,18 @@ "license": "0BSD" }, "node_modules/@walletconnect/sign-client": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.8.3.tgz", - "integrity": "sha512-fOlyZfzV4xJO0CDCMrQ3hw4bIuboncqVpJ0BgTF5yQtKklv+5pEqlFnhU8GN2rE6GThU1zyPQNibT/jRG7lCAw==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.8.5.tgz", + "integrity": "sha512-sLoQtARKfm2pJZ4Br4ME6LJeqn5lIcF7YJUZdNJ0DI34ZRsZCYvPuHN+2JANn4e1G24PnRwUC/uzilSMVkjvrQ==", "dependencies": { - "@walletconnect/core": "2.8.3", + "@walletconnect/core": "2.8.5", "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/types": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0" } }, @@ -10981,9 +11054,9 @@ "license": "0BSD" }, "node_modules/@walletconnect/types": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.8.3.tgz", - "integrity": "sha512-crZ5IfWEp+ctygfDNifzB68sVWKwfLMiF7GZuoOzKJuFYbXtcNjtpmFdAd3cPT+a8L30XMgv0shEdIHTj2JglQ==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.8.5.tgz", + "integrity": "sha512-Zyr16q17JAvF3u2b+ClLdpO7HEUd/gnNj90+V2o3DHYaScrL0LZ0d9DS3hdba2l06WAoSAZNw9AKD/qN2gKHGw==", "dependencies": { "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", @@ -10994,25 +11067,25 @@ } }, "node_modules/@walletconnect/universal-provider": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/universal-provider/-/universal-provider-2.8.3.tgz", - "integrity": "sha512-HW1u23Ridjq+LG1mb+nsH31lPa4/th5kFpWuBem9n6FeZNIpoWbbGQUhU3Q5snyMccD1Vxgvxv1xC2KMUwbXTA==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/universal-provider/-/universal-provider-2.8.5.tgz", + "integrity": "sha512-XyhyUf/VgwgvEvDE+pmPuoesCfOebYt3DrlyGfPkZVUgceByBGru2iB7TQUWbiYjjhltSdn8SVlodUSc68rYeg==", "dependencies": { "@walletconnect/jsonrpc-http-connection": "^1.0.7", "@walletconnect/jsonrpc-provider": "1.0.13", "@walletconnect/jsonrpc-types": "^1.0.2", "@walletconnect/jsonrpc-utils": "^1.0.7", "@walletconnect/logger": "^2.0.1", - "@walletconnect/sign-client": "2.8.3", - "@walletconnect/types": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/sign-client": "2.8.5", + "@walletconnect/types": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0" } }, "node_modules/@walletconnect/utils": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.8.3.tgz", - "integrity": "sha512-PwNEj/kGO7J7ZyrAaVqYkASLBG77qDE/+6JPX11GAucSy2wac92WefLjfVsPLNPwiNmYiV1eGbxzR3KCdlnrLA==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.8.5.tgz", + "integrity": "sha512-CH4j9gCtcdyTa4OcyviiwQvmu1B6rQ8OAlA+PzlDd3HVJ2ftpvP/oy2LuDb3XkvxXd4uN4EL6TyK3sxckgguaA==", "dependencies": { "@stablelib/chacha20poly1305": "1.0.1", "@stablelib/hkdf": "1.0.1", @@ -11022,7 +11095,7 @@ "@walletconnect/relay-api": "^1.0.9", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.8.3", + "@walletconnect/types": "2.8.5", "@walletconnect/window-getters": "^1.0.1", "@walletconnect/window-metadata": "^1.0.1", "detect-browser": "5.3.0", @@ -11161,71 +11234,6 @@ "zustand": "^4.3.5" } }, - "node_modules/@web3-react/walletconnect": { - "version": "8.2.0", - "dev": true, - "license": "GPL-3.0-or-later", - "dependencies": { - "@walletconnect/ethereum-provider": "^1.7.8", - "@web3-react/types": "^8.2.0", - "eventemitter3": "^4.0.7" - } - }, - "node_modules/@web3-react/walletconnect/node_modules/@walletconnect/ethereum-provider": { - "version": "1.8.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@walletconnect/client": "^1.8.0", - "@walletconnect/jsonrpc-http-connection": "^1.0.2", - "@walletconnect/jsonrpc-provider": "^1.0.5", - "@walletconnect/signer-connection": "^1.8.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0", - "eip1193-provider": "1.0.1", - "eventemitter3": "4.0.7" - } - }, - "node_modules/@web3-react/walletconnect/node_modules/@walletconnect/types": { - "version": "1.8.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/@web3-react/walletconnect/node_modules/@walletconnect/utils": { - "version": "1.8.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "node_modules/@web3-react/walletconnect/node_modules/bn.js": { - "version": "4.11.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@web3-react/walletconnect/node_modules/query-string": { - "version": "6.13.5", - "dev": true, - "license": "MIT", - "dependencies": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@web3modal/core": { "version": "2.4.1", "license": "Apache-2.0", @@ -52827,9 +52835,9 @@ } }, "@walletconnect/core": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.8.3.tgz", - "integrity": "sha512-uQG3XoGJscnxOWTO/W39QOXQszNpSbV8b/BFJoful9D1IUGeTracGc8FdKtNQFfvyhrx3gooZ+HwOK6QBirXzQ==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.8.5.tgz", + "integrity": "sha512-p+hrz9cVyqgBEitV1iIHrmw9ZLz7d85bIPu4DpqktRzmew6OpHzZvmnZ/hpI4fqADsbYBMjP1wH8FBBzwJeB8w==", "requires": { "@walletconnect/heartbeat": "1.2.1", "@walletconnect/jsonrpc-provider": "1.0.13", @@ -52842,8 +52850,8 @@ "@walletconnect/relay-auth": "^1.0.4", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/types": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0", "lodash.isequal": "4.5.0", "uint8arrays": "^3.1.0" @@ -52890,18 +52898,18 @@ } }, "@walletconnect/ethereum-provider": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/ethereum-provider/-/ethereum-provider-2.8.3.tgz", - "integrity": "sha512-OdD1G7xWAqJy2G/C5uoLHNw6oPs3+epXjt1J0WF8984f34GBse7iCCC6vB3ImvtzO2Jc/B08LUUnATdyDMxYMw==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/ethereum-provider/-/ethereum-provider-2.8.5.tgz", + "integrity": "sha512-wNQghH/NdxT5t+Pv3tBgIyailA1bQ5BB5KBOzy4IwyP1Tt+tSZzo8xI5pvf7mbTA4/DXXr2As0vCC6OerVHZug==", "requires": { "@walletconnect/jsonrpc-http-connection": "^1.0.7", "@walletconnect/jsonrpc-provider": "^1.0.13", "@walletconnect/jsonrpc-types": "^1.0.3", "@walletconnect/jsonrpc-utils": "^1.0.8", - "@walletconnect/sign-client": "2.8.3", - "@walletconnect/types": "2.8.3", - "@walletconnect/universal-provider": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/sign-client": "2.8.5", + "@walletconnect/types": "2.8.5", + "@walletconnect/universal-provider": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0" } }, @@ -53127,6 +53135,71 @@ "@walletconnect/mobile-registry": { "version": "1.4.0" }, + "@walletconnect/modal": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@walletconnect/modal/-/modal-2.5.4.tgz", + "integrity": "sha512-JAKMcCd4JQvSEr7pNitg3OBke4DN1JyaQ7bdi3x4T7oLgOr9Y88qdkeOXko/0aJonDHJsM88hZ10POQWmKfEMA==", + "requires": { + "@walletconnect/modal-core": "2.5.4", + "@walletconnect/modal-ui": "2.5.4" + } + }, + "@walletconnect/modal-core": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@walletconnect/modal-core/-/modal-core-2.5.4.tgz", + "integrity": "sha512-ISe4LqmEDFU7b6rLgonqaEtMXzG6ko13HA7S8Ty3d7GgfAEe29LM1dq3zo8ehEOghhofhj1PiiNfvaogZKzT1g==", + "requires": { + "buffer": "6.0.3", + "valtio": "1.10.6" + }, + "dependencies": { + "valtio": { + "version": "1.10.6", + "resolved": "https://registry.npmjs.org/valtio/-/valtio-1.10.6.tgz", + "integrity": "sha512-SxN1bHUmdhW6V8qsQTpCgJEwp7uHbntuH0S9cdLQtiohuevwBksbpXjwj5uDMA7bLwg1WKyq9sEpZrx3TIMrkA==", + "requires": { + "proxy-compare": "2.5.1", + "use-sync-external-store": "1.2.0" + } + } + } + }, + "@walletconnect/modal-ui": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@walletconnect/modal-ui/-/modal-ui-2.5.4.tgz", + "integrity": "sha512-5qLLjwbE3YC4AsCVhf8J87otklkApcQ5DCMykOcS0APPv8lKQ46JxpQhfWwRYaUkuIiHonI9h1YxFARDkoaI9g==", + "requires": { + "@walletconnect/modal-core": "2.5.4", + "lit": "2.7.5", + "motion": "10.16.2", + "qrcode": "1.5.3" + }, + "dependencies": { + "lit": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.7.5.tgz", + "integrity": "sha512-i/cH7Ye6nBDUASMnfwcictBnsTN91+aBjXoTHF2xARghXScKxpD4F4WYI+VLXg9lqbMinDfvoI7VnZXjyHgdfQ==", + "requires": { + "@lit/reactive-element": "^1.6.0", + "lit-element": "^3.3.0", + "lit-html": "^2.7.0" + } + }, + "motion": { + "version": "10.16.2", + "resolved": "https://registry.npmjs.org/motion/-/motion-10.16.2.tgz", + "integrity": "sha512-p+PurYqfUdcJZvtnmAqu5fJgV2kR0uLFQuBKtLeFVTrYEVllI99tiOTSefVNYuip9ELTEkepIIDftNdze76NAQ==", + "requires": { + "@motionone/animation": "^10.15.1", + "@motionone/dom": "^10.16.2", + "@motionone/svelte": "^10.16.2", + "@motionone/types": "^10.15.1", + "@motionone/utils": "^10.15.1", + "@motionone/vue": "^10.16.2" + } + } + } + }, "@walletconnect/qrcode-modal": { "version": "1.8.0", "requires": { @@ -53325,18 +53398,18 @@ } }, "@walletconnect/sign-client": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.8.3.tgz", - "integrity": "sha512-fOlyZfzV4xJO0CDCMrQ3hw4bIuboncqVpJ0BgTF5yQtKklv+5pEqlFnhU8GN2rE6GThU1zyPQNibT/jRG7lCAw==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.8.5.tgz", + "integrity": "sha512-sLoQtARKfm2pJZ4Br4ME6LJeqn5lIcF7YJUZdNJ0DI34ZRsZCYvPuHN+2JANn4e1G24PnRwUC/uzilSMVkjvrQ==", "requires": { - "@walletconnect/core": "2.8.3", + "@walletconnect/core": "2.8.5", "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/types": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0" } }, @@ -53408,9 +53481,9 @@ } }, "@walletconnect/types": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.8.3.tgz", - "integrity": "sha512-crZ5IfWEp+ctygfDNifzB68sVWKwfLMiF7GZuoOzKJuFYbXtcNjtpmFdAd3cPT+a8L30XMgv0shEdIHTj2JglQ==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.8.5.tgz", + "integrity": "sha512-Zyr16q17JAvF3u2b+ClLdpO7HEUd/gnNj90+V2o3DHYaScrL0LZ0d9DS3hdba2l06WAoSAZNw9AKD/qN2gKHGw==", "requires": { "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", @@ -53421,25 +53494,25 @@ } }, "@walletconnect/universal-provider": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/universal-provider/-/universal-provider-2.8.3.tgz", - "integrity": "sha512-HW1u23Ridjq+LG1mb+nsH31lPa4/th5kFpWuBem9n6FeZNIpoWbbGQUhU3Q5snyMccD1Vxgvxv1xC2KMUwbXTA==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/universal-provider/-/universal-provider-2.8.5.tgz", + "integrity": "sha512-XyhyUf/VgwgvEvDE+pmPuoesCfOebYt3DrlyGfPkZVUgceByBGru2iB7TQUWbiYjjhltSdn8SVlodUSc68rYeg==", "requires": { "@walletconnect/jsonrpc-http-connection": "^1.0.7", "@walletconnect/jsonrpc-provider": "1.0.13", "@walletconnect/jsonrpc-types": "^1.0.2", "@walletconnect/jsonrpc-utils": "^1.0.7", "@walletconnect/logger": "^2.0.1", - "@walletconnect/sign-client": "2.8.3", - "@walletconnect/types": "2.8.3", - "@walletconnect/utils": "2.8.3", + "@walletconnect/sign-client": "2.8.5", + "@walletconnect/types": "2.8.5", + "@walletconnect/utils": "2.8.5", "events": "^3.3.0" } }, "@walletconnect/utils": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.8.3.tgz", - "integrity": "sha512-PwNEj/kGO7J7ZyrAaVqYkASLBG77qDE/+6JPX11GAucSy2wac92WefLjfVsPLNPwiNmYiV1eGbxzR3KCdlnrLA==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.8.5.tgz", + "integrity": "sha512-CH4j9gCtcdyTa4OcyviiwQvmu1B6rQ8OAlA+PzlDd3HVJ2ftpvP/oy2LuDb3XkvxXd4uN4EL6TyK3sxckgguaA==", "requires": { "@stablelib/chacha20poly1305": "1.0.1", "@stablelib/hkdf": "1.0.1", @@ -53449,7 +53522,7 @@ "@walletconnect/relay-api": "^1.0.9", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.8.3", + "@walletconnect/types": "2.8.5", "@walletconnect/window-getters": "^1.0.1", "@walletconnect/window-metadata": "^1.0.1", "detect-browser": "5.3.0", @@ -53569,61 +53642,6 @@ "zustand": "^4.3.5" } }, - "@web3-react/walletconnect": { - "version": "8.2.0", - "dev": true, - "requires": { - "@walletconnect/ethereum-provider": "^1.7.8", - "@web3-react/types": "^8.2.0", - "eventemitter3": "^4.0.7" - }, - "dependencies": { - "@walletconnect/ethereum-provider": { - "version": "1.8.0", - "dev": true, - "requires": { - "@walletconnect/client": "^1.8.0", - "@walletconnect/jsonrpc-http-connection": "^1.0.2", - "@walletconnect/jsonrpc-provider": "^1.0.5", - "@walletconnect/signer-connection": "^1.8.0", - "@walletconnect/types": "^1.8.0", - "@walletconnect/utils": "^1.8.0", - "eip1193-provider": "1.0.1", - "eventemitter3": "4.0.7" - } - }, - "@walletconnect/types": { - "version": "1.8.0", - "dev": true - }, - "@walletconnect/utils": { - "version": "1.8.0", - "dev": true, - "requires": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "bn.js": { - "version": "4.11.8", - "dev": true - }, - "query-string": { - "version": "6.13.5", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - } - } - } - }, "@web3modal/core": { "version": "2.4.1", "requires": { diff --git a/package.json b/package.json index 63aab315f..722ae031b 100755 --- a/package.json +++ b/package.json @@ -4,6 +4,8 @@ "private": true, "devDependencies": { "@ethersproject/experimental": "^5.4.0", + "@orbs-network/twap-ui": "0.7.x", + "@orbs-network/twap-ui-quickswap": "0.7.x", "@reduxjs/toolkit": "^1.3.5", "@types/d3": "^6.7.1", "@types/jest": "^25.2.1", @@ -32,7 +34,6 @@ "@web3-react/metamask": "^8.2.0", "@web3-react/network": "^8.2.0", "@web3-react/types": "^8.2.0", - "@web3-react/walletconnect": "^8.2.0", "ajv": "^6.12.3", "cids": "^1.1.9", "copy-to-clipboard": "^3.2.0", @@ -70,9 +71,7 @@ "serve": "^11.3.2", "source-map-explorer": "^2.5.2", "start-server-and-test": "^1.11.0", - "typescript": "^4.1.2", - "@orbs-network/twap-ui": "0.7.x", - "@orbs-network/twap-ui-quickswap": "0.7.x" + "typescript": "^4.1.2" }, "resolutions": { "yargs-parser": "^13.1.2", @@ -134,6 +133,8 @@ "@material-ui/lab": "^4.0.0-alpha.60", "@paraswap/sdk": "^5.6.0-alpha.6", "@venly/web3-provider": "3.1.0-develop.0", + "@walletconnect/ethereum-provider": "^2.8.5", + "@walletconnect/modal": "^2.5.4", "apexcharts": "3.32.1", "i18next-http-backend": "^1.4.1", "numbro": "^2.3.5", diff --git a/src/components/StakeModal/index.tsx b/src/components/StakeModal/index.tsx index d176f71c0..4adcc65df 100644 --- a/src/components/StakeModal/index.tsx +++ b/src/components/StakeModal/index.tsx @@ -222,9 +222,9 @@ export function FarmModal({ farmHandler( selectedNFT, { - pool: pool.id, - rewardToken: rewardToken.id, - bonusRewardToken: bonusRewardToken.id, + pool: pool?.id, + rewardToken: rewardToken?.id, + bonusRewardToken: bonusRewardToken?.id, startTime, endTime, }, @@ -235,9 +235,9 @@ export function FarmModal({ [ farmHandler, selectedNFT, - pool.id, - rewardToken.id, - bonusRewardToken.id, + pool, + rewardToken, + bonusRewardToken, startTime, endTime, selectedTier, @@ -268,7 +268,7 @@ export function FarmModal({ +_balance >= +formatUnits( BigNumber.from(tokenAmountForTier1), - multiplierToken.decimals, + multiplierToken?.decimals, ) ); case tokenAmountForTier2: @@ -276,7 +276,7 @@ export function FarmModal({ +_balance >= +formatUnits( BigNumber.from(tokenAmountForTier2), - multiplierToken.decimals, + multiplierToken?.decimals, ) ); case tokenAmountForTier3: @@ -284,7 +284,7 @@ export function FarmModal({ +_balance >= +formatUnits( BigNumber.from(tokenAmountForTier3), - multiplierToken.decimals, + multiplierToken?.decimals, ) ); default: @@ -292,7 +292,7 @@ export function FarmModal({ } }, [ balance, - multiplierToken.decimals, + multiplierToken?.decimals, selectedTier, tokenAmountForTier1, tokenAmountForTier2, @@ -375,7 +375,7 @@ export function FarmModal({ ) : positionsForPoolLoading ? ( @@ -418,7 +418,7 @@ export function FarmModal({

{t('noNFTForPool')}

{t('takePartinFarmNeedTo')}

- + [0], + 'rpcMap' +> & { + /** + * Map of chainIds to rpc url(s). If multiple urls are provided, the first one that responds + * within a given timeout will be used. Note that multiple urls are not supported by WalletConnect by default. + * That's why we extend its options with our own `rpcMap` (@see getBestUrlMap). + */ + rpcMap?: { [chainId: number]: string | string[] }; +}; + +/** + * Options to configure the WalletConnect connector. + */ +export interface WalletConnectConstructorArgs { + actions: Actions; + /** Options to pass to `@walletconnect/ethereum-provider`. */ + options: WalletConnectOptions; + /** The chainId to connect to in activate if one is not provided. */ + defaultChainId?: number; + /** + * @param timeout - Timeout, in milliseconds, after which to treat network calls to urls as failed when selecting + * online urls. + */ + timeout?: number; + /** + * @param onError - Handler to report errors thrown from WalletConnect. + */ + onError?: (error: Error) => void; +} + +export class WalletConnect extends Connector { + /** {@inheritdoc Connector.provider} */ + public provider?: WalletConnectProvider; + public readonly events = new EventEmitter3(); + + private readonly options: Omit; + + private readonly rpcMap?: Record; + private readonly chains: number[]; + private readonly defaultChainId?: number; + private readonly timeout: number; + + private eagerConnection?: Promise; -export class WalletConnectPopup extends WalletConnect { constructor({ actions, + options, + defaultChainId, + timeout = DEFAULT_TIMEOUT, onError, - qrcode = true, - qrcodeModalOptions, - }: Omit & { - qrcode?: boolean; - qrcodeModalOptions?: any; - }) { - super({ - actions, - options: { qrcode, rpc: rpcMap, qrcodeModalOptions }, - onError, - }); + }: WalletConnectConstructorArgs) { + super(actions, onError); + + const { rpcMap, chains, ...rest } = options; + + this.options = rest; + this.chains = chains; + this.defaultChainId = defaultChainId; + this.rpcMap = rpcMap; + this.timeout = timeout; + } + + private disconnectListener = (error: ProviderRpcError) => { + this.actions.resetState(); + if (error) this.onError?.(error); + }; + + private chainChangedListener = (chainId: string): void => { + this.actions.update({ chainId: Number.parseInt(chainId, 16) }); + }; + + private accountsChangedListener = (accounts: string[]): void => { + this.actions.update({ accounts }); + }; + + private URIListener = (uri: string): void => { + this.events.emit(URI_AVAILABLE, uri); + }; + + private isomorphicInitialize( + desiredChainId: number | undefined = this.defaultChainId, + ): Promise { + if (this.eagerConnection) return this.eagerConnection; + + const rpcMap = this.rpcMap + ? getBestUrlMap(this.rpcMap, this.timeout) + : undefined; + const chains = desiredChainId + ? getChainsWithDefault(this.chains, desiredChainId) + : this.chains; + + return (this.eagerConnection = import( + '@walletconnect/ethereum-provider' + ).then(async (ethProviderModule) => { + const provider = (this.provider = await ethProviderModule.default.init({ + ...this.options, + chains, + rpcMap: await rpcMap, + })); + + return provider + .on('disconnect', this.disconnectListener) + .on('chainChanged', this.chainChangedListener) + .on('accountsChanged', this.accountsChangedListener) + .on('display_uri', this.URIListener); + })); + } + + /** {@inheritdoc Connector.connectEagerly} */ + public async connectEagerly(): Promise { + const cancelActivation = this.actions.startActivation(); + + try { + const provider = await this.isomorphicInitialize(); + // WalletConnect automatically persists and restores active sessions + if (!provider.session) { + throw new Error('No active session found. Connect your wallet first.'); + } + this.actions.update({ + accounts: provider.accounts, + chainId: provider.chainId, + }); + } catch (error) { + await this.deactivate(); + cancelActivation(); + throw error; + } + } + + /** + * @param desiredChainId - The desired chainId to connect to. + */ + public async activate(desiredChainId?: number): Promise { + const provider = await this.isomorphicInitialize(desiredChainId); + + if (provider.session) { + if (!desiredChainId || desiredChainId === provider.chainId) return; + // WalletConnect exposes connected accounts, not chains: `eip155:${chainId}:${address}` + const isConnectedToDesiredChain = provider.session.namespaces.eip155.accounts.some( + (account) => account.startsWith(`eip155:${desiredChainId}:`), + ); + if (!isConnectedToDesiredChain) { + if (this.options.optionalChains?.includes(desiredChainId)) { + throw new Error( + `Cannot activate an optional chain (${desiredChainId}), as the wallet is not connected to it.\n\tYou should handle this error in application code, as there is no guarantee that a wallet is connected to a chain configured in "optionalChains".`, + ); + } + throw new Error( + `Unknown chain (${desiredChainId}). Make sure to include any chains you might connect to in the "chains" or "optionalChains" parameters when initializing WalletConnect.`, + ); + } + return provider.request({ + method: 'wallet_switchEthereumChain', + params: [{ chainId: `0x${desiredChainId.toString(16)}` }], + }); + } + + const cancelActivation = this.actions.startActivation(); + + try { + await provider.enable(); + this.actions.update({ + chainId: provider.chainId, + accounts: provider.accounts, + }); + } catch (error) { + await this.deactivate(); + cancelActivation(); + throw error; + } } - activate(chainId?: number) { - return super.activate(chainId); + /** {@inheritdoc Connector.deactivate} */ + public async deactivate(): Promise { + this.provider + ?.removeListener('disconnect', this.disconnectListener) + .removeListener('chainChanged', this.chainChangedListener) + .removeListener('accountsChanged', this.accountsChangedListener) + .removeListener('display_uri', this.URIListener) + .disconnect(); + this.provider = undefined; + this.eagerConnection = undefined; + this.actions.resetState(); } } diff --git a/src/connectors/WalletConnectPopup.ts b/src/connectors/WalletConnectPopup.ts new file mode 100644 index 000000000..2cb33a4c9 --- /dev/null +++ b/src/connectors/WalletConnectPopup.ts @@ -0,0 +1,32 @@ +import { SUPPORTED_CHAINIDS } from 'constants/index'; +import { WalletConnect, WalletConnectConstructorArgs } from './WalletConnect'; +import { rpcMap } from 'constants/providers'; +import { QrModalOptions } from '@walletconnect/ethereum-provider/dist/types/EthereumProvider'; + +export class WalletConnectPopup extends WalletConnect { + constructor({ + actions, + onError, + qrcode = true, + qrModalOptions, + }: Omit & { + qrcode?: boolean; + qrModalOptions?: QrModalOptions; + }) { + super({ + actions, + options: { + showQrModal: qrcode, + chains: [1], + optionalChains: SUPPORTED_CHAINIDS, + projectId: 'a6cc11517a10f6f12953fd67b1eb67e7', + qrModalOptions, + }, + onError, + }); + } + + activate(chainId?: number) { + return super.activate(chainId); + } +} diff --git a/src/connectors/index.ts b/src/connectors/index.ts index 9b646b921..827bb8ea2 100755 --- a/src/connectors/index.ts +++ b/src/connectors/index.ts @@ -4,7 +4,7 @@ import { GnosisSafe } from '@web3-react/gnosis-safe'; import { MetaMask } from './Metamask'; import { Network } from '@web3-react/network'; import { Connector } from '@web3-react/types'; -import { WalletConnectPopup } from './WalletConnect'; +import { WalletConnectPopup } from './WalletConnectPopup'; import { Venly } from './Arkane'; import { ChainId } from '@uniswap/sdk'; import MetamaskIcon from 'assets/images/metamask.png'; @@ -298,7 +298,19 @@ const [web3ZengoConnect, web3ZengoConnectHooks] = initializeConnector< new WalletConnectPopup({ actions, onError, - qrcodeModalOptions: { mobileLinks: ['ZenGo'] }, + qrModalOptions: { + mobileWallets: [ + { + id: + '4ff5b6816dd118b8c362939cfb7332f667ff071a1828aa96c760871e1b5634fd', + name: 'ZenGo', + links: { + native: '', + universal: 'https://get.zengo.com', + }, + }, + ], + }, }), ); diff --git a/src/connectors/utils.ts b/src/connectors/utils.ts index 43f6dfab4..171a99f34 100644 --- a/src/connectors/utils.ts +++ b/src/connectors/utils.ts @@ -63,3 +63,109 @@ export const getIsBitKeepWallet = () => { const windowAsAny = window as any; return Boolean(windowAsAny.bitkeep && windowAsAny.bitkeep.ethereum); }; + +async function getBestUrl( + urls: string | string[], + timeout: number, +): Promise { + // if we only have 1 url, it's the best! + if (typeof urls === 'string') return urls; + if (urls.length === 1) return urls[0]; + + const [HttpConnection, JsonRpcProvider] = await Promise.all([ + import('@walletconnect/jsonrpc-http-connection').then( + ({ HttpConnection }) => HttpConnection, + ), + import('@walletconnect/jsonrpc-provider').then( + ({ JsonRpcProvider }) => JsonRpcProvider, + ), + ]); + + // the below returns the first url for which there's been a successful call, prioritized by index + return new Promise((resolve) => { + let resolved = false; + const successes: { [index: number]: boolean } = {}; + + urls.forEach((url, i) => { + const http = new JsonRpcProvider(new HttpConnection(url)); + + // create a promise that resolves on a successful call, and rejects on a failed call or after timeout milliseconds + const promise = new Promise((resolve, reject) => { + http + .request({ method: 'eth_chainId' }) + .then(() => resolve()) + .catch(() => reject()); + + // set a timeout to reject + setTimeout(() => { + reject(); + }, timeout); + }); + + void promise + .then(() => true) + .catch(() => false) + .then((success) => { + // if we already resolved, return + if (resolved) return; + + // store the result of the call + successes[i] = success; + + // if this is the last call and we haven't resolved yet - do so + if (Object.keys(successes).length === urls.length) { + const index = Object.keys(successes).findIndex( + (j) => successes[Number(j)], + ); + // no need to set resolved to true, as this is the last promise + return resolve(urls[index === -1 ? 0 : index]); + } + + // otherwise, for each prospective index, check if we can resolve + new Array(urls.length) + .fill(0) + .forEach((_, prospectiveIndex) => { + // to resolve, we need to: + // a) have successfully made a call + // b) not be waiting on any other higher-index calls + if ( + successes[prospectiveIndex] && + new Array(prospectiveIndex) + .fill(0) + .every((_, j) => successes[j] === false) + ) { + resolved = true; + resolve(urls[prospectiveIndex]); + } + }); + }); + }); + }); +} + +export async function getBestUrlMap( + rpcMap: Record, + timeout: number, +): Promise<{ [chainId: string]: string }> { + return Object.fromEntries( + await Promise.all( + Object.entries(rpcMap).map(async ([chainId, map]) => [ + chainId, + await getBestUrl(map, timeout), + ]), + ), + ); +} + +export function getChainsWithDefault(chains: number[], defaultChainId: number) { + const idx = chains.indexOf(defaultChainId); + if (idx === -1) { + throw new Error( + `Invalid chainId ${defaultChainId}. Make sure default chain is included in "chains" - chains specified in "optionalChains" may not be selected as the default, as they may not be supported by the wallet.`, + ); + } + + const ordered = [...chains]; + ordered.splice(idx, 1); + return [defaultChainId, ...ordered]; +} diff --git a/src/hooks/useGasPrice.ts b/src/hooks/useGasPrice.ts index 39ee10f42..3b9be945c 100644 --- a/src/hooks/useGasPrice.ts +++ b/src/hooks/useGasPrice.ts @@ -1,28 +1 @@ -import { useState } from 'react'; - export const GAS_PRICE_MULTIPLIER = 1_000_000_000; - -export function useGasPrice() { - const [gasPrice, setGasPrice] = useState<{ - fetched: null | number; - override: boolean; - }>({ fetched: null, override: false }); - const [gasPriceLoading, setGasPriceLoading] = useState(false); - - async function fetchGasPrice() { - setGasPriceLoading(true); - - try { - const gasPriceReq = await fetch( - 'https://gasstation-mainnet.matic.network/', - ); - const { standard } = await gasPriceReq.json(); - setGasPrice({ fetched: standard, override: standard < 36 }); - } catch (err) { - console.error('Gas price fetching failed', err.code, err.message); - } - setGasPriceLoading(false); - } - - return { fetchGasPrice, gasPrice, gasPriceLoading }; -} diff --git a/src/hooks/useIncentiveSubgraph.ts b/src/hooks/useIncentiveSubgraph.ts index a91c69f12..1e6be6e62 100644 --- a/src/hooks/useIncentiveSubgraph.ts +++ b/src/hooks/useIncentiveSubgraph.ts @@ -441,15 +441,6 @@ export function useFarmingSubgraph() { provider.getSigner(), ); - const { - reward, - bonusReward, - } = await farmingCenterContract.callStatic.collectRewards( - [rewardToken, bonusRewardToken, pool, startTime, endTime], - +position.id, - { from: account }, - ); - const _rewardToken = await fetchToken(rewardToken, true); const _bonusRewardToken = await fetchToken(bonusRewardToken, true); const _pool = await fetchPool(pool); @@ -471,6 +462,15 @@ export function useFarmingSubgraph() { }; const _multiplierToken = await fetchToken(multiplierToken, true); + let rewardRes: any; + try { + rewardRes = await farmingCenterContract.callStatic.collectRewards( + [rewardToken, bonusRewardToken, pool, startTime, endTime], + +position.id, + { from: account }, + ); + } catch (e) {} + _position = { ..._position, farmId: id, @@ -489,11 +489,12 @@ export function useFarmingSubgraph() { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore pool: newPool, - eternalEarned: formatUnits(reward, _rewardToken.decimals), - eternalBonusEarned: formatUnits( - bonusReward, - _bonusRewardToken.decimals, - ), + eternalEarned: rewardRes + ? formatUnits(rewardRes.reward, _rewardToken.decimals) + : 0, + eternalBonusEarned: rewardRes + ? formatUnits(rewardRes.bonusReward, _bonusRewardToken.decimals) + : 0, }; } else { const res = await fetch( diff --git a/src/index.scss b/src/index.scss index 2cb9a3afb..1a35bc666 100755 --- a/src/index.scss +++ b/src/index.scss @@ -12,6 +12,11 @@ body { } } +wcm-modal { + z-index: 10000; + position: relative; +} + .loadingDots { &::after { display: inline-block; diff --git a/src/layouts/PageLayout.tsx b/src/layouts/PageLayout.tsx index 2cbb8e023..9647b651a 100755 --- a/src/layouts/PageLayout.tsx +++ b/src/layouts/PageLayout.tsx @@ -50,7 +50,7 @@ const PageLayout: React.FC = ({ children, name }) => { window.location.host !== 'beta.quickswap.exchange' && window.location.host !== 'dogechain.quickswap.exchange' && window.location.host !== 'localhost:3000' && - window.location.host !== 'testing-orbs.interface-v2-01.pages.dev' + window.location.host !== 'testing-wcv2.interface-v2-01.pages.dev' ) { setOpenPassModal(true); }