Add dependencies
The @solana/web3.js library provides a convenient RPC clientConnection class that has an API for submitting RPC requests to a JSON RPC endpoint.
Add polyfills
After installing, ensure you have also added these polyfills to theindex.js of your React native app. These are needed in some parts of @solana/web3.js because it is originally written as a web/node library and, as a result, certain expected APIs are missing in a React Native environment.
Creating a Connection client
The Connection class represents a connection to a Solana RPC endpoint and provides convenient functions to make RPC requests.
Construct a Connection client by passing in an RPC endpoint and an optional commitment config:
Connection class created can be reused throughout your application.
Usage
After creation, call various asynchronous RPC functions and receive responses from the RPC endpoint.Next steps
- Read the following Building transactions guide to learn how to create transactions that interact with on-chain Solana Programs.
- Browse the full list of Solana RPC HTTP Methods
