diff --git a/index.html b/index.html index 362c5fe..326fd06 100644 --- a/index.html +++ b/index.html @@ -348,7 +348,7 @@ type="text" id="transactionInput" class="form-input" - placeholder="Enter TON address, private key, or transaction hash" + placeholder="Enter TON address or private key (TON/FLO/BTC)" /> = 51 && - input.length <= 56 - ) { - return true; + // Check for TON/FLO/BTC private key format (WIF - Wallet Import Format) + const base58Regex = /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/; + if (base58Regex.test(input) && input.length >= 51 && input.length <= 56) { + // Only accept private keys with specific prefixes that can be converted to TON + const validPrivateKeyPrefixes = ['R',, 'K', 'L', 'T']; + if (validPrivateKeyPrefixes.some(prefix => input.startsWith(prefix))) { + return true; + } + return false; // Reject other Base58 strings (like BTC addresses) } - if (input.length === 44 && /^[A-Za-z0-9+/]{43}=?$/.test(input)) { - return false; - } - - if (input.length < 32 || input.length > 128) { - return false; - } - - return true; + // Reject any other input format + return false; } // Enhanced transaction loading with multi-chain support @@ -2414,8 +2408,7 @@ The input doesn't appear to be a valid TON address or private key. Please enter: - A TON address (starts with EQ, UQ, or kQ) - A hex private key (64 or 128 characters) + A TON address (starts with EQ, UQ) A TON/FLO/BTC private key @@ -2459,11 +2452,13 @@ tonPrivateKey ); finalAddress = address.toString(true, true, true); + finalAddress = await convertTob64(finalAddress); } else { // Try multi-chain conversion (TON/FLO/BTC) const walletData = await tonCrypto.recoverFromInput(input); if (walletData.TON && walletData.TON.address) { finalAddress = walletData.TON.address; + finalAddress = await convertTob64(finalAddress); } else { throw new Error( "Invalid input: not a valid TON address or private key"
The input doesn't appear to be a valid TON address or private key.
Please enter: