requestTransaction() for state-changing operations and readContract() for read-only queries. Write operations open a hosted approval popup so the user can review the transaction before it’s submitted — read operations execute instantly with no popup required.
TypeScript types
The SDK ships with full TypeScript definitions. Here are the core types for the transaction methods:requestTransaction()
UserequestTransaction() when you need to write to a Soroban contract. The SDK opens a hosted approval popup showing the user the contract, method, and arguments. After the user approves, the SDK submits the transaction and returns the result.
Transaction approval flow
Transfer tokens example
readContract()
UsereadContract() to query on-chain state without modifying it. Because reads are simulated rather than submitted, no approval popup opens and the user doesn’t need to interact.
Read token balance example
UI state management
Production UIs need more than success/error states — they should communicate loading, pending approval, and completed states to the user. The component below demonstrates a complete status-tracking pattern.components/TransactionButton.tsx
Full AuthProvider + transaction flow
This example combines theAuthProvider pattern from the Authentication guide with both transaction methods in a single component. It’s a good reference for wiring everything together in a real feature.
components/WalletDashboard.tsx
Error handling for transactions
Always wrap transaction calls intry/catch. The table below lists the errors you’re most likely to encounter.