Workflow updating files of floscout

This commit is contained in:
RanchiMall Dev 2025-07-28 13:08:51 +00:00
parent 0903baa786
commit e8c1f871c8

View File

@ -2973,7 +2973,15 @@ function parseTransactions(txList) {
const url = `${floGlobals.floApiUrl}/api/v2/address/${floAddress}?details=basic`; const url = `${floGlobals.floApiUrl}/api/v2/address/${floAddress}?details=basic`;
console.log(`📡 Fetching address balance from: ${url}`); console.log(`📡 Fetching address balance from: ${url}`);
const balance = await fetchJson(url); const balance = await fetchJson(url);
console.log("📦 Balance info:", balance); console.log("📦 Raw balance info:", balance);
// Add normalized balanceFLO for uniform usage between Address Indexer and Blockbook
if ("balanceSat" in balance) {
balance.balance = balance.balance; // already in FLO
} else {
balance.balance = parseFloat(balance.balance) / 1e8; // convert from satoshi string
}
return balance; return balance;
} catch (error) { } catch (error) {
console.error("❌ Error fetching address balance:", error); console.error("❌ Error fetching address balance:", error);
@ -2983,6 +2991,7 @@ function parseTransactions(txList) {
async function getAddressTxs(floAddress) { async function getAddressTxs(floAddress) {
try { try {
const url = `${floGlobals.tokenApiUrl}/api/v2/floAddressTransactions/${floAddress}`; const url = `${floGlobals.tokenApiUrl}/api/v2/floAddressTransactions/${floAddress}`;
@ -3188,12 +3197,26 @@ async function processNavbarSearch() {
async function getAllSuggestions() { async function getAllSuggestions() {
console.log(`📡 Fetching token and smart contract list from ${floGlobals.tokenApiUrl}/api/v2/tokenSmartContractList`); console.log(`📡 Checking cached token and smart contract list...`);
window.allSuggestions = []; window.allSuggestions = [];
try { // Check sessionStorage
let { tokens, smartContracts } = await fetchJson(`${floGlobals.tokenApiUrl}/api/v2/tokenSmartContractList`); let cached = sessionStorage.getItem("tokenSmartContractList");
console.log("✅ Token & Smart Contract list received:", { tokensCount: tokens.length, smartContractsCount: smartContracts.length }); if (cached) {
console.log("📦 Loaded token & contract list from session cache.");
cached = JSON.parse(cached);
} else {
// Fetch from network
console.log(`🌐 Fetching from: ${floGlobals.tokenApiUrl}/api/v2/tokenSmartContractList`);
cached = await fetchJson(`${floGlobals.tokenApiUrl}/api/v2/tokenSmartContractList`);
sessionStorage.setItem("tokenSmartContractList", JSON.stringify(cached));
console.log("✅ Fetched and cached:", {
tokensCount: cached.tokens.length,
smartContractsCount: cached.smartContracts.length
});
}
const { tokens, smartContracts } = cached;
floGlobals.tokenList = tokens; floGlobals.tokenList = tokens;
floGlobals.smartContractList = {}; floGlobals.smartContractList = {};
@ -3213,13 +3236,10 @@ async function processNavbarSearch() {
}); });
console.log("🔍 Search suggestions initialized with", allSuggestions.length, "items"); console.log("🔍 Search suggestions initialized with", allSuggestions.length, "items");
} catch (err) {
console.error("❌ Failed to fetch suggestions:", err);
throw err;
}
} }
function initSmartContractCreation() { function initSmartContractCreation() {
const [selectedSCTemplate, setSelectedSCTemplate] = $signal(null); const [selectedSCTemplate, setSelectedSCTemplate] = $signal(null);
const [priceType, setPriceType] = $signal('predetermined'); const [priceType, setPriceType] = $signal('predetermined');