@dodoex/wallet-web3 0.0.22-2 → 0.0.22-4
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.
- package/dist/__node-resolve_empty-8632adc3.js +1 -0
- package/dist/__tslib-6ff4d83f.js +1 -0
- package/dist/blocto-532eeb3b.js +7 -0
- package/dist/bn-d8b2aa48.js +1 -0
- package/dist/browser-ponyfill-17a49e59.js +1 -0
- package/dist/cjs/__node-resolve_empty-e6311036.cjs +1 -0
- package/dist/cjs/__tslib-b9bb49bb.cjs +1 -0
- package/dist/cjs/blocto-dc83ab21.cjs +7 -0
- package/dist/cjs/bn-2f18fb63.cjs +1 -0
- package/dist/cjs/browser-ponyfill-4411ec49.cjs +1 -0
- package/dist/cjs/ethers-bc02633f.cjs +1 -0
- package/dist/cjs/id-4255a5f8.cjs +1 -0
- package/dist/cjs/{index-4585c950.cjs → index-0ec82476.cjs} +1 -1
- package/dist/cjs/{index-f2c04d55.cjs → index-165c948d.cjs} +1 -1
- package/dist/cjs/index-217a1036.cjs +46 -0
- package/dist/cjs/{index-4abb9db3.cjs → index-27942063.cjs} +1 -1
- package/dist/cjs/index-3e255821.cjs +1 -0
- package/dist/cjs/index-4e5d1d8d.cjs +1 -0
- package/dist/cjs/index-4f2d1da0.cjs +15 -0
- package/dist/cjs/index-5672be01.cjs +1 -0
- package/dist/cjs/index-8e209085.cjs +10 -0
- package/dist/cjs/{index-5d7b94fd.cjs → index-979d2927.cjs} +1 -1
- package/dist/cjs/index-cf3bf3b5.cjs +3 -0
- package/dist/cjs/{index-3d1a3da9.cjs → index-df8e5839.cjs} +1 -1
- package/dist/cjs/index-eb09e54d.cjs +60 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.es-fa952979.cjs +9 -0
- package/dist/cjs/{interface-1b54eefa.cjs → interface-c0ab0ac8.cjs} +1 -1
- package/dist/cjs/portis-c69e492c.cjs +24 -0
- package/dist/cjs/{provider-403219c9.cjs → provider-692e5c89.cjs} +1 -1
- package/dist/cjs/rainbow-d0f3ec18.cjs +1 -0
- package/dist/cjs/uAuth-43d34532.cjs +1 -0
- package/dist/cjs/walletConnect-c0e36fea.cjs +1 -0
- package/dist/cjs/walletLink-7b9716e2.cjs +1 -0
- package/dist/ethers-7757efa9.js +1 -0
- package/dist/id-8c638e81.js +1 -0
- package/dist/index-0ee5ef8d.js +60 -0
- package/dist/index-30664326.js +10 -0
- package/dist/index-40f05896.js +15 -0
- package/dist/index-4e992427.js +1 -0
- package/dist/index-5a901c0e.js +2 -0
- package/dist/{index-650785ec.js → index-77db3261.js} +1 -1
- package/dist/{index-de37f6bb.js → index-82bd9877.js} +1 -1
- package/dist/index-89309b1f.js +1 -0
- package/dist/index-b54cb21d.js +46 -0
- package/dist/{index-235259d8.js → index-bab1214b.js} +1 -1
- package/dist/index-c2c42137.js +1 -0
- package/dist/index-c8690ee6.js +1 -0
- package/dist/{index-5f9e8321.js → index-e0d3617a.js} +1 -1
- package/dist/index.es-571d50ca.js +9 -0
- package/dist/index.js +1 -1
- package/dist/{interface-f97a878a.js → interface-2082dd3f.js} +1 -1
- package/dist/portis-fb908c06.js +24 -0
- package/dist/{provider-453e2483.js → provider-6caed3b7.js} +1 -1
- package/dist/rainbow-98eb30ca.js +1 -0
- package/dist/uAuth-034cff41.js +1 -0
- package/dist/walletConnect-2c923830.js +1 -0
- package/dist/walletLink-d4240be5.js +1 -0
- package/package.json +1 -1
- package/dist/__tslib-dd22ed7d.js +0 -1
- package/dist/blocto-69a506f8.js +0 -1
- package/dist/bn-3e892825.js +0 -1
- package/dist/cjs/__tslib-8344f379.cjs +0 -1
- package/dist/cjs/blocto-bdab3cea.cjs +0 -1
- package/dist/cjs/bn-ce9dbccd.cjs +0 -1
- package/dist/cjs/ethers-767c2337.cjs +0 -1
- package/dist/cjs/id-6c4d97dd.cjs +0 -1
- package/dist/cjs/index-2428f0a6.cjs +0 -1
- package/dist/cjs/index-659dc842.cjs +0 -61
- package/dist/cjs/index-67e59d1a.cjs +0 -1
- package/dist/cjs/index-795ad993.cjs +0 -46
- package/dist/cjs/index-a5fa1e6e.cjs +0 -15
- package/dist/cjs/index-aa04e7a3.cjs +0 -1
- package/dist/cjs/index-cfe3e391.cjs +0 -10
- package/dist/cjs/index-d226aab9.cjs +0 -8
- package/dist/cjs/index-e875b498.cjs +0 -1
- package/dist/cjs/index.es-a3704620.cjs +0 -9
- package/dist/cjs/node-ponyfill-a7a0b431.cjs +0 -1
- package/dist/cjs/portis-ec0ce54d.cjs +0 -1
- package/dist/cjs/rainbow-caa66e39.cjs +0 -1
- package/dist/cjs/uAuth-a2d2617a.cjs +0 -1
- package/dist/cjs/walletConnect-c57b3b5d.cjs +0 -1
- package/dist/cjs/walletLink-f0f9e2a7.cjs +0 -3
- package/dist/ethers-51e19435.js +0 -1
- package/dist/id-830e09aa.js +0 -1
- package/dist/index-3158e93a.js +0 -46
- package/dist/index-46c2059e.js +0 -1
- package/dist/index-5091218e.js +0 -1
- package/dist/index-6bf494b0.js +0 -1
- package/dist/index-80483be2.js +0 -8
- package/dist/index-82b4fd64.js +0 -60
- package/dist/index-88837567.js +0 -1
- package/dist/index-c699a924.js +0 -1
- package/dist/index-cc453bb1.js +0 -10
- package/dist/index-f3052552.js +0 -15
- package/dist/index.es-877101c5.js +0 -9
- package/dist/node-ponyfill-55b945e1.js +0 -1
- package/dist/portis-7d46b7ed.js +0 -1
- package/dist/rainbow-61a52379.js +0 -1
- package/dist/uAuth-40d8acab.js +0 -1
- package/dist/walletConnect-d6a9aa67.js +0 -1
- package/dist/walletLink-106461e6.js +0 -3
- /package/dist/cjs/{index-47f3e61d.cjs → index-70269942.cjs} +0 -0
- /package/dist/{index-0103e089.js → index-6be6f872.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./index-cfe3e391.cjs");function t(e,t){var i="string"==typeof e?Object.assign({},n[e]):e;if("object"!=typeof i)throw new Error("[Portis] illegal 'network' parameter. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(!i.nodeUrl)throw new Error("[Portis] 'nodeUrl' is required. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(t&&!i.gasRelayHubAddress)throw new Error("[Portis] can't find default gas relay hub for "+e);return"string"!=typeof e||t||delete i.gasRelayHubAddress,i}require("events"),require("@ethersproject/providers"),require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/address"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");var n={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"}},i=function(){return!("undefined"==typeof window||!window.document)},r=!1;function o(){return new Promise((function(e,t){i()?r?e():["loaded","interactive","complete"].indexOf(document.readyState)>-1?(r=!0,e()):window.addEventListener("load",(function(){r=!0,e()}),!1):t()}))}function a(){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 s={};Object.defineProperty(s,"__esModule",{value:!0});var c=s.default=s.ERR_NOT_IN_IFRAME=s.ERR_CONNECTION_TIMEOUT=s.ERR_CONNECTION_DESTROYED=void 0,u="handshake",d="handshake-reply",l="call",h="reply",f="fulfilled",g="rejected",p="message",v="ConnectionDestroyed";s.ERR_CONNECTION_DESTROYED=v;var m="ConnectionTimeout";s.ERR_CONNECTION_TIMEOUT=m;var w="NotInIframe";s.ERR_NOT_IN_IFRAME=w;var b,y={"http:":"80","https:":"443"},_=/^(https?:)?\/\/([^/:]+)(:(\d+))?/,E={ERR_CONNECTION_DESTROYED:v,ERR_CONNECTION_TIMEOUT:m,ERR_NOT_IN_IFRAME:w,Promise:function(){try{return window?window.Promise:null}catch(e){return null}}(),debug:!1},C=(b=0,function(){return++b}),P=function(){if(E.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))}},k=function(e){var t=[];return e((function(){t.forEach((function(e){e()}))})),{then:function(e){t.push(e)}}},I=function(e){return{name:e.name,message:e.message,stack:e.stack}},W=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 E.Promise((function(t,i){var c=C();o.addEventListener(p,(function n(u){if(u.source===a&&u.origin===s&&u.data.penpal===h&&u.data.id===c){P("".concat(r,": Received ").concat(e,"() reply")),o.removeEventListener(p,n);var d=u.data.returnValue;u.data.returnValueIsError&&(l=d,g=new Error,Object.keys(l).forEach((function(e){return g[e]=l[e]})),d=g),(u.data.resolution===f?t:i)(d)}var l,g})),a.postMessage({penpal:l,id:c,methodName:e,args:n},s)}))}};i.then((function(){c=!0})),n.reduce((function(e,t){return e[t]=u(t),e}),e)},x=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===l){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:h,id:u,resolution:e,returnValue:t};e===g&&t instanceof Error&&(n.returnValue=I(t),n.returnValueIsError=!0);try{o.postMessage(n,a)}catch(e){throw"DataCloneError"===e.name&&o.postMessage({penpal:h,id:u,resolution:g,returnValue:I(e),returnValueIsError:!0},a),e}}}};new E.Promise((function(e){return e(t[r].apply(t,c))})).then(d(f),d(g))}}};r.addEventListener(p,c),n.then((function(){s=!0,r.removeEventListener(p,c)}))};E.connectToChild=function(e){var t,n=e.url,i=e.appendTo,r=e.methods,o=void 0===r?{}:r,a=e.timeout,s=new k((function(e){t=e})),c=window,l=document.createElement("iframe");(i||document.body).appendChild(l),s.then((function(){l.parentNode&&l.parentNode.removeChild(l)}));var h=l.contentWindow||l.contentDocument.parentWindow,f=function(e){var t,n,i,r=document.location,o=_.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!==y[t]?":".concat(i):"";return"".concat(t,"//").concat(n).concat(a)}(n);return{promise:new E.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=m,i(e),t()}),a));var g,w,b={},y=function(t){if(t.source===h&&t.origin===f&&t.data.penpal===u){P("Parent: Received handshake, sending reply"),t.source.postMessage({penpal:d,methodNames:Object.keys(o)},t.origin);var n={localName:"Parent",local:c,remote:h,remoteOrigin:t.origin};w&&w();var i=new k((function(e){s.then(e),w=e}));x(n,o,i),g&&g.forEach((function(e){delete b[e]})),g=t.data.methodNames,W(b,n,g,s),clearTimeout(r),e(b)}};c.addEventListener(p,y),s.then((function(){c.removeEventListener(p,y);var e=new Error("Connection destroyed");e.code=v,i(e)})),P("Parent: Loading iframe"),l.src=n})),iframe:l,destroy:t}},E.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=w,s}var c=new k((function(t){e=t})),l=window,h=l.parent,f=new E.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=m,n(t),e()}),a));var s=function e(n){if(("*"===i||i===n.origin)&&n.source===h&&n.data.penpal===d){P("Child: Received handshake reply"),l.removeEventListener(p,e);var a={localName:"Child",local:l,remote:h,remoteOrigin:n.origin},s={};x(a,o,c),W(s,a,n.data.methodNames,c),clearTimeout(r),t(s)}};l.addEventListener(p,s),c.then((function(){l.removeEventListener(p,s);var e=new Error("Connection destroyed");e.code=v,n(e)})),P("Child: Sending handshake"),h.postMessage({penpal:u,methodNames:Object.keys(o)},i)}));return{promise:f,destroy:e}};var T=E;c=s.default=T;var A=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())}))},O=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])}}},M=process.env.PORTIS_WIDGET_URL||"https://widget.portis.io",N="por_portis-widget-frame",L="por_portis-container";var R=function(){function e(t,n){this._widgetConfig=t,this._clearProviderSession=n,this._widgetUrl=M,this._onLoginCallback=function(){},this._onLogoutCallback=function(){},this._onErrorCallback=function(){},a(),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 A(this,void 0,void 0,(function(){var e;return O(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 A(this,void 0,void 0,(function(){return O(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 A(this,void 0,void 0,(function(){return O(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 A(this,void 0,void 0,(function(){return O(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 A(this,void 0,void 0,(function(){return O(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"),A(this,void 0,void 0,(function(){return O(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 A(this,void 0,void 0,(function(){return O(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 A(this,void 0,void 0,(function(){return O(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 A(this,void 0,void 0,(function(){return O(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"),A(this,void 0,void 0,(function(){return O(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 A(this,void 0,void 0,(function(){return O(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(L).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 A(this,void 0,void 0,(function(){var t,n,i,r,a;return O(this,(function(s){switch(s.label){case 0:return[4,o()];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=L,(i=document.createElement("div")).id="portis-container-"+Date.now(),i.className=N,n.appendChild(i),document.body.appendChild(n),document.head.appendChild(t),[4,(r=c.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(a=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:a,widgetFrame:i}]}}))}))},e.prototype._setHeight=function(e){return A(this,void 0,void 0,(function(){return O(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}(),S=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())}))},D=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])}}},j=require("ethereumjs-util"),U=j.addHexPrefix,B=j.stripHexPrefix,q=j.BN,F="0x5208";function G(e,t){return S(this,void 0,void 0,(function(){var n,i,r,o,a;return D(this,(function(s){switch(s.label){case 0:return[4,e.getBlockByNumber("latest",!1)];case 1:return n=s.sent(),[4,V(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,H(e,t,n.gasLimit,r)];case 4:return[2,s.sent()];case 5:return s.sent(),[2,r];case 6:return[2]}}))}))}function V(e,t,n){return S(this,void 0,void 0,(function(){var i,r,o;return D(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:F,simpleSend:!0,gasLimitSpecified:!1}]}a.label=2;case 2:return o=K(n),s=o,c=20,u=new q(19),d=new q(c),[2,{safeGas:Y(s.mul(u).div(d)),simpleSend:!1,gasLimitSpecified:!1}]}var s,c,u,d}))}))}function H(e,t,n,i){return S(this,void 0,void 0,(function(){var r;return D(this,(function(o){switch(o.label){case 0:return t.gas=i,r=U,[4,e.estimateGas(t)];case 1:return[2,z(r.apply(void 0,[o.sent()]),n)]}}))}))}function z(e,t){var n=K(e),i=K(t).muln(.9),r=n.muln(1.5);return n.gt(i)?Y(n):r.lt(i)?Y(r):Y(i)}function K(e){return new q(B(e),16)}function Y(e){return U(e.toString(16))}var J=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}(),Q=function(){return Q=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},Q.apply(this,arguments)},X=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())}))},Z=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])}}},$=require("web3-provider-engine"),ee=require("web3-provider-engine/dist/es5/subproviders/cache.js"),te=require("web3-provider-engine/dist/es5/subproviders/fixture.js"),ne=require("web3-provider-engine/dist/es5/subproviders/filters.js"),ie=require("web3-provider-engine/dist/es5/subproviders/hooked-wallet.js"),re=require("web3-provider-engine/dist/es5/subproviders/nonce-tracker.js"),oe=require("web3-provider-engine/dist/es5/subproviders/subscriptions.js"),ae=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,n){var i=t(e,n);this.clearSubprovider(re),this.clearSubprovider(ee),this.config.network=i},e.prototype._initProvider=function(){var e=this;if(this.engine)return this.engine;this.engine=new $;var t=new J(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 te({web3_clientVersion:"Portis/v"+this.config.version+"/javascript",net_listening:!0,eth_hashrate:"0x00",eth_mining:!1,eth_syncing:!0})),this.engine.addProvider(new ee),this.engine.addProvider(new oe),this.engine.addProvider(new ne),this.engine.addProvider(new re),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,n){return X(e,void 0,void 0,(function(){return Z(this,(function(e){return t.id||(t.id=42),n(),[2]}))}))}}),this.engine.addProvider(new ie({getAccounts:function(t){return X(e,void 0,void 0,(function(){var e,n,i;return Z(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 X(e,void 0,void 0,(function(){var e,i,r;return Z(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 X(e,void 0,void 0,(function(){var e,i,r,o,a;return Z(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=Q({},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 X(e,void 0,void 0,(function(){var e,i,r,o,a;return Z(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=Q({},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 X(e,void 0,void 0,(function(){var e,i,r,o,a;return Z(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=Q({},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 X(e,void 0,void 0,(function(){var e,i,r,o,a;return Z(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),i=Q({},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 X(e,void 0,void 0,(function(){var e;return Z(this,(function(r){switch(r.label){case 0:return[4,G(t,n)];case 1:return e=r.sent(),i(null,e),[2]}}))}))},getGasPrice:function(t){return X(e,void 0,void 0,(function(){return Z(this,(function(e){return t(null,""),[2]}))}))}})),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,n,i){return X(e,void 0,void 0,(function(){var e,n,r;return Z(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}(),se=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())}))},ce=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])}}},ue=["email","reputation"];o().then((function(){document.getElementsByClassName(N).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 de=function(){function e(e,n,r){if(void 0===r&&(r={}),!i())return new Proxy(this,{get:function(e,t){return e[t]instanceof Function?function(){}:void 0}});a(),this._validateParams(e,n,r),this._config={dappId:e,network:t(n,r.gasRelay),version:"4.0.7",scope:r.scope,registerPageByDefault:r.registerPageByDefault,staging:r.staging,feature:r.feature},this._getWidgetCommunication=this._getWidgetCommunication.bind(this),this._widgetManagerInstance=new R(this.config,this._clearProviderSession),this._web3ManagerInstance=new ae(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 se(this,void 0,void 0,(function(){return ce(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 se(this,void 0,void 0,(function(){return ce(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 se(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,this._widgetManager.showPortis()]}))}))},e.prototype.getCampaignInfo=function(e){return se(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._widgetManager.getCampaignInfo(e)]}))}))},e.prototype.claimVoucher=function(e){return se(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._widgetManager.claimVoucher(e)]}))}))},e.prototype.logout=function(){return se(this,void 0,void 0,(function(){return ce(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"),se(this,void 0,void 0,(function(){return ce(this,(function(n){return[2,this._widgetManager.getExtendedPublicKey(e,t)]}))}))},e.prototype.importWallet=function(e){return se(this,void 0,void 0,(function(){return ce(this,(function(t){return[2,this._widgetManager.importWallet(e)]}))}))},e.prototype.isLoggedIn=function(){return se(this,void 0,void 0,(function(){return ce(this,(function(e){return[2,this._widgetManager.isLoggedIn()]}))}))},e.prototype.signBitcoinTransaction=function(e){return se(this,void 0,void 0,(function(){return ce(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"),se(this,void 0,void 0,(function(){return ce(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 ue.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}(),le=de;exports.default=function({chainId:t,portisParams:n},i){return e.__awaiter(this,void 0,void 0,(function*(){if(!(null==n?void 0:n.id))throw new Error("uAuthParams is not valid.");let r="";switch(t){case 1:default:r="mainnet";break;case 5:r="goerli"}const o=new le(n.id,r,n.config);return yield o.provider.enable(),o.provider._portis=o,o.provider.on("connect",i.connect),o.provider.on("disconnect",i.disconnect),o.provider.on("accountsChanged",i.accountsChanged),o.provider.on("chainChanged",i.chainChanged),o.provider.on("message",i.message),e.convertWeb3Provider(o.provider)}))};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./index-cfe3e391.cjs"),r=require("./index.es-a3704620.cjs");require("@ethersproject/address"),require("events"),require("@ethersproject/providers"),require("zustand"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),require("./_commonjs-dynamic-modules-f09a98c7.cjs"),require("crypto"),require("./__tslib-8344f379.cjs"),require("os"),require("fs"),require("util"),require("path"),require("worker_threads"),require("module"),require("url"),require("buffer"),require("assert"),require("./node-ponyfill-a7a0b431.cjs"),require("stream"),require("http"),require("punycode"),require("https"),require("zlib"),exports.default=function({chainId:i,rpcUrl:o,rpc:t,walletConnectParams:n,darkMode:c},s){return e.__awaiter(this,void 0,void 0,(function*(){let a,d,u="wss://relay.walletconnect.com",l=!0;n&&(u=n.bridge||u,l=void 0!==n.qrcode?n.qrcode:l,n.infuraId,d=n.qrModalOptions||void 0),t?a=t:i&&o&&(a={[i]:o});const q=e.getIsMobile(),p=yield r.G.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:i?[i]:[],showQrModal:!q,rpcMap:a,qrModalOptions:Object.assign({themeMode:c?"dark":"light"},d)});return p.on("display_uri",(e=>{(null==d?void 0:d.openCallback)&&d.openCallback(e)})),p.on("connect",s.connect),p.on("disconnect",(e=>{s.disconnect(e),s.accountsChanged([])})),p.on("accountsChanged",s.accountsChanged),p.on("chainChanged",s.chainChanged),p.on("message",(({type:e,data:r})=>s.message(e,r))),new Promise((r=>e.__awaiter(this,void 0,void 0,(function*(){q?(p.once("display_uri",(i=>{let o=i;e.getIsIOS()&&(o=`rainbow://wc?uri=${encodeURIComponent(i)}&connector=rainbowkit`),window.location.href=o,r(e.convertWeb3Provider(p))})),p.enable()):(yield p.enable(),r(e.convertWeb3Provider(p)))}))))}))};
|