Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl committed Dec 12, 2024
1 parent 8d4adef commit c0ba044
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 7 additions & 4 deletions api/_types/exclusivity.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import { array, boolean, Infer, object, optional } from "superstruct";
import { positiveFloatStr, positiveIntStr, validAddress } from "../_utils";
import { TypedVercelRequest } from "./generic.types";

export const RelayerFillLimitSchema = object({
export const RelayerRoute = object({
originChainId: positiveIntStr(),
destinationChainId: positiveIntStr(),
inputToken: validAddress(),
destinationChainId: positiveIntStr(),
outputToken: validAddress(),
});

export const RelayerFillLimitSchema = object({
minOutputAmount: positiveIntStr(),
maxOutputAmount: positiveIntStr(),
minProfitThreshold: positiveFloatStr(),
Expand All @@ -25,9 +28,9 @@ export type RelayerFillLimit = Infer<typeof RelayerFillLimitSchema>;

export type RelayerConfigUpdate = {
timestamp: number;
originChainId: number;
originChainId: string;
inputToken: string;
destinationChainId: number;
destinationChainId: string;
outputToken: string;
relayerFillLimits: RelayerFillLimit[];
};
Expand Down
8 changes: 8 additions & 0 deletions test/api/relayer-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ describe("Relayer Config API", () => {
test("POST request with invalid timestamp", async () => {
const message: RelayerConfigUpdate = {
timestamp: Date.now() / 1000 - MAX_MESSAGE_AGE_SECONDS - 1,
originChainId: "1",
inputToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
destinationChainId: "10",
outputToken: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
relayerFillLimits: [],
};
const signature = await whitelistedRelayer.signMessage(
Expand All @@ -87,6 +91,10 @@ describe("Relayer Config API", () => {
test("POST request with invalid signature", async () => {
const message: RelayerConfigUpdate = {
timestamp: Date.now() / 1000,
originChainId: "1",
inputToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
destinationChainId: "10",
outputToken: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
relayerFillLimits: [],
};
const signature = await unauthorizedRelayer.signMessage(
Expand Down

0 comments on commit c0ba044

Please sign in to comment.