import { PrimeValue, ResoLangValue, Transfer } from './types.js'; export interface ContractMethod { name: string; params: { name: string; paramType?: string; }[]; returnType?: string; isSync: boolean; isConsensus: boolean; body: string; startLine: number; endLine: number; } export interface ContractDefinition { name: string; config: Record; stateVariables: { name: string; varType: string; initialValue: ResoLangValue; }[]; methods: ContractMethod[]; sourceCode: string; codeHash: string; } export interface DeployedContract { id: string; address: string; definition: ContractDefinition; state: Map; stateRoot: bigint; balance: PrimeValue; deployer: string; deployerSignature: string; createdAt: number; lastExecutedAt?: number; callCount: number; totalGasUsed: number; version: number; status: 'active' | 'paused' | 'deprecated'; } export interface ContractCallResult { success: boolean; returnValue?: ResoLangValue; gasUsed: number; transfers: Transfer[]; stateChanges: { key: string; oldValue: ResoLangValue; newValue: ResoLangValue; }[]; logs: string[]; error?: string; executionTime: number; } export interface ConsensusRequest { contractId: string; method: string; args: ResoLangValue[]; caller: string; proposedStateRoot: bigint; proposedTransfers: Transfer[]; timestamp: number; } /** * Parse a ResoLang source file to extract contract definition */ export declare function parseContract(source: string): ContractDefinition | { error: string; }; export declare class ContractDeploymentService { private contracts; private interpreter; constructor(); /** * Deploy a new contract */ deploy(source: string, deployer: string, deployerSignature: string, initialBalance?: PrimeValue, deployerNonce?: bigint): DeployedContract | { error: string; }; /** * Get a deployed contract */ getContract(address: string): DeployedContract | undefined; /** * List all deployed contracts */ listContracts(): DeployedContract[]; /** * Call a contract method */ call(contractAddress: string, method: string, args: ResoLangValue[], caller: string, value?: PrimeValue, gasLimit?: number): ContractCallResult; /** * Build ResoLang source for a method call */ private buildCallSource; /** * Convert a value to ResoLang source */ private valueToSource; /** * Compute state root (prime product of all state hashes) */ private computeStateRoot; /** * Hash a value to a bigint */ private hashValue; /** * Pause a contract */ pause(contractAddress: string, caller: string): boolean; /** * Resume a paused contract */ resume(contractAddress: string, caller: string): boolean; /** * Get contract statistics */ getStats(): { totalContracts: number; activeContracts: number; totalCalls: number; totalGasUsed: number; }; } export declare const contractService: ContractDeploymentService; //# sourceMappingURL=contracts.d.ts.map