mollsoft / laravel-tron-module
Laravel Tron Module
Requires
- php: ^8.1
- ext-ctype: *
- ext-decimal: *
- ext-gmp: *
- furqansiddiqui/bip39-mnemonic-php: ^0.1.7
- illuminate/contracts: ^10.0|^11.0
- kornrunner/secp256k1: ^0.2.0
- minter/minter-php-bip-44: ^1.2
- simplito/elliptic-php: ^1.0
- spatie/laravel-package-tools: ^1.15
- web3p/web3.php: ^0.1.6
README
Laravel Tron Module is a Laravel package for work with cryptocurrency Tron, with the support TRC-20 tokens.It allows you to generate HD wallets using mnemonic phrase, validate addresses, get addresses balances and resources, preview and send TRX/TRC-20 tokens. You can automate the acceptance and withdrawal of cryptocurrency in your application.
You can contact me for help in integrating payment acceptance into your project.
Requirements
The following versions of PHP are supported by this version.
- PHP 8.1 and older
- Laravel 10 or older
- PHP Extensions: Decimal, GMP, BCMath, CType.
Installation
You can install the package via composer:
composer require mollsoft/laravel-tron-module
After you can run installer using command:
php artisan tron:install
And run migrations:
php artisan migrate
Register Service Provider and Facade in app, edit config/app.php
:
'providers' => ServiceProvider::defaultProviders()->merge([ ..., \Mollsoft\LaravelTronModule\TronServiceProvider::class, ])->toArray(), 'aliases' => Facade::defaultAliases()->merge([ ..., 'Tron' => \Mollsoft\LaravelTronModule\Facades\Tron::class, ])->toArray(),
In file app/Console/Kernel
in method schedule(Schedule $schedule)
add
$schedule->command('tron:sync')
->everyMinute()
->runInBackground();
Commands
Synchronizing everything
php artisan tron:sync
Node synchronization
php artisan tron:sync-node NODE_ID
Wallet synchronization
php artisan tron:sync-wallet WALLET_ID
Address synchronization
php artisan tron:sync-address ADDRESS_ID
Create Tron Node. Before you need register account in https://trongrid.io and generate API Key.
php artisan tron:new-node
Create Tron Wallet.
php artisan tron:new-wallet
Generate Tron Address.
php artisan tron:new-address
Import watch only address.
php artisan tron:import-address
Create TRC-20 Token
php artisan tron:new-trc20