@dodoex/wallet-web3 0.0.41 → 0.0.42
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.
- package/dist/{DefaultJsonRpcProvider-81dbd3f9.js → DefaultJsonRpcProvider-470545c2.js} +1 -1
- package/dist/__node-resolve_empty-f90bb206.js +1 -0
- package/dist/__tslib-041a522f.js +1 -0
- package/dist/{blocto-a553b391.js → blocto-a613e3ea.js} +1 -1
- package/dist/{bn-8f7cc9b5.js → bn-a73d500d.js} +1 -1
- package/dist/{browser-ponyfill-4134b2b7.js → browser-ponyfill-5a72503b.js} +1 -1
- package/dist/cjs/{DefaultJsonRpcProvider-851de86a.cjs → DefaultJsonRpcProvider-1b124fcf.cjs} +1 -1
- package/dist/cjs/{__node-resolve_empty-04cc3662.cjs → __node-resolve_empty-c6c4d691.cjs} +1 -1
- package/dist/cjs/__tslib-74b92aa0.cjs +1 -0
- package/dist/cjs/{blocto-1d2d3abc.cjs → blocto-54eeaf0e.cjs} +1 -1
- package/dist/cjs/{bn-8a65a921.cjs → bn-5799deeb.cjs} +1 -1
- package/dist/cjs/{browser-ponyfill-96a14706.cjs → browser-ponyfill-98c87b2b.cjs} +1 -1
- package/dist/cjs/{draggabilly-326f0353.cjs → draggabilly-0280fdd9.cjs} +1 -1
- package/dist/cjs/{ethers-c6e7830c.cjs → ethers-1f3c68c5.cjs} +1 -1
- package/dist/cjs/{id-ac2184da.cjs → id-f0a49000.cjs} +1 -1
- package/dist/cjs/{index-4685dfbc.cjs → index-1334a219.cjs} +2 -2
- package/dist/cjs/{index-c6a78b5c.cjs → index-26ef8efb.cjs} +1 -1
- package/dist/cjs/{index-b3a93c7d.cjs → index-47b72555.cjs} +1 -1
- package/dist/cjs/{index-97c32dcf.cjs → index-5d2a4d45.cjs} +1 -1
- package/dist/cjs/{index-01b3872e.cjs → index-7c8afb3d.cjs} +1 -1
- package/dist/cjs/{index-8d32723e.cjs → index-876f807b.cjs} +1 -1
- package/dist/cjs/{index-4f46ab04.cjs → index-965f574d.cjs} +1 -1
- package/dist/cjs/{index-6130f88a.cjs → index-9c3d3910.cjs} +2 -2
- package/dist/cjs/{index-38a82c12.cjs → index-ade355c8.cjs} +1 -1
- package/dist/cjs/{index-d89005f4.cjs → index-dbfff00c.cjs} +1 -1
- package/dist/cjs/{index-823d3a25.cjs → index-eeb0556a.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-168fe2b1.cjs → index.es-d8a23b8c.cjs} +1 -1
- package/dist/cjs/{interface-f6b53727.cjs → interface-32ec049c.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-05755aa6.cjs → lib-typedarrays-c773181b.cjs} +1 -1
- package/dist/cjs/{portis-7873ce6a.cjs → portis-7b794882.cjs} +1 -1
- package/dist/cjs/{provider-d7c647ea.cjs → provider-73c10a83.cjs} +1 -1
- package/dist/cjs/providers/connector/injected.d.ts +1 -1
- package/dist/cjs/providers/connector/types.d.ts +1 -0
- package/dist/cjs/{rainbow-43c8e5f6.cjs → rainbow-59104eb0.cjs} +1 -1
- package/dist/cjs/sha224-c7a50394.cjs +1 -0
- package/dist/cjs/{sha256-7cc68713.cjs → sha256-33ca448e.cjs} +1 -1
- package/dist/cjs/{uAuth-6aa71b34.cjs → uAuth-2de77cf5.cjs} +1 -1
- package/dist/cjs/walletConnect-23c4ab09.cjs +1 -0
- package/dist/cjs/{walletLink-eb56d177.cjs → walletLink-e9532414.cjs} +1 -1
- package/dist/{draggabilly-291f869b.js → draggabilly-186183f4.js} +1 -1
- package/dist/{ethers-f8f094be.js → ethers-5bf5b00b.js} +1 -1
- package/dist/{id-dcb529f4.js → id-f73e9185.js} +1 -1
- package/dist/{index-a1df7720.js → index-4a260eae.js} +1 -1
- package/dist/{index-e3070128.js → index-4a2d9b19.js} +1 -1
- package/dist/{index-20ce8a4c.js → index-66448990.js} +1 -1
- package/dist/{index-cebac794.js → index-687aa034.js} +2 -2
- package/dist/{index-bc061f7b.js → index-8cc67274.js} +1 -1
- package/dist/{index-cec5c507.js → index-9ef93cee.js} +1 -1
- package/dist/{index-7a7a090a.js → index-b7b5de53.js} +1 -1
- package/dist/{index-89a7e976.js → index-d18b1515.js} +1 -1
- package/dist/index-ec768c82.js +1 -0
- package/dist/{index-914dc773.js → index-fca1a0c3.js} +1 -1
- package/dist/{index-4e6b81d8.js → index-fdf822d6.js} +1 -1
- package/dist/{index.es-b6986074.js → index.es-d0dcd244.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-6c3ec32a.js → interface-cd17b51d.js} +1 -1
- package/dist/{lib-typedarrays-f1051e37.js → lib-typedarrays-b049d0e6.js} +1 -1
- package/dist/{portis-6c321b6b.js → portis-eedfe5a8.js} +1 -1
- package/dist/{provider-0a241f15.js → provider-cc8e4040.js} +1 -1
- package/dist/providers/connector/injected.d.ts +1 -1
- package/dist/providers/connector/types.d.ts +1 -0
- package/dist/rainbow-bc431cfa.js +1 -0
- package/dist/sha224-882535a5.js +1 -0
- package/dist/{sha256-79cd8cb2.js → sha256-081247ed.js} +1 -1
- package/dist/{uAuth-57530103.js → uAuth-acbb6033.js} +1 -1
- package/dist/walletConnect-622e5dfc.js +1 -0
- package/dist/{walletLink-7f641f02.js → walletLink-90f5ac8d.js} +1 -1
- package/package.json +1 -1
- package/dist/__node-resolve_empty-314df16e.js +0 -1
- package/dist/__tslib-895a7349.js +0 -1
- package/dist/cjs/__tslib-07f80053.cjs +0 -1
- package/dist/cjs/sha224-86e8cc7f.cjs +0 -1
- package/dist/cjs/walletConnect-b0df4f12.cjs +0 -1
- package/dist/index-cbfb042c.js +0 -1
- package/dist/rainbow-43a583fd.js +0 -1
- package/dist/sha224-1e5a1736.js +0 -1
- package/dist/walletConnect-dc900305.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAddress as t}from"@ethersproject/address";import{arrayify as e,hexZeroPad as r,hexConcat as n,isHexString as o,hexlify as i,isBytesLike as s}from"@ethersproject/bytes";import{k as a}from"./index-bc061f7b.js";import{defineReadOnly as c,deepCopy as u,shallowCopy as l}from"@ethersproject/properties";import{L as f,B as h,i as d,t as y,a as m}from"./id-dcb529f4.js";const p="hash/5.7.0";function g(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function v(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var E=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const w=new f(p),b=new Uint8Array(32);b.fill(0);const S=h.from(-1),C=h.from(0),O=h.from(1),R=h.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(O.toHexString(),32),x=r(C.toHexString(),32),T={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k=["name","version","chainId","verifyingContract","salt"];function _(t){return function(e){return"string"!=typeof e&&w.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const I={name:_("name"),version:_("version"),chainId:function(t){try{return h.from(t).toString()}catch(t){}return w.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(e){try{return t(e).toLowerCase()}catch(t){}return w.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(t){try{const r=e(t);if(32!==r.length)throw new Error("bad length");return i(r)}catch(t){}return w.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function j(o){{const t=o.match(/^(u?)int(\d*)$/);if(t){const e=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&w.throwArgumentError("invalid numeric width","type",o);const i=R.mask(e?n-1:n),s=e?i.add(O).mul(S):C;return function(t){const e=h.from(t);return(e.lt(s)||e.gt(i))&&w.throwArgumentError(`value out-of-bounds for ${o}`,"value",t),r(e.toTwos(256).toHexString(),32)}}}{const t=o.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&w.throwArgumentError("invalid bytes width","type",o),function(t){return e(t).length!==r&&w.throwArgumentError(`invalid length for ${o}`,"value",t),function(t){const r=e(t),o=r.length%32;return o?n([r,b.slice(o)]):i(r)}(t)}}}switch(o){case"address":return function(e){return r(t(e),32)};case"bool":return function(t){return t?A:x};case"bytes":return function(t){return a(t)};case"string":return function(t){return d(t)}}return null}function $(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class P{constructor(t){c(this,"types",Object.freeze(u(t))),c(this,"_encoderCache",{}),c(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const o={};t[n].forEach((i=>{o[i.name]&&w.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(n)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&w.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);j(s)||(r[s]||w.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const o=Object.keys(r).filter((t=>0===r[t].length));0===o.length?w.throwArgumentError("missing primary type","types",t):o.length>1&&w.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),c(this,"primaryType",o[0]),function o(i,s){s[i]&&w.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(e[i]).forEach((t=>{r[t]&&(o(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=$(e,t[e])+r.map((e=>$(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=j(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),o=parseInt(e[3]);return e=>{o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(a)),a(n(i))}}const r=this.types[t];if(r){const e=d(this._types[t]);return t=>{const o=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?a(n):n}));return o.unshift(e),n(o)}}return w.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||w.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return a(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(j(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],o=parseInt(n[3]);return o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const o=this.types[t];return o?o.reduce(((t,{name:n,type:o})=>(t[n]=this._visit(o,e[n],r),t)),{}):w.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new P(t)}static getPrimaryType(t){return P.from(t).primaryType}static hashStruct(t,e,r){return P.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=T[r];n||w.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>k.indexOf(t.name)-k.indexOf(e.name))),P.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return n(["0x1901",P.hashDomain(t),P.from(e).hash(r)])}static hash(t,e,r){return a(P.encode(t,e,r))}static resolveNames(t,e,r,n){return E(this,void 0,void 0,(function*(){t=l(t);const i={};t.verifyingContract&&!o(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=P.from(e);s.visit(r,((t,e)=>("address"!==t||o(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=s.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,r,n){P.hashDomain(t);const o={},s=[];k.forEach((e=>{const r=t[e];null!=r&&(o[e]=I[e](r),s.push({name:e,type:T[e]}))}));const a=P.from(r),c=l(r);return c.EIP712Domain?w.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):c.EIP712Domain=s,a.encode(n),{types:c,domain:o,primaryType:a.primaryType,message:a.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return i(e(r));if(t.match(/^u?int/))return h.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&w.throwArgumentError("invalid string","value",r),r}return w.throwArgumentError("unsupported type","type",t)}))}}}var L=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};function D(t,r){return L(this,void 0,void 0,(function*(){null==r&&(r={});const n={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=r.fetchOptions){const t=r.fetchOptions;t.mode&&(n.mode=t.mode),t.cache&&(n.cache=t.cache),t.credentials&&(n.credentials=t.credentials),t.redirect&&(n.redirect=t.redirect),t.referrer&&(n.referrer=t.referrer)}const o=yield fetch(t,n),i=yield o.arrayBuffer(),s={};return o.headers.forEach?o.headers.forEach(((t,e)=>{s[e.toLowerCase()]=t})):o.headers.keys().forEach((t=>{s[t.toLowerCase()]=o.headers.get(t)})),{headers:s,statusCode:o.status,statusMessage:o.statusText,body:e(new Uint8Array(i))}}))}var M=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const N=new f("web/5.7.1");function q(t){return new Promise((e=>{setTimeout(e,t)}))}function J(t,e){if(null==t)return null;if("string"==typeof t)return t;if(s(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return m(t)}catch(t){}return i(t)}return t}function B(t,e,r){const n="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;N.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const o="object"==typeof t?t.throttleCallback:null,i="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;N.assertArgument(i>0&&i%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",i);const s="object"==typeof t&&!!t.errorPassThrough,a={};let c=null;const u={method:"GET"};let h=!1,d=12e4;if("string"==typeof t)c=t;else if("object"==typeof t){if(null!=t&&null!=t.url||N.throwArgumentError("missing URL","connection.url",t),c=t.url,"number"==typeof t.timeout&&t.timeout>0&&(d=t.timeout),t.headers)for(const e in t.headers)a[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(h=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==c.substring(0,6)&&!0!==t.allowInsecureAuthentication&&N.throwError("basic authentication requires a secure https url",f.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+v(y(e))}}null!=t.skipFetchSetup&&(u.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(u.fetchOptions=l(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),p=c?c.match(m):null;if(p)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":p[1]||"text/plain"},body:p[2]?g(p[3]):(E=p[3],y(E.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(p[1],p[2]),error:t,requestBody:null,requestMethod:"GET",url:c})}var E;e&&(u.method="POST",u.body=e,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const w={};Object.keys(a).forEach((t=>{const e=a[t];w[e.key]=e.value})),u.headers=w;const b=function(){let t=null;return{promise:new Promise((function(e,r){d&&(t=setTimeout((()=>{null!=t&&(t=null,r(N.makeError("timeout",f.errors.TIMEOUT,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,timeout:d,url:c})))}),d))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),S=function(){return M(this,void 0,void 0,(function*(){for(let t=0;t<n;t++){let e=null;try{if(e=yield D(c,u),t<n)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===u.method&&t.match(/^https:/)){c=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(o&&(r=yield o(t,c)),r){let r=0;const n=e.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):i*parseInt(String(Math.random()*Math.pow(2,t))),yield q(r);continue}}}catch(t){e=t.response,null==e&&(b.cancel(),N.throwError("missing response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,serverError:t,url:c}))}let a=e.body;if(h&&304===e.statusCode?a=null:!s&&(e.statusCode<200||e.statusCode>=300)&&(b.cancel(),N.throwError("bad response",f.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:J(a,e.headers?e.headers["content-type"]:null),requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})),r)try{const t=yield r(a,e);return b.cancel(),t}catch(r){if(r.throttleRetry&&t<n){let e=!0;if(o&&(e=yield o(t,c)),e){const e=i*parseInt(String(Math.random()*Math.pow(2,t)));yield q(e);continue}}b.cancel(),N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(a,e.headers?e.headers["content-type"]:null),error:r,requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}return b.cancel(),a}return N.throwError("failed response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}))}();return Promise.race([b.promise,S])}function G(t,e,r){let n=null;if(null!=e){n=y(e);const r="string"==typeof t?{url:t}:l(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=l(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return B(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(m(t))}catch(e){N.throwError("invalid JSON",f.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function V(t,e){return e||(e={}),null==(e=l(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let o=null,i=!1;const s=()=>!i&&(i=!0,o&&clearTimeout(o),!0);e.timeout&&(o=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let c=0;!function o(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",o);else if(e.onceBlock)e.onceBlock.once("block",o);else if(!i){if(c++,c>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(o,t)}return null}),(function(t){s()&&n(t)}))}()}))}var z=Object.freeze({__proto__:null,_fetchData:B,fetchJson:G,poll:V});export{P as T,B as _,g as d,v as e,G as f,z as l,V as p,p as v};
|
|
1
|
+
import{getAddress as t}from"@ethersproject/address";import{arrayify as e,hexZeroPad as r,hexConcat as n,isHexString as o,hexlify as i,isBytesLike as s}from"@ethersproject/bytes";import{k as a}from"./index-8cc67274.js";import{defineReadOnly as c,deepCopy as u,shallowCopy as l}from"@ethersproject/properties";import{L as f,B as h,i as d,t as y,a as m}from"./id-f73e9185.js";const p="hash/5.7.0";function g(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e(r)}function v(t){t=e(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var E=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const w=new f(p),b=new Uint8Array(32);b.fill(0);const S=h.from(-1),C=h.from(0),O=h.from(1),R=h.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(O.toHexString(),32),x=r(C.toHexString(),32),T={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k=["name","version","chainId","verifyingContract","salt"];function _(t){return function(e){return"string"!=typeof e&&w.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const I={name:_("name"),version:_("version"),chainId:function(t){try{return h.from(t).toString()}catch(t){}return w.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(e){try{return t(e).toLowerCase()}catch(t){}return w.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(t){try{const r=e(t);if(32!==r.length)throw new Error("bad length");return i(r)}catch(t){}return w.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function j(o){{const t=o.match(/^(u?)int(\d*)$/);if(t){const e=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&w.throwArgumentError("invalid numeric width","type",o);const i=R.mask(e?n-1:n),s=e?i.add(O).mul(S):C;return function(t){const e=h.from(t);return(e.lt(s)||e.gt(i))&&w.throwArgumentError(`value out-of-bounds for ${o}`,"value",t),r(e.toTwos(256).toHexString(),32)}}}{const t=o.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&w.throwArgumentError("invalid bytes width","type",o),function(t){return e(t).length!==r&&w.throwArgumentError(`invalid length for ${o}`,"value",t),function(t){const r=e(t),o=r.length%32;return o?n([r,b.slice(o)]):i(r)}(t)}}}switch(o){case"address":return function(e){return r(t(e),32)};case"bool":return function(t){return t?A:x};case"bytes":return function(t){return a(t)};case"string":return function(t){return d(t)}}return null}function $(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class P{constructor(t){c(this,"types",Object.freeze(u(t))),c(this,"_encoderCache",{}),c(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const o={};t[n].forEach((i=>{o[i.name]&&w.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(n)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&w.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);j(s)||(r[s]||w.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const o=Object.keys(r).filter((t=>0===r[t].length));0===o.length?w.throwArgumentError("missing primary type","types",t):o.length>1&&w.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),c(this,"primaryType",o[0]),function o(i,s){s[i]&&w.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(e[i]).forEach((t=>{r[t]&&(o(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=$(e,t[e])+r.map((e=>$(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=j(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),o=parseInt(e[3]);return e=>{o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(a)),a(n(i))}}const r=this.types[t];if(r){const e=d(this._types[t]);return t=>{const o=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?a(n):n}));return o.unshift(e),n(o)}}return w.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||w.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return a(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(j(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],o=parseInt(n[3]);return o>=0&&e.length!==o&&w.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const o=this.types[t];return o?o.reduce(((t,{name:n,type:o})=>(t[n]=this._visit(o,e[n],r),t)),{}):w.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new P(t)}static getPrimaryType(t){return P.from(t).primaryType}static hashStruct(t,e,r){return P.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=T[r];n||w.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>k.indexOf(t.name)-k.indexOf(e.name))),P.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return n(["0x1901",P.hashDomain(t),P.from(e).hash(r)])}static hash(t,e,r){return a(P.encode(t,e,r))}static resolveNames(t,e,r,n){return E(this,void 0,void 0,(function*(){t=l(t);const i={};t.verifyingContract&&!o(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=P.from(e);s.visit(r,((t,e)=>("address"!==t||o(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=s.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,r,n){P.hashDomain(t);const o={},s=[];k.forEach((e=>{const r=t[e];null!=r&&(o[e]=I[e](r),s.push({name:e,type:T[e]}))}));const a=P.from(r),c=l(r);return c.EIP712Domain?w.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):c.EIP712Domain=s,a.encode(n),{types:c,domain:o,primaryType:a.primaryType,message:a.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return i(e(r));if(t.match(/^u?int/))return h.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&w.throwArgumentError("invalid string","value",r),r}return w.throwArgumentError("unsupported type","type",t)}))}}}var L=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};function D(t,r){return L(this,void 0,void 0,(function*(){null==r&&(r={});const n={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=r.fetchOptions){const t=r.fetchOptions;t.mode&&(n.mode=t.mode),t.cache&&(n.cache=t.cache),t.credentials&&(n.credentials=t.credentials),t.redirect&&(n.redirect=t.redirect),t.referrer&&(n.referrer=t.referrer)}const o=yield fetch(t,n),i=yield o.arrayBuffer(),s={};return o.headers.forEach?o.headers.forEach(((t,e)=>{s[e.toLowerCase()]=t})):o.headers.keys().forEach((t=>{s[t.toLowerCase()]=o.headers.get(t)})),{headers:s,statusCode:o.status,statusMessage:o.statusText,body:e(new Uint8Array(i))}}))}var M=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};const N=new f("web/5.7.1");function q(t){return new Promise((e=>{setTimeout(e,t)}))}function J(t,e){if(null==t)return null;if("string"==typeof t)return t;if(s(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return m(t)}catch(t){}return i(t)}return t}function B(t,e,r){const n="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;N.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const o="object"==typeof t?t.throttleCallback:null,i="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;N.assertArgument(i>0&&i%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",i);const s="object"==typeof t&&!!t.errorPassThrough,a={};let c=null;const u={method:"GET"};let h=!1,d=12e4;if("string"==typeof t)c=t;else if("object"==typeof t){if(null!=t&&null!=t.url||N.throwArgumentError("missing URL","connection.url",t),c=t.url,"number"==typeof t.timeout&&t.timeout>0&&(d=t.timeout),t.headers)for(const e in t.headers)a[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(h=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==c.substring(0,6)&&!0!==t.allowInsecureAuthentication&&N.throwError("basic authentication requires a secure https url",f.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+v(y(e))}}null!=t.skipFetchSetup&&(u.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(u.fetchOptions=l(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),p=c?c.match(m):null;if(p)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":p[1]||"text/plain"},body:p[2]?g(p[3]):(E=p[3],y(E.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(p[1],p[2]),error:t,requestBody:null,requestMethod:"GET",url:c})}var E;e&&(u.method="POST",u.body=e,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const w={};Object.keys(a).forEach((t=>{const e=a[t];w[e.key]=e.value})),u.headers=w;const b=function(){let t=null;return{promise:new Promise((function(e,r){d&&(t=setTimeout((()=>{null!=t&&(t=null,r(N.makeError("timeout",f.errors.TIMEOUT,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,timeout:d,url:c})))}),d))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),S=function(){return M(this,void 0,void 0,(function*(){for(let t=0;t<n;t++){let e=null;try{if(e=yield D(c,u),t<n)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===u.method&&t.match(/^https:/)){c=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(o&&(r=yield o(t,c)),r){let r=0;const n=e.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):i*parseInt(String(Math.random()*Math.pow(2,t))),yield q(r);continue}}}catch(t){e=t.response,null==e&&(b.cancel(),N.throwError("missing response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,serverError:t,url:c}))}let a=e.body;if(h&&304===e.statusCode?a=null:!s&&(e.statusCode<200||e.statusCode>=300)&&(b.cancel(),N.throwError("bad response",f.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:J(a,e.headers?e.headers["content-type"]:null),requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})),r)try{const t=yield r(a,e);return b.cancel(),t}catch(r){if(r.throttleRetry&&t<n){let e=!0;if(o&&(e=yield o(t,c)),e){const e=i*parseInt(String(Math.random()*Math.pow(2,t)));yield q(e);continue}}b.cancel(),N.throwError("processing response error",f.errors.SERVER_ERROR,{body:J(a,e.headers?e.headers["content-type"]:null),error:r,requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}return b.cancel(),a}return N.throwError("failed response",f.errors.SERVER_ERROR,{requestBody:J(u.body,w["content-type"]),requestMethod:u.method,url:c})}))}();return Promise.race([b.promise,S])}function G(t,e,r){let n=null;if(null!=e){n=y(e);const r="string"==typeof t?{url:t}:l(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=l(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return B(t,n,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(m(t))}catch(e){N.throwError("invalid JSON",f.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function V(t,e){return e||(e={}),null==(e=l(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,n){let o=null,i=!1;const s=()=>!i&&(i=!0,o&&clearTimeout(o),!0);e.timeout&&(o=setTimeout((()=>{s()&&n(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let c=0;!function o(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",o);else if(e.onceBlock)e.onceBlock.once("block",o);else if(!i){if(c++,c>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(o,t)}return null}),(function(t){s()&&n(t)}))}()}))}var z=Object.freeze({__proto__:null,_fetchData:B,fetchJson:G,poll:V});export{P as T,B as _,g as d,v as e,G as f,z as l,V as p,p as v};
|