tron-api
tron-api copied to clipboard
exapmpes/contract.php need some fix to work
I fix this example, now it working:
//$tron = new Tron($fullNode, $solidityNode, $eventServer, null, true); //this code gives error on my system, i change it to: $tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
//echo $contract->balanceOf(); //this not working, function need string adress, in example better to fill witn any adress, like //btw, also betterl looks if add names of the variables
echo "Name: ".$contract->name()."\n";
echo "Symbol: ".$contract->symbol()."\n";
echo "BalanceOf: ".$contract->balanceOf('TMtiKBUP15SijTPh7UgvpSjvKEBYP4AvJ5')."\n";
echo "totalSupply: ".$contract->totalSupply()."\n";
You need to use the $tron->setAddress('TMtiKBUP15SijTPh7UgvpSjvKEBYP4AvJ5') method; to select an address