Documentation
¶
Index ¶
- Constants
- type Account
- type Address
- type BigMapUpdate
- type Block
- type Content
- type Head
- type Message
- type MessageType
- type Operation
- type Packet
- type Parameter
- type Transaction
- type TzKT
- func (tzkt *TzKT) Close() error
- func (tzkt *TzKT) Connect() error
- func (tzkt *TzKT) Listen() <-chan Message
- 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) SubscribeToHead() error
- func (tzkt *TzKT) SubscribeToOperations(address string, types ...string) error
Constants ¶
const ( MethodHead = "SubscribeToHead" MethodBlocks = "SubscribeToBlocks" MethodOperations = "SubscribeToOperations" MethodBigMap = "SubscribeToBigMaps" MethodAccounts = "SubscribeToAccounts" )
Methods
const ( ChannelHead = "head" ChannelBlocks = "blocks" ChannelOperations = "operations" ChannelBigMap = "bigmaps" ChannelAccounts = "accounts" )
Channels
const ( KindTransaction = "transaction" KindOrigination = "origination" KindDelegation = "delegation" KindEndorsement = "endorsement" KindBallot = "ballot" KindProposal = "proposal" KindActivation = "activation" KindDoubleBaking = "double_baking" KindDoubleEndorsing = "double_endorsing" KindNonceRevelation = "nonce_revelation" KindReveal = "reveal" )
operation kinds
const ( BigMapTagMetadata = "metadata" BigMapTagTokenMetadata = "token_metadata" )
Big map tags
const (
BaseURL = "https://api.tzkt.io/v1/events"
)
Base URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶ added in v0.1.27
type Account struct {
Type string `json:"type"`
Address string `json:"address"`
Kind string `json:"kind"`
Tzips []string `json:"tzips"`
Alias string `json:"alias"`
Balance int64 `json:"balance"`
Creator Address `json:"creator"`
NumContracts int64 `json:"numContracts"`
NumDelegations int64 `json:"numDelegations"`
NumOriginations int64 `json:"numOriginations"`
NumTransactions int64 `json:"numTransactions"`
NumReveals int64 `json:"numReveals"`
NumMigrations int64 `json:"numMigrations"`
FirstActivity int64 `json:"firstActivity"`
FirstActivityTime time.Time `json:"firstActivityTime"`
LastActivity int64 `json:"lastActivity"`
LastActivityTime time.Time `json:"lastActivityTime"`
TypeHash int64 `json:"typeHash"`
CodeHash int64 `json:"codeHash"`
}
Account -
type BigMapUpdate ¶ added in v0.1.27
type BigMapUpdate struct {
ID int64 `json:"id"`
Level int64 `json:"level"`
Timestamp time.Time `json:"timestamp"`
Bigmap int64 `json:"bigmap"`
Contract Address `json:"contract"`
Path string `json:"path"`
Action string `json:"action"`
Content *Content `json:"content,omitempty"`
}
BigMapUpdate -
type Block ¶ added in v0.1.27
type Block struct {
Cycle int64 `json:"cycle"`
Level int64 `json:"level"`
Hash string `json:"hash"`
Timestamp time.Time `json:"timestamp"`
Proto int64 `json:"proto"`
Priority int64 `json:"priority"`
Validations int64 `json:"validations"`
Deposit int64 `json:"deposit"`
Reward int64 `json:"reward"`
Fees int64 `json:"fees"`
LbEscapeEma int64 `json:"lbEscapeEma"`
Baker Address `json:"baker"`
Software struct {
Version string `json:"version"`
Date time.Time `json:"date"`
} `json:"software"`
NonceRevealed bool `json:"nonceRevealed"`
LbEscapeVote bool `json:"lbEscapeVote"`
}
Block -
type Content ¶ added in v0.1.27
type Content struct {
Hash string `json:"hash"`
Key string `json:"key"`
Value stdJSON.RawMessage `json:"value"`
}
Content -
type Head ¶ added in v0.1.27
type Head struct {
Chain string `json:"chain"`
ChainID string `json:"chainId"`
Cycle int64 `json:"cycle"`
Level int64 `json:"level"`
Hash string `json:"hash"`
Protocol string `json:"protocol"`
Timestamp time.Time `json:"timestamp"`
VotingEpoch int64 `json:"votingEpoch"`
VotingPeriod int64 `json:"votingPeriod"`
KnownLevel int64 `json:"knownLevel"`
LastSync time.Time `json:"lastSync"`
Synced bool `json:"synced"`
QuoteLevel int64 `json:"quoteLevel"`
QuoteBtc decimal.Decimal `json:"quoteBtc"`
QuoteEur decimal.Decimal `json:"quoteEur"`
QuoteUsd decimal.Decimal `json:"quoteUsd"`
QuoteCny decimal.Decimal `json:"quoteCny"`
QuoteJpy decimal.Decimal `json:"quoteJpy"`
QuoteKrw decimal.Decimal `json:"quoteKrw"`
QuoteEth decimal.Decimal `json:"quoteEth"`
}
Head -
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 )
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 Parameter ¶ added in v0.1.27
type Parameter struct {
Entrypoint string `json:"entrypoint"`
Value stdJSON.RawMessage `json:"value"`
}
Parameter -
type Transaction ¶ added in v0.1.27
type Transaction struct {
Operation
Sender Address `json:"sender"`
Target Address `json:"target"`
Initiator Address `json:"initiator"`
Amount decimal.Decimal `json:"amount"`
Parameter Parameter `json:"parameter"`
Timestamp time.Time `json:"timestamp"`
ID int64 `json:"id"`
Level int64 `json:"level"`
Counter int64 `json:"counter"`
GasLimit int64 `json:"gasLimit"`
GasUsed int64 `json:"gasUsed"`
StorageLimit int64 `json:"storageLimit"`
StorageUsed int64 `json:"storageUsed"`
BakerFee int64 `json:"bakerFee"`
StorageFee int64 `json:"storageFee"`
AllocationFee int64 `json:"allocationFee"`
Status string `json:"status"`
Parameters string `json:"parameters"`
Block string `json:"block"`
Hash string `json:"hash"`
HasInternals bool `json:"hasInternals"`
}
Transaction -
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) SubscribeToAccounts ¶ added in v0.1.17
SubscribeToBigMaps - 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) 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.