blockatlas

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DelegationStatusActive  DelegationStatus = "active"
	DelegationStatusPending DelegationStatus = "pending"

	DelegationTypeAuto     DelegationType = "auto"
	DelegationTypeDelegate DelegationType = "delegate"

	DefaultAnnualReward = 0.0
)

Variables

View Source
var (
	// ErrSourceConn signals that the connection to the source API failed
	ErrSourceConn = errors.New("connection to servers failed")

	// ErrInvalidAddr signals that the requested address is invalid
	ErrInvalidAddr = errors.New("invalid address")

	// ErrNotFound signals that the resource has not been found
	ErrNotFound = errors.New("not found")

	// ErrInvalidKey signals that the requested key is invalid
	ErrInvalidKey = errors.New("invalid key")
)

Functions

func FindHightestAPR

func FindHightestAPR(validators []Validator) float64

func GenCollectibleId

func GenCollectibleId(contract, tokenId string) string

func GetValidParameter

func GetValidParameter(first, second string) string

func MapJsonObject

func MapJsonObject(from interface{}, to interface{}) error

Types

type BlockAPI

type BlockAPI interface {
	Platform
	CurrentBlockNumber() (int64, error)
	GetBlockByNumber(num int64) (*types.Block, error)
}

BlockAPI provides block information and lookups

type CollectionsAPI

type CollectionsAPI interface {
	Platform
	GetCollections(owner string) (types.CollectionPage, error)
	GetCollectibles(owner, collectibleID string) (types.CollectiblePage, error)
}

type CollectionsAPIs

type CollectionsAPIs map[uint]CollectionsAPI

type Delegation

type Delegation struct {
	Delegator StakeValidator   `json:"delegator"`
	Value     string           `json:"value"`
	Status    DelegationStatus `json:"status"`
	Metadata  interface{}      `json:"metadata,omitempty"`
}

type DelegationMetaDataPending

type DelegationMetaDataPending struct {
	AvailableDate uint `json:"available_date"`
}

type DelegationResponse

type DelegationResponse struct {
	Delegations DelegationsPage `json:"delegations"`
	Balance     string          `json:"balance"`
	Address     string          `json:"address"`
	StakingResponse
}

type DelegationStatus

type DelegationStatus string

type DelegationType

type DelegationType string

type DelegationsBatchPage

type DelegationsBatchPage []DelegationResponse

type DelegationsPage

type DelegationsPage []Delegation

type Platform

type Platform interface {
	Coin() coin.Coin
}

Platform can be used to access a crypto service

type Platforms

type Platforms map[string]Platform

func (Platforms) GetPlatformList

func (ps Platforms) GetPlatformList() []Platform

type ResultsResponse

type ResultsResponse struct {
	Results interface{} `json:"docs"`
}

type StakeAPI

type StakeAPI interface {
	Platform
	UndelegatedBalance(address string) (string, error)
	GetDetails() StakingDetails
	GetValidators() (ValidatorPage, error)
	GetDelegations(address string) (DelegationsPage, error)
	GetActiveValidators() (StakeValidators, error)
}

StakingAPI provides staking information

type StakeValidator

type StakeValidator struct {
	ID      string             `json:"id"`
	Status  bool               `json:"status"`
	Info    StakeValidatorInfo `json:"info,omitempty"`
	Details StakingDetails     `json:"details,omitempty"`
}

type StakeValidatorInfo

type StakeValidatorInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Image       string `json:"image"`
	Website     string `json:"website"`
}

type StakeValidators

type StakeValidators []StakeValidator

func (StakeValidators) ToMap

func (s StakeValidators) ToMap() ValidatorMap

type StakingBatchPage

type StakingBatchPage []StakingResponse

type StakingDetails

type StakingDetails struct {
	Reward        StakingReward  `json:"reward"`
	LockTime      int            `json:"locktime"`
	MinimumAmount types.Amount   `json:"minimum_amount"`
	Type          DelegationType `json:"type"`
}

type StakingResponse

type StakingResponse struct {
	Coin    *coin.ExternalCoin `json:"coin"`
	Details StakingDetails     `json:"details"`
}

type StakingReward

type StakingReward struct {
	Annual float64 `json:"annual"`
}

type TokenTxAPI

type TokenTxAPI interface {
	Platform
	GetTokenTxsByAddress(address, token string) (types.Txs, error)
}

TokenTxAPI provides token transaction lookups

type TokensAPI

type TokensAPI interface {
	Platform
	GetTokenListByAddress(address string) ([]types.Token, error)
	GetTokenListIdsByAddress(address string) ([]string, error)
}

TokensAPI provides token lookups

type TxAPI

type TxAPI interface {
	Platform
	GetTxsByAddress(address string) (types.Txs, error)
}

TxAPI provides transaction lookups based on address

type TxUtxoAPI

type TxUtxoAPI interface {
	TxAPI
	GetTxsByXpub(xpub string) (types.Txs, error)
}

TxUtxoAPI provides transaction lookup based on address and XPUB (Bitcoin-style)

type Validator

type Validator struct {
	ID      string         `json:"id"`
	Status  bool           `json:"status"`
	Details StakingDetails `json:"details"`
}

type ValidatorMap

type ValidatorMap map[string]StakeValidator

type ValidatorPage

type ValidatorPage []Validator

Jump to

Keyboard shortcuts

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