ontology

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GovernanceContract = "AFmseVrdL9f9oyCzZefL9tG6UbviEH9ugK"
	ONGDecimals        = 9

	MsgSuccess MsgType = "SUCCESS"

	AssetONT AssetType = "ont"
	AssetONG AssetType = "ong"
	AssetAll AssetType = "all"
)
View Source
const (
	// The current value comes from https://cryptoslate.com/coins/ontology
	Annual = 4.45
)

Variables

This section is empty.

Functions

func Normalize

func Normalize(srcTx *Tx, assetName AssetType) (tx types.Tx, ok bool)

Types

type AssetType

type AssetType string

type Balance

type Balance struct {
	Balance      string    `json:"balance"`
	AssetName    AssetType `json:"asset_name"`
	AssetType    string    `json:"asset_type"`
	ContractHash string    `json:"contract_hash"`
}

type Balances

type Balances []Balance

type BalancesResult

type BalancesResult struct {
	BaseResponse
	Result Balances `json:"result"`
}

type BaseResponse

type BaseResponse struct {
	Code int     `json:"code"`
	Msg  MsgType `json:"msg"`
}

type Block

type Block struct {
	Height int64  `json:"block_height"`
	Hash   string `json:"block_hash"`
	Txs    []Tx   `json:"txs"`
}

type BlockRecords

type BlockRecords struct {
	Total   int64   `json:"total"`
	Records []Block `json:"records"`
}

type BlockResult

type BlockResult struct {
	BaseResponse
	Result BlockRecords `json:"result"`
}

type BlockResults

type BlockResults struct {
	BaseResponse
	Result Block `json:"result"`
}

type Client

type Client struct {
	client.Request
}

func (*Client) CurrentBlockNumber

func (c *Client) CurrentBlockNumber() (blocks BlockResult, err error)

func (*Client) GetBalances

func (c *Client) GetBalances(address string) (balances BalancesResult, err error)

func (*Client) GetBlockByNumber

func (c *Client) GetBlockByNumber(num int64) (block BlockResults, err error)

func (*Client) GetTxDetailsByHash

func (c *Client) GetTxDetailsByHash(hash string) (Tx, error)

func (*Client) GetTxsOfAddress

func (c *Client) GetTxsOfAddress(address string) (txPage TxsResult, err error)

type Detail

type Detail struct {
	Transfers Transfers `json:"transfers"`
}

type MsgType

type MsgType string

type Platform

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

func Init

func Init(api string) *Platform

func (*Platform) Coin

func (p *Platform) Coin() coin.Coin

func (*Platform) CurrentBlockNumber

func (p *Platform) CurrentBlockNumber() (int64, error)

func (*Platform) GetActiveValidators

func (p *Platform) GetActiveValidators() (blockatlas.StakeValidators, error)

func (*Platform) GetBlockByNumber

func (p *Platform) GetBlockByNumber(num int64) (*types.Block, error)

func (*Platform) GetDelegations

func (p *Platform) GetDelegations(address string) (blockatlas.DelegationsPage, error)

func (*Platform) GetDetails

func (p *Platform) GetDetails() blockatlas.StakingDetails

func (*Platform) GetTokenTxsByAddress

func (p *Platform) GetTokenTxsByAddress(address string, token string) (types.Txs, error)

func (*Platform) GetTxsByAddress

func (p *Platform) GetTxsByAddress(address string) (types.Txs, error)

func (*Platform) GetValidators

func (p *Platform) GetValidators() (blockatlas.ValidatorPage, error)

func (*Platform) UndelegatedBalance

func (p *Platform) UndelegatedBalance(address string) (string, error)

type Transfer

type Transfer struct {
	Amount      string    `json:"amount"`
	FromAddress string    `json:"from_address"`
	ToAddress   string    `json:"to_address"`
	AssetName   AssetType `json:"asset_name"`
	Description string    `json:"description,omitempty"`
}

type Transfers

type Transfers []Transfer

type Tx

type Tx struct {
	Hash        string    `json:"tx_hash"`
	ConfirmFlag uint64    `json:"confirm_flag"`
	Time        int64     `json:"tx_time"`
	Height      uint64    `json:"block_height"`
	Fee         string    `json:"fee"`
	BlockIndex  uint64    `json:"block_index"`
	EventType   uint64    `json:"event_type,omitempty"`
	Description string    `json:"description,omitempty"`
	Details     Detail    `json:"detail,omitempty"`
	Transfers   Transfers `json:"transfers,omitempty"`
}

type TxResult

type TxResult struct {
	BaseResponse
	Result Tx `json:"result"`
}

type TxsResult

type TxsResult struct {
	BaseResponse
	Result []Tx `json:"result"`
}

Jump to

Keyboard shortcuts

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