-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathprovider.ts
More file actions
57 lines (52 loc) · 1.48 KB
/
Copy pathprovider.ts
File metadata and controls
57 lines (52 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';
export enum AccountProviderType {
Evm = 'Evm',
Solana = 'Solana',
Btc = 'Btc',
}
/**
* An account provider is reponsible of providing accounts to an account group.
*/
export type AccountProvider<Account extends KeyringAccount> = {
/**
* The type of the provider.
*/
providerType: AccountProviderType;
/**
* Gets an account for a given ID.
*
* @returns An account, or undefined if not found.
*/
getAccount: (id: Account['id']) => Account | undefined;
/**
* Gets all accounts for this provider.
*
* @returns A list of all account for this provider.
*/
getAccounts: () => Account[];
/**
* Creates accounts for a given entropy source and a given group
* index.
*
* @param options - Options.
* @param options.entropySource - Entropy source to use.
* @param options.groupIndex - Group index to use.
* @returns The list of created accounts.
*/
createAccounts: (options: {
entropySource: EntropySourceId;
groupIndex: number;
}) => Promise<Account[]>;
/**
* Discover accounts for a given entropy source.
*
* NOTE: This method needs to also create the discovered accounts.
*
* @param options - Options.
* @param options.entropySource - Entropy source to use.
* @returns The list of discovered and created accounts.
*/
discoverAndCreateAccounts: (options: {
entropySource: EntropySourceId;
}) => Promise<Account[]>;
};