Created
January 4, 2021 11:53
-
-
Save askaaqib/81d0e3f260e579ea55710cd6b17a8ec3 to your computer and use it in GitHub Desktop.
TRON SDK Implementation - Account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
require "../../vendor/autoload.php"; | |
echo "<pre>"; | |
//$ip = "47.252.19.181"; | |
$domain = "api.shasta.trongrid.io"; | |
//$port = 8090; | |
$tronClient = new \MediaParkPK\TRON\TRON_Client(null, null, null, null, true, $domain); | |
/** Owner/Sender Address Generated, save the info */ | |
$senderAddress = "TV5zxwvW5DxKQtMAJHYeMcsN1RM9D2e7ng"; | |
$senderHexAddress = "41d1b3410f82d9bb660ee0402d0e19e185cbf45ba3"; | |
$senderPrivateKey = "f22f0cca9c7dc67628db510480e5b83b5a9f490974429481a15112c48d13594c"; | |
/** Receiver Address Generated, save the info */ | |
$receiverAddress = "TWLTgsCeLUN8pMz2B1eLd18k2Z1ta7hxRG"; | |
$receiverHexAddress = "41df6782aa08af50a1e02f44b73b654cdb25e2cc1d"; | |
$receiverPrivateKey = "304393c3223365e934ae5ec699de43db35ce2ad68c92b494b3dfbe30565a95c54"; | |
/** @var $contractAddress */ | |
$contractAddress = "TDpEU7wg6Tr1t4X5vkgYQPLMSucDy94dzz"; | |
$smartContractHexAddress = "412a2dfbd4d9a608551c99317aa3ec24519542d321"; | |
///** Generate Address | |
// * @param $tronClient | |
// * @return mixed | |
// */ | |
//function generateAddress($tronClient){ | |
// return $tronClient->generateAddress(); | |
//} | |
//$addressCreated = generateAddress($tronClient); | |
//echo "<h2>Acount Created</h2>"; | |
//print_r($addressCreated); | |
//echo "<br>"; | |
// | |
//$accountCreated = $tronClient->createAccount($senderHexAddress, $addressCreated["hexAddress"], $senderPrivateKey); | |
//print_r($accountCreated); | |
// ADDRESS GENERATED | |
$privateKey = "522f5a88cf68c4ef87cec659538156ad001565549478b9ddb38bdb3528478d8d"; | |
$address = "TYbkZiMLe9La1MB9nQrBnfEQL8B5XKoiYL"; | |
$hexAddress = "41f83c16df3fb55a958d69086232e7dfc887401276"; | |
/*GET ACCOUNT*/ | |
echo "<h3>Get Account</h3>"; | |
$getAccount = $tronClient->getAccount($hexAddress); | |
echo "<b>Output:</b><br>"; | |
print_r($getAccount); | |
/*GET ACCOUNT UPDATE*/ | |
echo "<h3>Get Account Update</h3>"; | |
$getUpdateAccount = $tronClient->updateAccount("Mista Gangsta", $senderHexAddress, $senderPrivateKey); | |
echo "<b>Output:</b><br>"; | |
print_r($getUpdateAccount); | |
// /*GET ACCOUNT Resource*/ | |
echo "<h3>Get Account Resource</h3>"; | |
$getAccountReference = $tronClient->getAccountResource($senderHexAddress); | |
echo "<b>Output:</b><br>"; | |
print_r($getAccountReference); | |
// /*Get Account Net*/ | |
echo "<h3>Get Account Net</h3>"; | |
$getAccountReference = $tronClient->getAccountNet($senderHexAddress); | |
echo "<b>Output:</b><br>"; | |
print_r($getAccountReference); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment