The Client is the main entry point for interacting with the NEAR blockchain. It provides methods for querying account information, calling contract functions, fetching blocks, and sending transactions.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/near/near-api-ts/llms.txt
Use this file to discover all available pages before exploring further.
Creating a Client
You can create a client in three ways:- Custom configuration - Configure your own RPC endpoints and transport policies
- Testnet preset - Pre-configured for NEAR testnet
- Mainnet preset - Pre-configured for NEAR mainnet
Client Interface
The Client provides both throwable and safe variants of each method:- Throwable methods - Throw errors on failure (e.g.,
getAccountInfo) - Safe methods - Return
Result<T, E>objects (e.g.,safeGetAccountInfo)
Available Methods
Account Methods
Query account information and access keys
Contract Methods
Call read-only contract functions
Block Methods
Fetch block data and recent block hashes
Transaction Methods
Send signed transactions to the network
Method Categories
Account Methods
getAccountInfo/safeGetAccountInfo- Get account balance and stategetAccountAccessKey/safeGetAccountAccessKey- Get a specific access keygetAccountAccessKeys/safeGetAccountAccessKeys- Get all access keys for an account
Contract Methods
callContractReadFunction/safeCallContractReadFunction- Call view functions on smart contracts
Block Methods
getBlock/safeGetBlock- Get block informationgetRecentBlockHash/safeGetRecentBlockHash- Get a recent block hash for transactions
Transaction Methods
sendSignedTransaction/safeSendSignedTransaction- Broadcast signed transactions to the network
Error Handling
Using Throwable Methods
Using Safe Methods
Common Parameters
Most client methods accept these optional parameters:Policy overrides for this specific request
Additional options for the request
Example: Complete Flow
Next Steps
Create a Client
Learn about client configuration options
Network Presets
Use pre-configured clients for testnet and mainnet