universal.php 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. include_once '../vendor/autoload.php';
  3. use IEXBase\TronAPI\Tron;
  4. $tron = new Tron();
  5. $tron->setPrivateKey('...');
  6. /**
  7. * check multi balances
  8. *
  9. * $address = [
  10. * ['address', 'isFromTron'],
  11. * ['address', 'isFromTron'],
  12. * ]
  13. */
  14. //address one -> TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
  15. $addresses = [
  16. ['address one', true],
  17. ['address two', true],
  18. ['address three', false],
  19. ];
  20. //isValid (tron address) - default false
  21. $check = $tron->balances($addresses);
  22. var_dump($check);
  23. /**
  24. * send one to many
  25. *
  26. * $address = [
  27. * ['to address', 'amount float'],
  28. * ['to address', 'amount float'],
  29. * ]
  30. *
  31. * toAddress format: TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
  32. */
  33. $toArray = [
  34. ['TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY', 0.1],
  35. ['TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY', 0.2],
  36. ['other address', 0.001]
  37. ];
  38. //default: $this->setPrivateKey();
  39. $send = $tron->sendOneToMany('from_address', $toArray, 'private_key alt');
  40. var_dump($send);