Skip to content

Commit

Permalink
chore: fix zod schema validation to account for 0x string salt
Browse files Browse the repository at this point in the history
  • Loading branch information
canhtrinh committed Dec 20, 2023
1 parent 2cca85b commit 974ab98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions apps/maestro/src/lib/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export const hex64 = () =>
*/
export const hex0x = () => z.string().startsWith("0x").max(2);

export const hex0xLiteral = () => hex0x().transform(asHexLiteral);

export const hex40Literal = () => hex40().transform(asHexLiteral);

export const hex64Literal = () => hex64().transform(asHexLiteral);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { TRPCError } from "@trpc/server";
import { z } from "zod";

import { hex0x, hex40Literal, hex64Literal } from "~/lib/utils/validation";
import {
hex0xLiteral,
hex40Literal,
hex64Literal,
} from "~/lib/utils/validation";
import { publicProcedure } from "~/server/trpc";

const remoteTokenSchema = z.object({
Expand Down Expand Up @@ -30,7 +34,7 @@ const outputSchema = z.object({
kind: z.string(),
createdAt: z.date().nullable(),
updatedAt: z.date().nullable(),
salt: hex64Literal().or(hex0x()),
salt: hex64Literal().or(hex0xLiteral()),
remoteTokens: z.array(remoteTokenSchema),
});

Expand Down

2 comments on commit 974ab98

@vercel
Copy link

@vercel vercel bot commented on 974ab98 Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

axelar-registry – ./apps/registry

axelar-registry-git-main-axelar-network.vercel.app
axelar-registry-axelar-network.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 974ab98 Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

axelar-ui – ./packages/ui

axelar-ui.vercel.app
axelar-ui-axelar-network.vercel.app
ui.axelar.dev
axelar-ui-git-main-axelar-network.vercel.app

Please sign in to comment.