@bradthomasbrown/900ef2
v1.0.0
Published
Minimal, unoptimized, and unaudited { podman, containerized evm node (foundry's anvil, go-ethereum, etc. } library in JavaScript/TypeScript.
Downloads
18
Readme
900ef2
This is function that can return classes which can create containerized EVM nodes and return interfaces for them, with some helpful features, in TypeScript/JavaScript.
Features include automatic cleanup and "wait until responsive" logic, as well as returning a class (see @bradthomasbrown/ejra) to make interacting with the EVM node more convenient.
Why?
To make testing EVM nodes a little bit easier to manage.
Dependencies
This has a hard dependency on having podman for containers and images. See podman.io.
Installation
npm i @bradthomasbrown/900ef2Usage
import { _900ef2_ } from "@bradthomasbrown/900ef2";
const anvilPort = 8546;
const gethPort = 8547;
const Anvil = _900ef2_("ghcr.io/foundry-rs/foundry:v1.5.1", `anvil -b 1 -p ${anvilPort} --host 0.0.0.0`);
const Geth = _900ef2_("ethereum/client-go", ["--dev", "--http", "--http.addr", "0.0.0.0", "--http.port", `${gethPort}`, "--http.api", "eth,debug"]);
const [anvilNode, gethNode] = await Promise.all([Anvil.make(anvilPort), Geth.make(gethPort)]);
const [anvilChainId, gethChainId] = await Promise.all([anvilNode, gethNode].map(node => node.chainId()));
const anvilUrl = anvilNode.client.url;
const gethUrl = gethNode.client.url;
console.log({ anvilUrl, anvilChainId, gethUrl, gethChainId });
/*
{
anvilUrl: "localhost:8546",
anvilChainId: 31337n,
gethUrl: "localhost:8547",
gethChainId: 1337n,
}
*/