Skip to main content

Rust SDK installation

Install Rust SDK v2 in an application that uses the Solana 2.1 client stack.

Install the crate​

The default build exposes asynchronous RPC APIs under sns_sdk::non_blocking:

[dependencies]
sns-sdk = "2"
solana-client = "2.1"
solana-sdk = "2.1"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

For synchronous RPC APIs, disable default features and enable blocking:

[dependencies]
sns-sdk = { version = "2", default-features = false, features = ["blocking"] }
solana-client = "2.1"
solana-sdk = "2.1"

The default subdomain feature enables sub-registrar APIs. Add it alongside blocking when a synchronous application uses those APIs.

RPC Configuration​

Create the RPC client used by SDK operations with your Solana RPC endpoint:

use solana_client::nonblocking::rpc_client::RpcClient;

let client = RpcClient::new("https://your-rpc-endpoint.example".to_string());

For a blocking build, import solana_client::rpc_client::RpcClient instead.

Next​

Continue to the Rust SDK Quickstart to resolve a domain and query domain data.