|
| 1 | +# slvler - Etherscan Service |
| 2 | + |
| 3 | +[](https://packagist.org/packages/qwerty/tmdb) |
| 4 | +[](https://packagist.org/packages/qwerty/tmdb) |
| 5 | +[](https://packagist.org/packages/qwerty/tmdb) |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +An api service for etherscan.io |
| 10 | + |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +To install this package tou can use composer: |
| 15 | + |
| 16 | +```bash |
| 17 | + composer require qwerty/tmdb |
| 18 | +``` |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +- First, you should extract the config/etherscan.php file to the config folder. |
| 23 | + |
| 24 | +```php |
| 25 | + php artisan vendor:publish --tag=ether |
| 26 | +``` |
| 27 | + |
| 28 | +- API key to be obtained from etherscan.io address should be declared. |
| 29 | + |
| 30 | +```php |
| 31 | + 'ether' => [ |
| 32 | + 'etherscan_url' => 'https://api.etherscan.io/', |
| 33 | + 'etherscan_key' => 'XXXXXXXXXXXXXXXXXXXXXXXX' |
| 34 | + ] |
| 35 | +``` |
| 36 | + |
| 37 | +- This is how you can connect to the etherscan api service. |
| 38 | +- Returns the Ether balance of a given address. |
| 39 | + |
| 40 | +```php |
| 41 | + $ether = new EtherScanService(); |
| 42 | + $ether->balance('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'); |
| 43 | +``` |
| 44 | + |
| 45 | +- Returns the balance of the accounts from a list of addresses. |
| 46 | + |
| 47 | +```php |
| 48 | + $data = [ |
| 49 | + '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a', |
| 50 | + '0x63a9975ba31b0b9626b34300f7f627147df1f526', |
| 51 | + '0x198ef1ec325a96cc354c7266a038be8b5c558f67' |
| 52 | + ]; |
| 53 | + |
| 54 | + $ether = new EtherScanService(); |
| 55 | + $ether->balance_multiple($data); |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | +- Returns the list of transactions performed by an address, with optional pagination. |
| 60 | + |
| 61 | +```php |
| 62 | + $ether = new EtherScanService(); |
| 63 | + $ether->transactions_normal('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'); |
| 64 | +``` |
| 65 | + |
| 66 | + |
| 67 | +- Returns the list of internal transactions performed by an address, with optional pagination. |
| 68 | + |
| 69 | +```php |
| 70 | + $ether = new EtherScanService(); |
| 71 | + $ether->transactions_internal('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'); |
| 72 | +``` |
| 73 | + |
| 74 | +- Returns the list of internal transactions performed within a transaction. |
| 75 | + |
| 76 | +```php |
| 77 | + $ether = new EtherScanService(); |
| 78 | + $ether->transactions_internal_hash('0x40eb908387324f2b575b4879cd9d7188f69c8fc9d87c901b9e2daaea4b442170'); |
| 79 | +``` |
| 80 | + |
| 81 | +- Returns the list of internal transactions performed within a block range, with optional pagination. |
| 82 | + |
| 83 | +```php |
| 84 | + $ether = new EtherScanService(); |
| 85 | + $ether->transactions_internal_block_range(); |
| 86 | +``` |
| 87 | + |
| 88 | + |
| 89 | +- Returns the list of ERC-20 tokens transferred by an address, with optional filtering by token contract. |
| 90 | + |
| 91 | +```php |
| 92 | + $ether = new EtherScanService(); |
| 93 | + $ether->token_transfer_events_erc20(); |
| 94 | +``` |
| 95 | + |
| 96 | + |
| 97 | +- Returns the list of ERC-721 ( NFT ) tokens transferred by an address, with optional filtering by token contract. |
| 98 | + |
| 99 | +```php |
| 100 | + $ether = new EtherScanService(); |
| 101 | + $ether->token_transfer_events_erc721(); |
| 102 | +``` |
| 103 | + |
| 104 | +- Returns the list of ERC-1155 ( Multi Token Standard ) tokens transferred by an address, with optional filtering by token contract. |
| 105 | + |
| 106 | +```php |
| 107 | + $ether = new EtherScanService(); |
| 108 | + $ether->token_transfer_events_erc1155(); |
| 109 | +``` |
| 110 | + |
| 111 | + |
| 112 | +- Returns the list of blocks mined by an address. |
| 113 | + |
| 114 | +```php |
| 115 | + $ether = new EtherScanService(); |
| 116 | + $ether->address_blocks_mined(); |
| 117 | +``` |
| 118 | + |
| 119 | +- Returns the balance of an address at a certain block height. - PRO |
| 120 | + |
| 121 | +```php |
| 122 | + $ether = new EtherScanService(); |
| 123 | + $ether->balance_single_adress(); |
| 124 | +``` |
| 125 | + |
| 126 | + |
| 127 | +### Testing |
| 128 | + |
| 129 | +```bash |
| 130 | + composer test |
| 131 | +``` |
| 132 | + |
| 133 | +## Credits |
| 134 | + |
| 135 | +- [slvler](https://github.com/slvler) |
| 136 | + |
| 137 | + |
| 138 | +## License |
| 139 | + |
| 140 | +The MIT License (MIT). Please see [License File](https://github.com/hs-qwerty/TMDB/blob/main/LICENSE.md) for more information. |
0 commit comments