+@@ -502,9 +550,12 @@ const Agent = { ], eventsFields: [ { key: 'number', label: '#', sortable: false, thStyle: 'width: 5%;', tdClass: 'text-truncate' }, - { key: 'when', label: 'When', sortable: false, thStyle: 'width: 20%;', thClass: 'text-left', tdClass: 'text-left' }, - { key: 'type', label: 'Type', sortable: false, thStyle: 'width: 10%;', tdClass: 'text-left' }, - { key: 'info', label: 'Info', sortable: false, thStyle: 'width: 65%;', tdClass: 'text-left' }, + { key: 'when', label: 'When', sortable: false, thStyle: 'width: 12%;', thClass: 'text-left', tdClass: 'text-left' }, + { key: 'maker', label: 'Maker', sortable: false, thStyle: 'width: 12%;', tdClass: 'text-left' }, + { key: 'taker', label: 'Taker', sortable: false, thStyle: 'width: 12%;', tdClass: 'text-left' }, + { key: 'token', label: 'Token', sortable: false, thStyle: 'width: 12%;', tdClass: 'text-left' }, + { key: 'eventType', label: 'Event Type', sortable: false, thStyle: 'width: 10%;', tdClass: 'text-left' }, + { key: 'info', label: 'Info', sortable: false, thStyle: 'width: 37%;', tdClass: 'text-left' }, ], approvalsFields: [ { key: 'number', label: '#', sortable: false, thStyle: 'width: 5%;', tdClass: 'text-truncate' }, @@ -666,7 +717,7 @@ const Agent = { }, nonce() { - const events = this.events.filter(e => e.type == "OffersInvalidated"); + const events = this.events.filter(e => e.eventType == "OffersInvalidated"); if (events.length > 0) { return events[events.length - 1].newNonce; } @@ -675,40 +726,23 @@ const Agent = { filteredSortedEvents() { const results = this.events; - // console.log(JSON.stringify(results, null, 2)); - // if (this.settings.sortOption == 'ownertokenagentasc') { - // results.sort((a, b) => { - // if (('' + a.owner).localeCompare(b.owner) == 0) { - // return ('' + a.transferAgent).localeCompare(b.transferAgent); - // } else { - // return ('' + a.owner).localeCompare(b.owner); - // } - // }); - // } else if (this.settings.sortOption == 'ownertokenagentdsc') { - // results.sort((a, b) => { - // if (('' + a.owner).localeCompare(b.owner) == 0) { - // return ('' + a.transferAgent).localeCompare(b.transferAgent); - // } else { - // return ('' + b.owner).localeCompare(a.owner); - // } - // }); - // } else if (this.settings.sortOption == 'tokenagentasc') { - // results.sort((a, b) => { - // return ('' + a.tokenAgent).localeCompare(b.tokenAgent); - // }); - // } else if (this.settings.sortOption == 'tokenagentdsc') { - // results.sort((a, b) => { - // return ('' + b.tokenAgent).localeCompare(a.tokenAgent); - // }); - // } else if (this.settings.sortOption == 'indexasc') { - // results.sort((a, b) => { - // return a.index - b.index; - // }); - // } else if (this.settings.sortOption == 'indexdsc') { - // results.sort((a, b) => { - // return b.index - a.index; - // }); - // } + if (this.settings.events.sortOption == 'txorderasc') { + results.sort((a, b) => { + if (a.blockNumber == b.blockNumber) { + return a.logIndex - b.logIndex; + } else { + return a.blockNumber - b.blockNumber; + } + }); + } else if (this.settings.events.sortOption == 'txorderdsc') { + results.sort((a, b) => { + if (a.blockNumber == b.blockNumber) { + return b.logIndex - a.logIndex; + } else { + return b.blockNumber - a.blockNumber; + } + }); + } return results; }, pagedFilteredSortedEvents() { @@ -717,45 +751,27 @@ const Agent = { }, offers() { - const results = this.events.filter(e => e.type == "Offered"); - return results; + return this.events.filter(e => e.eventType == "Offered"); }, filteredSortedOffers() { const results = this.offers; - // console.log(JSON.stringify(results, null, 2)); - // if (this.settings.sortOption == 'ownertokenagentasc') { - // results.sort((a, b) => { - // if (('' + a.owner).localeCompare(b.owner) == 0) { - // return ('' + a.transferAgent).localeCompare(b.transferAgent); - // } else { - // return ('' + a.owner).localeCompare(b.owner); - // } - // }); - // } else if (this.settings.sortOption == 'ownertokenagentdsc') { - // results.sort((a, b) => { - // if (('' + a.owner).localeCompare(b.owner) == 0) { - // return ('' + a.transferAgent).localeCompare(b.transferAgent); - // } else { - // return ('' + b.owner).localeCompare(a.owner); - // } - // }); - // } else if (this.settings.sortOption == 'tokenagentasc') { - // results.sort((a, b) => { - // return ('' + a.tokenAgent).localeCompare(b.tokenAgent); - // }); - // } else if (this.settings.sortOption == 'tokenagentdsc') { - // results.sort((a, b) => { - // return ('' + b.tokenAgent).localeCompare(a.tokenAgent); - // }); - // } else if (this.settings.sortOption == 'indexasc') { - // results.sort((a, b) => { - // return a.index - b.index; - // }); - // } else if (this.settings.sortOption == 'indexdsc') { - // results.sort((a, b) => { - // return b.index - a.index; - // }); - // } + if (this.settings.offers.sortOption == 'txorderasc') { + results.sort((a, b) => { + if (a.blockNumber == b.blockNumber) { + return a.logIndex - b.logIndex; + } else { + return a.blockNumber - b.blockNumber; + } + }); + } else if (this.settings.offers.sortOption == 'txorderdsc') { + results.sort((a, b) => { + if (a.blockNumber == b.blockNumber) { + return b.logIndex - a.logIndex; + } else { + return b.blockNumber - a.blockNumber; + } + }); + } return results; }, pagedFilteredSortedOffers() { diff --git a/docs/parsers.js b/docs/parsers.js index 88e16de..0219d53 100644 --- a/docs/parsers.js +++ b/docs/parsers.js @@ -67,7 +67,7 @@ function parseTokenAgentEventLogs(logs, chainId, tokenAgentAddress, tokenAgentAb // event Offered(Index index, Account indexed maker, Token indexed token, TokenType tokenType, BuySell buySell, Unixtime expiry, Count count, Nonce nonce, Price[] prices, TokenId[] tokenIds, Tokens[] tokenss, Unixtime timestamp); const [index, maker, token, tokenType, buySell, expiry, count, nonce, prices, tokenIds, tokenss, timestamp] = logData.args; eventRecord = { - type: "Offered", index, maker, token, tokenType, buySell, expiry, count, nonce, + eventType: "Offered", index, maker, token, tokenType, buySell, expiry, count, nonce, prices: prices.map(e => ethers.BigNumber.from(e).toString()), tokenIds: tokenIds.map(e => ethers.BigNumber.from(e).toString()), tokenss: tokenss.map(e => ethers.BigNumber.from(e).toString()), @@ -76,7 +76,7 @@ function parseTokenAgentEventLogs(logs, chainId, tokenAgentAddress, tokenAgentAb } else if (logData.eventFragment.name == "OffersInvalidated") { // event OffersInvalidated(Nonce newNonce, Unixtime timestamp); const [newNonce, timestamp] = logData.args; - eventRecord = { type: "OffersInvalidated", newNonce, timestamp }; + eventRecord = { eventType: "OffersInvalidated", newNonce, timestamp }; } else { console.log(now() + " INFO functions:parseTokenAgentEventLogs - UNHANDLED log: " + JSON.stringify(log)); } diff --git a/images/Screenshot_Agent_Events_20240911.png b/images/Screenshot_Agent_Events_20240911.png new file mode 100644 index 0000000..58899ec Binary files /dev/null and b/images/Screenshot_Agent_Events_20240911.png differ+ + index: {{ data.item.index }}, + type: {{ data.item.tokenType == 1 ? 'ERC-20' : (data.item.tokenType == 2 ? 'ERC-721' : 'ERC-1155') }}, + buySell: {{ data.item.buySell == 0 ? 'Buy' : 'Sell' }}, + expiry: {{ data.item.expiry == 0 ? '(no expiry)' : formatTimestamp(data.item.expiry) }}, + count: {{ data.item.count }}, + nonce: {{ data.item.nonce }}, + prices: [{{ data.item.prices.map(e => formatDecimals(e, 18)).join(', ') }}] + tokenIds: [{{ data.item.tokenIds.map(e => parseInt(e)).join(', ') }}] + tokenss: [{{ data.item.tokenss.map(e => formatDecimals(e, 18)).join(', ') }}] + +++ + newNonce: {{ data.item.newNonce }} + + +