Skip to content

Commit

Permalink
Fetch AMB signatures a bit earlier (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev authored Nov 3, 2021
1 parent 1e3aa53 commit 4eba91e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion alm/src/components/ManualExecutionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
() => {
Expand Down Expand Up @@ -150,7 +151,7 @@ export const ManualExecutionButton = ({
return (
<div>
<div className="is-center">
<ActionButton className="button outline" onClick={() => setManualExecution(true)}>
<ActionButton disabled={notReady} className="button outline" onClick={() => setManualExecution(true)}>
Execute
</ActionButton>
</div>
Expand Down
17 changes: 8 additions & 9 deletions alm/src/utils/getConfirmationsForTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4eba91e

Please sign in to comment.