Skip to content

Commit

Permalink
fix: minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
teebszet authored and m-aboelenein committed Dec 22, 2023
1 parent 17d2819 commit 3e83755
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/app/screens/transactionRequest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ContractCallPayload, ContractDeployPayload } from '@stacks/connect';
import { StacksTransaction } from '@stacks/transactions';
import { getNetworkType, isHardwareAccount } from '@utils/helper';
import { useEffect, useState } from 'react';
import toast from 'react-hot-toast';
import { useNavigate } from 'react-router-dom';
import { MoonLoader } from 'react-spinners';
import styled from 'styled-components';
Expand Down Expand Up @@ -134,21 +135,24 @@ function TransactionRequest() {
});
}
};

const createRequestTx = async () => {
try {
if (!payload.txHex) {
if (payload.txType === 'token_transfer') {
await handleTokenTransferRequest(payload);
} else if (payload.txType === 'contract_call') {
await handleContractCallRequest(payload);
} else if (payload.txType === 'smart_contract') {
await handleContractDeployRequest(payload);
} else {
await handleTxSigningRequest();
}
} else {
await handleTxSigningRequest();
}
}

} catch (e: unknown) {
console.error(e); // eslint-disable-line
toast.error('Unexpected error creating transaction');
}
};

createRequestTx();

Expand Down

0 comments on commit 3e83755

Please sign in to comment.