From b7ed02e3a63739434be4c51e7f26bff2abe17daa Mon Sep 17 00:00:00 2001 From: CodeSchwert Date: Fri, 26 Jul 2024 07:18:35 +0000 Subject: [PATCH] chore: update game bridge to 1.46.3 --- Web/index.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Web/index.js b/Web/index.js index c8a95d4..f38089a 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)}},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:"d7a375891f0a307c32d58add07000fbe241f3542",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",()=>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/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");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)=>{try{return await e()}catch(r){let e;throw e=(0,v.isAxiosError)(r)&&r.response?.data&&z(r.response.data)?r.response.data.message:r.message,new K(e,t)}},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=()=>`