UNPKG

wallet-engine-lib

Version:

Professional, reusable wallet UI components with Gelato SDK integration. Enterprise-grade React components for building smart wallet applications.

1,517 lines 96.2 kB
import O, { forwardRef as ht, createElement as _e, useState as z, useCallback as L, useMemo as xe, useEffect as qe } from "react"; var ue = { exports: {} }, ee = {}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Xe; function Xt() { if (Xe) return ee; Xe = 1; var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment"); function s(n, r, i) { var a = null; if (i !== void 0 && (a = "" + i), r.key !== void 0 && (a = "" + r.key), "key" in r) { i = {}; for (var c in r) c !== "key" && (i[c] = r[c]); } else i = r; return r = i.ref, { $$typeof: e, type: n, key: a, ref: r !== void 0 ? r : null, props: i }; } return ee.Fragment = t, ee.jsx = s, ee.jsxs = s, ee; } var te = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Ke; function Kt() { return Ke || (Ke = 1, process.env.NODE_ENV !== "production" && (function() { function e(l) { if (l == null) return null; if (typeof l == "function") return l.$$typeof === Yt ? null : l.displayName || l.name || null; if (typeof l == "string") return l; switch (l) { case N: return "Fragment"; case B: return "Profiler"; case I: return "StrictMode"; case F: return "Suspense"; case E: return "SuspenseList"; case Ne: return "Activity"; } if (typeof l == "object") switch (typeof l.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), l.$$typeof) { case j: return "Portal"; case g: return (l.displayName || "Context") + ".Provider"; case h: return (l._context.displayName || "Context") + ".Consumer"; case A: var x = l.render; return l = l.displayName, l || (l = x.displayName || x.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l; case P: return x = l.displayName || null, x !== null ? x : e(l.type) || "Memo"; case _: x = l._payload, l = l._init; try { return e(l(x)); } catch { } } return null; } function t(l) { return "" + l; } function s(l) { try { t(l); var x = !1; } catch { x = !0; } if (x) { x = console; var v = x.error, k = typeof Symbol == "function" && Symbol.toStringTag && l[Symbol.toStringTag] || l.constructor.name || "Object"; return v.call( x, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", k ), t(l); } } function n(l) { if (l === N) return "<>"; if (typeof l == "object" && l !== null && l.$$typeof === _) return "<...>"; try { var x = e(l); return x ? "<" + x + ">" : "<...>"; } catch { return "<...>"; } } function r() { var l = Ee.A; return l === null ? null : l.getOwner(); } function i() { return Error("react-stack-top-frame"); } function a(l) { if (He.call(l, "key")) { var x = Object.getOwnPropertyDescriptor(l, "key").get; if (x && x.isReactWarning) return !1; } return l.key !== void 0; } function c(l, x) { function v() { Me || (Me = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", x )); } v.isReactWarning = !0, Object.defineProperty(l, "key", { get: v, configurable: !0 }); } function d() { var l = e(this.type); return De[l] || (De[l] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), l = this.props.ref, l !== void 0 ? l : null; } function u(l, x, v, k, R, S, Pe, ke) { return v = S.ref, l = { $$typeof: b, type: l, key: x, props: S, _owner: R }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(l, "ref", { enumerable: !1, get: d }) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(l, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(l, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: Pe }), Object.defineProperty(l, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: ke }), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l; } function m(l, x, v, k, R, S, Pe, ke) { var T = x.children; if (T !== void 0) if (k) if (Wt(T)) { for (k = 0; k < T.length; k++) f(T[k]); Object.freeze && Object.freeze(T); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else f(T); if (He.call(x, "key")) { T = e(l); var X = Object.keys(x).filter(function(qt) { return qt !== "key"; }); k = 0 < X.length ? "{key: someKey, " + X.join(": ..., ") + ": ...}" : "{key: someKey}", We[T + k] || (X = 0 < X.length ? "{" + X.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, k, T, X, T ), We[T + k] = !0); } if (T = null, v !== void 0 && (s(v), T = "" + v), a(x) && (s(x.key), T = "" + x.key), "key" in x) { v = {}; for (var Te in x) Te !== "key" && (v[Te] = x[Te]); } else v = x; return T && c( v, typeof l == "function" ? l.displayName || l.name || "Unknown" : l ), u( l, T, S, R, r(), v, Pe, ke ); } function f(l) { typeof l == "object" && l !== null && l.$$typeof === b && l._store && (l._store.validated = 1); } var y = O, b = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), I = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), h = Symbol.for("react.consumer"), g = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), P = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), Ne = Symbol.for("react.activity"), Yt = Symbol.for("react.client.reference"), Ee = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, He = Object.prototype.hasOwnProperty, Wt = Array.isArray, je = console.createTask ? console.createTask : function() { return null; }; y = { react_stack_bottom_frame: function(l) { return l(); } }; var Me, De = {}, Ve = y.react_stack_bottom_frame.bind( y, i )(), Ye = je(n(i)), We = {}; te.Fragment = N, te.jsx = function(l, x, v, k, R) { var S = 1e4 > Ee.recentlyCreatedOwnerStacks++; return m( l, x, v, !1, k, R, S ? Error("react-stack-top-frame") : Ve, S ? je(n(l)) : Ye ); }, te.jsxs = function(l, x, v, k, R) { var S = 1e4 > Ee.recentlyCreatedOwnerStacks++; return m( l, x, v, !0, k, R, S ? Error("react-stack-top-frame") : Ve, S ? je(n(l)) : Ye ); }; })()), te; } var Je; function Jt() { return Je || (Je = 1, process.env.NODE_ENV === "production" ? ue.exports = Xt() : ue.exports = Kt()), ue.exports; } var o = Jt(); const Zt = (e, t = 6) => !e || e.length < 10 ? e : `${e.slice(0, t)}...${e.slice(-t)}`, Ze = (e) => /^0x[a-fA-F0-9]{40}$/.test(e), mr = (e) => ({ 1: { name: "Ethereum Mainnet", explorer: "https://etherscan.io" }, 11155111: { name: "Sepolia Testnet", explorer: "https://sepolia.etherscan.io" }, 84532: { name: "Base Sepolia Testnet", explorer: "https://sepolia.basescan.org" } })[e] || { name: `Chain ${e}`, explorer: "" }; /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const Qt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), es = (e) => e.replace( /^([A-Z])|[\s-_]+(\w)/g, (t, s, n) => n ? n.toUpperCase() : s.toLowerCase() ), Qe = (e) => { const t = es(e); return t.charAt(0).toUpperCase() + t.slice(1); }, mt = (...e) => e.filter((t, s, n) => !!t && t.trim() !== "" && n.indexOf(t) === s).join(" ").trim(), ts = (e) => { for (const t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0; }; /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ var ss = { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }; /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const ns = ht( ({ color: e = "currentColor", size: t = 24, strokeWidth: s = 2, absoluteStrokeWidth: n, className: r = "", children: i, iconNode: a, ...c }, d) => _e( "svg", { ref: d, ...ss, width: t, height: t, stroke: e, strokeWidth: n ? Number(s) * 24 / Number(t) : s, className: mt("lucide", r), ...!i && !ts(c) && { "aria-hidden": "true" }, ...c }, [ ...a.map(([u, m]) => _e(u, m)), ...Array.isArray(i) ? i : [i] ] ) ); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const C = (e, t) => { const s = ht( ({ className: n, ...r }, i) => _e(ns, { ref: i, iconNode: t, className: mt( `lucide-${Qt(Qe(e))}`, `lucide-${e}`, n ), ...r }) ); return s.displayName = Qe(e), s; }; /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const rs = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], xt = C("check", rs); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const is = [ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }], ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }] ], pt = C("circle-alert", is); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const os = [ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }], ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }] ], bt = C("circle-check-big", os); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const as = [ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }], ["path", { d: "m15 9-6 6", key: "1uzhvr" }], ["path", { d: "m9 9 6 6", key: "z0biqf" }] ], cs = C("circle-x", as); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const ls = [ ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }], ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }] ], he = C("clock", ls); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const ds = [ ["circle", { cx: "8", cy: "8", r: "6", key: "3yglwk" }], ["path", { d: "M18.09 10.37A6 6 0 1 1 10.34 18", key: "t5s6rm" }], ["path", { d: "M7 6h1v4", key: "1obek4" }], ["path", { d: "m16.71 13.88.7.71-2.82 2.82", key: "1rbuyh" }] ], et = C("coins", ds); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const us = [ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }], ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }] ], gt = C("copy", us); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const fs = [ ["path", { d: "M15 3h6v6", key: "1q9fwt" }], ["path", { d: "M10 14 21 3", key: "gplh6r" }], ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }] ], yt = C("external-link", fs); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const hs = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ie = C("loader-circle", hs); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const ms = [ ["path", { d: "M5 12h14", key: "1ays0h" }], ["path", { d: "M12 5v14", key: "s699le" }] ], xs = C("plus", ms); /** * @license lucide-react v0.541.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const ps = [ ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }], ["path", { d: "M21 3v5h-5", key: "1q7to0" }], ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }], ["path", { d: "M8 16H3v5", key: "1cv678" }] ], wt = C("refresh-cw", ps), xr = O.memo(({ smartWalletAddress: e, isConnected: t, chainId: s, className: n = "", onAddressCopied: r }) => { const [i, a] = z(!1), c = L(async () => { if (e) try { await navigator.clipboard.writeText(e), a(!0), r?.(e), setTimeout(() => a(!1), 2e3); } catch (u) { console.error("Failed to copy address:", u); } }, [e, r]), d = L(() => { if (!(!e || !s)) try { const u = `https://sepolia.inkonchain.com/address/${e}`; window.open(u, "_blank", "noopener,noreferrer"); } catch (u) { console.error("Failed to open explorer:", u); } }, [e, s]); return !t || !e ? null : /* @__PURE__ */ o.jsx("div", { className: `bg-white/5 backdrop-blur-sm rounded-xl p-4 sm:p-6 ${n}`, children: /* @__PURE__ */ o.jsxs("div", { className: "space-y-3 sm:space-y-4", children: [ /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0", children: [ /* @__PURE__ */ o.jsx("span", { className: "text-xs sm:text-sm text-gray-400", children: "Address" }), /* @__PURE__ */ o.jsxs( "button", { onClick: c, className: "flex items-center gap-2 sm:gap-3 text-xs sm:text-sm text-blue-400 hover:text-blue-300 transition-colors break-all sm:break-normal", children: [ i ? /* @__PURE__ */ o.jsx(xt, { size: 12, className: "sm:w-3.5 sm:h-3.5" }) : /* @__PURE__ */ o.jsx(gt, { size: 12, className: "sm:w-3.5 sm:h-3.5" }), /* @__PURE__ */ o.jsx("span", { className: "truncate", children: Zt(e) }) ] } ) ] }), /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0", children: [ /* @__PURE__ */ o.jsx("span", { className: "text-xs sm:text-sm text-gray-400", children: "Network" }), /* @__PURE__ */ o.jsx("span", { className: "text-xs sm:text-sm text-white", children: "INK Sepolia" }) ] }), /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0", children: [ /* @__PURE__ */ o.jsx("span", { className: "text-xs sm:text-sm text-gray-400", children: "Status" }), /* @__PURE__ */ o.jsx("span", { className: "text-xs sm:text-sm text-green-400", children: "Connected" }) ] }), /* @__PURE__ */ o.jsxs( "button", { onClick: d, className: "flex items-center gap-2 text-xs sm:text-sm text-blue-400 hover:text-blue-300 transition-colors w-full sm:w-auto justify-center sm:justify-start", children: [ /* @__PURE__ */ o.jsx(yt, { size: 12, className: "sm:w-3.5 sm:h-3.5" }), /* @__PURE__ */ o.jsx("span", { className: "sm:hidden", children: "View Explorer" }), /* @__PURE__ */ o.jsx("span", { className: "hidden sm:inline", children: "View on Explorer" }) ] } ) ] }) }); }); function $e(e) { return { formatters: void 0, fees: void 0, serializers: void 0, ...e }; } const vt = "2.34.0"; let Ie = { getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0, version: `viem@${vt}` }; class w extends Error { constructor(t, s = {}) { const n = s.cause instanceof w ? s.cause.details : s.cause?.message ? s.cause.message : s.details, r = s.cause instanceof w && s.cause.docsPath || s.docsPath, i = Ie.getDocsUrl?.({ ...s, docsPath: r }), a = [ t || "An error occurred.", "", ...s.metaMessages ? [...s.metaMessages, ""] : [], ...i ? [`Docs: ${i}`] : [], ...n ? [`Details: ${n}`] : [], ...Ie.version ? [`Version: ${Ie.version}`] : [] ].join(` `); super(a, 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 = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = vt; } walk(t) { return Nt(this, t); } } function Nt(e, t) { return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? Nt(e.cause, t) : t ? null : e; } class bs extends w { constructor({ max: t, min: s, signed: n, size: r, value: i }) { super(`Number "${i}" is not in safe ${r ? `${r * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${s} to ${t})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" }); } } class gs extends w { constructor({ givenSize: t, maxSize: s }) { super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" }); } } function ce(e, { strict: t = !0 } = {}) { return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x"); } function J(e) { return ce(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length; } function pe(e, { dir: t = "left" } = {}) { let s = typeof e == "string" ? e.replace("0x", "") : e, n = 0; for (let r = 0; r < s.length - 1 && s[t === "left" ? r : s.length - r - 1].toString() === "0"; r++) 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 ys extends w { 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 Et extends w { 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 Z(e, { dir: t, size: s = 32 } = {}) { return typeof e == "string" ? ws(e, { dir: t, size: s }) : vs(e, { dir: t, size: s }); } function ws(e, { dir: t, size: s = 32 } = {}) { if (s === null) return e; const n = e.replace("0x", ""); if (n.length > s * 2) throw new Et({ size: Math.ceil(n.length / 2), targetSize: s, type: "hex" }); return `0x${n[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`; } function vs(e, { dir: t, size: s = 32 } = {}) { if (s === null) return e; if (e.length > s) throw new Et({ size: e.length, targetSize: s, type: "bytes" }); const n = new Uint8Array(s); for (let r = 0; r < s; r++) { const i = t === "right"; n[i ? r : s - r - 1] = e[i ? r : e.length - r - 1]; } return n; } const Ns = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0")); function re(e, t = {}) { return typeof e == "number" || typeof e == "bigint" ? p(e, t) : typeof e == "string" ? Ps(e, t) : typeof e == "boolean" ? Es(e, t) : M(e, t); } function Es(e, t = {}) { const s = `0x${Number(e)}`; return typeof t.size == "number" ? (Q(s, { size: t.size }), Z(s, { size: t.size })) : s; } function M(e, t = {}) { let s = ""; for (let r = 0; r < e.length; r++) s += Ns[e[r]]; const n = `0x${s}`; return typeof t.size == "number" ? (Q(n, { size: t.size }), Z(n, { dir: "right", size: t.size })) : n; } function p(e, t = {}) { const { signed: s, size: n } = t, r = BigInt(e); let i; n ? s ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER)); const a = typeof i == "bigint" && s ? -i - 1n : 0; if (i && r > i || r < a) { const d = typeof e == "bigint" ? "n" : ""; throw new bs({ max: i ? `${i}${d}` : void 0, min: `${a}${d}`, signed: s, size: n, value: `${e}${d}` }); } const c = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`; return n ? Z(c, { size: n }) : c; } const js = /* @__PURE__ */ new TextEncoder(); function Ps(e, t = {}) { const s = js.encode(e); return M(s, t); } const ks = /* @__PURE__ */ new TextEncoder(); function jt(e, t = {}) { return typeof e == "number" || typeof e == "bigint" ? Is(e, t) : typeof e == "boolean" ? Ts(e, t) : ce(e) ? V(e, t) : Pt(e, t); } function Ts(e, t = {}) { const s = new Uint8Array(1); return s[0] = Number(e), typeof t.size == "number" ? (Q(s, { size: t.size }), Z(s, { size: t.size })) : s; } const U = { zero: 48, nine: 57, A: 65, F: 70, a: 97, f: 102 }; function tt(e) { if (e >= U.zero && e <= U.nine) return e - U.zero; if (e >= U.A && e <= U.F) return e - (U.A - 10); if (e >= U.a && e <= U.f) return e - (U.a - 10); } function V(e, t = {}) { let s = e; t.size && (Q(s, { size: t.size }), s = Z(s, { dir: "right", size: t.size })); let n = s.slice(2); n.length % 2 && (n = `0${n}`); const r = n.length / 2, i = new Uint8Array(r); for (let a = 0, c = 0; a < r; a++) { const d = tt(n.charCodeAt(c++)), u = tt(n.charCodeAt(c++)); if (d === void 0 || u === void 0) throw new w(`Invalid byte sequence ("${n[c - 2]}${n[c - 1]}" in "${n}").`); i[a] = d * 16 + u; } return i; } function Is(e, t) { const s = p(e, t); return V(s); } function Pt(e, t = {}) { const s = ks.encode(e); return typeof t.size == "number" ? (Q(s, { size: t.size }), Z(s, { dir: "right", size: t.size })) : s; } function Q(e, { size: t }) { if (J(e) > t) throw new gs({ givenSize: J(e), maxSize: t }); } function K(e, t = {}) { const { signed: s } = t; t.size && Q(e, { size: t.size }); const n = BigInt(e); if (!s) return n; const r = (e.length - 2) / 2, i = (1n << BigInt(r) * 8n - 1n) - 1n; return n <= i ? n : n - BigInt(`0x${"f".padStart(r * 2, "f")}`) - 1n; } function be(e, t = {}) { return Number(K(e, t)); } function ze(e, t) { return ({ exclude: s, format: n }) => ({ exclude: s, format: (r) => { const i = t(r); if (s) for (const a of s) delete i[a]; return { ...i, ...n(r) }; }, type: e }); } const kt = { "0x0": "legacy", "0x1": "eip2930", "0x2": "eip1559", "0x3": "eip4844", "0x4": "eip7702" }; function Le(e) { const t = { ...e, blockHash: e.blockHash ? e.blockHash : null, blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null, chainId: e.chainId ? be(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 ? be(e.nonce) : void 0, to: e.to ? e.to : null, transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null, type: e.type ? kt[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 = Cs(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 As = /* @__PURE__ */ ze("transaction", Le); function Cs(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 Bs(e) { const t = (e.transactions ?? []).map((s) => typeof s == "string" ? s : Le(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 _s = /* @__PURE__ */ ze("block", Bs); function Ss(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 $s = { "0x0": "reverted", "0x1": "success" }; function zs(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) => Ss(s)) : null, to: e.to ? e.to : null, transactionIndex: e.transactionIndex ? be(e.transactionIndex) : null, status: e.status ? $s[e.status] : null, type: e.type ? kt[e.type] || e.type : null }; return e.blobGasPrice && (t.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (t.blobGasUsed = BigInt(e.blobGasUsed)), t; } const Ls = /* @__PURE__ */ ze("transactionReceipt", zs), Fe = 2n ** 256n - 1n; function le(e) { return `0x${e.reduce((t, s) => t + s.replace("0x", ""), "")}`; } class st extends w { constructor({ offset: t }) { super(`Offset \`${t}\` cannot be negative.`, { name: "NegativeOffsetError" }); } } class Fs extends w { constructor({ length: t, position: s }) { super(`Position \`${s}\` is out of bounds (\`0 < position < ${t}\`).`, { name: "PositionOutOfBoundsError" }); } } class Us extends w { constructor({ count: t, limit: s }) { super(`Recursive read limit of \`${s}\` exceeded (recursive read count: \`${t}\`).`, { name: "RecursiveReadLimitExceededError" }); } } const Os = { 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 Us({ count: this.recursiveReadCount + 1, limit: this.recursiveReadLimit }); }, assertPosition(e) { if (e < 0 || e > this.bytes.length - 1) throw new Fs({ length: this.bytes.length, position: e }); }, decrementPosition(e) { if (e < 0) throw new st({ 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 st({ 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 Tt(e, { recursiveReadLimit: t = 8192 } = {}) { const s = Object.create(Os); return s.bytes = e, s.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), s.positionReadCount = /* @__PURE__ */ new Map(), s.recursiveReadLimit = t, s; } function Y(e, t = "hex") { const s = It(e), n = Tt(new Uint8Array(s.length)); return s.encode(n), t === "hex" ? M(n.bytes) : n.bytes; } function It(e) { return Array.isArray(e) ? Rs(e.map((t) => It(t))) : Gs(e); } function Rs(e) { const t = e.reduce((r, i) => r + i.length, 0), s = At(t); return { length: t <= 55 ? 1 + t : 1 + s + t, encode(r) { t <= 55 ? r.pushByte(192 + t) : (r.pushByte(247 + s), s === 1 ? r.pushUint8(t) : s === 2 ? r.pushUint16(t) : s === 3 ? r.pushUint24(t) : r.pushUint32(t)); for (const { encode: i } of e) i(r); } }; } function Gs(e) { const t = typeof e == "string" ? V(e) : e, s = At(t.length); return { length: t.length === 1 && t[0] < 128 ? 1 : t.length <= 55 ? 1 + t.length : 1 + s + t.length, encode(r) { t.length === 1 && t[0] < 128 ? r.pushBytes(t) : t.length <= 55 ? (r.pushByte(128 + t.length), r.pushBytes(t)) : (r.pushByte(183 + s), s === 1 ? r.pushUint8(t.length) : s === 2 ? r.pushUint16(t.length) : s === 3 ? r.pushUint24(t.length) : r.pushUint32(t.length), r.pushBytes(t)); } }; } function At(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 w("Length is too large."); } const Hs = { ether: -9, wei: 9 }; function Ms(e, t) { let s = e.toString(); const n = s.startsWith("-"); n && (s = s.slice(1)), s = s.padStart(t, "0"); let [r, i] = [ s.slice(0, s.length - t), s.slice(s.length - t) ]; return i = i.replace(/(0+)$/, ""), `${n ? "-" : ""}${r || "0"}${i ? `.${i}` : ""}`; } function Se(e, t = "wei") { return Ms(e, Hs[t]); } function Ds(e) { const t = Object.entries(e).map(([n, r]) => r === void 0 || r === !1 ? null : [n, r]).filter(Boolean), s = t.reduce((n, [r]) => Math.max(n, r.length), 0); return t.map(([n, r]) => ` ${`${n}:`.padEnd(s + 1)} ${r}`).join(` `); } class Vs extends w { constructor({ v: t }) { super(`Invalid \`v\` value "${t}". Expected 27 or 28.`, { name: "InvalidLegacyVError" }); } } class Ys extends w { constructor({ transaction: t }) { super("Cannot infer a transaction type from provided transaction.", { metaMessages: [ "Provided Transaction:", "{", Ds(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 Ws extends w { 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 qs(e) { if (!e || e.length === 0) return []; const t = []; for (const s of e) { const { chainId: n, nonce: r, ...i } = s, a = s.address; t.push([ n ? re(n) : "0x", a, r ? re(r) : "0x", ...de({}, i) ]); } return t; } function Ct(e) { const { kzg: t } = e, s = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((i) => V(i)) : e.blobs, r = []; for (const i of n) r.push(Uint8Array.from(t.blobToKzgCommitment(i))); return s === "bytes" ? r : r.map((i) => M(i)); } function Bt(e) { const { kzg: t } = e, s = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((a) => V(a)) : e.blobs, r = typeof e.commitments[0] == "string" ? e.commitments.map((a) => V(a)) : e.commitments, i = []; for (let a = 0; a < n.length; a++) { const c = n[a], d = r[a]; i.push(Uint8Array.from(t.computeBlobKzgProof(c, d))); } return s === "bytes" ? i : i.map((a) => M(a)); } /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function Xs(e) { return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array"; } function nt(e) { if (!Number.isSafeInteger(e) || e < 0) throw new Error("positive integer expected, got " + e); } function oe(e, ...t) { if (!Xs(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 ge(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 _t(e, t) { oe(e); const s = t.outputLen; if (e.length < s) throw new Error("digestInto() expects output buffer of length at least " + s); } function Ks(e) { return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)); } function ae(...e) { for (let t = 0; t < e.length; t++) e[t].fill(0); } function Ae(e) { return new DataView(e.buffer, e.byteOffset, e.byteLength); } function $(e, t) { return e << 32 - t | e >>> t; } const Js = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; function Zs(e) { return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255; } function Qs(e) { for (let t = 0; t < e.length; t++) e[t] = Zs(e[t]); return e; } const rt = Js ? (e) => e : Qs; function en(e) { if (typeof e != "string") throw new Error("string expected"); return new Uint8Array(new TextEncoder().encode(e)); } function Ue(e) { return typeof e == "string" && (e = en(e)), oe(e), e; } class St { } function $t(e) { const t = (n) => e().update(Ue(n)).digest(), s = e(); return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t; } function tn(e, t, s, n) { if (typeof e.setBigUint64 == "function") return e.setBigUint64(t, s, n); const r = BigInt(32), i = BigInt(4294967295), a = Number(s >> r & i), c = Number(s & i), d = n ? 4 : 0, u = n ? 0 : 4; e.setUint32(t + d, a, n), e.setUint32(t + u, c, n); } function sn(e, t, s) { return e & t ^ ~e & s; } function nn(e, t, s) { return e & t ^ e & s ^ t & s; } class rn extends St { constructor(t, s, n, r) { super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(t), this.view = Ae(this.buffer); } update(t) { ge(this), t = Ue(t), oe(t); const { view: s, buffer: n, blockLen: r } = this, i = t.length; for (let a = 0; a < i; ) { const c = Math.min(r - this.pos, i - a); if (c === r) { const d = Ae(t); for (; r <= i - a; a += r) this.process(d, a); continue; } n.set(t.subarray(a, a + c), this.pos), this.pos += c, a += c, this.pos === r && (this.process(s, 0), this.pos = 0); } return this.length += t.length, this.roundClean(), this; } digestInto(t) { ge(this), _t(t, this), this.finished = !0; const { buffer: s, view: n, blockLen: r, isLE: i } = this; let { pos: a } = this; s[a++] = 128, ae(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0); for (let f = a; f < r; f++) s[f] = 0; tn(n, r - 8, BigInt(this.length * 8), i), this.process(n, 0); const c = Ae(t), d = this.outputLen; if (d % 4) throw new Error("_sha2: outputLen should be aligned to 32bit"); const u = d / 4, m = this.get(); if (u > m.length) throw new Error("_sha2: outputLen bigger than state"); for (let f = 0; f < u; f++) c.setUint32(4 * f, m[f], i); } 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: r, finished: i, destroyed: a, pos: c } = this; return t.destroyed = a, t.finished = i, t.length = r, t.pos = c, r % s && t.buffer.set(n), t; } clone() { return this._cloneInto(); } } const G = /* @__PURE__ */ Uint32Array.from([ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ]), fe = /* @__PURE__ */ BigInt(2 ** 32 - 1), it = /* @__PURE__ */ BigInt(32); function on(e, t = !1) { return t ? { h: Number(e & fe), l: Number(e >> it & fe) } : { h: Number(e >> it & fe) | 0, l: Number(e & fe) | 0 }; } function an(e, t = !1) { const s = e.length; let n = new Uint32Array(s), r = new Uint32Array(s); for (let i = 0; i < s; i++) { const { h: a, l: c } = on(e[i], t); [n[i], r[i]] = [a, c]; } return [n, r]; } const cn = (e, t, s) => e << s | t >>> 32 - s, ln = (e, t, s) => t << s | e >>> 32 - s, dn = (e, t, s) => t << s - 32 | e >>> 64 - s, un = (e, t, s) => e << s - 32 | t >>> 64 - s, fn = /* @__PURE__ */ Uint32Array.from([ 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 ]), H = /* @__PURE__ */ new Uint32Array(64); class hn extends rn { constructor(t = 32) { super(64, t, 8, !1), this.A = G[0] | 0, this.B = G[1] | 0, this.C = G[2] | 0, this.D = G[3] | 0, this.E = G[4] | 0, this.F = G[5] | 0, this.G = G[6] | 0, this.H = G[7] | 0; } get() { const { A: t, B: s, C: n, D: r, E: i, F: a, G: c, H: d } = this; return [t, s, n, r, i, a, c, d]; } // prettier-ignore set(t, s, n, r, i, a, c, d) { this.A = t | 0, this.B = s | 0, this.C = n | 0, this.D = r | 0, this.E = i | 0, this.F = a | 0, this.G = c | 0, this.H = d | 0; } process(t, s) { for (let f = 0; f < 16; f++, s += 4) H[f] = t.getUint32(s, !1); for (let f = 16; f < 64; f++) { const y = H[f - 15], b = H[f - 2], j = $(y, 7) ^ $(y, 18) ^ y >>> 3, N = $(b, 17) ^ $(b, 19) ^ b >>> 10; H[f] = N + H[f - 7] + j + H[f - 16] | 0; } let { A: n, B: r, C: i, D: a, E: c, F: d, G: u, H: m } = this; for (let f = 0; f < 64; f++) { const y = $(c, 6) ^ $(c, 11) ^ $(c, 25), b = m + y + sn(c, d, u) + fn[f] + H[f] | 0, N = ($(n, 2) ^ $(n, 13) ^ $(n, 22)) + nn(n, r, i) | 0; m = u, u = d, d = c, c = a + b | 0, a = i, i = r, r = n, n = b + N | 0; } n = n + this.A | 0, r = r + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, c = c + this.E | 0, d = d + this.F | 0, u = u + this.G | 0, m = m + this.H | 0, this.set(n, r, i, a, c, d, u, m); } roundClean() { ae(H); } destroy() { this.set(0, 0, 0, 0, 0, 0, 0, 0), ae(this.buffer); } } const mn = /* @__PURE__ */ $t(() => new hn()), xn = mn; function pn(e, t) { return xn(ce(e, { strict: !1 }) ? jt(e) : e); } function bn(e) { const { commitment: t, version: s = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), r = pn(t); return r.set([s], 0), n === "bytes" ? r : M(r); } function gn(e) { const { commitments: t, version: s } = e, n = e.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), r = []; for (const i of t) r.push(bn({ commitment: i, to: n, version: s })); return r; } const ot = 6, zt = 32, Oe = 4096, Lt = zt * Oe, at = Lt * ot - // terminator byte (0x80). 1 - // zero byte (0x00) appended to each field element. 1 * Oe * ot, Ft = 1; class yn extends w { constructor({ maxSize: t, size: s }) { super("Blob size is too large.", { metaMessages: [`Max: ${t} bytes`, `Given: ${s} bytes`], name: "BlobSizeTooLargeError" }); } } class Ut extends w { constructor() { super("Blob data must not be empty.", { name: "EmptyBlobError" }); } } class wn extends w { constructor({ hash: t, size: s }) { super(`Versioned hash "${t}" size is invalid.`, { metaMessages: ["Expected: 32", `Received: ${s}`], name: "InvalidVersionedHashSizeError" }); } } class vn extends w { constructor({ hash: t, version: s }) { super(`Versioned hash "${t}" version is invalid.`, { metaMessages: [ `Expected: ${Ft}`, `Received: ${s}` ], name: "InvalidVersionedHashVersionError" }); } } function Nn(e) { const t = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), s = typeof e.data == "string" ? V(e.data) : e.data, n = J(s); if (!n) throw new Ut(); if (n > at) throw new yn({ maxSize: at, size: n }); const r = []; let i = !0, a = 0; for (; i; ) { const c = Tt(new Uint8Array(Lt)); let d = 0; for (; d < Oe; ) { const u = s.slice(a, a + (zt - 1)); if (c.pushByte(0), c.pushBytes(u), u.length < 31) { c.pushByte(128), i = !1; break; } d++, a += 31; } r.push(c); } return t === "bytes" ? r.map((c) => c.bytes) : r.map((c) => M(c.bytes)); } function En(e) { const { data: t, kzg: s, to: n } = e, r = e.blobs ?? Nn({ data: t, to: n }), i = e.commitments ?? Ct({ blobs: r, kzg: s, to: n }), a = e.proofs ?? Bt({ blobs: r, commitments: i, kzg: s, to: n }), c = []; for (let d = 0; d < r.length; d++) c.push({ blob: r[d], commitment: i[d], proof: a[d] }); return c; } class W extends w { 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 ye extends w { constructor({ chainId: t }) { super(typeof t == "number" ? `Chain ID "${t}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" }); } } class we extends w { constructor({ cause: t, maxFeePerGas: s } = {}) { super(`The fee cap (\`maxFeePerGas\`${s ? ` = ${Se(s)} gwei` : ""}