Disable no button after tx is approved

This commit is contained in:
Isha 2024-11-08 10:34:47 +05:30
parent 08711b50d6
commit 6ac15085ff

View File

@ -1,5 +1,4 @@
import React, { useEffect, useState, useCallback, useRef } from 'react'; import React, { useEffect, useState, useCallback, useRef } from 'react';
import { ScrollView, View } from 'react-native'; import { ScrollView, View } from 'react-native';
import { import {
Button, Button,
@ -153,10 +152,6 @@ export const WalletEmbed = () => {
network!.nativeDenom!.toLowerCase(), network!.nativeDenom!.toLowerCase(),
); );
const gasPrice = GasPrice.fromString(
network.gasPrice! + network.nativeDenom,
);
const sendMsg = { const sendMsg = {
typeUrl: '/cosmos.bank.v1beta1.MsgSend', typeUrl: '/cosmos.bank.v1beta1.MsgSend',
value: { value: {
@ -171,20 +166,15 @@ export const WalletEmbed = () => {
}, },
}; };
const gasEstimation = await client.simulate( const gasEstimation = await client.simulate(fromAddress, [sendMsg], MEMO);
fromAddress,
[sendMsg],
MEMO,
);
const gasLimit = const gasLimit =
String( String(
Math.round(gasEstimation * Number(process.env.REACT_APP_GAS_ADJUSTMENT)), Math.round(gasEstimation * Number(process.env.REACT_APP_GAS_ADJUSTMENT)),
) )
const cosmosFees = calculateFee(Number(gasLimit), gasPrice);
setGasLimit(gasLimit); setGasLimit(gasLimit);
const gasPrice = GasPrice.fromString(network.gasPrice! + network.nativeDenom);
const cosmosFees = calculateFee(Number(gasLimit), gasPrice);
setFees(cosmosFees.amount[0].amount); setFees(cosmosFees.amount[0].amount);
setTransactionDetails({ setTransactionDetails({
@ -319,13 +309,13 @@ export const WalletEmbed = () => {
mode="contained" mode="contained"
onPress={rejectRequestHandler} onPress={rejectRequestHandler}
buttonColor="#B82B0D" buttonColor="#B82B0D"
disabled={isTxLoading}
> >
No No
</Button> </Button>
</View> </View>
</> </>
) : null} ) : null}
<TxErrorDialog <TxErrorDialog
error={txError!} error={txError!}
visible={!!txError} visible={!!txError}