Near Learn

Rust, Python & mobile clients

NEAR client libraries beyond JavaScript: near-api-rs, near-jsonrpc-client-rs, py-near and the Swift and Kotlin JSON-RPC clients — official vs community.

Intermediate4 min read3-question check

Every NEAR client ultimately speaks the same JSON-RPC API, so you can always fall back to plain HTTP. The libraries below save you from hand-encoding Borsh transactions, signing and nonce handling. Pay attention to the Status column: some long-lived names are archived.

Rust#

LibraryLanguageStatusWhat it’s forLink
near-api (near-api-rs)RustOfficialHigh-level, builder-style API inspired by near-cli-rs: accounts, contract deploy and calls, NEAR/FT/NFT transfers, storage deposits, staking, signing via secret key, seed phrase, Ledger or OS keychain, and key pools to avoid nonce clashes.near/near-api-rs · docs.rs
near-jsonrpc-clientRustOfficialLower-level typed wrapper over each RPC method (methods::tx, methods::query, …). Use it when you need exact control of requests, e.g. inside indexers or infra.near/near-jsonrpc-client-rs
near-api-rs: read a balance (from the crate docs)
Rust
use near_api::*;
use std::str::FromStr;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let bob = AccountId::from_str("bob.testnet")?;

    let balance = Tokens::account(bob)
        .near_balance()
        .fetch_from_testnet()
        .await?;

    println!("{balance:?}");
    Ok(())
}

Python, Swift, Kotlin and others#

LibraryLanguageStatusWhat it’s forLink
py-nearPythonCommunity (listed on docs.near.org)Async client: accounts, transfers, contract calls, plus built-in NEAR Intents (OmniBalance) and HOT Protocol helpers. Install with pip install py-near.pvolnov/py-near · docs
near-jsonrpc-client-swiftSwift (iOS 13+, macOS)Under the near orgType-safe async/await JSON-RPC client generated from NEAR’s OpenAPI spec; Swift Package Manager.near/near-jsonrpc-client-swift
near-jsonrpc-client-kotlinKotlin Multiplatform (Android, iOS)Under the near orgCoroutine-based typed JSON-RPC client generated from the OpenAPI spec with kotlinx.serialization.near/near-jsonrpc-client-kotlin
near-api-swift / near-api-kotlinSwift / KotlinLegacyOlder mobile SDKs built around the web-wallet redirect login flow. Prefer the JSON-RPC clients above plus your own key management for new apps.near-api-swift · near-api-kotlin

Check yourself

3 questions · progress saved in this browser

  1. 1.A Rust backend needs to create sub-accounts and send FT transfers, signing with a seed phrase. Which crate is the best fit?
  2. 2.You find a tutorial using near-api-py from the near GitHub org. What should you do?
  3. 3.An Android + iOS app built with Kotlin Multiplatform needs typed access to NEAR RPC. Which library?