From 86ab18d4ac79045dc2ea90ca740e47f8f70207bc Mon Sep 17 00:00:00 2001 From: brucedonovan Date: Thu, 14 Sep 2023 16:42:45 +0100 Subject: [PATCH 01/80] upgrade packages --- package.json | 4 +- yarn.lock | 367 +++++++++++++++++++++++++++------------------------ 2 files changed, 193 insertions(+), 178 deletions(-) diff --git a/package.json b/package.json index db14afac..c3c9b6f9 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@liquity/lib-base": "^3.0.0", "@liquity/lib-ethers": "^3.4.0", "@next/font": "13.1.2", - "@rainbow-me/rainbowkit": "^0.12.0", + "@rainbow-me/rainbowkit": "^1.0.11", "@types/node": "18.11.18", "@types/react": "18.0.27", "@types/react-dom": "18.0.10", @@ -60,7 +60,7 @@ "swr": "^2.0.4", "typescript": "^5.2.2", "viem": "^1.9.3", - "wagmi": "^0.12.0", + "wagmi": "^1.4.1", "zksync-web3": "^0.14.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index e349a3b9..108896a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1689,8 +1689,8 @@ __metadata: linkType: hard "@coinbase/wallet-sdk@npm:^3.6.6": - version: 3.7.1 - resolution: "@coinbase/wallet-sdk@npm:3.7.1" + version: 3.7.2 + resolution: "@coinbase/wallet-sdk@npm:3.7.2" dependencies: "@metamask/safe-event-emitter": 2.0.0 "@solana/web3.js": ^1.70.1 @@ -1709,7 +1709,7 @@ __metadata: sha.js: ^2.4.11 stream-browserify: ^3.0.0 util: ^0.12.4 - checksum: e88c656d08c06d42dcd03006c62162705a7c7dc27171ee721910f76c15c995f0482a314057a582af6e9548e6f49e4a1aff22f33685a33535c9b2550a615efbaf + checksum: d42a7b7e443942f657f636eede671979024308c6713af68f774309c04c0e1974cdbfe83514adebf4c0bcdb84adce6a026e5a92b5cff35e08eb1fb0772b1ec7e5 languageName: node linkType: hard @@ -3070,7 +3070,7 @@ __metadata: languageName: node linkType: hard -"@ledgerhq/connect-kit-loader@npm:^1.0.1": +"@ledgerhq/connect-kit-loader@npm:^1.1.0": version: 1.1.2 resolution: "@ledgerhq/connect-kit-loader@npm:1.1.2" checksum: 614fdd9ac2363da60af667adcfe4721f863d8ea06ee45a08192a162c28e806dc07491bee4833d14def74de673eac1f1450eaf67e783c8c28da4e0cd095b4474a @@ -4193,9 +4193,9 @@ __metadata: languageName: node linkType: hard -"@rainbow-me/rainbowkit@npm:^0.12.0": - version: 0.12.18 - resolution: "@rainbow-me/rainbowkit@npm:0.12.18" +"@rainbow-me/rainbowkit@npm:^1.0.11": + version: 1.0.11 + resolution: "@rainbow-me/rainbowkit@npm:1.0.11" dependencies: "@vanilla-extract/css": 1.9.1 "@vanilla-extract/dynamic": 2.0.2 @@ -4204,11 +4204,11 @@ __metadata: qrcode: 1.5.0 react-remove-scroll: 2.5.4 peerDependencies: - ethers: ">=5.6.8" react: ">=17" react-dom: ">=17" - wagmi: ">=0.12.19 <1.0.0" - checksum: 067f5c93ce48b6e5d6971b2819170ddcf90b2dabf092600a14e50557f84272efeb67a0b89fc79c1a3cad631b6ba68ae9a7f3bc0c7ec4c2c7c25e1dedb09d7913 + viem: ~0.3.19 || ^1.0.0 + wagmi: ~1.0.1 || ~1.1.0 || ~1.2.0 || ~1.3.0 || ~1.4.0 + checksum: a8d0be75d88ed97694b165ac76408ff8e2721aed6d1fbda101111e2accb674e7c63f2e2dcdae958cf3dda1f269a6d5740a7d0835fcd420dc39703e34c4375f49 languageName: node linkType: hard @@ -4219,33 +4219,33 @@ __metadata: languageName: node linkType: hard -"@safe-global/safe-apps-provider@npm:^0.15.2": - version: 0.15.2 - resolution: "@safe-global/safe-apps-provider@npm:0.15.2" +"@safe-global/safe-apps-provider@npm:^0.17.1": + version: 0.17.1 + resolution: "@safe-global/safe-apps-provider@npm:0.17.1" dependencies: - "@safe-global/safe-apps-sdk": 7.9.0 + "@safe-global/safe-apps-sdk": 8.0.0 events: ^3.3.0 - checksum: 5d647d105c935f1cb2b349b2dd3f8b590be5b16f5c1e65e4fd3fb8c72e46bfe8e2bb8e4876642511c41c0b3d75ae2f572e55a35066740c04d80c1def02e93e3b + checksum: 02f0415a4bb77b82e55f0055be045af715d9c0ea0fa7daa4e0604f40cc2189051d111b8ead67ddab0e99b1e423b444753c11d69bb213d51e459f706d2b430e34 languageName: node linkType: hard -"@safe-global/safe-apps-sdk@npm:7.9.0": - version: 7.9.0 - resolution: "@safe-global/safe-apps-sdk@npm:7.9.0" +"@safe-global/safe-apps-sdk@npm:8.0.0": + version: 8.0.0 + resolution: "@safe-global/safe-apps-sdk@npm:8.0.0" dependencies: "@safe-global/safe-gateway-typescript-sdk": ^3.5.3 - ethers: ^5.7.2 - checksum: 439cea5e486e85619c78c876bdbb81544d54c47af24e9633b7e0bd49cb0b25d260f02de573e734cd5bf767c8188bc60729880e30c86785c7e7dd22f0dbd5d0dd + viem: ^1.0.0 + checksum: 07295c44afa4d85fbc9419b4baac56b4fb493816d4438d6956842261e0689fdcea639ab86b39ee693c456fddace17b6c556c77a637892634a57de96f6b00b0c3 languageName: node linkType: hard -"@safe-global/safe-apps-sdk@npm:^7.9.0": - version: 7.11.0 - resolution: "@safe-global/safe-apps-sdk@npm:7.11.0" +"@safe-global/safe-apps-sdk@npm:^8.0.0": + version: 8.1.0 + resolution: "@safe-global/safe-apps-sdk@npm:8.1.0" dependencies: "@safe-global/safe-gateway-typescript-sdk": ^3.5.3 - ethers: ^5.7.2 - checksum: 8ada9c238fa485a12f0ecac14aa0c0497635f118c03537980e4ab32da7e8bfd7f01e25cfa1aaac28842e9e27d0d12598aaca943e342d94db305d2b6b9a65df9e + viem: ^1.0.0 + checksum: e9d31ed6d9cd2cd9ed71ef5a0e1f6ecfca9f0c62acb9b86a0ddb1b65a609090f2297c4304591ac0518b266a1bcc88d1dad31b0d05e50c7732accccb65adab754 languageName: node linkType: hard @@ -4367,8 +4367,8 @@ __metadata: linkType: hard "@solana/web3.js@npm:^1.70.1": - version: 1.78.4 - resolution: "@solana/web3.js@npm:1.78.4" + version: 1.78.5 + resolution: "@solana/web3.js@npm:1.78.5" dependencies: "@babel/runtime": ^7.22.6 "@noble/curves": ^1.0.0 @@ -4385,7 +4385,7 @@ __metadata: node-fetch: ^2.6.12 rpc-websockets: ^7.5.1 superstruct: ^0.14.2 - checksum: e1c44c6cbec87cdfd4d6d23b4241b746e14ed3a9ca73d596693758d91ac825cecf579345da3b0b7bb5e54b6794791bc0eac02cadf11f1ec79e859b6536f26f11 + checksum: 66fe4ddcc073d0c539e23a2aae3ba23c081a11f5ebc8216dd18e0c6770f20e419c635a50529faa59baeec9722cd521a3502abc7cdf3b3d5f31b32066e0415c24 languageName: node linkType: hard @@ -5913,47 +5913,47 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:4.35.0": - version: 4.35.0 - resolution: "@tanstack/query-core@npm:4.35.0" - checksum: 7a6f24164bce5d7367e2bb58f94380d9608bf4df2726e4e8b0e4f42e84d40cc7883baab2127c0c7e8eaa5c4d444a80c1e5f6e7930d21768a863c82baf22a75d4 +"@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.0": - version: 4.35.0 - resolution: "@tanstack/query-persist-client-core@npm:4.35.0" +"@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.0 - checksum: fcc1c61500f0737a5dd98ff51bc7d46cf366952e4279e5059807b266168c14c82d8161249c9c3db99392e8517138f243b33983534e220e58a589e5387fd35675 + "@tanstack/query-core": 4.35.3 + checksum: c48f33936216e0ddbeb7fb0ed4242bb24a4086f4d719547a0f12461293a039b6fc9586056f5d3d8894c2043a014a614f155af8705f539edea633f7403ff7f5b6 languageName: node linkType: hard "@tanstack/query-sync-storage-persister@npm:^4.27.1": - version: 4.35.0 - resolution: "@tanstack/query-sync-storage-persister@npm:4.35.0" + version: 4.35.3 + resolution: "@tanstack/query-sync-storage-persister@npm:4.35.3" dependencies: - "@tanstack/query-persist-client-core": 4.35.0 - checksum: bfb6e19aae9aa9310ecada297a9c8293042ab0052f8ad1d3c5cb711ca885afd4674517942aa7ef94c7564fae777bc51903b0fe2fcc1092b5685b2cc1824b2d1b + "@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.0 - resolution: "@tanstack/react-query-persist-client@npm:4.35.0" + version: 4.35.3 + resolution: "@tanstack/react-query-persist-client@npm:4.35.3" dependencies: - "@tanstack/query-persist-client-core": 4.35.0 + "@tanstack/query-persist-client-core": 4.35.3 peerDependencies: - "@tanstack/react-query": ^4.35.0 - checksum: 5dc3121e1e31aa0c21cbb33808856d75f87a08b0ba735e55bcc662a6a0590c813ed15e440ee862da22e1399bf10f20509b869fca334dc7f0a0e08bc5438e1b12 + "@tanstack/react-query": ^4.35.3 + checksum: 1f8d5630c34b177341443e34dcc2ce916e9888af9b975a8d3de899fa14a8125abde7009299f5529ab5d1d5de5341ece2b6c68acfe6546e5f83efa39988e8d36e languageName: node linkType: hard "@tanstack/react-query@npm:^4.28.0": - version: 4.35.0 - resolution: "@tanstack/react-query@npm:4.35.0" + version: 4.35.3 + resolution: "@tanstack/react-query@npm:4.35.3" dependencies: - "@tanstack/query-core": 4.35.0 + "@tanstack/query-core": 4.35.3 use-sync-external-store: ^1.2.0 peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 @@ -5964,7 +5964,7 @@ __metadata: optional: true react-native: optional: true - checksum: d3a140a010f0266eca9dae83c4995f2b541ceb8cafafd7247c5c17ec4e09416d2f2a88450f23ebab45c132125e4e4222e77a69354c0dd5d459170c7a24f1b172 + checksum: 4d7e4e6a8466095848d2924fdbcd2d22a36b53e2d0f79a7dec121c8d7af36ff857b1bae5a7b802f3a399922c9c9f38f2a06372b1fc7b1d5de960e78fa1d3d722 languageName: node linkType: hard @@ -7007,84 +7007,69 @@ __metadata: languageName: node linkType: hard -"@wagmi/chains@npm:0.2.22": - version: 0.2.22 - resolution: "@wagmi/chains@npm:0.2.22" - peerDependencies: - typescript: ">=4.9.4" - peerDependenciesMeta: - typescript: - optional: true - checksum: a8fdbce18f2ed8cce6c765828b78ef59756e3d4dc858af07f42827e78d8ab5b4ab3da2c79cd7cd3f534a6b27edd5bb5f764e6250394b4ae6aa0a055b7bdc518a - languageName: node - linkType: hard - -"@wagmi/connectors@npm:0.3.24": - version: 0.3.24 - resolution: "@wagmi/connectors@npm:0.3.24" +"@wagmi/connectors@npm:3.1.1": + version: 3.1.1 + resolution: "@wagmi/connectors@npm:3.1.1" dependencies: "@coinbase/wallet-sdk": ^3.6.6 - "@ledgerhq/connect-kit-loader": ^1.0.1 - "@safe-global/safe-apps-provider": ^0.15.2 - "@safe-global/safe-apps-sdk": ^7.9.0 - "@walletconnect/ethereum-provider": 2.9.0 + "@ledgerhq/connect-kit-loader": ^1.1.0 + "@safe-global/safe-apps-provider": ^0.17.1 + "@safe-global/safe-apps-sdk": ^8.0.0 + "@walletconnect/ethereum-provider": 2.10.0 "@walletconnect/legacy-provider": ^2.0.0 - "@walletconnect/modal": ^2.5.9 - abitype: ^0.3.0 + "@walletconnect/modal": 2.6.1 + "@walletconnect/utils": 2.10.0 + abitype: 0.8.7 eventemitter3: ^4.0.7 peerDependencies: - "@wagmi/core": ">=0.9.x" - ethers: ">=5.5.1 <6" - typescript: ">=4.9.4" + typescript: ">=5.0.4" + viem: ">=0.3.35" peerDependenciesMeta: - "@wagmi/core": - optional: true typescript: optional: true - checksum: ba55e9ed5534b5565b439d8bc98b0a483f5756abdfd19b9d5f068906f8d2132807b64cb3c8e504cfa68098a4d55b908b4a89055049846a0b4791356d1906faba + checksum: bd88703e7967d0293d08774a73b6f5e09c35a7097c1c19598eabd3010fde33d74238c77eeb739a4409e82cde565a3bb42d94ef3c441a1e822d5e164483c81275 languageName: node linkType: hard -"@wagmi/core@npm:0.10.17": - version: 0.10.17 - resolution: "@wagmi/core@npm:0.10.17" +"@wagmi/core@npm:1.4.1": + version: 1.4.1 + resolution: "@wagmi/core@npm:1.4.1" dependencies: - "@wagmi/chains": 0.2.22 - "@wagmi/connectors": 0.3.24 - abitype: ^0.3.0 + "@wagmi/connectors": 3.1.1 + abitype: 0.8.7 eventemitter3: ^4.0.7 zustand: ^4.3.1 peerDependencies: - ethers: ">=5.5.1 <6" - typescript: ">=4.9.4" + typescript: ">=5.0.4" + viem: ">=0.3.35" peerDependenciesMeta: typescript: optional: true - checksum: 50a0d5041b7b1ce123105e3833b2a3a57f2c2a71f28c73500038fa6d13d2891835e953e81f5d751c30dec345bcd680b88620dbc420b480a7fcd4099323e5211c + checksum: 9c3d5cf6022890d4eebd20e014ab7a2d3e3e7c7b22b8e0bfae2241ad6e4731a35303dfacae702872c3f5efc31cf523a029ca49bfa96db6be5350fa4ea464746f languageName: node linkType: hard -"@walletconnect/core@npm:2.9.0": - version: 2.9.0 - resolution: "@walletconnect/core@npm:2.9.0" +"@walletconnect/core@npm:2.10.0": + version: 2.10.0 + resolution: "@walletconnect/core@npm:2.10.0" dependencies: "@walletconnect/heartbeat": 1.2.1 "@walletconnect/jsonrpc-provider": 1.0.13 "@walletconnect/jsonrpc-types": 1.0.3 "@walletconnect/jsonrpc-utils": 1.0.8 - "@walletconnect/jsonrpc-ws-connection": 1.0.12 + "@walletconnect/jsonrpc-ws-connection": 1.0.13 "@walletconnect/keyvaluestorage": ^1.0.2 "@walletconnect/logger": ^2.0.1 "@walletconnect/relay-api": ^1.0.9 "@walletconnect/relay-auth": ^1.0.4 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.9.0 - "@walletconnect/utils": 2.9.0 + "@walletconnect/types": 2.10.0 + "@walletconnect/utils": 2.10.0 events: ^3.3.0 lodash.isequal: 4.5.0 uint8arrays: ^3.1.0 - checksum: c2cba1746e9679bd03e55ecfbf8c0339d3122ee31e87e8a690778263ff5c8c371ab5301445da2139711e6522d33946e9fbf640e5238241b2b2e7a394b23c2a00 + checksum: 5ad207b07ef651d143a9305e8f3a96b8c50e186b7144387c8e54d826d24cf7fdc86ab333e44b2c2d8bf1c4aa48744586cb69b783ae64c86c3dc5355750f17bf2 languageName: node linkType: hard @@ -7122,25 +7107,25 @@ __metadata: languageName: node linkType: hard -"@walletconnect/ethereum-provider@npm:2.9.0": - version: 2.9.0 - resolution: "@walletconnect/ethereum-provider@npm:2.9.0" +"@walletconnect/ethereum-provider@npm:2.10.0": + version: 2.10.0 + resolution: "@walletconnect/ethereum-provider@npm:2.10.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/sign-client": 2.9.0 - "@walletconnect/types": 2.9.0 - "@walletconnect/universal-provider": 2.9.0 - "@walletconnect/utils": 2.9.0 + "@walletconnect/sign-client": 2.10.0 + "@walletconnect/types": 2.10.0 + "@walletconnect/universal-provider": 2.10.0 + "@walletconnect/utils": 2.10.0 events: ^3.3.0 peerDependencies: "@walletconnect/modal": ">=2" peerDependenciesMeta: "@walletconnect/modal": optional: true - checksum: 9d2fe058b0bf278c4468240de64552f355683542c6e3b3881c4e82a006c53ce3981e36719f82836eeac8eb9137143368fa94e50b32c0fa270f04159eb3dc69b5 + checksum: 3cfb919636d0b12b8944516837f3fefad8d1e07195aadb20d97fcdfe89dd1def3824c4bffdc56f377e9c93b8f7b14e093e722bbeddfef743eada545cc5ef8f00 languageName: node linkType: hard @@ -7209,16 +7194,16 @@ __metadata: languageName: node linkType: hard -"@walletconnect/jsonrpc-ws-connection@npm:1.0.12": - version: 1.0.12 - resolution: "@walletconnect/jsonrpc-ws-connection@npm:1.0.12" +"@walletconnect/jsonrpc-ws-connection@npm:1.0.13": + version: 1.0.13 + resolution: "@walletconnect/jsonrpc-ws-connection@npm:1.0.13" dependencies: "@walletconnect/jsonrpc-utils": ^1.0.6 "@walletconnect/safe-json": ^1.0.2 events: ^3.3.0 tslib: 1.14.1 ws: ^7.5.1 - checksum: 937811d8d9d56064b2c1676e2d3f00cb4c0aaba2e359391ff93d83836b5e9fd2215fe6e9d435504df99924575f4c796f1e382a40c492f9b6b0da846aef674e05 + checksum: f2253b17564f7622e69b1252830f05efdf7f4d58b120adb3a3e950c2087845171c912307c39948d0b869aa8610688b83f54f54de4657091f7431aea95a59f8b9 languageName: node linkType: hard @@ -7320,34 +7305,34 @@ __metadata: languageName: node linkType: hard -"@walletconnect/modal-core@npm:2.6.2": - version: 2.6.2 - resolution: "@walletconnect/modal-core@npm:2.6.2" +"@walletconnect/modal-core@npm:2.6.1": + version: 2.6.1 + resolution: "@walletconnect/modal-core@npm:2.6.1" dependencies: - valtio: 1.11.2 - checksum: 94daceba50c323b06ecbeac2968d9f0972f327359c6118887c6526cd64006249b12f64322d71bc6c4a2b928436ecc89cf3d3af706511fcdc264c1f4b34a2dd5d + valtio: 1.11.0 + checksum: 3c1dcb865cc0737bb0e77b7103bde7167e64a8790c628427814b825dafa133c7cb3baf5184314de35a2dbd743a3b0978ef4abc86c3bb63d051f8368e3bdba67a languageName: node linkType: hard -"@walletconnect/modal-ui@npm:2.6.2": - version: 2.6.2 - resolution: "@walletconnect/modal-ui@npm:2.6.2" +"@walletconnect/modal-ui@npm:2.6.1": + version: 2.6.1 + resolution: "@walletconnect/modal-ui@npm:2.6.1" dependencies: - "@walletconnect/modal-core": 2.6.2 - lit: 2.8.0 + "@walletconnect/modal-core": 2.6.1 + lit: 2.7.6 motion: 10.16.2 qrcode: 1.5.3 - checksum: cd1ec0205eb491e529670599d3dd26f6782d7c5a99d5594bf6949a8c760c1c5f4eb6ed72b8662450774fe4e2dd47678f2c05145c8f2494bd7153446ddf4bd7ed + checksum: 34408c784659564ef57fe59227f5f0a307ec34dc9e73c6c7b72e4c03054024ffbbf1d4ed73425a2606c978aaa3518629eba61adf3fc31263d80a4c13cf1c77d2 languageName: node linkType: hard -"@walletconnect/modal@npm:^2.5.9": - version: 2.6.2 - resolution: "@walletconnect/modal@npm:2.6.2" +"@walletconnect/modal@npm:2.6.1": + version: 2.6.1 + resolution: "@walletconnect/modal@npm:2.6.1" dependencies: - "@walletconnect/modal-core": 2.6.2 - "@walletconnect/modal-ui": 2.6.2 - checksum: 68b354d49960b96d22de0e47a3801df27c01a3e96ec5fbde3ca6df1344ca2b20668b0c4d58fe1803f5670ac7b7b4c6f5b7b405e354f5f9eaff5cca147c13de9c + "@walletconnect/modal-core": 2.6.1 + "@walletconnect/modal-ui": 2.6.1 + checksum: f48107abe4594b3a6849a4eae1a3fb9fb37ded25ef390c084e9098ceed58ace1bcb723abfa15027b462d75226a907bbbfc1d48e1414f882b5d7f83903da617bb languageName: node linkType: hard @@ -7396,20 +7381,20 @@ __metadata: languageName: node linkType: hard -"@walletconnect/sign-client@npm:2.9.0": - version: 2.9.0 - resolution: "@walletconnect/sign-client@npm:2.9.0" +"@walletconnect/sign-client@npm:2.10.0": + version: 2.10.0 + resolution: "@walletconnect/sign-client@npm:2.10.0" dependencies: - "@walletconnect/core": 2.9.0 + "@walletconnect/core": 2.10.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.9.0 - "@walletconnect/utils": 2.9.0 + "@walletconnect/types": 2.10.0 + "@walletconnect/utils": 2.10.0 events: ^3.3.0 - checksum: fe35b9b15c62efc9702fd34e883f95dcdbda954ff27b628d2d3d3eb7cb904b0fd6ec9c33b64c314305ba7a4b669d37769e7b9e9a723a0a2cb6b57d6a45aa6171 + checksum: 2d9f30ad8b656b7942add2cba9f7a6b04928ecb058440b9dc1701e74c605e961b518cfef6bee249e7477d1033c05a3e16977b10ed658030bf3be0d135b09afd8 languageName: node linkType: hard @@ -7422,9 +7407,9 @@ __metadata: languageName: node linkType: hard -"@walletconnect/types@npm:2.9.0": - version: 2.9.0 - resolution: "@walletconnect/types@npm:2.9.0" +"@walletconnect/types@npm:2.10.0": + version: 2.10.0 + resolution: "@walletconnect/types@npm:2.10.0" dependencies: "@walletconnect/events": ^1.0.1 "@walletconnect/heartbeat": 1.2.1 @@ -7432,30 +7417,30 @@ __metadata: "@walletconnect/keyvaluestorage": ^1.0.2 "@walletconnect/logger": ^2.0.1 events: ^3.3.0 - checksum: 147bec3c89cd7194e6df7e3a59560c46bf5b0b8ef58e81f387b3bfeecaa3aecb04b4ac2dbffe11fe671ffdf2f1222178b2fac256ced39e9b3b56c21411362872 + checksum: b32006f192578e28cb5c1dbd757a47ff077e25ac3ea9c9d8fd95b174e47f7f8a76386db5aef52623cf6d349c9816d5cff752095af8d35d79a44a2a26a019839d languageName: node linkType: hard -"@walletconnect/universal-provider@npm:2.9.0": - version: 2.9.0 - resolution: "@walletconnect/universal-provider@npm:2.9.0" +"@walletconnect/universal-provider@npm:2.10.0": + version: 2.10.0 + resolution: "@walletconnect/universal-provider@npm:2.10.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.9.0 - "@walletconnect/types": 2.9.0 - "@walletconnect/utils": 2.9.0 + "@walletconnect/sign-client": 2.10.0 + "@walletconnect/types": 2.10.0 + "@walletconnect/utils": 2.10.0 events: ^3.3.0 - checksum: 924a4de3d17ff04d33c0acbab4ca9ef5893c286d866a91e4c4734ef260473f1163b2ad6555911b891a4793545b7f042f221dce6278e3c95e4f0e224ab17d9857 + checksum: acb7a4e14e0c472577ae054a67e22cdb5ddc1cb6b6a404d2ca5ea733c459818ad1f013bfe04efa8cce45d693d29a4dc82b07dcb212d99371bc9012b28d087385 languageName: node linkType: hard -"@walletconnect/utils@npm:2.9.0": - version: 2.9.0 - resolution: "@walletconnect/utils@npm:2.9.0" +"@walletconnect/utils@npm:2.10.0": + version: 2.10.0 + resolution: "@walletconnect/utils@npm:2.10.0" dependencies: "@stablelib/chacha20poly1305": 1.0.1 "@stablelib/hkdf": 1.0.1 @@ -7465,13 +7450,13 @@ __metadata: "@walletconnect/relay-api": ^1.0.9 "@walletconnect/safe-json": ^1.0.2 "@walletconnect/time": ^1.0.2 - "@walletconnect/types": 2.9.0 + "@walletconnect/types": 2.10.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: 83592e6b793d16ddcaa7d904cc1a420b1a7240c9a5263a8ff7d7304f7f1194a2f98e1a69f68b10628e1178541c135d722d3844509678a88f6660c03a076eb755 + checksum: a1a99e062ce758d28cbbe286efd1fe47f98b5c936a429d2c42700135eb8672b747fdde08384ad5dbf3ec394a7fd7837bbe6d3be0f80445b949f336923517cfc2 languageName: node linkType: hard @@ -7709,31 +7694,31 @@ __metadata: languageName: node linkType: hard -"abitype@npm:0.9.8": - version: 0.9.8 - resolution: "abitype@npm:0.9.8" +"abitype@npm:0.8.7": + version: 0.8.7 + resolution: "abitype@npm:0.8.7" peerDependencies: typescript: ">=5.0.4" zod: ^3 >=3.19.1 peerDependenciesMeta: - typescript: - optional: true zod: optional: true - checksum: d7d887f29d6821e3f7a400de9620511b80ead3f85c5c87308aaec97965d3493e6687ed816e88722b4f512249bd66dee9e69231b49af0e1db8f69400a62c87cf6 + checksum: 4351466808969bcc73e5c535c3d96bb687ee2be0bccd48eba024c47e6cc248f0c8bd368f9e42dab35d39923e63b1349ade470f72812de27127968caf1a1426c9 languageName: node linkType: hard -"abitype@npm:^0.3.0": - version: 0.3.0 - resolution: "abitype@npm:0.3.0" +"abitype@npm:0.9.8": + version: 0.9.8 + resolution: "abitype@npm:0.9.8" peerDependencies: - typescript: ">=4.9.4" - zod: ">=3.19.1" + typescript: ">=5.0.4" + zod: ^3 >=3.19.1 peerDependenciesMeta: + typescript: + optional: true zod: optional: true - checksum: d7f604d917d0ffddc0a7865c24db78585d257202500a70b99c63da659fe299148778fcb78b31e9dbc2d213d69475880702cb05be22eaa0a49e22c73672dd97e1 + checksum: d7d887f29d6821e3f7a400de9620511b80ead3f85c5c87308aaec97965d3493e6687ed816e88722b4f512249bd66dee9e69231b49af0e1db8f69400a62c87cf6 languageName: node linkType: hard @@ -9429,7 +9414,7 @@ __metadata: "@liquity/lib-base": ^3.0.0 "@liquity/lib-ethers": ^3.4.0 "@next/font": 13.1.2 - "@rainbow-me/rainbowkit": ^0.12.0 + "@rainbow-me/rainbowkit": ^1.0.11 "@storybook/addon-essentials": ^7.0.12 "@storybook/addon-interactions": ^7.0.12 "@storybook/addon-links": ^7.0.12 @@ -9483,7 +9468,7 @@ __metadata: tailwindcss: ^3.2.4 typescript: ^5.2.2 viem: ^1.9.3 - wagmi: ^0.12.0 + wagmi: ^1.4.1 zksync-web3: ^0.14.3 languageName: unknown linkType: soft @@ -15661,7 +15646,7 @@ __metadata: languageName: node linkType: hard -"lit-html@npm:^2.8.0": +"lit-html@npm:^2.7.0, lit-html@npm:^2.8.0": version: 2.8.0 resolution: "lit-html@npm:2.8.0" dependencies: @@ -15670,7 +15655,18 @@ __metadata: languageName: node linkType: hard -"lit@npm:2.8.0, lit@npm:^2.1.3": +"lit@npm:2.7.6": + version: 2.7.6 + resolution: "lit@npm:2.7.6" + dependencies: + "@lit/reactive-element": ^1.6.0 + lit-element: ^3.3.0 + lit-html: ^2.7.0 + checksum: 984a7fb9c0fa387f20177a07de22ea1c9cdc01a7dc7cb1c400d1df5b43a8956908460482a3259ea173555c6f0f13457d2ddc5c84d4c365007afd86e7ca58b384 + languageName: node + linkType: hard + +"lit@npm:^2.1.3": version: 2.8.0 resolution: "lit@npm:2.8.0" dependencies: @@ -22383,21 +22379,18 @@ __metadata: languageName: node linkType: hard -"valtio@npm:1.11.2": - version: 1.11.2 - resolution: "valtio@npm:1.11.2" +"valtio@npm:1.11.0": + version: 1.11.0 + resolution: "valtio@npm:1.11.0" dependencies: proxy-compare: 2.5.1 use-sync-external-store: 1.2.0 peerDependencies: - "@types/react": ">=16.8" react: ">=16.8" peerDependenciesMeta: - "@types/react": - optional: true react: optional: true - checksum: cce2d9212aac9fc4bdeba2d381188cc831cfe8d2d03039024cfcd58ba1801f2a5b14d01c2bb21a2c9f12046d2ede64f1dd887175185f39bee553677a35592c30 + checksum: 77e42f5841054ba3e41b456fbb96b679eaeb6d9dbb46b7ce9aee6acf1352de73969858dea837a706c969ca908155d6cb97966e33be10b69b097744dd99b5174a languageName: node linkType: hard @@ -22448,6 +22441,28 @@ __metadata: languageName: node linkType: hard +"viem@npm:^1.0.0": + version: 1.10.13 + resolution: "viem@npm:1.10.13" + 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: cf5fddc3adafdf3f425011a0b5a94948fde892dee6b9223d9dee96f69671753908bab298da3599902f64a88762f5607453ad28d5302730ee351398c577f135a0 + languageName: node + linkType: hard + "viem@npm:^1.9.3": version: 1.10.9 resolution: "viem@npm:1.10.9" @@ -22477,24 +22492,24 @@ __metadata: languageName: node linkType: hard -"wagmi@npm:^0.12.0": - version: 0.12.19 - resolution: "wagmi@npm:0.12.19" +"wagmi@npm:^1.4.1": + version: 1.4.1 + resolution: "wagmi@npm:1.4.1" 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": 0.10.17 - abitype: ^0.3.0 + "@wagmi/core": 1.4.1 + abitype: 0.8.7 use-sync-external-store: ^1.2.0 peerDependencies: - ethers: ">=5.5.1 <6" react: ">=17.0.0" - typescript: ">=4.9.4" + typescript: ">=5.0.4" + viem: ">=0.3.35" peerDependenciesMeta: typescript: optional: true - checksum: b7d7c3b407160eb90e1fd5fc42bfeff067fde7ac5bb9d2516af2243ac53c2defc3af115499c9f0bbfe64967a11fecc545f8e1d792eac3fbabd8872d5bea01b3a + checksum: 3f8cba8776657f44e1c4c0a1985522c4f25e1f83ad837d448d4a768830df2585a44904cd859a5e1a9331a5f8dfa6980b27638431cf93b15cac8cca221827d1a2 languageName: node linkType: hard From 27bf57d7806ea37a71546fed1847e00536647e11 Mon Sep 17 00:00:00 2001 From: brucedonovan Date: Thu, 14 Sep 2023 16:58:09 +0100 Subject: [PATCH 02/80] first pass --- package.json | 1 - .../current/widgets/uniswap/useUniswapQuote.tsx | 1 + src/components/devTools/MintButton.tsx | 4 ++-- src/contexts/ConnectionWrapper.tsx | 15 ++++++--------- src/hooks/useForkTools.ts | 10 +++++----- yarn.lock | 1 - 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index c3c9b6f9..186be720 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "date-fns": "^2.30.0", "eslint": "8.32.0", "eslint-config-next": "13.1.2", - "ethers": "^5.7.2", "graphql-request": "^6.1.0", "json-bigint": "^1.0.0", "next": "13.1.2", diff --git a/src/components/current/widgets/uniswap/useUniswapQuote.tsx b/src/components/current/widgets/uniswap/useUniswapQuote.tsx index be5c2197..ee2f3524 100644 --- a/src/components/current/widgets/uniswap/useUniswapQuote.tsx +++ b/src/components/current/widgets/uniswap/useUniswapQuote.tsx @@ -22,6 +22,7 @@ interface UseUniswapQuoteRes { const useUniswapQuote = ({ baseTokenSymbol, quoteTokenSymbol, amount }: UseUniswapQuoteProps) => { const chainId = useChainId(); const provider = useProvider(); + const { isETH: baseTokenIsEth } = useToken(baseTokenSymbol); const { isETH: quoteTokenIsEth } = useToken(quoteTokenSymbol); const { data: baseTokenToUse } = useToken(baseTokenIsEth ? 'WETH' : baseTokenSymbol); diff --git a/src/components/devTools/MintButton.tsx b/src/components/devTools/MintButton.tsx index 75c72dfc..02d79353 100644 --- a/src/components/devTools/MintButton.tsx +++ b/src/components/devTools/MintButton.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import { JsonRpcProvider } from '@ethersproject/providers'; import { ethers } from 'ethers'; -import { useAccount, useNetwork, useProvider } from 'wagmi'; +import { useAccount, useNetwork, usePublicClient } from 'wagmi'; import useBalance from '../cactiComponents/hooks/useBalance'; import { Button } from '../shared/Button'; @@ -11,7 +11,7 @@ export const MintButton = () => { const [isVisible, setVisible] = useState(false); const { chain } = useNetwork(); const { refetch } = useBalance(); - const provider = useProvider(); + const provider = usePublicClient(); useEffect(() => { if (!address || chain?.id != 1) setVisible(false); diff --git a/src/contexts/ConnectionWrapper.tsx b/src/contexts/ConnectionWrapper.tsx index 3dbec41e..9d4cad49 100644 --- a/src/contexts/ConnectionWrapper.tsx +++ b/src/contexts/ConnectionWrapper.tsx @@ -10,9 +10,8 @@ import { lightTheme, } from '@rainbow-me/rainbowkit'; import axios from 'axios'; -import { Chain, WagmiConfig, configureChains, createClient, useEnsAvatar } from 'wagmi'; +import { Chain, WagmiConfig, configureChains, createConfig, useEnsAvatar } from 'wagmi'; import { goerli, zkSyncTestnet } from 'wagmi/chains'; -import { jsonRpcProvider } from 'wagmi/providers/jsonRpc'; import { publicProvider } from 'wagmi/providers/public'; import useCachedState from '@/hooks/useCachedState'; import { getBackendApiUrl } from '@/utils/backend'; @@ -20,14 +19,12 @@ import { GetSiweMessageOptions, RainbowKitSiweNextAuthProvider } from '@/utils/r import SettingsContext from './SettingsContext'; const ConnectionWrapper = ({ children, useSiwe = true }: any) => { - const queryClient = useQueryClient(); /* Use a fork url cached in the browser localStorage, else use the .env value */ const [forkUrl] = useCachedState( 'forkUrl', `https://rpc.tenderly.co/fork/${process.env.NEXT_PUBLIC_TENDERLY_FORK_ID}` ); - console.log('🦄 ~ file: ConnectionWrapper.tsx:29 ~ ConnectionWrapper ~ forkUrl:', forkUrl); const { settings: { experimentalUi }, @@ -48,7 +45,7 @@ const ConnectionWrapper = ({ children, useSiwe = true }: any) => { }, } as Chain; - const { chains, provider } = configureChains( + const { chains, publicClient, webSocketPublicClient } = configureChains( [mainnetFork, goerli, zkSyncTestnet], [publicProvider()] ); @@ -59,10 +56,10 @@ const ConnectionWrapper = ({ children, useSiwe = true }: any) => { chains, }); - const wagmiClient = createClient({ + const wagmiConfig = createConfig({ autoConnect: true, connectors, - provider, + publicClient, }); const getSiweMessageOptions: GetSiweMessageOptions = () => ({ @@ -102,7 +99,7 @@ const ConnectionWrapper = ({ children, useSiwe = true }: any) => { address: string | `0x${string}` | undefined; size: number; }) => { - const { data: ensImage } = useEnsAvatar({ address: address as `0x${string}` }); + const { data: ensImage } = useEnsAvatar(); return ensImage ? ( avatar ) : ( @@ -111,7 +108,7 @@ const ConnectionWrapper = ({ children, useSiwe = true }: any) => { }; return ( - + {useSiwe && ( Promise; fillEther: () => Promise; @@ -28,7 +28,7 @@ const useForkTools = (id?: string): ForkTools => { /* parameters from wagmi */ const { address: account } = useAccount(); const { refetch } = useBalance(); - const provider = useProvider(); + const provider = usePublicClient(); const forkProvider = useMemo( () => (forkUrl ? new ethers.providers.JsonRpcProvider(forkUrl) : undefined), [forkUrl] @@ -53,8 +53,8 @@ const useForkTools = (id?: string): ForkTools => { const getForkTimestamp = useCallback(async () => { if (!isForkedEnv || !provider) return; try { - const { timestamp } = await provider.getBlock('latest'); - console.log('Updated Forked Blockchain time: ', new Date(timestamp * 1000)); + const { timestamp } = await provider.getBlock(); + console.log('Updated Forked Blockchain time: ', timestamp); return timestamp; } catch (e) { console.log('Error getting latest timestamp', e); diff --git a/yarn.lock b/yarn.lock index 108896a8..0d33a4a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9440,7 +9440,6 @@ __metadata: eslint: 8.32.0 eslint-config-next: 13.1.2 eslint-plugin-storybook: ^0.6.12 - ethers: ^5.7.2 graphql-request: ^6.1.0 json-bigint: ^1.0.0 next: 13.1.2 From ff3770a3bc86ba41aecf702cc91b0d0e50674124 Mon Sep 17 00:00:00 2001 From: brucedonovan Date: Thu, 14 Sep 2023 17:23:56 +0100 Subject: [PATCH 03/80] updates --- src/components/cactiComponents/ActionResponse.tsx | 11 +++++------ .../cactiComponents/hooks/useAllowance.tsx | 2 +- src/components/cactiComponents/hooks/useApproval.tsx | 9 ++++----- src/components/cactiComponents/hooks/useBalance.ts | 12 ++++++------ .../cactiComponents/hooks/useEnsAvatar.tsx | 2 +- src/components/cactiComponents/hooks/useSubmitTx.tsx | 9 +++++---- .../current/containers/MultiStepContainer.tsx | 2 +- .../current/widgets/4626vault/DepositIntoVault.tsx | 5 ++--- .../current/widgets/4626vault/WithdrawFromVault.tsx | 5 ++--- src/components/current/widgets/dsr/DepositDSR.tsx | 5 ++--- src/components/current/widgets/dsr/RedeemDSR.tsx | 5 ++--- src/components/current/widgets/hop/HopBridge.tsx | 5 +++-- src/components/current/widgets/nft/BuyNft.tsx | 9 +++++---- src/components/current/widgets/transfer/Transfer.tsx | 4 ++-- .../current/widgets/tx-replay/TransactionReplay.tsx | 5 ++--- src/hooks/useInput.ts | 7 +++---- 16 files changed, 46 insertions(+), 51 deletions(-) diff --git a/src/components/cactiComponents/ActionResponse.tsx b/src/components/cactiComponents/ActionResponse.tsx index 07413973..909ded20 100644 --- a/src/components/cactiComponents/ActionResponse.tsx +++ b/src/components/cactiComponents/ActionResponse.tsx @@ -1,10 +1,8 @@ import { useEffect, useMemo, useState } from 'react'; import Skeleton from 'react-loading-skeleton'; -import { TransactionReceipt } from '@ethersproject/abstract-provider'; import { AddressZero } from '@ethersproject/constants'; import { CheckCircleIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline'; import { ConnectButton } from '@rainbow-me/rainbowkit'; -import { BigNumber, UnsignedTransaction } from 'ethers'; import { formatUnits } from 'ethers/lib/utils.js'; import tw from 'tailwind-styled-components'; import { useAccount } from 'wagmi'; @@ -14,6 +12,7 @@ import { ActionStepper } from './ActionStepper'; import useApproval, { ApprovalBasicParams } from './hooks/useApproval'; import useBalance from './hooks/useBalance'; import useSubmitTx, { TxBasicParams } from './hooks/useSubmitTx'; +import { TransactionReceipt } from 'viem'; export enum ActionResponseState { LOADING = 'LOADING', // background async checks @@ -52,7 +51,7 @@ type Action = { export type ActionResponseProps = { txParams: TxBasicParams | undefined; approvalParams: ApprovalBasicParams | undefined; - sendParams?: UnsignedTransaction | undefined; + sendParams?: any | undefined; // unsigned transaction type without ethers? label?: string; // label to show on button description?: string; // tx description (for wallet ) disabled?: boolean; @@ -84,13 +83,13 @@ export const ActionResponse = ({ approvalParams || { tokenAddress: AddressZero, spender: AddressZero, - approvalAmount: BigNumber.from(0), + approvalAmount: BigInt(0), skipApproval: true, // NOTE: approval is skipped if no approval params are passed in }, [approvalParams] ); const { data: token } = useToken(undefined, _approvalParams.tokenAddress); - const amountFmt = formatUnits(_approvalParams.approvalAmount, token?.decimals); + const amountFmt = formatUnits(_approvalParams.approvalAmount.toString(), token?.decimals); /** Check for the approval. If no approvalParams, hasAllowance === true and approveTx == undefined */ const { @@ -144,7 +143,7 @@ export const ActionResponse = ({ // check approval token balance if (balance && _approvalParams?.approvalAmount) - setHasEnoughBalance(balance.gte(_approvalParams.approvalAmount)); + setHasEnoughBalance(balance >= _approvalParams?.approvalAmount); }, [_approvalParams, balance, ethBal, sendParams?.value, skipBalanceCheck]); /** diff --git a/src/components/cactiComponents/hooks/useAllowance.tsx b/src/components/cactiComponents/hooks/useAllowance.tsx index 5609050a..73cbc79a 100644 --- a/src/components/cactiComponents/hooks/useAllowance.tsx +++ b/src/components/cactiComponents/hooks/useAllowance.tsx @@ -1,5 +1,5 @@ import { useQuery } from 'react-query'; -import { Address, erc20ABI, useAccount, useContract } from 'wagmi'; +import { Address, erc20ABI, useAccount } from 'wagmi'; import { readContract } from 'wagmi/actions'; import useChainId from '@/hooks/useChainId'; diff --git a/src/components/cactiComponents/hooks/useApproval.tsx b/src/components/cactiComponents/hooks/useApproval.tsx index 127bb46a..fe6e0ebd 100644 --- a/src/components/cactiComponents/hooks/useApproval.tsx +++ b/src/components/cactiComponents/hooks/useApproval.tsx @@ -1,7 +1,6 @@ import { useMemo } from 'react'; import { useQuery } from 'react-query'; import { AddressZero } from '@ethersproject/constants'; -import { BigNumber } from 'ethers'; import { erc20ABI, useContractWrite, useWaitForTransaction } from 'wagmi'; import { prepareWriteContract } from 'wagmi/actions'; import useChainId from '@/hooks/useChainId'; @@ -10,7 +9,7 @@ import { cleanValue } from '@/utils'; import useAllowance from './useAllowance'; export type ApprovalBasicParams = { - approvalAmount: BigNumber; + approvalAmount: bigint; tokenAddress: `0x${string}`; spender: `0x${string}`; skipApproval?: boolean; @@ -28,7 +27,7 @@ const useApproval = (params: ApprovalBasicParams) => { // cleanup the bignumber and convert back to a bignumber to avoid underlow errors; const amountToUse = useMemo( - () => BigNumber.from(cleanValue(approvalAmount.toString(), token?.decimals)), + () => BigInt(cleanValue(approvalAmount.toString(), token?.decimals)!), [approvalAmount, token?.decimals] ); @@ -64,7 +63,7 @@ const useApproval = (params: ApprovalBasicParams) => { refetchOnWindowFocus: false, }); - const { write: approveTx, data, isLoading: isWaitingOnUser } = useContractWrite(config); + const { write: approveTx, data, isLoading: isWaitingOnUser } = useContractWrite(config!); const { isError, @@ -78,7 +77,7 @@ const useApproval = (params: ApprovalBasicParams) => { const hasAllowance = useMemo(() => { if (!!params.skipApproval) return true; if (!allowanceAmount) return false; - return allowanceAmount.gte(amountToUse); + return allowanceAmount >= amountToUse; }, [allowanceAmount, amountToUse, params.skipApproval]); return { diff --git a/src/components/cactiComponents/hooks/useBalance.ts b/src/components/cactiComponents/hooks/useBalance.ts index d9390bee..82808a1c 100644 --- a/src/components/cactiComponents/hooks/useBalance.ts +++ b/src/components/cactiComponents/hooks/useBalance.ts @@ -12,7 +12,7 @@ import useChainId from '@/hooks/useChainId'; */ const useBalance = ( tokenAddress?: `0x${string}`, - compareAmount?: BigNumber, + compareAmount?: bigint, erc1155TokenId?: string ) => { const chainId = useChainId(); @@ -42,7 +42,7 @@ const useBalance = ( chainId, abi: erc1155ABI, functionName: 'balanceOf', - args: [account, BigNumber.from(erc1155TokenId)], + args: [account, BigInt(erc1155TokenId) ], }); return erc1155Bal; } @@ -64,10 +64,10 @@ const useBalance = ( useEffect(() => { if (compareAmount && data) { setComparisons({ - isZero: data.isZero(), - isGTEcompared: data.gte(compareAmount), - isEQcompared: data.eq(compareAmount), - isLTcompared: data.lt(compareAmount), + isZero: data === BigInt(0), + isGTEcompared: data >= compareAmount, + isEQcompared: data === compareAmount, + isLTcompared: data < compareAmount, }); } }, [compareAmount, data, erc1155TokenId]); diff --git a/src/components/cactiComponents/hooks/useEnsAvatar.tsx b/src/components/cactiComponents/hooks/useEnsAvatar.tsx index 1f4e13a2..c51d0de0 100644 --- a/src/components/cactiComponents/hooks/useEnsAvatar.tsx +++ b/src/components/cactiComponents/hooks/useEnsAvatar.tsx @@ -12,7 +12,7 @@ const useEnsAvatar = () => { queryFn: async () => address && (await fetchEnsAvatar({ - address, + name: address, // TODO check this! ? chainId, })), refetchOnWindowFocus: false, diff --git a/src/components/cactiComponents/hooks/useSubmitTx.tsx b/src/components/cactiComponents/hooks/useSubmitTx.tsx index 2f44f537..3fa132f8 100644 --- a/src/components/cactiComponents/hooks/useSubmitTx.tsx +++ b/src/components/cactiComponents/hooks/useSubmitTx.tsx @@ -1,6 +1,5 @@ -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import { toast } from 'react-toastify'; -import { TransactionReceipt } from '@ethersproject/abstract-provider'; import { useAddRecentTransaction } from '@rainbow-me/rainbowkit'; import { CallOverrides, Overrides, PayableOverrides, UnsignedTransaction } from 'ethers'; import { @@ -10,6 +9,7 @@ import { useWaitForTransaction, } from 'wagmi'; import useBalance from './useBalance'; +import { Transaction, TransactionReceipt } from 'viem/dist/types/types/transaction'; export type TxBasicParams = { address?: `0x${string}`; @@ -37,7 +37,7 @@ export const SEND_ETH_FNNAME = '8bb05f0e-05ed-11ee-be56-0242ac120002'; */ const useSubmitTx = ( params?: TxBasicParams, - sendParams?: UnsignedTransaction, + sendParams?: Transaction, onSuccess?: (receipt?: TransactionReceipt) => void, onError?: (receipt?: TransactionReceipt) => void, description?: string @@ -57,7 +57,8 @@ const useSubmitTx = ( /* prepare a send transaction if the fnName matches the SEND_TRANSACTION unique id */ const { config: sendConfig, isError: isPrepareError } = usePrepareSendTransaction({ - request: { ...(writeConfig.request ?? sendParams), gasLimit: sendParams?.gasLimit || 500000 }, + ...(writeConfig.request ?? sendParams), + // gasLimit: sendParams?.gasLimit || 500000 TODO add in gas limti? enabled: true, onError: (e) => console.log('prepare send error', e), }); diff --git a/src/components/current/containers/MultiStepContainer.tsx b/src/components/current/containers/MultiStepContainer.tsx index 32a0f53c..5254d33b 100644 --- a/src/components/current/containers/MultiStepContainer.tsx +++ b/src/components/current/containers/MultiStepContainer.tsx @@ -1,10 +1,10 @@ import { useEffect } from 'react'; -import { TransactionReceipt } from '@ethersproject/abstract-provider'; import { UnsignedTransaction } from 'ethers'; import { useChatContext } from '@/contexts/ChatContext'; import { ActionResponse, HeaderResponse } from '../../cactiComponents'; import { WidgetError } from '../widgets/helpers'; import { ConnectFirst } from '../widgets/helpers/ConnectFirst'; +import { TransactionReceipt } from 'viem'; interface MultiStepContainerProps { status: 'success' | 'error'; diff --git a/src/components/current/widgets/4626vault/DepositIntoVault.tsx b/src/components/current/widgets/4626vault/DepositIntoVault.tsx index a0092d05..98b63658 100644 --- a/src/components/current/widgets/4626vault/DepositIntoVault.tsx +++ b/src/components/current/widgets/4626vault/DepositIntoVault.tsx @@ -1,6 +1,4 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; import { Address, useAccount } from 'wagmi'; import ERC4626Abi from '@/abi/erc4626ABI.json'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; @@ -10,6 +8,7 @@ import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; import { ConnectFirst } from '../helpers/ConnectFirst'; +import { parseUnits } from 'viem'; interface DepositVaultProps { amount: string; @@ -52,7 +51,7 @@ export const DepositVault = ({ depositToken, amount, vault }: DepositVaultProps) //TODO: Get the vault address const inputCleaned = cleanValue(amount.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); const params: DepositVaultParams = { assets: amountIn.toString(), diff --git a/src/components/current/widgets/4626vault/WithdrawFromVault.tsx b/src/components/current/widgets/4626vault/WithdrawFromVault.tsx index 6cdd29de..b60c57a5 100644 --- a/src/components/current/widgets/4626vault/WithdrawFromVault.tsx +++ b/src/components/current/widgets/4626vault/WithdrawFromVault.tsx @@ -1,6 +1,4 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; import { Address, useAccount } from 'wagmi'; import ERC4626Abi from '@/abi/erc4626ABI.json'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; @@ -10,6 +8,7 @@ import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; import { ConnectFirst } from '../helpers/ConnectFirst'; +import { parseUnits } from 'viem'; interface WithdrawVaultProps { amount: string; @@ -52,7 +51,7 @@ export const WithdrawVault = ({ withdrawToken, amount, vault }: WithdrawVaultPro //TODO: Get the vault address const inputCleaned = cleanValue(amount.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); const params: WithdrawVaultParams = { assets: amountIn.toString(), diff --git a/src/components/current/widgets/dsr/DepositDSR.tsx b/src/components/current/widgets/dsr/DepositDSR.tsx index bd40c105..4edf8e39 100644 --- a/src/components/current/widgets/dsr/DepositDSR.tsx +++ b/src/components/current/widgets/dsr/DepositDSR.tsx @@ -1,6 +1,4 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; import { useAccount } from 'wagmi'; import ERC4626Abi from '@/abi/erc4626ABI.json'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; @@ -10,6 +8,7 @@ import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; import { ConnectFirst } from '../helpers/ConnectFirst'; +import { parseUnits } from 'viem'; interface DepositDSRProps { depositAmount: string; @@ -32,7 +31,7 @@ export const DepositDSR = ({ depositAmount }: DepositDSRProps) => { const { data: tokenOut } = useToken(tokenOutSymbol); const inputCleaned = cleanValue(depositAmount.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); const params: DepositDSRParams = { assets: amountIn.toString(), diff --git a/src/components/current/widgets/dsr/RedeemDSR.tsx b/src/components/current/widgets/dsr/RedeemDSR.tsx index 44b8dd49..7a35850c 100644 --- a/src/components/current/widgets/dsr/RedeemDSR.tsx +++ b/src/components/current/widgets/dsr/RedeemDSR.tsx @@ -1,6 +1,4 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; import { useAccount } from 'wagmi'; import ERC4626Abi from '@/abi/erc4626ABI.json'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; @@ -10,6 +8,7 @@ import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; import { ConnectFirst } from '../helpers/ConnectFirst'; +import { parseUnits } from 'viem'; interface RedeemDSRProps { shares: string; @@ -35,7 +34,7 @@ export const RedeemDSR = ({ shares }: RedeemDSRProps) => { const { data: tokenOut } = useToken(tokenOutSymbol); const inputCleaned = cleanValue(shares.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); const params: RedeemDSRParams = { assets: amountIn.toString(), diff --git a/src/components/current/widgets/hop/HopBridge.tsx b/src/components/current/widgets/hop/HopBridge.tsx index d55871fd..8e1630db 100644 --- a/src/components/current/widgets/hop/HopBridge.tsx +++ b/src/components/current/widgets/hop/HopBridge.tsx @@ -1,12 +1,13 @@ import React, { useEffect, useState } from 'react'; import { Hop } from '@hop-protocol/sdk'; -import { Interface, UnsignedTransaction } from 'ethers/lib/utils'; import { erc20ABI } from 'wagmi'; import { ActionResponse, HeaderResponse, SingleLineResponse } from '@/components/cactiComponents'; import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval'; import useInput from '@/hooks/useInput'; import useSigner from '@/hooks/useSigner'; import useToken from '@/hooks/useToken'; +import { Transaction } from 'viem'; +import { Interface } from 'ethers/lib/utils'; interface HopBridgeProps { inputString: string; @@ -22,7 +23,7 @@ const HopBridge = ({ inputString, tokenSymbol, toChain, fromChain }: HopBridgePr const { data: tokenIn } = useToken(tokenSymbol); const input = useInput(inputString, tokenIn?.symbol!); const [approvalParams, setApprovalParams] = useState(); - const [sendParams, setSendParams] = useState(); + const [sendParams, setSendParams] = useState(); const [error, setError] = useState(); useEffect(() => { diff --git a/src/components/current/widgets/nft/BuyNft.tsx b/src/components/current/widgets/nft/BuyNft.tsx index 027438a3..0500b0d9 100644 --- a/src/components/current/widgets/nft/BuyNft.tsx +++ b/src/components/current/widgets/nft/BuyNft.tsx @@ -44,10 +44,11 @@ export const BuyNft = ({ // Simulate tx to re-verify if the NFT is for sale const { isError } = usePrepareContractWrite({ ...tx, - overrides: { - ...tx.overrides, - gasLimit: undefined, - }, + // overrides: { + // ...tx.overrides, + // gasLimit: undefined, + // }, + // ...tx.overrides }); const notForSale = !isForSale || isError; diff --git a/src/components/current/widgets/transfer/Transfer.tsx b/src/components/current/widgets/transfer/Transfer.tsx index b804b27a..d81b892d 100644 --- a/src/components/current/widgets/transfer/Transfer.tsx +++ b/src/components/current/widgets/transfer/Transfer.tsx @@ -1,10 +1,10 @@ import { AddressZero } from '@ethersproject/constants'; -import { parseUnits } from 'ethers/lib/utils.js'; import { erc20ABI, useAccount, useEnsAddress } from 'wagmi'; import { ActionResponse, HeaderResponse } from '@/components/cactiComponents'; import { SEND_ETH_FNNAME } from '@/components/cactiComponents/hooks/useSubmitTx'; import useToken from '@/hooks/useToken'; import { ConnectFirst } from '../helpers/ConnectFirst'; +import { parseUnits } from 'viem'; interface TransferWidgetProps { tokenSymbol: string; @@ -14,7 +14,7 @@ interface TransferWidgetProps { const Transfer = ({ tokenSymbol, amtString, receiver }: TransferWidgetProps) => { const { isETH, data: token } = useToken(tokenSymbol); - const amount = parseUnits(amtString, token?.decimals); + const amount = parseUnits(amtString, token?.decimals!); // Resolve ENS name const { data: receiverAddress } = useEnsAddress({ diff --git a/src/components/current/widgets/tx-replay/TransactionReplay.tsx b/src/components/current/widgets/tx-replay/TransactionReplay.tsx index 25ce2120..75d44a23 100644 --- a/src/components/current/widgets/tx-replay/TransactionReplay.tsx +++ b/src/components/current/widgets/tx-replay/TransactionReplay.tsx @@ -1,6 +1,5 @@ import React, { useCallback, useEffect, useState } from 'react'; -import { BigNumber, UnsignedTransaction, ethers } from 'ethers'; -import { decodeFunctionData } from 'viem'; +import { Transaction, decodeFunctionData } from 'viem'; import { Address, useTransaction } from 'wagmi'; import { ActionResponse, HeaderResponse, SingleLineResponse } from '@/components/cactiComponents'; import SkeletonWrap from '@/components/shared/SkeletonWrap'; @@ -14,7 +13,7 @@ interface TransactionReplayProps { const TransactionReplay = ({ txHash }: TransactionReplayProps) => { const { data, isLoading } = useTransaction({ hash: txHash }); const { data: abi } = useAbi(data?.to as Address | undefined); - const [sendParams, setSendParams] = useState(); + const [sendParams, setSendParams] = useState(); const [isError, setIsError] = useState(false); const explorerUrl = `https://etherscan.io/tx/${txHash}`; diff --git a/src/hooks/useInput.ts b/src/hooks/useInput.ts index 9c720019..4e1d4a43 100644 --- a/src/hooks/useInput.ts +++ b/src/hooks/useInput.ts @@ -1,11 +1,10 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { formatUnits, parseUnits } from 'ethers/lib/utils.js'; import { cleanValue } from '@/utils'; import useToken from './useToken'; +import { formatUnits, parseUnits } from 'viem'; type Input = { - value: BigNumber | undefined; + value: bigint | undefined; formatted: string | undefined; decimals: number; }; @@ -21,7 +20,7 @@ type Input = { const useInput = ( input: string, tokenSymbol: string, - mutate?: (inputBN: BigNumber) => BigNumber + mutate?: (inputBN: bigint) => bigint ) => { const { data: token } = useToken(tokenSymbol); From 5925d7218483c8808de51ea8f55e117fab8800bf Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Thu, 14 Sep 2023 09:41:57 -0700 Subject: [PATCH 04/80] package: update viem --- package.json | 2 +- yarn.lock | 26 ++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 186be720..f9ef332b 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "siwe": "^2.1.4", "swr": "^2.0.4", "typescript": "^5.2.2", - "viem": "^1.9.3", + "viem": "^1.10.13", "wagmi": "^1.4.1", "zksync-web3": "^0.14.3" }, diff --git a/yarn.lock b/yarn.lock index 0d33a4a6..5b51a9ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9466,7 +9466,7 @@ __metadata: tailwind-styled-components: ^2.2.0 tailwindcss: ^3.2.4 typescript: ^5.2.2 - viem: ^1.9.3 + viem: ^1.10.13 wagmi: ^1.4.1 zksync-web3: ^0.14.3 languageName: unknown @@ -22440,7 +22440,7 @@ __metadata: languageName: node linkType: hard -"viem@npm:^1.0.0": +"viem@npm:^1.0.0, viem@npm:^1.10.13": version: 1.10.13 resolution: "viem@npm:1.10.13" dependencies: @@ -22462,28 +22462,6 @@ __metadata: languageName: node linkType: hard -"viem@npm:^1.9.3": - version: 1.10.9 - resolution: "viem@npm:1.10.9" - 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: 7bf53044abff4ff703d518227921d9a56907be744a30750873231a442dcfdee485d9928f337e22ad698a4d0cf25a57194aee9e636a09233169721bf2a6f2eea0 - languageName: node - linkType: hard - "vm-browserify@npm:^1.1.2": version: 1.1.2 resolution: "vm-browserify@npm:1.1.2" From 630a836814848b9261f19fba47c325a80851ff8d Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Thu, 14 Sep 2023 10:03:51 -0700 Subject: [PATCH 05/80] fix: update to solely use viem --- .../widgets/tx-replay/TransactionReplay.tsx | 41 +++++++++---------- src/hooks/useAbi.tsx | 2 +- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/components/current/widgets/tx-replay/TransactionReplay.tsx b/src/components/current/widgets/tx-replay/TransactionReplay.tsx index 75d44a23..4dd67a16 100644 --- a/src/components/current/widgets/tx-replay/TransactionReplay.tsx +++ b/src/components/current/widgets/tx-replay/TransactionReplay.tsx @@ -1,6 +1,6 @@ import React, { useCallback, useEffect, useState } from 'react'; -import { Transaction, decodeFunctionData } from 'viem'; -import { Address, useTransaction } from 'wagmi'; +import { TransactionRequestBase, decodeFunctionData, encodeFunctionData, getAddress } from 'viem'; +import { Address, useAccount, useTransaction } from 'wagmi'; import { ActionResponse, HeaderResponse, SingleLineResponse } from '@/components/cactiComponents'; import SkeletonWrap from '@/components/shared/SkeletonWrap'; import useAbi from '@/hooks/useAbi'; @@ -11,16 +11,17 @@ interface TransactionReplayProps { } const TransactionReplay = ({ txHash }: TransactionReplayProps) => { + const { address: account } = useAccount(); const { data, isLoading } = useTransaction({ hash: txHash }); - const { data: abi } = useAbi(data?.to as Address | undefined); - const [sendParams, setSendParams] = useState(); + const { data: abi } = useAbi(data?.to); + const [sendParams, setSendParams] = useState(); const [isError, setIsError] = useState(false); const explorerUrl = `https://etherscan.io/tx/${txHash}`; // State to hold editable fields, stored as strings for simplicity const [decoded, setDecoded] = useState<{ - to?: string; + to: Address; value: string; functionName?: string; args?: { @@ -32,7 +33,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { // handle decoding the transaction data const handleDecode = useCallback(() => { - if (!data) return console.log('no data'); + if (!data?.input || !data.to) return console.log('no data'); if (!abi) { console.log('no abi, is possibly an eth/native currency transfer'); return setDecoded({ @@ -47,7 +48,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { let functionName: string; try { - const decoded = decodeFunctionData({ abi, data: data.data as Address }); + const decoded = decodeFunctionData({ abi, data: data.input }); args = decoded.args as string[]; functionName = decoded.functionName; } catch (e) { @@ -109,7 +110,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { } // handle changing the to param if (name === 'to') { - setDecoded((d) => d && { ...d, to: value }); + setDecoded((d) => d && { ...d, to: getAddress(value) }); return; } @@ -125,16 +126,16 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { }); }; - const getSendParams = useCallback((): UnsignedTransaction | undefined => { + const getSendParams = useCallback((): TransactionRequestBase | undefined => { if (!decoded) { console.error('Decoded data is missing'); return; } // Initialize a transaction object - let transaction: Partial = { + let transaction: Partial = { to: decoded.to, - value: BigNumber.from(decoded.value), + value: BigInt(decoded.value), }; // If it's a simple transfer @@ -154,15 +155,13 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { return arg.value; }) || []; - // Create the function signature - const functionTypes = decoded.args.map((arg) => arg.type).join(','); - const functionSignature = `${decoded.functionName}(${functionTypes})`; - - // Create the encoded data field for contract interaction - const iface = new ethers.utils.Interface(abi); try { // Encode the function data - const data = iface.encodeFunctionData(functionSignature, convertedArgs); + const data = encodeFunctionData({ + abi, + functionName: decoded.functionName, + args: convertedArgs, + }); transaction.data = data; // Now, you can populate the transaction object and pass it to ActionResponse } catch (e) { @@ -170,8 +169,8 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { } } - setSendParams(transaction); - }, [abi, decoded]); + setSendParams({ from: account!, ...transaction }); + }, [abi, account, decoded]); useEffect(() => { getSendParams(); @@ -204,7 +203,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { /> ))} - {BigNumber.from(decoded.value)?.gt(ethers.constants.Zero) && decoded.to && ( + {BigInt(decoded.value) > BigInt(0) && decoded.to && ( <>