@harmoniclabs/plu-ts-onchain
Version:
An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript
44 lines (43 loc) • 1.66 kB
TypeScript
export type CallStackSiteInfos = {
/** raw call stack line as it is reported in `new Error().stack */
__line__: string;
inferredName?: string | undefined;
path: string;
line: number | undefined;
column: number | undefined;
once: (evt: "inferredName", listener: (inferredName: string) => any) => void;
dispatchEvent: (evt: "inferredName", inferredName: string) => void;
};
export interface GetCallStackAtOptions {
/**
* if `inferredName` was not already present in the stack trace
* tries to parse the file (using `fetch`) indicated by the stack trace
*
* **if found**, `inferredName` will be modified i the reference present in the object returned
*
* @default false
**/
tryGetNameAsync?: boolean;
/**
* automatically add callback once the name is inferred
**/
onNameInferred?: (inferredName: string) => void;
}
export declare const defaultGetCallStackAtOptions: GetCallStackAtOptions;
/**
*
* @param n index of an array tha looks like this
* ```ts
* [
* "Error: ",
* " at getCallStackAt path/to/this/file.ts 10:17",
* " at someCallerFunction path/to/caller/file.ts line:column",
* " at callerCallerFunction path/to/callerCaller/file.ts line:column",
* " at just/some/path/to/some/caller.ts line:column",
* " at someOtherFunction path/to/something.ts line:column",
* ...rest_of_call_stack
* ]
* ```
* @returns
*/
export declare function getCallStackAt(n?: number, opts?: GetCallStackAtOptions): CallStackSiteInfos | undefined;