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 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 PrivKeyParam
- type RPCResponse
- type RequestHandlerFunc
- type SendParam
- type SignTxParam
- type StorageAtParam
- type SubIdParam
- type Subscriptions
- type SubscriptionsCache
- type TCodec
- func (codec *TCodec) Decode(v interface{}, r io.Reader) error
- func (codec *TCodec) DecodeBytes(v interface{}, bts []byte) error
- func (codec *TCodec) DecodeBytesPtr(v interface{}, bts []byte) error
- func (codec *TCodec) Encode(v interface{}, w io.Writer) error
- func (codec *TCodec) EncodeBytes(v interface{}) ([]byte, error)
- 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 ¶
type AddressParam struct {
Address []byte `json:"address"`
}
Used to send an address. The address should be hex and properly formatted.
type BlocksParam ¶
type CallCodeParam ¶
type CallCodeParam struct { From []byte `json:"from"` Code []byte `json:"code"` Data []byte `json:"data"` }
Used when doing code calls
type CallParam ¶
type CallParam struct { Address []byte `json:"address"` From []byte `json:"from"` Data []byte `json:"data"` }
Used when doing calls
type EventSub ¶ added in v0.18.0
type EventSub struct {
SubId string `json:"sub_id"`
}
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 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 PrivKeyParam ¶
type PrivKeyParam struct {
PrivKey []byte `json:"priv_key"`
}
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 { PrivKey []byte `json:"priv_key"` InputAddress []byte `json:"input_account"` ToAddress []byte `json:"to_address"` Amount uint64 `json:"amount"` }
Used when sending a 'Send' transaction.
type SignTxParam ¶
type SignTxParam struct { Tx *txs.CallTx `json:"tx"` PrivAccounts []*acm.ConcretePrivateAccount `json:"priv_accounts"` }
Used when signing a tx. Uses placeholders just like TxParam
type StorageAtParam ¶
StorageAt
type Subscriptions ¶ added in v0.18.0
type Subscriptions struct {
// contains filtered or unexported fields
}
Catches events that callers subscribe to and adds them to an array ready to be polled.
func NewSubscriptions ¶ added in v0.18.0
func NewSubscriptions(service *rpc.Service) *Subscriptions
func (*Subscriptions) Add ¶ added in v0.18.0
func (subs *Subscriptions) Add(eventId string) (string, error)
Add a subscription and return the generated id. Note event dispatcher has to call func which involves acquiring a mutex lock, so might be a delay - though a conflict is practically impossible, and if it does happen it's for an insignificant amount of time (the time it takes to carry out SubscriptionsCache.poll() ).
func (*Subscriptions) Poll ¶ added in v0.18.0
func (subs *Subscriptions) Poll(subId string) ([]interface{}, error)
func (*Subscriptions) Remove ¶ added in v0.18.0
func (subs *Subscriptions) Remove(subId string) error
type SubscriptionsCache ¶ added in v0.18.0
type SubscriptionsCache struct {
// contains filtered or unexported fields
}
type TCodec ¶
type TCodec struct { }
Codec that uses tendermints 'binary' package for JSON.
func (*TCodec) DecodeBytes ¶
Decode from a byte array.
func (*TCodec) DecodeBytesPtr ¶
Decode from a byte array pointer.
func (*TCodec) EncodeBytes ¶
Encode to a byte array.
type TransactNameRegParam ¶
type TransactNameRegParam struct { PrivKey []byte `json:"priv_key"` InputAddress []byte `json:"input_account"` 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 { PrivKey []byte `json:"priv_key"` InputAddress []byte `json:"input_account"` Data []byte `json:"data"` Address []byte `json:"address"` Fee uint64 `json:"fee"` GasLimit uint64 `json:"gas_limit"` }
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)