@metamask-previews/transaction-controller 65.0.0-preview-156c8ccf7 → 65.0.0-preview-7cef09c77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -12
- package/dist/TransactionController.cjs +5 -7
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +5 -7
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -19
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -19
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +3 -7
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.d.cts.map +1 -1
- package/dist/utils/batch.d.mts.map +1 -1
- package/dist/utils/batch.mjs +3 -7
- package/dist/utils/batch.mjs.map +1 -1
- package/dist/utils/gas-fees.cjs +2 -2
- package/dist/utils/gas-fees.cjs.map +1 -1
- package/dist/utils/gas-fees.d.cts.map +1 -1
- package/dist/utils/gas-fees.d.mts.map +1 -1
- package/dist/utils/gas-fees.mjs +3 -3
- package/dist/utils/gas-fees.mjs.map +1 -1
- package/dist/utils/validation.cjs +14 -15
- package/dist/utils/validation.cjs.map +1 -1
- package/dist/utils/validation.d.cts +2 -6
- package/dist/utils/validation.d.cts.map +1 -1
- package/dist/utils/validation.d.mts +2 -6
- package/dist/utils/validation.d.mts.map +1 -1
- package/dist/utils/validation.mjs +15 -16
- package/dist/utils/validation.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,21 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
- Add optional `isInternal` flag to `addTransaction` and `addTransactionBatch` to explicitly mark a request as originating from trusted internal MetaMask code ([#8633](https://github.com/MetaMask/core/pull/8633))
|
|
13
|
-
- When `true`, the controller skips validations that only apply to external requests: permitted-address check, EIP-7702 authorization rejection, calls-with-data to internal accounts, duplicate batch ID, dapp-suggested gas fee handling, and batch size limit
|
|
14
|
-
- The flag is persisted on `TransactionMeta` and `TransactionBatchMeta` so downstream logic (e.g. `userFeeLevel` selection) does not need to re-derive trust from the origin
|
|
15
|
-
- Add `isInternal` field to `TransactionMeta`, `TransactionBatchMeta`, `AddTransactionOptions`, and `TransactionBatchRequest` ([#8633](https://github.com/MetaMask/core/pull/8633))
|
|
16
|
-
|
|
17
10
|
### Changed
|
|
18
11
|
|
|
19
|
-
- **BREAKING:** Internal-only validation behavior is now gated by the explicit `isInternal` flag rather than `origin === ORIGIN_METAMASK` ([#8633](https://github.com/MetaMask/core/pull/8633))
|
|
20
|
-
- Setting `origin` to `ORIGIN_METAMASK` (or omitting `origin`) no longer skips external-request validations
|
|
21
|
-
- Callers that previously relied on `origin: ORIGIN_METAMASK` to suppress these validations must pass `isInternal: true` explicitly
|
|
22
|
-
- `validateTransactionOrigin` and `validateBatchRequest` now accept an `isInternal` option
|
|
23
|
-
- `userFeeLevel` selection in `gas-fees.ts` now keys off `txMeta.isInternal` instead of `txMeta.origin === ORIGIN_METAMASK` ([#8633](https://github.com/MetaMask/core/pull/8633))
|
|
24
12
|
- Bump `@metamask/messenger` from `^1.1.1` to `^1.2.0` ([#8632](https://github.com/MetaMask/core/pull/8632))
|
|
13
|
+
- Bump `@metamask/network-controller` from `^30.0.1` to `^30.1.0` ([#8636](https://github.com/MetaMask/core/pull/8636))
|
|
25
14
|
|
|
26
15
|
## [65.0.0]
|
|
27
16
|
|
|
@@ -407,7 +407,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
407
407
|
*/
|
|
408
408
|
async addTransaction(txParams, options) {
|
|
409
409
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
410
|
-
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, excludeNativeTokenForFee, isGasFeeIncluded, isGasFeeSponsored,
|
|
410
|
+
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, excludeNativeTokenForFee, isGasFeeIncluded, isGasFeeSponsored, isStateOnly, method, nestedTransactions, networkClientId, origin, publishHook, requestId, requiredAssets, requireApproval, securityAlertResponse, skipInitialGasEstimate, swaps = {}, traceContext, type, } = options;
|
|
411
411
|
// eslint-disable-next-line no-param-reassign
|
|
412
412
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
413
413
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
@@ -422,7 +422,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
422
422
|
data: txParams.data,
|
|
423
423
|
from: txParams.from,
|
|
424
424
|
internalAccounts,
|
|
425
|
-
isInternal,
|
|
426
425
|
origin,
|
|
427
426
|
permittedAddresses,
|
|
428
427
|
txParams,
|
|
@@ -437,10 +436,10 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
437
436
|
}
|
|
438
437
|
const isDuplicateBatchId = batchId?.length &&
|
|
439
438
|
this.state.transactions.some((tx) => tx.batchId?.toLowerCase() === batchId?.toLowerCase());
|
|
440
|
-
if (isDuplicateBatchId &&
|
|
439
|
+
if (isDuplicateBatchId && origin && origin !== controller_utils_1.ORIGIN_METAMASK) {
|
|
441
440
|
throw new rpc_errors_1.JsonRpcError(validation_1.ErrorCode.DuplicateBundleId, 'Batch ID already exists');
|
|
442
441
|
}
|
|
443
|
-
const dappSuggestedGasFees = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_generateDappSuggestedGasFees).call(this, txParams, origin
|
|
442
|
+
const dappSuggestedGasFees = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_generateDappSuggestedGasFees).call(this, txParams, origin);
|
|
444
443
|
const transactionType = type ??
|
|
445
444
|
(await (0, transaction_type_1.determineTransactionType)(txParams, {
|
|
446
445
|
messenger: this.messenger,
|
|
@@ -469,7 +468,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
469
468
|
? {}
|
|
470
469
|
: { excludeNativeTokenForFee }),
|
|
471
470
|
isFirstTimeInteraction: undefined,
|
|
472
|
-
isInternal,
|
|
473
471
|
isStateOnly,
|
|
474
472
|
nestedTransactions,
|
|
475
473
|
networkClientId,
|
|
@@ -1937,8 +1935,8 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
1937
1935
|
(0, logger_1.projectLogger)('Added incoming transactions to state', finalTransactions.length, finalTransactions);
|
|
1938
1936
|
});
|
|
1939
1937
|
this.messenger.publish(`${controllerName}:incomingTransactionsReceived`, finalTransactions);
|
|
1940
|
-
}, _TransactionController_generateDappSuggestedGasFees = function _TransactionController_generateDappSuggestedGasFees(txParams, origin
|
|
1941
|
-
if (
|
|
1938
|
+
}, _TransactionController_generateDappSuggestedGasFees = function _TransactionController_generateDappSuggestedGasFees(txParams, origin) {
|
|
1939
|
+
if (!origin || origin === controller_utils_1.ORIGIN_METAMASK) {
|
|
1942
1940
|
return undefined;
|
|
1943
1941
|
}
|
|
1944
1942
|
const { gasPrice, maxFeePerGas, maxPriorityFeePerGas, gas } = txParams;
|