@raydium-io/raydium-sdk-v2
Version:
An SDK for building applications on top of Raydium.
2 lines • 2.08 kB
JavaScript
var y=Object.defineProperty,b=Object.defineProperties,N=Object.getOwnPropertyDescriptor,J=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var m=(t,e,s)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,c=(t,e)=>{for(var s in e||(e={}))u.call(e,s)&&m(t,s,e[s]);if(g)for(var s of g(e))p.call(e,s)&&m(t,s,e[s]);return t},S=(t,e)=>b(t,J(e));var h=(t,e)=>{var s={};for(var r in t)u.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(t!=null&&g)for(var r of g(t))e.indexOf(r)<0&&p.call(t,r)&&(s[r]=t[r]);return s};var _=(t,e)=>{for(var s in e)y(t,s,{get:e[s],enumerable:!0})},x=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of I(e))!u.call(t,n)&&n!==s&&y(t,n,{get:()=>e[n],enumerable:!(r=N(e,n))||r.enumerable});return t};var R=t=>x(y({},"__esModule",{value:!0}),t);var E={};_(E,{SESSION_KEY:()=>d,STORAGE_KEY:()=>f,getSessionKey:()=>w,updateReqHistory:()=>O});module.exports=R(E);var d="ray_tab_hash",f="ray_req_hash",w=()=>{if(typeof window===void 0)return"";let t=sessionStorage.getItem(d);return t||(t=`ray-${Date.now()}`,sessionStorage.setItem(d,t)),t},O=async r=>{var n=r,{logCount:t=1e3,removeLastLog:e}=n,s=h(n,["logCount","removeLastLog"]);if(typeof window===void 0)return new Promise(o=>o());let i=JSON.parse(localStorage.getItem(f)||"[]").slice(0,t-1);e&&i.pop(),new Blob([JSON.stringify(s.data)]).size>1024&&(s.data=JSON.stringify(s.data).substring(0,200)+"..."),i.unshift(S(c({},s),{time:Date.now(),session:w()}));try{localStorage.setItem(f,JSON.stringify(i))}catch{if(e){let o=!1,l=JSON.stringify(s.data).substring(0,100);for(i[0].data=l+(l.length>100?"...":"");!o;){i.pop();let a=JSON.stringify(s.data).substring(0,100);i[0].data=a+(a.length>100?"...":"");try{localStorage.setItem(f,JSON.stringify(i)),o=!0}catch{o=!1}}return new Promise(a=>a())}return O(S(c({},s),{logCount:t,removeLastLog:!0}))}};0&&(module.exports={SESSION_KEY,STORAGE_KEY,getSessionKey,updateReqHistory});
//# sourceMappingURL=utils.js.map