api

package
v0.0.0-...-f58d8a1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: LGPL-3.0 Imports: 18 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

GetAPIs returns the rpc apis

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.ScdoLog
	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
}

GetMinerInfo returns miner simple info

type GetMinerInfo2

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

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) AddTrustNode

func (n *PrivateNetworkAPI) AddTrustNode(node string) bool

AddTrustNode return whether the node is added

func (*PrivateNetworkAPI) GetBlockListCount

func (n *PrivateNetworkAPI) GetBlockListCount() int

GetBlockListCount return the count of nodes in blockList

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 scdo 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 scdo protocol version this node supports

func (*PrivateNetworkAPI) GetToTrustNodeCount

func (n *PrivateNetworkAPI) GetToTrustNodeCount() int

GetToTrustNodeCount return count of toTrustNode added by User

func (*PrivateNetworkAPI) IsListening

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 PublicScdoAPI

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

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

func NewPublicScdoAPI

func NewPublicScdoAPI(s Backend) *PublicScdoAPI

NewPublicScdoAPI creates a new PublicScdoAPI object for rpc service.

func (*PublicScdoAPI) AddTx

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

AddTx add a tx to miner

func (*PublicScdoAPI) GetAccountNonce

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

GetAccountNonce get account next used nonce

func (*PublicScdoAPI) GetAccountTransactions

func (api *PublicScdoAPI) 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 (*PublicScdoAPI) GetAccountTransactionsByHash

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

GetAccountTransactionsByHash get transaction of one account at specific height

func (*PublicScdoAPI) GetAccountTransactionsByHeight

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

GetAccountTransactionsByHeight get transaction of one account at specific blockhash

func (*PublicScdoAPI) GetBalance

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

GetBalance get balance of the account.

func (*PublicScdoAPI) GetBlock

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

GetBlock returns the requested block.

func (*PublicScdoAPI) GetBlockByHash

func (api *PublicScdoAPI) 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 (*PublicScdoAPI) GetBlockByHeight

func (api *PublicScdoAPI) 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 (*PublicScdoAPI) GetBlockDebtCount

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

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

func (*PublicScdoAPI) GetBlockDebtCountByHash

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

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

func (*PublicScdoAPI) GetBlockDebtCountByHeight

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

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

func (*PublicScdoAPI) GetBlockHeight

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

GetBlockHeight get the block height of the chain head

func (*PublicScdoAPI) GetBlockTransactionCount

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

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

func (*PublicScdoAPI) GetBlockTransactionCountByHash

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

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

func (*PublicScdoAPI) GetBlockTransactionCountByHeight

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

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

func (*PublicScdoAPI) GetBlockTransactions

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

GetBlockTransactions get all txs in the block with height or blockhash

func (*PublicScdoAPI) GetBlockTransactionsByHash

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

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

func (*PublicScdoAPI) GetBlockTransactionsByHeight

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

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

func (*PublicScdoAPI) GetBlocks

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

GetBlocks returns requested blocks. 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 (*PublicScdoAPI) GetChangedAccounts

func (api *PublicScdoAPI) GetChangedAccounts(hexHash string, height int64) (map[string]interface{}, error)

GetChangedAccounts gets the updated accounts of a certain block given the block hash or block height

func (*PublicScdoAPI) GetCode

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

GetCode gets the code of a contract address

func (*PublicScdoAPI) GetReceiptByTxHash

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

GetReceiptByTxHash get receipt by transaction hash

func (*PublicScdoAPI) GetReceiptsByBlockHash

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

GetReceiptsByBlockHash get receipts by block hash

func (*PublicScdoAPI) GetScdoForkHeight

func (api *PublicScdoAPI) GetScdoForkHeight() (uint64, error)

GetScdoForkHeight get the Scdo fork height

func (*PublicScdoAPI) GetTransactionByBlockHashAndIndex

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

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

func (*PublicScdoAPI) GetTransactionByBlockHeightAndIndex

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

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

func (*PublicScdoAPI) GetTransactionByBlockIndex

func (api *PublicScdoAPI) 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 (*PublicScdoAPI) GetTransactionsFrom

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

GetTransactionsTo get transactions from one account at specific height or blockhash

func (*PublicScdoAPI) GetTransactionsFromByHash

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

GetTransactionsFromByHash get transaction from one account at specific blockhash

func (*PublicScdoAPI) GetTransactionsFromByHeight

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

GetTransactionsFromByHeight get transaction from one account at specific height

func (*PublicScdoAPI) GetTransactionsTo

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

GetTransactionsTo get transactions to one account at specific height or blockhash

func (*PublicScdoAPI) GetTransactionsToByHash

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

GetTransactionsToByHash get transaction from one account at specific blockhash

func (*PublicScdoAPI) GetTransactionsToByHeight

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

GetTransactionsToByHeight get transaction from one account at specific height

func (*PublicScdoAPI) IsListening

func (api *PublicScdoAPI) IsListening() bool

Always listening

func (*PublicScdoAPI) IsSyncing

func (api *PublicScdoAPI) IsSyncing() bool

IsSyncing returns the sync status of the node

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

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

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

GetTxPoolContent returns the transactions contained within the transaction pool

func (*TransactionPoolAPI) GetTxPoolTxCount

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
y or Y : Canonical URL