[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:
parent
dabe8172da
commit
31e87382d6
File diff suppressed because it is too large
Load Diff
|
@ -23,7 +23,7 @@
|
||||||
"@certusone/wormhole-sdk": "0.10.5",
|
"@certusone/wormhole-sdk": "0.10.5",
|
||||||
"@cosmjs/proto-signing": "^0.32.3",
|
"@cosmjs/proto-signing": "^0.32.3",
|
||||||
"@mysten/sui.js": "^0.49.1",
|
"@mysten/sui.js": "^0.49.1",
|
||||||
"@xlabs/rpc-pool": "^0.0.3",
|
"@xlabs/rpc-pool": "^0.0.4",
|
||||||
"axios": "^1.6.0",
|
"axios": "^1.6.0",
|
||||||
"bs58": "^5.0.0",
|
"bs58": "^5.0.0",
|
||||||
"config": "^3.3.9",
|
"config": "^3.3.9",
|
||||||
|
|
|
@ -21,7 +21,7 @@ export const seiRedeemedTransactionFoundMapper = (
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const txAttributes = transactionAttributes(addresses, transaction);
|
const txAttributes = transactionAttributes(addresses, transaction);
|
||||||
if (!txAttributes) {
|
if (!txAttributes || !transaction.timestamp) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const hash = transaction.hash;
|
const hash = transaction.hash;
|
||||||
|
@ -61,7 +61,8 @@ function mappedVaaInformation(tx: Buffer): VaaInformation | undefined {
|
||||||
const parsedMessage = MsgExecuteContract.decode(message.value);
|
const parsedMessage = MsgExecuteContract.decode(message.value);
|
||||||
|
|
||||||
const instruction = JSON.parse(Buffer.from(parsedMessage.msg).toString());
|
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) {
|
if (base64Vaa) {
|
||||||
const vaa = parseVaa(base64.decode(base64Vaa));
|
const vaa = parseVaa(base64.decode(base64Vaa));
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class SeiJsonRPCBlockRepository implements SeiRepository {
|
||||||
async getRedeems(chainId: number, address: string, blockBatchSize: number): Promise<SeiRedeem[]> {
|
async getRedeems(chainId: number, address: string, blockBatchSize: number): Promise<SeiRedeem[]> {
|
||||||
try {
|
try {
|
||||||
let resultTransactionSearch: ResultTransactionSearch;
|
let resultTransactionSearch: ResultTransactionSearch;
|
||||||
const query = `wasm._contract_address='${address}' AND wasm.action='${ACTION}'`;
|
const query = `"wasm._contract_address='${address}'"`;
|
||||||
|
|
||||||
const perPageLimit = 20;
|
const perPageLimit = 20;
|
||||||
const seiRedeems = [];
|
const seiRedeems = [];
|
||||||
|
@ -41,7 +41,8 @@ export class SeiJsonRPCBlockRepository implements SeiRepository {
|
||||||
seiRedeems.push(...resultTransactionSearch.txs);
|
seiRedeems.push(...resultTransactionSearch.txs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Number(resultTransactionSearch.total_count) >= blockBatchSize) {
|
const totalCount = page * perPageLimit;
|
||||||
|
if (totalCount >= blockBatchSize) {
|
||||||
continuesFetching = false;
|
continuesFetching = false;
|
||||||
}
|
}
|
||||||
page++;
|
page++;
|
||||||
|
|
|
@ -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,
|
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,
|
126, 152, 15, 242, 109, 18, 211, 225, 99, 16,
|
||||||
]),
|
]),
|
||||||
|
timestamp: 123123123,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue