Compare commits

...

1 Commits

Author SHA1 Message Date
Vivek Teega
b1dce79c2e Temporarily commenting out transaction grouping 2023-10-02 14:56:06 +05:30

View File

@ -104,7 +104,7 @@
</sm-popup> </sm-popup>
<!-- Set urls for token and flo Apis --> <!-- Set urls for token and flo Apis -->
<script> <script>
const testMode = false const testMode = true
const floGlobals = { const floGlobals = {
blockchain: testMode ? "FLO_TEST" : "FLO", blockchain: testMode ? "FLO_TEST" : "FLO",
tokenApiUrl: testMode ? 'https://ranchimallflo-testnet-blockbook.ranchimall.net' : 'https://ranchimallflo.ranchimall.net', tokenApiUrl: testMode ? 'https://ranchimallflo-testnet-blockbook.ranchimall.net' : 'https://ranchimallflo.ranchimall.net',
@ -1820,46 +1820,46 @@
function renderTransactions(transactions = []) { function renderTransactions(transactions = []) {
let parsedTxs = parseTransactions(transactions); let parsedTxs = parseTransactions(transactions);
let groupedTxs = new Map(); // let groupedTxs = new Map();
parsedTxs.forEach((tx) => { // parsedTxs.forEach((tx) => {
const { hash, transactionTrigger } = tx; // const { hash, transactionTrigger } = tx;
const key = hash || transactionTrigger; // const key = hash || transactionTrigger;
if (!groupedTxs.has(key)) { // if (!groupedTxs.has(key)) {
groupedTxs.set(key, { // groupedTxs.set(key, {
sourceTransaction: null, // sourceTransaction: null,
offChainTransactions: [], // offChainTransactions: [],
type: transactionTrigger ? 'compoundTransaction' : undefined, // type: transactionTrigger ? 'compoundTransaction' : undefined,
}); // });
} // }
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 } = tx;
groupedTxs.get(key).offChainTransactions.push({ // groupedTxs.get(key).offChainTransactions.push({
tokenIdentification, // tokenIdentification,
receiverAddress, // receiverAddress,
tokenAmount, // tokenAmount,
}); // });
} // }
}); // });
// Convert the Map to an array of values for sorting // // Convert the Map to an array of values for sorting
const sortedTxs = [...groupedTxs.values()].sort((a, b) => b.sourceTransaction.time - a.sourceTransaction.time); // const sortedTxs = [...groupedTxs.values()].sort((a, b) => b.sourceTransaction.time - a.sourceTransaction.time);
// Replace parsedTxs with sortedTxs // // Replace parsedTxs with sortedTxs
parsedTxs = sortedTxs.map((tx) => { // parsedTxs = sortedTxs.map((tx) => {
if (tx.type === 'compoundTransaction') { // if (tx.type === 'compoundTransaction') {
return { // return {
...tx.sourceTransaction, // ...tx.sourceTransaction,
offChainTransactions: tx.offChainTransactions, // offChainTransactions: tx.offChainTransactions,
type: tx.type, // type: tx.type,
}; // };
} // }
return tx.sourceTransaction; // return tx.sourceTransaction;
}); // });
const renderedTransactions = parsedTxs.map(tx => { const renderedTransactions = parsedTxs.map(tx => {
switch (tx.type) { switch (tx.type) {
case 'tokentransfer': case 'tokentransfer':