@@ -37,6 +37,8 @@ const KEYPAIR: Keypair = Keypair.fromSecretKey(
37
37
Uint8Array . from ( JSON . parse ( fs . readFileSync ( envOrErr ( "WALLET" ) , "ascii" ) ) )
38
38
) ;
39
39
const OFFSET : number = Number ( process . env . OFFSET ?? "-1" ) ;
40
+ const SKIP_FAILED_REMOTE_INSTRUCTIONS : boolean =
41
+ process . env . SKIP_FAILED_REMOTE_INSTRUCTIONS == "true" ;
40
42
const COMMITMENT : Commitment =
41
43
( process . env . COMMITMENT as Commitment ) ?? "confirmed" ;
42
44
@@ -163,15 +165,24 @@ async function run() {
163
165
}
164
166
}
165
167
166
- await remoteExecutor . methods
167
- . executePostedVaa ( )
168
- . accounts ( {
169
- claimRecord : claimRecordAddress ,
170
- postedVaa : derivePostedVaaKey ( WORMHOLE_ADDRESS [ CLUSTER ] ! , vaa . hash ) ,
171
- } )
172
- . remainingAccounts ( extraAccountMetas )
173
- . preInstructions ( preInstructions )
174
- . rpc ( { skipPreflight : true } ) ;
168
+ try {
169
+ await remoteExecutor . methods
170
+ . executePostedVaa ( )
171
+ . accounts ( {
172
+ claimRecord : claimRecordAddress ,
173
+ postedVaa : derivePostedVaaKey (
174
+ WORMHOLE_ADDRESS [ CLUSTER ] ! ,
175
+ vaa . hash
176
+ ) ,
177
+ } )
178
+ . remainingAccounts ( extraAccountMetas )
179
+ . preInstructions ( preInstructions )
180
+ . rpc ( { skipPreflight : true } ) ;
181
+ } catch ( e ) {
182
+ if ( SKIP_FAILED_REMOTE_INSTRUCTIONS ) {
183
+ console . error ( e ) ;
184
+ } else throw e ;
185
+ }
175
186
}
176
187
} else if ( response . code == 5 ) {
177
188
console . log ( `All VAAs have been relayed` ) ;
0 commit comments