From 79d800c21941ddb9dea28443292d9b7511d557c7 Mon Sep 17 00:00:00 2001 From: Ted Ian Osias Date: Thu, 26 Sep 2024 23:16:05 +0800 Subject: [PATCH] chore: deliver chainId via flags --- components/Bridge/NEVMStepWrapepr.tsx | 5 +++-- .../Steps/ConnectValidate/StartTransferButton.tsx | 3 ++- components/Bridge/UTXOStepWrapper.tsx | 4 +++- components/Bridge/hooks/useFeatureFlags.ts | 2 ++ contexts/ConnectedWallet/NEVMProvider.tsx | 2 -- contexts/PaliWallet/V2Provider.tsx | 10 +++++----- pages/_app.tsx | 4 +--- pages/api/flags.ts | 6 +++++- pages/bridge/[id].tsx | 4 +--- 9 files changed, 22 insertions(+), 18 deletions(-) diff --git a/components/Bridge/NEVMStepWrapepr.tsx b/components/Bridge/NEVMStepWrapepr.tsx index 121b398..4ac02be 100644 --- a/components/Bridge/NEVMStepWrapepr.tsx +++ b/components/Bridge/NEVMStepWrapepr.tsx @@ -1,8 +1,8 @@ -import { CHAIN_ID } from "@constants"; import { useNEVM } from "@contexts/ConnectedWallet/NEVMProvider"; import { usePaliWalletV2 } from "@contexts/PaliWallet/usePaliWallet"; import { Button } from "@mui/material"; import { isValidEthereumAddress } from "@pollum-io/sysweb3-utils"; +import { useFeatureFlags } from "./hooks/useFeatureFlags"; type Props = { children: React.ReactNode; @@ -11,6 +11,7 @@ type Props = { const NEVMStepWrapper: React.FC = ({ children }) => { const { version, isBitcoinBased, switchTo, isEVMInjected, connectWallet } = usePaliWalletV2(); + const { chainId: expectedChainId } = useFeatureFlags(); const { connect, account, chainId, switchToMainnet } = useNEVM(); @@ -34,7 +35,7 @@ const NEVMStepWrapper: React.FC = ({ children }) => { ); } - if (chainId !== `0x${Number(CHAIN_ID).toString(16)}`) { + if (chainId !== `0x${Number(expectedChainId).toString(16)}`) { return (