@multiversx/sdk-dapp 5.0.0-alpha.13 → 5.0.0-alpha.15
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/README.md +24 -22
- package/out/__chunks__/{chunk-HTAH342B.mjs → chunk-33V2XBND.mjs} +2 -2
- package/out/__chunks__/chunk-4KABQZJU.mjs +2 -0
- package/out/__chunks__/{chunk-AQ3VAQH3.mjs → chunk-4MNCFSUO.mjs} +2 -2
- package/out/__chunks__/chunk-4NXTT4UR.mjs +2 -0
- package/out/__chunks__/{chunk-S4LN2NQH.mjs → chunk-4USFY3DC.mjs} +2 -2
- package/out/__chunks__/{chunk-UZUI4AP5.mjs → chunk-532QQEN4.mjs} +2 -2
- package/out/__chunks__/{chunk-FFEFZVCC.mjs → chunk-5MDDPC5M.mjs} +2 -2
- package/out/__chunks__/{chunk-K66JLLVW.mjs → chunk-7H2PZVSJ.mjs} +2 -2
- package/out/__chunks__/{chunk-AKFSBZ46.mjs → chunk-7RFUEHZX.mjs} +2 -2
- package/out/__chunks__/{chunk-RJSL5ONQ.mjs → chunk-AI7LYKBU.mjs} +2 -2
- package/out/__chunks__/{chunk-LYXQ3FWU.mjs → chunk-AZ2KOM5R.mjs} +2 -2
- package/out/__chunks__/{chunk-3ATEIVW3.mjs → chunk-AZGVI4QW.mjs} +2 -2
- package/out/__chunks__/chunk-BHXGUN5H.mjs +2 -0
- package/out/__chunks__/{chunk-NONAAAZC.mjs.map → chunk-BHXGUN5H.mjs.map} +1 -1
- package/out/__chunks__/chunk-BLUKJJTY.mjs +2 -0
- package/out/__chunks__/{chunk-QNKYH6KO.mjs → chunk-BTXVE2KE.mjs} +2 -2
- package/out/__chunks__/{chunk-VO4DXDYI.mjs → chunk-C3F3EPNZ.mjs} +2 -2
- package/out/__chunks__/{chunk-TXQO3M7J.mjs → chunk-CBH7E57H.mjs} +2 -2
- package/out/__chunks__/chunk-CKTFPRJS.mjs +2 -0
- package/out/__chunks__/chunk-CKTFPRJS.mjs.map +7 -0
- package/out/__chunks__/chunk-CMEBBADF.mjs +2 -0
- package/out/__chunks__/{chunk-3XCB5CEW.mjs → chunk-CRHPVNRL.mjs} +2 -2
- package/out/__chunks__/{chunk-HPLSDK5V.mjs → chunk-CUABBK2P.mjs} +2 -2
- package/out/__chunks__/{chunk-AM6BSOYA.mjs → chunk-EBQZQA2Q.mjs} +2 -2
- package/out/__chunks__/{chunk-Y5Y2WOCZ.mjs → chunk-EO6CD6VO.mjs} +2 -2
- package/out/__chunks__/{chunk-Q56GIIOP.mjs → chunk-ES6E2HM6.mjs} +2 -2
- package/out/__chunks__/{chunk-RIH7QM6W.mjs → chunk-F4W3N3JZ.mjs} +2 -2
- package/out/__chunks__/{chunk-3UIJI5YR.mjs → chunk-F4WQOPSX.mjs} +2 -2
- package/out/__chunks__/chunk-FGRMMCGF.mjs +2 -0
- package/out/__chunks__/{chunk-YILGIHY5.mjs → chunk-GFK4E7GU.mjs} +2 -2
- package/out/__chunks__/{chunk-QPXVUJSC.mjs → chunk-GRD5MWEG.mjs} +2 -2
- package/out/__chunks__/{chunk-ISB4SC4L.mjs → chunk-GXMIT5JQ.mjs} +2 -2
- package/out/__chunks__/chunk-GZAAD3TR.mjs +2 -0
- package/out/__chunks__/{chunk-PGOE5XGR.mjs → chunk-GZTGHNVI.mjs} +2 -2
- package/out/__chunks__/chunk-HACVN4R6.mjs +2 -0
- package/out/__chunks__/chunk-I2BU6ZOQ.mjs +2 -0
- package/out/__chunks__/chunk-I2BU6ZOQ.mjs.map +7 -0
- package/out/__chunks__/{chunk-XSJE7M77.mjs → chunk-I2XLXOU2.mjs} +2 -2
- package/out/__chunks__/{chunk-ER735UVF.mjs → chunk-IQVVCXXL.mjs} +2 -2
- package/out/__chunks__/chunk-JGWGDO7E.mjs +2 -0
- package/out/__chunks__/chunk-JJ2NEPU5.mjs +2 -0
- package/out/__chunks__/chunk-JJ2NEPU5.mjs.map +7 -0
- package/out/__chunks__/{chunk-U5IR3XBA.mjs → chunk-JMXZ4XDT.mjs} +2 -2
- package/out/__chunks__/{chunk-KGASLT4P.mjs → chunk-JYZ5XXJG.mjs} +2 -2
- package/out/__chunks__/{chunk-JGFDKHG2.mjs → chunk-KNRIU7GR.mjs} +2 -2
- package/out/__chunks__/chunk-KOALRMAA.mjs +2 -0
- package/out/__chunks__/{chunk-EUXN5BLO.mjs → chunk-LV2BL56O.mjs} +2 -2
- package/out/__chunks__/{chunk-Q6NDAYER.mjs → chunk-MAK5NFYN.mjs} +2 -2
- package/out/__chunks__/{chunk-PXMPUIUL.mjs → chunk-MH42KJTU.mjs} +2 -2
- package/out/__chunks__/{chunk-NJMYFDLA.mjs → chunk-MUYF2CWM.mjs} +2 -2
- package/out/__chunks__/{chunk-A343RP4X.mjs → chunk-MXLRZPMK.mjs} +2 -2
- package/out/__chunks__/{chunk-65RXDHRY.mjs → chunk-MYCXIA5W.mjs} +2 -2
- package/out/__chunks__/chunk-O67FZOYR.mjs +2 -0
- package/out/__chunks__/{chunk-JF4GVWO4.mjs → chunk-O67WFDS3.mjs} +2 -2
- package/out/__chunks__/{chunk-LDETTRYB.mjs → chunk-ODIVUD2L.mjs} +2 -2
- package/out/__chunks__/{chunk-57B6Q67I.mjs → chunk-OYY5ZF7L.mjs} +2 -2
- package/out/__chunks__/{chunk-EGU5LABV.mjs → chunk-PH2YVVEA.mjs} +2 -2
- package/out/__chunks__/{chunk-IEWH5GDM.mjs → chunk-PLO67H6R.mjs} +2 -2
- package/out/__chunks__/{chunk-QVLQCJFN.mjs → chunk-PTLBE2H2.mjs} +2 -2
- package/out/__chunks__/{chunk-ED5SQUAW.mjs → chunk-QCJMV6NU.mjs} +2 -2
- package/out/__chunks__/chunk-QYV4JQI5.mjs +2 -0
- package/out/__chunks__/{chunk-6H5TKCEW.mjs → chunk-QZ27VHW6.mjs} +2 -2
- package/out/__chunks__/{chunk-LEBVS2YF.mjs → chunk-R6QXUFY4.mjs} +2 -2
- package/out/__chunks__/{chunk-HVUNMCAO.mjs → chunk-RCRWI3XT.mjs} +2 -2
- package/out/__chunks__/{chunk-53JZ6ZBD.mjs → chunk-RG72LHS3.mjs} +2 -2
- package/out/__chunks__/{chunk-GOL32UNC.mjs → chunk-RLVN434K.mjs} +2 -2
- package/out/__chunks__/{chunk-KWJVDPCC.mjs → chunk-RPBH7EFR.mjs} +2 -2
- package/out/__chunks__/chunk-RVO7H26H.mjs +2 -0
- package/out/__chunks__/chunk-RVO7H26H.mjs.map +7 -0
- package/out/__chunks__/chunk-S2FAYMW2.mjs +2 -0
- package/out/__chunks__/{chunk-SHFT3OJY.mjs → chunk-SFZJXI7K.mjs} +2 -2
- package/out/__chunks__/{chunk-OB6ULJEV.mjs → chunk-SLBB2BEP.mjs} +2 -2
- package/out/__chunks__/{chunk-3RBYJZII.mjs → chunk-SZHXVDHF.mjs} +2 -2
- package/out/__chunks__/{chunk-77IZTIMY.mjs → chunk-T5GA3FRJ.mjs} +2 -2
- package/out/__chunks__/chunk-TDUKMRJX.mjs +2 -0
- package/out/__chunks__/chunk-TDUKMRJX.mjs.map +7 -0
- package/out/__chunks__/{chunk-W46BAMEI.mjs → chunk-TEYO3CV4.mjs} +2 -2
- package/out/__chunks__/chunk-TGCPDWQK.mjs +2 -0
- package/out/__chunks__/{chunk-EKMRPW2A.mjs → chunk-VML7BRY5.mjs} +2 -2
- package/out/__chunks__/chunk-VOZWABCM.mjs +2 -0
- package/out/__chunks__/chunk-VTL2OSUK.mjs +2 -0
- package/out/__chunks__/{chunk-GXUJBKWY.mjs → chunk-Y4OUAJSG.mjs} +2 -2
- package/out/__chunks__/chunk-YDGXPL33.mjs +2 -0
- package/out/__chunks__/{chunk-L4762ZRT.mjs → chunk-YIWTWMQF.mjs} +2 -2
- package/out/__chunks__/{chunk-HIODLP5F.mjs → chunk-YMSRWWNA.mjs} +2 -2
- package/out/__chunks__/chunk-YVH7ZJXA.mjs +2 -0
- package/out/__chunks__/{chunk-RIQNG4I7.mjs → chunk-Z6VA2J3J.mjs} +2 -2
- package/out/__chunks__/chunk-ZSHUGRGA.mjs +2 -0
- package/out/__mocks__/accountConfig.mjs +1 -1
- package/out/__mocks__/index.mjs +1 -1
- package/out/__mocks__/server.mjs +1 -1
- 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.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/managers/LogoutManager/LogoutManager.mjs +1 -1
- package/out/managers/NotificationsFeedManager/NotificationsFeedManager.mjs +1 -1
- package/out/managers/NotificationsFeedManager/index.mjs +1 -1
- package/out/managers/TransactionManager/TransactionManager.mjs +1 -1
- package/out/managers/TransactionManager/helpers/getAreTransactionsCorssShards.mjs +1 -1
- package/out/managers/TransactionManager/helpers/getToastDuration.mjs +1 -1
- package/out/managers/TransactionManager/helpers/getTransactionsStatus.mjs +1 -1
- package/out/managers/TransactionManager/index.mjs +1 -1
- package/out/managers/UnlockPanelManager/UnlockPanelManager.js +1 -3
- package/out/managers/UnlockPanelManager/UnlockPanelManager.js.map +1 -1
- package/out/managers/UnlockPanelManager/UnlockPanelManager.mjs +1 -1
- package/out/managers/UnlockPanelManager/UnlockPanelManager.types.d.ts +12 -5
- package/out/managers/UnlockPanelManager/UnlockPanelManager.types.js.map +1 -1
- package/out/managers/UnlockPanelManager/UnlockPanelManager.types.mjs +1 -1
- package/out/managers/UnlockPanelManager/index.mjs +1 -1
- package/out/managers/index.mjs +1 -1
- package/out/managers/internal/LedgerConnectStateManager/LedgerConnectStateManager.mjs +1 -1
- package/out/managers/internal/LedgerConnectStateManager/index.mjs +1 -1
- package/out/managers/internal/LedgerIdleStateManager/LedgerIdleStateManager.mjs +1 -1
- package/out/managers/internal/PendingTransactionsStateManager/PendingTransactionsStateManager.mjs +1 -1
- package/out/managers/internal/PendingTransactionsStateManager/index.mjs +1 -1
- package/out/managers/internal/SidePanelBaseManager/SidePanelBaseManager.mjs +1 -1
- package/out/managers/internal/SidePanelBaseManager/index.mjs +1 -1
- package/out/managers/internal/SignTransactionsStateManager/SignTransactionsStateManager.mjs +1 -1
- package/out/managers/internal/SignTransactionsStateManager/index.mjs +1 -1
- package/out/managers/internal/ToastManager/ToastManager.mjs +1 -1
- package/out/managers/internal/ToastManager/helpers/LifetimeManager.mjs +1 -1
- package/out/managers/internal/ToastManager/helpers/createToastsFromTransactions.mjs +1 -1
- package/out/managers/internal/ToastManager/helpers/createTransactionToast.mjs +1 -1
- package/out/managers/internal/ToastManager/helpers/getToastDataStateByStatus.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.js +2 -2
- package/out/methods/initApp/initApp.js.map +1 -1
- package/out/methods/initApp/initApp.mjs +1 -1
- package/out/methods/initApp/initApp.mjs.map +2 -2
- package/out/methods/initApp/websocket/initializeWebsocketConnection.mjs +1 -1
- package/out/methods/initApp/websocket/registerWebsocket.mjs +1 -1
- package/out/methods/loginInfo/getLoginInfo.mjs +1 -1
- package/out/methods/network/getEgldLabel.mjs +1 -1
- package/out/methods/network/getExplorerAddress.mjs +1 -1
- package/out/methods/network/getNetworkConfig.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/checkBatch.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/checkTransactionStatus.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/index.mjs +1 -1
- package/out/methods/trackTransactions/helpers/checkTransactionStatus/manageFailedTransactions.mjs +1 -1
- package/out/methods/trackTransactions/helpers/getPollingInterval.mjs +1 -1
- package/out/methods/trackTransactions/trackTransactions.mjs +1 -1
- package/out/methods/transactions/getFailedTransactions.mjs +1 -1
- package/out/methods/transactions/getFailedTransactionsSessions.mjs +1 -1
- package/out/methods/transactions/getPendingTransactions.mjs +1 -1
- package/out/methods/transactions/getPendingTransactionsSessions.mjs +1 -1
- package/out/methods/transactions/getSuccessfulTransactions.mjs +1 -1
- package/out/methods/transactions/getSuccessfulTransactionsSessions.mjs +1 -1
- package/out/methods/transactions/getTransactionSessions.mjs +1 -1
- package/out/providers/DappProvider/DappProvider.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/accountLogin.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/extractAddressFromToken.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/getAccountFromToken.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/helpers/getModifiedLoginToken.mjs +1 -1
- package/out/providers/DappProvider/helpers/login/login.mjs +1 -1
- package/out/providers/DappProvider/helpers/logout/logout.mjs +1 -1
- package/out/providers/DappProvider/helpers/signErrors/handleSignError.mjs +1 -1
- package/out/providers/DappProvider/helpers/signMessage/signMessageWithProvider.mjs +1 -1
- package/out/providers/DappProvider/helpers/signTransactions/signTransactionsWithProvider.mjs +1 -1
- package/out/providers/DappProvider/index.mjs +1 -1
- package/out/providers/ProviderFactory.mjs +1 -1
- package/out/providers/helpers/accountProvider.mjs +1 -1
- package/out/providers/helpers/cancelCrossWindowAction.mjs +1 -1
- package/out/providers/helpers/restoreProvider.mjs +1 -1
- package/out/providers/index.mjs +1 -1
- package/out/providers/strategies/BaseProviderStrategy/BaseProviderStrategy.mjs +1 -1
- package/out/providers/strategies/CrossWindowProviderStrategy/CrossWindowProviderStrategy.mjs +1 -1
- package/out/providers/strategies/CrossWindowProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/ExtensionProviderStrategy/ExtensionProviderStrategy.mjs +1 -1
- package/out/providers/strategies/ExtensionProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/IframeProviderStrategy/IframeProviderStrategy.mjs +1 -1
- package/out/providers/strategies/IframeProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/LedgerProviderStrategy.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/authenticateLedgerAccount.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getAuthTokenText.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerConfiguration.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerProvider.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerVersionOptions.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/index.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/initializeLedgerProvider.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/signLedgerMessage.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/updateAccountsList/index.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/helpers/updateAccountsList/updateAccountsList.mjs +1 -1
- package/out/providers/strategies/LedgerProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/WalletConnectProviderStrategy/WalletConnectProviderStrategy.mjs +1 -1
- package/out/providers/strategies/WalletConnectProviderStrategy/index.mjs +1 -1
- package/out/providers/strategies/WebviewProviderStrategy/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/helpers/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.d.ts +2 -1
- package/out/services/nativeAuth/methods/getDefaultNativeAuthConfig.js +12 -5
- package/out/services/nativeAuth/methods/getDefaultNativeAuthConfig.js.map +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/selectors/index.mjs +1 -1
- package/out/store/slices/index.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/types/index.mjs +1 -1
- package/out/utils/ComponentFactory.mjs +1 -1
- package/out/utils/account/index.d.ts +1 -0
- package/out/utils/account/index.js +1 -0
- package/out/utils/account/index.js.map +1 -1
- package/out/utils/account/index.mjs +1 -1
- package/out/utils/account/refreshAccount.mjs +1 -1
- package/out/{core/providers/DappProvider/helpers/login/helpers → utils/account}/refreshNativeAuthTokenLogin.d.ts +2 -2
- package/out/{core/providers/DappProvider/helpers/login/helpers → utils/account}/refreshNativeAuthTokenLogin.js +6 -9
- package/out/utils/account/refreshNativeAuthTokenLogin.js.map +1 -0
- package/out/utils/account/refreshNativeAuthTokenLogin.mjs +2 -0
- package/out/utils/account/refreshNativeAuthTokenLogin.mjs.map +7 -0
- 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/getTransactionAsset.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/helpers/mapTransactionToListItem.mjs +1 -1
- package/out/utils/transactions/getTransactionsHistory/index.mjs +1 -1
- package/out/utils/transactions/index.mjs +1 -1
- package/out/utils/validation/index.mjs +1 -1
- package/out/utils/validation/isContract.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/getWindowLocation.js +7 -1
- package/out/utils/window/getWindowLocation.js.map +1 -1
- package/out/utils/window/getWindowLocation.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-2ZNIPYEV.mjs +0 -2
- package/out/__chunks__/chunk-35ED7YL2.mjs +0 -2
- package/out/__chunks__/chunk-47CCSYQY.mjs +0 -2
- package/out/__chunks__/chunk-5V5MG3BL.mjs +0 -2
- package/out/__chunks__/chunk-5V5MG3BL.mjs.map +0 -7
- package/out/__chunks__/chunk-7ZW5EZFP.mjs +0 -2
- package/out/__chunks__/chunk-AGHFAZ7O.mjs +0 -2
- package/out/__chunks__/chunk-CTW5DICC.mjs +0 -2
- package/out/__chunks__/chunk-DCCGXGUQ.mjs +0 -2
- package/out/__chunks__/chunk-DDXGTNBZ.mjs +0 -2
- package/out/__chunks__/chunk-IMGZJVC6.mjs +0 -2
- package/out/__chunks__/chunk-IMGZJVC6.mjs.map +0 -7
- package/out/__chunks__/chunk-IYAIXP65.mjs +0 -2
- package/out/__chunks__/chunk-LIFPBQTL.mjs +0 -2
- package/out/__chunks__/chunk-LRHRFWQ4.mjs +0 -2
- package/out/__chunks__/chunk-LRHRFWQ4.mjs.map +0 -7
- package/out/__chunks__/chunk-NONAAAZC.mjs +0 -2
- package/out/__chunks__/chunk-NQQQKXT2.mjs +0 -2
- package/out/__chunks__/chunk-RNYSLFYZ.mjs +0 -2
- package/out/__chunks__/chunk-RUG7JMMB.mjs +0 -2
- package/out/__chunks__/chunk-SBZ2AN3R.mjs +0 -2
- package/out/__chunks__/chunk-T3VFM2QO.mjs +0 -2
- package/out/__chunks__/chunk-VYWLQ5T7.mjs +0 -2
- package/out/__chunks__/chunk-XBVPYKPZ.mjs +0 -2
- package/out/__chunks__/chunk-XDH23MRS.mjs +0 -2
- package/out/__chunks__/chunk-YB2E5WOO.mjs +0 -2
- package/out/__chunks__/chunk-YB2E5WOO.mjs.map +0 -7
- package/out/core/providers/DappProvider/helpers/login/helpers/refreshNativeAuthTokenLogin.js.map +0 -1
- package/out/core/providers/DappProvider/helpers/login/helpers/refreshNativeAuthTokenLogin.mjs +0 -2
- package/out/core/providers/DappProvider/helpers/login/helpers/refreshNativeAuthTokenLogin.mjs.map +0 -7
- /package/out/__chunks__/{chunk-HTAH342B.mjs.map → chunk-33V2XBND.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-DDXGTNBZ.mjs.map → chunk-4KABQZJU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AQ3VAQH3.mjs.map → chunk-4MNCFSUO.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XBVPYKPZ.mjs.map → chunk-4NXTT4UR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-S4LN2NQH.mjs.map → chunk-4USFY3DC.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-UZUI4AP5.mjs.map → chunk-532QQEN4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-FFEFZVCC.mjs.map → chunk-5MDDPC5M.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-K66JLLVW.mjs.map → chunk-7H2PZVSJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AKFSBZ46.mjs.map → chunk-7RFUEHZX.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RJSL5ONQ.mjs.map → chunk-AI7LYKBU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-LYXQ3FWU.mjs.map → chunk-AZ2KOM5R.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3ATEIVW3.mjs.map → chunk-AZGVI4QW.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-CTW5DICC.mjs.map → chunk-BLUKJJTY.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QNKYH6KO.mjs.map → chunk-BTXVE2KE.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VO4DXDYI.mjs.map → chunk-C3F3EPNZ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-TXQO3M7J.mjs.map → chunk-CBH7E57H.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AGHFAZ7O.mjs.map → chunk-CMEBBADF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3XCB5CEW.mjs.map → chunk-CRHPVNRL.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HPLSDK5V.mjs.map → chunk-CUABBK2P.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-AM6BSOYA.mjs.map → chunk-EBQZQA2Q.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-Y5Y2WOCZ.mjs.map → chunk-EO6CD6VO.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-Q56GIIOP.mjs.map → chunk-ES6E2HM6.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RIH7QM6W.mjs.map → chunk-F4W3N3JZ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3UIJI5YR.mjs.map → chunk-F4WQOPSX.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-VYWLQ5T7.mjs.map → chunk-FGRMMCGF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-YILGIHY5.mjs.map → chunk-GFK4E7GU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QPXVUJSC.mjs.map → chunk-GRD5MWEG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ISB4SC4L.mjs.map → chunk-GXMIT5JQ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-DCCGXGUQ.mjs.map → chunk-GZAAD3TR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PGOE5XGR.mjs.map → chunk-GZTGHNVI.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-47CCSYQY.mjs.map → chunk-HACVN4R6.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XSJE7M77.mjs.map → chunk-I2XLXOU2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ER735UVF.mjs.map → chunk-IQVVCXXL.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-35ED7YL2.mjs.map → chunk-JGWGDO7E.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-U5IR3XBA.mjs.map → chunk-JMXZ4XDT.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KGASLT4P.mjs.map → chunk-JYZ5XXJG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JGFDKHG2.mjs.map → chunk-KNRIU7GR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SBZ2AN3R.mjs.map → chunk-KOALRMAA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-EUXN5BLO.mjs.map → chunk-LV2BL56O.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-Q6NDAYER.mjs.map → chunk-MAK5NFYN.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-PXMPUIUL.mjs.map → chunk-MH42KJTU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-NJMYFDLA.mjs.map → chunk-MUYF2CWM.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-A343RP4X.mjs.map → chunk-MXLRZPMK.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-65RXDHRY.mjs.map → chunk-MYCXIA5W.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-XDH23MRS.mjs.map → chunk-O67FZOYR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-JF4GVWO4.mjs.map → chunk-O67WFDS3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-LDETTRYB.mjs.map → chunk-ODIVUD2L.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-57B6Q67I.mjs.map → chunk-OYY5ZF7L.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-EGU5LABV.mjs.map → chunk-PH2YVVEA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-IEWH5GDM.mjs.map → chunk-PLO67H6R.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-QVLQCJFN.mjs.map → chunk-PTLBE2H2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-ED5SQUAW.mjs.map → chunk-QCJMV6NU.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-2ZNIPYEV.mjs.map → chunk-QYV4JQI5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-6H5TKCEW.mjs.map → chunk-QZ27VHW6.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-LEBVS2YF.mjs.map → chunk-R6QXUFY4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HVUNMCAO.mjs.map → chunk-RCRWI3XT.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-53JZ6ZBD.mjs.map → chunk-RG72LHS3.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-GOL32UNC.mjs.map → chunk-RLVN434K.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-KWJVDPCC.mjs.map → chunk-RPBH7EFR.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RUG7JMMB.mjs.map → chunk-S2FAYMW2.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-SHFT3OJY.mjs.map → chunk-SFZJXI7K.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-OB6ULJEV.mjs.map → chunk-SLBB2BEP.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-3RBYJZII.mjs.map → chunk-SZHXVDHF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-77IZTIMY.mjs.map → chunk-T5GA3FRJ.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-W46BAMEI.mjs.map → chunk-TEYO3CV4.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-LIFPBQTL.mjs.map → chunk-TGCPDWQK.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-EKMRPW2A.mjs.map → chunk-VML7BRY5.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RNYSLFYZ.mjs.map → chunk-VOZWABCM.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-T3VFM2QO.mjs.map → chunk-VTL2OSUK.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-GXUJBKWY.mjs.map → chunk-Y4OUAJSG.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-7ZW5EZFP.mjs.map → chunk-YDGXPL33.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-L4762ZRT.mjs.map → chunk-YIWTWMQF.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-HIODLP5F.mjs.map → chunk-YMSRWWNA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-IYAIXP65.mjs.map → chunk-YVH7ZJXA.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-RIQNG4I7.mjs.map → chunk-Z6VA2J3J.mjs.map} +0 -0
- /package/out/__chunks__/{chunk-NQQQKXT2.mjs.map → chunk-ZSHUGRGA.mjs.map} +0 -0
package/README.md
CHANGED
|
@@ -45,20 +45,7 @@ or
|
|
|
45
45
|
```bash
|
|
46
46
|
yarn add @multiversx/sdk-dapp
|
|
47
47
|
```
|
|
48
|
-
|
|
49
|
-
If you need only the core behaviour, without the additional UI, you can create a project-specific `.npmrc` file to configure per-package installation behavior. This will skip the installation of `@multiversx/sdk-dapp-ui`, but keep in mind that you may need to provide the UI components yourself.
|
|
50
|
-
Also, make sure you run your app on `https`, not `http`, otherwise some providers will not work.
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
## .npmrc
|
|
54
|
-
@multiversx/sdk-dapp:omit-optional=true
|
|
55
|
-
## enable the option when needed with:
|
|
56
|
-
## @multiversx/sdk-dapp:omit-optional=false
|
|
57
|
-
|
|
58
|
-
## Run Installation
|
|
59
|
-
## When you run npm install, NPM will use the configurations specified in the .npmrc file:
|
|
60
|
-
npm install
|
|
61
|
-
```
|
|
48
|
+
> **Note:** Make sure you run your app on `https`, not `http`, otherwise some providers will not work.
|
|
62
49
|
|
|
63
50
|
If you're transitioning from `@multiversx/sdk-dapp@4.x`, you can check out the [Migration guide](https://github.com/multiversx/mx-template-dapp/blob/0eb7bc6194195b6c364b8010023d351d914db65e/MIGRATION_GUIDE.md) and [migration PR](https://github.com/multiversx/mx-template-dapp/pull/343) of Template Dapp
|
|
64
51
|
|
|
@@ -140,6 +127,7 @@ export const ConnectButton = () => {
|
|
|
140
127
|
onClose: () => { // optional action to be performed when the user closes the Unlock Panel
|
|
141
128
|
navigate('/');
|
|
142
129
|
},
|
|
130
|
+
// allowedProviders: [ProviderTypeEnum.walletConnect, 'myCustomProvider'] // optionally, only show specific providers
|
|
143
131
|
});
|
|
144
132
|
const handleOpenUnlockPanel = () => {
|
|
145
133
|
unlockPanelManager.openUnlockPanel();
|
|
@@ -185,7 +173,7 @@ export const AdvancedConnectButton = () => {
|
|
|
185
173
|
});
|
|
186
174
|
const { address, signature } = await provider.login();
|
|
187
175
|
navigate(`/dashboard?address=${address}`;
|
|
188
|
-
}
|
|
176
|
+
},
|
|
189
177
|
});
|
|
190
178
|
const handleOpenUnlockPanel = () => {
|
|
191
179
|
unlockPanelManager.openUnlockPanel();
|
|
@@ -280,7 +268,7 @@ export function useStore() {
|
|
|
280
268
|
To sign transactions, you first need to create the `Transaction` object, then pass it to the initialized provider.
|
|
281
269
|
|
|
282
270
|
```typescript
|
|
283
|
-
import { Address, Transaction
|
|
271
|
+
import { Address, Transaction } from '@multiversx/sdk-core';
|
|
284
272
|
import {
|
|
285
273
|
GAS_PRICE,
|
|
286
274
|
GAS_LIMIT
|
|
@@ -290,7 +278,7 @@ import { refreshAccount } from '@multiversx/sdk-dapp/out/utils/account/refreshAc
|
|
|
290
278
|
|
|
291
279
|
const pongTransaction = new Transaction({
|
|
292
280
|
value: BigInt(0),
|
|
293
|
-
data:
|
|
281
|
+
data: Buffer.from('pong'),
|
|
294
282
|
receiver: Address.newFromBech32(contractAddress),
|
|
295
283
|
gasLimit: BigInt(GAS_LIMIT),
|
|
296
284
|
gasPrice: BigInt(GAS_PRICE),
|
|
@@ -309,12 +297,15 @@ const signedTransactions = await provider.signTransactions(transactions);
|
|
|
309
297
|
|
|
310
298
|
Then, to send the transactions, you need to use the `TransactionManager` class and pass in the `signedTransactions` to the `send` method. You can then track the transactions by using the `track` method. This will create a toast notification with the transaction hash and its status.
|
|
311
299
|
|
|
300
|
+
> **Note:** You can set callbacks for the transaction manager to handle the session status, by using the `setCallbacks` method on the `TransactionManager` class. This can also be configured globally in the `initApp` method.
|
|
301
|
+
|
|
312
302
|
```typescript
|
|
313
303
|
import { TransactionManager } from '@multiversx/sdk-dapp/out/managers/TransactionManager';
|
|
314
304
|
import type { TransactionsDisplayInfoType } from '@multiversx/sdk-dapp/out/types/transactions.types';
|
|
315
305
|
|
|
316
306
|
|
|
317
307
|
const txManager = TransactionManager.getInstance();
|
|
308
|
+
|
|
318
309
|
const sentTransactions = await txManager.send(signedTransactions);
|
|
319
310
|
|
|
320
311
|
const toastInformation: TransactionsDisplayInfoType = {
|
|
@@ -324,7 +315,7 @@ const toastInformation: TransactionsDisplayInfoType = {
|
|
|
324
315
|
}
|
|
325
316
|
|
|
326
317
|
const sessionId = await txManager.track(sentTransactions, {
|
|
327
|
-
transactionsDisplayInfo: toastInformation
|
|
318
|
+
transactionsDisplayInfo: toastInformation,
|
|
328
319
|
});
|
|
329
320
|
```
|
|
330
321
|
|
|
@@ -504,6 +495,18 @@ The transaction lifecycle consists of the following steps:
|
|
|
504
495
|
4. **Tracking** transactions is made by using `transactionManager.track()`. Since the `send()` function returns the same arguments it has received, the same array payload can be passed into the `track()` method. Under the hood, status updates are received via a WebSocket or polling mechanism.
|
|
505
496
|
Once a transaction array is tracked, it gets associated with a `sessionId`, returned by the `track()` method and stored in the `transactions` slice. Depending on the array's type (plain/batch), the session's status varies from initial (`pending`/`invalid`/`sent`) to final (`successful`/`failed`/`timedOut`).
|
|
506
497
|
|
|
498
|
+
**Table 6**. Inspecting transaction sessions
|
|
499
|
+
| # | Helper | Description | React hook equivalent |
|
|
500
|
+
|---|------|-------------|----|
|
|
501
|
+
| | `methods/transactions` | path | `react/transactions` |
|
|
502
|
+
| 1 | `getTransactionSessions()` | returns all trabsaction sessions |`useGetTransactionSessions()` |
|
|
503
|
+
| 2 | `getPendingTransactionsSessions()` | returns an record of pending sessions | `useGetPendingTransactionsSessions()`|
|
|
504
|
+
| 3 | `getPendingTransactions()` | returns an array of signed transactions | `useGetPendingTransactions()` |
|
|
505
|
+
| 4 | `getFailedTransactionsSessions()` | returns an record of failed sessions | `useGetFailedTransactionsSessions()`|
|
|
506
|
+
| 5 | `getFailedTransactions()` | returns an array of failed transactions | `useGetFailedTransactions()`|
|
|
507
|
+
| 6 | `getSuccessfulTransactionsSessions()` | returns an record of successful sessions | `useGetSuccessfulTransactionsSessions()`|
|
|
508
|
+
| 7 | `getSuccessfulTransactions()` | returns an array of successful transactions | `useGetSuccessfulTransactions()`|
|
|
509
|
+
|
|
507
510
|
5. **User feedback** is provided through toast notifications, which are triggered to inform about transactions' progress. Additional tracking details can be optionally displayed in the toast UI.
|
|
508
511
|
There is an option to add custom toast messages by using the `createCustomToast` helper.
|
|
509
512
|
|
|
@@ -718,9 +721,6 @@ export const FormatAmount = (props: IFormatAmountProps) => {
|
|
|
718
721
|
/>
|
|
719
722
|
);
|
|
720
723
|
};
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
724
|
```
|
|
725
725
|
|
|
726
726
|
|
|
@@ -734,7 +734,9 @@ flowchart LR
|
|
|
734
734
|
```
|
|
735
735
|
|
|
736
736
|
```typescript
|
|
737
|
-
|
|
737
|
+
import { ComponentFactory } from '@multiversx/sdk-dapp/out/utils/ComponentFactory';
|
|
738
|
+
|
|
739
|
+
const modalElement = await ComponentFactory.create<LedgerConnectModal>(
|
|
738
740
|
'mvx-ledger-connect-panel'
|
|
739
741
|
);
|
|
740
742
|
const eventBus = await modalElement.getEventBus();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as h}from"./chunk-RCRWI3XT.mjs";import{a as S}from"./chunk-F4W3N3JZ.mjs";import{a as o}from"./chunk-FMQYLMTU.mjs";import{a as y}from"./chunk-MFUQ5NBC.mjs";import{b as i,c as f}from"./chunk-Y4OUAJSG.mjs";import{l}from"./chunk-65L5EBBL.mjs";var u={};async function d({serverTransaction:e,sessionId:t,isSequential:c}){let{hash:a,status:r,results:m,invalidTransaction:n,hasStatusChanged:p}=e;try{if(u[a]>30){i({sessionId:t,status:"timedOut"}),await o({sessionId:t,status:"timedOut"});return}if(n&&!c||r==="sent"){u[a]=u[a]?u[a]+1:1;return}if(c&&!r){let s=f({sessionId:t,transaction:e});await o({sessionId:t,status:s});return}if(p){let s=f({sessionId:t,transaction:e});await o({sessionId:t,status:s})}l(r)&&await S({sessionId:t,hash:a,results:m})}catch(T){console.error(T),i({sessionId:t,status:"timedOut"}),await o({sessionId:t,status:"timedOut"})}}async function R({sessionId:e,transactionBatch:t,isSequential:c}){try{if(t==null)return;let a=y(t),r=await h(a);for(let n of r)await d({serverTransaction:n,sessionId:e,isSequential:c});if(r.every(n=>n.status!=="pending")){if(r.every(s=>s.status==="success"))return i({sessionId:e,status:"success"});if(r.some(s=>s.status==="fail"))return i({sessionId:e,status:"fail"});if(r.every(s=>s.invalidTransaction))return i({sessionId:e,status:"invalid"})}}catch(a){console.error(a)}}export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-33V2XBND.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-VML7BRY5.mjs";var a=class{constructor({uiDataUpdateEvent:t,uiTag:e}){this.eventBus=null;this.uiElement=null;this.isCreatingElement=!1;this.unsubscribeFunctions=new Map;this.uiDataUpdateEvent=t,this.uiTag=e,this.data=this.getInitialData()}async init(t){this.anchor=t,await this.createUIElement(t),await this.setupEventListeners()}updateData(t){this.data={...this.data,...t},this.notifyDataUpdate()}subscribeToEventBus(t,e){if(!this.eventBus)throw new Error("eventBus is not initialized");let i=this.eventBus?.subscribe(t,e);if(i){let n=this.unsubscribeFunctions.get(t)||[];n.push(i),this.unsubscribeFunctions.set(t,n)}}notifyDataUpdate(){this.eventBus?.publish(this.uiDataUpdateEvent,this.data)}destroy(){this.unsubscribeFunctions.forEach(t=>t.forEach(e=>e())),this.unsubscribeFunctions.clear(),this.eventBus=null,this.uiElement?.remove(),this.uiElement=null}getInitialData(){return this.initialData}resetData(){this.data=this.getInitialData()}async createUIElement(t=this.anchor){if(this.isCreatingElement||this.uiElement)return this.uiElement;if(this.isCreatingElement=!0,this.uiElement=await s.create({name:this.uiTag,anchor:t}),this.isCreatingElement=!1,!this.uiElement)throw new Error(`Failed to create ${this.uiTag} element`);if(this.eventBus||(this.eventBus=await this.uiElement.getEventBus()),!this.eventBus)throw new Error("eventBus is not initialized");return this.uiElement}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-4MNCFSUO.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-TQA3JDNV.mjs";import{u as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-TQA3JDNV.mjs";import{u as s}from"./chunk-GZTGHNVI.mjs";import{e as a}from"./chunk-QJSB5NX4.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-4USFY3DC.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as I}from"./chunk-PJDJEPY2.mjs";import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as I}from"./chunk-PJDJEPY2.mjs";import{a as l}from"./chunk-YDGXPL33.mjs";import{a as f}from"./chunk-S2FAYMW2.mjs";import{j as m,k as d,l as p,n as u}from"./chunk-65L5EBBL.mjs";import{a as T}from"./chunk-SZHXVDHF.mjs";var q=async({toastList:S,transactionsSessions:g,account:o,existingCompletedTransactions:y=[]})=>{let n=[],a=[...y],r=l(),F=f();for(let t of S.transactionToasts){let e=g[t.toastId];if(!e?.status)continue;let{status:s,transactions:C,transactionsDisplayInfo:P}=e,x=await T({transactions:C,address:o.address,explorerAddress:r,egldLabel:F}),A=u(s),E=p(s),L=d(s),i=A||E||L,v=m(s),{startTime:R,endTime:b}=t;if(i&&a.some(h=>h.toastId===t.toastId))continue;let c=I({toastId:t.toastId,address:o.address,status:s,transactions:x,transactionsDisplayInfo:P,explorerAddress:r,startTime:R,endTime:b});i&&a.push(c),v&&n.push(c)}return{pendingTransactionToasts:n,completedTransactionToasts:a}};export{q as a};
|
|
2
|
+
//# sourceMappingURL=chunk-532QQEN4.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-YVH7ZJXA.mjs";import{a as k}from"./chunk-TGCPDWQK.mjs";import{s as f}from"./chunk-GZTGHNVI.mjs";import{d as b}from"./chunk-QJSB5NX4.mjs";import{c as n}from"./chunk-MAK5NFYN.mjs";import{b as i}from"./chunk-GGBMHKR4.mjs";async function N(){let o=f(),I=g(),s=null,t=null,l=b(o.getState())?.timestamp,c=()=>{k()},u=()=>{s??=setInterval(c,I)},m=()=>{s&&(clearInterval(s),s=null)},p=()=>{m();let a=o.subscribe(({account:{websocketEvent:e}})=>{e?.message&&l!==e.timestamp&&(l=e.timestamp,c())});n.set("websocketEventReceived",a)},S=()=>{i.status!=="not_initialized"||t||(t=setInterval(()=>{i.status==="completed"&&(clearInterval(t),t=null,p())},1e3))};c();let r=()=>{m(),t&&(clearInterval(t),t=null)},v=o.subscribe(({account:{address:a},config:{websocketStatus:e}},T)=>{if(T.config.websocketStatus!==e)switch(e){case"completed":p();break;case"pending":u(),S();break;default:a?u():r();break}});return n.set("websocketStatusChanged",v),n.set("websocketEventReceived",r),{stopTransactionsTracking:r}}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5MDDPC5M.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-QTKK6OSJ.mjs";import{a as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-QTKK6OSJ.mjs";import{a as h}from"./chunk-Z6VA2J3J.mjs";import{a as g}from"./chunk-3S57OP4Z.mjs";import{NativeAuthClient as y}from"@multiversx/sdk-native-auth-client";var H=f=>{let{origin:o,apiAddress:i,expirySeconds:r,blockHashShard:s,extraInfo:u,gatewayUrl:d,extraRequestHeaders:k}=h(f),e=new y({origin:o,apiUrl:i,expirySeconds:r,blockHashShard:s,gatewayUrl:d,extraRequestHeaders:k});return{initialize:async t=>{if(!i||!o)return"";let a=()=>e.getCurrentBlockHash(),n=t?.latestBlockInfo;n??=await g({apiAddress:i,blockHashShard:s,getBlockHash:a,noCache:t?.noCache});let{hash:p,timestamp:c}=n,m=e.encodeValue(JSON.stringify({...t?.extraInfo??u,...c?{timestamp:c}:{}}));return`${e.encodeValue(o)}.${p}.${r}.${m}`},getToken:({address:t,token:a,signature:n})=>e.getToken(t,a,n),getTokenExpiration:l}};export{H as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7H2PZVSJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-AZGVI4QW.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-7RFUEHZX.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k}from"./chunk-SFZJXI7K.mjs";import{a as T}from"./chunk-P3BXXGQA.mjs";import{a as i}from"./chunk-W5MTQBQF.mjs";import{a as m}from"./chunk-EQEYL6AE.mjs";import{a as l}from"./chunk-VJ2DAL5M.mjs";import{c as d}from"./chunk-J4CPYFK6.mjs";import{a as o}from"./chunk-BSWV5MEC.mjs";var p=class{static async processTransactions({address:u,egldLabel:v,explorerAddress:g,transactions:L}){let f=L.map(e=>m({address:u,explorerAddress:g,transaction:e}));return await Promise.all(f.map(async e=>{let s=e.receiverAssets?.name.replace(/\p{Emoji}/gu,""),a=e.senderAssets?.name.replace(/\p{Emoji}/gu,""),{senderLockedAccount:h,receiverLockedAccount:D}=await k({receiver:e.receiver,sender:e.sender,tokenId:e.tokenIdentifier}),{egldValueData:t,tokenValueData:n,nftValueData:r}=T({transaction:e}),x=r?.token.type==="MetaESDT"?void 0:r?.badgeText,c=l.getData({input:t?.value??n?.value??r?.value??"",decimals:t?.decimals??n?.decimals??r?.decimals??d,digits:2}),y={badge:x??void 0,collection:n?.token.collection??r?.token.collection,egldLabel:t?v:"",link:n?.tokenExplorerLink??r?.tokenExplorerLink,linkText:n?.tokenLinkText??r?.tokenLinkText,name:n?.token.name??r?.token.name,showFormattedAmount:!!(t||n?.tokenFormattedAmount||r?.tokenFormattedAmount),svgUrl:n?.token.svgUrl??r?.token.svgUrl,ticker:n?.token.ticker??r?.token.ticker,titleText:n?.titleText??r?.titleText,valueDecimal:c.valueDecimal,valueInteger:c.valueInteger},w=i(e.receiverShard),A=i(e.senderShard);return{age:e.transactionDetails.age,direction:e.transactionDetails.direction,method:e.transactionDetails.method,iconInfo:e.transactionDetails.iconInfo,link:e.links.transactionLink??"",txHash:e.txHash,receiver:{address:e.receiver,name:s??"",description:`${s??e.receiver} (${e.receiver})`,isContract:o(e.receiver),isTokenLocked:!!D,link:e.links.receiverLink??"",shard:w,shardLink:e.links.receiverLink,showLink:e.transactionDetails.direction!=="In"},sender:{address:e.sender,name:a??"",description:`${a??e.sender} (${e.sender})`,isContract:o(e.sender),isTokenLocked:!!h,link:e.links.senderLink??"",shard:A,shardLink:e.links.senderShardLink,showLink:e.transactionDetails.direction!=="Out"},value:y}}))}};export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AI7LYKBU.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-MYCXIA5W.mjs";import{a as u}from"./chunk-QYV4JQI5.mjs";import{a as g}from"./chunk-YMSRWWNA.mjs";import{c as n}from"./chunk-MAK5NFYN.mjs";import{a}from"./chunk-OJV6XRG5.mjs";import{a as s}from"./chunk-BHXGUN5H.mjs";var c=(o,r)=>{let t=`sdk-dapp-logout-event-${o}`,e=r.getItem(t);e&&o!==e||(r.setItem(t,o),r.removeItem(t))};async function h({provider:o,options:r={shouldBroadcastLogoutAcrossTabs:!0,hasConsentPopup:!1}}){let t=u();r.shouldBroadcastLogoutAcrossTabs&&s.localStorage&&c(t,s.localStorage);try{return g(),r.hasConsentPopup&&o.getType()===a.crossWindow&&o.setShouldShowConsentPopup(!0),n.forEach(p=>p()),n.clear(),i.closeConnectionRef?.(),await o.logout()}catch(e){return console.error("Logging out error:",e),!1}}export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AZ2KOM5R.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-4MNCFSUO.mjs";import{a as t}from"./chunk-4KABQZJU.mjs";var s=class extends n{constructor({uiDataUpdateEvent:e,uiTag:i}){super({uiDataUpdateEvent:e,uiTag:i});this.isOpen=!1;this.data=this.getInitialData()}async openUI(){this.isOpen&&this.uiElement||(await super.init(),this.setIsSidePanelOpen(!0))}async destroy(){this.setIsSidePanelOpen(!1),await this.uiElement?.closeWithAnimation?.(),super.destroy()}closeUI(){this.resetData(),this.destroy()}setIsSidePanelOpen(e){this.isOpen=e,t(e)}};export{s as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AZGVI4QW.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants/window.constants.ts"],
|
|
4
|
-
"sourcesContent": ["export const safeWindow: Window =\n typeof window !== 'undefined' ? window : ({} as Window);\n\nexport const version = '5.0.0-alpha.
|
|
4
|
+
"sourcesContent": ["export const safeWindow: Window =\n typeof window !== 'undefined' ? window : ({} as Window);\n\nexport const version = '5.0.0-alpha.15'; // will be replaced at build time\n"],
|
|
5
5
|
"mappings": "AAAO,IAAMA,EACX,OAAO,OAAW,IAAc,OAAU,CAAC,EAEhCC,EAAU",
|
|
6
6
|
"names": ["safeWindow", "version"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as ot}from"./chunk-CTW5DICC.mjs";import{a as ct}from"./chunk-6UZHM5LW.mjs";import{a as C}from"./chunk-UZUI4AP5.mjs";import{a as mt}from"./chunk-ED5SQUAW.mjs";import{a as L}from"./chunk-FFEFZVCC.mjs";import{a as Q,b as X,g as Z,l as tt}from"./chunk-CAA4VJRH.mjs";import{a as lt}from"./chunk-LYXQ3FWU.mjs";import{b}from"./chunk-65RXDHRY.mjs";import{a as pt}from"./chunk-XDH23MRS.mjs";import{a as ht}from"./chunk-4ODPAHHA.mjs";import{a as gt}from"./chunk-Z5CDCI3Y.mjs";import{a as dt}from"./chunk-77IZTIMY.mjs";import{a as g}from"./chunk-47CCSYQY.mjs";import{a as J}from"./chunk-2ZNIPYEV.mjs";import{a as ft}from"./chunk-DCCGXGUQ.mjs";import{a as rt}from"./chunk-3ATEIVW3.mjs";import{a as S}from"./chunk-S4LN2NQH.mjs";import{a as y,f as ut}from"./chunk-A343RP4X.mjs";import{a as j}from"./chunk-K66JLLVW.mjs";import{a as I}from"./chunk-QTKK6OSJ.mjs";import{b as Tt}from"./chunk-HIODLP5F.mjs";import{d as it}from"./chunk-GXUJBKWY.mjs";import{k as st,l as et,n as nt}from"./chunk-65L5EBBL.mjs";import{a as A}from"./chunk-HORSXVIV.mjs";import{a as E}from"./chunk-6FXEHNGW.mjs";import{a as It}from"./chunk-NJN53MJV.mjs";import{a as Y}from"./chunk-YSCND2MX.mjs";import{b as V,s as u,u as q}from"./chunk-PGOE5XGR.mjs";import{b as d}from"./chunk-VNLGNNIL.mjs";import{b as h}from"./chunk-IEJTMYFW.mjs";import{c as $,f as G}from"./chunk-QJSB5NX4.mjs";import{b as H,c as K,f as z}from"./chunk-R53MCZI6.mjs";import{b as vt}from"./chunk-3LBQYLDY.mjs";import{a as at}from"./chunk-EKMRPW2A.mjs";import{a as v}from"./chunk-OJV6XRG5.mjs";import _ from"lodash.isequal";import Et from"lodash.isequal";var Nt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",w=class e extends rt{constructor(){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.store=u();this.initialData={pendingTransactions:[],historicTransactions:[]};this.data={...this.initialData}}static getInstance(){return e.instance||(e.instance=new e),e.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){p.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let s=this.store.subscribe(async({toasts:n,transactions:i},{toasts:a,transactions:c})=>{(!Et(a.transactionToasts,n.transactionToasts)||!Et(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Nt,[s]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}handleCloseUI(){let o=p.getInstance();this.closeUI(),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,account:s,toasts:n,network:i}=this.store.getState(),{pendingTransactionToasts:a}=await C({toastList:n,transactionsSessions:o,account:s});this.data.pendingTransactions=a,this.data.historicTransactions=await ot.getTransactionsHistory({transactionsSessions:o,address:s.address,explorerAddress:i.network.explorerAddress,egldLabel:i.network.egldLabel}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){it(),this.resetData(),this.updateNotificationsFeed()}async updateNotificationsFeed(){this.eventBus&&(this.eventBus.publish("PENDING_TRANSACTIONS_UPDATE",this.data.pendingTransactions),this.eventBus.publish("TRANSACTIONS_HISTORY_UPDATE",this.data.historicTransactions))}};import R from"bignumber.js";var x=class e{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=d(t),{isExpired:s}=I(o?.nativeAuthToken);s?f().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=d(t),s=G(t);return!!(o?.nativeAuthToken&&s)};this.addPlannedLogout=()=>{let t=f(),o=$(this.store.getState()),s=t.getType()===v.webview;if(!o||s)return;this.addLogoutWarning();let n=d(this.store.getState()),{secondsUntilExpires:i,expiresAt:a}=I(n?.nativeAuthToken),c=new R(String(i)),r=`${o}_${a}`,m=this.plannedLogoutKey===r;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=r,clearTimeout(this.plannedLogoutTimeoutRef??0);let W=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{p.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},W.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},W.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=h(this.store.getState()),o=d(this.store.getState()),{secondsUntilExpires:s}=I(o?.nativeAuthToken),n=new R(String(s)),i=n.times(1e3);if(!s||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new R(t?.tokenExpirationToastWarningSeconds??0).times(1e3),r=n.times(1e3).minus(c),m=ct(i.toNumber()),T=r.isLessThanOrEqualTo(0)?0:r.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{p.getInstance().createCustomToast({toastId:"native-auth-expired",iconClassName:"warning",title:"Session Expiration Warning",icon:"hourglass",message:`Your session will expire in ${m}!`}),this.warningLogoutTimeoutRef=null},T)}}static getInstance(){return e.instance||(e.instance=new e),e.instance}};async function U({address:e,provider:t,apiAddress:o}){let s=await E({address:e,baseURL:o});if(!s)throw new Error("Account not found");Tt({address:e,providerType:t.getType()});let n={...s,username:A(s.username),nonce:S(s)};y(n),await b(e),L(),s.shard!=null&&await mt({shard:Number(s.shard),apiAddress:o})}async function Ot(e){let{network:{apiAddress:t}}=g();await e.login();let o=await e.getAddress();if(!o)throw new Error("Address not found");return await U({address:o,provider:e,apiAddress:t}),{address:o}}async function Ft({provider:e,nativeAuthConfig:t,token:o}){let{network:{apiAddress:s}}=g(),n=j(t),i=o;i||(i=await n.initialize({noCache:!0}));let{address:a,signature:c,...r}=await e.login({token:i});if(!a)return console.warn("Login cancelled."),null;if(!c)return console.error("Failed to sign login token"),null;let m=n.getToken({address:a,token:i,signature:c});V({loginToken:i,signature:c,nativeAuthToken:m});let T=await pt({loginToken:i,extraInfoData:{multisig:r?.multisig,impersonate:r?.impersonate},address:a});return await U({address:T,provider:e,apiAddress:s}),{address:T,signature:c}}async function St(e,t){let o=h(q());if(o)return await Ft({provider:e,nativeAuthConfig:o,token:t?.token});let{address:s}=await Ot(e);return await b(s),L(),{address:s}}var k={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${X}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${Q}-${Date.now()}`}},Pt={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"},Dt=e=>{for(let[t,o]of Object.entries(Pt))if(e.includes(t))return o;return"Error when signing"};function B(e,t="error"){let o=e?.message,s=Dt(o),i=s!=="Error when signing"?"warning":t,a=Object.keys(k).includes(i)?k[i]:k.error,{toastId:c,iconClassName:r,title:m}=a;return N({toastId:c,duration:1e4,icon:"times",iconClassName:r,message:s,title:m}),s}async function Ct({provider:e,transactions:t,options:o={}}){await yt();let{isGuarded:s,activeGuardianAddress:n,nonce:i}=ft(),a=e.getType()===v.ledger,c=ht({latestNonce:i,transactions:t}),r=n&&s&&!o.skipGuardian?c?.map(T=>(T.version=H.withTxOptions().valueOf(),T.options=z.withOptions({guarded:!0,...a?{hashSign:!0}:{}}).valueOf(),T.guardian=K.newFromBech32(n),T)):c,m=await e.signTransactions(r)??[];return ut(i+m.length),m}var M=class{constructor(t){this.provider=t}init(){return this.provider.init()}async login(t){let o=await St(this.provider,t);return x.getInstance().init(),o}isInitialized(){return this.provider.isInitialized()}async logout(t={shouldBroadcastLogoutAcrossTabs:!0,hasConsentPopup:!1}){return await lt({provider:this.provider,options:t})}setShouldShowConsentPopup(t){this.provider.setShouldShowConsentPopup?.(t)}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,o){try{return await Ct({provider:this.provider,transactions:t,options:o})}catch(s){let n=B(s);throw new Error(n)}}async signMessage(t,o){try{return await dt({provider:this.provider,message:t,options:o})}catch(s){let n=B(s,"warning");throw new Error(n)}}async verifyMessage(t){return await gt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var bt=null;function ps(e){bt=e}function f(){return bt||new M(vt)}var Rt=async()=>{try{let e=J(),{network:t}=g();try{let o=await E({address:e,baseURL:t.apiAddress});if(o!=null){let s={...o,username:A(o.username),nonce:S(o)};return y(s),s}}catch(o){console.error("Failed getting account ",o)}}catch(e){console.error("Failed getting address ",e)}return null};async function yt(){let e=f();if(e==null)throw"Provider not initialized";try{if(!e.init)throw"Current provider does not have init() function";return await e.init()?Rt():void 0}catch(t){console.error("Failed initializing provider ",t)}}var O={},l={},Ut=(e,t)=>{u().setState(({toasts:o})=>{let s=o.customToasts.length>0?Math.max(...o.customToasts.map(r=>parseInt(r.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${s+1}`,i=o.customToasts.findIndex(r=>r.toastId===n),a={...e,toastId:n};if(i!==-1){o.customToasts[i]=a;return}o.customToasts.push({...a,toastId:n})},!1,"addCustomToast")},F=e=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(o=>o.toastId!==e)},!1,"removeCustomToast")},Lt=()=>{u().setState(({toasts:e})=>{e.customToasts=[]},!1,"removeAllCustomToasts")},_s=()=>{u().setState(({toasts:e})=>{e.transactionToasts=[]})},At=({toastId:e,totalDuration:t})=>{let o="";return u().setState(({toasts:s})=>{let n=s.transactionToasts.length>0?Math.max(...s.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;o=e??`transaction-toast-${n+1}`,s.transactionToasts.push({startTime:Y(),endTime:It(t),toastId:o})},!1,"addTransactionToast"),o},P=e=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(o=>o.toastId!==e)},!1,"removeTransactionToast"),delete l[e],delete O[e]},N=e=>{let{toasts:t}=u().getState(),o=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,s=e.toastId||`custom-toast-${o+1}`;return e.onClose&&(l[s]=e.onClose),e.instantiateToastElement?(O[s]=e.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(r=>r.toastId===s),a={...e,instantiateToastElement:null,toastId:s};i!==-1?n.customToasts[i]=a:n.customToasts.push(a)},!1,"createCustomToast"),s):(Ut(e,s),s)};var wt=1e4,D=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=wt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let o=setTimeout(()=>{P(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,o)};this.startWithCustomDuration=(t,o)=>{if(this.stop(t),o<=0)return;let s=setTimeout(()=>{F(t);let n=l[t];n?.()},o);this.timeoutIntervals.set(t,s)};this.stop=t=>{let o=this.timeoutIntervals.get(t);o&&(clearTimeout(o),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t||wt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};var p=class e{constructor(){this.isCreatingElement=!1;this.toastsElement=null;this.transactionToasts=[];this.customToasts=[];this.storeToastsSubscription=()=>null;this.eventBusUnsubscribeFunctions=[];this.eventBus=null;this.store=u();this.destroy(),this.lifetimeManager=new D,this.notificationsFeedManager=w.getInstance()}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),this.updateTransactionToastsList(),this.updateCustomToastList(),await this.subscribeToEventBusNotifications(),this.storeToastsSubscription=this.store.subscribe(({toasts:o,transactions:s},{toasts:n,transactions:i})=>{(!_(n.transactionToasts,o.transactionToasts)||!_(i,s))&&this.updateTransactionToastsList(),_(n.customToasts,o.customToasts)||this.updateCustomToastList()})}static getInstance(){return e.instance||(e.instance=new e),e.instance}handleCompletedTransaction(t){let{transactions:o}=this.store.getState(),s=o[t];if(!s)return!1;let{status:n}=s,i=nt(n),a=et(n),c=st(n),r=a||c||i;return r?(this.successfulToastLifetime&&this.lifetimeManager.start(t),r):(this.lifetimeManager.stop(t),r)}createTransactionToast(t,o){let s=At({toastId:t,totalDuration:o});return this.handleCompletedTransaction(t),this.updateTransactionToastsList(),s}createCustomToast(t){let o=N(t);return this.updateCustomToastList(),o}async updateTransactionToastsList(){let{toasts:t,transactions:o,account:s}=this.store.getState(),{pendingTransactionToasts:n,completedTransactionToasts:i}=await C({toastList:t,transactionsSessions:o,account:s});this.transactionToasts=[...n,...i];for(let a of t.transactionToasts)this.handleCompletedTransaction(a.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:O[o.toastId]};this.customToasts.push(n),o.duration&&this.lifetimeManager.startWithCustomDuration(o.toastId,o.duration)}this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await at.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}handleTransactionToastClose(t){this.handleCompletedTransaction(t)&&P(t)}async subscribeToEventBusNotifications(){let t=await this.createToastListElement();if(t){if(this.eventBus=await t.getEventBus(),!this.eventBus)throw new Error("eventBus is not initialized");this.eventBus.subscribe("CLOSE_TOAST",this.handleCloseToast.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.handleCloseToast.bind(this))}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}showToasts(){this.updateCustomToastList(),this.updateTransactionToastsList()}hideToasts(){this.transactionToasts=[],this.customToasts=[],this.eventBus?.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts),this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}handleCloseToast(t){if(this.customToasts.find(s=>s.toastId===t)){this.lifetimeManager.stop(t);let s=l[t];s?.(),F(t);return}this.handleTransactionToastClose(t)}async publishTransactionToasts(){if(!this.notificationsFeedManager.isNotificationsFeedOpen()){if(!this.eventBus){let t=await this.createToastListElement();if(!t)return;this.eventBus=await t.getEventBus()}this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts)}}destroy(){this.storeToastsSubscription(),this.lifetimeManager?.destroy(),this.notificationsFeedManager?.destroy(),Lt(),this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[]}};export{w as a,O as b,l as c,Ut as d,F as e,Lt as f,_s as g,At as h,P as i,N as j,D as k,p as l,x as m,U as n,St as o,B as p,Ct as q,M as r,ps as s,f as t,yt as u};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as ot}from"./chunk-BLUKJJTY.mjs";import{a as ct}from"./chunk-6UZHM5LW.mjs";import{a as C}from"./chunk-532QQEN4.mjs";import{a as mt}from"./chunk-QCJMV6NU.mjs";import{a as L}from"./chunk-5MDDPC5M.mjs";import{a as Q,b as X,g as Z,l as tt}from"./chunk-CAA4VJRH.mjs";import{a as lt}from"./chunk-AZ2KOM5R.mjs";import{b}from"./chunk-MYCXIA5W.mjs";import{a as pt}from"./chunk-O67FZOYR.mjs";import{a as ht}from"./chunk-4ODPAHHA.mjs";import{a as gt}from"./chunk-Z5CDCI3Y.mjs";import{a as dt}from"./chunk-T5GA3FRJ.mjs";import{a as g}from"./chunk-HACVN4R6.mjs";import{a as J}from"./chunk-QYV4JQI5.mjs";import{a as rt}from"./chunk-AZGVI4QW.mjs";import{a as S}from"./chunk-4USFY3DC.mjs";import{a as y,f as ut}from"./chunk-MXLRZPMK.mjs";import{b as Tt}from"./chunk-YMSRWWNA.mjs";import{d as it}from"./chunk-Y4OUAJSG.mjs";import{k as st,l as et,n as nt}from"./chunk-65L5EBBL.mjs";import{a as A}from"./chunk-HORSXVIV.mjs";import{a as ft}from"./chunk-GZAAD3TR.mjs";import{a as j}from"./chunk-7H2PZVSJ.mjs";import{a as I}from"./chunk-QTKK6OSJ.mjs";import{a as E}from"./chunk-6FXEHNGW.mjs";import{a as It}from"./chunk-NJN53MJV.mjs";import{a as Y}from"./chunk-YSCND2MX.mjs";import{b as V,s as u,u as q}from"./chunk-GZTGHNVI.mjs";import{c as $,f as G}from"./chunk-QJSB5NX4.mjs";import{b as d}from"./chunk-VNLGNNIL.mjs";import{b as h}from"./chunk-IEJTMYFW.mjs";import{b as H,c as K,f as z}from"./chunk-R53MCZI6.mjs";import{b as vt}from"./chunk-3LBQYLDY.mjs";import{a as at}from"./chunk-VML7BRY5.mjs";import{a as v}from"./chunk-OJV6XRG5.mjs";import _ from"lodash.isequal";import Et from"lodash.isequal";var Nt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",w=class e extends rt{constructor(){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.store=u();this.initialData={pendingTransactions:[],historicTransactions:[]};this.data={...this.initialData}}static getInstance(){return e.instance||(e.instance=new e),e.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){p.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let s=this.store.subscribe(async({toasts:n,transactions:i},{toasts:a,transactions:c})=>{(!Et(a.transactionToasts,n.transactionToasts)||!Et(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Nt,[s]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}handleCloseUI(){let o=p.getInstance();this.closeUI(),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,account:s,toasts:n,network:i}=this.store.getState(),{pendingTransactionToasts:a}=await C({toastList:n,transactionsSessions:o,account:s});this.data.pendingTransactions=a,this.data.historicTransactions=await ot.getTransactionsHistory({transactionsSessions:o,address:s.address,explorerAddress:i.network.explorerAddress,egldLabel:i.network.egldLabel}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){it(),this.resetData(),this.updateNotificationsFeed()}async updateNotificationsFeed(){this.eventBus&&(this.eventBus.publish("PENDING_TRANSACTIONS_UPDATE",this.data.pendingTransactions),this.eventBus.publish("TRANSACTIONS_HISTORY_UPDATE",this.data.historicTransactions))}};import R from"bignumber.js";var x=class e{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=d(t),{isExpired:s}=I(o?.nativeAuthToken);s?f().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=d(t),s=G(t);return!!(o?.nativeAuthToken&&s)};this.addPlannedLogout=()=>{let t=f(),o=$(this.store.getState()),s=t.getType()===v.webview;if(!o||s)return;this.addLogoutWarning();let n=d(this.store.getState()),{secondsUntilExpires:i,expiresAt:a}=I(n?.nativeAuthToken),c=new R(String(i)),r=`${o}_${a}`,m=this.plannedLogoutKey===r;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=r,clearTimeout(this.plannedLogoutTimeoutRef??0);let W=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{p.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},W.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},W.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=h(this.store.getState()),o=d(this.store.getState()),{secondsUntilExpires:s}=I(o?.nativeAuthToken),n=new R(String(s)),i=n.times(1e3);if(!s||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new R(t?.tokenExpirationToastWarningSeconds??0).times(1e3),r=n.times(1e3).minus(c),m=ct(i.toNumber()),T=r.isLessThanOrEqualTo(0)?0:r.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{p.getInstance().createCustomToast({toastId:"native-auth-expired",iconClassName:"warning",title:"Session Expiration Warning",icon:"hourglass",message:`Your session will expire in ${m}!`}),this.warningLogoutTimeoutRef=null},T)}}static getInstance(){return e.instance||(e.instance=new e),e.instance}};async function U({address:e,provider:t,apiAddress:o}){let s=await E({address:e,baseURL:o});if(!s)throw new Error("Account not found");Tt({address:e,providerType:t.getType()});let n={...s,username:A(s.username),nonce:S(s)};y(n),await b(e),L(),s.shard!=null&&await mt({shard:Number(s.shard),apiAddress:o})}async function Ot(e){let{network:{apiAddress:t}}=g();await e.login();let o=await e.getAddress();if(!o)throw new Error("Address not found");return await U({address:o,provider:e,apiAddress:t}),{address:o}}async function Ft({provider:e,nativeAuthConfig:t,token:o}){let{network:{apiAddress:s}}=g(),n=j(t),i=o;i||(i=await n.initialize({noCache:!0}));let{address:a,signature:c,...r}=await e.login({token:i});if(!a)return console.warn("Login cancelled."),null;if(!c)return console.error("Failed to sign login token"),null;let m=n.getToken({address:a,token:i,signature:c});V({loginToken:i,signature:c,nativeAuthToken:m});let T=await pt({loginToken:i,extraInfoData:{multisig:r?.multisig,impersonate:r?.impersonate},address:a});return await U({address:T,provider:e,apiAddress:s}),{address:T,signature:c}}async function St(e,t){let o=h(q());if(o)return await Ft({provider:e,nativeAuthConfig:o,token:t?.token});let{address:s}=await Ot(e);return await b(s),L(),{address:s}}var k={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${X}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${Q}-${Date.now()}`}},Pt={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"},Dt=e=>{for(let[t,o]of Object.entries(Pt))if(e.includes(t))return o;return"Error when signing"};function B(e,t="error"){let o=e?.message,s=Dt(o),i=s!=="Error when signing"?"warning":t,a=Object.keys(k).includes(i)?k[i]:k.error,{toastId:c,iconClassName:r,title:m}=a;return N({toastId:c,duration:1e4,icon:"times",iconClassName:r,message:s,title:m}),s}async function Ct({provider:e,transactions:t,options:o={}}){await yt();let{isGuarded:s,activeGuardianAddress:n,nonce:i}=ft(),a=e.getType()===v.ledger,c=ht({latestNonce:i,transactions:t}),r=n&&s&&!o.skipGuardian?c?.map(T=>(T.version=H.withTxOptions().valueOf(),T.options=z.withOptions({guarded:!0,...a?{hashSign:!0}:{}}).valueOf(),T.guardian=K.newFromBech32(n),T)):c,m=await e.signTransactions(r)??[];return ut(i+m.length),m}var M=class{constructor(t){this.provider=t}init(){return this.provider.init()}async login(t){let o=await St(this.provider,t);return x.getInstance().init(),o}isInitialized(){return this.provider.isInitialized()}async logout(t={shouldBroadcastLogoutAcrossTabs:!0,hasConsentPopup:!1}){return await lt({provider:this.provider,options:t})}setShouldShowConsentPopup(t){this.provider.setShouldShowConsentPopup?.(t)}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,o){try{return await Ct({provider:this.provider,transactions:t,options:o})}catch(s){let n=B(s);throw new Error(n)}}async signMessage(t,o){try{return await dt({provider:this.provider,message:t,options:o})}catch(s){let n=B(s,"warning");throw new Error(n)}}async verifyMessage(t){return await gt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var bt=null;function ps(e){bt=e}function f(){return bt||new M(vt)}var Rt=async()=>{try{let e=J(),{network:t}=g();try{let o=await E({address:e,baseURL:t.apiAddress});if(o!=null){let s={...o,username:A(o.username),nonce:S(o)};return y(s),s}}catch(o){console.error("Failed getting account ",o)}}catch(e){console.error("Failed getting address ",e)}return null};async function yt(){let e=f();if(e==null)throw"Provider not initialized";try{if(!e.init)throw"Current provider does not have init() function";return await e.init()?Rt():void 0}catch(t){console.error("Failed initializing provider ",t)}}var O={},l={},Ut=(e,t)=>{u().setState(({toasts:o})=>{let s=o.customToasts.length>0?Math.max(...o.customToasts.map(r=>parseInt(r.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${s+1}`,i=o.customToasts.findIndex(r=>r.toastId===n),a={...e,toastId:n};if(i!==-1){o.customToasts[i]=a;return}o.customToasts.push({...a,toastId:n})},!1,"addCustomToast")},F=e=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(o=>o.toastId!==e)},!1,"removeCustomToast")},Lt=()=>{u().setState(({toasts:e})=>{e.customToasts=[]},!1,"removeAllCustomToasts")},Ws=()=>{u().setState(({toasts:e})=>{e.transactionToasts=[]})},At=({toastId:e,totalDuration:t})=>{let o="";return u().setState(({toasts:s})=>{let n=s.transactionToasts.length>0?Math.max(...s.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;o=e??`transaction-toast-${n+1}`,s.transactionToasts.push({startTime:Y(),endTime:It(t),toastId:o})},!1,"addTransactionToast"),o},P=e=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(o=>o.toastId!==e)},!1,"removeTransactionToast"),delete l[e],delete O[e]},N=e=>{let{toasts:t}=u().getState(),o=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,s=e.toastId||`custom-toast-${o+1}`;return e.onClose&&(l[s]=e.onClose),e.instantiateToastElement?(O[s]=e.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(r=>r.toastId===s),a={...e,instantiateToastElement:null,toastId:s};i!==-1?n.customToasts[i]=a:n.customToasts.push(a)},!1,"createCustomToast"),s):(Ut(e,s),s)};var wt=1e4,D=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=wt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let o=setTimeout(()=>{P(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,o)};this.startWithCustomDuration=(t,o)=>{if(this.stop(t),o<=0)return;let s=setTimeout(()=>{F(t);let n=l[t];n?.()},o);this.timeoutIntervals.set(t,s)};this.stop=t=>{let o=this.timeoutIntervals.get(t);o&&(clearTimeout(o),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t||wt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};var p=class e{constructor(){this.isCreatingElement=!1;this.toastsElement=null;this.transactionToasts=[];this.customToasts=[];this.storeToastsSubscription=()=>null;this.eventBusUnsubscribeFunctions=[];this.eventBus=null;this.store=u();this.destroy(),this.lifetimeManager=new D,this.notificationsFeedManager=w.getInstance()}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),this.updateTransactionToastsList(),this.updateCustomToastList(),await this.subscribeToEventBusNotifications(),this.storeToastsSubscription=this.store.subscribe(({toasts:o,transactions:s},{toasts:n,transactions:i})=>{(!_(n.transactionToasts,o.transactionToasts)||!_(i,s))&&this.updateTransactionToastsList(),_(n.customToasts,o.customToasts)||this.updateCustomToastList()})}static getInstance(){return e.instance||(e.instance=new e),e.instance}handleCompletedTransaction(t){let{transactions:o}=this.store.getState(),s=o[t];if(!s)return!1;let{status:n}=s,i=nt(n),a=et(n),c=st(n),r=a||c||i;return r?(this.successfulToastLifetime&&this.lifetimeManager.start(t),r):(this.lifetimeManager.stop(t),r)}createTransactionToast(t,o){let s=At({toastId:t,totalDuration:o});return this.handleCompletedTransaction(t),this.updateTransactionToastsList(),s}createCustomToast(t){let o=N(t);return this.updateCustomToastList(),o}async updateTransactionToastsList(){let{toasts:t,transactions:o,account:s}=this.store.getState(),{pendingTransactionToasts:n,completedTransactionToasts:i}=await C({toastList:t,transactionsSessions:o,account:s});this.transactionToasts=[...n,...i];for(let a of t.transactionToasts)this.handleCompletedTransaction(a.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:O[o.toastId]};this.customToasts.push(n),o.duration&&this.lifetimeManager.startWithCustomDuration(o.toastId,o.duration)}this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await at.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}handleTransactionToastClose(t){this.handleCompletedTransaction(t)&&P(t)}async subscribeToEventBusNotifications(){let t=await this.createToastListElement();if(t){if(this.eventBus=await t.getEventBus(),!this.eventBus)throw new Error("eventBus is not initialized");this.eventBus.subscribe("CLOSE_TOAST",this.handleCloseToast.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.handleCloseToast.bind(this))}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}showToasts(){this.updateCustomToastList(),this.updateTransactionToastsList()}hideToasts(){this.transactionToasts=[],this.customToasts=[],this.eventBus?.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts),this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}handleCloseToast(t){if(this.customToasts.find(s=>s.toastId===t)){this.lifetimeManager.stop(t);let s=l[t];s?.(),F(t);return}this.handleTransactionToastClose(t)}async publishTransactionToasts(){if(!this.notificationsFeedManager.isNotificationsFeedOpen()){if(!this.eventBus){let t=await this.createToastListElement();if(!t)return;this.eventBus=await t.getEventBus()}this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts)}}destroy(){this.storeToastsSubscription(),this.lifetimeManager?.destroy(),this.notificationsFeedManager?.destroy(),Lt(),this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[]}};export{w as a,O as b,l as c,Ut as d,F as e,Lt as f,Ws as g,At as h,P as i,N as j,D as k,p as l,x as m,U as n,St as o,B as p,Ct as q,M as r,ps as s,f as t,yt as u};
|
|
2
|
+
//# sourceMappingURL=chunk-BTXVE2KE.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as pe}from"./chunk-3U6H4VPO.mjs";import{a as le}from"./chunk-M3YL36ZL.mjs";import{a as se}from"./chunk-JGFDKHG2.mjs";import{a as V}from"./chunk-KGASLT4P.mjs";import{a as ae}from"./chunk-JF4GVWO4.mjs";import{a as ne}from"./chunk-6H5TKCEW.mjs";import{a as I}from"./chunk-AGHFAZ7O.mjs";import{a as oe}from"./chunk-YUFPUG5O.mjs";import{a as ge}from"./chunk-ER735UVF.mjs";import{a as p}from"./chunk-GOL32UNC.mjs";import{a as ce}from"./chunk-ISB4SC4L.mjs";import{a as de}from"./chunk-3UIJI5YR.mjs";import{a as te}from"./chunk-FFNSZC37.mjs";import{a as ie}from"./chunk-KWJVDPCC.mjs";import{b as re}from"./chunk-4Z3DZ2A3.mjs";import{e as u,f as ee}from"./chunk-FFHVVGYW.mjs";import{j as Q,l as U,r as S,s as C,t as b}from"./chunk-QNKYH6KO.mjs";import{a as P}from"./chunk-W46BAMEI.mjs";import{g as J}from"./chunk-CAA4VJRH.mjs";import{a as Y}from"./chunk-2ZNIPYEV.mjs";import{a as R}from"./chunk-4TBVQD27.mjs";import{a as Z}from"./chunk-HIODLP5F.mjs";import{a as N,s as $,u as d}from"./chunk-PGOE5XGR.mjs";import{b as E,c as G}from"./chunk-SAAOQW7P.mjs";import{a as q}from"./chunk-VNLGNNIL.mjs";import{b as F,c as j,d as K}from"./chunk-IEJTMYFW.mjs";import{f as H}from"./chunk-QJSB5NX4.mjs";import{a as L}from"./chunk-VMFJUT3G.mjs";import{a as c}from"./chunk-REI3WYXH.mjs";import{b as X}from"./chunk-U5IR3XBA.mjs";import{a as o}from"./chunk-OJV6XRG5.mjs";import{a as M}from"./chunk-NONAAAZC.mjs";import{IframeLoginTypes as ue}from"@multiversx/sdk-web-wallet-iframe-provider/out/constants";var f=class extends p{constructor({address:e,anchor:r,shouldInitProvider:t}){super(e);this.provider=null;this.config=null;this.ledgerLogin=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");if(!e||typeof e.addressIndex!="number")throw new Error("Missing addressIndex for Ledger login");let{address:r,signature:t}=await this.provider.login({addressIndex:e.addressIndex});return{address:r,signature:t??""}};this.loginOperation=async e=>{if(!this.provider||!this.config)throw new Error("Provider is not initialized.");return await se({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!I())return;await V.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ce({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 me({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await ne({shouldInitProvider:!0});this.provider=r}catch(r){throw Q({toastId:"ledger-provider-rebuild-error",duration:1e4,icon:"times",iconClassName:"warning",message:"Unlock your device & open the MultiversX App",title:"Ledger unavailable"}),r}}};this.options={anchor:r,shouldInitProvider:t},this._login=this.ledgerLogin.bind(this)}async init(){try{this.initializeAddress(),await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return o.ledger}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){await L(M),await this.initLegderConnectManager(this.options?.anchor);let e=V.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((n,s)=>ae({manager:e,resolve:n,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var we=3e4,ye=5e3,Pe=3e3,k=class a{constructor(){this.store=$();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let i=this.store.getState(),{providerType:e}=q(i),r=H(i);return!!(e===o.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let i=re(d());if(!(!this.shouldCheckConnection()||i))try{await b().getProvider().getAddress()}catch{if(U.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"times",iconClassName:"warning",message:"Unlock your device to continue signing transactions",title:"Ledger disconnected"}),this.reset(),this.recreateProviderInterval)return;this.recreateProviderInterval=setInterval(this.reconnectProvider,ye)}},we))};this.reconnectProvider=async()=>{if(this.shouldCheckConnection())try{let i=new f({shouldInitProvider:!0});await i.init();let e=new S(i);i.getType=()=>o.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,U.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",duration:Pe,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 W=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();this.setPopupConsent();try{let n=await this.provider.signTransactions(e)??[];return await de(n)}catch(n){throw await r({shouldCancelAction:!0}),n}finally{t.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return this.setPopupConsent(),await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.crossWindow})};this.setPopupConsent=()=>{let e=K(d());if(!this.provider)throw new Error("Provider is not initialized.");(e?.isBrowserWithPopupConfirmation||X)&&this.provider.setShouldShowConsentPopup(!0)};this.walletAddress=e?.walletAddress,this.provider=te.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=E(d()),r=await this.provider.init();return this.provider.setWalletUrl(this.walletAddress??e.walletAddress),this.setPopupConsent(),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 Ce}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(n){throw await t({shouldCancelAction:!1}),n}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.provider=Ce.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 Ie={passkey:o.passkey,metamask:o.metamask},T=class extends p{constructor({type:e,address:r,walletUrl:t}){super(r);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)}catch(n){throw await t({shouldCancelAction:!0}),n}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider||!this.type)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c[this.type]})};this.type=e,this.walletUrl=t??"",this.provider=le.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=E(d());if(!e.iframeWalletAddress)throw new Error("Invalid walletUrl");this.walletUrl=e.iframeWalletAddress}async initializeProvider(){return await this.provider.init(),this.address&&this.setAccount({address:this.address}),this.provider.setLoginType(this.type),this.provider.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return Ie[this.type]}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{OptionalOperation as ve}from"@multiversx/sdk-wallet-connect-provider/out";var he=[u.CANCEL_ACTION,u.SIGN_LOGIN_TOKEN],x=class extends p{constructor(e){super();this.provider=null;this.methods=[];this._approval=null;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(n){throw await t({shouldCancelAction:!0}),await this.sendCustomRequest({method:u.CANCEL_ACTION,action:ve.CANCEL_ACTION}),n}finally{r.closeUI()}};this.cancelAction=async()=>{await this.sendCustomRequest({method:u.CANCEL_ACTION,action:ve.CANCEL_ACTION})};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.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 L(M),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:n}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??R.walletConnectDeepLink;this._approval=n,P.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!I())return;await P.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=I(),t=G(d());if(F(d())&&he.push(u.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{Z()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:O={},walletConnectV2RelayAddress:D=""}=e,y=new ee(v,t,D,m,O);return await y.init(),{walletConnectProvider:y,dappMethods:he}}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=P.getInstance(),{uri:n="",approval:s}=await this.provider.connect({methods:this.methods}),l=this.config.walletConnectDeepLink??R.walletConnectDeepLink;t.updateData({wcURI:n,walletConnectDeepLink:`${l}?wallet-connect=${encodeURIComponent(n)}`});let w=await this.provider.login({approval:s,token:e?.token}),{address:v="",signature:m=""}=w??{};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:n="",signature:s=""}=t??{};return P.getInstance().handleClose({isLoginFinished:!!n}),{address:n,signature:s}}catch(t){return console.error("User rejected connection proposal",t),await r()}}async sendCustomRequest({action:e,method:r}){if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.sendCustomRequest?.({request:{method:r,params:{action:e}}})}catch(t){console.error("Unable to send event",t)}}};var A=class{static set customProviders(i){this._customProviders=i}static get customProviders(){return this._customProviders}static async create({type:i,anchor:e}){let r=null;switch(i){case o.extension:{r=new _;break}case o.crossWindow:{r=new W;break}case o.ledger:{r=new f({anchor:e}),await k.getInstance().init();break}case o.metamask:{r=new T({type:ue.metamask});break}case o.passkey:{r=new T({type:ue.passkey});break}case o.walletConnect:{let s=j(d());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new x({anchor:e,...s});break}case o.webview:{r=new ge;break}default:{let s=Y();for(let l of this._customProviders)l.type===i&&(r=await l.constructor({address:s,anchor:e}));break}}if(!r)throw new Error("Unable to create provider");await r.init();let t=new S(r);C(t),N(i);let n=[o.crossWindow,o.metamask,o.passkey].includes(i);return pe(n?{skipLoginMethod:i}:null),t}static async destroy(){b().cancelLogin(),C(null),N(o.none)}};A._customProviders=[];var Ae=(a,i)=>a.some(e=>e.type===i);async function g({message:a,handleSignMessage:i,cancelAction:e,providerType:r}){return await new Promise(async(n,s)=>{let{manager:l,onClose:w}=await ie({cancelAction:e}),v=Object.values(A.customProviders),m=v.reduce((h,B)=>(h[B.type]=B.name,h),{}),O={...c,...m},D=async()=>{await w({shouldCancelAction:!0}),s({message:"Signing canceled"})};l.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",D);let y=Ae(v,r)?r:o.none;l.updateData({name:O[y],type:y});try{let h=await i(a);n(h)}catch(h){await w({shouldCancelAction:!0}),s(h)}finally{l.closeUI()}})}async function me({message:a,handleSignMessage:i}){try{return await g({message:a,handleSignMessage:i,providerType:c.ledger})}catch(e){let{errorMessage:r}=oe(e);throw r?{message:r}:e}}export{me as a,f as b,k as c,A as d,g as e,W as f,_ as g,T as h,x as i};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as pe}from"./chunk-3U6H4VPO.mjs";import{a as le}from"./chunk-M3YL36ZL.mjs";import{a as se}from"./chunk-KNRIU7GR.mjs";import{a as V}from"./chunk-JYZ5XXJG.mjs";import{a as ae}from"./chunk-O67WFDS3.mjs";import{a as ne}from"./chunk-QZ27VHW6.mjs";import{a as I}from"./chunk-CMEBBADF.mjs";import{a as oe}from"./chunk-YUFPUG5O.mjs";import{a as ge}from"./chunk-IQVVCXXL.mjs";import{a as p}from"./chunk-RLVN434K.mjs";import{a as ie}from"./chunk-RPBH7EFR.mjs";import{a as ce}from"./chunk-GXMIT5JQ.mjs";import{a as de}from"./chunk-F4WQOPSX.mjs";import{a as te}from"./chunk-FFNSZC37.mjs";import{b as re}from"./chunk-4Z3DZ2A3.mjs";import{e as u,f as ee}from"./chunk-FFHVVGYW.mjs";import{j as Q,l as U,r as S,s as C,t as b}from"./chunk-BTXVE2KE.mjs";import{a as P}from"./chunk-TEYO3CV4.mjs";import{g as J}from"./chunk-CAA4VJRH.mjs";import{a as Y}from"./chunk-QYV4JQI5.mjs";import{a as R}from"./chunk-4TBVQD27.mjs";import{a as Z}from"./chunk-YMSRWWNA.mjs";import{a as N,s as $,u as d}from"./chunk-GZTGHNVI.mjs";import{f as H}from"./chunk-QJSB5NX4.mjs";import{b as E,c as G}from"./chunk-SAAOQW7P.mjs";import{a as q}from"./chunk-VNLGNNIL.mjs";import{b as F,c as j,d as K}from"./chunk-IEJTMYFW.mjs";import{a as L}from"./chunk-VMFJUT3G.mjs";import{a as c}from"./chunk-REI3WYXH.mjs";import{b as X}from"./chunk-JMXZ4XDT.mjs";import{a as o}from"./chunk-OJV6XRG5.mjs";import{a as M}from"./chunk-BHXGUN5H.mjs";import{IframeLoginTypes as ue}from"@multiversx/sdk-web-wallet-iframe-provider/out/constants";var f=class extends p{constructor({address:e,anchor:r,shouldInitProvider:t}){super(e);this.provider=null;this.config=null;this.ledgerLogin=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");if(!e||typeof e.addressIndex!="number")throw new Error("Missing addressIndex for Ledger login");let{address:r,signature:t}=await this.provider.login({addressIndex:e.addressIndex});return{address:r,signature:t??""}};this.loginOperation=async e=>{if(!this.provider||!this.config)throw new Error("Provider is not initialized.");return await se({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!I())return;await V.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ce({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 me({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await ne({shouldInitProvider:!0});this.provider=r}catch(r){throw Q({toastId:"ledger-provider-rebuild-error",duration:1e4,icon:"times",iconClassName:"warning",message:"Unlock your device & open the MultiversX App",title:"Ledger unavailable"}),r}}};this.options={anchor:r,shouldInitProvider:t},this._login=this.ledgerLogin.bind(this)}async init(){try{this.initializeAddress(),await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return o.ledger}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){await L(M),await this.initLegderConnectManager(this.options?.anchor);let e=V.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((n,s)=>ae({manager:e,resolve:n,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var we=3e4,ye=5e3,Pe=3e3,k=class a{constructor(){this.store=$();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let i=this.store.getState(),{providerType:e}=q(i),r=H(i);return!!(e===o.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let i=re(d());if(!(!this.shouldCheckConnection()||i))try{await b().getProvider().getAddress()}catch{if(U.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"times",iconClassName:"warning",message:"Unlock your device to continue signing transactions",title:"Ledger disconnected"}),this.reset(),this.recreateProviderInterval)return;this.recreateProviderInterval=setInterval(this.reconnectProvider,ye)}},we))};this.reconnectProvider=async()=>{if(this.shouldCheckConnection())try{let i=new f({shouldInitProvider:!0});await i.init();let e=new S(i);i.getType=()=>o.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,U.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",duration:Pe,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 W=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();this.setPopupConsent();try{let n=await this.provider.signTransactions(e)??[];return await de(n)}catch(n){throw await r({shouldCancelAction:!0}),n}finally{t.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return this.setPopupConsent(),await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.crossWindow})};this.setPopupConsent=()=>{let e=K(d());if(!this.provider)throw new Error("Provider is not initialized.");(e?.isBrowserWithPopupConfirmation||X)&&this.provider.setShouldShowConsentPopup(!0)};this.walletAddress=e?.walletAddress,this.provider=te.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=E(d()),r=await this.provider.init();return this.provider.setWalletUrl(this.walletAddress??e.walletAddress),this.setPopupConsent(),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 Ce}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(n){throw await t({shouldCancelAction:!1}),n}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.provider=Ce.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 Ie={passkey:o.passkey,metamask:o.metamask},T=class extends p{constructor({type:e,address:r,walletUrl:t}){super(r);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)}catch(n){throw await t({shouldCancelAction:!0}),n}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider||!this.type)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c[this.type]})};this.type=e,this.walletUrl=t??"",this.provider=le.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=E(d());if(!e.iframeWalletAddress)throw new Error("Invalid walletUrl");this.walletUrl=e.iframeWalletAddress}async initializeProvider(){return await this.provider.init(),this.address&&this.setAccount({address:this.address}),this.provider.setLoginType(this.type),this.provider.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return Ie[this.type]}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{OptionalOperation as ve}from"@multiversx/sdk-wallet-connect-provider/out";var he=[u.CANCEL_ACTION,u.SIGN_LOGIN_TOKEN],x=class extends p{constructor(e){super();this.provider=null;this.methods=[];this._approval=null;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(n){throw await t({shouldCancelAction:!0}),await this.sendCustomRequest({method:u.CANCEL_ACTION,action:ve.CANCEL_ACTION}),n}finally{r.closeUI()}};this.cancelAction=async()=>{await this.sendCustomRequest({method:u.CANCEL_ACTION,action:ve.CANCEL_ACTION})};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.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 L(M),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:n}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??R.walletConnectDeepLink;this._approval=n,P.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!I())return;await P.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=I(),t=G(d());if(F(d())&&he.push(u.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{Z()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:O={},walletConnectV2RelayAddress:D=""}=e,y=new ee(v,t,D,m,O);return await y.init(),{walletConnectProvider:y,dappMethods:he}}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=P.getInstance(),{uri:n="",approval:s}=await this.provider.connect({methods:this.methods}),l=this.config.walletConnectDeepLink??R.walletConnectDeepLink;t.updateData({wcURI:n,walletConnectDeepLink:`${l}?wallet-connect=${encodeURIComponent(n)}`});let w=await this.provider.login({approval:s,token:e?.token}),{address:v="",signature:m=""}=w??{};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:n="",signature:s=""}=t??{};return P.getInstance().handleClose({isLoginFinished:!!n}),{address:n,signature:s}}catch(t){return console.error("User rejected connection proposal",t),await r()}}async sendCustomRequest({action:e,method:r}){if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.sendCustomRequest?.({request:{method:r,params:{action:e}}})}catch(t){console.error("Unable to send event",t)}}};var A=class{static set customProviders(i){this._customProviders=i}static get customProviders(){return this._customProviders}static async create({type:i,anchor:e}){let r=null;switch(i){case o.extension:{r=new _;break}case o.crossWindow:{r=new W;break}case o.ledger:{r=new f({anchor:e}),await k.getInstance().init();break}case o.metamask:{r=new T({type:ue.metamask});break}case o.passkey:{r=new T({type:ue.passkey});break}case o.walletConnect:{let s=j(d());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new x({anchor:e,...s});break}case o.webview:{r=new ge;break}default:{let s=Y();for(let l of this._customProviders)l.type===i&&(r=await l.constructor({address:s,anchor:e}));break}}if(!r)throw new Error("Unable to create provider");await r.init();let t=new S(r);C(t),N(i);let n=[o.crossWindow,o.metamask,o.passkey].includes(i);return pe(n?{skipLoginMethod:i}:null),t}static async destroy(){b().cancelLogin(),C(null),N(o.none)}};A._customProviders=[];var Ae=(a,i)=>a.some(e=>e.type===i);async function g({message:a,handleSignMessage:i,cancelAction:e,providerType:r}){return await new Promise(async(n,s)=>{let{manager:l,onClose:w}=await ie({cancelAction:e}),v=Object.values(A.customProviders),m=v.reduce((h,B)=>(h[B.type]=B.name,h),{}),O={...c,...m},D=async()=>{await w({shouldCancelAction:!0}),s({message:"Signing canceled"})};l.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",D);let y=Ae(v,r)?r:o.none;l.updateData({name:O[y],type:y});try{let h=await i(a);n(h)}catch(h){await w({shouldCancelAction:!0}),s(h)}finally{l.closeUI()}})}async function me({message:a,handleSignMessage:i}){try{return await g({message:a,handleSignMessage:i,providerType:c.ledger})}catch(e){let{errorMessage:r}=oe(e);throw r?{message:r}:e}}export{me as a,f as b,k as c,A as d,g as e,W as f,_ as g,T as h,x as i};
|
|
2
|
+
//# sourceMappingURL=chunk-C3F3EPNZ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as w}from"./chunk-YK7T6MBD.mjs";import{a as l}from"./chunk-KMJMQEXI.mjs";import{s as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as w}from"./chunk-YK7T6MBD.mjs";import{a as l}from"./chunk-KMJMQEXI.mjs";import{s as u}from"./chunk-GZTGHNVI.mjs";import{a as c}from"./chunk-SQVKVA7X.mjs";import{a as i}from"./chunk-ULUZWP2P.mjs";var e=o=>u().setState(({network:r})=>{r.network={...r.network,...o}},!1,"initializeNetworkConfig");var y=async({customNetworkConfig:o={},environment:r})=>{let d=!o?.skipFetchFromServer,g=o?.apiAddress,n=r&&r in i,p=n?i[r]:{},s={...c,...p,...o},t={...s,apiTimeout:String(s.apiTimeout)},N=p?.apiAddress;if(!n&&d){let a=g||N,m=await w(a),f=t.roundDuration?null:await l(a);if(f!=null&&(t.roundDuration=f.erd_round_duration),m!=null){let k={...t,...m,...o};return e(k),k}}return e(t),t};export{y as a,e as b};
|
|
2
|
+
//# sourceMappingURL=chunk-CBH7E57H.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as n}from"./chunk-B2UIPHJ3.mjs";var c=()=>{let i;try{i=n()}catch{i=!1}if(!i)return{pathname:"",hash:"",origin:"",href:"",search:""};let{location:{pathname:r,hash:t,origin:e,href:o,search:a}}=window;return{pathname:r,hash:t,origin:e,href:o,search:a}};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CKTFPRJS.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/window/getWindowLocation.ts"],
|
|
4
|
+
"sourcesContent": ["import { isWindowAvailable } from './isWindowAvailable';\n\ntype GetWindowLocationType = {\n pathname: string;\n hash: string;\n origin: string;\n href: string;\n search: string;\n};\n\nexport const getWindowLocation = (): GetWindowLocationType => {\n let isAvailable: boolean;\n\n try {\n isAvailable = isWindowAvailable();\n } catch (_error) {\n isAvailable = false;\n }\n\n if (!isAvailable) {\n return {\n pathname: '',\n hash: '',\n origin: '',\n href: '',\n search: ''\n };\n }\n\n const {\n location: { pathname, hash, origin, href, search }\n } = window;\n\n return {\n pathname,\n hash,\n origin,\n href,\n search\n };\n};\n"],
|
|
5
|
+
"mappings": "yCAUO,IAAMA,EAAoB,IAA6B,CAC5D,IAAIC,EAEJ,GAAI,CACFA,EAAcC,EAAkB,CAClC,MAAiB,CACfD,EAAc,EAChB,CAEA,GAAI,CAACA,EACH,MAAO,CACL,SAAU,GACV,KAAM,GACN,OAAQ,GACR,KAAM,GACN,OAAQ,EACV,EAGF,GAAM,CACJ,SAAU,CAAE,SAAAE,EAAU,KAAAC,EAAM,OAAAC,EAAQ,KAAAC,EAAM,OAAAC,CAAO,CACnD,EAAI,OAEJ,MAAO,CACL,SAAAJ,EACA,KAAAC,EACA,OAAAC,EACA,KAAAC,EACA,OAAAC,CACF,CACF",
|
|
6
|
+
"names": ["getWindowLocation", "isAvailable", "isWindowAvailable", "pathname", "hash", "origin", "href", "search"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as h}from"./chunk-YIWTWMQF.mjs";import{a as S}from"./chunk-EAJBSX6Y.mjs";import{a as f}from"./chunk-Y3BNMQFP.mjs";import{h as l}from"./chunk-BTXVE2KE.mjs";import{h as d}from"./chunk-CAA4VJRH.mjs";import{b as g}from"./chunk-3ZEUVYQF.mjs";import{a as u}from"./chunk-Y4OUAJSG.mjs";import{a as m}from"./chunk-L3MWDI6J.mjs";import{a as y}from"./chunk-GZAAD3TR.mjs";import{u as p}from"./chunk-GZTGHNVI.mjs";import{b as c}from"./chunk-SAAOQW7P.mjs";import{e as T}from"./chunk-R53MCZI6.mjs";import b from"axios";var r=class r{constructor(){this.setCallbacks=({onSuccess:a,onFail:t})=>{g({onSuccess:a,onFail:t})};this.send=async a=>{if(a.length===0)throw new Error("No transactions to send");try{if(!S(a))return await this.sendSignedTransactions(a);let t=await this.sendSignedBatchTransactions(a);if(!t.data||t.data.error)throw new Error(t.data?.error??"Failed to send transactions");return t.data.transactions}catch(t){throw t.response?.data?.message??t.message}};this.track=async(a,t={disableToasts:!1})=>{let n=this.sequentialToFlatArray(a).map(i=>({...i,status:i.status??"pending"})),e=m(n),o=u({transactions:n,transactionsDisplayInfo:t.transactionsDisplayInfo,status:e??"sent",sessionInformation:t.sessionInformation});if(t.disableToasts===!0)return o;let s=h(a);return l({toastId:o,totalDuration:s}),o};this.sendSignedTransactions=async a=>{let{apiAddress:t,apiTimeout:n}=c(p()),e=a.map(s=>b.post(`${t}/transactions`,s.toPlainObject(),{timeout:Number(n)}));return(await Promise.all(e)).map(({data:s})=>({...s,status:"pending",hash:s.txHash}))};this.sendSignedBatchTransactions=async a=>{let{address:t}=y(),{apiAddress:n,apiTimeout:e}=c(p());if(!t)return{error:"Invalid address provided. You need to be logged in to send transactions"};let o=this.buildBatchId(t),i={transactions:a.map(w=>w.map(v=>this.parseSignedTransaction(v))),id:o},{data:A}=await b.post(`${n}/batch`,i,{timeout:Number(e)});return{data:A}};this.buildBatchId=a=>`${Date.now().toString()}${d}${a}`;this.sequentialToFlatArray=(a=[])=>this.getIsSequential(a)?a.flat():a;this.getIsSequential=a=>a?.every(t=>Array.isArray(t));this.parseSignedTransaction=a=>{let t=new T,n={...a.toPlainObject(),hash:t.computeTransactionHash(a),status:"pending"};return f({data:n.data})&&(delete n.senderUsername,delete n.receiverUsername),n}}static getInstance(){return r.instance||(r.instance=new r),r.instance}};r.instance=null;var I=r;export{I as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CRHPVNRL.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-BHXGUN5H.mjs";function t(){if(!e)return"";try{if(e.document.referrer)return new URL(e.document.referrer).origin;let r=e.location.ancestorOrigins;return r.length<1?"":new URL(r[r.length-1]).origin}catch(r){return console.error(r),""}}export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CUABBK2P.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t}from"./chunk-AZGVI4QW.mjs";var e=class n extends t{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE_PENDING_TRANSACTIONS",uiTag:"mvx-pending-transactions-panel"});this.initialData=null;this.data=this.initialData}static getInstance(){return n.instance||(n.instance=new n),n.instance}isPendingTransactionsOpen(){return this.isOpen}async setupEventListeners(){this.eventBus&&this.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",this.closeUI.bind(this))}};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EBQZQA2Q.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-CUABBK2P.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-EO6CD6VO.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{t as n}from"./chunk-BTXVE2KE.mjs";import{a as i}from"./chunk-OJV6XRG5.mjs";var e=async()=>{let o=n();if(o.getType()===i.crossWindow){let r=o;await r.cancelAction(),await r.dispose()}};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ES6E2HM6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-FMQYLMTU.mjs";import{b as s,c as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-FMQYLMTU.mjs";import{b as s,c as r}from"./chunk-Y4OUAJSG.mjs";async function l({results:e,hash:i,sessionId:t}){let a=e?.find(o=>o?.returnMessage!=="");r({sessionId:t,transaction:{...a,hash:i,status:"fail",inTransit:!1}}),s({sessionId:t,status:"fail",errorMessage:a?.returnMessage}),await n({sessionId:t,status:"fail"})}export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-F4W3N3JZ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-FKBLKOLI.mjs";import{a as s}from"./chunk-SPSO2A53.mjs";import{a as t}from"./chunk-GZAAD3TR.mjs";import{u as n}from"./chunk-GZTGHNVI.mjs";import{b as e}from"./chunk-SAAOQW7P.mjs";var S=async r=>{let{isGuarded:i}=t();if(!a({isGuarded:i,transactions:r}))return r;let d=r[0].getSender().bech32().toString(),{walletAddress:c}=e(n()),o=await s({address:d,walletUrl:c});return o?.setShouldShowConsentPopup(!1),await o?.guardTransactions(r)||[]};export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-F4WQOPSX.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-4TBVQD27.mjs";import{s as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-4TBVQD27.mjs";import{s as o}from"./chunk-GZTGHNVI.mjs";var l=t=>o().setState(({config:e})=>{e.nativeAuthConfig=t},!1,"setNativeAuthConfig"),c=t=>o().setState(({config:e})=>{e.websocketStatus=t},!1,"setWebsocketStatus"),f=t=>o().setState(({config:e})=>{let s=t.walletConnectV2RelayAddress||n.walletConnectV2RelayAddress,i=t.walletConnectDeepLink||n.walletConnectDeepLink;e.walletConnectConfig={...t,walletConnectDeepLink:i,walletConnectV2RelayAddress:s}},!1,"setWalletConnectConfig"),r=t=>o().setState(({config:e})=>{e.crossWindowConfig=t},!1,"setCrossWindowConfig");export{l as a,c as b,f as c,r as d};
|
|
2
|
+
//# sourceMappingURL=chunk-GFK4E7GU.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-HACVN4R6.mjs";import{a as f}from"./chunk-6FXEHNGW.mjs";import{f as m}from"./chunk-J4CPYFK6.mjs";import x from"bignumber.js";var v=async({manager:e,provider:d})=>{if(!e||!d)throw new Error("Provider is not initialized.");let{network:u}=b(),n=e.getAccountScreenData()?.startIndex||0,r=e.getAllAccounts(),a=await w({baseURL:u.apiAddress}),l=c=>c.index>=n&&c.index<n+e.addressesPerPage,I=r.reduce((c,s)=>Object.assign(c,{[s.index]:s}),{}),A=r.filter(l),y=!!I[n];if(e.updateAccountScreen({isLoading:!y}),A.length>0){e.updateAccountScreen({accounts:A});return}try{let c=await d.getAccounts(n,e.addressesPerPage),s=c.map((t,o)=>({address:t,balance:"...",index:o+n})),L=[...r,...s],j=c.map(t=>f({address:t,baseURL:u.apiAddress})),O=await Promise.all(j),i=L.reduce((t,o)=>Object.assign(t,{[o.address]:o}),{});O.forEach(t=>{if(!t||!a||!a.price)return;let o=new x(t.balance),U=o.dividedBy(x(10).pow(18)).toFormat(4).toString();if(o.isNaN())return;let h=g({amount:m({input:t.balance}),usd:a?.price});i[t.address].balance=U,i[t.address].usdValue=h});let p=Object.values(i).sort((t,o)=>t.index-o.index),S=p.filter(l);e.updateAllAccounts(p),e.updateAccountScreen({accounts:S,isLoading:!1})}catch(c){console.error("Failed to fetch accounts:",c)}};export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GRD5MWEG.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as B}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as B}from"./chunk-FGRMMCGF.mjs";import{a as b}from"./chunk-ES6E2HM6.mjs";import{a as k}from"./chunk-QXC4D3AC.mjs";import{a as R}from"./chunk-OD4ANAAQ.mjs";import{a as D}from"./chunk-PTLBE2H2.mjs";import{a as I}from"./chunk-AV4HSXYZ.mjs";import{a as j}from"./chunk-YTFYVPZO.mjs";import{a as _}from"./chunk-F4WQOPSX.mjs";import{a as O}from"./chunk-7RFUEHZX.mjs";import{a as x}from"./chunk-S2FAYMW2.mjs";import{u as A}from"./chunk-GZTGHNVI.mjs";import{b as v}from"./chunk-SAAOQW7P.mjs";import{a as G,c as U,f as F}from"./chunk-J4CPYFK6.mjs";import{a as w}from"./chunk-R53MCZI6.mjs";import{c as N}from"./chunk-MGFIOCA4.mjs";async function Dn({transactions:z=[],handleSign:H,guardTransactions:K=_}){let{account:{address:y,shard:C,username:E}}=B(),g=v(A()),h=x(),{allTransactions:e,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 k({baseURL:g.apiAddress});n.notifyDataUpdate(),n.initializeGasPriceMap(e.map(t=>t.transaction));let l=Y?.price,a=0,T=async()=>{let r=e[a]?.transaction,i=Number(r.nonce);n.updateIsLoading(!0);let{commonData:c,tokenTransaction:o,fungibleTransaction:s}=await D({allTransactions:e,currentScreenIndex:a,egldLabel:h,network:g,gasPriceData:n.ppuMap[i],price:l,address:y,username:E,shard:C,signedIndexes:p,parsedTransactionsByDataField:L});n.updateIsLoading(!1),o&&n.updateTokenTransaction(o),s&&n.updateNonFungibleTransaction(s.type,s),n.updateCommonData(c)},q=()=>{a>0&&(a--,T())},J=(t=0)=>{let i=e[a].transaction,c=Number(i.nonce);n.updateGasPriceMap({nonce:c,ppu:t}),n.updateCommonData({ppu:t});let o=i.toPlainObject(),s=I({transaction:o,gasPriceData:n.ppuMap[c]}),P=w.newFromPlainObject({...o,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:t})},Q=async()=>{M(new Error("Transaction signing cancelled by user")),await b(),n.closeUI()},f=()=>{a<n.transactionsCount-1&&(a++,T())},V=async()=>{let r=e[a].transaction,i=Number(r.nonce),{commonData:c}=await D({allTransactions:e,currentScreenIndex:a,egldLabel:h,network:g,gasPriceData:n.ppuMap[i],price:l,address:y,username:E,shard:C,signedIndexes:p,parsedTransactionsByDataField:L});if(!c.needsSigning)return p.push(a),f();let o=r.toPlainObject(),s=o.nonce,P=I({transaction:o,gasPriceData:n.ppuMap[s]}),u=w.newFromPlainObject({...o,gasPrice:P});try{let m=await H([u]);m&&(p.push(a),d.push(m[0]));let nn=a===e.length-1,an=e.filter(S=>S.needsSigning),tn=d.length===an.length;if(nn&&tn){let S=await K(d);return n.closeUI(),X(S)}f()}catch(m){n.closeUI(),M(m)}},Z=new Map([["NEXT_SIGN_TRANSACTIONS",f],["CONFIRM_SIGN_TRANSACTIONS",V],["CLOSE_SIGN_TRANSACTIONS",Q],["BACK_SIGN_TRANSACTIONS",q],["SET_PPU_SIGN_TRANSACTIONS",J]]);function $(){for(let[t,r]of Z)n.subscribeToEventBus(t,r)}$(),await T()})}export{Dn as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GXMIT5JQ.mjs.map
|