import { a as D, Z as Se, t as dt, f as ft, X as ht, d as Le, p as $e, g as Fe, l as Ge, h as He, P as Oe } from "./index-DoYa-2VZ.mjs";
import { defineChain as S } from "viem";
import { clusterApiUrl as Ce } from "@solana/web3.js";
import { WalletAdapterNetwork as Ne } from "@solana/wallet-adapter-base";
function _(e) {
  return {
    formatters: void 0,
    fees: void 0,
    serializers: void 0,
    ...e
  };
}
const De = "2.28.1";
let O = {
  getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0,
  version: `viem@${De}`
};
class h extends Error {
  constructor(t, s = {}) {
    var a;
    const n = (() => {
      var c;
      return s.cause instanceof h ? s.cause.details : (c = s.cause) != null && c.message ? s.cause.message : s.details;
    })(), i = s.cause instanceof h && s.cause.docsPath || s.docsPath, r = (a = O.getDocsUrl) == null ? void 0 : a.call(O, { ...s, docsPath: i }), o = [
      t || "An error occurred.",
      "",
      ...s.metaMessages ? [...s.metaMessages, ""] : [],
      ...r ? [`Docs: ${r}`] : [],
      ...n ? [`Details: ${n}`] : [],
      ...O.version ? [`Version: ${O.version}`] : []
    ].join(`
`);
    super(o, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docsPath", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "metaMessages", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "shortMessage", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "version", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "BaseError"
    }), this.details = n, this.docsPath = i, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = De;
  }
  walk(t) {
    return _e(this, t);
  }
}
function _e(e, t) {
  return t != null && t(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? _e(e.cause, t) : t ? null : e;
}
class pt extends h {
  constructor({ max: t, min: s, signed: n, size: i, value: r }) {
    super(`Number "${r}" is not in safe ${i ? `${i * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${s} to ${t})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
  }
}
class bt extends h {
  constructor({ givenSize: t, maxSize: s }) {
    super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
  }
}
function V(e, { strict: t = !0 } = {}) {
  return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
}
function k(e) {
  return V(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
}
function Y(e, { dir: t = "left" } = {}) {
  let s = typeof e == "string" ? e.replace("0x", "") : e, n = 0;
  for (let i = 0; i < s.length - 1 && s[t === "left" ? i : s.length - i - 1].toString() === "0"; i++)
    n++;
  return s = t === "left" ? s.slice(n) : s.slice(0, s.length - n), typeof e == "string" ? (s.length === 1 && t === "right" && (s = `${s}0`), `0x${s.length % 2 === 1 ? `0${s}` : s}`) : s;
}
class xt extends h {
  constructor({ offset: t, position: s, size: n }) {
    super(`Slice ${s === "start" ? "starting" : "ending"} at offset "${t}" is out-of-bounds (size: ${n}).`, { name: "SliceOffsetOutOfBoundsError" });
  }
}
class Ve extends h {
  constructor({ size: t, targetSize: s, type: n }) {
    super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
  }
}
function L(e, { dir: t, size: s = 32 } = {}) {
  return typeof e == "string" ? mt(e, { dir: t, size: s }) : gt(e, { dir: t, size: s });
}
function mt(e, { dir: t, size: s = 32 } = {}) {
  if (s === null)
    return e;
  const n = e.replace("0x", "");
  if (n.length > s * 2)
    throw new Ve({
      size: Math.ceil(n.length / 2),
      targetSize: s,
      type: "hex"
    });
  return `0x${n[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
}
function gt(e, { dir: t, size: s = 32 } = {}) {
  if (s === null)
    return e;
  if (e.length > s)
    throw new Ve({
      size: e.length,
      targetSize: s,
      type: "bytes"
    });
  const n = new Uint8Array(s);
  for (let i = 0; i < s; i++) {
    const r = t === "right";
    n[r ? i : s - i - 1] = e[r ? i : e.length - i - 1];
  }
  return n;
}
const yt = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
function d(e, t = {}) {
  return typeof e == "number" || typeof e == "bigint" ? Me(e, t) : typeof e == "string" ? Bt(e, t) : typeof e == "boolean" ? wt(e, t) : B(e, t);
}
function wt(e, t = {}) {
  const s = `0x${Number(e)}`;
  return typeof t.size == "number" ? ($(s, { size: t.size }), L(s, { size: t.size })) : s;
}
function B(e, t = {}) {
  let s = "";
  for (let i = 0; i < e.length; i++)
    s += yt[e[i]];
  const n = `0x${s}`;
  return typeof t.size == "number" ? ($(n, { size: t.size }), L(n, { dir: "right", size: t.size })) : n;
}
function Me(e, t = {}) {
  const { signed: s, size: n } = t, i = BigInt(e);
  let r;
  n ? s ? r = (1n << BigInt(n) * 8n - 1n) - 1n : r = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
  const o = typeof r == "bigint" && s ? -r - 1n : 0;
  if (r && i > r || i < o) {
    const c = typeof e == "bigint" ? "n" : "";
    throw new pt({
      max: r ? `${r}${c}` : void 0,
      min: `${o}${c}`,
      signed: s,
      size: n,
      value: `${e}${c}`
    });
  }
  const a = `0x${(s && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`;
  return n ? L(a, { size: n }) : a;
}
const vt = /* @__PURE__ */ new TextEncoder();
function Bt(e, t = {}) {
  const s = vt.encode(e);
  return B(s, t);
}
const Pt = /* @__PURE__ */ new TextEncoder();
function je(e, t = {}) {
  return typeof e == "number" || typeof e == "bigint" ? It(e, t) : typeof e == "boolean" ? Et(e, t) : V(e) ? E(e, t) : Re(e, t);
}
function Et(e, t = {}) {
  const s = new Uint8Array(1);
  return s[0] = Number(e), typeof t.size == "number" ? ($(s, { size: t.size }), L(s, { size: t.size })) : s;
}
const y = {
  zero: 48,
  nine: 57,
  A: 65,
  F: 70,
  a: 97,
  f: 102
};
function ve(e) {
  if (e >= y.zero && e <= y.nine)
    return e - y.zero;
  if (e >= y.A && e <= y.F)
    return e - (y.A - 10);
  if (e >= y.a && e <= y.f)
    return e - (y.a - 10);
}
function E(e, t = {}) {
  let s = e;
  t.size && ($(s, { size: t.size }), s = L(s, { dir: "right", size: t.size }));
  let n = s.slice(2);
  n.length % 2 && (n = `0${n}`);
  const i = n.length / 2, r = new Uint8Array(i);
  for (let o = 0, a = 0; o < i; o++) {
    const c = ve(n.charCodeAt(a++)), u = ve(n.charCodeAt(a++));
    if (c === void 0 || u === void 0)
      throw new h(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
    r[o] = c * 16 + u;
  }
  return r;
}
function It(e, t) {
  const s = Me(e, t);
  return E(s);
}
function Re(e, t = {}) {
  const s = Pt.encode(e);
  return typeof t.size == "number" ? ($(s, { size: t.size }), L(s, { dir: "right", size: t.size })) : s;
}
function $(e, { size: t }) {
  if (k(e) > t)
    throw new bt({
      givenSize: k(e),
      maxSize: t
    });
}
function A(e, t = {}) {
  const { signed: s } = t;
  t.size && $(e, { size: t.size });
  const n = BigInt(e);
  if (!s)
    return n;
  const i = (e.length - 2) / 2, r = (1n << BigInt(i) * 8n - 1n) - 1n;
  return n <= r ? n : n - BigInt(`0x${"f".padStart(i * 2, "f")}`) - 1n;
}
function Z(e, t = {}) {
  return Number(A(e, t));
}
function le(e, t) {
  return ({ exclude: s, format: n }) => ({
    exclude: s,
    format: (i) => {
      const r = t(i);
      if (s)
        for (const o of s)
          delete r[o];
      return {
        ...r,
        ...n(i)
      };
    },
    type: e
  });
}
const Ke = {
  "0x0": "legacy",
  "0x1": "eip2930",
  "0x2": "eip1559",
  "0x3": "eip4844",
  "0x4": "eip7702"
};
function de(e) {
  const t = {
    ...e,
    blockHash: e.blockHash ? e.blockHash : null,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    chainId: e.chainId ? Z(e.chainId) : void 0,
    gas: e.gas ? BigInt(e.gas) : void 0,
    gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
    maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
    maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
    maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
    nonce: e.nonce ? Z(e.nonce) : void 0,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
    type: e.type ? Ke[e.type] : void 0,
    typeHex: e.type ? e.type : void 0,
    value: e.value ? BigInt(e.value) : void 0,
    v: e.v ? BigInt(e.v) : void 0
  };
  return e.authorizationList && (t.authorizationList = zt(e.authorizationList)), t.yParity = (() => {
    if (e.yParity)
      return Number(e.yParity);
    if (typeof t.v == "bigint") {
      if (t.v === 0n || t.v === 27n)
        return 0;
      if (t.v === 1n || t.v === 28n)
        return 1;
      if (t.v >= 35n)
        return t.v % 2n === 0n ? 1 : 0;
    }
  })(), t.type === "legacy" && (delete t.accessList, delete t.maxFeePerBlobGas, delete t.maxFeePerGas, delete t.maxPriorityFeePerGas, delete t.yParity), t.type === "eip2930" && (delete t.maxFeePerBlobGas, delete t.maxFeePerGas, delete t.maxPriorityFeePerGas), t.type === "eip1559" && delete t.maxFeePerBlobGas, t;
}
const Ut = /* @__PURE__ */ le("transaction", de);
function zt(e) {
  return e.map((t) => ({
    address: t.address,
    chainId: Number(t.chainId),
    nonce: Number(t.nonce),
    r: t.r,
    s: t.s,
    yParity: Number(t.yParity)
  }));
}
function Tt(e) {
  const t = (e.transactions ?? []).map((s) => typeof s == "string" ? s : de(s));
  return {
    ...e,
    baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
    blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
    difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
    excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
    gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
    gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
    hash: e.hash ? e.hash : null,
    logsBloom: e.logsBloom ? e.logsBloom : null,
    nonce: e.nonce ? e.nonce : null,
    number: e.number ? BigInt(e.number) : null,
    size: e.size ? BigInt(e.size) : void 0,
    timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
    transactions: t,
    totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
  };
}
const At = /* @__PURE__ */ le("block", Tt);
function kt(e, { args: t, eventName: s } = {}) {
  return {
    ...e,
    blockHash: e.blockHash ? e.blockHash : null,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    logIndex: e.logIndex ? Number(e.logIndex) : null,
    transactionHash: e.transactionHash ? e.transactionHash : null,
    transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
    ...s ? { args: t, eventName: s } : {}
  };
}
const St = {
  "0x0": "reverted",
  "0x1": "success"
};
function Lt(e) {
  const t = {
    ...e,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    contractAddress: e.contractAddress ? e.contractAddress : null,
    cumulativeGasUsed: e.cumulativeGasUsed ? BigInt(e.cumulativeGasUsed) : null,
    effectiveGasPrice: e.effectiveGasPrice ? BigInt(e.effectiveGasPrice) : null,
    gasUsed: e.gasUsed ? BigInt(e.gasUsed) : null,
    logs: e.logs ? e.logs.map((s) => kt(s)) : null,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? Z(e.transactionIndex) : null,
    status: e.status ? St[e.status] : null,
    type: e.type ? Ke[e.type] || e.type : null
  };
  return e.blobGasPrice && (t.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (t.blobGasUsed = BigInt(e.blobGasUsed)), t;
}
const $t = /* @__PURE__ */ le("transactionReceipt", Lt), fe = 2n ** 256n - 1n;
function M(e) {
  return `0x${e.reduce((t, s) => t + s.replace("0x", ""), "")}`;
}
class Be extends h {
  constructor({ offset: t }) {
    super(`Offset \`${t}\` cannot be negative.`, {
      name: "NegativeOffsetError"
    });
  }
}
class Ft extends h {
  constructor({ length: t, position: s }) {
    super(`Position \`${s}\` is out of bounds (\`0 < position < ${t}\`).`, { name: "PositionOutOfBoundsError" });
  }
}
class Gt extends h {
  constructor({ count: t, limit: s }) {
    super(`Recursive read limit of \`${s}\` exceeded (recursive read count: \`${t}\`).`, { name: "RecursiveReadLimitExceededError" });
  }
}
const Ht = {
  bytes: new Uint8Array(),
  dataView: new DataView(new ArrayBuffer(0)),
  position: 0,
  positionReadCount: /* @__PURE__ */ new Map(),
  recursiveReadCount: 0,
  recursiveReadLimit: Number.POSITIVE_INFINITY,
  assertReadLimit() {
    if (this.recursiveReadCount >= this.recursiveReadLimit)
      throw new Gt({
        count: this.recursiveReadCount + 1,
        limit: this.recursiveReadLimit
      });
  },
  assertPosition(e) {
    if (e < 0 || e > this.bytes.length - 1)
      throw new Ft({
        length: this.bytes.length,
        position: e
      });
  },
  decrementPosition(e) {
    if (e < 0)
      throw new Be({ offset: e });
    const t = this.position - e;
    this.assertPosition(t), this.position = t;
  },
  getReadCount(e) {
    return this.positionReadCount.get(e || this.position) || 0;
  },
  incrementPosition(e) {
    if (e < 0)
      throw new Be({ offset: e });
    const t = this.position + e;
    this.assertPosition(t), this.position = t;
  },
  inspectByte(e) {
    const t = e ?? this.position;
    return this.assertPosition(t), this.bytes[t];
  },
  inspectBytes(e, t) {
    const s = t ?? this.position;
    return this.assertPosition(s + e - 1), this.bytes.subarray(s, s + e);
  },
  inspectUint8(e) {
    const t = e ?? this.position;
    return this.assertPosition(t), this.bytes[t];
  },
  inspectUint16(e) {
    const t = e ?? this.position;
    return this.assertPosition(t + 1), this.dataView.getUint16(t);
  },
  inspectUint24(e) {
    const t = e ?? this.position;
    return this.assertPosition(t + 2), (this.dataView.getUint16(t) << 8) + this.dataView.getUint8(t + 2);
  },
  inspectUint32(e) {
    const t = e ?? this.position;
    return this.assertPosition(t + 3), this.dataView.getUint32(t);
  },
  pushByte(e) {
    this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
  },
  pushBytes(e) {
    this.assertPosition(this.position + e.length - 1), this.bytes.set(e, this.position), this.position += e.length;
  },
  pushUint8(e) {
    this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
  },
  pushUint16(e) {
    this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, e), this.position += 2;
  },
  pushUint24(e) {
    this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, e >> 8), this.dataView.setUint8(this.position + 2, e & 255), this.position += 3;
  },
  pushUint32(e) {
    this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, e), this.position += 4;
  },
  readByte() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectByte();
    return this.position++, e;
  },
  readBytes(e, t) {
    this.assertReadLimit(), this._touch();
    const s = this.inspectBytes(e);
    return this.position += t ?? e, s;
  },
  readUint8() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint8();
    return this.position += 1, e;
  },
  readUint16() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint16();
    return this.position += 2, e;
  },
  readUint24() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint24();
    return this.position += 3, e;
  },
  readUint32() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint32();
    return this.position += 4, e;
  },
  get remaining() {
    return this.bytes.length - this.position;
  },
  setPosition(e) {
    const t = this.position;
    return this.assertPosition(e), this.position = e, () => this.position = t;
  },
  _touch() {
    if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
      return;
    const e = this.getReadCount();
    this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
  }
};
function Xe(e, { recursiveReadLimit: t = 8192 } = {}) {
  const s = Object.create(Ht);
  return s.bytes = e, s.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), s.positionReadCount = /* @__PURE__ */ new Map(), s.recursiveReadLimit = t, s;
}
function I(e, t = "hex") {
  const s = We(e), n = Xe(new Uint8Array(s.length));
  return s.encode(n), t === "hex" ? B(n.bytes) : n.bytes;
}
function We(e) {
  return Array.isArray(e) ? Ot(e.map((t) => We(t))) : Ct(e);
}
function Ot(e) {
  const t = e.reduce((i, r) => i + r.length, 0), s = qe(t);
  return {
    length: t <= 55 ? 1 + t : 1 + s + t,
    encode(i) {
      t <= 55 ? i.pushByte(192 + t) : (i.pushByte(247 + s), s === 1 ? i.pushUint8(t) : s === 2 ? i.pushUint16(t) : s === 3 ? i.pushUint24(t) : i.pushUint32(t));
      for (const { encode: r } of e)
        r(i);
    }
  };
}
function Ct(e) {
  const t = typeof e == "string" ? E(e) : e, s = qe(t.length);
  return {
    length: t.length === 1 && t[0] < 128 ? 1 : t.length <= 55 ? 1 + t.length : 1 + s + t.length,
    encode(i) {
      t.length === 1 && t[0] < 128 ? i.pushBytes(t) : t.length <= 55 ? (i.pushByte(128 + t.length), i.pushBytes(t)) : (i.pushByte(183 + s), s === 1 ? i.pushUint8(t.length) : s === 2 ? i.pushUint16(t.length) : s === 3 ? i.pushUint24(t.length) : i.pushUint32(t.length), i.pushBytes(t));
    }
  };
}
function qe(e) {
  if (e < 2 ** 8)
    return 1;
  if (e < 2 ** 16)
    return 2;
  if (e < 2 ** 24)
    return 3;
  if (e < 2 ** 32)
    return 4;
  throw new h("Length is too large.");
}
const Nt = {
  ether: -9,
  wei: 9
};
function Dt(e, t) {
  let s = e.toString();
  const n = s.startsWith("-");
  n && (s = s.slice(1)), s = s.padStart(t, "0");
  let [i, r] = [
    s.slice(0, s.length - t),
    s.slice(s.length - t)
  ];
  return r = r.replace(/(0+)$/, ""), `${n ? "-" : ""}${i || "0"}${r ? `.${r}` : ""}`;
}
function ue(e, t = "wei") {
  return Dt(e, Nt[t]);
}
function _t(e) {
  const t = Object.entries(e).map(([n, i]) => i === void 0 || i === !1 ? null : [n, i]).filter(Boolean), s = t.reduce((n, [i]) => Math.max(n, i.length), 0);
  return t.map(([n, i]) => `  ${`${n}:`.padEnd(s + 1)}  ${i}`).join(`
`);
}
class Vt extends h {
  constructor({ v: t }) {
    super(`Invalid \`v\` value "${t}". Expected 27 or 28.`, {
      name: "InvalidLegacyVError"
    });
  }
}
class Mt extends h {
  constructor({ transaction: t }) {
    super("Cannot infer a transaction type from provided transaction.", {
      metaMessages: [
        "Provided Transaction:",
        "{",
        _t(t),
        "}",
        "",
        "To infer the type, either provide:",
        "- a `type` to the Transaction, or",
        "- an EIP-1559 Transaction with `maxFeePerGas`, or",
        "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
        "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
        "- an EIP-7702 Transaction with `authorizationList`, or",
        "- a Legacy Transaction with `gasPrice`"
      ],
      name: "InvalidSerializableTransactionError"
    });
  }
}
class jt extends h {
  constructor({ storageKey: t }) {
    super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
  }
}
function Rt(e) {
  if (!e || e.length === 0)
    return [];
  const t = [];
  for (const s of e) {
    const { chainId: n, nonce: i, ...r } = s, o = s.address;
    t.push([
      n ? d(n) : "0x",
      o,
      i ? d(i) : "0x",
      ...j({}, r)
    ]);
  }
  return t;
}
function Ye(e) {
  const { kzg: t } = e, s = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((r) => E(r)) : e.blobs, i = [];
  for (const r of n)
    i.push(Uint8Array.from(t.blobToKzgCommitment(r)));
  return s === "bytes" ? i : i.map((r) => B(r));
}
function Ze(e) {
  const { kzg: t } = e, s = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((o) => E(o)) : e.blobs, i = typeof e.commitments[0] == "string" ? e.commitments.map((o) => E(o)) : e.commitments, r = [];
  for (let o = 0; o < n.length; o++) {
    const a = n[o], c = i[o];
    r.push(Uint8Array.from(t.computeBlobKzgProof(a, c)));
  }
  return s === "bytes" ? r : r.map((o) => B(o));
}
function Pe(e) {
  if (!Number.isSafeInteger(e) || e < 0)
    throw new Error("positive integer expected, got " + e);
}
function Kt(e) {
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
}
function he(e, ...t) {
  if (!Kt(e))
    throw new Error("Uint8Array expected");
  if (t.length > 0 && !t.includes(e.length))
    throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
}
function J(e, t = !0) {
  if (e.destroyed)
    throw new Error("Hash instance has been destroyed");
  if (t && e.finished)
    throw new Error("Hash#digest() has already been called");
}
function Je(e, t) {
  he(e);
  const s = t.outputLen;
  if (e.length < s)
    throw new Error("digestInto() expects output buffer of length at least " + s);
}
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function Xt(e) {
  return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
}
function ne(e) {
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
}
function g(e, t) {
  return e << 32 - t | e >>> t;
}
const Ee = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
function Wt(e) {
  return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
}
function Ie(e) {
  for (let t = 0; t < e.length; t++)
    e[t] = Wt(e[t]);
}
typeof Uint8Array.from([]).toHex == "function" && Uint8Array.fromHex;
function qt(e) {
  if (typeof e != "string")
    throw new Error("utf8ToBytes expected string, got " + typeof e);
  return new Uint8Array(new TextEncoder().encode(e));
}
function pe(e) {
  return typeof e == "string" && (e = qt(e)), he(e), e;
}
class Qe {
  // Safe version that clones internal state
  clone() {
    return this._cloneInto();
  }
}
function et(e) {
  const t = (n) => e().update(pe(n)).digest(), s = e();
  return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
}
function Yt(e, t, s, n) {
  if (typeof e.setBigUint64 == "function")
    return e.setBigUint64(t, s, n);
  const i = BigInt(32), r = BigInt(4294967295), o = Number(s >> i & r), a = Number(s & r), c = n ? 4 : 0, u = n ? 0 : 4;
  e.setUint32(t + c, o, n), e.setUint32(t + u, a, n);
}
function Zt(e, t, s) {
  return e & t ^ ~e & s;
}
function Jt(e, t, s) {
  return e & t ^ e & s ^ t & s;
}
class Qt extends Qe {
  constructor(t, s, n, i) {
    super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = ne(this.buffer);
  }
  update(t) {
    J(this);
    const { view: s, buffer: n, blockLen: i } = this;
    t = pe(t);
    const r = t.length;
    for (let o = 0; o < r; ) {
      const a = Math.min(i - this.pos, r - o);
      if (a === i) {
        const c = ne(t);
        for (; i <= r - o; o += i)
          this.process(c, o);
        continue;
      }
      n.set(t.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === i && (this.process(s, 0), this.pos = 0);
    }
    return this.length += t.length, this.roundClean(), this;
  }
  digestInto(t) {
    J(this), Je(t, this), this.finished = !0;
    const { buffer: s, view: n, blockLen: i, isLE: r } = this;
    let { pos: o } = this;
    s[o++] = 128, this.buffer.subarray(o).fill(0), this.padOffset > i - o && (this.process(n, 0), o = 0);
    for (let l = o; l < i; l++)
      s[l] = 0;
    Yt(n, i - 8, BigInt(this.length * 8), r), this.process(n, 0);
    const a = ne(t), c = this.outputLen;
    if (c % 4)
      throw new Error("_sha2: outputLen should be aligned to 32bit");
    const u = c / 4, f = this.get();
    if (u > f.length)
      throw new Error("_sha2: outputLen bigger than state");
    for (let l = 0; l < u; l++)
      a.setUint32(4 * l, f[l], r);
  }
  digest() {
    const { buffer: t, outputLen: s } = this;
    this.digestInto(t);
    const n = t.slice(0, s);
    return this.destroy(), n;
  }
  _cloneInto(t) {
    t || (t = new this.constructor()), t.set(...this.get());
    const { blockLen: s, buffer: n, length: i, finished: r, destroyed: o, pos: a } = this;
    return t.length = i, t.pos = a, t.finished = r, t.destroyed = o, i % s && t.buffer.set(n), t;
  }
}
const es = /* @__PURE__ */ new Uint32Array([
  1116352408,
  1899447441,
  3049323471,
  3921009573,
  961987163,
  1508970993,
  2453635748,
  2870763221,
  3624381080,
  310598401,
  607225278,
  1426881987,
  1925078388,
  2162078206,
  2614888103,
  3248222580,
  3835390401,
  4022224774,
  264347078,
  604807628,
  770255983,
  1249150122,
  1555081692,
  1996064986,
  2554220882,
  2821834349,
  2952996808,
  3210313671,
  3336571891,
  3584528711,
  113926993,
  338241895,
  666307205,
  773529912,
  1294757372,
  1396182291,
  1695183700,
  1986661051,
  2177026350,
  2456956037,
  2730485921,
  2820302411,
  3259730800,
  3345764771,
  3516065817,
  3600352804,
  4094571909,
  275423344,
  430227734,
  506948616,
  659060556,
  883997877,
  958139571,
  1322822218,
  1537002063,
  1747873779,
  1955562222,
  2024104815,
  2227730452,
  2361852424,
  2428436474,
  2756734187,
  3204031479,
  3329325298
]), w = /* @__PURE__ */ new Uint32Array([
  1779033703,
  3144134277,
  1013904242,
  2773480762,
  1359893119,
  2600822924,
  528734635,
  1541459225
]), v = /* @__PURE__ */ new Uint32Array(64);
class ts extends Qt {
  constructor(t = 32) {
    super(64, t, 8, !1), this.A = w[0] | 0, this.B = w[1] | 0, this.C = w[2] | 0, this.D = w[3] | 0, this.E = w[4] | 0, this.F = w[5] | 0, this.G = w[6] | 0, this.H = w[7] | 0;
  }
  get() {
    const { A: t, B: s, C: n, D: i, E: r, F: o, G: a, H: c } = this;
    return [t, s, n, i, r, o, a, c];
  }
  // prettier-ignore
  set(t, s, n, i, r, o, a, c) {
    this.A = t | 0, this.B = s | 0, this.C = n | 0, this.D = i | 0, this.E = r | 0, this.F = o | 0, this.G = a | 0, this.H = c | 0;
  }
  process(t, s) {
    for (let l = 0; l < 16; l++, s += 4)
      v[l] = t.getUint32(s, !1);
    for (let l = 16; l < 64; l++) {
      const b = v[l - 15], p = v[l - 2], F = g(b, 7) ^ g(b, 18) ^ b >>> 3, T = g(p, 17) ^ g(p, 19) ^ p >>> 10;
      v[l] = T + v[l - 7] + F + v[l - 16] | 0;
    }
    let { A: n, B: i, C: r, D: o, E: a, F: c, G: u, H: f } = this;
    for (let l = 0; l < 64; l++) {
      const b = g(a, 6) ^ g(a, 11) ^ g(a, 25), p = f + b + Zt(a, c, u) + es[l] + v[l] | 0, T = (g(n, 2) ^ g(n, 13) ^ g(n, 22)) + Jt(n, i, r) | 0;
      f = u, u = c, c = a, a = o + p | 0, o = r, r = i, i = n, n = p + T | 0;
    }
    n = n + this.A | 0, i = i + this.B | 0, r = r + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, u = u + this.G | 0, f = f + this.H | 0, this.set(n, i, r, o, a, c, u, f);
  }
  roundClean() {
    v.fill(0);
  }
  destroy() {
    this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
  }
}
const ss = /* @__PURE__ */ et(() => new ts());
function ns(e, t) {
  return ss(V(e, { strict: !1 }) ? je(e) : e);
}
function is(e) {
  const { commitment: t, version: s = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), i = ns(t);
  return i.set([s], 0), n === "bytes" ? i : B(i);
}
function rs(e) {
  const { commitments: t, version: s } = e, n = e.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), i = [];
  for (const r of t)
    i.push(is({
      commitment: r,
      to: n,
      version: s
    }));
  return i;
}
const Ue = 6, tt = 32, be = 4096, st = tt * be, ze = st * Ue - // terminator byte (0x80).
1 - // zero byte (0x00) appended to each field element.
1 * be * Ue, nt = 1;
class os extends h {
  constructor({ maxSize: t, size: s }) {
    super("Blob size is too large.", {
      metaMessages: [`Max: ${t} bytes`, `Given: ${s} bytes`],
      name: "BlobSizeTooLargeError"
    });
  }
}
class it extends h {
  constructor() {
    super("Blob data must not be empty.", { name: "EmptyBlobError" });
  }
}
class as extends h {
  constructor({ hash: t, size: s }) {
    super(`Versioned hash "${t}" size is invalid.`, {
      metaMessages: ["Expected: 32", `Received: ${s}`],
      name: "InvalidVersionedHashSizeError"
    });
  }
}
class cs extends h {
  constructor({ hash: t, version: s }) {
    super(`Versioned hash "${t}" version is invalid.`, {
      metaMessages: [
        `Expected: ${nt}`,
        `Received: ${s}`
      ],
      name: "InvalidVersionedHashVersionError"
    });
  }
}
function us(e) {
  const t = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), s = typeof e.data == "string" ? E(e.data) : e.data, n = k(s);
  if (!n)
    throw new it();
  if (n > ze)
    throw new os({
      maxSize: ze,
      size: n
    });
  const i = [];
  let r = !0, o = 0;
  for (; r; ) {
    const a = Xe(new Uint8Array(st));
    let c = 0;
    for (; c < be; ) {
      const u = s.slice(o, o + (tt - 1));
      if (a.pushByte(0), a.pushBytes(u), u.length < 31) {
        a.pushByte(128), r = !1;
        break;
      }
      c++, o += 31;
    }
    i.push(a);
  }
  return t === "bytes" ? i.map((a) => a.bytes) : i.map((a) => B(a.bytes));
}
function ls(e) {
  const { data: t, kzg: s, to: n } = e, i = e.blobs ?? us({ data: t, to: n }), r = e.commitments ?? Ye({ blobs: i, kzg: s, to: n }), o = e.proofs ?? Ze({ blobs: i, commitments: r, kzg: s, to: n }), a = [];
  for (let c = 0; c < i.length; c++)
    a.push({
      blob: i[c],
      commitment: r[c],
      proof: o[c]
    });
  return a;
}
class U extends h {
  constructor({ address: t }) {
    super(`Address "${t}" is invalid.`, {
      metaMessages: [
        "- Address must be a hex value of 20 bytes (40 hex characters).",
        "- Address must match its checksum counterpart."
      ],
      name: "InvalidAddressError"
    });
  }
}
class ee extends h {
  constructor({ chainId: t }) {
    super(typeof t == "number" ? `Chain ID "${t}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
  }
}
class te extends h {
  constructor({ cause: t, maxFeePerGas: s } = {}) {
    super(`The fee cap (\`maxFeePerGas\`${s ? ` = ${ue(s)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
      cause: t,
      name: "FeeCapTooHighError"
    });
  }
}
Object.defineProperty(te, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
});
class rt extends h {
  constructor({ cause: t, maxPriorityFeePerGas: s, maxFeePerGas: n } = {}) {
    super([
      `The provided tip (\`maxPriorityFeePerGas\`${s ? ` = ${ue(s)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${ue(n)} gwei` : ""}).`
    ].join(`
`), {
      cause: t,
      name: "TipAboveFeeCapError"
    });
  }
}
Object.defineProperty(rt, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
});
class ot extends Map {
  constructor(t) {
    super(), Object.defineProperty(this, "maxSize", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.maxSize = t;
  }
  get(t) {
    const s = super.get(t);
    return super.has(t) && s !== void 0 && (this.delete(t), super.set(t, s)), s;
  }
  set(t, s) {
    if (super.set(t, s), this.maxSize && this.size > this.maxSize) {
      const n = this.keys().next().value;
      n && this.delete(n);
    }
    return this;
  }
}
const K = /* @__PURE__ */ BigInt(2 ** 32 - 1), Te = /* @__PURE__ */ BigInt(32);
function ds(e, t = !1) {
  return t ? { h: Number(e & K), l: Number(e >> Te & K) } : { h: Number(e >> Te & K) | 0, l: Number(e & K) | 0 };
}
function fs(e, t = !1) {
  let s = new Uint32Array(e.length), n = new Uint32Array(e.length);
  for (let i = 0; i < e.length; i++) {
    const { h: r, l: o } = ds(e[i], t);
    [s[i], n[i]] = [r, o];
  }
  return [s, n];
}
const hs = (e, t, s) => e << s | t >>> 32 - s, ps = (e, t, s) => t << s | e >>> 32 - s, bs = (e, t, s) => t << s - 32 | e >>> 64 - s, xs = (e, t, s) => e << s - 32 | t >>> 64 - s, at = [], ct = [], ut = [], ms = /* @__PURE__ */ BigInt(0), C = /* @__PURE__ */ BigInt(1), gs = /* @__PURE__ */ BigInt(2), ys = /* @__PURE__ */ BigInt(7), ws = /* @__PURE__ */ BigInt(256), vs = /* @__PURE__ */ BigInt(113);
for (let e = 0, t = C, s = 1, n = 0; e < 24; e++) {
  [s, n] = [n, (2 * s + 3 * n) % 5], at.push(2 * (5 * n + s)), ct.push((e + 1) * (e + 2) / 2 % 64);
  let i = ms;
  for (let r = 0; r < 7; r++)
    t = (t << C ^ (t >> ys) * vs) % ws, t & gs && (i ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
  ut.push(i);
}
const [Bs, Ps] = /* @__PURE__ */ fs(ut, !0), Ae = (e, t, s) => s > 32 ? bs(e, t, s) : hs(e, t, s), ke = (e, t, s) => s > 32 ? xs(e, t, s) : ps(e, t, s);
function Es(e, t = 24) {
  const s = new Uint32Array(10);
  for (let n = 24 - t; n < 24; n++) {
    for (let o = 0; o < 10; o++)
      s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
    for (let o = 0; o < 10; o += 2) {
      const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], f = s[c + 1], l = Ae(u, f, 1) ^ s[a], b = ke(u, f, 1) ^ s[a + 1];
      for (let p = 0; p < 50; p += 10)
        e[o + p] ^= l, e[o + p + 1] ^= b;
    }
    let i = e[2], r = e[3];
    for (let o = 0; o < 24; o++) {
      const a = ct[o], c = Ae(i, r, a), u = ke(i, r, a), f = at[o];
      i = e[f], r = e[f + 1], e[f] = c, e[f + 1] = u;
    }
    for (let o = 0; o < 50; o += 10) {
      for (let a = 0; a < 10; a++)
        s[a] = e[o + a];
      for (let a = 0; a < 10; a++)
        e[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
    }
    e[0] ^= Bs[n], e[1] ^= Ps[n];
  }
  s.fill(0);
}
class xe extends Qe {
  // NOTE: we accept arguments in bytes instead of bits here.
  constructor(t, s, n, i = !1, r = 24) {
    if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = i, this.rounds = r, Pe(n), 0 >= this.blockLen || this.blockLen >= 200)
      throw new Error("Sha3 supports only keccak-f1600 function");
    this.state = new Uint8Array(200), this.state32 = Xt(this.state);
  }
  keccak() {
    Ee || Ie(this.state32), Es(this.state32, this.rounds), Ee || Ie(this.state32), this.posOut = 0, this.pos = 0;
  }
  update(t) {
    J(this);
    const { blockLen: s, state: n } = this;
    t = pe(t);
    const i = t.length;
    for (let r = 0; r < i; ) {
      const o = Math.min(s - this.pos, i - r);
      for (let a = 0; a < o; a++)
        n[this.pos++] ^= t[r++];
      this.pos === s && this.keccak();
    }
    return this;
  }
  finish() {
    if (this.finished)
      return;
    this.finished = !0;
    const { state: t, suffix: s, pos: n, blockLen: i } = this;
    t[n] ^= s, (s & 128) !== 0 && n === i - 1 && this.keccak(), t[i - 1] ^= 128, this.keccak();
  }
  writeInto(t) {
    J(this, !1), he(t), this.finish();
    const s = this.state, { blockLen: n } = this;
    for (let i = 0, r = t.length; i < r; ) {
      this.posOut >= n && this.keccak();
      const o = Math.min(n - this.posOut, r - i);
      t.set(s.subarray(this.posOut, this.posOut + o), i), this.posOut += o, i += o;
    }
    return t;
  }
  xofInto(t) {
    if (!this.enableXOF)
      throw new Error("XOF is not possible for this instance");
    return this.writeInto(t);
  }
  xof(t) {
    return Pe(t), this.xofInto(new Uint8Array(t));
  }
  digestInto(t) {
    if (Je(t, this), this.finished)
      throw new Error("digest() was already called");
    return this.writeInto(t), this.destroy(), t;
  }
  digest() {
    return this.digestInto(new Uint8Array(this.outputLen));
  }
  destroy() {
    this.destroyed = !0, this.state.fill(0);
  }
  _cloneInto(t) {
    const { blockLen: s, suffix: n, outputLen: i, rounds: r, enableXOF: o } = this;
    return t || (t = new xe(s, n, i, o, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = n, t.outputLen = i, t.enableXOF = o, t.destroyed = this.destroyed, t;
  }
}
const Is = (e, t, s) => et(() => new xe(t, e, s)), Us = /* @__PURE__ */ Is(1, 136, 256 / 8);
function zs(e, t) {
  return Us(V(e, { strict: !1 }) ? je(e) : e);
}
const ie = /* @__PURE__ */ new ot(8192);
function Ts(e, t) {
  if (ie.has(`${e}.${t}`))
    return ie.get(`${e}.${t}`);
  const s = e.substring(2).toLowerCase(), n = zs(Re(s)), i = s.split("");
  for (let o = 0; o < 40; o += 2)
    n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase());
  const r = `0x${i.join("")}`;
  return ie.set(`${e}.${t}`, r), r;
}
const As = /^0x[a-fA-F0-9]{40}$/, re = /* @__PURE__ */ new ot(8192);
function z(e, t) {
  const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
  if (re.has(n))
    return re.get(n);
  const i = As.test(e) ? e.toLowerCase() === e ? !0 : s ? Ts(e) === e : !0 : !1;
  return re.set(n, i), i;
}
function ks(e, t, s, { strict: n } = {}) {
  return V(e, { strict: !1 }) ? Ls(e, t, s, {
    strict: n
  }) : Ss(e, t, s, {
    strict: n
  });
}
function lt(e, t, s) {
  if (k(e) !== s - t)
    throw new xt({
      offset: s,
      position: "end",
      size: k(e)
    });
}
function Ss(e, t, s, { strict: n } = {}) {
  const i = e.slice(t, s);
  return n && lt(i, t, s), i;
}
function Ls(e, t, s, { strict: n } = {}) {
  const i = `0x${e.replace("0x", "").slice(t * 2, s * 2)}`;
  return n && lt(i, t, s), i;
}
function $s(e) {
  const { authorizationList: t } = e;
  if (t)
    for (const s of t) {
      const { chainId: n } = s, i = s.address;
      if (!z(i))
        throw new U({ address: i });
      if (n < 0)
        throw new ee({ chainId: n });
    }
  me(e);
}
function Fs(e) {
  const { blobVersionedHashes: t } = e;
  if (t) {
    if (t.length === 0)
      throw new it();
    for (const s of t) {
      const n = k(s), i = Z(ks(s, 0, 1));
      if (n !== 32)
        throw new as({ hash: s, size: n });
      if (i !== nt)
        throw new cs({
          hash: s,
          version: i
        });
    }
  }
  me(e);
}
function me(e) {
  const { chainId: t, maxPriorityFeePerGas: s, maxFeePerGas: n, to: i } = e;
  if (t <= 0)
    throw new ee({ chainId: t });
  if (i && !z(i))
    throw new U({ address: i });
  if (n && n > fe)
    throw new te({ maxFeePerGas: n });
  if (s && n && s > n)
    throw new rt({ maxFeePerGas: n, maxPriorityFeePerGas: s });
}
function Gs(e) {
  const { chainId: t, maxPriorityFeePerGas: s, gasPrice: n, maxFeePerGas: i, to: r } = e;
  if (t <= 0)
    throw new ee({ chainId: t });
  if (r && !z(r))
    throw new U({ address: r });
  if (s || i)
    throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
  if (n && n > fe)
    throw new te({ maxFeePerGas: n });
}
function Hs(e) {
  const { chainId: t, maxPriorityFeePerGas: s, gasPrice: n, maxFeePerGas: i, to: r } = e;
  if (r && !z(r))
    throw new U({ address: r });
  if (typeof t < "u" && t <= 0)
    throw new ee({ chainId: t });
  if (s || i)
    throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
  if (n && n > fe)
    throw new te({ maxFeePerGas: n });
}
function Os(e) {
  if (e.type)
    return e.type;
  if (typeof e.authorizationList < "u")
    return "eip7702";
  if (typeof e.blobs < "u" || typeof e.blobVersionedHashes < "u" || typeof e.maxFeePerBlobGas < "u" || typeof e.sidecars < "u")
    return "eip4844";
  if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u")
    return "eip1559";
  if (typeof e.gasPrice < "u")
    return typeof e.accessList < "u" ? "eip2930" : "legacy";
  throw new Mt({ transaction: e });
}
function se(e) {
  if (!e || e.length === 0)
    return [];
  const t = [];
  for (let s = 0; s < e.length; s++) {
    const { address: n, storageKeys: i } = e[s];
    for (let r = 0; r < i.length; r++)
      if (i[r].length - 2 !== 64)
        throw new jt({ storageKey: i[r] });
    if (!z(n, { strict: !1 }))
      throw new U({ address: n });
    t.push([n, i]);
  }
  return t;
}
function Cs(e, t) {
  const s = Os(e);
  return s === "eip1559" ? _s(e, t) : s === "eip2930" ? Vs(e, t) : s === "eip4844" ? Ds(e, t) : s === "eip7702" ? Ns(e, t) : Ms(e, t);
}
function Ns(e, t) {
  const { authorizationList: s, chainId: n, gas: i, nonce: r, to: o, value: a, maxFeePerGas: c, maxPriorityFeePerGas: u, accessList: f, data: l } = e;
  $s(e);
  const b = se(f), p = Rt(s);
  return M([
    "0x04",
    I([
      d(n),
      r ? d(r) : "0x",
      u ? d(u) : "0x",
      c ? d(c) : "0x",
      i ? d(i) : "0x",
      o ?? "0x",
      a ? d(a) : "0x",
      l ?? "0x",
      b,
      p,
      ...j(e, t)
    ])
  ]);
}
function Ds(e, t) {
  const { chainId: s, gas: n, nonce: i, to: r, value: o, maxFeePerBlobGas: a, maxFeePerGas: c, maxPriorityFeePerGas: u, accessList: f, data: l } = e;
  Fs(e);
  let b = e.blobVersionedHashes, p = e.sidecars;
  if (e.blobs && (typeof b > "u" || typeof p > "u")) {
    const P = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((H) => B(H)), R = e.kzg, G = Ye({
      blobs: P,
      kzg: R
    });
    if (typeof b > "u" && (b = rs({
      commitments: G
    })), typeof p > "u") {
      const H = Ze({ blobs: P, commitments: G, kzg: R });
      p = ls({ blobs: P, commitments: G, proofs: H });
    }
  }
  const F = se(f), T = [
    d(s),
    i ? d(i) : "0x",
    u ? d(u) : "0x",
    c ? d(c) : "0x",
    n ? d(n) : "0x",
    r ?? "0x",
    o ? d(o) : "0x",
    l ?? "0x",
    F,
    a ? d(a) : "0x",
    b ?? [],
    ...j(e, t)
  ], ge = [], ye = [], we = [];
  if (p)
    for (let P = 0; P < p.length; P++) {
      const { blob: R, commitment: G, proof: H } = p[P];
      ge.push(R), ye.push(G), we.push(H);
    }
  return M([
    "0x03",
    // If sidecars are enabled, envelope turns into a "wrapper":
    I(p ? [T, ge, ye, we] : T)
  ]);
}
function _s(e, t) {
  const { chainId: s, gas: n, nonce: i, to: r, value: o, maxFeePerGas: a, maxPriorityFeePerGas: c, accessList: u, data: f } = e;
  me(e);
  const l = se(u), b = [
    d(s),
    i ? d(i) : "0x",
    c ? d(c) : "0x",
    a ? d(a) : "0x",
    n ? d(n) : "0x",
    r ?? "0x",
    o ? d(o) : "0x",
    f ?? "0x",
    l,
    ...j(e, t)
  ];
  return M([
    "0x02",
    I(b)
  ]);
}
function Vs(e, t) {
  const { chainId: s, gas: n, data: i, nonce: r, to: o, value: a, accessList: c, gasPrice: u } = e;
  Gs(e);
  const f = se(c), l = [
    d(s),
    r ? d(r) : "0x",
    u ? d(u) : "0x",
    n ? d(n) : "0x",
    o ?? "0x",
    a ? d(a) : "0x",
    i ?? "0x",
    f,
    ...j(e, t)
  ];
  return M([
    "0x01",
    I(l)
  ]);
}
function Ms(e, t) {
  const { chainId: s = 0, gas: n, data: i, nonce: r, to: o, value: a, gasPrice: c } = e;
  Hs(e);
  let u = [
    r ? d(r) : "0x",
    c ? d(c) : "0x",
    n ? d(n) : "0x",
    o ?? "0x",
    a ? d(a) : "0x",
    i ?? "0x"
  ];
  if (t) {
    const f = (() => {
      if (t.v >= 35n)
        return (t.v - 35n) / 2n > 0 ? t.v : 27n + (t.v === 35n ? 0n : 1n);
      if (s > 0)
        return BigInt(s * 2) + BigInt(35n + t.v - 27n);
      const p = 27n + (t.v === 27n ? 0n : 1n);
      if (t.v !== p)
        throw new Vt({ v: t.v });
      return p;
    })(), l = Y(t.r), b = Y(t.s);
    u = [
      ...u,
      d(f),
      l === "0x00" ? "0x" : l,
      b === "0x00" ? "0x" : b
    ];
  } else s > 0 && (u = [
    ...u,
    d(s),
    "0x",
    "0x"
  ]);
  return I(u);
}
function j(e, t) {
  const s = t ?? e, { v: n, yParity: i } = s;
  if (typeof s.r > "u")
    return [];
  if (typeof s.s > "u")
    return [];
  if (typeof n > "u" && typeof i > "u")
    return [];
  const r = Y(s.r), o = Y(s.s);
  return [typeof i == "number" ? i ? d(1) : "0x" : n === 0n ? "0x" : n === 1n ? d(1) : n === 27n ? "0x" : d(1), r === "0x00" ? "0x" : r, o === "0x00" ? "0x" : o];
}
const js = {
  gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
  l1Block: { address: "0x4200000000000000000000000000000000000015" },
  l2CrossDomainMessenger: {
    address: "0x4200000000000000000000000000000000000007"
  },
  l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
  l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
  l2ToL1MessagePasser: {
    address: "0x4200000000000000000000000000000000000016"
  }
}, Rs = {
  block: /* @__PURE__ */ At({
    format(e) {
      var s;
      return {
        transactions: (s = e.transactions) == null ? void 0 : s.map((n) => {
          if (typeof n == "string")
            return n;
          const i = de(n);
          return i.typeHex === "0x7e" && (i.isSystemTx = n.isSystemTx, i.mint = n.mint ? A(n.mint) : void 0, i.sourceHash = n.sourceHash, i.type = "deposit"), i;
        }),
        stateRoot: e.stateRoot
      };
    }
  }),
  transaction: /* @__PURE__ */ Ut({
    format(e) {
      const t = {};
      return e.type === "0x7e" && (t.isSystemTx = e.isSystemTx, t.mint = e.mint ? A(e.mint) : void 0, t.sourceHash = e.sourceHash, t.type = "deposit"), t;
    }
  }),
  transactionReceipt: /* @__PURE__ */ $t({
    format(e) {
      return {
        l1GasPrice: e.l1GasPrice ? A(e.l1GasPrice) : null,
        l1GasUsed: e.l1GasUsed ? A(e.l1GasUsed) : null,
        l1Fee: e.l1Fee ? A(e.l1Fee) : null,
        l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
      };
    }
  })
};
function Ks(e, t) {
  return qs(e) ? Ws(e) : Cs(e, t);
}
const Xs = {
  transaction: Ks
};
function Ws(e) {
  Ys(e);
  const { sourceHash: t, data: s, from: n, gas: i, isSystemTx: r, mint: o, to: a, value: c } = e, u = [
    t,
    n,
    a ?? "0x",
    o ? d(o) : "0x",
    c ? d(c) : "0x",
    i ? d(i) : "0x",
    r ? "0x1" : "0x",
    s ?? "0x"
  ];
  return M([
    "0x7e",
    I(u)
  ]);
}
function qs(e) {
  return e.type === "deposit" || typeof e.sourceHash < "u";
}
function Ys(e) {
  const { from: t, to: s } = e;
  if (t && !z(t))
    throw new U({ address: t });
  if (s && !z(s))
    throw new U({ address: s });
}
const Q = {
  contracts: js,
  formatters: Rs,
  serializers: Xs
}, N = 1, oe = /* @__PURE__ */ _({
  ...Q,
  id: 8453,
  name: "Base",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://mainnet.base.org"]
    }
  },
  blockExplorers: {
    default: {
      name: "Basescan",
      url: "https://basescan.org",
      apiUrl: "https://api.basescan.org/api"
    }
  },
  contracts: {
    ...Q.contracts,
    disputeGameFactory: {
      [N]: {
        address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"
      }
    },
    l2OutputOracle: {
      [N]: {
        address: "0x56315b90c40730925ec5485cf004d835058518A0"
      }
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 5022
    },
    portal: {
      [N]: {
        address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
        blockCreated: 17482143
      }
    },
    l1StandardBridge: {
      [N]: {
        address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
        blockCreated: 17482143
      }
    }
  },
  sourceId: N
}), X = /* @__PURE__ */ _({
  id: 56,
  name: "BNB Smart Chain",
  nativeCurrency: {
    decimals: 18,
    name: "BNB",
    symbol: "BNB"
  },
  rpcUrls: {
    default: { http: ["https://56.rpc.thirdweb.com"] }
  },
  blockExplorers: {
    default: {
      name: "BscScan",
      url: "https://bscscan.com",
      apiUrl: "https://api.bscscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 15921452
    }
  }
}), W = /* @__PURE__ */ _({
  id: 97,
  name: "Binance Smart Chain Testnet",
  nativeCurrency: {
    decimals: 18,
    name: "BNB",
    symbol: "tBNB"
  },
  rpcUrls: {
    default: { http: ["https://data-seed-prebsc-1-s1.bnbchain.org:8545"] }
  },
  blockExplorers: {
    default: {
      name: "BscScan",
      url: "https://testnet.bscscan.com",
      apiUrl: "https://api-testnet.bscscan.com/api"
    }
  },
  contracts: {
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 17422483
    }
  },
  testnet: !0
}), ae = /* @__PURE__ */ _({
  id: 1,
  name: "Ethereum",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: {
    default: {
      http: ["https://eth.merkle.io"]
    }
  },
  blockExplorers: {
    default: {
      name: "Etherscan",
      url: "https://etherscan.io",
      apiUrl: "https://api.etherscan.io/api"
    }
  },
  contracts: {
    ensRegistry: {
      address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
    },
    ensUniversalResolver: {
      address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
      blockCreated: 19258213
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 14353601
    }
  }
}), q = 11155111, ce = /* @__PURE__ */ _({
  ...Q,
  id: 1301,
  name: "Unichain Sepolia",
  nativeCurrency: {
    name: "Ether",
    symbol: "ETH",
    decimals: 18
  },
  rpcUrls: {
    default: {
      http: ["https://sepolia.unichain.org"]
    }
  },
  blockExplorers: {
    default: {
      name: "Uniscan",
      url: "https://sepolia.uniscan.xyz",
      apiUrl: "https://api-sepolia.uniscan.xyz/api"
    }
  },
  contracts: {
    ...Q.contracts,
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 0
    },
    portal: {
      [q]: {
        address: "0x0d83dab629f0e0F9d36c0Cbc89B69a489f0751bD"
      }
    },
    l1StandardBridge: {
      [q]: {
        address: "0xea58fcA6849d79EAd1f26608855c2D6407d54Ce2"
      }
    },
    disputeGameFactory: {
      [q]: {
        address: "0xeff73e5aa3B9AEC32c659Aa3E00444d20a84394b"
      }
    }
  },
  testnet: !0,
  sourceId: q
});
var x = /* @__PURE__ */ ((e) => (e.eth = "eth", e.uni = "uni", e.base = "base", e.bsc = "bsc", e.tbsc = "tbsc", e.sol = "sol", e.solDevnet = "tsol", e.sui = "sui", e.suiDevnet = "tsui", e.ton = "ton", e.tonDevnet = "tton", e))(x || {}), m = /* @__PURE__ */ ((e) => (e[e.eth = 1] = "eth", e[e.uni = 130] = "uni", e[e.base = 8453] = "base", e[e.bsc = 56] = "bsc", e[e.tbsc = 97] = "tbsc", e[e.sol = 8453] = "sol", e[e.solDevnet = 84532] = "solDevnet", e[e.sui = 84532] = "sui", e[e.suiDevnet = 100] = "suiDevnet", e[e.ton = 10] = "ton", e[e.tonDevnet = 11] = "tonDevnet", e))(m || {});
const Zs = {
  ...ae,
  id: m.eth,
  symbol: x.eth,
  logo: ft,
  network: D,
  blockExplorers: {
    ...ae.blockExplorers,
    default: {
      ...ae.blockExplorers.default,
      hash: "https://etherscan.io/tx/{{addr}}",
      address: "https://etherscan.io/address/{{addr}}"
    }
  }
}, Js = {
  ...X,
  id: m.bsc,
  symbol: x.bsc,
  logo: Se,
  network: D,
  rpcUrls: {
    default: {
      http: [
        X.rpcUrls.default.http[0],
        "https://bsc.blockpi.network/v1/rpc/32cdfa234a4a17abbb8e3f23bc6410a9b7d47cb3"
      ]
    }
  },
  blockExplorers: {
    ...X.blockExplorers,
    default: {
      ...X.blockExplorers.default,
      hash: "https://bscscan.com/tx/{{addr}}",
      address: "https://bscscan.com/address/{{addr}}"
    }
  }
}, Qs = {
  ...W,
  id: m.tbsc,
  symbol: x.tbsc,
  logo: Se,
  network: D,
  rpcUrls: {
    default: {
      http: [
        "https://bsc-testnet-rpc.publicnode.com",
        ...W.rpcUrls.default.http
      ],
      webSocket: [
        "wss://bsc-testnet-rpc.publicnode.com",
        "wss://bsc-testnet.blockpi.network/v1/ws/cd61e00aed93674ae0d608f823e2c2d05a52752d"
      ]
    }
  },
  blockExplorers: {
    ...W.blockExplorers,
    default: {
      ...W.blockExplorers.default,
      hash: "https://testnet.bscscan.com/tx/{{addr}}",
      address: "https://testnet.bscscan.com/address/{{addr}}"
    }
  }
}, en = {
  ...ce,
  id: m.uni,
  symbol: x.uni,
  logo: ht,
  network: D,
  blockExplorers: {
    ...ce.blockExplorers,
    default: {
      ...ce.blockExplorers.default,
      hash: "https://explorer.unichain.io/tx/{{addr}}",
      address: "https://explorer.unichain.io/address/{{addr}}"
    }
  }
}, tn = {
  ...oe,
  id: m.base,
  symbol: x.base,
  logo: dt,
  network: D,
  blockExplorers: {
    ...oe.blockExplorers,
    default: {
      ...oe.blockExplorers.default,
      hash: "https://basescan.org/tx/{{addr}}",
      address: "https://basescan.org/address/{{addr}}"
    }
  }
}, sn = S({
  id: m.sol,
  symbol: x.sol,
  name: "Solana",
  logo: $e,
  network: Le,
  nativeCurrency: { name: "Solana", symbol: "SOL", decimals: 9 },
  rpcUrls: {
    default: {
      http: [
        Ce(Ne.Mainnet),
        "https://late-indulgent-surf.solana-mainnet.quiknode.pro/06bfbf9317a2dac06f06abf1087a9ea64cd0da56/"
      ]
    }
  },
  blockExplorers: {
    default: {
      name: "Solscan",
      url: "https://explorer.solana.com",
      hash: "https://solscan.io/tx/{{addr}}",
      address: "https://solscan.io/account/{{addr}}"
    }
  }
}), nn = S({
  id: m.solDevnet,
  symbol: x.solDevnet,
  name: "Solana Devnet",
  logo: $e,
  network: Le,
  nativeCurrency: { name: "Solana", symbol: "SOL", decimals: 9 },
  rpcUrls: {
    default: {
      http: [
        Ce(Ne.Devnet),
        "https://cosmological-quaint-friday.solana-devnet.quiknode.pro/c1f4aaab4ab76f04042e3902cdb03dc8a35b5c6d/",
        "https://rpc.walletconnect.org/v1"
      ]
    }
  },
  blockExplorers: {
    default: {
      name: "Solscan",
      url: "https://explorer.solana.com",
      hash: "https://solscan.io/tx/{{addr}}?cluster=devnet",
      address: "https://solscan.io/account/{{addr}}?cluster=devnet"
    },
    solana: {
      name: "Solana Explorer",
      url: "https://explorer.solana.com",
      hash: "https://solscan.io/tx/{{addr}}?cluster=devnet",
      address: "https://solscan.io/account/{{addr}}?cluster=devnet"
    }
  },
  testnet: !0
}), un = S({
  id: m.ton,
  symbol: x.ton,
  name: "TON",
  logo: Ge,
  network: Fe,
  nativeCurrency: { name: "Toncoin", symbol: "TON", decimals: 9 },
  rpcUrls: {
    default: { http: ["https://toncenter.com/api/v2/json-rpc"] }
  },
  blockExplorers: {
    default: {
      name: "Tonviewer",
      url: "https://tonviewer.com",
      hash: "https://tonviewer.com/tx/{{addr}}",
      address: "https://tonviewer.com/address/{{addr}}"
    }
  },
  testnet: !1
}), ln = S({
  id: m.tonDevnet,
  symbol: x.tonDevnet,
  name: "TON Testnet",
  logo: Ge,
  network: Fe,
  nativeCurrency: { name: "Toncoin", symbol: "TON", decimals: 9 },
  rpcUrls: {
    default: { http: ["https://toncenter.com/api/v2/json-rpc"] }
  },
  blockExplorers: {
    default: {
      name: "Tonviewer",
      url: "https://tonviewer.com",
      hash: "https://tonviewer.com/tx/{{addr}}",
      address: "https://tonviewer.com/address/{{addr}}"
    }
  },
  testnet: !0
}), dn = S({
  id: m.sui,
  symbol: x.sui,
  name: "Sui",
  logo: Oe,
  network: He,
  nativeCurrency: { name: "Sui", symbol: "SUI", decimals: 9 },
  rpcUrls: {
    default: { http: ["https://fullnode.mainnet.sui.io"] }
  },
  blockExplorers: {
    default: {
      name: "Suiexplorer",
      url: "https://suiexplorer.com",
      hash: "https://suiexplorer.com/tx/{{addr}}",
      address: "https://suiexplorer.com/address/{{addr}}"
    }
  },
  testnet: !1
}), fn = S({
  id: m.suiDevnet,
  symbol: x.suiDevnet,
  name: "Sui Devnet",
  logo: Oe,
  network: He,
  nativeCurrency: { name: "Sui", symbol: "SUI", decimals: 9 },
  rpcUrls: {
    default: { http: ["https://fullnode.devnet.sui.io"] }
  },
  blockExplorers: {
    default: {
      name: "Suiexplorer",
      url: "https://suiexplorer.com",
      hash: "https://suiexplorer.com/tx/{{addr}}",
      address: "https://suiexplorer.com/address/{{addr}}"
    }
  },
  testnet: !0
}), hn = process.env.NEXT_PUBLIC_APP_ENV === "mainnet", pn = [
  Qs,
  Js,
  tn,
  Zs,
  en,
  sn,
  nn
];
export {
  pn as AllChains,
  m as ChainIds,
  x as ChainSymbols,
  Js as chainBSC,
  Qs as chainBSCTestnet,
  tn as chainBase,
  Zs as chainEth,
  sn as chainSol,
  nn as chainSolDevnet,
  dn as chainSui,
  fn as chainSuiDevnet,
  un as chainTon,
  ln as chainTonDevnet,
  en as chainUni,
  hn as isMainnet
};
//# sourceMappingURL=chains.js.map
