UNPKG

@metamask/multichain-account-service

Version:
56 lines 2.24 kB
/** * Range-based multichain account creations type. */ export type GroupIndexRange = { from?: number; to: number; }; /** * Asserts that a range is valid. * * @param range - The range to assert. * @param range.from - The starting index of the range (inclusive). * @param range.to - The ending index of the range (inclusive). */ export declare function assertGroupIndexRangeIsValid({ from, to, }: GroupIndexRange): void; /** * Asserts that a group index is valid given the next available group index. * * @param groupIndex - The group index to assert. * @param nextGroupIndex - The next available group index. */ export declare function assertGroupIndexIsValid(groupIndex: number, nextGroupIndex: number): void; /** * Augmented `Error` shape produced by {@link createSentryError}. The runtime * value carries a `cause` and (optionally) a structured `context` payload * that downstream Sentry tooling can read. * * The `TContext` type parameter narrows the shape of `context` for callers * that know what they put in — most useful in tests when asserting on a * captured error. */ export type SentryError<TContext extends Record<string, unknown> = Record<string, unknown>> = Error & { cause: Error; context?: TContext; }; /** * Creates a Sentry error from an error message, an inner error and a context. * * NOTE: Sentry defaults to a depth of 3 when extracting non-native attributes. * As such, the context depth shouldn't be too deep. * * @param message - The error message to create a Sentry error from. * @param innerError - The inner error to create a Sentry error from. * @param context - The context to add to the Sentry error. * @returns A Sentry error. */ export declare const createSentryError: <TContext extends Record<string, unknown> = Record<string, unknown>>(message: string, innerError: Error, context?: TContext | undefined) => SentryError<TContext>; /** * Converts an unknown error value to a string message. * * @param error - The error to convert. * @returns The error message if the error is an `Error` instance, otherwise * the string representation of the value. */ export declare function toErrorMessage(error: unknown): string; //# sourceMappingURL=utils.d.mts.map