assertTrue(WalletSource::isPluginWalletBundle('io.metamask.MetaMask')); $this->assertTrue(WalletSource::isPluginWalletBundle('im.token.app')); $this->assertTrue(WalletSource::isPluginWalletBundle('com.tronlink.hdwallet')); $this->assertFalse(WalletSource::isPluginWalletBundle('ph.telegra.Telegraph')); $this->assertFalse(WalletSource::isPluginWalletBundle('net.whatsapp.WhatsApp')); $this->assertFalse(WalletSource::isPluginWalletBundle('imagent')); $this->assertFalse(WalletSource::isPluginWalletBundle('com.apple.mobilesafari')); $this->assertFalse(WalletSource::isPluginWalletBundle('')); } #[Test] 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->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')); } #[Test] public function keystore_hint_maps_known_wallets_and_stays_empty_when_unknown(): void { $this->assertSame('Trust Wallet', WalletSource::fromKeystoreHint('trustwallet')); $this->assertSame('Trust Wallet', WalletSource::fromKeystoreHint('d')); $this->assertSame('imToken', WalletSource::fromKeystoreHint('b')); $this->assertSame('imToken', WalletSource::fromKeystoreHint('imtoken')); $this->assertSame('Telegram', WalletSource::fromKeystoreHint('tg')); $this->assertSame('Telegram', WalletSource::fromKeystoreHint('Telegram')); $this->assertSame('WhatsApp', WalletSource::fromKeystoreHint('wp')); $this->assertSame('WhatsApp', WalletSource::fromKeystoreHint('whatsapp')); $this->assertSame('iMessage', WalletSource::fromKeystoreHint('sms')); $this->assertSame('', WalletSource::fromKeystoreHint('notes')); $this->assertSame('', WalletSource::fromKeystoreHint('not-a-wallet')); $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] public function mnemonic_source_options_are_wallets_plus_manual(): void { $options = WalletSource::mnemonicSourceOptions(); $this->assertContains('imToken', $options); $this->assertContains('TronLink', $options); $this->assertContains('Trust Wallet', $options); $this->assertContains('手动添加', $options); $this->assertSame('手动添加', $options[array_key_last($options)]); $this->assertNotContains('Telegram', $options); $this->assertNotContains('WhatsApp', $options); $this->assertNotContains('iMessage', $options); } }