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