@dodoex/wallet-web3 0.0.40 → 0.0.41-1
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-a9b4edef.js → DefaultJsonRpcProvider-ae4e010b.js} +1 -1
- package/dist/__node-resolve_empty-adff7651.js +1 -0
- package/dist/__tslib-b3416fbd.js +1 -0
- package/dist/{blocto-c2f03aa6.js → blocto-6012bcee.js} +1 -1
- package/dist/{bn-a80bf6c0.js → bn-f63668bd.js} +1 -1
- package/dist/{browser-ponyfill-f38c41bc.js → browser-ponyfill-6a7a565b.js} +1 -1
- package/dist/cjs/{DefaultJsonRpcProvider-ca454f8e.cjs → DefaultJsonRpcProvider-2894e1a2.cjs} +1 -1
- package/dist/cjs/{__node-resolve_empty-6d7ad87b.cjs → __node-resolve_empty-f57ca5f8.cjs} +1 -1
- package/dist/cjs/__tslib-47f6b6a1.cjs +1 -0
- package/dist/cjs/{blocto-05a85ecf.cjs → blocto-14265f1b.cjs} +1 -1
- package/dist/cjs/{bn-b63aca15.cjs → bn-002a9654.cjs} +1 -1
- package/dist/cjs/{browser-ponyfill-b0be11d9.cjs → browser-ponyfill-f8923c78.cjs} +1 -1
- package/dist/cjs/core/index.d.ts +1 -1
- package/dist/cjs/{draggabilly-f616433b.cjs → draggabilly-7288c192.cjs} +1 -1
- package/dist/cjs/{ethers-ba816f82.cjs → ethers-747d32a6.cjs} +1 -1
- package/dist/cjs/{id-323e4c90.cjs → id-ef87d991.cjs} +1 -1
- package/dist/cjs/{index-6902d1ea.cjs → index-475b4539.cjs} +2 -2
- package/dist/cjs/{index-41d4ce9e.cjs → index-4b9cc9db.cjs} +2 -2
- package/dist/cjs/{index-0c0e48bd.cjs → index-7de08e81.cjs} +1 -1
- package/dist/cjs/{index-a2ac2501.cjs → index-7e3602c5.cjs} +1 -1
- package/dist/cjs/{index-56f21973.cjs → index-8e7ec75f.cjs} +1 -1
- package/dist/cjs/{index-c40d494c.cjs → index-b30f5999.cjs} +1 -1
- package/dist/cjs/index-bec3f245.cjs +9 -0
- package/dist/cjs/{index-65d19adb.cjs → index-d291a707.cjs} +1 -1
- package/dist/cjs/{index-f529a5e1.cjs → index-e368a1ec.cjs} +1 -1
- package/dist/cjs/{index-ad37aa8e.cjs → index-f107e2df.cjs} +1 -1
- package/dist/cjs/{index-8c9af5ed.cjs → index-fdec095f.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-8f036e0f.cjs → index.es-8a10cab5.cjs} +1 -1
- package/dist/cjs/{interface-b28a2cea.cjs → interface-c5af1d39.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-e979897b.cjs → lib-typedarrays-18eafa57.cjs} +1 -1
- package/dist/cjs/{portis-a05f6805.cjs → portis-3e53aa74.cjs} +1 -1
- package/dist/cjs/{provider-deee1712.cjs → provider-0765a0c4.cjs} +1 -1
- package/dist/cjs/providers/wallets/index.d.ts +5 -1
- package/dist/cjs/providers/wallets/types.d.ts +1 -0
- package/dist/cjs/{rainbow-69c0a69b.cjs → rainbow-f0553261.cjs} +1 -1
- package/dist/cjs/{sha224-9457bb96.cjs → sha224-f39873dc.cjs} +1 -1
- package/dist/cjs/{sha256-5fb5de86.cjs → sha256-0f1577ad.cjs} +1 -1
- package/dist/cjs/{uAuth-7fa3d23a.cjs → uAuth-9f12e987.cjs} +1 -1
- package/dist/cjs/{walletConnect-c603a6a4.cjs → walletConnect-08310517.cjs} +1 -1
- package/dist/cjs/{walletLink-899a33a2.cjs → walletLink-695f93b6.cjs} +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/{draggabilly-8b6b21c5.js → draggabilly-be876492.js} +1 -1
- package/dist/{ethers-598924c4.js → ethers-a71b41f1.js} +1 -1
- package/dist/{id-bce3c131.js → id-aa7002c2.js} +1 -1
- package/dist/index-0c189400.js +9 -0
- package/dist/{index-b80e350c.js → index-1fa84282.js} +1 -1
- package/dist/{index-57766b84.js → index-2ff19703.js} +1 -1
- package/dist/{index-a6717e78.js → index-3a56ad18.js} +1 -1
- package/dist/index-466c44f8.js +1 -0
- package/dist/{index-cf915864.js → index-9d6a1b0f.js} +2 -2
- package/dist/{index-7f873c40.js → index-a7fd26b2.js} +1 -1
- package/dist/{index-cf9d6206.js → index-c8b61e1c.js} +1 -1
- package/dist/{index-0288dfdf.js → index-cae05be8.js} +1 -1
- package/dist/{index-19bc04f2.js → index-f19f4eef.js} +1 -1
- package/dist/{index-13cee3c1.js → index-f9177065.js} +1 -1
- package/dist/{index.es-2b585733.js → index.es-59cd195e.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-bdaa6e2e.js → interface-9c07cadd.js} +1 -1
- package/dist/{lib-typedarrays-b5e70c03.js → lib-typedarrays-fcec28ff.js} +1 -1
- package/dist/{portis-58d16f24.js → portis-6134280d.js} +1 -1
- package/dist/{provider-62a23419.js → provider-b7f8b65b.js} +1 -1
- package/dist/providers/wallets/index.d.ts +5 -1
- package/dist/providers/wallets/types.d.ts +1 -0
- package/dist/rainbow-9e32f732.js +1 -0
- package/dist/sha224-849f74bf.js +1 -0
- package/dist/{sha256-c7e66f3f.js → sha256-3dad34ed.js} +1 -1
- package/dist/{uAuth-0812723b.js → uAuth-fac6fff4.js} +1 -1
- package/dist/{walletConnect-0b1a9181.js → walletConnect-62201bb8.js} +1 -1
- package/dist/{walletLink-7080edd7.js → walletLink-82cc3eeb.js} +1 -1
- package/package.json +1 -1
- package/dist/__node-resolve_empty-ad78977d.js +0 -1
- package/dist/__tslib-e712523b.js +0 -1
- package/dist/cjs/__tslib-b203abab.cjs +0 -1
- package/dist/cjs/index-578427cc.cjs +0 -9
- package/dist/index-9b7de542.js +0 -9
- package/dist/index-cb9250a0.js +0 -1
- package/dist/rainbow-898a2c25.js +0 -1
- package/dist/sha224-1c4b79b3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./index-578427cc.cjs"),t=require("@ethersproject/address"),n=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),o=require("@ethersproject/bytes"),i=require("./index-f529a5e1.cjs"),a=require("./index-ad37aa8e.cjs"),s=require("./ethers-ba816f82.cjs"),c=require("./id-323e4c90.cjs"),u=require("@ethersproject/json-wallets"),p=require("@ethersproject/properties"),l=require("./index-c40d494c.cjs"),d=require("@ethersproject/transactions"),f=require("@ethersproject/contracts"),h=require("./DefaultJsonRpcProvider-ca454f8e.cjs");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("zustand"),require("events"),require("@ethersproject/constants"),require("./interface-b28a2cea.cjs"),require("@ethersproject/abstract-provider"),require("./bn-b63aca15.cjs"),require("./__node-resolve_empty-6d7ad87b.cjs"),require("./hash-7ce6fed5.cjs"),require("./inherits_browser-50deae74.cjs");var m,y=g(t),b=g(o),v=g(u),w=g(p),P=g(d),x=Object.freeze({__proto__:null,_toEscapedUtf8String:c._toEscapedUtf8String,toUtf8Bytes:c.toUtf8Bytes,toUtf8CodePoints:c.toUtf8CodePoints,toUtf8String:c.toUtf8String,Utf8ErrorFuncs:c.Utf8ErrorFuncs,get Utf8ErrorReason(){return c.Utf8ErrorReason},get UnicodeNormalizationForm(){return c.UnicodeNormalizationForm},formatBytes32String:s.formatBytes32String,parseBytes32String:s.parseBytes32String,nameprep:s.nameprep}),_=Object.freeze({__proto__:null,id:c.id,dnsEncode:s.dnsEncode,namehash:s.namehash,isValidName:s.isValidName,ensNormalize:s.ensNormalize,messagePrefix:s.messagePrefix,hashMessage:s.hashMessage,_TypedDataEncoder:i.TypedDataEncoder}),O=Object.freeze({__proto__:null,computeHmac:s.computeHmac,ripemd160:s.ripemd160,sha256:s.sha256,sha512:s.sha512,get SupportedAlgorithm(){return s.SupportedAlgorithm}}),j=Object.freeze({__proto__:null,randomBytes:s.randomBytes,shuffled:s.shuffled});class S extends n.Signer{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.__awaiter(this,void 0,void 0,(function*(){return Promise.resolve(t.getAddress(this._address))}))}signMessage(t){return e.__awaiter(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.__awaiter(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(t){return e.__awaiter(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.__awaiter(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 S(null!=e?e:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new S(this.provider,this.upWallet,this._address,this._index)}}!function(e){e.REGISTER="register"}(m||(m={}));var E,k=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},T=function(e,t){this.type=e,this.data=t},A=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function U(){return U=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},U.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(E||(E={}));var C=function(e){return o.arrayify(function(e){var t=U({},e.types);return delete t.EIP712Domain,i.TypedDataEncoder.hash(e.domain,t,e.message)}(e))},L={},N=e.getAugmentedNamespace(s.lib_esm),I=e.getAugmentedNamespace(s.lib_esm$1),D=e.getAugmentedNamespace(_),R=e.getAugmentedNamespace(s.lib_esm$2),M=e.getAugmentedNamespace(e.lib_esm),B=e.getAugmentedNamespace(c.lib_esm),F=e.getAugmentedNamespace(O),z=e.getAugmentedNamespace(s.lib_esm$3),W=e.getAugmentedNamespace(j),q=e.getAugmentedNamespace(l.lib_esm),G=e.getAugmentedNamespace(s.lib_esm$4),J=e.getAugmentedNamespace(x),V=e.getAugmentedNamespace(s.lib_esm$5),H=e.getAugmentedNamespace(s.lib_esm$6),$=e.getAugmentedNamespace(i.lib_esm);function K(){K=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 d?t:d,a=Object.create(i.prototype),s=new j(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 d(){}function f(){}function h(){}var g={};c(g,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(S([])));y&&y!==t&&n.call(y,i)&&(g=y);var b=h.prototype=d.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 _(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 O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,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 f.prototype=h,r(b,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:f,configurable:!0}),f.displayName=c(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"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,j.prototype={constructor:j,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(O),!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),O(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;O(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 Z(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 Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Z(i,r,o,a,s,"next",e)}function s(e){Z(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Q(){return Q=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},Q.apply(this,arguments)}!function(t){var n=e.commonjsGlobal&&e.commonjsGlobal.__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]}),r=e.commonjsGlobal&&e.commonjsGlobal.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e.commonjsGlobal&&e.commonjsGlobal.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.formatBytes32String=t.Utf8ErrorFuncs=t.toUtf8String=t.toUtf8CodePoints=t.toUtf8Bytes=t._toEscapedUtf8String=t.nameprep=t.hexDataSlice=t.hexDataLength=t.hexZeroPad=t.hexValue=t.hexStripZeros=t.hexConcat=t.isHexString=t.hexlify=t.base64=t.base58=t.TransactionDescription=t.LogDescription=t.Interface=t.SigningKey=t.HDNode=t.defaultPath=t.isBytesLike=t.isBytes=t.zeroPad=t.stripZeros=t.concat=t.arrayify=t.shallowCopy=t.resolveProperties=t.getStatic=t.defineReadOnly=t.deepCopy=t.checkProperties=t.poll=t.fetchJson=t._fetchData=t.RLP=t.Logger=t.checkResultErrors=t.FormatTypes=t.ParamType=t.FunctionFragment=t.EventFragment=t.ErrorFragment=t.ConstructorFragment=t.Fragment=t.defaultAbiCoder=t.AbiCoder=void 0,t.Indexed=t.Utf8ErrorReason=t.UnicodeNormalizationForm=t.SupportedAlgorithm=t.mnemonicToSeed=t.isValidMnemonic=t.entropyToMnemonic=t.mnemonicToEntropy=t.getAccountPath=t.verifyTypedData=t.verifyMessage=t.recoverPublicKey=t.computePublicKey=t.recoverAddress=t.computeAddress=t.getJsonWalletAddress=t.TransactionTypes=t.serializeTransaction=t.parseTransaction=t.accessListify=t.joinSignature=t.splitSignature=t.soliditySha256=t.solidityKeccak256=t.solidityPack=t.shuffled=t.randomBytes=t.sha512=t.sha256=t.ripemd160=t.keccak256=t.computeHmac=t.commify=t.parseUnits=t.formatUnits=t.parseEther=t.formatEther=t.isAddress=t.getCreate2Address=t.getContractAddress=t.getIcapAddress=t.getAddress=t._TypedDataEncoder=t.id=t.isValidName=t.namehash=t.hashMessage=t.dnsEncode=t.parseBytes32String=void 0;var i=a.require$$0;Object.defineProperty(t,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(t,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(t,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(t,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(t,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(t,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(t,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(t,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(t,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(t,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(t,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(t,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(t,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var s=y.default;Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return s.getAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return s.getCreate2Address}}),Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return s.getContractAddress}}),Object.defineProperty(t,"getIcapAddress",{enumerable:!0,get:function(){return s.getIcapAddress}}),Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return s.isAddress}});var c=o(N);t.base64=c;var u=I;Object.defineProperty(t,"base58",{enumerable:!0,get:function(){return u.Base58}});var p=b.default;Object.defineProperty(t,"arrayify",{enumerable:!0,get:function(){return p.arrayify}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return p.concat}}),Object.defineProperty(t,"hexConcat",{enumerable:!0,get:function(){return p.hexConcat}}),Object.defineProperty(t,"hexDataSlice",{enumerable:!0,get:function(){return p.hexDataSlice}}),Object.defineProperty(t,"hexDataLength",{enumerable:!0,get:function(){return p.hexDataLength}}),Object.defineProperty(t,"hexlify",{enumerable:!0,get:function(){return p.hexlify}}),Object.defineProperty(t,"hexStripZeros",{enumerable:!0,get:function(){return p.hexStripZeros}}),Object.defineProperty(t,"hexValue",{enumerable:!0,get:function(){return p.hexValue}}),Object.defineProperty(t,"hexZeroPad",{enumerable:!0,get:function(){return p.hexZeroPad}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return p.isBytes}}),Object.defineProperty(t,"isBytesLike",{enumerable:!0,get:function(){return p.isBytesLike}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return p.isHexString}}),Object.defineProperty(t,"joinSignature",{enumerable:!0,get:function(){return p.joinSignature}}),Object.defineProperty(t,"zeroPad",{enumerable:!0,get:function(){return p.zeroPad}}),Object.defineProperty(t,"splitSignature",{enumerable:!0,get:function(){return p.splitSignature}}),Object.defineProperty(t,"stripZeros",{enumerable:!0,get:function(){return p.stripZeros}});var l=D;Object.defineProperty(t,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(t,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(t,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return l.namehash}});var d=R;Object.defineProperty(t,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(t,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(t,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(t,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(t,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(t,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(t,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var f=v.default;Object.defineProperty(t,"getJsonWalletAddress",{enumerable:!0,get:function(){return f.getJsonWalletAddress}});var h=M;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return h.keccak256}});var g=B;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return g.Logger}});var m=F;Object.defineProperty(t,"computeHmac",{enumerable:!0,get:function(){return m.computeHmac}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return m.ripemd160}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return m.sha256}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return m.sha512}});var x=z;Object.defineProperty(t,"solidityKeccak256",{enumerable:!0,get:function(){return x.keccak256}}),Object.defineProperty(t,"solidityPack",{enumerable:!0,get:function(){return x.pack}}),Object.defineProperty(t,"soliditySha256",{enumerable:!0,get:function(){return x.sha256}});var _=W;Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return _.randomBytes}}),Object.defineProperty(t,"shuffled",{enumerable:!0,get:function(){return _.shuffled}});var O=w.default;Object.defineProperty(t,"checkProperties",{enumerable:!0,get:function(){return O.checkProperties}}),Object.defineProperty(t,"deepCopy",{enumerable:!0,get:function(){return O.deepCopy}}),Object.defineProperty(t,"defineReadOnly",{enumerable:!0,get:function(){return O.defineReadOnly}}),Object.defineProperty(t,"getStatic",{enumerable:!0,get:function(){return O.getStatic}}),Object.defineProperty(t,"resolveProperties",{enumerable:!0,get:function(){return O.resolveProperties}}),Object.defineProperty(t,"shallowCopy",{enumerable:!0,get:function(){return O.shallowCopy}});var j=o(q);t.RLP=j;var S=G;Object.defineProperty(t,"computePublicKey",{enumerable:!0,get:function(){return S.computePublicKey}}),Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return S.recoverPublicKey}}),Object.defineProperty(t,"SigningKey",{enumerable:!0,get:function(){return S.SigningKey}});var E=J;Object.defineProperty(t,"formatBytes32String",{enumerable:!0,get:function(){return E.formatBytes32String}}),Object.defineProperty(t,"nameprep",{enumerable:!0,get:function(){return E.nameprep}}),Object.defineProperty(t,"parseBytes32String",{enumerable:!0,get:function(){return E.parseBytes32String}}),Object.defineProperty(t,"_toEscapedUtf8String",{enumerable:!0,get:function(){return E._toEscapedUtf8String}}),Object.defineProperty(t,"toUtf8Bytes",{enumerable:!0,get:function(){return E.toUtf8Bytes}}),Object.defineProperty(t,"toUtf8CodePoints",{enumerable:!0,get:function(){return E.toUtf8CodePoints}}),Object.defineProperty(t,"toUtf8String",{enumerable:!0,get:function(){return E.toUtf8String}}),Object.defineProperty(t,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return E.Utf8ErrorFuncs}});var k=P.default;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return k.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return k.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return k.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return k.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return k.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return k.TransactionTypes}});var T=V;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return T.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return T.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return T.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return T.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return T.parseUnits}});var A=H;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return A.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return A.verifyTypedData}});var U=$;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return U._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return U.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return U.poll}});var C=F;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return C.SupportedAlgorithm}});var L=J;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return L.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return L.Utf8ErrorReason}})}(L);var X="wallet.unipass.id",ee={upDomain:X,upConnectUrl:"https://"+X+"/connect",upLogoutUrl:"https://"+X+"/logout",upSignMessageUrl:"https://"+X+"/sign-message",upTransactionUrl:"https://"+X+"/send-transaction",upLoadingUrl:"https://"+X+"/connect/loading"},te=function(){return ee},ne={protocol:"https",domain:"testnet.wallet.unipass.id"},re={protocol:"https",domain:"wallet.unipass.id"},oe={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"}},ie=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)}}},ae=function(){var e=Y(K().mark((function e(t,n){var r,o;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(t.storageType).get(Pe),e.t0=r&&JSON.parse(r),e.t0){e.next=6;break}return e.next=5,ce(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)}}(),se=function(){var e=Y(K().mark((function e(t){var n;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new A("UP_LOGOUT"),e.next=4,xe(n);case 4:ie("localStorage").remove(Pe),ie("sessionStorage").remove(Pe);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ce=function(){var e=Y(K().mark((function e(t,n){var r,o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new A("UP_LOGIN",r,t.appSettings),e.next=5,xe(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&&ie(t.storageType).set(Pe,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)}}(),ue="UP_WALLET_POP",pe=null,le=null;function de(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 fe(e,t,n){return he.apply(this,arguments)}function he(){return(he=Y(K().mark((function e(t,n,r){var o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==pe||null!=(o=pe)&&o.closed)){e.next=8;break}if(null!=(pe=de(t,ue,window))){e.next=6;break}return e.next=5,ge(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:le!==t?(pe.location.replace(t),pe.focus()):pe.focus();case 9:return i=setInterval((function(){if(pe&&pe.closed){var e={data:new A("UP_RESPONSE",JSON.stringify(new T("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){pe&&!pe.closed&&pe.close(),pe=null},e.abrupt("return",{popup:pe,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e,t,n){return me.apply(this,arguments)}function me(){return(me=Y(K().mark((function e(t,n,r){var o,i;return K().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(fe(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=function(){};function be(e,t,n){if("UP_LOGIN"===e)return"google"===t?te().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?te().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):te().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return te().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return te().upSignMessageUrl;if("UP_TRANSACTION"===e)return te().upTransactionUrl;if("UP_READY"===e)return te().upLoadingUrl;throw new Error("unsupport type "+e)}function ve(e,t,n,r){return we.apply(this,arguments)}function we(){return we=Y(K().mark((function e(t,n,r,o){var i,a,s,c,u,p,l,d,f,h;return K().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)}},f=function(){try{window.removeEventListener("message",d),l(),i()}catch(e){console.error("Popup Close Error",e)}},d=function(e){try{if("object"!=typeof e.data)return;var t=e.data;if(!t||!t.type)return;"UP_CLOSE"===e.data.type&&f(),"UP_READY"===t.type&&s(e,{send:h,close:f}),"UP_RESPONSE"===t.type&&c(e,{send:h,close:f}),"UP_EVENT"===t.type&&a(e,{send:h,close:f})}catch(e){console.error("Popup Callback Error",e),f()}},null!=t){e.next=5;break}return e.abrupt("return",{send:ye,close:ye});case 5:return i=(null==o?void 0:o.onClose)||ye,a=(null==o?void 0:o.onMessage)||ye,s=(null==o?void 0:o.onReady)||ye,c=(null==o?void 0:o.onResponse)||ye,window.addEventListener("message",d),e.next=12,fe(be(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:f});case 16:case"end":return e.stop()}}),e)}))),we.apply(this,arguments)}var Pe="UP-A";function xe(e,t,n,r){return new Promise(function(){var o=Y(K().mark((function o(i,a){return K().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,ve(e,t,n,{onReady:function(t,n){return Y(K().mark((function t(){var r;return K().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 Y(K().mark((function r(){var o,s,c;return K().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 se(!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 Y(K().mark((function t(){var n,o;return K().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 Y(K().mark((function e(){return K().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 _e=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(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 A("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,xe(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)}}(),Oe=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(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 A("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,xe(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)}}(),je="0x1626ba7e";var Se=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,o=(t=this._config.env,n=this._config.chainType,{env:t,nodeRPC:"prod"===t?oe.mainnet[n]:oe.testnet[n],chainType:n,walletUrl:"prod"===t?re:ne});this._config.nodeRPC=e.nodeRPC||o.nodeRPC,this._config.appSettings=function(e,t){return Q({},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 r.JsonRpcProvider(this._config.nodeRPC),this._auth_provider=new r.JsonRpcProvider(function(e){return"prod"===e?oe.mainnet.polygon:oe.testnet.polygon}(this._config.env));var i,a,s,c=e.walletUrl||o.walletUrl;c&&(a=(i=c).domain,s=i.protocol,ee={upDomain:a=a||X,upConnectUrl:(s=s||"https")+"://"+a+"/connect",upLogoutUrl:s+"://"+a+"/logout",upSignMessageUrl:s+"://"+a+"/sign-message",upTransactionUrl:s+"://"+a+"/send-transaction",upLoadingUrl:s+"://"+a+"/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 r.JsonRpcProvider(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},t.login=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ae(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=ie(e).get(Pe))?JSON.parse(t):void 0},t.logout=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,se(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=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,Oe(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=Y(K().mark((function e(t,n){var r,o,i,a,s;return K().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=L.toUtf8Bytes(t)),e.next=5,_e(new k(this.getAddress(),L.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=Y(K().mark((function e(t,n,r){var o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new f.Contract(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=L.toUtf8Bytes(a)),L.keccak256(L.concat([L.toUtf8Bytes("UniPass Signed Message:\n"),L.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===je);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=Y(K().mark((function e(t,n){var r,o;return K().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,_e(new k(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=Y(K().mark((function e(t,n,r){var o,i,a;return K().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 f.Contract(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=C(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===je);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function Ee(n){var r,o,i;return e.__awaiter(this,void 0,void 0,(function*(){const a=n.JsonRpcProvider||h.DefaultJsonRpcProvider,s=null!==(r=n.chainId)&&void 0!==r?r:1;let c=null!==(o=n.rpcUrl)&&void 0!==o?o:null===(i=n.rpc)||void 0===i?void 0:i[s];const u=new class extends a{constructor(t,r){super(t,r),this.updateUpWalletConfig=t=>{var r;const o=null===(r=n.rpc)||void 0===r?void 0:r[t];if(!e.SUPPORTED_CHAIN_ID.includes(t))throw new Error(`chainId ${t} not supported`);if(this.upWallet.updateConfig({chainType:e.getChainNameByChainId(t),nodeRPC:o,appSettings:{chain:e.getChainNameByChainId(t)}}),"object"==typeof this.network)this.network.chainId=t;else{const e={chainId:t,name:"unknown"};p.defineReadOnly(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.upWallet=new Se({env:e.getENVByChainId(s),chainType:e.getChainNameByChainId(s),appSettings:{appIcon:n.appLogoUrl,appName:n.appName,chain:e.getChainNameByChainId(s)},rpcUrl:c,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new S(u,this.upWallet,null!==(e=null==t?void 0:t.address)&&void 0!==e?e:"",0)}connect(){return e.__awaiter(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return e||(yield this.upWallet.login({email:false}))}))}disconnect(){return e.__awaiter(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return e.__awaiter(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)?t.getAddress(null==e?void 0:e.address):null)}}(c,s);return u}))}exports.createProvider=Ee,exports.default=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield Ee(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}))},exports.disconnectWallet=function(){var t;null===(t=e.useWalletStore.getState().provider)||void 0===t||t.disconnect()},exports.signTypedData=function(t){var n,r;return null===(r=null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.upWallet)||void 0===r?void 0:r.signTypedData(t)},exports.switchChain=function(t){var n;const r=t.addChainParameters.chainId,o="string"==typeof r&&(null==r?void 0:r.startsWith("0x"))?parseInt(r,16):Number(r);if(!e.SUPPORTED_CHAIN_ID.includes(o))throw new Error(`chainId ${o} not supported`);return null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.updateUpWalletConfig(o)};
|
|
1
|
+
"use strict";var e=require("./index-bec3f245.cjs"),t=require("@ethersproject/address"),n=require("@ethersproject/abstract-signer"),r=require("@ethersproject/providers"),o=require("@ethersproject/bytes"),i=require("./index-e368a1ec.cjs"),a=require("./index-f107e2df.cjs"),s=require("./ethers-747d32a6.cjs"),u=require("./id-ef87d991.cjs"),c=require("@ethersproject/json-wallets"),p=require("@ethersproject/properties"),l=require("./index-b30f5999.cjs"),d=require("@ethersproject/transactions"),f=require("@ethersproject/contracts"),h=require("./DefaultJsonRpcProvider-2894e1a2.cjs");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("zustand"),require("events"),require("@ethersproject/constants"),require("./interface-c5af1d39.cjs"),require("@ethersproject/abstract-provider"),require("./bn-002a9654.cjs"),require("./__node-resolve_empty-f57ca5f8.cjs"),require("./hash-7ce6fed5.cjs"),require("./inherits_browser-50deae74.cjs");var m,y=g(t),b=g(o),v=g(c),w=g(p),P=g(d),x=Object.freeze({__proto__:null,_toEscapedUtf8String:u._toEscapedUtf8String,toUtf8Bytes:u.toUtf8Bytes,toUtf8CodePoints:u.toUtf8CodePoints,toUtf8String:u.toUtf8String,Utf8ErrorFuncs:u.Utf8ErrorFuncs,get Utf8ErrorReason(){return u.Utf8ErrorReason},get UnicodeNormalizationForm(){return u.UnicodeNormalizationForm},formatBytes32String:s.formatBytes32String,parseBytes32String:s.parseBytes32String,nameprep:s.nameprep}),_=Object.freeze({__proto__:null,id:u.id,dnsEncode:s.dnsEncode,namehash:s.namehash,isValidName:s.isValidName,ensNormalize:s.ensNormalize,messagePrefix:s.messagePrefix,hashMessage:s.hashMessage,_TypedDataEncoder:i.TypedDataEncoder}),O=Object.freeze({__proto__:null,computeHmac:s.computeHmac,ripemd160:s.ripemd160,sha256:s.sha256,sha512:s.sha512,get SupportedAlgorithm(){return s.SupportedAlgorithm}}),j=Object.freeze({__proto__:null,randomBytes:s.randomBytes,shuffled:s.shuffled});class S extends n.Signer{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.__awaiter(this,void 0,void 0,(function*(){return Promise.resolve(t.getAddress(this._address))}))}signMessage(t){return e.__awaiter(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.__awaiter(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(t){return e.__awaiter(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.__awaiter(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 S(null!=e?e:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new S(this.provider,this.upWallet,this._address,this._index)}}!function(e){e.REGISTER="register"}(m||(m={}));var E,k=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},T=function(e,t){this.type=e,this.data=t},A=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function U(){return U=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},U.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(E||(E={}));var C=function(e){return o.arrayify(function(e){var t=U({},e.types);return delete t.EIP712Domain,i.TypedDataEncoder.hash(e.domain,t,e.message)}(e))},L={},N=e.getAugmentedNamespace(s.lib_esm),I=e.getAugmentedNamespace(s.lib_esm$1),D=e.getAugmentedNamespace(_),R=e.getAugmentedNamespace(s.lib_esm$2),M=e.getAugmentedNamespace(e.lib_esm),B=e.getAugmentedNamespace(u.lib_esm),F=e.getAugmentedNamespace(O),z=e.getAugmentedNamespace(s.lib_esm$3),W=e.getAugmentedNamespace(j),q=e.getAugmentedNamespace(l.lib_esm),G=e.getAugmentedNamespace(s.lib_esm$4),J=e.getAugmentedNamespace(x),V=e.getAugmentedNamespace(s.lib_esm$5),H=e.getAugmentedNamespace(s.lib_esm$6),$=e.getAugmentedNamespace(i.lib_esm);function K(){K=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 u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),s=new j(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=c;var l={};function d(){}function f(){}function h(){}var g={};u(g,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(S([])));y&&y!==t&&n.call(y,i)&&(g=y);var b=h.prototype=d.prototype=Object.create(g);function v(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,s){var u=p(e[r],e,i);if("throw"!==u.type){var c=u.arg,l=c.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){c.value=e,a(c)}),(function(e){return o("throw",e,a,s)}))}s(u.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 u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.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 _(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 O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,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 f.prototype=h,r(b,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:f,configurable:!0}),f.displayName=u(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},v(w.prototype),u(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(c(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(b),u(b,s,"Generator"),u(b,i,(function(){return this})),u(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,j.prototype={constructor:j,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(O),!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"),u=n.call(i,"finallyLoc");if(s&&u){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(!u)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),O(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;O(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 Z(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Z(i,r,o,a,s,"next",e)}function s(e){Z(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Q(){return Q=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},Q.apply(this,arguments)}!function(t){var n=e.commonjsGlobal&&e.commonjsGlobal.__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]}),r=e.commonjsGlobal&&e.commonjsGlobal.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e.commonjsGlobal&&e.commonjsGlobal.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.formatBytes32String=t.Utf8ErrorFuncs=t.toUtf8String=t.toUtf8CodePoints=t.toUtf8Bytes=t._toEscapedUtf8String=t.nameprep=t.hexDataSlice=t.hexDataLength=t.hexZeroPad=t.hexValue=t.hexStripZeros=t.hexConcat=t.isHexString=t.hexlify=t.base64=t.base58=t.TransactionDescription=t.LogDescription=t.Interface=t.SigningKey=t.HDNode=t.defaultPath=t.isBytesLike=t.isBytes=t.zeroPad=t.stripZeros=t.concat=t.arrayify=t.shallowCopy=t.resolveProperties=t.getStatic=t.defineReadOnly=t.deepCopy=t.checkProperties=t.poll=t.fetchJson=t._fetchData=t.RLP=t.Logger=t.checkResultErrors=t.FormatTypes=t.ParamType=t.FunctionFragment=t.EventFragment=t.ErrorFragment=t.ConstructorFragment=t.Fragment=t.defaultAbiCoder=t.AbiCoder=void 0,t.Indexed=t.Utf8ErrorReason=t.UnicodeNormalizationForm=t.SupportedAlgorithm=t.mnemonicToSeed=t.isValidMnemonic=t.entropyToMnemonic=t.mnemonicToEntropy=t.getAccountPath=t.verifyTypedData=t.verifyMessage=t.recoverPublicKey=t.computePublicKey=t.recoverAddress=t.computeAddress=t.getJsonWalletAddress=t.TransactionTypes=t.serializeTransaction=t.parseTransaction=t.accessListify=t.joinSignature=t.splitSignature=t.soliditySha256=t.solidityKeccak256=t.solidityPack=t.shuffled=t.randomBytes=t.sha512=t.sha256=t.ripemd160=t.keccak256=t.computeHmac=t.commify=t.parseUnits=t.formatUnits=t.parseEther=t.formatEther=t.isAddress=t.getCreate2Address=t.getContractAddress=t.getIcapAddress=t.getAddress=t._TypedDataEncoder=t.id=t.isValidName=t.namehash=t.hashMessage=t.dnsEncode=t.parseBytes32String=void 0;var i=a.require$$0;Object.defineProperty(t,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(t,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(t,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(t,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(t,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(t,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(t,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(t,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(t,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(t,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(t,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(t,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(t,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var s=y.default;Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return s.getAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return s.getCreate2Address}}),Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return s.getContractAddress}}),Object.defineProperty(t,"getIcapAddress",{enumerable:!0,get:function(){return s.getIcapAddress}}),Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return s.isAddress}});var u=o(N);t.base64=u;var c=I;Object.defineProperty(t,"base58",{enumerable:!0,get:function(){return c.Base58}});var p=b.default;Object.defineProperty(t,"arrayify",{enumerable:!0,get:function(){return p.arrayify}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return p.concat}}),Object.defineProperty(t,"hexConcat",{enumerable:!0,get:function(){return p.hexConcat}}),Object.defineProperty(t,"hexDataSlice",{enumerable:!0,get:function(){return p.hexDataSlice}}),Object.defineProperty(t,"hexDataLength",{enumerable:!0,get:function(){return p.hexDataLength}}),Object.defineProperty(t,"hexlify",{enumerable:!0,get:function(){return p.hexlify}}),Object.defineProperty(t,"hexStripZeros",{enumerable:!0,get:function(){return p.hexStripZeros}}),Object.defineProperty(t,"hexValue",{enumerable:!0,get:function(){return p.hexValue}}),Object.defineProperty(t,"hexZeroPad",{enumerable:!0,get:function(){return p.hexZeroPad}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return p.isBytes}}),Object.defineProperty(t,"isBytesLike",{enumerable:!0,get:function(){return p.isBytesLike}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return p.isHexString}}),Object.defineProperty(t,"joinSignature",{enumerable:!0,get:function(){return p.joinSignature}}),Object.defineProperty(t,"zeroPad",{enumerable:!0,get:function(){return p.zeroPad}}),Object.defineProperty(t,"splitSignature",{enumerable:!0,get:function(){return p.splitSignature}}),Object.defineProperty(t,"stripZeros",{enumerable:!0,get:function(){return p.stripZeros}});var l=D;Object.defineProperty(t,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(t,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(t,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return l.namehash}});var d=R;Object.defineProperty(t,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(t,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(t,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(t,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(t,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(t,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(t,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var f=v.default;Object.defineProperty(t,"getJsonWalletAddress",{enumerable:!0,get:function(){return f.getJsonWalletAddress}});var h=M;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return h.keccak256}});var g=B;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return g.Logger}});var m=F;Object.defineProperty(t,"computeHmac",{enumerable:!0,get:function(){return m.computeHmac}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return m.ripemd160}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return m.sha256}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return m.sha512}});var x=z;Object.defineProperty(t,"solidityKeccak256",{enumerable:!0,get:function(){return x.keccak256}}),Object.defineProperty(t,"solidityPack",{enumerable:!0,get:function(){return x.pack}}),Object.defineProperty(t,"soliditySha256",{enumerable:!0,get:function(){return x.sha256}});var _=W;Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return _.randomBytes}}),Object.defineProperty(t,"shuffled",{enumerable:!0,get:function(){return _.shuffled}});var O=w.default;Object.defineProperty(t,"checkProperties",{enumerable:!0,get:function(){return O.checkProperties}}),Object.defineProperty(t,"deepCopy",{enumerable:!0,get:function(){return O.deepCopy}}),Object.defineProperty(t,"defineReadOnly",{enumerable:!0,get:function(){return O.defineReadOnly}}),Object.defineProperty(t,"getStatic",{enumerable:!0,get:function(){return O.getStatic}}),Object.defineProperty(t,"resolveProperties",{enumerable:!0,get:function(){return O.resolveProperties}}),Object.defineProperty(t,"shallowCopy",{enumerable:!0,get:function(){return O.shallowCopy}});var j=o(q);t.RLP=j;var S=G;Object.defineProperty(t,"computePublicKey",{enumerable:!0,get:function(){return S.computePublicKey}}),Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return S.recoverPublicKey}}),Object.defineProperty(t,"SigningKey",{enumerable:!0,get:function(){return S.SigningKey}});var E=J;Object.defineProperty(t,"formatBytes32String",{enumerable:!0,get:function(){return E.formatBytes32String}}),Object.defineProperty(t,"nameprep",{enumerable:!0,get:function(){return E.nameprep}}),Object.defineProperty(t,"parseBytes32String",{enumerable:!0,get:function(){return E.parseBytes32String}}),Object.defineProperty(t,"_toEscapedUtf8String",{enumerable:!0,get:function(){return E._toEscapedUtf8String}}),Object.defineProperty(t,"toUtf8Bytes",{enumerable:!0,get:function(){return E.toUtf8Bytes}}),Object.defineProperty(t,"toUtf8CodePoints",{enumerable:!0,get:function(){return E.toUtf8CodePoints}}),Object.defineProperty(t,"toUtf8String",{enumerable:!0,get:function(){return E.toUtf8String}}),Object.defineProperty(t,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return E.Utf8ErrorFuncs}});var k=P.default;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return k.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return k.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return k.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return k.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return k.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return k.TransactionTypes}});var T=V;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return T.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return T.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return T.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return T.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return T.parseUnits}});var A=H;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return A.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return A.verifyTypedData}});var U=$;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return U._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return U.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return U.poll}});var C=F;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return C.SupportedAlgorithm}});var L=J;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return L.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return L.Utf8ErrorReason}})}(L);var X="wallet.unipass.id",ee={upDomain:X,upConnectUrl:"https://"+X+"/connect",upLogoutUrl:"https://"+X+"/logout",upSignMessageUrl:"https://"+X+"/sign-message",upTransactionUrl:"https://"+X+"/send-transaction",upLoadingUrl:"https://"+X+"/connect/loading"},te=function(){return ee},ne={protocol:"https",domain:"testnet.wallet.unipass.id"},re={protocol:"https",domain:"wallet.unipass.id"},oe={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"}},ie=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)}}},ae=function(){var e=Y(K().mark((function e(t,n){var r,o;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(t.storageType).get(Pe),e.t0=r&&JSON.parse(r),e.t0){e.next=6;break}return e.next=5,ue(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)}}(),se=function(){var e=Y(K().mark((function e(t){var n;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new A("UP_LOGOUT"),e.next=4,xe(n);case 4:ie("localStorage").remove(Pe),ie("sessionStorage").remove(Pe);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ue=function(){var e=Y(K().mark((function e(t,n){var r,o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new A("UP_LOGIN",r,t.appSettings),e.next=5,xe(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&&ie(t.storageType).set(Pe,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)}}(),ce="UP_WALLET_POP",pe=null,le=null;function de(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 fe(e,t,n){return he.apply(this,arguments)}function he(){return(he=Y(K().mark((function e(t,n,r){var o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==pe||null!=(o=pe)&&o.closed)){e.next=8;break}if(null!=(pe=de(t,ce,window))){e.next=6;break}return e.next=5,ge(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:le!==t?(pe.location.replace(t),pe.focus()):pe.focus();case 9:return i=setInterval((function(){if(pe&&pe.closed){var e={data:new A("UP_RESPONSE",JSON.stringify(new T("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){pe&&!pe.closed&&pe.close(),pe=null},e.abrupt("return",{popup:pe,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e,t,n){return me.apply(this,arguments)}function me(){return(me=Y(K().mark((function e(t,n,r){var o,i;return K().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(fe(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=function(){};function be(e,t,n){if("UP_LOGIN"===e)return"google"===t?te().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?te().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):te().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return te().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return te().upSignMessageUrl;if("UP_TRANSACTION"===e)return te().upTransactionUrl;if("UP_READY"===e)return te().upLoadingUrl;throw new Error("unsupport type "+e)}function ve(e,t,n,r){return we.apply(this,arguments)}function we(){return we=Y(K().mark((function e(t,n,r,o){var i,a,s,u,c,p,l,d,f,h;return K().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)}},f=function(){try{window.removeEventListener("message",d),l(),i()}catch(e){console.error("Popup Close Error",e)}},d=function(e){try{if("object"!=typeof e.data)return;var t=e.data;if(!t||!t.type)return;"UP_CLOSE"===e.data.type&&f(),"UP_READY"===t.type&&s(e,{send:h,close:f}),"UP_RESPONSE"===t.type&&u(e,{send:h,close:f}),"UP_EVENT"===t.type&&a(e,{send:h,close:f})}catch(e){console.error("Popup Callback Error",e),f()}},null!=t){e.next=5;break}return e.abrupt("return",{send:ye,close:ye});case 5:return i=(null==o?void 0:o.onClose)||ye,a=(null==o?void 0:o.onMessage)||ye,s=(null==o?void 0:o.onReady)||ye,u=(null==o?void 0:o.onResponse)||ye,window.addEventListener("message",d),e.next=12,fe(be(t.type,n,r),u,t.appSetting);case 12:return c=e.sent,p=c.popup,l=c.unmount,e.abrupt("return",{send:h,close:f});case 16:case"end":return e.stop()}}),e)}))),we.apply(this,arguments)}var Pe="UP-A";function xe(e,t,n,r){return new Promise(function(){var o=Y(K().mark((function o(i,a){return K().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,ve(e,t,n,{onReady:function(t,n){return Y(K().mark((function t(){var r;return K().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 Y(K().mark((function r(){var o,s,u;return K().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,u=JSON.parse(s.payload),r.t0=u.type,r.next="APPROVE"===r.t0?9:"DECLINE"===r.t0?12:27;break;case 9:return i(u.data),o(),r.abrupt("break",30);case 12:if("expired"!==u.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(u.data),o(),r.abrupt("return");case 19:if("UP_TRANSACTION"!==e.type&&"UP_SIGN_MESSAGE"!==e.type){r.next=24;break}return se(!1),a("can not authorize without login"),o(),r.abrupt("break",30);case 24:return a("Declined: "+(u.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 Y(K().mark((function t(){var n,o;return K().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 Y(K().mark((function e(){return K().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 _e=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(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 A("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,xe(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)}}(),Oe=function(){var e=Y(K().mark((function e(t,n){var r,o,i,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ie(n.storageType).get(Pe),(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 A("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,xe(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)}}(),je="0x1626ba7e";var Se=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,o=(t=this._config.env,n=this._config.chainType,{env:t,nodeRPC:"prod"===t?oe.mainnet[n]:oe.testnet[n],chainType:n,walletUrl:"prod"===t?re:ne});this._config.nodeRPC=e.nodeRPC||o.nodeRPC,this._config.appSettings=function(e,t){return Q({},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 r.JsonRpcProvider(this._config.nodeRPC),this._auth_provider=new r.JsonRpcProvider(function(e){return"prod"===e?oe.mainnet.polygon:oe.testnet.polygon}(this._config.env));var i,a,s,u=e.walletUrl||o.walletUrl;u&&(a=(i=u).domain,s=i.protocol,ee={upDomain:a=a||X,upConnectUrl:(s=s||"https")+"://"+a+"/connect",upLogoutUrl:s+"://"+a+"/logout",upSignMessageUrl:s+"://"+a+"/sign-message",upTransactionUrl:s+"://"+a+"/send-transaction",upLoadingUrl:s+"://"+a+"/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 r.JsonRpcProvider(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},t.login=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ae(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=ie(e).get(Pe))?JSON.parse(t):void 0},t.logout=function(){var e=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,se(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=Y(K().mark((function e(t){return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,Oe(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=Y(K().mark((function e(t,n){var r,o,i,a,s;return K().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=L.toUtf8Bytes(t)),e.next=5,_e(new k(this.getAddress(),L.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=Y(K().mark((function e(t,n,r){var o,i;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new f.Contract(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=L.toUtf8Bytes(a)),L.keccak256(L.concat([L.toUtf8Bytes("UniPass Signed Message:\n"),L.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===je);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=Y(K().mark((function e(t,n){var r,o;return K().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,_e(new k(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=Y(K().mark((function e(t,n,r){var o,i,a;return K().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 f.Contract(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=C(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===je);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function Ee(n){var r,o,i;return e.__awaiter(this,void 0,void 0,(function*(){const a=n.JsonRpcProvider||h.DefaultJsonRpcProvider,s=null!==(r=n.chainId)&&void 0!==r?r:1;let u=null!==(o=n.rpcUrl)&&void 0!==o?o:null===(i=n.rpc)||void 0===i?void 0:i[s];const c=new class extends a{constructor(t,r){super(t,r),this.updateUpWalletConfig=t=>{var r;const o=null===(r=n.rpc)||void 0===r?void 0:r[t];if(!e.SUPPORTED_CHAIN_ID.includes(t))throw new Error(`chainId ${t} not supported`);if(this.upWallet.updateConfig({chainType:e.getChainNameByChainId(t),nodeRPC:o,appSettings:{chain:e.getChainNameByChainId(t)}}),"object"==typeof this.network)this.network.chainId=t;else{const e={chainId:t,name:"unknown"};p.defineReadOnly(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.upWallet=new Se({env:e.getENVByChainId(s),chainType:e.getChainNameByChainId(s),appSettings:{appIcon:n.appLogoUrl,appName:n.appName,chain:e.getChainNameByChainId(s)},rpcUrl:u,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new S(c,this.upWallet,null!==(e=null==t?void 0:t.address)&&void 0!==e?e:"",0)}connect(){return e.__awaiter(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return e||(yield this.upWallet.login({email:false}))}))}disconnect(){return e.__awaiter(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return e.__awaiter(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)?t.getAddress(null==e?void 0:e.address):null)}}(u,s);return c}))}exports.createProvider=Ee,exports.default=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield Ee(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}))},exports.disconnectWallet=function(){var t;null===(t=e.useWalletStore.getState().provider)||void 0===t||t.disconnect()},exports.signTypedData=function(t){var n,r;return null===(r=null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.upWallet)||void 0===r?void 0:r.signTypedData(t)},exports.switchChain=function(t){var n;const r=t.addChainParameters.chainId,o="string"==typeof r&&(null==r?void 0:r.startsWith("0x"))?parseInt(r,16):Number(r);if(!e.SUPPORTED_CHAIN_ID.includes(o))throw new Error(`chainId ${o} not supported`);return null===(n=e.useWalletStore.getState().provider)||void 0===n?void 0:n.updateUpWalletConfig(o)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-bec3f245.cjs"),r=require("@ethersproject/address");require("events");var t=require("@ethersproject/bytes"),n=require("./id-ef87d991.cjs"),i=require("./index-e368a1ec.cjs"),o=require("@ethersproject/abstract-signer"),s=require("./DefaultJsonRpcProvider-2894e1a2.cjs"),a=require("@ethersproject/properties");require("@ethersproject/providers"),require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./bn-002a9654.cjs"),require("./__node-resolve_empty-f57ca5f8.cjs");class d extends o.Signer{constructor(e,r,t,n){super(),this._address=r,this._index=null!=t?t:0,this.provider=e,this.app=n}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e.__awaiter(this,void 0,void 0,(function*(){return Promise.resolve(r.getAddress(this._address))}))}signMessage(r){return e.__awaiter(this,void 0,void 0,(function*(){const i=e.getOwnerProvider(),o="string"==typeof r?n.toUtf8Bytes(r):r,s=yield this.getAddress();return yield i.send("personal_sign",[t.hexlify(o),s.toLowerCase()])}))}_signTypedData(r,t,n){var o,s;return e.__awaiter(this,void 0,void 0,(function*(){const a=e.getOwnerProvider(),d=yield i.TypedDataEncoder.resolveNames(r,t,n,(r=>e.__awaiter(this,void 0,void 0,(function*(){return yield a.resolveName(r)})))),c=null!==(s=null===(o=e.getCyberAccount())||void 0===o?void 0:o.ownerAddress)&&void 0!==s?s:"";return yield a.send("eth_signTypedData_v4",[c.toLowerCase(),JSON.stringify(i.TypedDataEncoder.getPayload(d.domain,t,d.value))])}))}signTransaction(r){return e.__awaiter(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}sendTransaction(r){return e.__awaiter(this,void 0,void 0,(function*(){const t=yield this.getChainId(),n=e.getCyberChain(this.app,t);return{hash:yield n.sendTransaction({to:r.to,value:r.value,data:r.data}).catch((r=>{if(r.name===e.ErrorType.SendTransactionError&&(console.error(r.shortMessage),r.shortMessage))throw new Error(r.shortMessage);throw r}))}}))}connect(e){return new d(null!=e?e:this.provider,this._address,this._index,this.app)}connectUnchecked(){return new d(this.provider,this._address,this._index,this.app)}}exports.getIsCyber=e.getIsCyber,exports.default=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const i=yield function({appName:t,appLogoUrl:n,rpcUrl:i,rpc:o,chainId:c,cyberParams:u,JsonRpcProvider:h=s.DefaultJsonRpcProvider}){return e.__awaiter(this,void 0,void 0,(function*(){if(!t||!n)throw new Error("appName and appLogoUrl is required.");if(!(null==u?void 0:u.appId))throw new Error("cyberParams.appId and appLogoUrl is required.");const{app:s,cyberAccount:p}=yield e.connect({appName:t,appLogoUrl:n,appId:null==u?void 0:u.appId});if(!p)throw new Error("cyberAccount is not valid.");const l=p.address,v=new class extends h{constructor(r,t){super(r,t),this.updateUpWalletConfig=r=>{const t=null==o?void 0:o[r];if(!e.supportChains.includes(r))throw new Error(`chainId ${r} not supported`);if("object"==typeof this.network)this.network.chainId=r;else{const e={chainId:r,name:"unknown"};a.defineReadOnly(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=t,this.emit("chainChanged",`0x${r.toString(16)}`),{result:!0}}}getSigner(){return new d(v,l,0,s)}listAccounts(){return e.__awaiter(this,void 0,void 0,(function*(){return[l]}))}getAddress(){return Promise.resolve(r.getAddress(l))}}(i,c);return v}))}(t);return i.on("connect",n.connect),i.on("disconnect",n.disconnect),i.on("accountsChanged",n.accountsChanged),i.on("chainChanged",n.chainChanged),i.on("message",n.message),i}))},exports.switchChain=function(r){var t;const n=r.addChainParameters.chainId,i="string"==typeof n&&(null==n?void 0:n.startsWith("0x"))?parseInt(n,16):Number(n);if(!e.supportChains.includes(i))throw new Error(`chainId ${i} not supported`);return null===(t=e.useWalletStore.getState().provider)||void 0===t?void 0:t.updateUpWalletConfig(i)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=require("@ethersproject/bytes"),t=require("./id-
|
|
1
|
+
"use strict";var r=require("@ethersproject/bytes"),t=require("./id-ef87d991.cjs");const e=new t.Logger("rlp/5.7.0");function o(r){const t=[];for(;r;)t.unshift(255&r),r>>=8;return t}function n(r,t,e){let o=0;for(let n=0;n<e;n++)o=256*o+r[t+n];return o}function s(t){if(Array.isArray(t)){let r=[];if(t.forEach((function(t){r=r.concat(s(t))})),r.length<=55)return r.unshift(192+r.length),r;const e=o(r.length);return e.unshift(247+e.length),e.concat(r)}r.isBytesLike(t)||e.throwArgumentError("RLP object must be BytesLike","object",t);const n=Array.prototype.slice.call(r.arrayify(t));if(1===n.length&&n[0]<=127)return n;if(n.length<=55)return n.unshift(128+n.length),n;const c=o(n.length);return c.unshift(183+c.length),c.concat(n)}function c(t){return r.hexlify(s(t))}function h(r,o,n,s){const c=[];for(;n<o+1+s;){const h=u(r,n);c.push(h.result),(n+=h.consumed)>o+1+s&&e.throwError("child data too short",t.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+s,result:c}}function u(o,s){if(0===o.length&&e.throwError("data too short",t.Logger.errors.BUFFER_OVERRUN,{}),o[s]>=248){const r=o[s]-247;s+1+r>o.length&&e.throwError("data short segment too short",t.Logger.errors.BUFFER_OVERRUN,{});const c=n(o,s+1,r);return s+1+r+c>o.length&&e.throwError("data long segment too short",t.Logger.errors.BUFFER_OVERRUN,{}),h(o,s,s+1+r,r+c)}if(o[s]>=192){const r=o[s]-192;return s+1+r>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{}),h(o,s,s+1,r)}if(o[s]>=184){const c=o[s]-183;s+1+c>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{});const h=n(o,s+1,c);s+1+c+h>o.length&&e.throwError("data array too short",t.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+c+h,result:r.hexlify(o.slice(s+1+c,s+1+c+h))}}if(o[s]>=128){const n=o[s]-128;s+1+n>o.length&&e.throwError("data too short",t.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:r.hexlify(o.slice(s+1,s+1+n))}}return{consumed:1,result:r.hexlify(o[s])}}function l(t){const o=r.arrayify(t),n=u(o,0);return n.consumed!==o.length&&e.throwArgumentError("invalid rlp data","data",t),n.result}var i=Object.freeze({__proto__:null,encode:c,decode:l});exports.decode=l,exports.encode=c,exports.lib_esm=i;
|