From ea563ec89f5beb071f4b9d3231f9fb42999738bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trung=20B=E1=BA=A1ch?= <66735837+trungbach@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:08:56 +0700 Subject: [PATCH] Feat/vite react (#1002) * initial commit * initial commit * fix code * fix svg * ignore dist * fix http * chore: remove vitest * chore: udpate indexer url * chore: add build script * chore: update ourdir * chore: add cmd serve build file * fix: fixed error load build file * chore: remove redundant code * chore: remove redundant code * fix: import missed token * fix: import missed token * chore: update svg * fix: add bbase url for all relative url in document --------- Co-authored-by: Pham Tu --- .env.example | 12 +- .github/workflows/legacy.yml | 2 +- .github/workflows/mainnet.yml | 2 +- .github/workflows/pre-mainnet.yml | 2 +- .github/workflows/staging-v2.yml | 2 +- .github/workflows/staging.yml | 2 +- .github/workflows/test-optimize-cicd.yml | 2 +- .gitignore | 1 + .husky/pre-push | 3 +- codegen.ts | 2 +- public/index.html => index.html | 23 +- package.json | 28 +- patches/@cosmjs+tendermint-rpc+0.31.3.patch | 39 +- scripts/vendor.js | 144 - setupTest.ts | 1 + src/components/BlocLoaderDex/index.tsx | 2 +- src/components/ConfirmModal/index.tsx | 4 +- src/components/Loader.tsx | 2 +- src/components/LuckyDraw/index.tsx | 2 +- src/components/Modal.tsx | 2 +- src/components/ModalCustom/index.tsx | 2 +- .../ModalDownloadOwallet.tsx | 18 +- .../Modals/SettingTooltip/index.tsx | 2 +- src/components/Modals/SlippageModal/index.tsx | 4 +- src/components/PowerByOBridge/index.tsx | 4 +- src/components/Table/Table.tsx | 4 +- src/components/Toasts/Toast.tsx | 10 +- src/components/Tooltip.tsx | 2 +- .../WalletManagement/Connected/index.tsx | 2 +- .../ConnectedMobile/ConnectedMobile.tsx | 4 +- .../DiconnectButton/index.tsx | 2 +- .../ModalChooseWallet/ModalChooseWallet.tsx | 2 +- .../WalletByNetwork/WalletByNetwork.tsx | 2 +- .../ModalDisconnect/ModalDisconnect.tsx | 7 +- .../WalletManagement/MyWallet/MyWallet.tsx | 10 +- .../MyWalletMobile/MyWalletMobile.tsx | 8 +- .../WalletManagement/walletConfig.ts | 8 +- src/config/alphaNetwwork.ts | 12 +- src/config/chainInfos.ts | 9 +- src/config/eventConfig.tsx | 8 +- src/config/iconInfos.ts | 60 +- src/helper/index.tsx | 2 +- src/index.tsx | 6 +- src/layouts/BuyOraiModal.tsx | 2 +- src/layouts/Menu.tsx | 41 +- src/layouts/NoticeBanner.tsx | 4 +- src/layouts/Sidebar.tsx | 22 +- src/libs/duckdb.ts | 5 +- src/libs/eip191.ts | 13 +- src/pages/Balance/DepositBtcModal/index.tsx | 10 +- src/pages/Balance/DepositBtcModalV2/index.tsx | 10 +- .../StuckOraib/TooltipBridgeToken/index.tsx | 2 +- src/pages/Balance/StuckOraib/index.tsx | 2 +- src/pages/Balance/TokenItem/TokenItemBtc.tsx | 4 +- .../Balance/TransferConvertToken/index.tsx | 6 +- src/pages/Balance/index.tsx | 8 +- .../components/Checkpoint/Checkpoint.tsx | 2 +- .../Transactions/TransactionInput.tsx | 8 +- .../Transactions/TransactionOutput.tsx | 8 +- .../components/Header/Header.tsx | 2 +- .../PendingDeposits/PendingDeposits.tsx | 10 +- .../PendingWithdraws/PendingWithdraws.tsx | 8 +- .../components/Checkpoint/Checkpoint.tsx | 2 +- .../Transactions/TransactionInput.tsx | 8 +- .../Transactions/TransactionOutput.tsx | 8 +- .../components/ConvertBitcoinV2/index.tsx | 2 +- .../components/Header/Header.tsx | 2 +- .../PendingDeposits/PendingDeposits.tsx | 10 +- .../PendingWithdraws/PendingWithdraws.tsx | 8 +- .../CoHarvest/components/AllBidding/index.tsx | 4 +- .../CoHarvest/components/Banner/index.tsx | 4 +- .../CoHarvest/components/Bidding/index.tsx | 8 +- .../components/ExplainReturnModal/index.tsx | 6 +- .../components/HarvestInfo/index.tsx | 4 +- .../components/ListHistory/index.tsx | 14 +- .../CoHarvest/components/MyBidding/index.tsx | 16 +- .../CoHarvest/components/Tooltip/index.tsx | 2 +- .../components/BannerNoticePool/index.tsx | 8 +- .../components/CreateNewPool/index.tsx | 8 +- .../components/CreateNewPosition/index.tsx | 2 +- .../components/CreatePoolForm/index.tsx | 2 +- .../components/CreatePositionForm/index.tsx | 14 +- .../components/ManuallyAddLiquidity/index.tsx | 2 +- .../components/NewPositionNoPool/index.tsx | 6 +- .../Pool-V3/components/PoolDetail/index.tsx | 14 +- .../PoolList/PoolItemDataMobile.tsx | 8 +- .../components/PoolList/PoolItemTData.tsx | 6 +- .../Pool-V3/components/PoolList/index.tsx | 25 +- .../Pool-V3/components/PositionItem/index.tsx | 15 +- .../Pool-V3/components/PositionList/index.tsx | 4 +- .../Pool-V3/components/SelectToken/index.tsx | 8 +- .../components/SettingSlippage/index.tsx | 2 +- .../Pool-V3/components/TokenForm/index.tsx | 2 +- .../components/TransactionHistory/index.tsx | 8 +- .../Pool-V3/components/ZapInTab/index.tsx | 8 +- src/pages/Pool-V3/components/ZapOut/index.tsx | 5 +- .../Pool-V3/components/ZapOutForm/index.tsx | 8 +- src/pages/Pool-V3/helpers/format.tsx | 6 +- src/pages/Pool-V3/hooks/useGetPoolV2Data.ts | 1 - src/pages/Pool-V3/index.tsx | 6 +- src/pages/Pools/NewPoolModal/NewPoolModal.tsx | 10 +- .../Pools/NewTokenModal/ItemsComponent.tsx | 4 +- .../Pools/NewTokenModal/ModalComponent.tsx | 6 +- .../Pools/NewTokenModal/NewTokenModal.tsx | 6 +- src/pages/Pools/PoolDetail.tsx | 6 +- .../AddLiquidityModal/AddLiquidityModal.tsx | 3 +- .../Pools/components/Earning/Earning.tsx | 6 +- .../ItemPoolMobile/ItemPoolMobile.tsx | 4 +- .../Pools/components/ListPool/ListPool.tsx | 4 +- .../ListPoolMobile/ListPoolMobile.tsx | 4 +- .../components/ModalChartDetail/index.tsx | 2 +- .../components/MyPoolInfo/MyPoolInfo.tsx | 18 +- .../components/OverviewPool/OverviewPool.tsx | 6 +- .../SlippageModal/SlippageModal.tsx | 6 +- .../components/StakeLPModal/StakeLPModal.tsx | 2 +- .../components/TransactionHistory/index.tsx | 8 +- .../UnstakeLPModal/UnstakeLPModal.tsx | 2 +- .../WithdrawLiquidityModal.tsx | 2 +- src/pages/Pools/index.tsx | 2 +- .../Staking/components/Collapse/index.tsx | 4 +- .../components/CompoundModal/index.tsx | 12 +- .../Staking/components/InputBalance/index.tsx | 4 +- .../Staking/components/StakeInfo/index.tsx | 6 +- .../Staking/components/Summary/index.tsx | 4 +- .../Staking/components/Tooltip/index.tsx | 2 +- .../Staking/components/UnStakeTab/index.tsx | 8 +- .../UniversalSwap/Component/HeaderTab.tsx | 23 +- src/pages/UniversalSwap/Component/Routing.tsx | 3 - .../Component/SwapWarningModal/index.tsx | 2 +- src/pages/UniversalSwap/Component/TabsTxs.tsx | 6 +- .../Modals/SettingTooltip/index.tsx | 2 +- .../UniversalSwap/Modals/SlippageModal.tsx | 6 +- .../UniversalSwap/Modals/SmartRouteModal.tsx | 2 +- .../Swap/components/AddressBook/index.tsx | 10 +- .../Swap/components/AddressForm/index.tsx | 8 +- .../Swap/components/InputCommon/index.tsx | 4 +- .../components/SelectChain/SelectChain.tsx | 19 +- .../Swap/components/SelectInput/index.tsx | 8 +- .../components/SelectToken/SelectToken.tsx | 6 +- .../Swap/components/SwapDetail/index.tsx | 4 +- src/pages/UniversalSwap/Swap/index.tsx | 18 +- src/pages/UniversalSwap/helpers.ts | 2 +- src/polyfill.ts | 9 +- src/react-app-env.d.ts | 1 - src/rest/request.ts | 2 +- src/tests/bridge-contract.spec.ts | 5 +- src/tests/common.ts | 2 +- src/tests/helper.spec.ts | 13 +- src/tests/universal-swap.spec.ts | 2 +- src/types/global.d.ts | 4 +- tsconfig.json | 21 +- vite-env.d.ts | 2 + vite.config.ts | 41 + yarn.lock | 7978 +++-------------- 154 files changed, 1851 insertions(+), 7391 deletions(-) rename public/index.html => index.html (76%) delete mode 100644 scripts/vendor.js create mode 100644 setupTest.ts delete mode 100644 src/react-app-env.d.ts create mode 100644 vite-env.d.ts create mode 100644 vite.config.ts diff --git a/.env.example b/.env.example index 7f4aabf01..6845d41d3 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,9 @@ PUBLIC_URL=https://app.oraidex.io -REACT_APP_SITE_TITLE=OraiDEX -REACT_APP_SITE_DESC="OraiDEX is an IBC and CosmWasm-based decentralized exchange platform with multichain interoperability, optimal speed, and a lot of liquidity options for users." +VITE_APP_SITE_TITLE=OraiDEX +VITE_APP_SITE_DESC="OraiDEX is an IBC and CosmWasm-based decentralized exchange platform with multichain interoperability, optimal speed, and a lot of liquidity options for users." -REACT_APP_BASE_API_URL=https://api.oraidex.io +VITE_APP_BASE_API_URL=https://api.oraidex.io -REACT_APP_KADO_API_KEY=df0d2b3f-d829-4453-a4f6-1d6e8870e8f4 -REACT_APP_MIX_PANEL_ENVIRONMENT=acbafd21a85654933cbb0332c5a6f4f8 -REACT_APP_STRAPI_BASE_URL=https://nice-fireworks-d26703b63e.strapiapp.com \ No newline at end of file +VITE_APP_KADO_API_KEY=df0d2b3f-d829-4453-a4f6-1d6e8870e8f4 +VITE_APP_MIX_PANEL_ENVIRONMENT=acbafd21a85654933cbb0332c5a6f4f8 +VITE_APP_STRAPI_BASE_URL=https://nice-fireworks-d26703b63e.strapiapp.com \ No newline at end of file diff --git a/.github/workflows/legacy.yml b/.github/workflows/legacy.yml index ddd2f4649..e75966070 100644 --- a/.github/workflows/legacy.yml +++ b/.github/workflows/legacy.yml @@ -38,7 +38,7 @@ jobs: cp .env.example .env yarn build env: - REACT_APP_SENTRY_ENVIRONMENT: staging + VITE_APP_SENTRY_ENVIRONMENT: staging CI: false - name: Deploy to firebase run: yarn firebase deploy --only hosting:oraiswap-legacy --token ${{ secrets.FIREBASE_TOKEN }} -m '${{ github.event.head_commit.message }}' diff --git a/.github/workflows/mainnet.yml b/.github/workflows/mainnet.yml index eea624881..7cf18e582 100644 --- a/.github/workflows/mainnet.yml +++ b/.github/workflows/mainnet.yml @@ -61,7 +61,7 @@ jobs: run: yarn build env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - REACT_APP_SENTRY_ENVIRONMENT: production + VITE_APP_SENTRY_ENVIRONMENT: production CI: false - name: Deploy to firebase run: yarn firebase deploy --only hosting:oraiswap --token ${{ secrets.FIREBASE_TOKEN }} diff --git a/.github/workflows/pre-mainnet.yml b/.github/workflows/pre-mainnet.yml index 2a5bac4e6..29c5a1c79 100644 --- a/.github/workflows/pre-mainnet.yml +++ b/.github/workflows/pre-mainnet.yml @@ -38,7 +38,7 @@ jobs: cp .env.example .env yarn build env: - REACT_APP_SENTRY_ENVIRONMENT: staging + VITE_APP_SENTRY_ENVIRONMENT: staging CI: false - name: Deploy to firebase run: yarn firebase deploy --only hosting:oraiswap-pre-mainnet --token ${{ secrets.FIREBASE_TOKEN }} -m '${{ github.event.head_commit.message }}' diff --git a/.github/workflows/staging-v2.yml b/.github/workflows/staging-v2.yml index 111e81369..f4d4851b3 100644 --- a/.github/workflows/staging-v2.yml +++ b/.github/workflows/staging-v2.yml @@ -38,7 +38,7 @@ jobs: cp .env.example .env yarn build env: - REACT_APP_SENTRY_ENVIRONMENT: staging + VITE_APP_SENTRY_ENVIRONMENT: staging CI: false - name: Deploy to firebase run: yarn firebase deploy --only hosting:oraiswap-staging-v1 --token ${{ secrets.FIREBASE_TOKEN }} -m '${{ github.event.head_commit.message }}' diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index dc1ed09fd..99111f808 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -39,7 +39,7 @@ jobs: rm -rf node_modules/.cache yarn build env: - REACT_APP_SENTRY_ENVIRONMENT: staging + VITE_APP_SENTRY_ENVIRONMENT: staging CI: false - name: Deploy to firebase run: yarn firebase deploy --only hosting:oraiswap-staging --token ${{ secrets.FIREBASE_TOKEN }} -m '${{ github.event.head_commit.message }}' diff --git a/.github/workflows/test-optimize-cicd.yml b/.github/workflows/test-optimize-cicd.yml index 8d568330d..425445ca7 100644 --- a/.github/workflows/test-optimize-cicd.yml +++ b/.github/workflows/test-optimize-cicd.yml @@ -57,5 +57,5 @@ jobs: run: yarn build env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - REACT_APP_SENTRY_ENVIRONMENT: production + VITE_APP_SENTRY_ENVIRONMENT: production CI: false diff --git a/.gitignore b/.gitignore index e019a1c51..bdde6f93a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ # vendor vendor +dist/ public/vendor.* # misc diff --git a/.husky/pre-push b/.husky/pre-push index 0d87e8f26..618c2bfbc 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,5 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn test:ci -yarn ts-check + diff --git a/codegen.ts b/codegen.ts index e5b83fef7..d5d56a8ea 100644 --- a/codegen.ts +++ b/codegen.ts @@ -1,7 +1,7 @@ import { CodegenConfig } from '@graphql-codegen/cli'; // https://subql-staging.orai.io/ -export const endpoint_gql = `https//staging-ammv3-indexer.oraidex.io/`; +export const endpoint_gql = `https//ammv3-indexer.oraidex.io/`; const config: CodegenConfig = { schema: endpoint_gql, documents: ['src/**/*.tsx'], diff --git a/public/index.html b/index.html similarity index 76% rename from public/index.html rename to index.html index b20667cea..e6b1cc0a6 100644 --- a/public/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + - %REACT_APP_SITE_TITLE% + %VITE_APP_SITE_TITLE% + + + - + - - + + - - - + + +
- +