Skip to content

Commit 610c4f2

Browse files
fix: remove duplicate gas fee tokens check (#7234)
## Explanation Remove unnecessary additional call to `checkGasFeeTokenBeforePublish`. ## References Related to [#23137](MetaMask/metamask-mobile#23137) ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs) - [x] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Removes the redundant gas fee token/balance check during approval (now only checked post-beforeSign), adds a log when skipping nonce for external signing, and updates the changelog. > > - **Transaction Controller**: > - Remove duplicate `checkGasFeeTokenBeforePublish` invocation in `#approveTransaction`; gas fee tokens/balance are now checked only in `#signTransaction` after the `beforeSign` hook. > - **Utils**: > - Add log in `utils/nonce#getNextNonce` when skipping nonce for `isExternalSign`. > - **Changelog**: > - Document fix to check balance and gas fee tokens only after before sign hook. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 38f9eca. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 9688009 commit 610c4f2

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

packages/transaction-controller/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Check balance and gas fee tokens only after before sign hook ([#7234](https://github.com/MetaMask/core/pull/7234))
13+
1014
## [62.2.0]
1115

1216
### Added

packages/transaction-controller/src/TransactionController.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,17 +3176,6 @@ export class TransactionController extends BaseController<
31763176
const { networkClientId } = transactionMeta;
31773177
const ethQuery = this.#getEthQuery({ networkClientId });
31783178

3179-
await checkGasFeeTokenBeforePublish({
3180-
ethQuery,
3181-
fetchGasFeeTokens: async (tx) =>
3182-
(await this.#getGasFeeTokens(tx)).gasFeeTokens,
3183-
transaction: transactionMeta,
3184-
updateTransaction: (txId, fn) =>
3185-
this.#updateTransactionInternal({ transactionId: txId }, fn),
3186-
});
3187-
3188-
transactionMeta = this.#getTransactionOrThrow(transactionId);
3189-
31903179
const [nonce, releaseNonce] = await getNextNonce(
31913180
transactionMeta,
31923181
(address: string) =>

packages/transaction-controller/src/utils/nonce.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export async function getNextNonce(
2727
} = txMeta;
2828

2929
if (isExternalSign) {
30+
log('Skipping nonce as signed externally');
3031
return [undefined, undefined];
3132
}
3233

0 commit comments

Comments
 (0)