UNPKG

locklift

Version:

Node JS framework for working with Ever contracts. Inspired by Truffle and Hardhat. Helps you to build, test, run and maintain your smart contracts.

56 lines (55 loc) 3.33 kB
import { AccountData, Addressable, BalanceChangeInfoStorage, ErrorStore, MsgError, TraceType, ViewTrace, ViewTraceTree, ViewTraceTreeWithTotalFee } from "../types"; import { AbiEventName, Address, Contract, DecodedEventWithTransaction } from "everscale-inpage-provider"; import { ContractWithArtifacts } from "../../../types"; import { PrinterConfig } from "./utils"; import { Tokens } from "./tokens"; export type NameAndType<T extends string = string> = { type: TraceType; name: T; contract?: Addressable; }; type EventNames<Abi> = DecodedEventWithTransaction<Abi, AbiEventName<Abi>>["event"]; type EventsNamesInner<T extends Contract<any>> = EventNames<T extends Contract<infer f> ? f : never>; type MethodParams<C extends Contract<any>, N extends keyof C["methods"]> = Parameters<C["methods"][N]>[0]; type EventParams<Abi, N extends string> = Extract<DecodedEventWithTransaction<Abi, AbiEventName<Abi>>, { event: N; }>["data"]; export declare class ViewTracingTree { private readonly contractGetter; private readonly accounts; readonly viewTraceTree: ViewTraceTreeWithTotalFee; readonly tokens: Tokens; balanceChangeInfo: BalanceChangeInfoStorage; msgErrorsStore: ErrorStore; constructor(viewTraceTree: ViewTraceTree, contractGetter: (codeHash: string | undefined, address: Address) => ContractWithArtifacts<any> | undefined, accounts: AccountData[]); getErrorsByContract: <T extends Contract<any> | Address | string>(contract: T) => Array<MsgError>; getAllErrors: () => { phase: "compute" | "action"; code: number | null; trace: ViewTrace; contract: string; }[]; getBalanceDiff: <T extends Contract<any> | Address | string>(contracts: T[] | T) => T extends T[] ? Record<string, string> : string; findCallsForContract: <C extends Contract<any>, N extends keyof C["methods"] & string>({ contract, name, }: { contract: C; } & { name: N; }) => NonNullable<(N extends keyof C["methods"] & string ? MethodParams<C, N> : EventParams<C extends Contract<infer f> ? f : never, N>) | MethodParams<C, N> | undefined>[]; findEventsForContract: <C extends Contract<any>, Abi extends C extends Contract<infer f_1> ? f_1 : never, N extends EventNames<Abi>>({ contract, name, }: { contract: C; } & { name: N; }) => NonNullable<(N extends keyof C["methods"] & string ? MethodParams<C, N> : EventParams<C extends Contract<infer f> ? f : never, N>) | MethodParams<C, N> | undefined>[]; findForContract: <C extends Contract<any>, N extends (keyof C["methods"] & string) | EventsNamesInner<C>, Abi extends C extends Contract<infer f> ? f : never, E extends N extends keyof C["methods"] & string ? MethodParams<C, N> : EventParams<Abi, N>>({ contract, name, }: { contract: C; } & { name: N; }) => (import("../types").DecodedMsg<N, MethodParams<C, N>> | undefined)[] | (import("../types").DecodedMsg<N, E> | undefined)[]; findByType: <M extends string, P>(params: NameAndType) => Array<ViewTrace<M, P>["decodedMsg"]>; findByTypeWithFullData: <M extends string, P>(params: NameAndType) => ViewTrace<M, P>[]; private _findByType; totalGasUsed: () => number; beautyPrint: (printerConfig?: PrinterConfig) => Promise<void>; private _beautyPrint; } export {};