ethrpc

package
v0.0.0-...-bb1a4e7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigToHex

func BigToHex(bigInt big.Int) string

BigToHex covert big.Int to hexadecimal representation

func Eth1

func Eth1() *big.Int

Eth1 returns 1 ethereum value (10^18 wei)

func Eth1Int64

func Eth1Int64() int64

Eth1 returns 1 ethereum value (10^18 wei)

func HexToBigInt

func HexToBigInt(hex string) *big.Int

func Int64ToHex

func Int64ToHex(i int64) string

Int64ToHex convert int64 to hexadecimal representation

func IntToHex

func IntToHex(i int) string

IntToHex convert int to hexadecimal representation

func LocalSigning

func LocalSigning(addrHex string, privHex string, plainMessage string) ([]byte, error)

func ParseBigInt

func ParseBigInt(value string) (*big.Int, string, error)

ParseBigInt parse hex string value to big.Int

func ParseHexToInt

func ParseHexToInt(value string) (int64, error)

ParseBigInt parse hex string value to big.Int

func ParseInt

func ParseInt(value string) (int64, error)

ParseInt parse hex string value to int

func ResolveNetworkId

func ResolveNetworkId(id string) string

func ResolveNetworkId2

func ResolveNetworkId2(id string) string

@deprecated

func TextAndHash

func TextAndHash(data []byte) ([]byte, string)

TextAndHash is a helper function that calculates a hash for the given message that can be safely used to calculate a signature from.

The hash is calulcated as

keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).

This gives context to the signed message and prevents signing of transactions.

Types

type Block

type Block struct {
	Number           int
	Hash             string
	ParentHash       string
	Nonce            string
	Sha3Uncles       string
	LogsBloom        string
	TransactionsRoot string
	StateRoot        string
	Miner            string
	Difficulty       big.Int
	TotalDifficulty  big.Int
	ExtraData        string
	Size             int
	GasLimit         int
	GasUsed          int
	Timestamp        int
	Uncles           []string
	Transactions     []Transaction
}

Block - block object

type ConnectionMode

type ConnectionMode uint8
const (
	HttpMode ConnectionMode = iota
	UnixMode
)

type EthRPC

type EthRPC struct {

	// debug flag
	Debug bool
	// contains filtered or unexported fields
}

EthRPC - Ethereum rpc client

func NewDefaultRPC

func NewDefaultRPC(url string, debug bool, client *client.EthClient) EthRPC

New create new rpc client with given url

func NewDefaultRPCPtr

func NewDefaultRPCPtr(url string, debug bool, client *client.EthClient) *EthRPC

New create new rpc client with given url

func (*EthRPC) ChainId

func (rpc *EthRPC) ChainId() (string, error)

Chain id returns target network chain id

func (*EthRPC) ContractCall

func (rpc *EthRPC) ContractCall(contract string, methodName string, params string, block string, gas string, gasprice string) (string, error)

post ethereum network contract with no parameters

func (*EthRPC) DbGetHex

func (rpc *EthRPC) DbGetHex(dbname string, key string) (string, error)

db_getHex Returns binary data from the local database. Note this function is deprecated and will be removed in the future. Parameters

String - Database name.
String - Key name.

Example Parameters

params: [

"testDB",
"myKey",

]

Returns

DATA - The previously stored data.

func (*EthRPC) DbGetString

func (rpc *EthRPC) DbGetString(dbname string, key string) (string, error)

db_getString Returns string from the local database. Note this function is deprecated and will be removed in the future. Parameters String - Database name. String - Key name. Example Parameters

params: [

"testDB",
"myKey",

] Returns

String - The previously stored string.

func (*EthRPC) DbPutHex

func (rpc *EthRPC) DbPutHex(dbname string, key string, value string) (bool, error)

db_putHex Stores binary data in the local database. Note this function is deprecated and will be removed in the future. Parameters

String - Database name.
String - Key name.
DATA - The data to store.

Example Parameters

params: [

"testDB",
"myKey",
"0x68656c6c6f20776f726c64"

]

Returns

Boolean - returns true if the value was stored, otherwise false.

func (*EthRPC) DbPutString

func (rpc *EthRPC) DbPutString(dbname string, key string, value string) (bool, error)

db_putString Stores a string in the local database. Note this function is deprecated and will be removed in the future. Parameters

String - Database name.
String - Key name.
String - String to store.

Example Parameters

params: [

"testDB",
"myKey",
"myString"

]

Returns

Boolean - returns true if the value was stored, otherwise false.

func (*EthRPC) DeployContract

func (rpc *EthRPC) DeployContract(fromAddress string, bytecode string, gas string, gasPrice string) (json.RawMessage, error)

curl localhost:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from": "0x8aff0a12f3e8d55cc718d36f84e002c335df2f4a", "data": "606060405260728060106000396000f360606040526000357c0100000000000000000000000000000000000000000000000000000000900480636ffa1caa146037576035565b005b604b60048080359060200190919050506061565b6040518082815260200191505060405180910390f35b6000816002029050606d565b91905056"}],"id":1}

func (*EthRPC) Erc20Allowance

func (rpc *EthRPC) Erc20Allowance(contract string, tokenOwner string, spender string) (json.RawMessage, error)

func (*EthRPC) Erc20BalanceOf

func (rpc *EthRPC) Erc20BalanceOf(contract string, tokenOwner string) (json.RawMessage, error)

func (*EthRPC) Erc20Decimals

func (rpc *EthRPC) Erc20Decimals(contract string) (string, error)

func (*EthRPC) Erc20Name

func (rpc *EthRPC) Erc20Name(contract string) (string, error)

func (*EthRPC) Erc20Summary

func (rpc *EthRPC) Erc20Summary(contract string) (map[string]string, error)

func (*EthRPC) Erc20Symbol

func (rpc *EthRPC) Erc20Symbol(contract string) (string, error)

func (*EthRPC) Erc20TotalSupply

func (rpc *EthRPC) Erc20TotalSupply(contract string) (string, error)

func (*EthRPC) Erc20Transfer

func (rpc *EthRPC) Erc20Transfer(contract string, address string, amount int) (json.RawMessage, error)

func (*EthRPC) EthAccounts

func (rpc *EthRPC) EthAccounts() ([]string, error)

EthAccounts returns a list of addresses owned by client.

func (*EthRPC) EthBlockNumber

func (rpc *EthRPC) EthBlockNumber() (int64, error)

EthBlockNumber returns the number of most recent block.

func (*EthRPC) EthCall

func (rpc *EthRPC) EthCall(transaction TransactionData, tag string) (string, error)

EthCall executes a new message post immediately without creating a transaction on the block chain.

func (*EthRPC) EthCoinbase

func (rpc *EthRPC) EthCoinbase() (string, error)

EthCoinbase returns the client coinbase address

func (*EthRPC) EthCompileLLL

func (rpc *EthRPC) EthCompileLLL(code string) ([]string, error)

eth_compileLLL @deprecated Returns compiled LLL code.

DATA - The compiled source code.

func (*EthRPC) EthCompileSerpent

func (rpc *EthRPC) EthCompileSerpent(code string) ([]string, error)

eth_compileSerpent @deprecated Returns compiled Serpent code.

DATA - The compiled source code.

func (*EthRPC) EthCompileSolidity

func (rpc *EthRPC) EthCompileSolidity(code string) ([]string, error)

eth_compileSolidity @deprecated Returns compiled solidity code.

DATA - The compiled source code.

func (*EthRPC) EthEstimateGas

func (rpc *EthRPC) EthEstimateGas(transaction TransactionData) (int64, error)

EthEstimateGas makes a post or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas.

func (*EthRPC) EthGasPrice

func (rpc *EthRPC) EthGasPrice() (int64, error)

EthGasPrice returns the current price per gas in wei.

func (*EthRPC) EthGetBalance

func (rpc *EthRPC) EthGetBalance(address string, block string) (*big.Int, string, error)

EthGetBalance returns the balance of the account of given address in wei.

func (*EthRPC) EthGetBlockByHash

func (rpc *EthRPC) EthGetBlockByHash(hash string, withTransactions bool) (*Block, error)

EthGetBlockByHash returns information about a block by hash.

func (*EthRPC) EthGetBlockByNumber

func (rpc *EthRPC) EthGetBlockByNumber(number int, withTransactions bool) (*Block, error)

EthGetBlockByNumber returns information about a block by block number.

func (*EthRPC) EthGetBlockTransactionCountByHash

func (rpc *EthRPC) EthGetBlockTransactionCountByHash(hash string) (int64, error)

EthGetBlockTransactionCountByHash returns the number of transactions in a block from a block matching the given block hash.

func (*EthRPC) EthGetBlockTransactionCountByNumber

func (rpc *EthRPC) EthGetBlockTransactionCountByNumber(blockNumber string) (int64, error)

EthGetBlockTransactionCountByNumber returns the number of transactions in a block from a block matching the given block

func (*EthRPC) EthGetCode

func (rpc *EthRPC) EthGetCode(address string, block string) (string, error)

EthGetCode returns code at a given address.

func (*EthRPC) EthGetCompilers

func (rpc *EthRPC) EthGetCompilers() ([]string, error)

EthGetCompilers returns a list of available compilers in the client. @deprecated returns Array - Array of available compilers.

func (*EthRPC) EthGetFilterChanges

func (rpc *EthRPC) EthGetFilterChanges(filterID string) ([]Log, error)

EthGetFilterChanges polling method for a filter, which returns an array of logs which occurred since last poll.

func (*EthRPC) EthGetFilterLogs

func (rpc *EthRPC) EthGetFilterLogs(filterID string) ([]Log, error)

EthGetFilterLogs returns an array of all logs matching filter with given id.

func (*EthRPC) EthGetLogs

func (rpc *EthRPC) EthGetLogs(filter FilterParams) ([]Log, error)

EthGetLogs returns an array of all logs matching a given filter object.

func (*EthRPC) EthGetPendingTransactions

func (rpc *EthRPC) EthGetPendingTransactions(hash string) (*TransactionReceipt, error)

TODO implement EthGetPendingTransactions returns the list of pending transactions

func (*EthRPC) EthGetProof

func (rpc *EthRPC) EthGetProof(address string, keys []string, blocktime string) (bool, error)

Returns Object - A account object: balance: QUANTITY - the balance of the account. See eth_getBalance codeHash: DATA, 32 Bytes - hash of the code of the account. For a simple Account without code it will return "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" nonce: QUANTITY, - nonce of the account. See eth_getTransactionCount storageHash: DATA, 32 Bytes - SHA3 of the StorageRoot. All storage will deliver a MerkleProof starting with this rootHash. accountProof: ARRAY - Array of rlp-serialized MerkleTree-Nodes, starting with the stateRoot-Node, following the path of the SHA3 (address) as key. storageProof: ARRAY - Array of storage-entries as requested. Each entry is a object with these properties: key: QUANTITY - the requested storage key value: QUANTITY - the storage value proof: ARRAY - Array of rlp-serialized MerkleTree-Nodes, starting with the storageHash-Node, following the path of the SHA3 (key) as path.

func (*EthRPC) EthGetStorageAt

func (rpc *EthRPC) EthGetStorageAt(data string, key string, block string) (string, error)

EthGetStorageAt returns the value from a storage position at a given address.

func (*EthRPC) EthGetTransactionByBlockHashAndIndex

func (rpc *EthRPC) EthGetTransactionByBlockHashAndIndex(blockHash string, transactionIndex int) (*Transaction, error)

EthGetTransactionByBlockHashAndIndex returns information about a transaction by block hash and transaction index position.

func (*EthRPC) EthGetTransactionByBlockNumberAndIndex

func (rpc *EthRPC) EthGetTransactionByBlockNumberAndIndex(blockNumber, transactionIndex int) (*Transaction, error)

EthGetTransactionByBlockNumberAndIndex returns information about a transaction by block number and transaction index position.

func (*EthRPC) EthGetTransactionByHash

func (rpc *EthRPC) EthGetTransactionByHash(hash string) (*Transaction, error)

EthGetTransactionByHash returns the information about a transaction requested by transaction hash.

func (*EthRPC) EthGetTransactionCount

func (rpc *EthRPC) EthGetTransactionCount(address string, block string) (int64, error)

EthGetTransactionCount returns the number of transactions sent from an address.

func (*EthRPC) EthGetTransactionReceipt

func (rpc *EthRPC) EthGetTransactionReceipt(hash string) (*TransactionReceipt, error)

EthGetTransactionReceipt returns the receipt of a transaction by transaction hash. Note That the receipt is not available for pending transactions.

func (*EthRPC) EthGetUncleByBlockHashAndIndex

func (rpc *EthRPC) EthGetUncleByBlockHashAndIndex(hash string, uncleIndex int) (*TransactionReceipt, error)

eth_getUncleByBlockHashAndIndex Returns information about a uncle of a block by hash and uncle index position. params: [

'0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b',
'0x0' // 0

] Note: An uncle doesn't contain individual transactions.

func (*EthRPC) EthGetUncleByBlockNumberAndIndex

func (rpc *EthRPC) EthGetUncleByBlockNumberAndIndex(blockNumber string, uncleIndex int) (*TransactionReceipt, error)

eth_getUncleByBlockNumberAndIndex Returns information about a uncle of a block by number and uncle index position. params: [

'0x29c', // 668
'0x0' // 0

] Note: An uncle doesn't contain individual transactions.

func (*EthRPC) EthGetUncleCountByBlockHash

func (rpc *EthRPC) EthGetUncleCountByBlockHash(hash string) (int64, error)

EthGetUncleCountByBlockHash returns the number of uncles in a block from a block matching the given block hash.

func (*EthRPC) EthGetUncleCountByBlockNumber

func (rpc *EthRPC) EthGetUncleCountByBlockNumber(number int) (int64, error)

EthGetUncleCountByBlockNumber returns the number of uncles in a block from a block matching the given block number.

func (*EthRPC) EthGetWork

func (rpc *EthRPC) EthGetWork() ([]string, error)

eth_getWork Returns the hash of the current block, the seedHash, and the boundary condition to be met ("target"). EthGetWork returns an array of all logs matching a given filter object. Returns Array - Array with the following properties: DATA, 32 Bytes - current block header pow-hash DATA, 32 Bytes - the seed hash used for the DAG. DATA, 32 Bytes - the boundary condition ("target"), 2^256 / difficulty.

func (*EthRPC) EthHashRate

func (rpc *EthRPC) EthHashRate() (int64, error)

EthHashRate returns the number of hashes per second that the node is mining with.

func (*EthRPC) EthMethodNoParams

func (rpc *EthRPC) EthMethodNoParams(methodName string) (interface{}, error)

func (*EthRPC) EthMining

func (rpc *EthRPC) EthMining() (bool, error)

EthMining returns true if client is actively mining new blocks.

func (*EthRPC) EthNetVersion

func (rpc *EthRPC) EthNetVersion() (string, error)

returns ethereum node information

func (*EthRPC) EthNewBlockFilter

func (rpc *EthRPC) EthNewBlockFilter() (string, error)

EthNewBlockFilter creates a filter in the node, to notify when a new block arrives. To check if the state has changed, post EthGetFilterChanges.

func (*EthRPC) EthNewFilter

func (rpc *EthRPC) EthNewFilter(filter FilterParams) (string, error)

EthNewFilter creates a new filter object.

func (*EthRPC) EthNewPendingTransactionFilter

func (rpc *EthRPC) EthNewPendingTransactionFilter() (string, error)

EthNewPendingTransactionFilter creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, post EthGetFilterChanges.

func (*EthRPC) EthNodeInfo

func (rpc *EthRPC) EthNodeInfo() (string, error)

returns ethereum node information

func (*EthRPC) EthProtocolVersion

func (rpc *EthRPC) EthProtocolVersion() (string, error)

EthProtocolVersion returns the current ethereum protocol version.

func (*EthRPC) EthSendRawTransaction

func (rpc *EthRPC) EthSendRawTransaction(data string) (string, error)

EthSendRawTransaction creates new message post transaction or a contract creation for signed transactions.

func (*EthRPC) EthSendTransaction

func (rpc *EthRPC) EthSendTransaction(transaction TransactionData) (string, error)

EthSendTransaction creates new message post transaction or a contract creation, if the data field contains code.

func (*EthRPC) EthSendTransactionPtr

func (rpc *EthRPC) EthSendTransactionPtr(transaction *TransactionData) (string, error)

EthSendTransaction creates new message post transaction or a contract creation, if the data field contains code.

func (*EthRPC) EthSign

func (rpc *EthRPC) EthSign(address, data string) (string, error)

EthSign signs data with a given address. Calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))

func (*EthRPC) EthSubmitHashrate

func (rpc *EthRPC) EthSubmitHashrate(hashrate string, clientid string) (bool, error)

eth_submitHashrate Used for submitting mining hashrate. Parameters

Hashrate, a hexadecimal string representation (32 bytes) of the hash rate
ID, String - A random hexadecimal(32 bytes) ID identifying the client

params: [

"0x0000000000000000000000000000000000000000000000000000000000500000",
"0x59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c"

] returns Boolean - returns true if submitting went through succesfully and false otherwise.

func (*EthRPC) EthSubmitWork

func (rpc *EthRPC) EthSubmitWork(nonce, header, digest string) (bool, error)

eth_submitWork EthSubmitWork Used for submitting a proof-of-work solution. DATA, 8 Bytes - The nonce found (64 bits) DATA, 32 Bytes - The header's pow-hash (256 bits) DATA, 32 Bytes - The mix digest (256 bits) params: [

"0x0000000000000001",
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000"

] Boolean - returns true if the provided solution is valid, otherwise false.

func (*EthRPC) EthSyncing

func (rpc *EthRPC) EthSyncing() (*Syncing, error)

EthSyncing returns an object with data about the sync status or false.

func (*EthRPC) EthUninstallFilter

func (rpc *EthRPC) EthUninstallFilter(filterID string) (bool, error)

EthUninstallFilter uninstalls a filter with given id.

func (*EthRPC) GraphQL

func (rpc *EthRPC) GraphQL(graphQLendpointURI string, qlQuery []byte) ([]byte, stack.Error)

method that calls graph ql api of ethereum nodes (supported on geth +1.9.0)

func (*EthRPC) IsGanache

func (rpc *EthRPC) IsGanache() (bool, error)

func (*EthRPC) IsSmartContractAddress

func (rpc *EthRPC) IsSmartContractAddress(addr string) (bool, error)

func (*EthRPC) NetListening

func (rpc *EthRPC) NetListening() (bool, error)

NetListening returns true if client is actively listening for network connections.

func (*EthRPC) NetPeerCount

func (rpc *EthRPC) NetPeerCount() (int, error)

NetPeerCount returns number of peers currently connected to the client.

func (*EthRPC) NetVersion

func (rpc *EthRPC) NetVersion() (string, error)

NetVersion returns the current network protocol version.

func (*EthRPC) NetworkId

func (rpc *EthRPC) NetworkId() (*big.Int, error)

NetworkID returns the network ID (also known as the chain ID) for this chain.

func (*EthRPC) PendingNonceAt

func (rpc *EthRPC) PendingNonceAt(address string) (uint64, error)

PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.

func (*EthRPC) Proxy

func (rpc *EthRPC) Proxy(requestContent []byte) ([]byte, stack.Error)

func (*EthRPC) RawCall

func (rpc *EthRPC) RawCall(method string, params string) (json.RawMessage, error)

RawCall returns raw response of method post (Deprecated)

func (*EthRPC) ShhAddToGroup

func (rpc *EthRPC) ShhAddToGroup(identityKey string) (bool, error)

shh_addToGroup Adds a whisper identity to the group. Parameters

DATA, 60 Bytes - The identity address to add to a group.

Example Parameters params: [ "0x04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a03e245533f97284d442460f2998cd41858798ddfd4d661997d3940272b717b1" ] Returns

Boolean - returns true if the identity was successfully added to the group, otherwise false.

func (*EthRPC) ShhGetFilterChanges

func (rpc *EthRPC) ShhGetFilterChanges() (string, error)

shh_getFilterChanges Polling method for whisper filters. Returns new messages since the last call of this method. Note calling the shh_getMessages method, will reset the buffer for this method, so that you won't receive duplicate messages. Parameters

QUANTITY - The filter id.

Example Parameters params: [ "0x7" // 7 ] Returns Array - Array of messages received since last poll:

hash: DATA, 32 Bytes (?) - The hash of the message.
from: DATA, 60 Bytes - The sender of the message, if a sender was specified.
to: DATA, 60 Bytes - The receiver of the message, if a receiver was specified.
expiry: QUANTITY - Integer of the time in seconds when this message should expire (?).
ttl: QUANTITY - Integer of the time the message should float in the system in seconds (?).
sent: QUANTITY - Integer of the unix timestamp when the message was sent.
topics: Array of DATA - Array of DATA topics the message contained.
payload: DATA - The payload of the message.
workProved: QUANTITY - Integer of the work this message required before it was send (?).

func (*EthRPC) ShhNewFilter

func (rpc *EthRPC) ShhNewFilter() (string, error)

shh_newFilter Creates filter to notify, when client receives whisper message matching the filter options. Parameters

Object - The filter options:

to: DATA, 60 Bytes - (optional) Identity of the receiver. When present it will try to decrypt any incoming message if the client holds the private key to this identity.
topics: Array of DATA - Array of DATA topics which the incoming message's topics should match. You can use the following combinations:
    [A, B] = A && B
    [A, [B, C]] = A && (B || C)
    [null, A, B] = ANYTHING && A && B null works as a wildcard

Example Parameters

params: [{
   "topics": ['0x12341234bf4b564f'],
   "to": "0x04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a03e245533f97284d442460f2998cd41858798ddfd4d661997d3940272b717b1"
}]

Returns

QUANTITY - The newly created filter. TODO develop

func (*EthRPC) ShhNewGroup

func (rpc *EthRPC) ShhNewGroup() (string, error)

shh_newGroup Creates a new group. Parameters: none Returns

DATA, 60 Bytes - the address of the new group.

func (*EthRPC) ShhNewIdentity

func (rpc *EthRPC) ShhNewIdentity() (string, error)

shh_newIdentity Creates new whisper identity in the client. Parameters: none Returns

DATA, 60 Bytes - the address of the new identiy.

func (*EthRPC) ShhPost

func (rpc *EthRPC) ShhPost(data model.WhisperParams) (string, error)

shh_post Sends a whisper message. Parameters

Object - The whisper post object:

from: DATA, 60 Bytes - (optional) The identity of the sender.
to: DATA, 60 Bytes - (optional) The identity of the receiver. When present whisper will encrypt the message so that only the receiver can decrypt it.
topics: Array of DATA - Array of DATA topics, for the receiver to identify messages.
payload: DATA - The payload of the message.
priority: QUANTITY - The integer of the priority in a range from ... (?).
ttl: QUANTITY - integer of the time to live in seconds.

Example Parameters

params: [{
  from: "0x04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a03e245533f97284d442460f2998cd41858798ddfd4d661997d3940272b717b1",
  to: "0x3e245533f97284d442460f2998cd41858798ddf04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a0d4d661997d3940272b717b1",
  topics: ["0x776869737065722d636861742d636c69656e74", "0x4d5a695276454c39425154466b61693532"],
  payload: "0x7b2274797065223a226d6",
  priority: "0x64",
  ttl: "0x64",
}]

Returns

Boolean - returns true if the message was send, otherwise false. TODO develop this option

func (*EthRPC) ShhUninstallFilter

func (rpc *EthRPC) ShhUninstallFilter() (bool, error)

shh_uninstallFilter Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with shh_getFilterChanges for a period of time. Parameters

QUANTITY - The filter id.

Example Parameters params: [ "0x7" // 7 ] Returns Boolean - true if the filter was successfully uninstalled, otherwise false.

func (*EthRPC) ShhVersion

func (rpc *EthRPC) ShhVersion() (string, error)

shh_version Returns the current whisper protocol version. Parameters

none

Returns

String - The current whisper protocol version

func (*EthRPC) SshGetMessages

func (rpc *EthRPC) SshGetMessages(filterId string) ([]model.FilterChanges, error)

shh_getMessages Get all messages matching a filter. Unlike shh_getFilterChanges this returns all messages. Parameters

QUANTITY - The filter id.

params: [

"0x7" // 7

] Returns: see shh_getFilterChanges

func (*EthRPC) SshHasIdentity

func (rpc *EthRPC) SshHasIdentity(identityKey string) (bool, error)

shh_hasIdentity Checks if the client hold the private keys for a given identity. Parameters

DATA, 60 Bytes - The identity address to check.

Example Parameters params: [ "0x04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a03e245533f97284d442460f2998cd41858798ddfd4d661997d3940272b717b1" ] Returns Boolean - returns true if the client holds the privatekey for that identity, otherwise false.

func (*EthRPC) SuggestGasPrice

func (rpc *EthRPC) SuggestGasPrice() (*big.Int, error)

SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.

func (*EthRPC) URL

func (rpc *EthRPC) URL() string

URL returns client url

func (*EthRPC) Web3ClientVersion

func (rpc *EthRPC) Web3ClientVersion() (string, error)

Web3ClientVersion returns the current client version.

func (*EthRPC) Web3Sha3

func (rpc *EthRPC) Web3Sha3(data []byte) (string, error)

Web3Sha3 returns Keccak-256 (not the standardized SHA3-256) of the given data.

type FilterParams

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

FilterParams - Filter parameters object

func (FilterParams) String

func (params FilterParams) String() string

type Log

type Log struct {
	Removed          bool
	LogIndex         int
	TransactionIndex int
	TransactionHash  string
	BlockNumber      int
	BlockHash        string
	Address          string
	Data             string
	Topics           []string
}

Log - log object

func (*Log) UnmarshalJSON

func (log *Log) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type NodeSignRequest

type NodeSignRequest struct {
	Address string `json:"address"`
	Data    string `json:"data"`
}

Note the address to sign with must be unlocked.

type ParamsCallback

type ParamsCallback func() string

type Syncing

type Syncing struct {
	IsSyncing     bool
	StartingBlock int
	CurrentBlock  int
	HighestBlock  int
	PulledStates  int
	KnownStates   int
}

Syncing - object with syncing data info

func (*Syncing) UnmarshalJSON

func (s *Syncing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Transaction

type Transaction struct {
	Hash             string
	Nonce            int
	BlockHash        string
	BlockNumber      *int
	TransactionIndex *int
	From             string
	To               string
	Value            big.Int
	Gas              int
	GasPrice         big.Int
	Input            string
}

Transaction - transaction object

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type TransactionData

type TransactionData struct {
	From string `json:"from"`
	To   string `json:"to"`

	GasStr string `json:"gas"`

	GasPriceStr string `json:"price"`
	ValueStr    string `json:"value"`

	Data string `json:"data"`

	NonceStr string `json:"nonce"`
	// contains filtered or unexported fields
}

TransactionData - input transaction object

func (TransactionData) MarshalJSON

func (t TransactionData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Unmarshaler interface.

func (*TransactionData) SetValue

func (t *TransactionData) SetValue(wei *big.Int)

func (TransactionData) Value

func (t TransactionData) Value() *big.Int

type TransactionReceipt

type TransactionReceipt struct {
	TransactionHash   string
	TransactionIndex  int
	BlockHash         string
	BlockNumber       int
	CumulativeGasUsed int
	GasUsed           int
	ContractAddress   string
	Logs              []Log
	LogsBloom         string
	Root              string
	Status            string
}

TransactionReceipt - transaction receipt object

func (*TransactionReceipt) UnmarshalJSON

func (t *TransactionReceipt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Web3Resolver

type Web3Resolver func() (interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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