diff --git a/index.html b/index.html index b4ba309..7ae713e 100644 --- a/index.html +++ b/index.html @@ -87,6 +87,10 @@ floGlobals.myBscID = floGlobals.myEthID; // MATIC (Polygon) uses same address format as Ethereum floGlobals.myMaticID = floGlobals.myEthID; + // Arbitrum uses same address format as Ethereum + floGlobals.myArbID = floGlobals.myEthID; + // Optimism uses same address format as Ethereum + floGlobals.myOpID = floGlobals.myEthID; // HBAR (Hedera) uses same address format as Ethereum floGlobals.myHbarID = floGlobals.myEthID; @@ -264,6 +268,8 @@ + +
@@ -2062,15 +2068,17 @@ removeNotificationBadge('#chat_page_button') if (floGlobals.idInterval) clearInterval(floGlobals.idInterval) - // Cycle through all blockchain addresses: FLO -> BTC -> ETH -> AVAX -> BSC -> MATIC -> HBAR -> XRP -> SUI -> TON -> TRON -> DOGE -> LTC -> BCH -> DOT -> ALGO -> XLM -> SOL + let activeChain = localStorage.getItem(`${floGlobals.application}#activeChain`) || 'FLO'; let currentIdIndex = 0 - const idList = [ + const allIds = [ { id: floGlobals.myFloID, label: 'FLO' }, { id: floGlobals.myBtcID, label: 'BTC' }, { id: floGlobals.myEthID, label: 'ETH' }, { id: floGlobals.myAvaxID, label: 'AVAX' }, { id: floGlobals.myBscID, label: 'BSC' }, { id: floGlobals.myMaticID, label: 'MATIC' }, + { id: floGlobals.myArbID, label: 'ARB' }, + { id: floGlobals.myOpID, label: 'OP' }, { id: floGlobals.myHbarID, label: 'HBAR' }, { id: floGlobals.myXrpID, label: 'XRP' }, { id: floGlobals.mySuiID, label: 'SUI' }, @@ -2084,7 +2092,16 @@ { id: floGlobals.myXlmID, label: 'XLM' }, { id: floGlobals.mySolID, label: 'SOL' }, { id: floGlobals.myAdaID, label: 'ADA' } - ].filter(item => item.id) + ]; + + const idList = allIds.filter(item => { + if (!item.id) return false; + if (item.label === 'FLO') return true; // Always include FLO + if (item.label === activeChain) return true; // Include active chain + // For EVM compatible chains which share the ETH ID: + if (['ETH', 'AVAX', 'BSC', 'MATIC', 'ARB', 'OP', 'HBAR'].includes(activeChain) && item.label === activeChain) return true; + return false; + }); floGlobals.idInterval = setInterval(() => { currentIdIndex = (currentIdIndex + 1) % idList.length document.querySelectorAll('.user-profile-id').forEach(el => el.textContent = idList[currentIdIndex].id) @@ -3284,6 +3301,14 @@ My MATIC (Polygon) address
+
+ My ARB (Arbitrum) address + +
+
+ My OP (Optimism) address + +
My HBAR (Hedera) address diff --git a/scripts/blockchainAddresses.js b/scripts/blockchainAddresses.js index eb48a4f..d708a91 100644 --- a/scripts/blockchainAddresses.js +++ b/scripts/blockchainAddresses.js @@ -9,6 +9,8 @@ * - AVAX (Avalanche C-Chain) - same as ETH (EVM-compatible) * - BSC (Binance Smart Chain) - same as ETH (EVM-compatible) * - MATIC (Polygon) - same as ETH (EVM-compatible) + * - ARB (Arbitrum) - same as ETH (EVM-compatible) + * - OP (Optimism) - same as ETH (EVM-compatible) * - HBAR (Hedera) - same as ETH (EVM-compatible) * - XRP (Ripple) - via xrpl library * - SUI - via nacl + BLAKE2b @@ -423,6 +425,8 @@ async function deriveAllBlockchainAddresses(wif) { bsc: null, matic: null, hbar: null, + arb: null, + op: null, xrp: null, sui: null, ton: null, @@ -438,13 +442,15 @@ async function deriveAllBlockchainAddresses(wif) { }; try { - // BSC, MATIC, and HBAR use same address as ETH (requires public key, not WIF) + // BSC, MATIC, HBAR, ARB, and OP use same address as ETH (requires public key, not WIF) // These will be set from floGlobals.myEthID in the main code addresses.bsc = null; // Set in main code as same as ETH addresses.matic = null; // Set in main code as same as ETH addresses.hbar = null; // Set in main code as same as ETH + addresses.arb = null; // Set in main code as same as ETH + addresses.op = null; // Set in main code as same as ETH } catch (e) { - console.warn("BSC/MATIC/HBAR derivation failed:", e); + console.warn("BSC/MATIC/HBAR/ARB/OP derivation failed:", e); } try { addresses.xrp = convertWIFtoXrpAddress(wif); diff --git a/scripts/messenger.js b/scripts/messenger.js index 1441241..262fb48 100644 --- a/scripts/messenger.js +++ b/scripts/messenger.js @@ -86,7 +86,7 @@ if ((address.length === 33 || address.length === 34) && /^[1-9A-HJ-NP-Za-km-z]+$/.test(address)) { return floCrypto.validateAddr(address) || true; } - // Ethereum/EVM addresses (0x prefix, 40 hex chars) - ETH, AVAX, BSC, MATIC + // Ethereum/EVM addresses (0x prefix, 40 hex chars) - ETH, AVAX, BSC, MATIC, ARB, OP if (/^0x[a-fA-F0-9]{40}$/.test(address)) return true; // SUI addresses (0x prefix, 64 hex chars) if (/^0x[a-fA-F0-9]{64}$/.test(address)) return true; @@ -152,6 +152,8 @@ case 'AVAX': case 'BSC': case 'MATIC': + case 'ARB': + case 'OP': case 'HBAR': proxyID = floEthereum.ethAddressFromCompressedPublicKey(user.public); break; case 'BTC': proxyID = floGlobals.myBtcID; break; @@ -632,6 +634,8 @@ case 'AVAX': case 'BSC': case 'MATIC': + case 'ARB': + case 'OP': case 'HBAR': addIfValid(floEthereum.ethAddressFromCompressedPublicKey(user.public)); break; @@ -655,7 +659,8 @@ const allDerived = [ floEthereum.ethAddressFromCompressedPublicKey(user.public), floGlobals.myBtcID, floGlobals.myAvaxID, floGlobals.myBscID, - floGlobals.myMaticID, floGlobals.myHbarID, floGlobals.myXrpID, + floGlobals.myMaticID, floGlobals.myArbID, floGlobals.myOpID, + floGlobals.myHbarID, floGlobals.myXrpID, floGlobals.mySuiID, floGlobals.myTonID, floGlobals.myTronID, floGlobals.myDogeID, floGlobals.myLtcID, floGlobals.myBchID, floGlobals.myDotID, floGlobals.myAlgoID, floGlobals.myXlmID,