Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private getTransactionAndMetaFromPosition(
transactionPositions: number[],
block: DataAccessTypes.IBlock,
location: string,
meta: StorageTypes.IMetaOneData,
): {
transactions: DataAccessTypes.IConfirmedTransaction[];
transactionsStorageLocation: string[];
storageMeta: string[];
} {
// Gets the transaction from the positions
const transactions: DataAccessTypes.IConfirmedTransaction[] =
// first remove de duplicates
Utils.unique(transactionPositions).uniqueItems.map(
// Get the transaction from their position and add the timestamp
(position: number) => ({
timestamp: meta.timestamp,
transaction: block.transactions[position],
}),
);
// Gets the list of storage location of the transactions found
const transactionsStorageLocation = Array(transactions.length).fill(location);
// Gets the list of storage meta of the transactions found
const storageMeta = Array(transactions.length).fill(meta);
return { transactions, transactionsStorageLocation, storageMeta };
}