-
-
Notifications
You must be signed in to change notification settings - Fork 233
Extends GasFeePoller
to update gas properties for unapproved transaction batches
#5950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…a publish batch hook
Co-authored-by: Matthew Walsh <[email protected]>
…:MetaMask/core into feat/add-batch-transaction-approval-type
…-estimate-gas-batch-transaction
…-estimate-gas-batch-transaction
…-estimate-gas-batch-transaction
…s-fee-poller-batch
GasFeePoller
to update gas properties for unapproved transactionBatches
GasFeePoller
to update gas properties for unapproved transaction batches
requireApproval: false, | ||
}, | ||
); | ||
const txMeta = { ...txBatchMeta, txParams: { ...params, from } }; |
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.
Minor, is it confusing to have this and transactionMeta
below? Maybe we call this transactionMetaForGasEstimates
?
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.
Great suggestion, done.
} | ||
|
||
log( | ||
'Found unapproved batch transactions', |
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.
Minor, transaction batches
?
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.
Done
this.#updateTransactionBatch(batch); | ||
} | ||
|
||
#updateTransactionBatch(batch: TransactionBatchMeta) { |
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.
Rather than accepting the full state which can lead to race conditions in future, could we accept a callback like we do with updateTransactionInternal
so we only update specific properties?
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.
You are right, changed this function to accept a callback.
transactionMeta: { | ||
...txBatchMeta, | ||
txParams: { | ||
...txBatchMeta.transactions?.[0], |
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.
I maybe missing the context - why we are estimating only the first transaction?
Shouldn't we estimate all nested transactions and return all gas estimates and then UI calculates them all and show as final network fee estimate?
Explanation
This PR extends the
GasFeePoller
to track/update gas properties for unapprovedtransactionBatches
.Changes
The GasFeePoller now:
transactionBatches
via#getUnapprovedTransactionBatches
.DefaultGasFeeFlow
.transaction-batch-updated
events with updatedgasFeeEstimates
.Updates are applied to the
TransactionBatchMeta
for each batch, mirroring the behaviour already in place for single transactions.This enhancement ensures that unapproved transaction batches receive timely gas updates similar to individual transactions, improving consistency across transaction types.
References
Fixes https://github.com/MetaMask/MetaMask-planning/issues/5090
Changelog
Checklist