File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { enabledChains } from "../chains.ts" ;
2
2
import { mockWormhole } from "../mockGuardian.ts" ;
3
3
import { type Request , type Response } from "express" ;
4
- import type { Hex } from "viem" ;
4
+ import { type Hex , isHex } from "viem" ;
5
5
6
6
export const vaasHandler = async ( req : Request , res : Response ) => {
7
7
let txHash = req . query [ "txHash" ] ;
@@ -11,14 +11,22 @@ export const vaasHandler = async (req: Request, res: Response) => {
11
11
return ;
12
12
}
13
13
14
+ if ( ! isHex ( txHash ) ) {
15
+ res . status ( 400 ) . send ( "txHash must be a valid hex string." ) ;
16
+ return ;
17
+ }
18
+
14
19
// Loop through enabledChains and try mockWormhole for each one, returning the first signed VAA
15
20
// that mockWormhole returns.
16
21
for ( const chainConfig of Object . values ( enabledChains ) ) {
17
22
try {
23
+ if ( ! isHex ( chainConfig . coreContractAddress ) ) {
24
+ continue ;
25
+ }
18
26
const result = await mockWormhole (
19
27
chainConfig . rpc ,
20
- txHash as Hex ,
21
- chainConfig . coreContractAddress as Hex ,
28
+ txHash ,
29
+ chainConfig . coreContractAddress ,
22
30
"" ,
23
31
) ;
24
32
You can’t perform that action at this time.
0 commit comments