UNPKG

@m3s/smart-contract

Version:

A modular toolkit for generating, compiling, deploying, and interacting with Ethereum-compatible smart contracts

87 lines 2.72 kB
import { DeploymentDataType } from "../enums/base.js"; import { ERC20Options } from "@openzeppelin/wizard/dist/erc20.js"; import { ERC721Options } from "@openzeppelin/wizard/dist/erc721.js"; import { ERC1155Options } from "@openzeppelin/wizard/dist/erc1155.js"; import { GenerateContractInput } from "../types/index.js"; /** Input for generating contract source code */ interface BaseContractInput { language: string; } export interface ERC20ContractInput extends BaseContractInput { template: 'openzeppelin_erc20'; options: ERC20Options; } export interface ERC721ContractInput extends BaseContractInput { template: 'openzeppelin_erc721'; options: ERC721Options; } export interface ERC1155ContractInput extends BaseContractInput { template: 'openzeppelin_erc1155'; options: ERC1155Options; } /** 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: DeploymentDataType.regular; data: string; value?: string; } export interface ProxyDeployment { type: DeploymentDataType.proxy; implementation: { data: string; value?: string; }; proxy: { bytecode: string; abi: any[]; logicInitializeData: string; value?: string; }; } /** * Contract source code generation capabilities */ export 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 */ export 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>; } export {}; //# sourceMappingURL=base.d.ts.map