Skip to content

The minimum an SDK function needs to run: the dependencies it was configured with and a logger. AnvilSDK implements it, so pass the SDK instance wherever a ctx is required — you never construct one yourself. Every exported action (getChainId, getContractAddress, …) takes it as its first argument.

Remarks

Internal code (actions, lib, operations, validation) accepts SDKContext — never AnvilSDK. This file is a leaf module: it imports only from dependencies.ts and types/. Nothing in the codebase imports from this file’s dependents, so circular imports are structurally impossible.

DO NOT import from sdk.ts or modules/ here. Ever.

Properties

deps

readonly deps: AnvilDependencies;

The AnvilDependencies this instance was constructed with. Actions read it lazily at call time, so the reactive setters on AnvilSDK (updateWalletClient, updateAccountAddress) normally take effect on the next call without rebuilding anything. Prepared wallet workflows are the deliberate exception: they pin the first available signer for their full planning and execution lifetime and reject a later account change rather than spending the newly connected account’s assets.


logger

readonly logger: Logger;

Sink for the SDK’s diagnostic output. AnvilSDK supplies a console-backed logger that prefixes every line with [AnvilSDK]; there is no public way to replace it today. That default only surfaces warn and error — info, log, and debug are no-ops, since those are the levels request/response payloads log at.