Created
March 8, 2025 00:10
-
-
Save gregfromstl/d7098325d8c1ab72ad5e4c0ad1cc9419 to your computer and use it in GitHub Desktop.
Checksum Address Hono
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { z } from "@hono/zod-openapi"; | |
| import { Address as ox__Address } from "ox"; | |
| export const AddressSchema = z | |
| .string() | |
| .refine((address) => ox__Address.validate(address), { | |
| message: "Must be a valid Ethereum address", | |
| }) | |
| .transform((address) => ox__Address.checksum(address)); | |
| export type Address = z.infer<typeof AddressSchema>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment