Skip to content

Commit c488d71

Browse files
fix: include origin in 7702 transaction (#5771)
## Explanation Include `origin` in call to `addTransaction` from EIP-7702 batch transaction. Wasn't causing a linting error as `origin` is default global variable. ## References ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
1 parent 8dd27f0 commit c488d71

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/transaction-controller/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Bump `@metamask/controller-utils` to `^11.8.0` ([#5765](https://github.com/MetaMask/core/pull/5765))
1313

14+
### Fixed
15+
16+
- Validate correct origin in EIP-7702 transaction ([#5771](https://github.com/MetaMask/core/pull/5771))
17+
1418
## [55.0.0]
1519

1620
### Added

packages/transaction-controller/src/utils/batch.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const TRANSACTION_SIGNATURE_MOCK = '0xabc';
5858
const TRANSACTION_SIGNATURE_2_MOCK = '0xdef';
5959
const ERROR_MESSAGE_MOCK = 'Test error';
6060
const SECURITY_ALERT_ID_MOCK = '123-456';
61+
const ORIGIN_MOCK = 'test.com';
6162
const UPGRADE_CONTRACT_ADDRESS_MOCK =
6263
'0xfedfedfedfedfedfedfedfedfedfedfedfedfedf';
6364

@@ -127,6 +128,7 @@ describe('Batch Utils', () => {
127128
request: {
128129
from: FROM_MOCK,
129130
networkClientId: NETWORK_CLIENT_ID_MOCK,
131+
origin: ORIGIN_MOCK,
130132
requireApproval: true,
131133
transactions: [
132134
{
@@ -230,6 +232,7 @@ describe('Batch Utils', () => {
230232
},
231233
expect.objectContaining({
232234
networkClientId: NETWORK_CLIENT_ID_MOCK,
235+
origin: ORIGIN_MOCK,
233236
requireApproval: true,
234237
}),
235238
);

packages/transaction-controller/src/utils/batch.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,11 @@ async function addTransactionBatchWith7702(
231231
batchId: batchIdOverride,
232232
from,
233233
networkClientId,
234+
origin,
234235
requireApproval,
236+
securityAlertId,
235237
transactions,
236238
validateSecurity,
237-
securityAlertId,
238239
} = userRequest;
239240

240241
const chainId = getChainId(networkClientId);
@@ -325,10 +326,10 @@ async function addTransactionBatchWith7702(
325326
batchId,
326327
nestedTransactions,
327328
networkClientId,
329+
origin,
328330
requireApproval,
329331
securityAlertResponse,
330332
type: TransactionType.batch,
331-
origin,
332333
});
333334

334335
// Wait for the transaction to be published.

0 commit comments

Comments
 (0)