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