Skip to content

Commit

Permalink
watcher: move terra2 to explorer watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
panoel committed Oct 7, 2024
1 parent 7ffa628 commit d88c8cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion watcher/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const RPCS_BY_CHAIN: { [key in Network]: { [key in Chain]?: string } } =
Aptos: process.env.APTOS_RPC || 'https://fullnode.mainnet.aptoslabs.com/',
Near: process.env.NEAR_RPC || 'https://rpc.mainnet.near.org',
Xpla: process.env.XPLA_RPC || 'https://dimension-lcd.xpla.dev',
Terra2: process.env.TERRA2_RPC || 'https://terra-lcd.publicnode.com',
Terra2: process.env.TERRA2_RPC || 'https://phoenix-fcd.terra.dev',
Terra: process.env.TERRA_RPC || 'https://terra-classic-fcd.publicnode.com',
Injective: process.env.INJECTIVE_RPC || 'https://sentry.exchange.grpc-web.injective.network',
Solana: process.env.SOLANA_RPC || 'https://api.mainnet-beta.solana.com',
Expand Down
10 changes: 5 additions & 5 deletions watcher/src/watchers/__tests__/CosmwasmWatcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import { isBase64Encoded } from '../../utils/isBase64Encoded';
jest.setTimeout(60000);

test('getFinalizedBlockNumber(terra2)', async () => {
const watcher = new CosmwasmWatcher('Mainnet', 'Terra2');
const watcher = new TerraExplorerWatcher('Mainnet', 'Terra2');
const blockNumber = await watcher.getFinalizedBlockNumber();
expect(blockNumber).toBeGreaterThan(3181746);
});

test('getMessagesForBlocks(terra2)', async () => {
const watcher = new CosmwasmWatcher('Mainnet', 'Terra2');
const watcher = new TerraExplorerWatcher('Mainnet', 'Terra2');
const vaasByBlock = await watcher.getMessagesForBlocks(10847656, 10847657);
const entries = Object.entries(vaasByBlock);
expect(entries.length).toEqual(2);
expect(entries.filter(([block, vaas]) => vaas.length === 0).length).toEqual(1);
expect(entries.filter(([block, vaas]) => vaas.length === 1).length).toEqual(1);
expect(entries.filter(([block, vaas]) => vaas.length === 2).length).toEqual(0);
expect(vaasByBlock['10847656/2024-06-20T08:02:18.898Z']).toBeDefined();
expect(vaasByBlock['10847656/2024-06-20T08:02:18.898Z'].length).toEqual(1);
expect(vaasByBlock['10847656/2024-06-20T08:02:18.898Z'][0]).toEqual(
expect(vaasByBlock['10847656/2024-06-20T08:02:18.000Z']).toBeDefined();
expect(vaasByBlock['10847656/2024-06-20T08:02:18.000Z'].length).toEqual(1);
expect(vaasByBlock['10847656/2024-06-20T08:02:18.000Z'][0]).toEqual(
'F99C1EAE1969723592024DB7ABD247A62663452BA82003C64F0248B2B62A482A:18/a463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3/3444'
);
});
Expand Down
4 changes: 2 additions & 2 deletions watcher/src/watchers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export function makeFinalizedWatcher(network: Network, chainName: Chain): Watche
return new InjectiveExplorerWatcher(network);
} else if (chainName === 'Sei') {
return new SeiExplorerWatcher(network);
} else if (chainName === 'Terra') {
} else if (chainName === 'Terra' || chainName === 'Terra2') {
return new TerraExplorerWatcher(network, chainName);
} else if (chainName === 'Xpla' || chainName === 'Terra2') {
} else if (chainName === 'Xpla') {
return new CosmwasmWatcher(network, chainName);
} else if (chainName === 'Sui') {
return new SuiWatcher(network);
Expand Down

0 comments on commit d88c8cc

Please sign in to comment.