@metamask-previews/multichain-account-service 0.2.1-preview-7509efdb → 0.3.0-preview-1abef88
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 +15 -2
- package/dist/MultichainAccountService.cjs +113 -36
- package/dist/MultichainAccountService.cjs.map +1 -1
- package/dist/MultichainAccountService.d.cts +36 -5
- package/dist/MultichainAccountService.d.cts.map +1 -1
- package/dist/MultichainAccountService.d.mts +36 -5
- package/dist/MultichainAccountService.d.mts.map +1 -1
- package/dist/MultichainAccountService.mjs +112 -35
- package/dist/MultichainAccountService.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/providers/BaseAccountProvider.cjs +4 -19
- package/dist/providers/BaseAccountProvider.cjs.map +1 -1
- package/dist/providers/BaseAccountProvider.d.cts +5 -19
- package/dist/providers/BaseAccountProvider.d.cts.map +1 -1
- package/dist/providers/BaseAccountProvider.d.mts +5 -19
- package/dist/providers/BaseAccountProvider.d.mts.map +1 -1
- package/dist/providers/BaseAccountProvider.mjs +3 -17
- package/dist/providers/BaseAccountProvider.mjs.map +1 -1
- package/dist/providers/EvmAccountProvider.cjs.map +1 -1
- package/dist/providers/EvmAccountProvider.d.cts +2 -1
- package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
- package/dist/providers/EvmAccountProvider.d.mts +2 -1
- package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
- package/dist/providers/EvmAccountProvider.mjs.map +1 -1
- package/dist/providers/SolAccountProvider.cjs.map +1 -1
- package/dist/providers/SolAccountProvider.d.cts +2 -1
- package/dist/providers/SolAccountProvider.d.cts.map +1 -1
- package/dist/providers/SolAccountProvider.d.mts +2 -1
- package/dist/providers/SolAccountProvider.d.mts.map +1 -1
- package/dist/providers/SolAccountProvider.mjs.map +1 -1
- package/dist/tests/accounts.cjs +7 -3
- package/dist/tests/accounts.cjs.map +1 -1
- package/dist/tests/accounts.d.cts +1 -0
- package/dist/tests/accounts.d.cts.map +1 -1
- package/dist/tests/accounts.d.mts +1 -0
- package/dist/tests/accounts.d.mts.map +1 -1
- package/dist/tests/accounts.mjs +5 -1
- package/dist/tests/accounts.mjs.map +1 -1
- package/dist/tests/messenger.cjs +5 -1
- package/dist/tests/messenger.cjs.map +1 -1
- package/dist/tests/messenger.d.cts +2 -2
- package/dist/tests/messenger.d.cts.map +1 -1
- package/dist/tests/messenger.d.mts +2 -2
- package/dist/tests/messenger.d.mts.map +1 -1
- package/dist/tests/messenger.mjs +5 -1
- package/dist/tests/messenger.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +20 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +20 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +4 -3
package/dist/tests/accounts.cjs
CHANGED
|
@@ -13,9 +13,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _MockAccountBuilder_account;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.MockAccountBuilder = exports.MOCK_HARDWARE_ACCOUNT_1 = exports.MOCK_SNAP_ACCOUNT_2 = exports.MOCK_SNAP_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;
|
|
16
|
+
const account_api_1 = require("@metamask/account-api");
|
|
16
17
|
const keyring_api_1 = require("@metamask/keyring-api");
|
|
17
18
|
const keyring_controller_1 = require("@metamask/keyring-controller");
|
|
18
|
-
const BaseAccountProvider_1 = require("../providers/BaseAccountProvider.cjs");
|
|
19
19
|
const ETH_EOA_METHODS = [
|
|
20
20
|
keyring_api_1.EthMethod.PersonalSign,
|
|
21
21
|
keyring_api_1.EthMethod.Sign,
|
|
@@ -158,14 +158,18 @@ class MockAccountBuilder {
|
|
|
158
158
|
static from(account) {
|
|
159
159
|
return new MockAccountBuilder(account);
|
|
160
160
|
}
|
|
161
|
+
withId(id) {
|
|
162
|
+
__classPrivateFieldGet(this, _MockAccountBuilder_account, "f").id = id;
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
161
165
|
withEntropySource(entropySource) {
|
|
162
|
-
if ((0,
|
|
166
|
+
if ((0, account_api_1.isBip44Account)(__classPrivateFieldGet(this, _MockAccountBuilder_account, "f"))) {
|
|
163
167
|
__classPrivateFieldGet(this, _MockAccountBuilder_account, "f").options.entropy.id = entropySource;
|
|
164
168
|
}
|
|
165
169
|
return this;
|
|
166
170
|
}
|
|
167
171
|
withGroupIndex(groupIndex) {
|
|
168
|
-
if ((0,
|
|
172
|
+
if ((0, account_api_1.isBip44Account)(__classPrivateFieldGet(this, _MockAccountBuilder_account, "f"))) {
|
|
169
173
|
__classPrivateFieldGet(this, _MockAccountBuilder_account, "f").options.entropy.groupIndex = groupIndex;
|
|
170
174
|
}
|
|
171
175
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.cjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"accounts.cjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAAuD;AAEvD,uDAQ+B;AAC/B,qEAA4D;AAG5D,MAAM,eAAe,GAAG;IACtB,uBAAS,CAAC,YAAY;IACtB,uBAAS,CAAC,IAAI;IACd,uBAAS,CAAC,eAAe;IACzB,uBAAS,CAAC,eAAe;IACzB,uBAAS,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AwB;QAClC,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,EAAyB;QAC9B,uBAAA,IAAI,mCAAS,CAAC,EAAE,GAAG,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB,CAAC,aAA8B;QAC9C,IAAI,IAAA,4BAAc,EAAC,uBAAA,IAAI,mCAAS,CAAC,EAAE;YACjC,uBAAA,IAAI,mCAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,aAAa,CAAC;SAClD;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,UAAkB;QAC/B,IAAI,IAAA,4BAAc,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;AAlCD,gDAkCC","sourcesContent":["import { isBip44Account } from '@metamask/account-api';\nimport type { EntropySourceId } from '@metamask/keyring-api';\nimport {\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';\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: 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: 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_SNAP_ACCOUNT_1: 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],\n metadata: {\n name: 'Snap Account 1',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_1,\n importTime: 0,\n lastSelected: 0,\n },\n};\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_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 {\n readonly #account: InternalAccount;\n\n constructor(account: InternalAccount) {\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: InternalAccount): MockAccountBuilder {\n return new MockAccountBuilder(account);\n }\n\n withId(id: InternalAccount['id']) {\n this.#account.id = id;\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"]}
|
|
@@ -44,6 +44,7 @@ export declare class MockAccountBuilder {
|
|
|
44
44
|
#private;
|
|
45
45
|
constructor(account: InternalAccount);
|
|
46
46
|
static from(account: InternalAccount): MockAccountBuilder;
|
|
47
|
+
withId(id: InternalAccount['id']): this;
|
|
47
48
|
withEntropySource(entropySource: EntropySourceId): this;
|
|
48
49
|
withGroupIndex(groupIndex: number): this;
|
|
49
50
|
get(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.cts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accounts.d.cts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAU7D,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAatE,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,eAqB/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAqB/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eAsBjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eAcjC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAarC,CAAC;AAEF,qBAAa,kBAAkB;;gBAGjB,OAAO,EAAE,eAAe;IAKpC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB;IAIzD,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC;IAKhC,iBAAiB,CAAC,aAAa,EAAE,eAAe;IAOhD,cAAc,CAAC,UAAU,EAAE,MAAM;IAOjC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ"}
|
|
@@ -44,6 +44,7 @@ export declare class MockAccountBuilder {
|
|
|
44
44
|
#private;
|
|
45
45
|
constructor(account: InternalAccount);
|
|
46
46
|
static from(account: InternalAccount): MockAccountBuilder;
|
|
47
|
+
withId(id: InternalAccount['id']): this;
|
|
47
48
|
withEntropySource(entropySource: EntropySourceId): this;
|
|
48
49
|
withGroupIndex(groupIndex: number): this;
|
|
49
50
|
get(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.mts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accounts.d.mts","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAU7D,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAatE,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,eAqB/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAqB/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eAsBjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eAcjC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAarC,CAAC;AAEF,qBAAa,kBAAkB;;gBAGjB,OAAO,EAAE,eAAe;IAKpC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB;IAIzD,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC;IAKhC,iBAAiB,CAAC,aAAa,EAAE,eAAe;IAOhD,cAAc,CAAC,UAAU,EAAE,MAAM;IAOjC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ"}
|
package/dist/tests/accounts.mjs
CHANGED
|
@@ -10,9 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _MockAccountBuilder_account;
|
|
13
|
+
import { isBip44Account } from "@metamask/account-api";
|
|
13
14
|
import { EthAccountType, EthMethod, EthScope, KeyringAccountEntropyTypeOption, SolAccountType, SolMethod, SolScope } from "@metamask/keyring-api";
|
|
14
15
|
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
15
|
-
import { isBip44Account } from "../providers/BaseAccountProvider.mjs";
|
|
16
16
|
const ETH_EOA_METHODS = [
|
|
17
17
|
EthMethod.PersonalSign,
|
|
18
18
|
EthMethod.Sign,
|
|
@@ -155,6 +155,10 @@ export class MockAccountBuilder {
|
|
|
155
155
|
static from(account) {
|
|
156
156
|
return new MockAccountBuilder(account);
|
|
157
157
|
}
|
|
158
|
+
withId(id) {
|
|
159
|
+
__classPrivateFieldGet(this, _MockAccountBuilder_account, "f").id = id;
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
158
162
|
withEntropySource(entropySource) {
|
|
159
163
|
if (isBip44Account(__classPrivateFieldGet(this, _MockAccountBuilder_account, "f"))) {
|
|
160
164
|
__classPrivateFieldGet(this, _MockAccountBuilder_account, "f").options.entropy.id = entropySource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.mjs","sourceRoot":"","sources":["../../src/tests/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|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OAAO,EAAE,CAAC,GAAG,eAAe,CAAC;IAC7B,IAAI,EAAE,cAAc,CAAC,GAAG;IACxB,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,EAAE;QACtC,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;KAChB;CACF,CAAC;AAEF,MAAM,OAAO,kBAAkB;IAG7B,YAAY,OAAwB;QAF3B,8CAA0B;QAGjC,mDAAmD;QACnD,uBAAA,IAAI,+BAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAA,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,OAAwB;QAClC,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,EAAyB;QAC9B,uBAAA,IAAI,mCAAS,CAAC,EAAE,GAAG,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB,CAAC,aAA8B;QAC9C,IAAI,cAAc,CAAC,uBAAA,IAAI,mCAAS,CAAC,EAAE;YACjC,uBAAA,IAAI,mCAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,aAAa,CAAC;SAClD;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,UAAkB;QAC/B,IAAI,cAAc,CAAC,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","sourcesContent":["import { isBip44Account } from '@metamask/account-api';\nimport type { EntropySourceId } from '@metamask/keyring-api';\nimport {\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';\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: 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: 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_SNAP_ACCOUNT_1: 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],\n metadata: {\n name: 'Snap Account 1',\n keyring: { type: KeyringTypes.snap },\n snap: MOCK_SNAP_1,\n importTime: 0,\n lastSelected: 0,\n },\n};\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_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 {\n readonly #account: InternalAccount;\n\n constructor(account: InternalAccount) {\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: InternalAccount): MockAccountBuilder {\n return new MockAccountBuilder(account);\n }\n\n withId(id: InternalAccount['id']) {\n this.#account.id = id;\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"]}
|
package/dist/tests/messenger.cjs
CHANGED
|
@@ -20,7 +20,11 @@ exports.getRootMessenger = getRootMessenger;
|
|
|
20
20
|
function getMultichainAccountServiceMessenger(messenger) {
|
|
21
21
|
return messenger.getRestricted({
|
|
22
22
|
name: 'MultichainAccountService',
|
|
23
|
-
allowedEvents: [
|
|
23
|
+
allowedEvents: [
|
|
24
|
+
'KeyringController:stateChange',
|
|
25
|
+
'AccountsController:accountAdded',
|
|
26
|
+
'AccountsController:accountRemoved',
|
|
27
|
+
],
|
|
24
28
|
allowedActions: [
|
|
25
29
|
'AccountsController:getAccount',
|
|
26
30
|
'AccountsController:getAccountByAddress',
|
|
@@ -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
|
|
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,11 +1,11 @@
|
|
|
1
1
|
import { Messenger } from "@metamask/base-controller";
|
|
2
|
-
import type { AllowedActions, MultichainAccountServiceMessenger } from "../types.cjs";
|
|
2
|
+
import type { AllowedActions, AllowedEvents, MultichainAccountServiceActions, MultichainAccountServiceMessenger } from "../types.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new root messenger instance for testing.
|
|
5
5
|
*
|
|
6
6
|
* @returns A new Messenger instance.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getRootMessenger(): Messenger<AllowedActions,
|
|
8
|
+
export declare function getRootMessenger(): Messenger<MultichainAccountServiceActions | AllowedActions, AllowedEvents>;
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves a restricted messenger for the MultichainAccountService.
|
|
11
11
|
*
|
|
@@ -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,
|
|
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,11 +1,11 @@
|
|
|
1
1
|
import { Messenger } from "@metamask/base-controller";
|
|
2
|
-
import type { AllowedActions, MultichainAccountServiceMessenger } from "../types.mjs";
|
|
2
|
+
import type { AllowedActions, AllowedEvents, MultichainAccountServiceActions, MultichainAccountServiceMessenger } from "../types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new root messenger instance for testing.
|
|
5
5
|
*
|
|
6
6
|
* @returns A new Messenger instance.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getRootMessenger(): Messenger<AllowedActions,
|
|
8
|
+
export declare function getRootMessenger(): Messenger<MultichainAccountServiceActions | AllowedActions, AllowedEvents>;
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves a restricted messenger for the MultichainAccountService.
|
|
11
11
|
*
|
|
@@ -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,
|
|
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
|
@@ -16,7 +16,11 @@ export function getRootMessenger() {
|
|
|
16
16
|
export function getMultichainAccountServiceMessenger(messenger) {
|
|
17
17
|
return messenger.getRestricted({
|
|
18
18
|
name: 'MultichainAccountService',
|
|
19
|
-
allowedEvents: [
|
|
19
|
+
allowedEvents: [
|
|
20
|
+
'KeyringController:stateChange',
|
|
21
|
+
'AccountsController:accountAdded',
|
|
22
|
+
'AccountsController:accountRemoved',
|
|
23
|
+
],
|
|
20
24
|
allowedActions: [
|
|
21
25
|
'AccountsController:getAccount',
|
|
22
26
|
'AccountsController:getAccountByAddress',
|
|
@@ -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
|
|
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/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\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\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions
|
|
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 MultichainAccountServiceGetMultichainAccountAction = {\n type: `${typeof serviceName}:getMultichainAccount`;\n handler: MultichainAccountService['getMultichainAccount'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountsAction = {\n type: `${typeof serviceName}:getMultichainAccounts`;\n handler: MultichainAccountService['getMultichainAccounts'];\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\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountAction\n | MultichainAccountServiceGetMultichainAccountsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction;\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,12 +1,29 @@
|
|
|
1
|
-
import type { AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
|
|
1
|
+
import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
|
|
2
2
|
import type { RestrictedMessenger } from "@metamask/base-controller";
|
|
3
3
|
import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
4
4
|
import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
|
|
5
|
+
import type { MultichainAccountService, serviceName } from "./MultichainAccountService.cjs";
|
|
6
|
+
export type MultichainAccountServiceGetMultichainAccountAction = {
|
|
7
|
+
type: `${typeof serviceName}:getMultichainAccount`;
|
|
8
|
+
handler: MultichainAccountService['getMultichainAccount'];
|
|
9
|
+
};
|
|
10
|
+
export type MultichainAccountServiceGetMultichainAccountsAction = {
|
|
11
|
+
type: `${typeof serviceName}:getMultichainAccounts`;
|
|
12
|
+
handler: MultichainAccountService['getMultichainAccounts'];
|
|
13
|
+
};
|
|
14
|
+
export type MultichainAccountServiceGetMultichainAccountWalletAction = {
|
|
15
|
+
type: `${typeof serviceName}:getMultichainAccountWallet`;
|
|
16
|
+
handler: MultichainAccountService['getMultichainAccountWallet'];
|
|
17
|
+
};
|
|
18
|
+
export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
|
|
19
|
+
type: `${typeof serviceName}:getMultichainAccountWallets`;
|
|
20
|
+
handler: MultichainAccountService['getMultichainAccountWallets'];
|
|
21
|
+
};
|
|
5
22
|
/**
|
|
6
23
|
* All actions that {@link MultichainAccountService} registers so that other
|
|
7
24
|
* modules can call them.
|
|
8
25
|
*/
|
|
9
|
-
export type MultichainAccountServiceActions =
|
|
26
|
+
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountAction | MultichainAccountServiceGetMultichainAccountsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction;
|
|
10
27
|
/**
|
|
11
28
|
* All events that {@link MultichainAccountService} publishes so that other modules
|
|
12
29
|
* can subscribe to them.
|
|
@@ -21,7 +38,7 @@ export type AllowedActions = AccountsControllerListMultichainAccountsAction | Ac
|
|
|
21
38
|
* All events published by other modules that {@link MultichainAccountService}
|
|
22
39
|
* subscribes to.
|
|
23
40
|
*/
|
|
24
|
-
export type AllowedEvents = KeyringControllerStateChangeEvent;
|
|
41
|
+
export type AllowedEvents = KeyringControllerStateChangeEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRemovedEvent;
|
|
25
42
|
/**
|
|
26
43
|
* The messenger restricted to actions and events that
|
|
27
44
|
* {@link MultichainAccountService} needs to access.
|
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,kCAAkC,EAClC,2CAA2C,EAC3C,8CAA8C,EAC/C,sCAAsC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EACV,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EACnC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,IAAI,qCAAqC,EAAE,oCAAoC;AAE9G;;;GAGG;AACH,MAAM,MAAM,+BAA+B,
|
|
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,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mC,GACnC,qCAAqC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,mBAAmB,CACjE,0BAA0B,EAC1B,+BAA+B,GAAG,cAAc,EAChD,8BAA8B,GAAG,aAAa,EAC9C,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import type { AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
|
|
1
|
+
import type { AccountsControllerAccountAddedEvent, AccountsControllerAccountRemovedEvent, AccountsControllerGetAccountAction, AccountsControllerGetAccountByAddressAction, AccountsControllerListMultichainAccountsAction } from "@metamask/accounts-controller";
|
|
2
2
|
import type { RestrictedMessenger } from "@metamask/base-controller";
|
|
3
3
|
import type { KeyringControllerGetStateAction, KeyringControllerStateChangeEvent, KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
|
|
4
4
|
import type { HandleSnapRequest as SnapControllerHandleSnapRequestAction } from "@metamask/snaps-controllers";
|
|
5
|
+
import type { MultichainAccountService, serviceName } from "./MultichainAccountService.mjs";
|
|
6
|
+
export type MultichainAccountServiceGetMultichainAccountAction = {
|
|
7
|
+
type: `${typeof serviceName}:getMultichainAccount`;
|
|
8
|
+
handler: MultichainAccountService['getMultichainAccount'];
|
|
9
|
+
};
|
|
10
|
+
export type MultichainAccountServiceGetMultichainAccountsAction = {
|
|
11
|
+
type: `${typeof serviceName}:getMultichainAccounts`;
|
|
12
|
+
handler: MultichainAccountService['getMultichainAccounts'];
|
|
13
|
+
};
|
|
14
|
+
export type MultichainAccountServiceGetMultichainAccountWalletAction = {
|
|
15
|
+
type: `${typeof serviceName}:getMultichainAccountWallet`;
|
|
16
|
+
handler: MultichainAccountService['getMultichainAccountWallet'];
|
|
17
|
+
};
|
|
18
|
+
export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
|
|
19
|
+
type: `${typeof serviceName}:getMultichainAccountWallets`;
|
|
20
|
+
handler: MultichainAccountService['getMultichainAccountWallets'];
|
|
21
|
+
};
|
|
5
22
|
/**
|
|
6
23
|
* All actions that {@link MultichainAccountService} registers so that other
|
|
7
24
|
* modules can call them.
|
|
8
25
|
*/
|
|
9
|
-
export type MultichainAccountServiceActions =
|
|
26
|
+
export type MultichainAccountServiceActions = MultichainAccountServiceGetMultichainAccountAction | MultichainAccountServiceGetMultichainAccountsAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction;
|
|
10
27
|
/**
|
|
11
28
|
* All events that {@link MultichainAccountService} publishes so that other modules
|
|
12
29
|
* can subscribe to them.
|
|
@@ -21,7 +38,7 @@ export type AllowedActions = AccountsControllerListMultichainAccountsAction | Ac
|
|
|
21
38
|
* All events published by other modules that {@link MultichainAccountService}
|
|
22
39
|
* subscribes to.
|
|
23
40
|
*/
|
|
24
|
-
export type AllowedEvents = KeyringControllerStateChangeEvent;
|
|
41
|
+
export type AllowedEvents = KeyringControllerStateChangeEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRemovedEvent;
|
|
25
42
|
/**
|
|
26
43
|
* The messenger restricted to actions and events that
|
|
27
44
|
* {@link MultichainAccountService} needs to access.
|
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,kCAAkC,EAClC,2CAA2C,EAC3C,8CAA8C,EAC/C,sCAAsC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EACV,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EACnC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,IAAI,qCAAqC,EAAE,oCAAoC;AAE9G;;;GAGG;AACH,MAAM,MAAM,+BAA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CAA8C,GAC9C,kCAAkC,GAClC,2CAA2C,GAC3C,qCAAqC,GACrC,kCAAkC,GAClC,+BAA+B,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,iCAAiC,GACjC,mCAAmC,GACnC,qCAAqC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,mBAAmB,CACjE,0BAA0B,EAC1B,+BAA+B,GAAG,cAAc,EAChD,8BAA8B,GAAG,aAAa,EAC9C,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
|
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 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\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions
|
|
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 MultichainAccountServiceGetMultichainAccountAction = {\n type: `${typeof serviceName}:getMultichainAccount`;\n handler: MultichainAccountService['getMultichainAccount'];\n};\n\nexport type MultichainAccountServiceGetMultichainAccountsAction = {\n type: `${typeof serviceName}:getMultichainAccounts`;\n handler: MultichainAccountService['getMultichainAccounts'];\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\n/**\n * All actions that {@link MultichainAccountService} registers so that other\n * modules can call them.\n */\nexport type MultichainAccountServiceActions =\n | MultichainAccountServiceGetMultichainAccountAction\n | MultichainAccountServiceGetMultichainAccountsAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction;\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.
|
|
3
|
+
"version": "0.3.0-preview-1abef88",
|
|
4
4
|
"description": "Service to manage multichain accounts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@metamask/account-api": "^0.2.0",
|
|
51
50
|
"@metamask/base-controller": "^8.0.1",
|
|
52
51
|
"@metamask/keyring-api": "^19.0.0",
|
|
53
52
|
"@metamask/keyring-internal-api": "^7.0.0",
|
|
@@ -57,7 +56,8 @@
|
|
|
57
56
|
"@metamask/superstruct": "^3.1.0"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
|
-
"@metamask/
|
|
59
|
+
"@metamask/account-api": "^0.3.0",
|
|
60
|
+
"@metamask/accounts-controller": "^32.0.1",
|
|
61
61
|
"@metamask/auto-changelog": "^3.4.4",
|
|
62
62
|
"@metamask/eth-snap-keyring": "^14.0.0",
|
|
63
63
|
"@metamask/keyring-controller": "^22.1.0",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"webextension-polyfill": "^0.12.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
+
"@metamask/account-api": "^0.3.0",
|
|
76
77
|
"@metamask/accounts-controller": "^32.0.0",
|
|
77
78
|
"@metamask/keyring-controller": "^22.0.0",
|
|
78
79
|
"@metamask/providers": "^22.0.0",
|