Documentation ¶
Index ¶
- type Contract
- func (contract *Contract) Call(transaction *dto.TransactionParameters, functionName string, ...) (*dto.RequestResult, error)
- func (contract *Contract) Deploy(transaction *dto.TransactionParameters, bytecode string, args ...interface{}) (string, error)
- func (contract *Contract) Send(transaction *dto.TransactionParameters, functionName string, ...) (string, error)
- type Eth
- func (eth *Eth) Call(transaction *dto.TransactionParameters) (*dto.RequestResult, error)
- func (eth *Eth) CompileSolidity(sourceCode string) (types.ComplexString, error)
- func (eth *Eth) Contract(jsonInterface string) (*Contract, error)
- func (eth *Eth) DoCall(msg *ethereum.CallMsg, blockNumber *big.Int) (*dto.RequestResult, error)
- func (eth *Eth) EstimateGas(transaction *dto.TransactionParameters) (*big.Int, error)
- func (eth *Eth) GetBalance(address string, defaultBlockParameter string) (*big.Int, error)
- func (eth *Eth) GetBlockByHash(hash string, transactionDetails bool) (*dto.Block, error)
- func (eth *Eth) GetBlockByNumber(number *big.Int, transactionDetails bool) (*dto.Block, error)
- func (eth *Eth) GetBlockNumber() (*big.Int, error)
- func (eth *Eth) GetBlockTransactionCountByHash(hash string) (*big.Int, error)
- func (eth *Eth) GetBlockTransactionCountByNumber(defaultBlockParameter string) (*big.Int, error)
- func (eth *Eth) GetCode(address string, defaultBlockParameter string) (string, error)
- func (eth *Eth) GetCoinbase() (string, error)
- func (eth *Eth) GetGasPrice() (*big.Int, error)
- func (eth *Eth) GetHashRate() (*big.Int, error)
- func (eth *Eth) GetProtocolVersion() (string, error)
- func (eth *Eth) GetStorageAt(address string, position *big.Int, defaultBlockParameter string) (string, error)
- func (eth *Eth) GetTransactionByBlockHashAndIndex(hash string, index *big.Int) (*dto.TransactionResponse, error)
- func (eth *Eth) GetTransactionByBlockNumberAndIndex(blockIndex *big.Int, index *big.Int) (*dto.TransactionResponse, error)
- func (eth *Eth) GetTransactionByHash(hash string) (*dto.TransactionResponse, error)
- func (eth *Eth) GetTransactionCount(address string, defaultBlockParameter string) (*big.Int, error)
- func (eth *Eth) GetTransactionReceipt(hash string) (*dto.TransactionReceipt, error)
- func (eth *Eth) GetUncleCountByBlockHash(hash string) (*big.Int, error)
- func (eth *Eth) GetUncleCountByBlockNumber(quantity *big.Int) (*big.Int, error)
- func (eth *Eth) IsMining() (bool, error)
- func (eth *Eth) IsSyncing() (*dto.SyncingResponse, error)
- func (eth *Eth) ListAccounts() ([]string, error)
- func (eth *Eth) NewContract(abi string) (*Contract, error)
- func (eth *Eth) SendRawTransaction(rawTx []byte) (string, error)
- func (eth *Eth) SendTransaction(transaction *dto.TransactionParameters) (string, error)
- func (eth *Eth) SignTransaction(transaction *dto.TransactionParameters) (*dto.SignTransactionResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
Contract ...
func (*Contract) Call ¶
func (contract *Contract) Call(transaction *dto.TransactionParameters, functionName string, args ...interface{}) (*dto.RequestResult, error)
type Eth ¶
type Eth struct {
// contains filtered or unexported fields
}
Eth - The Eth Module
func NewEth ¶
func NewEth(provider providers.ProviderInterface) *Eth
NewEth - Eth Module constructor to set the default provider
func (*Eth) Call ¶
func (eth *Eth) Call(transaction *dto.TransactionParameters) (*dto.RequestResult, error)
Call - Executes a new message call immediately without creating a transaction on the block chain. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call Parameters:
- Object - The transaction call object - from: DATA, 20 Bytes - The address the transaction is send from. - to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to. - gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas. - gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas - value: QUANTITY - (optional) Integer of the value send with this transaction - data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI (https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI)
- QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter: https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter
Returns:
- DATA - the return value of executed contract.
func (*Eth) CompileSolidity ¶
func (eth *Eth) CompileSolidity(sourceCode string) (types.ComplexString, error)
CompileSolidity - Returns compiled solidity code. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity Parameters:
- String - The source code.
Returns:
- DATA - The compiled source code.
func (*Eth) EstimateGas ¶
EstimateGas - Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas Parameters:
- See eth_call parameters, expect that all properties are optional. If no gas limit is specified geth uses the block gas limit from the pending block as an upper bound. As a result the returned estimate might not be enough to executed the call/transaction when the amount of gas is higher than the pending block gas limit.
Returns:
- QUANTITY - the amount of gas used.
func (*Eth) GetBalance ¶
GetBalance - Returns the balance of the account of given address. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance Parameters:
- DATA, 20 Bytes - address to check for balance.
- QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter: https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter
Returns:
- QUANTITY - integer of the current balance in wei.
func (*Eth) GetBlockByHash ¶
GetBlockByHash - Returns information about a block by hash. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash Parameters:
- DATA, 32 bytes - Hash of a block
- transactionDetails, bool - indicate if we should have or not the details of the transactions of the block
Returns:
- Object - A block object, or null when no transaction was found
- error
func (*Eth) GetBlockByNumber ¶
GetBlockByNumber - Returns the information about a block requested by number. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber Parameters:
- number, QUANTITY - number of block
- transactionDetails, bool - indicate if we should have or not the details of the transactions of the block
Returns:
- Object - A block object, or null when no transaction was found
- error
func (*Eth) GetBlockNumber ¶
GetBlockNumber - Returns the number of most recent block. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber Parameters:
- none
Returns:
- QUANTITY - integer of the current block number the client is on.
func (*Eth) GetBlockTransactionCountByHash ¶
GetBlockTransactionCountByHash Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash Parameters:
- DATA, 32 bytes - block hash
Returns:
- QUANTITY, number - number of transactions in the block
- error
func (*Eth) GetBlockTransactionCountByNumber ¶
GetBlockTransactionCountByNumber - Returns the number of transactions in a block matching the given block number Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber Parameters:
- QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter
Returns:
- QUANTITY - integer of the number of transactions in this block
func (*Eth) GetCode ¶
GetCode - Returns code at a given address Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode Parameters:
- DATA, 20 Bytes - address
- QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter: https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter
Returns:
- DATA - the code from the given address.
func (*Eth) GetCoinbase ¶
GetCoinbase - Returns the client coinbase address. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase Parameters:
- none
Returns:
- DATA, 20 bytes - the current coinbase address.
func (*Eth) GetGasPrice ¶
GetGasPrice - Returns the current price per gas in wei. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice Parameters:
- none
Returns:
- QUANTITY - integer of the current gas price in wei.
func (*Eth) GetHashRate ¶
GetHashRate - Returns the number of hashes per second that the node is mining with. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate Parameters:
- none
Returns:
- QUANTITY - number of hashes per second.
func (*Eth) GetProtocolVersion ¶
GetProtocolVersion - Returns the current ethereum protocol version. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion Parameters:
- none
Returns:
- String - The current ethereum protocol version
func (*Eth) GetStorageAt ¶
func (eth *Eth) GetStorageAt(address string, position *big.Int, defaultBlockParameter string) (string, error)
GetStorageAt - Returns the value from a storage position at a given address. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat Parameters:
- DATA, 20 Bytes - address of the storage.
- QUANTITY - integer of the position in the storage.
- QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter: https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter.
Returns:
- DATA - the value at this storage position.
func (*Eth) GetTransactionByBlockHashAndIndex ¶
func (eth *Eth) GetTransactionByBlockHashAndIndex(hash string, index *big.Int) (*dto.TransactionResponse, error)
GetTransactionByBlockHashAndIndex - Returns the information about a transaction requested by block hash. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getTransactionByBlockNumberAndIndex Parameters:
- DATA, 32 Bytes - hash of a block
- QUANTITY, number - index of the transaction position
Returns:
- Object - A transaction object, or null when no transaction was found - hash: DATA, 32 Bytes - hash of the transaction. - nonce: QUANTITY - the number of transactions made by the sender prior to this one. - blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending. - blockNumber: QUANTITY - block number where this transaction was in. null when its pending. - transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending. - from: DATA, 20 Bytes - address of the sender. - to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction. - value: QUANTITY - value transferred in Wei. - gasPrice: QUANTITY - gas price provided by the sender in Wei. - gas: QUANTITY - gas provided by the sender. - input: DATA - the data send along with the transaction.
func (*Eth) GetTransactionByBlockNumberAndIndex ¶
func (eth *Eth) GetTransactionByBlockNumberAndIndex(blockIndex *big.Int, index *big.Int) (*dto.TransactionResponse, error)
GetTransactionByBlockNumberAndIndex - Returns the information about a transaction requested by block index. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getTransactionByBlockNumberAndIndex Parameters:
- QUANTITY, number - block number
- QUANTITY, number - transaction index in block
Returns:
- Object - A transaction object, or null when no transaction was found - hash: DATA, 32 Bytes - hash of the transaction. - nonce: QUANTITY - the number of transactions made by the sender prior to this one. - blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending. - blockNumber: QUANTITY - block number where this transaction was in. null when its pending. - transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending. - from: DATA, 20 Bytes - address of the sender. - to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction. - value: QUANTITY - value transferred in Wei. - gasPrice: QUANTITY - gas price provided by the sender in Wei. - gas: QUANTITY - gas provided by the sender. - input: DATA - the data send along with the transaction.
func (*Eth) GetTransactionByHash ¶
func (eth *Eth) GetTransactionByHash(hash string) (*dto.TransactionResponse, error)
GetTransactionByHash - Returns the information about a transaction requested by transaction hash. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash Parameters:
- DATA, 32 Bytes - hash of a transaction
Returns:
- Object - A transaction object, or null when no transaction was found - hash: DATA, 32 Bytes - hash of the transaction. - nonce: QUANTITY - the number of transactions made by the sender prior to this one. - blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending. - blockNumber: QUANTITY - block number where this transaction was in. null when its pending. - transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending. - from: DATA, 20 Bytes - address of the sender. - to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction. - value: QUANTITY - value transferred in Wei. - gasPrice: QUANTITY - gas price provided by the sender in Wei. - gas: QUANTITY - gas provided by the sender. - input: DATA - the data send along with the transaction.
func (*Eth) GetTransactionCount ¶
GetTransactionCount - Returns the number of transactions sent from an address. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionaccount Parameters:
- DATA, 20 Bytes - address to check for balance.
- QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter: https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter
Returns:
- QUANTITY - integer of the number of transactions sent from this address
func (*Eth) GetTransactionReceipt ¶
func (eth *Eth) GetTransactionReceipt(hash string) (*dto.TransactionReceipt, error)
GetTransactionReceipt - Returns compiled solidity code. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt Parameters:
- DATA, 32 Bytes - hash of a transaction.
Returns:
- Object - A transaction receipt object, or null when no receipt was found: - transactionHash: DATA, 32 Bytes - hash of the transaction. - transactionIndex: QUANTITY - integer of the transactions index position in the block. - blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. - blockNumber: QUANTITY - block number where this transaction was in. - cumulativeGasUsed: QUANTITY - The total amount of gas used when this transaction was executed in the block. - gasUsed: QUANTITY - The amount of gas used by this specific transaction alone. - contractAddress: DATA, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null. - logs: Array - Array of log objects, which this transaction generated.
func (*Eth) GetUncleCountByBlockHash ¶
GetUncleCountByBlockHash - Returns the number of uncles in a block from a block matching the given block hash. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash Parameters:
- DATA, 32 bytes - Hash of a block
Returns:
- QUANTITY, number - integer of the number of uncles in this block
- error
func (*Eth) GetUncleCountByBlockNumber ¶
GetUncleCountByBlockNumber - Returns the number of uncles in a block from a block matching the given block number. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber Parameters:
- QUANTITY, number - integer of a block number
Returns:
- QUANTITY, number - integer of the number of uncles in this block
- error
func (*Eth) IsMining ¶
IsMining - Returns true if client is actively mining new blocks. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining Parameters:
- none
Returns:
- Boolean - returns true of the client is mining, otherwise false.
func (*Eth) IsSyncing ¶
func (eth *Eth) IsSyncing() (*dto.SyncingResponse, error)
IsSyncing - Returns an object with data about the sync status or false. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing Parameters:
- none
Returns:
- Object|Boolean, An object with sync status data or FALSE, when not syncing:
- startingBlock: QUANTITY - The block at which the import started (will only be reset, after the sync reached his head)
- currentBlock: QUANTITY - The current block, same as eth_blockNumber
- highestBlock: QUANTITY - The estimated highest block
func (*Eth) ListAccounts ¶
ListAccounts - Returns a list of addresses owned by client. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts Parameters:
- none
Returns:
- Array of DATA, 20 Bytes - addresses owned by the client.
func (*Eth) NewContract ¶
NewContract - Contract abstraction
func (*Eth) SendTransaction ¶
func (eth *Eth) SendTransaction(transaction *dto.TransactionParameters) (string, error)
SendTransaction - Creates new message call transaction or a contract creation, if the data field contains code. Reference: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction Parameters:
- Object - The transaction object - from: DATA, 20 Bytes - The address the transaction is send from. - to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to. - gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas. - gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas - value: QUANTITY - (optional) Integer of the value send with this transaction - data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI (https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) - nonce: QUANTITY - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
Returns:
- DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.
Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
func (*Eth) SignTransaction ¶
func (eth *Eth) SignTransaction(transaction *dto.TransactionParameters) (*dto.SignTransactionResponse, error)
SignTransaction - Signs transactions without dispatching it to the network. It can be later submitted using eth_sendRawTransaction. Reference: https://wiki.parity.io/JSONRPC-eth-module.html#eth_signtransaction Parameters:
- Object - The transaction call object - from: DATA, 20 Bytes - The address the transaction is send from. - to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to. - gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas. - gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas - value: QUANTITY - (optional) Integer of the value send with this transaction - data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI (https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) - nonce: QUANTITY - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
Returns:
- Object - A transaction sign result object - raw: DATA - The signed, RLP encoded transaction. - tx: Object - A transaction object - hash: DATA, 32 Bytes - hash of the transaction. - nonce: QUANTITY - the number of transactions made by the sender prior to this one. - blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending. - blockNumber: QUANTITY - block number where this transaction was in. null when its pending. - transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending. - from: DATA, 20 Bytes - address of the sender. - to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction. - value: QUANTITY - value transferred in Wei. - gasPrice: QUANTITY - gas price provided by the sender in Wei. - gas: QUANTITY - gas provided by the sender. - input: DATA - the data send along with the transaction.
Use eth_sendRawTransaction to submit the transaction after it was signed.