Skip to content

Commit d47df96

Browse files
authored
fix: fix transfer gas bug (#2298)
1 parent 6289f04 commit d47df96

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/namadillo/src/hooks/useTransactionFee/useTransactionFee.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const useTransactionFee = (
5252
tokenPricesFamily(gasPriceTable?.map((item) => item.token.address) ?? [])
5353
).data ?? {};
5454

55-
const averageGasLimit = gasEstimate && BigNumber(gasEstimate.avg);
55+
const averageGasLimit = gasEstimate ? BigNumber(gasEstimate.avg) : undefined;
5656
const gasLimit = gasLimitValue ?? averageGasLimit ?? BigNumber(0);
5757

5858
const availableGasTokenAddress = useMemo(() => {
@@ -74,10 +74,12 @@ export const useTransactionFee = (
7474
minDenomAmount: BigNumber(balance.minDenomAmount),
7575
token: balance.address,
7676
}))
77-
: userTransparentBalances.data?.map((balance) => ({
78-
minDenomAmount: BigNumber(balance.minDenomAmount),
79-
token: balance.token.address,
80-
}))) || [];
77+
: userTransparentBalances.data
78+
?.map((balance) => ({
79+
minDenomAmount: BigNumber(balance.minDenomAmount),
80+
token: balance.token?.address,
81+
}))
82+
.filter((balance) => balance.token)) || [];
8183

8284
// Check if user has enough NAM to pay fees
8385
const nativeAddressBalance = balances.find(

0 commit comments

Comments
 (0)