Skip to content

Commit 7013186

Browse files
committed
Add trx & trc20 tokens
1 parent 9d9d081 commit 7013186

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cryptapi/cryptapi.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
class CryptAPI {
77
private static $base_url = "https://api.cryptapi.io";
8-
private $valid_tokens = ['becaz', 'bnb', 'busd', 'cro', 'link', 'mkr', 'nexo', 'pax', 'tusd', 'usdc', 'usdt', ];
9-
private $valid_coins = ['btc', 'bch', 'eth', 'ltc', 'xmr', 'iota', ];
8+
private $valid_erc20_tokens = ['becaz', 'bnb', 'busd', 'cro', 'link', 'mkr', 'nexo', 'pax', 'tusd', 'usdc', 'usdt', ];
9+
private $valid_trc20_tokens = ['usdt', 'btc', 'eth', ];
10+
private $valid_coins = ['btc', 'bch', 'eth', 'ltc', 'xmr', 'iota', 'trx', ];
1011
private $own_address = null;
1112
private $callback_url = null;
1213
private $coin = null;
@@ -20,14 +21,19 @@ class CryptAPI {
2021
'eth' => 10**18,
2122
'iota' => 10**6,
2223
'xmr' => 10**12,
24+
'trx' => 10**6,
2325
];
2426

2527
public function __construct($coin, $own_address, $callback_url, $parameters=[], $ca_params=[]) {
2628

27-
foreach ($this->valid_tokens as $token) {
29+
foreach ($this->valid_erc20_tokens as $token) {
2830
$this->valid_coins[] = 'erc20_' . $token;
2931
}
3032

33+
foreach ($this->valid_trc20_tokens as $token) {
34+
$this->valid_coins[] = 'trc20_' . $token;
35+
}
36+
3137
if (!in_array($coin, $this->valid_coins)) {
3238
$vc = print_r($this->valid_coins, true);
3339
throw new Exception("Unsupported Coin: {$coin}, Valid options are: {$vc}");

0 commit comments

Comments
 (0)