@multiversx/sdk-dapp 5.2.12-alpha.1 → 5.2.12
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-J3PAP5L7.mjs → chunk-2BKGSHOR.mjs} +2 -2
- package/out/__chunks__/{chunk-WZMOKJRU.mjs → chunk-2FRFDBKB.mjs} +2 -2
- package/out/__chunks__/{chunk-G6BDMW4E.mjs → chunk-2IANAIWP.mjs} +2 -2
- package/out/__chunks__/{chunk-256UVPBB.mjs → chunk-3PTO3UT5.mjs} +2 -2
- package/out/__chunks__/{chunk-PDHQOTBR.mjs → chunk-3V7L7VMK.mjs} +2 -2
- package/out/__chunks__/{chunk-ITI5ANFI.mjs → chunk-5BYHDDZU.mjs} +2 -2
- package/out/__chunks__/{chunk-YJ4UF7WR.mjs → chunk-5IJGFJ7A.mjs} +2 -2
- package/out/__chunks__/{chunk-ZOQVPZWZ.mjs → chunk-5MSC5VEJ.mjs} +2 -2
- package/out/__chunks__/chunk-5TY2NRTY.mjs +2 -0
- package/out/__chunks__/chunk-5V3ZVJ5N.mjs +2 -0
- package/out/__chunks__/{chunk-5L36FGFX.mjs → chunk-6KJDFL4X.mjs} +2 -2
- package/out/__chunks__/{chunk-APPNCPKI.mjs → chunk-6TAFMLIP.mjs} +2 -2
- package/out/__chunks__/{chunk-HRRO627B.mjs → chunk-6V32BQRW.mjs} +2 -2
- package/out/__chunks__/chunk-74YKEHCU.mjs +2 -0
- package/out/__chunks__/chunk-7GTKSPKR.mjs +2 -0
- package/out/__chunks__/{chunk-ZNXVHDZB.mjs → chunk-7I7SJXVG.mjs} +2 -2
- package/out/__chunks__/chunk-7SHSB2H7.mjs +2 -0
- package/out/__chunks__/{chunk-4HVKYSYB.mjs → chunk-AWV2BT4N.mjs} +2 -2
- package/out/__chunks__/{chunk-R3JJ2K6E.mjs → chunk-BFYSNMGP.mjs} +2 -2
- package/out/__chunks__/{chunk-KWPLSEMY.mjs → chunk-CIUJ7Q6E.mjs} +2 -2
- package/out/__chunks__/{chunk-WIPFIC6A.mjs → chunk-CUMVG6S5.mjs} +2 -2
- package/out/__chunks__/{chunk-RFR7PHXZ.mjs → chunk-DGANJCHG.mjs} +2 -2
- package/out/__chunks__/chunk-DKMTA3CC.mjs +2 -0
- package/out/__chunks__/{chunk-CRTAVEFT.mjs → chunk-EELETY3Z.mjs} +2 -2
- package/out/__chunks__/{chunk-EGEQQSOM.mjs → chunk-EPRQ5A6W.mjs} +2 -2
- package/out/__chunks__/{chunk-A2DCRR56.mjs → chunk-EUJRQFQG.mjs} +2 -2
- package/out/__chunks__/{chunk-DGFYEV3J.mjs → chunk-EXE2PPR4.mjs} +2 -2
- package/out/__chunks__/{chunk-UOLQAHFF.mjs → chunk-FCB3AT5J.mjs} +2 -2
- package/out/__chunks__/{chunk-Y33JH2RH.mjs → chunk-FJD2WVYA.mjs} +2 -2
- package/out/__chunks__/{chunk-J7UVIFYD.mjs → chunk-GECW34DV.mjs} +2 -2
- package/out/__chunks__/{chunk-EH5ZLMLQ.mjs → chunk-GKM7KNTV.mjs} +2 -2
- package/out/__chunks__/{chunk-AUIQ4KU5.mjs → chunk-GRZU3CBF.mjs} +2 -2
- package/out/__chunks__/chunk-HROVYEVW.mjs +2 -0
- package/out/__chunks__/{chunk-MRMPIS2Z.mjs → chunk-HWWLVGYU.mjs} +2 -2
- package/out/__chunks__/{chunk-DDETOX7N.mjs → chunk-I3C6RYN6.mjs} +2 -2
- package/out/__chunks__/chunk-IRP5CFO7.mjs +2 -0
- package/out/__chunks__/{chunk-K2CYC6YQ.mjs → chunk-IRQV762M.mjs} +2 -2
- package/out/__chunks__/{chunk-PEET56XV.mjs → chunk-IUCITH6E.mjs} +2 -2
- package/out/__chunks__/{chunk-KDBMGECR.mjs → chunk-JOX3TPDC.mjs} +2 -2
- package/out/__chunks__/{chunk-NY3PLUBB.mjs → chunk-JPMLMIQR.mjs} +2 -2
- package/out/__chunks__/{chunk-NY3PLUBB.mjs.map → chunk-JPMLMIQR.mjs.map} +2 -2
- package/out/__chunks__/{chunk-LVGH7JBF.mjs → chunk-JSA535AB.mjs} +2 -2
- package/out/__chunks__/{chunk-RCAOCVBC.mjs → chunk-K2QNLOBA.mjs} +2 -2
- package/out/__chunks__/{chunk-CY733W4L.mjs → chunk-KC6QWZ4R.mjs} +2 -2
- package/out/__chunks__/{chunk-VLDGQL7B.mjs → chunk-KONLNCQL.mjs} +2 -2
- package/out/__chunks__/{chunk-BOXGW3SR.mjs → chunk-MWOVK6GV.mjs} +2 -2
- package/out/__chunks__/{chunk-K2Z5JQB6.mjs → chunk-N4CXXF6R.mjs} +2 -2
- package/out/__chunks__/{chunk-3AIY3TW7.mjs → chunk-NAQ3AWXW.mjs} +2 -2
- package/out/__chunks__/{chunk-QBV3NGRD.mjs → chunk-OAVLO5YR.mjs} +2 -2
- package/out/__chunks__/{chunk-H3COTSYJ.mjs → chunk-OTSQGZLA.mjs} +2 -2
- package/out/__chunks__/{chunk-UGRA4C4Z.mjs → chunk-OWA27GTK.mjs} +2 -2
- package/out/__chunks__/{chunk-MLPNNQ52.mjs → chunk-OZYD32IW.mjs} +2 -2
- package/out/__chunks__/{chunk-QVQOCBO6.mjs → chunk-P5BMCXKE.mjs} +2 -2
- package/out/__chunks__/{chunk-ZPELMVTN.mjs → chunk-P6DSLB4K.mjs} +2 -2
- package/out/__chunks__/{chunk-VLWMD34B.mjs → chunk-PR2UXLUQ.mjs} +2 -2
- package/out/__chunks__/{chunk-E2QSDBTZ.mjs → chunk-QT3PF6MA.mjs} +2 -2
- package/out/__chunks__/{chunk-JV5L4B73.mjs → chunk-R2OXRDF3.mjs} +2 -2
- package/out/__chunks__/chunk-R64XZNJM.mjs +2 -0
- package/out/__chunks__/chunk-SCIOG3JW.mjs +2 -0
- package/out/__chunks__/chunk-SDF6BSQJ.mjs +2 -0
- package/out/__chunks__/{chunk-UU3MJKEM.mjs → chunk-SJWV7RWT.mjs} +2 -2
- package/out/__chunks__/{chunk-76AWPVM4.mjs → chunk-SV3NP6BV.mjs} +2 -2
- package/out/__chunks__/chunk-SWV35LLA.mjs +2 -0
- package/out/__chunks__/{chunk-ARLGL5IH.mjs → chunk-SY2OIXRY.mjs} +2 -2
- package/out/__chunks__/{chunk-43ZS3ORV.mjs → chunk-T4GLMTGR.mjs} +2 -2
- package/out/__chunks__/{chunk-NLEPTN7T.mjs → chunk-U3CB72I3.mjs} +2 -2
- package/out/__chunks__/chunk-UBOX3NGQ.mjs +2 -0
- package/out/__chunks__/{chunk-HEK7IPGE.mjs → chunk-UKFG6RD4.mjs} +2 -2
- package/out/__chunks__/chunk-VGHFJYHY.mjs +2 -0
- package/out/__chunks__/chunk-WEDTMPCV.mjs +2 -0
- package/out/__chunks__/{chunk-2IEPFE4D.mjs → chunk-WMSBYBUV.mjs} +2 -2
- package/out/__chunks__/{chunk-AJA2CGU3.mjs → chunk-WTCCK3ZP.mjs} +2 -2
- package/out/__chunks__/chunk-WW4U7UI2.mjs +2 -0
- package/out/__chunks__/chunk-XJPDM2YR.mjs +2 -0
- package/out/__chunks__/chunk-XJPDM2YR.mjs.map +7 -0
- package/out/__chunks__/{chunk-Y3HLH5WI.mjs → chunk-XLBZPLWQ.mjs} +2 -2
- package/out/__chunks__/{chunk-VXBGAYMV.mjs → chunk-XQL64G6I.mjs} +2 -2
- package/out/__chunks__/{chunk-ZQLEJXPX.mjs → chunk-XU7FAZR4.mjs} +2 -2
- package/out/__chunks__/{chunk-TI2TATUO.mjs → chunk-YDKZQMFY.mjs} +2 -2
- package/out/__chunks__/chunk-YG6GGSSN.mjs +2 -0
- package/out/__chunks__/{chunk-GOFUMUQT.mjs.map → chunk-YG6GGSSN.mjs.map} +1 -1
- package/out/__chunks__/{chunk-SQDP4UCG.mjs → chunk-YLGQ3PM4.mjs} +2 -2
- package/out/__chunks__/{chunk-TUMBWNGY.mjs → chunk-YVVVV5XJ.mjs} +2 -2
- package/out/__chunks__/{chunk-SWW3XXSG.mjs → chunk-ZJ7L5STS.mjs} +2 -2
- package/out/__chunks__/{chunk-VXZLPVLU.mjs → chunk-ZNCLQODX.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/checkTransactionStatus.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/helpers/checkBatch/checkBatch.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/helpers/checkBatch/helpers/runTransactionFailure.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/helpers/checkBatch/helpers/runTransactionStatusUpdate.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/helpers/checkBatch/helpers/updateTransactionAndSessionStatus.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/helpers/checkBatch/index.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/index.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/helpers/getMultisigLoginToken.cjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/getMultisigLoginToken.cjs.map +2 -2
- package/out/providers/DappProvider/helpers/login/helpers/getMultisigLoginToken.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.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.cjs +1 -1
- package/out/providers/strategies/WalletConnectProviderStrategy/WalletConnectProviderStrategy.cjs.map +2 -2
- 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.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-2M3OATOJ.mjs +0 -2
- package/out/__chunks__/chunk-2POJ7MH5.mjs +0 -2
- package/out/__chunks__/chunk-2YEAP742.mjs +0 -2
- package/out/__chunks__/chunk-3GLS46GV.mjs +0 -2
- package/out/__chunks__/chunk-5ERDAMIE.mjs +0 -2
- package/out/__chunks__/chunk-5VJEMKRJ.mjs +0 -2
- package/out/__chunks__/chunk-6QDSNTK4.mjs +0 -2
- package/out/__chunks__/chunk-BT423XM3.mjs +0 -2
- package/out/__chunks__/chunk-BWBRRDTJ.mjs +0 -2
- package/out/__chunks__/chunk-EX3G2KOJ.mjs +0 -2
- package/out/__chunks__/chunk-GOFUMUQT.mjs +0 -2
- package/out/__chunks__/chunk-HTUNEXJ6.mjs +0 -2
- package/out/__chunks__/chunk-LFIRLUYG.mjs +0 -2
- package/out/__chunks__/chunk-RS457CD4.mjs +0 -2
- package/out/__chunks__/chunk-TKIMRAZN.mjs +0 -2
- package/out/__chunks__/chunk-USQUPGRC.mjs +0 -2
- package/out/__chunks__/chunk-USQUPGRC.mjs.map +0 -7
- package/out/__chunks__/chunk-XUNR4H62.mjs +0 -2
- package/out/__chunks__/chunk-YGEY6NOV.mjs +0 -2
- /package/out/__chunks__/{chunk-J3PAP5L7.mjs.map → chunk-2BKGSHOR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-WZMOKJRU.mjs.map → chunk-2FRFDBKB.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-G6BDMW4E.mjs.map → chunk-2IANAIWP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-256UVPBB.mjs.map → chunk-3PTO3UT5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PDHQOTBR.mjs.map → chunk-3V7L7VMK.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ITI5ANFI.mjs.map → chunk-5BYHDDZU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-YJ4UF7WR.mjs.map → chunk-5IJGFJ7A.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ZOQVPZWZ.mjs.map → chunk-5MSC5VEJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5VJEMKRJ.mjs.map → chunk-5TY2NRTY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-LFIRLUYG.mjs.map → chunk-5V3ZVJ5N.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5L36FGFX.mjs.map → chunk-6KJDFL4X.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-APPNCPKI.mjs.map → chunk-6TAFMLIP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HRRO627B.mjs.map → chunk-6V32BQRW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-5ERDAMIE.mjs.map → chunk-74YKEHCU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-TKIMRAZN.mjs.map → chunk-7GTKSPKR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ZNXVHDZB.mjs.map → chunk-7I7SJXVG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-EX3G2KOJ.mjs.map → chunk-7SHSB2H7.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-4HVKYSYB.mjs.map → chunk-AWV2BT4N.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-R3JJ2K6E.mjs.map → chunk-BFYSNMGP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KWPLSEMY.mjs.map → chunk-CIUJ7Q6E.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-WIPFIC6A.mjs.map → chunk-CUMVG6S5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RFR7PHXZ.mjs.map → chunk-DGANJCHG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2M3OATOJ.mjs.map → chunk-DKMTA3CC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-CRTAVEFT.mjs.map → chunk-EELETY3Z.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-EGEQQSOM.mjs.map → chunk-EPRQ5A6W.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-A2DCRR56.mjs.map → chunk-EUJRQFQG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-DGFYEV3J.mjs.map → chunk-EXE2PPR4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UOLQAHFF.mjs.map → chunk-FCB3AT5J.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-Y33JH2RH.mjs.map → chunk-FJD2WVYA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-J7UVIFYD.mjs.map → chunk-GECW34DV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-EH5ZLMLQ.mjs.map → chunk-GKM7KNTV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AUIQ4KU5.mjs.map → chunk-GRZU3CBF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3GLS46GV.mjs.map → chunk-HROVYEVW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-MRMPIS2Z.mjs.map → chunk-HWWLVGYU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-DDETOX7N.mjs.map → chunk-I3C6RYN6.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-YGEY6NOV.mjs.map → chunk-IRP5CFO7.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-K2CYC6YQ.mjs.map → chunk-IRQV762M.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PEET56XV.mjs.map → chunk-IUCITH6E.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KDBMGECR.mjs.map → chunk-JOX3TPDC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-LVGH7JBF.mjs.map → chunk-JSA535AB.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RCAOCVBC.mjs.map → chunk-K2QNLOBA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-CY733W4L.mjs.map → chunk-KC6QWZ4R.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VLDGQL7B.mjs.map → chunk-KONLNCQL.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-BOXGW3SR.mjs.map → chunk-MWOVK6GV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-K2Z5JQB6.mjs.map → chunk-N4CXXF6R.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3AIY3TW7.mjs.map → chunk-NAQ3AWXW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QBV3NGRD.mjs.map → chunk-OAVLO5YR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-H3COTSYJ.mjs.map → chunk-OTSQGZLA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UGRA4C4Z.mjs.map → chunk-OWA27GTK.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-MLPNNQ52.mjs.map → chunk-OZYD32IW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QVQOCBO6.mjs.map → chunk-P5BMCXKE.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ZPELMVTN.mjs.map → chunk-P6DSLB4K.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VLWMD34B.mjs.map → chunk-PR2UXLUQ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-E2QSDBTZ.mjs.map → chunk-QT3PF6MA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JV5L4B73.mjs.map → chunk-R2OXRDF3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2YEAP742.mjs.map → chunk-R64XZNJM.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-6QDSNTK4.mjs.map → chunk-SCIOG3JW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-BT423XM3.mjs.map → chunk-SDF6BSQJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UU3MJKEM.mjs.map → chunk-SJWV7RWT.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-76AWPVM4.mjs.map → chunk-SV3NP6BV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2POJ7MH5.mjs.map → chunk-SWV35LLA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ARLGL5IH.mjs.map → chunk-SY2OIXRY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-43ZS3ORV.mjs.map → chunk-T4GLMTGR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-NLEPTN7T.mjs.map → chunk-U3CB72I3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RS457CD4.mjs.map → chunk-UBOX3NGQ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HEK7IPGE.mjs.map → chunk-UKFG6RD4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XUNR4H62.mjs.map → chunk-VGHFJYHY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HTUNEXJ6.mjs.map → chunk-WEDTMPCV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2IEPFE4D.mjs.map → chunk-WMSBYBUV.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AJA2CGU3.mjs.map → chunk-WTCCK3ZP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-BWBRRDTJ.mjs.map → chunk-WW4U7UI2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-Y3HLH5WI.mjs.map → chunk-XLBZPLWQ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VXBGAYMV.mjs.map → chunk-XQL64G6I.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ZQLEJXPX.mjs.map → chunk-XU7FAZR4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-TI2TATUO.mjs.map → chunk-YDKZQMFY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SQDP4UCG.mjs.map → chunk-YLGQ3PM4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-TUMBWNGY.mjs.map → chunk-YVVVV5XJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SWW3XXSG.mjs.map → chunk-ZJ7L5STS.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VXZLPVLU.mjs.map → chunk-ZNCLQODX.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{s as r}from"./chunk-EXE2PPR4.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-2BKGSHOR.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-YG6GGSSN.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-2FRFDBKB.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S}from"./chunk-EAJBSX6Y.mjs";import{a as s}from"./chunk-SQ3EODA7.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-SQ3EODA7.mjs";import{c as r,d as a}from"./chunk-M6MN4RXG.mjs";import{s as e}from"./chunk-EXE2PPR4.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-2IANAIWP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S}from"./chunk-ZATPIKZ2.mjs";import{j as p,k as d,l as f,n as u}from"./chunk-E2GGD7D4.mjs";import{a as I}from"./chunk-XXV6KGR4.mjs";import{a as m}from"./chunk-NGM3AVCY.mjs";import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as S}from"./chunk-ZATPIKZ2.mjs";import{j as p,k as d,l as f,n as u}from"./chunk-E2GGD7D4.mjs";import{a as I}from"./chunk-XXV6KGR4.mjs";import{a as m}from"./chunk-NGM3AVCY.mjs";import{a as l}from"./chunk-BFYSNMGP.mjs";import{s as T}from"./chunk-EXE2PPR4.mjs";import{c}from"./chunk-UERJ6AKK.mjs";async function G(g){let s=g?.store??T(),n=[],a=[],y=I(s),F=m(s),C=c(s);for(let o of y.transactionToasts){let r=F[o.toastId];if(!r?.status)continue;let{status:t,transactions:P,transactionsDisplayInfo:h}=r,L=await l({transactions:P,store:s}),O=u(t),R=f(t),v=d(t),e=O||R||v,w=p(t),{startTime:x,endTime:D}=o;if(e&&a.some(b=>b.toastId===o.toastId))continue;let i=S({toastId:o.toastId,address:C,status:t,transactions:L,transactionsDisplayInfo:h,startTime:x,endTime:D});e&&a.push(i),w&&n.push(i)}return{pendingTransactionToasts:n,completedTransactionToasts:a}}export{G as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3PTO3UT5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{s as e}from"./chunk-EXE2PPR4.mjs";import{b as o}from"./chunk-7VHTZYM2.mjs";import{a as i}from"./chunk-CKTFPRJS.mjs";var n="https://api.multiversx.com",s=60*60*24,a=5*60,d=t=>{let r=o(e());return{origin:t?.origin||i().origin,apiAddress:t?.apiAddress||r.apiAddress||n,expirySeconds:t?.expirySeconds||s,tokenExpirationToastWarningSeconds:t?.tokenExpirationToastWarningSeconds||a}};export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3V7L7VMK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p}from"./chunk-MWOVK6GV.mjs";import{a as u}from"./chunk-REYJ4EFS.mjs";import{a as i}from"./chunk-W5MTQBQF.mjs";import{a as T}from"./chunk-HMAL7GVA.mjs";import{a as m}from"./chunk-U3UMCTU6.mjs";import{a as k}from"./chunk-YJCTRUJT.mjs";import{c as l}from"./chunk-PJWJZHIS.mjs";import{a as o}from"./chunk-KSC3RFHN.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-5BYHDDZU.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{q as o}from"./chunk-EXE2PPR4.mjs";import{a as c}from"./chunk-JMC7CMTU.mjs";var p=t=>{o().setState(({account:e})=>{let s=e.address===t.address;e.accounts={[e.address]:s?t:c}},!1,{type:"setAccount",payload:{value:t}})},r=t=>o().setState(({account:e})=>{e.ledgerAccount=t},!1,{type:"setLedgerAccount",payload:{value:t}}),u=t=>o().setState(({account:e})=>{e.walletConnectAccount=t},!1,{type:"setWalletConnectAccount",payload:{value:t}}),l=t=>o().setState(({account:e})=>{e.websocketEvent={timestamp:Date.now(),message:t}},!1,{type:"setWebsocketEvent",payload:{value:t}}),d=t=>o().setState(({account:e})=>{e.websocketBatchEvent={timestamp:Date.now(),data:t}},!1,{type:"setWebsocketBatchEvent",payload:{value:t}}),y=t=>{o().setState(({account:e})=>{e.accounts[e.address].nonce=t},!1,{type:"setAccountNonce",payload:{value:t}})};export{p as a,r as b,u as c,l as d,d as e,y as f};
|
|
2
|
+
//# sourceMappingURL=chunk-5IJGFJ7A.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-K2QNLOBA.mjs";import{a as t}from"./chunk-74YKEHCU.mjs";var i=class extends n{constructor({uiDataUpdateEvent:e,uiTag:s}){super({uiDataUpdateEvent:e,uiTag:s});this.isOpen=!1;this.data=this.getInitialData()}async openUI(){this.isOpen&&this.uiElement||(await super.init(),this.setIsSidePanelOpen(!0))}destroy(){if(this.setIsSidePanelOpen(!1),this.uiElement?.closeWithAnimation){this.uiElement?.closeWithAnimation?.().finally(()=>{super.destroy()});return}super.destroy()}closeUI(){this.resetData(),this.destroy()}setIsSidePanelOpen(e){this.isOpen=e,t(e)}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5MSC5VEJ.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-T4GLMTGR.mjs";import{c as n}from"./chunk-EXE2PPR4.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-5TY2NRTY.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./chunk-P5BMCXKE.mjs";import{a as o}from"./chunk-PMHRZ5Y7.mjs";import{b as i}from"./chunk-P6DSLB4K.mjs";import{j as r}from"./chunk-E2GGD7D4.mjs";import{s as n}from"./chunk-EXE2PPR4.mjs";async function E({transaction:a,sessionId:s}){let c=a.results?.find(t=>t?.returnMessage!=="");e({sessionId:s,transaction:{...a,status:"fail",inTransit:!1}});let{transactions:m}=n();m?.[s]?.transactions?.some(t=>r(t.status))||(i({sessionId:s,status:"fail",errorMessage:c?.returnMessage}),await o({sessionId:s,status:"fail"}))}export{E as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5V3ZVJ5N.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as r}from"./chunk-XLBZPLWQ.mjs";import{a as o}from"./chunk-WE7YOBO7.mjs";async function p({loginToken:i,extraInfoData:n}){if(i==null||Object.keys(n).length===0)return null;let t=o(String(i)),{timestamp:e,...a}=t?.extraInfo||{};if(!(t&&e!=null))return null;let s={hash:String(t?.blockHash),timestamp:Number(e)};return await r({extraInfo:{...a,...n},expirySeconds:t?.ttl,origin:t?.origin}).initialize({latestBlockInfo:s})}export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6KJDFL4X.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-K2QNLOBA.mjs";var n=class t extends e{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE",uiTag:"mvx-wallet-connect"});this.initialData={wcURI:"",walletConnectDeepLink:""};this.data={...this.initialData}}static getInstance(){return t.instance||(t.instance=new t),t.instance}handleClose(a){a?.isLoginFinished||(this.anchor?this.anchor.dispatchEvent(new CustomEvent("ANCHOR_CLOSE",{composed:!1,bubbles:!1})):this.destroy())}async setupEventListeners(){this.eventBus&&(this.eventBus.subscribe("CLOSE",this.handleClose.bind(this)),this.eventBus.subscribe("UI_DISCONNECTED",this.destroy.bind(this)))}};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6TAFMLIP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as St}from"./chunk-76AWPVM4.mjs";import{a as dt}from"./chunk-EX3G2KOJ.mjs";import{a as vt}from"./chunk-6UZHM5LW.mjs";import{a as w}from"./chunk-256UVPBB.mjs";import{a as wt}from"./chunk-VXZLPVLU.mjs";import{a as bt}from"./chunk-RS457CD4.mjs";import{a as It}from"./chunk-DDETOX7N.mjs";import{a as Et}from"./chunk-TKIMRAZN.mjs";import{a as Ct}from"./chunk-ABBDCZHP.mjs";import{a as Mt}from"./chunk-4ODPAHHA.mjs";import{a as Nt}from"./chunk-TUMBWNGY.mjs";import{b as x}from"./chunk-VLWMD34B.mjs";import{a as xt}from"./chunk-USQUPGRC.mjs";import{a as At}from"./chunk-5VJEMKRJ.mjs";import{a as Pt}from"./chunk-MDVI45IV.mjs";import{a as Ot}from"./chunk-K2CYC6YQ.mjs";import{a as v}from"./chunk-BT423XM3.mjs";import{a as it}from"./chunk-2YEAP742.mjs";import{a as ht}from"./chunk-ZOQVPZWZ.mjs";import{a as E}from"./chunk-PEET56XV.mjs";import{a as A,f as yt}from"./chunk-YJ4UF7WR.mjs";import{b as L,d as gt}from"./chunk-ZPELMVTN.mjs";import{k as pt,l as lt,n as Tt}from"./chunk-E2GGD7D4.mjs";import{b as Lt}from"./chunk-EGEQQSOM.mjs";import{a as N}from"./chunk-HORSXVIV.mjs";import{a as Ft}from"./chunk-2POJ7MH5.mjs";import{a as nt}from"./chunk-Y3HLH5WI.mjs";import{a as C}from"./chunk-QTKK6OSJ.mjs";import{a as et}from"./chunk-6ACLOUQ3.mjs";import{a as I}from"./chunk-G7GU37XI.mjs";import{a as st}from"./chunk-YSCND2MX.mjs";import{a as Rt}from"./chunk-NJN53MJV.mjs";import{a as rt,b as ct,g as ut,l as mt}from"./chunk-M6MN4RXG.mjs";import{b as at}from"./chunk-NGM3AVCY.mjs";import{a as tt,b as ot,q as u,s as g}from"./chunk-DGFYEV3J.mjs";import{c as V,d as Y,f as J}from"./chunk-UERJ6AKK.mjs";import{b as h}from"./chunk-VNLGNNIL.mjs";import{b as S}from"./chunk-6JM4DPOH.mjs";import{b as Q,c as X,f as Z}from"./chunk-NTEMINYA.mjs";import{b as kt}from"./chunk-UCRVRBTA.mjs";import{a as ft}from"./chunk-UOLQAHFF.mjs";import{c as $}from"./chunk-QBV3NGRD.mjs";import{a as b}from"./chunk-LJX4MW7B.mjs";import K from"bignumber.js";import G from"lodash.isequal";var Bt=1e4,O=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=Bt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let o=setTimeout(()=>{F(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,o)};this.startWithCustomDuration=(t,o)=>{if(this.stop(t),o<=0)return;let e=setTimeout(()=>{P(t);let n=f[t];n?.()},o);this.timeoutIntervals.set(t,e)};this.stop=t=>{let o=this.timeoutIntervals.get(t);o&&(clearTimeout(o),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t??Bt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};import Dt from"lodash.isequal";var Yt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",M=class s extends ht{constructor(o){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.initialData={pendingTransactions:[],historicTransactions:[]};this.store=o||u(),this.data={...this.initialData}}static getInstance(){return s.instance||(s.instance=new s),s.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){d.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let e=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Dt(r.transactionToasts,n.transactionToasts)||!Dt(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Yt,[e]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let o=d.getInstance();this.closeUI(),await o.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:o}=this.store.getState(),{pendingTransactionToasts:e}=await w();this.data.pendingTransactions=e;let n=Object.keys(o).reduce((i,r)=>(["sent","pending"].includes(String(o[r].status))||(i[r]=o[r]),i),{});this.data.historicTransactions=await dt.getTransactionsHistory({transactionsSessions:n}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){gt(),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 k=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||M.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 o=await this.createToastListElement();if(!o)return;this.eventBus=await o.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 ft.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 s{constructor(t){this.transactionToasts=[];this.customToasts=[];this.unsubscribeFromStore=()=>null;this.uiCoordinator=null;this.destroy(),this.store=t?.store||u(),this.lifetimeManager=t?.lifetimeManager??new O,this.uiCoordinator=t?.uiCoordinator??new k({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:o,transactions:e},{toasts:n,transactions:i})=>{let r=!G(n.transactionToasts,o.transactionToasts),c=!G(i,e);(r||c)&&await this.updateTransactionToastsList(),!G(n.customToasts,o.customToasts)&&await this.updateCustomToastList()})}static getInstance(){return s.instance||(s.instance=new s),s.instance}handleCompletedTransaction(t){let{transactions:o}=this.store.getState(),e=o[t];if(!e)return!1;let{status:n}=e,i=Tt(n),r=lt(n),c=pt(n),a=r||c||i;return a?(this.successfulToastLifetime&&this.lifetimeManager.start(t),a):(this.lifetimeManager.stop(t),a)}async createTransactionToast(t,o){let e=_t({toastId:t,totalDuration:o});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),e}async createCustomToast(t){let o=B(t);return await this.updateCustomToastList(),o}async updateTransactionToastsList(){let t=this.store.getState(),{toasts:o}=t,{pendingTransactionToasts:e,completedTransactionToasts:n}=await w({store:t});this.transactionToasts=[...e,...n];for(let i of o.transactionToasts)this.handleCompletedTransaction(i.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let o of t.customToasts){let n="message"in o?{...o}:{...o,instantiateToastElement:R[o.toastId]};this.customToasts.push(n),o.duration&&this.lifetimeManager.startWithCustomDuration(o.toastId,o.duration)}await this.uiCoordinator?.publishCustomToasts(this.customToasts)}handleTransactionToastClose(t){return this.handleCompletedTransaction(t)?(F(t),!0):!1}async showToasts(){this.uiCoordinator?.showToasts(),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.uiCoordinator?.hideToasts()}closeToast(t){if(this.customToasts.find(e=>e.toastId===t)){this.lifetimeManager.stop(t);let e=f[t];return e?.(),P(t),!0}return this.handleTransactionToastClose(t)}async publishTransactionToasts(){await this.uiCoordinator?.publishTransactionToasts(this.transactionToasts)}destroy(){this.unsubscribeFromStore(),this.lifetimeManager?.destroy(),this.uiCoordinator?.destroy(),Ut()}};var D=class s{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(),o=h(t),{isExpired:e}=C(o?.nativeAuthToken);e?y().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(),o=h(t),e=J(t);return!!(o?.nativeAuthToken&&e)};this.addPlannedLogout=()=>{let t=y(),o=V(this.store.getState()),e=t.getType()===b.webview;if(!o||e)return;this.addLogoutWarning();let n=h(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=C(n?.nativeAuthToken),c=new K(String(i)),a=`${o}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let l=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{d.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"close",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},l.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},l.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=S(this.store.getState()),o=h(this.store.getState()),{secondsUntilExpires:e}=C(o?.nativeAuthToken),n=new K(String(e)),i=n.times(1e3);if(!e||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new K(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=vt(i.toNumber()),p=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},p)}}static getInstance(){return s.instance||(s.instance=new s),s.instance}};async function Wt({sessionId:s,transactionBatch:t,isSequential:o}){try{if(t==null)return;let e=bt(),n=Ct(t),i=await St(n);for(let T of i)await It({serverTransaction:T,sessionId:s,isSequential:o});if(!i.every(T=>T.status!=="pending"))return;e&&await U();let{transactions:c}=g(),a=c?.[s];if(a.transactions.every(T=>T.status==="success"))return L({sessionId:s,status:"success"});if(a.transactions.some(T=>T.status==="fail"))return L({sessionId:s,status:"fail"});if(a.transactions.every(T=>T.status==="not executed"))return L({sessionId:s,status:"invalid"})}catch(e){console.error(e)}}async function Ht(){let s=at(g()),t=Object.entries(s);t.length!==0&&await Promise.all(t.map(([o,{transactions:e}])=>Wt({sessionId:o,transactionBatch:e})))}async function _(){let s=u(),t=Et(),o=null,e=Y(s.getState())?.timestamp??null,n=async()=>{try{await Ht()}catch(p){console.error("[trackTransactions] Error checking transaction status:",p)}},i=()=>{o||(o=setInterval(n,t))},r=()=>{o&&(clearInterval(o),o=null)},c=()=>{r();let p=s.subscribe(({account:{websocketEvent:l}})=>{l?.message&&l.timestamp!=null&&e!==l.timestamp&&(e=l.timestamp,n())});$.set("websocketEventReceived",p)};n();let a=()=>{r()},m=s.subscribe(({account:{address:p},config:{websocketStatus:l}},T)=>{if(T.config.websocketStatus!==l)switch(l){case"completed":c();break;case"pending":i();break;default:p?i():a();break}});return $.set("websocketStatusChanged",m),{stopTransactionsTracking:a}}async function j({address:s,provider:t,apiAddress:o}){let e=await I({address:s,baseURL:o});if(!e)throw new Error("Account not found");Lt({address:s,providerType:t.getType()});let n={...e,username:N(e.username),nonce:E(e)};A(n),await x(s),_(),e.shard!=null&&await wt({shard:Number(e.shard),apiAddress:o})}async function Qt(s){let{network:{apiAddress:t}}=v();await s.login();let o=await s.getAddress();if(!o)throw new Error("Address not found");return await j({address:o,provider:s,apiAddress:t}),{address:o}}async function Xt({provider:s,nativeAuthConfig:t,token:o}){let{network:{apiAddress:e}}=v(),n=nt(t),i=o;i||(i=await n.initialize({noCache:!0}));let r=await s.login({token:i}),{address:c,signature:a,...m}=r;if(!c)return console.warn("Login cancelled."),null;if(!a)return console.error("Failed to sign login token"),null;let p=et(m?.accessToken),l=await xt({loginData:r,nativeAuthConfig:t,loginToken:i}),T=p?m.accessToken:n.getToken({address:c,token:l,signature:a});ot({loginToken:i,signature:a,nativeAuthToken:T});let H=await At({loginToken:i,extraInfoData:{multisig:m?.multisig,impersonate:m?.impersonate},address:c});return await j({address:H,provider:s,apiAddress:e}),{address:H,signature:a}}async function $t(s,t){let o=S(g());if(o)return await Xt({provider:s,nativeAuthConfig:o,token:t?.token});let{address:e}=await Qt(s);return await x(e),_(),{address:e,signature:""}}var z={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${ct}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${rt}-${Date.now()}`}},Zt={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"},to=s=>{for(let[t,o]of Object.entries(Zt))if(s.includes(t))return o;return"Error when signing"};function q(s,t="error"){let o=s?.message,e=to(o),i=e!=="Error when signing"?"warning":t,r=Object.keys(z).includes(i)?z[i]:z.error,{toastId:c,iconClassName:a,title:m}=r;return B({toastId:c,duration:1e4,icon:"close",iconClassName:a,message:e,title:m}),e}async function Gt({provider:s,transactions:t,options:o={}}){await U();let{isGuarded:e,activeGuardianAddress:n,nonce:i}=Ft(),r=s.getType()===b.ledger,c=Mt({latestNonce:i,transactions:t}),a=n&&e&&!o.skipGuardian?c?.map(p=>(p.version=Q.withTxOptions().valueOf(),p.options=Z.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),p.guardian=X.newFromBech32(n),p)):c,m=await s.signTransactions(a)??[];return yt(i+m.length),m}var W=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let o=await $t(this.provider,t);return tt(this.provider.getType()),Kt(this),D.getInstance().init(),o}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 o=await Nt({provider:this.provider,options:t});return this._isLoggingOut=!1,o}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,o){try{return await Gt({provider:this.provider,transactions:t,options:o})}catch(e){let n=q(e);throw new Error(n)}}async signMessage(t,o){try{return await Ot({provider:this.provider,message:t,options:o})}catch(e){let n=q(e,"warning");throw new Error(n)}}async verifyMessage(t){return await Pt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var jt=null;function Kt(s){jt=s}function y(){return jt||new W(kt)}var oo=async()=>{try{let s=it(),{network:t}=v();try{let o=await I({address:s,baseURL:t.apiAddress});if(o!=null){let e={...o,username:N(o.username),nonce:E(o)};return A(e),e}}catch(o){console.error("Failed getting account ",o)}}catch(s){console.error("Failed getting address ",s)}return null};async function U(){let s=y();if(s==null)throw"Provider not initialized";try{if(!s.init)throw"Current provider does not have init() function";return await s.init()?await oo():void 0}catch(t){console.error("Failed initializing provider ",t)}}var R={},f={},so=(s,t)=>{u().setState(({toasts:o})=>{let e=o.customToasts.length>0?Math.max(...o.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${e+1}`,i=o.customToasts.findIndex(a=>a.toastId===n),r={...s,toastId:n};if(i!==-1){o.customToasts[i]=r;return}o.customToasts.push({...r,toastId:n})},!1,{type:"addCustomToast",payload:{value:{customToast:s,currentToastId:t}}})},P=s=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(o=>o.toastId!==s)},!1,{type:"removeCustomToast",payload:{value:s}})},Ut=()=>{u().setState(({toasts:s})=>{s.customToasts=[]},!1,{type:"removeAllCustomToasts",payload:{value:null}})},an=()=>{u().setState(({toasts:s})=>{s.transactionToasts=[]})},_t=({toastId:s,totalDuration:t})=>{let o="";return u().setState(({toasts:e})=>{let n=e.transactionToasts.length>0?Math.max(...e.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;o=s??`transaction-toast-${n+1}`,e.transactionToasts.push({startTime:st(),endTime:Rt(t),toastId:o})},!1,"addTransactionToast"),o},F=s=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(o=>o.toastId!==s)},!1,"removeTransactionToast"),delete f[s],delete R[s]},B=s=>{let{toasts:t}=u().getState(),o=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,e=s.toastId||`custom-toast-${o+1}`;return s.onClose&&(f[e]=s.onClose),s.instantiateToastElement?(R[e]=s.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===e),r={...s,instantiateToastElement:null,toastId:e};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),e):(so(s,e),e)};export{R as a,f as b,so as c,P as d,Ut as e,an as f,_t as g,F as h,B as i,O as j,M as k,k as l,d as m,D as n,Wt as o,Ht as p,_ as q,j as r,$t as s,q as t,Gt as u,W as v,Kt as w,y as x,U as y};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as St}from"./chunk-SV3NP6BV.mjs";import{a as dt}from"./chunk-7SHSB2H7.mjs";import{a as vt}from"./chunk-6UZHM5LW.mjs";import{a as w}from"./chunk-3PTO3UT5.mjs";import{a as wt}from"./chunk-ZNCLQODX.mjs";import{a as bt}from"./chunk-UBOX3NGQ.mjs";import{a as It}from"./chunk-I3C6RYN6.mjs";import{a as Et}from"./chunk-7GTKSPKR.mjs";import{a as Ct}from"./chunk-ABBDCZHP.mjs";import{a as Mt}from"./chunk-4ODPAHHA.mjs";import{a as Nt}from"./chunk-YVVVV5XJ.mjs";import{b as x}from"./chunk-PR2UXLUQ.mjs";import{a as xt}from"./chunk-XJPDM2YR.mjs";import{a as At}from"./chunk-5TY2NRTY.mjs";import{a as Pt}from"./chunk-MDVI45IV.mjs";import{a as Ot}from"./chunk-IRQV762M.mjs";import{a as v}from"./chunk-SDF6BSQJ.mjs";import{a as it}from"./chunk-R64XZNJM.mjs";import{a as ht}from"./chunk-5MSC5VEJ.mjs";import{a as E}from"./chunk-IUCITH6E.mjs";import{a as A,f as yt}from"./chunk-5IJGFJ7A.mjs";import{b as L,d as gt}from"./chunk-P6DSLB4K.mjs";import{k as pt,l as lt,n as Tt}from"./chunk-E2GGD7D4.mjs";import{b as Lt}from"./chunk-EPRQ5A6W.mjs";import{a as N}from"./chunk-HORSXVIV.mjs";import{a as Ft}from"./chunk-SWV35LLA.mjs";import{a as nt}from"./chunk-XLBZPLWQ.mjs";import{a as C}from"./chunk-QTKK6OSJ.mjs";import{a as et}from"./chunk-6ACLOUQ3.mjs";import{a as I}from"./chunk-G7GU37XI.mjs";import{a as st}from"./chunk-YSCND2MX.mjs";import{a as Rt}from"./chunk-NJN53MJV.mjs";import{a as rt,b as ct,g as ut,l as mt}from"./chunk-M6MN4RXG.mjs";import{b as at}from"./chunk-NGM3AVCY.mjs";import{a as tt,b as ot,q as u,s as g}from"./chunk-EXE2PPR4.mjs";import{c as V,d as Y,f as J}from"./chunk-UERJ6AKK.mjs";import{b as h}from"./chunk-VNLGNNIL.mjs";import{b as S}from"./chunk-6JM4DPOH.mjs";import{b as Q,c as X,f as Z}from"./chunk-NTEMINYA.mjs";import{b as kt}from"./chunk-UCRVRBTA.mjs";import{a as ft}from"./chunk-FCB3AT5J.mjs";import{c as $}from"./chunk-OAVLO5YR.mjs";import{a as b}from"./chunk-LJX4MW7B.mjs";import K from"bignumber.js";import G from"lodash.isequal";var Bt=1e4,O=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=Bt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let o=setTimeout(()=>{F(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,o)};this.startWithCustomDuration=(t,o)=>{if(this.stop(t),o<=0)return;let e=setTimeout(()=>{P(t);let n=f[t];n?.()},o);this.timeoutIntervals.set(t,e)};this.stop=t=>{let o=this.timeoutIntervals.get(t);o&&(clearTimeout(o),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t??Bt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};import Dt from"lodash.isequal";var Yt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",M=class s extends ht{constructor(o){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.initialData={pendingTransactions:[],historicTransactions:[]};this.store=o||u(),this.data={...this.initialData}}static getInstance(){return s.instance||(s.instance=new s),s.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){d.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let e=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Dt(r.transactionToasts,n.transactionToasts)||!Dt(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Yt,[e]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let o=d.getInstance();this.closeUI(),await o.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:o}=this.store.getState(),{pendingTransactionToasts:e}=await w();this.data.pendingTransactions=e;let n=Object.keys(o).reduce((i,r)=>(["sent","pending"].includes(String(o[r].status))||(i[r]=o[r]),i),{});this.data.historicTransactions=await dt.getTransactionsHistory({transactionsSessions:n}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){gt(),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 k=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||M.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 o=await this.createToastListElement();if(!o)return;this.eventBus=await o.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 ft.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 s{constructor(t){this.transactionToasts=[];this.customToasts=[];this.unsubscribeFromStore=()=>null;this.uiCoordinator=null;this.destroy(),this.store=t?.store||u(),this.lifetimeManager=t?.lifetimeManager??new O,this.uiCoordinator=t?.uiCoordinator??new k({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:o,transactions:e},{toasts:n,transactions:i})=>{let r=!G(n.transactionToasts,o.transactionToasts),c=!G(i,e);(r||c)&&await this.updateTransactionToastsList(),!G(n.customToasts,o.customToasts)&&await this.updateCustomToastList()})}static getInstance(){return s.instance||(s.instance=new s),s.instance}handleCompletedTransaction(t){let{transactions:o}=this.store.getState(),e=o[t];if(!e)return!1;let{status:n}=e,i=Tt(n),r=lt(n),c=pt(n),a=r||c||i;return a?(this.successfulToastLifetime&&this.lifetimeManager.start(t),a):(this.lifetimeManager.stop(t),a)}async createTransactionToast(t,o){let e=_t({toastId:t,totalDuration:o});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),e}async createCustomToast(t){let o=B(t);return await this.updateCustomToastList(),o}async updateTransactionToastsList(){let t=this.store.getState(),{toasts:o}=t,{pendingTransactionToasts:e,completedTransactionToasts:n}=await w({store:t});this.transactionToasts=[...e,...n];for(let i of o.transactionToasts)this.handleCompletedTransaction(i.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let o of t.customToasts){let n="message"in o?{...o}:{...o,instantiateToastElement:R[o.toastId]};this.customToasts.push(n),o.duration&&this.lifetimeManager.startWithCustomDuration(o.toastId,o.duration)}await this.uiCoordinator?.publishCustomToasts(this.customToasts)}handleTransactionToastClose(t){return this.handleCompletedTransaction(t)?(F(t),!0):!1}async showToasts(){this.uiCoordinator?.showToasts(),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.uiCoordinator?.hideToasts()}closeToast(t){if(this.customToasts.find(e=>e.toastId===t)){this.lifetimeManager.stop(t);let e=f[t];return e?.(),P(t),!0}return this.handleTransactionToastClose(t)}async publishTransactionToasts(){await this.uiCoordinator?.publishTransactionToasts(this.transactionToasts)}destroy(){this.unsubscribeFromStore(),this.lifetimeManager?.destroy(),this.uiCoordinator?.destroy(),Ut()}};var D=class s{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(),o=h(t),{isExpired:e}=C(o?.nativeAuthToken);e?y().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(),o=h(t),e=J(t);return!!(o?.nativeAuthToken&&e)};this.addPlannedLogout=()=>{let t=y(),o=V(this.store.getState()),e=t.getType()===b.webview;if(!o||e)return;this.addLogoutWarning();let n=h(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=C(n?.nativeAuthToken),c=new K(String(i)),a=`${o}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let l=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{d.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"close",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},l.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},l.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=S(this.store.getState()),o=h(this.store.getState()),{secondsUntilExpires:e}=C(o?.nativeAuthToken),n=new K(String(e)),i=n.times(1e3);if(!e||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new K(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=vt(i.toNumber()),p=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},p)}}static getInstance(){return s.instance||(s.instance=new s),s.instance}};async function Wt({sessionId:s,transactionBatch:t,isSequential:o}){try{if(t==null)return;let e=bt(),n=Ct(t),i=await St(n);for(let T of i)await It({serverTransaction:T,sessionId:s,isSequential:o});if(!i.every(T=>T.status!=="pending"))return;e&&await U();let{transactions:c}=g(),a=c?.[s];if(a.transactions.every(T=>T.status==="success"))return L({sessionId:s,status:"success"});if(a.transactions.some(T=>T.status==="fail"))return L({sessionId:s,status:"fail"});if(a.transactions.every(T=>T.status==="not executed"))return L({sessionId:s,status:"invalid"})}catch(e){console.error(e)}}async function Ht(){let s=at(g()),t=Object.entries(s);t.length!==0&&await Promise.all(t.map(([o,{transactions:e}])=>Wt({sessionId:o,transactionBatch:e})))}async function _(){let s=u(),t=Et(),o=null,e=Y(s.getState())?.timestamp??null,n=async()=>{try{await Ht()}catch(p){console.error("[trackTransactions] Error checking transaction status:",p)}},i=()=>{o||(o=setInterval(n,t))},r=()=>{o&&(clearInterval(o),o=null)},c=()=>{r();let p=s.subscribe(({account:{websocketEvent:l}})=>{l?.message&&l.timestamp!=null&&e!==l.timestamp&&(e=l.timestamp,n())});$.set("websocketEventReceived",p)};n();let a=()=>{r()},m=s.subscribe(({account:{address:p},config:{websocketStatus:l}},T)=>{if(T.config.websocketStatus!==l)switch(l){case"completed":c();break;case"pending":i();break;default:p?i():a();break}});return $.set("websocketStatusChanged",m),{stopTransactionsTracking:a}}async function j({address:s,provider:t,apiAddress:o}){let e=await I({address:s,baseURL:o});if(!e)throw new Error("Account not found");Lt({address:s,providerType:t.getType()});let n={...e,username:N(e.username),nonce:E(e)};A(n),await x(s),_(),e.shard!=null&&await wt({shard:Number(e.shard),apiAddress:o})}async function Qt(s){let{network:{apiAddress:t}}=v();await s.login();let o=await s.getAddress();if(!o)throw new Error("Address not found");return await j({address:o,provider:s,apiAddress:t}),{address:o}}async function Xt({provider:s,nativeAuthConfig:t,token:o}){let{network:{apiAddress:e}}=v(),n=nt(t),i=o;i||(i=await n.initialize({noCache:!0}));let r=await s.login({token:i}),{address:c,signature:a,...m}=r;if(!c)return console.warn("Login cancelled."),null;if(!a)return console.error("Failed to sign login token"),null;let p=et(m?.accessToken),l=await xt({loginData:r,nativeAuthConfig:t,loginToken:i}),T=p?m.accessToken:n.getToken({address:c,token:l,signature:a});ot({loginToken:i,signature:a,nativeAuthToken:T});let H=await At({loginToken:i,extraInfoData:{multisig:m?.multisig,impersonate:m?.impersonate},address:c});return await j({address:H,provider:s,apiAddress:e}),{address:H,signature:a}}async function $t(s,t){let o=S(g());if(o)return await Xt({provider:s,nativeAuthConfig:o,token:t?.token});let{address:e}=await Qt(s);return await x(e),_(),{address:e,signature:""}}var z={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${ct}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${rt}-${Date.now()}`}},Zt={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"},to=s=>{for(let[t,o]of Object.entries(Zt))if(s.includes(t))return o;return"Error when signing"};function q(s,t="error"){let o=s?.message,e=to(o),i=e!=="Error when signing"?"warning":t,r=Object.keys(z).includes(i)?z[i]:z.error,{toastId:c,iconClassName:a,title:m}=r;return B({toastId:c,duration:1e4,icon:"close",iconClassName:a,message:e,title:m}),e}async function Gt({provider:s,transactions:t,options:o={}}){await U();let{isGuarded:e,activeGuardianAddress:n,nonce:i}=Ft(),r=s.getType()===b.ledger,c=Mt({latestNonce:i,transactions:t}),a=n&&e&&!o.skipGuardian?c?.map(p=>(p.version=Q.withTxOptions().valueOf(),p.options=Z.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),p.guardian=X.newFromBech32(n),p)):c,m=await s.signTransactions(a)??[];return yt(i+m.length),m}var W=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let o=await $t(this.provider,t);return tt(this.provider.getType()),Kt(this),D.getInstance().init(),o}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 o=await Nt({provider:this.provider,options:t});return this._isLoggingOut=!1,o}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,o){try{return await Gt({provider:this.provider,transactions:t,options:o})}catch(e){let n=q(e);throw new Error(n)}}async signMessage(t,o){try{return await Ot({provider:this.provider,message:t,options:o})}catch(e){let n=q(e,"warning");throw new Error(n)}}async verifyMessage(t){return await Pt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var jt=null;function Kt(s){jt=s}function y(){return jt||new W(kt)}var oo=async()=>{try{let s=it(),{network:t}=v();try{let o=await I({address:s,baseURL:t.apiAddress});if(o!=null){let e={...o,username:N(o.username),nonce:E(o)};return A(e),e}}catch(o){console.error("Failed getting account ",o)}}catch(s){console.error("Failed getting address ",s)}return null};async function U(){let s=y();if(s==null)throw"Provider not initialized";try{if(!s.init)throw"Current provider does not have init() function";return await s.init()?await oo():void 0}catch(t){console.error("Failed initializing provider ",t)}}var R={},f={},so=(s,t)=>{u().setState(({toasts:o})=>{let e=o.customToasts.length>0?Math.max(...o.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${e+1}`,i=o.customToasts.findIndex(a=>a.toastId===n),r={...s,toastId:n};if(i!==-1){o.customToasts[i]=r;return}o.customToasts.push({...r,toastId:n})},!1,{type:"addCustomToast",payload:{value:{customToast:s,currentToastId:t}}})},P=s=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(o=>o.toastId!==s)},!1,{type:"removeCustomToast",payload:{value:s}})},Ut=()=>{u().setState(({toasts:s})=>{s.customToasts=[]},!1,{type:"removeAllCustomToasts",payload:{value:null}})},an=()=>{u().setState(({toasts:s})=>{s.transactionToasts=[]})},_t=({toastId:s,totalDuration:t})=>{let o="";return u().setState(({toasts:e})=>{let n=e.transactionToasts.length>0?Math.max(...e.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;o=s??`transaction-toast-${n+1}`,e.transactionToasts.push({startTime:st(),endTime:Rt(t),toastId:o})},!1,"addTransactionToast"),o},F=s=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(o=>o.toastId!==s)},!1,"removeTransactionToast"),delete f[s],delete R[s]},B=s=>{let{toasts:t}=u().getState(),o=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,e=s.toastId||`custom-toast-${o+1}`;return s.onClose&&(f[e]=s.onClose),s.instantiateToastElement?(R[e]=s.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===e),r={...s,instantiateToastElement:null,toastId:e};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),e):(so(s,e),e)};export{R as a,f as b,so as c,P as d,Ut as e,an as f,_t as g,F as h,B as i,O as j,M as k,k as l,d as m,D as n,Wt as o,Ht as p,_ as q,j as r,$t as s,q as t,Gt as u,W as v,Kt as w,y as x,U as y};
|
|
2
|
+
//# sourceMappingURL=chunk-6V32BQRW.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-YLGQ3PM4.mjs";async function i(a){let n=e.getInstance();return await n.openUI(),{manager:n,onClose:async({shouldCancelAction:t=!0}={})=>{n.closeUI(),t&&a?.cancelAction&&await a.cancelAction()}}}export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7I7SJXVG.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-SWV35LLA.mjs";import{s as e}from"./chunk-EXE2PPR4.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-AWV2BT4N.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as S}from"./chunk-WTCCK3ZP.mjs";import{a as u}from"./chunk-IRP5CFO7.mjs";import{a as l}from"./chunk-WCEZVGFB.mjs";import{s as f}from"./chunk-EXE2PPR4.mjs";import{c as T}from"./chunk-UERJ6AKK.mjs";import{f as h,g as d}from"./chunk-7VHTZYM2.mjs";var I=r=>r.sort((n,t)=>t.timestamp-n.timestamp),M=async({transactions:r,...n})=>{let t=n.store??f(),o=[],i=[];if(r.forEach(s=>{let e=u(s.hash,t);e?o.push(e):i.push(s.hash)}),i.length===0)return I(o);let c=r.map(s=>({...s,txHash:s.hash})),g=c.map(s=>s.txHash),p=i.filter(s=>!g.includes(s));if(p.length>0){let e=r.filter(a=>p.includes(a.hash)).map(a=>({...a,txHash:a.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 o.forEach(s=>{let e=s.hash;e&&m.set(String(e),s)}),c.forEach(s=>{let e=l({transaction:s,address:T(t),explorerAddress:d(t),egldLabel:h(t)});e.status!=="pending"&&S({key:`transaction-${s.txHash}`,value:e}),m.set(s.txHash,e)}),I(Array.from(m.values()))};export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BFYSNMGP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k}from"./chunk-DKMTA3CC.mjs";import{a as O}from"./chunk-GECW34DV.mjs";import{a as B}from"./chunk-WEDTMPCV.mjs";import{a as b}from"./chunk-XU7FAZR4.mjs";import{a as A}from"./chunk-QXC4D3AC.mjs";import{a as D}from"./chunk-XQL64G6I.mjs";import{a as I}from"./chunk-PHOF3Z5D.mjs";import{a as _}from"./chunk-AWV2BT4N.mjs";import{a as R}from"./chunk-K373M2BG.mjs";import{a as j}from"./chunk-5KCP7UJT.mjs";import{s as x}from"./chunk-EXE2PPR4.mjs";import{b as v}from"./chunk-7VHTZYM2.mjs";import{a as G,c as U,f as F}from"./chunk-PJWJZHIS.mjs";import{a as w}from"./chunk-NTEMINYA.mjs";import{c as N}from"./chunk-MGFIOCA4.mjs";async function Dn({transactions:z=[],handleSign:H,guardTransactions:K=_}){let{account:{address:y,shard:h,username:E}}=k(),g=v(x()),C=B(),{allTransactions:r,parsedTransactionsByDataField:L}=R(z),p=[],n=O.getInstance();if(await n.openUI(),!n)throw new Error("Unable to establish connection with sign screens");let W=async()=>{await b(),n.closeUI()};return n.subscribeToEventBus("CLOSE_SIGN_TRANSACTIONS",W),new Promise(async(X,M)=>{let d=[],Y=await A({baseURL:g.apiAddress});n.notifyDataUpdate(),n.initializeGasPriceMap(r.map(a=>a.transaction));let l=Y?.price,t=0,T=async()=>{let c=r[t]?.transaction,i=Number(c.nonce);try{n.updateIsLoading(!0);let{commonData:o,tokenTransaction:e,fungibleTransaction:s}=await D({allTransactions:r,currentScreenIndex:t,egldLabel:C,network:g,gasPriceData:n.ppuMap[i],price:l,address:y,username:E,shard:h,signedIndexes:p,parsedTransactionsByDataField:L});e&&n.updateTokenTransaction(e),s&&n.updateNonFungibleTransaction(s.type,s),n.updateCommonData(o)}catch(o){throw console.error(`Error fetching common data for transaction at index ${t}:`,o),o}finally{n.updateIsLoading(!1)}},$=()=>{t>0&&(t--,T())},q=(a=0)=>{let i=r[t].transaction,o=Number(i.nonce);n.updateGasPriceMap({nonce:o,ppu:a}),n.updateCommonData({ppu:a});let e=i.toPlainObject(),s=I({transaction:e,gasPriceData:n.ppuMap[o]}),P=w.newFromPlainObject({...e,gasPrice:s}),u=j({transaction:P,price:l}),m=F({input:s.toString(),decimals:U,addCommas:!0,digits:G});n.updateCommonData({feeLimit:u.feeLimitFormatted,feeInFiatLimit:u.feeInFiatLimit,gasPrice:m,ppu:a})},J=async()=>{M(new Error("Transaction signing cancelled by user")),await b(),n.closeUI()},f=()=>{t<n.transactionsCount-1&&(t++,T())},Q=async()=>{let c=r[t].transaction,i=Number(c.nonce),{commonData:o}=await D({allTransactions:r,currentScreenIndex:t,egldLabel:C,network:g,gasPriceData:n.ppuMap[i],price:l,address:y,username:E,shard:h,signedIndexes:p,parsedTransactionsByDataField:L});if(!o.needsSigning)return p.push(t),f();let e=c.toPlainObject(),s=e.nonce,P=I({transaction:e,gasPriceData:n.ppuMap[s]}),u=w.newFromPlainObject({...e,gasPrice:P});try{let m=await H([u]);m&&(p.push(t),d.push(m[0]));let nn=t===r.length-1,tn=r.filter(S=>S.needsSigning),an=d.length===tn.length;if(nn&&an){let S=await K(d);return n.closeUI(),X(S)}f()}catch(m){n.closeUI(),M(m)}},V=new Map([["NEXT_SIGN_TRANSACTIONS",f],["CONFIRM_SIGN_TRANSACTIONS",Q],["CLOSE_SIGN_TRANSACTIONS",J],["BACK_SIGN_TRANSACTIONS",$],["SET_PPU_SIGN_TRANSACTIONS",q]]);function Z(){for(let[a,c]of V)n.subscribeToEventBus(a,c)}Z(),await T()})}export{Dn as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CIUJ7Q6E.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as w}from"./chunk-QXC4D3AC.mjs";import{a as g}from"./chunk-YGI3KXMZ.mjs";import{a as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as w}from"./chunk-QXC4D3AC.mjs";import{a as g}from"./chunk-YGI3KXMZ.mjs";import{a as b}from"./chunk-SDF6BSQJ.mjs";import{a as m}from"./chunk-G7GU37XI.mjs";import{f}from"./chunk-PJWJZHIS.mjs";import x from"bignumber.js";var F=async({manager:e,provider:d})=>{if(!e||!d)throw new Error("Provider is not initialized.");let{network:u}=b(),s=e.getAccountScreenData()?.startIndex||0,r=e.getAllAccounts(),a=await w({baseURL:u.apiAddress}),l=o=>o.index>=s&&o.index<s+e.addressesPerPage,I=r.reduce((o,n)=>Object.assign(o,{[n.index]:n}),{}),A=r.filter(l),y=!!I[s];if(e.updateAccountScreen({isLoading:!y}),A.length>0){e.updateAccountScreen({accounts:A});return}try{let o=Math.floor(s/e.addressesPerPage),n=await d.getAccounts(o,e.addressesPerPage),L=n.map((t,c)=>({address:t,balance:"...",index:c+s})),P=[...r,...L],h=n.map(t=>m({address:t,baseURL:u.apiAddress})),j=await Promise.all(h),i=P.reduce((t,c)=>Object.assign(t,{[c.address]:c}),{});j.forEach(t=>{if(!t||!a||!a.price)return;let c=new x(t.balance),S=c.dividedBy(x(10).pow(18)).toFormat(4).toString();if(c.isNaN())return;let U=g({amount:f({input:t.balance}),usd:a?.price});i[t.address].balance=S,i[t.address].usdValue=U});let p=Object.values(i).sort((t,c)=>t.index-c.index),O=p.filter(l);e.updateAllAccounts(p),e.updateAccountScreen({accounts:O,isLoading:!1})}catch(o){console.error("Failed to fetch accounts:",o)}};export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CUMVG6S5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-55W25Q35.mjs";import{a as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-55W25Q35.mjs";import{a as r}from"./chunk-BFYSNMGP.mjs";import a from"lodash.isempty";var e=async({transactionsSessions:t})=>{if(a(t))return[];let i=s(t);return r({transactions:i})};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DGANJCHG.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-7I7SJXVG.mjs";import{a as e}from"./chunk-R64XZNJM.mjs";import{a as i}from"./chunk-6R2WFQ7U.mjs";var a=class{constructor(o){this.address="";this._login=null;this.loginAbortController=null;this.cancelLogin=()=>{this.loginAbortController&&this.loginAbortController.abort(),this.cancelAction?.(),this.loginAbortController=null};this.loginOperation=async o=>{if(!this._login)throw new Error("Provider is not initialized.");let r=await this._login(o);if(!r?.address)throw new Error("Provider is not initialized.");return{...r,address:r.address,signature:r.signature??""}};this.initializeAddress=()=>{if(this.address)return;let o=e();o&&(this.address=o)};this.cancelAction=void 0;this.address=o??""}getAccount(){throw new Error("Method not implemented.")}signTransaction(o,r){throw new Error("Method not implemented.")}async login(o){if(!this._login)throw new Error("Provider is not initialized.");this.loginAbortController&&this.loginAbortController.abort();let r=new AbortController;this.loginAbortController=r;let t=r.signal;try{let n=new Promise((p,c)=>{t.addEventListener("abort",()=>{c(new Error("Login cancelled"))})}),l=await Promise.race([this.loginOperation(o),n]);return this.loginAbortController=null,l}catch(n){throw this.loginAbortController=null,n}}async initSignState(){let{onClose:o,manager:r}=await s({cancelAction:this.cancelAction?.bind(this)}),t=this.getType();return r.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",o),r.updateData({name:i[t],type:t}),{onClose:o,manager:r}}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-EELETY3Z.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as n,q as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{j as n,q as o}from"./chunk-EXE2PPR4.mjs";import{c as p}from"./chunk-NTEMINYA.mjs";var s=()=>o().setState(n),l=({address:e,providerType:t})=>{o().setState(({account:r,loginInfo:i})=>{r.address=e,r.publicKey=new p(e).toHex(),i&&(i.providerType=t)},!1,{type:"loginAction",payload:{value:{address:e,providerType:t}}})};export{s as a,l as b};
|
|
2
|
+
//# sourceMappingURL=chunk-EPRQ5A6W.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-2BKGSHOR.mjs";import o from"axios";var n="transactions/ppu";async function l(a,s){let r=`${e(s)}/${n}/${a}`;try{let{data:t}=await o.get(r);return t?{[a]:{lastBlock:t.lastBlock,fast:t.fast,faster:t.faster}}:null}catch(t){return console.error("Error fetching gas station metadata from:",r,t),null}}export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EUJRQFQG.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-HROVYEVW.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-EXE2PPR4.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t}from"./chunk-YG6GGSSN.mjs";var n=class{static get create(){return this.createComponent}static set create(e){this.createComponent=e}};n.createComponent=async({name:e,anchor:m})=>{if(!t?.customElements?.get(e))return null;let o=t.document.createElement(e);return(m||t.document.body).appendChild(o),await customElements.whenDefined(e),o};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FCB3AT5J.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-YG6GGSSN.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-FJD2WVYA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-5MSC5VEJ.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-GECW34DV.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-FJD2WVYA.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-GKM7KNTV.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-3V7L7VMK.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-GRZU3CBF.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as r,c as n}from"./chunk-QJGFIK7H.mjs";import{x as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as r,c as n}from"./chunk-QJGFIK7H.mjs";import{x as g}from"./chunk-6V32BQRW.mjs";import{q as M}from"./chunk-EXE2PPR4.mjs";import{a as d}from"./chunk-UERJ6AKK.mjs";import{a as u,c as p,g as l}from"./chunk-NTEMINYA.mjs";import{a as c}from"./chunk-YG6GGSSN.mjs";var m=class{constructor({onLoginCancelled:e}){this.handlers=new Map;this.store=M();this.isLoginInitiated=!1;this.handleMessage=this.handleMessage.bind(this),this.handleLoginCancelled=e}startListening(){c.addEventListener("message",this.handleMessage)}stopListening(){c.removeEventListener("message",this.handleMessage)}registerEvent(e,s){this.handlers.set(e,s)}unregisterEvent(e){this.handlers.delete(e)}async handleMessage(e){let s=e.data?.type;if(typeof s=="string"&&this.handlers.has(s))return this.handlers.get(s)?.(e);switch(s){case r.finalizeHandshakeRequest:this.handshake({event:e});break;case r.signMessageRequest:this.signMessage({event:e,payload:e.data.payload});break;case r.loginRequest:this.isLoginInitiated=!0,this.login({event:e,payload:e.data.payload});break;case r.signTransactionsRequest:this.signTransactions({event:e});break;case n.cancelResponse:case"cancelAction":this.isLoginInitiated&&await this.handleLoginCancelled();break;default:break}}async login({event:e,payload:s}){let a=s?.token;if(a)try{let{address:t}=d(this.store.getState()),o=g(),i=`${t}${a}`,y=new l({address:new p(t),data:new Uint8Array(Buffer.from(i))}),f=(await o.signMessage(y))?.signature??"";e.source?.postMessage({type:n.loginResponse,payload:{data:{address:t,signature:Buffer.from(f).toString("hex")}}},{targetOrigin:e.origin})}catch{this.isLoginInitiated&&(await this.handleLoginCancelled(),e.source?.postMessage({type:n.cancelResponse,payload:null},{targetOrigin:e.origin}))}finally{this.isLoginInitiated=!1}}handshake({event:e}){let s=Date.now().toString();e.source?.postMessage({type:n.finalizeHandshakeResponse,payload:{data:s}},{targetOrigin:e.origin})}async signMessage({event:e,payload:s}){let{address:a}=d(this.store.getState()),{message:t}=s;try{let o=new l({address:new p(a),data:new Uint8Array(Buffer.from(t))}),h=(await g().signMessage(o))?.signature??"";e.source?.postMessage({type:n.signMessageResponse,payload:{data:{signature:Buffer.from(h).toString("hex"),status:"signed"}}},{targetOrigin:e.origin})}catch{throw new Error("Could not sign message")}}async signTransactions({event:e}){let s=g(),{payload:a}=e.data;if(Array.isArray(a))try{let t=a.map(i=>u.newFromPlainObject(i)),o=await s.signTransactions(t);e.source?.postMessage({type:n.signTransactionsResponse,payload:{data:o.map(i=>i.toPlainObject())}},{targetOrigin:e.origin})}catch{throw new Error("Could not sign transactions")}}};export{m as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HWWLVGYU.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-5V3ZVJ5N.mjs";import{a as u}from"./chunk-P5BMCXKE.mjs";import{a}from"./chunk-PMHRZ5Y7.mjs";import{b as o}from"./chunk-P6DSLB4K.mjs";import{l as p}from"./chunk-E2GGD7D4.mjs";var n={};async function b({serverTransaction:r,sessionId:t,isSequential:c}){let{hash:e,status:s,invalidTransaction:f,hasStatusChanged:S}=r;try{if(n[e]>30){o({sessionId:t,status:"timedOut"}),await a({sessionId:t,status:"timedOut"});return}if(f&&!c||s==="sent"){n[e]=n[e]?n[e]+1:1;return}if(c&&!s){let i=u({sessionId:t,transaction:r});await a({sessionId:t,status:i});return}if(S){let i=u({sessionId:t,transaction:r});await a({sessionId:t,status:i})}p(s)&&await m({sessionId:t,transaction:r})}catch(T){console.error(T),o({sessionId:t,status:"timedOut"}),await a({sessionId:t,status:"timedOut"})}}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-I3C6RYN6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-R64XZNJM.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-IRQV762M.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-NGM3AVCY.mjs";import{s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-NGM3AVCY.mjs";import{s}from"./chunk-EXE2PPR4.mjs";import{e as a}from"./chunk-UERJ6AKK.mjs";function x(n){let e=s(),o=u(e),c=a(e),t=Object.keys(o).map(Number).reduce((r,m)=>{let i=o[m]?.transactions||[];return Math.max(r,...i.map(l=>l.nonce),0)},0);return t>0&&(t+=1),n==null?Math.max(t,c):Math.max(t,n.nonce,c)}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IUCITH6E.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-EXE2PPR4.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-JOX3TPDC.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as ce}from"./chunk-M3YL36ZL.mjs";import{a as A}from"./chunk-APPNCPKI.mjs";import{a as ae}from"./chunk-2Y66XRQK.mjs";import{a as oe}from"./chunk-LVGH7JBF.mjs";import{a as R}from"./chunk-VLDGQL7B.mjs";import{a as ne}from"./chunk-2IEPFE4D.mjs";import{a as ie}from"./chunk-H3COTSYJ.mjs";import{a as te}from"./chunk-YUFPUG5O.mjs";import{a as de}from"./chunk-MLPNNQ52.mjs";import{a as p}from"./chunk-CRTAVEFT.mjs";import{a as re}from"./chunk-ZNXVHDZB.mjs";import{a as S}from"./chunk-KWPLSEMY.mjs";import{a as se}from"./chunk-4HVKYSYB.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-7B7XIPV2.mjs";import{i as J,m as N,v as M,w as C,x as L}from"./chunk-HRRO627B.mjs";import{a as y}from"./chunk-RS457CD4.mjs";import{a as X}from"./chunk-2YEAP742.mjs";import{a as U}from"./chunk-4TBVQD27.mjs";import{a as Q}from"./chunk-EGEQQSOM.mjs";import{g as Y}from"./chunk-M6MN4RXG.mjs";import{a as q,q as F,s as c}from"./chunk-DGFYEV3J.mjs";import{f as H}from"./chunk-UERJ6AKK.mjs";import{b as w,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 P=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:"close",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(N.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"close",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 P({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,N.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=w(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=w(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??U.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,u=new Z(v,t,D,m,O);return u.isInitialized()||await u.init(),{walletConnectProvider:u,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??U.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 P({anchor:e}),await k.getInstance().init();break}case o.metamask:{r=new W;break}case o.passkey:{let s=w(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((f,V)=>(f[V.type]=V.name,f),{}),O={...l,...m},D=async()=>{await h({shouldCancelAction:!0}),s({message:"Signing canceled"})};d.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",D);let u=Pe(v,r)?r:o.none;d.updateData({name:O[u],type:u});try{let f=await n(a);i(f)}catch(f){await h({shouldCancelAction:!0}),s(f)}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,P 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-6TAFMLIP.mjs";import{a as ae}from"./chunk-2Y66XRQK.mjs";import{a as oe}from"./chunk-JSA535AB.mjs";import{a as R}from"./chunk-KONLNCQL.mjs";import{a as ne}from"./chunk-WMSBYBUV.mjs";import{a as ie}from"./chunk-OTSQGZLA.mjs";import{a as te}from"./chunk-YUFPUG5O.mjs";import{a as de}from"./chunk-OZYD32IW.mjs";import{a as p}from"./chunk-EELETY3Z.mjs";import{a as re}from"./chunk-7I7SJXVG.mjs";import{a as S}from"./chunk-CIUJ7Q6E.mjs";import{a as se}from"./chunk-AWV2BT4N.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-7B7XIPV2.mjs";import{i as J,m as N,v as M,w as C,x as L}from"./chunk-6V32BQRW.mjs";import{a as y}from"./chunk-UBOX3NGQ.mjs";import{a as X}from"./chunk-R64XZNJM.mjs";import{a as U}from"./chunk-4TBVQD27.mjs";import{a as Q}from"./chunk-EPRQ5A6W.mjs";import{g as Y}from"./chunk-M6MN4RXG.mjs";import{a as q,q as F,s as c}from"./chunk-EXE2PPR4.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:"close",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(N.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"close",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,N.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??U.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??U.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-JPMLMIQR.mjs.map
|