"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsonSafe = jsonSafe;
/** JSON-safe hub header / nested values (ethers returns bigint). */
function jsonSafe(value) {
    if (typeof value === 'bigint')
        return value.toString();
    if (Array.isArray(value))
        return value.map(jsonSafe);
    if (value !== null && typeof value === 'object') {
        const out = {};
        for (const [k, v] of Object.entries(value)) {
            out[k] = jsonSafe(v);
        }
        return out;
    }
    return value;
}
