Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/chain-agnostic-permission/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `Eip1193Compatible` property in `KnownSessionProperties` enum to support EIP-1193-style connections established through `connect-evm` ([#8731](https://github.com/MetaMask/core/pull/8731))
- Set `sessionProperties: { 'eip1193-compatible': true }` in `getCaip25PermissionFromLegacyPermissions` so that legacy EIP-1193 permission requests are tagged as EIP-1193-compatible ([#8731](https://github.com/MetaMask/core/pull/8731))

### Changed

- Bump `@metamask/permission-controller` from `^12.2.1` to `^13.1.0` ([#8317](https://github.com/MetaMask/core/pull/8317), [#8661](https://github.com/MetaMask/core/pull/8661), [#8722](https://github.com/MetaMask/core/pull/8722))
Expand Down
36 changes: 27 additions & 9 deletions packages/chain-agnostic-permission/src/caip25Permission.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2038,7 +2040,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2076,7 +2080,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2126,7 +2132,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2163,7 +2171,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2201,7 +2211,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2251,7 +2263,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2300,7 +2314,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down Expand Up @@ -2349,7 +2365,9 @@ describe('getCaip25PermissionFromLegacyPermissions', () => {
},
},
isMultichainOrigin: false,
sessionProperties: {},
sessionProperties: {
'eip1193-compatible': true,
},
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
setPermittedEthChainIds,
} from './operators/caip-permission-operator-permittedChains';
import { assertIsInternalScopesObject } from './scope/assert';
import { KnownSessionProperties } from './scope/constants';
import {
isSupportedAccount,
isSupportedScopeString,
Expand Down Expand Up @@ -632,7 +633,9 @@ export const getCaip25PermissionFromLegacyPermissions =
accounts: [],
},
},
sessionProperties: {},
sessionProperties: {
[KnownSessionProperties.Eip1193Compatible]: true,
},
isMultichainOrigin: false,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ describe('KnownSessionProperties', () => {
expect(KnownSessionProperties).toMatchInlineSnapshot(`
{
"Bip122AccountChangedNotifications": "bip122_accountChanged_notifications",
"Eip1193Compatible": "eip1193-compatible",
"SolanaAccountChangedNotifications": "solana_accountChanged_notifications",
"TronAccountChangedNotifications": "tron_accountChanged_notifications",
}
Expand All @@ -74,6 +75,7 @@ describe('KnownSessionProperties', () => {

describe('isKnownSessionPropertyValue', () => {
it('should return true for known session property values', () => {
expect(isKnownSessionPropertyValue('eip1193-compatible')).toBe(true);
expect(
isKnownSessionPropertyValue('solana_accountChanged_notifications'),
).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const KnownNotifications: Record<NonWalletKnownCaipNamespace, string[]> =
* Session properties for known CAIP namespaces.
*/
export enum KnownSessionProperties {
Eip1193Compatible = 'eip1193-compatible',
SolanaAccountChangedNotifications = 'solana_accountChanged_notifications',
TronAccountChangedNotifications = 'tron_accountChanged_notifications',
Bip122AccountChangedNotifications = 'bip122_accountChanged_notifications',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ describe('Scope Support', () => {

describe('isSupportedSessionProperty', () => {
it('returns true for the session property', () => {
expect(
isSupportedSessionProperty(KnownSessionProperties.Eip1193Compatible),
).toBe(true);
expect(
isSupportedSessionProperty(
KnownSessionProperties.SolanaAccountChangedNotifications,
Expand Down
Loading