UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

2 lines 1.64 kB
var h=Object.defineProperty,w=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var d=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var S=(t,s,e)=>s in t?h(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,g=(t,s)=>{for(var e in s||(s={}))d.call(s,e)&&S(t,e,s[e]);if(a)for(var e of a(s))l.call(s,e)&&S(t,e,s[e]);return t},y=(t,s)=>w(t,O(s));var m=(t,s)=>{var e={};for(var r in t)d.call(t,r)&&s.indexOf(r)<0&&(e[r]=t[r]);if(t!=null&&a)for(var r of a(t))s.indexOf(r)<0&&l.call(t,r)&&(e[r]=t[r]);return e};var p="ray_tab_hash",f="ray_req_hash",b=()=>{if(typeof window===void 0)return"";let t=sessionStorage.getItem(p);return t||(t=`ray-${Date.now()}`,sessionStorage.setItem(p,t)),t},N=async r=>{var u=r,{logCount:t=1e3,removeLastLog:s}=u,e=m(u,["logCount","removeLastLog"]);if(typeof window===void 0)return new Promise(i=>i());let n=JSON.parse(localStorage.getItem(f)||"[]").slice(0,t-1);s&&n.pop(),new Blob([JSON.stringify(e.data)]).size>1024&&(e.data=JSON.stringify(e.data).substring(0,200)+"..."),n.unshift(y(g({},e),{time:Date.now(),session:b()}));try{localStorage.setItem(f,JSON.stringify(n))}catch{if(s){let i=!1,c=JSON.stringify(e.data).substring(0,100);for(n[0].data=c+(c.length>100?"...":"");!i;){n.pop();let o=JSON.stringify(e.data).substring(0,100);n[0].data=o+(o.length>100?"...":"");try{localStorage.setItem(f,JSON.stringify(n)),i=!0}catch{i=!1}}return new Promise(o=>o())}return N(y(g({},e),{logCount:t,removeLastLog:!0}))}};export{p as SESSION_KEY,f as STORAGE_KEY,b as getSessionKey,N as updateReqHistory}; //# sourceMappingURL=utils.mjs.map