Socket
Socket
Sign inDemoInstall

fortmatic

Package Overview
Dependencies
Maintainers
9
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fortmatic - npm Package Compare versions

Comparing version 2.0.0-beta.6 to 2.0.0-beta.7

2

dist/cjs/fortmatic.js

@@ -1,1 +0,1 @@

module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(13)),o(n(16))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),r=n(17);function a(e){var n,i;return e.jsonrpc=e.jsonrpc||t.JSON_RPC_VERSION,e.id=r.getPayloadId(),e.batch||e.method===o.ethPayloadMethodSubset.eth_batchRequest?(e.method=o.ethPayloadMethodSubset.eth_batchRequest,e.batch=null!=(i=null===(n=e.batch)||void 0===n?void 0:n.map((function(e){return a(e)})))?i:[],e):(e.params=e.params||[],e)}t.JSON_RPC_VERSION="2.0",t.createJsonRpcRequestPayload=function(e,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:e,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId()}},t.createJsonRpcBatchRequestPayload=function(e){void 0===e&&(e=[]);var n=Array.isArray(e)?e:[e];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId(),batch:n.filter(Boolean).map((function(e){return a(e)}))}},t.standardizeRequestPayload=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);t.emitWeb3Payload=function(e,t,n){return void 0===n&&(n=[]),new Promise((function(r,a){e.sendAsync(o.createJsonRpcRequestPayload(t,n),(function(e,t){e?a(e):r(t.result)}))}))},t.emitFortmaticPayload=function(e,t){return new Promise((function(n,o){e.sendFortmaticAsync(t,(function(e,t){e?o(e):n(t?t.result:{})}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){this.sdk=e};t.BaseModule=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0);function r(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.batch||e.params)}function a(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.params||e.batch)}t.isJsonRpcBatchRequestPayload=r,t.isJsonRpcRequestPayload=a,t.isJsonRpcResponsePayload=function(e){return!!e&&!(!e.jsonrpc||!e.id||!e.result&&null!==e.result&&!e.error)},t.isFmRequest=function(e){return!(!e||!e.payload)&&a(e.payload)},t.isFmBatchRequest=function(e){return!(!e||!e.payload)&&r(e.payload)},t.isFmPayloadMethod=function(e){return!!e&&("string"==typeof e&&Object.values(o.FmPayloadMethod).includes(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(4),s=n(7);function u(e,t){var n,o,r,a,u,c;!function(e){var t,n,o,r,a,i,s=!!e.data.response.error||!!e.data.response.message||!!e.data.response.code,u={message:(n=null===(t=e.data.response.error)||void 0===t?void 0:t.message,o=null!=n?n:e.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=e.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:e.data.response.code,null!=i?i:1)};e.data.response.error=s?u:null}(t);var l=null!=(o=null===(n=t.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new s.JsonRpcResponse(function(e,t){return t&&i.isJsonRpcBatchRequestPayload(e)&&e.batch.find((function(e){return e.id===t}))||e}(e,l)).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(a=t.data.response)||void 0===a?void 0:a.error),id:(c=null===(u=t.data.response)||void 0===u?void 0:u.id,null!=c?c:void 0)}}var c=function(){function e(e,t){this.endpoint=e}return e.prototype.post=function(e,t,n){return o(this,void 0,void 0,(function(){var o,c=this;return r(this,(function(r){switch(r.label){case 0:return[4,e.iframe];case 1:return o=r.sent(),[2,new Promise((function(e,r){if(o.contentWindow){var l=[],d=i.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(e){return e.id})):[];o.contentWindow.postMessage({msgType:t,payload:n},"*");var p=c.on(a.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(h=function(){p(),f()},function(t){var o=u(n,t),r=o.id,a=o.response;r&&i.isJsonRpcBatchRequestPayload(n)&&d.includes(r)?(l.push(a.payload),l.length===n.batch.length&&(h(),e(l))):r&&r===n.id&&(h(),e(a.payload))})),f=c.on(a.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(t){return function(o){var r=u(n,o),a=r.id,c=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=c.hasError?c.payload:c.applyError(p).payload;if(a&&i.isJsonRpcBatchRequestPayload(n)&&d.includes(a)){l.push(f);for(var h=l.length;h<n.batch.length;h++)l.push(new s.JsonRpcResponse(n.batch[h]).applyError(p).payload);t(),e(l)}else a&&a===n.id&&(t(),e(f))}}((function(){f(),p()})))}else r(new Error("Fortmatic: Modal is not ready."));var h}))]}}))}))},e.prototype.on=function(e,t){var n=this,o=t.bind(window),r=function(t){var r;t.origin===n.endpoint&&t.data&&t.data.msgType===e&&(t.data.response=null!=(r=t.data.response)?r:{},o(t))};return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}},e}();t.FmPayloadTransport=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),r=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):o.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return void 0===e&&(e=null),this._error=e,this},e.prototype.applyResult=function(e){return void 0===e&&(e=null),this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=r},function(e,t,n){e.exports=n(9)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(10);t.default=o.Fortmatic,function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(0))},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(11),u=n(12),c=n(18),l=n(19),d=n(0),p=n(2),f=n(1),h=n(20),y=n(23),_=n(24),m=n(25),v=function(){function e(e){if(!e.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=e.apiKey,this.endpoint=e.endpoint,this.encodedQueryParams=y.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:e.ethNetwork,version:m.version})}return e.prototype.getProvider=function(){var t=_.createOriginSignature(this.endpoint,this.encodedQueryParams);return e.__provider__.has(t.id)||e.__provider__.set(t.id,new h.FmProvider(this.endpoint,this.apiKey,this.encodedQueryParams,t)),e.__provider__.get(t.id)},e.__provider__=new Map,e}();t.SDK=v;var b=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.AUTH_URL})||this;return o.user=new u.PhantomUser(o),o}return r(t,e),t.prototype.loginWithMagicLink=function(e){return a(this,void 0,void 0,(function(){var t,n,o,r;return i(this,(function(a){switch(a.label){case 0:return t=e.email,n=e.showPendingModal,o=void 0===n||n,r=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_auth_login_with_magic_link,[{email:t,showPendingModal:o}]),[4,p.emitFortmaticPayload(this.getProvider(),r)];case 1:return a.sent(),[2,this.user]}}))}))},t}(v);t.PhantomMode=b;var g=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.X_URL})||this;return o.transactions=new c.TransactionsModule(o),o.user=new l.UserModule(o),o}return r(t,e),t.prototype.configure=function(e){void 0===e&&(e={});var t=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_configure,[e]);return p.emitFortmaticPayload(this.getProvider(),t)},t.Phantom=b,t}(v);t.WidgetMode=g,t.Fortmatic=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.X_URL="https://x2.fortmatic.com",t.AUTH_URL="https://auth.fortmatic.com"},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token,[e]);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.PhantomUser=u},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(14)),o(n(15))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.fm_composeSend="fm_composeSend",e.fm_logout="fm_logout",e.fm_get_balances="fm_get_balances",e.fm_get_transactions="fm_get_transactions",e.fm_is_logged_in="fm_is_logged_in",e.fm_accountSettings="fm_accountSettings",e.fm_deposit="fm_deposit",e.fm_get_user="fm_get_user",e.fm_configure="fm_configure",e.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",e.fm_auth_get_access_token="fm_auth_get_access_token",e.fm_auth_get_metadata="fm_auth_get_metadata",e.fm_auth_logout="fm_auth_logout"}(t.FmPayloadMethod||(t.FmPayloadMethod={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",e.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",e.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",e.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",e.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",e.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT",e.FORTMATIC_UNAUTHORIZED_API_KEY="FORTMATIC_UNAUTHORIZED_API_KEY"}(t.FmIncomingWindowMessage||(t.FmIncomingWindowMessage={})),function(e){e.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",e.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",e.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(t.FmOutgoingWindowMessage||(t.FmOutgoingWindowMessage={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithEmail="email",e.LoginWithPhone="phone"}(t.PrimaryLoginOption||(t.PrimaryLoginOption={}))},function(e,t,n){"use strict";var o=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var r=function(){var e;return o(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return r.next().value}},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,e);this.sdk.getProvider().sendFortmaticAsync(n,t)},t}(n(3).BaseModule);t.TransactionsModule=s},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return e.sent(),[2]}}))}))},t.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getUser=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getBalances=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getTransactions=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.settings=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.deposit=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.UserModule=l},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),i=n(0),s=n(2),u=n(1),c=n(4),l=n(21),d=n(6),p=n(22),f=n(7),h=function(){function e(e,t,n,o){this.apiKey=t,this.originSignature=o,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,this.overlay=new l.FmIframeController(e,n,o),this.payloadTransport=new d.FmPayloadTransport(e,o),this.listen()}return e.prototype.sendAsync=function(e,t){if(Array.isArray(e))return this.enqueue({onRequestComplete:t,payload:u.createJsonRpcBatchRequestPayload(e),originSignature:this.originSignature});var n=u.standardizeRequestPayload(e);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:t,payload:n,originSignature:this.originSignature})},e.prototype.sendFortmaticAsync=function(e,t){var n=u.standardizeRequestPayload(e);this.enqueue({onRequestComplete:t,payload:n,isFortmaticMethod:!0,originSignature:this.originSignature})},e.prototype.send=function(e,t){if("string"==typeof e)return s.emitWeb3Payload(this,e,t);if(t)this.sendAsync(e,t);else{console.warn("Non-async web3 methods will be deprecated in web3 > 1.0 and are not supported by the Fortmatic provider. An async method is to be used instead."),this.sendAsync(e,(function(){}));var n=new f.JsonRpcResponse(e);switch(e.method){case a.ethPayloadMethodSubset.eth_accounts:return n.applyResult(this.account?[this.account]:[]).payload;case a.ethPayloadMethodSubset.eth_coinbase:return n.applyResult(this.account).payload;case a.ethPayloadMethodSubset.net_version:return n.applyResult(this.network||(this.apiKey.startsWith("pk_live")?1:4)).payload;case a.ethPayloadMethodSubset.eth_uninstallFilter:return n.applyResult(!0).payload;default:return n.applyResult({}).payload}}},e.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},e.prototype.enqueue=function(e){e&&(this.queue.push(e),this.overlay.overlayReady&&this.dequeue())},e.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var e,t,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(e=this.queue.shift())?(t=e.payload,n=function(e){var n=new f.JsonRpcResponse(e);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,t.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:t.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:t.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(t)?0===t.batch.length?[2,e.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),e.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(t)?[4,this.payloadTransport.post(this.overlay,e.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,4];case 3:s=r.sent(),n(s),s.error?e.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):e.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){e.account=null,e.network=null,e.isLoggedIn=!1})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){throw new Error("Given API key is not authorized to access the resource.")})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,(function(t){e.queue.forEach((function(e){var t=new f.JsonRpcResponse(e.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};e.onRequestComplete(new p.JsonRpcErrorWrapper(n),t.applyError(n).payload)})),e.queue.slice(0)}))},e}();t.FmProvider=h},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(6),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t,n){this.endpoint=e,this.encodedQueryParams=t,this.originSignature=n,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(e,n),this.listen()}return Object.defineProperty(e.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),e.prototype.init=function(){var e=this;return new Promise((function(t){var n=function(){if(0===document.querySelectorAll('[data-fortmatic-iframe-label="'+e.iframeLabel+'"]').length){var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=e.iframeLabel,n.src=e.endpoint+"/send?params="+e.encodedQueryParams,function(e){var t,n;try{for(var o=a(Object.entries(c)),r=o.next();!r.done;r=o.next()){var s=i(r.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),t(n)}else console.error("Fortmatic: Duplicate instances found.")};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},e.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){e._overlayReady=!1})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.FmIframeController=l},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=e.call(this,t.message)||this;return n.code=t.code,n.name="FortmaticError",n}return r(t,e),t}(Error);t.JsonRpcErrorWrapper=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOriginSignature=function(e,t){return{id:"OriginSignature_"+e+"_"+t}}},function(e){e.exports=JSON.parse('{"name":"fortmatic","version":"2.0.0-beta.6","description":"Fortmatic Javascript SDK","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/fortmatic-js"},"keywords":["auth","login","web3","crypto","ethereum","metaMask","wallet","blockchain","dapp"],"homepage":"https://www.fortmatic.com","main":"dist/cjs/fortmatic.js","types":"dist/cjs/src/index.cjs.d.ts","scripts":{"start":"npm run clean:build && ./scripts/start.sh","build":"npm run clean:build && ./scripts/build.sh","test":"npm run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cross-env":"~6.0.3","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","lodash":"~4.17.15","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.7.2","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')}]);
module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(13)),o(n(16))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),r=n(17);function a(e){var n,i;return e.jsonrpc=e.jsonrpc||t.JSON_RPC_VERSION,e.id=r.getPayloadId(),e.batch||e.method===o.ethPayloadMethodSubset.eth_batchRequest?(e.method=o.ethPayloadMethodSubset.eth_batchRequest,e.batch=null!=(i=null===(n=e.batch)||void 0===n?void 0:n.map((function(e){return a(e)})))?i:[],e):(e.params=e.params||[],e)}t.JSON_RPC_VERSION="2.0",t.createJsonRpcRequestPayload=function(e,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:e,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId()}},t.createJsonRpcBatchRequestPayload=function(e){void 0===e&&(e=[]);var n=Array.isArray(e)?e:[e];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId(),batch:n.filter(Boolean).map((function(e){return a(e)}))}},t.standardizeRequestPayload=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);t.emitWeb3Payload=function(e,t,n){return void 0===n&&(n=[]),new Promise((function(r,a){e.sendAsync(o.createJsonRpcRequestPayload(t,n),(function(e,t){e?a(e):r(t.result)}))}))},t.emitFortmaticPayload=function(e,t){return new Promise((function(n,o){e.sendFortmaticAsync(t,(function(e,t){e?o(e):n(t?t.result:{})}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){this.sdk=e};t.BaseModule=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0);function r(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.batch||e.params)}function a(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.params||e.batch)}t.isJsonRpcBatchRequestPayload=r,t.isJsonRpcRequestPayload=a,t.isJsonRpcResponsePayload=function(e){return!!e&&!(!e.jsonrpc||!e.id||!e.result&&null!==e.result&&!e.error)},t.isFmRequest=function(e){return!(!e||!e.payload)&&a(e.payload)},t.isFmBatchRequest=function(e){return!(!e||!e.payload)&&r(e.payload)},t.isFmPayloadMethod=function(e){return!!e&&("string"==typeof e&&Object.values(o.FmPayloadMethod).includes(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),s=n(4),u=n(7);function c(e,t){var n,o,r,a,i,c;!function(e){var t,n,o,r,a,i,s=!!e.data.response.error||!!e.data.response.message||!!e.data.response.code,u={message:(n=null===(t=e.data.response.error)||void 0===t?void 0:t.message,o=null!=n?n:e.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=e.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:e.data.response.code,null!=i?i:1)};e.data.response.error=s?u:null}(t);var l=null!=(o=null===(n=t.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new u.JsonRpcResponse(function(e,t){return t&&s.isJsonRpcBatchRequestPayload(e)&&e.batch.find((function(e){return e.id===t}))||e}(e,l)).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(a=t.data.response)||void 0===a?void 0:a.error),id:(c=null===(i=t.data.response)||void 0===i?void 0:i.id,null!=c?c:void 0)}}var l=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this.messageHandlers=new Set,this.initMessageListener()}return e.prototype.post=function(e,t,n){return o(this,void 0,void 0,(function(){var o,a=this;return r(this,(function(r){switch(r.label){case 0:return[4,e.iframe];case 1:return o=r.sent(),[2,new Promise((function(e,r){if(o.contentWindow){var l=[],d=s.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(e){return e.id})):[];o.contentWindow.postMessage({msgType:t+"-"+a.encodedQueryParams,payload:n},"*");var p=a.on(i.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(h=function(){p(),f()},function(t){var o=c(n,t),r=o.id,a=o.response;r&&s.isJsonRpcBatchRequestPayload(n)&&d.includes(r)?(l.push(a.payload),l.length===n.batch.length&&(h(),e(l))):r&&r===n.id&&(h(),e(a.payload))})),f=a.on(i.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(t){return function(o){var r=c(n,o),a=r.id,i=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=i.hasError?i.payload:i.applyError(p).payload;if(a&&s.isJsonRpcBatchRequestPayload(n)&&d.includes(a)){l.push(f);for(var h=l.length;h<n.batch.length;h++)l.push(new u.JsonRpcResponse(n.batch[h]).applyError(p).payload);t(),e(l)}else a&&a===n.id&&(t(),e(f))}}((function(){f(),p()})))}else r(new Error("Fortmatic: Modal is not ready."));var h}))]}}))}))},e.prototype.on=function(e,t){var n=this,o=t.bind(window),r=function(t){t.data.msgType===e+"-"+n.encodedQueryParams&&o(t)};return this.messageHandlers.add(r),function(){return n.messageHandlers.delete(r)}},e.prototype.initMessageListener=function(){var e=this;window.addEventListener("message",(function(t){var n,o,r;if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){t.data.response=null!=(r=t.data.response)?r:{};try{for(var i=a(e.messageHandlers.values()),s=i.next();!s.done;s=i.next()){(0,s.value)(t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}}))},e}();t.FmPayloadTransport=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),r=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):o.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return void 0===e&&(e=null),this._error=e,this},e.prototype.applyResult=function(e){return void 0===e&&(e=null),this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=r},function(e,t,n){e.exports=n(9)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(10);t.default=o.Fortmatic,function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(0))},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(11),u=n(12),c=n(18),l=n(19),d=n(0),p=n(2),f=n(1),h=n(20),y=n(23),_=n(24),m=function(){function e(e){if(!e.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=e.apiKey,this.endpoint=e.endpoint,this.encodedQueryParams=y.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:e.ethNetwork,host:new URL(this.endpoint).host,sdk:_.name,version:_.version})}return e.prototype.getProvider=function(){return e.__provider__.has(this.encodedQueryParams)||e.__provider__.set(this.encodedQueryParams,new h.FmProvider(this.endpoint,this.apiKey,this.encodedQueryParams)),e.__provider__.get(this.encodedQueryParams)},e.__provider__=new Map,e}();t.SDK=m;var v=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.PHANTOM_URL})||this;return o.user=new u.PhantomUser(o),o}return r(t,e),t.prototype.loginWithMagicLink=function(e){return a(this,void 0,void 0,(function(){var t,n,o,r;return i(this,(function(a){switch(a.label){case 0:return t=e.email,n=e.showPendingModal,o=void 0===n||n,r=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_auth_login_with_magic_link,[{email:t,showPendingModal:o}]),[4,p.emitFortmaticPayload(this.getProvider(),r)];case 1:return a.sent(),[2,this.user]}}))}))},t}(m);t.PhantomMode=v;var b=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.WIDGET_URL})||this;return o.transactions=new c.TransactionsModule(o),o.user=new l.UserModule(o),o}return r(t,e),t.prototype.configure=function(e){void 0===e&&(e={});var t=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_configure,[e]);return p.emitFortmaticPayload(this.getProvider(),t)},t.Phantom=v,t}(m);t.WidgetMode=b,t.Fortmatic=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WIDGET_URL="https://x2.fortmatic.com",t.PHANTOM_URL="https://auth.fortmatic.com"},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token,[e]);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.PhantomUser=u},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(14)),o(n(15))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.fm_composeSend="fm_composeSend",e.fm_logout="fm_logout",e.fm_get_balances="fm_get_balances",e.fm_get_transactions="fm_get_transactions",e.fm_is_logged_in="fm_is_logged_in",e.fm_accountSettings="fm_accountSettings",e.fm_deposit="fm_deposit",e.fm_get_user="fm_get_user",e.fm_configure="fm_configure",e.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",e.fm_auth_get_access_token="fm_auth_get_access_token",e.fm_auth_get_metadata="fm_auth_get_metadata",e.fm_auth_logout="fm_auth_logout"}(t.FmPayloadMethod||(t.FmPayloadMethod={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",e.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",e.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",e.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",e.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",e.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT"}(t.FmIncomingWindowMessage||(t.FmIncomingWindowMessage={})),function(e){e.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",e.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",e.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(t.FmOutgoingWindowMessage||(t.FmOutgoingWindowMessage={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithEmail="email",e.LoginWithPhone="phone"}(t.PrimaryLoginOption||(t.PrimaryLoginOption={}))},function(e,t,n){"use strict";var o=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var r=function(){var e;return o(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return r.next().value}},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,e);this.sdk.getProvider().sendFortmaticAsync(n,t)},t}(n(3).BaseModule);t.TransactionsModule=s},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return e.sent(),[2]}}))}))},t.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getUser=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getBalances=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getTransactions=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.settings=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.deposit=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.UserModule=l},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),i=n(0),s=n(2),u=n(1),c=n(4),l=n(21),d=n(6),p=n(22),f=n(7),h=function(){function e(e,t,n){this.apiKey=t,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,this.overlay=new l.FmIframeController(e,n),this.payloadTransport=new d.FmPayloadTransport(e,n),this.listen()}return e.prototype.sendAsync=function(e,t){if(Array.isArray(e))return this.enqueue({onRequestComplete:t,payload:u.createJsonRpcBatchRequestPayload(e)});var n=u.standardizeRequestPayload(e);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:t,payload:n})},e.prototype.sendFortmaticAsync=function(e,t){var n=u.standardizeRequestPayload(e);this.enqueue({onRequestComplete:t,payload:n,isFortmaticMethod:!0})},e.prototype.send=function(e,t){if("string"==typeof e)return s.emitWeb3Payload(this,e,t);if(t)this.sendAsync(e,t);else{console.warn("Non-async web3 methods will be deprecated in web3 > 1.0 and are not supported by the Fortmatic provider. An async method is to be used instead."),this.sendAsync(e,(function(){}));var n=new f.JsonRpcResponse(e);switch(e.method){case a.ethPayloadMethodSubset.eth_accounts:return n.applyResult(this.account?[this.account]:[]).payload;case a.ethPayloadMethodSubset.eth_coinbase:return n.applyResult(this.account).payload;case a.ethPayloadMethodSubset.net_version:return n.applyResult(this.network||(this.apiKey.startsWith("pk_live")?1:4)).payload;case a.ethPayloadMethodSubset.eth_uninstallFilter:return n.applyResult(!0).payload;default:return n.applyResult({}).payload}}},e.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},e.prototype.enqueue=function(e){e&&(this.queue.push(e),this.overlay.overlayReady&&this.dequeue())},e.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var e,t,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(e=this.queue.shift())?(t=e.payload,n=function(e){var n=new f.JsonRpcResponse(e);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,t.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:t.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:t.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(t)?0===t.batch.length?[2,e.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),e.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(t)?[4,this.payloadTransport.post(this.overlay,e.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,4];case 3:s=r.sent(),n(s),s.error?e.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):e.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){e.account=null,e.network=null,e.isLoggedIn=!1})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,(function(t){e.queue.forEach((function(e){var t=new f.JsonRpcResponse(e.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};e.onRequestComplete(new p.JsonRpcErrorWrapper(n),t.applyError(n).payload)})),e.queue.slice(0)}))},e}();t.FmProvider=h},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(6),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(e,t),this.listen()}return Object.defineProperty(e.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),e.prototype.init=function(){var e=this;return new Promise((function(t){var n=function(){if(r=e.encodedQueryParams,s=[].slice.call(document.querySelectorAll(".fortmatic-iframe")),Boolean(s.find((function(e){var t;return null===(t=e.src)||void 0===t?void 0:t.includes(r)}))))console.error("Fortmatic: Duplicate instances found.");else{var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=e.iframeLabel,n.src=e.endpoint+"/send?params="+e.encodedQueryParams,function(e){var t,n;try{for(var o=a(Object.entries(c)),r=o.next();!r.done;r=o.next()){var s=i(r.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),t(n)}var r,s};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},e.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.FmIframeController=l},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=e.call(this,t.message)||this;return n.code=t.code,n.name="FortmaticError",n}return r(t,e),t}(Error);t.JsonRpcErrorWrapper=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e){e.exports=JSON.parse('{"name":"fortmatic","version":"2.0.0-beta.7","description":"Fortmatic Javascript SDK","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/fortmatic-js"},"keywords":["auth","login","web3","crypto","ethereum","metaMask","wallet","blockchain","dapp"],"homepage":"https://www.fortmatic.com","main":"dist/cjs/fortmatic.js","types":"dist/cjs/src/index.cjs.d.ts","scripts":{"start":"npm run clean:build && ./scripts/start.sh","build":"npm run clean:build && ./scripts/build.sh","test":"npm run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cross-env":"~6.0.3","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","lodash":"~4.17.15","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.7.2","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')}]);

@@ -1,2 +0,2 @@

export declare const X_URL: string;
export declare const AUTH_URL: string;
export declare const WIDGET_URL: string;
export declare const PHANTOM_URL: string;

@@ -1,2 +0,1 @@

import { OriginSignature } from '../types';
/**

@@ -8,7 +7,6 @@ * View controller for the Fortmatic `<iframe>` overlay.

private readonly encodedQueryParams;
private readonly originSignature;
readonly iframe: Promise<HTMLIFrameElement>;
private _overlayReady;
private payloadTransport;
constructor(endpoint: string, encodedQueryParams: string, originSignature: OriginSignature);
constructor(endpoint: string, encodedQueryParams: string);
/**

@@ -15,0 +13,0 @@ * Represents the ready state of the underlying Fortmatic `<iframe>`.

@@ -1,2 +0,2 @@

import { FmIncomingWindowMessage, FmMessageEvent, FmOutgoingWindowMessage, JsonRpcBatchRequestPayload, JsonRpcRequestPayload, JsonRpcResponsePayload, OriginSignature } from '../types';
import { FmIncomingWindowMessage, FmMessageEvent, FmOutgoingWindowMessage, JsonRpcBatchRequestPayload, JsonRpcRequestPayload, JsonRpcResponsePayload } from '../types';
import { FmIframeController } from './fm-iframe-controller';

@@ -16,6 +16,12 @@ interface RemoveEventListenerFunction {

private readonly endpoint;
constructor(endpoint: string, originSignature: OriginSignature);
private readonly encodedQueryParams;
private messageHandlers;
constructor(endpoint: string, encodedQueryParams: string);
/**
* Send a payload to the Fortmatic `<iframe>` for processing and automatically
* handle the acknowledging follow-up event(s).
*
* @param overlay - The `FmIframeController` context to which the event will be posted.
* @param msgType - The type of message to encode with the data.
* @param payload - The JSON RPC payload to emit via `window.postMessage`.
*/

@@ -25,8 +31,14 @@ post(overlay: FmIframeController, msgType: FmOutgoingWindowMessage, payload: JsonRpcRequestPayload): Promise<JsonRpcResponsePayload>;

/**
* Listen for the event given by `msgType`.
* Listen for events received with the given `msgType`.
*
* @param msgType - The `msgType` encoded with the event data.
* @param handler - A handler function to execute on each event received.
* @return A `void` function to remove the attached event.
*/
on(msgType: FmIncomingWindowMessage, handler: (this: Window, event: FmMessageEvent) => void): RemoveEventListenerFunction;
on(msgType: FmIncomingWindowMessage, handler: (this: Window, event: FmMessageEvent) => any): RemoveEventListenerFunction;
/**
* Initialize the underlying `Window.onmessage` event listener.
*/
private initMessageListener;
}
export {};

@@ -1,2 +0,2 @@

import { JsonRpcBatchRequestPayload, JsonRpcRequestCallback, JsonRpcRequestPayload, JsonRpcResponsePayload, OriginSignature } from '../types';
import { JsonRpcBatchRequestPayload, JsonRpcRequestCallback, JsonRpcRequestPayload, JsonRpcResponsePayload } from '../types';
/**

@@ -7,3 +7,2 @@ * Fortmatic's Web3-compliant provider.

private readonly apiKey;
private readonly originSignature;
readonly isFortmatic: boolean;

@@ -16,3 +15,3 @@ private readonly overlay;

isLoggedIn: boolean;
constructor(endpoint: string, apiKey: string, encodedQueryParams: string, originSignature: OriginSignature);
constructor(endpoint: string, apiKey: string, encodedQueryParams: string);
/**

@@ -19,0 +18,0 @@ * Enqueue a native Web3 payload for asynchronous processing.

@@ -7,4 +7,3 @@ export declare enum FmIncomingWindowMessage {

FORTMATIC_USER_DENIED = "FORTMATIC_USER_DENIED",
FORTMATIC_USER_LOGOUT = "FORTMATIC_USER_LOGOUT",
FORTMATIC_UNAUTHORIZED_API_KEY = "FORTMATIC_UNAUTHORIZED_API_KEY"
FORTMATIC_USER_LOGOUT = "FORTMATIC_USER_LOGOUT"
}

@@ -11,0 +10,0 @@ export declare enum FmOutgoingWindowMessage {

@@ -1,6 +0,2 @@

import { FmIncomingWindowMessage } from './fm-message-types';
import { JsonRpcBatchRequestPayload, JsonRpcError, JsonRpcRequestCallback, JsonRpcRequestPayload } from './json-rpc-types';
export interface OriginSignature {
id: string;
}
import { JsonRpcBatchRequestPayload, JsonRpcError, JsonRpcRequestCallback, JsonRpcRequestPayload, JsonRpcResponsePayload } from './json-rpc-types';
/**

@@ -13,3 +9,2 @@ * The shape of payloads encoded by `FmProvider` while they are queued.

isFortmaticMethod?: boolean;
originSignature: OriginSignature;
}

@@ -22,14 +17,7 @@ /**

onRequestComplete: JsonRpcRequestCallback;
originSignature: OriginSignature;
}
/** The shape of responding window message datas from the Fortmatic modal. */
export interface FmResponse<ResultType = any> {
msgType: FmIncomingWindowMessage;
originSignature: OriginSignature;
response: JsonRpcError & {
jsonrpc?: string;
id?: string | number;
result?: ResultType | null;
error?: JsonRpcError | null;
};
msgType: string;
response: Partial<JsonRpcError> & Partial<JsonRpcResponsePayload<ResultType>>;
}

@@ -36,0 +24,0 @@ /** The expected message event returned by the Fortmatic modal. */

@@ -11,2 +11,4 @@ /**

};
host?: string;
sdk?: string;
version?: string;

@@ -13,0 +15,0 @@ }

@@ -1,1 +0,1 @@

window.Fortmatic=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(13)),o(n(16))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),r=n(17);function a(e){var n,i;return e.jsonrpc=e.jsonrpc||t.JSON_RPC_VERSION,e.id=r.getPayloadId(),e.batch||e.method===o.ethPayloadMethodSubset.eth_batchRequest?(e.method=o.ethPayloadMethodSubset.eth_batchRequest,e.batch=null!=(i=null===(n=e.batch)||void 0===n?void 0:n.map((function(e){return a(e)})))?i:[],e):(e.params=e.params||[],e)}t.JSON_RPC_VERSION="2.0",t.createJsonRpcRequestPayload=function(e,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:e,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId()}},t.createJsonRpcBatchRequestPayload=function(e){void 0===e&&(e=[]);var n=Array.isArray(e)?e:[e];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId(),batch:n.filter(Boolean).map((function(e){return a(e)}))}},t.standardizeRequestPayload=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);t.emitWeb3Payload=function(e,t,n){return void 0===n&&(n=[]),new Promise((function(r,a){e.sendAsync(o.createJsonRpcRequestPayload(t,n),(function(e,t){e?a(e):r(t.result)}))}))},t.emitFortmaticPayload=function(e,t){return new Promise((function(n,o){e.sendFortmaticAsync(t,(function(e,t){e?o(e):n(t?t.result:{})}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){this.sdk=e};t.BaseModule=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0);function r(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.batch||e.params)}function a(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.params||e.batch)}t.isJsonRpcBatchRequestPayload=r,t.isJsonRpcRequestPayload=a,t.isJsonRpcResponsePayload=function(e){return!!e&&!(!e.jsonrpc||!e.id||!e.result&&null!==e.result&&!e.error)},t.isFmRequest=function(e){return!(!e||!e.payload)&&a(e.payload)},t.isFmBatchRequest=function(e){return!(!e||!e.payload)&&r(e.payload)},t.isFmPayloadMethod=function(e){return!!e&&("string"==typeof e&&Object.values(o.FmPayloadMethod).includes(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(4),s=n(7);function u(e,t){var n,o,r,a,u,c;!function(e){var t,n,o,r,a,i,s=!!e.data.response.error||!!e.data.response.message||!!e.data.response.code,u={message:(n=null===(t=e.data.response.error)||void 0===t?void 0:t.message,o=null!=n?n:e.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=e.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:e.data.response.code,null!=i?i:1)};e.data.response.error=s?u:null}(t);var l=null!=(o=null===(n=t.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new s.JsonRpcResponse(function(e,t){return t&&i.isJsonRpcBatchRequestPayload(e)&&e.batch.find((function(e){return e.id===t}))||e}(e,l)).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(a=t.data.response)||void 0===a?void 0:a.error),id:(c=null===(u=t.data.response)||void 0===u?void 0:u.id,null!=c?c:void 0)}}var c=function(){function e(e,t){this.endpoint=e}return e.prototype.post=function(e,t,n){return o(this,void 0,void 0,(function(){var o,c=this;return r(this,(function(r){switch(r.label){case 0:return[4,e.iframe];case 1:return o=r.sent(),[2,new Promise((function(e,r){if(o.contentWindow){var l=[],d=i.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(e){return e.id})):[];o.contentWindow.postMessage({msgType:t,payload:n},"*");var p=c.on(a.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(h=function(){p(),f()},function(t){var o=u(n,t),r=o.id,a=o.response;r&&i.isJsonRpcBatchRequestPayload(n)&&d.includes(r)?(l.push(a.payload),l.length===n.batch.length&&(h(),e(l))):r&&r===n.id&&(h(),e(a.payload))})),f=c.on(a.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(t){return function(o){var r=u(n,o),a=r.id,c=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=c.hasError?c.payload:c.applyError(p).payload;if(a&&i.isJsonRpcBatchRequestPayload(n)&&d.includes(a)){l.push(f);for(var h=l.length;h<n.batch.length;h++)l.push(new s.JsonRpcResponse(n.batch[h]).applyError(p).payload);t(),e(l)}else a&&a===n.id&&(t(),e(f))}}((function(){f(),p()})))}else r(new Error("Fortmatic: Modal is not ready."));var h}))]}}))}))},e.prototype.on=function(e,t){var n=this,o=t.bind(window),r=function(t){var r;t.origin===n.endpoint&&t.data&&t.data.msgType===e&&(t.data.response=null!=(r=t.data.response)?r:{},o(t))};return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}},e}();t.FmPayloadTransport=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),r=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):o.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return void 0===e&&(e=null),this._error=e,this},e.prototype.applyResult=function(e){return void 0===e&&(e=null),this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=r},function(e,t,n){e.exports=n(9)},function(e,t,n){"use strict";var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),a=o(n(0));t.default=Object.assign(r.Fortmatic,a)},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(11),u=n(12),c=n(18),l=n(19),d=n(0),p=n(2),f=n(1),h=n(20),y=n(23),_=n(24),m=n(25),v=function(){function e(e){if(!e.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=e.apiKey,this.endpoint=e.endpoint,this.encodedQueryParams=y.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:e.ethNetwork,version:m.version})}return e.prototype.getProvider=function(){var t=_.createOriginSignature(this.endpoint,this.encodedQueryParams);return e.__provider__.has(t.id)||e.__provider__.set(t.id,new h.FmProvider(this.endpoint,this.apiKey,this.encodedQueryParams,t)),e.__provider__.get(t.id)},e.__provider__=new Map,e}();t.SDK=v;var b=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.AUTH_URL})||this;return o.user=new u.PhantomUser(o),o}return r(t,e),t.prototype.loginWithMagicLink=function(e){return a(this,void 0,void 0,(function(){var t,n,o,r;return i(this,(function(a){switch(a.label){case 0:return t=e.email,n=e.showPendingModal,o=void 0===n||n,r=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_auth_login_with_magic_link,[{email:t,showPendingModal:o}]),[4,p.emitFortmaticPayload(this.getProvider(),r)];case 1:return a.sent(),[2,this.user]}}))}))},t}(v);t.PhantomMode=b;var g=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.X_URL})||this;return o.transactions=new c.TransactionsModule(o),o.user=new l.UserModule(o),o}return r(t,e),t.prototype.configure=function(e){void 0===e&&(e={});var t=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_configure,[e]);return p.emitFortmaticPayload(this.getProvider(),t)},t.Phantom=b,t}(v);t.WidgetMode=g,t.Fortmatic=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.X_URL="https://x2.fortmatic.com",t.AUTH_URL="https://auth.fortmatic.com"},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token,[e]);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.PhantomUser=u},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(14)),o(n(15))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.fm_composeSend="fm_composeSend",e.fm_logout="fm_logout",e.fm_get_balances="fm_get_balances",e.fm_get_transactions="fm_get_transactions",e.fm_is_logged_in="fm_is_logged_in",e.fm_accountSettings="fm_accountSettings",e.fm_deposit="fm_deposit",e.fm_get_user="fm_get_user",e.fm_configure="fm_configure",e.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",e.fm_auth_get_access_token="fm_auth_get_access_token",e.fm_auth_get_metadata="fm_auth_get_metadata",e.fm_auth_logout="fm_auth_logout"}(t.FmPayloadMethod||(t.FmPayloadMethod={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",e.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",e.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",e.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",e.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",e.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT",e.FORTMATIC_UNAUTHORIZED_API_KEY="FORTMATIC_UNAUTHORIZED_API_KEY"}(t.FmIncomingWindowMessage||(t.FmIncomingWindowMessage={})),function(e){e.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",e.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",e.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(t.FmOutgoingWindowMessage||(t.FmOutgoingWindowMessage={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithEmail="email",e.LoginWithPhone="phone"}(t.PrimaryLoginOption||(t.PrimaryLoginOption={}))},function(e,t,n){"use strict";var o=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var r=function(){var e;return o(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return r.next().value}},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,e);this.sdk.getProvider().sendFortmaticAsync(n,t)},t}(n(3).BaseModule);t.TransactionsModule=s},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return e.sent(),[2]}}))}))},t.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getUser=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getBalances=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getTransactions=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.settings=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.deposit=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.UserModule=l},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),i=n(0),s=n(2),u=n(1),c=n(4),l=n(21),d=n(6),p=n(22),f=n(7),h=function(){function e(e,t,n,o){this.apiKey=t,this.originSignature=o,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,this.overlay=new l.FmIframeController(e,n,o),this.payloadTransport=new d.FmPayloadTransport(e,o),this.listen()}return e.prototype.sendAsync=function(e,t){if(Array.isArray(e))return this.enqueue({onRequestComplete:t,payload:u.createJsonRpcBatchRequestPayload(e),originSignature:this.originSignature});var n=u.standardizeRequestPayload(e);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:t,payload:n,originSignature:this.originSignature})},e.prototype.sendFortmaticAsync=function(e,t){var n=u.standardizeRequestPayload(e);this.enqueue({onRequestComplete:t,payload:n,isFortmaticMethod:!0,originSignature:this.originSignature})},e.prototype.send=function(e,t){if("string"==typeof e)return s.emitWeb3Payload(this,e,t);if(t)this.sendAsync(e,t);else{console.warn("Non-async web3 methods will be deprecated in web3 > 1.0 and are not supported by the Fortmatic provider. An async method is to be used instead."),this.sendAsync(e,(function(){}));var n=new f.JsonRpcResponse(e);switch(e.method){case a.ethPayloadMethodSubset.eth_accounts:return n.applyResult(this.account?[this.account]:[]).payload;case a.ethPayloadMethodSubset.eth_coinbase:return n.applyResult(this.account).payload;case a.ethPayloadMethodSubset.net_version:return n.applyResult(this.network||(this.apiKey.startsWith("pk_live")?1:4)).payload;case a.ethPayloadMethodSubset.eth_uninstallFilter:return n.applyResult(!0).payload;default:return n.applyResult({}).payload}}},e.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},e.prototype.enqueue=function(e){e&&(this.queue.push(e),this.overlay.overlayReady&&this.dequeue())},e.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var e,t,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(e=this.queue.shift())?(t=e.payload,n=function(e){var n=new f.JsonRpcResponse(e);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,t.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:t.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:t.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(t)?0===t.batch.length?[2,e.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),e.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(t)?[4,this.payloadTransport.post(this.overlay,e.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,4];case 3:s=r.sent(),n(s),s.error?e.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):e.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){e.account=null,e.network=null,e.isLoggedIn=!1})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){throw new Error("Given API key is not authorized to access the resource.")})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,(function(t){e.queue.forEach((function(e){var t=new f.JsonRpcResponse(e.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};e.onRequestComplete(new p.JsonRpcErrorWrapper(n),t.applyError(n).payload)})),e.queue.slice(0)}))},e}();t.FmProvider=h},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(6),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t,n){this.endpoint=e,this.encodedQueryParams=t,this.originSignature=n,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(e,n),this.listen()}return Object.defineProperty(e.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),e.prototype.init=function(){var e=this;return new Promise((function(t){var n=function(){if(0===document.querySelectorAll('[data-fortmatic-iframe-label="'+e.iframeLabel+'"]').length){var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=e.iframeLabel,n.src=e.endpoint+"/send?params="+e.encodedQueryParams,function(e){var t,n;try{for(var o=a(Object.entries(c)),r=o.next();!r.done;r=o.next()){var s=i(r.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),t(n)}else console.error("Fortmatic: Duplicate instances found.")};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},e.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){e._overlayReady=!1})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.FmIframeController=l},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=e.call(this,t.message)||this;return n.code=t.code,n.name="FortmaticError",n}return r(t,e),t}(Error);t.JsonRpcErrorWrapper=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOriginSignature=function(e,t){return{id:"OriginSignature_"+e+"_"+t}}},function(e){e.exports=JSON.parse('{"name":"fortmatic","version":"2.0.0-beta.6","description":"Fortmatic Javascript SDK","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/fortmatic-js"},"keywords":["auth","login","web3","crypto","ethereum","metaMask","wallet","blockchain","dapp"],"homepage":"https://www.fortmatic.com","main":"dist/cjs/fortmatic.js","types":"dist/cjs/src/index.cjs.d.ts","scripts":{"start":"npm run clean:build && ./scripts/start.sh","build":"npm run clean:build && ./scripts/build.sh","test":"npm run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cross-env":"~6.0.3","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","lodash":"~4.17.15","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.7.2","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')}]).default;
window.Fortmatic=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(13)),o(n(16))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),r=n(17);function a(e){var n,i;return e.jsonrpc=e.jsonrpc||t.JSON_RPC_VERSION,e.id=r.getPayloadId(),e.batch||e.method===o.ethPayloadMethodSubset.eth_batchRequest?(e.method=o.ethPayloadMethodSubset.eth_batchRequest,e.batch=null!=(i=null===(n=e.batch)||void 0===n?void 0:n.map((function(e){return a(e)})))?i:[],e):(e.params=e.params||[],e)}t.JSON_RPC_VERSION="2.0",t.createJsonRpcRequestPayload=function(e,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:e,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId()}},t.createJsonRpcBatchRequestPayload=function(e){void 0===e&&(e=[]);var n=Array.isArray(e)?e:[e];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:t.JSON_RPC_VERSION,id:r.getPayloadId(),batch:n.filter(Boolean).map((function(e){return a(e)}))}},t.standardizeRequestPayload=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);t.emitWeb3Payload=function(e,t,n){return void 0===n&&(n=[]),new Promise((function(r,a){e.sendAsync(o.createJsonRpcRequestPayload(t,n),(function(e,t){e?a(e):r(t.result)}))}))},t.emitFortmaticPayload=function(e,t){return new Promise((function(n,o){e.sendFortmaticAsync(t,(function(e,t){e?o(e):n(t?t.result:{})}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){this.sdk=e};t.BaseModule=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0);function r(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.batch||e.params)}function a(e){return!!e&&!(!e.jsonrpc||!e.id||!e.method||!e.params||e.batch)}t.isJsonRpcBatchRequestPayload=r,t.isJsonRpcRequestPayload=a,t.isJsonRpcResponsePayload=function(e){return!!e&&!(!e.jsonrpc||!e.id||!e.result&&null!==e.result&&!e.error)},t.isFmRequest=function(e){return!(!e||!e.payload)&&a(e.payload)},t.isFmBatchRequest=function(e){return!(!e||!e.payload)&&r(e.payload)},t.isFmPayloadMethod=function(e){return!!e&&("string"==typeof e&&Object.values(o.FmPayloadMethod).includes(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),s=n(4),u=n(7);function c(e,t){var n,o,r,a,i,c;!function(e){var t,n,o,r,a,i,s=!!e.data.response.error||!!e.data.response.message||!!e.data.response.code,u={message:(n=null===(t=e.data.response.error)||void 0===t?void 0:t.message,o=null!=n?n:e.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=e.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:e.data.response.code,null!=i?i:1)};e.data.response.error=s?u:null}(t);var l=null!=(o=null===(n=t.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new u.JsonRpcResponse(function(e,t){return t&&s.isJsonRpcBatchRequestPayload(e)&&e.batch.find((function(e){return e.id===t}))||e}(e,l)).applyResult(null===(r=t.data.response)||void 0===r?void 0:r.result).applyError(null===(a=t.data.response)||void 0===a?void 0:a.error),id:(c=null===(i=t.data.response)||void 0===i?void 0:i.id,null!=c?c:void 0)}}var l=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this.messageHandlers=new Set,this.initMessageListener()}return e.prototype.post=function(e,t,n){return o(this,void 0,void 0,(function(){var o,a=this;return r(this,(function(r){switch(r.label){case 0:return[4,e.iframe];case 1:return o=r.sent(),[2,new Promise((function(e,r){if(o.contentWindow){var l=[],d=s.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(e){return e.id})):[];o.contentWindow.postMessage({msgType:t+"-"+a.encodedQueryParams,payload:n},"*");var p=a.on(i.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(h=function(){p(),f()},function(t){var o=c(n,t),r=o.id,a=o.response;r&&s.isJsonRpcBatchRequestPayload(n)&&d.includes(r)?(l.push(a.payload),l.length===n.batch.length&&(h(),e(l))):r&&r===n.id&&(h(),e(a.payload))})),f=a.on(i.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(t){return function(o){var r=c(n,o),a=r.id,i=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=i.hasError?i.payload:i.applyError(p).payload;if(a&&s.isJsonRpcBatchRequestPayload(n)&&d.includes(a)){l.push(f);for(var h=l.length;h<n.batch.length;h++)l.push(new u.JsonRpcResponse(n.batch[h]).applyError(p).payload);t(),e(l)}else a&&a===n.id&&(t(),e(f))}}((function(){f(),p()})))}else r(new Error("Fortmatic: Modal is not ready."));var h}))]}}))}))},e.prototype.on=function(e,t){var n=this,o=t.bind(window),r=function(t){t.data.msgType===e+"-"+n.encodedQueryParams&&o(t)};return this.messageHandlers.add(r),function(){return n.messageHandlers.delete(r)}},e.prototype.initMessageListener=function(){var e=this;window.addEventListener("message",(function(t){var n,o,r;if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){t.data.response=null!=(r=t.data.response)?r:{};try{for(var i=a(e.messageHandlers.values()),s=i.next();!s.done;s=i.next()){(0,s.value)(t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}}))},e}();t.FmPayloadTransport=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),r=function(){function e(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):o.isJsonRpcResponsePayload(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=null,this._error=null)}return e.prototype.applyError=function(e){return void 0===e&&(e=null),this._error=e,this},e.prototype.applyResult=function(e){return void 0===e&&(e=null),this._result=e,this},Object.defineProperty(e.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),e}();t.JsonRpcResponse=r},function(e,t,n){e.exports=n(9)},function(e,t,n){"use strict";var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),a=o(n(0));t.default=Object.assign(r.Fortmatic,a)},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(11),u=n(12),c=n(18),l=n(19),d=n(0),p=n(2),f=n(1),h=n(20),y=n(23),_=n(24),m=function(){function e(e){if(!e.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=e.apiKey,this.endpoint=e.endpoint,this.encodedQueryParams=y.encodeQueryParameters({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:e.ethNetwork,host:new URL(this.endpoint).host,sdk:_.name,version:_.version})}return e.prototype.getProvider=function(){return e.__provider__.has(this.encodedQueryParams)||e.__provider__.set(this.encodedQueryParams,new h.FmProvider(this.endpoint,this.apiKey,this.encodedQueryParams)),e.__provider__.get(this.encodedQueryParams)},e.__provider__=new Map,e}();t.SDK=m;var v=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.PHANTOM_URL})||this;return o.user=new u.PhantomUser(o),o}return r(t,e),t.prototype.loginWithMagicLink=function(e){return a(this,void 0,void 0,(function(){var t,n,o,r;return i(this,(function(a){switch(a.label){case 0:return t=e.email,n=e.showPendingModal,o=void 0===n||n,r=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_auth_login_with_magic_link,[{email:t,showPendingModal:o}]),[4,p.emitFortmaticPayload(this.getProvider(),r)];case 1:return a.sent(),[2,this.user]}}))}))},t}(m);t.PhantomMode=v;var b=function(e){function t(t,n){var o=e.call(this,{apiKey:t,ethNetwork:n,endpoint:s.WIDGET_URL})||this;return o.transactions=new c.TransactionsModule(o),o.user=new l.UserModule(o),o}return r(t,e),t.prototype.configure=function(e){void 0===e&&(e={});var t=f.createJsonRpcRequestPayload(d.FmPayloadMethod.fm_configure,[e]);return p.emitFortmaticPayload(this.getProvider(),t)},t.Phantom=v,t}(m);t.WidgetMode=b,t.Fortmatic=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WIDGET_URL="https://x2.fortmatic.com",t.PHANTOM_URL="https://auth.fortmatic.com"},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.getIdToken=function(e){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token,[e]);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},t.prototype.getMetadata=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.logout=function(){var e=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.PhantomUser=u},function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(14)),o(n(15))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.fm_composeSend="fm_composeSend",e.fm_logout="fm_logout",e.fm_get_balances="fm_get_balances",e.fm_get_transactions="fm_get_transactions",e.fm_is_logged_in="fm_is_logged_in",e.fm_accountSettings="fm_accountSettings",e.fm_deposit="fm_deposit",e.fm_get_user="fm_get_user",e.fm_configure="fm_configure",e.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",e.fm_auth_get_access_token="fm_auth_get_access_token",e.fm_auth_get_metadata="fm_auth_get_metadata",e.fm_auth_logout="fm_auth_logout"}(t.FmPayloadMethod||(t.FmPayloadMethod={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",e.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",e.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",e.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",e.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",e.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT"}(t.FmIncomingWindowMessage||(t.FmIncomingWindowMessage={})),function(e){e.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",e.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",e.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(t.FmOutgoingWindowMessage||(t.FmOutgoingWindowMessage={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.LoginWithEmail="email",e.LoginWithPhone="phone"}(t.PrimaryLoginOption||(t.PrimaryLoginOption={}))},function(e,t,n){"use strict";var o=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var r=function(){var e;return o(this,(function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<Number.MAX_SAFE_INTEGER?[4,++e]:[3,3];case 2:return t.sent(),[3,4];case 3:e=0,t.label=4;case 4:return[3,1];case 5:return[2]}}))}();t.getPayloadId=function(){return r.next().value}},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,e);this.sdk.getProvider().sendFortmaticAsync(n,t)},t}(n(3).BaseModule);t.TransactionsModule=s},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return e.sent(),[2]}}))}))},t.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getUser=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getBalances=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.getTransactions=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.isLoggedIn=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.settings=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t.prototype.deposit=function(){var e=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),e)},t}(n(3).BaseModule);t.UserModule=l},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),i=n(0),s=n(2),u=n(1),c=n(4),l=n(21),d=n(6),p=n(22),f=n(7),h=function(){function e(e,t,n){this.apiKey=t,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,this.overlay=new l.FmIframeController(e,n),this.payloadTransport=new d.FmPayloadTransport(e,n),this.listen()}return e.prototype.sendAsync=function(e,t){if(Array.isArray(e))return this.enqueue({onRequestComplete:t,payload:u.createJsonRpcBatchRequestPayload(e)});var n=u.standardizeRequestPayload(e);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:t,payload:n})},e.prototype.sendFortmaticAsync=function(e,t){var n=u.standardizeRequestPayload(e);this.enqueue({onRequestComplete:t,payload:n,isFortmaticMethod:!0})},e.prototype.send=function(e,t){if("string"==typeof e)return s.emitWeb3Payload(this,e,t);if(t)this.sendAsync(e,t);else{console.warn("Non-async web3 methods will be deprecated in web3 > 1.0 and are not supported by the Fortmatic provider. An async method is to be used instead."),this.sendAsync(e,(function(){}));var n=new f.JsonRpcResponse(e);switch(e.method){case a.ethPayloadMethodSubset.eth_accounts:return n.applyResult(this.account?[this.account]:[]).payload;case a.ethPayloadMethodSubset.eth_coinbase:return n.applyResult(this.account).payload;case a.ethPayloadMethodSubset.net_version:return n.applyResult(this.network||(this.apiKey.startsWith("pk_live")?1:4)).payload;case a.ethPayloadMethodSubset.eth_uninstallFilter:return n.applyResult(!0).payload;default:return n.applyResult({}).payload}}},e.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},e.prototype.enqueue=function(e){e&&(this.queue.push(e),this.overlay.overlayReady&&this.dequeue())},e.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var e,t,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(e=this.queue.shift())?(t=e.payload,n=function(e){var n=new f.JsonRpcResponse(e);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,t.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:t.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:t.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(t)?0===t.batch.length?[2,e.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),e.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(t)?[4,this.payloadTransport.post(this.overlay,e.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,t)]:[3,4];case 3:s=r.sent(),n(s),s.error?e.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):e.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){e.account=null,e.network=null,e.isLoggedIn=!1})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,(function(t){e.queue.forEach((function(e){var t=new f.JsonRpcResponse(e.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};e.onRequestComplete(new p.JsonRpcErrorWrapper(n),t.applyError(n).payload)})),e.queue.slice(0)}))},e}();t.FmProvider=h},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function s(e){try{u(o.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((o=o.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),u=n(6),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function e(e,t){this.endpoint=e,this.encodedQueryParams=t,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(e,t),this.listen()}return Object.defineProperty(e.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),e.prototype.init=function(){var e=this;return new Promise((function(t){var n=function(){if(r=e.encodedQueryParams,s=[].slice.call(document.querySelectorAll(".fortmatic-iframe")),Boolean(s.find((function(e){var t;return null===(t=e.src)||void 0===t?void 0:t.includes(r)}))))console.error("Fortmatic: Duplicate instances found.");else{var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=e.iframeLabel,n.src=e.endpoint+"/send?params="+e.encodedQueryParams,function(e){var t,n;try{for(var o=a(Object.entries(c)),r=o.next();!r.done;r=o.next()){var s=i(r.value,2),u=s[0],l=s[1];e.style[u]=l}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),t(n)}var r,s};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},e.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="block",[2]}}))}))},e.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.iframe];case 1:return e.sent().style.display="none",[2]}}))}))},e.prototype.listen=function(){var e=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){e._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){e.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){e.showOverlay()}))},e}();t.FmIframeController=l},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=e.call(this,t.message)||this;return n.code=t.code,n.name="FortmaticError",n}return r(t,e),t}(Error);t.JsonRpcErrorWrapper=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeQueryParameters=function(e){return btoa(JSON.stringify(e))},t.decodeQueryParameters=function(e){return JSON.parse(atob(e))}},function(e){e.exports=JSON.parse('{"name":"fortmatic","version":"2.0.0-beta.7","description":"Fortmatic Javascript SDK","author":"Fortmatic <team@fortmatic.com> (https://fortmatic.com/)","license":"MIT","repository":{"type":"git","url":"https://github.com/fortmatic/fortmatic-js"},"keywords":["auth","login","web3","crypto","ethereum","metaMask","wallet","blockchain","dapp"],"homepage":"https://www.fortmatic.com","main":"dist/cjs/fortmatic.js","types":"dist/cjs/src/index.cjs.d.ts","scripts":{"start":"npm run clean:build && ./scripts/start.sh","build":"npm run clean:build && ./scripts/build.sh","test":"npm run clean:test-artifacts && ./scripts/test.sh","lint":"eslint --fix src/**/*.ts","clean":"npm-run-all -s clean:*","clean:test-artifacts":"rimraf coverage && rimraf .nyc_output","clean:build":"rimraf dist","clean_node_modules":"rimraf node_modules"},"dependencies":{},"devDependencies":{"@ikscodes/browser-env":"~0.3.1","@ikscodes/eslint-config":"~6.2.0","@ikscodes/prettier-config":"^0.1.0","@istanbuljs/nyc-config-typescript":"~0.1.3","@types/jsdom":"~12.2.4","@types/sinon":"~7.5.0","@types/webpack":"~4.41.0","@typescript-eslint/eslint-plugin":"~2.17.0","ava":"2.2.0","cross-env":"~6.0.3","eslint":"~6.8.0","eslint-import-resolver-typescript":"~2.0.0","eslint-plugin-import":"~2.20.0","eslint-plugin-jsx-a11y":"~6.2.3","eslint-plugin-prettier":"~3.1.2","eslint-plugin-react":"~7.18.0","eslint-plugin-react-hooks":"~1.7.0","lodash":"~4.17.15","npm-run-all":"~4.1.5","nyc":"13.1.0","prettier":"~1.19.1","rimraf":"~3.0.0","sinon":"7.1.1","ts-loader":"~6.2.1","ts-node":"~8.5.2","typescript":"~3.7.2","webpack":"~4.41.2","webpack-chain":"~6.2.0","webpack-cli":"~3.3.10"},"ava":{"require":["ts-node/register"],"files":["test/**/*.spec.ts"],"extensions":["ts"],"compileEnhancements":false,"verbose":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":false,"check-coverage":true,"per-file":true,"lines":99,"statements":99,"functions":99,"branches":99,"reporter":["html","lcov"]}}')}]).default;
{
"name": "fortmatic",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.7",
"description": "Fortmatic Javascript SDK",

@@ -5,0 +5,0 @@ "author": "Fortmatic <team@fortmatic.com> (https://fortmatic.com/)",

# Fortmatic Javascript SDK
Fortmatic JavaScript SDK lets developers conveniently connect their web apps
to the Ethereum blockchain - allowing end-users to interact with their apps on
any modern browser, without requiring them to download any browser extensions or
mobile dApp browsers.
Fortmatic JavaScript SDK lets developers conveniently connect their web apps to the Ethereum blockchain - allowing end-users to interact with their apps on any modern browser, without requiring them to download any browser extensions or mobile dApp browsers.
## Documentation
See the [Developer Documentation](https://developers.fortmatic.com).
See the [Developer Documentation](https://docs.fortmatic.com).

@@ -17,6 +14,10 @@ ## Installation

```bash
# Via NPM:
npm install --save fortmatic
# Via Yarn:
yarn add fortmatic
```
Alternatively you can add this script tag to your app’s `<head>`:
Alternatively you can load via CDN with by adding a script tag to your app’s `<head>`:

@@ -29,8 +30,5 @@ ```html

Sign up or log in to your [Developer Dashboard](https://dashboard.fortmatic.com) to receive API keys that will allow your app to interact with the Ethereum blockchain through Fortmatic.
Sign up or log in to the [Developer Dashboard](https://dashboard.fortmatic.com) to receive API keys that will allow your app to interact with the Ethereum blockchain through Fortmatic.
You can then integrate by simply replacing your web3 provider with Fortmatic
provider. Now instead of the MetaMask Chrome Extension opening, a Fortmatic
modal will open instead - requiring no extra user downloads, and works on all
modern desktop and mobile Chrome, Safari and Firefox browsers.
You can then integrate by simply replacing your web3 provider with Fortmatic provider. Now, instead of the MetaMask Chrome Extension opening, a Fortmatic modal will show instead—requiring no additional user downloads. Fortmatic works across all modern desktop, mobile Chrome, Safari and Firefox browsers.

@@ -37,0 +35,0 @@ ```jspx

[
"X_URL",
"AUTH_URL"
"WIDGET_URL",
"PHANTOM_URL"
]

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc