@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
49 lines (48 loc) • 1.56 kB
TypeScript
import { Address, Hex } from "viem";
import type { LocalNodeManager } from "../node/LocalNodeManager";
import type { ContractCall, ContractDeployment, SetupConfig } from "./types";
/**
* SmartContractManager handles deploying contracts using CREATE2 and executing contract calls
* using viem instead of ethers for improved performance and reliability.
*/
export declare class SmartContractManager {
private projectRoot;
private publicClient?;
private walletClient?;
private deployedContracts;
private proxyDeployer?;
private chain?;
constructor(projectRoot: string);
/**
* Initialize the manager by setting up viem clients
*/
initialize(node: LocalNodeManager): Promise<void>;
/**
* Get the chain ID from the RPC endpoint
*/
private getChainId;
/**
* Deploy a contract using CREATE2 for deterministic addresses
*/
deployContract(deployment: ContractDeployment): Promise<Address>;
/**
* Execute a contract function call
*/
executeCall(call: ContractCall): Promise<Hex>;
/**
* Set the complete contract state (deploy contracts and execute calls)
*/
setContractState(config: SetupConfig, node: LocalNodeManager): Promise<void>;
/**
* Predict the address where a contract will be deployed using CREATE2
*/
private predictContractAddress;
/**
* Load contract artifact from the compiled contracts
*/
private loadArtifact;
/**
* Validate the setup configuration
*/
private validateConfig;
}