nectarengine.api module

class nectarengine.api.Api(url: str | Node | Dict[str, Any] | Sequence[str | Node | Dict[str, Any]] | Nodes | None = None, rpcurl: str | Node | Dict[str, Any] | Sequence[str | Node | Dict[str, Any]] | Nodes | None = None, history_url: str | Node | Dict[str, Any] | Sequence[str | Node | Dict[str, Any]] | Nodes | None = None, user: str | None = None, password: str | None = None, **kwargs: Any)

Bases: object

Access the hive-engine API

find(contract_name: str, table_name: str, query: Dict[str, Any] = {}, limit: int = 1000, offset: int = 0, indexes: List[str] = []) List[Dict[str, Any]]

Get an array of objects that match the query from the table of the specified contract

find_all(contract_name: str, table_name: str, query: Dict[str, Any] = {}) List[Dict[str, Any]]

Get an array of objects that match the query from the table of the specified contract

find_many(contract_name: str, table_name: str, query: Dict[str, Any] | None = None, limit: int = 1000, offset: int = 0, last_id: str | None = None, indexes: List[str] | None = None) List[Dict[str, Any]]

Get an array of objects that match the query, supporting last_id for efficient pagination. This mirrors the ‘findMany’ functionality in hiveenginepy.

find_one(contract_name: str, table_name: str, query: Dict[str, Any] = {}) Dict[str, Any] | None

Get the object that matches the query from the table of the specified contract

get_block_info(blocknumber: int) Dict[str, Any]

get the block with the specified block number of the sidechain

get_block_range_info(start_block: int, count: int) List[Dict[str, Any]]

Get information for a consecutive range of blocks.

This is a convenience wrapper around the getBlockRangeInfo JSON-RPC call. It can fetch up to 1000 blocks in one request and is much more efficient than calling get_block_info() repeatedly.

Parameters

start_blockint

The first block number to retrieve.

countint

The number of blocks to retrieve (maximum 1000).

Returns

List[Dict[str, Any]]

A list where each element is a block dictionary as returned by the side-chain node.

get_contract(contract_name: str) Dict[str, Any] | None

Get the contract specified from the database

get_history(account: str, symbol: str, limit: int = 1000, offset: int = 0) List[Dict[str, Any]]

“Get the transaction history for an account and a token

get_latest_block_info() Dict[str, Any]

get the latest block of the sidechain

get_status() Dict[str, Any]

gets the status of the sidechain

get_transaction_info(txid: str) Dict[str, Any]

Retrieve the specified transaction info of the sidechain