tron-api
tron-api copied to clipboard
contract transfer not working
hello dear thats my code : ` try { $tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer); $tron->setAddress('TXsxxxxxxxx'); $tron->setPrivateKey('72bxxxxxxx'); $contract = $tron->contract('Twtssss'); // Tether USDT https://tronscan.org/#/token20/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
echo $contract->transfer('THwsxxxxxx', 100000000000000000000); } catch (\IEXBase\TronAPI\Exception\TronException $e) { exit($e->getMessage()); }` my token decimals : 18 but not working why ?
??
$contract->decimals();
print_r($contract->transfer('THwsxxxxxx', 1)); // (1 = 1 Token)
https://github.com/iexbase/tron-api/blob/master/src/TRC20Contract.php#L290
thanks
now print this error :
Fatal error: Uncaught Error: Call to undefined function Mdanter\Ecc\Curves\gmp_init() in C:\xampp\htdocs\tron\vendor\mdanter\ecc\src\Curves\SecgCurve.php:122 Stack trace: #0 C:\xampp\htdocs\tron\vendor\mdanter\ecc\src\Curves\SecgCurve.php(137): Mdanter\Ecc\Curves\SecgCurve->curve256k1() #1 C:\xampp\htdocs\tron\vendor\mdanter\ecc\src\Curves\CurveFactory.php(78): Mdanter\Ecc\Curves\SecgCurve->generator256k1() #2 C:\xampp\htdocs\tron\vendor\kornrunner\secp256k1\src\Secp256k1.php(29): Mdanter\Ecc\Curves\CurveFactory::getGeneratorByName('secp256k1') #3 C:\xampp\htdocs\tron\vendor\iexbase\tron-api\src\Support\Secp.php(14): kornrunner\Secp256k1->__construct() #4 C:\xampp\htdocs\tron\vendor\iexbase\tron-api\src\Tron.php(756): IEXBase\TronAPI\Support\Secp::sign('579254878df6621...', '7ba5ad146ea9a3b...') #5 C:\xampp\htdocs\tron\vendor\iexbase\tron-api\src\TRC20Contract.php(302): IEXBase\TronAPI\Tron->signTransaction(Array) #6 C:\xampp\htdocs\tron\index.php(33): IEXBase\TronAPI\TRC20Contract->transfer('THwBemASULj5HdN...', '100') #7 {main} thrown in C:\xampp\htdocs\tron\vendor\mdanter\ecc\src\Curves\SecgCurve.php on line 122
??
gmp_init Install the library
me to! gmp had install