EthereumAPI

package module
v0.0.0-...-38f3b5e Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: MIT Imports: 10 Imported by: 0

README

Ethereum API

Documentation

Index

Constants

View Source
const Earliest string = "earliest"

Blog tags

View Source
const Latest string = "latest"
View Source
const Pending string = "pending"

Variables

View Source
var EtherscanAPIKeyToken string = "UninitializedApiKey"
View Source
var EtherscanTestNet bool = true
View Source
var EtherscanTestNetName string = "ropsten"

Functions

func AdminAddPeer

func AdminAddPeer(url string) (interface{}, error)

TODO: finish

func AdminDatadir

func AdminDatadir() (interface{}, error)

TODO: finish

func AdminNodeInfo

func AdminNodeInfo() (interface{}, error)

TODO: finish

func AdminPeers

func AdminPeers() (interface{}, error)

TODO: finish

func AdminSetSolc

func AdminSetSolc(path string) (interface{}, error)

TODO: finish

func AdminStartRPC

func AdminStartRPC(host string, port int64, cors string, apis string) (interface{}, error)

TODO: finish

func AdminStartWS

func AdminStartWS(host string, port int64, cors string, apis string) (interface{}, error)

TODO: finish

func AdminStopRPC

func AdminStopRPC() (interface{}, error)

TODO: finish

func AdminStopWS

func AdminStopWS() (interface{}, error)

TODO: finish

func CallRest

func CallRest(url string, dst interface{}) error

func DBGetHex

func DBGetHex(data []string) (string, error)

TODO: finish

func DBGetString

func DBGetString(data []string) (string, error)

TODO: finish

func DBPutHex

func DBPutHex(data []string) (bool, error)

TODO: finish

func DBPutString

func DBPutString(data []string) (bool, error)

TODO: finish

func DataToHex

func DataToHex(data string) ([]byte, error)

func DebugBacktraceAt

func DebugBacktraceAt(location string) (interface{}, error)

TODO: finish

func DebugBlockProfile

func DebugBlockProfile(file string, seconds int64) (interface{}, error)

TODO: finish

func DebugCPUProfile

func DebugCPUProfile(file string, seconds int64) (interface{}, error)

TODO: finish

func DebugDumpBlock

func DebugDumpBlock(number uint64) (interface{}, error)

TODO: finish

func DebugGCStats

func DebugGCStats() (interface{}, error)

TODO: finish

func DebugGetBlockRLP

func DebugGetBlockRLP(number uint64) (interface{}, error)

TODO: finish

func DebugGoTrace

func DebugGoTrace(file string, seconds int64) (interface{}, error)

TODO: finish

func DebugMemStats

func DebugMemStats() (interface{}, error)

TODO: finish

func DebugSeedHash

func DebugSeedHash(number uint64) (interface{}, error)

TODO: finish

func DebugSetBlockProfileRate

func DebugSetBlockProfileRate(rate int64) (interface{}, error)

TODO: finish

func DebugSetHead

func DebugSetHead(number uint64) (interface{}, error)

TODO: finish

func DebugStacks

func DebugStacks() (interface{}, error)

TODO: finish

func DebugStartCPUProfile

func DebugStartCPUProfile(file string) (interface{}, error)

TODO: finish

func DebugStartGoTrace

func DebugStartGoTrace(file string) (interface{}, error)

TODO: finish

func DebugStopCPUProfile

func DebugStopCPUProfile() (interface{}, error)

TODO: finish

func DebugStopGoTrace

func DebugStopGoTrace() (interface{}, error)

TODO: finish

func DebugTraceBlock

func DebugTraceBlock(blockRlp string) (interface{}, error)

TODO: finish TODO: add config?

func DebugTraceBlockByHash

func DebugTraceBlockByHash(hash string) (interface{}, error)

TODO: finish TODO: add config?

func DebugTraceBlockByNumber

func DebugTraceBlockByNumber(number uint64) (interface{}, error)

TODO: finish TODO: add config?

func DebugTraceBlockFromFile

func DebugTraceBlockFromFile(file string) (interface{}, error)

TODO: finish TODO: add config?

func DebugTraceTransaction

func DebugTraceTransaction(txHash string) (interface{}, error)

TODO: finish TODO: add options?

func DebugVModule

func DebugVModule(pattern string) (interface{}, error)

TODO: finish

func DebugVerbosity

func DebugVerbosity(number int64) (interface{}, error)

TODO: finish

func DebugWriteBlockProfile

func DebugWriteBlockProfile(file string) (interface{}, error)

TODO: finish

func DebugWriteMemProfile

func DebugWriteMemProfile(file string) (interface{}, error)

TODO: finish

func EncodeJSON

func EncodeJSON(data interface{}) ([]byte, error)

func EncodeJSONString

func EncodeJSONString(data interface{}) (string, error)

func EncodeJSONToBuffer

func EncodeJSONToBuffer(data interface{}, b *bytes.Buffer) error

func EthAccounts

func EthAccounts() ([]string, error)

func EthBlockNumber

func EthBlockNumber() (int64, error)

func EthCall

func EthCall(tx *TransactionObject, blockNumberOrTag string) (string, error)

TODO: test

func EthCoinbase

func EthCoinbase() (string, error)

func EthCompileLLL

func EthCompileLLL(sourceCode string) (string, error)

TODO: test

func EthCompileSerpent

func EthCompileSerpent(sourceCode string) (string, error)

TODO: test

func EthCompileSolidity

func EthCompileSolidity(sourceCode string) (string, error)

TODO: test

func EthEstimateGas

func EthEstimateGas(tx *TransactionObject, blockNumberOrTag string) (int64, error)

TODO: test

func EthGasPrice

func EthGasPrice() (int64, error)

func EthGetBalance

func EthGetBalance(address string, blockNumberOrTag string) (int64, error)

TODO: test

func EthGetBlockTransactionCountByHash

func EthGetBlockTransactionCountByHash(blockHash string) (int64, error)

TODO: test

func EthGetBlockTransactionCountByNumber

func EthGetBlockTransactionCountByNumber(blockNumberOrTag string) (int64, error)

TODO: test

func EthGetCode

func EthGetCode(address, blockNumberOrTag string) (string, error)

TODO: test

func EthGetCompilers

func EthGetCompilers() ([]string, error)

func EthGetStorageAt

func EthGetStorageAt(address, positionInTheStorage, blockNumberOrTag string) (string, error)

TODO: test

func EthGetTransactionCount

func EthGetTransactionCount(address, blockNumberOrTag string) (int64, error)

TODO: test

func EthGetUncleCountByBlockHash

func EthGetUncleCountByBlockHash(blockHash string) (int64, error)

TODO: test

func EthGetUncleCountByBlockNumber

func EthGetUncleCountByBlockNumber(blockNumberOrTag string) (int64, error)

TODO: test

func EthGetWork

func EthGetWork() ([]string, error)

TODO: test

func EthHashrate

func EthHashrate() (int64, error)

func EthMining

func EthMining() (bool, error)

func EthNewBlockFilter

func EthNewBlockFilter() (int64, error)

TODO: test

func EthNewFilter

func EthNewFilter(filterOptions *FilterOptions) (int64, error)

TODO: test

func EthNewPendingTransactionFilter

func EthNewPendingTransactionFilter() (int64, error)

TODO: test

func EthProtocolVersion

func EthProtocolVersion() (string, error)

func EthSendRawTransaction

func EthSendRawTransaction(txData string) (string, error)

TODO: test

func EthSendTransaction

func EthSendTransaction(tx *TransactionObject) (string, error)

TODO: test

func EthSign

func EthSign(address, hashOfDataToSign string) (string, error)

TODO: test

func EthSubmitHashrate

func EthSubmitHashrate(hashrate []string) (bool, error)

TODO: test

func EthSubmitWork

func EthSubmitWork(work []string) (bool, error)

TODO: test

func EthUninstallFilter

func EthUninstallFilter(filterID string) (bool, error)

TODO: test

func HexToData

func HexToData(b []byte) string

func HexToDataWithoutPrefix

func HexToDataWithoutPrefix(b []byte) string

func HexToPaddedData

func HexToPaddedData(b []byte) string

func HexToPaddedDataWithoutPrefix

func HexToPaddedDataWithoutPrefix(b []byte) string

func IntToData

func IntToData(i int64) string

func IntToQuantity

func IntToQuantity(i int64) string

func IntToQuantityWithoutPrefix

func IntToQuantityWithoutPrefix(i int64) string

func MapToObject

func MapToObject(source interface{}, dst interface{}) error

func MinerHashrate

func MinerHashrate() (interface{}, error)

TODO: finish

func MinerMakeDAG

func MinerMakeDAG(number int64) (interface{}, error)

TODO: finish

func MinerSetExtra

func MinerSetExtra(extra string) (interface{}, error)

TODO: finish

func MinerSetGasPrice

func MinerSetGasPrice(number int64) (interface{}, error)

TODO: finish

func MinerStart

func MinerStart(threads int64) (interface{}, error)

TODO: finish

func MinerStartAutoDAG

func MinerStartAutoDAG() (interface{}, error)

TODO: finish

func MinerStop

func MinerStop() (interface{}, error)

TODO: finish

func MinerStopAutoDAG

func MinerStopAutoDAG() (interface{}, error)

TODO: finish

func NetListening

func NetListening() (bool, error)

func NetVersion

func NetVersion() (string, error)

func ParseQuantity

func ParseQuantity(q string) (int64, error)

func PersonalImportRawKey

func PersonalImportRawKey(keyData, passphrase string) (interface{}, error)

TODO: finish

func PersonalListAccounts

func PersonalListAccounts() (interface{}, error)

TODO: finish

func PersonalLockAccount

func PersonalLockAccount(address string) (interface{}, error)

TODO: finish

func PersonalNewAccount

func PersonalNewAccount(passphrase string) (interface{}, error)

TODO: finish

func PersonalSendTransaction

func PersonalSendTransaction(tx *TransactionObject, passphrase string) (string, error)

TODO: finish

func PersonalUnlockAccount

func PersonalUnlockAccount(address, passphrase string, duration int64) (interface{}, error)

TODO: finish

func QuantityToInt

func QuantityToInt(q string) (int64, error)

func SSHAddToGroup

func SSHAddToGroup(identityAddress string) (interface{}, error)

TODO: test

func SSHHasIdentity

func SSHHasIdentity(identityAddress string) (bool, error)

TODO: test

func SSHNewFilter

func SSHNewFilter(filter *FilterOptions) (int64, error)

TODO: test

func SSHNewGroup

func SSHNewGroup() (string, error)

TODO: test

func SSHNewIdentity

func SSHNewIdentity() (string, error)

TODO: test

func SSHPost

func SSHPost(whisper *WhisperMessage) (bool, error)

TODO: test

func SSHUninstallFilter

func SSHUninstallFilter(filterID string) (bool, error)

TODO: test

func SSHVersion

func SSHVersion() (string, error)

TODO: test

func SetServer

func SetServer(newServer string)

func StringToData

func StringToData(str string) string

func StringToDataWithoutPrefix

func StringToDataWithoutPrefix(str string) string

func StringToMethodID

func StringToMethodID(method string) string

func TxPoolContent

func TxPoolContent() (interface{}, error)

TODO: finish

func TxPoolInspect

func TxPoolInspect() (interface{}, error)

TODO: finish

func TxPoolStatus

func TxPoolStatus() (interface{}, error)

TODO: finish

func Web3ClientVersion

func Web3ClientVersion() (string, error)

func Web3Sha3

func Web3Sha3(data string) (string, error)

Types

type BlockObject

type BlockObject struct {
	Number           string `json:"number"`
	Hash             string `json:"hash"`
	ParentHash       string `json:"parentHash"`
	Nonce            string `json:"nonce"`
	Sha3Uncles       string `json:"sha3Uncles"`
	LogsBloom        string `json:"logsBloom"`
	TransactionsRoot string `json:"transactionsRoot"`
	StateRoot        string `json:"stateRoot"`
	Miner            string `json:"miner"`
	Difficulty       string `json:"difficulty"`
	TotalDifficulty  string `json:"totalDifficulty"`
	ExtraData        string `json:"extraData"`
	Size             string `json:"size"`
	GasLimit         string `json:"gasLimit"`
	GasUsed          string `json:"gasUsed"`
	Timestamp        string `json:"timestamp"`
	//TODO: handle both full transactions and the hashes
	Transactions []interface{} `json:"transactions"`
	Uncles       []string      `json:"uncles"`
}

func EthGetBlockByHash

func EthGetBlockByHash(blockHash string, fullTransaction bool) (*BlockObject, error)

TODO: test

func EthGetBlockByNumber

func EthGetBlockByNumber(blockNumberOrTag string, fullTransaction bool) (*BlockObject, error)

TODO: test

func EthGetUncleByBlockHashAndIndex

func EthGetUncleByBlockHashAndIndex(blockHash, uncleIndex string) (*BlockObject, error)

TODO: test

func EthGetUncleByBlockNumberAndIndex

func EthGetUncleByBlockNumberAndIndex(blockNumberOrTag string, uncleIndex string) (*BlockObject, error)

TODO: test

func (*BlockObject) JSONBuffer

func (e *BlockObject) JSONBuffer(b *bytes.Buffer) error

func (*BlockObject) JSONByte

func (e *BlockObject) JSONByte() ([]byte, error)

func (*BlockObject) JSONString

func (e *BlockObject) JSONString() (string, error)

func (*BlockObject) String

func (e *BlockObject) String() string

type EthSyncingResponse

type EthSyncingResponse struct {
	Syncing       bool   `json:"syncing,omitempty"`
	StartingBlock string `json:"startingBlock,omitempty"`
	CurrentBlock  string `json:"currentBlock,omitempty"`
	HighestBlock  string `json:"highestBlock,omitempty"`
}

func EthSyncing

func EthSyncing() (*EthSyncingResponse, error)

func (*EthSyncingResponse) JSONBuffer

func (e *EthSyncingResponse) JSONBuffer(b *bytes.Buffer) error

func (*EthSyncingResponse) JSONByte

func (e *EthSyncingResponse) JSONByte() ([]byte, error)

func (*EthSyncingResponse) JSONString

func (e *EthSyncingResponse) JSONString() (string, error)

func (*EthSyncingResponse) String

func (e *EthSyncingResponse) String() string

type EtherscanResponse

type EtherscanResponse struct {
	Status  string      `json:"status"`
	Message string      `json:"message"`
	Result  interface{} `json:"result"`
}

type EtherscanTransaction

type EtherscanTransaction struct {
	BlockNumber       string `json:"blockNumber"`
	TimeStamp         string `json:"timeStamp"`
	Hash              string `json:"hash"`
	Nonce             string `json:"nonce"`
	BlockHash         string `json:"blockHash"`
	TransactionIndex  string `json:"transactionIndex"`
	From              string `json:"from"`
	To                string `json:"to"`
	Value             string `json:"value"`
	Gas               string `json:"gas"`
	GasPrice          string `json:"gasPrice"`
	IsError           string `json:"isError"`
	Input             string `json:"input"`
	ContractAddress   string `json:"contractAddress"`
	CumulativeGasUsed string `json:"cumulativeGasUsed"`
	GasUsed           string `json:"gasUsed"`
	Confirmations     string `json:"confirmations"`
}

func EtherscanTxList

func EtherscanTxList(address string) ([]*EtherscanTransaction, error)

func EtherscanTxListWithStartBlock

func EtherscanTxListWithStartBlock(address string, startBlock int64) ([]*EtherscanTransaction, error)

func (*EtherscanTransaction) JSONBuffer

func (e *EtherscanTransaction) JSONBuffer(b *bytes.Buffer) error

func (*EtherscanTransaction) JSONByte

func (e *EtherscanTransaction) JSONByte() ([]byte, error)

func (*EtherscanTransaction) JSONString

func (e *EtherscanTransaction) JSONString() (string, error)

func (*EtherscanTransaction) String

func (e *EtherscanTransaction) String() string

type FilterOptions

type FilterOptions struct {
	FromBlock string   `json:"fromBlock,omitempty"`
	ToBlock   string   `json:"toBlock,omitempty"`
	Address   string   `json:"address,omitempty"`
	Topics    []string `json:"topics,omitempty"`
}

func (*FilterOptions) JSONBuffer

func (e *FilterOptions) JSONBuffer(b *bytes.Buffer) error

func (*FilterOptions) JSONByte

func (e *FilterOptions) JSONByte() ([]byte, error)

func (*FilterOptions) JSONString

func (e *FilterOptions) JSONString() (string, error)

func (*FilterOptions) String

func (e *FilterOptions) String() string

type JSON2Request

type JSON2Request struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      interface{} `json:"id"`
	Params  interface{} `json:"params,omitempty"`
	Method  string      `json:"method,omitempty"`
}

func NewJSON2Request

func NewJSON2Request(id, params interface{}, method string) *JSON2Request

func NewJSON2RequestBlank

func NewJSON2RequestBlank() *JSON2Request

func ParseJSON2Request

func ParseJSON2Request(request string) (*JSON2Request, error)

func (*JSON2Request) JSONBuffer

func (e *JSON2Request) JSONBuffer(b *bytes.Buffer) error

func (*JSON2Request) JSONByte

func (e *JSON2Request) JSONByte() ([]byte, error)

func (*JSON2Request) JSONString

func (e *JSON2Request) JSONString() (string, error)

func (*JSON2Request) String

func (e *JSON2Request) String() string

type JSON2Response

type JSON2Response struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      interface{} `json:"id"`
	Error   *JSONError  `json:"error,omitempty"`
	Result  interface{} `json:"result,omitempty"`
}

func Call

func Call(method string, params interface{}) (*JSON2Response, error)

func NewJSON2Response

func NewJSON2Response() *JSON2Response

func (*JSON2Response) AddError

func (j *JSON2Response) AddError(code int, message string, data interface{})

func (*JSON2Response) JSONBuffer

func (e *JSON2Response) JSONBuffer(b *bytes.Buffer) error

func (*JSON2Response) JSONByte

func (e *JSON2Response) JSONByte() ([]byte, error)

func (*JSON2Response) JSONString

func (e *JSON2Response) JSONString() (string, error)

func (*JSON2Response) String

func (e *JSON2Response) String() string

type JSONError

type JSONError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

func NewJSONError

func NewJSONError(code int, message string, data interface{}) *JSONError

type LogObject

type LogObject struct {
	Type string `json:"type"`

	TransactionIndex string   `json:"transactionIndex"`
	TransactionHash  string   `json:"transactionHash"`
	BlockHash        string   `json:"blockHash"`
	BlockNumber      string   `json:"blockNumber"`
	Address          string   `json:"address"`
	Data             string   `json:"data"`
	Topics           []string `json:"topics"`
	// contains filtered or unexported fields
}

func EthGetFilterChanges

func EthGetFilterChanges(filterID string) (*LogObject, error)

TODO: test

func EthGetFilterLogs

func EthGetFilterLogs(filterID string) (*LogObject, error)

TODO: test

func EthGetLogs

func EthGetLogs(filter []*FilterOptions) (*LogObject, error)

TODO: test

func (*LogObject) JSONBuffer

func (e *LogObject) JSONBuffer(b *bytes.Buffer) error

func (*LogObject) JSONByte

func (e *LogObject) JSONByte() ([]byte, error)

func (*LogObject) JSONString

func (e *LogObject) JSONString() (string, error)

func (*LogObject) String

func (e *LogObject) String() string

type Message

type Message struct {
	Hash       string   `json:"hash"`
	From       string   `json:"from"`
	To         string   `json:"to"`
	Expiry     string   `json:"expiry"`
	TTL        string   `json:"ttl"`
	Sent       string   `json:"sent"`
	Topics     []string `json:"topics"`
	Payload    string   `json:"payload"`
	WorkProved string   `json:"workProved"`
}

func SSHGetFilterChanges

func SSHGetFilterChanges(filterID string) ([]*Message, error)

TODO: test

func SSHGetMessages

func SSHGetMessages(filterID string) ([]*Message, error)

TODO: test

func (*Message) JSONBuffer

func (e *Message) JSONBuffer(b *bytes.Buffer) error

func (*Message) JSONByte

func (e *Message) JSONByte() ([]byte, error)

func (*Message) JSONString

func (e *Message) JSONString() (string, error)

func (*Message) String

func (e *Message) String() string

type Quantity

type Quantity int64

func NetPeerCount

func NetPeerCount() (*Quantity, error)

func NewQuantityFromInt

func NewQuantityFromInt(i int64) *Quantity

func NewQuantityFromString

func NewQuantityFromString(s string) *Quantity

func (*Quantity) Int64

func (q *Quantity) Int64() int64

func (*Quantity) JSONBuffer

func (e *Quantity) JSONBuffer(b *bytes.Buffer) error

func (*Quantity) JSONByte

func (e *Quantity) JSONByte() ([]byte, error)

func (*Quantity) JSONString

func (e *Quantity) JSONString() (string, error)

func (*Quantity) MarshalText

func (q *Quantity) MarshalText() (text []byte, err error)

func (*Quantity) String

func (e *Quantity) String() string

func (*Quantity) UnmarshalText

func (q *Quantity) UnmarshalText(text []byte) error

type TransactionObject

type TransactionObject struct {
	Hash             string `json:"hash,omitempty"`
	Nonce            string `json:"nonce,omitempty"`
	BlockHash        string `json:"blockHash,omitempty"`
	BlockNumber      string `json:"blockNumber,omitempty"`
	TransactionIndex string `json:"transactionIndex,omitempty"`

	From     string `json:"from"`
	To       string `json:"to,omitempty"`
	Gas      string `json:"gas,omitempty"`
	GasPrice string `json:"gasPrice,omitempty"`
	Value    string `json:"value,omitempty"`
	Data     string `json:"data,omitempty"`
	Input    string `json:"input,omitempty"`
}

func EthGetTransactionByBlockHashAndIndex

func EthGetTransactionByBlockHashAndIndex(blockHash, txIndex string) (*TransactionObject, error)

TODO: test

func EthGetTransactionByBlockNumberAndIndex

func EthGetTransactionByBlockNumberAndIndex(blockNumberOrTag string, txIndex string) (*TransactionObject, error)

TODO: test

func EthGetTransactionByHash

func EthGetTransactionByHash(txHash string) (*TransactionObject, error)

TODO: test

func (*TransactionObject) JSONBuffer

func (e *TransactionObject) JSONBuffer(b *bytes.Buffer) error

func (*TransactionObject) JSONByte

func (e *TransactionObject) JSONByte() ([]byte, error)

func (*TransactionObject) JSONString

func (e *TransactionObject) JSONString() (string, error)

func (*TransactionObject) String

func (e *TransactionObject) String() string

type TransactionReceipt

type TransactionReceipt struct {
	TransactionHash   string        `json:"transactionHash"`
	TransactionIndex  string        `json:"transactionIndex"`
	BlockHash         string        `json:"blockHash"`
	BlockNumber       string        `json:"blockNumber"`
	CumulativeGasUsed string        `json:"cumulativeGasUsed"`
	GasUsed           string        `json:"gasUsed"`
	ContractAddress   string        `json:"contractAddress"`
	Logs              []interface{} `json:"logs"`
}

func EthGetTransactionReceipt

func EthGetTransactionReceipt(txHash string) (*TransactionReceipt, error)

TODO: test

func (*TransactionReceipt) JSONBuffer

func (e *TransactionReceipt) JSONBuffer(b *bytes.Buffer) error

func (*TransactionReceipt) JSONByte

func (e *TransactionReceipt) JSONByte() ([]byte, error)

func (*TransactionReceipt) JSONString

func (e *TransactionReceipt) JSONString() (string, error)

func (*TransactionReceipt) String

func (e *TransactionReceipt) String() string

type WhisperMessage

type WhisperMessage struct {
	From     string `json:"from,omitempty"`
	To       string `json:"to,omitempty"`
	Topics   string `json:"topics"`
	Payload  string `json:"payload"`
	Priority string `json:"priority"`
	TTL      string `json:"ttl"`
}

func (*WhisperMessage) JSONBuffer

func (e *WhisperMessage) JSONBuffer(b *bytes.Buffer) error

func (*WhisperMessage) JSONByte

func (e *WhisperMessage) JSONByte() ([]byte, error)

func (*WhisperMessage) JSONString

func (e *WhisperMessage) JSONString() (string, error)

func (*WhisperMessage) String

func (e *WhisperMessage) String() string

Jump to

Keyboard shortcuts

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