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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/__node-resolve_empty-0100ccbe.js +1 -0
  2. package/dist/__tslib-edb9da71.js +1 -0
  3. package/dist/blocto-8d7de7b5.js +7 -0
  4. package/dist/bn-e338479f.js +1 -0
  5. package/dist/browser-ponyfill-4f8ec4cc.js +1 -0
  6. package/dist/cjs/__node-resolve_empty-db84e05a.cjs +1 -0
  7. package/dist/cjs/__tslib-12427cac.cjs +1 -0
  8. package/dist/cjs/blocto-5784523c.cjs +7 -0
  9. package/dist/cjs/bn-595d299a.cjs +1 -0
  10. package/dist/cjs/browser-ponyfill-99cd2b2a.cjs +1 -0
  11. package/dist/cjs/ethers-8dd84195.cjs +1 -0
  12. package/dist/cjs/id-ae785b22.cjs +1 -0
  13. package/dist/cjs/{index-5d7b94fd.cjs → index-095f26b3.cjs} +1 -1
  14. package/dist/cjs/index-1eddf6b7.cjs +1 -0
  15. package/dist/cjs/index-1ee2a405.cjs +1 -0
  16. package/dist/cjs/index-2dac57a4.cjs +1 -0
  17. package/dist/cjs/{index-f2c04d55.cjs → index-3bc984a2.cjs} +1 -1
  18. package/dist/cjs/index-47036dc9.cjs +15 -0
  19. package/dist/cjs/index-4d18447a.cjs +1 -0
  20. package/dist/cjs/{index-4585c950.cjs → index-4ee3ab7f.cjs} +1 -1
  21. package/dist/cjs/index-773f2765.cjs +46 -0
  22. package/dist/cjs/index-99b925f5.cjs +10 -0
  23. package/dist/cjs/index-cf3bf3b5.cjs +3 -0
  24. package/dist/cjs/{index-3d1a3da9.cjs → index-df8e5839.cjs} +1 -1
  25. package/dist/cjs/index-eb09e54d.cjs +60 -0
  26. package/dist/cjs/index.cjs +1 -1
  27. package/dist/cjs/index.es-6f21f76e.cjs +9 -0
  28. package/dist/cjs/{interface-1b54eefa.cjs → interface-6285bef3.cjs} +1 -1
  29. package/dist/cjs/portis-ec351600.cjs +24 -0
  30. package/dist/cjs/{provider-403219c9.cjs → provider-6f06969f.cjs} +1 -1
  31. package/dist/cjs/rainbow-cb1bd1d4.cjs +1 -0
  32. package/dist/cjs/uAuth-21c58fc5.cjs +1 -0
  33. package/dist/cjs/walletConnect-4e88eea6.cjs +1 -0
  34. package/dist/cjs/walletLink-4cf61eb3.cjs +1 -0
  35. package/dist/ethers-d98a529c.js +1 -0
  36. package/dist/id-bb7887d8.js +1 -0
  37. package/dist/index-0ee5ef8d.js +60 -0
  38. package/dist/index-1dc7fa04.js +1 -0
  39. package/dist/index-32669120.js +15 -0
  40. package/dist/index-5a901c0e.js +2 -0
  41. package/dist/{index-235259d8.js → index-9201db0c.js} +1 -1
  42. package/dist/index-98f05edd.js +1 -0
  43. package/dist/{index-de37f6bb.js → index-a0101310.js} +1 -1
  44. package/dist/index-c2c32c9a.js +46 -0
  45. package/dist/index-d1e775cf.js +10 -0
  46. package/dist/{index-5f9e8321.js → index-e0d3617a.js} +1 -1
  47. package/dist/index-e17029da.js +1 -0
  48. package/dist/index-fbd509d6.js +1 -0
  49. package/dist/{index-650785ec.js → index-fe1624e3.js} +1 -1
  50. package/dist/index.es-e051edf2.js +9 -0
  51. package/dist/index.js +1 -1
  52. package/dist/{interface-f97a878a.js → interface-2066cc0e.js} +1 -1
  53. package/dist/portis-a96be943.js +24 -0
  54. package/dist/{provider-453e2483.js → provider-01f3e885.js} +1 -1
  55. package/dist/rainbow-5bfe748a.js +1 -0
  56. package/dist/uAuth-4cf1112e.js +1 -0
  57. package/dist/walletConnect-7c22cd4c.js +1 -0
  58. package/dist/walletLink-ad1c9d2e.js +1 -0
  59. package/package.json +1 -1
  60. package/dist/__tslib-dd22ed7d.js +0 -1
  61. package/dist/blocto-69a506f8.js +0 -1
  62. package/dist/bn-3e892825.js +0 -1
  63. package/dist/cjs/__tslib-8344f379.cjs +0 -1
  64. package/dist/cjs/blocto-bdab3cea.cjs +0 -1
  65. package/dist/cjs/bn-ce9dbccd.cjs +0 -1
  66. package/dist/cjs/ethers-767c2337.cjs +0 -1
  67. package/dist/cjs/id-6c4d97dd.cjs +0 -1
  68. package/dist/cjs/index-2428f0a6.cjs +0 -1
  69. package/dist/cjs/index-4abb9db3.cjs +0 -1
  70. package/dist/cjs/index-659dc842.cjs +0 -61
  71. package/dist/cjs/index-67e59d1a.cjs +0 -1
  72. package/dist/cjs/index-795ad993.cjs +0 -46
  73. package/dist/cjs/index-a5fa1e6e.cjs +0 -15
  74. package/dist/cjs/index-aa04e7a3.cjs +0 -1
  75. package/dist/cjs/index-cfe3e391.cjs +0 -10
  76. package/dist/cjs/index-d226aab9.cjs +0 -8
  77. package/dist/cjs/index-e875b498.cjs +0 -1
  78. package/dist/cjs/index.es-a3704620.cjs +0 -9
  79. package/dist/cjs/node-ponyfill-a7a0b431.cjs +0 -1
  80. package/dist/cjs/portis-ec0ce54d.cjs +0 -1
  81. package/dist/cjs/rainbow-caa66e39.cjs +0 -1
  82. package/dist/cjs/uAuth-a2d2617a.cjs +0 -1
  83. package/dist/cjs/walletConnect-c57b3b5d.cjs +0 -1
  84. package/dist/cjs/walletLink-f0f9e2a7.cjs +0 -3
  85. package/dist/ethers-51e19435.js +0 -1
  86. package/dist/id-830e09aa.js +0 -1
  87. package/dist/index-3158e93a.js +0 -46
  88. package/dist/index-46c2059e.js +0 -1
  89. package/dist/index-5091218e.js +0 -1
  90. package/dist/index-6bf494b0.js +0 -1
  91. package/dist/index-80483be2.js +0 -8
  92. package/dist/index-82b4fd64.js +0 -60
  93. package/dist/index-88837567.js +0 -1
  94. package/dist/index-c699a924.js +0 -1
  95. package/dist/index-cc453bb1.js +0 -10
  96. package/dist/index-f3052552.js +0 -15
  97. package/dist/index.es-877101c5.js +0 -9
  98. package/dist/node-ponyfill-55b945e1.js +0 -1
  99. package/dist/portis-7d46b7ed.js +0 -1
  100. package/dist/rainbow-61a52379.js +0 -1
  101. package/dist/uAuth-40d8acab.js +0 -1
  102. package/dist/walletConnect-d6a9aa67.js +0 -1
  103. package/dist/walletLink-106461e6.js +0 -3
  104. /package/dist/cjs/{index-47f3e61d.cjs → index-70269942.cjs} +0 -0
  105. /package/dist/{index-0103e089.js → index-6be6f872.js} +0 -0
@@ -1 +0,0 @@
1
- import{_ as e,d as t}from"./index-cc453bb1.js";import"events";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";function n(e,t){var n="string"==typeof e?Object.assign({},i[e]):e;if("object"!=typeof n)throw new Error("[Portis] illegal 'network' parameter. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(!n.nodeUrl)throw new Error("[Portis] 'nodeUrl' is required. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(t&&!n.gasRelayHubAddress)throw new Error("[Portis] can't find default gas relay hub for "+e);return"string"!=typeof e||t||delete n.gasRelayHubAddress,n}var i={mainnet:{nodeUrl:"https://mainnet.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"1",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},ropsten:{nodeUrl:"https://ropsten.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"3",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},rinkeby:{nodeUrl:"https://rinkeby.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"4",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},goerli:{nodeUrl:"https://goerli.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"5"},ubiq:{nodeUrl:"https://rpc1.ubiqscan.io",chainId:"8"},thundercoreTestnet:{nodeUrl:"https://testnet-rpc.thundercore.com:8544",chainId:"18"},orchid:{nodeUrl:"https://public-node.rsk.co",chainId:"30"},orchidTestnet:{nodeUrl:"https://public-node.testnet.rsk.co",chainId:"31"},kovan:{nodeUrl:"https://kovan.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"42",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},classic:{nodeUrl:"https://ethereumclassic.network",chainId:"61"},sokol:{nodeUrl:"https://sokol.poa.network",chainId:"77"},core:{nodeUrl:"https://core.poa.network",chainId:"99"},xdai:{nodeUrl:"https://dai.poa.network",chainId:"100",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},thundercore:{nodeUrl:"https://mainnet-rpc.thundercore.com",chainId:"108"},fuse:{nodeUrl:"https://rpc.fusenet.io",chainId:"122"},lightstreams:{nodeUrl:"https://node.mainnet.lightstreams.io",chainId:"163"},matic:{nodeUrl:"https://polygon-rpc.com",chainId:"137"},maticMumbai:{nodeUrl:"https://rpc-mumbai.matic.today",chainId:"80001"},maticAlpha:{nodeUrl:"https://alpha.ethereum.matic.network",chainId:"4626"},maticTestnet:{nodeUrl:"https://testnet2.matic.network",chainId:"8995"}},r=function(){return!("undefined"==typeof window||!window.document)},o=!1;function a(){return new Promise((function(e,t){r()?o?e():["loaded","interactive","complete"].indexOf(document.readyState)>-1?(o=!0,e()):window.addEventListener("load",(function(){o=!0,e()}),!1):t()}))}function s(){var e="localhost"===location.hostname||"127.0.0.1"===location.hostname,t="https:"===location.protocol;if(!(e||t))throw"[Portis] Access to the WebCrypto API is restricted to secure origins.\nIf this is a development environment please use http://localhost:"+location.port+" instead.\nOtherwise, please use an SSL certificate."}var c={};Object.defineProperty(c,"__esModule",{value:!0});var u=c.default=c.ERR_NOT_IN_IFRAME=c.ERR_CONNECTION_TIMEOUT=c.ERR_CONNECTION_DESTROYED=void 0,d="handshake",l="handshake-reply",h="call",f="reply",g="fulfilled",p="rejected",m="message",v="ConnectionDestroyed";c.ERR_CONNECTION_DESTROYED=v;var w="ConnectionTimeout";c.ERR_CONNECTION_TIMEOUT=w;var b="NotInIframe";c.ERR_NOT_IN_IFRAME=b;var y,_={"http:":"80","https:":"443"},E=/^(https?:)?\/\/([^/:]+)(:(\d+))?/,C={ERR_CONNECTION_DESTROYED:v,ERR_CONNECTION_TIMEOUT:w,ERR_NOT_IN_IFRAME:b,Promise:function(){try{return window?window.Promise:null}catch(e){return null}}(),debug:!1},k=(y=0,function(){return++y}),P=function(){if(C.debug){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,["[Penpal]"].concat(n))}},I=function(e){var t=[];return e((function(){t.forEach((function(e){e()}))})),{then:function(e){t.push(e)}}},W=function(e){return{name:e.name,message:e.message,stack:e.stack}},x=function(e,t,n,i){var r=t.localName,o=t.local,a=t.remote,s=t.remoteOrigin,c=!1;P("".concat(r,": Connecting call sender"));var u=function(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(P("".concat(r,": Sending ").concat(e,"() call")),c){var u=new Error("Unable to send ".concat(e,"() call due ")+"to destroyed connection");throw u.code=v,u}return new C.Promise((function(t,i){var c=k();o.addEventListener(m,(function n(u){if(u.source===a&&u.origin===s&&u.data.penpal===f&&u.data.id===c){P("".concat(r,": Received ").concat(e,"() reply")),o.removeEventListener(m,n);var d=u.data.returnValue;u.data.returnValueIsError&&(l=d,h=new Error,Object.keys(l).forEach((function(e){return h[e]=l[e]})),d=h),(u.data.resolution===g?t:i)(d)}var l,h})),a.postMessage({penpal:h,id:c,methodName:e,args:n},s)}))}};i.then((function(){c=!0})),n.reduce((function(e,t){return e[t]=u(t),e}),e)},T=function(e,t,n){var i=e.localName,r=e.local,o=e.remote,a=e.remoteOrigin,s=!1;P("".concat(i,": Connecting call receiver"));var c=function(e){if(e.source===o&&e.origin===a&&e.data.penpal===h){var n=e.data,r=n.methodName,c=n.args,u=n.id;if(P("".concat(i,": Received ").concat(r,"() call")),r in t){var d=function(e){return function(t){if(P("".concat(i,": Sending ").concat(r,"() reply")),s)P("".concat(i,": Unable to send ").concat(r,"() reply due to destroyed connection"));else{var n={penpal:f,id:u,resolution:e,returnValue:t};e===p&&t instanceof Error&&(n.returnValue=W(t),n.returnValueIsError=!0);try{o.postMessage(n,a)}catch(e){throw"DataCloneError"===e.name&&o.postMessage({penpal:f,id:u,resolution:p,returnValue:W(e),returnValueIsError:!0},a),e}}}};new C.Promise((function(e){return e(t[r].apply(t,c))})).then(d(g),d(p))}}};r.addEventListener(m,c),n.then((function(){s=!0,r.removeEventListener(m,c)}))};C.connectToChild=function(e){var t,n=e.url,i=e.appendTo,r=e.methods,o=void 0===r?{}:r,a=e.timeout,s=new I((function(e){t=e})),c=window,u=document.createElement("iframe");(i||document.body).appendChild(u),s.then((function(){u.parentNode&&u.parentNode.removeChild(u)}));var h=u.contentWindow||u.contentDocument.parentWindow,f=function(e){var t,n,i,r=document.location,o=E.exec(e);o?(t=o[1]?o[1]:r.protocol,n=o[2],i=o[4]):(t=r.protocol,n=r.hostname,i=r.port);var a=i&&i!==_[t]?":".concat(i):"";return"".concat(t,"//").concat(n).concat(a)}(n);return{promise:new C.Promise((function(e,i){var r;void 0!==a&&(r=setTimeout((function(){var e=new Error("Connection to child timed out after ".concat(a,"ms"));e.code=w,i(e),t()}),a));var g,p,b={},y=function(t){if(t.source===h&&t.origin===f&&t.data.penpal===d){P("Parent: Received handshake, sending reply"),t.source.postMessage({penpal:l,methodNames:Object.keys(o)},t.origin);var n={localName:"Parent",local:c,remote:h,remoteOrigin:t.origin};p&&p();var i=new I((function(e){s.then(e),p=e}));T(n,o,i),g&&g.forEach((function(e){delete b[e]})),g=t.data.methodNames,x(b,n,g,s),clearTimeout(r),e(b)}};c.addEventListener(m,y),s.then((function(){c.removeEventListener(m,y);var e=new Error("Connection destroyed");e.code=v,i(e)})),P("Parent: Loading iframe"),u.src=n})),iframe:u,destroy:t}},C.connectToParent=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.parentOrigin,i=void 0===n?"*":n,r=t.methods,o=void 0===r?{}:r,a=t.timeout;if(window===window.top){var s=new Error("connectToParent() must be called within an iframe");throw s.code=b,s}var c=new I((function(t){e=t})),u=window,h=u.parent,f=new C.Promise((function(t,n){var r;void 0!==a&&(r=setTimeout((function(){var t=new Error("Connection to parent timed out after ".concat(a,"ms"));t.code=w,n(t),e()}),a));var s=function e(n){if(("*"===i||i===n.origin)&&n.source===h&&n.data.penpal===l){P("Child: Received handshake reply"),u.removeEventListener(m,e);var a={localName:"Child",local:u,remote:h,remoteOrigin:n.origin},s={};T(a,o,c),x(s,a,n.data.methodNames,c),clearTimeout(r),t(s)}};u.addEventListener(m,s),c.then((function(){u.removeEventListener(m,s);var e=new Error("Connection destroyed");e.code=v,n(e)})),P("Child: Sending handshake"),h.postMessage({penpal:d,methodNames:Object.keys(o)},i)}));return{promise:f,destroy:e}};var A=C;u=c.default=A;var O=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(a,s)}c((i=i.apply(e,t||[])).next())}))},M=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},N=process.env.PORTIS_WIDGET_URL||"https://widget.portis.io",L="por_portis-widget-frame",R="por_portis-container";var S=function(){function e(t,n){this._widgetConfig=t,this._clearProviderSession=n,this._widgetUrl=N,this._onLoginCallback=function(){},this._onLogoutCallback=function(){},this._onErrorCallback=function(){},s(),t.staging?(console.warn("Please note: you are using the Portis STAGING environment."),this._widgetUrl="https://widget-staging.portis.io"):t.feature&&(console.warn("Please note: you are using the Portis FEATURE environment."),this._widgetUrl="https://widget-feature.portis.io"),e._checkIfWidgetAlreadyInitialized()}return e.prototype.getWidget=function(){return O(this,void 0,void 0,(function(){var e;return M(this,(function(t){switch(t.label){case 0:return this.widgetInstance?[3,2]:(this.widgetPromise||(this.widgetPromise=this._initWidget()),e=this,[4,this.widgetPromise]);case 1:e.widgetInstance=t.sent(),t.label=2;case 2:return[2,this.widgetInstance]}}))}))},e.prototype.setDefaultEmail=function(e){this._widgetConfig.defaultEmail=e},e.prototype.setOnLoginCallback=function(e){this._onLoginCallback=e},e.prototype.setOnLogoutCallback=function(e){this._onLogoutCallback=e},e.prototype.setOnActiveWalletChangedCallback=function(e){this._onActiveWalletChangedCallback=e},e.prototype.setOnErrorCallback=function(e){this._onErrorCallback=e},e.prototype.showPortis=function(){return O(this,void 0,void 0,(function(){return M(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.showPortis(this._widgetConfig)]}}))}))},e.prototype.getCampaignInfo=function(e){return O(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.getCampaignInfo(e)]}}))}))},e.prototype.claimVoucher=function(e){return O(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.claimVoucher(e,this._widgetConfig)]}}))}))},e.prototype.logout=function(){return O(this,void 0,void 0,(function(){return M(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.logout()]}}))}))},e.prototype.getExtendedPublicKey=function(e,t){return void 0===e&&(e="m/44'/60'/0'/0/0"),void 0===t&&(t="Ethereum"),O(this,void 0,void 0,(function(){return M(this,(function(n){switch(n.label){case 0:return[4,this.getWidget()];case 1:return[2,n.sent().communication.getExtendedPublicKey(e,t,this._widgetConfig)]}}))}))},e.prototype.importWallet=function(e){return O(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.importWallet(e,this._widgetConfig)]}}))}))},e.prototype.isLoggedIn=function(){return O(this,void 0,void 0,(function(){return M(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.isLoggedIn()]}}))}))},e.prototype.signBitcoinTransaction=function(e){return O(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.signBitcoinTransaction(e,this._widgetConfig)]}}))}))},e.prototype.showBitcoinWallet=function(e){return void 0===e&&(e="m/49'/0'/0'/0/0"),O(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.showBitcoinWallet(e,this._widgetConfig)]}}))}))},e.prototype.purchaseERC20=function(e){return O(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.purchaseERC20(e,this._widgetConfig)]}}))}))},e._checkIfWidgetAlreadyInitialized=function(){document.getElementsByClassName(R).length&&console.warn("An instance of Portis was already initialized. This is probably a mistake. Make sure that you use the same Portis instance throughout your app.")},e.prototype._initWidget=function(){return O(this,void 0,void 0,(function(){var t,n,i,r,o;return M(this,(function(s){switch(s.label){case 0:return[4,a()];case 1:return s.sent(),(t=document.createElement("style")).innerHTML="\n.por_portis-container {\n position: fixed;\n width: 0px;\n height: 0px;\n top: 0px;\n right: 0px;\n z-index: 2147483647;\n}\n\n@media (max-width: 576px) {\n .por_portis-container {\n bottom: 0;\n top: auto;\n }\n}\n\n.por_portis-widget-frame {\n position: fixed;\n width: 375px;\n height: 0;\n top: 20px;\n right: 20px;\n box-shadow: 0 5px 40px rgba(0,0,0,.16);\n border-radius: 8px;\n overflow: hidden;\n z-index: 2147483000;\n}\n\n@media (max-width: 576px) {\n .por_portis-widget-frame {\n bottom: 0;\n top: auto;\n width: 100%;\n right: 0;\n left: 0;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n}\n",(n=document.createElement("div")).className=R,(i=document.createElement("div")).id="portis-container-"+Date.now(),i.className=L,n.appendChild(i),document.body.appendChild(n),document.head.appendChild(t),[4,(r=u.connectToChild({url:this._widgetUrl,appendTo:document.getElementById(i.id),methods:{setHeight:this._setHeight.bind(this),getWindowSize:e._getWindowSize.bind(this),onLogin:this._onLogin.bind(this),onLogout:this._onLogout.bind(this),onActiveWalletChanged:this._onActiveWalletChanged.bind(this),hasOnActiveWalletChanged:this.hasOnActiveWalletChanged.bind(this),onError:this._onError.bind(this)}})).promise];case 2:return(o=s.sent()).setSdkConfig(this._widgetConfig),r.iframe.style.position="absolute",r.iframe.style.height="100%",r.iframe.style.width="100%",r.iframe.style.border="0 transparent",[2,{communication:o,widgetFrame:i}]}}))}))},e.prototype._setHeight=function(e){return O(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return t.sent().widgetFrame.style.height=e+"px",[2]}}))}))},e._getWindowSize=function(){var e=document.getElementsByTagName("body")[0];return{width:window.innerWidth||document.documentElement.clientWidth||e.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||e.clientHeight}},e.prototype._onLogin=function(e,t,n){this._onLoginCallback&&this._onLoginCallback(e,t,n)},e.prototype._onLogout=function(){this._clearProviderSession(),this._onLogoutCallback&&this._onLogoutCallback()},e.prototype._onActiveWalletChanged=function(e){this._onActiveWalletChangedCallback&&this._onActiveWalletChangedCallback(e)},e.prototype.hasOnActiveWalletChanged=function(){return!!this._onActiveWalletChangedCallback},e.prototype._onError=function(e){this._onErrorCallback&&this._onErrorCallback(e)},e}(),D=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(a,s)}c((i=i.apply(e,t||[])).next())}))},j=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},U=require("ethereumjs-util"),B=U.addHexPrefix,F=U.stripHexPrefix,G=U.BN,V="0x5208";function H(e,t){return D(this,void 0,void 0,(function(){var n,i,r,o,a;return j(this,(function(s){switch(s.label){case 0:return[4,e.getBlockByNumber("latest",!1)];case 1:return n=s.sent(),[4,q(e,t,n.gasLimit)];case 2:if(i=s.sent(),r=i.safeGas,o=i.simpleSend,a=i.gasLimitSpecified,o||a)return[2,r];s.label=3;case 3:return s.trys.push([3,5,,6]),[4,z(e,t,n.gasLimit,r)];case 4:return[2,s.sent()];case 5:return s.sent(),[2,r];case 6:return[2]}}))}))}function q(e,t,n){return D(this,void 0,void 0,(function(){var i,r,o;return j(this,(function(a){switch(a.label){case 0:return Boolean(t.gas)?[2,{safeGas:t.gas,simpleSend:!1,gasLimitSpecified:!0}]:(i=t.to,Boolean(i)?[4,e.getCode(i)]:[3,2]);case 1:if(r=a.sent(),!r||"0x"===r||"0x0"===r){if(t.data)throw new Error("Trying to call a function on a non-contract address");return[2,{safeGas:V,simpleSend:!0,gasLimitSpecified:!1}]}a.label=2;case 2:return o=Y(n),s=o,c=20,u=new G(19),d=new G(c),[2,{safeGas:J(s.mul(u).div(d)),simpleSend:!1,gasLimitSpecified:!1}]}var s,c,u,d}))}))}function z(e,t,n,i){return D(this,void 0,void 0,(function(){var r;return j(this,(function(o){switch(o.label){case 0:return t.gas=i,r=B,[4,e.estimateGas(t)];case 1:return[2,K(r.apply(void 0,[o.sent()]),n)]}}))}))}function K(e,t){var n=Y(e),i=Y(t).muln(.9),r=n.muln(1.5);return n.gt(i)?J(n):r.lt(i)?J(r):J(i)}function Y(e){return new G(F(e),16)}function J(e){return B(e.toString(16))}var Q=function(){function e(e){this.provider=e}return e.prototype.getBlockByNumber=function(e,t){return this.sendAsync("eth_getBlockByNumber",e,t)},e.prototype.getCode=function(e,t){return void 0===t&&(t="latest"),this.sendAsync("eth_getCode",e,t)},e.prototype.estimateGas=function(e){return this.sendAsync("eth_estimateGas",e)},e.prototype.sendAsync=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return new Promise((function(i,r){t.provider.sendAsync({id:42,jsonrpc:"2.0",method:e,params:n},(function(e,t){e?r(e):i(t.result)}))}))},e}(),X=function(){return X=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},X.apply(this,arguments)},Z=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(a,s)}c((i=i.apply(e,t||[])).next())}))},$=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ee=require("web3-provider-engine"),te=require("web3-provider-engine/dist/es5/subproviders/cache.js"),ne=require("web3-provider-engine/dist/es5/subproviders/fixture.js"),ie=require("web3-provider-engine/dist/es5/subproviders/filters.js"),re=require("web3-provider-engine/dist/es5/subproviders/hooked-wallet.js"),oe=require("web3-provider-engine/dist/es5/subproviders/nonce-tracker.js"),ae=require("web3-provider-engine/dist/es5/subproviders/subscriptions.js"),se=function(){function e(e,t){this.config=e,this._getWidgetCommunication=t,this.provider=this._initProvider()}return e.prototype.setSelectedAddress=function(e){this._selectedAddress=e},e.prototype.changeNetwork=function(e,t){var i=n(e,t);this.clearSubprovider(oe),this.clearSubprovider(te),this.config.network=i},e.prototype._initProvider=function(){var e=this;if(this.engine)return this.engine;this.engine=new ee;var t=new Q(this.engine);return this.engine.send=function(t,n){if("string"==typeof t)return new Promise((function(i,r){e.engine.sendAsync({jsonrpc:"2.0",id:42,method:t,params:n||[]},(function(e,t){e?r(e):i(t.result)}))}));if(!n){var i=null;switch(t.method){case"eth_accounts":case"eth_coinbase":i=e._selectedAddress?[e._selectedAddress]:[];break;case"net_version":i=e._network;break;case"eth_uninstallFilter":e.engine.sendAsync(t,(function(e){return e})),i=!0;break;default:var r="The Portis Web3 object does not support synchronous methods like "+t.method+" without a callback parameter.";throw new Error(r)}return{id:t.id,jsonrpc:t.jsonrpc,result:i}}e.engine.sendAsync(t,n)},this.engine.addProvider(new ne({web3_clientVersion:"Portis/v"+this.config.version+"/javascript",net_listening:!0,eth_hashrate:"0x00",eth_mining:!1,eth_syncing:!0})),this.engine.addProvider(new te),this.engine.addProvider(new ae),this.engine.addProvider(new ie),this.engine.addProvider(new oe),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,n){return Z(e,void 0,void 0,(function(){return $(this,(function(e){return t.id||(t.id=42),n(),[2]}))}))}}),this.engine.addProvider(new re({getAccounts:function(t){return Z(e,void 0,void 0,(function(){var e,n,i;return $(this,(function(r){switch(r.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,r.sent().getAccounts(this.config)];case 2:return e=r.sent(),n=e.error,i=e.result,!n&&i&&(this._selectedAddress=i[0]),t(n,i),[2]}}))}))},signTransaction:function(t,n){return Z(e,void 0,void 0,(function(){var e,i,r;return $(this,(function(o){switch(o.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,o.sent().signTransaction(t,this.config)];case 2:return e=o.sent(),i=e.error,r=e.result,n(i,r),[2]}}))}))},signMessage:function(t,n){return Z(e,void 0,void 0,(function(){var e,i,r,o,a;return $(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=X({},t,{messageStandard:"signMessage"}),[4,e.signMessage(i,this.config)];case 2:return r=s.sent(),o=r.error,a=r.result,n(o,a),[2]}}))}))},signPersonalMessage:function(t,n){return Z(e,void 0,void 0,(function(){var e,i,r,o,a;return $(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=X({},t,{messageStandard:"signPersonalMessage"}),[4,e.signMessage(i,this.config)];case 2:return r=s.sent(),o=r.error,a=r.result,n(o,a),[2]}}))}))},signTypedMessage:function(t,n){return Z(e,void 0,void 0,(function(){var e,i,r,o,a;return $(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=X({},t,{messageStandard:"signTypedMessage"}),[4,e.signMessage(i,this.config)];case 2:return r=s.sent(),o=r.error,a=r.result,n(o,a),[2]}}))}))},signTypedMessageV3:function(t,n){return Z(e,void 0,void 0,(function(){var e,i,r,o,a;return $(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=X({},t,{messageStandard:"signTypedMessageV3"}),[4,e.signMessage(i,this.config)];case 2:return r=s.sent(),o=r.error,a=r.result,n(o,a),[2]}}))}))},estimateGas:function(n,i){return Z(e,void 0,void 0,(function(){var e;return $(this,(function(r){switch(r.label){case 0:return[4,H(t,n)];case 1:return e=r.sent(),i(null,e),[2]}}))}))},getGasPrice:function(t){return Z(e,void 0,void 0,(function(){return $(this,(function(e){return t(null,""),[2]}))}))}})),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,n,i){return Z(e,void 0,void 0,(function(){var e,n,r;return $(this,(function(o){switch(o.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,o.sent().relay(t,this.config)];case 2:return e=o.sent(),n=e.error,r=e.result,"net_version"===t.method&&(this._network=r,this.engine.networkVersion=this._network),i(n,r),[2]}}))}))}}),this.engine.enable=function(){return new Promise((function(t,n){e.engine.sendAsync({method:"eth_accounts"},(function(e,i){e?n(e):t(i.result)}))}))},this.engine.isConnected=function(){return!0},this.engine.isPortis=!0,this.engine.on("error",(function(e){e&&e.message&&e.message.includes("PollingBlockTracker")?console.warn("If you see this warning constantly, there might be an error with your RPC node."):console.error(e)})),this.engine.start(),this.engine},e.prototype.clearSubprovider=function(e){var t=this.provider._providers.find((function(t){return t instanceof e}));this.provider.removeProvider(t),this.provider.addProvider(new e)},e}(),ce=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(a,s)}c((i=i.apply(e,t||[])).next())}))},ue=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},de=["email","reputation"];a().then((function(){document.getElementsByClassName(L).length&&console.warn("Portis script was already loaded. This might cause unexpected behavior. If loading with a <script> tag, please make sure that you only load it once.")})).catch((function(){}));var le=function(){function e(e,t,i){if(void 0===i&&(i={}),!r())return new Proxy(this,{get:function(e,t){return e[t]instanceof Function?function(){}:void 0}});s(),this._validateParams(e,t,i),this._config={dappId:e,network:n(t,i.gasRelay),version:"4.0.7",scope:i.scope,registerPageByDefault:i.registerPageByDefault,staging:i.staging,feature:i.feature},this._getWidgetCommunication=this._getWidgetCommunication.bind(this),this._widgetManagerInstance=new S(this.config,this._clearProviderSession),this._web3ManagerInstance=new se(this.config,this._getWidgetCommunication),this.setDefaultEmail=this.setDefaultEmail.bind(this),this.changeNetwork=this.changeNetwork.bind(this),this.getWidget=this.getWidget.bind(this),this.onLogin=this.onLogin.bind(this),this.onLogout=this.onLogout.bind(this),this.onActiveWalletChanged=this.onActiveWalletChanged.bind(this),this.onError=this.onError.bind(this),this.showPortis=this.showPortis.bind(this),this.getCampaignInfo=this.getCampaignInfo.bind(this),this.claimVoucher=this.claimVoucher.bind(this),this.getExtendedPublicKey=this.getExtendedPublicKey.bind(this),this.importWallet=this.importWallet.bind(this),this.isLoggedIn=this.isLoggedIn.bind(this),this.signBitcoinTransaction=this.signBitcoinTransaction.bind(this),this.showBitcoinWallet=this.showBitcoinWallet.bind(this)}return Object.defineProperty(e.prototype,"_widgetManager",{get:function(){return this._widgetManagerInstance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_web3Manager",{get:function(){return this._web3ManagerInstance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),e.prototype._clearProviderSession=function(){this._web3Manager.setSelectedAddress("")},e.prototype._getWidgetCommunication=function(){return ce(this,void 0,void 0,(function(){return ue(this,(function(e){switch(e.label){case 0:return[4,this._widgetManager.getWidget()];case 1:return[2,e.sent().communication]}}))}))},Object.defineProperty(e.prototype,"web3Provider",{get:function(){return this._web3Manager.provider},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"provider",{get:function(){return this.web3Provider},enumerable:!0,configurable:!0}),e.prototype.changeNetwork=function(e,t){this._web3Manager.changeNetwork(e,t)},e.prototype.setDefaultEmail=function(e){this._widgetManager.setDefaultEmail(e)},e.prototype.getWidget=function(){return ce(this,void 0,void 0,(function(){return ue(this,(function(e){return[2,this._widgetManager.getWidget()]}))}))},e.prototype.onLogin=function(e){this._widgetManager.setOnLoginCallback(e)},e.prototype.onLogout=function(e){this._widgetManager.setOnLogoutCallback(e)},e.prototype.onActiveWalletChanged=function(e){this._widgetManager.setOnActiveWalletChangedCallback(e)},e.prototype.onError=function(e){this._widgetManager.setOnErrorCallback(e)},e.prototype.showPortis=function(){return ce(this,void 0,void 0,(function(){return ue(this,(function(e){return[2,this._widgetManager.showPortis()]}))}))},e.prototype.getCampaignInfo=function(e){return ce(this,void 0,void 0,(function(){return ue(this,(function(t){return[2,this._widgetManager.getCampaignInfo(e)]}))}))},e.prototype.claimVoucher=function(e){return ce(this,void 0,void 0,(function(){return ue(this,(function(t){return[2,this._widgetManager.claimVoucher(e)]}))}))},e.prototype.logout=function(){return ce(this,void 0,void 0,(function(){return ue(this,(function(e){return[2,this._widgetManager.logout()]}))}))},e.prototype.getExtendedPublicKey=function(e,t){return void 0===e&&(e="m/44'/60'/0'/0/0"),void 0===t&&(t="Ethereum"),ce(this,void 0,void 0,(function(){return ue(this,(function(n){return[2,this._widgetManager.getExtendedPublicKey(e,t)]}))}))},e.prototype.importWallet=function(e){return ce(this,void 0,void 0,(function(){return ue(this,(function(t){return[2,this._widgetManager.importWallet(e)]}))}))},e.prototype.isLoggedIn=function(){return ce(this,void 0,void 0,(function(){return ue(this,(function(e){return[2,this._widgetManager.isLoggedIn()]}))}))},e.prototype.signBitcoinTransaction=function(e){return ce(this,void 0,void 0,(function(){return ue(this,(function(t){return[2,this._widgetManager.signBitcoinTransaction(e)]}))}))},e.prototype.showBitcoinWallet=function(e){return void 0===e&&(e="m/49'/0'/0'/0/0"),ce(this,void 0,void 0,(function(){return ue(this,(function(t){return[2,this._widgetManager.showBitcoinWallet(e)]}))}))},e.prototype._validateParams=function(e,t,n){if(!e)throw new Error("[Portis] 'dappId' is required. Get your dappId here: https://dashboard.portis.io");if(!t)throw new Error("[Portis] 'network' is required. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(n.scope){if(!Array.isArray(n.scope))throw new Error("[Portis] 'scope' must be an array. Read more about it here: https://docs.portis.io/#/configuration?id=scope");if(n.scope.filter((function(e){return de.indexOf(e)<0})).length>0)throw new Error("[Portis] invalid 'scope' parameter. Read more about it here: https://docs.portis.io/#/configuration?id=scope")}if(void 0!==n.registerPageByDefault&&"boolean"!=typeof n.registerPageByDefault)throw new Error("[Portis] invalid 'registerPageByDefault' parameter, must be a boolean. Read more about it here: https://docs.portis.io/#/configuration?id=registerPageByDefault")},e}(),he=le;function fe({chainId:n,portisParams:i},r){return e(this,void 0,void 0,(function*(){if(!(null==i?void 0:i.id))throw new Error("uAuthParams is not valid.");let e="";switch(n){case 1:default:e="mainnet";break;case 5:e="goerli"}const o=new he(i.id,e,i.config);return yield o.provider.enable(),o.provider._portis=o,o.provider.on("connect",r.connect),o.provider.on("disconnect",r.disconnect),o.provider.on("accountsChanged",r.accountsChanged),o.provider.on("chainChanged",r.chainChanged),o.provider.on("message",r.message),t(o.provider)}))}export{fe as default};
@@ -1 +0,0 @@
1
- import{_ as o,l as t,n as e,d as r}from"./index-cc453bb1.js";import{G as i}from"./index.es-877101c5.js";import"@ethersproject/address";import"events";import"@ethersproject/providers";import"zustand";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"./_commonjs-dynamic-modules-7cfc9805.js";import"crypto";import"./__tslib-dd22ed7d.js";import"os";import"fs";import"util";import"path";import"worker_threads";import"module";import"url";import"buffer";import"assert";import"./node-ponyfill-55b945e1.js";import"stream";import"http";import"punycode";import"https";import"zlib";function n({chainId:n,rpcUrl:s,rpc:c,walletConnectParams:p,darkMode:a},d){return o(this,void 0,void 0,(function*(){let m,l,h="wss://relay.walletconnect.com",u=!0;p&&(h=p.bridge||h,u=void 0!==p.qrcode?p.qrcode:u,p.infuraId,l=p.qrModalOptions||void 0),c?m=c:n&&s&&(m={[n]:s});const b=t(),j=yield i.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:n?[n]:[],showQrModal:!b,rpcMap:m,qrModalOptions:Object.assign({themeMode:a?"dark":"light"},l)});return j.on("display_uri",(o=>{(null==l?void 0:l.openCallback)&&l.openCallback(o)})),j.on("connect",d.connect),j.on("disconnect",(o=>{d.disconnect(o),d.accountsChanged([])})),j.on("accountsChanged",d.accountsChanged),j.on("chainChanged",d.chainChanged),j.on("message",(({type:o,data:t})=>d.message(o,t))),new Promise((t=>o(this,void 0,void 0,(function*(){b?(j.once("display_uri",(o=>{let i=o;e()&&(i=`rainbow://wc?uri=${encodeURIComponent(o)}&connector=rainbowkit`),window.location.href=i,t(r(j))})),j.enable()):(yield j.enable(),t(r(j)))}))))}))}export{n as default};