chain

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseInt

func ParseInt(s string) uint64

Types

type Block

type Block struct {
	models.Pbft
	Number       string    `json:"number"`
	Timestamp    string    `json:"timestamp"`
	Transactions *[]string `json:"transactions"`
	TotalReward  string    `json:"totalReward"`
}

func (*Block) ToModel

func (b *Block) ToModel() (pbft *models.Pbft)

type GenesisObject

type GenesisObject struct {
	DagGenesisBlock dagBlock          `json:"dag_genesis_block"`
	InitialBalances map[string]string `json:"initial_balances"`
	// TODO[45]: Old genesis structure. Remove
	FinalChain struct {
		State struct {
			GenesisBalances map[string]string `json:"genesis_balances"`
		} `json:"state"`
	} `json:"final_chain"`
}

type WsClient

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

WsClient is a struct that connects to a Taraxa node.

func NewWsClient

func NewWsClient(url string) (*WsClient, error)

NewWsClient creates a new instance of the WsClient struct.

func (*WsClient) AddTransactionReceiptData

func (client *WsClient) AddTransactionReceiptData(trx *transaction) (err error)

func (*WsClient) Close

func (client *WsClient) Close()

Close disconnects from the node

func (*WsClient) GetBlockByNumber

func (client *WsClient) GetBlockByNumber(number uint64) (blk *Block, err error)

func (*WsClient) GetChainStats

func (client *WsClient) GetChainStats() (ns *storage.FinalizationData, err error)

func (*WsClient) GetDagBlockByHash

func (client *WsClient) GetDagBlockByHash(hash string) (dag *dagBlock, err error)

func (*WsClient) GetGenesis

func (client *WsClient) GetGenesis() (genesis *GenesisObject, err error)

func (*WsClient) GetLatestPeriod

func (client *WsClient) GetLatestPeriod() (uint64, error)

func (*WsClient) GetPbftBlockWithDagBlocks

func (client *WsClient) GetPbftBlockWithDagBlocks(period uint64) (pbftWithDags *pbftBlockWithDags, 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) SubscribeNewHeads

func (client *WsClient) SubscribeNewHeads() (chan *Block, *rpc.ClientSubscription, error)

Jump to

Keyboard shortcuts

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