@@ -6,7 +6,7 @@ import { VaasByBlock } from '../databases/types';
6
6
import { makeVaaKey } from '../databases/utils' ;
7
7
import { AptosEvent } from '../types/aptos' ;
8
8
import { Watcher } from './Watcher' ;
9
- import { Network , contracts } from '@wormhole-foundation/sdk-base' ;
9
+ import { Chain , Network , contracts } from '@wormhole-foundation/sdk-base' ;
10
10
11
11
const APTOS_FIELD_NAME = 'event' ;
12
12
@@ -20,10 +20,14 @@ export class AptosWatcher extends Watcher {
20
20
coreBridgeAddress : string ;
21
21
eventHandle : string ;
22
22
23
- constructor ( network : Network ) {
24
- super ( network , 'Aptos' , 'vaa' ) ;
23
+ constructor ( network : Network , chain : Chain ) {
24
+ super ( network , chain , 'vaa' ) ;
25
25
this . client = new AptosClient ( RPCS_BY_CHAIN [ this . network ] [ this . chain ] ! ) ;
26
- this . coreBridgeAddress = contracts . coreBridge ( network , 'Aptos' ) ;
26
+ const address = contracts . coreBridge . get ( this . network , this . chain ) ;
27
+ if ( ! address ) {
28
+ throw new Error ( `Core contract not defined for ${ this . chain } on ${ this . network } !` ) ;
29
+ }
30
+ this . coreBridgeAddress = address ;
27
31
this . eventHandle = `${ this . coreBridgeAddress } ::state::WormholeMessageHandle` ;
28
32
}
29
33
@@ -75,9 +79,8 @@ export class AptosWatcher extends Watcher {
75
79
const initialSequence = z
76
80
. number ( )
77
81
. int ( )
78
- . parse ( Number ( INITIAL_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN [ this . network ] . Aptos ) ) ;
82
+ . parse ( Number ( INITIAL_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN [ this . network ] [ this . chain ] ) ) ;
79
83
return (
80
- z . number ( ) . int ( ) . parse ( Number ( block ) ) > 1094390 && // initial deployment block
81
84
Date . parse ( z . string ( ) . datetime ( ) . parse ( timestamp ) ) < Date . now ( ) &&
82
85
z . number ( ) . int ( ) . parse ( Number ( sequence ) ) >= initialSequence // initial deployment sequence
83
86
) ;
0 commit comments