|
9 | 9 | */
|
10 | 10 | class Token extends AbstractApi
|
11 | 11 | {
|
| 12 | + /** |
| 13 | + * Get ERC20-Token TotalSupply by ContractAddress |
| 14 | + * Returns the current amount of an ERC-20 token in circulation. |
| 15 | + * |
| 16 | + * @param string $contractAddress the contract address of the ERC-20 token |
| 17 | + * |
| 18 | + * @return array |
| 19 | + * @throws \Etherscan\Exception\ErrorException |
| 20 | + */ |
| 21 | + public function getTokenSupply($contractAddress) |
| 22 | + { |
| 23 | + return $this->request->exec([ |
| 24 | + 'module' => "stats", |
| 25 | + 'action' => "tokensupply", |
| 26 | + 'contractaddress' => $contractAddress |
| 27 | + ]); |
| 28 | + } |
12 | 29 |
|
13 |
| -} |
| 30 | + /** |
| 31 | + * Get ERC20-Token Account Balance for TokenContractAddress |
| 32 | + * Returns the current balance of an ERC-20 token of an address. |
| 33 | + * |
| 34 | + * @param string $contractAddress the contract address of the ERC-20 token |
| 35 | + * @param string $address the string representing the address to check for token balance |
| 36 | + * |
| 37 | + * @return array |
| 38 | + * @throws \Etherscan\Exception\ErrorException |
| 39 | + */ |
| 40 | + public function getTokenBalance($contractAddress, $address) |
| 41 | + { |
| 42 | + return $this->request->exec([ |
| 43 | + 'module' => "account", |
| 44 | + 'action' => "tokenbalance", |
| 45 | + 'contractaddress' => $contractAddress, |
| 46 | + 'address' => $address |
| 47 | + ]); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Get Historical ERC20-Token TotalSupply by ContractAddress & BlockNo |
| 52 | + * Returns the amount of an ERC-20 token in circulation at a certain block height. |
| 53 | + * |
| 54 | + * @param string $contractAddress the contract address of the ERC-20 token |
| 55 | + * @param string $blockNumber the integer block number to check total supply for eg. 12697906 |
| 56 | + * |
| 57 | + * @return array |
| 58 | + * @throws \Etherscan\Exception\ErrorException |
| 59 | + */ |
| 60 | + public function getTokenSupplyHistory($contractAddress, $blockNumber) |
| 61 | + { |
| 62 | + return $this->request->exec([ |
| 63 | + 'module' => "stats", |
| 64 | + 'action' => "tokensupplyhistory", |
| 65 | + 'contractaddress' => $contractAddress, |
| 66 | + 'blockno' => $blockNumber |
| 67 | + ]); |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * Get Historical ERC20-Token Account Balance for TokenContractAddress by BlockNo |
| 72 | + * Returns the balance of an ERC-20 token of an address at a certain block height. |
| 73 | + * |
| 74 | + * @param string $contractAddress the contract address of the ERC-20 token |
| 75 | + * @param string $address the string representing the address to check for balance |
| 76 | + * @param string $blockNumber the integer block number to check total supply for eg. 12697906 |
| 77 | + * |
| 78 | + * @return array |
| 79 | + * @throws \Etherscan\Exception\ErrorException |
| 80 | + */ |
| 81 | + public function getTokenBalanceHistory($contractAddress, $address, $blockNumber) |
| 82 | + { |
| 83 | + return $this->request->exec([ |
| 84 | + 'module' => "account", |
| 85 | + 'action' => "tokenbalancehistory", |
| 86 | + 'contractaddress' => $contractAddress, |
| 87 | + 'address' => $address, |
| 88 | + 'blockno' => $blockNumber |
| 89 | + ]); |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * Get Token Info by ContractAddress |
| 94 | + * Returns project information and social media links of an ERC-20/ERC-721 token. |
| 95 | + * |
| 96 | + * @param string $contractAddress the contract address of the ERC-20/ERC-721 token to retrieve token info |
| 97 | + * |
| 98 | + * @return array |
| 99 | + * @throws \Etherscan\Exception\ErrorException |
| 100 | + */ |
| 101 | + public function getTokenInfo($contractAddress) |
| 102 | + { |
| 103 | + return $this->request->exec([ |
| 104 | + 'module' => "token", |
| 105 | + 'action' => "tokeninfo", |
| 106 | + 'contractaddress' => $contractAddress |
| 107 | + ]); |
| 108 | + } |
| 109 | +} |
0 commit comments