Introduction
The NullGraph Frontend SDK is a React-based library built on top of Anchor Framework that provides hooks and utilities for interacting with the NullGraph Solana program. It handles wallet connections, transaction signing, and account fetching through a clean, type-safe API.Architecture
The SDK is structured around:- React Hooks: Custom hooks for reading and writing on-chain data
- Anchor Integration: Uses
@coral-xyz/anchorfor program interaction - Wallet Adapter: Integrates with
@solana/wallet-adapter-react - PDA Derivation: Utilities for deriving Program Derived Addresses
- TypeScript Types: Fully typed interfaces for all accounts and transactions
Installation
Install the required dependencies:Provider Setup
Wrap your application with the required providers:App.tsx
Program Context
TheProgramProvider creates an Anchor Program instance that all hooks use internally:
context/ProgramContext.tsx
Constants
The SDK uses environment variables for configuration:lib/constants.ts
Connection to Devnet
The SDK is configured to connect to Solana devnet by default through theRPC_URL constant. The connection is established via the ConnectionProvider:
string
required
The RPC endpoint URL. Defaults to
https://api.devnet.solana.comCommitment
Transaction confirmation level. Defaults to
confirmedEnvironment Variables
Create a.env file in your project root:
.env
Next Steps
Hooks
Learn about all available React hooks for interacting with NullGraph
PDA Derivation
Understand how to derive Program Derived Addresses
Types
Explore TypeScript interfaces for accounts and transactions