api

package
v0.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const (
	KindTransaction            = "transaction"
	KindOrigination            = "origination"
	KindEndorsement            = "endorsement"
	KindBallot                 = "ballot"
	KindProposal               = "proposal"
	KindDoubleBaking           = "double_baking"
	KindDoubleEndorsing        = "double_endorsing"
	KindActivation             = "activation"
	KindNonceRevelation        = "nonce_revelation"
	KindDelegation             = "delegation"
	KindReveal                 = "reveal"
	KindRegisterGlobalConstant = "register_constant"
)
View Source
const (
	BaseURL = "https://api.tzkt.io"
)

urls

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API -

func New

func New(baseURL string, opts ...Option) *API

New -

func (*API) BuildContractParameters added in v0.1.40

func (tzkt *API) BuildContractParameters(ctx context.Context, contract, entrypoint string, parameters interface{}) ([]byte, error)

BuildContractParameters -

func (*API) GetAccountsMetadata added in v0.2.8

func (tzkt *API) GetAccountsMetadata(ctx context.Context, filters map[string]string) ([]AccountMetadata, error)

GetAccountsMetadata -

func (*API) GetActivations

func (tzkt *API) GetActivations(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetActivations -

func (*API) GetBallots

func (tzkt *API) GetBallots(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetBallots -

func (*API) GetBigmapByID

func (tzkt *API) GetBigmapByID(ctx context.Context, id uint64, filters map[string]string) (response BigMap, err error)

GetBigmapByID -

func (*API) GetBigmapKey

func (tzkt *API) GetBigmapKey(ctx context.Context, id uint64, key string, filters map[string]string) (response BigMapKey, err error)

GetBigmapKey -

func (*API) GetBigmapKeyUpdates

func (tzkt *API) GetBigmapKeyUpdates(ctx context.Context, id uint64, key string, filters map[string]string) (response []BigMapKeyUpdate, err error)

GetBigmapKeyUpdates -

func (*API) GetBigmapKeys

func (tzkt *API) GetBigmapKeys(ctx context.Context, id uint64, filters map[string]string) (response []BigMapKey, err error)

GetBigmapKeys -

func (*API) GetBigmapUpdates

func (tzkt *API) GetBigmapUpdates(ctx context.Context, filters map[string]string) (response []BigMapUpdate, err error)

GetBigmapUpdates -

func (*API) GetBigmaps

func (tzkt *API) GetBigmaps(ctx context.Context, filters map[string]string) (response []BigMap, err error)

GetBigmaps -

func (*API) GetBigmapsCount

func (tzkt *API) GetBigmapsCount(ctx context.Context) (uint64, error)

GetBigmapsCount -

func (*API) GetBlock

func (tzkt *API) GetBlock(ctx context.Context, level uint64) (b Block, err error)

GetBlock -

func (*API) GetBlocks

func (tzkt *API) GetBlocks(ctx context.Context, filters map[string]string) (b []Block, err error)

GetBlocks -

func (*API) GetContractJSONSchema added in v0.1.39

func (tzkt *API) GetContractJSONSchema(ctx context.Context, address string) (response ContractJSONSchema, err error)

GetContractJSONSchema -

func (*API) GetContractStorage added in v0.1.39

func (tzkt *API) GetContractStorage(ctx context.Context, address string, output interface{}) error

GetContractStorage -

func (*API) GetDelegateByAddress added in v0.1.1

func (tzkt *API) GetDelegateByAddress(ctx context.Context, address string) (delegate Delegate, err error)

GetDelegateByAddress -

func (*API) GetDelegates added in v0.1.1

func (tzkt *API) GetDelegates(ctx context.Context, filters map[string]string) (delegates []Delegate, err error)

GetDelegates -

func (*API) GetDelegatesCount added in v0.1.1

func (tzkt *API) GetDelegatesCount(ctx context.Context) (uint64, error)

GetDelegatesCount -

func (*API) GetDelegations

func (tzkt *API) GetDelegations(ctx context.Context, filters map[string]string) (operations []Delegation, err error)

GetDelegations -

func (*API) GetDoubleBakings

func (tzkt *API) GetDoubleBakings(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetDoubleBakings -

func (*API) GetDoubleEndorsings

func (tzkt *API) GetDoubleEndorsings(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetDoubleEndorsings -

func (*API) GetEndorsements

func (tzkt *API) GetEndorsements(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetEndorsements -

func (*API) GetHead

func (tzkt *API) GetHead(ctx context.Context) (head Head, err error)

GetHead -

func (*API) GetMigrations added in v0.2.7

func (tzkt *API) GetMigrations(ctx context.Context, filters map[string]string) (operations []Migration, err error)

GetMigrations -

func (*API) GetNonceRevelations

func (tzkt *API) GetNonceRevelations(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetNonceRevelations -

func (*API) GetOperationsByHash added in v0.2.8

func (tzkt *API) GetOperationsByHash(ctx context.Context, hash string, filters map[string]string) (operations []Operation, err error)

GetOperationsByHash -

func (*API) GetOriginations

func (tzkt *API) GetOriginations(ctx context.Context, filters map[string]string) (operations []Origination, err error)

GetOriginations -

func (*API) GetProposals

func (tzkt *API) GetProposals(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetProposals -

func (*API) GetRegisterConstants added in v0.1.32

func (tzkt *API) GetRegisterConstants(ctx context.Context, filters map[string]string) (operations []Operation, err error)

GetRegisterConstants -

func (*API) GetReveals

func (tzkt *API) GetReveals(ctx context.Context, filters map[string]string) (operations []Reveal, err error)

GetReveals -

func (*API) GetRights added in v0.1.1

func (tzkt *API) GetRights(ctx context.Context, filters map[string]string) (rights []Right, err error)

GetRights -

func (*API) GetTokenTransfers added in v0.2.6

func (tzkt *API) GetTokenTransfers(ctx context.Context, filters map[string]string) (transfers []Transfer, err error)

GetTokenTransfers -

func (*API) GetTransactions

func (tzkt *API) GetTransactions(ctx context.Context, filters map[string]string) (operations []Transaction, err error)

GetTransactions -

func (*API) GetTransactionsByHash added in v0.2.8

func (tzkt *API) GetTransactionsByHash(ctx context.Context, hash string, filters map[string]string) (operations []Transaction, err error)

GetTransactionsByHash -

type AccountMetadata added in v0.2.8

type AccountMetadata struct {
	Address     string `json:"address"`
	Kind        string `json:"kind"`
	Alias       string `json:"alias"`
	Description string `json:"description"`
	Site        string `json:"site"`
	Support     string `json:"support"`
	Email       string `json:"email"`
	Twitter     string `json:"twitter"`
	Telegram    string `json:"telegram"`
	Discord     string `json:"discord"`
	Reddit      string `json:"reddit"`
	Slack       string `json:"slack"`
	Github      string `json:"github"`
	Gitlab      string `json:"gitlab"`
	Instagram   string `json:"instagram"`
	Facebook    string `json:"facebook"`
	Medium      string `json:"medium"`
}

AccountMetadata -

type AdditionalProperties added in v0.1.39

type AdditionalProperties struct {
	Value *JSONSchema `json:"-"`
}

AdditionalProperties -

func (*AdditionalProperties) UnmarshalJSON added in v0.1.39

func (props *AdditionalProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON -

type Address

type Address struct {
	Alias   string `json:"alias"`
	Address string `json:"address"`
}

Address -

type BigMap

type BigMap struct {
	Ptr        int64              `json:"ptr"`
	Contract   Address            `json:"contract"`
	Path       string             `json:"path"`
	Active     bool               `json:"active"`
	FirstLevel uint64             `json:"firstLevel"`
	LastLevel  uint64             `json:"lastLevel"`
	TotalKeys  uint64             `json:"totalKeys"`
	ActiveKeys uint64             `json:"activeKeys"`
	Updates    uint64             `json:"updates"`
	KeyType    stdJSON.RawMessage `json:"keyType"`
	ValueType  stdJSON.RawMessage `json:"valueType"`
}

BigMap -

type BigMapJSONSchema added in v0.1.39

type BigMapJSONSchema struct {
	Name  string     `json:"name"`
	Path  string     `json:"path"`
	Key   JSONSchema `json:"keySchema"`
	Value JSONSchema `json:"valueSchema"`
}

BigMapJSONSchema -

type BigMapKey

type BigMapKey struct {
	ID         uint64             `json:"id"`
	Active     bool               `json:"active"`
	Hash       string             `json:"hash"`
	Key        string             `json:"key"`
	Value      stdJSON.RawMessage `json:"value"`
	FirstLevel uint64             `json:"firstLevel"`
	LastLevel  uint64             `json:"lastLevel"`
	Updates    uint64             `json:"updates"`
}

BigMapKey -

type BigMapKeyUpdate added in v0.1.24

type BigMapKeyUpdate struct {
	ID        uint64             `json:"id"`
	Level     uint64             `json:"level"`
	Timestamp time.Time          `json:"timestamp"`
	Action    string             `json:"action"`
	Value     stdJSON.RawMessage `json:"value"`
}

BigMapKeyUpdate -

type BigMapUpdate

type BigMapUpdate struct {
	ID        uint64               `json:"id"`
	Level     uint64               `json:"level"`
	Timestamp time.Time            `json:"timestamp"`
	Bigmap    int64                `json:"bigmap"`
	Contract  Address              `json:"contract"`
	Path      string               `json:"path"`
	Action    string               `json:"action"`
	Content   *BigMapUpdateContent `json:"content,omitempty"`
}

BigMapUpdate -

type BigMapUpdateContent

type BigMapUpdateContent struct {
	Hash  string             `json:"hash"`
	Key   stdJSON.RawMessage `json:"key"`
	Value stdJSON.RawMessage `json:"value"`
}

BigMapUpdateContent -

type Block

type Block struct {
	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"`
	NonceRevealed bool      `json:"nonceRevealed"`
	Baker         Address   `json:"baker"`
}

Block -

type Contract added in v0.2.1

type Contract struct {
	Kind     string `json:"kind"`
	Address  string `json:"address"`
	TypeHash int    `json:"typeHash"`
	CodeHash int    `json:"codeHash"`
}

Contract -

type ContractJSONSchema added in v0.1.39

type ContractJSONSchema struct {
	Storage     JSONSchema             `json:"storageSchema"`
	Entrypoints []EntrypointJSONSchema `json:"entrypoints"`
	BigMaps     []BigMapJSONSchema     `json:"bigMaps"`
}

ContractJSONSchema -

type Delegate added in v0.1.1

type Delegate struct {
	Type                   string    `json:"type"`
	Alias                  string    `json:"alias"`
	Address                string    `json:"address"`
	PublicKey              string    `json:"publicKey"`
	Balance                int64     `json:"balance"`
	FrozenDeposits         int64     `json:"frozenDeposits"`
	FrozenRewards          int64     `json:"frozenRewards"`
	FrozenFees             int64     `json:"frozenFees"`
	Counter                int64     `json:"counter"`
	ActivationLevel        int64     `json:"activationLevel"`
	StakingBalance         int64     `json:"stakingBalance"`
	NumContracts           int64     `json:"numContracts"`
	NumDelegators          int64     `json:"numDelegators"`
	NumBlocks              int64     `json:"numBlocks"`
	NumEndorsements        int64     `json:"numEndorsements"`
	NumBallots             int64     `json:"numBallots"`
	NumProposals           int64     `json:"numProposals"`
	NumActivations         int64     `json:"numActivations"`
	NumDoubleBaking        int64     `json:"numDoubleBaking"`
	NumDoubleEndorsing     int64     `json:"numDoubleEndorsing"`
	NumNonceRevelations    int64     `json:"numNonceRevelations"`
	NumRevelationPenalties int64     `json:"numRevelationPenalties"`
	NumDelegations         int64     `json:"numDelegations"`
	NumOriginations        int64     `json:"numOriginations"`
	NumTransactions        int64     `json:"numTransactions"`
	NumReveals             int64     `json:"numReveals"`
	NumMigrations          int64     `json:"numMigrations"`
	FirstActivity          int64     `json:"firstActivity"`
	LastActivity           int64     `json:"lastActivity"`
	FirstActivityTime      time.Time `json:"firstActivityTime"`
	LastActivityTime       time.Time `json:"lastActivityTime"`
	ActivationTime         time.Time `json:"activationTime"`
	Software               Software  `json:"software"`
	Active                 bool      `json:"active"`
	Revealed               bool      `json:"revealed"`
}

Delegate -

type Delegation added in v0.2.1

type Delegation struct {
	Block       string          `json:"block"`
	Hash        string          `json:"hash"`
	Type        string          `json:"type"`
	Status      string          `json:"status"`
	Sender      Address         `json:"sender"`
	NewDelegate Address         `json:"newDelegate"`
	Timestamp   time.Time       `json:"timestamp"`
	Amount      decimal.Decimal `json:"amount"`
	ID          uint64          `json:"id"`
	Level       uint64          `json:"level"`
	Counter     uint64          `json:"counter"`
	GasLimit    uint64          `json:"gasLimit"`
	GasUsed     uint64          `json:"gasUsed"`
	BakerFee    uint64          `json:"bakerFee"`
	Nonce       *uint64         `json:"nonce,omitempty"`
}

Delegation -

type EntrypointJSONSchema added in v0.1.39

type EntrypointJSONSchema struct {
	Name      string     `json:"name"`
	Parameter JSONSchema `json:"parameterSchema"`
}

EntrypointJSONSchema -

type Error added in v0.2.1

type Error struct {
	Type string `json:"type"`
}

Error -

type Head struct {
	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   int64     `json:"knownLevel"`
	LastSync     time.Time `json:"lastSync"`
	Synced       bool      `json:"synced"`
	QuoteLevel   int64     `json:"quoteLevel"`
	QuoteBtc     float64   `json:"quoteBtc"`
	QuoteEur     float64   `json:"quoteEur"`
	QuoteUsd     float64   `json:"quoteUsd"`
}

Head -

type JSONSchema added in v0.1.39

type JSONSchema struct {
	Schema               string                `json:"$schema,omitempty"`
	Type                 string                `json:"type,omitempty"`
	Comment              string                `json:"$comment,omitempty"`
	Required             []string              `json:"required,omitempty"`
	Properties           map[string]JSONSchema `json:"properties,omitempty"`
	OneOf                []JSONSchema          `json:"oneOf"`
	AdditionalProperties AdditionalProperties  `json:"additionalProperties,omitempty"`
	PropertyNames        *JSONSchema           `json:"propertyNames,omitempty"`
	Items                *JSONSchema           `json:"items,omitempty"`
}

JSONSchema -

type Metadata added in v0.2.8

type Metadata[T MetadataConstraint] struct {
	Key   string `json:"key"`
	Value T      `json:"metadata"`
}

Metadata -

type MetadataConstraint added in v0.2.8

type MetadataConstraint interface {
	AccountMetadata
}

MetadataConstraint -

type Migration added in v0.2.7

type Migration struct {
	Type          string    `json:"type"`
	ID            uint64    `json:"id"`
	Level         uint64    `json:"level"`
	Timestamp     time.Time `json:"timestamp"`
	Block         string    `json:"block"`
	Kind          string    `json:"kind"`
	Account       Address   `json:"account"`
	BalanceChange int64     `json:"balanceChange"`
}

Migration -

type Operation

type Operation struct {
	ID         uint64      `json:"id" mapstructure:"id"`
	Level      uint64      `json:"level" mapstructure:"level"`
	Hash       string      `json:"hash" mapstructure:"hash"`
	Kind       string      `json:"type" mapstructure:"type"`
	Block      string      `json:"block" mapstructure:"block"`
	Delegate   *Address    `json:"delegate,omitempty" mapstructure:"delegate,omitempty"`
	GasUsed    *uint64     `json:"gasUsed,omitempty" mapstructure:"gasUsed,omitempty"`
	BakerFee   *uint64     `json:"bakerFee,omitempty" mapstructure:"bakerFee,omitempty"`
	Parameters *Parameters `json:"parameter,omitempty" mapstructure:"parameter,omitempty"`
}

Operation -

type Option added in v0.2.8

type Option func(*API)

Option -

func WithAuth added in v0.2.8

func WithAuth(user, privateKey string) Option

WithAuth -

type Origination added in v0.2.1

type Origination struct {
	Type             string    `json:"type"`
	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"`
	Sender           Address   `json:"sender"`
	Initiator        Address   `json:"initiator"`
	Nonce            *uint64   `json:"nonce,omitempty"`
	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  Address   `json:"contractManager"`
	ContractDelegate Address   `json:"contractDelegate"`
	Status           string    `json:"status"`
	Originated       Contract  `json:"originatedContract"`
	Errors           []Error   `json:"errors,omitempty"`
}

Origination -

type Parameters added in v0.1.23

type Parameters struct {
	Entrypoint string             `json:"entrypoint"`
	Value      stdJSON.RawMessage `json:"value"`
}

Parameters -

type Reveal added in v0.2.1

type Reveal struct {
	Type      string    `json:"type"`
	Status    string    `json:"status"`
	Block     string    `json:"block"`
	Hash      string    `json:"hash"`
	Timestamp time.Time `json:"timestamp"`
	Sender    Address   `json:"sender"`
	ID        uint64    `json:"id"`
	Level     uint64    `json:"level"`
	Counter   uint64    `json:"counter"`
	GasLimit  uint64    `json:"gasLimit"`
	GasUsed   uint64    `json:"gasUsed"`
	BakerFee  uint64    `json:"bakerFee"`
	Nonce     *uint64   `json:"nonce,omitempty"`
}

Reveal -

type Right struct {
	Type      string    `json:"type"`
	Cycle     uint64    `json:"cycle"`
	Level     uint64    `json:"level"`
	Timestamp time.Time `json:"timestamp"`
	Slots     uint64    `json:"slots"`
	Baker     Address   `json:"baker"`
	Status    string    `json:"status"`
}

Right -

type Software added in v0.1.1

type Software struct {
	Version string    `json:"version"`
	Date    time.Time `json:"date"`
}

Software -

type Token added in v0.2.6

type Token struct {
	ID       uint64             `json:"id"`
	Contract Address            `json:"contract"`
	TokenID  string             `json:"tokenId"`
	Standard string             `json:"standard"`
	Metadata stdJSON.RawMessage `json:"metadata,omitempty"`
}

Token -

type Transaction added in v0.2.1

type Transaction struct {
	Type          string          `json:"type"`
	Sender        Address         `json:"sender"`
	Target        Address         `json:"target"`
	Initiator     Address         `json:"initiator"`
	Amount        decimal.Decimal `json:"amount"`
	Parameter     *Parameters     `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"`
	Nonce         *uint64         `json:"nonce,omitempty"`
}

Transaction -

type Transfer added in v0.2.6

type Transfer struct {
	ID            uint64    `json:"id"`
	Level         uint64    `json:"level"`
	Timestamp     time.Time `json:"timestamp"`
	Token         Token     `json:"token"`
	From          *Address  `json:"from,omitempty"`
	To            *Address  `json:"to,omitempty"`
	Amount        string    `json:"amount"`
	TransactionID *uint64   `json:"transactionId,omitempty"`
	OriginationID *uint64   `json:"originationId,omitempty"`
	MigrationID   *uint64   `json:"migrationId,omitempty"`
}

Transfer -

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL