Documentation
¶
Index ¶
- Constants
- type Account
- type Alias
- type BigMapUpdate
- type Block
- type Content
- type Delegation
- type Head
- type Message
- type MessageType
- type Operation
- type OriginatedContract
- type Origination
- type Packet
- type Parameter
- type QuoteShort
- type Reveal
- type Transaction
- type TzKT
- func (tzkt *TzKT) Close() error
- func (tzkt *TzKT) Connect() error
- func (tzkt *TzKT) IsConnected() bool
- 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 Alias `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 uint64 `json:"id"`
Level uint64 `json:"level"`
Timestamp time.Time `json:"timestamp"`
Bigmap int64 `json:"bigmap"`
Contract Alias `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 uint64 `json:"cycle"`
Level uint64 `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 Alias `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 Delegation ¶ added in v0.1.30
type Delegation struct {
Operation
ID uint64 `json:"id"`
Level uint64 `json:"level"`
Timestamp time.Time `json:"timestamp"`
Block string `json:"block"`
Hash string `json:"hash"`
Counter uint64 `json:"counter"`
Initiator *Account `json:"initiator"`
Sender *Account `json:"sender"`
Nonce uint64 `json:"nonce"`
GasLimit uint64 `json:"gasLimit"`
GasUsed uint64 `json:"gasUsed"`
BakerFee uint64 `json:"bakerFee"`
Amount uint64 `json:"amount"`
PrevDelegate *Account `json:"prevDelegate"`
NewDelegate *Account `json:"newDelegate"`
Status string `json:"status"`
Errors stdJSON.RawMessage `json:"errors,omitempty"`
Quote *QuoteShort `json:"quote,omitempty"`
}
Delegation -
type Head ¶ added in v0.1.27
type Head struct {
Chain string `json:"chain"`
ChainID string `json:"chainId"`
Cycle int64 `json:"cycle"`
Level uint64 `json:"level"`
Hash string `json:"hash"`
Protocol string `json:"protocol"`
Timestamp time.Time `json:"timestamp"`
VotingEpoch int64 `json:"votingEpoch"`
VotingPeriod int64 `json:"votingPeriod"`
KnownLevel uint64 `json:"knownLevel"`
LastSync time.Time `json:"lastSync"`
Synced bool `json:"synced"`
QuoteLevel uint64 `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 MessageTypeSubscribed )
message types
type OriginatedContract ¶ added in v0.1.30
type OriginatedContract struct {
Kind string `json:"kind"`
Alias string `json:"alias,omitempty"`
Address string `json:"address,omitempty"`
TypeHash int64 `json:"typeHash"`
CodeHash int64 `json:"codeHash"`
}
OriginatedContract -
type Origination ¶ added in v0.1.30
type Origination struct {
Operation
ID uint64 `json:"id"`
Level uint64 `json:"level"`
Timestamp time.Time `json:"timestamp"`
Block string `json:"block"`
Hash string `json:"hash"`
Counter uint64 `json:"counter"`
Initiator *Alias `json:"initiator"`
Sender *Alias `json:"sender"`
Nonce *uint64 `json:"nonce"`
GasLimit uint64 `json:"gasLimit"`
GasUsed uint64 `json:"gasUsed"`
StorageLimit uint64 `json:"storageLimit"`
StorageUsed uint64 `json:"storageUsed"`
BakerFee uint64 `json:"bakerFee"`
StorageFee uint64 `json:"storageFee"`
AllocationFee uint64 `json:"allocationFee"`
ContractBalance uint64 `json:"contractBalance"`
ContractManager *Alias `json:"contractManager"`
ContractDelegate *Alias `json:"contractDelegate"`
Code stdJSON.RawMessage `json:"code"`
Storage stdJSON.RawMessage `json:"storage"`
Diffs stdJSON.RawMessage `json:"diffs"`
Status string `json:"status"`
Errors stdJSON.RawMessage `json:"errors,omitempty"`
OriginatedContract *OriginatedContract `json:"originatedContract,omitempty"`
Quote *QuoteShort `json:"quote,omitempty"`
}
Origination -
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 QuoteShort ¶ added in v0.1.30
type QuoteShort struct {
BTC decimal.Decimal `json:"btc,omitempty"`
EUR decimal.Decimal `json:"eur,omitempty"`
USD decimal.Decimal `json:"usd,omitempty"`
CNY decimal.Decimal `json:"cny,omitempty"`
JPY decimal.Decimal `json:"jpy,omitempty"`
KRW decimal.Decimal `json:"krw,omitempty"`
ETH decimal.Decimal `json:"eth,omitempty"`
}
QuoteShort -
type Reveal ¶ added in v0.1.30
type Reveal struct {
Operation
ID uint64 `json:"id"`
Level uint64 `json:"level"`
Timestamp time.Time `json:"timestamp"`
Block string `json:"block"`
Hash string `json:"hash"`
Sender *Alias `json:"sender"`
Counter uint64 `json:"counter"`
GasLimit uint64 `json:"gasLimit"`
GasUsed uint64 `json:"gasUsed"`
BakerFee uint64 `json:"bakerFee"`
Status string `json:"status"`
Errors stdJSON.RawMessage `json:"errors,omitempty"`
Quote *QuoteShort `json:"quote,omitempty"`
}
Reveal -
type Transaction ¶ added in v0.1.27
type Transaction struct {
Operation
Sender Alias `json:"sender"`
Target Alias `json:"target"`
Initiator Alias `json:"initiator"`
Amount decimal.Decimal `json:"amount"`
Parameter *Parameter `json:"parameter"`
Timestamp time.Time `json:"timestamp"`
ID uint64 `json:"id"`
Level uint64 `json:"level"`
Counter uint64 `json:"counter"`
GasLimit uint64 `json:"gasLimit"`
GasUsed uint64 `json:"gasUsed"`
StorageLimit uint64 `json:"storageLimit"`
StorageUsed uint64 `json:"storageUsed"`
BakerFee uint64 `json:"bakerFee"`
StorageFee uint64 `json:"storageFee"`
AllocationFee uint64 `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) IsConnected ¶ added in v0.1.37
IsConnected - reports whether the connection to TzKT events is established
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.