View Source Yggdrasil.Subscriber.Adapter.Icon.Message (ICON 2.0 SDK v0.1.6)

This module defines functions to deal with ICON 2.0 websocket messages.

When a connection is established with the ICON 2.0 websocket, we need to send a text frame with a JSON payload to state our intention. There are two channels:

  • :block for receiving both ticks on every block and event logs specific to the events we're filtering.
  • :event for receiving updates for a specific event log.

Link to this section Summary

Functions

Decodes an incoming message from the ICON 2.0 websocket.

Encodes a request for the ICON 2.0 websocket. It receives the height and the channel to build the request.

Publishes notifications in a channel.

Link to this section Functions

Link to this function

decode(channel, notification)

View Source

Specs

decode(Yggdrasil.Channel.t(), map()) ::
  {:ok, [Icon.Schema.Types.EventLog.t()]} | {:error, Icon.Schema.Error.t()}

Decodes an incoming message from the ICON 2.0 websocket.

Specs

Encodes a request for the ICON 2.0 websocket. It receives the height and the channel to build the request.

Link to this function

publish(channel, notification)

View Source

Specs

publish(Yggdrasil.Channel.t(), map()) :: Task.t()

Publishes notifications in a channel.