diff --git a/index.html b/index.html index 3268574..820a957 100644 --- a/index.html +++ b/index.html @@ -381,35 +381,36 @@ try { const [contractId] = state.wildcards if (!contractId) return; - // todo: load contract variable dynamically const contract = splitContractNameAddress(contractId); const contractInfo = await getContractInfo(contract) + const { contractType, contractSubtype, accepting_token, selling_token } = contractInfo const detailsToFetch = [getContractTransactions(contract), getContractParticipants(contract)] - console.log(contractInfo) - if (contractInfo.contractType === 'continuos-event' && contractInfo.contractSubtype === 'tokenswap') + if (contractType === 'continuos-event' && contractSubtype === 'tokenswap') detailsToFetch.push(getContractDeposits(contract)) - console.log(detailsToFetch) let [contractTransactions, contractParticipants, contractDeposits] = await Promise.all(detailsToFetch) - // todo : check the type of contract & then further checks like fetching details of contractParticipant renderElem(getRef("page_container"), html`${render.contractPage(contractInfo)}`); getRef("page_title").textContent = "Contract"; - const { contractName, contractAddress, contractType, contractSubtype, participantInfo } = contractParticipants - // append latest transactions renderTransactions('contract_transaction_container', contractTransactions) console.log(contractParticipants) - switch (contractInfo.contractType) { + switch (contractType) { case 'one-time-event': - let winners = [] - for (const participant in contractParticipants) { - if (contractParticipants[participant].winningAmount) - winners.push(contractParticipants[participant]) - } - if (winners.length) { - renderElem(document.getElementById('winners_container'), html`${winners.map(winner => render.contractChoiceCard(winner))}`) - } else { - renderElem(document.getElementById('winners_container'), html`