Skip to content

Commit

Permalink
feat: Add error message to BlockHash schema validation
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
  • Loading branch information
cygnusv and derekpierre committed Oct 29, 2024
1 parent fa81b97 commit f971fea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/shared/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const EthAddressSchema = z

const BLOCK_HASH_REGEXP = new RegExp('^0x[a-fA-F0-9]{64}$');
const BlockNumber = z.number().int().nonnegative();
const BlockHash = z.string().regex(BLOCK_HASH_REGEXP);
const BlockHash = z.string().regex(BLOCK_HASH_REGEXP, 'Invalid block hash');
const BlockTag = z.enum(['earliest', 'finalized', 'safe', 'latest', 'pending']);

export const BlockIdentifierSchema = z.union([BlockNumber, BlockHash, BlockTag]);

0 comments on commit f971fea

Please sign in to comment.