@metamask-previews/multichain-account-service 0.6.0-preview-236bab4a → 0.6.0-preview-3734aa94
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 +11 -0
- 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 +29 -0
- package/dist/MultichainAccountService.cjs.map +1 -1
- package/dist/MultichainAccountService.d.cts +20 -2
- package/dist/MultichainAccountService.d.cts.map +1 -1
- package/dist/MultichainAccountService.d.mts +20 -2
- package/dist/MultichainAccountService.d.mts.map +1 -1
- package/dist/MultichainAccountService.mjs +29 -0
- package/dist/MultichainAccountService.mjs.map +1 -1
- package/dist/MultichainAccountWallet.cjs +66 -0
- package/dist/MultichainAccountWallet.cjs.map +1 -1
- package/dist/MultichainAccountWallet.d.cts +19 -2
- package/dist/MultichainAccountWallet.d.cts.map +1 -1
- package/dist/MultichainAccountWallet.d.mts +19 -2
- package/dist/MultichainAccountWallet.d.mts.map +1 -1
- package/dist/MultichainAccountWallet.mjs +66 -0
- package/dist/MultichainAccountWallet.mjs.map +1 -1
- package/dist/providers/AccountProviderWrapper.cjs +3 -0
- package/dist/providers/AccountProviderWrapper.cjs.map +1 -1
- package/dist/providers/AccountProviderWrapper.d.cts +1 -0
- package/dist/providers/AccountProviderWrapper.d.cts.map +1 -1
- package/dist/providers/AccountProviderWrapper.d.mts +1 -0
- package/dist/providers/AccountProviderWrapper.d.mts.map +1 -1
- package/dist/providers/AccountProviderWrapper.mjs +3 -0
- package/dist/providers/AccountProviderWrapper.mjs.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.cjs.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.d.cts +5 -1
- package/dist/providers/BaseBip44AccountProvider.d.cts.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.d.mts +5 -1
- package/dist/providers/BaseBip44AccountProvider.d.mts.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.mjs.map +1 -1
- package/dist/providers/EvmAccountProvider.cjs +50 -2
- package/dist/providers/EvmAccountProvider.cjs.map +1 -1
- package/dist/providers/EvmAccountProvider.d.cts +77 -2
- package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
- package/dist/providers/EvmAccountProvider.d.mts +77 -2
- package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
- package/dist/providers/EvmAccountProvider.mjs +51 -3
- package/dist/providers/EvmAccountProvider.mjs.map +1 -1
- package/dist/providers/SolAccountProvider.cjs +43 -4
- package/dist/providers/SolAccountProvider.cjs.map +1 -1
- package/dist/providers/SolAccountProvider.d.cts +3 -1
- package/dist/providers/SolAccountProvider.d.cts.map +1 -1
- package/dist/providers/SolAccountProvider.d.mts +3 -1
- package/dist/providers/SolAccountProvider.d.mts.map +1 -1
- package/dist/providers/SolAccountProvider.mjs +41 -2
- package/dist/providers/SolAccountProvider.mjs.map +1 -1
- package/dist/tests/accounts.cjs +12 -6
- package/dist/tests/accounts.cjs.map +1 -1
- package/dist/tests/accounts.d.cts +5 -1
- package/dist/tests/accounts.d.cts.map +1 -1
- package/dist/tests/accounts.d.mts +5 -1
- package/dist/tests/accounts.d.mts.map +1 -1
- package/dist/tests/accounts.mjs +7 -1
- package/dist/tests/accounts.mjs.map +1 -1
- package/dist/tests/messenger.cjs +4 -0
- 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 +4 -0
- package/dist/tests/messenger.mjs.map +1 -1
- package/dist/tests/providers.cjs +1 -0
- package/dist/tests/providers.cjs.map +1 -1
- package/dist/tests/providers.d.cts +1 -0
- package/dist/tests/providers.d.cts.map +1 -1
- package/dist/tests/providers.d.mts +1 -0
- package/dist/tests/providers.d.mts.map +1 -1
- package/dist/tests/providers.mjs +1 -0
- package/dist/tests/providers.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +17 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +17 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils.cjs +19 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +3 -0
- package/dist/utils.d.cts.map +1 -0
- package/dist/utils.d.mts +3 -0
- package/dist/utils.d.mts.map +1 -0
- package/dist/utils.mjs +14 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +3 -2
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
+
};
|
|
13
|
+
var _SolAccountProvider_instances, _SolAccountProvider_client, _SolAccountProvider_getKeyringClientFromSnapId;
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.SolAccountProvider = void 0;
|
|
4
16
|
const keyring_api_1 = require("@metamask/keyring-api");
|
|
17
|
+
const keyring_api_2 = require("@metamask/keyring-api");
|
|
5
18
|
const keyring_controller_1 = require("@metamask/keyring-controller");
|
|
19
|
+
const keyring_snap_client_1 = require("@metamask/keyring-snap-client");
|
|
20
|
+
const snaps_utils_1 = require("@metamask/snaps-utils");
|
|
6
21
|
const BaseBip44AccountProvider_1 = require("./BaseBip44AccountProvider.cjs");
|
|
7
22
|
const SnapAccountProvider_1 = require("./SnapAccountProvider.cjs");
|
|
8
23
|
class SolAccountProvider extends SnapAccountProvider_1.SnapAccountProvider {
|
|
9
24
|
constructor(messenger) {
|
|
10
25
|
super(SolAccountProvider.SOLANA_SNAP_ID, messenger);
|
|
26
|
+
_SolAccountProvider_instances.add(this);
|
|
27
|
+
_SolAccountProvider_client.set(this, void 0);
|
|
28
|
+
__classPrivateFieldSet(this, _SolAccountProvider_client, __classPrivateFieldGet(this, _SolAccountProvider_instances, "m", _SolAccountProvider_getKeyringClientFromSnapId).call(this, SolAccountProvider.SOLANA_SNAP_ID), "f");
|
|
29
|
+
}
|
|
30
|
+
getName() {
|
|
31
|
+
return 'Solana';
|
|
11
32
|
}
|
|
12
33
|
isAccountCompatible(account) {
|
|
13
|
-
return (account.type ===
|
|
34
|
+
return (account.type === keyring_api_2.SolAccountType.DataAccount &&
|
|
14
35
|
account.metadata.keyring.type === keyring_controller_1.KeyringTypes.snap);
|
|
15
36
|
}
|
|
16
37
|
async createAccounts({ entropySource, groupIndex, }) {
|
|
@@ -27,7 +48,7 @@ class SolAccountProvider extends SnapAccountProvider_1.SnapAccountProvider {
|
|
|
27
48
|
// so we "inject" them (the `AccountsController` does a similar thing
|
|
28
49
|
// for the moment).
|
|
29
50
|
account.options.entropy = {
|
|
30
|
-
type:
|
|
51
|
+
type: keyring_api_2.KeyringAccountEntropyTypeOption.Mnemonic,
|
|
31
52
|
id: entropySource,
|
|
32
53
|
groupIndex,
|
|
33
54
|
derivationPath,
|
|
@@ -36,10 +57,28 @@ class SolAccountProvider extends SnapAccountProvider_1.SnapAccountProvider {
|
|
|
36
57
|
(0, BaseBip44AccountProvider_1.assertAreBip44Accounts)(accounts);
|
|
37
58
|
return accounts;
|
|
38
59
|
}
|
|
39
|
-
async discoverAndCreateAccounts(
|
|
40
|
-
|
|
60
|
+
async discoverAndCreateAccounts({ entropySource, groupIndex, }) {
|
|
61
|
+
const discoveredAccounts = await __classPrivateFieldGet(this, _SolAccountProvider_client, "f").discoverAccounts([keyring_api_1.SolScope.Mainnet], entropySource, groupIndex);
|
|
62
|
+
// Solana Snap always returns one discovered account.
|
|
63
|
+
if (discoveredAccounts.length === 1) {
|
|
64
|
+
return this.createAccounts({ entropySource, groupIndex });
|
|
65
|
+
}
|
|
66
|
+
return Promise.resolve([]);
|
|
41
67
|
}
|
|
42
68
|
}
|
|
43
69
|
exports.SolAccountProvider = SolAccountProvider;
|
|
70
|
+
_SolAccountProvider_client = new WeakMap(), _SolAccountProvider_instances = new WeakSet(), _SolAccountProvider_getKeyringClientFromSnapId = function _SolAccountProvider_getKeyringClientFromSnapId(snapId) {
|
|
71
|
+
return new keyring_snap_client_1.KeyringClient({
|
|
72
|
+
send: async (request) => {
|
|
73
|
+
const response = await this.messenger.call('SnapController:handleRequest', {
|
|
74
|
+
snapId: snapId,
|
|
75
|
+
origin: 'metamask',
|
|
76
|
+
handler: snaps_utils_1.HandlerType.OnKeyringRequest,
|
|
77
|
+
request,
|
|
78
|
+
});
|
|
79
|
+
return response;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
};
|
|
44
83
|
SolAccountProvider.SOLANA_SNAP_ID = 'npm:@metamask/solana-wallet-snap';
|
|
45
84
|
//# sourceMappingURL=SolAccountProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"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AA,iDAAsB,EAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,EAC9B,aAAa,EACb,UAAU,GAIX;QACC,MAAM,kBAAkB,GAAG,MAAM,uBAAA,IAAI,kCAAQ,CAAC,gBAAgB,CAC5D,CAAC,sBAAQ,CAAC,OAAO,CAAC,EAClB,aAAa,EACb,UAAU,CACX,CAAC;QAEF,qDAAqD;QACrD,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;YACnC,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;SAC3D;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;;AA7FH,gDA8FC;oMA9E6B,MAAc;IACxC,OAAO,IAAI,mCAAa,CAAC;QACvB,IAAI,EAAE,KAAK,EAAE,OAAuB,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CACxC,8BAA8B,EAC9B;gBACE,MAAM,EAAE,MAAgB;gBACxB,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,yBAAW,CAAC,gBAAgB;gBACrC,OAAO;aACR,CACF,CAAC;YACF,OAAO,QAAgB,CAAC;QAC1B,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AA9BM,iCAAc,GAAG,kCAA4C,AAA/C,CAAgD","sourcesContent":["import { type Bip44Account } from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport { SolScope } from '@metamask/keyring-api';\nimport {\n KeyringAccountEntropyTypeOption,\n SolAccountType,\n} from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { KeyringClient } from '@metamask/keyring-snap-client';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport { HandlerType } from '@metamask/snaps-utils';\nimport type { Json, JsonRpcRequest } from '@metamask/utils';\nimport type { MultichainAccountServiceMessenger } from 'src/types';\n\nimport { assertAreBip44Accounts } from './BaseBip44AccountProvider';\nimport { SnapAccountProvider } from './SnapAccountProvider';\n\nexport class SolAccountProvider extends SnapAccountProvider {\n static SOLANA_SNAP_ID = 'npm:@metamask/solana-wallet-snap' as SnapId;\n\n readonly #client: KeyringClient;\n\n constructor(messenger: MultichainAccountServiceMessenger) {\n super(SolAccountProvider.SOLANA_SNAP_ID, messenger);\n this.#client = this.#getKeyringClientFromSnapId(\n SolAccountProvider.SOLANA_SNAP_ID,\n );\n }\n\n getName(): string {\n return 'Solana';\n }\n\n #getKeyringClientFromSnapId(snapId: string): KeyringClient {\n return new KeyringClient({\n send: async (request: JsonRpcRequest) => {\n const response = await this.messenger.call(\n 'SnapController:handleRequest',\n {\n snapId: snapId as SnapId,\n origin: 'metamask',\n handler: HandlerType.OnKeyringRequest,\n request,\n },\n );\n return response as Json;\n },\n });\n }\n\n isAccountCompatible(account: Bip44Account<InternalAccount>): boolean {\n return (\n account.type === SolAccountType.DataAccount &&\n account.metadata.keyring.type === (KeyringTypes.snap as string)\n );\n }\n\n async createAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]> {\n const createAccount = await this.getRestrictedSnapAccountCreator();\n\n // Create account without any confirmation nor selecting it.\n // TODO: Use the new keyring API `createAccounts` method with the \"bip-44:derive-index\"\n // type once ready.\n const derivationPath = `m/44'/501'/${groupIndex}'/0'`;\n const account = await createAccount({\n entropySource,\n derivationPath,\n });\n\n // Solana Snap does not use BIP-44 typed options for the moment\n // so we \"inject\" them (the `AccountsController` does a similar thing\n // for the moment).\n account.options.entropy = {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: entropySource,\n groupIndex,\n derivationPath,\n };\n\n const accounts = [account];\n assertAreBip44Accounts(accounts);\n\n return accounts;\n }\n\n async discoverAndCreateAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]> {\n const discoveredAccounts = await this.#client.discoverAccounts(\n [SolScope.Mainnet],\n entropySource,\n groupIndex,\n );\n\n // Solana Snap always returns one discovered account.\n if (discoveredAccounts.length === 1) {\n return this.createAccounts({ entropySource, groupIndex });\n }\n\n return Promise.resolve([]);\n }\n}\n"]}
|
|
@@ -5,14 +5,16 @@ import type { SnapId } from "@metamask/snaps-sdk";
|
|
|
5
5
|
import type { MultichainAccountServiceMessenger } from "src/types";
|
|
6
6
|
import { SnapAccountProvider } from "./SnapAccountProvider.cjs";
|
|
7
7
|
export declare class SolAccountProvider extends SnapAccountProvider {
|
|
8
|
+
#private;
|
|
8
9
|
static SOLANA_SNAP_ID: SnapId;
|
|
9
10
|
constructor(messenger: MultichainAccountServiceMessenger);
|
|
11
|
+
getName(): string;
|
|
10
12
|
isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
11
13
|
createAccounts({ entropySource, groupIndex, }: {
|
|
12
14
|
entropySource: EntropySourceId;
|
|
13
15
|
groupIndex: number;
|
|
14
16
|
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
15
|
-
discoverAndCreateAccounts(
|
|
17
|
+
discoverAndCreateAccounts({ entropySource, groupIndex, }: {
|
|
16
18
|
entropySource: EntropySourceId;
|
|
17
19
|
groupIndex: number;
|
|
18
20
|
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8B;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"SolAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8B;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAO7E,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAGlD,OAAO,KAAK,EAAE,iCAAiC,EAAE,kBAAkB;AAGnE,OAAO,EAAE,mBAAmB,EAAE,kCAA8B;AAE5D,qBAAa,kBAAmB,SAAQ,mBAAmB;;IACzD,MAAM,CAAC,cAAc,SAAgD;gBAIzD,SAAS,EAAE,iCAAiC;IAOxD,OAAO,IAAI,MAAM;IAqBjB,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO;IAO9D,cAAc,CAAC,EACnB,aAAa,EACb,UAAU,GACX,EAAE;QACD,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;IA4BrC,yBAAyB,CAAC,EAC9B,aAAa,EACb,UAAU,GACX,EAAE;QACD,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;CAc5C"}
|
|
@@ -5,14 +5,16 @@ import type { SnapId } from "@metamask/snaps-sdk";
|
|
|
5
5
|
import type { MultichainAccountServiceMessenger } from "src/types";
|
|
6
6
|
import { SnapAccountProvider } from "./SnapAccountProvider.mjs";
|
|
7
7
|
export declare class SolAccountProvider extends SnapAccountProvider {
|
|
8
|
+
#private;
|
|
8
9
|
static SOLANA_SNAP_ID: SnapId;
|
|
9
10
|
constructor(messenger: MultichainAccountServiceMessenger);
|
|
11
|
+
getName(): string;
|
|
10
12
|
isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
11
13
|
createAccounts({ entropySource, groupIndex, }: {
|
|
12
14
|
entropySource: EntropySourceId;
|
|
13
15
|
groupIndex: number;
|
|
14
16
|
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
15
|
-
discoverAndCreateAccounts(
|
|
17
|
+
discoverAndCreateAccounts({ entropySource, groupIndex, }: {
|
|
16
18
|
entropySource: EntropySourceId;
|
|
17
19
|
groupIndex: number;
|
|
18
20
|
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8B;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"SolAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8B;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAO7E,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAGlD,OAAO,KAAK,EAAE,iCAAiC,EAAE,kBAAkB;AAGnE,OAAO,EAAE,mBAAmB,EAAE,kCAA8B;AAE5D,qBAAa,kBAAmB,SAAQ,mBAAmB;;IACzD,MAAM,CAAC,cAAc,SAAgD;gBAIzD,SAAS,EAAE,iCAAiC;IAOxD,OAAO,IAAI,MAAM;IAqBjB,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,OAAO;IAO9D,cAAc,CAAC,EACnB,aAAa,EACb,UAAU,GACX,EAAE;QACD,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;IA4BrC,yBAAyB,CAAC,EAC9B,aAAa,EACb,UAAU,GACX,EAAE;QACD,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;CAc5C"}
|
|
@@ -1,10 +1,31 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _SolAccountProvider_instances, _SolAccountProvider_client, _SolAccountProvider_getKeyringClientFromSnapId;
|
|
13
|
+
import { SolScope } from "@metamask/keyring-api";
|
|
1
14
|
import { KeyringAccountEntropyTypeOption, SolAccountType } from "@metamask/keyring-api";
|
|
2
15
|
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
16
|
+
import { KeyringClient } from "@metamask/keyring-snap-client";
|
|
17
|
+
import { HandlerType } from "@metamask/snaps-utils";
|
|
3
18
|
import { assertAreBip44Accounts } from "./BaseBip44AccountProvider.mjs";
|
|
4
19
|
import { SnapAccountProvider } from "./SnapAccountProvider.mjs";
|
|
5
20
|
export class SolAccountProvider extends SnapAccountProvider {
|
|
6
21
|
constructor(messenger) {
|
|
7
22
|
super(SolAccountProvider.SOLANA_SNAP_ID, messenger);
|
|
23
|
+
_SolAccountProvider_instances.add(this);
|
|
24
|
+
_SolAccountProvider_client.set(this, void 0);
|
|
25
|
+
__classPrivateFieldSet(this, _SolAccountProvider_client, __classPrivateFieldGet(this, _SolAccountProvider_instances, "m", _SolAccountProvider_getKeyringClientFromSnapId).call(this, SolAccountProvider.SOLANA_SNAP_ID), "f");
|
|
26
|
+
}
|
|
27
|
+
getName() {
|
|
28
|
+
return 'Solana';
|
|
8
29
|
}
|
|
9
30
|
isAccountCompatible(account) {
|
|
10
31
|
return (account.type === SolAccountType.DataAccount &&
|
|
@@ -33,9 +54,27 @@ export class SolAccountProvider extends SnapAccountProvider {
|
|
|
33
54
|
assertAreBip44Accounts(accounts);
|
|
34
55
|
return accounts;
|
|
35
56
|
}
|
|
36
|
-
async discoverAndCreateAccounts(
|
|
37
|
-
|
|
57
|
+
async discoverAndCreateAccounts({ entropySource, groupIndex, }) {
|
|
58
|
+
const discoveredAccounts = await __classPrivateFieldGet(this, _SolAccountProvider_client, "f").discoverAccounts([SolScope.Mainnet], entropySource, groupIndex);
|
|
59
|
+
// Solana Snap always returns one discovered account.
|
|
60
|
+
if (discoveredAccounts.length === 1) {
|
|
61
|
+
return this.createAccounts({ entropySource, groupIndex });
|
|
62
|
+
}
|
|
63
|
+
return Promise.resolve([]);
|
|
38
64
|
}
|
|
39
65
|
}
|
|
66
|
+
_SolAccountProvider_client = new WeakMap(), _SolAccountProvider_instances = new WeakSet(), _SolAccountProvider_getKeyringClientFromSnapId = function _SolAccountProvider_getKeyringClientFromSnapId(snapId) {
|
|
67
|
+
return new KeyringClient({
|
|
68
|
+
send: async (request) => {
|
|
69
|
+
const response = await this.messenger.call('SnapController:handleRequest', {
|
|
70
|
+
snapId: snapId,
|
|
71
|
+
origin: 'metamask',
|
|
72
|
+
handler: HandlerType.OnKeyringRequest,
|
|
73
|
+
request,
|
|
74
|
+
});
|
|
75
|
+
return response;
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
};
|
|
40
79
|
SolAccountProvider.SOLANA_SNAP_ID = 'npm:@metamask/solana-wallet-snap';
|
|
41
80
|
//# sourceMappingURL=SolAccountProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolAccountProvider.mjs","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,+BAA+B,EAC/B,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;
|
|
1
|
+
{"version":3,"file":"SolAccountProvider.mjs","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AACjD,OAAO,EACL,+BAA+B,EAC/B,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,aAAa,EAAE,sCAAsC;AAE9D,OAAO,EAAE,WAAW,EAAE,8BAA8B;AAIpD,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AACpE,OAAO,EAAE,mBAAmB,EAAE,kCAA8B;AAE5D,MAAM,OAAO,kBAAmB,SAAQ,mBAAmB;IAKzD,YAAY,SAA4C;QACtD,KAAK,CAAC,kBAAkB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;;QAH7C,6CAAuB;QAI9B,uBAAA,IAAI,8BAAW,uBAAA,IAAI,qFAA4B,MAAhC,IAAI,EACjB,kBAAkB,CAAC,cAAc,CAClC,MAAA,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,QAAQ,CAAC;IAClB,CAAC;IAmBD,mBAAmB,CAAC,OAAsC;QACxD,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,WAAW;YA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AAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CACxC,8BAA8B,EAC9B;gBACE,MAAM,EAAE,MAAgB;gBACxB,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,WAAW,CAAC,gBAAgB;gBACrC,OAAO;aACR,CACF,CAAC;YACF,OAAO,QAAgB,CAAC;QAC1B,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AA9BM,iCAAc,GAAG,kCAA4C,AAA/C,CAAgD","sourcesContent":["import { type Bip44Account } from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport { SolScope } from '@metamask/keyring-api';\nimport {\n KeyringAccountEntropyTypeOption,\n SolAccountType,\n} from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { KeyringClient } from '@metamask/keyring-snap-client';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport { HandlerType } from '@metamask/snaps-utils';\nimport type { Json, JsonRpcRequest } from '@metamask/utils';\nimport type { MultichainAccountServiceMessenger } from 'src/types';\n\nimport { assertAreBip44Accounts } from './BaseBip44AccountProvider';\nimport { SnapAccountProvider } from './SnapAccountProvider';\n\nexport class SolAccountProvider extends SnapAccountProvider {\n static SOLANA_SNAP_ID = 'npm:@metamask/solana-wallet-snap' as SnapId;\n\n readonly #client: KeyringClient;\n\n constructor(messenger: MultichainAccountServiceMessenger) {\n super(SolAccountProvider.SOLANA_SNAP_ID, messenger);\n this.#client = this.#getKeyringClientFromSnapId(\n SolAccountProvider.SOLANA_SNAP_ID,\n );\n }\n\n getName(): string {\n return 'Solana';\n }\n\n #getKeyringClientFromSnapId(snapId: string): KeyringClient {\n return new KeyringClient({\n send: async (request: JsonRpcRequest) => {\n const response = await this.messenger.call(\n 'SnapController:handleRequest',\n {\n snapId: snapId as SnapId,\n origin: 'metamask',\n handler: HandlerType.OnKeyringRequest,\n request,\n },\n );\n return response as Json;\n },\n });\n }\n\n isAccountCompatible(account: Bip44Account<InternalAccount>): boolean {\n return (\n account.type === SolAccountType.DataAccount &&\n account.metadata.keyring.type === (KeyringTypes.snap as string)\n );\n }\n\n async createAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]> {\n const createAccount = await this.getRestrictedSnapAccountCreator();\n\n // Create account without any confirmation nor selecting it.\n // TODO: Use the new keyring API `createAccounts` method with the \"bip-44:derive-index\"\n // type once ready.\n const derivationPath = `m/44'/501'/${groupIndex}'/0'`;\n const account = await createAccount({\n entropySource,\n derivationPath,\n });\n\n // Solana Snap does not use BIP-44 typed options for the moment\n // so we \"inject\" them (the `AccountsController` does a similar thing\n // for the moment).\n account.options.entropy = {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: entropySource,\n groupIndex,\n derivationPath,\n };\n\n const accounts = [account];\n assertAreBip44Accounts(accounts);\n\n return accounts;\n }\n\n async discoverAndCreateAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]> {\n const discoveredAccounts = await this.#client.discoverAccounts(\n [SolScope.Mainnet],\n entropySource,\n groupIndex,\n );\n\n // Solana Snap always returns one discovered account.\n if (discoveredAccounts.length === 1) {\n return this.createAccounts({ entropySource, groupIndex });\n }\n\n return Promise.resolve([]);\n }\n}\n"]}
|
package/dist/tests/accounts.cjs
CHANGED
|
@@ -12,12 +12,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
};
|
|
13
13
|
var _MockAccountBuilder_account;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.mockAsInternalAccount = exports.MOCK_WALLET_1_BTC_P2TR_ACCOUNT = exports.MOCK_WALLET_1_BTC_P2WPKH_ACCOUNT = exports.MOCK_WALLET_1_SOL_ACCOUNT = exports.MOCK_WALLET_1_EVM_ACCOUNT = exports.MOCK_WALLET_1_ENTROPY_SOURCE = exports.MockAccountBuilder = exports.MOCK_HARDWARE_ACCOUNT_1 = exports.MOCK_SNAP_ACCOUNT_4 = exports.MOCK_SNAP_ACCOUNT_3 = exports.MOCK_SNAP_ACCOUNT_2 = exports.MOCK_SNAP_ACCOUNT_1 = exports.MOCK_BTC_P2TR_ACCOUNT_1 = exports.MOCK_BTC_P2WPKH_ACCOUNT_1 = exports.MOCK_SOL_ACCOUNT_1 = exports.MOCK_HD_ACCOUNT_2 = exports.MOCK_HD_ACCOUNT_1 = exports.MOCK_HD_KEYRING_2 = exports.MOCK_HD_KEYRING_1 = exports.MOCK_ENTROPY_SOURCE_2 = exports.MOCK_ENTROPY_SOURCE_1 = exports.MOCK_SNAP_2 = exports.MOCK_SNAP_1 = void 0;
|
|
15
|
+
exports.mockAsInternalAccount = exports.MOCK_WALLET_1_BTC_P2TR_ACCOUNT = exports.MOCK_WALLET_1_BTC_P2WPKH_ACCOUNT = exports.MOCK_WALLET_1_SOL_ACCOUNT = exports.MOCK_WALLET_1_EVM_ACCOUNT = exports.MOCK_WALLET_1_ENTROPY_SOURCE = exports.MockAccountBuilder = exports.MOCK_HARDWARE_ACCOUNT_1 = exports.MOCK_SNAP_ACCOUNT_4 = exports.MOCK_SNAP_ACCOUNT_3 = exports.MOCK_SNAP_ACCOUNT_2 = exports.MOCK_SNAP_ACCOUNT_1 = exports.MOCK_BTC_P2TR_ACCOUNT_1 = exports.MOCK_BTC_P2WPKH_ACCOUNT_1 = exports.MOCK_SOL_DISCOVERED_ACCOUNT_1 = exports.MOCK_SOL_ACCOUNT_1 = exports.MOCK_HD_ACCOUNT_2 = exports.MOCK_HD_ACCOUNT_1 = exports.MOCK_HD_KEYRING_2 = exports.MOCK_HD_KEYRING_1 = exports.MOCK_ENTROPY_SOURCE_2 = exports.MOCK_ENTROPY_SOURCE_1 = exports.MOCK_SNAP_2 = exports.MOCK_SNAP_1 = exports.ETH_EOA_METHODS = exports.MOCK_MNEMONIC = void 0;
|
|
16
16
|
const account_api_1 = require("@metamask/account-api");
|
|
17
17
|
const keyring_api_1 = require("@metamask/keyring-api");
|
|
18
18
|
const keyring_controller_1 = require("@metamask/keyring-controller");
|
|
19
19
|
const uuid_1 = require("uuid");
|
|
20
|
-
|
|
20
|
+
exports.MOCK_MNEMONIC = 'abandon ability able about above absent absorb abstract absurd abuse access accident';
|
|
21
|
+
exports.ETH_EOA_METHODS = [
|
|
21
22
|
keyring_api_1.EthMethod.PersonalSign,
|
|
22
23
|
keyring_api_1.EthMethod.Sign,
|
|
23
24
|
keyring_api_1.EthMethod.SignTransaction,
|
|
@@ -65,7 +66,7 @@ exports.MOCK_HD_ACCOUNT_1 = {
|
|
|
65
66
|
derivationPath: '',
|
|
66
67
|
},
|
|
67
68
|
},
|
|
68
|
-
methods: [...ETH_EOA_METHODS],
|
|
69
|
+
methods: [...exports.ETH_EOA_METHODS],
|
|
69
70
|
type: keyring_api_1.EthAccountType.Eoa,
|
|
70
71
|
scopes: [keyring_api_1.EthScope.Eoa],
|
|
71
72
|
metadata: {
|
|
@@ -87,7 +88,7 @@ exports.MOCK_HD_ACCOUNT_2 = {
|
|
|
87
88
|
derivationPath: '',
|
|
88
89
|
},
|
|
89
90
|
},
|
|
90
|
-
methods: [...ETH_EOA_METHODS],
|
|
91
|
+
methods: [...exports.ETH_EOA_METHODS],
|
|
91
92
|
type: keyring_api_1.EthAccountType.Eoa,
|
|
92
93
|
scopes: [keyring_api_1.EthScope.Eoa],
|
|
93
94
|
metadata: {
|
|
@@ -121,6 +122,11 @@ exports.MOCK_SOL_ACCOUNT_1 = {
|
|
|
121
122
|
lastSelected: 0,
|
|
122
123
|
},
|
|
123
124
|
};
|
|
125
|
+
exports.MOCK_SOL_DISCOVERED_ACCOUNT_1 = {
|
|
126
|
+
type: 'bip44',
|
|
127
|
+
scopes: [keyring_api_1.SolScope.Mainnet],
|
|
128
|
+
derivationPath: `m/44'/501'/0'/0'`,
|
|
129
|
+
};
|
|
124
130
|
exports.MOCK_BTC_P2WPKH_ACCOUNT_1 = {
|
|
125
131
|
id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',
|
|
126
132
|
type: keyring_api_1.BtcAccountType.P2wpkh,
|
|
@@ -182,7 +188,7 @@ exports.MOCK_SNAP_ACCOUNT_2 = {
|
|
|
182
188
|
id: 'mock-snap-id-2',
|
|
183
189
|
address: '0x789',
|
|
184
190
|
options: {},
|
|
185
|
-
methods: [...ETH_EOA_METHODS],
|
|
191
|
+
methods: [...exports.ETH_EOA_METHODS],
|
|
186
192
|
type: keyring_api_1.EthAccountType.Eoa,
|
|
187
193
|
scopes: [keyring_api_1.EthScope.Eoa],
|
|
188
194
|
metadata: {
|
|
@@ -199,7 +205,7 @@ exports.MOCK_HARDWARE_ACCOUNT_1 = {
|
|
|
199
205
|
id: 'mock-hardware-id-1',
|
|
200
206
|
address: '0xABC',
|
|
201
207
|
options: {},
|
|
202
|
-
methods: [...ETH_EOA_METHODS],
|
|
208
|
+
methods: [...exports.ETH_EOA_METHODS],
|
|
203
209
|
type: keyring_api_1.EthAccountType.Eoa,
|
|
204
210
|
scopes: [keyring_api_1.EthScope.Eoa],
|
|
205
211
|
metadata: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.cjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,uDAAuD;AAEvD,uDAW+B;AAC/B,qEAA4D;AAE5D,+BAAkC;AAElC,MAAM,eAAe,GAAG;IACtB,uBAAS,CAAC,YAAY;IACtB,uBAAS,CAAC,IAAI;IACd,uBAAS,CAAC,eAAe;IACzB,uBAAS,CAAC,eAAe;IACzB,uBAAS,CAAC,eAAe;IACzB,uBAAS,CAAC,eAAe;CACjB,CAAC;AAEX,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAS,CAAC,CAAC;AAEhC,QAAA,WAAW,GAAG;IACzB,E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AyB,GAAG,kBAAkB,CAAC,IAAI,CAC9D,0BAAkB,CACnB;KACE,iBAAiB,CAAC,oCAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AACI,QAAA,gCAAgC,GAAG,kBAAkB,CAAC,IAAI,CACrE,iCAAyB,CAC1B;KACE,iBAAiB,CAAC,oCAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AACI,QAAA,8BAA8B,GAAG,kBAAkB,CAAC,IAAI,CACnE,+BAAuB,CACxB;KACE,iBAAiB,CAAC,oCAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AAET,SAAgB,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;AAbD,sDAaC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\nimport type { Bip44Account } from '@metamask/account-api';\nimport { isBip44Account } from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport {\n BtcAccountType,\n BtcMethod,\n BtcScope,\n EthAccountType,\n EthMethod,\n EthScope,\n KeyringAccountEntropyTypeOption,\n SolAccountType,\n SolMethod,\n SolScope,\n} from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { v4 as uuid } from 'uuid';\n\nconst ETH_EOA_METHODS = [\n EthMethod.PersonalSign,\n EthMethod.Sign,\n EthMethod.SignTransaction,\n EthMethod.SignTypedDataV1,\n EthMethod.SignTypedDataV3,\n EthMethod.SignTypedDataV4,\n] as const;\n\nconst SOL_METHODS = Object.values(SolMethod);\n\nexport const MOCK_SNAP_1 = {\n id: 'local:mock-snap-id-1',\n name: 'Mock Snap 1',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 1',\n },\n};\n\nexport const MOCK_SNAP_2 = {\n id: 'local:mock-snap-id-2',\n name: 'Mock Snap 2',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 2',\n },\n};\n\nexport const MOCK_ENTROPY_SOURCE_1 = 'mock-keyring-id-1';\nexport const MOCK_ENTROPY_SOURCE_2 = 'mock-keyring-id-2';\n\nexport const MOCK_HD_KEYRING_1 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_1, name: 'HD Keyring 1' },\n accounts: ['0x123'],\n};\n\nexport const MOCK_HD_KEYRING_2 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_2, name: 'HD Keyring 2' },\n accounts: ['0x456'],\n};\n\nexport const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-id-1',\n address: '0x123',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_1.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 1',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount> = {\n id: 'mock-id-2',\n address: '0x456',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 2',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-snap-id-1',\n address: 'aabbccdd',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: SOL_METHODS,\n type: SolAccountType.DataAccount,\n scopes: [SolScope.Mainnet, SolScope.Testnet, SolScope.Devnet],\n metadata: {\n name: 'Solana Account 1',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_1,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',\n type: BtcAccountType.P2wpkh,\n methods: [BtcMethod.SendBitcoin],\n address: 'bc1qx8ls07cy8j8nrluy2u0xwn7gh8fxg0rg4s8zze',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Mainnet],\n metadata: {\n name: 'Bitcoin Native Segwit Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'a20c2e1a-6ff6-40ba-b8e0-ccdb6f9933bb',\n type: BtcAccountType.P2tr,\n methods: [BtcMethod.SendBitcoin],\n address: 'tb1p5cyxnuxmeuwuvkwfem96lxx9wex9kkf4mt9ll6q60jfsnrzqg4sszkqjnh',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Testnet],\n metadata: {\n name: 'Bitcoin Taproot Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_1 = MOCK_SOL_ACCOUNT_1;\n\nexport const MOCK_SNAP_ACCOUNT_2: InternalAccount = {\n id: 'mock-snap-id-2',\n address: '0x789',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Snap Acc 2',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_2,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_3 = MOCK_BTC_P2WPKH_ACCOUNT_1;\nexport const MOCK_SNAP_ACCOUNT_4 = MOCK_BTC_P2TR_ACCOUNT_1;\n\nexport const MOCK_HARDWARE_ACCOUNT_1: InternalAccount = {\n id: 'mock-hardware-id-1',\n address: '0xABC',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Hardware Acc 1',\n keyring: { type: KeyringTypes.ledger },\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport class MockAccountBuilder<Account extends KeyringAccount> {\n readonly #account: Account;\n\n constructor(account: Account) {\n // Make a deep-copy to avoid mutating the same ref.\n this.#account = JSON.parse(JSON.stringify(account));\n }\n\n static from<Account extends KeyringAccount>(\n account: Account,\n ): MockAccountBuilder<Account> {\n return new MockAccountBuilder(account);\n }\n\n withId(id: InternalAccount['id']) {\n this.#account.id = id;\n return this;\n }\n\n withUuid() {\n this.#account.id = uuid();\n return this;\n }\n\n withAddressSuffix(suffix: string) {\n this.#account.address += suffix;\n return this;\n }\n\n withEntropySource(entropySource: EntropySourceId) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.id = entropySource;\n }\n return this;\n }\n\n withGroupIndex(groupIndex: number) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.groupIndex = groupIndex;\n }\n return this;\n }\n\n get() {\n return this.#account;\n }\n}\n\nexport const MOCK_WALLET_1_ENTROPY_SOURCE = MOCK_ENTROPY_SOURCE_1;\n\nexport const MOCK_WALLET_1_EVM_ACCOUNT = MockAccountBuilder.from(\n MOCK_HD_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_SOL_ACCOUNT = MockAccountBuilder.from(\n MOCK_SOL_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2WPKH_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2WPKH_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2TR_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2TR_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\n\nexport function mockAsInternalAccount(\n account: KeyringAccount,\n): InternalAccount {\n return {\n ...account,\n metadata: {\n name: 'Mocked Account',\n importTime: Date.now(),\n keyring: {\n type: 'mock-keyring-type',\n },\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"accounts.cjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,uDAAuD;AAMvD,uDAW+B;AAC/B,qEAA4D;AAE5D,+BAAkC;AAErB,QAAA,aAA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AAc,EAAC,uBAAA,IAAI,mCAAS,CAAC,EAAE;YACjC,uBAAA,IAAI,mCAAS,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;SACvD;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG;QACD,OAAO,uBAAA,IAAI,mCAAS,CAAC;IACvB,CAAC;CACF;AA9CD,gDA8CC;;AAEY,QAAA,4BAA4B,GAAG,6BAAqB,CAAC;AAErD,QAAA,yBAAyB,GAAG,kBAAkB,CAAC,IAAI,CAC9D,yBAAiB,CAClB;KACE,iBAAiB,CAAC,oCAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AACI,QAAA,yBAAyB,GAAG,kBAAkB,CAAC,IAAI,CAC9D,0BAAkB,CACnB;KACE,iBAAiB,CAAC,oCAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AACI,QAAA,gCAAgC,GAAG,kBAAkB,CAAC,IAAI,CACrE,iCAAyB,CAC1B;KACE,iBAAiB,CAAC,oCAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AACI,QAAA,8BAA8B,GAAG,kBAAkB,CAAC,IAAI,CACnE,+BAAuB,CACxB;KACE,iBAAiB,CAAC,oCAA4B,CAAC;KAC/C,cAAc,CAAC,CAAC,CAAC;KACjB,GAAG,EAAE,CAAC;AAET,SAAgB,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;AAbD,sDAaC","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,7 +1,10 @@
|
|
|
1
1
|
import type { Bip44Account } from "@metamask/account-api";
|
|
2
|
-
import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
2
|
+
import type { DiscoveredAccount, EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
3
|
+
import { EthMethod } from "@metamask/keyring-api";
|
|
3
4
|
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
4
5
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
6
|
+
export declare const 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];
|
|
5
8
|
export declare const MOCK_SNAP_1: {
|
|
6
9
|
id: string;
|
|
7
10
|
name: string;
|
|
@@ -39,6 +42,7 @@ export declare const MOCK_HD_KEYRING_2: {
|
|
|
39
42
|
export declare const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
40
43
|
export declare const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount>;
|
|
41
44
|
export declare const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
45
|
+
export declare const MOCK_SOL_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
|
|
42
46
|
export declare const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
43
47
|
export declare const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
44
48
|
export declare const MOCK_SNAP_ACCOUNT_1: Bip44Account<{
|
|
@@ -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,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAKL,SAAS,EAMV,8BAA8B;AAC/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAGtE,eAAO,MAAM,aAAa,yFAC8D,CAAC;AAEzF,eAAO,MAAM,eAAe,+JAOlB,CAAC;AAIX,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,iBAAi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;;;;;;EAKrC,CAAC;AACT,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AAET,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,GACtB,eAAe,CAWjB"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Bip44Account } from "@metamask/account-api";
|
|
2
|
-
import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
2
|
+
import type { DiscoveredAccount, EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
3
|
+
import { EthMethod } from "@metamask/keyring-api";
|
|
3
4
|
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
4
5
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
6
|
+
export declare const 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];
|
|
5
8
|
export declare const MOCK_SNAP_1: {
|
|
6
9
|
id: string;
|
|
7
10
|
name: string;
|
|
@@ -39,6 +42,7 @@ export declare const MOCK_HD_KEYRING_2: {
|
|
|
39
42
|
export declare const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
40
43
|
export declare const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount>;
|
|
41
44
|
export declare const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
45
|
+
export declare const MOCK_SOL_DISCOVERED_ACCOUNT_1: DiscoveredAccount;
|
|
42
46
|
export declare const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
43
47
|
export declare const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount>;
|
|
44
48
|
export declare const MOCK_SNAP_ACCOUNT_1: Bip44Account<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.mts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;AAE1D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"accounts.d.mts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;AAE1D,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,8BAA8B;AAC/B,OAAO,EAKL,SAAS,EAMV,8BAA8B;AAC/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAGtE,eAAO,MAAM,aAAa,yFAC8D,CAAC;AAEzF,eAAO,MAAM,eAAe,+JAOlB,CAAC;AAIX,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD,eAAO,MAAM,iBAAiB;;;;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,eAAe,CAqB3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,eAAe,CAqB3D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,eAAe,CAsB5D,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,iBAI3C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,YAAY,CAAC,eAAe,CA2BnE,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,eAAe,CA2BjE,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqB,CAAC;AAEtD,eAAO,MAAM,mBAAmB,EAAE,eAcjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AAC7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA0B,CAAC;AAE3D,eAAO,MAAM,uBAAuB,EAAE,eAarC,CAAC;AAEF,qBAAa,kBAAkB,CAAC,OAAO,SAAS,cAAc;;gBAGhD,OAAO,EAAE,OAAO;IAK5B,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,cAAc,EACxC,OAAO,EAAE,OAAO,GACf,kBAAkB,CAAC,OAAO,CAAC;IAI9B,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC;IAKhC,QAAQ;IAKR,iBAAiB,CAAC,MAAM,EAAE,MAAM;IAKhC,iBAAiB,CAAC,aAAa,EAAE,eAAe;IAOhD,cAAc,CAAC,UAAU,EAAE,MAAM;IAOjC,GAAG;CAGJ;AAED,eAAO,MAAM,4BAA4B,sBAAwB,CAAC;AAElE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK9B,CAAC;AACT,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK9B,CAAC;AACT,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrC,CAAC;AACT,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AAET,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,GACtB,eAAe,CAWjB"}
|
package/dist/tests/accounts.mjs
CHANGED
|
@@ -14,7 +14,8 @@ import { isBip44Account } from "@metamask/account-api";
|
|
|
14
14
|
import { BtcAccountType, BtcMethod, BtcScope, EthAccountType, EthMethod, EthScope, KeyringAccountEntropyTypeOption, SolAccountType, SolMethod, SolScope } from "@metamask/keyring-api";
|
|
15
15
|
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
16
16
|
import { v4 as uuid } from "uuid";
|
|
17
|
-
const
|
|
17
|
+
export const MOCK_MNEMONIC = 'abandon ability able about above absent absorb abstract absurd abuse access accident';
|
|
18
|
+
export const ETH_EOA_METHODS = [
|
|
18
19
|
EthMethod.PersonalSign,
|
|
19
20
|
EthMethod.Sign,
|
|
20
21
|
EthMethod.SignTransaction,
|
|
@@ -118,6 +119,11 @@ export const MOCK_SOL_ACCOUNT_1 = {
|
|
|
118
119
|
lastSelected: 0,
|
|
119
120
|
},
|
|
120
121
|
};
|
|
122
|
+
export const MOCK_SOL_DISCOVERED_ACCOUNT_1 = {
|
|
123
|
+
type: 'bip44',
|
|
124
|
+
scopes: [SolScope.Mainnet],
|
|
125
|
+
derivationPath: `m/44'/501'/0'/0'`,
|
|
126
|
+
};
|
|
121
127
|
export const MOCK_BTC_P2WPKH_ACCOUNT_1 = {
|
|
122
128
|
id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',
|
|
123
129
|
type: BtcAccountType.P2wpkh,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.mjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAEvD,OAAO,EACL,cAAc,EACd,SAAS,EACT,QAAQ,EACR,cAAc,EACd,SAAS,EACT,QAAQ,EACR,+BAA+B,EAC/B,cAAc,EACd,SAAS,EACT,QAAQ,EACT,8BAA8B;AAC/B,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAE5D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AAElC,MAAM,eAAe,GAAG;IACtB,SAAS,CAAC,YAAY;IACtB,SAAS,CAAC,IAAI;IACd,SAAS,CAAC,eAAe;IACzB,SAAS,CAAC,eAAe;IACzB,SAAS,CAA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AAG;QACD,OAAO,uBAAA,IAAI,mCAAS,CAAC;IACvB,CAAC;CACF;;AAED,MAAM,CAAC,MAAM,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 { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport {\n BtcAccountType,\n BtcMethod,\n BtcScope,\n EthAccountType,\n EthMethod,\n EthScope,\n KeyringAccountEntropyTypeOption,\n SolAccountType,\n SolMethod,\n SolScope,\n} from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport { v4 as uuid } from 'uuid';\n\nconst ETH_EOA_METHODS = [\n EthMethod.PersonalSign,\n EthMethod.Sign,\n EthMethod.SignTransaction,\n EthMethod.SignTypedDataV1,\n EthMethod.SignTypedDataV3,\n EthMethod.SignTypedDataV4,\n] as const;\n\nconst SOL_METHODS = Object.values(SolMethod);\n\nexport const MOCK_SNAP_1 = {\n id: 'local:mock-snap-id-1',\n name: 'Mock Snap 1',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 1',\n },\n};\n\nexport const MOCK_SNAP_2 = {\n id: 'local:mock-snap-id-2',\n name: 'Mock Snap 2',\n enabled: true,\n manifest: {\n proposedName: 'Mock Snap 2',\n },\n};\n\nexport const MOCK_ENTROPY_SOURCE_1 = 'mock-keyring-id-1';\nexport const MOCK_ENTROPY_SOURCE_2 = 'mock-keyring-id-2';\n\nexport const MOCK_HD_KEYRING_1 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_1, name: 'HD Keyring 1' },\n accounts: ['0x123'],\n};\n\nexport const MOCK_HD_KEYRING_2 = {\n type: KeyringTypes.hd,\n metadata: { id: MOCK_ENTROPY_SOURCE_2, name: 'HD Keyring 2' },\n accounts: ['0x456'],\n};\n\nexport const MOCK_HD_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-id-1',\n address: '0x123',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_1.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 1',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_HD_ACCOUNT_2: Bip44Account<InternalAccount> = {\n id: 'mock-id-2',\n address: '0x456',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Account 2',\n keyring: { type: KeyringTypes.hd },\n importTime: 0,\n lastSelected: 0,\n nameLastUpdatedAt: 0,\n },\n};\n\nexport const MOCK_SOL_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'mock-snap-id-1',\n address: 'aabbccdd',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n methods: SOL_METHODS,\n type: SolAccountType.DataAccount,\n scopes: [SolScope.Mainnet, SolScope.Testnet, SolScope.Devnet],\n metadata: {\n name: 'Solana Account 1',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_1,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_BTC_P2WPKH_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'b0f030d8-e101-4b5a-a3dd-13f8ca8ec1db',\n type: BtcAccountType.P2wpkh,\n methods: [BtcMethod.SendBitcoin],\n address: 'bc1qx8ls07cy8j8nrluy2u0xwn7gh8fxg0rg4s8zze',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Mainnet],\n metadata: {\n name: 'Bitcoin Native Segwit Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_BTC_P2TR_ACCOUNT_1: Bip44Account<InternalAccount> = {\n id: 'a20c2e1a-6ff6-40ba-b8e0-ccdb6f9933bb',\n type: BtcAccountType.P2tr,\n methods: [BtcMethod.SendBitcoin],\n address: 'tb1p5cyxnuxmeuwuvkwfem96lxx9wex9kkf4mt9ll6q60jfsnrzqg4sszkqjnh',\n options: {\n entropy: {\n type: KeyringAccountEntropyTypeOption.Mnemonic,\n // NOTE: shares entropy with MOCK_HD_ACCOUNT_2\n id: MOCK_HD_KEYRING_2.metadata.id,\n groupIndex: 0,\n derivationPath: '',\n },\n },\n scopes: [BtcScope.Testnet],\n metadata: {\n name: 'Bitcoin Taproot Account 1',\n importTime: 0,\n keyring: {\n type: 'Snap keyring',\n },\n snap: {\n id: 'mock-btc-snap-id',\n enabled: true,\n name: 'Mock Bitcoin Snap',\n },\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_1 = MOCK_SOL_ACCOUNT_1;\n\nexport const MOCK_SNAP_ACCOUNT_2: InternalAccount = {\n id: 'mock-snap-id-2',\n address: '0x789',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Snap Acc 2',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_2,\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport const MOCK_SNAP_ACCOUNT_3 = MOCK_BTC_P2WPKH_ACCOUNT_1;\nexport const MOCK_SNAP_ACCOUNT_4 = MOCK_BTC_P2TR_ACCOUNT_1;\n\nexport const MOCK_HARDWARE_ACCOUNT_1: InternalAccount = {\n id: 'mock-hardware-id-1',\n address: '0xABC',\n options: {},\n methods: [...ETH_EOA_METHODS],\n type: EthAccountType.Eoa,\n scopes: [EthScope.Eoa],\n metadata: {\n name: 'Hardware Acc 1',\n keyring: { type: KeyringTypes.ledger },\n importTime: 0,\n lastSelected: 0,\n },\n};\n\nexport class MockAccountBuilder<Account extends KeyringAccount> {\n readonly #account: Account;\n\n constructor(account: Account) {\n // Make a deep-copy to avoid mutating the same ref.\n this.#account = JSON.parse(JSON.stringify(account));\n }\n\n static from<Account extends KeyringAccount>(\n account: Account,\n ): MockAccountBuilder<Account> {\n return new MockAccountBuilder(account);\n }\n\n withId(id: InternalAccount['id']) {\n this.#account.id = id;\n return this;\n }\n\n withUuid() {\n this.#account.id = uuid();\n return this;\n }\n\n withAddressSuffix(suffix: string) {\n this.#account.address += suffix;\n return this;\n }\n\n withEntropySource(entropySource: EntropySourceId) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.id = entropySource;\n }\n return this;\n }\n\n withGroupIndex(groupIndex: number) {\n if (isBip44Account(this.#account)) {\n this.#account.options.entropy.groupIndex = groupIndex;\n }\n return this;\n }\n\n get() {\n return this.#account;\n }\n}\n\nexport const MOCK_WALLET_1_ENTROPY_SOURCE = MOCK_ENTROPY_SOURCE_1;\n\nexport const MOCK_WALLET_1_EVM_ACCOUNT = MockAccountBuilder.from(\n MOCK_HD_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_SOL_ACCOUNT = MockAccountBuilder.from(\n MOCK_SOL_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2WPKH_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2WPKH_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\nexport const MOCK_WALLET_1_BTC_P2TR_ACCOUNT = MockAccountBuilder.from(\n MOCK_BTC_P2TR_ACCOUNT_1,\n)\n .withEntropySource(MOCK_WALLET_1_ENTROPY_SOURCE)\n .withGroupIndex(0)\n .get();\n\nexport function mockAsInternalAccount(\n account: KeyringAccount,\n): InternalAccount {\n return {\n ...account,\n metadata: {\n name: 'Mocked Account',\n importTime: Date.now(),\n keyring: {\n type: 'mock-keyring-type',\n },\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"accounts.mjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAMvD,OAAO,EACL,cAAc,EACd,SAAS,EACT,QAAQ,EACR,cAAc,EACd,SAAS,EACT,QAAQ,EACR,+BAA+B,EAC/B,cAAc,EACd,SAAS,EACT,QAAQ,EACT,8BAA8B;AAC/B,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,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,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACzD,MAAM,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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"]}
|
package/dist/tests/messenger.cjs
CHANGED
|
@@ -32,6 +32,10 @@ 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',
|
|
35
39
|
],
|
|
36
40
|
});
|
|
37
41
|
}
|
|
@@ -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;YAC5B,gDAAgD;YAChD,wCAAwC;YACxC,qCAAqC;YACrC,iCAAiC;SAClC;KACF,CAAC,CAAC;AACL,CAAC;AAvBD,oFAuBC","sourcesContent":["import { Messenger } from '@metamask/base-controller';\n\nimport type {\n AllowedActions,\n AllowedEvents,\n MultichainAccountServiceActions,\n MultichainAccountServiceEvents,\n MultichainAccountServiceMessenger,\n} from '../types';\n\n/**\n * Creates a new root messenger instance for testing.\n *\n * @returns A new Messenger instance.\n */\nexport function getRootMessenger() {\n return new Messenger<\n MultichainAccountServiceActions | AllowedActions,\n MultichainAccountServiceEvents | AllowedEvents\n >();\n}\n\n/**\n * Retrieves a restricted messenger for the MultichainAccountService.\n *\n * @param messenger - The root messenger instance. Defaults to a new Messenger created by getRootMessenger().\n * @returns The restricted messenger for the MultichainAccountService.\n */\nexport function getMultichainAccountServiceMessenger(\n messenger: ReturnType<typeof getRootMessenger>,\n): MultichainAccountServiceMessenger {\n return messenger.getRestricted({\n name: 'MultichainAccountService',\n allowedEvents: [\n 'KeyringController:stateChange',\n 'AccountsController:accountAdded',\n 'AccountsController:accountRemoved',\n ],\n allowedActions: [\n 'AccountsController:getAccount',\n 'AccountsController:getAccountByAddress',\n 'AccountsController:listMultichainAccounts',\n 'SnapController:handleRequest',\n 'KeyringController:withKeyring',\n 'KeyringController:getState',\n 'NetworkController:findNetworkClientIdByChainId',\n 'NetworkController:getNetworkClientById',\n 'KeyringController:getKeyringsByType',\n 'KeyringController:addNewKeyring',\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,CAqBnC"}
|
|
@@ -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,CAqBnC"}
|
package/dist/tests/messenger.mjs
CHANGED
|
@@ -28,6 +28,10 @@ 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',
|
|
31
35
|
],
|
|
32
36
|
});
|
|
33
37
|
}
|