From 24beb7ed41734105811ecdd7cd426ccb83b2833a Mon Sep 17 00:00:00 2001 From: CodeSchwert Date: Wed, 31 Jul 2024 06:39:36 +0000 Subject: [PATCH] chore: update game bridge to 1.46.6 --- Web/index.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Web/index.js b/Web/index.js index c8a95d4..4a654e0 100644 --- a/Web/index.js +++ b/Web/index.js @@ -1,4 +1,4 @@ -!function(e,t,r,n,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[n]&&a[n],o=s.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!o[t]){if(!e[t]){var i="function"==typeof a[n]&&a[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(c&&"string"==typeof t)return c(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var d=o[t]=new f.Module(t);e[t][0].call(d.exports,l,d,d.exports,this)}return o[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=o,f.parent=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return a[n]}}),a[n]=f;for(var u=0;u{let t=JSON.stringify(e);if(console.log(`callbackToGame: ${t}`),console.log(t),void 0!==window.ue){if(void 0===window.ue.jsconnector){let e="Unreal JSConnector not defined";throw console.error(e),Error(e)}window.ue.jsconnector.sendtogame(t)}else if("undefined"!=typeof blu_event)blu_event("sendtogame",t);else if("undefined"!=typeof UnityPostMessage)UnityPostMessage(t);else if("undefined"!==window.Unity)window.Unity.call(t);else{let e="No available game callbacks to call from ImmutableSDK game-bridge";throw console.error(e),Error(e)}},m=()=>{if(null==n)throw Error("No Passport client");return n},b=e=>null!=e?(i=e,console.log("IMX provider set"),!0):(console.log("No IMX provider"),!1),g=()=>{if(null==i)throw Error("No IMX provider");return i},y=e=>null!=e?(a=e,console.log("zkEvm provider set"),!0):(console.log("No zkEvm provider"),!1),v=()=>{if(null==a)throw Error("No zkEvm provider");return a},w=e=>Date.now()-e;(0,f.track)(d,"loadedGameBridge",{sdkVersionTag:l}),window.callFunction=async e=>{console.log(`Call function ${e}`);let t=null,r=null,s=Date.now();try{let _=JSON.parse(e);t=_.fxName,r=_.requestId;let E=_.data;switch((0,f.track)(d,"startedCallFunction",{function:t}),t){case h.init:{let e=JSON.parse(E),i=e?.redirectUri;if(!n){let t={baseConfig:new c.ImmutableConfiguration({environment:e.environment}),clientId:e.clientId,audience:"platform_api",scope:"openid offline_access profile email transact",redirectUri:i??"https://localhost:3000/",logoutRedirectUri:e?.logoutRedirectUri,crossSdkBridgeEnabled:!0};n=new o.Passport(t),(0,f.trackDuration)(d,"initialisedPassport",w(s))}p({responseFor:t,requestId:r,success:!0,error:null});let{engineVersion:a}=e,u={gameBridgeTag:l,gameBridgeSha:"99a37467440e7545319714c0297928d542ead7e5",engine:a.engine,engineVersion:a.engineVersion,engineSdkVersion:a.engineSdkVersion??"",platform:a.platform,platformVersion:a.platformVersion,deviceModel:a.deviceModel??"N/A"};console.log(`Version check: ${JSON.stringify(u)}`),(0,f.trackDuration)(d,"completedInitGameBridge",w(s),{...u});break}case h.initDeviceFlow:{let e=await m().loginWithDeviceFlow();(0,f.trackDuration)(d,"performedInitDeviceFlow",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,code:e.code,deviceCode:e.deviceCode,url:e.url,interval:e.interval});break}case h.relogin:{let e=await m().login({useCachedSession:!0}),n=null!==e;if(!n)throw Error("Failed to re-login");(0,f.identify)({passportId:e?.sub}),(0,f.trackDuration)(d,"performedRelogin",w(s),{succeeded:n}),p({responseFor:t,requestId:r,success:null!==e,error:null});break}case h.reconnect:{let e=!1,n=await m().login({useCachedSession:!0});if(n){let t=await m().connectImx();e=b(t),(0,f.identify)({passportId:n?.sub})}if(!e)throw Error("Failed to reconnect");(0,f.trackDuration)(d,"performedReconnect",w(s),{succeeded:null!==n}),p({responseFor:t,requestId:r,success:e,error:null});break}case h.getPKCEAuthUrl:{let e=m().loginWithPKCEFlow();(0,f.trackDuration)(d,"performedGetPkceAuthUrl",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case h.loginPKCE:{let e=JSON.parse(E),n=await m().loginWithPKCEFlowCallback(e.authorizationCode,e.state);(0,f.identify)({passportId:n.sub}),(0,f.trackDuration)(d,"performedLoginPkce",w(s)),p({responseFor:t,requestId:r,success:!0,error:null});break}case h.connectPKCE:{let e=JSON.parse(E),n=await m().loginWithPKCEFlowCallback(e.authorizationCode,e.state),i=await m().connectImx(),a=b(i);if(!a)throw Error("Failed to connect via PKCE");(0,f.identify)({passportId:n.sub}),(0,f.trackDuration)(d,"performedConnectPkce",w(s),{succeeded:a}),p({responseFor:t,requestId:r,success:a,error:null});break}case h.loginConfirmCode:{let e=JSON.parse(E),n=await m().loginWithDeviceFlowCallback(e.deviceCode,e.interval,e.timeoutMs??null);(0,f.identify)({passportId:n.sub}),(0,f.trackDuration)(d,"performedLoginConfirmCode",w(s)),p({responseFor:t,requestId:r,success:!0,error:null});break}case h.connectConfirmCode:{let e=JSON.parse(E),n=await m().loginWithDeviceFlowCallback(e.deviceCode,e.interval,e.timeoutMs??null),i=await m().connectImx(),a=b(i);if(!a)throw Error("Failed to connect via confirm code");(0,f.identify)({passportId:n.sub}),(0,f.trackDuration)(d,"performedConnectConfirmCode",w(s),{succeeded:a}),p({responseFor:t,requestId:r,success:a,error:null});break}case h.logout:{let e=await m().logoutDeviceFlow();i=null,a=null,(0,f.trackDuration)(d,"performedGetLogoutUrl",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case h.getAccessToken:{let e=await m().getAccessToken(),n=void 0!==e;if(!n)throw Error("No access token");(0,f.trackDuration)(d,"performedGetAccessToken",w(s)),p({responseFor:t,requestId:r,success:n,error:null,result:e});break}case h.getIdToken:{let e=await m().getIdToken(),n=void 0!==e;if(!n)throw Error("No ID token");(0,f.trackDuration)(d,"performedGetIdToken",w(s)),p({responseFor:t,requestId:r,success:n,error:null,result:e});break}case h.getEmail:{let e=await m().getUserInfo(),n=e?.email!==void 0;if(!n)throw Error("No email");(0,f.trackDuration)(d,"performedGetEmail",w(s)),p({responseFor:t,requestId:r,success:n,error:null,result:e?.email});break}case h.getPassportId:{let e=await m().getUserInfo(),n=e?.sub!==void 0;if(!n)throw Error("No Passport ID");(0,f.trackDuration)(d,"performedGetPassportId",w(s)),p({responseFor:t,requestId:r,success:n,error:null,result:e?.sub});break}case h.getLinkedAddresses:{let e=await m().getLinkedAddresses();(0,f.trackDuration)(d,"performedGetLinkedAddresses",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case h.imx.getAddress:{let e=await g().getAddress();(0,f.trackDuration)(d,"performedImxGetAddress",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case h.imx.isRegisteredOffchain:{let e=await g().isRegisteredOffchain();(0,f.trackDuration)(d,"performedImxIsRegisteredOffchain",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case h.imx.registerOffchain:{let e=await g().registerOffchain();(0,f.trackDuration)(d,"performedImxRegisterOffchain",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,...e});break}case h.imx.transfer:{let e=JSON.parse(E),n=await g().transfer(e);(0,f.trackDuration)(d,"performedImxTransfer",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,...n});break}case h.imx.batchNftTransfer:{let e=JSON.parse(E),n=await g().batchNftTransfer(e);(0,f.trackDuration)(d,"performedImxBatchNftTransfer",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,...n});break}case h.zkEvm.connectEvm:{let e=m().connectEvm(),n=y(e);if(!n)throw Error("Failed to connect to EVM");(0,f.trackDuration)(d,"performedZkevmConnectEvm",w(s),{succeeded:n}),p({responseFor:t,requestId:r,success:n,error:null});break}case h.zkEvm.sendTransaction:{let e=JSON.parse(E),n=await v().request({method:"eth_sendTransaction",params:[e]}),i=null!=n;if(!i)throw Error("Failed to send transaction");(0,f.trackDuration)(d,"performedZkevmSendTransaction",w(s)),p({responseFor:t,requestId:r,success:i,error:null,result:n});break}case h.zkEvm.sendTransactionWithConfirmation:{let e=JSON.parse(E),n=v(),i=new u.providers.Web3Provider(n),a=i.getSigner(),o=await a.sendTransaction(e),c=await o.wait();(0,f.trackDuration)(d,"performedZkevmSendTransactionWithConfirmation",w(s)),p({responseFor:t,requestId:r,success:!0,error:null,...c});break}case h.zkEvm.requestAccounts:{let e=await v().request({method:"eth_requestAccounts"}),n=null!=e;if(!n)throw Error("Failed to request accounts");(0,f.trackDuration)(d,"performedZkevmRequestAccounts",w(s)),p({responseFor:t,requestId:r,success:n,error:null,accounts:e});break}case h.zkEvm.getBalance:{let e=JSON.parse(E),n=await v().request({method:"eth_getBalance",params:[e.address,e.blockNumberOrTag]}),i=null!=n;if(!i)throw Error("Failed to get balance");(0,f.trackDuration)(d,"performedZkevmGetBalance",w(s)),p({responseFor:t,requestId:r,success:i,error:null,result:n});break}case h.zkEvm.getTransactionReceipt:{let e=JSON.parse(E),n=await v().request({method:"eth_getTransactionReceipt",params:[e.txHash]}),i=null!=n;if(!i)throw Error("Failed to get transaction receipt");(0,f.trackDuration)(d,"performedZkevmGetTransactionReceipt",w(s)),p({responseFor:t,requestId:r,success:i,error:null,...n});break}case"track":{let e=JSON.parse(E),n=JSON.parse(e.properties);(0,f.track)(e.moduleName,e.eventName,n),p({responseFor:t,requestId:r,success:!0,error:null})}}}catch(i){let e;e=i instanceof Error?i:Error(i);let n=i instanceof o.PassportError?i?.type:void 0;(0,f.trackError)(d,t,e,{fxName:t,requestId:r,errorType:n}),(0,f.trackDuration)(d,"failedCallFunction",w(s),{fxName:t,requestId:r,error:e.message}),console.log("callFunction error",i),p({responseFor:t,requestId:r,success:!1,error:i?.message!==null&&i?.message!==void 0?i.message:"Error",errorType:i instanceof o.PassportError?i?.type:null})}},console.log("index.ts loaded"),s=function(){p({responseFor:"init",requestId:"1",success:!0,error:null})},"complete"===document.readyState?s():window.addEventListener("load",s)},{"@imtbl/passport":"iPtWy","@imtbl/config":"ed8SG","@imtbl/metrics":"dO0KB",ethers:"8wpcu"}],iPtWy:[function(e,t,r){let n;var i,a,s,o,c,f,u,d,l,h,p,m,b,g,y=e("@parcel/transformer-js/src/esmodule-helpers.js");y.defineInteropFlag(r),y.export(r,"JsonRpcError",()=>e2),y.export(r,"Passport",()=>tk),y.export(r,"PassportError",()=>z),y.export(r,"ProviderErrorCode",()=>b),y.export(r,"ProviderEvent",()=>m),y.export(r,"RpcErrorCode",()=>g);var v=e("axios"),w=y.interopDefault(v),_=e("@imtbl/generated-clients"),E=e("@imtbl/x-client"),A=e("@imtbl/config"),M=e("@imtbl/metrics"),S=e("oidc-client-ts"),x=e("crypto"),T=e("jwt-decode"),k=y.interopDefault(T),R=e("localforage"),I=y.interopDefault(R),C=e("magic-sdk"),P=e("@magic-ext/oidc"),O=e("@ethersproject/providers"),N=e("@imtbl/toolkit"),j=e("@imtbl/guardian"),B=e("ethers"),L=e("events"),D=e("@0xsequence/abi"),U=e("@0xsequence/core"),F=e("uuid"),q=e("a7402fb880ab41a1");(i=u||(u={})).AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",i.INVALID_CONFIGURATION="INVALID_CONFIGURATION",i.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",i.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",i.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",i.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",i.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",i.USER_NOT_REGISTERED_ERROR="USER_NOT_REGISTERED_ERROR",i.LOGOUT_ERROR="LOGOUT_ERROR",i.TRANSFER_ERROR="TRANSFER_ERROR",i.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",i.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",i.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",i.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",i.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR";class z extends Error{type;constructor(e,t){super(e),this.type=t}}let K=async(e,t)=>{try{return await e()}catch(n){var r;let e;throw e=(0,v.isAxiosError)(n)&&n.response?.data&&"code"in(r=n.response.data)&&"message"in r?n.response.data.message:n.message,new z(e,t)}},H="pkce_state",V="pkce_verifier";class W{areValid(e){if(e){let t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){try{let t=(0,k.default)(e),r=t.exp??0,n=Date.now()/1e3+3600;return r>n}catch(e){return!1}}savePKCEData(e){localStorage.setItem(H,e.state),localStorage.setItem(V,e.verifier)}getPKCEData(){let e=localStorage.getItem(H),t=localStorage.getItem(V);return e&&t?{state:e,verifier:t}:null}}var G={warn:(...e)=>{if(void 0===q)return;let t=q?.env?.JEST_WORKER_ID===void 0;t&&console.warn(...e)}};(a=d||(d={})).LOGGED_OUT="loggedOut",a.LOGGED_IN="loggedIn",a.ACCOUNTS_REQUESTED="accountsRequested";let J=e=>!!e.zkEvm,Z=e=>!!e.imx,$="passport-overlay",X=`${$}-close`,Y=`${$}-try-again`,Q=` +!function(e,t,r,n,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[n]&&a[n],o=s.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!o[t]){if(!e[t]){var i="function"==typeof a[n]&&a[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(c&&"string"==typeof t)return c(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var d=o[t]=new f.Module(t);e[t][0].call(d.exports,l,d,d.exports,this)}return o[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=o,f.parent=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return a[n]}}),a[n]=f;for(var u=0;u{let t=JSON.stringify(e);if(console.log(`callbackToGame: ${t}`),console.log(t),void 0!==window.ue){if(void 0===window.ue.jsconnector){let e="Unreal JSConnector not defined";throw console.error(e),Error(e)}window.ue.jsconnector.sendtogame(t)}else if("undefined"!=typeof blu_event)blu_event("sendtogame",t);else if("undefined"!=typeof UnityPostMessage)UnityPostMessage(t);else if("undefined"!==window.Unity)window.Unity.call(t);else{let e="No available game callbacks to call from ImmutableSDK game-bridge";throw console.error(e),Error(e)}},b=()=>{if(null==n)throw Error("No Passport client");return n},g=e=>null!=e?(i=e,console.log("IMX provider set"),!0):(console.log("No IMX provider"),!1),y=()=>{if(null==i)throw Error("No IMX provider");return i},v=e=>null!=e?(a=e,console.log("zkEvm provider set"),!0):(console.log("No zkEvm provider"),!1),w=()=>{if(null==a)throw Error("No zkEvm provider");return a},_=e=>Date.now()-e;(0,u.track)(l,"loadedGameBridge",{sdkVersionTag:h}),window.callFunction=async e=>{console.log(`Call function ${e}`);let t=null,r=null,o=Date.now();try{let E=JSON.parse(e);t=E.fxName,r=E.requestId;let A=E.data;switch((0,u.track)(l,"startedCallFunction",{function:t}),t){case p.init:{let e=JSON.parse(A),i=e?.redirectUri;if(!n){let t={baseConfig:new f.ImmutableConfiguration({environment:e.environment}),clientId:e.clientId,audience:"platform_api",scope:"openid offline_access profile email transact",redirectUri:i??"https://localhost:3000/",logoutRedirectUri:e?.logoutRedirectUri,crossSdkBridgeEnabled:!0};n=new c.Passport(t),(0,u.trackDuration)(l,"initialisedPassport",_(o))}m({responseFor:t,requestId:r,success:!0,error:null});let{engineVersion:a}=e;s={gameBridgeTag:h,gameBridgeSha:"__SDK_VERSION_SHA__",engine:a.engine,engineVersion:a.engineVersion,engineSdkVersion:a.engineSdkVersion??"",platform:a.platform,platformVersion:a.platformVersion,deviceModel:a.deviceModel??"N/A"},console.log(`Version check: ${JSON.stringify(s)}`),(0,u.trackDuration)(l,"completedInitGameBridge",_(o),{...s});break}case p.initDeviceFlow:{let e=await b().loginWithDeviceFlow();(0,u.trackDuration)(l,"performedInitDeviceFlow",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,code:e.code,deviceCode:e.deviceCode,url:e.url,interval:e.interval});break}case p.relogin:{let e=await b().login({useCachedSession:!0}),n=null!==e;if(!n)throw Error("Failed to re-login");(0,u.identify)({passportId:e?.sub}),(0,u.trackDuration)(l,"performedRelogin",_(o),{succeeded:n}),m({responseFor:t,requestId:r,success:null!==e,error:null});break}case p.reconnect:{let e=!1,n=await b().login({useCachedSession:!0});if(n){let t=await b().connectImx();e=g(t),(0,u.identify)({passportId:n?.sub})}if(!e)throw Error("Failed to reconnect");(0,u.trackDuration)(l,"performedReconnect",_(o),{succeeded:null!==n}),m({responseFor:t,requestId:r,success:e,error:null});break}case p.getPKCEAuthUrl:{let e=b().loginWithPKCEFlow();(0,u.trackDuration)(l,"performedGetPkceAuthUrl",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case p.loginPKCE:{let e=JSON.parse(A),n=await b().loginWithPKCEFlowCallback(e.authorizationCode,e.state);(0,u.identify)({passportId:n.sub}),(0,u.trackDuration)(l,"performedLoginPkce",_(o)),m({responseFor:t,requestId:r,success:!0,error:null});break}case p.connectPKCE:{let e=JSON.parse(A),n=await b().loginWithPKCEFlowCallback(e.authorizationCode,e.state),i=await b().connectImx(),a=g(i);if(!a)throw Error("Failed to connect via PKCE");(0,u.identify)({passportId:n.sub}),(0,u.trackDuration)(l,"performedConnectPkce",_(o),{succeeded:a}),m({responseFor:t,requestId:r,success:a,error:null});break}case p.loginConfirmCode:{let e=JSON.parse(A),n=await b().loginWithDeviceFlowCallback(e.deviceCode,e.interval,e.timeoutMs??null);(0,u.identify)({passportId:n.sub}),(0,u.trackDuration)(l,"performedLoginConfirmCode",_(o)),m({responseFor:t,requestId:r,success:!0,error:null});break}case p.connectConfirmCode:{let e=JSON.parse(A),n=await b().loginWithDeviceFlowCallback(e.deviceCode,e.interval,e.timeoutMs??null),i=await b().connectImx(),a=g(i);if(!a)throw Error("Failed to connect via confirm code");(0,u.identify)({passportId:n.sub}),(0,u.trackDuration)(l,"performedConnectConfirmCode",_(o),{succeeded:a}),m({responseFor:t,requestId:r,success:a,error:null});break}case p.logout:{let e=await b().logoutDeviceFlow();i=null,a=null,(0,u.trackDuration)(l,"performedGetLogoutUrl",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case p.getAccessToken:{let e=await b().getAccessToken(),n=void 0!==e;if(!n)throw Error("No access token");(0,u.trackDuration)(l,"performedGetAccessToken",_(o)),m({responseFor:t,requestId:r,success:n,error:null,result:e});break}case p.getIdToken:{let e=await b().getIdToken(),n=void 0!==e;if(!n)throw Error("No ID token");(0,u.trackDuration)(l,"performedGetIdToken",_(o)),m({responseFor:t,requestId:r,success:n,error:null,result:e});break}case p.getEmail:{let e=await b().getUserInfo(),n=e?.email!==void 0;if(!n)throw Error("No email");(0,u.trackDuration)(l,"performedGetEmail",_(o)),m({responseFor:t,requestId:r,success:n,error:null,result:e?.email});break}case p.getPassportId:{let e=await b().getUserInfo(),n=e?.sub!==void 0;if(!n)throw Error("No Passport ID");(0,u.trackDuration)(l,"performedGetPassportId",_(o)),m({responseFor:t,requestId:r,success:n,error:null,result:e?.sub});break}case p.getLinkedAddresses:{let e=await b().getLinkedAddresses();(0,u.trackDuration)(l,"performedGetLinkedAddresses",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case p.imx.getAddress:{let e=await y().getAddress();(0,u.trackDuration)(l,"performedImxGetAddress",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case p.imx.isRegisteredOffchain:{let e=await y().isRegisteredOffchain();(0,u.trackDuration)(l,"performedImxIsRegisteredOffchain",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,result:e});break}case p.imx.registerOffchain:{let e=await y().registerOffchain();(0,u.trackDuration)(l,"performedImxRegisterOffchain",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,...e});break}case p.imx.transfer:{let e=JSON.parse(A),n=await y().transfer(e);(0,u.trackDuration)(l,"performedImxTransfer",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,...n});break}case p.imx.batchNftTransfer:{let e=JSON.parse(A),n=await y().batchNftTransfer(e);(0,u.trackDuration)(l,"performedImxBatchNftTransfer",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,...n});break}case p.zkEvm.connectEvm:{let e=b().connectEvm(),n=v(e);if(!n)throw Error("Failed to connect to EVM");(0,u.trackDuration)(l,"performedZkevmConnectEvm",_(o),{succeeded:n}),m({responseFor:t,requestId:r,success:n,error:null});break}case p.zkEvm.sendTransaction:{let e=JSON.parse(A),n=await w().request({method:"eth_sendTransaction",params:[e]}),i=null!=n;if(!i)throw Error("Failed to send transaction");(0,u.trackDuration)(l,"performedZkevmSendTransaction",_(o)),m({responseFor:t,requestId:r,success:i,error:null,result:n});break}case p.zkEvm.sendTransactionWithConfirmation:{let e=JSON.parse(A),n=w(),i=new d.providers.Web3Provider(n),a=i.getSigner(),s=await a.sendTransaction(e),c=await s.wait();(0,u.trackDuration)(l,"performedZkevmSendTransactionWithConfirmation",_(o)),m({responseFor:t,requestId:r,success:!0,error:null,...c});break}case p.zkEvm.requestAccounts:{let e=await w().request({method:"eth_requestAccounts"}),n=null!=e;if(!n)throw Error("Failed to request accounts");(0,u.trackDuration)(l,"performedZkevmRequestAccounts",_(o)),m({responseFor:t,requestId:r,success:n,error:null,accounts:e});break}case p.zkEvm.getBalance:{let e=JSON.parse(A),n=await w().request({method:"eth_getBalance",params:[e.address,e.blockNumberOrTag]}),i=null!=n;if(!i)throw Error("Failed to get balance");(0,u.trackDuration)(l,"performedZkevmGetBalance",_(o)),m({responseFor:t,requestId:r,success:i,error:null,result:n});break}case p.zkEvm.getTransactionReceipt:{let e=JSON.parse(A),n=await w().request({method:"eth_getTransactionReceipt",params:[e.txHash]}),i=null!=n;if(!i)throw Error("Failed to get transaction receipt");(0,u.trackDuration)(l,"performedZkevmGetTransactionReceipt",_(o)),m({responseFor:t,requestId:r,success:i,error:null,...n});break}case"track":{let e=JSON.parse(A),n=JSON.parse(e.properties);(0,u.track)(e.moduleName,e.eventName,n),m({responseFor:t,requestId:r,success:!0,error:null})}}}catch(i){let e;e=i instanceof Error?i:Error(i);let n=i instanceof c.PassportError?i?.type:void 0;(0,u.trackError)(l,t,e,{fxName:t,requestId:r,errorType:n,...s}),(0,u.trackDuration)(l,"failedCallFunction",_(o),{fxName:t,requestId:r,error:e.message}),console.log("callFunction error",i),m({responseFor:t,requestId:r,success:!1,error:i?.message!==null&&i?.message!==void 0?i.message:"Error",errorType:i instanceof c.PassportError?i?.type:null})}},console.log("index.ts loaded"),o=function(){m({responseFor:"init",requestId:"1",success:!0,error:null})},"complete"===document.readyState?o():window.addEventListener("load",o)},{"@imtbl/passport":"iPtWy","@imtbl/config":"ed8SG","@imtbl/metrics":"dO0KB",ethers:"8wpcu"}],iPtWy:[function(e,t,r){let n;var i,a,s,o,c,f,u,d,l,h,p,m,b,g,y=e("@parcel/transformer-js/src/esmodule-helpers.js");y.defineInteropFlag(r),y.export(r,"JsonRpcError",()=>e6),y.export(r,"Passport",()=>tR),y.export(r,"PassportError",()=>K),y.export(r,"ProviderErrorCode",()=>b),y.export(r,"ProviderEvent",()=>m),y.export(r,"RpcErrorCode",()=>g);var v=e("axios"),w=y.interopDefault(v),_=e("@imtbl/metrics"),E=e("@imtbl/generated-clients"),A=e("@imtbl/x-client"),M=e("@imtbl/config"),S=e("oidc-client-ts"),x=e("crypto"),T=e("jwt-decode"),k=y.interopDefault(T),R=e("localforage"),I=y.interopDefault(R),C=e("magic-sdk"),P=e("@magic-ext/oidc"),O=e("@ethersproject/providers"),N=e("@imtbl/toolkit"),j=e("@imtbl/guardian"),B=e("ethers"),L=e("events"),D=e("@0xsequence/abi"),U=e("@0xsequence/core"),F=e("uuid"),q=e("a7402fb880ab41a1");function z(e){return"code"in e&&"message"in e}(i=u||(u={})).AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",i.INVALID_CONFIGURATION="INVALID_CONFIGURATION",i.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",i.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",i.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",i.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",i.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",i.USER_NOT_REGISTERED_ERROR="USER_NOT_REGISTERED_ERROR",i.LOGOUT_ERROR="LOGOUT_ERROR",i.TRANSFER_ERROR="TRANSFER_ERROR",i.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",i.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",i.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",i.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",i.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR",i.LINK_WALLET_ALREADY_LINKED_ERROR="LINK_WALLET_ALREADY_LINKED_ERROR",i.LINK_WALLET_MAX_WALLETS_LINKED_ERROR="LINK_WALLET_MAX_WALLETS_LINKED_ERROR",i.LINK_WALLET_VALIDATION_ERROR="LINK_WALLET_VALIDATION_ERROR",i.LINK_WALLET_DUPLICATE_NONCE_ERROR="LINK_WALLET_DUPLICATE_NONCE_ERROR",i.LINK_WALLET_GENERIC_ERROR="LINK_WALLET_GENERIC_ERROR";class K extends Error{type;constructor(e,t){super(e),this.type=t}}let H=async(e,t,r)=>{try{return await e()}catch(i){let e;e=(0,v.isAxiosError)(i)&&i.response?.data&&z(i.response.data)?i.response.data.message:i.message;let n=new K(e,t);throw r&&(0,_.trackError)("passport",r,n),n}},V="pkce_state",W="pkce_verifier";class G{areValid(e){if(e){let t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){try{let t=(0,k.default)(e),r=t.exp??0,n=Date.now()/1e3+3600;return r>n}catch(e){return!1}}savePKCEData(e){localStorage.setItem(V,e.state),localStorage.setItem(W,e.verifier)}getPKCEData(){let e=localStorage.getItem(V),t=localStorage.getItem(W);return e&&t?{state:e,verifier:t}:null}}var J={warn:(...e)=>{if(void 0===q)return;let t=q?.env?.JEST_WORKER_ID===void 0;t&&console.warn(...e)}};(a=d||(d={})).LOGGED_OUT="loggedOut",a.LOGGED_IN="loggedIn",a.ACCOUNTS_REQUESTED="accountsRequested";let Z=e=>!!e.zkEvm,$=e=>!!e.imx,X="passport-overlay",Y=`${X}-close`,Q=`${X}-try-again`,ee=` -`,ee=` +`,et=` -`,et=` +`,er=` - ${Q} + ${ee} - `,en=()=>` + `,ei=()=>`
- ${ee} + ${et} Pop-up blocked

Secure pop-up not showing?
We'll help you re-launch

- `,ea=()=>` + `,es=()=>`