mollsoft/laravel-tron-module

v3.0.1 2024-04-24 12:20 UTC

This package is auto-updated.

Last update: 2024-04-24 12:21:04 UTC


README

Pest Laravel Expectations

Latest Version on Packagist Php Version Php Version Total Downloads

Website Telegram

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