@dodoex/wallet-web3 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/__node-resolve_empty-6899d137.js +1 -0
  2. package/dist/__tslib-6931b0df.js +1 -0
  3. package/dist/{blocto-2be0255e.js → blocto-4a1e9263.js} +1 -1
  4. package/dist/{bn-8000b6e3.js → bn-adaa4e36.js} +1 -1
  5. package/dist/{browser-ponyfill-7f0b470a.js → browser-ponyfill-dddc085e.js} +1 -1
  6. package/dist/cjs/{__node-resolve_empty-43123101.cjs → __node-resolve_empty-49c0af6e.cjs} +1 -1
  7. package/dist/cjs/__tslib-4266d6e2.cjs +1 -0
  8. package/dist/cjs/{blocto-51673345.cjs → blocto-deb38e52.cjs} +1 -1
  9. package/dist/cjs/{bn-5cd5c0fb.cjs → bn-2b933a98.cjs} +1 -1
  10. package/dist/cjs/{browser-ponyfill-cb1d5c87.cjs → browser-ponyfill-1726d0df.cjs} +1 -1
  11. package/dist/cjs/{ethers-aebcc064.cjs → ethers-b15b78af.cjs} +1 -1
  12. package/dist/cjs/{id-da45e69f.cjs → id-8ee21e65.cjs} +1 -1
  13. package/dist/cjs/{index-d2a99739.cjs → index-0b32b93b.cjs} +1 -1
  14. package/dist/cjs/{index-ef71e28c.cjs → index-33676cb5.cjs} +1 -1
  15. package/dist/cjs/{index-00ada50b.cjs → index-4a4f9fb0.cjs} +1 -1
  16. package/dist/cjs/{index-69f8df7c.cjs → index-6102e681.cjs} +1 -1
  17. package/dist/cjs/{index-0b343772.cjs → index-a3094029.cjs} +1 -1
  18. package/dist/cjs/{index-a47256a1.cjs → index-a5e70b92.cjs} +1 -1
  19. package/dist/cjs/{index-16f9c2d1.cjs → index-d176fe96.cjs} +1 -1
  20. package/dist/cjs/{index-ff867346.cjs → index-d8ce743a.cjs} +1 -1
  21. package/dist/cjs/{index-4fdceae7.cjs → index-e138e4bd.cjs} +1 -1
  22. package/dist/cjs/{index-3c3e551e.cjs → index-f7e0957d.cjs} +1 -1
  23. package/dist/cjs/index.cjs +1 -1
  24. package/dist/cjs/{index.es-e47d88b2.cjs → index.es-6960d4a9.cjs} +1 -1
  25. package/dist/cjs/{interface-67cf56b9.cjs → interface-999fee7d.cjs} +1 -1
  26. package/dist/cjs/{portis-910b9215.cjs → portis-d03f025d.cjs} +1 -1
  27. package/dist/cjs/{provider-98114aff.cjs → provider-455dd9b1.cjs} +1 -1
  28. package/dist/cjs/{rainbow-200b22e8.cjs → rainbow-d05c27f9.cjs} +1 -1
  29. package/dist/cjs/{typed-data-2460f6ae.cjs → typed-data-f657627b.cjs} +1 -1
  30. package/dist/cjs/{uAuth-d1f305eb.cjs → uAuth-7d31e1b1.cjs} +1 -1
  31. package/dist/cjs/{walletConnect-c410399b.cjs → walletConnect-40c43a59.cjs} +1 -1
  32. package/dist/cjs/{walletLink-db81b068.cjs → walletLink-7a3a1449.cjs} +1 -1
  33. package/dist/{ethers-b54549c2.js → ethers-3699e497.js} +1 -1
  34. package/dist/{id-adc8ed20.js → id-3a9db3a4.js} +1 -1
  35. package/dist/{index-d7e065b9.js → index-01d9066d.js} +1 -1
  36. package/dist/{index-894e5014.js → index-034d865e.js} +1 -1
  37. package/dist/{index-90462b41.js → index-037efcb0.js} +1 -1
  38. package/dist/{index-89255662.js → index-08792dc3.js} +1 -1
  39. package/dist/{index-e79286ee.js → index-39ab0219.js} +1 -1
  40. package/dist/{index-3dd9a47d.js → index-42239632.js} +1 -1
  41. package/dist/index-6ca7c907.js +1 -0
  42. package/dist/{index-0676e514.js → index-8e1d08b5.js} +1 -1
  43. package/dist/{index-614b0395.js → index-a5df01df.js} +1 -1
  44. package/dist/{index-727f157f.js → index-c07e3ffe.js} +1 -1
  45. package/dist/{index.es-db0319f9.js → index.es-852c4086.js} +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/{interface-a49f4a47.js → interface-794f4d58.js} +1 -1
  48. package/dist/{portis-5e1589b3.js → portis-4973bf4d.js} +1 -1
  49. package/dist/{provider-f9f16eed.js → provider-e3fb88f2.js} +1 -1
  50. package/dist/rainbow-63383448.js +1 -0
  51. package/dist/{typed-data-45223455.js → typed-data-987b06fa.js} +1 -1
  52. package/dist/{uAuth-89b8b290.js → uAuth-6aeb1a27.js} +1 -1
  53. package/dist/walletConnect-0d5f67a2.js +1 -0
  54. package/dist/{walletLink-0ec9afe4.js → walletLink-ab6f46dd.js} +1 -1
  55. package/package.json +1 -1
  56. package/dist/__node-resolve_empty-19247ee4.js +0 -1
  57. package/dist/__tslib-d44dfbbf.js +0 -1
  58. package/dist/cjs/__tslib-4964d23b.cjs +0 -1
  59. package/dist/index-6f24054a.js +0 -1
  60. package/dist/rainbow-a64c3525.js +0 -1
  61. package/dist/walletConnect-49c4af8f.js +0 -1
@@ -1 +1 @@
1
- import{_ as e,l as r,m as t,n,E as o,o as s,p as i,u as d}from"./index-e79286ee.js";export{q as getIsCyber}from"./index-e79286ee.js";import{JsonRpcProvider as a}from"@ethersproject/providers";import{getAddress as c}from"@ethersproject/address";import"events";import{hexlify as h}from"@ethersproject/bytes";import{t as p}from"./id-adc8ed20.js";import{T as u}from"./typed-data-45223455.js";import{Signer as l}from"@ethersproject/abstract-signer";import{deepCopy as m}from"@ethersproject/properties";import{f as v}from"./index-89255662.js";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/transactions";import"./__node-resolve_empty-19247ee4.js";class g extends l{constructor(e,r,t,n){super(),this._address=r,this._index=null!=t?t:0,this.provider=e,this.app=n}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e(this,void 0,void 0,(function*(){return Promise.resolve(c(this._address))}))}signMessage(t){return e(this,void 0,void 0,(function*(){const e=r(),n="string"==typeof t?p(t):t,o=yield this.getAddress();return yield e.send("personal_sign",[h(n),o.toLowerCase()])}))}_signTypedData(n,o,s){var i,d;return e(this,void 0,void 0,(function*(){const a=r(),c=yield u.resolveNames(n,o,s,(r=>e(this,void 0,void 0,(function*(){return yield a.resolveName(r)})))),h=null!==(d=null===(i=t())||void 0===i?void 0:i.ownerAddress)&&void 0!==d?d:"";return yield a.send("eth_signTypedData_v4",[h.toLowerCase(),JSON.stringify(u.getPayload(c.domain,o,c.value))])}))}signTransaction(r){return e(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}sendTransaction(r){return e(this,void 0,void 0,(function*(){const e=yield this.getChainId(),t=n(this.app,e);return{hash:yield t.sendTransaction({to:r.to,value:r.value,data:r.data}).catch((e=>{if(e.name===o.SendTransactionError)throw console.error(e.shortMessage),e}))}}))}connect(e){return new g(null!=e?e:this.provider,this._address,this._index,this.app)}connectUnchecked(){return new g(this.provider,this._address,this._index,this.app)}}function f(e){if(e.error){const r=new Error(e.error.message);throw r.code=e.error.code,r.data=e.error.data,r}return e.result}function w(r,t){return e(this,void 0,void 0,(function*(){const n=yield function({appName:r,appLogoUrl:t,rpcUrl:n,rpc:o,chainId:d,cyberParams:h}){return e(this,void 0,void 0,(function*(){if(!r||!t)throw new Error("appName and appLogoUrl is required.");if(!(null==h?void 0:h.appId))throw new Error("cyberParams.appId and appLogoUrl is required.");const{app:p,cyberAccount:u}=yield s({appName:r,appLogoUrl:t,appId:null==h?void 0:h.appId});if(!u)throw new Error("cyberAccount is not valid.");const l=u.address,w=new class extends a{constructor(e,r){super(e,r),this.updateUpWalletConfig=e=>{const r=null==o?void 0:o[e];if(!i.includes(e)||!r)throw new Error(`chainId ${e} not supported`);return this.chainId=e,r&&(this.rpcUrl=r),this.emit("chainChanged",`0x${e.toString(16)}`),{result:!0}},this.rpcUrl=e,this.chainId=d}getSigner(){return new g(w,l,0,p)}listAccounts(){return e(this,void 0,void 0,(function*(){return[l]}))}getNetwork(){return this.chainId?Promise.resolve({chainId:this.chainId,name:"unknown"}):super.getNetwork()}send(e,r){const t={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:m(t),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const o=v({url:this.rpcUrl},JSON.stringify(t),f).then((e=>(this.emit("debug",{action:"response",request:t,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:t,provider:this}),e}));return n&&(this._cache[e]=o,setTimeout((()=>{this._cache[e]=null}),0)),o}getAddress(){return Promise.resolve(c(l))}}(n,d);return w}))}(r);return n.on("connect",t.connect),n.on("disconnect",t.disconnect),n.on("accountsChanged",t.accountsChanged),n.on("chainChanged",t.chainChanged),n.on("message",t.message),n}))}function y(e){var r;const t=e.addChainParameters.chainId,n="string"==typeof t&&(null==t?void 0:t.startsWith("0x"))?parseInt(t,16):Number(t);if(!i.includes(n))throw new Error(`chainId ${n} not supported`);return null===(r=d.getState().provider)||void 0===r?void 0:r.updateUpWalletConfig(n)}export{w as default,y as switchChain};
1
+ import{_ as e,l as r,m as t,n,E as o,o as s,p as i,u as d}from"./index-39ab0219.js";export{q as getIsCyber}from"./index-39ab0219.js";import{JsonRpcProvider as a}from"@ethersproject/providers";import{getAddress as c}from"@ethersproject/address";import"events";import{hexlify as h}from"@ethersproject/bytes";import{t as p}from"./id-3a9db3a4.js";import{T as u}from"./typed-data-987b06fa.js";import{Signer as l}from"@ethersproject/abstract-signer";import{deepCopy as m}from"@ethersproject/properties";import{f as v}from"./index-08792dc3.js";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/transactions";import"./__node-resolve_empty-6899d137.js";class g extends l{constructor(e,r,t,n){super(),this._address=r,this._index=null!=t?t:0,this.provider=e,this.app=n}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e(this,void 0,void 0,(function*(){return Promise.resolve(c(this._address))}))}signMessage(t){return e(this,void 0,void 0,(function*(){const e=r(),n="string"==typeof t?p(t):t,o=yield this.getAddress();return yield e.send("personal_sign",[h(n),o.toLowerCase()])}))}_signTypedData(n,o,s){var i,d;return e(this,void 0,void 0,(function*(){const a=r(),c=yield u.resolveNames(n,o,s,(r=>e(this,void 0,void 0,(function*(){return yield a.resolveName(r)})))),h=null!==(d=null===(i=t())||void 0===i?void 0:i.ownerAddress)&&void 0!==d?d:"";return yield a.send("eth_signTypedData_v4",[h.toLowerCase(),JSON.stringify(u.getPayload(c.domain,o,c.value))])}))}signTransaction(r){return e(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}sendTransaction(r){return e(this,void 0,void 0,(function*(){const e=yield this.getChainId(),t=n(this.app,e);return{hash:yield t.sendTransaction({to:r.to,value:r.value,data:r.data}).catch((e=>{if(e.name===o.SendTransactionError)throw console.error(e.shortMessage),e}))}}))}connect(e){return new g(null!=e?e:this.provider,this._address,this._index,this.app)}connectUnchecked(){return new g(this.provider,this._address,this._index,this.app)}}function f(e){if(e.error){const r=new Error(e.error.message);throw r.code=e.error.code,r.data=e.error.data,r}return e.result}function w(r,t){return e(this,void 0,void 0,(function*(){const n=yield function({appName:r,appLogoUrl:t,rpcUrl:n,rpc:o,chainId:d,cyberParams:h}){return e(this,void 0,void 0,(function*(){if(!r||!t)throw new Error("appName and appLogoUrl is required.");if(!(null==h?void 0:h.appId))throw new Error("cyberParams.appId and appLogoUrl is required.");const{app:p,cyberAccount:u}=yield s({appName:r,appLogoUrl:t,appId:null==h?void 0:h.appId});if(!u)throw new Error("cyberAccount is not valid.");const l=u.address,w=new class extends a{constructor(e,r){super(e,r),this.updateUpWalletConfig=e=>{const r=null==o?void 0:o[e];if(!i.includes(e)||!r)throw new Error(`chainId ${e} not supported`);return this.chainId=e,r&&(this.rpcUrl=r),this.emit("chainChanged",`0x${e.toString(16)}`),{result:!0}},this.rpcUrl=e,this.chainId=d}getSigner(){return new g(w,l,0,p)}listAccounts(){return e(this,void 0,void 0,(function*(){return[l]}))}getNetwork(){return this.chainId?Promise.resolve({chainId:this.chainId,name:"unknown"}):super.getNetwork()}send(e,r){const t={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:m(t),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const o=v({url:this.rpcUrl},JSON.stringify(t),f).then((e=>(this.emit("debug",{action:"response",request:t,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:t,provider:this}),e}));return n&&(this._cache[e]=o,setTimeout((()=>{this._cache[e]=null}),0)),o}getAddress(){return Promise.resolve(c(l))}}(n,d);return w}))}(r);return n.on("connect",t.connect),n.on("disconnect",t.disconnect),n.on("accountsChanged",t.accountsChanged),n.on("chainChanged",t.chainChanged),n.on("message",t.message),n}))}function y(e){var r;const t=e.addChainParameters.chainId,n="string"==typeof t&&(null==t?void 0:t.startsWith("0x"))?parseInt(t,16):Number(t);if(!i.includes(n))throw new Error(`chainId ${n} not supported`);return null===(r=d.getState().provider)||void 0===r?void 0:r.updateUpWalletConfig(n)}export{w as default,y as switchChain};
@@ -1 +1 @@
1
- import{arrayify as e,isBytesLike as t,hexlify as r}from"@ethersproject/bytes";import{shallowCopy as o}from"@ethersproject/properties";import{L as n,t as s,a as i}from"./id-adc8ed20.js";function l(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function c(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var a=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};function u(t,r){return a(this,void 0,void 0,(function*(){null==r&&(r={});const o={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(o.mode="cors",o.cache="no-cache",o.credentials="same-origin",o.redirect="follow",o.referrer="client"),null!=r.fetchOptions){const e=r.fetchOptions;e.mode&&(o.mode=e.mode),e.cache&&(o.cache=e.cache),e.credentials&&(o.credentials=e.credentials),e.redirect&&(o.redirect=e.redirect),e.referrer&&(o.referrer=e.referrer)}const n=yield fetch(t,o),s=yield n.arrayBuffer(),i={};return n.headers.forEach?n.headers.forEach(((e,t)=>{i[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{i[e.toLowerCase()]=n.headers.get(e)})),{headers:i,statusCode:n.status,statusMessage:n.statusText,body:e(new Uint8Array(s))}}))}var h=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};const d=new n("web/5.7.1");function f(e){return new Promise((t=>{setTimeout(t,e)}))}function p(e,o){if(null==e)return null;if("string"==typeof e)return e;if(t(e)){if(o&&("text"===o.split("/")[0]||"application/json"===o.split(";")[0].trim()))try{return i(e)}catch(e){}return r(e)}return e}function y(e,t,r){const i="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const a="object"==typeof e?e.throttleCallback:null,y="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(y>0&&y%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",y);const m="object"==typeof e&&!!e.errorPassThrough,E={};let g=null;const w={method:"GET"};let b=!1,R=12e4;if("string"==typeof e)g=e;else if("object"==typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),g=e.url,"number"==typeof e.timeout&&e.timeout>0&&(R=e.timeout),e.headers)for(const t in e.headers)E[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(b=!0);if(w.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==g.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",n.errors.INVALID_ARGUMENT,{argument:"url",url:g,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;E.authorization={key:"Authorization",value:"Basic "+c(s(t))}}null!=e.skipFetchSetup&&(w.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(w.fetchOptions=o(e.fetchOptions))}const v=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),C=g?g.match(v):null;if(C)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":C[1]||"text/plain"},body:C[2]?l(C[3]):(S=C[3],s(S.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(C[1],C[2]),error:e,requestBody:null,requestMethod:"GET",url:g})}var S;t&&(w.method="POST",w.body=t,null==E["content-type"]&&(E["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==E["content-length"]&&(E["content-length"]={key:"Content-Length",value:String(t.length)}));const O={};Object.keys(E).forEach((e=>{const t=E[e];O[t.key]=t.value})),w.headers=O;const T=function(){let e=null;return{promise:new Promise((function(t,r){R&&(e=setTimeout((()=>{null!=e&&(e=null,r(d.makeError("timeout",n.errors.TIMEOUT,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,timeout:R,url:g})))}),R))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),k=function(){return h(this,void 0,void 0,(function*(){for(let e=0;e<i;e++){let t=null;try{if(t=yield u(g,w),e<i)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===w.method&&e.match(/^https:/)){g=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(a&&(r=yield a(e,g)),r){let r=0;const o=t.headers["retry-after"];r="string"==typeof o&&o.match(/^[1-9][0-9]*$/)?1e3*parseInt(o):y*parseInt(String(Math.random()*Math.pow(2,e))),yield f(r);continue}}}catch(e){t=e.response,null==t&&(T.cancel(),d.throwError("missing response",n.errors.SERVER_ERROR,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,serverError:e,url:g}))}let o=t.body;if(b&&304===t.statusCode?o=null:!m&&(t.statusCode<200||t.statusCode>=300)&&(T.cancel(),d.throwError("bad response",n.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:p(o,t.headers?t.headers["content-type"]:null),requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})),r)try{const e=yield r(o,t);return T.cancel(),e}catch(r){if(r.throttleRetry&&e<i){let t=!0;if(a&&(t=yield a(e,g)),t){const t=y*parseInt(String(Math.random()*Math.pow(2,e)));yield f(t);continue}}T.cancel(),d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(o,t.headers?t.headers["content-type"]:null),error:r,requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})}return T.cancel(),o}return d.throwError("failed response",n.errors.SERVER_ERROR,{requestBody:p(w.body,O["content-type"]),requestMethod:w.method,url:g})}))}();return Promise.race([T.promise,k])}function m(e,t,r){let l=null;if(null!=t){l=s(t);const r="string"==typeof e?{url:e}:o(e);if(r.headers){0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=o(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return y(e,l,((e,t)=>{let o=null;if(null!=e)try{o=JSON.parse(i(e))}catch(t){d.throwError("invalid JSON",n.errors.SERVER_ERROR,{body:e,error:t})}return r&&(o=r(o,t)),o}))}function E(e,t){return t||(t={}),null==(t=o(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,o){let n=null,s=!1;const i=()=>!s&&(s=!0,n&&clearTimeout(n),!0);t.timeout&&(n=setTimeout((()=>{i()&&o(new Error("timeout"))}),t.timeout));const l=t.retryLimit;let c=0;!function n(){return e().then((function(e){if(void 0!==e)i()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",n);else if(t.onceBlock)t.onceBlock.once("block",n);else if(!s){if(c++,c>l)return void(i()&&o(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(n,e)}return null}),(function(e){i()&&o(e)}))}()}))}var g=Object.freeze({__proto__:null,_fetchData:y,fetchJson:m,poll:E});export{y as _,l as d,c as e,m as f,g as l,E as p};
1
+ import{arrayify as e,isBytesLike as t,hexlify as r}from"@ethersproject/bytes";import{shallowCopy as o}from"@ethersproject/properties";import{L as n,t as s,a as i}from"./id-3a9db3a4.js";function l(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function c(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var a=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};function u(t,r){return a(this,void 0,void 0,(function*(){null==r&&(r={});const o={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(o.mode="cors",o.cache="no-cache",o.credentials="same-origin",o.redirect="follow",o.referrer="client"),null!=r.fetchOptions){const e=r.fetchOptions;e.mode&&(o.mode=e.mode),e.cache&&(o.cache=e.cache),e.credentials&&(o.credentials=e.credentials),e.redirect&&(o.redirect=e.redirect),e.referrer&&(o.referrer=e.referrer)}const n=yield fetch(t,o),s=yield n.arrayBuffer(),i={};return n.headers.forEach?n.headers.forEach(((e,t)=>{i[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{i[e.toLowerCase()]=n.headers.get(e)})),{headers:i,statusCode:n.status,statusMessage:n.statusText,body:e(new Uint8Array(s))}}))}var h=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function l(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};const d=new n("web/5.7.1");function f(e){return new Promise((t=>{setTimeout(t,e)}))}function p(e,o){if(null==e)return null;if("string"==typeof e)return e;if(t(e)){if(o&&("text"===o.split("/")[0]||"application/json"===o.split(";")[0].trim()))try{return i(e)}catch(e){}return r(e)}return e}function y(e,t,r){const i="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const a="object"==typeof e?e.throttleCallback:null,y="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(y>0&&y%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",y);const m="object"==typeof e&&!!e.errorPassThrough,E={};let b=null;const g={method:"GET"};let w=!1,R=12e4;if("string"==typeof e)b=e;else if("object"==typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),b=e.url,"number"==typeof e.timeout&&e.timeout>0&&(R=e.timeout),e.headers)for(const t in e.headers)E[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(w=!0);if(g.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==b.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",n.errors.INVALID_ARGUMENT,{argument:"url",url:b,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;E.authorization={key:"Authorization",value:"Basic "+c(s(t))}}null!=e.skipFetchSetup&&(g.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(g.fetchOptions=o(e.fetchOptions))}const v=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),C=b?b.match(v):null;if(C)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":C[1]||"text/plain"},body:C[2]?l(C[3]):(S=C[3],s(S.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(C[1],C[2]),error:e,requestBody:null,requestMethod:"GET",url:b})}var S;t&&(g.method="POST",g.body=t,null==E["content-type"]&&(E["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==E["content-length"]&&(E["content-length"]={key:"Content-Length",value:String(t.length)}));const O={};Object.keys(E).forEach((e=>{const t=E[e];O[t.key]=t.value})),g.headers=O;const T=function(){let e=null;return{promise:new Promise((function(t,r){R&&(e=setTimeout((()=>{null!=e&&(e=null,r(d.makeError("timeout",n.errors.TIMEOUT,{requestBody:p(g.body,O["content-type"]),requestMethod:g.method,timeout:R,url:b})))}),R))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),k=function(){return h(this,void 0,void 0,(function*(){for(let e=0;e<i;e++){let t=null;try{if(t=yield u(b,g),e<i)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===g.method&&e.match(/^https:/)){b=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(a&&(r=yield a(e,b)),r){let r=0;const o=t.headers["retry-after"];r="string"==typeof o&&o.match(/^[1-9][0-9]*$/)?1e3*parseInt(o):y*parseInt(String(Math.random()*Math.pow(2,e))),yield f(r);continue}}}catch(e){t=e.response,null==t&&(T.cancel(),d.throwError("missing response",n.errors.SERVER_ERROR,{requestBody:p(g.body,O["content-type"]),requestMethod:g.method,serverError:e,url:b}))}let o=t.body;if(w&&304===t.statusCode?o=null:!m&&(t.statusCode<200||t.statusCode>=300)&&(T.cancel(),d.throwError("bad response",n.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:p(o,t.headers?t.headers["content-type"]:null),requestBody:p(g.body,O["content-type"]),requestMethod:g.method,url:b})),r)try{const e=yield r(o,t);return T.cancel(),e}catch(r){if(r.throttleRetry&&e<i){let t=!0;if(a&&(t=yield a(e,b)),t){const t=y*parseInt(String(Math.random()*Math.pow(2,e)));yield f(t);continue}}T.cancel(),d.throwError("processing response error",n.errors.SERVER_ERROR,{body:p(o,t.headers?t.headers["content-type"]:null),error:r,requestBody:p(g.body,O["content-type"]),requestMethod:g.method,url:b})}return T.cancel(),o}return d.throwError("failed response",n.errors.SERVER_ERROR,{requestBody:p(g.body,O["content-type"]),requestMethod:g.method,url:b})}))}();return Promise.race([T.promise,k])}function m(e,t,r){let l=null;if(null!=t){l=s(t);const r="string"==typeof e?{url:e}:o(e);if(r.headers){0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=o(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return y(e,l,((e,t)=>{let o=null;if(null!=e)try{o=JSON.parse(i(e))}catch(t){d.throwError("invalid JSON",n.errors.SERVER_ERROR,{body:e,error:t})}return r&&(o=r(o,t)),o}))}function E(e,t){return t||(t={}),null==(t=o(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,o){let n=null,s=!1;const i=()=>!s&&(s=!0,n&&clearTimeout(n),!0);t.timeout&&(n=setTimeout((()=>{i()&&o(new Error("timeout"))}),t.timeout));const l=t.retryLimit;let c=0;!function n(){return e().then((function(e){if(void 0!==e)i()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",n);else if(t.onceBlock)t.onceBlock.once("block",n);else if(!s){if(c++,c>l)return void(i()&&o(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(n,e)}return null}),(function(e){i()&&o(e)}))}()}))}var b=Object.freeze({__proto__:null,_fetchData:y,fetchJson:m,poll:E});export{y as _,l as d,c as e,m as f,b as l,E as p};