@metamask/snaps-simulation 3.3.0 → 3.4.1
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 +17 -1
- package/dist/methods/hooks/end-trace.cjs +29 -0
- package/dist/methods/hooks/end-trace.cjs.map +1 -0
- package/dist/methods/hooks/end-trace.d.cts +9 -0
- package/dist/methods/hooks/end-trace.d.cts.map +1 -0
- package/dist/methods/hooks/end-trace.d.mts +9 -0
- package/dist/methods/hooks/end-trace.d.mts.map +1 -0
- package/dist/methods/hooks/end-trace.mjs +25 -0
- package/dist/methods/hooks/end-trace.mjs.map +1 -0
- package/dist/methods/hooks/get-snap.cjs +52 -0
- package/dist/methods/hooks/get-snap.cjs.map +1 -0
- package/dist/methods/hooks/get-snap.d.cts +11 -0
- package/dist/methods/hooks/get-snap.d.cts.map +1 -0
- package/dist/methods/hooks/get-snap.d.mts +11 -0
- package/dist/methods/hooks/get-snap.d.mts.map +1 -0
- package/dist/methods/hooks/get-snap.mjs +48 -0
- package/dist/methods/hooks/get-snap.mjs.map +1 -0
- package/dist/methods/hooks/index.cjs +5 -0
- package/dist/methods/hooks/index.cjs.map +1 -1
- package/dist/methods/hooks/index.d.cts +5 -0
- package/dist/methods/hooks/index.d.cts.map +1 -1
- package/dist/methods/hooks/index.d.mts +5 -0
- package/dist/methods/hooks/index.d.mts.map +1 -1
- package/dist/methods/hooks/index.mjs +5 -0
- package/dist/methods/hooks/index.mjs.map +1 -1
- package/dist/methods/hooks/start-trace.cjs +34 -0
- package/dist/methods/hooks/start-trace.cjs.map +1 -0
- package/dist/methods/hooks/start-trace.d.cts +9 -0
- package/dist/methods/hooks/start-trace.d.cts.map +1 -0
- package/dist/methods/hooks/start-trace.d.mts +9 -0
- package/dist/methods/hooks/start-trace.d.mts.map +1 -0
- package/dist/methods/hooks/start-trace.mjs +30 -0
- package/dist/methods/hooks/start-trace.mjs.map +1 -0
- package/dist/methods/hooks/track-error.cjs +31 -0
- package/dist/methods/hooks/track-error.cjs.map +1 -0
- package/dist/methods/hooks/track-error.d.cts +9 -0
- package/dist/methods/hooks/track-error.d.cts.map +1 -0
- package/dist/methods/hooks/track-error.d.mts +9 -0
- package/dist/methods/hooks/track-error.d.mts.map +1 -0
- package/dist/methods/hooks/track-error.mjs +27 -0
- package/dist/methods/hooks/track-error.mjs.map +1 -0
- package/dist/methods/hooks/track-event.cjs +29 -0
- package/dist/methods/hooks/track-event.cjs.map +1 -0
- package/dist/methods/hooks/track-event.d.cts +13 -0
- package/dist/methods/hooks/track-event.d.cts.map +1 -0
- package/dist/methods/hooks/track-event.d.mts +13 -0
- package/dist/methods/hooks/track-event.d.mts.map +1 -0
- package/dist/methods/hooks/track-event.mjs +25 -0
- package/dist/methods/hooks/track-event.mjs.map +1 -0
- package/dist/request.cjs +21 -1
- package/dist/request.cjs.map +1 -1
- package/dist/request.d.cts.map +1 -1
- package/dist/request.d.mts.map +1 -1
- package/dist/request.mjs +22 -2
- package/dist/request.mjs.map +1 -1
- package/dist/simulation.cjs +6 -1
- package/dist/simulation.cjs.map +1 -1
- package/dist/simulation.d.cts +34 -2
- package/dist/simulation.d.cts.map +1 -1
- package/dist/simulation.d.mts +34 -2
- package/dist/simulation.d.mts.map +1 -1
- package/dist/simulation.mjs +7 -2
- package/dist/simulation.mjs.map +1 -1
- package/dist/store/index.cjs +1 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +1 -0
- package/dist/store/index.d.cts.map +1 -1
- package/dist/store/index.d.mts +1 -0
- package/dist/store/index.d.mts.map +1 -1
- package/dist/store/index.mjs +1 -0
- package/dist/store/index.mjs.map +1 -1
- package/dist/store/mocks.d.cts +1 -0
- package/dist/store/mocks.d.cts.map +1 -1
- package/dist/store/mocks.d.mts +1 -0
- package/dist/store/mocks.d.mts.map +1 -1
- package/dist/store/notifications.d.cts +1 -0
- package/dist/store/notifications.d.cts.map +1 -1
- package/dist/store/notifications.d.mts +1 -0
- package/dist/store/notifications.d.mts.map +1 -1
- package/dist/store/state.d.cts +2 -0
- package/dist/store/state.d.cts.map +1 -1
- package/dist/store/state.d.mts +2 -0
- package/dist/store/state.d.mts.map +1 -1
- package/dist/store/store.cjs +2 -0
- package/dist/store/store.cjs.map +1 -1
- package/dist/store/store.d.cts +1 -0
- package/dist/store/store.d.cts.map +1 -1
- package/dist/store/store.d.mts +1 -0
- package/dist/store/store.d.mts.map +1 -1
- package/dist/store/store.mjs +2 -0
- package/dist/store/store.mjs.map +1 -1
- package/dist/store/trackables.cjs +70 -0
- package/dist/store/trackables.cjs.map +1 -0
- package/dist/store/trackables.d.cts +98 -0
- package/dist/store/trackables.d.cts.map +1 -0
- package/dist/store/trackables.d.mts +98 -0
- package/dist/store/trackables.d.mts.map +1 -0
- package/dist/store/trackables.mjs +67 -0
- package/dist/store/trackables.mjs.map +1 -0
- package/dist/store/ui.d.cts +1 -0
- package/dist/store/ui.d.cts.map +1 -1
- package/dist/store/ui.d.mts +1 -0
- package/dist/store/ui.d.mts.map +1 -1
- package/dist/structs.cjs +17 -0
- package/dist/structs.cjs.map +1 -1
- package/dist/structs.d.cts +182 -12
- package/dist/structs.d.cts.map +1 -1
- package/dist/structs.d.mts +182 -12
- package/dist/structs.d.mts.map +1 -1
- package/dist/structs.mjs +18 -1
- package/dist/structs.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +11 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +11 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +8 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackables.d.cts","sourceRoot":"","sources":["../../src/store/trackables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,4BAA4B;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAMtD,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvB;;OAEG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B,CAAC;AAYF,eAAO,MAAM,eAAe;iGAII,cAAc,YAAY,CAAC;iGAG3B,cAAc,YAAY,CAAC;iGAG3B,cAAc,YAAY,CAAC;+FAI7B,cAAc,cAAc,CAAC;;gBAoBzD,CAAC;AAEH,eAAO,MAAQ,UAAU,8HAAE,UAAU;;;;6BAAE,UAAU,8FAAE,QAAQ,6HAAE,eAAe,sFACnD,CAAC;AAE1B;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAGrB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAGrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAGrB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { EndTraceParams, TraceRequest, TrackErrorParams, TrackEventParams } from "@metamask/snaps-sdk";
|
|
2
|
+
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
3
|
+
export type TrackedEvent = TrackEventParams['event'];
|
|
4
|
+
export type TrackedError = TrackErrorParams['error'];
|
|
5
|
+
/**
|
|
6
|
+
* The trackables state.
|
|
7
|
+
*/
|
|
8
|
+
export type TrackablesState = {
|
|
9
|
+
/**
|
|
10
|
+
* An array of tracked events.
|
|
11
|
+
*/
|
|
12
|
+
events: TrackedEvent[];
|
|
13
|
+
/**
|
|
14
|
+
* An array of tracked errors.
|
|
15
|
+
*/
|
|
16
|
+
errors: TrackedError[];
|
|
17
|
+
/**
|
|
18
|
+
* An array of performance traces.
|
|
19
|
+
*/
|
|
20
|
+
traces: TraceRequest[];
|
|
21
|
+
/**
|
|
22
|
+
* An array of pending traces that have not yet been ended.
|
|
23
|
+
*/
|
|
24
|
+
pendingTraces: TraceRequest[];
|
|
25
|
+
};
|
|
26
|
+
export declare const trackablesSlice: import("@reduxjs/toolkit").Slice<TrackablesState, {
|
|
27
|
+
trackError: (state: import("immer/dist/internal.js").WritableDraft<TrackablesState>, action: PayloadAction<TrackedError>) => void;
|
|
28
|
+
trackEvent: (state: import("immer/dist/internal.js").WritableDraft<TrackablesState>, action: PayloadAction<TrackedEvent>) => void;
|
|
29
|
+
startTrace: (state: import("immer/dist/internal.js").WritableDraft<TrackablesState>, action: PayloadAction<TraceRequest>) => void;
|
|
30
|
+
endTrace: (state: import("immer/dist/internal.js").WritableDraft<TrackablesState>, action: PayloadAction<EndTraceParams>) => void;
|
|
31
|
+
clearTrackables: (state: import("immer/dist/internal.js").WritableDraft<TrackablesState>) => void;
|
|
32
|
+
}, "trackables">;
|
|
33
|
+
export declare const trackError: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("@metamask/snaps-sdk").TrackableError, "trackables/trackError">, trackEvent: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
34
|
+
event: string;
|
|
35
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
36
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
37
|
+
}, "trackables/trackEvent">, startTrace: import("@reduxjs/toolkit").ActionCreatorWithPayload<TraceRequest, "trackables/startTrace">, endTrace: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("@metamask/snaps-sdk").EndTraceRequest, "trackables/endTrace">, clearTrackables: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"trackables/clearTrackables">;
|
|
38
|
+
/**
|
|
39
|
+
* Get the errors from the state.
|
|
40
|
+
*
|
|
41
|
+
* @param state - The application state.
|
|
42
|
+
* @returns An array of errors.
|
|
43
|
+
*/
|
|
44
|
+
export declare const getErrors: ((state: {
|
|
45
|
+
mocks: import("./mocks.mjs").MocksState;
|
|
46
|
+
notifications: import("./notifications.mjs").NotificationsState;
|
|
47
|
+
state: import("./state.mjs").State;
|
|
48
|
+
trackables: TrackablesState;
|
|
49
|
+
ui: import("./ui.mjs").UiState;
|
|
50
|
+
}) => import("@metamask/snaps-sdk").TrackableError[]) & import("reselect").OutputSelectorFields<(args_0: TrackablesState) => import("@metamask/snaps-sdk").TrackableError[], {
|
|
51
|
+
clearCache: () => void;
|
|
52
|
+
}> & {
|
|
53
|
+
clearCache: () => void;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Get the events from the state.
|
|
57
|
+
*
|
|
58
|
+
* @param state - The application state.
|
|
59
|
+
* @returns An array of events.
|
|
60
|
+
*/
|
|
61
|
+
export declare const getEvents: ((state: {
|
|
62
|
+
mocks: import("./mocks.mjs").MocksState;
|
|
63
|
+
notifications: import("./notifications.mjs").NotificationsState;
|
|
64
|
+
state: import("./state.mjs").State;
|
|
65
|
+
trackables: TrackablesState;
|
|
66
|
+
ui: import("./ui.mjs").UiState;
|
|
67
|
+
}) => {
|
|
68
|
+
event: string;
|
|
69
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
70
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
71
|
+
}[]) & import("reselect").OutputSelectorFields<(args_0: TrackablesState) => {
|
|
72
|
+
event: string;
|
|
73
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
74
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
75
|
+
}[], {
|
|
76
|
+
clearCache: () => void;
|
|
77
|
+
}> & {
|
|
78
|
+
clearCache: () => void;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Get the traces from the state. This only includes traces that have been
|
|
82
|
+
* ended, not pending traces.
|
|
83
|
+
*
|
|
84
|
+
* @param state - The application state.
|
|
85
|
+
* @returns An array of traces.
|
|
86
|
+
*/
|
|
87
|
+
export declare const getTraces: ((state: {
|
|
88
|
+
mocks: import("./mocks.mjs").MocksState;
|
|
89
|
+
notifications: import("./notifications.mjs").NotificationsState;
|
|
90
|
+
state: import("./state.mjs").State;
|
|
91
|
+
trackables: TrackablesState;
|
|
92
|
+
ui: import("./ui.mjs").UiState;
|
|
93
|
+
}) => TraceRequest[]) & import("reselect").OutputSelectorFields<(args_0: TrackablesState) => TraceRequest[], {
|
|
94
|
+
clearCache: () => void;
|
|
95
|
+
}> & {
|
|
96
|
+
clearCache: () => void;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=trackables.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackables.d.mts","sourceRoot":"","sources":["../../src/store/trackables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,4BAA4B;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAMtD,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvB;;OAEG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B,CAAC;AAYF,eAAO,MAAM,eAAe;iGAII,cAAc,YAAY,CAAC;iGAG3B,cAAc,YAAY,CAAC;iGAG3B,cAAc,YAAY,CAAC;+FAI7B,cAAc,cAAc,CAAC;;gBAoBzD,CAAC;AAEH,eAAO,MAAQ,UAAU,8HAAE,UAAU;;;;6BAAE,UAAU,8FAAE,QAAQ,6HAAE,eAAe,sFACnD,CAAC;AAE1B;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAGrB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAGrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAGrB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import $reduxjstoolkit from "@reduxjs/toolkit";
|
|
2
|
+
const { createSelector, createSlice } = $reduxjstoolkit;
|
|
3
|
+
import { castDraft } from "immer";
|
|
4
|
+
/**
|
|
5
|
+
* The initial events state.
|
|
6
|
+
*/
|
|
7
|
+
const INITIAL_STATE = {
|
|
8
|
+
events: [],
|
|
9
|
+
errors: [],
|
|
10
|
+
traces: [],
|
|
11
|
+
pendingTraces: [],
|
|
12
|
+
};
|
|
13
|
+
export const trackablesSlice = createSlice({
|
|
14
|
+
name: 'trackables',
|
|
15
|
+
initialState: INITIAL_STATE,
|
|
16
|
+
reducers: {
|
|
17
|
+
trackError: (state, action) => {
|
|
18
|
+
state.errors.push(castDraft(action.payload));
|
|
19
|
+
},
|
|
20
|
+
trackEvent: (state, action) => {
|
|
21
|
+
state.events.push(castDraft(action.payload));
|
|
22
|
+
},
|
|
23
|
+
startTrace: (state, action) => {
|
|
24
|
+
const trace = castDraft(action.payload);
|
|
25
|
+
state.pendingTraces.push(trace);
|
|
26
|
+
},
|
|
27
|
+
endTrace: (state, action) => {
|
|
28
|
+
const endTrace = castDraft(action.payload);
|
|
29
|
+
const index = state.pendingTraces.findLastIndex((pendingTrace) => pendingTrace.id === endTrace.id &&
|
|
30
|
+
pendingTrace.name === endTrace.name);
|
|
31
|
+
if (index !== -1) {
|
|
32
|
+
const pendingTrace = state.pendingTraces[index];
|
|
33
|
+
state.pendingTraces.splice(index, 1);
|
|
34
|
+
state.traces.push(pendingTrace);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
clearTrackables: (state) => {
|
|
38
|
+
state.events = [];
|
|
39
|
+
state.errors = [];
|
|
40
|
+
state.traces = [];
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
export const { trackError, trackEvent, startTrace, endTrace, clearTrackables } = trackablesSlice.actions;
|
|
45
|
+
/**
|
|
46
|
+
* Get the errors from the state.
|
|
47
|
+
*
|
|
48
|
+
* @param state - The application state.
|
|
49
|
+
* @returns An array of errors.
|
|
50
|
+
*/
|
|
51
|
+
export const getErrors = createSelector((state) => state.trackables, ({ errors }) => errors);
|
|
52
|
+
/**
|
|
53
|
+
* Get the events from the state.
|
|
54
|
+
*
|
|
55
|
+
* @param state - The application state.
|
|
56
|
+
* @returns An array of events.
|
|
57
|
+
*/
|
|
58
|
+
export const getEvents = createSelector((state) => state.trackables, ({ events }) => events);
|
|
59
|
+
/**
|
|
60
|
+
* Get the traces from the state. This only includes traces that have been
|
|
61
|
+
* ended, not pending traces.
|
|
62
|
+
*
|
|
63
|
+
* @param state - The application state.
|
|
64
|
+
* @returns An array of traces.
|
|
65
|
+
*/
|
|
66
|
+
export const getTraces = createSelector((state) => state.trackables, ({ traces }) => traces);
|
|
67
|
+
//# sourceMappingURL=trackables.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackables.mjs","sourceRoot":"","sources":["../../src/store/trackables.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,SAAS,EAAE,cAAc;AAiClC;;GAEG;AACH,MAAM,aAAa,GAAoB;IACrC,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;IACzC,IAAI,EAAE,YAA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YAClB,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;YAClB,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;QACpB,CAAC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,GAC5E,eAAe,CAAC,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,cAAc,CACrC,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,EAC7C,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,cAAc,CACrC,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,EAC7C,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CACvB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,cAAc,CACrC,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,EAC7C,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CACvB,CAAC","sourcesContent":["import type {\n EndTraceParams,\n TraceRequest,\n TrackErrorParams,\n TrackEventParams,\n} from '@metamask/snaps-sdk';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSelector, createSlice } from '@reduxjs/toolkit';\nimport { castDraft } from 'immer';\n\nimport type { ApplicationState } from './store';\n\nexport type TrackedEvent = TrackEventParams['event'];\n\nexport type TrackedError = TrackErrorParams['error'];\n\n/**\n * The trackables state.\n */\nexport type TrackablesState = {\n /**\n * An array of tracked events.\n */\n events: TrackedEvent[];\n\n /**\n * An array of tracked errors.\n */\n errors: TrackedError[];\n\n /**\n * An array of performance traces.\n */\n traces: TraceRequest[];\n\n /**\n * An array of pending traces that have not yet been ended.\n */\n pendingTraces: TraceRequest[];\n};\n\n/**\n * The initial events state.\n */\nconst INITIAL_STATE: TrackablesState = {\n events: [],\n errors: [],\n traces: [],\n pendingTraces: [],\n};\n\nexport const trackablesSlice = createSlice({\n name: 'trackables',\n initialState: INITIAL_STATE,\n reducers: {\n trackError: (state, action: PayloadAction<TrackedError>) => {\n state.errors.push(castDraft(action.payload));\n },\n trackEvent: (state, action: PayloadAction<TrackedEvent>) => {\n state.events.push(castDraft(action.payload));\n },\n startTrace: (state, action: PayloadAction<TraceRequest>) => {\n const trace = castDraft(action.payload);\n state.pendingTraces.push(trace);\n },\n endTrace: (state, action: PayloadAction<EndTraceParams>) => {\n const endTrace = castDraft(action.payload);\n const index = state.pendingTraces.findLastIndex(\n (pendingTrace) =>\n pendingTrace.id === endTrace.id &&\n pendingTrace.name === endTrace.name,\n );\n\n if (index !== -1) {\n const pendingTrace = state.pendingTraces[index];\n state.pendingTraces.splice(index, 1);\n state.traces.push(pendingTrace);\n }\n },\n clearTrackables: (state) => {\n state.events = [];\n state.errors = [];\n state.traces = [];\n },\n },\n});\n\nexport const { trackError, trackEvent, startTrace, endTrace, clearTrackables } =\n trackablesSlice.actions;\n\n/**\n * Get the errors from the state.\n *\n * @param state - The application state.\n * @returns An array of errors.\n */\nexport const getErrors = createSelector(\n (state: ApplicationState) => state.trackables,\n ({ errors }) => errors,\n);\n\n/**\n * Get the events from the state.\n *\n * @param state - The application state.\n * @returns An array of events.\n */\nexport const getEvents = createSelector(\n (state: ApplicationState) => state.trackables,\n ({ events }) => events,\n);\n\n/**\n * Get the traces from the state. This only includes traces that have been\n * ended, not pending traces.\n *\n * @param state - The application state.\n * @returns An array of traces.\n */\nexport const getTraces = createSelector(\n (state: ApplicationState) => state.trackables,\n ({ traces }) => traces,\n);\n"]}
|
package/dist/store/ui.d.cts
CHANGED
|
@@ -18,6 +18,7 @@ export declare const getCurrentInterface: ((state: {
|
|
|
18
18
|
mocks: import("./mocks.cjs").MocksState;
|
|
19
19
|
notifications: import("./notifications.cjs").NotificationsState;
|
|
20
20
|
state: import("./state.cjs").State;
|
|
21
|
+
trackables: import("./trackables.cjs").TrackablesState;
|
|
21
22
|
ui: UiState;
|
|
22
23
|
}) => Interface | null | undefined) & import("reselect").OutputSelectorFields<(args_0: UiState) => Interface | null | undefined, {
|
|
23
24
|
clearCache: () => void;
|
package/dist/store/ui.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.cts","sourceRoot":"","sources":["../../src/store/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,4BAA4B;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,mBAAmB,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,cAAc,CAAC;IACnE,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5B,CAAC;AAMF,eAAO,MAAM,OAAO;yFAIY,cAAc,SAAS,CAAC;;QAOtD,CAAC;AAEH,eAAO,MAAM,gBAAgB,0EAE5B,CAAC;AAEF,eAAO,MAAQ,YAAY,qFAAE,cAAc,6EAAoB,CAAC;AAEhE,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"ui.d.cts","sourceRoot":"","sources":["../../src/store/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,4BAA4B;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,mBAAmB,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,cAAc,CAAC;IACnE,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5B,CAAC;AAMF,eAAO,MAAM,OAAO;yFAIY,cAAc,SAAS,CAAC;;QAOtD,CAAC;AAEH,eAAO,MAAM,gBAAgB,0EAE5B,CAAC;AAEF,eAAO,MAAQ,YAAY,qFAAE,cAAc,6EAAoB,CAAC;AAEhE,eAAO,MAAM,mBAAmB;;;;;;;;;;CAG/B,CAAC"}
|
package/dist/store/ui.d.mts
CHANGED
|
@@ -18,6 +18,7 @@ export declare const getCurrentInterface: ((state: {
|
|
|
18
18
|
mocks: import("./mocks.mjs").MocksState;
|
|
19
19
|
notifications: import("./notifications.mjs").NotificationsState;
|
|
20
20
|
state: import("./state.mjs").State;
|
|
21
|
+
trackables: import("./trackables.mjs").TrackablesState;
|
|
21
22
|
ui: UiState;
|
|
22
23
|
}) => Interface | null | undefined) & import("reselect").OutputSelectorFields<(args_0: UiState) => Interface | null | undefined, {
|
|
23
24
|
clearCache: () => void;
|
package/dist/store/ui.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.mts","sourceRoot":"","sources":["../../src/store/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,4BAA4B;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,mBAAmB,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,cAAc,CAAC;IACnE,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5B,CAAC;AAMF,eAAO,MAAM,OAAO;yFAIY,cAAc,SAAS,CAAC;;QAOtD,CAAC;AAEH,eAAO,MAAM,gBAAgB,0EAE5B,CAAC;AAEF,eAAO,MAAQ,YAAY,qFAAE,cAAc,6EAAoB,CAAC;AAEhE,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"ui.d.mts","sourceRoot":"","sources":["../../src/store/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,4BAA4B;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB;AAKtD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,mBAAmB,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,cAAc,CAAC;IACnE,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5B,CAAC;AAMF,eAAO,MAAM,OAAO;yFAIY,cAAc,SAAS,CAAC;;QAOtD,CAAC;AAEH,eAAO,MAAM,gBAAgB,0EAE5B,CAAC;AAEF,eAAO,MAAQ,YAAY,qFAAE,cAAc,6EAAoB,CAAC;AAEhE,eAAO,MAAM,mBAAmB;;;;;;;;;;CAG/B,CAAC"}
|
package/dist/structs.cjs
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsResponseWithInterface = exports.SnapResponseStruct = exports.SnapResponseWithInterfaceStruct = exports.SnapResponseWithoutInterfaceStruct = exports.InterfaceStruct = exports.JsonRpcMockOptionsStruct = exports.SnapOptionsStruct = exports.NameLookupOptionsStruct = exports.BaseNameLookupOptionsStruct = exports.SignatureOptionsStruct = exports.TransactionOptionsStruct = void 0;
|
|
4
4
|
const snaps_sdk_1 = require("@metamask/snaps-sdk");
|
|
5
5
|
const jsx_1 = require("@metamask/snaps-sdk/jsx");
|
|
6
|
+
const snaps_utils_1 = require("@metamask/snaps-utils");
|
|
6
7
|
const superstruct_1 = require("@metamask/superstruct");
|
|
7
8
|
const utils_1 = require("@metamask/utils");
|
|
8
9
|
const crypto_1 = require("crypto");
|
|
@@ -171,6 +172,22 @@ exports.SnapResponseWithoutInterfaceStruct = (0, superstruct_1.object)({
|
|
|
171
172
|
text: (0, superstruct_1.string)(),
|
|
172
173
|
})),
|
|
173
174
|
})),
|
|
175
|
+
tracked: (0, superstruct_1.object)({
|
|
176
|
+
errors: (0, superstruct_1.array)(snaps_utils_1.TrackableErrorStruct),
|
|
177
|
+
events: (0, superstruct_1.array)((0, superstruct_1.object)({
|
|
178
|
+
event: (0, superstruct_1.string)(),
|
|
179
|
+
properties: (0, superstruct_1.optional)((0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)),
|
|
180
|
+
sensitiveProperties: (0, superstruct_1.optional)((0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)),
|
|
181
|
+
})),
|
|
182
|
+
traces: (0, superstruct_1.array)((0, superstruct_1.object)({
|
|
183
|
+
id: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
184
|
+
name: (0, superstruct_1.string)(),
|
|
185
|
+
parentContext: (0, superstruct_1.optional)(utils_1.JsonStruct),
|
|
186
|
+
startTime: (0, superstruct_1.optional)((0, superstruct_1.number)()),
|
|
187
|
+
data: (0, superstruct_1.optional)((0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.boolean)()]))),
|
|
188
|
+
tags: (0, superstruct_1.optional)((0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.boolean)()]))),
|
|
189
|
+
})),
|
|
190
|
+
}),
|
|
174
191
|
});
|
|
175
192
|
exports.SnapResponseWithInterfaceStruct = (0, superstruct_1.assign)(exports.SnapResponseWithoutInterfaceStruct, (0, superstruct_1.object)({
|
|
176
193
|
getInterface: (0, superstruct_1.func)(),
|
package/dist/structs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structs.cjs","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAClE,iDAA2D;AAC3D,uDAiB+B;AAC/B,2CAMyB;AACzB,mCAAqC;AAIrC,oDAAoD;AACpD,MAAM,eAAe,GAAG,IAAA,mBAAK,EAAC;IAC5B,IAAA,oBAAM,GAAE;IACR,IAAA,oBAAM,GAAE;IACR,IAAA,oBAAM,GAAE;IACR,IAAA,sBAAQ,EAAC,UAAU,CAAC;CACrB,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,IAAA,oBAAM,EAAC;IAC7C;;OAEG;IACH,OAAO,EAAE,IAAA,uBAAS,EAAC,IAAA,oBAAM,GAAE,EAAE,UAAU,CAAC;IAExC;;OAEG;IACH,MAAM,EAAE,IAAA,uBAAS,EAAC,IAAA,oBAAM,GAAE,EAAE,aAAa,CAAC;IAE1C;;;OAGG;IACH,gDAAgD;IAChD,IAAI,EAAE,IAAA,oBAAM,EAAC,uBAAe,EAAE,IAAA,sBAAQ,EAAC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;QACjE,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAA,kBAAU,EAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,IAAA,kBAAU,EAAC,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF;;;OAGG;IACH,gDAAgD;IAChD,EAAE,EAAE,IAAA,oBAAM,EAAC,uBAAe,EAAE,IAAA,sBAAQ,EAAC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;QAC/D,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAA,kBAAU,EAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC,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kBAAU;SAClB,CAAC;KACH,CAAC;IAEF,aAAa,EAAE,IAAA,mBAAK,EAClB,IAAA,oBAAM,EAAC;QACL,EAAE,EAAE,IAAA,oBAAM,GAAE;QACZ,OAAO,EAAE,IAAA,oBAAM,GAAE;QACjB,IAAI,EAAE,IAAA,mBAAK,EAAC;YACV,IAAA,qBAAS,EAAC,4BAAgB,CAAC,KAAK,CAAC;YACjC,IAAA,qBAAS,EAAC,4BAAgB,CAAC,MAAM,CAAC;SACnC,CAAC;QACF,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;QACzB,OAAO,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC3B,UAAU,EAAE,IAAA,sBAAQ,EAClB,IAAA,oBAAM,EAAC;YACL,IAAI,EAAE,IAAA,oBAAM,GAAE;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;KACF,CAAC,CACH;CACF,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EACnD,0CAAkC,EAClC,IAAA,oBAAM,EAAC;IACL,YAAY,EAAE,IAAA,kBAAI,GAAE;CACrB,CAAC,CACH,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAA,mBAAK,EAAC;IACtC,0CAAkC;IAClC,uCAA+B;CAChC,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAgB,6BAA6B,CAC3C,QAAsB;IAEtB,IAAA,oBAAY,EAAC,QAAQ,EAAE,uCAA+B,CAAC,CAAC;AAC1D,CAAC;AAJD,sEAIC","sourcesContent":["import { NotificationType, enumValue } from '@metamask/snaps-sdk';\nimport { JSXElementStruct } from '@metamask/snaps-sdk/jsx';\nimport {\n array,\n assign,\n bigint,\n coerce,\n defaulted,\n instance,\n literal,\n number,\n object,\n optional,\n string,\n union,\n record,\n any,\n func,\n type,\n} from '@metamask/superstruct';\nimport {\n assertStruct,\n bytesToHex,\n JsonStruct,\n StrictHexStruct,\n valueToBytes,\n} from '@metamask/utils';\nimport { randomBytes } from 'crypto';\n\nimport type { SnapResponse, SnapResponseWithInterface } from './types';\n\n// TODO: Export this from `@metamask/utils` instead.\nconst BytesLikeStruct = union([\n bigint(),\n number(),\n string(),\n instance(Uint8Array),\n]);\n\nexport const TransactionOptionsStruct = object({\n /**\n * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.\n */\n chainId: defaulted(string(), 'eip155:1'),\n\n /**\n * The origin to send the transaction from. Defaults to `metamask.io`.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address to send the transaction from. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The address to send the transaction to. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n to: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The value to send with the transaction. The value may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n value: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x0',\n ),\n\n /**\n * The gas limit to use for the transaction. The gas limit may be specified\n * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.\n */\n gasLimit: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(21_000),\n ),\n\n /**\n * The max fee per gas (in Wei) to use for the transaction. The max fee per\n * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.\n * Defaults to `1`.\n */\n maxFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The max priority fee per gas (in Wei) to use for the transaction. The max\n * priority fee per gas may be specified as a `number`, `bigint`, `string`,\n * or `Uint8Array`. Defaults to `1`.\n */\n maxPriorityFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The nonce to use for the transaction. The nonce may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n nonce: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(0),\n ),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.\n */\n data: defaulted(\n coerce(union([StrictHexStruct, literal('0x')]), BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x',\n ),\n});\n\nexport const SignatureOptionsStruct = object({\n /**\n * The origin making the signature request.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address signing the signature request. Defaults to a randomly generated\n * address.\n */\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `string`, an object, or an array of objects. This covers the data types\n * for the supported signature methods. Defaults to `0x`.\n */\n data: defaulted(\n union([\n StrictHexStruct,\n literal('0x'),\n record(string(), any()),\n array(record(string(), any())),\n ]),\n '0x',\n ),\n\n /**\n * The signature method being used.\n */\n signatureMethod: defaulted(\n union([\n literal('personal_sign'),\n literal('eth_signTypedData'),\n literal('eth_signTypedData_v3'),\n literal('eth_signTypedData_v4'),\n ]),\n 'personal_sign',\n ),\n});\n\nexport const BaseNameLookupOptionsStruct = object({\n /**\n * The CAIP-2 chain ID. Defaults to `eip155:1`.\n */\n chainId: defaulted(string(), 'eip155:1'),\n});\n\nexport const NameLookupOptionsStruct = union([\n assign(\n BaseNameLookupOptionsStruct,\n object({\n /**\n * Address to lookup.\n */\n address: string(),\n }),\n ),\n assign(\n BaseNameLookupOptionsStruct,\n object({\n /**\n * Domain name to lookup.\n */\n domain: string(),\n }),\n ),\n]);\n\nexport const SnapOptionsStruct = object({\n /**\n * The timeout in milliseconds to use for requests to the snap. Defaults to\n * `1000`.\n */\n timeout: defaulted(optional(number()), 1000),\n});\n\nexport const JsonRpcMockOptionsStruct = object({\n method: string(),\n result: JsonStruct,\n});\n\nexport const InterfaceStruct = type({\n content: optional(JSXElementStruct),\n});\n\nexport const SnapResponseWithoutInterfaceStruct = object({\n id: string(),\n\n response: union([\n object({\n result: JsonStruct,\n }),\n object({\n error: JsonStruct,\n }),\n ]),\n\n notifications: array(\n object({\n id: string(),\n message: string(),\n type: union([\n enumValue(NotificationType.InApp),\n enumValue(NotificationType.Native),\n ]),\n title: optional(string()),\n content: optional(string()),\n footerLink: optional(\n object({\n href: string(),\n text: string(),\n }),\n ),\n }),\n ),\n});\n\nexport const SnapResponseWithInterfaceStruct = assign(\n SnapResponseWithoutInterfaceStruct,\n object({\n getInterface: func(),\n }),\n);\n\nexport const SnapResponseStruct = union([\n SnapResponseWithoutInterfaceStruct,\n SnapResponseWithInterfaceStruct,\n]);\n\n/**\n * Ensure that the actual response contains `getInterface`.\n *\n * @param response - The response of the handler.\n */\nexport function assertIsResponseWithInterface(\n response: SnapResponse,\n): asserts response is SnapResponseWithInterface {\n assertStruct(response, SnapResponseWithInterfaceStruct);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"structs.cjs","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAClE,iDAA2D;AAC3D,uDAA6D;AAC7D,uDAkB+B;AAC/B,2CAMyB;AACzB,mCAAqC;AAIrC,oDAAoD;AACpD,MAAM,eAAe,GAAG,IAAA,mBAAK,EAAC;IAC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C,IAAA,oBAAM,GAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,GAAE,CAAC,CAAC,CAAC,CACzD;SACF,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EACnD,0CAAkC,EAClC,IAAA,oBAAM,EAAC;IACL,YAAY,EAAE,IAAA,kBAAI,GAAE;CACrB,CAAC,CACH,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAA,mBAAK,EAAC;IACtC,0CAAkC;IAClC,uCAA+B;CAChC,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAgB,6BAA6B,CAC3C,QAAsB;IAEtB,IAAA,oBAAY,EAAC,QAAQ,EAAE,uCAA+B,CAAC,CAAC;AAC1D,CAAC;AAJD,sEAIC","sourcesContent":["import { NotificationType, enumValue } from '@metamask/snaps-sdk';\nimport { JSXElementStruct } from '@metamask/snaps-sdk/jsx';\nimport { TrackableErrorStruct } from '@metamask/snaps-utils';\nimport {\n array,\n assign,\n bigint,\n coerce,\n defaulted,\n instance,\n literal,\n number,\n object,\n optional,\n string,\n union,\n record,\n any,\n func,\n type,\n boolean,\n} from '@metamask/superstruct';\nimport {\n assertStruct,\n bytesToHex,\n JsonStruct,\n StrictHexStruct,\n valueToBytes,\n} from '@metamask/utils';\nimport { randomBytes } from 'crypto';\n\nimport type { SnapResponse, SnapResponseWithInterface } from './types';\n\n// TODO: Export this from `@metamask/utils` instead.\nconst BytesLikeStruct = union([\n bigint(),\n number(),\n string(),\n instance(Uint8Array),\n]);\n\nexport const TransactionOptionsStruct = object({\n /**\n * The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.\n */\n chainId: defaulted(string(), 'eip155:1'),\n\n /**\n * The origin to send the transaction from. Defaults to `metamask.io`.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address to send the transaction from. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The address to send the transaction to. Defaults to a randomly generated\n * address.\n */\n // TODO: Move this coercer to `@metamask/utils`.\n to: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The value to send with the transaction. The value may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n value: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x0',\n ),\n\n /**\n * The gas limit to use for the transaction. The gas limit may be specified\n * as a `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `21_000`.\n */\n gasLimit: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(21_000),\n ),\n\n /**\n * The max fee per gas (in Wei) to use for the transaction. The max fee per\n * gas may be specified as a `number`, `bigint`, `string`, or `Uint8Array`.\n * Defaults to `1`.\n */\n maxFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The max priority fee per gas (in Wei) to use for the transaction. The max\n * priority fee per gas may be specified as a `number`, `bigint`, `string`,\n * or `Uint8Array`. Defaults to `1`.\n */\n maxPriorityFeePerGas: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(1),\n ),\n\n /**\n * The nonce to use for the transaction. The nonce may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0`.\n */\n nonce: defaulted(\n coerce(StrictHexStruct, BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n valueToBytes(0),\n ),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `number`, `bigint`, `string`, or `Uint8Array`. Defaults to `0x`.\n */\n data: defaulted(\n coerce(union([StrictHexStruct, literal('0x')]), BytesLikeStruct, (value) =>\n bytesToHex(valueToBytes(value)),\n ),\n '0x',\n ),\n});\n\nexport const SignatureOptionsStruct = object({\n /**\n * The origin making the signature request.\n */\n origin: defaulted(string(), 'metamask.io'),\n\n /**\n * The address signing the signature request. Defaults to a randomly generated\n * address.\n */\n from: coerce(StrictHexStruct, optional(BytesLikeStruct), (value) => {\n if (value) {\n return bytesToHex(valueToBytes(value));\n }\n\n return bytesToHex(randomBytes(20));\n }),\n\n /**\n * The data to send with the transaction. The data may be specified as a\n * `string`, an object, or an array of objects. This covers the data types\n * for the supported signature methods. Defaults to `0x`.\n */\n data: defaulted(\n union([\n StrictHexStruct,\n literal('0x'),\n record(string(), any()),\n array(record(string(), any())),\n ]),\n '0x',\n ),\n\n /**\n * The signature method being used.\n */\n signatureMethod: defaulted(\n union([\n literal('personal_sign'),\n literal('eth_signTypedData'),\n literal('eth_signTypedData_v3'),\n literal('eth_signTypedData_v4'),\n ]),\n 'personal_sign',\n ),\n});\n\nexport const BaseNameLookupOptionsStruct = object({\n /**\n * The CAIP-2 chain ID. Defaults to `eip155:1`.\n */\n chainId: defaulted(string(), 'eip155:1'),\n});\n\nexport const NameLookupOptionsStruct = union([\n assign(\n BaseNameLookupOptionsStruct,\n object({\n /**\n * Address to lookup.\n */\n address: string(),\n }),\n ),\n assign(\n BaseNameLookupOptionsStruct,\n object({\n /**\n * Domain name to lookup.\n */\n domain: string(),\n }),\n ),\n]);\n\nexport const SnapOptionsStruct = object({\n /**\n * The timeout in milliseconds to use for requests to the snap. Defaults to\n * `1000`.\n */\n timeout: defaulted(optional(number()), 1000),\n});\n\nexport const JsonRpcMockOptionsStruct = object({\n method: string(),\n result: JsonStruct,\n});\n\nexport const InterfaceStruct = type({\n content: optional(JSXElementStruct),\n});\n\nexport const SnapResponseWithoutInterfaceStruct = object({\n id: string(),\n\n response: union([\n object({\n result: JsonStruct,\n }),\n object({\n error: JsonStruct,\n }),\n ]),\n\n notifications: array(\n object({\n id: string(),\n message: string(),\n type: union([\n enumValue(NotificationType.InApp),\n enumValue(NotificationType.Native),\n ]),\n title: optional(string()),\n content: optional(string()),\n footerLink: optional(\n object({\n href: string(),\n text: string(),\n }),\n ),\n }),\n ),\n\n tracked: object({\n errors: array(TrackableErrorStruct),\n\n events: array(\n object({\n event: string(),\n properties: optional(record(string(), JsonStruct)),\n sensitiveProperties: optional(record(string(), JsonStruct)),\n }),\n ),\n\n traces: array(\n object({\n id: optional(string()),\n name: string(),\n parentContext: optional(JsonStruct),\n startTime: optional(number()),\n data: optional(\n record(string(), union([string(), number(), boolean()])),\n ),\n tags: optional(\n record(string(), union([string(), number(), boolean()])),\n ),\n }),\n ),\n }),\n});\n\nexport const SnapResponseWithInterfaceStruct = assign(\n SnapResponseWithoutInterfaceStruct,\n object({\n getInterface: func(),\n }),\n);\n\nexport const SnapResponseStruct = union([\n SnapResponseWithoutInterfaceStruct,\n SnapResponseWithInterfaceStruct,\n]);\n\n/**\n * Ensure that the actual response contains `getInterface`.\n *\n * @param response - The response of the handler.\n */\nexport function assertIsResponseWithInterface(\n response: SnapResponse,\n): asserts response is SnapResponseWithInterface {\n assertStruct(response, SnapResponseWithInterfaceStruct);\n}\n"]}
|
package/dist/structs.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SnapResponse, SnapResponseWithInterface } from "./types.cjs";
|
|
2
2
|
export declare const TransactionOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
3
|
+
data: `0x${string}`;
|
|
3
4
|
value: `0x${string}`;
|
|
4
5
|
chainId: string;
|
|
5
6
|
origin: string;
|
|
@@ -9,7 +10,6 @@ export declare const TransactionOptionsStruct: import("@metamask/superstruct").S
|
|
|
9
10
|
maxFeePerGas: `0x${string}`;
|
|
10
11
|
maxPriorityFeePerGas: `0x${string}`;
|
|
11
12
|
nonce: `0x${string}`;
|
|
12
|
-
data: `0x${string}`;
|
|
13
13
|
}, {
|
|
14
14
|
/**
|
|
15
15
|
* The CAIP-2 chain ID to send the transaction on. Defaults to `eip155:1`.
|
|
@@ -63,9 +63,9 @@ export declare const TransactionOptionsStruct: import("@metamask/superstruct").S
|
|
|
63
63
|
data: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
64
64
|
}>;
|
|
65
65
|
export declare const SignatureOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
66
|
+
data: `0x${string}` | Record<string, any> | Record<string, any>[];
|
|
66
67
|
origin: string;
|
|
67
68
|
from: `0x${string}`;
|
|
68
|
-
data: `0x${string}` | Record<string, any> | Record<string, any>[];
|
|
69
69
|
signatureMethod: "eth_signTypedData" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "personal_sign";
|
|
70
70
|
}, {
|
|
71
71
|
/**
|
|
@@ -128,8 +128,8 @@ export declare const SnapResponseWithoutInterfaceStruct: import("@metamask/super
|
|
|
128
128
|
id: string;
|
|
129
129
|
notifications: {
|
|
130
130
|
id: string;
|
|
131
|
-
type: "inApp" | "native";
|
|
132
131
|
message: string;
|
|
132
|
+
type: "inApp" | "native";
|
|
133
133
|
title?: string | undefined;
|
|
134
134
|
content?: string | undefined;
|
|
135
135
|
footerLink?: {
|
|
@@ -142,6 +142,22 @@ export declare const SnapResponseWithoutInterfaceStruct: import("@metamask/super
|
|
|
142
142
|
} | {
|
|
143
143
|
error: import("@metamask/snaps-sdk").Json;
|
|
144
144
|
};
|
|
145
|
+
tracked: {
|
|
146
|
+
events: {
|
|
147
|
+
event: string;
|
|
148
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
149
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
150
|
+
}[];
|
|
151
|
+
errors: import("@metamask/snaps-sdk").TrackableError[];
|
|
152
|
+
traces: {
|
|
153
|
+
name: string;
|
|
154
|
+
id?: string | undefined;
|
|
155
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
156
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
157
|
+
startTime?: number | undefined;
|
|
158
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
159
|
+
}[];
|
|
160
|
+
};
|
|
145
161
|
}, {
|
|
146
162
|
id: import("@metamask/superstruct").Struct<string, null>;
|
|
147
163
|
response: import("@metamask/superstruct").Struct<{
|
|
@@ -151,8 +167,8 @@ export declare const SnapResponseWithoutInterfaceStruct: import("@metamask/super
|
|
|
151
167
|
}, null>;
|
|
152
168
|
notifications: import("@metamask/superstruct").Struct<{
|
|
153
169
|
id: string;
|
|
154
|
-
type: "inApp" | "native";
|
|
155
170
|
message: string;
|
|
171
|
+
type: "inApp" | "native";
|
|
156
172
|
title?: string | undefined;
|
|
157
173
|
content?: string | undefined;
|
|
158
174
|
footerLink?: {
|
|
@@ -161,8 +177,8 @@ export declare const SnapResponseWithoutInterfaceStruct: import("@metamask/super
|
|
|
161
177
|
} | undefined;
|
|
162
178
|
}[], import("@metamask/superstruct").Struct<{
|
|
163
179
|
id: string;
|
|
164
|
-
type: "inApp" | "native";
|
|
165
180
|
message: string;
|
|
181
|
+
type: "inApp" | "native";
|
|
166
182
|
title?: string | undefined;
|
|
167
183
|
content?: string | undefined;
|
|
168
184
|
footerLink?: {
|
|
@@ -183,14 +199,66 @@ export declare const SnapResponseWithoutInterfaceStruct: import("@metamask/super
|
|
|
183
199
|
text: import("@metamask/superstruct").Struct<string, null>;
|
|
184
200
|
}>;
|
|
185
201
|
}>>;
|
|
202
|
+
tracked: import("@metamask/superstruct").Struct<{
|
|
203
|
+
events: {
|
|
204
|
+
event: string;
|
|
205
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
206
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
207
|
+
}[];
|
|
208
|
+
errors: import("@metamask/snaps-sdk").TrackableError[];
|
|
209
|
+
traces: {
|
|
210
|
+
name: string;
|
|
211
|
+
id?: string | undefined;
|
|
212
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
213
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
214
|
+
startTime?: number | undefined;
|
|
215
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
216
|
+
}[];
|
|
217
|
+
}, {
|
|
218
|
+
errors: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError[], import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError, unknown>>;
|
|
219
|
+
events: import("@metamask/superstruct").Struct<{
|
|
220
|
+
event: string;
|
|
221
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
222
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
223
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
224
|
+
event: string;
|
|
225
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
226
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
227
|
+
}, {
|
|
228
|
+
event: import("@metamask/superstruct").Struct<string, null>;
|
|
229
|
+
properties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>;
|
|
230
|
+
sensitiveProperties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>;
|
|
231
|
+
}>>;
|
|
232
|
+
traces: import("@metamask/superstruct").Struct<{
|
|
233
|
+
name: string;
|
|
234
|
+
id?: string | undefined;
|
|
235
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
236
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
237
|
+
startTime?: number | undefined;
|
|
238
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
239
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
240
|
+
name: string;
|
|
241
|
+
id?: string | undefined;
|
|
242
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
243
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
244
|
+
startTime?: number | undefined;
|
|
245
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
246
|
+
}, {
|
|
247
|
+
id: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
248
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
249
|
+
parentContext: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Json | undefined, unknown>;
|
|
250
|
+
startTime: import("@metamask/superstruct").Struct<number | undefined, null>;
|
|
251
|
+
data: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>;
|
|
252
|
+
tags: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>;
|
|
253
|
+
}>>;
|
|
254
|
+
}>;
|
|
186
255
|
}>;
|
|
187
256
|
export declare const SnapResponseWithInterfaceStruct: import("@metamask/superstruct").Struct<{
|
|
188
257
|
id: string;
|
|
189
|
-
getInterface: Function;
|
|
190
258
|
notifications: {
|
|
191
259
|
id: string;
|
|
192
|
-
type: "inApp" | "native";
|
|
193
260
|
message: string;
|
|
261
|
+
type: "inApp" | "native";
|
|
194
262
|
title?: string | undefined;
|
|
195
263
|
content?: string | undefined;
|
|
196
264
|
footerLink?: {
|
|
@@ -198,18 +266,35 @@ export declare const SnapResponseWithInterfaceStruct: import("@metamask/superstr
|
|
|
198
266
|
href: string;
|
|
199
267
|
} | undefined;
|
|
200
268
|
}[];
|
|
269
|
+
getInterface: Function;
|
|
201
270
|
response: {
|
|
202
271
|
result: import("@metamask/snaps-sdk").Json;
|
|
203
272
|
} | {
|
|
204
273
|
error: import("@metamask/snaps-sdk").Json;
|
|
205
274
|
};
|
|
275
|
+
tracked: {
|
|
276
|
+
events: {
|
|
277
|
+
event: string;
|
|
278
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
279
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
280
|
+
}[];
|
|
281
|
+
errors: import("@metamask/snaps-sdk").TrackableError[];
|
|
282
|
+
traces: {
|
|
283
|
+
name: string;
|
|
284
|
+
id?: string | undefined;
|
|
285
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
286
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
287
|
+
startTime?: number | undefined;
|
|
288
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
289
|
+
}[];
|
|
290
|
+
};
|
|
206
291
|
}, {
|
|
207
292
|
getInterface: import("@metamask/superstruct").Struct<Function, null>;
|
|
208
293
|
id: import("@metamask/superstruct").Struct<string, null>;
|
|
209
294
|
notifications: import("@metamask/superstruct").Struct<{
|
|
210
295
|
id: string;
|
|
211
|
-
type: "inApp" | "native";
|
|
212
296
|
message: string;
|
|
297
|
+
type: "inApp" | "native";
|
|
213
298
|
title?: string | undefined;
|
|
214
299
|
content?: string | undefined;
|
|
215
300
|
footerLink?: {
|
|
@@ -218,8 +303,8 @@ export declare const SnapResponseWithInterfaceStruct: import("@metamask/superstr
|
|
|
218
303
|
} | undefined;
|
|
219
304
|
}[], import("@metamask/superstruct").Struct<{
|
|
220
305
|
id: string;
|
|
221
|
-
type: "inApp" | "native";
|
|
222
306
|
message: string;
|
|
307
|
+
type: "inApp" | "native";
|
|
223
308
|
title?: string | undefined;
|
|
224
309
|
content?: string | undefined;
|
|
225
310
|
footerLink?: {
|
|
@@ -245,13 +330,66 @@ export declare const SnapResponseWithInterfaceStruct: import("@metamask/superstr
|
|
|
245
330
|
} | {
|
|
246
331
|
error: import("@metamask/snaps-sdk").Json;
|
|
247
332
|
}, null>;
|
|
333
|
+
tracked: import("@metamask/superstruct").Struct<{
|
|
334
|
+
events: {
|
|
335
|
+
event: string;
|
|
336
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
337
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
338
|
+
}[];
|
|
339
|
+
errors: import("@metamask/snaps-sdk").TrackableError[];
|
|
340
|
+
traces: {
|
|
341
|
+
name: string;
|
|
342
|
+
id?: string | undefined;
|
|
343
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
344
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
345
|
+
startTime?: number | undefined;
|
|
346
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
347
|
+
}[];
|
|
348
|
+
}, {
|
|
349
|
+
errors: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError[], import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").TrackableError, unknown>>;
|
|
350
|
+
events: import("@metamask/superstruct").Struct<{
|
|
351
|
+
event: string;
|
|
352
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
353
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
354
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
355
|
+
event: string;
|
|
356
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
357
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
358
|
+
}, {
|
|
359
|
+
event: import("@metamask/superstruct").Struct<string, null>;
|
|
360
|
+
properties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>;
|
|
361
|
+
sensitiveProperties: import("@metamask/superstruct").Struct<Record<string, import("@metamask/snaps-sdk").Json> | undefined, null>;
|
|
362
|
+
}>>;
|
|
363
|
+
traces: import("@metamask/superstruct").Struct<{
|
|
364
|
+
name: string;
|
|
365
|
+
id?: string | undefined;
|
|
366
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
367
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
368
|
+
startTime?: number | undefined;
|
|
369
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
370
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
371
|
+
name: string;
|
|
372
|
+
id?: string | undefined;
|
|
373
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
374
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
375
|
+
startTime?: number | undefined;
|
|
376
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
377
|
+
}, {
|
|
378
|
+
id: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
379
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
380
|
+
parentContext: import("@metamask/superstruct").Struct<import("@metamask/snaps-sdk").Json | undefined, unknown>;
|
|
381
|
+
startTime: import("@metamask/superstruct").Struct<number | undefined, null>;
|
|
382
|
+
data: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>;
|
|
383
|
+
tags: import("@metamask/superstruct").Struct<Record<string, string | number | boolean> | undefined, null>;
|
|
384
|
+
}>>;
|
|
385
|
+
}>;
|
|
248
386
|
}>;
|
|
249
387
|
export declare const SnapResponseStruct: import("@metamask/superstruct").Struct<{
|
|
250
388
|
id: string;
|
|
251
389
|
notifications: {
|
|
252
390
|
id: string;
|
|
253
|
-
type: "inApp" | "native";
|
|
254
391
|
message: string;
|
|
392
|
+
type: "inApp" | "native";
|
|
255
393
|
title?: string | undefined;
|
|
256
394
|
content?: string | undefined;
|
|
257
395
|
footerLink?: {
|
|
@@ -264,13 +402,28 @@ export declare const SnapResponseStruct: import("@metamask/superstruct").Struct<
|
|
|
264
402
|
} | {
|
|
265
403
|
error: import("@metamask/snaps-sdk").Json;
|
|
266
404
|
};
|
|
405
|
+
tracked: {
|
|
406
|
+
events: {
|
|
407
|
+
event: string;
|
|
408
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
409
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
410
|
+
}[];
|
|
411
|
+
errors: import("@metamask/snaps-sdk").TrackableError[];
|
|
412
|
+
traces: {
|
|
413
|
+
name: string;
|
|
414
|
+
id?: string | undefined;
|
|
415
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
416
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
417
|
+
startTime?: number | undefined;
|
|
418
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
419
|
+
}[];
|
|
420
|
+
};
|
|
267
421
|
} | {
|
|
268
422
|
id: string;
|
|
269
|
-
getInterface: Function;
|
|
270
423
|
notifications: {
|
|
271
424
|
id: string;
|
|
272
|
-
type: "inApp" | "native";
|
|
273
425
|
message: string;
|
|
426
|
+
type: "inApp" | "native";
|
|
274
427
|
title?: string | undefined;
|
|
275
428
|
content?: string | undefined;
|
|
276
429
|
footerLink?: {
|
|
@@ -278,11 +431,28 @@ export declare const SnapResponseStruct: import("@metamask/superstruct").Struct<
|
|
|
278
431
|
href: string;
|
|
279
432
|
} | undefined;
|
|
280
433
|
}[];
|
|
434
|
+
getInterface: Function;
|
|
281
435
|
response: {
|
|
282
436
|
result: import("@metamask/snaps-sdk").Json;
|
|
283
437
|
} | {
|
|
284
438
|
error: import("@metamask/snaps-sdk").Json;
|
|
285
439
|
};
|
|
440
|
+
tracked: {
|
|
441
|
+
events: {
|
|
442
|
+
event: string;
|
|
443
|
+
properties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
444
|
+
sensitiveProperties?: Record<string, import("@metamask/snaps-sdk").Json> | undefined;
|
|
445
|
+
}[];
|
|
446
|
+
errors: import("@metamask/snaps-sdk").TrackableError[];
|
|
447
|
+
traces: {
|
|
448
|
+
name: string;
|
|
449
|
+
id?: string | undefined;
|
|
450
|
+
data?: Record<string, string | number | boolean> | undefined;
|
|
451
|
+
parentContext?: import("@metamask/snaps-sdk").Json | undefined;
|
|
452
|
+
startTime?: number | undefined;
|
|
453
|
+
tags?: Record<string, string | number | boolean> | undefined;
|
|
454
|
+
}[];
|
|
455
|
+
};
|
|
286
456
|
}, null>;
|
|
287
457
|
/**
|
|
288
458
|
* Ensure that the actual response contains `getInterface`.
|
package/dist/structs.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structs.d.cts","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"structs.d.cts","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,oBAAgB;AAUvE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;IACnC;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAUH;;;OAGG;;IAUH;;;OAGG;;IAQH;;;OAGG;;IAQH;;;;OAIG;;IAQH;;;;OAIG;;IAQH;;;OAGG;;IAQH;;;OAGG;;EAOH,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;IACjC;;OAEG;;IAGH;;;OAGG;;IASH;;;;OAIG;;IAWH;;OAEG;;EAUH,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;IACtC;;OAEG;;EAEH,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;QAmBlC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;IAC5B;;;OAGG;;EAEH,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;EAGnC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;EAE1B,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyD7C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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