IHiveChainInterface extends IWaxBaseInterface with online blockchain operations. It provides API access, transaction broadcasting, and automatic TAPOS data retrieval.
Properties
api
Returns the API collection for making RPC calls to the Hive node.WaxApiCollection
Collection of API endpoints including:
database_api- Account, block, and state queriesaccount_history_api- Transaction historynetwork_broadcast_api- Transaction broadcastingrc_api- Resource credit queries- And more…
endpoint_url
Gets or sets the Hive node endpoint URL.HttpUrl
Current endpoint URL being used for API calls.
InvalidEndpointUrlFormatError if the URL format is invalid.
Inherited properties
All properties fromIWaxBaseInterface are available:
chain_id- Chain identifierconfig- Protocol configurationaddress_prefix- Public key prefixhive- HIVE asset factoryhbd- HBD asset factoryvests- VESTS asset factory
Transaction methods
create_transaction
Creates an online transaction with automatic TAPOS data from the blockchain.TTimestamp | None
default:"timedelta(minutes=1)"
Transaction expiration time. Can be:
datetime- Absolute UTC expiration timetimedelta- Duration from nowNone- Uses default 1 minute
IOnlineTransaction
Online transaction object with TAPOS data automatically filled from the current head block.
AssertionError if expiration type is invalid.
broadcast
Broadcasts a signed transaction to the blockchain.ITransaction | IOnlineTransaction
required
Signed transaction to broadcast.
TransactionNotSignedError- Transaction has no signaturesWaxValidationFailedError- Transaction validation failedAccountNotFoundError- One or more impacted accounts not found (IOnlineTransaction only)PrivateKeyDetectedInMemoError- Private key detected in operation content (IOnlineTransaction only)
When broadcasting an
IOnlineTransaction, the perform_on_chain_verification() method is called automatically to verify accounts exist and scan for leaked private keys.Account authority methods
collect_account_authorities
Retrieves authority information for one or more accounts.*AccountName
required
One or more account names to retrieve authorities for.
WaxAccountAuthorityInfo | list[WaxAccountAuthorityInfo]
If single account provided, returns single
WaxAccountAuthorityInfo. If multiple accounts provided, returns list.Each WaxAccountAuthorityInfo contains:account- Account nameauthorities- Owner, active, and posting authoritiesmemo_key- Memo public keylast_owner_update- Last owner key update timeprevious_owner_update- Previous owner key update time
InvalidAccountNameError- Account name is invalidAccountNotFoundError- Account not found on the blockchain
API extension methods
extends
Extends the API collection with custom API classes.type[ExtendedApiCollectionT]
required
New API collection class to add. Must contain API classes as attributes.
IHiveChainInterface[ExtendedApiCollectionT | ApiCollectionT]
New chain instance with extended API collection. Original instance remains unchanged.
- Extend existing API classes (like
DatabaseApi) or useAbstractAsyncApifor new APIs - Use
@endpoint_jsonrpcdecorator for endpoint methods - Endpoint parameters must be keyword-only (use
*before params) - Class name must match the Hive API name (e.g.,
BlockApiforblock_api)
extend_rest
Extends the REST API collection with custom REST API classes.type[ExtendedApiCollectionT]
required
New REST API collection class to add.
IHiveChainInterface[ExtendedApiCollectionT | ApiCollectionT]
New chain instance with extended REST API collection.
- Use
AbstractAsyncApias base class - Use
@endpoint_restdecorator for REST endpoints - Endpoint methods should return parsed response data
Cleanup methods
teardown
Cleans up API communication resources. Call this when finished with the chain instance.Always call
teardown() when finished with a chain instance to properly close connections and free resources. Use a try/finally block to ensure cleanup happens even if errors occur.