Skip to main content
useContractCall is your window into the state of the blockchain. It simulates a read-only method call against a deployed Soroban contract and returns the decoded result as a native JavaScript value. No connected wallet required.

The Experience

You pass plain JavaScript objects as arguments. Sorokit fetches the contract’s WASM spec at runtime and handles all XDR conversion for you, so you never touch scValToNative or manual encoding.

Performance by Default

Under the hood, useContractCall is a wrapper around TanStack Query.
  • Automatic Caching: If two components call the same method with the same arguments, only one network request is made.
  • Smart Revalidation: The cache is automatically invalidated when a wallet transaction might have changed the value (via useContractSend).
  • Loading & Error States: You get isLoading, isError, and error directly, ready for JSX.

Parameters

Type Inference

The contract spec is fetched at runtime, but you can pass a generic type for type safety in your component.