Skip to content

Commit 9c877fb

Browse files
im-shamclaude
andcommitted
fix(api): correct ABI import casing and template serialization
- ABI exports are camelCase (aegisEscrowAbi), not PascalCase - Use JSON.parse/stringify for BigInt serialization instead of Hono's c.json replacer option Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 52e2659 commit 9c877fb

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

api/src/routes/templates.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ export function createTemplateRoutes(sdk?: AegisClient, subgraph?: GraphQLClient
1111
if (!sdk) return c.json({ error: "SDK not initialized" }, 503);
1212
const templateId = BigInt(c.req.param("id"));
1313
const template = await sdk.factory.getTemplate(templateId);
14-
return c.json(template, 200, {
15-
replacer: (_: string, v: unknown) => (typeof v === "bigint" ? v.toString() : v),
16-
});
14+
const serialized = JSON.parse(
15+
JSON.stringify(template, (_: string, v: unknown) => (typeof v === "bigint" ? v.toString() : v)),
16+
);
17+
return c.json(serialized);
1718
});
1819

1920
router.get("/:id/active", async (c) => {

api/src/services/events.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import {
77
} from "viem";
88
import { baseSepolia, base } from "viem/chains";
99
import type { SupportedChain, ContractAddresses } from "@aegis-protocol/types";
10-
import { AegisEscrowAbi } from "@aegis-protocol/abis";
11-
import { AegisDisputeAbi } from "@aegis-protocol/abis";
12-
import { AegisTreasuryAbi } from "@aegis-protocol/abis";
13-
import { AegisJobFactoryAbi } from "@aegis-protocol/abis";
10+
import {
11+
aegisEscrowAbi,
12+
aegisDisputeAbi,
13+
aegisTreasuryAbi,
14+
aegisJobFactoryAbi,
15+
} from "@aegis-protocol/abis";
1416

1517
const CHAIN_MAP = { "base-sepolia": baseSepolia, base } as const;
1618

@@ -48,10 +50,10 @@ export function watchAllContracts(
4850

4951
// Watch each contract
5052
const contracts = [
51-
{ name: "escrow", address: addresses.escrow, abi: AegisEscrowAbi },
52-
{ name: "dispute", address: addresses.dispute, abi: AegisDisputeAbi },
53-
{ name: "treasury", address: addresses.treasury, abi: AegisTreasuryAbi },
54-
{ name: "factory", address: addresses.factory, abi: AegisJobFactoryAbi },
53+
{ name: "escrow", address: addresses.escrow, abi: aegisEscrowAbi },
54+
{ name: "dispute", address: addresses.dispute, abi: aegisDisputeAbi },
55+
{ name: "treasury", address: addresses.treasury, abi: aegisTreasuryAbi },
56+
{ name: "factory", address: addresses.factory, abi: aegisJobFactoryAbi },
5557
] as const;
5658

5759
for (const { name, address, abi } of contracts) {

0 commit comments

Comments
 (0)