Documentation
¶
Index ¶
- func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
- func NewJSONCodec(conn io.ReadWriteCloser, srv *rpc.Server) rpc.ServerCodec
- func ServeConn(conn io.ReadWriteCloser)
- type BatchArg
- type BlockInfo
- type Client
- type CurrentBlock
- type Debt
- type Error
- type GetBlockByHeightRequest
- type Header
- type JSONRPC2
- type PeerInfo
- type Receipt
- type SeeleRPC
- func (rpc *SeeleRPC) Connect() error
- func (rpc *SeeleRPC) CurrentBlockHeight() (uint64, error)
- func (rpc *SeeleRPC) GetBalance(account string) (int64, error)
- func (rpc *SeeleRPC) GetBlockByHeight(h uint64, fullTx bool) (block *BlockInfo, err error)
- func (rpc *SeeleRPC) GetPeersInfo() (result []PeerInfo, err error)
- func (rpc *SeeleRPC) GetPendingTransactions() ([]Transaction, error)
- func (rpc *SeeleRPC) GetReceiptByTxHash(txhash string) (*Receipt, error)
- func (rpc *SeeleRPC) Release()
- type Transaction
- type TxDebt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientCodec ¶
func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
NewClientCodec returns a new rpc.ClientCodec using JSON-RPC 2.0 on conn.
func NewJSONCodec ¶
func NewJSONCodec(conn io.ReadWriteCloser, srv *rpc.Server) rpc.ServerCodec
NewJSONCodec returns a new rpc.ServerCodec using JSON-RPC on conn.
func ServeConn ¶
func ServeConn(conn io.ReadWriteCloser)
ServeConn runs the JSON-RPC server on a single connection. ServeConn blocks, serving the connection until the client hangs up. The caller typically invokes ServeConn with go-routine.
Types ¶
type BatchArg ¶
type BatchArg struct {
// contains filtered or unexported fields
}
BatchArg is a param for internal RPC JSONRPC2.Batch.
type BlockInfo ¶
type BlockInfo struct {
Hash string `json:"hash"`
ParentHash string `json:"parentHash"`
Height uint64 `json:"height"`
StateHash string `json:"stateHash"`
Timestamp *big.Int `json:"timestamp"`
Difficulty *big.Int `json:"difficulty"`
TotalDifficulty *big.Int `json:"totaldifficulty"`
Creator string `json:"creator"`
Nonce uint64 `json:"nonce"`
TxHash string `json:"txHash"`
Txs []Transaction `json:"txs"`
Debts []Debt `json:"debts"`
TxDebts []TxDebt `json:"txDebts"`
}
BlockInfo is the block data send from seele node
type Client ¶
Client represents a JSON RPC 2.0 Client. There may be multiple outstanding Calls associated with a single Client, and a Client may be used by multiple goroutines simultaneously.
It also provides all methods of net/rpc Client.
func NewClient ¶
func NewClient(conn io.ReadWriteCloser) *Client
NewClient returns a new Client to handle requests to the set of services at the other end of the connection.
func NewClientWithCodec ¶
func NewClientWithCodec(codec rpc.ClientCodec) *Client
NewClientWithCodec returns a new Client using the given rpc.ClientCodec.
type CurrentBlock ¶
type CurrentBlock struct {
HeadHash string `json:"headHash"`
Height uint64 `json:"height"`
Timestamp *big.Int `json:"timestamp"`
Difficult *big.Int `json:"difficult"`
Creator string `json:"creator"`
TxCount int `json:"txcount"`
}
CurrentBlock is the informations about the best block
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
Error represent JSON-RPC 2.0 "Error object".
func ServerError ¶
ServerError convert errors returned by Client.Call() into Error. User should check for rpc.ErrShutdown and io.ErrUnexpectedEOF before calling ServerError.
type GetBlockByHeightRequest ¶
GetBlockByHeightRequest request param for GetBlockByHeight api
type JSONRPC2 ¶
type JSONRPC2 struct{}
JSONRPC2 is an internal RPC service used to process batch requests.
type PeerInfo ¶
type PeerInfo struct {
ID string `json:"id"` // Unique of the node
Caps []string `json:"caps"` // Sum-protocols advertised by this particular peer
LocalAddress string `json:"localAddress"` // Local endpoint of the TCP data connection
RemoteAddress string `json:"remoteAddress"` // Remote endpoint of the TCP data connection
ShardNumber int `json:"shardNumber"`
}
PeerInfo is the peer info send from seele node
type Receipt ¶
type Receipt struct {
Result string `json:"result"`
PostState string `json:"poststate"`
TxHash string `json:"txhash"`
ContractAddress string `json:"contractaddress"`
Failed bool `json:"failed"`
TotalFee int64 `json:"totalFee"`
UsedGas int64 `json:"usedGas"`
}
Receipt is the receipt information of tx
type SeeleRPC ¶
type SeeleRPC struct {
// contains filtered or unexported fields
}
SeeleRPC json_rpc client
func (*SeeleRPC) CurrentBlockHeight ¶
CurrentBlockHeight gets the current blockchain height
func (*SeeleRPC) GetBalance ¶
GetBalance get the balance of the account
func (*SeeleRPC) GetBlockByHeight ¶
GetBlockByHeight get block and transaction data from seele node
func (*SeeleRPC) GetPeersInfo ¶
GetPeersInfo get peers info from connected seele node
func (*SeeleRPC) GetPendingTransactions ¶
func (rpc *SeeleRPC) GetPendingTransactions() ([]Transaction, error)
GetPendingTransactions get pending transactions on seele node
func (*SeeleRPC) GetReceiptByTxHash ¶
GetReceiptByTxHash get the receipt by tx hash
type Transaction ¶
type Transaction struct {
Hash string `json:"hash"`
DebtTxHash string `json:"debtTxHash"`
From string `json:"from"`
To string `json:"to"`
Amount *big.Int `json:"amount"`
AccountNonce uint64 `json:"accountNonce"`
Payload string `json:"payload"`
Timestamp uint64 `json:"timestamp"`
Fee int64 `json:"fee"`
Block uint64 `json:"block"`
Idx uint64 `json:"idx"`
TxType int `json:"txtype"`
GasLimit int64 `json:"gasLimit"`
GasPrice int64 `json:"gasPrice"`
}
Transaction is the transaction data send from seele node