@metamask-previews/transaction-controller 52.0.0-preview-5a3453d → 52.0.0-preview-e3c959f
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 -3
- package/dist/TransactionController.cjs +15 -15
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +15 -15
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.cjs +3 -1
- package/dist/gas-flows/DefaultGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +3 -1
- package/dist/gas-flows/DefaultGasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.cjs +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.cts +1 -5
- package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.mts +1 -5
- package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.mjs +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts +1 -5
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +1 -5
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts +1 -5
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +1 -5
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts +1 -5
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +1 -5
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.cjs +1 -1
- package/dist/gas-flows/TestGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.d.cts +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.d.mts +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -1
- package/dist/helpers/GasFeePoller.cjs +4 -9
- package/dist/helpers/GasFeePoller.cjs.map +1 -1
- package/dist/helpers/GasFeePoller.d.cts +1 -4
- package/dist/helpers/GasFeePoller.d.cts.map +1 -1
- package/dist/helpers/GasFeePoller.d.mts +1 -4
- package/dist/helpers/GasFeePoller.d.mts.map +1 -1
- package/dist/helpers/GasFeePoller.mjs +4 -9
- package/dist/helpers/GasFeePoller.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -15
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +3 -15
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/feature-flags.cjs +3 -16
- package/dist/utils/feature-flags.cjs.map +1 -1
- package/dist/utils/feature-flags.d.cts +2 -12
- package/dist/utils/feature-flags.d.cts.map +1 -1
- package/dist/utils/feature-flags.d.mts +2 -12
- package/dist/utils/feature-flags.d.mts.map +1 -1
- package/dist/utils/feature-flags.mjs +2 -14
- package/dist/utils/feature-flags.mjs.map +1 -1
- package/dist/utils/gas-fees.cjs +3 -21
- package/dist/utils/gas-fees.cjs.map +1 -1
- package/dist/utils/gas-fees.d.cts +0 -14
- package/dist/utils/gas-fees.d.cts.map +1 -1
- package/dist/utils/gas-fees.d.mts +0 -14
- package/dist/utils/gas-fees.d.mts.map +1 -1
- package/dist/utils/gas-fees.mjs +2 -19
- package/dist/utils/gas-fees.mjs.map +1 -1
- package/dist/utils/gas-flow.cjs +2 -3
- package/dist/utils/gas-flow.cjs.map +1 -1
- package/dist/utils/gas-flow.d.cts +1 -3
- package/dist/utils/gas-flow.d.cts.map +1 -1
- package/dist/utils/gas-flow.d.mts +1 -3
- package/dist/utils/gas-flow.d.mts.map +1 -1
- package/dist/utils/gas-flow.mjs +2 -3
- package/dist/utils/gas-flow.mjs.map +1 -1
- package/dist/utils/gas.cjs +108 -8
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.d.cts +16 -5
- package/dist/utils/gas.d.cts.map +1 -1
- package/dist/utils/gas.d.mts +16 -5
- package/dist/utils/gas.d.mts.map +1 -1
- package/dist/utils/gas.mjs +108 -8
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.cjs +4 -9
- package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.d.cts +1 -4
- package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.d.mts +1 -4
- package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.mjs +4 -9
- package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
- package/dist/utils/simulation-api.cjs.map +1 -1
- package/dist/utils/simulation-api.d.cts +9 -5
- package/dist/utils/simulation-api.d.cts.map +1 -1
- package/dist/utils/simulation-api.d.mts +9 -5
- package/dist/utils/simulation-api.d.mts.map +1 -1
- package/dist/utils/simulation-api.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs +0 -145
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +0 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts +0 -27
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +0 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +0 -27
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +0 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs +0 -140
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
###
|
|
10
|
+
### Fixed
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
- Added flow only will be activated if chainId is defined in feature flags.
|
|
12
|
+
- Fix gas estimation for type 4 transactions ([#5519](https://github.com/MetaMask/core/pull/5519))
|
|
14
13
|
|
|
15
14
|
## [52.0.0]
|
|
16
15
|
|
|
@@ -33,7 +33,6 @@ const accounts_api_1 = require("./api/accounts-api.cjs");
|
|
|
33
33
|
const DefaultGasFeeFlow_1 = require("./gas-flows/DefaultGasFeeFlow.cjs");
|
|
34
34
|
const LineaGasFeeFlow_1 = require("./gas-flows/LineaGasFeeFlow.cjs");
|
|
35
35
|
const OptimismLayer1GasFeeFlow_1 = require("./gas-flows/OptimismLayer1GasFeeFlow.cjs");
|
|
36
|
-
const RandomisedEstimationsGasFeeFlow_1 = require("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs");
|
|
37
36
|
const ScrollLayer1GasFeeFlow_1 = require("./gas-flows/ScrollLayer1GasFeeFlow.cjs");
|
|
38
37
|
const TestGasFeeFlow_1 = require("./gas-flows/TestGasFeeFlow.cjs");
|
|
39
38
|
const AccountsApiRemoteTransactionSource_1 = require("./helpers/AccountsApiRemoteTransactionSource.cjs");
|
|
@@ -247,7 +246,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
247
246
|
getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
|
|
248
247
|
getTransactions: () => this.state.transactions,
|
|
249
248
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
250
|
-
messenger: this.messagingSystem,
|
|
251
249
|
onStateChange: (listener) => {
|
|
252
250
|
this.messagingSystem.subscribe('TransactionController:stateChange', listener);
|
|
253
251
|
},
|
|
@@ -551,7 +549,12 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
551
549
|
const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
|
|
552
550
|
networkClientId,
|
|
553
551
|
});
|
|
554
|
-
const { estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(
|
|
552
|
+
const { estimatedGas, simulationFails } = await (0, gas_1.estimateGas)({
|
|
553
|
+
chainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId),
|
|
554
|
+
ethQuery,
|
|
555
|
+
isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
|
|
556
|
+
txParams: transaction,
|
|
557
|
+
});
|
|
555
558
|
return { gas: estimatedGas, simulationFails };
|
|
556
559
|
}
|
|
557
560
|
/**
|
|
@@ -566,7 +569,12 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
566
569
|
const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
|
|
567
570
|
networkClientId,
|
|
568
571
|
});
|
|
569
|
-
const { blockGasLimit, estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(
|
|
572
|
+
const { blockGasLimit, estimatedGas, simulationFails } = await (0, gas_1.estimateGas)({
|
|
573
|
+
chainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId),
|
|
574
|
+
ethQuery,
|
|
575
|
+
isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
|
|
576
|
+
txParams: transaction,
|
|
577
|
+
});
|
|
570
578
|
const gas = (0, gas_1.addGasBuffer)(estimatedGas, blockGasLimit, multiplier);
|
|
571
579
|
return {
|
|
572
580
|
gas,
|
|
@@ -817,7 +825,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
817
825
|
updatedTransaction.type = type;
|
|
818
826
|
await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
|
|
819
827
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
820
|
-
messenger: this.messagingSystem,
|
|
821
828
|
provider,
|
|
822
829
|
transactionMeta: updatedTransaction,
|
|
823
830
|
});
|
|
@@ -1030,7 +1037,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1030
1037
|
networkClientId,
|
|
1031
1038
|
};
|
|
1032
1039
|
// Guaranteed as the default gas fee flow matches all transactions.
|
|
1033
|
-
const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows
|
|
1040
|
+
const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows);
|
|
1034
1041
|
const ethQuery = new eth_query_1.default(provider);
|
|
1035
1042
|
const gasFeeControllerData = await this.getGasFeeEstimates({
|
|
1036
1043
|
networkClientId,
|
|
@@ -1038,7 +1045,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1038
1045
|
return gasFeeFlow.getGasFees({
|
|
1039
1046
|
ethQuery,
|
|
1040
1047
|
gasFeeControllerData,
|
|
1041
|
-
messenger: this.messagingSystem,
|
|
1042
1048
|
transactionMeta,
|
|
1043
1049
|
});
|
|
1044
1050
|
}
|
|
@@ -1058,7 +1064,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1058
1064
|
});
|
|
1059
1065
|
return await (0, layer1_gas_fee_flow_1.getTransactionLayer1GasFee)({
|
|
1060
1066
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
1061
|
-
messenger: this.messagingSystem,
|
|
1062
1067
|
provider,
|
|
1063
1068
|
transactionMeta: {
|
|
1064
1069
|
txParams: transactionParams,
|
|
@@ -1185,12 +1190,10 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1185
1190
|
gasFeeFlows: this.gasFeeFlows,
|
|
1186
1191
|
getGasFeeEstimates: this.getGasFeeEstimates,
|
|
1187
1192
|
getSavedGasFees: this.getSavedGasFees.bind(this),
|
|
1188
|
-
messenger: this.messagingSystem,
|
|
1189
1193
|
txMeta: transactionMeta,
|
|
1190
1194
|
}));
|
|
1191
1195
|
await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Update Layer 1 Gas Fees', parentContext: traceContext }, async () => await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
|
|
1192
1196
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
1193
|
-
messenger: this.messagingSystem,
|
|
1194
1197
|
provider,
|
|
1195
1198
|
transactionMeta,
|
|
1196
1199
|
}));
|
|
@@ -1920,11 +1923,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
1920
1923
|
if (__classPrivateFieldGet(this, _TransactionController_testGasFeeFlows, "f")) {
|
|
1921
1924
|
return [new TestGasFeeFlow_1.TestGasFeeFlow()];
|
|
1922
1925
|
}
|
|
1923
|
-
return [
|
|
1924
|
-
new RandomisedEstimationsGasFeeFlow_1.RandomisedEstimationsGasFeeFlow(),
|
|
1925
|
-
new LineaGasFeeFlow_1.LineaGasFeeFlow(),
|
|
1926
|
-
new DefaultGasFeeFlow_1.DefaultGasFeeFlow(),
|
|
1927
|
-
];
|
|
1926
|
+
return [new LineaGasFeeFlow_1.LineaGasFeeFlow(), new DefaultGasFeeFlow_1.DefaultGasFeeFlow()];
|
|
1928
1927
|
}, _TransactionController_getLayer1GasFeeFlows = function _TransactionController_getLayer1GasFeeFlows() {
|
|
1929
1928
|
return [new OptimismLayer1GasFeeFlow_1.OptimismLayer1GasFeeFlow(), new ScrollLayer1GasFeeFlow_1.ScrollLayer1GasFeeFlow()];
|
|
1930
1929
|
}, _TransactionController_updateTransactionInternal = function _TransactionController_updateTransactionInternal({ transactionId, note, skipHistory, skipValidation, skipResimulateCheck, }, callback) {
|
|
@@ -2098,6 +2097,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2098
2097
|
chainId,
|
|
2099
2098
|
ethQuery,
|
|
2100
2099
|
isCustomNetwork,
|
|
2100
|
+
isSimulationEnabled: __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this),
|
|
2101
2101
|
txMeta: transactionMeta,
|
|
2102
2102
|
});
|
|
2103
2103
|
}, _TransactionController_deleteTransaction = function _TransactionController_deleteTransaction(transactionId) {
|