@dodoex/wallet-web3 0.0.43-2 → 0.0.43-3

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 (127) hide show
  1. package/dist/__tslib-b9063535.js +1 -0
  2. package/dist/alchemy-provider-5870b6fa-d23e5ee5.js +1 -0
  3. package/dist/alchemy-websocket-provider-213da986-0b22950f.js +1 -0
  4. package/dist/blocto-81cca48d.js +1 -0
  5. package/dist/ccip-8d34ca7b.js +1 -0
  6. package/dist/cjs/__tslib-c4e7aabc.cjs +1 -0
  7. package/dist/cjs/alchemy-provider-5870b6fa-1bd8b6bd.cjs +1 -0
  8. package/dist/cjs/alchemy-websocket-provider-213da986-d28efad0.cjs +1 -0
  9. package/dist/cjs/blocto-f237ffa1.cjs +1 -0
  10. package/dist/cjs/ccip-f3caf907.cjs +1 -0
  11. package/dist/cjs/{draggabilly-9347a024.cjs → draggabilly-e326df59.cjs} +1 -1
  12. package/dist/cjs/ethers-6d61cad7.cjs +1 -0
  13. package/dist/cjs/id-429f99e0.cjs +1 -0
  14. package/dist/cjs/{index-0e02422e.cjs → index-05816b53.cjs} +1 -1
  15. package/dist/cjs/{index-a4d7eb55.cjs → index-0f3725cc.cjs} +2 -2
  16. package/dist/cjs/index-13c33397.cjs +1 -0
  17. package/dist/cjs/index-2ff8acb7.cjs +28 -0
  18. package/dist/cjs/index-3236a05c.cjs +1 -0
  19. package/dist/cjs/index-3bc344a2.cjs +1 -0
  20. package/dist/cjs/index-557cb005.cjs +15 -0
  21. package/dist/{index-cd748d86.js → cjs/index-791c6860.cjs} +2 -2
  22. package/dist/cjs/index-793845be.cjs +6 -0
  23. package/dist/cjs/index-d39c8a59.cjs +1 -0
  24. package/dist/cjs/index-ef6f4cd5.cjs +1 -0
  25. package/dist/cjs/index.cjs +1 -1
  26. package/dist/cjs/index.es-cba506e1.cjs +9 -0
  27. package/dist/cjs/{interface-ca8f7e00.cjs → interface-e7093db3.cjs} +1 -1
  28. package/dist/cjs/{lib-typedarrays-b3b1a9b2.cjs → lib-typedarrays-6a913903.cjs} +1 -1
  29. package/dist/cjs/{portis-2628aa40.cjs → portis-bbf62ccd.cjs} +1 -1
  30. package/dist/cjs/provider-c5f6a090.cjs +1 -0
  31. package/dist/cjs/providers/connector/alchemy/provider.d.ts +42 -41
  32. package/dist/cjs/providers/wallets/standalone.d.ts +1 -0
  33. package/dist/cjs/rainbow-456904df.cjs +1 -0
  34. package/dist/cjs/{sha224-e08c8475.cjs → sha224-9a19fa11.cjs} +1 -1
  35. package/dist/cjs/sha256-be12467d.cjs +1 -0
  36. package/dist/cjs/typed-data-6a9095c9.cjs +1 -0
  37. package/dist/cjs/uAuth-7be759be.cjs +1 -0
  38. package/dist/cjs/walletConnect-cf4c0650.cjs +1 -0
  39. package/dist/cjs/walletLink-aed9d343.cjs +3 -0
  40. package/dist/{draggabilly-e394dd03.js → draggabilly-05a4c022.js} +1 -1
  41. package/dist/ethers-5083145b.js +1 -0
  42. package/dist/id-66f0017b.js +1 -0
  43. package/dist/{index-578e2937.js → index-194016af.js} +2 -2
  44. package/dist/index-1f959f94.js +1 -0
  45. package/dist/index-20eb855b.js +1 -0
  46. package/dist/index-30742353.js +1 -0
  47. package/dist/{index-fe4c3da3.js → index-32fea953.js} +2 -2
  48. package/dist/{cjs/index-123203f3.cjs → index-83581112.js} +2 -2
  49. package/dist/index-8740b83e.js +1 -0
  50. package/dist/index-89d5f09e.js +1 -0
  51. package/dist/index-d2fabfc5.js +15 -0
  52. package/dist/index-ddc227e4.js +1 -0
  53. package/dist/index-e25f9e24.js +28 -0
  54. package/dist/index.es-7ed72d41.js +9 -0
  55. package/dist/index.js +1 -1
  56. package/dist/{interface-2be6959d.js → interface-69689b2d.js} +1 -1
  57. package/dist/{lib-typedarrays-0fb1b85c.js → lib-typedarrays-b625647d.js} +1 -1
  58. package/dist/{portis-61fd1e59.js → portis-9d48bbdf.js} +1 -1
  59. package/dist/provider-b0524b31.js +1 -0
  60. package/dist/providers/connector/alchemy/provider.d.ts +42 -41
  61. package/dist/providers/wallets/standalone.d.ts +1 -0
  62. package/dist/rainbow-c332b668.js +1 -0
  63. package/dist/sha224-312b08a7.js +1 -0
  64. package/dist/sha256-b40ca149.js +1 -0
  65. package/dist/typed-data-493baf31.js +1 -0
  66. package/dist/uAuth-65fb6910.js +1 -0
  67. package/dist/walletConnect-4f48092f.js +1 -0
  68. package/dist/{walletLink-518a0d96.js → walletLink-bd6ba61a.js} +2 -2
  69. package/package.json +1 -1
  70. package/dist/DefaultJsonRpcProvider-cbd850bc.js +0 -1
  71. package/dist/__node-resolve_empty-c07e04b2.js +0 -1
  72. package/dist/__tslib-54b019af.js +0 -1
  73. package/dist/alchemy-provider-5870b6fa-077754c5.js +0 -1
  74. package/dist/alchemy-websocket-provider-213da986-3bfbc710.js +0 -1
  75. package/dist/blocto-46848faf.js +0 -1
  76. package/dist/bn-27b74013.js +0 -1
  77. package/dist/browser-ponyfill-9983e3af.js +0 -1
  78. package/dist/ccip-54b3b540.js +0 -1
  79. package/dist/cjs/DefaultJsonRpcProvider-4b2cbac3.cjs +0 -1
  80. package/dist/cjs/__node-resolve_empty-d89e5abe.cjs +0 -1
  81. package/dist/cjs/__tslib-2cb2dc52.cjs +0 -1
  82. package/dist/cjs/alchemy-provider-5870b6fa-1e0f04fc.cjs +0 -1
  83. package/dist/cjs/alchemy-websocket-provider-213da986-14086d26.cjs +0 -1
  84. package/dist/cjs/blocto-b08bae37.cjs +0 -1
  85. package/dist/cjs/bn-2fd35ed6.cjs +0 -1
  86. package/dist/cjs/browser-ponyfill-479139d5.cjs +0 -1
  87. package/dist/cjs/ccip-ffbee020.cjs +0 -1
  88. package/dist/cjs/ethers-6c134a78.cjs +0 -1
  89. package/dist/cjs/id-306822a4.cjs +0 -1
  90. package/dist/cjs/index-0c3f7f0d.cjs +0 -1
  91. package/dist/cjs/index-21f1272b.cjs +0 -1
  92. package/dist/cjs/index-3ee0c164.cjs +0 -15
  93. package/dist/cjs/index-449eebb0.cjs +0 -1
  94. package/dist/cjs/index-4b751ebb.cjs +0 -9
  95. package/dist/cjs/index-584ce2f2.cjs +0 -1
  96. package/dist/cjs/index-630bda42.cjs +0 -1
  97. package/dist/cjs/index-891edc27.cjs +0 -6
  98. package/dist/cjs/index-c8612d96.cjs +0 -20
  99. package/dist/cjs/index-d890bb01.cjs +0 -1
  100. package/dist/cjs/index-e373c760.cjs +0 -1
  101. package/dist/cjs/index.es-1a08ac77.cjs +0 -9
  102. package/dist/cjs/provider-ed5b8d31.cjs +0 -1
  103. package/dist/cjs/rainbow-66ff0e60.cjs +0 -1
  104. package/dist/cjs/sha256-ff3785f0.cjs +0 -1
  105. package/dist/cjs/uAuth-1c63d29f.cjs +0 -1
  106. package/dist/cjs/walletConnect-c94a63a7.cjs +0 -1
  107. package/dist/cjs/walletLink-24367174.cjs +0 -3
  108. package/dist/ethers-33678100.js +0 -1
  109. package/dist/id-66098a37.js +0 -1
  110. package/dist/index-1fae0e53.js +0 -1
  111. package/dist/index-27bb4d53.js +0 -1
  112. package/dist/index-493358d6.js +0 -1
  113. package/dist/index-4f7c4b45.js +0 -1
  114. package/dist/index-5b79ce49.js +0 -1
  115. package/dist/index-6aa8c5c1.js +0 -1
  116. package/dist/index-75067bb0.js +0 -15
  117. package/dist/index-76c2f135.js +0 -9
  118. package/dist/index-81e6d2c8.js +0 -20
  119. package/dist/index-9dc69b05.js +0 -1
  120. package/dist/index-fb276f03.js +0 -1
  121. package/dist/index.es-79e3646d.js +0 -9
  122. package/dist/provider-5ae74ef7.js +0 -1
  123. package/dist/rainbow-5edcbe7e.js +0 -1
  124. package/dist/sha224-ad024e21.js +0 -1
  125. package/dist/sha256-2a311540.js +0 -1
  126. package/dist/uAuth-70cae622.js +0 -1
  127. package/dist/walletConnect-526a0eb4.js +0 -1
@@ -0,0 +1 @@
1
+ import{g as a}from"./index-e25f9e24.js";import{C as r,E as e,a as s,F as t,b as o,P as n,c as i,A as c,d as m,I as d,f,e as p,L as F,T as g}from"./interface-69689b2d.js";var b=a(Object.freeze({__proto__:null,ConstructorFragment:r,ErrorFragment:e,EventFragment:s,Fragment:t,FunctionFragment:o,ParamType:n,FormatTypes:i,AbiCoder:c,defaultAbiCoder:m,Interface:d,Indexed:f,checkResultErrors:p,LogDescription:F,TransactionDescription:g}));export{b as r};
@@ -0,0 +1 @@
1
+ import{hexlify as r,arrayify as t,isBytesLike as o}from"@ethersproject/bytes";import{L as e}from"./index-e25f9e24.js";const n=new e("rlp/5.7.0");function s(r){const t=[];for(;r;)t.unshift(255&r),r>>=8;return t}function c(r,t,o){let e=0;for(let n=0;n<o;n++)e=256*e+r[t+n];return e}function h(r){if(Array.isArray(r)){let t=[];if(r.forEach((function(r){t=t.concat(h(r))})),t.length<=55)return t.unshift(192+t.length),t;const o=s(t.length);return o.unshift(247+o.length),o.concat(t)}o(r)||n.throwArgumentError("RLP object must be BytesLike","object",r);const e=Array.prototype.slice.call(t(r));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const c=s(e.length);return c.unshift(183+c.length),c.concat(e)}function u(t){return r(h(t))}function a(r,t,o,s){const c=[];for(;o<t+1+s;){const h=l(r,o);c.push(h.result),(o+=h.consumed)>t+1+s&&n.throwError("child data too short",e.errors.BUFFER_OVERRUN,{})}return{consumed:1+s,result:c}}function l(t,o){if(0===t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{}),t[o]>=248){const r=t[o]-247;o+1+r>t.length&&n.throwError("data short segment too short",e.errors.BUFFER_OVERRUN,{});const s=c(t,o+1,r);return o+1+r+s>t.length&&n.throwError("data long segment too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1+r,r+s)}if(t[o]>=192){const r=t[o]-192;return o+1+r>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{}),a(t,o,o+1,r)}if(t[o]>=184){const s=t[o]-183;o+1+s>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});const h=c(t,o+1,s);o+1+s+h>t.length&&n.throwError("data array too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s+h,result:r(t.slice(o+1+s,o+1+s+h))}}if(t[o]>=128){const s=t[o]-128;o+1+s>t.length&&n.throwError("data too short",e.errors.BUFFER_OVERRUN,{});return{consumed:1+s,result:r(t.slice(o+1,o+1+s))}}return{consumed:1,result:r(t[o])}}function i(r){const o=t(r),e=l(o,0);return e.consumed!==o.length&&n.throwArgumentError("invalid rlp data","data",r),e.result}var f=Object.freeze({__proto__:null,encode:u,decode:i});export{i as d,u as e,f as l};
@@ -0,0 +1 @@
1
+ import{q as e,t,j as n,b as r,s as o,A as i,U as a,_ as s,g as u,X as c,Y as p,Z as l,$ as f,c as d,D as h,a0 as g,a1 as y,a2 as m,u as b}from"./index-e25f9e24.js";import v,{getAddress as w}from"@ethersproject/address";import{Signer as P}from"@ethersproject/abstract-signer";import{JsonRpcProvider as x}from"@ethersproject/providers";import O,{arrayify as j}from"@ethersproject/bytes";import{T as _}from"./typed-data-493baf31.js";import{r as S}from"./index-1f959f94.js";import{f as E,p as k,n as T,d as U,b as L,i as A,c as C,m as N,h as D,g as I,r as R,s as M,j as F,S as z,k as B,o as W,q as G,t as V,x as J,y as H,z as K,A as Z}from"./ethers-5083145b.js";import{i as $}from"./id-66f0017b.js";import q from"@ethersproject/json-wallets";import Y,{defineReadOnly as X}from"@ethersproject/properties";import{l as Q}from"./index-20eb855b.js";import ee from"@ethersproject/transactions";import{Contract as te}from"@ethersproject/contracts";import"zustand";import"events";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/constants";import"./interface-69689b2d.js";import"./hash-b468659c.js";import"./inherits_browser-51bb8c3c.js";var ne,re=Object.freeze({__proto__:null,_toEscapedUtf8String:e,toUtf8Bytes:t,toUtf8CodePoints:n,toUtf8String:r,Utf8ErrorFuncs:o,get Utf8ErrorReason(){return i},get UnicodeNormalizationForm(){return a},formatBytes32String:E,parseBytes32String:k,nameprep:T}),oe=Object.freeze({__proto__:null,id:$,dnsEncode:U,namehash:L,isValidName:A,ensNormalize:C,messagePrefix:N,hashMessage:D,_TypedDataEncoder:_}),ie=Object.freeze({__proto__:null,computeHmac:I,ripemd160:R,sha256:M,sha512:F,get SupportedAlgorithm(){return z}}),ae=Object.freeze({__proto__:null,randomBytes:B,shuffled:W});class se extends P{constructor(e,t,n,r){super(),this._address=n,this._index=null!=r?r:0,this.provider=e,this.upWallet=t}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return s(this,void 0,void 0,(function*(){return Promise.resolve(w(this._address))}))}signMessage(e){return s(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e}'`);return yield this.upWallet.signMessage(e,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(e,t,n){return s(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(e){return s(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data})}))}sendTransaction(e){return s(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return{hash:yield this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data}),from:e.from}}))}connect(e){return new se(null!=e?e:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new se(this.provider,this.upWallet,this._address,this._index)}}!function(e){e.REGISTER="register"}(ne||(ne={}));var ue,ce=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},pe=function(e,t){this.type=e,this.data=t},le=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fe.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(ue||(ue={}));var de=function(e){return j(function(e){var t=fe({},e.types);return delete t.EIP712Domain,_.hash(e.domain,t,e.message)}(e))},he={},ge=u(G),ye=u(V),me=u(oe),be=u(J),ve=u(c),we=u(p),Pe=u(ie),xe=u(H),Oe=u(ae),je=u(Q),_e=u(K),Se=u(re),Ee=u(l),ke=u(Z),Te=u(f);function Ue(){Ue=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),s=new _(o||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function f(){}function d(){}function h(){}var g={};u(g,i,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(S([])));m&&m!==t&&n.call(m,i)&&(g=m);var b=h.prototype=f.prototype=Object.create(g);function v(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,s){var u=p(e[r],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return o("throw",e,a,s)}))}s(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function P(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return E()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=x(a,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,l;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=h,r(b,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:d,configurable:!0}),d.displayName=u(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},v(w.prototype),u(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new w(c(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(b),u(b,s,"Generator"),u(b,i,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=S,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}function Le(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function Ae(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Le(i,r,o,a,s,"next",e)}function s(e){Le(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ce.apply(this,arguments)}!function(e){var t=d&&d.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=d&&d.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=d&&d.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&t(r,e,o);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var o=S;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return o.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return o.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return o.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return o.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return o.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return o.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return o.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return o.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return o.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return o.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return o.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return o.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return o.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return o.TransactionDescription}});var i=v;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return i.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return i.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return i.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return i.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return i.isAddress}});var a=r(ge);e.base64=a;var s=ye;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var u=O;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return u.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return u.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return u.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return u.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return u.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return u.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return u.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return u.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return u.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return u.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return u.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return u.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return u.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return u.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return u.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return u.stripZeros}});var c=me;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return c._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return c.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return c.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return c.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return c.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return c.namehash}});var p=be;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return p.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return p.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return p.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return p.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return p.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return p.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return p.mnemonicToSeed}});var l=q;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return l.getJsonWalletAddress}});var f=ve;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return f.keccak256}});var h=we;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return h.Logger}});var g=Pe;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return g.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return g.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return g.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return g.sha512}});var y=xe;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return y.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return y.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return y.sha256}});var m=Oe;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return m.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return m.shuffled}});var b=Y;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return b.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return b.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return b.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return b.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return b.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return b.shallowCopy}});var w=r(je);e.RLP=w;var P=_e;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return P.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return P.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return P.SigningKey}});var x=Se;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return x.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return x.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return x.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return x._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return x.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return x.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return x.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return x.Utf8ErrorFuncs}});var j=ee;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return j.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return j.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return j.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return j.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return j.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return j.TransactionTypes}});var _=Ee;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return _.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return _.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return _.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return _.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return _.parseUnits}});var E=ke;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return E.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return E.verifyTypedData}});var k=Te;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return k._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return k.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return k.poll}});var T=Pe;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return T.SupportedAlgorithm}});var U=Se;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return U.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return U.Utf8ErrorReason}})}(he);var Ne="wallet.unipass.id",De={upDomain:Ne,upConnectUrl:"https://"+Ne+"/connect",upLogoutUrl:"https://"+Ne+"/logout",upSignMessageUrl:"https://"+Ne+"/sign-message",upTransactionUrl:"https://"+Ne+"/send-transaction",upLoadingUrl:"https://"+Ne+"/connect/loading"},Ie=function(){return De},Re={protocol:"https",domain:"testnet.wallet.unipass.id"},Me={protocol:"https",domain:"wallet.unipass.id"},Fe={mainnet:{eth:"https://node.wallet.unipass.id/eth-mainnet",polygon:"https://node.wallet.unipass.id/polygon-mainnet",bsc:"https://node.wallet.unipass.id/bsc-mainnet",rangers:"https://node.wallet.unipass.id/rangers-mainnet",scroll:"https://node.wallet.unipass.id/scroll-mainnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-mainnet",avalanche:"https://node.wallet.unipass.id/avalanche-mainnet",kcc:"https://node.wallet.unipass.id/kcc-mainnet",platon:"https://node.wallet.unipass.id/platon-mainnet",okc:"https://node.wallet.unipass.id/okc-mainnet"},testnet:{eth:"https://node.wallet.unipass.id/eth-goerli",polygon:"https://node.wallet.unipass.id/polygon-mumbai",bsc:"https://node.wallet.unipass.id/bsc-testnet",rangers:"https://node.wallet.unipass.id/rangers-robin",scroll:"https://node.wallet.unipass.id/scroll-testnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-testnet",avalanche:"https://node.wallet.unipass.id/avalanche-testnet",kcc:"https://node.wallet.unipass.id/kcc-testnet",platon:"https://node.wallet.unipass.id/platon-testnet",okc:"https://node.wallet.unipass.id/okc-testnet"}},ze=function(e){var t;t="localStorage"===e?window.localStorage||localStorage:window.sessionStorage||sessionStorage;return{get:function(e){return t.getItem(e)||""},set:function(e,n){return t.setItem(e,n||"")},remove:function(e){return t.removeItem(e)}}},Be=function(){var e=Ae(Ue().mark((function e(t,n){var r,o;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(t.storageType).get(nt),e.t0=r&&JSON.parse(r),e.t0){e.next=6;break}return e.next=5,Ge(t,n);case 5:e.t0=e.sent;case 6:return o=e.t0,e.abrupt("return",o);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),We=function(){var e=Ae(Ue().mark((function e(t){var n;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new le("UP_LOGOUT"),e.next=4,rt(n);case 4:ze("localStorage").remove(nt),ze("sessionStorage").remove(nt);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ge=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new le("UP_LOGIN",r,t.appSettings),e.next=5,rt(o,null==n?void 0:n.connectType,null==n?void 0:n.forceLogin,null==n?void 0:n.eventListener);case 5:return(i=e.sent)&&i.address&&ze(t.storageType).set(nt,JSON.stringify(i)),e.abrupt("return",i);case 10:throw e.prev=10,e.t0=e.catch(0),new Error("Account Not Available");case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n){return e.apply(this,arguments)}}(),Ve="UP_WALLET_POP",Je=null,He=null;function Ke(e,t,n){var r="innerWidth=462,width=462,innerHeight=810,height=810,top="+.5*(n.screen.availHeight-30-810)+",left="+.8*(n.screen.availWidth-10-462)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";return n.open(e,t,r)}function Ze(e,t,n){return $e.apply(this,arguments)}function $e(){return($e=Ae(Ue().mark((function e(t,n,r){var o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==Je||null!=(o=Je)&&o.closed)){e.next=8;break}if(null!=(Je=Ke(t,Ve,window))){e.next=6;break}return e.next=5,qe(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:He!==t?(Je.location.replace(t),Je.focus()):Je.focus();case 9:return i=setInterval((function(){if(Je&&Je.closed){var e={data:new le("UP_RESPONSE",JSON.stringify(new pe("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){Je&&!Je.closed&&Je.close(),Je=null},e.abrupt("return",{popup:Je,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e,t,n){return Ye.apply(this,arguments)}function Ye(){return(Ye=Ae(Ue().mark((function e(t,n,r){var o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=document.createElement("div"),'\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',o.innerHTML='\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',document.body.appendChild(o),i=document.querySelector(".up_notification_right"),e.abrupt("return",new Promise((function(e){null==i||i.addEventListener("click",(function(){document.body.removeChild(o),e(Ze(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Xe=function(){};function Qe(e,t,n){if("UP_LOGIN"===e)return"google"===t?Ie().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?Ie().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):Ie().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return Ie().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return Ie().upSignMessageUrl;if("UP_TRANSACTION"===e)return Ie().upTransactionUrl;if("UP_READY"===e)return Ie().upLoadingUrl;throw new Error("unsupport type "+e)}function et(e,t,n,r){return tt.apply(this,arguments)}function tt(){return tt=Ae(Ue().mark((function e(t,n,r,o){var i,a,s,u,c,p,l,f,d,h;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h=function(e){try{null==p||p.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}},d=function(){try{window.removeEventListener("message",f),l(),i()}catch(e){console.error("Popup Close Error",e)}},f=function(e){try{if("object"!=typeof e.data)return;var t=e.data;if(!t||!t.type)return;"UP_CLOSE"===e.data.type&&d(),"UP_READY"===t.type&&s(e,{send:h,close:d}),"UP_RESPONSE"===t.type&&u(e,{send:h,close:d}),"UP_EVENT"===t.type&&a(e,{send:h,close:d})}catch(e){console.error("Popup Callback Error",e),d()}},null!=t){e.next=5;break}return e.abrupt("return",{send:Xe,close:Xe});case 5:return i=(null==o?void 0:o.onClose)||Xe,a=(null==o?void 0:o.onMessage)||Xe,s=(null==o?void 0:o.onReady)||Xe,u=(null==o?void 0:o.onResponse)||Xe,window.addEventListener("message",f),e.next=12,Ze(Qe(t.type,n,r),u,t.appSetting);case 12:return c=e.sent,p=c.popup,l=c.unmount,e.abrupt("return",{send:h,close:d});case 16:case"end":return e.stop()}}),e)}))),tt.apply(this,arguments)}var nt="UP-A";function rt(e,t,n,r){return new Promise(function(){var o=Ae(Ue().mark((function o(i,a){return Ue().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,et(e,t,n,{onReady:function(t,n){return Ae(Ue().mark((function t(){var r;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.send,t.prev=1,r(e),t.next=8;break;case 5:throw t.prev=5,t.t0=t.catch(1),t.t0;case 8:case"end":return t.stop()}}),t,null,[[1,5]])})))()},onResponse:function(t,n){return Ae(Ue().mark((function r(){var o,s,u;return Ue().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=n.close,r.prev=1,"object"==typeof t.data){r.next=4;break}return r.abrupt("return");case 4:s=t.data,u=JSON.parse(s.payload),r.t0=u.type,r.next="APPROVE"===r.t0?9:"DECLINE"===r.t0?12:27;break;case 9:return i(u.data),o(),r.abrupt("break",30);case 12:if("expired"!==u.data){r.next=24;break}if("UP_LOGIN"!==e.type){r.next=15;break}return r.abrupt("return");case 15:if("UP_LOGOUT"!==e.type){r.next=19;break}return i(u.data),o(),r.abrupt("return");case 19:if("UP_TRANSACTION"!==e.type&&"UP_SIGN_MESSAGE"!==e.type){r.next=24;break}return We(!1),a("can not authorize without login"),o(),r.abrupt("break",30);case 24:return a("Declined: "+(u.data||"No reason supplied")),o(),r.abrupt("break",30);case 27:return a("Declined: No reason supplied"),o(),r.abrupt("break",30);case 30:r.next=35;break;case 32:throw r.prev=32,r.t1=r.catch(1),r.t1;case 35:case"end":return r.stop()}}),r,null,[[1,32]])})))()},onMessage:function(e,t){return Ae(Ue().mark((function t(){var n,o;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}return t.abrupt("return");case 2:if(t.prev=2,"object"==typeof e.data){t.next=5;break}return t.abrupt("return");case 5:n=e.data,o=JSON.parse(n.payload),r(o),t.next=13;break;case 10:throw t.prev=10,t.t0=t.catch(2),t.t0;case 13:case"end":return t.stop()}}),t,null,[[2,10]])})))()},onClose:function(){return Ae(Ue().mark((function e(){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a("Declined: Externally Halted");case 1:case"end":return e.stop()}}),e)})))()}});case 2:case"end":return o.stop()}}),o)})));return function(e,t){return o.apply(this,arguments)}}())}var ot=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(n.storageType).get(nt),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new le("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,rt(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),it=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(n.storageType).get(nt),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new le("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,rt(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),at="0x1626ba7e";var st=function(){function e(e){this.initConfig(e)}var t=e.prototype;return t.initConfig=function(e){this._config={env:"prod",nodeRPC:"",chainType:"polygon",storageType:"sessionStorage"},this._config.env=e.env||"prod",this._config.chainType=e.chainType||"polygon";var t,n,r=(t=this._config.env,n=this._config.chainType,{env:t,nodeRPC:"prod"===t?Fe.mainnet[n]:Fe.testnet[n],chainType:n,walletUrl:"prod"===t?Me:Re});this._config.nodeRPC=e.nodeRPC||r.nodeRPC,this._config.appSettings=function(e,t){return Ce({},t||{},{chain:(null==t?void 0:t.chain)||e,appName:(null==t?void 0:t.appName)||"MyDemo"})}(this._config.chainType,e.appSettings),this._provider=new x(this._config.nodeRPC),this._auth_provider=new x(function(e){return"prod"===e?Fe.mainnet.polygon:Fe.testnet.polygon}(this._config.env));var o,i,a,s=e.walletUrl||r.walletUrl;s&&(i=(o=s).domain,a=o.protocol,De={upDomain:i=i||Ne,upConnectUrl:(a=a||"https")+"://"+i+"/connect",upLogoutUrl:a+"://"+i+"/logout",upSignMessageUrl:a+"://"+i+"/sign-message",upTransactionUrl:a+"://"+i+"/send-transaction",upLoadingUrl:a+"://"+i+"/connect/loading"}),this._config.storageType=e.storageType||"sessionStorage"},t.updateConfig=function(e){this._config&&(e.chainType&&(this._config.chainType=e.chainType),e.nodeRPC&&(this._config.nodeRPC=e.nodeRPC,this._provider=new x(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},t.login=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Be(this._config,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getAccount=function(){var e,t;return e=this._config.storageType,(t=ze(e).get(nt))?JSON.parse(t):void 0},t.logout=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,We(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.getProvider=function(){return this._provider},t.getAuthProvider=function(){return this._auth_provider},t.isLogin=function(){return!!this.getAccount()},t.assertLogin=function(){if(!this.isLogin())throw new Error("user is not login")},t.getAddress=function(){return this.assertLogin(),this.getAccount().address},t.sendTransaction=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,it(t,this._config);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.signMessage=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a,s;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),o=(r=n||{}).isEIP191Prefix,i=void 0!==o&&o,a=r.onAuthChain,s=void 0===a||a,"string"==typeof t&&(t=he.toUtf8Bytes(t)),e.next=5,ot(new ce(this.getAddress(),he.hexlify(t),"V1",i,s),this._config);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidSignature=function(){var e=Ae(Ue().mark((function e(t,n,r){var o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new te(r,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),e.next=4,o.isValidSignature(("string"==typeof(a=t)&&(a=he.toUtf8Bytes(a)),he.keccak256(he.concat([he.toUtf8Bytes("UniPass Signed Message:\n"),he.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===at);case 6:case"end":return e.stop()}var a}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.signTypedData=function(){var e=Ae(Ue().mark((function e(t,n){var r,o;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertLogin(),null!=t){e.next=3;break}throw new Error("Missing data parameter");case 3:return r=(n||{}).onAuthChain,o=void 0===r||r,e.next=6,ot(new ce(this.getAddress(),JSON.stringify(t),"V4",!1,o),this._config);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidTypedSignature=function(){var e=Ae(Ue().mark((function e(t,n,r){var o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t){e.next=2;break}throw new Error("Missing data parameter");case 2:return n||(this.assertLogin(),n=this.getAddress()),o=new te(n,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),i=de(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===at);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function ut(e){var t,n,r;return s(this,void 0,void 0,(function*(){const o=e.JsonRpcProvider||h,i=null!==(t=e.chainId)&&void 0!==t?t:1;let a=null!==(n=e.rpcUrl)&&void 0!==n?n:null===(r=e.rpc)||void 0===r?void 0:r[i];const u=new class extends o{constructor(t,n){super(t,n),this.updateUpWalletConfig=t=>{var n;const r=null===(n=e.rpc)||void 0===n?void 0:n[t];if(!g.includes(t))throw new Error(`chainId ${t} not supported`);if(this.upWallet.updateConfig({chainType:y(t),nodeRPC:r,appSettings:{chain:y(t)}}),"object"==typeof this.network)this.network.chainId=t;else{const e={chainId:t,name:"unknown"};X(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=r,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.upWallet=new st({env:m(i),chainType:y(i),appSettings:{appIcon:e.appLogoUrl,appName:e.appName,chain:y(i)},rpcUrl:a,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new se(u,this.upWallet,null!==(e=null==t?void 0:t.address)&&void 0!==e?e:"",0)}connect(){return s(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return e||(yield this.upWallet.login({email:false}))}))}disconnect(){return s(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return s(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)?w(null==e?void 0:e.address):null)}}(a,i);return u}))}function ct(e,t){return s(this,void 0,void 0,(function*(){const n=yield ut(e);return n.on("connect",t.connect),n.on("disconnect",(e=>{t.disconnect(e),t.accountsChanged([])})),n.on("accountsChanged",t.accountsChanged),n.on("chainChanged",t.chainChanged),n.on("message",(({type:e,data:n})=>t.message(e,n))),yield n.connect(),n}))}function pt(){var e;null===(e=b.getState().provider)||void 0===e||e.disconnect()}function lt(e){var t,n;return null===(n=null===(t=b.getState().provider)||void 0===t?void 0:t.upWallet)||void 0===n?void 0:n.signTypedData(e)}function ft(e){var t;const n=e.addChainParameters.chainId,r="string"==typeof n&&(null==n?void 0:n.startsWith("0x"))?parseInt(n,16):Number(n);if(!g.includes(r))throw new Error(`chainId ${r} not supported`);return null===(t=b.getState().provider)||void 0===t?void 0:t.updateUpWalletConfig(r)}export{ut as createProvider,ct as default,pt as disconnectWallet,lt as signTypedData,ft as switchChain};