@multiversx/sdk-dapp 5.1.6 → 5.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/__chunks__/chunk-26I72KPF.mjs +2 -0
- package/out/__chunks__/chunk-2EJDUI4F.mjs +2 -0
- package/out/__chunks__/chunk-3462VWV2.mjs +2 -0
- package/out/__chunks__/chunk-355TDGZM.mjs +2 -0
- package/out/__chunks__/chunk-355TDGZM.mjs.map +7 -0
- package/out/__chunks__/{chunk-QDKEGSAE.mjs → chunk-3TKKCFM4.mjs} +2 -2
- package/out/__chunks__/{chunk-FF3CITEE.mjs → chunk-4FD6QSAE.mjs} +2 -2
- package/out/__chunks__/{chunk-3OO2PJ5E.mjs → chunk-4PIR4ESS.mjs} +2 -2
- package/out/__chunks__/chunk-5DKIUS4V.mjs +2 -0
- package/out/__chunks__/{chunk-UAYONFID.mjs → chunk-5LDRZKQG.mjs} +2 -2
- package/out/__chunks__/{chunk-PQUU625Y.mjs → chunk-5Q2JDZD3.mjs} +2 -2
- package/out/__chunks__/chunk-66D2TGF6.mjs +2 -0
- package/out/__chunks__/chunk-66D2TGF6.mjs.map +7 -0
- package/out/__chunks__/{chunk-ISVH77R7.mjs → chunk-6KB3FBQO.mjs} +2 -2
- package/out/__chunks__/{chunk-575BWL2S.mjs → chunk-6KIQJGRP.mjs} +2 -2
- package/out/__chunks__/{chunk-NSKXXUF3.mjs → chunk-6OBHBOL7.mjs} +2 -2
- package/out/__chunks__/{chunk-UHYEAGVT.mjs → chunk-6OVM3ZX6.mjs} +2 -2
- package/out/__chunks__/chunk-6VSANQCL.mjs +2 -0
- package/out/__chunks__/chunk-7BTDFBMU.mjs +2 -0
- package/out/__chunks__/chunk-7BTDFBMU.mjs.map +7 -0
- package/out/__chunks__/{chunk-THFGSZAO.mjs → chunk-A4WTVE3V.mjs} +2 -2
- package/out/__chunks__/{chunk-VVVJMWC7.mjs → chunk-A7PB4MFL.mjs} +2 -2
- package/out/__chunks__/{chunk-U7K25PTV.mjs → chunk-AUZPUAD4.mjs} +2 -2
- package/out/__chunks__/{chunk-XD66BXVH.mjs → chunk-B6YF7H7U.mjs} +2 -2
- package/out/__chunks__/{chunk-SOCKMSP3.mjs → chunk-B7VN77JG.mjs} +2 -2
- package/out/__chunks__/chunk-BIEPQOD5.mjs +2 -0
- package/out/__chunks__/{chunk-A5YEUL6E.mjs → chunk-BYMTQKPA.mjs} +2 -2
- package/out/__chunks__/{chunk-RJKUZ653.mjs → chunk-CFCHCCTH.mjs} +2 -2
- package/out/__chunks__/{chunk-VF4NEQOC.mjs → chunk-CQXLKX4W.mjs} +2 -2
- package/out/__chunks__/chunk-DJCWPLIW.mjs +2 -0
- package/out/__chunks__/{chunk-J2SA53FJ.mjs → chunk-DQUL7SM3.mjs} +2 -2
- package/out/__chunks__/{chunk-64SIZQ4A.mjs → chunk-DSSANNT5.mjs} +2 -2
- package/out/__chunks__/chunk-ENGIAAJA.mjs +2 -0
- package/out/__chunks__/chunk-ETED4JB5.mjs +2 -0
- package/out/__chunks__/{chunk-3UYFSQJC.mjs.map → chunk-ETED4JB5.mjs.map} +1 -1
- package/out/__chunks__/chunk-FG6BP2H5.mjs +2 -0
- package/out/__chunks__/chunk-FG6BP2H5.mjs.map +7 -0
- package/out/__chunks__/{chunk-G2PLL4CC.mjs → chunk-FODR6WTG.mjs} +2 -2
- package/out/__chunks__/chunk-FQTEXMMN.mjs +2 -0
- package/out/__chunks__/{chunk-3RVLQV7F.mjs → chunk-GRU4NOFI.mjs} +2 -2
- package/out/__chunks__/{chunk-XDM4RXOI.mjs → chunk-HBYQEHJE.mjs} +2 -2
- package/out/__chunks__/{chunk-6RKXIEWW.mjs → chunk-I6DCGYFE.mjs} +2 -2
- package/out/__chunks__/{chunk-QYVT3QOR.mjs → chunk-ICDR3HC5.mjs} +2 -2
- package/out/__chunks__/{chunk-7PNJRSBM.mjs → chunk-IMXMFXER.mjs} +2 -2
- package/out/__chunks__/{chunk-2BG7AZYX.mjs → chunk-IYYCFUH4.mjs} +2 -2
- package/out/__chunks__/{chunk-PRPABOZE.mjs → chunk-J65JH3Q2.mjs} +2 -2
- package/out/__chunks__/{chunk-H34PCHYS.mjs → chunk-J6CFAYIO.mjs} +2 -2
- package/out/__chunks__/{chunk-RDP6VYTK.mjs → chunk-JBNKG6XC.mjs} +2 -2
- package/out/__chunks__/{chunk-6KOUCJBK.mjs → chunk-JGEBMC2K.mjs} +2 -2
- package/out/__chunks__/{chunk-66AEOYAI.mjs → chunk-JTWAEL7D.mjs} +2 -2
- package/out/__chunks__/{chunk-DJYYELSI.mjs → chunk-KJIGI7AM.mjs} +2 -2
- package/out/__chunks__/{chunk-LT4WBCNY.mjs → chunk-KLZC6NYC.mjs} +2 -2
- package/out/__chunks__/{chunk-2BDFMCV6.mjs → chunk-L5WRBBHH.mjs} +2 -2
- package/out/__chunks__/{chunk-EVP5GFFK.mjs → chunk-LH5IBSC3.mjs} +2 -2
- package/out/__chunks__/{chunk-YICLYRWL.mjs → chunk-LIQTTAAS.mjs} +2 -2
- package/out/__chunks__/{chunk-H3NZ6BVM.mjs → chunk-LMG7PLUI.mjs} +2 -2
- package/out/__chunks__/{chunk-WPIKF7VY.mjs → chunk-LS5QVDML.mjs} +2 -2
- package/out/__chunks__/{chunk-CGPXKO6Q.mjs → chunk-LX2TO34O.mjs} +2 -2
- package/out/__chunks__/{chunk-IL2H4RXA.mjs → chunk-MFMWGMLN.mjs} +2 -2
- package/out/__chunks__/{chunk-AVDBWEOB.mjs → chunk-MSFYVSIA.mjs} +2 -2
- package/out/__chunks__/{chunk-XS35527Q.mjs → chunk-NN2ODLFY.mjs} +2 -2
- package/out/__chunks__/{chunk-CQNWLJEW.mjs → chunk-NOAPU5US.mjs} +2 -2
- package/out/__chunks__/{chunk-YO3QD3RT.mjs → chunk-NPF3MLTJ.mjs} +2 -2
- package/out/__chunks__/chunk-NXTU644D.mjs +2 -0
- package/out/__chunks__/{chunk-XBDFLPDP.mjs → chunk-OD7MJ7CA.mjs} +2 -2
- package/out/__chunks__/{chunk-N6YAJHO2.mjs → chunk-OPVHND3O.mjs} +2 -2
- package/out/__chunks__/{chunk-KBNE74VW.mjs → chunk-OQOS52S7.mjs} +2 -2
- package/out/__chunks__/{chunk-5OCHCEMP.mjs → chunk-P5EDEM26.mjs} +2 -2
- package/out/__chunks__/{chunk-GGFRARKJ.mjs → chunk-PM2CIPJB.mjs} +2 -2
- package/out/__chunks__/{chunk-7SEPLODG.mjs → chunk-Q3AAD4PW.mjs} +2 -2
- package/out/__chunks__/chunk-QN2BIRAC.mjs +2 -0
- package/out/__chunks__/{chunk-E3YY6EFZ.mjs → chunk-QUVHL3QF.mjs} +2 -2
- package/out/__chunks__/chunk-RSJC4YBI.mjs +2 -0
- package/out/__chunks__/{chunk-IPRDBCJL.mjs → chunk-SJDGXLII.mjs} +2 -2
- package/out/__chunks__/chunk-TF2JS3TY.mjs +2 -0
- package/out/__chunks__/chunk-URXO7GNH.mjs +2 -0
- package/out/__chunks__/{chunk-QQYLFECS.mjs → chunk-V5VIOBBE.mjs} +2 -2
- package/out/__chunks__/{chunk-SWQZKECU.mjs → chunk-VRU7SNQA.mjs} +2 -2
- package/out/__chunks__/chunk-WGESEEJ2.mjs +2 -0
- package/out/__chunks__/{chunk-JKP4S7G7.mjs → chunk-XONPIJ3Y.mjs} +2 -2
- package/out/__chunks__/{chunk-CSMPAIH6.mjs → chunk-Y57ROHMV.mjs} +2 -2
- package/out/__chunks__/{chunk-XV2F257X.mjs → chunk-YEQDJ3AV.mjs} +2 -2
- package/out/__chunks__/chunk-YEQDJ3AV.mjs.map +7 -0
- package/out/__chunks__/{chunk-PQNKIJXU.mjs → chunk-YMBVUA56.mjs} +2 -2
- package/out/__chunks__/{chunk-V7ZVF4G7.mjs → chunk-ZVDPYIMB.mjs} +2 -2
- package/out/apiCalls/account/getScamAddressData.mjs +1 -1
- package/out/apiCalls/configuration/getCleanApiAddress.mjs +1 -1
- package/out/apiCalls/configuration/getGasStationMetadata.mjs +1 -1
- package/out/apiCalls/index.mjs +1 -1
- package/out/apiCalls/tokens/getPersistedTokenDetails.mjs +1 -1
- package/out/apiCalls/tokens/getTokenDetails.mjs +1 -1
- package/out/apiCalls/tokens/index.mjs +1 -1
- package/out/apiCalls/transactions/getServerTransactionsByHashes.mjs +1 -1
- package/out/apiCalls/transactions/getTransactionByHash.mjs +1 -1
- package/out/apiCalls/transactions/getTransactionsByHashes.mjs +1 -1
- package/out/constants/browser.constants.mjs +1 -1
- package/out/constants/index.mjs +1 -1
- package/out/constants/storage.constants.mjs +1 -1
- package/out/constants/window.constants.cjs +1 -1
- package/out/constants/window.constants.cjs.map +1 -1
- package/out/constants/window.constants.mjs +1 -1
- package/out/controllers/TransactionsHistoryController/TransactionsHistoryController.mjs +1 -1
- package/out/controllers/TransactionsHistoryController/index.mjs +1 -1
- package/out/controllers/TransactionsTableController/TransactionsTableController.mjs +1 -1
- package/out/controllers/TransactionsTableController/index.mjs +1 -1
- package/out/index.mjs +1 -1
- package/out/lib/sdkDappUi.mjs +1 -1
- package/out/managers/LogoutManager/LogoutManager.mjs +1 -1
- package/out/managers/NotificationsFeedManager/NotificationsFeedManager.mjs +1 -1
- package/out/managers/NotificationsFeedManager/index.mjs +1 -1
- package/out/managers/TransactionManager/TransactionManager.mjs +1 -1
- package/out/managers/TransactionManager/helpers/getAreTransactionsCorssShards.mjs +1 -1
- package/out/managers/TransactionManager/helpers/getToastDuration.mjs +1 -1
- package/out/managers/TransactionManager/index.mjs +1 -1
- package/out/managers/UnlockPanelManager/UnlockPanelManager.mjs +1 -1
- package/out/managers/UnlockPanelManager/index.mjs +1 -1
- package/out/managers/index.mjs +1 -1
- package/out/managers/internal/LedgerConnectStateManager/LedgerConnectStateManager.mjs +1 -1
- package/out/managers/internal/LedgerConnectStateManager/index.mjs +1 -1
- package/out/managers/internal/LedgerIdleStateManager/LedgerIdleStateManager.mjs +1 -1
- package/out/managers/internal/PendingTransactionsStateManager/PendingTransactionsStateManager.mjs +1 -1
- package/out/managers/internal/PendingTransactionsStateManager/index.mjs +1 -1
- package/out/managers/internal/SidePanelBaseManager/SidePanelBaseManager.mjs +1 -1
- package/out/managers/internal/SidePanelBaseManager/index.mjs +1 -1
- package/out/managers/internal/SignTransactionsStateManager/SignTransactionsStateManager.mjs +1 -1
- package/out/managers/internal/SignTransactionsStateManager/index.mjs +1 -1
- package/out/managers/internal/ToastManager/ToastManager.cjs +18 -5
- package/out/managers/internal/ToastManager/ToastManager.cjs.map +2 -2
- package/out/managers/internal/ToastManager/ToastManager.mjs +1 -1
- package/out/managers/internal/ToastManager/helpers/LifetimeManager.mjs +1 -1
- package/out/managers/internal/ToastManager/helpers/createToastsFromTransactions.cjs +4 -2
- package/out/managers/internal/ToastManager/helpers/createToastsFromTransactions.cjs.map +2 -2
- package/out/managers/internal/ToastManager/helpers/createToastsFromTransactions.d.ts +2 -1
- package/out/managers/internal/ToastManager/helpers/createToastsFromTransactions.mjs +1 -1
- package/out/managers/internal/UIBaseManager/UIBaseManager.mjs +1 -1
- package/out/managers/internal/WalletConnectStateManager/WalletConnectStateManager.mjs +1 -1
- package/out/managers/internal/WalletConnectStateManager/index.mjs +1 -1
- package/out/managers/internal/index.mjs +1 -1
- package/out/methods/account/getAccount.mjs +1 -1
- package/out/methods/account/getAccountInfo.mjs +1 -1
- package/out/methods/account/getAddress.mjs +1 -1
- package/out/methods/account/getIsLoggedIn.mjs +1 -1
- package/out/methods/account/getLatestNonce.mjs +1 -1
- package/out/methods/initApp/gastStationMetadata/setGasStationMetadata.mjs +1 -1
- package/out/methods/initApp/initApp.mjs +1 -1
- package/out/methods/initApp/websocket/initializeWebsocketConnection.mjs +1 -1
- package/out/methods/initApp/websocket/registerWebsocket.mjs +1 -1
- package/out/methods/loginInfo/getLoginInfo.mjs +1 -1
- package/out/methods/network/getEgldLabel.mjs +1 -1
- package/out/methods/network/getExplorerAddress.mjs +1 -1
- package/out/methods/network/getNetworkConfig.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/checkBatch.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/checkTransactionStatus.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/index.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/manageFailedTransactions.mjs +1 -1
- package/out/methods/trackTransactions/helpers/getPollingInterval.mjs +1 -1
- package/out/methods/trackTransactions/trackTransactions.mjs +1 -1
- package/out/methods/transactions/getFailedTransactions.mjs +1 -1
- package/out/methods/transactions/getFailedTransactionsSessions.mjs +1 -1
- package/out/methods/transactions/getPendingTransactions.mjs +1 -1
- package/out/methods/transactions/getPendingTransactionsSessions.mjs +1 -1
- package/out/methods/transactions/getSuccessfulTransactions.mjs +1 -1
- package/out/methods/transactions/getSuccessfulTransactionsSessions.mjs +1 -1
- package/out/methods/transactions/getTransactionSessions.mjs +1 -1
- package/out/providers/DappProvider/DappProvider.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/accountLogin.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/extractAddressFromToken.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/getAccountFromToken.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/getModifiedLoginToken.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/login.mjs +1 -1
- package/out/providers/DappProvider/helpers/logout/logout.mjs +1 -1
- package/out/providers/DappProvider/helpers/signErrors/handleSignError.mjs +1 -1
- package/out/providers/DappProvider/helpers/signMessage/signMessageWithProvider.mjs +1 -1
- package/out/providers/DappProvider/helpers/signTransactions/signTransactionsWithProvider.mjs +1 -1
- package/out/providers/DappProvider/index.mjs +1 -1
- package/out/providers/ProviderFactory.mjs +1 -1
- package/out/providers/helpers/accountProvider.mjs +1 -1
- package/out/providers/helpers/cancelCrossWindowAction.mjs +1 -1
- package/out/providers/helpers/restoreProvider.cjs +2 -1
- package/out/providers/helpers/restoreProvider.cjs.map +2 -2
- package/out/providers/helpers/restoreProvider.mjs +1 -1
- package/out/providers/index.mjs +1 -1
- package/out/providers/strategies/BaseProviderStrategy/BaseProviderStrategy.mjs +1 -1
- package/out/providers/strategies/CrossWindowProviderStrategy/CrossWindowProviderStrategy.mjs +1 -1
- package/out/providers/strategies/CrossWindowProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/ExtensionProviderStrategy/ExtensionProviderStrategy.mjs +1 -1
- package/out/providers/strategies/ExtensionProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/IframeProviderStrategy/IframeProviderStrategy.mjs +1 -1
- package/out/providers/strategies/IframeProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/LedgerProviderStrategy.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/authenticateLedgerAccount.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getAuthTokenText.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerConfiguration.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerProvider.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerVersionOptions.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/index.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/initializeLedgerProvider.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/signLedgerMessage.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/updateAccountsList/index.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/updateAccountsList/updateAccountsList.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/WalletConnectProviderStrategy/WalletConnectProviderStrategy.mjs +1 -1
- package/out/providers/strategies/WalletConnectProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/WebviewProviderStrategy/WebviewClient/WebviewClient.cjs +2 -1
- package/out/providers/strategies/WebviewProviderStrategy/WebviewClient/WebviewClient.cjs.map +2 -2
- package/out/providers/strategies/WebviewProviderStrategy/WebviewClient/WebviewClient.mjs +1 -1
- package/out/providers/strategies/WebviewProviderStrategy/WebviewClient/index.mjs +1 -1
- package/out/providers/strategies/WebviewProviderStrategy/WebviewProviderStrategy.mjs +1 -1
- package/out/providers/strategies/WebviewProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/helpers/getPendingTransactionsHandlers.mjs +1 -1
- package/out/providers/strategies/helpers/index.mjs +1 -1
- package/out/providers/strategies/helpers/signMessage/signMessage.mjs +1 -1
- package/out/providers/strategies/helpers/signTransactions/helpers/calculateFeeLimit.mjs +1 -1
- package/out/providers/strategies/helpers/signTransactions/helpers/getCommonData/getCommonData.mjs +1 -1
- package/out/providers/strategies/helpers/signTransactions/helpers/getCommonData/helpers/getExtractTransactionsInfo.mjs +1 -1
- package/out/providers/strategies/helpers/signTransactions/helpers/getFeeData.mjs +1 -1
- package/out/providers/strategies/helpers/signTransactions/helpers/guardTransactions/guardTransactions.mjs +1 -1
- package/out/providers/strategies/helpers/signTransactions/signTransactions.mjs +1 -1
- package/out/providers/strategies/index.mjs +1 -1
- package/out/react/account/useGetAccount.mjs +1 -1
- package/out/react/account/useGetAccountInfo.mjs +1 -1
- package/out/react/account/useGetIsLoggedIn.mjs +1 -1
- package/out/react/account/useGetLatestNonce.mjs +1 -1
- package/out/react/index.mjs +1 -1
- package/out/react/loginInfo/useGetLoginInfo.mjs +1 -1
- package/out/react/network/useGetNetworkConfig.mjs +1 -1
- package/out/react/store/getReactStore.mjs +1 -1
- package/out/react/store/useSelector.mjs +1 -1
- package/out/react/transactions/useGetFailedTransactions.mjs +1 -1
- package/out/react/transactions/useGetFailedTransactionsSessions.mjs +1 -1
- package/out/react/transactions/useGetPendingTransactions.mjs +1 -1
- package/out/react/transactions/useGetPendingTransactionsSessions.mjs +1 -1
- package/out/react/transactions/useGetSuccessfulTransactions.mjs +1 -1
- package/out/react/transactions/useGetSuccessfulTransactionsSessions.mjs +1 -1
- package/out/react/transactions/useGetTransactionSessions.mjs +1 -1
- package/out/services/index.mjs +1 -1
- package/out/services/nativeAuth/index.mjs +1 -1
- package/out/services/nativeAuth/methods/buildNativeAuthConfig.mjs +1 -1
- package/out/services/nativeAuth/methods/getDefaultNativeAuthConfig.mjs +1 -1
- package/out/services/nativeAuth/methods/index.mjs +1 -1
- package/out/services/nativeAuth/nativeAuth.mjs +1 -1
- package/out/store/actions/account/accountActions.mjs +1 -1
- package/out/store/actions/account/index.mjs +1 -1
- package/out/store/actions/cache/cacheActions.mjs +1 -1
- package/out/store/actions/cache/index.mjs +1 -1
- package/out/store/actions/config/configActions.mjs +1 -1
- package/out/store/actions/config/index.mjs +1 -1
- package/out/store/actions/index.mjs +1 -1
- package/out/store/actions/loginInfo/loginInfoActions.mjs +1 -1
- package/out/store/actions/network/index.mjs +1 -1
- package/out/store/actions/network/initializeNetwork.mjs +1 -1
- package/out/store/actions/network/networkActions.mjs +1 -1
- package/out/store/actions/sharedActions/index.mjs +1 -1
- package/out/store/actions/sharedActions/sharedActions.mjs +1 -1
- package/out/store/actions/toasts/index.mjs +1 -1
- package/out/store/actions/toasts/toastsActions.mjs +1 -1
- package/out/store/actions/transactions/transactionsActions.mjs +1 -1
- package/out/store/actions/ui/index.mjs +1 -1
- package/out/store/actions/ui/uiActions.mjs +1 -1
- package/out/store/middleware/applyMiddlewares.mjs +1 -1
- package/out/store/middleware/index.mjs +1 -1
- package/out/store/middleware/logoutMiddleware.mjs +1 -1
- package/out/store/storage/index.mjs +1 -1
- package/out/store/storage/storageCallback.mjs +1 -1
- package/out/store/store.mjs +1 -1
- package/out/utils/ComponentFactory.mjs +1 -1
- package/out/utils/account/index.mjs +1 -1
- package/out/utils/account/refreshAccount.mjs +1 -1
- package/out/utils/account/refreshNativeAuthTokenLogin.mjs +1 -1
- package/out/utils/index.mjs +1 -1
- package/out/utils/transactions/getActiveTransactionsStatus.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/getInterpretedTransaction.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/helpers/getLockedAccountName.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/helpers/getReceiptMessage.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/helpers/getShardText.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/helpers/getTransactionIconInfo.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/helpers/getTransactionMessages.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/helpers/index.mjs +1 -1
- package/out/utils/transactions/getInterpretedTransaction/index.mjs +1 -1
- package/out/utils/transactions/getTransactionsHistory/getTransactionsHistory.mjs +1 -1
- package/out/utils/transactions/getTransactionsHistory/helpers/getCachedTransactionListItem.mjs +1 -1
- package/out/utils/transactions/getTransactionsHistory/helpers/index.mjs +1 -1
- package/out/utils/transactions/getTransactionsHistory/helpers/mapServerTransactionsToListItems.cjs +19 -4
- package/out/utils/transactions/getTransactionsHistory/helpers/mapServerTransactionsToListItems.cjs.map +2 -2
- package/out/utils/transactions/getTransactionsHistory/helpers/mapServerTransactionsToListItems.d.ts +2 -1
- package/out/utils/transactions/getTransactionsHistory/helpers/mapServerTransactionsToListItems.mjs +1 -1
- package/out/utils/transactions/getTransactionsHistory/index.mjs +1 -1
- package/out/utils/transactions/index.mjs +1 -1
- package/out/utils/visual/index.mjs +1 -1
- package/out/utils/visual/switchTheme.mjs +1 -1
- package/out/utils/window/getIsInIframe.mjs +1 -1
- package/out/utils/window/getWindowParentOrigin.mjs +1 -1
- package/out/utils/window/index.mjs +1 -1
- package/package.json +2 -2
- package/out/__chunks__/chunk-24YD5YQR.mjs +0 -2
- package/out/__chunks__/chunk-3EUMNUIN.mjs +0 -2
- package/out/__chunks__/chunk-3UYFSQJC.mjs +0 -2
- package/out/__chunks__/chunk-3YNJTF3V.mjs +0 -2
- package/out/__chunks__/chunk-422QE3FU.mjs +0 -2
- package/out/__chunks__/chunk-4EHSLTS7.mjs +0 -2
- package/out/__chunks__/chunk-7UDSVANN.mjs +0 -2
- package/out/__chunks__/chunk-AILGXDNS.mjs +0 -2
- package/out/__chunks__/chunk-DCC7FDBZ.mjs +0 -2
- package/out/__chunks__/chunk-F3VK7GN4.mjs +0 -2
- package/out/__chunks__/chunk-F3VK7GN4.mjs.map +0 -7
- package/out/__chunks__/chunk-KDQYDWVH.mjs +0 -2
- package/out/__chunks__/chunk-MQW4VU2U.mjs +0 -2
- package/out/__chunks__/chunk-OUE73NQT.mjs +0 -2
- package/out/__chunks__/chunk-Q35CW3O7.mjs +0 -2
- package/out/__chunks__/chunk-QQYKT7DZ.mjs +0 -2
- package/out/__chunks__/chunk-QQYKT7DZ.mjs.map +0 -7
- package/out/__chunks__/chunk-RZGMEYEV.mjs +0 -2
- package/out/__chunks__/chunk-SXK6H7XE.mjs +0 -2
- package/out/__chunks__/chunk-TDFHHNYX.mjs +0 -2
- package/out/__chunks__/chunk-TDFHHNYX.mjs.map +0 -7
- package/out/__chunks__/chunk-U44EUWQT.mjs +0 -2
- package/out/__chunks__/chunk-XV2F257X.mjs.map +0 -7
- package/out/__chunks__/chunk-XX44YK52.mjs +0 -2
- package/out/__chunks__/chunk-XX44YK52.mjs.map +0 -7
- /package/out/__chunks__/{chunk-AILGXDNS.mjs.map → chunk-26I72KPF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-7UDSVANN.mjs.map → chunk-2EJDUI4F.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-24YD5YQR.mjs.map → chunk-3462VWV2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QDKEGSAE.mjs.map → chunk-3TKKCFM4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-FF3CITEE.mjs.map → chunk-4FD6QSAE.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3OO2PJ5E.mjs.map → chunk-4PIR4ESS.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-422QE3FU.mjs.map → chunk-5DKIUS4V.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UAYONFID.mjs.map → chunk-5LDRZKQG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PQUU625Y.mjs.map → chunk-5Q2JDZD3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ISVH77R7.mjs.map → chunk-6KB3FBQO.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-575BWL2S.mjs.map → chunk-6KIQJGRP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-NSKXXUF3.mjs.map → chunk-6OBHBOL7.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UHYEAGVT.mjs.map → chunk-6OVM3ZX6.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-4EHSLTS7.mjs.map → chunk-6VSANQCL.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-THFGSZAO.mjs.map → chunk-A4WTVE3V.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VVVJMWC7.mjs.map → chunk-A7PB4MFL.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-U7K25PTV.mjs.map → chunk-AUZPUAD4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XD66BXVH.mjs.map → chunk-B6YF7H7U.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SOCKMSP3.mjs.map → chunk-B7VN77JG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-MQW4VU2U.mjs.map → chunk-BIEPQOD5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-A5YEUL6E.mjs.map → chunk-BYMTQKPA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RJKUZ653.mjs.map → chunk-CFCHCCTH.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VF4NEQOC.mjs.map → chunk-CQXLKX4W.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RZGMEYEV.mjs.map → chunk-DJCWPLIW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-J2SA53FJ.mjs.map → chunk-DQUL7SM3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-64SIZQ4A.mjs.map → chunk-DSSANNT5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3EUMNUIN.mjs.map → chunk-ENGIAAJA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-G2PLL4CC.mjs.map → chunk-FODR6WTG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-DCC7FDBZ.mjs.map → chunk-FQTEXMMN.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3RVLQV7F.mjs.map → chunk-GRU4NOFI.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XDM4RXOI.mjs.map → chunk-HBYQEHJE.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-6RKXIEWW.mjs.map → chunk-I6DCGYFE.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QYVT3QOR.mjs.map → chunk-ICDR3HC5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-7PNJRSBM.mjs.map → chunk-IMXMFXER.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2BG7AZYX.mjs.map → chunk-IYYCFUH4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PRPABOZE.mjs.map → chunk-J65JH3Q2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-H34PCHYS.mjs.map → chunk-J6CFAYIO.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RDP6VYTK.mjs.map → chunk-JBNKG6XC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-6KOUCJBK.mjs.map → chunk-JGEBMC2K.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-66AEOYAI.mjs.map → chunk-JTWAEL7D.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-DJYYELSI.mjs.map → chunk-KJIGI7AM.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-LT4WBCNY.mjs.map → chunk-KLZC6NYC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2BDFMCV6.mjs.map → chunk-L5WRBBHH.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-EVP5GFFK.mjs.map → chunk-LH5IBSC3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-YICLYRWL.mjs.map → chunk-LIQTTAAS.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-H3NZ6BVM.mjs.map → chunk-LMG7PLUI.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-WPIKF7VY.mjs.map → chunk-LS5QVDML.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-CGPXKO6Q.mjs.map → chunk-LX2TO34O.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-IL2H4RXA.mjs.map → chunk-MFMWGMLN.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AVDBWEOB.mjs.map → chunk-MSFYVSIA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XS35527Q.mjs.map → chunk-NN2ODLFY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-CQNWLJEW.mjs.map → chunk-NOAPU5US.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-YO3QD3RT.mjs.map → chunk-NPF3MLTJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-Q35CW3O7.mjs.map → chunk-NXTU644D.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XBDFLPDP.mjs.map → chunk-OD7MJ7CA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-N6YAJHO2.mjs.map → chunk-OPVHND3O.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KBNE74VW.mjs.map → chunk-OQOS52S7.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5OCHCEMP.mjs.map → chunk-P5EDEM26.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-GGFRARKJ.mjs.map → chunk-PM2CIPJB.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-7SEPLODG.mjs.map → chunk-Q3AAD4PW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-OUE73NQT.mjs.map → chunk-QN2BIRAC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-E3YY6EFZ.mjs.map → chunk-QUVHL3QF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3YNJTF3V.mjs.map → chunk-RSJC4YBI.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-IPRDBCJL.mjs.map → chunk-SJDGXLII.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SXK6H7XE.mjs.map → chunk-TF2JS3TY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-U44EUWQT.mjs.map → chunk-URXO7GNH.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QQYLFECS.mjs.map → chunk-V5VIOBBE.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SWQZKECU.mjs.map → chunk-VRU7SNQA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KDQYDWVH.mjs.map → chunk-WGESEEJ2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JKP4S7G7.mjs.map → chunk-XONPIJ3Y.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-CSMPAIH6.mjs.map → chunk-Y57ROHMV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PQNKIJXU.mjs.map → chunk-YMBVUA56.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-V7ZVF4G7.mjs.map → chunk-ZVDPYIMB.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s,f as a}from"./chunk-UERJ6AKK.mjs";import{f as p}from"./chunk-VNLGNNIL.mjs";import{a as d,b as L}from"./chunk-NLRDRI7Q.mjs";import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s,f as a}from"./chunk-UERJ6AKK.mjs";import{f as p}from"./chunk-VNLGNNIL.mjs";import{a as d,b as L}from"./chunk-NLRDRI7Q.mjs";import{a as k}from"./chunk-BIEPQOD5.mjs";import{a as v}from"./chunk-KRWR77QE.mjs";import{b as y}from"./chunk-A7FTKX2A.mjs";import{a as c,b as g}from"./chunk-WZGG2YKQ.mjs";import{a as m,b as f}from"./chunk-M7BM6QPB.mjs";import{a as T}from"./chunk-CYCS3K6Q.mjs";import{a as S,b as u}from"./chunk-VKEESSBI.mjs";import{a as x}from"./chunk-2DNGCNYM.mjs";import{a as I}from"./chunk-NB7A4C7L.mjs";import{c as l}from"./chunk-NTEMINYA.mjs";import{createJSONStorage as O,devtools as V,persist as h}from"zustand/middleware";import{immer as N}from"zustand/middleware/immer";import{createStore as J}from"zustand/vanilla";var A=e=>{e.account=c,e.loginInfo=m,e.transactions=d,e.toasts=S};function H(){return new Date().setHours(new Date().getHours()+24)}function w(e){if(e==null){E();return}b(e)}var C=e=>{let t=a(e),n=p(e),{address:i,publicKey:M}=s(e);if(i&&M!==new l(i).toHex()&&A(e),!t)return;if(n==null){w(H());return}let P=Date.now();n-P<0&&(w(null),o().setState(A))};var z=(e,t)=>{C(e)};var W=e=>{let t=J(V(h(N((...n)=>({network:x(...n),account:g(...n),loginInfo:f(...n),config:T(...n),transactions:L(...n),toasts:u(...n),cache:y(...n),ui:I(...n)})),{name:"sdk-dapp-store",storage:O(e)})));return t.subscribe(z),t},r,D=e=>{r=e},o=()=>(r||D(W(()=>new v)),r),pe=(e=k)=>{let t=W(e);return D(t),t},le=()=>o().getState();var me=e=>o().setState(({loginInfo:t})=>{t.providerType=e},!1,"setProviderType"),fe=e=>o().setState(({loginInfo:t})=>{t.tokenLogin=e},!1,"setTokenLogin"),Se=e=>o().setState(({loginInfo:t})=>{if(t.tokenLogin!=null){t.tokenLogin.loginToken=e;return}t.tokenLogin={loginToken:e}},!1,"setLoginToken"),ue=e=>o().setState(({loginInfo:t})=>{t?.tokenLogin!=null&&(t.tokenLogin.signature=e)},!1,"setTokenLoginSignature"),de=e=>o().setState(({loginInfo:t})=>{t.walletConnectLogin=e},!1,"setWalletConnectLogin"),Le=e=>o().setState(({loginInfo:t})=>{t.ledgerLogin=e},!1,"setLedgerLogin"),xe=e=>o().setState(({loginInfo:t})=>{t.isWalletConnectV2Initialized=e},!1,"setIsWalletConnectV2Initialized"),E=()=>o().setState(({loginInfo:e})=>{e.loginExpiresAt=null},!1,"removeLoginExpiresAt"),b=e=>o().setState(({loginInfo:t})=>{t.loginExpiresAt=e},!1,"addLoginExpiresAt");export{me as a,fe as b,Se as c,ue as d,de as e,Le as f,xe as g,E as h,b as i,A as j,H as k,w as l,C as m,z as n,W as o,D as p,o as q,pe as r,le as s};
|
|
2
|
+
//# sourceMappingURL=chunk-MSFYVSIA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-TQA3JDNV.mjs";import{s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-TQA3JDNV.mjs";import{s}from"./chunk-MSFYVSIA.mjs";import{e as a}from"./chunk-UERJ6AKK.mjs";function x(n){let e=s(),o=u(e),c=a(e),t=Object.keys(o).map(Number).reduce((r,m)=>{let i=o[m]?.transactions||[];return Math.max(r,...i.map(l=>l.nonce),0)},0);return t>0&&(t+=1),n==null?Math.max(t,c):Math.max(t,n.nonce,c)}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-NN2ODLFY.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-A4WTVE3V.mjs";var t={closeConnectionRef:void 0};async function c(n){let{closeConnection:o}=await e(n);t.closeConnectionRef=o}export{t as a,c as b};
|
|
2
|
+
//# sourceMappingURL=chunk-NOAPU5US.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-NOAPU5US.mjs";import{a}from"./chunk-WGESEEJ2.mjs";import{a as u}from"./chunk-A7PB4MFL.mjs";import{c as n}from"./chunk-5Q2JDZD3.mjs";import{a as s}from"./chunk-ETED4JB5.mjs";var c=(o,t)=>{let r=`sdk-dapp-logout-event-${o}`,e=t.getItem(r);e&&o!==e||(t.setItem(r,o),t.removeItem(r))};async function L({provider:o,options:t={shouldBroadcastLogoutAcrossTabs:!0}}){let r=a();t.shouldBroadcastLogoutAcrossTabs&&s.localStorage&&c(r,s.localStorage);try{return u(),n.forEach(g=>g()),n.clear(),i.closeConnectionRef?.(),await o.logout()}catch(e){return console.error("Logging out error:",e),!1}}export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-NPF3MLTJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-BYMTQKPA.mjs";import{c as e}from"./chunk-MGFIOCA4.mjs";var o=class i extends s{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE_SIGN_TRANSACTIONS",uiTag:"mvx-sign-transactions-panel"});this.addressesPerPage=10;this._ppuMap={};this.initialData={commonData:{transactionsCount:0,currentIndexToSign:0,egldLabel:"",currentIndex:0,ppuOptions:[],address:"",origin:""},tokenTransaction:null,nftTransaction:null,sftTransaction:null};this.data={...this.initialData}}static getInstance(){return i.instance||(i.instance=new i),i.instance}get transactionsCount(){return this.data.commonData.transactionsCount}initializeGasPriceMap(a){let t=0;a.filter(n=>n!=null).forEach(n=>{let r=n?Number(n.gasPrice):0;this.updateGasPriceMap({nonce:Number(n.nonce),ppu:t,initialGasPrice:r})}),this.updateCommonData({ppu:t})}updateGasPriceMap({nonce:a,ppu:t,initialGasPrice:n}){this._ppuMap[a]={...this._ppuMap[a],ppu:t},n&&(this._ppuMap[a].initialGasPrice=n)}updateCommonData(a){this.data.commonData={...this.data.commonData,...a},this.notifyDataUpdate()}updateIsLoading(a){this.data.isLoading=a,this.notifyDataUpdate()}updateTokenTransaction(a){this.data.tokenTransaction=a,this.data.sftTransaction=null,this.data.nftTransaction=null,this.notifyDataUpdate()}updateNonFungibleTransaction(a,t){switch(a){case"NonFungibleESDT":this.data.nftTransaction=t,this.data.tokenTransaction=null,this.data.sftTransaction=null;break;case"SemiFungibleESDT":this.data.sftTransaction=t,this.data.nftTransaction=null,this.data.tokenTransaction=null;break;default:break}this.notifyDataUpdate()}get currentScreenIndex(){return this.data.commonData.currentIndex}get ppuMap(){return this._ppuMap}async setupEventListeners(){this.eventBus&&this.subscribeToEventBus("CLOSE_SIGN_TRANSACTIONS",this.closeUI.bind(this))}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OD7MJ7CA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k}from"./chunk-4FD6QSAE.mjs";import{a as T}from"./chunk-XCVEFI4B.mjs";import{a as i}from"./chunk-W5MTQBQF.mjs";import{a as m}from"./chunk-UNBTFF6K.mjs";import{a as l}from"./chunk-U3UMCTU6.mjs";import{c as d}from"./chunk-PJWJZHIS.mjs";import{a as o}from"./chunk-7CELSV4S.mjs";var p=class{static async processTransactions({address:u,egldLabel:v,explorerAddress:g,transactions:L}){let f=L.map(e=>m({address:u,explorerAddress:g,transaction:e}));return await Promise.all(f.map(async e=>{let s=e.receiverAssets?.name.replace(/\p{Emoji}/gu,""),a=e.senderAssets?.name.replace(/\p{Emoji}/gu,""),{senderLockedAccount:h,receiverLockedAccount:D}=await k({receiver:e.receiver,sender:e.sender,tokenId:e.tokenIdentifier}),{egldValueData:t,tokenValueData:n,nftValueData:r}=T({transaction:e}),x=r?.token.type==="MetaESDT"?void 0:r?.badgeText,c=l.getData({input:t?.value??n?.value??r?.value??"",decimals:t?.decimals??n?.decimals??r?.decimals??d,digits:2}),y={badge:x??void 0,collection:n?.token.collection??r?.token.collection,egldLabel:t?v:"",link:n?.tokenExplorerLink??r?.tokenExplorerLink,linkText:n?.tokenLinkText??r?.tokenLinkText,name:n?.token.name??r?.token.name,showFormattedAmount:!!(t||n?.tokenFormattedAmount||r?.tokenFormattedAmount),svgUrl:n?.token.svgUrl??r?.token.svgUrl,ticker:n?.token.ticker??r?.token.ticker,titleText:n?.titleText??r?.titleText,valueDecimal:c.valueDecimal,valueInteger:c.valueInteger},w=i(e.receiverShard),A=i(e.senderShard);return{age:e.transactionDetails.age,direction:e.transactionDetails.direction,method:e.transactionDetails.method,iconInfo:e.transactionDetails.iconInfo,link:e.links.transactionLink??"",txHash:e.txHash,receiver:{address:e.receiver,name:s??"",description:`${s??e.receiver} (${e.receiver})`,isContract:o(e.receiver),isTokenLocked:!!D,link:e.links.receiverLink??"",shard:w,shardLink:e.links.receiverLink,showLink:e.transactionDetails.direction!=="In"},sender:{address:e.sender,name:a??"",description:`${a??e.sender} (${e.sender})`,isContract:o(e.sender),isTokenLocked:!!h,link:e.links.senderLink??"",shard:A,shardLink:e.links.senderShardLink,showLink:e.transactionDetails.direction!=="Out"},value:y}}))}};export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OPVHND3O.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-L3MWDI6J.mjs";import{q as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-L3MWDI6J.mjs";import{q as i}from"./chunk-MSFYVSIA.mjs";var g=({transactions:s,transactionsDisplayInfo:a,status:e,sessionInformation:t})=>{let o=Date.now().toString();return i().setState(({transactions:n})=>{n[o]={transactions:s,status:e,transactionsDisplayInfo:a,interpretedTransactions:{},sessionInformation:t}},!1,"createTransactionsSession"),o},T=({sessionId:s,status:a,errorMessage:e})=>{i().setState(({transactions:t})=>{t[s].status=a,t[s].errorMessage=e},!1,"updateTransactionsSession")},y=({sessionId:s,transaction:a})=>{let e=null;return i().setState(({transactions:t})=>{let o=t[s]?.transactions;if(o!=null){t[s].transactions=o.map(r=>r.hash===a.hash?{...r,...a??{}}:r);let n=u([...t[s].transactions]);n&&(T({sessionId:s,status:n}),e=n)}},!1,"updateTransactionStatus"),e},h=()=>{i().setState(({transactions:s,toasts:a})=>{let t=Object.keys(s).filter(n=>{let r=s[n];if(!r)return!1;let{status:c}=r;return!(c==="pending"||c==="signed"||c==="sent")});t.forEach(n=>{delete s[n]});let o=a.transactionToasts.filter(n=>!t.includes(n.toastId));a.transactionToasts=o},!1,"clearCompletedTransactions")};export{g as a,T as b,y as c,h as d};
|
|
2
|
+
//# sourceMappingURL=chunk-OQOS52S7.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-MFMWGMLN.mjs";var i=async a=>{let r=a.map(s=>s.hash),n=await e(r);return a.map(s=>{let t=n.find(o=>o?.txHash===s.hash);return{...s,status:t?.status,invalidTransaction:t==null,results:t?.results??[],previousStatus:s.status?.toString()||"",hasStatusChanged:!!(t&&t.status!==s.status)}})};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-P5EDEM26.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-WGESEEJ2.mjs";import{c as e,g as s}from"./chunk-NTEMINYA.mjs";async function m({message:r,provider:a,options:n}){let g=o(),i=new s({address:new e(g),data:r.data});return await a.signMessage(i,n)}export{m as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PM2CIPJB.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{q as a}from"./chunk-MSFYVSIA.mjs";var r=({key:e,value:t})=>{a().setState(({cache:c})=>{c[e]=t},!1,"saveToCache")},s=e=>{a().setState(({cache:t})=>{delete t[e]},!1,"removeFromCache")},h=()=>{a().setState(({cache:e})=>{Object.keys(e).forEach(t=>{delete e[t]})},!1,"clearCache")};export{r as a,s as b,h as c};
|
|
2
|
+
//# sourceMappingURL=chunk-Q3AAD4PW.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-ETED4JB5.mjs";var i=String(o?.navigator?.userAgent),t=/^((?!chrome|android).)*safari/i.test(i),r=/firefox/i.test(i)&&/windows/i.test(i),n=t||r;export{t as a,n as b};
|
|
2
|
+
//# sourceMappingURL=chunk-QUVHL3QF.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-JBNKG6XC.mjs";async function i(a){let n=e.getInstance();return await n.openUI(),{manager:n,onClose:async({shouldCancelAction:t=!0}={})=>{n.closeUI(),t&&a?.cancelAction&&await a.cancelAction()}}}export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SJDGXLII.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{s as e}from"./chunk-MSFYVSIA.mjs";import{b as o}from"./chunk-SAAOQW7P.mjs";import{a as i}from"./chunk-CKTFPRJS.mjs";var n="https://api.multiversx.com",s=60*60*24,a=5*60,d=t=>{let r=o(e());return{origin:t?.origin||i().origin,apiAddress:t?.apiAddress||r.apiAddress||n,expirySeconds:t?.expirySeconds||s,tokenExpirationToastWarningSeconds:t?.tokenExpirationToastWarningSeconds||a}};export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-V5VIOBBE.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as A}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as A}from"./chunk-5LDRZKQG.mjs";import{a as I}from"./chunk-EAJBSX6Y.mjs";import{a as b}from"./chunk-Y3BNMQFP.mjs";import{h as f}from"./chunk-YEQDJ3AV.mjs";import{b as S}from"./chunk-3ZEUVYQF.mjs";import{a as y}from"./chunk-OQOS52S7.mjs";import{a as g}from"./chunk-L3MWDI6J.mjs";import{a as h}from"./chunk-ENGIAAJA.mjs";import{h as u}from"./chunk-2IUBMLF4.mjs";import{s as m}from"./chunk-MSFYVSIA.mjs";import{b as T}from"./chunk-SAAOQW7P.mjs";import w from"axios";var r=class r{constructor(){this.setCallbacks=({onSuccess:a,onFail:t})=>{S({onSuccess:a,onFail:t})};this.send=async a=>{if(a.length===0)throw new Error("No transactions to send");try{if(!I(a))return await this.sendSignedTransactions(a);let t=await this.sendSignedBatchTransactions(a);if(!t.data||t.data.error)throw new Error(t.data?.error??"Failed to send transactions");return t.data.transactions}catch(t){throw t.response?.data?.message??t.message}};this.track=async(a,t={disableToasts:!1})=>{let n=this.sequentialToFlatArray(a).map(e=>({...e,status:e.status??"pending"})),o=g(n),s=y({transactions:n,transactionsDisplayInfo:t.transactionsDisplayInfo,status:o??"sent",sessionInformation:t.sessionInformation});if(t.disableToasts===!0)return s;let i=A(a);return f({toastId:s,totalDuration:i}),s};this.sendSignedTransactions=async a=>{let{apiAddress:t,apiTimeout:n}=T(m());return await Promise.all(a.map(async s=>{let i=await w.post(`${t}/transactions`,s.toPlainObject(),{timeout:Number(n)}),e=i.data.txHash;return{...s.toPlainObject(),...i.data,status:"pending",hash:e}}))};this.sendSignedBatchTransactions=async a=>{let{address:t}=h(),{apiAddress:n,apiTimeout:o}=T(m());if(!t)return{error:"Invalid address provided. You need to be logged in to send transactions"};let s=this.buildBatchId(t),e={transactions:a.map(p=>p.map(c=>c.toPlainObject())),id:s},{data:l}=await w.post(`${n}/batch`,e,{timeout:Number(o)}),B=l.transactions.map(p=>p.map(c=>{let d={...c,status:"pending",hash:c.hash};return b({data:d.data})&&(delete d.senderUsername,delete d.receiverUsername),d}));return{data:{...l,transactions:B}}};this.buildBatchId=a=>`${Date.now().toString()}${u}${a}`;this.sequentialToFlatArray=(a=[])=>this.getIsSequential(a)?a.flat():a;this.getIsSequential=a=>a?.every(t=>Array.isArray(t))}static getInstance(){return r.instance||(r.instance=new r),r.instance}};r.instance=null;var v=r;export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-VRU7SNQA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as de}from"./chunk-M3YL36ZL.mjs";import{a as se}from"./chunk-2Y66XRQK.mjs";import{a as te}from"./chunk-PQNKIJXU.mjs";import{a as U}from"./chunk-3OO2PJ5E.mjs";import{a as ie}from"./chunk-7PNJRSBM.mjs";import{a as re}from"./chunk-J2SA53FJ.mjs";import{a as ee}from"./chunk-YUFPUG5O.mjs";import{a as ae}from"./chunk-PRPABOZE.mjs";import{a as p}from"./chunk-LT4WBCNY.mjs";import{a as Z}from"./chunk-IPRDBCJL.mjs";import{a as ne}from"./chunk-DJYYELSI.mjs";import{a as oe}from"./chunk-G2PLL4CC.mjs";import{a as Q}from"./chunk-QJGFIK7H.mjs";import{b as J}from"./chunk-4Z3DZ2A3.mjs";import{b as I,c as Y}from"./chunk-NRXYSTRW.mjs";import{j as $,l as O,u as M,v as C,w as L}from"./chunk-XV2F257X.mjs";import{a as y}from"./chunk-H3NZ6BVM.mjs";import{a as P}from"./chunk-DCC7FDBZ.mjs";import{a as q}from"./chunk-KDQYDWVH.mjs";import{a as D}from"./chunk-4TBVQD27.mjs";import{a as X}from"./chunk-VVVJMWC7.mjs";import{g as K}from"./chunk-2IUBMLF4.mjs";import{a as F,q as j,s as l}from"./chunk-AVDBWEOB.mjs";import{f as R}from"./chunk-UERJ6AKK.mjs";import{b as E,c as V}from"./chunk-SAAOQW7P.mjs";import{a as B}from"./chunk-VNLGNNIL.mjs";import{b as H,c as G}from"./chunk-6JM4DPOH.mjs";import{a as c}from"./chunk-6JSWL75O.mjs";import{a as n}from"./chunk-LJX4MW7B.mjs";import{IframeLoginTypes as pe}from"@multiversx/sdk-web-wallet-iframe-provider/out/constants";var f=class extends p{constructor({address:e,anchor:r,shouldInitProvider:t}){super(e);this.provider=null;this.config=null;this.ledgerLogin=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");if(!e||typeof e.addressIndex!="number")throw new Error("Missing addressIndex for Ledger login");let{address:r,signature:t}=await this.provider.login({addressIndex:e.addressIndex});return{address:r,signature:t??""}};this.loginOperation=async e=>{if(!this.provider||!this.config)throw new Error("Provider is not initialized.");return await te({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!P())return;await U.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ne({transactions:e,handleSign:this.provider.signTransactions.bind(this.provider)})};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ce({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await re({shouldInitProvider:!0});this.provider=r}catch(r){throw $({toastId:"ledger-provider-rebuild-error",duration:1e4,icon:"times",iconClassName:"warning",message:"Unlock your device & open the MultiversX App",title:"Ledger unavailable"}),r}}};this.options={anchor:r,shouldInitProvider:t},this._login=this.ledgerLogin.bind(this)}async init(){try{this.initializeAddress(),await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.ledger}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){await this.initLegderConnectManager(this.options?.anchor);let e=U.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((o,s)=>ie({manager:e,resolve:o,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var ve=3e4,me=5e3,he=3e3,S=class a{constructor(){this.store=j();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let i=this.store.getState(),{providerType:e}=B(i),r=R(i);return!!(e===n.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let i=J(l());if(!(!this.shouldCheckConnection()||i))try{await L().getProvider().getAddress()}catch{if(O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"times",iconClassName:"warning",message:"Unlock your device to continue signing transactions",title:"Ledger disconnected"}),this.reset(),this.recreateProviderInterval)return;this.recreateProviderInterval=setInterval(this.reconnectProvider,me)}},ve))};this.reconnectProvider=async()=>{if(this.shouldCheckConnection())try{let i=new f({shouldInitProvider:!0});await i.init();let e=new M(i);i.getType=()=>n.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",duration:he,icon:"check",iconClassName:"success",message:"Your device is ready to sign transactions",title:"Ledger reconnected"}),this.startCheckConnectionLoop()}catch{console.log("Unable to reconnect to Ledger")}};this.reset=()=>{clearInterval(this.connectionCheckInterval??0),this.connectionCheckInterval=null}}static getInstance(){return a.instance||(a.instance=new a),a.instance}};var z=class extends p{constructor(e){super(e?.address);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{onClose:r,manager:t}=await this.initSignState();try{let o=await this.provider.signTransactions(e)??[];return await oe(o)}catch(o){throw await r({shouldCancelAction:!0}),o}finally{t.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.crossWindow})};this.walletAddress=e?.walletAddress,this.provider=Q.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=E(l()),r=await this.provider.init();return this.provider.setWalletUrl(this.walletAddress??e.walletAddress),this.address&&this.provider.setAddress(this.address),r}logout(){return this.provider.logout()}getType(){return n.crossWindow}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{ExtensionProvider as ue}from"@multiversx/sdk-extension-provider/out/extensionProvider";var k=class extends p{constructor(e){super(e);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)??[]}catch(o){throw await t({shouldCancelAction:!1}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.provider=ue.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=await this.provider.init();return this.address&&this.setAccount({address:this.address}),e}getAddress(){return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}logout(){return this.provider.logout()}getType(){return n.extension}};var fe={passkey:n.passkey,metamask:n.metamask},T=class extends p{constructor({type:e,address:r,walletUrl:t}){super(r);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)}catch(o){throw await t({shouldCancelAction:!0}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider||!this.type)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c[this.type]})};this.type=e,this.walletUrl=t??"",this.provider=de.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=E(l());if(!e.iframeWalletAddress)throw new Error("Invalid walletUrl");this.walletUrl=e.iframeWalletAddress}async initializeProvider(){return await this.provider.init(),this.address&&this.setAccount({address:this.address}),this.provider.setLoginType(this.type),this.provider.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return fe[this.type]}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{OptionalOperation as ye}from"@multiversx/sdk-wallet-connect-provider/out";var le=[I.CANCEL_ACTION,I.SIGN_LOGIN_TOKEN],_=class extends p{constructor(e){super();this.provider=null;this.methods=[];this._approval=null;this.cancelActionAbortController=null;this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();this.cancelActionAbortController=new AbortController;let o=this.cancelActionAbortController.signal;try{let s=new Promise((h,v)=>{o.addEventListener("abort",()=>{v(new Error("cancelled by user"))})});return await Promise.race([this.provider.signTransactions(e),s])}catch(s){throw await t({shouldCancelAction:!0}),s}finally{r.closeUI()}};this.cancelAction=async()=>{this.sendCustomRequest({method:I.CANCEL_ACTION,action:ye.CANCEL_ACTION}),this.cancelActionAbortController?.abort()};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");this.cancelActionAbortController=new AbortController;let r=this.cancelActionAbortController.signal,t=new Promise((s,d)=>{r.addEventListener("abort",()=>{d(new Error("cancelled by user"))})});return await Promise.race([g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension}),t])};this.config=e}async init(){try{await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.walletConnect}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return Promise.resolve(this.provider.getAddress())}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){if(await this.initWalletConnectManager(),!this.config)throw new Error("Invalid WalletConnect setup");let{walletConnectProvider:e,dappMethods:r}=await this.createWalletConnectProvider(this.config);this.provider=e,this.methods=r;let{uri:t="",approval:o}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??D.walletConnectDeepLink;this._approval=o,y.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!P())return;await y.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=P(),t=V(l());if(H(l())&&le.push(I.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{X()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:x={},walletConnectV2RelayAddress:W=""}=e,w=new Y(v,t,W,m,x);return await w.init(),{walletConnectProvider:w,dappMethods:le}}catch(m){throw console.error("Unable to connect",m),r&&await this.logout(),m}}async login(e){if(!this.provider)throw new Error("Provider is not initialized. Call createProvider first.");let r=async()=>{if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.init();let t=y.getInstance(),{uri:o="",approval:s}=await this.provider.connect({methods:this.methods}),d=this.config.walletConnectDeepLink??D.walletConnectDeepLink;t.updateData({wcURI:o,walletConnectDeepLink:`${d}?wallet-connect=${encodeURIComponent(o)}`});let h=await this.provider.login({approval:s,token:e?.token}),{address:v="",signature:m=""}=h??{};return t.handleClose({isLoginFinished:!!v}),{address:v,signature:m}}catch{return await r()}};if(!this._approval)throw new Error("Approval or login is not initialized");try{let t=await this.provider.login({approval:this._approval.bind(this),token:e?.token}),{address:o="",signature:s=""}=t??{};return y.getInstance().handleClose({isLoginFinished:!!o}),{address:o,signature:s}}catch(t){return console.error("User rejected connection proposal",t),await r()}}async sendCustomRequest({action:e,method:r}){if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.sendCustomRequest?.({request:{method:r,params:{action:e}}})}catch(t){console.error("Unable to send event",t)}}};var A=class{static set customProviders(i){this._customProviders=i}static get customProviders(){return this._customProviders}static async create({type:i,anchor:e}){let r=null;switch(i){case n.extension:{r=new k;break}case n.crossWindow:{r=new z;break}case n.ledger:{r=new f({anchor:e}),await S.getInstance().init();break}case n.metamask:{r=new T({type:pe.metamask});break}case n.passkey:{r=new T({type:pe.passkey});break}case n.walletConnect:{let s=G(l());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new _({anchor:e,...s});break}case n.webview:{r=new ae;break}default:{let s=q();for(let d of this._customProviders)d.type===i&&(r=await d.constructor({address:s,anchor:e}));break}}if(!r)throw new Error("Unable to create provider");await r.init();let t=new M(r);C(t);let o=n.crossWindow===i;return se(o?{skipLoginMethod:i}:null),t}static async destroy(){L().cancelLogin(),C(null),F(n.none)}};A._customProviders=[];var Pe=(a,i)=>a.some(e=>e.type===i);async function g({message:a,handleSignMessage:i,cancelAction:e,providerType:r}){return await new Promise(async(o,s)=>{let{manager:d,onClose:h}=await Z({cancelAction:e}),v=Object.values(A.customProviders),m=v.reduce((u,N)=>(u[N.type]=N.name,u),{}),x={...c,...m},W=async()=>{await h({shouldCancelAction:!0}),s({message:"Signing canceled"})};d.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",W);let w=Pe(v,r)?r:n.none;d.updateData({name:x[w],type:w});try{let u=await i(a);o(u)}catch(u){await h({shouldCancelAction:!0}),s(u)}finally{d.closeUI()}})}async function ce({message:a,handleSignMessage:i}){try{return await g({message:a,handleSignMessage:i,providerType:c.ledger})}catch(e){let{errorMessage:r}=ee(e);throw r?{message:r}:e}}export{ce as a,f as b,S as c,A as d,g as e,z as f,k as g,T as h,_ as i};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as de}from"./chunk-M3YL36ZL.mjs";import{a as se}from"./chunk-2Y66XRQK.mjs";import{a as te}from"./chunk-YMBVUA56.mjs";import{a as U}from"./chunk-4PIR4ESS.mjs";import{a as ie}from"./chunk-IMXMFXER.mjs";import{a as re}from"./chunk-DQUL7SM3.mjs";import{a as ee}from"./chunk-YUFPUG5O.mjs";import{a as ae}from"./chunk-J65JH3Q2.mjs";import{a as p}from"./chunk-KLZC6NYC.mjs";import{a as Z}from"./chunk-SJDGXLII.mjs";import{a as ne}from"./chunk-KJIGI7AM.mjs";import{a as oe}from"./chunk-FODR6WTG.mjs";import{a as Q}from"./chunk-QJGFIK7H.mjs";import{b as J}from"./chunk-4Z3DZ2A3.mjs";import{b as I,c as Y}from"./chunk-NRXYSTRW.mjs";import{j as $,l as O,u as M,v as C,w as L}from"./chunk-YEQDJ3AV.mjs";import{a as y}from"./chunk-LMG7PLUI.mjs";import{a as P}from"./chunk-FQTEXMMN.mjs";import{a as q}from"./chunk-WGESEEJ2.mjs";import{a as D}from"./chunk-4TBVQD27.mjs";import{a as X}from"./chunk-A7PB4MFL.mjs";import{g as K}from"./chunk-2IUBMLF4.mjs";import{a as F,q as j,s as l}from"./chunk-MSFYVSIA.mjs";import{f as R}from"./chunk-UERJ6AKK.mjs";import{b as E,c as V}from"./chunk-SAAOQW7P.mjs";import{a as B}from"./chunk-VNLGNNIL.mjs";import{b as H,c as G}from"./chunk-6JM4DPOH.mjs";import{a as c}from"./chunk-6JSWL75O.mjs";import{a as n}from"./chunk-LJX4MW7B.mjs";import{IframeLoginTypes as pe}from"@multiversx/sdk-web-wallet-iframe-provider/out/constants";var f=class extends p{constructor({address:e,anchor:r,shouldInitProvider:t}){super(e);this.provider=null;this.config=null;this.ledgerLogin=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");if(!e||typeof e.addressIndex!="number")throw new Error("Missing addressIndex for Ledger login");let{address:r,signature:t}=await this.provider.login({addressIndex:e.addressIndex});return{address:r,signature:t??""}};this.loginOperation=async e=>{if(!this.provider||!this.config)throw new Error("Provider is not initialized.");return await te({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!P())return;await U.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ne({transactions:e,handleSign:this.provider.signTransactions.bind(this.provider)})};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ce({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await re({shouldInitProvider:!0});this.provider=r}catch(r){throw $({toastId:"ledger-provider-rebuild-error",duration:1e4,icon:"times",iconClassName:"warning",message:"Unlock your device & open the MultiversX App",title:"Ledger unavailable"}),r}}};this.options={anchor:r,shouldInitProvider:t},this._login=this.ledgerLogin.bind(this)}async init(){try{this.initializeAddress(),await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.ledger}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){await this.initLegderConnectManager(this.options?.anchor);let e=U.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((o,s)=>ie({manager:e,resolve:o,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var ve=3e4,me=5e3,he=3e3,S=class a{constructor(){this.store=j();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let i=this.store.getState(),{providerType:e}=B(i),r=R(i);return!!(e===n.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let i=J(l());if(!(!this.shouldCheckConnection()||i))try{await L().getProvider().getAddress()}catch{if(O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"times",iconClassName:"warning",message:"Unlock your device to continue signing transactions",title:"Ledger disconnected"}),this.reset(),this.recreateProviderInterval)return;this.recreateProviderInterval=setInterval(this.reconnectProvider,me)}},ve))};this.reconnectProvider=async()=>{if(this.shouldCheckConnection())try{let i=new f({shouldInitProvider:!0});await i.init();let e=new M(i);i.getType=()=>n.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",duration:he,icon:"check",iconClassName:"success",message:"Your device is ready to sign transactions",title:"Ledger reconnected"}),this.startCheckConnectionLoop()}catch{console.log("Unable to reconnect to Ledger")}};this.reset=()=>{clearInterval(this.connectionCheckInterval??0),this.connectionCheckInterval=null}}static getInstance(){return a.instance||(a.instance=new a),a.instance}};var z=class extends p{constructor(e){super(e?.address);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{onClose:r,manager:t}=await this.initSignState();try{let o=await this.provider.signTransactions(e)??[];return await oe(o)}catch(o){throw await r({shouldCancelAction:!0}),o}finally{t.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.crossWindow})};this.walletAddress=e?.walletAddress,this.provider=Q.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=E(l()),r=await this.provider.init();return this.provider.setWalletUrl(this.walletAddress??e.walletAddress),this.address&&this.provider.setAddress(this.address),r}logout(){return this.provider.logout()}getType(){return n.crossWindow}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{ExtensionProvider as ue}from"@multiversx/sdk-extension-provider/out/extensionProvider";var k=class extends p{constructor(e){super(e);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)??[]}catch(o){throw await t({shouldCancelAction:!1}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.provider=ue.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=await this.provider.init();return this.address&&this.setAccount({address:this.address}),e}getAddress(){return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}logout(){return this.provider.logout()}getType(){return n.extension}};var fe={passkey:n.passkey,metamask:n.metamask},T=class extends p{constructor({type:e,address:r,walletUrl:t}){super(r);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)}catch(o){throw await t({shouldCancelAction:!0}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider||!this.type)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c[this.type]})};this.type=e,this.walletUrl=t??"",this.provider=de.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=E(l());if(!e.iframeWalletAddress)throw new Error("Invalid walletUrl");this.walletUrl=e.iframeWalletAddress}async initializeProvider(){return await this.provider.init(),this.address&&this.setAccount({address:this.address}),this.provider.setLoginType(this.type),this.provider.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return fe[this.type]}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{OptionalOperation as ye}from"@multiversx/sdk-wallet-connect-provider/out";var le=[I.CANCEL_ACTION,I.SIGN_LOGIN_TOKEN],_=class extends p{constructor(e){super();this.provider=null;this.methods=[];this._approval=null;this.cancelActionAbortController=null;this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();this.cancelActionAbortController=new AbortController;let o=this.cancelActionAbortController.signal;try{let s=new Promise((h,v)=>{o.addEventListener("abort",()=>{v(new Error("cancelled by user"))})});return await Promise.race([this.provider.signTransactions(e),s])}catch(s){throw await t({shouldCancelAction:!0}),s}finally{r.closeUI()}};this.cancelAction=async()=>{this.sendCustomRequest({method:I.CANCEL_ACTION,action:ye.CANCEL_ACTION}),this.cancelActionAbortController?.abort()};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");this.cancelActionAbortController=new AbortController;let r=this.cancelActionAbortController.signal,t=new Promise((s,d)=>{r.addEventListener("abort",()=>{d(new Error("cancelled by user"))})});return await Promise.race([g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension}),t])};this.config=e}async init(){try{await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.walletConnect}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return Promise.resolve(this.provider.getAddress())}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){if(await this.initWalletConnectManager(),!this.config)throw new Error("Invalid WalletConnect setup");let{walletConnectProvider:e,dappMethods:r}=await this.createWalletConnectProvider(this.config);this.provider=e,this.methods=r;let{uri:t="",approval:o}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??D.walletConnectDeepLink;this._approval=o,y.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!P())return;await y.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=P(),t=V(l());if(H(l())&&le.push(I.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{X()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:x={},walletConnectV2RelayAddress:W=""}=e,w=new Y(v,t,W,m,x);return await w.init(),{walletConnectProvider:w,dappMethods:le}}catch(m){throw console.error("Unable to connect",m),r&&await this.logout(),m}}async login(e){if(!this.provider)throw new Error("Provider is not initialized. Call createProvider first.");let r=async()=>{if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.init();let t=y.getInstance(),{uri:o="",approval:s}=await this.provider.connect({methods:this.methods}),d=this.config.walletConnectDeepLink??D.walletConnectDeepLink;t.updateData({wcURI:o,walletConnectDeepLink:`${d}?wallet-connect=${encodeURIComponent(o)}`});let h=await this.provider.login({approval:s,token:e?.token}),{address:v="",signature:m=""}=h??{};return t.handleClose({isLoginFinished:!!v}),{address:v,signature:m}}catch{return await r()}};if(!this._approval)throw new Error("Approval or login is not initialized");try{let t=await this.provider.login({approval:this._approval.bind(this),token:e?.token}),{address:o="",signature:s=""}=t??{};return y.getInstance().handleClose({isLoginFinished:!!o}),{address:o,signature:s}}catch(t){return console.error("User rejected connection proposal",t),await r()}}async sendCustomRequest({action:e,method:r}){if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.sendCustomRequest?.({request:{method:r,params:{action:e}}})}catch(t){console.error("Unable to send event",t)}}};var A=class{static set customProviders(i){this._customProviders=i}static get customProviders(){return this._customProviders}static async create({type:i,anchor:e}){let r=null;switch(i){case n.extension:{r=new k;break}case n.crossWindow:{r=new z;break}case n.ledger:{r=new f({anchor:e}),await S.getInstance().init();break}case n.metamask:{r=new T({type:pe.metamask});break}case n.passkey:{r=new T({type:pe.passkey});break}case n.walletConnect:{let s=G(l());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new _({anchor:e,...s});break}case n.webview:{r=new ae;break}default:{let s=q();for(let d of this._customProviders)d.type===i&&(r=await d.constructor({address:s,anchor:e}));break}}if(!r)throw new Error("Unable to create provider");await r.init();let t=new M(r);C(t);let o=n.crossWindow===i;return se(o?{skipLoginMethod:i}:null),t}static async destroy(){L().cancelLogin(),C(null),F(n.none)}};A._customProviders=[];var Pe=(a,i)=>a.some(e=>e.type===i);async function g({message:a,handleSignMessage:i,cancelAction:e,providerType:r}){return await new Promise(async(o,s)=>{let{manager:d,onClose:h}=await Z({cancelAction:e}),v=Object.values(A.customProviders),m=v.reduce((u,N)=>(u[N.type]=N.name,u),{}),x={...c,...m},W=async()=>{await h({shouldCancelAction:!0}),s({message:"Signing canceled"})};d.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",W);let w=Pe(v,r)?r:n.none;d.updateData({name:x[w],type:w});try{let u=await i(a);o(u)}catch(u){await h({shouldCancelAction:!0}),s(u)}finally{d.closeUI()}})}async function ce({message:a,handleSignMessage:i}){try{return await g({message:a,handleSignMessage:i,providerType:c.ledger})}catch(e){let{errorMessage:r}=ee(e);throw r?{message:r}:e}}export{ce as a,f as b,S as c,A as d,g as e,z as f,k as g,T as h,_ as i};
|
|
2
|
+
//# sourceMappingURL=chunk-XONPIJ3Y.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{s as r}from"./chunk-MSFYVSIA.mjs";import{b as e}from"./chunk-SAAOQW7P.mjs";var d=s=>{let o=e(r()),t=s??o.apiAddress;return t.endsWith("/")?t.slice(0,-1):t};export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-Y57ROHMV.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Et}from"./chunk-5OCHCEMP.mjs";import{a as gt}from"./chunk-24YD5YQR.mjs";import{a as It}from"./chunk-6UZHM5LW.mjs";import{a as O}from"./chunk-F3VK7GN4.mjs";import{a as xt}from"./chunk-NSKXXUF3.mjs";import{a as wt}from"./chunk-DCC7FDBZ.mjs";import{a as At}from"./chunk-3YNJTF3V.mjs";import{a as Lt}from"./chunk-3RVLQV7F.mjs";import{a as y}from"./chunk-FMQYLMTU.mjs";import{a as Ct}from"./chunk-MFUQ5NBC.mjs";import{a as Rt}from"./chunk-4ODPAHHA.mjs";import{a as kt}from"./chunk-YO3QD3RT.mjs";import{b as M}from"./chunk-CQNWLJEW.mjs";import{a as Ot}from"./chunk-RZGMEYEV.mjs";import{a as Pt}from"./chunk-MDVI45IV.mjs";import{a as Mt}from"./chunk-GGFRARKJ.mjs";import{a as S}from"./chunk-422QE3FU.mjs";import{a as ut}from"./chunk-KDQYDWVH.mjs";import{a as yt}from"./chunk-A5YEUL6E.mjs";import{a as x}from"./chunk-XS35527Q.mjs";import{a as k,f as bt}from"./chunk-V7ZVF4G7.mjs";import{b as f,c as q,d as vt}from"./chunk-KBNE74VW.mjs";import{k as ft,l as N,n as ht}from"./chunk-65L5EBBL.mjs";import{b as Nt}from"./chunk-VVVJMWC7.mjs";import{a as P}from"./chunk-HORSXVIV.mjs";import{a as Ft}from"./chunk-3EUMNUIN.mjs";import{a as ct}from"./chunk-YICLYRWL.mjs";import{a as L}from"./chunk-QTKK6OSJ.mjs";import{a as rt}from"./chunk-6ACLOUQ3.mjs";import{a as A}from"./chunk-NZYB675D.mjs";import{a as at}from"./chunk-YSCND2MX.mjs";import{a as Dt}from"./chunk-NJN53MJV.mjs";import{a as lt,b as pt,g as Tt,l as dt}from"./chunk-2IUBMLF4.mjs";import{b as mt}from"./chunk-TQA3JDNV.mjs";import{a as nt,b as it,q as u,s as E}from"./chunk-AVDBWEOB.mjs";import{c as Q,d as X,f as tt}from"./chunk-UERJ6AKK.mjs";import{b as v}from"./chunk-VNLGNNIL.mjs";import{b}from"./chunk-6JM4DPOH.mjs";import{b as st,c as et,f as ot}from"./chunk-NTEMINYA.mjs";import{b as Bt}from"./chunk-UCRVRBTA.mjs";import{a as St}from"./chunk-XD66BXVH.mjs";import{c as w}from"./chunk-PQUU625Y.mjs";import{b as z}from"./chunk-GGBMHKR4.mjs";import{a as C}from"./chunk-LJX4MW7B.mjs";import J from"lodash.isequal";import Ut from"lodash.isequal";var Zt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",F=class o extends yt{constructor(){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.store=u();this.initialData={pendingTransactions:[],historicTransactions:[]};this.data={...this.initialData}}static getInstance(){return o.instance||(o.instance=new o),o.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){T.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let e=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Ut(r.transactionToasts,n.transactionToasts)||!Ut(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Zt,[e]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let s=T.getInstance();this.closeUI(),await s.showToasts()}async setupEventListeners(){this.eventBus&&(this.subscribeToEventBus("CLOSE_NOTIFICATIONS_FEED",this.handleCloseUI.bind(this)),this.subscribeToEventBus("CLEAR_NOTIFICATIONS_FEED_HISTORY",this.handleClearNotificationsFeedHistory.bind(this)))}async updateDataAndNotifications(){let{transactions:s,account:e,toasts:n,network:i}=this.store.getState(),{pendingTransactionToasts:r}=await O({toastList:n,transactionsSessions:s,account:e});this.data.pendingTransactions=r,this.data.historicTransactions=await gt.getTransactionsHistory({transactionsSessions:s,address:e.address,explorerAddress:i.network.explorerAddress,egldLabel:i.network.egldLabel}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){vt(),this.resetData(),this.updateNotificationsFeed()}async updateNotificationsFeed(){this.eventBus&&(this.eventBus.publish("PENDING_TRANSACTIONS_UPDATE",this.data.pendingTransactions),this.eventBus.publish("TRANSACTIONS_HISTORY_UPDATE",this.data.historicTransactions))}};import V from"bignumber.js";var R=class o{constructor(){this.store=u();this.warningLogoutTimeoutRef=null;this.actualLogoutTimeoutRef=null;this.plannedLogoutTimeoutRef=null;this.plannedLogoutKey=null;this.init=async()=>{if(!this.shouldStart())return;let t=this.store.getState(),s=v(t),{isExpired:e}=L(s?.nativeAuthToken);e?I().logout():this.addPlannedLogout()};this.stop=()=>{clearTimeout(this.warningLogoutTimeoutRef??0),clearTimeout(this.plannedLogoutTimeoutRef??0),clearTimeout(this.actualLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=null,this.plannedLogoutTimeoutRef=null,this.actualLogoutTimeoutRef=null,this.plannedLogoutKey=null};this.shouldStart=()=>{let t=this.store.getState(),s=v(t),e=tt(t);return!!(s?.nativeAuthToken&&e)};this.addPlannedLogout=()=>{let t=I(),s=Q(this.store.getState()),e=t.getType()===C.webview;if(!s||e)return;this.addLogoutWarning();let n=v(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=L(n?.nativeAuthToken),c=new V(String(i)),a=`${s}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let d=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},d.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},d.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=b(this.store.getState()),s=v(this.store.getState()),{secondsUntilExpires:e}=L(s?.nativeAuthToken),n=new V(String(e)),i=n.times(1e3);if(!e||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new V(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=It(i.toNumber()),l=a.isLessThanOrEqualTo(0)?0:a.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-expired",iconClassName:"warning",title:"Session Expiration Warning",icon:"hourglass",message:`Your session will expire in ${m}!`}),this.warningLogoutTimeoutRef=null},l)}}static getInstance(){return o.instance||(o.instance=new o),o.instance}};var B={};async function Qt({serverTransaction:o,sessionId:t,isSequential:s}){let{hash:e,status:n,results:i,invalidTransaction:r,hasStatusChanged:c}=o;try{if(B[e]>30){f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"});return}if(r&&!s||n==="sent"){B[e]=B[e]?B[e]+1:1;return}if(s&&!n){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m});return}if(c){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m})}N(n)&&await Lt({sessionId:t,hash:e,results:i})}catch(a){console.error(a),f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"})}}async function _t({sessionId:o,transactionBatch:t,isSequential:s}){try{if(t==null)return;let e=wt(),n=Ct(t),i=await Et(n);for(let p of i)await Qt({serverTransaction:p,sessionId:o,isSequential:s});if(!i.every(p=>p.status!=="pending"))return;e&&await D();let{transactions:c}=u().getState(),a=c[o];if(a.transactions.every(p=>p.status==="success"))return f({sessionId:o,status:"success"});if(a.transactions.some(p=>p.status==="fail"))return f({sessionId:o,status:"fail"});if(a.transactions.every(p=>p.status==="not executed"))return f({sessionId:o,status:"invalid"})}catch(e){console.error(e)}}async function Wt(){let o=mt(E());if(Object.keys(o).length>0)for(let[t,{transactions:s}]of Object.entries(o))await _t({sessionId:t,transactionBatch:s})}async function U(){let o=u(),t=At(),s=null,e=null,n=X(o.getState())?.timestamp,i=()=>{Wt()},r=()=>{s??=setInterval(i,t)},c=()=>{s&&(clearInterval(s),s=null)},a=()=>{c();let p=o.subscribe(({account:{websocketEvent:g}})=>{g?.message&&n!==g.timestamp&&(n=g.timestamp,i())});w.set("websocketEventReceived",p)},m=()=>{z.status!=="not_initialized"||e||(e=setInterval(()=>{z.status==="completed"&&(clearInterval(e),e=null,a())},1e3))};i();let l=()=>{c(),e&&(clearInterval(e),e=null)},d=o.subscribe(({account:{address:p},config:{websocketStatus:g}},jt)=>{if(jt.config.websocketStatus!==g)switch(g){case"completed":a();break;case"pending":r(),m();break;default:p?r():l();break}});return w.set("websocketStatusChanged",d),w.set("websocketEventReceived",l),{stopTransactionsTracking:l}}async function j({address:o,provider:t,apiAddress:s}){let e=await A({address:o,baseURL:s});if(!e)throw new Error("Account not found");Nt({address:o,providerType:t.getType()});let n={...e,username:P(e.username),nonce:x(e)};k(n),await M(o),U(),e.shard!=null&&await xt({shard:Number(e.shard),apiAddress:s})}async function Xt(o){let{network:{apiAddress:t}}=S();await o.login();let s=await o.getAddress();if(!s)throw new Error("Address not found");return await j({address:s,provider:o,apiAddress:t}),{address:s}}async function ts({provider:o,nativeAuthConfig:t,token:s}){let{network:{apiAddress:e}}=S(),n=ct(t),i=s;i||(i=await n.initialize({noCache:!0}));let{address:r,signature:c,...a}=await o.login({token:i});if(!r)return console.warn("Login cancelled."),null;if(!c)return console.error("Failed to sign login token"),null;let l=rt(a?.accessToken)?a.accessToken:n.getToken({address:r,token:i,signature:c});it({loginToken:i,signature:c,nativeAuthToken:l});let d=await Ot({loginToken:i,extraInfoData:{multisig:a?.multisig,impersonate:a?.impersonate},address:r});return await j({address:d,provider:o,apiAddress:e}),{address:d,signature:c}}async function Ht(o,t){let s=b(E());if(s)return await ts({provider:o,nativeAuthConfig:s,token:t?.token});let{address:e}=await Xt(o);return await M(e),U(),{address:e,signature:""}}var Y={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${pt}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${lt}-${Date.now()}`}},ss={extensionResponse:"Unable to sign transactions","Transaction canceled":"Transaction canceled","cancelled by user":"Transaction signing cancelled by user","denied by the user":"Transaction signing denied by the user"},es=o=>{for(let[t,s]of Object.entries(ss))if(o.includes(t))return s;return"Error when signing"};function Z(o,t="error"){let s=o?.message,e=es(s),i=e!=="Error when signing"?"warning":t,r=Object.keys(Y).includes(i)?Y[i]:Y.error,{toastId:c,iconClassName:a,title:m}=r;return _({toastId:c,duration:1e4,icon:"times",iconClassName:a,message:e,title:m}),e}async function Gt({provider:o,transactions:t,options:s={}}){await D();let{isGuarded:e,activeGuardianAddress:n,nonce:i}=Ft(),r=o.getType()===C.ledger,c=Rt({latestNonce:i,transactions:t}),a=n&&e&&!s.skipGuardian?c?.map(l=>(l.version=st.withTxOptions().valueOf(),l.options=ot.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),l.guardian=et.newFromBech32(n),l)):c,m=await o.signTransactions(a)??[];return bt(i+m.length),m}var W=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let s=await Ht(this.provider,t);return nt(this.provider.getType()),$t(this),R.getInstance().init(),s}isInitialized(){return this.provider.isInitialized()}async logout(t={shouldBroadcastLogoutAcrossTabs:!0}){if(this._isLoggingOut)return console.warn("Logout already in progress"),!1;this._isLoggingOut=!0;let s=await kt({provider:this.provider,options:t});return this._isLoggingOut=!1,s}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,s){try{return await Gt({provider:this.provider,transactions:t,options:s})}catch(e){let n=Z(e);throw new Error(n)}}async signMessage(t,s){try{return await Mt({provider:this.provider,message:t,options:s})}catch(e){let n=Z(e,"warning");throw new Error(n)}}async verifyMessage(t){return await Pt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var Kt=null;function $t(o){Kt=o}function I(){return Kt||new W(Bt)}var os=async()=>{try{let o=ut(),{network:t}=S();try{let s=await A({address:o,baseURL:t.apiAddress});if(s!=null){let e={...s,username:P(s.username),nonce:x(s)};return k(e),e}}catch(s){console.error("Failed getting account ",s)}}catch(o){console.error("Failed getting address ",o)}return null};async function D(){let o=I();if(o==null)throw"Provider not initialized";try{if(!o.init)throw"Current provider does not have init() function";return await o.init()?await os():void 0}catch(t){console.error("Failed initializing provider ",t)}}var H={},h={},ns=(o,t)=>{u().setState(({toasts:s})=>{let e=s.customToasts.length>0?Math.max(...s.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${e+1}`,i=s.customToasts.findIndex(a=>a.toastId===n),r={...o,toastId:n};if(i!==-1){s.customToasts[i]=r;return}s.customToasts.push({...r,toastId:n})},!1,"addCustomToast")},G=o=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(s=>s.toastId!==o)},!1,"removeCustomToast")},zt=()=>{u().setState(({toasts:o})=>{o.customToasts=[]},!1,"removeAllCustomToasts")},Wo=()=>{u().setState(({toasts:o})=>{o.transactionToasts=[]})},qt=({toastId:o,totalDuration:t})=>{let s="";return u().setState(({toasts:e})=>{let n=e.transactionToasts.length>0?Math.max(...e.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;s=o??`transaction-toast-${n+1}`,e.transactionToasts.push({startTime:at(),endTime:Dt(t),toastId:s})},!1,"addTransactionToast"),s},$=o=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(s=>s.toastId!==o)},!1,"removeTransactionToast"),delete h[o],delete H[o]},_=o=>{let{toasts:t}=u().getState(),s=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,e=o.toastId||`custom-toast-${s+1}`;return o.onClose&&(h[e]=o.onClose),o.instantiateToastElement?(H[e]=o.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===e),r={...o,instantiateToastElement:null,toastId:e};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),e):(ns(o,e),e)};var Vt=1e4,K=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=Vt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let s=setTimeout(()=>{$(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,s)};this.startWithCustomDuration=(t,s)=>{if(this.stop(t),s<=0)return;let e=setTimeout(()=>{G(t);let n=h[t];n?.()},s);this.timeoutIntervals.set(t,e)};this.stop=t=>{let s=this.timeoutIntervals.get(t);s&&(clearTimeout(s),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t||Vt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};var T=class o{constructor(){this.isCreatingElement=!1;this.toastsElement=null;this.transactionToasts=[];this.customToasts=[];this.storeToastsSubscription=()=>null;this.eventBusUnsubscribeFunctions=[];this.eventBus=null;this.store=u();this.destroy(),this.lifetimeManager=new K,this.notificationsFeedManager=F.getInstance()}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),await this.updateTransactionToastsList(),await this.updateCustomToastList(),await this.subscribeToEventBusNotifications(),this.storeToastsSubscription=this.store.subscribe(async({toasts:s,transactions:e},{toasts:n,transactions:i})=>{(!J(n.transactionToasts,s.transactionToasts)||!J(i,e))&&await this.updateTransactionToastsList(),J(n.customToasts,s.customToasts)||await this.updateCustomToastList()})}static getInstance(){return o.instance||(o.instance=new o),o.instance}handleCompletedTransaction(t){let{transactions:s}=this.store.getState(),e=s[t];if(!e)return!1;let{status:n}=e,i=ht(n),r=N(n),c=ft(n),a=r||c||i;return a?(this.successfulToastLifetime&&this.lifetimeManager.start(t),a):(this.lifetimeManager.stop(t),a)}async createTransactionToast(t,s){let e=qt({toastId:t,totalDuration:s});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),e}createCustomToast(t){let s=_(t);return this.updateCustomToastList(),s}async updateTransactionToastsList(){let{toasts:t,transactions:s,account:e}=this.store.getState(),{pendingTransactionToasts:n,completedTransactionToasts:i}=await O({toastList:t,transactionsSessions:s,account:e});this.transactionToasts=[...n,...i];for(let r of t.transactionToasts)this.handleCompletedTransaction(r.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let s of t.customToasts){let n="message"in s?{...s}:{...s,instantiateToastElement:H[s.toastId]};this.customToasts.push(n),s.duration&&this.lifetimeManager.startWithCustomDuration(s.toastId,s.duration)}this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await St.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}handleTransactionToastClose(t){this.handleCompletedTransaction(t)&&$(t)}async subscribeToEventBusNotifications(){let t=await this.createToastListElement();if(t){if(this.eventBus=await t.getEventBus(),!this.eventBus)throw new Error("eventBus is not initialized");this.eventBus.subscribe("CLOSE_TOAST",this.closeToast.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.closeToast.bind(this))}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}async showToasts(){this.eventBus?.publish("SHOW_TOAST_LIST",null),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.eventBus?.publish("HIDE_TOAST_LIST",null)}async handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}closeToast(t){if(this.customToasts.find(e=>e.toastId===t)){this.lifetimeManager.stop(t);let e=h[t];e?.(),G(t);return}this.handleTransactionToastClose(t)}async publishTransactionToasts(){if(this.notificationsFeedManager.isNotificationsFeedOpen()&&this.eventBus){this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts),this.hideToasts();return}if(!this.eventBus){let t=await this.createToastListElement();if(!t)return;this.eventBus=await t.getEventBus()}this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts)}destroy(){this.storeToastsSubscription(),this.lifetimeManager?.destroy(),this.notificationsFeedManager?.destroy(),zt(),this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[]}};export{F as a,H as b,h as c,ns as d,G as e,zt as f,Wo as g,qt as h,$ as i,_ as j,K as k,T as l,R as m,_t as n,Wt as o,U as p,j as q,Ht as r,Z as s,Gt as t,W as u,$t as v,I as w,D as x};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as Et}from"./chunk-P5EDEM26.mjs";import{a as gt}from"./chunk-3462VWV2.mjs";import{a as It}from"./chunk-6UZHM5LW.mjs";import{a as k}from"./chunk-355TDGZM.mjs";import{a as xt}from"./chunk-6OBHBOL7.mjs";import{a as wt}from"./chunk-FQTEXMMN.mjs";import{a as At}from"./chunk-RSJC4YBI.mjs";import{a as Lt}from"./chunk-GRU4NOFI.mjs";import{a as y}from"./chunk-FMQYLMTU.mjs";import{a as Ct}from"./chunk-MFUQ5NBC.mjs";import{a as Rt}from"./chunk-4ODPAHHA.mjs";import{a as Ot}from"./chunk-NPF3MLTJ.mjs";import{b as F}from"./chunk-NOAPU5US.mjs";import{a as kt}from"./chunk-DJCWPLIW.mjs";import{a as Mt}from"./chunk-MDVI45IV.mjs";import{a as Ft}from"./chunk-PM2CIPJB.mjs";import{a as S}from"./chunk-5DKIUS4V.mjs";import{a as ut}from"./chunk-WGESEEJ2.mjs";import{a as yt}from"./chunk-BYMTQKPA.mjs";import{a as x}from"./chunk-NN2ODLFY.mjs";import{a as O,f as bt}from"./chunk-ZVDPYIMB.mjs";import{b as f,c as q,d as vt}from"./chunk-OQOS52S7.mjs";import{k as ft,l as N,n as ht}from"./chunk-65L5EBBL.mjs";import{b as Nt}from"./chunk-A7PB4MFL.mjs";import{a as M}from"./chunk-HORSXVIV.mjs";import{a as Pt}from"./chunk-ENGIAAJA.mjs";import{a as ct}from"./chunk-LIQTTAAS.mjs";import{a as L}from"./chunk-QTKK6OSJ.mjs";import{a as rt}from"./chunk-6ACLOUQ3.mjs";import{a as A}from"./chunk-NZYB675D.mjs";import{a as at}from"./chunk-YSCND2MX.mjs";import{a as Dt}from"./chunk-NJN53MJV.mjs";import{a as lt,b as pt,g as Tt,l as dt}from"./chunk-2IUBMLF4.mjs";import{b as mt}from"./chunk-TQA3JDNV.mjs";import{a as nt,b as it,q as u,s as E}from"./chunk-MSFYVSIA.mjs";import{c as Q,d as X,f as tt}from"./chunk-UERJ6AKK.mjs";import{b as v}from"./chunk-VNLGNNIL.mjs";import{b}from"./chunk-6JM4DPOH.mjs";import{b as st,c as et,f as ot}from"./chunk-NTEMINYA.mjs";import{b as Bt}from"./chunk-UCRVRBTA.mjs";import{a as St}from"./chunk-B6YF7H7U.mjs";import{c as w}from"./chunk-5Q2JDZD3.mjs";import{b as z}from"./chunk-GGBMHKR4.mjs";import{a as C}from"./chunk-LJX4MW7B.mjs";import J from"lodash.isequal";import Ut from"lodash.isequal";var Zt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",P=class o extends yt{constructor(){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.store=u();this.initialData={pendingTransactions:[],historicTransactions:[]};this.data={...this.initialData}}static getInstance(){return o.instance||(o.instance=new o),o.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){T.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let e=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Ut(r.transactionToasts,n.transactionToasts)||!Ut(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Zt,[e]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let s=T.getInstance();this.closeUI(),await s.showToasts()}async setupEventListeners(){this.eventBus&&(this.subscribeToEventBus("CLOSE_NOTIFICATIONS_FEED",this.handleCloseUI.bind(this)),this.subscribeToEventBus("CLEAR_NOTIFICATIONS_FEED_HISTORY",this.handleClearNotificationsFeedHistory.bind(this)))}async updateDataAndNotifications(){let{transactions:s,account:e,toasts:n,network:i}=this.store.getState(),{pendingTransactionToasts:r}=await k({toastList:n,transactionsSessions:s,account:e});this.data.pendingTransactions=r,this.data.historicTransactions=await gt.getTransactionsHistory({transactionsSessions:s,address:e.address,explorerAddress:i.network.explorerAddress,egldLabel:i.network.egldLabel}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){vt(),this.resetData(),this.updateNotificationsFeed()}async updateNotificationsFeed(){this.eventBus&&(this.eventBus.publish("PENDING_TRANSACTIONS_UPDATE",this.data.pendingTransactions),this.eventBus.publish("TRANSACTIONS_HISTORY_UPDATE",this.data.historicTransactions))}};import V from"bignumber.js";var R=class o{constructor(){this.store=u();this.warningLogoutTimeoutRef=null;this.actualLogoutTimeoutRef=null;this.plannedLogoutTimeoutRef=null;this.plannedLogoutKey=null;this.init=async()=>{if(!this.shouldStart())return;let t=this.store.getState(),s=v(t),{isExpired:e}=L(s?.nativeAuthToken);e?I().logout():this.addPlannedLogout()};this.stop=()=>{clearTimeout(this.warningLogoutTimeoutRef??0),clearTimeout(this.plannedLogoutTimeoutRef??0),clearTimeout(this.actualLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=null,this.plannedLogoutTimeoutRef=null,this.actualLogoutTimeoutRef=null,this.plannedLogoutKey=null};this.shouldStart=()=>{let t=this.store.getState(),s=v(t),e=tt(t);return!!(s?.nativeAuthToken&&e)};this.addPlannedLogout=()=>{let t=I(),s=Q(this.store.getState()),e=t.getType()===C.webview;if(!s||e)return;this.addLogoutWarning();let n=v(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=L(n?.nativeAuthToken),c=new V(String(i)),a=`${s}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let d=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},d.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},d.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=b(this.store.getState()),s=v(this.store.getState()),{secondsUntilExpires:e}=L(s?.nativeAuthToken),n=new V(String(e)),i=n.times(1e3);if(!e||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new V(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=It(i.toNumber()),l=a.isLessThanOrEqualTo(0)?0:a.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-expired",iconClassName:"warning",title:"Session Expiration Warning",icon:"hourglass",message:`Your session will expire in ${m}!`}),this.warningLogoutTimeoutRef=null},l)}}static getInstance(){return o.instance||(o.instance=new o),o.instance}};var B={};async function Qt({serverTransaction:o,sessionId:t,isSequential:s}){let{hash:e,status:n,results:i,invalidTransaction:r,hasStatusChanged:c}=o;try{if(B[e]>30){f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"});return}if(r&&!s||n==="sent"){B[e]=B[e]?B[e]+1:1;return}if(s&&!n){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m});return}if(c){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m})}N(n)&&await Lt({sessionId:t,hash:e,results:i})}catch(a){console.error(a),f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"})}}async function _t({sessionId:o,transactionBatch:t,isSequential:s}){try{if(t==null)return;let e=wt(),n=Ct(t),i=await Et(n);for(let p of i)await Qt({serverTransaction:p,sessionId:o,isSequential:s});if(!i.every(p=>p.status!=="pending"))return;e&&await D();let{transactions:c}=u().getState(),a=c[o];if(a.transactions.every(p=>p.status==="success"))return f({sessionId:o,status:"success"});if(a.transactions.some(p=>p.status==="fail"))return f({sessionId:o,status:"fail"});if(a.transactions.every(p=>p.status==="not executed"))return f({sessionId:o,status:"invalid"})}catch(e){console.error(e)}}async function Wt(){let o=mt(E());if(Object.keys(o).length>0)for(let[t,{transactions:s}]of Object.entries(o))await _t({sessionId:t,transactionBatch:s})}async function U(){let o=u(),t=At(),s=null,e=null,n=X(o.getState())?.timestamp,i=()=>{Wt()},r=()=>{s??=setInterval(i,t)},c=()=>{s&&(clearInterval(s),s=null)},a=()=>{c();let p=o.subscribe(({account:{websocketEvent:g}})=>{g?.message&&n!==g.timestamp&&(n=g.timestamp,i())});w.set("websocketEventReceived",p)},m=()=>{z.status!=="not_initialized"||e||(e=setInterval(()=>{z.status==="completed"&&(clearInterval(e),e=null,a())},1e3))};i();let l=()=>{c(),e&&(clearInterval(e),e=null)},d=o.subscribe(({account:{address:p},config:{websocketStatus:g}},jt)=>{if(jt.config.websocketStatus!==g)switch(g){case"completed":a();break;case"pending":r(),m();break;default:p?r():l();break}});return w.set("websocketStatusChanged",d),w.set("websocketEventReceived",l),{stopTransactionsTracking:l}}async function j({address:o,provider:t,apiAddress:s}){let e=await A({address:o,baseURL:s});if(!e)throw new Error("Account not found");Nt({address:o,providerType:t.getType()});let n={...e,username:M(e.username),nonce:x(e)};O(n),await F(o),U(),e.shard!=null&&await xt({shard:Number(e.shard),apiAddress:s})}async function Xt(o){let{network:{apiAddress:t}}=S();await o.login();let s=await o.getAddress();if(!s)throw new Error("Address not found");return await j({address:s,provider:o,apiAddress:t}),{address:s}}async function ts({provider:o,nativeAuthConfig:t,token:s}){let{network:{apiAddress:e}}=S(),n=ct(t),i=s;i||(i=await n.initialize({noCache:!0}));let{address:r,signature:c,...a}=await o.login({token:i});if(!r)return console.warn("Login cancelled."),null;if(!c)return console.error("Failed to sign login token"),null;let l=rt(a?.accessToken)?a.accessToken:n.getToken({address:r,token:i,signature:c});it({loginToken:i,signature:c,nativeAuthToken:l});let d=await kt({loginToken:i,extraInfoData:{multisig:a?.multisig,impersonate:a?.impersonate},address:r});return await j({address:d,provider:o,apiAddress:e}),{address:d,signature:c}}async function Ht(o,t){let s=b(E());if(s)return await ts({provider:o,nativeAuthConfig:s,token:t?.token});let{address:e}=await Xt(o);return await F(e),U(),{address:e,signature:""}}var Y={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${pt}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${lt}-${Date.now()}`}},ss={extensionResponse:"Unable to sign transactions","Transaction canceled":"Transaction canceled","cancelled by user":"Transaction signing cancelled by user","denied by the user":"Transaction signing denied by the user"},es=o=>{for(let[t,s]of Object.entries(ss))if(o.includes(t))return s;return"Error when signing"};function Z(o,t="error"){let s=o?.message,e=es(s),i=e!=="Error when signing"?"warning":t,r=Object.keys(Y).includes(i)?Y[i]:Y.error,{toastId:c,iconClassName:a,title:m}=r;return _({toastId:c,duration:1e4,icon:"times",iconClassName:a,message:e,title:m}),e}async function Gt({provider:o,transactions:t,options:s={}}){await D();let{isGuarded:e,activeGuardianAddress:n,nonce:i}=Pt(),r=o.getType()===C.ledger,c=Rt({latestNonce:i,transactions:t}),a=n&&e&&!s.skipGuardian?c?.map(l=>(l.version=st.withTxOptions().valueOf(),l.options=ot.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),l.guardian=et.newFromBech32(n),l)):c,m=await o.signTransactions(a)??[];return bt(i+m.length),m}var W=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let s=await Ht(this.provider,t);return nt(this.provider.getType()),$t(this),R.getInstance().init(),s}isInitialized(){return this.provider.isInitialized()}async logout(t={shouldBroadcastLogoutAcrossTabs:!0}){if(this._isLoggingOut)return console.warn("Logout already in progress"),!1;this._isLoggingOut=!0;let s=await Ot({provider:this.provider,options:t});return this._isLoggingOut=!1,s}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,s){try{return await Gt({provider:this.provider,transactions:t,options:s})}catch(e){let n=Z(e);throw new Error(n)}}async signMessage(t,s){try{return await Ft({provider:this.provider,message:t,options:s})}catch(e){let n=Z(e,"warning");throw new Error(n)}}async verifyMessage(t){return await Mt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var Kt=null;function $t(o){Kt=o}function I(){return Kt||new W(Bt)}var os=async()=>{try{let o=ut(),{network:t}=S();try{let s=await A({address:o,baseURL:t.apiAddress});if(s!=null){let e={...s,username:M(s.username),nonce:x(s)};return O(e),e}}catch(s){console.error("Failed getting account ",s)}}catch(o){console.error("Failed getting address ",o)}return null};async function D(){let o=I();if(o==null)throw"Provider not initialized";try{if(!o.init)throw"Current provider does not have init() function";return await o.init()?await os():void 0}catch(t){console.error("Failed initializing provider ",t)}}var H={},h={},ns=(o,t)=>{u().setState(({toasts:s})=>{let e=s.customToasts.length>0?Math.max(...s.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${e+1}`,i=s.customToasts.findIndex(a=>a.toastId===n),r={...o,toastId:n};if(i!==-1){s.customToasts[i]=r;return}s.customToasts.push({...r,toastId:n})},!1,"addCustomToast")},G=o=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(s=>s.toastId!==o)},!1,"removeCustomToast")},zt=()=>{u().setState(({toasts:o})=>{o.customToasts=[]},!1,"removeAllCustomToasts")},Wo=()=>{u().setState(({toasts:o})=>{o.transactionToasts=[]})},qt=({toastId:o,totalDuration:t})=>{let s="";return u().setState(({toasts:e})=>{let n=e.transactionToasts.length>0?Math.max(...e.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;s=o??`transaction-toast-${n+1}`,e.transactionToasts.push({startTime:at(),endTime:Dt(t),toastId:s})},!1,"addTransactionToast"),s},$=o=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(s=>s.toastId!==o)},!1,"removeTransactionToast"),delete h[o],delete H[o]},_=o=>{let{toasts:t}=u().getState(),s=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,e=o.toastId||`custom-toast-${s+1}`;return o.onClose&&(h[e]=o.onClose),o.instantiateToastElement?(H[e]=o.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===e),r={...o,instantiateToastElement:null,toastId:e};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),e):(ns(o,e),e)};var Vt=1e4,K=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=Vt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let s=setTimeout(()=>{$(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,s)};this.startWithCustomDuration=(t,s)=>{if(this.stop(t),s<=0)return;let e=setTimeout(()=>{G(t);let n=h[t];n?.()},s);this.timeoutIntervals.set(t,e)};this.stop=t=>{let s=this.timeoutIntervals.get(t);s&&(clearTimeout(s),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t||Vt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};var T=class o{constructor(){this.isCreatingElement=!1;this.toastsElement=null;this.transactionToasts=[];this.customToasts=[];this.storeToastsSubscription=()=>null;this.eventBusUnsubscribeFunctions=[];this.eventBus=null;this.store=u();this.destroy(),this.lifetimeManager=new K,this.notificationsFeedManager=P.getInstance()}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),await this.updateTransactionToastsList(),await this.updateCustomToastList(),await this.subscribeToEventBusNotifications(),this.storeToastsSubscription=this.store.subscribe(async({toasts:s,transactions:e},{toasts:n,transactions:i})=>{let r=!J(n.transactionToasts,s.transactionToasts),c=!J(i,e);(r||c)&&await this.updateTransactionToastsList({skipFetchingTransactions:c}),!J(n.customToasts,s.customToasts)&&await this.updateCustomToastList()})}static getInstance(){return o.instance||(o.instance=new o),o.instance}handleCompletedTransaction(t){let{transactions:s}=this.store.getState(),e=s[t];if(!e)return!1;let{status:n}=e,i=ht(n),r=N(n),c=ft(n),a=r||c||i;return a?(this.successfulToastLifetime&&this.lifetimeManager.start(t),a):(this.lifetimeManager.stop(t),a)}async createTransactionToast(t,s){let e=qt({toastId:t,totalDuration:s});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),e}createCustomToast(t){let s=_(t);return this.updateCustomToastList(),s}async updateTransactionToastsList(t){let{toasts:s,transactions:e,account:n}=this.store.getState(),{pendingTransactionToasts:i,completedTransactionToasts:r}=await k({toastList:s,transactionsSessions:e,account:n,skipFetchingTransactions:t?.skipFetchingTransactions});this.transactionToasts=[...i,...r];for(let c of s.transactionToasts)this.handleCompletedTransaction(c.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let s of t.customToasts){let n="message"in s?{...s}:{...s,instantiateToastElement:H[s.toastId]};this.customToasts.push(n),s.duration&&this.lifetimeManager.startWithCustomDuration(s.toastId,s.duration)}this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await St.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}handleTransactionToastClose(t){this.handleCompletedTransaction(t)&&$(t)}async subscribeToEventBusNotifications(){let t=await this.createToastListElement();if(t){if(this.eventBus=await t.getEventBus(),!this.eventBus)throw new Error("eventBus is not initialized");this.eventBus.subscribe("CLOSE_TOAST",this.closeToast.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.closeToast.bind(this))}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}async showToasts(){this.eventBus?.publish("SHOW_TOAST_LIST",null),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.eventBus?.publish("HIDE_TOAST_LIST",null)}async handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}closeToast(t){if(this.customToasts.find(e=>e.toastId===t)){this.lifetimeManager.stop(t);let e=h[t];e?.(),G(t);return}this.handleTransactionToastClose(t)}async publishTransactionToasts(){if(this.notificationsFeedManager.isNotificationsFeedOpen()&&this.eventBus){this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts),this.hideToasts();return}if(!this.eventBus){let t=await this.createToastListElement();if(!t)return;this.eventBus=await t.getEventBus()}this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts)}destroy(){this.storeToastsSubscription(),this.lifetimeManager?.destroy(),this.notificationsFeedManager?.destroy(),zt(),this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[]}};export{P as a,H as b,h as c,ns as d,G as e,zt as f,Wo as g,qt as h,$ as i,_ as j,K as k,T as l,R as m,_t as n,Wt as o,U as p,j as q,Ht as r,Z as s,Gt as t,W as u,$t as v,I as w,D as x};
|
|
2
|
+
//# sourceMappingURL=chunk-YEQDJ3AV.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/managers/internal/ToastManager/ToastManager.ts", "../../src/managers/NotificationsFeedManager/NotificationsFeedManager.ts", "../../src/managers/LogoutManager/LogoutManager.ts", "../../src/methods/trackTransactions/helpers/checkTransactionStatus/checkBatch.ts", "../../src/methods/trackTransactions/helpers/checkTransactionStatus/checkTransactionStatus.ts", "../../src/methods/trackTransactions/trackTransactions.ts", "../../src/providers/DappProvider/helpers/login/helpers/accountLogin.ts", "../../src/providers/DappProvider/helpers/login/login.ts", "../../src/providers/DappProvider/helpers/signErrors/handleSignError.ts", "../../src/providers/DappProvider/helpers/signTransactions/signTransactionsWithProvider.ts", "../../src/providers/DappProvider/DappProvider.ts", "../../src/providers/helpers/accountProvider.ts", "../../src/utils/account/refreshAccount.ts", "../../src/store/actions/toasts/toastsActions.ts", "../../src/managers/internal/ToastManager/helpers/LifetimeManager.ts"],
|
|
4
|
+
"sourcesContent": ["import isEqual from 'lodash.isequal';\nimport { DEFAULT_TOAST_LIEFTIME } from 'constants/transactions.constants';\nimport { UITagsEnum } from 'constants/UITags.enum';\nimport { MvxToastList } from 'lib/sdkDappUi';\nimport { NotificationsFeedManager } from 'managers/NotificationsFeedManager/NotificationsFeedManager';\nimport {\n customToastCloseHandlersDictionary,\n customToastComponentDictionary,\n removeAllCustomToasts,\n removeCustomToast,\n removeTransactionToast,\n addTransactionToast,\n createCustomToast\n} from 'store/actions/toasts/toastsActions';\nimport {\n getIsTransactionFailed,\n getIsTransactionSuccessful,\n getIsTransactionTimedOut\n} from 'store/actions/transactions/transactionStateByStatus';\n\nimport { CustomToastType } from 'store/slices/toast/toastSlice.types';\nimport { getStore } from 'store/store';\nimport { IEventBus } from 'types/manager.types';\nimport { ProviderErrorsEnum } from 'types/provider.types';\nimport { ComponentFactory } from 'utils/ComponentFactory';\nimport { createToastsFromTransactions } from './helpers/createToastsFromTransactions';\nimport { LifetimeManager } from './helpers/LifetimeManager';\nimport { ITransactionToast, ToastEventsEnum } from './types';\n\ninterface IToastManager {\n successfulToastLifetime?: number;\n}\n\nexport class ToastManager {\n private readonly lifetimeManager: LifetimeManager;\n private isCreatingElement = false;\n private static instance: ToastManager;\n private toastsElement: MvxToastList | null = null;\n private transactionToasts: ITransactionToast[] = [];\n private customToasts: CustomToastType[] = [];\n private successfulToastLifetime?: number;\n private storeToastsSubscription: () => void = () => null;\n private readonly notificationsFeedManager: NotificationsFeedManager;\n private eventBusUnsubscribeFunctions: (() => void)[] = [];\n private eventBus: IEventBus<\n ITransactionToast[] | CustomToastType[] | null\n > | null = null;\n\n store = getStore();\n\n constructor() {\n this.destroy();\n this.lifetimeManager = new LifetimeManager();\n\n this.notificationsFeedManager = NotificationsFeedManager.getInstance();\n }\n\n public async init({\n successfulToastLifetime = DEFAULT_TOAST_LIEFTIME\n }: IToastManager = {}) {\n this.successfulToastLifetime = successfulToastLifetime;\n\n this.lifetimeManager.init({ successfulToastLifetime });\n\n await this.updateTransactionToastsList();\n await this.updateCustomToastList();\n\n await this.subscribeToEventBusNotifications();\n\n this.storeToastsSubscription = this.store.subscribe(\n async (\n { toasts, transactions },\n { toasts: prevToasts, transactions: prevTransactions }\n ) => {\n const newToastsWereCreated = !isEqual(\n prevToasts.transactionToasts,\n toasts.transactionToasts\n );\n const checkBatchHasNewData = !isEqual(prevTransactions, transactions);\n\n if (newToastsWereCreated || checkBatchHasNewData) {\n await this.updateTransactionToastsList({\n skipFetchingTransactions: checkBatchHasNewData // transactions were already fetched by `checkBatch`\n });\n }\n\n const newCustomToastsWereCreated = !isEqual(\n prevToasts.customToasts,\n toasts.customToasts\n );\n\n if (newCustomToastsWereCreated) {\n await this.updateCustomToastList();\n }\n }\n );\n }\n\n public static getInstance(): ToastManager {\n if (!ToastManager.instance) {\n ToastManager.instance = new ToastManager();\n }\n return ToastManager.instance;\n }\n\n private handleCompletedTransaction(toastId: string): boolean {\n const { transactions } = this.store.getState();\n const transaction = transactions[toastId];\n\n if (!transaction) {\n return false;\n }\n\n const { status } = transaction;\n const isTimedOut = getIsTransactionTimedOut(status);\n const isFailed = getIsTransactionFailed(status);\n const isSuccessful = getIsTransactionSuccessful(status);\n const isCompleted = isFailed || isSuccessful || isTimedOut;\n\n if (isCompleted) {\n if (this.successfulToastLifetime) {\n this.lifetimeManager.start(toastId);\n }\n return isCompleted;\n }\n\n this.lifetimeManager.stop(toastId);\n return isCompleted;\n }\n\n public async createTransactionToast(\n toastId: string,\n totalDuration: number\n ): Promise<string> {\n const newToastId = addTransactionToast({\n toastId,\n totalDuration\n });\n\n this.handleCompletedTransaction(toastId);\n await this.updateTransactionToastsList();\n return newToastId;\n }\n\n public createCustomToast(toast: CustomToastType): string {\n const toastId = createCustomToast(toast);\n this.updateCustomToastList();\n return toastId;\n }\n\n private async updateTransactionToastsList(props?: {\n skipFetchingTransactions?: boolean;\n }) {\n const {\n toasts: toastList,\n transactions: transactionsSessions,\n account\n } = this.store.getState();\n\n const { pendingTransactionToasts, completedTransactionToasts } =\n await createToastsFromTransactions({\n toastList,\n transactionsSessions,\n account,\n skipFetchingTransactions: props?.skipFetchingTransactions\n });\n\n this.transactionToasts = [\n ...pendingTransactionToasts,\n ...completedTransactionToasts\n ];\n\n for (const toast of toastList.transactionToasts) {\n this.handleCompletedTransaction(toast.toastId);\n }\n\n await this.publishTransactionToasts();\n }\n\n private async updateCustomToastList() {\n const { toasts: toastList } = this.store.getState();\n this.customToasts = [];\n\n for (const toast of toastList.customToasts) {\n const isSimpleToast = 'message' in toast;\n\n const newToast: CustomToastType = isSimpleToast\n ? { ...toast }\n : {\n ...toast,\n instantiateToastElement:\n customToastComponentDictionary[toast.toastId]\n };\n this.customToasts.push(newToast);\n\n if (toast.duration) {\n this.lifetimeManager.startWithCustomDuration(\n toast.toastId,\n toast.duration\n );\n }\n }\n this.eventBus?.publish(\n ToastEventsEnum.CUSTOM_TOAST_DATA_UPDATE,\n this.customToasts\n );\n }\n\n private async createToastListElement(): Promise<MvxToastList | null> {\n if (this.toastsElement) {\n return this.toastsElement;\n }\n\n if (!this.isCreatingElement) {\n this.isCreatingElement = true;\n\n this.toastsElement = await ComponentFactory.create<MvxToastList>({\n name: UITagsEnum.TOAST_LIST\n });\n\n this.isCreatingElement = false;\n }\n\n return this.toastsElement;\n }\n\n private handleTransactionToastClose(toastId: string) {\n const isCompleted = this.handleCompletedTransaction(toastId);\n\n if (isCompleted) {\n removeTransactionToast(toastId);\n }\n }\n\n private async subscribeToEventBusNotifications() {\n const toastsElement = await this.createToastListElement();\n\n if (!toastsElement) {\n return;\n }\n\n this.eventBus = await toastsElement.getEventBus();\n if (!this.eventBus) {\n throw new Error(ProviderErrorsEnum.eventBusError);\n }\n\n this.eventBus.subscribe(ToastEventsEnum.CLOSE, this.closeToast.bind(this));\n\n this.eventBusUnsubscribeFunctions.push(() => {\n this.eventBus?.unsubscribe(\n ToastEventsEnum.CLOSE,\n this.closeToast.bind(this)\n );\n });\n\n this.eventBus.subscribe(\n ToastEventsEnum.OPEN_NOTIFICATIONS_FEED,\n this.handleOpenNotificationsFeed.bind(this)\n );\n\n this.eventBusUnsubscribeFunctions.push(() => {\n this.eventBus?.unsubscribe(\n ToastEventsEnum.OPEN_NOTIFICATIONS_FEED,\n this.handleOpenNotificationsFeed.bind(this)\n );\n });\n }\n\n public async showToasts() {\n this.eventBus?.publish(ToastEventsEnum.SHOW, null);\n\n await this.updateCustomToastList();\n await this.updateTransactionToastsList();\n }\n\n public hideToasts() {\n this.eventBus?.publish(ToastEventsEnum.HIDE, null);\n }\n\n private async handleOpenNotificationsFeed() {\n this.notificationsFeedManager.openNotificationsFeed();\n }\n\n public closeToast(toastId: string) {\n const customToast = this.customToasts.find(\n (toast) => toast.toastId === toastId\n );\n\n if (customToast) {\n this.lifetimeManager.stop(toastId);\n const handleClose = customToastCloseHandlersDictionary[toastId];\n handleClose?.();\n removeCustomToast(toastId);\n return;\n }\n\n this.handleTransactionToastClose(toastId);\n }\n\n private async publishTransactionToasts() {\n if (\n this.notificationsFeedManager.isNotificationsFeedOpen() &&\n this.eventBus\n ) {\n this.eventBus.publish(\n ToastEventsEnum.TRANSACTION_TOAST_DATA_UPDATE,\n this.transactionToasts\n );\n\n this.hideToasts();\n return;\n }\n\n if (!this.eventBus) {\n const toastsElement = await this.createToastListElement();\n\n if (!toastsElement) {\n return;\n }\n\n this.eventBus = await toastsElement.getEventBus();\n }\n\n this.eventBus.publish(\n ToastEventsEnum.TRANSACTION_TOAST_DATA_UPDATE,\n this.transactionToasts\n );\n }\n\n public destroy() {\n this.storeToastsSubscription();\n this.lifetimeManager?.destroy();\n this.notificationsFeedManager?.destroy();\n removeAllCustomToasts();\n this.eventBusUnsubscribeFunctions.forEach((unsubscribe) => unsubscribe());\n this.eventBusUnsubscribeFunctions = [];\n }\n}\n", "import isEqual from 'lodash.isequal';\nimport { UITagsEnum } from 'constants/UITags.enum';\nimport { TransactionsHistoryController } from 'controllers/TransactionsHistoryController';\nimport { ITransactionListItem, MvxNotificationsFeed } from 'lib/sdkDappUi';\nimport { clearCompletedTransactions } from 'store/actions/transactions/transactionsActions';\nimport { getStore } from 'store/store';\nimport { NotificationsFeedEventsEnum } from './types';\nimport { ToastManager } from '../internal';\nimport { SidePanelBaseManager } from '../internal/SidePanelBaseManager/SidePanelBaseManager';\nimport { createToastsFromTransactions } from '../internal/ToastManager/helpers/createToastsFromTransactions';\nimport { ITransactionToast } from '../internal/ToastManager/types';\n\ninterface INotificationsFeedManagerData {\n pendingTransactions: ITransactionToast[];\n historicTransactions: ITransactionListItem[];\n}\n\nconst NOTIFICATIONS_FEED_STORE_SUBSCRIBE = 'NOTIFICATIONS_FEED_STORE_SUBSCRIBE';\n\nexport class NotificationsFeedManager extends SidePanelBaseManager<\n MvxNotificationsFeed,\n INotificationsFeedManagerData,\n NotificationsFeedEventsEnum | typeof NOTIFICATIONS_FEED_STORE_SUBSCRIBE\n> {\n private static instance: NotificationsFeedManager;\n private readonly store = getStore();\n\n protected initialData: INotificationsFeedManagerData = {\n pendingTransactions: [],\n historicTransactions: []\n };\n\n public static getInstance(): NotificationsFeedManager {\n if (!NotificationsFeedManager.instance) {\n NotificationsFeedManager.instance = new NotificationsFeedManager();\n }\n return NotificationsFeedManager.instance;\n }\n\n constructor() {\n super({\n uiDataUpdateEvent: NotificationsFeedEventsEnum.OPEN,\n uiTag: UITagsEnum.NOTIFICATIONS_FEED\n });\n this.data = { ...this.initialData };\n }\n\n public isNotificationsFeedOpen(): boolean {\n return this.isOpen;\n }\n\n /**\n * Open the notifications feed and toggle off the toast manager.\n */\n public async openNotificationsFeed(): Promise<void> {\n const toastManager = ToastManager.getInstance();\n toastManager.hideToasts();\n await this.openUI();\n await this.updateDataAndNotifications();\n\n const storeToastsUnsubscribe = this.store.subscribe(\n async (\n { toasts, transactions },\n { toasts: prevToasts, transactions: prevTransactions }\n ) => {\n if (\n !isEqual(prevToasts.transactionToasts, toasts.transactionToasts) ||\n !isEqual(prevTransactions, transactions)\n ) {\n await this.updateDataAndNotifications();\n }\n }\n );\n this.unsubscribeFunctions.set(NOTIFICATIONS_FEED_STORE_SUBSCRIBE, [\n storeToastsUnsubscribe\n ]);\n\n this.eventBus?.publish(NotificationsFeedEventsEnum.OPEN);\n await this.updateDataAndNotifications();\n }\n\n /**\n * Close the notifications feed and toggle on the toast manager.\n */\n protected async handleCloseUI() {\n const toastManager = ToastManager.getInstance();\n this.closeUI();\n await toastManager.showToasts();\n }\n\n protected async setupEventListeners() {\n if (!this.eventBus) {\n return;\n }\n\n this.subscribeToEventBus(\n NotificationsFeedEventsEnum.CLOSE,\n this.handleCloseUI.bind(this)\n );\n\n this.subscribeToEventBus(\n NotificationsFeedEventsEnum.CLEAR,\n this.handleClearNotificationsFeedHistory.bind(this)\n );\n }\n\n protected async updateDataAndNotifications() {\n const { transactions, account, toasts, network } = this.store.getState();\n\n const { pendingTransactionToasts } = await createToastsFromTransactions({\n toastList: toasts,\n transactionsSessions: transactions,\n account\n });\n\n this.data.pendingTransactions = pendingTransactionToasts;\n\n this.data.historicTransactions =\n await TransactionsHistoryController.getTransactionsHistory({\n transactionsSessions: transactions,\n address: account.address,\n explorerAddress: network.network.explorerAddress,\n egldLabel: network.network.egldLabel\n });\n\n await this.updateNotificationsFeed();\n }\n\n private handleClearNotificationsFeedHistory() {\n clearCompletedTransactions();\n this.resetData();\n this.updateNotificationsFeed();\n }\n\n private async updateNotificationsFeed() {\n if (!this.eventBus) {\n return;\n }\n\n this.eventBus.publish(\n NotificationsFeedEventsEnum.PENDING_TRANSACTIONS_UPDATE,\n this.data.pendingTransactions\n );\n\n this.eventBus.publish(\n NotificationsFeedEventsEnum.TRANSACTIONS_HISTORY_UPDATE,\n this.data.historicTransactions\n );\n }\n}\n", "import BigNumber from 'bignumber.js';\nimport { ToastIconsEnum } from 'managers/internal/ToastManager/helpers/getToastDataStateByStatus';\nimport { ToastManager } from 'managers/internal/ToastManager/ToastManager';\nimport { getAccountProvider } from 'providers/helpers/accountProvider';\nimport { ProviderTypeEnum } from 'providers/types/providerFactory.types';\nimport { getTokenExpiration } from 'services/nativeAuth/methods/getTokenExpiration';\nimport {\n addressSelector,\n isLoggedInSelector\n} from 'store/selectors/accountSelectors';\nimport { nativeAuthConfigSelector } from 'store/selectors/configSelectors';\nimport { tokenLoginSelector } from 'store/selectors/loginInfoSelectors';\nimport { getStore } from 'store/store';\nimport { getHumanReadableTokenExpirationTime } from './helpers/getHumanReadableTokenExpirationTime';\n\nexport class LogoutManager {\n private static instance: LogoutManager;\n private store = getStore();\n private warningLogoutTimeoutRef: ReturnType<typeof setInterval> | null = null;\n private actualLogoutTimeoutRef: ReturnType<typeof setInterval> | null = null;\n private plannedLogoutTimeoutRef: ReturnType<typeof setInterval> | null = null;\n private plannedLogoutKey: string | null = null;\n\n public static getInstance(): LogoutManager {\n if (!LogoutManager.instance) {\n LogoutManager.instance = new LogoutManager();\n }\n return LogoutManager.instance;\n }\n\n private constructor() {}\n\n public init = async () => {\n if (!this.shouldStart()) {\n return;\n }\n\n const state = this.store.getState();\n const tokenLogin = tokenLoginSelector(state);\n\n const { isExpired: isNativeAuthTokenExpired } = getTokenExpiration(\n tokenLogin?.nativeAuthToken\n );\n\n if (isNativeAuthTokenExpired) {\n const provider = getAccountProvider();\n provider.logout();\n } else {\n this.addPlannedLogout();\n }\n };\n\n public stop = () => {\n clearTimeout(this.warningLogoutTimeoutRef ?? 0);\n clearTimeout(this.plannedLogoutTimeoutRef ?? 0);\n clearTimeout(this.actualLogoutTimeoutRef ?? 0);\n\n this.warningLogoutTimeoutRef = null;\n this.plannedLogoutTimeoutRef = null;\n this.actualLogoutTimeoutRef = null;\n this.plannedLogoutKey = null;\n };\n\n private readonly shouldStart = (): boolean => {\n const state = this.store.getState();\n const tokenLogin = tokenLoginSelector(state);\n const isLoggedIn = isLoggedInSelector(state);\n return Boolean(tokenLogin?.nativeAuthToken && isLoggedIn);\n };\n\n private addPlannedLogout = () => {\n const provider = getAccountProvider();\n const address = addressSelector(this.store.getState());\n const isWebviewLogin = provider.getType() === ProviderTypeEnum.webview;\n\n // prevent unexpected logout if webview login\n if (!address || isWebviewLogin) {\n return;\n }\n\n this.addLogoutWarning();\n\n const tokenLogin = tokenLoginSelector(this.store.getState());\n\n const { secondsUntilExpires, expiresAt } = getTokenExpiration(\n tokenLogin?.nativeAuthToken\n );\n\n // Handle the actual logout functionality.\n const secondsUntilExpiresBN = new BigNumber(String(secondsUntilExpires));\n const plannedLogoutKey = `${address}_${expiresAt}`;\n const plannedLogoutSet = this.plannedLogoutKey === plannedLogoutKey;\n\n const isValidInterval =\n secondsUntilExpires && secondsUntilExpiresBN.isGreaterThan(0);\n\n if (!isValidInterval || plannedLogoutSet) {\n return;\n }\n\n this.plannedLogoutKey = plannedLogoutKey;\n\n clearTimeout(this.plannedLogoutTimeoutRef ?? 0);\n const millisecondsUntilLogout = secondsUntilExpiresBN.times(1000);\n\n this.actualLogoutTimeoutRef = setTimeout(() => {\n ToastManager.getInstance().createCustomToast({\n toastId: 'native-auth-logout',\n iconClassName: 'warning',\n title: 'Logging out',\n icon: ToastIconsEnum.times,\n message: 'Your session has expired!'\n });\n this.actualLogoutTimeoutRef = null;\n }, millisecondsUntilLogout.toNumber() - 3000);\n\n this.plannedLogoutTimeoutRef = setTimeout(() => {\n provider.logout();\n this.plannedLogoutTimeoutRef = null;\n this.plannedLogoutKey = null;\n }, millisecondsUntilLogout.toNumber());\n };\n\n private readonly addLogoutWarning = () => {\n if (this.warningLogoutTimeoutRef) {\n return;\n }\n\n const nativeAuthConfig = nativeAuthConfigSelector(this.store.getState());\n const tokenLogin = tokenLoginSelector(this.store.getState());\n\n const { secondsUntilExpires } = getTokenExpiration(\n tokenLogin?.nativeAuthToken\n );\n\n const secondsUntilExpiresBN = new BigNumber(String(secondsUntilExpires));\n const millisecondsUntilLogout = secondsUntilExpiresBN.times(1000);\n\n if (\n !secondsUntilExpires ||\n secondsUntilExpiresBN.isLessThanOrEqualTo(0) ||\n !nativeAuthConfig?.tokenExpirationToastWarningSeconds\n ) {\n return;\n }\n\n const logoutWarningOffsetSeconds = new BigNumber(\n nativeAuthConfig?.tokenExpirationToastWarningSeconds ?? 0\n );\n\n const logoutWarningOffsetMilliseconds =\n logoutWarningOffsetSeconds.times(1000);\n\n const millisecondsUntilLogoutWarning = secondsUntilExpiresBN\n .times(1000)\n .minus(logoutWarningOffsetMilliseconds);\n\n const readableMinutesUntilLogout = getHumanReadableTokenExpirationTime(\n millisecondsUntilLogout.toNumber()\n );\n\n const timeoutUntilLogoutWarning =\n millisecondsUntilLogoutWarning.isLessThanOrEqualTo(0)\n ? 0\n : millisecondsUntilLogoutWarning.toNumber();\n\n clearTimeout(this.warningLogoutTimeoutRef ?? 0);\n\n this.warningLogoutTimeoutRef = setTimeout(() => {\n ToastManager.getInstance().createCustomToast({\n toastId: 'native-auth-expired',\n iconClassName: 'warning',\n title: 'Session Expiration Warning',\n icon: ToastIconsEnum.hourglass,\n message: `Your session will expire in ${readableMinutesUntilLogout}!`\n });\n this.warningLogoutTimeoutRef = null;\n }, timeoutUntilLogoutWarning);\n };\n}\n", "import { getTransactionsByHashes } from 'apiCalls/transactions/getTransactionsByHashes';\nimport { getIsLoggedIn } from 'methods/account/getIsLoggedIn';\nimport {\n updateTransactionStatus,\n updateSessionStatus\n} from 'store/actions/transactions/transactionsActions';\nimport { getIsTransactionFailed } from 'store/actions/transactions/transactionStateByStatus';\nimport { getStore } from 'store/store';\nimport {\n TransactionBatchStatusesEnum,\n TransactionServerStatusesEnum\n} from 'types/enums.types';\nimport {\n TrackedTransactionResultType,\n SignedTransactionType\n} from 'types/transactions.types';\n\nimport { refreshAccount } from 'utils';\nimport { getPendingTransactions } from './getPendingTransactions';\nimport { manageFailedTransactions } from './manageFailedTransactions';\nimport { runSessionCallbacks } from './runSessionCallbacks';\n\nexport interface TransactionStatusTrackerPropsType {\n sessionId: string;\n transactionBatch: SignedTransactionType[];\n isSequential?: boolean;\n}\n\ninterface RetriesType {\n [hash: string]: number;\n}\n\nconst retries: RetriesType = {};\n\ninterface ManageTransactionType {\n serverTransaction: TrackedTransactionResultType;\n sessionId: string;\n isSequential?: boolean;\n}\n\nasync function manageTransaction({\n serverTransaction: transaction,\n sessionId,\n isSequential\n}: ManageTransactionType) {\n const { hash, status, results, invalidTransaction, hasStatusChanged } =\n transaction;\n try {\n const retriesForThisHash = retries[hash];\n if (retriesForThisHash > 30) {\n // consider transaction as stuck after 1 minute\n updateSessionStatus({\n sessionId,\n status: TransactionBatchStatusesEnum.timedOut\n });\n\n await runSessionCallbacks({\n sessionId,\n status: TransactionBatchStatusesEnum.timedOut\n });\n\n return;\n }\n\n if (\n (invalidTransaction && !isSequential) ||\n status === TransactionBatchStatusesEnum.sent\n ) {\n retries[hash] = retries[hash] ? retries[hash] + 1 : 1;\n return;\n }\n\n // The tx is from a sequential batch.\n // If the transactions before this are not successful then it means that no other tx will be processed\n if (isSequential && !status) {\n const newStatus = updateTransactionStatus({\n sessionId,\n transaction\n });\n await runSessionCallbacks({\n sessionId,\n status: newStatus\n });\n return;\n }\n\n if (hasStatusChanged) {\n const newStatus = updateTransactionStatus({\n sessionId,\n transaction\n });\n\n await runSessionCallbacks({\n sessionId,\n status: newStatus\n });\n }\n\n if (getIsTransactionFailed(status)) {\n await manageFailedTransactions({ sessionId, hash, results });\n }\n } catch (error) {\n console.error(error);\n updateSessionStatus({\n sessionId,\n status: TransactionBatchStatusesEnum.timedOut\n });\n await runSessionCallbacks({\n sessionId,\n status: TransactionBatchStatusesEnum.timedOut\n });\n }\n}\n\nexport async function checkBatch({\n sessionId,\n transactionBatch: transactions,\n isSequential\n}: TransactionStatusTrackerPropsType) {\n try {\n if (transactions == null) {\n return;\n }\n\n const isLoggedIn = getIsLoggedIn();\n\n const pendingTransactions = getPendingTransactions(transactions);\n\n const serverTransactions =\n await getTransactionsByHashes(pendingTransactions);\n\n for (const serverTransaction of serverTransactions) {\n await manageTransaction({\n serverTransaction,\n sessionId,\n isSequential\n });\n }\n\n const hasCompleted = serverTransactions.every(\n (tx) => tx.status !== TransactionServerStatusesEnum.pending\n );\n\n if (!hasCompleted) {\n return;\n }\n\n if (isLoggedIn) {\n await refreshAccount();\n }\n\n // Call the onSuccess or onFail callback only if the transactions are sent normally (not using batch transactions mechanism).\n // The batch transactions mechanism will call the callbacks separately.\n\n const { transactions: sessions } = getStore().getState();\n const session = sessions[sessionId];\n\n const isSuccessful = session.transactions.every(\n (tx) => tx.status === TransactionServerStatusesEnum.success\n );\n\n if (isSuccessful) {\n return updateSessionStatus({\n sessionId,\n status: TransactionBatchStatusesEnum.success\n });\n }\n\n const isFailed = session.transactions.some(\n (tx) => tx.status === TransactionServerStatusesEnum.fail\n );\n\n if (isFailed) {\n return updateSessionStatus({\n sessionId,\n status: TransactionBatchStatusesEnum.fail\n });\n }\n\n const isInvalid = session.transactions.every(\n (tx) => tx.status === TransactionServerStatusesEnum.notExecuted\n );\n\n if (isInvalid) {\n return updateSessionStatus({\n sessionId,\n status: TransactionBatchStatusesEnum.invalid\n });\n }\n } catch (error) {\n console.error(error);\n }\n}\n", "import { pendingTransactionsSessionsSelector } from 'store/selectors/transactionsSelector';\nimport { getState } from 'store/store';\nimport { checkBatch } from './checkBatch';\n\nexport async function checkTransactionStatus() {\n const pendingSessions = pendingTransactionsSessionsSelector(getState());\n if (Object.keys(pendingSessions).length > 0) {\n for (const [sessionId, { transactions }] of Object.entries(\n pendingSessions\n )) {\n await checkBatch({\n sessionId,\n transactionBatch: transactions\n });\n }\n }\n}\n", "import { subscriptions } from 'constants/storage.constants';\nimport {\n WebsocketConnectionStatusEnum,\n websocketConnection\n} from 'constants/websocket.constants';\nimport { websocketEventSelector } from 'store/selectors/accountSelectors';\nimport { getStore } from 'store/store';\nimport { SubscriptionsEnum } from 'types/subscriptions.type';\nimport { checkTransactionStatus } from './helpers/checkTransactionStatus';\nimport { getPollingInterval } from './helpers/getPollingInterval';\n\n/**\n * Tracks transactions using websocket or polling\n * @returns stopTransactionsTracking function\n */\nexport async function trackTransactions() {\n const store = getStore();\n const pollingInterval = getPollingInterval();\n let pollingIntervalRef: ReturnType<typeof setTimeout> | null = null;\n let websocketStatusCheckIntervalRef: ReturnType<typeof setTimeout> | null =\n null;\n let timestamp = websocketEventSelector(store.getState())?.timestamp;\n\n const recheckStatus = () => {\n checkTransactionStatus();\n };\n\n const startPolling = () => {\n pollingIntervalRef ??= setInterval(recheckStatus, pollingInterval);\n };\n\n const stopPolling = () => {\n if (pollingIntervalRef) {\n clearInterval(pollingIntervalRef);\n pollingIntervalRef = null;\n }\n };\n\n const setupWebSocketTracking = () => {\n stopPolling();\n const unsubscribeWebsocketEvent = store.subscribe(\n ({ account: { websocketEvent } }) => {\n if (websocketEvent?.message && timestamp !== websocketEvent.timestamp) {\n timestamp = websocketEvent.timestamp;\n recheckStatus();\n }\n }\n );\n\n subscriptions.set(\n SubscriptionsEnum.websocketEventReceived,\n unsubscribeWebsocketEvent\n );\n };\n\n const startWatchingWebsocketStatus = () => {\n if (\n websocketConnection.status !==\n WebsocketConnectionStatusEnum.NOT_INITIALIZED ||\n websocketStatusCheckIntervalRef\n ) {\n return;\n }\n\n websocketStatusCheckIntervalRef = setInterval(() => {\n if (\n websocketConnection.status === WebsocketConnectionStatusEnum.COMPLETED\n ) {\n clearInterval(websocketStatusCheckIntervalRef!);\n websocketStatusCheckIntervalRef = null;\n setupWebSocketTracking();\n }\n }, 1000);\n };\n\n // Initial execution\n recheckStatus();\n\n const stopTransactionsTracking = () => {\n stopPolling();\n if (websocketStatusCheckIntervalRef) {\n clearInterval(websocketStatusCheckIntervalRef);\n websocketStatusCheckIntervalRef = null;\n }\n };\n\n const unsubscribeWebsocketStatus = store.subscribe(\n ({ account: { address }, config: { websocketStatus } }, prevState) => {\n const hasStatusChange =\n prevState.config.websocketStatus !== websocketStatus;\n\n if (!hasStatusChange) {\n return;\n }\n\n switch (websocketStatus) {\n case WebsocketConnectionStatusEnum.COMPLETED:\n setupWebSocketTracking();\n break;\n case WebsocketConnectionStatusEnum.PENDING:\n startPolling();\n startWatchingWebsocketStatus();\n break;\n default:\n address ? startPolling() : stopTransactionsTracking();\n break;\n }\n }\n );\n\n subscriptions.set(\n SubscriptionsEnum.websocketStatusChanged,\n unsubscribeWebsocketStatus\n );\n subscriptions.set(\n SubscriptionsEnum.websocketEventReceived,\n stopTransactionsTracking\n );\n return { stopTransactionsTracking };\n}\n", "import { getLatestNonce } from 'methods/account/getLatestNonce';\nimport { setGasStationMetadata } from 'methods/initApp/gastStationMetadata/setGasStationMetadata';\nimport { registerWebsocketListener } from 'methods/initApp/websocket/registerWebsocket';\nimport { trackTransactions } from 'methods/trackTransactions/trackTransactions';\nimport { IProvider } from 'providers/types/providerFactory.types';\nimport { loginAction } from 'store/actions';\nimport { setAccount } from 'store/actions/account';\nimport { AccountType } from 'types/account.types';\nimport { fetchAccount } from 'utils/account/fetchAccount';\nimport { trimUsernameDomain } from 'utils/account/trimUsernameDomain';\n\ninterface IAccountLoginProps {\n address: string;\n provider: IProvider;\n apiAddress: string;\n}\n\nexport async function accountLogin({\n address,\n provider,\n apiAddress\n}: IAccountLoginProps) {\n const account = await fetchAccount({\n address,\n baseURL: apiAddress\n });\n\n if (!account) {\n throw new Error('Account not found');\n }\n\n loginAction({\n address,\n providerType: provider.getType()\n });\n\n const newAccount: AccountType = {\n ...account,\n username: trimUsernameDomain(account.username),\n nonce: getLatestNonce(account)\n };\n\n setAccount(newAccount);\n\n await registerWebsocketListener(address);\n trackTransactions();\n\n if (account.shard != null) {\n await setGasStationMetadata({\n shard: Number(account.shard),\n apiAddress\n });\n }\n}\n", "import { registerWebsocketListener } from 'methods/initApp/websocket/registerWebsocket';\nimport { getNetworkConfig } from 'methods/network/getNetworkConfig';\nimport { trackTransactions } from 'methods/trackTransactions/trackTransactions';\nimport { IProvider } from 'providers/types/providerFactory.types';\nimport { nativeAuth } from 'services/nativeAuth';\nimport { decodeNativeAuthToken } from 'services/nativeAuth/helpers/decodeNativeAuthToken';\nimport { NativeAuthConfigType } from 'services/nativeAuth/nativeAuth.types';\nimport { setTokenLogin } from 'store/actions/loginInfo/loginInfoActions';\nimport { nativeAuthConfigSelector } from 'store/selectors';\nimport { getState } from 'store/store';\nimport { accountLogin } from './helpers/accountLogin';\nimport { extractAddressFromToken } from './helpers/extractAddressFromToken';\n\nasync function loginWithoutNativeToken(provider: IProvider) {\n const {\n network: { apiAddress }\n } = getNetworkConfig();\n\n await provider.login();\n\n const address = await provider.getAddress();\n\n if (!address) {\n throw new Error('Address not found');\n }\n\n await accountLogin({ address, provider, apiAddress });\n\n return {\n address\n };\n}\n\nasync function loginWithNativeToken({\n provider,\n nativeAuthConfig,\n token\n}: {\n provider: IProvider;\n nativeAuthConfig: NativeAuthConfigType;\n token?: string;\n}) {\n const {\n network: { apiAddress }\n } = getNetworkConfig();\n\n const nativeAuthClient = nativeAuth(nativeAuthConfig);\n let loginToken = token;\n\n if (!loginToken) {\n loginToken = await nativeAuthClient.initialize({\n noCache: true\n });\n }\n\n const { address, signature, ...loginResult } = await provider.login({\n token: loginToken\n });\n\n if (!address) {\n console.warn('Login cancelled.');\n return null;\n }\n\n if (!signature) {\n console.error('Failed to sign login token');\n return null;\n }\n\n // nativeAuthToken received from hub login\n const decodedToken = decodeNativeAuthToken(loginResult?.accessToken);\n\n const nativeAuthToken = decodedToken\n ? loginResult.accessToken\n : nativeAuthClient.getToken({\n address,\n token: loginToken,\n signature\n });\n\n setTokenLogin({\n loginToken,\n signature,\n nativeAuthToken\n });\n\n const extractedAddress = await extractAddressFromToken({\n loginToken,\n extraInfoData: {\n multisig: loginResult?.multisig,\n impersonate: loginResult?.impersonate\n },\n address\n });\n\n await accountLogin({\n address: extractedAddress,\n provider,\n apiAddress\n });\n\n return {\n address: extractedAddress,\n signature\n };\n}\n\nexport async function login(provider: IProvider, options?: { token?: string }) {\n const nativeAuthConfig = nativeAuthConfigSelector(getState());\n\n if (nativeAuthConfig) {\n const data = await loginWithNativeToken({\n provider,\n nativeAuthConfig,\n token: options?.token\n });\n return data;\n }\n\n const { address } = await loginWithoutNativeToken(provider);\n\n await registerWebsocketListener(address);\n trackTransactions();\n\n return { address, signature: '' };\n}\n", "import {\n CANCEL_TRANSACTION_TOAST_DEFAULT_DURATION,\n CANCEL_TRANSACTION_TOAST_ID,\n ERROR_SIGNING_TOAST_ID\n} from 'constants/transactions.constants';\nimport { ToastIconsEnum } from 'managers/internal/ToastManager/helpers/getToastDataStateByStatus';\nimport { createCustomToast } from 'store/actions';\nimport { SigningErrorsEnum, SigningWarningsEnum } from 'types/enums.types';\n\nconst states = {\n error: {\n title: SigningErrorsEnum.errorSigning.toString(),\n iconClassName: 'danger',\n toastId: `${ERROR_SIGNING_TOAST_ID}-${Date.now()}`\n },\n warning: {\n title: SigningWarningsEnum.cancelled.toString(),\n iconClassName: 'warning',\n toastId: `${CANCEL_TRANSACTION_TOAST_ID}-${Date.now()}`\n }\n};\n\nconst errorsMap = {\n extensionResponse: 'Unable to sign transactions', // extension\n 'Transaction canceled': 'Transaction canceled', // web wallet\n 'cancelled by user': 'Transaction signing cancelled by user', // custom\n 'denied by the user': 'Transaction signing denied by the user' // ledger\n};\n\nconst getUserError = (error: string) => {\n for (const [key, value] of Object.entries(errorsMap)) {\n if (error.includes(key)) {\n return value;\n }\n }\n return SigningErrorsEnum.errorSigning;\n};\n\nexport function handleSignError(\n error: unknown,\n type: 'error' | 'warning' = 'error'\n) {\n const originalError = (error as Error)?.message;\n const errorMessage = getUserError(originalError);\n\n const isKnownError = errorMessage !== SigningErrorsEnum.errorSigning;\n\n const errorType = isKnownError ? 'warning' : type;\n\n const state = Object.keys(states).includes(errorType)\n ? states[errorType]\n : states.error;\n\n const { toastId, iconClassName, title } = state;\n\n createCustomToast({\n toastId,\n duration: CANCEL_TRANSACTION_TOAST_DEFAULT_DURATION,\n icon: ToastIconsEnum.times,\n iconClassName,\n message: errorMessage,\n title\n });\n\n return errorMessage;\n}\n", "import {\n Address,\n Transaction,\n TransactionOptions,\n TransactionVersion\n} from 'lib/sdkCore';\nimport { getAccount } from 'methods/account/getAccount';\nimport {\n IProvider,\n ProviderTypeEnum\n} from 'providers/types/providerFactory.types';\nimport { setAccountNonce } from 'store/actions';\nimport { refreshAccount } from 'utils';\nimport { computeNonces } from '../computeNonces/computeNonces';\n\nexport type SignTransactionsOptionsType = {\n skipGuardian?: boolean;\n};\n\ntype SignTransactionsType = {\n provider: IProvider;\n transactions: Transaction[];\n options?: SignTransactionsOptionsType;\n};\n\nexport async function signTransactionsWithProvider({\n provider,\n transactions,\n options = {}\n}: SignTransactionsType): Promise<Transaction[]> {\n await refreshAccount();\n const { isGuarded, activeGuardianAddress, nonce } = getAccount();\n const isLedger = provider.getType() === ProviderTypeEnum.ledger;\n\n const transactionsWithComputedNonce = computeNonces({\n latestNonce: nonce,\n transactions\n });\n\n const transactionsToSign =\n activeGuardianAddress && isGuarded && !options.skipGuardian\n ? transactionsWithComputedNonce?.map((transaction) => {\n transaction.version = TransactionVersion.withTxOptions().valueOf();\n transaction.options = TransactionOptions.withOptions({\n guarded: true,\n ...(isLedger ? { hashSign: true } : {})\n }).valueOf();\n\n transaction.guardian = Address.newFromBech32(activeGuardianAddress);\n\n return transaction;\n })\n : transactionsWithComputedNonce;\n\n const signedTransactions: Transaction[] =\n (await provider.signTransactions(transactionsToSign)) ?? [];\n\n setAccountNonce(nonce + signedTransactions.length);\n\n return signedTransactions;\n}\n", "import { Message, Transaction } from 'lib/sdkCore';\nimport { LogoutManager } from 'managers/LogoutManager/LogoutManager';\nimport { setAccountProvider } from 'providers/helpers/accountProvider';\nimport { setProviderType } from 'store/actions/loginInfo/loginInfoActions';\nimport { IProvider } from '../types/providerFactory.types';\nimport { login } from './helpers/login/login';\nimport { logout } from './helpers/logout/logout';\nimport { handleSignError } from './helpers/signErrors/handleSignError';\nimport { signMessageWithProvider } from './helpers/signMessage/signMessageWithProvider';\nimport {\n verifyMessage,\n VerifyMessageReturnType\n} from './helpers/signMessage/verifyMessage';\nimport {\n signTransactionsWithProvider,\n SignTransactionsOptionsType\n} from './helpers/signTransactions/signTransactionsWithProvider';\n\nexport class DappProvider {\n private provider: IProvider;\n private _isLoggingOut = false;\n\n constructor(provider: IProvider) {\n this.provider = provider;\n }\n\n init(): Promise<boolean> {\n return this.provider.init();\n }\n\n async login(options?: { token?: string }) {\n const data = await login(this.provider, options);\n setProviderType(this.provider.getType());\n setAccountProvider(this);\n LogoutManager.getInstance().init();\n return data;\n }\n\n isInitialized(): boolean {\n return this.provider.isInitialized();\n }\n\n async logout(\n options = {\n shouldBroadcastLogoutAcrossTabs: true\n }\n ): Promise<boolean> {\n if (this._isLoggingOut) {\n console.warn('Logout already in progress');\n return false;\n }\n\n this._isLoggingOut = true;\n\n const isLoggedOut = await logout({ provider: this.provider, options });\n\n this._isLoggingOut = false;\n\n return isLoggedOut;\n }\n\n getType() {\n return this.provider.getType();\n }\n\n /**\n * @returns The original provider instance.\n */\n getProvider() {\n return this.provider;\n }\n\n async signTransactions(\n transactions: Transaction[],\n options?: SignTransactionsOptionsType\n ): Promise<Transaction[]> {\n try {\n const signedTransactions = await signTransactionsWithProvider({\n provider: this.provider,\n transactions,\n options\n });\n return signedTransactions;\n } catch (error) {\n const errorMessage = handleSignError(error);\n throw new Error(errorMessage);\n }\n }\n\n async signMessage(\n message: Message,\n options?: {\n hasConsentPopup?: boolean;\n }\n ): Promise<Message | null> {\n try {\n const signedMessage = await signMessageWithProvider({\n provider: this.provider,\n message,\n options\n });\n return signedMessage;\n } catch (error) {\n const errorMessage = handleSignError(error, 'warning');\n throw new Error(errorMessage);\n }\n }\n\n /**\n * @param signedMessage - The signed message to verify in form of a JSON string with `address`, `message` and `signature` properties.\n * @returns The verification result with `isVerified`, `message` and `address` properties.\n */\n async verifyMessage(signedMessage: string): Promise<VerifyMessageReturnType> {\n return await verifyMessage(signedMessage);\n }\n\n cancelLogin(): void {\n this.provider.cancelLogin?.();\n }\n}\n", "import { IProvider } from 'providers/types/providerFactory.types';\nimport { DappProvider } from '../DappProvider';\nimport { emptyProvider } from './emptyProvider';\n\nexport type ProvidersType = IProvider;\n\nlet accountProvider: DappProvider | null = null;\n\nexport function setAccountProvider<TProvider extends DappProvider | null>(\n provider: TProvider\n) {\n accountProvider = provider;\n}\n\nexport function getAccountProvider(): DappProvider {\n return accountProvider || new DappProvider(emptyProvider);\n}\n", "import { getAddress } from 'methods/account/getAddress';\nimport { getLatestNonce } from 'methods/account/getLatestNonce';\nimport { getNetworkConfig } from 'methods/network/getNetworkConfig';\nimport { getAccountProvider } from 'providers/helpers/accountProvider';\nimport { setAccount } from 'store/actions';\nimport { fetchAccount } from './fetchAccount';\nimport { trimUsernameDomain } from './trimUsernameDomain';\n\nconst setNewAccount = async () => {\n try {\n const address = getAddress();\n const { network } = getNetworkConfig();\n\n try {\n const account = await fetchAccount({\n address,\n baseURL: network.apiAddress\n });\n\n if (account != null) {\n const accountData = {\n ...account,\n username: trimUsernameDomain(account.username),\n nonce: getLatestNonce(account)\n };\n\n setAccount(accountData);\n\n return accountData;\n }\n } catch (e) {\n console.error('Failed getting account ', e);\n }\n } catch (e) {\n console.error('Failed getting address ', e);\n }\n\n return null;\n};\n\nexport async function refreshAccount() {\n const provider = getAccountProvider();\n\n if (provider == null) {\n throw 'Provider not initialized';\n }\n\n try {\n if (!provider.init) {\n throw 'Current provider does not have init() function';\n }\n\n const initialized = await provider.init();\n\n if (!initialized) {\n return;\n }\n\n const account = await setNewAccount();\n\n return account;\n } catch (e) {\n console.error('Failed initializing provider ', e);\n }\n\n return undefined;\n}\n", "import {\n CustomToastType,\n IComponentToast\n} from 'store/slices/toast/toastSlice.types';\nimport { getStore } from 'store/store';\nimport { getUnixTimestamp, getUnixTimestampWithAddedMilliseconds } from 'utils';\n\nexport const customToastComponentDictionary: Record<\n string,\n IComponentToast['instantiateToastElement']\n> = {};\nexport const customToastCloseHandlersDictionary: Record<string, () => void> =\n {};\n\nexport const addCustomToast = (\n customToast: CustomToastType,\n currentToastId?: string\n) => {\n getStore().setState(\n ({ toasts: state }) => {\n const lastToastIndex =\n state.customToasts.length > 0\n ? Math.max(\n ...state.customToasts.map((toast) =>\n parseInt(toast.toastId.split('-').pop() ?? '0')\n )\n )\n : 0;\n const toastId = currentToastId ?? `custom-toast-${lastToastIndex + 1}`;\n\n const existingToastIndex = state.customToasts.findIndex(\n (toast) => toast.toastId === toastId\n );\n\n const newToast: CustomToastType = {\n ...customToast,\n toastId\n };\n\n const isToastFound = existingToastIndex !== -1;\n\n if (isToastFound) {\n state.customToasts[existingToastIndex] = newToast;\n return;\n }\n\n state.customToasts.push({\n ...newToast,\n toastId\n });\n },\n false,\n 'addCustomToast'\n );\n};\n\nexport const removeCustomToast = (toastId: string) => {\n getStore().setState(\n ({ toasts: state }) => {\n state.customToasts = state.customToasts.filter(\n (toast) => toast.toastId !== toastId\n );\n },\n false,\n 'removeCustomToast'\n );\n};\n\nexport const removeAllCustomToasts = () => {\n getStore().setState(\n ({ toasts: state }) => {\n state.customToasts = [];\n },\n false,\n 'removeAllCustomToasts'\n );\n};\n\nexport const removeAllTransactionToasts = () => {\n getStore().setState(({ toasts: state }) => {\n state.transactionToasts = [];\n });\n};\n\nexport const addTransactionToast = ({\n toastId,\n totalDuration\n}: {\n toastId: string;\n totalDuration: number;\n}): string => {\n let newToastId: string = '';\n getStore().setState(\n ({ toasts: state }) => {\n const lastToastIndex =\n state.transactionToasts.length > 0\n ? Math.max(\n ...state.transactionToasts.map((toast) =>\n parseInt(toast.toastId.split('-').pop() ?? '0')\n )\n )\n : 0;\n newToastId = toastId ?? `transaction-toast-${lastToastIndex + 1}`;\n\n state.transactionToasts.push({\n startTime: getUnixTimestamp(),\n endTime: getUnixTimestampWithAddedMilliseconds(totalDuration),\n toastId: newToastId\n });\n },\n false,\n 'addTransactionToast'\n );\n\n return newToastId;\n};\n\nexport const removeTransactionToast = (toastId: string) => {\n getStore().setState(\n ({ toasts: state }) => {\n state.transactionToasts = state.transactionToasts.filter((toast) => {\n return toast.toastId !== toastId;\n });\n },\n false,\n 'removeTransactionToast'\n );\n\n delete customToastCloseHandlersDictionary[toastId];\n delete customToastComponentDictionary[toastId];\n};\n\nexport const createCustomToast = (props: CustomToastType) => {\n const { toasts } = getStore().getState();\n\n const lastToastIndex =\n toasts.customToasts.length > 0\n ? Math.max(\n ...toasts.customToasts.map((toast) =>\n parseInt(toast.toastId.split('-').pop() ?? '0')\n )\n )\n : 0;\n\n const toastId = props.toastId || `custom-toast-${lastToastIndex + 1}`;\n\n if (props.onClose) {\n customToastCloseHandlersDictionary[toastId] = props.onClose;\n }\n\n if (props.instantiateToastElement) {\n customToastComponentDictionary[toastId] = props.instantiateToastElement;\n\n getStore().setState(\n ({ toasts: state }) => {\n const existingToastIndex = state.customToasts.findIndex(\n (toast) => toast.toastId === toastId\n );\n\n const toast: CustomToastType = {\n ...props,\n instantiateToastElement: null,\n toastId\n };\n\n const isToastFound = existingToastIndex !== -1;\n\n if (isToastFound) {\n state.customToasts[existingToastIndex] = toast;\n } else {\n state.customToasts.push(toast);\n }\n },\n false,\n 'createCustomToast'\n );\n\n return toastId;\n }\n\n addCustomToast(props, toastId);\n return toastId;\n};\n", "import {\n customToastCloseHandlersDictionary,\n removeCustomToast,\n removeTransactionToast\n} from 'store/actions/toasts/toastsActions';\n\ninterface IToastProgressManagerParams {\n successfulToastLifetime?: number;\n}\n\nconst DEFAULT_SUCCESSFUL_TOAST_LIFETIME = 10_000;\n\nexport class LifetimeManager {\n private timeoutIntervals: Map<string, ReturnType<typeof setTimeout>> =\n new Map();\n private successfulToastLifetime: number = DEFAULT_SUCCESSFUL_TOAST_LIFETIME;\n\n constructor() {}\n\n public init({ successfulToastLifetime }: IToastProgressManagerParams) {\n this.successfulToastLifetime =\n successfulToastLifetime || DEFAULT_SUCCESSFUL_TOAST_LIFETIME;\n }\n\n public start = (toastId: string) => {\n this.stop(toastId);\n\n if (this.successfulToastLifetime <= 0) {\n return;\n }\n\n const timeout = setTimeout(() => {\n removeTransactionToast(toastId);\n }, this.successfulToastLifetime);\n\n this.timeoutIntervals.set(toastId, timeout);\n };\n\n public startWithCustomDuration = (toastId: string, duration: number) => {\n this.stop(toastId);\n\n if (duration <= 0) {\n return;\n }\n\n const timeout = setTimeout(() => {\n removeCustomToast(toastId);\n const handleClose = customToastCloseHandlersDictionary[toastId];\n handleClose?.();\n }, duration);\n\n this.timeoutIntervals.set(toastId, timeout);\n };\n\n public stop = (toastId: string) => {\n const timeout = this.timeoutIntervals.get(toastId);\n if (timeout) {\n clearTimeout(timeout);\n this.timeoutIntervals.delete(toastId);\n }\n };\n\n public destroy() {\n this.timeoutIntervals.forEach((interval) => clearTimeout(interval));\n this.timeoutIntervals.clear();\n }\n}\n"],
|
|
5
|
+
"mappings": "s5DAAA,OAAOA,MAAa,iBCApB,OAAOC,OAAa,iBAiBpB,IAAMC,GAAqC,qCAE9BC,EAAN,MAAMC,UAAiCC,EAI5C,CAgBA,aAAc,CACZ,MAAM,CACJ,4CACA,8BACF,CAAC,EAlBH,KAAiB,MAAQC,EAAS,EAElC,KAAU,YAA6C,CACrD,oBAAqB,CAAC,EACtB,qBAAsB,CAAC,CACzB,EAcE,KAAK,KAAO,CAAE,GAAG,KAAK,WAAY,CACpC,CAbA,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UAAU,sCAEb,KAAK,4BAA4B,KAAK,IAAI,CAC5C,CACF,CAAC,EACH,CAEA,MAAa,YAAa,CACxB,KAAK,UAAU,0BAA8B,IAAI,EAEjD,MAAM,KAAK,sBAAsB,EACjC,MAAM,KAAK,4BAA4B,CACzC,CAEO,YAAa,CAClB,KAAK,UAAU,0BAA8B,IAAI,CACnD,CAEA,MAAc,6BAA8B,CAC1C,KAAK,yBAAyB,sBAAsB,CACtD,CAEO,WAAW1B,EAAiB,CAKjC,GAJoB,KAAK,aAAa,KACnCa,GAAUA,EAAM,UAAYb,CAC/B,EAEiB,CACf,KAAK,gBAAgB,KAAKA,CAAO,EACjC,IAAM2B,EAAcC,EAAmC5B,CAAO,EAC9D2B,IAAc,EACdE,EAAkB7B,CAAO,EACzB,MACF,CAEA,KAAK,4BAA4BA,CAAO,CAC1C,CAEA,MAAc,0BAA2B,CACvC,GACE,KAAK,yBAAyB,wBAAwB,GACtD,KAAK,SACL,CACA,KAAK,SAAS,wCAEZ,KAAK,iBACP,EAEA,KAAK,WAAW,EAChB,MACF,CAEA,GAAI,CAAC,KAAK,SAAU,CAClB,IAAM0B,EAAgB,MAAM,KAAK,uBAAuB,EAExD,GAAI,CAACA,EACH,OAGF,KAAK,SAAW,MAAMA,EAAc,YAAY,CAClD,CAEA,KAAK,SAAS,wCAEZ,KAAK,iBACP,CACF,CAEO,SAAU,CACf,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,QAAQ,EAC9B,KAAK,0BAA0B,QAAQ,EACvCI,GAAsB,EACtB,KAAK,6BAA6B,QAASC,GAAgBA,EAAY,CAAC,EACxE,KAAK,6BAA+B,CAAC,CACvC,CACF",
|
|
6
|
+
"names": ["isEqual", "isEqual", "NOTIFICATIONS_FEED_STORE_SUBSCRIBE", "NotificationsFeedManager", "_NotificationsFeedManager", "SidePanelBaseManager", "getStore", "ToastManager", "storeToastsUnsubscribe", "toasts", "transactions", "prevToasts", "prevTransactions", "isEqual", "toastManager", "account", "network", "pendingTransactionToasts", "createToastsFromTransactions", "TransactionsHistoryController", "clearCompletedTransactions", "BigNumber", "LogoutManager", "_LogoutManager", "getStore", "state", "tokenLogin", "tokenLoginSelector", "isNativeAuthTokenExpired", "getTokenExpiration", "getAccountProvider", "isLoggedIn", "isLoggedInSelector", "provider", "address", "addressSelector", "isWebviewLogin", "ProviderTypeEnum", "secondsUntilExpires", "expiresAt", "secondsUntilExpiresBN", "BigNumber", "plannedLogoutKey", "plannedLogoutSet", "millisecondsUntilLogout", "ToastManager", "nativeAuthConfig", "nativeAuthConfigSelector", "logoutWarningOffsetMilliseconds", "millisecondsUntilLogoutWarning", "readableMinutesUntilLogout", "getHumanReadableTokenExpirationTime", "timeoutUntilLogoutWarning", "retries", "manageTransaction", "transaction", "sessionId", "isSequential", "hash", "status", "results", "invalidTransaction", "hasStatusChanged", "updateSessionStatus", "runSessionCallbacks", "newStatus", "updateTransactionStatus", "getIsTransactionFailed", "manageFailedTransactions", "error", "checkBatch", "transactions", "isLoggedIn", "getIsLoggedIn", "pendingTransactions", "getPendingTransactions", "serverTransactions", "getTransactionsByHashes", "serverTransaction", "tx", "refreshAccount", "sessions", "getStore", "session", "checkTransactionStatus", "pendingSessions", "pendingTransactionsSessionsSelector", "getState", "sessionId", "transactions", "checkBatch", "trackTransactions", "store", "getStore", "pollingInterval", "getPollingInterval", "pollingIntervalRef", "websocketStatusCheckIntervalRef", "timestamp", "websocketEventSelector", "recheckStatus", "checkTransactionStatus", "startPolling", "stopPolling", "setupWebSocketTracking", "unsubscribeWebsocketEvent", "websocketEvent", "subscriptions", "startWatchingWebsocketStatus", "websocketConnection", "stopTransactionsTracking", "unsubscribeWebsocketStatus", "address", "websocketStatus", "prevState", "accountLogin", "address", "provider", "apiAddress", "account", "fetchAccount", "loginAction", "newAccount", "trimUsernameDomain", "getLatestNonce", "setAccount", "registerWebsocketListener", "trackTransactions", "setGasStationMetadata", "loginWithoutNativeToken", "provider", "apiAddress", "getNetworkConfig", "address", "accountLogin", "loginWithNativeToken", "nativeAuthConfig", "token", "nativeAuthClient", "nativeAuth", "loginToken", "signature", "loginResult", "nativeAuthToken", "decodeNativeAuthToken", "setTokenLogin", "extractedAddress", "extractAddressFromToken", "login", "options", "nativeAuthConfigSelector", "getState", "registerWebsocketListener", "trackTransactions", "states", "ERROR_SIGNING_TOAST_ID", "CANCEL_TRANSACTION_TOAST_ID", "errorsMap", "getUserError", "error", "key", "value", "handleSignError", "type", "originalError", "errorMessage", "errorType", "state", "toastId", "iconClassName", "title", "createCustomToast", "signTransactionsWithProvider", "provider", "transactions", "options", "refreshAccount", "isGuarded", "activeGuardianAddress", "nonce", "getAccount", "isLedger", "ProviderTypeEnum", "transactionsWithComputedNonce", "computeNonces", "transactionsToSign", "transaction", "TransactionVersion", "TransactionOptions", "Address", "signedTransactions", "setAccountNonce", "DappProvider", "provider", "options", "data", "login", "setProviderType", "setAccountProvider", "LogoutManager", "isLoggedOut", "logout", "transactions", "signTransactionsWithProvider", "error", "errorMessage", "handleSignError", "message", "signMessageWithProvider", "signedMessage", "verifyMessage", "accountProvider", "setAccountProvider", "provider", "getAccountProvider", "DappProvider", "emptyProvider", "setNewAccount", "address", "getAddress", "network", "getNetworkConfig", "account", "fetchAccount", "accountData", "trimUsernameDomain", "getLatestNonce", "setAccount", "e", "refreshAccount", "provider", "getAccountProvider", "customToastComponentDictionary", "customToastCloseHandlersDictionary", "addCustomToast", "customToast", "currentToastId", "getStore", "state", "lastToastIndex", "toast", "toastId", "existingToastIndex", "newToast", "removeCustomToast", "removeAllCustomToasts", "removeAllTransactionToasts", "addTransactionToast", "totalDuration", "newToastId", "getUnixTimestamp", "getUnixTimestampWithAddedMilliseconds", "removeTransactionToast", "createCustomToast", "props", "toasts", "DEFAULT_SUCCESSFUL_TOAST_LIFETIME", "LifetimeManager", "toastId", "timeout", "removeTransactionToast", "duration", "removeCustomToast", "handleClose", "customToastCloseHandlersDictionary", "successfulToastLifetime", "interval", "ToastManager", "_ToastManager", "getStore", "LifetimeManager", "NotificationsFeedManager", "successfulToastLifetime", "toasts", "transactions", "prevToasts", "prevTransactions", "newToastsWereCreated", "isEqual", "checkBatchHasNewData", "toastId", "transaction", "status", "isTimedOut", "getIsTransactionTimedOut", "isFailed", "getIsTransactionFailed", "isSuccessful", "getIsTransactionSuccessful", "isCompleted", "totalDuration", "newToastId", "addTransactionToast", "toast", "createCustomToast", "props", "toastList", "transactionsSessions", "account", "pendingTransactionToasts", "completedTransactionToasts", "createToastsFromTransactions", "newToast", "customToastComponentDictionary", "ComponentFactory", "removeTransactionToast", "toastsElement", "handleClose", "customToastCloseHandlersDictionary", "removeCustomToast", "removeAllCustomToasts", "unsubscribe"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as h}from"./chunk-4PIR4ESS.mjs";import{a as s}from"./chunk-IYYCFUH4.mjs";import{a as k}from"./chunk-B2RDSGON.mjs";import{a as L}from"./chunk-URXO7GNH.mjs";import{b as A}from"./chunk-ZVDPYIMB.mjs";import{a as I}from"./chunk-BRJNX4JF.mjs";import{f as p}from"./chunk-MSFYVSIA.mjs";import{a as f}from"./chunk-KD2IQ32V.mjs";import{a as x}from"./chunk-LJX4MW7B.mjs";import{BigNumber as C}from"bignumber.js";async function M({options:d,config:i,provider:a,login:c}){let e=h.getInstance(),T=L(),b=k({loginToken:d?.token,version:i.version}),o={manager:e,provider:a};await s(o);let t=await new Promise(async function(E,w){async function g(r){let n=e?e.addressesPerPage??1:1,l=new C(r-1).times(n);e?.updateStartIndex(Math.max(0,parseInt(l.toString()))),await s(o)}async function u(r){if(!(!a||!c)){e?.updateConfirmScreen({...b,selectedAddress:r.selectedAddress,explorerLink:I({to:`/${f}/${r.selectedAddress}`,explorerAddress:T})});try{let n=d?.token?await a.tokenLogin({token:Buffer.from(`${d?.token}{}`),addressIndex:r.addressIndex}):await c({addressIndex:r.addressIndex});E({address:n.address,signature:n.signature?n.signature.toString("hex"):"",addressIndex:r.addressIndex})}catch(n){console.error("User rejected login:",n),!!e?.getConfirmScreenData()&&await s(o)}}}async function m(){await s(o),e.unsubscribeFromAuthEvents({handleCancel:m,handleAccessWallet:u,handleGoToPage:g}),w("User cancelled login")}e.subscribeToAuthEvents({handleCancel:m,handleAccessWallet:u,handleGoToPage:g})}),{version:P,dataEnabled:v}=i;return p({index:t.addressIndex,loginType:x.ledger}),A({address:t.address,index:t.addressIndex,version:P,hasContractDataEnabled:v}),{address:t.address,signature:t.signature}}export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-YMBVUA56.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{q as c}from"./chunk-MSFYVSIA.mjs";import{a as o}from"./chunk-JMC7CMTU.mjs";var r=e=>{c().setState(({account:t})=>{let s=t.address===e.address;t.accounts={[t.address]:s?e:o}},!1,"setAccount")},u=e=>c().setState(({account:t})=>{t.ledgerAccount=e},!1,"setLedgerAccount"),p=e=>c().setState(({account:t})=>{t.walletConnectAccount=e},!1,"setWalletConnectAccount"),l=e=>c().setState(({account:t})=>{t.websocketEvent={timestamp:Date.now(),message:e}},!1,"setWebsocketEvent"),m=e=>c().setState(({account:t})=>{t.websocketBatchEvent={timestamp:Date.now(),data:e}},!1,"setWebsocketBatchEvent"),A=e=>{c().setState(({account:t})=>{t.accounts[t.address].nonce=e},!1,"setAccountNonce")};export{r as a,u as b,p as c,l as d,m as e,A as f};
|
|
2
|
+
//# sourceMappingURL=chunk-ZVDPYIMB.mjs.map
|