[Blockchain Watcher] (FIX) Validate tx logs to process correctly (#1704)
* Improve standard relayer mapper * Improve standard relayer mapper * Filter logs by topic * Create random key for sns message --------- Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Air.local>
This commit is contained in:
parent
a96572e03b
commit
39d952bc47
|
@ -62,15 +62,19 @@ export function populateTransaction(
|
|||
evmBlocks: Record<string, EvmBlock>,
|
||||
transactionReceipts: Record<string, ReceiptTransaction>,
|
||||
filterTransactions: EvmTransaction[],
|
||||
populatedTransactions: EvmTransaction[]
|
||||
populatedTransactions: EvmTransaction[],
|
||||
topics: string[]
|
||||
) {
|
||||
filterTransactions.forEach((transaction) => {
|
||||
if (transactionReceipts[transaction.hash]) {
|
||||
transaction.effectiveGasPrice = transactionReceipts[transaction.hash].effectiveGasPrice;
|
||||
transaction.gasUsed = transactionReceipts[transaction.hash].gasUsed;
|
||||
const txReceipt = transactionReceipts[transaction.hash];
|
||||
if (txReceipt) {
|
||||
transaction.effectiveGasPrice = txReceipt.effectiveGasPrice;
|
||||
transaction.gasUsed = txReceipt.gasUsed;
|
||||
transaction.timestamp = evmBlocks[transaction.blockHash].timestamp;
|
||||
transaction.status = transactionReceipts[transaction.hash].status;
|
||||
transaction.logs = transactionReceipts[transaction.hash].logs;
|
||||
transaction.status = txReceipt.status;
|
||||
transaction.logs = txReceipt.logs.filter((log) =>
|
||||
log.topics.some((topic) => topics.includes(topic))
|
||||
);
|
||||
transaction.environment = opts.environment;
|
||||
transaction.chainId = opts.chainId;
|
||||
transaction.chain = opts.chain;
|
||||
|
|
|
@ -51,7 +51,8 @@ export class GetTransactionsByBlocksStrategy implements GetTransactions {
|
|||
evmBlocks,
|
||||
transactionReceipts,
|
||||
transactionsByAddressConfigured,
|
||||
populatedTransactions
|
||||
populatedTransactions,
|
||||
filter.topics
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ export class GetTransactionsByLogFiltersStrategy implements GetTransactions {
|
|||
evmBlocks,
|
||||
transactionReceipts,
|
||||
filterTransactions,
|
||||
populatedTransactions
|
||||
populatedTransactions,
|
||||
filter.topics
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { LogFoundEvent } from "../../../domain/entities";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import winston from "../../log";
|
||||
import crypto from "node:crypto";
|
||||
import {
|
||||
SNSClient,
|
||||
PublishBatchCommand,
|
||||
PublishBatchCommandInput,
|
||||
PublishBatchRequestEntry,
|
||||
PublishBatchCommand,
|
||||
SNSClient,
|
||||
} from "@aws-sdk/client-sns";
|
||||
import winston from "../../log";
|
||||
|
||||
const CHUNK_SIZE = 10;
|
||||
|
||||
|
@ -127,7 +128,7 @@ export class SnsEvent {
|
|||
|
||||
static fromLogFoundEvent<T>(logFoundEvent: LogFoundEvent<T>): SnsEvent {
|
||||
return new SnsEvent(
|
||||
`chain-event-${logFoundEvent.txHash}-${logFoundEvent.blockHeight}`,
|
||||
`chain-event-${uuidv4()}-${logFoundEvent.txHash}`,
|
||||
"blockchain-watcher",
|
||||
logFoundEvent.name,
|
||||
new Date().toISOString(),
|
||||
|
|
|
@ -37,7 +37,7 @@ OPTIMISM_RPCS='["https://rpc.ankr.com/optimism/${token_ankr}","https://op-pokt.n
|
|||
ARBITRUM_RPCS='["https://rpc.ankr.com/arbitrum/${token_ankr}","https://arb1.arbitrum.io/rpc"]'
|
||||
POLYGON_RPCS='["https://rpc.ankr.com/polygon/${token_ankr}","https://rpc-mainnet.matic.quiknode.pro","https://polygon-rpc.com"]'
|
||||
AVALANCHE_RPCS='["https://rpc.ankr.com/avalanche/${token_ankr}","https://avalanche.blockpi.network/v1/rpc/public","https://api.avax.network/ext/bc/C/rpc","https://avalanche.public-rpc.com","https://endpoints.omniatech.io/v1/avax/mainnet/public", "https://avalanche-c-chain.publicnode.com"]'
|
||||
MOONBEAM_RPCS='["https://rpc.ankr.com/moonbeam/${token_ankr}","https://rpc.api.moonbeam.network","https://1rpc.io/glmr"]'
|
||||
MOONBEAM_RPCS='["https://rpc.ankr.com/moonbeam/${token_ankr}","https://rpc.api.moonbeam.network"]'
|
||||
BSC_RPCS='["https://rpc.ankr.com/bsc/${token_ankr}","https://bscrpc.com"]'
|
||||
CELO_RPCS='["https://rpc.ankr.com/celo/${token_ankr}","https://forno.celo.org","https://1rpc.io/celo"]'
|
||||
SCROLL_RPCS='["https://rpc.ankr.com/scroll/${token_ankr}","https://scroll-mainnet-public.unifra.io","https://rpc.scroll.io","https://scroll-mainnet.chainstacklabs.com"]'
|
||||
|
|
|
@ -34,7 +34,7 @@ OPTIMISM_RPCS='["https://rpc.ankr.com/optimism/${token_ankr}","https://op-pokt.n
|
|||
ARBITRUM_RPCS='["https://rpc.ankr.com/arbitrum/${token_ankr}","https://arb1.arbitrum.io/rpc"]'
|
||||
POLYGON_RPCS='["https://rpc.ankr.com/polygon/${token_ankr}","https://rpc-mainnet.matic.quiknode.pro","https://polygon-rpc.com"]'
|
||||
AVALANCHE_RPCS='["https://rpc.ankr.com/avalanche/${token_ankr}","https://avalanche.blockpi.network/v1/rpc/public","https://api.avax.network/ext/bc/C/rpc","https://avalanche.public-rpc.com","https://endpoints.omniatech.io/v1/avax/mainnet/public", "https://avalanche-c-chain.publicnode.com"]'
|
||||
MOONBEAM_RPCS='["https://rpc.ankr.com/moonbeam/${token_ankr}","https://rpc.api.moonbeam.network","https://1rpc.io/glmr"]'
|
||||
MOONBEAM_RPCS='["https://rpc.ankr.com/moonbeam/${token_ankr}","https://rpc.api.moonbeam.network"]'
|
||||
BSC_RPCS='["https://rpc.ankr.com/bsc/${token_ankr}","https://bscrpc.com"]'
|
||||
CELO_RPCS='["https://rpc.ankr.com/celo/${token_ankr}","https://forno.celo.org","https://1rpc.io/celo"]'
|
||||
SCROLL_RPCS='["https://rpc.ankr.com/scroll/${token_ankr}","https://scroll-mainnet-public.unifra.io","https://rpc.scroll.io","https://scroll-mainnet.chainstacklabs.com"]'
|
||||
|
|
Loading…
Reference in New Issue