yf_wrapper_ethereum class

Ethereum API wrapper.

Fileplugins/ethereum/classes/yf_wrapper_ethereum.class.php
Use_class('wrapper_ethereum')

Public properties

A site sets them in its config with $PROJECT_CONF['wrapper_ethereum']['NAME'] = ...;

PropertyDefaultDescription
$host '127.0.0.1'
$port 8545
$version '2.0'

Public methods 58

db_getHex

public function db_getHex($db, $key)
    public function db_getHex($db, $key)
    {
        return $this->_ether_request(__FUNCTION__, [$db, $key]);
    }

db_getString

public function db_getString($db, $key)
    public function db_getString($db, $key)
    {
        return $this->_ether_request(__FUNCTION__, [$db, $key]);
    }

db_putHex

public function db_putHex($db, $key, $value)
    public function db_putHex($db, $key, $value)
    {
        return $this->_ether_request(__FUNCTION__, [$db, $key, $value]);
    }

db_putString

public function db_putString($db, $key, $value)
    public function db_putString($db, $key, $value)
    {
        return $this->_ether_request(__FUNCTION__, [$db, $key, $value]);
    }

eth_accounts

public function eth_accounts()
    public function eth_accounts()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function eth_blockNumber($decode_hex = false)
    public function eth_blockNumber($decode_hex = false)
    {
        $block = $this->_ether_request(__FUNCTION__);

        if ($decode_hex) {
            $block = $this->_decode_hex($block);
        }

        return $block;
    }

eth_call

public function eth_call($message, $block)
    public function eth_call($message, $block)
    {
        return $this->_ether_request(__FUNCTION__, $message);
    }

eth_coinbase

public function eth_coinbase()
    public function eth_coinbase()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function eth_compileLLL($code)
    public function eth_compileLLL($code)
    {
        return $this->_ether_request(__FUNCTION__, [$code]);
    }
public function eth_compileSerpent($code)
    public function eth_compileSerpent($code)
    {
        return $this->_ether_request(__FUNCTION__, [$code]);
    }
public function eth_compileSolidity($code)
    public function eth_compileSolidity($code)
    {
        return $this->_ether_request(__FUNCTION__, [$code]);
    }
public function eth_estimateGas($message, $block)
    public function eth_estimateGas($message, $block)
    {
        return $this->_ether_request(__FUNCTION__, $message);
    }

eth_gasPrice

public function eth_gasPrice()
    public function eth_gasPrice()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function eth_getBalance($address, $block = 'latest', $decode_hex = false)
    public function eth_getBalance($address, $block = 'latest', $decode_hex = false)
    {
        $balance = $this->_ether_request(__FUNCTION__, [$address, $block]);

        if ($decode_hex) {
            $balance = $this->_decode_hex($balance);
        }

        return $balance;
    }
public function eth_getBlockByHash($hash, $full_tx = true)
    public function eth_getBlockByHash($hash, $full_tx = true)
    {
        return $this->_ether_request(__FUNCTION__, [$hash, $full_tx]);
    }
public function eth_getBlockByNumber($block = 'latest', $full_tx = true)
    public function eth_getBlockByNumber($block = 'latest', $full_tx = true)
    {
        return $this->_ether_request(__FUNCTION__, [$block, $full_tx]);
    }
public function eth_getBlockTransactionCountByHash($tx_hash)
    public function eth_getBlockTransactionCountByHash($tx_hash)
    {
        return $this->_ether_request(__FUNCTION__, [$tx_hash]);
    }
public function eth_getBlockTransactionCountByNumber($tx = 'latest')
    public function eth_getBlockTransactionCountByNumber($tx = 'latest')
    {
        return $this->_ether_request(__FUNCTION__, [$tx]);
    }

eth_getCode

public function eth_getCode($address, $block = 'latest')
    public function eth_getCode($address, $block = 'latest')
    {
        return $this->_ether_request(__FUNCTION__, [$address, $block]);
    }
public function eth_getCompilers()
    public function eth_getCompilers()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function eth_getFilterChanges($id)
    public function eth_getFilterChanges($id)
    {
        return $this->_ether_request(__FUNCTION__, [$id]);
    }
public function eth_getFilterLogs($id)
    public function eth_getFilterLogs($id)
    {
        return $this->_ether_request(__FUNCTION__, [$id]);
    }

eth_getLogs

public function eth_getLogs($filter)
    public function eth_getLogs($filter)
    {
        return $this->_ether_request(__FUNCTION__, $filter);
    }
public function eth_getStorageAt($address, $at, $block = 'latest')
    public function eth_getStorageAt($address, $at, $block = 'latest')
    {
        return $this->_ether_request(__FUNCTION__, [$address, $at, $block]);
    }
public function eth_getTransactionByBlockHashAndIndex($hash, $index)
    public function eth_getTransactionByBlockHashAndIndex($hash, $index)
    {
        return $this->_ether_request(__FUNCTION__, [$hash, $index]);
    }
public function eth_getTransactionByBlockNumberAndIndex($block, $index)
    public function eth_getTransactionByBlockNumberAndIndex($block, $index)
    {
        return $this->_ether_request(__FUNCTION__, [$block, $index]);
    }
public function eth_getTransactionByHash($hash)
    public function eth_getTransactionByHash($hash)
    {
        return $this->_ether_request(__FUNCTION__, [$hash]);
    }
public function eth_getTransactionCount($address, $block = 'latest', $decode_hex = false)
    public function eth_getTransactionCount($address, $block = 'latest', $decode_hex = false)
    {
        $count = $this->_ether_request(__FUNCTION__, [$address, $block]);

        if ($decode_hex) {
            $count = $this->_decode_hex($count);
        }

        return $count;
    }
public function eth_getTransactionReceipt($tx_hash)
    public function eth_getTransactionReceipt($tx_hash)
    {
        return $this->_ether_request(__FUNCTION__, [$tx_hash]);
    }
public function eth_getUncleByBlockHashAndIndex($hash, $index)
    public function eth_getUncleByBlockHashAndIndex($hash, $index)
    {
        return $this->_ether_request(__FUNCTION__, [$hash, $index]);
    }
public function eth_getUncleByBlockNumberAndIndex($block, $index)
    public function eth_getUncleByBlockNumberAndIndex($block, $index)
    {
        return $this->_ether_request(__FUNCTION__, [$block, $index]);
    }
public function eth_getUncleCountByBlockHash($block_hash)
    public function eth_getUncleCountByBlockHash($block_hash)
    {
        return $this->_ether_request(__FUNCTION__, [$block_hash]);
    }
public function eth_getUncleCountByBlockNumber($block = 'latest')
    public function eth_getUncleCountByBlockNumber($block = 'latest')
    {
        return $this->_ether_request(__FUNCTION__, [$block]);
    }

eth_getWork

public function eth_getWork()
    public function eth_getWork()
    {
        return $this->_ether_request(__FUNCTION__);
    }

eth_hashrate

public function eth_hashrate()
    public function eth_hashrate()
    {
        return $this->_ether_request(__FUNCTION__);
    }

eth_mining

public function eth_mining()
    public function eth_mining()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function eth_newBlockFilter($decode_hex = false)
    public function eth_newBlockFilter($decode_hex = false)
    {
        $id = $this->_ether_request(__FUNCTION__);

        if ($decode_hex) {
            $id = $this->_decode_hex($id);
        }

        return $id;
    }

eth_newFilter

public function eth_newFilter($filter, $decode_hex = false)
    public function eth_newFilter($filter, $decode_hex = false)
    {
        $id = $this->_ether_request(__FUNCTION__, $filter);

        if ($decode_hex) {
            $id = $this->_decode_hex($id);
        }

        return $id;
    }
public function eth_newPendingTransactionFilter($decode_hex = false)
    public function eth_newPendingTransactionFilter($decode_hex = false)
    {
        $id = $this->_ether_request(__FUNCTION__);

        if ($decode_hex) {
            $id = $this->_decode_hex($id);
        }

        return $id;
    }
public function eth_protocolVersion()
    public function eth_protocolVersion()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function eth_sendTransaction($transaction)
    public function eth_sendTransaction($transaction)
    {
        return $this->_ether_request(__FUNCTION__, $transaction);
    }

eth_sign

public function eth_sign($address, $input)
    public function eth_sign($address, $input)
    {
        return $this->_ether_request(__FUNCTION__, [$address, $input]);
    }
public function eth_submitWork($nonce, $pow_hash, $mix_digest)
    public function eth_submitWork($nonce, $pow_hash, $mix_digest)
    {
        return $this->_ether_request(__FUNCTION__, [$nonce, $pow_hash, $mix_digest]);
    }
public function eth_uninstallFilter($id)
    public function eth_uninstallFilter($id)
    {
        return $this->_ether_request(__FUNCTION__, [$id]);
    }

net_listening

public function net_listening()
    public function net_listening()
    {
        return $this->_ether_request(__FUNCTION__);
    }

net_peerCount

public function net_peerCount()
    public function net_peerCount()
    {
        return $this->_ether_request(__FUNCTION__);
    }

net_version

public function net_version()
    public function net_version()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function shh_getFilterChanges($id)
    public function shh_getFilterChanges($id)
    {
        return $this->_ether_request(__FUNCTION__, [$id]);
    }
public function shh_getMessages($id)
    public function shh_getMessages($id)
    {
        return $this->_ether_request(__FUNCTION__, [$id]);
    }
public function shh_hasIdentity($id)
    public function shh_hasIdentity($id)
    {
        return $this->_ether_request(__FUNCTION__);
    }

shh_newFilter

public function shh_newFilter($to = null, $topics = [])
    public function shh_newFilter($to = null, $topics = [])
    {
        return $this->_ether_request(__FUNCTION__, [['to' => $to, 'topics' => $topics]]);
    }
public function shh_newIdentinty()
    public function shh_newIdentinty()
    {
        return $this->_ether_request(__FUNCTION__);
    }

shh_post

public function shh_post($post)
    public function shh_post($post)
    {
        return $this->_ether_request(__FUNCTION__, $post);
    }
public function shh_uninstallFilter($id)
    public function shh_uninstallFilter($id)
    {
        return $this->_ether_request(__FUNCTION__, [$id]);
    }

shh_version

public function shh_version()
    public function shh_version()
    {
        return $this->_ether_request(__FUNCTION__);
    }
public function web3_clientVersion()
    public function web3_clientVersion()
    {
        return $this->_ether_request(__FUNCTION__);
    }

web3_sha3

public function web3_sha3($input)
    public function web3_sha3($input)
    {
        return $this->_ether_request(__FUNCTION__, [$input]);
    }

Methods starting with _ hooks and helpers; not routable as page actions

public function _format_response($response)
    public function _format_response($response)
    {
        return @json_decode($response);
    }