Skip to content

Commit

Permalink
Merge pull request #47 from bnb-chain/fix/meson
Browse files Browse the repository at this point in the history
feat: Get native token balance based on selected chain
  • Loading branch information
Halibao-Lala authored Oct 24, 2024
2 parents 656c59a + 3790485 commit e267ab8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { ERC20_TOKEN } from '@/core/contract/abi';

export const useGetTokenBalance = ({ tokenAddress }: { tokenAddress: `0x${string}` }) => {
const { address } = useAccount();
const { data: nativeBalance } = useBalance({ address });
const selectedToken = useAppSelector((state) => state.transfer.selectedToken);
const fromChain = useAppSelector((state) => state.transfer.fromChain);
const { data: nativeBalance } = useBalance({ address, chainId: fromChain?.id });
const {
data: balance,
isError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export const useGetDeBridgeFees = () => {
const sendValue = useAppSelector((state) => state.transfer.sendValue);
const toChain = useAppSelector((state) => state.transfer.toChain);

const { data: nativeTokenBalance } = useBalance({ address: address as `0x${string}` });
const { data: nativeTokenBalance } = useBalance({
address: address as `0x${string}`,
chainId: fromChain?.id,
});

const { toTokenInfo } = useToTokenInfo();
const { balance } = useGetTokenBalance({
Expand Down

0 comments on commit e267ab8

Please sign in to comment.