Complete API reference for LocalNodeManager
new LocalNodeManager(config?: NodeConfig)
http://localhost:12345
async start(): Promise<void>
const node = new LocalNodeManager() await node.start() console.log(`Node running at ${node.rpcUrl}`)
async stop(): Promise<void>
await node.stop()
getPort(): number | null
null
const port = node.getPort() // Use port for configuration
async snapshot(): Promise<string>
revert()
const snapshotId = await node.snapshot() // Make changes... await node.revert(snapshotId)
async revert(snapshotId: string): Promise<void>
snapshot()
async reset(forkBlock?: bigint): Promise<void>
async mine(blocks = 1): Promise<void>
// Mine 10 blocks await node.mine(10)
async setAutomine(enabled: boolean): Promise<void>
// Disable automine for manual control await node.setAutomine(false)
async setNextBlockTimestamp(timestamp: number): Promise<void>
async increaseTime(seconds: number): Promise<void>
// Advance time by 1 day await node.increaseTime(86400)
async setTime(timestamp: number): Promise<void>
async getAccounts(): Promise<string[]>
const accounts = await node.getAccounts() console.log(`Available accounts: ${accounts.length}`)
async setBalance(address: string, balance: bigint): Promise<void>
await node.setBalance( "0x742d35Cc6634C0532925a3b844Bc9e7595f8fA65", parseEther("100") )
async setNonce(address: string, nonce: number): Promise<void>
async impersonateAccount(address: string): Promise<void>
// Impersonate a whale address await node.impersonateAccount("0xWhaleAddress")
async stopImpersonatingAccount(address: string): Promise<void>
async setCode(address: string, code: string): Promise<void>
async setStorageAt( address: string, slot: string, value: string ): Promise<void>
async setNextBlockBaseFeePerGas(fee: bigint): Promise<void>
async setMinGasPrice(price: bigint): Promise<void>
async setChainId(chainId: number): Promise<void>