(Fix) - #1775 Nonce of cancel transaction calculation (#1886)

* Fix how the nonce of the cancel transaction is calculated

* make use useState to handle nonce state

* fix to prevent "0" being treated as undefined

Co-authored-by: nicolas <nicosampler@users.noreply.github.com>
Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
This commit is contained in:
Agustin Pane 2021-02-22 07:44:20 -03:00 committed by GitHub
parent 8e52ec5f60
commit 5665d69145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -80,7 +80,12 @@ export const createTransaction = (
const safeInstance = await getGnosisSafeInstanceAt(safeAddress)
const lastTx = await getLastTx(safeAddress)
const nextNonce = await getNewTxNonce(lastTx, safeInstance)
const nonce = txNonce ? txNonce.toString() : nextNonce
let nonce = nextNonce
if (txNonce !== undefined) {
nonce = txNonce.toString()
}
const isExecution = await shouldExecuteTransaction(safeInstance, nonce, lastTx)
const safeVersion = await getCurrentSafeVersion(safeInstance)
let safeTxGas

View File

@ -89,7 +89,7 @@ export const useTransactionParameters = (props?: Props): TxParameters => {
}
const safeNonce = Number(props?.initialSafeNonce || 0)
if (!safeNonce) {
if (safeNonce === undefined) {
getSafeNonce()
}
}, [safeAddress, props?.initialSafeNonce])