api

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: LGPL-3.0 Imports: 19 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 Backend

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

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

	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.

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

func (*PrivateNetworkAPI) IsListening added in v1.3.0

func (n *PrivateNetworkAPI) IsListening() bool

IsListening return whether the node is listen or not

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) GetAccountTransactions added in v1.3.0

func (api *PublicSeeleAPI) GetAccountTransactions(account common.Address, blockHash string, height int64) (result []map[string]interface{}, err error)

GetAccountTransactions get transaction of one account at specific height or blockhash

func (*PublicSeeleAPI) GetAccountTransactionsByHash added in v1.3.0

func (api *PublicSeeleAPI) GetAccountTransactionsByHash(account common.Address, blockHash string) (result []map[string]interface{}, err error)

GetAccountTransactionsByHash get transaction of one account at specific height

func (*PublicSeeleAPI) GetAccountTransactionsByHeight added in v1.3.0

func (api *PublicSeeleAPI) GetAccountTransactionsByHeight(account common.Address, height int64) (result []map[string]interface{}, err error)

GetAccountTransactionsByHeight get transaction of one account at specific blockhash

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) GetBlockDebtCount added in v1.3.0

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

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

func (*PublicSeeleAPI) GetBlockDebtCountByHash added in v1.3.0

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

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

func (*PublicSeeleAPI) GetBlockDebtCountByHeight added in v1.3.0

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

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

func (*PublicSeeleAPI) GetBlockHeight

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

GetBlockHeight get the block height of the chain head

func (*PublicSeeleAPI) GetBlockTransactionCount added in v1.3.0

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

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

func (*PublicSeeleAPI) GetBlockTransactionCountByHash added in v1.3.0

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

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

func (*PublicSeeleAPI) GetBlockTransactionCountByHeight added in v1.3.0

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

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

func (*PublicSeeleAPI) GetBlockTransactions added in v1.3.0

func (api *PublicSeeleAPI) GetBlockTransactions(blockHash string, height int64) (result []map[string]interface{}, err error)

GetBlockTransactions get all txs in the block with heigth or blockhash

func (*PublicSeeleAPI) GetBlockTransactionsByHash added in v1.3.0

func (api *PublicSeeleAPI) GetBlockTransactionsByHash(blockHash string) (result []map[string]interface{}, err error)

GetBlockTransactionsByHash returns the transactions in the block with the given height.

func (*PublicSeeleAPI) GetBlockTransactionsByHeight added in v1.3.0

func (api *PublicSeeleAPI) GetBlockTransactionsByHeight(height int64) (result []map[string]interface{}, err error)

GetBlockTransactionsByHeight returns the transactions in the block with the given height.

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) GetCode added in v1.3.0

func (api *PublicSeeleAPI) GetCode(contractAdd common.Address, height int64) (interface{}, error)

GetReceiptByTxHash get receipt by transaction hash

func (*PublicSeeleAPI) GetReceiptByTxHash added in v1.3.0

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

GetReceiptByTxHash get receipt by transaction hash

func (*PublicSeeleAPI) GetReceiptsByBlockHash added in v1.3.0

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

GetReceiptsByBlockHash get receipts by block hash

func (*PublicSeeleAPI) GetTransactionByBlockHashAndIndex added in v1.3.0

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

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

func (*PublicSeeleAPI) GetTransactionByBlockHeightAndIndex added in v1.3.0

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

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

func (*PublicSeeleAPI) GetTransactionByBlockIndex added in v1.3.0

func (api *PublicSeeleAPI) 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 (*PublicSeeleAPI) GetTransactionsFrom added in v1.3.0

func (api *PublicSeeleAPI) GetTransactionsFrom(account common.Address, blockHash string, height int64) (result []map[string]interface{}, err error)

func (*PublicSeeleAPI) GetTransactionsFromByHash added in v1.3.0

func (api *PublicSeeleAPI) GetTransactionsFromByHash(account common.Address, blockHash string) (result []map[string]interface{}, err error)

GetTransactionsFromByHash get transaction from one account at specific blockhash

func (*PublicSeeleAPI) GetTransactionsFromByHeight added in v1.3.0

func (api *PublicSeeleAPI) GetTransactionsFromByHeight(account common.Address, height int64) (result []map[string]interface{}, err error)

GetTransactionsFromByHeight get transaction from one account at specific height

func (*PublicSeeleAPI) GetTransactionsTo added in v1.3.0

func (api *PublicSeeleAPI) GetTransactionsTo(account common.Address, blockHash string, height int64) (result []map[string]interface{}, err error)

GetTransactionsTo get transaction to one account at specific height or blockhash

func (*PublicSeeleAPI) GetTransactionsToByHash added in v1.3.0

func (api *PublicSeeleAPI) GetTransactionsToByHash(account common.Address, blockHash string) (result []map[string]interface{}, err error)

GetTransactionsToByHash get transaction from one account at specific blockhash

func (*PublicSeeleAPI) GetTransactionsToByHeight added in v1.3.0

func (api *PublicSeeleAPI) GetTransactionsToByHeight(account common.Address, height int64) (result []map[string]interface{}, err error)

GetTransactionsToByHeight get transaction from one account at specific height

func (*PublicSeeleAPI) IsListening

func (api *PublicSeeleAPI) IsListening() bool

Always listening

func (*PublicSeeleAPI) IsSyncing

func (api *PublicSeeleAPI) IsSyncing() bool

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) GetPendingTransactions added in v1.3.0

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

GetPendingTransactions returns all pending transactions

func (*TransactionPoolAPI) GetTransactionByHash

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

GetTransactionByHash returns the transaction by the given transaction hash.

func (*TransactionPoolAPI) GetTxPoolContent added in v1.3.0

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

GetTxPoolContent returns the transactions contained within the transaction pool

func (*TransactionPoolAPI) GetTxPoolTxCount added in v1.3.0

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

GetTxPoolTxCount returns the number of transaction in the pool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL