@multiversx/sdk-dapp 5.3.0-alpha.1 → 5.3.0-alpha.3
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-ZJM5FGLA.mjs → chunk-2D4GMO36.mjs} +2 -2
- package/out/__chunks__/{chunk-2WAT3RZ3.mjs → chunk-2I2KSLE2.mjs} +2 -2
- package/out/__chunks__/{chunk-JHYKMKMK.mjs → chunk-2YOQ53JR.mjs} +2 -2
- package/out/__chunks__/{chunk-KZUPCFEG.mjs → chunk-3OVUAVDG.mjs} +2 -2
- package/out/__chunks__/{chunk-T3RXRYP5.mjs → chunk-3TS5K6ZA.mjs} +2 -2
- package/out/__chunks__/{chunk-NO4FZ4M3.mjs → chunk-4QRIFJFV.mjs} +2 -2
- package/out/__chunks__/{chunk-HBZ2RP7A.mjs → chunk-4WAWOE33.mjs} +2 -2
- package/out/__chunks__/{chunk-JKFZERMM.mjs → chunk-6RJVQ4UE.mjs} +2 -2
- package/out/__chunks__/{chunk-ETH6P454.mjs → chunk-6T23W57Y.mjs} +2 -2
- package/out/__chunks__/{chunk-QMFEYMZI.mjs → chunk-6T2LXDEP.mjs} +2 -2
- package/out/__chunks__/{chunk-I2CW2O7M.mjs → chunk-6ZHJDJ2I.mjs} +2 -2
- package/out/__chunks__/chunk-7FTEFM3G.mjs +2 -0
- package/out/__chunks__/chunk-7GBXWZAI.mjs +2 -0
- package/out/__chunks__/{chunk-32DICVUK.mjs → chunk-7S2Y4LHL.mjs} +2 -2
- package/out/__chunks__/{chunk-GWXW3E7L.mjs → chunk-7WYMH2Y5.mjs} +2 -2
- package/out/__chunks__/{chunk-5WR632LR.mjs → chunk-A6QJ4XG2.mjs} +2 -2
- package/out/__chunks__/{chunk-UF2Y4P6U.mjs → chunk-B4HHDEQD.mjs} +2 -2
- package/out/__chunks__/chunk-BDAUGWZM.mjs +2 -0
- package/out/__chunks__/{chunk-2ZW4LVVR.mjs → chunk-BWBZHZCG.mjs} +2 -2
- package/out/__chunks__/{chunk-UUPS4KLW.mjs → chunk-D6T322RK.mjs} +2 -2
- package/out/__chunks__/chunk-DXXG5TSN.mjs +2 -0
- package/out/__chunks__/{chunk-YYVGE2ZU.mjs → chunk-EB4P7XML.mjs} +2 -2
- package/out/__chunks__/{chunk-GPUXJWA3.mjs → chunk-EEFPWMB3.mjs} +2 -2
- package/out/__chunks__/{chunk-TKIYJDS2.mjs → chunk-EETEYJ2T.mjs} +2 -2
- package/out/__chunks__/{chunk-FFGJMR4Q.mjs → chunk-EPFU7G25.mjs} +2 -2
- package/out/__chunks__/{chunk-PCGP4VVW.mjs → chunk-FLIHXJC6.mjs} +2 -2
- package/out/__chunks__/{chunk-ALT4OKHK.mjs → chunk-FPOYB42M.mjs} +2 -2
- package/out/__chunks__/{chunk-OI2AXS22.mjs → chunk-FREDJUGU.mjs} +2 -2
- package/out/__chunks__/{chunk-ZM77AGP5.mjs → chunk-GJXPULYJ.mjs} +2 -2
- package/out/__chunks__/{chunk-AN4TQZVZ.mjs → chunk-GX6HPAJJ.mjs} +2 -2
- package/out/__chunks__/{chunk-6VPMVY56.mjs → chunk-H4DVQ62L.mjs} +2 -2
- package/out/__chunks__/chunk-HFGQW4ZK.mjs +2 -0
- package/out/__chunks__/chunk-HT2FAOH3.mjs +2 -0
- package/out/__chunks__/{chunk-4ZAZCOJD.mjs → chunk-IDEBZCHN.mjs} +2 -2
- package/out/__chunks__/{chunk-5KY3OIFD.mjs → chunk-IW4DEEHC.mjs} +2 -2
- package/out/__chunks__/chunk-IXXPFRFP.mjs +2 -0
- package/out/__chunks__/{chunk-BC5MT6WS.mjs → chunk-J6JGLSU3.mjs} +2 -2
- package/out/__chunks__/{chunk-J6MUGECP.mjs → chunk-JAWHG5QV.mjs} +2 -2
- package/out/__chunks__/chunk-JMFGVLF2.mjs +2 -0
- package/out/__chunks__/{chunk-B5YOJH7H.mjs → chunk-JNHXLQ7M.mjs} +2 -2
- package/out/__chunks__/{chunk-H7YY4BCM.mjs → chunk-JQD5FQP7.mjs} +2 -2
- package/out/__chunks__/{chunk-KTQD4DTE.mjs → chunk-K57S4IEN.mjs} +2 -2
- package/out/__chunks__/{chunk-ALBBGYHS.mjs → chunk-KXCUN2CA.mjs} +2 -2
- package/out/__chunks__/{chunk-V322LMVG.mjs → chunk-L7LGSTVP.mjs} +2 -2
- package/out/__chunks__/chunk-LFOBVMPR.mjs +2 -0
- package/out/__chunks__/chunk-LHQEWFDT.mjs +2 -0
- package/out/__chunks__/chunk-LHQEWFDT.mjs.map +7 -0
- package/out/__chunks__/{chunk-IXO75QXR.mjs → chunk-LOCBYCTW.mjs} +2 -2
- package/out/__chunks__/{chunk-AGBY3WIQ.mjs → chunk-LSFKZEDF.mjs} +2 -2
- package/out/__chunks__/{chunk-ZAY5O7DE.mjs → chunk-LV3TNCL7.mjs} +2 -2
- package/out/__chunks__/{chunk-2UPWFRCA.mjs → chunk-MB3UAUH4.mjs} +2 -2
- package/out/__chunks__/chunk-MQIVKPYU.mjs +2 -0
- package/out/__chunks__/chunk-MQIVKPYU.mjs.map +7 -0
- package/out/__chunks__/{chunk-GJ64B4SS.mjs → chunk-NFJTM7EU.mjs} +2 -2
- package/out/__chunks__/{chunk-643FDBLR.mjs → chunk-NKW3DRZI.mjs} +2 -2
- package/out/__chunks__/{chunk-AVEMKF6Z.mjs → chunk-NNNII7QZ.mjs} +2 -2
- package/out/__chunks__/chunk-NQNTF6QC.mjs +2 -0
- package/out/__chunks__/chunk-NU34PSWD.mjs +2 -0
- package/out/__chunks__/{chunk-VY62CH5W.mjs → chunk-OEH2DV7C.mjs} +2 -2
- package/out/__chunks__/{chunk-RXE5QIE3.mjs → chunk-OLQHWVIS.mjs} +2 -2
- package/out/__chunks__/{chunk-VDAYN2HT.mjs → chunk-PKSNXCV4.mjs} +2 -2
- package/out/__chunks__/chunk-PNOKA67W.mjs +2 -0
- package/out/__chunks__/{chunk-O462QL7Q.mjs → chunk-PWCNMKNB.mjs} +2 -2
- package/out/__chunks__/{chunk-GDMANS7S.mjs → chunk-QJI3WAKY.mjs} +2 -2
- package/out/__chunks__/{chunk-V3GRSQIB.mjs → chunk-RJRYSDHS.mjs} +2 -2
- package/out/__chunks__/{chunk-PUCCTEN7.mjs → chunk-SQMHTV2T.mjs} +2 -2
- package/out/__chunks__/chunk-SXOH2YD4.mjs +2 -0
- package/out/__chunks__/chunk-T74VEWCS.mjs +2 -0
- package/out/__chunks__/{chunk-X3AX4PFE.mjs → chunk-TE3NCUWV.mjs} +2 -2
- package/out/__chunks__/chunk-TIQSGLWX.mjs +2 -0
- package/out/__chunks__/chunk-TRIWGK3U.mjs +2 -0
- package/out/__chunks__/{chunk-G43Z243B.mjs.map → chunk-TRIWGK3U.mjs.map} +1 -1
- package/out/__chunks__/{chunk-ELCWJYQ7.mjs → chunk-U3GR2SVT.mjs} +2 -2
- package/out/__chunks__/chunk-UOZF737L.mjs +2 -0
- package/out/__chunks__/{chunk-SLG55PDO.mjs → chunk-UZHVWIUR.mjs} +2 -2
- package/out/__chunks__/{chunk-A63UAQRB.mjs → chunk-V5T4YPD6.mjs} +2 -2
- package/out/__chunks__/{chunk-7UUDW64Y.mjs → chunk-V6TPJKNA.mjs} +2 -2
- package/out/__chunks__/{chunk-ET6MYYOM.mjs → chunk-VFUYYYKF.mjs} +2 -2
- package/out/__chunks__/{chunk-UXBKGTA5.mjs → chunk-VMRTQJQQ.mjs} +2 -2
- package/out/__chunks__/{chunk-QJ6YLLBK.mjs → chunk-VRGBE6S2.mjs} +2 -2
- package/out/__chunks__/{chunk-5DUIQBPR.mjs → chunk-WH6I35RW.mjs} +2 -2
- package/out/__chunks__/{chunk-MNIS55JL.mjs → chunk-WQMYGZGV.mjs} +2 -2
- package/out/__chunks__/{chunk-ZG6EULI2.mjs → chunk-Y6ONT26X.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/ToastManager/ToastManager.mjs +1 -1
- package/out/managers/ToastManager/ToastUICoordinator.mjs +1 -1
- package/out/managers/ToastManager/helpers/LifetimeManager.mjs +1 -1
- package/out/managers/ToastManager/helpers/createToastsFromTransactions.mjs +1 -1
- package/out/managers/ToastManager/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/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/checkTransactionStatus/updateTransactionAndSessionStatus.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 +1 -0
- 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 -0
- 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.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-25G6565D.mjs +0 -2
- package/out/__chunks__/chunk-5F53ZQDO.mjs +0 -2
- package/out/__chunks__/chunk-5VQOOZQV.mjs +0 -2
- package/out/__chunks__/chunk-6C26F7JZ.mjs +0 -2
- package/out/__chunks__/chunk-6FRXGPOE.mjs +0 -2
- package/out/__chunks__/chunk-73E7X7HK.mjs +0 -2
- package/out/__chunks__/chunk-7BZQYV6D.mjs +0 -2
- package/out/__chunks__/chunk-BEXC6NB5.mjs +0 -2
- package/out/__chunks__/chunk-BEXC6NB5.mjs.map +0 -7
- package/out/__chunks__/chunk-E5OMXZT7.mjs +0 -2
- package/out/__chunks__/chunk-G43Z243B.mjs +0 -2
- package/out/__chunks__/chunk-HKVAAOC4.mjs +0 -2
- package/out/__chunks__/chunk-ILR4U7Q3.mjs +0 -2
- package/out/__chunks__/chunk-JFIQXGJ5.mjs +0 -2
- package/out/__chunks__/chunk-JM3JEGRV.mjs +0 -2
- package/out/__chunks__/chunk-JOPPHD4R.mjs +0 -2
- package/out/__chunks__/chunk-QZDVKNF4.mjs +0 -2
- package/out/__chunks__/chunk-SJLTVGKD.mjs +0 -2
- package/out/__chunks__/chunk-TT7J5V3M.mjs +0 -2
- package/out/__chunks__/chunk-TT7J5V3M.mjs.map +0 -7
- package/out/__chunks__/chunk-WJJTA23D.mjs +0 -2
- /package/out/__chunks__/{chunk-ZJM5FGLA.mjs.map → chunk-2D4GMO36.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2WAT3RZ3.mjs.map → chunk-2I2KSLE2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JHYKMKMK.mjs.map → chunk-2YOQ53JR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KZUPCFEG.mjs.map → chunk-3OVUAVDG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-T3RXRYP5.mjs.map → chunk-3TS5K6ZA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-NO4FZ4M3.mjs.map → chunk-4QRIFJFV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HBZ2RP7A.mjs.map → chunk-4WAWOE33.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JKFZERMM.mjs.map → chunk-6RJVQ4UE.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ETH6P454.mjs.map → chunk-6T23W57Y.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QMFEYMZI.mjs.map → chunk-6T2LXDEP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-I2CW2O7M.mjs.map → chunk-6ZHJDJ2I.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JOPPHD4R.mjs.map → chunk-7FTEFM3G.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-6C26F7JZ.mjs.map → chunk-7GBXWZAI.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-32DICVUK.mjs.map → chunk-7S2Y4LHL.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-GWXW3E7L.mjs.map → chunk-7WYMH2Y5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5WR632LR.mjs.map → chunk-A6QJ4XG2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UF2Y4P6U.mjs.map → chunk-B4HHDEQD.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-73E7X7HK.mjs.map → chunk-BDAUGWZM.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2ZW4LVVR.mjs.map → chunk-BWBZHZCG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UUPS4KLW.mjs.map → chunk-D6T322RK.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HKVAAOC4.mjs.map → chunk-DXXG5TSN.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-YYVGE2ZU.mjs.map → chunk-EB4P7XML.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-GPUXJWA3.mjs.map → chunk-EEFPWMB3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-TKIYJDS2.mjs.map → chunk-EETEYJ2T.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-FFGJMR4Q.mjs.map → chunk-EPFU7G25.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PCGP4VVW.mjs.map → chunk-FLIHXJC6.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ALT4OKHK.mjs.map → chunk-FPOYB42M.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-OI2AXS22.mjs.map → chunk-FREDJUGU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ZM77AGP5.mjs.map → chunk-GJXPULYJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AN4TQZVZ.mjs.map → chunk-GX6HPAJJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-6VPMVY56.mjs.map → chunk-H4DVQ62L.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-25G6565D.mjs.map → chunk-HFGQW4ZK.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5VQOOZQV.mjs.map → chunk-HT2FAOH3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-4ZAZCOJD.mjs.map → chunk-IDEBZCHN.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5KY3OIFD.mjs.map → chunk-IW4DEEHC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-WJJTA23D.mjs.map → chunk-IXXPFRFP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-BC5MT6WS.mjs.map → chunk-J6JGLSU3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-J6MUGECP.mjs.map → chunk-JAWHG5QV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-7BZQYV6D.mjs.map → chunk-JMFGVLF2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-B5YOJH7H.mjs.map → chunk-JNHXLQ7M.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-H7YY4BCM.mjs.map → chunk-JQD5FQP7.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KTQD4DTE.mjs.map → chunk-K57S4IEN.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ALBBGYHS.mjs.map → chunk-KXCUN2CA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-V322LMVG.mjs.map → chunk-L7LGSTVP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ILR4U7Q3.mjs.map → chunk-LFOBVMPR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-IXO75QXR.mjs.map → chunk-LOCBYCTW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AGBY3WIQ.mjs.map → chunk-LSFKZEDF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ZAY5O7DE.mjs.map → chunk-LV3TNCL7.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2UPWFRCA.mjs.map → chunk-MB3UAUH4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-GJ64B4SS.mjs.map → chunk-NFJTM7EU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-643FDBLR.mjs.map → chunk-NKW3DRZI.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AVEMKF6Z.mjs.map → chunk-NNNII7QZ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SJLTVGKD.mjs.map → chunk-NQNTF6QC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5F53ZQDO.mjs.map → chunk-NU34PSWD.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VY62CH5W.mjs.map → chunk-OEH2DV7C.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RXE5QIE3.mjs.map → chunk-OLQHWVIS.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VDAYN2HT.mjs.map → chunk-PKSNXCV4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QZDVKNF4.mjs.map → chunk-PNOKA67W.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-O462QL7Q.mjs.map → chunk-PWCNMKNB.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-GDMANS7S.mjs.map → chunk-QJI3WAKY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-V3GRSQIB.mjs.map → chunk-RJRYSDHS.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PUCCTEN7.mjs.map → chunk-SQMHTV2T.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-E5OMXZT7.mjs.map → chunk-SXOH2YD4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-6FRXGPOE.mjs.map → chunk-T74VEWCS.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-X3AX4PFE.mjs.map → chunk-TE3NCUWV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JFIQXGJ5.mjs.map → chunk-TIQSGLWX.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ELCWJYQ7.mjs.map → chunk-U3GR2SVT.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JM3JEGRV.mjs.map → chunk-UOZF737L.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SLG55PDO.mjs.map → chunk-UZHVWIUR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-A63UAQRB.mjs.map → chunk-V5T4YPD6.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-7UUDW64Y.mjs.map → chunk-V6TPJKNA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ET6MYYOM.mjs.map → chunk-VFUYYYKF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UXBKGTA5.mjs.map → chunk-VMRTQJQQ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QJ6YLLBK.mjs.map → chunk-VRGBE6S2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5DUIQBPR.mjs.map → chunk-WH6I35RW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-MNIS55JL.mjs.map → chunk-WQMYGZGV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ZG6EULI2.mjs.map → chunk-Y6ONT26X.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-Y6ONT26X.mjs";var i=e=>{let t=a();return{origin:e?.origin??t.origin,blockHashShard:e?.blockHashShard,expirySeconds:e?.expirySeconds??t.expirySeconds,apiAddress:e?.apiAddress??t.apiAddress,tokenExpirationToastWarningSeconds:e?.tokenExpirationToastWarningSeconds??t.tokenExpirationToastWarningSeconds,extraInfo:e?.extraInfo??{},gatewayUrl:e?.gatewayUrl,extraRequestHeaders:e?.extraRequestHeaders??{}}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2D4GMO36.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-TIQSGLWX.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-2I2KSLE2.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S}from"./chunk-EAJBSX6Y.mjs";import{a as s}from"./chunk-NTOY6GTP.mjs";import{c as r,d as a}from"./chunk-M6MN4RXG.mjs";import{s as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as S}from"./chunk-EAJBSX6Y.mjs";import{a as s}from"./chunk-NTOY6GTP.mjs";import{c as r,d as a}from"./chunk-M6MN4RXG.mjs";import{s as e}from"./chunk-7WYMH2Y5.mjs";import{a as n}from"./chunk-UERJ6AKK.mjs";var u=t=>{let o=0,i=n(e())?.shard;return S(t)?(t.forEach(c=>{let m=s(c,i);o+=m?5*6e3:6e3}),o):(o=s(t,i)?5*6e3:6e3,o)};export{u as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2YOQ53JR.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-TRIWGK3U.mjs";function r(t){try{if(!e)return;e.document.documentElement.dataset.mvxTheme=t}catch{console.log("Error switching the theme!")}}export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3OVUAVDG.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-TRIWGK3U.mjs";var t=()=>{if(!e)return"";try{let r=e.document?.referrer;return r?new URL(r).origin:""}catch(r){return console.error(r),""}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3TS5K6ZA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-UZHVWIUR.mjs";import{b as r}from"./chunk-LSFKZEDF.mjs";import{s as i}from"./chunk-7WYMH2Y5.mjs";import{b as o}from"./chunk-7VHTZYM2.mjs";async function M({shard:t,apiAddress:s}){if(t!=null)try{let a=await n(t,s);if(!a?.[t]?.lastBlock)return;let e=o(i());(!e.gasStationMetadata||!e.gasStationMetadata[t]||e.gasStationMetadata[t].lastBlock!==a[t].lastBlock)&&r({...e,gasStationMetadata:{...e.gasStationMetadata,...a}})}catch(a){console.error("Error fetching gas station metadata:",a)}}export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4QRIFJFV.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-A6QJ4XG2.mjs";import{a as g}from"./chunk-JQD5FQP7.mjs";import{a as I}from"./chunk-LFOBVMPR.mjs";import{a as S}from"./chunk-4MWQKLVG.mjs";import{s as l}from"./chunk-7WYMH2Y5.mjs";import{c as T}from"./chunk-UERJ6AKK.mjs";import{d as h,f as d,g as f}from"./chunk-7VHTZYM2.mjs";var y=t=>t.sort((o,a)=>a.timestamp-o.timestamp),B=async({transactions:t,skipFetchingTransactions:o=!1,store:a=l()})=>{let i=[],r=[];if(t.forEach(s=>{let e=I(s.hash,a);e?i.push(e):r.push(s.hash)}),r.length===0)return y(i);let c=o?t.map(s=>({...s,txHash:s.hash})):await u(r,{apiAddress:h(a)}),v=c.map(s=>s.txHash),p=r.filter(s=>!v.includes(s));if(p.length>0){let e=t.filter(n=>p.includes(n.hash)).map(n=>({...n,txHash:n.hash,price:0,status:"pending",gasUsed:0,miniBlockHash:"",receiverShard:0,round:0,senderShard:0,timestamp:Date.now()}));c.push(...e)}let m=new Map;return i.forEach(s=>{let e=s.hash;e&&m.set(String(e),s)}),c.forEach(s=>{let e=S({transaction:s,address:T(a),explorerAddress:f(a),egldLabel:d(a)});e.status!=="pending"&&g({key:`transaction-${s.txHash}`,value:e}),m.set(s.txHash,e)}),y(Array.from(m.values()))};export{B as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4WAWOE33.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as A}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as A}from"./chunk-2YOQ53JR.mjs";import{a as I}from"./chunk-EAJBSX6Y.mjs";import{a as b}from"./chunk-Y3BNMQFP.mjs";import{g as f}from"./chunk-GJXPULYJ.mjs";import{a as S}from"./chunk-N55JEIM6.mjs";import{b as T}from"./chunk-2VG3V3VD.mjs";import{a as y}from"./chunk-JNHXLQ7M.mjs";import{a as h}from"./chunk-NQNTF6QC.mjs";import{h as g}from"./chunk-M6MN4RXG.mjs";import{s as l}from"./chunk-7WYMH2Y5.mjs";import{b as m}from"./chunk-7VHTZYM2.mjs";import w from"axios";var r=class r{constructor(){this.setCallbacks=({onSuccess:t,onFail:a})=>{T({onSuccess:t,onFail:a})};this.send=async t=>{if(t.length===0)throw new Error("No transactions to send");try{if(!I(t))return await this.sendSignedTransactions(t);let a=await this.sendSignedBatchTransactions(t);if(!a.data||a.data.error)throw new Error(a.data?.error??"Failed to send transactions");return a.data.transactions}catch(a){throw a.response?.data?.message??a.message}};this.track=async(t,a={disableToasts:!1})=>{let s=this.sequentialToFlatArray(t).map(e=>({...e,status:e.status??"pending"})),o=S(s),n=y({transactions:s,transactionsDisplayInfo:a.transactionsDisplayInfo,status:o??"sent",sessionInformation:a.sessionInformation});if(a.disableToasts===!0)return n;a.onSuccess&&T({onSuccess:a.onSuccess,sessionId:n}),a.onFail&&T({onFail:a.onFail,sessionId:n});let i=A(t);return f({toastId:n,totalDuration:i}),n};this.sendSignedTransactions=async t=>{let{apiAddress:a,apiTimeout:s}=m(l());return await Promise.all(t.map(async n=>{let i=await w.post(`${a}/transactions`,n.toPlainObject(),{timeout:Number(s)}),e=i.data.txHash;return{...n.toPlainObject(),...i.data,status:"pending",hash:e}}))};this.sendSignedBatchTransactions=async t=>{let{address:a}=h(),{apiAddress:s,apiTimeout:o}=m(l());if(!a)return{error:"Invalid address provided. You need to be logged in to send transactions"};let n=this.buildBatchId(a),e={transactions:t.map(p=>p.map(c=>c.toPlainObject())),id:n},{data:u}=await w.post(`${s}/batch`,e,{timeout:Number(o)}),B=u.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:{...u,transactions:B}}};this.buildBatchId=t=>`${Date.now().toString()}${g}${t}`;this.sequentialToFlatArray=(t=[])=>this.getIsSequential(t)?t.flat():t;this.getIsSequential=t=>t?.every(a=>Array.isArray(a))}static getInstance(){return r.instance||(r.instance=new r),r.instance}};r.instance=null;var v=r;export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6RJVQ4UE.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-4TBVQD27.mjs";import{q as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-4TBVQD27.mjs";import{q as o}from"./chunk-7WYMH2Y5.mjs";var C=t=>o().setState(({config:e})=>{e.nativeAuthConfig=t},!1,{type:"setNativeAuthConfig",payload:{value:t}}),c=t=>o().setState(({config:e})=>{e.websocketStatus=t},!1,{type:"setWebsocketStatus",payload:{value:t}}),f=t=>o().setState(({config:e})=>{let a=t.walletConnectV2RelayAddress||n.walletConnectV2RelayAddress,l=t.walletConnectDeepLink||n.walletConnectDeepLink;e.walletConnectConfig={...t,walletConnectDeepLink:l,walletConnectV2RelayAddress:a}},!1,{type:"setWalletConnectConfig",payload:{value:t}});export{C as a,c as b,f as c};
|
|
2
|
+
//# sourceMappingURL=chunk-6T23W57Y.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-EEFPWMB3.mjs";import{a}from"./chunk-YUFPUG5O.mjs";import{a as c}from"./chunk-SXOH2YD4.mjs";var p="Check if the MultiversX App is open on Ledger";async function v({manager:e,resolve:n,reject:d,shouldInitProvider:s}){let i=!c(),t=()=>v({manager:e,resolve:n,reject:d,shouldInitProvider:s}),o=()=>d("Device unavailable");try{e?.updateAccountScreen({isLoading:!0}),e&&i&&e.subscribeToProviderInit({handleRetry:t,handleCancel:o});let r=await l({shouldInitProvider:s});e&&i&&e.unsubscribeFromProviderInit({handleRetry:t,handleCancel:o}),n(r)}catch(r){if(!i)throw r;let{errorMessage:u,defaultErrorMessage:g}=a(r);e?.updateConnectScreen({error:u??g??p}),e&&e.subscribeToProviderInit({handleRetry:t,handleCancel:o})}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6T2LXDEP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-O7LCTC4K.mjs";import{s as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-O7LCTC4K.mjs";import{s as m}from"./chunk-7WYMH2Y5.mjs";import{b as a}from"./chunk-7VHTZYM2.mjs";import{o as r,u as i}from"./chunk-KD2IQ32V.mjs";import{a as c}from"./chunk-3FXHIV6O.mjs";async function b({tokenId:o}){let t=a(m()),{isNft:k}=c(o),n=o,p=k?r:i;if(!n)return{tokenDecimals:Number(t.decimals),tokenLabel:"",tokenAvatar:""};try{let{data:e}=await s.get(`${t.apiAddress}/${p}/${n}`),f=e?e?.decimals:Number(t.decimals),l=e?e?.name:"",d=e?e?.assets?.svgUrl??e?.media?.[0]?.thumbnailUrl:"";return{tokenDecimals:f,tokenLabel:l,type:e?.type,tokenAvatar:d,identifier:e?.identifier,assets:e?.assets,esdtPrice:e?.price,ticker:e?.ticker,name:e?.name}}catch(e){return{error:`Error fetching token ${n}: ${e.toString()}`,tokenDecimals:Number(t.decimals),tokenLabel:"",tokenAvatar:"",identifier:n}}}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6ZHJDJ2I.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-SUBC3H4J.mjs";import{a as t}from"./chunk-U64LDJTG.mjs";import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-SUBC3H4J.mjs";import{a as t}from"./chunk-U64LDJTG.mjs";import{a as n}from"./chunk-NQNTF6QC.mjs";import{s as e}from"./chunk-7WYMH2Y5.mjs";import{b as o}from"./chunk-7VHTZYM2.mjs";var w=async r=>{let{isGuarded:i}=n();if(!s({isGuarded:i,transactions:r}))return r;let a=r[0].sender.toBech32(),{walletAddress:d}=o(e());return await(await t({address:a,walletUrl:d}))?.guardTransactions(r)||[]};export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7S2Y4LHL.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a,f as p}from"./chunk-UERJ6AKK.mjs";import{f as l}from"./chunk-VNLGNNIL.mjs";import{a as d,b as y}from"./chunk-NLRDRI7Q.mjs";import{a as I}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as a,f as p}from"./chunk-UERJ6AKK.mjs";import{f as l}from"./chunk-VNLGNNIL.mjs";import{a as d,b as y}from"./chunk-NLRDRI7Q.mjs";import{a as I}from"./chunk-PNOKA67W.mjs";import{a as k}from"./chunk-KRWR77QE.mjs";import{b as T}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 L}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 v}from"./chunk-NB7A4C7L.mjs";import{c as s}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=p(e),n=l(e),{address:i,publicKey:M}=a(e);if(i&&M!==new s(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 W=(e,t)=>{C(e)};var z=e=>{let t=J(V(h(N((...n)=>({network:x(...n),account:g(...n),loginInfo:f(...n),config:L(...n),transactions:y(...n),toasts:u(...n),cache:T(...n),ui:v(...n)})),{name:"sdk-dapp-store",storage:O(e)}),{name:"sdk-dapp"}));return t.subscribe(W),t},r,D=e=>{r=e},o=()=>(r||D(z(()=>new k)),r),le=(e=I)=>{let t=z(e);return D(t),t},se=()=>o().getState();var me=e=>o().setState(({loginInfo:t})=>{t.providerType=e},!1,{type:"setProviderType",payload:{value:e}}),fe=e=>o().setState(({loginInfo:t})=>{t.tokenLogin=e},!1,{type:"setTokenLogin",payload:{value:e}}),Se=e=>o().setState(({loginInfo:t})=>{if(t.tokenLogin!=null){t.tokenLogin.loginToken=e;return}t.tokenLogin={loginToken:e}},!1,{type:"setLoginToken",payload:{value:e}}),ue=e=>o().setState(({loginInfo:t})=>{t?.tokenLogin!=null&&(t.tokenLogin.signature=e)},!1,{type:"setTokenLoginSignature",payload:{value:e}}),de=e=>o().setState(({loginInfo:t})=>{t.walletConnectLogin=e},!1,{type:"setWalletConnectLogin",payload:{value:e}}),ye=e=>o().setState(({loginInfo:t})=>{t.ledgerLogin=e},!1,{type:"setLedgerLogin",payload:{value:e}}),xe=e=>o().setState(({loginInfo:t})=>{t.isWalletConnectV2Initialized=e},!1,{type:"setIsWalletConnectV2Initialized",payload:{value:e}}),E=()=>o().setState(({loginInfo:e})=>{e.loginExpiresAt=null},!1,{type:"removeLoginExpiresAt",payload:{value:null}}),b=e=>o().setState(({loginInfo:t})=>{t.loginExpiresAt=e},!1,{type:"addLoginExpiresAt",payload:{value:e}});export{me as a,fe as b,Se as c,ue as d,de as e,ye as f,xe as g,E as h,b as i,A as j,H as k,w as l,C as m,W as n,z as o,D as p,o as q,le as r,se as s};
|
|
2
|
+
//# sourceMappingURL=chunk-7WYMH2Y5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{s as t}from"./chunk-7WYMH2Y5.mjs";import{d as e}from"./chunk-7VHTZYM2.mjs";import{x as r}from"./chunk-KD2IQ32V.mjs";import i from"axios";var c=async(s,a={apiAddress:""})=>{let{data:o}=await i.get(`${a.apiAddress||e(t())}/${r}`,{params:{hashes:s.join(","),withScResults:!0}});return o};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-A6QJ4XG2.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p}from"./chunk-LV3TNCL7.mjs";import{a as u}from"./chunk-EAXWH64Z.mjs";import{a as i}from"./chunk-W5MTQBQF.mjs";import{a as T}from"./chunk-JSSRK6RP.mjs";import{a as m}from"./chunk-U3UMCTU6.mjs";import{a as k}from"./chunk-BRJNX4JF.mjs";import{c as l}from"./chunk-PJWJZHIS.mjs";import{a as o}from"./chunk-7CELSV4S.mjs";var g=class{static async processTransactions({address:v,egldLabel:L,explorerAddress:a,transactions:h}){let f=h.map(e=>T({address:v,explorerAddress:a,transaction:e}));return await Promise.all(f.map(async e=>{let s=e.receiverAssets?.name.replace(/\p{Emoji}/gu,""),c=e.senderAssets?.name.replace(/\p{Emoji}/gu,""),{senderLockedAccount:D,receiverLockedAccount:x}=await p({receiver:e.receiver,sender:e.sender,tokenId:e.tokenIdentifier}),{egldValueData:t,tokenValueData:n,nftValueData:r}=u({transaction:e}),y=r?.token.type==="MetaESDT"?void 0:r?.badgeText,d=m.getData({input:t?.value??n?.value??r?.value??"",decimals:t?.decimals??n?.decimals??r?.decimals??l,digits:2}),S={badge:y??void 0,collection:n?.token.collection??r?.token.collection,egldLabel:t?L:"",link:k({explorerAddress:a,to: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:d.valueDecimal,valueInteger:d.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:!!x,link:e.links.receiverLink??"",shard:w,shardLink:e.links.receiverShardLink,showLink:e.transactionDetails.direction!=="In"},sender:{address:e.sender,name:c??"",description:`${c??e.sender} (${e.sender})`,isContract:o(e.sender),isTokenLocked:!!D,link:e.links.senderLink??"",shard:A,shardLink:e.links.senderShardLink,showLink:e.transactionDetails.direction!=="Out"},value:S}}))}};export{g as a};
|
|
2
|
+
//# sourceMappingURL=chunk-B4HHDEQD.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-FLIHXJC6.mjs";import{a}from"./chunk-TIQSGLWX.mjs";import{a as u}from"./chunk-WQMYGZGV.mjs";import{c as n}from"./chunk-IDEBZCHN.mjs";import{a as s}from"./chunk-TRIWGK3U.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-BWBZHZCG.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as T}from"./chunk-Q2Q4XN4M.mjs";import{b as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as T}from"./chunk-Q2Q4XN4M.mjs";import{b as u}from"./chunk-6T23W57Y.mjs";import{d as m,e as l}from"./chunk-PWCNMKNB.mjs";import{q as a}from"./chunk-7WYMH2Y5.mjs";import{b as r}from"./chunk-7VHTZYM2.mjs";import{b as t}from"./chunk-GGBMHKR4.mjs";import{io as y}from"socket.io-client";var A=3e3,g=3,w=500,E=1e3,f="batchUpdated",p="connect",N="connect_error",b="disconnect";async function M(i){let{apiAddress:k,websocketUrl:I}=r(a().getState());if(!i)throw new Error("Websocket could not be initialized: address missing");let o=null,n=null,c=e=>{t.status=e,u(e)},d=e=>{o&&clearTimeout(o),o=setTimeout(()=>{m(e)},E)},C=e=>{n&&clearTimeout(n),n=setTimeout(()=>{l(e)},E)},W=()=>{let e=t.instance;e&&(e.off(N),e.off(p),e.off(f),e.off(b),e.close(),console.log("Websocket disconnected.")),c("not_initialized"),t.instance=null,o&&clearTimeout(o),n&&clearTimeout(n)},S=async()=>{c("pending");let e=I??await T(k);if(!e){c("not_initialized");return}t.instance=y(e,{forceNew:!0,reconnection:!0,reconnectionAttempts:g,reconnectionDelay:w,timeout:A,query:{address:i}}),t.instance.onAny(d),t.instance.on(f,C),t.instance.on(p,()=>{console.log("Websocket connected."),c("completed")}),t.instance.on(N,s=>{console.warn("Websocket connect error: ",s.message)}),t.instance.on(b,s=>{console.warn("Websocket disconnected: ",s),c("pending")})};return t.status==="not_initialized"&&!t.instance?.active&&await S(),{closeConnection:W}}export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-D6T322RK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-TRIWGK3U.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-EB4P7XML.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-FRDR4A7Z.mjs";import{x as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-FRDR4A7Z.mjs";import{x as g}from"./chunk-GJXPULYJ.mjs";import{a as c}from"./chunk-SXOH2YD4.mjs";import{s as n}from"./chunk-7WYMH2Y5.mjs";import{g as a}from"./chunk-UERJ6AKK.mjs";import{e as l}from"./chunk-VNLGNNIL.mjs";import{HWProvider as m}from"@multiversx/sdk-hw-provider";async function A(u){let v=c(),d=u?.shouldInitProvider||!v,o=l(n()),t=a(n()),r=g(),i=new m,I=async()=>{let e=o?.index!=null;if(r instanceof m&&r.isInitialized())return e&&await r.setAddressIndex(o.index),r;if(d&&!await i.init())throw new Error("Failed to initialize Ledger Provider");return e&&await i.setAddressIndex(o.index),i};try{if(!d&&t)return{ledgerProvider:i,ledgerConfig:{version:t.version,dataEnabled:t.hasContractDataEnabled}};let e=await I(),s=await f(e);return{ledgerProvider:e,ledgerConfig:s}}catch(e){throw console.error("Could not initialize ledger app",e),e}}export{A as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EEFPWMB3.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t}from"./chunk-V5T4YPD6.mjs";async function g({originalLoginToken:i,extraInfoData:n,address:o}){let e=await t({loginToken:i,extraInfoData:n}),s=n.multisig||n.impersonate||o;return{address:e!=null?s:o,modifiedLoginToken:e}}export{g as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EETEYJ2T.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-A6QJ4XG2.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-EPFU7G25.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-D6T322RK.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-FLIHXJC6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{x as n}from"./chunk-GJXPULYJ.mjs";import{a as i}from"./chunk-LJX4MW7B.mjs";var e=async()=>{let o=n();if(o.getType()===i.crossWindow){let r=o;await r.cancelAction(),await r.dispose()}};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FPOYB42M.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-V6TPJKNA.mjs";var a=class{constructor({uiDataUpdateEvent:t,uiTag:e}){this.eventBus=null;this.uiElement=null;this.isCreatingElement=!1;this.unsubscribeFunctions=new Map;this.uiDataUpdateEvent=t,this.uiTag=e,this.data=this.getInitialData()}async init(t){this.anchor=t,await this.createUIElement(t),await this.setupEventListeners()}updateData(t){this.data={...this.data,...t},this.notifyDataUpdate()}subscribeToEventBus(t,e){if(!this.eventBus)throw new Error("eventBus is not initialized");let i=this.eventBus?.subscribe(t,e);if(i){let n=this.unsubscribeFunctions.get(t)||[];n.push(i),this.unsubscribeFunctions.set(t,n)}}notifyDataUpdate(){this.eventBus?.publish(this.uiDataUpdateEvent,this.data)}destroy(){this.unsubscribeFunctions.forEach(t=>t.forEach(e=>e())),this.unsubscribeFunctions.clear(),this.eventBus=null,this.uiElement?.remove?.(),this.uiElement=null}getInitialData(){return this.initialData}resetData(){this.data=this.getInitialData()}async createUIElement(t=this.anchor){if(this.isCreatingElement||this.uiElement)return this.uiElement;if(this.isCreatingElement=!0,this.uiElement=await s.create({name:this.uiTag,anchor:t}),this.isCreatingElement=!1,!this.uiElement)throw new Error(`Failed to create ${this.uiTag} element`);if(this.eventBus||(this.eventBus=await this.uiElement.getEventBus()),!this.eventBus)throw new Error("eventBus is not initialized");return this.uiElement}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-FREDJUGU.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as wt}from"./chunk-FFGJMR4Q.mjs";import{a as vt}from"./chunk-HKVAAOC4.mjs";import{a as O}from"./chunk-2UPWFRCA.mjs";import{a as Ct}from"./chunk-6UZHM5LW.mjs";import{a as xt}from"./chunk-NO4FZ4M3.mjs";import{a as Et}from"./chunk-E5OMXZT7.mjs";import{a as Nt}from"./chunk-WJJTA23D.mjs";import{a as At}from"./chunk-JM3JEGRV.mjs";import{a as q}from"./chunk-X3AX4PFE.mjs";import{a as S}from"./chunk-KDWLSBQB.mjs";import{a as Lt}from"./chunk-VRLS225Q.mjs";import{a as Bt}from"./chunk-4ODPAHHA.mjs";import{a as kt}from"./chunk-2ZW4LVVR.mjs";import{b as k}from"./chunk-PCGP4VVW.mjs";import{a as Ft}from"./chunk-7BZQYV6D.mjs";import{a as Pt}from"./chunk-MDVI45IV.mjs";import{a as Mt}from"./chunk-2WAT3RZ3.mjs";import{a as b}from"./chunk-6FRXGPOE.mjs";import{a as mt}from"./chunk-JFIQXGJ5.mjs";import{a as St}from"./chunk-IXO75QXR.mjs";import{a as N}from"./chunk-GDMANS7S.mjs";import{a as F,f as It}from"./chunk-O462QL7Q.mjs";import{b as h,d as yt}from"./chunk-B5YOJH7H.mjs";import{k as ft,l as x,n as ht}from"./chunk-E2GGD7D4.mjs";import{b as Ot}from"./chunk-MNIS55JL.mjs";import{a as M}from"./chunk-HORSXVIV.mjs";import{a as Rt}from"./chunk-SJLTVGKD.mjs";import{a as ut}from"./chunk-643FDBLR.mjs";import{a as L}from"./chunk-QTKK6OSJ.mjs";import{a as ct}from"./chunk-6ACLOUQ3.mjs";import{a as A}from"./chunk-G7GU37XI.mjs";import{a as rt}from"./chunk-YSCND2MX.mjs";import{a as Ut}from"./chunk-NJN53MJV.mjs";import{a as pt,b as Tt,g as dt,l as gt}from"./chunk-M6MN4RXG.mjs";import{b as lt}from"./chunk-NGM3AVCY.mjs";import{a as it,b as at,q as u,s as f}from"./chunk-GWXW3E7L.mjs";import{c as X,d as tt,f as et}from"./chunk-UERJ6AKK.mjs";import{b as y}from"./chunk-VNLGNNIL.mjs";import{b as I}from"./chunk-6JM4DPOH.mjs";import{b as ot,c as st,f as nt}from"./chunk-NTEMINYA.mjs";import{b as Dt}from"./chunk-UCRVRBTA.mjs";import{a as bt}from"./chunk-7UUDW64Y.mjs";import{c as w}from"./chunk-4ZAZCOJD.mjs";import{b as z}from"./chunk-GGBMHKR4.mjs";import{a as E}from"./chunk-LJX4MW7B.mjs";import Y from"bignumber.js";import V from"lodash.isequal";var _t=1e4,P=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=_t;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let e=setTimeout(()=>{B(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,e)};this.startWithCustomDuration=(t,e)=>{if(this.stop(t),e<=0)return;let s=setTimeout(()=>{R(t);let n=v[t];n?.()},e);this.timeoutIntervals.set(t,s)};this.stop=t=>{let e=this.timeoutIntervals.get(t);e&&(clearTimeout(e),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t??_t}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};import Wt from"lodash.isequal";var Jt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",D=class o extends St{constructor(e){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.initialData={pendingTransactions:[],historicTransactions:[]};this.store=e||u(),this.data={...this.initialData}}static getInstance(){return o.instance||(o.instance=new o),o.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){d.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let s=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Wt(r.transactionToasts,n.transactionToasts)||!Wt(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Jt,[s]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let e=d.getInstance();this.closeUI(),await e.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:e}=this.store.getState(),{pendingTransactionToasts:s}=await O({});this.data.pendingTransactions=s,this.data.historicTransactions=await vt.getTransactionsHistory({transactionsSessions:e}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){yt(),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))}};var U=class{constructor(t){this.toastsElement=null;this.eventBus=null;this.isCreatingElement=!1;this.eventBusUnsubscribeFunctions=[];this.onCloseToast=t.onCloseToast,this.store=t.store||u(),this.notificationsFeedManager=t.notificationsFeedManager||D.getInstance()}async init(){await this.subscribeToEventBusNotifications()}showToasts(){this.eventBus?.publish("SHOW_TOAST_LIST",null)}hideToasts(){this.eventBus?.publish("HIDE_TOAST_LIST",null)}async publishTransactionToasts(t){if(this.notificationsFeedManager.isNotificationsFeedOpen()&&this.eventBus){this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",t),this.hideToasts();return}if(!this.eventBus){let e=await this.createToastListElement();if(!e)return;this.eventBus=await e.getEventBus()}this.eventBus?.publish("TRANSACTION_TOAST_DATA_UPDATE",t)}async publishCustomToasts(t){this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",t)}handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}destroy(){this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[],this.notificationsFeedManager?.destroy()}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await bt.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}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.onCloseToast),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.onCloseToast)}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}};var d=class o{constructor(t){this.transactionToasts=[];this.customToasts=[];this.unsubscribeFromStore=()=>null;this.uiCoordinator=null;this.destroy(),this.store=t?.store||u(),this.lifetimeManager=t?.lifetimeManager??new P,this.uiCoordinator=t?.uiCoordinator??new U({onCloseToast:this.closeToast.bind(this)})}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),await this.updateTransactionToastsList(),await this.updateCustomToastList(),await this.uiCoordinator?.init(),this.unsubscribeFromStore=this.store.subscribe(async({toasts:e,transactions:s},{toasts:n,transactions:i})=>{let r=!V(n.transactionToasts,e.transactionToasts),c=!V(i,s);(r||c)&&await this.updateTransactionToastsList({skipFetchingTransactions:c}),!V(n.customToasts,e.customToasts)&&await this.updateCustomToastList()})}static getInstance(){return o.instance||(o.instance=new o),o.instance}handleCompletedTransaction(t){let{transactions:e}=this.store.getState(),s=e[t];if(!s)return!1;let{status:n}=s,i=ht(n),r=x(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,e){let s=Gt({toastId:t,totalDuration:e});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),s}async createCustomToast(t){let e=W(t);return await this.updateCustomToastList(),e}async updateTransactionToastsList(t){let e=this.store.getState(),{toasts:s}=e,{pendingTransactionToasts:n,completedTransactionToasts:i}=await O({skipFetchingTransactions:t?.skipFetchingTransactions,store:e});this.transactionToasts=[...n,...i];for(let r of s.transactionToasts)this.handleCompletedTransaction(r.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let e of t.customToasts){let n="message"in e?{...e}:{...e,instantiateToastElement:_[e.toastId]};this.customToasts.push(n),e.duration&&this.lifetimeManager.startWithCustomDuration(e.toastId,e.duration)}await this.uiCoordinator?.publishCustomToasts(this.customToasts)}handleTransactionToastClose(t){return this.handleCompletedTransaction(t)?(B(t),!0):!1}async showToasts(){this.uiCoordinator?.showToasts(),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.uiCoordinator?.hideToasts()}closeToast(t){if(this.customToasts.find(s=>s.toastId===t)){this.lifetimeManager.stop(t);let s=v[t];return s?.(),R(t),!0}return this.handleTransactionToastClose(t)}async publishTransactionToasts(){await this.uiCoordinator?.publishTransactionToasts(this.transactionToasts)}destroy(){this.unsubscribeFromStore(),this.lifetimeManager?.destroy(),this.uiCoordinator?.destroy(),Ht()}};var H=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(),e=y(t),{isExpired:s}=L(e?.nativeAuthToken);s?C().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(),e=y(t),s=et(t);return!!(e?.nativeAuthToken&&s)};this.addPlannedLogout=()=>{let t=C(),e=X(this.store.getState()),s=t.getType()===E.webview;if(!e||s)return;this.addLogoutWarning();let n=y(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=L(n?.nativeAuthToken),c=new Y(String(i)),a=`${e}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let T=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{d.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},T.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},T.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=I(this.store.getState()),e=y(this.store.getState()),{secondsUntilExpires:s}=L(e?.nativeAuthToken),n=new Y(String(s)),i=n.times(1e3);if(!s||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new Y(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=Ct(i.toNumber()),l=a.isLessThanOrEqualTo(0)?0:a.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{d.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 G={};async function Xt({serverTransaction:o,sessionId:t,isSequential:e}){let{hash:s,status:n,results:i,invalidTransaction:r,hasStatusChanged:c}=o;try{if(G[s]>30){h({sessionId:t,status:"timedOut"}),await S({sessionId:t,status:"timedOut"});return}if(r&&!e||n==="sent"){G[s]=G[s]?G[s]+1:1;return}if(e&&!n){let m=q({sessionId:t,transaction:o});await S({sessionId:t,status:m});return}if(c){let m=q({sessionId:t,transaction:o});await S({sessionId:t,status:m})}x(n)&&await At({sessionId:t,hash:s,results:i})}catch(a){console.error(a),h({sessionId:t,status:"timedOut"}),await S({sessionId:t,status:"timedOut"})}}async function $t({sessionId:o,transactionBatch:t,isSequential:e}){try{if(t==null)return;let s=Et(),n=Lt(t),i=await wt(n);for(let p of i)await Xt({serverTransaction:p,sessionId:o,isSequential:e});if(!i.every(p=>p.status!=="pending"))return;s&&await $();let{transactions:c}=f(),a=c[o];if(a.transactions.every(p=>p.status==="success"))return h({sessionId:o,status:"success"});if(a.transactions.some(p=>p.status==="fail"))return h({sessionId:o,status:"fail"});if(a.transactions.every(p=>p.status==="not executed"))return h({sessionId:o,status:"invalid"})}catch(s){console.error(s)}}async function Kt(){let o=lt(f());if(Object.keys(o).length>0)for(let[t,{transactions:e}]of Object.entries(o))await $t({sessionId:t,transactionBatch:e})}async function K(){let o=u(),t=Nt(),e=null,s=null,n=tt(o.getState())?.timestamp,i=()=>{Kt()},r=()=>{e??=setInterval(i,t)},c=()=>{e&&(clearInterval(e),e=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"||s||(s=setInterval(()=>{z.status==="completed"&&(clearInterval(s),s=null,a())},1e3))};i();let l=()=>{c(),s&&(clearInterval(s),s=null)},T=o.subscribe(({account:{address:p},config:{websocketStatus:g}},Yt)=>{if(Yt.config.websocketStatus!==g)switch(g){case"completed":a();break;case"pending":r(),m();break;default:p?r():l();break}});return w.set("websocketStatusChanged",T),w.set("websocketEventReceived",l),{stopTransactionsTracking:l}}async function Z({address:o,provider:t,apiAddress:e}){let s=await A({address:o,baseURL:e});if(!s)throw new Error("Account not found");Ot({address:o,providerType:t.getType()});let n={...s,username:M(s.username),nonce:N(s)};F(n),await k(o),K(),s.shard!=null&&await xt({shard:Number(s.shard),apiAddress:e})}async function te(o){let{network:{apiAddress:t}}=b();await o.login();let e=await o.getAddress();if(!e)throw new Error("Address not found");return await Z({address:e,provider:o,apiAddress:t}),{address:e}}async function ee({provider:o,nativeAuthConfig:t,token:e}){let{network:{apiAddress:s}}=b(),n=ut(t),i=e;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=ct(a?.accessToken)?a.accessToken:n.getToken({address:r,token:i,signature:c});at({loginToken:i,signature:c,nativeAuthToken:l});let T=await Ft({loginToken:i,extraInfoData:{multisig:a?.multisig,impersonate:a?.impersonate},address:r});return await Z({address:T,provider:o,apiAddress:s}),{address:T,signature:c}}async function jt(o,t){let e=I(f());if(e)return await ee({provider:o,nativeAuthConfig:e,token:t?.token});let{address:s}=await te(o);return await k(s),K(),{address:s,signature:""}}var J={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${Tt}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${pt}-${Date.now()}`}},oe={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"},se=o=>{for(let[t,e]of Object.entries(oe))if(o.includes(t))return e;return"Error when signing"};function Q(o,t="error"){let e=o?.message,s=se(e),i=s!=="Error when signing"?"warning":t,r=Object.keys(J).includes(i)?J[i]:J.error,{toastId:c,iconClassName:a,title:m}=r;return W({toastId:c,duration:1e4,icon:"times",iconClassName:a,message:s,title:m}),s}async function zt({provider:o,transactions:t,options:e={}}){await $();let{isGuarded:s,activeGuardianAddress:n,nonce:i}=Rt(),r=o.getType()===E.ledger,c=Bt({latestNonce:i,transactions:t}),a=n&&s&&!e.skipGuardian?c?.map(l=>(l.version=ot.withTxOptions().valueOf(),l.options=nt.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),l.guardian=st.newFromBech32(n),l)):c,m=await o.signTransactions(a)??[];return It(i+m.length),m}var j=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let e=await jt(this.provider,t);return it(this.provider.getType()),qt(this),H.getInstance().init(),e}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 e=await kt({provider:this.provider,options:t});return this._isLoggingOut=!1,e}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,e){try{return await zt({provider:this.provider,transactions:t,options:e})}catch(s){let n=Q(s);throw new Error(n)}}async signMessage(t,e){try{return await Mt({provider:this.provider,message:t,options:e})}catch(s){let n=Q(s,"warning");throw new Error(n)}}async verifyMessage(t){return await Pt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var Vt=null;function qt(o){Vt=o}function C(){return Vt||new j(Dt)}var ne=async()=>{try{let o=mt(),{network:t}=b();try{let e=await A({address:o,baseURL:t.apiAddress});if(e!=null){let s={...e,username:M(e.username),nonce:N(e)};return F(s),s}}catch(e){console.error("Failed getting account ",e)}}catch(o){console.error("Failed getting address ",o)}return null};async function $(){let o=C();if(o==null)throw"Provider not initialized";try{if(!o.init)throw"Current provider does not have init() function";return await o.init()?await ne():void 0}catch(t){console.error("Failed initializing provider ",t)}}var _={},v={},ie=(o,t)=>{u().setState(({toasts:e})=>{let s=e.customToasts.length>0?Math.max(...e.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${s+1}`,i=e.customToasts.findIndex(a=>a.toastId===n),r={...o,toastId:n};if(i!==-1){e.customToasts[i]=r;return}e.customToasts.push({...r,toastId:n})},!1,{type:"addCustomToast",payload:{value:{customToast:o,currentToastId:t}}})},R=o=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(e=>e.toastId!==o)},!1,{type:"removeCustomToast",payload:{value:o}})},Ht=()=>{u().setState(({toasts:o})=>{o.customToasts=[]},!1,{type:"removeAllCustomToasts",payload:{value:null}})},ln=()=>{u().setState(({toasts:o})=>{o.transactionToasts=[]})},Gt=({toastId:o,totalDuration:t})=>{let e="";return u().setState(({toasts:s})=>{let n=s.transactionToasts.length>0?Math.max(...s.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;e=o??`transaction-toast-${n+1}`,s.transactionToasts.push({startTime:rt(),endTime:Ut(t),toastId:e})},!1,"addTransactionToast"),e},B=o=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(e=>e.toastId!==o)},!1,"removeTransactionToast"),delete v[o],delete _[o]},W=o=>{let{toasts:t}=u().getState(),e=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,s=o.toastId||`custom-toast-${e+1}`;return o.onClose&&(v[s]=o.onClose),o.instantiateToastElement?(_[s]=o.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===s),r={...o,instantiateToastElement:null,toastId:s};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),s):(ie(o,s),s)};export{_ as a,v as b,ie as c,R as d,Ht as e,ln as f,Gt as g,B as h,W as i,P as j,D as k,U as l,d as m,H as n,$t as o,Kt as p,K as q,Z as r,jt as s,Q as t,zt as u,j as v,qt as w,C as x,$ as y};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as wt}from"./chunk-EPFU7G25.mjs";import{a as vt}from"./chunk-DXXG5TSN.mjs";import{a as O}from"./chunk-MB3UAUH4.mjs";import{a as Ct}from"./chunk-6UZHM5LW.mjs";import{a as xt}from"./chunk-4QRIFJFV.mjs";import{a as Et}from"./chunk-SXOH2YD4.mjs";import{a as Nt}from"./chunk-IXXPFRFP.mjs";import{a as At}from"./chunk-UOZF737L.mjs";import{a as q}from"./chunk-TE3NCUWV.mjs";import{a as S}from"./chunk-KDWLSBQB.mjs";import{a as Lt}from"./chunk-VRLS225Q.mjs";import{a as Bt}from"./chunk-4ODPAHHA.mjs";import{a as kt}from"./chunk-BWBZHZCG.mjs";import{b as k}from"./chunk-FLIHXJC6.mjs";import{a as Ft}from"./chunk-JMFGVLF2.mjs";import{a as Pt}from"./chunk-MDVI45IV.mjs";import{a as Mt}from"./chunk-2I2KSLE2.mjs";import{a as b}from"./chunk-T74VEWCS.mjs";import{a as mt}from"./chunk-TIQSGLWX.mjs";import{a as St}from"./chunk-LOCBYCTW.mjs";import{a as N}from"./chunk-QJI3WAKY.mjs";import{a as F,f as It}from"./chunk-PWCNMKNB.mjs";import{b as h,d as yt}from"./chunk-JNHXLQ7M.mjs";import{k as ft,l as x,n as ht}from"./chunk-E2GGD7D4.mjs";import{b as Ot}from"./chunk-WQMYGZGV.mjs";import{a as M}from"./chunk-HORSXVIV.mjs";import{a as Rt}from"./chunk-NQNTF6QC.mjs";import{a as ut}from"./chunk-NKW3DRZI.mjs";import{a as L}from"./chunk-QTKK6OSJ.mjs";import{a as ct}from"./chunk-6ACLOUQ3.mjs";import{a as A}from"./chunk-G7GU37XI.mjs";import{a as rt}from"./chunk-YSCND2MX.mjs";import{a as Ut}from"./chunk-NJN53MJV.mjs";import{a as pt,b as Tt,g as dt,l as gt}from"./chunk-M6MN4RXG.mjs";import{b as lt}from"./chunk-NGM3AVCY.mjs";import{a as it,b as at,q as u,s as f}from"./chunk-7WYMH2Y5.mjs";import{c as X,d as tt,f as et}from"./chunk-UERJ6AKK.mjs";import{b as y}from"./chunk-VNLGNNIL.mjs";import{b as I}from"./chunk-6JM4DPOH.mjs";import{b as ot,c as st,f as nt}from"./chunk-NTEMINYA.mjs";import{b as Dt}from"./chunk-UCRVRBTA.mjs";import{a as bt}from"./chunk-V6TPJKNA.mjs";import{c as w}from"./chunk-IDEBZCHN.mjs";import{b as z}from"./chunk-GGBMHKR4.mjs";import{a as E}from"./chunk-LJX4MW7B.mjs";import Y from"bignumber.js";import V from"lodash.isequal";var _t=1e4,P=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=_t;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let e=setTimeout(()=>{B(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,e)};this.startWithCustomDuration=(t,e)=>{if(this.stop(t),e<=0)return;let s=setTimeout(()=>{R(t);let n=v[t];n?.()},e);this.timeoutIntervals.set(t,s)};this.stop=t=>{let e=this.timeoutIntervals.get(t);e&&(clearTimeout(e),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t??_t}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};import Wt from"lodash.isequal";var Jt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",D=class o extends St{constructor(e){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.initialData={pendingTransactions:[],historicTransactions:[]};this.store=e||u(),this.data={...this.initialData}}static getInstance(){return o.instance||(o.instance=new o),o.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){d.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let s=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Wt(r.transactionToasts,n.transactionToasts)||!Wt(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Jt,[s]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let e=d.getInstance();this.closeUI(),await e.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:e}=this.store.getState(),{pendingTransactionToasts:s}=await O({});this.data.pendingTransactions=s,this.data.historicTransactions=await vt.getTransactionsHistory({transactionsSessions:e}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){yt(),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))}};var U=class{constructor(t){this.toastsElement=null;this.eventBus=null;this.isCreatingElement=!1;this.eventBusUnsubscribeFunctions=[];this.onCloseToast=t.onCloseToast,this.store=t.store||u(),this.notificationsFeedManager=t.notificationsFeedManager||D.getInstance()}async init(){await this.subscribeToEventBusNotifications()}showToasts(){this.eventBus?.publish("SHOW_TOAST_LIST",null)}hideToasts(){this.eventBus?.publish("HIDE_TOAST_LIST",null)}async publishTransactionToasts(t){if(this.notificationsFeedManager.isNotificationsFeedOpen()&&this.eventBus){this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",t),this.hideToasts();return}if(!this.eventBus){let e=await this.createToastListElement();if(!e)return;this.eventBus=await e.getEventBus()}this.eventBus?.publish("TRANSACTION_TOAST_DATA_UPDATE",t)}async publishCustomToasts(t){this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",t)}handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}destroy(){this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[],this.notificationsFeedManager?.destroy()}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await bt.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}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.onCloseToast),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.onCloseToast)}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}};var d=class o{constructor(t){this.transactionToasts=[];this.customToasts=[];this.unsubscribeFromStore=()=>null;this.uiCoordinator=null;this.destroy(),this.store=t?.store||u(),this.lifetimeManager=t?.lifetimeManager??new P,this.uiCoordinator=t?.uiCoordinator??new U({onCloseToast:this.closeToast.bind(this)})}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),await this.updateTransactionToastsList(),await this.updateCustomToastList(),await this.uiCoordinator?.init(),this.unsubscribeFromStore=this.store.subscribe(async({toasts:e,transactions:s},{toasts:n,transactions:i})=>{let r=!V(n.transactionToasts,e.transactionToasts),c=!V(i,s);(r||c)&&await this.updateTransactionToastsList({skipFetchingTransactions:c}),!V(n.customToasts,e.customToasts)&&await this.updateCustomToastList()})}static getInstance(){return o.instance||(o.instance=new o),o.instance}handleCompletedTransaction(t){let{transactions:e}=this.store.getState(),s=e[t];if(!s)return!1;let{status:n}=s,i=ht(n),r=x(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,e){let s=Gt({toastId:t,totalDuration:e});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),s}async createCustomToast(t){let e=W(t);return await this.updateCustomToastList(),e}async updateTransactionToastsList(t){let e=this.store.getState(),{toasts:s}=e,{pendingTransactionToasts:n,completedTransactionToasts:i}=await O({skipFetchingTransactions:t?.skipFetchingTransactions,store:e});this.transactionToasts=[...n,...i];for(let r of s.transactionToasts)this.handleCompletedTransaction(r.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let e of t.customToasts){let n="message"in e?{...e}:{...e,instantiateToastElement:_[e.toastId]};this.customToasts.push(n),e.duration&&this.lifetimeManager.startWithCustomDuration(e.toastId,e.duration)}await this.uiCoordinator?.publishCustomToasts(this.customToasts)}handleTransactionToastClose(t){return this.handleCompletedTransaction(t)?(B(t),!0):!1}async showToasts(){this.uiCoordinator?.showToasts(),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.uiCoordinator?.hideToasts()}closeToast(t){if(this.customToasts.find(s=>s.toastId===t)){this.lifetimeManager.stop(t);let s=v[t];return s?.(),R(t),!0}return this.handleTransactionToastClose(t)}async publishTransactionToasts(){await this.uiCoordinator?.publishTransactionToasts(this.transactionToasts)}destroy(){this.unsubscribeFromStore(),this.lifetimeManager?.destroy(),this.uiCoordinator?.destroy(),Ht()}};var H=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(),e=y(t),{isExpired:s}=L(e?.nativeAuthToken);s?C().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(),e=y(t),s=et(t);return!!(e?.nativeAuthToken&&s)};this.addPlannedLogout=()=>{let t=C(),e=X(this.store.getState()),s=t.getType()===E.webview;if(!e||s)return;this.addLogoutWarning();let n=y(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=L(n?.nativeAuthToken),c=new Y(String(i)),a=`${e}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let T=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{d.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},T.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},T.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=I(this.store.getState()),e=y(this.store.getState()),{secondsUntilExpires:s}=L(e?.nativeAuthToken),n=new Y(String(s)),i=n.times(1e3);if(!s||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new Y(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=Ct(i.toNumber()),l=a.isLessThanOrEqualTo(0)?0:a.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{d.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 G={};async function Xt({serverTransaction:o,sessionId:t,isSequential:e}){let{hash:s,status:n,results:i,invalidTransaction:r,hasStatusChanged:c}=o;try{if(G[s]>30){h({sessionId:t,status:"timedOut"}),await S({sessionId:t,status:"timedOut"});return}if(r&&!e||n==="sent"){G[s]=G[s]?G[s]+1:1;return}if(e&&!n){let m=q({sessionId:t,transaction:o});await S({sessionId:t,status:m});return}if(c){let m=q({sessionId:t,transaction:o});await S({sessionId:t,status:m})}x(n)&&await At({sessionId:t,hash:s,results:i})}catch(a){console.error(a),h({sessionId:t,status:"timedOut"}),await S({sessionId:t,status:"timedOut"})}}async function $t({sessionId:o,transactionBatch:t,isSequential:e}){try{if(t==null)return;let s=Et(),n=Lt(t),i=await wt(n);for(let p of i)await Xt({serverTransaction:p,sessionId:o,isSequential:e});if(!i.every(p=>p.status!=="pending"))return;s&&await $();let{transactions:c}=f(),a=c[o];if(a.transactions.every(p=>p.status==="success"))return h({sessionId:o,status:"success"});if(a.transactions.some(p=>p.status==="fail"))return h({sessionId:o,status:"fail"});if(a.transactions.every(p=>p.status==="not executed"))return h({sessionId:o,status:"invalid"})}catch(s){console.error(s)}}async function Kt(){let o=lt(f());if(Object.keys(o).length>0)for(let[t,{transactions:e}]of Object.entries(o))await $t({sessionId:t,transactionBatch:e})}async function K(){let o=u(),t=Nt(),e=null,s=null,n=tt(o.getState())?.timestamp,i=()=>{Kt()},r=()=>{e??=setInterval(i,t)},c=()=>{e&&(clearInterval(e),e=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"||s||(s=setInterval(()=>{z.status==="completed"&&(clearInterval(s),s=null,a())},1e3))};i();let l=()=>{c(),s&&(clearInterval(s),s=null)},T=o.subscribe(({account:{address:p},config:{websocketStatus:g}},Yt)=>{if(Yt.config.websocketStatus!==g)switch(g){case"completed":a();break;case"pending":r(),m();break;default:p?r():l();break}});return w.set("websocketStatusChanged",T),w.set("websocketEventReceived",l),{stopTransactionsTracking:l}}async function Z({address:o,provider:t,apiAddress:e}){let s=await A({address:o,baseURL:e});if(!s)throw new Error("Account not found");Ot({address:o,providerType:t.getType()});let n={...s,username:M(s.username),nonce:N(s)};F(n),await k(o),K(),s.shard!=null&&await xt({shard:Number(s.shard),apiAddress:e})}async function te(o){let{network:{apiAddress:t}}=b();await o.login();let e=await o.getAddress();if(!e)throw new Error("Address not found");return await Z({address:e,provider:o,apiAddress:t}),{address:e}}async function ee({provider:o,nativeAuthConfig:t,token:e}){let{network:{apiAddress:s}}=b(),n=ut(t),i=e;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=ct(a?.accessToken)?a.accessToken:n.getToken({address:r,token:i,signature:c});at({loginToken:i,signature:c,nativeAuthToken:l});let T=await Ft({loginToken:i,extraInfoData:{multisig:a?.multisig,impersonate:a?.impersonate},address:r});return await Z({address:T,provider:o,apiAddress:s}),{address:T,signature:c}}async function jt(o,t){let e=I(f());if(e)return await ee({provider:o,nativeAuthConfig:e,token:t?.token});let{address:s}=await te(o);return await k(s),K(),{address:s,signature:""}}var J={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${Tt}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${pt}-${Date.now()}`}},oe={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"},se=o=>{for(let[t,e]of Object.entries(oe))if(o.includes(t))return e;return"Error when signing"};function Q(o,t="error"){let e=o?.message,s=se(e),i=s!=="Error when signing"?"warning":t,r=Object.keys(J).includes(i)?J[i]:J.error,{toastId:c,iconClassName:a,title:m}=r;return W({toastId:c,duration:1e4,icon:"times",iconClassName:a,message:s,title:m}),s}async function zt({provider:o,transactions:t,options:e={}}){await $();let{isGuarded:s,activeGuardianAddress:n,nonce:i}=Rt(),r=o.getType()===E.ledger,c=Bt({latestNonce:i,transactions:t}),a=n&&s&&!e.skipGuardian?c?.map(l=>(l.version=ot.withTxOptions().valueOf(),l.options=nt.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),l.guardian=st.newFromBech32(n),l)):c,m=await o.signTransactions(a)??[];return It(i+m.length),m}var j=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let e=await jt(this.provider,t);return it(this.provider.getType()),qt(this),H.getInstance().init(),e}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 e=await kt({provider:this.provider,options:t});return this._isLoggingOut=!1,e}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,e){try{return await zt({provider:this.provider,transactions:t,options:e})}catch(s){let n=Q(s);throw new Error(n)}}async signMessage(t,e){try{return await Mt({provider:this.provider,message:t,options:e})}catch(s){let n=Q(s,"warning");throw new Error(n)}}async verifyMessage(t){return await Pt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var Vt=null;function qt(o){Vt=o}function C(){return Vt||new j(Dt)}var ne=async()=>{try{let o=mt(),{network:t}=b();try{let e=await A({address:o,baseURL:t.apiAddress});if(e!=null){let s={...e,username:M(e.username),nonce:N(e)};return F(s),s}}catch(e){console.error("Failed getting account ",e)}}catch(o){console.error("Failed getting address ",o)}return null};async function $(){let o=C();if(o==null)throw"Provider not initialized";try{if(!o.init)throw"Current provider does not have init() function";return await o.init()?await ne():void 0}catch(t){console.error("Failed initializing provider ",t)}}var _={},v={},ie=(o,t)=>{u().setState(({toasts:e})=>{let s=e.customToasts.length>0?Math.max(...e.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${s+1}`,i=e.customToasts.findIndex(a=>a.toastId===n),r={...o,toastId:n};if(i!==-1){e.customToasts[i]=r;return}e.customToasts.push({...r,toastId:n})},!1,{type:"addCustomToast",payload:{value:{customToast:o,currentToastId:t}}})},R=o=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(e=>e.toastId!==o)},!1,{type:"removeCustomToast",payload:{value:o}})},Ht=()=>{u().setState(({toasts:o})=>{o.customToasts=[]},!1,{type:"removeAllCustomToasts",payload:{value:null}})},ln=()=>{u().setState(({toasts:o})=>{o.transactionToasts=[]})},Gt=({toastId:o,totalDuration:t})=>{let e="";return u().setState(({toasts:s})=>{let n=s.transactionToasts.length>0?Math.max(...s.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;e=o??`transaction-toast-${n+1}`,s.transactionToasts.push({startTime:rt(),endTime:Ut(t),toastId:e})},!1,"addTransactionToast"),e},B=o=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(e=>e.toastId!==o)},!1,"removeTransactionToast"),delete v[o],delete _[o]},W=o=>{let{toasts:t}=u().getState(),e=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,s=o.toastId||`custom-toast-${e+1}`;return o.onClose&&(v[s]=o.onClose),o.instantiateToastElement?(_[s]=o.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===s),r={...o,instantiateToastElement:null,toastId:s};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),s):(ie(o,s),s)};export{_ as a,v as b,ie as c,R as d,Ht as e,ln as f,Gt as g,B as h,W as i,P as j,D as k,U as l,d as m,H as n,$t as o,Kt as p,K as q,Z as r,jt as s,Q as t,zt as u,j as v,qt as w,C as x,$ as y};
|
|
2
|
+
//# sourceMappingURL=chunk-GJXPULYJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-LOCBYCTW.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-GX6HPAJJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{s as r}from"./chunk-7WYMH2Y5.mjs";import{b as e}from"./chunk-7VHTZYM2.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-H4DVQ62L.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-TRIWGK3U.mjs";import{createJSONStorage as o}from"zustand/middleware";var r={persistReducersStorageType:"localStorage"},i=e?o(()=>e[r.persistReducersStorageType]):void 0,p=new Map,n=3e3;export{r as a,i as b,p as c,n as d};
|
|
2
|
+
//# sourceMappingURL=chunk-IDEBZCHN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-3TS5K6ZA.mjs";import{a as r}from"./chunk-B2UIPHJ3.mjs";var o=()=>{try{return!r()||!e()?!1:window.self!==window.top}catch{return!0}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IW4DEEHC.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-FREDJUGU.mjs";var c=class n extends i{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE",uiTag:"mvx-ledger-connect"});this.addressesPerPage=10;this.allAccounts=[];this.initialConnectScreenData={};this.connectScreenData={...this.initialConnectScreenData};this.initialAccountScreenData={accounts:this.allAccounts,startIndex:0,addressesPerPage:this.addressesPerPage,isLoading:!0};this.accountScreenData={...this.initialAccountScreenData};this.initialConfirmScreenData={selectedAddress:"",explorerLink:""};this.confirmScreenData={...this.initialConfirmScreenData};this.initialData={connectScreenData:this.initialConnectScreenData,accountScreenData:this.initialAccountScreenData,confirmScreenData:this.initialConfirmScreenData};this.data=this.getInitialData()}static getInstance(){return n.instance||(n.instance=new n),n.instance}updateAllAccounts(e){this.allAccounts=e,this.accountScreenData.accounts=e}updateStartIndex(e){this.accountScreenData.startIndex=e}updateConnectScreen(e){this.connectScreenData={...this.connectScreenData,...e},this.data.confirmScreenData=null,this.data.accountScreenData=null,this.data.connectScreenData=this.connectScreenData,this.notifyDataUpdate()}updateAccountScreen(e){this.accountScreenData={...this.accountScreenData,...e},this.data.confirmScreenData=null,this.data.accountScreenData=this.accountScreenData,this.notifyDataUpdate()}updateConfirmScreen(e){this.confirmScreenData={...this.confirmScreenData,...e},this.data.accountScreenData=null,this.data.confirmScreenData=this.confirmScreenData,this.notifyDataUpdate()}getAccountScreenData(){return this.data.accountScreenData}getConfirmScreenData(){return this.data.confirmScreenData}getAllAccounts(){return this.allAccounts}subscribeToProviderInit({handleRetry:e,handleCancel:t}){this.eventBus&&(this.eventBus.subscribe("CONNECT_DEVICE",e),this.eventBus.subscribe("CLOSE",t),this.eventBus.subscribe("UI_DISCONNECTED",this.destroy.bind(this)))}unsubscribeFromProviderInit({handleRetry:e,handleCancel:t}){this.eventBus&&(this.eventBus.unsubscribe("CONNECT_DEVICE",e),this.eventBus.unsubscribe("CLOSE",t),this.eventBus.unsubscribe("UI_DISCONNECTED",this.destroy.bind(this)))}subscribeToAuthEvents({handleCancel:e,handleAccessWallet:t,handleGoToPage:a}){this.eventBus&&(this.eventBus.subscribe("CLOSE",e),this.eventBus.subscribe("ACCESS_WALLET",t),this.eventBus.subscribe("GO_TO_PAGE",a))}unsubscribeFromAuthEvents({handleCancel:e,handleAccessWallet:t,handleGoToPage:a}){this.eventBus&&(this.eventBus.unsubscribe("CLOSE",e),this.eventBus.unsubscribe("ACCESS_WALLET",t),this.eventBus.unsubscribe("GO_TO_PAGE",a))}handleClose(){this.anchor?this.anchor?.dispatchEvent(new CustomEvent("ANCHOR_CLOSE",{composed:!1,bubbles:!1})):this.destroy()}resetData(){this.accountScreenData={...this.initialAccountScreenData},this.confirmScreenData={...this.initialConfirmScreenData},this.connectScreenData={...this.initialConnectScreenData},super.resetData()}async setupEventListeners(){this.eventBus&&this.eventBus.subscribe("CLOSE",this.handleClose.bind(this))}};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-J6JGLSU3.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as ce}from"./chunk-M3YL36ZL.mjs";import{a as A}from"./chunk-RXE5QIE3.mjs";import{a as ae}from"./chunk-2Y66XRQK.mjs";import{a as oe}from"./chunk-UXBKGTA5.mjs";import{a as R}from"./chunk-BC5MT6WS.mjs";import{a as ne}from"./chunk-QMFEYMZI.mjs";import{a as ie}from"./chunk-GPUXJWA3.mjs";import{a as te}from"./chunk-YUFPUG5O.mjs";import{a as de}from"./chunk-V322LMVG.mjs";import{a as p}from"./chunk-ELCWJYQ7.mjs";import{a as re}from"./chunk-VY62CH5W.mjs";import{a as S}from"./chunk-ET6MYYOM.mjs";import{a as se}from"./chunk-32DICVUK.mjs";import{a as b}from"./chunk-QJGFIK7H.mjs";import{b as ee}from"./chunk-4Z3DZ2A3.mjs";import{b as I,c as Z}from"./chunk-NRXYSTRW.mjs";import{i as J,m as U,v as M,w as C,x as L}from"./chunk-ZM77AGP5.mjs";import{a as y}from"./chunk-E5OMXZT7.mjs";import{a as X}from"./chunk-JFIQXGJ5.mjs";import{a as N}from"./chunk-4TBVQD27.mjs";import{a as Q}from"./chunk-MNIS55JL.mjs";import{g as Y}from"./chunk-M6MN4RXG.mjs";import{a as q,q as F,s as c}from"./chunk-GWXW3E7L.mjs";import{f as H}from"./chunk-UERJ6AKK.mjs";import{b as f,c as B}from"./chunk-7VHTZYM2.mjs";import{a as G}from"./chunk-VNLGNNIL.mjs";import{b as $,c as j}from"./chunk-6JM4DPOH.mjs";import{a as l,b as K}from"./chunk-6R2WFQ7U.mjs";import{a as o}from"./chunk-LJX4MW7B.mjs";var w=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 oe({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!y())return;await R.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await S({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 le({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await ie({shouldInitProvider:!0});this.provider=r}catch(r){throw J({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 o.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=R.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((i,s)=>ne({manager:e,resolve:i,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var ve=3e4,me=5e3,he=3e3,k=class a{constructor(){this.store=F();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let n=this.store.getState(),{providerType:e}=G(n),r=H(n);return!!(e===o.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let n=ee(c());if(!(!this.shouldCheckConnection()||n))try{await L().getProvider().getAddress()}catch{if(U.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 n=new w({shouldInitProvider:!0});await n.init();let e=new M(n);n.getType=()=>o.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,U.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 T=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 i=await this.provider.signTransactions(e)??[];return await se(i)}catch(i){throw await r({shouldCancelAction:!0}),i}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:l.crossWindow})};this.walletAddress=e?.walletAddress,this.provider=b.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=f(c()),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 o.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 _=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(i){throw await t({shouldCancelAction:!1}),i}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:l.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 o.extension}};var W=class extends p{constructor({address:e,walletUrl:r}={}){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 S({transactions:e,handleSign:this.provider.signTransactions.bind(this.provider)})}catch(i){throw await t({shouldCancelAction:!0}),i}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:l[o.metamask]})};this.walletUrl=r??"",this.provider=ce.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=f(c());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.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return o.metamask}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 we}from"@multiversx/sdk-wallet-connect-provider/out";var pe=[I.CANCEL_ACTION,I.SIGN_LOGIN_TOKEN],x=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 i=this.cancelActionAbortController.signal;try{let s=new Promise((h,v)=>{i.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:we.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:l.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 o.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:i}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??N.walletConnectDeepLink;this._approval=i,A.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!y())return;await A.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=y(),t=B(c());if($(c())&&pe.push(I.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{Q()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:O={},walletConnectV2RelayAddress:D=""}=e,P=new Z(v,t,D,m,O);return await P.init(),{walletConnectProvider:P,dappMethods:pe}}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=A.getInstance(),{uri:i="",approval:s}=await this.provider.connect({methods:this.methods}),d=this.config.walletConnectDeepLink??N.walletConnectDeepLink;t.updateData({wcURI:i,walletConnectDeepLink:`${d}?wallet-connect=${encodeURIComponent(i)}`});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:i="",signature:s=""}=t??{};return A.getInstance().handleClose({isLoginFinished:!!i}),{address:i,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 E=class{static set customProviders(n){this._customProviders=n}static get customProviders(){return this._customProviders}static async create({type:n,anchor:e}){let r=null;switch(n){case o.extension:{r=new _;break}case o.crossWindow:{r=new T;break}case o.ledger:{r=new w({anchor:e}),await k.getInstance().init();break}case o.metamask:{r=new W;break}case o.passkey:{let s=f(c());r=new T({walletAddress:`${s.walletAddress}?${K}=${o.passkey}`});break}case o.walletConnect:{let s=j(c());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new x({anchor:e,...s});break}case o.webview:{r=new de;break}default:{let s=X();for(let d of this._customProviders)d.type===n&&(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 i="provider"in r&&r.provider instanceof b;return ae(i?{skipLoginMethod:o.crossWindow}:null),t}static async destroy(){L().cancelLogin(),C(null),q(o.none)}};E._customProviders=[];var Pe=(a,n)=>a.some(e=>e.type===n);async function g({message:a,handleSignMessage:n,cancelAction:e,providerType:r}){return await new Promise(async(i,s)=>{let{manager:d,onClose:h}=await re({cancelAction:e}),v=Object.values(E.customProviders),m=v.reduce((u,V)=>(u[V.type]=V.name,u),{}),O={...l,...m},D=async()=>{await h({shouldCancelAction:!0}),s({message:"Signing canceled"})};d.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",D);let P=Pe(v,r)?r:o.none;d.updateData({name:O[P],type:P});try{let u=await n(a);i(u)}catch(u){await h({shouldCancelAction:!0}),s(u)}finally{d.closeUI()}})}async function le({message:a,handleSignMessage:n}){try{return await g({message:a,handleSignMessage:n,providerType:l.ledger})}catch(e){let{errorMessage:r}=te(e);throw r?{message:r}:e}}export{le as a,w as b,k as c,E as d,g as e,T as f,_ as g,W as h,x as i};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as ce}from"./chunk-M3YL36ZL.mjs";import{a as A}from"./chunk-OLQHWVIS.mjs";import{a as ae}from"./chunk-2Y66XRQK.mjs";import{a as oe}from"./chunk-VMRTQJQQ.mjs";import{a as R}from"./chunk-J6JGLSU3.mjs";import{a as ne}from"./chunk-6T2LXDEP.mjs";import{a as ie}from"./chunk-EEFPWMB3.mjs";import{a as te}from"./chunk-YUFPUG5O.mjs";import{a as de}from"./chunk-L7LGSTVP.mjs";import{a as p}from"./chunk-U3GR2SVT.mjs";import{a as re}from"./chunk-OEH2DV7C.mjs";import{a as S}from"./chunk-VFUYYYKF.mjs";import{a as se}from"./chunk-7S2Y4LHL.mjs";import{a as b}from"./chunk-QJGFIK7H.mjs";import{b as ee}from"./chunk-4Z3DZ2A3.mjs";import{b as I,c as Z}from"./chunk-NRXYSTRW.mjs";import{i as J,m as U,v as M,w as C,x as L}from"./chunk-GJXPULYJ.mjs";import{a as y}from"./chunk-SXOH2YD4.mjs";import{a as X}from"./chunk-TIQSGLWX.mjs";import{a as N}from"./chunk-4TBVQD27.mjs";import{a as Q}from"./chunk-WQMYGZGV.mjs";import{g as Y}from"./chunk-M6MN4RXG.mjs";import{a as q,q as F,s as c}from"./chunk-7WYMH2Y5.mjs";import{f as H}from"./chunk-UERJ6AKK.mjs";import{b as f,c as B}from"./chunk-7VHTZYM2.mjs";import{a as G}from"./chunk-VNLGNNIL.mjs";import{b as $,c as j}from"./chunk-6JM4DPOH.mjs";import{a as l,b as K}from"./chunk-6R2WFQ7U.mjs";import{a as o}from"./chunk-LJX4MW7B.mjs";var w=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 oe({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!y())return;await R.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await S({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 le({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await ie({shouldInitProvider:!0});this.provider=r}catch(r){throw J({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 o.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=R.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((i,s)=>ne({manager:e,resolve:i,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var ve=3e4,me=5e3,he=3e3,k=class a{constructor(){this.store=F();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let n=this.store.getState(),{providerType:e}=G(n),r=H(n);return!!(e===o.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let n=ee(c());if(!(!this.shouldCheckConnection()||n))try{await L().getProvider().getAddress()}catch{if(U.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 n=new w({shouldInitProvider:!0});await n.init();let e=new M(n);n.getType=()=>o.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,U.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 T=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 i=await this.provider.signTransactions(e)??[];return await se(i)}catch(i){throw await r({shouldCancelAction:!0}),i}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:l.crossWindow})};this.walletAddress=e?.walletAddress,this.provider=b.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=f(c()),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 o.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 _=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(i){throw await t({shouldCancelAction:!1}),i}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:l.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 o.extension}};var W=class extends p{constructor({address:e,walletUrl:r}={}){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 S({transactions:e,handleSign:this.provider.signTransactions.bind(this.provider)})}catch(i){throw await t({shouldCancelAction:!0}),i}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:l[o.metamask]})};this.walletUrl=r??"",this.provider=ce.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=f(c());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.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return o.metamask}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 we}from"@multiversx/sdk-wallet-connect-provider/out";var pe=[I.CANCEL_ACTION,I.SIGN_LOGIN_TOKEN],x=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 i=this.cancelActionAbortController.signal;try{let s=new Promise((h,v)=>{i.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:we.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:l.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 o.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:i}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??N.walletConnectDeepLink;this._approval=i,A.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!y())return;await A.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=y(),t=B(c());if($(c())&&pe.push(I.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{Q()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:O={},walletConnectV2RelayAddress:D=""}=e,P=new Z(v,t,D,m,O);return await P.init(),{walletConnectProvider:P,dappMethods:pe}}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=A.getInstance(),{uri:i="",approval:s}=await this.provider.connect({methods:this.methods}),d=this.config.walletConnectDeepLink??N.walletConnectDeepLink;t.updateData({wcURI:i,walletConnectDeepLink:`${d}?wallet-connect=${encodeURIComponent(i)}`});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:i="",signature:s=""}=t??{};return A.getInstance().handleClose({isLoginFinished:!!i}),{address:i,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 E=class{static set customProviders(n){this._customProviders=n}static get customProviders(){return this._customProviders}static async create({type:n,anchor:e}){let r=null;switch(n){case o.extension:{r=new _;break}case o.crossWindow:{r=new T;break}case o.ledger:{r=new w({anchor:e}),await k.getInstance().init();break}case o.metamask:{r=new W;break}case o.passkey:{let s=f(c());r=new T({walletAddress:`${s.walletAddress}?${K}=${o.passkey}`});break}case o.walletConnect:{let s=j(c());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new x({anchor:e,...s});break}case o.webview:{r=new de;break}default:{let s=X();for(let d of this._customProviders)d.type===n&&(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 i="provider"in r&&r.provider instanceof b;return ae(i?{skipLoginMethod:o.crossWindow}:null),t}static async destroy(){L().cancelLogin(),C(null),q(o.none)}};E._customProviders=[];var Pe=(a,n)=>a.some(e=>e.type===n);async function g({message:a,handleSignMessage:n,cancelAction:e,providerType:r}){return await new Promise(async(i,s)=>{let{manager:d,onClose:h}=await re({cancelAction:e}),v=Object.values(E.customProviders),m=v.reduce((u,V)=>(u[V.type]=V.name,u),{}),O={...l,...m},D=async()=>{await h({shouldCancelAction:!0}),s({message:"Signing canceled"})};d.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",D);let P=Pe(v,r)?r:o.none;d.updateData({name:O[P],type:P});try{let u=await n(a);i(u)}catch(u){await h({shouldCancelAction:!0}),s(u)}finally{d.closeUI()}})}async function le({message:a,handleSignMessage:n}){try{return await g({message:a,handleSignMessage:n,providerType:l.ledger})}catch(e){let{errorMessage:r}=te(e);throw r?{message:r}:e}}export{le as a,w as b,k as c,E as d,g as e,T as f,_ as g,W as h,x as i};
|
|
2
|
+
//# sourceMappingURL=chunk-JAWHG5QV.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-EETEYJ2T.mjs";import{c as n}from"./chunk-7WYMH2Y5.mjs";async function c({loginToken:r,extraInfoData:i,address:e}){let o=await t({originalLoginToken:r,extraInfoData:i,address:e});return o.modifiedLoginToken&&n(o.modifiedLoginToken),o.address}export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JMFGVLF2.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{q as o}from"./chunk-7WYMH2Y5.mjs";import{current as p}from"immer";function d({transactions:t,transactionsDisplayInfo:n,status:r,sessionInformation:s}){let a=Date.now().toString();return o().setState(({transactions:e})=>{e[a]={transactions:t,status:r,transactionsDisplayInfo:n,interpretedTransactions:{},sessionInformation:s}},!1,{type:"createTransactionsSession",payload:{value:{transactions:t,status:r,transactionsDisplayInfo:n,sessionInformation:s}}}),a}function m({sessionId:t,status:n,errorMessage:r}){o().setState(({transactions:s})=>{if(!s[t])return;let a=p(s[t]).transactionsDisplayInfo??{},e=r||a?.errorMessage;s[t].status=n,s[t].errorMessage=e,s[t].transactionsDisplayInfo={...a,errorMessage:e}},!1,{type:"updateSessionStatus",payload:{value:{sessionId:t,status:n,errorMessage:r}}})}function g({sessionId:t,transaction:n}){o().setState(({transactions:r})=>{let s=r[t]?.transactions;s!=null&&(r[t].transactions=s.map(a=>a.hash===n.hash?{...a,...n??{}}:a))},!1,{type:"updateTransactionStatus",payload:{value:{sessionId:t,transaction:n}}})}var h=()=>{o().setState(({transactions:t,toasts:n})=>{let s=Object.keys(t).filter(e=>{let c=t[e];if(!c)return!1;let{status:i}=c;return!(i==="pending"||i==="signed"||i==="sent")});s.forEach(e=>{delete t[e]});let a=n.transactionToasts.filter(e=>!s.includes(e.toastId));n.transactionToasts=a},!1,{type:"clearCompletedTransactions",payload:{value:null}})};export{d as a,m as b,g as c,h as d};
|
|
2
|
+
//# sourceMappingURL=chunk-JNHXLQ7M.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{q as t}from"./chunk-7WYMH2Y5.mjs";var r=({key:e,value:a})=>{t().setState(({cache:c})=>{c[e]=a},!1,{type:"saveToCache",payload:{value:a}})},s=e=>{t().setState(({cache:a})=>{delete a[e]},!1,{type:"removeFromCache",payload:{value:e}})},h=()=>{t().setState(({cache:e})=>{Object.keys(e).forEach(a=>{delete e[a]})},!1,"clearCache")};export{r as a,s as b,h as c};
|
|
2
|
+
//# sourceMappingURL=chunk-JQD5FQP7.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as M}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as M}from"./chunk-NU34PSWD.mjs";import{a as U}from"./chunk-OLPFN3HZ.mjs";import{a as j}from"./chunk-7Z7IX367.mjs";import{a as z}from"./chunk-VCQBYNNS.mjs";import{a as V}from"./chunk-LN5UXO64.mjs";import{a as B}from"./chunk-PHOF3Z5D.mjs";import{a as $}from"./chunk-RBZC4PEU.mjs";import{a as _}from"./chunk-ELQR4QMU.mjs";import{a as R}from"./chunk-URJQWHBM.mjs";import{a as w}from"./chunk-YGI3KXMZ.mjs";import{a as O}from"./chunk-KXCUN2CA.mjs";import{a as v}from"./chunk-RYIJWGFA.mjs";import{x}from"./chunk-GJXPULYJ.mjs";import{a as G}from"./chunk-BRJNX4JF.mjs";import{a as C,c as F,f}from"./chunk-PJWJZHIS.mjs";import{a as b}from"./chunk-KD2IQ32V.mjs";import{c as L}from"./chunk-TI37DKBT.mjs";import{k as h}from"./chunk-LHEH7L4L.mjs";import{a as A}from"./chunk-TRIWGK3U.mjs";import{BigNumber as Dt}from"bignumber.js";async function Kt({allTransactions:T,currentScreenIndex:s,egldLabel:n,network:e,gasPriceData:m,price:S,address:c,username:q,shard:H,signedIndexes:i,parsedTransactionsByDataField:K}){let p=T[s],W=p?.transaction?.sender.toString(),d=p?.transaction,o=d?.toPlainObject(),D=null,I=null,t=await _({egldLabel:n,sender:W,apiAddress:e.apiAddress,address:c,parsedTransactionsByDataField:K})(p),g=!t?.transactionTokenInfo?.tokenId,{tokenId:l,nonce:u,amount:y=""}=t?.transactionTokenInfo??{},Z=l&&u&&u.length>0?`${l}-${u}`:l,J=await O({tokenId:Z}),{esdtPrice:Q,tokenDecimals:X,type:r,identifier:a,tokenImageUrl:Y}=J;if(r==="SemiFungibleESDT"||r==="NonFungibleESDT")I={type:r,identifier:a,amount:y,imageURL:Y};else{let P=({addCommas:St})=>f({input:g?d.value.toString():y,decimals:g?Number(e.decimals):X,digits:Number(e.digits),showLastNonZeroDecimal:!1,addCommas:St}),lt=P({addCommas:!0}),ut=P({addCommas:!1}),ft=Number(g?S:Q),Tt=w({amount:ut,usd:ft,addEqualSign:!0});D={identifier:(a===h?n:a)??n,amount:lt,usdValue:Tt}}let{feeLimitFormatted:tt,feeInFiatLimit:ot}=R({transaction:d,price:S}),nt=V({shard:H,initialGasPrice:m.initialGasPrice,transaction:o,gasStationMetadata:e.gasStationMetadata}),et=B({transaction:o,gasPriceData:m}),it=x().getType(),rt=v(it),N=T.length,at=i.length>0?i[i.length-1]+1:0,k=L(o?.data??""),E=$(t?.transactionTokenInfo),st=U({data:k,identifier:a,highlight:E}),mt=M(),ct=G({to:`/${b}/${c}`,explorerAddress:mt}),pt=N===1||t?.needsSigning&&!i.includes(s),dt=f({input:et.toString(),decimals:F,addCommas:!0,digits:C}),gt=new Dt(o.gasLimit).toFormat({decimalSeparator:",",groupSeparator:".",groupSize:3});return{commonData:{receiver:o.receiver.toString(),data:k,decodedData:st,gasPrice:dt,gasLimit:gt,explorerLink:ct,ppu:m.ppu,ppuOptions:nt,egldLabel:n,tokenType:j(r),feeLimit:tt,feeInFiatLimit:ot,transactionsCount:N,currentIndex:s,currentIndexToSign:at,highlight:E,scCall:z(t?.transactionTokenInfo),needsSigning:pt,isEditable:t?.needsSigning,providerName:rt,address:c,username:q,origin:A.location?.origin},tokenTransaction:D,fungibleTransaction:I}}export{Kt as a};
|
|
2
|
+
//# sourceMappingURL=chunk-K57S4IEN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-3QWTD55I.mjs";import{s as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-3QWTD55I.mjs";import{s as m}from"./chunk-7WYMH2Y5.mjs";import{b as a}from"./chunk-7VHTZYM2.mjs";import{o as s,u as o}from"./chunk-KD2IQ32V.mjs";import{a as c}from"./chunk-3FXHIV6O.mjs";async function I({tokenId:n}){let t=a(m()),r={tokenDecimals:Number(t.decimals),tokenLabel:"",tokenImageUrl:""},{isNft:k}=c(n),i=n,p=k?s:o;if(!i)return r;try{let e=await g(`${t.apiAddress}/${p}/${i}`),l=e?e?.decimals:Number(t.decimals),f=e?e?.name:"",T=e?e?.assets?.svgUrl??e?.media?.[0]?.thumbnailUrl:"";return{tokenDecimals:l,tokenLabel:f,type:e?.type,tokenImageUrl:T,identifier:e?.identifier,assets:e?.assets,esdtPrice:e?.price,ticker:e?.ticker,name:e?.name}}catch(e){return{...r,error:`${e}`}}}export{I as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KXCUN2CA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-U3GR2SVT.mjs";import{a as o}from"./chunk-LJX4MW7B.mjs";import{a as e,b as t}from"./chunk-TRIWGK3U.mjs";import{WebviewProvider as a}from"@multiversx/sdk-webview-provider/out/WebviewProvider";var n=class extends s{constructor(r){super(r?.address);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async r=>{if(!this.provider)throw new Error("Provider is not initialized.");try{return await this.provider.signTransactions(r)||[]}catch(i){throw this.cancelAction(),i}};this.signMessage=async r=>{if(!this.provider)throw new Error("Provider is not initialized.");try{return await this.provider.signMessage(r)}catch(i){throw this.cancelAction(),i}};this.provider=a.getInstance({resetStateCallback:()=>{e.localStorage?.clear?.(),e.sessionStorage?.clear?.()}}),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}logout(){return this.provider.logout()}getType(){return o.webview}getAddress(){throw new Error("Method not implemented.")}setAccount(r){return this.provider.setAccount(r)}isInitialized(){return this.provider.isInitialized()}async initializeProvider(){let r=await this.provider.init(t);return this.address&&this.setAccount({address:this.address}),r}};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-L7LGSTVP.mjs.map
|