Coder Social home page Coder Social logo

etherscan's Introduction

etherscan

This lib is created for connecting to etherscan.io's api using php.

There are 2 possible ways of using the lib:

  • sync
    $esApiConnector = new ApiConnector('your_api_key');
    $etherScan = new EtherScan($esApiConnector);
    
    
    $account = $etherScan->getAccount(EtherScan::PREFIX_API);
    $startT = microtime(1);
    echo $account->getTransactions('0xbb9bc244d798123fde783fcc1c72d3bb8c189413', 1, 25, 'desc') . PHP_EOL;
    echo $account->getTransactions('0xbb9bc244d798123fde783fcc1c72d3bb8c189413', 1, 25, 'desc') . PHP_EOL;
    echo $account->getTransactions('0xbb9bc244d798123fde783fcc1c72d3bb8c189413', 1, 25, 'desc') . PHP_EOL;
    echo $account->getTransactions('0xbb9bc244d798123fde783fcc1c72d3bb8c189413', 1, 25, 'desc') . PHP_EOL;
    $endT = microtime(1);
    
    
    echo "DONE IN: " . ($endT - $startT);
    
  • async
    $esApiConnector = new ApiConnector('your_api_key');
    $etherScan = new EtherScan($esApiConnector);
    
    $onResponse = function ($responseOnResolve, $context) {
        echo 'Called on resolve: ' . $responseOnResolve . PHP_EOL;
        echo 'Called on context: ' . print_r($context, true) . PHP_EOL;
    };
    $onError = function ($responseOnResolve, $context) {
        echo 'Called on error: ' . $responseOnResolve . PHP_EOL;
    };
    $account = $etherScan->getAccount(EtherScan::PREFIX_API);
    $startT = microtime(1);
    
    $etherScan->callGroupAsync([
        [
            $account->getTransactionsLink('0xbb9bc244d798123fde783fcc1c72d3bb8c189413', 1, 25, Account::SORT_DESC),
            $onResponse, $onError, ['Any data type you want to be passed as second argument to the callbacks. This is optional.']
        ],
        [
            $account->getTransactionsLink('0xbb9bc244d798123fde783fcc1c72d3bb8c189413', 1, 25, Account::SORT_DESC),
            $onResponse, $onError
        ],
        [
            $account->getBalanceLink('0xbb9bc244d798123fde783fcc1c72d3bb8c189413'),
            $onResponse, $onError
        ],
        [
            $account->getTransactionsLink('0xbb9bc244d798123fde783fcc1c72d3bb8c189413', 1, 25, Account::SORT_DESC),
            $onResponse, $onError
        ],
    ]);
    
    $endT = microtime(1);
    
    echo "DONE IN: " . ($endT - $startT);
    

It uses the guzzlehttp/promises to allow aync calls

etherscan's People

Contributors

harmn108 avatar hayk891 avatar sergeytangyan avatar vazgen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

etherscan's Issues

Coinbase Wallet to Coinbase

I have attempt to send unsupported cryptocurrency to my Coinbase account. The good news is it shows my address but I need to retrieve them. Just need guideline but cannot provide my hash transaction and address!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.