[Blockchain Watcher] (FIX -SEI) Improve sei redeems (#1490)

* Improve sei redeems

* Valiadate timestamp value

* Resolve sei redeem test

---------

Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Pro-2.local>
This commit is contained in:
Julian 2024-06-14 18:28:41 -03:00 committed by GitHub
parent dabe8172da
commit 31e87382d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 2526 additions and 13042 deletions

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
"@certusone/wormhole-sdk": "0.10.5",
"@cosmjs/proto-signing": "^0.32.3",
"@mysten/sui.js": "^0.49.1",
"@xlabs/rpc-pool": "^0.0.3",
"@xlabs/rpc-pool": "^0.0.4",
"axios": "^1.6.0",
"bs58": "^5.0.0",
"config": "^3.3.9",

View File

@ -21,7 +21,7 @@ export const seiRedeemedTransactionFoundMapper = (
return undefined;
}
const txAttributes = transactionAttributes(addresses, transaction);
if (!txAttributes) {
if (!txAttributes || !transaction.timestamp) {
return undefined;
}
const hash = transaction.hash;
@ -61,7 +61,8 @@ function mappedVaaInformation(tx: Buffer): VaaInformation | undefined {
const parsedMessage = MsgExecuteContract.decode(message.value);
const instruction = JSON.parse(Buffer.from(parsedMessage.msg).toString());
const base64Vaa = instruction?.complete_transfer_and_convert?.vaa;
const base64Vaa =
instruction?.complete_transfer_and_convert?.vaa || instruction?.submit_vaa?.data;
if (base64Vaa) {
const vaa = parseVaa(base64.decode(base64Vaa));

View File

@ -22,7 +22,7 @@ export class SeiJsonRPCBlockRepository implements SeiRepository {
async getRedeems(chainId: number, address: string, blockBatchSize: number): Promise<SeiRedeem[]> {
try {
let resultTransactionSearch: ResultTransactionSearch;
const query = `wasm._contract_address='${address}' AND wasm.action='${ACTION}'`;
const query = `"wasm._contract_address='${address}'"`;
const perPageLimit = 20;
const seiRedeems = [];
@ -41,7 +41,8 @@ export class SeiJsonRPCBlockRepository implements SeiRepository {
seiRedeems.push(...resultTransactionSearch.txs);
}
if (Number(resultTransactionSearch.total_count) >= blockBatchSize) {
const totalCount = page * perPageLimit;
if (totalCount >= blockBatchSize) {
continuesFetching = false;
}
page++;

View File

@ -506,5 +506,6 @@ describe("seiRedeemedTransactionFoundMapper", () => {
108, 9, 253, 45, 17, 28, 158, 91, 188, 252, 20, 75, 13, 48, 8, 253, 45, 67, 193, 181, 32, 24,
126, 152, 15, 242, 109, 18, 211, 225, 99, 16,
]),
timestamp: 123123123,
};
});