@sentio/truffle-fetch-and-compile
Version:
Used to obtain external verified sources and compile them
66 lines (65 loc) • 1.86 kB
TypeScript
import type { WorkflowCompileResult } from "@truffle/compile-common";
import type { SourceInfo, NetworkInfo as FetcherNetworkInfo, FetcherOptions } from "@truffle/source-fetcher";
export interface FetchAndCompileOptions {
network: {
networkId: number;
};
fetch?: {
precedence?: string[];
fetcherOptions?: {
[fetcherName: string]: FetcherOptions;
};
};
compile?: {
docker?: boolean;
nativeCompilerMap?: string;
};
}
export interface Optimizer {
enabled: boolean;
runs: number;
}
export interface NetworkInfo extends FetcherNetworkInfo {
fetchers: string[];
}
export interface SupportedNetworks {
[name: string]: NetworkInfo;
}
export type FailureType = "fetch" | "compile" | "language";
export interface FetchAndCompileResult {
compileResult: WorkflowCompileResult;
sourceInfo: SourceInfo;
fetchedVia: string;
}
export interface FetchAndCompileMultipleResult {
results: {
[address: string]: FetchAndCompileResult;
};
failures: {
[address: string]: FetchAndCompileFailureRecord;
};
}
export interface FetchExternalErrors {
fetch: string[];
compile: string[];
fetchers: string[];
}
export interface FetchAndCompileFailureRecord {
reason?: FailureType;
error?: Error;
}
export interface Recognizer {
isAddressUnrecognized(address: string): boolean;
getAnUnrecognizedAddress(): string | undefined;
addCompiledInfo(info: FetchAndCompileResult, address: string): void | Promise<void>;
markUnrecognizable(address: string, reason?: FailureType, error?: Error): void;
markBadFetcher(fetcherName: string): void;
}
export interface Instances {
[address: string]: {
contractName?: string;
source?: string;
binary: string;
constructorArgs?: string;
};
}