Comment on page
Providers
Instantiate the Vertices library and configure the provider.
/// Initialize Vertices SDK
/// \param config Pass the configuration such as providers and user-defined event handler
/// \return
ret_code_t
vertices_new(vertex_t *config);
config
pointer to config.
typedef struct
{
provider_info_t *provider;
ret_code_t (*vertices_evt_handler)(vtc_evt_t *evt);
} vertex_t;
typedef struct
{
char *url;
short port;
char *header;
const char *cert_pem;
} provider_info_t;
Here is an example of configuration for a node (
algod
) running locally on my machine. Comments give a configuration with Algoexplorer's API.static provider_info_t providers =
{
.url = (char *) "localhost", // or "https://api.testnet.algoexplorer.io"
.port = 8080, // 0
.header = (char *) "X-Algo-API-Token:<api-token>" // ""
.cert_pem = algoexplorer_root_cert_pem_start
};
static vertex_t m_vertex = {
.provider = &providers,
.vertices_evt_handler = vertices_evt_handler
};
VTC_SUCCESS
on successVTC_ERROR_INTERNAL
if HTTP client cannot be initialized
ret_code_t
vertices_ping(void);
VTC_SUCCESS
when API can be reachedVTC_HTTP_ERROR
when an error occurs
ret_code_t
vertices_version(provider_version_t *version);
Pointer to
provider_version_t
structure that will be filled by the function.VTC_SUCCESS
whenversion
has been filled with node infoVTC_ERROR_OFFLINE
when node cannot be reached to get info. Version could still be filled with information from a previous call.