Sleuth allows you to run a contract call as a single
eth_call call.
Note: Cartouche.Contract.Sleuth generated from mix cartouche.gen --prefix cartouche/contract ./priv/Sleuth.json
Summary
Functions
Runs a Sleuth contract query: deploys bytecode on-chain via eth_call
with query calldata and decodes the result against selector. Returns
the decoded values without struct annotations.
Same as query/4, but tags each decoded value with its ABI type for
callers that need both type and value (e.g. when re-encoding).
Single-argument form of query_by/2: defaults fun to :query and
opts to [].
Convenience wrapper that derives bytecode, query calldata, and selector
from a generated contract module. Resolves mod.bytecode/0,
mod.encode_<fun>/0, and mod.<fun>_selector/0 and forwards the rest
to query/4.
Three-argument form of query_by/2: explicit fun and opts.
Variant of query/4 that exposes the full set of decode options
(:annotated, :decode_binaries, :decode_structs, :named_returns,
:sleuth_address) as keyword opts. Returns results with named-return
annotations when configured.
Functions
@spec query(binary(), binary(), ABI.FunctionSelector.t(), Keyword.t()) :: {:ok, term()} | {:error, String.t()}
Runs a Sleuth contract query: deploys bytecode on-chain via eth_call
with query calldata and decodes the result against selector. Returns
the decoded values without struct annotations.
@spec query_annotated(binary(), binary(), ABI.FunctionSelector.t(), Keyword.t()) :: {:ok, term()} | {:error, String.t()}
Same as query/4, but tags each decoded value with its ABI type for
callers that need both type and value (e.g. when re-encoding).
Single-argument form of query_by/2: defaults fun to :query and
opts to [].
Convenience wrapper that derives bytecode, query calldata, and selector
from a generated contract module. Resolves mod.bytecode/0,
mod.encode_<fun>/0, and mod.<fun>_selector/0 and forwards the rest
to query/4.
Three-argument form of query_by/2: explicit fun and opts.
@spec query_v2(binary(), binary(), ABI.FunctionSelector.t(), Keyword.t()) :: {:ok, term()} | {:error, String.t()}
Variant of query/4 that exposes the full set of decode options
(:annotated, :decode_binaries, :decode_structs, :named_returns,
:sleuth_address) as keyword opts. Returns results with named-return
annotations when configured.