@metamask-previews/multichain-account-service 0.6.0-preview-93dcb549 → 0.6.0-preview-974a6a01

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/MultichainAccountGroup.cjs.map +1 -1
  3. package/dist/MultichainAccountGroup.d.cts +2 -2
  4. package/dist/MultichainAccountGroup.d.cts.map +1 -1
  5. package/dist/MultichainAccountGroup.d.mts +2 -2
  6. package/dist/MultichainAccountGroup.d.mts.map +1 -1
  7. package/dist/MultichainAccountGroup.mjs.map +1 -1
  8. package/dist/MultichainAccountService.cjs +31 -0
  9. package/dist/MultichainAccountService.cjs.map +1 -1
  10. package/dist/MultichainAccountService.d.cts +19 -2
  11. package/dist/MultichainAccountService.d.cts.map +1 -1
  12. package/dist/MultichainAccountService.d.mts +19 -2
  13. package/dist/MultichainAccountService.d.mts.map +1 -1
  14. package/dist/MultichainAccountService.mjs +31 -0
  15. package/dist/MultichainAccountService.mjs.map +1 -1
  16. package/dist/MultichainAccountWallet.cjs +105 -0
  17. package/dist/MultichainAccountWallet.cjs.map +1 -1
  18. package/dist/MultichainAccountWallet.d.cts +10 -2
  19. package/dist/MultichainAccountWallet.d.cts.map +1 -1
  20. package/dist/MultichainAccountWallet.d.mts +10 -2
  21. package/dist/MultichainAccountWallet.d.mts.map +1 -1
  22. package/dist/MultichainAccountWallet.mjs +105 -0
  23. package/dist/MultichainAccountWallet.mjs.map +1 -1
  24. package/dist/providers/AccountProviderWrapper.cjs +3 -0
  25. package/dist/providers/AccountProviderWrapper.cjs.map +1 -1
  26. package/dist/providers/AccountProviderWrapper.d.cts +1 -0
  27. package/dist/providers/AccountProviderWrapper.d.cts.map +1 -1
  28. package/dist/providers/AccountProviderWrapper.d.mts +1 -0
  29. package/dist/providers/AccountProviderWrapper.d.mts.map +1 -1
  30. package/dist/providers/AccountProviderWrapper.mjs +3 -0
  31. package/dist/providers/AccountProviderWrapper.mjs.map +1 -1
  32. package/dist/providers/BaseBip44AccountProvider.cjs.map +1 -1
  33. package/dist/providers/BaseBip44AccountProvider.d.cts +5 -1
  34. package/dist/providers/BaseBip44AccountProvider.d.cts.map +1 -1
  35. package/dist/providers/BaseBip44AccountProvider.d.mts +5 -1
  36. package/dist/providers/BaseBip44AccountProvider.d.mts.map +1 -1
  37. package/dist/providers/BaseBip44AccountProvider.mjs.map +1 -1
  38. package/dist/providers/EvmAccountProvider.cjs +51 -2
  39. package/dist/providers/EvmAccountProvider.cjs.map +1 -1
  40. package/dist/providers/EvmAccountProvider.d.cts +78 -2
  41. package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
  42. package/dist/providers/EvmAccountProvider.d.mts +78 -2
  43. package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
  44. package/dist/providers/EvmAccountProvider.mjs +52 -3
  45. package/dist/providers/EvmAccountProvider.mjs.map +1 -1
  46. package/dist/providers/SolAccountProvider.cjs +43 -4
  47. package/dist/providers/SolAccountProvider.cjs.map +1 -1
  48. package/dist/providers/SolAccountProvider.d.cts +3 -1
  49. package/dist/providers/SolAccountProvider.d.cts.map +1 -1
  50. package/dist/providers/SolAccountProvider.d.mts +3 -1
  51. package/dist/providers/SolAccountProvider.d.mts.map +1 -1
  52. package/dist/providers/SolAccountProvider.mjs +41 -2
  53. package/dist/providers/SolAccountProvider.mjs.map +1 -1
  54. package/dist/tests/accounts.cjs +11 -6
  55. package/dist/tests/accounts.cjs.map +1 -1
  56. package/dist/tests/accounts.d.cts +4 -1
  57. package/dist/tests/accounts.d.cts.map +1 -1
  58. package/dist/tests/accounts.d.mts +4 -1
  59. package/dist/tests/accounts.d.mts.map +1 -1
  60. package/dist/tests/accounts.mjs +6 -1
  61. package/dist/tests/accounts.mjs.map +1 -1
  62. package/dist/tests/messenger.cjs +2 -0
  63. package/dist/tests/messenger.cjs.map +1 -1
  64. package/dist/tests/messenger.d.cts.map +1 -1
  65. package/dist/tests/messenger.d.mts.map +1 -1
  66. package/dist/tests/messenger.mjs +2 -0
  67. package/dist/tests/messenger.mjs.map +1 -1
  68. package/dist/tests/providers.cjs +1 -0
  69. package/dist/tests/providers.cjs.map +1 -1
  70. package/dist/tests/providers.d.cts +1 -0
  71. package/dist/tests/providers.d.cts.map +1 -1
  72. package/dist/tests/providers.d.mts +1 -0
  73. package/dist/tests/providers.d.mts.map +1 -1
  74. package/dist/tests/providers.mjs +1 -0
  75. package/dist/tests/providers.mjs.map +1 -1
  76. package/dist/types.cjs.map +1 -1
  77. package/dist/types.d.cts +25 -3
  78. package/dist/types.d.cts.map +1 -1
  79. package/dist/types.d.mts +25 -3
  80. package/dist/types.d.mts.map +1 -1
  81. package/dist/types.mjs.map +1 -1
  82. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.cts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAa7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AActE,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD,eAAO,MAAM,iBAAiB;;;;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,eAAe,CAqB3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,eAAe,CAqB3D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,eAAe,CAsB5D,CAAC;AAEF,eAAO,MAAM,yBA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;;;;;;EAA0B,CAAC;AAE3D,eAAO,MAAM,uBAAuB,EAAE,eAarC,CAAC;AAEF,qBAAa,kBAAkB,CAAC,OAAO,SAAS,cAAc;;gBAGhD,OAAO,EAAE,OAAO;IAK5B,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,cAAc,EACxC,OAAO,EAAE,OAAO,GACf,kBAAkB,CAAC,OAAO,CAAC;IAI9B,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC;IAKhC,QAAQ;IAKR,iBAAiB,CAAC,MAAM,EAAE,MAAM;IAKhC,iBAAiB,CAAC,aAAa,EAAE,eAAe;IAOhD,cAAc,CAAC,UAAU,EAAE,MAAM;IAOjC,GAAG;CAGJ;AAED,eAAO,MAAM,4BAA4B,sBAAwB,CAAC;AAElE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK9B,CAAC;AACT,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK9B,CAAC;AACT,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrC,CAAC;AACT,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AAET,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,GACtB,eAAe,CAWjB"}
@@ -1,7 +1,9 @@
1
1
  import type { Bip44Account } from "@metamask/account-api";
2
- import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
2
+ import type { DiscoveredAccount, EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
3
+ import { EthMethod } from "@metamask/keyring-api";
3
4
  import { KeyringTypes } from "@metamask/keyring-controller";
4
5
  import type { InternalAccount } from "@metamask/keyring-internal-api";
6
+ export declare const ETH_EOA_METHODS: readonly [EthMethod.PersonalSign, EthMethod.Sign, EthMethod.SignTransaction, EthMethod.SignTypedDataV1, EthMethod.SignTypedDataV3, EthMethod.SignTypedDataV4];
5
7
  export declare const MOCK_SNAP_1: {
6
8
  id: string;
7
9
  name: string;
@@ -39,6 +41,7 @@ export declare const MOCK_HD_KEYRING_2: {
39
41
  export declare const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount>;
40
42
  export declare const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount>;
41
43
  export declare const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount>;
44
+ export declare const MOCK_SOL_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
42
45
  export declare const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount>;
43
46
  export declare const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount>;
44
47
  export declare const MOCK_SNAP_ACCOUNT_1: Bip44Account<{
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.mts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAa7E,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AActE,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD,eAAO,MAAM,iBAAiB;;;;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,eAAe,CAqB3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,eAAe,CAqB3D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,eAAe,CAsB5D,CAAC;AAEF,eA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;;;;;;;;;;;;;;;;;EAA0B,CAAC;AAE3D,eAAO,MAAM,uBAAuB,EAAE,eAarC,CAAC;AAEF,qBAAa,kBAAkB,CAAC,OAAO,SAAS,cAAc;;gBAGhD,OAAO,EAAE,OAAO;IAK5B,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,cAAc,EACxC,OAAO,EAAE,OAAO,GACf,kBAAkB,CAAC,OAAO,CAAC;IAI9B,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC;IAKhC,QAAQ;IAKR,iBAAiB,CAAC,MAAM,EAAE,MAAM;IAKhC,iBAAiB,CAAC,aAAa,EAAE,eAAe;IAOhD,cAAc,CAAC,UAAU,EAAE,MAAM;IAOjC,GAAG;CAGJ;AAED,eAAO,MAAM,4BAA4B,sBAAwB,CAAC;AAElE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK9B,CAAC;AACT,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK9B,CAAC;AACT,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrC,CAAC;AACT,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AAET,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,GACtB,eAAe,CAWjB"}
@@ -14,7 +14,7 @@ import { isBip44Account } from "@metamask/account-api";
14
14
  import { BtcAccountType, BtcMethod, BtcScope, EthAccountType, EthMethod, EthScope, KeyringAccountEntropyTypeOption, SolAccountType, SolMethod, SolScope } from "@metamask/keyring-api";
15
15
  import { KeyringTypes } from "@metamask/keyring-controller";
16
16
  import { v4 as uuid } from "uuid";
17
- const ETH_EOA_METHODS = [
17
+ export const ETH_EOA_METHODS = [
18
18
  EthMethod.PersonalSign,
19
19
  EthMethod.Sign,
20
20
  EthMethod.SignTransaction,
@@ -118,6 +118,11 @@ export const MOCK_SOL_ACCOUNT_1 = {
118
118
  lastSelected: 0,
119
119
  },
120
120
  };
121
+ export const MOCK_SOL_DISCOVERED_ACCOUNT_1 = {
122
+ type: 'bip44',
123
+ scopes: [SolScope.Mainnet],
124
+ derivationPath: `m/44'/501'/0'/0'`,
125
+ };
121
126
  export const MOCK_BTC_P2WPKH_ACCOUNT_1 = {
122
127
  id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',
123
128
  type: BtcAccountType.P2wpkh,
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.mjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAEvD,OAAO,EACL,cAAc,EACd,SAAS,EACT,QAAQ,EACR,cAAc,EACd,SAAS,EACT,QAAQ,EACR,+BAA+B,EAC/B,cAAc,EACd,SAAS,EACT,QAAQ,EACT,8BAA8B;AAC/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AAElC,MAAM,eAAe,GAAG;IACtB,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,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,EAAE,EAAE,sBAAsB;IAC1B,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE;QACR,YAAY,EAAE,aAAa;KAC5B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,EAAE,EAAE,sBAAsB;IAC1B,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE;QACR,YAAY,EAA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ACjB,GAAG,EAAE,CAAC;AACT,MAAM,CAAC,MAAM,gCAAgC,GAAG,kBAAkB,CAAC,IAAI,CACrE,yBAAyB,CAC1B;KACE,iBAAiB,CAAC,4BAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AACT,MAAM,CAAC,MAAM,8BAA8B,GAAG,kBAAkB,CAAC,IAAI,CACnE,uBAAuB,CACxB;KACE,iBAAiB,CAAC,4BAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AAET,MAAM,UAAU,qBAAqB,CACnC,OAAuB;IAEvB,OAAO;QACL,GAAG,OAAO;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,gBAAgB;YACtB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;YACtB,OAAO,EAAE;gBACP,IAAI,EAAE,mBAAmB;aAC1B;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\nimport type { Bip44Account } from '@metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport {\n BtcAccountType,\n BtcMethod,\n BtcScope,\n EthAccountType,\n EthMethod,\n EthScope,\n KeyringAccountEntropyTypeOption,\n SolAccountType,\n SolMethod,\n SolScope,\n} from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { v4 as uuid } from 'uuid';\n\nconst 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\nconst SOL_METHODS = Object.values(SolMethod);\n\nexport const MOCK_SNAP_1 = {\n id: 'local:mock-snap-id-1',\n name: 'Mock Snap 1',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 1',\n },\n};\n\nexport const MOCK_SNAP_2 = {\n id: 'local:mock-snap-id-2',\n name: 'Mock Snap 2',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 2',\n },\n};\n\nexport const MOCK_ENTROPY_SOURCE_1 = 'mock-keyring-id-1';\nexport const MOCK_ENTROPY_SOURCE_2 = 'mock-keyring-id-2';\n\nexport const MOCK_HD_KEYRING_1 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_1, name: 'HD Keyring 1' },\n accounts: ['0x123'],\n};\n\nexport const MOCK_HD_KEYRING_2 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_2, name: 'HD Keyring 2' },\n accounts: ['0x456'],\n};\n\nexport const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-id-1',\n address: '0x123',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_1.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 1',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount> = {\n id: 'mock-id-2',\n address: '0x456',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 2',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-snap-id-1',\n address: 'aabbccdd',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: SOL_METHODS,\n type: SolAccountType.DataAccount,\n scopes: [SolScope.Mainnet, SolScope.Testnet, SolScope.Devnet],\n metadata: {\n name: 'Solana Account 1',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_1,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',\n type: BtcAccountType.P2wpkh,\n methods: [BtcMethod.SendBitcoin],\n address: 'bc1qx8ls07cy8j8nrluy2u0xwn7gh8fxg0rg4s8zze',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Mainnet],\n metadata: {\n name: 'Bitcoin Native Segwit Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'a20c2e1a-6ff6-40ba-b8e0-ccdb6f9933bb',\n type: BtcAccountType.P2tr,\n methods: [BtcMethod.SendBitcoin],\n address: 'tb1p5cyxnuxmeuwuvkwfem96lxx9wex9kkf4mt9ll6q60jfsnrzqg4sszkqjnh',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Testnet],\n metadata: {\n name: 'Bitcoin Taproot Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_1 = MOCK_SOL_ACCOUNT_1;\n\nexport const MOCK_SNAP_ACCOUNT_2: InternalAccount = {\n id: 'mock-snap-id-2',\n address: '0x789',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Snap Acc 2',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_2,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_3 = MOCK_BTC_P2WPKH_ACCOUNT_1;\nexport const MOCK_SNAP_ACCOUNT_4 = MOCK_BTC_P2TR_ACCOUNT_1;\n\nexport const MOCK_HARDWARE_ACCOUNT_1: InternalAccount = {\n id: 'mock-hardware-id-1',\n address: '0xABC',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Hardware Acc 1',\n keyring: { type: KeyringTypes.ledger },\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport class MockAccountBuilder<Account extends KeyringAccount> {\n readonly #account: Account;\n\n constructor(account: Account) {\n // Make a deep-copy to avoid mutating the same ref.\n this.#account = JSON.parse(JSON.stringify(account));\n }\n\n static from<Account extends KeyringAccount>(\n account: Account,\n ): MockAccountBuilder<Account> {\n return new MockAccountBuilder(account);\n }\n\n withId(id: InternalAccount['id']) {\n this.#account.id = id;\n return this;\n }\n\n withUuid() {\n this.#account.id = uuid();\n return this;\n }\n\n withAddressSuffix(suffix: string) {\n this.#account.address += suffix;\n return this;\n }\n\n withEntropySource(entropySource: EntropySourceId) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.id = entropySource;\n }\n return this;\n }\n\n withGroupIndex(groupIndex: number) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.groupIndex = groupIndex;\n }\n return this;\n }\n\n get() {\n return this.#account;\n }\n}\n\nexport const MOCK_WALLET_1_ENTROPY_SOURCE = MOCK_ENTROPY_SOURCE_1;\n\nexport const MOCK_WALLET_1_EVM_ACCOUNT = MockAccountBuilder.from(\n MOCK_HD_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_SOL_ACCOUNT = MockAccountBuilder.from(\n MOCK_SOL_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2WPKH_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2WPKH_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2TR_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2TR_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\n\nexport function mockAsInternalAccount(\n account: KeyringAccount,\n): InternalAccount {\n return {\n ...account,\n metadata: {\n name: 'Mocked Account',\n importTime: Date.now(),\n keyring: {\n type: 'mock-keyring-type',\n },\n },\n };\n}\n"]}
1
+ {"version":3,"file":"accounts.mjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAMvD,OAAO,EACL,cAAc,EACd,SAAS,EACT,QAAQ,EACR,cAAc,EACd,SAAS,EACT,QAAQ,EACR,+BAA+B,EAC/B,cAAc,EACd,SAAS,EACT,QAAQ,EACT,8BAA8B;AAC/B,OA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O;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,gBAAgB;YACtB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;YACtB,OAAO,EAAE;gBACP,IAAI,EAAE,mBAAmB;aAC1B;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\nimport type { Bip44Account } from '@metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type {\n DiscoveredAccount,\n EntropySourceId,\n KeyringAccount,\n} from '@metamask/keyring-api';\nimport {\n BtcAccountType,\n BtcMethod,\n BtcScope,\n EthAccountType,\n EthMethod,\n EthScope,\n KeyringAccountEntropyTypeOption,\n SolAccountType,\n SolMethod,\n SolScope,\n} from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { v4 as uuid } 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\nconst SOL_METHODS = Object.values(SolMethod);\n\nexport const MOCK_SNAP_1 = {\n id: 'local:mock-snap-id-1',\n name: 'Mock Snap 1',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 1',\n },\n};\n\nexport const MOCK_SNAP_2 = {\n id: 'local:mock-snap-id-2',\n name: 'Mock Snap 2',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 2',\n },\n};\n\nexport const MOCK_ENTROPY_SOURCE_1 = 'mock-keyring-id-1';\nexport const MOCK_ENTROPY_SOURCE_2 = 'mock-keyring-id-2';\n\nexport const MOCK_HD_KEYRING_1 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_1, name: 'HD Keyring 1' },\n accounts: ['0x123'],\n};\n\nexport const MOCK_HD_KEYRING_2 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_2, name: 'HD Keyring 2' },\n accounts: ['0x456'],\n};\n\nexport const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-id-1',\n address: '0x123',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_1.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 1',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount> = {\n id: 'mock-id-2',\n address: '0x456',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 2',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-snap-id-1',\n address: 'aabbccdd',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: SOL_METHODS,\n type: SolAccountType.DataAccount,\n scopes: [SolScope.Mainnet, SolScope.Testnet, SolScope.Devnet],\n metadata: {\n name: 'Solana Account 1',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_1,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_SOL_DISCOVERED_ACCOUNT_1: DiscoveredAccount = {\n type: 'bip44',\n scopes: [SolScope.Mainnet],\n derivationPath: `m/44'/501'/0'/0'`,\n};\n\nexport const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',\n type: BtcAccountType.P2wpkh,\n methods: [BtcMethod.SendBitcoin],\n address: 'bc1qx8ls07cy8j8nrluy2u0xwn7gh8fxg0rg4s8zze',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Mainnet],\n metadata: {\n name: 'Bitcoin Native Segwit Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'a20c2e1a-6ff6-40ba-b8e0-ccdb6f9933bb',\n type: BtcAccountType.P2tr,\n methods: [BtcMethod.SendBitcoin],\n address: 'tb1p5cyxnuxmeuwuvkwfem96lxx9wex9kkf4mt9ll6q60jfsnrzqg4sszkqjnh',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Testnet],\n metadata: {\n name: 'Bitcoin Taproot Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_1 = MOCK_SOL_ACCOUNT_1;\n\nexport const MOCK_SNAP_ACCOUNT_2: InternalAccount = {\n id: 'mock-snap-id-2',\n address: '0x789',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Snap Acc 2',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_2,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_3 = MOCK_BTC_P2WPKH_ACCOUNT_1;\nexport const MOCK_SNAP_ACCOUNT_4 = MOCK_BTC_P2TR_ACCOUNT_1;\n\nexport const MOCK_HARDWARE_ACCOUNT_1: InternalAccount = {\n id: 'mock-hardware-id-1',\n address: '0xABC',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Hardware Acc 1',\n keyring: { type: KeyringTypes.ledger },\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport class MockAccountBuilder<Account extends KeyringAccount> {\n readonly #account: Account;\n\n constructor(account: Account) {\n // Make a deep-copy to avoid mutating the same ref.\n this.#account = JSON.parse(JSON.stringify(account));\n }\n\n static from<Account extends KeyringAccount>(\n account: Account,\n ): MockAccountBuilder<Account> {\n return new MockAccountBuilder(account);\n }\n\n withId(id: InternalAccount['id']) {\n this.#account.id = id;\n return this;\n }\n\n withUuid() {\n this.#account.id = uuid();\n return this;\n }\n\n withAddressSuffix(suffix: string) {\n this.#account.address += suffix;\n return this;\n }\n\n withEntropySource(entropySource: EntropySourceId) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.id = entropySource;\n }\n return this;\n }\n\n withGroupIndex(groupIndex: number) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.groupIndex = groupIndex;\n }\n return this;\n }\n\n get() {\n return this.#account;\n }\n}\n\nexport const MOCK_WALLET_1_ENTROPY_SOURCE = MOCK_ENTROPY_SOURCE_1;\n\nexport const MOCK_WALLET_1_EVM_ACCOUNT = MockAccountBuilder.from(\n MOCK_HD_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_SOL_ACCOUNT = MockAccountBuilder.from(\n MOCK_SOL_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2WPKH_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2WPKH_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2TR_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2TR_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\n\nexport function mockAsInternalAccount(\n account: KeyringAccount,\n): InternalAccount {\n return {\n ...account,\n metadata: {\n name: 'Mocked Account',\n importTime: Date.now(),\n keyring: {\n type: 'mock-keyring-type',\n },\n },\n };\n}\n"]}
@@ -32,6 +32,8 @@ function getMultichainAccountServiceMessenger(messenger) {
32
32
  'SnapController:handleRequest',
33
33
  'KeyringController:withKeyring',
34
34
  'KeyringController:getState',
35
+ 'NetworkController:findNetworkClientIdByChainId',
36
+ 'NetworkController:getNetworkClientById',
35
37
  ],
36
38
  });
37
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"messenger.cjs","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":";;;AAAA,+DAAsD;AAUtD;;;;GAIG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,IAAI,2BAAS,EAGjB,CAAC;AACN,CAAC;AALD,4CAKC;AAED;;;;;GAKG;AACH,SAAgB,oCAAoC,CAClD,SAA8C;IAE9C,OAAO,SAAS,CAAC,aAAa,CAAC;QAC7B,IAAI,EAAE,0BAA0B;QAChC,aAAa,EAAE;YACb,+BAA+B;YAC/B,iCAAiC;YACjC,mCAAmC;SACpC;QACD,cAAc,EAAE;YACd,+BAA+B;YAC/B,wCAAwC;YACxC,2CAA2C;YAC3C,8BAA8B;YAC9B,+BAA+B;YAC/B,4BAA4B;SAC7B;KACF,CAAC,CAAC;AACL,CAAC;AAnBD,oFAmBC","sourcesContent":["import { Messenger } from '@metamask/base-controller';\n\nimport type {\n AllowedActions,\n AllowedEvents,\n MultichainAccountServiceActions,\n MultichainAccountServiceEvents,\n MultichainAccountServiceMessenger,\n} from '../types';\n\n/**\n * Creates a new root messenger instance for testing.\n *\n * @returns A new Messenger instance.\n */\nexport function getRootMessenger() {\n return new Messenger<\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n >();\n}\n\n/**\n * Retrieves a restricted messenger for the MultichainAccountService.\n *\n * @param messenger - The root messenger instance. Defaults to a new Messenger created by getRootMessenger().\n * @returns The restricted messenger for the MultichainAccountService.\n */\nexport function getMultichainAccountServiceMessenger(\n messenger: ReturnType<typeof getRootMessenger>,\n): MultichainAccountServiceMessenger {\n return messenger.getRestricted({\n name: 'MultichainAccountService',\n allowedEvents: [\n 'KeyringController:stateChange',\n 'AccountsController:accountAdded',\n 'AccountsController:accountRemoved',\n ],\n allowedActions: [\n 'AccountsController:getAccount',\n 'AccountsController:getAccountByAddress',\n 'AccountsController:listMultichainAccounts',\n 'SnapController:handleRequest',\n 'KeyringController:withKeyring',\n 'KeyringController:getState',\n ],\n });\n}\n"]}
1
+ {"version":3,"file":"messenger.cjs","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":";;;AAAA,+DAAsD;AAUtD;;;;GAIG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,IAAI,2BAAS,EAGjB,CAAC;AACN,CAAC;AALD,4CAKC;AAED;;;;;GAKG;AACH,SAAgB,oCAAoC,CAClD,SAA8C;IAE9C,OAAO,SAAS,CAAC,aAAa,CAAC;QAC7B,IAAI,EAAE,0BAA0B;QAChC,aAAa,EAAE;YACb,+BAA+B;YAC/B,iCAAiC;YACjC,mCAAmC;SACpC;QACD,cAAc,EAAE;YACd,+BAA+B;YAC/B,wCAAwC;YACxC,2CAA2C;YAC3C,8BAA8B;YAC9B,+BAA+B;YAC/B,4BAA4B;YAC5B,gDAAgD;YAChD,wCAAwC;SACzC;KACF,CAAC,CAAC;AACL,CAAC;AArBD,oFAqBC","sourcesContent":["import { Messenger } from '@metamask/base-controller';\n\nimport type {\n AllowedActions,\n AllowedEvents,\n MultichainAccountServiceActions,\n MultichainAccountServiceEvents,\n MultichainAccountServiceMessenger,\n} from '../types';\n\n/**\n * Creates a new root messenger instance for testing.\n *\n * @returns A new Messenger instance.\n */\nexport function getRootMessenger() {\n return new Messenger<\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n >();\n}\n\n/**\n * Retrieves a restricted messenger for the MultichainAccountService.\n *\n * @param messenger - The root messenger instance. Defaults to a new Messenger created by getRootMessenger().\n * @returns The restricted messenger for the MultichainAccountService.\n */\nexport function getMultichainAccountServiceMessenger(\n messenger: ReturnType<typeof getRootMessenger>,\n): MultichainAccountServiceMessenger {\n return messenger.getRestricted({\n name: 'MultichainAccountService',\n allowedEvents: [\n 'KeyringController:stateChange',\n 'AccountsController:accountAdded',\n 'AccountsController:accountRemoved',\n ],\n allowedActions: [\n 'AccountsController:getAccount',\n 'AccountsController:getAccountByAddress',\n 'AccountsController:listMultichainAccounts',\n 'SnapController:handleRequest',\n 'KeyringController:withKeyring',\n 'KeyringController:getState',\n 'NetworkController:findNetworkClientIdByChainId',\n 'NetworkController:getNetworkClientById',\n ],\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"messenger.d.cts","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kCAAkC;AAEtD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,+BAA+B,EAE/B,iCAAiC,EAClC,qBAAiB;AAElB;;;;GAIG;AACH,wBAAgB,gBAAgB,+EAK/B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC7C,iCAAiC,CAiBnC"}
1
+ {"version":3,"file":"messenger.d.cts","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kCAAkC;AAEtD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,+BAA+B,EAE/B,iCAAiC,EAClC,qBAAiB;AAElB;;;;GAIG;AACH,wBAAgB,gBAAgB,+EAK/B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC7C,iCAAiC,CAmBnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"messenger.d.mts","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kCAAkC;AAEtD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,+BAA+B,EAE/B,iCAAiC,EAClC,qBAAiB;AAElB;;;;GAIG;AACH,wBAAgB,gBAAgB,+EAK/B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC7C,iCAAiC,CAiBnC"}
1
+ {"version":3,"file":"messenger.d.mts","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kCAAkC;AAEtD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,+BAA+B,EAE/B,iCAAiC,EAClC,qBAAiB;AAElB;;;;GAIG;AACH,wBAAgB,gBAAgB,+EAK/B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC7C,iCAAiC,CAmBnC"}
@@ -28,6 +28,8 @@ export function getMultichainAccountServiceMessenger(messenger) {
28
28
  'SnapController:handleRequest',
29
29
  'KeyringController:withKeyring',
30
30
  'KeyringController:getState',
31
+ 'NetworkController:findNetworkClientIdByChainId',
32
+ 'NetworkController:getNetworkClientById',
31
33
  ],
32
34
  });
33
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"messenger.mjs","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kCAAkC;AAUtD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,SAAS,EAGjB,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oCAAoC,CAClD,SAA8C;IAE9C,OAAO,SAAS,CAAC,aAAa,CAAC;QAC7B,IAAI,EAAE,0BAA0B;QAChC,aAAa,EAAE;YACb,+BAA+B;YAC/B,iCAAiC;YACjC,mCAAmC;SACpC;QACD,cAAc,EAAE;YACd,+BAA+B;YAC/B,wCAAwC;YACxC,2CAA2C;YAC3C,8BAA8B;YAC9B,+BAA+B;YAC/B,4BAA4B;SAC7B;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Messenger } from '@metamask/base-controller';\n\nimport type {\n AllowedActions,\n AllowedEvents,\n MultichainAccountServiceActions,\n MultichainAccountServiceEvents,\n MultichainAccountServiceMessenger,\n} from '../types';\n\n/**\n * Creates a new root messenger instance for testing.\n *\n * @returns A new Messenger instance.\n */\nexport function getRootMessenger() {\n return new Messenger<\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n >();\n}\n\n/**\n * Retrieves a restricted messenger for the MultichainAccountService.\n *\n * @param messenger - The root messenger instance. Defaults to a new Messenger created by getRootMessenger().\n * @returns The restricted messenger for the MultichainAccountService.\n */\nexport function getMultichainAccountServiceMessenger(\n messenger: ReturnType<typeof getRootMessenger>,\n): MultichainAccountServiceMessenger {\n return messenger.getRestricted({\n name: 'MultichainAccountService',\n allowedEvents: [\n 'KeyringController:stateChange',\n 'AccountsController:accountAdded',\n 'AccountsController:accountRemoved',\n ],\n allowedActions: [\n 'AccountsController:getAccount',\n 'AccountsController:getAccountByAddress',\n 'AccountsController:listMultichainAccounts',\n 'SnapController:handleRequest',\n 'KeyringController:withKeyring',\n 'KeyringController:getState',\n ],\n });\n}\n"]}
1
+ {"version":3,"file":"messenger.mjs","sourceRoot":"","sources":["../../src/tests/messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kCAAkC;AAUtD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,SAAS,EAGjB,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oCAAoC,CAClD,SAA8C;IAE9C,OAAO,SAAS,CAAC,aAAa,CAAC;QAC7B,IAAI,EAAE,0BAA0B;QAChC,aAAa,EAAE;YACb,+BAA+B;YAC/B,iCAAiC;YACjC,mCAAmC;SACpC;QACD,cAAc,EAAE;YACd,+BAA+B;YAC/B,wCAAwC;YACxC,2CAA2C;YAC3C,8BAA8B;YAC9B,+BAA+B;YAC/B,4BAA4B;YAC5B,gDAAgD;YAChD,wCAAwC;SACzC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Messenger } from '@metamask/base-controller';\n\nimport type {\n AllowedActions,\n AllowedEvents,\n MultichainAccountServiceActions,\n MultichainAccountServiceEvents,\n MultichainAccountServiceMessenger,\n} from '../types';\n\n/**\n * Creates a new root messenger instance for testing.\n *\n * @returns A new Messenger instance.\n */\nexport function getRootMessenger() {\n return new Messenger<\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n >();\n}\n\n/**\n * Retrieves a restricted messenger for the MultichainAccountService.\n *\n * @param messenger - The root messenger instance. Defaults to a new Messenger created by getRootMessenger().\n * @returns The restricted messenger for the MultichainAccountService.\n */\nexport function getMultichainAccountServiceMessenger(\n messenger: ReturnType<typeof getRootMessenger>,\n): MultichainAccountServiceMessenger {\n return messenger.getRestricted({\n name: 'MultichainAccountService',\n allowedEvents: [\n 'KeyringController:stateChange',\n 'AccountsController:accountAdded',\n 'AccountsController:accountRemoved',\n ],\n allowedActions: [\n 'AccountsController:getAccount',\n 'AccountsController:getAccountByAddress',\n 'AccountsController:listMultichainAccounts',\n 'SnapController:handleRequest',\n 'KeyringController:withKeyring',\n 'KeyringController:getState',\n 'NetworkController:findNetworkClientIdByChainId',\n 'NetworkController:getNetworkClientById',\n ],\n });\n}\n"]}
@@ -11,6 +11,7 @@ function makeMockAccountProvider(accounts = []) {
11
11
  createAccounts: jest.fn(),
12
12
  discoverAndCreateAccounts: jest.fn(),
13
13
  isAccountCompatible: jest.fn(),
14
+ getName: jest.fn(),
14
15
  };
15
16
  }
16
17
  exports.makeMockAccountProvider = makeMockAccountProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"providers.cjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AAGxC,uDAAuD;AAYvD,SAAgB,uBAAuB,CACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,yBAAyB,EAAE,IAAI,CAAC,EAAE,EAAE;QACpC,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;KAC/B,CAAC;AACJ,CAAC;AAXD,0DAWC;AAED,SAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,KAAK,GAAG,uBAAuB,EAAE,EACjC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,GAKpB;IACC,8DAA8D;IAC9D,eAAe;IACf,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE1B,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CACnB,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,4BAAc,EAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CACxD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAClD,KAAK,CAAC,UAAU,CAAC,kBAAkB,CACjC,CAAC,EAAsC,EAAE,EAAE;IACzC,6BAA6B;IAC7B,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CACrD,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AA1BD,oDA0BC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n\nimport type { Bip44Account } from '@metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nexport type MockAccountProvider = {\n accounts: KeyringAccount[];\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAndCreateAccounts: jest.Mock;\n isAccountCompatible?: jest.Mock;\n};\n\nexport function makeMockAccountProvider(\n accounts: KeyringAccount[] = [],\n): MockAccountProvider {\n return {\n accounts,\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAndCreateAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n };\n}\n\nexport function setupAccountProvider({\n accounts,\n mocks = makeMockAccountProvider(),\n filter = () => true,\n}: {\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n}): MockAccountProvider {\n // You can mock this and all other mocks will re-use that list\n // of accounts.\n mocks.accounts = accounts;\n\n const getAccounts = () =>\n mocks.accounts.filter(\n (account) => isBip44Account(account) && filter(account),\n );\n\n mocks.getAccounts.mockImplementation(getAccounts);\n mocks.getAccount.mockImplementation(\n (id: Bip44Account<KeyringAccount>['id']) =>\n // Assuming this never fails.\n getAccounts().find((account) => account.id === id),\n );\n\n return mocks;\n}\n"]}
1
+ {"version":3,"file":"providers.cjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AAGxC,uDAAuD;AAavD,SAAgB,uBAAuB,CACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,yBAAyB,EAAE,IAAI,CAAC,EAAE,EAAE;QACpC,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;KACnB,CAAC;AACJ,CAAC;AAZD,0DAYC;AAED,SAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,KAAK,GAAG,uBAAuB,EAAE,EACjC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,GAKpB;IACC,8DAA8D;IAC9D,eAAe;IACf,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE1B,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CACnB,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,4BAAc,EAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CACxD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAClD,KAAK,CAAC,UAAU,CAAC,kBAAkB,CACjC,CAAC,EAAsC,EAAE,EAAE;IACzC,6BAA6B;IAC7B,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CACrD,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AA1BD,oDA0BC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n\nimport type { Bip44Account } from '@metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nexport type MockAccountProvider = {\n accounts: KeyringAccount[];\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAndCreateAccounts: jest.Mock;\n isAccountCompatible?: jest.Mock;\n getName: jest.Mock;\n};\n\nexport function makeMockAccountProvider(\n accounts: KeyringAccount[] = [],\n): MockAccountProvider {\n return {\n accounts,\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAndCreateAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n getName: jest.fn(),\n };\n}\n\nexport function setupAccountProvider({\n accounts,\n mocks = makeMockAccountProvider(),\n filter = () => true,\n}: {\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n}): MockAccountProvider {\n // You can mock this and all other mocks will re-use that list\n // of accounts.\n mocks.accounts = accounts;\n\n const getAccounts = () =>\n mocks.accounts.filter(\n (account) => isBip44Account(account) && filter(account),\n );\n\n mocks.getAccounts.mockImplementation(getAccounts);\n mocks.getAccount.mockImplementation(\n (id: Bip44Account<KeyringAccount>['id']) =>\n // Assuming this never fails.\n getAccounts().find((account) => account.id === id),\n );\n\n return mocks;\n}\n"]}
@@ -7,6 +7,7 @@ export type MockAccountProvider = {
7
7
  createAccounts: jest.Mock;
8
8
  discoverAndCreateAccounts: jest.Mock;
9
9
  isAccountCompatible?: jest.Mock;
10
+ getName: jest.Mock;
10
11
  };
11
12
  export declare function makeMockAccountProvider(accounts?: KeyringAccount[]): MockAccountProvider;
12
13
  export declare function setupAccountProvider({ accounts, mocks, filter, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.cts","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,8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KAAiC,EACjC,MAAmB,GACpB,EAAE;IACD,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;CAC/C,GAAG,mBAAmB,CAkBtB"}
@@ -7,6 +7,7 @@ export type MockAccountProvider = {
7
7
  createAccounts: jest.Mock;
8
8
  discoverAndCreateAccounts: jest.Mock;
9
9
  isAccountCompatible?: jest.Mock;
10
+ getName: jest.Mock;
10
11
  };
11
12
  export declare function makeMockAccountProvider(accounts?: KeyringAccount[]): MockAccountProvider;
12
13
  export declare function setupAccountProvider({ accounts, mocks, filter, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.mts","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B;AAE5D,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;IACtB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;IACvB,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC;IAC1B,yBAAyB,EAAE,IAAI,CAAC,IAAI,CAAC;IACrC,mBAAmB,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CACjC,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,GAAE,cAAc,EAAO,GAC9B,mBAAmB,CASrB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,KAAiC,EACjC,MAAmB,GACpB,EAAE;IACD,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;CAC/C,GAAG,mBAAmB,CAkBtB"}
1
+ {"version":3,"file":"providers.d.mts","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B;AAE5D,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;IACtB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;IACvB,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC;IAC1B,yBAAyB,EAAE,IAAI,CAAC,IAAI,CAAC;IACrC,mBAAmB,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;IAChC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC;CACpB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,GAAE,cAAc,EAAO,GAC9B,mBAAmB,CAUrB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,KAAiC,EACjC,MAAmB,GACpB,EAAE;IACD,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;CAC/C,GAAG,mBAAmB,CAkBtB"}
@@ -8,6 +8,7 @@ export function makeMockAccountProvider(accounts = []) {
8
8
  createAccounts: jest.fn(),
9
9
  discoverAndCreateAccounts: jest.fn(),
10
10
  isAccountCompatible: jest.fn(),
11
+ getName: jest.fn(),
11
12
  };
12
13
  }
13
14
  export function setupAccountProvider({ accounts, mocks = makeMockAccountProvider(), filter = () => true, }) {
@@ -1 +1 @@
1
- {"version":3,"file":"providers.mjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAGxC,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAYvD,MAAM,UAAU,uBAAuB,CACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,yBAAyB,EAAE,IAAI,CAAC,EAAE,EAAE;QACpC,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;KAC/B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,KAAK,GAAG,uBAAuB,EAAE,EACjC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,GAKpB;IACC,8DAA8D;IAC9D,eAAe;IACf,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE1B,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CACnB,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CACxD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAClD,KAAK,CAAC,UAAU,CAAC,kBAAkB,CACjC,CAAC,EAAsC,EAAE,EAAE;IACzC,6BAA6B;IAC7B,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CACrD,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n\nimport type { Bip44Account } from '@metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nexport type MockAccountProvider = {\n accounts: KeyringAccount[];\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAndCreateAccounts: jest.Mock;\n isAccountCompatible?: jest.Mock;\n};\n\nexport function makeMockAccountProvider(\n accounts: KeyringAccount[] = [],\n): MockAccountProvider {\n return {\n accounts,\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAndCreateAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n };\n}\n\nexport function setupAccountProvider({\n accounts,\n mocks = makeMockAccountProvider(),\n filter = () => true,\n}: {\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n}): MockAccountProvider {\n // You can mock this and all other mocks will re-use that list\n // of accounts.\n mocks.accounts = accounts;\n\n const getAccounts = () =>\n mocks.accounts.filter(\n (account) => isBip44Account(account) && filter(account),\n );\n\n mocks.getAccounts.mockImplementation(getAccounts);\n mocks.getAccount.mockImplementation(\n (id: Bip44Account<KeyringAccount>['id']) =>\n // Assuming this never fails.\n getAccounts().find((account) => account.id === id),\n );\n\n return mocks;\n}\n"]}
1
+ {"version":3,"file":"providers.mjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAGxC,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAavD,MAAM,UAAU,uBAAuB,CACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,yBAAyB,EAAE,IAAI,CAAC,EAAE,EAAE;QACpC,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;KACnB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,KAAK,GAAG,uBAAuB,EAAE,EACjC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,GAKpB;IACC,8DAA8D;IAC9D,eAAe;IACf,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE1B,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,CACnB,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CACxD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAClD,KAAK,CAAC,UAAU,CAAC,kBAAkB,CACjC,CAAC,EAAsC,EAAE,EAAE;IACzC,6BAA6B;IAC7B,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CACrD,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n\nimport type { Bip44Account } from '@metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nexport type MockAccountProvider = {\n accounts: KeyringAccount[];\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAndCreateAccounts: jest.Mock;\n isAccountCompatible?: jest.Mock;\n getName: jest.Mock;\n};\n\nexport function makeMockAccountProvider(\n accounts: KeyringAccount[] = [],\n): MockAccountProvider {\n return {\n accounts,\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAndCreateAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n getName: jest.fn(),\n };\n}\n\nexport function setupAccountProvider({\n accounts,\n mocks = makeMockAccountProvider(),\n filter = () => true,\n}: {\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n}): MockAccountProvider {\n // You can mock this and all other mocks will re-use that list\n // of accounts.\n mocks.accounts = accounts;\n\n const getAccounts = () =>\n mocks.accounts.filter(\n (account) => isBip44Account(account) && filter(account),\n );\n\n mocks.getAccounts.mockImplementation(getAccounts);\n mocks.getAccount.mockImplementation(\n (id: Bip44Account<KeyringAccount>['id']) =>\n // Assuming this never fails.\n getAccounts().find((account) => account.id === id),\n );\n\n return mocks;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\nexport type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createNextMultichainAccountGroup`;\n handler: MultichainAccountService['createNextMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceCreateMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createMultichainAccountGroup`;\n handler: MultichainAccountService['createMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceSetBasicFunctionalityAction = {\n type: `${typeof serviceName}:setBasicFunctionality`;\n handler: MultichainAccountService['setBasicFunctionality'];\n};\n\nexport type MultichainAccountServiceAlignWalletAction = {\n type: `${typeof serviceName}:alignWallet`;\n handler: MultichainAccountService['alignWallet'];\n};\n\nexport type MultichainAccountServiceAlignWalletsAction = {\n type: `${typeof serviceName}:alignWallets`;\n handler: MultichainAccountService['alignWallets'];\n};\n\nexport type MultichainAccountServiceGetIsAlignmentInProgressAction = {\n type: `${typeof serviceName}:getIsAlignmentInProgress`;\n handler: MultichainAccountService['getIsAlignmentInProgress'];\n};\n\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountGroupAction\n | MultichainAccountServiceGetMultichainAccountGroupsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction\n | MultichainAccountServiceCreateNextMultichainAccountGroupAction\n | MultichainAccountServiceCreateMultichainAccountGroupAction\n | MultichainAccountServiceSetBasicFunctionalityAction\n | MultichainAccountServiceAlignWalletAction\n | MultichainAccountServiceAlignWalletsAction\n | MultichainAccountServiceGetIsAlignmentInProgressAction;\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents = never;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\nexport type AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\nexport type AllowedEvents =\n | KeyringControllerStateChangeEvent\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRemovedEvent;\n\n/**\n * The messenger restricted to actions and events that\n * {@link MultichainAccountService} needs to access.\n */\nexport type MultichainAccountServiceMessenger = RestrictedMessenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringMetadata,\n KeyringSelector,\n} from '@metamask/keyring-controller';\nimport type { EthKeyring } from '@metamask/keyring-internal-api';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n} from '@metamask/network-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\nexport type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createNextMultichainAccountGroup`;\n handler: MultichainAccountService['createNextMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceCreateMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createMultichainAccountGroup`;\n handler: MultichainAccountService['createMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceSetBasicFunctionalityAction = {\n type: `${typeof serviceName}:setBasicFunctionality`;\n handler: MultichainAccountService['setBasicFunctionality'];\n};\n\nexport type MultichainAccountServiceAlignWalletAction = {\n type: `${typeof serviceName}:alignWallet`;\n handler: MultichainAccountService['alignWallet'];\n};\n\nexport type MultichainAccountServiceAlignWalletsAction = {\n type: `${typeof serviceName}:alignWallets`;\n handler: MultichainAccountService['alignWallets'];\n};\n\nexport type MultichainAccountServiceGetIsAlignmentInProgressAction = {\n type: `${typeof serviceName}:getIsAlignmentInProgress`;\n handler: MultichainAccountService['getIsAlignmentInProgress'];\n};\n\nexport type MultichainAccountServiceCreateMultichainAccountWalletAction = {\n type: `${typeof serviceName}:createMultichainAccountWallet`;\n handler: MultichainAccountService['createMultichainAccountWallet'];\n};\n\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountGroupAction\n | MultichainAccountServiceGetMultichainAccountGroupsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction\n | MultichainAccountServiceCreateNextMultichainAccountGroupAction\n | MultichainAccountServiceCreateMultichainAccountGroupAction\n | MultichainAccountServiceSetBasicFunctionalityAction\n | MultichainAccountServiceAlignWalletAction\n | MultichainAccountServiceAlignWalletsAction\n | MultichainAccountServiceGetIsAlignmentInProgressAction\n | MultichainAccountServiceCreateMultichainAccountWalletAction;\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents = never;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\nexport type AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringWithOptionsAction\n | KeyringControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\nexport type AllowedEvents =\n | KeyringControllerStateChangeEvent\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRemovedEvent;\n\n/**\n * The messenger restricted to actions and events that\n * {@link MultichainAccountService} needs to access.\n */\nexport type MultichainAccountServiceMessenger = RestrictedMessenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Locally widen the withKeyring action so the messenger accepts the optional options\n * parameter (createIfMissing/createWithData) in addition to selector and operation.\n */\nexport type KeyringControllerWithKeyringWithOptionsAction = {\n type: 'KeyringController:withKeyring';\n handler: <\n SelectedKeyring extends EthKeyring = EthKeyring,\n CallbackResult = void,\n >(\n selector: KeyringSelector,\n operation: ({\n keyring,\n metadata,\n }: {\n keyring: SelectedKeyring;\n metadata: KeyringMetadata;\n }) => Promise<CallbackResult>,\n options?:\n | { createIfMissing?: false }\n | { createIfMissing: true; createWithData?: unknown },\n ) => Promise<CallbackResult>;\n};\n"]}
package/dist/types.d.cts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
2
2
  import type { RestrictedMessenger } from "@metamask/base-controller";
3
- import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
3
+ import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringMetadata, KeyringSelector } from "@metamask/keyring-controller";
4
+ import type { EthKeyring } from "@metamask/keyring-internal-api";
5
+ import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction } from "@metamask/network-controller";
4
6
  import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
5
7
  import type { MultichainAccountService, serviceName } from "./MultichainAccountService.cjs";
6
8
  export type MultichainAccountServiceGetMultichainAccountGroupAction = {
@@ -43,11 +45,15 @@ export type MultichainAccountServiceGetIsAlignmentInProgressAction = {
43
45
  type: `${typeof serviceName}:getIsAlignmentInProgress`;
44
46
  handler: MultichainAccountService['getIsAlignmentInProgress'];
45
47
  };
48
+ export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
49
+ type: `${typeof serviceName}:createMultichainAccountWallet`;
50
+ handler: MultichainAccountService['createMultichainAccountWallet'];
51
+ };
46
52
  /**
47
53
  * All actions that {@link MultichainAccountService} registers so that other
48
54
  * modules can call them.
49
55
  */
50
- export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction;
56
+ export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction | MultichainAccountServiceCreateMultichainAccountWalletAction;
51
57
  /**
52
58
  * All events that {@link MultichainAccountService} publishes so that other modules
53
59
  * can subscribe to them.
@@ -57,7 +63,7 @@ export type MultichainAccountServiceEvents = never;
57
63
  * All actions registered by other modules that {@link MultichainAccountService}
58
64
  * calls.
59
65
  */
60
- export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction;
66
+ export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringWithOptionsAction | KeyringControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerFindNetworkClientIdByChainIdAction;
61
67
  /**
62
68
  * All events published by other modules that {@link MultichainAccountService}
63
69
  * subscribes to.
@@ -68,4 +74,20 @@ export type AllowedEvents = KeyringControllerStateChangeEvent | AccountsControll
68
74
  * {@link MultichainAccountService} needs to access.
69
75
  */
70
76
  export type MultichainAccountServiceMessenger = RestrictedMessenger<'MultichainAccountService', MultichainAccountServiceActions | AllowedActions, MultichainAccountServiceEvents | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
77
+ /**
78
+ * Locally widen the withKeyring action so the messenger accepts the optional options
79
+ * parameter (createIfMissing/createWithData) in addition to selector and operation.
80
+ */
81
+ export type KeyringControllerWithKeyringWithOptionsAction = {
82
+ type: 'KeyringController:withKeyring';
83
+ handler: <SelectedKeyring extends EthKeyring = EthKeyring, CallbackResult = void>(selector: KeyringSelector, operation: ({ keyring, metadata, }: {
84
+ keyring: SelectedKeyring;
85
+ metadata: KeyringMetadata;
86
+ }) => Promise<CallbackResult>, options?: {
87
+ createIfMissing?: false;
88
+ } | {
89
+ createIfMissing: true;
90
+ createWithData?: unknown;
91
+ }) => Promise<CallbackResult>;
92
+ };
71
93
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EACnC,qCAAqC,EACrC,kCAAkC,EAClC,2CAA2C,EAC3C,8CAA8C,EAC/C,sCAAsC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EACV,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EACnC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,IAAI,qCAAqC,EAAE,oCAAoC;AAE9G,OAAO,KAAK,EACV,wBAAwB,EACxB,WAAW,EACZ,uCAAmC;AAEpC,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,GAAG,OAAO,WAAW,4BAA4B,CAAC;IACxD,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,GAAG,OAAO,WAAW,6BAA6B,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,GAAG,OAAO,WAAW,6BAA6B,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,GAAG,OAAO,WAAW,8BAA8B,CAAC;IAC1D,OAAO,EAAE,wBAAwB,CAAC,6BAA6B,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,8DAA8D,GAAG;IAC3E,IAAI,EAAE,GAAG,OAAO,WAAW,mCAAmC,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,kCAAkC,CAAC,CAAC;CACvE,CAAC;AAE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1D,mDAAmD,GACnD,yCAAyC,GACzC,0CAA0C,GAC1C,sDAAsD,GACtD,2DAA2D,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB,8CAA8C,GAC9C,kCAAkC,GAClC,2CAA2C,GAC3C,qCAAqC,GACrC,6CAA6C,GAC7C,+BAA+B,GAC/B,2CAA2C,GAC3C,mDAAmD,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,iCAAiC,GACjC,mCAAmC,GACnC,qCAAqC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,mBAAmB,CACjE,0BAA0B,EAC1B,+BAA+B,GAAG,cAAc,EAChD,8BAA8B,GAAG,aAAa,EAC9C,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,CACP,eAAe,SAAS,UAAU,GAAG,UAAU,EAC/C,cAAc,GAAG,IAAI,EAErB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,CAAC,EACV,OAAO,EACP,QAAQ,GACT,EAAE;QACD,OAAO,EAAE,eAAe,CAAC;QACzB,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,OAAO,CAAC,cAAc,CAAC,EAC7B,OAAO,CAAC,EACJ;QAAE,eAAe,CAAC,EAAE,KAAK,CAAA;KAAE,GAC3B;QAAE,eAAe,EAAE,IAAI,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,KACpD,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9B,CAAC"}
package/dist/types.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
2
2
  import type { RestrictedMessenger } from "@metamask/base-controller";
3
- import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
3
+ import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringMetadata, KeyringSelector } from "@metamask/keyring-controller";
4
+ import type { EthKeyring } from "@metamask/keyring-internal-api";
5
+ import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction } from "@metamask/network-controller";
4
6
  import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
5
7
  import type { MultichainAccountService, serviceName } from "./MultichainAccountService.mjs";
6
8
  export type MultichainAccountServiceGetMultichainAccountGroupAction = {
@@ -43,11 +45,15 @@ export type MultichainAccountServiceGetIsAlignmentInProgressAction = {
43
45
  type: `${typeof serviceName}:getIsAlignmentInProgress`;
44
46
  handler: MultichainAccountService['getIsAlignmentInProgress'];
45
47
  };
48
+ export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
49
+ type: `${typeof serviceName}:createMultichainAccountWallet`;
50
+ handler: MultichainAccountService['createMultichainAccountWallet'];
51
+ };
46
52
  /**
47
53
  * All actions that {@link MultichainAccountService} registers so that other
48
54
  * modules can call them.
49
55
  */
50
- export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction;
56
+ export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction | MultichainAccountServiceCreateMultichainAccountWalletAction;
51
57
  /**
52
58
  * All events that {@link MultichainAccountService} publishes so that other modules
53
59
  * can subscribe to them.
@@ -57,7 +63,7 @@ export type MultichainAccountServiceEvents = never;
57
63
  * All actions registered by other modules that {@link MultichainAccountService}
58
64
  * calls.
59
65
  */
60
- export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction;
66
+ export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringWithOptionsAction | KeyringControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerFindNetworkClientIdByChainIdAction;
61
67
  /**
62
68
  * All events published by other modules that {@link MultichainAccountService}
63
69
  * subscribes to.
@@ -68,4 +74,20 @@ export type AllowedEvents = KeyringControllerStateChangeEvent | AccountsControll
68
74
  * {@link MultichainAccountService} needs to access.
69
75
  */
70
76
  export type MultichainAccountServiceMessenger = RestrictedMessenger<'MultichainAccountService', MultichainAccountServiceActions | AllowedActions, MultichainAccountServiceEvents | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
77
+ /**
78
+ * Locally widen the withKeyring action so the messenger accepts the optional options
79
+ * parameter (createIfMissing/createWithData) in addition to selector and operation.
80
+ */
81
+ export type KeyringControllerWithKeyringWithOptionsAction = {
82
+ type: 'KeyringController:withKeyring';
83
+ handler: <SelectedKeyring extends EthKeyring = EthKeyring, CallbackResult = void>(selector: KeyringSelector, operation: ({ keyring, metadata, }: {
84
+ keyring: SelectedKeyring;
85
+ metadata: KeyringMetadata;
86
+ }) => Promise<CallbackResult>, options?: {
87
+ createIfMissing?: false;
88
+ } | {
89
+ createIfMissing: true;
90
+ createWithData?: unknown;
91
+ }) => Promise<CallbackResult>;
92
+ };
71
93
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EACnC,qCAAqC,EACrC,kCAAkC,EAClC,2CAA2C,EAC3C,8CAA8C,EAC/C,sCAAsC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EACV,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EACnC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,IAAI,qCAAqC,EAAE,oCAAoC;AAE9G,OAAO,KAAK,EACV,wBAAwB,EACxB,WAAW,EACZ,uCAAmC;AAEpC,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,GAAG,OAAO,WAAW,4BAA4B,CAAC;IACxD,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,GAAG,OAAO,WAAW,6BAA6B,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,GAAG,OAAO,WAAW,6BAA6B,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,GAAG,OAAO,WAAW,8BAA8B,C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Ae,EAAE,IAAI,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,KACpD,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\nexport type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createNextMultichainAccountGroup`;\n handler: MultichainAccountService['createNextMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceCreateMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createMultichainAccountGroup`;\n handler: MultichainAccountService['createMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceSetBasicFunctionalityAction = {\n type: `${typeof serviceName}:setBasicFunctionality`;\n handler: MultichainAccountService['setBasicFunctionality'];\n};\n\nexport type MultichainAccountServiceAlignWalletAction = {\n type: `${typeof serviceName}:alignWallet`;\n handler: MultichainAccountService['alignWallet'];\n};\n\nexport type MultichainAccountServiceAlignWalletsAction = {\n type: `${typeof serviceName}:alignWallets`;\n handler: MultichainAccountService['alignWallets'];\n};\n\nexport type MultichainAccountServiceGetIsAlignmentInProgressAction = {\n type: `${typeof serviceName}:getIsAlignmentInProgress`;\n handler: MultichainAccountService['getIsAlignmentInProgress'];\n};\n\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountGroupAction\n | MultichainAccountServiceGetMultichainAccountGroupsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction\n | MultichainAccountServiceCreateNextMultichainAccountGroupAction\n | MultichainAccountServiceCreateMultichainAccountGroupAction\n | MultichainAccountServiceSetBasicFunctionalityAction\n | MultichainAccountServiceAlignWalletAction\n | MultichainAccountServiceAlignWalletsAction\n | MultichainAccountServiceGetIsAlignmentInProgressAction;\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents = never;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\nexport type AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\nexport type AllowedEvents =\n | KeyringControllerStateChangeEvent\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRemovedEvent;\n\n/**\n * The messenger restricted to actions and events that\n * {@link MultichainAccountService} needs to access.\n */\nexport type MultichainAccountServiceMessenger = RestrictedMessenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { RestrictedMessenger } from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringMetadata,\n KeyringSelector,\n} from '@metamask/keyring-controller';\nimport type { EthKeyring } from '@metamask/keyring-internal-api';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n} from '@metamask/network-controller';\nimport type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from '@metamask/snaps-controllers';\n\nimport type {\n MultichainAccountService,\n serviceName,\n} from './MultichainAccountService';\n\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `${typeof serviceName}:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `${typeof serviceName}:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `${typeof serviceName}:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `${typeof serviceName}:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\nexport type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createNextMultichainAccountGroup`;\n handler: MultichainAccountService['createNextMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceCreateMultichainAccountGroupAction = {\n type: `${typeof serviceName}:createMultichainAccountGroup`;\n handler: MultichainAccountService['createMultichainAccountGroup'];\n};\n\nexport type MultichainAccountServiceSetBasicFunctionalityAction = {\n type: `${typeof serviceName}:setBasicFunctionality`;\n handler: MultichainAccountService['setBasicFunctionality'];\n};\n\nexport type MultichainAccountServiceAlignWalletAction = {\n type: `${typeof serviceName}:alignWallet`;\n handler: MultichainAccountService['alignWallet'];\n};\n\nexport type MultichainAccountServiceAlignWalletsAction = {\n type: `${typeof serviceName}:alignWallets`;\n handler: MultichainAccountService['alignWallets'];\n};\n\nexport type MultichainAccountServiceGetIsAlignmentInProgressAction = {\n type: `${typeof serviceName}:getIsAlignmentInProgress`;\n handler: MultichainAccountService['getIsAlignmentInProgress'];\n};\n\nexport type MultichainAccountServiceCreateMultichainAccountWalletAction = {\n type: `${typeof serviceName}:createMultichainAccountWallet`;\n handler: MultichainAccountService['createMultichainAccountWallet'];\n};\n\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountGroupAction\n | MultichainAccountServiceGetMultichainAccountGroupsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction\n | MultichainAccountServiceCreateNextMultichainAccountGroupAction\n | MultichainAccountServiceCreateMultichainAccountGroupAction\n | MultichainAccountServiceSetBasicFunctionalityAction\n | MultichainAccountServiceAlignWalletAction\n | MultichainAccountServiceAlignWalletsAction\n | MultichainAccountServiceGetIsAlignmentInProgressAction\n | MultichainAccountServiceCreateMultichainAccountWalletAction;\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents = never;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\nexport type AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringWithOptionsAction\n | KeyringControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\nexport type AllowedEvents =\n | KeyringControllerStateChangeEvent\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRemovedEvent;\n\n/**\n * The messenger restricted to actions and events that\n * {@link MultichainAccountService} needs to access.\n */\nexport type MultichainAccountServiceMessenger = RestrictedMessenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Locally widen the withKeyring action so the messenger accepts the optional options\n * parameter (createIfMissing/createWithData) in addition to selector and operation.\n */\nexport type KeyringControllerWithKeyringWithOptionsAction = {\n type: 'KeyringController:withKeyring';\n handler: <\n SelectedKeyring extends EthKeyring = EthKeyring,\n CallbackResult = void,\n >(\n selector: KeyringSelector,\n operation: ({\n keyring,\n metadata,\n }: {\n keyring: SelectedKeyring;\n metadata: KeyringMetadata;\n }) => Promise<CallbackResult>,\n options?:\n | { createIfMissing?: false }\n | { createIfMissing: true; createWithData?: unknown },\n ) => Promise<CallbackResult>;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/multichain-account-service",
3
- "version": "0.6.0-preview-93dcb549",
3
+ "version": "0.6.0-preview-974a6a01",
4
4
  "description": "Service to manage multichain accounts",
5
5
  "keywords": [
6
6
  "MetaMask",