Compare commits

...

10 Commits

Author SHA1 Message Date
sairaj mote
a78d329f9d Update index.html 2024-02-18 02:40:23 +05:30
Vivek Teega
983e959ac2
Merge branch 'ranchimall:master' into master 2023-11-22 15:10:43 +05:30
sairaj mote
8a262850e5 Bug fix 2023-11-13 19:47:57 +05:30
sairaj mote
0798a5bd89 Bug fix 2023-11-13 19:47:50 +05:30
sairaj mote
78ff09ba37 fixed contract participants not shown issue 2023-11-13 19:37:47 +05:30
sairaj mote
ad20b20ca2 Merge branch 'master' of https://github.com/ranchimall/floscout-testnet 2023-11-13 19:37:34 +05:30
sairaj mote
67d6d21a6d fixed contract participants not shown issue 2023-11-13 19:37:19 +05:30
Vivek Teega
b2812024bf Changing to testnet 2023-11-13 19:23:42 +05:30
sairaj mote
62e7f8b20a fixed off chain ttcs grouping 2023-11-13 19:21:32 +05:30
sairaj mote
9867e23ed4 Fixed grouping for off chain transactions 2023-11-13 19:21:07 +05:30

View File

@ -1191,8 +1191,8 @@
</li>`;
},
compoundTransactionCard(details) {
const { time, hash, sender, receiver, contractName, token, amount, offChainTransactions = [], userChoice } = details
const smartContract = `${contractName}-${receiver}`
const { time, hash, sender, receiver, contractName, token, amount, offChainTransactions = [], userChoice, contractAddress } = details
const smartContract = `${contractName}-${receiver || contractAddress}`
const renderedOffChainTransactions = offChainTransactions.map(tx => {
const { receiverAddress, tokenAmount, tokenIdentification } = tx
return html`
@ -1226,31 +1226,35 @@
</div>
<div class="contract-info">
<ul class="transfer-steps">
<li class="transfer-step">
<div class="flex flex-direction-column gap-0-5">
<div class="flex flex-direction-column">
<h5 class="label">Sender</h5>
<sm-copy value=${sender}>
<a href=${`#/address/${sender}`} class="address wrap-around">${sender}</a>
</sm-copy>
<p>Sent: <b>${amount} ${token}</b></p>
${sender ? html`
<li class="transfer-step">
<div class="flex flex-direction-column gap-0-5">
<div class="flex flex-direction-column">
<h5 class="label">Sender</h5>
<sm-copy value=${sender}>
<a href=${`#/address/${sender}`} class="address wrap-around">${sender}</a>
</sm-copy>
<p>Sent: <b>${amount} ${token}</b></p>
</div>
</div>
</div>
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"/></svg>
<div class="flex flex-direction-column">
<h5 class="label">Receiver (Smart contract)</h5>
<a href=${`#/contract/${smartContract}`} class="address wrap-around">${smartContract}</a>
</div>
</li>
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"/></svg>
<div class="flex flex-direction-column">
<h5 class="label">Receiver (Smart contract)</h5>
<a href=${`#/contract/${smartContract}`} class="address wrap-around">${smartContract}</a>
</div>
</li>
`: ''}
${renderedOffChainTransactions}
</ul>
<div class="flex align-center space-between flex-wrap gap-1">
<div class="flex flex-direction-column">
<h5 class="label">Transaction ID</h5>
<sm-copy value=${hash} clip-text></sm-copy>
${hash ? html`
<div class="flex align-center space-between flex-wrap gap-1">
<div class="flex flex-direction-column">
<h5 class="label">Transaction ID</h5>
<sm-copy value=${hash} clip-text></sm-copy>
</div>
<a href=${`#/transaction/${hash}`} class="button button--small button--colored">View details</a>
</div>
<a href=${`#/transaction/${hash}`} class="button button--small button--colored">View details</a>
</div>
`: ''}
</div>
</li>
`
@ -1634,19 +1638,26 @@
// Consolidate participants with same address and choice
const consolidatedParticipants = {}
for (const participant in contractParticipants) {
const { participantFloAddress, tokenAmount, tokenIdentification, transactionHash, userChoice, winningAmount } = contractParticipants[participant]
if (!consolidatedParticipants[`${participantFloAddress}-${userChoice}`]) {
consolidatedParticipants[`${participantFloAddress}-${userChoice}`] = {
participantFloAddress,
tokenAmount,
tokenIdentification,
transactionHash,
userChoice,
winningAmount
}
const { participantFloAddress, tokenAmount, userChoice, winningAmount, participationAmount } = contractParticipants[participant]
const id = userChoice ? `${participantFloAddress}-${userChoice}` : participantFloAddress
if (!consolidatedParticipants[id]) {
consolidatedParticipants[id] = contractParticipants[participant]
} else {
consolidatedParticipants[`${participantFloAddress}-${userChoice}`].tokenAmount += tokenAmount
consolidatedParticipants[`${participantFloAddress}-${userChoice}`].winningAmount += winningAmount
if (tokenAmount) {
if (!consolidatedParticipants[id].tokenAmount)
consolidatedParticipants[id].tokenAmount = 0
consolidatedParticipants[id].tokenAmount += tokenAmount
}
if (participationAmount) {
if (!consolidatedParticipants[id].participationAmount)
consolidatedParticipants[id].participationAmount = 0
consolidatedParticipants[id].participationAmount += participationAmount
}
if (winningAmount) {
if (!consolidatedParticipants[id].winningAmount)
consolidatedParticipants[id].winningAmount = 0
consolidatedParticipants[id].winningAmount += winningAmount
}
}
}
for (const participant in consolidatedParticipants) {
@ -2008,7 +2019,7 @@
if (!groupedTxs.has(key)) {
groupedTxs.set(key, {
sourceTransaction: null,
sourceTransaction: {},
offChainTransactions: [],
type: transactionTrigger ? 'compoundTransaction' : undefined,
});
@ -2017,12 +2028,18 @@
if (hash) {
groupedTxs.get(key).sourceTransaction = tx;
} else {
const { tokenIdentification, senderAddress, receiverAddress, onChain, tokenAmount } = tx;
const { tokenIdentification, senderAddress, receiverAddress, onChain, tokenAmount, time, contractName } = tx;
groupedTxs.get(key).offChainTransactions.push({
tokenIdentification,
receiverAddress,
tokenAmount,
});
if (time)
groupedTxs.get(key).sourceTransaction.time = time
if (contractName)
groupedTxs.get(key).sourceTransaction.contractName = contractName
if (senderAddress)
groupedTxs.get(key).sourceTransaction.contractAddress = senderAddress
}
});
@ -2232,7 +2249,6 @@
}
async function getContractDeposits(contract) {
console.log(`${floGlobals.tokenApiUrl}/api/v2/smartContractDeposits?contractName=${contract.name}&contractAddress=${contract.address}`)
const deposits = await fetchJson(`${floGlobals.tokenApiUrl}/api/v2/smartContractDeposits?contractName=${contract.name}&contractAddress=${contract.address}`)
return deposits.depositInfo
}
@ -2450,7 +2466,7 @@
]
}
catch (err) {
console.error(err)
throw err
}
}
@ -3284,4 +3300,4 @@
</script>
</body>
</html>
</html>