tron

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const Annual = 0.74

Variables

This section is empty.

Functions

func HexToAddress

func HexToAddress(hexAddr string) (b58 string, err error)

HexToAddress converts a hex representation of a Tron address into a Base58 string with a 4 byte checksum.

func Normalize

func Normalize(srcTx Tx) (*blockatlas.Tx, error)

/ Normalize converts a Tron transaction into the generic model

func NormalizeDelegations added in v1.0.37

func NormalizeDelegations(data *AccountData, validators blockatlas.ValidatorMap) []blockatlas.Delegation

func NormalizeToken added in v1.0.37

func NormalizeToken(info AssetInfo) blockatlas.Token

Types

type Account added in v1.0.37

type Account struct {
	Data []AccountData `json:"data"`
}

type AccountData added in v1.0.37

type AccountData struct {
	Balance  uint      `json:"balance"`
	AssetsV2 []AssetV2 `json:"assetV2"`
	Votes    []Votes   `json:"votes"`
	Frozen   []Frozen  `json:"frozen"`
}

type Asset added in v1.0.37

type Asset struct {
	Data []AssetInfo `json:"data"`
}

type AssetInfo added in v1.0.37

type AssetInfo struct {
	Name     string `json:"name"`
	Symbol   string `json:"abbr"`
	ID       string `json:"id"`
	Decimals uint   `json:"precision"`
}

type AssetV2 added in v1.0.37

type AssetV2 struct {
	Key string `json:"key"`
}

type Block added in v1.0.37

type Block struct {
	BlockId     string `json:"blockID"`
	Txs         []Tx   `json:"transactions"`
	BlockHeader struct {
		Data BlockData `json:"raw_data"`
	} `json:"block_header"`
}

type BlockData added in v1.0.37

type BlockData struct {
	Number    int64 `json:"number"`
	Timestamp int64 `json:"timestamp"`
}

type BlockRequest added in v1.0.37

type BlockRequest struct {
	StartNum int64 `json:"startNum"`
	EndNum   int64 `json:"endNum"`
}

type Blocks added in v1.0.37

type Blocks struct {
	Blocks []Block `json:"block"`
}

type Client

type Client struct {
	blockatlas.Request
}

func (*Client) CurrentBlockNumber added in v1.0.37

func (c *Client) CurrentBlockNumber() (int64, error)

func (*Client) GetAccount added in v1.0.37

func (c *Client) GetAccount(address string) (accounts *Account, err error)

func (*Client) GetAccountVotes added in v1.0.37

func (c *Client) GetAccountVotes(address string) (account *AccountData, err error)

func (*Client) GetBlockByNumber added in v1.0.37

func (c *Client) GetBlockByNumber(num int64) (Block, error)

func (*Client) GetTokenInfo added in v1.0.37

func (c *Client) GetTokenInfo(id string) (asset Asset, err error)

func (*Client) GetTxsOfAddress

func (c *Client) GetTxsOfAddress(address, token string) ([]Tx, error)

func (*Client) GetValidators added in v1.0.37

func (c *Client) GetValidators() (validators Validators, err error)

type Contract

type Contract struct {
	Type      ContractType `json:"type"`
	Parameter struct {
		Value TransferValue `json:"value"`
	} `json:"parameter"`
}

type ContractType added in v1.0.37

type ContractType string
const (
	TransferContract      ContractType = "TransferContract"
	TransferAssetContract ContractType = "TransferAssetContract"
	CreateSmartContract   ContractType = "CreateSmartContract"
	TriggerSmartContract  ContractType = "TriggerSmartContract"
)

type Frozen added in v1.0.37

type Frozen struct {
	ExpireTime    int64       `json:"expire_time"`
	FrozenBalance interface{} `json:"frozen_balance,string"`
}

type Page

type Page struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
	Txs     []Tx   `json:"data"`
}

type Platform

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

func (*Platform) Coin

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

func (*Platform) CurrentBlockNumber added in v1.0.37

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

func (*Platform) GetBlockByNumber added in v1.0.37

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

func (*Platform) GetDelegations added in v1.0.37

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

func (*Platform) GetDetails added in v1.0.37

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

func (*Platform) GetTokenListByAddress added in v1.0.37

func (p *Platform) GetTokenListByAddress(address string) (blockatlas.TokenPage, error)

func (*Platform) GetTokenTxsByAddress added in v1.0.37

func (p *Platform) GetTokenTxsByAddress(address, token string) (blockatlas.TxPage, error)

func (*Platform) GetTxsByAddress added in v1.0.37

func (p *Platform) GetTxsByAddress(address string) (blockatlas.TxPage, error)

func (*Platform) GetValidators added in v1.0.37

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

func (*Platform) Init

func (p *Platform) Init() error

func (*Platform) NormalizeBlockChannel added in v1.0.37

func (p *Platform) NormalizeBlockChannel(srcTx Tx, txChan chan blockatlas.Tx)

func (*Platform) NormalizeBlockTxs added in v1.0.37

func (p *Platform) NormalizeBlockTxs(srcTxs []Tx) chan blockatlas.Tx

func (*Platform) UndelegatedBalance added in v1.0.37

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

type TransferValue

type TransferValue struct {
	Amount       blockatlas.Amount `json:"amount"`
	OwnerAddress string            `json:"owner_address"`
	ToAddress    string            `json:"to_address"`
	AssetName    string            `json:"asset_name,omitempty"`
}

type Tx

type Tx struct {
	ID        string `json:"txID"`
	BlockTime int64  `json:"block_timestamp"`
	Data      TxData `json:"raw_data"`
}

type TxData

type TxData struct {
	Timestamp int64      `json:"timestamp"`
	Contracts []Contract `json:"contract"`
}

type Validator added in v1.0.37

type Validator struct {
	Address string `json:"address"`
}

type Validators added in v1.0.37

type Validators struct {
	Witnesses []Validator `json:"witnesses"`
}

type Votes added in v1.0.37

type Votes struct {
	VoteAddress string `json:"vote_address"`
	VoteCount   int    `json:"vote_count"`
}

type VotesRequest added in v1.0.37

type VotesRequest struct {
	Address string `json:"address"`
	Visible bool   `json:"visible"`
}

Jump to

Keyboard shortcuts

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