Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new chains for fiat onramp (#7476)
<!-- 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 3b2b83f</samp> ### Summary 🌐💵♻️ <!-- 1. 🌐 - This emoji represents the addition of more chains to the `SUPPORTED_CHAINS` array and the restructuring of the supported tokens for each on-ramp provider. It conveys the idea of expanding the buy crypto feature to more networks and currencies. 2. 💵 - This emoji represents the change in the `onFieldAInput` function call to use the `code` of the base currency. It conveys the idea of updating the input field with the appropriate default amount based on the fiat currency selected by the user. 3. ♻️ - This emoji represents the refactoring and improvement of the `FiatOnRampModal` component and the `calculateDefaultAmount` function. It conveys the idea of cleaning up and optimizing the code for better performance and readability. --> The pull request enhances the buy crypto feature by adding support for more chains and tokens, refactoring the code to use a common `supportedTokenMap` object, and improving the default amount calculation for fiat currencies. It affects the files `FiatOnRampModal.tsx`, `hooks.ts`, `constants.ts`, and `BuyCryptoForm.tsx` in the `apps/web/src` directory. > _Buy crypto feature_ > _`SUPPORTED_CHAINS` expands_ > _Winter of scaling_ ### Walkthrough * Enable buy crypto feature for more chains and tokens by adding `ChainId.ZKSYNC` and `ChainId.ARBITRUM_ONE` to `SUPPORTED_CHAINS` array and restructuring supported tokens for each on-ramp provider into separate arrays and a `supportedTokenMap` object in `constants.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7476/files?diff=unified&w=0#diff-51b519af02f51d8fd66dfd13f06ed8e1b3b6ac5373780b862109543ecd77c896L3-R45)) * Use `supportedTokenMap` object to dynamically pass the supported tokens for each chain to the `fetchMoonPaySignedUrl` and `fetchMercuryoSignedUrl` functions in `FiatOnRampModal.tsx` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7476/files?diff=unified&w=0#diff-ec1dc15e7eaff4dffe6bf7d046f9b9f4c26a27a63089eee9af39f63659bb0905L125-R122), [link](https://github.com/pancakeswap/pancake-frontend/pull/7476/files?diff=unified&w=0#diff-ec1dc15e7eaff4dffe6bf7d046f9b9f4c26a27a63089eee9af39f63659bb0905L286-R283)) * Update the `typedValue` parameter for the `replaceBuyCryptoState` action in `hooks.ts` and the `onFieldAInput` function call in `BuyCryptoForm.tsx` to use the modified `calculateDefaultAmount` function with the fiat currency code parsed from the URL or the base currency ([link](https://github.com/pancakeswap/pancake-frontend/pull/7476/files?diff=unified&w=0#diff-62400b856d722556576b04bcbb9ff801cfaf142737eec302b955b8ab04a2c1f7L314-R340), [link](https://github.com/pancakeswap/pancake-frontend/pull/7476/files?diff=unified&w=0#diff-882eb9c5537b615b2172ba5b24afa7dcb5bf9f929276f64a0f19157ace7c9c11L73-R77)) * Import `ChainId` and `Box` components from `@pancakeswap/sdk` and `@pancakeswap/uikit` packages respectively in `FiatOnRampModal.tsx` to use the `ChainId` enum for identifying different chains and the `Box` component for styling the modal ([link](https://github.com/pancakeswap/pancake-frontend/pull/7476/files?diff=unified&w=0#diff-ec1dc15e7eaff4dffe6bf7d046f9b9f4c26a27a63089eee9af39f63659bb0905L2-R5)) * Reorder and remove some unused imports in `FiatOnRampModal.tsx` to improve the readability and maintainability of the code ([link](https://github.com/pancakeswap/pancake-frontend/pull/7476/files?diff=unified&w=0#diff-ec1dc15e7eaff4dffe6bf7d046f9b9f4c26a27a63089eee9af39f63659bb0905L12-R30))
- Loading branch information
358994e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
uikit – ./packages/uikit
uikit.pancake.run
uikit-git-develop.pancake.run