@metamask-previews/accounts-controller 24.0.1-preview-5dad659d → 24.0.1-preview-def92ff7

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.
@@ -1,17 +1,12 @@
1
- import { BtcMethod, EthMethod } from "@metamask/keyring-api";
2
- import type { CaipChainId, KeyringAccountType } from "@metamask/keyring-api";
1
+ import type { KeyringAccountType } from "@metamask/keyring-api";
3
2
  import { KeyringTypes } from "@metamask/keyring-controller";
4
3
  import type { InternalAccount } from "@metamask/keyring-internal-api";
5
- export declare const ETH_EOA_METHODS: readonly [EthMethod.PersonalSign, EthMethod.Sign, EthMethod.SignTransaction, EthMethod.SignTypedDataV1, EthMethod.SignTypedDataV3, EthMethod.SignTypedDataV4];
6
- export declare const ETH_ERC_4337_METHODS: readonly [EthMethod.PatchUserOperation, EthMethod.PrepareUserOperation, EthMethod.SignUserOperation];
7
- export declare const createMockInternalAccount: ({ id, address, type, name, keyringType, snap, methods, scopes, importTime, lastSelected, }?: {
4
+ export declare const createMockInternalAccount: ({ id, address, type, name, keyringType, snap, importTime, lastSelected, }?: {
8
5
  id?: string | undefined;
9
6
  address?: string | undefined;
10
7
  type?: KeyringAccountType | undefined;
11
8
  name?: string | undefined;
12
9
  keyringType?: KeyringTypes | undefined;
13
- scopes?: `${string}:${string}`[] | undefined;
14
- methods?: (EthMethod | BtcMethod)[] | undefined;
15
10
  snap?: {
16
11
  id: string;
17
12
  enabled: boolean;
@@ -20,26 +15,4 @@ export declare const createMockInternalAccount: ({ id, address, type, name, keyr
20
15
  importTime?: number | undefined;
21
16
  lastSelected?: number | undefined;
22
17
  }) => InternalAccount;
23
- export declare const createExpectedInternalAccount: (args: Parameters<typeof createMockInternalAccount>[0]) => {
24
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
25
- id: string;
26
- options: Record<string, import("@metamask/utils").Json>;
27
- metadata: {
28
- name: string;
29
- importTime: number;
30
- keyring: {
31
- type: string;
32
- };
33
- nameLastUpdatedAt?: number | undefined;
34
- snap?: {
35
- name: string;
36
- id: string;
37
- enabled: boolean;
38
- } | undefined;
39
- lastSelected?: number | undefined;
40
- };
41
- address: string;
42
- scopes: `${string}:${string}`[];
43
- methods: string[];
44
- };
45
18
  //# sourceMappingURL=mocks.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.d.cts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EACT,SAAS,EAGV,8BAA8B;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,8BAA8B;AAC7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAGtE,eAAO,MAAM,eAAe,+JAOlB,CAAC;AAEX,eAAO,MAAM,oBAAoB,sGAIvB,CAAC;AAEX,eAAO,MAAM,yBAAyB;;;;;;;;;YAoB9B,MAAM;iBACD,OAAO;cACV,MAAM;;;;MAIP,eAyCR,CAAC;AAEF,eAAO,MAAM,6BAA6B,SAClC,WAAW,gCAAgC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;CAOtD,CAAC"}
1
+ {"version":3,"file":"mocks.d.cts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAA8B;AAChE,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAGtE,eAAO,MAAM,yBAAyB;;;;;;;YAgB9B,MAAM;iBACD,OAAO;cACV,MAAM;;;;MAIP,eA0CR,CAAC"}
@@ -1,17 +1,12 @@
1
- import { BtcMethod, EthMethod } from "@metamask/keyring-api";
2
- import type { CaipChainId, KeyringAccountType } from "@metamask/keyring-api";
1
+ import type { KeyringAccountType } from "@metamask/keyring-api";
3
2
  import { KeyringTypes } from "@metamask/keyring-controller";
4
3
  import type { InternalAccount } from "@metamask/keyring-internal-api";
5
- export declare const ETH_EOA_METHODS: readonly [EthMethod.PersonalSign, EthMethod.Sign, EthMethod.SignTransaction, EthMethod.SignTypedDataV1, EthMethod.SignTypedDataV3, EthMethod.SignTypedDataV4];
6
- export declare const ETH_ERC_4337_METHODS: readonly [EthMethod.PatchUserOperation, EthMethod.PrepareUserOperation, EthMethod.SignUserOperation];
7
- export declare const createMockInternalAccount: ({ id, address, type, name, keyringType, snap, methods, scopes, importTime, lastSelected, }?: {
4
+ export declare const createMockInternalAccount: ({ id, address, type, name, keyringType, snap, importTime, lastSelected, }?: {
8
5
  id?: string | undefined;
9
6
  address?: string | undefined;
10
7
  type?: KeyringAccountType | undefined;
11
8
  name?: string | undefined;
12
9
  keyringType?: KeyringTypes | undefined;
13
- scopes?: `${string}:${string}`[] | undefined;
14
- methods?: (EthMethod | BtcMethod)[] | undefined;
15
10
  snap?: {
16
11
  id: string;
17
12
  enabled: boolean;
@@ -20,26 +15,4 @@ export declare const createMockInternalAccount: ({ id, address, type, name, keyr
20
15
  importTime?: number | undefined;
21
16
  lastSelected?: number | undefined;
22
17
  }) => InternalAccount;
23
- export declare const createExpectedInternalAccount: (args: Parameters<typeof createMockInternalAccount>[0]) => {
24
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
25
- id: string;
26
- options: Record<string, import("@metamask/utils").Json>;
27
- metadata: {
28
- name: string;
29
- importTime: number;
30
- keyring: {
31
- type: string;
32
- };
33
- nameLastUpdatedAt?: number | undefined;
34
- snap?: {
35
- name: string;
36
- id: string;
37
- enabled: boolean;
38
- } | undefined;
39
- lastSelected?: number | undefined;
40
- };
41
- address: string;
42
- scopes: `${string}:${string}`[];
43
- methods: string[];
44
- };
45
18
  //# sourceMappingURL=mocks.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.d.mts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EACT,SAAS,EAGV,8BAA8B;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,8BAA8B;AAC7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAGtE,eAAO,MAAM,eAAe,+JAOlB,CAAC;AAEX,eAAO,MAAM,oBAAoB,sGAIvB,CAAC;AAEX,eAAO,MAAM,yBAAyB;;;;;;;;;YAoB9B,MAAM;iBACD,OAAO;cACV,MAAM;;;;MAIP,eAyCR,CAAC;AAEF,eAAO,MAAM,6BAA6B,SAClC,WAAW,gCAAgC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;CAOtD,CAAC"}
1
+ {"version":3,"file":"mocks.d.mts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAA8B;AAChE,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAGtE,eAAO,MAAM,yBAAyB;;;;;;;YAgB9B,MAAM;iBACD,OAAO;cACV,MAAM;;;;MAIP,eA0CR,CAAC"}
@@ -1,64 +1,45 @@
1
- import { BtcAccountType, EthAccountType, BtcMethod, EthMethod, EthScope, BtcScope } from "@metamask/keyring-api";
1
+ import { BtcAccountType, EthAccountType, BtcMethod, EthMethod } from "@metamask/keyring-api";
2
2
  import { KeyringTypes } from "@metamask/keyring-controller";
3
3
  import { v4 } from "uuid";
4
- export const ETH_EOA_METHODS = [
5
- EthMethod.PersonalSign,
6
- EthMethod.Sign,
7
- EthMethod.SignTransaction,
8
- EthMethod.SignTypedDataV1,
9
- EthMethod.SignTypedDataV3,
10
- EthMethod.SignTypedDataV4,
11
- ];
12
- export const ETH_ERC_4337_METHODS = [
13
- EthMethod.PatchUserOperation,
14
- EthMethod.PrepareUserOperation,
15
- EthMethod.SignUserOperation,
16
- ];
17
- export const createMockInternalAccount = ({ id = v4(), address = '0x2990079bcdee240329a520d2444386fc119da21a', type = EthAccountType.Eoa, name = 'Account 1', keyringType = KeyringTypes.hd, snap, methods, scopes, importTime = Date.now(), lastSelected = Date.now(), } = {}) => {
18
- const getInternalAccountDefaults = () => {
19
- switch (type) {
20
- case `${EthAccountType.Eoa}`:
21
- return {
22
- methods: [...Object.values(ETH_EOA_METHODS)],
23
- scopes: [EthScope.Eoa],
24
- };
25
- case `${EthAccountType.Erc4337}`:
26
- return {
27
- methods: [...Object.values(ETH_ERC_4337_METHODS)],
28
- scopes: [EthScope.Mainnet], // Assuming we are using mainnet for those Smart Accounts.
29
- };
30
- case `${BtcAccountType.P2wpkh}`:
31
- return {
32
- methods: [...Object.values(BtcMethod)],
33
- scopes: [BtcScope.Mainnet],
34
- };
35
- default:
36
- throw new Error(`Unknown account type: ${type}`);
37
- }
38
- };
39
- const defaults = getInternalAccountDefaults();
4
+ export const createMockInternalAccount = ({ id = v4(), address = '0x2990079bcdee240329a520d2444386fc119da21a', type = EthAccountType.Eoa, name = 'Account 1', keyringType = KeyringTypes.hd, snap, importTime = Date.now(), lastSelected = Date.now(), } = {}) => {
5
+ let methods;
6
+ switch (type) {
7
+ case EthAccountType.Eoa:
8
+ methods = [
9
+ EthMethod.PersonalSign,
10
+ EthMethod.Sign,
11
+ EthMethod.SignTransaction,
12
+ EthMethod.SignTypedDataV1,
13
+ EthMethod.SignTypedDataV3,
14
+ EthMethod.SignTypedDataV4,
15
+ ];
16
+ break;
17
+ case EthAccountType.Erc4337:
18
+ methods = [
19
+ EthMethod.PatchUserOperation,
20
+ EthMethod.PrepareUserOperation,
21
+ EthMethod.SignUserOperation,
22
+ ];
23
+ break;
24
+ case BtcAccountType.P2wpkh:
25
+ methods = [BtcMethod.SendBitcoin];
26
+ break;
27
+ default:
28
+ throw new Error(`Unknown account type: ${type}`);
29
+ }
40
30
  return {
41
31
  id,
42
32
  address,
43
33
  options: {},
44
- methods: methods ?? defaults.methods,
45
- scopes: scopes ?? defaults.scopes,
34
+ methods,
46
35
  type,
47
36
  metadata: {
48
37
  name,
49
38
  keyring: { type: keyringType },
50
39
  importTime,
51
40
  lastSelected,
52
- // Use spread operator, to avoid having a `snap: undefined` if not defined.
53
- ...(snap ? { snap } : {}),
41
+ snap,
54
42
  },
55
43
  };
56
44
  };
57
- export const createExpectedInternalAccount = (args) => {
58
- return createMockInternalAccount({
59
- ...args,
60
- importTime: expect.any(Number),
61
- lastSelected: expect.any(Number),
62
- });
63
- };
64
45
  //# sourceMappingURL=mocks.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.mjs","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,8BAA8B;AAE/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,EAAE,EAAE,aAAa;AAE1B,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,CAAC,YAAY;IACtB,SAAS,CAAC,IAAI;IACd,SAAS,CAAC,eAAe;IACzB,SAAS,CAAC,eAAe;IACzB,SAAS,CAAC,eAAe;IACzB,SAAS,CAAC,eAAe;CACjB,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,SAAS,CAAC,kBAAkB;IAC5B,SAAS,CAAC,oBAAoB;IAC9B,SAAS,CAAC,iBAAiB;CACnB,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,EAAE,GAAG,EAAE,EAAE,EACT,OAAO,GAAG,4CAA4C,EACtD,IAAI,GAAG,cAAc,CAAC,GAAG,EACzB,IAAI,GAAG,WAAW,EAClB,WAAW,GAAG,YAAY,CAAC,EAAE,EAC7B,IAAI,EACJ,OAAO,EACP,MAAM,EACN,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,EACvB,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,MAgBvB,EAAE,EAAmB,EAAE;IACzB,MAAM,0BAA0B,GAAG,GAAG,EAAE;QACtC,QAAQ,IAAI,EAAE;YACZ,KAAK,GAAG,cAAc,CAAC,GAAG,EAAE;gBAC1B,OAAO;oBACL,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;oBAC5C,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;iBACvB,CAAC;YACJ,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE;gBAC9B,OAAO;oBACL,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;oBACjD,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,0DAA0D;iBACvF,CAAC;YACJ,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE;gBAC7B,OAAO;oBACL,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;oBACtC,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;iBAC3B,CAAC;YACJ;gBACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAc,EAAE,CAAC,CAAC;SAC9D;IACH,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,0BAA0B,EAAE,CAAC;IAE9C,OAAO;QACL,EAAE;QACF,OAAO;QACP,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,OAAO,IAAI,QAAQ,CAAC,OAAO;QACpC,MAAM,EAAE,MAAM,IAAI,QAAQ,CAAC,MAAM;QACjC,IAAI;QACJ,QAAQ,EAAE;YACR,IAAI;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YAC9B,UAAU;YACV,YAAY;YACZ,2EAA2E;YAC3E,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1B;KACiB,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,IAAqD,EACrD,EAAE;IACF,OAAO,yBAAyB,CAAC;QAC/B,GAAG,IAAI;QACP,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;QAC9B,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import {\n BtcAccountType,\n EthAccountType,\n BtcMethod,\n EthMethod,\n EthScope,\n BtcScope,\n} from '@metamask/keyring-api';\nimport type { CaipChainId, KeyringAccountType } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { v4 } from 'uuid';\n\nexport const ETH_EOA_METHODS = [\n EthMethod.PersonalSign,\n EthMethod.Sign,\n EthMethod.SignTransaction,\n EthMethod.SignTypedDataV1,\n EthMethod.SignTypedDataV3,\n EthMethod.SignTypedDataV4,\n] as const;\n\nexport const ETH_ERC_4337_METHODS = [\n EthMethod.PatchUserOperation,\n EthMethod.PrepareUserOperation,\n EthMethod.SignUserOperation,\n] as const;\n\nexport const createMockInternalAccount = ({\n id = v4(),\n address = '0x2990079bcdee240329a520d2444386fc119da21a',\n type = EthAccountType.Eoa,\n name = 'Account 1',\n keyringType = KeyringTypes.hd,\n snap,\n methods,\n scopes,\n importTime = Date.now(),\n lastSelected = Date.now(),\n}: {\n id?: string;\n address?: string;\n type?: KeyringAccountType;\n name?: string;\n keyringType?: KeyringTypes;\n scopes?: CaipChainId[];\n methods?: (EthMethod | BtcMethod)[];\n snap?: {\n id: string;\n enabled: boolean;\n name: string;\n };\n importTime?: number;\n lastSelected?: number;\n} = {}): InternalAccount => {\n const getInternalAccountDefaults = () => {\n switch (type) {\n case `${EthAccountType.Eoa}`:\n return {\n methods: [...Object.values(ETH_EOA_METHODS)],\n scopes: [EthScope.Eoa],\n };\n case `${EthAccountType.Erc4337}`:\n return {\n methods: [...Object.values(ETH_ERC_4337_METHODS)],\n scopes: [EthScope.Mainnet], // Assuming we are using mainnet for those Smart Accounts.\n };\n case `${BtcAccountType.P2wpkh}`:\n return {\n methods: [...Object.values(BtcMethod)],\n scopes: [BtcScope.Mainnet],\n };\n default:\n throw new Error(`Unknown account type: ${type as string}`);\n }\n };\n\n const defaults = getInternalAccountDefaults();\n\n return {\n id,\n address,\n options: {},\n methods: methods ?? defaults.methods,\n scopes: scopes ?? defaults.scopes,\n type,\n metadata: {\n name,\n keyring: { type: keyringType },\n importTime,\n lastSelected,\n // Use spread operator, to avoid having a `snap: undefined` if not defined.\n ...(snap ? { snap } : {}),\n },\n } as InternalAccount;\n};\n\nexport const createExpectedInternalAccount = (\n args: Parameters<typeof createMockInternalAccount>[0],\n) => {\n return createMockInternalAccount({\n ...args,\n importTime: expect.any(Number),\n lastSelected: expect.any(Number),\n });\n};\n"]}
1
+ {"version":3,"file":"mocks.mjs","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,SAAS,EACT,SAAS,EACV,8BAA8B;AAE/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,EAAE,EAAE,aAAa;AAE1B,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,EAAE,GAAG,EAAE,EAAE,EACT,OAAO,GAAG,4CAA4C,EACtD,IAAI,GAAG,cAAc,CAAC,GAAG,EACzB,IAAI,GAAG,WAAW,EAClB,WAAW,GAAG,YAAY,CAAC,EAAE,EAC7B,IAAI,EACJ,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,EACvB,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,MAcvB,EAAE,EAAmB,EAAE;IACzB,IAAI,OAAO,CAAC;IAEZ,QAAQ,IAAI,EAAE;QACZ,KAAK,cAAc,CAAC,GAAG;YACrB,OAAO,GAAG;gBACR,SAAS,CAAC,YAAY;gBACtB,SAAS,CAAC,IAAI;gBACd,SAAS,CAAC,eAAe;gBACzB,SAAS,CAAC,eAAe;gBACzB,SAAS,CAAC,eAAe;gBACzB,SAAS,CAAC,eAAe;aAC1B,CAAC;YACF,MAAM;QACR,KAAK,cAAc,CAAC,OAAO;YACzB,OAAO,GAAG;gBACR,SAAS,CAAC,kBAAkB;gBAC5B,SAAS,CAAC,oBAAoB;gBAC9B,SAAS,CAAC,iBAAiB;aAC5B,CAAC;YACF,MAAM;QACR,KAAK,cAAc,CAAC,MAAM;YACxB,OAAO,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAClC,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAc,EAAE,CAAC,CAAC;KAC9D;IAED,OAAO;QACL,EAAE;QACF,OAAO;QACP,OAAO,EAAE,EAAE;QACX,OAAO;QACP,IAAI;QACJ,QAAQ,EAAE;YACR,IAAI;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YAC9B,UAAU;YACV,YAAY;YACZ,IAAI;SACL;KACiB,CAAC;AACvB,CAAC,CAAC","sourcesContent":["import {\n BtcAccountType,\n EthAccountType,\n BtcMethod,\n EthMethod,\n} from '@metamask/keyring-api';\nimport type { KeyringAccountType } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { v4 } from 'uuid';\n\nexport const createMockInternalAccount = ({\n id = v4(),\n address = '0x2990079bcdee240329a520d2444386fc119da21a',\n type = EthAccountType.Eoa,\n name = 'Account 1',\n keyringType = KeyringTypes.hd,\n snap,\n importTime = Date.now(),\n lastSelected = Date.now(),\n}: {\n id?: string;\n address?: string;\n type?: KeyringAccountType;\n name?: string;\n keyringType?: KeyringTypes;\n snap?: {\n id: string;\n enabled: boolean;\n name: string;\n };\n importTime?: number;\n lastSelected?: number;\n} = {}): InternalAccount => {\n let methods;\n\n switch (type) {\n case EthAccountType.Eoa:\n methods = [\n EthMethod.PersonalSign,\n EthMethod.Sign,\n EthMethod.SignTransaction,\n EthMethod.SignTypedDataV1,\n EthMethod.SignTypedDataV3,\n EthMethod.SignTypedDataV4,\n ];\n break;\n case EthAccountType.Erc4337:\n methods = [\n EthMethod.PatchUserOperation,\n EthMethod.PrepareUserOperation,\n EthMethod.SignUserOperation,\n ];\n break;\n case BtcAccountType.P2wpkh:\n methods = [BtcMethod.SendBitcoin];\n break;\n default:\n throw new Error(`Unknown account type: ${type as string}`);\n }\n\n return {\n id,\n address,\n options: {},\n methods,\n type,\n metadata: {\n name,\n keyring: { type: keyringType },\n importTime,\n lastSelected,\n snap,\n },\n } as InternalAccount;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/accounts-controller",
3
- "version": "24.0.1-preview-5dad659d",
3
+ "version": "24.0.1-preview-def92ff7",
4
4
  "description": "Manages internal accounts",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -52,7 +52,6 @@
52
52
  "@metamask/eth-snap-keyring": "^11.1.0",
53
53
  "@metamask/keyring-api": "^17.2.0",
54
54
  "@metamask/keyring-internal-api": "^4.0.3",
55
- "@metamask/keyring-utils": "^2.3.1",
56
55
  "@metamask/network-controller": "^22.2.1",
57
56
  "@metamask/snaps-sdk": "^6.17.1",
58
57
  "@metamask/snaps-utils": "^8.10.0",