@metamask/snaps-rpc-methods
Version:
MetaMask Snaps JSON-RPC method implementations
47 lines • 1.85 kB
text/typescript
import type { PermittedHandlerExport } from "@metamask/permission-controller";
import type { TrackEventParams, TrackEventResult } from "@metamask/snaps-sdk";
import type { InferMatching, Snap } from "@metamask/snaps-utils";
import type { Json } from "@metamask/utils";
export type TrackEventMethodHooks = {
/**
* Track an event.
*
* @param event - The event object containing event details and properties.
*/
trackEvent: (event: TrackEventObject) => void;
/**
* Get Snap metadata.
*
* @param snapId - The ID of a Snap.
*/
getSnap: (snapId: string) => Snap | undefined;
};
export type TrackEventObject = {
event: string;
properties?: Record<string, Json>;
sensitiveProperties?: Record<string, Json>;
};
declare const TrackEventParametersStruct: import("@metamask/superstruct").Struct<{
event: {
event: string;
properties?: Record<string, Json> | undefined;
sensitiveProperties?: Record<string, Json> | undefined;
};
}, {
event: import("@metamask/superstruct").Struct<{
event: string;
properties?: Record<string, Json> | undefined;
sensitiveProperties?: Record<string, Json> | undefined;
}, {
event: import("@metamask/superstruct").Struct<string, null>;
properties: import("@metamask/superstruct").Struct<Record<string, Json> | undefined, null>;
sensitiveProperties: import("@metamask/superstruct").Struct<Record<string, Json> | undefined, null>;
}>;
}>;
export type TrackEventParameters = InferMatching<typeof TrackEventParametersStruct, TrackEventParams>;
/**
* Handler for the `snap_trackEvent` method.
*/
export declare const trackEventHandler: PermittedHandlerExport<TrackEventMethodHooks, TrackEventParameters, TrackEventResult>;
export {};
//# sourceMappingURL=trackEvent.d.mts.map