Skip to main content
The React SDK is currently planned for Phase 4. You can use the TypeScript SDK directly within your React components today to build zero-gas experiences.

Using the TypeScript SDK in React Today

You can easily integrate Grat by initializing the client in a configuration file and using it within your event handlers or custom hooks.

Planned Hooks API

The future React SDK will provide a collection of hooks to handle state management, loading indicators, and error states automatically.

useSponsor()

Returns a function to sponsor transactions and the current execution state.

useSimulate()

Calculates Soroban resource fees and diagnostic events for a transaction.

useRelayStatus()

Polls the health and metadata of the configured relay server.

useCreditBalance()

Fetches and updates the remaining credit balance for the project API key.

useGrat()

Provides access to the raw Grat client instance via React Context.
View on GitHub