From 462a7007e107653a2ab4a5729bd7e45fee04431e Mon Sep 17 00:00:00 2001 From: lwin Date: Thu, 27 Nov 2025 11:58:40 +0800 Subject: [PATCH 1/2] feat: include 'AuthorizationList' params in tx init and log requests --- packages/shield-controller/src/backend.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/shield-controller/src/backend.ts b/packages/shield-controller/src/backend.ts index cd94bc910a7..a5e4c3882a1 100644 --- a/packages/shield-controller/src/backend.ts +++ b/packages/shield-controller/src/backend.ts @@ -9,6 +9,7 @@ import { type SignatureRequest, } from '@metamask/signature-controller'; import type { TransactionMeta } from '@metamask/transaction-controller'; +import type { AuthorizationList } from '@metamask/transaction-controller'; import type { Json } from '@metamask/utils'; import { SignTypedDataVersion } from './constants'; @@ -26,6 +27,7 @@ import type { export type InitCoverageCheckRequest = { txParams: [ { + authorizationList?: AuthorizationList; from: string; to?: string; value?: string; @@ -290,6 +292,7 @@ function makeInitCoverageCheckBody( return { txParams: [ { + authorizationList: txMeta.txParams.authorizationList, from: txMeta.txParams.from, to: txMeta.txParams.to, value: txMeta.txParams.value, From 66e016994598d3bccbe18197d5ba6a1bb41d7eb7 Mon Sep 17 00:00:00 2001 From: lwin Date: Thu, 27 Nov 2025 12:48:14 +0800 Subject: [PATCH 2/2] chore: updated ChangeLog and tests --- packages/shield-controller/CHANGELOG.md | 4 ++ .../shield-controller/src/backend.test.ts | 43 ++++++++++++++++++- packages/shield-controller/src/backend.ts | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/packages/shield-controller/CHANGELOG.md b/packages/shield-controller/CHANGELOG.md index ebc007fed33..b59a5201404 100644 --- a/packages/shield-controller/CHANGELOG.md +++ b/packages/shield-controller/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Added `AuthorizationList` in transaction init and log requests for 7702 transactions. ([#7246](https://github.com/MetaMask/core/pull/7246)) + ### Changed - Move peer dependencies for controller and service packages to direct dependencies ([#7209](https://github.com/MetaMask/core/pull/7209), [#7220](https://github.com/MetaMask/core/pull/7220), [#7236](https://github.com/MetaMask/core/pull/7236)) diff --git a/packages/shield-controller/src/backend.test.ts b/packages/shield-controller/src/backend.test.ts index 820986bc948..fa6d1cae82d 100644 --- a/packages/shield-controller/src/backend.test.ts +++ b/packages/shield-controller/src/backend.test.ts @@ -3,7 +3,11 @@ import { SignatureRequestType, } from '@metamask/signature-controller'; -import { parseSignatureRequestMethod, ShieldRemoteBackend } from './backend'; +import { + makeInitCoverageCheckBody, + parseSignatureRequestMethod, + ShieldRemoteBackend, +} from './backend'; import { SignTypedDataVersion } from './constants'; import { generateMockSignatureRequest, @@ -423,4 +427,41 @@ describe('ShieldRemoteBackend', () => { ); }); }); + + describe('makeInitCoverageCheckBody', () => { + it('makes init coverage check body', () => { + const txMeta = generateMockTxMeta(); + const body = makeInitCoverageCheckBody(txMeta); + expect(body).toMatchObject({ + txParams: [txMeta.txParams], + }); + }); + + it('makes init coverage check body with authorization list', () => { + const txMeta = generateMockTxMeta(); + const body = makeInitCoverageCheckBody({ + ...txMeta, + txParams: { + ...txMeta.txParams, + authorizationList: [ + { + address: '0x0000000000000000000000000000000000000000', + }, + ], + }, + }); + expect(body).toMatchObject({ + txParams: [ + { + ...txMeta.txParams, + authorizationList: [ + { + address: '0x0000000000000000000000000000000000000000', + }, + ], + }, + ], + }); + }); + }); }); diff --git a/packages/shield-controller/src/backend.ts b/packages/shield-controller/src/backend.ts index a5e4c3882a1..83a52fcf05b 100644 --- a/packages/shield-controller/src/backend.ts +++ b/packages/shield-controller/src/backend.ts @@ -286,7 +286,7 @@ export class ShieldRemoteBackend implements ShieldBackend { * @param txMeta - The transaction metadata. * @returns The body for the init coverage check request. */ -function makeInitCoverageCheckBody( +export function makeInitCoverageCheckBody( txMeta: TransactionMeta, ): InitCoverageCheckRequest { return {