Skip to content

Commit

Permalink
Update to use with composer
Browse files Browse the repository at this point in the history
  • Loading branch information
Wawilow committed Mar 10, 2024
1 parent b3efdbd commit 399dc3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 44 deletions.
50 changes: 8 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ A PHP API for interacting with the Tron Protocol

## Install

```bash
> composer require wawilow/tron-api --ignore-platform-reqs
```

PS: To use Original library
```bash
> composer require iexbase/tron-api --ignore-platform-reqs
```
Expand All @@ -18,51 +23,12 @@ The following versions of PHP are supported by this version.

* PHP 7.4

## Example Usage

```php
use IEXBase\TronAPI\Tron;

$fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
$solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
$eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');

try {
$tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
} catch (\IEXBase\TronAPI\Exception\TronException $e) {
exit($e->getMessage());
}


$this->setAddress('..');
//Balance
$tron->getBalance(null, true);

// Transfer Trx
var_dump($tron->send('to', 1.5));

//Generate Address
var_dump($tron->createAccount());

//Get Last Blocks
var_dump($tron->getLatestBlocks(2));

//Change account name (only once)
var_dump($tron->changeAccountName('address', 'NewName'));


// Contract
$tron->contract('Contract Address');



```

## Testing

``` bash
$ vendor/bin/phpunit
> composer install --ignore-platform-reqs
```

## Donations
**Tron(TRX)**: TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
** Author - Tron(TRX)**: TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
** Editor - Tron(TRX)**: TBKjxAsFPk9EMFu18WK6mT6bADyb6NgnkN
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"name": "iexbase/tron-api",
"name": "wawilow/tron-api",
"description": "A PHP API for interacting with Tron (Trx)",
"license": "MIT",
"type": "library",
"homepage": "https://github.com/iexbase/tron-api",
"homepage": "https://github.com/wawilow/tron-api",
"authors": [
{
"name": "Shamsudin Serderov",
"email": "steein.shamsudin@gmail.com"
},
{
"name": "George Wawilow",
"email": "wawilow@protonmail.com"
}
],
"keywords": [
Expand Down

0 comments on commit 399dc3e

Please sign in to comment.