From acde2a34908662b533f6340672361713e1a4028d Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 23 Jan 2024 21:20:38 +0530 Subject: [PATCH 01/68] up wagmi and viem version --- packages/nextjs/package.json | 5 +- yarn.lock | 1922 ++++++++++++++++++++++------------ 2 files changed, 1239 insertions(+), 688 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 20a1f1a17..57b2ec0ed 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -17,6 +17,7 @@ "@ethersproject/providers": "^5.7.2", "@heroicons/react": "^2.0.11", "@rainbow-me/rainbowkit": "1.3.0", + "@tanstack/react-query": "^5.17.19", "@uniswap/sdk-core": "^4.0.1", "@uniswap/v2-sdk": "^3.0.1", "blo": "^1.0.1", @@ -30,8 +31,8 @@ "react-hot-toast": "^2.4.0", "use-debounce": "^8.0.4", "usehooks-ts": "^2.7.2", - "viem": "1.19.9", - "wagmi": "1.4.12", + "viem": "^2.5.0", + "wagmi": "^2.5.0", "zustand": "^4.1.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 99be4a237..528c6305c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33,6 +33,16 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.0.0": + version: 7.23.5 + resolution: "@babel/code-frame@npm:7.23.5" + dependencies: + "@babel/highlight": ^7.23.4 + chalk: ^2.4.2 + checksum: d90981fdf56a2824a9b14d19a4c0e8db93633fd488c772624b4e83e0ceac6039a27cd298a247c3214faa952bf803ba23696172ae7e7235f3b97f43ba278c569a + languageName: node + linkType: hard + "@babel/code-frame@npm:^7.16.7, @babel/code-frame@npm:^7.22.13": version: 7.22.13 resolution: "@babel/code-frame@npm:7.22.13" @@ -92,6 +102,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-module-imports@npm:^7.16.7": + version: 7.22.15 + resolution: "@babel/helper-module-imports@npm:7.22.15" + dependencies: + "@babel/types": ^7.22.15 + checksum: ecd7e457df0a46f889228f943ef9b4a47d485d82e030676767e6a2fdcbdaa63594d8124d4b55fd160b41c201025aec01fc27580352b1c87a37c9c6f33d116702 + languageName: node + linkType: hard + "@babel/helper-split-export-declaration@npm:^7.16.7": version: 7.22.6 resolution: "@babel/helper-split-export-declaration@npm:7.22.6" @@ -126,6 +145,17 @@ __metadata: languageName: node linkType: hard +"@babel/highlight@npm:^7.23.4": + version: 7.23.4 + resolution: "@babel/highlight@npm:7.23.4" + dependencies: + "@babel/helper-validator-identifier": ^7.22.20 + chalk: ^2.4.2 + js-tokens: ^4.0.0 + checksum: 643acecdc235f87d925979a979b539a5d7d1f31ae7db8d89047269082694122d11aa85351304c9c978ceeb6d250591ccadb06c366f358ccee08bb9c122476b89 + languageName: node + linkType: hard + "@babel/parser@npm:^7.17.3, @babel/parser@npm:^7.20.5, @babel/parser@npm:^7.22.15": version: 7.23.0 resolution: "@babel/parser@npm:7.23.0" @@ -135,7 +165,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.17.2, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.22.6": +"@babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.20.7": version: 7.23.1 resolution: "@babel/runtime@npm:7.23.1" dependencies: @@ -144,6 +174,15 @@ __metadata: languageName: node linkType: hard +"@babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.6, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.23.2": + version: 7.23.8 + resolution: "@babel/runtime@npm:7.23.8" + dependencies: + regenerator-runtime: ^0.14.0 + checksum: 0bd5543c26811153822a9f382fd39886f66825ff2a397a19008011376533747cd05c33a91f6248c0b8b0edf0448d7c167ebfba34786088f1b7eb11c65be7dfc3 + languageName: node + linkType: hard + "@babel/template@npm:^7.22.15": version: 7.22.15 resolution: "@babel/template@npm:7.22.15" @@ -240,28 +279,20 @@ __metadata: languageName: node linkType: hard -"@coinbase/wallet-sdk@npm:^3.6.6": - version: 3.7.2 - resolution: "@coinbase/wallet-sdk@npm:3.7.2" +"@coinbase/wallet-sdk@npm:3.9.1": + version: 3.9.1 + resolution: "@coinbase/wallet-sdk@npm:3.9.1" dependencies: - "@metamask/safe-event-emitter": 2.0.0 - "@solana/web3.js": ^1.70.1 - bind-decorator: ^1.0.11 - bn.js: ^5.1.1 + bn.js: ^5.2.1 buffer: ^6.0.3 - clsx: ^1.1.0 - eth-block-tracker: 6.1.0 - eth-json-rpc-filters: 5.1.0 - eth-rpc-errors: 4.0.2 - json-rpc-engine: 6.1.0 - keccak: ^3.0.1 - preact: ^10.5.9 - qs: ^6.10.3 - rxjs: ^6.6.3 + clsx: ^1.2.1 + eth-block-tracker: ^7.1.0 + eth-json-rpc-filters: ^6.0.0 + eventemitter3: ^5.0.1 + keccak: ^3.0.3 + preact: ^10.16.0 sha.js: ^2.4.11 - stream-browserify: ^3.0.0 - util: ^0.12.4 - checksum: d42a7b7e443942f657f636eede671979024308c6713af68f774309c04c0e1974cdbfe83514adebf4c0bcdb84adce6a026e5a92b5cff35e08eb1fb0772b1ec7e5 + checksum: 8e6ab9c1fdfe87c703e65e046c62b5d24821b103ae616646dd79b5639a6fef8861e5548a501598bd21d3b6884cd2ed86821b4517c1d3b90574f23f4ca4a459ba languageName: node linkType: hard @@ -313,6 +344,38 @@ __metadata: languageName: node linkType: hard +"@emotion/babel-plugin@npm:^11.11.0": + version: 11.11.0 + resolution: "@emotion/babel-plugin@npm:11.11.0" + dependencies: + "@babel/helper-module-imports": ^7.16.7 + "@babel/runtime": ^7.18.3 + "@emotion/hash": ^0.9.1 + "@emotion/memoize": ^0.8.1 + "@emotion/serialize": ^1.1.2 + babel-plugin-macros: ^3.1.0 + convert-source-map: ^1.5.0 + escape-string-regexp: ^4.0.0 + find-root: ^1.1.0 + source-map: ^0.5.7 + stylis: 4.2.0 + checksum: 6b363edccc10290f7a23242c06f88e451b5feb2ab94152b18bb8883033db5934fb0e421e2d67d09907c13837c21218a3ac28c51707778a54d6cd3706c0c2f3f9 + languageName: node + linkType: hard + +"@emotion/cache@npm:^11.11.0": + version: 11.11.0 + resolution: "@emotion/cache@npm:11.11.0" + dependencies: + "@emotion/memoize": ^0.8.1 + "@emotion/sheet": ^1.2.2 + "@emotion/utils": ^1.2.1 + "@emotion/weak-memoize": ^0.3.1 + stylis: 4.2.0 + checksum: 8eb1dc22beaa20c21a2e04c284d5a2630a018a9d51fb190e52de348c8d27f4e8ca4bbab003d68b4f6cd9cc1c569ca747a997797e0f76d6c734a660dc29decf08 + languageName: node + linkType: hard + "@emotion/hash@npm:^0.8.0": version: 0.8.0 resolution: "@emotion/hash@npm:0.8.0" @@ -320,6 +383,120 @@ __metadata: languageName: node linkType: hard +"@emotion/hash@npm:^0.9.1": + version: 0.9.1 + resolution: "@emotion/hash@npm:0.9.1" + checksum: 716e17e48bf9047bf9383982c071de49f2615310fb4e986738931776f5a823bc1f29c84501abe0d3df91a3803c80122d24e28b57351bca9e01356ebb33d89876 + languageName: node + linkType: hard + +"@emotion/is-prop-valid@npm:^1.2.1": + version: 1.2.1 + resolution: "@emotion/is-prop-valid@npm:1.2.1" + dependencies: + "@emotion/memoize": ^0.8.1 + checksum: 8f42dc573a3fad79b021479becb639b8fe3b60bdd1081a775d32388bca418ee53074c7602a4c845c5f75fa6831eb1cbdc4d208cc0299f57014ed3a02abcad16a + languageName: node + linkType: hard + +"@emotion/memoize@npm:^0.8.1": + version: 0.8.1 + resolution: "@emotion/memoize@npm:0.8.1" + checksum: a19cc01a29fcc97514948eaab4dc34d8272e934466ed87c07f157887406bc318000c69ae6f813a9001c6a225364df04249842a50e692ef7a9873335fbcc141b0 + languageName: node + linkType: hard + +"@emotion/react@npm:^11.10.6": + version: 11.11.3 + resolution: "@emotion/react@npm:11.11.3" + dependencies: + "@babel/runtime": ^7.18.3 + "@emotion/babel-plugin": ^11.11.0 + "@emotion/cache": ^11.11.0 + "@emotion/serialize": ^1.1.3 + "@emotion/use-insertion-effect-with-fallbacks": ^1.0.1 + "@emotion/utils": ^1.2.1 + "@emotion/weak-memoize": ^0.3.1 + hoist-non-react-statics: ^3.3.1 + peerDependencies: + react: ">=16.8.0" + peerDependenciesMeta: + "@types/react": + optional: true + checksum: 2e4b223591569f0a41686d5bd72dc8778629b7be33267e4a09582979e6faee4d7218de84e76294ed827058d4384d75557b5d71724756539c1f235e9a69e62b2e + languageName: node + linkType: hard + +"@emotion/serialize@npm:^1.1.2, @emotion/serialize@npm:^1.1.3": + version: 1.1.3 + resolution: "@emotion/serialize@npm:1.1.3" + dependencies: + "@emotion/hash": ^0.9.1 + "@emotion/memoize": ^0.8.1 + "@emotion/unitless": ^0.8.1 + "@emotion/utils": ^1.2.1 + csstype: ^3.0.2 + checksum: 5a756ce7e2692322683978d8ed2e84eadd60bd6f629618a82c5018c84d98684b117e57fad0174f68ec2ec0ac089bb2e0bcc8ea8c2798eb904b6d3236aa046063 + languageName: node + linkType: hard + +"@emotion/sheet@npm:^1.2.2": + version: 1.2.2 + resolution: "@emotion/sheet@npm:1.2.2" + checksum: d973273c9c15f1c291ca2269728bf044bd3e92a67bca87943fa9ec6c3cd2b034f9a6bfe95ef1b5d983351d128c75b547b43ff196a00a3875f7e1d269793cecfe + languageName: node + linkType: hard + +"@emotion/styled@npm:^11.10.6": + version: 11.11.0 + resolution: "@emotion/styled@npm:11.11.0" + dependencies: + "@babel/runtime": ^7.18.3 + "@emotion/babel-plugin": ^11.11.0 + "@emotion/is-prop-valid": ^1.2.1 + "@emotion/serialize": ^1.1.2 + "@emotion/use-insertion-effect-with-fallbacks": ^1.0.1 + "@emotion/utils": ^1.2.1 + peerDependencies: + "@emotion/react": ^11.0.0-rc.0 + react: ">=16.8.0" + peerDependenciesMeta: + "@types/react": + optional: true + checksum: 904f641aad3892c65d7d6c0808b036dae1e6d6dad4861c1c7dc0baa59977047c6cad220691206eba7b4059f1a1c6e6c1ef4ebb8c829089e280fa0f2164a01e6b + languageName: node + linkType: hard + +"@emotion/unitless@npm:^0.8.1": + version: 0.8.1 + resolution: "@emotion/unitless@npm:0.8.1" + checksum: 385e21d184d27853bb350999471f00e1429fa4e83182f46cd2c164985999d9b46d558dc8b9cc89975cb337831ce50c31ac2f33b15502e85c299892e67e7b4a88 + languageName: node + linkType: hard + +"@emotion/use-insertion-effect-with-fallbacks@npm:^1.0.1": + version: 1.0.1 + resolution: "@emotion/use-insertion-effect-with-fallbacks@npm:1.0.1" + peerDependencies: + react: ">=16.8.0" + checksum: 700b6e5bbb37a9231f203bb3af11295eed01d73b2293abece0bc2a2237015e944d7b5114d4887ad9a79776504aa51ed2a8b0ddbc117c54495dd01a6b22f93786 + languageName: node + linkType: hard + +"@emotion/utils@npm:^1.2.1": + version: 1.2.1 + resolution: "@emotion/utils@npm:1.2.1" + checksum: e0b44be0705b56b079c55faff93952150be69e79b660ae70ddd5b6e09fc40eb1319654315a9f34bb479d7f4ec94be6068c061abbb9e18b9778ae180ad5d97c73 + languageName: node + linkType: hard + +"@emotion/weak-memoize@npm:^0.3.1": + version: 0.3.1 + resolution: "@emotion/weak-memoize@npm:0.3.1" + checksum: b2be47caa24a8122622ea18cd2d650dbb4f8ad37b636dc41ed420c2e082f7f1e564ecdea68122b546df7f305b159bf5ab9ffee872abd0f052e687428459af594 + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" @@ -362,6 +539,16 @@ __metadata: languageName: node linkType: hard +"@ethereumjs/common@npm:^3.2.0": + version: 3.2.0 + resolution: "@ethereumjs/common@npm:3.2.0" + dependencies: + "@ethereumjs/util": ^8.1.0 + crc-32: ^1.2.0 + checksum: cb9cc11f5c868cb577ba611cebf55046e509218bbb89b47ccce010776dafe8256d70f8f43fab238aec74cf71f62601cd5842bc03a83261200802de365732a14b + languageName: node + linkType: hard + "@ethereumjs/rlp@npm:^4.0.1": version: 4.0.1 resolution: "@ethereumjs/rlp@npm:4.0.1" @@ -371,6 +558,18 @@ __metadata: languageName: node linkType: hard +"@ethereumjs/tx@npm:^4.1.2, @ethereumjs/tx@npm:^4.2.0": + version: 4.2.0 + resolution: "@ethereumjs/tx@npm:4.2.0" + dependencies: + "@ethereumjs/common": ^3.2.0 + "@ethereumjs/rlp": ^4.0.1 + "@ethereumjs/util": ^8.1.0 + ethereum-cryptography: ^2.0.0 + checksum: 87a3f5f2452cfbf6712f8847525a80c213210ed453c211c793c5df801fe35ecef28bae17fadd222fcbdd94277478a47e52d2b916a90a6b30cda21f1e0cdaee42 + languageName: node + linkType: hard + "@ethereumjs/util@npm:^8.1.0": version: 8.1.0 resolution: "@ethereumjs/util@npm:8.1.0" @@ -926,6 +1125,17 @@ __metadata: languageName: node linkType: hard +"@metamask/eth-json-rpc-provider@npm:^1.0.0": + version: 1.0.1 + resolution: "@metamask/eth-json-rpc-provider@npm:1.0.1" + dependencies: + "@metamask/json-rpc-engine": ^7.0.0 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^5.0.1 + checksum: ff97648b002d2889bd020c03abc26137cf068df3280e46144b5333c1b294f35f5099361343825f900ef20b9dcb6819495830b7a99eb1cbfbd671e5b11c0dfde1 + languageName: node + linkType: hard + "@metamask/eth-sig-util@npm:^4.0.0": version: 4.0.1 resolution: "@metamask/eth-sig-util@npm:4.0.1" @@ -939,22 +1149,189 @@ __metadata: languageName: node linkType: hard -"@metamask/safe-event-emitter@npm:2.0.0, @metamask/safe-event-emitter@npm:^2.0.0": +"@metamask/json-rpc-engine@npm:^7.0.0": + version: 7.3.1 + resolution: "@metamask/json-rpc-engine@npm:7.3.1" + dependencies: + "@metamask/rpc-errors": ^6.1.0 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^8.2.0 + checksum: 4952eb4e70c0011d334fb4a9bf56aa2d68bef745c892dddd06f6ed7e6303fb95b3b60b4e32c88b6d77bfc5091acc8e71ad274f389419e4bdcc5741ef49cde87d + languageName: node + linkType: hard + +"@metamask/object-multiplex@npm:^1.1.0": + version: 1.3.0 + resolution: "@metamask/object-multiplex@npm:1.3.0" + dependencies: + end-of-stream: ^1.4.4 + once: ^1.4.0 + readable-stream: ^2.3.3 + checksum: 4a2b48fc0e1a8f536edbab9f37b637cd91102538ad76ce07bdfad99b90d98b34585a0e5afa62ca9c1d550a0016347568ff0d635e5bf8cfa266d049e1c0ebedc8 + languageName: node + linkType: hard + +"@metamask/onboarding@npm:^1.0.1": + version: 1.0.1 + resolution: "@metamask/onboarding@npm:1.0.1" + dependencies: + bowser: ^2.9.0 + checksum: c5a6b13760d8c761733fd5edcd3984b2951fb22b34ecebc27104224de7d2582065b8b7edc5b1dafafb76e73a55144d251bc08d540620dde7f1ebfb5f3520b050 + languageName: node + linkType: hard + +"@metamask/post-message-stream@npm:^6.1.0": + version: 6.2.0 + resolution: "@metamask/post-message-stream@npm:6.2.0" + dependencies: + "@metamask/utils": ^5.0.0 + readable-stream: 2.3.3 + checksum: 657cdb2dd61a46a4da7f036a97ef0aa9ad8e918d8f8c0fd620eaede4a32c2ff909738a7dfb2b1e6099e7771fd03c3466b60fedab56e39a5cc5507927758e3cb7 + languageName: node + linkType: hard + +"@metamask/providers@npm:^10.2.1": + version: 10.2.1 + resolution: "@metamask/providers@npm:10.2.1" + dependencies: + "@metamask/object-multiplex": ^1.1.0 + "@metamask/safe-event-emitter": ^2.0.0 + "@types/chrome": ^0.0.136 + detect-browser: ^5.2.0 + eth-rpc-errors: ^4.0.2 + extension-port-stream: ^2.0.1 + fast-deep-equal: ^2.0.1 + is-stream: ^2.0.0 + json-rpc-engine: ^6.1.0 + json-rpc-middleware-stream: ^4.2.1 + pump: ^3.0.0 + webextension-polyfill-ts: ^0.25.0 + checksum: e88b2db8c4673cc6a7e47d9f0531df3fac73f05f8e9ff6d02c3420dfb3c7a82335d9c44876f2d472c44eac36d66491d2022be4f39600bee561d5de8ad59c5b07 + languageName: node + linkType: hard + +"@metamask/rpc-errors@npm:^6.1.0": + version: 6.1.0 + resolution: "@metamask/rpc-errors@npm:6.1.0" + dependencies: + "@metamask/utils": ^8.1.0 + fast-safe-stringify: ^2.0.6 + checksum: 9f4821d804e2fcaa8987b0958d02c6d829b7c7db49740c811cb593f381d0c4b00dabb7f1802907f1b2f6126f7c0d83ec34219183d29650f5d24df014ac72906a + languageName: node + linkType: hard + +"@metamask/safe-event-emitter@npm:^2.0.0": version: 2.0.0 resolution: "@metamask/safe-event-emitter@npm:2.0.0" checksum: 8b717ac5d53df0027c05509f03d0534700b5898dd1c3a53fb2dc4c0499ca5971b14aae67f522d09eb9f509e77f50afa95fdb3eda1afbff8b071c18a3d2905e93 languageName: node linkType: hard -"@metamask/utils@npm:^3.0.1": - version: 3.6.0 - resolution: "@metamask/utils@npm:3.6.0" +"@metamask/safe-event-emitter@npm:^3.0.0": + version: 3.0.0 + resolution: "@metamask/safe-event-emitter@npm:3.0.0" + checksum: 8dc58a76f9f75bf2405931465fc311c68043d851e6b8ebe9f82ae339073a08a83430dba9338f8e3adc4bfc8067607125074bcafa32baee3a5157f42343dc89e5 + languageName: node + linkType: hard + +"@metamask/sdk-communication-layer@npm:0.14.1": + version: 0.14.1 + resolution: "@metamask/sdk-communication-layer@npm:0.14.1" dependencies: + bufferutil: ^4.0.8 + cross-fetch: ^3.1.5 + date-fns: ^2.29.3 + eciesjs: ^0.3.16 + eventemitter2: ^6.4.5 + socket.io-client: ^4.5.1 + utf-8-validate: ^6.0.3 + uuid: ^8.3.2 + checksum: c4c2fee023a8138aa176850b904c793f4e4f4aed4f120f9c61ddf8f89ca603001418c7c0a7d2ff2709ac9a1490df5a32727b6d861d9e2727c6759bb252ac2ce8 + languageName: node + linkType: hard + +"@metamask/sdk-install-modal-web@npm:0.14.1": + version: 0.14.1 + resolution: "@metamask/sdk-install-modal-web@npm:0.14.1" + dependencies: + "@emotion/react": ^11.10.6 + "@emotion/styled": ^11.10.6 + i18next: 22.5.1 + qr-code-styling: ^1.6.0-rc.1 + react: ^18.2.0 + react-dom: ^18.2.0 + react-i18next: ^13.2.2 + checksum: 9122f3d0395514a4a8c2a4da5d805587b4af5d2112c333ea2dd08fa9c2046aea2f0f91bddade05364653b06899b64a849a902d645307e393c557fd878cffd50b + languageName: node + linkType: hard + +"@metamask/sdk@npm:0.14.1": + version: 0.14.1 + resolution: "@metamask/sdk@npm:0.14.1" + dependencies: + "@metamask/onboarding": ^1.0.1 + "@metamask/post-message-stream": ^6.1.0 + "@metamask/providers": ^10.2.1 + "@metamask/sdk-communication-layer": 0.14.1 + "@metamask/sdk-install-modal-web": 0.14.1 + "@react-native-async-storage/async-storage": ^1.17.11 + "@types/dom-screen-wake-lock": ^1.0.0 + bowser: ^2.9.0 + cross-fetch: ^4.0.0 + eciesjs: ^0.3.15 + eth-rpc-errors: ^4.0.3 + eventemitter2: ^6.4.7 + extension-port-stream: ^2.0.1 + i18next: 22.5.1 + i18next-browser-languagedetector: ^7.1.0 + obj-multiplex: ^1.0.0 + pump: ^3.0.0 + qrcode-terminal-nooctal: ^0.12.1 + react-i18next: ^13.2.2 + react-native-webview: ^11.26.0 + readable-stream: ^2.3.7 + rollup-plugin-visualizer: ^5.9.2 + socket.io-client: ^4.5.1 + util: ^0.12.4 + uuid: ^8.3.2 + peerDependencies: + react: ^18.2.0 + react-native: "*" + peerDependenciesMeta: + react: + optional: true + react-native: + optional: true + checksum: e18024828ee7e3f4009640fcb928981c39f5783e6165827fe7d5b79999d66a05841413cc9f4b0dd164c9add5a479003a3e283337f4a6cbf7c6d9c68a07eea2ee + languageName: node + linkType: hard + +"@metamask/utils@npm:^5.0.0, @metamask/utils@npm:^5.0.1": + version: 5.0.2 + resolution: "@metamask/utils@npm:5.0.2" + dependencies: + "@ethereumjs/tx": ^4.1.2 "@types/debug": ^4.1.7 debug: ^4.3.4 semver: ^7.3.8 superstruct: ^1.0.3 - checksum: 1ebc6677bb017e4d09d4af143621fe27194d8ed815234cfd76469c3c734dc1db2ea7b577c01a2096c21c04d8c9c4d721d3035b5353fe2ded3b4737f326755e43 + checksum: eca82e42911b2840deb4f32f0f215c5ffd14d22d68afbbe92d3180e920e509e310777b15eab29def3448f3535b66596ceb4c23666ec846adacc8e1bb093ff882 + languageName: node + linkType: hard + +"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0": + version: 8.3.0 + resolution: "@metamask/utils@npm:8.3.0" + dependencies: + "@ethereumjs/tx": ^4.2.0 + "@noble/hashes": ^1.3.1 + "@scure/base": ^1.1.3 + "@types/debug": ^4.1.7 + debug: ^4.3.4 + pony-cause: ^2.1.10 + semver: ^7.5.4 + superstruct: ^1.0.3 + checksum: cd60c49b4c0397fb31e6b38937a0d9346cbb8337cb8add59db8db0e0e2156fb063ff4df93a26410157f0cc02aa9a9b785fc1b53cfc4ab73204462893ed11cacb languageName: node linkType: hard @@ -1131,7 +1508,7 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.2.0, @noble/curves@npm:^1.0.0, @noble/curves@npm:~1.2.0": +"@noble/curves@npm:1.2.0, @noble/curves@npm:~1.2.0": version: 1.2.0 resolution: "@noble/curves@npm:1.2.0" dependencies: @@ -1711,6 +2088,17 @@ __metadata: languageName: node linkType: hard +"@react-native-async-storage/async-storage@npm:^1.17.11": + version: 1.21.0 + resolution: "@react-native-async-storage/async-storage@npm:1.21.0" + dependencies: + merge-options: ^3.0.4 + peerDependencies: + react-native: ^0.0.0-0 || >=0.60 <1.0 + checksum: 969cdeb444a037087b1897553082e148e25c8331055dd0dc142f76deeb4aadd9ed5ec26926ae990b3e9ff088396e74ab557148a2dd2a7db86058051b774f2619 + languageName: node + linkType: hard + "@rollup/pluginutils@npm:^4.0.0": version: 4.2.1 resolution: "@rollup/pluginutils@npm:4.2.1" @@ -1728,7 +2116,7 @@ __metadata: languageName: node linkType: hard -"@safe-global/safe-apps-provider@npm:^0.18.1": +"@safe-global/safe-apps-provider@npm:0.18.1": version: 0.18.1 resolution: "@safe-global/safe-apps-provider@npm:0.18.1" dependencies: @@ -1738,7 +2126,7 @@ __metadata: languageName: node linkType: hard -"@safe-global/safe-apps-sdk@npm:^8.1.0": +"@safe-global/safe-apps-sdk@npm:8.1.0, @safe-global/safe-apps-sdk@npm:^8.1.0": version: 8.1.0 resolution: "@safe-global/safe-apps-sdk@npm:8.1.0" dependencies: @@ -1755,6 +2143,13 @@ __metadata: languageName: node linkType: hard +"@scure/base@npm:^1.1.3": + version: 1.1.5 + resolution: "@scure/base@npm:1.1.5" + checksum: 9e9ee6088cb3aa0fb91f5a48497d26682c7829df3019b1251d088d166d7a8c0f941c68aaa8e7b96bbad20c71eb210397cb1099062cde3e29d4bad6b975c18519 + languageName: node + linkType: hard + "@scure/base@npm:~1.1.0, @scure/base@npm:~1.1.2": version: 1.1.3 resolution: "@scure/base@npm:1.1.3" @@ -1862,6 +2257,7 @@ __metadata: "@ethersproject/providers": ^5.7.2 "@heroicons/react": ^2.0.11 "@rainbow-me/rainbowkit": 1.3.0 + "@tanstack/react-query": ^5.17.19 "@trivago/prettier-plugin-sort-imports": ^4.1.1 "@types/node": ^17.0.35 "@types/nprogress": ^0 @@ -1892,8 +2288,8 @@ __metadata: use-debounce: ^8.0.4 usehooks-ts: ^2.7.2 vercel: ^32.4.1 - viem: 1.19.9 - wagmi: 1.4.12 + viem: ^2.5.0 + wagmi: ^2.5.0 zustand: ^4.1.2 languageName: unknown linkType: soft @@ -1987,35 +2383,10 @@ __metadata: languageName: node linkType: hard -"@solana/buffer-layout@npm:^4.0.0": - version: 4.0.1 - resolution: "@solana/buffer-layout@npm:4.0.1" - dependencies: - buffer: ~6.0.3 - checksum: bf846888e813187243d4008a7a9f58b49d16cbd995b9d7f1b72898aa510ed77b1ce5e8468e7b2fd26dd81e557a4e74a666e21fccb95f123c1f740d41138bbacd - languageName: node - linkType: hard - -"@solana/web3.js@npm:^1.70.1": - version: 1.78.5 - resolution: "@solana/web3.js@npm:1.78.5" - dependencies: - "@babel/runtime": ^7.22.6 - "@noble/curves": ^1.0.0 - "@noble/hashes": ^1.3.1 - "@solana/buffer-layout": ^4.0.0 - agentkeepalive: ^4.3.0 - bigint-buffer: ^1.1.5 - bn.js: ^5.2.1 - borsh: ^0.7.0 - bs58: ^4.0.1 - buffer: 6.0.3 - fast-stable-stringify: ^1.0.0 - jayson: ^4.1.0 - node-fetch: ^2.6.12 - rpc-websockets: ^7.5.1 - superstruct: ^0.14.2 - checksum: 66fe4ddcc073d0c539e23a2aae3ba23c081a11f5ebc8216dd18e0c6770f20e419c635a50529faa59baeec9722cd521a3502abc7cdf3b3d5f31b32066e0415c24 +"@socket.io/component-emitter@npm:~3.1.0": + version: 3.1.0 + resolution: "@socket.io/component-emitter@npm:3.1.0" + checksum: db069d95425b419de1514dffe945cc439795f6a8ef5b9465715acf5b8b50798e2c91b8719cbf5434b3fe7de179d6cdcd503c277b7871cb3dd03febb69bdd50fa languageName: node linkType: hard @@ -2216,58 +2587,21 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:4.35.3": - version: 4.35.3 - resolution: "@tanstack/query-core@npm:4.35.3" - checksum: 0184cd19a26c4f96d05bbebd7966866741d46e5be19ac99d8cd6e5bbeb6550f257e7b52b674fb2673190696e113dd601422d196bf4870b58b4d2e2edf4307e92 - languageName: node - linkType: hard - -"@tanstack/query-persist-client-core@npm:4.35.3": - version: 4.35.3 - resolution: "@tanstack/query-persist-client-core@npm:4.35.3" - dependencies: - "@tanstack/query-core": 4.35.3 - checksum: c48f33936216e0ddbeb7fb0ed4242bb24a4086f4d719547a0f12461293a039b6fc9586056f5d3d8894c2043a014a614f155af8705f539edea633f7403ff7f5b6 - languageName: node - linkType: hard - -"@tanstack/query-sync-storage-persister@npm:^4.27.1": - version: 4.35.3 - resolution: "@tanstack/query-sync-storage-persister@npm:4.35.3" - dependencies: - "@tanstack/query-persist-client-core": 4.35.3 - checksum: 17865d295d6f7092642adf8282174c059ae459226f84ccf90c4de9d0f7e1116e1db8da7e0ad2e9ebd9acba90057b673703bf4cc22bbf3813bc4bdccdfb3b6973 - languageName: node - linkType: hard - -"@tanstack/react-query-persist-client@npm:^4.28.0": - version: 4.35.5 - resolution: "@tanstack/react-query-persist-client@npm:4.35.5" - dependencies: - "@tanstack/query-persist-client-core": 4.35.3 - peerDependencies: - "@tanstack/react-query": ^4.35.3 - checksum: ed26363815527f44893ea7fba5b57dcc605ee9d59cc444d691211029596aec131f14aad9a03915ad6380402835c5a1fc06ca38209fbd7498b24d543fa4fd8f45 +"@tanstack/query-core@npm:5.17.19": + version: 5.17.19 + resolution: "@tanstack/query-core@npm:5.17.19" + checksum: ad09f1d64a169f8427225020b8b68328d64d1e671af28d47c33df31302106a05af4ed61587642704f70e1fe3861a8f00ea1722685a128dc6ee60fdf34b8dcc57 languageName: node linkType: hard -"@tanstack/react-query@npm:^4.28.0": - version: 4.35.3 - resolution: "@tanstack/react-query@npm:4.35.3" +"@tanstack/react-query@npm:^5.17.19": + version: 5.17.19 + resolution: "@tanstack/react-query@npm:5.17.19" dependencies: - "@tanstack/query-core": 4.35.3 - use-sync-external-store: ^1.2.0 + "@tanstack/query-core": 5.17.19 peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-native: "*" - peerDependenciesMeta: - react-dom: - optional: true - react-native: - optional: true - checksum: 4d7e4e6a8466095848d2924fdbcd2d22a36b53e2d0f79a7dec121c8d7af36ff857b1bae5a7b802f3a399922c9c9f38f2a06372b1fc7b1d5de960e78fa1d3d722 + react: ^18.0.0 + checksum: ceb98f42cb45c4e2086dbcf608c9488adc26dceebbf933c6ab59b896c3c8ae658622b213495140a19ac038458dbf3a484f033ffab9e1dcde7a77341d1b02bf23 languageName: node linkType: hard @@ -2416,21 +2750,22 @@ __metadata: languageName: node linkType: hard -"@types/concat-stream@npm:^1.6.0": - version: 1.6.1 - resolution: "@types/concat-stream@npm:1.6.1" +"@types/chrome@npm:^0.0.136": + version: 0.0.136 + resolution: "@types/chrome@npm:0.0.136" dependencies: - "@types/node": "*" - checksum: 7d211e74331affd3578b5469244f5cef84a93775f38332adb3ef12413559a23862bc682c6873d0a404b01c9d5d5f7d3ae091fe835b435b633eb420e3055b3e56 + "@types/filesystem": "*" + "@types/har-format": "*" + checksum: af96fdc79fb019d827fdb6269f831921f8f36215ee05a2624436dd2ad4d84d7be12333cc6f54912fb8bae0ca49cbfde5a78de94723bfbd20d309d2e71e274a1b languageName: node linkType: hard -"@types/connect@npm:^3.4.33": - version: 3.4.36 - resolution: "@types/connect@npm:3.4.36" +"@types/concat-stream@npm:^1.6.0": + version: 1.6.1 + resolution: "@types/concat-stream@npm:1.6.1" dependencies: "@types/node": "*" - checksum: 4dee3d966fb527b98f0cbbdcf6977c9193fc3204ed539b7522fe5e64dfa45f9017bdda4ffb1f760062262fce7701a0ee1c2f6ce2e50af36c74d4e37052303172 + checksum: 7d211e74331affd3578b5469244f5cef84a93775f38332adb3ef12413559a23862bc682c6873d0a404b01c9d5d5f7d3ae091fe835b435b633eb420e3055b3e56 languageName: node linkType: hard @@ -2443,6 +2778,13 @@ __metadata: languageName: node linkType: hard +"@types/dom-screen-wake-lock@npm:^1.0.0": + version: 1.0.3 + resolution: "@types/dom-screen-wake-lock@npm:1.0.3" + checksum: 66bece3508b4f4147db97a530c758f8f5d3132ef00c06cab1db4bf2b4af6a3a614ae0a0ba6b53ddc4177a6545adf9d312547087256efc8eff7314b13221380b8 + languageName: node + linkType: hard + "@types/eslint@npm:^8": version: 8.44.3 resolution: "@types/eslint@npm:8.44.3" @@ -2460,6 +2802,22 @@ __metadata: languageName: node linkType: hard +"@types/filesystem@npm:*": + version: 0.0.35 + resolution: "@types/filesystem@npm:0.0.35" + dependencies: + "@types/filewriter": "*" + checksum: 42548874e3ca6479ee593c2a8ac2b4cc2e9ede1cff14e0fc12c89379dfb3de057e5aa5fe2e826221020f3e0190ce273026112e7dec94bc098a4a9cb656bbc156 + languageName: node + linkType: hard + +"@types/filewriter@npm:*": + version: 0.0.32 + resolution: "@types/filewriter@npm:0.0.32" + checksum: b131eb02cd3dd3bc08a1f94b8457c6c5a113ff0f08404c72da1922ef43689466da650bb82140d6982e4629972da679b117ab97865892d9bca7451edb11849483 + languageName: node + linkType: hard + "@types/form-data@npm:0.0.33": version: 0.0.33 resolution: "@types/form-data@npm:0.0.33" @@ -2479,6 +2837,13 @@ __metadata: languageName: node linkType: hard +"@types/har-format@npm:*": + version: 1.2.15 + resolution: "@types/har-format@npm:1.2.15" + checksum: e3e8197e0ac74747736d13e0b54ec862e55ecf57cc962e1a24c801c7940b7b829d281dddc67f297877f1c4bc014b4ac29d35b2c6a9a1e6bc26bcff5fd7f835b0 + languageName: node + linkType: hard + "@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.6, @types/json-schema@npm:^7.0.9": version: 7.0.13 resolution: "@types/json-schema@npm:7.0.13" @@ -2549,13 +2914,6 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^12.12.54": - version: 12.20.55 - resolution: "@types/node@npm:12.20.55" - checksum: e4f86785f4092706e0d3b0edff8dca5a13b45627e4b36700acd8dfe6ad53db71928c8dee914d4276c7fd3b6ccd829aa919811c9eb708a2c8e4c6eb3701178c37 - languageName: node - linkType: hard - "@types/node@npm:^17.0.35": version: 17.0.45 resolution: "@types/node@npm:17.0.45" @@ -2577,6 +2935,13 @@ __metadata: languageName: node linkType: hard +"@types/parse-json@npm:^4.0.0": + version: 4.0.2 + resolution: "@types/parse-json@npm:4.0.2" + checksum: 5bf62eec37c332ad10059252fc0dab7e7da730764869c980b0714777ad3d065e490627be9f40fc52f238ffa3ac4199b19de4127196910576c2fe34dd47c7a470 + languageName: node + linkType: hard + "@types/pbkdf2@npm:^3.0.0": version: 3.1.0 resolution: "@types/pbkdf2@npm:3.1.0" @@ -2662,6 +3027,15 @@ __metadata: languageName: node linkType: hard +"@types/secp256k1@npm:^4.0.4": + version: 4.0.6 + resolution: "@types/secp256k1@npm:4.0.6" + dependencies: + "@types/node": "*" + checksum: 984494caf49a4ce99fda2b9ea1840eb47af946b8c2737314108949bcc0c06b4880e871296bd49ed6ea4c8423e3a302ad79fec43abfc987330e7eb98f0c4e8ba4 + languageName: node + linkType: hard + "@types/semver@npm:^7.3.12, @types/semver@npm:^7.5.0": version: 7.5.3 resolution: "@types/semver@npm:7.5.3" @@ -2676,15 +3050,6 @@ __metadata: languageName: node linkType: hard -"@types/ws@npm:^7.4.4": - version: 7.4.7 - resolution: "@types/ws@npm:7.4.7" - dependencies: - "@types/node": "*" - checksum: b4c9b8ad209620c9b21e78314ce4ff07515c0cadab9af101c1651e7bfb992d7fd933bd8b9c99d110738fd6db523ed15f82f29f50b45510288da72e964dedb1a3 - languageName: node - linkType: hard - "@types/ws@npm:^8.5.5": version: 8.5.6 resolution: "@types/ws@npm:8.5.6" @@ -3202,50 +3567,50 @@ __metadata: languageName: node linkType: hard -"@wagmi/connectors@npm:3.1.10": - version: 3.1.10 - resolution: "@wagmi/connectors@npm:3.1.10" +"@wagmi/connectors@npm:4.1.8": + version: 4.1.8 + resolution: "@wagmi/connectors@npm:4.1.8" dependencies: - "@coinbase/wallet-sdk": ^3.6.6 - "@safe-global/safe-apps-provider": ^0.18.1 - "@safe-global/safe-apps-sdk": ^8.1.0 - "@walletconnect/ethereum-provider": 2.10.6 - "@walletconnect/legacy-provider": ^2.0.0 + "@coinbase/wallet-sdk": 3.9.1 + "@metamask/sdk": 0.14.1 + "@safe-global/safe-apps-provider": 0.18.1 + "@safe-global/safe-apps-sdk": 8.1.0 + "@walletconnect/ethereum-provider": 2.11.0 "@walletconnect/modal": 2.6.2 - "@walletconnect/utils": 2.10.2 - abitype: 0.8.7 - eventemitter3: ^4.0.7 peerDependencies: + "@wagmi/core": 2.5.0 typescript: ">=5.0.4" - viem: ">=0.3.35" + viem: 2.x peerDependenciesMeta: typescript: optional: true - checksum: 65eeb30881fbbf018ec842eb156f4119090c804450f55de60d95c92b124d86b5a769cdc02f4db0bc04ae481b678375d6061d67a86b14b30b62527c202a688574 + checksum: 11f53d626b475061a9875436d38000b6c46081f3f3b94f247d50e95ddd0b2669f3acea413e4e03685d4a7c82356ba59146b7b6021c8d59fb638c4a98972857f4 languageName: node linkType: hard -"@wagmi/core@npm:1.4.12": - version: 1.4.12 - resolution: "@wagmi/core@npm:1.4.12" +"@wagmi/core@npm:2.5.0": + version: 2.5.0 + resolution: "@wagmi/core@npm:2.5.0" dependencies: - "@wagmi/connectors": 3.1.10 - abitype: 0.8.7 - eventemitter3: ^4.0.7 - zustand: ^4.3.1 + eventemitter3: 5.0.1 + mipd: 0.0.5 + zustand: 4.4.1 peerDependencies: + "@tanstack/query-core": ">=5.0.0" typescript: ">=5.0.4" - viem: ">=0.3.35" + viem: 2.x peerDependenciesMeta: + "@tanstack/query-core": + optional: true typescript: optional: true - checksum: 4f1e7c532e7f8a984c6918328a6690543cf77d224f0e1119a7eba4e3495da466d7a2c64718922bc5e3741cabf17c20ff0de2600531ea3f9bd07ba4b27067d68b + checksum: 15023af8a7ef400d624287be85465cba9b4d9fb4769464c19fd63a0823631480d78ad2962c33375c15458c697671110538ecef70283f44c972e1639a03709b03 languageName: node linkType: hard -"@walletconnect/core@npm:2.10.6": - version: 2.10.6 - resolution: "@walletconnect/core@npm:2.10.6" +"@walletconnect/core@npm:2.11.0": + version: 2.11.0 + resolution: "@walletconnect/core@npm:2.11.0" dependencies: "@walletconnect/heartbeat": 1.2.1 "@walletconnect/jsonrpc-provider": 1.0.13 @@ -3258,37 +3623,13 @@ __metadata: "@walletconnect/relay-auth": ^1.0.4 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.10.6 - "@walletconnect/utils": 2.10.6 + "@walletconnect/types": 2.11.0 + "@walletconnect/utils": 2.11.0 events: ^3.3.0 + isomorphic-unfetch: 3.1.0 lodash.isequal: 4.5.0 uint8arrays: ^3.1.0 - checksum: 7ed74d0feaf4f4b332da2e82932340e6897e26910ae66c111e8724f41b15f14376fd9fd4b93ba9395107d24d2147932ef29bd7b7edce1bbde89e4258e8b2f574 - languageName: node - linkType: hard - -"@walletconnect/crypto@npm:^1.0.3": - version: 1.0.3 - resolution: "@walletconnect/crypto@npm:1.0.3" - dependencies: - "@walletconnect/encoding": ^1.0.2 - "@walletconnect/environment": ^1.0.1 - "@walletconnect/randombytes": ^1.0.3 - aes-js: ^3.1.2 - hash.js: ^1.1.7 - tslib: 1.14.1 - checksum: 056c80451178d74be6237f24e53eb96951379ad2f556642b4f07231a9cac53512af182dfb58ee359d1d6803231030de747eb17b35a9a25577e20de3ef2d8fdec - languageName: node - linkType: hard - -"@walletconnect/encoding@npm:^1.0.2": - version: 1.0.2 - resolution: "@walletconnect/encoding@npm:1.0.2" - dependencies: - is-typedarray: 1.0.0 - tslib: 1.14.1 - typedarray-to-buffer: 3.1.5 - checksum: 648029d6a04e0e3675e1220b87c982e5d69764873e30a45a7c57f18223cd7c13e6758138d4644fd05d8fa03bd438fafb0a0ebc6ae168ed6f4a9bf1f93de1b82f + checksum: 419eff78df347eb5d5c51c2dbf60e3246b5dda00afdd77279795a89627285839cb769e1115e751026756d37e26e6bd708452170ded08be074d64256afd8a8663 languageName: node linkType: hard @@ -3301,21 +3642,21 @@ __metadata: languageName: node linkType: hard -"@walletconnect/ethereum-provider@npm:2.10.6": - version: 2.10.6 - resolution: "@walletconnect/ethereum-provider@npm:2.10.6" +"@walletconnect/ethereum-provider@npm:2.11.0": + version: 2.11.0 + resolution: "@walletconnect/ethereum-provider@npm:2.11.0" 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/modal": ^2.4.3 - "@walletconnect/sign-client": 2.10.6 - "@walletconnect/types": 2.10.6 - "@walletconnect/universal-provider": 2.10.6 - "@walletconnect/utils": 2.10.6 + "@walletconnect/modal": ^2.6.2 + "@walletconnect/sign-client": 2.11.0 + "@walletconnect/types": 2.11.0 + "@walletconnect/universal-provider": 2.11.0 + "@walletconnect/utils": 2.11.0 events: ^3.3.0 - checksum: 02452044400ef751358598aada659ce77ae69495f3b01f040a6888289d74d22a03c1736a4860a9e1157bc0211bbcde1e3b0eb01d4ff209c2bf14efe7172774c9 + checksum: 8b45eb7e6679d340e6d976c6c10b10b4ce0435b959d35b627677d946b9f152f20fc242e581a16e9b6f7ed98c5352748213856e342f55f3dbd4cd9130965d542c languageName: node linkType: hard @@ -3340,7 +3681,7 @@ __metadata: languageName: node linkType: hard -"@walletconnect/jsonrpc-http-connection@npm:^1.0.4, @walletconnect/jsonrpc-http-connection@npm:^1.0.7": +"@walletconnect/jsonrpc-http-connection@npm:^1.0.7": version: 1.0.7 resolution: "@walletconnect/jsonrpc-http-connection@npm:1.0.7" dependencies: @@ -3352,7 +3693,7 @@ __metadata: languageName: node linkType: hard -"@walletconnect/jsonrpc-provider@npm:1.0.13, @walletconnect/jsonrpc-provider@npm:^1.0.13, @walletconnect/jsonrpc-provider@npm:^1.0.6": +"@walletconnect/jsonrpc-provider@npm:1.0.13, @walletconnect/jsonrpc-provider@npm:^1.0.13": version: 1.0.13 resolution: "@walletconnect/jsonrpc-provider@npm:1.0.13" dependencies: @@ -3373,7 +3714,7 @@ __metadata: languageName: node linkType: hard -"@walletconnect/jsonrpc-utils@npm:1.0.8, @walletconnect/jsonrpc-utils@npm:^1.0.4, @walletconnect/jsonrpc-utils@npm:^1.0.6, @walletconnect/jsonrpc-utils@npm:^1.0.7, @walletconnect/jsonrpc-utils@npm:^1.0.8": +"@walletconnect/jsonrpc-utils@npm:1.0.8, @walletconnect/jsonrpc-utils@npm:^1.0.6, @walletconnect/jsonrpc-utils@npm:^1.0.7, @walletconnect/jsonrpc-utils@npm:^1.0.8": version: 1.0.8 resolution: "@walletconnect/jsonrpc-utils@npm:1.0.8" dependencies: @@ -3386,117 +3727,29 @@ __metadata: "@walletconnect/jsonrpc-ws-connection@npm:1.0.14": version: 1.0.14 - resolution: "@walletconnect/jsonrpc-ws-connection@npm:1.0.14" - dependencies: - "@walletconnect/jsonrpc-utils": ^1.0.6 - "@walletconnect/safe-json": ^1.0.2 - events: ^3.3.0 - ws: ^7.5.1 - checksum: a401e60b19390098183ef1b2a7b3e15c4dd3c64f9ac87fd2bbc0ae1f7fb31539ba542374ca021193efc4a2ae59fa3b04e588aed98cdf5c364f50524403d50f9f - languageName: node - linkType: hard - -"@walletconnect/keyvaluestorage@npm:^1.0.2": - version: 1.0.2 - resolution: "@walletconnect/keyvaluestorage@npm:1.0.2" - dependencies: - safe-json-utils: ^1.1.1 - tslib: 1.14.1 - peerDependencies: - "@react-native-async-storage/async-storage": 1.x - lokijs: 1.x - peerDependenciesMeta: - "@react-native-async-storage/async-storage": - optional: true - lokijs: - optional: true - checksum: d695c2efcfa013a43cfaa20c85281df7d364a4452d11a4312a695298bd0e50d04b0e21c828f33f46fb020ea9796e60a6b23041a85f29bd10beeba7d0da24539f - languageName: node - linkType: hard - -"@walletconnect/keyvaluestorage@npm:^1.1.1": - version: 1.1.1 - resolution: "@walletconnect/keyvaluestorage@npm:1.1.1" - dependencies: - "@walletconnect/safe-json": ^1.0.1 - idb-keyval: ^6.2.1 - unstorage: ^1.9.0 - peerDependencies: - "@react-native-async-storage/async-storage": 1.x - peerDependenciesMeta: - "@react-native-async-storage/async-storage": - optional: true - checksum: 7f85cb83963153417745367742070ccb78e03bd62adb549de57a7d5fae7bcfbd9a8f42b2f445ca76a3817ffacacc69d85bbf67757c3616ee7b3525f2f8a0faea - languageName: node - linkType: hard - -"@walletconnect/legacy-client@npm:^2.0.0": - version: 2.0.0 - resolution: "@walletconnect/legacy-client@npm:2.0.0" - dependencies: - "@walletconnect/crypto": ^1.0.3 - "@walletconnect/encoding": ^1.0.2 - "@walletconnect/jsonrpc-utils": ^1.0.4 - "@walletconnect/legacy-types": ^2.0.0 - "@walletconnect/legacy-utils": ^2.0.0 - "@walletconnect/safe-json": ^1.0.1 - "@walletconnect/window-getters": ^1.0.1 - "@walletconnect/window-metadata": ^1.0.1 - detect-browser: ^5.3.0 - query-string: ^6.13.5 - checksum: 57de9e373b24766e937734989080eb6d476e40d5406d4f817c989b278f25a09aa8636dfbe34a33f4de80ef90aea9641fdb7841007ecdba8e5ad47cd11614ee94 - languageName: node - linkType: hard - -"@walletconnect/legacy-modal@npm:^2.0.0": - version: 2.0.0 - resolution: "@walletconnect/legacy-modal@npm:2.0.0" - dependencies: - "@walletconnect/legacy-types": ^2.0.0 - "@walletconnect/legacy-utils": ^2.0.0 - copy-to-clipboard: ^3.3.3 - preact: ^10.12.0 - qrcode: ^1.5.1 - checksum: 897a02c9f4129a8f0b8e37832bf49a408e7e6f2828e78bea90c3718471cb57558f5522dd69c19456b5cc54a4aa04a4f7942f262ad9b031d318a5498ca0ca4078 - languageName: node - linkType: hard - -"@walletconnect/legacy-provider@npm:^2.0.0": - version: 2.0.0 - resolution: "@walletconnect/legacy-provider@npm:2.0.0" - dependencies: - "@walletconnect/jsonrpc-http-connection": ^1.0.4 - "@walletconnect/jsonrpc-provider": ^1.0.6 - "@walletconnect/legacy-client": ^2.0.0 - "@walletconnect/legacy-modal": ^2.0.0 - "@walletconnect/legacy-types": ^2.0.0 - "@walletconnect/legacy-utils": ^2.0.0 - checksum: 48adf2d938d3580be1dbaa4c7005cdf715896a56d3f4ab500c301cd5b442343c7df11bfccbc8e32bf9a7ba4b9a379208846ad848d79b1b6b511c1c4121fc83cf - languageName: node - linkType: hard - -"@walletconnect/legacy-types@npm:^2.0.0": - version: 2.0.0 - resolution: "@walletconnect/legacy-types@npm:2.0.0" + resolution: "@walletconnect/jsonrpc-ws-connection@npm:1.0.14" dependencies: - "@walletconnect/jsonrpc-types": ^1.0.2 - checksum: 358d789f8a50e689edcfd8eb668fcdf8e1f03ab08757b12fad0e658ce7ef62268f8022502b476bce69e5165aa4454c4ad1ea41f17244ab8d0fcd9026bd94707c + "@walletconnect/jsonrpc-utils": ^1.0.6 + "@walletconnect/safe-json": ^1.0.2 + events: ^3.3.0 + ws: ^7.5.1 + checksum: a401e60b19390098183ef1b2a7b3e15c4dd3c64f9ac87fd2bbc0ae1f7fb31539ba542374ca021193efc4a2ae59fa3b04e588aed98cdf5c364f50524403d50f9f languageName: node linkType: hard -"@walletconnect/legacy-utils@npm:^2.0.0": - version: 2.0.0 - resolution: "@walletconnect/legacy-utils@npm:2.0.0" +"@walletconnect/keyvaluestorage@npm:^1.1.1": + version: 1.1.1 + resolution: "@walletconnect/keyvaluestorage@npm:1.1.1" dependencies: - "@walletconnect/encoding": ^1.0.2 - "@walletconnect/jsonrpc-utils": ^1.0.4 - "@walletconnect/legacy-types": ^2.0.0 "@walletconnect/safe-json": ^1.0.1 - "@walletconnect/window-getters": ^1.0.1 - "@walletconnect/window-metadata": ^1.0.1 - detect-browser: ^5.3.0 - query-string: ^6.13.5 - checksum: ea90e98c2f2f0a7f1d8801f7284bae909952979413b5d8e339004948199a2777af025195442a3c78a27aa3c16bb546ef54bf9c592e5622e1f003bef6d4b355ca + idb-keyval: ^6.2.1 + unstorage: ^1.9.0 + peerDependencies: + "@react-native-async-storage/async-storage": 1.x + peerDependenciesMeta: + "@react-native-async-storage/async-storage": + optional: true + checksum: 7f85cb83963153417745367742070ccb78e03bd62adb549de57a7d5fae7bcfbd9a8f42b2f445ca76a3817ffacacc69d85bbf67757c3616ee7b3525f2f8a0faea languageName: node linkType: hard @@ -3531,7 +3784,7 @@ __metadata: languageName: node linkType: hard -"@walletconnect/modal@npm:2.6.2, @walletconnect/modal@npm:^2.4.3": +"@walletconnect/modal@npm:2.6.2, @walletconnect/modal@npm:^2.6.2": version: 2.6.2 resolution: "@walletconnect/modal@npm:2.6.2" dependencies: @@ -3541,18 +3794,6 @@ __metadata: languageName: node linkType: hard -"@walletconnect/randombytes@npm:^1.0.3": - version: 1.0.3 - resolution: "@walletconnect/randombytes@npm:1.0.3" - dependencies: - "@walletconnect/encoding": ^1.0.2 - "@walletconnect/environment": ^1.0.1 - randombytes: ^2.1.0 - tslib: 1.14.1 - checksum: 3ba1d5906299256c64affcd03348ec1397e2fadb1e60baaa13d4f46ba0267580fc354e67839d3fa4faa8abb375723f7ab96334b4e842f5814ce2080ed15f3578 - languageName: node - linkType: hard - "@walletconnect/relay-api@npm:^1.0.9": version: 1.0.9 resolution: "@walletconnect/relay-api@npm:1.0.9" @@ -3586,20 +3827,20 @@ __metadata: languageName: node linkType: hard -"@walletconnect/sign-client@npm:2.10.6": - version: 2.10.6 - resolution: "@walletconnect/sign-client@npm:2.10.6" +"@walletconnect/sign-client@npm:2.11.0": + version: 2.11.0 + resolution: "@walletconnect/sign-client@npm:2.11.0" dependencies: - "@walletconnect/core": 2.10.6 + "@walletconnect/core": 2.11.0 "@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.10.6 - "@walletconnect/utils": 2.10.6 + "@walletconnect/types": 2.11.0 + "@walletconnect/utils": 2.11.0 events: ^3.3.0 - checksum: 610dd354d53159eb26ec61d3399507ba63739d9070a458b3a791a944d8b62d9b55d487d3d41c68aa9af0052fc04daea0a05a2f5d664c6ff21cb89e0909a1323b + checksum: 89230cf4ca95f9feb06104cc8097340e345b2b21257d45acf16729342ddcf5248bbf05097343b21e4dbebfa4fbacb6fe067099ee6127169a6b464563985d4716 languageName: node linkType: hard @@ -3612,23 +3853,9 @@ __metadata: languageName: node linkType: hard -"@walletconnect/types@npm:2.10.2": - version: 2.10.2 - resolution: "@walletconnect/types@npm:2.10.2" - dependencies: - "@walletconnect/events": ^1.0.1 - "@walletconnect/heartbeat": 1.2.1 - "@walletconnect/jsonrpc-types": 1.0.3 - "@walletconnect/keyvaluestorage": ^1.0.2 - "@walletconnect/logger": ^2.0.1 - events: ^3.3.0 - checksum: dafcb840b2b93343db56ca6684edfe8a20d9b2f703f81b2d1fdbea558fe41de9fbddec12c24e9d51a50c75ee6298a1cfd347d7fa0202146033788670371cfd6a - languageName: node - linkType: hard - -"@walletconnect/types@npm:2.10.6": - version: 2.10.6 - resolution: "@walletconnect/types@npm:2.10.6" +"@walletconnect/types@npm:2.11.0": + version: 2.11.0 + resolution: "@walletconnect/types@npm:2.11.0" dependencies: "@walletconnect/events": ^1.0.1 "@walletconnect/heartbeat": 1.2.1 @@ -3636,52 +3863,30 @@ __metadata: "@walletconnect/keyvaluestorage": ^1.1.1 "@walletconnect/logger": ^2.0.1 events: ^3.3.0 - checksum: 84f411fd41debc310b4aae4969e5a78074f1f8cc937c4f1a6f92fa80775dd88bb400b365533396fc9325109a3c5dc4c4951615f2e265b5f82e9f454b17b96d5e + checksum: 32d0d7972b90683467e47eabf92005c7c5d1ae76400eb221576ac0d32501b9f0a414d5921f0c881efe86f07485db807e3e9d370c6b9cc264771822916dc4cca5 languageName: node linkType: hard -"@walletconnect/universal-provider@npm:2.10.6": - version: 2.10.6 - resolution: "@walletconnect/universal-provider@npm:2.10.6" +"@walletconnect/universal-provider@npm:2.11.0": + version: 2.11.0 + resolution: "@walletconnect/universal-provider@npm:2.11.0" 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.10.6 - "@walletconnect/types": 2.10.6 - "@walletconnect/utils": 2.10.6 + "@walletconnect/sign-client": 2.11.0 + "@walletconnect/types": 2.11.0 + "@walletconnect/utils": 2.11.0 events: ^3.3.0 - checksum: c09fd28819389d990edafb261d0570d54527f0872dd3c2ac38ac0c6fc25905dc2248809fc4fea2de382b2f68c86eee8e1d192fb46402bcc49370d76959662436 - languageName: node - linkType: hard - -"@walletconnect/utils@npm:2.10.2": - version: 2.10.2 - resolution: "@walletconnect/utils@npm:2.10.2" - dependencies: - "@stablelib/chacha20poly1305": 1.0.1 - "@stablelib/hkdf": 1.0.1 - "@stablelib/random": ^1.0.2 - "@stablelib/sha256": 1.0.1 - "@stablelib/x25519": ^1.0.3 - "@walletconnect/relay-api": ^1.0.9 - "@walletconnect/safe-json": ^1.0.2 - "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.10.2 - "@walletconnect/window-getters": ^1.0.1 - "@walletconnect/window-metadata": ^1.0.1 - detect-browser: 5.3.0 - query-string: 7.1.3 - uint8arrays: ^3.1.0 - checksum: 168e65d48ce6121f04f040662668fce63c8e42050c7c7d1da2948cf2e486657f8bf972f3386dc84251fcabf3626a26bb696e3363d55bc92826ec1602d7b493c7 + checksum: 7f4f187cd9148dc2e262e4afecadf0d0e136ae4183a60779562fef142411b927a3305c90793ef98dc3ecc61e4e2d4cfc8ac5491b1b42054021cfc4383f7ab81e languageName: node linkType: hard -"@walletconnect/utils@npm:2.10.6": - version: 2.10.6 - resolution: "@walletconnect/utils@npm:2.10.6" +"@walletconnect/utils@npm:2.11.0": + version: 2.11.0 + resolution: "@walletconnect/utils@npm:2.11.0" dependencies: "@stablelib/chacha20poly1305": 1.0.1 "@stablelib/hkdf": 1.0.1 @@ -3691,13 +3896,13 @@ __metadata: "@walletconnect/relay-api": ^1.0.9 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.10.6 + "@walletconnect/types": 2.11.0 "@walletconnect/window-getters": ^1.0.1 "@walletconnect/window-metadata": ^1.0.1 detect-browser: 5.3.0 query-string: 7.1.3 uint8arrays: ^3.1.0 - checksum: f6543601897aaa00f7aa0178df1cb88cca8f06f65846d3f4be85c458e79d04c462ad45e1f38d3fc993fcfa4f77871c92308e81620d6256da8138ae10e4b7546c + checksum: 9d8259ea6a2850e620eb366b26fc3f17cf7bf75ae9c50fdfa3252b9dd152d1c10444009dfad1aa5a0a7d1ed844e5efd76581540e973315ec289fba7b51ebf7d7 languageName: node linkType: hard @@ -3720,18 +3925,6 @@ __metadata: languageName: node linkType: hard -"JSONStream@npm:^1.3.5": - version: 1.3.5 - resolution: "JSONStream@npm:1.3.5" - dependencies: - jsonparse: ^1.2.0 - through: ">=2.2.7 <3" - bin: - JSONStream: ./bin.js - checksum: 2605fa124260c61bad38bb65eba30d2f72216a78e94d0ab19b11b4e0327d572b8d530c0c9cc3b0764f727ad26d39e00bf7ebad57781ca6368394d73169c59e46 - languageName: node - linkType: hard - "abbrev@npm:1, abbrev@npm:^1.0.0": version: 1.1.1 resolution: "abbrev@npm:1.1.1" @@ -3746,31 +3939,33 @@ __metadata: languageName: node linkType: hard -"abitype@npm:0.8.7": - version: 0.8.7 - resolution: "abitype@npm:0.8.7" +"abitype@npm:0.9.8": + version: 0.9.8 + resolution: "abitype@npm:0.9.8" peerDependencies: typescript: ">=5.0.4" zod: ^3 >=3.19.1 peerDependenciesMeta: + typescript: + optional: true zod: optional: true - checksum: 4351466808969bcc73e5c535c3d96bb687ee2be0bccd48eba024c47e6cc248f0c8bd368f9e42dab35d39923e63b1349ade470f72812de27127968caf1a1426c9 + checksum: d7d887f29d6821e3f7a400de9620511b80ead3f85c5c87308aaec97965d3493e6687ed816e88722b4f512249bd66dee9e69231b49af0e1db8f69400a62c87cf6 languageName: node linkType: hard -"abitype@npm:0.9.8": - version: 0.9.8 - resolution: "abitype@npm:0.9.8" +"abitype@npm:1.0.0": + version: 1.0.0 + resolution: "abitype@npm:1.0.0" peerDependencies: typescript: ">=5.0.4" - zod: ^3 >=3.19.1 + zod: ^3 >=3.22.0 peerDependenciesMeta: typescript: optional: true zod: optional: true - checksum: d7d887f29d6821e3f7a400de9620511b80ead3f85c5c87308aaec97965d3493e6687ed816e88722b4f512249bd66dee9e69231b49af0e1db8f69400a62c87cf6 + checksum: ea2c0548c3ba58c37a6de7483d63389074da498e63d803b742bbe94eb4eaa1f51a35d000c424058b2583aef56698cf07c696eb3bc4dd0303bc20c6f0826a241a languageName: node linkType: hard @@ -3851,13 +4046,6 @@ __metadata: languageName: node linkType: hard -"aes-js@npm:^3.1.2": - version: 3.1.2 - resolution: "aes-js@npm:3.1.2" - checksum: 062154d50b1e433cc8c3b8ca7879f3a6375d5e79c2a507b2b6c4ec920b4cd851bf2afa7f65c98761a9da89c0ab618cbe6529e8e9a1c71f93290b53128fb8f712 - languageName: node - linkType: hard - "agent-base@npm:6, agent-base@npm:^6.0.2": version: 6.0.2 resolution: "agent-base@npm:6.0.2" @@ -3867,7 +4055,7 @@ __metadata: languageName: node linkType: hard -"agentkeepalive@npm:^4.2.1, agentkeepalive@npm:^4.3.0": +"agentkeepalive@npm:^4.2.1": version: 4.5.0 resolution: "agentkeepalive@npm:4.5.0" dependencies: @@ -4445,6 +4633,17 @@ __metadata: languageName: node linkType: hard +"babel-plugin-macros@npm:^3.1.0": + version: 3.1.0 + resolution: "babel-plugin-macros@npm:3.1.0" + dependencies: + "@babel/runtime": ^7.12.5 + cosmiconfig: ^7.0.0 + resolve: ^1.19.0 + checksum: 765de4abebd3e4688ebdfbff8571ddc8cd8061f839bb6c3e550b0344a4027b04c60491f843296ce3f3379fb356cc873d57a9ee6694262547eb822c14a25be9a6 + languageName: node + linkType: hard + "balanced-match@npm:^1.0.0": version: 1.0.2 resolution: "balanced-match@npm:1.0.2" @@ -4491,16 +4690,6 @@ __metadata: languageName: node linkType: hard -"bigint-buffer@npm:^1.1.5": - version: 1.1.5 - resolution: "bigint-buffer@npm:1.1.5" - dependencies: - bindings: ^1.3.0 - node-gyp: latest - checksum: d010c9f57758bcdaccb435d88b483ffcc95fe8bbc6e7fb3a44fb5221f29c894ffaf4a3c5a4a530e0e7d6608203c2cde9b79ee4f2386cd6d4462d1070bc8c9f4e - languageName: node - linkType: hard - "bigint-crypto-utils@npm:^3.0.23": version: 3.3.0 resolution: "bigint-crypto-utils@npm:3.3.0" @@ -4522,14 +4711,7 @@ __metadata: languageName: node linkType: hard -"bind-decorator@npm:^1.0.11": - version: 1.0.11 - resolution: "bind-decorator@npm:1.0.11" - checksum: 41b6c69af51ee7e6e01ea6f2939df94c9c760383f89f5befda0890951657baedbf499a0b96a789fd85cb77252465134f4e6184aae6639ed60cf59549ef15353d - languageName: node - linkType: hard - -"bindings@npm:^1.3.0, bindings@npm:^1.4.0": +"bindings@npm:^1.4.0": version: 1.5.0 resolution: "bindings@npm:1.5.0" dependencies: @@ -4566,21 +4748,17 @@ __metadata: languageName: node linkType: hard -"bn.js@npm:^5.1.1, bn.js@npm:^5.1.2, bn.js@npm:^5.2.0, bn.js@npm:^5.2.1": +"bn.js@npm:^5.1.2, bn.js@npm:^5.2.0, bn.js@npm:^5.2.1": version: 5.2.1 resolution: "bn.js@npm:5.2.1" checksum: 3dd8c8d38055fedfa95c1d5fc3c99f8dd547b36287b37768db0abab3c239711f88ff58d18d155dd8ad902b0b0cee973747b7ae20ea12a09473272b0201c9edd3 languageName: node linkType: hard -"borsh@npm:^0.7.0": - version: 0.7.0 - resolution: "borsh@npm:0.7.0" - dependencies: - bn.js: ^5.2.0 - bs58: ^4.0.0 - text-encoding-utf-8: ^1.0.2 - checksum: e98bfb5f7cfb820819c2870b884dac58dd4b4ce6a86c286c8fbf5c9ca582e73a8c6094df67e81a28c418ff07a309c6b118b2e27fdfea83fd92b8100c741da0b5 +"bowser@npm:^2.9.0": + version: 2.11.0 + resolution: "bowser@npm:2.11.0" + checksum: 29c3f01f22e703fa6644fc3b684307442df4240b6e10f6cfe1b61c6ca5721073189ca97cdeedb376081148c8518e33b1d818a57f781d70b0b70e1f31fb48814f languageName: node linkType: hard @@ -4666,7 +4844,7 @@ __metadata: languageName: node linkType: hard -"bs58@npm:^4.0.0, bs58@npm:^4.0.1": +"bs58@npm:^4.0.0": version: 4.0.1 resolution: "bs58@npm:4.0.1" dependencies: @@ -4707,7 +4885,7 @@ __metadata: languageName: node linkType: hard -"buffer@npm:6.0.3, buffer@npm:^6.0.3, buffer@npm:~6.0.3": +"buffer@npm:^6.0.3": version: 6.0.3 resolution: "buffer@npm:6.0.3" dependencies: @@ -4717,13 +4895,13 @@ __metadata: languageName: node linkType: hard -"bufferutil@npm:^4.0.1": - version: 4.0.7 - resolution: "bufferutil@npm:4.0.7" +"bufferutil@npm:^4.0.8": + version: 4.0.8 + resolution: "bufferutil@npm:4.0.8" dependencies: node-gyp: latest node-gyp-build: ^4.3.0 - checksum: f75aa87e3d1b99b87a95f60a855e63f70af07b57fb8443e75a2ddfef2e47788d130fdd46e3a78fd7e0c10176082b26dfbed970c5b8632e1cc299cafa0e93ce45 + checksum: 7e9a46f1867dca72fda350966eb468eca77f4d623407b0650913fadf73d5750d883147d6e5e21c56f9d3b0bdc35d5474e80a600b9f31ec781315b4d2469ef087 languageName: node linkType: hard @@ -5117,6 +5295,17 @@ __metadata: languageName: node linkType: hard +"cliui@npm:^8.0.1": + version: 8.0.1 + resolution: "cliui@npm:8.0.1" + dependencies: + string-width: ^4.2.0 + strip-ansi: ^6.0.1 + wrap-ansi: ^7.0.0 + checksum: 79648b3b0045f2e285b76fb2e24e207c6db44323581e421c3acbd0e86454cba1b37aea976ab50195a49e7384b871e6dfb2247ad7dec53c02454ac6497394cb56 + languageName: node + linkType: hard + "clsx@npm:1.1.1": version: 1.1.1 resolution: "clsx@npm:1.1.1" @@ -5124,7 +5313,7 @@ __metadata: languageName: node linkType: hard -"clsx@npm:^1.1.0": +"clsx@npm:^1.2.1": version: 1.2.1 resolution: "clsx@npm:1.2.1" checksum: 30befca8019b2eb7dbad38cff6266cf543091dae2825c856a62a8ccf2c3ab9c2907c4d12b288b73101196767f66812365400a227581484a05f968b0307cfaf12 @@ -5254,13 +5443,6 @@ __metadata: languageName: node linkType: hard -"commander@npm:^2.20.3": - version: 2.20.3 - resolution: "commander@npm:2.20.3" - checksum: ab8c07884e42c3a8dbc5dd9592c606176c7eb5c1ca5ff274bcf907039b2c41de3626f684ea75ccf4d361ba004bbaff1f577d5384c155f3871e456bdf27becf9e - languageName: node - linkType: hard - "commander@npm:^4.0.0": version: 4.1.1 resolution: "commander@npm:4.1.1" @@ -5315,6 +5497,13 @@ __metadata: languageName: node linkType: hard +"convert-source-map@npm:^1.5.0": + version: 1.9.0 + resolution: "convert-source-map@npm:1.9.0" + checksum: dc55a1f28ddd0e9485ef13565f8f756b342f9a46c4ae18b843fe3c30c675d058d6a4823eff86d472f187b176f0adf51ea7b69ea38be34be4a63cbbf91b0593c8 + languageName: node + linkType: hard + "cookie-es@npm:^1.0.0": version: 1.0.0 resolution: "cookie-es@npm:1.0.0" @@ -5329,7 +5518,7 @@ __metadata: languageName: node linkType: hard -"copy-to-clipboard@npm:^3.3.1, copy-to-clipboard@npm:^3.3.3": +"copy-to-clipboard@npm:^3.3.1": version: 3.3.3 resolution: "copy-to-clipboard@npm:3.3.3" dependencies: @@ -5352,6 +5541,19 @@ __metadata: languageName: node linkType: hard +"cosmiconfig@npm:^7.0.0": + version: 7.1.0 + resolution: "cosmiconfig@npm:7.1.0" + dependencies: + "@types/parse-json": ^4.0.0 + import-fresh: ^3.2.1 + parse-json: ^5.0.0 + path-type: ^4.0.0 + yaml: ^1.10.0 + checksum: c53bf7befc1591b2651a22414a5e786cd5f2eeaa87f3678a3d49d6069835a9d8d1aef223728e98aa8fec9a95bf831120d245096db12abe019fecb51f5696c96f + languageName: node + linkType: hard + "crc-32@npm:^1.2.0": version: 1.2.2 resolution: "crc-32@npm:1.2.2" @@ -5395,7 +5597,7 @@ __metadata: languageName: node linkType: hard -"cross-fetch@npm:^3.1.4": +"cross-fetch@npm:^3.1.4, cross-fetch@npm:^3.1.5": version: 3.1.8 resolution: "cross-fetch@npm:3.1.8" dependencies: @@ -5404,6 +5606,15 @@ __metadata: languageName: node linkType: hard +"cross-fetch@npm:^4.0.0": + version: 4.0.0 + resolution: "cross-fetch@npm:4.0.0" + dependencies: + node-fetch: ^2.6.12 + checksum: ecca4f37ffa0e8283e7a8a590926b66713a7ef7892757aa36c2d20ffa27b0ac5c60dcf453119c809abe5923fc0bae3702a4d896bfb406ef1077b0d0018213e24 + languageName: node + linkType: hard + "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -5490,6 +5701,15 @@ __metadata: languageName: node linkType: hard +"date-fns@npm:^2.29.3": + version: 2.30.0 + resolution: "date-fns@npm:2.30.0" + dependencies: + "@babel/runtime": ^7.21.0 + checksum: f7be01523282e9bb06c0cd2693d34f245247a29098527d4420628966a2d9aad154bd0e90a6b1cf66d37adcb769cd108cf8a7bd49d76db0fb119af5cdd13644f4 + languageName: node + linkType: hard + "death@npm:^1.1.0": version: 1.1.0 resolution: "death@npm:1.1.0" @@ -5506,7 +5726,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:~4.3.1, debug@npm:~4.3.2": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -5557,7 +5777,7 @@ __metadata: languageName: node linkType: hard -"decode-uri-component@npm:^0.2.0, decode-uri-component@npm:^0.2.2": +"decode-uri-component@npm:^0.2.2": version: 0.2.2 resolution: "decode-uri-component@npm:0.2.2" checksum: 95476a7d28f267292ce745eac3524a9079058bbb35767b76e3ee87d42e34cd0275d2eb19d9d08c3e167f97556e8a2872747f5e65cbebcac8b0c98d83e285f139 @@ -5612,6 +5832,13 @@ __metadata: languageName: node linkType: hard +"define-lazy-prop@npm:^2.0.0": + version: 2.0.0 + resolution: "define-lazy-prop@npm:2.0.0" + checksum: 0115fdb065e0490918ba271d7339c42453d209d4cb619dfe635870d906731eff3e1ade8028bb461ea27ce8264ec5e22c6980612d332895977e89c1bbc80fcee2 + languageName: node + linkType: hard + "define-properties@npm:^1.1.2, define-properties@npm:^1.1.3, define-properties@npm:^1.1.4, define-properties@npm:^1.2.0, define-properties@npm:^1.2.1": version: 1.2.1 resolution: "define-properties@npm:1.2.1" @@ -5630,13 +5857,6 @@ __metadata: languageName: node linkType: hard -"delay@npm:^5.0.0": - version: 5.0.0 - resolution: "delay@npm:5.0.0" - checksum: 62f151151ecfde0d9afbb8a6be37a6d103c4cb24f35a20ef3fe56f920b0d0d0bb02bc9c0a3084d0179ef669ca332b91155f2ee4d9854622cd2cdba5fc95285f9 - languageName: node - linkType: hard - "delayed-stream@npm:~1.0.0": version: 1.0.0 resolution: "delayed-stream@npm:1.0.0" @@ -5686,7 +5906,7 @@ __metadata: languageName: node linkType: hard -"detect-browser@npm:5.3.0, detect-browser@npm:^5.3.0": +"detect-browser@npm:5.3.0, detect-browser@npm:^5.2.0": version: 5.3.0 resolution: "detect-browser@npm:5.3.0" checksum: dd6e08d55da1d9e0f22510ac79872078ae03d9dfa13c5e66c96baedc1c86567345a88f96949161f6be8f3e0fafa93bf179bdb1cd311b14f5f163112fcc70ab49 @@ -5843,6 +6063,17 @@ __metadata: languageName: node linkType: hard +"eciesjs@npm:^0.3.15, eciesjs@npm:^0.3.16": + version: 0.3.18 + resolution: "eciesjs@npm:0.3.18" + dependencies: + "@types/secp256k1": ^4.0.4 + futoin-hkdf: ^1.5.3 + secp256k1: ^5.0.0 + checksum: 2d6e1624c4b2110ab4c76a684d0f458774c702f9711859404a52ede1b2dea67f61e8fc258a0867c2090e5b1110ca3201ea2876f5ac0e2dd57ef1bcfb358d3004 + languageName: node + linkType: hard + "edge-runtime@npm:2.5.1": version: 2.5.1 resolution: "edge-runtime@npm:2.5.1" @@ -5921,7 +6152,7 @@ __metadata: languageName: node linkType: hard -"end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.1": +"end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.0, end-of-stream@npm:^1.4.1, end-of-stream@npm:^1.4.4": version: 1.4.4 resolution: "end-of-stream@npm:1.4.4" dependencies: @@ -5939,6 +6170,26 @@ __metadata: languageName: node linkType: hard +"engine.io-client@npm:~6.5.2": + version: 6.5.3 + resolution: "engine.io-client@npm:6.5.3" + dependencies: + "@socket.io/component-emitter": ~3.1.0 + debug: ~4.3.1 + engine.io-parser: ~5.2.1 + ws: ~8.11.0 + xmlhttprequest-ssl: ~2.0.0 + checksum: a72596fae99afbdb899926fccdb843f8fa790c69085b881dde121285a6935da2c2c665ebe88e0e6aa4285637782df84ac882084ff4892ad2430b059fc0045db0 + languageName: node + linkType: hard + +"engine.io-parser@npm:~5.2.1": + version: 5.2.1 + resolution: "engine.io-parser@npm:5.2.1" + checksum: 55b0e8e18500f50c1573675c53597c5552554ead08d3f30ff19fde6409e48f882a8e01f84e9772cd155c18a1d653d06f6bf57b4e1f8b834c63c9eaf3b657b88e + languageName: node + linkType: hard + "enhanced-resolve@npm:^5.12.0": version: 5.15.0 resolution: "enhanced-resolve@npm:5.15.0" @@ -5982,6 +6233,15 @@ __metadata: languageName: node linkType: hard +"error-ex@npm:^1.3.1": + version: 1.3.2 + resolution: "error-ex@npm:1.3.2" + dependencies: + is-arrayish: ^0.2.1 + checksum: c1c2b8b65f9c91b0f9d75f0debaa7ec5b35c266c2cac5de412c1a6de86d4cbae04ae44e510378cb14d032d0645a36925d0186f8bb7367bcc629db256b743a001 + languageName: node + linkType: hard + "es-abstract@npm:^1.22.1": version: 1.22.2 resolution: "es-abstract@npm:1.22.2" @@ -6089,22 +6349,6 @@ __metadata: languageName: node linkType: hard -"es6-promise@npm:^4.0.3": - version: 4.2.8 - resolution: "es6-promise@npm:4.2.8" - checksum: 95614a88873611cb9165a85d36afa7268af5c03a378b35ca7bda9508e1d4f1f6f19a788d4bc755b3fd37c8ebba40782018e02034564ff24c9d6fa37e959ad57d - languageName: node - linkType: hard - -"es6-promisify@npm:^5.0.0": - version: 5.0.0 - resolution: "es6-promisify@npm:5.0.0" - dependencies: - es6-promise: ^4.0.3 - checksum: fbed9d791598831413be84a5374eca8c24800ec71a16c1c528c43a98e2dadfb99331483d83ae6094ddb9b87e6f799a15d1553cebf756047e0865c753bc346b92 - languageName: node - linkType: hard - "esbuild-android-64@npm:0.14.47": version: 0.14.47 resolution: "esbuild-android-64@npm:0.14.47" @@ -6330,6 +6574,13 @@ __metadata: languageName: node linkType: hard +"escape-string-regexp@npm:2.0.0": + version: 2.0.0 + resolution: "escape-string-regexp@npm:2.0.0" + checksum: 9f8a2d5743677c16e85c810e3024d54f0c8dea6424fad3c79ef6666e81dd0846f7437f5e729dfcdac8981bc9e5294c39b4580814d114076b8d36318f46ae4395 + languageName: node + linkType: hard + "escape-string-regexp@npm:4.0.0, escape-string-regexp@npm:^4.0.0": version: 4.0.0 resolution: "escape-string-regexp@npm:4.0.0" @@ -6699,15 +6950,16 @@ __metadata: languageName: node linkType: hard -"eth-block-tracker@npm:6.1.0": - version: 6.1.0 - resolution: "eth-block-tracker@npm:6.1.0" +"eth-block-tracker@npm:^7.1.0": + version: 7.1.0 + resolution: "eth-block-tracker@npm:7.1.0" dependencies: - "@metamask/safe-event-emitter": ^2.0.0 - "@metamask/utils": ^3.0.1 + "@metamask/eth-json-rpc-provider": ^1.0.0 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^5.0.1 json-rpc-random-id: ^1.0.1 pify: ^3.0.0 - checksum: 33ee6375a26822649d1e9ac24a3c39d70338eb505715f72b9102fb82e40d7a48902b4a7dd4a33bb4f121b79707c5ab045777507a2881cfcdb385c8ccbb3ac2a0 + checksum: 1d019f261e0ef07387cd74538b160700caa35ba9859ab9d4e5137c48bf9c92822c3b4ade40f8a504f16cb813de4c317c5378d047625ddf04592e256be8842588 languageName: node linkType: hard @@ -6739,16 +6991,16 @@ __metadata: languageName: node linkType: hard -"eth-json-rpc-filters@npm:5.1.0": - version: 5.1.0 - resolution: "eth-json-rpc-filters@npm:5.1.0" +"eth-json-rpc-filters@npm:^6.0.0": + version: 6.0.1 + resolution: "eth-json-rpc-filters@npm:6.0.1" dependencies: - "@metamask/safe-event-emitter": ^2.0.0 + "@metamask/safe-event-emitter": ^3.0.0 async-mutex: ^0.2.6 eth-query: ^2.1.2 json-rpc-engine: ^6.1.0 pify: ^5.0.0 - checksum: 864092e96277953c399a139df66572b864bd41247c5c1d18e6529973804d4fd8962658d8b10571152554802fa8daaa1003588aee79ffce754e0bc57c39b771d5 + checksum: 216f7417417599a48273b08fb2894581175276fe21cb1c9ffa66e98a9c2a67bc0ac821ad2ca163fdb8e8de0960aea0d9c5e53aee9d5dcfec355abf020e9458c5 languageName: node linkType: hard @@ -6762,16 +7014,7 @@ __metadata: languageName: node linkType: hard -"eth-rpc-errors@npm:4.0.2": - version: 4.0.2 - resolution: "eth-rpc-errors@npm:4.0.2" - dependencies: - fast-safe-stringify: ^2.0.6 - checksum: 1dbdee8f416090f1d318e17bdee2251d174d73c8faa4286fa364bc51ae9105672045f2d078ec23ca6a2b4b92af7cfbe7fa1ba17ad49e591fc653a363bf8cbab2 - languageName: node - linkType: hard - -"eth-rpc-errors@npm:^4.0.2": +"eth-rpc-errors@npm:^4.0.2, eth-rpc-errors@npm:^4.0.3": version: 4.0.3 resolution: "eth-rpc-errors@npm:4.0.3" dependencies: @@ -6964,14 +7207,14 @@ __metadata: languageName: node linkType: hard -"eventemitter3@npm:^4.0.7": - version: 4.0.7 - resolution: "eventemitter3@npm:4.0.7" - checksum: 1875311c42fcfe9c707b2712c32664a245629b42bb0a5a84439762dd0fd637fc54d078155ea83c2af9e0323c9ac13687e03cfba79b03af9f40c89b4960099374 +"eventemitter2@npm:^6.4.5, eventemitter2@npm:^6.4.7": + version: 6.4.9 + resolution: "eventemitter2@npm:6.4.9" + checksum: be59577c1e1c35509c7ba0e2624335c35bbcfd9485b8a977384c6cc6759341ea1a98d3cb9dbaa5cea4fff9b687e504504e3f9c2cc1674cf3bd8a43a7c74ea3eb languageName: node linkType: hard -"eventemitter3@npm:^5.0.1": +"eventemitter3@npm:5.0.1, eventemitter3@npm:^5.0.1": version: 5.0.1 resolution: "eventemitter3@npm:5.0.1" checksum: 543d6c858ab699303c3c32e0f0f47fc64d360bf73c3daf0ac0b5079710e340d6fe9f15487f94e66c629f5f82cd1a8678d692f3dbb6f6fcd1190e1b97fcad36f8 @@ -7076,6 +7319,15 @@ __metadata: languageName: node linkType: hard +"extension-port-stream@npm:^2.0.1": + version: 2.1.1 + resolution: "extension-port-stream@npm:2.1.1" + dependencies: + webextension-polyfill: ">=0.10.0 <1.0" + checksum: aee8bbeb2ed6f69a62f58a89580e0e9002dadb11062edbaedb7bb04cfc5a5e0b0d3980bfeaa1c3ee7e08dec7e5fac26e25497fc2f82000db7653442bd5eca157 + languageName: node + linkType: hard + "extsprintf@npm:1.3.0": version: 1.3.0 resolution: "extsprintf@npm:1.3.0" @@ -7090,10 +7342,10 @@ __metadata: languageName: node linkType: hard -"eyes@npm:^0.1.8": - version: 0.1.8 - resolution: "eyes@npm:0.1.8" - checksum: c31703a92bf36ba75ee8d379ee7985c24ee6149f3a6175f44cec7a05b178c38bce9836d3ca48c9acb0329a960ac2c4b2ead4e60cdd4fe6e8c92cad7cd6913687 +"fast-deep-equal@npm:^2.0.1": + version: 2.0.1 + resolution: "fast-deep-equal@npm:2.0.1" + checksum: b701835a87985e0ec4925bdf1f0c1e7eb56309b5d12d534d5b4b69d95a54d65bb16861c081781ead55f73f12d6c60ba668713391ee7fbf6b0567026f579b7b0b languageName: node linkType: hard @@ -7152,13 +7404,6 @@ __metadata: languageName: node linkType: hard -"fast-stable-stringify@npm:^1.0.0": - version: 1.0.0 - resolution: "fast-stable-stringify@npm:1.0.0" - checksum: ef1203d246a7e8ac15e2bfbda0a89fa375947bccf9f7910be0ea759856dbe8ea5024a0d8cc2cceabe18a9cb67e95927b78bb6173a3ae37ec55a518cf36e5244b - languageName: node - linkType: hard - "fastparse@npm:^1.1.2": version: 1.1.2 resolution: "fastparse@npm:1.1.2" @@ -7225,6 +7470,13 @@ __metadata: languageName: node linkType: hard +"find-root@npm:^1.1.0": + version: 1.1.0 + resolution: "find-root@npm:1.1.0" + checksum: b2a59fe4b6c932eef36c45a048ae8f93c85640212ebe8363164814990ee20f154197505965f3f4f102efc33bfb1cbc26fd17c4a2fc739ebc51b886b137cbefaf + languageName: node + linkType: hard + "find-up@npm:3.0.0, find-up@npm:^3.0.0": version: 3.0.0 resolution: "find-up@npm:3.0.0" @@ -7581,6 +7833,13 @@ __metadata: languageName: node linkType: hard +"futoin-hkdf@npm:^1.5.3": + version: 1.5.3 + resolution: "futoin-hkdf@npm:1.5.3" + checksum: 790da5675b31df4b9a34c19a5181f673171b5ad81fa92b91981bcfd2250692f895d6aada5ae4203212babba3c7d7a1916432e0b42c7aa88d3f70408439ec315e + languageName: node + linkType: hard + "gauge@npm:^3.0.0": version: 3.0.2 resolution: "gauge@npm:3.0.2" @@ -8275,6 +8534,24 @@ __metadata: languageName: node linkType: hard +"hoist-non-react-statics@npm:^3.3.1": + version: 3.3.2 + resolution: "hoist-non-react-statics@npm:3.3.2" + dependencies: + react-is: ^16.7.0 + checksum: b1538270429b13901ee586aa44f4cc3ecd8831c061d06cb8322e50ea17b3f5ce4d0e2e66394761e6c8e152cd8c34fb3b4b690116c6ce2bd45b18c746516cb9e8 + languageName: node + linkType: hard + +"html-parse-stringify@npm:^3.0.1": + version: 3.0.1 + resolution: "html-parse-stringify@npm:3.0.1" + dependencies: + void-elements: 3.1.0 + checksum: 334fdebd4b5c355dba8e95284cead6f62bf865a2359da2759b039db58c805646350016d2017875718bc3c4b9bf81a0d11be5ee0cf4774a3a5a7b97cde21cfd67 + languageName: node + linkType: hard + "http-basic@npm:^8.1.1": version: 8.1.3 resolution: "http-basic@npm:8.1.3" @@ -8428,6 +8705,24 @@ __metadata: languageName: node linkType: hard +"i18next-browser-languagedetector@npm:^7.1.0": + version: 7.2.0 + resolution: "i18next-browser-languagedetector@npm:7.2.0" + dependencies: + "@babel/runtime": ^7.23.2 + checksum: 757845c7ae7dfc541f5150855c3a3e4f6d29bcee113796d44dc781594abc7f16f2750a2a70d786904c16d23ba952eba2741c0bcfeaa381016669522a6236998f + languageName: node + linkType: hard + +"i18next@npm:22.5.1": + version: 22.5.1 + resolution: "i18next@npm:22.5.1" + dependencies: + "@babel/runtime": ^7.20.6 + checksum: 175f8ab7fac2abcee147b00cc2d8e7d4fa9b05cdc227f02cac841fc2fd9545ed4a6d88774f594f8ad12dc944e4d34cc8e88aa00c8b9947baef9e859d93abd305 + languageName: node + linkType: hard + "iconv-lite@npm:0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" @@ -8515,7 +8810,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.3, inherits@npm:~2.0.4": +"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.3": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 @@ -8554,7 +8849,7 @@ __metadata: languageName: node linkType: hard -"invariant@npm:^2.2.4": +"invariant@npm:2.2.4, invariant@npm:^2.2.4": version: 2.2.4 resolution: "invariant@npm:2.2.4" dependencies: @@ -8624,6 +8919,13 @@ __metadata: languageName: node linkType: hard +"is-arrayish@npm:^0.2.1": + version: 0.2.1 + resolution: "is-arrayish@npm:0.2.1" + checksum: eef4417e3c10e60e2c810b6084942b3ead455af16c4509959a27e490e7aee87cfb3f38e01bbde92220b528a0ee1a18d52b787e1458ee86174d8c7f0e58cd488f + languageName: node + linkType: hard + "is-async-function@npm:^2.0.0": version: 2.0.0 resolution: "is-async-function@npm:2.0.0" @@ -8693,7 +8995,7 @@ __metadata: languageName: node linkType: hard -"is-docker@npm:^2.0.0": +"is-docker@npm:^2.0.0, is-docker@npm:^2.1.1": version: 2.2.1 resolution: "is-docker@npm:2.2.1" bin: @@ -8882,7 +9184,7 @@ __metadata: languageName: node linkType: hard -"is-typedarray@npm:1.0.0, is-typedarray@npm:^1.0.0, is-typedarray@npm:~1.0.0": +"is-typedarray@npm:~1.0.0": version: 1.0.0 resolution: "is-typedarray@npm:1.0.0" checksum: 3508c6cd0a9ee2e0df2fa2e9baabcdc89e911c7bd5cf64604586697212feec525aa21050e48affb5ffc3df20f0f5d2e2cf79b08caa64e1ccc9578e251763aef7 @@ -8959,6 +9261,16 @@ __metadata: languageName: node linkType: hard +"isomorphic-unfetch@npm:3.1.0": + version: 3.1.0 + resolution: "isomorphic-unfetch@npm:3.1.0" + dependencies: + node-fetch: ^2.6.1 + unfetch: ^4.2.0 + checksum: 82b92fe4ec2823a81ab0fc0d11bd94d710e6f9a940d56b3cba31896d4345ec9ffc7949f4ff31ebcae84f6b95f7ebf3474c4c7452b834eb4078ea3f2c37e459c5 + languageName: node + linkType: hard + "isomorphic-ws@npm:5.0.0": version: 5.0.0 resolution: "isomorphic-ws@npm:5.0.0" @@ -8968,15 +9280,6 @@ __metadata: languageName: node linkType: hard -"isomorphic-ws@npm:^4.0.1": - version: 4.0.1 - resolution: "isomorphic-ws@npm:4.0.1" - peerDependencies: - ws: "*" - checksum: d7190eadefdc28bdb93d67b5f0c603385aaf87724fa2974abb382ac1ec9756ed2cfb27065cbe76122879c2d452e2982bc4314317f3d6c737ddda6c047328771a - languageName: node - linkType: hard - "isows@npm:1.0.3": version: 1.0.3 resolution: "isows@npm:1.0.3" @@ -9026,28 +9329,6 @@ __metadata: languageName: node linkType: hard -"jayson@npm:^4.1.0": - version: 4.1.0 - resolution: "jayson@npm:4.1.0" - dependencies: - "@types/connect": ^3.4.33 - "@types/node": ^12.12.54 - "@types/ws": ^7.4.4 - JSONStream: ^1.3.5 - commander: ^2.20.3 - delay: ^5.0.0 - es6-promisify: ^5.0.0 - eyes: ^0.1.8 - isomorphic-ws: ^4.0.1 - json-stringify-safe: ^5.0.1 - uuid: ^8.3.2 - ws: ^7.4.5 - bin: - jayson: bin/jayson.js - checksum: 86464322fbdc6db65d2bb4fc278cb6c86fad5c2a506065490d39459f09ba0d30f2b4fb740b33828a1424791419b6c8bd295dc54d361a4ad959bf70cc62b1ca7e - languageName: node - linkType: hard - "jiti@npm:^1.18.2": version: 1.20.0 resolution: "jiti@npm:1.20.0" @@ -9159,7 +9440,14 @@ __metadata: languageName: node linkType: hard -"json-rpc-engine@npm:6.1.0, json-rpc-engine@npm:^6.1.0": +"json-parse-even-better-errors@npm:^2.3.0": + version: 2.3.1 + resolution: "json-parse-even-better-errors@npm:2.3.1" + checksum: 798ed4cf3354a2d9ccd78e86d2169515a0097a5c133337807cdf7f1fc32e1391d207ccfc276518cc1d7d8d4db93288b8a50ba4293d212ad1336e52a8ec0a941f + languageName: node + linkType: hard + +"json-rpc-engine@npm:^6.1.0": version: 6.1.0 resolution: "json-rpc-engine@npm:6.1.0" dependencies: @@ -9169,6 +9457,17 @@ __metadata: languageName: node linkType: hard +"json-rpc-middleware-stream@npm:^4.2.1": + version: 4.2.3 + resolution: "json-rpc-middleware-stream@npm:4.2.3" + dependencies: + "@metamask/safe-event-emitter": ^3.0.0 + json-rpc-engine: ^6.1.0 + readable-stream: ^2.3.3 + checksum: 0907d34935a8b58c3c67626e344272758f684c13175b2e7de2bac37309c3211fca7a129bce042d50faed605615f51fbba01e173bdc2ae6c14d95aefb9bfb4e09 + languageName: node + linkType: hard + "json-rpc-random-id@npm:^1.0.0, json-rpc-random-id@npm:^1.0.1": version: 1.0.1 resolution: "json-rpc-random-id@npm:1.0.1" @@ -9214,7 +9513,7 @@ __metadata: languageName: node linkType: hard -"json-stringify-safe@npm:^5.0.1, json-stringify-safe@npm:~5.0.1": +"json-stringify-safe@npm:~5.0.1": version: 5.0.1 resolution: "json-stringify-safe@npm:5.0.1" checksum: 48ec0adad5280b8a96bb93f4563aa1667fd7a36334f79149abd42446d0989f2ddc58274b479f4819f1f00617957e6344c886c55d05a4e15ebb4ab931e4a6a8ee @@ -9270,16 +9569,9 @@ __metadata: graceful-fs: ^4.1.6 universalify: ^2.0.0 dependenciesMeta: - graceful-fs: - optional: true - checksum: 7af3b8e1ac8fe7f1eccc6263c6ca14e1966fcbc74b618d3c78a0a2075579487547b94f72b7a1114e844a1e15bb00d440e5d1720bfc4612d790a6f285d5ea8354 - languageName: node - linkType: hard - -"jsonparse@npm:^1.2.0": - version: 1.3.1 - resolution: "jsonparse@npm:1.3.1" - checksum: 6514a7be4674ebf407afca0eda3ba284b69b07f9958a8d3113ef1005f7ec610860c312be067e450c569aab8b89635e332cee3696789c750692bb60daba627f4d + graceful-fs: + optional: true + checksum: 7af3b8e1ac8fe7f1eccc6263c6ca14e1966fcbc74b618d3c78a0a2075579487547b94f72b7a1114e844a1e15bb00d440e5d1720bfc4612d790a6f285d5ea8354 languageName: node linkType: hard @@ -9314,7 +9606,7 @@ __metadata: languageName: node linkType: hard -"keccak@npm:^3.0.0, keccak@npm:^3.0.1, keccak@npm:^3.0.2": +"keccak@npm:^3.0.0, keccak@npm:^3.0.2, keccak@npm:^3.0.3": version: 3.0.4 resolution: "keccak@npm:3.0.4" dependencies: @@ -9833,6 +10125,15 @@ __metadata: languageName: node linkType: hard +"merge-options@npm:^3.0.4": + version: 3.0.4 + resolution: "merge-options@npm:3.0.4" + dependencies: + is-plain-obj: ^2.1.0 + checksum: d86ddb3dd6e85d558dbf25dc944f3527b6bacb944db3fdda6e84a3f59c4e4b85231095f58b835758b9a57708342dee0f8de0dffa352974a48221487fe9f4584f + languageName: node + linkType: hard + "merge-stream@npm:^2.0.0": version: 2.0.0 resolution: "merge-stream@npm:2.0.0" @@ -10076,6 +10377,20 @@ __metadata: languageName: node linkType: hard +"mipd@npm:0.0.5": + version: 0.0.5 + resolution: "mipd@npm:0.0.5" + dependencies: + viem: ^1.1.4 + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 920b3afb3a92daeb66685adb746211ac4268ff805392a2f6e1da2703c43aa5835e5ad7be9d0312582a348d4c764ae3c81ab39362b66607ba0d54032def0038f1 + languageName: node + linkType: hard + "mkdirp@npm:0.5.5": version: 0.5.5 resolution: "mkdirp@npm:0.5.5" @@ -10398,6 +10713,15 @@ __metadata: languageName: node linkType: hard +"node-addon-api@npm:^5.0.0": + version: 5.1.0 + resolution: "node-addon-api@npm:5.1.0" + dependencies: + node-gyp: latest + checksum: 2508bd2d2981945406243a7bd31362fc7af8b70b8b4d65f869c61731800058fb818cc2fd36c8eac714ddd0e568cc85becf5e165cebbdf7b5024d5151bbc75ea1 + languageName: node + linkType: hard + "node-addon-api@npm:^7.0.0": version: 7.0.0 resolution: "node-addon-api@npm:7.0.0" @@ -10461,7 +10785,7 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.7": +"node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.7": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" dependencies: @@ -10641,6 +10965,17 @@ __metadata: languageName: node linkType: hard +"obj-multiplex@npm:^1.0.0": + version: 1.0.0 + resolution: "obj-multiplex@npm:1.0.0" + dependencies: + end-of-stream: ^1.4.0 + once: ^1.4.0 + readable-stream: ^2.3.3 + checksum: 6bdcb7d48a1cd4458a7ff0be0b3c1dc58e8e9e6504f937c10b1eac096a3d459b85d7ba32bdd9a45382bb238e245eb42ebcd91430c72f04b0a57c97f846f2d06f + languageName: node + linkType: hard + "object-assign@npm:^4.0.1, object-assign@npm:^4.1.0, object-assign@npm:^4.1.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" @@ -10822,6 +11157,17 @@ __metadata: languageName: node linkType: hard +"open@npm:^8.4.0": + version: 8.4.2 + resolution: "open@npm:8.4.2" + dependencies: + define-lazy-prop: ^2.0.0 + is-docker: ^2.1.1 + is-wsl: ^2.2.0 + checksum: 6388bfff21b40cb9bd8f913f9130d107f2ed4724ea81a8fd29798ee322b361ca31fa2cdfb491a5c31e43a3996cfe9566741238c7a741ada8d7af1cb78d85cf26 + languageName: node + linkType: hard + "optionator@npm:^0.8.1": version: 0.8.3 resolution: "optionator@npm:0.8.3" @@ -10987,6 +11333,18 @@ __metadata: languageName: node linkType: hard +"parse-json@npm:^5.0.0": + version: 5.2.0 + resolution: "parse-json@npm:5.2.0" + dependencies: + "@babel/code-frame": ^7.0.0 + error-ex: ^1.3.1 + json-parse-even-better-errors: ^2.3.0 + lines-and-columns: ^1.1.6 + checksum: 62085b17d64da57f40f6afc2ac1f4d95def18c4323577e1eced571db75d9ab59b297d1d10582920f84b15985cbfc6b6d450ccbf317644cfa176f3ed982ad87e2 + languageName: node + linkType: hard + "parse-ms@npm:^2.1.0": version: 2.1.0 resolution: "parse-ms@npm:2.1.0" @@ -11248,6 +11606,13 @@ __metadata: languageName: node linkType: hard +"pony-cause@npm:^2.1.10": + version: 2.1.10 + resolution: "pony-cause@npm:2.1.10" + checksum: 8b61378f213e61056312dc274a1c79980154e9d864f6ad86e0c8b91a50d3ce900d430995ee24147c9f3caa440dfe7d51c274b488d7f033b65b206522536d7217 + languageName: node + linkType: hard + "postcss-import@npm:^15.1.0": version: 15.1.0 resolution: "postcss-import@npm:15.1.0" @@ -11340,10 +11705,10 @@ __metadata: languageName: node linkType: hard -"preact@npm:^10.12.0, preact@npm:^10.5.9": - version: 10.17.1 - resolution: "preact@npm:10.17.1" - checksum: d25193272d2d2e58beb5dea7c0a715090a942d437638e39977b92f5729eb8d8a3410393f6f73799c850953e679ca79cf7a285dca31f34c492ff62df2f27643bf +"preact@npm:^10.16.0": + version: 10.19.3 + resolution: "preact@npm:10.19.3" + checksum: cb4fcc801f7ff302b9706eb4bb4a36cc7cd96f3231ac28baeb3ea5caf6724372222121cb487f66af44a1312bf61dbe74825ce2fda98295d2108e7443c20b0e56 languageName: node linkType: hard @@ -11395,6 +11760,13 @@ __metadata: languageName: node linkType: hard +"process-nextick-args@npm:~1.0.6": + version: 1.0.7 + resolution: "process-nextick-args@npm:1.0.7" + checksum: 41224fbc803ac6c96907461d4dfc20942efa3ca75f2d521bcf7cf0e89f8dec127fb3fb5d76746b8fb468a232ea02d84824fae08e027aec185fd29049c66d49f8 + languageName: node + linkType: hard + "process-nextick-args@npm:~2.0.0": version: 2.0.1 resolution: "process-nextick-args@npm:2.0.1" @@ -11477,6 +11849,31 @@ __metadata: languageName: node linkType: hard +"qr-code-styling@npm:^1.6.0-rc.1": + version: 1.6.0-rc.1 + resolution: "qr-code-styling@npm:1.6.0-rc.1" + dependencies: + qrcode-generator: ^1.4.3 + checksum: 778754790fe0b586ecd38fb02de777c7dd9cf844cf6e3c88f9a23ad85b122200a8567c946e3c41dba84ddd2f0016aa31ddfd1507150e1dbfea8a58323b62d944 + languageName: node + linkType: hard + +"qrcode-generator@npm:^1.4.3": + version: 1.4.4 + resolution: "qrcode-generator@npm:1.4.4" + checksum: 860cfdd2a7a608d34e92cab99774cc08182e1911432f30ed36d16f8a5cdabd7fdf40239caed91fa2691cfe66c8d95c1340a2fc9cc439eed07a9f2eb328c6f527 + languageName: node + linkType: hard + +"qrcode-terminal-nooctal@npm:^0.12.1": + version: 0.12.1 + resolution: "qrcode-terminal-nooctal@npm:0.12.1" + bin: + qrcode-terminal: bin/qrcode-terminal.js + checksum: 1071c4be2bfa07b3956ad0a63c87452ced0b5180a9dc19f224fc3dd69bb24ad687a7af365acdde0f876ddf89dc1a4beadba88d89c7c5c5cbf2ef3efaef64736e + languageName: node + linkType: hard + "qrcode.react@npm:^3.1.0": version: 3.1.0 resolution: "qrcode.react@npm:3.1.0" @@ -11514,7 +11911,7 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.10.3, qs@npm:^6.4.0, qs@npm:^6.9.4": +"qs@npm:^6.4.0, qs@npm:^6.9.4": version: 6.11.2 resolution: "qs@npm:6.11.2" dependencies: @@ -11542,18 +11939,6 @@ __metadata: languageName: node linkType: hard -"query-string@npm:^6.13.5": - version: 6.14.1 - resolution: "query-string@npm:6.14.1" - dependencies: - decode-uri-component: ^0.2.0 - filter-obj: ^1.1.0 - split-on-first: ^1.0.0 - strict-uri-encode: ^2.0.0 - checksum: f2c7347578fa0f3fd4eaace506470cb4e9dc52d409a7ddbd613f614b9a594d750877e193b5d5e843c7477b3b295b857ec328903c943957adc41a3efb6c929449 - languageName: node - linkType: hard - "queue-microtask@npm:^1.2.2, queue-microtask@npm:^1.2.3": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -11644,13 +12029,44 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^16.13.1": +"react-i18next@npm:^13.2.2": + version: 13.5.0 + resolution: "react-i18next@npm:13.5.0" + dependencies: + "@babel/runtime": ^7.22.5 + html-parse-stringify: ^3.0.1 + peerDependencies: + i18next: ">= 23.2.3" + react: ">= 16.8.0" + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + checksum: 2f68ccd24daf72ddd2d11a526fb3c2b66c11ea4fcd2e24ac7aed42bf57ec7bffa7455ad1dc93679968ff629e9b1896465cdf6d1a61c29b92138ef88098e8dcba + languageName: node + linkType: hard + +"react-is@npm:^16.13.1, react-is@npm:^16.7.0": version: 16.13.1 resolution: "react-is@npm:16.13.1" checksum: f7a19ac3496de32ca9ae12aa030f00f14a3d45374f1ceca0af707c831b2a6098ef0d6bdae51bd437b0a306d7f01d4677fcc8de7c0d331eb47ad0f46130e53c5f languageName: node linkType: hard +"react-native-webview@npm:^11.26.0": + version: 11.26.1 + resolution: "react-native-webview@npm:11.26.1" + dependencies: + escape-string-regexp: 2.0.0 + invariant: 2.2.4 + peerDependencies: + react: "*" + react-native: "*" + checksum: d2f95a89e944a2f1e8cf402e4e274f3568edae42e7ef190915e9fba8004a01d699c962459bdc9688c159060538e90aea3017cab24e6f4112021cbbc10ef57104 + languageName: node + linkType: hard + "react-remove-scroll-bar@npm:^2.3.3": version: 2.3.4 resolution: "react-remove-scroll-bar@npm:2.3.4" @@ -11721,7 +12137,22 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^2.2.2": +"readable-stream@npm:2.3.3": + version: 2.3.3 + resolution: "readable-stream@npm:2.3.3" + dependencies: + core-util-is: ~1.0.0 + inherits: ~2.0.3 + isarray: ~1.0.0 + process-nextick-args: ~1.0.6 + safe-buffer: ~5.1.1 + string_decoder: ~1.0.3 + util-deprecate: ~1.0.1 + checksum: 76f9863065d7edc14abd78e68784048487e83a4b6908336ba3eacb5e9544d642ad60836f91fab16e1dc6ad9e493dfe6c2e5b65f370ec65454d415efa50361a76 + languageName: node + linkType: hard + +"readable-stream@npm:^2.2.2, readable-stream@npm:^2.3.3, readable-stream@npm:^2.3.7": version: 2.3.8 resolution: "readable-stream@npm:2.3.8" dependencies: @@ -11736,7 +12167,7 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^3.1.1, readable-stream@npm:^3.5.0, readable-stream@npm:^3.6.0": +"readable-stream@npm:^3.1.1, readable-stream@npm:^3.6.0": version: 3.6.2 resolution: "readable-stream@npm:3.6.2" dependencies: @@ -12002,6 +12433,19 @@ __metadata: languageName: node linkType: hard +"resolve@npm:^1.19.0": + version: 1.22.8 + resolution: "resolve@npm:1.22.8" + dependencies: + is-core-module: ^2.13.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: f8a26958aa572c9b064562750b52131a37c29d072478ea32e129063e2da7f83e31f7f11e7087a18225a8561cfe8d2f0df9dbea7c9d331a897571c0a2527dbb4c + languageName: node + linkType: hard + "resolve@npm:^2.0.0-next.4": version: 2.0.0-next.4 resolution: "resolve@npm:2.0.0-next.4" @@ -12044,6 +12488,19 @@ __metadata: languageName: node linkType: hard +"resolve@patch:resolve@^1.19.0#~builtin": + version: 1.22.8 + resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=07638b" + dependencies: + is-core-module: ^2.13.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: 5479b7d431cacd5185f8db64bfcb7286ae5e31eb299f4c4f404ad8aa6098b77599563ac4257cb2c37a42f59dfc06a1bec2bcf283bb448f319e37f0feb9a09847 + languageName: node + linkType: hard + "resolve@patch:resolve@^2.0.0-next.4#~builtin": version: 2.0.0-next.4 resolution: "resolve@patch:resolve@npm%3A2.0.0-next.4#~builtin::version=2.0.0-next.4&hash=07638b" @@ -12131,22 +12588,22 @@ __metadata: languageName: node linkType: hard -"rpc-websockets@npm:^7.5.1": - version: 7.6.0 - resolution: "rpc-websockets@npm:7.6.0" +"rollup-plugin-visualizer@npm:^5.9.2": + version: 5.12.0 + resolution: "rollup-plugin-visualizer@npm:5.12.0" dependencies: - "@babel/runtime": ^7.17.2 - bufferutil: ^4.0.1 - eventemitter3: ^4.0.7 - utf-8-validate: ^5.0.2 - uuid: ^8.3.2 - ws: ^8.5.0 - dependenciesMeta: - bufferutil: - optional: true - utf-8-validate: + open: ^8.4.0 + picomatch: ^2.3.1 + source-map: ^0.7.4 + yargs: ^17.5.1 + peerDependencies: + rollup: 2.x || 3.x || 4.x + peerDependenciesMeta: + rollup: optional: true - checksum: af2b254f65985610bd354e8e13de07b5a36010b94672b0b5a9d226b9bb1b8b17d01c63221cad97263845888f3610e55867a32e4c0017dfb92fddf89417c4cb6c + bin: + rollup-plugin-visualizer: dist/bin/cli.js + checksum: 17dc10a93d4bd457c8bb7796a57c284487fb00f4b9703a33a1a954f5d40c66a89b24aca98564569922456f4fa8f72281c3ef96a95502195e6930b3fac62fce8e languageName: node linkType: hard @@ -12175,15 +12632,6 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^6.6.3": - version: 6.6.7 - resolution: "rxjs@npm:6.6.7" - dependencies: - tslib: ^1.9.0 - checksum: bc334edef1bb8bbf56590b0b25734ba0deaf8825b703256a93714308ea36dff8a11d25533671adf8e104e5e8f256aa6fdfe39b2e248cdbd7a5f90c260acbbd1b - languageName: node - linkType: hard - "safe-array-concat@npm:^1.0.0, safe-array-concat@npm:^1.0.1": version: 1.0.1 resolution: "safe-array-concat@npm:1.0.1" @@ -12210,13 +12658,6 @@ __metadata: languageName: node linkType: hard -"safe-json-utils@npm:^1.1.1": - version: 1.1.1 - resolution: "safe-json-utils@npm:1.1.1" - checksum: f82a5833b7f6f25583c46520b3e158da3864d4f6f85b7cd68ec956ae7023395872e834d75f7f6216c109c546d10b6ee15c066d849f75ac2a7b86b8a041b4f01f - languageName: node - linkType: hard - "safe-regex-test@npm:^1.0.0": version: 1.0.0 resolution: "safe-regex-test@npm:1.0.0" @@ -12310,6 +12751,18 @@ __metadata: languageName: node linkType: hard +"secp256k1@npm:^5.0.0": + version: 5.0.0 + resolution: "secp256k1@npm:5.0.0" + dependencies: + elliptic: ^6.5.4 + node-addon-api: ^5.0.0 + node-gyp: latest + node-gyp-build: ^4.2.0 + checksum: a0719dff4687c38d385b5e0b7e811c51a4ea24893128be9d097aee99f879eb0ea52582590deb15a49da627a3db23c6b028ad5c9c6ac1fca92ce760153b8cf21c + languageName: node + linkType: hard + "semver@npm:6.3.1, semver@npm:^6.0.0, semver@npm:^6.3.0, semver@npm:^6.3.1": version: 6.3.1 resolution: "semver@npm:6.3.1" @@ -12523,6 +12976,28 @@ __metadata: languageName: node linkType: hard +"socket.io-client@npm:^4.5.1": + version: 4.7.4 + resolution: "socket.io-client@npm:4.7.4" + dependencies: + "@socket.io/component-emitter": ~3.1.0 + debug: ~4.3.2 + engine.io-client: ~6.5.2 + socket.io-parser: ~4.2.4 + checksum: 7254f441ff5bf82cc301204b71578eff083a701fb6e636b75a42092d7806ada3b58bbb9914e150c22f50606f5b4c7290a5951605c62ff59d6d59f1aad140ead7 + languageName: node + linkType: hard + +"socket.io-parser@npm:~4.2.4": + version: 4.2.4 + resolution: "socket.io-parser@npm:4.2.4" + dependencies: + "@socket.io/component-emitter": ~3.1.0 + debug: ~4.3.1 + checksum: 61540ef99af33e6a562b9effe0fad769bcb7ec6a301aba5a64b3a8bccb611a0abdbe25f469933ab80072582006a78ca136bf0ad8adff9c77c9953581285e2263 + languageName: node + linkType: hard + "socks-proxy-agent@npm:^7.0.0": version: 7.0.0 resolution: "socks-proxy-agent@npm:7.0.0" @@ -12621,7 +13096,7 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.5.0": +"source-map@npm:^0.5.0, source-map@npm:^0.5.7": version: 0.5.7 resolution: "source-map@npm:0.5.7" checksum: 5dc2043b93d2f194142c7f38f74a24670cd7a0063acdaf4bf01d2964b402257ae843c2a8fa822ad5b71013b5fcafa55af7421383da919752f22ff488bc553f4d @@ -12635,6 +13110,13 @@ __metadata: languageName: node linkType: hard +"source-map@npm:^0.7.4": + version: 0.7.4 + resolution: "source-map@npm:0.7.4" + checksum: 01cc5a74b1f0e1d626a58d36ad6898ea820567e87f18dfc9d24a9843a351aaa2ec09b87422589906d6ff1deed29693e176194dc88bcae7c9a852dc74b311dbf5 + languageName: node + linkType: hard + "source-map@npm:~0.2.0": version: 0.2.0 resolution: "source-map@npm:0.2.0" @@ -12746,16 +13228,6 @@ __metadata: languageName: node linkType: hard -"stream-browserify@npm:^3.0.0": - version: 3.0.0 - resolution: "stream-browserify@npm:3.0.0" - dependencies: - inherits: ~2.0.4 - readable-stream: ^3.5.0 - checksum: 4c47ef64d6f03815a9ca3874e2319805e8e8a85f3550776c47ce523b6f4c6cd57f40e46ec6a9ab8ad260fde61863c2718f250d3bedb3fe9052444eb9abfd9921 - languageName: node - linkType: hard - "stream-shift@npm:^1.0.0": version: 1.0.1 resolution: "stream-shift@npm:1.0.1" @@ -12913,6 +13385,15 @@ __metadata: languageName: node linkType: hard +"string_decoder@npm:~1.0.3": + version: 1.0.3 + resolution: "string_decoder@npm:1.0.3" + dependencies: + safe-buffer: ~5.1.0 + checksum: 57ef02a148fd1ff2f20fe1accd944505ed3703e78bb28d302d940b2ad3dfb469508f79dcd0275ba1960d9675aa206452f76b2416059a6d0b0200bd7e9f552cdb + languageName: node + linkType: hard + "string_decoder@npm:~1.1.1": version: 1.1.1 resolution: "string_decoder@npm:1.1.1" @@ -13018,6 +13499,13 @@ __metadata: languageName: node linkType: hard +"stylis@npm:4.2.0": + version: 4.2.0 + resolution: "stylis@npm:4.2.0" + checksum: 0eb6cc1b866dc17a6037d0a82ac7fa877eba6a757443e79e7c4f35bacedbf6421fadcab4363b39667b43355cbaaa570a3cde850f776498e5450f32ed2f9b7584 + languageName: node + linkType: hard + "sucrase@npm:^3.32.0": version: 3.34.0 resolution: "sucrase@npm:3.34.0" @@ -13036,13 +13524,6 @@ __metadata: languageName: node linkType: hard -"superstruct@npm:^0.14.2": - version: 0.14.2 - resolution: "superstruct@npm:0.14.2" - checksum: c5c4840f432da82125b923ec45faca5113217e83ae416e314d80eae012b8bb603d2e745025d173450758d116348820bc7028157f8c9a72b6beae879f94b837c0 - languageName: node - linkType: hard - "superstruct@npm:^1.0.3": version: 1.0.3 resolution: "superstruct@npm:1.0.3" @@ -13216,13 +13697,6 @@ __metadata: languageName: node linkType: hard -"text-encoding-utf-8@npm:^1.0.2": - version: 1.0.2 - resolution: "text-encoding-utf-8@npm:1.0.2" - checksum: ec4c15d50e738c5dba7327ad432ebf0725ec75d4d69c0bd55609254c5a3bc5341272d7003691084a0a73d60d981c8eb0e87603676fdb6f3fed60f4c9192309f9 - languageName: node - linkType: hard - "text-table@npm:^0.2.0": version: 0.2.0 resolution: "text-table@npm:0.2.0" @@ -13276,13 +13750,6 @@ __metadata: languageName: node linkType: hard -"through@npm:>=2.2.7 <3": - version: 2.3.8 - resolution: "through@npm:2.3.8" - checksum: a38c3e059853c494af95d50c072b83f8b676a9ba2818dcc5b108ef252230735c54e0185437618596c790bbba8fcdaef5b290405981ffa09dce67b1f1bf190cbd - languageName: node - linkType: hard - "time-span@npm:4.0.0": version: 4.0.0 resolution: "time-span@npm:4.0.0" @@ -13491,7 +13958,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:1.14.1, tslib@npm:^1.8.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3": +"tslib@npm:1.14.1, tslib@npm:^1.8.1, tslib@npm:^1.9.3": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd @@ -13689,15 +14156,6 @@ __metadata: languageName: node linkType: hard -"typedarray-to-buffer@npm:3.1.5": - version: 3.1.5 - resolution: "typedarray-to-buffer@npm:3.1.5" - dependencies: - is-typedarray: ^1.0.0 - checksum: 99c11aaa8f45189fcfba6b8a4825fd684a321caa9bd7a76a27cf0c7732c174d198b99f449c52c3818107430b5f41c0ccbbfb75cb2ee3ca4a9451710986d61a60 - languageName: node - linkType: hard - "typedarray@npm:^0.0.6": version: 0.0.6 resolution: "typedarray@npm:0.0.6" @@ -13848,6 +14306,13 @@ __metadata: languageName: node linkType: hard +"unfetch@npm:^4.2.0": + version: 4.2.0 + resolution: "unfetch@npm:4.2.0" + checksum: 6a4b2557e1d921eaa80c4425ce27a404945ec26491ed06e62598f333996a91a44c7908cb26dc7c2746d735762b13276cf4aa41829b4c8f438dde63add3045d7a + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0" @@ -14027,7 +14492,7 @@ __metadata: languageName: node linkType: hard -"use-sync-external-store@npm:1.2.0, use-sync-external-store@npm:^1.2.0": +"use-sync-external-store@npm:1.2.0": version: 1.2.0 resolution: "use-sync-external-store@npm:1.2.0" peerDependencies: @@ -14056,13 +14521,13 @@ __metadata: languageName: node linkType: hard -"utf-8-validate@npm:^5.0.2": - version: 5.0.10 - resolution: "utf-8-validate@npm:5.0.10" +"utf-8-validate@npm:^6.0.3": + version: 6.0.3 + resolution: "utf-8-validate@npm:6.0.3" dependencies: node-gyp: latest node-gyp-build: ^4.3.0 - checksum: 5579350a023c66a2326752b6c8804cc7b39dcd251bb088241da38db994b8d78352e388dcc24ad398ab98385ba3c5ffcadb6b5b14b2637e43f767869055e46ba6 + checksum: 5e21383c81ff7469c1912119ca69d07202d944c73ddd8a54b84dddcc546b939054e5101c78c294e494d206fe93bd43428adc635a0660816b3ec9c8ec89286ac4 languageName: node linkType: hard @@ -14186,9 +14651,31 @@ __metadata: languageName: node linkType: hard -"viem@npm:1.19.9": - version: 1.19.9 - resolution: "viem@npm:1.19.9" +"viem@npm:^1.0.0": + version: 1.12.2 + resolution: "viem@npm:1.12.2" + dependencies: + "@adraffy/ens-normalize": 1.9.4 + "@noble/curves": 1.2.0 + "@noble/hashes": 1.3.2 + "@scure/bip32": 1.3.2 + "@scure/bip39": 1.2.1 + "@types/ws": ^8.5.5 + abitype: 0.9.8 + isomorphic-ws: 5.0.0 + ws: 8.13.0 + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 558bc2b46afb177a34356f3cc8e6e444f4a6bf4d8aa15658f95eecc1bb42bbc09f240a1fd8eae98fa4973c3a1dc34f0492034b4b4d182f65b2dadf80167c8cea + languageName: node + linkType: hard + +"viem@npm:^1.1.4": + version: 1.21.4 + resolution: "viem@npm:1.21.4" dependencies: "@adraffy/ens-normalize": 1.10.0 "@noble/curves": 1.2.0 @@ -14203,50 +14690,54 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: a18633f42f8075b16819b6914f5236c726875407e8e3741b1434af48193ac5a7c12cbe1e1522b0e13df7af4dd4c5daeea2371a21f9338f27c271700a7f6d1595 + checksum: c351fdea2d53d2d781ac73c964348b3b9fc5dd46f9eb53903e867705fc9e30a893cb9f2c8d7a00acdcdeca27d14eeebf976eed9f948c28c47018dc9211369117 languageName: node linkType: hard -"viem@npm:^1.0.0": - version: 1.12.2 - resolution: "viem@npm:1.12.2" +"viem@npm:^2.5.0": + version: 2.5.0 + resolution: "viem@npm:2.5.0" dependencies: - "@adraffy/ens-normalize": 1.9.4 + "@adraffy/ens-normalize": 1.10.0 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 "@scure/bip32": 1.3.2 "@scure/bip39": 1.2.1 - "@types/ws": ^8.5.5 - abitype: 0.9.8 - isomorphic-ws: 5.0.0 + abitype: 1.0.0 + isows: 1.0.3 ws: 8.13.0 peerDependencies: typescript: ">=5.0.4" peerDependenciesMeta: typescript: optional: true - checksum: 558bc2b46afb177a34356f3cc8e6e444f4a6bf4d8aa15658f95eecc1bb42bbc09f240a1fd8eae98fa4973c3a1dc34f0492034b4b4d182f65b2dadf80167c8cea + checksum: 108355b0384b6b7172ccee85a88cc34a95030b7f8508a09e506f306fdac2c94e4fad020f4ea2beff746ca2d344a1e01b5496bfa363d7c64a7db1044e3f246230 + languageName: node + linkType: hard + +"void-elements@npm:3.1.0": + version: 3.1.0 + resolution: "void-elements@npm:3.1.0" + checksum: 0390f818107fa8fce55bb0a5c3f661056001c1d5a2a48c28d582d4d847347c2ab5b7f8272314cac58acf62345126b6b09bea623a185935f6b1c3bbce0dfd7f7f languageName: node linkType: hard -"wagmi@npm:1.4.12": - version: 1.4.12 - resolution: "wagmi@npm:1.4.12" +"wagmi@npm:^2.5.0": + version: 2.5.0 + resolution: "wagmi@npm:2.5.0" dependencies: - "@tanstack/query-sync-storage-persister": ^4.27.1 - "@tanstack/react-query": ^4.28.0 - "@tanstack/react-query-persist-client": ^4.28.0 - "@wagmi/core": 1.4.12 - abitype: 0.8.7 - use-sync-external-store: ^1.2.0 + "@wagmi/connectors": 4.1.8 + "@wagmi/core": 2.5.0 + use-sync-external-store: 1.2.0 peerDependencies: - react: ">=17.0.0" + "@tanstack/react-query": ">=5.0.0" + react: ">=18" typescript: ">=5.0.4" - viem: ">=0.3.35" + viem: 2.x peerDependenciesMeta: typescript: optional: true - checksum: 7c1cb64c53e29899d508142e43a450b07f7f4f0ac2a19f5651f0f3dbfe2bb5b159d2b6251f6f613bd9bae007dc8390383ff79f5ab7bdf8d06788fe0bbdb3f8ab + checksum: f7cbfd5cdfa23ed5c73be1d2c8ba6fdf70333fa24214ce11c60b33f46ddf5adeb2201ff3eae7b8b8629b84e8562ccdd007f2490e9d8ee468880bf4b9873faf77 languageName: node linkType: hard @@ -14283,6 +14774,29 @@ __metadata: languageName: node linkType: hard +"webextension-polyfill-ts@npm:^0.25.0": + version: 0.25.0 + resolution: "webextension-polyfill-ts@npm:0.25.0" + dependencies: + webextension-polyfill: ^0.7.0 + checksum: c4dc82c86e34cea717a26af549f2822d63e92af52632f5e909ea13b5e7bd9d6110781f10313e36ada2b54c770ebca018bc3784756d12ba3b0b623d285f1a14a7 + languageName: node + linkType: hard + +"webextension-polyfill@npm:>=0.10.0 <1.0": + version: 0.10.0 + resolution: "webextension-polyfill@npm:0.10.0" + checksum: 4a59036bda571360c2c0b2fb03fe1dc244f233946bcf9a6766f677956c40fd14d270aaa69cdba95e4ac521014afbe4008bfa5959d0ac39f91c990eb206587f91 + languageName: node + linkType: hard + +"webextension-polyfill@npm:^0.7.0": + version: 0.7.0 + resolution: "webextension-polyfill@npm:0.7.0" + checksum: fb738a5de07feb593875e02f25c3ab4276c8736118929556c8d4bdf965bb0f11c96ea263cd397b9b21259e8faf2dce2eaaa42ce08c922d96de7adb5896ec7d10 + languageName: node + linkType: hard + "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" @@ -14532,7 +15046,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7.4.5, ws@npm:^7.4.6, ws@npm:^7.5.1": +"ws@npm:^7.4.6, ws@npm:^7.5.1": version: 7.5.9 resolution: "ws@npm:7.5.9" peerDependencies: @@ -14547,18 +15061,18 @@ __metadata: languageName: node linkType: hard -"ws@npm:^8.5.0": - version: 8.14.2 - resolution: "ws@npm:8.14.2" +"ws@npm:~8.11.0": + version: 8.11.0 + resolution: "ws@npm:8.11.0" peerDependencies: bufferutil: ^4.0.1 - utf-8-validate: ">=5.0.2" + utf-8-validate: ^5.0.2 peerDependenciesMeta: bufferutil: optional: true utf-8-validate: optional: true - checksum: 3ca0dad26e8cc6515ff392b622a1467430814c463b3368b0258e33696b1d4bed7510bc7030f7b72838b9fdeb8dbd8839cbf808367d6aae2e1d668ce741d4308b + checksum: 316b33aba32f317cd217df66dbfc5b281a2f09ff36815de222bc859e3424d83766d9eb2bd4d667de658b6ab7be151f258318fb1da812416b30be13103e5b5c67 languageName: node linkType: hard @@ -14580,6 +15094,13 @@ __metadata: languageName: node linkType: hard +"xmlhttprequest-ssl@npm:~2.0.0": + version: 2.0.0 + resolution: "xmlhttprequest-ssl@npm:2.0.0" + checksum: 1e98df67f004fec15754392a131343ea92e6ab5ac4d77e842378c5c4e4fd5b6a9134b169d96842cc19422d77b1606b8df84a5685562b3b698cb68441636f827e + languageName: node + linkType: hard + "xmlhttprequest@npm:1.8.0": version: 1.8.0 resolution: "xmlhttprequest@npm:1.8.0" @@ -14629,6 +15150,13 @@ __metadata: languageName: node linkType: hard +"yaml@npm:^1.10.0": + version: 1.10.2 + resolution: "yaml@npm:1.10.2" + checksum: ce4ada136e8a78a0b08dc10b4b900936912d15de59905b2bf415b4d33c63df1d555d23acb2a41b23cf9fb5da41c256441afca3d6509de7247daa062fd2c5ea5f + languageName: node + linkType: hard + "yaml@npm:^2.1.1": version: 2.3.2 resolution: "yaml@npm:2.3.2" @@ -14670,6 +15198,13 @@ __metadata: languageName: node linkType: hard +"yargs-parser@npm:^21.1.1": + version: 21.1.1 + resolution: "yargs-parser@npm:21.1.1" + checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c + languageName: node + linkType: hard + "yargs-unparser@npm:1.6.0": version: 1.6.0 resolution: "yargs-unparser@npm:1.6.0" @@ -14745,6 +15280,21 @@ __metadata: languageName: node linkType: hard +"yargs@npm:^17.5.1": + version: 17.7.2 + resolution: "yargs@npm:17.7.2" + dependencies: + cliui: ^8.0.1 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.3 + y18n: ^5.0.5 + yargs-parser: ^21.1.1 + checksum: 73b572e863aa4a8cbef323dd911d79d193b772defd5a51aab0aca2d446655216f5002c42c5306033968193bdbf892a7a4c110b0d77954a7fdf563e653967b56a + languageName: node + linkType: hard + "yauzl-clone@npm:^1.0.4": version: 1.0.4 resolution: "yauzl-clone@npm:1.0.4" @@ -14797,7 +15347,7 @@ __metadata: languageName: node linkType: hard -"zustand@npm:^4.1.2, zustand@npm:^4.3.1": +"zustand@npm:4.4.1, zustand@npm:^4.1.2": version: 4.4.1 resolution: "zustand@npm:4.4.1" dependencies: From dfb5b0e62319427a9b22e32b640116b8a630508a Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 23 Jan 2024 21:30:00 +0530 Subject: [PATCH 02/68] lock viem & wagmi version --- packages/nextjs/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 57b2ec0ed..bdb45cf20 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -31,8 +31,8 @@ "react-hot-toast": "^2.4.0", "use-debounce": "^8.0.4", "usehooks-ts": "^2.7.2", - "viem": "^2.5.0", - "wagmi": "^2.5.0", + "viem": "2.5.0", + "wagmi": "2.5.0", "zustand": "^4.1.2" }, "devDependencies": { From fa16eddde2280c31dc3da5e0ca62ffc6cb390a41 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 24 Jan 2024 09:24:58 +0530 Subject: [PATCH 03/68] update provider wrapper with new wagmi updates --- .../ScaffoldEthAppWithProviders.tsx | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx index 1eb3bd3a9..4853c6faa 100644 --- a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx +++ b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx @@ -2,8 +2,9 @@ import { useEffect } from "react"; import { RainbowKitProvider, darkTheme, lightTheme } from "@rainbow-me/rainbowkit"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { Toaster } from "react-hot-toast"; -import { WagmiConfig } from "wagmi"; +import { WagmiProvider } from "wagmi"; import { Footer } from "~~/components/Footer"; import { Header } from "~~/components/Header"; import { BlockieAvatar } from "~~/components/scaffold-eth"; @@ -36,19 +37,23 @@ const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => { ); }; +const queryClient = new QueryClient(); + export const ScaffoldEthAppWithProviders = ({ children }: { children: React.ReactNode }) => { const { isDarkMode } = useDarkMode(); return ( - - - - {children} - - + + + + + {children} + + + ); }; From fd2f89811168ad322e505acb7ac6b0ff6fbfcb95 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 24 Jan 2024 12:02:10 +0530 Subject: [PATCH 04/68] fix AddressType --- packages/nextjs/types/abitype/abi.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/types/abitype/abi.d.ts b/packages/nextjs/types/abitype/abi.d.ts index 8b1301a76..284937a82 100644 --- a/packages/nextjs/types/abitype/abi.d.ts +++ b/packages/nextjs/types/abitype/abi.d.ts @@ -3,13 +3,13 @@ import "abitype"; type AddressType = string; declare module "viem/node_modules/abitype" { - export interface Config { + export interface Register { AddressType: AddressType; } } declare module "abitype" { - export interface Config { + export interface Register { AddressType: AddressType; } } From 15c723067f474f78cd91c8d712c3debd259b18da Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 24 Jan 2024 13:27:12 +0530 Subject: [PATCH 05/68] viem v2 migrationchanges --- .../hooks/scaffold-eth/useScaffoldContract.ts | 17 ++++++++++------- .../utils/scaffold-eth/fetchPriceFromUniswap.ts | 5 +++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts index a97d67416..459c51ca0 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts @@ -1,6 +1,6 @@ -import { Account, Address, Chain, Transport, getContract } from "viem"; -import { PublicClient, usePublicClient } from "wagmi"; -import { GetWalletClientResult } from "wagmi/actions"; +import { Account, Address, Chain, Client, Transport, getContract } from "viem"; +import { usePublicClient } from "wagmi"; +import { GetWalletClientReturnType } from "wagmi/actions"; import { useDeployedContractInfo } from "~~/hooks/scaffold-eth"; import { Contract, ContractName } from "~~/utils/scaffold-eth/contract"; @@ -13,7 +13,7 @@ import { Contract, ContractName } from "~~/utils/scaffold-eth/contract"; */ export const useScaffoldContract = < TContractName extends ContractName, - TWalletClient extends Exclude | undefined, + TWalletClient extends Exclude | undefined, >({ contractName, walletClient, @@ -30,13 +30,16 @@ export const useScaffoldContract = < Transport, Address, Contract["abi"], + { + public: Client; + wallet?: Client; + }, Chain, - Account, - PublicClient, - TWalletClient + Account >({ address: deployedContractData.address, abi: deployedContractData.abi as Contract["abi"], + // @ts-expect-error TODO: fix this type walletClient: walletClient ? walletClient : undefined, publicClient, }); diff --git a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts index 5a94ebd3a..d46095ddc 100644 --- a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts +++ b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts @@ -1,13 +1,14 @@ import { CurrencyAmount, Token } from "@uniswap/sdk-core"; import { Pair, Route } from "@uniswap/v2-sdk"; import { Address, createPublicClient, http, parseAbi } from "viem"; -import { mainnet } from "wagmi"; +import { mainnet } from "viem/chains"; import scaffoldConfig from "~~/scaffold.config"; import { ChainWithAttributes } from "~~/utils/scaffold-eth"; const publicClient = createPublicClient({ chain: mainnet, - transport: http(`${mainnet.rpcUrls.alchemy.http[0]}/${scaffoldConfig.alchemyApiKey}`), + // TODO: Since viem/chains removed alchemy links find a better way to handle this + transport: http(`https://eth-mainnet.g.alchemy.com/v2/${scaffoldConfig.alchemyApiKey}`), }); const ABI = parseAbi([ From 21956318e0e6ed249e2072d10e19fb9c8045f218 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 24 Jan 2024 20:38:05 +0530 Subject: [PATCH 06/68] update wagmiConfig and wagmiConnectors files --- packages/nextjs/services/web3/wagmiConfig.tsx | 22 ++++++++-- .../nextjs/services/web3/wagmiConnectors.tsx | 43 ++++--------------- 2 files changed, 27 insertions(+), 38 deletions(-) diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index 240aea0f0..3a47785be 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -1,8 +1,22 @@ +import { enabledChains } from "./wagmiConnectors"; +import { createClient, http } from "viem"; +import { hardhat } from "viem/chains"; import { createConfig } from "wagmi"; -import { appChains, wagmiConnectors } from "~~/services/web3/wagmiConnectors"; +import scaffoldConfig from "~~/scaffold.config"; export const wagmiConfig = createConfig({ - autoConnect: false, - connectors: wagmiConnectors, - publicClient: appChains.publicClient, + // TODO: Maybe we should get literal value here currently TS has widened the types because of ensabledChains logic + chains: enabledChains, + client({ chain }) { + return createClient({ + chain, + // TODO: Create a file for alchmey links mapping and use fallback transport array so if alchmey fails fallbakc to default chain rpc + transport: http(), + ...(chain.id === hardhat.id + ? { + pollingInterval: scaffoldConfig.pollingInterval, + } + : {}), + }); + }, }); diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx index 1d42e30de..3b4f9fa74 100644 --- a/packages/nextjs/services/web3/wagmiConnectors.tsx +++ b/packages/nextjs/services/web3/wagmiConnectors.tsx @@ -9,56 +9,31 @@ import { walletConnectWallet, } from "@rainbow-me/rainbowkit/wallets"; import * as chains from "viem/chains"; -import { configureChains } from "wagmi"; -import { alchemyProvider } from "wagmi/providers/alchemy"; -import { publicProvider } from "wagmi/providers/public"; import scaffoldConfig from "~~/scaffold.config"; import { burnerWalletConfig } from "~~/services/web3/wagmi-burner/burnerWalletConfig"; -import { getTargetNetworks } from "~~/utils/scaffold-eth"; -const targetNetworks = getTargetNetworks(); -const { onlyLocalBurnerWallet } = scaffoldConfig; +const { targetNetworks, onlyLocalBurnerWallet } = scaffoldConfig; // We always want to have mainnet enabled (ENS resolution, ETH price, etc). But only once. -const enabledChains = targetNetworks.find(network => network.id === 1) +export const enabledChains = targetNetworks.find((network: chains.Chain) => network.id === 1) ? targetNetworks - : [...targetNetworks, chains.mainnet]; + : ([...targetNetworks, chains.mainnet] as const); -/** - * Chains for the app - */ -export const appChains = configureChains( - enabledChains, - [ - alchemyProvider({ - apiKey: scaffoldConfig.alchemyApiKey, - }), - publicProvider(), - ], - { - // We might not need this checkout https://github.com/scaffold-eth/scaffold-eth-2/pull/45#discussion_r1024496359, will test and remove this before merging - stallTimeout: 3_000, - // Sets pollingInterval if using chains other than local hardhat chain - ...(targetNetworks.find(network => network.id !== chains.hardhat.id) - ? { - pollingInterval: scaffoldConfig.pollingInterval, - } - : {}), - }, -); - -const walletsOptions = { chains: appChains.chains, projectId: scaffoldConfig.walletConnectProjectId }; +const walletsOptions = { chains: enabledChains, projectId: scaffoldConfig.walletConnectProjectId }; const wallets = [ metaMaskWallet({ ...walletsOptions, shimDisconnect: true }), - walletConnectWallet(walletsOptions), + // @ts-expect-error TODO: fix types + walletConnectWallet({ ...walletsOptions }), + // @ts-expect-error TODO: fix types ledgerWallet(walletsOptions), braveWallet(walletsOptions), + // @ts-expect-error TODO: fix types coinbaseWallet({ ...walletsOptions, appName: "scaffold-eth-2" }), rainbowWallet(walletsOptions), ...(!targetNetworks.some(network => network.id !== chains.hardhat.id) || !onlyLocalBurnerWallet ? [ burnerWalletConfig({ - chains: appChains.chains.filter(chain => targetNetworks.map(({ id }) => id).includes(chain.id)), + chains: enabledChains.filter((chain: any) => targetNetworks.map(({ id }) => id).includes(chain.id)), }), ] : []), From 07922d61777d4e04c599ce021243e070d3f875f0 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 24 Jan 2024 21:34:25 +0530 Subject: [PATCH 07/68] use rainbowkit beta and get yarn start working --- .../ScaffoldEthAppWithProviders.tsx | 7 +- .../nextjs/components/scaffold-eth/Faucet.tsx | 4 +- .../components/scaffold-eth/FaucetButton.tsx | 6 +- .../NetworkOptions.tsx | 8 +- .../RainbowKitCustomConnectButton/index.tsx | 5 +- packages/nextjs/hooks/scaffold-eth/index.ts | 2 +- .../hooks/scaffold-eth/useTargetNetwork.ts | 4 +- packages/nextjs/package.json | 2 +- .../nextjs/services/web3/wagmiConnectors.tsx | 45 ++--- yarn.lock | 173 ++++++++---------- 10 files changed, 109 insertions(+), 147 deletions(-) diff --git a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx index 4853c6faa..ae0eb1488 100644 --- a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx +++ b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx @@ -13,7 +13,6 @@ import { useNativeCurrencyPrice } from "~~/hooks/scaffold-eth"; import { useDarkMode } from "~~/hooks/scaffold-eth/useDarkMode"; import { useGlobalState } from "~~/services/store/store"; import { wagmiConfig } from "~~/services/web3/wagmiConfig"; -import { appChains } from "~~/services/web3/wagmiConnectors"; const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => { const price = useNativeCurrencyPrice(); @@ -46,11 +45,7 @@ export const ScaffoldEthAppWithProviders = ({ children }: { children: React.Reac - + {children} diff --git a/packages/nextjs/components/scaffold-eth/Faucet.tsx b/packages/nextjs/components/scaffold-eth/Faucet.tsx index d66bcb188..f7b449837 100644 --- a/packages/nextjs/components/scaffold-eth/Faucet.tsx +++ b/packages/nextjs/components/scaffold-eth/Faucet.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from "react"; import { Address as AddressType, createWalletClient, http, parseEther } from "viem"; import { hardhat } from "viem/chains"; -import { useNetwork } from "wagmi"; +import { useAccount } from "wagmi"; import { BanknotesIcon } from "@heroicons/react/24/outline"; import { Address, AddressInput, Balance, EtherInput } from "~~/components/scaffold-eth"; import { useTransactor } from "~~/hooks/scaffold-eth"; @@ -26,7 +26,7 @@ export const Faucet = () => { const [faucetAddress, setFaucetAddress] = useState(); const [sendValue, setSendValue] = useState(""); - const { chain: ConnectedChain } = useNetwork(); + const { chain: ConnectedChain } = useAccount(); const faucetTxn = useTransactor(localWalletClient); diff --git a/packages/nextjs/components/scaffold-eth/FaucetButton.tsx b/packages/nextjs/components/scaffold-eth/FaucetButton.tsx index b582a77ec..4b49df0ea 100644 --- a/packages/nextjs/components/scaffold-eth/FaucetButton.tsx +++ b/packages/nextjs/components/scaffold-eth/FaucetButton.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; import { createWalletClient, http, parseEther } from "viem"; import { hardhat } from "viem/chains"; -import { useAccount, useNetwork } from "wagmi"; +import { useAccount } from "wagmi"; import { BanknotesIcon } from "@heroicons/react/24/outline"; import { useAccountBalance, useTransactor } from "~~/hooks/scaffold-eth"; @@ -20,11 +20,9 @@ const localWalletClient = createWalletClient({ * FaucetButton button which lets you grab eth. */ export const FaucetButton = () => { - const { address } = useAccount(); + const { address, chain: ConnectedChain } = useAccount(); const { balance } = useAccountBalance(address); - const { chain: ConnectedChain } = useNetwork(); - const [loading, setLoading] = useState(false); const faucetTxn = useTransactor(localWalletClient); diff --git a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx index b81fe1a3e..ead91e3dd 100644 --- a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx +++ b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx @@ -1,4 +1,4 @@ -import { useNetwork, useSwitchNetwork } from "wagmi"; +import { useAccount, useSwitchChain } from "wagmi"; import { ArrowsRightLeftIcon } from "@heroicons/react/24/solid"; import { getNetworkColor } from "~~/hooks/scaffold-eth"; import { useDarkMode } from "~~/hooks/scaffold-eth/useDarkMode"; @@ -12,8 +12,8 @@ type NetworkOptionsProps = { export const NetworkOptions = ({ hidden = false }: NetworkOptionsProps) => { const { isDarkMode } = useDarkMode(); - const { switchNetwork } = useSwitchNetwork(); - const { chain } = useNetwork(); + const { switchChain } = useSwitchChain(); + const { chain } = useAccount(); return ( <> @@ -25,7 +25,7 @@ export const NetworkOptions = ({ hidden = false }: NetworkOptionsProps) => { className="menu-item btn-sm !rounded-xl flex gap-3 py-3 whitespace-nowrap" type="button" onClick={() => { - switchNetwork?.(allowedNetwork.id); + switchChain?.({ chainId: allowedNetwork.id }); }} > diff --git a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx index d0d60403e..902bd0933 100644 --- a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx +++ b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx @@ -7,7 +7,7 @@ import { AddressQRCodeModal } from "./AddressQRCodeModal"; import { WrongNetworkDropdown } from "./WrongNetworkDropdown"; import { ConnectButton } from "@rainbow-me/rainbowkit"; import { Address } from "viem"; -import { useAutoConnect, useNetworkColor } from "~~/hooks/scaffold-eth"; +import { useNetworkColor } from "~~/hooks/scaffold-eth"; import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; import { getBlockExplorerAddressLink } from "~~/utils/scaffold-eth"; @@ -15,7 +15,8 @@ import { getBlockExplorerAddressLink } from "~~/utils/scaffold-eth"; * Custom Wagmi Connect Button (watch balance + custom design) */ export const RainbowKitCustomConnectButton = () => { - useAutoConnect(); + // TODO: Add back autoconnect or use wagmi default autconnect should work + // useAutoConnect(); const networkColor = useNetworkColor(); const { targetNetwork } = useTargetNetwork(); diff --git a/packages/nextjs/hooks/scaffold-eth/index.ts b/packages/nextjs/hooks/scaffold-eth/index.ts index 10862fff1..fb94bff78 100644 --- a/packages/nextjs/hooks/scaffold-eth/index.ts +++ b/packages/nextjs/hooks/scaffold-eth/index.ts @@ -13,4 +13,4 @@ export * from "./useScaffoldEventHistory"; export * from "./useTransactor"; export * from "./useFetchBlocks"; export * from "./useContractLogs"; -export * from "./useAutoConnect"; +// export * from "./useAutoConnect"; diff --git a/packages/nextjs/hooks/scaffold-eth/useTargetNetwork.ts b/packages/nextjs/hooks/scaffold-eth/useTargetNetwork.ts index e2f318bf6..97f15db99 100644 --- a/packages/nextjs/hooks/scaffold-eth/useTargetNetwork.ts +++ b/packages/nextjs/hooks/scaffold-eth/useTargetNetwork.ts @@ -1,5 +1,5 @@ import { useEffect } from "react"; -import { useNetwork } from "wagmi"; +import { useAccount } from "wagmi"; import scaffoldConfig from "~~/scaffold.config"; import { useGlobalState } from "~~/services/store/store"; import { ChainWithAttributes } from "~~/utils/scaffold-eth"; @@ -9,7 +9,7 @@ import { NETWORKS_EXTRA_DATA } from "~~/utils/scaffold-eth"; * Retrieves the connected wallet's network from scaffold.config or defaults to the 0th network in the list if the wallet is not connected. */ export function useTargetNetwork(): { targetNetwork: ChainWithAttributes } { - const { chain } = useNetwork(); + const { chain } = useAccount(); const targetNetwork = useGlobalState(({ targetNetwork }) => targetNetwork); const setTargetNetwork = useGlobalState(({ setTargetNetwork }) => setTargetNetwork); diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index bdb45cf20..489ac342b 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -16,7 +16,7 @@ "dependencies": { "@ethersproject/providers": "^5.7.2", "@heroicons/react": "^2.0.11", - "@rainbow-me/rainbowkit": "1.3.0", + "@rainbow-me/rainbowkit": "beta", "@tanstack/react-query": "^5.17.19", "@uniswap/sdk-core": "^4.0.1", "@uniswap/v2-sdk": "^3.0.1", diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx index 3b4f9fa74..13e09eb2c 100644 --- a/packages/nextjs/services/web3/wagmiConnectors.tsx +++ b/packages/nextjs/services/web3/wagmiConnectors.tsx @@ -1,51 +1,40 @@ import { connectorsForWallets } from "@rainbow-me/rainbowkit"; import { - braveWallet, coinbaseWallet, ledgerWallet, metaMaskWallet, rainbowWallet, - safeWallet, walletConnectWallet, } from "@rainbow-me/rainbowkit/wallets"; import * as chains from "viem/chains"; import scaffoldConfig from "~~/scaffold.config"; -import { burnerWalletConfig } from "~~/services/web3/wagmi-burner/burnerWalletConfig"; -const { targetNetworks, onlyLocalBurnerWallet } = scaffoldConfig; +// import { burnerWalletConfig } from "~~/services/web3/wagmi-burner/burnerWalletConfig"; + +// const { targetNetworks, onlyLocalBurnerWallet } = scaffoldConfig; +const { targetNetworks } = scaffoldConfig; // We always want to have mainnet enabled (ENS resolution, ETH price, etc). But only once. export const enabledChains = targetNetworks.find((network: chains.Chain) => network.id === 1) ? targetNetworks : ([...targetNetworks, chains.mainnet] as const); -const walletsOptions = { chains: enabledChains, projectId: scaffoldConfig.walletConnectProjectId }; -const wallets = [ - metaMaskWallet({ ...walletsOptions, shimDisconnect: true }), - // @ts-expect-error TODO: fix types - walletConnectWallet({ ...walletsOptions }), - // @ts-expect-error TODO: fix types - ledgerWallet(walletsOptions), - braveWallet(walletsOptions), - // @ts-expect-error TODO: fix types - coinbaseWallet({ ...walletsOptions, appName: "scaffold-eth-2" }), - rainbowWallet(walletsOptions), - ...(!targetNetworks.some(network => network.id !== chains.hardhat.id) || !onlyLocalBurnerWallet - ? [ - burnerWalletConfig({ - chains: enabledChains.filter((chain: any) => targetNetworks.map(({ id }) => id).includes(chain.id)), - }), - ] - : []), - safeWallet({ ...walletsOptions }), -]; +// TODO: Get add burner wallet and get it working +const wallets = [metaMaskWallet, walletConnectWallet, ledgerWallet, coinbaseWallet, rainbowWallet]; /** * wagmi connectors for the wagmi context */ -export const wagmiConnectors = connectorsForWallets([ +export const wagmiConnectors = connectorsForWallets( + [ + { + groupName: "Supported Wallets", + wallets, + }, + ], + { - groupName: "Supported Wallets", - wallets, + appName: "scaffold-eth-2", + projectId: scaffoldConfig.walletConnectProjectId, }, -]); +); diff --git a/yarn.lock b/yarn.lock index 528c6305c..e724a9cda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -376,14 +376,7 @@ __metadata: languageName: node linkType: hard -"@emotion/hash@npm:^0.8.0": - version: 0.8.0 - resolution: "@emotion/hash@npm:0.8.0" - checksum: 4b35d88a97e67275c1d990c96d3b0450451d089d1508619488fc0acb882cb1ac91e93246d471346ebd1b5402215941ef4162efe5b51534859b39d8b3a0e3ffaa - languageName: node - linkType: hard - -"@emotion/hash@npm:^0.9.1": +"@emotion/hash@npm:^0.9.0, @emotion/hash@npm:^0.9.1": version: 0.9.1 resolution: "@emotion/hash@npm:0.9.1" checksum: 716e17e48bf9047bf9383982c071de49f2615310fb4e986738931776f5a823bc1f29c84501abe0d3df91a3803c80122d24e28b57351bca9e01356ebb33d89876 @@ -2067,24 +2060,24 @@ __metadata: languageName: node linkType: hard -"@rainbow-me/rainbowkit@npm:1.3.0": - version: 1.3.0 - resolution: "@rainbow-me/rainbowkit@npm:1.3.0" +"@rainbow-me/rainbowkit@npm:beta": + version: 2.0.0-beta.2 + resolution: "@rainbow-me/rainbowkit@npm:2.0.0-beta.2" dependencies: - "@vanilla-extract/css": 1.9.1 - "@vanilla-extract/dynamic": 2.0.2 - "@vanilla-extract/sprinkles": 1.5.0 - clsx: 1.1.1 + "@vanilla-extract/css": 1.14.0 + "@vanilla-extract/dynamic": 2.1.0 + "@vanilla-extract/sprinkles": 1.6.1 + clsx: 2.1.0 i18n-js: ^4.3.2 - qrcode: 1.5.0 - react-remove-scroll: 2.5.4 - ua-parser-js: ^1.0.35 + qrcode: 1.5.3 + react-remove-scroll: 2.5.7 + ua-parser-js: ^1.0.37 peerDependencies: react: ">=17" react-dom: ">=17" - viem: ~0.3.19 || ^1.0.0 - wagmi: ~1.0.1 || ~1.1.0 || ~1.2.0 || ~1.3.0 || ~1.4.0 - checksum: d038e0543d199da2b727c0b1d58cb07efadd0be08f5e15cab1b269f26ae5b332da46de36102f6a18a32afda93057fbea39fcad1ed287c3bb874aec91d9b2094f + viem: 2.x + wagmi: 2.x + checksum: bda804f04fa18106a49f964d9714b950b34280dc20cc37c50fadfcb9072757b8f8c3c327dc0cfa0276bb107b55691d0e0c3e01512bbb0cb9b3229dcc8a65a85e languageName: node linkType: hard @@ -2256,7 +2249,7 @@ __metadata: dependencies: "@ethersproject/providers": ^5.7.2 "@heroicons/react": ^2.0.11 - "@rainbow-me/rainbowkit": 1.3.0 + "@rainbow-me/rainbowkit": beta "@tanstack/react-query": ^5.17.19 "@trivago/prettier-plugin-sort-imports": ^4.1.1 "@types/node": ^17.0.35 @@ -2288,8 +2281,8 @@ __metadata: use-debounce: ^8.0.4 usehooks-ts: ^2.7.2 vercel: ^32.4.1 - viem: ^2.5.0 - wagmi: ^2.5.0 + viem: 2.5.0 + wagmi: 2.5.0 zustand: ^4.1.2 languageName: unknown linkType: soft @@ -3312,31 +3305,31 @@ __metadata: languageName: node linkType: hard -"@vanilla-extract/css@npm:1.9.1": - version: 1.9.1 - resolution: "@vanilla-extract/css@npm:1.9.1" +"@vanilla-extract/css@npm:1.14.0": + version: 1.14.0 + resolution: "@vanilla-extract/css@npm:1.14.0" dependencies: - "@emotion/hash": ^0.8.0 + "@emotion/hash": ^0.9.0 "@vanilla-extract/private": ^1.0.3 - ahocorasick: 1.0.2 chalk: ^4.1.1 - css-what: ^5.0.1 + css-what: ^6.1.0 cssesc: ^3.0.0 csstype: ^3.0.7 - deep-object-diff: ^1.1.0 + deep-object-diff: ^1.1.9 deepmerge: ^4.2.2 media-query-parser: ^2.0.2 + modern-ahocorasick: ^1.0.0 outdent: ^0.8.0 - checksum: 91127d8e2eaaf521b155a39fb6a93e0fbfe5ddd5a8bdf1c732aba278cfdb9505cba24c755a982bc47682b9ff582a06d11e51e6f8d810404164ba098799ce6800 + checksum: ca12de26f72b908c7ac2ee9319faff885fb451ab3da7cef86aae8660c7e042c447041be40ac8c6155d87e8a709efb0697214db3a6cce211e8ef3c110d4dcf8a1 languageName: node linkType: hard -"@vanilla-extract/dynamic@npm:2.0.2": - version: 2.0.2 - resolution: "@vanilla-extract/dynamic@npm:2.0.2" +"@vanilla-extract/dynamic@npm:2.1.0": + version: 2.1.0 + resolution: "@vanilla-extract/dynamic@npm:2.1.0" dependencies: "@vanilla-extract/private": ^1.0.3 - checksum: c6f22606bce094a5682c6d842be6d6965b9448f8973eaabdaa7a7438146458c22490c1c63345f08d2226f1c95ac20731835a5140c2c18646b2c1287b65607b84 + checksum: a6f129d096286cf7e2c7c868f12866d2da2967cd7591e071eb6420f0fafccce86c58e1d408864109fc894332399e731fe8ae67e2c92d456feb4b21c602287f6d languageName: node linkType: hard @@ -3347,12 +3340,12 @@ __metadata: languageName: node linkType: hard -"@vanilla-extract/sprinkles@npm:1.5.0": - version: 1.5.0 - resolution: "@vanilla-extract/sprinkles@npm:1.5.0" +"@vanilla-extract/sprinkles@npm:1.6.1": + version: 1.6.1 + resolution: "@vanilla-extract/sprinkles@npm:1.6.1" peerDependencies: "@vanilla-extract/css": ^1.0.0 - checksum: 522b96afe856a72d76072ab41453edc35117772a6ac829c8a5ad09cddd69152e152b1cbda0b4344d50dbde59d0effa39301beb7acf319ef88f485966c89c80fd + checksum: 13c53a94b19f9226c2684b0da06b98022d2faaf504cb5a4a8e5a0abae499aaa7855c17aa6d88534800d9427696b3248f4fc1a5332bde336c445d837017569f3b languageName: node linkType: hard @@ -4074,13 +4067,6 @@ __metadata: languageName: node linkType: hard -"ahocorasick@npm:1.0.2": - version: 1.0.2 - resolution: "ahocorasick@npm:1.0.2" - checksum: a13ce4403554ae782cf5e28d468a732acf1fd3d0bff251f5dcfddfa5497b6cc343948d69cd94dfdbe8d4dfdb81e2b34cb1c92079e6301f38b0143d314fb95bd6 - languageName: node - linkType: hard - "ajv@npm:8.6.3": version: 8.6.3 resolution: "ajv@npm:8.6.3" @@ -5306,10 +5292,10 @@ __metadata: languageName: node linkType: hard -"clsx@npm:1.1.1": - version: 1.1.1 - resolution: "clsx@npm:1.1.1" - checksum: ff052650329773b9b245177305fc4c4dc3129f7b2be84af4f58dc5defa99538c61d4207be7419405a5f8f3d92007c954f4daba5a7b74e563d5de71c28c830063 +"clsx@npm:2.1.0": + version: 2.1.0 + resolution: "clsx@npm:2.1.0" + checksum: 43fefc29b6b49c9476fbce4f8b1cc75c27b67747738e598e6651dd40d63692135dc60b18fa1c5b78a2a9ba8ae6fd2055a068924b94e20b42039bd53b78b98e1d languageName: node linkType: hard @@ -5643,10 +5629,10 @@ __metadata: languageName: node linkType: hard -"css-what@npm:^5.0.1": - version: 5.1.0 - resolution: "css-what@npm:5.1.0" - checksum: 0b75d1bac95c885c168573c85744a6c6843d8c33345f54f717218b37ea6296b0e99bb12105930ea170fd4a921990392a7c790c16c585c1d8960c49e2b7ec39f7 +"css-what@npm:^6.1.0": + version: 6.1.0 + resolution: "css-what@npm:6.1.0" + checksum: b975e547e1e90b79625918f84e67db5d33d896e6de846c9b584094e529f0c63e2ab85ee33b9daffd05bff3a146a1916bec664e18bb76dd5f66cbff9fc13b2bbe languageName: node linkType: hard @@ -5807,7 +5793,7 @@ __metadata: languageName: node linkType: hard -"deep-object-diff@npm:^1.1.0": +"deep-object-diff@npm:^1.1.9": version: 1.1.9 resolution: "deep-object-diff@npm:1.1.9" checksum: ecd42455e4773f653595d28070295e7aaa8402db5f8ab21d0bec115a7cb4de5e207a5665514767da5f025c96597f1d3a0a4888aeb4dd49e03c996871a3aa05ef @@ -10510,6 +10496,13 @@ __metadata: languageName: node linkType: hard +"modern-ahocorasick@npm:^1.0.0": + version: 1.0.1 + resolution: "modern-ahocorasick@npm:1.0.1" + checksum: ec83479f406511f37a966d66ce1c2b1701bb4a2cc2aabbbc257001178c9fbc48ce748c88eb10dfe72ba8b7f991a0bc7f1fa14683f444685edd1a9eeb32ecbc1e + languageName: node + linkType: hard + "module-error@npm:^1.0.1, module-error@npm:^1.0.2": version: 1.0.2 resolution: "module-error@npm:1.0.2" @@ -11883,20 +11876,6 @@ __metadata: languageName: node linkType: hard -"qrcode@npm:1.5.0": - version: 1.5.0 - resolution: "qrcode@npm:1.5.0" - dependencies: - dijkstrajs: ^1.0.1 - encode-utf8: ^1.0.3 - pngjs: ^5.0.0 - yargs: ^15.3.1 - bin: - qrcode: bin/qrcode - checksum: a0857713d4390937900a2789d5a065700f7cf78cd760e773bf8524c0e907ff629db19c9bdd4210aac55b8eef53ec1c7bcaa2acf01f340ef049c53098388a45a0 - languageName: node - linkType: hard - "qrcode@npm:1.5.3, qrcode@npm:^1.5.1": version: 1.5.3 resolution: "qrcode@npm:1.5.3" @@ -12067,7 +12046,7 @@ __metadata: languageName: node linkType: hard -"react-remove-scroll-bar@npm:^2.3.3": +"react-remove-scroll-bar@npm:^2.3.4": version: 2.3.4 resolution: "react-remove-scroll-bar@npm:2.3.4" dependencies: @@ -12083,11 +12062,11 @@ __metadata: languageName: node linkType: hard -"react-remove-scroll@npm:2.5.4": - version: 2.5.4 - resolution: "react-remove-scroll@npm:2.5.4" +"react-remove-scroll@npm:2.5.7": + version: 2.5.7 + resolution: "react-remove-scroll@npm:2.5.7" dependencies: - react-remove-scroll-bar: ^2.3.3 + react-remove-scroll-bar: ^2.3.4 react-style-singleton: ^2.2.1 tslib: ^2.1.0 use-callback-ref: ^1.3.0 @@ -12098,7 +12077,7 @@ __metadata: peerDependenciesMeta: "@types/react": optional: true - checksum: 01b0f65542a4c8803ee748b4e6cf2adad66d034e15fb72e8455773b0d7b178ec806b3194d74f412db7064670c45552cc666c04e9fb3b5d466dce5fb48e634825 + checksum: e0dbb6856beaed2cff4996d9ca62d775686ff72e3e9de34043034d932223b588993b2fc7a18644750dd3d73eb19bd3f2cedb8d91f0e424c1ef8403010da24b1d languageName: node linkType: hard @@ -14217,7 +14196,7 @@ __metadata: languageName: node linkType: hard -"ua-parser-js@npm:^1.0.35": +"ua-parser-js@npm:^1.0.37": version: 1.0.37 resolution: "ua-parser-js@npm:1.0.37" checksum: 4d481c720d523366d7762dc8a46a1b58967d979aacf786f9ceceb1cd767de069f64a4bdffb63956294f1c0696eb465ddb950f28ba90571709e33521b4bd75e07 @@ -14651,59 +14630,59 @@ __metadata: languageName: node linkType: hard -"viem@npm:^1.0.0": - version: 1.12.2 - resolution: "viem@npm:1.12.2" +"viem@npm:2.5.0": + version: 2.5.0 + resolution: "viem@npm:2.5.0" dependencies: - "@adraffy/ens-normalize": 1.9.4 + "@adraffy/ens-normalize": 1.10.0 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 "@scure/bip32": 1.3.2 "@scure/bip39": 1.2.1 - "@types/ws": ^8.5.5 - abitype: 0.9.8 - isomorphic-ws: 5.0.0 + abitype: 1.0.0 + isows: 1.0.3 ws: 8.13.0 peerDependencies: typescript: ">=5.0.4" peerDependenciesMeta: typescript: optional: true - checksum: 558bc2b46afb177a34356f3cc8e6e444f4a6bf4d8aa15658f95eecc1bb42bbc09f240a1fd8eae98fa4973c3a1dc34f0492034b4b4d182f65b2dadf80167c8cea + checksum: 108355b0384b6b7172ccee85a88cc34a95030b7f8508a09e506f306fdac2c94e4fad020f4ea2beff746ca2d344a1e01b5496bfa363d7c64a7db1044e3f246230 languageName: node linkType: hard -"viem@npm:^1.1.4": - version: 1.21.4 - resolution: "viem@npm:1.21.4" +"viem@npm:^1.0.0": + version: 1.12.2 + resolution: "viem@npm:1.12.2" dependencies: - "@adraffy/ens-normalize": 1.10.0 + "@adraffy/ens-normalize": 1.9.4 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 "@scure/bip32": 1.3.2 "@scure/bip39": 1.2.1 + "@types/ws": ^8.5.5 abitype: 0.9.8 - isows: 1.0.3 + isomorphic-ws: 5.0.0 ws: 8.13.0 peerDependencies: typescript: ">=5.0.4" peerDependenciesMeta: typescript: optional: true - checksum: c351fdea2d53d2d781ac73c964348b3b9fc5dd46f9eb53903e867705fc9e30a893cb9f2c8d7a00acdcdeca27d14eeebf976eed9f948c28c47018dc9211369117 + checksum: 558bc2b46afb177a34356f3cc8e6e444f4a6bf4d8aa15658f95eecc1bb42bbc09f240a1fd8eae98fa4973c3a1dc34f0492034b4b4d182f65b2dadf80167c8cea languageName: node linkType: hard -"viem@npm:^2.5.0": - version: 2.5.0 - resolution: "viem@npm:2.5.0" +"viem@npm:^1.1.4": + version: 1.21.4 + resolution: "viem@npm:1.21.4" dependencies: "@adraffy/ens-normalize": 1.10.0 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 "@scure/bip32": 1.3.2 "@scure/bip39": 1.2.1 - abitype: 1.0.0 + abitype: 0.9.8 isows: 1.0.3 ws: 8.13.0 peerDependencies: @@ -14711,7 +14690,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 108355b0384b6b7172ccee85a88cc34a95030b7f8508a09e506f306fdac2c94e4fad020f4ea2beff746ca2d344a1e01b5496bfa363d7c64a7db1044e3f246230 + checksum: c351fdea2d53d2d781ac73c964348b3b9fc5dd46f9eb53903e867705fc9e30a893cb9f2c8d7a00acdcdeca27d14eeebf976eed9f948c28c47018dc9211369117 languageName: node linkType: hard @@ -14722,7 +14701,7 @@ __metadata: languageName: node linkType: hard -"wagmi@npm:^2.5.0": +"wagmi@npm:2.5.0": version: 2.5.0 resolution: "wagmi@npm:2.5.0" dependencies: From 02a4e8754cafba639dd6045c88035475f1361d48 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 26 Jan 2024 12:27:06 +0530 Subject: [PATCH 08/68] remove useNetwork --- .../app/debug/_components/contract/WriteOnlyFunctionForm.tsx | 4 ++-- .../nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx index d7135018e..00dd39f51 100644 --- a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"; import { InheritanceTooltip } from "./InheritanceTooltip"; import { Abi, AbiFunction } from "abitype"; import { Address, TransactionReceipt } from "viem"; -import { useContractWrite, useNetwork, useWaitForTransaction } from "wagmi"; +import { useAccount, useContractWrite, useWaitForTransaction } from "wagmi"; import { ContractInput, TxReceipt, @@ -34,7 +34,7 @@ export const WriteOnlyFunctionForm = ({ }: WriteOnlyFunctionFormProps) => { const [form, setForm] = useState>(() => getInitialFormState(abiFunction)); const [txValue, setTxValue] = useState(""); - const { chain } = useNetwork(); + const { chain } = useAccount(); const writeTxn = useTransactor(); const { targetNetwork } = useTargetNetwork(); const writeDisabled = !chain || chain?.id !== targetNetwork.id; diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts index cc9983407..6571221a6 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts @@ -1,7 +1,7 @@ import { useState } from "react"; import { useTargetNetwork } from "./useTargetNetwork"; import { Abi, ExtractAbiFunctionNames } from "abitype"; -import { useContractWrite, useNetwork } from "wagmi"; +import { useAccount, useContractWrite } from "wagmi"; import { useDeployedContractInfo, useTransactor } from "~~/hooks/scaffold-eth"; import { getParsedError, notification } from "~~/utils/scaffold-eth"; import { ContractAbi, ContractName, UseScaffoldWriteConfig } from "~~/utils/scaffold-eth/contract"; @@ -32,7 +32,7 @@ export const useScaffoldContractWrite = < ...writeConfig }: UseScaffoldWriteConfig) => { const { data: deployedContractData } = useDeployedContractInfo(contractName); - const { chain } = useNetwork(); + const { chain } = useAccount(); const writeTx = useTransactor(); const [isMining, setIsMining] = useState(false); const { targetNetwork } = useTargetNetwork(); From b1d4e46f686ce729c4ea0e783da5e5716d5d2c90 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 26 Jan 2024 12:33:42 +0530 Subject: [PATCH 09/68] use useWatchContractEvent instead of useContractEvent --- .../nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts index 389553c6b..ecb43b943 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts @@ -1,7 +1,7 @@ import { useTargetNetwork } from "./useTargetNetwork"; import { Abi, ExtractAbiEventNames } from "abitype"; import { Log } from "viem"; -import { useContractEvent } from "wagmi"; +import { useWatchContractEvent } from "wagmi"; import { addIndexedArgsToEvent, useDeployedContractInfo } from "~~/hooks/scaffold-eth"; import { ContractAbi, ContractName, UseScaffoldEventConfig } from "~~/utils/scaffold-eth/contract"; @@ -28,11 +28,11 @@ export const useScaffoldEventSubscriber = < const listenerWithIndexedArgs = (logs: Log[]) => listener(addIndexedArgsToLogs(logs) as Parameters[0]); - return useContractEvent({ + return useWatchContractEvent({ address: deployedContractData?.address, abi: deployedContractData?.abi as Abi, chainId: targetNetwork.id, - listener: listenerWithIndexedArgs, + onLogs: listenerWithIndexedArgs, eventName, }); }; From 2fbdb80b05333c063cabc9cffc025890dd947403 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 26 Jan 2024 12:55:43 +0530 Subject: [PATCH 10/68] make faucet work & fix useAccountBalance to watch --- .../components/ScaffoldEthAppWithProviders.tsx | 2 +- .../hooks/scaffold-eth/useAccountBalance.ts | 16 +++++++++++----- .../nextjs/hooks/scaffold-eth/useTransactor.tsx | 3 ++- packages/nextjs/services/web3/wagmiConfig.tsx | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx index ae0eb1488..8ca5aa016 100644 --- a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx +++ b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx @@ -36,7 +36,7 @@ const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => { ); }; -const queryClient = new QueryClient(); +export const queryClient = new QueryClient(); export const ScaffoldEthAppWithProviders = ({ children }: { children: React.ReactNode }) => { const { isDarkMode } = useDarkMode(); diff --git a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts b/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts index b52fb2190..38458ee0e 100644 --- a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts +++ b/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts @@ -1,7 +1,8 @@ import { useCallback, useEffect, useState } from "react"; import { useTargetNetwork } from "./useTargetNetwork"; -import { Address } from "viem"; -import { useBalance } from "wagmi"; +import { Address, formatUnits } from "viem"; +import { useBalance, useBlockNumber } from "wagmi"; +import { queryClient } from "~~/components/ScaffoldEthAppWithProviders"; import { useGlobalState } from "~~/services/store/store"; export function useAccountBalance(address?: Address) { @@ -10,16 +11,21 @@ export function useAccountBalance(address?: Address) { const price = useGlobalState(state => state.nativeCurrencyPrice); const { targetNetwork } = useTargetNetwork(); + const { data: blockNumber } = useBlockNumber({ watch: true }); const { data: fetchedBalanceData, isError, isLoading, + queryKey, } = useBalance({ address, - watch: true, chainId: targetNetwork.id, }); + useEffect(() => { + queryClient.invalidateQueries({ queryKey }); + }, [blockNumber, queryKey]); + const onToggleBalance = useCallback(() => { if (price > 0) { setIsEthBalance(!isEthBalance); @@ -27,8 +33,8 @@ export function useAccountBalance(address?: Address) { }, [isEthBalance, price]); useEffect(() => { - if (fetchedBalanceData?.formatted) { - setBalance(Number(fetchedBalanceData.formatted)); + if (fetchedBalanceData?.value && fetchedBalanceData?.decimals) { + setBalance(Number(formatUnits(fetchedBalanceData.value, fetchedBalanceData.decimals))); } }, [fetchedBalanceData, targetNetwork]); diff --git a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx index 73a38f0ea..fba483764 100644 --- a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx +++ b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx @@ -1,6 +1,7 @@ import { WriteContractResult, getPublicClient } from "@wagmi/core"; import { Hash, SendTransactionParameters, TransactionReceipt, WalletClient } from "viem"; import { useWalletClient } from "wagmi"; +import { wagmiConfig } from "~~/services/web3/wagmiConfig"; import { getBlockExplorerTxLink, getParsedError, notification } from "~~/utils/scaffold-eth"; type TransactionFunc = ( @@ -51,7 +52,7 @@ export const useTransactor = (_walletClient?: WalletClient): TransactionFunc => try { const network = await walletClient.getChainId(); // Get full transaction from public client - const publicClient = getPublicClient(); + const publicClient = getPublicClient(wagmiConfig); notificationId = notification.loading(); if (typeof tx === "function") { diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index 3a47785be..85af11c47 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -7,6 +7,7 @@ import scaffoldConfig from "~~/scaffold.config"; export const wagmiConfig = createConfig({ // TODO: Maybe we should get literal value here currently TS has widened the types because of ensabledChains logic chains: enabledChains, + ssr: true, client({ chain }) { return createClient({ chain, From a4c00bd3df0aee6f98c31439352854bff280e969 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 26 Jan 2024 20:06:19 +0530 Subject: [PATCH 11/68] useAccountBalance: handle when balance is 0n --- packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts b/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts index 38458ee0e..c17a8a679 100644 --- a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts +++ b/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts @@ -33,7 +33,7 @@ export function useAccountBalance(address?: Address) { }, [isEthBalance, price]); useEffect(() => { - if (fetchedBalanceData?.value && fetchedBalanceData?.decimals) { + if (fetchedBalanceData?.value !== undefined && fetchedBalanceData?.decimals) { setBalance(Number(formatUnits(fetchedBalanceData.value, fetchedBalanceData.decimals))); } }, [fetchedBalanceData, targetNetwork]); From 2bacbdf2205dfafc8bdca7e3950a93e1c13449a9 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 26 Jan 2024 20:39:57 +0530 Subject: [PATCH 12/68] get writeOnlyFunction form working for hardhat --- .../contract/WriteOnlyFunctionForm.tsx | 30 +++++++++---------- .../hooks/scaffold-eth/useTransactor.tsx | 12 +++----- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx index 00dd39f51..3d9706d5d 100644 --- a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"; import { InheritanceTooltip } from "./InheritanceTooltip"; import { Abi, AbiFunction } from "abitype"; import { Address, TransactionReceipt } from "viem"; -import { useAccount, useContractWrite, useWaitForTransaction } from "wagmi"; +import { useAccount, useWaitForTransactionReceipt, useWriteContract } from "wagmi"; import { ContractInput, TxReceipt, @@ -39,21 +39,21 @@ export const WriteOnlyFunctionForm = ({ const { targetNetwork } = useTargetNetwork(); const writeDisabled = !chain || chain?.id !== targetNetwork.id; - const { - data: result, - isLoading, - writeAsync, - } = useContractWrite({ - address: contractAddress, - functionName: abiFunction.name, - abi: abi, - args: getParsedContractFunctionArgs(form), - }); + const { data: result, status, writeContractAsync } = useWriteContract(); + + const isLoading = status === "pending"; const handleWrite = async () => { - if (writeAsync) { + if (writeContractAsync) { try { - const makeWriteWithParams = () => writeAsync({ value: BigInt(txValue) }); + const makeWriteWithParams = () => + writeContractAsync({ + address: contractAddress, + functionName: abiFunction.name, + abi: abi, + args: getParsedContractFunctionArgs(form), + value: BigInt(txValue), + }); await writeTxn(makeWriteWithParams); onChange(); } catch (e: any) { @@ -64,8 +64,8 @@ export const WriteOnlyFunctionForm = ({ }; const [displayedTxResult, setDisplayedTxResult] = useState(); - const { data: txResult } = useWaitForTransaction({ - hash: result?.hash, + const { data: txResult } = useWaitForTransactionReceipt({ + hash: result, }); useEffect(() => { setDisplayedTxResult(txResult); diff --git a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx index fba483764..11ad39c55 100644 --- a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx +++ b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx @@ -1,11 +1,11 @@ -import { WriteContractResult, getPublicClient } from "@wagmi/core"; +import { getPublicClient } from "@wagmi/core"; import { Hash, SendTransactionParameters, TransactionReceipt, WalletClient } from "viem"; import { useWalletClient } from "wagmi"; import { wagmiConfig } from "~~/services/web3/wagmiConfig"; import { getBlockExplorerTxLink, getParsedError, notification } from "~~/utils/scaffold-eth"; type TransactionFunc = ( - tx: (() => Promise) | (() => Promise) | SendTransactionParameters, + tx: (() => Promise) | SendTransactionParameters, options?: { onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; blockConfirmations?: number; @@ -48,7 +48,7 @@ export const useTransactor = (_walletClient?: WalletClient): TransactionFunc => } let notificationId = null; - let transactionHash: Awaited["hash"] | undefined = undefined; + let transactionHash: Hash | undefined = undefined; try { const network = await walletClient.getChainId(); // Get full transaction from public client @@ -58,11 +58,7 @@ export const useTransactor = (_walletClient?: WalletClient): TransactionFunc => if (typeof tx === "function") { // Tx is already prepared by the caller const result = await tx(); - if (typeof result === "string") { - transactionHash = result; - } else { - transactionHash = result.hash; - } + transactionHash = result; } else if (tx != null) { transactionHash = await walletClient.sendTransaction(tx); } else { From 1eac18a59653907b817c552569d4c7c586a4d53f Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 27 Jan 2024 20:26:35 +0530 Subject: [PATCH 13/68] update ReadOnlyFucntionForm --- .../contract/ReadOnlyFunctionForm.tsx | 20 ++++++++++++------- .../contract/WriteOnlyFunctionForm.tsx | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx index 42013eddf..71d333bb6 100644 --- a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx @@ -1,10 +1,10 @@ "use client"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { InheritanceTooltip } from "./InheritanceTooltip"; import { Abi, AbiFunction } from "abitype"; import { Address } from "viem"; -import { useContractRead } from "wagmi"; +import { useReadContract } from "wagmi"; import { ContractInput, displayTxResult, @@ -21,6 +21,7 @@ type ReadOnlyFunctionFormProps = { abi: Abi; }; +// TODO: For some reason the if there's error, it takes lot of time to show up export const ReadOnlyFunctionForm = ({ contractAddress, abiFunction, @@ -30,18 +31,23 @@ export const ReadOnlyFunctionForm = ({ const [form, setForm] = useState>(() => getInitialFormState(abiFunction)); const [result, setResult] = useState(); - const { isFetching, refetch } = useContractRead({ + const { isFetching, refetch, error } = useReadContract({ address: contractAddress, functionName: abiFunction.name, abi: abi, args: getParsedContractFunctionArgs(form), - enabled: false, - onError: (error: any) => { - const parsedErrror = getParsedError(error); - notification.error(parsedErrror); + query: { + enabled: false, }, }); + useEffect(() => { + if (error) { + const parsedError = getParsedError(error); + notification.error(parsedError); + } + }, [error]); + const inputElements = abiFunction.inputs.map((input, inputIndex) => { const key = getFunctionInputKey(abiFunction.name, input, inputIndex); return ( diff --git a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx index 3d9706d5d..5aab9ffe0 100644 --- a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx @@ -41,6 +41,7 @@ export const WriteOnlyFunctionForm = ({ const { data: result, status, writeContractAsync } = useWriteContract(); + // TODO: Check if this is the correct way to handle this const isLoading = status === "pending"; const handleWrite = async () => { From a0528a69690b3252be9621c7a5d906b8f5e051c9 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sun, 28 Jan 2024 10:54:22 +0530 Subject: [PATCH 14/68] fix TODO in ReadOnlyFunction form --- .../app/debug/_components/contract/ReadOnlyFunctionForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx index 71d333bb6..86b184915 100644 --- a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx @@ -21,7 +21,6 @@ type ReadOnlyFunctionFormProps = { abi: Abi; }; -// TODO: For some reason the if there's error, it takes lot of time to show up export const ReadOnlyFunctionForm = ({ contractAddress, abiFunction, @@ -38,6 +37,7 @@ export const ReadOnlyFunctionForm = ({ args: getParsedContractFunctionArgs(form), query: { enabled: false, + retry: false, }, }); From e49d073c55bc7b7fe27a50918117f98d16ff4285 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sun, 28 Jan 2024 11:04:41 +0530 Subject: [PATCH 15/68] fix AddressInput component --- .../scaffold-eth/Input/AddressInput.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/nextjs/components/scaffold-eth/Input/AddressInput.tsx b/packages/nextjs/components/scaffold-eth/Input/AddressInput.tsx index 4f057015a..7d020333b 100644 --- a/packages/nextjs/components/scaffold-eth/Input/AddressInput.tsx +++ b/packages/nextjs/components/scaffold-eth/Input/AddressInput.tsx @@ -2,6 +2,7 @@ import { useCallback, useEffect, useState } from "react"; import { blo } from "blo"; import { useDebounce } from "usehooks-ts"; import { Address, isAddress } from "viem"; +import { normalize } from "viem/ens"; import { useEnsAddress, useEnsAvatar, useEnsName } from "wagmi"; import { CommonInputProps, InputBase, isENS } from "~~/components/scaffold-eth"; @@ -20,24 +21,30 @@ export const AddressInput = ({ value, name, placeholder, onChange, disabled }: C const { data: ensAddress, isLoading: isEnsAddressLoading } = useEnsAddress({ name: settledValue, - enabled: isENS(debouncedValue), chainId: 1, - cacheTime: 30_000, + query: { + gcTime: 30_000, + enabled: isENS(debouncedValue), + }, }); const [enteredEnsName, setEnteredEnsName] = useState(); const { data: ensName, isLoading: isEnsNameLoading } = useEnsName({ address: settledValue as Address, - enabled: isAddress(debouncedValue), chainId: 1, - cacheTime: 30_000, + query: { + enabled: isAddress(debouncedValue), + gcTime: 30_000, + }, }); const { data: ensAvatar } = useEnsAvatar({ - name: ensName, - enabled: Boolean(ensName), + name: ensName ? normalize(ensName) : undefined, chainId: 1, - cacheTime: 30_000, + query: { + enabled: Boolean(ensName), + gcTime: 30_000, + }, }); // ens => address From 9c3a72e38d2504561da9cf10c79080bd1c5cb408 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sun, 28 Jan 2024 11:13:08 +0530 Subject: [PATCH 16/68] fix DisplayVariable --- .../_components/contract/DisplayVariable.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx b/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx index 805593d05..90142fa78 100644 --- a/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx +++ b/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx @@ -5,10 +5,10 @@ import { InheritanceTooltip } from "./InheritanceTooltip"; import { displayTxResult } from "./utilsDisplay"; import { Abi, AbiFunction } from "abitype"; import { Address } from "viem"; -import { useContractRead } from "wagmi"; +import { useReadContract } from "wagmi"; import { ArrowPathIcon } from "@heroicons/react/24/outline"; import { useAnimationConfig } from "~~/hooks/scaffold-eth"; -import { notification } from "~~/utils/scaffold-eth"; +import { getParsedError, notification } from "~~/utils/scaffold-eth"; type DisplayVariableProps = { contractAddress: Address; @@ -29,12 +29,13 @@ export const DisplayVariable = ({ data: result, isFetching, refetch, - } = useContractRead({ + error, + } = useReadContract({ address: contractAddress, functionName: abiFunction.name, abi: abi, - onError: error => { - notification.error(error.message); + query: { + retry: false, }, }); @@ -44,6 +45,13 @@ export const DisplayVariable = ({ refetch(); }, [refetch, refreshDisplayVariables]); + useEffect(() => { + if (error) { + const parsedError = getParsedError(error); + notification.error(parsedError); + } + }, [error]); + return (
From b9132a2c0bbc057fd2fe051bc36024497d0b8cd2 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 12 Feb 2024 13:54:07 +0530 Subject: [PATCH 17/68] up rainbowkit to v2 --- packages/nextjs/package.json | 2 +- yarn.lock | 38 ++++++------------------------------ 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 489ac342b..e09528bdf 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -16,7 +16,7 @@ "dependencies": { "@ethersproject/providers": "^5.7.2", "@heroicons/react": "^2.0.11", - "@rainbow-me/rainbowkit": "beta", + "@rainbow-me/rainbowkit": "^2.0.0", "@tanstack/react-query": "^5.17.19", "@uniswap/sdk-core": "^4.0.1", "@uniswap/v2-sdk": "^3.0.1", diff --git a/yarn.lock b/yarn.lock index e724a9cda..a9f7c5a64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2060,15 +2060,14 @@ __metadata: languageName: node linkType: hard -"@rainbow-me/rainbowkit@npm:beta": - version: 2.0.0-beta.2 - resolution: "@rainbow-me/rainbowkit@npm:2.0.0-beta.2" +"@rainbow-me/rainbowkit@npm:^2.0.0": + version: 2.0.0 + resolution: "@rainbow-me/rainbowkit@npm:2.0.0" dependencies: "@vanilla-extract/css": 1.14.0 "@vanilla-extract/dynamic": 2.1.0 "@vanilla-extract/sprinkles": 1.6.1 clsx: 2.1.0 - i18n-js: ^4.3.2 qrcode: 1.5.3 react-remove-scroll: 2.5.7 ua-parser-js: ^1.0.37 @@ -2077,7 +2076,7 @@ __metadata: react-dom: ">=17" viem: 2.x wagmi: 2.x - checksum: bda804f04fa18106a49f964d9714b950b34280dc20cc37c50fadfcb9072757b8f8c3c327dc0cfa0276bb107b55691d0e0c3e01512bbb0cb9b3229dcc8a65a85e + checksum: 7c7750516437a25366d33e853fcec4967ca81b6944905118fe1450b210b0196422b0b75340bb014da54c2f8933b5d7ca8ec9bfe7f75f570439d95fadfb6d0b40 languageName: node linkType: hard @@ -2249,7 +2248,7 @@ __metadata: dependencies: "@ethersproject/providers": ^5.7.2 "@heroicons/react": ^2.0.11 - "@rainbow-me/rainbowkit": beta + "@rainbow-me/rainbowkit": ^2.0.0 "@tanstack/react-query": ^5.17.19 "@trivago/prettier-plugin-sort-imports": ^4.1.1 "@types/node": ^17.0.35 @@ -4683,13 +4682,6 @@ __metadata: languageName: node linkType: hard -"bignumber.js@npm:*": - version: 9.1.2 - resolution: "bignumber.js@npm:9.1.2" - checksum: 582c03af77ec9cb0ebd682a373ee6c66475db94a4325f92299621d544aa4bd45cb45fd60001610e94aef8ae98a0905fa538241d9638d4422d57abbeeac6fadaf - languageName: node - linkType: hard - "binary-extensions@npm:^2.0.0": version: 2.2.0 resolution: "binary-extensions@npm:2.2.0" @@ -8680,17 +8672,6 @@ __metadata: languageName: node linkType: hard -"i18n-js@npm:^4.3.2": - version: 4.3.2 - resolution: "i18n-js@npm:4.3.2" - dependencies: - bignumber.js: "*" - lodash: "*" - make-plural: "*" - checksum: 08a051dba75d93447e2021c1feb92f34c9034b5a818957885ea19ac58954d764c848c4deaaf46ada3e15d51f61ad9f7e0bf4ddffa3c765871ff1b26638ca0a8f - languageName: node - linkType: hard - "i18next-browser-languagedetector@npm:^7.1.0": version: 7.2.0 resolution: "i18next-browser-languagedetector@npm:7.2.0" @@ -9901,7 +9882,7 @@ __metadata: languageName: node linkType: hard -"lodash@npm:*, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21": +"lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 @@ -10045,13 +10026,6 @@ __metadata: languageName: node linkType: hard -"make-plural@npm:*": - version: 7.3.0 - resolution: "make-plural@npm:7.3.0" - checksum: bb39b4b77533f0d5fb94eec128340b54dda8c1707d6b0a98c148e5d7bc23094e123f88275a61573fa31dc2f5d7352215cee0df523cd69b5d8fcb3969a2bcf8f8 - languageName: node - linkType: hard - "markdown-table@npm:^1.1.3": version: 1.1.3 resolution: "markdown-table@npm:1.1.3" From c454a4102588a6fff177838d8f4108b767655771 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 17 Feb 2024 13:00:24 +0530 Subject: [PATCH 18/68] up wagmi and rainbow versions --- packages/nextjs/package.json | 4 +- yarn.lock | 168 +++++++++++++++++------------------ 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index e09528bdf..610eaa565 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -31,8 +31,8 @@ "react-hot-toast": "^2.4.0", "use-debounce": "^8.0.4", "usehooks-ts": "^2.7.2", - "viem": "2.5.0", - "wagmi": "2.5.0", + "viem": "^2.7.10", + "wagmi": "^2.5.7", "zustand": "^4.1.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index a9f7c5a64..9f857e0eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1227,9 +1227,9 @@ __metadata: languageName: node linkType: hard -"@metamask/sdk-communication-layer@npm:0.14.1": - version: 0.14.1 - resolution: "@metamask/sdk-communication-layer@npm:0.14.1" +"@metamask/sdk-communication-layer@npm:0.14.3": + version: 0.14.3 + resolution: "@metamask/sdk-communication-layer@npm:0.14.3" dependencies: bufferutil: ^4.0.8 cross-fetch: ^3.1.5 @@ -1239,7 +1239,7 @@ __metadata: socket.io-client: ^4.5.1 utf-8-validate: ^6.0.3 uuid: ^8.3.2 - checksum: c4c2fee023a8138aa176850b904c793f4e4f4aed4f120f9c61ddf8f89ca603001418c7c0a7d2ff2709ac9a1490df5a32727b6d861d9e2727c6759bb252ac2ce8 + checksum: 1a4d89a8bef3c4a08df151a1f95d0eca65f18715a1de3e66ae3b7dd1f7cb58957edb1cba7f1af13ee037b50866d25a0402917c640e380dbbe32534cfa0764398 languageName: node linkType: hard @@ -1258,14 +1258,14 @@ __metadata: languageName: node linkType: hard -"@metamask/sdk@npm:0.14.1": - version: 0.14.1 - resolution: "@metamask/sdk@npm:0.14.1" +"@metamask/sdk@npm:0.14.3": + version: 0.14.3 + resolution: "@metamask/sdk@npm:0.14.3" dependencies: "@metamask/onboarding": ^1.0.1 "@metamask/post-message-stream": ^6.1.0 "@metamask/providers": ^10.2.1 - "@metamask/sdk-communication-layer": 0.14.1 + "@metamask/sdk-communication-layer": 0.14.3 "@metamask/sdk-install-modal-web": 0.14.1 "@react-native-async-storage/async-storage": ^1.17.11 "@types/dom-screen-wake-lock": ^1.0.0 @@ -1295,7 +1295,7 @@ __metadata: optional: true react-native: optional: true - checksum: e18024828ee7e3f4009640fcb928981c39f5783e6165827fe7d5b79999d66a05841413cc9f4b0dd164c9add5a479003a3e283337f4a6cbf7c6d9c68a07eea2ee + checksum: da43da4b39c558ec2d6a472634e0b4b9fa3f3e46b4397368438c3a86764fac7e3dde386a0b50d9ce5ad43431879ce80178c01cef507eac28e67980006c82eeb6 languageName: node linkType: hard @@ -2280,8 +2280,8 @@ __metadata: use-debounce: ^8.0.4 usehooks-ts: ^2.7.2 vercel: ^32.4.1 - viem: 2.5.0 - wagmi: 2.5.0 + viem: ^2.7.10 + wagmi: ^2.5.7 zustand: ^4.1.2 languageName: unknown linkType: soft @@ -3559,30 +3559,30 @@ __metadata: languageName: node linkType: hard -"@wagmi/connectors@npm:4.1.8": - version: 4.1.8 - resolution: "@wagmi/connectors@npm:4.1.8" +"@wagmi/connectors@npm:4.1.14": + version: 4.1.14 + resolution: "@wagmi/connectors@npm:4.1.14" dependencies: "@coinbase/wallet-sdk": 3.9.1 - "@metamask/sdk": 0.14.1 + "@metamask/sdk": 0.14.3 "@safe-global/safe-apps-provider": 0.18.1 "@safe-global/safe-apps-sdk": 8.1.0 - "@walletconnect/ethereum-provider": 2.11.0 + "@walletconnect/ethereum-provider": 2.11.1 "@walletconnect/modal": 2.6.2 peerDependencies: - "@wagmi/core": 2.5.0 + "@wagmi/core": 2.6.5 typescript: ">=5.0.4" viem: 2.x peerDependenciesMeta: typescript: optional: true - checksum: 11f53d626b475061a9875436d38000b6c46081f3f3b94f247d50e95ddd0b2669f3acea413e4e03685d4a7c82356ba59146b7b6021c8d59fb638c4a98972857f4 + checksum: 1ec7a4e3d4cc479455c377e731fbc80eb2d84114cf535532efec66f072c20592e0cb67b116dcf87abdede0a377413722f6f53a7d2aa3543ade05c3a37d7cf36b languageName: node linkType: hard -"@wagmi/core@npm:2.5.0": - version: 2.5.0 - resolution: "@wagmi/core@npm:2.5.0" +"@wagmi/core@npm:2.6.5": + version: 2.6.5 + resolution: "@wagmi/core@npm:2.6.5" dependencies: eventemitter3: 5.0.1 mipd: 0.0.5 @@ -3596,13 +3596,13 @@ __metadata: optional: true typescript: optional: true - checksum: 15023af8a7ef400d624287be85465cba9b4d9fb4769464c19fd63a0823631480d78ad2962c33375c15458c697671110538ecef70283f44c972e1639a03709b03 + checksum: c7f7ef8dcf4bba368416fbfd621a8b0effa9c017e804cee436187320c199cc2f0955f891b997102908c0902c0773fdbd367c79db614f17aee7b0e3e58ded855a languageName: node linkType: hard -"@walletconnect/core@npm:2.11.0": - version: 2.11.0 - resolution: "@walletconnect/core@npm:2.11.0" +"@walletconnect/core@npm:2.11.1": + version: 2.11.1 + resolution: "@walletconnect/core@npm:2.11.1" dependencies: "@walletconnect/heartbeat": 1.2.1 "@walletconnect/jsonrpc-provider": 1.0.13 @@ -3615,13 +3615,13 @@ __metadata: "@walletconnect/relay-auth": ^1.0.4 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.11.0 - "@walletconnect/utils": 2.11.0 + "@walletconnect/types": 2.11.1 + "@walletconnect/utils": 2.11.1 events: ^3.3.0 isomorphic-unfetch: 3.1.0 lodash.isequal: 4.5.0 uint8arrays: ^3.1.0 - checksum: 419eff78df347eb5d5c51c2dbf60e3246b5dda00afdd77279795a89627285839cb769e1115e751026756d37e26e6bd708452170ded08be074d64256afd8a8663 + checksum: ab32b6355f52320bf17553fd6326a2de7674832e96e4fd521e2186692ac77a286f1186594d0cefae996c09306c2d183b64647a5b87b08bc65fa31f6a2e47ca96 languageName: node linkType: hard @@ -3634,21 +3634,21 @@ __metadata: languageName: node linkType: hard -"@walletconnect/ethereum-provider@npm:2.11.0": - version: 2.11.0 - resolution: "@walletconnect/ethereum-provider@npm:2.11.0" +"@walletconnect/ethereum-provider@npm:2.11.1": + version: 2.11.1 + resolution: "@walletconnect/ethereum-provider@npm:2.11.1" 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/modal": ^2.6.2 - "@walletconnect/sign-client": 2.11.0 - "@walletconnect/types": 2.11.0 - "@walletconnect/universal-provider": 2.11.0 - "@walletconnect/utils": 2.11.0 + "@walletconnect/sign-client": 2.11.1 + "@walletconnect/types": 2.11.1 + "@walletconnect/universal-provider": 2.11.1 + "@walletconnect/utils": 2.11.1 events: ^3.3.0 - checksum: 8b45eb7e6679d340e6d976c6c10b10b4ce0435b959d35b627677d946b9f152f20fc242e581a16e9b6f7ed98c5352748213856e342f55f3dbd4cd9130965d542c + checksum: 3cf0e578a937755baa0315e1cbec57161a34dafc3ef927e32a17b448cc8e6ce814a4515af5fd34c7c72d9b84433855a59377a9367a0dfc1221158d88fc1e78c2 languageName: node linkType: hard @@ -3819,20 +3819,20 @@ __metadata: languageName: node linkType: hard -"@walletconnect/sign-client@npm:2.11.0": - version: 2.11.0 - resolution: "@walletconnect/sign-client@npm:2.11.0" +"@walletconnect/sign-client@npm:2.11.1": + version: 2.11.1 + resolution: "@walletconnect/sign-client@npm:2.11.1" dependencies: - "@walletconnect/core": 2.11.0 + "@walletconnect/core": 2.11.1 "@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.11.0 - "@walletconnect/utils": 2.11.0 + "@walletconnect/types": 2.11.1 + "@walletconnect/utils": 2.11.1 events: ^3.3.0 - checksum: 89230cf4ca95f9feb06104cc8097340e345b2b21257d45acf16729342ddcf5248bbf05097343b21e4dbebfa4fbacb6fe067099ee6127169a6b464563985d4716 + checksum: 4d7f0c95d72245e00a1485b59a1621ea245330689172cb54d386a5b85e2a49a66a690fe5601e03f8e1bb58e998d9f0cf7322d0c0705856e29e88bee9d706ee3f languageName: node linkType: hard @@ -3845,9 +3845,9 @@ __metadata: languageName: node linkType: hard -"@walletconnect/types@npm:2.11.0": - version: 2.11.0 - resolution: "@walletconnect/types@npm:2.11.0" +"@walletconnect/types@npm:2.11.1": + version: 2.11.1 + resolution: "@walletconnect/types@npm:2.11.1" dependencies: "@walletconnect/events": ^1.0.1 "@walletconnect/heartbeat": 1.2.1 @@ -3855,30 +3855,30 @@ __metadata: "@walletconnect/keyvaluestorage": ^1.1.1 "@walletconnect/logger": ^2.0.1 events: ^3.3.0 - checksum: 32d0d7972b90683467e47eabf92005c7c5d1ae76400eb221576ac0d32501b9f0a414d5921f0c881efe86f07485db807e3e9d370c6b9cc264771822916dc4cca5 + checksum: c24f75d5f93eb5dd783108efd9a672c200b1ef8ab16d64ac2764348c1d17fb4946fe475bf9a590ebeb1f79e0cdd3c957d6700ef0fff140f59d34a7dc5ca5cbd5 languageName: node linkType: hard -"@walletconnect/universal-provider@npm:2.11.0": - version: 2.11.0 - resolution: "@walletconnect/universal-provider@npm:2.11.0" +"@walletconnect/universal-provider@npm:2.11.1": + version: 2.11.1 + resolution: "@walletconnect/universal-provider@npm:2.11.1" 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.11.0 - "@walletconnect/types": 2.11.0 - "@walletconnect/utils": 2.11.0 + "@walletconnect/sign-client": 2.11.1 + "@walletconnect/types": 2.11.1 + "@walletconnect/utils": 2.11.1 events: ^3.3.0 - checksum: 7f4f187cd9148dc2e262e4afecadf0d0e136ae4183a60779562fef142411b927a3305c90793ef98dc3ecc61e4e2d4cfc8ac5491b1b42054021cfc4383f7ab81e + checksum: 2fd7988efb25b26964630b907ae328a8dc25915b9434a98ca53317334538d5c31a724d97164ecf1158b25a77c59a260d77f358199147744fc68203b7e4538800 languageName: node linkType: hard -"@walletconnect/utils@npm:2.11.0": - version: 2.11.0 - resolution: "@walletconnect/utils@npm:2.11.0" +"@walletconnect/utils@npm:2.11.1": + version: 2.11.1 + resolution: "@walletconnect/utils@npm:2.11.1" dependencies: "@stablelib/chacha20poly1305": 1.0.1 "@stablelib/hkdf": 1.0.1 @@ -3888,13 +3888,13 @@ __metadata: "@walletconnect/relay-api": ^1.0.9 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.11.0 + "@walletconnect/types": 2.11.1 "@walletconnect/window-getters": ^1.0.1 "@walletconnect/window-metadata": ^1.0.1 detect-browser: 5.3.0 query-string: 7.1.3 uint8arrays: ^3.1.0 - checksum: 9d8259ea6a2850e620eb366b26fc3f17cf7bf75ae9c50fdfa3252b9dd152d1c10444009dfad1aa5a0a7d1ed844e5efd76581540e973315ec289fba7b51ebf7d7 + checksum: d3b90a4c1060009f1bb636474e850c051ba92684a6cb863c6e3458164930c275e3e5d2f776c540fa66be6df59546a2fd668122a1de9d5bcf511ec62a0e93fcd8 languageName: node linkType: hard @@ -14604,59 +14604,59 @@ __metadata: languageName: node linkType: hard -"viem@npm:2.5.0": - version: 2.5.0 - resolution: "viem@npm:2.5.0" +"viem@npm:^1.0.0": + version: 1.12.2 + resolution: "viem@npm:1.12.2" dependencies: - "@adraffy/ens-normalize": 1.10.0 + "@adraffy/ens-normalize": 1.9.4 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 "@scure/bip32": 1.3.2 "@scure/bip39": 1.2.1 - abitype: 1.0.0 - isows: 1.0.3 + "@types/ws": ^8.5.5 + abitype: 0.9.8 + isomorphic-ws: 5.0.0 ws: 8.13.0 peerDependencies: typescript: ">=5.0.4" peerDependenciesMeta: typescript: optional: true - checksum: 108355b0384b6b7172ccee85a88cc34a95030b7f8508a09e506f306fdac2c94e4fad020f4ea2beff746ca2d344a1e01b5496bfa363d7c64a7db1044e3f246230 + checksum: 558bc2b46afb177a34356f3cc8e6e444f4a6bf4d8aa15658f95eecc1bb42bbc09f240a1fd8eae98fa4973c3a1dc34f0492034b4b4d182f65b2dadf80167c8cea languageName: node linkType: hard -"viem@npm:^1.0.0": - version: 1.12.2 - resolution: "viem@npm:1.12.2" +"viem@npm:^1.1.4": + version: 1.21.4 + resolution: "viem@npm:1.21.4" dependencies: - "@adraffy/ens-normalize": 1.9.4 + "@adraffy/ens-normalize": 1.10.0 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 "@scure/bip32": 1.3.2 "@scure/bip39": 1.2.1 - "@types/ws": ^8.5.5 abitype: 0.9.8 - isomorphic-ws: 5.0.0 + isows: 1.0.3 ws: 8.13.0 peerDependencies: typescript: ">=5.0.4" peerDependenciesMeta: typescript: optional: true - checksum: 558bc2b46afb177a34356f3cc8e6e444f4a6bf4d8aa15658f95eecc1bb42bbc09f240a1fd8eae98fa4973c3a1dc34f0492034b4b4d182f65b2dadf80167c8cea + checksum: c351fdea2d53d2d781ac73c964348b3b9fc5dd46f9eb53903e867705fc9e30a893cb9f2c8d7a00acdcdeca27d14eeebf976eed9f948c28c47018dc9211369117 languageName: node linkType: hard -"viem@npm:^1.1.4": - version: 1.21.4 - resolution: "viem@npm:1.21.4" +"viem@npm:^2.7.10": + version: 2.7.10 + resolution: "viem@npm:2.7.10" dependencies: "@adraffy/ens-normalize": 1.10.0 "@noble/curves": 1.2.0 "@noble/hashes": 1.3.2 "@scure/bip32": 1.3.2 "@scure/bip39": 1.2.1 - abitype: 0.9.8 + abitype: 1.0.0 isows: 1.0.3 ws: 8.13.0 peerDependencies: @@ -14664,7 +14664,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: c351fdea2d53d2d781ac73c964348b3b9fc5dd46f9eb53903e867705fc9e30a893cb9f2c8d7a00acdcdeca27d14eeebf976eed9f948c28c47018dc9211369117 + checksum: 355d6c743b14dc85270f39c580a993d80c4458273374ed00110c88927b3b30c4871817ad91c0552cdff9be6f3b3e8a1e091e0eca22ed437a961c8502293c6d22 languageName: node linkType: hard @@ -14675,12 +14675,12 @@ __metadata: languageName: node linkType: hard -"wagmi@npm:2.5.0": - version: 2.5.0 - resolution: "wagmi@npm:2.5.0" +"wagmi@npm:^2.5.7": + version: 2.5.7 + resolution: "wagmi@npm:2.5.7" dependencies: - "@wagmi/connectors": 4.1.8 - "@wagmi/core": 2.5.0 + "@wagmi/connectors": 4.1.14 + "@wagmi/core": 2.6.5 use-sync-external-store: 1.2.0 peerDependencies: "@tanstack/react-query": ">=5.0.0" @@ -14690,7 +14690,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: f7cbfd5cdfa23ed5c73be1d2c8ba6fdf70333fa24214ce11c60b33f46ddf5adeb2201ff3eae7b8b8629b84e8562ccdd007f2490e9d8ee468880bf4b9873faf77 + checksum: bdb228573ef3119c8a935d127a98879671e8d7bb37e342097c8a5a91dc8304d1304fe695ce6a31f7ec989c794f3aa9e5e2f74fa23b34a69a2589a0b19b376c74 languageName: node linkType: hard From b6f406aab2c51cb9a0105f8ac983c1891bc90ba4 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 17 Feb 2024 13:43:03 +0530 Subject: [PATCH 19/68] fix chains not configured buggst --- packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts | 2 +- packages/nextjs/services/web3/wagmiConfig.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts b/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts index c17a8a679..4e0e5b6d8 100644 --- a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts +++ b/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts @@ -11,7 +11,7 @@ export function useAccountBalance(address?: Address) { const price = useGlobalState(state => state.nativeCurrencyPrice); const { targetNetwork } = useTargetNetwork(); - const { data: blockNumber } = useBlockNumber({ watch: true }); + const { data: blockNumber } = useBlockNumber({ watch: true, chainId: targetNetwork.id }); const { data: fetchedBalanceData, isError, diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index 85af11c47..c376716e5 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -1,4 +1,4 @@ -import { enabledChains } from "./wagmiConnectors"; +import { enabledChains, wagmiConnectors } from "./wagmiConnectors"; import { createClient, http } from "viem"; import { hardhat } from "viem/chains"; import { createConfig } from "wagmi"; @@ -7,6 +7,7 @@ import scaffoldConfig from "~~/scaffold.config"; export const wagmiConfig = createConfig({ // TODO: Maybe we should get literal value here currently TS has widened the types because of ensabledChains logic chains: enabledChains, + connectors: wagmiConnectors, ssr: true, client({ chain }) { return createClient({ From 2285e388eb9b1c48083060c2da686ebd22a4ee35 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 17 Feb 2024 13:56:16 +0530 Subject: [PATCH 20/68] cast to Chain in wagmiConfig for compersion --- packages/nextjs/services/web3/wagmiConfig.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index c376716e5..8aceaeab1 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -1,5 +1,5 @@ import { enabledChains, wagmiConnectors } from "./wagmiConnectors"; -import { createClient, http } from "viem"; +import { Chain, createClient, http } from "viem"; import { hardhat } from "viem/chains"; import { createConfig } from "wagmi"; import scaffoldConfig from "~~/scaffold.config"; @@ -14,7 +14,8 @@ export const wagmiConfig = createConfig({ chain, // TODO: Create a file for alchmey links mapping and use fallback transport array so if alchmey fails fallbakc to default chain rpc transport: http(), - ...(chain.id === hardhat.id + // TODO: Casting to Chain type to avoid TS literal compersion, we could in future use getTargetNetworks function + ...(chain.id === (hardhat as Chain).id ? { pollingInterval: scaffoldConfig.pollingInterval, } From 3beb59c67ada3075f4108a2dcc06abacb4c5e205 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 26 Feb 2024 12:47:34 +0530 Subject: [PATCH 21/68] WIP: add very naive implmentation of burnerWallet --- .../web3/wagmi-burner/burnerWalletConfig.ts | 14 +- .../wagmi-burner/createBurnerConnector.ts | 207 ++++++++++++++++++ .../nextjs/services/web3/wagmiConnectors.tsx | 3 +- 3 files changed, 216 insertions(+), 8 deletions(-) create mode 100644 packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts diff --git a/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts b/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts index 9b1d3dea5..199071f94 100644 --- a/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts +++ b/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts @@ -1,7 +1,11 @@ import { Chain, Wallet } from "@rainbow-me/rainbowkit"; import { hardhat } from "viem/chains"; import scaffoldConfig from "~~/scaffold.config"; -import { BurnerConnector, burnerWalletId, burnerWalletName } from "~~/services/web3/wagmi-burner/BurnerConnector"; +import { + burnerWalletId, + burnerWalletName, + createBurnerConnector, +} from "~~/services/web3/wagmi-burner/createBurnerConnector"; import { getTargetNetworks } from "~~/utils/scaffold-eth"; const { onlyLocalBurnerWallet } = scaffoldConfig; @@ -17,7 +21,7 @@ const burnerWalletIconBase64 = /** * Wagmi config for burner wallet */ -export const burnerWalletConfig = ({ chains }: BurnerWalletOptions): Wallet => ({ +export const burnerWalletConfig = (): Wallet => ({ id: burnerWalletId, name: burnerWalletName, iconUrl: burnerWalletIconBase64, @@ -30,10 +34,6 @@ export const burnerWalletConfig = ({ chains }: BurnerWalletOptions): Wallet => ( return false; }, createConnector: () => { - const connector = new BurnerConnector({ chains, options: { defaultChainId: targetNetworks[0].id } }); - - return { - connector, - }; + return createBurnerConnector(); }, }); diff --git a/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts new file mode 100644 index 000000000..d46864596 --- /dev/null +++ b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts @@ -0,0 +1,207 @@ +/* + * TODO: Need to find better way to handle `getProvider` + * TODO: Burner Wallet does not show in Rainbow wallets + * If we don't find any good solution might need to implement our provider + * Good reference: https://github.com/safe-global/safe-apps-sdk/blob/main/packages/safe-apps-provider/src/provider.ts#L1 + * Using ethers `EIP1193ProviderBridge` to create a provider also does not work properly + * @example: + * ```ts + * const provider = new EIP1193ProviderBridge(wallet, provider); + * ``` + */ +import { createConnector, normalizeChainId } from "@wagmi/core"; +import { + EIP1193RequestFn, + Hex, + RpcRequestError, + SwitchChainError, + Transport, + WalletRpcSchema, + createWalletClient, + custom, + fromHex, + getAddress, + http, +} from "viem"; +import { privateKeyToAccount } from "viem/accounts"; +import { getHttpRpcClient, hexToBigInt, numberToHex } from "viem/utils"; +import { SendTransactionParameters } from "viem/zksync"; +import { BaseError } from "wagmi"; +import { loadBurnerSK } from "~~/hooks/scaffold-eth"; + +export const burnerWalletId = "burnerWallet"; +export const burnerWalletName = "Burner Wallet"; + +export class ConnectorNotConnectedError extends BaseError { + override name = "ConnectorNotConnectedError"; + constructor() { + super("Connector not connected."); + } +} + +export class ChainNotConfiguredError extends BaseError { + override name = "ChainNotConfiguredError"; + constructor() { + super("Chain not configured."); + } +} + +type Provider = ReturnType, EIP1193RequestFn>>; + +export const createBurnerConnector = () => { + let connected = true; + let connectedChainId: number; + return createConnector(config => ({ + id: burnerWalletId, + name: burnerWalletName, + type: "burnerWallet", + async connect({ chainId } = {}) { + const provider = await this.getProvider(); + const accounts = await provider.request({ + method: "eth_accounts", + }); + console.log("The account is", accounts); + let currentChainId = await this.getChainId(); + if (chainId && currentChainId !== chainId) { + const chain = await this.switchChain!({ chainId }); + currentChainId = chain.id; + } + connected = true; + return { accounts, chainId: currentChainId }; + }, + async getProvider({ chainId } = {}) { + const chain = config.chains.find(x => x.id === chainId) ?? config.chains[0]; + + const url = chain.rpcUrls.default.http[0]; + const burnerAccount = privateKeyToAccount(loadBurnerSK()); + const client = createWalletClient({ + chain: chain, + account: burnerAccount, + transport: http(), + }); + + const request: EIP1193RequestFn = async ({ method, params }) => { + if (method === "eth_sendTransaction") { + console.log("eth_sendTransaction the params are", params); + const actualParams = (params as SendTransactionParameters[])[0]; + const value = actualParams.value ? hexToBigInt(actualParams.value as unknown as Hex) : undefined; + const bigIntVal = value ? value : undefined; + console.log("The value is", bigIntVal); + const hash = await client.sendTransaction({ + ...(params as SendTransactionParameters[])[0], + value, + }); + return hash; + } + + if (method === "eth_accounts") { + return [burnerAccount.address]; + } + + if (method === "wallet_switchEthereumChain") { + type Params = [{ chainId: Hex }]; + connectedChainId = fromHex((params as Params)[0].chainId, "number"); + this.onChainChanged(connectedChainId.toString()); + return; + } + + const body = { method, params }; + const httpClient = getHttpRpcClient(url); + const { error, result } = await httpClient.request({ body }); + if (error) throw new RpcRequestError({ body, error, url }); + + return result; + }; + + return custom({ request })({ retryCount: 0 }); + }, + onChainChanged(chain) { + const chainId = normalizeChainId(chain); + config.emitter.emit("change", { chainId }); + }, + async getAccounts() { + console.log("getAccounts"); + if (!connected) throw new ConnectorNotConnectedError(); + const provider = await this.getProvider(); + const accounts = await provider.request({ method: "eth_accounts" }); + console.log("accounts", accounts); + return [accounts.map(x => getAddress(x))[0]]; + }, + async onDisconnect() { + console.log("disconnect from burnerwallet"); + config.emitter.emit("disconnect"); + connected = false; + }, + async getChainId() { + console.log("getChainId"); + const provider = await this.getProvider(); + const hexChainId = await provider.request({ method: "eth_chainId" }); + return fromHex(hexChainId, "number"); + }, + async isAuthorized() { + console.log("isAuthorized"); + if (!connected) return false; + const accounts = await this.getAccounts(); + return !!accounts.length; + }, + onAccountsChanged(accounts) { + console.log("onAccountsChanged", accounts); + if (accounts.length === 0) this.onDisconnect(); + else + config.emitter.emit("change", { + accounts: accounts.map(x => getAddress(x)), + }); + }, + async switchChain({ chainId }) { + const provider = await this.getProvider(); + const chain = config.chains.find(x => x.id === chainId); + if (!chain) throw new SwitchChainError(new ChainNotConfiguredError()); + + await provider.request({ + method: "wallet_switchEthereumChain", + params: [{ chainId: numberToHex(chainId) }], + }); + return chain; + }, + disconnect() { + console.log("disconnect from burnerwallet"); + console.log("disconnect from burnerwallet"); + connected = false; + return Promise.resolve(); + }, + })); +}; + +/* { + readonly icon?: string | undefined + readonly id: string + readonly name: string + readonly type: string + + setup?(): Promise + connect( + parameters?: + | { chainId?: number | undefined; isReconnecting?: boolean | undefined } + | undefined, + ): Promise<{ + accounts: readonly Address[] + chainId: number + }> + disconnect(): Promise + getAccounts(): Promise + getChainId(): Promise + getProvider( + parameters?: { chainId?: number | undefined } | undefined, + ): Promise + getClient?( + parameters?: { chainId?: number | undefined } | undefined, + ): Promise + isAuthorized(): Promise + switchChain?(parameters: { chainId: number }): Promise + + onAccountsChanged(accounts: string[]): void + onChainChanged(chainId: string): void + onConnect?(connectInfo: ProviderConnectInfo): void + onDisconnect(error?: Error | undefined): void + onMessage?(message: ProviderMessage): void + } & properties */ diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx index 13e09eb2c..c0052e7ab 100644 --- a/packages/nextjs/services/web3/wagmiConnectors.tsx +++ b/packages/nextjs/services/web3/wagmiConnectors.tsx @@ -1,3 +1,4 @@ +import { burnerWalletConfig } from "./wagmi-burner/burnerWalletConfig"; import { connectorsForWallets } from "@rainbow-me/rainbowkit"; import { coinbaseWallet, @@ -20,7 +21,7 @@ export const enabledChains = targetNetworks.find((network: chains.Chain) => netw : ([...targetNetworks, chains.mainnet] as const); // TODO: Get add burner wallet and get it working -const wallets = [metaMaskWallet, walletConnectWallet, ledgerWallet, coinbaseWallet, rainbowWallet]; +const wallets = [metaMaskWallet, walletConnectWallet, ledgerWallet, coinbaseWallet, rainbowWallet, burnerWalletConfig]; /** * wagmi connectors for the wagmi context From c6bc1f4972622d31432b2656756004ee3d4cde97 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 29 Feb 2024 23:10:02 +0530 Subject: [PATCH 22/68] WIP: update useScaffoldReadContract hook --- .../scaffold-eth/useScaffoldContractRead.ts | 17 +++++++++-------- packages/nextjs/utils/scaffold-eth/contract.ts | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractRead.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractRead.ts index 39c0cb13e..6b9d54f20 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractRead.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractRead.ts @@ -1,6 +1,8 @@ import { useTargetNetwork } from "./useTargetNetwork"; +import { QueryObserverResult, RefetchOptions } from "@tanstack/react-query"; import type { ExtractAbiFunctionNames } from "abitype"; -import { useContractRead } from "wagmi"; +import { ReadContractErrorType } from "viem"; +import { useReadContract } from "wagmi"; import { useDeployedContractInfo } from "~~/hooks/scaffold-eth"; import { AbiFunctionReturnType, @@ -17,7 +19,7 @@ import { * @param config.functionName - name of the function to be called * @param config.args - args to be passed to the function call */ -export const useScaffoldContractRead = < +export const useScaffoldReadContract = < TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, "pure" | "view">, >({ @@ -29,7 +31,7 @@ export const useScaffoldContractRead = < const { data: deployedContract } = useDeployedContractInfo(contractName); const { targetNetwork } = useTargetNetwork(); - return useContractRead({ + return useReadContract({ chainId: targetNetwork.id, functionName, address: deployedContract?.address, @@ -38,11 +40,10 @@ export const useScaffoldContractRead = < args, enabled: !Array.isArray(args) || !args.some(arg => arg === undefined), ...(readConfig as any), - }) as Omit, "data" | "refetch"> & { + }) as Omit, "data" | "refetch"> & { data: AbiFunctionReturnType | undefined; - refetch: (options?: { - throwOnError: boolean; - cancelRefetch: boolean; - }) => Promise>; + refetch: ( + options?: RefetchOptions | undefined, + ) => Promise, ReadContractErrorType>>; }; }; diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index ac7fe4a39..259d58c2e 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -18,7 +18,7 @@ import { Log, TransactionReceipt, } from "viem"; -import { UseContractEventConfig, UseContractReadConfig, UseContractWriteConfig } from "wagmi"; +import { UseContractEventConfig, UseContractWriteConfig, UseReadContractParameters } from "wagmi"; import deployedContractsData from "~~/contracts/deployedContracts"; import externalContractsData from "~~/contracts/externalContracts"; import scaffoldConfig from "~~/scaffold.config"; @@ -163,11 +163,11 @@ export type UseScaffoldReadConfig< > = { contractName: TContractName; } & IsContractDeclarationMissing< - Partial, + Partial, { functionName: TFunctionName; } & UseScaffoldArgsParam & - Omit + Omit >; export type UseScaffoldWriteConfig< From e0d42b6eb6bcd871a54c68c2c039abe00d5407b0 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 4 Mar 2024 19:58:57 +0530 Subject: [PATCH 23/68] WIP: first iteration of useScaffoldWriteContract --- .../scaffold-eth/useDeployedContractInfo.ts | 5 ++ .../scaffold-eth/useScaffoldContractWrite.ts | 87 +++++++------------ .../nextjs/utils/scaffold-eth/contract.ts | 25 +++--- 3 files changed, 49 insertions(+), 68 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts b/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts index f82dce14a..4a0231b3c 100644 --- a/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts +++ b/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts @@ -21,6 +21,11 @@ export const useDeployedContractInfo = (cont setStatus(ContractCodeStatus.NOT_FOUND); return; } + + // TODO: Handle this properly + if (!publicClient) { + return; + } const code = await publicClient.getBytecode({ address: deployedContract.address, }); diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts index 6571221a6..828578d83 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts @@ -1,13 +1,13 @@ import { useState } from "react"; import { useTargetNetwork } from "./useTargetNetwork"; import { Abi, ExtractAbiFunctionNames } from "abitype"; -import { useAccount, useContractWrite } from "wagmi"; +import { Config, UseWriteContractParameters, useAccount, useWriteContract } from "wagmi"; +import { WriteContractVariables } from "wagmi/query"; import { useDeployedContractInfo, useTransactor } from "~~/hooks/scaffold-eth"; import { getParsedError, notification } from "~~/utils/scaffold-eth"; -import { ContractAbi, ContractName, UseScaffoldWriteConfig } from "~~/utils/scaffold-eth/contract"; - -type UpdatedArgs = Parameters>["writeAsync"]>[0]; +import { ContractAbi, ContractName, scaffoldWriteContractVariables } from "~~/utils/scaffold-eth/contract"; +// TODO: Update comment and handle value autocompleteion /** * Wrapper around wagmi's useContractWrite hook which automatically loads (by name) the contract ABI and address from * the contracts present in deployedContracts.ts & externalContracts.ts corresponding to targetNetworks configured in scaffold.config.ts @@ -19,42 +19,24 @@ type UpdatedArgs = Parameters, "nonpayable" | "payable">, ->({ - contractName, - functionName, - args, - value, - onBlockConfirmation, - blockConfirmations, - ...writeConfig -}: UseScaffoldWriteConfig) => { +export const useScaffoldWriteContract = ( + contractName: TContractName, + writeContractParams?: UseWriteContractParameters, +) => { const { data: deployedContractData } = useDeployedContractInfo(contractName); const { chain } = useAccount(); const writeTx = useTransactor(); const [isMining, setIsMining] = useState(false); const { targetNetwork } = useTargetNetwork(); - const wagmiContractWrite = useContractWrite({ - chainId: targetNetwork.id, - address: deployedContractData?.address, - abi: deployedContractData?.abi as Abi, - functionName: functionName as any, - args: args as unknown[], - value: value, - ...writeConfig, - }); + const wagmiContractWrite = useWriteContract(writeContractParams); - const sendContractWriteTx = async ({ - args: newArgs, - value: newValue, - ...otherConfig - }: { - args?: UseScaffoldWriteConfig["args"]; - value?: UseScaffoldWriteConfig["value"]; - } & UpdatedArgs = {}) => { + // TODO: Pass in second arg option to it + const sendContractWriteTx = async < + TFunctionName extends ExtractAbiFunctionNames, "nonpayable" | "payable">, + >( + variables: scaffoldWriteContractVariables, + ) => { if (!deployedContractData) { notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?"); return; @@ -68,29 +50,22 @@ export const useScaffoldContractWrite = < return; } - if (wagmiContractWrite.writeAsync) { - try { - setIsMining(true); - const writeTxResult = await writeTx( - () => - wagmiContractWrite.writeAsync({ - args: newArgs ?? args, - value: newValue ?? value, - ...otherConfig, - }), - { onBlockConfirmation, blockConfirmations }, - ); + try { + setIsMining(true); + const makeWriteWithParams = () => + wagmiContractWrite.writeContractAsync({ + abi: deployedContractData.abi as Abi, + address: deployedContractData.address, + ...variables, + } as WriteContractVariables); + const writeTxResult = await writeTx(makeWriteWithParams); - return writeTxResult; - } catch (e: any) { - const message = getParsedError(e); - notification.error(message); - } finally { - setIsMining(false); - } - } else { - notification.error("Contract writer error. Try again."); - return; + return writeTxResult; + } catch (e: any) { + const message = getParsedError(e); + notification.error(message); + } finally { + setIsMining(false); } }; @@ -98,6 +73,6 @@ export const useScaffoldContractWrite = < ...wagmiContractWrite, isMining, // Overwrite wagmi's write async - writeAsync: sendContractWriteTx, + writeContractAsync: sendContractWriteTx, }; }; diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index b3e4651a5..5c09a7859 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -19,7 +19,9 @@ import { Log, TransactionReceipt, } from "viem"; -import { UseContractEventConfig, UseContractWriteConfig, UseReadContractParameters } from "wagmi"; +import { UseContractEventConfig, UseReadContractParameters, UseWriteContractParameters } from "wagmi"; +import { WriteContractParameters } from "wagmi/actions"; +import { WriteContractVariables } from "wagmi/query"; import deployedContractsData from "~~/contracts/deployedContracts"; import externalContractsData from "~~/contracts/externalContracts"; import scaffoldConfig from "~~/scaffold.config"; @@ -171,20 +173,19 @@ export type UseScaffoldReadConfig< Omit >; -export type UseScaffoldWriteConfig< +/* + *{ + onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; + blockConfirmations?: number; +} + * */ +export type scaffoldWriteContractVariables< TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, WriteAbiStateMutability>, > = { - contractName: TContractName; - onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; - blockConfirmations?: number; -} & IsContractDeclarationMissing< - Partial, - { - functionName: TFunctionName; - } & UseScaffoldArgsParam & - Omit ->; + functionName: TFunctionName; +} & UseScaffoldArgsParam & + Omit; export type UseScaffoldEventConfig< TContractName extends ContractName, From 96e4a7e4f12897d0112e207e85dba6d3ba51b941 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 4 Mar 2024 20:43:00 +0530 Subject: [PATCH 24/68] WIP: add options to writeContract --- .../scaffold-eth/useScaffoldContractWrite.ts | 32 ++++++++++++++----- .../nextjs/utils/scaffold-eth/contract.ts | 15 +++++++-- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts index 828578d83..ec9aae218 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts @@ -1,13 +1,20 @@ import { useState } from "react"; import { useTargetNetwork } from "./useTargetNetwork"; +import { MutateOptions } from "@tanstack/react-query"; import { Abi, ExtractAbiFunctionNames } from "abitype"; import { Config, UseWriteContractParameters, useAccount, useWriteContract } from "wagmi"; +import { WriteContractErrorType, WriteContractReturnType } from "wagmi/actions"; import { WriteContractVariables } from "wagmi/query"; import { useDeployedContractInfo, useTransactor } from "~~/hooks/scaffold-eth"; import { getParsedError, notification } from "~~/utils/scaffold-eth"; -import { ContractAbi, ContractName, scaffoldWriteContractVariables } from "~~/utils/scaffold-eth/contract"; +import { + ContractAbi, + ContractName, + scaffoldWriteContractOptions, + scaffoldWriteContractVariables, +} from "~~/utils/scaffold-eth/contract"; -// TODO: Update comment and handle value autocompleteion +// TODO: Update comment and handle `value` error /** * Wrapper around wagmi's useContractWrite hook which automatically loads (by name) the contract ABI and address from * the contracts present in deployedContracts.ts & externalContracts.ts corresponding to targetNetworks configured in scaffold.config.ts @@ -31,11 +38,11 @@ export const useScaffoldWriteContract = ( const wagmiContractWrite = useWriteContract(writeContractParams); - // TODO: Pass in second arg option to it const sendContractWriteTx = async < TFunctionName extends ExtractAbiFunctionNames, "nonpayable" | "payable">, >( variables: scaffoldWriteContractVariables, + options?: scaffoldWriteContractOptions, ) => { if (!deployedContractData) { notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?"); @@ -53,11 +60,20 @@ export const useScaffoldWriteContract = ( try { setIsMining(true); const makeWriteWithParams = () => - wagmiContractWrite.writeContractAsync({ - abi: deployedContractData.abi as Abi, - address: deployedContractData.address, - ...variables, - } as WriteContractVariables); + wagmiContractWrite.writeContractAsync( + { + abi: deployedContractData.abi as Abi, + address: deployedContractData.address, + ...variables, + } as WriteContractVariables, + options as + | MutateOptions< + WriteContractReturnType, + WriteContractErrorType, + WriteContractVariables + > + | undefined, + ); const writeTxResult = await writeTx(makeWriteWithParams); return writeTxResult; diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index 5c09a7859..099d1c69b 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -1,3 +1,4 @@ +import { MutateOptions } from "@tanstack/react-query"; import { Abi, AbiParameter, @@ -17,10 +18,10 @@ import { GetTransactionReceiptReturnType, GetTransactionReturnType, Log, - TransactionReceipt, + WriteContractErrorType, } from "viem"; -import { UseContractEventConfig, UseReadContractParameters, UseWriteContractParameters } from "wagmi"; -import { WriteContractParameters } from "wagmi/actions"; +import { Config, UseContractEventConfig, UseReadContractParameters, useWriteContract } from "wagmi"; +import { WriteContractParameters, WriteContractReturnType } from "wagmi/actions"; import { WriteContractVariables } from "wagmi/query"; import deployedContractsData from "~~/contracts/deployedContracts"; import externalContractsData from "~~/contracts/externalContracts"; @@ -187,6 +188,14 @@ export type scaffoldWriteContractVariables< } & UseScaffoldArgsParam & Omit; +type WriteVariables = WriteContractVariables; +export type scaffoldWriteContractOptions = MutateOptions< + WriteContractReturnType, + WriteContractErrorType, + WriteVariables, + unknown +>; + export type UseScaffoldEventConfig< TContractName extends ContractName, TEventName extends ExtractAbiEventNames>, From ba3f00aa541df73efe76127f80b06035c57e5e4a Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 7 Mar 2024 14:42:44 +0530 Subject: [PATCH 25/68] WIP: fix basic tx errors --- .../blockexplorer/_components/SearchBar.tsx | 2 +- .../transaction/[txHash]/page.tsx | 2 +- .../nextjs/components/scaffold-eth/Address.tsx | 13 +++++++++---- .../AddressInfoDropdown.tsx | 3 ++- .../hooks/scaffold-eth/useAutoConnect.ts | 18 +++++++++--------- .../hooks/scaffold-eth/useBurnerWallet.ts | 9 +++++---- .../hooks/scaffold-eth/useContractLogs.ts | 5 +++-- .../scaffold-eth/useScaffoldEventHistory.ts | 4 ++++ .../nextjs/utils/scaffold-eth/decodeTxData.ts | 17 ++++++++++------- packages/nextjs/utils/scaffold-eth/networks.ts | 1 - 10 files changed, 44 insertions(+), 30 deletions(-) diff --git a/packages/nextjs/app/blockexplorer/_components/SearchBar.tsx b/packages/nextjs/app/blockexplorer/_components/SearchBar.tsx index 82b883987..e602096d3 100644 --- a/packages/nextjs/app/blockexplorer/_components/SearchBar.tsx +++ b/packages/nextjs/app/blockexplorer/_components/SearchBar.tsx @@ -16,7 +16,7 @@ export const SearchBar = () => { event.preventDefault(); if (isHex(searchInput)) { try { - const tx = await client.getTransaction({ hash: searchInput }); + const tx = await client?.getTransaction({ hash: searchInput }); if (tx) { router.push(`/blockexplorer/transaction/${searchInput}`); return; diff --git a/packages/nextjs/app/blockexplorer/transaction/[txHash]/page.tsx b/packages/nextjs/app/blockexplorer/transaction/[txHash]/page.tsx index d9c45f557..f3e0431df 100644 --- a/packages/nextjs/app/blockexplorer/transaction/[txHash]/page.tsx +++ b/packages/nextjs/app/blockexplorer/transaction/[txHash]/page.tsx @@ -25,7 +25,7 @@ const TransactionPage: NextPage = ({ params }: PageProps) => { const { targetNetwork } = useTargetNetwork(); useEffect(() => { - if (txHash) { + if (txHash && client) { const fetchTransaction = async () => { const tx = await client.getTransaction({ hash: txHash }); const receipt = await client.getTransactionReceipt({ hash: txHash }); diff --git a/packages/nextjs/components/scaffold-eth/Address.tsx b/packages/nextjs/components/scaffold-eth/Address.tsx index 1c1ad600a..2241edc89 100644 --- a/packages/nextjs/components/scaffold-eth/Address.tsx +++ b/packages/nextjs/components/scaffold-eth/Address.tsx @@ -5,6 +5,7 @@ import Link from "next/link"; import { CopyToClipboard } from "react-copy-to-clipboard"; import { Address as AddressType, getAddress, isAddress } from "viem"; import { hardhat } from "viem/chains"; +import { normalize } from "viem/ens"; import { useEnsAvatar, useEnsName } from "wagmi"; import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline"; import { BlockieAvatar } from "~~/components/scaffold-eth"; @@ -41,14 +42,18 @@ export const Address = ({ address, disableAddressLink, format, size = "base" }: const { data: fetchedEns } = useEnsName({ address: checkSumAddress, - enabled: isAddress(checkSumAddress ?? ""), chainId: 1, + query: { + enabled: isAddress(checkSumAddress ?? ""), + }, }); const { data: fetchedEnsAvatar } = useEnsAvatar({ - name: fetchedEns, - enabled: Boolean(fetchedEns), + name: fetchedEns ? normalize(fetchedEns) : undefined, chainId: 1, - cacheTime: 30_000, + query: { + enabled: Boolean(fetchedEns), + gcTime: 30_000, + }, }); // We need to apply this pattern to avoid Hydration errors. diff --git a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx index b86128c9b..a9e31251b 100644 --- a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx +++ b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx @@ -2,7 +2,8 @@ import { useRef, useState } from "react"; import { NetworkOptions } from "./NetworkOptions"; import CopyToClipboard from "react-copy-to-clipboard"; import { getAddress } from "viem"; -import { Address, useDisconnect } from "wagmi"; +import { Address } from "viem"; +import { useDisconnect } from "wagmi"; import { ArrowLeftOnRectangleIcon, ArrowTopRightOnSquareIcon, diff --git a/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts b/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts index 549c7febd..32c96e846 100644 --- a/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts +++ b/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts @@ -1,6 +1,6 @@ import { useEffectOnce, useLocalStorage, useReadLocalStorage } from "usehooks-ts"; import { Chain, hardhat } from "viem/chains"; -import { Connector, useAccount, useConnect } from "wagmi"; +import { Connector, useAccountEffect, useConnect, useConnectors } from "wagmi"; import scaffoldConfig from "~~/scaffold.config"; import { burnerWalletId } from "~~/services/web3/wagmi-burner/BurnerConnector"; import { getTargetNetworks } from "~~/utils/scaffold-eth"; @@ -24,7 +24,7 @@ const getInitialConnector = ( connectors: Connector[], ): { connector: Connector | undefined; chainId?: number } | undefined => { // Look for the SAFE connector instance and connect to it instantly if loaded in SAFE frame - const safeConnectorInstance = connectors.find(connector => connector.id === SAFE_ID && connector.ready); + const safeConnectorInstance = connectors.find(connector => connector.id === SAFE_ID && connector); if (safeConnectorInstance) { return { connector: safeConnectorInstance }; @@ -58,11 +58,11 @@ const getInitialConnector = ( */ export const useAutoConnect = (): void => { const wagmiWalletValue = useReadLocalStorage(WAGMI_WALLET_STORAGE_KEY); - const [walletId, setWalletId] = useLocalStorage(SCAFFOLD_WALLET_STORAGE_KEY, wagmiWalletValue ?? "", { - initializeWithValue: false, - }); - const connectState = useConnect(); - useAccount({ + const [walletId, setWalletId] = useLocalStorage(SCAFFOLD_WALLET_STORAGE_KEY, wagmiWalletValue ?? ""); + + const connectors = useConnectors(); + const { connect } = useConnect(); + useAccountEffect({ onConnect({ connector }) { setWalletId(connector?.id ?? ""); }, @@ -73,10 +73,10 @@ export const useAutoConnect = (): void => { }); useEffectOnce(() => { - const initialConnector = getInitialConnector(getTargetNetworks()[0], walletId, connectState.connectors); + const initialConnector = getInitialConnector(getTargetNetworks()[0], walletId, [...connectors]); if (initialConnector?.connector) { - connectState.connect({ connector: initialConnector.connector, chainId: initialConnector.chainId }); + connect({ connector: initialConnector.connector, chainId: initialConnector.chainId }); } }); }; diff --git a/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts b/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts index 0538fc35e..4867cb2b3 100644 --- a/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts +++ b/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts @@ -1,8 +1,9 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { useLocalStorage } from "usehooks-ts"; import { Chain, Hex, HttpTransport, PrivateKeyAccount, createWalletClient, http } from "viem"; +import { WalletClient } from "viem"; import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; -import { WalletClient, usePublicClient } from "wagmi"; +import { usePublicClient } from "wagmi"; const burnerStorageKey = "scaffoldEth2.burnerWallet.sk"; @@ -99,14 +100,14 @@ export const useBurnerWallet = (): BurnerAccount => { console.log("âš  Could not create burner wallet"); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [publicClient.chain.id]); + }, [publicClient?.chain.id]); /** * Load wallet with burnerSk * connect and set wallet, once we have burnerSk and valid provider */ useEffect(() => { - if (burnerSk && publicClient.chain.id) { + if (burnerSk && publicClient?.chain.id) { let wallet: WalletClient | undefined = undefined; if (isValidSk(burnerSk)) { const randomAccount = privateKeyToAccount(burnerSk); @@ -132,7 +133,7 @@ export const useBurnerWallet = (): BurnerAccount => { } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [burnerSk, publicClient.chain.id]); + }, [burnerSk, publicClient?.chain.id]); return { walletClient, diff --git a/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts b/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts index a5cf7d0a6..511958e46 100644 --- a/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts +++ b/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts @@ -8,6 +8,7 @@ export const useContractLogs = (address: Address) => { useEffect(() => { const fetchLogs = async () => { + if (!client) return console.error("Client not found"); try { const existingLogs = await client.getLogs({ address: address, @@ -21,8 +22,8 @@ export const useContractLogs = (address: Address) => { }; fetchLogs(); - return client.watchBlockNumber({ - onBlockNumber: async (blockNumber, prevBlockNumber) => { + return client?.watchBlockNumber({ + onBlockNumber: async (_blockNumber, prevBlockNumber) => { const newLogs = await client.getLogs({ address: address, fromBlock: prevBlockNumber, diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts index a8c2b3a89..1c5c41083 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts @@ -65,6 +65,10 @@ export const useScaffoldEventHistory = < throw new Error("Hook disabled"); } + if (!publicClient) { + throw new Error("Public client not found"); + } + const event = (deployedContractData.abi as Abi).find( part => part.type === "event" && part.name === eventName, ) as AbiEvent; diff --git a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts b/packages/nextjs/utils/scaffold-eth/decodeTxData.ts index 481b978ee..cb4f80ee7 100644 --- a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts +++ b/packages/nextjs/utils/scaffold-eth/decodeTxData.ts @@ -1,6 +1,6 @@ import { TransactionWithFunction } from "./block"; import { GenericContractsDeclaration } from "./contract"; -import { Abi, decodeFunctionData, getAbiItem } from "viem"; +import { Abi, AbiFunction, decodeFunctionData, getAbiItem } from "viem"; import { hardhat } from "viem/chains"; import contractData from "~~/contracts/deployedContracts"; @@ -26,12 +26,15 @@ export const decodeTransactionData = (tx: TransactionWithFunction) => { }); tx.functionName = functionName; tx.functionArgs = args as any[]; - tx.functionArgNames = getAbiItem({ abi: contractAbi, name: functionName }).inputs.map( - (input: any) => input.name, - ); - tx.functionArgTypes = getAbiItem({ abi: contractAbi, name: functionName }).inputs.map( - (input: any) => input.type, - ); + // TODO: Maybe find better way instead of assertsing + tx.functionArgNames = getAbiItem({ + abi: contractAbi as AbiFunction[], + name: functionName, + })?.inputs?.map((input: any) => input.name); + tx.functionArgTypes = getAbiItem({ + abi: contractAbi as AbiFunction[], + name: functionName, + })?.inputs.map((input: any) => input.type); break; } catch (e) { diff --git a/packages/nextjs/utils/scaffold-eth/networks.ts b/packages/nextjs/utils/scaffold-eth/networks.ts index 789898449..88b69e77f 100644 --- a/packages/nextjs/utils/scaffold-eth/networks.ts +++ b/packages/nextjs/utils/scaffold-eth/networks.ts @@ -74,7 +74,6 @@ export function getBlockExplorerTxLink(chainId: number, txnHash: string) { } const targetChain = targetChainArr[0] as keyof typeof chains; - // @ts-expect-error : ignoring error since `blockExplorers` key may or may not be present on some chains const blockExplorerTxURL = chains[targetChain]?.blockExplorers?.default?.url; if (!blockExplorerTxURL) { From 64cebf78001f119df23b6cbccbfb2304371cd207 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 7 Mar 2024 14:57:41 +0530 Subject: [PATCH 26/68] WIP: fix getParsedError --- packages/nextjs/utils/scaffold-eth/getParsedError.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/utils/scaffold-eth/getParsedError.ts b/packages/nextjs/utils/scaffold-eth/getParsedError.ts index 31e7414d2..870067df8 100644 --- a/packages/nextjs/utils/scaffold-eth/getParsedError.ts +++ b/packages/nextjs/utils/scaffold-eth/getParsedError.ts @@ -14,7 +14,7 @@ export const getParsedError = (e: any): string => { message = e.shortMessage; const cause = e.cause as { data?: DecodeErrorResultReturnType } | undefined; // if its not generic error, append custom error name and its args to message - if (cause?.data && cause.data?.abiItem?.name !== "Error") { + if (cause?.data && cause.data?.errorName !== "Error") { const customErrorArgs = cause.data.args?.toString() ?? ""; message = `${message.replace(/reverted\.$/, "reverted with following reason:")}\n${ cause.data.errorName From daa719a112fe32cfbe0d5efa2ed9a915042a37f3 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 7 Mar 2024 15:18:35 +0530 Subject: [PATCH 27/68] WIP: fix types for event subscriber --- packages/nextjs/utils/scaffold-eth/contract.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index 099d1c69b..7c7f34273 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -20,7 +20,7 @@ import { Log, WriteContractErrorType, } from "viem"; -import { Config, UseContractEventConfig, UseReadContractParameters, useWriteContract } from "wagmi"; +import { Config, UseReadContractParameters, UseWatchContractEventParameters } from "wagmi"; import { WriteContractParameters, WriteContractReturnType } from "wagmi/actions"; import { WriteContractVariables } from "wagmi/query"; import deployedContractsData from "~~/contracts/deployedContracts"; @@ -206,7 +206,7 @@ export type UseScaffoldEventConfig< > = { contractName: TContractName; } & IsContractDeclarationMissing< - Omit & { + Omit & { listener: ( logs: Simplify< Omit, "args" | "eventName"> & { @@ -216,7 +216,7 @@ export type UseScaffoldEventConfig< >[], ) => void; }, - Omit, TEventName>, "listener"> & { + Omit>, "listener" | "address" | "abi"> & { listener: ( logs: Simplify< Omit, "args"> & { From 1ff666ebcb3a6c19f24f3ddaefa96b6b348ad42b Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 7 Mar 2024 15:22:12 +0530 Subject: [PATCH 28/68] remove BurnerConnector and BurnerConnectorTypes --- .../web3/wagmi-burner/BurnerConnector.ts | 155 ------------------ .../wagmi-burner/BurnerConnectorErrors.ts | 23 --- .../web3/wagmi-burner/BurnerConnectorTypes.ts | 10 -- 3 files changed, 188 deletions(-) delete mode 100644 packages/nextjs/services/web3/wagmi-burner/BurnerConnector.ts delete mode 100644 packages/nextjs/services/web3/wagmi-burner/BurnerConnectorErrors.ts delete mode 100644 packages/nextjs/services/web3/wagmi-burner/BurnerConnectorTypes.ts diff --git a/packages/nextjs/services/web3/wagmi-burner/BurnerConnector.ts b/packages/nextjs/services/web3/wagmi-burner/BurnerConnector.ts deleted file mode 100644 index 311c6d917..000000000 --- a/packages/nextjs/services/web3/wagmi-burner/BurnerConnector.ts +++ /dev/null @@ -1,155 +0,0 @@ -import { StaticJsonRpcProvider } from "@ethersproject/providers"; -import { Address, Chain, HttpTransport, PrivateKeyAccount, WalletClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { Connector } from "wagmi"; -import { loadBurnerSK } from "~~/hooks/scaffold-eth"; -import { BurnerConnectorError, BurnerConnectorErrorList } from "~~/services/web3/wagmi-burner/BurnerConnectorErrors"; -import { BurnerConnectorData, BurnerConnectorOptions } from "~~/services/web3/wagmi-burner/BurnerConnectorTypes"; - -export const burnerWalletId = "burner-wallet"; -export const burnerWalletName = "Burner Wallet"; - -/** - * This class is a wagmi connector for BurnerWallet. Its used by {@link burnerWalletConfig} - */ -export class BurnerConnector extends Connector { - readonly id = burnerWalletId; - readonly name = burnerWalletName; - readonly ready = true; - - private provider?: StaticJsonRpcProvider; - - // store for getWallet() - private burnerWallet: WalletClient | undefined; - - constructor(config: { chains?: Chain[]; options: BurnerConnectorOptions }) { - super(config); - this.burnerWallet = undefined; - } - - async getProvider() { - if (!this.provider) { - const chain = this.getChainFromId(); - this.provider = new StaticJsonRpcProvider(chain.rpcUrls.default.http[0]); - } - return this.provider; - } - - async getWalletClient(config?: { chainId?: number | undefined } | undefined) { - const chain = this.getChainFromId(config?.chainId); - if (!this.burnerWallet) { - const burnerAccount = privateKeyToAccount(loadBurnerSK()); - - const client = createWalletClient({ - chain: chain, - account: burnerAccount, - transport: http(), - }); - this.burnerWallet = client; - } - return Promise.resolve(this.burnerWallet); - } - - async connect(config?: { chainId?: number | undefined } | undefined): Promise> { - const chain = this.getChainFromId(config?.chainId); - - this.provider = new StaticJsonRpcProvider(chain.rpcUrls.default.http[0]); - const account = await this.getAccount(); - - if (this.provider == null || account == null) { - throw new BurnerConnectorError(BurnerConnectorErrorList.couldNotConnect); - } - - if (!account) { - throw new BurnerConnectorError(BurnerConnectorErrorList.accountNotFound); - } - - const data: Required = { - account, - chain: { - id: chain.id, - unsupported: false, - }, - provider: this.provider, - }; - - return Promise.resolve(data); - } - - private getChainFromId(chainId?: number) { - const resolveChainId = chainId ?? this.options.defaultChainId; - const chain = this.chains.find(f => f.id === resolveChainId); - if (chain == null) { - throw new BurnerConnectorError(BurnerConnectorErrorList.chainNotSupported); - } - return chain; - } - - disconnect(): Promise { - console.log("disconnect from burnerwallet"); - return Promise.resolve(); - } - - async getAccount(): Promise
{ - const bunerAccount = privateKeyToAccount(loadBurnerSK()); - return bunerAccount.address as Address; - } - - async getChainId(): Promise { - const network = await this.provider?.getNetwork(); - const chainId = network?.chainId ?? this.options.defaultChainId; - if (chainId == null) { - throw new BurnerConnectorError(BurnerConnectorErrorList.chainIdNotResolved); - } - - return Promise.resolve(chainId); - } - - async isAuthorized() { - try { - const account = await this.getAccount(); - return !!account; - } catch { - return false; - } - } - - protected async onAccountsChanged() { - const chainId = await this.getChainId(); - const chain = this.getChainFromId(chainId); - const bunerAccount = privateKeyToAccount(loadBurnerSK()); - - const client = createWalletClient({ - chain: chain, - account: bunerAccount, - transport: http(), - }); - this.burnerWallet = client; - } - - async switchChain(chainId: number) { - const chain = this.getChainFromId(chainId); - this.provider = new StaticJsonRpcProvider(chain.rpcUrls.default.http[0]); - - await this.onChainChanged(); - return chain; - } - - protected async onChainChanged() { - const chainId = await this.getChainId(); - const chain = this.getChainFromId(chainId); - const bunerAccount = privateKeyToAccount(loadBurnerSK()); - - const client = createWalletClient({ - chain: chain, - account: bunerAccount, - transport: http(), - }); - this.burnerWallet = client; - this.emit("change", { chain: { id: chainId, unsupported: false } }); - } - - protected onDisconnect(error: Error): void { - if (error) console.warn(error); - } -} diff --git a/packages/nextjs/services/web3/wagmi-burner/BurnerConnectorErrors.ts b/packages/nextjs/services/web3/wagmi-burner/BurnerConnectorErrors.ts deleted file mode 100644 index 48478706b..000000000 --- a/packages/nextjs/services/web3/wagmi-burner/BurnerConnectorErrors.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Error list used by {@link BurnerConnectorError} - */ -export const BurnerConnectorErrorList = { - accountNotFound: "Account not found", - couldNotConnect: "Could not connect to network", - unsupportedBurnerChain: "This network is not supported for burner connector", - chainIdNotResolved: "Could not resolve chainId", - chainNotSupported: "Chain is not supported, check burner wallet config", -} as const; - -/** - * A union of all the BurnerConnectorErrorList - */ -export type BurnerConnectorErrorTypes = (typeof BurnerConnectorErrorList)[keyof typeof BurnerConnectorErrorList]; - -export class BurnerConnectorError extends Error { - constructor(errorType: BurnerConnectorErrorTypes, message?: string) { - const msg = `BurnerConnectorError ${errorType}: ${message ?? ""} `; - super(msg); - console.warn(msg); - } -} diff --git a/packages/nextjs/services/web3/wagmi-burner/BurnerConnectorTypes.ts b/packages/nextjs/services/web3/wagmi-burner/BurnerConnectorTypes.ts deleted file mode 100644 index 02821a6ea..000000000 --- a/packages/nextjs/services/web3/wagmi-burner/BurnerConnectorTypes.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { StaticJsonRpcProvider } from "@ethersproject/providers"; -import { ConnectorData } from "wagmi"; - -export type BurnerConnectorOptions = { - defaultChainId: number; -}; - -export type BurnerConnectorData = ConnectorData & { - provider: StaticJsonRpcProvider; -}; From 6c5dbed60887b943f5810cc9553bcdf9220cbecc Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 7 Mar 2024 15:23:46 +0530 Subject: [PATCH 29/68] fix useAutoConnect import --- packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts b/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts index 32c96e846..b2f3cc7d6 100644 --- a/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts +++ b/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts @@ -2,7 +2,7 @@ import { useEffectOnce, useLocalStorage, useReadLocalStorage } from "usehooks-ts import { Chain, hardhat } from "viem/chains"; import { Connector, useAccountEffect, useConnect, useConnectors } from "wagmi"; import scaffoldConfig from "~~/scaffold.config"; -import { burnerWalletId } from "~~/services/web3/wagmi-burner/BurnerConnector"; +import { burnerWalletId } from "~~/services/web3/wagmi-burner/createBurnerConnector"; import { getTargetNetworks } from "~~/utils/scaffold-eth"; const SCAFFOLD_WALLET_STORAGE_KEY = "scaffoldEth2.wallet"; From a2f264947e21d748795047eab3d14d1256638821 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 21 Mar 2024 07:55:24 +0100 Subject: [PATCH 30/68] up rainbow, wagmi, viem --- packages/nextjs/package.json | 8 +- yarn.lock | 148 +++++++++++++++++------------------ 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 63447cb96..d57f139ec 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -16,8 +16,8 @@ "dependencies": { "@ethersproject/providers": "^5.7.2", "@heroicons/react": "^2.0.11", - "@rainbow-me/rainbowkit": "^2.0.0", - "@tanstack/react-query": "^5.17.19", + "@rainbow-me/rainbowkit": "^2.0.2", + "@tanstack/react-query": "^5.28.6", "@uniswap/sdk-core": "^4.0.1", "@uniswap/v2-sdk": "^3.0.1", "blo": "^1.0.1", @@ -32,8 +32,8 @@ "react-hot-toast": "^2.4.0", "use-debounce": "^8.0.4", "usehooks-ts": "^2.13.0", - "viem": "^2.7.10", - "wagmi": "^2.5.7", + "viem": "^2.8.16", + "wagmi": "^2.5.12", "zustand": "^4.1.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index ee38bba2b..2d2c94d01 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2060,9 +2060,9 @@ __metadata: languageName: node linkType: hard -"@rainbow-me/rainbowkit@npm:^2.0.0": - version: 2.0.0 - resolution: "@rainbow-me/rainbowkit@npm:2.0.0" +"@rainbow-me/rainbowkit@npm:^2.0.2": + version: 2.0.2 + resolution: "@rainbow-me/rainbowkit@npm:2.0.2" dependencies: "@vanilla-extract/css": 1.14.0 "@vanilla-extract/dynamic": 2.1.0 @@ -2076,7 +2076,7 @@ __metadata: react-dom: ">=17" viem: 2.x wagmi: 2.x - checksum: 7c7750516437a25366d33e853fcec4967ca81b6944905118fe1450b210b0196422b0b75340bb014da54c2f8933b5d7ca8ec9bfe7f75f570439d95fadfb6d0b40 + checksum: ece6ce515431e4dc33ecb3e1cc2d5f76d0f2dbeaaeae882a3369c881f100f6564da25a50c40f624cddf73aaa4e34caac23198d4b90750807c83228e908fda742 languageName: node linkType: hard @@ -2248,8 +2248,8 @@ __metadata: dependencies: "@ethersproject/providers": ^5.7.2 "@heroicons/react": ^2.0.11 - "@rainbow-me/rainbowkit": ^2.0.0 - "@tanstack/react-query": ^5.17.19 + "@rainbow-me/rainbowkit": ^2.0.2 + "@tanstack/react-query": ^5.28.6 "@trivago/prettier-plugin-sort-imports": ^4.1.1 "@types/node": ^17.0.35 "@types/nprogress": ^0 @@ -2281,8 +2281,8 @@ __metadata: use-debounce: ^8.0.4 usehooks-ts: ^2.13.0 vercel: ^32.4.1 - viem: ^2.7.10 - wagmi: ^2.5.7 + viem: ^2.8.16 + wagmi: ^2.5.12 zustand: ^4.1.2 languageName: unknown linkType: soft @@ -2580,21 +2580,21 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:5.17.19": - version: 5.17.19 - resolution: "@tanstack/query-core@npm:5.17.19" - checksum: ad09f1d64a169f8427225020b8b68328d64d1e671af28d47c33df31302106a05af4ed61587642704f70e1fe3861a8f00ea1722685a128dc6ee60fdf34b8dcc57 +"@tanstack/query-core@npm:5.28.6": + version: 5.28.6 + resolution: "@tanstack/query-core@npm:5.28.6" + checksum: 2d8406e707fe36a72a90fd0f4f2975bb14b0546c9d39574e0b70a2e52e49f12bff44f6610a0c15a526c0b0561b18c65987602e4ad3ea3fd767502bb938985f88 languageName: node linkType: hard -"@tanstack/react-query@npm:^5.17.19": - version: 5.17.19 - resolution: "@tanstack/react-query@npm:5.17.19" +"@tanstack/react-query@npm:^5.28.6": + version: 5.28.6 + resolution: "@tanstack/react-query@npm:5.28.6" dependencies: - "@tanstack/query-core": 5.17.19 + "@tanstack/query-core": 5.28.6 peerDependencies: react: ^18.0.0 - checksum: ceb98f42cb45c4e2086dbcf608c9488adc26dceebbf933c6ab59b896c3c8ae658622b213495140a19ac038458dbf3a484f033ffab9e1dcde7a77341d1b02bf23 + checksum: a920991b62b2bd7f91f8a8a4377a7f50c28c60979535dad33f45d15aa865d481956724493341e8343ca71dbaf00e9ed7cefb782d5460a7447ce39125a66f869f languageName: node linkType: hard @@ -3560,30 +3560,30 @@ __metadata: languageName: node linkType: hard -"@wagmi/connectors@npm:4.1.14": - version: 4.1.14 - resolution: "@wagmi/connectors@npm:4.1.14" +"@wagmi/connectors@npm:4.1.18": + version: 4.1.18 + resolution: "@wagmi/connectors@npm:4.1.18" dependencies: "@coinbase/wallet-sdk": 3.9.1 "@metamask/sdk": 0.14.3 "@safe-global/safe-apps-provider": 0.18.1 "@safe-global/safe-apps-sdk": 8.1.0 - "@walletconnect/ethereum-provider": 2.11.1 + "@walletconnect/ethereum-provider": 2.11.2 "@walletconnect/modal": 2.6.2 peerDependencies: - "@wagmi/core": 2.6.5 + "@wagmi/core": 2.6.9 typescript: ">=5.0.4" viem: 2.x peerDependenciesMeta: typescript: optional: true - checksum: 1ec7a4e3d4cc479455c377e731fbc80eb2d84114cf535532efec66f072c20592e0cb67b116dcf87abdede0a377413722f6f53a7d2aa3543ade05c3a37d7cf36b + checksum: 28c5a0ca2d8281cd5c373ab433744107afea126893290328cf5295ba6329ab508585180e71eb0415ed7c0aa0c1286f50de59eda089caab900d0e3ea9dd61c63c languageName: node linkType: hard -"@wagmi/core@npm:2.6.5": - version: 2.6.5 - resolution: "@wagmi/core@npm:2.6.5" +"@wagmi/core@npm:2.6.9": + version: 2.6.9 + resolution: "@wagmi/core@npm:2.6.9" dependencies: eventemitter3: 5.0.1 mipd: 0.0.5 @@ -3597,13 +3597,13 @@ __metadata: optional: true typescript: optional: true - checksum: c7f7ef8dcf4bba368416fbfd621a8b0effa9c017e804cee436187320c199cc2f0955f891b997102908c0902c0773fdbd367c79db614f17aee7b0e3e58ded855a + checksum: 88c89e243c5e8b05ed18c5dd26f05927440f0c87ae7b9129bd228910faedd91857ed0f8edd2ff6d45de9cc4e554b131718e97a309bf15a468887636377da63d5 languageName: node linkType: hard -"@walletconnect/core@npm:2.11.1": - version: 2.11.1 - resolution: "@walletconnect/core@npm:2.11.1" +"@walletconnect/core@npm:2.11.2": + version: 2.11.2 + resolution: "@walletconnect/core@npm:2.11.2" dependencies: "@walletconnect/heartbeat": 1.2.1 "@walletconnect/jsonrpc-provider": 1.0.13 @@ -3616,13 +3616,13 @@ __metadata: "@walletconnect/relay-auth": ^1.0.4 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.11.1 - "@walletconnect/utils": 2.11.1 + "@walletconnect/types": 2.11.2 + "@walletconnect/utils": 2.11.2 events: ^3.3.0 isomorphic-unfetch: 3.1.0 lodash.isequal: 4.5.0 uint8arrays: ^3.1.0 - checksum: ab32b6355f52320bf17553fd6326a2de7674832e96e4fd521e2186692ac77a286f1186594d0cefae996c09306c2d183b64647a5b87b08bc65fa31f6a2e47ca96 + checksum: 048c1dbdf096218b1e0c878005faf6ec98b825594e38dedbbf1bbd488c0cc73cc9376180c1701c8b26e9735e0cde0fe31ab3ee01facb34c30cd75077fe03f31f languageName: node linkType: hard @@ -3635,21 +3635,21 @@ __metadata: languageName: node linkType: hard -"@walletconnect/ethereum-provider@npm:2.11.1": - version: 2.11.1 - resolution: "@walletconnect/ethereum-provider@npm:2.11.1" +"@walletconnect/ethereum-provider@npm:2.11.2": + version: 2.11.2 + resolution: "@walletconnect/ethereum-provider@npm:2.11.2" 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/modal": ^2.6.2 - "@walletconnect/sign-client": 2.11.1 - "@walletconnect/types": 2.11.1 - "@walletconnect/universal-provider": 2.11.1 - "@walletconnect/utils": 2.11.1 + "@walletconnect/sign-client": 2.11.2 + "@walletconnect/types": 2.11.2 + "@walletconnect/universal-provider": 2.11.2 + "@walletconnect/utils": 2.11.2 events: ^3.3.0 - checksum: 3cf0e578a937755baa0315e1cbec57161a34dafc3ef927e32a17b448cc8e6ce814a4515af5fd34c7c72d9b84433855a59377a9367a0dfc1221158d88fc1e78c2 + checksum: 2225552d86a8b2d72ce8c8fc73dfc0433e4603f2252fe617ff42ce3e7f7022894abdaf921cca263f6a9e09f56534cb44f4a66b368a0b96fe72f36262ebb4400c languageName: node linkType: hard @@ -3820,20 +3820,20 @@ __metadata: languageName: node linkType: hard -"@walletconnect/sign-client@npm:2.11.1": - version: 2.11.1 - resolution: "@walletconnect/sign-client@npm:2.11.1" +"@walletconnect/sign-client@npm:2.11.2": + version: 2.11.2 + resolution: "@walletconnect/sign-client@npm:2.11.2" dependencies: - "@walletconnect/core": 2.11.1 + "@walletconnect/core": 2.11.2 "@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.11.1 - "@walletconnect/utils": 2.11.1 + "@walletconnect/types": 2.11.2 + "@walletconnect/utils": 2.11.2 events: ^3.3.0 - checksum: 4d7f0c95d72245e00a1485b59a1621ea245330689172cb54d386a5b85e2a49a66a690fe5601e03f8e1bb58e998d9f0cf7322d0c0705856e29e88bee9d706ee3f + checksum: c7e566bcddedfd3c2498541c4ba9caf45436e8de0d3aa3b1da4d3b09d3fbad630ecbfe249c3ea19ed16b368c32ec3fa28b3ed78a82f1ce52793af17a585a4d71 languageName: node linkType: hard @@ -3846,9 +3846,9 @@ __metadata: languageName: node linkType: hard -"@walletconnect/types@npm:2.11.1": - version: 2.11.1 - resolution: "@walletconnect/types@npm:2.11.1" +"@walletconnect/types@npm:2.11.2": + version: 2.11.2 + resolution: "@walletconnect/types@npm:2.11.2" dependencies: "@walletconnect/events": ^1.0.1 "@walletconnect/heartbeat": 1.2.1 @@ -3856,30 +3856,30 @@ __metadata: "@walletconnect/keyvaluestorage": ^1.1.1 "@walletconnect/logger": ^2.0.1 events: ^3.3.0 - checksum: c24f75d5f93eb5dd783108efd9a672c200b1ef8ab16d64ac2764348c1d17fb4946fe475bf9a590ebeb1f79e0cdd3c957d6700ef0fff140f59d34a7dc5ca5cbd5 + checksum: 0979f214682f46762f15bef23d37220abc677dac09b38d40687efb32d7ac2636a92eff952a382ecc291641054736b9236ddaab870d6607e42b9cb77ffdce4079 languageName: node linkType: hard -"@walletconnect/universal-provider@npm:2.11.1": - version: 2.11.1 - resolution: "@walletconnect/universal-provider@npm:2.11.1" +"@walletconnect/universal-provider@npm:2.11.2": + version: 2.11.2 + resolution: "@walletconnect/universal-provider@npm:2.11.2" 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.11.1 - "@walletconnect/types": 2.11.1 - "@walletconnect/utils": 2.11.1 + "@walletconnect/sign-client": 2.11.2 + "@walletconnect/types": 2.11.2 + "@walletconnect/utils": 2.11.2 events: ^3.3.0 - checksum: 2fd7988efb25b26964630b907ae328a8dc25915b9434a98ca53317334538d5c31a724d97164ecf1158b25a77c59a260d77f358199147744fc68203b7e4538800 + checksum: afc1f49acbabc9ac7b7d838d7cba4bddd9363869912e6b13338c6c5351519d1abb0aa358b217bee2092111f0423de706f990dfb10b4930d5d8ac6fd542c4cb55 languageName: node linkType: hard -"@walletconnect/utils@npm:2.11.1": - version: 2.11.1 - resolution: "@walletconnect/utils@npm:2.11.1" +"@walletconnect/utils@npm:2.11.2": + version: 2.11.2 + resolution: "@walletconnect/utils@npm:2.11.2" dependencies: "@stablelib/chacha20poly1305": 1.0.1 "@stablelib/hkdf": 1.0.1 @@ -3889,13 +3889,13 @@ __metadata: "@walletconnect/relay-api": ^1.0.9 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.11.1 + "@walletconnect/types": 2.11.2 "@walletconnect/window-getters": ^1.0.1 "@walletconnect/window-metadata": ^1.0.1 detect-browser: 5.3.0 query-string: 7.1.3 uint8arrays: ^3.1.0 - checksum: d3b90a4c1060009f1bb636474e850c051ba92684a6cb863c6e3458164930c275e3e5d2f776c540fa66be6df59546a2fd668122a1de9d5bcf511ec62a0e93fcd8 + checksum: 169147f99c7486c48c23ad0a8ebcbbb4f07aaffd954bad20f4b98516391e89e44f213b5226b3ef737ee91e1226fff9b1becf79dd56738c86becdc96d86cbbc72 languageName: node linkType: hard @@ -14657,9 +14657,9 @@ __metadata: languageName: node linkType: hard -"viem@npm:^2.7.10": - version: 2.7.10 - resolution: "viem@npm:2.7.10" +"viem@npm:^2.8.16": + version: 2.8.16 + resolution: "viem@npm:2.8.16" dependencies: "@adraffy/ens-normalize": 1.10.0 "@noble/curves": 1.2.0 @@ -14674,7 +14674,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 355d6c743b14dc85270f39c580a993d80c4458273374ed00110c88927b3b30c4871817ad91c0552cdff9be6f3b3e8a1e091e0eca22ed437a961c8502293c6d22 + checksum: f58029cf1f39d662c51f4ebc9c71dc407522161bac2de1112170061d5bfe90ce1802bde701d567022dc1fd83d22ec4df031bcf55d943481159e50acf984292ae languageName: node linkType: hard @@ -14685,12 +14685,12 @@ __metadata: languageName: node linkType: hard -"wagmi@npm:^2.5.7": - version: 2.5.7 - resolution: "wagmi@npm:2.5.7" +"wagmi@npm:^2.5.12": + version: 2.5.12 + resolution: "wagmi@npm:2.5.12" dependencies: - "@wagmi/connectors": 4.1.14 - "@wagmi/core": 2.6.5 + "@wagmi/connectors": 4.1.18 + "@wagmi/core": 2.6.9 use-sync-external-store: 1.2.0 peerDependencies: "@tanstack/react-query": ">=5.0.0" @@ -14700,7 +14700,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: bdb228573ef3119c8a935d127a98879671e8d7bb37e342097c8a5a91dc8304d1304fe695ce6a31f7ec989c794f3aa9e5e2f74fa23b34a69a2589a0b19b376c74 + checksum: 9e5af2b319c8721aff9eb92fc8811e1e9188b2319c8d1335a02aeb6fe3c0ea9e0d08997735420b35b0edaee5259021dce9727d348bbc50c429ea6cd55bd9dcdf languageName: node linkType: hard From e249448768226ce0c7b5e6579999ab87a3359a08 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Fri, 22 Mar 2024 17:10:42 +0530 Subject: [PATCH 31/68] remove console logs from burner connector --- .../wagmi-burner/createBurnerConnector.ts | 49 +------------------ 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts index d46864596..52077141c 100644 --- a/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts +++ b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts @@ -60,10 +60,9 @@ export const createBurnerConnector = () => { const accounts = await provider.request({ method: "eth_accounts", }); - console.log("The account is", accounts); let currentChainId = await this.getChainId(); - if (chainId && currentChainId !== chainId) { - const chain = await this.switchChain!({ chainId }); + if (chainId && currentChainId !== chainId && this.switchChain) { + const chain = await this.switchChain({ chainId }); currentChainId = chain.id; } connected = true; @@ -82,11 +81,8 @@ export const createBurnerConnector = () => { const request: EIP1193RequestFn = async ({ method, params }) => { if (method === "eth_sendTransaction") { - console.log("eth_sendTransaction the params are", params); const actualParams = (params as SendTransactionParameters[])[0]; const value = actualParams.value ? hexToBigInt(actualParams.value as unknown as Hex) : undefined; - const bigIntVal = value ? value : undefined; - console.log("The value is", bigIntVal); const hash = await client.sendTransaction({ ...(params as SendTransactionParameters[])[0], value, @@ -120,32 +116,26 @@ export const createBurnerConnector = () => { config.emitter.emit("change", { chainId }); }, async getAccounts() { - console.log("getAccounts"); if (!connected) throw new ConnectorNotConnectedError(); const provider = await this.getProvider(); const accounts = await provider.request({ method: "eth_accounts" }); - console.log("accounts", accounts); return [accounts.map(x => getAddress(x))[0]]; }, async onDisconnect() { - console.log("disconnect from burnerwallet"); config.emitter.emit("disconnect"); connected = false; }, async getChainId() { - console.log("getChainId"); const provider = await this.getProvider(); const hexChainId = await provider.request({ method: "eth_chainId" }); return fromHex(hexChainId, "number"); }, async isAuthorized() { - console.log("isAuthorized"); if (!connected) return false; const accounts = await this.getAccounts(); return !!accounts.length; }, onAccountsChanged(accounts) { - console.log("onAccountsChanged", accounts); if (accounts.length === 0) this.onDisconnect(); else config.emitter.emit("change", { @@ -164,44 +154,9 @@ export const createBurnerConnector = () => { return chain; }, disconnect() { - console.log("disconnect from burnerwallet"); console.log("disconnect from burnerwallet"); connected = false; return Promise.resolve(); }, })); }; - -/* { - readonly icon?: string | undefined - readonly id: string - readonly name: string - readonly type: string - - setup?(): Promise - connect( - parameters?: - | { chainId?: number | undefined; isReconnecting?: boolean | undefined } - | undefined, - ): Promise<{ - accounts: readonly Address[] - chainId: number - }> - disconnect(): Promise - getAccounts(): Promise - getChainId(): Promise - getProvider( - parameters?: { chainId?: number | undefined } | undefined, - ): Promise - getClient?( - parameters?: { chainId?: number | undefined } | undefined, - ): Promise - isAuthorized(): Promise - switchChain?(parameters: { chainId: number }): Promise - - onAccountsChanged(accounts: string[]): void - onChainChanged(chainId: string): void - onConnect?(connectInfo: ProviderConnectInfo): void - onDisconnect(error?: Error | undefined): void - onMessage?(message: ProviderMessage): void - } & properties */ From f1bbd320031d17163a061738cfc989e19e62a5ef Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 01:49:50 +0530 Subject: [PATCH 32/68] fix bug: add chainId to Debug page read --- .../nextjs/app/debug/_components/contract/DisplayVariable.tsx | 4 ++++ .../app/debug/_components/contract/ReadOnlyFunctionForm.tsx | 3 +++ 2 files changed, 7 insertions(+) diff --git a/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx b/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx index 90142fa78..bf7fe3f45 100644 --- a/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx +++ b/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx @@ -8,6 +8,7 @@ import { Address } from "viem"; import { useReadContract } from "wagmi"; import { ArrowPathIcon } from "@heroicons/react/24/outline"; import { useAnimationConfig } from "~~/hooks/scaffold-eth"; +import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; import { getParsedError, notification } from "~~/utils/scaffold-eth"; type DisplayVariableProps = { @@ -25,6 +26,8 @@ export const DisplayVariable = ({ abi, inheritedFrom, }: DisplayVariableProps) => { + const { targetNetwork } = useTargetNetwork(); + const { data: result, isFetching, @@ -34,6 +37,7 @@ export const DisplayVariable = ({ address: contractAddress, functionName: abiFunction.name, abi: abi, + chainId: targetNetwork.id, query: { retry: false, }, diff --git a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx index 08f8c9242..9ccc37fed 100644 --- a/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx @@ -13,6 +13,7 @@ import { getParsedContractFunctionArgs, transformAbiFunction, } from "~~/app/debug/_components/contract"; +import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; import { getParsedError, notification } from "~~/utils/scaffold-eth"; type ReadOnlyFunctionFormProps = { @@ -30,12 +31,14 @@ export const ReadOnlyFunctionForm = ({ }: ReadOnlyFunctionFormProps) => { const [form, setForm] = useState>(() => getInitialFormState(abiFunction)); const [result, setResult] = useState(); + const { targetNetwork } = useTargetNetwork(); const { isFetching, refetch, error } = useReadContract({ address: contractAddress, functionName: abiFunction.name, abi: abi, args: getParsedContractFunctionArgs(form), + chainId: targetNetwork.id, query: { enabled: false, retry: false, From 20dfe88476ff63eec6ef437540bc386366600a66 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 02:41:06 +0530 Subject: [PATCH 33/68] fix types useScaffoldContract --- .../hooks/scaffold-eth/useScaffoldContract.ts | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts index 459c51ca0..1add8cba8 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts @@ -1,3 +1,4 @@ +import { useTargetNetwork } from "./useTargetNetwork"; import { Account, Address, Chain, Client, Transport, getContract } from "viem"; import { usePublicClient } from "wagmi"; import { GetWalletClientReturnType } from "wagmi/actions"; @@ -22,26 +23,30 @@ export const useScaffoldContract = < walletClient?: TWalletClient | null; }) => { const { data: deployedContractData, isLoading: deployedContractLoading } = useDeployedContractInfo(contractName); - const publicClient = usePublicClient(); + const { targetNetwork } = useTargetNetwork(); + const publicClient = usePublicClient({ chainId: targetNetwork.id }); let contract = undefined; - if (deployedContractData) { + if (deployedContractData && publicClient) { contract = getContract< Transport, Address, Contract["abi"], - { - public: Client; - wallet?: Client; - }, + TWalletClient extends Exclude + ? { + public: Client; + wallet: TWalletClient; + } + : { public: Client }, Chain, Account >({ address: deployedContractData.address, abi: deployedContractData.abi as Contract["abi"], - // @ts-expect-error TODO: fix this type - walletClient: walletClient ? walletClient : undefined, - publicClient, + client: { + public: publicClient, + wallet: walletClient ? walletClient : undefined, + } as any, }); } From 8dc30d455a8260525968868e369d334019ab7948 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 02:44:31 +0530 Subject: [PATCH 34/68] fix todo in useDeployedContractInfo --- .../nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts b/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts index 4a0231b3c..e277e5866 100644 --- a/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts +++ b/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts @@ -17,22 +17,17 @@ export const useDeployedContractInfo = (cont useEffect(() => { const checkContractDeployment = async () => { + if (!isMounted() || !publicClient) return; + if (!deployedContract) { setStatus(ContractCodeStatus.NOT_FOUND); return; } - // TODO: Handle this properly - if (!publicClient) { - return; - } const code = await publicClient.getBytecode({ address: deployedContract.address, }); - if (!isMounted()) { - return; - } // If contract code is `0x` => no contract deployed on that address if (code === "0x") { setStatus(ContractCodeStatus.NOT_FOUND); From b2e80b9bb65b8e0a7644a703e20455925c8e1741 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 03:21:24 +0530 Subject: [PATCH 35/68] remove decodeTxData todo --- packages/nextjs/utils/scaffold-eth/decodeTxData.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts b/packages/nextjs/utils/scaffold-eth/decodeTxData.ts index cb4f80ee7..65c20f789 100644 --- a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts +++ b/packages/nextjs/utils/scaffold-eth/decodeTxData.ts @@ -26,7 +26,6 @@ export const decodeTransactionData = (tx: TransactionWithFunction) => { }); tx.functionName = functionName; tx.functionArgs = args as any[]; - // TODO: Maybe find better way instead of assertsing tx.functionArgNames = getAbiItem({ abi: contractAbi as AbiFunction[], name: functionName, From e110557ed4f1cc443e2a61ebb0c2435ca4a08c74 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 03:24:29 +0530 Subject: [PATCH 36/68] fix useSCWrite hook value type & forgive for errors when deployments are absent --- .../hooks/scaffold-eth/useScaffoldContractWrite.ts | 1 - packages/nextjs/utils/scaffold-eth/contract.ts | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts index d5862dfce..31426d336 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts @@ -14,7 +14,6 @@ import { scaffoldWriteContractVariables, } from "~~/utils/scaffold-eth/contract"; -// TODO: Update comment and handle `value` error /** * Wrapper around wagmi's useContractWrite hook which automatically loads (by name) the contract ABI and address from * the contracts present in deployedContracts.ts & externalContracts.ts corresponding to targetNetworks configured in scaffold.config.ts diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index 7c7f34273..05e2f72d0 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -156,6 +156,9 @@ type UseScaffoldArgsParam< > = TFunctionName extends FunctionNamesWithInputs ? { args: OptionalTupple, TFunctionName>>>; + value?: ExtractAbiFunction, TFunctionName>["stateMutability"] extends "payable" + ? bigint | undefined + : undefined; } : { args?: never; @@ -183,10 +186,13 @@ export type UseScaffoldReadConfig< export type scaffoldWriteContractVariables< TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, WriteAbiStateMutability>, -> = { - functionName: TFunctionName; -} & UseScaffoldArgsParam & - Omit; +> = IsContractDeclarationMissing< + Partial, + { + functionName: TFunctionName; + } & UseScaffoldArgsParam & + Omit +>; type WriteVariables = WriteContractVariables; export type scaffoldWriteContractOptions = MutateOptions< From ed5c282492207d7b75c4e72f1f6ad23f5e4c9354 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 03:29:35 +0530 Subject: [PATCH 37/68] update useSCWrite comments --- .../hooks/scaffold-eth/useScaffoldContractWrite.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts index 31426d336..2ec86d7e6 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts @@ -15,15 +15,10 @@ import { } from "~~/utils/scaffold-eth/contract"; /** - * Wrapper around wagmi's useContractWrite hook which automatically loads (by name) the contract ABI and address from + * Wrapper around wagmi's useWriteContract hook which automatically loads (by name) the contract ABI and address from * the contracts present in deployedContracts.ts & externalContracts.ts corresponding to targetNetworks configured in scaffold.config.ts - * @param config - The config settings, including extra wagmi configuration - * @param config.contractName - contract name - * @param config.functionName - name of the function to be called - * @param config.args - arguments for the function - * @param config.value - value in ETH that will be sent with transaction - * @param config.blockConfirmations - number of block confirmations to wait for (default: 1) - * @param config.onBlockConfirmation - callback that will be called after blockConfirmations. + * @param contractName - contract name + * @param writeContractParams - wagmi's useWriteContract parameters */ export const useScaffoldWriteContract = ( contractName: TContractName, From 5532e616d9950e540b6156e31e6c74f42d9c0462 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 22:11:58 +0530 Subject: [PATCH 38/68] remove useSCEvenHistory TODO --- packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts index 1c5c41083..75b5caebb 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts @@ -79,7 +79,7 @@ export const useScaffoldEventHistory = < const logs = await publicClient.getLogs({ address: deployedContractData?.address, event, - args: filters as any, // TODO: check if it works and fix type + args: filters as any, fromBlock: fromBlock || fromBlockUpdated, toBlock: blockNumber, }); From c7226056b5172cd6a2468e8abb6e9395586932b9 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 27 Mar 2024 22:36:19 +0530 Subject: [PATCH 39/68] remove useAutoConnect hook --- .../RainbowKitCustomConnectButton/index.tsx | 2 - packages/nextjs/hooks/scaffold-eth/index.ts | 1 - .../hooks/scaffold-eth/useAutoConnect.ts | 82 ------------------- 3 files changed, 85 deletions(-) delete mode 100644 packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts diff --git a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx index 902bd0933..6521200dc 100644 --- a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx +++ b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx @@ -15,8 +15,6 @@ import { getBlockExplorerAddressLink } from "~~/utils/scaffold-eth"; * Custom Wagmi Connect Button (watch balance + custom design) */ export const RainbowKitCustomConnectButton = () => { - // TODO: Add back autoconnect or use wagmi default autconnect should work - // useAutoConnect(); const networkColor = useNetworkColor(); const { targetNetwork } = useTargetNetwork(); diff --git a/packages/nextjs/hooks/scaffold-eth/index.ts b/packages/nextjs/hooks/scaffold-eth/index.ts index fb94bff78..73184bf56 100644 --- a/packages/nextjs/hooks/scaffold-eth/index.ts +++ b/packages/nextjs/hooks/scaffold-eth/index.ts @@ -13,4 +13,3 @@ export * from "./useScaffoldEventHistory"; export * from "./useTransactor"; export * from "./useFetchBlocks"; export * from "./useContractLogs"; -// export * from "./useAutoConnect"; diff --git a/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts b/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts deleted file mode 100644 index b2f3cc7d6..000000000 --- a/packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { useEffectOnce, useLocalStorage, useReadLocalStorage } from "usehooks-ts"; -import { Chain, hardhat } from "viem/chains"; -import { Connector, useAccountEffect, useConnect, useConnectors } from "wagmi"; -import scaffoldConfig from "~~/scaffold.config"; -import { burnerWalletId } from "~~/services/web3/wagmi-burner/createBurnerConnector"; -import { getTargetNetworks } from "~~/utils/scaffold-eth"; - -const SCAFFOLD_WALLET_STORAGE_KEY = "scaffoldEth2.wallet"; -const WAGMI_WALLET_STORAGE_KEY = "wagmi.wallet"; - -// ID of the SAFE connector instance -const SAFE_ID = "safe"; - -/** - * This function will get the initial wallet connector (if any), the app will connect to - * @param initialNetwork - * @param previousWalletId - * @param connectors - * @returns - */ -const getInitialConnector = ( - initialNetwork: Chain, - previousWalletId: string, - connectors: Connector[], -): { connector: Connector | undefined; chainId?: number } | undefined => { - // Look for the SAFE connector instance and connect to it instantly if loaded in SAFE frame - const safeConnectorInstance = connectors.find(connector => connector.id === SAFE_ID && connector); - - if (safeConnectorInstance) { - return { connector: safeConnectorInstance }; - } - - const allowBurner = scaffoldConfig.onlyLocalBurnerWallet ? initialNetwork.id === hardhat.id : true; - - if (!previousWalletId) { - // The user was not connected to a wallet - if (allowBurner && scaffoldConfig.walletAutoConnect) { - const connector = connectors.find(f => f.id === burnerWalletId); - return { connector, chainId: initialNetwork.id }; - } - } else { - // the user was connected to wallet - if (scaffoldConfig.walletAutoConnect) { - if (previousWalletId === burnerWalletId && !allowBurner) { - return; - } - - const connector = connectors.find(f => f.id === previousWalletId); - return { connector }; - } - } - - return undefined; -}; - -/** - * Automatically connect to a wallet/connector based on config and prior wallet - */ -export const useAutoConnect = (): void => { - const wagmiWalletValue = useReadLocalStorage(WAGMI_WALLET_STORAGE_KEY); - const [walletId, setWalletId] = useLocalStorage(SCAFFOLD_WALLET_STORAGE_KEY, wagmiWalletValue ?? ""); - - const connectors = useConnectors(); - const { connect } = useConnect(); - useAccountEffect({ - onConnect({ connector }) { - setWalletId(connector?.id ?? ""); - }, - onDisconnect() { - window.localStorage.setItem(WAGMI_WALLET_STORAGE_KEY, JSON.stringify("")); - setWalletId(""); - }, - }); - - useEffectOnce(() => { - const initialConnector = getInitialConnector(getTargetNetworks()[0], walletId, [...connectors]); - - if (initialConnector?.connector) { - connect({ connector: initialConnector.connector, chainId: initialConnector.chainId }); - } - }); -}; From 07e91f5d4fe142949af23a2e85180e25d87abe30 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 28 Mar 2024 00:02:38 +0530 Subject: [PATCH 40/68] create util getAlchemyHttpUrl and remove TODOs corresponding to it --- packages/nextjs/services/web3/wagmiConfig.tsx | 6 ++-- .../scaffold-eth/fetchPriceFromUniswap.ts | 6 ++-- .../nextjs/utils/scaffold-eth/networks.ts | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index 8aceaeab1..6277d5ffd 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -3,18 +3,16 @@ import { Chain, createClient, http } from "viem"; import { hardhat } from "viem/chains"; import { createConfig } from "wagmi"; import scaffoldConfig from "~~/scaffold.config"; +import { getAlchemyHttpUrl } from "~~/utils/scaffold-eth"; export const wagmiConfig = createConfig({ - // TODO: Maybe we should get literal value here currently TS has widened the types because of ensabledChains logic chains: enabledChains, connectors: wagmiConnectors, ssr: true, client({ chain }) { return createClient({ chain, - // TODO: Create a file for alchmey links mapping and use fallback transport array so if alchmey fails fallbakc to default chain rpc - transport: http(), - // TODO: Casting to Chain type to avoid TS literal compersion, we could in future use getTargetNetworks function + transport: http(getAlchemyHttpUrl(chain.id)), ...(chain.id === (hardhat as Chain).id ? { pollingInterval: scaffoldConfig.pollingInterval, diff --git a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts index d46095ddc..a5cec3d31 100644 --- a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts +++ b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts @@ -2,13 +2,11 @@ import { CurrencyAmount, Token } from "@uniswap/sdk-core"; import { Pair, Route } from "@uniswap/v2-sdk"; import { Address, createPublicClient, http, parseAbi } from "viem"; import { mainnet } from "viem/chains"; -import scaffoldConfig from "~~/scaffold.config"; -import { ChainWithAttributes } from "~~/utils/scaffold-eth"; +import { ChainWithAttributes, getAlchemyHttpUrl } from "~~/utils/scaffold-eth"; const publicClient = createPublicClient({ chain: mainnet, - // TODO: Since viem/chains removed alchemy links find a better way to handle this - transport: http(`https://eth-mainnet.g.alchemy.com/v2/${scaffoldConfig.alchemyApiKey}`), + transport: http(getAlchemyHttpUrl(mainnet.id)), }); const ABI = parseAbi([ diff --git a/packages/nextjs/utils/scaffold-eth/networks.ts b/packages/nextjs/utils/scaffold-eth/networks.ts index 36484fad8..6b8276fbd 100644 --- a/packages/nextjs/utils/scaffold-eth/networks.ts +++ b/packages/nextjs/utils/scaffold-eth/networks.ts @@ -11,6 +11,34 @@ type ChainAttributes = { export type ChainWithAttributes = chains.Chain & Partial; +// Mapping of chainId to RPC chain name an format followed by alchemy and infura +export const RPC_CHAIN_NAMES: Record = { + [chains.mainnet.id]: "eth-mainnet", + [chains.goerli.id]: "eth-goerli", + [chains.sepolia.id]: "eth-sepolia", + [chains.optimism.id]: "opt-mainnet", + [chains.optimismGoerli.id]: "opt-goerli", + [chains.optimismSepolia.id]: "opt-sepolia", + [chains.arbitrum.id]: "arb-mainnet", + [chains.arbitrumGoerli.id]: "arb-goerli", + [chains.arbitrumSepolia.id]: "arb-sepolia", + [chains.polygon.id]: "polygon-mainnet", + [chains.polygonMumbai.id]: "polygon-mumbai", + [chains.polygonAmoy.id]: "polygon-amoy", + [chains.astar.id]: "astar-mainnet", + [chains.polygonZkEvm.id]: "polygonzkevm-mainnet", + [chains.polygonZkEvmTestnet.id]: "polygonzkevm-testnet", + [chains.base.id]: "base-mainnet", + [chains.baseGoerli.id]: "base-goerli", + [chains.baseSepolia.id]: "base-sepolia", +}; + +export const getAlchemyHttpUrl = (chainId: number) => { + return RPC_CHAIN_NAMES[chainId] + ? `https://${RPC_CHAIN_NAMES[chainId]}.g.alchemy.com/v2/${scaffoldConfig.alchemyApiKey}` + : undefined; +}; + export const NETWORKS_EXTRA_DATA: Record = { [chains.hardhat.id]: { color: "#b8af0c", From 588e8039b45a3336dec33ad23c9f97e3d24dc587 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 28 Mar 2024 00:03:52 +0530 Subject: [PATCH 41/68] remove todo from wagmi connector --- packages/nextjs/services/web3/wagmiConnectors.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx index c0052e7ab..8ba0eae8e 100644 --- a/packages/nextjs/services/web3/wagmiConnectors.tsx +++ b/packages/nextjs/services/web3/wagmiConnectors.tsx @@ -20,7 +20,6 @@ export const enabledChains = targetNetworks.find((network: chains.Chain) => netw ? targetNetworks : ([...targetNetworks, chains.mainnet] as const); -// TODO: Get add burner wallet and get it working const wallets = [metaMaskWallet, walletConnectWallet, ledgerWallet, coinbaseWallet, rainbowWallet, burnerWalletConfig]; /** From f8ad6b3b5481c8c4c973a5f13e2eef6810f775a5 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 28 Mar 2024 00:23:08 +0530 Subject: [PATCH 42/68] fix bug in fetchPriceFromUniswap due to cyclic dependencies --- packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts index a5cec3d31..f257f4989 100644 --- a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts +++ b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts @@ -2,11 +2,12 @@ import { CurrencyAmount, Token } from "@uniswap/sdk-core"; import { Pair, Route } from "@uniswap/v2-sdk"; import { Address, createPublicClient, http, parseAbi } from "viem"; import { mainnet } from "viem/chains"; -import { ChainWithAttributes, getAlchemyHttpUrl } from "~~/utils/scaffold-eth"; +import scaffoldConfig from "~~/scaffold.config"; +import { ChainWithAttributes } from "~~/utils/scaffold-eth"; const publicClient = createPublicClient({ chain: mainnet, - transport: http(getAlchemyHttpUrl(mainnet.id)), + transport: http(`https://eth-mainnet.g.alchemy.com/v2/${scaffoldConfig.alchemyApiKey}`), }); const ABI = parseAbi([ From aff440d5324f9a0db1c9d0df12b3be6b14f8ac14 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 28 Mar 2024 00:23:54 +0530 Subject: [PATCH 43/68] remvoe todo from writeOnlyFunction form --- .../debug/_components/contract/WriteOnlyFunctionForm.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx index 00ba507a0..b8e8f8490 100644 --- a/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx +++ b/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx @@ -39,10 +39,7 @@ export const WriteOnlyFunctionForm = ({ const { targetNetwork } = useTargetNetwork(); const writeDisabled = !chain || chain?.id !== targetNetwork.id; - const { data: result, status, writeContractAsync } = useWriteContract(); - - // TODO: Check if this is the correct way to handle this - const isLoading = status === "pending"; + const { data: result, isPending, writeContractAsync } = useWriteContract(); const handleWrite = async () => { if (writeContractAsync) { @@ -127,8 +124,8 @@ export const WriteOnlyFunctionForm = ({ }`} data-tip={`${writeDisabled && "Wallet not connected or in the wrong network"}`} > -
From 7c2a0a21a8e095dbd550ad8fc863cd114451317a Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 28 Mar 2024 00:24:30 +0530 Subject: [PATCH 44/68] add TODO about react-query making request when window out of focus --- packages/nextjs/components/ScaffoldEthAppWithProviders.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx index c4df3b54e..14f42f2fe 100644 --- a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx +++ b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx @@ -49,6 +49,7 @@ export const ScaffoldEthAppWithProviders = ({ children }: { children: React.Reac return ( + {/* TODO: turn off refetch when tab focus is lost */} Date: Thu, 28 Mar 2024 22:19:38 +0530 Subject: [PATCH 45/68] move enabledChains to wagmiConnectors and pass burnerConfig only when allowed in scaffold.conig --- packages/nextjs/services/web3/wagmiConfig.tsx | 11 ++++++++-- .../nextjs/services/web3/wagmiConnectors.tsx | 21 ++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index 6277d5ffd..4428c2fec 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -1,10 +1,17 @@ -import { enabledChains, wagmiConnectors } from "./wagmiConnectors"; +import { wagmiConnectors } from "./wagmiConnectors"; import { Chain, createClient, http } from "viem"; -import { hardhat } from "viem/chains"; +import { hardhat, mainnet } from "viem/chains"; import { createConfig } from "wagmi"; import scaffoldConfig from "~~/scaffold.config"; import { getAlchemyHttpUrl } from "~~/utils/scaffold-eth"; +const { targetNetworks } = scaffoldConfig; + +// We always want to have mainnet enabled (ENS resolution, ETH price, etc). But only once. +export const enabledChains = targetNetworks.find((network: Chain) => network.id === 1) + ? targetNetworks + : ([...targetNetworks, mainnet] as const); + export const wagmiConfig = createConfig({ chains: enabledChains, connectors: wagmiConnectors, diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx index 8ba0eae8e..bc1d0d62c 100644 --- a/packages/nextjs/services/web3/wagmiConnectors.tsx +++ b/packages/nextjs/services/web3/wagmiConnectors.tsx @@ -10,17 +10,18 @@ import { import * as chains from "viem/chains"; import scaffoldConfig from "~~/scaffold.config"; -// import { burnerWalletConfig } from "~~/services/web3/wagmi-burner/burnerWalletConfig"; +const { onlyLocalBurnerWallet, targetNetworks } = scaffoldConfig; -// const { targetNetworks, onlyLocalBurnerWallet } = scaffoldConfig; -const { targetNetworks } = scaffoldConfig; - -// We always want to have mainnet enabled (ENS resolution, ETH price, etc). But only once. -export const enabledChains = targetNetworks.find((network: chains.Chain) => network.id === 1) - ? targetNetworks - : ([...targetNetworks, chains.mainnet] as const); - -const wallets = [metaMaskWallet, walletConnectWallet, ledgerWallet, coinbaseWallet, rainbowWallet, burnerWalletConfig]; +const wallets = [ + metaMaskWallet, + walletConnectWallet, + ledgerWallet, + coinbaseWallet, + rainbowWallet, + ...(!targetNetworks.some(network => network.id !== (chains.hardhat as chains.Chain).id) || !onlyLocalBurnerWallet + ? [burnerWalletConfig] + : []), +]; /** * wagmi connectors for the wagmi context From e9c0436d31d227be08f3f118e38c5f823516bab6 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 28 Mar 2024 22:23:56 +0530 Subject: [PATCH 46/68] add safeWallet as connector rainbowkit --- packages/nextjs/services/web3/wagmiConnectors.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx index bc1d0d62c..90d52cabb 100644 --- a/packages/nextjs/services/web3/wagmiConnectors.tsx +++ b/packages/nextjs/services/web3/wagmiConnectors.tsx @@ -5,6 +5,7 @@ import { ledgerWallet, metaMaskWallet, rainbowWallet, + safeWallet, walletConnectWallet, } from "@rainbow-me/rainbowkit/wallets"; import * as chains from "viem/chains"; @@ -18,6 +19,7 @@ const wallets = [ ledgerWallet, coinbaseWallet, rainbowWallet, + safeWallet, ...(!targetNetworks.some(network => network.id !== (chains.hardhat as chains.Chain).id) || !onlyLocalBurnerWallet ? [burnerWalletConfig] : []), From 83b5b03891e3d9c6170c16894f72c1c4184ae7a6 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 28 Mar 2024 22:37:18 +0530 Subject: [PATCH 47/68] diable refetchOnWindowFocus --- .../nextjs/components/ScaffoldEthAppWithProviders.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx index 14f42f2fe..05273c2b7 100644 --- a/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx +++ b/packages/nextjs/components/ScaffoldEthAppWithProviders.tsx @@ -36,7 +36,13 @@ const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => { ); }; -export const queryClient = new QueryClient(); +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + refetchOnWindowFocus: false, + }, + }, +}); export const ScaffoldEthAppWithProviders = ({ children }: { children: React.ReactNode }) => { const { resolvedTheme } = useTheme(); @@ -49,7 +55,6 @@ export const ScaffoldEthAppWithProviders = ({ children }: { children: React.Reac return ( - {/* TODO: turn off refetch when tab focus is lost */} Date: Fri, 29 Mar 2024 01:11:36 +0530 Subject: [PATCH 48/68] rename hooks filename --- packages/nextjs/hooks/scaffold-eth/index.ts | 4 ++-- ...{useScaffoldContractRead.ts => useScaffoldReadContract.ts} | 0 ...seScaffoldContractWrite.ts => useScaffoldWriteContract.ts} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename packages/nextjs/hooks/scaffold-eth/{useScaffoldContractRead.ts => useScaffoldReadContract.ts} (100%) rename packages/nextjs/hooks/scaffold-eth/{useScaffoldContractWrite.ts => useScaffoldWriteContract.ts} (100%) diff --git a/packages/nextjs/hooks/scaffold-eth/index.ts b/packages/nextjs/hooks/scaffold-eth/index.ts index d35c6b69b..be317520d 100644 --- a/packages/nextjs/hooks/scaffold-eth/index.ts +++ b/packages/nextjs/hooks/scaffold-eth/index.ts @@ -5,8 +5,8 @@ export * from "./useNativeCurrencyPrice"; export * from "./useNetworkColor"; export * from "./useOutsideClick"; export * from "./useScaffoldContract"; -export * from "./useScaffoldContractRead"; -export * from "./useScaffoldContractWrite"; +export * from "./useScaffoldReadContract"; +export * from "./useScaffoldWriteContract"; export * from "./useScaffoldEventSubscriber"; export * from "./useScaffoldEventHistory"; export * from "./useTransactor"; diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractRead.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts similarity index 100% rename from packages/nextjs/hooks/scaffold-eth/useScaffoldContractRead.ts rename to packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts similarity index 100% rename from packages/nextjs/hooks/scaffold-eth/useScaffoldContractWrite.ts rename to packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts From 23179fabdb7fb49a5fddaafca533451502970d5b Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 1 Apr 2024 13:05:38 +0530 Subject: [PATCH 49/68] add abitype as devDependency and Register Address as string --- packages/nextjs/package.json | 1 + packages/nextjs/types/abitype/abi.d.ts | 8 +++++++- yarn.lock | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index d57f139ec..6bad4f972 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -43,6 +43,7 @@ "@types/react": "^18.0.9", "@types/react-copy-to-clipboard": "^5.0.4", "@typescript-eslint/eslint-plugin": "^5.39.0", + "abitype": "^1.0.2", "autoprefixer": "^10.4.12", "eslint": "^8.15.0", "eslint-config-next": "^14.0.4", diff --git a/packages/nextjs/types/abitype/abi.d.ts b/packages/nextjs/types/abitype/abi.d.ts index 284937a82..c216a079b 100644 --- a/packages/nextjs/types/abitype/abi.d.ts +++ b/packages/nextjs/types/abitype/abi.d.ts @@ -2,13 +2,19 @@ import "abitype"; type AddressType = string; +declare module "abitype" { + export interface Register { + AddressType: AddressType; + } +} + declare module "viem/node_modules/abitype" { export interface Register { AddressType: AddressType; } } -declare module "abitype" { +declare module "wagmi/node_moudles/abitype" { export interface Register { AddressType: AddressType; } diff --git a/yarn.lock b/yarn.lock index 2d2c94d01..dfe98fd1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2258,6 +2258,7 @@ __metadata: "@typescript-eslint/eslint-plugin": ^5.39.0 "@uniswap/sdk-core": ^4.0.1 "@uniswap/v2-sdk": ^3.0.1 + abitype: ^1.0.2 autoprefixer: ^10.4.12 blo: ^1.0.1 daisyui: 4.5.0 @@ -3962,6 +3963,21 @@ __metadata: languageName: node linkType: hard +"abitype@npm:^1.0.2": + version: 1.0.2 + resolution: "abitype@npm:1.0.2" + peerDependencies: + typescript: ">=5.0.4" + zod: ^3 >=3.22.0 + peerDependenciesMeta: + typescript: + optional: true + zod: + optional: true + checksum: 0986ec822ad279e7ea1d15398f88bad335a58419799f8ba80e3d5712fdd5a2b5858b387a1213d9da31571c3a42d10ca878a463cce11dae1bb17dbe4deeb40db4 + languageName: node + linkType: hard + "abstract-level@npm:^1.0.0, abstract-level@npm:^1.0.2, abstract-level@npm:^1.0.3": version: 1.0.3 resolution: "abstract-level@npm:1.0.3" From 81c995bee75680e05c8257ba7af89f225127cf5d Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 1 Apr 2024 23:40:52 +0530 Subject: [PATCH 50/68] spread walletDetails params in createBurnerConnector func --- .../nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts | 4 +--- .../services/web3/wagmi-burner/createBurnerConnector.ts | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts b/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts index 199071f94..b00ff7427 100644 --- a/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts +++ b/packages/nextjs/services/web3/wagmi-burner/burnerWalletConfig.ts @@ -33,7 +33,5 @@ export const burnerWalletConfig = (): Wallet => ({ return false; }, - createConnector: () => { - return createBurnerConnector(); - }, + createConnector: createBurnerConnector, }); diff --git a/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts index 52077141c..dc1b5fc6b 100644 --- a/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts +++ b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts @@ -9,6 +9,7 @@ * const provider = new EIP1193ProviderBridge(wallet, provider); * ``` */ +import { WalletDetailsParams } from "@rainbow-me/rainbowkit"; import { createConnector, normalizeChainId } from "@wagmi/core"; import { EIP1193RequestFn, @@ -48,7 +49,7 @@ export class ChainNotConfiguredError extends BaseError { type Provider = ReturnType, EIP1193RequestFn>>; -export const createBurnerConnector = () => { +export const createBurnerConnector = (walletDetails: WalletDetailsParams) => { let connected = true; let connectedChainId: number; return createConnector(config => ({ @@ -158,5 +159,6 @@ export const createBurnerConnector = () => { connected = false; return Promise.resolve(); }, + ...walletDetails, })); }; From 634562ce08ea1d3487fba5d06246396c268f1b2c Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Mon, 1 Apr 2024 23:41:47 +0530 Subject: [PATCH 51/68] remove todo from burnerWallet config --- .../web3/wagmi-burner/createBurnerConnector.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts index dc1b5fc6b..de53737b6 100644 --- a/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts +++ b/packages/nextjs/services/web3/wagmi-burner/createBurnerConnector.ts @@ -1,14 +1,3 @@ -/* - * TODO: Need to find better way to handle `getProvider` - * TODO: Burner Wallet does not show in Rainbow wallets - * If we don't find any good solution might need to implement our provider - * Good reference: https://github.com/safe-global/safe-apps-sdk/blob/main/packages/safe-apps-provider/src/provider.ts#L1 - * Using ethers `EIP1193ProviderBridge` to create a provider also does not work properly - * @example: - * ```ts - * const provider = new EIP1193ProviderBridge(wallet, provider); - * ``` - */ import { WalletDetailsParams } from "@rainbow-me/rainbowkit"; import { createConnector, normalizeChainId } from "@wagmi/core"; import { From f23e8a1d772c6f17881023b8b0dfabcd8f08b9ad Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 2 Apr 2024 00:11:43 +0530 Subject: [PATCH 52/68] remove useAccountBalance hook --- .../hooks/scaffold-eth/useAccountBalance.ts | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts diff --git a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts b/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts deleted file mode 100644 index 4e0e5b6d8..000000000 --- a/packages/nextjs/hooks/scaffold-eth/useAccountBalance.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { useCallback, useEffect, useState } from "react"; -import { useTargetNetwork } from "./useTargetNetwork"; -import { Address, formatUnits } from "viem"; -import { useBalance, useBlockNumber } from "wagmi"; -import { queryClient } from "~~/components/ScaffoldEthAppWithProviders"; -import { useGlobalState } from "~~/services/store/store"; - -export function useAccountBalance(address?: Address) { - const [isEthBalance, setIsEthBalance] = useState(true); - const [balance, setBalance] = useState(null); - const price = useGlobalState(state => state.nativeCurrencyPrice); - const { targetNetwork } = useTargetNetwork(); - - const { data: blockNumber } = useBlockNumber({ watch: true, chainId: targetNetwork.id }); - const { - data: fetchedBalanceData, - isError, - isLoading, - queryKey, - } = useBalance({ - address, - chainId: targetNetwork.id, - }); - - useEffect(() => { - queryClient.invalidateQueries({ queryKey }); - }, [blockNumber, queryKey]); - - const onToggleBalance = useCallback(() => { - if (price > 0) { - setIsEthBalance(!isEthBalance); - } - }, [isEthBalance, price]); - - useEffect(() => { - if (fetchedBalanceData?.value !== undefined && fetchedBalanceData?.decimals) { - setBalance(Number(formatUnits(fetchedBalanceData.value, fetchedBalanceData.decimals))); - } - }, [fetchedBalanceData, targetNetwork]); - - return { balance, price, isError, isLoading, onToggleBalance, isEthBalance }; -} From 2a12d851dfdb6e81a9d07632d051ec177ceebadc Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 2 Apr 2024 00:14:42 +0530 Subject: [PATCH 53/68] remove @ethersproject/providers as dependency --- packages/nextjs/package.json | 1 - yarn.lock | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 6bad4f972..cd7137a25 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -14,7 +14,6 @@ "vercel:yolo": "vercel --build-env NEXT_PUBLIC_IGNORE_BUILD_ERROR=true" }, "dependencies": { - "@ethersproject/providers": "^5.7.2", "@heroicons/react": "^2.0.11", "@rainbow-me/rainbowkit": "^2.0.2", "@tanstack/react-query": "^5.28.6", diff --git a/yarn.lock b/yarn.lock index dfe98fd1a..1dc8ec45a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2246,7 +2246,6 @@ __metadata: version: 0.0.0-use.local resolution: "@se-2/nextjs@workspace:packages/nextjs" dependencies: - "@ethersproject/providers": ^5.7.2 "@heroicons/react": ^2.0.11 "@rainbow-me/rainbowkit": ^2.0.2 "@tanstack/react-query": ^5.28.6 From 4d45d301947da30c2ba62681639801bb593fbfce Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 2 Apr 2024 16:37:43 +0530 Subject: [PATCH 54/68] allow blockConfirmation + blockConfirmations to useScafffoldWriteContract hook --- .../hooks/scaffold-eth/useScaffoldWriteContract.ts | 8 +++++--- packages/nextjs/hooks/scaffold-eth/useTransactor.tsx | 8 +++----- packages/nextjs/utils/scaffold-eth/contract.ts | 10 +++++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts index 2ec86d7e6..13cd77403 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts @@ -53,6 +53,7 @@ export const useScaffoldWriteContract = ( try { setIsMining(true); + const { blockConfirmations, onBlockConfirmation, ...mutateOptions } = options || {}; const makeWriteWithParams = () => wagmiContractWrite.writeContractAsync( { @@ -60,15 +61,16 @@ export const useScaffoldWriteContract = ( address: deployedContractData.address, ...variables, } as WriteContractVariables, - options as + mutateOptions as | MutateOptions< WriteContractReturnType, WriteContractErrorType, - WriteContractVariables + WriteContractVariables, + unknown > | undefined, ); - const writeTxResult = await writeTx(makeWriteWithParams); + const writeTxResult = await writeTx(makeWriteWithParams, { blockConfirmations, onBlockConfirmation }); return writeTxResult; } catch (e: any) { diff --git a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx index afdc0833a..08330a30b 100644 --- a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx +++ b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx @@ -1,15 +1,13 @@ import { getPublicClient } from "@wagmi/core"; -import { Hash, SendTransactionParameters, TransactionReceipt, WalletClient } from "viem"; +import { Hash, SendTransactionParameters, WalletClient } from "viem"; import { useWalletClient } from "wagmi"; import { wagmiConfig } from "~~/services/web3/wagmiConfig"; import { getBlockExplorerTxLink, getParsedError, notification } from "~~/utils/scaffold-eth"; +import { TrasactorFuncOptions } from "~~/utils/scaffold-eth/contract"; type TransactionFunc = ( tx: (() => Promise) | SendTransactionParameters, - options?: { - onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; - blockConfirmations?: number; - }, + options?: TrasactorFuncOptions, ) => Promise; /** diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index 05e2f72d0..d1b4538a8 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -18,6 +18,7 @@ import { GetTransactionReceiptReturnType, GetTransactionReturnType, Log, + TransactionReceipt, WriteContractErrorType, } from "viem"; import { Config, UseReadContractParameters, UseWatchContractEventParameters } from "wagmi"; @@ -195,12 +196,19 @@ export type scaffoldWriteContractVariables< >; type WriteVariables = WriteContractVariables; + +export type TrasactorFuncOptions = { + onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; + blockConfirmations?: number; +}; + export type scaffoldWriteContractOptions = MutateOptions< WriteContractReturnType, WriteContractErrorType, WriteVariables, unknown ->; +> & + TrasactorFuncOptions; export type UseScaffoldEventConfig< TContractName extends ContractName, From 7674eaed025e401d0d9b7382c9871dffa4b650c7 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 2 Apr 2024 17:27:56 +0530 Subject: [PATCH 55/68] use getAlchemyHttpUrl in fetchPriceFromUniwswap with realtive import --- packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts index f257f4989..2a5ab560c 100644 --- a/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts +++ b/packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts @@ -1,13 +1,12 @@ +import { ChainWithAttributes, getAlchemyHttpUrl } from "./networks"; import { CurrencyAmount, Token } from "@uniswap/sdk-core"; import { Pair, Route } from "@uniswap/v2-sdk"; import { Address, createPublicClient, http, parseAbi } from "viem"; import { mainnet } from "viem/chains"; -import scaffoldConfig from "~~/scaffold.config"; -import { ChainWithAttributes } from "~~/utils/scaffold-eth"; const publicClient = createPublicClient({ chain: mainnet, - transport: http(`https://eth-mainnet.g.alchemy.com/v2/${scaffoldConfig.alchemyApiKey}`), + transport: http(getAlchemyHttpUrl(mainnet.id)), }); const ABI = parseAbi([ From c8f5d3473e3205441f031c8c7f921e24252a5e7d Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 3 Apr 2024 23:05:41 +0530 Subject: [PATCH 56/68] remove walletAutConnect boolean from scaffold.config --- packages/nextjs/scaffold.config.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index f5ead0322..86c737a21 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -6,7 +6,6 @@ export type ScaffoldConfig = { alchemyApiKey: string; walletConnectProjectId: string; onlyLocalBurnerWallet: boolean; - walletAutoConnect: boolean; }; const scaffoldConfig = { @@ -31,13 +30,6 @@ const scaffoldConfig = { // Only show the Burner Wallet when running on hardhat network onlyLocalBurnerWallet: true, - - /** - * Auto connect: - * 1. If the user was connected into a wallet before, on page reload reconnect automatically - * 2. If user is not connected to any wallet: On reload, connect to burner wallet if burnerWallet.enabled is true && burnerWallet.onlyLocal is false - */ - walletAutoConnect: true, } as const satisfies ScaffoldConfig; export default scaffoldConfig; From de74362b222469795581192541a81e564e6b05ca Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 3 Apr 2024 23:13:06 +0530 Subject: [PATCH 57/68] fix spelling of TransactorFuncOptions --- packages/nextjs/hooks/scaffold-eth/useTransactor.tsx | 4 ++-- packages/nextjs/utils/scaffold-eth/contract.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx index 08330a30b..14b15fa6c 100644 --- a/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx +++ b/packages/nextjs/hooks/scaffold-eth/useTransactor.tsx @@ -3,11 +3,11 @@ import { Hash, SendTransactionParameters, WalletClient } from "viem"; import { useWalletClient } from "wagmi"; import { wagmiConfig } from "~~/services/web3/wagmiConfig"; import { getBlockExplorerTxLink, getParsedError, notification } from "~~/utils/scaffold-eth"; -import { TrasactorFuncOptions } from "~~/utils/scaffold-eth/contract"; +import { TransactorFuncOptions } from "~~/utils/scaffold-eth/contract"; type TransactionFunc = ( tx: (() => Promise) | SendTransactionParameters, - options?: TrasactorFuncOptions, + options?: TransactorFuncOptions, ) => Promise; /** diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index d1b4538a8..aada042f4 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -197,7 +197,7 @@ export type scaffoldWriteContractVariables< type WriteVariables = WriteContractVariables; -export type TrasactorFuncOptions = { +export type TransactorFuncOptions = { onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; blockConfirmations?: number; }; @@ -208,7 +208,7 @@ export type scaffoldWriteContractOptions = MutateOptions< WriteVariables, unknown > & - TrasactorFuncOptions; + TransactorFuncOptions; export type UseScaffoldEventConfig< TContractName extends ContractName, From 4a01b6797fd70c8722cba38adea28734bc973ff1 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 4 Apr 2024 09:15:30 +0530 Subject: [PATCH 58/68] accept contractName in writeAsync func --- .../scaffold-eth/useScaffoldWriteContract.ts | 15 ++++++++------- packages/nextjs/utils/scaffold-eth/contract.ts | 8 +------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts index 13cd77403..23cd19012 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts @@ -5,11 +5,12 @@ import { Abi, ExtractAbiFunctionNames } from "abitype"; import { Config, UseWriteContractParameters, useAccount, useWriteContract } from "wagmi"; import { WriteContractErrorType, WriteContractReturnType } from "wagmi/actions"; import { WriteContractVariables } from "wagmi/query"; -import { useDeployedContractInfo, useTransactor } from "~~/hooks/scaffold-eth"; +import { useTransactor } from "~~/hooks/scaffold-eth"; import { notification } from "~~/utils/scaffold-eth"; import { ContractAbi, ContractName, + contracts, scaffoldWriteContractOptions, scaffoldWriteContractVariables, } from "~~/utils/scaffold-eth/contract"; @@ -20,11 +21,7 @@ import { * @param contractName - contract name * @param writeContractParams - wagmi's useWriteContract parameters */ -export const useScaffoldWriteContract = ( - contractName: TContractName, - writeContractParams?: UseWriteContractParameters, -) => { - const { data: deployedContractData } = useDeployedContractInfo(contractName); +export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractParameters) => { const { chain } = useAccount(); const writeTx = useTransactor(); const [isMining, setIsMining] = useState(false); @@ -33,11 +30,15 @@ export const useScaffoldWriteContract = ( const wagmiContractWrite = useWriteContract(writeContractParams); const sendContractWriteTx = async < + TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, "nonpayable" | "payable">, >( variables: scaffoldWriteContractVariables, options?: scaffoldWriteContractOptions, ) => { + const { contractName, ...wagmiVariables } = variables; + const deployedContractData = contracts?.[targetNetwork.id]?.[contractName]; + if (!deployedContractData) { notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?"); return; @@ -59,7 +60,7 @@ export const useScaffoldWriteContract = ( { abi: deployedContractData.abi as Abi, address: deployedContractData.address, - ...variables, + ...wagmiVariables, } as WriteContractVariables, mutateOptions as | MutateOptions< diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index aada042f4..b36a90a21 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -178,16 +178,10 @@ export type UseScaffoldReadConfig< Omit >; -/* - *{ - onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void; - blockConfirmations?: number; -} - * */ export type scaffoldWriteContractVariables< TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, WriteAbiStateMutability>, -> = IsContractDeclarationMissing< +> = { contractName: TContractName } & IsContractDeclarationMissing< Partial, { functionName: TFunctionName; From acee186f19bd261924c017b1d04a41e94893410a Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 4 Apr 2024 12:36:13 +0530 Subject: [PATCH 59/68] create a wrapper around writeSync func too from useContractWrite --- .../scaffold-eth/useScaffoldWriteContract.ts | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts index 23cd19012..4893e9f2a 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts @@ -29,7 +29,7 @@ export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractP const wagmiContractWrite = useWriteContract(writeContractParams); - const sendContractWriteTx = async < + const sendContractWriteAsyncTx = async < TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, "nonpayable" | "payable">, >( @@ -80,10 +80,53 @@ export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractP setIsMining(false); } }; + + const sendContractWriteTx = < + TContractName extends ContractName, + TFunctionName extends ExtractAbiFunctionNames, "nonpayable" | "payable">, + >( + variables: scaffoldWriteContractVariables, + options?: Omit, + ) => { + const { contractName, ...wagmiVariables } = variables; + const deployedContractData = contracts?.[targetNetwork.id]?.[contractName]; + + if (!deployedContractData) { + notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?"); + return; + } + if (!chain?.id) { + notification.error("Please connect your wallet"); + return; + } + if (chain?.id !== targetNetwork.id) { + notification.error("You are on the wrong network"); + return; + } + + wagmiContractWrite.writeContract( + { + abi: deployedContractData.abi as Abi, + address: deployedContractData.address, + ...wagmiVariables, + } as WriteContractVariables, + options as + | MutateOptions< + WriteContractReturnType, + WriteContractErrorType, + WriteContractVariables, + unknown + > + | undefined, + ); + }; + return { ...wagmiContractWrite, isMining, - // Overwrite wagmi's write async - writeContractAsync: sendContractWriteTx, + // Overwrite wagmi's writeContactAsync + writeContractAsync: sendContractWriteAsyncTx, + // Overwrite wagmi's writeContract + writeContract: sendContractWriteTx, }; }; From 3726a7989d37da31bc6c2a2bd963594edcb95ef2 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 4 Apr 2024 13:57:36 +0530 Subject: [PATCH 60/68] remove contractName from useScaffoldWriteContract comments --- packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts index 4893e9f2a..10733770b 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts @@ -18,7 +18,6 @@ import { /** * Wrapper around wagmi's useWriteContract hook which automatically loads (by name) the contract ABI and address from * the contracts present in deployedContracts.ts & externalContracts.ts corresponding to targetNetworks configured in scaffold.config.ts - * @param contractName - contract name * @param writeContractParams - wagmi's useWriteContract parameters */ export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractParameters) => { From 388bc9c15b666ce0bbf08b102e532cc63b3937c8 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 6 Apr 2024 01:02:20 +0530 Subject: [PATCH 61/68] fix bug for useSRead: pass enabled option to query obj --- .../nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts index 6b9d54f20..10548c6b7 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts @@ -30,6 +30,7 @@ export const useScaffoldReadContract = < }: UseScaffoldReadConfig) => { const { data: deployedContract } = useDeployedContractInfo(contractName); const { targetNetwork } = useTargetNetwork(); + const { query: queryOptions, ...readContractConfig } = readConfig; return useReadContract({ chainId: targetNetwork.id, @@ -38,8 +39,11 @@ export const useScaffoldReadContract = < abi: deployedContract?.abi, watch: true, args, - enabled: !Array.isArray(args) || !args.some(arg => arg === undefined), - ...(readConfig as any), + ...(readContractConfig as any), + query: { + enabled: !Array.isArray(args) || !args.some(arg => arg === undefined), + ...queryOptions, + }, }) as Omit, "data" | "refetch"> & { data: AbiFunctionReturnType | undefined; refetch: ( From 4462752e0fd4aa9ee2cc9f7b99b7da094102bb9d Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 6 Apr 2024 01:21:51 +0530 Subject: [PATCH 62/68] add watch option to useSRC --- .../scaffold-eth/useScaffoldReadContract.ts | 28 ++++++++++++++++--- .../nextjs/utils/scaffold-eth/contract.ts | 1 + 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts index 10548c6b7..6a1f15b98 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts @@ -1,8 +1,9 @@ +import { useEffect } from "react"; import { useTargetNetwork } from "./useTargetNetwork"; -import { QueryObserverResult, RefetchOptions } from "@tanstack/react-query"; +import { QueryObserverResult, RefetchOptions, useQueryClient } from "@tanstack/react-query"; import type { ExtractAbiFunctionNames } from "abitype"; import { ReadContractErrorType } from "viem"; -import { useReadContract } from "wagmi"; +import { useBlockNumber, useReadContract } from "wagmi"; import { useDeployedContractInfo } from "~~/hooks/scaffold-eth"; import { AbiFunctionReturnType, @@ -30,9 +31,11 @@ export const useScaffoldReadContract = < }: UseScaffoldReadConfig) => { const { data: deployedContract } = useDeployedContractInfo(contractName); const { targetNetwork } = useTargetNetwork(); - const { query: queryOptions, ...readContractConfig } = readConfig; + const { query: queryOptions, watch, ...readContractConfig } = readConfig; + // set watch to true by default + const defaultWatch = watch ?? true; - return useReadContract({ + const readContractHookRes = useReadContract({ chainId: targetNetwork.id, functionName, address: deployedContract?.address, @@ -50,4 +53,21 @@ export const useScaffoldReadContract = < options?: RefetchOptions | undefined, ) => Promise, ReadContractErrorType>>; }; + + const queryClient = useQueryClient(); + const { data: blockNumber } = useBlockNumber({ + watch: defaultWatch, + chainId: targetNetwork.id, + query: { + enabled: defaultWatch, + }, + }); + + useEffect(() => { + if (defaultWatch) { + queryClient.invalidateQueries({ queryKey: readContractHookRes.queryKey }); + } + }, [blockNumber, queryClient, readContractHookRes.queryKey, defaultWatch]); + + return readContractHookRes; }; diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index b36a90a21..d248a0df7 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -170,6 +170,7 @@ export type UseScaffoldReadConfig< TFunctionName extends ExtractAbiFunctionNames, ReadAbiStateMutability>, > = { contractName: TContractName; + watch?: boolean; } & IsContractDeclarationMissing< Partial, { From c42a9e3b64ae640c76655914e6ad634094d0e242 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 6 Apr 2024 01:42:29 +0530 Subject: [PATCH 63/68] fix bug: watch useEffect remove obj from dependencies --- packages/nextjs/components/scaffold-eth/Balance.tsx | 3 ++- packages/nextjs/components/scaffold-eth/FaucetButton.tsx | 3 ++- packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/nextjs/components/scaffold-eth/Balance.tsx b/packages/nextjs/components/scaffold-eth/Balance.tsx index 6506e73fd..0108e953a 100644 --- a/packages/nextjs/components/scaffold-eth/Balance.tsx +++ b/packages/nextjs/components/scaffold-eth/Balance.tsx @@ -41,7 +41,8 @@ export const Balance = ({ address, className = "", usdMode }: BalanceProps) => { useEffect(() => { queryClient.invalidateQueries({ queryKey }); - }, [blockNumber, queryClient, queryKey]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [blockNumber]); if (!address || isLoading || balance === null) { return ( diff --git a/packages/nextjs/components/scaffold-eth/FaucetButton.tsx b/packages/nextjs/components/scaffold-eth/FaucetButton.tsx index 7d293cf34..5b91bbcdd 100644 --- a/packages/nextjs/components/scaffold-eth/FaucetButton.tsx +++ b/packages/nextjs/components/scaffold-eth/FaucetButton.tsx @@ -38,7 +38,8 @@ export const FaucetButton = () => { useEffect(() => { queryClient.invalidateQueries({ queryKey }); - }, [blockNumber, queryClient, queryKey]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [blockNumber]); const sendETH = async () => { try { diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts index 6a1f15b98..9d9e8f031 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts @@ -40,7 +40,6 @@ export const useScaffoldReadContract = < functionName, address: deployedContract?.address, abi: deployedContract?.abi, - watch: true, args, ...(readContractConfig as any), query: { @@ -67,7 +66,8 @@ export const useScaffoldReadContract = < if (defaultWatch) { queryClient.invalidateQueries({ queryKey: readContractHookRes.queryKey }); } - }, [blockNumber, queryClient, readContractHookRes.queryKey, defaultWatch]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [blockNumber]); return readContractHookRes; }; From c9c8beaa8611750801fb920171faf4311149fd0e Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 6 Apr 2024 01:57:27 +0530 Subject: [PATCH 64/68] pass chainId to publicClient (allows reading even when wallet is not connected) --- packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts | 4 +++- packages/nextjs/hooks/scaffold-eth/useContractLogs.ts | 4 +++- packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts b/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts index 4867cb2b3..2b8cf8895 100644 --- a/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts +++ b/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts @@ -1,4 +1,5 @@ import { useCallback, useEffect, useRef, useState } from "react"; +import { useTargetNetwork } from "./useTargetNetwork"; import { useLocalStorage } from "usehooks-ts"; import { Chain, Hex, HttpTransport, PrivateKeyAccount, createWalletClient, http } from "viem"; import { WalletClient } from "viem"; @@ -62,7 +63,8 @@ export const useBurnerWallet = (): BurnerAccount => { initializeWithValue: false, }); - const publicClient = usePublicClient(); + const { targetNetwork } = useTargetNetwork(); + const publicClient = usePublicClient({ chainId: targetNetwork.id }); const [walletClient, setWalletClient] = useState>(); const [generatedPrivateKey, setGeneratedPrivateKey] = useState("0x"); const [account, setAccount] = useState(); diff --git a/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts b/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts index 511958e46..27775d5be 100644 --- a/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts +++ b/packages/nextjs/hooks/scaffold-eth/useContractLogs.ts @@ -1,10 +1,12 @@ import { useEffect, useState } from "react"; +import { useTargetNetwork } from "./useTargetNetwork"; import { Address, Log } from "viem"; import { usePublicClient } from "wagmi"; export const useContractLogs = (address: Address) => { const [logs, setLogs] = useState([]); - const client = usePublicClient(); + const { targetNetwork } = useTargetNetwork(); + const client = usePublicClient({ chainId: targetNetwork.id }); useEffect(() => { const fetchLogs = async () => { diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts index 75b5caebb..7dc0e3deb 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts @@ -51,8 +51,10 @@ export const useScaffoldEventHistory = < const [fromBlockUpdated, setFromBlockUpdated] = useState(fromBlock); const { data: deployedContractData, isLoading: deployedContractLoading } = useDeployedContractInfo(contractName); - const publicClient = usePublicClient(); const { targetNetwork } = useTargetNetwork(); + const publicClient = usePublicClient({ + chainId: targetNetwork.id, + }); const readEvents = async (fromBlock?: bigint) => { setIsLoading(true); From c33edd4504aa63ffbaa86c49705f5e8cbef20df3 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 6 Apr 2024 12:49:20 +0530 Subject: [PATCH 65/68] update useSCEvenSubscriber comment and take in onLogs --- .../hooks/scaffold-eth/useScaffoldEventSubscriber.ts | 7 +++---- packages/nextjs/utils/scaffold-eth/contract.ts | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts index ecb43b943..02e6d2c09 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts @@ -11,7 +11,7 @@ import { ContractAbi, ContractName, UseScaffoldEventConfig } from "~~/utils/scaf * @param config - The config settings * @param config.contractName - deployed contract name * @param config.eventName - name of the event to listen for - * @param config.listener - the callback that receives events. If only interested in 1 event, call `unwatch` inside of the listener + * @param config.onLogs - the callback that receives events. */ export const useScaffoldEventSubscriber = < TContractName extends ContractName, @@ -19,14 +19,13 @@ export const useScaffoldEventSubscriber = < >({ contractName, eventName, - listener, + onLogs, }: UseScaffoldEventConfig) => { const { data: deployedContractData } = useDeployedContractInfo(contractName); const { targetNetwork } = useTargetNetwork(); const addIndexedArgsToLogs = (logs: Log[]) => logs.map(addIndexedArgsToEvent); - const listenerWithIndexedArgs = (logs: Log[]) => - listener(addIndexedArgsToLogs(logs) as Parameters[0]); + const listenerWithIndexedArgs = (logs: Log[]) => onLogs(addIndexedArgsToLogs(logs) as Parameters[0]); return useWatchContractEvent({ address: deployedContractData?.address, diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index d248a0df7..68225198c 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -215,8 +215,8 @@ export type UseScaffoldEventConfig< > = { contractName: TContractName; } & IsContractDeclarationMissing< - Omit & { - listener: ( + Omit & { + onLogs: ( logs: Simplify< Omit, "args" | "eventName"> & { args: Record; @@ -225,8 +225,8 @@ export type UseScaffoldEventConfig< >[], ) => void; }, - Omit>, "listener" | "address" | "abi"> & { - listener: ( + Omit>, "onLogs" | "address" | "abi"> & { + onLogs: ( logs: Simplify< Omit, "args"> & { args: AbiParametersToPrimitiveTypes & From 3a8143bac2368825e37cf1006ce4717655b79bfa Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 6 Apr 2024 12:52:01 +0530 Subject: [PATCH 66/68] rename useSEventSubscriber => useSWatchContractEvent --- packages/nextjs/hooks/scaffold-eth/index.ts | 2 +- ...ffoldEventSubscriber.ts => useScaffoldWatchContractEvent.ts} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/nextjs/hooks/scaffold-eth/{useScaffoldEventSubscriber.ts => useScaffoldWatchContractEvent.ts} (97%) diff --git a/packages/nextjs/hooks/scaffold-eth/index.ts b/packages/nextjs/hooks/scaffold-eth/index.ts index be317520d..b4b5223db 100644 --- a/packages/nextjs/hooks/scaffold-eth/index.ts +++ b/packages/nextjs/hooks/scaffold-eth/index.ts @@ -7,7 +7,7 @@ export * from "./useOutsideClick"; export * from "./useScaffoldContract"; export * from "./useScaffoldReadContract"; export * from "./useScaffoldWriteContract"; -export * from "./useScaffoldEventSubscriber"; +export * from "./useScaffoldWatchContractEvent"; export * from "./useScaffoldEventHistory"; export * from "./useTransactor"; export * from "./useFetchBlocks"; diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts similarity index 97% rename from packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts rename to packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts index 02e6d2c09..844b4a08b 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventSubscriber.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts @@ -13,7 +13,7 @@ import { ContractAbi, ContractName, UseScaffoldEventConfig } from "~~/utils/scaf * @param config.eventName - name of the event to listen for * @param config.onLogs - the callback that receives events. */ -export const useScaffoldEventSubscriber = < +export const useScaffoldWatchContractEvent = < TContractName extends ContractName, TEventName extends ExtractAbiEventNames>, >({ From 44c0835f6ce5c04229ec9948847b9924964a6277 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Tue, 9 Apr 2024 11:44:16 +0530 Subject: [PATCH 67/68] update useSWC to accept contractName while initialization instead --- .../scaffold-eth/useScaffoldWriteContract.ts | 23 +++++++++---------- .../nextjs/utils/scaffold-eth/contract.ts | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts index 10733770b..f5ff161bf 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts @@ -5,12 +5,11 @@ import { Abi, ExtractAbiFunctionNames } from "abitype"; import { Config, UseWriteContractParameters, useAccount, useWriteContract } from "wagmi"; import { WriteContractErrorType, WriteContractReturnType } from "wagmi/actions"; import { WriteContractVariables } from "wagmi/query"; -import { useTransactor } from "~~/hooks/scaffold-eth"; +import { useDeployedContractInfo, useTransactor } from "~~/hooks/scaffold-eth"; import { notification } from "~~/utils/scaffold-eth"; import { ContractAbi, ContractName, - contracts, scaffoldWriteContractOptions, scaffoldWriteContractVariables, } from "~~/utils/scaffold-eth/contract"; @@ -18,9 +17,13 @@ import { /** * Wrapper around wagmi's useWriteContract hook which automatically loads (by name) the contract ABI and address from * the contracts present in deployedContracts.ts & externalContracts.ts corresponding to targetNetworks configured in scaffold.config.ts + * @param contractName - name of the contract to be written to * @param writeContractParams - wagmi's useWriteContract parameters */ -export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractParameters) => { +export const useScaffoldWriteContract = ( + contractName: TContractName, + writeContractParams?: UseWriteContractParameters, +) => { const { chain } = useAccount(); const writeTx = useTransactor(); const [isMining, setIsMining] = useState(false); @@ -28,20 +31,19 @@ export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractP const wagmiContractWrite = useWriteContract(writeContractParams); + const { data: deployedContractData } = useDeployedContractInfo(contractName); + const sendContractWriteAsyncTx = async < - TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, "nonpayable" | "payable">, >( variables: scaffoldWriteContractVariables, options?: scaffoldWriteContractOptions, ) => { - const { contractName, ...wagmiVariables } = variables; - const deployedContractData = contracts?.[targetNetwork.id]?.[contractName]; - if (!deployedContractData) { notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?"); return; } + if (!chain?.id) { notification.error("Please connect your wallet"); return; @@ -59,7 +61,7 @@ export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractP { abi: deployedContractData.abi as Abi, address: deployedContractData.address, - ...wagmiVariables, + ...variables, } as WriteContractVariables, mutateOptions as | MutateOptions< @@ -87,9 +89,6 @@ export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractP variables: scaffoldWriteContractVariables, options?: Omit, ) => { - const { contractName, ...wagmiVariables } = variables; - const deployedContractData = contracts?.[targetNetwork.id]?.[contractName]; - if (!deployedContractData) { notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?"); return; @@ -107,7 +106,7 @@ export const useScaffoldWriteContract = (writeContractParams?: UseWriteContractP { abi: deployedContractData.abi as Abi, address: deployedContractData.address, - ...wagmiVariables, + ...variables, } as WriteContractVariables, options as | MutateOptions< diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts index 68225198c..e805c79b5 100644 --- a/packages/nextjs/utils/scaffold-eth/contract.ts +++ b/packages/nextjs/utils/scaffold-eth/contract.ts @@ -182,7 +182,7 @@ export type UseScaffoldReadConfig< export type scaffoldWriteContractVariables< TContractName extends ContractName, TFunctionName extends ExtractAbiFunctionNames, WriteAbiStateMutability>, -> = { contractName: TContractName } & IsContractDeclarationMissing< +> = IsContractDeclarationMissing< Partial, { functionName: TFunctionName; From 643d061636a51144c1888746739d1e16a6e240c7 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Wed, 10 Apr 2024 22:06:14 +0530 Subject: [PATCH 68/68] negate the condition for poollingInterval in config for hardhat --- packages/nextjs/services/web3/wagmiConfig.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/services/web3/wagmiConfig.tsx b/packages/nextjs/services/web3/wagmiConfig.tsx index 4428c2fec..e20784321 100644 --- a/packages/nextjs/services/web3/wagmiConfig.tsx +++ b/packages/nextjs/services/web3/wagmiConfig.tsx @@ -20,7 +20,7 @@ export const wagmiConfig = createConfig({ return createClient({ chain, transport: http(getAlchemyHttpUrl(chain.id)), - ...(chain.id === (hardhat as Chain).id + ...(chain.id !== (hardhat as Chain).id ? { pollingInterval: scaffoldConfig.pollingInterval, }