import type { Hex } from 'viem' export type JsonSerializable = | bigint | string | number | boolean | null | JsonSerializableArray | JsonSerializableObject | JsonSerializableSet export type JsonSerializableArray = ReadonlyArray export type JsonSerializableObject = { [key: string]: JsonSerializable } export type JsonSerializableSet< T extends bigint | string | number | boolean = | bigint | string | number | boolean, > = Set export type BigIntToHex = T extends bigint ? Hex : T export type SetToHex = T extends Set ? Hex : T export type SerializeToJson = T extends JsonSerializableSet ? ReadonlyArray : T extends JsonSerializableObject ? { [P in keyof T]: SerializeToJson } : T extends JsonSerializableArray ? SerializeToJson[] : BigIntToHex>