@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
1 lines • 1.87 kB
Source Map (JSON)
{"version":3,"file":"start-trace.mjs","sourceRoot":"","sources":["../../../src/types/methods/start-trace.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * The name of the trace context.\n *\n * The client uses an enum to define the trace names, but to avoid needing to\n * copy and update the enum in multiple places, we use a string type here.\n */\nexport type TraceName = string;\n\n/**\n * A context object to associate traces with each other and generate nested\n * traces.\n */\nexport type TraceContext = Json;\n\n/**\n * A request to create a new performance trace in Sentry.\n */\n// This type is copied from `metamask-extension`, and should match that type.\nexport type TraceRequest = {\n /**\n * Custom data to associate with the trace.\n */\n data?: Record<string, number | string | boolean>;\n\n /**\n * A unique identifier when not tracing a callback.\n * Defaults to 'default' if not provided.\n */\n id?: string;\n\n /**\n * The name of the trace.\n */\n name: TraceName;\n\n /**\n * The parent context of the trace.\n * If provided, the trace will be nested under the parent trace.\n */\n parentContext?: TraceContext;\n\n /**\n * Override the start time of the trace.\n */\n startTime?: number;\n\n /**\n * Custom tags to associate with the trace.\n */\n tags?: Record<string, number | string | boolean>;\n};\n\n/**\n * The request parameters for the `snap_startTrace` method. This method is used\n * to start a performance trace in Sentry.\n *\n * Note that this method is only available to preinstalled Snaps.\n */\nexport type StartTraceParams = TraceRequest;\n\n/**\n * The result returned by the `snap_startTrace` method.\n *\n * This is the trace context that can be used to end the trace later.\n */\nexport type StartTraceResult = TraceContext;\n"]}