@m3s/smart-contract
Version:
A modular toolkit for generating, compiling, deploying, and interacting with Ethereum-compatible smart contracts
78 lines • 2.3 kB
TypeScript
import { IAdapterIdentity, IAdapterLifecycle } from "@m3s/common";
/** Input for generating contract source code */
export interface GenerateContractInput {
language: string;
template?: string;
options: Record<string, any>;
}
/** Input for compiling source code */
export interface CompileInput {
sourceCode: string;
language: string;
contractName?: string;
compilerOptions?: Record<string, any>;
}
export interface CompiledOutput {
artifacts: {
abi: any[];
bytecode: string;
contractName: string;
sourceName: string;
};
getDeploymentArgsSpec: (opts?: {
proxy?: boolean;
}) => {
name: string;
type: string;
}[];
getRegularDeploymentData: (constructorArgs?: any[]) => Promise<RegularDeployment>;
getProxyDeploymentData: (initializeArgs?: any[]) => Promise<ProxyDeployment>;
metadata?: Record<string, any>;
}
export interface RegularDeployment {
type: 'regular';
data: string;
value?: string;
}
export interface ProxyDeployment {
type: 'proxy';
implementation: {
data: string;
value?: string;
};
proxy: {
bytecode: string;
abi: any[];
logicInitializeData: string;
value?: string;
};
}
/**
* Contract source code generation capabilities
*/
interface IContractGenerator {
/**
* Generates contract source code based on language, template, and options.
* @param input - Parameters defining the contract to generate.
* @returns A promise resolving to the generated source code string.
*/
generateContract(input: GenerateContractInput): Promise<string>;
}
/**
* Contract compilation capabilities
*/
interface IContractCompiler {
/**
* Compiles contract source code for a specific language.
* @param input - Source code, language, and compiler options.
* @returns A promise resolving to a generic structure containing compiled artifacts.
*/
compile(input: CompileInput): Promise<CompiledOutput>;
}
/**
* Complete contract handler interface - composed of all contract operations
*/
export interface IBaseContractHandler extends IAdapterIdentity, IAdapterLifecycle, IContractGenerator, IContractCompiler {
}
export {};
//# sourceMappingURL=base.d.ts.map