@metamask/snaps-utils 3.3.0 → 4.0.0
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 +29 -1
- package/dist/cjs/auxiliary-files.js +6 -19
- package/dist/cjs/auxiliary-files.js.map +1 -1
- package/dist/cjs/checksum.js +22 -5
- package/dist/cjs/checksum.js.map +1 -1
- package/dist/cjs/cronjob.js.map +1 -1
- package/dist/cjs/enum.js.map +1 -1
- package/dist/cjs/errors.js +6 -154
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/handlers.js +6 -13
- package/dist/cjs/handlers.js.map +1 -1
- package/dist/cjs/index.browser.js +1 -0
- package/dist/cjs/index.browser.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/localization.js +2 -2
- package/dist/cjs/localization.js.map +1 -1
- package/dist/cjs/manifest/manifest.js +11 -11
- package/dist/cjs/manifest/manifest.js.map +1 -1
- package/dist/cjs/manifest/validation.js.map +1 -1
- package/dist/cjs/namespace.js +5 -1
- package/dist/cjs/namespace.js.map +1 -1
- package/dist/cjs/npm.js +2 -2
- package/dist/cjs/npm.js.map +1 -1
- package/dist/cjs/snaps.js +7 -6
- package/dist/cjs/snaps.js.map +1 -1
- package/dist/cjs/structs.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/ui.js +51 -0
- package/dist/cjs/ui.js.map +1 -0
- package/dist/cjs/validation.js +2 -2
- package/dist/cjs/validation.js.map +1 -1
- package/dist/esm/auxiliary-files.js +1 -6
- package/dist/esm/auxiliary-files.js.map +1 -1
- package/dist/esm/checksum.js +25 -6
- package/dist/esm/checksum.js.map +1 -1
- package/dist/esm/cronjob.js +1 -1
- package/dist/esm/cronjob.js.map +1 -1
- package/dist/esm/enum.js.map +1 -1
- package/dist/esm/errors.js +2 -157
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/handlers.js +4 -8
- package/dist/esm/handlers.js.map +1 -1
- package/dist/esm/index.browser.js +1 -0
- package/dist/esm/index.browser.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/localization.js +1 -1
- package/dist/esm/localization.js.map +1 -1
- package/dist/esm/manifest/manifest.js +8 -8
- package/dist/esm/manifest/manifest.js.map +1 -1
- package/dist/esm/manifest/validation.js.map +1 -1
- package/dist/esm/namespace.js +3 -2
- package/dist/esm/namespace.js.map +1 -1
- package/dist/esm/npm.js +2 -2
- package/dist/esm/npm.js.map +1 -1
- package/dist/esm/snaps.js +7 -6
- package/dist/esm/snaps.js.map +1 -1
- package/dist/esm/structs.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/ui.js +48 -0
- package/dist/esm/ui.js.map +1 -0
- package/dist/esm/validation.js +2 -2
- package/dist/esm/validation.js.map +1 -1
- package/dist/types/auxiliary-files.d.ts +1 -5
- package/dist/types/checksum.d.ts +9 -2
- package/dist/types/enum.d.ts +1 -21
- package/dist/types/errors.d.ts +1 -109
- package/dist/types/handlers.d.ts +48 -173
- package/dist/types/index.browser.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/localization.d.ts +22 -22
- package/dist/types/manifest/manifest.d.ts +2 -2
- package/dist/types/manifest/validation.d.ts +80 -78
- package/dist/types/namespace.d.ts +11 -10
- package/dist/types/npm.d.ts +1 -1
- package/dist/types/snaps.d.ts +8 -43
- package/dist/types/structs.d.ts +23 -0
- package/dist/types/types.d.ts +0 -1
- package/dist/types/ui.d.ts +20 -0
- package/dist/types/validation.d.ts +1 -1
- package/package.json +3 -3
package/dist/types/handlers.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { OnCronjobHandler, OnHomePageHandler, OnKeyringRequestHandler, OnNameLookupHandler, OnRpcRequestHandler, OnTransactionHandler } from '@metamask/snaps-sdk';
|
|
2
|
+
import { SeverityLevel } from '@metamask/snaps-sdk';
|
|
3
3
|
import type { SnapHandler } from './handler-types';
|
|
4
4
|
import { HandlerType } from './handler-types';
|
|
5
|
-
import type { AccountAddress, Caip2ChainId } from './namespace';
|
|
6
5
|
export declare type SnapRpcHookArgs = {
|
|
7
6
|
origin: string;
|
|
8
7
|
handler: HandlerType;
|
|
@@ -12,7 +11,7 @@ export declare const SNAP_EXPORTS: {
|
|
|
12
11
|
readonly onRpcRequest: {
|
|
13
12
|
readonly type: HandlerType.OnRpcRequest;
|
|
14
13
|
readonly required: true;
|
|
15
|
-
readonly validator: (snapExport: unknown) => snapExport is OnRpcRequestHandler<JsonRpcParams>;
|
|
14
|
+
readonly validator: (snapExport: unknown) => snapExport is OnRpcRequestHandler<import("@metamask/snaps-sdk").JsonRpcParams>;
|
|
16
15
|
};
|
|
17
16
|
readonly onTransaction: {
|
|
18
17
|
readonly type: HandlerType.OnTransaction;
|
|
@@ -22,7 +21,7 @@ export declare const SNAP_EXPORTS: {
|
|
|
22
21
|
readonly onCronjob: {
|
|
23
22
|
readonly type: HandlerType.OnCronjob;
|
|
24
23
|
readonly required: true;
|
|
25
|
-
readonly validator: (snapExport: unknown) => snapExport is OnCronjobHandler<JsonRpcParams>;
|
|
24
|
+
readonly validator: (snapExport: unknown) => snapExport is OnCronjobHandler<import("@metamask/snaps-sdk").JsonRpcParams>;
|
|
26
25
|
};
|
|
27
26
|
readonly onNameLookup: {
|
|
28
27
|
readonly type: HandlerType.OnNameLookup;
|
|
@@ -32,17 +31,17 @@ export declare const SNAP_EXPORTS: {
|
|
|
32
31
|
readonly onInstall: {
|
|
33
32
|
readonly type: HandlerType.OnInstall;
|
|
34
33
|
readonly required: false;
|
|
35
|
-
readonly validator: (snapExport: unknown) => snapExport is LifecycleEventHandler;
|
|
34
|
+
readonly validator: (snapExport: unknown) => snapExport is import("@metamask/snaps-sdk").LifecycleEventHandler;
|
|
36
35
|
};
|
|
37
36
|
readonly onUpdate: {
|
|
38
37
|
readonly type: HandlerType.OnUpdate;
|
|
39
38
|
readonly required: false;
|
|
40
|
-
readonly validator: (snapExport: unknown) => snapExport is LifecycleEventHandler;
|
|
39
|
+
readonly validator: (snapExport: unknown) => snapExport is import("@metamask/snaps-sdk").LifecycleEventHandler;
|
|
41
40
|
};
|
|
42
41
|
readonly onKeyringRequest: {
|
|
43
42
|
readonly type: HandlerType.OnKeyringRequest;
|
|
44
43
|
readonly required: true;
|
|
45
|
-
readonly validator: (snapExport: unknown) => snapExport is OnKeyringRequestHandler<JsonRpcParams>;
|
|
44
|
+
readonly validator: (snapExport: unknown) => snapExport is OnKeyringRequestHandler<import("@metamask/snaps-sdk").JsonRpcParams>;
|
|
46
45
|
};
|
|
47
46
|
readonly onHomePage: {
|
|
48
47
|
readonly type: HandlerType.OnHomePage;
|
|
@@ -50,218 +49,94 @@ export declare const SNAP_EXPORTS: {
|
|
|
50
49
|
readonly validator: (snapExport: unknown) => snapExport is OnHomePageHandler;
|
|
51
50
|
};
|
|
52
51
|
};
|
|
53
|
-
/**
|
|
54
|
-
* The `onRpcRequest` handler. This is called whenever a JSON-RPC request is
|
|
55
|
-
* made to the snap.
|
|
56
|
-
*
|
|
57
|
-
* @param args - The request arguments.
|
|
58
|
-
* @param args.origin - The origin of the request. This can be the ID of another
|
|
59
|
-
* snap, or the URL of a dapp.
|
|
60
|
-
* @param args.request - The JSON-RPC request sent to the snap.
|
|
61
|
-
* @returns The JSON-RPC response. This must be a JSON-serializable value.
|
|
62
|
-
*/
|
|
63
|
-
export declare type OnRpcRequestHandler<Params extends JsonRpcParams = JsonRpcParams> = (args: {
|
|
64
|
-
origin: string;
|
|
65
|
-
request: JsonRpcRequest<Params>;
|
|
66
|
-
}) => Promise<unknown>;
|
|
67
|
-
/**
|
|
68
|
-
* Enum used to specify the severity level of content being returned from a transaction insight.
|
|
69
|
-
*/
|
|
70
|
-
export declare enum SeverityLevel {
|
|
71
|
-
Critical = "critical"
|
|
72
|
-
}
|
|
73
52
|
export declare const OnTransactionResponseStruct: import("superstruct").Struct<{
|
|
74
|
-
content: import("@metamask/snaps-
|
|
53
|
+
content: import("@metamask/snaps-sdk").Panel | {
|
|
75
54
|
value: string;
|
|
76
|
-
type: import("@metamask/snaps-
|
|
55
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
56
|
+
sensitive?: boolean | undefined;
|
|
77
57
|
} | {
|
|
78
|
-
type: import("@metamask/snaps-
|
|
58
|
+
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
79
59
|
} | {
|
|
80
60
|
value: string;
|
|
81
|
-
type: import("@metamask/snaps-
|
|
82
|
-
} | {
|
|
83
|
-
type: import("@metamask/snaps-ui").NodeType.Spinner;
|
|
61
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
84
62
|
} | {
|
|
85
63
|
value: string;
|
|
86
|
-
type: import("@metamask/snaps-
|
|
87
|
-
|
|
64
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
65
|
+
} | {
|
|
66
|
+
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
88
67
|
} | {
|
|
89
68
|
value: string;
|
|
90
|
-
type: import("@metamask/snaps-
|
|
69
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
70
|
+
markdown?: boolean | undefined;
|
|
91
71
|
};
|
|
92
72
|
severity?: SeverityLevel | undefined;
|
|
93
|
-
}, {
|
|
94
|
-
content: import("superstruct").Struct<import("@metamask/snaps-
|
|
73
|
+
} | null, {
|
|
74
|
+
content: import("superstruct").Struct<import("@metamask/snaps-sdk").Panel | {
|
|
95
75
|
value: string;
|
|
96
|
-
type: import("@metamask/snaps-
|
|
76
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
77
|
+
sensitive?: boolean | undefined;
|
|
97
78
|
} | {
|
|
98
|
-
type: import("@metamask/snaps-
|
|
79
|
+
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
99
80
|
} | {
|
|
100
81
|
value: string;
|
|
101
|
-
type: import("@metamask/snaps-
|
|
102
|
-
} | {
|
|
103
|
-
type: import("@metamask/snaps-ui").NodeType.Spinner;
|
|
82
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
104
83
|
} | {
|
|
105
84
|
value: string;
|
|
106
|
-
type: import("@metamask/snaps-
|
|
107
|
-
|
|
85
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
86
|
+
} | {
|
|
87
|
+
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
108
88
|
} | {
|
|
109
89
|
value: string;
|
|
110
|
-
type: import("@metamask/snaps-
|
|
90
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
91
|
+
markdown?: boolean | undefined;
|
|
111
92
|
}, null>;
|
|
112
93
|
severity: import("superstruct").Struct<SeverityLevel | undefined, SeverityLevel>;
|
|
113
94
|
}>;
|
|
114
|
-
/**
|
|
115
|
-
* The response from a snap's `onTransaction` handler.
|
|
116
|
-
*
|
|
117
|
-
* @property content - A custom UI component, that will be shown in MetaMask. Can be created using `@metamask/snaps-ui`.
|
|
118
|
-
*
|
|
119
|
-
* If the snap has no insights about the transaction, this should be `null`.
|
|
120
|
-
*/
|
|
121
|
-
export declare type OnTransactionResponse = Infer<typeof OnTransactionResponseStruct>;
|
|
122
|
-
/**
|
|
123
|
-
* The `onTransaction` handler. This is called whenever a transaction is
|
|
124
|
-
* submitted to the snap. It can return insights about the transaction, which
|
|
125
|
-
* will be displayed to the user.
|
|
126
|
-
*
|
|
127
|
-
* @param args - The request arguments.
|
|
128
|
-
* @param args.transaction - The transaction object.
|
|
129
|
-
* @param args.chainId - The CAIP-2 chain ID of the network the transaction is
|
|
130
|
-
* being submitted to.
|
|
131
|
-
* @param args.transactionOrigin - The origin of the transaction. This is the
|
|
132
|
-
* URL of the dapp that submitted the transaction.
|
|
133
|
-
* @returns Insights about the transaction. See {@link OnTransactionResponse}.
|
|
134
|
-
*/
|
|
135
|
-
export declare type OnTransactionHandler = (args: {
|
|
136
|
-
transaction: {
|
|
137
|
-
[key: string]: Json;
|
|
138
|
-
};
|
|
139
|
-
chainId: string;
|
|
140
|
-
transactionOrigin?: string;
|
|
141
|
-
}) => Promise<OnTransactionResponse>;
|
|
142
|
-
/**
|
|
143
|
-
* The `onCronjob` handler. This is called on a regular interval, as defined by
|
|
144
|
-
* the snap's manifest.
|
|
145
|
-
*
|
|
146
|
-
* @param args - The request arguments.
|
|
147
|
-
* @param args.request - The JSON-RPC request sent to the snap.
|
|
148
|
-
*/
|
|
149
|
-
export declare type OnCronjobHandler<Params extends JsonRpcParams = JsonRpcParams> = (args: {
|
|
150
|
-
request: JsonRpcRequest<Params>;
|
|
151
|
-
}) => Promise<unknown>;
|
|
152
|
-
/**
|
|
153
|
-
* A handler that can be used for the lifecycle hooks.
|
|
154
|
-
*/
|
|
155
|
-
export declare type LifecycleEventHandler = (args: {
|
|
156
|
-
request: JsonRpcRequest;
|
|
157
|
-
}) => Promise<unknown>;
|
|
158
|
-
/**
|
|
159
|
-
* The `onInstall` handler. This is called after the snap is installed.
|
|
160
|
-
*
|
|
161
|
-
* This type is an alias for {@link LifecycleEventHandler}.
|
|
162
|
-
*/
|
|
163
|
-
export declare type OnInstallHandler = LifecycleEventHandler;
|
|
164
|
-
/**
|
|
165
|
-
* The `onUpdate` handler. This is called after the snap is updated.
|
|
166
|
-
*
|
|
167
|
-
* This type is an alias for {@link LifecycleEventHandler}.
|
|
168
|
-
*/
|
|
169
|
-
export declare type OnUpdateHandler = LifecycleEventHandler;
|
|
170
|
-
/**
|
|
171
|
-
* The `onKeyringRequest` handler. This is called by the MetaMask client for
|
|
172
|
-
* privileged keyring actions.
|
|
173
|
-
*
|
|
174
|
-
* @param args - The request arguments.
|
|
175
|
-
* @param args.origin - The origin of the request. This can be the ID of
|
|
176
|
-
* another snap, or the URL of a dapp.
|
|
177
|
-
* @param args.request - The JSON-RPC request sent to the snap.
|
|
178
|
-
*/
|
|
179
|
-
export declare type OnKeyringRequestHandler<Params extends JsonRpcParams = JsonRpcParams> = (args: {
|
|
180
|
-
origin: string;
|
|
181
|
-
request: JsonRpcRequest<Params>;
|
|
182
|
-
}) => Promise<unknown>;
|
|
183
|
-
export declare type OnHomePageHandler = () => Promise<OnHomePageResponse>;
|
|
184
95
|
export declare const OnHomePageResponseStruct: import("superstruct").Struct<{
|
|
185
|
-
content: import("@metamask/snaps-
|
|
96
|
+
content: import("@metamask/snaps-sdk").Panel | {
|
|
186
97
|
value: string;
|
|
187
|
-
type: import("@metamask/snaps-
|
|
98
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
99
|
+
sensitive?: boolean | undefined;
|
|
188
100
|
} | {
|
|
189
|
-
type: import("@metamask/snaps-
|
|
101
|
+
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
190
102
|
} | {
|
|
191
103
|
value: string;
|
|
192
|
-
type: import("@metamask/snaps-
|
|
193
|
-
} | {
|
|
194
|
-
type: import("@metamask/snaps-ui").NodeType.Spinner;
|
|
104
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
195
105
|
} | {
|
|
196
106
|
value: string;
|
|
197
|
-
type: import("@metamask/snaps-
|
|
198
|
-
|
|
107
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
108
|
+
} | {
|
|
109
|
+
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
199
110
|
} | {
|
|
200
111
|
value: string;
|
|
201
|
-
type: import("@metamask/snaps-
|
|
112
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
113
|
+
markdown?: boolean | undefined;
|
|
202
114
|
};
|
|
203
115
|
}, {
|
|
204
|
-
content: import("superstruct").Struct<import("@metamask/snaps-
|
|
116
|
+
content: import("superstruct").Struct<import("@metamask/snaps-sdk").Panel | {
|
|
205
117
|
value: string;
|
|
206
|
-
type: import("@metamask/snaps-
|
|
118
|
+
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
119
|
+
sensitive?: boolean | undefined;
|
|
207
120
|
} | {
|
|
208
|
-
type: import("@metamask/snaps-
|
|
121
|
+
type: import("@metamask/snaps-sdk").NodeType.Divider;
|
|
209
122
|
} | {
|
|
210
123
|
value: string;
|
|
211
|
-
type: import("@metamask/snaps-
|
|
212
|
-
} | {
|
|
213
|
-
type: import("@metamask/snaps-ui").NodeType.Spinner;
|
|
124
|
+
type: import("@metamask/snaps-sdk").NodeType.Heading;
|
|
214
125
|
} | {
|
|
215
126
|
value: string;
|
|
216
|
-
type: import("@metamask/snaps-
|
|
217
|
-
|
|
127
|
+
type: import("@metamask/snaps-sdk").NodeType.Image;
|
|
128
|
+
} | {
|
|
129
|
+
type: import("@metamask/snaps-sdk").NodeType.Spinner;
|
|
218
130
|
} | {
|
|
219
131
|
value: string;
|
|
220
|
-
type: import("@metamask/snaps-
|
|
132
|
+
type: import("@metamask/snaps-sdk").NodeType.Text;
|
|
133
|
+
markdown?: boolean | undefined;
|
|
221
134
|
}, null>;
|
|
222
135
|
}>;
|
|
223
|
-
export declare type OnHomePageResponse = Infer<typeof OnHomePageResponseStruct>;
|
|
224
136
|
/**
|
|
225
137
|
* Utility type for getting the handler function type from a handler type.
|
|
226
138
|
*/
|
|
227
139
|
export declare type HandlerFunction<Type extends SnapHandler> = Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler ? Handler : never;
|
|
228
|
-
/**
|
|
229
|
-
* The response from a snap's `onNameLookup` handler.
|
|
230
|
-
*
|
|
231
|
-
* @property resolvedAddress - The resolved address for a given domain.
|
|
232
|
-
* @property resolvedDomain - The resolved domain for a given address.
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* If the snap has no resolved address/domain from its lookup, this should be `null`.
|
|
236
|
-
*/
|
|
237
|
-
export declare type OnNameLookupResponse = {
|
|
238
|
-
resolvedAddress: AccountAddress;
|
|
239
|
-
resolvedDomain?: never;
|
|
240
|
-
} | {
|
|
241
|
-
resolvedDomain: string;
|
|
242
|
-
resolvedAddress?: never;
|
|
243
|
-
} | null;
|
|
244
|
-
export declare type OnNameLookupArgs = {
|
|
245
|
-
chainId: Caip2ChainId;
|
|
246
|
-
} & ({
|
|
247
|
-
domain: string;
|
|
248
|
-
address?: never;
|
|
249
|
-
} | {
|
|
250
|
-
address: string;
|
|
251
|
-
domain?: never;
|
|
252
|
-
});
|
|
253
|
-
/**
|
|
254
|
-
* The `onNameLookup` handler. This is called whenever content is entered
|
|
255
|
-
* into the send to field for sending assets to an EOA address.
|
|
256
|
-
*
|
|
257
|
-
* @param args - The request arguments.
|
|
258
|
-
* @param args.domain - The human-readable address that is to be resolved.
|
|
259
|
-
* @param args.chainId - The CAIP-2 chain ID of the network the transaction is
|
|
260
|
-
* being submitted to.
|
|
261
|
-
* @param args.address - The address that is to be resolved.
|
|
262
|
-
* @returns Resolved address/domain from the lookup. See {@link OnNameLookupResponse}.
|
|
263
|
-
*/
|
|
264
|
-
export declare type OnNameLookupHandler = (args: OnNameLookupArgs) => Promise<OnNameLookupResponse>;
|
|
265
140
|
/**
|
|
266
141
|
* All the function-based handlers that a snap can implement.
|
|
267
142
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare function translate(value: string, file: LocalizationFile | undefi
|
|
|
64
64
|
*/
|
|
65
65
|
export declare function getLocalizedSnapManifest(snapManifest: SnapManifest, locale: string, localizationFiles: LocalizationFile[]): {
|
|
66
66
|
description: string;
|
|
67
|
+
version: import("@metamask/utils").SemVerVersion;
|
|
67
68
|
source: {
|
|
68
69
|
location: {
|
|
69
70
|
npm: {
|
|
@@ -77,9 +78,27 @@ export declare function getLocalizedSnapManifest(snapManifest: SnapManifest, loc
|
|
|
77
78
|
files?: string[] | undefined;
|
|
78
79
|
locales?: string[] | undefined;
|
|
79
80
|
};
|
|
80
|
-
version: import("@metamask/utils").SemVerVersion;
|
|
81
81
|
proposedName: string;
|
|
82
82
|
initialPermissions: {
|
|
83
|
+
snap_dialog?: {} | undefined;
|
|
84
|
+
snap_getBip32Entropy?: {
|
|
85
|
+
path: string[];
|
|
86
|
+
curve: "ed25519" | "secp256k1";
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
snap_getBip32PublicKey?: {
|
|
89
|
+
path: string[];
|
|
90
|
+
curve: "ed25519" | "secp256k1";
|
|
91
|
+
}[] | undefined;
|
|
92
|
+
snap_getBip44Entropy?: {
|
|
93
|
+
coinType: number;
|
|
94
|
+
}[] | undefined;
|
|
95
|
+
snap_getEntropy?: {} | undefined;
|
|
96
|
+
snap_manageAccounts?: {} | undefined;
|
|
97
|
+
snap_manageState?: {} | undefined;
|
|
98
|
+
snap_notify?: {} | undefined;
|
|
99
|
+
wallet_snap?: Record<string, {
|
|
100
|
+
version?: string | undefined;
|
|
101
|
+
}> | undefined;
|
|
83
102
|
'endowment:network-access'?: {} | undefined;
|
|
84
103
|
'endowment:webassembly'?: {} | undefined;
|
|
85
104
|
'endowment:transaction-insight'?: {
|
|
@@ -89,7 +108,7 @@ export declare function getLocalizedSnapManifest(snapManifest: SnapManifest, loc
|
|
|
89
108
|
jobs: {
|
|
90
109
|
request: {
|
|
91
110
|
method: string;
|
|
92
|
-
params?: Record<string, import("@metamask/
|
|
111
|
+
params?: Record<string, import("@metamask/snaps-sdk").Json> | import("@metamask/snaps-sdk").Json[] | undefined;
|
|
93
112
|
id?: string | number | null | undefined;
|
|
94
113
|
jsonrpc?: "2.0" | undefined;
|
|
95
114
|
};
|
|
@@ -101,30 +120,11 @@ export declare function getLocalizedSnapManifest(snapManifest: SnapManifest, loc
|
|
|
101
120
|
snaps?: boolean | undefined;
|
|
102
121
|
allowedOrigins?: string[] | undefined;
|
|
103
122
|
} | undefined;
|
|
104
|
-
'endowment:name-lookup'?: string[] | undefined;
|
|
123
|
+
'endowment:name-lookup'?: `${string}:${string}`[] | undefined;
|
|
105
124
|
'endowment:keyring'?: {
|
|
106
125
|
allowedOrigins?: string[] | undefined;
|
|
107
126
|
} | undefined;
|
|
108
|
-
snap_dialog?: {} | undefined;
|
|
109
127
|
snap_confirm?: {} | undefined;
|
|
110
|
-
snap_manageState?: {} | undefined;
|
|
111
|
-
snap_manageAccounts?: {} | undefined;
|
|
112
|
-
snap_notify?: {} | undefined;
|
|
113
|
-
snap_getBip32Entropy?: {
|
|
114
|
-
path: string[];
|
|
115
|
-
curve: "ed25519" | "secp256k1";
|
|
116
|
-
}[] | undefined;
|
|
117
|
-
snap_getBip32PublicKey?: {
|
|
118
|
-
path: string[];
|
|
119
|
-
curve: "ed25519" | "secp256k1";
|
|
120
|
-
}[] | undefined;
|
|
121
|
-
snap_getBip44Entropy?: {
|
|
122
|
-
coinType: number;
|
|
123
|
-
}[] | undefined;
|
|
124
|
-
snap_getEntropy?: {} | undefined;
|
|
125
|
-
wallet_snap?: Record<string, {
|
|
126
|
-
version?: string | undefined;
|
|
127
|
-
}> | undefined;
|
|
128
128
|
};
|
|
129
129
|
manifestVersion: "0.1";
|
|
130
130
|
repository?: {
|
|
@@ -46,7 +46,7 @@ export declare function checkManifest(basePath: string, writeManifest?: boolean,
|
|
|
46
46
|
* @param error - The {@link ProgrammaticallyFixableSnapError} that was thrown.
|
|
47
47
|
* @returns A copy of the manifest file where the cause of the error is fixed.
|
|
48
48
|
*/
|
|
49
|
-
export declare function fixManifest(snapFiles: SnapFiles, error: ProgrammaticallyFixableSnapError): VirtualFile<SnapManifest
|
|
49
|
+
export declare function fixManifest(snapFiles: SnapFiles, error: ProgrammaticallyFixableSnapError): Promise<VirtualFile<SnapManifest>>;
|
|
50
50
|
/**
|
|
51
51
|
* Given an unvalidated Snap manifest, attempts to extract the location of the
|
|
52
52
|
* bundle source file location and read the file.
|
|
@@ -103,4 +103,4 @@ export declare function getWritableManifest(manifest: SnapManifest): SnapManifes
|
|
|
103
103
|
* @param snapFiles.auxiliaryFiles - Any auxiliary files required by the snap at runtime.
|
|
104
104
|
* @param snapFiles.localizationFiles - The Snap's localization files.
|
|
105
105
|
*/
|
|
106
|
-
export declare function validateNpmSnapManifest({ manifest, packageJson, sourceCode, svgIcon, auxiliaryFiles, localizationFiles, }: SnapFiles): void
|
|
106
|
+
export declare function validateNpmSnapManifest({ manifest, packageJson, sourceCode, svgIcon, auxiliaryFiles, localizationFiles, }: SnapFiles): Promise<void>;
|