This repository was archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 360
Fix: use estimations v2 endpoint for tx nonce #3201
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d5b2f09
chore: Update safe-react-gateway-sdk dependency
893caee
build: Use the new estimation endpoint v2 to calculate the next txNonce
257b5d6
fix: Update the cgw sdk version and method calls
87663bc
build: Use a cancel tx to fetch only the recommended nonce
b404fba
Add try catch in case backend request fails
f7bb237
Replace getting next Tx nonce from the store by the tx estimation call
1f50be2
Merge branch 'main' into use-estimations-v2-endpoint-for-tx-nonce
katspaugh 70b1db1
Merge branch 'dev' into use-estimations-v2-endpoint-for-tx-nonce
katspaugh a34ad9e
Merge branch 'dev' of github.com:gnosis/safe-react into use-estimatio…
katspaugh 5e468fe
fix: remove unused imports
6e983ee
fix: remove v1 form the GATEWAY_URL
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ import { providerSelector } from 'src/logic/wallets/store/selectors' | |
| import enqueueSnackbar from 'src/logic/notifications/store/actions/enqueueSnackbar' | ||
| import closeSnackbarAction from 'src/logic/notifications/store/actions/closeSnackbar' | ||
| import { generateSafeTxHash } from 'src/logic/safe/store/actions/transactions/utils/transactionHelpers' | ||
| import { getNewTxNonce, shouldExecuteTransaction } from 'src/logic/safe/store/actions/utils' | ||
| import { shouldExecuteTransaction } from 'src/logic/safe/store/actions/utils' | ||
| import fetchTransactions from './transactions/fetchTransactions' | ||
| import { TxArgs } from 'src/logic/safe/store/models/types/transaction' | ||
| import { PayableTx } from 'src/types/contracts/types.d' | ||
|
|
@@ -35,7 +35,8 @@ import { extractShortChainName, history, SAFE_ROUTES } from 'src/routes/routes' | |
| import { getPrefixedSafeAddressSlug, SAFE_ADDRESS_SLUG, TRANSACTION_ID_SLUG } from 'src/routes/routes' | ||
| import { generatePath } from 'react-router-dom' | ||
| import { getContractErrorMessage } from 'src/logic/contracts/safeContractErrors' | ||
| import { getLastTransaction, getLastTxNonce } from '../selectors/gatewayTransactions' | ||
| import { getLastTransaction } from '../selectors/gatewayTransactions' | ||
| import { getRecommendedNonce } from '../../api/fetchSafeTxGasEstimation' | ||
| import { isMultiSigExecutionDetails, LocalTransactionStatus } from '../models/types/gateway.d' | ||
| import { updateTransactionStatus } from './updateTransactionStatus' | ||
|
|
||
|
|
@@ -108,9 +109,13 @@ export const createTransaction = | |
| const chainId = currentChainId(state) | ||
|
|
||
| const lastTx = getLastTransaction(state) | ||
| const lastTxNonce = getLastTxNonce(state) | ||
|
|
||
| const nextNonce = await getNewTxNonce(lastTxNonce, safeInstance) | ||
| let nextNonce: string | ||
| try { | ||
| nextNonce = (await getRecommendedNonce(safeAddress)).toString() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's already a |
||
| } catch (e) { | ||
| logError(Errors._616, e.message) | ||
| nextNonce = await safeInstance.methods.nonce().call() | ||
| } | ||
| const nonce = txNonce !== undefined ? txNonce.toString() : nextNonce | ||
|
|
||
| const isExecution = !delayExecution && (await shouldExecuteTransaction(safeInstance, nonce, lastTx)) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In future, we should make just one request – to fetch the actual safeTxGas and the nonce. They are displayed on the same Review screen.