Skip to content

Commit ec483a0

Browse files
committed
make it pretty
1 parent 30b8f27 commit ec483a0

File tree

2 files changed

+36
-31
lines changed

2 files changed

+36
-31
lines changed

src/api/vaas.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
import {enabledChains} from "../chains.ts";
2-
import {mockWormhole} from "../mockGuardian.ts";
3-
import {type Request, type Response} from "express";
4-
import type {Hex} from "viem";
1+
import { enabledChains } from "../chains.ts";
2+
import { mockWormhole } from "../mockGuardian.ts";
3+
import { type Request, type Response } from "express";
4+
import type { Hex } from "viem";
55

66
export const vaasHandler = async (req: Request, res: Response) => {
7-
let txHash = req.query["txHash"];
7+
let txHash = req.query["txHash"];
88

9-
if (!txHash) {
10-
res.status(400).send("txHash is required.");
11-
return;
12-
}
9+
if (!txHash) {
10+
res.status(400).send("txHash is required.");
11+
return;
12+
}
1313

14-
// Loop through enabledChains and try mockWormhole for each one, returning the first signed VAA
15-
// that mockWormhole returns.
16-
for (const chainConfig of Object.values(enabledChains)) {
17-
try {
18-
const result = await mockWormhole(
19-
chainConfig.rpc,
20-
txHash as Hex,
21-
chainConfig.coreContractAddress as Hex,
22-
""
23-
);
14+
// Loop through enabledChains and try mockWormhole for each one, returning the first signed VAA
15+
// that mockWormhole returns.
16+
for (const chainConfig of Object.values(enabledChains)) {
17+
try {
18+
const result = await mockWormhole(
19+
chainConfig.rpc,
20+
txHash as Hex,
21+
chainConfig.coreContractAddress as Hex,
22+
"",
23+
);
2424

25-
if (result !== undefined) {
26-
res.status(200).json({data: [{vaa: result}]});
27-
return;
28-
}
29-
} catch (error) {
30-
// Continue to next chain if this one fails
31-
console.log(`Failed to get VAA from chain ${chainConfig.name}:`, error);
32-
}
25+
if (result !== undefined) {
26+
res.status(200).json({ data: [{ vaa: result }] });
27+
return;
28+
}
29+
} catch (error) {
30+
// Continue to next chain if this one fails
31+
console.log(`Failed to get VAA from chain ${chainConfig.name}:`, error);
3332
}
33+
}
3434

35-
res.status(200).json({
36-
data: []
37-
});
35+
res.status(200).json({
36+
data: [],
37+
});
3838
};

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import express from "express";
22
import cors from "cors";
33
import { overrideGuardianSet } from "./overrideGuardianSet";
4-
import {quoteHandler, statusHandler, capabilitiesHandler, vaasHandler} from "./api";
4+
import {
5+
quoteHandler,
6+
statusHandler,
7+
capabilitiesHandler,
8+
vaasHandler,
9+
} from "./api";
510
import { enabledChains } from "./chains";
611
import { isHex } from "viem";
712

0 commit comments

Comments
 (0)