Allow using only imported accounts
This commit is contained in:
@@ -89,19 +89,24 @@ const Transaction: FC<TransactionProps> = ({
|
|||||||
const account = accounts.find(
|
const account = accounts.find(
|
||||||
acc => acc.address === selectedAccount?.value
|
acc => acc.address === selectedAccount?.value
|
||||||
);
|
);
|
||||||
const TransactionType = selectedTransaction?.value;
|
if (txIsDisabled) return;
|
||||||
if (!account || !TransactionType || txIsDisabled) return;
|
|
||||||
|
|
||||||
setState({ txIsLoading: true });
|
setState({ txIsLoading: true });
|
||||||
try {
|
|
||||||
const options = prepareOptions(st);
|
|
||||||
const logPrefix = header ? `${header.split(".")[0]}: ` : undefined;
|
const logPrefix = header ? `${header.split(".")[0]}: ` : undefined;
|
||||||
|
try {
|
||||||
|
if (!account) {
|
||||||
|
throw Error("Account must be selected from imported accounts!");
|
||||||
|
}
|
||||||
|
const options = prepareOptions(st);
|
||||||
|
|
||||||
await sendTransaction(account, options, { logPrefix });
|
await sendTransaction(account, options, { logPrefix });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
state.transactionLogs.push({ type: "error", message: error.message });
|
state.transactionLogs.push({
|
||||||
|
type: "error",
|
||||||
|
message: `${logPrefix}${error.message}`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setState({ txIsLoading: false });
|
setState({ txIsLoading: false });
|
||||||
@@ -109,7 +114,6 @@ const Transaction: FC<TransactionProps> = ({
|
|||||||
viewType,
|
viewType,
|
||||||
editorValue,
|
editorValue,
|
||||||
accounts,
|
accounts,
|
||||||
selectedTransaction?.value,
|
|
||||||
txIsDisabled,
|
txIsDisabled,
|
||||||
setState,
|
setState,
|
||||||
selectedAccount?.value,
|
selectedAccount?.value,
|
||||||
|
|||||||
Reference in New Issue
Block a user