@metamask/snaps-rpc-methods 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -1
- package/dist/{chunk-MXCJWR45.mjs → chunk-2CTOCP34.mjs} +8 -8
- package/dist/chunk-2CTOCP34.mjs.map +1 -0
- package/dist/{chunk-TKXU7ZXP.mjs → chunk-2L2ATCIK.mjs} +2 -2
- package/dist/{chunk-YG7W4CDT.js → chunk-33MTKZ4H.js} +11 -4
- package/dist/chunk-33MTKZ4H.js.map +1 -0
- package/dist/{chunk-LGUJMQC7.js → chunk-4BPNRCZJ.js} +5 -4
- package/dist/chunk-4BPNRCZJ.js.map +1 -0
- package/dist/{chunk-WLDEPJGG.mjs → chunk-634BK2VP.mjs} +3 -3
- package/dist/chunk-634BK2VP.mjs.map +1 -0
- package/dist/{chunk-7OMVZR5X.mjs → chunk-CJPFADO7.mjs} +3 -3
- package/dist/{chunk-GP5KW5FU.js → chunk-D5WQBUZB.js} +2 -2
- package/dist/chunk-D5WQBUZB.js.map +1 -0
- package/dist/{chunk-IDZGMGIB.js → chunk-DLVPMPRZ.js} +8 -8
- package/dist/chunk-DLVPMPRZ.js.map +1 -0
- package/dist/{chunk-AOWUGDER.js → chunk-E27BGHCR.js} +3 -3
- package/dist/{chunk-Y4LNTDZ2.mjs → chunk-FR26QD3N.mjs} +3 -3
- package/dist/{chunk-YS6TYXCP.mjs → chunk-GVJLWGSI.mjs} +3 -3
- package/dist/chunk-GVJLWGSI.mjs.map +1 -0
- package/dist/{chunk-SU6KOIVB.mjs → chunk-I3QG3QZL.mjs} +6 -6
- package/dist/{chunk-GYZV5UBD.js → chunk-I7DR6BFO.js} +4 -4
- package/dist/chunk-I7DR6BFO.js.map +1 -0
- package/dist/{chunk-S7AR3ROH.js → chunk-IE6EHYEG.js} +3 -3
- package/dist/{chunk-Q5W3YGEB.js → chunk-IVD2ORDS.js} +3 -3
- package/dist/{chunk-IBV23QOX.mjs → chunk-KIXPIIY5.mjs} +2 -2
- package/dist/{chunk-AYJK7MSH.js → chunk-LLH2T5NT.js} +5 -5
- package/dist/{chunk-TNRH2LRU.mjs → chunk-LXJBBRQ4.mjs} +2 -2
- package/dist/{chunk-R2M4YLJ7.js → chunk-M2JQCKR7.js} +3 -3
- package/dist/{chunk-RZXF4KSR.js → chunk-O2VSIMDY.js} +11 -11
- package/dist/{chunk-EGKFC56F.js → chunk-QAKSH24Z.js} +8 -8
- package/dist/{chunk-6WUIFFMQ.mjs → chunk-R3DRYUNH.mjs} +5 -4
- package/dist/chunk-R3DRYUNH.mjs.map +1 -0
- package/dist/{chunk-JQ456NCC.mjs → chunk-S46RTIDR.mjs} +5 -5
- package/dist/{chunk-NESDQ4PF.mjs → chunk-TE4W25CA.mjs} +2 -2
- package/dist/{chunk-AMBEX4N4.mjs → chunk-TUIJOZXZ.mjs} +4 -4
- package/dist/{chunk-3LPBU737.js → chunk-UDB4MUXI.js} +2 -2
- package/dist/chunk-UDB4MUXI.js.map +1 -0
- package/dist/{chunk-6UY23OOZ.js → chunk-VBCE6VHM.js} +5 -5
- package/dist/{chunk-SGQXD5K7.mjs → chunk-W33UWNA2.mjs} +11 -4
- package/dist/chunk-W33UWNA2.mjs.map +1 -0
- package/dist/{chunk-4SQWLI2S.mjs → chunk-X247BMMW.mjs} +6 -6
- package/dist/chunk-X247BMMW.mjs.map +1 -0
- package/dist/{chunk-D6MUXDVI.js → chunk-XXSAESE7.js} +9 -9
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/dist/permissions.js +10 -10
- package/dist/permissions.mjs +9 -9
- package/dist/permitted/createInterface.js +2 -2
- package/dist/permitted/createInterface.mjs +1 -1
- package/dist/permitted/handlers.js +6 -6
- package/dist/permitted/handlers.mjs +5 -5
- package/dist/permitted/index.js +8 -8
- package/dist/permitted/index.mjs +7 -7
- package/dist/permitted/invokeKeyring.js +3 -3
- package/dist/permitted/invokeKeyring.mjs +2 -2
- package/dist/permitted/invokeSnapSugar.js +2 -2
- package/dist/permitted/invokeSnapSugar.mjs +1 -1
- package/dist/permitted/middleware.js +8 -8
- package/dist/permitted/middleware.mjs +7 -7
- package/dist/permitted/updateInterface.js +2 -2
- package/dist/permitted/updateInterface.mjs +1 -1
- package/dist/restricted/caveats/index.js +5 -5
- package/dist/restricted/caveats/index.mjs +4 -4
- package/dist/restricted/dialog.js +2 -2
- package/dist/restricted/dialog.mjs +1 -1
- package/dist/restricted/getBip32Entropy.js +3 -3
- package/dist/restricted/getBip32Entropy.mjs +2 -2
- package/dist/restricted/getBip32PublicKey.js +3 -3
- package/dist/restricted/getBip32PublicKey.mjs +2 -2
- package/dist/restricted/getEntropy.js +3 -3
- package/dist/restricted/getEntropy.mjs +2 -2
- package/dist/restricted/index.js +9 -9
- package/dist/restricted/index.mjs +8 -8
- package/dist/restricted/manageState.js +3 -3
- package/dist/restricted/manageState.mjs +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/permitted/createInterface.d.ts +41 -41
- package/dist/types/permitted/handlers.d.ts +2 -2
- package/dist/types/permitted/invokeSnapSugar.d.ts +12 -7
- package/dist/types/permitted/updateInterface.d.ts +42 -42
- package/dist/types/restricted/dialog.d.ts +316 -148
- package/dist/types/restricted/getBip32PublicKey.d.ts +2 -5
- package/dist/types/restricted/manageAccounts.d.ts +1 -1
- package/dist/types/utils.d.ts +7 -5
- package/dist/utils.js +2 -2
- package/dist/utils.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-3LPBU737.js.map +0 -1
- package/dist/chunk-4SQWLI2S.mjs.map +0 -1
- package/dist/chunk-6WUIFFMQ.mjs.map +0 -1
- package/dist/chunk-GP5KW5FU.js.map +0 -1
- package/dist/chunk-GYZV5UBD.js.map +0 -1
- package/dist/chunk-IDZGMGIB.js.map +0 -1
- package/dist/chunk-LGUJMQC7.js.map +0 -1
- package/dist/chunk-MXCJWR45.mjs.map +0 -1
- package/dist/chunk-SGQXD5K7.mjs.map +0 -1
- package/dist/chunk-WLDEPJGG.mjs.map +0 -1
- package/dist/chunk-YG7W4CDT.js.map +0 -1
- package/dist/chunk-YS6TYXCP.mjs.map +0 -1
- /package/dist/{chunk-TKXU7ZXP.mjs.map → chunk-2L2ATCIK.mjs.map} +0 -0
- /package/dist/{chunk-7OMVZR5X.mjs.map → chunk-CJPFADO7.mjs.map} +0 -0
- /package/dist/{chunk-AOWUGDER.js.map → chunk-E27BGHCR.js.map} +0 -0
- /package/dist/{chunk-Y4LNTDZ2.mjs.map → chunk-FR26QD3N.mjs.map} +0 -0
- /package/dist/{chunk-SU6KOIVB.mjs.map → chunk-I3QG3QZL.mjs.map} +0 -0
- /package/dist/{chunk-S7AR3ROH.js.map → chunk-IE6EHYEG.js.map} +0 -0
- /package/dist/{chunk-Q5W3YGEB.js.map → chunk-IVD2ORDS.js.map} +0 -0
- /package/dist/{chunk-IBV23QOX.mjs.map → chunk-KIXPIIY5.mjs.map} +0 -0
- /package/dist/{chunk-AYJK7MSH.js.map → chunk-LLH2T5NT.js.map} +0 -0
- /package/dist/{chunk-TNRH2LRU.mjs.map → chunk-LXJBBRQ4.mjs.map} +0 -0
- /package/dist/{chunk-R2M4YLJ7.js.map → chunk-M2JQCKR7.js.map} +0 -0
- /package/dist/{chunk-RZXF4KSR.js.map → chunk-O2VSIMDY.js.map} +0 -0
- /package/dist/{chunk-EGKFC56F.js.map → chunk-QAKSH24Z.js.map} +0 -0
- /package/dist/{chunk-JQ456NCC.mjs.map → chunk-S46RTIDR.mjs.map} +0 -0
- /package/dist/{chunk-NESDQ4PF.mjs.map → chunk-TE4W25CA.mjs.map} +0 -0
- /package/dist/{chunk-AMBEX4N4.mjs.map → chunk-TUIJOZXZ.mjs.map} +0 -0
- /package/dist/{chunk-6UY23OOZ.js.map → chunk-VBCE6VHM.js.map} +0 -0
- /package/dist/{chunk-D6MUXDVI.js.map → chunk-XXSAESE7.js.map} +0 -0
|
@@ -1,48 +1,16 @@
|
|
|
1
1
|
import type { PermittedHandlerExport } from '@metamask/permission-controller';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CreateInterfaceParams, CreateInterfaceResult, ComponentOrElement } from '@metamask/snaps-sdk';
|
|
3
3
|
import { type InferMatching } from '@metamask/snaps-utils';
|
|
4
4
|
export declare type CreateInterfaceMethodHooks = {
|
|
5
5
|
/**
|
|
6
6
|
* @param ui - The UI components.
|
|
7
7
|
* @returns The unique identifier of the interface.
|
|
8
8
|
*/
|
|
9
|
-
createInterface: (ui:
|
|
9
|
+
createInterface: (ui: ComponentOrElement) => Promise<string>;
|
|
10
10
|
};
|
|
11
11
|
export declare const createInterfaceHandler: PermittedHandlerExport<CreateInterfaceMethodHooks, CreateInterfaceParameters, CreateInterfaceResult>;
|
|
12
12
|
declare const CreateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
13
|
-
ui: import("@metamask/snaps-sdk").Panel | {
|
|
14
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
15
|
-
name: string;
|
|
16
|
-
value?: string | undefined;
|
|
17
|
-
error?: string | undefined;
|
|
18
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
19
|
-
placeholder?: string | undefined;
|
|
20
|
-
label?: string | undefined;
|
|
21
|
-
} | {
|
|
22
|
-
value: string;
|
|
23
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
24
|
-
name?: string | undefined;
|
|
25
|
-
variant?: "primary" | "secondary" | undefined;
|
|
26
|
-
buttonType?: "button" | "submit" | undefined;
|
|
27
|
-
} | {
|
|
28
|
-
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
29
|
-
name: string;
|
|
30
|
-
children: ({
|
|
31
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
32
|
-
name: string;
|
|
33
|
-
value?: string | undefined;
|
|
34
|
-
error?: string | undefined;
|
|
35
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
36
|
-
placeholder?: string | undefined;
|
|
37
|
-
label?: string | undefined;
|
|
38
|
-
} | {
|
|
39
|
-
value: string;
|
|
40
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
41
|
-
name?: string | undefined;
|
|
42
|
-
variant?: "primary" | "secondary" | undefined;
|
|
43
|
-
buttonType?: "button" | "submit" | undefined;
|
|
44
|
-
})[];
|
|
45
|
-
} | {
|
|
13
|
+
ui: import("@metamask/snaps-sdk/jsx-runtime").JSXElement | import("@metamask/snaps-sdk").Panel | {
|
|
46
14
|
value: string;
|
|
47
15
|
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
48
16
|
sensitive?: boolean | undefined;
|
|
@@ -78,16 +46,14 @@ declare const CreateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
78
46
|
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
79
47
|
label: string;
|
|
80
48
|
variant?: "default" | "warning" | "critical" | undefined;
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
ui: import("superstruct").Struct<import("@metamask/snaps-sdk").Panel | {
|
|
49
|
+
} | {
|
|
84
50
|
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
85
51
|
name: string;
|
|
86
52
|
value?: string | undefined;
|
|
87
53
|
error?: string | undefined;
|
|
88
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
89
54
|
placeholder?: string | undefined;
|
|
90
55
|
label?: string | undefined;
|
|
56
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
91
57
|
} | {
|
|
92
58
|
value: string;
|
|
93
59
|
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
@@ -102,9 +68,9 @@ declare const CreateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
102
68
|
name: string;
|
|
103
69
|
value?: string | undefined;
|
|
104
70
|
error?: string | undefined;
|
|
105
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
106
71
|
placeholder?: string | undefined;
|
|
107
72
|
label?: string | undefined;
|
|
73
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
108
74
|
} | {
|
|
109
75
|
value: string;
|
|
110
76
|
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
@@ -112,7 +78,9 @@ declare const CreateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
112
78
|
variant?: "primary" | "secondary" | undefined;
|
|
113
79
|
buttonType?: "button" | "submit" | undefined;
|
|
114
80
|
})[];
|
|
115
|
-
}
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
ui: import("superstruct").Struct<import("@metamask/snaps-sdk/jsx-runtime").JSXElement | import("@metamask/snaps-sdk").Panel | {
|
|
116
84
|
value: string;
|
|
117
85
|
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
118
86
|
sensitive?: boolean | undefined;
|
|
@@ -148,6 +116,38 @@ declare const CreateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
148
116
|
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
149
117
|
label: string;
|
|
150
118
|
variant?: "default" | "warning" | "critical" | undefined;
|
|
119
|
+
} | {
|
|
120
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
121
|
+
name: string;
|
|
122
|
+
value?: string | undefined;
|
|
123
|
+
error?: string | undefined;
|
|
124
|
+
placeholder?: string | undefined;
|
|
125
|
+
label?: string | undefined;
|
|
126
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
127
|
+
} | {
|
|
128
|
+
value: string;
|
|
129
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
130
|
+
name?: string | undefined;
|
|
131
|
+
variant?: "primary" | "secondary" | undefined;
|
|
132
|
+
buttonType?: "button" | "submit" | undefined;
|
|
133
|
+
} | {
|
|
134
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
135
|
+
name: string;
|
|
136
|
+
children: ({
|
|
137
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
138
|
+
name: string;
|
|
139
|
+
value?: string | undefined;
|
|
140
|
+
error?: string | undefined;
|
|
141
|
+
placeholder?: string | undefined;
|
|
142
|
+
label?: string | undefined;
|
|
143
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
144
|
+
} | {
|
|
145
|
+
value: string;
|
|
146
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
147
|
+
name?: string | undefined;
|
|
148
|
+
variant?: "primary" | "secondary" | undefined;
|
|
149
|
+
buttonType?: "button" | "submit" | undefined;
|
|
150
|
+
})[];
|
|
151
151
|
}, null>;
|
|
152
152
|
}>;
|
|
153
153
|
export declare type CreateInterfaceParameters = InferMatching<typeof CreateInterfaceParametersStruct, CreateInterfaceParams>;
|
|
@@ -2,7 +2,7 @@ export declare const methodHandlers: {
|
|
|
2
2
|
wallet_getAllSnaps: import("@metamask/permission-controller").PermittedHandlerExport<import("./getAllSnaps").GetAllSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult>;
|
|
3
3
|
wallet_getSnaps: import("@metamask/permission-controller").PermittedHandlerExport<import("./getSnaps").GetSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult>;
|
|
4
4
|
wallet_requestSnaps: import("@metamask/permission-controller").PermittedHandlerExport<import("./requestSnaps").RequestSnapsHooks, import("@metamask/snaps-sdk").RequestSnapsParams, import("@metamask/snaps-sdk").RequestSnapsResult>;
|
|
5
|
-
wallet_invokeSnap: import("@metamask/permission-controller").PermittedHandlerExport<
|
|
5
|
+
wallet_invokeSnap: import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeSnapSugar").InvokeSnapSugarHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json>;
|
|
6
6
|
wallet_invokeKeyring: import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeKeyring").InvokeKeyringHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json>;
|
|
7
7
|
snap_getClientStatus: import("@metamask/permission-controller").PermittedHandlerExport<import("./getClientStatus").GetClientStatusHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetClientStatusResult>;
|
|
8
8
|
snap_getFile: import("@metamask/permission-controller").PermittedHandlerExport<import("./getFile").GetFileHooks, import("@metamask/snaps-sdk").GetFileParams, string>;
|
|
@@ -10,4 +10,4 @@ export declare const methodHandlers: {
|
|
|
10
10
|
snap_updateInterface: import("@metamask/permission-controller").PermittedHandlerExport<import("./updateInterface").UpdateInterfaceMethodHooks, import("@metamask/snaps-sdk").UpdateInterfaceParams, null>;
|
|
11
11
|
snap_getInterfaceState: import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceState").GetInterfaceStateMethodHooks, import("@metamask/snaps-sdk").GetInterfaceStateParams, Record<string, string | Record<string, string | null> | null>>;
|
|
12
12
|
};
|
|
13
|
-
export declare const handlers: (import("@metamask/permission-controller").PermittedHandlerExport<import("./createInterface").CreateInterfaceMethodHooks, import("@metamask/snaps-sdk").CreateInterfaceParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getAllSnaps").GetAllSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getClientStatus").GetClientStatusHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetClientStatusResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceState").GetInterfaceStateMethodHooks, import("@metamask/snaps-sdk").GetInterfaceStateParams, Record<string, string | Record<string, string | null> | null>> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getSnaps").GetSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./requestSnaps").RequestSnapsHooks, import("@metamask/snaps-sdk").RequestSnapsParams, import("@metamask/snaps-sdk").RequestSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./updateInterface").UpdateInterfaceMethodHooks, import("@metamask/snaps-sdk").UpdateInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getFile").GetFileHooks, import("@metamask/snaps-sdk").GetFileParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<
|
|
13
|
+
export declare const handlers: (import("@metamask/permission-controller").PermittedHandlerExport<import("./createInterface").CreateInterfaceMethodHooks, import("@metamask/snaps-sdk").CreateInterfaceParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getAllSnaps").GetAllSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getClientStatus").GetClientStatusHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetClientStatusResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getInterfaceState").GetInterfaceStateMethodHooks, import("@metamask/snaps-sdk").GetInterfaceStateParams, Record<string, string | Record<string, string | null> | null>> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getSnaps").GetSnapsHooks, import("@metamask/utils").JsonRpcParams, import("@metamask/snaps-sdk").GetSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./requestSnaps").RequestSnapsHooks, import("@metamask/snaps-sdk").RequestSnapsParams, import("@metamask/snaps-sdk").RequestSnapsResult> | import("@metamask/permission-controller").PermittedHandlerExport<import("./updateInterface").UpdateInterfaceMethodHooks, import("@metamask/snaps-sdk").UpdateInterfaceParams, null> | import("@metamask/permission-controller").PermittedHandlerExport<import("./getFile").GetFileHooks, import("@metamask/snaps-sdk").GetFileParams, string> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeSnapSugar").InvokeSnapSugarHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json> | import("@metamask/permission-controller").PermittedHandlerExport<import("./invokeKeyring").InvokeKeyringHooks, import("@metamask/snaps-sdk").InvokeSnapParams, import("@metamask/utils").Json>)[];
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from '@metamask/json-rpc-engine';
|
|
2
2
|
import type { PermittedHandlerExport } from '@metamask/permission-controller';
|
|
3
3
|
import type { InvokeSnapParams, InvokeSnapResult } from '@metamask/snaps-sdk';
|
|
4
|
-
import type { JsonRpcRequest } from '@metamask/utils';
|
|
4
|
+
import type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';
|
|
5
5
|
/**
|
|
6
6
|
* `wallet_invokeSnap` attempts to invoke an RPC method of the specified Snap.
|
|
7
7
|
*/
|
|
8
|
-
export declare const invokeSnapSugarHandler: PermittedHandlerExport<
|
|
8
|
+
export declare const invokeSnapSugarHandler: PermittedHandlerExport<InvokeSnapSugarHooks, InvokeSnapParams, InvokeSnapResult>;
|
|
9
|
+
export declare type InvokeSnapSugarHooks = {
|
|
10
|
+
invokeSnap: (params: InvokeSnapParams) => Promise<InvokeSnapResult>;
|
|
11
|
+
};
|
|
9
12
|
/**
|
|
10
13
|
* The `wallet_invokeSnap` method implementation.
|
|
11
|
-
*
|
|
14
|
+
* Effectively calls `wallet_snap` under the hood.
|
|
12
15
|
*
|
|
13
16
|
* @param req - The JSON-RPC request object.
|
|
14
|
-
* @param
|
|
15
|
-
*
|
|
16
|
-
* @param next - The `json-rpc-engine` "next" callback.
|
|
17
|
+
* @param res - The JSON-RPC response object.
|
|
18
|
+
* @param _next - The `json-rpc-engine` "next" callback.
|
|
17
19
|
* @param end - The `json-rpc-engine` "end" callback.
|
|
20
|
+
* @param hooks - The RPC method hooks.
|
|
21
|
+
* @param hooks.invokeSnap - A function to invoke a snap designated by its parameters,
|
|
22
|
+
* bound to the requesting origin.
|
|
18
23
|
* @returns Nothing.
|
|
19
24
|
* @throws If the params are invalid.
|
|
20
25
|
*/
|
|
21
|
-
export declare function invokeSnapSugar(req: JsonRpcRequest<InvokeSnapParams>,
|
|
26
|
+
export declare function invokeSnapSugar(req: JsonRpcRequest<InvokeSnapParams>, res: PendingJsonRpcResponse<InvokeSnapResult>, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback, { invokeSnap }: InvokeSnapSugarHooks): Promise<void>;
|
|
22
27
|
/**
|
|
23
28
|
* Validates the wallet_invokeSnap method `params` and returns them cast to the correct
|
|
24
29
|
* type. Throws if validation fails.
|
|
@@ -1,49 +1,17 @@
|
|
|
1
1
|
import type { PermittedHandlerExport } from '@metamask/permission-controller';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UpdateInterfaceParams, UpdateInterfaceResult, ComponentOrElement } from '@metamask/snaps-sdk';
|
|
3
3
|
import { type InferMatching } from '@metamask/snaps-utils';
|
|
4
4
|
export declare type UpdateInterfaceMethodHooks = {
|
|
5
5
|
/**
|
|
6
6
|
* @param id - The interface ID.
|
|
7
7
|
* @param ui - The UI components.
|
|
8
8
|
*/
|
|
9
|
-
updateInterface: (id: string, ui:
|
|
9
|
+
updateInterface: (id: string, ui: ComponentOrElement) => Promise<void>;
|
|
10
10
|
};
|
|
11
11
|
export declare const updateInterfaceHandler: PermittedHandlerExport<UpdateInterfaceMethodHooks, UpdateInterfaceParameters, UpdateInterfaceResult>;
|
|
12
12
|
declare const UpdateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
13
13
|
id: string;
|
|
14
|
-
ui: import("@metamask/snaps-sdk").Panel | {
|
|
15
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
16
|
-
name: string;
|
|
17
|
-
value?: string | undefined;
|
|
18
|
-
error?: string | undefined;
|
|
19
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
20
|
-
placeholder?: string | undefined;
|
|
21
|
-
label?: string | undefined;
|
|
22
|
-
} | {
|
|
23
|
-
value: string;
|
|
24
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
25
|
-
name?: string | undefined;
|
|
26
|
-
variant?: "primary" | "secondary" | undefined;
|
|
27
|
-
buttonType?: "button" | "submit" | undefined;
|
|
28
|
-
} | {
|
|
29
|
-
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
30
|
-
name: string;
|
|
31
|
-
children: ({
|
|
32
|
-
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
33
|
-
name: string;
|
|
34
|
-
value?: string | undefined;
|
|
35
|
-
error?: string | undefined;
|
|
36
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
37
|
-
placeholder?: string | undefined;
|
|
38
|
-
label?: string | undefined;
|
|
39
|
-
} | {
|
|
40
|
-
value: string;
|
|
41
|
-
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
42
|
-
name?: string | undefined;
|
|
43
|
-
variant?: "primary" | "secondary" | undefined;
|
|
44
|
-
buttonType?: "button" | "submit" | undefined;
|
|
45
|
-
})[];
|
|
46
|
-
} | {
|
|
14
|
+
ui: import("@metamask/snaps-sdk/jsx-runtime").JSXElement | import("@metamask/snaps-sdk").Panel | {
|
|
47
15
|
value: string;
|
|
48
16
|
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
49
17
|
sensitive?: boolean | undefined;
|
|
@@ -79,17 +47,14 @@ declare const UpdateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
79
47
|
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
80
48
|
label: string;
|
|
81
49
|
variant?: "default" | "warning" | "critical" | undefined;
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
id: import("superstruct").Struct<string, null>;
|
|
85
|
-
ui: import("superstruct").Struct<import("@metamask/snaps-sdk").Panel | {
|
|
50
|
+
} | {
|
|
86
51
|
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
87
52
|
name: string;
|
|
88
53
|
value?: string | undefined;
|
|
89
54
|
error?: string | undefined;
|
|
90
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
91
55
|
placeholder?: string | undefined;
|
|
92
56
|
label?: string | undefined;
|
|
57
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
93
58
|
} | {
|
|
94
59
|
value: string;
|
|
95
60
|
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
@@ -104,9 +69,9 @@ declare const UpdateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
104
69
|
name: string;
|
|
105
70
|
value?: string | undefined;
|
|
106
71
|
error?: string | undefined;
|
|
107
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
108
72
|
placeholder?: string | undefined;
|
|
109
73
|
label?: string | undefined;
|
|
74
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
110
75
|
} | {
|
|
111
76
|
value: string;
|
|
112
77
|
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
@@ -114,7 +79,10 @@ declare const UpdateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
114
79
|
variant?: "primary" | "secondary" | undefined;
|
|
115
80
|
buttonType?: "button" | "submit" | undefined;
|
|
116
81
|
})[];
|
|
117
|
-
}
|
|
82
|
+
};
|
|
83
|
+
}, {
|
|
84
|
+
id: import("superstruct").Struct<string, null>;
|
|
85
|
+
ui: import("superstruct").Struct<import("@metamask/snaps-sdk/jsx-runtime").JSXElement | import("@metamask/snaps-sdk").Panel | {
|
|
118
86
|
value: string;
|
|
119
87
|
type: import("@metamask/snaps-sdk").NodeType.Copyable;
|
|
120
88
|
sensitive?: boolean | undefined;
|
|
@@ -150,6 +118,38 @@ declare const UpdateInterfaceParametersStruct: import("superstruct").Struct<{
|
|
|
150
118
|
type: import("@metamask/snaps-sdk").NodeType.Row;
|
|
151
119
|
label: string;
|
|
152
120
|
variant?: "default" | "warning" | "critical" | undefined;
|
|
121
|
+
} | {
|
|
122
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
123
|
+
name: string;
|
|
124
|
+
value?: string | undefined;
|
|
125
|
+
error?: string | undefined;
|
|
126
|
+
placeholder?: string | undefined;
|
|
127
|
+
label?: string | undefined;
|
|
128
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
129
|
+
} | {
|
|
130
|
+
value: string;
|
|
131
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
132
|
+
name?: string | undefined;
|
|
133
|
+
variant?: "primary" | "secondary" | undefined;
|
|
134
|
+
buttonType?: "button" | "submit" | undefined;
|
|
135
|
+
} | {
|
|
136
|
+
type: import("@metamask/snaps-sdk").NodeType.Form;
|
|
137
|
+
name: string;
|
|
138
|
+
children: ({
|
|
139
|
+
type: import("@metamask/snaps-sdk").NodeType.Input;
|
|
140
|
+
name: string;
|
|
141
|
+
value?: string | undefined;
|
|
142
|
+
error?: string | undefined;
|
|
143
|
+
placeholder?: string | undefined;
|
|
144
|
+
label?: string | undefined;
|
|
145
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
146
|
+
} | {
|
|
147
|
+
value: string;
|
|
148
|
+
type: import("@metamask/snaps-sdk").NodeType.Button;
|
|
149
|
+
name?: string | undefined;
|
|
150
|
+
variant?: "primary" | "secondary" | undefined;
|
|
151
|
+
buttonType?: "button" | "submit" | undefined;
|
|
152
|
+
})[];
|
|
153
153
|
}, null>;
|
|
154
154
|
}>;
|
|
155
155
|
export declare type UpdateInterfaceParameters = InferMatching<typeof UpdateInterfaceParametersStruct, UpdateInterfaceParams>;
|