tron

package
v1.1.16-0...-5f6d184 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 18 Imported by: 0

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

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

Types

type Account

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

type AccountData

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

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

type AssetInfo

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

type AssetV2

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

type Block

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

type BlockData

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

type BlockRequest

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

type Blocks

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

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

type ExplorerResponse

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

type ExplorerTrc20Tokens

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

type Frozen

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

type GridClient

type GridClient struct {
	client.Request
}

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

func Init(api, gridApi 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) GetTokenListByAddress

func (p *Platform) GetTokenListByAddress(address string) ([]types.Token, error)

func (*Platform) GetTokenListIdsByAddress

func (p *Platform) GetTokenListIdsByAddress(address string) ([]string, error)

func (*Platform) GetTokenTxsByAddress

func (p *Platform) GetTokenTxsByAddress(address, 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) NormalizeBlockChannel

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

func (*Platform) NormalizeBlockTxs

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

func (*Platform) UndelegatedBalance

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

type TRC20TokenInfo

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

type TRC20Transaction

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

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

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

type Validators

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

type Votes

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

type VotesRequest

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