[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:
Julian 2024-06-07 10:08:47 -03:00 committed by GitHub
parent c33d469c71
commit b9f74e5516
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 19 additions and 18 deletions

View File

@ -2,7 +2,6 @@ export type WormchainBlockLogs = {
transactions?: CosmosTransaction[];
blockHeight: bigint;
timestamp: number;
chainId: number;
};
export type IbcTransaction = {

View File

@ -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,

View File

@ -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");

View File

@ -115,6 +115,5 @@ logs = [
],
blockHeight: BigInt(7606614),
timestamp: 1711025896481,
chainId: 3104,
},
];

View File

@ -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,
};

View File

@ -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,
});
});
});

View File

@ -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"
}

View File

@ -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": [