@dodoex/wallet-web3 0.0.38-0 → 0.0.38-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/DefaultJsonRpcProvider-023db5aa.js +1 -0
  2. package/dist/__node-resolve_empty-7c17bc23.js +1 -0
  3. package/dist/__tslib-84083895.js +1 -0
  4. package/dist/{blocto-a6cd807e.js → blocto-27f059d7.js} +1 -1
  5. package/dist/{bn-9584be28.js → bn-304e1d60.js} +1 -1
  6. package/dist/{browser-ponyfill-ceaf44e7.js → browser-ponyfill-9b4ef8a3.js} +1 -1
  7. package/dist/cjs/DefaultJsonRpcProvider-d29e7762.cjs +1 -0
  8. package/dist/cjs/{__node-resolve_empty-d0feef7d.cjs → __node-resolve_empty-0c1b6176.cjs} +1 -1
  9. package/dist/cjs/__tslib-09b93710.cjs +1 -0
  10. package/dist/cjs/{blocto-0b467bf1.cjs → blocto-e6a7fce9.cjs} +1 -1
  11. package/dist/cjs/{bn-e71fedb4.cjs → bn-c9a77de3.cjs} +1 -1
  12. package/dist/cjs/{browser-ponyfill-a1664394.cjs → browser-ponyfill-9467a437.cjs} +1 -1
  13. package/dist/cjs/{draggabilly-38f552fe.cjs → draggabilly-8693bda7.cjs} +1 -1
  14. package/dist/cjs/ethers-c5c25e89.cjs +1 -0
  15. package/dist/cjs/{id-27693a72.cjs → id-81c0e7d7.cjs} +1 -1
  16. package/dist/cjs/{index-fe5d6c82.cjs → index-39ba7b21.cjs} +2 -2
  17. package/dist/cjs/{index-3c316c68.cjs → index-402a5837.cjs} +1 -1
  18. package/dist/cjs/index-5584f8dd.cjs +1 -0
  19. package/dist/cjs/index-62e0f3ae.cjs +1 -0
  20. package/dist/cjs/index-6c6c6393.cjs +1 -0
  21. package/dist/cjs/index-6f4e58d7.cjs +1 -0
  22. package/dist/cjs/{index-6f572135.cjs → index-71fcb416.cjs} +1 -1
  23. package/dist/cjs/{index-d0b55caa.cjs → index-8ec0d3a5.cjs} +1 -1
  24. package/dist/cjs/{index-a75b8db4.cjs → index-b26f70bb.cjs} +1 -1
  25. package/dist/cjs/index-b7877bf5.cjs +15 -0
  26. package/dist/cjs/index-e102637e.cjs +1 -0
  27. package/dist/cjs/index.cjs +1 -1
  28. package/dist/cjs/{index.es-57126bda.cjs → index.es-f02d698e.cjs} +1 -1
  29. package/dist/cjs/{interface-efbed933.cjs → interface-76605ec5.cjs} +1 -1
  30. package/dist/cjs/{lib-typedarrays-bdd6ebce.cjs → lib-typedarrays-c4a4e3a1.cjs} +1 -1
  31. package/dist/cjs/{portis-b9a4f575.cjs → portis-fd11dffa.cjs} +1 -1
  32. package/dist/cjs/{provider-f35c74b4.cjs → provider-27422952.cjs} +1 -1
  33. package/dist/cjs/providers/baseProvider/DefaultJsonRpcProvider.d.ts +6 -0
  34. package/dist/cjs/providers/connector/cyber/provider.d.ts +1 -1
  35. package/dist/cjs/providers/connector/index.d.ts +2 -3
  36. package/dist/cjs/providers/connector/ledgerUSB/provider.d.ts +1 -1
  37. package/dist/cjs/providers/connector/types.d.ts +1 -0
  38. package/dist/cjs/providers/connector/uniPass/index.d.ts +2 -3
  39. package/dist/cjs/providers/connector/uniPass/provider.d.ts +4 -5
  40. package/dist/cjs/providers/wallets/index.d.ts +1 -0
  41. package/dist/cjs/{rainbow-26ed4a07.cjs → rainbow-bcf73bc1.cjs} +1 -1
  42. package/dist/cjs/{sha224-800bc9c6.cjs → sha224-22adba8e.cjs} +1 -1
  43. package/dist/cjs/{sha256-00851e3c.cjs → sha256-220413fb.cjs} +1 -1
  44. package/dist/cjs/{uAuth-0f14db24.cjs → uAuth-e3589bcb.cjs} +1 -1
  45. package/dist/cjs/{walletConnect-959dd939.cjs → walletConnect-c37e2492.cjs} +1 -1
  46. package/dist/cjs/walletLink-31031b72.cjs +3 -0
  47. package/dist/{draggabilly-b6db4be9.js → draggabilly-cff0507c.js} +1 -1
  48. package/dist/ethers-b4faabe7.js +1 -0
  49. package/dist/{id-12731258.js → id-7a72450a.js} +1 -1
  50. package/dist/{index-3ba69a09.js → index-2b4b285b.js} +2 -2
  51. package/dist/index-2fb9f03f.js +1 -0
  52. package/dist/{index-04e632fc.js → index-3064c150.js} +1 -1
  53. package/dist/index-3226a002.js +1 -0
  54. package/dist/{index-38a87c1d.js → index-3f80ded8.js} +1 -1
  55. package/dist/index-5126a09a.js +1 -0
  56. package/dist/{index-4a2b9fbb.js → index-718b7cea.js} +1 -1
  57. package/dist/index-7582b342.js +1 -0
  58. package/dist/index-85d303fd.js +1 -0
  59. package/dist/index-ae7d3074.js +15 -0
  60. package/dist/{index-fc4c5f68.js → index-cdb272cc.js} +1 -1
  61. package/dist/{index.es-1660ed9f.js → index.es-0a6a3401.js} +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/{interface-6fa31c33.js → interface-500e53e4.js} +1 -1
  64. package/dist/{lib-typedarrays-565397f3.js → lib-typedarrays-a390e948.js} +1 -1
  65. package/dist/{portis-2792bc32.js → portis-9d4b4870.js} +1 -1
  66. package/dist/{provider-e36ba00c.js → provider-ef233626.js} +1 -1
  67. package/dist/providers/baseProvider/DefaultJsonRpcProvider.d.ts +6 -0
  68. package/dist/providers/connector/cyber/provider.d.ts +1 -1
  69. package/dist/providers/connector/index.d.ts +2 -3
  70. package/dist/providers/connector/ledgerUSB/provider.d.ts +1 -1
  71. package/dist/providers/connector/types.d.ts +1 -0
  72. package/dist/providers/connector/uniPass/index.d.ts +2 -3
  73. package/dist/providers/connector/uniPass/provider.d.ts +4 -5
  74. package/dist/providers/wallets/index.d.ts +1 -0
  75. package/dist/{rainbow-3776a80e.js → rainbow-b52120c2.js} +1 -1
  76. package/dist/sha224-c1401791.js +1 -0
  77. package/dist/{sha256-7d953191.js → sha256-e8858cab.js} +1 -1
  78. package/dist/{uAuth-a10134f8.js → uAuth-69094892.js} +1 -1
  79. package/dist/{walletConnect-eb9d73e1.js → walletConnect-d37e0f11.js} +1 -1
  80. package/dist/walletLink-f5c11139.js +3 -0
  81. package/package.json +1 -1
  82. package/dist/__node-resolve_empty-243278fd.js +0 -1
  83. package/dist/__tslib-60be3963.js +0 -1
  84. package/dist/cjs/__tslib-2a3da337.cjs +0 -1
  85. package/dist/cjs/ethers-adc4197a.cjs +0 -1
  86. package/dist/cjs/index-0ad49e37.cjs +0 -1
  87. package/dist/cjs/index-0c56b744.cjs +0 -1
  88. package/dist/cjs/index-2f5278de.cjs +0 -1
  89. package/dist/cjs/index-899ad19f.cjs +0 -1
  90. package/dist/cjs/index-9b2ebee3.cjs +0 -15
  91. package/dist/cjs/index-d2607bc2.cjs +0 -1
  92. package/dist/cjs/typed-data-0687ecc0.cjs +0 -1
  93. package/dist/cjs/walletLink-1658878b.cjs +0 -3
  94. package/dist/ethers-9c12dcb6.js +0 -1
  95. package/dist/index-01560ab9.js +0 -1
  96. package/dist/index-41d286cf.js +0 -15
  97. package/dist/index-530cd3b1.js +0 -1
  98. package/dist/index-603004ab.js +0 -1
  99. package/dist/index-c8a4910b.js +0 -1
  100. package/dist/index-e2797e72.js +0 -1
  101. package/dist/sha224-83ad0b8d.js +0 -1
  102. package/dist/typed-data-947c7b13.js +0 -1
  103. package/dist/walletLink-005dd38f.js +0 -3
@@ -1 +0,0 @@
1
- "use strict";var e=require("./index-a75b8db4.cjs"),t=require("@ethersproject/providers"),n=require("@ethersproject/address"),r=require("@ethersproject/abstract-signer"),o=require("@ethersproject/bytes"),i=require("./typed-data-0687ecc0.cjs"),a=require("./index-3c316c68.cjs"),s=require("./ethers-adc4197a.cjs"),c=require("./id-27693a72.cjs"),u=require("@ethersproject/json-wallets"),p=require("@ethersproject/properties"),l=require("./index-d2607bc2.cjs"),d=require("@ethersproject/transactions"),f=require("./index-2f5278de.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-efbed933.cjs"),require("@ethersproject/abstract-provider"),require("./__node-resolve_empty-d0feef7d.cjs"),require("./hash-7ce6fed5.cjs"),require("./inherits_browser-50deae74.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 +0,0 @@
1
- "use strict";var e=require("@ethersproject/bytes"),t=require("@ethersproject/properties"),r=require("./id-27693a72.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 +0,0 @@
1
- "use strict";var e=require("./index-a75b8db4.cjs"),r=require("@ethersproject/providers"),t=require("@ethersproject/address");require("events");var n=require("@ethersproject/bytes"),s=require("./id-27693a72.cjs"),i=require("./typed-data-0687ecc0.cjs"),o=require("@ethersproject/abstract-signer"),a=require("@ethersproject/properties"),d=require("./index-2f5278de.cjs");require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./__node-resolve_empty-d0feef7d.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)};