@metamask-previews/transaction-controller 62.5.0-preview-aabe1c65 → 62.5.0-preview-c92c27f1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/TransactionController.cjs +24 -0
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +22 -1
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +22 -1
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +25 -1
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +6 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +6 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +4 -0
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +3 -2
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.mjs +3 -2
- package/dist/utils/batch.mjs.map +1 -1
- package/dist/utils/gas.cjs +68 -8
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.d.cts +15 -2
- package/dist/utils/gas.d.cts.map +1 -1
- package/dist/utils/gas.d.mts +15 -2
- package/dist/utils/gas.d.mts.map +1 -1
- package/dist/utils/gas.mjs +67 -8
- package/dist/utils/gas.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- Add `estimateGasBatch` function and messenger action to estimate gas for batch transactions ([#7405](https://github.com/MetaMask/core/pull/7405))
|
|
13
|
+
- Add optional `gasLimit7702` property to `TransactionBatchRequest`.
|
|
12
14
|
- Automatically fail pending transactions if no receipt and hash not recognised by network after multiple attempts ([#7329](https://github.com/MetaMask/core/pull/7329))
|
|
13
15
|
- Add optional `isTimeoutEnabled` callback to disable for specific transactions.
|
|
14
16
|
- Ignores transactions with future nonce.
|
|
@@ -657,6 +657,29 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
657
657
|
});
|
|
658
658
|
return { gas: estimatedGas, simulationFails };
|
|
659
659
|
}
|
|
660
|
+
/**
|
|
661
|
+
* Estimates required gas for a batch of transactions.
|
|
662
|
+
*
|
|
663
|
+
* @param request - Request object.
|
|
664
|
+
* @param request.chainId - Chain ID of the transactions.
|
|
665
|
+
* @param request.from - Address of the sender.
|
|
666
|
+
* @param request.transactions - Array of transactions within a batch request.
|
|
667
|
+
* @returns Object containing the gas limit.
|
|
668
|
+
*/
|
|
669
|
+
async estimateGasBatch({ chainId, from, transactions, }) {
|
|
670
|
+
const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
|
|
671
|
+
chainId,
|
|
672
|
+
});
|
|
673
|
+
return (0, gas_1.estimateGasBatch)({
|
|
674
|
+
chainId,
|
|
675
|
+
ethQuery,
|
|
676
|
+
from,
|
|
677
|
+
getSimulationConfig: __classPrivateFieldGet(this, _TransactionController_getSimulationConfig, "f"),
|
|
678
|
+
isAtomicBatchSupported: this.isAtomicBatchSupported.bind(this),
|
|
679
|
+
messenger: this.messenger,
|
|
680
|
+
transactions,
|
|
681
|
+
});
|
|
682
|
+
}
|
|
660
683
|
/**
|
|
661
684
|
* Estimates required gas for a given transaction and add additional gas buffer with the given multiplier.
|
|
662
685
|
*
|
|
@@ -2336,6 +2359,7 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
2336
2359
|
this.messenger.registerActionHandler(`${controllerName}:emulateNewTransaction`, this.emulateNewTransaction.bind(this));
|
|
2337
2360
|
this.messenger.registerActionHandler(`${controllerName}:emulateTransactionUpdate`, this.emulateTransactionUpdate.bind(this));
|
|
2338
2361
|
this.messenger.registerActionHandler(`${controllerName}:estimateGas`, this.estimateGas.bind(this));
|
|
2362
|
+
this.messenger.registerActionHandler(`${controllerName}:estimateGasBatch`, this.estimateGasBatch.bind(this));
|
|
2339
2363
|
this.messenger.registerActionHandler(`${controllerName}:getGasFeeTokens`, __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGasFeeTokensAction).bind(this));
|
|
2340
2364
|
this.messenger.registerActionHandler(`${controllerName}:getNonceLock`, this.getNonceLock.bind(this));
|
|
2341
2365
|
this.messenger.registerActionHandler(`${controllerName}:getTransactions`, this.getTransactions.bind(this));
|