api

package
v0.0.0-...-4097cb8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTransactionNotFound = errors.New("transaction not found")
	ErrDebtNotFound        = errors.New("debt not found")
)

Error variables

View Source
var ErrInvalidAccount = errors.New("invalid account")

ErrInvalidAccount the account is invalid

View Source
var KeyABIHash = common.StringToHash("KeyABIHash")

KeyABIHash is the hash key to storing abi to statedb

Functions

func GetAPIs

func GetAPIs(apiBackend Backend) []rpc.API

func PrintableOutputTx

func PrintableOutputTx(tx *types.Transaction) map[string]interface{}

PrintableOutputTx converts the given tx to the RPC output

func PrintableReceipt

func PrintableReceipt(re *types.Receipt) (map[string]interface{}, error)

PrintableReceipt converts the given Receipt to the RPC output

Types

type BFTCore

type BFTCore interface {
}

type Backend

type Backend interface {
	GetP2pServer() *p2p.Server
	GetNetVersion() string
	GetNetWorkID() string

	TxPoolBackend() Pool
	ChainBackend() Chain
	ProtocolBackend() Protocol
	Log() *log.SeeleLog
	IsSyncing() bool

	GetAccountIndexDB() database.Database
	GetIndexAccountDB() database.Database
	GenesisInfo() core.GenesisInfo

	GetBlock(hash common.Hash, height int64) (*types.Block, error)
	GetBlockTotalDifficulty(hash common.Hash) (*big.Int, error)
	GetReceiptByTxHash(txHash common.Hash) (*types.Receipt, error)
	GetTransaction(pool PoolCore, bcStore store.BlockchainStore, txHash common.Hash) (*types.Transaction, *BlockIndex, error)
}

Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.

type BlockIndex

type BlockIndex struct {
	BlockHash   common.Hash
	BlockHeight uint64
	Index       uint
}

BlockIndex represents the index info in a block.

func GetDebt

func GetDebt(pool *core.DebtPool, bcStore store.BlockchainStore, debtHash common.Hash) (*types.Debt, *BlockIndex, error)

GetDebt returns the debt for the specified debt hash.

func GetTransaction

func GetTransaction(pool PoolCore, bcStore store.BlockchainStore, txHash common.Hash) (*types.Transaction, *BlockIndex, error)

GetTransaction returns the transaction by the given blockchain store and transaction hash.

type Chain

type Chain interface {
	CurrentHeader() *types.BlockHeader
	GetCurrentState() (*state.Statedb, error)
	GetState(blockHash common.Hash) (*state.Statedb, error)
	GetStore() store.BlockchainStore
}

type GetBalanceResponse

type GetBalanceResponse struct {
	Account common.Address
	Balance *big.Int
}

GetBalanceResponse response param for GetBalance api

type GetLogsResponse

type GetLogsResponse struct {
	*types.Log
	Txhash   common.Hash
	LogIndex uint
	Args     interface{} `json:"data"`
}

GetLogsResponse response param for GetLogs api

type GetMinerInfo

type GetMinerInfo struct {
	Coinbase           common.Address
	CurrentBlockHeight uint64
	HeaderHash         common.Hash
	Shard              uint
	MinerStatus        string
	Version            string
	BlockAge           *big.Int
	PeerCnt            string
}

MinerInfo miner simple info

type Pool

type Pool interface {
	PoolCore
	GetTransactions(processing, pending bool) []*types.Transaction
	GetTxCount() int
}

type PoolCore

type PoolCore interface {
	AddTransaction(tx *types.Transaction) error
	GetTransaction(txHash common.Hash) *types.Transaction
}

type PrivateDebugAPI

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

PrivateDebugAPI provides an API to access full node-related information for debugging.

func NewPrivateDebugAPI

func NewPrivateDebugAPI(s Backend) *PrivateDebugAPI

NewPrivateDebugAPI creates a new NewPrivateDebugAPI object for rpc service.

func (*PrivateDebugAPI) GetPendingTransactions

func (api *PrivateDebugAPI) GetPendingTransactions() ([]map[string]interface{}, error)

GetPendingTransactions returns all pending transactions

func (*PrivateDebugAPI) GetTxPoolContent

func (api *PrivateDebugAPI) GetTxPoolContent() (map[string][]map[string]interface{}, error)

GetTxPoolContent returns the transactions contained within the transaction pool

func (*PrivateDebugAPI) GetTxPoolTxCount

func (api *PrivateDebugAPI) GetTxPoolTxCount() (uint64, error)

GetTxPoolTxCount returns the number of transaction in the pool

type PrivateNetworkAPI

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

PrivateNetworkAPI provides an API to access network information.

func NewPrivateNetworkAPI

func NewPrivateNetworkAPI(s Backend) *PrivateNetworkAPI

NewPrivateNetworkAPI creates a new PrivateNetworkAPI object for rpc service.

func (*PrivateNetworkAPI) GetNetVersion

func (n *PrivateNetworkAPI) GetNetVersion() (string, error)

GetNetVersion returns the net version

func (*PrivateNetworkAPI) GetNetworkID

func (n *PrivateNetworkAPI) GetNetworkID() (string, error)

GetNetworkID returns the network ID, unique mark of seele Network

func (*PrivateNetworkAPI) GetPeerCount

func (n *PrivateNetworkAPI) GetPeerCount() (int, error)

GetPeerCount returns the count of peers

func (*PrivateNetworkAPI) GetPeersInfo

func (n *PrivateNetworkAPI) GetPeersInfo() ([]p2p.PeerInfo, error)

GetPeersInfo returns all the information of peers at the protocol granularity.

func (*PrivateNetworkAPI) GetProtocolVersion

func (n *PrivateNetworkAPI) GetProtocolVersion() (uint, error)

GetProtocolVersion returns the current seele protocol version this node supports

type Protocol

type Protocol interface {
	SendDifferentShardTx(tx *types.Transaction, shard uint)
	GetProtocolVersion() (uint, error)
}

type PublicSeeleAPI

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

PublicSeeleAPI provides an API to access full node-related information.

func NewPublicSeeleAPI

func NewPublicSeeleAPI(s Backend) *PublicSeeleAPI

NewPublicSeeleAPI creates a new PublicSeeleAPI object for rpc service.

func (*PublicSeeleAPI) AddTx

func (api *PublicSeeleAPI) AddTx(tx types.Transaction) (bool, error)

AddTx add a tx to miner

func (*PublicSeeleAPI) GetAccountNonce

func (api *PublicSeeleAPI) GetAccountNonce(account common.Address, hexHash string, height int64) (uint64, error)

GetAccountNonce get account next used nonce

func (*PublicSeeleAPI) GetAccountTxCount

func (api *PublicSeeleAPI) GetAccountTxCount(account common.Address, hexHash string, height int64) (uint64, error)

GetAccountTxCount get account tx count

func (*PublicSeeleAPI) GetBalance

func (api *PublicSeeleAPI) GetBalance(account common.Address, hexHash string, height int64) (*GetBalanceResponse, error)

GetBalance get balance of the account.

func (*PublicSeeleAPI) GetBlock

func (api *PublicSeeleAPI) GetBlock(hashHex string, height int64, fulltx bool) (map[string]interface{}, error)

GetBlock returns the requested block.

func (*PublicSeeleAPI) GetBlockByHash

func (api *PublicSeeleAPI) GetBlockByHash(hashHex string, fulltx bool) (map[string]interface{}, error)

GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned

func (*PublicSeeleAPI) GetBlockByHeight

func (api *PublicSeeleAPI) GetBlockByHeight(height int64, fulltx bool) (map[string]interface{}, error)

GetBlockByHeight returns the requested block. When blockNr is less than 0 the chain head is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned

func (*PublicSeeleAPI) GetBlockHeight

func (api *PublicSeeleAPI) GetBlockHeight() (uint64, error)

GetBlockHeight get the block height of the chain head

func (*PublicSeeleAPI) GetBlocks

func (api *PublicSeeleAPI) GetBlocks(height int64, fulltx bool, size uint) ([]map[string]interface{}, error)

GetBlocks returns the size of requested block. When the blockNr is -1 the chain head is returned. When the size is greater than 64, the size will be set to 64.When it's -1 that the blockNr minus size, the blocks in 64 is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned

func (*PublicSeeleAPI) IsListening

func (api *PublicSeeleAPI) IsListening() bool

Always listening

func (*PublicSeeleAPI) IsSyncing

func (api *PublicSeeleAPI) IsSyncing() bool

type PublicSubchainAPI

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

PublicSubchainAPI provides an API to access subchain node information.

func NewPublicSubchainAPI

func NewPublicSubchainAPI(s Backend) *PublicSubchainAPI

NewPublicSubchainAPI creates a new PublicSubchainAPI object for rpc service.

func (*PublicSubchainAPI) GetAccountTx

func (api *PublicSubchainAPI) GetAccountTx(account common.Address, start uint64, end uint64) (map[string]interface{}, error)

get txs and signatures of an account between two block heights

func (*PublicSubchainAPI) GetBalanceMerkleInfo

func (api *PublicSubchainAPI) GetBalanceMerkleInfo(account common.Address, height int64) (map[string]interface{}, error)

get merkle index and merkle proof of an account at a given height

func (*PublicSubchainAPI) GetBalanceTreeRoot

func (api *PublicSubchainAPI) GetBalanceTreeRoot(height int64) (string, error)

get the root hash of the balance/state tree of a block

func (*PublicSubchainAPI) GetBlockCreator

func (api *PublicSubchainAPI) GetBlockCreator(height int64) (string, error)

get block creator

func (*PublicSubchainAPI) GetBlockInfoForStem

func (api *PublicSubchainAPI) GetBlockInfoForStem(height int64) (interface{}, error)

get block information needed by stem contract

func (*PublicSubchainAPI) GetBlockSignature

func (api *PublicSubchainAPI) GetBlockSignature(height int64) (interface{}, error)

get the block signature

func (*PublicSubchainAPI) GetFee

func (api *PublicSubchainAPI) GetFee(height uint64) (map[string]interface{}, error)

func (*PublicSubchainAPI) GetRecentTxMerkleInfo

func (api *PublicSubchainAPI) GetRecentTxMerkleInfo(account common.Address, height uint64) (map[string]interface{}, error)

get the merkle index and proof of the recent txs of an account

func (*PublicSubchainAPI) GetRecentTxTreeRoot

func (api *PublicSubchainAPI) GetRecentTxTreeRoot(height uint64) (string, error)

get the root hash of the recentTxTree of a block

func (*PublicSubchainAPI) GetRelayInterval

func (api *PublicSubchainAPI) GetRelayInterval() uint64

get block relay interval

func (*PublicSubchainAPI) GetStatedbByHeight

func (api *PublicSubchainAPI) GetStatedbByHeight(height uint64) (*state.Statedb, error)

func (*PublicSubchainAPI) GetTxMerkleInfo

func (api *PublicSubchainAPI) GetTxMerkleInfo(hashHex string) (map[string]interface{}, error)

get merkle index and merkle proof of a tx

func (*PublicSubchainAPI) GetTxTreeRoot

func (api *PublicSubchainAPI) GetTxTreeRoot(height int64) (string, error)

get the root hash of the tx tree of a block

func (*PublicSubchainAPI) GetUpdatedAccountInfo

func (api *PublicSubchainAPI) GetUpdatedAccountInfo(height uint64) (map[string]interface{}, error)

get the updated accounts during the last relayInterval (traced back from given height)

type TransactionPoolAPI

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

TransactionPoolAPI provides an API to access transaction pool information.

func NewTransactionPoolAPI

func NewTransactionPoolAPI(s Backend) *TransactionPoolAPI

NewTransactionPoolAPI creates a new PrivateTransactionPoolAPI object for transaction pool rpc service.

func (*TransactionPoolAPI) GetBlockDebtCount

func (api *TransactionPoolAPI) GetBlockDebtCount(blockHash string, height int64) (int, error)

GetBlockDebtCount returns the count of debts in the block with the given block hash or height.

func (*TransactionPoolAPI) GetBlockDebtCountByHash

func (api *TransactionPoolAPI) GetBlockDebtCountByHash(blockHash string) (int, error)

GetBlockDebtCountByHash returns the count of debts in the block with the given hash.

func (*TransactionPoolAPI) GetBlockDebtCountByHeight

func (api *TransactionPoolAPI) GetBlockDebtCountByHeight(height int64) (int, error)

GetBlockDebtCountByHeight returns the count of debts in the block with the given height.

func (*TransactionPoolAPI) GetBlockTransactionCount

func (api *TransactionPoolAPI) GetBlockTransactionCount(blockHash string, height int64) (int, error)

GetBlockTransactionCount returns the count of transactions in the block with the given block hash or height.

func (*TransactionPoolAPI) GetBlockTransactionCountByHash

func (api *TransactionPoolAPI) GetBlockTransactionCountByHash(blockHash string) (int, error)

GetBlockTransactionCountByHash returns the count of transactions in the block with the given hash.

func (*TransactionPoolAPI) GetBlockTransactionCountByHeight

func (api *TransactionPoolAPI) GetBlockTransactionCountByHeight(height int64) (int, error)

GetBlockTransactionCountByHeight returns the count of transactions in the block with the given height.

func (*TransactionPoolAPI) GetReceiptByTxHash

func (api *TransactionPoolAPI) GetReceiptByTxHash(txHash, abiJSON string) (map[string]interface{}, error)

GetReceiptByTxHash get receipt by transaction hash

func (*TransactionPoolAPI) GetReceiptsByBlockHash

func (api *TransactionPoolAPI) GetReceiptsByBlockHash(blockHash string) (map[string]interface{}, error)

GetReceiptsByBlockHash get receipts by block hash

func (*TransactionPoolAPI) GetTransactionByBlockHashAndIndex

func (api *TransactionPoolAPI) GetTransactionByBlockHashAndIndex(hashHex string, index uint) (map[string]interface{}, error)

GetTransactionByBlockHashAndIndex returns the transaction in the block with the given block hash and index.

func (*TransactionPoolAPI) GetTransactionByBlockHeightAndIndex

func (api *TransactionPoolAPI) GetTransactionByBlockHeightAndIndex(height int64, index uint) (map[string]interface{}, error)

GetTransactionByBlockHeightAndIndex returns the transaction in the block with the given block height and index.

func (*TransactionPoolAPI) GetTransactionByBlockIndex

func (api *TransactionPoolAPI) GetTransactionByBlockIndex(hashHex string, height int64, index uint) (map[string]interface{}, error)

GetTransactionByBlockIndex returns the transaction in the block with the given block hash/height and index.

func (*TransactionPoolAPI) GetTransactionByHash

func (api *TransactionPoolAPI) GetTransactionByHash(txHash string) (map[string]interface{}, error)

GetTransactionByHash returns the transaction by the given transaction hash.

Jump to

Keyboard shortcuts

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