Socket
Socket
Sign inDemoInstall

@toruslabs/http-helpers

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toruslabs/http-helpers - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

9

dist/httpHelpers-node.js

@@ -128,2 +128,5 @@ /******/ (() => { // webpackBootstrap

log.setLevel(external_loglevel_namespaceObject.levels.INFO);
// eslint-disable-next-line @typescript-eslint/no-empty-interface
let apiKey = "torus-default";

@@ -199,2 +202,5 @@ let embedHost = "";

}
function logTracingHeader(response) {
log.info(`Request tracing with traceID=${response.headers.get("x-web3-correlation-id")}`);
}
const promiseTimeout = (ms, promise) => {

@@ -259,2 +265,5 @@ const timeout = new Promise((resolve, reject) => {

return promiseTimeout(customOptions.timeout || 60000, fetchAndTrace(url, options).then(response => {
if (customOptions.logTracingHeader) {
logTracingHeader(response);
}
if (response.ok) {

@@ -261,0 +270,0 @@ return response.json();

@@ -93,2 +93,5 @@ /******/ (() => { // webpackBootstrap

log.setLevel(external_loglevel_namespaceObject.levels.INFO);
// eslint-disable-next-line @typescript-eslint/no-empty-interface
let apiKey = "torus-default";

@@ -164,2 +167,5 @@ let embedHost = "";

}
function logTracingHeader(response) {
log.info(`Request tracing with traceID=${response.headers.get("x-web3-correlation-id")}`);
}
const promiseTimeout = (ms, promise) => {

@@ -224,2 +230,5 @@ const timeout = new Promise((resolve, reject) => {

return promiseTimeout(customOptions.timeout || 60000, fetchAndTrace(url, options).then(response => {
if (customOptions.logTracingHeader) {
logTracingHeader(response);
}
if (response.ok) {

@@ -226,0 +235,0 @@ return response.json();

@@ -73,2 +73,5 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';

}
function logTracingHeader(response) {
log.info(`Request tracing with traceID=${response.headers.get("x-web3-correlation-id")}`);
}
const promiseTimeout = (ms, promise) => {

@@ -132,2 +135,5 @@ const timeout = new Promise((resolve, reject) => {

return promiseTimeout(customOptions.timeout || 60000, fetchAndTrace(url, options).then(response => {
if (customOptions.logTracingHeader) {
logTracingHeader(response);
}
if (response.ok) {

@@ -134,0 +140,0 @@ return response.json();

2

dist/httpHelpers.umd.min.js

@@ -1,2 +0,2 @@

!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 r="__lodash_hash_undefined__",o=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\]$/,y=/^(?:0|[1-9]\d*)$/,h={};h["[object Float32Array]"]=h["[object Float64Array]"]=h["[object Int8Array]"]=h["[object Int16Array]"]=h["[object Int32Array]"]=h["[object Uint8Array]"]=h["[object Uint8ClampedArray]"]=h["[object Uint16Array]"]=h["[object Uint32Array]"]=!0,h[i]=h["[object Array]"]=h["[object ArrayBuffer]"]=h["[object Boolean]"]=h["[object DataView]"]=h["[object Date]"]=h["[object Error]"]=h[a]=h["[object Map]"]=h["[object Number]"]=h[l]=h["[object RegExp]"]=h["[object Set]"]=h["[object String]"]=h["[object WeakMap]"]=!1;var v,b,g,_="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,m="object"==typeof self&&self&&self.Object===Object&&self,w=_||m||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,C=Function.prototype,L=Object.prototype,I=w["__core-js_shared__"],x=C.toString,U=L.hasOwnProperty,z=(v=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",R=L.toString,F=x.call(Object),N=RegExp("^"+x.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),k=T?w.Buffer:void 0,D=w.Symbol,H=w.Uint8Array,$=(k&&k.allocUnsafe,b=Object.getPrototypeOf,g=Object,function(t){return b(g(t))}),K=Object.create,M=L.propertyIsEnumerable,J=E.splice,B=D?D.toStringTag:void 0,G=function(){try{var t=dt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),W=k?k.isBuffer:void 0,q=Math.max,V=Date.now,Y=dt(w,"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 r=t[e];this.set(r[0],r[1])}}function tt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function et(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function nt(t){var e=this.__data__=new tt(t);this.size=e.size}function rt(t,e,n){(void 0!==n&&!gt(t[e],n)||void 0===n&&!(e in t))&&ct(t,e,n)}function ot(t,e,n){var r=t[e];U.call(t,e)&&gt(r,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&&G?G(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===r?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?r: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__,r=it(n,t);return r<0?(++this.size,n.push([t,e])):n[r][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),r=n.size;return n.set(t,e),this.size+=n.size==r?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 r=n.__data__;if(!Y||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new et(r)}return n.set(t,e),this.size=n.size,this};var at=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),c=i.length;c--;){var a=i[++r];if(!1===e(o[a],a,o))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 r=!0}catch(t){}var o=R.call(t);return r&&(e?t[B]=n:delete t[B]),o}(t):function(t){return R.call(t)}(t)}function st(t){return St(t)&&ut(t)==i}function lt(t,e,n,r,o){t!==e&&at(e,(function(i,c){if(o||(o=new nt),At(i))!function(t,e,n,r,o,i,c){var a=vt(t,n),u=vt(e,n),s=c.get(u);if(s)rt(t,n,s);else{var f,p,d,y,h,v=i?i(a,u,n+"",t,e,c):void 0,b=void 0===v;if(b){var g=mt(u),_=!g&&jt(u),m=!g&&!_&&Pt(u);v=u,g||_||m?mt(a)?v=a:St(h=a)&&wt(h)?v=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(a):_?(b=!1,v=function(t,e){return t.slice()}(u)):m?(b=!1,y=new(d=(f=u).buffer).constructor(d.byteLength),new H(y).set(new H(d)),p=y,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&&x.call(n)==F}(u)||_t(u)?(v=a,_t(a)?v=function(t){return function(t,e,n,r){var o=!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]),o?ct(n,a,u):ot(n,a,u)}return n}(t,Et(t))}(a):At(a)&&!Ot(a)||(v=function(t){return"function"!=typeof t.constructor||ht(t)?{}:X($(t))}(u))):b=!1}b&&(c.set(u,v),o(v,u,r,i,c),c.delete(u)),rt(t,n,v)}}(t,e,c,n,lt,r,o);else{var a=r?r(vt(t,c),i,c+"",t,e,o):void 0;void 0===a&&(a=i),rt(t,c,a)}}),Et)}var ft=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:It;function pt(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.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)?N:d).test(function(t){if(null!=t){try{return x.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function yt(t,e){var n=typeof t;return!!(e=null==e?o:e)&&("number"==n||"symbol"!=n&&y.test(t))&&t>-1&&t%1==0&&t<e}function ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||L)}function vt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var bt=function(t){var e=0,n=0;return function(){var r=V(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ft);function gt(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")},mt=Array.isArray;function wt(t){return null!=t&&Tt(t.length)&&!Ot(t)}var jt=W||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<=o}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)&&!!h[ut(t)]};function Et(t){return wt(t)?function(t,e){var n=mt(t),r=!n&&_t(t),o=!n&&!r&&jt(t),i=!n&&!r&&!o&&Pt(t),c=n||r||o||i,a=c?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=a.length;for(var s in t)!e&&!U.call(t,s)||c&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||yt(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=ht(t),n=[];for(var r in t)("constructor"!=r||!e&&U.call(t,r))&&n.push(r);return n}(t)}var Ct,Lt=(Ct=function(t,e,n){lt(t,e,n)},function(t,e){return bt(function(t,e,n){return e=q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=q(r.length-e,0),c=Array(i);++o<i;)c[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];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,It),t+"")}((function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Ct.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!At(n))return!1;var r=typeof e;return!!("number"==r?wt(n)&&yt(e,n.length):"string"==r&&e in n)&&gt(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var c=e[n];c&&Ct(t,c,n)}return t})));function It(t){return t}t.exports=Lt},43:function(t,e,n){var r,o;!function(i,c){"use strict";r=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function o(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 o=0;o<r.length;o++){var i=r[o];this[i]=o<e?t:this.methodFactory(i,e,n)}this.log=this.debug}function a(t,n,r){return function(){typeof console!==e&&(c.call(this,n,r),this[t].apply(this,arguments))}}function u(r,c,u){return function(r){return"debug"===r&&(r="log"),typeof console!==e&&("trace"===r&&n?i:void 0!==console[r]?o(console,r):void 0!==console.log?o(console,"log"):t)}(r)||a.apply(this,arguments)}function s(t,n,o){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,r=n.indexOf(encodeURIComponent(s)+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r))[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=o||u,a.getLevel=function(){return i},a.setLevel=function(n,o){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!==o&&function(t){var n=(r[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===(o=r.call(e,n,e,t))||(t.exports=o)}()}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r].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 r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},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 r={};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,n,r){return(n=function(e){var n=function(e,n){if("object"!==t(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(n)?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}n.r(r),n.d(r,{clearAPIKey:()=>j,clearEmbedHost:()=>_,enableSentryTracing:()=>b,gatewayAuthHeader:()=>p,gatewayEmbedHostHeader:()=>d,generateJsonRPCObject:()=>z,get:()=>C,getAPIKey:()=>O,getEmbedHost:()=>m,patch:()=>I,post:()=>L,promiseRace:()=>R,promiseTimeout:()=>E,put:()=>x,remove:()=>U,setAPIKey:()=>w,setEmbedHost:()=>g,setLogLevel:()=>T});var o=n(378),i=n.n(o),c=n(43);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}const s=n.n(c)().getLogger("http-helpers");s.setLevel(c.levels.INFO);let l="torus-default",f="";const p="x-api-key",d="x-embed-host";let y=null;const h=[],v=[];function b(t,e,n){y=t,h.push(...e),v.push(...n)}function g(t){f=t}function _(){f=""}function m(){return f}function w(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(y&&n&&(h.includes(n.origin)||v.includes(n.pathname))){const n=y.startTransaction({name:t}),r=n.startChild({op:"http"}),o=await fetch(t,e);return r.finish(),n.finish(),o}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=(t,e)=>{const n=new Promise(((e,n)=>{const r=setTimeout((()=>{clearTimeout(r),n(new Error(`Timed out in ${t}ms`))}),t)}));return Promise.race([e,n])},C=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=u(u({},n.headers),S()));const r=i()(n,e,{method:"GET"}),o=await A(t,r);if(o.ok)return o.json();throw P(o),o},L=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"POST"});return r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e),E(r.timeout||6e4,A(t,c).then((t=>{if(t.ok)return t.json();throw P(t),t})))},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]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"PATCH"});r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const a=await A(t,c);if(a.ok)return a.json();throw P(a),a},x=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"PUT"});r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const a=await A(t,c);if(a.ok)return a.json();throw P(a),a},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]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"DELETE"});r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const a=await A(t,c);if(a.ok)return a.json();throw P(a),a},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([C(t,e),new Promise(((t,e)=>{setTimeout((()=>{e(new Error("timed out"))}),n)}))])}})(),r})()));
!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 r="__lodash_hash_undefined__",o=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,C=Function.prototype,L=Object.prototype,I=m["__core-js_shared__"],x=C.toString,U=L.hasOwnProperty,z=(v=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",R=L.toString,F=x.call(Object),D=RegExp("^"+x.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=L.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 r=t[e];this.set(r[0],r[1])}}function tt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function et(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function nt(t){var e=this.__data__=new tt(t);this.size=e.size}function rt(t,e,n){(void 0!==n&&!bt(t[e],n)||void 0===n&&!(e in t))&&ct(t,e,n)}function ot(t,e,n){var r=t[e];U.call(t,e)&&bt(r,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===r?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?r: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__,r=it(n,t);return r<0?(++this.size,n.push([t,e])):n[r][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),r=n.size;return n.set(t,e),this.size+=n.size==r?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 r=n.__data__;if(!Y||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new et(r)}return n.set(t,e),this.size=n.size,this};var at=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),c=i.length;c--;){var a=i[++r];if(!1===e(o[a],a,o))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 r=!0}catch(t){}var o=R.call(t);return r&&(e?t[B]=n:delete t[B]),o}(t):function(t){return R.call(t)}(t)}function st(t){return St(t)&&ut(t)==i}function lt(t,e,n,r,o){t!==e&&at(e,(function(i,c){if(o||(o=new nt),At(i))!function(t,e,n,r,o,i,c){var a=vt(t,n),u=vt(e,n),s=c.get(u);if(s)rt(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,r=t.length;for(e||(e=Array(r));++n<r;)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&&x.call(n)==F}(u)||_t(u)?(v=a,_t(a)?v=function(t){return function(t,e,n,r){var o=!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]),o?ct(n,a,u):ot(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),o(v,u,r,i,c),c.delete(u)),rt(t,n,v)}}(t,e,c,n,lt,r,o);else{var a=r?r(vt(t,c),i,c+"",t,e,o):void 0;void 0===a&&(a=i),rt(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}:It;function pt(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.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 x.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?o: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||L)}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 r=V(),o=16-(r-n);if(n=r,o>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<=o}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),r=!n&&_t(t),o=!n&&!r&&jt(t),i=!n&&!r&&!o&&Pt(t),c=n||r||o||i,a=c?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=a.length;for(var s in t)!e&&!U.call(t,s)||c&&("length"==s||o&&("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 r in t)("constructor"!=r||!e&&U.call(t,r))&&n.push(r);return n}(t)}var Ct,Lt=(Ct=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 r=arguments,o=-1,i=W(r.length-e,0),c=Array(i);++o<i;)c[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];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,It),t+"")}((function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Ct.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!At(n))return!1;var r=typeof e;return!!("number"==r?mt(n)&&ht(e,n.length):"string"==r&&e in n)&&bt(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var c=e[n];c&&Ct(t,c,n)}return t})));function It(t){return t}t.exports=Lt},43:function(t,e,n){var r,o;!function(i,c){"use strict";r=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function o(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 o=0;o<r.length;o++){var i=r[o];this[i]=o<e?t:this.methodFactory(i,e,n)}this.log=this.debug}function a(t,n,r){return function(){typeof console!==e&&(c.call(this,n,r),this[t].apply(this,arguments))}}function u(r,c,u){return function(r){return"debug"===r&&(r="log"),typeof console!==e&&("trace"===r&&n?i:void 0!==console[r]?o(console,r):void 0!==console.log?o(console,"log"):t)}(r)||a.apply(this,arguments)}function s(t,n,o){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,r=n.indexOf(encodeURIComponent(s)+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r))[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=o||u,a.getLevel=function(){return i},a.setLevel=function(n,o){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!==o&&function(t){var n=(r[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===(o=r.call(e,n,e,t))||(t.exports=o)}()}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r].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 r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},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 r={};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,n,r){return(n=function(e){var n=function(e,n){if("object"!==t(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(n)?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}n.r(r),n.d(r,{clearAPIKey:()=>j,clearEmbedHost:()=>_,enableSentryTracing:()=>g,gatewayAuthHeader:()=>p,gatewayEmbedHostHeader:()=>d,generateJsonRPCObject:()=>z,get:()=>C,getAPIKey:()=>O,getEmbedHost:()=>w,patch:()=>I,post:()=>L,promiseRace:()=>R,promiseTimeout:()=>E,put:()=>x,remove:()=>U,setAPIKey:()=>m,setEmbedHost:()=>b,setLogLevel:()=>T});var o=n(378),i=n.n(o),c=n(43);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}const s=n.n(c)().getLogger("http-helpers");s.setLevel(c.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}),r=n.startChild({op:"http"}),o=await fetch(t,e);return r.finish(),n.finish(),o}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=(t,e)=>{const n=new Promise(((e,n)=>{const r=setTimeout((()=>{clearTimeout(r),n(new Error(`Timed out in ${t}ms`))}),t)}));return Promise.race([e,n])},C=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=u(u({},n.headers),S()));const r=i()(n,e,{method:"GET"}),o=await A(t,r);if(o.ok)return o.json();throw P(o),o},L=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"POST"});return r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e),E(r.timeout||6e4,A(t,c).then((t=>{if(r.logTracingHeader&&function(t){s.info(`Request tracing with traceID=${t.headers.get("x-web3-correlation-id")}`)}(t),t.ok)return t.json();throw P(t),t})))},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]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"PATCH"});r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const a=await A(t,c);if(a.ok)return a.json();throw P(a),a},x=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"PUT"});r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const a=await A(t,c);if(a.ok)return a.json();throw P(a),a},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]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};r.useAPIKey&&(o.headers=u(u({},o.headers),S()));const c=i()(o,n,{method:"DELETE"});r.isUrlEncodedData?(c.body=e,"application/json; charset=utf-8"===c.headers["Content-Type"]&&delete c.headers["Content-Type"]):c.body=JSON.stringify(e);const a=await A(t,c);if(a.ok)return a.json();throw P(a),a},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([C(t,e),new Promise(((t,e)=>{setTimeout((()=>{e(new Error("timed out"))}),n)}))])}})(),r})()));
//# sourceMappingURL=httpHelpers.umd.min.js.map

@@ -8,2 +8,3 @@ import type { SpanContext, TransactionContext } from "@sentry/types";

timeout?: number;
logTracingHeader?: boolean;
}

@@ -10,0 +11,0 @@ export interface Data {

{
"name": "@toruslabs/http-helpers",
"version": "3.3.0",
"version": "3.4.0",
"description": "http helpers",

@@ -37,13 +37,12 @@ "main": "dist/httpHelpers.cjs.js",

"devDependencies": {
"@toruslabs/eslint-config-typescript": "^1.4.1",
"@toruslabs/torus-scripts": "^3.0.4",
"@sentry/types": "^7.43.0",
"@toruslabs/eslint-config-typescript": "^1.4.3",
"@toruslabs/torus-scripts": "^3.0.8",
"@sentry/types": "^7.50.0",
"@types/lodash.merge": "^4.6.7",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"eslint": "^8.36.0",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"eslint": "^8.39.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",

@@ -54,6 +53,6 @@ "eslint-plugin-promise": "^6.1.1",

"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"lint-staged": "^13.2.2",
"node-fetch": "^2.6.9",
"prettier": "^2.8.4",
"rimraf": "^4.4.0"
"prettier": "^2.8.8",
"rimraf": "^5.0.0"
},

@@ -60,0 +59,0 @@ "repository": {

@@ -12,2 +12,3 @@ /* eslint-disable @typescript-eslint/no-throw-literal */

timeout?: number;
logTracingHeader?: boolean;
}

@@ -109,2 +110,6 @@

function logTracingHeader(response: Response) {
log.info(`Request tracing with traceID=${response.headers.get("x-web3-correlation-id")}`);
}
export const promiseTimeout = <T>(ms: number, promise: Promise<T>): Promise<T> => {

@@ -165,2 +170,5 @@ const timeout = new Promise<T>((resolve, reject) => {

fetchAndTrace(url, options).then((response) => {
if (customOptions.logTracingHeader) {
logTracingHeader(response);
}
if (response.ok) {

@@ -167,0 +175,0 @@ return response.json() as Promise<T>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc