Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: prxt <prxt@6529.io>
  • Loading branch information
prxt6529 committed Jul 1, 2024
1 parent bb6d8d5 commit 537b410
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/prenode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ cron.schedule(
}
);

// transactions every 5 minutes
// transactions every 2 minutes
cron.schedule(
'*/5 * * * *',
'*/2 * * * *',
async () => {
if (RUNNING_TDH || RUNNING_UPDATE || RUNNING_TRX) {
logger.info(
Expand Down
14 changes: 5 additions & 9 deletions src/transactions/transaction_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ export const findTransactionValues = async (

const transactionsWithValues: Transaction[] = [];

await Promise.all(
transactions.map(async (t) => {
const parsedTransaction = await resolveValue(t);
transactionsWithValues.push(parsedTransaction);
})
);
for (const t of transactions) {
await sleep(100);
const parsedTransaction = await resolveValue(t);
transactionsWithValues.push(parsedTransaction);
}

logger.info(
`[PROCESSED ${transactionsWithValues.length} TRANSACTION VALUES]`
Expand All @@ -107,7 +106,6 @@ export const findTransactionValues = async (
};

async function resolveValue(t: Transaction) {
await sleep(500); // Alchemy rate limit
const transaction = await alchemy.core.getTransaction(t.transaction);
t.value = transaction ? parseFloat(Utils.formatEther(transaction.value)) : 0;
t.royalties = 0;
Expand All @@ -120,7 +118,6 @@ async function resolveValue(t: Transaction) {
}

if (transaction) {
await sleep(500); // Alchemy rate limit
const receipt = await alchemy.core.getTransactionReceipt(transaction?.hash);
const logCount =
receipt?.logs.filter(
Expand Down Expand Up @@ -212,7 +209,6 @@ async function resolveValue(t: Transaction) {
toBlock: block
};

await sleep(500); // Alchemy rate limit
const internlTrfs = await alchemy.core.getAssetTransfers(settings);
const filteredInternalTrfs = internlTrfs.transfers.filter(
(it) =>
Expand Down
4 changes: 2 additions & 2 deletions src/transactions/transactions-discovery.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class TransactionsDiscoveryService {
pageKey
);

await sleep(500); // Alchemy rate limit
await sleep(1000); // Alchemy rate limit
const { transfers, pageKey: nextPageKey } =
await this.alchemy.core.getAssetTransfers(alchemyParams);

Expand Down Expand Up @@ -134,7 +134,7 @@ export class TransactionsDiscoveryService {
category: [AssetTransfersCategory.ERC1155, AssetTransfersCategory.ERC721],
contractAddresses: [contract],
withMetadata: true,
maxCount: 150,
maxCount: 50,
fromBlock: startingBlockHex,
toBlock: toBlockHex,
pageKey: pageKey
Expand Down

0 comments on commit 537b410

Please sign in to comment.