api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 34 Imported by: 1

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 added in v0.4.0

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

type BlockHashOp added in v0.4.0

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

type BytecodeRWOp added in v0.4.0

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

type CCEpoch added in v0.4.0

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

type CCTransferInfo added in v0.4.0

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

type CallDetail added in v0.4.0

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 added in v0.4.0

func TxToRpcCallDetail(tx *motypes.Transaction) *CallDetail

type CallLog added in v0.4.0

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

type CreationCounterRWOp added in v0.4.0

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

type DebugAPI added in v0.3.6

type DebugAPI interface {
	GetStats() Stats
	GetSeq(addr gethcmn.Address) hexutil.Uint64
	NodeInfo() json.RawMessage
	ValidatorOnlineInfos() json.RawMessage
	ValidatorWatchInfos() 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 added in v0.3.6

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 added in v0.3.6

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

type OnlineInfoToMarshal added in v0.4.5

type OnlineInfoToMarshal struct {
	ValidatorConsensusAddress gethcmn.Address `json:"validator_consensus_address"`
	SignatureCount            int32           `json:"signature_count"`
	HeightOfLastSignature     int64           `json:"height_of_last_signature"`
}

type PosVote added in v0.4.2

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 added in v0.1.6

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 added in v0.4.0

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)
	GetEpochList(from string) ([]*StakingEpoch, error)
	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)
	GetTransactionReceiptWithSig(hash gethcmn.Hash) (map[string]interface{}, error)
	Call(args rpctypes.CallArgs, blockNr gethrpc.BlockNumberOrHash) (*CallDetail, error)
	ValidatorsInfo(blockNr gethrpc.BlockNumberOrHash) json.RawMessage
	GetSyncBlock(height hexutil.Uint64) (hexutil.Bytes, error)
	SetRpcKey(key string) error
	GetRpcPubkey() (string, error)
}

type StakingEpoch added in v0.3.6

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 added in v0.3.6

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 added in v0.4.0

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

type ValidatorOnlineInfosToMarshal added in v0.4.5

type ValidatorOnlineInfosToMarshal struct {
	StartHeight            int64                  `json:"start_height"`
	EndHeight              int64                  `json:"end_height"`
	OnlineInfos            []*OnlineInfoToMarshal `json:"online_infos"`
	ValidatorsMaybeSlashed []gethcmn.Address      `json:"validators_maybe_slashed"`
}

type ValidatorWatchInfosToMarshal added in v0.5.1

type ValidatorWatchInfosToMarshal struct {
	StartHeight int64                 `json:"start_height"`
	EndHeight   int64                 `json:"end_height"`
	WatchInfos  []*WatchInfoToMarshal `json:"online_infos"`
}

type WatchInfoToMarshal added in v0.5.1

type WatchInfoToMarshal struct {
	ValidatorConsensusAddress gethcmn.Address `json:"validator_consensus_address"`
	SignatureCount            int32           `json:"signature_count"`
	HeightOfLastSignature     int64           `json:"height_of_last_signature"`
	VotingPowerBeDecreased    bool            `json:"voting_power_be_decreased"`
}

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