File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { z } from 'zod';
55
66import { L2BlockHash } from '../block/block_hash.js' ;
77import { TxHash } from '../tx/tx_hash.js' ;
8+ import { type UInt64 , UInt64Schema } from '../types/shared.js' ;
89import { PrivateLog } from './private_log.js' ;
910import { PublicLog } from './public_log.js' ;
1011
@@ -36,7 +37,7 @@ export class TxScopedL2Log {
3637 /*
3738 * The timestamp of the block this log is included in
3839 */
39- public blockTimestamp : bigint ,
40+ public blockTimestamp : UInt64 ,
4041 /*
4142 * The log data as either a PrivateLog or PublicLog
4243 */
@@ -55,7 +56,7 @@ export class TxScopedL2Log {
5556 logIndexInTx : z . number ( ) ,
5657 blockNumber : BlockNumberSchema ,
5758 blockHash : L2BlockHash . schema ,
58- blockTimestamp : z . bigint ( ) ,
59+ blockTimestamp : UInt64Schema ,
5960 log : z . union ( [ PrivateLog . schema , PublicLog . schema ] ) ,
6061 } )
6162 . transform (
Original file line number Diff line number Diff line change 11import { type Bufferable , serializeToBuffer } from '@aztec/foundation/serialize' ;
22
3+ import { z } from 'zod' ;
4+
35/**
46 * Implementation of a vector. Matches how we are serializing and deserializing vectors in cpp (length in the first position, followed by the items).
57 */
@@ -30,6 +32,12 @@ export type UInt32 = number;
3032 */
3133export type UInt64 = bigint ;
3234
35+ /**
36+ * Zod schema for UInt64 that accepts bigint, number, or string (from JSON) and coerces to bigint.
37+ * Inspired by BlockNumberSchema.
38+ */
39+ export const UInt64Schema = z . union ( [ z . bigint ( ) , z . number ( ) , z . string ( ) ] ) . pipe ( z . coerce . bigint ( ) ) ;
40+
3341/**
3442 * A type alias for a 128-bit unsigned integer.
3543 */
You can’t perform that action at this time.
0 commit comments