@metamask/snaps-sdk 6.1.0 → 6.2.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 +13 -2
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -0
- package/dist/index.mjs.map +1 -1
- package/dist/jsx/index.js +70 -42
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +70 -42
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js +16 -0
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.mjs +16 -0
- package/dist/jsx/jsx-dev-runtime.mjs.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/images.d.ts +1 -1
- package/dist/types/internals/error-wrappers.d.ts +1 -1
- package/dist/types/internals/helpers.d.ts +2 -2
- package/dist/types/internals/jsx.d.ts +3 -3
- package/dist/types/jsx/component.d.ts +9 -9
- package/dist/types/jsx/components/Address.d.ts +2 -2
- package/dist/types/jsx/components/Box.d.ts +2 -2
- package/dist/types/jsx/components/Card.d.ts +2 -2
- package/dist/types/jsx/components/Container.d.ts +2 -2
- package/dist/types/jsx/components/Copyable.d.ts +2 -2
- package/dist/types/jsx/components/Divider.d.ts +1 -1
- package/dist/types/jsx/components/Footer.d.ts +2 -2
- package/dist/types/jsx/components/Heading.d.ts +2 -2
- package/dist/types/jsx/components/Image.d.ts +2 -2
- package/dist/types/jsx/components/Link.d.ts +3 -3
- package/dist/types/jsx/components/Row.d.ts +3 -3
- package/dist/types/jsx/components/Spinner.d.ts +1 -1
- package/dist/types/jsx/components/Text.d.ts +3 -3
- package/dist/types/jsx/components/Tooltip.d.ts +3 -3
- package/dist/types/jsx/components/Value.d.ts +2 -2
- package/dist/types/jsx/components/form/Button.d.ts +2 -2
- package/dist/types/jsx/components/form/Checkbox.d.ts +2 -2
- package/dist/types/jsx/components/form/Dropdown.d.ts +2 -2
- package/dist/types/jsx/components/form/Field.d.ts +4 -3
- package/dist/types/jsx/components/form/FileInput.d.ts +2 -2
- package/dist/types/jsx/components/form/Form.d.ts +2 -2
- package/dist/types/jsx/components/form/Input.d.ts +2 -2
- package/dist/types/jsx/components/form/Option.d.ts +2 -2
- package/dist/types/jsx/components/form/Radio.d.ts +35 -0
- package/dist/types/jsx/components/form/RadioGroup.d.ts +29 -0
- package/dist/types/jsx/components/form/index.d.ts +5 -1
- package/dist/types/jsx/components/formatting/Bold.d.ts +3 -3
- package/dist/types/jsx/components/formatting/Italic.d.ts +3 -3
- package/dist/types/jsx/components/formatting/index.d.ts +1 -1
- package/dist/types/jsx/components/index.d.ts +1 -1
- package/dist/types/jsx/validation.d.ts +33 -4
- package/dist/types/types/caip.d.ts +2 -2
- package/dist/types/types/handlers/cronjob.d.ts +1 -1
- package/dist/types/types/handlers/home-page.d.ts +2 -2
- package/dist/types/types/handlers/keyring.d.ts +1 -1
- package/dist/types/types/handlers/lifecycle.d.ts +3 -3
- package/dist/types/types/handlers/name-lookup.d.ts +8 -8
- package/dist/types/types/handlers/rpc-request.d.ts +1 -1
- package/dist/types/types/handlers/signature.d.ts +8 -8
- package/dist/types/types/handlers/transaction.d.ts +5 -5
- package/dist/types/types/handlers/user-input.d.ts +7 -7
- package/dist/types/types/interface.d.ts +13 -6
- package/dist/types/types/methods/create-interface.d.ts +2 -2
- package/dist/types/types/methods/dialog.d.ts +6 -6
- package/dist/types/types/methods/get-bip32-entropy.d.ts +2 -2
- package/dist/types/types/methods/get-bip32-public-key.d.ts +2 -2
- package/dist/types/types/methods/get-bip44-entropy.d.ts +2 -2
- package/dist/types/types/methods/get-client-status.d.ts +2 -2
- package/dist/types/types/methods/get-entropy.d.ts +2 -2
- package/dist/types/types/methods/get-file.d.ts +2 -2
- package/dist/types/types/methods/get-interface-state.d.ts +2 -2
- package/dist/types/types/methods/get-locale.d.ts +2 -2
- package/dist/types/types/methods/get-preferences.d.ts +15 -0
- package/dist/types/types/methods/get-snaps.d.ts +2 -2
- package/dist/types/types/methods/index.d.ts +1 -0
- package/dist/types/types/methods/invoke-keyring.d.ts +2 -2
- package/dist/types/types/methods/invoke-snap.d.ts +2 -2
- package/dist/types/types/methods/manage-accounts.d.ts +2 -2
- package/dist/types/types/methods/manage-state.d.ts +5 -5
- package/dist/types/types/methods/methods.d.ts +4 -2
- package/dist/types/types/methods/notify.d.ts +2 -2
- package/dist/types/types/methods/request-snaps.d.ts +2 -2
- package/dist/types/types/methods/resolve-interface.d.ts +2 -2
- package/dist/types/types/methods/update-interface.d.ts +2 -2
- package/dist/types/types/permissions.d.ts +7 -7
- package/dist/types/types/provider.d.ts +3 -3
- package/dist/types/types/snap.d.ts +2 -2
- package/dist/types/ui/builder.d.ts +2 -2
- package/dist/types/ui/components/address.d.ts +1 -1
- package/dist/types/ui/components/button.d.ts +1 -1
- package/dist/types/ui/components/copyable.d.ts +1 -1
- package/dist/types/ui/components/divider.d.ts +1 -1
- package/dist/types/ui/components/form.d.ts +2 -2
- package/dist/types/ui/components/heading.d.ts +1 -1
- package/dist/types/ui/components/image.d.ts +1 -1
- package/dist/types/ui/components/input.d.ts +1 -1
- package/dist/types/ui/components/panel.d.ts +3 -3
- package/dist/types/ui/components/row.d.ts +1 -1
- package/dist/types/ui/components/spinner.d.ts +1 -1
- package/dist/types/ui/components/text.d.ts +1 -1
- package/dist/types/ui/nodes.d.ts +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The request parameters for the `snap_getPreferences` method.
|
|
3
|
+
*
|
|
4
|
+
* This method does not accept any parameters.
|
|
5
|
+
*/
|
|
6
|
+
export type GetPreferencesParams = never;
|
|
7
|
+
/**
|
|
8
|
+
* The result returned by the `snap_getPreferences` method.
|
|
9
|
+
*
|
|
10
|
+
* It is the user selected preferences from the MetaMask extension.
|
|
11
|
+
*/
|
|
12
|
+
export type GetPreferencesResult = {
|
|
13
|
+
locale: string;
|
|
14
|
+
currency: string;
|
|
15
|
+
};
|
|
@@ -5,12 +5,12 @@ import type { Snap, SnapId } from '../snap';
|
|
|
5
5
|
*
|
|
6
6
|
* This method does not accept any parameters.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type GetSnapsParams = never;
|
|
9
9
|
/**
|
|
10
10
|
* The result returned by the `wallet_getSnaps` method.
|
|
11
11
|
*
|
|
12
12
|
* It consists of a map of Snap IDs to either the Snap object or an error.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type GetSnapsResult = Record<SnapId, {
|
|
15
15
|
error: JsonRpcError;
|
|
16
16
|
} | Snap>;
|
|
@@ -8,6 +8,7 @@ export * from './get-entropy';
|
|
|
8
8
|
export * from './get-file';
|
|
9
9
|
export * from './get-interface-state';
|
|
10
10
|
export * from './get-locale';
|
|
11
|
+
export * from './get-preferences';
|
|
11
12
|
export * from './get-snaps';
|
|
12
13
|
export * from './invoke-keyring';
|
|
13
14
|
export * from './invoke-snap';
|
|
@@ -6,9 +6,9 @@ import type { InvokeSnapParams } from './invoke-snap';
|
|
|
6
6
|
* @property snapId - The ID of the snap to invoke.
|
|
7
7
|
* @property request - The JSON-RPC request to send to the snap.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type InvokeKeyringParams = InvokeSnapParams;
|
|
10
10
|
/**
|
|
11
11
|
* The result returned by the `wallet_invokeKeyring` method, which is the result
|
|
12
12
|
* returned by the Snap.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type InvokeKeyringResult = Json;
|
|
@@ -5,7 +5,7 @@ import type { Json } from '@metamask/utils';
|
|
|
5
5
|
* @property snapId - The ID of the Snap to invoke.
|
|
6
6
|
* @property request - The JSON-RPC request to send to the Snap.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type InvokeSnapParams = {
|
|
9
9
|
snapId: string;
|
|
10
10
|
request: Record<string, Json>;
|
|
11
11
|
};
|
|
@@ -13,4 +13,4 @@ export declare type InvokeSnapParams = {
|
|
|
13
13
|
* The result returned by the `wallet_invokeSnap` method, which is the result
|
|
14
14
|
* returned by the Snap.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type InvokeSnapResult = Json;
|
|
@@ -5,7 +5,7 @@ import type { Json } from '@metamask/utils';
|
|
|
5
5
|
* @property method - The method to call on the Snap.
|
|
6
6
|
* @property params - The optional parameters to pass to the Snap method.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type ManageAccountsParams = {
|
|
9
9
|
method: string;
|
|
10
10
|
} | {
|
|
11
11
|
method: string;
|
|
@@ -15,4 +15,4 @@ export declare type ManageAccountsParams = {
|
|
|
15
15
|
* The result returned by the `snap_manageAccounts` method, which is the result
|
|
16
16
|
* returned by the Snap.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export type ManageAccountsResult = Json;
|
|
@@ -17,7 +17,7 @@ export declare enum ManageStateOperation {
|
|
|
17
17
|
* be used if the extension is unlocked, while unencrypted state can be used
|
|
18
18
|
* whether the extension is locked or unlocked.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type ClearStateOperation = {
|
|
21
21
|
operation: EnumToUnion<ManageStateOperation.ClearState>;
|
|
22
22
|
encrypted?: boolean;
|
|
23
23
|
};
|
|
@@ -30,7 +30,7 @@ export declare type ClearStateOperation = {
|
|
|
30
30
|
* be used if the extension is unlocked, while unencrypted state can be used
|
|
31
31
|
* whether the extension is locked or unlocked.
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export type GetStateOperation = {
|
|
34
34
|
operation: EnumToUnion<ManageStateOperation.GetState>;
|
|
35
35
|
encrypted?: boolean;
|
|
36
36
|
};
|
|
@@ -45,7 +45,7 @@ export declare type GetStateOperation = {
|
|
|
45
45
|
* whether the extension is locked or unlocked.
|
|
46
46
|
* @property newState - The new state to set.
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export type UpdateStateOperation = {
|
|
49
49
|
operation: EnumToUnion<ManageStateOperation.UpdateState>;
|
|
50
50
|
encrypted?: boolean;
|
|
51
51
|
newState: Record<string, Json>;
|
|
@@ -59,11 +59,11 @@ export declare type UpdateStateOperation = {
|
|
|
59
59
|
* @property newState - The new state to set. Only applicable for the `set`
|
|
60
60
|
* operation.
|
|
61
61
|
*/
|
|
62
|
-
export
|
|
62
|
+
export type ManageStateParams = ClearStateOperation | GetStateOperation | UpdateStateOperation;
|
|
63
63
|
/**
|
|
64
64
|
* The result returned by the `snap_manageState` method.
|
|
65
65
|
*
|
|
66
66
|
* If the operation is `get`, the result is the state. Otherwise, the result is
|
|
67
67
|
* `null`.
|
|
68
68
|
*/
|
|
69
|
-
export
|
|
69
|
+
export type ManageStateResult = Record<string, Json> | null;
|
|
@@ -9,6 +9,7 @@ import type { GetEntropyParams, GetEntropyResult } from './get-entropy';
|
|
|
9
9
|
import type { GetFileParams, GetFileResult } from './get-file';
|
|
10
10
|
import type { GetInterfaceStateParams, GetInterfaceStateResult } from './get-interface-state';
|
|
11
11
|
import type { GetLocaleParams, GetLocaleResult } from './get-locale';
|
|
12
|
+
import type { GetPreferencesParams, GetPreferencesResult } from './get-preferences';
|
|
12
13
|
import type { GetSnapsParams, GetSnapsResult } from './get-snaps';
|
|
13
14
|
import type { InvokeKeyringParams, InvokeKeyringResult } from './invoke-keyring';
|
|
14
15
|
import type { InvokeSnapParams, InvokeSnapResult } from './invoke-snap';
|
|
@@ -22,7 +23,7 @@ import type { UpdateInterfaceParams, UpdateInterfaceResult } from './update-inte
|
|
|
22
23
|
* The methods that are available to the Snap. Each method is a tuple of the
|
|
23
24
|
* request parameters and the result returned by the method.
|
|
24
25
|
*/
|
|
25
|
-
export
|
|
26
|
+
export type SnapMethods = {
|
|
26
27
|
snap_dialog: [DialogParams, DialogResult];
|
|
27
28
|
snap_getBip32Entropy: [GetBip32EntropyParams, GetBip32EntropyResult];
|
|
28
29
|
snap_getBip32PublicKey: [GetBip32PublicKeyParams, GetBip32PublicKeyResult];
|
|
@@ -31,6 +32,7 @@ export declare type SnapMethods = {
|
|
|
31
32
|
snap_getEntropy: [GetEntropyParams, GetEntropyResult];
|
|
32
33
|
snap_getFile: [GetFileParams, GetFileResult];
|
|
33
34
|
snap_getLocale: [GetLocaleParams, GetLocaleResult];
|
|
35
|
+
snap_getPreferences: [GetPreferencesParams, GetPreferencesResult];
|
|
34
36
|
snap_manageAccounts: [ManageAccountsParams, ManageAccountsResult];
|
|
35
37
|
snap_manageState: [ManageStateParams, ManageStateResult];
|
|
36
38
|
snap_notify: [NotifyParams, NotifyResult];
|
|
@@ -69,4 +71,4 @@ export declare type SnapMethods = {
|
|
|
69
71
|
* },
|
|
70
72
|
* });
|
|
71
73
|
*/
|
|
72
|
-
export
|
|
74
|
+
export type RequestFunction = <MethodName extends keyof SnapMethods>(request: Method<MethodName, SnapMethods[MethodName][0]>) => Promise<SnapMethods[MethodName][1]>;
|
|
@@ -15,7 +15,7 @@ export declare enum NotificationType {
|
|
|
15
15
|
* @property type - The type of notification to display.
|
|
16
16
|
* @property message - The message to display in the notification.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export type NotifyParams = {
|
|
19
19
|
type: EnumToUnion<NotificationType>;
|
|
20
20
|
message: string;
|
|
21
21
|
};
|
|
@@ -24,4 +24,4 @@ export declare type NotifyParams = {
|
|
|
24
24
|
*
|
|
25
25
|
* This method does not return anything.
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export type NotifyResult = null;
|
|
@@ -5,7 +5,7 @@ import type { Snap } from '../snap';
|
|
|
5
5
|
*
|
|
6
6
|
* It consists of a map of Snap IDs to optional version strings to request.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type RequestSnapsParams = Record<string, {
|
|
9
9
|
version?: string;
|
|
10
10
|
}>;
|
|
11
11
|
/**
|
|
@@ -13,6 +13,6 @@ export declare type RequestSnapsParams = Record<string, {
|
|
|
13
13
|
*
|
|
14
14
|
* It consists of a map of Snap IDs to either the Snap object or an error.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type RequestSnapsResult = Record<string, {
|
|
17
17
|
error: JsonRpcError;
|
|
18
18
|
} | Snap>;
|
|
@@ -5,11 +5,11 @@ import type { Json } from '@metamask/utils';
|
|
|
5
5
|
* @property id - The interface id.
|
|
6
6
|
* @property value - The value to resolve the interface with.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type ResolveInterfaceParams = {
|
|
9
9
|
id: string;
|
|
10
10
|
value: Json;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* The result returned by the `snap_resolveInterface` method.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type ResolveInterfaceResult = null;
|
|
@@ -5,11 +5,11 @@ import type { ComponentOrElement } from '..';
|
|
|
5
5
|
* @property id - The interface id.
|
|
6
6
|
* @property ui - The components to display in the interface.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type UpdateInterfaceParams = {
|
|
9
9
|
id: string;
|
|
10
10
|
ui: ComponentOrElement;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* The result returned by the `snap_updateInterface` method.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type UpdateInterfaceResult = null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { SupportedCurve } from '@metamask/key-tree';
|
|
2
2
|
import type { JsonRpcRequest } from '@metamask/utils';
|
|
3
3
|
import type { ChainId } from './caip';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type EmptyObject = Record<string, never>;
|
|
5
|
+
export type Cronjob = {
|
|
6
6
|
expression: string;
|
|
7
7
|
request: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type NameLookupMatchers = {
|
|
10
10
|
tlds: string[];
|
|
11
11
|
} | {
|
|
12
12
|
schemes: string[];
|
|
@@ -14,17 +14,17 @@ export declare type NameLookupMatchers = {
|
|
|
14
14
|
tlds: string[];
|
|
15
15
|
schemes: string[];
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type Bip32Entropy = {
|
|
18
18
|
curve: SupportedCurve;
|
|
19
19
|
path: string[];
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type Bip44Entropy = {
|
|
22
22
|
coinType: number;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type RequestedSnap = {
|
|
25
25
|
version?: string;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type InitialPermissions = Partial<{
|
|
28
28
|
'endowment:cronjob': {
|
|
29
29
|
jobs: Cronjob[];
|
|
30
30
|
maxRequestTime?: number;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { BaseProvider } from '@metamask/providers';
|
|
2
2
|
import type { RequestFunction } from './methods';
|
|
3
|
-
|
|
3
|
+
type BaseProviderInstance = InstanceType<typeof BaseProvider>;
|
|
4
4
|
/**
|
|
5
5
|
* The `window.ethereum` provider for Snaps.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type SnapsEthereumProvider = Pick<BaseProviderInstance, 'request'>;
|
|
8
8
|
/**
|
|
9
9
|
* The `window.snap` provider.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type SnapsProvider = {
|
|
12
12
|
request: RequestFunction;
|
|
13
13
|
};
|
|
14
14
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SemVerVersion, Opaque } from '@metamask/utils';
|
|
2
2
|
import type { InitialPermissions } from './permissions';
|
|
3
|
-
export
|
|
3
|
+
export type SnapId = Opaque<string, typeof snapIdSymbol>;
|
|
4
4
|
declare const snapIdSymbol: unique symbol;
|
|
5
|
-
export
|
|
5
|
+
export type Snap = {
|
|
6
6
|
id: SnapId;
|
|
7
7
|
initialPermissions: InitialPermissions;
|
|
8
8
|
version: SemVerVersion;
|
|
@@ -7,7 +7,7 @@ import type { NodeType } from './nodes';
|
|
|
7
7
|
*
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
type NodeBuilder<Node extends Component, Keys extends (keyof Node)[]> = Omit<Node, 'type'> extends Record<string, never> ? (...args: []) => Node : (...args: [Omit<Node, 'type'>] | NodeArrayType<Node, Keys>) => Node;
|
|
11
11
|
/**
|
|
12
12
|
* Map from an array of node keys to the corresponding array type.
|
|
13
13
|
*
|
|
@@ -18,7 +18,7 @@ declare type NodeBuilder<Node extends Component, Keys extends (keyof Node)[]> =
|
|
|
18
18
|
* type NodeArray = NodeArrayType<Node, Keys>; // [string, number, boolean]
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
type NodeArrayType<Node extends Component, Keys extends (keyof Node)[]> = {
|
|
22
22
|
[Key in keyof Keys]: Node[Keys[Key]];
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -13,7 +13,7 @@ export declare const AddressStruct: import("@metamask/superstruct").Struct<{
|
|
|
13
13
|
* @property type - The type of the node. Must be the string `address`.
|
|
14
14
|
* @property value - The address in hexadecimal, including 0x.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type Address = Infer<typeof AddressStruct>;
|
|
17
17
|
/**
|
|
18
18
|
* Create an {@link Address} node.
|
|
19
19
|
*
|
|
@@ -30,7 +30,7 @@ export declare const ButtonStruct: import("@metamask/superstruct").Struct<{
|
|
|
30
30
|
* @property buttonType - The type of the button, must be either 'button' or 'submit'.
|
|
31
31
|
* @property name - An optional name to identify the button.
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export type Button = Infer<typeof ButtonStruct>;
|
|
34
34
|
/**
|
|
35
35
|
* Create a {@link Button} node.
|
|
36
36
|
*
|
|
@@ -20,7 +20,7 @@ export declare const CopyableStruct: import("@metamask/superstruct").Struct<{
|
|
|
20
20
|
* are only displayed to the user after clicking on the component. Defaults to
|
|
21
21
|
* false.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export type Copyable = Infer<typeof CopyableStruct>;
|
|
24
24
|
/**
|
|
25
25
|
* Create a {@link Copyable} component.
|
|
26
26
|
*
|
|
@@ -8,7 +8,7 @@ export declare const DividerStruct: import("@metamask/superstruct").Struct<{
|
|
|
8
8
|
/**
|
|
9
9
|
* A divider node, that renders a line between other nodes.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type Divider = Infer<typeof DividerStruct>;
|
|
12
12
|
/**
|
|
13
13
|
* Create a {@link Divider} node.
|
|
14
14
|
*
|
|
@@ -18,7 +18,7 @@ export declare const FormComponentStruct: import("@metamask/superstruct").Struct
|
|
|
18
18
|
/**
|
|
19
19
|
* The subset of nodes allowed as children in the {@link Form} node.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type FormComponent = Infer<typeof FormComponentStruct>;
|
|
22
22
|
export declare const FormStruct: import("@metamask/superstruct").Struct<{
|
|
23
23
|
type: NodeType.Form;
|
|
24
24
|
name: string;
|
|
@@ -77,7 +77,7 @@ export declare const FormStruct: import("@metamask/superstruct").Struct<{
|
|
|
77
77
|
* @property children - The children of the node. Only {@link FormComponent} nodes are allowed.
|
|
78
78
|
* @property name - The form name used to identify it.
|
|
79
79
|
*/
|
|
80
|
-
export
|
|
80
|
+
export type Form = Infer<typeof FormStruct>;
|
|
81
81
|
/**
|
|
82
82
|
* Create a {@link Form} node.
|
|
83
83
|
*
|
|
@@ -15,7 +15,7 @@ export declare const HeadingStruct: import("@metamask/superstruct").Struct<{
|
|
|
15
15
|
* @property value - The text content of the node, either as plain text, or as a
|
|
16
16
|
* markdown string.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export type Heading = Infer<typeof HeadingStruct>;
|
|
19
19
|
/**
|
|
20
20
|
* Create a {@link Heading} node.
|
|
21
21
|
*
|
|
@@ -13,7 +13,7 @@ export declare const ImageStruct: import("@metamask/superstruct").Struct<{
|
|
|
13
13
|
* @property type - The type of the node. Must be the string `image`.
|
|
14
14
|
* @property value - The SVG image to be rendered.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type Image = Infer<typeof ImageStruct>;
|
|
17
17
|
/**
|
|
18
18
|
* Create an {@link Image} node.
|
|
19
19
|
*
|
|
@@ -37,7 +37,7 @@ export declare const InputStruct: import("@metamask/superstruct").Struct<{
|
|
|
37
37
|
* @property label - An optional input label.
|
|
38
38
|
* @property error - An optional error text.
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export type Input = Infer<typeof InputStruct>;
|
|
41
41
|
/**
|
|
42
42
|
* Create a {@link Input} node.
|
|
43
43
|
*
|
|
@@ -222,7 +222,7 @@ export declare const ParentStruct: Struct<{
|
|
|
222
222
|
* @property children - The children of the node
|
|
223
223
|
* @internal
|
|
224
224
|
*/
|
|
225
|
-
export
|
|
225
|
+
export type Parent = Infer<typeof ParentStruct>;
|
|
226
226
|
/**
|
|
227
227
|
* @internal
|
|
228
228
|
*/
|
|
@@ -234,7 +234,7 @@ export declare const PanelStruct: Struct<Panel>;
|
|
|
234
234
|
* @property value - The text content of the node, either as plain text, or as a
|
|
235
235
|
* markdown string.
|
|
236
236
|
*/
|
|
237
|
-
export
|
|
237
|
+
export type Panel = {
|
|
238
238
|
type: NodeType.Panel;
|
|
239
239
|
children: Component[];
|
|
240
240
|
};
|
|
@@ -402,4 +402,4 @@ export declare const ComponentStruct: Struct<{
|
|
|
402
402
|
/**
|
|
403
403
|
* All supported component types.
|
|
404
404
|
*/
|
|
405
|
-
export
|
|
405
|
+
export type Component = Infer<typeof ComponentStruct>;
|
|
@@ -45,7 +45,7 @@ export declare const RowStruct: import("@metamask/superstruct").Struct<{
|
|
|
45
45
|
* on one side of the row.
|
|
46
46
|
* @property variant - Optional variant for styling.
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export type Row = Infer<typeof RowStruct>;
|
|
49
49
|
/**
|
|
50
50
|
* Create a {@link Row} node.
|
|
51
51
|
*
|
|
@@ -9,7 +9,7 @@ export declare const SpinnerStruct: import("@metamask/superstruct").Struct<{
|
|
|
9
9
|
* A spinner node, that renders a spinner, either as a full-screen overlay, or
|
|
10
10
|
* inline when nested inside a {@link Panel}.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type Spinner = Infer<typeof SpinnerStruct>;
|
|
13
13
|
/**
|
|
14
14
|
* Create a {@link Spinner} node.
|
|
15
15
|
*
|
|
@@ -18,7 +18,7 @@ export declare const TextStruct: import("@metamask/superstruct").Struct<{
|
|
|
18
18
|
* @property markdown - A flag to enable/disable markdown, if nothing is specified
|
|
19
19
|
* markdown will be enabled.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type Text = Infer<typeof TextStruct>;
|
|
22
22
|
/**
|
|
23
23
|
* Create a {@link Text} node.
|
|
24
24
|
*
|
package/dist/types/ui/nodes.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const NodeStruct: import("@metamask/superstruct").Struct<{
|
|
|
33
33
|
* node types.
|
|
34
34
|
* @internal
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type Node = Infer<typeof NodeStruct>;
|
|
37
37
|
/**
|
|
38
38
|
* @internal
|
|
39
39
|
*/
|
|
@@ -53,4 +53,4 @@ export declare const LiteralStruct: import("@metamask/superstruct").Struct<{
|
|
|
53
53
|
* node type.
|
|
54
54
|
* @internal
|
|
55
55
|
*/
|
|
56
|
-
export
|
|
56
|
+
export type Literal = Infer<typeof LiteralStruct>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@metamask/key-tree": "^9.1.2",
|
|
63
|
-
"@metamask/providers": "17.
|
|
63
|
+
"@metamask/providers": "^17.1.2",
|
|
64
64
|
"@metamask/rpc-errors": "^6.3.1",
|
|
65
65
|
"@metamask/superstruct": "^3.1.0",
|
|
66
66
|
"@metamask/utils": "^9.1.0"
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"rimraf": "^4.1.2",
|
|
96
96
|
"ts-jest": "^29.1.1",
|
|
97
97
|
"tsup": "^8.0.1",
|
|
98
|
-
"typescript": "~
|
|
98
|
+
"typescript": "~5.0.4"
|
|
99
99
|
},
|
|
100
100
|
"engines": {
|
|
101
101
|
"node": "^18.16 || >=20"
|