Documentation ¶
Index ¶
- Constants
- func GetMethods(codec rpc.Codec, service *rpc.Service, logger *logging.Logger) map[string]RequestHandlerFunc
- func NewJSONService(codec rpc.Codec, service *rpc.Service, logger *logging.Logger) server.HttpService
- func NewTCodec() rpc.Codec
- func NewWebsocketService(codec rpc.Codec, service *rpc.Service, logger *logging.Logger) server.WebSocketService
- type AddressParam
- type BlocksParam
- type CallCodeParam
- type CallParam
- type EventIdParam
- type EventSub
- type EventUnsub
- type FilterListParam
- type HeightParam
- type InputAccount
- type JSONService
- func (js *JSONService) EventPoll(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
- func (js *JSONService) EventSubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
- func (js *JSONService) EventUnsubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
- func (js *JSONService) Process(r *http.Request, w http.ResponseWriter)
- type JsonRpcServer
- type NameRegEntryParam
- type PeerParam
- type PollResponse
- type PrivateKeyParam
- type RPCResponse
- type RequestHandlerFunc
- type SendParam
- type SignTxParam
- type StorageAtParam
- type SubIdParam
- type TCodec
- type TransactNameRegParam
- type TransactParam
- type V0Client
- func (vc *V0Client) Call(param CallParam) (*execution.Call, error)
- func (vc *V0Client) CallCode(param CallCodeParam) (*execution.Call, error)
- func (vc *V0Client) CallMethod(method string, param interface{}, result interface{}) error
- func (vc *V0Client) Send(param SendParam) (*txs.Receipt, error)
- func (vc *V0Client) SendAndHold(param SendParam) (*txs.Receipt, error)
- func (vc *V0Client) Transact(param TransactParam) (*txs.Receipt, error)
- func (vc *V0Client) TransactAndHold(param TransactParam) (*events.EventDataCall, error)
- type WebsocketService
- func (ws *WebsocketService) EventPoll(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
- func (ws *WebsocketService) EventSubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
- func (ws *WebsocketService) EventUnsubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
- func (ws *WebsocketService) Process(msg []byte, session *server.WSSession)
Constants ¶
const ( SERVICE_NAME = "burrow" GET_ACCOUNTS = SERVICE_NAME + ".getAccounts" // Accounts GET_ACCOUNT = SERVICE_NAME + ".getAccount" GET_STORAGE = SERVICE_NAME + ".getStorage" GET_STORAGE_AT = SERVICE_NAME + ".getStorageAt" GEN_PRIV_ACCOUNT = SERVICE_NAME + ".genPrivAccount" GEN_PRIV_ACCOUNT_FROM_KEY = SERVICE_NAME + ".genPrivAccountFromKey" GET_BLOCKCHAIN_INFO = SERVICE_NAME + ".getBlockchainInfo" // Blockchain GET_LATEST_BLOCK = SERVICE_NAME + ".getLatestBlock" GET_BLOCKS = SERVICE_NAME + ".getBlocks" GET_BLOCK = SERVICE_NAME + ".getBlock" GET_CONSENSUS_STATE = SERVICE_NAME + ".getConsensusState" // Consensus GET_VALIDATORS = SERVICE_NAME + ".getValidators" GET_NETWORK_INFO = SERVICE_NAME + ".getNetworkInfo" // Net GET_CHAIN_ID = SERVICE_NAME + ".getChainId" GET_PEERS = SERVICE_NAME + ".getPeers" CALL = SERVICE_NAME + ".call" // Tx CALL_CODE = SERVICE_NAME + ".callCode" BROADCAST_TX = SERVICE_NAME + ".broadcastTx" GET_UNCONFIRMED_TXS = SERVICE_NAME + ".getUnconfirmedTxs" SIGN_TX = SERVICE_NAME + ".signTx" TRANSACT = SERVICE_NAME + ".transact" TRANSACT_AND_HOLD = SERVICE_NAME + ".transactAndHold" SEND = SERVICE_NAME + ".send" SEND_AND_HOLD = SERVICE_NAME + ".sendAndHold" TRANSACT_NAMEREG = SERVICE_NAME + ".transactNameReg" EVENT_SUBSCRIBE = SERVICE_NAME + ".eventSubscribe" // Events EVENT_UNSUBSCRIBE = SERVICE_NAME + ".eventUnsubscribe" EVENT_POLL = SERVICE_NAME + ".eventPoll" GET_NAMEREG_ENTRY = SERVICE_NAME + ".getNameRegEntry" // Namereg GET_NAMEREG_ENTRIES = SERVICE_NAME + ".getNameRegEntries" )
TODO use the method name definition file.
Variables ¶
This section is empty.
Functions ¶
func GetMethods ¶ added in v0.18.0
func GetMethods(codec rpc.Codec, service *rpc.Service, logger *logging.Logger) map[string]RequestHandlerFunc
Private. Create a method name -> method handler map.
func NewJSONService ¶ added in v0.18.0
func NewJSONService(codec rpc.Codec, service *rpc.Service, logger *logging.Logger) server.HttpService
Create a new JSON-RPC 2.0 service for burrow (tendermint).
func NewWebsocketService ¶ added in v0.18.0
func NewWebsocketService(codec rpc.Codec, service *rpc.Service, logger *logging.Logger) server.WebSocketService
Create a new websocket service.
Types ¶
type AddressParam ¶
Used to send an address. The address should be hex and properly formatted.
type BlocksParam ¶
type CallCodeParam ¶
type CallCodeParam struct { From binary.HexBytes `json:"from"` Code binary.HexBytes `json:"code"` Data binary.HexBytes `json:"data"` }
Used when doing code calls
type CallParam ¶
type CallParam struct { Address binary.HexBytes `json:"address"` From binary.HexBytes `json:"from"` Data binary.HexBytes `json:"data"` }
Used when doing calls
type EventSub ¶ added in v0.18.0
type EventSub struct {
SubId string `json:"subId"`
}
EventSubscribe
type EventUnsub ¶ added in v0.18.0
type EventUnsub struct {
Result bool `json:"result"`
}
EventUnsubscribe
type FilterListParam ¶
type FilterListParam struct {
Filters []*filters.FilterData `json:"filters"`
}
Used to send an address
type InputAccount ¶ added in v0.19.0
type JSONService ¶ added in v0.18.0
type JSONService struct {
// contains filtered or unexported fields
}
Used for Burrow. Implements server.HttpService
func (*JSONService) EventPoll ¶ added in v0.18.0
func (js *JSONService) EventPoll(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
Check subscription event cache for new data.
func (*JSONService) EventSubscribe ¶ added in v0.18.0
func (js *JSONService) EventSubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
Subscribe to an
func (*JSONService) EventUnsubscribe ¶ added in v0.18.0
func (js *JSONService) EventUnsubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
Un-subscribe from an
func (*JSONService) Process ¶ added in v0.18.0
func (js *JSONService) Process(r *http.Request, w http.ResponseWriter)
Process a request.
type JsonRpcServer ¶
type JsonRpcServer struct {
// contains filtered or unexported fields
}
Server used to handle JSON-RPC 2.0 requests. Implements server.Server
func NewJSONServer ¶ added in v0.18.0
func NewJSONServer(service server.HttpService) *JsonRpcServer
Create a new JsonRpcServer
func (*JsonRpcServer) Running ¶
func (jrs *JsonRpcServer) Running() bool
Is the server currently running?
func (*JsonRpcServer) Shutdown ¶ added in v0.18.0
func (jrs *JsonRpcServer) Shutdown(ctx context.Context) error
Shut the server down. Does nothing.
func (*JsonRpcServer) Start ¶
func (jrs *JsonRpcServer) Start(config *server.ServerConfig, router *gin.Engine)
Start adds the rpc path to the router.
type NameRegEntryParam ¶
type NameRegEntryParam struct {
Name string `json:"name"`
}
type PollResponse ¶ added in v0.18.0
type PollResponse struct {
Events []interface{} `json:"events"`
}
EventPoll
type PrivateKeyParam ¶ added in v0.19.0
type RPCResponse ¶ added in v0.18.0
type RequestHandlerFunc ¶
type RequestHandlerFunc func(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
Used to handle requests. interface{} param is a wildcard used for example with socket events.
type SendParam ¶
type SendParam struct { InputAccount InputAccount `json:"inputAccount"` ToAddress binary.HexBytes `json:"toAddress"` Amount uint64 `json:"amount"` }
Used when sending a 'Send' transaction.
type SignTxParam ¶
type SignTxParam struct { Tx *payload.CallTx `json:"tx"` PrivateAccounts []*acm.ConcretePrivateAccount `json:"privateAccounts"` }
Used when signing a tx. Uses placeholders just like TxParam
type StorageAtParam ¶
type StorageAtParam struct { Address binary.HexBytes `json:"address"` Key binary.HexBytes `json:"key"` }
StorageAt
type TCodec ¶
type TCodec struct { }
Codec that uses tendermints 'binary' package for JSON.
func (*TCodec) DecodeBytes ¶
Decode from a byte array.
func (*TCodec) EncodeBytes ¶
Encode to a byte array.
type TransactNameRegParam ¶
type TransactNameRegParam struct { InputAccount InputAccount `json:"inputAccount"` Name string `json:"name"` Data string `json:"data"` Fee uint64 `json:"fee"` Amount uint64 `json:"amount"` }
Used when sending a namereg transaction to be created and signed on the server (using the private key). This only uses the standard key type for now.
type TransactParam ¶
type TransactParam struct { InputAccount InputAccount `json:"inputAccount"` Data binary.HexBytes `json:"data"` Address binary.HexBytes `json:"address"` Fee uint64 `json:"fee"` GasLimit uint64 `json:"gasLimit"` }
Used when sending a transaction to be created and signed on the server (using the private key). This only uses the standard key type for now.
type V0Client ¶ added in v0.18.0
type V0Client struct {
// contains filtered or unexported fields
}
func NewV0Client ¶ added in v0.18.0
func (*V0Client) CallCode ¶ added in v0.18.0
func (vc *V0Client) CallCode(param CallCodeParam) (*execution.Call, error)
func (*V0Client) CallMethod ¶ added in v0.18.0
func (*V0Client) SendAndHold ¶ added in v0.18.0
func (*V0Client) Transact ¶ added in v0.18.0
func (vc *V0Client) Transact(param TransactParam) (*txs.Receipt, error)
func (*V0Client) TransactAndHold ¶ added in v0.18.0
func (vc *V0Client) TransactAndHold(param TransactParam) (*events.EventDataCall, error)
type WebsocketService ¶ added in v0.18.0
type WebsocketService struct {
// contains filtered or unexported fields
}
Used for Burrow. Implements WebSocketService.
func (*WebsocketService) EventPoll ¶ added in v0.18.0
func (ws *WebsocketService) EventPoll(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
func (*WebsocketService) EventSubscribe ¶ added in v0.18.0
func (ws *WebsocketService) EventSubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)
func (*WebsocketService) EventUnsubscribe ¶ added in v0.18.0
func (ws *WebsocketService) EventUnsubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)