Documentation ¶
Index ¶
- Constants
- type Message
- type MessageType
- type Packet
- type TzKT
- func (tzkt *TzKT) Close() error
- func (tzkt *TzKT) Connect(ctx context.Context) error
- func (tzkt *TzKT) IsConnected() bool
- func (tzkt *TzKT) Listen() <-chan Message
- func (tzkt *TzKT) SetLogger(logger zerolog.Logger)
- func (tzkt *TzKT) SubscribeToAccounts(addresses ...string) error
- func (tzkt *TzKT) SubscribeToBigMaps(ptr *int64, contract, path string, tags ...string) error
- func (tzkt *TzKT) SubscribeToBlocks() error
- func (tzkt *TzKT) SubscribeToCycles(delayBlocks uint64) error
- func (tzkt *TzKT) SubscribeToHead() error
- func (tzkt *TzKT) SubscribeToOperations(address string, types ...string) error
- func (tzkt *TzKT) SubscribeToTokenBalances(account, contract, tokenID string) error
- func (tzkt *TzKT) SubscribeToTokenTransfers(account, contract, tokenID string) error
Constants ¶
const ( MethodHead = "SubscribeToHead" MethodBlocks = "SubscribeToBlocks" MethodOperations = "SubscribeToOperations" MethodBigMap = "SubscribeToBigMaps" MethodAccounts = "SubscribeToAccounts" MethodTokenTransfers = "SubscribeToTokenTransfers" MethodTokenBalances = "SubscribeToTokenBalances" MethodCycles = "SubscribeToCycles" )
Methods
const ( ChannelHead = "head" ChannelBlocks = "blocks" ChannelOperations = "operations" ChannelBigMap = "bigmaps" ChannelAccounts = "accounts" ChannelTransfers = "transfers" ChannelCycles = "cycles" ChannelTokenBalances = "token_balances" )
Channels
const ( BigMapTagMetadata = "metadata" BigMapTagTokenMetadata = "token_metadata" )
Big map tags
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Channel string Type MessageType `json:"type"` State uint64 `json:"state"` Body interface{} `json:"data"` }
Message - message struct
type MessageType ¶
type MessageType int
MessageType - TzKT message type
const ( MessageTypeState MessageType = iota MessageTypeData MessageTypeReorg MessageTypeSubscribed )
message types
type Packet ¶ added in v0.1.27
type Packet struct { Type MessageType `json:"type"` State uint64 `json:"state"` Data stdJSON.RawMessage `json:"data,omitempty"` }
Packet -
type TzKT ¶
type TzKT struct {
// contains filtered or unexported fields
}
TzKT - struct that used for connection to TzKT events server
func NewTzKT ¶
NewTzKT - constructor of `TzKT`. `url` is TzKT events base URL. If it's empty https://api.tzkt.io/v1/events is set.
func (*TzKT) IsConnected ¶ added in v0.1.37
IsConnected - reports whether the connection to TzKT events is established
func (*TzKT) SubscribeToAccounts ¶ added in v0.1.17
SubscribeToAccounts - subscribe to accounts channel. Sends touched accounts (affected by any operation in any way)..
func (*TzKT) SubscribeToBigMaps ¶
SubscribeToBigMaps - subscribe to bigmaps channel. Sends bigmap updates.
func (*TzKT) SubscribeToBlocks ¶
SubscribeToBlocks - subscribe to blocks channel. Sends blocks added to the blockchain.
func (*TzKT) SubscribeToCycles ¶ added in v0.2.26
SubscribeToCycles - notifies of the start of a new cycle with a specified delay. delayBlocks is the number of blocks (2 by default) to delay a new cycle notification. It should be >= 2 (to not worry abour reorgs) and < cycle size
func (*TzKT) SubscribeToHead ¶
SubscribeToHead - subscribe to head channel. Sends the blockchain head every time it has been updated.
func (*TzKT) SubscribeToOperations ¶
SubscribeToOperations - subscribe to operations channel. Sends operations of specified types or related to specified accounts, included into the blockchain. Filters by `address` and list of `types` is appliable.
func (*TzKT) SubscribeToTokenBalances ¶ added in v0.2.26
SubscribeToTokenBalances - sends token balances when they are updated.
func (*TzKT) SubscribeToTokenTransfers ¶ added in v0.2.6
SubscribeToTokenTransfers - subscribe to transfers channel. Sends token transfers.