Fix balance check for cosmos token transfer txs #40

Merged
nabarun merged 2 commits from pj-fix-insufficient-funds-error into nym-vpn-app 2025-07-25 07:50:21 +00:00
3 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "web-wallet",
"version": "0.1.7",
"version": "0.1.7-nym-0.1.1",
"private": true,
"dependencies": {
"@cerc-io/registry-sdk": "^0.2.5",

View File

@ -4,7 +4,6 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { useAccounts } from '../context/AccountsContext';
import { useNetworks } from '../context/NetworksContext';
import useAccountsData from "../hooks/useAccountsData";
import { StackParamsList } from '../types';
import useGetOrCreateAccounts from './useGetOrCreateAccounts';
@ -15,7 +14,6 @@ export const useWebViewHandler = () => {
const navigation = useNavigation<NativeStackNavigationProp<StackParamsList>>();
const { selectedNetwork } = useNetworks();
const { accounts, currentIndex } = useAccounts();
const { getAccountsData } = useAccountsData();
const { getOrCreateAccountsForChain } = useGetOrCreateAccounts();
// Initialize accounts
@ -35,7 +33,7 @@ export const useWebViewHandler = () => {
console.error('Account operation error:', error);
window.Android?.onAccountError?.(`Operation failed: ${error}`);
}
}, [getOrCreateAccountsForChain, getAccountsData]);
}, [getOrCreateAccountsForChain]);
// Core navigation handler
const navigateToSignRequest = useCallback((message: string) => {

View File

@ -548,7 +548,7 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
if (!cosmosStargateClient) {
return;
}
if (!isSufficientFunds) {
if (!balance) {
return;
}
@ -567,13 +567,15 @@ const ApproveTransfer = ({ route }: ApproveTransferProps) => {
if (!(error instanceof Error)) {
throw error;
}
if (window.Android?.onTransferError) {
window.Android.onTransferError(`Not able to estimate gas`);
}
setTxError(error.message);
setIsTxErrorDialogOpen(true);
}
};
getCosmosGas();
}, [cosmosStargateClient, isSufficientFunds, sendMsg, transaction,txMemo]);
}, [cosmosStargateClient, balance, sendMsg, transaction, txMemo]);
useEffect(() => {
if (balance && !isSufficientFunds && !fees) {