Remove undefined default value for state variables

This commit is contained in:
Shreerang Kale 2024-08-01 10:48:47 +05:30
parent ce462f3ad2
commit 98755b9089
2 changed files with 13 additions and 13 deletions

View File

@ -50,9 +50,9 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
const [account, setAccount] = useState<Account>();
const [cosmosStargateClient, setCosmosStargateClient] =
useState<LaconicClient>();
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>();
const [fees, setFees] = useState<string>();
const [txError, setTxError] = useState<string>();
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
const [fees, setFees] = useState<string>('');
const [txError, setTxError] = useState<string>('');
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
const [isRequestAccepted, setIsRequestAccepted] = useState(false);
@ -197,11 +197,11 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
// This amount is total fees required for transaction
amount: [
{
amount: fees!,
amount: fees,
denom: requestedNetwork!.nativeDenom!,
},
],
gas: cosmosGasLimit!,
gas: cosmosGasLimit,
},
txMsg: transactionMessage,
};
@ -299,7 +299,7 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
</>
</ScrollView>
<TxErrorDialog
error={txError!}
error={txError}
visible={isTxErrorDialogOpen}
hideDialog={async () => {
setIsTxErrorDialogOpen(false);

View File

@ -70,9 +70,9 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
const [isTxLoading, setIsTxLoading] = useState(false);
const [cosmosStargateClient, setCosmosStargateClient] =
useState<SigningStargateClient>();
const [fees, setFees] = useState<string>();
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>();
const [txError, setTxError] = useState<string>();
const [fees, setFees] = useState<string>('');
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
const [txError, setTxError] = useState<string>('');
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
const [ethGasPrice, setEthGasPrice] = useState<BigNumber | null>();
const [ethGasLimit, setEthGasLimit] = useState<BigNumber>();
@ -212,7 +212,7 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
// If requested chain is EVM compatible, set loading to false when ethMaxFee and ethPriorityFee have been populated
(ethMaxFee !== undefined && ethMaxPriorityFee !== undefined) ||
// Or if requested chain is a cosmos chain, set loading to false when cosmosGasLimit has been populated
cosmosGasLimit !== undefined
!cosmosGasLimit
) {
setIsLoading(false);
}
@ -311,11 +311,11 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
// This amount is total fees required for transaction
amount: [
{
amount: fees!,
amount: fees,
denom: requestedNetwork!.nativeDenom!,
},
],
gas: cosmosGasLimit!,
gas: cosmosGasLimit,
},
sendMsg,
memo: MEMO,
@ -655,7 +655,7 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
</>
)}
<TxErrorDialog
error={txError!}
error={txError}
visible={isTxErrorDialogOpen}
hideDialog={() => {
setIsTxErrorDialogOpen(false);