Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add support for linea testnet (#7204)
<!-- Before opening a pull request, please read the [contributing guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md) first --> <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at 58fd408</samp> ### Summary 🌐🔄🛠️ <!-- 1. 🌐 - This emoji represents the addition of new networks and chains to the app, such as Arbitrum, Polygon ZK-EVM, and zkSync. It also represents the improvement of the network switcher and the menu configuration to support different features across different chains. 2. 🔄 - This emoji represents the update of the exchange configuration, the token list, the subgraph URLs, and the router address to support the latest exchange contract and the cross-farming feature on various chains. It also represents the refactoring of the pools hook to use loading states and version-specific data. 3. 🛠️ - This emoji represents the improvement of the code quality and the error handling for various cases, such as the native currency logo, the unsupported and wrong network modals, the subgraph URL prefix, the contract address validation, and the token and constant existence checks. It also represents the linting exceptions and the type specification for the farms API. --> The pull request adds support for various L2 networks and improves the exchange feature across different EVM-compatible chains. It updates the contracts, tokens, pools, subgraphs, and nodes configuration for the new chains, and adds some checks and conditions to handle chain-specific logic and compatibility issues. It also refactors some hooks and components to use loading states and version-specific data, and fixes some minor bugs and errors. It affects files such as `v3.ts`, `config.ts`, `NetworkSwitcher.tsx`, `chains.ts`, `contracts.ts`, `endpoints.ts`, `exchange.ts`, `pancake-default.tokenlist.json`, `nodes.ts`, `pools.ts`, `useApproveCallback.ts`, `useBUSDPrice.ts`, `useCommonPools.ts`, `CurrencyLogo.tsx`, `NetworkModal.tsx`, `FloatingSubgraphHealthIndicators.tsx`, `contracts.test.ts`, `lists.ts`, `useDomain.ts`, and `useInfoUserSavedTokensAndPoolsList.ts`. > _We're sailing across the EVM seas_ > _With new chains and features to please_ > _We'll swap and farm with ease_ > _On the count of three, heave ho `pancake`!_ ### Walkthrough * Add support for new chains for the exchange, farms, and pools features ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-0e56562b1a287487ad933f04eb8867f8afbccfc461716cc24e9ddad41d614126L1-R3), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-e0daeed87867fc4fc6b0b1a9c2d52c9bfbd175cd1822e100f43300c4046484adL20-R20), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-e0daeed87867fc4fc6b0b1a9c2d52c9bfbd175cd1822e100f43300c4046484adL47-R236), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b02b946734e39568c018763a8445fe22e5633c04fa393f78eaec1947165713dL45-R49), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4L3-R15), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4L11-R40), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4L35-R138), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07R189-R196), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07R204-R211), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-7238357db46da6bb48ca41841457ac0e832ee21fb8fd76a6b3c9dbf701ce8c62R45-R46), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-7238357db46da6bb48ca41841457ac0e832ee21fb8fd76a6b3c9dbf701ce8c62L59-R70), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fL2-R25), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fL10-R39), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR46-R52), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR61-R67), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR81-R89), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-9560b1a30bda8cc12c421b07b679e4dd58b888242ad19086c9e8e38c96709edcL13-R13), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-55ee773d94e57d4fe20f6463bc02307f5d9747933c77b517fa31a90375d2af7eL62-L117), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-55ee773d94e57d4fe20f6463bc02307f5d9747933c77b517fa31a90375d2af7eL158-R157), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-55ee773d94e57d4fe20f6463bc02307f5d9747933c77b517fa31a90375d2af7eL198-R213), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-55ee773d94e57d4fe20f6463bc02307f5d9747933c77b517fa31a90375d2af7eR222-R229), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecR2), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecL20-R35), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecL39-R68), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95L9-R16), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95L17-R31), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95L24-R45), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-30f4e9bda6809aacb9da9383d87f8a61a75ccbdae15da50c832e913381e30fb0L6-R6), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-30f4e9bda6809aacb9da9383d87f8a61a75ccbdae15da50c832e913381e30fb0L171-R171), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b34b1fc6cf61851f079c808fdf2ae746784a9471f898b9cac7f8ead870489aaL50-R52), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b34b1fc6cf61851f079c808fdf2ae746784a9471f898b9cac7f8ead870489aaL60-R62), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b34b1fc6cf61851f079c808fdf2ae746784a9471f898b9cac7f8ead870489aaR262-R264), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-15ed992def68801de075c1f54a3654cdda25fb6f9bb5bc1975579cdd61995ba4L43), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-15ed992def68801de075c1f54a3654cdda25fb6f9bb5bc1975579cdd61995ba4L74-R88), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-d8d2e80f999905e1bd9986d3e969db239634d3022e41fc1471625e64ec294a54R24-R51)) * Change the type of the `zChainId` variable to use the `FarmSupportedChainId` constant from `@pancakeswap/farms` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-0e56562b1a287487ad933f04eb8867f8afbccfc461716cc24e9ddad41d614126L24-R26)) * Change the path of the native currency logo from `chains` to `native` in the `ASSET_CDN` URL ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-e4d60339c52e33653f8806738d0332de2e480bbb86597c2288be5ca62a87604fL50-R50)) * Swap the order of the conditions for rendering the `UnsupportedNetworkModal` and the `WrongNetworkModal` in the `NetworkModal` component ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-a9ce57e529d7413179d4dde396ab3cc88885ba094fab1ab62d46e7db0c1d0d2eL48-R61)) * Add a new constant `SHORT_SYMBOL` to map the chain IDs to their short symbols and use it for displaying the native currency logo with the symbol in the `NetworkSwitcher` component ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b02b946734e39568c018763a8445fe22e5633c04fa393f78eaec1947165713dR139-R152), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b02b946734e39568c018763a8445fe22e5633c04fa393f78eaec1947165713dL147-R165)) * Add a condition to check if the subgraph URL contains the `https://api.thegraph.com/subgraphs/name/` prefix before replacing it with an empty string in the `FloatingSubgraphHealthIndicators` component ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-a8f99e5f4e69d35778497b7fe5b2dfa26da8c67a2731b50f0bde548c80b4ceefL27-R32)) * Add a condition to check if the contract has a valid address for the BSC mainnet before testing for duplicates in the `contracts.test.ts` file ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-a6ef8267b83dcda4d8d9b047fa01f6adada5e581595a2612645b2a3be7937b58L7-R10)) * Remove the BSC mainnet addresses for the `nonBscVault` and `crossFarmingSender` contracts in the `contracts.ts` file ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07L163-R166)) * Change the import of the `ROUTER_ADDRESS` constant to `V2_ROUTER_ADDRESS` and use it for the approve callback hooks in the `useApproveCallback.ts` file ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-30f4e9bda6809aacb9da9383d87f8a61a75ccbdae15da50c832e913381e30fb0L6-R6), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-30f4e9bda6809aacb9da9383d87f8a61a75ccbdae15da50c832e913381e30fb0L171-R171)) * Add some conditions to check if the currency and stable coin variables are defined before using them for fetching the price in the `useBUSDPrice.ts` file ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b34b1fc6cf61851f079c808fdf2ae746784a9471f898b9cac7f8ead870489aaL50-R52), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b34b1fc6cf61851f079c808fdf2ae746784a9471f898b9cac7f8ead870489aaL60-R62), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-5b34b1fc6cf61851f079c808fdf2ae746784a9471f898b9cac7f8ead870489aaR262-R264)) * Change the logic for determining the pools data in the `commonPoolsHookCreator` hook in the `useCommonPools.ts` file ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-15ed992def68801de075c1f54a3654cdda25fb6f9bb5bc1975579cdd61995ba4L43), [link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-15ed992def68801de075c1f54a3654cdda25fb6f9bb5bc1975579cdd61995ba4L74-R88)) * Change the `chainId` argument for the `useEnsName` and `useEnsAvatar` hooks to use the Goerli chain ID if the current chain ID is Goerli in the `useDomain.ts` file ([link](https://github.com/pancakeswap/pancake-frontend/pull/7204/files?diff=unified&w=0#diff-eaf278af1e252c50795b1e1288593d10523d442f05f28a79dbfb499314889bd1L17-R22)) --------- Co-authored-by: ChefJoJo <[email protected]>
- Loading branch information