From 4eba91ef7e2d811da3e5e4cf5e0ef3cd47c3ea09 Mon Sep 17 00:00:00 2001 From: Kirill Fedoseev Date: Wed, 3 Nov 2021 19:21:35 +0300 Subject: [PATCH] Fetch AMB signatures a bit earlier (#620) --- alm/src/components/ManualExecutionButton.tsx | 3 ++- alm/src/utils/getConfirmationsForTx.ts | 17 ++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/alm/src/components/ManualExecutionButton.tsx b/alm/src/components/ManualExecutionButton.tsx index cd492e86..32492d2f 100644 --- a/alm/src/components/ManualExecutionButton.tsx +++ b/alm/src/components/ManualExecutionButton.tsx @@ -45,6 +45,7 @@ export const ManualExecutionButton = ({ const { library, activate, account, active } = useWeb3React() const [manualExecution, setManualExecution] = useState(false) const [allowFailures, setAllowFailures] = useState(false) + const notReady = !foreign.bridgeContract || !signatureCollected || !signatureCollected.length useEffect( () => { @@ -150,7 +151,7 @@ export const ManualExecutionButton = ({ return (
- setManualExecution(true)}> + setManualExecution(true)}> Execute
diff --git a/alm/src/utils/getConfirmationsForTx.ts b/alm/src/utils/getConfirmationsForTx.ts index 54374efb..a7d87354 100644 --- a/alm/src/utils/getConfirmationsForTx.ts +++ b/alm/src/utils/getConfirmationsForTx.ts @@ -86,6 +86,14 @@ export const getConfirmationsForTx = async ( setPendingConfirmations(validatorPendingConfirmations.length > 0) } else { setPendingConfirmations(false) + if (fromHome) { + // fetch collected signatures for possible manual processing + setSignatureCollected( + await Promise.all( + Array.from(Array(requiredSignatures).keys()).map(i => bridgeContract.methods.signature(hashMsg, i).call()) + ) + ) + } } const undefinedConfirmations = validatorConfirmations.filter( @@ -115,15 +123,6 @@ export const getConfirmationsForTx = async ( status: VALIDATOR_CONFIRMATION_STATUS.NOT_REQUIRED })) updateConfirmations(notRequiredConfirmations) - - if (fromHome) { - // fetch collected signatures for possible manual processing - setSignatureCollected( - await Promise.all( - Array.from(Array(requiredSignatures).keys()).map(i => bridgeContract.methods.signature(hashMsg, i).call()) - ) - ) - } } // get transactions from success signatures