v0

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
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 NewTCodec

func NewTCodec() rpc.Codec

Get a new codec.

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 binary.HexBytes `json:"address"`
}

Used to send an address. The address should be hex and properly formatted.

type BlocksParam

type BlocksParam struct {
	MinHeight uint64 `json:"minHeight"`
	MaxHeight uint64 `json:"maxHeight"`
}

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 EventIdParam

type EventIdParam struct {
	EventId string `json:"eventId"`
}

Event Id

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 HeightParam

type HeightParam struct {
	Height uint64 `json:"height"`
}

Get a block

type InputAccount added in v0.19.0

type InputAccount struct {
	PrivateKey binary.HexBytes `json:"privateKey"`
	Address    binary.HexBytes `json:"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 PeerParam

type PeerParam struct {
	Address string `json:"address"`
}

type PollResponse added in v0.18.0

type PollResponse struct {
	Events []interface{} `json:"events"`
}

EventPoll

type PrivateKeyParam added in v0.19.0

type PrivateKeyParam struct {
	PrivateKey binary.HexBytes `json:"privateKey"`
}

type RPCResponse added in v0.18.0

type RPCResponse struct {
	Result  json.RawMessage `json:"result"`
	Error   *rpc.RPCError   `json:"error"`
	Id      string          `json:"id"`
	JSONRPC string          `json:"jsonrpc"`
}

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 SubIdParam

type SubIdParam struct {
	SubId string `json:"subId"`
}

Event Id

type TCodec

type TCodec struct {
}

Codec that uses tendermints 'binary' package for JSON.

func (*TCodec) Decode

func (codec *TCodec) Decode(v interface{}, r io.Reader) error

Decode from an io.Reader.

func (*TCodec) DecodeBytes

func (codec *TCodec) DecodeBytes(v interface{}, bs []byte) error

Decode from a byte array.

func (*TCodec) Encode

func (codec *TCodec) Encode(v interface{}, w io.Writer) error

Encode to an io.Writer.

func (*TCodec) EncodeBytes

func (codec *TCodec) EncodeBytes(v interface{}) ([]byte, error)

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 NewV0Client(url string) *V0Client

func (*V0Client) Call added in v0.18.0

func (vc *V0Client) Call(param CallParam) (*execution.Call, error)

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 (vc *V0Client) CallMethod(method string, param interface{}, result interface{}) error

func (*V0Client) Send added in v0.18.0

func (vc *V0Client) Send(param SendParam) (*txs.Receipt, error)

func (*V0Client) SendAndHold added in v0.18.0

func (vc *V0Client) SendAndHold(param SendParam) (*txs.Receipt, error)

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)

func (*WebsocketService) Process added in v0.18.0

func (ws *WebsocketService) Process(msg []byte, session *server.WSSession)

Process a request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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