feat(wallet): add support for Arbitrum and Optimism networks

- Address Derivation: Added ARB and OP to blockchainAddresses.js and messenger.js EVM checks, utilizing myArbID and myOpID where myEthID is used for validation and proxy ID generation.
- Login Selection: Added Arbitrum and Optimism buttons to the blockchain_select_popup in index.html to allow users to specifically choose these networks when logging in with indistinguishable EVM hex keys.
- Profile UI Data: Added ARB and OP copy boxes to the expanded list of blockchain network identifiers in the user profile page.
- Profile Ticker Simplification: Refactored the animated profile ID ticker in index.html to only cycle between the base FLO address and the user's currently signed-in activeChain address
This commit is contained in:
void-57 2026-02-27 16:16:25 +05:30
parent 1ff93355f6
commit ec5c8495dd
3 changed files with 43 additions and 7 deletions

View File

@ -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 @@
<button class="button w-100" onclick="resolveBlockchainSelection('DOT')">Polkadot (DOT)</button>
<button class="button w-100" onclick="resolveBlockchainSelection('SOL')">Solana (SOL)</button>
<button class="button w-100" onclick="resolveBlockchainSelection('HBAR')">Hedera (HBAR)</button>
<button class="button w-100" onclick="resolveBlockchainSelection('ARB')">Arbitrum (ARB)</button>
<button class="button w-100" onclick="resolveBlockchainSelection('OP')">Optimism (OP)</button>
</div>
<div class="flex align-center gap-0-5 margin-top-1 margin-left-auto">
<button class="button cancel-button" onclick="resolveBlockchainSelection(null)">Cancel</button>
@ -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 @@
<b>My MATIC (Polygon) address</b>
<sm-copy class="user-matic-id" value=${floGlobals.myMaticID}></sm-copy>
</div>
<div class="grid gap-0-5">
<b>My ARB (Arbitrum) address</b>
<sm-copy class="user-arb-id" value=${floGlobals.myArbID}></sm-copy>
</div>
<div class="grid gap-0-5">
<b>My OP (Optimism) address</b>
<sm-copy class="user-op-id" value=${floGlobals.myOpID}></sm-copy>
</div>
<div class="grid gap-0-5">
<b>My HBAR (Hedera) address</b>
<sm-copy class="user-hbar-id" value=${floGlobals.myHbarID}></sm-copy>

View File

@ -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);

View File

@ -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,