api

package
v0.4.5-0...-e935ded Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultGasPrice is default gas price for evm transactions
	DefaultGasPrice = 20000000000
	// DefaultRPCGasLimit is default gas limit for RPC call operations
	DefaultRPCGasLimit = 10000000
)
View Source
const (
	StatusUpdateInterval = 60 // seconds
)

Variables

This section is empty.

Functions

func GetAPIs

func GetAPIs(backend sbchapi.BackendService,
	logger log.Logger, testKeys []string) []rpc.API

GetAPIs returns the list of all APIs from the Ethereum namespaces

Types

type AccountRWOp

type AccountRWOp struct {
	Addr    gethcmn.Address `json:"address"`
	Nonce   hexutil.Uint64  `json:"nonce"`
	Balance *uint256.Int    `json:"balance"`
}

type BlockHashOp

type BlockHashOp struct {
	Height hexutil.Uint64 `json:"height"`
	Hash   gethcmn.Hash   `json:"hash"`
}

type BytecodeRWOp

type BytecodeRWOp struct {
	Addr     gethcmn.Address `json:"address"`
	Bytecode hexutil.Bytes   `json:"bytecode"`
}

type CCEpoch

type CCEpoch struct {
	Number        hexutil.Uint64    `json:"number"`
	StartHeight   hexutil.Uint64    `json:"startHeight"`
	EndTime       int64             `json:"endTime"`
	TransferInfos []*CCTransferInfo `json:"transferInfos"`
}

type CCTransferInfo

type CCTransferInfo struct {
	UTXO         hexutil.Bytes  `json:"utxo"`
	Amount       hexutil.Uint64 `json:"amount"`
	SenderPubkey hexutil.Bytes  `json:"senderPubkey"`
}

type CallDetail

type CallDetail struct {
	Status                 int             `json:"status"`
	GasUsed                hexutil.Uint64  `json:"gasUsed"`
	OutData                hexutil.Bytes   `json:"returnData"`
	Logs                   []*CallLog      `json:"logs"`
	CreatedContractAddress gethcmn.Address `json:"contractAddress"`
	InternalTxs            []*InternalTx   `json:"internalTransactions"`
	RwLists                *RWLists        `json:"rwLists"`
}

func TxToRpcCallDetail

func TxToRpcCallDetail(tx *motypes.Transaction) *CallDetail

type CallLog

type CallLog struct {
	Address gethcmn.Address `json:"address"`
	Topics  []gethcmn.Hash  `json:"topics"`
	Data    hexutil.Bytes   `json:"data"`
}

type CreationCounterRWOp

type CreationCounterRWOp struct {
	Lsb     uint8  `json:"lsb"`
	Counter uint64 `json:"counter"`
}

type DebugAPI

type DebugAPI interface {
	GetStats() Stats
	GetSeq(addr gethcmn.Address) hexutil.Uint64
	NodeInfo() json.RawMessage
}

type EthashAPI

type EthashAPI interface {
	GetWork() ([4]string, error)
	Hashrate() hexutil.Uint64
	Mining() bool
	SubmitWork(nonce gethtypes.BlockNonce, hash, digest common.Hash) bool
}

type InternalTx

type InternalTx struct {
	CallPath       string           `json:"callPath"`
	From           gethcmn.Address  `json:"from"`
	To             gethcmn.Address  `json:"to"`
	GasLimit       hexutil.Uint64   `json:"gas"`
	Value          *hexutil.Big     `json:"value"`
	Input          hexutil.Bytes    `json:"input"`
	StatusCode     hexutil.Uint64   `json:"status"`
	GasUsed        hexutil.Uint64   `json:"gasUsed"`
	Output         hexutil.Bytes    `json:"output"`
	CreatedAddress *gethcmn.Address `json:"contractAddress,omitempty"`
	// contains filtered or unexported fields
}

TODO: rename file to sbch_rpc_types.go

type Nomination

type Nomination struct {
	Pubkey         gethcmn.Hash `json:"pubkey"`
	NominatedCount int64        `json:"nominatedCount"`
}

type PosVote

type PosVote struct {
	Pubkey       gethcmn.Hash `json:"pubkey"`
	CoinDaysSlot *hexutil.Big `json:"coinDaysSlot"`
	CoinDays     float64      `json:"coinDays"`
}

type PublicEthAPI

type PublicEthAPI interface {
	Accounts() ([]common.Address, error)
	BlockNumber() (hexutil.Uint64, error)
	Call(args rpctypes.CallArgs, blockNrOrHash gethrpc.BlockNumberOrHash) (hexutil.Bytes, error)
	ChainId() hexutil.Uint64
	Coinbase() (common.Address, error)
	EstimateGas(args rpctypes.CallArgs, blockNrOrHash *gethrpc.BlockNumberOrHash) (hexutil.Uint64, error)
	GasPrice() *hexutil.Big
	GetBalance(addr common.Address, blockNrOrHash gethrpc.BlockNumberOrHash) (*hexutil.Big, error)
	GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error)
	GetBlockByNumber(blockNum gethrpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
	GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint
	GetBlockTransactionCountByNumber(blockNum gethrpc.BlockNumber) *hexutil.Uint
	GetCode(addr common.Address, blockNrOrHash gethrpc.BlockNumberOrHash) (hexutil.Bytes, error)
	GetStorageAt(addr common.Address, key string, blockNrOrHash gethrpc.BlockNumberOrHash) (hexutil.Bytes, error)
	GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.Transaction, error)
	GetTransactionByBlockNumberAndIndex(blockNum gethrpc.BlockNumber, idx hexutil.Uint) (*rpctypes.Transaction, error)
	GetTransactionByHash(hash common.Hash) (*rpctypes.Transaction, error)
	GetTransactionCount(addr common.Address, blockNrOrHash gethrpc.BlockNumberOrHash) (*hexutil.Uint64, error)
	GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error)
	GetUncleByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) map[string]interface{}
	GetUncleByBlockNumberAndIndex(number hexutil.Uint, idx hexutil.Uint) map[string]interface{}
	GetUncleCountByBlockHash(_ common.Hash) hexutil.Uint
	GetUncleCountByBlockNumber(_ gethrpc.BlockNumber) hexutil.Uint
	ProtocolVersion() hexutil.Uint
	SendRawTransaction(data hexutil.Bytes) (common.Hash, error) // ?
	SendTransaction(args rpctypes.SendTxArgs) (common.Hash, error)
	Syncing() (interface{}, error)
}

type PublicNetAPI

type PublicNetAPI interface {
	Version() string
	Listening() bool
	PeerCount() int
}

type PublicTxPoolAPI

type PublicTxPoolAPI interface {
	Content() map[string]map[string]map[string]*rpctypes.Transaction
	Status() map[string]hexutil.Uint
	Inspect() map[string]map[string]map[string]string
}

type PublicWeb3API

type PublicWeb3API interface {
	ClientVersion() string
	Sha3(input hexutil.Bytes) hexutil.Bytes
}

type RWLists

type RWLists struct {
	CreationCounterRList []CreationCounterRWOp `json:"creationCounterRList"`
	CreationCounterWList []CreationCounterRWOp `json:"creationCounterWList"`
	AccountRList         []AccountRWOp         `json:"accountRList"`
	AccountWList         []AccountRWOp         `json:"accountWList"`
	BytecodeRList        []BytecodeRWOp        `json:"bytecodeRList"`
	BytecodeWList        []BytecodeRWOp        `json:"bytecodeWList"`
	StorageRList         []StorageRWOp         `json:"storageRList"`
	StorageWList         []StorageRWOp         `json:"storageWList"`
	BlockHashList        []BlockHashOp         `json:"blockHashList"`
}

type SbchAPI

type SbchAPI interface {
	GetStandbyTxQueue()
	QueryTxBySrc(addr gethcmn.Address, startHeight, endHeight gethrpc.BlockNumber, limit hexutil.Uint64) ([]*rpctypes.Transaction, error)
	QueryTxByDst(addr gethcmn.Address, startHeight, endHeight gethrpc.BlockNumber, limit hexutil.Uint64) ([]*rpctypes.Transaction, error)
	QueryTxByAddr(addr gethcmn.Address, startHeight, endHeight gethrpc.BlockNumber, limit hexutil.Uint64) ([]*rpctypes.Transaction, error)
	QueryLogs(addr gethcmn.Address, topics []gethcmn.Hash, startHeight, endHeight gethrpc.BlockNumber, limit hexutil.Uint64) ([]*gethtypes.Log, error)
	GetTxListByHeight(height gethrpc.BlockNumber) ([]map[string]interface{}, error)
	GetTxListByHeightWithRange(height gethrpc.BlockNumber, start, end hexutil.Uint64) ([]map[string]interface{}, error)
	GetAddressCount(kind string, addr gethcmn.Address) hexutil.Uint64
	GetSep20AddressCount(kind string, contract, addr gethcmn.Address) hexutil.Uint64
	GetEpochs(start, end hexutil.Uint64) ([]*types.Epoch, error)
	GetEpochs2(start, end hexutil.Uint64) ([]*StakingEpoch, error) // result is more human-readable
	GetCurrEpoch(includesPosVotes *bool) (*StakingEpoch, error)
	GetCCEpochs(start, end hexutil.Uint64) ([]*cctypes.CCEpoch, error)
	GetCCEpochs2(start, end hexutil.Uint64) ([]*CCEpoch, error) // result is more human-readable
	HealthCheck(latestBlockTooOldAge hexutil.Uint64) map[string]interface{}
	GetTransactionReceipt(hash gethcmn.Hash) (map[string]interface{}, error)
	Call(args rpctypes.CallArgs, blockNr gethrpc.BlockNumberOrHash) (*CallDetail, error)
	ValidatorsInfo() json.RawMessage
	GetSyncBlock(height hexutil.Uint64) (hexutil.Bytes, error)
}

type StakingEpoch

type StakingEpoch struct {
	Number      hexutil.Uint64 `json:"number"`
	StartHeight hexutil.Uint64 `json:"startHeight"`
	EndTime     int64          `json:"endTime"`
	Nominations []*Nomination  `json:"nominations"`
	PosVotes    []*PosVote     `json:"posVotes"`
}

type Stats

type Stats struct {
	NumGoroutine     int    `json:"numGoroutine"`
	NumGC            uint32 `json:"numGC"`
	MemAllocMB       uint64 `json:"memAllocMB"`
	MemSysMB         uint64 `json:"memSysMB"`
	OsMemTotalMB     uint64 `json:"osMemTotalMB"`
	OsMemUsedMB      uint64 `json:"osMemUsedMB"`
	OsMemCachedMB    uint64 `json:"osMemCachedMB"`
	OsMemFreeMB      uint64 `json:"osMemFreeMB"`
	OsMemActiveMB    uint64 `json:"osMemActiveMB"`
	OsMemInactiveMB  uint64 `json:"osMemInactiveMB"`
	OsMemSwapTotalMB uint64 `json:"osMemSwapTotalMB"`
	OsMemSwapUsedMB  uint64 `json:"osMemSwapUsedMB"`
	OsMemSwapFreeMB  uint64 `json:"osMemSwapFreeMB"`
	NumEthCall       uint64 `json:"numEthCall"`
}

type StorageRWOp

type StorageRWOp struct {
	Seq   hexutil.Uint64 `json:"seq"`
	Key   hexutil.Bytes  `json:"key"`
	Value hexutil.Bytes  `json:"value"`
}

Directories

Path Synopsis
Package filters implements an ethereum filtering system for block, transactions and log events.
Package filters implements an ethereum filtering system for block, transactions and log events.

Jump to

Keyboard shortcuts

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