UNPKG

based-auth

Version:

A Next.js/Node.js authentication and wallet API kit for Ethereum and Solana, with utilities for serialization and contract interaction, designed for serverless and API route usage.

25 lines (24 loc) 1.18 kB
import { BN as s } from "@coral-xyz/anchor"; import { PublicKey as o } from "@solana/web3.js"; import { N as _ } from "./index-ChpwqF0V.mjs"; function y(r, t) { var i; if (Array.isArray(r)) return r.map((n) => y(n, t)); if (typeof r == "object" && !((i = t(r)) != null && i.__type) && !(r != null && r.__type)) { const n = {}; for (const f in r) r.hasOwnProperty(f) && (n[f] = y(r[f], t)); return n; } return t(r); } const m = (r, t) => { const i = r === _.sol ? "BN" : "bigint"; return y(t, (n) => n instanceof o ? { __type: "SolanaPublicKey", value: n.toBase58() } : n instanceof Uint8Array ? { __type: "Uint8Array", value: n.toString() } : n instanceof s ? { __type: i, value: n.toString() } : typeof n == "bigint" ? { __type: i, value: n.toString() } : n); }, g = (r) => y(r, (t) => (t == null ? void 0 : t.__type) === "bigint" ? BigInt(t.value) : (t == null ? void 0 : t.__type) === "BN" ? new s(t.value) : (t == null ? void 0 : t.__type) === "SolanaPublicKey" ? new o(t.value) : (t == null ? void 0 : t.__type) === "Uint8Array" ? new Uint8Array(t.value) : t); export { g as d, m as s }; //# sourceMappingURL=serialize-QLwKYaJT.mjs.map