Vertices Docs
  • Welcome 👨‍💻
  • ⚙️ Vertices SDK
    • Quickstart
      • Unix
        • New account
        • Pay transaction
        • Application call
      • Microcontrollers
        • PlatformIO
        • ESP-IDF
        • Zephyr (soon)
    • API Reference
      • Providers
      • Accounts
      • Events
      • Transactions
      • Applications
    • Porting guide
      • Starting from scratch
      • New vertex
      • HTTP Client
      • Handling events
Powered by GitBook
On this page
  • Scheduling
  • Parameters
  • Return codes
  • Processing
  • Parameters
  • Return code

Was this helpful?

  1. ⚙️ Vertices SDK
  2. API Reference

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

typedef struct
{
    vtc_evt_type_t type; ///< \see vtc_evt_type_t
    size_t bufid; ///< internal buffer ID, used to identify a pending transaction
} vtc_evt_t;


typedef enum
{
    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.
    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.
    VTC_EVT_TX_SUCCESS, ///< transaction has been successfully sent and executed, after that event, the buffer is freed.
} vtc_evt_type_t;

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

/// \param queue_size
/// \return \c VTC_SUCCESS if event has correctly been processed
ret_code_t
vertices_event_process(size_t *queue_size);

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.

PreviousAccountsNextTransactions

Last updated 3 years ago

Was this helpful?