@metamask-previews/multichain-account-service 0.3.0-preview-75996e28 → 0.3.0-preview-af4e47c0
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 +3 -1
- package/dist/MultichainAccountGroup.cjs.map +1 -1
- package/dist/MultichainAccountGroup.d.cts +3 -3
- package/dist/MultichainAccountGroup.d.cts.map +1 -1
- package/dist/MultichainAccountGroup.d.mts +3 -3
- package/dist/MultichainAccountGroup.d.mts.map +1 -1
- package/dist/MultichainAccountGroup.mjs.map +1 -1
- package/dist/MultichainAccountService.cjs +11 -0
- package/dist/MultichainAccountService.cjs.map +1 -1
- package/dist/MultichainAccountService.d.cts +10 -0
- package/dist/MultichainAccountService.d.cts.map +1 -1
- package/dist/MultichainAccountService.d.mts +10 -0
- package/dist/MultichainAccountService.d.mts.map +1 -1
- package/dist/MultichainAccountService.mjs +11 -0
- package/dist/MultichainAccountService.mjs.map +1 -1
- package/dist/MultichainAccountWallet.cjs +115 -13
- package/dist/MultichainAccountWallet.cjs.map +1 -1
- package/dist/MultichainAccountWallet.d.cts +22 -1
- package/dist/MultichainAccountWallet.d.cts.map +1 -1
- package/dist/MultichainAccountWallet.d.mts +22 -1
- package/dist/MultichainAccountWallet.d.mts.map +1 -1
- package/dist/MultichainAccountWallet.mjs +115 -13
- package/dist/MultichainAccountWallet.mjs.map +1 -1
- package/dist/providers/BaseAccountProvider.cjs +20 -1
- package/dist/providers/BaseAccountProvider.cjs.map +1 -1
- package/dist/providers/BaseAccountProvider.d.cts +21 -1
- package/dist/providers/BaseAccountProvider.d.cts.map +1 -1
- package/dist/providers/BaseAccountProvider.d.mts +21 -1
- package/dist/providers/BaseAccountProvider.d.mts.map +1 -1
- package/dist/providers/BaseAccountProvider.mjs +18 -0
- package/dist/providers/BaseAccountProvider.mjs.map +1 -1
- package/dist/providers/EvmAccountProvider.cjs +35 -0
- package/dist/providers/EvmAccountProvider.cjs.map +1 -1
- package/dist/providers/EvmAccountProvider.d.cts +66 -0
- package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
- package/dist/providers/EvmAccountProvider.d.mts +66 -0
- package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
- package/dist/providers/EvmAccountProvider.mjs +36 -1
- package/dist/providers/EvmAccountProvider.mjs.map +1 -1
- package/dist/providers/SolAccountProvider.cjs +35 -0
- package/dist/providers/SolAccountProvider.cjs.map +1 -1
- package/dist/providers/SolAccountProvider.d.cts +27 -1
- package/dist/providers/SolAccountProvider.d.cts.map +1 -1
- package/dist/providers/SolAccountProvider.d.mts +27 -1
- package/dist/providers/SolAccountProvider.d.mts.map +1 -1
- package/dist/providers/SolAccountProvider.mjs +37 -2
- package/dist/providers/SolAccountProvider.mjs.map +1 -1
- package/dist/tests/accounts.cjs +9 -0
- package/dist/tests/accounts.cjs.map +1 -1
- package/dist/tests/accounts.d.cts +27 -55
- package/dist/tests/accounts.d.cts.map +1 -1
- package/dist/tests/accounts.d.mts +27 -55
- package/dist/tests/accounts.d.mts.map +1 -1
- package/dist/tests/accounts.mjs +9 -0
- package/dist/tests/accounts.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +5 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +5 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uDAI+B;
|
|
1
|
+
{"version":3,"file":"BaseAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uDAI+B;AAS/B;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,OAAuB;IAEvB,IAAI,CAAC,IAAA,4BAAc,EAAC,OAAO,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D;AACH,CAAC;AAND,oDAMC;AAED,MAAsB,mBAAmB;IAKvC,YAAY,SAA4C;;QACtD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAyBD,WAAW;QACT,OAAO,uBAAA,IAAI,wEAAa,MAAjB,IAAI,CAAe,CAAC;IAC7B,CAAC;IAED,UAAU,CACR,EAAsC;QAEtC,wDAAwD;QACxD,MAAM,CAAC,KAAK,CAAC,GAAG,uBAAA,IAAI,wEAAa,MAAjB,IAAI,EAAc,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAElE,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;SAClD;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAES,KAAK,CAAC,WAAW,CACzB,QAAyB,EACzB,SAM6B;QAE7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CACtC,+BAA+B,EAC/B,QAAQ,EACR,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CACxB,SAAS,CAAC;YACR,OAAO,EAAE,OAA0B;YACnC,QAAQ;SACT,CAAC,CACL,CAAC;QAEF,OAAO,MAAwB,CAAC;IAClC,CAAC;CAmBF;AAzFD,kDAyFC;6HA/EG,SAA+C,GAAG,EAAE,CAAC,IAAI;IAEzD,MAAM,QAAQ,GAAmC,EAAE,CAAC;IAEpD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI;IACvC,2EAA2E;IAC3E,yEAAyE;IACzE,kDAAkD;IAClD,2CAA2C,CAC5C,EAAE;QACD,IACE,IAAA,4BAAc,EAAC,OAAO,CAAC;YACvB,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC;YACjC,MAAM,CAAC,OAAO,CAAC,EACf;YACA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACxB;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import {\n isBip44Account,\n type AccountProvider,\n type Bip44Account,\n} from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport type {\n KeyringMetadata,\n KeyringSelector,\n} from '@metamask/keyring-controller';\n\nimport type { MultichainAccountServiceMessenger } from '../types';\n\n/**\n * Asserts a keyring account is BIP-44 compatible.\n *\n * @param account - Keyring account to check.\n * @throws If the keyring account is not compatible.\n */\nexport function assertIsBip44Account(\n account: KeyringAccount,\n): asserts account is Bip44Account<KeyringAccount> {\n if (!isBip44Account(account)) {\n throw new Error('Created account is not BIP-44 compatible');\n }\n}\n\nexport abstract class BaseAccountProvider\n implements AccountProvider<Bip44Account<KeyringAccount>>\n{\n protected readonly messenger: MultichainAccountServiceMessenger;\n\n constructor(messenger: MultichainAccountServiceMessenger) {\n this.messenger = messenger;\n }\n\n #getAccounts(\n filter: (account: KeyringAccount) => boolean = () => true,\n ): Bip44Account<KeyringAccount>[] {\n const accounts: Bip44Account<KeyringAccount>[] = [];\n\n for (const account of this.messenger.call(\n // NOTE: Even though the name is misleading, this only fetches all internal\n // accounts, including EVM and non-EVM. We might wanna change this action\n // name once we fully support multichain accounts.\n 'AccountsController:listMultichainAccounts',\n )) {\n if (\n isBip44Account(account) &&\n this.isAccountCompatible(account) &&\n filter(account)\n ) {\n accounts.push(account);\n }\n }\n\n return accounts;\n }\n\n getAccounts(): Bip44Account<KeyringAccount>[] {\n return this.#getAccounts();\n }\n\n getAccount(\n id: Bip44Account<KeyringAccount>['id'],\n ): Bip44Account<KeyringAccount> {\n // TODO: Maybe just use a proper find for faster lookup?\n const [found] = this.#getAccounts((account) => account.id === id);\n\n if (!found) {\n throw new Error(`Unable to find account: ${id}`);\n }\n\n return found;\n }\n\n protected async withKeyring<SelectedKeyring, CallbackResult = void>(\n selector: KeyringSelector,\n operation: ({\n keyring,\n metadata,\n }: {\n keyring: SelectedKeyring;\n metadata: KeyringMetadata;\n }) => Promise<CallbackResult>,\n ): Promise<CallbackResult> {\n const result = await this.messenger.call(\n 'KeyringController:withKeyring',\n selector,\n ({ keyring, metadata }) =>\n operation({\n keyring: keyring as SelectedKeyring,\n metadata,\n }),\n );\n\n return result as CallbackResult;\n }\n\n abstract isAccountCompatible(account: Bip44Account<KeyringAccount>): boolean;\n\n abstract createAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n\n abstract discoverAndCreateAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n}\n"]}
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import { type AccountProvider, type Bip44Account } from "@metamask/account-api";
|
|
2
|
-
import type { KeyringAccount } from "@metamask/keyring-api";
|
|
2
|
+
import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
3
|
+
import type { KeyringMetadata, KeyringSelector } from "@metamask/keyring-controller";
|
|
3
4
|
import type { MultichainAccountServiceMessenger } from "../types.cjs";
|
|
5
|
+
/**
|
|
6
|
+
* Asserts a keyring account is BIP-44 compatible.
|
|
7
|
+
*
|
|
8
|
+
* @param account - Keyring account to check.
|
|
9
|
+
* @throws If the keyring account is not compatible.
|
|
10
|
+
*/
|
|
11
|
+
export declare function assertIsBip44Account(account: KeyringAccount): asserts account is Bip44Account<KeyringAccount>;
|
|
4
12
|
export declare abstract class BaseAccountProvider implements AccountProvider<Bip44Account<KeyringAccount>> {
|
|
5
13
|
#private;
|
|
6
14
|
protected readonly messenger: MultichainAccountServiceMessenger;
|
|
7
15
|
constructor(messenger: MultichainAccountServiceMessenger);
|
|
8
16
|
getAccounts(): Bip44Account<KeyringAccount>[];
|
|
9
17
|
getAccount(id: Bip44Account<KeyringAccount>['id']): Bip44Account<KeyringAccount>;
|
|
18
|
+
protected withKeyring<SelectedKeyring, CallbackResult = void>(selector: KeyringSelector, operation: ({ keyring, metadata, }: {
|
|
19
|
+
keyring: SelectedKeyring;
|
|
20
|
+
metadata: KeyringMetadata;
|
|
21
|
+
}) => Promise<CallbackResult>): Promise<CallbackResult>;
|
|
10
22
|
abstract isAccountCompatible(account: Bip44Account<KeyringAccount>): boolean;
|
|
23
|
+
abstract createAccounts({ entropySource, groupIndex, }: {
|
|
24
|
+
entropySource: EntropySourceId;
|
|
25
|
+
groupIndex: number;
|
|
26
|
+
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
27
|
+
abstract discoverAndCreateAccounts({ entropySource, groupIndex, }: {
|
|
28
|
+
entropySource: EntropySourceId;
|
|
29
|
+
groupIndex: number;
|
|
30
|
+
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
11
31
|
}
|
|
12
32
|
//# sourceMappingURL=BaseAccountProvider.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"BaseAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAC7E,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAChB,qCAAqC;AAEtC,OAAO,KAAK,EAAE,iCAAiC,EAAE,qBAAiB;AAElE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC,cAAc,CAAC,CAIjD;AAED,8BAAsB,mBACpB,YAAW,eAAe,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;;IAExD,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iCAAiC,CAAC;gBAEpD,SAAS,EAAE,iCAAiC;IA2BxD,WAAW,IAAI,YAAY,CAAC,cAAc,CAAC,EAAE;IAI7C,UAAU,CACR,EAAE,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GACrC,YAAY,CAAC,cAAc,CAAC;cAWf,WAAW,CAAC,eAAe,EAAE,cAAc,GAAG,IAAI,EAChE,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,CAAC,EACV,OAAO,EACP,QAAQ,GACT,EAAE;QACD,OAAO,EAAE,eAAe,CAAC;QACzB,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,OAAO,CAAC,cAAc,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC;IAc1B,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,cAAc,CAAC,GAAG,OAAO;IAE5E,QAAQ,CAAC,cAAc,CAAC,EACtB,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;IAE3C,QAAQ,CAAC,yBAAyB,CAAC,EACjC,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,12 +1,32 @@
|
|
|
1
1
|
import { type AccountProvider, type Bip44Account } from "@metamask/account-api";
|
|
2
|
-
import type { KeyringAccount } from "@metamask/keyring-api";
|
|
2
|
+
import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
|
|
3
|
+
import type { KeyringMetadata, KeyringSelector } from "@metamask/keyring-controller";
|
|
3
4
|
import type { MultichainAccountServiceMessenger } from "../types.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Asserts a keyring account is BIP-44 compatible.
|
|
7
|
+
*
|
|
8
|
+
* @param account - Keyring account to check.
|
|
9
|
+
* @throws If the keyring account is not compatible.
|
|
10
|
+
*/
|
|
11
|
+
export declare function assertIsBip44Account(account: KeyringAccount): asserts account is Bip44Account<KeyringAccount>;
|
|
4
12
|
export declare abstract class BaseAccountProvider implements AccountProvider<Bip44Account<KeyringAccount>> {
|
|
5
13
|
#private;
|
|
6
14
|
protected readonly messenger: MultichainAccountServiceMessenger;
|
|
7
15
|
constructor(messenger: MultichainAccountServiceMessenger);
|
|
8
16
|
getAccounts(): Bip44Account<KeyringAccount>[];
|
|
9
17
|
getAccount(id: Bip44Account<KeyringAccount>['id']): Bip44Account<KeyringAccount>;
|
|
18
|
+
protected withKeyring<SelectedKeyring, CallbackResult = void>(selector: KeyringSelector, operation: ({ keyring, metadata, }: {
|
|
19
|
+
keyring: SelectedKeyring;
|
|
20
|
+
metadata: KeyringMetadata;
|
|
21
|
+
}) => Promise<CallbackResult>): Promise<CallbackResult>;
|
|
10
22
|
abstract isAccountCompatible(account: Bip44Account<KeyringAccount>): boolean;
|
|
23
|
+
abstract createAccounts({ entropySource, groupIndex, }: {
|
|
24
|
+
entropySource: EntropySourceId;
|
|
25
|
+
groupIndex: number;
|
|
26
|
+
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
27
|
+
abstract discoverAndCreateAccounts({ entropySource, groupIndex, }: {
|
|
28
|
+
entropySource: EntropySourceId;
|
|
29
|
+
groupIndex: number;
|
|
30
|
+
}): Promise<Bip44Account<KeyringAccount>[]>;
|
|
11
31
|
}
|
|
12
32
|
//# sourceMappingURL=BaseAccountProvider.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"BaseAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAC7E,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAChB,qCAAqC;AAEtC,OAAO,KAAK,EAAE,iCAAiC,EAAE,qBAAiB;AAElE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC,cAAc,CAAC,CAIjD;AAED,8BAAsB,mBACpB,YAAW,eAAe,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;;IAExD,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iCAAiC,CAAC;gBAEpD,SAAS,EAAE,iCAAiC;IA2BxD,WAAW,IAAI,YAAY,CAAC,cAAc,CAAC,EAAE;IAI7C,UAAU,CACR,EAAE,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GACrC,YAAY,CAAC,cAAc,CAAC;cAWf,WAAW,CAAC,eAAe,EAAE,cAAc,GAAG,IAAI,EAChE,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,CAAC,EACV,OAAO,EACP,QAAQ,GACT,EAAE;QACD,OAAO,EAAE,eAAe,CAAC;QACzB,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,OAAO,CAAC,cAAc,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC;IAc1B,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,cAAc,CAAC,GAAG,OAAO;IAE5E,QAAQ,CAAC,cAAc,CAAC,EACtB,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;IAE3C,QAAQ,CAAC,yBAAyB,CAAC,EACjC,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,6 +5,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _BaseAccountProvider_instances, _BaseAccountProvider_getAccounts;
|
|
7
7
|
import { isBip44Account } from "@metamask/account-api";
|
|
8
|
+
/**
|
|
9
|
+
* Asserts a keyring account is BIP-44 compatible.
|
|
10
|
+
*
|
|
11
|
+
* @param account - Keyring account to check.
|
|
12
|
+
* @throws If the keyring account is not compatible.
|
|
13
|
+
*/
|
|
14
|
+
export function assertIsBip44Account(account) {
|
|
15
|
+
if (!isBip44Account(account)) {
|
|
16
|
+
throw new Error('Created account is not BIP-44 compatible');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
8
19
|
export class BaseAccountProvider {
|
|
9
20
|
constructor(messenger) {
|
|
10
21
|
_BaseAccountProvider_instances.add(this);
|
|
@@ -21,6 +32,13 @@ export class BaseAccountProvider {
|
|
|
21
32
|
}
|
|
22
33
|
return found;
|
|
23
34
|
}
|
|
35
|
+
async withKeyring(selector, operation) {
|
|
36
|
+
const result = await this.messenger.call('KeyringController:withKeyring', selector, ({ keyring, metadata }) => operation({
|
|
37
|
+
keyring: keyring,
|
|
38
|
+
metadata,
|
|
39
|
+
}));
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
24
42
|
}
|
|
25
43
|
_BaseAccountProvider_instances = new WeakSet(), _BaseAccountProvider_getAccounts = function _BaseAccountProvider_getAccounts(filter = () => true) {
|
|
26
44
|
const accounts = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAccountProvider.mjs","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,cAAc,EAGf,8BAA8B;
|
|
1
|
+
{"version":3,"file":"BaseAccountProvider.mjs","sourceRoot":"","sources":["../../src/providers/BaseAccountProvider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,cAAc,EAGf,8BAA8B;AAS/B;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAuB;IAEvB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D;AACH,CAAC;AAED,MAAM,OAAgB,mBAAmB;IAKvC,YAAY,SAA4C;;QACtD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAyBD,WAAW;QACT,OAAO,uBAAA,IAAI,wEAAa,MAAjB,IAAI,CAAe,CAAC;IAC7B,CAAC;IAED,UAAU,CACR,EAAsC;QAEtC,wDAAwD;QACxD,MAAM,CAAC,KAAK,CAAC,GAAG,uBAAA,IAAI,wEAAa,MAAjB,IAAI,EAAc,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAElE,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;SAClD;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAES,KAAK,CAAC,WAAW,CACzB,QAAyB,EACzB,SAM6B;QAE7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CACtC,+BAA+B,EAC/B,QAAQ,EACR,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CACxB,SAAS,CAAC;YACR,OAAO,EAAE,OAA0B;YACnC,QAAQ;SACT,CAAC,CACL,CAAC;QAEF,OAAO,MAAwB,CAAC;IAClC,CAAC;CAmBF;6HA/EG,SAA+C,GAAG,EAAE,CAAC,IAAI;IAEzD,MAAM,QAAQ,GAAmC,EAAE,CAAC;IAEpD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI;IACvC,2EAA2E;IAC3E,yEAAyE;IACzE,kDAAkD;IAClD,2CAA2C,CAC5C,EAAE;QACD,IACE,cAAc,CAAC,OAAO,CAAC;YACvB,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC;YACjC,MAAM,CAAC,OAAO,CAAC,EACf;YACA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACxB;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import {\n isBip44Account,\n type AccountProvider,\n type Bip44Account,\n} from '@metamask/account-api';\nimport type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\nimport type {\n KeyringMetadata,\n KeyringSelector,\n} from '@metamask/keyring-controller';\n\nimport type { MultichainAccountServiceMessenger } from '../types';\n\n/**\n * Asserts a keyring account is BIP-44 compatible.\n *\n * @param account - Keyring account to check.\n * @throws If the keyring account is not compatible.\n */\nexport function assertIsBip44Account(\n account: KeyringAccount,\n): asserts account is Bip44Account<KeyringAccount> {\n if (!isBip44Account(account)) {\n throw new Error('Created account is not BIP-44 compatible');\n }\n}\n\nexport abstract class BaseAccountProvider\n implements AccountProvider<Bip44Account<KeyringAccount>>\n{\n protected readonly messenger: MultichainAccountServiceMessenger;\n\n constructor(messenger: MultichainAccountServiceMessenger) {\n this.messenger = messenger;\n }\n\n #getAccounts(\n filter: (account: KeyringAccount) => boolean = () => true,\n ): Bip44Account<KeyringAccount>[] {\n const accounts: Bip44Account<KeyringAccount>[] = [];\n\n for (const account of this.messenger.call(\n // NOTE: Even though the name is misleading, this only fetches all internal\n // accounts, including EVM and non-EVM. We might wanna change this action\n // name once we fully support multichain accounts.\n 'AccountsController:listMultichainAccounts',\n )) {\n if (\n isBip44Account(account) &&\n this.isAccountCompatible(account) &&\n filter(account)\n ) {\n accounts.push(account);\n }\n }\n\n return accounts;\n }\n\n getAccounts(): Bip44Account<KeyringAccount>[] {\n return this.#getAccounts();\n }\n\n getAccount(\n id: Bip44Account<KeyringAccount>['id'],\n ): Bip44Account<KeyringAccount> {\n // TODO: Maybe just use a proper find for faster lookup?\n const [found] = this.#getAccounts((account) => account.id === id);\n\n if (!found) {\n throw new Error(`Unable to find account: ${id}`);\n }\n\n return found;\n }\n\n protected async withKeyring<SelectedKeyring, CallbackResult = void>(\n selector: KeyringSelector,\n operation: ({\n keyring,\n metadata,\n }: {\n keyring: SelectedKeyring;\n metadata: KeyringMetadata;\n }) => Promise<CallbackResult>,\n ): Promise<CallbackResult> {\n const result = await this.messenger.call(\n 'KeyringController:withKeyring',\n selector,\n ({ keyring, metadata }) =>\n operation({\n keyring: keyring as SelectedKeyring,\n metadata,\n }),\n );\n\n return result as CallbackResult;\n }\n\n abstract isAccountCompatible(account: Bip44Account<KeyringAccount>): boolean;\n\n abstract createAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n\n abstract discoverAndCreateAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }): Promise<Bip44Account<KeyringAccount>[]>;\n}\n"]}
|
|
@@ -4,11 +4,46 @@ exports.EvmAccountProvider = void 0;
|
|
|
4
4
|
const keyring_api_1 = require("@metamask/keyring-api");
|
|
5
5
|
const keyring_controller_1 = require("@metamask/keyring-controller");
|
|
6
6
|
const BaseAccountProvider_1 = require("./BaseAccountProvider.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Asserts an internal account exists.
|
|
9
|
+
*
|
|
10
|
+
* @param account - The internal account to check.
|
|
11
|
+
* @throws An error if the internal account does not exist.
|
|
12
|
+
*/
|
|
13
|
+
function assertInternalAccountExists(account) {
|
|
14
|
+
if (!account) {
|
|
15
|
+
throw new Error('Internal account does not exist');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
7
18
|
class EvmAccountProvider extends BaseAccountProvider_1.BaseAccountProvider {
|
|
8
19
|
isAccountCompatible(account) {
|
|
9
20
|
return (account.type === keyring_api_1.EthAccountType.Eoa &&
|
|
10
21
|
account.metadata.keyring.type === keyring_controller_1.KeyringTypes.hd);
|
|
11
22
|
}
|
|
23
|
+
async createAccounts({ entropySource, groupIndex, }) {
|
|
24
|
+
const [address] = await this.withKeyring({ id: entropySource }, async ({ keyring }) => {
|
|
25
|
+
const accounts = await keyring.getAccounts();
|
|
26
|
+
if (groupIndex < accounts.length) {
|
|
27
|
+
// Nothing new to create, we just re-use the existing accounts here,
|
|
28
|
+
return [accounts[groupIndex]];
|
|
29
|
+
}
|
|
30
|
+
// For now, we don't allow for gap, so if we need to create a new
|
|
31
|
+
// account, this has to be the next one.
|
|
32
|
+
if (groupIndex !== accounts.length) {
|
|
33
|
+
throw new Error('Trying to create too many accounts');
|
|
34
|
+
}
|
|
35
|
+
// Create next account (and returns their addresses).
|
|
36
|
+
return await keyring.addAccounts(1);
|
|
37
|
+
});
|
|
38
|
+
const account = this.messenger.call('AccountsController:getAccountByAddress', address);
|
|
39
|
+
// We MUST have the associated internal account.
|
|
40
|
+
assertInternalAccountExists(account);
|
|
41
|
+
(0, BaseAccountProvider_1.assertIsBip44Account)(account);
|
|
42
|
+
return [account];
|
|
43
|
+
}
|
|
44
|
+
async discoverAndCreateAccounts(_) {
|
|
45
|
+
return []; // TODO: Implement account discovery.
|
|
46
|
+
}
|
|
12
47
|
}
|
|
13
48
|
exports.EvmAccountProvider = EvmAccountProvider;
|
|
14
49
|
//# sourceMappingURL=EvmAccountProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"EvmAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":";;;AAEA,uDAAuD;AACvD,qEAA4D;AAO5D,mEAG+B;AAE/B;;;;;GAKG;AACH,SAAS,2BAA2B,CAClC,OAAoC;IAEpC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;AACH,CAAC;AAED,MAAa,kBAAmB,SAAQ,yCAAmB;IACzD,mBAAmB,CAAC,OAAsC;QACxD,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,4BAAc,CAAC,GAAG;YACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAM,iCAAY,CAAC,EAAa,CAC9D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,EACnB,aAAa,EACb,UAAU,GAIX;QACC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC,WAAW,CACtC,EAAE,EAAE,EAAE,aAAa,EAAE,EACrB,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YACpB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;YAC7C,IAAI,UAAU,GAAG,QAAQ,CAAC,MAAM,EAAE;gBAChC,oEAAoE;gBACpE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;aAC/B;YAED,iEAAiE;YACjE,wCAAwC;YACxC,IAAI,UAAU,KAAK,QAAQ,CAAC,MAAM,EAAE;gBAClC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;aACvD;YAED,qDAAqD;YACrD,OAAO,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC,CACF,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CACjC,wCAAwC,EACxC,OAAO,CACR,CAAC;QAEF,gDAAgD;QAChD,2BAA2B,CAAC,OAAO,CAAC,CAAC;QACrC,IAAA,0CAAoB,EAAC,OAAO,CAAC,CAAC;QAE9B,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,CAG/B;QACC,OAAO,EAAE,CAAC,CAAC,qCAAqC;IAClD,CAAC;CACF;AArDD,gDAqDC","sourcesContent":["import type { Bip44Account } from '@metamask/account-api';\nimport type { EntropySourceId } from '@metamask/keyring-api';\nimport { EthAccountType } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type {\n EthKeyring,\n InternalAccount,\n} from '@metamask/keyring-internal-api';\nimport type { Hex } from '@metamask/utils';\n\nimport {\n assertIsBip44Account,\n BaseAccountProvider,\n} from './BaseAccountProvider';\n\n/**\n * Asserts an internal account exists.\n *\n * @param account - The internal account to check.\n * @throws An error if the internal account does not exist.\n */\nfunction assertInternalAccountExists(\n account: InternalAccount | undefined,\n): asserts account is InternalAccount {\n if (!account) {\n throw new Error('Internal account does not exist');\n }\n}\n\nexport class EvmAccountProvider extends BaseAccountProvider {\n isAccountCompatible(account: Bip44Account<InternalAccount>): boolean {\n return (\n account.type === EthAccountType.Eoa &&\n account.metadata.keyring.type === (KeyringTypes.hd as string)\n );\n }\n\n async createAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) {\n const [address] = await this.withKeyring<EthKeyring, Hex[]>(\n { id: entropySource },\n async ({ keyring }) => {\n const accounts = await keyring.getAccounts();\n if (groupIndex < accounts.length) {\n // Nothing new to create, we just re-use the existing accounts here,\n return [accounts[groupIndex]];\n }\n\n // For now, we don't allow for gap, so if we need to create a new\n // account, this has to be the next one.\n if (groupIndex !== accounts.length) {\n throw new Error('Trying to create too many accounts');\n }\n\n // Create next account (and returns their addresses).\n return await keyring.addAccounts(1);\n },\n );\n\n const account = this.messenger.call(\n 'AccountsController:getAccountByAddress',\n address,\n );\n\n // We MUST have the associated internal account.\n assertInternalAccountExists(account);\n assertIsBip44Account(account);\n\n return [account];\n }\n\n async discoverAndCreateAccounts(_: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) {\n return []; // TODO: Implement account discovery.\n }\n}\n"]}
|
|
@@ -1,7 +1,73 @@
|
|
|
1
1
|
import type { Bip44Account } from "@metamask/account-api";
|
|
2
|
+
import type { EntropySourceId } from "@metamask/keyring-api";
|
|
2
3
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
3
4
|
import { BaseAccountProvider } from "./BaseAccountProvider.cjs";
|
|
4
5
|
export declare class EvmAccountProvider extends BaseAccountProvider {
|
|
5
6
|
isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
7
|
+
createAccounts({ entropySource, groupIndex, }: {
|
|
8
|
+
entropySource: EntropySourceId;
|
|
9
|
+
groupIndex: number;
|
|
10
|
+
}): Promise<({
|
|
11
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
|
|
12
|
+
id: string;
|
|
13
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
14
|
+
entropy?: {
|
|
15
|
+
type: "mnemonic";
|
|
16
|
+
id: string;
|
|
17
|
+
derivationPath: string;
|
|
18
|
+
groupIndex: number;
|
|
19
|
+
} | {
|
|
20
|
+
type: "private-key";
|
|
21
|
+
} | undefined;
|
|
22
|
+
exportable?: boolean | undefined;
|
|
23
|
+
};
|
|
24
|
+
metadata: {
|
|
25
|
+
name: string;
|
|
26
|
+
importTime: number;
|
|
27
|
+
keyring: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
nameLastUpdatedAt?: number | undefined;
|
|
31
|
+
snap?: {
|
|
32
|
+
name: string;
|
|
33
|
+
id: string;
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
} | undefined;
|
|
36
|
+
lastSelected?: number | undefined;
|
|
37
|
+
};
|
|
38
|
+
address: string;
|
|
39
|
+
scopes: `${string}:${string}`[];
|
|
40
|
+
methods: string[];
|
|
41
|
+
} & {
|
|
42
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account";
|
|
43
|
+
id: string;
|
|
44
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
45
|
+
entropy?: {
|
|
46
|
+
type: "mnemonic";
|
|
47
|
+
id: string;
|
|
48
|
+
derivationPath: string;
|
|
49
|
+
groupIndex: number;
|
|
50
|
+
} | {
|
|
51
|
+
type: "private-key";
|
|
52
|
+
} | undefined;
|
|
53
|
+
exportable?: boolean | undefined;
|
|
54
|
+
};
|
|
55
|
+
address: string;
|
|
56
|
+
scopes: `${string}:${string}`[];
|
|
57
|
+
methods: string[];
|
|
58
|
+
} & {
|
|
59
|
+
options: {
|
|
60
|
+
entropy: {
|
|
61
|
+
type: "mnemonic";
|
|
62
|
+
id: string;
|
|
63
|
+
derivationPath: string;
|
|
64
|
+
groupIndex: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
})[]>;
|
|
68
|
+
discoverAndCreateAccounts(_: {
|
|
69
|
+
entropySource: EntropySourceId;
|
|
70
|
+
groupIndex: number;
|
|
71
|
+
}): Promise<never[]>;
|
|
6
72
|
}
|
|
7
73
|
//# sourceMappingURL=EvmAccountProvider.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"EvmAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAG7D,OAAO,KAAK,EAEV,eAAe,EAChB,uCAAuC;AAGxC,OAAO,EAEL,mBAAmB,EACpB,kCAA8B;AAgB/B,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiCK,yBAAyB,CAAC,CAAC,EAAE;QACjC,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB;CAGF"}
|
|
@@ -1,7 +1,73 @@
|
|
|
1
1
|
import type { Bip44Account } from "@metamask/account-api";
|
|
2
|
+
import type { EntropySourceId } from "@metamask/keyring-api";
|
|
2
3
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
3
4
|
import { BaseAccountProvider } from "./BaseAccountProvider.mjs";
|
|
4
5
|
export declare class EvmAccountProvider extends BaseAccountProvider {
|
|
5
6
|
isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
7
|
+
createAccounts({ entropySource, groupIndex, }: {
|
|
8
|
+
entropySource: EntropySourceId;
|
|
9
|
+
groupIndex: number;
|
|
10
|
+
}): Promise<({
|
|
11
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
|
|
12
|
+
id: string;
|
|
13
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
14
|
+
entropy?: {
|
|
15
|
+
type: "mnemonic";
|
|
16
|
+
id: string;
|
|
17
|
+
derivationPath: string;
|
|
18
|
+
groupIndex: number;
|
|
19
|
+
} | {
|
|
20
|
+
type: "private-key";
|
|
21
|
+
} | undefined;
|
|
22
|
+
exportable?: boolean | undefined;
|
|
23
|
+
};
|
|
24
|
+
metadata: {
|
|
25
|
+
name: string;
|
|
26
|
+
importTime: number;
|
|
27
|
+
keyring: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
nameLastUpdatedAt?: number | undefined;
|
|
31
|
+
snap?: {
|
|
32
|
+
name: string;
|
|
33
|
+
id: string;
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
} | undefined;
|
|
36
|
+
lastSelected?: number | undefined;
|
|
37
|
+
};
|
|
38
|
+
address: string;
|
|
39
|
+
scopes: `${string}:${string}`[];
|
|
40
|
+
methods: string[];
|
|
41
|
+
} & {
|
|
42
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account";
|
|
43
|
+
id: string;
|
|
44
|
+
options: Record<string, import("@metamask/utils").Json> & {
|
|
45
|
+
entropy?: {
|
|
46
|
+
type: "mnemonic";
|
|
47
|
+
id: string;
|
|
48
|
+
derivationPath: string;
|
|
49
|
+
groupIndex: number;
|
|
50
|
+
} | {
|
|
51
|
+
type: "private-key";
|
|
52
|
+
} | undefined;
|
|
53
|
+
exportable?: boolean | undefined;
|
|
54
|
+
};
|
|
55
|
+
address: string;
|
|
56
|
+
scopes: `${string}:${string}`[];
|
|
57
|
+
methods: string[];
|
|
58
|
+
} & {
|
|
59
|
+
options: {
|
|
60
|
+
entropy: {
|
|
61
|
+
type: "mnemonic";
|
|
62
|
+
id: string;
|
|
63
|
+
derivationPath: string;
|
|
64
|
+
groupIndex: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
})[]>;
|
|
68
|
+
discoverAndCreateAccounts(_: {
|
|
69
|
+
entropySource: EntropySourceId;
|
|
70
|
+
groupIndex: number;
|
|
71
|
+
}): Promise<never[]>;
|
|
6
72
|
}
|
|
7
73
|
//# sourceMappingURL=EvmAccountProvider.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"EvmAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAG7D,OAAO,KAAK,EAEV,eAAe,EAChB,uCAAuC;AAGxC,OAAO,EAEL,mBAAmB,EACpB,kCAA8B;AAgB/B,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiCK,yBAAyB,CAAC,CAAC,EAAE;QACjC,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB;CAGF"}
|
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
import { EthAccountType } from "@metamask/keyring-api";
|
|
2
2
|
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
3
|
-
import { BaseAccountProvider } from "./BaseAccountProvider.mjs";
|
|
3
|
+
import { assertIsBip44Account, BaseAccountProvider } from "./BaseAccountProvider.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Asserts an internal account exists.
|
|
6
|
+
*
|
|
7
|
+
* @param account - The internal account to check.
|
|
8
|
+
* @throws An error if the internal account does not exist.
|
|
9
|
+
*/
|
|
10
|
+
function assertInternalAccountExists(account) {
|
|
11
|
+
if (!account) {
|
|
12
|
+
throw new Error('Internal account does not exist');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
4
15
|
export class EvmAccountProvider extends BaseAccountProvider {
|
|
5
16
|
isAccountCompatible(account) {
|
|
6
17
|
return (account.type === EthAccountType.Eoa &&
|
|
7
18
|
account.metadata.keyring.type === KeyringTypes.hd);
|
|
8
19
|
}
|
|
20
|
+
async createAccounts({ entropySource, groupIndex, }) {
|
|
21
|
+
const [address] = await this.withKeyring({ id: entropySource }, async ({ keyring }) => {
|
|
22
|
+
const accounts = await keyring.getAccounts();
|
|
23
|
+
if (groupIndex < accounts.length) {
|
|
24
|
+
// Nothing new to create, we just re-use the existing accounts here,
|
|
25
|
+
return [accounts[groupIndex]];
|
|
26
|
+
}
|
|
27
|
+
// For now, we don't allow for gap, so if we need to create a new
|
|
28
|
+
// account, this has to be the next one.
|
|
29
|
+
if (groupIndex !== accounts.length) {
|
|
30
|
+
throw new Error('Trying to create too many accounts');
|
|
31
|
+
}
|
|
32
|
+
// Create next account (and returns their addresses).
|
|
33
|
+
return await keyring.addAccounts(1);
|
|
34
|
+
});
|
|
35
|
+
const account = this.messenger.call('AccountsController:getAccountByAddress', address);
|
|
36
|
+
// We MUST have the associated internal account.
|
|
37
|
+
assertInternalAccountExists(account);
|
|
38
|
+
assertIsBip44Account(account);
|
|
39
|
+
return [account];
|
|
40
|
+
}
|
|
41
|
+
async discoverAndCreateAccounts(_) {
|
|
42
|
+
return []; // TODO: Implement account discovery.
|
|
43
|
+
}
|
|
9
44
|
}
|
|
10
45
|
//# sourceMappingURL=EvmAccountProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmAccountProvider.mjs","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EvmAccountProvider.mjs","sourceRoot":"","sources":["../../src/providers/EvmAccountProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAO5D,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACpB,kCAA8B;AAE/B;;;;;GAKG;AACH,SAAS,2BAA2B,CAClC,OAAoC;IAEpC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;AACH,CAAC;AAED,MAAM,OAAO,kBAAmB,SAAQ,mBAAmB;IACzD,mBAAmB,CAAC,OAAsC;QACxD,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,GAAG;YACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAM,YAAY,CAAC,EAAa,CAC9D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,EACnB,aAAa,EACb,UAAU,GAIX;QACC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC,WAAW,CACtC,EAAE,EAAE,EAAE,aAAa,EAAE,EACrB,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YACpB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;YAC7C,IAAI,UAAU,GAAG,QAAQ,CAAC,MAAM,EAAE;gBAChC,oEAAoE;gBACpE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;aAC/B;YAED,iEAAiE;YACjE,wCAAwC;YACxC,IAAI,UAAU,KAAK,QAAQ,CAAC,MAAM,EAAE;gBAClC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;aACvD;YAED,qDAAqD;YACrD,OAAO,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC,CACF,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CACjC,wCAAwC,EACxC,OAAO,CACR,CAAC;QAEF,gDAAgD;QAChD,2BAA2B,CAAC,OAAO,CAAC,CAAC;QACrC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE9B,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,CAG/B;QACC,OAAO,EAAE,CAAC,CAAC,qCAAqC;IAClD,CAAC;CACF","sourcesContent":["import type { Bip44Account } from '@metamask/account-api';\nimport type { EntropySourceId } from '@metamask/keyring-api';\nimport { EthAccountType } from '@metamask/keyring-api';\nimport { KeyringTypes } from '@metamask/keyring-controller';\nimport type {\n EthKeyring,\n InternalAccount,\n} from '@metamask/keyring-internal-api';\nimport type { Hex } from '@metamask/utils';\n\nimport {\n assertIsBip44Account,\n BaseAccountProvider,\n} from './BaseAccountProvider';\n\n/**\n * Asserts an internal account exists.\n *\n * @param account - The internal account to check.\n * @throws An error if the internal account does not exist.\n */\nfunction assertInternalAccountExists(\n account: InternalAccount | undefined,\n): asserts account is InternalAccount {\n if (!account) {\n throw new Error('Internal account does not exist');\n }\n}\n\nexport class EvmAccountProvider extends BaseAccountProvider {\n isAccountCompatible(account: Bip44Account<InternalAccount>): boolean {\n return (\n account.type === EthAccountType.Eoa &&\n account.metadata.keyring.type === (KeyringTypes.hd as string)\n );\n }\n\n async createAccounts({\n entropySource,\n groupIndex,\n }: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) {\n const [address] = await this.withKeyring<EthKeyring, Hex[]>(\n { id: entropySource },\n async ({ keyring }) => {\n const accounts = await keyring.getAccounts();\n if (groupIndex < accounts.length) {\n // Nothing new to create, we just re-use the existing accounts here,\n return [accounts[groupIndex]];\n }\n\n // For now, we don't allow for gap, so if we need to create a new\n // account, this has to be the next one.\n if (groupIndex !== accounts.length) {\n throw new Error('Trying to create too many accounts');\n }\n\n // Create next account (and returns their addresses).\n return await keyring.addAccounts(1);\n },\n );\n\n const account = this.messenger.call(\n 'AccountsController:getAccountByAddress',\n address,\n );\n\n // We MUST have the associated internal account.\n assertInternalAccountExists(account);\n assertIsBip44Account(account);\n\n return [account];\n }\n\n async discoverAndCreateAccounts(_: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) {\n return []; // TODO: Implement account discovery.\n }\n}\n"]}
|
|
@@ -9,6 +9,41 @@ class SolAccountProvider extends BaseAccountProvider_1.BaseAccountProvider {
|
|
|
9
9
|
return (account.type === keyring_api_1.SolAccountType.DataAccount &&
|
|
10
10
|
account.metadata.keyring.type === keyring_controller_1.KeyringTypes.snap);
|
|
11
11
|
}
|
|
12
|
+
async createAccounts({ entropySource, groupIndex, }) {
|
|
13
|
+
// NOTE: We're not supposed to make the keyring instance escape `withKeyring` but
|
|
14
|
+
// we have to use the `SnapKeyring` instance to be able to create Solana account
|
|
15
|
+
// without triggering UI confirmation.
|
|
16
|
+
// Also, creating account that way won't invalidate the Snap keyring state. The
|
|
17
|
+
// account will get created and persisted properly with the Snap account creation
|
|
18
|
+
// flow "asynchronously" (with `notify:accountCreated`).
|
|
19
|
+
const createAccount = await this.withKeyring({ type: keyring_controller_1.KeyringTypes.snap }, async ({ keyring }) => keyring.createAccount.bind(keyring));
|
|
20
|
+
// Create account without any confirmation nor selecting it.
|
|
21
|
+
// TODO: Use the new keyring API `createAccounts` method with the "bip-44:derive-index"
|
|
22
|
+
// type once ready.
|
|
23
|
+
const derivationPath = `m/44'/501'/${groupIndex}'/0'`;
|
|
24
|
+
const account = await createAccount(SolAccountProvider.SOLANA_SNAP_ID, {
|
|
25
|
+
entropySource,
|
|
26
|
+
derivationPath,
|
|
27
|
+
}, {
|
|
28
|
+
displayAccountNameSuggestion: false,
|
|
29
|
+
displayConfirmation: false,
|
|
30
|
+
setSelectedAccount: false,
|
|
31
|
+
});
|
|
32
|
+
// Solana Snap does not use BIP-44 typed options for the moment
|
|
33
|
+
// so we "inject" them (the `AccountsController` does a similar thing
|
|
34
|
+
// for the moment).
|
|
35
|
+
account.options.entropy = {
|
|
36
|
+
type: keyring_api_1.KeyringAccountEntropyTypeOption.Mnemonic,
|
|
37
|
+
id: entropySource,
|
|
38
|
+
groupIndex,
|
|
39
|
+
derivationPath,
|
|
40
|
+
};
|
|
41
|
+
(0, BaseAccountProvider_1.assertIsBip44Account)(account);
|
|
42
|
+
return [account];
|
|
43
|
+
}
|
|
44
|
+
async discoverAndCreateAccounts(_) {
|
|
45
|
+
return []; // TODO: Implement account discovery.
|
|
46
|
+
}
|
|
12
47
|
}
|
|
13
48
|
exports.SolAccountProvider = SolAccountProvider;
|
|
14
49
|
SolAccountProvider.SOLANA_SNAP_ID = 'npm:@metamask/solana-wallet-snap';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SolAccountProvider.cjs","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":";;;AAGA,uDAG+B;AAC/B,qEAA4D;AAI5D,mEAG+B;AAE/B,MAAa,kBAAmB,SAAQ,yCAAmB;IAGzD,mBAAmB,CAAC,OAAsC;QACxD,OAAO,CACL,OAAO,CAAC,IAAI,KAAK,4BAAc,CAAC,WAAW;YAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAM,iCAAY,CAAC,IAAe,CAChE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,EACnB,aAAa,EACb,UAAU,GAIX;QACC,iFAAiF;QACjF,gFAAgF;QAChF,sCAAsC;QACtC,+EAA+E;QAC/E,iFAAiF;QACjF,wDAAwD;QACxD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,WAAW,CAG1C,EAAE,IAAI,EAAE,iCAAY,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CACnD,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CACpC,CAAC;QAEF,4DAA4D;QAC5D,uFAAuF;QACvF,mBAAmB;QACnB,MAAM,cAAc,GAAG,cAAc,UAAU,MAAM,CAAC;QACtD,MAAM,OAAO,GAAG,MAAM,aAAa,CACjC,kBAAkB,CAAC,cAAc,EACjC;YACE,aAAa;YACb,cAAc;SACf,EACD;YACE,4BAA4B,EAAE,KAAK;YACnC,mBAAmB,EAAE,KAAK;YAC1B,kBAAkB,EAAE,KAAK;SAC1B,CACF,CAAC;QAEF,+DAA+D;QAC/D,qEAAqE;QACrE,mBAAmB;QACnB,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG;YACxB,IAAI,EAAE,6CAA+B,CAAC,QAAQ;YAC9C,EAAE,EAAE,aAAa;YACjB,UAAU;YACV,cAAc;SACf,CAAC;QAEF,IAAA,0CAAoB,EAAC,OAAO,CAAC,CAAC;QAE9B,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,CAG/B;QACC,OAAO,EAAE,CAAC,CAAC,qCAAqC;IAClD,CAAC;;AAnEH,gDAoEC;AAnEQ,iCAAc,GAAG,kCAA4C,CAAC","sourcesContent":["import { type Bip44Account } from '@metamask/account-api';\nimport type { SnapKeyring } from '@metamask/eth-snap-keyring';\nimport type { EntropySourceId } 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 type { SnapId } from '@metamask/snaps-sdk';\n\nimport {\n assertIsBip44Account,\n BaseAccountProvider,\n} from './BaseAccountProvider';\n\nexport class SolAccountProvider extends BaseAccountProvider {\n static SOLANA_SNAP_ID = 'npm:@metamask/solana-wallet-snap' as SnapId;\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 }) {\n // NOTE: We're not supposed to make the keyring instance escape `withKeyring` but\n // we have to use the `SnapKeyring` instance to be able to create Solana account\n // without triggering UI confirmation.\n // Also, creating account that way won't invalidate the Snap keyring state. The\n // account will get created and persisted properly with the Snap account creation\n // flow \"asynchronously\" (with `notify:accountCreated`).\n const createAccount = await this.withKeyring<\n SnapKeyring,\n SnapKeyring['createAccount']\n >({ type: KeyringTypes.snap }, async ({ keyring }) =>\n keyring.createAccount.bind(keyring),\n );\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 SolAccountProvider.SOLANA_SNAP_ID,\n {\n entropySource,\n derivationPath,\n },\n {\n displayAccountNameSuggestion: false,\n displayConfirmation: false,\n setSelectedAccount: false,\n },\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 assertIsBip44Account(account);\n\n return [account];\n }\n\n async discoverAndCreateAccounts(_: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) {\n return []; // TODO: Implement account discovery.\n }\n}\n"]}
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Bip44Account } from "@metamask/account-api";
|
|
2
|
+
import type { EntropySourceId } from "@metamask/keyring-api";
|
|
2
3
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
3
4
|
import type { SnapId } from "@metamask/snaps-sdk";
|
|
4
5
|
import { BaseAccountProvider } from "./BaseAccountProvider.cjs";
|
|
5
6
|
export declare class SolAccountProvider extends BaseAccountProvider {
|
|
6
7
|
static SOLANA_SNAP_ID: SnapId;
|
|
7
8
|
isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
9
|
+
createAccounts({ entropySource, groupIndex, }: {
|
|
10
|
+
entropySource: EntropySourceId;
|
|
11
|
+
groupIndex: number;
|
|
12
|
+
}): Promise<Bip44Account<{
|
|
13
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account";
|
|
14
|
+
id: string;
|
|
15
|
+
options: Record<string, import("@metamask/snaps-sdk").Json> & {
|
|
16
|
+
entropy?: {
|
|
17
|
+
type: "mnemonic";
|
|
18
|
+
id: string;
|
|
19
|
+
derivationPath: string;
|
|
20
|
+
groupIndex: number;
|
|
21
|
+
} | {
|
|
22
|
+
type: "private-key";
|
|
23
|
+
} | undefined;
|
|
24
|
+
exportable?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
address: string;
|
|
27
|
+
scopes: `${string}:${string}`[];
|
|
28
|
+
methods: string[];
|
|
29
|
+
}>[]>;
|
|
30
|
+
discoverAndCreateAccounts(_: {
|
|
31
|
+
entropySource: EntropySourceId;
|
|
32
|
+
groupIndex: number;
|
|
33
|
+
}): Promise<never[]>;
|
|
8
34
|
}
|
|
9
35
|
//# sourceMappingURL=SolAccountProvider.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SolAccountProvider.d.cts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8B;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAM7D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAElD,OAAO,EAEL,mBAAmB,EACpB,kCAA8B;AAE/B,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,MAAM,CAAC,cAAc,SAAgD;IAErE,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;;;;;;;;;;;;;;;;;;IA8CK,yBAAyB,CAAC,CAAC,EAAE;QACjC,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB;CAGF"}
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Bip44Account } from "@metamask/account-api";
|
|
2
|
+
import type { EntropySourceId } from "@metamask/keyring-api";
|
|
2
3
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
3
4
|
import type { SnapId } from "@metamask/snaps-sdk";
|
|
4
5
|
import { BaseAccountProvider } from "./BaseAccountProvider.mjs";
|
|
5
6
|
export declare class SolAccountProvider extends BaseAccountProvider {
|
|
6
7
|
static SOLANA_SNAP_ID: SnapId;
|
|
7
8
|
isAccountCompatible(account: Bip44Account<InternalAccount>): boolean;
|
|
9
|
+
createAccounts({ entropySource, groupIndex, }: {
|
|
10
|
+
entropySource: EntropySourceId;
|
|
11
|
+
groupIndex: number;
|
|
12
|
+
}): Promise<Bip44Account<{
|
|
13
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "any:account";
|
|
14
|
+
id: string;
|
|
15
|
+
options: Record<string, import("@metamask/snaps-sdk").Json> & {
|
|
16
|
+
entropy?: {
|
|
17
|
+
type: "mnemonic";
|
|
18
|
+
id: string;
|
|
19
|
+
derivationPath: string;
|
|
20
|
+
groupIndex: number;
|
|
21
|
+
} | {
|
|
22
|
+
type: "private-key";
|
|
23
|
+
} | undefined;
|
|
24
|
+
exportable?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
address: string;
|
|
27
|
+
scopes: `${string}:${string}`[];
|
|
28
|
+
methods: string[];
|
|
29
|
+
}>[]>;
|
|
30
|
+
discoverAndCreateAccounts(_: {
|
|
31
|
+
entropySource: EntropySourceId;
|
|
32
|
+
groupIndex: number;
|
|
33
|
+
}): Promise<never[]>;
|
|
8
34
|
}
|
|
9
35
|
//# sourceMappingURL=SolAccountProvider.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SolAccountProvider.d.mts","sourceRoot":"","sources":["../../src/providers/SolAccountProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,8BAA8B;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAM7D,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAElD,OAAO,EAEL,mBAAmB,EACpB,kCAA8B;AAE/B,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,MAAM,CAAC,cAAc,SAAgD;IAErE,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;;;;;;;;;;;;;;;;;;IA8CK,yBAAyB,CAAC,CAAC,EAAE;QACjC,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB;CAGF"}
|