This commit is contained in:
hashbro
2026-08-07 05:21:44 +08:00
parent 5145b6f719
commit 78b61f85d2
325 changed files with 9874 additions and 1738 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace Tests\Unit;
use App\Services\Chain\TronDriver;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class TronDriverTest extends TestCase
{
private const MNEMONIC = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about';
#[Test]
public function derives_known_tron_address_from_bip44_path(): void
{
$driver = new TronDriver;
$this->assertSame(
'TUEZSdKsoDHQMeZwihtdoBiN46zxhGWYdH',
$driver->deriveAddress(self::MNEMONIC, 0)
);
}
#[Test]
public function validates_tron_base58_addresses(): void
{
$driver = new TronDriver;
$this->assertTrue($driver->isValidAddress('TUEZSdKsoDHQMeZwihtdoBiN46zxhGWYdH'));
$this->assertFalse($driver->isValidAddress('0xab5c66752a9e8167967685f1450532fb96d5d24f'));
$this->assertFalse($driver->isValidAddress('Tinvalid'));
}
}