@metamask-previews/multichain-account-service 4.0.0-preview-7334bbce → 4.0.0-preview-e540d3bf

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 (96) hide show
  1. package/CHANGELOG.md +0 -21
  2. package/dist/MultichainAccountGroup.cjs +45 -84
  3. package/dist/MultichainAccountGroup.cjs.map +1 -1
  4. package/dist/MultichainAccountGroup.d.cts +5 -18
  5. package/dist/MultichainAccountGroup.d.cts.map +1 -1
  6. package/dist/MultichainAccountGroup.d.mts +5 -18
  7. package/dist/MultichainAccountGroup.d.mts.map +1 -1
  8. package/dist/MultichainAccountGroup.mjs +45 -84
  9. package/dist/MultichainAccountGroup.mjs.map +1 -1
  10. package/dist/MultichainAccountService.cjs +113 -126
  11. package/dist/MultichainAccountService.cjs.map +1 -1
  12. package/dist/MultichainAccountService.d.cts +20 -36
  13. package/dist/MultichainAccountService.d.cts.map +1 -1
  14. package/dist/MultichainAccountService.d.mts +20 -36
  15. package/dist/MultichainAccountService.d.mts.map +1 -1
  16. package/dist/MultichainAccountService.mjs +114 -127
  17. package/dist/MultichainAccountService.mjs.map +1 -1
  18. package/dist/MultichainAccountWallet.cjs +123 -107
  19. package/dist/MultichainAccountWallet.cjs.map +1 -1
  20. package/dist/MultichainAccountWallet.d.cts +4 -5
  21. package/dist/MultichainAccountWallet.d.cts.map +1 -1
  22. package/dist/MultichainAccountWallet.d.mts +4 -5
  23. package/dist/MultichainAccountWallet.d.mts.map +1 -1
  24. package/dist/MultichainAccountWallet.mjs +124 -108
  25. package/dist/MultichainAccountWallet.mjs.map +1 -1
  26. package/dist/providers/AccountProviderWrapper.cjs +0 -18
  27. package/dist/providers/AccountProviderWrapper.cjs.map +1 -1
  28. package/dist/providers/AccountProviderWrapper.d.cts +0 -12
  29. package/dist/providers/AccountProviderWrapper.d.cts.map +1 -1
  30. package/dist/providers/AccountProviderWrapper.d.mts +0 -12
  31. package/dist/providers/AccountProviderWrapper.d.mts.map +1 -1
  32. package/dist/providers/AccountProviderWrapper.mjs +0 -18
  33. package/dist/providers/AccountProviderWrapper.mjs.map +1 -1
  34. package/dist/providers/BaseBip44AccountProvider.cjs +20 -45
  35. package/dist/providers/BaseBip44AccountProvider.cjs.map +1 -1
  36. package/dist/providers/BaseBip44AccountProvider.d.cts +6 -58
  37. package/dist/providers/BaseBip44AccountProvider.d.cts.map +1 -1
  38. package/dist/providers/BaseBip44AccountProvider.d.mts +6 -58
  39. package/dist/providers/BaseBip44AccountProvider.d.mts.map +1 -1
  40. package/dist/providers/BaseBip44AccountProvider.mjs +20 -45
  41. package/dist/providers/BaseBip44AccountProvider.mjs.map +1 -1
  42. package/dist/providers/BtcAccountProvider.cjs +0 -1
  43. package/dist/providers/BtcAccountProvider.cjs.map +1 -1
  44. package/dist/providers/BtcAccountProvider.d.cts.map +1 -1
  45. package/dist/providers/BtcAccountProvider.d.mts.map +1 -1
  46. package/dist/providers/BtcAccountProvider.mjs +0 -1
  47. package/dist/providers/BtcAccountProvider.mjs.map +1 -1
  48. package/dist/providers/EvmAccountProvider.cjs +5 -39
  49. package/dist/providers/EvmAccountProvider.cjs.map +1 -1
  50. package/dist/providers/EvmAccountProvider.d.cts +0 -8
  51. package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
  52. package/dist/providers/EvmAccountProvider.d.mts +0 -8
  53. package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
  54. package/dist/providers/EvmAccountProvider.mjs +5 -39
  55. package/dist/providers/EvmAccountProvider.mjs.map +1 -1
  56. package/dist/providers/SolAccountProvider.cjs +0 -4
  57. package/dist/providers/SolAccountProvider.cjs.map +1 -1
  58. package/dist/providers/SolAccountProvider.d.cts.map +1 -1
  59. package/dist/providers/SolAccountProvider.d.mts.map +1 -1
  60. package/dist/providers/SolAccountProvider.mjs +0 -4
  61. package/dist/providers/SolAccountProvider.mjs.map +1 -1
  62. package/dist/providers/TrxAccountProvider.cjs +0 -1
  63. package/dist/providers/TrxAccountProvider.cjs.map +1 -1
  64. package/dist/providers/TrxAccountProvider.d.cts.map +1 -1
  65. package/dist/providers/TrxAccountProvider.d.mts.map +1 -1
  66. package/dist/providers/TrxAccountProvider.mjs +0 -1
  67. package/dist/providers/TrxAccountProvider.mjs.map +1 -1
  68. package/dist/tests/messenger.cjs +0 -3
  69. package/dist/tests/messenger.cjs.map +1 -1
  70. package/dist/tests/messenger.d.cts.map +1 -1
  71. package/dist/tests/messenger.d.mts.map +1 -1
  72. package/dist/tests/messenger.mjs +0 -3
  73. package/dist/tests/messenger.mjs.map +1 -1
  74. package/dist/tests/providers.cjs +7 -62
  75. package/dist/tests/providers.cjs.map +1 -1
  76. package/dist/tests/providers.d.cts +3 -17
  77. package/dist/tests/providers.d.cts.map +1 -1
  78. package/dist/tests/providers.d.mts +3 -17
  79. package/dist/tests/providers.d.mts.map +1 -1
  80. package/dist/tests/providers.mjs +6 -60
  81. package/dist/tests/providers.mjs.map +1 -1
  82. package/dist/types.cjs.map +1 -1
  83. package/dist/types.d.cts +3 -3
  84. package/dist/types.d.cts.map +1 -1
  85. package/dist/types.d.mts +3 -3
  86. package/dist/types.d.mts.map +1 -1
  87. package/dist/types.mjs.map +1 -1
  88. package/dist/utils.cjs +11 -1
  89. package/dist/utils.cjs.map +1 -1
  90. package/dist/utils.d.cts +1 -0
  91. package/dist/utils.d.cts.map +1 -1
  92. package/dist/utils.d.mts +1 -0
  93. package/dist/utils.d.mts.map +1 -1
  94. package/dist/utils.mjs +9 -0
  95. package/dist/utils.mjs.map +1 -1
  96. package/package.json +1 -1
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
2
  /* eslint-disable jsdoc/require-jsdoc */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.mockCreateAccountsOnce = exports.setupBip44AccountProvider = exports.makeMockAccountProvider = void 0;
4
+ exports.setupNamedAccountProvider = exports.makeMockAccountProvider = void 0;
5
+ const account_api_1 = require("@metamask/account-api");
5
6
  const providers_1 = require("../providers/index.cjs");
6
7
  function makeMockAccountProvider(accounts = []) {
7
8
  return {
8
- mockAccounts: accounts,
9
- accounts: new Set(),
9
+ accounts,
10
10
  constructor: jest.fn(),
11
- alignAccounts: jest.fn(),
12
- init: jest.fn(),
13
11
  resyncAccounts: jest.fn(),
14
12
  getAccount: jest.fn(),
15
13
  getAccounts: jest.fn(),
@@ -17,79 +15,26 @@ function makeMockAccountProvider(accounts = []) {
17
15
  discoverAccounts: jest.fn(),
18
16
  isAccountCompatible: jest.fn(),
19
17
  getName: jest.fn(),
20
- isDisabled: jest.fn(),
21
- setEnabled: jest.fn(),
22
- isEnabled: true,
23
18
  };
24
19
  }
25
20
  exports.makeMockAccountProvider = makeMockAccountProvider;
26
- function setupBip44AccountProvider({ name = 'Mocked Provider', accounts, mocks = makeMockAccountProvider(), index, }) {
21
+ function setupNamedAccountProvider({ name = 'Mocked Provider', accounts, mocks = makeMockAccountProvider(), filter = () => true, index, }) {
27
22
  // You can mock this and all other mocks will re-use that list
28
23
  // of accounts.
29
- mocks.mockAccounts = accounts;
30
- mocks.accounts = new Set(accounts.map((account) => account.id));
31
- // Toggle enabled state only
32
- mocks.setEnabled.mockImplementation((enabled) => {
33
- mocks.isEnabled = enabled;
34
- });
35
- mocks.isDisabled.mockImplementation(() => !mocks.isEnabled);
36
- const getAccounts = () => mocks.mockAccounts.filter((account) => [...mocks.accounts].includes(account.id));
24
+ mocks.accounts = accounts;
25
+ const getAccounts = () => mocks.accounts.filter((account) => (0, account_api_1.isBip44Account)(account) && filter(account));
37
26
  mocks.getName.mockImplementation(() => name);
38
27
  mocks.getAccounts.mockImplementation(getAccounts);
39
28
  mocks.getAccount.mockImplementation((id) =>
40
29
  // Assuming this never fails.
41
30
  getAccounts().find((account) => account.id === id));
42
31
  mocks.createAccounts.mockResolvedValue([]);
43
- mocks.alignAccounts.mockImplementation(async ({ entropySource, groupIndex, }) => {
44
- if (mocks.isDisabled()) {
45
- const wrapperAlign = providers_1.AccountProviderWrapper.prototype.alignAccounts;
46
- const ids = await wrapperAlign.call({ isEnabled: false, isDisabled: () => true }, { entropySource, groupIndex });
47
- return ids;
48
- }
49
- const createdAccounts = await mocks.createAccounts({
50
- entropySource,
51
- groupIndex,
52
- });
53
- const baseAlign = providers_1.BaseBip44AccountProvider.prototype.alignAccounts;
54
- const ids = await baseAlign.call({ createAccounts: async () => createdAccounts }, { entropySource, groupIndex });
55
- return ids;
56
- });
57
- mocks.init.mockImplementation((accountIds) => {
58
- accountIds.forEach((id) => mocks.accounts.add(id));
59
- });
60
32
  if (index === 0) {
61
33
  // Make the first provider to always be an `EvmAccountProvider`, since we
62
34
  // check for this pre-condition in some methods.
63
35
  Object.setPrototypeOf(mocks, providers_1.EvmAccountProvider.prototype);
64
36
  }
65
- if (index !== 0) {
66
- Object.setPrototypeOf(mocks, providers_1.AccountProviderWrapper.prototype);
67
- }
68
37
  return mocks;
69
38
  }
70
- exports.setupBip44AccountProvider = setupBip44AccountProvider;
71
- /**
72
- * Helper to mock a single createAccounts call while updating the provider's
73
- * internal state so subsequent getAccount/getAccounts can resolve the accounts.
74
- *
75
- * @param provider - The mock provider whose createAccounts call to mock.
76
- * @param created - The accounts to be returned and persisted in the mock state.
77
- */
78
- function mockCreateAccountsOnce(provider, created) {
79
- provider.createAccounts.mockImplementationOnce(async () => {
80
- // Add newly created accounts to the provider's internal store
81
- for (const acc of created) {
82
- if (!provider.mockAccounts.some((a) => a.id === acc.id)) {
83
- provider.mockAccounts.push(acc);
84
- }
85
- }
86
- // Merge IDs into the visible list used by getAccounts/getAccount
87
- const ids = created.map((a) => a.id);
88
- for (const id of ids) {
89
- provider.accounts.add(id);
90
- }
91
- return created;
92
- });
93
- }
94
- exports.mockCreateAccountsOnce = mockCreateAccountsOnce;
39
+ exports.setupNamedAccountProvider = setupNamedAccountProvider;
95
40
  //# sourceMappingURL=providers.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.cjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":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GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrC,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;YACrB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,wDAmBC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n\nimport type { Bip44Account } from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\n\nimport {\n AccountProviderWrapper,\n EvmAccountProvider,\n BaseBip44AccountProvider,\n} from '../providers';\n\nexport type MockAccountProvider = {\n mockAccounts: KeyringAccount[];\n accounts: Set<KeyringAccount['id']>;\n constructor: jest.Mock;\n alignAccounts: jest.Mock;\n init: jest.Mock;\n resyncAccounts: jest.Mock;\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAccounts: jest.Mock;\n isAccountCompatible: jest.Mock;\n getName: jest.Mock;\n isEnabled: boolean;\n isDisabled: jest.Mock;\n setEnabled: jest.Mock;\n};\n\nexport function makeMockAccountProvider(\n accounts: KeyringAccount[] = [],\n): MockAccountProvider {\n return {\n mockAccounts: accounts,\n accounts: new Set(),\n constructor: jest.fn(),\n alignAccounts: jest.fn(),\n init: jest.fn(),\n resyncAccounts: jest.fn(),\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n getName: jest.fn(),\n isDisabled: jest.fn(),\n setEnabled: jest.fn(),\n isEnabled: true,\n };\n}\n\nexport function setupBip44AccountProvider({\n name = 'Mocked Provider',\n accounts,\n mocks = makeMockAccountProvider(),\n index,\n}: {\n name?: string;\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n index?: number;\n}): MockAccountProvider {\n // You can mock this and all other mocks will re-use that list\n // of accounts.\n mocks.mockAccounts = accounts;\n mocks.accounts = new Set(accounts.map((account) => account.id));\n // Toggle enabled state only\n mocks.setEnabled.mockImplementation((enabled: boolean) => {\n mocks.isEnabled = enabled;\n });\n mocks.isDisabled.mockImplementation(() => !mocks.isEnabled);\n\n const getAccounts = () =>\n mocks.mockAccounts.filter((account) =>\n [...mocks.accounts].includes(account.id),\n );\n\n mocks.getName.mockImplementation(() => name);\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 mocks.createAccounts.mockResolvedValue([]);\n mocks.alignAccounts.mockImplementation(\n async ({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => {\n if (mocks.isDisabled()) {\n const wrapperAlign = (\n AccountProviderWrapper.prototype as unknown as {\n alignAccounts: (\n this: { isEnabled: boolean },\n opts: { entropySource: EntropySourceId; groupIndex: number },\n ) => Promise<string[]>;\n }\n ).alignAccounts;\n const ids = await wrapperAlign.call(\n { isEnabled: false, isDisabled: () => true },\n { entropySource, groupIndex },\n );\n return ids;\n }\n const createdAccounts = await mocks.createAccounts({\n entropySource,\n groupIndex,\n });\n\n const baseAlign = (\n BaseBip44AccountProvider.prototype as unknown as {\n alignAccounts: (\n this: {\n createAccounts: (o: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<unknown[]>;\n },\n opts: { entropySource: EntropySourceId; groupIndex: number },\n ) => Promise<string[]>;\n }\n ).alignAccounts;\n const ids = await baseAlign.call(\n { createAccounts: async () => createdAccounts },\n { entropySource, groupIndex },\n );\n\n return ids;\n },\n );\n mocks.init.mockImplementation(\n (accountIds: Bip44Account<KeyringAccount>['id'][]) => {\n accountIds.forEach((id) => mocks.accounts.add(id));\n },\n );\n\n if (index === 0) {\n // Make the first provider to always be an `EvmAccountProvider`, since we\n // check for this pre-condition in some methods.\n Object.setPrototypeOf(mocks, EvmAccountProvider.prototype);\n }\n\n if (index !== 0) {\n Object.setPrototypeOf(mocks, AccountProviderWrapper.prototype);\n }\n\n return mocks;\n}\n\n/**\n * Helper to mock a single createAccounts call while updating the provider's\n * internal state so subsequent getAccount/getAccounts can resolve the accounts.\n *\n * @param provider - The mock provider whose createAccounts call to mock.\n * @param created - The accounts to be returned and persisted in the mock state.\n */\nexport function mockCreateAccountsOnce(\n provider: MockAccountProvider,\n created: KeyringAccount[],\n): void {\n provider.createAccounts.mockImplementationOnce(async () => {\n // Add newly created accounts to the provider's internal store\n for (const acc of created) {\n if (!provider.mockAccounts.some((a) => a.id === acc.id)) {\n provider.mockAccounts.push(acc);\n }\n }\n // Merge IDs into the visible list used by getAccounts/getAccount\n const ids = created.map((a) => a.id);\n for (const id of ids) {\n provider.accounts.add(id);\n }\n\n return created;\n });\n}\n"]}
1
+ {"version":3,"file":"providers.cjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AAGxC,uDAAuD;AAGvD,sDAAkD;AAclD,SAAgB,uBAAuB,CACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,QAAQ;QACR,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;KACnB,CAAC;AACJ,CAAC;AAdD,0DAcC;AAED,SAAgB,yBAAyB,CAAC,EACxC,IAAI,GAAG,iBAAiB,EACxB,QAAQ,EACR,KAAK,GAAG,uBAAuB,EAAE,EACjC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,EACnB,KAAK,GAON;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,OAAO,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAE7C,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;IACF,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAE3C,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,yEAAyE;QACzE,gDAAgD;QAChD,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,8BAAkB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAvCD,8DAuCC","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\nimport { EvmAccountProvider } from '../providers';\n\nexport type MockAccountProvider = {\n accounts: KeyringAccount[];\n constructor: jest.Mock;\n resyncAccounts: jest.Mock;\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAccounts: 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 constructor: jest.fn(),\n resyncAccounts: jest.fn(),\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n getName: jest.fn(),\n };\n}\n\nexport function setupNamedAccountProvider({\n name = 'Mocked Provider',\n accounts,\n mocks = makeMockAccountProvider(),\n filter = () => true,\n index,\n}: {\n name?: string;\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n index?: number;\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.getName.mockImplementation(() => name);\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 mocks.createAccounts.mockResolvedValue([]);\n\n if (index === 0) {\n // Make the first provider to always be an `EvmAccountProvider`, since we\n // check for this pre-condition in some methods.\n Object.setPrototypeOf(mocks, EvmAccountProvider.prototype);\n }\n\n return mocks;\n}\n"]}
@@ -1,36 +1,22 @@
1
1
  /// <reference types="jest" />
2
2
  import type { KeyringAccount } from "@metamask/keyring-api";
3
3
  export type MockAccountProvider = {
4
- mockAccounts: KeyringAccount[];
5
- accounts: Set<KeyringAccount['id']>;
4
+ accounts: KeyringAccount[];
6
5
  constructor: jest.Mock;
7
- alignAccounts: jest.Mock;
8
- init: jest.Mock;
9
6
  resyncAccounts: jest.Mock;
10
7
  getAccount: jest.Mock;
11
8
  getAccounts: jest.Mock;
12
9
  createAccounts: jest.Mock;
13
10
  discoverAccounts: jest.Mock;
14
- isAccountCompatible: jest.Mock;
11
+ isAccountCompatible?: jest.Mock;
15
12
  getName: jest.Mock;
16
- isEnabled: boolean;
17
- isDisabled: jest.Mock;
18
- setEnabled: jest.Mock;
19
13
  };
20
14
  export declare function makeMockAccountProvider(accounts?: KeyringAccount[]): MockAccountProvider;
21
- export declare function setupBip44AccountProvider({ name, accounts, mocks, index, }: {
15
+ export declare function setupNamedAccountProvider({ name, accounts, mocks, filter, index, }: {
22
16
  name?: string;
23
17
  mocks?: MockAccountProvider;
24
18
  accounts: KeyringAccount[];
25
19
  filter?: (account: KeyringAccount) => boolean;
26
20
  index?: number;
27
21
  }): MockAccountProvider;
28
- /**
29
- * Helper to mock a single createAccounts call while updating the provider's
30
- * internal state so subsequent getAccount/getAccounts can resolve the accounts.
31
- *
32
- * @param provider - The mock provider whose createAccounts call to mock.
33
- * @param created - The accounts to be returned and persisted in the mock state.
34
- */
35
- export declare function mockCreateAccountsOnce(provider: MockAccountProvider, created: KeyringAccount[]): void;
36
22
  //# sourceMappingURL=providers.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.cts","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAmB,cAAc,EAAE,8BAA8B;AAQ7E,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,QAAQ,EAAE,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;IACvB,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC;IACzB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;IAChB,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;IACtB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;IACvB,cAAc,EAAE,IAAI,CAAC,IAAI,C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AAI,CAAC;IAC5B,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,CAYrB;AAED,wBAAgB,yBAAyB,CAAC,EACxC,IAAwB,EACxB,QAAQ,EACR,KAAiC,EACjC,MAAmB,EACnB,KAAK,GACN,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,mBAAmB,CA2BtB"}
@@ -1,36 +1,22 @@
1
1
  /// <reference types="jest" />
2
2
  import type { KeyringAccount } from "@metamask/keyring-api";
3
3
  export type MockAccountProvider = {
4
- mockAccounts: KeyringAccount[];
5
- accounts: Set<KeyringAccount['id']>;
4
+ accounts: KeyringAccount[];
6
5
  constructor: jest.Mock;
7
- alignAccounts: jest.Mock;
8
- init: jest.Mock;
9
6
  resyncAccounts: jest.Mock;
10
7
  getAccount: jest.Mock;
11
8
  getAccounts: jest.Mock;
12
9
  createAccounts: jest.Mock;
13
10
  discoverAccounts: jest.Mock;
14
- isAccountCompatible: jest.Mock;
11
+ isAccountCompatible?: jest.Mock;
15
12
  getName: jest.Mock;
16
- isEnabled: boolean;
17
- isDisabled: jest.Mock;
18
- setEnabled: jest.Mock;
19
13
  };
20
14
  export declare function makeMockAccountProvider(accounts?: KeyringAccount[]): MockAccountProvider;
21
- export declare function setupBip44AccountProvider({ name, accounts, mocks, index, }: {
15
+ export declare function setupNamedAccountProvider({ name, accounts, mocks, filter, index, }: {
22
16
  name?: string;
23
17
  mocks?: MockAccountProvider;
24
18
  accounts: KeyringAccount[];
25
19
  filter?: (account: KeyringAccount) => boolean;
26
20
  index?: number;
27
21
  }): MockAccountProvider;
28
- /**
29
- * Helper to mock a single createAccounts call while updating the provider's
30
- * internal state so subsequent getAccount/getAccounts can resolve the accounts.
31
- *
32
- * @param provider - The mock provider whose createAccounts call to mock.
33
- * @param created - The accounts to be returned and persisted in the mock state.
34
- */
35
- export declare function mockCreateAccountsOnce(provider: MockAccountProvider, created: KeyringAccount[]): void;
36
22
  //# sourceMappingURL=providers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.mts","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAmB,cAAc,EAAE,8BAA8B;AAQ7E,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,QAAQ,EAAE,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;IACvB,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC;IACzB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;IAChB,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;IACtB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;IACvB,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC;IAC1B,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC;IAC5B,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC;IAC/B,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;IACtB,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;CACvB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,GAAE,cAAc,EAAO,GAC9B,mBAAmB,CAkBrB;AAED,wBAAgB,yBAAyB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AC;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,mBAAmB,CA2BtB"}
@@ -1,12 +1,10 @@
1
1
  /* eslint-disable jsdoc/require-jsdoc */
2
- import { AccountProviderWrapper, EvmAccountProvider, BaseBip44AccountProvider } from "../providers/index.mjs";
2
+ import { isBip44Account } from "@metamask/account-api";
3
+ import { EvmAccountProvider } from "../providers/index.mjs";
3
4
  export function makeMockAccountProvider(accounts = []) {
4
5
  return {
5
- mockAccounts: accounts,
6
- accounts: new Set(),
6
+ accounts,
7
7
  constructor: jest.fn(),
8
- alignAccounts: jest.fn(),
9
- init: jest.fn(),
10
8
  resyncAccounts: jest.fn(),
11
9
  getAccount: jest.fn(),
12
10
  getAccounts: jest.fn(),
@@ -14,76 +12,24 @@ export function makeMockAccountProvider(accounts = []) {
14
12
  discoverAccounts: jest.fn(),
15
13
  isAccountCompatible: jest.fn(),
16
14
  getName: jest.fn(),
17
- isDisabled: jest.fn(),
18
- setEnabled: jest.fn(),
19
- isEnabled: true,
20
15
  };
21
16
  }
22
- export function setupBip44AccountProvider({ name = 'Mocked Provider', accounts, mocks = makeMockAccountProvider(), index, }) {
17
+ export function setupNamedAccountProvider({ name = 'Mocked Provider', accounts, mocks = makeMockAccountProvider(), filter = () => true, index, }) {
23
18
  // You can mock this and all other mocks will re-use that list
24
19
  // of accounts.
25
- mocks.mockAccounts = accounts;
26
- mocks.accounts = new Set(accounts.map((account) => account.id));
27
- // Toggle enabled state only
28
- mocks.setEnabled.mockImplementation((enabled) => {
29
- mocks.isEnabled = enabled;
30
- });
31
- mocks.isDisabled.mockImplementation(() => !mocks.isEnabled);
32
- const getAccounts = () => mocks.mockAccounts.filter((account) => [...mocks.accounts].includes(account.id));
20
+ mocks.accounts = accounts;
21
+ const getAccounts = () => mocks.accounts.filter((account) => isBip44Account(account) && filter(account));
33
22
  mocks.getName.mockImplementation(() => name);
34
23
  mocks.getAccounts.mockImplementation(getAccounts);
35
24
  mocks.getAccount.mockImplementation((id) =>
36
25
  // Assuming this never fails.
37
26
  getAccounts().find((account) => account.id === id));
38
27
  mocks.createAccounts.mockResolvedValue([]);
39
- mocks.alignAccounts.mockImplementation(async ({ entropySource, groupIndex, }) => {
40
- if (mocks.isDisabled()) {
41
- const wrapperAlign = AccountProviderWrapper.prototype.alignAccounts;
42
- const ids = await wrapperAlign.call({ isEnabled: false, isDisabled: () => true }, { entropySource, groupIndex });
43
- return ids;
44
- }
45
- const createdAccounts = await mocks.createAccounts({
46
- entropySource,
47
- groupIndex,
48
- });
49
- const baseAlign = BaseBip44AccountProvider.prototype.alignAccounts;
50
- const ids = await baseAlign.call({ createAccounts: async () => createdAccounts }, { entropySource, groupIndex });
51
- return ids;
52
- });
53
- mocks.init.mockImplementation((accountIds) => {
54
- accountIds.forEach((id) => mocks.accounts.add(id));
55
- });
56
28
  if (index === 0) {
57
29
  // Make the first provider to always be an `EvmAccountProvider`, since we
58
30
  // check for this pre-condition in some methods.
59
31
  Object.setPrototypeOf(mocks, EvmAccountProvider.prototype);
60
32
  }
61
- if (index !== 0) {
62
- Object.setPrototypeOf(mocks, AccountProviderWrapper.prototype);
63
- }
64
33
  return mocks;
65
34
  }
66
- /**
67
- * Helper to mock a single createAccounts call while updating the provider's
68
- * internal state so subsequent getAccount/getAccounts can resolve the accounts.
69
- *
70
- * @param provider - The mock provider whose createAccounts call to mock.
71
- * @param created - The accounts to be returned and persisted in the mock state.
72
- */
73
- export function mockCreateAccountsOnce(provider, created) {
74
- provider.createAccounts.mockImplementationOnce(async () => {
75
- // Add newly created accounts to the provider's internal store
76
- for (const acc of created) {
77
- if (!provider.mockAccounts.some((a) => a.id === acc.id)) {
78
- provider.mockAccounts.push(acc);
79
- }
80
- }
81
- // Merge IDs into the visible list used by getAccounts/getAccount
82
- const ids = created.map((a) => a.id);
83
- for (const id of ids) {
84
- provider.accounts.add(id);
85
- }
86
- return created;
87
- });
88
- }
89
35
  //# sourceMappingURL=providers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.mjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAKxC,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACzB,+BAAqB;AAoBtB,MAAM,UAAU,uBAAuB,CACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,QAAQ,EAAE,IAAI,GAAG,EAAE;QACnB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;QACxB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;QACf,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,EACxC,IAAI,GAAG,iBAAiB,EACxB,QAAQ,EACR,KAAK,GAAG,uBAAuB,EAAE,EACjC,KAAK,GAON;IACC,8DAA8D;IAC9D,eAAe;IACf,KAAK,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC9B,KAAK,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OA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AC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBACxD,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QACD,iEAAiE;QACjE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrC,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;YACrB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n\nimport type { Bip44Account } from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\n\nimport {\n AccountProviderWrapper,\n EvmAccountProvider,\n BaseBip44AccountProvider,\n} from '../providers';\n\nexport type MockAccountProvider = {\n mockAccounts: KeyringAccount[];\n accounts: Set<KeyringAccount['id']>;\n constructor: jest.Mock;\n alignAccounts: jest.Mock;\n init: jest.Mock;\n resyncAccounts: jest.Mock;\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAccounts: jest.Mock;\n isAccountCompatible: jest.Mock;\n getName: jest.Mock;\n isEnabled: boolean;\n isDisabled: jest.Mock;\n setEnabled: jest.Mock;\n};\n\nexport function makeMockAccountProvider(\n accounts: KeyringAccount[] = [],\n): MockAccountProvider {\n return {\n mockAccounts: accounts,\n accounts: new Set(),\n constructor: jest.fn(),\n alignAccounts: jest.fn(),\n init: jest.fn(),\n resyncAccounts: jest.fn(),\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n getName: jest.fn(),\n isDisabled: jest.fn(),\n setEnabled: jest.fn(),\n isEnabled: true,\n };\n}\n\nexport function setupBip44AccountProvider({\n name = 'Mocked Provider',\n accounts,\n mocks = makeMockAccountProvider(),\n index,\n}: {\n name?: string;\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n index?: number;\n}): MockAccountProvider {\n // You can mock this and all other mocks will re-use that list\n // of accounts.\n mocks.mockAccounts = accounts;\n mocks.accounts = new Set(accounts.map((account) => account.id));\n // Toggle enabled state only\n mocks.setEnabled.mockImplementation((enabled: boolean) => {\n mocks.isEnabled = enabled;\n });\n mocks.isDisabled.mockImplementation(() => !mocks.isEnabled);\n\n const getAccounts = () =>\n mocks.mockAccounts.filter((account) =>\n [...mocks.accounts].includes(account.id),\n );\n\n mocks.getName.mockImplementation(() => name);\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 mocks.createAccounts.mockResolvedValue([]);\n mocks.alignAccounts.mockImplementation(\n async ({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => {\n if (mocks.isDisabled()) {\n const wrapperAlign = (\n AccountProviderWrapper.prototype as unknown as {\n alignAccounts: (\n this: { isEnabled: boolean },\n opts: { entropySource: EntropySourceId; groupIndex: number },\n ) => Promise<string[]>;\n }\n ).alignAccounts;\n const ids = await wrapperAlign.call(\n { isEnabled: false, isDisabled: () => true },\n { entropySource, groupIndex },\n );\n return ids;\n }\n const createdAccounts = await mocks.createAccounts({\n entropySource,\n groupIndex,\n });\n\n const baseAlign = (\n BaseBip44AccountProvider.prototype as unknown as {\n alignAccounts: (\n this: {\n createAccounts: (o: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<unknown[]>;\n },\n opts: { entropySource: EntropySourceId; groupIndex: number },\n ) => Promise<string[]>;\n }\n ).alignAccounts;\n const ids = await baseAlign.call(\n { createAccounts: async () => createdAccounts },\n { entropySource, groupIndex },\n );\n\n return ids;\n },\n );\n mocks.init.mockImplementation(\n (accountIds: Bip44Account<KeyringAccount>['id'][]) => {\n accountIds.forEach((id) => mocks.accounts.add(id));\n },\n );\n\n if (index === 0) {\n // Make the first provider to always be an `EvmAccountProvider`, since we\n // check for this pre-condition in some methods.\n Object.setPrototypeOf(mocks, EvmAccountProvider.prototype);\n }\n\n if (index !== 0) {\n Object.setPrototypeOf(mocks, AccountProviderWrapper.prototype);\n }\n\n return mocks;\n}\n\n/**\n * Helper to mock a single createAccounts call while updating the provider's\n * internal state so subsequent getAccount/getAccounts can resolve the accounts.\n *\n * @param provider - The mock provider whose createAccounts call to mock.\n * @param created - The accounts to be returned and persisted in the mock state.\n */\nexport function mockCreateAccountsOnce(\n provider: MockAccountProvider,\n created: KeyringAccount[],\n): void {\n provider.createAccounts.mockImplementationOnce(async () => {\n // Add newly created accounts to the provider's internal store\n for (const acc of created) {\n if (!provider.mockAccounts.some((a) => a.id === acc.id)) {\n provider.mockAccounts.push(acc);\n }\n }\n // Merge IDs into the visible list used by getAccounts/getAccount\n const ids = created.map((a) => a.id);\n for (const id of ids) {\n provider.accounts.add(id);\n }\n\n return created;\n });\n}\n"]}
1
+ {"version":3,"file":"providers.mjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAGxC,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAGvD,OAAO,EAAE,kBAAkB,EAAE,+BAAqB;AAclD,MAAM,UAAU,uBAAuB,CACrC,WAA6B,EAAE;IAE/B,OAAO;QACL,QAAQ;QACR,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAA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metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nimport { EvmAccountProvider } from '../providers';\n\nexport type MockAccountProvider = {\n accounts: KeyringAccount[];\n constructor: jest.Mock;\n resyncAccounts: jest.Mock;\n getAccount: jest.Mock;\n getAccounts: jest.Mock;\n createAccounts: jest.Mock;\n discoverAccounts: 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 constructor: jest.fn(),\n resyncAccounts: jest.fn(),\n getAccount: jest.fn(),\n getAccounts: jest.fn(),\n createAccounts: jest.fn(),\n discoverAccounts: jest.fn(),\n isAccountCompatible: jest.fn(),\n getName: jest.fn(),\n };\n}\n\nexport function setupNamedAccountProvider({\n name = 'Mocked Provider',\n accounts,\n mocks = makeMockAccountProvider(),\n filter = () => true,\n index,\n}: {\n name?: string;\n mocks?: MockAccountProvider;\n accounts: KeyringAccount[];\n filter?: (account: KeyringAccount) => boolean;\n index?: number;\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.getName.mockImplementation(() => name);\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 mocks.createAccounts.mockResolvedValue([]);\n\n if (index === 0) {\n // Make the first provider to always be an `EvmAccountProvider`, since we\n // check for this pre-condition in some methods.\n Object.setPrototypeOf(mocks, EvmAccountProvider.prototype);\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 Bip44Account,\n MultichainAccountGroup,\n MultichainAccountWalletId,\n MultichainAccountWalletStatus,\n} from '@metamask/account-api';\nimport type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetAccountsAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type { ErrorReportingServiceCaptureExceptionAction } from '@metamask/error-reporting-service';\nimport type { KeyringAccount } from '@metamask/keyring-api';\nimport type {\n KeyringControllerAddNewKeyringAction,\n KeyringControllerCreateNewVaultAndKeychainAction,\n KeyringControllerCreateNewVaultAndRestoreAction,\n KeyringControllerGetKeyringsByTypeAction,\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\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 MultichainAccountServiceCreateMultichainAccountWalletAction = {\n type: `${typeof serviceName}:createMultichainAccountWallet`;\n handler: MultichainAccountService['createMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceResyncAccountsAction = {\n type: `${typeof serviceName}:resyncAccounts`;\n handler: MultichainAccountService['resyncAccounts'];\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 | MultichainAccountServiceCreateMultichainAccountWalletAction\n | MultichainAccountServiceResyncAccountsAction;\n\nexport type MultichainAccountServiceMultichainAccountGroupCreatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupCreated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceMultichainAccountGroupUpdatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupUpdated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceWalletStatusChangeEvent = {\n type: `${typeof serviceName}:walletStatusChange`;\n payload: [MultichainAccountWalletId, MultichainAccountWalletStatus];\n};\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents =\n | MultichainAccountServiceMultichainAccountGroupCreatedEvent\n | MultichainAccountServiceMultichainAccountGroupUpdatedEvent\n | MultichainAccountServiceWalletStatusChangeEvent;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\ntype AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction\n | KeyringControllerGetKeyringsByTypeAction\n | KeyringControllerAddNewKeyringAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | KeyringControllerCreateNewVaultAndKeychainAction\n | KeyringControllerCreateNewVaultAndRestoreAction\n | ErrorReportingServiceCaptureExceptionAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\ntype 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 = Messenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n>;\n\nexport type MultichainAccountServiceConfig = {\n trace?: TraceCallback;\n};\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n Bip44Account,\n MultichainAccountGroup,\n MultichainAccountWalletId,\n MultichainAccountWalletStatus,\n} from '@metamask/account-api';\nimport type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type { ErrorReportingServiceCaptureExceptionAction } from '@metamask/error-reporting-service';\nimport type { KeyringAccount } from '@metamask/keyring-api';\nimport type {\n KeyringControllerAddNewKeyringAction,\n KeyringControllerGetKeyringsByTypeAction,\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\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 MultichainAccountServiceCreateMultichainAccountWalletAction = {\n type: `${typeof serviceName}:createMultichainAccountWallet`;\n handler: MultichainAccountService['createMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceResyncAccountsAction = {\n type: `${typeof serviceName}:resyncAccounts`;\n handler: MultichainAccountService['resyncAccounts'];\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 | MultichainAccountServiceCreateMultichainAccountWalletAction\n | MultichainAccountServiceResyncAccountsAction;\n\nexport type MultichainAccountServiceMultichainAccountGroupCreatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupCreated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceMultichainAccountGroupUpdatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupUpdated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceWalletStatusChangeEvent = {\n type: `${typeof serviceName}:walletStatusChange`;\n payload: [MultichainAccountWalletId, MultichainAccountWalletStatus];\n};\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents =\n | MultichainAccountServiceMultichainAccountGroupCreatedEvent\n | MultichainAccountServiceMultichainAccountGroupUpdatedEvent\n | MultichainAccountServiceWalletStatusChangeEvent;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\ntype AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction\n | KeyringControllerGetKeyringsByTypeAction\n | KeyringControllerAddNewKeyringAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | ErrorReportingServiceCaptureExceptionAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\ntype 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 = Messenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n>;\n\nexport type MultichainAccountServiceConfig = {\n trace?: TraceCallback;\n};\n"]}
package/dist/types.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { Bip44Account, MultichainAccountGroup, MultichainAccountWalletId, MultichainAccountWalletStatus } from "@metamask/account-api";
2
- import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerGetAccountsAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
2
+ import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
3
3
  import type { TraceCallback } from "@metamask/controller-utils";
4
4
  import type { ErrorReportingServiceCaptureExceptionAction } from "@metamask/error-reporting-service";
5
5
  import type { KeyringAccount } from "@metamask/keyring-api";
6
- import type { KeyringControllerAddNewKeyringAction, KeyringControllerCreateNewVaultAndKeychainAction, KeyringControllerCreateNewVaultAndRestoreAction, KeyringControllerGetKeyringsByTypeAction, KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
6
+ import type { KeyringControllerAddNewKeyringAction, KeyringControllerGetKeyringsByTypeAction, KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
7
7
  import type { Messenger } from "@metamask/messenger";
8
8
  import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction } from "@metamask/network-controller";
9
9
  import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
@@ -78,7 +78,7 @@ export type MultichainAccountServiceEvents = MultichainAccountServiceMultichainA
78
78
  * All actions registered by other modules that {@link MultichainAccountService}
79
79
  * calls.
80
80
  */
81
- type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction | KeyringControllerGetKeyringsByTypeAction | KeyringControllerAddNewKeyringAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerFindNetworkClientIdByChainIdAction | KeyringControllerCreateNewVaultAndKeychainAction | KeyringControllerCreateNewVaultAndRestoreAction | ErrorReportingServiceCaptureExceptionAction;
81
+ type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction | KeyringControllerGetKeyringsByTypeAction | KeyringControllerAddNewKeyringAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerFindNetworkClientIdByChainIdAction | ErrorReportingServiceCaptureExceptionAction;
82
82
  /**
83
83
  * All events published by other modules that {@link MultichainAccountService}
84
84
  * subscribes to.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EACzB,6BAA6B,EAC9B,8BAA8B;AAC/B,OAAO,KAAK,EACV,mCAAmC,EACnC,qCAAqC,EACrC,kCAAkC,EAClC,2CAA2C,EAC3C,mCAAmC,EACnC,8CAA8C,EAC/C,sCAAsC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAChE,OAAO,KAAK,EAAE,2CAA2C,EAAE,0CAA0C;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B;AAC5D,OAAO,KAAK,EACV,oCAAoC,EACpC,gDAAgD,EAChD,+CAA+C,EAC/C,wCAAwC,EACxC,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EACnC,qCAAqC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,mDAAmD,EACnD,2CAA2C,EAC5C,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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C,GAC3C,qCAAqC,GACrC,kCAAkC,GAClC,+BAA+B,GAC/B,wCAAwC,GACxC,oCAAoC,GACpC,2CAA2C,GAC3C,mDAAmD,GACnD,2CAA2C,CAAC;AAEhD;;;GAGG;AACH,KAAK,aAAa,GACd,iCAAiC,GACjC,mCAAmC,GACnC,qCAAqC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,SAAS,CACvD,0BAA0B,EAC1B,+BAA+B,GAAG,cAAc,EAChD,8BAA8B,GAAG,aAAa,CAC/C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
package/dist/types.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { Bip44Account, MultichainAccountGroup, MultichainAccountWalletId, MultichainAccountWalletStatus } from "@metamask/account-api";
2
- import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerGetAccountsAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
2
+ import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
3
3
  import type { TraceCallback } from "@metamask/controller-utils";
4
4
  import type { ErrorReportingServiceCaptureExceptionAction } from "@metamask/error-reporting-service";
5
5
  import type { KeyringAccount } from "@metamask/keyring-api";
6
- import type { KeyringControllerAddNewKeyringAction, KeyringControllerCreateNewVaultAndKeychainAction, KeyringControllerCreateNewVaultAndRestoreAction, KeyringControllerGetKeyringsByTypeAction, KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
6
+ import type { KeyringControllerAddNewKeyringAction, KeyringControllerGetKeyringsByTypeAction, KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
7
7
  import type { Messenger } from "@metamask/messenger";
8
8
  import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction } from "@metamask/network-controller";
9
9
  import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
@@ -78,7 +78,7 @@ export type MultichainAccountServiceEvents = MultichainAccountServiceMultichainA
78
78
  * All actions registered by other modules that {@link MultichainAccountService}
79
79
  * calls.
80
80
  */
81
- type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction | KeyringControllerGetKeyringsByTypeAction | KeyringControllerAddNewKeyringAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerFindNetworkClientIdByChainIdAction | KeyringControllerCreateNewVaultAndKeychainAction | KeyringControllerCreateNewVaultAndRestoreAction | ErrorReportingServiceCaptureExceptionAction;
81
+ type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction | KeyringControllerGetKeyringsByTypeAction | KeyringControllerAddNewKeyringAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerFindNetworkClientIdByChainIdAction | ErrorReportingServiceCaptureExceptionAction;
82
82
  /**
83
83
  * All events published by other modules that {@link MultichainAccountService}
84
84
  * subscribes to.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EACzB,6BAA6B,EAC9B,8BAA8B;AAC/B,OAAO,KAAK,EACV,mCAAmC,EACnC,qCAAqC,EACrC,kCAAkC,EAClC,2CAA2C,EAC3C,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gCAAgC,CAAC;IAC5D,OAAO,EAAE,CAAC,sBAAsB,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,GAAG,OAAO,WAAW,gCAAgC,CAAC;IAC5D,OAAO,EAAE,CAAC,sBAAsB,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,GAAG,OAAO,WAAW,qBAAqB,CAAC;IACjD,OAAO,EAAE,CAAC,yBAAyB,EAAE,6BAA6B,CAAC,CAAC;CACrE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GACtC,0DAA0D,GAC1D,0DAA0D,GAC1D,+CAA+C,CAAC;AAEpD;;;GAGG;AACH,KAAK,cAAc,GACf,8CAA8C,GAC9C,kCAAkC,GAClC,2CAA2C,GAC3C,qCAAqC,GACrC,kCAAkC,GAClC,+BAA+B,GAC/B,wCAAwC,GACxC,oCAAoC,GACpC,2CAA2C,GAC3C,mDAAmD,GACnD,2CAA2C,CAAC;AAEhD;;;GAGG;AACH,KAAK,aAAa,GACd,iCAAiC,GACjC,mCAAmC,GACnC,qCAAqC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,SAAS,CACvD,0BAA0B,EAC1B,+BAA+B,GAAG,cAAc,EAChD,8BAA8B,GAAG,aAAa,CAC/C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n Bip44Account,\n MultichainAccountGroup,\n MultichainAccountWalletId,\n MultichainAccountWalletStatus,\n} from '@metamask/account-api';\nimport type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetAccountsAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type { ErrorReportingServiceCaptureExceptionAction } from '@metamask/error-reporting-service';\nimport type { KeyringAccount } from '@metamask/keyring-api';\nimport type {\n KeyringControllerAddNewKeyringAction,\n KeyringControllerCreateNewVaultAndKeychainAction,\n KeyringControllerCreateNewVaultAndRestoreAction,\n KeyringControllerGetKeyringsByTypeAction,\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\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 MultichainAccountServiceCreateMultichainAccountWalletAction = {\n type: `${typeof serviceName}:createMultichainAccountWallet`;\n handler: MultichainAccountService['createMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceResyncAccountsAction = {\n type: `${typeof serviceName}:resyncAccounts`;\n handler: MultichainAccountService['resyncAccounts'];\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 | MultichainAccountServiceCreateMultichainAccountWalletAction\n | MultichainAccountServiceResyncAccountsAction;\n\nexport type MultichainAccountServiceMultichainAccountGroupCreatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupCreated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceMultichainAccountGroupUpdatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupUpdated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceWalletStatusChangeEvent = {\n type: `${typeof serviceName}:walletStatusChange`;\n payload: [MultichainAccountWalletId, MultichainAccountWalletStatus];\n};\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents =\n | MultichainAccountServiceMultichainAccountGroupCreatedEvent\n | MultichainAccountServiceMultichainAccountGroupUpdatedEvent\n | MultichainAccountServiceWalletStatusChangeEvent;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\ntype AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction\n | KeyringControllerGetKeyringsByTypeAction\n | KeyringControllerAddNewKeyringAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | KeyringControllerCreateNewVaultAndKeychainAction\n | KeyringControllerCreateNewVaultAndRestoreAction\n | ErrorReportingServiceCaptureExceptionAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\ntype 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 = Messenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n>;\n\nexport type MultichainAccountServiceConfig = {\n trace?: TraceCallback;\n};\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n Bip44Account,\n MultichainAccountGroup,\n MultichainAccountWalletId,\n MultichainAccountWalletStatus,\n} from '@metamask/account-api';\nimport type {\n AccountsControllerAccountAddedEvent,\n AccountsControllerAccountRemovedEvent,\n AccountsControllerGetAccountAction,\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerListMultichainAccountsAction,\n} from '@metamask/accounts-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type { ErrorReportingServiceCaptureExceptionAction } from '@metamask/error-reporting-service';\nimport type { KeyringAccount } from '@metamask/keyring-api';\nimport type {\n KeyringControllerAddNewKeyringAction,\n KeyringControllerGetKeyringsByTypeAction,\n KeyringControllerGetStateAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\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 MultichainAccountServiceCreateMultichainAccountWalletAction = {\n type: `${typeof serviceName}:createMultichainAccountWallet`;\n handler: MultichainAccountService['createMultichainAccountWallet'];\n};\n\nexport type MultichainAccountServiceResyncAccountsAction = {\n type: `${typeof serviceName}:resyncAccounts`;\n handler: MultichainAccountService['resyncAccounts'];\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 | MultichainAccountServiceCreateMultichainAccountWalletAction\n | MultichainAccountServiceResyncAccountsAction;\n\nexport type MultichainAccountServiceMultichainAccountGroupCreatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupCreated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceMultichainAccountGroupUpdatedEvent = {\n type: `${typeof serviceName}:multichainAccountGroupUpdated`;\n payload: [MultichainAccountGroup<Bip44Account<KeyringAccount>>];\n};\n\nexport type MultichainAccountServiceWalletStatusChangeEvent = {\n type: `${typeof serviceName}:walletStatusChange`;\n payload: [MultichainAccountWalletId, MultichainAccountWalletStatus];\n};\n\n/**\n * All events that {@link MultichainAccountService} publishes so that other modules\n * can subscribe to them.\n */\nexport type MultichainAccountServiceEvents =\n | MultichainAccountServiceMultichainAccountGroupCreatedEvent\n | MultichainAccountServiceMultichainAccountGroupUpdatedEvent\n | MultichainAccountServiceWalletStatusChangeEvent;\n\n/**\n * All actions registered by other modules that {@link MultichainAccountService}\n * calls.\n */\ntype AllowedActions =\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountByAddressAction\n | SnapControllerHandleSnapRequestAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerGetStateAction\n | KeyringControllerGetKeyringsByTypeAction\n | KeyringControllerAddNewKeyringAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | ErrorReportingServiceCaptureExceptionAction;\n\n/**\n * All events published by other modules that {@link MultichainAccountService}\n * subscribes to.\n */\ntype 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 = Messenger<\n 'MultichainAccountService',\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n>;\n\nexport type MultichainAccountServiceConfig = {\n trace?: TraceCallback;\n};\n"]}
package/dist/utils.cjs CHANGED
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSentryError = void 0;
3
+ exports.createSentryError = exports.toRejectedErrorMessage = void 0;
4
+ const toRejectedErrorMessage = (prefix, results) => {
5
+ let errorMessage = `${prefix}:`;
6
+ for (const r of results) {
7
+ if (r.status === 'rejected') {
8
+ errorMessage += `\n- ${r.reason}`;
9
+ }
10
+ }
11
+ return errorMessage;
12
+ };
13
+ exports.toRejectedErrorMessage = toRejectedErrorMessage;
4
14
  /**
5
15
  * Creates a Sentry error from an error message, an inner error and a context.
6
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACI,MAAM,iBAAiB,GAAG,CAC/B,GAAW,EACX,UAAiB,EACjB,OAAgC,EAChC,EAAE;IACF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAG1B,CAAC;IACF,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACzB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAZW,QAAA,iBAAiB,qBAY5B","sourcesContent":["/**\n * Creates a Sentry error from an error message, an inner error and a context.\n *\n * NOTE: Sentry defaults to a depth of 3 when extracting non-native attributes.\n * As such, the context depth shouldn't be too deep.\n *\n * @param msg - The error message to create a Sentry error from.\n * @param innerError - The inner error to create a Sentry error from.\n * @param context - The context to add to the Sentry error.\n * @returns A Sentry error.\n */\nexport const createSentryError = (\n msg: string,\n innerError: Error,\n context: Record<string, unknown>,\n) => {\n const error = new Error(msg) as Error & {\n cause: Error;\n context: typeof context;\n };\n error.cause = innerError;\n error.context = context;\n return error;\n};\n"]}
1
+ {"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAO,MAAM,sBAAsB,GAAG,CACpC,MAAc,EACd,OAAuC,EACvC,EAAE;IACF,IAAI,YAAY,GAAG,GAAG,MAAM,GAAG,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAC5B,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC;AAEF;;;;;;;;;;GAUG;AACI,MAAM,iBAAiB,GAAG,CAC/B,GAAW,EACX,UAAiB,EACjB,OAAgC,EAChC,EAAE;IACF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAG1B,CAAC;IACF,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACzB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAZW,QAAA,iBAAiB,qBAY5B","sourcesContent":["export const toRejectedErrorMessage = <Result>(\n prefix: string,\n results: PromiseSettledResult<Result>[],\n) => {\n let errorMessage = `${prefix}:`;\n for (const r of results) {\n if (r.status === 'rejected') {\n errorMessage += `\\n- ${r.reason}`;\n }\n }\n return errorMessage;\n};\n\n/**\n * Creates a Sentry error from an error message, an inner error and a context.\n *\n * NOTE: Sentry defaults to a depth of 3 when extracting non-native attributes.\n * As such, the context depth shouldn't be too deep.\n *\n * @param msg - The error message to create a Sentry error from.\n * @param innerError - The inner error to create a Sentry error from.\n * @param context - The context to add to the Sentry error.\n * @returns A Sentry error.\n */\nexport const createSentryError = (\n msg: string,\n innerError: Error,\n context: Record<string, unknown>,\n) => {\n const error = new Error(msg) as Error & {\n cause: Error;\n context: typeof context;\n };\n error.cause = innerError;\n error.context = context;\n return error;\n};\n"]}
package/dist/utils.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const toRejectedErrorMessage: <Result>(prefix: string, results: PromiseSettledResult<Result>[]) => string;
1
2
  /**
2
3
  * Creates a Sentry error from an error message, an inner error and a context.
3
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,QACvB,MAAM,cACC,KAAK,WACR,OAAO,MAAM,EAAE,OAAO,CAAC;WAGvB,KAAK;;CAMf,CAAC"}
1
+ {"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,mBACzB,MAAM,oDAUf,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,QACvB,MAAM,cACC,KAAK,WACR,OAAO,MAAM,EAAE,OAAO,CAAC;WAGvB,KAAK;;CAMf,CAAC"}
package/dist/utils.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const toRejectedErrorMessage: <Result>(prefix: string, results: PromiseSettledResult<Result>[]) => string;
1
2
  /**
2
3
  * Creates a Sentry error from an error message, an inner error and a context.
3
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,QACvB,MAAM,cACC,KAAK,WACR,OAAO,MAAM,EAAE,OAAO,CAAC;WAGvB,KAAK;;CAMf,CAAC"}
1
+ {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,mBACzB,MAAM,oDAUf,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,QACvB,MAAM,cACC,KAAK,WACR,OAAO,MAAM,EAAE,OAAO,CAAC;WAGvB,KAAK;;CAMf,CAAC"}
package/dist/utils.mjs CHANGED
@@ -1,3 +1,12 @@
1
+ export const toRejectedErrorMessage = (prefix, results) => {
2
+ let errorMessage = `${prefix}:`;
3
+ for (const r of results) {
4
+ if (r.status === 'rejected') {
5
+ errorMessage += `\n- ${r.reason}`;
6
+ }
7
+ }
8
+ return errorMessage;
9
+ };
1
10
  /**
2
11
  * Creates a Sentry error from an error message, an inner error and a context.
3
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAW,EACX,UAAiB,EACjB,OAAgC,EAChC,EAAE;IACF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAG1B,CAAC;IACF,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACzB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["/**\n * Creates a Sentry error from an error message, an inner error and a context.\n *\n * NOTE: Sentry defaults to a depth of 3 when extracting non-native attributes.\n * As such, the context depth shouldn't be too deep.\n *\n * @param msg - The error message to create a Sentry error from.\n * @param innerError - The inner error to create a Sentry error from.\n * @param context - The context to add to the Sentry error.\n * @returns A Sentry error.\n */\nexport const createSentryError = (\n msg: string,\n innerError: Error,\n context: Record<string, unknown>,\n) => {\n const error = new Error(msg) as Error & {\n cause: Error;\n context: typeof context;\n };\n error.cause = innerError;\n error.context = context;\n return error;\n};\n"]}
1
+ {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAAc,EACd,OAAuC,EACvC,EAAE;IACF,IAAI,YAAY,GAAG,GAAG,MAAM,GAAG,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAC5B,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAW,EACX,UAAiB,EACjB,OAAgC,EAChC,EAAE;IACF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAG1B,CAAC;IACF,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACzB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["export const toRejectedErrorMessage = <Result>(\n prefix: string,\n results: PromiseSettledResult<Result>[],\n) => {\n let errorMessage = `${prefix}:`;\n for (const r of results) {\n if (r.status === 'rejected') {\n errorMessage += `\\n- ${r.reason}`;\n }\n }\n return errorMessage;\n};\n\n/**\n * Creates a Sentry error from an error message, an inner error and a context.\n *\n * NOTE: Sentry defaults to a depth of 3 when extracting non-native attributes.\n * As such, the context depth shouldn't be too deep.\n *\n * @param msg - The error message to create a Sentry error from.\n * @param innerError - The inner error to create a Sentry error from.\n * @param context - The context to add to the Sentry error.\n * @returns A Sentry error.\n */\nexport const createSentryError = (\n msg: string,\n innerError: Error,\n context: Record<string, unknown>,\n) => {\n const error = new Error(msg) as Error & {\n cause: Error;\n context: typeof context;\n };\n error.cause = innerError;\n error.context = context;\n return error;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/multichain-account-service",
3
- "version": "4.0.0-preview-7334bbce",
3
+ "version": "4.0.0-preview-e540d3bf",
4
4
  "description": "Service to manage multichain accounts",
5
5
  "keywords": [
6
6
  "MetaMask",