readContract() runs a read-only simulation against a Soroban smart contract and returns the result. Unlike requestTransaction(), it does not open any popup, does not require the user’s approval, and does not submit anything to the Stellar network. It is the right tool whenever you need on-chain data — a token balance, contract configuration, pool state, or any other view function — without changing state or spending gas.
Method signature
Parameters
ReadContractRequest
required
The read request describing the contract and function to simulate.
Return value
readContract() returns Promise<unknown>. The resolved value is the raw return value of the contract function — the shape depends entirely on the contract you are calling. Cast the result to a known type after calling:
No approval required
BecausereadContract() only simulates execution and never submits a transaction, it requires no active session and no user interaction. You can call it at any point — on page load, in the background, or before asking the user to authenticate — to pre-fetch the data your UI needs.