[Blockchain Watcher] (SEI) Map sei mainnet events (#1473)
* Map sei mainnet events * Map sei contract --------- Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Pro-2.local>
This commit is contained in:
parent
c33d469c71
commit
b9f74e5516
|
@ -2,7 +2,6 @@ export type WormchainBlockLogs = {
|
|||
transactions?: CosmosTransaction[];
|
||||
blockHeight: bigint;
|
||||
timestamp: number;
|
||||
chainId: number;
|
||||
};
|
||||
|
||||
export type IbcTransaction = {
|
||||
|
|
|
@ -18,7 +18,7 @@ export const wormchainLogMessagePublishedMapper = (
|
|||
|
||||
transactionAttributesMapped.forEach((tx) => {
|
||||
logger.info(
|
||||
`[wormchain] Source event info: [tx: ${tx.hash}][emitterChain: ${tx.chainId}][sender: ${tx.emitter}][sequence: ${tx.sequence}]`
|
||||
`[wormchain] Source event info: [tx: ${tx.hash}][VAA: ${tx.chainId}/${tx.emitter}/${tx.sequence}]`
|
||||
);
|
||||
|
||||
logMessages.push({
|
||||
|
@ -50,6 +50,7 @@ function transactionAttributes(
|
|||
log.transactions?.forEach((tx) => {
|
||||
let coreContract: string | undefined;
|
||||
let sequence: number | undefined;
|
||||
let chainId: number | undefined;
|
||||
let payload: string | undefined;
|
||||
let emitter: string | undefined;
|
||||
let nonce: number | undefined;
|
||||
|
@ -60,6 +61,9 @@ function transactionAttributes(
|
|||
const value = Buffer.from(attr.value, "base64").toString().toLowerCase();
|
||||
|
||||
switch (key) {
|
||||
case "message.chain_id":
|
||||
chainId = Number(value);
|
||||
break;
|
||||
case "message.sequence":
|
||||
sequence = Number(value);
|
||||
break;
|
||||
|
@ -81,13 +85,13 @@ function transactionAttributes(
|
|||
}
|
||||
}
|
||||
|
||||
if (coreContract && sequence && payload && emitter && nonce) {
|
||||
if (coreContract && chainId && sequence && payload && emitter && nonce != undefined) {
|
||||
hash = tx.hash;
|
||||
transactionAttributes.push({
|
||||
chainId: log.chainId,
|
||||
coreContract,
|
||||
sequence,
|
||||
payload,
|
||||
chainId,
|
||||
emitter,
|
||||
nonce,
|
||||
hash,
|
||||
|
|
|
@ -76,7 +76,6 @@ export class WormchainJsonRPCBlockRepository implements WormchainRepository {
|
|||
transactions: [],
|
||||
blockHeight: BigInt(resultsBlock.result.block.header.height),
|
||||
timestamp: Number(resultsBlock.result.block.header.time),
|
||||
chainId,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -135,7 +134,6 @@ export class WormchainJsonRPCBlockRepository implements WormchainRepository {
|
|||
transactions: cosmosTransactions || [],
|
||||
blockHeight: BigInt(resultsBlock.result.block.header.height),
|
||||
timestamp,
|
||||
chainId,
|
||||
};
|
||||
} catch (e) {
|
||||
this.handleError(`Error: ${e}`, "getBlockHeight");
|
||||
|
|
|
@ -115,6 +115,5 @@ logs = [
|
|||
],
|
||||
blockHeight: BigInt(7606614),
|
||||
timestamp: 1711025896481,
|
||||
chainId: 3104,
|
||||
},
|
||||
];
|
||||
|
|
|
@ -219,7 +219,6 @@ const logWithOneTx: WormchainBlockLogs = {
|
|||
],
|
||||
blockHeight: 7626736n,
|
||||
timestamp: 1711143222043,
|
||||
chainId: 3104,
|
||||
};
|
||||
|
||||
const logWithTwoTxs: WormchainBlockLogs = {
|
||||
|
@ -484,5 +483,4 @@ const logWithTwoTxs: WormchainBlockLogs = {
|
|||
],
|
||||
blockHeight: 7626736n,
|
||||
timestamp: 1711143222043,
|
||||
chainId: 3104,
|
||||
};
|
||||
|
|
|
@ -42,7 +42,6 @@ describe("WormchainJsonRPCBlockRepository", () => {
|
|||
|
||||
expect(result.transactions).toEqual([]);
|
||||
expect(result.blockHeight).toEqual(8453618n);
|
||||
expect(result.chainId).toEqual(3104);
|
||||
});
|
||||
|
||||
it("should process the block because have one transaction", async () => {
|
||||
|
@ -142,7 +141,6 @@ describe("WormchainJsonRPCBlockRepository", () => {
|
|||
],
|
||||
blockHeight: 8453618n,
|
||||
timestamp: 1712265433087,
|
||||
chainId: 3104,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -329,7 +327,6 @@ describe("WormchainJsonRPCBlockRepository", () => {
|
|||
],
|
||||
blockHeight: 8453618n,
|
||||
timestamp: 1712265433087,
|
||||
chainId: 3104,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -359,7 +359,7 @@ data:
|
|||
"source": {
|
||||
"action": "PollEvm",
|
||||
"config": {
|
||||
"blockBatchSize": 1,
|
||||
"blockBatchSize": 4,
|
||||
"commitment": "latest",
|
||||
"interval": 5000,
|
||||
"filters": [
|
||||
|
@ -590,7 +590,10 @@ data:
|
|||
"blockBatchSize": 100,
|
||||
"commitment": "latest",
|
||||
"interval": 5000,
|
||||
"addresses": ["wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j"],
|
||||
"addresses": [
|
||||
"wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
|
||||
"wormhole1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5ws2y050r"
|
||||
],
|
||||
"chain": "wormchain",
|
||||
"chainId": 3104
|
||||
}
|
||||
|
@ -603,7 +606,10 @@ data:
|
|||
"config": {
|
||||
"abi": "",
|
||||
"filter": {
|
||||
"addresses": ["wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j"]
|
||||
"addresses": [
|
||||
"wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
|
||||
"wormhole1wkwy0xh89ksdgj9hr347dyd2dw7zesmtrue6kfzyml4vdtz6e5ws2y050r"
|
||||
]
|
||||
},
|
||||
"metricName": "process_source_event"
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ data:
|
|||
"action": "PollEvm",
|
||||
"records": "GetEvmTransactions",
|
||||
"config": {
|
||||
"blockBatchSize": 100,
|
||||
"blockBatchSize": 1000,
|
||||
"commitment": "latest",
|
||||
"interval": 15000,
|
||||
"filters": [
|
||||
|
@ -202,7 +202,7 @@ data:
|
|||
"interval": 15000,
|
||||
"filters": [
|
||||
{
|
||||
"addresses": ["0x61E44E506Ca5659E6c0bba9b678586fA2d729756"],
|
||||
"addresses": ["0x61E44E506Ca5659E6c0bba9b678586fA2d729756", "0x1fb8B6743E8d4F8047cd9C216192D4cD897947a2"],
|
||||
"type": "Portal Token Bridge by contract and topic",
|
||||
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
|
||||
"strategy": "GetTransactionsByBlocksStrategy"
|
||||
|
@ -491,7 +491,7 @@ data:
|
|||
"action": "PollEvm",
|
||||
"records": "GetEvmTransactions",
|
||||
"config": {
|
||||
"blockBatchSize": 1,
|
||||
"blockBatchSize": 4,
|
||||
"commitment": "latest",
|
||||
"interval": 5000,
|
||||
"filters": [
|
||||
|
|
Loading…
Reference in New Issue