Call any RPC method
const { creator } = await anvil.rpc<{ hash: Hash; creator: Address }>(
"ots_getContractCreator",
[token],
);
expect(creator.toLowerCase()).toBe(deployer.toLowerCase());
Tested in examples/test/e2e/debugging-and-tracing.e2e.test.ts:171
anvil.rpc<T>(method, params) sends a raw JSON-RPC request through the
test client (its retries and stop guard included). Type the result with
T.
For anvil methods the library wraps, prefer the typed actions: see anvil extras.
Concepts
- Architecture: how requests reach the node
- Reference:
rpc()