Overview
Makes API calls to Hive blockchain nodes with automatic retry and failover support. Automatically switches between multiple nodes using JSON-RPC 2.0 protocol. If the current node fails, it will automatically try the next node in the list.Function Signature
Parameters
The API method name (e.g.,
'condenser_api.get_accounts', 'condenser_api.get_dynamic_global_properties')Parameters for the API method as an array or object. Most Hive API methods expect an array of parameters.
Request timeout in milliseconds. If not specified, uses the default timeout from configuration.
Number of retry attempts before throwing an error. The function will try different nodes on failure.
Return Type
Returns a Promise that resolves to the API response. The response type can be specified using TypeScript generics.
Error Handling
The function throws anRPCError when the Hive node returns an error response:
RPCError Properties
The error message from the RPC server
The error code from the RPC server
Additional error data if provided by the server
Examples
Get Account Information
Get Dynamic Global Properties
Get Content (Blog Post)
Custom Timeout and Retry Settings
With TypeScript Type Safety
Error Handling Example
Behavior
- Uses JSON-RPC 2.0 protocol
- Automatically rotates through configured nodes on failure
- Throws
RPCErrorimmediately on actual RPC errors (doesn’t retry) - Retries on network or timeout errors with different nodes
- Validates JSON-RPC response format (checks
id,jsonrpcversion)
See Also
- callREST - REST API calls
- callWithQuorum - Consensus-based calls
- Configuration - Configure nodes and timeouts