tron

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 17 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 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) types.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"`
	Trc20    []map[string]string `json:"trc20"`
}

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       uint   `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 {
	client.Request
}

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"
)

type ExplorerClient added in v1.1.4

type ExplorerClient struct {
	client.Request
}

type ExplorerResponse added in v1.1.4

type ExplorerResponse struct {
	ExplorerTrc20Tokens []ExplorerTrc20Tokens `json:"trc20token_balances"`
}

type ExplorerTrc20Tokens added in v1.1.4

type ExplorerTrc20Tokens struct {
	Name            string `json:"name"`
	Symbol          string `json:"symbol"`
	Decimals        int    `json:"decimals"`
	ContractAddress string `json:"contract_address"`
}

type Frozen added in v1.0.37

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

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 Init added in v1.1.0

func Init(api, explorerApi string) *Platform

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) GetActiveValidators added in v1.1.4

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

func (*Platform) GetBlockByNumber added in v1.0.37

func (p *Platform) GetBlockByNumber(num int64) (*types.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) (types.TokenPage, error)

func (*Platform) GetTokenTxsByAddress added in v1.0.37

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

func (*Platform) GetTxsByAddress added in v1.0.37

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

func (*Platform) GetValidators added in v1.0.37

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

func (*Platform) NormalizeBlockChannel added in v1.0.37

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

func (*Platform) NormalizeBlockTxs added in v1.0.37

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

func (*Platform) UndelegatedBalance added in v1.0.37

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

type TRC20TokenInfo added in v1.1.4

type TRC20TokenInfo struct {
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int    `json:"decimals"`
	Address  string `json:"address"`
}

type TRC20Transaction added in v1.1.4

type TRC20Transaction struct {
	From           string         `json:"from"`
	To             string         `json:"to"`
	BlockTimestamp int64          `json:"block_timestamp"`
	Value          string         `json:"value"`
	Type           string         `json:"type"`
	TransactionID  string         `json:"transaction_id"`
	TokenInfo      TRC20TokenInfo `json:"token_info"`
}

type TRC20Transactions added in v1.1.4

type TRC20Transactions struct {
	Data []TRC20Transaction `json:"data"`
}

type TransferValue

type TransferValue struct {
	Amount       types.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