@dodoex/wallet-web3 0.0.43-beta.2 → 0.0.43

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 (135) hide show
  1. package/dist/alchemy-provider-5870b6fa-233c80b6.js +1 -0
  2. package/dist/alchemy-websocket-provider-213da986-64068b80.js +1 -0
  3. package/dist/blocto-4c3b71f5.js +1 -0
  4. package/dist/ccip-da46c435.js +1 -0
  5. package/dist/cjs/alchemy-provider-5870b6fa-686578f0.cjs +1 -0
  6. package/dist/cjs/alchemy-websocket-provider-213da986-fff1f59d.cjs +1 -0
  7. package/dist/cjs/blocto-621f54a9.cjs +1 -0
  8. package/dist/cjs/ccip-4b1d6858.cjs +1 -0
  9. package/dist/cjs/{draggabilly-5c45132c.cjs → draggabilly-5b36eaf0.cjs} +1 -1
  10. package/dist/cjs/id-0b41bc31.cjs +1 -0
  11. package/dist/{index-9a0e5b83.js → cjs/index-1e729250.cjs} +2 -2
  12. package/dist/cjs/index-283b89ff.cjs +1 -0
  13. package/dist/cjs/index-2d5de895.cjs +1 -0
  14. package/dist/cjs/{index-eb09e54d.cjs → index-35edc6a0.cjs} +1 -1
  15. package/dist/cjs/{index-3f7251ad.cjs → index-44b7a45e.cjs} +3 -3
  16. package/dist/cjs/index-5560dc58.cjs +17 -0
  17. package/dist/cjs/index-73e4d7eb.cjs +6 -0
  18. package/dist/cjs/{index-df8e5839.cjs → index-9f2a69d5.cjs} +1 -1
  19. package/dist/cjs/index-a4478ddb.cjs +1 -0
  20. package/dist/cjs/index-d528b9d2.cjs +1 -0
  21. package/dist/cjs/index-d54b57b8.cjs +1 -0
  22. package/dist/cjs/index-db36b0fa.cjs +29 -0
  23. package/dist/cjs/index.cjs +1 -1
  24. package/dist/cjs/index.es-e3bf027a.cjs +9 -0
  25. package/dist/cjs/{interface-bc5624b1.cjs → interface-d076e79e.cjs} +1 -1
  26. package/dist/cjs/{lib-typedarrays-7f24496d.cjs → lib-typedarrays-68c72268.cjs} +1 -1
  27. package/dist/cjs/{portis-211bf6ad.cjs → portis-7f3437fb.cjs} +1 -1
  28. package/dist/cjs/provider-e53a855b.cjs +1 -0
  29. package/dist/cjs/providers/connector/alchemy/index.d.ts +913 -0
  30. package/dist/cjs/providers/connector/alchemy/provider.d.ts +914 -0
  31. package/dist/cjs/providers/connector/alchemy/signer.d.ts +23 -0
  32. package/dist/cjs/providers/connector/index.d.ts +951 -43
  33. package/dist/cjs/providers/connector/ledgerUSB/index.d.ts +43 -43
  34. package/dist/cjs/providers/connector/ledgerUSB/provider.d.ts +10 -10
  35. package/dist/cjs/providers/connector/types.d.ts +4 -0
  36. package/dist/cjs/providers/connector/uniPass/index.d.ts +43 -43
  37. package/dist/cjs/providers/connector/uniPass/provider.d.ts +10 -10
  38. package/dist/cjs/providers/wallets/index.d.ts +2 -1
  39. package/dist/cjs/providers/wallets/standalone.d.ts +1 -0
  40. package/dist/cjs/providers/wallets/types.d.ts +1 -0
  41. package/dist/cjs/rainbow-dc533bc9.cjs +1 -0
  42. package/dist/cjs/sha224-d1ef1120.cjs +1 -0
  43. package/dist/cjs/sha256-0f5b78af.cjs +1 -0
  44. package/dist/cjs/typed-data-248c37d5.cjs +1 -0
  45. package/dist/cjs/uAuth-d9d66e7c.cjs +1 -0
  46. package/dist/cjs/walletConnect-0d1d9c65.cjs +1 -0
  47. package/dist/cjs/walletLink-a6046616.cjs +3 -0
  48. package/dist/{draggabilly-fb1c9db3.js → draggabilly-ad95d562.js} +1 -1
  49. package/dist/id-d4f3e36f.js +1 -0
  50. package/dist/index-21179dd1.js +1 -0
  51. package/dist/index-2691f407.js +1 -0
  52. package/dist/index-4f86d0d9.js +1 -0
  53. package/dist/{index-0e53e209.js → index-52949a22.js} +2 -2
  54. package/dist/index-5526977f.js +17 -0
  55. package/dist/index-5a7908b7.js +1 -0
  56. package/dist/{index-0ee5ef8d.js → index-65d96278.js} +1 -1
  57. package/dist/index-7e9e2ba1.js +1 -0
  58. package/dist/{index-2068a4fe.js → index-7f74b1e8.js} +3 -3
  59. package/dist/index-af6c16a1.js +29 -0
  60. package/dist/{cjs/index-2a741fbb.cjs → index-cd1a9a88.js} +2 -2
  61. package/dist/{index-e0d3617a.js → index-f08d6a6b.js} +1 -1
  62. package/dist/index.es-bb0f01ae.js +9 -0
  63. package/dist/index.js +1 -1
  64. package/dist/{interface-cb5e1e98.js → interface-8030d5f3.js} +1 -1
  65. package/dist/{lib-typedarrays-f8420380.js → lib-typedarrays-a4c67579.js} +1 -1
  66. package/dist/{portis-0d9d874b.js → portis-e2bba602.js} +1 -1
  67. package/dist/provider-459277d5.js +1 -0
  68. package/dist/providers/connector/alchemy/index.d.ts +913 -0
  69. package/dist/providers/connector/alchemy/provider.d.ts +914 -0
  70. package/dist/providers/connector/alchemy/signer.d.ts +23 -0
  71. package/dist/providers/connector/index.d.ts +951 -43
  72. package/dist/providers/connector/ledgerUSB/index.d.ts +43 -43
  73. package/dist/providers/connector/ledgerUSB/provider.d.ts +10 -10
  74. package/dist/providers/connector/types.d.ts +4 -0
  75. package/dist/providers/connector/uniPass/index.d.ts +43 -43
  76. package/dist/providers/connector/uniPass/provider.d.ts +10 -10
  77. package/dist/providers/wallets/index.d.ts +2 -1
  78. package/dist/providers/wallets/standalone.d.ts +1 -0
  79. package/dist/providers/wallets/types.d.ts +1 -0
  80. package/dist/rainbow-a06575a1.js +1 -0
  81. package/dist/sha224-10712709.js +1 -0
  82. package/dist/sha256-656b18f4.js +1 -0
  83. package/dist/typed-data-b07573b9.js +1 -0
  84. package/dist/uAuth-7b727766.js +1 -0
  85. package/dist/walletConnect-9c01b144.js +1 -0
  86. package/dist/{walletLink-000fcb81.js → walletLink-1b8c2056.js} +2 -2
  87. package/package.json +12 -5
  88. package/dist/DefaultJsonRpcProvider-a5375519.js +0 -1
  89. package/dist/__node-resolve_empty-0ed2c058.js +0 -1
  90. package/dist/blocto-739837e0.js +0 -1
  91. package/dist/bn-dbf1b053.js +0 -1
  92. package/dist/browser-ponyfill-65b68016.js +0 -1
  93. package/dist/cjs/DefaultJsonRpcProvider-af04cc55.cjs +0 -1
  94. package/dist/cjs/__node-resolve_empty-e2dee16c.cjs +0 -1
  95. package/dist/cjs/blocto-e8847b99.cjs +0 -1
  96. package/dist/cjs/bn-87cba44d.cjs +0 -1
  97. package/dist/cjs/browser-ponyfill-de0a8ec9.cjs +0 -1
  98. package/dist/cjs/ethers-2b86e17d.cjs +0 -1
  99. package/dist/cjs/id-1eb25db0.cjs +0 -1
  100. package/dist/cjs/index-0740e7fe.cjs +0 -1
  101. package/dist/cjs/index-18446412.cjs +0 -1
  102. package/dist/cjs/index-1af4ac9a.cjs +0 -1
  103. package/dist/cjs/index-21b90e8c.cjs +0 -6
  104. package/dist/cjs/index-2587eef5.cjs +0 -1
  105. package/dist/cjs/index-38ed564c.cjs +0 -15
  106. package/dist/cjs/index-53583bbc.cjs +0 -1
  107. package/dist/cjs/index-aaf32aa5.cjs +0 -9
  108. package/dist/cjs/index-d22bf825.cjs +0 -1
  109. package/dist/cjs/index-e9e5106b.cjs +0 -1
  110. package/dist/cjs/index.es-3e845f07.cjs +0 -9
  111. package/dist/cjs/provider-0ddad67c.cjs +0 -1
  112. package/dist/cjs/rainbow-73e82c82.cjs +0 -1
  113. package/dist/cjs/sha224-8056f6e3.cjs +0 -1
  114. package/dist/cjs/sha256-43414cf6.cjs +0 -1
  115. package/dist/cjs/uAuth-5166de3a.cjs +0 -1
  116. package/dist/cjs/walletConnect-41dc68ec.cjs +0 -1
  117. package/dist/cjs/walletLink-689340b5.cjs +0 -3
  118. package/dist/ethers-b291db18.js +0 -1
  119. package/dist/id-4e950ad4.js +0 -1
  120. package/dist/index-05ecccce.js +0 -1
  121. package/dist/index-1aa609d8.js +0 -1
  122. package/dist/index-27d4b342.js +0 -1
  123. package/dist/index-54955d07.js +0 -1
  124. package/dist/index-8151dacc.js +0 -1
  125. package/dist/index-929dd85e.js +0 -15
  126. package/dist/index-948c094e.js +0 -9
  127. package/dist/index-d00482ad.js +0 -1
  128. package/dist/index-ede11a7b.js +0 -1
  129. package/dist/index.es-818610ea.js +0 -9
  130. package/dist/provider-0b6bd3ac.js +0 -1
  131. package/dist/rainbow-688b2e16.js +0 -1
  132. package/dist/sha224-3fa562e2.js +0 -1
  133. package/dist/sha256-39cd7493.js +0 -1
  134. package/dist/uAuth-4ba62d4b.js +0 -1
  135. package/dist/walletConnect-96c9baa7.js +0 -1
@@ -1 +0,0 @@
1
- import{_ as e,g as t,q as n,c as r,S as o,r as i,t as a,u as s}from"./index-948c094e.js";import c,{getAddress as u}from"@ethersproject/address";import{Signer as p}from"@ethersproject/abstract-signer";import{JsonRpcProvider as l}from"@ethersproject/providers";import f,{arrayify as d}from"@ethersproject/bytes";import{T as h,l as g}from"./index-27d4b342.js";import{r as y}from"./index-05ecccce.js";import{f as m,p as b,n as v,d as w,b as P,i as x,c as O,m as j,h as _,g as S,r as E,s as k,j as T,S as U,k as L,o as A,q as C,t as N,x as D,y as I,z as R,A as M,B as F}from"./ethers-b291db18.js";import{d as z,t as B,c as W,a as G,e as J,f as V,U as H,i as K,l as Z}from"./id-4e950ad4.js";import $ from"@ethersproject/json-wallets";import q,{defineReadOnly as Y}from"@ethersproject/properties";import{l as Q}from"./index-1aa609d8.js";import X from"@ethersproject/transactions";import{Contract as ee}from"@ethersproject/contracts";import{D as te}from"./DefaultJsonRpcProvider-a5375519.js";import"zustand";import"events";import"@ethersproject/constants";import"./interface-cb5e1e98.js";import"@ethersproject/abstract-provider";import"./__node-resolve_empty-0ed2c058.js";import"./hash-b468659c.js";import"./inherits_browser-51bb8c3c.js";var ne,re=Object.freeze({__proto__:null,_toEscapedUtf8String:z,toUtf8Bytes:B,toUtf8CodePoints:W,toUtf8String:G,Utf8ErrorFuncs:J,get Utf8ErrorReason(){return V},get UnicodeNormalizationForm(){return H},formatBytes32String:m,parseBytes32String:b,nameprep:v}),oe=Object.freeze({__proto__:null,id:K,dnsEncode:w,namehash:P,isValidName:x,ensNormalize:O,messagePrefix:j,hashMessage:_,_TypedDataEncoder:h}),ie=Object.freeze({__proto__:null,computeHmac:S,ripemd160:E,sha256:k,sha512:T,get SupportedAlgorithm(){return U}}),ae=Object.freeze({__proto__:null,randomBytes:L,shuffled:A});class se extends p{constructor(e,t,n,r){super(),this._address=n,this._index=null!=r?r:0,this.provider=e,this.upWallet=t}_legacySignMessage(e){throw new Error("Method not implemented.")}sendUncheckedTransaction(e){throw new Error("Method not implemented.")}unlock(e){throw new Error("Method not implemented.")}getAddress(){return e(this,void 0,void 0,(function*(){return Promise.resolve(u(this._address))}))}signMessage(t){return e(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t}'`);return yield this.upWallet.signMessage(t,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(t,n,r){return e(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(t){return e(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data})}))}sendTransaction(t){return e(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${t.from}'`);return{hash:yield this.upWallet.sendTransaction({from:t.from,to:t.to,value:t.value,data:t.data}),from:t.from}}))}connect(e){return new se(null!=e?e:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new se(this.provider,this.upWallet,this._address,this._index)}}!function(e){e.REGISTER="register"}(ne||(ne={}));var ce,ue=function(e,t,n,r,o){this.from=e,this.msg=t,this.type=n,this.isEIP191Prefix=r,this.onAuthChain=o},pe=function(e,t){this.type=e,this.data=t},le=function(e,t,n){this.type=e,this.payload=t,this.appSetting=n};function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fe.apply(this,arguments)}!function(e){e.LIGHT="light",e.DARK="dark"}(ce||(ce={}));var de=function(e){return d(function(e){var t=fe({},e.types);return delete t.EIP712Domain,h.hash(e.domain,t,e.message)}(e))},he={},ge=t(C),ye=t(N),me=t(oe),be=t(D),ve=t(n),we=t(Z),Pe=t(ie),xe=t(I),Oe=t(ae),je=t(Q),_e=t(R),Se=t(re),Ee=t(M),ke=t(F),Te=t(g);function Ue(){Ue=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),s=new _(o||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function d(){}function h(){}var g={};c(g,i,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(S([])));m&&m!==t&&n.call(m,i)&&(g=m);var b=h.prototype=f.prototype=Object.create(g);function v(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,s){var c=p(e[r],e,i);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){o("next",e,a,s)}),(function(e){o("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function P(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return E()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=x(a,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=p(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,l;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=h,r(b,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:d,configurable:!0}),d.displayName=c(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},v(w.prototype),c(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new w(u(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(b),c(b,s,"Generator"),c(b,i,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=S,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}function Le(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Ae(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Le(i,r,o,a,s,"next",e)}function s(e){Le(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ce.apply(this,arguments)}!function(e){var t=r&&r.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=r&&r.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&t(r,e,o);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var i=y;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var a=c;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return a.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return a.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return a.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return a.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return a.isAddress}});var s=o(ge);e.base64=s;var u=ye;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return u.Base58}});var p=f;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return p.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return p.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return p.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return p.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return p.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return p.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return p.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return p.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return p.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return p.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return p.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return p.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return p.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return p.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return p.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return p.stripZeros}});var l=me;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return l.namehash}});var d=be;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var h=$;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return h.getJsonWalletAddress}});var g=ve;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return g.keccak256}});var m=we;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return m.Logger}});var b=Pe;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return b.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return b.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return b.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return b.sha512}});var v=xe;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return v.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return v.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return v.sha256}});var w=Oe;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return w.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return w.shuffled}});var P=q;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return P.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return P.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return P.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return P.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return P.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return P.shallowCopy}});var x=o(je);e.RLP=x;var O=_e;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return O.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return O.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return O.SigningKey}});var j=Se;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return j.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return j.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return j.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return j._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return j.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return j.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return j.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return j.Utf8ErrorFuncs}});var _=X;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var S=Ee;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return S.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return S.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return S.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return S.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return S.parseUnits}});var E=ke;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return E.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return E.verifyTypedData}});var k=Te;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return k._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return k.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return k.poll}});var T=Pe;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return T.SupportedAlgorithm}});var U=Se;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return U.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return U.Utf8ErrorReason}})}(he);var Ne="wallet.unipass.id",De={upDomain:Ne,upConnectUrl:"https://"+Ne+"/connect",upLogoutUrl:"https://"+Ne+"/logout",upSignMessageUrl:"https://"+Ne+"/sign-message",upTransactionUrl:"https://"+Ne+"/send-transaction",upLoadingUrl:"https://"+Ne+"/connect/loading"},Ie=function(){return De},Re={protocol:"https",domain:"testnet.wallet.unipass.id"},Me={protocol:"https",domain:"wallet.unipass.id"},Fe={mainnet:{eth:"https://node.wallet.unipass.id/eth-mainnet",polygon:"https://node.wallet.unipass.id/polygon-mainnet",bsc:"https://node.wallet.unipass.id/bsc-mainnet",rangers:"https://node.wallet.unipass.id/rangers-mainnet",scroll:"https://node.wallet.unipass.id/scroll-mainnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-mainnet",avalanche:"https://node.wallet.unipass.id/avalanche-mainnet",kcc:"https://node.wallet.unipass.id/kcc-mainnet",platon:"https://node.wallet.unipass.id/platon-mainnet",okc:"https://node.wallet.unipass.id/okc-mainnet"},testnet:{eth:"https://node.wallet.unipass.id/eth-goerli",polygon:"https://node.wallet.unipass.id/polygon-mumbai",bsc:"https://node.wallet.unipass.id/bsc-testnet",rangers:"https://node.wallet.unipass.id/rangers-robin",scroll:"https://node.wallet.unipass.id/scroll-testnet",arbitrum:"https://node.wallet.unipass.id/arbitrum-testnet",avalanche:"https://node.wallet.unipass.id/avalanche-testnet",kcc:"https://node.wallet.unipass.id/kcc-testnet",platon:"https://node.wallet.unipass.id/platon-testnet",okc:"https://node.wallet.unipass.id/okc-testnet"}},ze=function(e){var t;t="localStorage"===e?window.localStorage||localStorage:window.sessionStorage||sessionStorage;return{get:function(e){return t.getItem(e)||""},set:function(e,n){return t.setItem(e,n||"")},remove:function(e){return t.removeItem(e)}}},Be=function(){var e=Ae(Ue().mark((function e(t,n){var r,o;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(t.storageType).get(nt),e.t0=r&&JSON.parse(r),e.t0){e.next=6;break}return e.next=5,Ge(t,n);case 5:e.t0=e.sent;case 6:return o=e.t0,e.abrupt("return",o);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),We=function(){var e=Ae(Ue().mark((function e(t){var n;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return n=new le("UP_LOGOUT"),e.next=4,rt(n);case 4:ze("localStorage").remove(nt),ze("sessionStorage").remove(nt);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ge=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?JSON.stringify(n):"",o=new le("UP_LOGIN",r,t.appSettings),e.next=5,rt(o,null==n?void 0:n.connectType,null==n?void 0:n.forceLogin,null==n?void 0:n.eventListener);case 5:return(i=e.sent)&&i.address&&ze(t.storageType).set(nt,JSON.stringify(i)),e.abrupt("return",i);case 10:throw e.prev=10,e.t0=e.catch(0),new Error("Account Not Available");case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n){return e.apply(this,arguments)}}(),Je="UP_WALLET_POP",Ve=null,He=null;function Ke(e,t,n){var r="innerWidth=462,width=462,innerHeight=810,height=810,top="+.5*(n.screen.availHeight-30-810)+",left="+.8*(n.screen.availWidth-10-462)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";return n.open(e,t,r)}function Ze(e,t,n){return $e.apply(this,arguments)}function $e(){return($e=Ae(Ue().mark((function e(t,n,r){var o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==Ve||null!=(o=Ve)&&o.closed)){e.next=8;break}if(null!=(Ve=Ke(t,Je,window))){e.next=6;break}return e.next=5,qe(t,n,r);case 5:return e.abrupt("return",e.sent);case 6:e.next=9;break;case 8:He!==t?(Ve.location.replace(t),Ve.focus()):Ve.focus();case 9:return i=setInterval((function(){if(Ve&&Ve.closed){var e={data:new le("UP_RESPONSE",JSON.stringify(new pe("DECLINE","user reject connection")))};n(e,{close:function(){},send:function(){}}),clearInterval(i)}}),1e3),a=function(){Ve&&!Ve.closed&&Ve.close(),Ve=null},e.abrupt("return",{popup:Ve,unmount:a});case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e,t,n){return Ye.apply(this,arguments)}function Ye(){return(Ye=Ae(Ue().mark((function e(t,n,r){var o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=document.createElement("div"),'\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',o.innerHTML='\n <div\n class="up_notification"\n style="\n position: fixed;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n top: 26px;\n right: 26px;\n width: 340px;\n height: 96px;\n z-index: 100001;\n background-color: #362866;\n box-sizing: border-box;\n border: 2px solid #ffffff;\n border-radius: 8px;\n padding: 16px 20px;\n "\n>\n <div class="up_notification_left" style="color: white">\n <div\n class="up_notification_title"\n style="\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n "\n >\n Request Pop-up\n </div>\n <div\n class="up_notification_tip"\n style="\n font-weight: 450;\n font-size: 12px;\n line-height: 20px;\n color: rgba(255, 255, 255, 0.8);\n "\n >\n Click Approve to complete creating or using wallet\n </div>\n </div>\n <div\n class="up_notification_right"\n style="\n width: 90px;\n height: 35px;\n font-size: 12px;\n text-align: center;\n background: linear-gradient(270deg, #997afb 0%, #7a55f8 63.6%);\n border-radius: 6px;\n line-height: 35px;\n color: white;\n margin-left: 20px;\n cursor: pointer;\n "\n >\n Approve\n </div>\n</div>\n ',document.body.appendChild(o),i=document.querySelector(".up_notification_right"),e.abrupt("return",new Promise((function(e){null==i||i.addEventListener("click",(function(){document.body.removeChild(o),e(Ze(t,n,r))}),!1)})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Qe=function(){};function Xe(e,t,n){if("UP_LOGIN"===e)return"google"===t?Ie().upConnectUrl+"?connectType=google&forceLogin="+(n?"1":"0"):"email"===t?Ie().upConnectUrl+"?connectType=email&forceLogin="+(n?"1":"0"):Ie().upConnectUrl+"?forceLogin="+(n?"1":"0");if("UP_LOGOUT"===e)return Ie().upLogoutUrl;if("UP_SIGN_MESSAGE"===e)return Ie().upSignMessageUrl;if("UP_TRANSACTION"===e)return Ie().upTransactionUrl;if("UP_READY"===e)return Ie().upLoadingUrl;throw new Error("unsupport type "+e)}function et(e,t,n,r){return tt.apply(this,arguments)}function tt(){return tt=Ae(Ue().mark((function e(t,n,r,o){var i,a,s,c,u,p,l,f,d,h;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h=function(e){try{null==p||p.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}},d=function(){try{window.removeEventListener("message",f),l(),i()}catch(e){console.error("Popup Close Error",e)}},f=function(e){try{if("object"!=typeof e.data)return;var t=e.data;if(!t||!t.type)return;"UP_CLOSE"===e.data.type&&d(),"UP_READY"===t.type&&s(e,{send:h,close:d}),"UP_RESPONSE"===t.type&&c(e,{send:h,close:d}),"UP_EVENT"===t.type&&a(e,{send:h,close:d})}catch(e){console.error("Popup Callback Error",e),d()}},null!=t){e.next=5;break}return e.abrupt("return",{send:Qe,close:Qe});case 5:return i=(null==o?void 0:o.onClose)||Qe,a=(null==o?void 0:o.onMessage)||Qe,s=(null==o?void 0:o.onReady)||Qe,c=(null==o?void 0:o.onResponse)||Qe,window.addEventListener("message",f),e.next=12,Ze(Xe(t.type,n,r),c,t.appSetting);case 12:return u=e.sent,p=u.popup,l=u.unmount,e.abrupt("return",{send:h,close:d});case 16:case"end":return e.stop()}}),e)}))),tt.apply(this,arguments)}var nt="UP-A";function rt(e,t,n,r){return new Promise(function(){var o=Ae(Ue().mark((function o(i,a){return Ue().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,et(e,t,n,{onReady:function(t,n){return Ae(Ue().mark((function t(){var r;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.send,t.prev=1,r(e),t.next=8;break;case 5:throw t.prev=5,t.t0=t.catch(1),t.t0;case 8:case"end":return t.stop()}}),t,null,[[1,5]])})))()},onResponse:function(t,n){return Ae(Ue().mark((function r(){var o,s,c;return Ue().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=n.close,r.prev=1,"object"==typeof t.data){r.next=4;break}return r.abrupt("return");case 4:s=t.data,c=JSON.parse(s.payload),r.t0=c.type,r.next="APPROVE"===r.t0?9:"DECLINE"===r.t0?12:27;break;case 9:return i(c.data),o(),r.abrupt("break",30);case 12:if("expired"!==c.data){r.next=24;break}if("UP_LOGIN"!==e.type){r.next=15;break}return r.abrupt("return");case 15:if("UP_LOGOUT"!==e.type){r.next=19;break}return i(c.data),o(),r.abrupt("return");case 19:if("UP_TRANSACTION"!==e.type&&"UP_SIGN_MESSAGE"!==e.type){r.next=24;break}return We(!1),a("can not authorize without login"),o(),r.abrupt("break",30);case 24:return a("Declined: "+(c.data||"No reason supplied")),o(),r.abrupt("break",30);case 27:return a("Declined: No reason supplied"),o(),r.abrupt("break",30);case 30:r.next=35;break;case 32:throw r.prev=32,r.t1=r.catch(1),r.t1;case 35:case"end":return r.stop()}}),r,null,[[1,32]])})))()},onMessage:function(e,t){return Ae(Ue().mark((function t(){var n,o;return Ue().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}return t.abrupt("return");case 2:if(t.prev=2,"object"==typeof e.data){t.next=5;break}return t.abrupt("return");case 5:n=e.data,o=JSON.parse(n.payload),r(o),t.next=13;break;case 10:throw t.prev=10,t.t0=t.catch(2),t.t0;case 13:case"end":return t.stop()}}),t,null,[[2,10]])})))()},onClose:function(){return Ae(Ue().mark((function e(){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a("Declined: Externally Halted");case 1:case"end":return e.stop()}}),e)})))()}});case 2:case"end":return o.stop()}}),o)})));return function(e,t){return o.apply(this,arguments)}}())}var ot=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(n.storageType).get(nt),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new le("UP_SIGN_MESSAGE",JSON.stringify(t),null==n?void 0:n.appSettings),e.prev=5,e.next=8,rt(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),it=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=ze(n.storageType).get(nt),(o=r&&JSON.parse(r))&&t.from&&o.address.toLowerCase()===t.from.toLowerCase()){e.next=4;break}throw new Error("can not authorize without login");case 4:return i=new le("UP_TRANSACTION",JSON.stringify(t),n.appSettings),e.prev=5,e.next=8,rt(i);case 8:return a=e.sent,e.abrupt("return",a);case 12:throw e.prev=12,e.t0=e.catch(5),new Error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(t,n){return e.apply(this,arguments)}}(),at="0x1626ba7e";var st=function(){function e(e){this.initConfig(e)}var t=e.prototype;return t.initConfig=function(e){this._config={env:"prod",nodeRPC:"",chainType:"polygon",storageType:"sessionStorage"},this._config.env=e.env||"prod",this._config.chainType=e.chainType||"polygon";var t,n,r=(t=this._config.env,n=this._config.chainType,{env:t,nodeRPC:"prod"===t?Fe.mainnet[n]:Fe.testnet[n],chainType:n,walletUrl:"prod"===t?Me:Re});this._config.nodeRPC=e.nodeRPC||r.nodeRPC,this._config.appSettings=function(e,t){return Ce({},t||{},{chain:(null==t?void 0:t.chain)||e,appName:(null==t?void 0:t.appName)||"MyDemo"})}(this._config.chainType,e.appSettings),this._provider=new l(this._config.nodeRPC),this._auth_provider=new l(function(e){return"prod"===e?Fe.mainnet.polygon:Fe.testnet.polygon}(this._config.env));var o,i,a,s=e.walletUrl||r.walletUrl;s&&(i=(o=s).domain,a=o.protocol,De={upDomain:i=i||Ne,upConnectUrl:(a=a||"https")+"://"+i+"/connect",upLogoutUrl:a+"://"+i+"/logout",upSignMessageUrl:a+"://"+i+"/sign-message",upTransactionUrl:a+"://"+i+"/send-transaction",upLoadingUrl:a+"://"+i+"/connect/loading"}),this._config.storageType=e.storageType||"sessionStorage"},t.updateConfig=function(e){this._config&&(e.chainType&&(this._config.chainType=e.chainType),e.nodeRPC&&(this._config.nodeRPC=e.nodeRPC,this._provider=new l(this._config.nodeRPC)),e.appSettings&&(this._config.appSettings=e.appSettings))},t.login=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Be(this._config,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getAccount=function(){var e,t;return e=this._config.storageType,(t=ze(e).get(nt))?JSON.parse(t):void 0},t.logout=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=!1),e.next=3,We(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.getProvider=function(){return this._provider},t.getAuthProvider=function(){return this._auth_provider},t.isLogin=function(){return!!this.getAccount()},t.assertLogin=function(){if(!this.isLogin())throw new Error("user is not login")},t.getAddress=function(){return this.assertLogin(),this.getAccount().address},t.sendTransaction=function(){var e=Ae(Ue().mark((function e(t){return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),e.next=3,it(t,this._config);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.signMessage=function(){var e=Ae(Ue().mark((function e(t,n){var r,o,i,a,s;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertLogin(),o=(r=n||{}).isEIP191Prefix,i=void 0!==o&&o,a=r.onAuthChain,s=void 0===a||a,"string"==typeof t&&(t=he.toUtf8Bytes(t)),e.next=5,ot(new ue(this.getAddress(),he.hexlify(t),"V1",i,s),this._config);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidSignature=function(){var e=Ae(Ue().mark((function e(t,n,r){var o,i;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r||(this.assertLogin(),r=this.getAddress()),o=new ee(r,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),e.next=4,o.isValidSignature(("string"==typeof(a=t)&&(a=he.toUtf8Bytes(a)),he.keccak256(he.concat([he.toUtf8Bytes("UniPass Signed Message:\n"),he.toUtf8Bytes(String(a.length)),a]))),n);case 4:return i=e.sent,e.abrupt("return",i===at);case 6:case"end":return e.stop()}var a}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),t.signTypedData=function(){var e=Ae(Ue().mark((function e(t,n){var r,o;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.assertLogin(),null!=t){e.next=3;break}throw new Error("Missing data parameter");case 3:return r=(n||{}).onAuthChain,o=void 0===r||r,e.next=6,ot(new ue(this.getAddress(),JSON.stringify(t),"V4",!1,o),this._config);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),t.isValidTypedSignature=function(){var e=Ae(Ue().mark((function e(t,n,r){var o,i,a;return Ue().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t){e.next=2;break}throw new Error("Missing data parameter");case 2:return n||(this.assertLogin(),n=this.getAddress()),o=new ee(n,[{inputs:[{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"magicValue",type:"bytes4"}],stateMutability:"view",type:"function"}],this._auth_provider),i=de(t),e.next=7,o.isValidSignature(i,r);case 7:return a=e.sent,e.abrupt("return",a===at);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}();function ct(t){var n,r,s;return e(this,void 0,void 0,(function*(){const c=t.JsonRpcProvider||te,p=null!==(n=t.chainId)&&void 0!==n?n:1;let l=null!==(r=t.rpcUrl)&&void 0!==r?r:null===(s=t.rpc)||void 0===s?void 0:s[p];const f=new class extends c{constructor(e,n){super(e,n),this.updateUpWalletConfig=e=>{var n;const r=null===(n=t.rpc)||void 0===n?void 0:n[e];if(!o.includes(e))throw new Error(`chainId ${e} not supported`);if(this.upWallet.updateConfig({chainType:i(e),nodeRPC:r,appSettings:{chain:i(e)}}),"object"==typeof this.network)this.network.chainId=e;else{const t={chainId:e,name:"unknown"};Y(this,"_network",t),this.emit("network",t,null)}return this.rpcUrl=r,this.emit("chainChanged",`0x${e.toString(16)}`),{result:!0}},this.rpcUrl=e,this.upWallet=new st({env:a(p),chainType:i(p),appSettings:{appIcon:t.appLogoUrl,appName:t.appName,chain:i(p)},rpcUrl:l,storageType:"sessionStorage"})}getSigner(){var e;const t=this.upWallet.getAccount();return new se(f,this.upWallet,null!==(e=null==t?void 0:t.address)&&void 0!==e?e:"",0)}connect(){return e(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return e||(yield this.upWallet.login({email:false}))}))}disconnect(){return e(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return e(this,void 0,void 0,(function*(){const e=this.upWallet.getAccount();return(null==e?void 0:e.address)?[null==e?void 0:e.address]:[]}))}getAddress(){const e=this.upWallet.getAccount();return Promise.resolve((null==e?void 0:e.address)?u(null==e?void 0:e.address):null)}}(l,p);return f}))}function ut(t,n){return e(this,void 0,void 0,(function*(){const e=yield ct(t);return e.on("connect",n.connect),e.on("disconnect",(e=>{n.disconnect(e),n.accountsChanged([])})),e.on("accountsChanged",n.accountsChanged),e.on("chainChanged",n.chainChanged),e.on("message",(({type:e,data:t})=>n.message(e,t))),yield e.connect(),e}))}function pt(){var e;null===(e=s.getState().provider)||void 0===e||e.disconnect()}function lt(e){var t,n;return null===(n=null===(t=s.getState().provider)||void 0===t?void 0:t.upWallet)||void 0===n?void 0:n.signTypedData(e)}function ft(e){var t;const n=e.addChainParameters.chainId,r="string"==typeof n&&(null==n?void 0:n.startsWith("0x"))?parseInt(n,16):Number(n);if(!o.includes(r))throw new Error(`chainId ${r} not supported`);return null===(t=s.getState().provider)||void 0===t?void 0:t.updateUpWalletConfig(r)}export{ct as createProvider,ut as default,pt as disconnectWallet,lt as signTypedData,ft as switchChain};
@@ -1 +0,0 @@
1
- import{c as e,g as t,b as s,_ as a,d as r,u as n}from"./index-948c094e.js";import{b as i}from"./browser-ponyfill-65b68016.js";import{e as o,W as d,F as c,l as u,u as l,w as h,v as f,a as g}from"./ethers-b291db18.js";import{Signer as p,VoidSigner as _}from"@ethersproject/abstract-signer";import*as E from"@ethersproject/providers";import{getDefaultProvider as m}from"@ethersproject/providers";import{BaseContract as v,Contract as T,ContractFactory as y}from"@ethersproject/contracts";import{B as w,E as S}from"./id-4e950ad4.js";import*as I from"@ethersproject/constants";import b from"events";import"zustand";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"@ethersproject/abstract-provider";import"./index-27d4b342.js";import"./__node-resolve_empty-0ed2c058.js";import"./hash-b468659c.js";import"./inherits_browser-51bb8c3c.js";import"@ethersproject/json-wallets";import"./interface-cb5e1e98.js";import"./index-1aa609d8.js";var A={},P={},M={},O={},C={},R={name:"@safe-global/safe-apps-sdk",version:"7.10.1",description:"SDK developed to integrate third-party apps with Safe app.",main:"dist/src/index.js",typings:"dist/src/index.d.ts",_files:["dist/**/*","src/**/*","CHANGELOG.md","README.md"],keywords:["Safe","sdk","apps"],scripts:{test:"jest","format-dist":"sed -i '' 's/\"files\":/\"_files\":/' dist/package.json",build:"yarn rimraf dist && tsc && yarn format-dist"},author:"Safe (https://safe.global)",license:"MIT",dependencies:{"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",ethers:"^5.7.2"},devDependencies:{rimraf:"^3.0.2"},repository:{type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},bugs:{url:"https://github.com/safe-global/safe-apps-sdk/issues"},homepage:"https://github.com/safe-global/safe-apps-sdk#readme",publishConfig:{access:"public"}},N=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0}),C.getSDKVersion=void 0;const L=N(R);C.getSDKVersion=()=>L.default.version.split("-")[0];var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.generateRequestId=void 0;const j=e=>e.toString(16).padStart(2,"0");D.generateRequestId=()=>"undefined"!=typeof window?(e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,j).join("")})(10):(new Date).getTime().toString(36),Object.defineProperty(O,"__esModule",{value:!0}),O.MessageFormatter=void 0;const x=C,H=D;class B{}O.MessageFormatter=B,B.makeRequest=(e,t)=>({id:(0,H.generateRequestId)(),method:e,params:t,env:{sdkVersion:(0,x.getSDKVersion)()}}),B.makeResponse=(e,t,s)=>({id:e,success:!0,version:s,data:t}),B.makeErrorResponse=(e,t,s)=>({id:e,success:!1,error:t,version:s});var k,q,U={};k=U,Object.defineProperty(k,"__esModule",{value:!0}),k.RestrictedMethods=k.Methods=void 0,(q=k.Methods||(k.Methods={})).sendTransactions="sendTransactions",q.rpcCall="rpcCall",q.getChainInfo="getChainInfo",q.getSafeInfo="getSafeInfo",q.getTxBySafeTxHash="getTxBySafeTxHash",q.getSafeBalances="getSafeBalances",q.signMessage="signMessage",q.signTypedMessage="signTypedMessage",q.getEnvironmentInfo="getEnvironmentInfo",q.getOffChainSignature="getOffChainSignature",q.requestAddressBook="requestAddressBook",q.wallet_getPermissions="wallet_getPermissions",q.wallet_requestPermissions="wallet_requestPermissions",(k.RestrictedMethods||(k.RestrictedMethods={})).requestAddressBook="requestAddressBook",function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0});const r=O;t.default=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="undefined"==typeof window,this.isValidMessage=({origin:e,data:t,source:s})=>{const a=!t,r=!this.isServer&&s===window.parent,n=(void 0!==t.version&&parseInt(t.version.split(".")[0]))>=1;let i=!0;return Array.isArray(this.allowedOrigins)&&(i=void 0!==this.allowedOrigins.find((t=>t.test(e)))),!a&&r&&n&&i},this.logIncomingMessage=e=>{console.info(`Safe Apps SDK v1: A message was received from origin ${e.origin}. `,e.data)},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{const{id:t}=e,s=this.callbacks.get(t);s&&(s(e),this.callbacks.delete(t))},this.send=(e,t)=>{const s=r.MessageFormatter.makeRequest(e,t);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise(((e,t)=>{this.callbacks.set(s.id,(s=>{s.success?e(s):t(new Error(s.error))}))}))},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}},a(U,t)}(M);var G={},$={},F={};Object.defineProperty(F,"__esModule",{value:!0}),F.isObjectEIP712TypedData=void 0;F.isObjectEIP712TypedData=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;var V={};Object.defineProperty(V,"__esModule",{value:!0});var W={},K={},Q={},X={},Y=e&&e.__awaiter||function(e,t,s,a){return new(s||(s=Promise))((function(r,n){function i(e){try{d(a.next(e))}catch(e){n(e)}}function o(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(i,o)}d((a=a.apply(e,t||[])).next())}))},J=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.fetchData=X.stringifyQuery=X.insertParams=void 0;const z=J(i.exports);X.insertParams=function(e,t){return t?Object.keys(t).reduce(((e,s)=>function(e,t,s){return e.replace(new RegExp(`\\{${t}\\}`,"g"),s)}(e,s,String(t[s]))),e):e},X.stringifyQuery=function(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach((s=>{null!=e[s]&&t.append(s,String(e[s]))}));const s=t.toString();return s?`?${s}`:""},X.fetchData=function(e,t){return Y(this,void 0,void 0,(function*(){let s;null!=t&&(s={method:"POST",body:"string"==typeof t?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}});const a=yield(0,z.default)(e,s);let r;try{r=yield a.json()}catch(e){if(a.headers&&"0"!==a.headers.get("content-length"))throw new Error(`Invalid response content: ${a.statusText}`)}if(!a.ok){const e="object"==typeof(n=r)&&null!==n&&"code"in n&&"message"in n?`${r.code}: ${r.message}`:a.statusText;throw new Error(e)}var n;return r}))},Object.defineProperty(Q,"__esModule",{value:!0}),Q.getEndpoint=Q.postEndpoint=void 0;const Z=X;function ee(e,t,s,a){return`${e}${(0,Z.insertParams)(t,s)}${(0,Z.stringifyQuery)(a)}`}Q.postEndpoint=function(e,t,s){const a=ee(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,Z.fetchData)(a,null==s?void 0:s.body)},Q.getEndpoint=function(e,t,s,a){if(a)return(0,Z.fetchData)(a);const r=ee(e,t,null==s?void 0:s.path,null==s?void 0:s.query);return(0,Z.fetchData)(r)};var te={};Object.defineProperty(te,"__esModule",{value:!0}),te.DEFAULT_BASE_URL=void 0,te.DEFAULT_BASE_URL="https://safe-client.safe.global";var se={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,(t=e.ImplementationVersionState||(e.ImplementationVersionState={})).UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(se);var ae={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,(t=e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})).NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST",(e.SafeAppFeatures||(e.SafeAppFeatures={})).BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS",(s=e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={})).TWITTER="TWITTER",s.GITHUB="GITHUB",s.DISCORD="DISCORD"}(ae);var re={};!function(e){var t,s,a,r,n,i,o,d,c,u;Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,(t=e.Operation||(e.Operation={}))[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE",(s=e.TransactionStatus||(e.TransactionStatus={})).AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",s.AWAITING_EXECUTION="AWAITING_EXECUTION",s.CANCELLED="CANCELLED",s.FAILED="FAILED",s.SUCCESS="SUCCESS",(a=e.TransferDirection||(e.TransferDirection={})).INCOMING="INCOMING",a.OUTGOING="OUTGOING",a.UNKNOWN="UNKNOWN",(r=e.TransactionTokenType||(e.TransactionTokenType={})).ERC20="ERC20",r.ERC721="ERC721",r.NATIVE_COIN="NATIVE_COIN",(n=e.SettingsInfoType||(e.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD",(i=e.TransactionInfoType||(e.TransactionInfoType={})).TRANSFER="Transfer",i.SETTINGS_CHANGE="SettingsChange",i.CUSTOM="Custom",i.CREATION="Creation",(o=e.ConflictType||(e.ConflictType={})).NONE="None",o.HAS_NEXT="HasNext",o.END="End",(d=e.TransactionListItemType||(e.TransactionListItemType={})).TRANSACTION="TRANSACTION",d.LABEL="LABEL",d.CONFLICT_HEADER="CONFLICT_HEADER",d.DATE_LABEL="DATE_LABEL",(c=e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",c.MODULE="MODULE",(u=e.LabelValue||(e.LabelValue={})).Queued="Queued",u.Next="Next"}(re);var ne={};!function(e){var t,s,a;Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,(t=e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})).API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN",(s=e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})).ORACLE="ORACLE",s.FIXED="FIXED",s.UNKNOWN="UNKNOWN",(a=e.FEATURES||(e.FEATURES={})).ERC721="ERC721",a.SAFE_APPS="SAFE_APPS",a.CONTRACT_INTERACTION="CONTRACT_INTERACTION",a.DOMAIN_LOOKUP="DOMAIN_LOOKUP",a.SPENDING_LIMIT="SPENDING_LIMIT",a.EIP1559="EIP1559",a.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",a.TX_SIMULATION="TX_SIMULATION",a.EIP1271="EIP1271"}(ne);var ie={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,(t=e.TokenType||(e.TokenType={})).ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(ie);var oe={};Object.defineProperty(oe,"__esModule",{value:!0});var de={};Object.defineProperty(de,"__esModule",{value:!0});var ce={};!function(e){var t,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,(t=e.SafeMessageListItemType||(e.SafeMessageListItemType={})).DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE",(s=e.SafeMessageStatus||(e.SafeMessageStatus={})).NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",s.CONFIRMED="CONFIRMED"}(ce),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),t.confirmSafeMessage=t.proposeSafeMessage=t.getSafeMessage=t.getSafeMessages=t.getDecodedData=t.getMasterCopies=t.getSafeApps=t.getChainConfig=t.getChainsConfig=t.proposeTransaction=t.postSafeGasEstimation=t.getTransactionDetails=t.getTransactionQueue=t.getTransactionHistory=t.getCollectiblesPage=t.getCollectibles=t.getOwnedSafes=t.getFiatCurrencies=t.getBalances=t.getMultisigTransactions=t.getModuleTransactions=t.getIncomingTransfers=t.getSafeInfo=t.setBaseUrl=void 0;const r=Q,n=te;a(se,t),a(ae,t),a(re,t),a(ne,t),a(ie,t),a(oe,t),a(de,t),a(ce,t);let i=n.DEFAULT_BASE_URL;t.setBaseUrl=e=>{i=e},t.getSafeInfo=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},t.getIncomingTransfers=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:e,address:t},query:s},a)},t.getModuleTransactions=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getMultisigTransactions=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:e,address:t},query:s},a)},t.getBalances=function(e,t,s="usd",a={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:s},query:a})},t.getFiatCurrencies=function(){return(0,r.getEndpoint)(i,"/v1/balances/supported-fiat-codes")},t.getOwnedSafes=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},t.getCollectibles=function(e,t,s={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s})},t.getCollectiblesPage=function(e,t,s={},a){return(0,r.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:s},a)},t.getTransactionHistory=function(e,t,s){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:{}},s)},t.getTransactionQueue=function(e,t,s,a){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:{trusted:a}},s)},t.getTransactionDetails=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},t.postSafeGasEstimation=function(e,t,s){return(0,r.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:s})},t.proposeTransaction=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:s})},t.getChainsConfig=function(e){return(0,r.getEndpoint)(i,"/v1/chains",{query:e})},t.getChainConfig=function(e){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:e}})},t.getSafeApps=function(e,t={}){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},t.getMasterCopies=function(e){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},t.getDecodedData=function(e,t){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t}})},t.getSafeMessages=function(e,t,s){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},s)},t.getSafeMessage=function(e,t){return(0,r.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},t.proposeSafeMessage=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},body:s})},t.confirmSafeMessage=function(e,t,s){return(0,r.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:s})}}(K),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransferDirection=e.TransactionStatus=e.TokenType=e.Operation=void 0;var t=K;Object.defineProperty(e,"Operation",{enumerable:!0,get:function(){return t.Operation}}),Object.defineProperty(e,"TokenType",{enumerable:!0,get:function(){return t.TokenType}}),Object.defineProperty(e,"TransactionStatus",{enumerable:!0,get:function(){return t.TransactionStatus}}),Object.defineProperty(e,"TransferDirection",{enumerable:!0,get:function(){return t.TransferDirection}})}(W);var ue={};Object.defineProperty(ue,"__esModule",{value:!0}),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(t,"__esModule",{value:!0}),a(F,t),a(V,t),a(W,t),a(ue,t)}($),Object.defineProperty(G,"__esModule",{value:!0}),G.TXs=void 0;const le=U,he=$;G.TXs=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(le.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(le.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,he.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(le.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const s={txs:e,params:t};return(await this.communicator.send(le.Methods.sendTransactions,s)).data}};var fe={},ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.RPC_CALLS=void 0,ge.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},Object.defineProperty(fe,"__esModule",{value:!0}),fe.Eth=void 0;const pe=ge,_e=U,Ee={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};fe.Eth=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:pe.RPC_CALLS.eth_call,formatters:[null,Ee.defaultBlockParam]}),this.getBalance=this.buildRequest({call:pe.RPC_CALLS.eth_getBalance,formatters:[null,Ee.defaultBlockParam]}),this.getCode=this.buildRequest({call:pe.RPC_CALLS.eth_getCode,formatters:[null,Ee.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:pe.RPC_CALLS.eth_getStorageAt,formatters:[null,Ee.blockNumberToHex,Ee.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:pe.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:pe.RPC_CALLS.eth_getBlockByHash,formatters:[null,Ee.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:pe.RPC_CALLS.eth_getBlockByNumber,formatters:[Ee.blockNumberToHex,Ee.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:pe.RPC_CALLS.eth_getTransactionCount,formatters:[null,Ee.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:pe.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:pe.RPC_CALLS.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:pe.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:s}=e;return async e=>{s&&Array.isArray(e)&&s.forEach(((t,s)=>{t&&(e[s]=t(e[s]))}));const a={call:t,params:e||[]};return(await this.communicator.send(_e.Methods.rpcCall,a)).data}}};var me={};try{const e=window;null==e._ethers&&(e._ethers=o)}catch(e){}var ve=t(Object.freeze({__proto__:null,ethers:o,Signer:p,Wallet:d,VoidSigner:_,getDefaultProvider:m,providers:E,BaseContract:v,Contract:T,ContractFactory:y,BigNumber:w,FixedNumber:c,constants:I,get errors(){return S},logger:u,utils:l,wordlists:h,version:f,Wordlist:g})),Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.MAGIC_VALUE_BYTES=Te.MAGIC_VALUE=Te.EIP_1271_BYTES_INTERFACE=Te.EIP_1271_INTERFACE=void 0;const ye=ve;Te.MAGIC_VALUE="0x1626ba7e";Te.MAGIC_VALUE_BYTES="0x20c13b0b";const we=new ye.ethers.utils.Interface(["function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view"]);Te.EIP_1271_INTERFACE=we;const Se=new ye.ethers.utils.Interface(["function isValidSignature(bytes calldata _data, bytes calldata _signature) public view"]);Te.EIP_1271_BYTES_INTERFACE=Se;var Ie={},be={},Ae={};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.PermissionsError=Ae.PERMISSIONS_REQUEST_REJECTED=void 0,Ae.PERMISSIONS_REQUEST_REJECTED=4001;class Pe extends Error{constructor(e,t,s){super(e),this.code=t,this.data=s,Object.setPrototypeOf(this,Pe.prototype)}}Ae.PermissionsError=Pe,Object.defineProperty(be,"__esModule",{value:!0}),be.Wallet=void 0;const Me=U,Oe=Ae;be.Wallet=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(Me.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new Oe.PermissionsError("Permissions request is invalid",Oe.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(Me.Methods.wallet_requestPermissions,e)).data}catch(e){throw new Oe.PermissionsError("Permissions rejected",Oe.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every((e=>"object"==typeof e&&Object.keys(e).every((e=>!!Object.values(Me.RestrictedMethods).includes(e)))))}},Object.defineProperty(Ie,"__esModule",{value:!0});const Ce=be,Re=Ae,Ne=(e,t)=>t.some((t=>t.parentCapability===e));Ie.default=()=>(e,t,s)=>{const a=s.value;return s.value=async function(){const e=new Ce.Wallet(this.communicator);let s=await e.getPermissions();if(Ne(t,s)||(s=await e.requestPermissions([{[t]:{}}])),!Ne(t,s))throw new Re.PermissionsError("Permissions rejected",Re.PERMISSIONS_REQUEST_REJECTED);return a.apply(this)},s};var Le=e&&e.__decorate||function(e,t,s,a){var r,n=arguments.length,i=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,s,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(i=(n<3?r(i):n>3?r(t,s,i):r(t,s))||i);return n>3&&i&&Object.defineProperty(t,s,i),i},De=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(me,"__esModule",{value:!0}),me.Safe=void 0;const je=ve,xe=Te,He=U,Be=ge,ke=$,qe=De(Ie);class Ue{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(He.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(He.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(He.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const s=await this.getInfo(),a=xe.EIP_1271_INTERFACE.encodeFunctionData("isValidSignature",[e,t]),r={call:Be.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:a},"latest"]};try{return(await this.communicator.send(He.Methods.rpcCall,r)).data.slice(0,10).toLowerCase()===xe.MAGIC_VALUE}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){const s=await this.getInfo(),a=je.ethers.utils.arrayify(e),r=xe.EIP_1271_BYTES_INTERFACE.encodeFunctionData("isValidSignature",[a,t]),n={call:Be.RPC_CALLS.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(He.Methods.rpcCall,n)).data.slice(0,10).toLowerCase()===xe.MAGIC_VALUE_BYTES}catch(e){return!1}}calculateMessageHash(e){return je.ethers.utils.hashMessage(e)}calculateTypedMessageHash(e){return je.ethers.utils._TypedDataEncoder.hash(e.domain,e.types,e.message)}async getOffChainSignature(e){return(await this.communicator.send(He.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let s;if("string"==typeof e&&(s=async()=>{const s=this.calculateMessageHash(e);return await this.isMessageHashSigned(s,t)}),(0,ke.isObjectEIP712TypedData)(e)&&(s=async()=>{const s=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(s,t)}),s){return await s()}throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const a of s){if(await a(e,t))return!0}return!1}async getEnvironmentInfo(){return(await this.communicator.send(He.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(He.Methods.requestAddressBook,void 0)).data}}Le([(0,qe.default)()],Ue.prototype,"requestAddressBook",null),me.Safe=Ue;var Ge=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(P,"__esModule",{value:!0});const $e=Ge(M),Fe=G,Ve=fe,We=me,Ke=be;P.default=class{constructor(e={}){const{allowedDomains:t=null,debug:s=!1}=e;this.communicator=new $e.default(t,s),this.eth=new Ve.Eth(this.communicator),this.txs=new Fe.TXs(this.communicator),this.safe=new We.Safe(this.communicator),this.wallet=new Ke.Wallet(this.communicator)}},function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getSDKVersion=void 0;const n=r(P);t.default=n.default,a(P,t),a($,t),a(U,t),a(O,t);var i=C;Object.defineProperty(t,"getSDKVersion",{enumerable:!0,get:function(){return i.getSDKVersion}})}(A);var Qe=s(A),Xe={},Ye={},Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.getLowerCase=void 0,Je.getLowerCase=function(e){return e?e.toLowerCase():e},Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.SafeAppProvider=void 0;const ze=b,Ze=Je;class et extends ze.EventEmitter{constructor(e,t){super(),this.submittedTxs=new Map,this.safe=e,this.sdk=t}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(e){const{method:t,params:s=[]}=e;switch(t){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(e),"0x"}case"eth_sign":{const[e,t]=s;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(t),"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[e,t]=s,a="string"==typeof t?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase())throw new Error("The address is invalid");return await this.sdk.txs.signTypedMessage(a),"0x"}case"eth_sendTransaction":const t=Object.assign({value:"0",data:"0x"},s[0]);"string"==typeof t.gas&&t.gas.startsWith("0x")&&(t.gas=parseInt(t.gas,16));const a=await this.sdk.txs.send({txs:[t],params:{safeTxGas:t.gas}});return this.submittedTxs.set(a.safeTxHash,{from:this.safe.safeAddress,hash:a.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:t.data,value:t.value,to:t.to,blockHash:null,blockNumber:null,transactionIndex:null}),a.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,Ze.getLowerCase)(s[0]),s[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,Ze.getLowerCase)(s[0]),s[1],s[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([s[0],s[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([s[0],s[1]]);case"eth_getTransactionByHash":let r=s[0];try{r=(await this.sdk.txs.getBySafeTxHash(r)).txHash||r}catch(e){}return this.submittedTxs.has(r)?this.submittedTxs.get(r):this.sdk.eth.getTransactionByHash([r]).then((e=>(e&&(e.hash=s[0]),e)));case"eth_getTransactionReceipt":{let e=s[0];try{e=(await this.sdk.txs.getBySafeTxHash(e)).txHash||e}catch(e){}return this.sdk.eth.getTransactionReceipt([e]).then((e=>(e&&(e.transactionHash=s[0]),e)))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(s[0]);case"eth_call":return this.sdk.eth.call([s[0],s[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([s[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(s[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([s[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then((s=>t(null,{jsonrpc:"2.0",id:e.id,result:s}))).catch((e=>t(e,null)))}}let tt,st;function at(){return a(this,void 0,void 0,(function*(){return st||(st=new Qe),void 0===tt&&(tt=yield Promise.race([st.safe.getInfo(),new Promise((e=>setTimeout(e,200)))])),tt}))}function rt(){return a(this,void 0,void 0,(function*(){return!!(yield at())}))}function nt(e){return a(this,void 0,void 0,(function*(){const t=yield at();if(!t)throw Error("Could not load Safe information");const s=new Xe.SafeAppProvider(t,st);return s.on("connect",e.connect),s.on("disconnect",e.disconnect),s.on("accountsChanged",e.accountsChanged),s.on("chainChanged",e.chainChanged),s.on("message",e.message),r(s)}))}Ye.SafeAppProvider=et,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppProvider=void 0;var t=Ye;Object.defineProperty(e,"SafeAppProvider",{enumerable:!0,get:function(){return t.SafeAppProvider}})}(Xe);var it={},ot={},dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.getTxServiceBaseUrl=void 0,dt.getTxServiceBaseUrl=function(e){return`${e}/api`};var ct={},ut={exports:{}};!function(t,s){var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();t.exports=s=a.fetch,a.fetch&&(s.default=a.fetch.bind(a)),s.Headers=a.Headers,s.Request=a.Request,s.Response=a.Response}(ut,ut.exports),function(t){var s=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendRequest=t.HttpMethod=void 0;const a=s(ut.exports);var r;(r=t.HttpMethod||(t.HttpMethod={})).Get="get",r.Post="post",r.Delete="delete",t.sendRequest=async function({url:e,method:t,body:s}){const r=await(0,a.default)(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)});let n;try{n=await r.json()}catch(e){if(!r.ok)throw new Error(r.statusText)}if(r.ok)return n;if(n.data)throw new Error(n.data);if(n.detail)throw new Error(n.detail);if(n.message)throw new Error(n.message);if(n.nonFieldErrors)throw new Error(n.nonFieldErrors);if(n.delegate)throw new Error(n.delegate);if(n.safe)throw new Error(n.safe);if(n.delegator)throw new Error(n.delegator);throw new Error(r.statusText)}}(ct);var lt,ht,ft=e&&e.__classPrivateFieldSet||function(e,t,s,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,s):r?r.value=s:t.set(e,s),s},gt=e&&e.__classPrivateFieldGet||function(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)};Object.defineProperty(ot,"__esModule",{value:!0});const pt=dt,_t=ct;lt=new WeakMap,ht=new WeakMap,ot.default=class{constructor({txServiceUrl:e,ethAdapter:t}){lt.set(this,void 0),ht.set(this,void 0),ft(this,lt,(0,pt.getTxServiceBaseUrl)(e),"f"),ft(this,ht,t,"f")}async getServiceInfo(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/about`,method:_t.HttpMethod.Get})}async getServiceMasterCopiesInfo(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/about/master-copies`,method:_t.HttpMethod.Get})}async decodeData(e){if(""===e)throw new Error("Invalid data");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/data-decoder/`,method:_t.HttpMethod.Post,body:{data:e}})}async getSafesByOwner(e){if(""===e)throw new Error("Invalid owner address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/owners/${t}/safes/`,method:_t.HttpMethod.Get})}async getSafesByModule(e){if(""===e)throw new Error("Invalid module address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/modules/${t}/safes/`,method:_t.HttpMethod.Get})}async getTransaction(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/`,method:_t.HttpMethod.Get})}async getTransactionConfirmations(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:_t.HttpMethod.Get})}async confirmTransaction(e,t){if(""===e)throw new Error("Invalid safeTxHash");if(""===t)throw new Error("Invalid signature");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:_t.HttpMethod.Post,body:{signature:t}})}async getSafeInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/`,method:_t.HttpMethod.Get})}async getSafeDelegates({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,limit:r,offset:n}){const i=new URL(`${gt(this,lt,"f")}/v1/delegates`);if(e){const{address:t}=await gt(this,ht,"f").getEip3770Address(e);i.searchParams.set("safe",t)}if(t){const{address:e}=await gt(this,ht,"f").getEip3770Address(t);i.searchParams.set("delegate",e)}if(s){const{address:e}=await gt(this,ht,"f").getEip3770Address(s);i.searchParams.set("delegator",e)}return a&&i.searchParams.set("label",a),r&&i.searchParams.set("limit",r),n&&i.searchParams.set("offset",n),(0,_t.sendRequest)({url:i.toString(),method:_t.HttpMethod.Get})}async addSafeDelegate({safeAddress:e,delegateAddress:t,delegatorAddress:s,label:a,signer:r}){if(""===t)throw new Error("Invalid Safe delegate address");if(""===s)throw new Error("Invalid Safe delegator address");if(""===a)throw new Error("Invalid label");const{address:n}=await gt(this,ht,"f").getEip3770Address(t),{address:i}=await gt(this,ht,"f").getEip3770Address(s),o=n+Math.floor(Date.now()/1e3/3600),d=await r.signMessage(o),c={safe:e?(await gt(this,ht,"f").getEip3770Address(e)).address:null,delegate:n,delegator:i,label:a,signature:d};return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/delegates/`,method:_t.HttpMethod.Post,body:c})}async removeSafeDelegate({delegateAddress:e,delegatorAddress:t,signer:s}){if(""===e)throw new Error("Invalid Safe delegate address");if(""===t)throw new Error("Invalid Safe delegator address");const{address:a}=await gt(this,ht,"f").getEip3770Address(e),{address:r}=await gt(this,ht,"f").getEip3770Address(t),n=a+Math.floor(Date.now()/1e3/3600),i=await s.signMessage(n);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/delegates/${a}`,method:_t.HttpMethod.Delete,body:{delegate:a,delegator:r,signature:i}})}async getSafeCreationInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/creation/`,method:_t.HttpMethod.Get})}async estimateSafeTransaction(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${s}/multisig-transactions/estimations/`,method:_t.HttpMethod.Post,body:t})}async proposeTransaction({safeAddress:e,safeTransactionData:t,safeTxHash:s,senderAddress:a,senderSignature:r,origin:n}){if(""===e)throw new Error("Invalid Safe address");const{address:i}=await gt(this,ht,"f").getEip3770Address(e),{address:o}=await gt(this,ht,"f").getEip3770Address(a);if(""===s)throw new Error("Invalid safeTxHash");return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${i}/multisig-transactions/`,method:_t.HttpMethod.Post,body:{...t,contractTransactionHash:s,sender:o,signature:r,origin:n}})}async getIncomingTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/incoming-transfers?executed=true`,method:_t.HttpMethod.Get})}async getModuleTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/module-transactions/`,method:_t.HttpMethod.Get})}async getMultisigTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${t}/multisig-transactions/`,method:_t.HttpMethod.Get})}async getPendingTransactions(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:s}=await gt(this,ht,"f").getEip3770Address(e),a=t||(await this.getSafeInfo(s)).nonce;return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/safes/${s}/multisig-transactions/?executed=false&nonce__gte=${a}`,method:_t.HttpMethod.Get})}async getAllTransactions(e,t){var s,a,r;if(""===e)throw new Error("Invalid Safe address");const{address:n}=await gt(this,ht,"f").getEip3770Address(e),i=new URL(`${gt(this,lt,"f")}/v1/safes/${n}/all-transactions/`),o=(null===(s=null==t?void 0:t.trusted)||void 0===s?void 0:s.toString())||"true";i.searchParams.set("trusted",o);const d=(null===(a=null==t?void 0:t.queued)||void 0===a?void 0:a.toString())||"true";i.searchParams.set("queued",d);const c=(null===(r=null==t?void 0:t.executed)||void 0===r?void 0:r.toString())||"false";return i.searchParams.set("executed",c),(0,_t.sendRequest)({url:i.toString(),method:_t.HttpMethod.Get})}async getNextNonce(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e),s=await this.getPendingTransactions(t);if(s.results.length>0){const e=s.results.map((e=>e.nonce));return Math.max(...e)+1}return(await this.getSafeInfo(t)).nonce}async getTokenList(){return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/tokens/`,method:_t.HttpMethod.Get})}async getToken(e){if(""===e)throw new Error("Invalid token address");const{address:t}=await gt(this,ht,"f").getEip3770Address(e);return(0,_t.sendRequest)({url:`${gt(this,lt,"f")}/v1/tokens/${t}/`,method:_t.HttpMethod.Get})}};var Et={};Object.defineProperty(Et,"__esModule",{value:!0}),function(t){var s=e&&e.__createBinding||(Object.create?function(e,t,s,a){void 0===a&&(a=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,a,r)}:function(e,t,s,a){void 0===a&&(a=s),e[a]=t[s]}),a=e&&e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)},r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(ot);a(Et,t),t.default=n.default}(it);var mt=s(it);const vt={1:"https://safe-transaction-mainnet.safe.global/",5:"https://safe-transaction-goerli.safe.global/",42161:"https://safe-transaction-arbitrum.safe.global/",43114:"https://safe-transaction-avalanche.safe.global/",1313161554:"https://safe-transaction-aurora.safe.global/",56:"https://safe-transaction-bsc.safe.global/",10:"https://safe-transaction-optimism.safe.global/",137:"https://safe-transaction-polygon.safe.global/"};let Tt;function yt(e){return a(this,void 0,void 0,(function*(){if((null==Tt?void 0:Tt.chainId)===e)return Tt.safeService;if(!n.getState().provider)throw new Error("provider is undefined");const t=function(){return{getEip3770Address:e=>a(this,void 0,void 0,(function*(){const{address:t,prefix:s}=function(e){const t=e.split(":"),s=t.length>1?t[1]:t[0];return{prefix:t.length>1?t[0]:"",address:s}}(e);return{address:t,prefix:s}}))}}(),s=vt[e];if(!s)return;const r=new mt({txServiceUrl:s,ethAdapter:t});return Tt={safeService:r,chainId:e},Tt.safeService}))}function wt(e,t){return a(this,void 0,void 0,(function*(){if(!t)return!1;const s=yield yt(e);if(!s)return!1;try{return!!(yield s.getSafeInfo(t))}catch(e){return console.error(e),!1}}))}function St(e,t,s){return a(this,void 0,void 0,(function*(){const a=yield yt(e);if(!a)return console.error(`chainId: ${e} is not supported safe`),s;if(s!==t)return s;const r=yield a.getMultisigTransactions(s),[n]=r.results;return n.safeTxHash}))}function It(e,t,s){return a(this,void 0,void 0,(function*(){const a=yield yt(e);if(!a)throw new Error(`chainId: ${e} is not supported safe`);try{const{results:e}=yield a.getMultisigTransactions(s),r=e.find((e=>e.safeTxHash.toLocaleLowerCase()===t.toLocaleLowerCase()));if(!r)return null;if(e.some((e=>!(e.nonce!==r.nonce||e.safeTxHash.toLocaleLowerCase()===t.toLocaleLowerCase()||!e.isExecuted||!e.isSuccessful))))return"rejected";if(null===r.isExecuted||null===r.isSuccessful)return null;return{status:r.isExecuted&&r.isSuccessful||!1,transactionHash:r.transactionHash,blockNumber:r.blockNumber||null}}catch(e){throw console.error(e),new Error(`safeTxHash: ${t} is not valid.`)}}))}function bt(e,t,s){const a={1:"eth",5:"gor",137:"matic",56:"bnb",42161:"arb1",10:"oeth",43114:"avax",1313161554:"aurora"}[t];if(!a)throw new Error(`Not Supported network: ${t}`);return`https://app.safe.global/transactions/tx?id=multisig_${s}_${e}&safe=${a}%3A${s}`}export{nt as default,wt as getAccountIsSafe,at as getConnectedSafe,rt as getIsSafe,bt as getSafeHashDetailUrl,St as getSafeTxHash,It as getSafeTxStatus};