Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Back to post

Revisions 3

Retrieving Unordered NFT Collection Items from TON Blockchain - Any Experiences?
Retrieving Unordered NFT Collection Items from TON Blockchain - Any Experiences?
I am currently working on a project that involves retrieving unordered NFT collection items from the TON blockchain. I have been searching for solutions or examples of how to do this, but so far, I haven't found any helpful information.
I am currently working on a project that involves retrieving unordered NFT collection items from the TON blockchain. I have been searching for solutions or examples of how to do this, but so far, I haven't found any helpful information. I wrote some code that fetches transactions from the TON blockchain, updates start and end times, and processes the transactions to retrieve the required data. It does this by iterating through the transactions and extracting the relevant information, such as the address, logical time (LT), and transaction hash, which uniquely identify each transaction. I would greatly appreciate any feedback on this solution, particularly regarding its efficiency and potential improvements. Are there any alternative methods or best practices that I should consider implementing to achieve the desired result? Additionally, if anyone has experience with similar tasks, I would love to hear your insights and recommendations. ``` private async fetchTransactions() { if (this.offsetTransactionLT) { console.log( `Get ${this.fetchCount} transactions before transaction ${this.offsetTransactionLT}:${this.offsetTransactionHash}`, ); } else { console.log(`Get last ${this.fetchCount} transactions`); } // TON transaction has composite ID: account address (on which the transaction took place) + transaction LT (logical time) + transaction hash. // So TxID = address+LT+hash, these three parameters uniquely identify the transaction. let transactions; try { transactions = await tonweb.provider.getTransactions( this.rootAddress, this.fetchCount, this.offsetTransactionLT, this.offsetTransactionHash, ); } catch (e) { return 0; } console.log(`Got ${transactions.length} transactions`); if (!transactions.length) { this.logger.debug('No transactions found'); return; } // Check if we need to update the start time if ( !this.startTime || transactions[transactions.length - 1].utime < this.startTime ) { this.startTime = transactions[transactions.length - 1].utime; console.log('Update start time', this.startTime); } // Check if we need to update the end time if (!this.endTime || transactions[0].utime > this.endTime) { this.endTime = transactions[0].utime; console.log('Update end time', this.endTime); } for (const tx of transactions) { // skip duplicate transactions (if any) if ( tx.transaction_id.lt === this.offsetTransactionLT && tx.transaction_id.hash === this.offsetTransactionHash ) { continue; } // } if (transactions.length === 1) { // Only one transaction, update the offset to start from the next one this.offsetTransactionLT = transactions[0].transaction_id.lt; this.offsetTransactionHash = transactions[0].transaction_id.hash; } else { // Multiple transactions, update the offset to start from the oldest one in the next batch const lastTx = transactions[transactions.length - 1]; this.offsetTransactionLT = lastTx.transaction_id.lt; this.offsetTransactionHash = lastTx.transaction_id.hash; } } ```
#unordered-collection #nft #ton-dns
#unordered-collection #nft #ton-dns
Retrieving Unordered NFT Collection Items from TON Blockchain - Any Experiences?
Retrieving Unordered NFT Collection Items from TON Blockchain - Any Experiences?
I am currently working on a project that involves retrieving unordered NFT collection items from the TON blockchain. I have been searching for solutions or examples of how to do this, but so far, I haven't found any helpful information. I wrote some code that fetches transactions from the TON blockchain, updates start and end times, and processes the transactions to retrieve the required data. It does this by iterating through the transactions and extracting the relevant information, such as the address, logical time (LT), and transaction hash, which uniquely identify each transaction. I would greatly appreciate any feedback on this solution, particularly regarding its efficiency and potential improvements. Are there any alternative methods or best practices that I should consider implementing to achieve the desired result? Additionally, if anyone has experience with similar tasks, I would love to hear your insights and recommendations. ``` private async fetchTransactions() { if (this.offsetTransactionLT) { console.log( `Get ${this.fetchCount} transactions before transaction ${this.offsetTransactionLT}:${this.offsetTransactionHash}`, ); } else { console.log(`Get last ${this.fetchCount} transactions`); } // TON transaction has composite ID: account address (on which the transaction took place) + transaction LT (logical time) + transaction hash. // So TxID = address+LT+hash, these three parameters uniquely identify the transaction. let transactions; try { transactions = await tonweb.provider.getTransactions( this.rootAddress, this.fetchCount, this.offsetTransactionLT, this.offsetTransactionHash, ); } catch (e) { return 0; } console.log(`Got ${transactions.length} transactions`); if (!transactions.length) { this.logger.debug('No transactions found'); return; } // Check if we need to update the start time if ( !this.startTime || transactions[transactions.length - 1].utime < this.startTime ) { this.startTime = transactions[transactions.length - 1].utime; console.log('Update start time', this.startTime); } // Check if we need to update the end time if (!this.endTime || transactions[0].utime > this.endTime) { this.endTime = transactions[0].utime; console.log('Update end time', this.endTime); } for (const tx of transactions) { // skip duplicate transactions (if any) if ( tx.transaction_id.lt === this.offsetTransactionLT && tx.transaction_id.hash === this.offsetTransactionHash ) { continue; } // } if (transactions.length === 1) { // Only one transaction, update the offset to start from the next one this.offsetTransactionLT = transactions[0].transaction_id.lt; this.offsetTransactionHash = transactions[0].transaction_id.hash; } else { // Multiple transactions, update the offset to start from the oldest one in the next batch const lastTx = transactions[transactions.length - 1]; this.offsetTransactionLT = lastTx.transaction_id.lt; this.offsetTransactionHash = lastTx.transaction_id.hash; } } ```
I am currently working on a project that involves retrieving unordered NFT collection items from the TON blockchain. I have been searching for solutions or examples of how to do this, but so far, I haven't found any helpful information. I wrote some code that fetches transactions from the TON blockchain, updates start and end times, and processes the transactions to retrieve the required data. It does this by iterating through the transactions and extracting the relevant information, such as the address, logical time (LT), and transaction hash, which uniquely identify each transaction. I would greatly appreciate any feedback on this solution, particularly regarding its efficiency and potential improvements. Are there any alternative methods or best practices that I should consider implementing to achieve the desired result? Additionally, if anyone has experience with similar tasks, I would love to hear your insights and recommendations. `private async fetchTransactions() { if (this.offsetTransactionLT) { console.log( `Get ${this.fetchCount} transactions before transaction ${this.offsetTransactionLT}:${this.offsetTransactionHash}`, ); } else { console.log(`Get last ${this.fetchCount} transactions`); } // TON transaction has composite ID: account address (on which the transaction took place) + transaction LT (logical time) + transaction hash. // So TxID = address+LT+hash, these three parameters uniquely identify the transaction. let transactions; try { transactions = await tonweb.provider.getTransactions( this.rootAddress, this.fetchCount, this.offsetTransactionLT, this.offsetTransactionHash, ); } catch (e) { return 0; } console.log(`Got ${transactions.length} transactions`); if (!transactions.length) { this.logger.debug('No transactions found'); return; } // Check if we need to update the start time if ( !this.startTime || transactions[transactions.length - 1].utime < this.startTime ) { this.startTime = transactions[transactions.length - 1].utime; console.log('Update start time', this.startTime); } // Check if we need to update the end time if (!this.endTime || transactions[0].utime > this.endTime) { this.endTime = transactions[0].utime; console.log('Update end time', this.endTime); } for (const tx of transactions) { // skip duplicate transactions (if any) if ( tx.transaction_id.lt === this.offsetTransactionLT && tx.transaction_id.hash === this.offsetTransactionHash ) { continue; } // } if (transactions.length === 1) { // Only one transaction, update the offset to start from the next one this.offsetTransactionLT = transactions[0].transaction_id.lt; this.offsetTransactionHash = transactions[0].transaction_id.hash; } else { // Multiple transactions, update the offset to start from the oldest one in the next batch const lastTx = transactions[transactions.length - 1]; this.offsetTransactionLT = lastTx.transaction_id.lt; this.offsetTransactionHash = lastTx.transaction_id.hash; } }`
#unordered-collection #nft #ton-dns
#unordered-collection #nft #ton-dns
12 months ago
Original
Retrieving Unordered NFT Collection Items from TON Blockchain - Any Experiences?

I am currently working on a project that involves retrieving unordered NFT collection items from the TON blockchain. I have been searching for solutions or examples of how to do this, but so far, I haven't found any helpful information. I wrote some code that fetches transactions from the TON blockchain, updates start and end times, and processes the transactions to retrieve the required data. It does this by iterating through the transactions and extracting the relevant information, such as the address, logical time (LT), and transaction hash, which uniquely identify each transaction. I would greatly appreciate any feedback on this solution, particularly regarding its efficiency and potential improvements. Are there any alternative methods or best practices that I should consider implementing to achieve the desired result? Additionally, if anyone has experience with similar tasks, I would love to hear your insights and recommendations. `private async fetchTransactions() { if (this.offsetTransactionLT) { console.log( `Get ${this.fetchCount} transactions before transaction ${this.offsetTransactionLT}:${this.offsetTransactionHash}`, ); } else { console.log(`Get last ${this.fetchCount} transactions`); } // TON transaction has composite ID: account address (on which the transaction took place) + transaction LT (logical time) + transaction hash. // So TxID = address+LT+hash, these three parameters uniquely identify the transaction. let transactions; try { transactions = await tonweb.provider.getTransactions( this.rootAddress, this.fetchCount, this.offsetTransactionLT, this.offsetTransactionHash, ); } catch (e) { return 0; } console.log(`Got ${transactions.length} transactions`); if (!transactions.length) { this.logger.debug('No transactions found'); return; } // Check if we need to update the start time if ( !this.startTime || transactions[transactions.length - 1].utime < this.startTime ) { this.startTime = transactions[transactions.length - 1].utime; console.log('Update start time', this.startTime); } // Check if we need to update the end time if (!this.endTime || transactions[0].utime > this.endTime) { this.endTime = transactions[0].utime; console.log('Update end time', this.endTime); } for (const tx of transactions) { // skip duplicate transactions (if any) if ( tx.transaction_id.lt === this.offsetTransactionLT && tx.transaction_id.hash === this.offsetTransactionHash ) { continue; } // } if (transactions.length === 1) { // Only one transaction, update the offset to start from the next one this.offsetTransactionLT = transactions[0].transaction_id.lt; this.offsetTransactionHash = transactions[0].transaction_id.hash; } else { // Multiple transactions, update the offset to start from the oldest one in the next batch const lastTx = transactions[transactions.length - 1]; this.offsetTransactionLT = lastTx.transaction_id.lt; this.offsetTransactionHash = lastTx.transaction_id.hash; } }`
#unordered-collection #nft #ton-dns