From 6a4430c680094f5461b996e22614b0bcdba69f48 Mon Sep 17 00:00:00 2001 From: Christophe Deveaux Date: Thu, 9 Jan 2025 17:05:43 +0100 Subject: [PATCH 1/5] build(deps): bump next from 14.2.15 to 14.2.21 (#2173) --- packages/arb-token-bridge-ui/package.json | 2 +- yarn.lock | 124 +++++++++++----------- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/packages/arb-token-bridge-ui/package.json b/packages/arb-token-bridge-ui/package.json index 22540e5993..b8311e0c57 100644 --- a/packages/arb-token-bridge-ui/package.json +++ b/packages/arb-token-bridge-ui/package.json @@ -28,7 +28,7 @@ "exponential-backoff": "^3.1.1", "graphql": "^16.9.0", "lodash-es": "^4.17.21", - "next": "^14.2.15", + "next": "^14.2.22", "next-query-params": "^5.0.0", "overmind": "^28.0.1", "overmind-react": "^29.0.1", diff --git a/yarn.lock b/yarn.lock index 936d7eb588..cdf686e6b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1768,10 +1768,10 @@ "@motionone/dom" "^10.16.2" tslib "^2.3.1" -"@next/env@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/env/-/env-14.2.15.tgz#06d984e37e670d93ddd6790af1844aeb935f332f" - integrity sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ== +"@next/env@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/env/-/env-14.2.22.tgz#8898ae47595badbfacebfc1585f42a4e06a97301" + integrity sha512-EQ6y1QeNQglNmNIXvwP/Bb+lf7n9WtgcWvtoFsHquVLCJUuxRs+6SfZ5EK0/EqkkLex4RrDySvKgKNN7PXip7Q== "@next/eslint-plugin-next@14.2.5": version "14.2.5" @@ -1787,50 +1787,50 @@ dependencies: glob "7.1.7" -"@next/swc-darwin-arm64@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.15.tgz#6386d585f39a1c490c60b72b1f76612ba4434347" - integrity sha512-Rvh7KU9hOUBnZ9TJ28n2Oa7dD9cvDBKua9IKx7cfQQ0GoYUwg9ig31O2oMwH3wm+pE3IkAQ67ZobPfEgurPZIA== - -"@next/swc-darwin-x64@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.15.tgz#b7baeedc6a28f7545ad2bc55adbab25f7b45cb89" - integrity sha512-5TGyjFcf8ampZP3e+FyCax5zFVHi+Oe7sZyaKOngsqyaNEpOgkKB3sqmymkZfowy3ufGA/tUgDPPxpQx931lHg== - -"@next/swc-linux-arm64-gnu@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.15.tgz#fa13c59d3222f70fb4cb3544ac750db2c6e34d02" - integrity sha512-3Bwv4oc08ONiQ3FiOLKT72Q+ndEMyLNsc/D3qnLMbtUYTQAmkx9E/JRu0DBpHxNddBmNT5hxz1mYBphJ3mfrrw== - -"@next/swc-linux-arm64-musl@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.15.tgz#30e45b71831d9a6d6d18d7ac7d611a8d646a17f9" - integrity sha512-k5xf/tg1FBv/M4CMd8S+JL3uV9BnnRmoe7F+GWC3DxkTCD9aewFRH1s5rJ1zkzDa+Do4zyN8qD0N8c84Hu96FQ== - -"@next/swc-linux-x64-gnu@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.15.tgz#5065db17fc86f935ad117483f21f812dc1b39254" - integrity sha512-kE6q38hbrRbKEkkVn62reLXhThLRh6/TvgSP56GkFNhU22TbIrQDEMrO7j0IcQHcew2wfykq8lZyHFabz0oBrA== - -"@next/swc-linux-x64-musl@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.15.tgz#3c4a4568d8be7373a820f7576cf33388b5dab47e" - integrity sha512-PZ5YE9ouy/IdO7QVJeIcyLn/Rc4ml9M2G4y3kCM9MNf1YKvFY4heg3pVa/jQbMro+tP6yc4G2o9LjAz1zxD7tQ== - -"@next/swc-win32-arm64-msvc@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.15.tgz#fb812cc4ca0042868e32a6a021da91943bb08b98" - integrity sha512-2raR16703kBvYEQD9HNLyb0/394yfqzmIeyp2nDzcPV4yPjqNUG3ohX6jX00WryXz6s1FXpVhsCo3i+g4RUX+g== - -"@next/swc-win32-ia32-msvc@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.15.tgz#ec26e6169354f8ced240c1427be7fd485c5df898" - integrity sha512-fyTE8cklgkyR1p03kJa5zXEaZ9El+kDNM5A+66+8evQS5e/6v0Gk28LqA0Jet8gKSOyP+OTm/tJHzMlGdQerdQ== - -"@next/swc-win32-x64-msvc@14.2.15": - version "14.2.15" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.15.tgz#18d68697002b282006771f8d92d79ade9efd35c4" - integrity sha512-SzqGbsLsP9OwKNUG9nekShTwhj6JSB9ZLMWQ8g1gG6hdE5gQLncbnbymrwy2yVmH9nikSLYRYxYMFu78Ggp7/g== +"@next/swc-darwin-arm64@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.22.tgz#2b3fcb42247ba951b19a48fc03f1d6fe65629baa" + integrity sha512-HUaLiehovgnqY4TMBZJ3pDaOsTE1spIXeR10pWgdQVPYqDGQmHJBj3h3V6yC0uuo/RoY2GC0YBFRkOX3dI9WVQ== + +"@next/swc-darwin-x64@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.22.tgz#11ecc609e9530b3edf8ddfd1fd3bd6aca4e1bfda" + integrity sha512-ApVDANousaAGrosWvxoGdLT0uvLBUC+srqOcpXuyfglA40cP2LBFaGmBjhgpxYk5z4xmunzqQvcIgXawTzo2uQ== + +"@next/swc-linux-arm64-gnu@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.22.tgz#4c08dd223e50c348f561af2285e27fb326ffabbf" + integrity sha512-3O2J99Bk9aM+d4CGn9eEayJXHuH9QLx0BctvWyuUGtJ3/mH6lkfAPRI4FidmHMBQBB4UcvLMfNf8vF0NZT7iKw== + +"@next/swc-linux-arm64-musl@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.22.tgz#0b285336f145887d421b3762f3d7c75f847ec1b3" + integrity sha512-H/hqfRz75yy60y5Eg7DxYfbmHMjv60Dsa6IWHzpJSz4MRkZNy5eDnEW9wyts9bkxwbOVZNPHeb3NkqanP+nGPg== + +"@next/swc-linux-x64-gnu@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.22.tgz#a936b6cfea0364571102f0389c6368d6acf3e294" + integrity sha512-LckLwlCLcGR1hlI5eiJymR8zSHPsuruuwaZ3H2uudr25+Dpzo6cRFjp/3OR5UYJt8LSwlXv9mmY4oI2QynwpqQ== + +"@next/swc-linux-x64-musl@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.22.tgz#0359497840d0b7d8c095d0d9735bc6aec68cef5d" + integrity sha512-qGUutzmh0PoFU0fCSu0XYpOfT7ydBZgDfcETIeft46abPqP+dmePhwRGLhFKwZWxNWQCPprH26TjaTxM0Nv8mw== + +"@next/swc-win32-arm64-msvc@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.22.tgz#9fd249d49ffccf3388400ab24472c432cdd04c24" + integrity sha512-K6MwucMWmIvMb9GlvT0haYsfIPxfQD8yXqxwFy4uLFMeXIb2TcVYQimxkaFZv86I7sn1NOZnpOaVk5eaxThGIw== + +"@next/swc-win32-ia32-msvc@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.22.tgz#70d8d5a48e78c7382c3e0544af28c2788ca6b551" + integrity sha512-5IhDDTPEbzPR31ZzqHe90LnNe7BlJUZvC4sA1thPJV6oN5WmtWjZ0bOYfNsyZx00FJt7gggNs6SrsX0UEIcIpA== + +"@next/swc-win32-x64-msvc@14.2.22": + version "14.2.22" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.22.tgz#b034f544c1346093a235f6bba46497a1ba344fc1" + integrity sha512-nvRaB1PyG4scn9/qNzlkwEwLzuoPH3Gjp7Q/pLuwUgOTt1oPMlnCI3A3rgkt+eZnU71emOiEv/mR201HoURPGg== "@noble/curves@1.2.0", "@noble/curves@~1.2.0": version "1.2.0" @@ -10804,12 +10804,12 @@ next-query-params@^5.0.0: dependencies: tslib "^2.0.3" -next@^14.2.15: - version "14.2.15" - resolved "https://registry.yarnpkg.com/next/-/next-14.2.15.tgz#348e5603e22649775d19c785c09a89c9acb5189a" - integrity sha512-h9ctmOokpoDphRvMGnwOJAedT6zKhwqyZML9mDtspgf4Rh3Pn7UTYKqePNoDvhsWBAO5GoPNYshnAUGIazVGmw== +next@^14.2.21: + version "14.2.22" + resolved "https://registry.yarnpkg.com/next/-/next-14.2.22.tgz#0cd664916ef4c725f31fa812d870348cffd0115b" + integrity sha512-Ps2caobQ9hlEhscLPiPm3J3SYhfwfpMqzsoCMZGWxt9jBRK9hoBZj2A37i8joKhsyth2EuVKDVJCTF5/H4iEDw== dependencies: - "@next/env" "14.2.15" + "@next/env" "14.2.22" "@swc/helpers" "0.5.5" busboy "1.6.0" caniuse-lite "^1.0.30001579" @@ -10817,15 +10817,15 @@ next@^14.2.15: postcss "8.4.31" styled-jsx "5.1.1" optionalDependencies: - "@next/swc-darwin-arm64" "14.2.15" - "@next/swc-darwin-x64" "14.2.15" - "@next/swc-linux-arm64-gnu" "14.2.15" - "@next/swc-linux-arm64-musl" "14.2.15" - "@next/swc-linux-x64-gnu" "14.2.15" - "@next/swc-linux-x64-musl" "14.2.15" - "@next/swc-win32-arm64-msvc" "14.2.15" - "@next/swc-win32-ia32-msvc" "14.2.15" - "@next/swc-win32-x64-msvc" "14.2.15" + "@next/swc-darwin-arm64" "14.2.22" + "@next/swc-darwin-x64" "14.2.22" + "@next/swc-linux-arm64-gnu" "14.2.22" + "@next/swc-linux-arm64-musl" "14.2.22" + "@next/swc-linux-x64-gnu" "14.2.22" + "@next/swc-linux-x64-musl" "14.2.22" + "@next/swc-win32-arm64-msvc" "14.2.22" + "@next/swc-win32-ia32-msvc" "14.2.22" + "@next/swc-win32-x64-msvc" "14.2.22" no-case@^3.0.4: version "3.0.4" From a45c962ff24d007e3b22d7d3de58a8da6a71d33e Mon Sep 17 00:00:00 2001 From: Dewansh Date: Fri, 10 Jan 2025 17:21:57 +0530 Subject: [PATCH 2/5] build(deps): bump swr from 2.1.2 to 2.3.0 (#2174) --- packages/arb-token-bridge-ui/package.json | 2 +- .../src/hooks/useAccountIsBlocked.ts | 7 +++++-- yarn.lock | 16 +++++++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/arb-token-bridge-ui/package.json b/packages/arb-token-bridge-ui/package.json index b8311e0c57..43631722c6 100644 --- a/packages/arb-token-bridge-ui/package.json +++ b/packages/arb-token-bridge-ui/package.json @@ -42,7 +42,7 @@ "react-use": "^17.6.0", "react-virtualized": "^9.22.3", "sharp": "^0.33.5", - "swr": "^2.1.2", + "swr": "^2.3.0", "tailwind-merge": "^2.5.5", "use-query-params": "^2.2.1", "wagmi": "^0.12.18", diff --git a/packages/arb-token-bridge-ui/src/hooks/useAccountIsBlocked.ts b/packages/arb-token-bridge-ui/src/hooks/useAccountIsBlocked.ts index 1ec288e21a..dd4bd75035 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useAccountIsBlocked.ts +++ b/packages/arb-token-bridge-ui/src/hooks/useAccountIsBlocked.ts @@ -66,10 +66,13 @@ export function useAccountIsBlocked() { return null } - return [address.toLowerCase(), 'useAccountIsBlocked'] + return [ + address.toLocaleLowerCase() as Address, + 'useAccountIsBlocked' + ] as const }, [address]) - const { data: isBlocked } = useSWRImmutable( + const { data: isBlocked } = useSWRImmutable( queryKey, // Extracts the first element of the query key as the fetcher param ([_address]) => fetcher(_address) diff --git a/yarn.lock b/yarn.lock index cdf686e6b1..1d556f8b3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13600,12 +13600,13 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -swr@^2.1.2: - version "2.1.5" - resolved "https://registry.npmjs.org/swr/-/swr-2.1.5.tgz" - integrity sha512-/OhfZMcEpuz77KavXST5q6XE9nrOBOVcBLWjMT+oAE/kQHyE3PASrevXCtQDZ8aamntOfFkbVJp7Il9tNBQWrw== +swr@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/swr/-/swr-2.3.0.tgz#66fa45023efd4199f4e7ce608c255709a135943d" + integrity sha512-NyZ76wA4yElZWBHzSgEJc28a0u6QZvhb6w0azeL2k7+Q1gAzVK+IqQYXhVOC/mzi+HZIozrZvBVeSeOZNR2bqA== dependencies: - use-sync-external-store "^1.2.0" + dequal "^2.0.3" + use-sync-external-store "^1.4.0" symbol-observable@^4.0.0: version "4.0.0" @@ -14363,6 +14364,11 @@ use-sync-external-store@1.2.0, use-sync-external-store@^1.2.0: resolved "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== +use-sync-external-store@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz#adbc795d8eeb47029963016cefdf89dc799fcebc" + integrity sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw== + user-home@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz" From f855d5696d53d479c8c2a679ea25baf54d91325a Mon Sep 17 00:00:00 2001 From: Fionna Chan <13184582+fionnachan@users.noreply.github.com> Date: Fri, 10 Jan 2025 20:26:33 +0800 Subject: [PATCH 3/5] build(deps): bump @testing-library/react from 14.2.1 to 16.1.0 (#2176) --- packages/arb-token-bridge-ui/package.json | 2 +- yarn.lock | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/arb-token-bridge-ui/package.json b/packages/arb-token-bridge-ui/package.json index 43631722c6..928566c2df 100644 --- a/packages/arb-token-bridge-ui/package.json +++ b/packages/arb-token-bridge-ui/package.json @@ -83,7 +83,7 @@ "devDependencies": { "@next/eslint-plugin-next": "^13.1.5", "@synthetixio/synpress": "3.7.3", - "@testing-library/react": "^14.2.1", + "@testing-library/react": "^16.1.0", "@types/jest": "^29.5.1", "@types/lodash-es": "^4.17.6", "@types/node": "^16.6.1", diff --git a/yarn.lock b/yarn.lock index 1d556f8b3b..23414ead7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2790,7 +2790,7 @@ lz-string "^1.5.0" pretty-format "^27.0.2" -"@testing-library/react@^14.0.0", "@testing-library/react@^14.2.1": +"@testing-library/react@^14.0.0": version "14.2.1" resolved "https://registry.npmjs.org/@testing-library/react/-/react-14.2.1.tgz" integrity sha512-sGdjws32ai5TLerhvzThYFbpnF9XtL65Cjf+gB0Dhr29BGqK+mAeN7SURSdu+eqgET4ANcWoC7FQpkaiGvBr+A== @@ -2799,6 +2799,13 @@ "@testing-library/dom" "^9.0.0" "@types/react-dom" "^18.0.0" +"@testing-library/react@^16.1.0": + version "16.1.0" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-16.1.0.tgz#aa0c61398bac82eaf89776967e97de41ac742d71" + integrity sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg== + dependencies: + "@babel/runtime" "^7.12.5" + "@tippyjs/react@^4.2.6": version "4.2.6" resolved "https://registry.npmjs.org/@tippyjs/react/-/react-4.2.6.tgz" From 592cdacc37d6ab1cc84ed7da5ca1c9faaf66e1bf Mon Sep 17 00:00:00 2001 From: Fionna Chan <13184582+fionnachan@users.noreply.github.com> Date: Fri, 10 Jan 2025 22:35:08 +0800 Subject: [PATCH 4/5] refactor: pass chain id instead of provider into function (#2171) --- .../src/hooks/useTransactionHistory.ts | 8 +------- .../src/util/deposits/helpers.ts | 13 +++++-------- .../src/util/teleports/helpers.ts | 18 ++---------------- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts index 285d867585..200c8d5347 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts +++ b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts @@ -161,13 +161,7 @@ async function transformTransaction(tx: Transfer): Promise { } if (isDeposit(tx)) { - return transformDeposit( - await updateAdditionalDepositData({ - depositTx: tx, - parentProvider, - childProvider - }) - ) + return transformDeposit(await updateAdditionalDepositData(tx)) } let withdrawal: L2ToL1EventResultPlus | undefined diff --git a/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts b/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts index 59d14ced25..bdd6cc93ec 100644 --- a/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts +++ b/packages/arb-token-bridge-ui/src/util/deposits/helpers.ts @@ -31,15 +31,12 @@ import { normalizeTimestamp } from '../../state/app/utils' -export const updateAdditionalDepositData = async ({ - depositTx, - parentProvider, - childProvider -}: { +export const updateAdditionalDepositData = async ( depositTx: Transaction - parentProvider: Provider - childProvider: Provider -}): Promise => { +): Promise => { + const parentProvider = getProviderForChainId(depositTx.parentChainId) + const childProvider = getProviderForChainId(depositTx.childChainId) + // 1. for all the fetched txns, fetch the transaction receipts and update their exact status // 2. on the basis of those, finally calculate the status of the transaction diff --git a/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts b/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts index b648950f18..af7da8a792 100644 --- a/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts +++ b/packages/arb-token-bridge-ui/src/util/teleports/helpers.ts @@ -70,14 +70,7 @@ export async function transformTeleportFromSubgraph( childChainId: Number(tx.childChainId) } as Transaction - const childProvider = getProviderForChainId(Number(tx.childChainId)) - return transformDeposit( - await updateAdditionalDepositData({ - depositTx, - parentProvider, - childProvider - }) - ) + return transformDeposit(await updateAdditionalDepositData(depositTx)) } // Erc20 transfers @@ -112,12 +105,5 @@ export async function transformTeleportFromSubgraph( childChainId: l3ChainId } as Transaction - const childProvider = getProviderForChainId(l3ChainId) - return transformDeposit( - await updateAdditionalDepositData({ - depositTx, - parentProvider, - childProvider - }) - ) + return transformDeposit(await updateAdditionalDepositData(depositTx)) } From 519c6d9b0d0b061cc8768a63eed4e2115c4e3cbc Mon Sep 17 00:00:00 2001 From: spsjvc Date: Mon, 13 Jan 2025 11:51:34 +0100 Subject: [PATCH 5/5] refactor: move ChainId to dedicated file (#2182) --- .../scripts/generateCoreChainsToMonitor.ts | 3 ++- .../src/api-utils/ServerSubgraphUtils.ts | 2 +- .../components/TransactionHistory/helpers.ts | 3 ++- .../components/TransferPanel/EstimatedGas.tsx | 3 ++- .../TransferPanel/OneNovaTransferDialog.tsx | 3 ++- .../TransferPanel/TransferDisabledDialog.tsx | 3 ++- .../TransferPanel/TransferPanelMain/utils.ts | 2 +- .../src/components/common/AddCustomChain.tsx | 2 +- .../common/NetworkSelectionContainer.tsx | 3 ++- .../src/generateOpenGraphImages.tsx | 3 ++- .../src/hooks/CCTP/useCCTPIsBlocked.ts | 2 +- .../useChainIdsForNetworkSelection.ts | 2 +- .../hooks/__tests__/useArbQueryParams.test.ts | 3 ++- .../src/hooks/__tests__/useNetworks.test.ts | 3 ++- .../src/hooks/useArbQueryParams.tsx | 2 +- .../src/hooks/useIsTestnetMode.ts | 3 ++- .../src/hooks/useNetworks.ts | 3 ++- .../src/hooks/useTransactionHistory.ts | 8 ++------ .../src/pages/api/cctp/[type].ts | 2 +- .../api/chains/[chainId]/block-number.ts | 2 +- .../src/state/cctpState.ts | 8 ++------ .../src/token-bridge-sdk/cctp.ts | 2 +- .../src/token-bridge-sdk/utils.ts | 3 ++- .../arb-token-bridge-ui/src/types/ChainId.ts | 18 +++++++++++++++++ .../src/types/ChainQueryParam.ts | 2 +- .../src/util/L2ApprovalUtils.ts | 2 +- .../src/util/L2NativeUtils.ts | 2 +- .../src/util/SubgraphUtils.ts | 2 +- .../src/util/TokenListUtils.ts | 2 +- .../src/util/TokenTeleportEnabledUtils.ts | 2 +- .../src/util/TokenTransferDisabledUtils.ts | 2 +- .../src/util/TokenUtils.ts | 3 ++- .../src/util/WithdrawOnlyUtils.ts | 3 ++- .../src/util/__tests__/networks.test.ts | 2 +- .../src/util/bridgeUiConfig.ts | 3 ++- .../src/util/cctp/fetchCCTP.ts | 2 +- .../src/util/fastBridges.ts | 2 +- .../arb-token-bridge-ui/src/util/infura.ts | 2 +- .../arb-token-bridge-ui/src/util/networks.ts | 20 +------------------ .../src/util/wagmi/getWagmiChain.ts | 3 ++- .../src/util/wagmi/setup.ts | 3 ++- .../src/util/wagmi/wagmiAdditionalNetworks.ts | 3 ++- .../src/util/xErc20Utils.ts | 2 +- 43 files changed, 80 insertions(+), 70 deletions(-) create mode 100644 packages/arb-token-bridge-ui/src/types/ChainId.ts diff --git a/packages/arb-token-bridge-ui/scripts/generateCoreChainsToMonitor.ts b/packages/arb-token-bridge-ui/scripts/generateCoreChainsToMonitor.ts index e9170e9b7c..13f9ef6af7 100644 --- a/packages/arb-token-bridge-ui/scripts/generateCoreChainsToMonitor.ts +++ b/packages/arb-token-bridge-ui/scripts/generateCoreChainsToMonitor.ts @@ -1,7 +1,8 @@ import fs from 'fs' import 'dotenv/config' import { getArbitrumNetwork } from '@arbitrum/sdk' -import { ChainId, rpcURLs } from '../src/util/networks' +import { rpcURLs } from '../src/util/networks' +import { ChainId } from '../src/types/ChainId' import { getChainToMonitor } from './utils' // github secrets return '' for empty values, so we need to sanitize the value diff --git a/packages/arb-token-bridge-ui/src/api-utils/ServerSubgraphUtils.ts b/packages/arb-token-bridge-ui/src/api-utils/ServerSubgraphUtils.ts index 0925c16e5d..60a1d083bd 100644 --- a/packages/arb-token-bridge-ui/src/api-utils/ServerSubgraphUtils.ts +++ b/packages/arb-token-bridge-ui/src/api-utils/ServerSubgraphUtils.ts @@ -5,7 +5,7 @@ import { NormalizedCacheObject } from '@apollo/client' -import { ChainId } from '../util/networks' +import { ChainId } from '../types/ChainId' /** * The API key to be used for calls to The Graph Network. diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts b/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts index 3a10fb6929..ce795b4526 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts @@ -15,7 +15,8 @@ import { TeleporterMergedTransaction, WithdrawalStatus } from '../../state/app/state' -import { ChainId, getL1BlockTime, isNetwork } from '../../util/networks' +import { getL1BlockTime, isNetwork } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { Deposit, Transfer } from '../../hooks/useTransactionHistory' import { getParentToChildMessageDataFromParentTxHash, diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/EstimatedGas.tsx b/packages/arb-token-bridge-ui/src/components/TransferPanel/EstimatedGas.tsx index be0675afcc..0b1de4f338 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/EstimatedGas.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/EstimatedGas.tsx @@ -3,7 +3,8 @@ import { useMemo } from 'react' import { twMerge } from 'tailwind-merge' import { useAppState } from '../../state' -import { ChainId, getNetworkName, isNetwork } from '../../util/networks' +import { getNetworkName, isNetwork } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { Tooltip } from '../common/Tooltip' import { formatAmount } from '../../util/NumberUtils' import { useNativeCurrency } from '../../hooks/useNativeCurrency' diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/OneNovaTransferDialog.tsx b/packages/arb-token-bridge-ui/src/components/TransferPanel/OneNovaTransferDialog.tsx index 44a8c540d5..c48987fa35 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/OneNovaTransferDialog.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/OneNovaTransferDialog.tsx @@ -7,7 +7,8 @@ import { BridgesTable } from '../common/BridgesTable' import { SecurityNotGuaranteed } from './SecurityLabels' import { Dialog, UseDialogProps } from '../common/Dialog' import { FastBridgeInfo, FastBridgeNames } from '../../util/fastBridges' -import { ChainId, getNetworkName, isNetwork } from '../../util/networks' +import { getNetworkName, isNetwork } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { ether } from '../../constants' import { useArbQueryParams } from '../../hooks/useArbQueryParams' import { useNetworks } from '../../hooks/useNetworks' diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferDisabledDialog.tsx b/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferDisabledDialog.tsx index 12b9dcfdd0..8f5d993e54 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferDisabledDialog.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferDisabledDialog.tsx @@ -6,7 +6,8 @@ import { Dialog } from '../common/Dialog' import { sanitizeTokenSymbol } from '../../util/TokenUtils' import { useNetworks } from '../../hooks/useNetworks' import { ExternalLink } from '../common/ExternalLink' -import { ChainId, getNetworkName } from '../../util/networks' +import { getNetworkName } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { getL2ConfigForTeleport } from '../../token-bridge-sdk/teleport' import { useNetworksRelationship } from '../../hooks/useNetworksRelationship' import { withdrawOnlyTokens } from '../../util/WithdrawOnlyUtils' diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMain/utils.ts b/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMain/utils.ts index 930bab1453..8f6ee3a2ba 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMain/utils.ts +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMain/utils.ts @@ -1,4 +1,4 @@ -import { ChainId } from '../../../util/networks' +import { ChainId } from '../../../types/ChainId' export enum NetworkType { parentChain = 'parentChain', diff --git a/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx b/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx index 76a346f12e..9be3138a8d 100644 --- a/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx +++ b/packages/arb-token-bridge-ui/src/components/common/AddCustomChain.tsx @@ -11,7 +11,6 @@ import SyntaxHighlighter from 'react-syntax-highlighter' import { stackoverflowDark } from 'react-syntax-highlighter/dist/esm/styles/hljs' import { - ChainId, ChainWithRpcUrl, getCustomChainsFromLocalStorage, getCustomChainFromLocalStorageById, @@ -22,6 +21,7 @@ import { rpcURLs, isNetwork } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { Loader } from './atoms/Loader' import { Erc20Data, fetchErc20Data } from '../../util/TokenUtils' import { getProviderForChainId } from '@/token-bridge-sdk/utils' diff --git a/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx b/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx index dc328d6034..aab6e65c24 100644 --- a/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx +++ b/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx @@ -15,7 +15,8 @@ import { import { twMerge } from 'tailwind-merge' import { AutoSizer, List, ListRowProps } from 'react-virtualized' -import { ChainId, isNetwork, getNetworkName } from '../../util/networks' +import { isNetwork, getNetworkName } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { useIsTestnetMode } from '../../hooks/useIsTestnetMode' import { SearchPanel } from './SearchPanel/SearchPanel' import { SearchPanelTable } from './SearchPanel/SearchPanelTable' diff --git a/packages/arb-token-bridge-ui/src/generateOpenGraphImages.tsx b/packages/arb-token-bridge-ui/src/generateOpenGraphImages.tsx index 6df1761284..01ff07ff39 100644 --- a/packages/arb-token-bridge-ui/src/generateOpenGraphImages.tsx +++ b/packages/arb-token-bridge-ui/src/generateOpenGraphImages.tsx @@ -2,7 +2,8 @@ import React from 'react' import satori, { Font } from 'satori' import sharp from 'sharp' import fs from 'fs' -import { ChainId, isNetwork } from './util/networks' +import { isNetwork } from './util/networks' +import { ChainId } from './types/ChainId' import { getBridgeUiConfigForChain } from './util/bridgeUiConfig' import { orbitMainnets, orbitTestnets } from './util/orbitChainsList' diff --git a/packages/arb-token-bridge-ui/src/hooks/CCTP/useCCTPIsBlocked.ts b/packages/arb-token-bridge-ui/src/hooks/CCTP/useCCTPIsBlocked.ts index d4c8c0bc98..c8ec3a1701 100644 --- a/packages/arb-token-bridge-ui/src/hooks/CCTP/useCCTPIsBlocked.ts +++ b/packages/arb-token-bridge-ui/src/hooks/CCTP/useCCTPIsBlocked.ts @@ -1,5 +1,5 @@ import useSWRImmutable from 'swr/immutable' -import { ChainId } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { getCctpUtils } from '@/token-bridge-sdk/cctp' export function useCCTPIsBlocked() { diff --git a/packages/arb-token-bridge-ui/src/hooks/TransferPanel/useChainIdsForNetworkSelection.ts b/packages/arb-token-bridge-ui/src/hooks/TransferPanel/useChainIdsForNetworkSelection.ts index 6d139ed254..68b776da8f 100644 --- a/packages/arb-token-bridge-ui/src/hooks/TransferPanel/useChainIdsForNetworkSelection.ts +++ b/packages/arb-token-bridge-ui/src/hooks/TransferPanel/useChainIdsForNetworkSelection.ts @@ -1,8 +1,8 @@ import { - ChainId, getDestinationChainIds, getSupportedChainIds } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { useIsTestnetMode } from '../useIsTestnetMode' import { useNetworks } from '../useNetworks' diff --git a/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts b/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts index e31ac3dd95..924645d6de 100644 --- a/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts +++ b/packages/arb-token-bridge-ui/src/hooks/__tests__/useArbQueryParams.test.ts @@ -2,7 +2,8 @@ * @jest-environment jsdom */ import { registerCustomArbitrumNetwork } from '@arbitrum/sdk' -import { ChainId, customChainLocalStorageKey } from '../../util/networks' +import { customChainLocalStorageKey } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { AmountQueryParam, ChainParam } from '../useArbQueryParams' import { createMockOrbitChain } from './helpers' diff --git a/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts b/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts index ec03fd1f9c..b7b2de2db3 100644 --- a/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts +++ b/packages/arb-token-bridge-ui/src/hooks/__tests__/useNetworks.test.ts @@ -2,7 +2,8 @@ * @jest-environment jsdom */ import { registerCustomArbitrumNetwork } from '@arbitrum/sdk' -import { ChainId, customChainLocalStorageKey } from '../../util/networks' +import { customChainLocalStorageKey } from '../../util/networks' +import { ChainId } from '../../types/ChainId' import { sanitizeQueryParams } from '../useNetworks' import { createMockOrbitChain } from './helpers' diff --git a/packages/arb-token-bridge-ui/src/hooks/useArbQueryParams.tsx b/packages/arb-token-bridge-ui/src/hooks/useArbQueryParams.tsx index 0d07a46d3e..0d61bd7394 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useArbQueryParams.tsx +++ b/packages/arb-token-bridge-ui/src/hooks/useArbQueryParams.tsx @@ -32,7 +32,7 @@ import { getChainQueryParamForChain, isValidChainQueryParam } from '../types/ChainQueryParam' -import { ChainId } from '../util/networks' +import { ChainId } from '../types/ChainId' export enum AmountQueryParamEnum { MAX = 'max' diff --git a/packages/arb-token-bridge-ui/src/hooks/useIsTestnetMode.ts b/packages/arb-token-bridge-ui/src/hooks/useIsTestnetMode.ts index 3917b493f6..052f54629a 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useIsTestnetMode.ts +++ b/packages/arb-token-bridge-ui/src/hooks/useIsTestnetMode.ts @@ -1,6 +1,7 @@ import { useCallback } from 'react' import { useNetworks } from './useNetworks' -import { ChainId, isNetwork } from '../util/networks' +import { isNetwork } from '../util/networks' +import { ChainId } from '../types/ChainId' export const useIsTestnetMode = () => { const [networks, setNetworks] = useNetworks() diff --git a/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts b/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts index b141f2d144..58f97cd4a8 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts +++ b/packages/arb-token-bridge-ui/src/hooks/useNetworks.ts @@ -4,7 +4,8 @@ import { useCallback, useMemo } from 'react' import { mainnet, arbitrum } from '@wagmi/core/chains' import { useArbQueryParams } from './useArbQueryParams' -import { ChainId, getCustomChainsFromLocalStorage } from '../util/networks' +import { getCustomChainsFromLocalStorage } from '../util/networks' +import { ChainId } from '../types/ChainId' import { sepolia, holesky, diff --git a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts index 200c8d5347..c2f2779c19 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts +++ b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts @@ -4,12 +4,8 @@ import useSWRInfinite from 'swr/infinite' import { useCallback, useEffect, useMemo, useState } from 'react' import dayjs from 'dayjs' -import { - ChainId, - getChains, - getChildChainIds, - isNetwork -} from '../util/networks' +import { getChains, getChildChainIds, isNetwork } from '../util/networks' +import { ChainId } from '../types/ChainId' import { fetchWithdrawals } from '../util/withdrawals/fetchWithdrawals' import { fetchDeposits } from '../util/deposits/fetchDeposits' import { diff --git a/packages/arb-token-bridge-ui/src/pages/api/cctp/[type].ts b/packages/arb-token-bridge-ui/src/pages/api/cctp/[type].ts index ff4e3d2021..6925c98b5d 100644 --- a/packages/arb-token-bridge-ui/src/pages/api/cctp/[type].ts +++ b/packages/arb-token-bridge-ui/src/pages/api/cctp/[type].ts @@ -1,7 +1,7 @@ import { gql } from '@apollo/client' import { NextApiRequest, NextApiResponse } from 'next' -import { ChainId } from '../../../util/networks' +import { ChainId } from '../../../types/ChainId' import { Address } from '../../../util/AddressUtils' import { diff --git a/packages/arb-token-bridge-ui/src/pages/api/chains/[chainId]/block-number.ts b/packages/arb-token-bridge-ui/src/pages/api/chains/[chainId]/block-number.ts index 02dd20f839..f23b2fd4c3 100644 --- a/packages/arb-token-bridge-ui/src/pages/api/chains/[chainId]/block-number.ts +++ b/packages/arb-token-bridge-ui/src/pages/api/chains/[chainId]/block-number.ts @@ -1,7 +1,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { gql } from '@apollo/client' -import { ChainId } from '../../../../util/networks' +import { ChainId } from '../../../../types/ChainId' import { getL1SubgraphClient, getL2SubgraphClient, diff --git a/packages/arb-token-bridge-ui/src/state/cctpState.ts b/packages/arb-token-bridge-ui/src/state/cctpState.ts index 7f0eb43f84..523aa80b73 100644 --- a/packages/arb-token-bridge-ui/src/state/cctpState.ts +++ b/packages/arb-token-bridge-ui/src/state/cctpState.ts @@ -5,12 +5,8 @@ import useSWRImmutable from 'swr/immutable' import { useInterval } from 'react-use' import { getCctpUtils } from '@/token-bridge-sdk/cctp' -import { - ChainId, - getL1BlockTime, - getNetworkName, - isNetwork -} from '../util/networks' +import { getL1BlockTime, getNetworkName, isNetwork } from '../util/networks' +import { ChainId } from '../types/ChainId' import { fetchCCTPDeposits, fetchCCTPWithdrawals } from '../util/cctp/fetchCCTP' import { DepositStatus, MergedTransaction, WithdrawalStatus } from './app/state' import { normalizeTimestamp } from './app/utils' diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/cctp.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/cctp.ts index eb446b7679..e816a8394b 100644 --- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/cctp.ts +++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/cctp.ts @@ -5,7 +5,7 @@ import { ChainDomain } from '../pages/api/cctp/[type]' import { prepareWriteContract, writeContract } from '@wagmi/core' import { MessageTransmitterAbi } from '../util/cctp/MessageTransmitterAbi' import { CCTPSupportedChainId } from '../state/cctpState' -import { ChainId } from '../util/networks' +import { ChainId } from '../types/ChainId' import { CommonAddress } from '../util/CommonAddressUtils' import { Address } from '../util/AddressUtils' diff --git a/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts b/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts index 54e7483bbf..b8bc6ae6dc 100644 --- a/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts +++ b/packages/arb-token-bridge-ui/src/token-bridge-sdk/utils.ts @@ -1,7 +1,8 @@ import { BigNumber, Signer } from 'ethers' import { Provider, StaticJsonRpcProvider } from '@ethersproject/providers' -import { ChainId, isNetwork, rpcURLs } from '../util/networks' +import { isNetwork, rpcURLs } from '../util/networks' +import { ChainId } from '../types/ChainId' import { BridgeTransferStarterPropsWithChainIds } from './BridgeTransferStarter' import { isValidTeleportChainPair } from './teleport' import { diff --git a/packages/arb-token-bridge-ui/src/types/ChainId.ts b/packages/arb-token-bridge-ui/src/types/ChainId.ts new file mode 100644 index 0000000000..c5a4057f6e --- /dev/null +++ b/packages/arb-token-bridge-ui/src/types/ChainId.ts @@ -0,0 +1,18 @@ +export enum ChainId { + // L1 + Ethereum = 1, + // L1 Testnets + Local = 1337, + Sepolia = 11155111, + Holesky = 17000, + // L2 + ArbitrumOne = 42161, + ArbitrumNova = 42170, + Base = 8453, + // L2 Testnets + ArbitrumSepolia = 421614, + ArbitrumLocal = 412346, + BaseSepolia = 84532, + // L3 Testnets + L3Local = 333333 +} diff --git a/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts b/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts index cb41de6fc8..15e2c0614c 100644 --- a/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts +++ b/packages/arb-token-bridge-ui/src/types/ChainQueryParam.ts @@ -1,10 +1,10 @@ import { Chain } from 'wagmi' import * as chains from 'wagmi/chains' import { - ChainId, getCustomChainFromLocalStorageById, getSupportedChainIds } from '../util/networks' +import { ChainId } from '../types/ChainId' import * as customChains from '../util/wagmi/wagmiAdditionalNetworks' import { getOrbitChains, orbitChains } from '../util/orbitChainsList' import { chainToWagmiChain } from '../util/wagmi/wagmiAdditionalNetworks' diff --git a/packages/arb-token-bridge-ui/src/util/L2ApprovalUtils.ts b/packages/arb-token-bridge-ui/src/util/L2ApprovalUtils.ts index b5bfe7d038..55001b5acb 100644 --- a/packages/arb-token-bridge-ui/src/util/L2ApprovalUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/L2ApprovalUtils.ts @@ -1,4 +1,4 @@ -import { ChainId } from '../util/networks' +import { ChainId } from '../types/ChainId' import { xErc20RequiresApprovalOnChildChain } from './xErc20Utils' export type RequireL2ApproveToken = { diff --git a/packages/arb-token-bridge-ui/src/util/L2NativeUtils.ts b/packages/arb-token-bridge-ui/src/util/L2NativeUtils.ts index e223f7b9ed..a6f0cb8652 100644 --- a/packages/arb-token-bridge-ui/src/util/L2NativeUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/L2NativeUtils.ts @@ -1,4 +1,4 @@ -import { ChainId } from '../util/networks' +import { ChainId } from '../types/ChainId' import { CommonAddress } from './CommonAddressUtils' export type L2NativeToken = { diff --git a/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts b/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts index 53d3d6c5f3..dcdd31f896 100644 --- a/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts @@ -1,4 +1,4 @@ -import { ChainId } from './networks' +import { ChainId } from '../types/ChainId' import { getAPIBaseUrl } from '.' export function hasL1Subgraph(l2ChainId: number) { diff --git a/packages/arb-token-bridge-ui/src/util/TokenListUtils.ts b/packages/arb-token-bridge-ui/src/util/TokenListUtils.ts index 4f9f629475..09fe0ccd56 100644 --- a/packages/arb-token-bridge-ui/src/util/TokenListUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/TokenListUtils.ts @@ -8,7 +8,7 @@ import CMCLogo from '@/images/lists/cmc.png' import CoinGeckoLogo from '@/images/lists/coinGecko.svg' import ArbitrumLogo from '@/images/lists/ArbitrumLogo.png' import { ArbTokenBridge } from '../hooks/arbTokenBridge.types' -import { ChainId } from './networks' +import { ChainId } from '../types/ChainId' import orbitChainsData from './orbitChainsData.json' export const SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID = diff --git a/packages/arb-token-bridge-ui/src/util/TokenTeleportEnabledUtils.ts b/packages/arb-token-bridge-ui/src/util/TokenTeleportEnabledUtils.ts index 3eabd7ed9d..72127f7bc5 100644 --- a/packages/arb-token-bridge-ui/src/util/TokenTeleportEnabledUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/TokenTeleportEnabledUtils.ts @@ -1,4 +1,4 @@ -import { ChainId } from './networks' +import { ChainId } from '../types/ChainId' export type TeleportEnabledToken = { symbol: string diff --git a/packages/arb-token-bridge-ui/src/util/TokenTransferDisabledUtils.ts b/packages/arb-token-bridge-ui/src/util/TokenTransferDisabledUtils.ts index 563f9b6549..863b01a5d4 100644 --- a/packages/arb-token-bridge-ui/src/util/TokenTransferDisabledUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/TokenTransferDisabledUtils.ts @@ -1,4 +1,4 @@ -import { ChainId } from '../util/networks' +import { ChainId } from '../types/ChainId' export type TransferDisabledToken = { symbol: string diff --git a/packages/arb-token-bridge-ui/src/util/TokenUtils.ts b/packages/arb-token-bridge-ui/src/util/TokenUtils.ts index 428e0dc305..b180be53c8 100644 --- a/packages/arb-token-bridge-ui/src/util/TokenUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/TokenUtils.ts @@ -11,7 +11,8 @@ import { import { ERC20__factory } from '@arbitrum/sdk/dist/lib/abi/factories/ERC20__factory' import { CommonAddress } from './CommonAddressUtils' -import { ChainId, isNetwork } from './networks' +import { isNetwork } from './networks' +import { ChainId } from '../types/ChainId' import { defaultErc20Decimals } from '../defaults' import { ERC20BridgeToken, TokenType } from '../hooks/arbTokenBridge.types' import { getBridger, getChainIdFromProvider } from '../token-bridge-sdk/utils' diff --git a/packages/arb-token-bridge-ui/src/util/WithdrawOnlyUtils.ts b/packages/arb-token-bridge-ui/src/util/WithdrawOnlyUtils.ts index 67f5aefd0c..08a45510a7 100644 --- a/packages/arb-token-bridge-ui/src/util/WithdrawOnlyUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/WithdrawOnlyUtils.ts @@ -4,7 +4,8 @@ import { ethers } from 'ethers' import { getProviderForChainId } from '@/token-bridge-sdk/utils' -import { ChainId, isNetwork } from '../util/networks' +import { isNetwork } from '../util/networks' +import { ChainId } from '../types/ChainId' import { isTokenArbitrumOneUSDCe, isTokenArbitrumSepoliaUSDCe diff --git a/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts b/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts index fe0e2f7952..445272a7f7 100644 --- a/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts +++ b/packages/arb-token-bridge-ui/src/util/__tests__/networks.test.ts @@ -1,11 +1,11 @@ import { registerCustomArbitrumNetwork } from '@arbitrum/sdk' import { - ChainId, getBlockNumberReferenceChainIdByChainId, getDestinationChainIds, getSupportedChainIds } from '../networks' +import { ChainId } from '../../types/ChainId' import { orbitTestnets } from '../orbitChainsList' const xaiTestnetChainId = 37714555429 diff --git a/packages/arb-token-bridge-ui/src/util/bridgeUiConfig.ts b/packages/arb-token-bridge-ui/src/util/bridgeUiConfig.ts index d7d4461918..03d8d03695 100644 --- a/packages/arb-token-bridge-ui/src/util/bridgeUiConfig.ts +++ b/packages/arb-token-bridge-ui/src/util/bridgeUiConfig.ts @@ -1,4 +1,5 @@ -import { ChainId, getCustomChainFromLocalStorageById } from './networks' +import { getCustomChainFromLocalStorageById } from './networks' +import { ChainId } from '../types/ChainId' import { orbitChains, BridgeUiConfig } from './orbitChainsList' export function getBridgeUiConfigForChain(chainId: number): BridgeUiConfig { diff --git a/packages/arb-token-bridge-ui/src/util/cctp/fetchCCTP.ts b/packages/arb-token-bridge-ui/src/util/cctp/fetchCCTP.ts index bddf51db87..7b19be6214 100644 --- a/packages/arb-token-bridge-ui/src/util/cctp/fetchCCTP.ts +++ b/packages/arb-token-bridge-ui/src/util/cctp/fetchCCTP.ts @@ -1,4 +1,4 @@ -import { ChainId } from '../networks' +import { ChainId } from '../../types/ChainId' import { getAPIBaseUrl, sanitizeQueryParams } from '..' import { CompletedCCTPTransfer, diff --git a/packages/arb-token-bridge-ui/src/util/fastBridges.ts b/packages/arb-token-bridge-ui/src/util/fastBridges.ts index 31e258336c..45f17f6c77 100644 --- a/packages/arb-token-bridge-ui/src/util/fastBridges.ts +++ b/packages/arb-token-bridge-ui/src/util/fastBridges.ts @@ -10,7 +10,7 @@ import Wormhole from '@/images/bridge/wormhole.svg' // import LIFI from '@/images/bridge/lifi.webp' import Router from '@/images/bridge/router.webp' -import { ChainId } from './networks' +import { ChainId } from '../types/ChainId' import { USDC_LEARN_MORE_LINK } from '../constants' export enum FastBridgeNames { diff --git a/packages/arb-token-bridge-ui/src/util/infura.ts b/packages/arb-token-bridge-ui/src/util/infura.ts index 20fa95514d..dfe3b4d48a 100644 --- a/packages/arb-token-bridge-ui/src/util/infura.ts +++ b/packages/arb-token-bridge-ui/src/util/infura.ts @@ -1,7 +1,7 @@ import { providers } from 'ethers' import { Chain, ChainProviderFn } from 'wagmi' -import { ChainId } from './networks' +import { ChainId } from '../types/ChainId' // custom implementation based on https://github.com/wevm/wagmi/blob/wagmi%400.12.13/packages/core/src/providers/infura.ts // with multiple infura keys support diff --git a/packages/arb-token-bridge-ui/src/util/networks.ts b/packages/arb-token-bridge-ui/src/util/networks.ts index ff4ca58a60..a28f528d29 100644 --- a/packages/arb-token-bridge-ui/src/util/networks.ts +++ b/packages/arb-token-bridge-ui/src/util/networks.ts @@ -12,25 +12,7 @@ import { getBridgeUiConfigForChain } from './bridgeUiConfig' import { chainIdToInfuraUrl } from './infura' import { fetchErc20Data } from './TokenUtils' import { orbitChains } from './orbitChainsList' - -export enum ChainId { - // L1 - Ethereum = 1, - // L1 Testnets - Local = 1337, - Sepolia = 11155111, - Holesky = 17000, - // L2 - ArbitrumOne = 42161, - ArbitrumNova = 42170, - Base = 8453, - // L2 Testnets - ArbitrumSepolia = 421614, - ArbitrumLocal = 412346, - BaseSepolia = 84532, - // L3 Testnets - L3Local = 333333 -} +import { ChainId } from '../types/ChainId' /** The network that you reference when calling `block.number` in solidity */ type BlockNumberReferenceNetwork = { diff --git a/packages/arb-token-bridge-ui/src/util/wagmi/getWagmiChain.ts b/packages/arb-token-bridge-ui/src/util/wagmi/getWagmiChain.ts index ad75742cc3..172e185d3c 100644 --- a/packages/arb-token-bridge-ui/src/util/wagmi/getWagmiChain.ts +++ b/packages/arb-token-bridge-ui/src/util/wagmi/getWagmiChain.ts @@ -13,7 +13,8 @@ import { baseSepolia, base } from './wagmiAdditionalNetworks' -import { ChainId, getCustomChainFromLocalStorageById } from '../networks' +import { getCustomChainFromLocalStorageById } from '../networks' +import { ChainId } from '../../types/ChainId' import { orbitChains } from '../orbitChainsList' export function getWagmiChain(chainId: number): Chain { diff --git a/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts b/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts index d32c467a51..179f8ead9b 100644 --- a/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts +++ b/packages/arb-token-bridge-ui/src/util/wagmi/setup.ts @@ -17,7 +17,8 @@ import { baseSepolia } from './wagmiAdditionalNetworks' import { isTestingEnvironment } from '../CommonUtils' -import { getCustomChainsFromLocalStorage, ChainId, rpcURLs } from '../networks' +import { getCustomChainsFromLocalStorage, rpcURLs } from '../networks' +import { ChainId } from '../../types/ChainId' import { getOrbitChains } from '../orbitChainsList' import { getWagmiChain } from './getWagmiChain' import { customInfuraProvider } from '../infura' diff --git a/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts b/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts index 8c9228e5cd..0d0e867606 100644 --- a/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts +++ b/packages/arb-token-bridge-ui/src/util/wagmi/wagmiAdditionalNetworks.ts @@ -1,7 +1,8 @@ import { Chain, sepolia as sepoliaDefault } from 'wagmi' import { ether } from '../../constants' -import { ChainId, ChainWithRpcUrl, explorerUrls, rpcURLs } from '../networks' +import { ChainWithRpcUrl, explorerUrls, rpcURLs } from '../networks' +import { ChainId } from '../../types/ChainId' import { getBridgeUiConfigForChain } from '../bridgeUiConfig' import { NativeCurrencyBase } from '../../hooks/useNativeCurrency' diff --git a/packages/arb-token-bridge-ui/src/util/xErc20Utils.ts b/packages/arb-token-bridge-ui/src/util/xErc20Utils.ts index 267763edaf..203a5e1059 100644 --- a/packages/arb-token-bridge-ui/src/util/xErc20Utils.ts +++ b/packages/arb-token-bridge-ui/src/util/xErc20Utils.ts @@ -1,6 +1,6 @@ import { getProviderForChainId } from '@/token-bridge-sdk/utils' import { fetchErc20L2GatewayAddress } from './TokenUtils' -import { ChainId } from './networks' +import { ChainId } from '../types/ChainId' import { TokenWithdrawalApprovalParams } from './L2ApprovalUtils' export const xErc20Gateways: {