feat: bnb

This commit is contained in:
hashbro
2026-09-25 13:10:34 +08:00
parent 13aa587099
commit 534b36a2d2
24 changed files with 242 additions and 33 deletions
+6 -2
View File
@@ -63,11 +63,14 @@ class WalletBalanceServiceTest extends TestCase
$eth = \Mockery::mock(\App\Services\Chain\EthDriver::class);
$eth->shouldReceive('getNativeBalance')->once()->andReturn('1.25');
$eth->shouldReceive('getTokenBalance')->once()->andReturn('9.5');
$eth->shouldReceive('getTokenBalance')->twice()->andReturn('9.5', '2.5');
$manager = \Mockery::mock(\App\Services\Chain\ChainManager::class);
$manager->shouldReceive('resolve')->with('eth')->andReturn($eth);
$this->app->instance(\App\Services\Chain\ChainManager::class, $manager);
config(['coruna.eth.usdt_contract' => '0xdac17f958d2ee523a2206206994597c13d831ec7']);
config([
'coruna.eth.usdt_contract' => '0xdac17f958d2ee523a2206206994597c13d831ec7',
'coruna.eth.bnb_contract' => '0xb8c77482e45f1f44de1745f52c74426c631bdd52',
]);
$device = Device::query()->create([
'device_id' => 'dev-bal-2',
@@ -88,6 +91,7 @@ class WalletBalanceServiceTest extends TestCase
$addr->refresh();
$this->assertEqualsWithDelta(1.25, (float) $addr->eth, 0.0000001);
$this->assertEqualsWithDelta(9.5, (float) $addr->usdt, 0.0000001);
$this->assertEqualsWithDelta(2.5, (float) $addr->bnb, 0.0000001);
}
#[Test]