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.
3 lines (2 loc) • 998 B
JavaScript
;const y=require("@coral-xyz/anchor"),_=require("@solana/web3.js"),f=require("./index-Cws-uUvN.js");function e(r,t){var i;if(Array.isArray(r))return r.map(n=>e(n,t));if(typeof r=="object"&&!((i=t(r))!=null&&i.__type)&&!(r!=null&&r.__type)){const n={};for(const s in r)r.hasOwnProperty(s)&&(n[s]=e(r[s],t));return n}return t(r)}const o=(r,t)=>{const i=r===f.NetworkSymbols.sol?"BN":"bigint";return e(t,n=>n instanceof _.PublicKey?{__type:"SolanaPublicKey",value:n.toBase58()}:n instanceof Uint8Array?{__type:"Uint8Array",value:n.toString()}:n instanceof y.BN?{__type:i,value:n.toString()}:typeof n=="bigint"?{__type:i,value:n.toString()}:n)},c=r=>e(r,t=>(t==null?void 0:t.__type)==="bigint"?BigInt(t.value):(t==null?void 0:t.__type)==="BN"?new y.BN(t.value):(t==null?void 0:t.__type)==="SolanaPublicKey"?new _.PublicKey(t.value):(t==null?void 0:t.__type)==="Uint8Array"?new Uint8Array(t.value):t);exports.deserialize=c;exports.serialize=o;
//# sourceMappingURL=serialize-hzIq3W0C.js.map