Providers

Instantiate the Vertices library and configure the provider.

Create

/// 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);

Parameters

  • 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.

Return codes

  • VTC_SUCCESS on success

  • VTC_ERROR_INTERNAL if HTTP client cannot be initialized

Health

Return codes

  • VTC_SUCCESS when API can be reached

  • VTC_HTTP_ERROR when an error occurs

Version

Parameters

Pointer to provider_version_t structure that will be filled by the function.

Return codes

  • VTC_SUCCESS when version has been filled with node info

  • VTC_ERROR_OFFLINE when node cannot be reached to get info. Version could still be filled with information from a previous call.

Last updated

Was this helpful?