@dodoex/wallet-web3 0.0.41-6 → 0.0.41
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-39051876.js → DefaultJsonRpcProvider-81dbd3f9.js} +1 -1
- package/dist/__node-resolve_empty-314df16e.js +1 -0
- package/dist/__tslib-895a7349.js +1 -0
- package/dist/{blocto-b1fd16e0.js → blocto-a553b391.js} +1 -1
- package/dist/bn-8f7cc9b5.js +1 -0
- package/dist/{browser-ponyfill-45febd35.js → browser-ponyfill-4134b2b7.js} +1 -1
- package/dist/cjs/{DefaultJsonRpcProvider-9c49bc74.cjs → DefaultJsonRpcProvider-851de86a.cjs} +1 -1
- package/dist/cjs/{__node-resolve_empty-cc04456f.cjs → __node-resolve_empty-04cc3662.cjs} +1 -1
- package/dist/cjs/__tslib-07f80053.cjs +1 -0
- package/dist/cjs/{blocto-21bcf508.cjs → blocto-1d2d3abc.cjs} +1 -1
- package/dist/cjs/bn-8a65a921.cjs +1 -0
- package/dist/cjs/{browser-ponyfill-1a8d200e.cjs → browser-ponyfill-96a14706.cjs} +1 -1
- package/dist/cjs/{draggabilly-f1bb3b36.cjs → draggabilly-326f0353.cjs} +1 -1
- package/dist/cjs/ethers-c6e7830c.cjs +1 -0
- package/dist/cjs/id-ac2184da.cjs +1 -0
- package/dist/cjs/{index-50ef639c.cjs → index-01b3872e.cjs} +1 -1
- package/dist/cjs/index-38a82c12.cjs +1 -0
- package/dist/cjs/index-4685dfbc.cjs +9 -0
- package/dist/cjs/{index-fec2b0e7.cjs → index-4f46ab04.cjs} +1 -1
- package/dist/cjs/{index-bb9d8efd.cjs → index-6130f88a.cjs} +2 -2
- package/dist/cjs/index-823d3a25.cjs +6 -0
- package/dist/cjs/index-8d32723e.cjs +15 -0
- package/dist/cjs/index-97c32dcf.cjs +1 -0
- package/dist/cjs/{index-1cf2025a.cjs → index-b3a93c7d.cjs} +1 -1
- package/dist/cjs/{index-7fb18b59.cjs → index-c6a78b5c.cjs} +1 -1
- package/dist/cjs/index-d89005f4.cjs +1 -0
- package/dist/cjs/{index-9f2a69d5.cjs → index-df8e5839.cjs} +1 -1
- package/dist/cjs/{index-35edc6a0.cjs → index-eb09e54d.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-c188e54b.cjs → index.es-168fe2b1.cjs} +2 -2
- package/dist/cjs/{interface-847c070f.cjs → interface-f6b53727.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-924fdb15.cjs → lib-typedarrays-05755aa6.cjs} +1 -1
- package/dist/cjs/{portis-04649135.cjs → portis-7873ce6a.cjs} +1 -1
- package/dist/cjs/{provider-55f49a37.cjs → provider-d7c647ea.cjs} +1 -1
- package/dist/cjs/{rainbow-331b4b7f.cjs → rainbow-43c8e5f6.cjs} +1 -1
- package/dist/cjs/sha224-86e8cc7f.cjs +1 -0
- package/dist/cjs/{sha256-a9306fd5.cjs → sha256-7cc68713.cjs} +1 -1
- package/dist/cjs/state.d.ts +0 -1
- package/dist/cjs/uAuth-6aa71b34.cjs +1 -0
- package/dist/cjs/{walletConnect-4a8a9594.cjs → walletConnect-b0df4f12.cjs} +1 -1
- package/dist/cjs/walletLink-eb56d177.cjs +3 -0
- package/dist/{draggabilly-bfad3669.js → draggabilly-291f869b.js} +1 -1
- package/dist/ethers-f8f094be.js +1 -0
- package/dist/id-dcb529f4.js +1 -0
- package/dist/{index-65d96278.js → index-0ee5ef8d.js} +1 -1
- package/dist/{index-2421fbca.js → index-20ce8a4c.js} +1 -1
- package/dist/{index-c900ddbc.js → index-4e6b81d8.js} +1 -1
- package/dist/index-7a7a090a.js +1 -0
- package/dist/{index-33d9ef5d.js → index-89a7e976.js} +1 -1
- package/dist/index-914dc773.js +15 -0
- package/dist/index-a1df7720.js +1 -0
- package/dist/index-bc061f7b.js +9 -0
- package/dist/index-cbfb042c.js +1 -0
- package/dist/{index-1fbb15b5.js → index-cebac794.js} +2 -2
- package/dist/index-cec5c507.js +6 -0
- package/dist/{index-f08d6a6b.js → index-e0d3617a.js} +1 -1
- package/dist/index-e3070128.js +1 -0
- package/dist/{index.es-5eecb376.js → index.es-b6986074.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{interface-b85b700d.js → interface-6c3ec32a.js} +1 -1
- package/dist/{lib-typedarrays-a8e83421.js → lib-typedarrays-f1051e37.js} +1 -1
- package/dist/{portis-43f60af4.js → portis-6c321b6b.js} +1 -1
- package/dist/{provider-301ac332.js → provider-0a241f15.js} +1 -1
- package/dist/{rainbow-23c1faed.js → rainbow-43a583fd.js} +1 -1
- package/dist/{sha224-c866b8af.js → sha224-1e5a1736.js} +1 -1
- package/dist/{sha256-aa67d92b.js → sha256-79cd8cb2.js} +1 -1
- package/dist/state.d.ts +0 -1
- package/dist/uAuth-57530103.js +1 -0
- package/dist/{walletConnect-6fa1fc97.js → walletConnect-dc900305.js} +1 -1
- package/dist/walletLink-7f641f02.js +3 -0
- package/package.json +1 -1
- package/dist/__node-resolve_empty-8d36ef45.js +0 -1
- package/dist/__tslib-028c435c.js +0 -1
- package/dist/bn-6691dc4b.js +0 -1
- package/dist/cjs/__tslib-1a913bb4.cjs +0 -1
- package/dist/cjs/bn-f78d1a17.cjs +0 -1
- package/dist/cjs/ethers-b4443d90.cjs +0 -1
- package/dist/cjs/id-81d6569b.cjs +0 -1
- package/dist/cjs/index-2b6e2d0e.cjs +0 -9
- package/dist/cjs/index-2faa3982.cjs +0 -6
- package/dist/cjs/index-39d0684d.cjs +0 -1
- package/dist/cjs/index-603ccd56.cjs +0 -1
- package/dist/cjs/index-61c5fbfc.cjs +0 -1
- package/dist/cjs/index-81e04477.cjs +0 -15
- package/dist/cjs/sha224-ec932277.cjs +0 -1
- package/dist/cjs/uAuth-f08a6bc1.cjs +0 -1
- package/dist/cjs/walletLink-55148573.cjs +0 -3
- package/dist/ethers-149a03bf.js +0 -1
- package/dist/id-9ebc6c25.js +0 -1
- package/dist/index-3fa89254.js +0 -1
- package/dist/index-5bdb764f.js +0 -9
- package/dist/index-660d9f03.js +0 -1
- package/dist/index-b40bcea4.js +0 -1
- package/dist/index-bf8de361.js +0 -6
- package/dist/index-c953d0ac.js +0 -1
- package/dist/index-e4bf19f4.js +0 -15
- package/dist/uAuth-0c0662eb.js +0 -1
- package/dist/walletLink-88727a96.js +0 -3
|
@@ -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-5bdb764f.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-9ebc6c25.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-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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,g as t,r as n,c as r,S as o,t as i,v as a,u as s}from"./index-bc061f7b.js";import c,{getAddress as u}from"@ethersproject/address";import{Signer as p}from"@ethersproject/abstract-signer";import{JsonRpcProvider as l}from"@ethersproject/providers";import f,{arrayify as d}from"@ethersproject/bytes";import{T as h,l as g}from"./index-4e6b81d8.js";import{r as y}from"./index-cbfb042c.js";import{f as m,p as b,n as v,d as w,b as P,i as x,c as O,m as j,h as _,g as S,r as E,s as k,j as T,S as U,k as L,o as A,q as C,t as N,x as D,y as I,z as R,A as M,B as F}from"./ethers-f8f094be.js";import{d as z,t as B,c as W,a as G,e as J,f as V,U as H,i as K,l as Z}from"./id-dcb529f4.js";import $ from"@ethersproject/json-wallets";import q,{defineReadOnly as Y}from"@ethersproject/properties";import{l as Q}from"./index-89a7e976.js";import X from"@ethersproject/transactions";import{Contract as ee}from"@ethersproject/contracts";import{D as te}from"./DefaultJsonRpcProvider-81dbd3f9.js";import"zustand";import"events";import"@ethersproject/constants";import"./interface-6c3ec32a.js";import"@ethersproject/abstract-provider";import"./__node-resolve_empty-314df16e.js";import"./hash-b468659c.js";import"./inherits_browser-51bb8c3c.js";var ne,re=Object.freeze({__proto__:null,_toEscapedUtf8String:z,toUtf8Bytes:B,toUtf8CodePoints:W,toUtf8String:G,Utf8ErrorFuncs:J,get Utf8ErrorReason(){return V},get UnicodeNormalizationForm(){return H},formatBytes32String:m,parseBytes32String:b,nameprep:v}),oe=Object.freeze({__proto__:null,id:K,dnsEncode:w,namehash:P,isValidName:x,ensNormalize:O,messagePrefix:j,hashMessage:_,_TypedDataEncoder:h}),ie=Object.freeze({__proto__:null,computeHmac:S,ripemd160:E,sha256:k,sha512:T,get SupportedAlgorithm(){return U}}),ae=Object.freeze({__proto__:null,randomBytes:L,shuffled:A});class se extends p{constructor(e,t,n,r){super(),this._address=n,this._index=null!=r?r:0,this.provider=e,this.upWallet=t}_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(u(this._address))}))}signMessage(t){return e(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t}'`);return yield this.upWallet.signMessage(t,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(t,n,r){return e(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(t){return e(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data})}))}sendTransaction(t){return e(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return{hash:yield this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data}),from:t.from}}))}connect(e){return new se(null!=e?e:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new se(this.provider,this.upWallet,this._address,this._index)}}!function(e){e.REGISTER="register"}(ne||(ne={}));var ce,ue=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},pe=function(e,t){this.type=e,this.data=t},le=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fe.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(ce||(ce={}));var de=function(e){return d(function(e){var t=fe({},e.types);return delete t.EIP712Domain,h.hash(e.domain,t,e.message)}(e))},he={},ge=t(C),ye=t(N),me=t(oe),be=t(D),ve=t(n),we=t(Z),Pe=t(ie),xe=t(I),Oe=t(ae),je=t(Q),_e=t(R),Se=t(re),Ee=t(M),ke=t(F),Te=t(g);function Ue(){Ue=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),s=new _(o||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function d(){}function h(){}var g={};c(g,i,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(S([])));m&&m!==t&&n.call(m,i)&&(g=m);var b=h.prototype=f.prototype=Object.create(g);function v(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,s){var c=p(e[r],e,i);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function P(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return E()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=x(a,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=p(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,l;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=h,r(b,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:d,configurable:!0}),d.displayName=c(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},v(w.prototype),c(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new w(u(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(b),c(b,s,"Generator"),c(b,i,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=S,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}function Le(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Ae(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Le(i,r,o,a,s,"next",e)}function s(e){Le(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ce.apply(this,arguments)}!function(e){var t=r&&r.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=r&&r.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&t(r,e,o);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var i=y;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var a=c;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return a.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return a.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return a.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return a.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return a.isAddress}});var s=o(ge);e.base64=s;var u=ye;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return u.Base58}});var p=f;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return p.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return p.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return p.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return p.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return p.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return p.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return p.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return p.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return p.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return p.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return p.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return p.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return p.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return p.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return p.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return p.stripZeros}});var l=me;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return l.namehash}});var d=be;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var h=$;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return h.getJsonWalletAddress}});var g=ve;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return g.keccak256}});var m=we;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return m.Logger}});var b=Pe;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return b.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return b.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return b.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return b.sha512}});var v=xe;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return v.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return v.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return v.sha256}});var w=Oe;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return w.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return w.shuffled}});var P=q;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return P.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return P.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return P.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return P.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return P.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return P.shallowCopy}});var x=o(je);e.RLP=x;var O=_e;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return O.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return O.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return O.SigningKey}});var j=Se;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return j.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return j.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return j.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return j._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return j.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return j.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return j.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return j.Utf8ErrorFuncs}});var _=X;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var S=Ee;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return S.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return S.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return S.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return S.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return S.parseUnits}});var E=ke;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return E.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return E.verifyTypedData}});var k=Te;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return k._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return k.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return k.poll}});var T=Pe;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return T.SupportedAlgorithm}});var U=Se;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return U.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return U.Utf8ErrorReason}})}(he);var Ne="wallet.unipass.id",De={upDomain:Ne,upConnectUrl:"https://"+Ne+"/connect",upLogoutUrl:"https://"+Ne+"/logout",upSignMessageUrl:"https://"+Ne+"/sign-message",upTransactionUrl:"https://"+Ne+"/send-transaction",upLoadingUrl:"https://"+Ne+"/connect/loading"},Ie=function(){return De},Re={protocol:"https",domain:"testnet.wallet.unipass.id"},Me={protocol:"https",domain:"wallet.unipass.id"},Fe={mainnet:{eth:"https://node.wallet.unipass.id/eth-mainnet",polygon:"https://node.wallet.unipass.id/polygon-mainnet",bsc:"https://node.wallet.unipass.id/bsc-mainnet",rangers:"https://node.wallet.unipass.id/rangers-mainnet",scroll:"https://node.wallet.unipass.id/scroll-mainnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-mainnet",avalanche:"https://node.wallet.unipass.id/avalanche-mainnet",kcc:"https://node.wallet.unipass.id/kcc-mainnet",platon:"https://node.wallet.unipass.id/platon-mainnet",okc:"https://node.wallet.unipass.id/okc-mainnet"},testnet:{eth:"https://node.wallet.unipass.id/eth-goerli",polygon:"https://node.wallet.unipass.id/polygon-mumbai",bsc:"https://node.wallet.unipass.id/bsc-testnet",rangers:"https://node.wallet.unipass.id/rangers-robin",scroll:"https://node.wallet.unipass.id/scroll-testnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-testnet",avalanche:"https://node.wallet.unipass.id/avalanche-testnet",kcc:"https://node.wallet.unipass.id/kcc-testnet",platon:"https://node.wallet.unipass.id/platon-testnet",okc:"https://node.wallet.unipass.id/okc-testnet"}},ze=function(e){var t;t="localStorage"===e?window.localStorage||localStorage:window.sessionStorage||sessionStorage;return{get:function(e){return t.getItem(e)||""},set:function(e,n){return t.setItem(e,n||"")},remove:function(e){return t.removeItem(e)}}},Be=function(){var e=Ae(Ue().mark((function e(t,n){var r,o;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(t.storageType).get(nt),e.t0=r&&JSON.parse(r),e.t0){e.next=6;break}return e.next=5,Ge(t,n);case 5:e.t0=e.sent;case 6:return o=e.t0,e.abrupt("return",o);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),We=function(){var e=Ae(Ue().mark((function e(t){var n;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new le("UP_LOGOUT"),e.next=4,rt(n);case 4:ze("localStorage").remove(nt),ze("sessionStorage").remove(nt);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ge=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new le("UP_LOGIN",r,t.appSettings),e.next=5,rt(o,null==n?void 0:n.connectType,null==n?void 0:n.forceLogin,null==n?void 0:n.eventListener);case 5:return(i=e.sent)&&i.address&&ze(t.storageType).set(nt,JSON.stringify(i)),e.abrupt("return",i);case 10:throw e.prev=10,e.t0=e.catch(0),new Error("Account Not Available");case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n){return e.apply(this,arguments)}}(),Je="UP_WALLET_POP",Ve=null,He=null;function Ke(e,t,n){var r="innerWidth=462,width=462,innerHeight=810,height=810,top="+.5*(n.screen.availHeight-30-810)+",left="+.8*(n.screen.availWidth-10-462)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";return n.open(e,t,r)}function Ze(e,t,n){return $e.apply(this,arguments)}function $e(){return($e=Ae(Ue().mark((function e(t,n,r){var o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==Ve||null!=(o=Ve)&&o.closed)){e.next=8;break}if(null!=(Ve=Ke(t,Je,window))){e.next=6;break}return e.next=5,qe(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:He!==t?(Ve.location.replace(t),Ve.focus()):Ve.focus();case 9:return i=setInterval((function(){if(Ve&&Ve.closed){var e={data:new le("UP_RESPONSE",JSON.stringify(new pe("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){Ve&&!Ve.closed&&Ve.close(),Ve=null},e.abrupt("return",{popup:Ve,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e,t,n){return Ye.apply(this,arguments)}function Ye(){return(Ye=Ae(Ue().mark((function e(t,n,r){var o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=document.createElement("div"),'\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',o.innerHTML='\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',document.body.appendChild(o),i=document.querySelector(".up_notification_right"),e.abrupt("return",new Promise((function(e){null==i||i.addEventListener("click",(function(){document.body.removeChild(o),e(Ze(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Qe=function(){};function Xe(e,t,n){if("UP_LOGIN"===e)return"google"===t?Ie().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?Ie().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):Ie().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return Ie().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return Ie().upSignMessageUrl;if("UP_TRANSACTION"===e)return Ie().upTransactionUrl;if("UP_READY"===e)return Ie().upLoadingUrl;throw new Error("unsupport type "+e)}function et(e,t,n,r){return tt.apply(this,arguments)}function tt(){return tt=Ae(Ue().mark((function e(t,n,r,o){var i,a,s,c,u,p,l,f,d,h;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h=function(e){try{null==p||p.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}},d=function(){try{window.removeEventListener("message",f),l(),i()}catch(e){console.error("Popup Close Error",e)}},f=function(e){try{if("object"!=typeof e.data)return;var t=e.data;if(!t||!t.type)return;"UP_CLOSE"===e.data.type&&d(),"UP_READY"===t.type&&s(e,{send:h,close:d}),"UP_RESPONSE"===t.type&&c(e,{send:h,close:d}),"UP_EVENT"===t.type&&a(e,{send:h,close:d})}catch(e){console.error("Popup Callback Error",e),d()}},null!=t){e.next=5;break}return e.abrupt("return",{send:Qe,close:Qe});case 5:return i=(null==o?void 0:o.onClose)||Qe,a=(null==o?void 0:o.onMessage)||Qe,s=(null==o?void 0:o.onReady)||Qe,c=(null==o?void 0:o.onResponse)||Qe,window.addEventListener("message",f),e.next=12,Ze(Xe(t.type,n,r),c,t.appSetting);case 12:return u=e.sent,p=u.popup,l=u.unmount,e.abrupt("return",{send:h,close:d});case 16:case"end":return e.stop()}}),e)}))),tt.apply(this,arguments)}var nt="UP-A";function rt(e,t,n,r){return new Promise(function(){var o=Ae(Ue().mark((function o(i,a){return Ue().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,et(e,t,n,{onReady:function(t,n){return Ae(Ue().mark((function t(){var r;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.send,t.prev=1,r(e),t.next=8;break;case 5:throw t.prev=5,t.t0=t.catch(1),t.t0;case 8:case"end":return t.stop()}}),t,null,[[1,5]])})))()},onResponse:function(t,n){return Ae(Ue().mark((function r(){var o,s,c;return Ue().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=n.close,r.prev=1,"object"==typeof t.data){r.next=4;break}return r.abrupt("return");case 4:s=t.data,c=JSON.parse(s.payload),r.t0=c.type,r.next="APPROVE"===r.t0?9:"DECLINE"===r.t0?12:27;break;case 9:return i(c.data),o(),r.abrupt("break",30);case 12:if("expired"!==c.data){r.next=24;break}if("UP_LOGIN"!==e.type){r.next=15;break}return r.abrupt("return");case 15:if("UP_LOGOUT"!==e.type){r.next=19;break}return i(c.data),o(),r.abrupt("return");case 19:if("UP_TRANSACTION"!==e.type&&"UP_SIGN_MESSAGE"!==e.type){r.next=24;break}return We(!1),a("can not authorize without login"),o(),r.abrupt("break",30);case 24:return a("Declined: "+(c.data||"No reason supplied")),o(),r.abrupt("break",30);case 27:return a("Declined: No reason supplied"),o(),r.abrupt("break",30);case 30:r.next=35;break;case 32:throw r.prev=32,r.t1=r.catch(1),r.t1;case 35:case"end":return r.stop()}}),r,null,[[1,32]])})))()},onMessage:function(e,t){return Ae(Ue().mark((function t(){var n,o;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}return t.abrupt("return");case 2:if(t.prev=2,"object"==typeof e.data){t.next=5;break}return t.abrupt("return");case 5:n=e.data,o=JSON.parse(n.payload),r(o),t.next=13;break;case 10:throw t.prev=10,t.t0=t.catch(2),t.t0;case 13:case"end":return t.stop()}}),t,null,[[2,10]])})))()},onClose:function(){return Ae(Ue().mark((function e(){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a("Declined: Externally Halted");case 1:case"end":return e.stop()}}),e)})))()}});case 2:case"end":return o.stop()}}),o)})));return function(e,t){return o.apply(this,arguments)}}())}var ot=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(n.storageType).get(nt),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new le("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,rt(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),it=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(n.storageType).get(nt),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new le("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,rt(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),at="0x1626ba7e";var st=function(){function e(e){this.initConfig(e)}var t=e.prototype;return t.initConfig=function(e){this._config={env:"prod",nodeRPC:"",chainType:"polygon",storageType:"sessionStorage"},this._config.env=e.env||"prod",this._config.chainType=e.chainType||"polygon";var t,n,r=(t=this._config.env,n=this._config.chainType,{env:t,nodeRPC:"prod"===t?Fe.mainnet[n]:Fe.testnet[n],chainType:n,walletUrl:"prod"===t?Me:Re});this._config.nodeRPC=e.nodeRPC||r.nodeRPC,this._config.appSettings=function(e,t){return Ce({},t||{},{chain:(null==t?void 0:t.chain)||e,appName:(null==t?void 0:t.appName)||"MyDemo"})}(this._config.chainType,e.appSettings),this._provider=new l(this._config.nodeRPC),this._auth_provider=new l(function(e){return"prod"===e?Fe.mainnet.polygon:Fe.testnet.polygon}(this._config.env));var o,i,a,s=e.walletUrl||r.walletUrl;s&&(i=(o=s).domain,a=o.protocol,De={upDomain:i=i||Ne,upConnectUrl:(a=a||"https")+"://"+i+"/connect",upLogoutUrl:a+"://"+i+"/logout",upSignMessageUrl:a+"://"+i+"/sign-message",upTransactionUrl:a+"://"+i+"/send-transaction",upLoadingUrl:a+"://"+i+"/connect/loading"}),this._config.storageType=e.storageType||"sessionStorage"},t.updateConfig=function(e){this._config&&(e.chainType&&(this._config.chainType=e.chainType),e.nodeRPC&&(this._config.nodeRPC=e.nodeRPC,this._provider=new l(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},t.login=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Be(this._config,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getAccount=function(){var e,t;return e=this._config.storageType,(t=ze(e).get(nt))?JSON.parse(t):void 0},t.logout=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,We(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.getProvider=function(){return this._provider},t.getAuthProvider=function(){return this._auth_provider},t.isLogin=function(){return!!this.getAccount()},t.assertLogin=function(){if(!this.isLogin())throw new Error("user is not login")},t.getAddress=function(){return this.assertLogin(),this.getAccount().address},t.sendTransaction=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,it(t,this._config);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.signMessage=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a,s;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),o=(r=n||{}).isEIP191Prefix,i=void 0!==o&&o,a=r.onAuthChain,s=void 0===a||a,"string"==typeof t&&(t=he.toUtf8Bytes(t)),e.next=5,ot(new ue(this.getAddress(),he.hexlify(t),"V1",i,s),this._config);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidSignature=function(){var e=Ae(Ue().mark((function e(t,n,r){var o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new ee(r,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),e.next=4,o.isValidSignature(("string"==typeof(a=t)&&(a=he.toUtf8Bytes(a)),he.keccak256(he.concat([he.toUtf8Bytes("UniPass Signed Message:\n"),he.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===at);case 6:case"end":return e.stop()}var a}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.signTypedData=function(){var e=Ae(Ue().mark((function e(t,n){var r,o;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertLogin(),null!=t){e.next=3;break}throw new Error("Missing data parameter");case 3:return r=(n||{}).onAuthChain,o=void 0===r||r,e.next=6,ot(new ue(this.getAddress(),JSON.stringify(t),"V4",!1,o),this._config);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidTypedSignature=function(){var e=Ae(Ue().mark((function e(t,n,r){var o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t){e.next=2;break}throw new Error("Missing data parameter");case 2:return n||(this.assertLogin(),n=this.getAddress()),o=new ee(n,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),i=de(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===at);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function ct(t){var n,r,s;return e(this,void 0,void 0,(function*(){const c=t.JsonRpcProvider||te,p=null!==(n=t.chainId)&&void 0!==n?n:1;let l=null!==(r=t.rpcUrl)&&void 0!==r?r:null===(s=t.rpc)||void 0===s?void 0:s[p];const f=new class extends c{constructor(e,n){super(e,n),this.updateUpWalletConfig=e=>{var n;const r=null===(n=t.rpc)||void 0===n?void 0:n[e];if(!o.includes(e))throw new Error(`chainId ${e} not supported`);if(this.upWallet.updateConfig({chainType:i(e),nodeRPC:r,appSettings:{chain:i(e)}}),"object"==typeof this.network)this.network.chainId=e;else{const t={chainId:e,name:"unknown"};Y(this,"_network",t),this.emit("network",t,null)}return this.rpcUrl=r,this.emit("chainChanged",`0x${e.toString(16)}`),{result:!0}},this.rpcUrl=e,this.upWallet=new st({env:a(p),chainType:i(p),appSettings:{appIcon:t.appLogoUrl,appName:t.appName,chain:i(p)},rpcUrl:l,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new se(f,this.upWallet,null!==(e=null==t?void 0:t.address)&&void 0!==e?e:"",0)}connect(){return e(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return e||(yield this.upWallet.login({email:false}))}))}disconnect(){return e(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return e(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return(null==e?void 0:e.address)?[null==e?void 0:e.address]:[]}))}getAddress(){const e=this.upWallet.getAccount();return Promise.resolve((null==e?void 0:e.address)?u(null==e?void 0:e.address):null)}}(l,p);return f}))}function ut(t,n){return e(this,void 0,void 0,(function*(){const e=yield ct(t);return e.on("connect",n.connect),e.on("disconnect",(e=>{n.disconnect(e),n.accountsChanged([])})),e.on("accountsChanged",n.accountsChanged),e.on("chainChanged",n.chainChanged),e.on("message",(({type:e,data:t})=>n.message(e,t))),yield e.connect(),e}))}function pt(){var e;null===(e=s.getState().provider)||void 0===e||e.disconnect()}function lt(e){var t,n;return null===(n=null===(t=s.getState().provider)||void 0===t?void 0:t.upWallet)||void 0===n?void 0:n.signTypedData(e)}function ft(e){var t;const n=e.addChainParameters.chainId,r="string"==typeof n&&(null==n?void 0:n.startsWith("0x"))?parseInt(n,16):Number(n);if(!o.includes(r))throw new Error(`chainId ${r} not supported`);return null===(t=s.getState().provider)||void 0===t?void 0:t.updateUpWalletConfig(r)}export{ct as createProvider,ut as default,pt as disconnectWallet,lt as signTypedData,ft as switchChain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hexlify as r,arrayify as t,isBytesLike as o}from"@ethersproject/bytes";import{L as e}from"./id-
|
|
1
|
+
import{hexlify as r,arrayify as t,isBytesLike as o}from"@ethersproject/bytes";import{L as e}from"./id-dcb529f4.js";const n=new e("rlp/5.7.0");function s(r){const t=[];for(;r;)t.unshift(255&r),r>>=8;return t}function c(r,t,o){let e=0;for(let n=0;n<o;n++)e=256*e+r[t+n];return e}function h(r){if(Array.isArray(r)){let t=[];if(r.forEach((function(r){t=t.concat(h(r))})),t.length<=55)return t.unshift(192+t.length),t;const o=s(t.length);return o.unshift(247+o.length),o.concat(t)}o(r)||n.throwArgumentError("RLP object must be BytesLike","object",r);const e=Array.prototype.slice.call(t(r));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const c=s(e.length);return c.unshift(183+c.length),c.concat(e)}function u(t){return r(h(t))}function a(r,t,o,s){const c=[];for(;o<t+1+s;){const h=l(r,o);c.push(h.result),(o+=h.consumed)>t+1+s&&n.throwError("child data too short",e.errors.BUFFER_OVERRUN,{})}return{consumed:1+s,result:c}}function l(t,o){if(0===t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{}),t[o]>=248){const r=t[o]-247;o+1+r>t.length&&n.throwError("data short segment too short",e.errors.BUFFER_OVERRUN,{});const s=c(t,o+1,r);return o+1+r+s>t.length&&n.throwError("data long segment too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1+r,r+s)}if(t[o]>=192){const r=t[o]-192;return o+1+r>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1,r)}if(t[o]>=184){const s=t[o]-183;o+1+s>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});const h=c(t,o+1,s);o+1+s+h>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s+h,result:r(t.slice(o+1+s,o+1+s+h))}}if(t[o]>=128){const s=t[o]-128;o+1+s>t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s,result:r(t.slice(o+1,o+1+s))}}return{consumed:1,result:r(t[o])}}function i(r){const o=t(r),e=l(o,0);return e.consumed!==o.length&&n.throwArgumentError("invalid rlp data","data",r),e.result}var f=Object.freeze({__proto__:null,encode:u,decode:i});export{i as d,u as e,f as l};
|