Closed jacktop closed 3 years ago
The program can run normally
Thank you very much for your answer. Can you provide some TRC20 transfer examples?
<?php
include_once './vendor/autoload.php';
use GuzzleHttp\Client;
use Tron\Address;
$uri = 'https://api.shasta.trongrid.io';// shasta testnet
$api = new \Tron\Api(new Client(['base_uri' => $uri]));
$config = [
'contract_address' => 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',// USDT TRC20
'decimals' => 6,
];
$trc20Wallet = new \Tron\TRC20($api, $this->config);
$fromPrivateKey = '0xfc0df27bf59f39d37726ba4****';// The private key of the sending address
$toAddress = 'TPQz2D5PddZ1LTi****';// Receiving address
$amount = 1;// The number of transactions, but it is necessary to ensure that the TRX of the sending address has sufficient transaction fees
$from = $trc20Wallet->privateKeyToAddress($fromPrivateKey);
$to = new Address($toAddress, '', $trc20Wallet->tron->address2HexString($toAddress));
$transferResult = $trc20Wallet->transfer($from, $to, $amount);
Using version ^1.3 for fenguoz/tron-php Root package 'fenguoz/tron-php' cannot require itself in its composer.json can youe help me?
Dose it support iexbase/tron-api 3.1?