"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.gasPriceError = gasPriceError;
exports.getPublicClient = getPublicClient;
const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
const viem_1 = require("viem");
const chains = tslib_1.__importStar(require("viem/chains"));
function gasPriceError(method, chainId, data) {
    throw new Error(`Malformed ${method} response on chain ID ${chainId} (${JSON.stringify(data)})`);
}
function getPublicClient(chainId, transport) {
    transport ??= (0, viem_1.http)();
    const chain = Object.values(chains).find((chain) => chain.id === chainId);
    (0, assert_1.default)(chain);
    return (0, viem_1.createPublicClient)({ chain, transport });
}
//# sourceMappingURL=util.js.map