qkcapi

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataEncoder

func DataEncoder(bytes []byte) hexutil.Bytes

func GetAPIs

func GetAPIs(apiBackend Backend) []rpc.API

func IDDecoder

func IDDecoder(bytes []byte) (ethCommon.Hash, uint32, error)

func IDEncoder

func IDEncoder(hashByte []byte, fullShardKey uint32) hexutil.Bytes

Types

type Backend

type Backend interface {
	AddTransaction(tx *types.Transaction) error
	ExecuteTransaction(tx *types.Transaction, address *account.Address, height *uint64) ([]byte, error)
	GetMinorBlockByHash(blockHash common.Hash, branch account.Branch) (*types.MinorBlock, error)
	GetMinorBlockByHeight(height *uint64, branch account.Branch) (*types.MinorBlock, error)
	GetTransactionByHash(txHash common.Hash, branch account.Branch) (*types.MinorBlock, uint32, error)
	GetTransactionReceipt(txHash common.Hash, branch account.Branch) (*types.MinorBlock, uint32, *types.Receipt, error)
	GetTransactionsByAddress(address *account.Address, start []byte, limit uint32) ([]*qkcRPC.TransactionDetail, []byte, error)
	GetLogs(branch account.Branch, address []account.Address, topics [][]common.Hash, startBlock, endBlock uint64) ([]*types.Log, error)
	EstimateGas(tx *types.Transaction, address *account.Address) (uint32, error)
	GetStorageAt(address *account.Address, key common.Hash, height *uint64) (common.Hash, error)
	GetCode(address *account.Address, height *uint64) ([]byte, error)
	GasPrice(branch account.Branch) (uint64, error)
	GetWork(branch account.Branch) (*consensus.MiningWork, error)
	SubmitWork(branch account.Branch, headerHash common.Hash, nonce uint64, mixHash common.Hash) (bool, error)
	GetRootBlockByNumber(blockNr *uint64) (*types.RootBlock, error)
	GetRootBlockByHash(hash common.Hash) (*types.RootBlock, error)
	NetWorkInfo() map[string]interface{}
	GetPrimaryAccountData(address *account.Address, blockHeight *uint64) (*qkcRPC.AccountBranchData, error)
	CurrentBlock() *types.RootBlock
	GetAccountData(address *account.Address, height *uint64) (map[uint32]*qkcRPC.AccountBranchData, error)
	GetClusterConfig() *config.ClusterConfig
	GetPeers() []qkcRPC.PeerInfoForDisPlay
	GetStats() (map[string]interface{}, error)
	GetBlockCount() (map[uint32]map[account.Recipient]uint32, error)
	SetTargetBlockTime(rootBlockTime *uint32, minorBlockTime *uint32) error
	SetMining(mining bool)
	CreateTransactions(numTxPerShard, xShardPercent uint32, tx *types.Transaction) error
	IsSyncing() bool
	IsMining() bool
	GetSlavePoolLen() int
	GetLastMinorBlockByFullShardID(fullShardId uint32) (uint64, error)
}

type CallArgs

type CallArgs struct {
	From     *account.Address `json:"from"`
	To       *account.Address `json:"to"`
	Gas      hexutil.Big      `json:"gas"`
	GasPrice hexutil.Big      `json:"gasPrice"`
	Value    hexutil.Big      `json:"value"`
	Data     hexutil.Bytes    `json:"data"`
}

CallArgs represents the arguments for a call.

type CreateTxArgs

type CreateTxArgs struct {
	NumTxPreShard    hexutil.Uint   `json:"numTxPerShard"`
	XShardPrecent    hexutil.Uint   `json:"xShardPercent"`
	To               common.Address `json:"to"`
	Gas              *hexutil.Big   `json:"gas"`
	GasPrice         *hexutil.Big   `json:"gasPrice"`
	Value            *hexutil.Big   `json:"value"`
	Data             hexutil.Bytes  `json:"data"`
	FromFullShardKey hexutil.Uint   `json:"fromFullShardKey"`
}

type FilterQuery

type FilterQuery struct {
	FromBlock *big.Int          // beginning of the queried range, nil means genesis block
	ToBlock   *big.Int          // end of the range, nil means latest block
	Addresses []account.Address // restricts matches to events created by specific contracts

	// The Topic list restricts matches to particular event topics. Each event has a list
	// of topics. Topics matches a prefix of that list. An empty element slice matches any
	// topic. Non-empty elements represent an alternative that matches any of the
	// contained topics.
	//
	// Examples:
	// {} or nil          matches any topic list
	// {{A}}              matches topic A in first position
	// {{}, {B}}          matches any topic in first position, B in second position
	// {{A}, {B}}         matches topic A in first position, B in second position
	// {{A, B}, {C, D}}   matches topic (A OR B) in first position, (C OR D) in second position
	Topics [][]common.Hash
}

func (*FilterQuery) UnmarshalJSON

func (args *FilterQuery) UnmarshalJSON(data []byte) error

https://github.com/ethereum/go-ethereum/blob/v1.8.20/eth/filters/api.go line 460 //TODO delete it UnmarshalJSON sets *args fields with given data.

type PrivateBlockChainAPI

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

func NewPrivateBlockChainAPI

func NewPrivateBlockChainAPI(b Backend) *PrivateBlockChainAPI

func (*PrivateBlockChainAPI) CreateTransactions

func (p *PrivateBlockChainAPI) CreateTransactions(NumTxPreShard hexutil.Uint) error

TODO txGenerate implement

func (*PrivateBlockChainAPI) GetBlockCount

func (p *PrivateBlockChainAPI) GetBlockCount() (map[string]interface{}, error)

func (*PrivateBlockChainAPI) GetJrpcCalls

func (p *PrivateBlockChainAPI) GetJrpcCalls()

TODO ?? necessary?

func (*PrivateBlockChainAPI) GetNextblocktomine

func (p *PrivateBlockChainAPI) GetNextblocktomine()

func (*PrivateBlockChainAPI) GetPeers

func (p *PrivateBlockChainAPI) GetPeers() map[string]interface{}

func (*PrivateBlockChainAPI) GetStats

func (p *PrivateBlockChainAPI) GetStats() (map[string]interface{}, error)

func (*PrivateBlockChainAPI) GetSyncStats

func (p *PrivateBlockChainAPI) GetSyncStats()

func (*PrivateBlockChainAPI) SetMining

func (p *PrivateBlockChainAPI) SetMining(flag bool)

func (*PrivateBlockChainAPI) SetTargetBlockTime

func (p *PrivateBlockChainAPI) SetTargetBlockTime(rootBlockTime *uint32, minorBlockTime *uint32) error

type PublicBlockChainAPI

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

It offers only methods that operate on public data that is freely available to anyone.

func NewPublicBlockChainAPI

func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI

NewPublicBlockChainAPI creates a new QuarkChain blockchain API.

func (*PublicBlockChainAPI) Call

func (p *PublicBlockChainAPI) Call(data CallArgs, blockNr *rpc.BlockNumber) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) CallOrEstimateGas

func (p *PublicBlockChainAPI) CallOrEstimateGas(args *CallArgs, height *uint64, isCall bool) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) EchoData

func (p *PublicBlockChainAPI) EchoData(data hexutil.Big) *hexutil.Big

EchoData echo data for test

func (*PublicBlockChainAPI) Echoquantity

func (p *PublicBlockChainAPI) Echoquantity(data hexutil.Big) *hexutil.Big

Echoquantity :should use data without leading zero

func (*PublicBlockChainAPI) EstimateGas

func (p *PublicBlockChainAPI) EstimateGas(data CallArgs) ([]byte, error)

func (*PublicBlockChainAPI) GasPrice

func (p *PublicBlockChainAPI) GasPrice(fullShardKey uint32) (hexutil.Uint64, error)

func (*PublicBlockChainAPI) GetAccountData

func (p *PublicBlockChainAPI) GetAccountData(address account.Address, blockNr *rpc.BlockNumber, includeShards *bool) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetBalances

func (p *PublicBlockChainAPI) GetBalances(address account.Address, blockNr *rpc.BlockNumber) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetCode

func (p *PublicBlockChainAPI) GetCode(address account.Address, blockNr *rpc.BlockNumber) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) GetLogs

func (p *PublicBlockChainAPI) GetLogs(args *FilterQuery, fullShardKey hexutil.Uint) ([]map[string]interface{}, error)

func (*PublicBlockChainAPI) GetMinorBlockByHeight

func (p *PublicBlockChainAPI) GetMinorBlockByHeight(fullShardKeyInput hexutil.Uint, heightInput *hexutil.Uint64, includeTxs *bool) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetMinorBlockById

func (p *PublicBlockChainAPI) GetMinorBlockById(blockID hexutil.Bytes, includeTxs *bool) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetRootBlockByHash

func (p *PublicBlockChainAPI) GetRootBlockByHash(hash common.Hash) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetRootBlockByHeight

func (p *PublicBlockChainAPI) GetRootBlockByHeight(heightInput *hexutil.Uint64) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetStorageAt

func (p *PublicBlockChainAPI) GetStorageAt(address account.Address, key common.Hash, blockNr *rpc.BlockNumber) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) GetTransactionById

func (p *PublicBlockChainAPI) GetTransactionById(txID hexutil.Bytes) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetTransactionCount

func (p *PublicBlockChainAPI) GetTransactionCount(address account.Address, blockNr *rpc.BlockNumber) (hexutil.Uint64, error)

func (*PublicBlockChainAPI) GetTransactionReceipt

func (p *PublicBlockChainAPI) GetTransactionReceipt(txID hexutil.Bytes) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetTransactionsByAddress

func (p *PublicBlockChainAPI) GetTransactionsByAddress(address account.Address, start *hexutil.Bytes, limit *hexutil.Uint) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetWork

func (p *PublicBlockChainAPI) GetWork(fullShardKey *hexutil.Uint) ([]common.Hash, error)

func (*PublicBlockChainAPI) NetVersion

func (p *PublicBlockChainAPI) NetVersion() hexutil.Uint

func (*PublicBlockChainAPI) NetworkInfo

func (p *PublicBlockChainAPI) NetworkInfo() map[string]interface{}

func (*PublicBlockChainAPI) QkcCall

func (p *PublicBlockChainAPI) QkcCall()

func (*PublicBlockChainAPI) QkcEstimategas

func (p *PublicBlockChainAPI) QkcEstimategas()

func (*PublicBlockChainAPI) QkcGetbalance

func (p *PublicBlockChainAPI) QkcGetbalance()

func (*PublicBlockChainAPI) QkcGetblockbynumber

func (p *PublicBlockChainAPI) QkcGetblockbynumber(blockNumber rpc.BlockNumber, includeTx bool) (map[string]interface{}, error)

func (*PublicBlockChainAPI) QkcGetcode

func (p *PublicBlockChainAPI) QkcGetcode()

func (*PublicBlockChainAPI) QkcGetlogs

func (p *PublicBlockChainAPI) QkcGetlogs()

func (*PublicBlockChainAPI) QkcGetstorageat

func (p *PublicBlockChainAPI) QkcGetstorageat()

func (*PublicBlockChainAPI) QkcGettransactioncount

func (p *PublicBlockChainAPI) QkcGettransactioncount()

func (*PublicBlockChainAPI) QkcGettransactionreceipt

func (p *PublicBlockChainAPI) QkcGettransactionreceipt()

func (*PublicBlockChainAPI) QkcQkcGasprice

func (p *PublicBlockChainAPI) QkcQkcGasprice(fullShardKey uint32) (hexutil.Uint64, error)

func (*PublicBlockChainAPI) QkcSendrawtransaction

func (p *PublicBlockChainAPI) QkcSendrawtransaction()

func (*PublicBlockChainAPI) SendRawTransaction

func (p *PublicBlockChainAPI) SendRawTransaction(encodedTx hexutil.Bytes) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) SendTransaction

func (p *PublicBlockChainAPI) SendTransaction(args SendTxArgs) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) SubmitWork

func (p *PublicBlockChainAPI) SubmitWork(fullShardKey *hexutil.Uint, headHash common.Hash, nonce hexutil.Uint64, mixHash common.Hash) (bool, error)

type SendTxArgs

type SendTxArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Big    `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
	// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
	// newer name and should be preferred by clients.
	Data             *hexutil.Bytes `json:"data"`
	FromFullShardKey *hexutil.Uint  `json:"fromFullShardKey"`
	ToFullShardKey   *hexutil.Uint  `json:"toFullShardKey"`
	V                *hexutil.Big   `json:"v"`
	R                *hexutil.Big   `json:"r"`
	S                *hexutil.Big   `json:"s"`
	NetWorkID        *hexutil.Uint  `json:"networkid"`
}

SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.

Jump to

Keyboard shortcuts

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