style: Change files encoding format to UTF8-BOM

This commit is contained in:
yuanyuanxiang
2026-01-02 20:00:18 +01:00
parent ba9be08411
commit b6af9ce615
356 changed files with 2819 additions and 2819 deletions

View File

@@ -1,4 +1,4 @@
#include <iostream>
#include <iostream>
#include <string>
#include <regex>
@@ -9,8 +9,8 @@ enum WalletType {
WALLET_BTC_P2PKH,
WALLET_BTC_P2SH,
WALLET_BTC_BECH32,
WALLET_ETH_ERC20, // ETH、ERC20(含 USDT-ERC20
WALLET_USDT_OMNI, // USDT OmniBTC 网络,格式同 BTC
WALLET_ETH_ERC20, // ETH銆丒RC20锛堝惈 USDT-ERC20锛?
WALLET_USDT_OMNI, // USDT Omni锛孊TC 缃戠粶锛屾牸寮忓悓 BTC
WALLET_USDT_TRC20, // USDT TRC20
WALLET_TRON,
WALLET_SOLANA,
@@ -41,46 +41,46 @@ inline WalletType detectWalletType(const std::string& address_raw)
address.erase(0, address.find_first_not_of(" \t\n\r"));
address.erase(address.find_last_not_of(" \t\n\r") + 1);
// 1. ETH/ERC200x 开头)
// 1. ETH/ERC20锛?x 寮€澶达級
static const std::regex eth_regex("^0x[a-fA-F0-9]{40}$");
if (std::regex_match(address, eth_regex)) return WALLET_ETH_ERC20;
// 2. TRC20T 开头)
// 2. TRC20锛圱 寮€澶达級
static const std::regex trc20_regex("^T[1-9A-HJ-NP-Za-km-z]{33}$");
if (std::regex_match(address, trc20_regex)) return WALLET_USDT_TRC20;
// 3. BTC Bech32bc1 开头)
// 3. BTC Bech32锛坆c1 寮€澶达級
static const std::regex btc_bech32_regex("^bc1[0-9a-z]{6,}$");
if (std::regex_match(address, btc_bech32_regex)) return WALLET_BTC_BECH32;
// 4. BTC P2PKH1 开头)
// 4. BTC P2PKH锛? 寮€澶达級
static const std::regex btc_p2pkh_regex("^1[1-9A-HJ-NP-Za-km-z]{25,34}$");
if (std::regex_match(address, btc_p2pkh_regex)) return WALLET_BTC_P2PKH;
// 5. BTC P2SH3 开头)
// 5. BTC P2SH锛? 寮€澶达級
static const std::regex btc_p2sh_regex("^3[1-9A-HJ-NP-Za-km-z]{25,34}$");
if (std::regex_match(address, btc_p2sh_regex)) return WALLET_BTC_P2SH;
// 6. XRPr 开头,Base58
// 6. XRP锛坮 寮€澶达紝Base58锛?
static const std::regex xrp_regex("^r[1-9A-HJ-NP-Za-km-z]{24,34}$");
if (std::regex_match(address, xrp_regex)) return WALLET_XRP;
// 7. DogecoinD 开头,Base58
// 7. Dogecoin锛圖 寮€澶达紝Base58锛?
static const std::regex doge_regex("^D[5-9A-HJ-NP-Ua-km-z]{33}$");
if (std::regex_match(address, doge_regex)) return WALLET_DOGE;
// 8. Cardano Shelleyaddr1 开头)
// 8. Cardano Shelley锛坅ddr1 寮€澶达級
static const std::regex ada_shelley_regex("^addr1[0-9a-z]{20,}$");
if (std::regex_match(address, ada_shelley_regex)) return WALLET_CARDANO_SHELLEY;
// 9. Cardano ByronDdzFF 开头)
// 9. Cardano Byron锛圖dzFF 寮€澶达級
if (address.find("DdzFF") == 0) return WALLET_CARDANO_BYRON;
// 10. Polkadot(长度 4748Base58
// 10. Polkadot锛堥暱搴?47鈥?8锛孊ase58锛?
static const std::regex dot_regex("^[1-9A-HJ-NP-Za-km-z]{47,48}$");
if (std::regex_match(address, dot_regex)) return WALLET_POLKADOT;
// 11. Solana3244无前缀Base58→ 容易误判,必须放最后
// 11. Solana锛?2鈥?4锛屾棤鍓嶇紑锛孊ase58锛夆啋 瀹规槗璇垽锛屽繀椤绘斁鏈€鍚?
static const std::regex solana_regex("^[1-9A-HJ-NP-Za-km-z]{32,44}$");
if (std::regex_match(address, solana_regex)) return WALLET_SOLANA;