-
Notifications
You must be signed in to change notification settings - Fork 542
/
index.ts
49 lines (45 loc) · 1.68 KB
/
index.ts
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
import { PermissionConstraint } from '@metamask/controllers';
import { Json } from '@metamask/utils';
import {
cronjobCaveatSpecifications,
cronjobEndowmentBuilder,
getCronjobCaveatMapper,
} from './cronjob';
import { longRunningEndowmentBuilder } from './long-running';
import { networkAccessEndowmentBuilder } from './network-access';
import {
getTransactionInsightCaveatMapper,
transactionInsightCaveatSpecifications,
transactionInsightEndowmentBuilder,
} from './transaction-insight';
import {
keyringEndowmentBuilder,
keyringCaveatSpecifications,
getKeyringCaveatMapper,
} from './keyring';
import { ethereumProviderEndowmentBuilder } from './ethereum-provider';
export const endowmentPermissionBuilders = {
[networkAccessEndowmentBuilder.targetKey]: networkAccessEndowmentBuilder,
[longRunningEndowmentBuilder.targetKey]: longRunningEndowmentBuilder,
[transactionInsightEndowmentBuilder.targetKey]:
transactionInsightEndowmentBuilder,
[keyringEndowmentBuilder.targetKey]: keyringEndowmentBuilder,
[cronjobEndowmentBuilder.targetKey]: cronjobEndowmentBuilder,
[ethereumProviderEndowmentBuilder.targetKey]:
ethereumProviderEndowmentBuilder,
} as const;
export const endowmentCaveatSpecifications = {
...keyringCaveatSpecifications,
...cronjobCaveatSpecifications,
...transactionInsightCaveatSpecifications,
};
export const endowmentCaveatMappers: Record<
string,
(value: Json) => Pick<PermissionConstraint, 'caveats'>
> = {
[keyringEndowmentBuilder.targetKey]: getKeyringCaveatMapper,
[cronjobEndowmentBuilder.targetKey]: getCronjobCaveatMapper,
[transactionInsightEndowmentBuilder.targetKey]:
getTransactionInsightCaveatMapper,
};
export * from './enum';