import type { ErrorType } from '../errors/utils.js' export type DeserializeErrorType = ErrorType /** Deserializes a Viem-flavored JSON string to a JavaScript value, with BigInt support. */ export const deserialize: typeof JSON.parse = (value, reviver) => JSON.parse(value, (key, value_) => { let value = value_ if (typeof value === 'string' && value.startsWith('#v_bigint:')) value = BigInt(value.replace('#v_bigint:', '')) return reviver?.(key, value) ?? value })