Documentation ¶
Index ¶
- Constants
- Variables
- func CheckProtocolVersion(version string) bool
- func GetInternalTransactionTarget(trace TraceEntry) string
- func GetTransactionType(to, input, txType string, internal bool) models.TransactionType
- type Action
- type Block
- type BlockData
- type Client
- type ClientMock
- func (c *ClientMock) AddLogsFromJson(trx_json string)
- func (c *ClientMock) AddPbftBlock(period uint64, block *Block)
- func (c *ClientMock) AddTracesFromJson(hash, traces_json string)
- func (c *ClientMock) AddTransactionFromJson(trx_json string)
- func (c *ClientMock) Close()
- func (c *ClientMock) GetBalanceAtBlock(address string, blockNumber uint64) (balance string, err error)
- func (c *ClientMock) GetBlockByNumber(number uint64) (blk *Block, err error)
- func (c *ClientMock) GetChainStats() (ns storage.FinalizationData, err error)
- func (c *ClientMock) GetDagBlockByHash(hash string) (dag DagBlock, err error)
- func (c *ClientMock) GetGenesis() (genesis GenesisObject, err error)
- func (c *ClientMock) GetLatestPeriod() (p uint64, e error)
- func (c *ClientMock) GetLogs(fromBlock, toBlock uint64, addresses []string, topics [][]string) (logs []EventLog, err error)
- func (c *ClientMock) GetPbftBlockWithDagBlocks(period uint64) (pbftWithDags PbftBlockWithDags, err error)
- func (c *ClientMock) GetPeriodDagBlocks(period uint64) (dags []DagBlock, err error)
- func (c *ClientMock) GetPeriodTransactions(num uint64) (trxs []Transaction, err error)
- func (c *ClientMock) GetPreviousBlockCertVotes(period uint64) (vr VotesResponse, err error)
- func (c *ClientMock) GetTransactionByHash(hash string) (trx Transaction, err error)
- func (c *ClientMock) GetValidatorsAtBlock(uint64) (validators []Validator, err error)
- func (c *ClientMock) GetVersion() (version string, err error)
- func (c *ClientMock) SubscribeNewHeads() (chan Block, *rpc.ClientSubscription, error)
- func (c *ClientMock) TraceBlockTransactions(num uint64) (traces []TransactionTrace, err error)
- type DagBlock
- type DposConfig
- type EventLog
- type GenesisObject
- type PbftBlockWithDags
- type PbftConfig
- type TraceEntry
- type TraceEntryResult
- type Transaction
- type TransactionTrace
- type Validator
- type Vote
- type VotesResponse
- type WsClient
- func (client *WsClient) Close()
- func (client *WsClient) GetBalanceAtBlock(address string, blockNumber uint64) (balance string, err error)
- func (client *WsClient) GetBlockByNumber(number uint64) (blk *Block, err error)
- func (client *WsClient) GetChainId() *big.Int
- func (client *WsClient) GetChainStats() (fd storage.FinalizationData, err error)
- func (client *WsClient) GetDagBlockByHash(hash string) (dag DagBlock, err error)
- func (client *WsClient) GetGenesis() (genesis GenesisObject, err error)
- func (client *WsClient) GetLatestPeriod() (uint64, error)
- func (client *WsClient) GetLogs(fromBlock, toBlock uint64, addresses []string, topics [][]string) (logs []EventLog, err error)
- func (client *WsClient) GetPbftBlockWithDagBlocks(period uint64) (pbftWithDags PbftBlockWithDags, err error)
- func (client *WsClient) GetPeriodDagBlocks(period uint64) (dags []DagBlock, err error)
- func (client *WsClient) GetPeriodTransactions(number uint64) (trxs []Transaction, err error)
- func (client *WsClient) GetPreviousBlockCertVotes(period uint64) (vr VotesResponse, err error)
- func (client *WsClient) GetTransactionByHash(hash string) (trx Transaction, err error)
- func (client *WsClient) GetValidatorsAtBlock(period uint64) (validators []Validator, err error)
- func (client *WsClient) GetVersion() (version string, err error)
- func (client *WsClient) SubscribeNewHeads() (chan Block, *rpc.ClientSubscription, error)
- func (client *WsClient) TraceBlockTransactions(number uint64) (traces []TransactionTrace, err error)
Constants ¶
View Source
const MinimumProtocolVersion = "1.5.0"
Variables ¶
View Source
var ErrFutureBlock = errors.New("Block is in the future")
View Source
var ErrNotImplemented = fmt.Errorf("Not implemented")
Functions ¶
func CheckProtocolVersion ¶ added in v0.4.0
func GetInternalTransactionTarget ¶ added in v0.3.3
func GetInternalTransactionTarget(trace TraceEntry) string
func GetTransactionType ¶ added in v0.2.1
func GetTransactionType(to, input, txType string, internal bool) models.TransactionType
Types ¶
type Block ¶
type Block struct { models.Pbft Transactions []string `json:"transactions"` TotalReward string `json:"totalReward"` }
func (*Block) UnmarshalJSON ¶ added in v1.5.4
type BlockData ¶ added in v1.5.4
type BlockData struct { Pbft *Block Dags []DagBlock Transactions []Transaction Traces []TransactionTrace Votes VotesResponse Validators []Validator }
func GetBlockData ¶ added in v1.5.4
func GetBlockDataFromPbft ¶ added in v1.5.4
func MakeEmptyBlockData ¶ added in v1.5.4
func MakeEmptyBlockData() *BlockData
type Client ¶ added in v0.2.1
type Client interface { GetBlockByNumber(number uint64) (blk *Block, err error) GetLatestPeriod() (uint64, error) TraceBlockTransactions(number uint64) (traces []TransactionTrace, err error) GetTransactionByHash(hash string) (trx Transaction, err error) GetPeriodTransactions(period uint64) (trxs []Transaction, err error) GetPbftBlockWithDagBlocks(period uint64) (pbftWithDags PbftBlockWithDags, err error) GetDagBlockByHash(hash string) (dag DagBlock, err error) GetPeriodDagBlocks(period uint64) (dags []DagBlock, err error) GetPreviousBlockCertVotes(period uint64) (vr VotesResponse, err error) GetValidatorsAtBlock(block_num uint64) (validators []Validator, err error) GetVersion() (version string, err error) GetGenesis() (genesis GenesisObject, err error) GetChainStats() (ns storage.FinalizationData, err error) SubscribeNewHeads() (chan Block, *rpc.ClientSubscription, error) GetBalanceAtBlock(address string, blockNumber uint64) (balance string, err error) GetLogs(fromBlock, toBlock uint64, addresses []string, topics [][]string) (logs []EventLog, err error) // Close disconnects from the node Close() }
type ClientMock ¶ added in v0.2.1
type ClientMock struct { Blocks map[uint64]*Block Traces map[string][]TransactionTrace Transactions map[string]Transaction BlockTransactions map[uint64][]string EventLogs map[string][]EventLog }
func MakeMockClient ¶ added in v0.2.1
func MakeMockClient() *ClientMock
func (*ClientMock) AddLogsFromJson ¶ added in v0.2.1
func (c *ClientMock) AddLogsFromJson(trx_json string)
func (*ClientMock) AddPbftBlock ¶ added in v1.5.4
func (c *ClientMock) AddPbftBlock(period uint64, block *Block)
func (*ClientMock) AddTracesFromJson ¶ added in v0.2.1
func (c *ClientMock) AddTracesFromJson(hash, traces_json string)
func (*ClientMock) AddTransactionFromJson ¶ added in v0.2.1
func (c *ClientMock) AddTransactionFromJson(trx_json string)
func (*ClientMock) Close ¶ added in v0.2.1
func (c *ClientMock) Close()
func (*ClientMock) GetBalanceAtBlock ¶ added in v0.2.1
func (c *ClientMock) GetBalanceAtBlock(address string, blockNumber uint64) (balance string, err error)
func (*ClientMock) GetBlockByNumber ¶ added in v0.2.1
func (c *ClientMock) GetBlockByNumber(number uint64) (blk *Block, err error)
func (*ClientMock) GetChainStats ¶ added in v0.2.1
func (c *ClientMock) GetChainStats() (ns storage.FinalizationData, err error)
func (*ClientMock) GetDagBlockByHash ¶ added in v0.2.1
func (c *ClientMock) GetDagBlockByHash(hash string) (dag DagBlock, err error)
func (*ClientMock) GetGenesis ¶ added in v0.2.1
func (c *ClientMock) GetGenesis() (genesis GenesisObject, err error)
func (*ClientMock) GetLatestPeriod ¶ added in v0.2.1
func (c *ClientMock) GetLatestPeriod() (p uint64, e error)
func (*ClientMock) GetPbftBlockWithDagBlocks ¶ added in v0.2.1
func (c *ClientMock) GetPbftBlockWithDagBlocks(period uint64) (pbftWithDags PbftBlockWithDags, err error)
func (*ClientMock) GetPeriodDagBlocks ¶ added in v0.2.1
func (c *ClientMock) GetPeriodDagBlocks(period uint64) (dags []DagBlock, err error)
func (*ClientMock) GetPeriodTransactions ¶ added in v0.2.1
func (c *ClientMock) GetPeriodTransactions(num uint64) (trxs []Transaction, err error)
func (*ClientMock) GetPreviousBlockCertVotes ¶ added in v0.2.1
func (c *ClientMock) GetPreviousBlockCertVotes(period uint64) (vr VotesResponse, err error)
func (*ClientMock) GetTransactionByHash ¶ added in v0.2.1
func (c *ClientMock) GetTransactionByHash(hash string) (trx Transaction, err error)
func (*ClientMock) GetValidatorsAtBlock ¶ added in v0.2.1
func (c *ClientMock) GetValidatorsAtBlock(uint64) (validators []Validator, err error)
func (*ClientMock) GetVersion ¶ added in v1.5.4
func (c *ClientMock) GetVersion() (version string, err error)
func (*ClientMock) SubscribeNewHeads ¶ added in v0.2.1
func (c *ClientMock) SubscribeNewHeads() (chan Block, *rpc.ClientSubscription, error)
func (*ClientMock) TraceBlockTransactions ¶ added in v0.2.1
func (c *ClientMock) TraceBlockTransactions(num uint64) (traces []TransactionTrace, err error)
type DagBlock ¶ added in v0.2.1
type DagBlock struct { models.Dag Sender string `json:"sender"` Transactions []string `json:"transactions"` }
func (*DagBlock) UnmarshalJSON ¶ added in v1.5.4
type DposConfig ¶ added in v0.2.1
type DposConfig struct { BlocksPerYear string `json:"blocks_per_year"` DagProposersReward string `json:"dag_proposers_reward"` MaxBlockAuthorReward string `json:"max_block_author_reward"` EligibilityBalanceThreshold string `json:"eligibility_balance_threshold"` YieldPercentage string `json:"yield_percentage"` InitialValidators []initialValidator `json:"initial_validators"` }
type EventLog ¶ added in v0.2.1
type EventLog struct { Address string `json:"address"` Data string `json:"data"` LogIndex string `json:"logIndex"` Removed bool `json:"removed"` Topics []string `json:"topics"` TransactionHash string `json:"transactionHash"` TransactionIndex string `json:"transactionIndex"` BlockNumber string `json:"blockNumber"` }
type GenesisObject ¶
type GenesisObject struct { DagGenesisBlock DagBlock `json:"dag_genesis_block"` InitialBalances map[string]string `json:"initial_balances"` Pbft PbftConfig `json:"pbft"` Dpos DposConfig `json:"dpos"` Hardforks common.HardforksConfig `json:"hardforks"` }
func (*GenesisObject) ToChainConfig ¶ added in v0.2.1
func (g *GenesisObject) ToChainConfig() (c *common.ChainConfig)
type PbftBlockWithDags ¶ added in v0.2.1
type PbftConfig ¶ added in v0.2.1
type TraceEntry ¶ added in v0.2.1
type TraceEntry struct { Action Action `json:"action"` Subtraces uint16 `json:"subtraces"` TraceAddress []uint16 `json:"traceAddress"` Type string `json:"type"` Result TraceEntryResult `json:"result"` }
type TraceEntryResult ¶ added in v0.2.1
type Transaction ¶ added in v0.2.1
type Transaction struct { models.Transaction Logs []EventLog `json:"logs"` Nonce models.Counter `json:"nonce"` GasPrice models.Counter `json:"gasPrice"` GasUsed models.Counter `json:"gasUsed"` TransactionIndex models.Counter `json:"transactionIndex"` ContractAddress string `json:"contractAddress"` }
func (*Transaction) ExtractLogs ¶ added in v0.2.1
func (t *Transaction) ExtractLogs() (logs []models.EventLog)
func (*Transaction) GetFee ¶ added in v0.2.1
func (t *Transaction) GetFee() *big.Int
func (*Transaction) GetModel ¶ added in v1.5.4
func (b *Transaction) GetModel() (trx *models.Transaction)
func (*Transaction) SetTimestamp ¶ added in v1.5.4
func (t *Transaction) SetTimestamp(timestamp uint64)
func (*Transaction) UnmarshalJSON ¶ added in v1.5.4
func (t *Transaction) UnmarshalJSON(data []byte) error
type TransactionTrace ¶ added in v0.2.1
type TransactionTrace struct {
Trace []TraceEntry `json:"trace"`
}
type Validator ¶ added in v1.5.1
func (*Validator) UnmarshalJSON ¶ added in v1.5.1
type VotesResponse ¶ added in v0.2.1
type WsClient ¶
WsClient is a struct that connects to a Taraxa node.
func NewWsClient ¶
NewWsClient creates a new instance of the WsClient struct.
func (*WsClient) GetBalanceAtBlock ¶ added in v0.2.1
func (*WsClient) GetBlockByNumber ¶
func (*WsClient) GetChainId ¶ added in v0.2.1
func (*WsClient) GetChainStats ¶
func (client *WsClient) GetChainStats() (fd storage.FinalizationData, err error)
func (*WsClient) GetDagBlockByHash ¶
func (*WsClient) GetGenesis ¶
func (client *WsClient) GetGenesis() (genesis GenesisObject, err error)
func (*WsClient) GetLatestPeriod ¶
func (*WsClient) GetPbftBlockWithDagBlocks ¶
func (client *WsClient) GetPbftBlockWithDagBlocks(period uint64) (pbftWithDags PbftBlockWithDags, err error)
func (*WsClient) GetPeriodDagBlocks ¶ added in v0.2.1
func (*WsClient) GetPeriodTransactions ¶ added in v0.2.1
func (client *WsClient) GetPeriodTransactions(number uint64) (trxs []Transaction, err error)
func (*WsClient) GetPreviousBlockCertVotes ¶ added in v0.2.1
func (client *WsClient) GetPreviousBlockCertVotes(period uint64) (vr VotesResponse, err error)
func (*WsClient) GetTransactionByHash ¶
func (client *WsClient) GetTransactionByHash(hash string) (trx Transaction, err error)
TODO: Optimize this. We are making two requests here, so its pretty slow
func (*WsClient) GetValidatorsAtBlock ¶ added in v0.2.1
func (*WsClient) GetVersion ¶ added in v0.4.0
func (*WsClient) SubscribeNewHeads ¶
func (client *WsClient) SubscribeNewHeads() (chan Block, *rpc.ClientSubscription, error)
func (*WsClient) TraceBlockTransactions ¶ added in v0.2.1
func (client *WsClient) TraceBlockTransactions(number uint64) (traces []TransactionTrace, err error)
Click to show internal directories.
Click to hide internal directories.