import { n as _, Z as Le, t as ut, g as lt, X as ft, a as $e, p as ke, b as Fe, P as Ge } from "./sui-C9kTe4me.mjs";
import { defineChain as Q } from "viem";
import { clusterApiUrl as He } from "@solana/web3.js";
import { WalletAdapterNetwork as Oe } from "@solana/wallet-adapter-base";
function D(e) {
  return {
    formatters: void 0,
    fees: void 0,
    serializers: void 0,
    ...e
  };
}
const Ce = "2.28.1";
let H = {
  getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0,
  version: `viem@${Ce}`
};
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 = H.getDocsUrl) == null ? void 0 : a.call(H, { ...s, docsPath: i }), o = [
      t || "An error occurred.",
      "",
      ...s.metaMessages ? [...s.metaMessages, ""] : [],
      ...r ? [`Docs: ${r}`] : [],
      ...n ? [`Details: ${n}`] : [],
      ...H.version ? [`Version: ${H.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 = Ce;
  }
  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 dt 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 ht extends h {
  constructor({ givenSize: t, maxSize: s }) {
    super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
  }
}
function N(e, { strict: t = !0 } = {}) {
  return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
}
function S(e) {
  return N(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 pt 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 De 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" ? bt(e, { dir: t, size: s }) : xt(e, { dir: t, size: s });
}
function bt(e, { dir: t, size: s = 32 } = {}) {
  if (s === null)
    return e;
  const n = e.replace("0x", "");
  if (n.length > s * 2)
    throw new De({
      size: Math.ceil(n.length / 2),
      targetSize: s,
      type: "hex"
    });
  return `0x${n[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
}
function xt(e, { dir: t, size: s = 32 } = {}) {
  if (s === null)
    return e;
  if (e.length > s)
    throw new De({
      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 mt = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
function f(e, t = {}) {
  return typeof e == "number" || typeof e == "bigint" ? Ne(e, t) : typeof e == "string" ? wt(e, t) : typeof e == "boolean" ? gt(e, t) : P(e, t);
}
function gt(e, t = {}) {
  const s = `0x${Number(e)}`;
  return typeof t.size == "number" ? ($(s, { size: t.size }), L(s, { size: t.size })) : s;
}
function P(e, t = {}) {
  let s = "";
  for (let i = 0; i < e.length; i++)
    s += mt[e[i]];
  const n = `0x${s}`;
  return typeof t.size == "number" ? ($(n, { size: t.size }), L(n, { dir: "right", size: t.size })) : n;
}
function Ne(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 dt({
      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 yt = /* @__PURE__ */ new TextEncoder();
function wt(e, t = {}) {
  const s = yt.encode(e);
  return P(s, t);
}
const Bt = /* @__PURE__ */ new TextEncoder();
function Ve(e, t = {}) {
  return typeof e == "number" || typeof e == "bigint" ? vt(e, t) : typeof e == "boolean" ? Pt(e, t) : N(e) ? E(e, t) : Me(e, t);
}
function Pt(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 Be(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 = Be(n.charCodeAt(a++)), u = Be(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 vt(e, t) {
  const s = Ne(e, t);
  return E(s);
}
function Me(e, t = {}) {
  const s = Bt.encode(e);
  return typeof t.size == "number" ? ($(s, { size: t.size }), L(s, { dir: "right", size: t.size })) : s;
}
function $(e, { size: t }) {
  if (S(e) > t)
    throw new ht({
      givenSize: S(e),
      maxSize: t
    });
}
function T(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 q(e, t = {}) {
  return Number(T(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 je = {
  "0x0": "legacy",
  "0x1": "eip2930",
  "0x2": "eip1559",
  "0x3": "eip4844",
  "0x4": "eip7702"
};
function fe(e) {
  const t = {
    ...e,
    blockHash: e.blockHash ? e.blockHash : null,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    chainId: e.chainId ? q(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 ? q(e.nonce) : void 0,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
    type: e.type ? je[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 = It(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 Et = /* @__PURE__ */ le("transaction", fe);
function It(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 Ut(e) {
  const t = (e.transactions ?? []).map((s) => typeof s == "string" ? s : fe(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 zt = /* @__PURE__ */ le("block", Ut);
function At(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 Tt = {
  "0x0": "reverted",
  "0x1": "success"
};
function St(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) => At(s)) : null,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? q(e.transactionIndex) : null,
    status: e.status ? Tt[e.status] : null,
    type: e.type ? je[e.type] || e.type : null
  };
  return e.blobGasPrice && (t.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (t.blobGasUsed = BigInt(e.blobGasUsed)), t;
}
const Lt = /* @__PURE__ */ le("transactionReceipt", St), de = 2n ** 256n - 1n;
function V(e) {
  return `0x${e.reduce((t, s) => t + s.replace("0x", ""), "")}`;
}
class Pe extends h {
  constructor({ offset: t }) {
    super(`Offset \`${t}\` cannot be negative.`, {
      name: "NegativeOffsetError"
    });
  }
}
class $t extends h {
  constructor({ length: t, position: s }) {
    super(`Position \`${s}\` is out of bounds (\`0 < position < ${t}\`).`, { name: "PositionOutOfBoundsError" });
  }
}
class kt extends h {
  constructor({ count: t, limit: s }) {
    super(`Recursive read limit of \`${s}\` exceeded (recursive read count: \`${t}\`).`, { name: "RecursiveReadLimitExceededError" });
  }
}
const Ft = {
  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 kt({
        count: this.recursiveReadCount + 1,
        limit: this.recursiveReadLimit
      });
  },
  assertPosition(e) {
    if (e < 0 || e > this.bytes.length - 1)
      throw new $t({
        length: this.bytes.length,
        position: e
      });
  },
  decrementPosition(e) {
    if (e < 0)
      throw new Pe({ 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 Pe({ 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 Re(e, { recursiveReadLimit: t = 8192 } = {}) {
  const s = Object.create(Ft);
  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 = Ke(e), n = Re(new Uint8Array(s.length));
  return s.encode(n), t === "hex" ? P(n.bytes) : n.bytes;
}
function Ke(e) {
  return Array.isArray(e) ? Gt(e.map((t) => Ke(t))) : Ht(e);
}
function Gt(e) {
  const t = e.reduce((i, r) => i + r.length, 0), s = Xe(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 Ht(e) {
  const t = typeof e == "string" ? E(e) : e, s = Xe(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 Xe(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 Ot = {
  ether: -9,
  wei: 9
};
function Ct(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 Ct(e, Ot[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 Dt extends h {
  constructor({ v: t }) {
    super(`Invalid \`v\` value "${t}". Expected 27 or 28.`, {
      name: "InvalidLegacyVError"
    });
  }
}
class Nt 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 Vt 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 Mt(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 ? f(n) : "0x",
      o,
      i ? f(i) : "0x",
      ...M({}, r)
    ]);
  }
  return t;
}
function We(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) => P(r));
}
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((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) => P(o));
}
function ve(e) {
  if (!Number.isSafeInteger(e) || e < 0)
    throw new Error("positive integer expected, got " + e);
}
function jt(e) {
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
}
function he(e, ...t) {
  if (!jt(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 Z(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 qe(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 Rt(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 x(e, t) {
  return e << 32 - t | e >>> t;
}
const Ee = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
function Kt(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] = Kt(e[t]);
}
typeof Uint8Array.from([]).toHex == "function" && Uint8Array.fromHex;
function Xt(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 = Xt(e)), he(e), e;
}
class Ze {
  // Safe version that clones internal state
  clone() {
    return this._cloneInto();
  }
}
function Je(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 Wt(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 Yt(e, t, s) {
  return e & t ^ ~e & s;
}
function qt(e, t, s) {
  return e & t ^ e & s ^ t & s;
}
class Zt extends Ze {
  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) {
    Z(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) {
    Z(this), qe(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;
    Wt(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, d = this.get();
    if (u > d.length)
      throw new Error("_sha2: outputLen bigger than state");
    for (let l = 0; l < u; l++)
      a.setUint32(4 * l, d[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 Jt = /* @__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
]), B = /* @__PURE__ */ new Uint32Array(64);
class Qt extends Zt {
  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)
      B[l] = t.getUint32(s, !1);
    for (let l = 16; l < 64; l++) {
      const b = B[l - 15], p = B[l - 2], k = x(b, 7) ^ x(b, 18) ^ b >>> 3, A = x(p, 17) ^ x(p, 19) ^ p >>> 10;
      B[l] = A + B[l - 7] + k + B[l - 16] | 0;
    }
    let { A: n, B: i, C: r, D: o, E: a, F: c, G: u, H: d } = this;
    for (let l = 0; l < 64; l++) {
      const b = x(a, 6) ^ x(a, 11) ^ x(a, 25), p = d + b + Yt(a, c, u) + Jt[l] + B[l] | 0, A = (x(n, 2) ^ x(n, 13) ^ x(n, 22)) + qt(n, i, r) | 0;
      d = u, u = c, c = a, a = o + p | 0, o = r, r = i, i = n, n = p + A | 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, d = d + this.H | 0, this.set(n, i, r, o, a, c, u, d);
  }
  roundClean() {
    B.fill(0);
  }
  destroy() {
    this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
  }
}
const es = /* @__PURE__ */ Je(() => new Qt());
function ts(e, t) {
  return es(N(e, { strict: !1 }) ? Ve(e) : e);
}
function ss(e) {
  const { commitment: t, version: s = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), i = ts(t);
  return i.set([s], 0), n === "bytes" ? i : P(i);
}
function ns(e) {
  const { commitments: t, version: s } = e, n = e.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), i = [];
  for (const r of t)
    i.push(ss({
      commitment: r,
      to: n,
      version: s
    }));
  return i;
}
const Ue = 6, Qe = 32, be = 4096, et = Qe * be, ze = et * Ue - // terminator byte (0x80).
1 - // zero byte (0x00) appended to each field element.
1 * be * Ue, tt = 1;
class is extends h {
  constructor({ maxSize: t, size: s }) {
    super("Blob size is too large.", {
      metaMessages: [`Max: ${t} bytes`, `Given: ${s} bytes`],
      name: "BlobSizeTooLargeError"
    });
  }
}
class st extends h {
  constructor() {
    super("Blob data must not be empty.", { name: "EmptyBlobError" });
  }
}
class rs extends h {
  constructor({ hash: t, size: s }) {
    super(`Versioned hash "${t}" size is invalid.`, {
      metaMessages: ["Expected: 32", `Received: ${s}`],
      name: "InvalidVersionedHashSizeError"
    });
  }
}
class os extends h {
  constructor({ hash: t, version: s }) {
    super(`Versioned hash "${t}" version is invalid.`, {
      metaMessages: [
        `Expected: ${tt}`,
        `Received: ${s}`
      ],
      name: "InvalidVersionedHashVersionError"
    });
  }
}
function as(e) {
  const t = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), s = typeof e.data == "string" ? E(e.data) : e.data, n = S(s);
  if (!n)
    throw new st();
  if (n > ze)
    throw new is({
      maxSize: ze,
      size: n
    });
  const i = [];
  let r = !0, o = 0;
  for (; r; ) {
    const a = Re(new Uint8Array(et));
    let c = 0;
    for (; c < be; ) {
      const u = s.slice(o, o + (Qe - 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) => P(a.bytes));
}
function cs(e) {
  const { data: t, kzg: s, to: n } = e, i = e.blobs ?? as({ data: t, to: n }), r = e.commitments ?? We({ blobs: i, kzg: s, to: n }), o = e.proofs ?? Ye({ 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 nt 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(nt, "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 it 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 R = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ae = /* @__PURE__ */ BigInt(32);
function us(e, t = !1) {
  return t ? { h: Number(e & R), l: Number(e >> Ae & R) } : { h: Number(e >> Ae & R) | 0, l: Number(e & R) | 0 };
}
function ls(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 } = us(e[i], t);
    [s[i], n[i]] = [r, o];
  }
  return [s, n];
}
const fs = (e, t, s) => e << s | t >>> 32 - s, ds = (e, t, s) => t << s | e >>> 32 - s, hs = (e, t, s) => t << s - 32 | e >>> 64 - s, ps = (e, t, s) => e << s - 32 | t >>> 64 - s, rt = [], ot = [], at = [], bs = /* @__PURE__ */ BigInt(0), O = /* @__PURE__ */ BigInt(1), xs = /* @__PURE__ */ BigInt(2), ms = /* @__PURE__ */ BigInt(7), gs = /* @__PURE__ */ BigInt(256), ys = /* @__PURE__ */ BigInt(113);
for (let e = 0, t = O, s = 1, n = 0; e < 24; e++) {
  [s, n] = [n, (2 * s + 3 * n) % 5], rt.push(2 * (5 * n + s)), ot.push((e + 1) * (e + 2) / 2 % 64);
  let i = bs;
  for (let r = 0; r < 7; r++)
    t = (t << O ^ (t >> ms) * ys) % gs, t & xs && (i ^= O << (O << /* @__PURE__ */ BigInt(r)) - O);
  at.push(i);
}
const [ws, Bs] = /* @__PURE__ */ ls(at, !0), Te = (e, t, s) => s > 32 ? hs(e, t, s) : fs(e, t, s), Se = (e, t, s) => s > 32 ? ps(e, t, s) : ds(e, t, s);
function Ps(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], d = s[c + 1], l = Te(u, d, 1) ^ s[a], b = Se(u, d, 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 = ot[o], c = Te(i, r, a), u = Se(i, r, a), d = rt[o];
      i = e[d], r = e[d + 1], e[d] = c, e[d + 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] ^= ws[n], e[1] ^= Bs[n];
  }
  s.fill(0);
}
class xe extends Ze {
  // 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, ve(n), 0 >= this.blockLen || this.blockLen >= 200)
      throw new Error("Sha3 supports only keccak-f1600 function");
    this.state = new Uint8Array(200), this.state32 = Rt(this.state);
  }
  keccak() {
    Ee || Ie(this.state32), Ps(this.state32, this.rounds), Ee || Ie(this.state32), this.posOut = 0, this.pos = 0;
  }
  update(t) {
    Z(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) {
    Z(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 ve(t), this.xofInto(new Uint8Array(t));
  }
  digestInto(t) {
    if (qe(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 vs = (e, t, s) => Je(() => new xe(t, e, s)), Es = /* @__PURE__ */ vs(1, 136, 256 / 8);
function Is(e, t) {
  return Es(N(e, { strict: !1 }) ? Ve(e) : e);
}
const ie = /* @__PURE__ */ new it(8192);
function Us(e, t) {
  if (ie.has(`${e}.${t}`))
    return ie.get(`${e}.${t}`);
  const s = e.substring(2).toLowerCase(), n = Is(Me(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 zs = /^0x[a-fA-F0-9]{40}$/, re = /* @__PURE__ */ new it(8192);
function z(e, t) {
  const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
  if (re.has(n))
    return re.get(n);
  const i = zs.test(e) ? e.toLowerCase() === e ? !0 : s ? Us(e) === e : !0 : !1;
  return re.set(n, i), i;
}
function As(e, t, s, { strict: n } = {}) {
  return N(e, { strict: !1 }) ? Ss(e, t, s, {
    strict: n
  }) : Ts(e, t, s, {
    strict: n
  });
}
function ct(e, t, s) {
  if (S(e) !== s - t)
    throw new pt({
      offset: s,
      position: "end",
      size: S(e)
    });
}
function Ts(e, t, s, { strict: n } = {}) {
  const i = e.slice(t, s);
  return n && ct(i, t, s), i;
}
function Ss(e, t, s, { strict: n } = {}) {
  const i = `0x${e.replace("0x", "").slice(t * 2, s * 2)}`;
  return n && ct(i, t, s), i;
}
function Ls(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 $s(e) {
  const { blobVersionedHashes: t } = e;
  if (t) {
    if (t.length === 0)
      throw new st();
    for (const s of t) {
      const n = S(s), i = q(As(s, 0, 1));
      if (n !== 32)
        throw new rs({ hash: s, size: n });
      if (i !== tt)
        throw new os({
          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 > de)
    throw new te({ maxFeePerGas: n });
  if (s && n && s > n)
    throw new nt({ maxFeePerGas: n, maxPriorityFeePerGas: s });
}
function ks(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 > de)
    throw new te({ maxFeePerGas: n });
}
function Fs(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 > de)
    throw new te({ maxFeePerGas: n });
}
function Gs(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 Nt({ 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 Vt({ storageKey: i[r] });
    if (!z(n, { strict: !1 }))
      throw new U({ address: n });
    t.push([n, i]);
  }
  return t;
}
function Hs(e, t) {
  const s = Gs(e);
  return s === "eip1559" ? _s(e, t) : s === "eip2930" ? Ds(e, t) : s === "eip4844" ? Cs(e, t) : s === "eip7702" ? Os(e, t) : Ns(e, t);
}
function Os(e, t) {
  const { authorizationList: s, chainId: n, gas: i, nonce: r, to: o, value: a, maxFeePerGas: c, maxPriorityFeePerGas: u, accessList: d, data: l } = e;
  Ls(e);
  const b = se(d), p = Mt(s);
  return V([
    "0x04",
    I([
      f(n),
      r ? f(r) : "0x",
      u ? f(u) : "0x",
      c ? f(c) : "0x",
      i ? f(i) : "0x",
      o ?? "0x",
      a ? f(a) : "0x",
      l ?? "0x",
      b,
      p,
      ...M(e, t)
    ])
  ]);
}
function Cs(e, t) {
  const { chainId: s, gas: n, nonce: i, to: r, value: o, maxFeePerBlobGas: a, maxFeePerGas: c, maxPriorityFeePerGas: u, accessList: d, data: l } = e;
  $s(e);
  let b = e.blobVersionedHashes, p = e.sidecars;
  if (e.blobs && (typeof b > "u" || typeof p > "u")) {
    const v = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((G) => P(G)), j = e.kzg, F = We({
      blobs: v,
      kzg: j
    });
    if (typeof b > "u" && (b = ns({
      commitments: F
    })), typeof p > "u") {
      const G = Ye({ blobs: v, commitments: F, kzg: j });
      p = cs({ blobs: v, commitments: F, proofs: G });
    }
  }
  const k = se(d), A = [
    f(s),
    i ? f(i) : "0x",
    u ? f(u) : "0x",
    c ? f(c) : "0x",
    n ? f(n) : "0x",
    r ?? "0x",
    o ? f(o) : "0x",
    l ?? "0x",
    k,
    a ? f(a) : "0x",
    b ?? [],
    ...M(e, t)
  ], ge = [], ye = [], we = [];
  if (p)
    for (let v = 0; v < p.length; v++) {
      const { blob: j, commitment: F, proof: G } = p[v];
      ge.push(j), ye.push(F), we.push(G);
    }
  return V([
    "0x03",
    // If sidecars are enabled, envelope turns into a "wrapper":
    I(p ? [A, ge, ye, we] : A)
  ]);
}
function _s(e, t) {
  const { chainId: s, gas: n, nonce: i, to: r, value: o, maxFeePerGas: a, maxPriorityFeePerGas: c, accessList: u, data: d } = e;
  me(e);
  const l = se(u), b = [
    f(s),
    i ? f(i) : "0x",
    c ? f(c) : "0x",
    a ? f(a) : "0x",
    n ? f(n) : "0x",
    r ?? "0x",
    o ? f(o) : "0x",
    d ?? "0x",
    l,
    ...M(e, t)
  ];
  return V([
    "0x02",
    I(b)
  ]);
}
function Ds(e, t) {
  const { chainId: s, gas: n, data: i, nonce: r, to: o, value: a, accessList: c, gasPrice: u } = e;
  ks(e);
  const d = se(c), l = [
    f(s),
    r ? f(r) : "0x",
    u ? f(u) : "0x",
    n ? f(n) : "0x",
    o ?? "0x",
    a ? f(a) : "0x",
    i ?? "0x",
    d,
    ...M(e, t)
  ];
  return V([
    "0x01",
    I(l)
  ]);
}
function Ns(e, t) {
  const { chainId: s = 0, gas: n, data: i, nonce: r, to: o, value: a, gasPrice: c } = e;
  Fs(e);
  let u = [
    r ? f(r) : "0x",
    c ? f(c) : "0x",
    n ? f(n) : "0x",
    o ?? "0x",
    a ? f(a) : "0x",
    i ?? "0x"
  ];
  if (t) {
    const d = (() => {
      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 Dt({ v: t.v });
      return p;
    })(), l = Y(t.r), b = Y(t.s);
    u = [
      ...u,
      f(d),
      l === "0x00" ? "0x" : l,
      b === "0x00" ? "0x" : b
    ];
  } else s > 0 && (u = [
    ...u,
    f(s),
    "0x",
    "0x"
  ]);
  return I(u);
}
function M(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 ? f(1) : "0x" : n === 0n ? "0x" : n === 1n ? f(1) : n === 27n ? "0x" : f(1), r === "0x00" ? "0x" : r, o === "0x00" ? "0x" : o];
}
const Vs = {
  gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
  l1Block: { address: "0x4200000000000000000000000000000000000015" },
  l2CrossDomainMessenger: {
    address: "0x4200000000000000000000000000000000000007"
  },
  l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
  l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
  l2ToL1MessagePasser: {
    address: "0x4200000000000000000000000000000000000016"
  }
}, Ms = {
  block: /* @__PURE__ */ zt({
    format(e) {
      var s;
      return {
        transactions: (s = e.transactions) == null ? void 0 : s.map((n) => {
          if (typeof n == "string")
            return n;
          const i = fe(n);
          return i.typeHex === "0x7e" && (i.isSystemTx = n.isSystemTx, i.mint = n.mint ? T(n.mint) : void 0, i.sourceHash = n.sourceHash, i.type = "deposit"), i;
        }),
        stateRoot: e.stateRoot
      };
    }
  }),
  transaction: /* @__PURE__ */ Et({
    format(e) {
      const t = {};
      return e.type === "0x7e" && (t.isSystemTx = e.isSystemTx, t.mint = e.mint ? T(e.mint) : void 0, t.sourceHash = e.sourceHash, t.type = "deposit"), t;
    }
  }),
  transactionReceipt: /* @__PURE__ */ Lt({
    format(e) {
      return {
        l1GasPrice: e.l1GasPrice ? T(e.l1GasPrice) : null,
        l1GasUsed: e.l1GasUsed ? T(e.l1GasUsed) : null,
        l1Fee: e.l1Fee ? T(e.l1Fee) : null,
        l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
      };
    }
  })
};
function js(e, t) {
  return Xs(e) ? Ks(e) : Hs(e, t);
}
const Rs = {
  transaction: js
};
function Ks(e) {
  Ws(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 ? f(o) : "0x",
    c ? f(c) : "0x",
    i ? f(i) : "0x",
    r ? "0x1" : "0x",
    s ?? "0x"
  ];
  return V([
    "0x7e",
    I(u)
  ]);
}
function Xs(e) {
  return e.type === "deposit" || typeof e.sourceHash < "u";
}
function Ws(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 J = {
  contracts: Vs,
  formatters: Ms,
  serializers: Rs
}, C = 1, oe = /* @__PURE__ */ D({
  ...J,
  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: {
    ...J.contracts,
    disputeGameFactory: {
      [C]: {
        address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"
      }
    },
    l2OutputOracle: {
      [C]: {
        address: "0x56315b90c40730925ec5485cf004d835058518A0"
      }
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 5022
    },
    portal: {
      [C]: {
        address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
        blockCreated: 17482143
      }
    },
    l1StandardBridge: {
      [C]: {
        address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
        blockCreated: 17482143
      }
    }
  },
  sourceId: C
}), K = /* @__PURE__ */ D({
  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
    }
  }
}), X = /* @__PURE__ */ D({
  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__ */ D({
  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
    }
  }
}), W = 11155111, ce = /* @__PURE__ */ D({
  ...J,
  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: {
    ...J.contracts,
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 0
    },
    portal: {
      [W]: {
        address: "0x0d83dab629f0e0F9d36c0Cbc89B69a489f0751bD"
      }
    },
    l1StandardBridge: {
      [W]: {
        address: "0xea58fcA6849d79EAd1f26608855c2D6407d54Ce2"
      }
    },
    disputeGameFactory: {
      [W]: {
        address: "0xeff73e5aa3B9AEC32c659Aa3E00444d20a84394b"
      }
    }
  },
  testnet: !0,
  sourceId: W
});
var m = /* @__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))(m || {}), g = /* @__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 = 501] = "sol", e[e.solDevnet = 5011] = "solDevnet", e[e.sui = 784] = "sui", e[e.suiDevnet = 7841] = "suiDevnet", e[e.ton = 461] = "ton", e[e.tonDevnet = 4611] = "tonDevnet", e))(g || {});
const Ys = {
  ...ae,
  id: g.eth,
  symbol: m.eth,
  logo: lt,
  network: _,
  blockExplorers: {
    ...ae.blockExplorers,
    default: {
      ...ae.blockExplorers.default,
      hash: "https://etherscan.io/tx/{{addr}}",
      address: "https://etherscan.io/address/{{addr}}"
    }
  }
}, qs = {
  ...K,
  id: g.bsc,
  symbol: m.bsc,
  logo: Le,
  network: _,
  rpcUrls: {
    default: {
      http: [
        K.rpcUrls.default.http[0],
        "https://bsc.blockpi.network/v1/rpc/32cdfa234a4a17abbb8e3f23bc6410a9b7d47cb3"
      ]
    }
  },
  blockExplorers: {
    ...K.blockExplorers,
    default: {
      ...K.blockExplorers.default,
      hash: "https://bscscan.com/tx/{{addr}}",
      address: "https://bscscan.com/address/{{addr}}"
    }
  }
}, Zs = {
  ...X,
  id: g.tbsc,
  symbol: m.tbsc,
  logo: Le,
  network: _,
  rpcUrls: {
    default: {
      http: [
        "https://bsc-testnet-rpc.publicnode.com",
        ...X.rpcUrls.default.http
      ],
      webSocket: [
        "wss://bsc-testnet-rpc.publicnode.com",
        "wss://bsc-testnet.blockpi.network/v1/ws/cd61e00aed93674ae0d608f823e2c2d05a52752d"
      ]
    }
  },
  blockExplorers: {
    ...X.blockExplorers,
    default: {
      ...X.blockExplorers.default,
      hash: "https://testnet.bscscan.com/tx/{{addr}}",
      address: "https://testnet.bscscan.com/address/{{addr}}"
    }
  }
}, Js = {
  ...ce,
  id: g.uni,
  symbol: m.uni,
  logo: ft,
  network: _,
  blockExplorers: {
    ...ce.blockExplorers,
    default: {
      ...ce.blockExplorers.default,
      hash: "https://explorer.unichain.io/tx/{{addr}}",
      address: "https://explorer.unichain.io/address/{{addr}}"
    }
  }
}, Qs = {
  ...oe,
  id: g.base,
  symbol: m.base,
  logo: ut,
  network: _,
  blockExplorers: {
    ...oe.blockExplorers,
    default: {
      ...oe.blockExplorers.default,
      hash: "https://basescan.org/tx/{{addr}}",
      address: "https://basescan.org/address/{{addr}}"
    }
  }
}, en = Q({
  id: g.sol,
  symbol: m.sol,
  name: "Solana",
  logo: ke,
  network: $e,
  nativeCurrency: { name: "Solana", symbol: "SOL", decimals: 9 },
  rpcUrls: {
    default: {
      http: [He(Oe.Mainnet)]
    }
  },
  blockExplorers: {
    default: {
      name: "Solscan",
      url: "https://explorer.solana.com",
      hash: "https://solscan.io/tx/{{addr}}",
      address: "https://solscan.io/account/{{addr}}"
    }
  }
}), tn = Q({
  id: g.solDevnet,
  symbol: m.solDevnet,
  name: "Solana Devnet",
  logo: ke,
  network: $e,
  nativeCurrency: { name: "Solana", symbol: "SOL", decimals: 9 },
  rpcUrls: {
    default: {
      http: [
        He(Oe.Devnet),
        "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
}), an = Q({
  id: g.sui,
  symbol: m.sui,
  name: "Sui",
  logo: Ge,
  network: Fe,
  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
}), cn = Q({
  id: g.suiDevnet,
  symbol: m.suiDevnet,
  name: "Sui Devnet",
  logo: Ge,
  network: Fe,
  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
}), un = process.env.NEXT_PUBLIC_APP_ENV === "mainnet", ln = [
  Zs,
  qs,
  Qs,
  Ys,
  Js,
  en,
  tn
];
export {
  ln as AllChains,
  g as ChainIds,
  m as ChainSymbols,
  qs as chainBSC,
  Zs as chainBSCTestnet,
  Qs as chainBase,
  Ys as chainEth,
  en as chainSol,
  tn as chainSolDevnet,
  an as chainSui,
  cn as chainSuiDevnet,
  Js as chainUni,
  un as isMainnet
};
//# sourceMappingURL=chains.js.map
