@metamask/snaps-rpc-methods 10.0.0 → 11.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/{chunk-SYUGPLEP.js → chunk-6XKVFSC2.js} +4 -4
  3. package/dist/chunk-6XKVFSC2.js.map +1 -0
  4. package/dist/{chunk-IZYMBIBD.mjs → chunk-AMMJ744B.mjs} +4 -4
  5. package/dist/chunk-AMMJ744B.mjs.map +1 -0
  6. package/dist/{chunk-HZQ34FQT.js → chunk-CDAVFOUS.js} +9 -5
  7. package/dist/chunk-CDAVFOUS.js.map +1 -0
  8. package/dist/chunk-FM4LNQR7.mjs +34 -0
  9. package/dist/chunk-FM4LNQR7.mjs.map +1 -0
  10. package/dist/{chunk-BSAXPL2T.mjs → chunk-GEJDXRTL.mjs} +3 -3
  11. package/dist/{chunk-FNUO7MQ4.mjs → chunk-K3UL5RVN.mjs} +5 -5
  12. package/dist/{chunk-6VJVURH5.js → chunk-LP3RWEDJ.js} +4 -4
  13. package/dist/{chunk-4TUORIA6.js → chunk-PK2RPAXI.js} +6 -6
  14. package/dist/chunk-RHPSYX7X.js +34 -0
  15. package/dist/chunk-RHPSYX7X.js.map +1 -0
  16. package/dist/{chunk-SYB5TG5O.mjs → chunk-V3KRSCUK.mjs} +10 -6
  17. package/dist/chunk-V3KRSCUK.mjs.map +1 -0
  18. package/dist/index.js +10 -9
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +9 -8
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/permissions.js +8 -7
  23. package/dist/permissions.mjs +7 -6
  24. package/dist/restricted/caveats/index.js +3 -3
  25. package/dist/restricted/caveats/index.mjs +2 -2
  26. package/dist/restricted/getLocale.js +2 -2
  27. package/dist/restricted/getLocale.mjs +1 -1
  28. package/dist/restricted/getPreferences.js +11 -0
  29. package/dist/restricted/getPreferences.js.map +1 -0
  30. package/dist/restricted/getPreferences.mjs +11 -0
  31. package/dist/restricted/getPreferences.mjs.map +1 -0
  32. package/dist/restricted/index.js +9 -8
  33. package/dist/restricted/index.mjs +8 -7
  34. package/dist/tsconfig.build.tsbuildinfo +1 -1
  35. package/dist/types/endowments/caveats/generic.d.ts +2 -2
  36. package/dist/types/endowments/rpc.d.ts +1 -1
  37. package/dist/types/permitted/createInterface.d.ts +16 -2
  38. package/dist/types/permitted/getAllSnaps.d.ts +1 -1
  39. package/dist/types/permitted/getClientStatus.d.ts +1 -1
  40. package/dist/types/permitted/getFile.d.ts +2 -2
  41. package/dist/types/permitted/getInterfaceState.d.ts +2 -2
  42. package/dist/types/permitted/getSnaps.d.ts +1 -1
  43. package/dist/types/permitted/index.d.ts +1 -1
  44. package/dist/types/permitted/invokeKeyring.d.ts +1 -1
  45. package/dist/types/permitted/invokeSnapSugar.d.ts +1 -1
  46. package/dist/types/permitted/requestSnaps.d.ts +1 -1
  47. package/dist/types/permitted/resolveInterface.d.ts +2 -2
  48. package/dist/types/permitted/updateInterface.d.ts +16 -2
  49. package/dist/types/restricted/dialog.d.ts +121 -9
  50. package/dist/types/restricted/getBip32Entropy.d.ts +2 -2
  51. package/dist/types/restricted/getBip32PublicKey.d.ts +2 -2
  52. package/dist/types/restricted/getBip44Entropy.d.ts +2 -2
  53. package/dist/types/restricted/getEntropy.d.ts +3 -3
  54. package/dist/types/restricted/getLocale.d.ts +8 -7
  55. package/dist/types/restricted/getPreferences.d.ts +48 -0
  56. package/dist/types/restricted/index.d.ts +15 -1
  57. package/dist/types/restricted/invokeSnap.d.ts +6 -6
  58. package/dist/types/restricted/manageAccounts.d.ts +4 -4
  59. package/dist/types/restricted/manageState.d.ts +4 -4
  60. package/dist/types/restricted/notify.d.ts +4 -4
  61. package/dist/types/utils.d.ts +3 -3
  62. package/package.json +6 -6
  63. package/dist/chunk-HZQ34FQT.js.map +0 -1
  64. package/dist/chunk-IZYMBIBD.mjs.map +0 -1
  65. package/dist/chunk-SYB5TG5O.mjs.map +0 -1
  66. package/dist/chunk-SYUGPLEP.js.map +0 -1
  67. /package/dist/{chunk-BSAXPL2T.mjs.map → chunk-GEJDXRTL.mjs.map} +0 -0
  68. /package/dist/{chunk-FNUO7MQ4.mjs.map → chunk-K3UL5RVN.mjs.map} +0 -0
  69. /package/dist/{chunk-6VJVURH5.js.map → chunk-LP3RWEDJ.js.map} +0 -0
  70. /package/dist/{chunk-4TUORIA6.js.map → chunk-PK2RPAXI.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import type { PermissionConstraint, PermissionValidatorConstraint } from '@metamask/permission-controller';
2
2
  import type { Json } from '@metamask/utils';
3
- export declare type CaveatMapperReturnValue = Pick<PermissionConstraint, 'caveats'>;
4
- export declare type CaveatMapperFunction = (value: Json) => CaveatMapperReturnValue;
3
+ export type CaveatMapperReturnValue = Pick<PermissionConstraint, 'caveats'>;
4
+ export type CaveatMapperFunction = (value: Json) => CaveatMapperReturnValue;
5
5
  /**
6
6
  * Create a generic permission validator that validates the presence of certain caveats.
7
7
  *
@@ -5,7 +5,7 @@ import { SnapCaveatType } from '@metamask/snaps-utils';
5
5
  import type { Json, NonEmptyArray } from '@metamask/utils';
6
6
  import { SnapEndowments } from './enum';
7
7
  declare const targetName = SnapEndowments.Rpc;
8
- declare type RpcSpecificationBuilderOptions = {};
8
+ type RpcSpecificationBuilderOptions = {};
9
9
  export declare const rpcEndowmentBuilder: Readonly<{
10
10
  readonly targetName: SnapEndowments.Rpc;
11
11
  readonly specificationBuilder: PermissionSpecificationBuilder<PermissionType.Endowment, RpcSpecificationBuilderOptions, {
@@ -1,7 +1,7 @@
1
1
  import type { PermittedHandlerExport } from '@metamask/permission-controller';
2
2
  import type { CreateInterfaceParams, CreateInterfaceResult, ComponentOrElement, InterfaceContext } from '@metamask/snaps-sdk';
3
3
  import { type InferMatching } from '@metamask/snaps-utils';
4
- export declare type CreateInterfaceMethodHooks = {
4
+ export type CreateInterfaceMethodHooks = {
5
5
  /**
6
6
  * @param ui - The UI components.
7
7
  * @returns The unique identifier of the interface.
@@ -79,6 +79,13 @@ declare const CreateInterfaceParametersStruct: import("@metamask/superstruct").S
79
79
  buttonType?: "button" | "submit" | undefined;
80
80
  })[];
81
81
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
82
+ name: string;
83
+ value?: string | undefined;
84
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
85
+ value: string;
86
+ children: string;
87
+ }, "Radio">>;
88
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
82
89
  children: import("@metamask/snaps-sdk/jsx").StringElement;
83
90
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
84
91
  src: string;
@@ -155,6 +162,13 @@ declare const CreateInterfaceParametersStruct: import("@metamask/superstruct").S
155
162
  buttonType?: "button" | "submit" | undefined;
156
163
  })[];
157
164
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
165
+ name: string;
166
+ value?: string | undefined;
167
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
168
+ value: string;
169
+ children: string;
170
+ }, "Radio">>;
171
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
158
172
  children: import("@metamask/snaps-sdk/jsx").StringElement;
159
173
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
160
174
  src: string;
@@ -162,5 +176,5 @@ declare const CreateInterfaceParametersStruct: import("@metamask/superstruct").S
162
176
  }, "Image">, null>;
163
177
  context: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>;
164
178
  }>;
165
- export declare type CreateInterfaceParameters = InferMatching<typeof CreateInterfaceParametersStruct, CreateInterfaceParams>;
179
+ export type CreateInterfaceParameters = InferMatching<typeof CreateInterfaceParametersStruct, CreateInterfaceParams>;
166
180
  export {};
@@ -6,7 +6,7 @@ import type { JsonRpcParams } from '@metamask/utils';
6
6
  * called from `https://snaps.metamask.io`.
7
7
  */
8
8
  export declare const getAllSnapsHandler: PermittedHandlerExport<GetAllSnapsHooks, JsonRpcParams, GetSnapsResult>;
9
- export declare type GetAllSnapsHooks = {
9
+ export type GetAllSnapsHooks = {
10
10
  /**
11
11
  * @returns All installed Snaps.
12
12
  */
@@ -5,7 +5,7 @@ import type { JsonRpcParams } from '@metamask/utils';
5
5
  * `snap_getClientStatus` returns useful information about the client running the snap.
6
6
  */
7
7
  export declare const getClientStatusHandler: PermittedHandlerExport<GetClientStatusHooks, JsonRpcParams, GetClientStatusResult>;
8
- export declare type GetClientStatusHooks = {
8
+ export type GetClientStatusHooks = {
9
9
  /**
10
10
  * @returns Whether the client is locked or not.
11
11
  */
@@ -8,8 +8,8 @@ export declare const GetFileArgsStruct: import("@metamask/superstruct").Struct<{
8
8
  path: import("@metamask/superstruct").Struct<string, null>;
9
9
  encoding: import("@metamask/superstruct").Struct<"base64" | "utf8" | "hex" | undefined, null>;
10
10
  }>;
11
- export declare type InferredGetFileParams = InferMatching<typeof GetFileArgsStruct, GetFileParams>;
11
+ export type InferredGetFileParams = InferMatching<typeof GetFileArgsStruct, GetFileParams>;
12
12
  export declare const getFileHandler: PermittedHandlerExport<GetFileHooks, InferredGetFileParams, string>;
13
- export declare type GetFileHooks = {
13
+ export type GetFileHooks = {
14
14
  getSnapFile: (path: InferredGetFileParams['path'], encoding: InferredGetFileParams['encoding']) => Promise<string>;
15
15
  };
@@ -1,7 +1,7 @@
1
1
  import type { PermittedHandlerExport } from '@metamask/permission-controller';
2
2
  import type { GetInterfaceStateParams, GetInterfaceStateResult, InterfaceState } from '@metamask/snaps-sdk';
3
3
  import { type InferMatching } from '@metamask/snaps-utils';
4
- export declare type GetInterfaceStateMethodHooks = {
4
+ export type GetInterfaceStateMethodHooks = {
5
5
  /**
6
6
  * @param id - The interface ID.
7
7
  * @returns The interface state.
@@ -14,5 +14,5 @@ declare const GetInterfaceStateParametersStruct: import("@metamask/superstruct")
14
14
  }, {
15
15
  id: import("@metamask/superstruct").Struct<string, null>;
16
16
  }>;
17
- export declare type GetInterfaceStateParameters = InferMatching<typeof GetInterfaceStateParametersStruct, GetInterfaceStateParams>;
17
+ export type GetInterfaceStateParameters = InferMatching<typeof GetInterfaceStateParametersStruct, GetInterfaceStateParams>;
18
18
  export {};
@@ -5,7 +5,7 @@ import type { JsonRpcParams } from '@metamask/utils';
5
5
  * `wallet_getSnaps` gets the requester's permitted and installed Snaps.
6
6
  */
7
7
  export declare const getSnapsHandler: PermittedHandlerExport<GetSnapsHooks, JsonRpcParams, GetSnapsResult>;
8
- export declare type GetSnapsHooks = {
8
+ export type GetSnapsHooks = {
9
9
  /**
10
10
  * @returns The permitted and installed snaps for the requesting origin.
11
11
  */
@@ -6,6 +6,6 @@ import type { GetSnapsHooks } from './getSnaps';
6
6
  import type { RequestSnapsHooks } from './requestSnaps';
7
7
  import type { ResolveInterfaceMethodHooks } from './resolveInterface';
8
8
  import type { UpdateInterfaceMethodHooks } from './updateInterface';
9
- export declare type PermittedRpcMethodHooks = GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks;
9
+ export type PermittedRpcMethodHooks = GetAllSnapsHooks & GetClientStatusHooks & GetSnapsHooks & RequestSnapsHooks & CreateInterfaceMethodHooks & UpdateInterfaceMethodHooks & GetInterfaceStateMethodHooks & ResolveInterfaceMethodHooks;
10
10
  export * from './handlers';
11
11
  export * from './middleware';
@@ -5,7 +5,7 @@ import type { Snap, SnapRpcHookArgs } from '@metamask/snaps-utils';
5
5
  * `wallet_invokeKeyring` gets the requester's permitted and installed Snaps.
6
6
  */
7
7
  export declare const invokeKeyringHandler: PermittedHandlerExport<InvokeKeyringHooks, InvokeSnapParams, InvokeKeyringResult>;
8
- export declare type InvokeKeyringHooks = {
8
+ export type InvokeKeyringHooks = {
9
9
  hasPermission: (permissionName: string) => boolean;
10
10
  handleSnapRpcRequest: ({ snapId, handler, request, }: Omit<SnapRpcHookArgs, 'origin'> & {
11
11
  snapId: string;
@@ -6,7 +6,7 @@ import type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';
6
6
  * `wallet_invokeSnap` attempts to invoke an RPC method of the specified Snap.
7
7
  */
8
8
  export declare const invokeSnapSugarHandler: PermittedHandlerExport<InvokeSnapSugarHooks, InvokeSnapParams, InvokeSnapResult>;
9
- export declare type InvokeSnapSugarHooks = {
9
+ export type InvokeSnapSugarHooks = {
10
10
  invokeSnap: (params: InvokeSnapParams) => Promise<InvokeSnapResult>;
11
11
  };
12
12
  /**
@@ -5,7 +5,7 @@ import type { SnapsPermissionRequest } from '@metamask/snaps-utils';
5
5
  * `wallet_requestSnaps` installs the requested Snaps and requests permission to use them if necessary.
6
6
  */
7
7
  export declare const requestSnapsHandler: PermittedHandlerExport<RequestSnapsHooks, RequestSnapsParams, RequestSnapsResult>;
8
- export declare type RequestSnapsHooks = {
8
+ export type RequestSnapsHooks = {
9
9
  /**
10
10
  * Installs the requested snaps if they are permitted.
11
11
  */
@@ -2,7 +2,7 @@ import type { PermittedHandlerExport } from '@metamask/permission-controller';
2
2
  import type { ResolveInterfaceParams, ResolveInterfaceResult } from '@metamask/snaps-sdk';
3
3
  import type { InferMatching } from '@metamask/snaps-utils';
4
4
  import { type Json } from '@metamask/utils';
5
- export declare type ResolveInterfaceMethodHooks = {
5
+ export type ResolveInterfaceMethodHooks = {
6
6
  /**
7
7
  * @param id - The interface id.
8
8
  * @param value - The value to resolve the interface with.
@@ -17,5 +17,5 @@ declare const ResolveInterfaceParametersStruct: import("@metamask/superstruct").
17
17
  id: import("@metamask/superstruct").Struct<string, null>;
18
18
  value: import("@metamask/superstruct").Struct<Json, unknown>;
19
19
  }>;
20
- export declare type ResolveInterfaceParameters = InferMatching<typeof ResolveInterfaceParametersStruct, ResolveInterfaceParams>;
20
+ export type ResolveInterfaceParameters = InferMatching<typeof ResolveInterfaceParametersStruct, ResolveInterfaceParams>;
21
21
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { PermittedHandlerExport } from '@metamask/permission-controller';
2
2
  import type { UpdateInterfaceParams, UpdateInterfaceResult, ComponentOrElement } from '@metamask/snaps-sdk';
3
3
  import { type InferMatching } from '@metamask/snaps-utils';
4
- export declare type UpdateInterfaceMethodHooks = {
4
+ export type UpdateInterfaceMethodHooks = {
5
5
  /**
6
6
  * @param id - The interface ID.
7
7
  * @param ui - The UI components.
@@ -80,6 +80,13 @@ declare const UpdateInterfaceParametersStruct: import("@metamask/superstruct").S
80
80
  buttonType?: "button" | "submit" | undefined;
81
81
  })[];
82
82
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
83
+ name: string;
84
+ value?: string | undefined;
85
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
86
+ value: string;
87
+ children: string;
88
+ }, "Radio">>;
89
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
83
90
  children: import("@metamask/snaps-sdk/jsx").StringElement;
84
91
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
85
92
  src: string;
@@ -156,11 +163,18 @@ declare const UpdateInterfaceParametersStruct: import("@metamask/superstruct").S
156
163
  buttonType?: "button" | "submit" | undefined;
157
164
  })[];
158
165
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
166
+ name: string;
167
+ value?: string | undefined;
168
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
169
+ value: string;
170
+ children: string;
171
+ }, "Radio">>;
172
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
159
173
  children: import("@metamask/snaps-sdk/jsx").StringElement;
160
174
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
161
175
  src: string;
162
176
  alt?: string | undefined;
163
177
  }, "Image">, null>;
164
178
  }>;
165
- export declare type UpdateInterfaceParameters = InferMatching<typeof UpdateInterfaceParametersStruct, UpdateInterfaceParams>;
179
+ export type UpdateInterfaceParameters = InferMatching<typeof UpdateInterfaceParametersStruct, UpdateInterfaceParams>;
166
180
  export {};
@@ -7,7 +7,7 @@ import type { Infer, Struct } from '@metamask/superstruct';
7
7
  import type { Json, NonEmptyArray } from '@metamask/utils';
8
8
  import { type MethodHooksObject } from '../utils';
9
9
  declare const methodName = "snap_dialog";
10
- export declare type DialogApprovalTypes = Record<DialogType, string> & {
10
+ export type DialogApprovalTypes = Record<DialogType, string> & {
11
11
  default: string;
12
12
  };
13
13
  export declare const DIALOG_APPROVAL_TYPES: {
@@ -17,8 +17,8 @@ export declare const DIALOG_APPROVAL_TYPES: {
17
17
  default: string;
18
18
  };
19
19
  declare const PlaceholderStruct: Struct<string | undefined, null>;
20
- export declare type Placeholder = Infer<typeof PlaceholderStruct>;
21
- declare type RequestUserApprovalOptions = {
20
+ export type Placeholder = Infer<typeof PlaceholderStruct>;
21
+ type RequestUserApprovalOptions = {
22
22
  id?: string;
23
23
  origin: string;
24
24
  type: string;
@@ -27,14 +27,14 @@ declare type RequestUserApprovalOptions = {
27
27
  placeholder?: string;
28
28
  };
29
29
  };
30
- declare type RequestUserApproval = (opts: RequestUserApprovalOptions) => Promise<boolean | null | string | Json>;
31
- declare type CreateInterface = (snapId: string, content: ComponentOrElement) => Promise<string>;
32
- declare type GetInterface = (snapId: string, id: string) => {
30
+ type RequestUserApproval = (opts: RequestUserApprovalOptions) => Promise<boolean | null | string | Json>;
31
+ type CreateInterface = (snapId: string, content: ComponentOrElement) => Promise<string>;
32
+ type GetInterface = (snapId: string, id: string) => {
33
33
  content: ComponentOrElement;
34
34
  snapId: SnapId;
35
35
  state: InterfaceState;
36
36
  };
37
- export declare type DialogMethodHooks = {
37
+ export type DialogMethodHooks = {
38
38
  /**
39
39
  * @param opts - The `requestUserApproval` options.
40
40
  * @param opts.id - The approval ID. If not provided, a new approval ID will be generated.
@@ -56,7 +56,7 @@ export declare type DialogMethodHooks = {
56
56
  */
57
57
  getInterface: GetInterface;
58
58
  };
59
- declare type DialogSpecificationBuilderOptions = {
59
+ type DialogSpecificationBuilderOptions = {
60
60
  allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
61
61
  methodHooks: DialogMethodHooks;
62
62
  };
@@ -141,6 +141,13 @@ declare const DialogParametersStruct: Struct<{
141
141
  buttonType?: "button" | "submit" | undefined;
142
142
  })[];
143
143
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
144
+ name: string;
145
+ value?: string | undefined;
146
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
147
+ value: string;
148
+ children: string;
149
+ }, "Radio">>;
150
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
144
151
  children: import("@metamask/snaps-sdk/jsx").StringElement;
145
152
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
146
153
  src: string;
@@ -220,6 +227,13 @@ declare const DialogParametersStruct: Struct<{
220
227
  buttonType?: "button" | "submit" | undefined;
221
228
  })[];
222
229
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
230
+ name: string;
231
+ value?: string | undefined;
232
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
233
+ value: string;
234
+ children: string;
235
+ }, "Radio">>;
236
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
223
237
  children: import("@metamask/snaps-sdk/jsx").StringElement;
224
238
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
225
239
  src: string;
@@ -299,6 +313,13 @@ declare const DialogParametersStruct: Struct<{
299
313
  buttonType?: "button" | "submit" | undefined;
300
314
  })[];
301
315
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
316
+ name: string;
317
+ value?: string | undefined;
318
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
319
+ value: string;
320
+ children: string;
321
+ }, "Radio">>;
322
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
302
323
  children: import("@metamask/snaps-sdk/jsx").StringElement;
303
324
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
304
325
  src: string;
@@ -379,6 +400,13 @@ declare const DialogParametersStruct: Struct<{
379
400
  buttonType?: "button" | "submit" | undefined;
380
401
  })[];
381
402
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
403
+ name: string;
404
+ value?: string | undefined;
405
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
406
+ value: string;
407
+ children: string;
408
+ }, "Radio">>;
409
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
382
410
  children: import("@metamask/snaps-sdk/jsx").StringElement;
383
411
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
384
412
  src: string;
@@ -457,6 +485,13 @@ declare const DialogParametersStruct: Struct<{
457
485
  buttonType?: "button" | "submit" | undefined;
458
486
  })[];
459
487
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
488
+ name: string;
489
+ value?: string | undefined;
490
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
491
+ value: string;
492
+ children: string;
493
+ }, "Radio">>;
494
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
460
495
  children: import("@metamask/snaps-sdk/jsx").StringElement;
461
496
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
462
497
  src: string;
@@ -536,6 +571,13 @@ declare const DialogParametersStruct: Struct<{
536
571
  buttonType?: "button" | "submit" | undefined;
537
572
  })[];
538
573
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
574
+ name: string;
575
+ value?: string | undefined;
576
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
577
+ value: string;
578
+ children: string;
579
+ }, "Radio">>;
580
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
539
581
  children: import("@metamask/snaps-sdk/jsx").StringElement;
540
582
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
541
583
  src: string;
@@ -612,6 +654,13 @@ declare const DialogParametersStruct: Struct<{
612
654
  buttonType?: "button" | "submit" | undefined;
613
655
  })[];
614
656
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
657
+ name: string;
658
+ value?: string | undefined;
659
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
660
+ value: string;
661
+ children: string;
662
+ }, "Radio">>;
663
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
615
664
  children: import("@metamask/snaps-sdk/jsx").StringElement;
616
665
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
617
666
  src: string;
@@ -694,6 +743,13 @@ declare const DialogParametersStruct: Struct<{
694
743
  buttonType?: "button" | "submit" | undefined;
695
744
  })[];
696
745
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
746
+ name: string;
747
+ value?: string | undefined;
748
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
749
+ value: string;
750
+ children: string;
751
+ }, "Radio">>;
752
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
697
753
  children: import("@metamask/snaps-sdk/jsx").StringElement;
698
754
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
699
755
  src: string;
@@ -773,6 +829,13 @@ declare const DialogParametersStruct: Struct<{
773
829
  buttonType?: "button" | "submit" | undefined;
774
830
  })[];
775
831
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
832
+ name: string;
833
+ value?: string | undefined;
834
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
835
+ value: string;
836
+ children: string;
837
+ }, "Radio">>;
838
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
776
839
  children: import("@metamask/snaps-sdk/jsx").StringElement;
777
840
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
778
841
  src: string;
@@ -849,6 +912,13 @@ declare const DialogParametersStruct: Struct<{
849
912
  buttonType?: "button" | "submit" | undefined;
850
913
  })[];
851
914
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
915
+ name: string;
916
+ value?: string | undefined;
917
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
918
+ value: string;
919
+ children: string;
920
+ }, "Radio">>;
921
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
852
922
  children: import("@metamask/snaps-sdk/jsx").StringElement;
853
923
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
854
924
  src: string;
@@ -931,6 +1001,13 @@ declare const DialogParametersStruct: Struct<{
931
1001
  buttonType?: "button" | "submit" | undefined;
932
1002
  })[];
933
1003
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
1004
+ name: string;
1005
+ value?: string | undefined;
1006
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
1007
+ value: string;
1008
+ children: string;
1009
+ }, "Radio">>;
1010
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
934
1011
  children: import("@metamask/snaps-sdk/jsx").StringElement;
935
1012
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
936
1013
  src: string;
@@ -1012,6 +1089,13 @@ declare const DialogParametersStruct: Struct<{
1012
1089
  buttonType?: "button" | "submit" | undefined;
1013
1090
  })[];
1014
1091
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
1092
+ name: string;
1093
+ value?: string | undefined;
1094
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
1095
+ value: string;
1096
+ children: string;
1097
+ }, "Radio">>;
1098
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1015
1099
  children: import("@metamask/snaps-sdk/jsx").StringElement;
1016
1100
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1017
1101
  src: string;
@@ -1089,6 +1173,13 @@ declare const DialogParametersStruct: Struct<{
1089
1173
  buttonType?: "button" | "submit" | undefined;
1090
1174
  })[];
1091
1175
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
1176
+ name: string;
1177
+ value?: string | undefined;
1178
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
1179
+ value: string;
1180
+ children: string;
1181
+ }, "Radio">>;
1182
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1092
1183
  children: import("@metamask/snaps-sdk/jsx").StringElement;
1093
1184
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1094
1185
  src: string;
@@ -1173,6 +1264,13 @@ declare const DialogParametersStruct: Struct<{
1173
1264
  buttonType?: "button" | "submit" | undefined;
1174
1265
  })[];
1175
1266
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
1267
+ name: string;
1268
+ value?: string | undefined;
1269
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
1270
+ value: string;
1271
+ children: string;
1272
+ }, "Radio">>;
1273
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1176
1274
  children: import("@metamask/snaps-sdk/jsx").StringElement;
1177
1275
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1178
1276
  src: string;
@@ -1250,6 +1348,13 @@ declare const DialogParametersStruct: Struct<{
1250
1348
  buttonType?: "button" | "submit" | undefined;
1251
1349
  })[];
1252
1350
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
1351
+ name: string;
1352
+ value?: string | undefined;
1353
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
1354
+ value: string;
1355
+ children: string;
1356
+ }, "Radio">>;
1357
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1253
1358
  children: import("@metamask/snaps-sdk/jsx").StringElement;
1254
1359
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1255
1360
  src: string;
@@ -1325,6 +1430,13 @@ declare const DialogParametersStruct: Struct<{
1325
1430
  buttonType?: "button" | "submit" | undefined;
1326
1431
  })[];
1327
1432
  } | import("@metamask/snaps-sdk/jsx").SnapElement<{
1433
+ name: string;
1434
+ value?: string | undefined;
1435
+ children: import("@metamask/snaps-sdk/jsx").SnapsChildren<import("@metamask/snaps-sdk/jsx").SnapElement<{
1436
+ value: string;
1437
+ children: string;
1438
+ }, "Radio">>;
1439
+ }, "RadioGroup"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1328
1440
  children: import("@metamask/snaps-sdk/jsx").StringElement;
1329
1441
  }, "Heading"> | import("@metamask/snaps-sdk/jsx").SnapElement<{
1330
1442
  src: string;
@@ -1335,7 +1447,7 @@ declare const DialogParametersStruct: Struct<{
1335
1447
  }, {
1336
1448
  id: Struct<string, null>;
1337
1449
  }>]>]>;
1338
- export declare type DialogParameters = InferMatching<typeof DialogParametersStruct, DialogParams>;
1450
+ export type DialogParameters = InferMatching<typeof DialogParametersStruct, DialogParams>;
1339
1451
  /**
1340
1452
  * Builds the method implementation for `snap_dialog`.
1341
1453
  *
@@ -4,7 +4,7 @@ import type { GetBip32EntropyParams, GetBip32EntropyResult } from '@metamask/sna
4
4
  import type { NonEmptyArray } from '@metamask/utils';
5
5
  import type { MethodHooksObject } from '../utils';
6
6
  declare const targetName = "snap_getBip32Entropy";
7
- export declare type GetBip32EntropyMethodHooks = {
7
+ export type GetBip32EntropyMethodHooks = {
8
8
  /**
9
9
  * @returns The mnemonic of the user's primary keyring.
10
10
  */
@@ -16,7 +16,7 @@ export declare type GetBip32EntropyMethodHooks = {
16
16
  */
17
17
  getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;
18
18
  };
19
- declare type GetBip32EntropySpecificationBuilderOptions = {
19
+ type GetBip32EntropySpecificationBuilderOptions = {
20
20
  methodHooks: GetBip32EntropyMethodHooks;
21
21
  };
22
22
  export declare const getBip32EntropyBuilder: Readonly<{
@@ -4,7 +4,7 @@ import type { GetBip32PublicKeyParams, GetBip32PublicKeyResult } from '@metamask
4
4
  import type { NonEmptyArray } from '@metamask/utils';
5
5
  import type { MethodHooksObject } from '../utils';
6
6
  declare const targetName = "snap_getBip32PublicKey";
7
- export declare type GetBip32PublicKeyMethodHooks = {
7
+ export type GetBip32PublicKeyMethodHooks = {
8
8
  /**
9
9
  * @returns The mnemonic of the user's primary keyring.
10
10
  */
@@ -16,7 +16,7 @@ export declare type GetBip32PublicKeyMethodHooks = {
16
16
  */
17
17
  getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;
18
18
  };
19
- declare type GetBip32PublicKeySpecificationBuilderOptions = {
19
+ type GetBip32PublicKeySpecificationBuilderOptions = {
20
20
  methodHooks: GetBip32PublicKeyMethodHooks;
21
21
  };
22
22
  export declare const Bip32PublicKeyArgsStruct: import("@metamask/superstruct").Struct<{
@@ -4,7 +4,7 @@ import type { GetBip44EntropyParams, GetBip44EntropyResult } from '@metamask/sna
4
4
  import type { NonEmptyArray } from '@metamask/utils';
5
5
  import type { MethodHooksObject } from '../utils';
6
6
  declare const targetName = "snap_getBip44Entropy";
7
- export declare type GetBip44EntropyMethodHooks = {
7
+ export type GetBip44EntropyMethodHooks = {
8
8
  /**
9
9
  * @returns The mnemonic of the user's primary keyring.
10
10
  */
@@ -16,7 +16,7 @@ export declare type GetBip44EntropyMethodHooks = {
16
16
  */
17
17
  getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>;
18
18
  };
19
- declare type GetBip44EntropySpecificationBuilderOptions = {
19
+ type GetBip44EntropySpecificationBuilderOptions = {
20
20
  methodHooks: GetBip44EntropyMethodHooks;
21
21
  };
22
22
  export declare const getBip44EntropyBuilder: Readonly<{
@@ -5,7 +5,7 @@ import type { Infer } from '@metamask/superstruct';
5
5
  import type { NonEmptyArray } from '@metamask/utils';
6
6
  import type { MethodHooksObject } from '../utils';
7
7
  declare const targetName = "snap_getEntropy";
8
- declare type GetEntropySpecificationBuilderOptions = {
8
+ type GetEntropySpecificationBuilderOptions = {
9
9
  allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
10
10
  methodHooks: GetEntropyHooks;
11
11
  };
@@ -22,7 +22,7 @@ export declare const GetEntropyArgsStruct: import("@metamask/superstruct").Struc
22
22
  * @property salt - A string to use as the salt when deriving the entropy. If
23
23
  * omitted, the salt will be an empty string.
24
24
  */
25
- export declare type GetEntropyArgs = Infer<typeof GetEntropyArgsStruct>;
25
+ export type GetEntropyArgs = Infer<typeof GetEntropyArgsStruct>;
26
26
  export declare const getEntropyBuilder: Readonly<{
27
27
  readonly targetName: "snap_getEntropy";
28
28
  readonly specificationBuilder: PermissionSpecificationBuilder<PermissionType.RestrictedMethod, GetEntropySpecificationBuilderOptions, {
@@ -33,7 +33,7 @@ export declare const getEntropyBuilder: Readonly<{
33
33
  }>;
34
34
  readonly methodHooks: MethodHooksObject<GetEntropyHooks>;
35
35
  }>;
36
- export declare type GetEntropyHooks = {
36
+ export type GetEntropyHooks = {
37
37
  /**
38
38
  * @returns The mnemonic of the user's primary keyring.
39
39
  */
@@ -1,17 +1,17 @@
1
1
  import type { PermissionSpecificationBuilder, ValidPermissionSpecification, RestrictedMethodOptions, RestrictedMethodParameters } from '@metamask/permission-controller';
2
2
  import { PermissionType } from '@metamask/permission-controller';
3
- import type { GetLocaleResult } from '@metamask/snaps-sdk';
3
+ import type { GetLocaleResult, GetPreferencesResult } from '@metamask/snaps-sdk';
4
4
  import type { NonEmptyArray } from '@metamask/utils';
5
5
  import type { MethodHooksObject } from '../utils';
6
6
  declare const methodName = "snap_getLocale";
7
- export declare type GetLocaleMethodHooks = {
8
- getLocale: () => Promise<string>;
7
+ export type GetLocaleMethodHooks = {
8
+ getPreferences: () => GetPreferencesResult;
9
9
  };
10
- declare type SpecificationBuilderOptions = {
10
+ type SpecificationBuilderOptions = {
11
11
  allowedCaveats?: Readonly<NonEmptyArray<string>> | null;
12
12
  methodHooks: GetLocaleMethodHooks;
13
13
  };
14
- declare type Specification = ValidPermissionSpecification<{
14
+ type Specification = ValidPermissionSpecification<{
15
15
  permissionType: PermissionType.RestrictedMethod;
16
16
  targetName: typeof methodName;
17
17
  methodImplementation: ReturnType<typeof getImplementation>;
@@ -25,6 +25,7 @@ declare type Specification = ValidPermissionSpecification<{
25
25
  * @param options.allowedCaveats - The optional allowed caveats for the permission.
26
26
  * @param options.methodHooks - The RPC method hooks needed by the method implementation.
27
27
  * @returns The specification for the `snap_getLocale` permission.
28
+ * @deprecated - To be removed in favor of `snap_getPreferences`.
28
29
  */
29
30
  export declare const specificationBuilder: PermissionSpecificationBuilder<PermissionType.RestrictedMethod, SpecificationBuilderOptions, Specification>;
30
31
  export declare const getLocaleBuilder: Readonly<{
@@ -41,8 +42,8 @@ export declare const getLocaleBuilder: Readonly<{
41
42
  * Builds the method implementation for `snap_getLocale`.
42
43
  *
43
44
  * @param hooks - The RPC method hooks.
44
- * @param hooks.getLocale - A function that returns the user selected locale.
45
+ * @param hooks.getPreferences - A function that returns the user selected preferences.
45
46
  * @returns The user selected locale.
46
47
  */
47
- export declare function getImplementation({ getLocale }: GetLocaleMethodHooks): (_args: RestrictedMethodOptions<RestrictedMethodParameters>) => Promise<GetLocaleResult>;
48
+ export declare function getImplementation({ getPreferences }: GetLocaleMethodHooks): (_args: RestrictedMethodOptions<RestrictedMethodParameters>) => Promise<GetLocaleResult>;
48
49
  export {};