Skip to content

Commit

Permalink
return 0 if feeAsset doesn't match sourceAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
toddkao committed Sep 19, 2024
1 parent 1d96604 commit 8b21f3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/widget-v2/src/pages/SwapPage/useSetMaxAmount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export const useGasFeeTokenAmount = () => {
chainId: sourceAsset?.chainID,
});


const feeAsset = chains?.find(chain => chain.chainID === sourceAsset?.chainID)?.feeAssets?.[0];

const chainType = sourceDetails?.chain?.chainType;

switch (chainType) {
case "evm":
return Number(convertHumanReadableAmountToCryptoAmount(ETH_GAS_FEE));
case "cosmos":
if (!feeAsset?.gasPrice?.average) return 0;
if (!feeAsset?.gasPrice?.average || feeAsset.denom !== sourceAsset?.denom) return 0;
return Number(feeAsset.gasPrice.average) * (COSMOS_GAS_FEE);
case "svm":
default:
Expand Down

0 comments on commit 8b21f3c

Please sign in to comment.