@metamask-previews/transaction-controller 45.0.0-preview-1adbaffc → 45.1.0-preview-ee98fad1

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/dist/TransactionController.cjs +85 -67
  3. package/dist/TransactionController.cjs.map +1 -1
  4. package/dist/TransactionController.d.cts +22 -17
  5. package/dist/TransactionController.d.cts.map +1 -1
  6. package/dist/TransactionController.d.mts +22 -17
  7. package/dist/TransactionController.d.mts.map +1 -1
  8. package/dist/TransactionController.mjs +84 -66
  9. package/dist/TransactionController.mjs.map +1 -1
  10. package/dist/abi/IERC7821.cjs +23 -0
  11. package/dist/abi/IERC7821.cjs.map +1 -0
  12. package/dist/abi/IERC7821.d.cts +16 -0
  13. package/dist/abi/IERC7821.d.cts.map +1 -0
  14. package/dist/abi/IERC7821.d.mts +16 -0
  15. package/dist/abi/IERC7821.d.mts.map +1 -0
  16. package/dist/abi/IERC7821.mjs +20 -0
  17. package/dist/abi/IERC7821.mjs.map +1 -0
  18. package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs +4 -13
  19. package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -1
  20. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -1
  21. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -1
  22. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs +4 -13
  23. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
  24. package/dist/index.cjs +3 -2
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +3 -2
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts +3 -2
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +2 -1
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/types.cjs +11 -37
  33. package/dist/types.cjs.map +1 -1
  34. package/dist/types.d.cts +98 -1
  35. package/dist/types.d.cts.map +1 -1
  36. package/dist/types.d.mts +98 -1
  37. package/dist/types.d.mts.map +1 -1
  38. package/dist/types.mjs +11 -37
  39. package/dist/types.mjs.map +1 -1
  40. package/dist/utils/batch.cjs +84 -0
  41. package/dist/utils/batch.cjs.map +1 -0
  42. package/dist/utils/batch.d.cts +32 -0
  43. package/dist/utils/batch.d.cts.map +1 -0
  44. package/dist/utils/batch.d.mts +32 -0
  45. package/dist/utils/batch.d.mts.map +1 -0
  46. package/dist/utils/batch.mjs +79 -0
  47. package/dist/utils/batch.mjs.map +1 -0
  48. package/dist/utils/eip7702.cjs +160 -0
  49. package/dist/utils/eip7702.cjs.map +1 -0
  50. package/dist/utils/eip7702.d.cts +63 -0
  51. package/dist/utils/eip7702.d.cts.map +1 -0
  52. package/dist/utils/eip7702.d.mts +63 -0
  53. package/dist/utils/eip7702.d.mts.map +1 -0
  54. package/dist/utils/eip7702.mjs +153 -0
  55. package/dist/utils/eip7702.mjs.map +1 -0
  56. package/dist/utils/feature-flags.cjs +53 -0
  57. package/dist/utils/feature-flags.cjs.map +1 -0
  58. package/dist/utils/feature-flags.d.cts +34 -0
  59. package/dist/utils/feature-flags.d.cts.map +1 -0
  60. package/dist/utils/feature-flags.d.mts +34 -0
  61. package/dist/utils/feature-flags.d.mts.map +1 -0
  62. package/dist/utils/feature-flags.mjs +47 -0
  63. package/dist/utils/feature-flags.mjs.map +1 -0
  64. package/dist/utils/prepare.cjs +49 -0
  65. package/dist/utils/prepare.cjs.map +1 -0
  66. package/dist/utils/prepare.d.cts +21 -0
  67. package/dist/utils/prepare.d.cts.map +1 -0
  68. package/dist/utils/prepare.d.mts +21 -0
  69. package/dist/utils/prepare.d.mts.map +1 -0
  70. package/dist/utils/prepare.mjs +44 -0
  71. package/dist/utils/prepare.mjs.map +1 -0
  72. package/dist/utils/utils.cjs +3 -8
  73. package/dist/utils/utils.cjs.map +1 -1
  74. package/dist/utils/utils.d.cts.map +1 -1
  75. package/dist/utils/utils.d.mts.map +1 -1
  76. package/dist/utils/utils.mjs +3 -8
  77. package/dist/utils/utils.mjs.map +1 -1
  78. package/dist/utils/validation.cjs +102 -31
  79. package/dist/utils/validation.cjs.map +1 -1
  80. package/dist/utils/validation.d.cts +18 -6
  81. package/dist/utils/validation.d.cts.map +1 -1
  82. package/dist/utils/validation.d.mts +18 -6
  83. package/dist/utils/validation.d.mts.map +1 -1
  84. package/dist/utils/validation.mjs +103 -32
  85. package/dist/utils/validation.mjs.map +1 -1
  86. package/package.json +11 -9
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ABI_IERC7821 = void 0;
4
+ exports.ABI_IERC7821 = [
5
+ {
6
+ type: 'function',
7
+ name: 'execute',
8
+ inputs: [
9
+ { name: 'mode', type: 'bytes32', internalType: 'ModeCode' },
10
+ { name: 'executionData', type: 'bytes', internalType: 'bytes' },
11
+ ],
12
+ outputs: [],
13
+ stateMutability: 'payable',
14
+ },
15
+ {
16
+ type: 'function',
17
+ name: 'supportsExecutionMode',
18
+ inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],
19
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
20
+ stateMutability: 'view',
21
+ },
22
+ ];
23
+ //# sourceMappingURL=IERC7821.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IERC7821.cjs","sourceRoot":"","sources":["../../src/abi/IERC7821.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE;YAC3D,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE;SAChE;QACD,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,SAAS;KAC3B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;QACrE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;QAC3D,eAAe,EAAE,MAAM;KACxB;CACF,CAAC","sourcesContent":["export const ABI_IERC7821 = [\n {\n type: 'function',\n name: 'execute',\n inputs: [\n { name: 'mode', type: 'bytes32', internalType: 'ModeCode' },\n { name: 'executionData', type: 'bytes', internalType: 'bytes' },\n ],\n outputs: [],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n name: 'supportsExecutionMode',\n inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'view',\n },\n];\n"]}
@@ -0,0 +1,16 @@
1
+ export declare const ABI_IERC7821: {
2
+ type: string;
3
+ name: string;
4
+ inputs: {
5
+ name: string;
6
+ type: string;
7
+ internalType: string;
8
+ }[];
9
+ outputs: {
10
+ name: string;
11
+ type: string;
12
+ internalType: string;
13
+ }[];
14
+ stateMutability: string;
15
+ }[];
16
+ //# sourceMappingURL=IERC7821.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IERC7821.d.cts","sourceRoot":"","sources":["../../src/abi/IERC7821.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;GAkBxB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const ABI_IERC7821: {
2
+ type: string;
3
+ name: string;
4
+ inputs: {
5
+ name: string;
6
+ type: string;
7
+ internalType: string;
8
+ }[];
9
+ outputs: {
10
+ name: string;
11
+ type: string;
12
+ internalType: string;
13
+ }[];
14
+ stateMutability: string;
15
+ }[];
16
+ //# sourceMappingURL=IERC7821.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IERC7821.d.mts","sourceRoot":"","sources":["../../src/abi/IERC7821.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;GAkBxB,CAAC"}
@@ -0,0 +1,20 @@
1
+ export const ABI_IERC7821 = [
2
+ {
3
+ type: 'function',
4
+ name: 'execute',
5
+ inputs: [
6
+ { name: 'mode', type: 'bytes32', internalType: 'ModeCode' },
7
+ { name: 'executionData', type: 'bytes', internalType: 'bytes' },
8
+ ],
9
+ outputs: [],
10
+ stateMutability: 'payable',
11
+ },
12
+ {
13
+ type: 'function',
14
+ name: 'supportsExecutionMode',
15
+ inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],
16
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
17
+ stateMutability: 'view',
18
+ },
19
+ ];
20
+ //# sourceMappingURL=IERC7821.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IERC7821.mjs","sourceRoot":"","sources":["../../src/abi/IERC7821.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE;YAC3D,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE;SAChE;QACD,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,SAAS;KAC3B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;QACrE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;QAC3D,eAAe,EAAE,MAAM;KACxB;CACF,CAAC","sourcesContent":["export const ABI_IERC7821 = [\n {\n type: 'function',\n name: 'execute',\n inputs: [\n { name: 'mode', type: 'bytes32', internalType: 'ModeCode' },\n { name: 'executionData', type: 'bytes', internalType: 'bytes' },\n ],\n outputs: [],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n name: 'supportsExecutionMode',\n inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'view',\n },\n];\n"]}
@@ -10,16 +10,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _OracleLayer1GasFeeFlow_instances, _OracleLayer1GasFeeFlow_oracleAddress, _OracleLayer1GasFeeFlow_signTransaction, _OracleLayer1GasFeeFlow_getOracleLayer1GasFee, _OracleLayer1GasFeeFlow_buildUnserializedTransaction, _OracleLayer1GasFeeFlow_buildTransactionParams, _OracleLayer1GasFeeFlow_buildTransactionCommon;
13
+ var _OracleLayer1GasFeeFlow_instances, _OracleLayer1GasFeeFlow_oracleAddress, _OracleLayer1GasFeeFlow_signTransaction, _OracleLayer1GasFeeFlow_getOracleLayer1GasFee, _OracleLayer1GasFeeFlow_buildUnserializedTransaction, _OracleLayer1GasFeeFlow_buildTransactionParams;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.OracleLayer1GasFeeFlow = void 0;
16
- const common_1 = require("@ethereumjs/common");
17
- const tx_1 = require("@ethereumjs/tx");
18
16
  const contracts_1 = require("@ethersproject/contracts");
19
17
  const providers_1 = require("@ethersproject/providers");
20
18
  const utils_1 = require("@metamask/utils");
21
19
  const lodash_1 = require("lodash");
22
20
  const logger_1 = require("../logger.cjs");
21
+ const prepare_1 = require("../utils/prepare.cjs");
23
22
  const log = (0, utils_1.createModuleLogger)(logger_1.projectLogger, 'oracle-layer1-gas-fee-flow');
24
23
  const DUMMY_KEY = 'abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789';
25
24
  const GAS_PRICE_ORACLE_ABI = [
@@ -68,10 +67,8 @@ _OracleLayer1GasFeeFlow_oracleAddress = new WeakMap(), _OracleLayer1GasFeeFlow_s
68
67
  };
69
68
  }, _OracleLayer1GasFeeFlow_buildUnserializedTransaction = function _OracleLayer1GasFeeFlow_buildUnserializedTransaction(transactionMeta, sign) {
70
69
  const txParams = __classPrivateFieldGet(this, _OracleLayer1GasFeeFlow_instances, "m", _OracleLayer1GasFeeFlow_buildTransactionParams).call(this, transactionMeta);
71
- const common = __classPrivateFieldGet(this, _OracleLayer1GasFeeFlow_instances, "m", _OracleLayer1GasFeeFlow_buildTransactionCommon).call(this, transactionMeta);
72
- let unserializedTransaction = tx_1.TransactionFactory.fromTxData(txParams, {
73
- common,
74
- });
70
+ const { chainId } = transactionMeta;
71
+ let unserializedTransaction = (0, prepare_1.prepareTransaction)(chainId, txParams);
75
72
  if (sign) {
76
73
  const keyBuffer = Buffer.from(DUMMY_KEY, 'hex');
77
74
  unserializedTransaction = unserializedTransaction.sign(keyBuffer);
@@ -82,11 +79,5 @@ _OracleLayer1GasFeeFlow_oracleAddress = new WeakMap(), _OracleLayer1GasFeeFlow_s
82
79
  ...(0, lodash_1.omit)(transactionMeta.txParams, 'gas'),
83
80
  gasLimit: transactionMeta.txParams.gas,
84
81
  };
85
- }, _OracleLayer1GasFeeFlow_buildTransactionCommon = function _OracleLayer1GasFeeFlow_buildTransactionCommon(transactionMeta) {
86
- const chainId = Number(transactionMeta.chainId);
87
- return common_1.Common.custom({
88
- chainId,
89
- defaultHardfork: common_1.Hardfork.London,
90
- });
91
82
  };
92
83
  //# sourceMappingURL=OracleLayer1GasFeeFlow.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"OracleLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsD;AACtD,uCAAoD;AACpD,wDAAoD;AACpD,wDAA+E;AAE/E,2CAAqD;AACrD,mCAA8B;AAE9B,0CAA0C;AAQ1C,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAa,EAAE,4BAA4B,CAAC,CAAC;AAE5E,MAAM,SAAS,GACb,kEAAkE,CAAC;AAErE,MAAM,oBAAoB,GAAG;IAC3B;QACE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACjE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACjE,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;CACF,CAAC;AAEF;;GAEG;AACH,MAAsB,sBAAsB;IAK1C,YAAY,aAAkB,EAAE,eAAyB;;QAJzD,wDAAoB;QAEpB,0DAA0B;QAGxB,uBAAA,IAAI,yCAAkB,aAAa,MAAA,CAAC;QACpC,uBAAA,IAAI,2CAAoB,eAAe,IAAI,KAAK,MAAA,CAAC;IACnD,CAAC;IAID,KAAK,CAAC,YAAY,CAChB,OAAgC;QAEhC,IAAI;YACF,OAAO,MAAM,uBAAA,IAAI,wFAAuB,MAA3B,IAAI,EAAwB,OAAO,CAAC,CAAC;SACnD;QAAC,OAAO,KAAK,EAAE;YACd,GAAG,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SACzD;IACH,CAAC;CAkEF;AAvFD,wDAuFC;mNAhEC,KAAK,wDACH,OAAgC;IAEhC,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAE9C,MAAM,QAAQ,GAAG,IAAI,oBAAQ,CAC3B,uBAAA,IAAI,6CAAe,EACnB,oBAAoB;IACpB,wEAAwE;IACxE,IAAI,wBAAY,CAAC,QAAuC,CAAC,CAC1D,CAAC;IAEF,MAAM,qBAAqB,GAAG,uBAAA,IAAI,+FAA8B,MAAlC,IAAI,EAChC,eAAe,EACf,uBAAA,IAAI,+CAAiB,CACtB,CAAC,SAAS,EAAE,CAAC;IAEd,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IAE9D,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC3D;IAED,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;KAChC,CAAC;AACJ,CAAC,uHAGC,eAAgC,EAChC,IAAa;IAEb,MAAM,QAAQ,GAAG,uBAAA,IAAI,yFAAwB,MAA5B,IAAI,EAAyB,eAAe,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,uBAAA,IAAI,yFAAwB,MAA5B,IAAI,EAAyB,eAAe,CAAC,CAAC;IAE7D,IAAI,uBAAuB,GAAG,uBAAkB,CAAC,UAAU,CAAC,QAAQ,EAAE;QACpE,MAAM;KACP,CAAC,CAAC;IAEH,IAAI,IAAI,EAAE;QACR,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAChD,uBAAuB,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KACnE;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC,2GAGC,eAAgC;IAEhC,OAAO;QACL,GAAG,IAAA,aAAI,EAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC;QACxC,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG;KACvC,CAAC;AACJ,CAAC,2GAEuB,eAAgC;IACtD,MAAM,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAEhD,OAAO,eAAM,CAAC,MAAM,CAAC;QACnB,OAAO;QACP,eAAe,EAAE,iBAAQ,CAAC,MAAM;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Common, Hardfork } from '@ethereumjs/common';\nimport { TransactionFactory } from '@ethereumjs/tx';\nimport { Contract } from '@ethersproject/contracts';\nimport { Web3Provider, type ExternalProvider } from '@ethersproject/providers';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\nimport { omit } from 'lodash';\n\nimport { projectLogger } from '../logger';\nimport type {\n Layer1GasFeeFlow,\n Layer1GasFeeFlowRequest,\n Layer1GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\n\nconst log = createModuleLogger(projectLogger, 'oracle-layer1-gas-fee-flow');\n\nconst DUMMY_KEY =\n 'abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789';\n\nconst GAS_PRICE_ORACLE_ABI = [\n {\n inputs: [{ internalType: 'bytes', name: '_data', type: 'bytes' }],\n name: 'getL1Fee',\n outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n];\n\n/**\n * Layer 1 gas fee flow that obtains gas fee estimate using an oracle smart contract.\n */\nexport abstract class OracleLayer1GasFeeFlow implements Layer1GasFeeFlow {\n #oracleAddress: Hex;\n\n #signTransaction: boolean;\n\n constructor(oracleAddress: Hex, signTransaction?: boolean) {\n this.#oracleAddress = oracleAddress;\n this.#signTransaction = signTransaction ?? false;\n }\n\n abstract matchesTransaction(transactionMeta: TransactionMeta): boolean;\n\n async getLayer1Fee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n try {\n return await this.#getOracleLayer1GasFee(request);\n } catch (error) {\n log('Failed to get oracle layer 1 gas fee', error);\n throw new Error(`Failed to get oracle layer 1 gas fee`);\n }\n }\n\n async #getOracleLayer1GasFee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n const { provider, transactionMeta } = request;\n\n const contract = new Contract(\n this.#oracleAddress,\n GAS_PRICE_ORACLE_ABI,\n // Network controller provider type is incompatible with ethers provider\n new Web3Provider(provider as unknown as ExternalProvider),\n );\n\n const serializedTransaction = this.#buildUnserializedTransaction(\n transactionMeta,\n this.#signTransaction,\n ).serialize();\n\n const result = await contract.getL1Fee(serializedTransaction);\n\n if (result === undefined) {\n throw new Error('No value returned from oracle contract');\n }\n\n return {\n layer1Fee: result.toHexString(),\n };\n }\n\n #buildUnserializedTransaction(\n transactionMeta: TransactionMeta,\n sign: boolean,\n ) {\n const txParams = this.#buildTransactionParams(transactionMeta);\n const common = this.#buildTransactionCommon(transactionMeta);\n\n let unserializedTransaction = TransactionFactory.fromTxData(txParams, {\n common,\n });\n\n if (sign) {\n const keyBuffer = Buffer.from(DUMMY_KEY, 'hex');\n unserializedTransaction = unserializedTransaction.sign(keyBuffer);\n }\n\n return unserializedTransaction;\n }\n\n #buildTransactionParams(\n transactionMeta: TransactionMeta,\n ): TransactionMeta['txParams'] {\n return {\n ...omit(transactionMeta.txParams, 'gas'),\n gasLimit: transactionMeta.txParams.gas,\n };\n }\n\n #buildTransactionCommon(transactionMeta: TransactionMeta) {\n const chainId = Number(transactionMeta.chainId);\n\n return Common.custom({\n chainId,\n defaultHardfork: Hardfork.London,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"OracleLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAoD;AACpD,wDAA+E;AAE/E,2CAAqD;AACrD,mCAA8B;AAE9B,0CAA0C;AAO1C,kDAAsD;AAEtD,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAa,EAAE,4BAA4B,CAAC,CAAC;AAE5E,MAAM,SAAS,GACb,kEAAkE,CAAC;AAErE,MAAM,oBAAoB,GAAG;IAC3B;QACE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACjE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACjE,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;CACF,CAAC;AAEF;;GAEG;AACH,MAAsB,sBAAsB;IAK1C,YAAY,aAAkB,EAAE,eAAyB;;QAJhD,wDAAoB;QAEpB,0DAA0B;QAGjC,uBAAA,IAAI,yCAAkB,aAAa,MAAA,CAAC;QACpC,uBAAA,IAAI,2CAAoB,eAAe,IAAI,KAAK,MAAA,CAAC;IACnD,CAAC;IAID,KAAK,CAAC,YAAY,CAChB,OAAgC;QAEhC,IAAI;YACF,OAAO,MAAM,uBAAA,IAAI,wFAAuB,MAA3B,IAAI,EAAwB,OAAO,CAAC,CAAC;SACnD;QAAC,OAAO,KAAK,EAAE;YACd,GAAG,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SACzD;IACH,CAAC;CAuDF;AA5ED,wDA4EC;mNArDC,KAAK,wDACH,OAAgC;IAEhC,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAE9C,MAAM,QAAQ,GAAG,IAAI,oBAAQ,CAC3B,uBAAA,IAAI,6CAAe,EACnB,oBAAoB;IACpB,wEAAwE;IACxE,IAAI,wBAAY,CAAC,QAAuC,CAAC,CAC1D,CAAC;IAEF,MAAM,qBAAqB,GAAG,uBAAA,IAAI,+FAA8B,MAAlC,IAAI,EAChC,eAAe,EACf,uBAAA,IAAI,+CAAiB,CACtB,CAAC,SAAS,EAAE,CAAC;IAEd,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IAE9D,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC3D;IAED,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;KAChC,CAAC;AACJ,CAAC,uHAGC,eAAgC,EAChC,IAAa;IAEb,MAAM,QAAQ,GAAG,uBAAA,IAAI,yFAAwB,MAA5B,IAAI,EAAyB,eAAe,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC;IAEpC,IAAI,uBAAuB,GAAG,IAAA,4BAAkB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEpE,IAAI,IAAI,EAAE;QACR,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAChD,uBAAuB,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KACnE;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC,2GAGC,eAAgC;IAEhC,OAAO;QACL,GAAG,IAAA,aAAI,EAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC;QACxC,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG;KACvC,CAAC;AACJ,CAAC","sourcesContent":["import { Contract } from '@ethersproject/contracts';\nimport { Web3Provider, type ExternalProvider } from '@ethersproject/providers';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\nimport { omit } from 'lodash';\n\nimport { projectLogger } from '../logger';\nimport type {\n Layer1GasFeeFlow,\n Layer1GasFeeFlowRequest,\n Layer1GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\nimport { prepareTransaction } from '../utils/prepare';\n\nconst log = createModuleLogger(projectLogger, 'oracle-layer1-gas-fee-flow');\n\nconst DUMMY_KEY =\n 'abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789';\n\nconst GAS_PRICE_ORACLE_ABI = [\n {\n inputs: [{ internalType: 'bytes', name: '_data', type: 'bytes' }],\n name: 'getL1Fee',\n outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n];\n\n/**\n * Layer 1 gas fee flow that obtains gas fee estimate using an oracle smart contract.\n */\nexport abstract class OracleLayer1GasFeeFlow implements Layer1GasFeeFlow {\n readonly #oracleAddress: Hex;\n\n readonly #signTransaction: boolean;\n\n constructor(oracleAddress: Hex, signTransaction?: boolean) {\n this.#oracleAddress = oracleAddress;\n this.#signTransaction = signTransaction ?? false;\n }\n\n abstract matchesTransaction(transactionMeta: TransactionMeta): boolean;\n\n async getLayer1Fee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n try {\n return await this.#getOracleLayer1GasFee(request);\n } catch (error) {\n log('Failed to get oracle layer 1 gas fee', error);\n throw new Error(`Failed to get oracle layer 1 gas fee`);\n }\n }\n\n async #getOracleLayer1GasFee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n const { provider, transactionMeta } = request;\n\n const contract = new Contract(\n this.#oracleAddress,\n GAS_PRICE_ORACLE_ABI,\n // Network controller provider type is incompatible with ethers provider\n new Web3Provider(provider as unknown as ExternalProvider),\n );\n\n const serializedTransaction = this.#buildUnserializedTransaction(\n transactionMeta,\n this.#signTransaction,\n ).serialize();\n\n const result = await contract.getL1Fee(serializedTransaction);\n\n if (result === undefined) {\n throw new Error('No value returned from oracle contract');\n }\n\n return {\n layer1Fee: result.toHexString(),\n };\n }\n\n #buildUnserializedTransaction(\n transactionMeta: TransactionMeta,\n sign: boolean,\n ) {\n const txParams = this.#buildTransactionParams(transactionMeta);\n const { chainId } = transactionMeta;\n\n let unserializedTransaction = prepareTransaction(chainId, txParams);\n\n if (sign) {\n const keyBuffer = Buffer.from(DUMMY_KEY, 'hex');\n unserializedTransaction = unserializedTransaction.sign(keyBuffer);\n }\n\n return unserializedTransaction;\n }\n\n #buildTransactionParams(\n transactionMeta: TransactionMeta,\n ): TransactionMeta['txParams'] {\n return {\n ...omit(transactionMeta.txParams, 'gas'),\n gasLimit: transactionMeta.txParams.gas,\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"OracleLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAK3C,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAiBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;IAEhE,YAAY,CAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CAyErC"}
1
+ {"version":3,"file":"OracleLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAK3C,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAkBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;IAEhE,YAAY,CAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CA8DrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"OracleLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAK3C,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAiBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;IAEhE,YAAY,CAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CAyErC"}
1
+ {"version":3,"file":"OracleLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAK3C,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAkBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;IAEhE,YAAY,CAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CA8DrC"}
@@ -9,15 +9,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _OracleLayer1GasFeeFlow_instances, _OracleLayer1GasFeeFlow_oracleAddress, _OracleLayer1GasFeeFlow_signTransaction, _OracleLayer1GasFeeFlow_getOracleLayer1GasFee, _OracleLayer1GasFeeFlow_buildUnserializedTransaction, _OracleLayer1GasFeeFlow_buildTransactionParams, _OracleLayer1GasFeeFlow_buildTransactionCommon;
13
- import { Common, Hardfork } from "@ethereumjs/common";
14
- import { TransactionFactory } from "@ethereumjs/tx";
12
+ var _OracleLayer1GasFeeFlow_instances, _OracleLayer1GasFeeFlow_oracleAddress, _OracleLayer1GasFeeFlow_signTransaction, _OracleLayer1GasFeeFlow_getOracleLayer1GasFee, _OracleLayer1GasFeeFlow_buildUnserializedTransaction, _OracleLayer1GasFeeFlow_buildTransactionParams;
15
13
  import { Contract } from "@ethersproject/contracts";
16
14
  import { Web3Provider } from "@ethersproject/providers";
17
15
  import { createModuleLogger } from "@metamask/utils";
18
16
  import $lodash from "lodash";
19
17
  const { omit } = $lodash;
20
18
  import { projectLogger } from "../logger.mjs";
19
+ import { prepareTransaction } from "../utils/prepare.mjs";
21
20
  const log = createModuleLogger(projectLogger, 'oracle-layer1-gas-fee-flow');
22
21
  const DUMMY_KEY = 'abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789';
23
22
  const GAS_PRICE_ORACLE_ABI = [
@@ -65,10 +64,8 @@ _OracleLayer1GasFeeFlow_oracleAddress = new WeakMap(), _OracleLayer1GasFeeFlow_s
65
64
  };
66
65
  }, _OracleLayer1GasFeeFlow_buildUnserializedTransaction = function _OracleLayer1GasFeeFlow_buildUnserializedTransaction(transactionMeta, sign) {
67
66
  const txParams = __classPrivateFieldGet(this, _OracleLayer1GasFeeFlow_instances, "m", _OracleLayer1GasFeeFlow_buildTransactionParams).call(this, transactionMeta);
68
- const common = __classPrivateFieldGet(this, _OracleLayer1GasFeeFlow_instances, "m", _OracleLayer1GasFeeFlow_buildTransactionCommon).call(this, transactionMeta);
69
- let unserializedTransaction = TransactionFactory.fromTxData(txParams, {
70
- common,
71
- });
67
+ const { chainId } = transactionMeta;
68
+ let unserializedTransaction = prepareTransaction(chainId, txParams);
72
69
  if (sign) {
73
70
  const keyBuffer = Buffer.from(DUMMY_KEY, 'hex');
74
71
  unserializedTransaction = unserializedTransaction.sign(keyBuffer);
@@ -79,11 +76,5 @@ _OracleLayer1GasFeeFlow_oracleAddress = new WeakMap(), _OracleLayer1GasFeeFlow_s
79
76
  ...omit(transactionMeta.txParams, 'gas'),
80
77
  gasLimit: transactionMeta.txParams.gas,
81
78
  };
82
- }, _OracleLayer1GasFeeFlow_buildTransactionCommon = function _OracleLayer1GasFeeFlow_buildTransactionCommon(transactionMeta) {
83
- const chainId = Number(transactionMeta.chainId);
84
- return Common.custom({
85
- chainId,
86
- defaultHardfork: Hardfork.London,
87
- });
88
79
  };
89
80
  //# sourceMappingURL=OracleLayer1GasFeeFlow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"OracleLayer1GasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"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","sourcesContent":["import { Common, Hardfork } from '@ethereumjs/common';\nimport { TransactionFactory } from '@ethereumjs/tx';\nimport { Contract } from '@ethersproject/contracts';\nimport { Web3Provider, type ExternalProvider } from '@ethersproject/providers';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\nimport { omit } from 'lodash';\n\nimport { projectLogger } from '../logger';\nimport type {\n Layer1GasFeeFlow,\n Layer1GasFeeFlowRequest,\n Layer1GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\n\nconst log = createModuleLogger(projectLogger, 'oracle-layer1-gas-fee-flow');\n\nconst DUMMY_KEY =\n 'abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789';\n\nconst GAS_PRICE_ORACLE_ABI = [\n {\n inputs: [{ internalType: 'bytes', name: '_data', type: 'bytes' }],\n name: 'getL1Fee',\n outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n];\n\n/**\n * Layer 1 gas fee flow that obtains gas fee estimate using an oracle smart contract.\n */\nexport abstract class OracleLayer1GasFeeFlow implements Layer1GasFeeFlow {\n #oracleAddress: Hex;\n\n #signTransaction: boolean;\n\n constructor(oracleAddress: Hex, signTransaction?: boolean) {\n this.#oracleAddress = oracleAddress;\n this.#signTransaction = signTransaction ?? false;\n }\n\n abstract matchesTransaction(transactionMeta: TransactionMeta): boolean;\n\n async getLayer1Fee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n try {\n return await this.#getOracleLayer1GasFee(request);\n } catch (error) {\n log('Failed to get oracle layer 1 gas fee', error);\n throw new Error(`Failed to get oracle layer 1 gas fee`);\n }\n }\n\n async #getOracleLayer1GasFee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n const { provider, transactionMeta } = request;\n\n const contract = new Contract(\n this.#oracleAddress,\n GAS_PRICE_ORACLE_ABI,\n // Network controller provider type is incompatible with ethers provider\n new Web3Provider(provider as unknown as ExternalProvider),\n );\n\n const serializedTransaction = this.#buildUnserializedTransaction(\n transactionMeta,\n this.#signTransaction,\n ).serialize();\n\n const result = await contract.getL1Fee(serializedTransaction);\n\n if (result === undefined) {\n throw new Error('No value returned from oracle contract');\n }\n\n return {\n layer1Fee: result.toHexString(),\n };\n }\n\n #buildUnserializedTransaction(\n transactionMeta: TransactionMeta,\n sign: boolean,\n ) {\n const txParams = this.#buildTransactionParams(transactionMeta);\n const common = this.#buildTransactionCommon(transactionMeta);\n\n let unserializedTransaction = TransactionFactory.fromTxData(txParams, {\n common,\n });\n\n if (sign) {\n const keyBuffer = Buffer.from(DUMMY_KEY, 'hex');\n unserializedTransaction = unserializedTransaction.sign(keyBuffer);\n }\n\n return unserializedTransaction;\n }\n\n #buildTransactionParams(\n transactionMeta: TransactionMeta,\n ): TransactionMeta['txParams'] {\n return {\n ...omit(transactionMeta.txParams, 'gas'),\n gasLimit: transactionMeta.txParams.gas,\n };\n }\n\n #buildTransactionCommon(transactionMeta: TransactionMeta) {\n const chainId = Number(transactionMeta.chainId);\n\n return Common.custom({\n chainId,\n defaultHardfork: Hardfork.London,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"OracleLayer1GasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"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","sourcesContent":["import { Contract } from '@ethersproject/contracts';\nimport { Web3Provider, type ExternalProvider } from '@ethersproject/providers';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\nimport { omit } from 'lodash';\n\nimport { projectLogger } from '../logger';\nimport type {\n Layer1GasFeeFlow,\n Layer1GasFeeFlowRequest,\n Layer1GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\nimport { prepareTransaction } from '../utils/prepare';\n\nconst log = createModuleLogger(projectLogger, 'oracle-layer1-gas-fee-flow');\n\nconst DUMMY_KEY =\n 'abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789';\n\nconst GAS_PRICE_ORACLE_ABI = [\n {\n inputs: [{ internalType: 'bytes', name: '_data', type: 'bytes' }],\n name: 'getL1Fee',\n outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n];\n\n/**\n * Layer 1 gas fee flow that obtains gas fee estimate using an oracle smart contract.\n */\nexport abstract class OracleLayer1GasFeeFlow implements Layer1GasFeeFlow {\n readonly #oracleAddress: Hex;\n\n readonly #signTransaction: boolean;\n\n constructor(oracleAddress: Hex, signTransaction?: boolean) {\n this.#oracleAddress = oracleAddress;\n this.#signTransaction = signTransaction ?? false;\n }\n\n abstract matchesTransaction(transactionMeta: TransactionMeta): boolean;\n\n async getLayer1Fee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n try {\n return await this.#getOracleLayer1GasFee(request);\n } catch (error) {\n log('Failed to get oracle layer 1 gas fee', error);\n throw new Error(`Failed to get oracle layer 1 gas fee`);\n }\n }\n\n async #getOracleLayer1GasFee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n const { provider, transactionMeta } = request;\n\n const contract = new Contract(\n this.#oracleAddress,\n GAS_PRICE_ORACLE_ABI,\n // Network controller provider type is incompatible with ethers provider\n new Web3Provider(provider as unknown as ExternalProvider),\n );\n\n const serializedTransaction = this.#buildUnserializedTransaction(\n transactionMeta,\n this.#signTransaction,\n ).serialize();\n\n const result = await contract.getL1Fee(serializedTransaction);\n\n if (result === undefined) {\n throw new Error('No value returned from oracle contract');\n }\n\n return {\n layer1Fee: result.toHexString(),\n };\n }\n\n #buildUnserializedTransaction(\n transactionMeta: TransactionMeta,\n sign: boolean,\n ) {\n const txParams = this.#buildTransactionParams(transactionMeta);\n const { chainId } = transactionMeta;\n\n let unserializedTransaction = prepareTransaction(chainId, txParams);\n\n if (sign) {\n const keyBuffer = Buffer.from(DUMMY_KEY, 'hex');\n unserializedTransaction = unserializedTransaction.sign(keyBuffer);\n }\n\n return unserializedTransaction;\n }\n\n #buildTransactionParams(\n transactionMeta: TransactionMeta,\n ): TransactionMeta['txParams'] {\n return {\n ...omit(transactionMeta.txParams, 'gas'),\n gasLimit: transactionMeta.txParams.gas,\n };\n }\n}\n"]}
package/dist/index.cjs CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS = exports.CHAIN_IDS = exports.normalizeTransactionParams = exports.isEIP1559Transaction = exports.mergeGasFeeEstimates = exports.determineTransactionType = exports.MAX_TRANSACTION_HISTORY_LENGTH = exports.DISPLAYED_TRANSACTION_HISTORY_PATHS = exports.WalletDevice = exports.UserFeeLevel = exports.TransactionType = exports.TransactionStatus = exports.TransactionEnvelopeType = exports.SimulationTokenStandard = exports.SimulationErrorCode = exports.GasFeeEstimateType = exports.GasFeeEstimateLevel = exports.TransactionController = exports.SPEED_UP_RATE = exports.CANCEL_RATE = exports.HARDFORK = void 0;
3
+ exports.HARDFORK = exports.INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS = exports.CHAIN_IDS = exports.normalizeTransactionParams = exports.isEIP1559Transaction = exports.mergeGasFeeEstimates = exports.determineTransactionType = exports.MAX_TRANSACTION_HISTORY_LENGTH = exports.DISPLAYED_TRANSACTION_HISTORY_PATHS = exports.WalletDevice = exports.UserFeeLevel = exports.TransactionType = exports.TransactionStatus = exports.TransactionEnvelopeType = exports.SimulationTokenStandard = exports.SimulationErrorCode = exports.GasFeeEstimateType = exports.GasFeeEstimateLevel = exports.TransactionController = exports.SPEED_UP_RATE = exports.CANCEL_RATE = void 0;
4
4
  var TransactionController_1 = require("./TransactionController.cjs");
5
- Object.defineProperty(exports, "HARDFORK", { enumerable: true, get: function () { return TransactionController_1.HARDFORK; } });
6
5
  Object.defineProperty(exports, "CANCEL_RATE", { enumerable: true, get: function () { return TransactionController_1.CANCEL_RATE; } });
7
6
  Object.defineProperty(exports, "SPEED_UP_RATE", { enumerable: true, get: function () { return TransactionController_1.SPEED_UP_RATE; } });
8
7
  Object.defineProperty(exports, "TransactionController", { enumerable: true, get: function () { return TransactionController_1.TransactionController; } });
@@ -30,4 +29,6 @@ var constants_1 = require("./constants.cjs");
30
29
  Object.defineProperty(exports, "CHAIN_IDS", { enumerable: true, get: function () { return constants_1.CHAIN_IDS; } });
31
30
  var AccountsApiRemoteTransactionSource_1 = require("./helpers/AccountsApiRemoteTransactionSource.cjs");
32
31
  Object.defineProperty(exports, "INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS", { enumerable: true, get: function () { return AccountsApiRemoteTransactionSource_1.SUPPORTED_CHAIN_IDS; } });
32
+ var prepare_1 = require("./utils/prepare.cjs");
33
+ Object.defineProperty(exports, "HARDFORK", { enumerable: true, get: function () { return prepare_1.HARDFORK; } });
33
34
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA0BA,qEAKiC;AAJ/B,iHAAA,QAAQ,OAAA;AACR,oHAAA,WAAW,OAAA;AACX,sHAAA,aAAa,OAAA;AACb,8HAAA,qBAAqB,OAAA;AA8BvB,qCAUiB;AATf,4GAAA,mBAAmB,OAAA;AACnB,2GAAA,kBAAkB,OAAA;AAClB,4GAAA,mBAAmB,OAAA;AACnB,gHAAA,uBAAuB,OAAA;AACvB,gHAAA,uBAAuB,OAAA;AACvB,0GAAA,iBAAiB,OAAA;AACjB,wGAAA,eAAe,OAAA;AACf,qGAAA,YAAY,OAAA;AACZ,qGAAA,YAAY,OAAA;AAEd,+CAGyB;AAFvB,8HAAA,mCAAmC,OAAA;AACnC,yHAAA,8BAA8B,OAAA;AAEhC,iEAAoE;AAA3D,4HAAA,wBAAwB,OAAA;AACjC,iDAAwD;AAA/C,gHAAA,oBAAoB,OAAA;AAC7B,2CAGuB;AAFrB,6GAAA,oBAAoB,OAAA;AACpB,mHAAA,0BAA0B,OAAA;AAE5B,6CAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,uGAAgI;AAAvH,+JAAA,mBAAmB,OAA6C","sourcesContent":["export type {\n MethodData,\n Result,\n TransactionControllerActions,\n TransactionControllerEvents,\n TransactionControllerGetStateAction,\n TransactionControllerIncomingTransactionsReceivedEvent,\n TransactionControllerPostTransactionBalanceUpdatedEvent,\n TransactionControllerSpeedupTransactionAddedEvent,\n TransactionControllerState,\n TransactionControllerStateChangeEvent,\n TransactionControllerTransactionApprovedEvent,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionDroppedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionControllerTransactionFinishedEvent,\n TransactionControllerTransactionNewSwapApprovalEvent,\n TransactionControllerTransactionNewSwapEvent,\n TransactionControllerTransactionPublishingSkipped,\n TransactionControllerTransactionRejectedEvent,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUnapprovedTransactionAddedEvent,\n TransactionControllerMessenger,\n TransactionControllerOptions,\n} from './TransactionController';\nexport {\n HARDFORK,\n CANCEL_RATE,\n SPEED_UP_RATE,\n TransactionController,\n} from './TransactionController';\nexport type {\n DappSuggestedGasFees,\n DefaultGasEstimates,\n FeeMarketEIP1559Values,\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasPriceGasFeeEstimates,\n GasPriceValue,\n InferTransactionTypeResult,\n LegacyGasFeeEstimates,\n Log,\n SavedGasFees,\n SecurityAlertResponse,\n SecurityProviderRequest,\n SendFlowHistoryEntry,\n SimulationBalanceChange,\n SimulationData,\n SimulationError,\n SimulationToken,\n SimulationTokenBalanceChange,\n TransactionError,\n TransactionHistory,\n TransactionHistoryEntry,\n TransactionMeta,\n TransactionParams,\n TransactionReceipt,\n} from './types';\nexport {\n GasFeeEstimateLevel,\n GasFeeEstimateType,\n SimulationErrorCode,\n SimulationTokenStandard,\n TransactionEnvelopeType,\n TransactionStatus,\n TransactionType,\n UserFeeLevel,\n WalletDevice,\n} from './types';\nexport {\n DISPLAYED_TRANSACTION_HISTORY_PATHS,\n MAX_TRANSACTION_HISTORY_LENGTH,\n} from './utils/history';\nexport { determineTransactionType } from './utils/transaction-type';\nexport { mergeGasFeeEstimates } from './utils/gas-flow';\nexport {\n isEIP1559Transaction,\n normalizeTransactionParams,\n} from './utils/utils';\nexport { CHAIN_IDS } from './constants';\nexport { SUPPORTED_CHAIN_IDS as INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS } from './helpers/AccountsApiRemoteTransactionSource';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA0BA,qEAIiC;AAH/B,oHAAA,WAAW,OAAA;AACX,sHAAA,aAAa,OAAA;AACb,8HAAA,qBAAqB,OAAA;AAmCvB,qCAUiB;AATf,4GAAA,mBAAmB,OAAA;AACnB,2GAAA,kBAAkB,OAAA;AAClB,4GAAA,mBAAmB,OAAA;AACnB,gHAAA,uBAAuB,OAAA;AACvB,gHAAA,uBAAuB,OAAA;AACvB,0GAAA,iBAAiB,OAAA;AACjB,wGAAA,eAAe,OAAA;AACf,qGAAA,YAAY,OAAA;AACZ,qGAAA,YAAY,OAAA;AAEd,+CAGyB;AAFvB,8HAAA,mCAAmC,OAAA;AACnC,yHAAA,8BAA8B,OAAA;AAEhC,iEAAoE;AAA3D,4HAAA,wBAAwB,OAAA;AACjC,iDAAwD;AAA/C,gHAAA,oBAAoB,OAAA;AAC7B,2CAGuB;AAFrB,6GAAA,oBAAoB,OAAA;AACpB,mHAAA,0BAA0B,OAAA;AAE5B,6CAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,uGAAgI;AAAvH,+JAAA,mBAAmB,OAA6C;AACzE,+CAA2C;AAAlC,mGAAA,QAAQ,OAAA","sourcesContent":["export type {\n MethodData,\n Result,\n TransactionControllerActions,\n TransactionControllerEvents,\n TransactionControllerGetStateAction,\n TransactionControllerIncomingTransactionsReceivedEvent,\n TransactionControllerPostTransactionBalanceUpdatedEvent,\n TransactionControllerSpeedupTransactionAddedEvent,\n TransactionControllerState,\n TransactionControllerStateChangeEvent,\n TransactionControllerTransactionApprovedEvent,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionDroppedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionControllerTransactionFinishedEvent,\n TransactionControllerTransactionNewSwapApprovalEvent,\n TransactionControllerTransactionNewSwapEvent,\n TransactionControllerTransactionPublishingSkipped,\n TransactionControllerTransactionRejectedEvent,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUnapprovedTransactionAddedEvent,\n TransactionControllerMessenger,\n TransactionControllerOptions,\n} from './TransactionController';\nexport {\n CANCEL_RATE,\n SPEED_UP_RATE,\n TransactionController,\n} from './TransactionController';\nexport type {\n Authorization,\n AuthorizationList,\n BatchTransactionParams,\n DappSuggestedGasFees,\n DefaultGasEstimates,\n FeeMarketEIP1559Values,\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasPriceGasFeeEstimates,\n GasPriceValue,\n InferTransactionTypeResult,\n LegacyGasFeeEstimates,\n Log,\n SavedGasFees,\n SecurityAlertResponse,\n SecurityProviderRequest,\n SendFlowHistoryEntry,\n SimulationBalanceChange,\n SimulationData,\n SimulationError,\n SimulationToken,\n SimulationTokenBalanceChange,\n TransactionBatchRequest,\n TransactionBatchResult,\n TransactionError,\n TransactionHistory,\n TransactionHistoryEntry,\n TransactionMeta,\n TransactionParams,\n TransactionReceipt,\n} from './types';\nexport {\n GasFeeEstimateLevel,\n GasFeeEstimateType,\n SimulationErrorCode,\n SimulationTokenStandard,\n TransactionEnvelopeType,\n TransactionStatus,\n TransactionType,\n UserFeeLevel,\n WalletDevice,\n} from './types';\nexport {\n DISPLAYED_TRANSACTION_HISTORY_PATHS,\n MAX_TRANSACTION_HISTORY_LENGTH,\n} from './utils/history';\nexport { determineTransactionType } from './utils/transaction-type';\nexport { mergeGasFeeEstimates } from './utils/gas-flow';\nexport {\n isEIP1559Transaction,\n normalizeTransactionParams,\n} from './utils/utils';\nexport { CHAIN_IDS } from './constants';\nexport { SUPPORTED_CHAIN_IDS as INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS } from './helpers/AccountsApiRemoteTransactionSource';\nexport { HARDFORK } from './utils/prepare';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { MethodData, Result, TransactionControllerActions, TransactionControllerEvents, TransactionControllerGetStateAction, TransactionControllerIncomingTransactionsReceivedEvent, TransactionControllerPostTransactionBalanceUpdatedEvent, TransactionControllerSpeedupTransactionAddedEvent, TransactionControllerState, TransactionControllerStateChangeEvent, TransactionControllerTransactionApprovedEvent, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionDroppedEvent, TransactionControllerTransactionFailedEvent, TransactionControllerTransactionFinishedEvent, TransactionControllerTransactionNewSwapApprovalEvent, TransactionControllerTransactionNewSwapEvent, TransactionControllerTransactionPublishingSkipped, TransactionControllerTransactionRejectedEvent, TransactionControllerTransactionStatusUpdatedEvent, TransactionControllerTransactionSubmittedEvent, TransactionControllerUnapprovedTransactionAddedEvent, TransactionControllerMessenger, TransactionControllerOptions, } from "./TransactionController.cjs";
2
- export { HARDFORK, CANCEL_RATE, SPEED_UP_RATE, TransactionController, } from "./TransactionController.cjs";
3
- export type { DappSuggestedGasFees, DefaultGasEstimates, FeeMarketEIP1559Values, FeeMarketGasFeeEstimateForLevel, FeeMarketGasFeeEstimates, GasFeeEstimates, GasPriceGasFeeEstimates, GasPriceValue, InferTransactionTypeResult, LegacyGasFeeEstimates, Log, SavedGasFees, SecurityAlertResponse, SecurityProviderRequest, SendFlowHistoryEntry, SimulationBalanceChange, SimulationData, SimulationError, SimulationToken, SimulationTokenBalanceChange, TransactionError, TransactionHistory, TransactionHistoryEntry, TransactionMeta, TransactionParams, TransactionReceipt, } from "./types.cjs";
2
+ export { CANCEL_RATE, SPEED_UP_RATE, TransactionController, } from "./TransactionController.cjs";
3
+ export type { Authorization, AuthorizationList, BatchTransactionParams, DappSuggestedGasFees, DefaultGasEstimates, FeeMarketEIP1559Values, FeeMarketGasFeeEstimateForLevel, FeeMarketGasFeeEstimates, GasFeeEstimates, GasPriceGasFeeEstimates, GasPriceValue, InferTransactionTypeResult, LegacyGasFeeEstimates, Log, SavedGasFees, SecurityAlertResponse, SecurityProviderRequest, SendFlowHistoryEntry, SimulationBalanceChange, SimulationData, SimulationError, SimulationToken, SimulationTokenBalanceChange, TransactionBatchRequest, TransactionBatchResult, TransactionError, TransactionHistory, TransactionHistoryEntry, TransactionMeta, TransactionParams, TransactionReceipt, } from "./types.cjs";
4
4
  export { GasFeeEstimateLevel, GasFeeEstimateType, SimulationErrorCode, SimulationTokenStandard, TransactionEnvelopeType, TransactionStatus, TransactionType, UserFeeLevel, WalletDevice, } from "./types.cjs";
5
5
  export { DISPLAYED_TRANSACTION_HISTORY_PATHS, MAX_TRANSACTION_HISTORY_LENGTH, } from "./utils/history.cjs";
6
6
  export { determineTransactionType } from "./utils/transaction-type.cjs";
@@ -8,4 +8,5 @@ export { mergeGasFeeEstimates } from "./utils/gas-flow.cjs";
8
8
  export { isEIP1559Transaction, normalizeTransactionParams, } from "./utils/utils.cjs";
9
9
  export { CHAIN_IDS } from "./constants.cjs";
10
10
  export { SUPPORTED_CHAIN_IDS as INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS } from "./helpers/AccountsApiRemoteTransactionSource.cjs";
11
+ export { HARDFORK } from "./utils/prepare.cjs";
11
12
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,MAAM,EACN,4BAA4B,EAC5B,2BAA2B,EAC3B,mCAAmC,EACnC,sDAAsD,EACtD,uDAAuD,EACvD,iDAAiD,EACjD,0BAA0B,EAC1B,qCAAqC,EACrC,6CAA6C,EAC7C,8CAA8C,EAC9C,4CAA4C,EAC5C,2CAA2C,EAC3C,6CAA6C,EAC7C,oDAAoD,EACpD,4CAA4C,EAC5C,iDAAiD,EACjD,6CAA6C,EAC7C,kDAAkD,EAClD,8CAA8C,EAC9C,oDAAoD,EACpD,8BAA8B,EAC9B,4BAA4B,GAC7B,oCAAgC;AACjC,OAAO,EACL,QAAQ,EACR,WAAW,EACX,aAAa,EACb,qBAAqB,GACtB,oCAAgC;AACjC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,EAC/B,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,GAAG,EACH,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,oBAAgB;AACjB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,GACb,oBAAgB;AACjB,OAAO,EACL,mCAAmC,EACnC,8BAA8B,GAC/B,4BAAwB;AACzB,OAAO,EAAE,wBAAwB,EAAE,qCAAiC;AACpE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,0BAAsB;AACvB,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,mBAAmB,IAAI,yCAAyC,EAAE,yDAAqD"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,MAAM,EACN,4BAA4B,EAC5B,2BAA2B,EAC3B,mCAAmC,EACnC,sDAAsD,EACtD,uDAAuD,EACvD,iDAAiD,EACjD,0BAA0B,EAC1B,qCAAqC,EACrC,6CAA6C,EAC7C,8CAA8C,EAC9C,4CAA4C,EAC5C,2CAA2C,EAC3C,6CAA6C,EAC7C,oDAAoD,EACpD,4CAA4C,EAC5C,iDAAiD,EACjD,6CAA6C,EAC7C,kDAAkD,EAClD,8CAA8C,EAC9C,oDAAoD,EACpD,8BAA8B,EAC9B,4BAA4B,GAC7B,oCAAgC;AACjC,OAAO,EACL,WAAW,EACX,aAAa,EACb,qBAAqB,GACtB,oCAAgC;AACjC,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,EAC/B,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,GAAG,EACH,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,oBAAgB;AACjB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,GACb,oBAAgB;AACjB,OAAO,EACL,mCAAmC,EACnC,8BAA8B,GAC/B,4BAAwB;AACzB,OAAO,EAAE,wBAAwB,EAAE,qCAAiC;AACpE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,0BAAsB;AACvB,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,mBAAmB,IAAI,yCAAyC,EAAE,yDAAqD;AAChI,OAAO,EAAE,QAAQ,EAAE,4BAAwB"}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { MethodData, Result, TransactionControllerActions, TransactionControllerEvents, TransactionControllerGetStateAction, TransactionControllerIncomingTransactionsReceivedEvent, TransactionControllerPostTransactionBalanceUpdatedEvent, TransactionControllerSpeedupTransactionAddedEvent, TransactionControllerState, TransactionControllerStateChangeEvent, TransactionControllerTransactionApprovedEvent, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionDroppedEvent, TransactionControllerTransactionFailedEvent, TransactionControllerTransactionFinishedEvent, TransactionControllerTransactionNewSwapApprovalEvent, TransactionControllerTransactionNewSwapEvent, TransactionControllerTransactionPublishingSkipped, TransactionControllerTransactionRejectedEvent, TransactionControllerTransactionStatusUpdatedEvent, TransactionControllerTransactionSubmittedEvent, TransactionControllerUnapprovedTransactionAddedEvent, TransactionControllerMessenger, TransactionControllerOptions, } from "./TransactionController.mjs";
2
- export { HARDFORK, CANCEL_RATE, SPEED_UP_RATE, TransactionController, } from "./TransactionController.mjs";
3
- export type { DappSuggestedGasFees, DefaultGasEstimates, FeeMarketEIP1559Values, FeeMarketGasFeeEstimateForLevel, FeeMarketGasFeeEstimates, GasFeeEstimates, GasPriceGasFeeEstimates, GasPriceValue, InferTransactionTypeResult, LegacyGasFeeEstimates, Log, SavedGasFees, SecurityAlertResponse, SecurityProviderRequest, SendFlowHistoryEntry, SimulationBalanceChange, SimulationData, SimulationError, SimulationToken, SimulationTokenBalanceChange, TransactionError, TransactionHistory, TransactionHistoryEntry, TransactionMeta, TransactionParams, TransactionReceipt, } from "./types.mjs";
2
+ export { CANCEL_RATE, SPEED_UP_RATE, TransactionController, } from "./TransactionController.mjs";
3
+ export type { Authorization, AuthorizationList, BatchTransactionParams, DappSuggestedGasFees, DefaultGasEstimates, FeeMarketEIP1559Values, FeeMarketGasFeeEstimateForLevel, FeeMarketGasFeeEstimates, GasFeeEstimates, GasPriceGasFeeEstimates, GasPriceValue, InferTransactionTypeResult, LegacyGasFeeEstimates, Log, SavedGasFees, SecurityAlertResponse, SecurityProviderRequest, SendFlowHistoryEntry, SimulationBalanceChange, SimulationData, SimulationError, SimulationToken, SimulationTokenBalanceChange, TransactionBatchRequest, TransactionBatchResult, TransactionError, TransactionHistory, TransactionHistoryEntry, TransactionMeta, TransactionParams, TransactionReceipt, } from "./types.mjs";
4
4
  export { GasFeeEstimateLevel, GasFeeEstimateType, SimulationErrorCode, SimulationTokenStandard, TransactionEnvelopeType, TransactionStatus, TransactionType, UserFeeLevel, WalletDevice, } from "./types.mjs";
5
5
  export { DISPLAYED_TRANSACTION_HISTORY_PATHS, MAX_TRANSACTION_HISTORY_LENGTH, } from "./utils/history.mjs";
6
6
  export { determineTransactionType } from "./utils/transaction-type.mjs";
@@ -8,4 +8,5 @@ export { mergeGasFeeEstimates } from "./utils/gas-flow.mjs";
8
8
  export { isEIP1559Transaction, normalizeTransactionParams, } from "./utils/utils.mjs";
9
9
  export { CHAIN_IDS } from "./constants.mjs";
10
10
  export { SUPPORTED_CHAIN_IDS as INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS } from "./helpers/AccountsApiRemoteTransactionSource.mjs";
11
+ export { HARDFORK } from "./utils/prepare.mjs";
11
12
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,MAAM,EACN,4BAA4B,EAC5B,2BAA2B,EAC3B,mCAAmC,EACnC,sDAAsD,EACtD,uDAAuD,EACvD,iDAAiD,EACjD,0BAA0B,EAC1B,qCAAqC,EACrC,6CAA6C,EAC7C,8CAA8C,EAC9C,4CAA4C,EAC5C,2CAA2C,EAC3C,6CAA6C,EAC7C,oDAAoD,EACpD,4CAA4C,EAC5C,iDAAiD,EACjD,6CAA6C,EAC7C,kDAAkD,EAClD,8CAA8C,EAC9C,oDAAoD,EACpD,8BAA8B,EAC9B,4BAA4B,GAC7B,oCAAgC;AACjC,OAAO,EACL,QAAQ,EACR,WAAW,EACX,aAAa,EACb,qBAAqB,GACtB,oCAAgC;AACjC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,EAC/B,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,GAAG,EACH,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,oBAAgB;AACjB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,GACb,oBAAgB;AACjB,OAAO,EACL,mCAAmC,EACnC,8BAA8B,GAC/B,4BAAwB;AACzB,OAAO,EAAE,wBAAwB,EAAE,qCAAiC;AACpE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,0BAAsB;AACvB,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,mBAAmB,IAAI,yCAAyC,EAAE,yDAAqD"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,MAAM,EACN,4BAA4B,EAC5B,2BAA2B,EAC3B,mCAAmC,EACnC,sDAAsD,EACtD,uDAAuD,EACvD,iDAAiD,EACjD,0BAA0B,EAC1B,qCAAqC,EACrC,6CAA6C,EAC7C,8CAA8C,EAC9C,4CAA4C,EAC5C,2CAA2C,EAC3C,6CAA6C,EAC7C,oDAAoD,EACpD,4CAA4C,EAC5C,iDAAiD,EACjD,6CAA6C,EAC7C,kDAAkD,EAClD,8CAA8C,EAC9C,oDAAoD,EACpD,8BAA8B,EAC9B,4BAA4B,GAC7B,oCAAgC;AACjC,OAAO,EACL,WAAW,EACX,aAAa,EACb,qBAAqB,GACtB,oCAAgC;AACjC,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,EAC/B,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,GAAG,EACH,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,oBAAgB;AACjB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,GACb,oBAAgB;AACjB,OAAO,EACL,mCAAmC,EACnC,8BAA8B,GAC/B,4BAAwB;AACzB,OAAO,EAAE,wBAAwB,EAAE,qCAAiC;AACpE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,0BAAsB;AACvB,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,mBAAmB,IAAI,yCAAyC,EAAE,yDAAqD;AAChI,OAAO,EAAE,QAAQ,EAAE,4BAAwB"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { HARDFORK, CANCEL_RATE, SPEED_UP_RATE, TransactionController } from "./TransactionController.mjs";
1
+ export { CANCEL_RATE, SPEED_UP_RATE, TransactionController } from "./TransactionController.mjs";
2
2
  export { GasFeeEstimateLevel, GasFeeEstimateType, SimulationErrorCode, SimulationTokenStandard, TransactionEnvelopeType, TransactionStatus, TransactionType, UserFeeLevel, WalletDevice } from "./types.mjs";
3
3
  export { DISPLAYED_TRANSACTION_HISTORY_PATHS, MAX_TRANSACTION_HISTORY_LENGTH } from "./utils/history.mjs";
4
4
  export { determineTransactionType } from "./utils/transaction-type.mjs";
@@ -6,4 +6,5 @@ export { mergeGasFeeEstimates } from "./utils/gas-flow.mjs";
6
6
  export { isEIP1559Transaction, normalizeTransactionParams } from "./utils/utils.mjs";
7
7
  export { CHAIN_IDS } from "./constants.mjs";
8
8
  export { SUPPORTED_CHAIN_IDS as INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS } from "./helpers/AccountsApiRemoteTransactionSource.mjs";
9
+ export { HARDFORK } from "./utils/prepare.mjs";
9
10
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0BA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,aAAa,EACb,qBAAqB,EACtB,oCAAgC;AA6BjC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACb,oBAAgB;AACjB,OAAO,EACL,mCAAmC,EACnC,8BAA8B,EAC/B,4BAAwB;AACzB,OAAO,EAAE,wBAAwB,EAAE,qCAAiC;AACpE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC3B,0BAAsB;AACvB,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,mBAAmB,IAAI,yCAAyC,EAAE,yDAAqD","sourcesContent":["export type {\n MethodData,\n Result,\n TransactionControllerActions,\n TransactionControllerEvents,\n TransactionControllerGetStateAction,\n TransactionControllerIncomingTransactionsReceivedEvent,\n TransactionControllerPostTransactionBalanceUpdatedEvent,\n TransactionControllerSpeedupTransactionAddedEvent,\n TransactionControllerState,\n TransactionControllerStateChangeEvent,\n TransactionControllerTransactionApprovedEvent,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionDroppedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionControllerTransactionFinishedEvent,\n TransactionControllerTransactionNewSwapApprovalEvent,\n TransactionControllerTransactionNewSwapEvent,\n TransactionControllerTransactionPublishingSkipped,\n TransactionControllerTransactionRejectedEvent,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUnapprovedTransactionAddedEvent,\n TransactionControllerMessenger,\n TransactionControllerOptions,\n} from './TransactionController';\nexport {\n HARDFORK,\n CANCEL_RATE,\n SPEED_UP_RATE,\n TransactionController,\n} from './TransactionController';\nexport type {\n DappSuggestedGasFees,\n DefaultGasEstimates,\n FeeMarketEIP1559Values,\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasPriceGasFeeEstimates,\n GasPriceValue,\n InferTransactionTypeResult,\n LegacyGasFeeEstimates,\n Log,\n SavedGasFees,\n SecurityAlertResponse,\n SecurityProviderRequest,\n SendFlowHistoryEntry,\n SimulationBalanceChange,\n SimulationData,\n SimulationError,\n SimulationToken,\n SimulationTokenBalanceChange,\n TransactionError,\n TransactionHistory,\n TransactionHistoryEntry,\n TransactionMeta,\n TransactionParams,\n TransactionReceipt,\n} from './types';\nexport {\n GasFeeEstimateLevel,\n GasFeeEstimateType,\n SimulationErrorCode,\n SimulationTokenStandard,\n TransactionEnvelopeType,\n TransactionStatus,\n TransactionType,\n UserFeeLevel,\n WalletDevice,\n} from './types';\nexport {\n DISPLAYED_TRANSACTION_HISTORY_PATHS,\n MAX_TRANSACTION_HISTORY_LENGTH,\n} from './utils/history';\nexport { determineTransactionType } from './utils/transaction-type';\nexport { mergeGasFeeEstimates } from './utils/gas-flow';\nexport {\n isEIP1559Transaction,\n normalizeTransactionParams,\n} from './utils/utils';\nexport { CHAIN_IDS } from './constants';\nexport { SUPPORTED_CHAIN_IDS as INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS } from './helpers/AccountsApiRemoteTransactionSource';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0BA,OAAO,EACL,WAAW,EACX,aAAa,EACb,qBAAqB,EACtB,oCAAgC;AAkCjC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACb,oBAAgB;AACjB,OAAO,EACL,mCAAmC,EACnC,8BAA8B,EAC/B,4BAAwB;AACzB,OAAO,EAAE,wBAAwB,EAAE,qCAAiC;AACpE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC3B,0BAAsB;AACvB,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,mBAAmB,IAAI,yCAAyC,EAAE,yDAAqD;AAChI,OAAO,EAAE,QAAQ,EAAE,4BAAwB","sourcesContent":["export type {\n MethodData,\n Result,\n TransactionControllerActions,\n TransactionControllerEvents,\n TransactionControllerGetStateAction,\n TransactionControllerIncomingTransactionsReceivedEvent,\n TransactionControllerPostTransactionBalanceUpdatedEvent,\n TransactionControllerSpeedupTransactionAddedEvent,\n TransactionControllerState,\n TransactionControllerStateChangeEvent,\n TransactionControllerTransactionApprovedEvent,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionDroppedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionControllerTransactionFinishedEvent,\n TransactionControllerTransactionNewSwapApprovalEvent,\n TransactionControllerTransactionNewSwapEvent,\n TransactionControllerTransactionPublishingSkipped,\n TransactionControllerTransactionRejectedEvent,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUnapprovedTransactionAddedEvent,\n TransactionControllerMessenger,\n TransactionControllerOptions,\n} from './TransactionController';\nexport {\n CANCEL_RATE,\n SPEED_UP_RATE,\n TransactionController,\n} from './TransactionController';\nexport type {\n Authorization,\n AuthorizationList,\n BatchTransactionParams,\n DappSuggestedGasFees,\n DefaultGasEstimates,\n FeeMarketEIP1559Values,\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasPriceGasFeeEstimates,\n GasPriceValue,\n InferTransactionTypeResult,\n LegacyGasFeeEstimates,\n Log,\n SavedGasFees,\n SecurityAlertResponse,\n SecurityProviderRequest,\n SendFlowHistoryEntry,\n SimulationBalanceChange,\n SimulationData,\n SimulationError,\n SimulationToken,\n SimulationTokenBalanceChange,\n TransactionBatchRequest,\n TransactionBatchResult,\n TransactionError,\n TransactionHistory,\n TransactionHistoryEntry,\n TransactionMeta,\n TransactionParams,\n TransactionReceipt,\n} from './types';\nexport {\n GasFeeEstimateLevel,\n GasFeeEstimateType,\n SimulationErrorCode,\n SimulationTokenStandard,\n TransactionEnvelopeType,\n TransactionStatus,\n TransactionType,\n UserFeeLevel,\n WalletDevice,\n} from './types';\nexport {\n DISPLAYED_TRANSACTION_HISTORY_PATHS,\n MAX_TRANSACTION_HISTORY_LENGTH,\n} from './utils/history';\nexport { determineTransactionType } from './utils/transaction-type';\nexport { mergeGasFeeEstimates } from './utils/gas-flow';\nexport {\n isEIP1559Transaction,\n normalizeTransactionParams,\n} from './utils/utils';\nexport { CHAIN_IDS } from './constants';\nexport { SUPPORTED_CHAIN_IDS as INCOMING_TRANSACTIONS_SUPPORTED_CHAIN_IDS } from './helpers/AccountsApiRemoteTransactionSource';\nexport { HARDFORK } from './utils/prepare';\n"]}
package/dist/types.cjs CHANGED
@@ -15,62 +15,44 @@ var TransactionStatus;
15
15
  /**
16
16
  * The initial state of a transaction before user approval.
17
17
  */
18
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
19
- // eslint-disable-next-line @typescript-eslint/naming-convention
20
18
  TransactionStatus["unapproved"] = "unapproved";
21
19
  /**
22
20
  * The transaction has been approved by the user but is not yet signed.
23
21
  * This status is usually brief but may be longer for scenarios like hardware wallet usage.
24
22
  */
25
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
26
- // eslint-disable-next-line @typescript-eslint/naming-convention
27
23
  TransactionStatus["approved"] = "approved";
28
24
  /**
29
25
  * The transaction is signed and in the process of being submitted to the network.
30
26
  * This status is typically short-lived but can be longer for certain cases, such as smart transactions.
31
27
  */
32
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
33
- // eslint-disable-next-line @typescript-eslint/naming-convention
34
28
  TransactionStatus["signed"] = "signed";
35
29
  /**
36
30
  * The transaction has been submitted to the network and is awaiting confirmation.
37
31
  */
38
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
39
- // eslint-disable-next-line @typescript-eslint/naming-convention
40
32
  TransactionStatus["submitted"] = "submitted";
41
33
  /**
42
34
  * The transaction has been successfully executed and confirmed on the blockchain.
43
35
  * This is a final state.
44
36
  */
45
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
46
- // eslint-disable-next-line @typescript-eslint/naming-convention
47
37
  TransactionStatus["confirmed"] = "confirmed";
48
38
  /**
49
39
  * The transaction encountered an error during execution on the blockchain and failed.
50
40
  * This is a final state.
51
41
  */
52
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
53
- // eslint-disable-next-line @typescript-eslint/naming-convention
54
42
  TransactionStatus["failed"] = "failed";
55
43
  /**
56
44
  * The transaction was superseded by another transaction, resulting in its dismissal.
57
45
  * This is a final state.
58
46
  */
59
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
60
- // eslint-disable-next-line @typescript-eslint/naming-convention
61
47
  TransactionStatus["dropped"] = "dropped";
62
48
  /**
63
49
  * The transaction was rejected by the user and not processed further.
64
50
  * This is a final state.
65
51
  */
66
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
67
- // eslint-disable-next-line @typescript-eslint/naming-convention
68
52
  TransactionStatus["rejected"] = "rejected";
69
53
  /**
70
54
  * @deprecated This status is no longer used.
71
55
  */
72
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
73
- // eslint-disable-next-line @typescript-eslint/naming-convention
74
56
  TransactionStatus["cancelled"] = "cancelled";
75
57
  })(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
76
58
  /**
@@ -78,20 +60,20 @@ var TransactionStatus;
78
60
  */
79
61
  var WalletDevice;
80
62
  (function (WalletDevice) {
81
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
82
- // eslint-disable-next-line @typescript-eslint/naming-convention
83
63
  WalletDevice["MM_MOBILE"] = "metamask_mobile";
84
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
85
- // eslint-disable-next-line @typescript-eslint/naming-convention
86
64
  WalletDevice["MM_EXTENSION"] = "metamask_extension";
87
65
  WalletDevice["OTHER"] = "other_device";
88
66
  })(WalletDevice || (exports.WalletDevice = WalletDevice = {}));
89
- /* eslint-disable @typescript-eslint/naming-convention */
90
67
  /**
91
68
  * The type of the transaction.
92
69
  */
93
70
  var TransactionType;
94
71
  (function (TransactionType) {
72
+ /**
73
+ * A batch transaction that includes multiple nested transactions.
74
+ * Introduced in EIP-7702.
75
+ */
76
+ TransactionType["batch"] = "batch";
95
77
  /**
96
78
  * A transaction that bridges tokens to a different chain through Metamask Bridge.
97
79
  */
@@ -221,16 +203,12 @@ var TransactionEnvelopeType;
221
203
  /**
222
204
  * A legacy transaction, the very first type.
223
205
  */
224
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
225
- // eslint-disable-next-line @typescript-eslint/naming-convention
226
206
  TransactionEnvelopeType["legacy"] = "0x0";
227
207
  /**
228
208
  * EIP-2930 defined the access list transaction type that allowed for
229
209
  * specifying the state that a transaction would act upon in advance and
230
210
  * theoretically save on gas fees.
231
211
  */
232
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
233
- // eslint-disable-next-line @typescript-eslint/naming-convention
234
212
  TransactionEnvelopeType["accessList"] = "0x1";
235
213
  /**
236
214
  * The type introduced comes from EIP-1559, Fee Market describes the addition
@@ -240,9 +218,13 @@ var TransactionEnvelopeType;
240
218
  * the maxPriorityFeePerGas (maximum amount of gwei per gas from the
241
219
  * transaction fee to distribute to miner).
242
220
  */
243
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
244
- // eslint-disable-next-line @typescript-eslint/naming-convention
245
221
  TransactionEnvelopeType["feeMarket"] = "0x2";
222
+ /**
223
+ * Adds code to externally owned accounts according to the signed authorizations
224
+ * in the new `authorizationList` parameter.
225
+ * Introduced in EIP-7702.
226
+ */
227
+ TransactionEnvelopeType["setCode"] = "0x4";
246
228
  })(TransactionEnvelopeType || (exports.TransactionEnvelopeType = TransactionEnvelopeType = {}));
247
229
  /**
248
230
  * The source of the gas fee parameters on a transaction.
@@ -250,8 +232,6 @@ var TransactionEnvelopeType;
250
232
  var UserFeeLevel;
251
233
  (function (UserFeeLevel) {
252
234
  UserFeeLevel["CUSTOM"] = "custom";
253
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
254
- // eslint-disable-next-line @typescript-eslint/naming-convention
255
235
  UserFeeLevel["DAPP_SUGGESTED"] = "dappSuggested";
256
236
  UserFeeLevel["MEDIUM"] = "medium";
257
237
  })(UserFeeLevel || (exports.UserFeeLevel = UserFeeLevel = {}));
@@ -272,14 +252,8 @@ var GasFeeEstimateType;
272
252
  /** Token standards supported by simulation. */
273
253
  var SimulationTokenStandard;
274
254
  (function (SimulationTokenStandard) {
275
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
276
- // eslint-disable-next-line @typescript-eslint/naming-convention
277
255
  SimulationTokenStandard["erc20"] = "erc20";
278
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
279
- // eslint-disable-next-line @typescript-eslint/naming-convention
280
256
  SimulationTokenStandard["erc721"] = "erc721";
281
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
282
- // eslint-disable-next-line @typescript-eslint/naming-convention
283
257
  SimulationTokenStandard["erc1155"] = "erc1155";
284
258
  })(SimulationTokenStandard || (exports.SimulationTokenStandard = SimulationTokenStandard = {}));
285
259
  var SimulationErrorCode;