Skip to content

Commit

Permalink
feat: add provider interface
Browse files Browse the repository at this point in the history
fix: fix an issue that was preventing unit intervals to be created from doubles without decilams
  • Loading branch information
AngelCastilloB committed Oct 4, 2024
1 parent 40b10c1 commit a741cb4
Show file tree
Hide file tree
Showing 61 changed files with 10,354 additions and 368 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SET(PROJECT_NAME "cardano-c")
# Option that the user can optionally select
OPTION (TESTING_ENABLED "Enables unit test build." ON)
OPTION (DOXYGEN_ENABLED "Build documentation" OFF)
OPTION (EXAMPLES_ENABLED "Build examples" OFF)

# Find external dependencies
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -67,6 +68,7 @@ MESSAGE ( STATUS "CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}" )
MESSAGE ( STATUS "ARCHITECTURE = ${ARCHITECTURE}" )
MESSAGE ( STATUS "TESTING ENABLED = ${TESTING_ENABLED}")
MESSAGE ( STATUS "DOXYGEN ENABLED = ${DOXYGEN_ENABLED}")
MESSAGE ( STATUS "EXAMPLES ENABLED = ${EXAMPLES_ENABLED}")
MESSAGE ( STATUS "CMAKE_C_CLANG_TIDY = ${CMAKE_C_CLANG_TIDY}")
MESSAGE ( STATUS )
MESSAGE ( STATUS "change a configuration variable with: cmake -D<Variable>=<Value>" )
Expand Down Expand Up @@ -159,6 +161,10 @@ IF (CMAKE_BUILD_TYPE STREQUAL "Fuzz")
ADD_SUBDIRECTORY (fuzz ${BUILD_DIR}/fuzz)
ENDIF ()

# Build examples
IF (EXAMPLES_ENABLED)
ADD_SUBDIRECTORY (examples ${BUILD_DIR}/examples)
ENDIF ()

# Packaging.
SET (CPACK_SOURCE_IGNORE_FILES ".git,.swp")
Expand Down
10 changes: 10 additions & 0 deletions doc/src/sections/api/providers/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Providers
===================

This section of the documentation introduces the data providers for interacting with the Cardano blockchain:

.. toctree::
:maxdepth: 1

provider
provider_impl
72 changes: 72 additions & 0 deletions doc/src/sections/api/providers/provider.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Provider
==========================

.. doxygentypedef:: cardano_provider_t

------------

.. doxygenfunction:: cardano_provider_new

------------

.. doxygenfunction:: cardano_provider_get_name

------------

.. doxygenfunction:: cardano_provider_get_parameters

------------

.. doxygenfunction:: cardano_provider_get_unspent_outputs

------------

.. doxygenfunction:: cardano_provider_get_rewards_available

------------

.. doxygenfunction:: cardano_provider_get_unspent_outputs_with_asset

------------

.. doxygenfunction:: cardano_provider_get_unspent_output_by_nft

------------

.. doxygenfunction:: cardano_provider_resolve_unspent_outputs

------------

.. doxygenfunction:: cardano_provider_resolve_datum_outputs

------------

.. doxygenfunction:: cardano_provider_confirm_transaction_outputs

------------

.. doxygenfunction:: cardano_provider_submit_transaction

------------

.. doxygenfunction:: cardano_provider_evaluate_transaction

------------

.. doxygenfunction:: cardano_provider_unref

------------

.. doxygenfunction:: cardano_provider_ref

------------

.. doxygenfunction:: cardano_provider_refcount

------------

.. doxygenfunction:: cardano_provider_set_last_error

------------

.. doxygenfunction:: cardano_provider_get_last_error
49 changes: 49 additions & 0 deletions doc/src/sections/api/providers/provider_impl.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Provider Implementation
==========================

.. doxygentypedef:: cardano_provider_impl_t

------------

.. doxygentypedef:: cardano_get_parameters_func_t


------------

.. doxygentypedef:: cardano_get_unspent_outputs_func_t

------------

.. doxygentypedef:: cardano_get_rewards_balance_func_t

------------

.. doxygentypedef:: cardano_get_unspent_outputs_with_asset_func_t

------------

.. doxygentypedef:: cardano_get_unspent_output_by_nft_func_t

------------

.. doxygentypedef:: cardano_resolve_unspent_outputs_func_t


------------

.. doxygentypedef:: cardano_resolve_datum_func_t

------------

.. doxygentypedef:: cardano_confirm_transaction_func_t


------------

.. doxygentypedef:: cardano_submit_transaction_func_t


------------

.. doxygentypedef:: cardano_evaluate_transaction_func_t

4 changes: 4 additions & 0 deletions doc/src/sections/api/transaction_body/value.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Value

------------

.. doxygenfunction:: cardano_value_from_asset_map

------------

.. doxygenfunction:: cardano_value_from_cbor

------------
Expand Down
8 changes: 8 additions & 0 deletions doc/src/sections/api/witness_set/redeemer_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ Redeemer List

------------

.. doxygenfunction:: cardano_redeemer_list_set_ex_units

------------

.. doxygenfunction:: cardano_redeemer_list_clone

------------

.. doxygenfunction:: cardano_redeemer_list_clear_cbor_cache

------------
Expand Down
1 change: 1 addition & 0 deletions doc/src/sections/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ See `APACHE LICENSE, VERSION 2.0`_
api/pool_params/index
api/proposal_procedures/index
api/protocol_params/index
api/providers/index
api/scripts/index
api/transaction/index
api/transaction_body/index
Expand Down
20 changes: 20 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FILE(GLOB EXAMPLE_SOURCES "*_example.c")
MESSAGE(STATUS "Example sources: ${EXAMPLE_SOURCES}")

FILE(GLOB_RECURSE PROVIDERS_HEADER_DIRS RELATIVE ${CMAKE_SOURCE_DIR} utils/ providers/)

FILE(GLOB_RECURSE PROVIDERS_SOURCE_FILES utils/*.c providers/*.c)

FIND_PACKAGE(CURL REQUIRED)

FOREACH(EXAMPLE_SOURCE ${EXAMPLE_SOURCES})
GET_FILENAME_COMPONENT(EXAMPLE_TARGET_NAME ${EXAMPLE_SOURCE} NAME_WE) # Extract the filename without extension

ADD_EXECUTABLE(${EXAMPLE_TARGET_NAME} ${EXAMPLE_SOURCE} ${PROVIDERS_SOURCE_FILES})
MESSAGE(STATUS "Example source: ${EXAMPLE_TARGET_NAME}")

TARGET_INCLUDE_DIRECTORIES(${EXAMPLE_TARGET_NAME} PRIVATE ${CARDANO_C_INCLUDE_DIR})
TARGET_INCLUDE_DIRECTORIES(${EXAMPLE_TARGET_NAME} PRIVATE utils providers)

TARGET_LINK_LIBRARIES(${EXAMPLE_TARGET_NAME} PRIVATE cardano-c ${CURL_LIBRARIES})
ENDFOREACH()
Loading

0 comments on commit a741cb4

Please sign in to comment.