takpesar/tron

A PHP library to create Tron wallet addresses and manage wallets using the Tron API

v1.0.1 2024-03-13 14:17 UTC

This package is auto-updated.

Last update: 2024-05-15 19:45:43 UTC


README

Tron ( TRX ) crypto currency API ! This library facilitates connectivity to the Tron network, enabling you to generate a personalized wallet address. This is achieved through utilization of the Tron API.

Installation

composer require takpesar/tron

Requirements

This package requires PHP 8 or later. GMP and curl extensions require this package

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use Tak\Tron\API;

$tron = new API();

$address = $tron->generateAddress();

var_dump($address);

$tron = new API(privatekey : $address->privatekey,wallet : $address->wallet);

$balance = $tron->getBalance();
print 'your balance : '.$balance;
print PHP_EOL;

try {
	$send = $tron->sendTron(to : 'TJZfm2PSQ38WNwzPqSBpTbVAynZpMEmfKR',amount : 10.5);
	print 'transaction : '.var_export($send,true);
} catch(Throwable $e){
	print 'transaction error : '.$e->getMessage();
}

Note Please see examples for more examples

Issues

Should you encounter any issues, please do not hesitate to reach out to us via email at loser.man.2007@gmail.com.

License

The MIT License (MIT). Please see LICENSE for more information.