@metamask-previews/transaction-controller 28.1.0-preview-2036edd1 → 28.1.0-preview-61ace68c
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/dist/TransactionController.js +10 -11
- package/dist/TransactionController.mjs +9 -10
- package/dist/chunk-4RJXBKSR.js +90 -0
- package/dist/chunk-4RJXBKSR.js.map +1 -0
- package/dist/{chunk-P5THQMD6.js → chunk-DMMUAJKY.js} +17 -74
- package/dist/chunk-DMMUAJKY.js.map +1 -0
- package/dist/{chunk-DJX2AHAR.js → chunk-EQNKFFTM.js} +4 -18
- package/dist/chunk-EQNKFFTM.js.map +1 -0
- package/dist/{chunk-3N4EU7GV.js → chunk-FK7AP6SH.js} +5 -12
- package/dist/chunk-FK7AP6SH.js.map +1 -0
- package/dist/{chunk-CLDKTBKV.mjs → chunk-HHK4QSNF.mjs} +2 -2
- package/dist/chunk-HHK4QSNF.mjs.map +1 -0
- package/dist/{chunk-3ARSFXUM.mjs → chunk-LDXTSESK.mjs} +3 -17
- package/dist/chunk-LDXTSESK.mjs.map +1 -0
- package/dist/{chunk-SFFCXXMG.js → chunk-LNX4JTOL.js} +7 -7
- package/dist/chunk-LNX4JTOL.js.map +1 -0
- package/dist/{chunk-M2ASPQYU.mjs → chunk-MG7HTD3H.mjs} +14 -71
- package/dist/chunk-MG7HTD3H.mjs.map +1 -0
- package/dist/{chunk-ZFBQCDET.mjs → chunk-NCRWKI6Y.mjs} +4 -4
- package/dist/chunk-NCRWKI6Y.mjs.map +1 -0
- package/dist/chunk-NPEXNXSY.mjs +90 -0
- package/dist/chunk-NPEXNXSY.mjs.map +1 -0
- package/dist/{chunk-S6AIATO4.mjs → chunk-TWND5SFD.mjs} +12 -17
- package/dist/chunk-TWND5SFD.mjs.map +1 -0
- package/dist/{chunk-2U7O4BFB.js → chunk-UH7FNVKS.js} +14 -19
- package/dist/chunk-UH7FNVKS.js.map +1 -0
- package/dist/{chunk-P54PO3B4.js → chunk-V6UIRCOF.js} +3 -3
- package/dist/chunk-V6UIRCOF.js.map +1 -0
- package/dist/{chunk-H25BFN76.mjs → chunk-YEJJKWT2.mjs} +4 -11
- package/dist/{chunk-H25BFN76.mjs.map → chunk-YEJJKWT2.mjs.map} +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.js +5 -5
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +4 -4
- package/dist/gas-flows/LineaGasFeeFlow.js +6 -6
- package/dist/gas-flows/LineaGasFeeFlow.mjs +5 -5
- package/dist/helpers/EtherscanRemoteTransactionSource.js +1 -1
- package/dist/helpers/EtherscanRemoteTransactionSource.mjs +1 -1
- package/dist/helpers/GasFeePoller.js +4 -4
- package/dist/helpers/GasFeePoller.mjs +3 -3
- package/dist/helpers/MultichainTrackingHelper.js +1 -1
- package/dist/helpers/MultichainTrackingHelper.mjs +1 -1
- package/dist/helpers/PendingTransactionTracker.js +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs +1 -1
- package/dist/index.js +10 -15
- package/dist/index.mjs +9 -14
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/TransactionController.d.ts +4 -11
- package/dist/types/TransactionController.d.ts.map +1 -1
- package/dist/types/gas-flows/DefaultGasFeeFlow.d.ts.map +1 -1
- package/dist/types/helpers/GasFeePoller.d.ts +2 -2
- package/dist/types/helpers/GasFeePoller.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +15 -33
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/gas-flow.d.ts +14 -8
- package/dist/types/utils/gas-flow.d.ts.map +1 -1
- package/dist/types.js +2 -4
- package/dist/types.mjs +1 -3
- package/dist/utils/external-transactions.js +1 -1
- package/dist/utils/external-transactions.mjs +1 -1
- package/dist/utils/gas-fees.js +4 -4
- package/dist/utils/gas-fees.mjs +3 -3
- package/dist/utils/gas-flow.js +3 -3
- package/dist/utils/gas-flow.mjs +2 -2
- package/dist/utils/simulation-api.js +1 -1
- package/dist/utils/simulation-api.mjs +1 -1
- package/dist/utils/simulation.js +1 -1
- package/dist/utils/simulation.mjs +1 -1
- package/dist/utils/swaps.js +1 -1
- package/dist/utils/swaps.mjs +1 -1
- package/dist/utils/transaction-type.js +1 -1
- package/dist/utils/transaction-type.mjs +1 -1
- package/dist/utils/utils.js +1 -1
- package/dist/utils/utils.mjs +1 -1
- package/dist/utils/validation.js +1 -1
- package/dist/utils/validation.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-2U7O4BFB.js.map +0 -1
- package/dist/chunk-3ARSFXUM.mjs.map +0 -1
- package/dist/chunk-3N4EU7GV.js.map +0 -1
- package/dist/chunk-CLDKTBKV.mjs.map +0 -1
- package/dist/chunk-DJX2AHAR.js.map +0 -1
- package/dist/chunk-FMRLPVFZ.mjs +0 -66
- package/dist/chunk-FMRLPVFZ.mjs.map +0 -1
- package/dist/chunk-GK5HZWG5.js +0 -113
- package/dist/chunk-GK5HZWG5.js.map +0 -1
- package/dist/chunk-M2ASPQYU.mjs.map +0 -1
- package/dist/chunk-P54PO3B4.js.map +0 -1
- package/dist/chunk-P5THQMD6.js.map +0 -1
- package/dist/chunk-RVML2FZF.mjs +0 -113
- package/dist/chunk-RVML2FZF.mjs.map +0 -1
- package/dist/chunk-S6AIATO4.mjs.map +0 -1
- package/dist/chunk-SFFCXXMG.js.map +0 -1
- package/dist/chunk-TJMQEH57.js +0 -66
- package/dist/chunk-TJMQEH57.js.map +0 -1
- package/dist/chunk-ZFBQCDET.mjs.map +0 -1
- package/dist/gas-flows/TestGasFeeFlow.js +0 -9
- package/dist/gas-flows/TestGasFeeFlow.js.map +0 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs +0 -9
- package/dist/gas-flows/TestGasFeeFlow.mjs.map +0 -1
- package/dist/types/gas-flows/TestGasFeeFlow.d.ts +0 -12
- package/dist/types/gas-flows/TestGasFeeFlow.d.ts.map +0 -1
|
@@ -4,36 +4,35 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-ZNZEJDOE.js');
|
|
7
|
+
var _chunkDMMUAJKYjs = require('./chunk-DMMUAJKY.js');
|
|
9
8
|
require('./chunk-JAYYMCBQ.js');
|
|
10
9
|
require('./chunk-KT6UAKBB.js');
|
|
11
10
|
require('./chunk-SD6CWFDF.js');
|
|
12
11
|
require('./chunk-VH47Q6TS.js');
|
|
13
|
-
require('./chunk-5KMU2IAT.js');
|
|
14
12
|
require('./chunk-7LXE4KHV.js');
|
|
15
13
|
require('./chunk-V72C4MCR.js');
|
|
16
14
|
require('./chunk-QP75SWIQ.js');
|
|
15
|
+
require('./chunk-ZNZEJDOE.js');
|
|
17
16
|
require('./chunk-NYKRCWBG.js');
|
|
18
17
|
require('./chunk-WR5F34OW.js');
|
|
19
18
|
require('./chunk-YVCX6Z75.js');
|
|
20
|
-
require('./chunk-
|
|
21
|
-
require('./chunk-P54PO3B4.js');
|
|
19
|
+
require('./chunk-V6UIRCOF.js');
|
|
22
20
|
require('./chunk-2XKEAKQG.js');
|
|
23
21
|
require('./chunk-DTDTOMTB.js');
|
|
24
22
|
require('./chunk-5XQ2KRYL.js');
|
|
25
23
|
require('./chunk-EQT25RSP.js');
|
|
26
24
|
require('./chunk-FDUCRHYT.js');
|
|
25
|
+
require('./chunk-5KMU2IAT.js');
|
|
27
26
|
require('./chunk-HMOSP33F.js');
|
|
28
|
-
require('./chunk-
|
|
29
|
-
require('./chunk-
|
|
30
|
-
require('./chunk-
|
|
27
|
+
require('./chunk-LNX4JTOL.js');
|
|
28
|
+
require('./chunk-4RJXBKSR.js');
|
|
29
|
+
require('./chunk-EQNKFFTM.js');
|
|
31
30
|
require('./chunk-C2LNDHP4.js');
|
|
32
31
|
require('./chunk-UGFBA4GV.js');
|
|
33
|
-
require('./chunk-
|
|
32
|
+
require('./chunk-UH7FNVKS.js');
|
|
34
33
|
require('./chunk-UGN7PBON.js');
|
|
35
34
|
require('./chunk-S6VGOPUY.js');
|
|
36
|
-
require('./chunk-
|
|
35
|
+
require('./chunk-FK7AP6SH.js');
|
|
37
36
|
require('./chunk-Z4BLTVTB.js');
|
|
38
37
|
|
|
39
38
|
|
|
@@ -41,5 +40,5 @@ require('./chunk-Z4BLTVTB.js');
|
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
|
|
44
|
-
exports.ApprovalState =
|
|
43
|
+
exports.ApprovalState = _chunkDMMUAJKYjs.ApprovalState; exports.CANCEL_RATE = _chunkDMMUAJKYjs.CANCEL_RATE; exports.HARDFORK = _chunkDMMUAJKYjs.HARDFORK; exports.SPEED_UP_RATE = _chunkDMMUAJKYjs.SPEED_UP_RATE; exports.TransactionController = _chunkDMMUAJKYjs.TransactionController;
|
|
45
44
|
//# sourceMappingURL=TransactionController.js.map
|
|
@@ -4,36 +4,35 @@ import {
|
|
|
4
4
|
HARDFORK,
|
|
5
5
|
SPEED_UP_RATE,
|
|
6
6
|
TransactionController
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-NHRBO3LU.mjs";
|
|
7
|
+
} from "./chunk-MG7HTD3H.mjs";
|
|
9
8
|
import "./chunk-IZVRGO3P.mjs";
|
|
10
9
|
import "./chunk-K4KOSAGM.mjs";
|
|
11
10
|
import "./chunk-KG4UW4K4.mjs";
|
|
12
11
|
import "./chunk-NM6OYEPP.mjs";
|
|
13
|
-
import "./chunk-5YES3V2R.mjs";
|
|
14
12
|
import "./chunk-FRKQ3Z2L.mjs";
|
|
15
13
|
import "./chunk-5G6OHAXI.mjs";
|
|
16
14
|
import "./chunk-XGRAHX6T.mjs";
|
|
15
|
+
import "./chunk-NHRBO3LU.mjs";
|
|
17
16
|
import "./chunk-VEVVBHP3.mjs";
|
|
18
17
|
import "./chunk-Z4GV3YQQ.mjs";
|
|
19
18
|
import "./chunk-FG74Z3F5.mjs";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-CLDKTBKV.mjs";
|
|
19
|
+
import "./chunk-HHK4QSNF.mjs";
|
|
22
20
|
import "./chunk-NOHEXQ7Y.mjs";
|
|
23
21
|
import "./chunk-Y7ENNK7L.mjs";
|
|
24
22
|
import "./chunk-F6E3TTR3.mjs";
|
|
25
23
|
import "./chunk-CPMTUMMZ.mjs";
|
|
26
24
|
import "./chunk-QZLPYOGC.mjs";
|
|
25
|
+
import "./chunk-5YES3V2R.mjs";
|
|
27
26
|
import "./chunk-HQSNKCXI.mjs";
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-NCRWKI6Y.mjs";
|
|
28
|
+
import "./chunk-NPEXNXSY.mjs";
|
|
29
|
+
import "./chunk-LDXTSESK.mjs";
|
|
31
30
|
import "./chunk-ZGUNOEUQ.mjs";
|
|
32
31
|
import "./chunk-J56A7UCK.mjs";
|
|
33
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-TWND5SFD.mjs";
|
|
34
33
|
import "./chunk-O6ZZVIFH.mjs";
|
|
35
34
|
import "./chunk-UQQWZT6C.mjs";
|
|
36
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-YEJJKWT2.mjs";
|
|
37
36
|
import "./chunk-XUI43LEZ.mjs";
|
|
38
37
|
export {
|
|
39
38
|
ApprovalState,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkEQNKFFTMjs = require('./chunk-EQNKFFTM.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkS6VGOPUYjs = require('./chunk-S6VGOPUY.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkFK7AP6SHjs = require('./chunk-FK7AP6SH.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkZ4BLTVTBjs = require('./chunk-Z4BLTVTB.js');
|
|
14
|
+
|
|
15
|
+
// src/gas-flows/DefaultGasFeeFlow.ts
|
|
16
|
+
var _gasfeecontroller = require('@metamask/gas-fee-controller');
|
|
17
|
+
var _utils = require('@metamask/utils');
|
|
18
|
+
var log = _utils.createModuleLogger.call(void 0, _chunkS6VGOPUYjs.projectLogger, "default-gas-fee-flow");
|
|
19
|
+
var _getEstimateLevel, getEstimateLevel_fn, _getFeeMarketLevel, getFeeMarketLevel_fn, _getLegacyLevel, getLegacyLevel_fn;
|
|
20
|
+
var DefaultGasFeeFlow = class {
|
|
21
|
+
constructor() {
|
|
22
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getEstimateLevel);
|
|
23
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getFeeMarketLevel);
|
|
24
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getLegacyLevel);
|
|
25
|
+
}
|
|
26
|
+
matchesTransaction(_transactionMeta) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
async getGasFees(request) {
|
|
30
|
+
const { getGasFeeControllerEstimates, transactionMeta } = request;
|
|
31
|
+
const { networkClientId } = transactionMeta;
|
|
32
|
+
const { gasEstimateType, gasFeeEstimates } = await getGasFeeControllerEstimates({ networkClientId });
|
|
33
|
+
if (gasEstimateType === _gasfeecontroller.GAS_ESTIMATE_TYPES.FEE_MARKET) {
|
|
34
|
+
log("Using fee market estimates", gasFeeEstimates);
|
|
35
|
+
} else if (gasEstimateType === _gasfeecontroller.GAS_ESTIMATE_TYPES.LEGACY) {
|
|
36
|
+
log("Using legacy estimates", gasFeeEstimates);
|
|
37
|
+
} else {
|
|
38
|
+
throw new Error(`'No gas fee estimates available`);
|
|
39
|
+
}
|
|
40
|
+
const estimates = Object.values(_chunkFK7AP6SHjs.GasFeeEstimateLevel).reduce(
|
|
41
|
+
(result, level) => ({
|
|
42
|
+
...result,
|
|
43
|
+
[level]: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getEstimateLevel, getEstimateLevel_fn).call(this, {
|
|
44
|
+
gasEstimateType,
|
|
45
|
+
gasFeeEstimates,
|
|
46
|
+
level
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
{}
|
|
50
|
+
);
|
|
51
|
+
return { estimates };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
_getEstimateLevel = new WeakSet();
|
|
55
|
+
getEstimateLevel_fn = function({
|
|
56
|
+
gasEstimateType,
|
|
57
|
+
gasFeeEstimates,
|
|
58
|
+
level
|
|
59
|
+
}) {
|
|
60
|
+
if (gasEstimateType === _gasfeecontroller.GAS_ESTIMATE_TYPES.FEE_MARKET) {
|
|
61
|
+
return _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getFeeMarketLevel, getFeeMarketLevel_fn).call(this, gasFeeEstimates, level);
|
|
62
|
+
}
|
|
63
|
+
return _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getLegacyLevel, getLegacyLevel_fn).call(this, gasFeeEstimates, level);
|
|
64
|
+
};
|
|
65
|
+
_getFeeMarketLevel = new WeakSet();
|
|
66
|
+
getFeeMarketLevel_fn = function(gasFeeEstimates, level) {
|
|
67
|
+
const maxFeePerGas = _chunkEQNKFFTMjs.gweiDecimalToWeiHex.call(void 0,
|
|
68
|
+
gasFeeEstimates[level].suggestedMaxFeePerGas
|
|
69
|
+
);
|
|
70
|
+
const maxPriorityFeePerGas = _chunkEQNKFFTMjs.gweiDecimalToWeiHex.call(void 0,
|
|
71
|
+
gasFeeEstimates[level].suggestedMaxPriorityFeePerGas
|
|
72
|
+
);
|
|
73
|
+
return {
|
|
74
|
+
maxFeePerGas,
|
|
75
|
+
maxPriorityFeePerGas
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
_getLegacyLevel = new WeakSet();
|
|
79
|
+
getLegacyLevel_fn = function(gasFeeEstimates, level) {
|
|
80
|
+
const gasPrice = _chunkEQNKFFTMjs.gweiDecimalToWeiHex.call(void 0, gasFeeEstimates[level]);
|
|
81
|
+
return {
|
|
82
|
+
maxFeePerGas: gasPrice,
|
|
83
|
+
maxPriorityFeePerGas: gasPrice
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
exports.DefaultGasFeeFlow = DefaultGasFeeFlow;
|
|
90
|
+
//# sourceMappingURL=chunk-4RJXBKSR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAIA,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AAcnC,IAAM,MAAM,mBAAmB,eAAe,sBAAsB;AAnBpE;AAoCO,IAAM,oBAAN,MAA8C;AAAA,EAA9C;AAmCL;AAcA;AAkBA;AAAA;AAAA,EAlEA,mBAAmB,kBAA4C;AAC7D,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,WAAW,SAAyD;AACxE,UAAM,EAAE,8BAA8B,gBAAgB,IAAI;AAC1D,UAAM,EAAE,gBAAgB,IAAI;AAE5B,UAAM,EAAE,iBAAiB,gBAAgB,IACvC,MAAM,6BAA6B,EAAE,gBAAgB,CAAC;AAExD,QAAI,oBAAoB,mBAAmB,YAAY;AACrD,UAAI,8BAA8B,eAAe;AAAA,IACnD,WAAW,oBAAoB,mBAAmB,QAAQ;AACxD,UAAI,0BAA0B,eAAe;AAAA,IAC/C,OAAO;AACL,YAAM,IAAI,MAAM,iCAAiC;AAAA,IACnD;AAEA,UAAM,YAAY,OAAO,OAAO,mBAAmB,EAAE;AAAA,MACnD,CAAC,QAAQ,WAAW;AAAA,QAClB,GAAG;AAAA,QACH,CAAC,KAAK,GAAG,sBAAK,wCAAL,WAAuB;AAAA,UAC9B;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,MACA,CAAC;AAAA,IACH;AAEA,WAAO,EAAE,UAAU;AAAA,EACrB;AA6CF;AA3CE;AAAA,sBAAiB,SAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AACF,GAE4D;AAC1D,MAAI,oBAAoB,mBAAmB,YAAY;AACrD,WAAO,sBAAK,0CAAL,WAAwB,iBAAiB;AAAA,EAClD;AAEA,SAAO,sBAAK,oCAAL,WAAqB,iBAAiB;AAC/C;AAEA;AAAA,uBAAkB,SAChB,iBACA,OACyB;AACzB,QAAM,eAAe;AAAA,IACnB,gBAAgB,KAAK,EAAE;AAAA,EACzB;AAEA,QAAM,uBAAuB;AAAA,IAC3B,gBAAgB,KAAK,EAAE;AAAA,EACzB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEA;AAAA,oBAAe,SACb,iBACA,OACyB;AACzB,QAAM,WAAW,oBAAoB,gBAAgB,KAAK,CAAC;AAE3D,SAAO;AAAA,IACL,cAAc;AAAA,IACd,sBAAsB;AAAA,EACxB;AACF","sourcesContent":["import type {\n LegacyGasPriceEstimate,\n GasFeeEstimates as FeeMarketGasPriceEstimate,\n} from '@metamask/gas-fee-controller';\nimport { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../logger';\nimport type {\n GasFeeEstimates,\n GasFeeEstimatesForLevel,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\nimport { GasFeeEstimateLevel } from '../types';\nimport { gweiDecimalToWeiHex } from '../utils/gas-fees';\n\nconst log = createModuleLogger(projectLogger, 'default-gas-fee-flow');\n\ntype FeeMarketGetEstimateLevelRequest = {\n gasEstimateType: 'fee-market';\n gasFeeEstimates: FeeMarketGasPriceEstimate;\n level: GasFeeEstimateLevel;\n};\n\ntype LegacyGetEstimateLevelRequest = {\n gasEstimateType: 'legacy';\n gasFeeEstimates: LegacyGasPriceEstimate;\n level: GasFeeEstimateLevel;\n};\n\n/**\n * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.\n */\nexport class DefaultGasFeeFlow implements GasFeeFlow {\n matchesTransaction(_transactionMeta: TransactionMeta): boolean {\n return true;\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n const { getGasFeeControllerEstimates, transactionMeta } = request;\n const { networkClientId } = transactionMeta;\n\n const { gasEstimateType, gasFeeEstimates } =\n await getGasFeeControllerEstimates({ networkClientId });\n\n if (gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET) {\n log('Using fee market estimates', gasFeeEstimates);\n } else if (gasEstimateType === GAS_ESTIMATE_TYPES.LEGACY) {\n log('Using legacy estimates', gasFeeEstimates);\n } else {\n throw new Error(`'No gas fee estimates available`);\n }\n\n const estimates = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getEstimateLevel({\n gasEstimateType,\n gasFeeEstimates,\n level,\n } as FeeMarketGetEstimateLevelRequest | LegacyGetEstimateLevelRequest),\n }),\n {} as GasFeeEstimates,\n );\n\n return { estimates };\n }\n\n #getEstimateLevel({\n gasEstimateType,\n gasFeeEstimates,\n level,\n }:\n | FeeMarketGetEstimateLevelRequest\n | LegacyGetEstimateLevelRequest): GasFeeEstimatesForLevel {\n if (gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET) {\n return this.#getFeeMarketLevel(gasFeeEstimates, level);\n }\n\n return this.#getLegacyLevel(gasFeeEstimates, level);\n }\n\n #getFeeMarketLevel(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): GasFeeEstimatesForLevel {\n const maxFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxFeePerGas,\n );\n\n const maxPriorityFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxPriorityFeePerGas,\n );\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n }\n\n #getLegacyLevel(\n gasFeeEstimates: LegacyGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): GasFeeEstimatesForLevel {\n const gasPrice = gweiDecimalToWeiHex(gasFeeEstimates[level]);\n\n return {\n maxFeePerGas: gasPrice,\n maxPriorityFeePerGas: gasPrice,\n };\n }\n}\n"]}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var _chunkZNZEJDOEjs = require('./chunk-ZNZEJDOE.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
3
|
var _chunkJAYYMCBQjs = require('./chunk-JAYYMCBQ.js');
|
|
8
4
|
|
|
9
5
|
|
|
@@ -14,9 +10,6 @@ var _chunkSD6CWFDFjs = require('./chunk-SD6CWFDF.js');
|
|
|
14
10
|
var _chunkVH47Q6TSjs = require('./chunk-VH47Q6TS.js');
|
|
15
11
|
|
|
16
12
|
|
|
17
|
-
var _chunk5KMU2IATjs = require('./chunk-5KMU2IAT.js');
|
|
18
|
-
|
|
19
|
-
|
|
20
13
|
var _chunk7LXE4KHVjs = require('./chunk-7LXE4KHV.js');
|
|
21
14
|
|
|
22
15
|
|
|
@@ -29,16 +22,17 @@ var _chunkV72C4MCRjs = require('./chunk-V72C4MCR.js');
|
|
|
29
22
|
var _chunkQP75SWIQjs = require('./chunk-QP75SWIQ.js');
|
|
30
23
|
|
|
31
24
|
|
|
32
|
-
var _chunkNYKRCWBGjs = require('./chunk-NYKRCWBG.js');
|
|
33
25
|
|
|
26
|
+
var _chunkZNZEJDOEjs = require('./chunk-ZNZEJDOE.js');
|
|
34
27
|
|
|
35
|
-
|
|
28
|
+
|
|
29
|
+
var _chunkNYKRCWBGjs = require('./chunk-NYKRCWBG.js');
|
|
36
30
|
|
|
37
31
|
|
|
38
|
-
var
|
|
32
|
+
var _chunkWR5F34OWjs = require('./chunk-WR5F34OW.js');
|
|
39
33
|
|
|
40
34
|
|
|
41
|
-
var
|
|
35
|
+
var _chunkV6UIRCOFjs = require('./chunk-V6UIRCOF.js');
|
|
42
36
|
|
|
43
37
|
|
|
44
38
|
|
|
@@ -54,19 +48,20 @@ var _chunk5XQ2KRYLjs = require('./chunk-5XQ2KRYL.js');
|
|
|
54
48
|
var _chunkEQT25RSPjs = require('./chunk-EQT25RSP.js');
|
|
55
49
|
|
|
56
50
|
|
|
57
|
-
var
|
|
51
|
+
var _chunk5KMU2IATjs = require('./chunk-5KMU2IAT.js');
|
|
58
52
|
|
|
59
53
|
|
|
60
|
-
var
|
|
54
|
+
var _chunkLNX4JTOLjs = require('./chunk-LNX4JTOL.js');
|
|
61
55
|
|
|
62
56
|
|
|
63
|
-
var
|
|
57
|
+
var _chunk4RJXBKSRjs = require('./chunk-4RJXBKSR.js');
|
|
64
58
|
|
|
65
59
|
|
|
60
|
+
var _chunkEQNKFFTMjs = require('./chunk-EQNKFFTM.js');
|
|
66
61
|
|
|
67
|
-
var _chunkC2LNDHP4js = require('./chunk-C2LNDHP4.js');
|
|
68
62
|
|
|
69
63
|
|
|
64
|
+
var _chunkC2LNDHP4js = require('./chunk-C2LNDHP4.js');
|
|
70
65
|
|
|
71
66
|
|
|
72
67
|
|
|
@@ -76,10 +71,9 @@ var _chunkC2LNDHP4js = require('./chunk-C2LNDHP4.js');
|
|
|
76
71
|
|
|
77
72
|
|
|
78
73
|
|
|
79
|
-
var _chunkUGFBA4GVjs = require('./chunk-UGFBA4GV.js');
|
|
80
74
|
|
|
81
75
|
|
|
82
|
-
var
|
|
76
|
+
var _chunkUGFBA4GVjs = require('./chunk-UGFBA4GV.js');
|
|
83
77
|
|
|
84
78
|
|
|
85
79
|
var _chunkS6VGOPUYjs = require('./chunk-S6VGOPUY.js');
|
|
@@ -143,7 +137,7 @@ function getDefaultTransactionControllerState() {
|
|
|
143
137
|
lastFetchedBlockNumbers: {}
|
|
144
138
|
};
|
|
145
139
|
}
|
|
146
|
-
var _internalEvents, _incomingTransactionOptions, _pendingTransactionOptions, _transactionHistoryLimit, _isSimulationEnabled,
|
|
140
|
+
var _internalEvents, _incomingTransactionOptions, _pendingTransactionOptions, _transactionHistoryLimit, _isSimulationEnabled, _multichainTrackingHelper, _createNonceTracker, createNonceTracker_fn, _createIncomingTransactionHelper, createIncomingTransactionHelper_fn, _createPendingTransactionTracker, createPendingTransactionTracker_fn, _checkForPendingTransactionAndStartPolling, _stopAllTracking, stopAllTracking_fn, _removeIncomingTransactionHelperListeners, removeIncomingTransactionHelperListeners_fn, _addIncomingTransactionHelperListeners, addIncomingTransactionHelperListeners_fn, _removePendingTransactionTrackerListeners, removePendingTransactionTrackerListeners_fn, _addPendingTransactionTrackerListeners, addPendingTransactionTrackerListeners_fn, _getNonceTrackerPendingTransactions, getNonceTrackerPendingTransactions_fn, _getGasFeeFlows, getGasFeeFlows_fn, _getLayer1GasFeeFlows, getLayer1GasFeeFlows_fn, _updateTransactionInternal, updateTransactionInternal_fn, _checkIfTransactionParamsUpdated, checkIfTransactionParamsUpdated_fn, _onTransactionParamsUpdated, onTransactionParamsUpdated_fn, _updateSimulationData, updateSimulationData_fn, _onGasFeePollerTransactionUpdate, onGasFeePollerTransactionUpdate_fn;
|
|
147
141
|
var TransactionController = class extends _basecontroller.BaseController {
|
|
148
142
|
/**
|
|
149
143
|
* Constructs a TransactionController.
|
|
@@ -172,7 +166,6 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
172
166
|
* @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.
|
|
173
167
|
* @param options.sign - Function used to sign transactions.
|
|
174
168
|
* @param options.state - Initial state to set on this controller.
|
|
175
|
-
* @param options.testGasFeeFlows - Whether to use the test gas fee flow.
|
|
176
169
|
* @param options.transactionHistoryLimit - Transaction history limit.
|
|
177
170
|
* @param options.hooks - The controller hooks.
|
|
178
171
|
*/
|
|
@@ -200,7 +193,6 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
200
193
|
securityProviderRequest,
|
|
201
194
|
sign,
|
|
202
195
|
state,
|
|
203
|
-
testGasFeeFlows,
|
|
204
196
|
transactionHistoryLimit = 40,
|
|
205
197
|
hooks
|
|
206
198
|
}) {
|
|
@@ -229,7 +221,6 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
229
221
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _onTransactionParamsUpdated);
|
|
230
222
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _updateSimulationData);
|
|
231
223
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _onGasFeePollerTransactionUpdate);
|
|
232
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getNetworkClientId);
|
|
233
224
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _internalEvents, new (0, _events.EventEmitter)());
|
|
234
225
|
this.inProcessOfSigning = /* @__PURE__ */ new Set();
|
|
235
226
|
this.mutex = new (0, _asyncmutex.Mutex)();
|
|
@@ -238,7 +229,6 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
238
229
|
this.signAbortCallbacks = /* @__PURE__ */ new Map();
|
|
239
230
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _transactionHistoryLimit, void 0);
|
|
240
231
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _isSimulationEnabled, void 0);
|
|
241
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _testGasFeeFlows, void 0);
|
|
242
232
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _multichainTrackingHelper, void 0);
|
|
243
233
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _checkForPendingTransactionAndStartPolling, () => {
|
|
244
234
|
this.pendingTransactionTracker.startIfPendingTransactions();
|
|
@@ -263,7 +253,6 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
263
253
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _pendingTransactionOptions, pendingTransactions);
|
|
264
254
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _transactionHistoryLimit, transactionHistoryLimit);
|
|
265
255
|
this.sign = sign;
|
|
266
|
-
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _testGasFeeFlows, testGasFeeFlows === true);
|
|
267
256
|
this.afterSign = hooks?.afterSign ?? (() => true);
|
|
268
257
|
this.beforeApproveOnInit = hooks?.beforeApproveOnInit ?? (() => true);
|
|
269
258
|
this.beforeCheckPendingTransaction = hooks?.beforeCheckPendingTransaction ?? /* istanbul ignore next */
|
|
@@ -319,9 +308,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
319
308
|
});
|
|
320
309
|
this.gasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGasFeeFlows, getGasFeeFlows_fn).call(this);
|
|
321
310
|
this.layer1GasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getLayer1GasFeeFlows, getLayer1GasFeeFlows_fn).call(this);
|
|
322
|
-
const gasFeePoller = new (0,
|
|
311
|
+
const gasFeePoller = new (0, _chunkV6UIRCOFjs.GasFeePoller)({
|
|
323
312
|
// Default gas fee polling is not yet supported by the clients
|
|
324
|
-
gasFeeFlows: this.gasFeeFlows,
|
|
313
|
+
gasFeeFlows: this.gasFeeFlows.slice(0, -1),
|
|
325
314
|
getGasFeeControllerEstimates: this.getGasFeeEstimates,
|
|
326
315
|
getProvider: (chainId, networkClientId) => _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getProvider({
|
|
327
316
|
networkClientId,
|
|
@@ -1379,34 +1368,6 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1379
1368
|
}
|
|
1380
1369
|
return filteredTransactions;
|
|
1381
1370
|
}
|
|
1382
|
-
async estimateGasFee({
|
|
1383
|
-
transactionParams,
|
|
1384
|
-
chainId,
|
|
1385
|
-
networkClientId: requestNetworkClientId
|
|
1386
|
-
}) {
|
|
1387
|
-
const networkClientId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getNetworkClientId, getNetworkClientId_fn).call(this, {
|
|
1388
|
-
networkClientId: requestNetworkClientId,
|
|
1389
|
-
chainId
|
|
1390
|
-
});
|
|
1391
|
-
const transactionMeta = {
|
|
1392
|
-
txParams: transactionParams,
|
|
1393
|
-
chainId,
|
|
1394
|
-
networkClientId
|
|
1395
|
-
};
|
|
1396
|
-
const gasFeeFlow = _chunk2U7O4BFBjs.getGasFeeFlow.call(void 0,
|
|
1397
|
-
transactionMeta,
|
|
1398
|
-
this.gasFeeFlows
|
|
1399
|
-
);
|
|
1400
|
-
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
1401
|
-
networkClientId,
|
|
1402
|
-
chainId
|
|
1403
|
-
});
|
|
1404
|
-
return gasFeeFlow.getGasFees({
|
|
1405
|
-
ethQuery,
|
|
1406
|
-
getGasFeeControllerEstimates: this.getGasFeeEstimates,
|
|
1407
|
-
transactionMeta
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
1371
|
/**
|
|
1411
1372
|
* Determine the layer 1 gas fee for the given transaction parameters.
|
|
1412
1373
|
*
|
|
@@ -1514,7 +1475,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1514
1475
|
isCustomNetwork,
|
|
1515
1476
|
txMeta: transactionMeta
|
|
1516
1477
|
});
|
|
1517
|
-
await
|
|
1478
|
+
await _chunkEQNKFFTMjs.updateGasFees.call(void 0, {
|
|
1518
1479
|
eip1559: isEIP1559Compatible,
|
|
1519
1480
|
ethQuery,
|
|
1520
1481
|
gasFeeFlows: this.gasFeeFlows,
|
|
@@ -2226,7 +2187,6 @@ _incomingTransactionOptions = new WeakMap();
|
|
|
2226
2187
|
_pendingTransactionOptions = new WeakMap();
|
|
2227
2188
|
_transactionHistoryLimit = new WeakMap();
|
|
2228
2189
|
_isSimulationEnabled = new WeakMap();
|
|
2229
|
-
_testGasFeeFlows = new WeakMap();
|
|
2230
2190
|
_multichainTrackingHelper = new WeakMap();
|
|
2231
2191
|
_createNonceTracker = new WeakSet();
|
|
2232
2192
|
createNonceTracker_fn = function({
|
|
@@ -2366,10 +2326,7 @@ getNonceTrackerPendingTransactions_fn = function(chainId, address) {
|
|
|
2366
2326
|
};
|
|
2367
2327
|
_getGasFeeFlows = new WeakSet();
|
|
2368
2328
|
getGasFeeFlows_fn = function() {
|
|
2369
|
-
|
|
2370
|
-
return [new (0, _chunkTJMQEH57js.TestGasFeeFlow)()];
|
|
2371
|
-
}
|
|
2372
|
-
return [new (0, _chunkSFFCXXMGjs.LineaGasFeeFlow)(), new (0, _chunkGK5HZWG5js.DefaultGasFeeFlow)()];
|
|
2329
|
+
return [new (0, _chunkLNX4JTOLjs.LineaGasFeeFlow)(), new (0, _chunk4RJXBKSRjs.DefaultGasFeeFlow)()];
|
|
2373
2330
|
};
|
|
2374
2331
|
_getLayer1GasFeeFlows = new WeakSet();
|
|
2375
2332
|
getLayer1GasFeeFlows_fn = function() {
|
|
@@ -2496,20 +2453,6 @@ onGasFeePollerTransactionUpdate_fn = function({
|
|
|
2496
2453
|
}
|
|
2497
2454
|
});
|
|
2498
2455
|
};
|
|
2499
|
-
_getNetworkClientId = new WeakSet();
|
|
2500
|
-
getNetworkClientId_fn = function({
|
|
2501
|
-
networkClientId: requestNetworkClientId,
|
|
2502
|
-
chainId
|
|
2503
|
-
}) {
|
|
2504
|
-
if (requestNetworkClientId) {
|
|
2505
|
-
return requestNetworkClientId;
|
|
2506
|
-
}
|
|
2507
|
-
const networkClientId = chainId ? this.messagingSystem.call(
|
|
2508
|
-
`NetworkController:findNetworkClientIdByChainId`,
|
|
2509
|
-
chainId
|
|
2510
|
-
) : void 0;
|
|
2511
|
-
return networkClientId ?? this.getNetworkState().selectedNetworkClientId;
|
|
2512
|
-
};
|
|
2513
2456
|
|
|
2514
2457
|
|
|
2515
2458
|
|
|
@@ -2518,4 +2461,4 @@ getNetworkClientId_fn = function({
|
|
|
2518
2461
|
|
|
2519
2462
|
|
|
2520
2463
|
exports.HARDFORK = HARDFORK; exports.CANCEL_RATE = CANCEL_RATE; exports.SPEED_UP_RATE = SPEED_UP_RATE; exports.ApprovalState = ApprovalState; exports.TransactionController = TransactionController;
|
|
2521
|
-
//# sourceMappingURL=chunk-
|
|
2464
|
+
//# sourceMappingURL=chunk-DMMUAJKY.js.map
|