Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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-54c5cfd8.12 to 2.0.0-54c5cfd8.13

2

dist/cjs/fortmatic.js

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

module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(13)),o(n(17))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(6),r=n(19);function a(t){var n,i;return t.jsonrpc=t.jsonrpc||e.JSON_RPC_VERSION,t.id=r.createRandomId(),t.batch||t.method===o.ethPayloadMethodSubset.eth_batchRequest?(t.method=o.ethPayloadMethodSubset.eth_batchRequest,t.batch=null!=(i=null===(n=t.batch)||void 0===n?void 0:n.map((function(t){return a(t)})))?i:[],t):(t.params=t.params||[],t)}e.JSON_RPC_VERSION="2.0",e.createJsonRpcRequestPayload=function(t,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:t,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId()}},e.createJsonRpcBatchRequestPayload=function(t){void 0===t&&(t=[]);var n=Array.isArray(t)?t:[t];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId(),batch:n.filter(Boolean).map((function(t){return a(t)}))}},e.standardizeRequestPayload=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.emitWeb3Payload=function(t,e,n){return void 0===n&&(n=[]),new Promise((function(r,a){t.sendAsync(o.createJsonRpcRequestPayload(e,n),(function(t,e){t?a(t):r(e.result)}))}))},e.emitFortmaticPayload=function(t,e){return new Promise((function(n,o){t.sendFortmaticAsync(e,(function(t,e){t?o(t):n(e?e.result:{})}))}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.WidgetMode.__instance__},enumerable:!0,configurable:!0}),t}();e.WidgetModule=r;var a=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.PhantomMode.__instance__},enumerable:!0,configurable:!0}),t}();e.PhantomModule=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);function r(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.batch||t.params)}function a(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.params||t.batch)}e.isJsonRpcBatchRequestPayload=r,e.isJsonRpcRequestPayload=a,e.isJsonRpcResponsePayload=function(t){return!!t&&!(!t.jsonrpc||!t.id||!t.result&&null!==t.result&&!t.error)},e.isFmRequest=function(t){return!(!t||!t.payload)&&a(t.payload)},e.isFmBatchRequest=function(t){return!(!t||!t.payload)&&r(t.payload)},e.isFmPayloadMethod=function(t){return!!t&&("string"==typeof t&&Object.values(o.FmPayloadMethod).includes(t))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__decorate||function(t,e,n,o){var r,a=arguments.length,i=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i},i=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var u=n(11),c=n(12),l=n(20),d=n(21),p=n(0),f=n(22),h=n(2),y=n(1),_=n(23),m=function(){function t(t){if(!t.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=t.apiKey,this.chainName=t.chainName,this.endpoint=t.endpoint}return t.prototype.getProvider=function(){return this.__provider__||(this.__provider__=new _.FmProvider(this.endpoint,this.apiKey,this.chainName)),this.__provider__},t}(),v=function(t){function e(e,n){void 0===n&&(n=u.AUTH_URL);var o=t.call(this,{apiKey:e,endpoint:n})||this;return o.user=new c.PhantomUser,o}return r(e,t),e.prototype.loginWithMagicLink=function(t){return i(this,void 0,void 0,(function(){var e,n;return s(this,(function(o){switch(o.label){case 0:return[4,this.user.isLoggedIn()];case 1:if(o.sent())throw new Error("A user is currently logged in. Log out the current user before invoking `loginWithMagicLink` again.");return e=t.email,n=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_auth_login_with_magic_link,[e]),[4,h.emitFortmaticPayload(this.getProvider(),n)];case 2:return o.sent(),[2,this.user]}}))}))},e=a([f.singleton("Fortmatic.Phantom")],e)}(m);e.PhantomMode=v;var b=function(t){function e(e,n){var o=t.call(this,{apiKey:e,chainName:n,endpoint:u.X_URL})||this;return o.transactions=new l.TransactionsModule,o.user=new d.UserModule,o}return r(e,t),e.prototype.configure=function(t){void 0===t&&(t={});var e=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_configure,[t]);return h.emitFortmaticPayload(this.getProvider(),e)},e.Phantom=v,e=a([f.singleton("Fortmatic")],e)}(m);e.WidgetMode=b,e.Fortmatic=b},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(0),i=n(4),s=n(8),u=function(){function t(t){this.endpoint=t}return t.prototype.post=function(t,e,n){return o(this,void 0,void 0,(function(){var o,u=this;return r(this,(function(r){switch(r.label){case 0:return[4,t.iframe];case 1:return o=r.sent(),[2,new Promise((function(t,r){if(o.contentWindow){var c=[],l=i.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(t){return t.id})):[];o.contentWindow.postMessage({msgType:e,payload:n},"*");var d=u.on(a.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(f=function(){return d()},function(e){var o=u.standardizeResponse(n,e),r=o.id,a=o.response;r&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(r)?(c.push(a.payload),c.length===n.batch.length&&(f(),t(c))):r&&r===n.id&&(f(),t(a.payload))})),p=u.on(a.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(e){return function(o){var r=u.standardizeResponse(n,o),a=r.id,d=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=d.hasError?d.payload:d.applyError(p).payload;if(a&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(a)){c.push(f);for(var h=c.length;h<n.batch.length;h++)c.push(new s.JsonRpcResponse(n.batch[h]).applyError(p).payload);e(),t(c)}else a&&a===n.id&&(e(),t(f))}}((function(){return p()})))}else r(new Error("Fortmatic: Modal is not ready."));var f}))]}}))}))},t.prototype.on=function(t,e){var n=this,o=e.bind(window),r=function(e){var r;e.origin===n.endpoint&&e.data&&e.data.msgType===t&&(e.data.response=null!=(r=e.data.response)?r:{},o(e))};return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}},t.prototype.standardizeResponse=function(t,e){var n,o,r,a,i,u;this.standardizeError(e);var c=null!=(o=null===(n=e.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new s.JsonRpcResponse(this.getRequestPayloadFromBatch(t,c)).applyResult(null===(r=e.data.response)||void 0===r?void 0:r.result).applyError(null===(a=e.data.response)||void 0===a?void 0:a.error),id:(u=null===(i=e.data.response)||void 0===i?void 0:i.id,null!=u?u:void 0)}},t.prototype.standardizeError=function(t){var e,n,o,r,a,i,s=!!t.data.response.error||!!t.data.response.message||!!t.data.response.code,u={message:(n=null===(e=t.data.response.error)||void 0===e?void 0:e.message,o=null!=n?n:t.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=t.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:t.data.response.code,null!=i?i:1)};t.data.response.error=s?u:null},t.prototype.getRequestPayloadFromBatch=function(t,e){return e&&i.isJsonRpcBatchRequestPayload(t)&&t.batch.find((function(t){return t.id===e}))||t},t}();e.FmPayloadTransport=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=function(){function t(e){e instanceof t?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):o.isJsonRpcResponsePayload(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=null,this._error=null)}return t.prototype.applyError=function(t){return t&&(this._error=t),this},t.prototype.applyResult=function(t){return t&&(this._result=t),this},Object.defineProperty(t.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),t}();e.JsonRpcResponse=r},function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5);e.default=o.Fortmatic,function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.X_URL="https://x2.fortmatic.com",e.AUTH_URL="https://auth.fortmatic.com"},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getAccessToken=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getMetadata=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.logout=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).PhantomModule);e.PhantomUser=u},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(14)),o(n(15)),o(n(16))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.fm_composeSend="fm_composeSend",t.fm_logout="fm_logout",t.fm_get_balances="fm_get_balances",t.fm_get_transactions="fm_get_transactions",t.fm_is_logged_in="fm_is_logged_in",t.fm_accountSettings="fm_accountSettings",t.fm_deposit="fm_deposit",t.fm_get_user="fm_get_user",t.fm_configure="fm_configure",t.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",t.fm_auth_get_access_token="fm_auth_get_access_token",t.fm_auth_get_metadata="fm_auth_get_metadata",t.fm_auth_logout="fm_auth_logout"}(e.FmPayloadMethod||(e.FmPayloadMethod={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",t.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",t.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",t.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",t.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",t.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT",t.FORTMATIC_UNAUTHORIZED_API_KEY="FORTMATIC_UNAUTHORIZED_API_KEY"}(e.FmIncomingWindowMessage||(e.FmIncomingWindowMessage={})),function(t){t.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",t.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",t.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(e.FmOutgoingWindowMessage||(e.FmOutgoingWindowMessage={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Mainnet="mainnet",t.Ropsten="ropsten",t.Rinkeby="rinkeby",t.Kovan="kovan"}(e.ChainName||(e.ChainName={})),function(t){t[t.Mainnet=1]="Mainnet",t[t.Ropsten=3]="Ropsten",t[t.Rinkeby=4]="Rinkeby",t[t.Kovan=42]="Kovan"}(e.ChainId||(e.ChainId={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(18))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.LoginWithEmail="email",t.LoginWithPhone="phone"}(e.PrimaryLoginOption||(e.PrimaryLoginOption={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createRandomId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.send=function(t,e){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,t);this.sdk.getProvider().sendFortmaticAsync(n,e)},e}(n(3).WidgetModule);e.TransactionsModule=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getUser=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getBalances=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getTransactions=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.settings=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.deposit=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).WidgetModule);e.UserModule=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0}),e.singleton=function(t){return function(e){return function(e){function n(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var a=this;return n.__instance__?console.warn(t+" is an implicit singleton. Calling `new "+t+"(...)` will return the existing instance. If the parameters passed to the constructor have changed, they will be ignored."):(a=e.apply(this,i(o))||this,n.__instance__=a),n.__instance__}return r(n,e),n}(e)}}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(6),i=n(0),s=n(2),u=n(1),c=n(4),l=n(24),d=n(7),p=n(25),f=n(8),h=function(){function t(t,e,n){if(this.endpoint=t,this.apiKey=e,this.chainName=n,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,!e)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.domainOrigin=window.location?window.location.origin:"",this.overlay=new l.FmIframeController(this.endpoint,{API_KEY:this.apiKey,ETH_NETWORK:this.chainName,DOMAIN_ORIGIN:this.domainOrigin}),this.payloadTransport=new d.FmPayloadTransport(t),this.listen()}return t.prototype.sendAsync=function(t,e){if(Array.isArray(t))return this.enqueue({onRequestComplete:e,payload:u.createJsonRpcBatchRequestPayload(t)});var n=u.standardizeRequestPayload(t);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:e,payload:n})},t.prototype.sendFortmaticAsync=function(t,e){var n=u.standardizeRequestPayload(t);this.enqueue({onRequestComplete:e,payload:n,isFortmaticMethod:!0})},t.prototype.send=function(t,e){if("string"==typeof t)return s.emitWeb3Payload(this,t,e);if(e)this.sendAsync(t,e);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(t,(function(){}));var n=new f.JsonRpcResponse(t);switch(t.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}}},t.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},t.prototype.enqueue=function(t){t&&(this.queue.push(t),this.overlay.overlayReady&&this.dequeue())},t.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var t,e,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(t=this.queue.shift())?(e=t.payload,n=function(t){var n=new f.JsonRpcResponse(t);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,e.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:e.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:e.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(e)?0===e.batch.length?[2,t.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),t.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(e)?[4,this.payloadTransport.post(this.overlay,t.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,4];case 3:s=r.sent(),n(s),s.error?t.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):t.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){t.account=null,t.network=null,t.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(e){t.queue.forEach((function(t){var e=new f.JsonRpcResponse(t.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};t.onRequestComplete(new p.JsonRpcErrorWrapper(n),e.applyError(n).payload)})),t.queue.slice(0)}))},t}();e.FmProvider=h},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=n(7),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function t(t,e){this.endpoint=t,this.options=e,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(t),this.listen()}return Object.defineProperty(t.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),t.prototype.init=function(){var t=this;return new Promise((function(e){var n=function(){if(0===document.querySelectorAll('[data-fortmatic-iframe-label="'+t.iframeLabel+'"]').length){var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=t.iframeLabel,n.src=t.endpoint+"/send?params="+btoa(JSON.stringify(t.options)),function(t){var e,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];t.style[u]=l}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),e(n)}else console.error("Fortmatic: Duplicate instances found.")};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},t.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="block",[2]}}))}))},t.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="none",[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){t._overlayReady=!1})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){t.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){t.showOverlay()}))},t}();e.FmIframeController=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(e){var n=t.call(this,e.message)||this;return n.code=e.code,n.name="FortmaticError",n}return r(e,t),e}(Error);e.JsonRpcErrorWrapper=a}]);
module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(13)),o(n(17))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(6),r=n(19);function a(t){var n,i;return t.jsonrpc=t.jsonrpc||e.JSON_RPC_VERSION,t.id=r.createRandomId(),t.batch||t.method===o.ethPayloadMethodSubset.eth_batchRequest?(t.method=o.ethPayloadMethodSubset.eth_batchRequest,t.batch=null!=(i=null===(n=t.batch)||void 0===n?void 0:n.map((function(t){return a(t)})))?i:[],t):(t.params=t.params||[],t)}e.JSON_RPC_VERSION="2.0",e.createJsonRpcRequestPayload=function(t,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:t,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId()}},e.createJsonRpcBatchRequestPayload=function(t){void 0===t&&(t=[]);var n=Array.isArray(t)?t:[t];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId(),batch:n.filter(Boolean).map((function(t){return a(t)}))}},e.standardizeRequestPayload=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.emitWeb3Payload=function(t,e,n){return void 0===n&&(n=[]),new Promise((function(r,a){t.sendAsync(o.createJsonRpcRequestPayload(e,n),(function(t,e){t?a(t):r(e.result)}))}))},e.emitFortmaticPayload=function(t,e){return new Promise((function(n,o){t.sendFortmaticAsync(e,(function(t,e){t?o(t):n(e?e.result:{})}))}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.WidgetMode.__instance__},enumerable:!0,configurable:!0}),t}();e.WidgetModule=r;var a=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.PhantomMode.__instance__},enumerable:!0,configurable:!0}),t}();e.PhantomModule=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);function r(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.batch||t.params)}function a(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.params||t.batch)}e.isJsonRpcBatchRequestPayload=r,e.isJsonRpcRequestPayload=a,e.isJsonRpcResponsePayload=function(t){return!!t&&!(!t.jsonrpc||!t.id||!t.result&&null!==t.result&&!t.error)},e.isFmRequest=function(t){return!(!t||!t.payload)&&a(t.payload)},e.isFmBatchRequest=function(t){return!(!t||!t.payload)&&r(t.payload)},e.isFmPayloadMethod=function(t){return!!t&&("string"==typeof t&&Object.values(o.FmPayloadMethod).includes(t))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__decorate||function(t,e,n,o){var r,a=arguments.length,i=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i},i=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var u=n(11),c=n(12),l=n(20),d=n(21),p=n(0),f=n(22),h=n(2),y=n(1),_=n(23),m=function(){function t(t){if(!t.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=t.apiKey,this.chainName=t.chainName,this.endpoint=t.endpoint}return t.prototype.getProvider=function(){return this.__provider__||(this.__provider__=new _.FmProvider(this.endpoint,this.apiKey,this.chainName)),this.__provider__},t}(),v=function(t){function e(e,n){void 0===n&&(n=u.AUTH_URL);var o=t.call(this,{apiKey:e,endpoint:n})||this;return o.user=new c.PhantomUser,o}return r(e,t),e.prototype.loginWithMagicLink=function(t){return i(this,void 0,void 0,(function(){var e,n;return s(this,(function(o){switch(o.label){case 0:return[4,this.user.isLoggedIn()];case 1:if(o.sent())throw new Error("A user is currently logged in. Log out the current user before invoking `loginWithMagicLink` again.");return e=t.email,n=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_auth_login_with_magic_link,[e]),[4,h.emitFortmaticPayload(this.getProvider(),n)];case 2:return o.sent(),[2,this.user]}}))}))},e=a([f.singleton("Fortmatic.Phantom")],e)}(m);e.PhantomMode=v;var b=function(t){function e(e,n){var o=t.call(this,{apiKey:e,chainName:n,endpoint:u.X_URL})||this;return o.transactions=new l.TransactionsModule,o.user=new d.UserModule,o}return r(e,t),e.prototype.configure=function(t){void 0===t&&(t={});var e=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_configure,[t]);return h.emitFortmaticPayload(this.getProvider(),e)},e.Phantom=v,e=a([f.singleton("Fortmatic")],e)}(m);e.WidgetMode=b,e.Fortmatic=b},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(0),i=n(4),s=n(8),u=function(){function t(t){this.endpoint=t}return t.prototype.post=function(t,e,n){return o(this,void 0,void 0,(function(){var o,u=this;return r(this,(function(r){switch(r.label){case 0:return[4,t.iframe];case 1:return o=r.sent(),[2,new Promise((function(t,r){if(o.contentWindow){var c=[],l=i.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(t){return t.id})):[];o.contentWindow.postMessage({msgType:e,payload:n},"*");var d=u.on(a.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(f=function(){return d()},function(e){var o=u.standardizeResponse(n,e),r=o.id,a=o.response;r&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(r)?(c.push(a.payload),c.length===n.batch.length&&(f(),t(c))):r&&r===n.id&&(f(),t(a.payload))})),p=u.on(a.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(e){return function(o){var r=u.standardizeResponse(n,o),a=r.id,d=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=d.hasError?d.payload:d.applyError(p).payload;if(a&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(a)){c.push(f);for(var h=c.length;h<n.batch.length;h++)c.push(new s.JsonRpcResponse(n.batch[h]).applyError(p).payload);e(),t(c)}else a&&a===n.id&&(e(),t(f))}}((function(){return p()})))}else r(new Error("Fortmatic: Modal is not ready."));var f}))]}}))}))},t.prototype.on=function(t,e){var n=this,o=e.bind(window),r=function(e){var r;e.origin===n.endpoint&&e.data&&e.data.msgType===t&&(e.data.response=null!=(r=e.data.response)?r:{},o(e))};return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}},t.prototype.standardizeResponse=function(t,e){var n,o,r,a,i,u;this.standardizeError(e);var c=null!=(o=null===(n=e.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new s.JsonRpcResponse(this.getRequestPayloadFromBatch(t,c)).applyResult(null===(r=e.data.response)||void 0===r?void 0:r.result).applyError(null===(a=e.data.response)||void 0===a?void 0:a.error),id:(u=null===(i=e.data.response)||void 0===i?void 0:i.id,null!=u?u:void 0)}},t.prototype.standardizeError=function(t){var e,n,o,r,a,i,s=!!t.data.response.error||!!t.data.response.message||!!t.data.response.code,u={message:(n=null===(e=t.data.response.error)||void 0===e?void 0:e.message,o=null!=n?n:t.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=t.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:t.data.response.code,null!=i?i:1)};t.data.response.error=s?u:null},t.prototype.getRequestPayloadFromBatch=function(t,e){return e&&i.isJsonRpcBatchRequestPayload(t)&&t.batch.find((function(t){return t.id===e}))||t},t}();e.FmPayloadTransport=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=function(){function t(e){e instanceof t?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):o.isJsonRpcResponsePayload(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=null,this._error=null)}return t.prototype.applyError=function(t){return t&&(this._error=t),this},t.prototype.applyResult=function(t){return t&&(this._result=t),this},Object.defineProperty(t.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),t}();e.JsonRpcResponse=r},function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5);e.default=o.Fortmatic,function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.X_URL="https://x2.fortmatic.com",e.AUTH_URL="https://auth.fortmatic.com"},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getIdToken=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getMetadata=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.logout=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).PhantomModule);e.PhantomUser=u},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(14)),o(n(15)),o(n(16))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.fm_composeSend="fm_composeSend",t.fm_logout="fm_logout",t.fm_get_balances="fm_get_balances",t.fm_get_transactions="fm_get_transactions",t.fm_is_logged_in="fm_is_logged_in",t.fm_accountSettings="fm_accountSettings",t.fm_deposit="fm_deposit",t.fm_get_user="fm_get_user",t.fm_configure="fm_configure",t.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",t.fm_auth_get_access_token="fm_auth_get_access_token",t.fm_auth_get_metadata="fm_auth_get_metadata",t.fm_auth_logout="fm_auth_logout"}(e.FmPayloadMethod||(e.FmPayloadMethod={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",t.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",t.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",t.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",t.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",t.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT",t.FORTMATIC_UNAUTHORIZED_API_KEY="FORTMATIC_UNAUTHORIZED_API_KEY"}(e.FmIncomingWindowMessage||(e.FmIncomingWindowMessage={})),function(t){t.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",t.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",t.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(e.FmOutgoingWindowMessage||(e.FmOutgoingWindowMessage={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Mainnet="mainnet",t.Ropsten="ropsten",t.Rinkeby="rinkeby",t.Kovan="kovan"}(e.ChainName||(e.ChainName={})),function(t){t[t.Mainnet=1]="Mainnet",t[t.Ropsten=3]="Ropsten",t[t.Rinkeby=4]="Rinkeby",t[t.Kovan=42]="Kovan"}(e.ChainId||(e.ChainId={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(18))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.LoginWithEmail="email",t.LoginWithPhone="phone"}(e.PrimaryLoginOption||(e.PrimaryLoginOption={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createRandomId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.send=function(t,e){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,t);this.sdk.getProvider().sendFortmaticAsync(n,e)},e}(n(3).WidgetModule);e.TransactionsModule=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getUser=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getBalances=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getTransactions=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.settings=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.deposit=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).WidgetModule);e.UserModule=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0}),e.singleton=function(t){return function(e){return function(e){function n(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var a=this;return n.__instance__?console.warn(t+" is an implicit singleton. Calling `new "+t+"(...)` will return the existing instance. If the parameters passed to the constructor have changed, they will be ignored."):(a=e.apply(this,i(o))||this,n.__instance__=a),n.__instance__}return r(n,e),n}(e)}}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(6),i=n(0),s=n(2),u=n(1),c=n(4),l=n(24),d=n(7),p=n(25),f=n(8),h=function(){function t(t,e,n){if(this.endpoint=t,this.apiKey=e,this.chainName=n,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,!e)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.domainOrigin=window.location?window.location.origin:"",this.overlay=new l.FmIframeController(this.endpoint,{API_KEY:this.apiKey,ETH_NETWORK:this.chainName,DOMAIN_ORIGIN:this.domainOrigin}),this.payloadTransport=new d.FmPayloadTransport(t),this.listen()}return t.prototype.sendAsync=function(t,e){if(Array.isArray(t))return this.enqueue({onRequestComplete:e,payload:u.createJsonRpcBatchRequestPayload(t)});var n=u.standardizeRequestPayload(t);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:e,payload:n})},t.prototype.sendFortmaticAsync=function(t,e){var n=u.standardizeRequestPayload(t);this.enqueue({onRequestComplete:e,payload:n,isFortmaticMethod:!0})},t.prototype.send=function(t,e){if("string"==typeof t)return s.emitWeb3Payload(this,t,e);if(e)this.sendAsync(t,e);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(t,(function(){}));var n=new f.JsonRpcResponse(t);switch(t.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}}},t.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},t.prototype.enqueue=function(t){t&&(this.queue.push(t),this.overlay.overlayReady&&this.dequeue())},t.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var t,e,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(t=this.queue.shift())?(e=t.payload,n=function(t){var n=new f.JsonRpcResponse(t);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,e.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:e.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:e.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(e)?0===e.batch.length?[2,t.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),t.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(e)?[4,this.payloadTransport.post(this.overlay,t.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,4];case 3:s=r.sent(),n(s),s.error?t.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):t.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){t.account=null,t.network=null,t.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(e){t.queue.forEach((function(t){var e=new f.JsonRpcResponse(t.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};t.onRequestComplete(new p.JsonRpcErrorWrapper(n),e.applyError(n).payload)})),t.queue.slice(0)}))},t}();e.FmProvider=h},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=n(7),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function t(t,e){this.endpoint=t,this.options=e,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(t),this.listen()}return Object.defineProperty(t.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),t.prototype.init=function(){var t=this;return new Promise((function(e){var n=function(){if(0===document.querySelectorAll('[data-fortmatic-iframe-label="'+t.iframeLabel+'"]').length){var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=t.iframeLabel,n.src=t.endpoint+"/send?params="+btoa(JSON.stringify(t.options)),function(t){var e,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];t.style[u]=l}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),e(n)}else console.error("Fortmatic: Duplicate instances found.")};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},t.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="block",[2]}}))}))},t.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="none",[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){t._overlayReady=!1})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){t.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){t.showOverlay()}))},t}();e.FmIframeController=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(e){var n=t.call(this,e.message)||this;return n.code=e.code,n.name="FortmaticError",n}return r(e,t),e}(Error);e.JsonRpcErrorWrapper=a}]);

@@ -8,3 +8,3 @@ import { PhantomUserMetadata } from '../../types/phantom-mode/phantom-user-metadata';

/** */
getAccessToken(): Promise<string>;
getIdToken(): Promise<string>;
/** */

@@ -11,0 +11,0 @@ getMetadata(): Promise<PhantomUserMetadata>;

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

window.Fortmatic=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(13)),o(n(17))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(6),r=n(19);function a(t){var n,i;return t.jsonrpc=t.jsonrpc||e.JSON_RPC_VERSION,t.id=r.createRandomId(),t.batch||t.method===o.ethPayloadMethodSubset.eth_batchRequest?(t.method=o.ethPayloadMethodSubset.eth_batchRequest,t.batch=null!=(i=null===(n=t.batch)||void 0===n?void 0:n.map((function(t){return a(t)})))?i:[],t):(t.params=t.params||[],t)}e.JSON_RPC_VERSION="2.0",e.createJsonRpcRequestPayload=function(t,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:t,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId()}},e.createJsonRpcBatchRequestPayload=function(t){void 0===t&&(t=[]);var n=Array.isArray(t)?t:[t];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId(),batch:n.filter(Boolean).map((function(t){return a(t)}))}},e.standardizeRequestPayload=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.emitWeb3Payload=function(t,e,n){return void 0===n&&(n=[]),new Promise((function(r,a){t.sendAsync(o.createJsonRpcRequestPayload(e,n),(function(t,e){t?a(t):r(e.result)}))}))},e.emitFortmaticPayload=function(t,e){return new Promise((function(n,o){t.sendFortmaticAsync(e,(function(t,e){t?o(t):n(e?e.result:{})}))}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.WidgetMode.__instance__},enumerable:!0,configurable:!0}),t}();e.WidgetModule=r;var a=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.PhantomMode.__instance__},enumerable:!0,configurable:!0}),t}();e.PhantomModule=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);function r(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.batch||t.params)}function a(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.params||t.batch)}e.isJsonRpcBatchRequestPayload=r,e.isJsonRpcRequestPayload=a,e.isJsonRpcResponsePayload=function(t){return!!t&&!(!t.jsonrpc||!t.id||!t.result&&null!==t.result&&!t.error)},e.isFmRequest=function(t){return!(!t||!t.payload)&&a(t.payload)},e.isFmBatchRequest=function(t){return!(!t||!t.payload)&&r(t.payload)},e.isFmPayloadMethod=function(t){return!!t&&("string"==typeof t&&Object.values(o.FmPayloadMethod).includes(t))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__decorate||function(t,e,n,o){var r,a=arguments.length,i=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i},i=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var u=n(11),c=n(12),l=n(20),d=n(21),p=n(0),f=n(22),h=n(2),y=n(1),_=n(23),m=function(){function t(t){if(!t.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=t.apiKey,this.chainName=t.chainName,this.endpoint=t.endpoint}return t.prototype.getProvider=function(){return this.__provider__||(this.__provider__=new _.FmProvider(this.endpoint,this.apiKey,this.chainName)),this.__provider__},t}(),v=function(t){function e(e,n){void 0===n&&(n=u.AUTH_URL);var o=t.call(this,{apiKey:e,endpoint:n})||this;return o.user=new c.PhantomUser,o}return r(e,t),e.prototype.loginWithMagicLink=function(t){return i(this,void 0,void 0,(function(){var e,n;return s(this,(function(o){switch(o.label){case 0:return[4,this.user.isLoggedIn()];case 1:if(o.sent())throw new Error("A user is currently logged in. Log out the current user before invoking `loginWithMagicLink` again.");return e=t.email,n=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_auth_login_with_magic_link,[e]),[4,h.emitFortmaticPayload(this.getProvider(),n)];case 2:return o.sent(),[2,this.user]}}))}))},e=a([f.singleton("Fortmatic.Phantom")],e)}(m);e.PhantomMode=v;var b=function(t){function e(e,n){var o=t.call(this,{apiKey:e,chainName:n,endpoint:u.X_URL})||this;return o.transactions=new l.TransactionsModule,o.user=new d.UserModule,o}return r(e,t),e.prototype.configure=function(t){void 0===t&&(t={});var e=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_configure,[t]);return h.emitFortmaticPayload(this.getProvider(),e)},e.Phantom=v,e=a([f.singleton("Fortmatic")],e)}(m);e.WidgetMode=b,e.Fortmatic=b},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(0),i=n(4),s=n(8),u=function(){function t(t){this.endpoint=t}return t.prototype.post=function(t,e,n){return o(this,void 0,void 0,(function(){var o,u=this;return r(this,(function(r){switch(r.label){case 0:return[4,t.iframe];case 1:return o=r.sent(),[2,new Promise((function(t,r){if(o.contentWindow){var c=[],l=i.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(t){return t.id})):[];o.contentWindow.postMessage({msgType:e,payload:n},"*");var d=u.on(a.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(f=function(){return d()},function(e){var o=u.standardizeResponse(n,e),r=o.id,a=o.response;r&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(r)?(c.push(a.payload),c.length===n.batch.length&&(f(),t(c))):r&&r===n.id&&(f(),t(a.payload))})),p=u.on(a.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(e){return function(o){var r=u.standardizeResponse(n,o),a=r.id,d=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=d.hasError?d.payload:d.applyError(p).payload;if(a&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(a)){c.push(f);for(var h=c.length;h<n.batch.length;h++)c.push(new s.JsonRpcResponse(n.batch[h]).applyError(p).payload);e(),t(c)}else a&&a===n.id&&(e(),t(f))}}((function(){return p()})))}else r(new Error("Fortmatic: Modal is not ready."));var f}))]}}))}))},t.prototype.on=function(t,e){var n=this,o=e.bind(window),r=function(e){var r;e.origin===n.endpoint&&e.data&&e.data.msgType===t&&(e.data.response=null!=(r=e.data.response)?r:{},o(e))};return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}},t.prototype.standardizeResponse=function(t,e){var n,o,r,a,i,u;this.standardizeError(e);var c=null!=(o=null===(n=e.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new s.JsonRpcResponse(this.getRequestPayloadFromBatch(t,c)).applyResult(null===(r=e.data.response)||void 0===r?void 0:r.result).applyError(null===(a=e.data.response)||void 0===a?void 0:a.error),id:(u=null===(i=e.data.response)||void 0===i?void 0:i.id,null!=u?u:void 0)}},t.prototype.standardizeError=function(t){var e,n,o,r,a,i,s=!!t.data.response.error||!!t.data.response.message||!!t.data.response.code,u={message:(n=null===(e=t.data.response.error)||void 0===e?void 0:e.message,o=null!=n?n:t.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=t.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:t.data.response.code,null!=i?i:1)};t.data.response.error=s?u:null},t.prototype.getRequestPayloadFromBatch=function(t,e){return e&&i.isJsonRpcBatchRequestPayload(t)&&t.batch.find((function(t){return t.id===e}))||t},t}();e.FmPayloadTransport=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=function(){function t(e){e instanceof t?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):o.isJsonRpcResponsePayload(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=null,this._error=null)}return t.prototype.applyError=function(t){return t&&(this._error=t),this},t.prototype.applyResult=function(t){return t&&(this._result=t),this},Object.defineProperty(t.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),t}();e.JsonRpcResponse=r},function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),a=o(n(0));e.default=Object.assign(r.Fortmatic,a)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.X_URL="https://x2.fortmatic.com",e.AUTH_URL="https://auth.fortmatic.com"},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getAccessToken=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getMetadata=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.logout=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).PhantomModule);e.PhantomUser=u},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(14)),o(n(15)),o(n(16))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.fm_composeSend="fm_composeSend",t.fm_logout="fm_logout",t.fm_get_balances="fm_get_balances",t.fm_get_transactions="fm_get_transactions",t.fm_is_logged_in="fm_is_logged_in",t.fm_accountSettings="fm_accountSettings",t.fm_deposit="fm_deposit",t.fm_get_user="fm_get_user",t.fm_configure="fm_configure",t.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",t.fm_auth_get_access_token="fm_auth_get_access_token",t.fm_auth_get_metadata="fm_auth_get_metadata",t.fm_auth_logout="fm_auth_logout"}(e.FmPayloadMethod||(e.FmPayloadMethod={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",t.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",t.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",t.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",t.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",t.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT",t.FORTMATIC_UNAUTHORIZED_API_KEY="FORTMATIC_UNAUTHORIZED_API_KEY"}(e.FmIncomingWindowMessage||(e.FmIncomingWindowMessage={})),function(t){t.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",t.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",t.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(e.FmOutgoingWindowMessage||(e.FmOutgoingWindowMessage={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Mainnet="mainnet",t.Ropsten="ropsten",t.Rinkeby="rinkeby",t.Kovan="kovan"}(e.ChainName||(e.ChainName={})),function(t){t[t.Mainnet=1]="Mainnet",t[t.Ropsten=3]="Ropsten",t[t.Rinkeby=4]="Rinkeby",t[t.Kovan=42]="Kovan"}(e.ChainId||(e.ChainId={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(18))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.LoginWithEmail="email",t.LoginWithPhone="phone"}(e.PrimaryLoginOption||(e.PrimaryLoginOption={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createRandomId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.send=function(t,e){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,t);this.sdk.getProvider().sendFortmaticAsync(n,e)},e}(n(3).WidgetModule);e.TransactionsModule=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getUser=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getBalances=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getTransactions=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.settings=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.deposit=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).WidgetModule);e.UserModule=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0}),e.singleton=function(t){return function(e){return function(e){function n(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var a=this;return n.__instance__?console.warn(t+" is an implicit singleton. Calling `new "+t+"(...)` will return the existing instance. If the parameters passed to the constructor have changed, they will be ignored."):(a=e.apply(this,i(o))||this,n.__instance__=a),n.__instance__}return r(n,e),n}(e)}}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(6),i=n(0),s=n(2),u=n(1),c=n(4),l=n(24),d=n(7),p=n(25),f=n(8),h=function(){function t(t,e,n){if(this.endpoint=t,this.apiKey=e,this.chainName=n,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,!e)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.domainOrigin=window.location?window.location.origin:"",this.overlay=new l.FmIframeController(this.endpoint,{API_KEY:this.apiKey,ETH_NETWORK:this.chainName,DOMAIN_ORIGIN:this.domainOrigin}),this.payloadTransport=new d.FmPayloadTransport(t),this.listen()}return t.prototype.sendAsync=function(t,e){if(Array.isArray(t))return this.enqueue({onRequestComplete:e,payload:u.createJsonRpcBatchRequestPayload(t)});var n=u.standardizeRequestPayload(t);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:e,payload:n})},t.prototype.sendFortmaticAsync=function(t,e){var n=u.standardizeRequestPayload(t);this.enqueue({onRequestComplete:e,payload:n,isFortmaticMethod:!0})},t.prototype.send=function(t,e){if("string"==typeof t)return s.emitWeb3Payload(this,t,e);if(e)this.sendAsync(t,e);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(t,(function(){}));var n=new f.JsonRpcResponse(t);switch(t.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}}},t.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},t.prototype.enqueue=function(t){t&&(this.queue.push(t),this.overlay.overlayReady&&this.dequeue())},t.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var t,e,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(t=this.queue.shift())?(e=t.payload,n=function(t){var n=new f.JsonRpcResponse(t);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,e.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:e.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:e.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(e)?0===e.batch.length?[2,t.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),t.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(e)?[4,this.payloadTransport.post(this.overlay,t.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,4];case 3:s=r.sent(),n(s),s.error?t.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):t.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){t.account=null,t.network=null,t.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(e){t.queue.forEach((function(t){var e=new f.JsonRpcResponse(t.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};t.onRequestComplete(new p.JsonRpcErrorWrapper(n),e.applyError(n).payload)})),t.queue.slice(0)}))},t}();e.FmProvider=h},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=n(7),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function t(t,e){this.endpoint=t,this.options=e,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(t),this.listen()}return Object.defineProperty(t.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),t.prototype.init=function(){var t=this;return new Promise((function(e){var n=function(){if(0===document.querySelectorAll('[data-fortmatic-iframe-label="'+t.iframeLabel+'"]').length){var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=t.iframeLabel,n.src=t.endpoint+"/send?params="+btoa(JSON.stringify(t.options)),function(t){var e,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];t.style[u]=l}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),e(n)}else console.error("Fortmatic: Duplicate instances found.")};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},t.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="block",[2]}}))}))},t.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="none",[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){t._overlayReady=!1})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){t.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){t.showOverlay()}))},t}();e.FmIframeController=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(e){var n=t.call(this,e.message)||this;return n.code=e.code,n.name="FortmaticError",n}return r(e,t),e}(Error);e.JsonRpcErrorWrapper=a}]).default;
window.Fortmatic=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(13)),o(n(17))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(6),r=n(19);function a(t){var n,i;return t.jsonrpc=t.jsonrpc||e.JSON_RPC_VERSION,t.id=r.createRandomId(),t.batch||t.method===o.ethPayloadMethodSubset.eth_batchRequest?(t.method=o.ethPayloadMethodSubset.eth_batchRequest,t.batch=null!=(i=null===(n=t.batch)||void 0===n?void 0:n.map((function(t){return a(t)})))?i:[],t):(t.params=t.params||[],t)}e.JSON_RPC_VERSION="2.0",e.createJsonRpcRequestPayload=function(t,n){var o=[{}];return n&&(o=Array.isArray(n)?n:[{to:n.to,value:n.amount}]),{params:o,method:t,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId()}},e.createJsonRpcBatchRequestPayload=function(t){void 0===t&&(t=[]);var n=Array.isArray(t)?t:[t];return{method:o.ethPayloadMethodSubset.eth_batchRequest,jsonrpc:e.JSON_RPC_VERSION,id:r.createRandomId(),batch:n.filter(Boolean).map((function(t){return a(t)}))}},e.standardizeRequestPayload=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.emitWeb3Payload=function(t,e,n){return void 0===n&&(n=[]),new Promise((function(r,a){t.sendAsync(o.createJsonRpcRequestPayload(e,n),(function(t,e){t?a(t):r(e.result)}))}))},e.emitFortmaticPayload=function(t,e){return new Promise((function(n,o){t.sendFortmaticAsync(e,(function(t,e){t?o(t):n(e?e.result:{})}))}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.WidgetMode.__instance__},enumerable:!0,configurable:!0}),t}();e.WidgetModule=r;var a=function(){function t(){}return Object.defineProperty(t.prototype,"sdk",{get:function(){return o.PhantomMode.__instance__},enumerable:!0,configurable:!0}),t}();e.PhantomModule=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);function r(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.batch||t.params)}function a(t){return!!t&&!(!t.jsonrpc||!t.id||!t.method||!t.params||t.batch)}e.isJsonRpcBatchRequestPayload=r,e.isJsonRpcRequestPayload=a,e.isJsonRpcResponsePayload=function(t){return!!t&&!(!t.jsonrpc||!t.id||!t.result&&null!==t.result&&!t.error)},e.isFmRequest=function(t){return!(!t||!t.payload)&&a(t.payload)},e.isFmBatchRequest=function(t){return!(!t||!t.payload)&&r(t.payload)},e.isFmPayloadMethod=function(t){return!!t&&("string"==typeof t&&Object.values(o.FmPayloadMethod).includes(t))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__decorate||function(t,e,n,o){var r,a=arguments.length,i=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(i=(a<3?r(i):a>3?r(e,n,i):r(e,n))||i);return a>3&&i&&Object.defineProperty(e,n,i),i},i=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var u=n(11),c=n(12),l=n(20),d=n(21),p=n(0),f=n(22),h=n(2),y=n(1),_=n(23),m=function(){function t(t){if(!t.apiKey)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.apiKey=t.apiKey,this.chainName=t.chainName,this.endpoint=t.endpoint}return t.prototype.getProvider=function(){return this.__provider__||(this.__provider__=new _.FmProvider(this.endpoint,this.apiKey,this.chainName)),this.__provider__},t}(),v=function(t){function e(e,n){void 0===n&&(n=u.AUTH_URL);var o=t.call(this,{apiKey:e,endpoint:n})||this;return o.user=new c.PhantomUser,o}return r(e,t),e.prototype.loginWithMagicLink=function(t){return i(this,void 0,void 0,(function(){var e,n;return s(this,(function(o){switch(o.label){case 0:return[4,this.user.isLoggedIn()];case 1:if(o.sent())throw new Error("A user is currently logged in. Log out the current user before invoking `loginWithMagicLink` again.");return e=t.email,n=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_auth_login_with_magic_link,[e]),[4,h.emitFortmaticPayload(this.getProvider(),n)];case 2:return o.sent(),[2,this.user]}}))}))},e=a([f.singleton("Fortmatic.Phantom")],e)}(m);e.PhantomMode=v;var b=function(t){function e(e,n){var o=t.call(this,{apiKey:e,chainName:n,endpoint:u.X_URL})||this;return o.transactions=new l.TransactionsModule,o.user=new d.UserModule,o}return r(e,t),e.prototype.configure=function(t){void 0===t&&(t={});var e=y.createJsonRpcRequestPayload(p.FmPayloadMethod.fm_configure,[t]);return h.emitFortmaticPayload(this.getProvider(),e)},e.Phantom=v,e=a([f.singleton("Fortmatic")],e)}(m);e.WidgetMode=b,e.Fortmatic=b},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ethPayloadMethodSubset={net_version:"net_version",eth_coinbase:"eth_coinbase",eth_accounts:"eth_accounts",eth_batchRequest:"eth_batchRequest",eth_uninstallFilter:"eth_uninstallFilter"}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(0),i=n(4),s=n(8),u=function(){function t(t){this.endpoint=t}return t.prototype.post=function(t,e,n){return o(this,void 0,void 0,(function(){var o,u=this;return r(this,(function(r){switch(r.label){case 0:return[4,t.iframe];case 1:return o=r.sent(),[2,new Promise((function(t,r){if(o.contentWindow){var c=[],l=i.isJsonRpcBatchRequestPayload(n)?n.batch.map((function(t){return t.id})):[];o.contentWindow.postMessage({msgType:e,payload:n},"*");var d=u.on(a.FmIncomingWindowMessage.FORTMATIC_HANDLE_RESPONSE,(f=function(){return d()},function(e){var o=u.standardizeResponse(n,e),r=o.id,a=o.response;r&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(r)?(c.push(a.payload),c.length===n.batch.length&&(f(),t(c))):r&&r===n.id&&(f(),t(a.payload))})),p=u.on(a.FmIncomingWindowMessage.FORTMATIC_USER_DENIED,function(e){return function(o){var r=u.standardizeResponse(n,o),a=r.id,d=r.response,p={message:"Fortmatic: Modal was closed without executing action!",code:1},f=d.hasError?d.payload:d.applyError(p).payload;if(a&&i.isJsonRpcBatchRequestPayload(n)&&l.includes(a)){c.push(f);for(var h=c.length;h<n.batch.length;h++)c.push(new s.JsonRpcResponse(n.batch[h]).applyError(p).payload);e(),t(c)}else a&&a===n.id&&(e(),t(f))}}((function(){return p()})))}else r(new Error("Fortmatic: Modal is not ready."));var f}))]}}))}))},t.prototype.on=function(t,e){var n=this,o=e.bind(window),r=function(e){var r;e.origin===n.endpoint&&e.data&&e.data.msgType===t&&(e.data.response=null!=(r=e.data.response)?r:{},o(e))};return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}},t.prototype.standardizeResponse=function(t,e){var n,o,r,a,i,u;this.standardizeError(e);var c=null!=(o=null===(n=e.data.response)||void 0===n?void 0:n.id)?o:void 0;return{response:new s.JsonRpcResponse(this.getRequestPayloadFromBatch(t,c)).applyResult(null===(r=e.data.response)||void 0===r?void 0:r.result).applyError(null===(a=e.data.response)||void 0===a?void 0:a.error),id:(u=null===(i=e.data.response)||void 0===i?void 0:i.id,null!=u?u:void 0)}},t.prototype.standardizeError=function(t){var e,n,o,r,a,i,s=!!t.data.response.error||!!t.data.response.message||!!t.data.response.code,u={message:(n=null===(e=t.data.response.error)||void 0===e?void 0:e.message,o=null!=n?n:t.data.response.message,null!=o?o:"Fortmatic: Modal was closed without executing action!"),code:(a=null===(r=t.data.response.error)||void 0===r?void 0:r.code,i=null!=a?a:t.data.response.code,null!=i?i:1)};t.data.response.error=s?u:null},t.prototype.getRequestPayloadFromBatch=function(t,e){return e&&i.isJsonRpcBatchRequestPayload(t)&&t.batch.find((function(t){return t.id===e}))||t},t}();e.FmPayloadTransport=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=function(){function t(e){e instanceof t?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):o.isJsonRpcResponsePayload(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=null,this._error=null)}return t.prototype.applyError=function(t){return t&&(this._error=t),this},t.prototype.applyResult=function(t){return t&&(this._result=t),this},Object.defineProperty(t.prototype,"hasError",{get:function(){return!!this._error},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasResult",{get:function(){return!!this._result},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}},enumerable:!0,configurable:!0}),t}();e.JsonRpcResponse=r},function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),a=o(n(0));e.default=Object.assign(r.Fortmatic,a)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.X_URL="https://x2.fortmatic.com",e.AUTH_URL="https://auth.fortmatic.com"},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(2),s=n(1),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getIdToken=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_access_token);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getMetadata=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_get_metadata);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_is_logged_in);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.logout=function(){var t=s.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_auth_logout);return i.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).PhantomModule);e.PhantomUser=u},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(14)),o(n(15)),o(n(16))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.fm_composeSend="fm_composeSend",t.fm_logout="fm_logout",t.fm_get_balances="fm_get_balances",t.fm_get_transactions="fm_get_transactions",t.fm_is_logged_in="fm_is_logged_in",t.fm_accountSettings="fm_accountSettings",t.fm_deposit="fm_deposit",t.fm_get_user="fm_get_user",t.fm_configure="fm_configure",t.fm_auth_login_with_magic_link="fm_auth_login_with_magic_link",t.fm_auth_get_access_token="fm_auth_get_access_token",t.fm_auth_get_metadata="fm_auth_get_metadata",t.fm_auth_logout="fm_auth_logout"}(e.FmPayloadMethod||(e.FmPayloadMethod={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.FORTMATIC_HANDLE_RESPONSE="FORTMATIC_HANDLE_RESPONSE",t.FORTMATIC_OVERLAY_READY="FORTMATIC_OVERLAY_READY",t.FORTMATIC_SHOW_OVERLAY="FORTMATIC_SHOW_OVERLAY",t.FORTMATIC_HIDE_OVERLAY="FORTMATIC_HIDE_OVERLAY",t.FORTMATIC_USER_DENIED="FORTMATIC_USER_DENIED",t.FORTMATIC_USER_LOGOUT="FORTMATIC_USER_LOGOUT",t.FORTMATIC_UNAUTHORIZED_API_KEY="FORTMATIC_UNAUTHORIZED_API_KEY"}(e.FmIncomingWindowMessage||(e.FmIncomingWindowMessage={})),function(t){t.FORTMATIC_HANDLE_BATCH_REQUEST="FORTMATIC_HANDLE_BATCH_REQUEST",t.FORTMATIC_HANDLE_REQUEST="FORTMATIC_HANDLE_REQUEST",t.FORTMATIC_HANDLE_FORTMATIC_REQUEST="FORTMATIC_HANDLE_FORTMATIC_REQUEST"}(e.FmOutgoingWindowMessage||(e.FmOutgoingWindowMessage={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Mainnet="mainnet",t.Ropsten="ropsten",t.Rinkeby="rinkeby",t.Kovan="kovan"}(e.ChainName||(e.ChainName={})),function(t){t[t.Mainnet=1]="Mainnet",t[t.Ropsten=3]="Ropsten",t[t.Rinkeby=4]="Rinkeby",t[t.Kovan=42]="Kovan"}(e.ChainId||(e.ChainId={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(18))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.LoginWithEmail="email",t.LoginWithPhone="phone"}(e.PrimaryLoginOption||(e.PrimaryLoginOption={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createRandomId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.send=function(t,e){var n=i.createJsonRpcRequestPayload(a.FmPayloadMethod.fm_composeSend,t);this.sdk.getProvider().sendFortmaticAsync(n,e)},e}(n(3).WidgetModule);e.TransactionsModule=s},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var s=n(0),u=n(2),c=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.login=function(){return a(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.sdk.getProvider().enable()];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){this.sdk.getProvider().account=null,this.sdk.getProvider().network=null;var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_logout);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getUser=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_user);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getBalances=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_balances);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.getTransactions=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_get_transactions);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.isLoggedIn=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_is_logged_in);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.settings=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_accountSettings);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e.prototype.deposit=function(){var t=c.createJsonRpcRequestPayload(s.FmPayloadMethod.fm_deposit);return u.emitFortmaticPayload(this.sdk.getProvider(),t)},e}(n(3).WidgetModule);e.UserModule=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0}),e.singleton=function(t){return function(e){return function(e){function n(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var a=this;return n.__instance__?console.warn(t+" is an implicit singleton. Calling `new "+t+"(...)` will return the existing instance. If the parameters passed to the constructor have changed, they will be ignored."):(a=e.apply(this,i(o))||this,n.__instance__=a),n.__instance__}return r(n,e),n}(e)}}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(e,"__esModule",{value:!0});var a=n(6),i=n(0),s=n(2),u=n(1),c=n(4),l=n(24),d=n(7),p=n(25),f=n(8),h=function(){function t(t,e,n){if(this.endpoint=t,this.apiKey=e,this.chainName=n,this.isFortmatic=!0,this.queue=[],this.account=null,this.network=null,this.isLoggedIn=!1,!e)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.domainOrigin=window.location?window.location.origin:"",this.overlay=new l.FmIframeController(this.endpoint,{API_KEY:this.apiKey,ETH_NETWORK:this.chainName,DOMAIN_ORIGIN:this.domainOrigin}),this.payloadTransport=new d.FmPayloadTransport(t),this.listen()}return t.prototype.sendAsync=function(t,e){if(Array.isArray(t))return this.enqueue({onRequestComplete:e,payload:u.createJsonRpcBatchRequestPayload(t)});var n=u.standardizeRequestPayload(t);return c.isJsonRpcBatchRequestPayload(n),this.enqueue({onRequestComplete:e,payload:n})},t.prototype.sendFortmaticAsync=function(t,e){var n=u.standardizeRequestPayload(t);this.enqueue({onRequestComplete:e,payload:n,isFortmaticMethod:!0})},t.prototype.send=function(t,e){if("string"==typeof t)return s.emitWeb3Payload(this,t,e);if(e)this.sendAsync(t,e);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(t,(function(){}));var n=new f.JsonRpcResponse(t);switch(t.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}}},t.prototype.enable=function(){return s.emitWeb3Payload(this,a.ethPayloadMethodSubset.eth_accounts)},t.prototype.enqueue=function(t){t&&(this.queue.push(t),this.overlay.overlayReady&&this.dequeue())},t.prototype.dequeue=function(){return o(this,void 0,void 0,(function(){var t,e,n,o,s,u=this;return r(this,(function(r){switch(r.label){case 0:return 0===this.queue.length?[2]:(t=this.queue.shift())?(e=t.payload,n=function(t){var n=new f.JsonRpcResponse(t);!n.hasError&&n.hasResult&&(u.isLoggedIn=!0,e.method===a.ethPayloadMethodSubset.eth_accounts?u.account=n.payload.result[0]:e.method===a.ethPayloadMethodSubset.eth_coinbase?u.account=n.payload.result:e.method===a.ethPayloadMethodSubset.net_version&&(u.network=n.payload.result))},c.isJsonRpcBatchRequestPayload(e)?0===e.batch.length?[2,t.onRequestComplete(null,[])]:[4,this.payloadTransport.post(this.overlay,i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,2]):[3,5];case 1:(o=r.sent()).forEach(n),t.onRequestComplete(null,o),r.label=2;case 2:return c.isJsonRpcRequestPayload(e)?[4,this.payloadTransport.post(this.overlay,t.isFortmaticMethod?i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_FORTMATIC_REQUEST:i.FmOutgoingWindowMessage.FORTMATIC_HANDLE_REQUEST,e)]:[3,4];case 3:s=r.sent(),n(s),s.error?t.onRequestComplete(new p.JsonRpcErrorWrapper(s.error),null):t.onRequestComplete(null,s),r.label=4;case 4:this.dequeue(),r.label=5;case 5:return[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t.dequeue()})),this.payloadTransport.on(i.FmIncomingWindowMessage.FORTMATIC_USER_LOGOUT,(function(){t.account=null,t.network=null,t.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(e){t.queue.forEach((function(t){var e=new f.JsonRpcResponse(t.payload),n={message:"Fortmatic: Modal was closed without executing action!",code:1};t.onRequestComplete(new p.JsonRpcErrorWrapper(n),e.applyError(n).payload)})),t.queue.slice(0)}))},t}();e.FmProvider=h},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(r,a){function i(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}u((o=o.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){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=e.call(t,i)}catch(t){a=[6,t],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(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,a=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i};Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=n(7),c={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var l=function(){function t(t,e){this.endpoint=t,this.options=e,this._overlayReady=!1,this.iframe=this.init(),this.payloadTransport=new u.FmPayloadTransport(t),this.listen()}return Object.defineProperty(t.prototype,"overlayReady",{get:function(){return this._overlayReady},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iframeLabel",{get:function(){return new URL(this.endpoint).host},enumerable:!0,configurable:!0}),t.prototype.init=function(){var t=this;return new Promise((function(e){var n=function(){if(0===document.querySelectorAll('[data-fortmatic-iframe-label="'+t.iframeLabel+'"]').length){var n=document.createElement("iframe");n.classList.add("fortmatic-iframe"),n.dataset.fortmaticIframeLabel=t.iframeLabel,n.src=t.endpoint+"/send?params="+btoa(JSON.stringify(t.options)),function(t){var e,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];t.style[u]=l}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}(n),document.body.appendChild(n);var o=document.createElement("img");o.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(o),e(n)}else console.error("Fortmatic: Duplicate instances found.")};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}))},t.prototype.showOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="block",[2]}}))}))},t.prototype.hideOverlay=function(){return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.iframe];case 1:return t.sent().style.display="none",[2]}}))}))},t.prototype.listen=function(){var t=this;this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_OVERLAY_READY,(function(){t._overlayReady=!0})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_UNAUTHORIZED_API_KEY,(function(){t._overlayReady=!1})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_HIDE_OVERLAY,(function(){t.hideOverlay()})),this.payloadTransport.on(s.FmIncomingWindowMessage.FORTMATIC_SHOW_OVERLAY,(function(){t.showOverlay()}))},t}();e.FmIframeController=l},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(e){var n=t.call(this,e.message)||this;return n.code=e.code,n.name="FortmaticError",n}return r(e,t),e}(Error);e.JsonRpcErrorWrapper=a}]).default;
{
"name": "fortmatic",
"version": "2.0.0-54c5cfd8.12",
"version": "2.0.0-54c5cfd8.13",
"description": "Fortmatic Javascript SDK",

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

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