Skip to content

Commit 75b4125

Browse files
committed
trx add get all transactions
1 parent 57fe3de commit 75b4125

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

examples/find-transaction.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,17 @@
1111
exit($e->getMessage());
1212
}
1313

14+
// get transaction by tx id
1415
$detail = $tron->getTransaction('TxId');
16+
var_dump($detail);
17+
18+
// get all transaction by address
19+
$address = 'this is you address';
20+
$detail = $tron->getTransactions($address, 100);
21+
var_dump($detail);
22+
23+
// TRC20 All transactions
24+
$contractAddress = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'; //mainnet usdt contract address
25+
$trc20Contract = new \IEXBase\TronAPI\TRC20Contract($tron, $contractAddress);
26+
$detail = $trc20Contract->getTransactions($address, 100);
1527
var_dump($detail);

src/Tron.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,4 +1386,18 @@ public function getTokenByID(string $token_id): array
13861386
'value' => $token_id
13871387
]);
13881388
}
1389+
1390+
/**
1391+
* TRX All transactions
1392+
*
1393+
* @param string $address
1394+
* @param int $limit
1395+
* @return array
1396+
*
1397+
* @throws TronException
1398+
*/
1399+
public function getTransactions(string $address, int $limit = 100): array
1400+
{
1401+
return $this->manager->request("v1/accounts/{$address}/transactions?limit={$limit}", [], 'get');
1402+
}
13891403
}

0 commit comments

Comments
 (0)