@metamask/snaps-sdk 10.0.0 → 10.1.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 +12 -1
- package/dist/error-wrappers.d.cts +192 -192
- package/dist/error-wrappers.d.mts +192 -192
- package/dist/internals/error-wrappers.d.cts +12 -12
- package/dist/internals/error-wrappers.d.mts +12 -12
- package/dist/jsx/components/formatting/Italic.cjs +1 -1
- package/dist/jsx/components/formatting/Italic.cjs.map +1 -1
- package/dist/jsx/components/formatting/Italic.d.cts +1 -1
- package/dist/jsx/components/formatting/Italic.d.mts +1 -1
- package/dist/jsx/components/formatting/Italic.mjs +1 -1
- package/dist/jsx/components/formatting/Italic.mjs.map +1 -1
- package/dist/types/handlers/user-input.cjs +2 -2
- package/dist/types/handlers/user-input.cjs.map +1 -1
- package/dist/types/handlers/user-input.d.cts +3 -3
- package/dist/types/handlers/user-input.d.cts.map +1 -1
- package/dist/types/handlers/user-input.d.mts +3 -3
- package/dist/types/handlers/user-input.d.mts.map +1 -1
- package/dist/types/handlers/user-input.mjs +2 -2
- package/dist/types/handlers/user-input.mjs.map +1 -1
- package/dist/types/methods/get-client-status.cjs.map +1 -1
- package/dist/types/methods/get-client-status.d.cts +14 -0
- package/dist/types/methods/get-client-status.d.cts.map +1 -1
- package/dist/types/methods/get-client-status.d.mts +14 -0
- package/dist/types/methods/get-client-status.d.mts.map +1 -1
- package/dist/types/methods/get-client-status.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -15,10 +15,10 @@ export type JsonRpcErrorFunction = typeof rpcErrors.parse;
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function createSnapError(fn: JsonRpcErrorFunction): {
|
|
17
17
|
new (message?: string): {
|
|
18
|
-
readonly "__#
|
|
19
|
-
readonly "__#
|
|
20
|
-
readonly "__#
|
|
21
|
-
readonly "__#
|
|
18
|
+
readonly "__#16449@#code": number;
|
|
19
|
+
readonly "__#16449@#message": string;
|
|
20
|
+
readonly "__#16449@#data"?: Record<string, Json> | undefined;
|
|
21
|
+
readonly "__#16449@#stack"?: string | undefined;
|
|
22
22
|
readonly name: string;
|
|
23
23
|
readonly code: number;
|
|
24
24
|
readonly message: string;
|
|
@@ -29,10 +29,10 @@ export declare function createSnapError(fn: JsonRpcErrorFunction): {
|
|
|
29
29
|
cause?: unknown;
|
|
30
30
|
};
|
|
31
31
|
new (data?: Record<string, Json>): {
|
|
32
|
-
readonly "__#
|
|
33
|
-
readonly "__#
|
|
34
|
-
readonly "__#
|
|
35
|
-
readonly "__#
|
|
32
|
+
readonly "__#16449@#code": number;
|
|
33
|
+
readonly "__#16449@#message": string;
|
|
34
|
+
readonly "__#16449@#data"?: Record<string, Json> | undefined;
|
|
35
|
+
readonly "__#16449@#stack"?: string | undefined;
|
|
36
36
|
readonly name: string;
|
|
37
37
|
readonly code: number;
|
|
38
38
|
readonly message: string;
|
|
@@ -43,10 +43,10 @@ export declare function createSnapError(fn: JsonRpcErrorFunction): {
|
|
|
43
43
|
cause?: unknown;
|
|
44
44
|
};
|
|
45
45
|
new (message?: string | Record<string, Json>, data?: Record<string, Json>): {
|
|
46
|
-
readonly "__#
|
|
47
|
-
readonly "__#
|
|
48
|
-
readonly "__#
|
|
49
|
-
readonly "__#
|
|
46
|
+
readonly "__#16449@#code": number;
|
|
47
|
+
readonly "__#16449@#message": string;
|
|
48
|
+
readonly "__#16449@#data"?: Record<string, Json> | undefined;
|
|
49
|
+
readonly "__#16449@#stack"?: string | undefined;
|
|
50
50
|
readonly name: string;
|
|
51
51
|
readonly code: number;
|
|
52
52
|
readonly message: string;
|
|
@@ -15,10 +15,10 @@ export type JsonRpcErrorFunction = typeof rpcErrors.parse;
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function createSnapError(fn: JsonRpcErrorFunction): {
|
|
17
17
|
new (message?: string): {
|
|
18
|
-
readonly "__#
|
|
19
|
-
readonly "__#
|
|
20
|
-
readonly "__#
|
|
21
|
-
readonly "__#
|
|
18
|
+
readonly "__#8229@#code": number;
|
|
19
|
+
readonly "__#8229@#message": string;
|
|
20
|
+
readonly "__#8229@#data"?: Record<string, Json> | undefined;
|
|
21
|
+
readonly "__#8229@#stack"?: string | undefined;
|
|
22
22
|
readonly name: string;
|
|
23
23
|
readonly code: number;
|
|
24
24
|
readonly message: string;
|
|
@@ -29,10 +29,10 @@ export declare function createSnapError(fn: JsonRpcErrorFunction): {
|
|
|
29
29
|
cause?: unknown;
|
|
30
30
|
};
|
|
31
31
|
new (data?: Record<string, Json>): {
|
|
32
|
-
readonly "__#
|
|
33
|
-
readonly "__#
|
|
34
|
-
readonly "__#
|
|
35
|
-
readonly "__#
|
|
32
|
+
readonly "__#8229@#code": number;
|
|
33
|
+
readonly "__#8229@#message": string;
|
|
34
|
+
readonly "__#8229@#data"?: Record<string, Json> | undefined;
|
|
35
|
+
readonly "__#8229@#stack"?: string | undefined;
|
|
36
36
|
readonly name: string;
|
|
37
37
|
readonly code: number;
|
|
38
38
|
readonly message: string;
|
|
@@ -43,10 +43,10 @@ export declare function createSnapError(fn: JsonRpcErrorFunction): {
|
|
|
43
43
|
cause?: unknown;
|
|
44
44
|
};
|
|
45
45
|
new (message?: string | Record<string, Json>, data?: Record<string, Json>): {
|
|
46
|
-
readonly "__#
|
|
47
|
-
readonly "__#
|
|
48
|
-
readonly "__#
|
|
49
|
-
readonly "__#
|
|
46
|
+
readonly "__#8229@#code": number;
|
|
47
|
+
readonly "__#8229@#message": string;
|
|
48
|
+
readonly "__#8229@#data"?: Record<string, Json> | undefined;
|
|
49
|
+
readonly "__#8229@#stack"?: string | undefined;
|
|
50
50
|
readonly name: string;
|
|
51
51
|
readonly code: number;
|
|
52
52
|
readonly message: string;
|
|
@@ -4,7 +4,7 @@ exports.Italic = void 0;
|
|
|
4
4
|
const component_1 = require("../../component.cjs");
|
|
5
5
|
const TYPE = 'Italic';
|
|
6
6
|
/**
|
|
7
|
-
* An italic component, which is used to display text in italic. This
|
|
7
|
+
* An italic component, which is used to display text in italic. This component
|
|
8
8
|
* can only be used as a child of the {@link Text} component.
|
|
9
9
|
*
|
|
10
10
|
* @param props - The props of the component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Italic.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/formatting/Italic.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AAqBtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;;;;GAYG;AACU,QAAA,MAAM,GAAG,IAAA,+BAAmB,EAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement<JsonObject, 'Bold'>\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This
|
|
1
|
+
{"version":3,"file":"Italic.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/formatting/Italic.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AAqBtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;;;;GAYG;AACU,QAAA,MAAM,GAAG,IAAA,+BAAmB,EAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement<JsonObject, 'Bold'>\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This component\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * <Text>\n * Hello <Italic>world</Italic>!\n * </Text>\n */\nexport const Italic = createSnapComponent<ItalicProps, typeof TYPE>(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType<typeof Italic>;\n"]}
|
|
@@ -13,7 +13,7 @@ export type ItalicProps = {
|
|
|
13
13
|
children: ItalicChildren;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* An italic component, which is used to display text in italic. This
|
|
16
|
+
* An italic component, which is used to display text in italic. This component
|
|
17
17
|
* can only be used as a child of the {@link Text} component.
|
|
18
18
|
*
|
|
19
19
|
* @param props - The props of the component.
|
|
@@ -13,7 +13,7 @@ export type ItalicProps = {
|
|
|
13
13
|
children: ItalicChildren;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* An italic component, which is used to display text in italic. This
|
|
16
|
+
* An italic component, which is used to display text in italic. This component
|
|
17
17
|
* can only be used as a child of the {@link Text} component.
|
|
18
18
|
*
|
|
19
19
|
* @param props - The props of the component.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSnapComponent } from "../../component.mjs";
|
|
2
2
|
const TYPE = 'Italic';
|
|
3
3
|
/**
|
|
4
|
-
* An italic component, which is used to display text in italic. This
|
|
4
|
+
* An italic component, which is used to display text in italic. This component
|
|
5
5
|
* can only be used as a child of the {@link Text} component.
|
|
6
6
|
*
|
|
7
7
|
* @param props - The props of the component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Italic.mjs","sourceRoot":"","sources":["../../../../src/jsx/components/formatting/Italic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAAwB;AAqBtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,mBAAmB,CAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement<JsonObject, 'Bold'>\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This
|
|
1
|
+
{"version":3,"file":"Italic.mjs","sourceRoot":"","sources":["../../../../src/jsx/components/formatting/Italic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAAwB;AAqBtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,mBAAmB,CAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement<JsonObject, 'Bold'>\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This component\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * <Text>\n * Hello <Italic>world</Italic>!\n * </Text>\n */\nexport const Italic = createSnapComponent<ItalicProps, typeof TYPE>(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType<typeof Italic>;\n"]}
|
|
@@ -57,12 +57,12 @@ exports.FormSubmitEventStruct = (0, superstruct_1.assign)(exports.GenericEventSt
|
|
|
57
57
|
exports.InputChangeEventStruct = (0, superstruct_1.assign)(exports.GenericEventStruct, (0, superstruct_1.object)({
|
|
58
58
|
type: (0, internals_1.literal)(UserInputEventType.InputChangeEvent),
|
|
59
59
|
name: (0, superstruct_1.string)(),
|
|
60
|
-
value: (0, superstruct_1.union)([
|
|
60
|
+
value: (0, superstruct_1.nullable)((0, superstruct_1.union)([
|
|
61
61
|
(0, superstruct_1.string)(),
|
|
62
62
|
(0, superstruct_1.boolean)(),
|
|
63
63
|
exports.AccountSelectorStateStruct,
|
|
64
64
|
exports.AssetSelectorStateStruct,
|
|
65
|
-
]),
|
|
65
|
+
])),
|
|
66
66
|
}));
|
|
67
67
|
exports.FileUploadEventStruct = (0, superstruct_1.assign)(exports.GenericEventStruct, (0, superstruct_1.object)({
|
|
68
68
|
type: (0, internals_1.literal)(UserInputEventType.FileUploadEvent),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-input.cjs","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":";;;AACA,uDAW+B;AAC/B,2CAA2E;AAE3E,yDAAsD;AAGtD;;;;;;;;GAQG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,2DAAqC,CAAA;IACrC,yDAAmC,CAAA;IACnC,2DAAqC,CAAA;IACrC,yDAAmC,CAAA;AACrC,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAEY,QAAA,kBAAkB,GAAG,IAAA,oBAAM,EAAC;IACvC,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,IAAI,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAC1C,0BAAkB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AsB;IACtB,6BAAqB;CACtB,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n array,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, CaipAccountIdStruct } from '@metamask/utils';\n\nimport { typedUnion, literal } from '../../internals';\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer<typeof ButtonClickEventStruct>;\n\nexport const AccountSelectorStateStruct = object({\n accountId: string(),\n addresses: array(CaipAccountIdStruct),\n});\n\n/**\n * The state of an `AccountSelector` component.\n *\n * @property accountId - The account ID of the account.\n * @property addresses - The addresses of the account as CAIP-10 account ID.\n */\nexport type AccountSelectorState = Infer<typeof AccountSelectorStateStruct>;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer<typeof FileStruct>;\n\nexport const AssetSelectorStateStruct = object({\n asset: CaipAssetTypeStruct,\n name: string(),\n symbol: string(),\n});\n\n/**\n * The state of the asset selector component.\n *\n * @property asset - The CAIP-19 asset ID.\n * @property name - The name of the asset.\n * @property symbol - The symbol of the asset.\n */\nexport type AssetSelectorState = Infer<typeof AssetSelectorStateStruct>;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(\n string(),\n nullable(\n union([\n string(),\n FileStruct,\n boolean(),\n AccountSelectorStateStruct,\n AssetSelectorStateStruct,\n ]),\n ),\n ),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer<typeof FormSubmitEventStruct>;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: nullable(\n union([\n string(),\n boolean(),\n AccountSelectorStateStruct,\n AssetSelectorStateStruct,\n ]),\n ),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer<typeof InputChangeEventStruct>;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer<typeof FileUploadEventStruct>;\n\nexport const UserInputEventStruct = typedUnion([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise<void>;\n"]}
|
|
@@ -145,7 +145,7 @@ export declare const InputChangeEventStruct: import("@metamask/superstruct").Str
|
|
|
145
145
|
symbol: string;
|
|
146
146
|
name: string;
|
|
147
147
|
asset: `${string}:${string}/${string}:${string}`;
|
|
148
|
-
};
|
|
148
|
+
} | null;
|
|
149
149
|
type: UserInputEventType.InputChangeEvent;
|
|
150
150
|
name: string;
|
|
151
151
|
}, {
|
|
@@ -158,7 +158,7 @@ export declare const InputChangeEventStruct: import("@metamask/superstruct").Str
|
|
|
158
158
|
symbol: string;
|
|
159
159
|
name: string;
|
|
160
160
|
asset: `${string}:${string}/${string}:${string}`;
|
|
161
|
-
}, null>;
|
|
161
|
+
} | null, null>;
|
|
162
162
|
}>;
|
|
163
163
|
/**
|
|
164
164
|
* An input change event, which is fired when the value of an input field
|
|
@@ -231,7 +231,7 @@ export declare const UserInputEventStruct: import("@metamask/superstruct").Struc
|
|
|
231
231
|
symbol: string;
|
|
232
232
|
name: string;
|
|
233
233
|
asset: `${string}:${string}/${string}:${string}`;
|
|
234
|
-
};
|
|
234
|
+
} | null;
|
|
235
235
|
type: UserInputEventType.InputChangeEvent;
|
|
236
236
|
name: string;
|
|
237
237
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-input.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAgBnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,yBAAqB;AAErD;;;;;;;;GAQG;AACH,oBAAY,kBAAkB;IAC5B,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;CACpC;AAED,eAAO,MAAM,kBAAkB;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;EAMlC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,eAAO,MAAM,0BAA0B;;;;;;EAGrC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,UAAU;;;;;;;;;;EAKrB,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5C,eAAO,MAAM,wBAAwB;;;;;;;;EAInC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;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AqB,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;EAclC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAK/B,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -145,7 +145,7 @@ export declare const InputChangeEventStruct: import("@metamask/superstruct").Str
|
|
|
145
145
|
symbol: string;
|
|
146
146
|
name: string;
|
|
147
147
|
asset: `${string}:${string}/${string}:${string}`;
|
|
148
|
-
};
|
|
148
|
+
} | null;
|
|
149
149
|
type: UserInputEventType.InputChangeEvent;
|
|
150
150
|
name: string;
|
|
151
151
|
}, {
|
|
@@ -158,7 +158,7 @@ export declare const InputChangeEventStruct: import("@metamask/superstruct").Str
|
|
|
158
158
|
symbol: string;
|
|
159
159
|
name: string;
|
|
160
160
|
asset: `${string}:${string}/${string}:${string}`;
|
|
161
|
-
}, null>;
|
|
161
|
+
} | null, null>;
|
|
162
162
|
}>;
|
|
163
163
|
/**
|
|
164
164
|
* An input change event, which is fired when the value of an input field
|
|
@@ -231,7 +231,7 @@ export declare const UserInputEventStruct: import("@metamask/superstruct").Struc
|
|
|
231
231
|
symbol: string;
|
|
232
232
|
name: string;
|
|
233
233
|
asset: `${string}:${string}/${string}:${string}`;
|
|
234
|
-
};
|
|
234
|
+
} | null;
|
|
235
235
|
type: UserInputEventType.InputChangeEvent;
|
|
236
236
|
name: string;
|
|
237
237
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-input.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAgBnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,yBAAqB;AAErD;;;;;;;;GAQG;AACH,oBAAY,kBAAkB;IAC5B,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;CACpC;AAED,eAAO,MAAM,kBAAkB;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;EAMlC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,eAAO,MAAM,0BAA0B;;;;;;EAGrC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,UAAU;;;;;;;;;;EAKrB,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5C,eAAO,MAAM,wBAAwB;;;;;;;;EAInC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBjC,CAAC;AAEF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AsB;;;;;;;;;;;;;;;;;;;;;;EAclC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAK/B,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -54,12 +54,12 @@ export const FormSubmitEventStruct = assign(GenericEventStruct, object({
|
|
|
54
54
|
export const InputChangeEventStruct = assign(GenericEventStruct, object({
|
|
55
55
|
type: literal(UserInputEventType.InputChangeEvent),
|
|
56
56
|
name: string(),
|
|
57
|
-
value: union([
|
|
57
|
+
value: nullable(union([
|
|
58
58
|
string(),
|
|
59
59
|
boolean(),
|
|
60
60
|
AccountSelectorStateStruct,
|
|
61
61
|
AssetSelectorStateStruct,
|
|
62
|
-
]),
|
|
62
|
+
])),
|
|
63
63
|
}));
|
|
64
64
|
export const FileUploadEventStruct = assign(GenericEventStruct, object({
|
|
65
65
|
type: literal(UserInputEventType.FileUploadEvent),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-input.mjs","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AAC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AAE;IACd,MAAM,EAAE,MAAM,EAAE;CACjB,CAAC,CAAC;AAWH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CACzC,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC;IACjD,KAAK,EAAE,MAAM,CACX,MAAM,EAAE,EACR,QAAQ,CACN,KAAK,CAAC;QACJ,MAAM,EAAE;QACR,UAAU;QACV,OAAO,EAAE;QACT,0BAA0B;QAC1B,wBAAwB;KACzB,CAAC,CACH,CACF;IACD,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CACH,CAAC;AAiBF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC;IAClD,IAAI,EAAE,MAAM,EAAE;IACd,KAAK,EAAE,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"user-input.mjs","sourceRoot":"","sources":["../../../src/types/handlers/user-input.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,KAAK,EACN,8BAA8B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,wBAAwB;AAE3E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,kCAAwB;AAGtD;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,2DAAqC,CAAA;IACrC,yDAAmC,CAAA;IACnC,2DAAqC,CAAA;IACrC,yDAAmC,CAAA;AACrC,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,QAAQ,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AI,EAAE,MAAM,EAAE;IACd,KAAK,EAAE,QAAQ,CACb,KAAK,CAAC;QACJ,MAAM,EAAE;QACR,OAAO,EAAE;QACT,0BAA0B;QAC1B,wBAAwB;KACzB,CAAC,CACH;CACF,CAAC,CACH,CAAC;AAYF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CACzC,kBAAkB,EAClB,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC;IACjD,IAAI,EAAE,MAAM,EAAE;IACd,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC;CAC3B,CAAC,CACH,CAAC;AAcF,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC7C,sBAAsB;IACtB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;CACtB,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n array,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, CaipAccountIdStruct } from '@metamask/utils';\n\nimport { typedUnion, literal } from '../../internals';\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer<typeof ButtonClickEventStruct>;\n\nexport const AccountSelectorStateStruct = object({\n accountId: string(),\n addresses: array(CaipAccountIdStruct),\n});\n\n/**\n * The state of an `AccountSelector` component.\n *\n * @property accountId - The account ID of the account.\n * @property addresses - The addresses of the account as CAIP-10 account ID.\n */\nexport type AccountSelectorState = Infer<typeof AccountSelectorStateStruct>;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer<typeof FileStruct>;\n\nexport const AssetSelectorStateStruct = object({\n asset: CaipAssetTypeStruct,\n name: string(),\n symbol: string(),\n});\n\n/**\n * The state of the asset selector component.\n *\n * @property asset - The CAIP-19 asset ID.\n * @property name - The name of the asset.\n * @property symbol - The symbol of the asset.\n */\nexport type AssetSelectorState = Infer<typeof AssetSelectorStateStruct>;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(\n string(),\n nullable(\n union([\n string(),\n FileStruct,\n boolean(),\n AccountSelectorStateStruct,\n AssetSelectorStateStruct,\n ]),\n ),\n ),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer<typeof FormSubmitEventStruct>;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: nullable(\n union([\n string(),\n boolean(),\n AccountSelectorStateStruct,\n AssetSelectorStateStruct,\n ]),\n ),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer<typeof InputChangeEventStruct>;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer<typeof FileUploadEventStruct>;\n\nexport const UserInputEventStruct = typedUnion([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise<void>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-client-status.cjs","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getClientStatus` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetClientStatusParams = never;\n\n/**\n * The result returned by the `snap_getClientStatus` method.\n *\n * It returns an object containing useful information about the client.\n */\nexport type GetClientStatusResult = { locked: boolean
|
|
1
|
+
{"version":3,"file":"get-client-status.cjs","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getClientStatus` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetClientStatusParams = never;\n\n/**\n * The result returned by the `snap_getClientStatus` method.\n *\n * It returns an object containing useful information about the client.\n */\nexport type GetClientStatusResult = {\n /**\n * The semantic version of the client that the Snap is running in.\n */\n clientVersion: string;\n /**\n * The Snaps Platform version that the client is running.\n */\n platformVersion: string;\n /**\n * A boolean flag that indicates whether the client is locked or not.\n */\n locked: boolean;\n /**\n * A boolean flag that indicates whether the client is active or not.\n */\n active: boolean;\n};\n"]}
|
|
@@ -10,7 +10,21 @@ export type GetClientStatusParams = never;
|
|
|
10
10
|
* It returns an object containing useful information about the client.
|
|
11
11
|
*/
|
|
12
12
|
export type GetClientStatusResult = {
|
|
13
|
+
/**
|
|
14
|
+
* The semantic version of the client that the Snap is running in.
|
|
15
|
+
*/
|
|
16
|
+
clientVersion: string;
|
|
17
|
+
/**
|
|
18
|
+
* The Snaps Platform version that the client is running.
|
|
19
|
+
*/
|
|
20
|
+
platformVersion: string;
|
|
21
|
+
/**
|
|
22
|
+
* A boolean flag that indicates whether the client is locked or not.
|
|
23
|
+
*/
|
|
13
24
|
locked: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A boolean flag that indicates whether the client is active or not.
|
|
27
|
+
*/
|
|
14
28
|
active: boolean;
|
|
15
29
|
};
|
|
16
30
|
//# sourceMappingURL=get-client-status.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-client-status.d.cts","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;
|
|
1
|
+
{"version":3,"file":"get-client-status.d.cts","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
@@ -10,7 +10,21 @@ export type GetClientStatusParams = never;
|
|
|
10
10
|
* It returns an object containing useful information about the client.
|
|
11
11
|
*/
|
|
12
12
|
export type GetClientStatusResult = {
|
|
13
|
+
/**
|
|
14
|
+
* The semantic version of the client that the Snap is running in.
|
|
15
|
+
*/
|
|
16
|
+
clientVersion: string;
|
|
17
|
+
/**
|
|
18
|
+
* The Snaps Platform version that the client is running.
|
|
19
|
+
*/
|
|
20
|
+
platformVersion: string;
|
|
21
|
+
/**
|
|
22
|
+
* A boolean flag that indicates whether the client is locked or not.
|
|
23
|
+
*/
|
|
13
24
|
locked: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A boolean flag that indicates whether the client is active or not.
|
|
27
|
+
*/
|
|
14
28
|
active: boolean;
|
|
15
29
|
};
|
|
16
30
|
//# sourceMappingURL=get-client-status.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-client-status.d.mts","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;
|
|
1
|
+
{"version":3,"file":"get-client-status.d.mts","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-client-status.mjs","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getClientStatus` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetClientStatusParams = never;\n\n/**\n * The result returned by the `snap_getClientStatus` method.\n *\n * It returns an object containing useful information about the client.\n */\nexport type GetClientStatusResult = { locked: boolean
|
|
1
|
+
{"version":3,"file":"get-client-status.mjs","sourceRoot":"","sources":["../../../src/types/methods/get-client-status.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getClientStatus` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetClientStatusParams = never;\n\n/**\n * The result returned by the `snap_getClientStatus` method.\n *\n * It returns an object containing useful information about the client.\n */\nexport type GetClientStatusResult = {\n /**\n * The semantic version of the client that the Snap is running in.\n */\n clientVersion: string;\n /**\n * The Snaps Platform version that the client is running.\n */\n platformVersion: string;\n /**\n * A boolean flag that indicates whether the client is locked or not.\n */\n locked: boolean;\n /**\n * A boolean flag that indicates whether the client is active or not.\n */\n active: boolean;\n};\n"]}
|