UNPKG

@kolirt/vue-web3-auth

Version:

Web3 authentication for Vue3 apps based on WalletConnect Web3Modal v2

1,671 lines 194 kB
import { configureChains as ut, createConfig as mt, watchNetwork as dt, watchAccount as ht, disconnect as bt, getWalletClient as ft, fetchBalance as yt, fetchBlockNumber as kt, readContract as wt, writeContract as xt, getPublicClient as Le, waitForTransaction as Ne, watchContractEvent as gt, fetchFeeData as vt, signMessage as Et, multicall as Ct, fetchToken as Tt, fetchTransaction as St, prepareSendTransaction as At, sendTransaction as Ut } from "@wagmi/core"; import { reactive as K, ref as ce, computed as Pt, watch as ue, toRaw as Bt, readonly as zt, watchEffect as Ft } from "vue"; import { w3mProvider as It, w3mConnectors as Mt, EthereumClient as Lt } from "@web3modal/ethereum"; import { Web3Modal as Nt } from "@web3modal/html"; import $t from "js-event-bus"; function s(e, t = {}) { const { fees: n = e.fees, formatters: r = e.formatters, serializers: a = e.serializers } = t; return { ...e, fees: n, formatters: r, serializers: a }; } const Ot = /* @__PURE__ */ s({ id: 787, name: "Acala", network: "acala", nativeCurrency: { name: "Acala", symbol: "ACA", decimals: 18 }, rpcUrls: { public: { http: ["https://eth-rpc-acala.aca-api.network"], webSocket: ["wss://eth-rpc-acala.aca-api.network"] }, default: { http: ["https://eth-rpc-acala.aca-api.network"], webSocket: ["wss://eth-rpc-acala.aca-api.network"] } }, blockExplorers: { default: { name: "Acala Blockscout", url: "https://blockscout.acala.network" } }, testnet: !1 }), Ht = /* @__PURE__ */ s({ id: 42161, name: "Arbitrum One", network: "arbitrum", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { alchemy: { http: ["https://arb-mainnet.g.alchemy.com/v2"], webSocket: ["wss://arb-mainnet.g.alchemy.com/v2"] }, infura: { http: ["https://arbitrum-mainnet.infura.io/v3"], webSocket: ["wss://arbitrum-mainnet.infura.io/ws/v3"] }, default: { http: ["https://arb1.arbitrum.io/rpc"] }, public: { http: ["https://arb1.arbitrum.io/rpc"] } }, blockExplorers: { etherscan: { name: "Arbiscan", url: "https://arbiscan.io" }, default: { name: "Arbiscan", url: "https://arbiscan.io" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 7654707 } } }), Gt = /* @__PURE__ */ s({ id: 421613, name: "Arbitrum Goerli", network: "arbitrum-goerli", nativeCurrency: { name: "Arbitrum Goerli Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { alchemy: { http: ["https://arb-goerli.g.alchemy.com/v2"], webSocket: ["wss://arb-goerli.g.alchemy.com/v2"] }, infura: { http: ["https://arbitrum-goerli.infura.io/v3"], webSocket: ["wss://arbitrum-goerli.infura.io/ws/v3"] }, default: { http: ["https://goerli-rollup.arbitrum.io/rpc"] }, public: { http: ["https://goerli-rollup.arbitrum.io/rpc"] } }, blockExplorers: { etherscan: { name: "Arbiscan", url: "https://goerli.arbiscan.io" }, default: { name: "Arbiscan", url: "https://goerli.arbiscan.io" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 88114 } }, testnet: !0 }), jt = /* @__PURE__ */ s({ id: 42170, name: "Arbitrum Nova", network: "arbitrum-nova", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { blast: { http: ["https://arbitrum-nova.public.blastapi.io"], webSocket: ["wss://arbitrum-nova.public.blastapi.io"] }, default: { http: ["https://nova.arbitrum.io/rpc"] }, public: { http: ["https://nova.arbitrum.io/rpc"] } }, blockExplorers: { etherscan: { name: "Arbiscan", url: "https://nova.arbiscan.io" }, blockScout: { name: "BlockScout", url: "https://nova-explorer.arbitrum.io/" }, default: { name: "Arbiscan", url: "https://nova.arbiscan.io" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 1746963 } } }), Dt = /* @__PURE__ */ s({ id: 592, name: "Astar", network: "astar-mainnet", nativeCurrency: { name: "Astar", symbol: "ASTR", decimals: 18 }, rpcUrls: { public: { http: ["https://astar.api.onfinality.io/public"] }, default: { http: ["https://astar.api.onfinality.io/public"] } }, blockExplorers: { default: { name: "Astar Subscan", url: "https://astar.subscan.io" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 761794 } }, testnet: !1 }), Kt = /* @__PURE__ */ s({ id: 421614, name: "Arbitrum Sepolia", network: "arbitrum-sepolia", nativeCurrency: { name: "Arbitrum Sepolia Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { alchemy: { http: ["https://arb-sepolia.g.alchemy.com/v2"], webSocket: ["wss://arb-sepolia.g.alchemy.com/v2"] }, default: { http: ["https://sepolia-rollup.arbitrum.io/rpc"] }, public: { http: ["https://sepolia-rollup.arbitrum.io/rpc"] } }, blockExplorers: { etherscan: { name: "Arbiscan", url: "https://sepolia.arbiscan.io" }, default: { name: "Arbiscan", url: "https://sepolia.arbiscan.io" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 81930 } }, testnet: !0 }), Vt = /* @__PURE__ */ s({ id: 1261120, name: "Astar zkEVM Testnet zKatana", network: "zKatana", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: [ "https://rpc.zkatana.gelato.digital", "https://rpc.startale.com/zkatana" ] }, public: { http: [ "https://rpc.zkatana.gelato.digital", "https://rpc.startale.com/zkatana" ] } }, blockExplorers: { blockscout: { name: "Blockscout zKatana chain explorer", url: "https://zkatana.blockscout.com" }, default: { name: "zKatana Explorer", url: "https://zkatana.explorer.startale.com" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 31317 } }, testnet: !0 }), Rt = /* @__PURE__ */ s({ id: 1313161554, name: "Aurora", network: "aurora", nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" }, rpcUrls: { infura: { http: ["https://aurora-mainnet.infura.io/v3"] }, default: { http: ["https://mainnet.aurora.dev"] }, public: { http: ["https://mainnet.aurora.dev"] } }, blockExplorers: { etherscan: { name: "Aurorascan", url: "https://aurorascan.dev" }, default: { name: "Aurorascan", url: "https://aurorascan.dev" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 62907816 } } }), qt = /* @__PURE__ */ s({ id: 1313161555, name: "Aurora Testnet", network: "aurora-testnet", nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" }, rpcUrls: { infura: { http: ["https://aurora-testnet.infura.io/v3"] }, default: { http: ["https://testnet.aurora.dev"] }, public: { http: ["https://testnet.aurora.dev"] } }, blockExplorers: { etherscan: { name: "Aurorascan", url: "https://testnet.aurorascan.dev" }, default: { name: "Aurorascan", url: "https://testnet.aurorascan.dev" } }, testnet: !0 }), Xt = /* @__PURE__ */ s({ id: 43114, name: "Avalanche", network: "avalanche", nativeCurrency: { decimals: 18, name: "Avalanche", symbol: "AVAX" }, rpcUrls: { default: { http: ["https://api.avax.network/ext/bc/C/rpc"] }, public: { http: ["https://api.avax.network/ext/bc/C/rpc"] } }, blockExplorers: { etherscan: { name: "SnowTrace", url: "https://snowtrace.io" }, default: { name: "SnowTrace", url: "https://snowtrace.io" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 11907934 } } }), Zt = /* @__PURE__ */ s({ id: 43113, name: "Avalanche Fuji", network: "avalanche-fuji", nativeCurrency: { decimals: 18, name: "Avalanche Fuji", symbol: "AVAX" }, rpcUrls: { default: { http: ["https://api.avax-test.network/ext/bc/C/rpc"] }, public: { http: ["https://api.avax-test.network/ext/bc/C/rpc"] } }, blockExplorers: { etherscan: { name: "SnowTrace", url: "https://testnet.snowtrace.io" }, default: { name: "SnowTrace", url: "https://testnet.snowtrace.io" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 7096959 } }, testnet: !0 }), Wt = /* @__PURE__ */ s({ id: 5165, network: "bahamut", name: "Bahamut", nativeCurrency: { name: "Fasttoken", symbol: "FTN", decimals: 18 }, rpcUrls: { default: { http: [ "https://rpc1.bahamut.io", "https://bahamut.publicnode.com", "https://rpc2.bahamut.io" ], webSocket: [ "wss://ws1.sahara.bahamutchain.com", "wss://bahamut.publicnode.com", "wss://ws2.sahara.bahamutchain.com" ] }, public: { http: [ "https://rpc1.bahamut.io", "https://bahamut.publicnode.com", "https://rpc2.bahamut.io" ], webSocket: [ "wss://ws1.sahara.bahamutchain.com", "wss://bahamut.publicnode.com", "wss://ws2.sahara.bahamutchain.com" ] } }, blockExplorers: { default: { name: "Ftnscan", url: "https://www.ftnscan.com" } } }), _t = "1.21.3", Qt = () => `viem@${_t}`; class m extends Error { constructor(t, n = {}) { var o; super(), 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, "name", { enumerable: !0, configurable: !0, writable: !0, value: "ViemError" }), Object.defineProperty(this, "version", { enumerable: !0, configurable: !0, writable: !0, value: Qt() }); const r = n.cause instanceof m ? n.cause.details : (o = n.cause) != null && o.message ? n.cause.message : n.details, a = n.cause instanceof m && n.cause.docsPath || n.docsPath; this.message = [ t || "An error occurred.", "", ...n.metaMessages ? [...n.metaMessages, ""] : [], ...a ? [ `Docs: https://viem.sh${a}.html${n.docsSlug ? `#${n.docsSlug}` : ""}` ] : [], ...r ? [`Details: ${r}`] : [], `Version: ${this.version}` ].join(` `), n.cause && (this.cause = n.cause), this.details = r, this.docsPath = a, this.metaMessages = n.metaMessages, this.shortMessage = t; } walk(t) { return $e(this, t); } } function $e(e, t) { return t != null && t(e) ? e : e && typeof e == "object" && "cause" in e ? $e(e.cause, t) : t ? null : e; } class Yt extends m { constructor({ max: t, min: n, signed: r, size: a, value: o }) { super(`Number "${o}" is not in safe ${a ? `${a * 8}-bit ${r ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${n} to ${t})` : `(above ${n})`}`), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "IntegerOutOfRangeError" }); } } class Jt extends m { constructor(t) { super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "InvalidHexBooleanError" }); } } class en extends m { constructor({ givenSize: t, maxSize: n }) { super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "SizeOverflowError" }); } } function te(e, { strict: t = !0 } = {}) { return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x"); } function B(e) { return te(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length; } function C(e, { dir: t = "left" } = {}) { let n = typeof e == "string" ? e.replace("0x", "") : e, r = 0; for (let a = 0; a < n.length - 1 && n[t === "left" ? a : n.length - a - 1].toString() === "0"; a++) r++; return n = t === "left" ? n.slice(r) : n.slice(0, n.length - r), typeof e == "string" ? (n.length === 1 && t === "right" && (n = `${n}0`), `0x${n.length % 2 === 1 ? `0${n}` : n}`) : n; } class Oe extends m { constructor({ offset: t, position: n, size: r }) { super(`Slice ${n === "start" ? "starting" : "ending"} at offset "${t}" is out-of-bounds (size: ${r}).`), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "SliceOffsetOutOfBoundsError" }); } } class He extends m { constructor({ size: t, targetSize: n, type: r }) { super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "SizeExceedsPaddingSizeError" }); } } function V(e, { dir: t, size: n = 32 } = {}) { return typeof e == "string" ? tn(e, { dir: t, size: n }) : nn(e, { dir: t, size: n }); } function tn(e, { dir: t, size: n = 32 } = {}) { if (n === null) return e; const r = e.replace("0x", ""); if (r.length > n * 2) throw new He({ size: Math.ceil(r.length / 2), targetSize: n, type: "hex" }); return `0x${r[t === "right" ? "padEnd" : "padStart"](n * 2, "0")}`; } function nn(e, { dir: t, size: n = 32 } = {}) { if (n === null) return e; if (e.length > n) throw new He({ size: e.length, targetSize: n, type: "bytes" }); const r = new Uint8Array(n); for (let a = 0; a < n; a++) { const o = t === "right"; r[o ? a : n - a - 1] = e[o ? a : e.length - a - 1]; } return r; } const rn = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0")); function p(e, t = {}) { return typeof e == "number" || typeof e == "bigint" ? $(e, t) : typeof e == "string" ? on(e, t) : typeof e == "boolean" ? an(e, t) : me(e, t); } function an(e, t = {}) { const n = `0x${Number(e)}`; return typeof t.size == "number" ? (G(n, { size: t.size }), V(n, { size: t.size })) : n; } function me(e, t = {}) { let n = ""; for (let a = 0; a < e.length; a++) n += rn[e[a]]; const r = `0x${n}`; return typeof t.size == "number" ? (G(r, { size: t.size }), V(r, { dir: "right", size: t.size })) : r; } function $(e, t = {}) { const { signed: n, size: r } = t, a = BigInt(e); let o; r ? n ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof e == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER)); const i = typeof o == "bigint" && n ? -o - 1n : 0; if (o && a > o || a < i) { const l = typeof e == "bigint" ? "n" : ""; throw new Yt({ max: o ? `${o}${l}` : void 0, min: `${i}${l}`, signed: n, size: r, value: `${e}${l}` }); } const c = `0x${(n && a < 0 ? (1n << BigInt(r * 8)) + BigInt(a) : a).toString(16)}`; return r ? V(c, { size: r }) : c; } const sn = /* @__PURE__ */ new TextEncoder(); function on(e, t = {}) { const n = sn.encode(e); return me(n, t); } const cn = /* @__PURE__ */ new TextEncoder(); function Ge(e, t = {}) { return typeof e == "number" || typeof e == "bigint" ? pn(e, t) : typeof e == "boolean" ? ln(e, t) : te(e) ? _(e, t) : je(e, t); } function ln(e, t = {}) { const n = new Uint8Array(1); return n[0] = Number(e), typeof t.size == "number" ? (G(n, { size: t.size }), V(n, { size: t.size })) : n; } const L = { zero: 48, nine: 57, A: 65, F: 70, a: 97, f: 102 }; function Ce(e) { if (e >= L.zero && e <= L.nine) return e - L.zero; if (e >= L.A && e <= L.F) return e - (L.A - 10); if (e >= L.a && e <= L.f) return e - (L.a - 10); } function _(e, t = {}) { let n = e; t.size && (G(n, { size: t.size }), n = V(n, { dir: "right", size: t.size })); let r = n.slice(2); r.length % 2 && (r = `0${r}`); const a = r.length / 2, o = new Uint8Array(a); for (let i = 0, c = 0; i < a; i++) { const l = Ce(r.charCodeAt(c++)), u = Ce(r.charCodeAt(c++)); if (l === void 0 || u === void 0) throw new m(`Invalid byte sequence ("${r[c - 2]}${r[c - 1]}" in "${r}").`); o[i] = l * 16 + u; } return o; } function pn(e, t) { const n = $(e, t); return _(n); } function je(e, t = {}) { const n = cn.encode(e); return typeof t.size == "number" ? (G(n, { size: t.size }), V(n, { dir: "right", size: t.size })) : n; } function G(e, { size: t }) { if (B(e) > t) throw new en({ givenSize: B(e), maxSize: t }); } function k(e, t = {}) { const { signed: n } = t; t.size && G(e, { size: t.size }); const r = BigInt(e); if (!n) return r; const a = (e.length - 2) / 2, o = (1n << BigInt(a) * 8n - 1n) - 1n; return r <= o ? r : r - BigInt(`0x${"f".padStart(a * 2, "f")}`) - 1n; } function un(e, t = {}) { let n = e; if (t.size && (G(n, { size: t.size }), n = C(n)), C(n) === "0x00") return !1; if (C(n) === "0x01") return !0; throw new Jt(n); } function T(e, t = {}) { return Number(k(e, t)); } function mn(e, t = {}) { let n = _(e); return t.size && (G(n, { size: t.size }), n = C(n, { dir: "right" })), new TextDecoder().decode(n); } function ne(e, t) { return ({ exclude: n, format: r }) => ({ exclude: n, format: (a) => { const o = t(a); if (n) for (const i of n) delete o[i]; return { ...o, ...r(a) }; }, type: e }); } const De = { "0x0": "legacy", "0x1": "eip2930", "0x2": "eip1559" }; function re(e) { const t = { ...e, blockHash: e.blockHash ? e.blockHash : null, blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null, chainId: e.chainId ? T(e.chainId) : void 0, gas: e.gas ? BigInt(e.gas) : void 0, gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0, maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0, maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0, nonce: e.nonce ? T(e.nonce) : void 0, to: e.to ? e.to : null, transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null, type: e.type ? De[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 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.maxFeePerGas, delete t.maxPriorityFeePerGas, delete t.yParity), t.type === "eip2930" && (delete t.maxFeePerGas, delete t.maxPriorityFeePerGas), t; } const de = /* @__PURE__ */ ne("transaction", re); function dn(e) { var n; const t = (n = e.transactions) == null ? void 0 : n.map((r) => typeof r == "string" ? r : re(r)); return { ...e, baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null, difficulty: e.difficulty ? BigInt(e.difficulty) : 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 he = /* @__PURE__ */ ne("block", dn); function Ke(e, { args: t, eventName: n } = {}) { 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, ...n ? { args: t, eventName: n } : {} }; } const hn = { "0x0": "reverted", "0x1": "success" }; function bn(e) { return { ...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((t) => Ke(t)) : null, to: e.to ? e.to : null, transactionIndex: e.transactionIndex ? T(e.transactionIndex) : null, status: e.status ? hn[e.status] : null, type: e.type ? De[e.type] || e.type : null }; } const Ve = /* @__PURE__ */ ne("transactionReceipt", bn), F = { block: /* @__PURE__ */ he({ format(e) { var n; return { transactions: (n = e.transactions) == null ? void 0 : n.map((r) => { if (typeof r == "string") return r; const a = re(r); return a.typeHex === "0x7e" && (a.isSystemTx = r.isSystemTx, a.mint = r.mint ? k(r.mint) : void 0, a.sourceHash = r.sourceHash, a.type = "deposit"), a; }), stateRoot: e.stateRoot }; } }), transaction: /* @__PURE__ */ de({ format(e) { const t = {}; return e.type === "0x7e" && (t.isSystemTx = e.isSystemTx, t.mint = e.mint ? k(e.mint) : void 0, t.sourceHash = e.sourceHash, t.type = "deposit"), t; } }), transactionReceipt: /* @__PURE__ */ Ve({ format(e) { return { l1GasPrice: e.l1GasPrice ? k(e.l1GasPrice) : null, l1GasUsed: e.l1GasUsed ? k(e.l1GasUsed) : null, l1Fee: e.l1Fee ? k(e.l1Fee) : null, l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null }; } }) }, fn = /* @__PURE__ */ s({ id: 8453, network: "base", name: "Base", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { alchemy: { http: ["https://base-mainnet.g.alchemy.com/v2"], webSocket: ["wss://base-mainnet.g.alchemy.com/v2"] }, infura: { http: ["https://base-mainnet.infura.io/v3"], webSocket: ["wss://base-mainnet.infura.io/ws/v3"] }, default: { http: ["https://mainnet.base.org"] }, public: { http: ["https://mainnet.base.org"] } }, blockExplorers: { blockscout: { name: "Basescout", url: "https://base.blockscout.com" }, default: { name: "Basescan", url: "https://basescan.org" }, etherscan: { name: "Basescan", url: "https://basescan.org" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 5022 } } }, { formatters: F }), yn = /* @__PURE__ */ s({ id: 84531, network: "base-goerli", name: "Base Goerli", nativeCurrency: { name: "Goerli Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { alchemy: { http: ["https://base-goerli.g.alchemy.com/v2"], webSocket: ["wss://base-goerli.g.alchemy.com/v2"] }, default: { http: ["https://goerli.base.org"] }, public: { http: ["https://goerli.base.org"] } }, blockExplorers: { etherscan: { name: "Basescan", url: "https://goerli.basescan.org" }, default: { name: "Basescan", url: "https://goerli.basescan.org" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 1376988 } }, testnet: !0, sourceId: 5 // goerli }, { formatters: F }), kn = /* @__PURE__ */ s({ id: 84532, network: "base-sepolia", name: "Base Sepolia", nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 }, rpcUrls: { alchemy: { http: ["https://base-sepolia.g.alchemy.com/v2"], webSocket: ["wss://base-sepolia.g.alchemy.com/v2"] }, default: { http: ["https://sepolia.base.org"] }, public: { http: ["https://sepolia.base.org"] } }, blockExplorers: { blockscout: { name: "Blockscout", url: "https://base-sepolia.blockscout.com" }, default: { name: "Blockscout", url: "https://base-sepolia.blockscout.com" } }, testnet: !0, sourceId: 11155111 // sepolia }, { formatters: F }), wn = /* @__PURE__ */ s({ id: 641230, name: "Bear Network Chain Mainnet", network: "BearNetworkChainMainnet", nativeCurrency: { decimals: 18, name: "BearNetworkChain", symbol: "BRNKC" }, rpcUrls: { public: { http: ["https://brnkc-mainnet.bearnetwork.net"] }, default: { http: ["https://brnkc-mainnet.bearnetwork.net"] } }, blockExplorers: { default: { name: "BrnkScan", url: "https://brnkscan.bearnetwork.net" } } }), xn = /* @__PURE__ */ s({ id: 751230, name: "Bear Network Chain Testnet", network: "BearNetworkChainTestnet", nativeCurrency: { decimals: 18, name: "tBRNKC", symbol: "tBRNKC" }, rpcUrls: { public: { http: ["https://brnkc-test.bearnetwork.net"] }, default: { http: ["https://brnkc-test.bearnetwork.net"] } }, blockExplorers: { default: { name: "BrnkTestScan", url: "https://brnktest-scan.bearnetwork.net" } }, testnet: !0 }), gn = /* @__PURE__ */ s({ id: 199, name: "BitTorrent", network: "bittorrent-chain-mainnet", nativeCurrency: { name: "BitTorrent", symbol: "BTT", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.bittorrentchain.io"] }, public: { http: ["https://rpc.bittorrentchain.io"] } }, blockExplorers: { etherscan: { name: "Bttcscan", url: "https://bttcscan.com" }, default: { name: "Bttcscan", url: "https://bttcscan.com" } } }), vn = /* @__PURE__ */ s({ id: 1028, name: "BitTorrent Chain Testnet", network: "bittorrent-chain-testnet", nativeCurrency: { name: "BitTorrent", symbol: "BTT", decimals: 18 }, rpcUrls: { default: { http: ["https://testrpc.bittorrentchain.io"] }, public: { http: ["https://testrpc.bittorrentchain.io"] } }, blockExplorers: { etherscan: { name: "Bttcscan", url: "https://testnet.bttcscan.com" }, default: { name: "Bttcscan", url: "https://testnet.bttcscan.com" } }, testnet: !0 }), En = /* @__PURE__ */ s({ id: 288, name: "Boba Network", network: "boba", nativeCurrency: { decimals: 18, name: "Boba", symbol: "BOBA" }, rpcUrls: { default: { http: ["https://mainnet.boba.network"] }, public: { http: ["https://mainnet.boba.network"] } }, blockExplorers: { etherscan: { name: "BOBAScan", url: "https://bobascan.com" }, default: { name: "BOBAScan", url: "https://bobascan.com" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 446859 } } }), Cn = /* @__PURE__ */ s({ id: 1039, name: "Bronos", network: "bronos", nativeCurrency: { decimals: 18, name: "BRO", symbol: "BRO" }, rpcUrls: { default: { http: ["https://evm.bronos.org"] }, public: { http: ["https://evm.bronos.org"] } }, blockExplorers: { default: { name: "BronoScan", url: "https://broscan.bronos.org" } } }), Tn = /* @__PURE__ */ s({ id: 1038, name: "Bronos Testnet", network: "bronos-testnet", nativeCurrency: { decimals: 18, name: "Bronos Coin", symbol: "tBRO" }, rpcUrls: { default: { http: ["https://evm-testnet.bronos.org"] }, public: { http: ["https://evm-testnet.bronos.org"] } }, blockExplorers: { default: { name: "BronoScan", url: "https://tbroscan.bronos.org" } }, testnet: !0 }), Sn = /* @__PURE__ */ s({ id: 56, name: "BNB Smart Chain", network: "bsc", nativeCurrency: { decimals: 18, name: "BNB", symbol: "BNB" }, rpcUrls: { default: { http: ["https://rpc.ankr.com/bsc"] }, public: { http: ["https://rpc.ankr.com/bsc"] } }, blockExplorers: { etherscan: { name: "BscScan", url: "https://bscscan.com" }, default: { name: "BscScan", url: "https://bscscan.com" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 15921452 } } }), An = /* @__PURE__ */ s({ id: 97, name: "Binance Smart Chain Testnet", network: "bsc-testnet", nativeCurrency: { decimals: 18, name: "BNB", symbol: "tBNB" }, rpcUrls: { default: { http: ["https://data-seed-prebsc-1-s1.bnbchain.org:8545"] }, public: { http: ["https://data-seed-prebsc-1-s1.bnbchain.org:8545"] } }, blockExplorers: { etherscan: { name: "BscScan", url: "https://testnet.bscscan.com" }, default: { name: "BscScan", url: "https://testnet.bscscan.com" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 17422483 } }, testnet: !0 }), Un = /* @__PURE__ */ s({ id: 4999, name: "BlackFort Exchange Network", network: "bxn", nativeCurrency: { name: "BlackFort Token", symbol: "BXN", decimals: 18 }, rpcUrls: { default: { http: ["https://mainnet.blackfort.network/rpc"] }, public: { http: ["https://mainnet.blackfort.network/rpc"] } }, blockExplorers: { default: { name: "Blockscout", url: "https://explorer.blackfort.network" } } }), Pn = /* @__PURE__ */ s({ id: 4777, name: "BlackFort Exchange Network Testnet", network: "bxnTestnet", nativeCurrency: { name: "BlackFort Testnet Token", symbol: "TBXN", decimals: 18 }, rpcUrls: { default: { http: ["https://testnet.blackfort.network/rpc"] }, public: { http: ["https://testnet.blackfort.network/rpc"] } }, blockExplorers: { default: { name: "Blockscout", url: "https://testnet-explorer.blackfort.network" } } }), Bn = /* @__PURE__ */ s({ id: 7700, name: "Canto", network: "canto", nativeCurrency: { decimals: 18, name: "Canto", symbol: "CANTO" }, rpcUrls: { default: { http: ["https://canto.gravitychain.io"] }, public: { http: ["https://canto.gravitychain.io"] } }, blockExplorers: { default: { name: "Tuber.Build (Blockscout)", url: "https://tuber.build" } }, contracts: { multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 2905789 } } }), zn = { legacy: "0x0", eip2930: "0x1", eip1559: "0x2" }; function Fn(e) { return { ...e, gas: typeof e.gas < "u" ? $(e.gas) : void 0, gasPrice: typeof e.gasPrice < "u" ? $(e.gasPrice) : void 0, maxFeePerGas: typeof e.maxFeePerGas < "u" ? $(e.maxFeePerGas) : void 0, maxPriorityFeePerGas: typeof e.maxPriorityFeePerGas < "u" ? $(e.maxPriorityFeePerGas) : void 0, nonce: typeof e.nonce < "u" ? $(e.nonce) : void 0, type: typeof e.type < "u" ? zn[e.type] : void 0, value: typeof e.value < "u" ? $(e.value) : void 0 }; } const Re = /* @__PURE__ */ ne("transactionRequest", Fn); function H(e) { return e === 0 || e === 0n || e === void 0 || e === null || e === "0" || e === "" || typeof e == "string" && (C(e).toLowerCase() === "0x" || C(e).toLowerCase() === "0x00"); } function v(e) { return !H(e); } function qe(e) { return v(e.maxFeePerGas) && v(e.maxPriorityFeePerGas); } function Xe(e) { return e.type === "cip42" ? !0 : qe(e) && (v(e.feeCurrency) || v(e.gatewayFeeRecipient) || v(e.gatewayFee)); } function Ze(e) { return e.type === "cip64" ? !0 : qe(e) && v(e.feeCurrency) && H(e.gatewayFee) && H(e.gatewayFeeRecipient); } const be = { block: /* @__PURE__ */ he({ exclude: ["difficulty", "gasLimit", "mixHash", "nonce", "uncles"], format(e) { var n; const t = (n = e.transactions) == null ? void 0 : n.map((r) => typeof r == "string" ? r : { ...re(r), feeCurrency: r.feeCurrency, ...r.type !== "0x7b" ? { gatewayFee: r.gatewayFee ? k(r.gatewayFee) : null, gatewayFeeRecipient: r.gatewayFeeRecipient || null } : {} }); return { randomness: e.randomness, transactions: t }; } }), transaction: /* @__PURE__ */ de({ format(e) { const t = { feeCurrency: e.feeCurrency }; return e.type === "0x7b" ? t.type = "cip64" : (e.type === "0x7c" && (t.type = "cip42"), t.gatewayFee = e.gatewayFee ? k(e.gatewayFee) : null, t.gatewayFeeRecipient = e.gatewayFeeRecipient), t; } }), transactionRequest: /* @__PURE__ */ Re({ format(e) { const t = { feeCurrency: e.feeCurrency }; return Ze(e) ? t.type = "0x7b" : (Xe(e) && (t.type = "0x7c"), t.gatewayFee = typeof e.gatewayFee < "u" ? $(e.gatewayFee) : void 0, t.gatewayFeeRecipient = e.gatewayFeeRecipient), t; } }) }; class M extends m { constructor({ address: t }) { super(`Address "${t}" is invalid.`), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "InvalidAddressError" }); } } class R extends m { constructor({ chainId: t }) { super(`Chain ID "${t}" is invalid.`), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "InvalidChainIdError" }); } } const In = { ether: -9, wei: 9 }; function Mn(e, t) { let n = e.toString(); const r = n.startsWith("-"); r && (n = n.slice(1)), n = n.padStart(t, "0"); let [a, o] = [ n.slice(0, n.length - t), n.slice(n.length - t) ]; return o = o.replace(/(0+)$/, ""), `${r ? "-" : ""}${a || "0"}${o ? `.${o}` : ""}`; } function le(e, t = "wei") { return Mn(e, In[t]); } class q extends m { constructor({ cause: t, maxFeePerGas: n } = {}) { super(`The fee cap (\`maxFeePerGas\`${n ? ` = ${le(n)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, { cause: t }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "FeeCapTooHigh" }); } } Object.defineProperty(q, "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 ae extends m { constructor({ cause: t, maxPriorityFeePerGas: n, maxFeePerGas: r } = {}) { super([ `The provided tip (\`maxPriorityFeePerGas\`${n ? ` = ${le(n)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r ? ` = ${le(r)} gwei` : ""}).` ].join(` `), { cause: t }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "TipAboveFeeCapError" }); } } Object.defineProperty(ae, "nodeMessage", { enumerable: !0, configurable: !0, writable: !0, value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ }); const Ln = /^0x[a-fA-F0-9]{40}$/; function A(e) { return Ln.test(e); } function Q(e) { return `0x${e.reduce((t, n) => t + n.replace("0x", ""), "")}`; } function Nn(e, t) { const n = e.exec(t); return n == null ? void 0 : n.groups; } const Te = /^tuple(?<array>(\[(\d*)\])*)$/; function pe(e) { let t = e.type; if (Te.test(e.type) && "components" in e) { t = "("; const n = e.components.length; for (let a = 0; a < n; a++) { const o = e.components[a]; t += pe(o), a < n - 1 && (t += ", "); } const r = Nn(Te, e.type); return t += `)${(r == null ? void 0 : r.array) ?? ""}`, pe({ ...e, type: t }); } return "indexed" in e && e.indexed && (t = `${t} indexed`), e.name ? `${t} ${e.name}` : t; } function Z(e) { let t = ""; const n = e.length; for (let r = 0; r < n; r++) { const a = e[r]; t += pe(a), r !== n - 1 && (t += ", "); } return t; } function $n(e) { return e.type === "function" ? `function ${e.name}(${Z(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${e.outputs.length ? ` returns (${Z(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${Z(e.inputs)})` : e.type === "error" ? `error ${e.name}(${Z(e.inputs)})` : e.type === "constructor" ? `constructor(${Z(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? "fallback()" : "receive() external payable"; } function We(e, { includeName: t = !1 } = {}) { if (e.type !== "function" && e.type !== "event" && e.type !== "error") throw new Vn(e.type); return `${e.name}(${se(e.inputs, { includeName: t })})`; } function se(e, { includeName: t = !1 } = {}) { return e ? e.map((n) => On(n, { includeName: t })).join(t ? ", " : ",") : ""; } function On(e, { includeName: t }) { return e.type.startsWith("tuple") ? `(${se(e.components, { includeName: t })})${e.type.slice(5)}` : e.type + (t && e.name ? ` ${e.name}` : ""); } class fe extends m { constructor({ data: t, params: n, size: r }) { super([`Data size of ${r} bytes is too small for given parameters.`].join(` `), { metaMessages: [ `Params: (${se(n, { includeName: !0 })})`, `Data: ${t} (${r} bytes)` ] }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "AbiDecodingDataSizeTooSmallError" }), Object.defineProperty(this, "data", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "params", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "size", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), this.data = t, this.params = n, this.size = r; } } class Hn extends m { constructor() { super('Cannot decode zero data ("0x") with ABI parameters.'), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "AbiDecodingZeroDataError" }); } } class Gn extends m { constructor({ docsPath: t }) { super("Cannot extract event signature from empty topics.", { docsPath: t }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "AbiEventSignatureEmptyTopicsError" }); } } class jn extends m { constructor(t, { docsPath: n }) { super([ `Encoded event signature "${t}" not found on ABI.`, "Make sure you are using the correct ABI and that the event exists on it.", `You can look up the signature here: https://openchain.xyz/signatures?query=${t}.` ].join(` `), { docsPath: n }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "AbiEventSignatureNotFoundError" }); } } class Se extends m { constructor({ abiItem: t, data: n, params: r, size: a }) { super([ `Data size of ${a} bytes is too small for non-indexed event parameters.` ].join(` `), { metaMessages: [ `Params: (${se(r, { includeName: !0 })})`, `Data: ${n} (${a} bytes)` ] }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "DecodeLogDataMismatch" }), Object.defineProperty(this, "abiItem", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "data", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "params", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), Object.defineProperty(this, "size", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), this.abiItem = t, this.data = n, this.params = r, this.size = a; } } class Dn extends m { constructor({ abiItem: t, param: n }) { super([ `Expected a topic for indexed event parameter${n.name ? ` "${n.name}"` : ""} on event "${We(t, { includeName: !0 })}".` ].join(` `)), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "DecodeLogTopicsMismatch" }), Object.defineProperty(this, "abiItem", { enumerable: !0, configurable: !0, writable: !0, value: void 0 }), this.abiItem = t; } } class Kn extends m { constructor(t, { docsPath: n }) { super([ `Type "${t}" is not a valid decoding type.`, "Please provide a valid ABI type." ].join(` `), { docsPath: n }), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "InvalidAbiDecodingType" }); } } class Vn extends m { constructor(t) { super([ `"${t}" is not a valid definition type.`, 'Valid types: "function", "event", "error"' ].join(` `)), Object.defineProperty(this, "name", { enumerable: !0, configurable: !0, writable: !0, value: "InvalidDefinitionTypeError" }); } } function Rn(e) { let t = !0, n = "", r = 0, a = "", o = !1; for (let i = 0; i < e.length; i++) { const c = e[i]; if (["(", ")", ","].includes(c) && (t = !0), c === "(" && r++, c === ")" && r--, !!t) { if (r === 0) { if (c === " " && ["event", "function", ""].includes(a)) a = ""; else if (a += c, c === ")") { o = !0; break; } continue; } if (c === " ") { e[i - 1] !== "," && n !== "," && n !== ",(" && (n = "", t = !1); continue; } a += c, n += c; } } if (!o) throw new m("Unable to normalize signature."); return a; } const qn = (e) => { const t = (() => typeof e == "string" ? e : $n(e))(); return Rn(t); }, Xn = (e) => qn(e); function Ae(e) { if (!Number.isSafeInteger(e) || e < 0) throw new Error(`Wrong positive integer: ${e}`); } function _e(e, ...t) { if (!(e instanceof Uint8Array)) throw new Error("Expected Uint8Array"); if (t.length > 0 && !t.includes(e.length)) throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`); } function Ue(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 Zn(e, t) { _e(e); const n = t.outputLen; if (e.length < n) throw new Error(`digestInto() expects output buffer of length at least ${n}`); } const J = /* @__PURE__ */ BigInt(2 ** 32 - 1), Pe = /* @__PURE__ */ BigInt(32); function Wn(e, t = !1) { return t ? { h: Number(e & J), l: Number(e >> Pe & J) } : { h: Number(e >> Pe & J) | 0, l: Number(e & J) | 0 }; } function _n(e, t = !1) { let n = new Uint32Array(e.length), r = new Uint32Array(e.length); for (let a = 0; a < e.length; a++) { const { h: o, l: i } = Wn(e[a], t); [n[a], r[a]] = [o, i]; } return [n, r]; } const Qn = (e, t, n) => e << n | t >>> 32 - n, Yn = (e, t, n) => t << n | e >>> 32 - n, Jn = (e, t, n) => t << n - 32 | e >>> 64 - n, er = (e, t, n) => e << n - 32 | t >>> 64 - n; /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const tr = (e) => e instanceof Uint8Array, nr = (e) => new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4)), rr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; if (!rr) throw new Error("Non little-endian hardware is not supported"); function ar(e) { if (typeof e != "string") throw new Error(`utf8ToBytes expected string, got ${typeof e}`); return new Uint8Array(new TextEncoder().encode(e)); } function Qe(e) { if (typeof e == "string" && (e = ar(e)), !tr(e)) throw new Error(`expected Uint8Array, got ${typeof e}`); return e; } class sr { // Safe version that clones internal state clone() { return this._cloneInto(); } } function or(e) { const t = (r) => e().update(Qe(r)).digest(), n = e(); return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t; } const [Ye, Je, et] = [[], [], []], ir = /* @__PURE__ */ BigInt(0), W = /* @__PURE__ */ BigInt(1), cr = /* @__PURE__ */ BigInt(2), lr = /* @__PURE__ */ BigInt(7), pr = /* @__PURE__ */ BigInt(256), ur = /* @__PURE__ */ BigInt(113); for (let e = 0, t = W, n = 1, r = 0; e < 24; e++) { [n, r] = [r, (2 * n + 3 * r) % 5], Ye.push(2 * (5 * r + n)), Je.push((e + 1) * (e + 2) / 2 % 64); let a = ir; for (let o = 0; o < 7; o++) t = (t << W ^ (t >> lr) * ur) % pr, t & cr && (a ^= W << (W << /* @__PURE__ */ BigInt(o)) - W); et.push(a); } const [mr, dr] = /* @__PURE__ */ _n(et, !0), Be = (e, t, n) => n > 32 ? Jn(e, t, n) : Qn(e, t, n), ze = (e, t, n) => n > 32 ? er(e, t, n) : Yn(e, t, n); function hr(e, t = 24) { const n = new Uint32Array(10); for (let r = 24 - t; r < 24; r++) { for (let i = 0; i < 10; i++) n[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40]; for (let i = 0; i < 10; i += 2) { const c = (i + 8) % 10, l = (i + 2) % 10, u = n[l], h = n[l + 1], f = Be(u, h, 1) ^ n[c], y = ze(u, h, 1) ^ n[c + 1]; for (let w = 0; w < 50; w += 10) e[i + w] ^= f, e[i + w + 1] ^= y; } let a = e[2], o = e[3]; for (let i = 0; i < 24; i++) { const c = Je[i], l = Be(a, o, c), u = ze(a, o, c), h = Ye[i]; a = e[h], o = e[h + 1], e[h] = l, e[h + 1] = u; } for (let i = 0; i < 50; i += 10) { for (let c = 0; c < 10; c++) n[c] = e[i + c]; for (let c = 0; c < 10; c++) e[i + c] ^= ~n[(c + 2) % 10] & n[(c + 4) % 10]; } e[0] ^= mr[r], e[1] ^= dr[r]; } n.fill(0); } class ye extends sr { // NOTE: we accept arguments in bytes instead of bits here. constructor(t, n, r, a = !1, o = 24) { if (super(), this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = a, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, Ae(r), 0 >= this.blockLen || this.blockLen >= 200) throw new Error("Sha3 supports only keccak-f1600 function"); this.state = new Uint8Array(200), this.state32 = nr(this.state); } keccak() { hr(this.state32, this.rounds), this.posOut = 0, this.pos = 0; } update(t) { Ue(this); const { blockLen: n, state: r } = this; t = Qe(t); const a = t.length; for (let o = 0; o < a; ) { const i = Math.min(n - this.pos, a - o); for (let c = 0; c < i; c++) r[this.pos++] ^= t[o++]; this.pos === n && this.keccak(); } return this; } finish() { if (this.finished) return; this.finished = !0; const { state: t, suffix: n, pos: r, blockLen: a } = this; t[r] ^= n, n & 128 && r === a - 1 && this.keccak(), t[a - 1] ^= 128, this.keccak(); } writeInto(t) { Ue(this, !1), _e(t), this.finish(); const n = this.state, { blockLen: r } = this; for (let a = 0, o = t.length; a < o; ) { this.posOut >= r && this.keccak(); const i = Math.min(r - this.posOut, o - a); t.set(n.subarray(this.posOut, this.posOut + i), a), this.posOut += i, a += i; } return t; } xofInto(t) { if (!this.enableXOF) throw new Error("XOF is not possible for this instance"); return this.writeInto(t); } xof(t) { return Ae(t), this.xofInto(new Uint8Array(t)); } digestInto(t) { if (Zn(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: n, suffix: r, outputLen: a, rounds: o, enableXOF: i } = this; return t || (t = new ye(n, r, a, i, o)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = o, t.suffix = r, t.outputLen = a, t.enableXOF = i, t.destroyed = this.destroyed, t; } } const br = (e, t, n) => or(() => new ye(t, e, n)), fr = /* @__PURE__ */ br(1, 136, 256 / 8); function tt(e, t) { const n = t || "hex", r = fr(te(e, { strict: !1 }) ? Ge(e) : e); return n === "bytes" ? r : p(r); } const yr = (e) => tt(Ge(e)), kr = (e) => yr(Xn(e)); function E(e, t, n, { strict: r } = {}) { return te(e, { strict: !1 }) ? xr(e, t, n, { strict: r }) : wr(e, t, n, { strict: r }); } function nt(e, t) { if (typeof t == "number" && t > 0 && t > B(e) - 1) throw new Oe({ offset: t, position: "start", size: B(e) }); } function rt(e, t, n) { if (typeof t == "number" && typeof n == "number" && B(e) !== n - t) throw new Oe({ offset: n, position: "end", size: B(e) }); } function wr(e, t, n, { strict: r } = {}) { nt(e, t); const a = e.slice(t, n); return r && rt(a, t, n), a; } function xr(e, t, n, { strict: r } = {}) { nt(e, t); const a = `0x${e.replace("0x", "").slice((t ?? 0) * 2, (n ?? e.length)