Events
Asynchronous events
Events are responsible to warn the user that an action has to be taken. Those actions can be signing a new payload, or that the transactions went through.

Scheduling

Schedule new Vertices events. Make sure to process them afterward to have the SDK process the queued events.

Parameters

    evt : event to be processed
1
typedef struct
2
{
3
vtc_evt_type_t type; ///< \see vtc_evt_type_t
4
size_t bufid; ///< internal buffer ID, used to identify a pending transaction
5
} vtc_evt_t;
6
​
7
​
8
typedef enum
9
{
10
VTC_EVT_TX_READY_TO_SIGN = 0, ///< transaction's payload must be signed: the user must provide the signing function and emit the \c VTC_EVT_TX_READY_TO_SEND event.
11
VTC_EVT_TX_SENDING, ///< transaction is being sent to the blockchain API. When the user got the event, the transaction has probably been already sent.
12
VTC_EVT_TX_SUCCESS, ///< transaction has been successfully sent and executed, after that event, the buffer is freed.
13
} vtc_evt_type_t;
Copied!

Return codes

    VTC_SUCCESS on success.
    VTC_ERROR_NO_MEM when event queue is full: either process events or increase VTC_EVENTS_COUNT.

Processing

Call this function to have the Vertices SDK process pending events. Whenever calling a Vertices function, make sure to process all the events. To make sure all the events are processed, this function should be called from an infinite loop or OS thread/task. This function will call the user-defined callback if one has been passed when using vertices_new
1
/// \param queue_size
2
/// \return \c VTC_SUCCESS if event has correctly been processed
3
ret_code_t
4
vertices_event_process(size_t *queue_size);
5
​
Copied!

Parameters

queue_size : Pointer to size_t value that will be replaced with the Vertices interval queue size defining the number of events to be processed.

Return code

    VTC_SUCCESS when the event is correctly processed.
    Error code from the event.
Last modified 4mo ago