Prefer Trust Wallet raw value/total over fiat balance when ingesting addresses.
Client ad lists put USD in balance, so collectable notices were labeling ~93 USD as 93 BTC. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -71,4 +71,32 @@ class IngestServiceNormalizeTest extends TestCase
|
||||
$this->assertSame([null, null], IngestService::decodeHexCounterPair('bad'));
|
||||
$this->assertSame([null, null], IngestService::decodeHexCounterPair(null));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function trust_ad_list_uses_raw_sats_not_fiat_balance(): void
|
||||
{
|
||||
$ingest = $this->app->make(IngestService::class);
|
||||
$method = new \ReflectionMethod(IngestService::class, 'normalizeStatusAddressRows');
|
||||
|
||||
$rows = $method->invoke($ingest, [
|
||||
'a' => 'd',
|
||||
'ad' => [
|
||||
[
|
||||
'symbol' => 'BTC',
|
||||
'name' => 'Bitcoin',
|
||||
'address' => 'bc1qw8m95ulfgkanvmlx3sw86wddxquk25ngen6dk0',
|
||||
'decimals' => 8,
|
||||
'balance' => 93.01116944632426,
|
||||
'value' => '112737',
|
||||
'total' => '112737',
|
||||
'raw_coin' => 0,
|
||||
'raw_type' => 'coin',
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertCount(1, $rows);
|
||||
$this->assertSame('bc1qw8m95ulfgkanvmlx3sw86wddxquk25ngen6dk0', $rows[0]['address']);
|
||||
$this->assertEqualsWithDelta(0.00112737, (float) $rows[0]['balance']['BTC'], 1e-12);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user