@dodoex/wallet-web3 0.0.29-6 → 0.0.29-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/__node-resolve_empty-62830e5c.js +1 -0
  2. package/dist/__tslib-72ac33fc.js +1 -0
  3. package/dist/{blocto-6fdd2522.js → blocto-3233e8b5.js} +1 -1
  4. package/dist/{bn-3c1372bb.js → bn-9b750297.js} +1 -1
  5. package/dist/{browser-ponyfill-e86d50ae.js → browser-ponyfill-f816b726.js} +1 -1
  6. package/dist/cjs/__node-resolve_empty-0dd66a00.cjs +1 -0
  7. package/dist/cjs/__tslib-ec033c18.cjs +1 -0
  8. package/dist/cjs/{blocto-a9a7429a.cjs → blocto-67356537.cjs} +2 -2
  9. package/dist/cjs/{bn-f79633bb.cjs → bn-4a4bfa0a.cjs} +1 -1
  10. package/dist/cjs/{browser-ponyfill-262b9a1d.cjs → browser-ponyfill-4f18e485.cjs} +1 -1
  11. package/dist/cjs/{ethers-2e33277b.cjs → ethers-ae8365c6.cjs} +1 -1
  12. package/dist/cjs/{id-ce261f66.cjs → id-a5369fec.cjs} +1 -1
  13. package/dist/cjs/{index-d72d2161.cjs → index-01114acc.cjs} +1 -1
  14. package/dist/cjs/{index-c59c8727.cjs → index-18e53038.cjs} +1 -1
  15. package/dist/cjs/{index-b300045d.cjs → index-2e6f9c53.cjs} +2 -2
  16. package/dist/cjs/{index-de2a5091.cjs → index-40782cd0.cjs} +1 -1
  17. package/dist/cjs/{index-46767b56.cjs → index-5295919d.cjs} +1 -1
  18. package/dist/cjs/{index-040d72a4.cjs → index-6024b45b.cjs} +1 -1
  19. package/dist/cjs/{index-92dad595.cjs → index-81701808.cjs} +1 -1
  20. package/dist/cjs/{index-b7400738.cjs → index-9c38ef81.cjs} +1 -1
  21. package/dist/cjs/{index-839d2b51.cjs → index-aa1663b2.cjs} +1 -1
  22. package/dist/cjs/{index-8bbd780e.cjs → index-d925012b.cjs} +1 -1
  23. package/dist/cjs/index-df8e5839.cjs +1 -0
  24. package/dist/cjs/index-eb09e54d.cjs +60 -0
  25. package/dist/cjs/index.cjs +1 -1
  26. package/dist/cjs/index.es-0c458619.cjs +9 -0
  27. package/dist/cjs/{interface-770bfae7.cjs → interface-381a1867.cjs} +1 -1
  28. package/dist/cjs/{portis-b2b50bfb.cjs → portis-00d84abf.cjs} +1 -1
  29. package/dist/cjs/{provider-b83497b2.cjs → provider-1fd8592b.cjs} +1 -1
  30. package/dist/cjs/providers/connector/types.d.ts +1 -3
  31. package/dist/cjs/rainbow-e590de84.cjs +1 -0
  32. package/dist/cjs/{typed-data-63d8e9ee.cjs → typed-data-f4c4259c.cjs} +1 -1
  33. package/dist/cjs/{uAuth-b8c6a947.cjs → uAuth-9129d9d5.cjs} +1 -1
  34. package/dist/cjs/walletConnect-c4df4e10.cjs +1 -0
  35. package/dist/cjs/{walletLink-3f05b2ee.cjs → walletLink-30c9ba99.cjs} +1 -1
  36. package/dist/{ethers-e9ea7b62.js → ethers-1fa5d7da.js} +1 -1
  37. package/dist/{id-4394eafb.js → id-241466ee.js} +1 -1
  38. package/dist/index-0d75d6ba.js +1 -0
  39. package/dist/index-0ee5ef8d.js +60 -0
  40. package/dist/{index-853c105c.js → index-15ca614d.js} +1 -1
  41. package/dist/{index-5ef7c2c6.js → index-1d2d4d92.js} +1 -1
  42. package/dist/{index-f4e58da8.js → index-23612abc.js} +1 -1
  43. package/dist/{index-bef3992a.js → index-23cdb4b9.js} +1 -1
  44. package/dist/{index-9e75afb9.js → index-2eb3ae24.js} +1 -1
  45. package/dist/{index-71412a35.js → index-a27e6d76.js} +1 -1
  46. package/dist/{index-b12d1c2b.js → index-ab295bee.js} +1 -1
  47. package/dist/{index-4f115893.js → index-bae507df.js} +1 -1
  48. package/dist/{index-faabf409.js → index-c32b134d.js} +1 -1
  49. package/dist/{index-71e104e3.js → index-e0d3617a.js} +1 -1
  50. package/dist/index.es-565c5077.js +9 -0
  51. package/dist/index.js +1 -1
  52. package/dist/{interface-e24b9dc3.js → interface-f4fa20b2.js} +1 -1
  53. package/dist/{portis-7a5843d0.js → portis-b8816fb7.js} +1 -1
  54. package/dist/{provider-3276289c.js → provider-fcf01622.js} +1 -1
  55. package/dist/providers/connector/types.d.ts +1 -3
  56. package/dist/rainbow-865b4947.js +1 -0
  57. package/dist/{typed-data-4ee2951a.js → typed-data-a8efb1b6.js} +1 -1
  58. package/dist/{uAuth-1775a01d.js → uAuth-10f72d35.js} +1 -1
  59. package/dist/walletConnect-68af47c4.js +1 -0
  60. package/dist/{walletLink-4295f7ca.js → walletLink-014e5649.js} +1 -1
  61. package/package.json +3 -2
  62. package/dist/__node-resolve_empty-1bb86108.js +0 -1
  63. package/dist/__tslib-6f859a10.js +0 -1
  64. package/dist/cjs/__node-resolve_empty-b9b68f61.cjs +0 -1
  65. package/dist/cjs/__tslib-5e95569a.cjs +0 -1
  66. package/dist/cjs/index-269c7834.cjs +0 -1
  67. package/dist/cjs/index-6286567d.cjs +0 -66
  68. package/dist/cjs/index.es-eeb7e818.cjs +0 -9
  69. package/dist/cjs/rainbow-10b0c861.cjs +0 -1
  70. package/dist/cjs/walletConnect-be645a80.cjs +0 -1
  71. package/dist/index-9cb93da4.js +0 -1
  72. package/dist/index-aa70a2b2.js +0 -66
  73. package/dist/index.es-c2f702fd.js +0 -9
  74. package/dist/rainbow-028e417a.js +0 -1
  75. package/dist/walletConnect-4d5928fe.js +0 -1
@@ -1 +1 @@
1
- "use strict";var e=require("./index-46767b56.cjs"),t=require("@ethersproject/providers"),n=require("@ethersproject/address"),r=require("@ethersproject/abstract-signer"),o=require("@ethersproject/bytes"),i=require("./typed-data-63d8e9ee.cjs"),a=require("./index-8bbd780e.cjs"),s=require("./ethers-2e33277b.cjs"),c=require("./id-ce261f66.cjs"),u=require("@ethersproject/json-wallets"),p=require("@ethersproject/properties"),l=require("./index-b7400738.cjs"),d=require("@ethersproject/transactions"),f=require("./index-92dad595.cjs"),h=require("@ethersproject/contracts");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("zustand"),require("events"),require("@ethersproject/constants"),require("./interface-770bfae7.cjs"),require("@ethersproject/abstract-provider"),require("./__node-resolve_empty-b9b68f61.cjs"),require("./hash-282034e6.cjs"),require("./inherits_browser-f88a000a.cjs");var m,y=g(n),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 r.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(n.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,T=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},k=function(e,t){this.type=e,this.data=t},U=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function A(){return A=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},A.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(E||(E={}));var C=function(e){var t=A({},e.types);return delete t.EIP712Domain,i.TypedDataEncoder.hash(e.domain,t,e.message)},L=function(e){return o.arrayify(C(e))},N={},I=e.getAugmentedNamespace(s.lib_esm),D=e.getAugmentedNamespace(s.lib_esm$1),R=e.getAugmentedNamespace(_),M=e.getAugmentedNamespace(s.lib_esm$2),B=e.getAugmentedNamespace(e.lib_esm),F=e.getAugmentedNamespace(c.lib_esm),z=e.getAugmentedNamespace(O),W=e.getAugmentedNamespace(s.lib_esm$3),q=e.getAugmentedNamespace(j),G=e.getAugmentedNamespace(l.lib_esm),J=e.getAugmentedNamespace(s.lib_esm$4),V=e.getAugmentedNamespace(x),H=e.getAugmentedNamespace(s.lib_esm$5),$=e.getAugmentedNamespace(s.lib_esm$6),K=e.getAugmentedNamespace(f.lib_esm);function Z(){Z=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 Y(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 Q(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Y(i,r,o,a,s,"next",e)}function s(e){Y(i,r,o,a,s,"throw",e)}a(void 0)}))}}function X(){return X=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},X.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(I);t.base64=c;var u=D;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=R;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=M;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=B;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return h.keccak256}});var g=F;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return g.Logger}});var m=z;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=W;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 _=q;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(G);t.RLP=j;var S=J;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=V;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 T=P.default;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return T.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return T.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return T.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return T.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return T.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return T.TransactionTypes}});var k=H;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return k.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return k.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return k.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return k.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return k.parseUnits}});var U=$;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return U.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return U.verifyTypedData}});var A=K;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return A._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return A.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return A.poll}});var C=z;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return C.SupportedAlgorithm}});var L=V;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return L.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return L.Utf8ErrorReason}})}(N);var ee="wallet.unipass.id",te={upDomain:ee,upConnectUrl:"https://"+ee+"/connect",upLogoutUrl:"https://"+ee+"/logout",upSignMessageUrl:"https://"+ee+"/sign-message",upTransactionUrl:"https://"+ee+"/send-transaction",upLoadingUrl:"https://"+ee+"/connect/loading"},ne=function(){return te},re={protocol:"https",domain:"testnet.wallet.unipass.id"},oe={protocol:"https",domain:"wallet.unipass.id"},ie={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"}},ae=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)}}},se=function(){var e=Q(Z().mark((function e(t,n){var r,o;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ae(t.storageType).get(xe),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)}}(),ce=function(){var e=Q(Z().mark((function e(t){var n;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new U("UP_LOGOUT"),e.next=4,_e(n);case 4:ae("localStorage").remove(xe),ae("sessionStorage").remove(xe);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ue=function(){var e=Q(Z().mark((function e(t,n){var r,o,i;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new U("UP_LOGIN",r,t.appSettings),e.next=5,_e(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&&ae(t.storageType).set(xe,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)}}(),pe="UP_WALLET_POP",le=null,de=null;function fe(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 he(e,t,n){return ge.apply(this,arguments)}function ge(){return(ge=Q(Z().mark((function e(t,n,r){var o,i,a;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==le||null!=(o=le)&&o.closed)){e.next=8;break}if(null!=(le=fe(t,pe,window))){e.next=6;break}return e.next=5,me(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:de!==t?(le.location.replace(t),le.focus()):le.focus();case 9:return i=setInterval((function(){if(le&&le.closed){var e={data:new U("UP_RESPONSE",JSON.stringify(new k("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){le&&!le.closed&&le.close(),le=null},e.abrupt("return",{popup:le,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function me(e,t,n){return ye.apply(this,arguments)}function ye(){return(ye=Q(Z().mark((function e(t,n,r){var o,i;return Z().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(he(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var be=function(){};function ve(e,t,n){if("UP_LOGIN"===e)return"google"===t?ne().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?ne().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):ne().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return ne().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return ne().upSignMessageUrl;if("UP_TRANSACTION"===e)return ne().upTransactionUrl;if("UP_READY"===e)return ne().upLoadingUrl;throw new Error("unsupport type "+e)}function we(e,t,n,r){return Pe.apply(this,arguments)}function Pe(){return Pe=Q(Z().mark((function e(t,n,r,o){var i,a,s,c,u,p,l,d,f,h;return Z().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:be,close:be});case 5:return i=(null==o?void 0:o.onClose)||be,a=(null==o?void 0:o.onMessage)||be,s=(null==o?void 0:o.onReady)||be,c=(null==o?void 0:o.onResponse)||be,window.addEventListener("message",d),e.next=12,he(ve(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)}))),Pe.apply(this,arguments)}var xe="UP-A";function _e(e,t,n,r){return new Promise(function(){var o=Q(Z().mark((function o(i,a){return Z().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,we(e,t,n,{onReady:function(t,n){return Q(Z().mark((function t(){var r;return Z().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 Q(Z().mark((function r(){var o,s,c;return Z().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 ce(!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 Q(Z().mark((function t(){var n,o;return Z().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 Q(Z().mark((function e(){return Z().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 Oe=function(){var e=Q(Z().mark((function e(t,n){var r,o,i,a;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ae(n.storageType).get(xe),(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 U("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,_e(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=function(){var e=Q(Z().mark((function e(t,n){var r,o,i,a;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ae(n.storageType).get(xe),(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 U("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,_e(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)}}(),Se="0x1626ba7e";var Ee=function(){function e(e){this.initConfig(e)}var n=e.prototype;return n.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 n,r,o=(n=this._config.env,r=this._config.chainType,{env:n,nodeRPC:"prod"===n?ie.mainnet[r]:ie.testnet[r],chainType:r,walletUrl:"prod"===n?oe:re});this._config.nodeRPC=e.nodeRPC||o.nodeRPC,this._config.appSettings=function(e,t){return X({},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 t.JsonRpcProvider(this._config.nodeRPC),this._auth_provider=new t.JsonRpcProvider(function(e){return"prod"===e?ie.mainnet.polygon:ie.testnet.polygon}(this._config.env));var i,a,s,c=e.walletUrl||o.walletUrl;c&&(a=(i=c).domain,s=i.protocol,te={upDomain:a=a||ee,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"},n.updateConfig=function(e){this._config&&(e.chainType&&(this._config.chainType=e.chainType),e.nodeRPC&&(this._config.nodeRPC=e.nodeRPC,this._provider=new t.JsonRpcProvider(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},n.login=function(){var e=Q(Z().mark((function e(t){return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,se(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)}}(),n.getAccount=function(){var e,t;return e=this._config.storageType,(t=ae(e).get(xe))?JSON.parse(t):void 0},n.logout=function(){var e=Q(Z().mark((function e(t){return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,ce(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.getProvider=function(){return this._provider},n.getAuthProvider=function(){return this._auth_provider},n.isLogin=function(){return!!this.getAccount()},n.assertLogin=function(){if(!this.isLogin())throw new Error("user is not login")},n.getAddress=function(){return this.assertLogin(),this.getAccount().address},n.sendTransaction=function(){var e=Q(Z().mark((function e(t){return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,je(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)}}(),n.signMessage=function(){var e=Q(Z().mark((function e(t,n){var r,o,i,a,s;return Z().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=N.toUtf8Bytes(t)),e.next=5,Oe(new T(this.getAddress(),N.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)}}(),n.isValidSignature=function(){var e=Q(Z().mark((function e(t,n,r){var o,i;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new h.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=N.toUtf8Bytes(a)),N.keccak256(N.concat([N.toUtf8Bytes("UniPass Signed Message:\n"),N.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===Se);case 6:case"end":return e.stop()}var a}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),n.signTypedData=function(){var e=Q(Z().mark((function e(t,n){var r,o;return Z().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,Oe(new T(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)}}(),n.isValidTypedSignature=function(){var e=Q(Z().mark((function e(t,n,r){var o,i,a;return Z().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 h.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=L(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===Se);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function Te(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function ke(r){var o,i,a;return e.__awaiter(this,void 0,void 0,(function*(){const s=null!==(o=r.chainId)&&void 0!==o?o:1;let c=null!==(i=r.rpcUrl)&&void 0!==i?i:null===(a=r.rpc)||void 0===a?void 0:a[s];class u extends t.JsonRpcProvider{constructor(t,n){super(t,n),this.updateUpWalletConfig=t=>{var n;const o=null===(n=r.rpc)||void 0===n?void 0:n[t];if(!e.SUPPORTED_CHAIN_ID.includes(t)||!o)throw new Error(`chainId ${t} not supported`);return this.upWallet.updateConfig({chainType:e.getChainNameByChainId(t),nodeRPC:o,appSettings:{chain:e.getChainNameByChainId(t)}}),this.chainId=t,this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.chainId=s,this.upWallet=new Ee({env:e.getENVByChainId(s),chainType:e.getChainNameByChainId(s),appSettings:{appIcon:r.appLogoUrl,appName:r.appName,chain:e.getChainNameByChainId(s)},rpcUrl:c,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new S(l,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)?n.getAddress(null==e?void 0:e.address):null)}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:p.deepCopy(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const o=f.fetchJson({url:this.rpcUrl},JSON.stringify(n),Te).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=o,setTimeout((()=>{this._cache[e]=null}),0)),o}}const l=new u(c);return l}))}exports.createProvider=ke,exports.default=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield ke(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-5295919d.cjs"),t=require("@ethersproject/providers"),n=require("@ethersproject/address"),r=require("@ethersproject/abstract-signer"),o=require("@ethersproject/bytes"),i=require("./typed-data-f4c4259c.cjs"),a=require("./index-d925012b.cjs"),s=require("./ethers-ae8365c6.cjs"),c=require("./id-a5369fec.cjs"),u=require("@ethersproject/json-wallets"),p=require("@ethersproject/properties"),l=require("./index-9c38ef81.cjs"),d=require("@ethersproject/transactions"),f=require("./index-81701808.cjs"),h=require("@ethersproject/contracts");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("zustand"),require("events"),require("@ethersproject/constants"),require("./interface-381a1867.cjs"),require("@ethersproject/abstract-provider"),require("./__node-resolve_empty-0dd66a00.cjs"),require("./hash-282034e6.cjs"),require("./inherits_browser-f88a000a.cjs");var m,y=g(n),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 r.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(n.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,T=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},k=function(e,t){this.type=e,this.data=t},U=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function A(){return A=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},A.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(E||(E={}));var C=function(e){var t=A({},e.types);return delete t.EIP712Domain,i.TypedDataEncoder.hash(e.domain,t,e.message)},L=function(e){return o.arrayify(C(e))},N={},I=e.getAugmentedNamespace(s.lib_esm),D=e.getAugmentedNamespace(s.lib_esm$1),R=e.getAugmentedNamespace(_),M=e.getAugmentedNamespace(s.lib_esm$2),B=e.getAugmentedNamespace(e.lib_esm),F=e.getAugmentedNamespace(c.lib_esm),z=e.getAugmentedNamespace(O),W=e.getAugmentedNamespace(s.lib_esm$3),q=e.getAugmentedNamespace(j),G=e.getAugmentedNamespace(l.lib_esm),J=e.getAugmentedNamespace(s.lib_esm$4),V=e.getAugmentedNamespace(x),H=e.getAugmentedNamespace(s.lib_esm$5),$=e.getAugmentedNamespace(s.lib_esm$6),K=e.getAugmentedNamespace(f.lib_esm);function Z(){Z=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 Y(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 Q(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Y(i,r,o,a,s,"next",e)}function s(e){Y(i,r,o,a,s,"throw",e)}a(void 0)}))}}function X(){return X=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},X.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(I);t.base64=c;var u=D;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=R;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=M;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=B;Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return h.keccak256}});var g=F;Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return g.Logger}});var m=z;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=W;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 _=q;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(G);t.RLP=j;var S=J;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=V;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 T=P.default;Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return T.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return T.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return T.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return T.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return T.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return T.TransactionTypes}});var k=H;Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return k.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return k.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return k.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return k.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return k.parseUnits}});var U=$;Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return U.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return U.verifyTypedData}});var A=K;Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return A._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return A.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return A.poll}});var C=z;Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return C.SupportedAlgorithm}});var L=V;Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return L.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return L.Utf8ErrorReason}})}(N);var ee="wallet.unipass.id",te={upDomain:ee,upConnectUrl:"https://"+ee+"/connect",upLogoutUrl:"https://"+ee+"/logout",upSignMessageUrl:"https://"+ee+"/sign-message",upTransactionUrl:"https://"+ee+"/send-transaction",upLoadingUrl:"https://"+ee+"/connect/loading"},ne=function(){return te},re={protocol:"https",domain:"testnet.wallet.unipass.id"},oe={protocol:"https",domain:"wallet.unipass.id"},ie={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"}},ae=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)}}},se=function(){var e=Q(Z().mark((function e(t,n){var r,o;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ae(t.storageType).get(xe),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)}}(),ce=function(){var e=Q(Z().mark((function e(t){var n;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new U("UP_LOGOUT"),e.next=4,_e(n);case 4:ae("localStorage").remove(xe),ae("sessionStorage").remove(xe);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ue=function(){var e=Q(Z().mark((function e(t,n){var r,o,i;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new U("UP_LOGIN",r,t.appSettings),e.next=5,_e(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&&ae(t.storageType).set(xe,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)}}(),pe="UP_WALLET_POP",le=null,de=null;function fe(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 he(e,t,n){return ge.apply(this,arguments)}function ge(){return(ge=Q(Z().mark((function e(t,n,r){var o,i,a;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==le||null!=(o=le)&&o.closed)){e.next=8;break}if(null!=(le=fe(t,pe,window))){e.next=6;break}return e.next=5,me(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:de!==t?(le.location.replace(t),le.focus()):le.focus();case 9:return i=setInterval((function(){if(le&&le.closed){var e={data:new U("UP_RESPONSE",JSON.stringify(new k("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){le&&!le.closed&&le.close(),le=null},e.abrupt("return",{popup:le,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function me(e,t,n){return ye.apply(this,arguments)}function ye(){return(ye=Q(Z().mark((function e(t,n,r){var o,i;return Z().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(he(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var be=function(){};function ve(e,t,n){if("UP_LOGIN"===e)return"google"===t?ne().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?ne().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):ne().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return ne().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return ne().upSignMessageUrl;if("UP_TRANSACTION"===e)return ne().upTransactionUrl;if("UP_READY"===e)return ne().upLoadingUrl;throw new Error("unsupport type "+e)}function we(e,t,n,r){return Pe.apply(this,arguments)}function Pe(){return Pe=Q(Z().mark((function e(t,n,r,o){var i,a,s,c,u,p,l,d,f,h;return Z().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:be,close:be});case 5:return i=(null==o?void 0:o.onClose)||be,a=(null==o?void 0:o.onMessage)||be,s=(null==o?void 0:o.onReady)||be,c=(null==o?void 0:o.onResponse)||be,window.addEventListener("message",d),e.next=12,he(ve(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)}))),Pe.apply(this,arguments)}var xe="UP-A";function _e(e,t,n,r){return new Promise(function(){var o=Q(Z().mark((function o(i,a){return Z().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,we(e,t,n,{onReady:function(t,n){return Q(Z().mark((function t(){var r;return Z().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 Q(Z().mark((function r(){var o,s,c;return Z().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 ce(!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 Q(Z().mark((function t(){var n,o;return Z().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 Q(Z().mark((function e(){return Z().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 Oe=function(){var e=Q(Z().mark((function e(t,n){var r,o,i,a;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ae(n.storageType).get(xe),(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 U("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,_e(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=function(){var e=Q(Z().mark((function e(t,n){var r,o,i,a;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ae(n.storageType).get(xe),(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 U("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,_e(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)}}(),Se="0x1626ba7e";var Ee=function(){function e(e){this.initConfig(e)}var n=e.prototype;return n.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 n,r,o=(n=this._config.env,r=this._config.chainType,{env:n,nodeRPC:"prod"===n?ie.mainnet[r]:ie.testnet[r],chainType:r,walletUrl:"prod"===n?oe:re});this._config.nodeRPC=e.nodeRPC||o.nodeRPC,this._config.appSettings=function(e,t){return X({},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 t.JsonRpcProvider(this._config.nodeRPC),this._auth_provider=new t.JsonRpcProvider(function(e){return"prod"===e?ie.mainnet.polygon:ie.testnet.polygon}(this._config.env));var i,a,s,c=e.walletUrl||o.walletUrl;c&&(a=(i=c).domain,s=i.protocol,te={upDomain:a=a||ee,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"},n.updateConfig=function(e){this._config&&(e.chainType&&(this._config.chainType=e.chainType),e.nodeRPC&&(this._config.nodeRPC=e.nodeRPC,this._provider=new t.JsonRpcProvider(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},n.login=function(){var e=Q(Z().mark((function e(t){return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,se(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)}}(),n.getAccount=function(){var e,t;return e=this._config.storageType,(t=ae(e).get(xe))?JSON.parse(t):void 0},n.logout=function(){var e=Q(Z().mark((function e(t){return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,ce(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.getProvider=function(){return this._provider},n.getAuthProvider=function(){return this._auth_provider},n.isLogin=function(){return!!this.getAccount()},n.assertLogin=function(){if(!this.isLogin())throw new Error("user is not login")},n.getAddress=function(){return this.assertLogin(),this.getAccount().address},n.sendTransaction=function(){var e=Q(Z().mark((function e(t){return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,je(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)}}(),n.signMessage=function(){var e=Q(Z().mark((function e(t,n){var r,o,i,a,s;return Z().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=N.toUtf8Bytes(t)),e.next=5,Oe(new T(this.getAddress(),N.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)}}(),n.isValidSignature=function(){var e=Q(Z().mark((function e(t,n,r){var o,i;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new h.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=N.toUtf8Bytes(a)),N.keccak256(N.concat([N.toUtf8Bytes("UniPass Signed Message:\n"),N.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===Se);case 6:case"end":return e.stop()}var a}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),n.signTypedData=function(){var e=Q(Z().mark((function e(t,n){var r,o;return Z().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,Oe(new T(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)}}(),n.isValidTypedSignature=function(){var e=Q(Z().mark((function e(t,n,r){var o,i,a;return Z().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 h.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=L(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===Se);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function Te(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function ke(r){var o,i,a;return e.__awaiter(this,void 0,void 0,(function*(){const s=null!==(o=r.chainId)&&void 0!==o?o:1;let c=null!==(i=r.rpcUrl)&&void 0!==i?i:null===(a=r.rpc)||void 0===a?void 0:a[s];class u extends t.JsonRpcProvider{constructor(t,n){super(t,n),this.updateUpWalletConfig=t=>{var n;const o=null===(n=r.rpc)||void 0===n?void 0:n[t];if(!e.SUPPORTED_CHAIN_ID.includes(t)||!o)throw new Error(`chainId ${t} not supported`);return this.upWallet.updateConfig({chainType:e.getChainNameByChainId(t),nodeRPC:o,appSettings:{chain:e.getChainNameByChainId(t)}}),this.chainId=t,this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.chainId=s,this.upWallet=new Ee({env:e.getENVByChainId(s),chainType:e.getChainNameByChainId(s),appSettings:{appIcon:r.appLogoUrl,appName:r.appName,chain:e.getChainNameByChainId(s)},rpcUrl:c,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new S(l,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)?n.getAddress(null==e?void 0:e.address):null)}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:p.deepCopy(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const o=f.fetchJson({url:this.rpcUrl},JSON.stringify(n),Te).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=o,setTimeout((()=>{this._cache[e]=null}),0)),o}}const l=new u(c);return l}))}exports.createProvider=ke,exports.default=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield ke(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("@ethersproject/bytes"),t=require("@ethersproject/properties"),r=require("./id-ce261f66.cjs");function o(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e.arrayify(r)}function n(t){t=e.arrayify(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var s=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function l(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,i)}c((o=o.apply(e,t||[])).next())}))};function l(t,r){return s(this,void 0,void 0,(function*(){null==r&&(r={});const o={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(o.mode="cors",o.cache="no-cache",o.credentials="same-origin",o.redirect="follow",o.referrer="client"),null!=r.fetchOptions){const e=r.fetchOptions;e.mode&&(o.mode=e.mode),e.cache&&(o.cache=e.cache),e.credentials&&(o.credentials=e.credentials),e.redirect&&(o.redirect=e.redirect),e.referrer&&(o.referrer=e.referrer)}const n=yield fetch(t,o),s=yield n.arrayBuffer(),l={};return n.headers.forEach?n.headers.forEach(((e,t)=>{l[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{l[e.toLowerCase()]=n.headers.get(e)})),{headers:l,statusCode:n.status,statusMessage:n.statusText,body:e.arrayify(new Uint8Array(s))}}))}var i=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function l(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,i)}c((o=o.apply(e,t||[])).next())}))};const c=new r.Logger("web/5.7.1");function a(e){return new Promise((t=>{setTimeout(t,e)}))}function u(t,o){if(null==t)return null;if("string"==typeof t)return t;if(e.isBytesLike(t)){if(o&&("text"===o.split("/")[0]||"application/json"===o.split(";")[0].trim()))try{return r.toUtf8String(t)}catch(e){}return e.hexlify(t)}return t}function h(e,s,h){const d="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;c.assertArgument(d>0&&d%1==0,"invalid connection throttle limit","connection.throttleLimit",d);const f="object"==typeof e?e.throttleCallback:null,p="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;c.assertArgument(p>0&&p%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",p);const y="object"==typeof e&&!!e.errorPassThrough,m={};let g=null;const E={method:"GET"};let w=!1,b=12e4;if("string"==typeof e)g=e;else if("object"==typeof e){if(null!=e&&null!=e.url||c.throwArgumentError("missing URL","connection.url",e),g=e.url,"number"==typeof e.timeout&&e.timeout>0&&(b=e.timeout),e.headers)for(const t in e.headers)m[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(w=!0);if(E.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==g.substring(0,6)&&!0!==e.allowInsecureAuthentication&&c.throwError("basic authentication requires a secure https url",r.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:g,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;m.authorization={key:"Authorization",value:"Basic "+n(r.toUtf8Bytes(t))}}null!=e.skipFetchSetup&&(E.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(E.fetchOptions=t.shallowCopy(e.fetchOptions))}const v=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),R=g?g.match(v):null;if(R)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":R[1]||"text/plain"},body:R[2]?o(R[3]):(C=R[3],r.toUtf8Bytes(C.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return h&&(t=h(e.body,e)),Promise.resolve(t)}catch(e){c.throwError("processing response error",r.Logger.errors.SERVER_ERROR,{body:u(R[1],R[2]),error:e,requestBody:null,requestMethod:"GET",url:g})}var C;s&&(E.method="POST",E.body=s,null==m["content-type"]&&(m["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==m["content-length"]&&(m["content-length"]={key:"Content-Length",value:String(s.length)}));const S={};Object.keys(m).forEach((e=>{const t=m[e];S[t.key]=t.value})),E.headers=S;const L=function(){let e=null;return{promise:new Promise((function(t,o){b&&(e=setTimeout((()=>{null!=e&&(e=null,o(c.makeError("timeout",r.Logger.errors.TIMEOUT,{requestBody:u(E.body,S["content-type"]),requestMethod:E.method,timeout:b,url:g})))}),b))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),O=function(){return i(this,void 0,void 0,(function*(){for(let e=0;e<d;e++){let t=null;try{if(t=yield l(g,E),e<d)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===E.method&&e.match(/^https:/)){g=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(f&&(r=yield f(e,g)),r){let r=0;const o=t.headers["retry-after"];r="string"==typeof o&&o.match(/^[1-9][0-9]*$/)?1e3*parseInt(o):p*parseInt(String(Math.random()*Math.pow(2,e))),yield a(r);continue}}}catch(e){t=e.response,null==t&&(L.cancel(),c.throwError("missing response",r.Logger.errors.SERVER_ERROR,{requestBody:u(E.body,S["content-type"]),requestMethod:E.method,serverError:e,url:g}))}let o=t.body;if(w&&304===t.statusCode?o=null:!y&&(t.statusCode<200||t.statusCode>=300)&&(L.cancel(),c.throwError("bad response",r.Logger.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:u(o,t.headers?t.headers["content-type"]:null),requestBody:u(E.body,S["content-type"]),requestMethod:E.method,url:g})),h)try{const e=yield h(o,t);return L.cancel(),e}catch(n){if(n.throttleRetry&&e<d){let t=!0;if(f&&(t=yield f(e,g)),t){const t=p*parseInt(String(Math.random()*Math.pow(2,e)));yield a(t);continue}}L.cancel(),c.throwError("processing response error",r.Logger.errors.SERVER_ERROR,{body:u(o,t.headers?t.headers["content-type"]:null),error:n,requestBody:u(E.body,S["content-type"]),requestMethod:E.method,url:g})}return L.cancel(),o}return c.throwError("failed response",r.Logger.errors.SERVER_ERROR,{requestBody:u(E.body,S["content-type"]),requestMethod:E.method,url:g})}))}();return Promise.race([L.promise,O])}function d(e,o,n){let s=null;if(null!=o){s=r.toUtf8Bytes(o);const n="string"==typeof e?{url:e}:t.shallowCopy(e);if(n.headers){0!==Object.keys(n.headers).filter((e=>"content-type"===e.toLowerCase())).length||(n.headers=t.shallowCopy(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return h(e,s,((e,t)=>{let o=null;if(null!=e)try{o=JSON.parse(r.toUtf8String(e))}catch(t){c.throwError("invalid JSON",r.Logger.errors.SERVER_ERROR,{body:e,error:t})}return n&&(o=n(o,t)),o}))}function f(e,r){return r||(r={}),null==(r=t.shallowCopy(r)).floor&&(r.floor=0),null==r.ceiling&&(r.ceiling=1e4),null==r.interval&&(r.interval=250),new Promise((function(t,o){let n=null,s=!1;const l=()=>!s&&(s=!0,n&&clearTimeout(n),!0);r.timeout&&(n=setTimeout((()=>{l()&&o(new Error("timeout"))}),r.timeout));const i=r.retryLimit;let c=0;!function n(){return e().then((function(e){if(void 0!==e)l()&&t(e);else if(r.oncePoll)r.oncePoll.once("poll",n);else if(r.onceBlock)r.onceBlock.once("block",n);else if(!s){if(c++,c>i)return void(l()&&o(new Error("retry limit reached")));let e=r.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<r.floor&&(e=r.floor),e>r.ceiling&&(e=r.ceiling),setTimeout(n,e)}return null}),(function(e){l()&&o(e)}))}()}))}var p=Object.freeze({__proto__:null,_fetchData:h,fetchJson:d,poll:f});exports._fetchData=h,exports.decode=o,exports.encode=n,exports.fetchJson=d,exports.lib_esm=p,exports.poll=f;
1
+ "use strict";var e=require("@ethersproject/bytes"),t=require("@ethersproject/properties"),r=require("./id-a5369fec.cjs");function o(t){t=atob(t);const r=[];for(let e=0;e<t.length;e++)r.push(t.charCodeAt(e));return e.arrayify(r)}function n(t){t=e.arrayify(t);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}var s=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function l(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,i)}c((o=o.apply(e,t||[])).next())}))};function l(t,r){return s(this,void 0,void 0,(function*(){null==r&&(r={});const o={method:r.method||"GET",headers:r.headers||{},body:r.body||void 0};if(!0!==r.skipFetchSetup&&(o.mode="cors",o.cache="no-cache",o.credentials="same-origin",o.redirect="follow",o.referrer="client"),null!=r.fetchOptions){const e=r.fetchOptions;e.mode&&(o.mode=e.mode),e.cache&&(o.cache=e.cache),e.credentials&&(o.credentials=e.credentials),e.redirect&&(o.redirect=e.redirect),e.referrer&&(o.referrer=e.referrer)}const n=yield fetch(t,o),s=yield n.arrayBuffer(),l={};return n.headers.forEach?n.headers.forEach(((e,t)=>{l[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{l[e.toLowerCase()]=n.headers.get(e)})),{headers:l,statusCode:n.status,statusMessage:n.statusText,body:e.arrayify(new Uint8Array(s))}}))}var i=function(e,t,r,o){return new(r||(r=Promise))((function(n,s){function l(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,i)}c((o=o.apply(e,t||[])).next())}))};const c=new r.Logger("web/5.7.1");function a(e){return new Promise((t=>{setTimeout(t,e)}))}function u(t,o){if(null==t)return null;if("string"==typeof t)return t;if(e.isBytesLike(t)){if(o&&("text"===o.split("/")[0]||"application/json"===o.split(";")[0].trim()))try{return r.toUtf8String(t)}catch(e){}return e.hexlify(t)}return t}function h(e,s,h){const d="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;c.assertArgument(d>0&&d%1==0,"invalid connection throttle limit","connection.throttleLimit",d);const f="object"==typeof e?e.throttleCallback:null,p="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;c.assertArgument(p>0&&p%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",p);const y="object"==typeof e&&!!e.errorPassThrough,m={};let g=null;const E={method:"GET"};let w=!1,b=12e4;if("string"==typeof e)g=e;else if("object"==typeof e){if(null!=e&&null!=e.url||c.throwArgumentError("missing URL","connection.url",e),g=e.url,"number"==typeof e.timeout&&e.timeout>0&&(b=e.timeout),e.headers)for(const t in e.headers)m[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(w=!0);if(E.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==g.substring(0,6)&&!0!==e.allowInsecureAuthentication&&c.throwError("basic authentication requires a secure https url",r.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:g,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;m.authorization={key:"Authorization",value:"Basic "+n(r.toUtf8Bytes(t))}}null!=e.skipFetchSetup&&(E.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(E.fetchOptions=t.shallowCopy(e.fetchOptions))}const v=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),R=g?g.match(v):null;if(R)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":R[1]||"text/plain"},body:R[2]?o(R[3]):(C=R[3],r.toUtf8Bytes(C.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return h&&(t=h(e.body,e)),Promise.resolve(t)}catch(e){c.throwError("processing response error",r.Logger.errors.SERVER_ERROR,{body:u(R[1],R[2]),error:e,requestBody:null,requestMethod:"GET",url:g})}var C;s&&(E.method="POST",E.body=s,null==m["content-type"]&&(m["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==m["content-length"]&&(m["content-length"]={key:"Content-Length",value:String(s.length)}));const S={};Object.keys(m).forEach((e=>{const t=m[e];S[t.key]=t.value})),E.headers=S;const L=function(){let e=null;return{promise:new Promise((function(t,o){b&&(e=setTimeout((()=>{null!=e&&(e=null,o(c.makeError("timeout",r.Logger.errors.TIMEOUT,{requestBody:u(E.body,S["content-type"]),requestMethod:E.method,timeout:b,url:g})))}),b))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),O=function(){return i(this,void 0,void 0,(function*(){for(let e=0;e<d;e++){let t=null;try{if(t=yield l(g,E),e<d)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===E.method&&e.match(/^https:/)){g=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(f&&(r=yield f(e,g)),r){let r=0;const o=t.headers["retry-after"];r="string"==typeof o&&o.match(/^[1-9][0-9]*$/)?1e3*parseInt(o):p*parseInt(String(Math.random()*Math.pow(2,e))),yield a(r);continue}}}catch(e){t=e.response,null==t&&(L.cancel(),c.throwError("missing response",r.Logger.errors.SERVER_ERROR,{requestBody:u(E.body,S["content-type"]),requestMethod:E.method,serverError:e,url:g}))}let o=t.body;if(w&&304===t.statusCode?o=null:!y&&(t.statusCode<200||t.statusCode>=300)&&(L.cancel(),c.throwError("bad response",r.Logger.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:u(o,t.headers?t.headers["content-type"]:null),requestBody:u(E.body,S["content-type"]),requestMethod:E.method,url:g})),h)try{const e=yield h(o,t);return L.cancel(),e}catch(n){if(n.throttleRetry&&e<d){let t=!0;if(f&&(t=yield f(e,g)),t){const t=p*parseInt(String(Math.random()*Math.pow(2,e)));yield a(t);continue}}L.cancel(),c.throwError("processing response error",r.Logger.errors.SERVER_ERROR,{body:u(o,t.headers?t.headers["content-type"]:null),error:n,requestBody:u(E.body,S["content-type"]),requestMethod:E.method,url:g})}return L.cancel(),o}return c.throwError("failed response",r.Logger.errors.SERVER_ERROR,{requestBody:u(E.body,S["content-type"]),requestMethod:E.method,url:g})}))}();return Promise.race([L.promise,O])}function d(e,o,n){let s=null;if(null!=o){s=r.toUtf8Bytes(o);const n="string"==typeof e?{url:e}:t.shallowCopy(e);if(n.headers){0!==Object.keys(n.headers).filter((e=>"content-type"===e.toLowerCase())).length||(n.headers=t.shallowCopy(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return h(e,s,((e,t)=>{let o=null;if(null!=e)try{o=JSON.parse(r.toUtf8String(e))}catch(t){c.throwError("invalid JSON",r.Logger.errors.SERVER_ERROR,{body:e,error:t})}return n&&(o=n(o,t)),o}))}function f(e,r){return r||(r={}),null==(r=t.shallowCopy(r)).floor&&(r.floor=0),null==r.ceiling&&(r.ceiling=1e4),null==r.interval&&(r.interval=250),new Promise((function(t,o){let n=null,s=!1;const l=()=>!s&&(s=!0,n&&clearTimeout(n),!0);r.timeout&&(n=setTimeout((()=>{l()&&o(new Error("timeout"))}),r.timeout));const i=r.retryLimit;let c=0;!function n(){return e().then((function(e){if(void 0!==e)l()&&t(e);else if(r.oncePoll)r.oncePoll.once("poll",n);else if(r.onceBlock)r.onceBlock.once("block",n);else if(!s){if(c++,c>i)return void(l()&&o(new Error("retry limit reached")));let e=r.interval*parseInt(String(Math.random()*Math.pow(2,c)));e<r.floor&&(e=r.floor),e>r.ceiling&&(e=r.ceiling),setTimeout(n,e)}return null}),(function(e){l()&&o(e)}))}()}))}var p=Object.freeze({__proto__:null,_fetchData:h,fetchJson:d,poll:f});exports._fetchData=h,exports.decode=o,exports.encode=n,exports.fetchJson=d,exports.lib_esm=p,exports.poll=f;
@@ -1 +1 @@
1
- "use strict";var r=require("@ethersproject/bytes"),t=require("./id-ce261f66.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;
1
+ "use strict";var r=require("@ethersproject/bytes"),t=require("./id-a5369fec.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 a=Object.freeze({__proto__:null,encode:c,decode:l});exports.decode=l,exports.encode=c,exports.lib_esm=a;
@@ -1 +1 @@
1
- "use strict";var e=require("./index-46767b56.cjs"),r=require("@ethersproject/providers"),t=require("@ethersproject/address");require("events");var n=require("@ethersproject/bytes"),s=require("./id-ce261f66.cjs"),i=require("./typed-data-63d8e9ee.cjs"),o=require("@ethersproject/abstract-signer"),a=require("@ethersproject/properties"),d=require("./index-92dad595.cjs");require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./__node-resolve_empty-b9b68f61.cjs");class c 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(t.getAddress(this._address))}))}signMessage(r){return e.__awaiter(this,void 0,void 0,(function*(){const t=e.getOwnerProvider(),i="string"==typeof r?s.toUtf8Bytes(r):r,o=yield this.getAddress();return yield t.send("personal_sign",[n.hexlify(i),o.toLowerCase()])}))}_signTypedData(r,t,n){var s,o;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!==(o=null===(s=e.getCyberAccount())||void 0===s?void 0:s.ownerAddress)&&void 0!==o?o:"";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 c(null!=e?e:this.provider,this._address,this._index,this.app)}connectUnchecked(){return new c(this.provider,this._address,this._index,this.app)}}function h(e){if(e.error){const r=new Error(e.error.message);throw r.code=e.error.code,r.data=e.error.data,r}return e.result}exports.getIsCyber=e.getIsCyber,exports.default=function(n,s){return e.__awaiter(this,void 0,void 0,(function*(){const i=yield function({appName:n,appLogoUrl:s,rpcUrl:i,rpc:o,chainId:u,cyberParams:p}){return e.__awaiter(this,void 0,void 0,(function*(){if(!n||!s)throw new Error("appName and appLogoUrl is required.");if(!(null==p?void 0:p.appId))throw new Error("cyberParams.appId and appLogoUrl is required.");const{app:l,cyberAccount:g}=yield e.connect({appName:n,appLogoUrl:s,appId:null==p?void 0:p.appId});if(!g)throw new Error("cyberAccount is not valid.");const v=g.address;class w extends r.JsonRpcProvider{constructor(r,t){super(r,t),this.updateUpWalletConfig=r=>{const t=null==o?void 0:o[r];if(!e.supportChains.includes(r)||!t)throw new Error(`chainId ${r} not supported`);return this.chainId=r,t&&(this.rpcUrl=t),this.emit("chainChanged",`0x${r.toString(16)}`),{result:!0}},this.rpcUrl=r,this.chainId=u}getSigner(){return new c(_,v,0,l)}listAccounts(){return e.__awaiter(this,void 0,void 0,(function*(){return[v]}))}getNetwork(){return this.chainId?Promise.resolve({chainId:this.chainId,name:"unknown"}):super.getNetwork()}send(e,r){const t={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:a.deepCopy(t),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const s=d.fetchJson({url:this.rpcUrl},JSON.stringify(t),h).then((e=>(this.emit("debug",{action:"response",request:t,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:t,provider:this}),e}));return n&&(this._cache[e]=s,setTimeout((()=>{this._cache[e]=null}),0)),s}getAddress(){return Promise.resolve(t.getAddress(v))}}const _=new w(i,u);return _}))}(n);return i.on("connect",s.connect),i.on("disconnect",s.disconnect),i.on("accountsChanged",s.accountsChanged),i.on("chainChanged",s.chainChanged),i.on("message",s.message),i}))},exports.switchChain=function(r){var t;const n=r.addChainParameters.chainId,s="string"==typeof n&&(null==n?void 0:n.startsWith("0x"))?parseInt(n,16):Number(n);if(!e.supportChains.includes(s))throw new Error(`chainId ${s} not supported`);return null===(t=e.useWalletStore.getState().provider)||void 0===t?void 0:t.updateUpWalletConfig(s)};
1
+ "use strict";var e=require("./index-5295919d.cjs"),r=require("@ethersproject/providers"),t=require("@ethersproject/address");require("events");var n=require("@ethersproject/bytes"),s=require("./id-a5369fec.cjs"),i=require("./typed-data-f4c4259c.cjs"),o=require("@ethersproject/abstract-signer"),a=require("@ethersproject/properties"),d=require("./index-81701808.cjs");require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./__node-resolve_empty-0dd66a00.cjs");class c 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(t.getAddress(this._address))}))}signMessage(r){return e.__awaiter(this,void 0,void 0,(function*(){const t=e.getOwnerProvider(),i="string"==typeof r?s.toUtf8Bytes(r):r,o=yield this.getAddress();return yield t.send("personal_sign",[n.hexlify(i),o.toLowerCase()])}))}_signTypedData(r,t,n){var s,o;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!==(o=null===(s=e.getCyberAccount())||void 0===s?void 0:s.ownerAddress)&&void 0!==o?o:"";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 c(null!=e?e:this.provider,this._address,this._index,this.app)}connectUnchecked(){return new c(this.provider,this._address,this._index,this.app)}}function h(e){if(e.error){const r=new Error(e.error.message);throw r.code=e.error.code,r.data=e.error.data,r}return e.result}exports.getIsCyber=e.getIsCyber,exports.default=function(n,s){return e.__awaiter(this,void 0,void 0,(function*(){const i=yield function({appName:n,appLogoUrl:s,rpcUrl:i,rpc:o,chainId:u,cyberParams:p}){return e.__awaiter(this,void 0,void 0,(function*(){if(!n||!s)throw new Error("appName and appLogoUrl is required.");if(!(null==p?void 0:p.appId))throw new Error("cyberParams.appId and appLogoUrl is required.");const{app:l,cyberAccount:g}=yield e.connect({appName:n,appLogoUrl:s,appId:null==p?void 0:p.appId});if(!g)throw new Error("cyberAccount is not valid.");const v=g.address;class w extends r.JsonRpcProvider{constructor(r,t){super(r,t),this.updateUpWalletConfig=r=>{const t=null==o?void 0:o[r];if(!e.supportChains.includes(r)||!t)throw new Error(`chainId ${r} not supported`);return this.chainId=r,t&&(this.rpcUrl=t),this.emit("chainChanged",`0x${r.toString(16)}`),{result:!0}},this.rpcUrl=r,this.chainId=u}getSigner(){return new c(_,v,0,l)}listAccounts(){return e.__awaiter(this,void 0,void 0,(function*(){return[v]}))}getNetwork(){return this.chainId?Promise.resolve({chainId:this.chainId,name:"unknown"}):super.getNetwork()}send(e,r){const t={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:a.deepCopy(t),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const s=d.fetchJson({url:this.rpcUrl},JSON.stringify(t),h).then((e=>(this.emit("debug",{action:"response",request:t,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:t,provider:this}),e}));return n&&(this._cache[e]=s,setTimeout((()=>{this._cache[e]=null}),0)),s}getAddress(){return Promise.resolve(t.getAddress(v))}}const _=new w(i,u);return _}))}(n);return i.on("connect",s.connect),i.on("disconnect",s.disconnect),i.on("accountsChanged",s.accountsChanged),i.on("chainChanged",s.chainChanged),i.on("message",s.message),i}))},exports.switchChain=function(r){var t;const n=r.addChainParameters.chainId,s="string"==typeof n&&(null==n?void 0:n.startsWith("0x"))?parseInt(n,16):Number(n);if(!e.supportChains.includes(s))throw new Error(`chainId ${s} not supported`);return null===(t=e.useWalletStore.getState().provider)||void 0===t?void 0:t.updateUpWalletConfig(s)};
@@ -1 +1 @@
1
- "use strict";var e=require("./index-46767b56.cjs"),r=require("./interface-770bfae7.cjs"),t=Object.freeze({__proto__:null,ConstructorFragment:r.ConstructorFragment,ErrorFragment:r.ErrorFragment,EventFragment:r.EventFragment,Fragment:r.Fragment,FunctionFragment:r.FunctionFragment,ParamType:r.ParamType,FormatTypes:r.FormatTypes,AbiCoder:r.AbiCoder,defaultAbiCoder:r.defaultAbiCoder,Interface:r.Interface,Indexed:r.Indexed,checkResultErrors:r.checkResultErrors,LogDescription:r.LogDescription,TransactionDescription:r.TransactionDescription}),n=e.getAugmentedNamespace(t);exports.require$$0=n;
1
+ "use strict";var e=require("./index-5295919d.cjs"),r=require("./interface-381a1867.cjs"),t=Object.freeze({__proto__:null,ConstructorFragment:r.ConstructorFragment,ErrorFragment:r.ErrorFragment,EventFragment:r.EventFragment,Fragment:r.Fragment,FunctionFragment:r.FunctionFragment,ParamType:r.ParamType,FormatTypes:r.FormatTypes,AbiCoder:r.AbiCoder,defaultAbiCoder:r.defaultAbiCoder,Interface:r.Interface,Indexed:r.Indexed,checkResultErrors:r.checkResultErrors,LogDescription:r.LogDescription,TransactionDescription:r.TransactionDescription}),n=e.getAugmentedNamespace(t);exports.require$$0=n;
@@ -0,0 +1 @@
1
+ "use strict";const e=Symbol(),t=Object.getPrototypeOf,s=new WeakMap,o=o=>(e=>e&&(s.has(e)?s.get(e):t(e)===Object.prototype||t(e)===Array.prototype))(o)&&o[e]||null,n=(e,t=!0)=>{s.set(e,t)},a=e=>"object"==typeof e&&null!==e,r=new WeakMap,i=new WeakSet,[l]=((e=Object.is,t=((e,t)=>new Proxy(e,t)),s=(e=>a(e)&&!i.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)),l=(e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}}),c=new WeakMap,d=((e,t,s=l)=>{const o=c.get(e);if((null==o?void 0:o[0])===t)return o[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return n(a,!0),c.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const o=Reflect.get(e,t),l={value:o,enumerable:!0,configurable:!0};if(i.has(o))n(o,!1);else if(o instanceof Promise)delete l.value,l.get=()=>s(o);else if(r.has(o)){const[e,t]=r.get(o);l.value=d(e,t(),s)}Object.defineProperty(a,t,l)})),Object.preventExtensions(a)}),p=new WeakMap,u=[1,1],h=(n=>{if(!a(n))throw new Error("object required");const l=p.get(n);if(l)return l;let c=u[0];const g=new Set,m=(e,t=++u[0])=>{c!==t&&(c=t,g.forEach((s=>s(e,t))))};let f=u[1];const b=e=>(t,s)=>{const o=[...t];o[1]=[e,...o[1]],m(o,s)},y=new Map,v=e=>{var t;const s=y.get(e);s&&(y.delete(e),null==(t=s[1])||t.call(s))},w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),I=t(w,{deleteProperty(e,t){const s=Reflect.get(e,t);v(t);const o=Reflect.deleteProperty(e,t);return o&&m(["delete",[t],s]),o},set(t,n,l,c){const d=Reflect.has(t,n),u=Reflect.get(t,n,c);if(d&&(e(u,l)||p.has(l)&&e(u,p.get(l))))return!0;v(n),a(l)&&(l=o(l)||l);let f=l;if(l instanceof Promise)l.then((e=>{l.status="fulfilled",l.value=e,m(["resolve",[n],e])})).catch((e=>{l.status="rejected",l.reason=e,m(["reject",[n],e])}));else{!r.has(l)&&s(l)&&(f=h(l));const e=!i.has(f)&&r.get(f);e&&((e,t)=>{if(y.has(e))throw new Error("prop listener already exists");if(g.size){const s=t[3](b(e));y.set(e,[t,s])}else y.set(e,[t])})(n,e)}return Reflect.set(t,n,f,c),m(["set",[n],l,u]),!0}});p.set(n,I);const C=[w,(e=++u[1])=>(f===e||g.size||(f=e,y.forEach((([t])=>{const s=t[1](e);s>c&&(c=s)}))),c),d,e=>{g.add(e),1===g.size&&y.forEach((([e,t],s)=>{if(t)throw new Error("remove already exists");const o=e[3](b(s));y.set(s,[e,o])}));return()=>{g.delete(e),0===g.size&&y.forEach((([e,t],s)=>{t&&(t(),y.set(s,[e]))}))}}];return r.set(I,C),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(I[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(w,e,t)})),I}))=>[h,r,i,e,t,s,l,c,d,p,u])();function c(e={}){return l(e)}function d(e,t,s){const o=r.get(e);let n;o||console.warn("Please use proxy object");const a=[],i=o[3];let l=!1;const c=i((e=>{a.push(e),s?t(a.splice(0)):n||(n=Promise.resolve().then((()=>{n=void 0,l&&t(a.splice(0))})))}));return l=!0,()=>{l=!1,c()}}const p=c({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),u={state:p,subscribe:e=>d(p,(()=>e(p))),push(e,t){e!==p.view&&(p.view=e,t&&(p.data=t),p.history.push(e))},reset(e){p.view=e,p.history=[e]},replace(e){p.history.length>1&&(p.history[p.history.length-1]=e,p.view=e)},goBack(){if(p.history.length>1){p.history.pop();const[e]=p.history.slice(-1);p.view=e}},setData(e){p.data=e}},h={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile:()=>typeof window<"u"&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),isAndroid:()=>h.isMobile()&&navigator.userAgent.toLowerCase().includes("android"),isIos(){const e=navigator.userAgent.toLowerCase();return h.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),isArray:e=>Array.isArray(e)&&e.length>0,formatNativeUrl(e,t,s){if(h.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let o=e;o.includes("://")||(o=e.replaceAll("/","").replaceAll(":",""),o=`${o}://`),o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);return`${o}wc?uri=${encodeURIComponent(t)}`},formatUniversalUrl(e,t,s){if(!h.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let o=e;o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);return`${o}wc?uri=${encodeURIComponent(t)}`},wait:async e=>new Promise((t=>{setTimeout(t,e)})),openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(h.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(h.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(h.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(h.WCM_VERSION,"2.6.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=null==(e=u.state.data)?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},g=c({enabled:typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),userSessionId:"",events:[],connectedWalletId:void 0}),m={state:g,subscribe:e=>d(g.events,(()=>e(function(e,t){const s=r.get(e);s||console.warn("Please use proxy object");const[o,n,a]=s;return a(o,n(),t)}(g.events[g.events.length-1])))),initialize(){g.enabled&&typeof(null==crypto?void 0:crypto.randomUUID)<"u"&&(g.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){g.connectedWalletId=e},click(e){if(g.enabled){const t={type:"CLICK",name:e.name,userSessionId:g.userSessionId,timestamp:Date.now(),data:e};g.events.push(t)}},track(e){if(g.enabled){const t={type:"TRACK",name:e.name,userSessionId:g.userSessionId,timestamp:Date.now(),data:e};g.events.push(t)}},view(e){if(g.enabled){const t={type:"VIEW",name:e.name,userSessionId:g.userSessionId,timestamp:Date.now(),data:e};g.events.push(t)}}},f=c({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:f,subscribe:e=>d(f,(()=>e(f))),setChains(e){f.chains=e},setWalletConnectUri(e){f.walletConnectUri=e},setIsCustomDesktop(e){f.isCustomDesktop=e},setIsCustomMobile(e){f.isCustomMobile=e},setIsDataLoaded(e){f.isDataLoaded=e},setIsUiLoaded(e){f.isUiLoaded=e},setIsAuth(e){f.isAuth=e}},y=c({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),v={state:y,subscribe:e=>d(y,(()=>e(y))),setConfig(e){var t,s;m.initialize(),b.setChains(e.chains),b.setIsAuth(Boolean(e.enableAuthMode)),b.setIsCustomMobile(Boolean(null==(t=e.mobileWallets)?void 0:t.length)),b.setIsCustomDesktop(Boolean(null==(s=e.desktopWallets)?void 0:s.length)),h.setModalVersionInStorage(),Object.assign(y,e)}},w="https://explorer-api.walletconnect.com";async function I(e,t){const s=new URL(e,w);return s.searchParams.append("projectId",v.state.projectId),Object.entries(t).forEach((([e,t])=>{t&&s.searchParams.append(e,String(t))})),(await fetch(s)).json()}const C={getDesktopListings:async e=>I("/w3m/v1/getDesktopListings",e),getMobileListings:async e=>I("/w3m/v1/getMobileListings",e),getInjectedListings:async e=>I("/w3m/v1/getInjectedListings",e),getAllListings:async e=>I("/w3m/v1/getAllListings",e),getWalletImageUrl:e=>`${w}/w3m/v1/getWalletImage/${e}?projectId=${v.state.projectId}`,getAssetImageUrl:e=>`${w}/w3m/v1/getAssetImage/${e}?projectId=${v.state.projectId}`};var W=Object.defineProperty,E=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,A=(e,t,s)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const j=h.isMobile(),M=c({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),U={state:M,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=v.state;if("NONE"===e||"ALL"===t&&!e)return M.recomendedWallets;if(h.isArray(e)){const t={recommendedIds:e.join(",")},{listings:s}=await C.getAllListings(t),o=Object.values(s);o.sort(((t,s)=>e.indexOf(t.id)-e.indexOf(s.id))),M.recomendedWallets=o}else{const{chains:e,isAuth:s}=b.state,o=e?.join(","),n=h.isArray(t),a={page:1,sdks:s?"auth_v1":void 0,entries:h.RECOMMENDED_WALLET_AMOUNT,chains:o,version:2,excludedIds:n?t.join(","):void 0},{listings:r}=j?await C.getMobileListings(a):await C.getDesktopListings(a);M.recomendedWallets=Object.values(r)}return M.recomendedWallets},async getWallets(e){const t=((e,t)=>{for(var s in t||(t={}))O.call(t,s)&&A(e,s,t[s]);if(E)for(var s of E(t))L.call(t,s)&&A(e,s,t[s]);return e})({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:o}=v.state,{recomendedWallets:n}=M;if("ALL"===o)return M.wallets;n.length?t.excludedIds=n.map((e=>e.id)).join(","):h.isArray(s)&&(t.excludedIds=s.join(",")),h.isArray(o)&&(t.excludedIds=[t.excludedIds,o].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:a,search:r}=e,{listings:i,total:l}=j?await C.getMobileListings(t):await C.getDesktopListings(t),c=Object.values(i),d=r?"search":"wallets";return M[d]={listings:[...M[d].listings,...c],total:l,page:a??1},{listings:c,total:l}},getWalletImageUrl:e=>C.getWalletImageUrl(e),getAssetImageUrl:e=>C.getAssetImageUrl(e),resetSearch(){M.search={listings:[],total:0,page:1}}},x=c({open:!1}),D={state:x,subscribe:e=>d(x,(()=>e(x))),open:async e=>new Promise((t=>{const{isUiLoaded:s,isDataLoaded:o}=b.state;if(b.setWalletConnectUri(e?.uri),b.setChains(e?.chains),u.reset("ConnectWallet"),s&&o)x.open=!0,t();else{const e=setInterval((()=>{const s=b.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(e),x.open=!0,t())}),200)}})),close(){x.open=!1}};var P=Object.defineProperty,k=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,R=(e,t,s)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const T=c({themeMode:typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}),_={state:T,subscribe:e=>d(T,(()=>e(T))),setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=((e,t)=>{for(var s in t||(t={}))S.call(t,s)&&R(e,s,t[s]);if(k)for(var s of k(t))N.call(t,s)&&R(e,s,t[s]);return e})({},s))}},$=c({open:!1,message:"",variant:"success"}),B={state:$,subscribe:e=>d($,(()=>e($))),openToast(e,t){$.open=!0,$.message=e,$.variant=t},closeToast(){$.open=!1}};var H=Object.freeze({__proto__:null,WalletConnectModal:class{constructor(e){this.openModal=D.open,this.closeModal=D.close,this.subscribeModal=D.subscribe,this.setTheme=_.setThemeConfig,_.setThemeConfig(e),v.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then((function(){return require("./index-eb09e54d.cjs")}));const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),b.setIsUiLoaded(!0)}}}});exports.F=D,exports.G=_,exports.N=u,exports.Q=B,exports.T=m,exports.d=b,exports.f=v,exports.i=h,exports.index=H,exports.q=U;