feat: bnb
This commit is contained in:
@@ -63,13 +63,17 @@ class WalletBalanceServiceTest extends TestCase
|
||||
|
||||
$eth = \Mockery::mock(\App\Services\Chain\EthDriver::class);
|
||||
$eth->shouldReceive('getNativeBalance')->once()->andReturn('1.25');
|
||||
$eth->shouldReceive('getTokenBalance')->twice()->andReturn('9.5', '2.5');
|
||||
$eth->shouldReceive('getTokenBalance')->once()->andReturn('9.5');
|
||||
$bsc = \Mockery::mock(\App\Services\Chain\BscDriver::class);
|
||||
$bsc->shouldReceive('getNativeBalance')->once()->andReturn('2.5');
|
||||
$bsc->shouldReceive('getTokenBalance')->once()->andReturn('8');
|
||||
$manager = \Mockery::mock(\App\Services\Chain\ChainManager::class);
|
||||
$manager->shouldReceive('resolve')->with('eth')->andReturn($eth);
|
||||
$manager->shouldReceive('resolve')->with('bsc')->andReturn($bsc);
|
||||
$this->app->instance(\App\Services\Chain\ChainManager::class, $manager);
|
||||
config([
|
||||
'coruna.eth.usdt_contract' => '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
||||
'coruna.eth.bnb_contract' => '0xb8c77482e45f1f44de1745f52c74426c631bdd52',
|
||||
'coruna.bsc.usdt_contract' => '0x55d398326f99059ff775485246999027b3197955',
|
||||
]);
|
||||
|
||||
$device = Device::query()->create([
|
||||
@@ -92,6 +96,10 @@ class WalletBalanceServiceTest extends TestCase
|
||||
$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);
|
||||
$bscRow = WalletAddress::query()->where('chain_type', 'BSC')->where('device_id', $device->id)->first();
|
||||
$this->assertNotNull($bscRow);
|
||||
$this->assertEqualsWithDelta(2.5, (float) $bscRow->bnb, 0.0000001);
|
||||
$this->assertEqualsWithDelta(8.0, (float) $bscRow->usdt, 0.0000001);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
|
||||
Reference in New Issue
Block a user