@metamask-previews/transaction-controller 35.1.1-preview-63249efd → 35.1.1-preview-e8f9512d
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 +12 -11
- package/dist/TransactionController.mjs +11 -10
- package/dist/{chunk-DV4DIGIE.js → chunk-4OYPDGHO.js} +6 -6
- package/dist/{chunk-3Y7RHK6L.js → chunk-5HYWLTVQ.js} +3 -3
- package/dist/chunk-5QVDIVJH.js +68 -0
- package/dist/chunk-5QVDIVJH.js.map +1 -0
- package/dist/{chunk-EPCF4BU3.mjs → chunk-AWIJZAW3.mjs} +3 -3
- package/dist/{chunk-PI5XNTNC.js → chunk-BZV72SCF.js} +5 -5
- package/dist/{chunk-OBYKCUWH.js → chunk-EHWAY6XU.js} +9 -9
- package/dist/{chunk-GNAL5HC2.mjs → chunk-JIFPK37W.mjs} +2 -2
- package/dist/chunk-JOQK7A5G.mjs +68 -0
- package/dist/chunk-JOQK7A5G.mjs.map +1 -0
- package/dist/{chunk-OZ6UB42C.js → chunk-KTGMNUTQ.js} +2 -23
- package/dist/chunk-KTGMNUTQ.js.map +1 -0
- package/dist/{chunk-EUJSTRE7.mjs → chunk-KYRW4BLA.mjs} +3 -3
- package/dist/{chunk-ZAL2JFL6.mjs → chunk-LFFYCDHB.mjs} +1 -1
- package/dist/{chunk-ZAL2JFL6.mjs.map → chunk-LFFYCDHB.mjs.map} +1 -1
- package/dist/{chunk-TWU3E2S2.mjs → chunk-NNHSNPT2.mjs} +2 -2
- package/dist/{chunk-4IUBMIDQ.js → chunk-PSZ34BI5.js} +1 -1
- package/dist/{chunk-4IUBMIDQ.js.map → chunk-PSZ34BI5.js.map} +1 -1
- package/dist/{chunk-QH2H4W3N.js → chunk-QKV7E5BO.js} +5 -5
- package/dist/{chunk-EXQCUTGP.mjs → chunk-SFFOC25Q.mjs} +3 -3
- package/dist/{chunk-OSRJHVMI.js → chunk-UHAFIPSL.js} +6 -6
- package/dist/{chunk-Q56I5ONX.mjs → chunk-UHSRHP55.mjs} +1 -22
- package/dist/chunk-UHSRHP55.mjs.map +1 -0
- package/dist/{chunk-5MYXN7TL.mjs → chunk-VGFPVAKX.mjs} +2 -2
- package/dist/{chunk-X4UQYI6T.js → chunk-VKWOHNDO.js} +153 -251
- package/dist/chunk-VKWOHNDO.js.map +1 -0
- package/dist/{chunk-P6E3JOST.mjs → chunk-X4XSEYPL.mjs} +3 -3
- package/dist/{chunk-FGXUEMNU.mjs → chunk-XTMJ25EF.mjs} +133 -231
- package/dist/chunk-XTMJ25EF.mjs.map +1 -0
- package/dist/{chunk-SZRRNVKK.js → chunk-YWLMT7XH.js} +4 -4
- package/dist/errors.js +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.js +7 -7
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +6 -6
- package/dist/gas-flows/LineaGasFeeFlow.js +8 -8
- package/dist/gas-flows/LineaGasFeeFlow.mjs +7 -7
- package/dist/gas-flows/TestGasFeeFlow.js +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs +1 -1
- 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 +12 -11
- package/dist/index.mjs +11 -10
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/TransactionController.d.ts +1 -8
- package/dist/types/TransactionController.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 +12 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/retry.d.ts +11 -0
- package/dist/types/utils/retry.d.ts.map +1 -0
- package/dist/types/utils/utils.d.ts +1 -15
- package/dist/types/utils/utils.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types.mjs +1 -1
- package/dist/utils/external-transactions.js +1 -1
- package/dist/utils/external-transactions.mjs +1 -1
- package/dist/utils/gas-fees.js +6 -6
- package/dist/utils/gas-fees.mjs +5 -5
- package/dist/utils/gas-flow.js +3 -3
- package/dist/utils/gas-flow.mjs +2 -2
- package/dist/utils/retry.js +8 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/retry.mjs +8 -0
- package/dist/utils/retry.mjs.map +1 -0
- 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 +4 -4
- package/dist/utils/swaps.mjs +3 -3
- package/dist/utils/transaction-type.js +1 -1
- package/dist/utils/transaction-type.mjs +1 -1
- package/dist/utils/utils.js +3 -13
- package/dist/utils/utils.mjs +4 -14
- package/dist/utils/validation.js +4 -4
- package/dist/utils/validation.mjs +3 -3
- package/package.json +2 -2
- package/dist/chunk-FGXUEMNU.mjs.map +0 -1
- package/dist/chunk-OZ6UB42C.js.map +0 -1
- package/dist/chunk-Q56I5ONX.mjs.map +0 -1
- package/dist/chunk-X4UQYI6T.js.map +0 -1
- /package/dist/{chunk-DV4DIGIE.js.map → chunk-4OYPDGHO.js.map} +0 -0
- /package/dist/{chunk-3Y7RHK6L.js.map → chunk-5HYWLTVQ.js.map} +0 -0
- /package/dist/{chunk-EPCF4BU3.mjs.map → chunk-AWIJZAW3.mjs.map} +0 -0
- /package/dist/{chunk-PI5XNTNC.js.map → chunk-BZV72SCF.js.map} +0 -0
- /package/dist/{chunk-OBYKCUWH.js.map → chunk-EHWAY6XU.js.map} +0 -0
- /package/dist/{chunk-GNAL5HC2.mjs.map → chunk-JIFPK37W.mjs.map} +0 -0
- /package/dist/{chunk-EUJSTRE7.mjs.map → chunk-KYRW4BLA.mjs.map} +0 -0
- /package/dist/{chunk-TWU3E2S2.mjs.map → chunk-NNHSNPT2.mjs.map} +0 -0
- /package/dist/{chunk-QH2H4W3N.js.map → chunk-QKV7E5BO.js.map} +0 -0
- /package/dist/{chunk-EXQCUTGP.mjs.map → chunk-SFFOC25Q.mjs.map} +0 -0
- /package/dist/{chunk-OSRJHVMI.js.map → chunk-UHAFIPSL.js.map} +0 -0
- /package/dist/{chunk-5MYXN7TL.mjs.map → chunk-VGFPVAKX.mjs.map} +0 -0
- /package/dist/{chunk-P6E3JOST.mjs.map → chunk-X4XSEYPL.mjs.map} +0 -0
- /package/dist/{chunk-SZRRNVKK.js.map → chunk-YWLMT7XH.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/utils.ts"],"sourcesContent":["import {\n add0x,\n getKnownPropertyNames,\n isStrictHexString,\n} from '@metamask/utils';\nimport type { Json } from '@metamask/utils';\n\nimport { TransactionStatus } from '../types';\nimport type {\n TransactionParams,\n TransactionMeta,\n TransactionError,\n GasPriceValue,\n FeeMarketEIP1559Values,\n} from '../types';\n\nexport const ESTIMATE_GAS_ERROR = 'eth_estimateGas rpc method error';\n\n// TODO: Replace `any` with type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst NORMALIZERS: { [param in keyof TransactionParams]: any } = {\n data: (data: string) => add0x(padHexToEvenLength(data)),\n from: (from: string) => add0x(from).toLowerCase(),\n gas: (gas: string) => add0x(gas),\n gasLimit: (gas: string) => add0x(gas),\n gasPrice: (gasPrice: string) => add0x(gasPrice),\n nonce: (nonce: string) => add0x(nonce),\n to: (to: string) => add0x(to).toLowerCase(),\n value: (value: string) => add0x(value),\n maxFeePerGas: (maxFeePerGas: string) => add0x(maxFeePerGas),\n maxPriorityFeePerGas: (maxPriorityFeePerGas: string) =>\n add0x(maxPriorityFeePerGas),\n estimatedBaseFee: (maxPriorityFeePerGas: string) =>\n add0x(maxPriorityFeePerGas),\n type: (type: string) => add0x(type),\n};\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param txParams - The transaction params to normalize.\n * @returns Normalized transaction params.\n */\nexport function normalizeTransactionParams(txParams: TransactionParams) {\n const normalizedTxParams: TransactionParams = { from: '' };\n\n for (const key of getKnownPropertyNames(NORMALIZERS)) {\n if (txParams[key]) {\n normalizedTxParams[key] = NORMALIZERS[key](txParams[key]);\n }\n }\n\n if (!normalizedTxParams.value) {\n normalizedTxParams.value = '0x0';\n }\n\n return normalizedTxParams;\n}\n\n/**\n * Checks if a transaction is EIP-1559 by checking for the existence of\n * maxFeePerGas and maxPriorityFeePerGas within its parameters.\n *\n * @param txParams - Transaction params object to add.\n * @returns Boolean that is true if the transaction is EIP-1559 (has maxFeePerGas and maxPriorityFeePerGas), otherwise returns false.\n */\nexport function isEIP1559Transaction(txParams: TransactionParams): boolean {\n const hasOwnProp = (obj: TransactionParams, key: string) =>\n Object.prototype.hasOwnProperty.call(obj, key);\n return (\n hasOwnProp(txParams, 'maxFeePerGas') &&\n hasOwnProp(txParams, 'maxPriorityFeePerGas')\n );\n}\n\nexport const validateGasValues = (\n gasValues: GasPriceValue | FeeMarketEIP1559Values,\n) => {\n Object.keys(gasValues).forEach((key) => {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value = (gasValues as any)[key];\n if (typeof value !== 'string' || !isStrictHexString(value)) {\n throw new TypeError(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `expected hex string for ${key} but received: ${value}`,\n );\n }\n });\n};\n\n/**\n * Validates that a transaction is unapproved.\n * Throws if the transaction is not unapproved.\n *\n * @param transactionMeta - The transaction metadata to check.\n * @param fnName - The name of the function calling this helper.\n */\nexport function validateIfTransactionUnapproved(\n transactionMeta: TransactionMeta | undefined,\n fnName: string,\n) {\n if (transactionMeta?.status !== TransactionStatus.unapproved) {\n throw new Error(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `TransactionsController: Can only call ${fnName} on an unapproved transaction.\\n Current tx status: ${transactionMeta?.status}`,\n );\n }\n}\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param error - The error to be normalize.\n * @returns Normalized transaction error.\n */\nexport function normalizeTxError(\n error: Error & { code?: string; value?: unknown },\n): TransactionError {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n code: error.code,\n rpc: isJsonCompatible(error.value) ? error.value : undefined,\n };\n}\n\n/**\n * Normalize an object containing gas fee values.\n *\n * @param gasFeeValues - An object containing gas fee values.\n * @returns An object containing normalized gas fee values.\n */\nexport function normalizeGasFeeValues(\n gasFeeValues: GasPriceValue | FeeMarketEIP1559Values,\n): GasPriceValue | FeeMarketEIP1559Values {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const normalize = (value: any) =>\n typeof value === 'string' ? add0x(value) : value;\n\n if ('gasPrice' in gasFeeValues) {\n return {\n gasPrice: normalize(gasFeeValues.gasPrice),\n };\n }\n\n return {\n maxFeePerGas: normalize(gasFeeValues.maxFeePerGas),\n maxPriorityFeePerGas: normalize(gasFeeValues.maxPriorityFeePerGas),\n };\n}\n\n/**\n * Determines whether the given value can be encoded as JSON.\n *\n * @param value - The value.\n * @returns True if the value is JSON-encodable, false if not.\n */\nfunction isJsonCompatible(value: unknown): value is Json {\n try {\n JSON.parse(JSON.stringify(value));\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Ensure a hex string is of even length by adding a leading 0 if necessary.\n * Any existing `0x` prefix is preserved but is not added if missing.\n *\n * @param hex - The hex string to ensure is even.\n * @returns The hex string with an even length.\n */\nexport function padHexToEvenLength(hex: string) {\n const prefix = hex.toLowerCase().startsWith('0x') ? hex.slice(0, 2) : '';\n const data = prefix ? hex.slice(2) : hex;\n const evenData = data.length % 2 === 0 ? data : `0${data}`;\n\n return prefix + evenData;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-NOHEXQ7Y.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getGasFeeFlow
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NNHSNPT2.mjs";
|
|
7
7
|
import {
|
|
8
8
|
projectLogger
|
|
9
9
|
} from "./chunk-UQQWZT6C.mjs";
|
|
@@ -225,4 +225,4 @@ getGasFeeControllerData_fn = async function(transactions) {
|
|
|
225
225
|
export {
|
|
226
226
|
GasFeePoller
|
|
227
227
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
228
|
+
//# sourceMappingURL=chunk-VGFPVAKX.mjs.map
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
var _chunkPRUNMTRDjs = require('./chunk-PRUNMTRD.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunk5QVDIVJHjs = require('./chunk-5QVDIVJH.js');
|
|
8
|
+
|
|
9
|
+
|
|
7
10
|
var _chunkNNCUD3QFjs = require('./chunk-NNCUD3QF.js');
|
|
8
11
|
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ var _chunkSD6CWFDFjs = require('./chunk-SD6CWFDF.js');
|
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
|
|
14
|
-
var
|
|
17
|
+
var _chunk4OYPDGHOjs = require('./chunk-4OYPDGHO.js');
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
var _chunkULD4JC3Qjs = require('./chunk-ULD4JC3Q.js');
|
|
@@ -38,7 +41,7 @@ var _chunkWR5F34OWjs = require('./chunk-WR5F34OW.js');
|
|
|
38
41
|
var _chunkTJMQEH57js = require('./chunk-TJMQEH57.js');
|
|
39
42
|
|
|
40
43
|
|
|
41
|
-
var
|
|
44
|
+
var _chunk5HYWLTVQjs = require('./chunk-5HYWLTVQ.js');
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
|
|
@@ -54,19 +57,17 @@ var _chunk6OLJWLKKjs = require('./chunk-6OLJWLKK.js');
|
|
|
54
57
|
var _chunk7NMV2NPMjs = require('./chunk-7NMV2NPM.js');
|
|
55
58
|
|
|
56
59
|
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var _chunkOBYKCUWHjs = require('./chunk-OBYKCUWH.js');
|
|
60
|
+
var _chunkUHAFIPSLjs = require('./chunk-UHAFIPSL.js');
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkEHWAY6XUjs = require('./chunk-EHWAY6XU.js');
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
var _chunkBZV72SCFjs = require('./chunk-BZV72SCF.js');
|
|
66
67
|
|
|
67
|
-
var _chunkQH2H4W3Njs = require('./chunk-QH2H4W3N.js');
|
|
68
68
|
|
|
69
69
|
|
|
70
|
+
var _chunkQKV7E5BOjs = require('./chunk-QKV7E5BO.js');
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
|
|
@@ -74,12 +75,10 @@ var _chunkQH2H4W3Njs = require('./chunk-QH2H4W3N.js');
|
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
|
|
78
|
+
var _chunkKTGMNUTQjs = require('./chunk-KTGMNUTQ.js');
|
|
77
79
|
|
|
78
80
|
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
var _chunkSZRRNVKKjs = require('./chunk-SZRRNVKK.js');
|
|
81
|
+
var _chunkYWLMT7XHjs = require('./chunk-YWLMT7XH.js');
|
|
83
82
|
|
|
84
83
|
|
|
85
84
|
var _chunkS6VGOPUYjs = require('./chunk-S6VGOPUY.js');
|
|
@@ -143,7 +142,7 @@ function getDefaultTransactionControllerState() {
|
|
|
143
142
|
lastFetchedBlockNumbers: {}
|
|
144
143
|
};
|
|
145
144
|
}
|
|
146
|
-
var _internalEvents, _incomingTransactionOptions, _pendingTransactionOptions, _trace, _transactionHistoryLimit, _isSimulationEnabled, _testGasFeeFlows, _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, _getNetworkClientId, getNetworkClientId_fn, _getGlobalNetworkClientId, getGlobalNetworkClientId_fn, _getGlobalChainId, getGlobalChainId_fn, _isCustomNetwork, isCustomNetwork_fn, _getSelectedAccount, getSelectedAccount_fn;
|
|
145
|
+
var _internalEvents, _incomingTransactionOptions, _pendingTransactionOptions, _trace, _transactionHistoryLimit, _isSimulationEnabled, _testGasFeeFlows, _multichainTrackingHelper, _retryTransaction, retryTransaction_fn, _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, _getNetworkClientId, getNetworkClientId_fn, _getGlobalNetworkClientId, getGlobalNetworkClientId_fn, _getGlobalChainId, getGlobalChainId_fn, _isCustomNetwork, isCustomNetwork_fn, _getSelectedAccount, getSelectedAccount_fn;
|
|
147
146
|
var TransactionController = class extends _basecontroller.BaseController {
|
|
148
147
|
/**
|
|
149
148
|
* Constructs a TransactionController.
|
|
@@ -213,6 +212,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
213
212
|
...state
|
|
214
213
|
}
|
|
215
214
|
});
|
|
215
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _retryTransaction);
|
|
216
216
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _createNonceTracker);
|
|
217
217
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _createIncomingTransactionHelper);
|
|
218
218
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _createPendingTransactionTracker);
|
|
@@ -325,7 +325,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
325
325
|
});
|
|
326
326
|
this.gasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGasFeeFlows, getGasFeeFlows_fn).call(this);
|
|
327
327
|
this.layer1GasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getLayer1GasFeeFlows, getLayer1GasFeeFlows_fn).call(this);
|
|
328
|
-
const gasFeePoller = new (0,
|
|
328
|
+
const gasFeePoller = new (0, _chunk5HYWLTVQjs.GasFeePoller)({
|
|
329
329
|
findNetworkClientIdByChainId,
|
|
330
330
|
gasFeeFlows: this.gasFeeFlows,
|
|
331
331
|
getGasFeeControllerEstimates: this.getGasFeeEstimates,
|
|
@@ -360,7 +360,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
360
360
|
}
|
|
361
361
|
failTransaction(transactionMeta, error, actionId) {
|
|
362
362
|
const newTransactionMeta = _lodash.merge.call(void 0, {}, transactionMeta, {
|
|
363
|
-
error:
|
|
363
|
+
error: _chunkKTGMNUTQjs.normalizeTxError.call(void 0, error),
|
|
364
364
|
status: "failed" /* failed */
|
|
365
365
|
});
|
|
366
366
|
this.messagingSystem.publish(`${controllerName}:transactionFailed`, {
|
|
@@ -460,7 +460,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
460
460
|
networkClientId: requestNetworkClientId
|
|
461
461
|
} = {}) {
|
|
462
462
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Adding transaction", txParams);
|
|
463
|
-
txParams =
|
|
463
|
+
txParams = _chunkKTGMNUTQjs.normalizeTransactionParams.call(void 0, txParams);
|
|
464
464
|
if (requestNetworkClientId && !_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).has(requestNetworkClientId)) {
|
|
465
465
|
throw new Error(
|
|
466
466
|
"The networkClientId for this transaction could not be found"
|
|
@@ -470,9 +470,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
470
470
|
const isEIP1559Compatible = await this.getEIP1559Compatibility(
|
|
471
471
|
networkClientId
|
|
472
472
|
);
|
|
473
|
-
|
|
473
|
+
_chunk4OYPDGHOjs.validateTxParams.call(void 0, txParams, isEIP1559Compatible);
|
|
474
474
|
if (origin) {
|
|
475
|
-
await
|
|
475
|
+
await _chunk4OYPDGHOjs.validateTransactionOrigin.call(void 0,
|
|
476
476
|
await this.getPermittedAccounts(origin),
|
|
477
477
|
_chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getSelectedAccount, getSelectedAccount_fn).call(this).address,
|
|
478
478
|
txParams.from,
|
|
@@ -524,7 +524,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
524
524
|
if (!this.isHistoryDisabled) {
|
|
525
525
|
addedTransactionMeta = _chunkTIE3CPF7js.addInitialHistorySnapshot.call(void 0, addedTransactionMeta);
|
|
526
526
|
}
|
|
527
|
-
addedTransactionMeta =
|
|
527
|
+
addedTransactionMeta = _chunkQKV7E5BOjs.updateSwapsTransaction.call(void 0,
|
|
528
528
|
addedTransactionMeta,
|
|
529
529
|
transactionType,
|
|
530
530
|
swaps,
|
|
@@ -605,116 +605,30 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
605
605
|
estimatedBaseFee,
|
|
606
606
|
actionId
|
|
607
607
|
} = {}) {
|
|
608
|
-
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
|
-
if (gasValues) {
|
|
612
|
-
gasValues = _chunkOZ6UB42Cjs.normalizeGasFeeValues.call(void 0, gasValues);
|
|
613
|
-
_chunkOZ6UB42Cjs.validateGasValues.call(void 0, gasValues);
|
|
614
|
-
}
|
|
615
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Creating cancel transaction", transactionId, gasValues);
|
|
616
|
-
const transactionMeta = this.getTransaction(transactionId);
|
|
617
|
-
if (!transactionMeta) {
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
if (!this.sign) {
|
|
621
|
-
throw new Error("No sign method defined.");
|
|
622
|
-
}
|
|
623
|
-
const minGasPrice = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
624
|
-
transactionMeta.txParams.gasPrice,
|
|
625
|
-
CANCEL_RATE
|
|
626
|
-
);
|
|
627
|
-
const gasPriceFromValues = _chunkOZ6UB42Cjs.isGasPriceValue.call(void 0, gasValues) && gasValues.gasPrice;
|
|
628
|
-
const newGasPrice = gasPriceFromValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, gasPriceFromValues, minGasPrice) || minGasPrice;
|
|
629
|
-
const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;
|
|
630
|
-
const minMaxFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
631
|
-
existingMaxFeePerGas,
|
|
632
|
-
CANCEL_RATE
|
|
633
|
-
);
|
|
634
|
-
const maxFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxFeePerGas;
|
|
635
|
-
const newMaxFeePerGas = maxFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, maxFeePerGasValues, minMaxFeePerGas) || existingMaxFeePerGas && minMaxFeePerGas;
|
|
636
|
-
const existingMaxPriorityFeePerGas = transactionMeta.txParams?.maxPriorityFeePerGas;
|
|
637
|
-
const minMaxPriorityFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
638
|
-
existingMaxPriorityFeePerGas,
|
|
639
|
-
CANCEL_RATE
|
|
640
|
-
);
|
|
641
|
-
const maxPriorityFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxPriorityFeePerGas;
|
|
642
|
-
const newMaxPriorityFeePerGas = maxPriorityFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0,
|
|
643
|
-
maxPriorityFeePerGasValues,
|
|
644
|
-
minMaxPriorityFeePerGas
|
|
645
|
-
) || existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas;
|
|
646
|
-
const newTxParams = newMaxFeePerGas && newMaxPriorityFeePerGas ? {
|
|
647
|
-
from: transactionMeta.txParams.from,
|
|
648
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
649
|
-
maxFeePerGas: newMaxFeePerGas,
|
|
650
|
-
maxPriorityFeePerGas: newMaxPriorityFeePerGas,
|
|
651
|
-
type: "0x2" /* feeMarket */,
|
|
652
|
-
nonce: transactionMeta.txParams.nonce,
|
|
653
|
-
to: transactionMeta.txParams.from,
|
|
654
|
-
value: "0x0"
|
|
655
|
-
} : {
|
|
656
|
-
from: transactionMeta.txParams.from,
|
|
657
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
658
|
-
gasPrice: newGasPrice,
|
|
659
|
-
nonce: transactionMeta.txParams.nonce,
|
|
660
|
-
to: transactionMeta.txParams.from,
|
|
661
|
-
value: "0x0"
|
|
662
|
-
};
|
|
663
|
-
const unsignedEthTx = this.prepareUnsignedEthTx(
|
|
664
|
-
transactionMeta.chainId,
|
|
665
|
-
newTxParams
|
|
666
|
-
);
|
|
667
|
-
const signedTx = await this.sign(
|
|
668
|
-
unsignedEthTx,
|
|
669
|
-
transactionMeta.txParams.from
|
|
670
|
-
);
|
|
671
|
-
const rawTx = _util.bufferToHex.call(void 0, signedTx.serialize());
|
|
672
|
-
const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;
|
|
673
|
-
const oldFee = newTxParams.maxFeePerGas ? transactionMeta.txParams.maxFeePerGas : transactionMeta.txParams.gasPrice;
|
|
674
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Submitting cancel transaction", {
|
|
675
|
-
oldFee,
|
|
676
|
-
newFee,
|
|
677
|
-
txParams: newTxParams
|
|
678
|
-
});
|
|
679
|
-
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
680
|
-
networkClientId: transactionMeta.networkClientId,
|
|
681
|
-
chainId: transactionMeta.chainId
|
|
682
|
-
});
|
|
683
|
-
const hash = await this.publishTransactionForRetry(
|
|
684
|
-
ethQuery,
|
|
685
|
-
rawTx,
|
|
686
|
-
transactionMeta
|
|
687
|
-
);
|
|
688
|
-
const cancelTransactionMeta = {
|
|
608
|
+
return await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _retryTransaction, retryTransaction_fn).call(this, {
|
|
689
609
|
actionId,
|
|
690
|
-
chainId: transactionMeta.chainId,
|
|
691
|
-
networkClientId: transactionMeta.networkClientId,
|
|
692
610
|
estimatedBaseFee,
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
611
|
+
gasValues,
|
|
612
|
+
label: "cancel",
|
|
613
|
+
rate: CANCEL_RATE,
|
|
614
|
+
transactionId,
|
|
615
|
+
transactionType: "cancel" /* cancel */,
|
|
616
|
+
prepareTransactionParams: (txParams) => {
|
|
617
|
+
delete txParams.data;
|
|
618
|
+
txParams.to = txParams.from;
|
|
619
|
+
txParams.value = "0x0";
|
|
620
|
+
},
|
|
621
|
+
afterSubmit: (newTransactionMeta) => {
|
|
622
|
+
this.messagingSystem.publish(
|
|
623
|
+
`${controllerName}:transactionFinished`,
|
|
624
|
+
newTransactionMeta
|
|
625
|
+
);
|
|
626
|
+
_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _internalEvents).emit(
|
|
627
|
+
`${newTransactionMeta.id}:finished`,
|
|
628
|
+
newTransactionMeta
|
|
629
|
+
);
|
|
630
|
+
}
|
|
709
631
|
});
|
|
710
|
-
this.messagingSystem.publish(
|
|
711
|
-
`${controllerName}:transactionFinished`,
|
|
712
|
-
cancelTransactionMeta
|
|
713
|
-
);
|
|
714
|
-
_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _internalEvents).emit(
|
|
715
|
-
`${transactionMeta.id}:finished`,
|
|
716
|
-
cancelTransactionMeta
|
|
717
|
-
);
|
|
718
632
|
}
|
|
719
633
|
/**
|
|
720
634
|
* Attempts to speed up a transaction increasing transaction gasPrice by ten percent.
|
|
@@ -729,118 +643,21 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
729
643
|
actionId,
|
|
730
644
|
estimatedBaseFee
|
|
731
645
|
} = {}) {
|
|
732
|
-
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
if (gasValues) {
|
|
736
|
-
gasValues = _chunkOZ6UB42Cjs.normalizeGasFeeValues.call(void 0, gasValues);
|
|
737
|
-
_chunkOZ6UB42Cjs.validateGasValues.call(void 0, gasValues);
|
|
738
|
-
}
|
|
739
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Creating speed up transaction", transactionId, gasValues);
|
|
740
|
-
const transactionMeta = this.getTransaction(transactionId);
|
|
741
|
-
if (!transactionMeta) {
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
if (!this.sign) {
|
|
745
|
-
throw new Error("No sign method defined.");
|
|
746
|
-
}
|
|
747
|
-
const minGasPrice = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
748
|
-
transactionMeta.txParams.gasPrice,
|
|
749
|
-
SPEED_UP_RATE
|
|
750
|
-
);
|
|
751
|
-
const gasPriceFromValues = _chunkOZ6UB42Cjs.isGasPriceValue.call(void 0, gasValues) && gasValues.gasPrice;
|
|
752
|
-
const newGasPrice = gasPriceFromValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, gasPriceFromValues, minGasPrice) || minGasPrice;
|
|
753
|
-
const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;
|
|
754
|
-
const minMaxFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
755
|
-
existingMaxFeePerGas,
|
|
756
|
-
SPEED_UP_RATE
|
|
757
|
-
);
|
|
758
|
-
const maxFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxFeePerGas;
|
|
759
|
-
const newMaxFeePerGas = maxFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, maxFeePerGasValues, minMaxFeePerGas) || existingMaxFeePerGas && minMaxFeePerGas;
|
|
760
|
-
const existingMaxPriorityFeePerGas = transactionMeta.txParams?.maxPriorityFeePerGas;
|
|
761
|
-
const minMaxPriorityFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
762
|
-
existingMaxPriorityFeePerGas,
|
|
763
|
-
SPEED_UP_RATE
|
|
764
|
-
);
|
|
765
|
-
const maxPriorityFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxPriorityFeePerGas;
|
|
766
|
-
const newMaxPriorityFeePerGas = maxPriorityFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0,
|
|
767
|
-
maxPriorityFeePerGasValues,
|
|
768
|
-
minMaxPriorityFeePerGas
|
|
769
|
-
) || existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas;
|
|
770
|
-
const txParams = newMaxFeePerGas && newMaxPriorityFeePerGas ? {
|
|
771
|
-
...transactionMeta.txParams,
|
|
772
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
773
|
-
maxFeePerGas: newMaxFeePerGas,
|
|
774
|
-
maxPriorityFeePerGas: newMaxPriorityFeePerGas,
|
|
775
|
-
type: "0x2" /* feeMarket */
|
|
776
|
-
} : {
|
|
777
|
-
...transactionMeta.txParams,
|
|
778
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
779
|
-
gasPrice: newGasPrice
|
|
780
|
-
};
|
|
781
|
-
const unsignedEthTx = this.prepareUnsignedEthTx(
|
|
782
|
-
transactionMeta.chainId,
|
|
783
|
-
txParams
|
|
784
|
-
);
|
|
785
|
-
const signedTx = await this.sign(
|
|
786
|
-
unsignedEthTx,
|
|
787
|
-
transactionMeta.txParams.from
|
|
788
|
-
);
|
|
789
|
-
const transactionMetaWithRsv = this.updateTransactionMetaRSV(
|
|
790
|
-
transactionMeta,
|
|
791
|
-
signedTx
|
|
792
|
-
);
|
|
793
|
-
const rawTx = _util.bufferToHex.call(void 0, signedTx.serialize());
|
|
794
|
-
const newFee = txParams.maxFeePerGas ?? txParams.gasPrice;
|
|
795
|
-
const oldFee = txParams.maxFeePerGas ? transactionMetaWithRsv.txParams.maxFeePerGas : transactionMetaWithRsv.txParams.gasPrice;
|
|
796
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Submitting speed up transaction", { oldFee, newFee, txParams });
|
|
797
|
-
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
798
|
-
networkClientId: transactionMeta.networkClientId,
|
|
799
|
-
chainId: transactionMeta.chainId
|
|
800
|
-
});
|
|
801
|
-
const hash = await this.publishTransactionForRetry(
|
|
802
|
-
ethQuery,
|
|
803
|
-
rawTx,
|
|
804
|
-
transactionMeta
|
|
805
|
-
);
|
|
806
|
-
const baseTransactionMeta = {
|
|
807
|
-
...transactionMetaWithRsv,
|
|
808
|
-
estimatedBaseFee,
|
|
809
|
-
id: _uuid.v1.call(void 0, ),
|
|
810
|
-
time: Date.now(),
|
|
811
|
-
hash,
|
|
646
|
+
return await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _retryTransaction, retryTransaction_fn).call(this, {
|
|
812
647
|
actionId,
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
} : {
|
|
825
|
-
...baseTransactionMeta,
|
|
826
|
-
txParams: {
|
|
827
|
-
...transactionMeta.txParams,
|
|
828
|
-
gasPrice: newGasPrice
|
|
648
|
+
estimatedBaseFee,
|
|
649
|
+
gasValues,
|
|
650
|
+
label: "speed up",
|
|
651
|
+
rate: SPEED_UP_RATE,
|
|
652
|
+
transactionId,
|
|
653
|
+
transactionType: "retry" /* retry */,
|
|
654
|
+
afterSubmit: (newTransactionMeta) => {
|
|
655
|
+
this.messagingSystem.publish(
|
|
656
|
+
`${controllerName}:speedupTransactionAdded`,
|
|
657
|
+
newTransactionMeta
|
|
658
|
+
);
|
|
829
659
|
}
|
|
830
|
-
};
|
|
831
|
-
this.addMetadata(newTransactionMeta);
|
|
832
|
-
this.messagingSystem.publish(`${controllerName}:transactionApproved`, {
|
|
833
|
-
transactionMeta: newTransactionMeta,
|
|
834
|
-
actionId
|
|
835
660
|
});
|
|
836
|
-
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
837
|
-
transactionMeta: newTransactionMeta,
|
|
838
|
-
actionId
|
|
839
|
-
});
|
|
840
|
-
this.messagingSystem.publish(
|
|
841
|
-
`${controllerName}:speedupTransactionAdded`,
|
|
842
|
-
newTransactionMeta
|
|
843
|
-
);
|
|
844
661
|
}
|
|
845
662
|
/**
|
|
846
663
|
* Estimates required gas for a given transaction.
|
|
@@ -1006,7 +823,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1006
823
|
`Cannot update send flow history as no transaction metadata found`
|
|
1007
824
|
);
|
|
1008
825
|
}
|
|
1009
|
-
|
|
826
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0,
|
|
1010
827
|
transactionMeta,
|
|
1011
828
|
"updateTransactionSendFlowHistory"
|
|
1012
829
|
);
|
|
@@ -1060,7 +877,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1060
877
|
`Cannot update transaction as no transaction metadata found`
|
|
1061
878
|
);
|
|
1062
879
|
}
|
|
1063
|
-
|
|
880
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0,
|
|
1064
881
|
transactionMeta,
|
|
1065
882
|
"updateTransactionGasFees"
|
|
1066
883
|
);
|
|
@@ -1111,7 +928,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1111
928
|
`Cannot update transaction as no transaction metadata found`
|
|
1112
929
|
);
|
|
1113
930
|
}
|
|
1114
|
-
|
|
931
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0, transactionMeta, "updatePreviousGasParams");
|
|
1115
932
|
const transactionPreviousGas = {
|
|
1116
933
|
previousGas: {
|
|
1117
934
|
gasLimit,
|
|
@@ -1164,7 +981,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1164
981
|
`Cannot update editable params as no transaction metadata found`
|
|
1165
982
|
);
|
|
1166
983
|
}
|
|
1167
|
-
|
|
984
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0, transactionMeta, "updateEditableParams");
|
|
1168
985
|
const editableParams = {
|
|
1169
986
|
txParams: {
|
|
1170
987
|
data,
|
|
@@ -1299,7 +1116,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1299
1116
|
updatedTransactionMeta.submittedTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1300
1117
|
}
|
|
1301
1118
|
if (updatedTransactionMeta.status === "failed" /* failed */) {
|
|
1302
|
-
updatedTransactionMeta.error =
|
|
1119
|
+
updatedTransactionMeta.error = _chunkKTGMNUTQjs.normalizeTxError.call(void 0, new Error(errorMessage));
|
|
1303
1120
|
}
|
|
1304
1121
|
this.updateTransaction(
|
|
1305
1122
|
updatedTransactionMeta,
|
|
@@ -1413,7 +1230,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1413
1230
|
chainId,
|
|
1414
1231
|
networkClientId
|
|
1415
1232
|
};
|
|
1416
|
-
const gasFeeFlow =
|
|
1233
|
+
const gasFeeFlow = _chunkYWLMT7XHjs.getGasFeeFlow.call(void 0,
|
|
1417
1234
|
transactionMeta,
|
|
1418
1235
|
this.gasFeeFlows
|
|
1419
1236
|
);
|
|
@@ -1460,8 +1277,8 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1460
1277
|
if (!this.sign) {
|
|
1461
1278
|
throw new Error("No sign method defined.");
|
|
1462
1279
|
}
|
|
1463
|
-
const normalizedTransactionParams =
|
|
1464
|
-
const type =
|
|
1280
|
+
const normalizedTransactionParams = _chunkKTGMNUTQjs.normalizeTransactionParams.call(void 0, transactionParams);
|
|
1281
|
+
const type = _chunkKTGMNUTQjs.isEIP1559Transaction.call(void 0, normalizedTransactionParams) ? "0x2" /* feeMarket */ : "0x0" /* legacy */;
|
|
1465
1282
|
const updatedTransactionParams = {
|
|
1466
1283
|
...normalizedTransactionParams,
|
|
1467
1284
|
type,
|
|
@@ -1509,7 +1326,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1509
1326
|
this.signAbortCallbacks.delete(transactionId);
|
|
1510
1327
|
}
|
|
1511
1328
|
addMetadata(transactionMeta) {
|
|
1512
|
-
|
|
1329
|
+
_chunk4OYPDGHOjs.validateTxParams.call(void 0, transactionMeta.txParams);
|
|
1513
1330
|
this.update((state) => {
|
|
1514
1331
|
state.transactions = this.trimTransactionsForState([
|
|
1515
1332
|
...state.transactions,
|
|
@@ -1537,7 +1354,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1537
1354
|
txMeta: transactionMeta
|
|
1538
1355
|
});
|
|
1539
1356
|
});
|
|
1540
|
-
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Update Gas Fees", parentContext: traceContext }, async () => await
|
|
1357
|
+
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Update Gas Fees", parentContext: traceContext }, async () => await _chunkBZV72SCFjs.updateGasFees.call(void 0, {
|
|
1541
1358
|
eip1559: isEIP1559Compatible,
|
|
1542
1359
|
ethQuery,
|
|
1543
1360
|
gasFeeFlows: this.gasFeeFlows,
|
|
@@ -1704,7 +1521,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1704
1521
|
nonce,
|
|
1705
1522
|
chainId,
|
|
1706
1523
|
gasLimit: txParams.gas,
|
|
1707
|
-
...
|
|
1524
|
+
..._chunkKTGMNUTQjs.isEIP1559Transaction.call(void 0, txParams) && {
|
|
1708
1525
|
type: "0x2" /* feeMarket */
|
|
1709
1526
|
}
|
|
1710
1527
|
};
|
|
@@ -2225,7 +2042,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
2225
2042
|
networkClientId: transactionMeta.networkClientId,
|
|
2226
2043
|
chainId: transactionMeta.chainId
|
|
2227
2044
|
});
|
|
2228
|
-
const { updatedTransactionMeta, approvalTransactionMeta } = await
|
|
2045
|
+
const { updatedTransactionMeta, approvalTransactionMeta } = await _chunkQKV7E5BOjs.updatePostTransactionBalance.call(void 0, transactionMeta, {
|
|
2229
2046
|
ethQuery,
|
|
2230
2047
|
getTransaction: this.getTransaction.bind(this),
|
|
2231
2048
|
updateTransaction: this.updateTransaction.bind(this)
|
|
@@ -2276,6 +2093,91 @@ _transactionHistoryLimit = new WeakMap();
|
|
|
2276
2093
|
_isSimulationEnabled = new WeakMap();
|
|
2277
2094
|
_testGasFeeFlows = new WeakMap();
|
|
2278
2095
|
_multichainTrackingHelper = new WeakMap();
|
|
2096
|
+
_retryTransaction = new WeakSet();
|
|
2097
|
+
retryTransaction_fn = async function({
|
|
2098
|
+
actionId,
|
|
2099
|
+
afterSubmit,
|
|
2100
|
+
estimatedBaseFee,
|
|
2101
|
+
gasValues,
|
|
2102
|
+
label,
|
|
2103
|
+
prepareTransactionParams,
|
|
2104
|
+
rate,
|
|
2105
|
+
transactionId,
|
|
2106
|
+
transactionType
|
|
2107
|
+
}) {
|
|
2108
|
+
if (this.getTransactionWithActionId(actionId)) {
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
if (gasValues) {
|
|
2112
|
+
gasValues = _chunkKTGMNUTQjs.normalizeGasFeeValues.call(void 0, gasValues);
|
|
2113
|
+
_chunkKTGMNUTQjs.validateGasValues.call(void 0, gasValues);
|
|
2114
|
+
}
|
|
2115
|
+
_chunkS6VGOPUYjs.projectLogger.call(void 0, `Creating ${label} transaction`, transactionId, gasValues);
|
|
2116
|
+
const transactionMeta = this.getTransaction(transactionId);
|
|
2117
|
+
if (!transactionMeta) {
|
|
2118
|
+
return;
|
|
2119
|
+
}
|
|
2120
|
+
if (!this.sign) {
|
|
2121
|
+
throw new Error("No sign method defined.");
|
|
2122
|
+
}
|
|
2123
|
+
const newTxParams = _chunk5QVDIVJHjs.getTransactionParamsWithIncreasedGasFee.call(void 0,
|
|
2124
|
+
transactionMeta.txParams,
|
|
2125
|
+
rate,
|
|
2126
|
+
gasValues
|
|
2127
|
+
);
|
|
2128
|
+
prepareTransactionParams?.(newTxParams);
|
|
2129
|
+
const unsignedEthTx = this.prepareUnsignedEthTx(
|
|
2130
|
+
transactionMeta.chainId,
|
|
2131
|
+
newTxParams
|
|
2132
|
+
);
|
|
2133
|
+
const signedTx = await this.sign(
|
|
2134
|
+
unsignedEthTx,
|
|
2135
|
+
transactionMeta.txParams.from
|
|
2136
|
+
);
|
|
2137
|
+
const transactionMetaWithRsv = this.updateTransactionMetaRSV(
|
|
2138
|
+
transactionMeta,
|
|
2139
|
+
signedTx
|
|
2140
|
+
);
|
|
2141
|
+
const rawTx = _util.bufferToHex.call(void 0, signedTx.serialize());
|
|
2142
|
+
const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;
|
|
2143
|
+
const oldFee = newTxParams.maxFeePerGas ? transactionMetaWithRsv.txParams.maxFeePerGas : transactionMetaWithRsv.txParams.gasPrice;
|
|
2144
|
+
_chunkS6VGOPUYjs.projectLogger.call(void 0, `Submitting ${label} transaction`, {
|
|
2145
|
+
oldFee,
|
|
2146
|
+
newFee,
|
|
2147
|
+
txParams: newTxParams
|
|
2148
|
+
});
|
|
2149
|
+
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
2150
|
+
networkClientId: transactionMeta.networkClientId,
|
|
2151
|
+
chainId: transactionMeta.chainId
|
|
2152
|
+
});
|
|
2153
|
+
const hash = await this.publishTransactionForRetry(
|
|
2154
|
+
ethQuery,
|
|
2155
|
+
rawTx,
|
|
2156
|
+
transactionMeta
|
|
2157
|
+
);
|
|
2158
|
+
const newTransactionMeta = {
|
|
2159
|
+
...transactionMetaWithRsv,
|
|
2160
|
+
estimatedBaseFee,
|
|
2161
|
+
id: _uuid.v1.call(void 0, ),
|
|
2162
|
+
time: Date.now(),
|
|
2163
|
+
hash,
|
|
2164
|
+
actionId,
|
|
2165
|
+
originalGasEstimate: transactionMeta.txParams.gas,
|
|
2166
|
+
type: transactionType,
|
|
2167
|
+
txParams: newTxParams,
|
|
2168
|
+
originalType: transactionMeta.type
|
|
2169
|
+
};
|
|
2170
|
+
this.addMetadata(newTransactionMeta);
|
|
2171
|
+
this.messagingSystem.publish(`${controllerName}:transactionApproved`, {
|
|
2172
|
+
transactionMeta: newTransactionMeta,
|
|
2173
|
+
actionId
|
|
2174
|
+
});
|
|
2175
|
+
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
2176
|
+
transactionMeta: newTransactionMeta,
|
|
2177
|
+
actionId
|
|
2178
|
+
});
|
|
2179
|
+
afterSubmit?.(newTransactionMeta);
|
|
2180
|
+
};
|
|
2279
2181
|
_createNonceTracker = new WeakSet();
|
|
2280
2182
|
createNonceTracker_fn = function({
|
|
2281
2183
|
provider,
|
|
@@ -2418,7 +2320,7 @@ getGasFeeFlows_fn = function() {
|
|
|
2418
2320
|
if (_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _testGasFeeFlows)) {
|
|
2419
2321
|
return [new (0, _chunkTJMQEH57js.TestGasFeeFlow)()];
|
|
2420
2322
|
}
|
|
2421
|
-
return [new (0,
|
|
2323
|
+
return [new (0, _chunkUHAFIPSLjs.LineaGasFeeFlow)(), new (0, _chunkEHWAY6XUjs.DefaultGasFeeFlow)()];
|
|
2422
2324
|
};
|
|
2423
2325
|
_getLayer1GasFeeFlows = new WeakSet();
|
|
2424
2326
|
getLayer1GasFeeFlows_fn = function() {
|
|
@@ -2437,10 +2339,10 @@ updateTransactionInternal_fn = function({
|
|
|
2437
2339
|
);
|
|
2438
2340
|
let transactionMeta2 = state.transactions[index];
|
|
2439
2341
|
transactionMeta2 = callback(transactionMeta2) ?? transactionMeta2;
|
|
2440
|
-
transactionMeta2.txParams =
|
|
2342
|
+
transactionMeta2.txParams = _chunkKTGMNUTQjs.normalizeTransactionParams.call(void 0,
|
|
2441
2343
|
transactionMeta2.txParams
|
|
2442
2344
|
);
|
|
2443
|
-
|
|
2345
|
+
_chunk4OYPDGHOjs.validateTxParams.call(void 0, transactionMeta2.txParams);
|
|
2444
2346
|
updatedTransactionParams = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _checkIfTransactionParamsUpdated, checkIfTransactionParamsUpdated_fn).call(this, transactionMeta2);
|
|
2445
2347
|
const shouldSkipHistory = this.isHistoryDisabled || skipHistory;
|
|
2446
2348
|
if (!shouldSkipHistory) {
|
|
@@ -2604,4 +2506,4 @@ getSelectedAccount_fn = function() {
|
|
|
2604
2506
|
|
|
2605
2507
|
|
|
2606
2508
|
exports.HARDFORK = HARDFORK; exports.CANCEL_RATE = CANCEL_RATE; exports.SPEED_UP_RATE = SPEED_UP_RATE; exports.ApprovalState = ApprovalState; exports.TransactionController = TransactionController;
|
|
2607
|
-
//# sourceMappingURL=chunk-
|
|
2509
|
+
//# sourceMappingURL=chunk-VKWOHNDO.js.map
|