hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
66 lines • 3.07 kB
TypeScript
import type { SuiteResult } from "@nomicfoundation/edr";
export declare const SNAPSHOT_CHEATCODES_DIR = "snapshots";
export interface RenamedSnapshotGroup {
original: string;
sanitized: string;
}
export interface SanitizedSnapshotCheatcodes {
snapshotCheatcodes: SnapshotCheatcodesWithMetadataMap;
renamedGroups: RenamedSnapshotGroup[];
}
export type SnapshotCheatcodesMap = Map<string, // group
Record<string, // name
string>>;
export type SnapshotCheatcodesWithMetadataMap = Map<string, // group
Record<string, // name
{
value: string;
metadata: {
source: string;
};
}>>;
export interface SnapshotCheatcode {
group: string;
name: string;
value: string;
}
export interface SnapshotCheatcodeChange {
group: string;
name: string;
expected: number;
actual: number;
source: string;
}
export interface SnapshotCheatcodesComparison {
added: SnapshotCheatcode[];
removed: SnapshotCheatcode[];
changed: SnapshotCheatcodeChange[];
}
export interface SnapshotCheatcodesCheckResult {
passed: boolean;
comparison: SnapshotCheatcodesComparison;
written: boolean;
renamedGroups: RenamedSnapshotGroup[];
}
export declare function getSnapshotCheatcodesPath(basePath: string, filename: string): string;
/**
* Rekeys {@link snapshotCheatcodes} so each group name is safe to use as a
* filename component, returning the rekeyed map alongside the list of names
* that were actually changed by sanitization.
*
* @throws `SOLIDITY_TESTS.SNAPSHOT_GROUP_NAME_COLLISION` if two distinct
* original names sanitize to the same on-disk filename. Originals are
* sorted by codepoint in the error message so the same input always
* produces the same error text.
*/
export declare function sanitizeSnapshotCheatcodes(snapshotCheatcodes: SnapshotCheatcodesWithMetadataMap): SanitizedSnapshotCheatcodes;
export declare function extractSnapshotCheatcodes(suiteResults: SuiteResult[]): SnapshotCheatcodesWithMetadataMap;
export declare function writeSnapshotCheatcodes(basePath: string, snapshotCheatcodes: SnapshotCheatcodesWithMetadataMap): Promise<void>;
export declare function readSnapshotCheatcodes(basePath: string): Promise<SnapshotCheatcodesMap>;
export declare function stringifySnapshotCheatcodes(snapshots: SnapshotCheatcode[]): string;
export declare function compareSnapshotCheatcodes(previousSnapshotsMap: SnapshotCheatcodesMap, currentSnapshotsMap: SnapshotCheatcodesWithMetadataMap): SnapshotCheatcodesComparison;
export declare function checkSnapshotCheatcodes(basePath: string, suiteResults: SuiteResult[]): Promise<SnapshotCheatcodesCheckResult>;
export declare function logSnapshotCheatcodesSection(result: SnapshotCheatcodesCheckResult, logger?: typeof console.log): void;
export declare function printSnapshotCheatcodeChanges(changes: SnapshotCheatcodeChange[], logger?: typeof console.log): void;
export declare function logSnapshotRenameWarnings(renamedGroups: RenamedSnapshotGroup[], logger?: typeof console.log): void;
//# sourceMappingURL=snapshot-cheatcodes.d.ts.map