Compare commits
1 Commits
master
...
temp-switc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1dce79c2e |
72
index.html
72
index.html
@ -104,7 +104,7 @@
|
||||
</sm-popup>
|
||||
<!-- Set urls for token and flo Apis -->
|
||||
<script>
|
||||
const testMode = false
|
||||
const testMode = true
|
||||
const floGlobals = {
|
||||
blockchain: testMode ? "FLO_TEST" : "FLO",
|
||||
tokenApiUrl: testMode ? 'https://ranchimallflo-testnet-blockbook.ranchimall.net' : 'https://ranchimallflo.ranchimall.net',
|
||||
@ -1820,46 +1820,46 @@
|
||||
|
||||
function renderTransactions(transactions = []) {
|
||||
let parsedTxs = parseTransactions(transactions);
|
||||
let groupedTxs = new Map();
|
||||
// let groupedTxs = new Map();
|
||||
|
||||
parsedTxs.forEach((tx) => {
|
||||
const { hash, transactionTrigger } = tx;
|
||||
const key = hash || transactionTrigger;
|
||||
// parsedTxs.forEach((tx) => {
|
||||
// const { hash, transactionTrigger } = tx;
|
||||
// const key = hash || transactionTrigger;
|
||||
|
||||
if (!groupedTxs.has(key)) {
|
||||
groupedTxs.set(key, {
|
||||
sourceTransaction: null,
|
||||
offChainTransactions: [],
|
||||
type: transactionTrigger ? 'compoundTransaction' : undefined,
|
||||
});
|
||||
}
|
||||
// if (!groupedTxs.has(key)) {
|
||||
// groupedTxs.set(key, {
|
||||
// sourceTransaction: null,
|
||||
// offChainTransactions: [],
|
||||
// type: transactionTrigger ? 'compoundTransaction' : undefined,
|
||||
// });
|
||||
// }
|
||||
|
||||
if (hash) {
|
||||
groupedTxs.get(key).sourceTransaction = tx;
|
||||
} else {
|
||||
const { tokenIdentification, senderAddress, receiverAddress, onChain, tokenAmount } = tx;
|
||||
groupedTxs.get(key).offChainTransactions.push({
|
||||
tokenIdentification,
|
||||
receiverAddress,
|
||||
tokenAmount,
|
||||
});
|
||||
}
|
||||
});
|
||||
// if (hash) {
|
||||
// groupedTxs.get(key).sourceTransaction = tx;
|
||||
// } else {
|
||||
// const { tokenIdentification, senderAddress, receiverAddress, onChain, tokenAmount } = tx;
|
||||
// groupedTxs.get(key).offChainTransactions.push({
|
||||
// tokenIdentification,
|
||||
// receiverAddress,
|
||||
// tokenAmount,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// Convert the Map to an array of values for sorting
|
||||
const sortedTxs = [...groupedTxs.values()].sort((a, b) => b.sourceTransaction.time - a.sourceTransaction.time);
|
||||
// // Convert the Map to an array of values for sorting
|
||||
// const sortedTxs = [...groupedTxs.values()].sort((a, b) => b.sourceTransaction.time - a.sourceTransaction.time);
|
||||
|
||||
// Replace parsedTxs with sortedTxs
|
||||
parsedTxs = sortedTxs.map((tx) => {
|
||||
if (tx.type === 'compoundTransaction') {
|
||||
return {
|
||||
...tx.sourceTransaction,
|
||||
offChainTransactions: tx.offChainTransactions,
|
||||
type: tx.type,
|
||||
};
|
||||
}
|
||||
return tx.sourceTransaction;
|
||||
});
|
||||
// // Replace parsedTxs with sortedTxs
|
||||
// parsedTxs = sortedTxs.map((tx) => {
|
||||
// if (tx.type === 'compoundTransaction') {
|
||||
// return {
|
||||
// ...tx.sourceTransaction,
|
||||
// offChainTransactions: tx.offChainTransactions,
|
||||
// type: tx.type,
|
||||
// };
|
||||
// }
|
||||
// return tx.sourceTransaction;
|
||||
// });
|
||||
const renderedTransactions = parsedTxs.map(tx => {
|
||||
switch (tx.type) {
|
||||
case 'tokentransfer':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user