@dodoex/wallet-web3 0.0.41-1 → 0.0.41-2
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-ae4e010b.js → DefaultJsonRpcProvider-583987df.js} +1 -1
- package/dist/__node-resolve_empty-0b485399.js +1 -0
- package/dist/__tslib-ced6fd51.js +1 -0
- package/dist/{blocto-6012bcee.js → blocto-f42a61b6.js} +1 -1
- package/dist/{bn-f63668bd.js → bn-d8f0262c.js} +1 -1
- package/dist/{browser-ponyfill-6a7a565b.js → browser-ponyfill-635ba813.js} +1 -1
- package/dist/cjs/{DefaultJsonRpcProvider-2894e1a2.cjs → DefaultJsonRpcProvider-9f539cb7.cjs} +1 -1
- package/dist/cjs/{__node-resolve_empty-f57ca5f8.cjs → __node-resolve_empty-8f743760.cjs} +1 -1
- package/dist/cjs/__tslib-86b51b1b.cjs +1 -0
- package/dist/cjs/{blocto-14265f1b.cjs → blocto-71a53312.cjs} +1 -1
- package/dist/cjs/{bn-002a9654.cjs → bn-f94d2173.cjs} +1 -1
- package/dist/cjs/{browser-ponyfill-f8923c78.cjs → browser-ponyfill-e352d0ba.cjs} +1 -1
- package/dist/cjs/{draggabilly-7288c192.cjs → draggabilly-218423e5.cjs} +1 -1
- package/dist/cjs/{ethers-747d32a6.cjs → ethers-3b1d7d09.cjs} +1 -1
- package/dist/cjs/{id-ef87d991.cjs → id-d2547ab8.cjs} +1 -1
- package/dist/cjs/{index-fdec095f.cjs → index-15ff0303.cjs} +1 -1
- package/dist/cjs/{index-7e3602c5.cjs → index-16586b6f.cjs} +1 -1
- package/dist/cjs/{index-bec3f245.cjs → index-3b9b0297.cjs} +1 -1
- package/dist/cjs/{index-7de08e81.cjs → index-4957886b.cjs} +1 -1
- package/dist/cjs/{index-e368a1ec.cjs → index-66442a21.cjs} +1 -1
- package/dist/cjs/{index-4b9cc9db.cjs → index-9fa73ad5.cjs} +2 -2
- package/dist/cjs/index-d400c95d.cjs +1 -0
- package/dist/cjs/{index-8e7ec75f.cjs → index-e6510853.cjs} +1 -1
- package/dist/cjs/{index-d291a707.cjs → index-f1d55466.cjs} +1 -1
- package/dist/cjs/{index-475b4539.cjs → index-f9b3e693.cjs} +2 -2
- package/dist/cjs/{index-f107e2df.cjs → index-fece914f.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-8a10cab5.cjs → index.es-24601ae9.cjs} +1 -1
- package/dist/cjs/{interface-c5af1d39.cjs → interface-b141cac1.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-18eafa57.cjs → lib-typedarrays-16b8679e.cjs} +1 -1
- package/dist/cjs/{portis-3e53aa74.cjs → portis-8a542a71.cjs} +1 -1
- package/dist/cjs/{provider-0765a0c4.cjs → provider-97d6accc.cjs} +1 -1
- package/dist/cjs/{rainbow-f0553261.cjs → rainbow-e2f8e93b.cjs} +1 -1
- package/dist/cjs/{sha224-f39873dc.cjs → sha224-677fefaf.cjs} +1 -1
- package/dist/cjs/{sha256-0f1577ad.cjs → sha256-722ffe23.cjs} +1 -1
- package/dist/cjs/{uAuth-9f12e987.cjs → uAuth-ad6cc7bb.cjs} +1 -1
- package/dist/cjs/{walletConnect-08310517.cjs → walletConnect-38298739.cjs} +1 -1
- package/dist/cjs/{walletLink-695f93b6.cjs → walletLink-31aaa2a8.cjs} +1 -1
- package/dist/{draggabilly-be876492.js → draggabilly-ce8c12b6.js} +1 -1
- package/dist/{ethers-a71b41f1.js → ethers-7b46939e.js} +1 -1
- package/dist/{id-aa7002c2.js → id-854c92f2.js} +1 -1
- package/dist/{index-0c189400.js → index-0cd3036e.js} +1 -1
- package/dist/{index-a7fd26b2.js → index-34ca0120.js} +1 -1
- package/dist/{index-c8b61e1c.js → index-546ca9d4.js} +1 -1
- package/dist/{index-2ff19703.js → index-6b1cae41.js} +1 -1
- package/dist/index-75bd164d.js +1 -0
- package/dist/{index-9d6a1b0f.js → index-7c400140.js} +2 -2
- package/dist/{index-f9177065.js → index-c57b0448.js} +1 -1
- package/dist/{index-cae05be8.js → index-cb13f500.js} +1 -1
- package/dist/{index-3a56ad18.js → index-cdfcca5b.js} +1 -1
- package/dist/{index-f19f4eef.js → index-dd28f95d.js} +1 -1
- package/dist/{index-1fa84282.js → index-e7c8df7f.js} +1 -1
- package/dist/{index.es-59cd195e.js → index.es-5adf8ffb.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-9c07cadd.js → interface-9f8f54a0.js} +1 -1
- package/dist/{lib-typedarrays-fcec28ff.js → lib-typedarrays-509620fd.js} +1 -1
- package/dist/{portis-6134280d.js → portis-cd3a3d3c.js} +1 -1
- package/dist/{provider-b7f8b65b.js → provider-0d0e4055.js} +1 -1
- package/dist/{rainbow-9e32f732.js → rainbow-0c05f6fc.js} +1 -1
- package/dist/sha224-a8f71aae.js +1 -0
- package/dist/{sha256-3dad34ed.js → sha256-46b03365.js} +1 -1
- package/dist/{uAuth-fac6fff4.js → uAuth-1a8670b8.js} +1 -1
- package/dist/{walletConnect-62201bb8.js → walletConnect-fa40acff.js} +1 -1
- package/dist/{walletLink-82cc3eeb.js → walletLink-cb34aa54.js} +1 -1
- package/package.json +1 -1
- package/dist/__node-resolve_empty-adff7651.js +0 -1
- package/dist/__tslib-b3416fbd.js +0 -1
- package/dist/cjs/__tslib-47f6b6a1.cjs +0 -1
- package/dist/cjs/index-b30f5999.cjs +0 -1
- package/dist/index-466c44f8.js +0 -1
- package/dist/sha224-849f74bf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@ethersproject/address"),e=require("@ethersproject/bytes"),r=require("./index-bec3f245.cjs"),n=require("@ethersproject/properties"),o=require("./id-ef87d991.cjs");const i="hash/5.7.0";function s(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e.arrayify(r)}function a(t){t=e.arrayify(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var c=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 u=new o.Logger(i),l=new Uint8Array(32);l.fill(0);const f=o.BigNumber.from(-1),h=o.BigNumber.from(0),d=o.BigNumber.from(1),y=o.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const p=e.hexZeroPad(d.toHexString(),32),m=e.hexZeroPad(h.toHexString(),32),g={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},v=["name","version","chainId","verifyingContract","salt"];function w(t){return function(e){return"string"!=typeof e&&u.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const E={name:w("name"),version:w("version"),chainId:function(t){try{return o.BigNumber.from(t).toString()}catch(t){}return u.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(e){try{return t.getAddress(e).toLowerCase()}catch(t){}return u.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(t){try{const r=e.arrayify(t);if(32!==r.length)throw new Error("bad length");return e.hexlify(r)}catch(t){}return u.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function b(n){{const t=n.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],i=parseInt(t[2]||"256");(i%8!=0||i>256||t[2]&&t[2]!==String(i))&&u.throwArgumentError("invalid numeric width","type",n);const s=y.mask(r?i-1:i),a=r?s.add(d).mul(f):h;return function(t){const r=o.BigNumber.from(t);return(r.lt(a)||r.gt(s))&&u.throwArgumentError(`value out-of-bounds for ${n}`,"value",t),e.hexZeroPad(r.toTwos(256).toHexString(),32)}}}{const t=n.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&u.throwArgumentError("invalid bytes width","type",n),function(t){return e.arrayify(t).length!==r&&u.throwArgumentError(`invalid length for ${n}`,"value",t),function(t){const r=e.arrayify(t),n=r.length%32;return n?e.hexConcat([r,l.slice(n)]):e.hexlify(r)}(t)}}}switch(n){case"address":return function(r){return e.hexZeroPad(t.getAddress(r),32)};case"bool":return function(t){return t?p:m};case"bytes":return function(t){return r.keccak256(t)};case"string":return function(t){return o.id(t)}}return null}function x(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class C{constructor(t){n.defineReadOnly(this,"types",Object.freeze(n.deepCopy(t))),n.defineReadOnly(this,"_encoderCache",{}),n.defineReadOnly(this,"_types",{});const e={},r={},o={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],o[t]={}}));for(const n in t){const o={};t[n].forEach((i=>{o[i.name]&&u.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&&u.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);b(s)||(r[s]||u.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?u.throwArgumentError("missing primary type","types",t):i.length>1&&u.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),n.defineReadOnly(this,"primaryType",i[0]),function n(i,s){s[i]&&u.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(e[i]).forEach((t=>{r[t]&&(n(t,s),Object.keys(s).forEach((e=>{o[e][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const e in o){const r=Object.keys(o[e]);r.sort(),this._types[e]=x(e,t[e])+r.map((e=>x(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=b(t);if(e)return e}const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],o=this.getEncoder(t),i=parseInt(n[3]);return n=>{i>=0&&n.length!==i&&u.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",n);let s=n.map(o);return this._types[t]&&(s=s.map(r.keccak256)),r.keccak256(e.hexConcat(s))}}const i=this.types[t];if(i){const n=o.id(this._types[t]);return t=>{const o=i.map((({name:e,type:n})=>{const o=this.getEncoder(n)(t[e]);return this._types[n]?r.keccak256(o):o}));return o.unshift(n),e.hexConcat(o)}}return u.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||u.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return r.keccak256(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(b(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&&u.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)),{}):u.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new C(t)}static getPrimaryType(t){return C.from(t).primaryType}static hashStruct(t,e,r){return C.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=g[r];n||u.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>v.indexOf(t.name)-v.indexOf(e.name))),C.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,r,n){return e.hexConcat(["0x1901",C.hashDomain(t),C.from(r).hash(n)])}static hash(t,e,n){return r.keccak256(C.encode(t,e,n))}static resolveNames(t,r,o,i){return c(this,void 0,void 0,(function*(){t=n.shallowCopy(t);const s={};t.verifyingContract&&!e.isHexString(t.verifyingContract,20)&&(s[t.verifyingContract]="0x");const a=C.from(r);a.visit(o,((t,r)=>("address"!==t||e.isHexString(r,20)||(s[r]="0x"),r)));for(const t in s)s[t]=yield i(t);return t.verifyingContract&&s[t.verifyingContract]&&(t.verifyingContract=s[t.verifyingContract]),o=a.visit(o,((t,e)=>"address"===t&&s[e]?s[e]:e)),{domain:t,value:o}}))}static getPayload(t,r,i){C.hashDomain(t);const s={},a=[];v.forEach((e=>{const r=t[e];null!=r&&(s[e]=E[e](r),a.push({name:e,type:g[e]}))}));const c=C.from(r),l=n.shallowCopy(r);return l.EIP712Domain?u.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=a,c.encode(i),{types:l,domain:s,primaryType:c.primaryType,message:c.visit(i,((t,r)=>{if(t.match(/^bytes(\d*)/))return e.hexlify(e.arrayify(r));if(t.match(/^u?int/))return o.BigNumber.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&u.throwArgumentError("invalid string","value",r),r}return u.throwArgumentError("unsupported type","type",t)}))}}}var S=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 k(t,r){return S(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.arrayify(new Uint8Array(i))}}))}var O=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 R=new o.Logger("web/5.7.1");function A(t){return new Promise((e=>{setTimeout(e,t)}))}function T(t,r){if(null==t)return null;if("string"==typeof t)return t;if(e.isBytesLike(t)){if(r&&("text"===r.split("/")[0]||"application/json"===r.split(";")[0].trim()))try{return o.toUtf8String(t)}catch(t){}return e.hexlify(t)}return t}function _(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;R.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const c="object"==typeof t?t.throttleCallback:null,u="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;R.assertArgument(u>0&&u%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",u);const l="object"==typeof t&&!!t.errorPassThrough,f={};let h=null;const d={method:"GET"};let y=!1,p=12e4;if("string"==typeof t)h=t;else if("object"==typeof t){if(null!=t&&null!=t.url||R.throwArgumentError("missing URL","connection.url",t),h=t.url,"number"==typeof t.timeout&&t.timeout>0&&(p=t.timeout),t.headers)for(const e in t.headers)f[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(y=!0);if(d.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==h.substring(0,6)&&!0!==t.allowInsecureAuthentication&&R.throwError("basic authentication requires a secure https url",o.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:h,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;f.authorization={key:"Authorization",value:"Basic "+a(o.toUtf8Bytes(e))}}null!=t.skipFetchSetup&&(d.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(d.fetchOptions=n.shallowCopy(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),g=h?h.match(m):null;if(g)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":g[1]||"text/plain"},body:g[2]?s(g[3]):(v=g[3],o.toUtf8Bytes(v.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){R.throwError("processing response error",o.Logger.errors.SERVER_ERROR,{body:T(g[1],g[2]),error:t,requestBody:null,requestMethod:"GET",url:h})}var v;e&&(d.method="POST",d.body=e,null==f["content-type"]&&(f["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==f["content-length"]&&(f["content-length"]={key:"Content-Length",value:String(e.length)}));const w={};Object.keys(f).forEach((t=>{const e=f[t];w[e.key]=e.value})),d.headers=w;const E=function(){let t=null;return{promise:new Promise((function(e,r){p&&(t=setTimeout((()=>{null!=t&&(t=null,r(R.makeError("timeout",o.Logger.errors.TIMEOUT,{requestBody:T(d.body,w["content-type"]),requestMethod:d.method,timeout:p,url:h})))}),p))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),b=function(){return O(this,void 0,void 0,(function*(){for(let t=0;t<i;t++){let e=null;try{if(e=yield k(h,d),t<i)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===d.method&&t.match(/^https:/)){h=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(c&&(r=yield c(t,h)),r){let r=0;const n=e.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):u*parseInt(String(Math.random()*Math.pow(2,t))),yield A(r);continue}}}catch(t){e=t.response,null==e&&(E.cancel(),R.throwError("missing response",o.Logger.errors.SERVER_ERROR,{requestBody:T(d.body,w["content-type"]),requestMethod:d.method,serverError:t,url:h}))}let n=e.body;if(y&&304===e.statusCode?n=null:!l&&(e.statusCode<200||e.statusCode>=300)&&(E.cancel(),R.throwError("bad response",o.Logger.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:T(n,e.headers?e.headers["content-type"]:null),requestBody:T(d.body,w["content-type"]),requestMethod:d.method,url:h})),r)try{const t=yield r(n,e);return E.cancel(),t}catch(r){if(r.throttleRetry&&t<i){let e=!0;if(c&&(e=yield c(t,h)),e){const e=u*parseInt(String(Math.random()*Math.pow(2,t)));yield A(e);continue}}E.cancel(),R.throwError("processing response error",o.Logger.errors.SERVER_ERROR,{body:T(n,e.headers?e.headers["content-type"]:null),error:r,requestBody:T(d.body,w["content-type"]),requestMethod:d.method,url:h})}return E.cancel(),n}return R.throwError("failed response",o.Logger.errors.SERVER_ERROR,{requestBody:T(d.body,w["content-type"]),requestMethod:d.method,url:h})}))}();return Promise.race([E.promise,b])}function I(t,e,r){let i=null;if(null!=e){i=o.toUtf8Bytes(e);const r="string"==typeof t?{url:t}:n.shallowCopy(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=n.shallowCopy(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return _(t,i,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(o.toUtf8String(t))}catch(e){R.throwError("invalid JSON",o.Logger.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function L(t,e){return e||(e={}),null==(e=n.shallowCopy(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 j=Object.freeze({__proto__:null,_fetchData:_,fetchJson:I,poll:L});exports.TypedDataEncoder=C,exports._fetchData=_,exports.decode=s,exports.encode=a,exports.fetchJson=I,exports.lib_esm=j,exports.poll=L,exports.version=i;
|
|
1
|
+
"use strict";var t=require("@ethersproject/address"),e=require("@ethersproject/bytes"),r=require("./index-3b9b0297.cjs"),n=require("@ethersproject/properties"),o=require("./id-d2547ab8.cjs");const i="hash/5.7.0";function s(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e.arrayify(r)}function a(t){t=e.arrayify(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var c=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 u=new o.Logger(i),l=new Uint8Array(32);l.fill(0);const f=o.BigNumber.from(-1),h=o.BigNumber.from(0),d=o.BigNumber.from(1),y=o.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const p=e.hexZeroPad(d.toHexString(),32),m=e.hexZeroPad(h.toHexString(),32),g={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},v=["name","version","chainId","verifyingContract","salt"];function w(t){return function(e){return"string"!=typeof e&&u.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const E={name:w("name"),version:w("version"),chainId:function(t){try{return o.BigNumber.from(t).toString()}catch(t){}return u.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(e){try{return t.getAddress(e).toLowerCase()}catch(t){}return u.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(t){try{const r=e.arrayify(t);if(32!==r.length)throw new Error("bad length");return e.hexlify(r)}catch(t){}return u.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function b(n){{const t=n.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],i=parseInt(t[2]||"256");(i%8!=0||i>256||t[2]&&t[2]!==String(i))&&u.throwArgumentError("invalid numeric width","type",n);const s=y.mask(r?i-1:i),a=r?s.add(d).mul(f):h;return function(t){const r=o.BigNumber.from(t);return(r.lt(a)||r.gt(s))&&u.throwArgumentError(`value out-of-bounds for ${n}`,"value",t),e.hexZeroPad(r.toTwos(256).toHexString(),32)}}}{const t=n.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&u.throwArgumentError("invalid bytes width","type",n),function(t){return e.arrayify(t).length!==r&&u.throwArgumentError(`invalid length for ${n}`,"value",t),function(t){const r=e.arrayify(t),n=r.length%32;return n?e.hexConcat([r,l.slice(n)]):e.hexlify(r)}(t)}}}switch(n){case"address":return function(r){return e.hexZeroPad(t.getAddress(r),32)};case"bool":return function(t){return t?p:m};case"bytes":return function(t){return r.keccak256(t)};case"string":return function(t){return o.id(t)}}return null}function x(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class C{constructor(t){n.defineReadOnly(this,"types",Object.freeze(n.deepCopy(t))),n.defineReadOnly(this,"_encoderCache",{}),n.defineReadOnly(this,"_types",{});const e={},r={},o={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],o[t]={}}));for(const n in t){const o={};t[n].forEach((i=>{o[i.name]&&u.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&&u.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);b(s)||(r[s]||u.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?u.throwArgumentError("missing primary type","types",t):i.length>1&&u.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),n.defineReadOnly(this,"primaryType",i[0]),function n(i,s){s[i]&&u.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(e[i]).forEach((t=>{r[t]&&(n(t,s),Object.keys(s).forEach((e=>{o[e][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const e in o){const r=Object.keys(o[e]);r.sort(),this._types[e]=x(e,t[e])+r.map((e=>x(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=b(t);if(e)return e}const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],o=this.getEncoder(t),i=parseInt(n[3]);return n=>{i>=0&&n.length!==i&&u.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",n);let s=n.map(o);return this._types[t]&&(s=s.map(r.keccak256)),r.keccak256(e.hexConcat(s))}}const i=this.types[t];if(i){const n=o.id(this._types[t]);return t=>{const o=i.map((({name:e,type:n})=>{const o=this.getEncoder(n)(t[e]);return this._types[n]?r.keccak256(o):o}));return o.unshift(n),e.hexConcat(o)}}return u.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||u.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return r.keccak256(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(b(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&&u.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)),{}):u.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new C(t)}static getPrimaryType(t){return C.from(t).primaryType}static hashStruct(t,e,r){return C.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=g[r];n||u.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>v.indexOf(t.name)-v.indexOf(e.name))),C.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,r,n){return e.hexConcat(["0x1901",C.hashDomain(t),C.from(r).hash(n)])}static hash(t,e,n){return r.keccak256(C.encode(t,e,n))}static resolveNames(t,r,o,i){return c(this,void 0,void 0,(function*(){t=n.shallowCopy(t);const s={};t.verifyingContract&&!e.isHexString(t.verifyingContract,20)&&(s[t.verifyingContract]="0x");const a=C.from(r);a.visit(o,((t,r)=>("address"!==t||e.isHexString(r,20)||(s[r]="0x"),r)));for(const t in s)s[t]=yield i(t);return t.verifyingContract&&s[t.verifyingContract]&&(t.verifyingContract=s[t.verifyingContract]),o=a.visit(o,((t,e)=>"address"===t&&s[e]?s[e]:e)),{domain:t,value:o}}))}static getPayload(t,r,i){C.hashDomain(t);const s={},a=[];v.forEach((e=>{const r=t[e];null!=r&&(s[e]=E[e](r),a.push({name:e,type:g[e]}))}));const c=C.from(r),l=n.shallowCopy(r);return l.EIP712Domain?u.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=a,c.encode(i),{types:l,domain:s,primaryType:c.primaryType,message:c.visit(i,((t,r)=>{if(t.match(/^bytes(\d*)/))return e.hexlify(e.arrayify(r));if(t.match(/^u?int/))return o.BigNumber.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&u.throwArgumentError("invalid string","value",r),r}return u.throwArgumentError("unsupported type","type",t)}))}}}var S=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 k(t,r){return S(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.arrayify(new Uint8Array(i))}}))}var O=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 R=new o.Logger("web/5.7.1");function A(t){return new Promise((e=>{setTimeout(e,t)}))}function T(t,r){if(null==t)return null;if("string"==typeof t)return t;if(e.isBytesLike(t)){if(r&&("text"===r.split("/")[0]||"application/json"===r.split(";")[0].trim()))try{return o.toUtf8String(t)}catch(t){}return e.hexlify(t)}return t}function _(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;R.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const c="object"==typeof t?t.throttleCallback:null,u="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;R.assertArgument(u>0&&u%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",u);const l="object"==typeof t&&!!t.errorPassThrough,f={};let h=null;const d={method:"GET"};let y=!1,p=12e4;if("string"==typeof t)h=t;else if("object"==typeof t){if(null!=t&&null!=t.url||R.throwArgumentError("missing URL","connection.url",t),h=t.url,"number"==typeof t.timeout&&t.timeout>0&&(p=t.timeout),t.headers)for(const e in t.headers)f[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(y=!0);if(d.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==h.substring(0,6)&&!0!==t.allowInsecureAuthentication&&R.throwError("basic authentication requires a secure https url",o.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:h,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;f.authorization={key:"Authorization",value:"Basic "+a(o.toUtf8Bytes(e))}}null!=t.skipFetchSetup&&(d.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(d.fetchOptions=n.shallowCopy(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),g=h?h.match(m):null;if(g)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":g[1]||"text/plain"},body:g[2]?s(g[3]):(v=g[3],o.toUtf8Bytes(v.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){R.throwError("processing response error",o.Logger.errors.SERVER_ERROR,{body:T(g[1],g[2]),error:t,requestBody:null,requestMethod:"GET",url:h})}var v;e&&(d.method="POST",d.body=e,null==f["content-type"]&&(f["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==f["content-length"]&&(f["content-length"]={key:"Content-Length",value:String(e.length)}));const w={};Object.keys(f).forEach((t=>{const e=f[t];w[e.key]=e.value})),d.headers=w;const E=function(){let t=null;return{promise:new Promise((function(e,r){p&&(t=setTimeout((()=>{null!=t&&(t=null,r(R.makeError("timeout",o.Logger.errors.TIMEOUT,{requestBody:T(d.body,w["content-type"]),requestMethod:d.method,timeout:p,url:h})))}),p))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),b=function(){return O(this,void 0,void 0,(function*(){for(let t=0;t<i;t++){let e=null;try{if(e=yield k(h,d),t<i)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===d.method&&t.match(/^https:/)){h=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(c&&(r=yield c(t,h)),r){let r=0;const n=e.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):u*parseInt(String(Math.random()*Math.pow(2,t))),yield A(r);continue}}}catch(t){e=t.response,null==e&&(E.cancel(),R.throwError("missing response",o.Logger.errors.SERVER_ERROR,{requestBody:T(d.body,w["content-type"]),requestMethod:d.method,serverError:t,url:h}))}let n=e.body;if(y&&304===e.statusCode?n=null:!l&&(e.statusCode<200||e.statusCode>=300)&&(E.cancel(),R.throwError("bad response",o.Logger.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:T(n,e.headers?e.headers["content-type"]:null),requestBody:T(d.body,w["content-type"]),requestMethod:d.method,url:h})),r)try{const t=yield r(n,e);return E.cancel(),t}catch(r){if(r.throttleRetry&&t<i){let e=!0;if(c&&(e=yield c(t,h)),e){const e=u*parseInt(String(Math.random()*Math.pow(2,t)));yield A(e);continue}}E.cancel(),R.throwError("processing response error",o.Logger.errors.SERVER_ERROR,{body:T(n,e.headers?e.headers["content-type"]:null),error:r,requestBody:T(d.body,w["content-type"]),requestMethod:d.method,url:h})}return E.cancel(),n}return R.throwError("failed response",o.Logger.errors.SERVER_ERROR,{requestBody:T(d.body,w["content-type"]),requestMethod:d.method,url:h})}))}();return Promise.race([E.promise,b])}function I(t,e,r){let i=null;if(null!=e){i=o.toUtf8Bytes(e);const r="string"==typeof t?{url:t}:n.shallowCopy(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=n.shallowCopy(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return _(t,i,((t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(o.toUtf8String(t))}catch(e){R.throwError("invalid JSON",o.Logger.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n}))}function L(t,e){return e||(e={}),null==(e=n.shallowCopy(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 j=Object.freeze({__proto__:null,_fetchData:_,fetchJson:I,poll:L});exports.TypedDataEncoder=C,exports._fetchData=_,exports.decode=s,exports.encode=a,exports.fetchJson=I,exports.lib_esm=j,exports.poll=L,exports.version=i;
|