rpc

package
v0.8.6-0...-b2a225a Latest Latest
Warning

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

Go to latest
Published: Feb 23, 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

func NewErrorResponseWithError(msg string, err error) error

Types

type BalanceRes

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

type DbArgs

type DbArgs struct {
	Database string
	Key      string
	Value    string
}

type EthereumApi

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

func NewEthereumApi

func NewEthereumApi(eth *xeth.XEth) *EthereumApi

func (*EthereumApi) Accounts

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

func (*EthereumApi) AllLogs

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

func (*EthereumApi) BlockNumber

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

func (*EthereumApi) Call

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

func (*EthereumApi) CompileSerpent

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

func (*EthereumApi) DbGet

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

func (*EthereumApi) DbPut

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

func (*EthereumApi) FilterChanged

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

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

func (*EthereumApi) GetCoinbase

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

func (*EthereumApi) GetCompilers

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

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

func (*EthereumApi) GetStateAt

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

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

func (*EthereumApi) Logs

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

func (*EthereumApi) MessagesChanged

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

func (*EthereumApi) NewFilter

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

func (*EthereumApi) NewFilterString

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

func (*EthereumApi) NewWhisperFilter

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

func (*EthereumApi) NewWhisperIdentity

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

func (*EthereumApi) PushTx

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

func (*EthereumApi) Register

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

func (*EthereumApi) SetMining

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

func (*EthereumApi) Sha3

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

func (*EthereumApi) Transact

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

func (*EthereumApi) UninstallFilter

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

func (*EthereumApi) Unregister

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

func (*EthereumApi) WatchTx

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

func (*EthereumApi) WhisperMessages

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

func (*EthereumApi) WhisperPost

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

type FilterChangedArgs

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

type FilterOptions

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

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

type GetBlockArgs

type GetBlockArgs struct {
	BlockNumber int32
	Hash        string
}

func (*GetBlockArgs) UnmarshalJSON

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

type GetCodeAtArgs

type GetCodeAtArgs struct {
	Address string
}

func (*GetCodeAtArgs) UnmarshalJSON

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

type GetStateArgs

type GetStateArgs struct {
	Address string
	Key     string
}

func (*GetStateArgs) UnmarshalJSON

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

type GetStorageArgs

type GetStorageArgs struct {
	Address string
}

func (*GetStorageArgs) UnmarshalJSON

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

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

type JsonWrapper

type JsonWrapper struct{}

func (JsonWrapper) ParseRequestBody

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

func (JsonWrapper) Send

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

type Log

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

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

type PushTxArgs

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

func (*PushTxArgs) UnmarshalJSON

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

type RpcErrorObject

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

type RpcErrorResponse

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

type RpcRequest

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

func (*RpcRequest) ToBoolArgs

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

func (*RpcRequest) ToCompileArgs

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

func (*RpcRequest) ToDbGetArgs

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

func (*RpcRequest) ToDbPutArgs

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

func (*RpcRequest) ToFilterArgs

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

func (*RpcRequest) ToFilterChangedArgs

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

func (*RpcRequest) ToFilterStringArgs

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

func (*RpcRequest) ToGetBalanceArgs

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

func (*RpcRequest) ToGetBlockArgs

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

func (*RpcRequest) ToGetCodeAtArgs

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

func (*RpcRequest) ToGetStateArgs

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

func (*RpcRequest) ToGetTxCountArgs

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

func (*RpcRequest) ToIdArgs

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

func (*RpcRequest) ToNewTxArgs

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

func (*RpcRequest) ToPushTxArgs

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

func (*RpcRequest) ToRegisterArgs

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

func (*RpcRequest) ToSha3Args

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

func (*RpcRequest) ToStorageAtArgs

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

func (*RpcRequest) ToUninstallFilterArgs

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

func (*RpcRequest) ToWatchTxArgs

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

func (*RpcRequest) ToWhisperFilterArgs

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

func (*RpcRequest) ToWhisperHasIdentityArgs

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

func (*RpcRequest) ToWhisperPostArgs

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

type RpcServer

type RpcServer interface {
	Start()
	Stop()
}

type RpcSuccessResponse

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

type Sha3Args

type Sha3Args struct {
	Data string
}

func (*Sha3Args) UnmarshalJSON

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

type WhisperMessageArgs

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