tron-api icon indicating copy to clipboard operation
tron-api copied to clipboard

exapmpes/contract.php need some fix to work

Open akamitch opened this issue 3 years ago • 1 comments

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";

akamitch avatar Jul 22 '21 21:07 akamitch

You need to use the $tron->setAddress('TMtiKBUP15SijTPh7UgvpSjvKEBYP4AvJ5') method; to select an address

sviridenkovalera avatar Oct 26 '21 20:10 sviridenkovalera