@volga-sh/evm-ghostcall
v0.0.3
Published
Batch EVM blockchain reads without deployment dependencies.
Readme
ghostcall
ghostcall batches EVM blockchain reads without deployment dependencies.
Documentation
The docs live at ghostcall.volga.sh.
Start there for installation, examples, the API reference, protocol details, and endpoint limit notes.
Install
npm install @volga-sh/evm-ghostcallQuick Start
This example uses viem for the EIP-1193-compatible client and ABI helpers. Install it with npm install viem if your app does not already use it.
import { aggregateDecodedCalls } from "@volga-sh/evm-ghostcall";
import {
createPublicClient,
decodeFunctionResult,
encodeFunctionData,
http,
parseAbi,
} from "viem";
import { mainnet } from "viem/chains";
const client = createPublicClient({
chain: mainnet,
transport: http(),
});
const erc20Abi = parseAbi(["function totalSupply() view returns (uint256)"]);
const [totalSupply] = await aggregateDecodedCalls(client, [
{
to: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
data: encodeFunctionData({
abi: erc20Abi,
functionName: "totalSupply",
}),
decodeResult: (returnData) =>
decodeFunctionResult({
abi: erc20Abi,
functionName: "totalSupply",
data: returnData,
}),
},
]);See the Getting Started guide for a complete viem example with ABI encoding and decoding.
API
aggregateDecodedCalls()sends a strict batch and returns decoded values.aggregateCalls()sends a batch and returns raw{ success, returnData }entries.encodeCalls()builds the CREATE-styleeth_calldata payload.decodeResults()parses the packed ghostcall response.
Full reference: API docs.
Development
npm install
npm run build:sdk
npm run test
npm run checkDocs are built with Astro Starlight:
npm run docs:dev
npm run docs:buildThe repository is hosted at github.com/volga-sh/ghostcall.
