ghostcall batches EVM contract reads without deploying a Multicall contract.
Start at ghostcall.volga.sh for the setup guide, recipes, API reference, protocol, and size limits.
npm install @volga-sh/evm-ghostcallThis example uses viem for its client and ABI helpers:
npm install viemimport{aggregateDecodedCalls}from"@volga-sh/evm-ghostcall";import{createPublicClient,decodeFunctionResult,encodeFunctionData,http,parseAbi,}from"viem";import{mainnet}from"viem/chains";constclient=createPublicClient({chain: mainnet,transport: http(),});constabi=parseAbi(["function totalSupply() view returns (uint256)"]);consttoken="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";const[totalSupply]=awaitaggregateDecodedCalls(client,[{to: token,data: encodeFunctionData({
abi,functionName: "totalSupply",}),decodeResult: (data)=>decodeFunctionResult({
abi,functionName: "totalSupply",
data,}),},]);See Getting Started for a complete two-call walkthrough.
aggregateDecodedCalls()sends calls and returns decoded values.aggregateCalls()sends calls and returns raw success or failure results.encodeCalls()builds request data for aneth_callwithoutto.decodeResults()parses a raw ghostcall response.
Read the API reference for signatures, options, return types, and errors.
npm install
npm run build:sdk
npm run test
npm run checkTo work on the documentation:
npm run docs:dev
npm run docs:buildThe source is hosted at github.com/volga-sh/ghostcall.