module Web3::EthCalls
Public Instance Methods
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts
# File eth_calls.rb, line 39 def eth_accounts() response = do_request("eth_accounts") response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber
# File eth_calls.rb, line 45 def eth_blockNumber() response = do_request("eth_blockNumber") to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_call
# File eth_calls.rb, line 147 def eth_call(trans_object,block="latest") response = do_request("eth_call",[trans_object, block]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase
# File eth_calls.rb, line 15 def eth_coinbase() response = do_request("eth_coinbase") response["result"] end
deprecated
See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilelll
# File eth_calls.rb, line 215 def eth_compileLLL(code) response = do_request("eth_compileLLL",[code]) response["result"] end
deprecated See github.com/ethereum/wiki/wiki/JSON-RPC#eth_compileserpent
# File eth_calls.rb, line 229 def eth_compileSerpent(code) response = do_request("eth_compileSerpent",[code]) response["result"] end
deprecated See github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity
# File eth_calls.rb, line 222 def eth_compileSolidity(code) response = do_request("eth_compileSolidity",[code]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas
# File eth_calls.rb, line 153 def eth_estimateGas(trans_object) response = do_request("eth_estimateGas",[trans_object]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice
# File eth_calls.rb, line 33 def eth_gasPrice() response = do_request("eth_gasPrice") to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance
# File eth_calls.rb, line 51 def eth_getBalance(address, block = "latest") response = do_request("eth_getBalance",[address, block]) to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash
# File eth_calls.rb, line 159 def eth_getBlockByHash(hash, full_transactions = true) response = do_request("eth_getBlockByHash",[hash, full_transactions]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber
# File eth_calls.rb, line 165 def eth_getBlockByNumber(number, full_transactions = true) response = do_request("eth_getBlockByNumber",[number, full_transactions]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash
# File eth_calls.rb, line 69 def eth_getBlockTransactionCountByHash(data) response = do_request("eth_getBlockTransactionCountByHash",[data]) to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber
# File eth_calls.rb, line 75 def eth_getBlockTransactionCountByNumber(block = "latest") response = do_request("eth_getBlockTransactionCountByNumber",[block]) to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode
# File eth_calls.rb, line 93 def eth_getCode(address, block = "latest") response = do_request("eth_getCode",[address, block]) response["result"] end
deprecated See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcompilers
# File eth_calls.rb, line 208 def eth_getCompilers() response = do_request("eth_getCompilers") response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges
# File eth_calls.rb, line 259 def eth_getFilterChanges(id) response = do_request("eth_getFilterChanges",[id]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs
# File eth_calls.rb, line 265 def eth_getFilterLogs(id) response = do_request("eth_getFilterLogs",[id]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs
# File eth_calls.rb, line 271 def eth_getLogs(filter_obj) response = do_request("eth_getLogs",[filter_obj]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat
# File eth_calls.rb, line 57 def eth_getStorageAt(storage_address, position, block = "latest") response = do_request("eth_getStorageAt",[storage_address, to_hex(position), block]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex
# File eth_calls.rb, line 177 def eth_getTransactionByBlockHashAndIndex(hash, index) response = do_request("eth_getTransactionByBlockHashAndIndex",[hash, index]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex
# File eth_calls.rb, line 183 def eth_getTransactionByBlockNumberAndIndex(number, index) response = do_request("eth_getTransactionByBlockNumberAndIndex",[number, index]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash
# File eth_calls.rb, line 171 def eth_getTransactionByHash(hash) response = do_request("eth_getTransactionByHash",[hash]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount
# File eth_calls.rb, line 63 def eth_getTransactionCount(address, block = "latest") response = do_request("eth_getTransactionCount",[address, block]) to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt
# File eth_calls.rb, line 189 def eth_getTransactionReceipt(hash) response = do_request("eth_getTransactionReceipt",[hash]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex
# File eth_calls.rb, line 195 def eth_getUncleByBlockHashAndIndex(hash, index) response = do_request("eth_getUncleByBlockHashAndIndex",[hash, index]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblocknumberandindex
# File eth_calls.rb, line 201 def eth_getUncleByBlockNumberAndIndex(number, index) response = do_request("eth_getUncleByBlockNumberAndIndex",[number, index]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash
# File eth_calls.rb, line 81 def eth_getUncleCountByBlockHash(data) response = do_request("eth_getUncleCountByBlockHash",[data]) to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber
# File eth_calls.rb, line 87 def eth_getUncleCountByBlockNumber(data) response = do_request("eth_getUncleCountByBlockNumber",[data]) to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork
# File eth_calls.rb, line 277 def eth_getWork() response = do_request("eth_getWork") response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate
# File eth_calls.rb, line 27 def eth_hashrate() response = do_request("eth_hashrate") to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining
# File eth_calls.rb, line 21 def eth_mining() response = do_request("eth_mining") response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter
# File eth_calls.rb, line 241 def eth_newBlockFilter() response = do_request("eth_newBlockFilter") to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter
# File eth_calls.rb, line 235 def eth_newFilter(fromBlock, toBlock, address, topics) response = do_request("$CODE",[fromBlock, toBlock, address, topics]) to_decimal response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter
# File eth_calls.rb, line 247 def eth_newPendingTransactionFilter() response = do_request("eth_newPendingTransactionFilter") to_decimal response["result"] end
Returns pending transactions that belong to any of the users accounts See github.com/ethereum/go-ethereum/wiki/JavaScript-Console#ethpendingtransactions
# File eth_calls.rb, line 121 def eth_pendingTransactions() response = do_request("eth_pendingTransactions") response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion
# File eth_calls.rb, line 4 def eth_protocolVersion() raise NotImplementedError.new "JSON-RPC call to eth_protocolVersion is not currently supported" end
Resends a transaction. These can ge retrieved from #eth_pendingTransactions(). gasPrice and gasLimit can be included together if the gas settings are being changed from their original settings in the pending_transaction object See github.com/ethereum/go-ethereum/wiki/JavaScript-Console#ethresend
# File eth_calls.rb, line 130 def eth_resend(pending_transaction, gasPrice=nil, gasLimit=nil) package = [pending_transaction] if gasPrice != nil package += [gasPrice, gasLimit] end response = do_request("eth_resend", package) response["result"] end
This sends a transaction that looks something like this: See github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction
# File eth_calls.rb, line 141 def eth_sendRawTransaction(data) response = do_request("eth_sendRawTransaction",[data]) response["result"] end
Sends a transaction for posting to the ethereum network. The transaction_object that is sent should look something like this:
{"from"=> accounts[0], "to" => accounts[1], "value" => w3.ether_to_0xwei(0.001)}
Other 0x-fomatted attributes that can be included in the transaction_object are:
"data" : formatted as hex "gas", "gasPrice", "value", and "nonce" : formatted as "0x" + hex
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction
# File eth_calls.rb, line 114 def eth_sendTransaction(transaction_object) response = do_request("eth_sendTransaction",[transaction_object]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
# File eth_calls.rb, line 99 def eth_sign(address, data) response = do_request("eth_sign",[address, data]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate
# File eth_calls.rb, line 289 def eth_submitHashrate(hashrate, id) response = do_request("eth_submitHashrate",[hashrate, id]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork
# File eth_calls.rb, line 283 def eth_submitWork(nonce, powHash, mixDigest) response = do_request("eth_submitWork",[nonce, powHash, mixDigest]) response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing
# File eth_calls.rb, line 9 def eth_syncing() response = do_request("eth_syncing") response["result"] end
See github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter
# File eth_calls.rb, line 253 def eth_uninstallFilter(id) response = do_request("eth_uninstallFilter",[id]) response["result"] end