rpc_v0

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2016 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERVICE_NAME = "erisdb"

	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_GENESIS_HASH          = SERVICE_NAME + ".getGenesisHash"
	GET_LATEST_BLOCK_HEIGHT   = SERVICE_NAME + ".getLatestBlockHeight"
	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_CLIENT_VERSION        = SERVICE_NAME + ".getClientVersion"
	GET_MONIKER               = SERVICE_NAME + ".getMoniker"
	GET_CHAIN_ID              = SERVICE_NAME + ".getChainId"
	IS_LISTENING              = SERVICE_NAME + ".isListening"
	GET_LISTENERS             = SERVICE_NAME + ".getListeners"
	GET_PEERS                 = SERVICE_NAME + ".getPeers"
	GET_PEER                  = SERVICE_NAME + ".getPeer"
	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 NewErisDbJsonService

func NewErisDbJsonService(codec rpc.Codec, pipe definitions.Pipe,
	eventSubs *event.EventSubscriptions) server.HttpService

Create a new JSON-RPC 2.0 service for erisdb (tendermint).

func NewErisDbWsService

func NewErisDbWsService(codec rpc.Codec,
	pipe definitions.Pipe) server.WebSocketService

Create a new websocket service.

func NewTCodec

func NewTCodec() rpc.Codec

Get a new codec.

Types

type AccountsParam

type AccountsParam struct {
	Filters []*event.FilterData `json:"filters"`
}

Used to send an address TODO deprecate in favor of 'FilterListParam'

type AddressParam

type AddressParam struct {
	Address []byte `json:"address"`
}

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

type BlocksParam

type BlocksParam struct {
	Filters []*event.FilterData `json:"filters"`
}

Get a series of blocks TODO deprecate in favor of 'FilterListParam'

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 ErisDbJsonService

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

Used for ErisDb. Implements server.HttpService

func (*ErisDbJsonService) EventPoll

func (this *ErisDbJsonService) EventPoll(request *rpc.RPCRequest,
	requester interface{}) (interface{}, int, error)

Check subscription event cache for new data.

func (*ErisDbJsonService) EventSubscribe

func (this *ErisDbJsonService) EventSubscribe(request *rpc.RPCRequest,
	requester interface{}) (interface{}, int, error)

Subscribe to an event.

func (*ErisDbJsonService) EventUnsubscribe

func (this *ErisDbJsonService) EventUnsubscribe(request *rpc.RPCRequest,
	requester interface{}) (interface{}, int, error)

Un-subscribe from an event.

func (*ErisDbJsonService) Process

func (this *ErisDbJsonService) Process(r *http.Request, w http.ResponseWriter)

Process a request.

type ErisDbMethods

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

The rpc method handlers.

func NewErisDbMethods

func NewErisDbMethods(codec rpc.Codec,
	pipe definitions.Pipe) *ErisDbMethods

func (*ErisDbMethods) Account

func (erisDbMethods *ErisDbMethods) Account(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) AccountStorage

func (erisDbMethods *ErisDbMethods) AccountStorage(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) AccountStorageAt

func (erisDbMethods *ErisDbMethods) AccountStorageAt(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Accounts

func (erisDbMethods *ErisDbMethods) Accounts(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Block

func (erisDbMethods *ErisDbMethods) Block(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) BlockchainInfo

func (erisDbMethods *ErisDbMethods) BlockchainInfo(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Blocks

func (erisDbMethods *ErisDbMethods) Blocks(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) BroadcastTx

func (erisDbMethods *ErisDbMethods) BroadcastTx(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Call

func (erisDbMethods *ErisDbMethods) Call(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) CallCode

func (erisDbMethods *ErisDbMethods) CallCode(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) ChainId

func (erisDbMethods *ErisDbMethods) ChainId(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) ClientVersion

func (erisDbMethods *ErisDbMethods) ClientVersion(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) ConsensusState

func (erisDbMethods *ErisDbMethods) ConsensusState(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) GenPrivAccount

func (erisDbMethods *ErisDbMethods) GenPrivAccount(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) GenPrivAccountFromKey

func (erisDbMethods *ErisDbMethods) GenPrivAccountFromKey(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) GenesisHash

func (erisDbMethods *ErisDbMethods) GenesisHash(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) LatestBlock

func (erisDbMethods *ErisDbMethods) LatestBlock(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) LatestBlockHeight

func (erisDbMethods *ErisDbMethods) LatestBlockHeight(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Listeners

func (erisDbMethods *ErisDbMethods) Listeners(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Listening

func (erisDbMethods *ErisDbMethods) Listening(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Moniker

func (erisDbMethods *ErisDbMethods) Moniker(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) NameRegEntries

func (erisDbMethods *ErisDbMethods) NameRegEntries(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) NameRegEntry

func (erisDbMethods *ErisDbMethods) NameRegEntry(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) NetworkInfo

func (erisDbMethods *ErisDbMethods) NetworkInfo(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Peer

func (erisDbMethods *ErisDbMethods) Peer(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Peers

func (erisDbMethods *ErisDbMethods) Peers(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Send

func (this *ErisDbMethods) Send(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) SendAndHold

func (this *ErisDbMethods) SendAndHold(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) SignTx

func (erisDbMethods *ErisDbMethods) SignTx(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Transact

func (erisDbMethods *ErisDbMethods) Transact(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) TransactAndHold

func (erisDbMethods *ErisDbMethods) TransactAndHold(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) TransactNameReg

func (erisDbMethods *ErisDbMethods) TransactNameReg(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) UnconfirmedTxs

func (erisDbMethods *ErisDbMethods) UnconfirmedTxs(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbMethods) Validators

func (erisDbMethods *ErisDbMethods) Validators(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

type ErisDbWsService

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

Used for ErisDb. Implements WebSocketService.

func (*ErisDbWsService) EventPoll

func (this *ErisDbWsService) EventPoll(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbWsService) EventSubscribe

func (this *ErisDbWsService) EventSubscribe(request *rpc.RPCRequest,
	requester interface{}) (interface{}, int, error)

func (*ErisDbWsService) EventUnsubscribe

func (this *ErisDbWsService) EventUnsubscribe(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error)

func (*ErisDbWsService) Process

func (this *ErisDbWsService) Process(msg []byte, session *server.WSSession)

Process a request.

type EventIdParam

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

Event Id

type FilterListParam

type FilterListParam struct {
	Filters []*event.FilterData `json:"filters"`
}

Used to send an address

type HeightParam

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

Get a block

type JsonRpcServer

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

Server used to handle JSON-RPC 2.0 requests. Implements server.Server

func NewJsonRpcServer

func NewJsonRpcServer(service server.HttpService) *JsonRpcServer

Create a new JsonRpcServer

func (*JsonRpcServer) Running

func (this *JsonRpcServer) Running() bool

Is the server currently running?

func (*JsonRpcServer) ShutDown

func (this *JsonRpcServer) ShutDown()

Shut the server down. Does nothing.

func (*JsonRpcServer) Start

func (this *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 PrivKeyParam

type PrivKeyParam struct {
	PrivKey []byte `json:"priv_key"`
}

type RequestHandlerFunc

type RequestHandlerFunc func(*rpc.RPCRequest, interface{}) (interface{}, int, error)

Used to handle requests. interface{} param is a wildcard used for example with socket events.

type RestServer

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

Provides a REST-like web-api. Implements server.Server TODO more routers. Also, start looking into how better status codes can be gotten.

func NewRestServer

func NewRestServer(codec rpc.Codec, pipe definitions.Pipe,
	eventSubs *event.EventSubscriptions) *RestServer

Create a new rest server.

func (*RestServer) Running

func (restServer *RestServer) Running() bool

Is the server currently running?

func (*RestServer) ShutDown

func (restServer *RestServer) ShutDown()

Shut the server down. Does nothing.

func (*RestServer) Start

func (restServer *RestServer) Start(config *server.ServerConfig, router *gin.Engine)

Starting the server means registering all the handlers with the router.

type SendParam

type SendParam struct {
	PrivKey   []byte `json:"priv_key"`
	ToAddress []byte `json:"to_address"`
	Amount    int64  `json:"amount"`
}

Used when sending a 'Send' transaction.

type SignTxParam

type SignTxParam struct {
	Tx           *txs.CallTx            `json:"tx"`
	PrivAccounts []*account.PrivAccount `json:"priv_accounts"`
}

Used when signing a tx. Uses placeholders just like TxParam

type StorageAtParam

type StorageAtParam struct {
	Address []byte `json:"address"`
	Key     []byte `json:"key"`
}

StorageAt

type SubIdParam

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

Event Id

type TCodec

type TCodec struct {
}

Codec that uses tendermints 'binary' package for JSON.

func (*TCodec) Decode

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

Decode from an io.Reader.

func (*TCodec) DecodeBytes

func (this *TCodec) DecodeBytes(v interface{}, bts []byte) error

Decode from a byte array.

func (*TCodec) Encode

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

Encode to an io.Writer.

func (*TCodec) EncodeBytes

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

Encode to a byte array.

type TransactNameRegParam

type TransactNameRegParam struct {
	PrivKey []byte `json:"priv_key"`
	Name    string `json:"name"`
	Data    string `json:"data"`
	Fee     int64  `json:"fee"`
	Amount  int64  `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"`
	Data     []byte `json:"data"`
	Address  []byte `json:"address"`
	Fee      int64  `json:"fee"`
	GasLimit int64  `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.

Directories

Path Synopsis
Net is part of the pipe for ErisMint and provides the implementation for the pipe to call into the ErisMint application
Net is part of the pipe for ErisMint and provides the implementation for the pipe to call into the ErisMint application

Jump to

Keyboard shortcuts

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