Fix balance check for cosmos token transfer txs #40
@ -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",
|
||||
|
||||
@ -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) => {
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user