@metamask-previews/multichain-account-service 0.6.0-preview-3232d5bd → 0.6.0-preview-2a00636
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.
- package/CHANGELOG.md +0 -7
- package/dist/MultichainAccountGroup.cjs.map +1 -1
- package/dist/MultichainAccountGroup.d.cts +2 -2
- package/dist/MultichainAccountGroup.d.cts.map +1 -1
- package/dist/MultichainAccountGroup.d.mts +2 -2
- package/dist/MultichainAccountGroup.d.mts.map +1 -1
- package/dist/MultichainAccountGroup.mjs.map +1 -1
- package/dist/MultichainAccountService.cjs +0 -29
- package/dist/MultichainAccountService.cjs.map +1 -1
- package/dist/MultichainAccountService.d.cts +2 -20
- package/dist/MultichainAccountService.d.cts.map +1 -1
- package/dist/MultichainAccountService.d.mts +2 -20
- package/dist/MultichainAccountService.d.mts.map +1 -1
- package/dist/MultichainAccountService.mjs +0 -29
- package/dist/MultichainAccountService.mjs.map +1 -1
- package/dist/MultichainAccountWallet.cjs +0 -105
- package/dist/MultichainAccountWallet.cjs.map +1 -1
- package/dist/MultichainAccountWallet.d.cts +2 -10
- package/dist/MultichainAccountWallet.d.cts.map +1 -1
- package/dist/MultichainAccountWallet.d.mts +2 -10
- package/dist/MultichainAccountWallet.d.mts.map +1 -1
- package/dist/MultichainAccountWallet.mjs +0 -105
- package/dist/MultichainAccountWallet.mjs.map +1 -1
- package/dist/providers/AccountProviderWrapper.cjs +0 -3
- package/dist/providers/AccountProviderWrapper.cjs.map +1 -1
- package/dist/providers/AccountProviderWrapper.d.cts +0 -1
- package/dist/providers/AccountProviderWrapper.d.cts.map +1 -1
- package/dist/providers/AccountProviderWrapper.d.mts +0 -1
- package/dist/providers/AccountProviderWrapper.d.mts.map +1 -1
- package/dist/providers/AccountProviderWrapper.mjs +0 -3
- package/dist/providers/AccountProviderWrapper.mjs.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.cjs.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.d.cts +1 -5
- package/dist/providers/BaseBip44AccountProvider.d.cts.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.d.mts +1 -5
- package/dist/providers/BaseBip44AccountProvider.d.mts.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.mjs.map +1 -1
- package/dist/providers/EvmAccountProvider.cjs +2 -51
- package/dist/providers/EvmAccountProvider.cjs.map +1 -1
- package/dist/providers/EvmAccountProvider.d.cts +2 -78
- package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
- package/dist/providers/EvmAccountProvider.d.mts +2 -78
- package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
- package/dist/providers/EvmAccountProvider.mjs +3 -52
- package/dist/providers/EvmAccountProvider.mjs.map +1 -1
- package/dist/providers/SolAccountProvider.cjs +4 -43
- package/dist/providers/SolAccountProvider.cjs.map +1 -1
- package/dist/providers/SolAccountProvider.d.cts +1 -3
- package/dist/providers/SolAccountProvider.d.cts.map +1 -1
- package/dist/providers/SolAccountProvider.d.mts +1 -3
- package/dist/providers/SolAccountProvider.d.mts.map +1 -1
- package/dist/providers/SolAccountProvider.mjs +2 -41
- package/dist/providers/SolAccountProvider.mjs.map +1 -1
- package/dist/tests/accounts.cjs +6 -12
- package/dist/tests/accounts.cjs.map +1 -1
- package/dist/tests/accounts.d.cts +1 -5
- package/dist/tests/accounts.d.cts.map +1 -1
- package/dist/tests/accounts.d.mts +1 -5
- package/dist/tests/accounts.d.mts.map +1 -1
- package/dist/tests/accounts.mjs +1 -7
- package/dist/tests/accounts.mjs.map +1 -1
- package/dist/tests/messenger.cjs +0 -4
- package/dist/tests/messenger.cjs.map +1 -1
- package/dist/tests/messenger.d.cts.map +1 -1
- package/dist/tests/messenger.d.mts.map +1 -1
- package/dist/tests/messenger.mjs +0 -4
- package/dist/tests/messenger.mjs.map +1 -1
- package/dist/tests/providers.cjs +0 -1
- package/dist/tests/providers.cjs.map +1 -1
- package/dist/tests/providers.d.cts +0 -1
- package/dist/tests/providers.d.cts.map +1 -1
- package/dist/tests/providers.d.mts +0 -1
- package/dist/tests/providers.d.mts.map +1 -1
- package/dist/tests/providers.mjs +0 -1
- package/dist/tests/providers.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -8
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +3 -8
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -2
- package/dist/utils.cjs +0 -19
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts +0 -3
- package/dist/utils.d.cts.map +0 -1
- package/dist/utils.d.mts +0 -3
- package/dist/utils.d.mts.map +0 -1
- package/dist/utils.mjs +0 -14
- package/dist/utils.mjs.map +0 -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,
|
|
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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AA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AAET,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,GACtB,eAAe,CAWjB"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { Bip44Account } from "@metamask/account-api";
|
|
2
|
-
import type {
|
|
3
|
-
import { EthMethod } from "@metamask/keyring-api";
|
|
2
|
+
import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
4
3
|
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
5
4
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
6
|
-
export declare const MOCK_MNEMONIC = "abandon ability able about above absent absorb abstract absurd abuse access accident";
|
|
7
|
-
export declare const ETH_EOA_METHODS: readonly [EthMethod.PersonalSign, EthMethod.Sign, EthMethod.SignTransaction, EthMethod.SignTypedDataV1, EthMethod.SignTypedDataV3, EthMethod.SignTypedDataV4];
|
|
8
5
|
export declare const MOCK_SNAP_1: {
|
|
9
6
|
id: string;
|
|
10
7
|
name: string;
|
|
@@ -42,7 +39,6 @@ export declare const MOCK_HD_KEYRING_2: {
|
|
|
42
39
|
export declare const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
43
40
|
export declare const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount>;
|
|
44
41
|
export declare const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
45
|
-
export declare const MOCK_SOL_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
|
|
46
42
|
export declare const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
47
43
|
export declare const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
48
44
|
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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,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"}
|
package/dist/tests/accounts.mjs
CHANGED
|
@@ -14,8 +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
|
-
|
|
18
|
-
export const ETH_EOA_METHODS = [
|
|
17
|
+
const ETH_EOA_METHODS = [
|
|
19
18
|
EthMethod.PersonalSign,
|
|
20
19
|
EthMethod.Sign,
|
|
21
20
|
EthMethod.SignTransaction,
|
|
@@ -119,11 +118,6 @@ export const MOCK_SOL_ACCOUNT_1 = {
|
|
|
119
118
|
lastSelected: 0,
|
|
120
119
|
},
|
|
121
120
|
};
|
|
122
|
-
export const MOCK_SOL_DISCOVERED_ACCOUNT_1 = {
|
|
123
|
-
type: 'bip44',
|
|
124
|
-
scopes: [SolScope.Mainnet],
|
|
125
|
-
derivationPath: `m/44'/501'/0'/0'`,
|
|
126
|
-
};
|
|
127
121
|
export const MOCK_BTC_P2WPKH_ACCOUNT_1 = {
|
|
128
122
|
id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',
|
|
129
123
|
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;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,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AAElC,MAAM,CAAC,MAAM,aAAa,GACxB,sFAAsF,CAAC;AAEzF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,CAAC,YAAY;IACtB,SAAS,CAAC,IAAI;IACd,SAAS,CAAC,eAAe;IACzB,SAAS,CAAC,eAAe;IACzB,SAAS,CAAC,eAAe;IACzB,SAAS,CAAC,eAAe;CACjB,CAAC;AAEX,MAAM,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,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4BAA4B,GAAG,qBAAqB,CAAC;AAElE,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC,IAAI,CAC9D,iBAAiB,CAClB;KACE,iBAAiB,CAAC,4BAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AACT,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC,IAAI,CAC9D,kBAAkB,CACnB;KACE,iBAAiB,CAAC,4BAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,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 {\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 MOCK_MNEMONIC =\n 'abandon ability able about above absent absorb abstract absurd abuse access accident';\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"]}
|
|
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,EAAE,aAAa;KAC5B;CACF,CAAC;AAEF,MA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AAC,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"]}
|
package/dist/tests/messenger.cjs
CHANGED
|
@@ -32,10 +32,6 @@ function getMultichainAccountServiceMessenger(messenger) {
|
|
|
32
32
|
'SnapController:handleRequest',
|
|
33
33
|
'KeyringController:withKeyring',
|
|
34
34
|
'KeyringController:getState',
|
|
35
|
-
'NetworkController:findNetworkClientIdByChainId',
|
|
36
|
-
'NetworkController:getNetworkClientById',
|
|
37
|
-
'KeyringController:getKeyringsByType',
|
|
38
|
-
'KeyringController:addNewKeyring',
|
|
39
35
|
],
|
|
40
36
|
});
|
|
41
37
|
}
|
|
@@ -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;
|
|
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 +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,
|
|
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 +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,
|
|
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"}
|
package/dist/tests/messenger.mjs
CHANGED
|
@@ -28,10 +28,6 @@ export function getMultichainAccountServiceMessenger(messenger) {
|
|
|
28
28
|
'SnapController:handleRequest',
|
|
29
29
|
'KeyringController:withKeyring',
|
|
30
30
|
'KeyringController:getState',
|
|
31
|
-
'NetworkController:findNetworkClientIdByChainId',
|
|
32
|
-
'NetworkController:getNetworkClientById',
|
|
33
|
-
'KeyringController:getKeyringsByType',
|
|
34
|
-
'KeyringController:addNewKeyring',
|
|
35
31
|
],
|
|
36
32
|
});
|
|
37
33
|
}
|
|
@@ -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;
|
|
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"]}
|
package/dist/tests/providers.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.cjs","sourceRoot":"","sources":["../../src/tests/providers.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AAGxC,uDAAuD;
|
|
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"]}
|
|
@@ -7,7 +7,6 @@ export type MockAccountProvider = {
|
|
|
7
7
|
createAccounts: jest.Mock;
|
|
8
8
|
discoverAndCreateAccounts: jest.Mock;
|
|
9
9
|
isAccountCompatible?: jest.Mock;
|
|
10
|
-
getName: jest.Mock;
|
|
11
10
|
};
|
|
12
11
|
export declare function makeMockAccountProvider(accounts?: KeyringAccount[]): MockAccountProvider;
|
|
13
12
|
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,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;
|
|
1
|
+
{"version":3,"file":"providers.d.cts","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"}
|
|
@@ -7,7 +7,6 @@ export type MockAccountProvider = {
|
|
|
7
7
|
createAccounts: jest.Mock;
|
|
8
8
|
discoverAndCreateAccounts: jest.Mock;
|
|
9
9
|
isAccountCompatible?: jest.Mock;
|
|
10
|
-
getName: jest.Mock;
|
|
11
10
|
};
|
|
12
11
|
export declare function makeMockAccountProvider(accounts?: KeyringAccount[]): MockAccountProvider;
|
|
13
12
|
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;
|
|
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"}
|
package/dist/tests/providers.mjs
CHANGED
|
@@ -8,7 +8,6 @@ export function makeMockAccountProvider(accounts = []) {
|
|
|
8
8
|
createAccounts: jest.fn(),
|
|
9
9
|
discoverAndCreateAccounts: jest.fn(),
|
|
10
10
|
isAccountCompatible: jest.fn(),
|
|
11
|
-
getName: jest.fn(),
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
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;
|
|
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"]}
|
package/dist/types.cjs.map
CHANGED
|
@@ -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
|
|
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"]}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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 {
|
|
4
|
-
import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction } from "@metamask/network-controller";
|
|
3
|
+
import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
5
4
|
import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
|
|
6
5
|
import type { MultichainAccountService, serviceName } from "./MultichainAccountService.cjs";
|
|
7
6
|
export type MultichainAccountServiceGetMultichainAccountGroupAction = {
|
|
@@ -44,15 +43,11 @@ export type MultichainAccountServiceGetIsAlignmentInProgressAction = {
|
|
|
44
43
|
type: `${typeof serviceName}:getIsAlignmentInProgress`;
|
|
45
44
|
handler: MultichainAccountService['getIsAlignmentInProgress'];
|
|
46
45
|
};
|
|
47
|
-
export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
|
|
48
|
-
type: `${typeof serviceName}:createMultichainAccountWallet`;
|
|
49
|
-
handler: MultichainAccountService['createMultichainAccountWallet'];
|
|
50
|
-
};
|
|
51
46
|
/**
|
|
52
47
|
* All actions that {@link MultichainAccountService} registers so that other
|
|
53
48
|
* modules can call them.
|
|
54
49
|
*/
|
|
55
|
-
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction
|
|
50
|
+
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction;
|
|
56
51
|
/**
|
|
57
52
|
* All events that {@link MultichainAccountService} publishes so that other modules
|
|
58
53
|
* can subscribe to them.
|
|
@@ -62,7 +57,7 @@ export type MultichainAccountServiceEvents = never;
|
|
|
62
57
|
* All actions registered by other modules that {@link MultichainAccountService}
|
|
63
58
|
* calls.
|
|
64
59
|
*/
|
|
65
|
-
export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction
|
|
60
|
+
export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction;
|
|
66
61
|
/**
|
|
67
62
|
* All events published by other modules that {@link MultichainAccountService}
|
|
68
63
|
* subscribes to.
|
package/dist/types.d.cts.map
CHANGED
|
@@ -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
|
|
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,s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
import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
|
|
2
2
|
import type { RestrictedMessenger } from "@metamask/base-controller";
|
|
3
|
-
import type {
|
|
4
|
-
import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction } from "@metamask/network-controller";
|
|
3
|
+
import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
5
4
|
import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
|
|
6
5
|
import type { MultichainAccountService, serviceName } from "./MultichainAccountService.mjs";
|
|
7
6
|
export type MultichainAccountServiceGetMultichainAccountGroupAction = {
|
|
@@ -44,15 +43,11 @@ export type MultichainAccountServiceGetIsAlignmentInProgressAction = {
|
|
|
44
43
|
type: `${typeof serviceName}:getIsAlignmentInProgress`;
|
|
45
44
|
handler: MultichainAccountService['getIsAlignmentInProgress'];
|
|
46
45
|
};
|
|
47
|
-
export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
|
|
48
|
-
type: `${typeof serviceName}:createMultichainAccountWallet`;
|
|
49
|
-
handler: MultichainAccountService['createMultichainAccountWallet'];
|
|
50
|
-
};
|
|
51
46
|
/**
|
|
52
47
|
* All actions that {@link MultichainAccountService} registers so that other
|
|
53
48
|
* modules can call them.
|
|
54
49
|
*/
|
|
55
|
-
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction
|
|
50
|
+
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceGetIsAlignmentInProgressAction;
|
|
56
51
|
/**
|
|
57
52
|
* All events that {@link MultichainAccountService} publishes so that other modules
|
|
58
53
|
* can subscribe to them.
|
|
@@ -62,7 +57,7 @@ export type MultichainAccountServiceEvents = never;
|
|
|
62
57
|
* All actions registered by other modules that {@link MultichainAccountService}
|
|
63
58
|
* calls.
|
|
64
59
|
*/
|
|
65
|
-
export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction
|
|
60
|
+
export type AllowedActions = AccountsControllerListMultichainAccountsAction | AccountsControllerGetAccountAction | AccountsControllerGetAccountByAddressAction | SnapControllerHandleSnapRequestAction | KeyringControllerWithKeyringAction | KeyringControllerGetStateAction;
|
|
66
61
|
/**
|
|
67
62
|
* All events published by other modules that {@link MultichainAccountService}
|
|
68
63
|
* subscribes to.
|
package/dist/types.d.mts.map
CHANGED
|
@@ -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
|
|
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AAc,EAChD,8BAA8B,GAAG,aAAa,EAC9C,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
|
package/dist/types.mjs.map
CHANGED
|
@@ -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
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/multichain-account-service",
|
|
3
|
-
"version": "0.6.0-preview-
|
|
3
|
+
"version": "0.6.0-preview-2a00636",
|
|
4
4
|
"description": "Service to manage multichain accounts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
"@metamask/keyring-internal-api": "^8.1.0",
|
|
54
54
|
"@metamask/keyring-snap-client": "^7.0.0",
|
|
55
55
|
"@metamask/keyring-utils": "^3.1.0",
|
|
56
|
-
"@metamask/scure-bip39": "^2.1.1",
|
|
57
56
|
"@metamask/snaps-sdk": "^9.0.0",
|
|
58
57
|
"@metamask/snaps-utils": "^11.0.0",
|
|
59
58
|
"@metamask/superstruct": "^3.1.0"
|
package/dist/utils.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertMnemonicToWordlistIndices = exports.convertEnglishWordlistIndicesToCodepoints = void 0;
|
|
4
|
-
const english_1 = require("@metamask/scure-bip39/dist/wordlists/english.js");
|
|
5
|
-
const convertEnglishWordlistIndicesToCodepoints = (wordlistIndices) => {
|
|
6
|
-
return Buffer.from(Array.from(new Uint16Array(wordlistIndices.buffer))
|
|
7
|
-
.map((i) => english_1.wordlist[i])
|
|
8
|
-
.join(' '));
|
|
9
|
-
};
|
|
10
|
-
exports.convertEnglishWordlistIndicesToCodepoints = convertEnglishWordlistIndicesToCodepoints;
|
|
11
|
-
const convertMnemonicToWordlistIndices = (mnemonic) => {
|
|
12
|
-
const indices = mnemonic
|
|
13
|
-
.toString()
|
|
14
|
-
.split(' ')
|
|
15
|
-
.map((word) => english_1.wordlist.indexOf(word));
|
|
16
|
-
return new Uint8Array(new Uint16Array(indices).buffer);
|
|
17
|
-
};
|
|
18
|
-
exports.convertMnemonicToWordlistIndices = convertMnemonicToWordlistIndices;
|
|
19
|
-
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,6EAAwE;AAEjE,MAAM,yCAAyC,GAAG,CACvD,eAA2B,EACnB,EAAE;IACV,OAAO,MAAM,CAAC,IAAI,CAChB,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAQ,CAAC,CAAC,CAAC,CAAC;SACvB,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,yCAAyC,6CAQpD;AAEK,MAAM,gCAAgC,GAAG,CAC9C,QAAgB,EACJ,EAAE;IACd,MAAM,OAAO,GAAG,QAAQ;SACrB,QAAQ,EAAE;SACV,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,OAAO,IAAI,UAAU,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC,CAAC;AARW,QAAA,gCAAgC,oCAQ3C","sourcesContent":["import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english';\n\nexport const convertEnglishWordlistIndicesToCodepoints = (\n wordlistIndices: Uint8Array,\n): Buffer => {\n return Buffer.from(\n Array.from(new Uint16Array(wordlistIndices.buffer))\n .map((i) => wordlist[i])\n .join(' '),\n );\n};\n\nexport const convertMnemonicToWordlistIndices = (\n mnemonic: string,\n): Uint8Array => {\n const indices = mnemonic\n .toString()\n .split(' ')\n .map((word) => wordlist.indexOf(word));\n return new Uint8Array(new Uint16Array(indices).buffer);\n};\n"]}
|
package/dist/utils.d.cts
DELETED
package/dist/utils.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yCAAyC,oBACnC,UAAU,KAC1B,MAMF,CAAC;AAEF,eAAO,MAAM,gCAAgC,aACjC,MAAM,KACf,UAMF,CAAC"}
|
package/dist/utils.d.mts
DELETED
package/dist/utils.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yCAAyC,oBACnC,UAAU,KAC1B,MAMF,CAAC;AAEF,eAAO,MAAM,gCAAgC,aACjC,MAAM,KACf,UAMF,CAAC"}
|
package/dist/utils.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { wordlist } from "@metamask/scure-bip39/dist/wordlists/english.js";
|
|
2
|
-
export const convertEnglishWordlistIndicesToCodepoints = (wordlistIndices) => {
|
|
3
|
-
return Buffer.from(Array.from(new Uint16Array(wordlistIndices.buffer))
|
|
4
|
-
.map((i) => wordlist[i])
|
|
5
|
-
.join(' '));
|
|
6
|
-
};
|
|
7
|
-
export const convertMnemonicToWordlistIndices = (mnemonic) => {
|
|
8
|
-
const indices = mnemonic
|
|
9
|
-
.toString()
|
|
10
|
-
.split(' ')
|
|
11
|
-
.map((word) => wordlist.indexOf(word));
|
|
12
|
-
return new Uint8Array(new Uint16Array(indices).buffer);
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=utils.mjs.map
|
package/dist/utils.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wDAAqD;AAExE,MAAM,CAAC,MAAM,yCAAyC,GAAG,CACvD,eAA2B,EACnB,EAAE;IACV,OAAO,MAAM,CAAC,IAAI,CAChB,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;SACvB,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,QAAgB,EACJ,EAAE;IACd,MAAM,OAAO,GAAG,QAAQ;SACrB,QAAQ,EAAE;SACV,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,OAAO,IAAI,UAAU,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english';\n\nexport const convertEnglishWordlistIndicesToCodepoints = (\n wordlistIndices: Uint8Array,\n): Buffer => {\n return Buffer.from(\n Array.from(new Uint16Array(wordlistIndices.buffer))\n .map((i) => wordlist[i])\n .join(' '),\n );\n};\n\nexport const convertMnemonicToWordlistIndices = (\n mnemonic: string,\n): Uint8Array => {\n const indices = mnemonic\n .toString()\n .split(' ')\n .map((word) => wordlist.indexOf(word));\n return new Uint8Array(new Uint16Array(indices).buffer);\n};\n"]}
|