Provider Implementation¶
-
typedef struct cardano_provider_impl_t cardano_provider_impl_t¶
Opaque structure representing the implementation details of a Cardano blockchain data provider.
Implementation of the Cardano provider interface.
This structure encapsulates the internal state and implementation details of a Cardano blockchain data provider.
This structure contains the context and function pointers required to interact with the Cardano blockchain. It serves as the implementation of the provider interface, encapsulating the necessary state and behaviors.
Note
Users should interact with Cardano providers through the provided cardano_provider_t API functions and should not attempt to manipulate this structure directly.
-
typedef cardano_error_t (*cardano_get_parameters_func_t)(cardano_provider_impl_t *provider_impl, cardano_protocol_parameters_t **parameters)¶
Function pointer type for retrieving protocol parameters.
This function retrieves the protocol parameters using the given provider implementation.
-
typedef cardano_error_t (*cardano_get_unspent_outputs_func_t)(cardano_provider_impl_t *provider_impl, cardano_address_t *address, cardano_utxo_list_t **utxo_list)¶
Function pointer type for retrieving unspent outputs for an address.
Retrieves a list of unspent transaction outputs (UTXOs) associated with the specified address.
-
typedef cardano_error_t (*cardano_get_rewards_balance_func_t)(cardano_provider_impl_t *provider_impl, cardano_reward_address_t *address, uint64_t *rewards)¶
Function pointer type for retrieving staking rewards for an address.
This function retrieves the current staking rewards associated with the specified address. It uses the provided provider implementation instance to access blockchain data and obtain the reward balance for the address. Staking rewards are accumulated for addresses that delegate their stake to a stake pool.
- Param provider_impl:¶
[in] Pointer to the provider implementation instance. Must not be
NULL.- Param address:¶
[in] Pointer to a cardano_address_t representing the address for which to retrieve staking rewards. Must not be
NULL.- Param rewards:¶
[out] Pointer to a
uint64_tvariable where the function will store the amount of rewards (in Lovelace). Must not beNULL.- Return:¶
A cardano_error_t indicating success or failure of the operation.
Other error codes for provider-specific failures.
-
typedef cardano_error_t (*cardano_get_unspent_outputs_with_asset_func_t)(cardano_provider_impl_t *provider_impl, cardano_address_t *address, cardano_asset_id_t *asset_id, cardano_utxo_list_t **utxo_list)¶
Function pointer type for retrieving unspent outputs for an address and specific asset.
Retrieves a list of unspent transaction outputs (UTXOs) associated with the specified address that contain the specified asset.
- Param provider_impl:¶
[in] Pointer to the provider implementation instance.
- Param address:¶
[in] Address for which to retrieve unspent outputs.
- Param asset_id:¶
[in] Asset identifier to filter UTXOs.
- Param utxo_list:¶
[out] Pointer to store the list of unspent outputs containing the asset.
- Return:¶
Error code indicating success or failure of the operation.
-
typedef cardano_error_t (*cardano_get_unspent_output_by_nft_func_t)(cardano_provider_impl_t *provider_impl, cardano_asset_id_t *asset_id, cardano_utxo_t **utxo)¶
Function pointer type for retrieving an unspent output containing a specific NFT.
Retrieves an unspent transaction output (UTXO) that contains the specified NFT (Non-Fungible Token).
-
typedef cardano_error_t (*cardano_resolve_unspent_outputs_func_t)(cardano_provider_impl_t *provider_impl, cardano_transaction_input_set_t *tx_ins, cardano_utxo_list_t **utxo_list)¶
Function pointer type for resolving unspent outputs for given transaction inputs.
Resolves a list of unspent transaction outputs (UTXOs) corresponding to the provided transaction inputs.
-
typedef cardano_error_t (*cardano_resolve_datum_func_t)(cardano_provider_impl_t *provider_impl, cardano_blake2b_hash_t *datum_hash, cardano_plutus_data_t **datum)¶
Function pointer type for resolving a datum from its hash.
Retrieves the Plutus datum associated with the given datum hash.
-
typedef cardano_error_t (*cardano_confirm_transaction_func_t)(cardano_provider_impl_t *provider_impl, cardano_blake2b_hash_t *tx_id, uint64_t timeout_ms, bool *confirmed)¶
Function pointer type for confirming a transaction’s inclusion in the blockchain.
Waits for the specified transaction to be confirmed within a given timeout period.
- Param provider_impl:¶
[in] Pointer to the provider implementation instance.
- Param tx_id:¶
[in] Transaction ID to confirm.
- Param timeout_ms:¶
[in] Timeout in milliseconds to wait for confirmation.
- Param confirmed:¶
[out] Pointer to store the confirmation status of the transaction.
- Return:¶
Error code indicating success or failure of the operation.
-
typedef cardano_error_t (*cardano_submit_transaction_func_t)(cardano_provider_impl_t *provider_impl, cardano_transaction_t *tx, cardano_blake2b_hash_t **tx_id)¶
Function pointer type for submitting a transaction to the blockchain.
Submits the given transaction to the network and returns its transaction ID.
-
typedef cardano_error_t (*cardano_evaluate_transaction_func_t)(cardano_provider_impl_t *provider_impl, cardano_transaction_t *tx, cardano_utxo_list_t *additional_utxos, cardano_redeemer_list_t **redeemers)¶
Function pointer type for evaluating a transaction’s execution units.
Evaluates the execution units required by the transaction, considering any additional UTXOs and redeemers.
- Param provider_impl:¶
[in] Pointer to the provider implementation instance.
- Param tx:¶
[in] Transaction to evaluate.
- Param additional_utxos:¶
[in] Additional UTXOs required for evaluation (optional).
- Param redeemers:¶
[in] Redeemers to be evaluated with the transaction.
- Return:¶
Error code indicating success or failure of the operation.