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,38 +3197,49 @@ 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.");
floGlobals.tokenList = tokens; cached = JSON.parse(cached);
floGlobals.smartContractList = {}; } else {
smartContracts.forEach(contract => { // Fetch from network
floGlobals.smartContractList[`${contract.contractName}_${contract.contractAddress}`] = contract; console.log(`🌐 Fetching from: ${floGlobals.tokenApiUrl}/api/v2/tokenSmartContractList`);
allSuggestions.push(`${contract.contractName}_${contract.contractAddress}`); 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
}); });
allSuggestions = allSuggestions.concat(tokens);
window.flexSearchIndex = new FlexSearch.Index({
tokenize: "reverse",
suggest: true
});
allSuggestions.forEach((suggestion, index) => {
flexSearchIndex.add(index, suggestion);
});
console.log("🔍 Search suggestions initialized with", allSuggestions.length, "items");
} catch (err) {
console.error("❌ Failed to fetch suggestions:", err);
throw err;
} }
const { tokens, smartContracts } = cached;
floGlobals.tokenList = tokens;
floGlobals.smartContractList = {};
smartContracts.forEach(contract => {
floGlobals.smartContractList[`${contract.contractName}_${contract.contractAddress}`] = contract;
allSuggestions.push(`${contract.contractName}_${contract.contractAddress}`);
});
allSuggestions = allSuggestions.concat(tokens);
window.flexSearchIndex = new FlexSearch.Index({
tokenize: "reverse",
suggest: true
});
allSuggestions.forEach((suggestion, index) => {
flexSearchIndex.add(index, suggestion);
});
console.log("🔍 Search suggestions initialized with", allSuggestions.length, "items");
} }
function initSmartContractCreation() { function initSmartContractCreation() {
const [selectedSCTemplate, setSelectedSCTemplate] = $signal(null); const [selectedSCTemplate, setSelectedSCTemplate] = $signal(null);
const [priceType, setPriceType] = $signal('predetermined'); const [priceType, setPriceType] = $signal('predetermined');