@toruslabs/http-helpers
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -396,3 +396,2 @@ /******/ (() => { // webpackBootstrap | ||
/******/ })() | ||
; | ||
//# sourceMappingURL=httpHelpers.cjs.js.map | ||
; |
@@ -312,2 +312,1 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2'; | ||
export { clearAPIKey, clearEmbedHost, enableSentryTracing, gatewayAuthHeader, gatewayEmbedHostHeader, generateJsonRPCObject, get, getAPIKey, getEmbedHost, patch, post, promiseRace, promiseTimeout, put, remove, setAPIKey, setEmbedHost, setLogLevel }; | ||
//# sourceMappingURL=httpHelpers.esm.js.map |
@@ -1,2 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HttpHelpers=e():t.HttpHelpers=e()}(self,(()=>(()=>{var t={378:(t,e,n)=>{t=n.nmd(t);var o="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",c="[object AsyncFunction]",a="[object Function]",u="[object GeneratorFunction]",s="[object Null]",l="[object Object]",f="[object Proxy]",p="[object Undefined]",d=/^\[object .+?Constructor\]$/,h=/^(?:0|[1-9]\d*)$/,y={};y["[object Float32Array]"]=y["[object Float64Array]"]=y["[object Int8Array]"]=y["[object Int16Array]"]=y["[object Int32Array]"]=y["[object Uint8Array]"]=y["[object Uint8ClampedArray]"]=y["[object Uint16Array]"]=y["[object Uint32Array]"]=!0,y[i]=y["[object Array]"]=y["[object ArrayBuffer]"]=y["[object Boolean]"]=y["[object DataView]"]=y["[object Date]"]=y["[object Error]"]=y[a]=y["[object Map]"]=y["[object Number]"]=y[l]=y["[object RegExp]"]=y["[object Set]"]=y["[object String]"]=y["[object WeakMap]"]=!1;var v,g,b,_="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,w="object"==typeof self&&self&&self.Object===Object&&self,m=_||w||Function("return this")(),j=e&&!e.nodeType&&e,O=j&&t&&!t.nodeType&&t,T=O&&O.exports===j,A=T&&_.process,S=function(){try{return O&&O.require&&O.require("util").types||A&&A.binding&&A.binding("util")}catch(t){}}(),P=S&&S.isTypedArray,E=Array.prototype,x=Function.prototype,C=Object.prototype,L=m["__core-js_shared__"],I=x.toString,U=C.hasOwnProperty,z=(v=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",R=C.toString,F=I.call(Object),D=RegExp("^"+I.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=T?m.Buffer:void 0,k=m.Symbol,H=m.Uint8Array,$=(N&&N.allocUnsafe,g=Object.getPrototypeOf,b=Object,function(t){return g(b(t))}),K=Object.create,M=C.propertyIsEnumerable,J=E.splice,B=k?k.toStringTag:void 0,q=function(){try{var t=dt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=N?N.isBuffer:void 0,W=Math.max,V=Date.now,Y=dt(m,"Map"),Q=dt(Object,"create"),X=function(){function t(){}return function(e){if(!At(e))return{};if(K)return K(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Z(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function tt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function et(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function nt(t){var e=this.__data__=new tt(t);this.size=e.size}function ot(t,e,n){(void 0!==n&&!bt(t[e],n)||void 0===n&&!(e in t))&&ct(t,e,n)}function rt(t,e,n){var o=t[e];U.call(t,e)&&bt(o,n)&&(void 0!==n||e in t)||ct(t,e,n)}function it(t,e){for(var n=t.length;n--;)if(bt(t[n][0],e))return n;return-1}function ct(t,e,n){"__proto__"==e&&q?q(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}Z.prototype.clear=function(){this.__data__=Q?Q(null):{},this.size=0},Z.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Z.prototype.get=function(t){var e=this.__data__;if(Q){var n=e[t];return n===o?void 0:n}return U.call(e,t)?e[t]:void 0},Z.prototype.has=function(t){var e=this.__data__;return Q?void 0!==e[t]:U.call(e,t)},Z.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Q&&void 0===e?o:e,this},tt.prototype.clear=function(){this.__data__=[],this.size=0},tt.prototype.delete=function(t){var e=this.__data__,n=it(e,t);return!(n<0||(n==e.length-1?e.pop():J.call(e,n,1),--this.size,0))},tt.prototype.get=function(t){var e=this.__data__,n=it(e,t);return n<0?void 0:e[n][1]},tt.prototype.has=function(t){return it(this.__data__,t)>-1},tt.prototype.set=function(t,e){var n=this.__data__,o=it(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this},et.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(Y||tt),string:new Z}},et.prototype.delete=function(t){var e=pt(this,t).delete(t);return this.size-=e?1:0,e},et.prototype.get=function(t){return pt(this,t).get(t)},et.prototype.has=function(t){return pt(this,t).has(t)},et.prototype.set=function(t,e){var n=pt(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this},nt.prototype.clear=function(){this.__data__=new tt,this.size=0},nt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},nt.prototype.get=function(t){return this.__data__.get(t)},nt.prototype.has=function(t){return this.__data__.has(t)},nt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof tt){var o=n.__data__;if(!Y||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new et(o)}return n.set(t,e),this.size=n.size,this};var at=function(t,e,n){for(var o=-1,r=Object(t),i=n(t),c=i.length;c--;){var a=i[++o];if(!1===e(r[a],a,r))break}return t};function ut(t){return null==t?void 0===t?p:s:B&&B in Object(t)?function(t){var e=U.call(t,B),n=t[B];try{t[B]=void 0;var o=!0}catch(t){}var r=R.call(t);return o&&(e?t[B]=n:delete t[B]),r}(t):function(t){return R.call(t)}(t)}function st(t){return St(t)&&ut(t)==i}function lt(t,e,n,o,r){t!==e&&at(e,(function(i,c){if(r||(r=new nt),At(i))!function(t,e,n,o,r,i,c){var a=vt(t,n),u=vt(e,n),s=c.get(u);if(s)ot(t,n,s);else{var f,p,d,h,y,v=i?i(a,u,n+"",t,e,c):void 0,g=void 0===v;if(g){var b=wt(u),_=!b&&jt(u),w=!b&&!_&&Pt(u);v=u,b||_||w?wt(a)?v=a:St(y=a)&&mt(y)?v=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e}(a):_?(g=!1,v=function(t,e){return t.slice()}(u)):w?(g=!1,h=new(d=(f=u).buffer).constructor(d.byteLength),new H(h).set(new H(d)),p=h,v=new f.constructor(p,f.byteOffset,f.length)):v=[]:function(t){if(!St(t)||ut(t)!=l)return!1;var e=$(t);if(null===e)return!0;var n=U.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&I.call(n)==F}(u)||_t(u)?(v=a,_t(a)?v=function(t){return function(t,e,n,o){var r=!n;n||(n={});for(var i=-1,c=e.length;++i<c;){var a=e[i],u=void 0;void 0===u&&(u=t[a]),r?ct(n,a,u):rt(n,a,u)}return n}(t,Et(t))}(a):At(a)&&!Ot(a)||(v=function(t){return"function"!=typeof t.constructor||yt(t)?{}:X($(t))}(u))):g=!1}g&&(c.set(u,v),r(v,u,o,i,c),c.delete(u)),ot(t,n,v)}}(t,e,c,n,lt,o,r);else{var a=o?o(vt(t,c),i,c+"",t,e,r):void 0;void 0===a&&(a=i),ot(t,c,a)}}),Et)}var ft=q?function(t,e){return q(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Lt;function pt(t,e){var n,o,r=t.__data__;return("string"==(o=typeof(n=e))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function dt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!At(t)||function(t){return!!z&&z in t}(t))&&(Ot(t)?D:d).test(function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function ht(t,e){var n=typeof t;return!!(e=null==e?r:e)&&("number"==n||"symbol"!=n&&h.test(t))&&t>-1&&t%1==0&&t<e}function yt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)}function vt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var gt=function(t){var e=0,n=0;return function(){var o=V(),r=16-(o-n);if(n=o,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ft);function bt(t,e){return t===e||t!=t&&e!=e}var _t=st(function(){return arguments}())?st:function(t){return St(t)&&U.call(t,"callee")&&!M.call(t,"callee")},wt=Array.isArray;function mt(t){return null!=t&&Tt(t.length)&&!Ot(t)}var jt=G||function(){return!1};function Ot(t){if(!At(t))return!1;var e=ut(t);return e==a||e==u||e==c||e==f}function Tt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function At(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function St(t){return null!=t&&"object"==typeof t}var Pt=P?function(t){return function(e){return t(e)}}(P):function(t){return St(t)&&Tt(t.length)&&!!y[ut(t)]};function Et(t){return mt(t)?function(t,e){var n=wt(t),o=!n&&_t(t),r=!n&&!o&&jt(t),i=!n&&!o&&!r&&Pt(t),c=n||o||r||i,a=c?function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o}(t.length,String):[],u=a.length;for(var s in t)!e&&!U.call(t,s)||c&&("length"==s||r&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ht(s,u))||a.push(s);return a}(t,!0):function(t){if(!At(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=yt(t),n=[];for(var o in t)("constructor"!=o||!e&&U.call(t,o))&&n.push(o);return n}(t)}var xt,Ct=(xt=function(t,e,n){lt(t,e,n)},function(t,e){return gt(function(t,e,n){return e=W(void 0===e?t.length-1:e,0),function(){for(var o=arguments,r=-1,i=W(o.length-e,0),c=Array(i);++r<i;)c[r]=o[e+r];r=-1;for(var a=Array(e+1);++r<e;)a[r]=o[r];return a[e]=n(c),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,a)}}(t,e,Lt),t+"")}((function(t,e){var n=-1,o=e.length,r=o>1?e[o-1]:void 0,i=o>2?e[2]:void 0;for(r=xt.length>3&&"function"==typeof r?(o--,r):void 0,i&&function(t,e,n){if(!At(n))return!1;var o=typeof e;return!!("number"==o?mt(n)&&ht(e,n.length):"string"==o&&e in n)&&bt(n[e],t)}(e[0],e[1],i)&&(r=o<3?void 0:r,o=1),t=Object(t);++n<o;){var c=e[n];c&&xt(t,c,n)}return t})));function Lt(t){return t}t.exports=Ct},43:function(t,e,n){var o,r;!function(i,c){"use strict";o=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"];function r(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(e,n){for(var r=0;r<o.length;r++){var i=o[r];this[i]=r<e?t:this.methodFactory(i,e,n)}this.log=this.debug}function a(t,n,o){return function(){typeof console!==e&&(c.call(this,n,o),this[t].apply(this,arguments))}}function u(o,c,u){return function(o){return"debug"===o&&(o="log"),typeof console!==e&&("trace"===o&&n?i:void 0!==console[o]?r(console,o):void 0!==console.log?r(console,"log"):t)}(o)||a.apply(this,arguments)}function s(t,n,r){var i,a=this;n=null==n?"WARN":n;var s="loglevel";function l(){var t;if(typeof window!==e&&s){try{t=window.localStorage[s]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,o=n.indexOf(encodeURIComponent(s)+"=");-1!==o&&(t=/^([^;]+)/.exec(n.slice(o))[1])}catch(t){}return void 0===a.levels[t]&&(t=void 0),t}}"string"==typeof t?s+=":"+t:"symbol"==typeof t&&(s=void 0),a.name=t,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=r||u,a.getLevel=function(){return i},a.setLevel=function(n,r){if("string"==typeof n&&void 0!==a.levels[n.toUpperCase()]&&(n=a.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=a.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(i=n,!1!==r&&function(t){var n=(o[t]||"silent").toUpperCase();if(typeof window!==e&&s){try{return void(window.localStorage[s]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(s)+"="+n+";"}catch(t){}}}(n),c.call(a,n,t),typeof console===e&&n<a.levels.SILENT)return"No console available for logging"},a.setDefaultLevel=function(t){n=t,l()||a.setLevel(t,!1)},a.resetLevel=function(){a.setLevel(n,!1),function(){if(typeof window!==e&&s){try{return void window.localStorage.removeItem(s)}catch(t){}try{window.document.cookie=encodeURIComponent(s)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}()},a.enableAll=function(t){a.setLevel(a.levels.TRACE,t)},a.disableAll=function(t){a.setLevel(a.levels.SILENT,t)};var f=l();null==f&&(f=n),a.setLevel(f,!1)}var l=new s,f={};l.getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=f[t];return e||(e=f[t]=new s(t,l.getLevel(),l.methodFactory)),e};var p=typeof window!==e?window.log:void 0;return l.noConflict=function(){return typeof window!==e&&window.log===l&&(window.log=p),l},l.getLoggers=function(){return f},l.default=l,l},void 0===(r=o.call(e,n,e,t))||(t.exports=r)}()}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={id:o,loaded:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};return(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:String(n)}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function i(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(n){var r,i,c;r=t,i=n,c=o[n],(i=e(i))in r?Object.defineProperty(r,i,{value:c,enumerable:!0,configurable:!0,writable:!0}):r[i]=c})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}n.r(o),n.d(o,{clearAPIKey:()=>j,clearEmbedHost:()=>_,enableSentryTracing:()=>g,gatewayAuthHeader:()=>p,gatewayEmbedHostHeader:()=>d,generateJsonRPCObject:()=>z,get:()=>x,getAPIKey:()=>O,getEmbedHost:()=>w,patch:()=>L,post:()=>C,promiseRace:()=>R,promiseTimeout:()=>E,put:()=>I,remove:()=>U,setAPIKey:()=>m,setEmbedHost:()=>b,setLogLevel:()=>T});var c=n(378),a=n.n(c),u=n(43);const s=n.n(u)().getLogger("http-helpers");s.setLevel(u.levels.INFO);let l="torus-default",f="";const p="x-api-key",d="x-embed-host";let h=null;const y=[],v=[];function g(t,e,n){h=t,y.push(...e),v.push(...n)}function b(t){f=t}function _(){f=""}function w(){return f}function m(t){l=t}function j(){l="torus-default"}function O(){return l}function T(t){s.setLevel(t)}async function A(t,e){let n=null;try{n=new URL(t)}catch(t){}if(h&&n&&(y.includes(n.origin)||v.includes(n.pathname))){const n=h.startTransaction({name:t}),o=n.startChild({op:"http"}),r=await fetch(t,e);return o.finish(),n.finish(),r}return fetch(t,e)}function S(){const t={};return l&&(t[p]=l),f&&(t[d]=f),t}function P(t){s.info(`Response: ${t.status} ${t.statusText}`),s.info(`Url: ${t.url}`)}const E=async(t,e)=>{let n=null;try{const o=new Promise(((e,o)=>{n=setTimeout((()=>{o(new Error(`Timed out in ${t}ms`))}),t)})),r=await Promise.race([e,o]);return null!=n&&clearTimeout(n),r}catch(t){throw null!=n&&clearTimeout(n),t}},x=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={mode:"cors",headers:{}};(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).useAPIKey&&(n.headers=i(i({},n.headers),S()));const o=a()(n,e,{method:"GET"}),r=await A(t,o);if(r.ok){const t=r.headers.get("content-type");return null!=t&&t.includes("application/json")?r.json():r.text()}throw P(r),r},C=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"POST"});return o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e),E(o.timeout||6e4,A(t,c).then((t=>{if(o.logTracingHeader&&function(t){s.info(`Request tracing with traceID=${t.headers.get("x-web3-correlation-id")}`)}(t),t.ok){const e=t.headers.get("content-type");return null!=e&&e.includes("application/json")?t.json():t.text()}throw P(t),t})))},L=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"PATCH"});o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const u=await A(t,c);if(u.ok){const t=u.headers.get("content-type");return null!=t&&t.includes("application/json")?u.json():u.text()}throw P(u),u},I=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"PUT"});o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const u=await A(t,c);if(u.ok){const t=u.headers.get("content-type");return null!=t&&t.includes("application/json")?u.json():u.text()}throw P(u),u},U=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"DELETE"});o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const u=await A(t,c);if(u.ok){const t=u.headers.get("content-type");return null!=t&&t.includes("application/json")?u.json():u.text()}throw P(u),u},z=(t,e)=>({jsonrpc:"2.0",method:t,id:10,params:e}),R=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6e4;return Promise.race([x(t,e),new Promise(((t,e)=>{setTimeout((()=>{e(new Error("timed out"))}),n)}))])}})(),o})())); | ||
//# sourceMappingURL=httpHelpers.umd.min.js.map | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HttpHelpers=e():t.HttpHelpers=e()}(self,(()=>(()=>{var t={182:(t,e,n)=>{t=n.nmd(t);var o="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",c="[object AsyncFunction]",a="[object Function]",u="[object GeneratorFunction]",l="[object Null]",s="[object Object]",f="[object Proxy]",p="[object Undefined]",d=/^\[object .+?Constructor\]$/,h=/^(?:0|[1-9]\d*)$/,y={};y["[object Float32Array]"]=y["[object Float64Array]"]=y["[object Int8Array]"]=y["[object Int16Array]"]=y["[object Int32Array]"]=y["[object Uint8Array]"]=y["[object Uint8ClampedArray]"]=y["[object Uint16Array]"]=y["[object Uint32Array]"]=!0,y[i]=y["[object Array]"]=y["[object ArrayBuffer]"]=y["[object Boolean]"]=y["[object DataView]"]=y["[object Date]"]=y["[object Error]"]=y[a]=y["[object Map]"]=y["[object Number]"]=y[s]=y["[object RegExp]"]=y["[object Set]"]=y["[object String]"]=y["[object WeakMap]"]=!1;var v,g,b,_="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,w="object"==typeof self&&self&&self.Object===Object&&self,m=_||w||Function("return this")(),j=e&&!e.nodeType&&e,O=j&&t&&!t.nodeType&&t,T=O&&O.exports===j,A=T&&_.process,S=function(){try{return O&&O.require&&O.require("util").types||A&&A.binding&&A.binding("util")}catch(t){}}(),P=S&&S.isTypedArray,E=Array.prototype,x=Function.prototype,C=Object.prototype,L=m["__core-js_shared__"],I=x.toString,U=C.hasOwnProperty,z=(v=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",R=C.toString,F=I.call(Object),D=RegExp("^"+I.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=T?m.Buffer:void 0,k=m.Symbol,H=m.Uint8Array,$=(N&&N.allocUnsafe,g=Object.getPrototypeOf,b=Object,function(t){return g(b(t))}),K=Object.create,M=C.propertyIsEnumerable,J=E.splice,B=k?k.toStringTag:void 0,q=function(){try{var t=pt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=N?N.isBuffer:void 0,W=Math.max,V=Date.now,Y=pt(m,"Map"),Q=pt(Object,"create"),X=function(){function t(){}return function(e){if(!Tt(e))return{};if(K)return K(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Z(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function tt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function et(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function nt(t){var e=this.__data__=new tt(t);this.size=e.size}function ot(t,e,n){(void 0!==n&&!gt(t[e],n)||void 0===n&&!(e in t))&&ct(t,e,n)}function rt(t,e,n){var o=t[e];U.call(t,e)&>(o,n)&&(void 0!==n||e in t)||ct(t,e,n)}function it(t,e){for(var n=t.length;n--;)if(gt(t[n][0],e))return n;return-1}function ct(t,e,n){"__proto__"==e&&q?q(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}Z.prototype.clear=function(){this.__data__=Q?Q(null):{},this.size=0},Z.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Z.prototype.get=function(t){var e=this.__data__;if(Q){var n=e[t];return n===o?void 0:n}return U.call(e,t)?e[t]:void 0},Z.prototype.has=function(t){var e=this.__data__;return Q?void 0!==e[t]:U.call(e,t)},Z.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Q&&void 0===e?o:e,this},tt.prototype.clear=function(){this.__data__=[],this.size=0},tt.prototype.delete=function(t){var e=this.__data__,n=it(e,t);return!(n<0||(n==e.length-1?e.pop():J.call(e,n,1),--this.size,0))},tt.prototype.get=function(t){var e=this.__data__,n=it(e,t);return n<0?void 0:e[n][1]},tt.prototype.has=function(t){return it(this.__data__,t)>-1},tt.prototype.set=function(t,e){var n=this.__data__,o=it(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this},et.prototype.clear=function(){this.size=0,this.__data__={hash:new Z,map:new(Y||tt),string:new Z}},et.prototype.delete=function(t){var e=ft(this,t).delete(t);return this.size-=e?1:0,e},et.prototype.get=function(t){return ft(this,t).get(t)},et.prototype.has=function(t){return ft(this,t).has(t)},et.prototype.set=function(t,e){var n=ft(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this},nt.prototype.clear=function(){this.__data__=new tt,this.size=0},nt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},nt.prototype.get=function(t){return this.__data__.get(t)},nt.prototype.has=function(t){return this.__data__.has(t)},nt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof tt){var o=n.__data__;if(!Y||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new et(o)}return n.set(t,e),this.size=n.size,this};function at(t){return null==t?void 0===t?p:l:B&&B in Object(t)?function(t){var e=U.call(t,B),n=t[B];try{t[B]=void 0;var o=!0}catch(t){}var r=R.call(t);return o&&(e?t[B]=n:delete t[B]),r}(t):function(t){return R.call(t)}(t)}function ut(t){return At(t)&&at(t)==i}function lt(t,e,n,o,r){t!==e&&function(t,e,n){for(var o=-1,r=Object(t),i=n(t),c=i.length;c--;){var a=i[++o];if(!1===e(r[a],a,r))break}}(e,(function(i,c){if(r||(r=new nt),Tt(i))!function(t,e,n,o,r,i,c){var a=yt(t,n),u=yt(e,n),l=c.get(u);if(l)ot(t,n,l);else{var f,p,d,h,y,v=i?i(a,u,n+"",t,e,c):void 0,g=void 0===v;if(g){var b=_t(u),_=!b&&mt(u),w=!b&&!_&&St(u);v=u,b||_||w?_t(a)?v=a:At(y=a)&&wt(y)?v=function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e}(a):_?(g=!1,v=function(t,e){return t.slice()}(u)):w?(g=!1,h=new(d=(f=u).buffer).constructor(d.byteLength),new H(h).set(new H(d)),p=h,v=new f.constructor(p,f.byteOffset,f.length)):v=[]:function(t){if(!At(t)||at(t)!=s)return!1;var e=$(t);if(null===e)return!0;var n=U.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&I.call(n)==F}(u)||bt(u)?(v=a,bt(a)?v=function(t){return function(t,e,n,o){var r=!n;n||(n={});for(var i=-1,c=e.length;++i<c;){var a=e[i],u=void 0;void 0===u&&(u=t[a]),r?ct(n,a,u):rt(n,a,u)}return n}(t,Pt(t))}(a):Tt(a)&&!jt(a)||(v=function(t){return"function"!=typeof t.constructor||ht(t)?{}:X($(t))}(u))):g=!1}g&&(c.set(u,v),r(v,u,o,i,c),c.delete(u)),ot(t,n,v)}}(t,e,c,n,lt,o,r);else{var a=o?o(yt(t,c),i,c+"",t,e,r):void 0;void 0===a&&(a=i),ot(t,c,a)}}),Pt)}var st=q?function(t,e){return q(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Ct;function ft(t,e){var n,o,r=t.__data__;return("string"==(o=typeof(n=e))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function pt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Tt(t)||function(t){return!!z&&z in t}(t))&&(jt(t)?D:d).test(function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function dt(t,e){var n=typeof t;return!!(e=null==e?r:e)&&("number"==n||"symbol"!=n&&h.test(t))&&t>-1&&t%1==0&&t<e}function ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)}function yt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var vt=function(t){var e=0,n=0;return function(){var o=V(),r=16-(o-n);if(n=o,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(st);function gt(t,e){return t===e||t!=t&&e!=e}var bt=ut(function(){return arguments}())?ut:function(t){return At(t)&&U.call(t,"callee")&&!M.call(t,"callee")},_t=Array.isArray;function wt(t){return null!=t&&Ot(t.length)&&!jt(t)}var mt=G||function(){return!1};function jt(t){if(!Tt(t))return!1;var e=at(t);return e==a||e==u||e==c||e==f}function Ot(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function Tt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function At(t){return null!=t&&"object"==typeof t}var St=P?function(t){return function(e){return t(e)}}(P):function(t){return At(t)&&Ot(t.length)&&!!y[at(t)]};function Pt(t){return wt(t)?function(t,e){var n=_t(t),o=!n&&bt(t),r=!n&&!o&&mt(t),i=!n&&!o&&!r&&St(t),c=n||o||r||i,a=c?function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o}(t.length,String):[],u=a.length;for(var l in t)!e&&!U.call(t,l)||c&&("length"==l||r&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||dt(l,u))||a.push(l);return a}(t,!0):function(t){if(!Tt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=ht(t),n=[];for(var o in t)("constructor"!=o||!e&&U.call(t,o))&&n.push(o);return n}(t)}var Et,xt=(Et=function(t,e,n){lt(t,e,n)},function(t,e){return vt(function(t,e,n){return e=W(void 0===e?t.length-1:e,0),function(){for(var o=arguments,r=-1,i=W(o.length-e,0),c=Array(i);++r<i;)c[r]=o[e+r];r=-1;for(var a=Array(e+1);++r<e;)a[r]=o[r];return a[e]=n(c),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,a)}}(t,e,Ct),t+"")}((function(t,e){var n=-1,o=e.length,r=o>1?e[o-1]:void 0,i=o>2?e[2]:void 0;for(r=Et.length>3&&"function"==typeof r?(o--,r):void 0,i&&function(t,e,n){if(!Tt(n))return!1;var o=typeof e;return!!("number"==o?wt(n)&&dt(e,n.length):"string"==o&&e in n)&>(n[e],t)}(e[0],e[1],i)&&(r=o<3?void 0:r,o=1),t=Object(t);++n<o;){var c=e[n];c&&Et(t,c,n)}return t})));function Ct(t){return t}t.exports=xt},65:function(t,e,n){var o,r;!function(i,c){"use strict";o=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],r={},i=null;function c(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(){for(var n=this.getLevel(),r=0;r<o.length;r++){var i=o[r];this[i]=r<n?t:this.methodFactory(i,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function l(t){return function(){typeof console!==e&&(u.call(this),this[t].apply(this,arguments))}}function s(o,r,i){return function(o){return"debug"===o&&(o="log"),typeof console!==e&&("trace"===o&&n?a:void 0!==console[o]?c(console,o):void 0!==console.log?c(console,"log"):t)}(o)||l.apply(this,arguments)}function f(t,n){var c,a,l,f=this,p="loglevel";function d(){var t;if(typeof window!==e&&p){try{t=window.localStorage[p]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,o=encodeURIComponent(p),r=n.indexOf(o+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+o.length+1))[1])}catch(t){}return void 0===f.levels[t]&&(t=void 0),t}}function h(t){var e=t;if("string"==typeof e&&void 0!==f.levels[e.toUpperCase()]&&(e=f.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=f.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?p+=":"+t:"symbol"==typeof t&&(p=void 0),f.name=t,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=n||s,f.getLevel=function(){return null!=l?l:null!=a?a:c},f.setLevel=function(t,n){return l=h(t),!1!==n&&function(t){var n=(o[t]||"silent").toUpperCase();if(typeof window!==e&&p){try{return void(window.localStorage[p]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(p)+"="+n+";"}catch(t){}}}(l),u.call(f)},f.setDefaultLevel=function(t){a=h(t),d()||f.setLevel(t,!1)},f.resetLevel=function(){l=null,function(){if(typeof window!==e&&p){try{window.localStorage.removeItem(p)}catch(t){}try{window.document.cookie=encodeURIComponent(p)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),u.call(f)},f.enableAll=function(t){f.setLevel(f.levels.TRACE,t)},f.disableAll=function(t){f.setLevel(f.levels.SILENT,t)},f.rebuild=function(){if(i!==f&&(c=h(i.getLevel())),u.call(f),i===f)for(var t in r)r[t].rebuild()},c=h(i?i.getLevel():"WARN");var y=d();null!=y&&(l=h(y)),u.call(f)}(i=new f).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new f(t,i.methodFactory)),e};var p=typeof window!==e?window.log:void 0;return i.noConflict=function(){return typeof window!==e&&window.log===i&&(window.log=p),i},i.getLoggers=function(){return r},i.default=i,i},void 0===(r=o.call(e,n,e,t))||(t.exports=r)}()}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={id:o,loaded:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var o={};return(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:String(n)}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function i(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(n){var r,i,c;r=t,i=n,c=o[n],(i=e(i))in r?Object.defineProperty(r,i,{value:c,enumerable:!0,configurable:!0,writable:!0}):r[i]=c})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}n.r(o),n.d(o,{clearAPIKey:()=>j,clearEmbedHost:()=>_,enableSentryTracing:()=>g,gatewayAuthHeader:()=>p,gatewayEmbedHostHeader:()=>d,generateJsonRPCObject:()=>z,get:()=>x,getAPIKey:()=>O,getEmbedHost:()=>w,patch:()=>L,post:()=>C,promiseRace:()=>R,promiseTimeout:()=>E,put:()=>I,remove:()=>U,setAPIKey:()=>m,setEmbedHost:()=>b,setLogLevel:()=>T});var c=n(182),a=n.n(c),u=n(65);const l=n.n(u)().getLogger("http-helpers");l.setLevel(u.levels.INFO);let s="torus-default",f="";const p="x-api-key",d="x-embed-host";let h=null;const y=[],v=[];function g(t,e,n){h=t,y.push(...e),v.push(...n)}function b(t){f=t}function _(){f=""}function w(){return f}function m(t){s=t}function j(){s="torus-default"}function O(){return s}function T(t){l.setLevel(t)}async function A(t,e){let n=null;try{n=new URL(t)}catch(t){}if(h&&n&&(y.includes(n.origin)||v.includes(n.pathname))){const n=h.startTransaction({name:t}),o=n.startChild({op:"http"}),r=await fetch(t,e);return o.finish(),n.finish(),r}return fetch(t,e)}function S(){const t={};return s&&(t[p]=s),f&&(t[d]=f),t}function P(t){l.info(`Response: ${t.status} ${t.statusText}`),l.info(`Url: ${t.url}`)}const E=async(t,e)=>{let n=null;try{const o=new Promise(((e,o)=>{n=setTimeout((()=>{o(new Error(`Timed out in ${t}ms`))}),t)})),r=await Promise.race([e,o]);return null!=n&&clearTimeout(n),r}catch(t){throw null!=n&&clearTimeout(n),t}},x=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={mode:"cors",headers:{}};(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).useAPIKey&&(n.headers=i(i({},n.headers),S()));const o=a()(n,e,{method:"GET"}),r=await A(t,o);if(r.ok){const t=r.headers.get("content-type");return null!=t&&t.includes("application/json")?r.json():r.text()}throw P(r),r},C=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"POST"});return o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e),E(o.timeout||6e4,A(t,c).then((t=>{if(o.logTracingHeader&&function(t){l.info(`Request tracing with traceID=${t.headers.get("x-web3-correlation-id")}`)}(t),t.ok){const e=t.headers.get("content-type");return null!=e&&e.includes("application/json")?t.json():t.text()}throw P(t),t})))},L=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"PATCH"});o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const u=await A(t,c);if(u.ok){const t=u.headers.get("content-type");return null!=t&&t.includes("application/json")?u.json():u.text()}throw P(u),u},I=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"PUT"});o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const u=await A(t,c);if(u.ok){const t=u.headers.get("content-type");return null!=t&&t.includes("application/json")?u.json():u.text()}throw P(u),u},U=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};o.useAPIKey&&(r.headers=i(i({},r.headers),S()));const c=a()(r,n,{method:"DELETE"});o.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const u=await A(t,c);if(u.ok){const t=u.headers.get("content-type");return null!=t&&t.includes("application/json")?u.json():u.text()}throw P(u),u},z=(t,e)=>({jsonrpc:"2.0",method:t,id:10,params:e}),R=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6e4;return Promise.race([x(t,e),new Promise(((t,e)=>{setTimeout((()=>{e(new Error("timed out"))}),n)}))])}})(),o})())); |
{ | ||
"name": "@toruslabs/http-helpers", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "http helpers", | ||
@@ -17,7 +17,6 @@ "main": "dist/httpHelpers.cjs.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"prepare": "husky install" | ||
"prepare": "husky" | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -35,14 +34,14 @@ "peerDependencies": { | ||
"lodash.merge": "^4.6.2", | ||
"loglevel": "^1.8.1" | ||
"loglevel": "^1.9.1" | ||
}, | ||
"devDependencies": { | ||
"@sentry/types": "^7.86.0", | ||
"@sentry/types": "^7.105.0", | ||
"@toruslabs/config": "^2.0.2", | ||
"@toruslabs/eslint-config-typescript": "^3.0.3", | ||
"@toruslabs/torus-scripts": "^5.1.0", | ||
"@toruslabs/eslint-config-typescript": "^3.2.0", | ||
"@toruslabs/torus-scripts": "^5.3.0", | ||
"@types/lodash.merge": "^4.6.9", | ||
"eslint": "^8.55.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^15.2.0", | ||
"prettier": "^3.1.1", | ||
"eslint": "^8.57.0", | ||
"husky": "^9.0.11", | ||
"lint-staged": "^15.2.2", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.5" | ||
@@ -49,0 +48,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53335
7
727
Updatedloglevel@^1.9.1