Skip to content

Commit 77b0536

Browse files
committed
watcher: add sepolia
1 parent 3ea71d7 commit 77b0536

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

watcher/src/consts.ts

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export const RPCS_BY_CHAIN: { [key in Environment]: { [key in ChainName]?: strin
8080
base: process.env.BASE_RPC,
8181
sei: process.env.SEI_RPC,
8282
wormchain: process.env.WORMCHAIN_RPC,
83+
sepolia: process.env.SEPOLIA_RPC,
8384
},
8485
['devnet']: {},
8586
};

watcher/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const supportedChains: ChainName[] =
4242
'base',
4343
'sei',
4444
// 'wormchain',
45+
'sepolia',
4546
]
4647
: [
4748
// This is the list of chains supported in MAINNET.

watcher/src/watchers/EVMWatcher.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Implementation__factory } from '@certusone/wormhole-sdk/lib/cjs/ethers-contracts/factories/Implementation__factory';
2-
import { CONTRACTS, EVMChainName } from '@certusone/wormhole-sdk/lib/cjs/utils/consts';
2+
import { CONTRACTS, Contracts, EVMChainName } from '@certusone/wormhole-sdk/lib/cjs/utils/consts';
33
import { Log } from '@ethersproject/abstract-provider';
44
import axios from 'axios';
55
import { BigNumber } from 'ethers';
@@ -206,7 +206,13 @@ export class EVMWatcher extends Watcher {
206206
}
207207

208208
async getMessagesForBlocks(fromBlock: number, toBlock: number): Promise<VaasByBlock> {
209-
const address = CONTRACTS.MAINNET[this.chain].core;
209+
const contracts: Contracts =
210+
this.network === 'mainnet'
211+
? CONTRACTS.MAINNET[this.chain]
212+
: this.network === 'testnet'
213+
? CONTRACTS.TESTNET[this.chain]
214+
: CONTRACTS.DEVNET[this.chain];
215+
const address = contracts.core;
210216
if (!address) {
211217
throw new Error(`Core contract not defined for ${this.chain}`);
212218
}

watcher/src/watchers/Watcher.ts

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class Watcher {
7474
fromBlock = toBlock;
7575
}
7676
retry = 0;
77+
this.logger.debug(`fromBlock = ${fromBlock}, toBlock = ${toBlock}`);
7778
await sleep(TIMEOUT);
7879
} catch (e) {
7980
// skip attempting to fetch messages until getting the finalized block succeeds

watcher/src/watchers/utils.ts

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export function makeFinalizedWatcher(network: Environment, chainName: ChainName)
5656
return new SuiWatcher(network);
5757
} else if (chainName === 'wormchain') {
5858
return new WormchainWatcher(network);
59+
} else if (chainName === 'sepolia' && network === 'testnet') {
60+
return new EVMWatcher(network, chainName, 'finalized');
5961
} else {
6062
throw new Error(`Attempted to create finalized watcher for unsupported chain ${chainName}`);
6163
}

0 commit comments

Comments
 (0)