rpc

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2015 License: LGPL-2.1-or-later Imports: 19 Imported by: 0

Documentation

Overview

This file is part of go-ethereum

go-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

go-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with go-ethereum.  If not, see <http://www.gnu.org/licenses/>.

For each request type, define the following:

1. RpcRequest "To" method [message.go], which does basic validation and conversion to "Args" type via json.Decoder() 2. json.Decoder() calls "UnmarshalON" defined on each "Args" struct 3. EthereumApi method, taking the "Args" type and replying with an interface to be marshalled to ON

	This file is part of go-ethereum

	go-ethereum is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	go-ethereum is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with go-ethereum.  If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	ErrorArguments      = "Error: Insufficient arguments"
	ErrorNotImplemented = "Error: Method not implemented"
	ErrorUnknown        = "Error: Unknown error"
	ErrorParseRequest   = "Error: Could not parse request"
	ErrorDecodeArgs     = "Error: Could not decode arguments"
)

Variables

This section is empty.

Functions

func NewErrorResponse

func NewErrorResponse(msg string) error

func NewErrorResponseWithError added in v0.8.4

func NewErrorResponseWithError(msg string, err error) error

Types

type BalanceRes

type BalanceRes struct {
	Balance string `json:"balance"`
	Address string `json:"address"`
}

type DbArgs added in v0.8.4

type DbArgs struct {
	Database string
	Key      string
	Value    string
}

type EthereumApi

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

func NewEthereumApi added in v0.8.4

func NewEthereumApi(eth *xeth.XEth) *EthereumApi

func (*EthereumApi) Accounts added in v0.8.4

func (p *EthereumApi) Accounts(reply *interface{}) error

func (*EthereumApi) AllLogs added in v0.8.5

func (self *EthereumApi) AllLogs(args *FilterOptions, reply *interface{}) error

func (*EthereumApi) BlockNumber added in v0.8.4

func (p *EthereumApi) BlockNumber(reply *interface{}) error

func (*EthereumApi) Call added in v0.8.4

func (p *EthereumApi) Call(args *NewTxArgs, reply *interface{}) error

func (*EthereumApi) CompileSerpent added in v0.8.4

func (p *EthereumApi) CompileSerpent(script string, reply *interface{}) error

func (*EthereumApi) DbGet added in v0.8.4

func (p *EthereumApi) DbGet(args *DbArgs, reply *interface{}) error

func (*EthereumApi) DbPut added in v0.8.4

func (p *EthereumApi) DbPut(args *DbArgs, reply *interface{}) error

func (*EthereumApi) FilterChanged added in v0.8.4

func (self *EthereumApi) FilterChanged(id int, reply *interface{}) error

func (*EthereumApi) GetBalanceAt

func (p *EthereumApi) GetBalanceAt(args *GetBalanceArgs, reply *interface{}) error

func (*EthereumApi) GetBlock

func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error

func (*EthereumApi) GetCodeAt added in v0.8.4

func (p *EthereumApi) GetCodeAt(args *GetCodeAtArgs, reply *interface{}) error

func (*EthereumApi) GetCoinbase

func (p *EthereumApi) GetCoinbase(reply *interface{}) error

func (*EthereumApi) GetCompilers added in v0.8.4

func (p *EthereumApi) GetCompilers(reply *interface{}) error

func (*EthereumApi) GetIsListening

func (p *EthereumApi) GetIsListening(reply *interface{}) error

func (*EthereumApi) GetIsMining

func (p *EthereumApi) GetIsMining(reply *interface{}) error

func (*EthereumApi) GetPeerCount

func (p *EthereumApi) GetPeerCount(reply *interface{}) error

func (*EthereumApi) GetRequestReply added in v0.8.4

func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error

func (*EthereumApi) GetStateAt added in v0.8.4

func (p *EthereumApi) GetStateAt(args *GetStateArgs, reply *interface{}) error

func (*EthereumApi) GetStorageAt

func (p *EthereumApi) GetStorageAt(args *GetStorageArgs, reply *interface{}) error

func (*EthereumApi) GetTxCountAt

func (p *EthereumApi) GetTxCountAt(args *GetTxCountArgs, reply *interface{}) error

func (*EthereumApi) HasWhisperIdentity added in v0.8.4

func (p *EthereumApi) HasWhisperIdentity(args string, reply *interface{}) error

func (*EthereumApi) Logs added in v0.8.4

func (self *EthereumApi) Logs(id int, reply *interface{}) error

func (*EthereumApi) MessagesChanged added in v0.8.4

func (self *EthereumApi) MessagesChanged(id int, reply *interface{}) error

func (*EthereumApi) NewFilter added in v0.8.4

func (self *EthereumApi) NewFilter(args *FilterOptions, reply *interface{}) error

func (*EthereumApi) NewFilterString added in v0.8.4

func (self *EthereumApi) NewFilterString(args string, reply *interface{}) error

func (*EthereumApi) NewWhisperFilter added in v0.8.4

func (p *EthereumApi) NewWhisperFilter(args *xeth.Options, reply *interface{}) error

func (*EthereumApi) NewWhisperIdentity added in v0.8.4

func (p *EthereumApi) NewWhisperIdentity(reply *interface{}) error

func (*EthereumApi) PushTx

func (p *EthereumApi) PushTx(args *PushTxArgs, reply *interface{}) error

func (*EthereumApi) Register added in v0.8.4

func (self *EthereumApi) Register(args string, reply *interface{}) error

func (*EthereumApi) SetMining added in v0.8.4

func (p *EthereumApi) SetMining(shouldmine bool, reply *interface{}) error

func (*EthereumApi) Sha3 added in v0.8.4

func (p *EthereumApi) Sha3(args *Sha3Args, reply *interface{}) error

func (*EthereumApi) Transact

func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) error

func (*EthereumApi) UninstallFilter added in v0.8.4

func (self *EthereumApi) UninstallFilter(id int, reply *interface{}) error

func (*EthereumApi) Unregister added in v0.8.4

func (self *EthereumApi) Unregister(args string, reply *interface{}) error

func (*EthereumApi) WatchTx added in v0.8.4

func (self *EthereumApi) WatchTx(args string, reply *interface{}) error

func (*EthereumApi) WhisperMessages added in v0.8.4

func (p *EthereumApi) WhisperMessages(id int, reply *interface{}) error

func (*EthereumApi) WhisperPost added in v0.8.4

func (p *EthereumApi) WhisperPost(args *WhisperMessageArgs, reply *interface{}) error

type FilterChangedArgs added in v0.8.4

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

type FilterOptions added in v0.8.4

type FilterOptions struct {
	Earliest int64
	Latest   int64
	Address  interface{}
	Topic    []string
	Skip     int
	Max      int
}

type GetBalanceArgs

type GetBalanceArgs struct {
	Address string
}

func (*GetBalanceArgs) UnmarshalJSON added in v0.8.4

func (obj *GetBalanceArgs) UnmarshalJSON(b []byte) (err error)

type GetBlockArgs

type GetBlockArgs struct {
	BlockNumber int32
	Hash        string
}

func (*GetBlockArgs) UnmarshalJSON added in v0.8.4

func (obj *GetBlockArgs) UnmarshalJSON(b []byte) (err error)

type GetCodeAtArgs added in v0.8.4

type GetCodeAtArgs struct {
	Address string
}

func (*GetCodeAtArgs) UnmarshalJSON added in v0.8.4

func (obj *GetCodeAtArgs) UnmarshalJSON(b []byte) (err error)

type GetStateArgs added in v0.8.4

type GetStateArgs struct {
	Address string
	Key     string
}

func (*GetStateArgs) UnmarshalJSON added in v0.8.4

func (obj *GetStateArgs) UnmarshalJSON(b []byte) (err error)

type GetStorageArgs

type GetStorageArgs struct {
	Address string
}

func (*GetStorageArgs) UnmarshalJSON added in v0.8.4

func (obj *GetStorageArgs) UnmarshalJSON(b []byte) (err error)

type GetStorageAtRes

type GetStorageAtRes struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type GetTxCountArgs

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

func (*GetTxCountArgs) UnmarshalJSON added in v0.8.4

func (obj *GetTxCountArgs) UnmarshalJSON(b []byte) (err error)

type JsonWrapper added in v0.8.4

type JsonWrapper struct{}

func (JsonWrapper) ParseRequestBody added in v0.8.4

func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error)

func (JsonWrapper) Send added in v0.8.4

func (self JsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error)

type Log added in v0.8.4

type Log struct {
	Address string   `json:"address"`
	Topic   []string `json:"topics"`
	Data    string   `json:"data"`
	Number  uint64   `json:"number"`
}

type NewTxArgs

type NewTxArgs struct {
	From     string `json:"from"`
	To       string `json:"to"`
	Value    string `json:"value"`
	Gas      string `json:"gas"`
	GasPrice string `json:"gasPrice"`
	Data     string `json:"data"`
}

func (*NewTxArgs) UnmarshalJSON added in v0.8.4

func (obj *NewTxArgs) UnmarshalJSON(b []byte) (err error)

type PushTxArgs

type PushTxArgs struct {
	Tx string `json:"tx"`
}

func (*PushTxArgs) UnmarshalJSON added in v0.8.4

func (obj *PushTxArgs) UnmarshalJSON(b []byte) (err error)

type RpcErrorObject added in v0.8.4

type RpcErrorObject struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type RpcErrorResponse added in v0.8.4

type RpcErrorResponse struct {
	ID      interface{}     `json:"id"`
	JsonRpc string          `json:"jsonrpc"`
	Error   *RpcErrorObject `json:"error"`
}

type RpcRequest added in v0.8.4

type RpcRequest struct {
	ID      interface{}       `json:"id"`
	JsonRpc string            `json:"jsonrpc"`
	Method  string            `json:"method"`
	Params  []json.RawMessage `json:"params"`
}

func (*RpcRequest) ToBoolArgs added in v0.8.4

func (req *RpcRequest) ToBoolArgs() (bool, error)

func (*RpcRequest) ToCompileArgs added in v0.8.4

func (req *RpcRequest) ToCompileArgs() (string, error)

func (*RpcRequest) ToDbGetArgs added in v0.8.4

func (req *RpcRequest) ToDbGetArgs() (*DbArgs, error)

func (*RpcRequest) ToDbPutArgs added in v0.8.4

func (req *RpcRequest) ToDbPutArgs() (*DbArgs, error)

func (*RpcRequest) ToFilterArgs added in v0.8.4

func (req *RpcRequest) ToFilterArgs() (*FilterOptions, error)

func (*RpcRequest) ToFilterChangedArgs added in v0.8.4

func (req *RpcRequest) ToFilterChangedArgs() (int, error)

func (*RpcRequest) ToFilterStringArgs added in v0.8.4

func (req *RpcRequest) ToFilterStringArgs() (string, error)

func (*RpcRequest) ToGetBalanceArgs added in v0.8.4

func (req *RpcRequest) ToGetBalanceArgs() (*GetBalanceArgs, error)

func (*RpcRequest) ToGetBlockArgs added in v0.8.4

func (req *RpcRequest) ToGetBlockArgs() (*GetBlockArgs, error)

func (*RpcRequest) ToGetCodeAtArgs added in v0.8.4

func (req *RpcRequest) ToGetCodeAtArgs() (*GetCodeAtArgs, error)

func (*RpcRequest) ToGetStateArgs added in v0.8.4

func (req *RpcRequest) ToGetStateArgs() (*GetStateArgs, error)

func (*RpcRequest) ToGetTxCountArgs added in v0.8.4

func (req *RpcRequest) ToGetTxCountArgs() (*GetTxCountArgs, error)

func (*RpcRequest) ToIdArgs added in v0.8.4

func (req *RpcRequest) ToIdArgs() (int, error)

func (*RpcRequest) ToNewTxArgs added in v0.8.4

func (req *RpcRequest) ToNewTxArgs() (*NewTxArgs, error)

func (*RpcRequest) ToPushTxArgs added in v0.8.4

func (req *RpcRequest) ToPushTxArgs() (*PushTxArgs, error)

func (*RpcRequest) ToRegisterArgs added in v0.8.4

func (req *RpcRequest) ToRegisterArgs() (string, error)

func (*RpcRequest) ToSha3Args added in v0.8.4

func (req *RpcRequest) ToSha3Args() (*Sha3Args, error)

func (*RpcRequest) ToStorageAtArgs added in v0.8.4

func (req *RpcRequest) ToStorageAtArgs() (*GetStorageArgs, error)

func (*RpcRequest) ToUninstallFilterArgs added in v0.8.4

func (req *RpcRequest) ToUninstallFilterArgs() (int, error)

func (*RpcRequest) ToWatchTxArgs added in v0.8.4

func (req *RpcRequest) ToWatchTxArgs() (string, error)

func (*RpcRequest) ToWhisperFilterArgs added in v0.8.4

func (req *RpcRequest) ToWhisperFilterArgs() (*xeth.Options, error)

func (*RpcRequest) ToWhisperHasIdentityArgs added in v0.8.4

func (req *RpcRequest) ToWhisperHasIdentityArgs() (string, error)

func (*RpcRequest) ToWhisperPostArgs added in v0.8.4

func (req *RpcRequest) ToWhisperPostArgs() (*WhisperMessageArgs, error)

type RpcServer added in v0.8.4

type RpcServer interface {
	Start()
	Stop()
}

type RpcSuccessResponse added in v0.8.4

type RpcSuccessResponse struct {
	ID      interface{} `json:"id"`
	JsonRpc string      `json:"jsonrpc"`
	Result  interface{} `json:"result"`
}

type Sha3Args added in v0.8.4

type Sha3Args struct {
	Data string
}

func (*Sha3Args) UnmarshalJSON added in v0.8.4

func (obj *Sha3Args) UnmarshalJSON(b []byte) (err error)

type WhisperMessageArgs added in v0.8.4

type WhisperMessageArgs struct {
	Payload  string
	To       string
	From     string
	Topic    []string
	Priority uint32
	Ttl      uint32
}

Directories

Path Synopsis
This file is part of go-ethereum go-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This file is part of go-ethereum go-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This file is part of go-ethereum go-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This file is part of go-ethereum go-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Jump to

Keyboard shortcuts

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