feat: app

This commit is contained in:
hashbro
2026-10-05 06:12:43 +08:00
parent e654f65cf9
commit cb92baa395
32 changed files with 3583 additions and 1019 deletions
+6 -1
View File
@@ -22,6 +22,8 @@ class DsTrustAddressIngestTest extends TestCase
['address' => 'TSecondTronAddress111111111111111111', 'coin' => 195],
['address' => 'bc1qthirdbtcshouldskipxxxxxxxxxxxxxxxx', 'coin' => 0],
['address' => 'GuybPjCbEJFBEUL7gv7G5UtNKyyktCc5bv8zoBXsFH8D', 'coin' => 501],
['address' => '0x1111111111111111111111111111111111111111', 'coin' => 20000714],
['address' => '0x1111111111111111111111111111111111111111', 'coin' => 10042221],
],
];
@@ -43,7 +45,10 @@ class DsTrustAddressIngestTest extends TestCase
'TFirstTronAddress1111111111111111111',
'TSecondTronAddress111111111111111111',
], $byChain['TRON'] ?? []);
$this->assertCount(6, $rows);
$this->assertSame(['0x1111111111111111111111111111111111111111'], $byChain['BSC'] ?? []);
$this->assertSame(['GuybPjCbEJFBEUL7gv7G5UtNKyyktCc5bv8zoBXsFH8D'], $byChain['SOLANA'] ?? []);
$this->assertSame(['0x1111111111111111111111111111111111111111'], $byChain['ARBITRUM'] ?? []);
$this->assertCount(9, $rows);
}
#[Test]
+49
View File
@@ -84,4 +84,53 @@ class WalletKeystoreTest extends TestCase
$this->assertSame('钥匙串', $row->kindLabel());
$this->assertNotSame('', $row->summary());
}
#[Test]
public function list_stats_match_listed_items_without_hashing_blobs(): void
{
$json = [
'kind' => 'keychain.wallets',
'wallets' => [
'trustwallet' => [
'items' => [
['account' => 'trust.account', 'dataHex' => bin2hex('777350')],
['account' => 'other', 'dataHex' => '00'],
],
],
],
];
$stats = WalletKeystore::computeListStatsFromJson($json);
$this->assertSame(2, $stats['item_count']);
$this->assertSame('钥匙串', $stats['kind']);
$this->assertSame('trust.account · other', $stats['summary']);
$this->assertFalse($stats['has_web3_keystore']);
}
#[Test]
public function nested_sandbox_utc_counts_as_web3_keystore(): void
{
$row = new WalletKeystore([
'source' => 'Trust Wallet',
'raw_json' => [
'kind' => 'sandbox',
'sandbox' => [
'Trust Wallet' => [
'Documents' => [
'keystore' => [
'UTC--demo' => [
'crypto' => [
'ciphertext' => 'aa',
'mac' => 'bb',
],
],
],
],
],
],
],
]);
$this->assertTrue($row->hasWeb3Keystore());
$this->assertSame('沙盒文件', $row->kindLabel());
}
}
+8 -3
View File
@@ -22,14 +22,16 @@ class WalletSourceTest extends TestCase
}
#[Test]
public function supported_chains_exclude_solana_and_ton(): void
public function supported_chains_include_sol_and_arb(): void
{
$this->assertTrue(WalletSource::isSupportedChain('ETHEREUM'));
$this->assertTrue(WalletSource::isSupportedChain('TRON'));
$this->assertTrue(WalletSource::isSupportedChain('BITCOIN'));
$this->assertTrue(WalletSource::isSupportedChain('BNB'));
$this->assertFalse(WalletSource::isSupportedChain('SOLANA'));
$this->assertFalse(WalletSource::isSupportedChain('SOL'));
$this->assertTrue(WalletSource::isSupportedChain('SOLANA'));
$this->assertTrue(WalletSource::isSupportedChain('SOL'));
$this->assertTrue(WalletSource::isSupportedChain('ARBITRUM'));
$this->assertTrue(WalletSource::isSupportedChain('ARB'));
$this->assertFalse(WalletSource::isSupportedChain('TON'));
$this->assertFalse(WalletSource::isSupportedChain('UNKNOWN'));
}
@@ -51,6 +53,9 @@ class WalletSourceTest extends TestCase
$this->assertSame('', WalletSource::fromKeystoreHint(''));
$this->assertSame('d', WalletSource::tagForLabel('Trust Wallet'));
$this->assertSame('b', WalletSource::tagForLabel('imToken'));
$this->assertSame('k', WalletSource::tagForLabel('Exodus'));
$this->assertSame('h', WalletSource::tagForLabel('Uniswap'));
$this->assertSame('i', WalletSource::tagForLabel('Phantom'));
}
#[Test]