Fixed grouping for off chain transactions
This commit is contained in:
parent
2317e02472
commit
9867e23ed4
18
index.html
18
index.html
@ -1191,8 +1191,8 @@
|
|||||||
</li>`;
|
</li>`;
|
||||||
},
|
},
|
||||||
compoundTransactionCard(details) {
|
compoundTransactionCard(details) {
|
||||||
const { time, hash, sender, receiver, contractName, token, amount, offChainTransactions = [], userChoice } = details
|
const { time, hash, sender, receiver, contractName, token, amount, offChainTransactions = [], userChoice, contractAddress } = details
|
||||||
const smartContract = `${contractName}-${receiver}`
|
const smartContract = `${contractName}-${receiver || contractAddress}`
|
||||||
const renderedOffChainTransactions = offChainTransactions.map(tx => {
|
const renderedOffChainTransactions = offChainTransactions.map(tx => {
|
||||||
const { receiverAddress, tokenAmount, tokenIdentification } = tx
|
const { receiverAddress, tokenAmount, tokenIdentification } = tx
|
||||||
return html`
|
return html`
|
||||||
@ -1226,6 +1226,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="contract-info">
|
<div class="contract-info">
|
||||||
<ul class="transfer-steps">
|
<ul class="transfer-steps">
|
||||||
|
${sender ? html`
|
||||||
<li class="transfer-step">
|
<li class="transfer-step">
|
||||||
<div class="flex flex-direction-column gap-0-5">
|
<div class="flex flex-direction-column gap-0-5">
|
||||||
<div class="flex flex-direction-column">
|
<div class="flex flex-direction-column">
|
||||||
@ -1242,8 +1243,10 @@
|
|||||||
<a href=${`#/contract/${smartContract}`} class="address wrap-around">${smartContract}</a>
|
<a href=${`#/contract/${smartContract}`} class="address wrap-around">${smartContract}</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
`: ''}
|
||||||
${renderedOffChainTransactions}
|
${renderedOffChainTransactions}
|
||||||
</ul>
|
</ul>
|
||||||
|
${hash ? html`
|
||||||
<div class="flex align-center space-between flex-wrap gap-1">
|
<div class="flex align-center space-between flex-wrap gap-1">
|
||||||
<div class="flex flex-direction-column">
|
<div class="flex flex-direction-column">
|
||||||
<h5 class="label">Transaction ID</h5>
|
<h5 class="label">Transaction ID</h5>
|
||||||
@ -1251,6 +1254,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<a href=${`#/transaction/${hash}`} class="button button--small button--colored">View details</a>
|
<a href=${`#/transaction/${hash}`} class="button button--small button--colored">View details</a>
|
||||||
</div>
|
</div>
|
||||||
|
`: ''}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
`
|
`
|
||||||
@ -2008,7 +2012,7 @@
|
|||||||
|
|
||||||
if (!groupedTxs.has(key)) {
|
if (!groupedTxs.has(key)) {
|
||||||
groupedTxs.set(key, {
|
groupedTxs.set(key, {
|
||||||
sourceTransaction: null,
|
sourceTransaction: {},
|
||||||
offChainTransactions: [],
|
offChainTransactions: [],
|
||||||
type: transactionTrigger ? 'compoundTransaction' : undefined,
|
type: transactionTrigger ? 'compoundTransaction' : undefined,
|
||||||
});
|
});
|
||||||
@ -2017,12 +2021,18 @@
|
|||||||
if (hash) {
|
if (hash) {
|
||||||
groupedTxs.get(key).sourceTransaction = tx;
|
groupedTxs.get(key).sourceTransaction = tx;
|
||||||
} else {
|
} else {
|
||||||
const { tokenIdentification, senderAddress, receiverAddress, onChain, tokenAmount } = tx;
|
const { tokenIdentification, senderAddress, receiverAddress, onChain, tokenAmount, time, contractName } = tx;
|
||||||
groupedTxs.get(key).offChainTransactions.push({
|
groupedTxs.get(key).offChainTransactions.push({
|
||||||
tokenIdentification,
|
tokenIdentification,
|
||||||
receiverAddress,
|
receiverAddress,
|
||||||
tokenAmount,
|
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
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user