api

package
v0.9.32 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2015 License: LGPL-2.1-or-later Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AdminApiversion = "1.0"
)
View Source
const (
	DbApiversion = "1.0"
)
View Source
const (
	DebugApiVersion = "1.0"
)
View Source
const (
	EthApiVersion = "1.0"
)
View Source
const (
	MergedApiVersion = "1.0"
)
View Source
const (
	MinerApiVersion = "1.0"
)
View Source
const (
	NetApiVersion = "1.0"
)
View Source
const (
	PersonalApiVersion = "1.0"
)
View Source
const (
	ShhApiVersion = "1.0"
)
View Source
const (
	TxPoolApiVersion = "1.0"
)
View Source
const (
	Web3ApiVersion = "1.0"
)

Variables

View Source
var (
	// mapping between methods and handlers
	AdminMapping = map[string]adminhandler{
		"admin_addPeer":         (*adminApi).AddPeer,
		"admin_peers":           (*adminApi).Peers,
		"admin_nodeInfo":        (*adminApi).NodeInfo,
		"admin_exportChain":     (*adminApi).ExportChain,
		"admin_importChain":     (*adminApi).ImportChain,
		"admin_verbosity":       (*adminApi).Verbosity,
		"admin_chainSyncStatus": (*adminApi).ChainSyncStatus,
		"admin_setSolc":         (*adminApi).SetSolc,
		"admin_datadir":         (*adminApi).DataDir,
		"admin_startRPC":        (*adminApi).StartRPC,
		"admin_stopRPC":         (*adminApi).StopRPC,
	}
)
View Source
var (
	// Mapping between the different methods each api supports
	AutoCompletion = map[string][]string{
		"admin": []string{
			"addPeer",
			"peers",
			"nodeInfo",
			"exportChain",
			"importChain",
			"verbosity",
			"chainSyncStatus",
			"setSolc",
			"datadir",
			"startRPC",
			"stopRPC",
		},
		"db": []string{
			"getString",
			"putString",
			"getHex",
			"putHex",
		},
		"debug": []string{
			"dumpBlock",
			"getBlockRlp",
			"printBlock",
			"processBlock",
			"seedHash",
			"setHead",
		},
		"eth": []string{
			"accounts",
			"blockNumber",
			"getBalance",
			"protocolVersion",
			"coinbase",
			"mining",
			"gasPrice",
			"getStorage",
			"storageAt",
			"getStorageAt",
			"getTransactionCount",
			"getBlockTransactionCountByHash",
			"getBlockTransactionCountByNumber",
			"getUncleCountByBlockHash",
			"getUncleCountByBlockNumber",
			"getData",
			"getCode",
			"sign",
			"sendRawTransaction",
			"sendTransaction",
			"transact",
			"estimateGas",
			"call",
			"flush",
			"getBlockByHash",
			"getBlockByNumber",
			"getTransactionByHash",
			"getTransactionByBlockHashAndIndex",
			"getUncleByBlockHashAndIndex",
			"getUncleByBlockNumberAndIndex",
			"getCompilers",
			"compileSolidity",
			"newFilter",
			"newBlockFilter",
			"newPendingTransactionFilter",
			"uninstallFilter",
			"getFilterChanges",
			"getFilterLogs",
			"getLogs",
			"hashrate",
			"getWork",
			"submitWork",
		},
		"miner": []string{
			"hashrate",
			"makeDAG",
			"setExtra",
			"setGasPrice",
			"startAutoDAG",
			"start",
			"stopAutoDAG",
			"stop",
		},
		"net": []string{
			"peerCount",
			"listening",
		},
		"personal": []string{
			"listAccounts",
			"newAccount",
			"deleteAccount",
			"unlockAccount",
		},
		"shh": []string{
			"version",
			"post",
			"hasIdentity",
			"newIdentity",
			"newFilter",
			"uninstallFilter",
			"getFilterChanges",
		},
		"txpool": []string{
			"status",
		},
		"web3": []string{
			"sha3",
			"version",
			"fromWei",
			"toWei",
			"toHex",
			"toAscii",
			"fromAscii",
			"toBigNumber",
			"isAddress",
		},
	}
)
View Source
var (
	// mapping between methods and handlers
	DbMapping = map[string]dbhandler{
		"db_getString": (*dbApi).GetString,
		"db_putString": (*dbApi).PutString,
		"db_getHex":    (*dbApi).GetHex,
		"db_putHex":    (*dbApi).PutHex,
	}
)
View Source
var (
	// mapping between methods and handlers
	DebugMapping = map[string]debughandler{
		"debug_dumpBlock":    (*debugApi).DumpBlock,
		"debug_getBlockRlp":  (*debugApi).GetBlockRlp,
		"debug_printBlock":   (*debugApi).PrintBlock,
		"debug_processBlock": (*debugApi).ProcessBlock,
		"debug_seedHash":     (*debugApi).SeedHash,
		"debug_setHead":      (*debugApi).SetHead,
	}
)
View Source
var (
	// mapping between methods and handlers
	MinerMapping = map[string]minerhandler{
		"miner_hashrate":     (*minerApi).Hashrate,
		"miner_makeDAG":      (*minerApi).MakeDAG,
		"miner_setExtra":     (*minerApi).SetExtra,
		"miner_setGasPrice":  (*minerApi).SetGasPrice,
		"miner_startAutoDAG": (*minerApi).StartAutoDAG,
		"miner_start":        (*minerApi).StartMiner,
		"miner_stopAutoDAG":  (*minerApi).StopAutoDAG,
		"miner_stop":         (*minerApi).StopMiner,
	}
)
View Source
var (
	// mapping between methods and handlers
	Web3Mapping = map[string]web3handler{
		"web3_sha3":          (*web3Api).Sha3,
		"web3_clientVersion": (*web3Api).ClientVersion,
	}
)

Functions

func Javascript

func Javascript(name string) string

func Merge

func Merge(apis ...shared.EthereumApi) shared.EthereumApi

Merge multiple API's to a single API instance

func NewAdminApi

func NewAdminApi(xeth *xeth.XEth, ethereum *eth.Ethereum, codec codec.Codec) *adminApi

create a new admin api instance

func NewDbApi

func NewDbApi(xeth *xeth.XEth, ethereum *eth.Ethereum, coder codec.Codec) *dbApi

create a new db api instance

func NewDebugApi

func NewDebugApi(xeth *xeth.XEth, ethereum *eth.Ethereum, coder codec.Codec) *debugApi

create a new debug api instance

func NewEthApi

func NewEthApi(xeth *xeth.XEth, codec codec.Codec) *ethApi

create new ethApi instance

func NewHashesRes

func NewHashesRes(hs []common.Hash) []string

func NewMinerApi

func NewMinerApi(ethereum *eth.Ethereum, coder codec.Codec) *minerApi

create a new miner api instance

func NewNetApi

func NewNetApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *netApi

create a new net api instance

func NewPersonalApi

func NewPersonalApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *personalApi

create a new net api instance

func NewShhApi

func NewShhApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *shhApi

create a new whisper api instance

func NewTxPoolApi

func NewTxPoolApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *txPoolApi

create a new txpool api instance

func NewWeb3Api

func NewWeb3Api(xeth *xeth.XEth, coder codec.Codec) *web3Api

create a new web3 api instance

func ParseApiString

func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth.Ethereum) ([]shared.EthereumApi, error)

Parse a comma separated API string to individual api's

Types

type AddPeerArgs

type AddPeerArgs struct {
	Url string
}

func (*AddPeerArgs) UnmarshalJSON

func (args *AddPeerArgs) UnmarshalJSON(b []byte) (err error)

type BlockFilterArgs

type BlockFilterArgs struct {
	Earliest int64
	Latest   int64
	Address  []string
	Topics   [][]string
	Skip     int
	Max      int
}

func (*BlockFilterArgs) UnmarshalJSON

func (args *BlockFilterArgs) UnmarshalJSON(b []byte) (err error)

type BlockNumArg

type BlockNumArg struct {
	BlockNumber int64
}

func (*BlockNumArg) UnmarshalJSON

func (args *BlockNumArg) UnmarshalJSON(b []byte) (err error)

type BlockNumIndexArgs

type BlockNumIndexArgs struct {
	BlockNumber int64
	Index       int64
}

func (*BlockNumIndexArgs) UnmarshalJSON

func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error)

type BlockRes

type BlockRes struct {
	BlockNumber     *hexnum           `json:"number"`
	BlockHash       *hexdata          `json:"hash"`
	ParentHash      *hexdata          `json:"parentHash"`
	Nonce           *hexdata          `json:"nonce"`
	Sha3Uncles      *hexdata          `json:"sha3Uncles"`
	LogsBloom       *hexdata          `json:"logsBloom"`
	TransactionRoot *hexdata          `json:"transactionsRoot"`
	StateRoot       *hexdata          `json:"stateRoot"`
	Miner           *hexdata          `json:"miner"`
	Difficulty      *hexnum           `json:"difficulty"`
	TotalDifficulty *hexnum           `json:"totalDifficulty"`
	Size            *hexnum           `json:"size"`
	ExtraData       *hexdata          `json:"extraData"`
	GasLimit        *hexnum           `json:"gasLimit"`
	GasUsed         *hexnum           `json:"gasUsed"`
	UnixTimestamp   *hexnum           `json:"timestamp"`
	Transactions    []*TransactionRes `json:"transactions"`
	Uncles          []*UncleRes       `json:"uncles"`
	// contains filtered or unexported fields
}

func NewBlockRes

func NewBlockRes(block *types.Block, fullTx bool) *BlockRes

func (*BlockRes) MarshalJSON

func (b *BlockRes) MarshalJSON() ([]byte, error)

type CallArgs

type CallArgs struct {
	From     string
	To       string
	Value    *big.Int
	Gas      *big.Int
	GasPrice *big.Int
	Data     string

	BlockNumber int64
}

func (*CallArgs) UnmarshalJSON

func (args *CallArgs) UnmarshalJSON(b []byte) (err error)

type CompileArgs

type CompileArgs struct {
	Source string
}

func (*CompileArgs) UnmarshalJSON

func (args *CompileArgs) UnmarshalJSON(b []byte) (err error)

type DbArgs

type DbArgs struct {
	Database string
	Key      string
	Value    []byte
}

func (*DbArgs) UnmarshalJSON

func (args *DbArgs) UnmarshalJSON(b []byte) (err error)

type DbHexArgs

type DbHexArgs struct {
	Database string
	Key      string
	Value    []byte
}

func (*DbHexArgs) UnmarshalJSON

func (args *DbHexArgs) UnmarshalJSON(b []byte) (err error)

type DeleteAccountArgs

type DeleteAccountArgs struct {
	Address    string
	Passphrase string
}

func (*DeleteAccountArgs) UnmarshalJSON

func (args *DeleteAccountArgs) UnmarshalJSON(b []byte) (err error)

type FilterIdArgs

type FilterIdArgs struct {
	Id int
}

func (*FilterIdArgs) UnmarshalJSON

func (args *FilterIdArgs) UnmarshalJSON(b []byte) (err error)

type FilterStringArgs

type FilterStringArgs struct {
	Word string
}

func (*FilterStringArgs) UnmarshalJSON

func (args *FilterStringArgs) UnmarshalJSON(b []byte) (err error)

type GasPriceArgs

type GasPriceArgs struct {
	Price string
}

func (*GasPriceArgs) UnmarshalJSON

func (args *GasPriceArgs) UnmarshalJSON(b []byte) (err error)

type GetBalanceArgs

type GetBalanceArgs struct {
	Address     string
	BlockNumber int64
}

func (*GetBalanceArgs) UnmarshalJSON

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

type GetBlockByHashArgs

type GetBlockByHashArgs struct {
	BlockHash  string
	IncludeTxs bool
}

func (*GetBlockByHashArgs) UnmarshalJSON

func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error)

type GetBlockByNumberArgs

type GetBlockByNumberArgs struct {
	BlockNumber int64
	IncludeTxs  bool
}

func (*GetBlockByNumberArgs) UnmarshalJSON

func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error)

type GetDataArgs

type GetDataArgs struct {
	Address     string
	BlockNumber int64
}

func (*GetDataArgs) UnmarshalJSON

func (args *GetDataArgs) UnmarshalJSON(b []byte) (err error)

type GetStorageArgs

type GetStorageArgs struct {
	Address     string
	BlockNumber int64
}

func (*GetStorageArgs) UnmarshalJSON

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

type GetStorageAtArgs

type GetStorageAtArgs struct {
	Address     string
	BlockNumber int64
	Key         string
}

func (*GetStorageAtArgs) UnmarshalJSON

func (args *GetStorageAtArgs) UnmarshalJSON(b []byte) (err error)

type GetTxCountArgs

type GetTxCountArgs struct {
	Address     string
	BlockNumber int64
}

func (*GetTxCountArgs) UnmarshalJSON

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

type HashArgs

type HashArgs struct {
	Hash string
}

func (*HashArgs) UnmarshalJSON

func (args *HashArgs) UnmarshalJSON(b []byte) (err error)

type HashIndexArgs

type HashIndexArgs struct {
	Hash  string
	Index int64
}

func (*HashIndexArgs) UnmarshalJSON

func (args *HashIndexArgs) UnmarshalJSON(b []byte) (err error)

type ImportExportChainArgs

type ImportExportChainArgs struct {
	Filename string
}

func (*ImportExportChainArgs) UnmarshalJSON

func (args *ImportExportChainArgs) UnmarshalJSON(b []byte) (err error)

type LogRes

type LogRes struct {
	Address          *hexdata   `json:"address"`
	Topics           []*hexdata `json:"topics"`
	Data             *hexdata   `json:"data"`
	BlockNumber      *hexnum    `json:"blockNumber"`
	LogIndex         *hexnum    `json:"logIndex"`
	BlockHash        *hexdata   `json:"blockHash"`
	TransactionHash  *hexdata   `json:"transactionHash"`
	TransactionIndex *hexnum    `json:"transactionIndex"`
}

func NewLogRes

func NewLogRes(log *state.Log) LogRes

func NewLogsRes

func NewLogsRes(logs state.Logs) (ls []LogRes)

type MakeDAGArgs

type MakeDAGArgs struct {
	BlockNumber int64
}

func (*MakeDAGArgs) UnmarshalJSON

func (args *MakeDAGArgs) UnmarshalJSON(b []byte) (err error)

type MergedApi

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

combines multiple API's

func (*MergedApi) ApiVersion

func (self *MergedApi) ApiVersion() string

func (*MergedApi) Execute

func (self *MergedApi) Execute(req *shared.Request) (interface{}, error)

Call the correct API's Execute method for the given request

func (*MergedApi) Methods

func (self *MergedApi) Methods() []string

Supported RPC methods

func (*MergedApi) Name

func (self *MergedApi) Name() string

type NewAccountArgs

type NewAccountArgs struct {
	Passphrase string
}

func (*NewAccountArgs) UnmarshalJSON

func (args *NewAccountArgs) UnmarshalJSON(b []byte) (err error)

type NewDataArgs

type NewDataArgs struct {
	Data string
}

func (*NewDataArgs) UnmarshalJSON

func (args *NewDataArgs) UnmarshalJSON(b []byte) (err error)

type NewSigArgs

type NewSigArgs struct {
	From string
	Data string
}

func (*NewSigArgs) UnmarshalJSON

func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error)

type NewTxArgs

type NewTxArgs struct {
	From     string
	To       string
	Nonce    *big.Int
	Value    *big.Int
	Gas      *big.Int
	GasPrice *big.Int
	Data     string

	BlockNumber int64
}

func (*NewTxArgs) UnmarshalJSON

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

type SetExtraArgs

type SetExtraArgs struct {
	Data string
}

func (*SetExtraArgs) UnmarshalJSON

func (args *SetExtraArgs) UnmarshalJSON(b []byte) (err error)

type SetSolcArgs

type SetSolcArgs struct {
	Path string
}

func (*SetSolcArgs) UnmarshalJSON

func (args *SetSolcArgs) UnmarshalJSON(b []byte) (err error)

type Sha3Args

type Sha3Args struct {
	Data string
}

func (*Sha3Args) UnmarshalJSON

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

type SourceArgs

type SourceArgs struct {
	Source string
}

func (*SourceArgs) UnmarshalJSON

func (args *SourceArgs) UnmarshalJSON(b []byte) (err error)

type StartMinerArgs

type StartMinerArgs struct {
	Threads int
}

func (*StartMinerArgs) UnmarshalJSON

func (args *StartMinerArgs) UnmarshalJSON(b []byte) (err error)

type StartRPCArgs

type StartRPCArgs struct {
	ListenAddress string
	ListenPort    uint
	CorsDomain    string
	Apis          string
}

func (*StartRPCArgs) UnmarshalJSON

func (args *StartRPCArgs) UnmarshalJSON(b []byte) (err error)

type SubmitWorkArgs

type SubmitWorkArgs struct {
	Nonce  uint64
	Header string
	Digest string
}

func (*SubmitWorkArgs) UnmarshalJSON

func (args *SubmitWorkArgs) UnmarshalJSON(b []byte) (err error)

type TransactionRes

type TransactionRes struct {
	Hash        *hexdata `json:"hash"`
	Nonce       *hexnum  `json:"nonce"`
	BlockHash   *hexdata `json:"blockHash"`
	BlockNumber *hexnum  `json:"blockNumber"`
	TxIndex     *hexnum  `json:"transactionIndex"`
	From        *hexdata `json:"from"`
	To          *hexdata `json:"to"`
	Value       *hexnum  `json:"value"`
	Gas         *hexnum  `json:"gas"`
	GasPrice    *hexnum  `json:"gasPrice"`
	Input       *hexdata `json:"input"`
}

func NewTransactionRes

func NewTransactionRes(tx *types.Transaction) *TransactionRes

type UncleRes

type UncleRes struct {
	BlockNumber     *hexnum  `json:"number"`
	BlockHash       *hexdata `json:"hash"`
	ParentHash      *hexdata `json:"parentHash"`
	Nonce           *hexdata `json:"nonce"`
	Sha3Uncles      *hexdata `json:"sha3Uncles"`
	ReceiptHash     *hexdata `json:"receiptHash"`
	LogsBloom       *hexdata `json:"logsBloom"`
	TransactionRoot *hexdata `json:"transactionsRoot"`
	StateRoot       *hexdata `json:"stateRoot"`
	Miner           *hexdata `json:"miner"`
	Difficulty      *hexnum  `json:"difficulty"`
	ExtraData       *hexdata `json:"extraData"`
	GasLimit        *hexnum  `json:"gasLimit"`
	GasUsed         *hexnum  `json:"gasUsed"`
	UnixTimestamp   *hexnum  `json:"timestamp"`
}

func NewUncleRes

func NewUncleRes(h *types.Header) *UncleRes

type UnlockAccountArgs

type UnlockAccountArgs struct {
	Address    string
	Passphrase string
	Duration   int
}

func (*UnlockAccountArgs) UnmarshalJSON

func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error)

type VerbosityArgs

type VerbosityArgs struct {
	Level int
}

func (*VerbosityArgs) UnmarshalJSON

func (args *VerbosityArgs) UnmarshalJSON(b []byte) (err error)

type WaitForBlockArgs

type WaitForBlockArgs struct {
	MinHeight int
	Timeout   int // in seconds
}

func (*WaitForBlockArgs) UnmarshalJSON

func (args *WaitForBlockArgs) UnmarshalJSON(b []byte) (err error)

type WhisperFilterArgs

type WhisperFilterArgs struct {
	To     string
	From   string
	Topics [][]string
}

func (*WhisperFilterArgs) UnmarshalJSON

func (args *WhisperFilterArgs) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface, invoked to convert a JSON message blob into a WhisperFilterArgs structure.

type WhisperIdentityArgs

type WhisperIdentityArgs struct {
	Identity string
}

func (*WhisperIdentityArgs) UnmarshalJSON

func (args *WhisperIdentityArgs) UnmarshalJSON(b []byte) (err error)

type WhisperMessageArgs

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

func (*WhisperMessageArgs) UnmarshalJSON

func (args *WhisperMessageArgs) UnmarshalJSON(b []byte) (err error)

Jump to

Keyboard shortcuts

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