@multiversx/sdk-dapp 5.1.8 → 5.1.9

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.
Files changed (399) hide show
  1. package/README.md +8 -0
  2. package/out/__chunks__/chunk-2VG3V3VD.mjs +2 -0
  3. package/out/__chunks__/chunk-2VG3V3VD.mjs.map +7 -0
  4. package/out/__chunks__/{chunk-YMBVUA56.mjs → chunk-3LL33L5F.mjs} +2 -2
  5. package/out/__chunks__/{chunk-J65JH3Q2.mjs → chunk-3UVBQHXR.mjs} +2 -2
  6. package/out/__chunks__/{chunk-B6YF7H7U.mjs → chunk-44EDRVCP.mjs} +2 -2
  7. package/out/__chunks__/{chunk-XONPIJ3Y.mjs → chunk-4AVJA7MF.mjs} +2 -2
  8. package/out/__chunks__/{chunk-66D2TGF6.mjs → chunk-4CK3GBRH.mjs} +2 -2
  9. package/out/__chunks__/chunk-4KTXRMDS.mjs +2 -0
  10. package/out/__chunks__/{chunk-LS5QVDML.mjs → chunk-4YUEQAGD.mjs} +2 -2
  11. package/out/__chunks__/{chunk-YEQDJ3AV.mjs → chunk-5K2UH5QL.mjs} +2 -2
  12. package/out/__chunks__/{chunk-4PIR4ESS.mjs → chunk-632VK5RN.mjs} +2 -2
  13. package/out/__chunks__/{chunk-LMG7PLUI.mjs → chunk-6GKWP4IU.mjs} +2 -2
  14. package/out/__chunks__/{chunk-5LDRZKQG.mjs → chunk-6QDJ2IO3.mjs} +2 -2
  15. package/out/__chunks__/{chunk-SJDGXLII.mjs → chunk-A6XTQQEL.mjs} +2 -2
  16. package/out/__chunks__/{chunk-Y57ROHMV.mjs → chunk-AQ7ZQRAJ.mjs} +2 -2
  17. package/out/__chunks__/{chunk-LH5IBSC3.mjs → chunk-C22Q5W5S.mjs} +2 -2
  18. package/out/__chunks__/{chunk-NOAPU5US.mjs → chunk-CCFQYROV.mjs} +2 -2
  19. package/out/__chunks__/{chunk-NN2ODLFY.mjs → chunk-CHCWBFEG.mjs} +2 -2
  20. package/out/__chunks__/{chunk-L5WRBBHH.mjs → chunk-CLPLLK67.mjs} +2 -2
  21. package/out/__chunks__/{chunk-5Q2JDZD3.mjs → chunk-CYWOWIRB.mjs} +2 -2
  22. package/out/__chunks__/chunk-D4V7EOIL.mjs +2 -0
  23. package/out/__chunks__/{chunk-Q3AAD4PW.mjs → chunk-DGL4E36L.mjs} +2 -2
  24. package/out/__chunks__/chunk-DT3MXNJI.mjs +2 -0
  25. package/out/__chunks__/{chunk-OPVHND3O.mjs → chunk-EIL6PTC4.mjs} +2 -2
  26. package/out/__chunks__/chunk-ENHFZ4TV.mjs +2 -0
  27. package/out/__chunks__/{chunk-ETED4JB5.mjs.map → chunk-ENHFZ4TV.mjs.map} +1 -1
  28. package/out/__chunks__/{chunk-QUVHL3QF.mjs → chunk-EQOLFL4H.mjs} +2 -2
  29. package/out/__chunks__/{chunk-JBNKG6XC.mjs → chunk-FZKGYTPJ.mjs} +2 -2
  30. package/out/__chunks__/{chunk-IMXMFXER.mjs → chunk-GF3J27ZR.mjs} +2 -2
  31. package/out/__chunks__/chunk-GQAGO7KW.mjs +2 -0
  32. package/out/__chunks__/{chunk-6KB3FBQO.mjs → chunk-HSAPJUAV.mjs} +2 -2
  33. package/out/__chunks__/{chunk-AUZPUAD4.mjs → chunk-IDCBOZNB.mjs} +2 -2
  34. package/out/__chunks__/{chunk-MFMWGMLN.mjs → chunk-II663X5B.mjs} +2 -2
  35. package/out/__chunks__/{chunk-FODR6WTG.mjs → chunk-IJWIF6QG.mjs} +2 -2
  36. package/out/__chunks__/{chunk-GRU4NOFI.mjs → chunk-IT3RZ4HT.mjs} +2 -2
  37. package/out/__chunks__/{chunk-OD7MJ7CA.mjs → chunk-IXHQSJBO.mjs} +2 -2
  38. package/out/__chunks__/{chunk-NPF3MLTJ.mjs → chunk-K4BSSSHE.mjs} +2 -2
  39. package/out/__chunks__/chunk-KDWLSBQB.mjs +2 -0
  40. package/out/__chunks__/chunk-KDWLSBQB.mjs.map +7 -0
  41. package/out/__chunks__/{chunk-CQXLKX4W.mjs → chunk-KGKDFREW.mjs} +2 -2
  42. package/out/__chunks__/{chunk-V5VIOBBE.mjs → chunk-KMKXCFDQ.mjs} +2 -2
  43. package/out/__chunks__/chunk-KNZRUMOW.mjs +2 -0
  44. package/out/__chunks__/chunk-LDIEAM6D.mjs +2 -0
  45. package/out/__chunks__/chunk-LKPI47RK.mjs +2 -0
  46. package/out/__chunks__/chunk-LKPI47RK.mjs.map +7 -0
  47. package/out/__chunks__/{chunk-I6DCGYFE.mjs → chunk-MQFYSUO6.mjs} +2 -2
  48. package/out/__chunks__/{chunk-LX2TO34O.mjs → chunk-NAJG7WG4.mjs} +2 -2
  49. package/out/__chunks__/chunk-NN3CS646.mjs +2 -0
  50. package/out/__chunks__/{chunk-A7PB4MFL.mjs → chunk-NQZVWZM5.mjs} +2 -2
  51. package/out/__chunks__/{chunk-KLZC6NYC.mjs → chunk-O46BVCSH.mjs} +2 -2
  52. package/out/__chunks__/{chunk-CFCHCCTH.mjs → chunk-PFMI2MWN.mjs} +2 -2
  53. package/out/__chunks__/{chunk-HBYQEHJE.mjs → chunk-PRBRKMR4.mjs} +2 -2
  54. package/out/__chunks__/{chunk-BYMTQKPA.mjs → chunk-PSSRDP4O.mjs} +2 -2
  55. package/out/__chunks__/chunk-QMHHBZ5O.mjs +2 -0
  56. package/out/__chunks__/{chunk-DSSANNT5.mjs → chunk-QXVINXTO.mjs} +2 -2
  57. package/out/__chunks__/chunk-RCM3SNZB.mjs +2 -0
  58. package/out/__chunks__/{chunk-355TDGZM.mjs → chunk-RHP2BLW4.mjs} +2 -2
  59. package/out/__chunks__/{chunk-OQOS52S7.mjs → chunk-RMSMZKTD.mjs} +2 -2
  60. package/out/__chunks__/{chunk-MSFYVSIA.mjs → chunk-RQG6ZONS.mjs} +2 -2
  61. package/out/__chunks__/chunk-SBDWJ7ES.mjs +2 -0
  62. package/out/__chunks__/chunk-SDJQOCX2.mjs +2 -0
  63. package/out/__chunks__/{chunk-ZVDPYIMB.mjs → chunk-SJCFVUWO.mjs} +2 -2
  64. package/out/__chunks__/{chunk-6OVM3ZX6.mjs → chunk-SJUTPNHW.mjs} +2 -2
  65. package/out/__chunks__/{chunk-6OBHBOL7.mjs → chunk-T5FALTG2.mjs} +2 -2
  66. package/out/__chunks__/{chunk-A4WTVE3V.mjs → chunk-TJYIVY7J.mjs} +2 -2
  67. package/out/__chunks__/{chunk-IYYCFUH4.mjs → chunk-TMNKFPRG.mjs} +2 -2
  68. package/out/__chunks__/{chunk-B7VN77JG.mjs → chunk-TRUQQVTW.mjs} +2 -2
  69. package/out/__chunks__/{chunk-ICDR3HC5.mjs → chunk-UA5WGULZ.mjs} +2 -2
  70. package/out/__chunks__/{chunk-J6CFAYIO.mjs → chunk-UEPKOEV5.mjs} +2 -2
  71. package/out/__chunks__/{chunk-JGEBMC2K.mjs → chunk-UPIJGCBH.mjs} +2 -2
  72. package/out/__chunks__/chunk-VFIKV2UU.mjs +2 -0
  73. package/out/__chunks__/{chunk-LIQTTAAS.mjs → chunk-VHHB4LMW.mjs} +2 -2
  74. package/out/__chunks__/{chunk-DQUL7SM3.mjs → chunk-VHOQPKEC.mjs} +2 -2
  75. package/out/__chunks__/chunk-VN62BHIP.mjs +2 -0
  76. package/out/__chunks__/{chunk-4FD6QSAE.mjs → chunk-VQ4W2MEF.mjs} +2 -2
  77. package/out/__chunks__/{chunk-7BTDFBMU.mjs → chunk-WF63AXH3.mjs} +2 -2
  78. package/out/__chunks__/chunk-WYVDY3V7.mjs +2 -0
  79. package/out/__chunks__/{chunk-3TKKCFM4.mjs → chunk-X3XRZCS3.mjs} +2 -2
  80. package/out/__chunks__/{chunk-KJIGI7AM.mjs → chunk-YC3NVMU3.mjs} +2 -2
  81. package/out/__chunks__/{chunk-JTWAEL7D.mjs → chunk-YJMGYDU3.mjs} +2 -2
  82. package/out/__chunks__/{chunk-PM2CIPJB.mjs → chunk-YQ63ZYW2.mjs} +2 -2
  83. package/out/__chunks__/chunk-YY55H5EM.mjs +2 -0
  84. package/out/__chunks__/{chunk-6KIQJGRP.mjs → chunk-ZM3VDK22.mjs} +2 -2
  85. package/out/__chunks__/chunk-ZPCNRXQG.mjs +2 -0
  86. package/out/__chunks__/{chunk-P5EDEM26.mjs → chunk-ZTLWHYQL.mjs} +2 -2
  87. package/out/apiCalls/account/getScamAddressData.mjs +1 -1
  88. package/out/apiCalls/configuration/getCleanApiAddress.mjs +1 -1
  89. package/out/apiCalls/configuration/getGasStationMetadata.mjs +1 -1
  90. package/out/apiCalls/index.mjs +1 -1
  91. package/out/apiCalls/tokens/getPersistedTokenDetails.mjs +1 -1
  92. package/out/apiCalls/tokens/getTokenDetails.mjs +1 -1
  93. package/out/apiCalls/tokens/index.mjs +1 -1
  94. package/out/apiCalls/transactions/getServerTransactionsByHashes.mjs +1 -1
  95. package/out/apiCalls/transactions/getTransactionByHash.mjs +1 -1
  96. package/out/apiCalls/transactions/getTransactionsByHashes.mjs +1 -1
  97. package/out/constants/browser.constants.mjs +1 -1
  98. package/out/constants/index.mjs +1 -1
  99. package/out/constants/storage.constants.mjs +1 -1
  100. package/out/constants/window.constants.cjs +1 -1
  101. package/out/constants/window.constants.cjs.map +1 -1
  102. package/out/constants/window.constants.mjs +1 -1
  103. package/out/controllers/TransactionsHistoryController/TransactionsHistoryController.mjs +1 -1
  104. package/out/controllers/TransactionsHistoryController/index.mjs +1 -1
  105. package/out/controllers/TransactionsTableController/TransactionsTableController.mjs +1 -1
  106. package/out/controllers/TransactionsTableController/index.mjs +1 -1
  107. package/out/index.mjs +1 -1
  108. package/out/lib/sdkDappUi.mjs +1 -1
  109. package/out/managers/LogoutManager/LogoutManager.mjs +1 -1
  110. package/out/managers/NotificationsFeedManager/NotificationsFeedManager.mjs +1 -1
  111. package/out/managers/NotificationsFeedManager/index.mjs +1 -1
  112. package/out/managers/TransactionManager/TransactionManager.cjs +34 -1
  113. package/out/managers/TransactionManager/TransactionManager.cjs.map +2 -2
  114. package/out/managers/TransactionManager/TransactionManager.d.ts +27 -0
  115. package/out/managers/TransactionManager/TransactionManager.mjs +1 -1
  116. package/out/managers/TransactionManager/TransactionManager.types.cjs.map +1 -1
  117. package/out/managers/TransactionManager/TransactionManager.types.d.ts +9 -0
  118. package/out/managers/TransactionManager/helpers/getAreTransactionsCorssShards.mjs +1 -1
  119. package/out/managers/TransactionManager/helpers/getToastDuration.mjs +1 -1
  120. package/out/managers/TransactionManager/helpers/sessionCallbacks.cjs +21 -8
  121. package/out/managers/TransactionManager/helpers/sessionCallbacks.cjs.map +2 -2
  122. package/out/managers/TransactionManager/helpers/sessionCallbacks.d.ts +5 -4
  123. package/out/managers/TransactionManager/helpers/sessionCallbacks.mjs +1 -1
  124. package/out/managers/TransactionManager/index.mjs +1 -1
  125. package/out/managers/UnlockPanelManager/UnlockPanelManager.mjs +1 -1
  126. package/out/managers/UnlockPanelManager/index.mjs +1 -1
  127. package/out/managers/index.mjs +1 -1
  128. package/out/managers/internal/LedgerConnectStateManager/LedgerConnectStateManager.mjs +1 -1
  129. package/out/managers/internal/LedgerConnectStateManager/index.mjs +1 -1
  130. package/out/managers/internal/LedgerIdleStateManager/LedgerIdleStateManager.mjs +1 -1
  131. package/out/managers/internal/PendingTransactionsStateManager/PendingTransactionsStateManager.mjs +1 -1
  132. package/out/managers/internal/PendingTransactionsStateManager/index.mjs +1 -1
  133. package/out/managers/internal/SidePanelBaseManager/SidePanelBaseManager.mjs +1 -1
  134. package/out/managers/internal/SidePanelBaseManager/index.mjs +1 -1
  135. package/out/managers/internal/SignTransactionsStateManager/SignTransactionsStateManager.mjs +1 -1
  136. package/out/managers/internal/SignTransactionsStateManager/index.mjs +1 -1
  137. package/out/managers/internal/ToastManager/ToastManager.mjs +1 -1
  138. package/out/managers/internal/ToastManager/helpers/LifetimeManager.mjs +1 -1
  139. package/out/managers/internal/ToastManager/helpers/createToastsFromTransactions.mjs +1 -1
  140. package/out/managers/internal/UIBaseManager/UIBaseManager.mjs +1 -1
  141. package/out/managers/internal/WalletConnectStateManager/WalletConnectStateManager.mjs +1 -1
  142. package/out/managers/internal/WalletConnectStateManager/index.mjs +1 -1
  143. package/out/managers/internal/index.mjs +1 -1
  144. package/out/methods/account/getAccount.mjs +1 -1
  145. package/out/methods/account/getAccountInfo.mjs +1 -1
  146. package/out/methods/account/getAddress.mjs +1 -1
  147. package/out/methods/account/getIsLoggedIn.mjs +1 -1
  148. package/out/methods/account/getLatestNonce.mjs +1 -1
  149. package/out/methods/initApp/gastStationMetadata/setGasStationMetadata.mjs +1 -1
  150. package/out/methods/initApp/initApp.cjs +1 -1
  151. package/out/methods/initApp/initApp.cjs.map +2 -2
  152. package/out/methods/initApp/initApp.mjs +1 -1
  153. package/out/methods/initApp/initApp.mjs.map +3 -3
  154. package/out/methods/initApp/websocket/initializeWebsocketConnection.mjs +1 -1
  155. package/out/methods/initApp/websocket/registerWebsocket.mjs +1 -1
  156. package/out/methods/loginInfo/getLoginInfo.mjs +1 -1
  157. package/out/methods/network/getEgldLabel.mjs +1 -1
  158. package/out/methods/network/getExplorerAddress.mjs +1 -1
  159. package/out/methods/network/getNetworkConfig.mjs +1 -1
  160. package/out/methods/trackTransactions/helpers/checkTransactionStatus/checkBatch.mjs +1 -1
  161. package/out/methods/trackTransactions/helpers/checkTransactionStatus/checkTransactionStatus.mjs +1 -1
  162. package/out/methods/trackTransactions/helpers/checkTransactionStatus/index.mjs +1 -1
  163. package/out/methods/trackTransactions/helpers/checkTransactionStatus/manageFailedTransactions.mjs +1 -1
  164. package/out/methods/trackTransactions/helpers/checkTransactionStatus/runSessionCallbacks.cjs +4 -4
  165. package/out/methods/trackTransactions/helpers/checkTransactionStatus/runSessionCallbacks.cjs.map +2 -2
  166. package/out/methods/trackTransactions/helpers/checkTransactionStatus/runSessionCallbacks.d.ts +2 -2
  167. package/out/methods/trackTransactions/helpers/checkTransactionStatus/runSessionCallbacks.mjs +1 -1
  168. package/out/methods/trackTransactions/helpers/getPollingInterval.mjs +1 -1
  169. package/out/methods/trackTransactions/trackTransactions.mjs +1 -1
  170. package/out/methods/transactions/getFailedTransactions.mjs +1 -1
  171. package/out/methods/transactions/getFailedTransactionsSessions.mjs +1 -1
  172. package/out/methods/transactions/getPendingTransactions.mjs +1 -1
  173. package/out/methods/transactions/getPendingTransactionsSessions.mjs +1 -1
  174. package/out/methods/transactions/getSuccessfulTransactions.mjs +1 -1
  175. package/out/methods/transactions/getSuccessfulTransactionsSessions.mjs +1 -1
  176. package/out/methods/transactions/getTransactionSessions.mjs +1 -1
  177. package/out/providers/DappProvider/DappProvider.mjs +1 -1
  178. package/out/providers/DappProvider/helpers/login/helpers/accountLogin.mjs +1 -1
  179. package/out/providers/DappProvider/helpers/login/helpers/extractAddressFromToken.mjs +1 -1
  180. package/out/providers/DappProvider/helpers/login/helpers/getAccountFromToken.mjs +1 -1
  181. package/out/providers/DappProvider/helpers/login/helpers/getModifiedLoginToken.mjs +1 -1
  182. package/out/providers/DappProvider/helpers/login/login.mjs +1 -1
  183. package/out/providers/DappProvider/helpers/logout/logout.mjs +1 -1
  184. package/out/providers/DappProvider/helpers/signErrors/handleSignError.mjs +1 -1
  185. package/out/providers/DappProvider/helpers/signMessage/signMessageWithProvider.mjs +1 -1
  186. package/out/providers/DappProvider/helpers/signTransactions/signTransactionsWithProvider.mjs +1 -1
  187. package/out/providers/DappProvider/index.mjs +1 -1
  188. package/out/providers/ProviderFactory.mjs +1 -1
  189. package/out/providers/helpers/accountProvider.mjs +1 -1
  190. package/out/providers/helpers/cancelCrossWindowAction.mjs +1 -1
  191. package/out/providers/helpers/restoreProvider.mjs +1 -1
  192. package/out/providers/index.mjs +1 -1
  193. package/out/providers/strategies/BaseProviderStrategy/BaseProviderStrategy.mjs +1 -1
  194. package/out/providers/strategies/CrossWindowProviderStrategy/CrossWindowProviderStrategy.mjs +1 -1
  195. package/out/providers/strategies/CrossWindowProviderStrategy/index.mjs +1 -1
  196. package/out/providers/strategies/ExtensionProviderStrategy/ExtensionProviderStrategy.mjs +1 -1
  197. package/out/providers/strategies/ExtensionProviderStrategy/index.mjs +1 -1
  198. package/out/providers/strategies/IframeProviderStrategy/IframeProviderStrategy.mjs +1 -1
  199. package/out/providers/strategies/IframeProviderStrategy/index.mjs +1 -1
  200. package/out/providers/strategies/LedgerProviderStrategy/LedgerProviderStrategy.mjs +1 -1
  201. package/out/providers/strategies/LedgerProviderStrategy/helpers/authenticateLedgerAccount.mjs +1 -1
  202. package/out/providers/strategies/LedgerProviderStrategy/helpers/getAuthTokenText.mjs +1 -1
  203. package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerConfiguration.mjs +1 -1
  204. package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerProvider.mjs +1 -1
  205. package/out/providers/strategies/LedgerProviderStrategy/helpers/getLedgerVersionOptions.mjs +1 -1
  206. package/out/providers/strategies/LedgerProviderStrategy/helpers/index.mjs +1 -1
  207. package/out/providers/strategies/LedgerProviderStrategy/helpers/initializeLedgerProvider.mjs +1 -1
  208. package/out/providers/strategies/LedgerProviderStrategy/helpers/signLedgerMessage.mjs +1 -1
  209. package/out/providers/strategies/LedgerProviderStrategy/helpers/updateAccountsList/index.mjs +1 -1
  210. package/out/providers/strategies/LedgerProviderStrategy/helpers/updateAccountsList/updateAccountsList.mjs +1 -1
  211. package/out/providers/strategies/LedgerProviderStrategy/index.mjs +1 -1
  212. package/out/providers/strategies/WalletConnectProviderStrategy/WalletConnectProviderStrategy.mjs +1 -1
  213. package/out/providers/strategies/WalletConnectProviderStrategy/index.mjs +1 -1
  214. package/out/providers/strategies/WebviewProviderStrategy/WebviewClient/WebviewClient.mjs +1 -1
  215. package/out/providers/strategies/WebviewProviderStrategy/WebviewClient/index.mjs +1 -1
  216. package/out/providers/strategies/WebviewProviderStrategy/WebviewProviderStrategy.mjs +1 -1
  217. package/out/providers/strategies/WebviewProviderStrategy/index.mjs +1 -1
  218. package/out/providers/strategies/helpers/getPendingTransactionsHandlers.mjs +1 -1
  219. package/out/providers/strategies/helpers/index.mjs +1 -1
  220. package/out/providers/strategies/helpers/signMessage/signMessage.mjs +1 -1
  221. package/out/providers/strategies/helpers/signTransactions/helpers/calculateFeeLimit.mjs +1 -1
  222. package/out/providers/strategies/helpers/signTransactions/helpers/getCommonData/getCommonData.mjs +1 -1
  223. package/out/providers/strategies/helpers/signTransactions/helpers/getCommonData/helpers/getExtractTransactionsInfo.mjs +1 -1
  224. package/out/providers/strategies/helpers/signTransactions/helpers/getFeeData.mjs +1 -1
  225. package/out/providers/strategies/helpers/signTransactions/helpers/guardTransactions/guardTransactions.mjs +1 -1
  226. package/out/providers/strategies/helpers/signTransactions/signTransactions.mjs +1 -1
  227. package/out/providers/strategies/index.mjs +1 -1
  228. package/out/react/account/useGetAccount.mjs +1 -1
  229. package/out/react/account/useGetAccountInfo.mjs +1 -1
  230. package/out/react/account/useGetIsLoggedIn.mjs +1 -1
  231. package/out/react/account/useGetLatestNonce.mjs +1 -1
  232. package/out/react/index.mjs +1 -1
  233. package/out/react/loginInfo/useGetLoginInfo.mjs +1 -1
  234. package/out/react/network/useGetNetworkConfig.mjs +1 -1
  235. package/out/react/store/getReactStore.mjs +1 -1
  236. package/out/react/store/useSelector.mjs +1 -1
  237. package/out/react/transactions/useGetFailedTransactions.mjs +1 -1
  238. package/out/react/transactions/useGetFailedTransactionsSessions.mjs +1 -1
  239. package/out/react/transactions/useGetPendingTransactions.mjs +1 -1
  240. package/out/react/transactions/useGetPendingTransactionsSessions.mjs +1 -1
  241. package/out/react/transactions/useGetSuccessfulTransactions.mjs +1 -1
  242. package/out/react/transactions/useGetSuccessfulTransactionsSessions.mjs +1 -1
  243. package/out/react/transactions/useGetTransactionSessions.mjs +1 -1
  244. package/out/services/index.mjs +1 -1
  245. package/out/services/nativeAuth/index.mjs +1 -1
  246. package/out/services/nativeAuth/methods/buildNativeAuthConfig.mjs +1 -1
  247. package/out/services/nativeAuth/methods/getDefaultNativeAuthConfig.mjs +1 -1
  248. package/out/services/nativeAuth/methods/index.mjs +1 -1
  249. package/out/services/nativeAuth/nativeAuth.mjs +1 -1
  250. package/out/store/actions/account/accountActions.mjs +1 -1
  251. package/out/store/actions/account/index.mjs +1 -1
  252. package/out/store/actions/cache/cacheActions.mjs +1 -1
  253. package/out/store/actions/cache/index.mjs +1 -1
  254. package/out/store/actions/config/configActions.mjs +1 -1
  255. package/out/store/actions/config/index.mjs +1 -1
  256. package/out/store/actions/index.mjs +1 -1
  257. package/out/store/actions/loginInfo/loginInfoActions.mjs +1 -1
  258. package/out/store/actions/network/index.mjs +1 -1
  259. package/out/store/actions/network/initializeNetwork.mjs +1 -1
  260. package/out/store/actions/network/networkActions.mjs +1 -1
  261. package/out/store/actions/sharedActions/index.mjs +1 -1
  262. package/out/store/actions/sharedActions/sharedActions.mjs +1 -1
  263. package/out/store/actions/toasts/index.mjs +1 -1
  264. package/out/store/actions/toasts/toastsActions.mjs +1 -1
  265. package/out/store/actions/transactions/transactionsActions.mjs +1 -1
  266. package/out/store/actions/ui/index.mjs +1 -1
  267. package/out/store/actions/ui/uiActions.mjs +1 -1
  268. package/out/store/middleware/applyMiddlewares.mjs +1 -1
  269. package/out/store/middleware/index.mjs +1 -1
  270. package/out/store/middleware/logoutMiddleware.mjs +1 -1
  271. package/out/store/storage/index.mjs +1 -1
  272. package/out/store/storage/storageCallback.mjs +1 -1
  273. package/out/store/store.mjs +1 -1
  274. package/out/utils/ComponentFactory.mjs +1 -1
  275. package/out/utils/account/index.mjs +1 -1
  276. package/out/utils/account/refreshAccount.mjs +1 -1
  277. package/out/utils/account/refreshNativeAuthTokenLogin.mjs +1 -1
  278. package/out/utils/index.mjs +1 -1
  279. package/out/utils/transactions/getActiveTransactionsStatus.mjs +1 -1
  280. package/out/utils/transactions/getInterpretedTransaction/getInterpretedTransaction.mjs +1 -1
  281. package/out/utils/transactions/getInterpretedTransaction/helpers/getLockedAccountName.mjs +1 -1
  282. package/out/utils/transactions/getInterpretedTransaction/helpers/getReceiptMessage.mjs +1 -1
  283. package/out/utils/transactions/getInterpretedTransaction/helpers/getShardText.mjs +1 -1
  284. package/out/utils/transactions/getInterpretedTransaction/helpers/getTransactionIconInfo.mjs +1 -1
  285. package/out/utils/transactions/getInterpretedTransaction/helpers/getTransactionMessages.mjs +1 -1
  286. package/out/utils/transactions/getInterpretedTransaction/helpers/index.mjs +1 -1
  287. package/out/utils/transactions/getInterpretedTransaction/index.mjs +1 -1
  288. package/out/utils/transactions/getTransactionsHistory/getTransactionsHistory.mjs +1 -1
  289. package/out/utils/transactions/getTransactionsHistory/helpers/getCachedTransactionListItem.mjs +1 -1
  290. package/out/utils/transactions/getTransactionsHistory/helpers/index.mjs +1 -1
  291. package/out/utils/transactions/getTransactionsHistory/helpers/mapServerTransactionsToListItems.mjs +1 -1
  292. package/out/utils/transactions/getTransactionsHistory/index.mjs +1 -1
  293. package/out/utils/transactions/index.mjs +1 -1
  294. package/out/utils/visual/index.mjs +1 -1
  295. package/out/utils/visual/switchTheme.mjs +1 -1
  296. package/out/utils/window/getIsInIframe.mjs +1 -1
  297. package/out/utils/window/getWindowParentOrigin.mjs +1 -1
  298. package/out/utils/window/index.mjs +1 -1
  299. package/package.json +1 -1
  300. package/out/__chunks__/chunk-26I72KPF.mjs +0 -2
  301. package/out/__chunks__/chunk-2EJDUI4F.mjs +0 -2
  302. package/out/__chunks__/chunk-3462VWV2.mjs +0 -2
  303. package/out/__chunks__/chunk-3ZEUVYQF.mjs +0 -2
  304. package/out/__chunks__/chunk-3ZEUVYQF.mjs.map +0 -7
  305. package/out/__chunks__/chunk-5DKIUS4V.mjs +0 -2
  306. package/out/__chunks__/chunk-6VSANQCL.mjs +0 -2
  307. package/out/__chunks__/chunk-BIEPQOD5.mjs +0 -2
  308. package/out/__chunks__/chunk-DJCWPLIW.mjs +0 -2
  309. package/out/__chunks__/chunk-ENGIAAJA.mjs +0 -2
  310. package/out/__chunks__/chunk-ETED4JB5.mjs +0 -2
  311. package/out/__chunks__/chunk-FG6BP2H5.mjs +0 -2
  312. package/out/__chunks__/chunk-FMQYLMTU.mjs +0 -2
  313. package/out/__chunks__/chunk-FMQYLMTU.mjs.map +0 -7
  314. package/out/__chunks__/chunk-FQTEXMMN.mjs +0 -2
  315. package/out/__chunks__/chunk-NXTU644D.mjs +0 -2
  316. package/out/__chunks__/chunk-QN2BIRAC.mjs +0 -2
  317. package/out/__chunks__/chunk-RSJC4YBI.mjs +0 -2
  318. package/out/__chunks__/chunk-TF2JS3TY.mjs +0 -2
  319. package/out/__chunks__/chunk-URXO7GNH.mjs +0 -2
  320. package/out/__chunks__/chunk-VRU7SNQA.mjs +0 -2
  321. package/out/__chunks__/chunk-VRU7SNQA.mjs.map +0 -7
  322. package/out/__chunks__/chunk-WGESEEJ2.mjs +0 -2
  323. /package/out/__chunks__/{chunk-YMBVUA56.mjs.map → chunk-3LL33L5F.mjs.map} +0 -0
  324. /package/out/__chunks__/{chunk-J65JH3Q2.mjs.map → chunk-3UVBQHXR.mjs.map} +0 -0
  325. /package/out/__chunks__/{chunk-B6YF7H7U.mjs.map → chunk-44EDRVCP.mjs.map} +0 -0
  326. /package/out/__chunks__/{chunk-XONPIJ3Y.mjs.map → chunk-4AVJA7MF.mjs.map} +0 -0
  327. /package/out/__chunks__/{chunk-66D2TGF6.mjs.map → chunk-4CK3GBRH.mjs.map} +0 -0
  328. /package/out/__chunks__/{chunk-FG6BP2H5.mjs.map → chunk-4KTXRMDS.mjs.map} +0 -0
  329. /package/out/__chunks__/{chunk-LS5QVDML.mjs.map → chunk-4YUEQAGD.mjs.map} +0 -0
  330. /package/out/__chunks__/{chunk-YEQDJ3AV.mjs.map → chunk-5K2UH5QL.mjs.map} +0 -0
  331. /package/out/__chunks__/{chunk-4PIR4ESS.mjs.map → chunk-632VK5RN.mjs.map} +0 -0
  332. /package/out/__chunks__/{chunk-LMG7PLUI.mjs.map → chunk-6GKWP4IU.mjs.map} +0 -0
  333. /package/out/__chunks__/{chunk-5LDRZKQG.mjs.map → chunk-6QDJ2IO3.mjs.map} +0 -0
  334. /package/out/__chunks__/{chunk-SJDGXLII.mjs.map → chunk-A6XTQQEL.mjs.map} +0 -0
  335. /package/out/__chunks__/{chunk-Y57ROHMV.mjs.map → chunk-AQ7ZQRAJ.mjs.map} +0 -0
  336. /package/out/__chunks__/{chunk-LH5IBSC3.mjs.map → chunk-C22Q5W5S.mjs.map} +0 -0
  337. /package/out/__chunks__/{chunk-NOAPU5US.mjs.map → chunk-CCFQYROV.mjs.map} +0 -0
  338. /package/out/__chunks__/{chunk-NN2ODLFY.mjs.map → chunk-CHCWBFEG.mjs.map} +0 -0
  339. /package/out/__chunks__/{chunk-L5WRBBHH.mjs.map → chunk-CLPLLK67.mjs.map} +0 -0
  340. /package/out/__chunks__/{chunk-5Q2JDZD3.mjs.map → chunk-CYWOWIRB.mjs.map} +0 -0
  341. /package/out/__chunks__/{chunk-6VSANQCL.mjs.map → chunk-D4V7EOIL.mjs.map} +0 -0
  342. /package/out/__chunks__/{chunk-Q3AAD4PW.mjs.map → chunk-DGL4E36L.mjs.map} +0 -0
  343. /package/out/__chunks__/{chunk-TF2JS3TY.mjs.map → chunk-DT3MXNJI.mjs.map} +0 -0
  344. /package/out/__chunks__/{chunk-OPVHND3O.mjs.map → chunk-EIL6PTC4.mjs.map} +0 -0
  345. /package/out/__chunks__/{chunk-QUVHL3QF.mjs.map → chunk-EQOLFL4H.mjs.map} +0 -0
  346. /package/out/__chunks__/{chunk-JBNKG6XC.mjs.map → chunk-FZKGYTPJ.mjs.map} +0 -0
  347. /package/out/__chunks__/{chunk-IMXMFXER.mjs.map → chunk-GF3J27ZR.mjs.map} +0 -0
  348. /package/out/__chunks__/{chunk-ENGIAAJA.mjs.map → chunk-GQAGO7KW.mjs.map} +0 -0
  349. /package/out/__chunks__/{chunk-6KB3FBQO.mjs.map → chunk-HSAPJUAV.mjs.map} +0 -0
  350. /package/out/__chunks__/{chunk-AUZPUAD4.mjs.map → chunk-IDCBOZNB.mjs.map} +0 -0
  351. /package/out/__chunks__/{chunk-MFMWGMLN.mjs.map → chunk-II663X5B.mjs.map} +0 -0
  352. /package/out/__chunks__/{chunk-FODR6WTG.mjs.map → chunk-IJWIF6QG.mjs.map} +0 -0
  353. /package/out/__chunks__/{chunk-GRU4NOFI.mjs.map → chunk-IT3RZ4HT.mjs.map} +0 -0
  354. /package/out/__chunks__/{chunk-OD7MJ7CA.mjs.map → chunk-IXHQSJBO.mjs.map} +0 -0
  355. /package/out/__chunks__/{chunk-NPF3MLTJ.mjs.map → chunk-K4BSSSHE.mjs.map} +0 -0
  356. /package/out/__chunks__/{chunk-CQXLKX4W.mjs.map → chunk-KGKDFREW.mjs.map} +0 -0
  357. /package/out/__chunks__/{chunk-V5VIOBBE.mjs.map → chunk-KMKXCFDQ.mjs.map} +0 -0
  358. /package/out/__chunks__/{chunk-BIEPQOD5.mjs.map → chunk-KNZRUMOW.mjs.map} +0 -0
  359. /package/out/__chunks__/{chunk-DJCWPLIW.mjs.map → chunk-LDIEAM6D.mjs.map} +0 -0
  360. /package/out/__chunks__/{chunk-I6DCGYFE.mjs.map → chunk-MQFYSUO6.mjs.map} +0 -0
  361. /package/out/__chunks__/{chunk-LX2TO34O.mjs.map → chunk-NAJG7WG4.mjs.map} +0 -0
  362. /package/out/__chunks__/{chunk-2EJDUI4F.mjs.map → chunk-NN3CS646.mjs.map} +0 -0
  363. /package/out/__chunks__/{chunk-A7PB4MFL.mjs.map → chunk-NQZVWZM5.mjs.map} +0 -0
  364. /package/out/__chunks__/{chunk-KLZC6NYC.mjs.map → chunk-O46BVCSH.mjs.map} +0 -0
  365. /package/out/__chunks__/{chunk-CFCHCCTH.mjs.map → chunk-PFMI2MWN.mjs.map} +0 -0
  366. /package/out/__chunks__/{chunk-HBYQEHJE.mjs.map → chunk-PRBRKMR4.mjs.map} +0 -0
  367. /package/out/__chunks__/{chunk-BYMTQKPA.mjs.map → chunk-PSSRDP4O.mjs.map} +0 -0
  368. /package/out/__chunks__/{chunk-QN2BIRAC.mjs.map → chunk-QMHHBZ5O.mjs.map} +0 -0
  369. /package/out/__chunks__/{chunk-DSSANNT5.mjs.map → chunk-QXVINXTO.mjs.map} +0 -0
  370. /package/out/__chunks__/{chunk-FQTEXMMN.mjs.map → chunk-RCM3SNZB.mjs.map} +0 -0
  371. /package/out/__chunks__/{chunk-355TDGZM.mjs.map → chunk-RHP2BLW4.mjs.map} +0 -0
  372. /package/out/__chunks__/{chunk-OQOS52S7.mjs.map → chunk-RMSMZKTD.mjs.map} +0 -0
  373. /package/out/__chunks__/{chunk-MSFYVSIA.mjs.map → chunk-RQG6ZONS.mjs.map} +0 -0
  374. /package/out/__chunks__/{chunk-26I72KPF.mjs.map → chunk-SBDWJ7ES.mjs.map} +0 -0
  375. /package/out/__chunks__/{chunk-5DKIUS4V.mjs.map → chunk-SDJQOCX2.mjs.map} +0 -0
  376. /package/out/__chunks__/{chunk-ZVDPYIMB.mjs.map → chunk-SJCFVUWO.mjs.map} +0 -0
  377. /package/out/__chunks__/{chunk-6OVM3ZX6.mjs.map → chunk-SJUTPNHW.mjs.map} +0 -0
  378. /package/out/__chunks__/{chunk-6OBHBOL7.mjs.map → chunk-T5FALTG2.mjs.map} +0 -0
  379. /package/out/__chunks__/{chunk-A4WTVE3V.mjs.map → chunk-TJYIVY7J.mjs.map} +0 -0
  380. /package/out/__chunks__/{chunk-IYYCFUH4.mjs.map → chunk-TMNKFPRG.mjs.map} +0 -0
  381. /package/out/__chunks__/{chunk-B7VN77JG.mjs.map → chunk-TRUQQVTW.mjs.map} +0 -0
  382. /package/out/__chunks__/{chunk-ICDR3HC5.mjs.map → chunk-UA5WGULZ.mjs.map} +0 -0
  383. /package/out/__chunks__/{chunk-J6CFAYIO.mjs.map → chunk-UEPKOEV5.mjs.map} +0 -0
  384. /package/out/__chunks__/{chunk-JGEBMC2K.mjs.map → chunk-UPIJGCBH.mjs.map} +0 -0
  385. /package/out/__chunks__/{chunk-3462VWV2.mjs.map → chunk-VFIKV2UU.mjs.map} +0 -0
  386. /package/out/__chunks__/{chunk-LIQTTAAS.mjs.map → chunk-VHHB4LMW.mjs.map} +0 -0
  387. /package/out/__chunks__/{chunk-DQUL7SM3.mjs.map → chunk-VHOQPKEC.mjs.map} +0 -0
  388. /package/out/__chunks__/{chunk-WGESEEJ2.mjs.map → chunk-VN62BHIP.mjs.map} +0 -0
  389. /package/out/__chunks__/{chunk-4FD6QSAE.mjs.map → chunk-VQ4W2MEF.mjs.map} +0 -0
  390. /package/out/__chunks__/{chunk-7BTDFBMU.mjs.map → chunk-WF63AXH3.mjs.map} +0 -0
  391. /package/out/__chunks__/{chunk-NXTU644D.mjs.map → chunk-WYVDY3V7.mjs.map} +0 -0
  392. /package/out/__chunks__/{chunk-3TKKCFM4.mjs.map → chunk-X3XRZCS3.mjs.map} +0 -0
  393. /package/out/__chunks__/{chunk-KJIGI7AM.mjs.map → chunk-YC3NVMU3.mjs.map} +0 -0
  394. /package/out/__chunks__/{chunk-JTWAEL7D.mjs.map → chunk-YJMGYDU3.mjs.map} +0 -0
  395. /package/out/__chunks__/{chunk-PM2CIPJB.mjs.map → chunk-YQ63ZYW2.mjs.map} +0 -0
  396. /package/out/__chunks__/{chunk-RSJC4YBI.mjs.map → chunk-YY55H5EM.mjs.map} +0 -0
  397. /package/out/__chunks__/{chunk-6KIQJGRP.mjs.map → chunk-ZM3VDK22.mjs.map} +0 -0
  398. /package/out/__chunks__/{chunk-URXO7GNH.mjs.map → chunk-ZPCNRXQG.mjs.map} +0 -0
  399. /package/out/__chunks__/{chunk-P5EDEM26.mjs.map → chunk-ZTLWHYQL.mjs.map} +0 -0
package/README.md CHANGED
@@ -595,6 +595,14 @@ const options: TransactionManagerTrackOptionsType = {
595
595
  sessionInformation: {
596
596
  // `undefined` by default. Use to perform additional actions based on the session information
597
597
  stakeAmount: '1000000000000000000000000'
598
+ },
599
+ onSuccess: async(sessionId) => { // optional
600
+ // will be executed when the current session is successful
601
+ // does not override the global onSuccess callback set in the initApp method
602
+ console.log('Session successful', sessionId);
603
+ },
604
+ onFail: async(sessionId) => { // optional
605
+ console.log('Session failed', sessionId);
598
606
  }
599
607
  };
600
608
 
@@ -0,0 +1,2 @@
1
+ var l={},i={},o=s=>s!=null&&s in l?l[s]:i,r=({onSuccess:s,onFail:a,sessionId:e})=>{let n=i;e!=null&&(l[e]=l[e]??{},n=l[e]),s!=null&&(n.onSuccess=s),a!=null&&(n.onFail=a)};export{o as a,r as b};
2
+ //# sourceMappingURL=chunk-2VG3V3VD.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/managers/TransactionManager/helpers/sessionCallbacks.ts"],
4
+ "sourcesContent": ["const sessionCallbacksMap: Record<string, SessionCallbacksType> = {};\n\nconst genericCallbacksMap: SessionCallbacksType = {};\n\nexport type SessionCallbacksType = {\n onSuccess?: (sessionId: string) => Promise<void>;\n onFail?: (sessionId: string) => Promise<void>;\n};\n\nexport const getCallbacks = (sessionId?: string): SessionCallbacksType => {\n if (sessionId != null && sessionId in sessionCallbacksMap) {\n return sessionCallbacksMap[sessionId];\n }\n return genericCallbacksMap;\n};\n\nexport const registerCallbacks = ({\n onSuccess,\n onFail,\n sessionId\n}: SessionCallbacksType & { sessionId?: string }) => {\n let map = genericCallbacksMap;\n\n if (sessionId != null) {\n sessionCallbacksMap[sessionId] = sessionCallbacksMap[sessionId] ?? {};\n map = sessionCallbacksMap[sessionId];\n }\n\n if (onSuccess != null) {\n map.onSuccess = onSuccess;\n }\n if (onFail != null) {\n map.onFail = onFail;\n }\n};\n"],
5
+ "mappings": "AAAA,IAAMA,EAA4D,CAAC,EAE7DC,EAA4C,CAAC,EAOtCC,EAAgBC,GACvBA,GAAa,MAAQA,KAAaH,EAC7BA,EAAoBG,CAAS,EAE/BF,EAGIG,EAAoB,CAAC,CAChC,UAAAC,EACA,OAAAC,EACA,UAAAH,CACF,IAAqD,CACnD,IAAII,EAAMN,EAENE,GAAa,OACfH,EAAoBG,CAAS,EAAIH,EAAoBG,CAAS,GAAK,CAAC,EACpEI,EAAMP,EAAoBG,CAAS,GAGjCE,GAAa,OACfE,EAAI,UAAYF,GAEdC,GAAU,OACZC,EAAI,OAASD,EAEjB",
6
+ "names": ["sessionCallbacksMap", "genericCallbacksMap", "getCallbacks", "sessionId", "registerCallbacks", "onSuccess", "onFail", "map"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{a as h}from"./chunk-4PIR4ESS.mjs";import{a as s}from"./chunk-IYYCFUH4.mjs";import{a as k}from"./chunk-B2RDSGON.mjs";import{a as L}from"./chunk-URXO7GNH.mjs";import{b as A}from"./chunk-ZVDPYIMB.mjs";import{a as I}from"./chunk-BRJNX4JF.mjs";import{f as p}from"./chunk-MSFYVSIA.mjs";import{a as f}from"./chunk-KD2IQ32V.mjs";import{a as x}from"./chunk-LJX4MW7B.mjs";import{BigNumber as C}from"bignumber.js";async function M({options:d,config:i,provider:a,login:c}){let e=h.getInstance(),T=L(),b=k({loginToken:d?.token,version:i.version}),o={manager:e,provider:a};await s(o);let t=await new Promise(async function(E,w){async function g(r){let n=e?e.addressesPerPage??1:1,l=new C(r-1).times(n);e?.updateStartIndex(Math.max(0,parseInt(l.toString()))),await s(o)}async function u(r){if(!(!a||!c)){e?.updateConfirmScreen({...b,selectedAddress:r.selectedAddress,explorerLink:I({to:`/${f}/${r.selectedAddress}`,explorerAddress:T})});try{let n=d?.token?await a.tokenLogin({token:Buffer.from(`${d?.token}{}`),addressIndex:r.addressIndex}):await c({addressIndex:r.addressIndex});E({address:n.address,signature:n.signature?n.signature.toString("hex"):"",addressIndex:r.addressIndex})}catch(n){console.error("User rejected login:",n),!!e?.getConfirmScreenData()&&await s(o)}}}async function m(){await s(o),e.unsubscribeFromAuthEvents({handleCancel:m,handleAccessWallet:u,handleGoToPage:g}),w("User cancelled login")}e.subscribeToAuthEvents({handleCancel:m,handleAccessWallet:u,handleGoToPage:g})}),{version:P,dataEnabled:v}=i;return p({index:t.addressIndex,loginType:x.ledger}),A({address:t.address,index:t.addressIndex,version:P,hasContractDataEnabled:v}),{address:t.address,signature:t.signature}}export{M as a};
2
- //# sourceMappingURL=chunk-YMBVUA56.mjs.map
1
+ import{a as h}from"./chunk-632VK5RN.mjs";import{a as s}from"./chunk-TMNKFPRG.mjs";import{a as k}from"./chunk-B2RDSGON.mjs";import{a as L}from"./chunk-ZPCNRXQG.mjs";import{b as A}from"./chunk-SJCFVUWO.mjs";import{a as I}from"./chunk-BRJNX4JF.mjs";import{f as p}from"./chunk-RQG6ZONS.mjs";import{a as f}from"./chunk-KD2IQ32V.mjs";import{a as x}from"./chunk-LJX4MW7B.mjs";import{BigNumber as C}from"bignumber.js";async function M({options:d,config:i,provider:a,login:c}){let e=h.getInstance(),T=L(),b=k({loginToken:d?.token,version:i.version}),o={manager:e,provider:a};await s(o);let t=await new Promise(async function(E,w){async function g(r){let n=e?e.addressesPerPage??1:1,l=new C(r-1).times(n);e?.updateStartIndex(Math.max(0,parseInt(l.toString()))),await s(o)}async function u(r){if(!(!a||!c)){e?.updateConfirmScreen({...b,selectedAddress:r.selectedAddress,explorerLink:I({to:`/${f}/${r.selectedAddress}`,explorerAddress:T})});try{let n=d?.token?await a.tokenLogin({token:Buffer.from(`${d?.token}{}`),addressIndex:r.addressIndex}):await c({addressIndex:r.addressIndex});E({address:n.address,signature:n.signature?n.signature.toString("hex"):"",addressIndex:r.addressIndex})}catch(n){console.error("User rejected login:",n),!!e?.getConfirmScreenData()&&await s(o)}}}async function m(){await s(o),e.unsubscribeFromAuthEvents({handleCancel:m,handleAccessWallet:u,handleGoToPage:g}),w("User cancelled login")}e.subscribeToAuthEvents({handleCancel:m,handleAccessWallet:u,handleGoToPage:g})}),{version:P,dataEnabled:v}=i;return p({index:t.addressIndex,loginType:x.ledger}),A({address:t.address,index:t.addressIndex,version:P,hasContractDataEnabled:v}),{address:t.address,signature:t.signature}}export{M as a};
2
+ //# sourceMappingURL=chunk-3LL33L5F.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-KLZC6NYC.mjs";import{a as o}from"./chunk-LJX4MW7B.mjs";import{a as e,b as t}from"./chunk-ETED4JB5.mjs";import{WebviewProvider as a}from"@multiversx/sdk-webview-provider/out/WebviewProvider";var n=class extends s{constructor(r){super(r?.address);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async r=>{if(!this.provider)throw new Error("Provider is not initialized.");try{return await this.provider.signTransactions(r)||[]}catch(i){throw this.cancelAction(),i}};this.signMessage=async r=>{if(!this.provider)throw new Error("Provider is not initialized.");try{return await this.provider.signMessage(r)}catch(i){throw this.cancelAction(),i}};this.provider=a.getInstance({resetStateCallback:()=>{e.localStorage?.clear?.(),e.sessionStorage?.clear?.()}}),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}logout(){return this.provider.logout()}getType(){return o.webview}getAddress(){throw new Error("Method not implemented.")}setAccount(r){return this.provider.setAccount(r)}isInitialized(){return this.provider.isInitialized()}async initializeProvider(){let r=await this.provider.init(t);return this.address&&this.setAccount({address:this.address}),r}};export{n as a};
2
- //# sourceMappingURL=chunk-J65JH3Q2.mjs.map
1
+ import{a as s}from"./chunk-O46BVCSH.mjs";import{a as o}from"./chunk-LJX4MW7B.mjs";import{a as e,b as t}from"./chunk-ENHFZ4TV.mjs";import{WebviewProvider as a}from"@multiversx/sdk-webview-provider/out/WebviewProvider";var n=class extends s{constructor(r){super(r?.address);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async r=>{if(!this.provider)throw new Error("Provider is not initialized.");try{return await this.provider.signTransactions(r)||[]}catch(i){throw this.cancelAction(),i}};this.signMessage=async r=>{if(!this.provider)throw new Error("Provider is not initialized.");try{return await this.provider.signMessage(r)}catch(i){throw this.cancelAction(),i}};this.provider=a.getInstance({resetStateCallback:()=>{e.localStorage?.clear?.(),e.sessionStorage?.clear?.()}}),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}logout(){return this.provider.logout()}getType(){return o.webview}getAddress(){throw new Error("Method not implemented.")}setAccount(r){return this.provider.setAccount(r)}isInitialized(){return this.provider.isInitialized()}async initializeProvider(){let r=await this.provider.init(t);return this.address&&this.setAccount({address:this.address}),r}};export{n as a};
2
+ //# sourceMappingURL=chunk-3UVBQHXR.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-ETED4JB5.mjs";var n=class{static get create(){return this.createComponent}static set create(e){this.createComponent=e}};n.createComponent=async({name:e,anchor:m})=>{if(!t?.customElements?.get(e))return null;let o=t.document.createElement(e);return(m||t.document.body).appendChild(o),await customElements.whenDefined(e),o};export{n as a};
2
- //# sourceMappingURL=chunk-B6YF7H7U.mjs.map
1
+ import{a as t}from"./chunk-ENHFZ4TV.mjs";var n=class{static get create(){return this.createComponent}static set create(e){this.createComponent=e}};n.createComponent=async({name:e,anchor:m})=>{if(!t?.customElements?.get(e))return null;let o=t.document.createElement(e);return(m||t.document.body).appendChild(o),await customElements.whenDefined(e),o};export{n as a};
2
+ //# sourceMappingURL=chunk-44EDRVCP.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as de}from"./chunk-M3YL36ZL.mjs";import{a as se}from"./chunk-2Y66XRQK.mjs";import{a as te}from"./chunk-YMBVUA56.mjs";import{a as U}from"./chunk-4PIR4ESS.mjs";import{a as ie}from"./chunk-IMXMFXER.mjs";import{a as re}from"./chunk-DQUL7SM3.mjs";import{a as ee}from"./chunk-YUFPUG5O.mjs";import{a as ae}from"./chunk-J65JH3Q2.mjs";import{a as p}from"./chunk-KLZC6NYC.mjs";import{a as Z}from"./chunk-SJDGXLII.mjs";import{a as ne}from"./chunk-KJIGI7AM.mjs";import{a as oe}from"./chunk-FODR6WTG.mjs";import{a as Q}from"./chunk-QJGFIK7H.mjs";import{b as J}from"./chunk-4Z3DZ2A3.mjs";import{b as I,c as Y}from"./chunk-NRXYSTRW.mjs";import{j as $,l as O,u as M,v as C,w as L}from"./chunk-YEQDJ3AV.mjs";import{a as y}from"./chunk-LMG7PLUI.mjs";import{a as P}from"./chunk-FQTEXMMN.mjs";import{a as q}from"./chunk-WGESEEJ2.mjs";import{a as D}from"./chunk-4TBVQD27.mjs";import{a as X}from"./chunk-A7PB4MFL.mjs";import{g as K}from"./chunk-2IUBMLF4.mjs";import{a as F,q as j,s as l}from"./chunk-MSFYVSIA.mjs";import{f as R}from"./chunk-UERJ6AKK.mjs";import{b as E,c as V}from"./chunk-SAAOQW7P.mjs";import{a as B}from"./chunk-VNLGNNIL.mjs";import{b as H,c as G}from"./chunk-6JM4DPOH.mjs";import{a as c}from"./chunk-6JSWL75O.mjs";import{a as n}from"./chunk-LJX4MW7B.mjs";import{IframeLoginTypes as pe}from"@multiversx/sdk-web-wallet-iframe-provider/out/constants";var f=class extends p{constructor({address:e,anchor:r,shouldInitProvider:t}){super(e);this.provider=null;this.config=null;this.ledgerLogin=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");if(!e||typeof e.addressIndex!="number")throw new Error("Missing addressIndex for Ledger login");let{address:r,signature:t}=await this.provider.login({addressIndex:e.addressIndex});return{address:r,signature:t??""}};this.loginOperation=async e=>{if(!this.provider||!this.config)throw new Error("Provider is not initialized.");return await te({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!P())return;await U.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ne({transactions:e,handleSign:this.provider.signTransactions.bind(this.provider)})};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ce({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await re({shouldInitProvider:!0});this.provider=r}catch(r){throw $({toastId:"ledger-provider-rebuild-error",duration:1e4,icon:"times",iconClassName:"warning",message:"Unlock your device & open the MultiversX App",title:"Ledger unavailable"}),r}}};this.options={anchor:r,shouldInitProvider:t},this._login=this.ledgerLogin.bind(this)}async init(){try{this.initializeAddress(),await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.ledger}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){await this.initLegderConnectManager(this.options?.anchor);let e=U.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((o,s)=>ie({manager:e,resolve:o,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var ve=3e4,me=5e3,he=3e3,S=class a{constructor(){this.store=j();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let i=this.store.getState(),{providerType:e}=B(i),r=R(i);return!!(e===n.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let i=J(l());if(!(!this.shouldCheckConnection()||i))try{await L().getProvider().getAddress()}catch{if(O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"times",iconClassName:"warning",message:"Unlock your device to continue signing transactions",title:"Ledger disconnected"}),this.reset(),this.recreateProviderInterval)return;this.recreateProviderInterval=setInterval(this.reconnectProvider,me)}},ve))};this.reconnectProvider=async()=>{if(this.shouldCheckConnection())try{let i=new f({shouldInitProvider:!0});await i.init();let e=new M(i);i.getType=()=>n.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",duration:he,icon:"check",iconClassName:"success",message:"Your device is ready to sign transactions",title:"Ledger reconnected"}),this.startCheckConnectionLoop()}catch{console.log("Unable to reconnect to Ledger")}};this.reset=()=>{clearInterval(this.connectionCheckInterval??0),this.connectionCheckInterval=null}}static getInstance(){return a.instance||(a.instance=new a),a.instance}};var z=class extends p{constructor(e){super(e?.address);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{onClose:r,manager:t}=await this.initSignState();try{let o=await this.provider.signTransactions(e)??[];return await oe(o)}catch(o){throw await r({shouldCancelAction:!0}),o}finally{t.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.crossWindow})};this.walletAddress=e?.walletAddress,this.provider=Q.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=E(l()),r=await this.provider.init();return this.provider.setWalletUrl(this.walletAddress??e.walletAddress),this.address&&this.provider.setAddress(this.address),r}logout(){return this.provider.logout()}getType(){return n.crossWindow}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{ExtensionProvider as ue}from"@multiversx/sdk-extension-provider/out/extensionProvider";var k=class extends p{constructor(e){super(e);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)??[]}catch(o){throw await t({shouldCancelAction:!1}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.provider=ue.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=await this.provider.init();return this.address&&this.setAccount({address:this.address}),e}getAddress(){return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}logout(){return this.provider.logout()}getType(){return n.extension}};var fe={passkey:n.passkey,metamask:n.metamask},T=class extends p{constructor({type:e,address:r,walletUrl:t}){super(r);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)}catch(o){throw await t({shouldCancelAction:!0}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider||!this.type)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c[this.type]})};this.type=e,this.walletUrl=t??"",this.provider=de.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=E(l());if(!e.iframeWalletAddress)throw new Error("Invalid walletUrl");this.walletUrl=e.iframeWalletAddress}async initializeProvider(){return await this.provider.init(),this.address&&this.setAccount({address:this.address}),this.provider.setLoginType(this.type),this.provider.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return fe[this.type]}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{OptionalOperation as ye}from"@multiversx/sdk-wallet-connect-provider/out";var le=[I.CANCEL_ACTION,I.SIGN_LOGIN_TOKEN],_=class extends p{constructor(e){super();this.provider=null;this.methods=[];this._approval=null;this.cancelActionAbortController=null;this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();this.cancelActionAbortController=new AbortController;let o=this.cancelActionAbortController.signal;try{let s=new Promise((h,v)=>{o.addEventListener("abort",()=>{v(new Error("cancelled by user"))})});return await Promise.race([this.provider.signTransactions(e),s])}catch(s){throw await t({shouldCancelAction:!0}),s}finally{r.closeUI()}};this.cancelAction=async()=>{this.sendCustomRequest({method:I.CANCEL_ACTION,action:ye.CANCEL_ACTION}),this.cancelActionAbortController?.abort()};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");this.cancelActionAbortController=new AbortController;let r=this.cancelActionAbortController.signal,t=new Promise((s,d)=>{r.addEventListener("abort",()=>{d(new Error("cancelled by user"))})});return await Promise.race([g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension}),t])};this.config=e}async init(){try{await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.walletConnect}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return Promise.resolve(this.provider.getAddress())}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){if(await this.initWalletConnectManager(),!this.config)throw new Error("Invalid WalletConnect setup");let{walletConnectProvider:e,dappMethods:r}=await this.createWalletConnectProvider(this.config);this.provider=e,this.methods=r;let{uri:t="",approval:o}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??D.walletConnectDeepLink;this._approval=o,y.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!P())return;await y.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=P(),t=V(l());if(H(l())&&le.push(I.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{X()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:x={},walletConnectV2RelayAddress:W=""}=e,w=new Y(v,t,W,m,x);return await w.init(),{walletConnectProvider:w,dappMethods:le}}catch(m){throw console.error("Unable to connect",m),r&&await this.logout(),m}}async login(e){if(!this.provider)throw new Error("Provider is not initialized. Call createProvider first.");let r=async()=>{if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.init();let t=y.getInstance(),{uri:o="",approval:s}=await this.provider.connect({methods:this.methods}),d=this.config.walletConnectDeepLink??D.walletConnectDeepLink;t.updateData({wcURI:o,walletConnectDeepLink:`${d}?wallet-connect=${encodeURIComponent(o)}`});let h=await this.provider.login({approval:s,token:e?.token}),{address:v="",signature:m=""}=h??{};return t.handleClose({isLoginFinished:!!v}),{address:v,signature:m}}catch{return await r()}};if(!this._approval)throw new Error("Approval or login is not initialized");try{let t=await this.provider.login({approval:this._approval.bind(this),token:e?.token}),{address:o="",signature:s=""}=t??{};return y.getInstance().handleClose({isLoginFinished:!!o}),{address:o,signature:s}}catch(t){return console.error("User rejected connection proposal",t),await r()}}async sendCustomRequest({action:e,method:r}){if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.sendCustomRequest?.({request:{method:r,params:{action:e}}})}catch(t){console.error("Unable to send event",t)}}};var A=class{static set customProviders(i){this._customProviders=i}static get customProviders(){return this._customProviders}static async create({type:i,anchor:e}){let r=null;switch(i){case n.extension:{r=new k;break}case n.crossWindow:{r=new z;break}case n.ledger:{r=new f({anchor:e}),await S.getInstance().init();break}case n.metamask:{r=new T({type:pe.metamask});break}case n.passkey:{r=new T({type:pe.passkey});break}case n.walletConnect:{let s=G(l());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new _({anchor:e,...s});break}case n.webview:{r=new ae;break}default:{let s=q();for(let d of this._customProviders)d.type===i&&(r=await d.constructor({address:s,anchor:e}));break}}if(!r)throw new Error("Unable to create provider");await r.init();let t=new M(r);C(t);let o=n.crossWindow===i;return se(o?{skipLoginMethod:i}:null),t}static async destroy(){L().cancelLogin(),C(null),F(n.none)}};A._customProviders=[];var Pe=(a,i)=>a.some(e=>e.type===i);async function g({message:a,handleSignMessage:i,cancelAction:e,providerType:r}){return await new Promise(async(o,s)=>{let{manager:d,onClose:h}=await Z({cancelAction:e}),v=Object.values(A.customProviders),m=v.reduce((u,N)=>(u[N.type]=N.name,u),{}),x={...c,...m},W=async()=>{await h({shouldCancelAction:!0}),s({message:"Signing canceled"})};d.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",W);let w=Pe(v,r)?r:n.none;d.updateData({name:x[w],type:w});try{let u=await i(a);o(u)}catch(u){await h({shouldCancelAction:!0}),s(u)}finally{d.closeUI()}})}async function ce({message:a,handleSignMessage:i}){try{return await g({message:a,handleSignMessage:i,providerType:c.ledger})}catch(e){let{errorMessage:r}=ee(e);throw r?{message:r}:e}}export{ce as a,f as b,S as c,A as d,g as e,z as f,k as g,T as h,_ as i};
2
- //# sourceMappingURL=chunk-XONPIJ3Y.mjs.map
1
+ import{a as de}from"./chunk-M3YL36ZL.mjs";import{a as se}from"./chunk-2Y66XRQK.mjs";import{a as te}from"./chunk-3LL33L5F.mjs";import{a as U}from"./chunk-632VK5RN.mjs";import{a as ie}from"./chunk-GF3J27ZR.mjs";import{a as re}from"./chunk-VHOQPKEC.mjs";import{a as ee}from"./chunk-YUFPUG5O.mjs";import{a as ae}from"./chunk-3UVBQHXR.mjs";import{a as p}from"./chunk-O46BVCSH.mjs";import{a as Z}from"./chunk-A6XTQQEL.mjs";import{a as ne}from"./chunk-YC3NVMU3.mjs";import{a as oe}from"./chunk-IJWIF6QG.mjs";import{a as Q}from"./chunk-QJGFIK7H.mjs";import{b as J}from"./chunk-4Z3DZ2A3.mjs";import{b as I,c as Y}from"./chunk-NRXYSTRW.mjs";import{j as $,l as O,u as M,v as C,w as L}from"./chunk-5K2UH5QL.mjs";import{a as y}from"./chunk-6GKWP4IU.mjs";import{a as P}from"./chunk-RCM3SNZB.mjs";import{a as q}from"./chunk-VN62BHIP.mjs";import{a as D}from"./chunk-4TBVQD27.mjs";import{a as X}from"./chunk-NQZVWZM5.mjs";import{g as K}from"./chunk-2IUBMLF4.mjs";import{a as F,q as j,s as l}from"./chunk-RQG6ZONS.mjs";import{f as R}from"./chunk-UERJ6AKK.mjs";import{b as E,c as V}from"./chunk-SAAOQW7P.mjs";import{a as B}from"./chunk-VNLGNNIL.mjs";import{b as H,c as G}from"./chunk-6JM4DPOH.mjs";import{a as c}from"./chunk-6JSWL75O.mjs";import{a as n}from"./chunk-LJX4MW7B.mjs";import{IframeLoginTypes as pe}from"@multiversx/sdk-web-wallet-iframe-provider/out/constants";var f=class extends p{constructor({address:e,anchor:r,shouldInitProvider:t}){super(e);this.provider=null;this.config=null;this.ledgerLogin=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");if(!e||typeof e.addressIndex!="number")throw new Error("Missing addressIndex for Ledger login");let{address:r,signature:t}=await this.provider.login({addressIndex:e.addressIndex});return{address:r,signature:t??""}};this.loginOperation=async e=>{if(!this.provider||!this.config)throw new Error("Provider is not initialized.");return await te({options:e,config:this.config,provider:this.provider,login:this.ledgerLogin.bind(this)})};this.initLegderConnectManager=async e=>{if(!!P())return;await U.getInstance().init(e)};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ne({transactions:e,handleSign:this.provider.signTransactions.bind(this.provider)})};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await this.rebuildProvider(),await ce({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider)})};this.rebuildProvider=async()=>{try{await this.provider?.getAddress()}catch{try{let{ledgerProvider:r}=await re({shouldInitProvider:!0});this.provider=r}catch(r){throw $({toastId:"ledger-provider-rebuild-error",duration:1e4,icon:"times",iconClassName:"warning",message:"Unlock your device & open the MultiversX App",title:"Ledger unavailable"}),r}}};this.options={anchor:r,shouldInitProvider:t},this._login=this.ledgerLogin.bind(this)}async init(){try{this.initializeAddress(),await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.ledger}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){await this.initLegderConnectManager(this.options?.anchor);let e=U.getInstance(),{ledgerProvider:r,ledgerConfig:t}=await new Promise((o,s)=>ie({manager:e,resolve:o,reject:s,shouldInitProvider:this.options?.shouldInitProvider}));this.config=t,this.provider=r}};var ve=3e4,me=5e3,he=3e3,S=class a{constructor(){this.store=j();this.connectionCheckInterval=null;this.recreateProviderInterval=null;this.init=async()=>{this.startCheckConnectionLoop()};this.shouldCheckConnection=()=>{let i=this.store.getState(),{providerType:e}=B(i),r=R(i);return!!(e===n.ledger&&r)};this.startCheckConnectionLoop=()=>{this.connectionCheckInterval||(this.connectionCheckInterval=setInterval(async()=>{let i=J(l());if(!(!this.shouldCheckConnection()||i))try{await L().getProvider().getAddress()}catch{if(O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",icon:"times",iconClassName:"warning",message:"Unlock your device to continue signing transactions",title:"Ledger disconnected"}),this.reset(),this.recreateProviderInterval)return;this.recreateProviderInterval=setInterval(this.reconnectProvider,me)}},ve))};this.reconnectProvider=async()=>{if(this.shouldCheckConnection())try{let i=new f({shouldInitProvider:!0});await i.init();let e=new M(i);i.getType=()=>n.ledger,C(e),this.reset(),clearInterval(this.recreateProviderInterval??0),this.recreateProviderInterval=null,O.getInstance().createCustomToast({toastId:"ledger-provider-idle-warning",duration:he,icon:"check",iconClassName:"success",message:"Your device is ready to sign transactions",title:"Ledger reconnected"}),this.startCheckConnectionLoop()}catch{console.log("Unable to reconnect to Ledger")}};this.reset=()=>{clearInterval(this.connectionCheckInterval??0),this.connectionCheckInterval=null}}static getInstance(){return a.instance||(a.instance=new a),a.instance}};var z=class extends p{constructor(e){super(e?.address);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{onClose:r,manager:t}=await this.initSignState();try{let o=await this.provider.signTransactions(e)??[];return await oe(o)}catch(o){throw await r({shouldCancelAction:!0}),o}finally{t.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.crossWindow})};this.walletAddress=e?.walletAddress,this.provider=Q.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=E(l()),r=await this.provider.init();return this.provider.setWalletUrl(this.walletAddress??e.walletAddress),this.address&&this.provider.setAddress(this.address),r}logout(){return this.provider.logout()}getType(){return n.crossWindow}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{ExtensionProvider as ue}from"@multiversx/sdk-extension-provider/out/extensionProvider";var k=class extends p{constructor(e){super(e);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)??[]}catch(o){throw await t({shouldCancelAction:!1}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension})};this.provider=ue.getInstance(),this._login=this.provider.login.bind(this.provider)}async init(){return this.initializeAddress(),this.initializeProvider()}async initializeProvider(){let e=await this.provider.init();return this.address&&this.setAccount({address:this.address}),e}getAddress(){return this.provider.getAddress()}setAccount(e){return this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}logout(){return this.provider.logout()}getType(){return n.extension}};var fe={passkey:n.passkey,metamask:n.metamask},T=class extends p{constructor({type:e,address:r,walletUrl:t}){super(r);this.cancelAction=async()=>{this.provider.cancelAction()};this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();try{return await this.provider.signTransactions(e)}catch(o){throw await t({shouldCancelAction:!0}),o}finally{r.closeUI()}};this.signMessage=async e=>{if(!this.provider||!this.type)throw new Error("Provider is not initialized.");return await g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c[this.type]})};this.type=e,this.walletUrl=t??"",this.provider=de.getInstance(),this._login=this.provider.login.bind(this.provider)}init(){return this.initializeAddress(),this.initializeWalletUrl(),this.initializeProvider()}initializeWalletUrl(){if(this.walletUrl)return;let e=E(l());if(!e.iframeWalletAddress)throw new Error("Invalid walletUrl");this.walletUrl=e.iframeWalletAddress}async initializeProvider(){return await this.provider.init(),this.address&&this.setAccount({address:this.address}),this.provider.setLoginType(this.type),this.provider.setWalletUrl(this.walletUrl),!0}logout(){return this.provider.logout()}getType(){return fe[this.type]}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.getAddress()}setAccount(e){this.provider.setAccount(e)}isInitialized(){return this.provider.isInitialized()}};import{OptionalOperation as ye}from"@multiversx/sdk-wallet-connect-provider/out";var le=[I.CANCEL_ACTION,I.SIGN_LOGIN_TOKEN],_=class extends p{constructor(e){super();this.provider=null;this.methods=[];this._approval=null;this.cancelActionAbortController=null;this.signTransactions=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");let{manager:r,onClose:t}=await this.initSignState();this.cancelActionAbortController=new AbortController;let o=this.cancelActionAbortController.signal;try{let s=new Promise((h,v)=>{o.addEventListener("abort",()=>{v(new Error("cancelled by user"))})});return await Promise.race([this.provider.signTransactions(e),s])}catch(s){throw await t({shouldCancelAction:!0}),s}finally{r.closeUI()}};this.cancelAction=async()=>{this.sendCustomRequest({method:I.CANCEL_ACTION,action:ye.CANCEL_ACTION}),this.cancelActionAbortController?.abort()};this.signMessage=async e=>{if(!this.provider)throw new Error("Provider is not initialized.");this.cancelActionAbortController=new AbortController;let r=this.cancelActionAbortController.signal,t=new Promise((s,d)=>{r.addEventListener("abort",()=>{d(new Error("cancelled by user"))})});return await Promise.race([g({message:e,handleSignMessage:this.provider.signMessage.bind(this.provider),cancelAction:this.cancelAction,providerType:c.extension}),t])};this.config=e}async init(){try{await this.initializeProvider()}catch{return!1}return!0}logout(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.logout()}getType(){return n.walletConnect}getAddress(){if(!this.provider)throw new Error("Provider is not initialized.");return Promise.resolve(this.provider.getAddress())}setAccount(e){return this.provider?.setAccount(e)}isInitialized(){if(!this.provider)throw new Error("Provider is not initialized.");return this.provider.isInitialized()}async initializeProvider(){if(await this.initWalletConnectManager(),!this.config)throw new Error("Invalid WalletConnect setup");let{walletConnectProvider:e,dappMethods:r}=await this.createWalletConnectProvider(this.config);this.provider=e,this.methods=r;let{uri:t="",approval:o}=await this.provider.connect({methods:this.methods}),s=this.config.walletConnectDeepLink??D.walletConnectDeepLink;this._approval=o,y.getInstance().updateData({wcURI:t,walletConnectDeepLink:`${s}?wallet-connect=${encodeURIComponent(t)}`})}async initWalletConnectManager(){if(!!P())return;await y.getInstance().init(this.config?.anchor)}async createWalletConnectProvider(e){let r=P(),t=V(l());if(H(l())&&le.push(I.SIGN_NATIVE_AUTH_TOKEN),!e?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");let v={onClientLogin:()=>{},onClientLogout:()=>{X()},onClientEvent:m=>{}};try{let{walletConnectV2ProjectId:m,walletConnectV2Options:x={},walletConnectV2RelayAddress:W=""}=e,w=new Y(v,t,W,m,x);return await w.init(),{walletConnectProvider:w,dappMethods:le}}catch(m){throw console.error("Unable to connect",m),r&&await this.logout(),m}}async login(e){if(!this.provider)throw new Error("Provider is not initialized. Call createProvider first.");let r=async()=>{if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.init();let t=y.getInstance(),{uri:o="",approval:s}=await this.provider.connect({methods:this.methods}),d=this.config.walletConnectDeepLink??D.walletConnectDeepLink;t.updateData({wcURI:o,walletConnectDeepLink:`${d}?wallet-connect=${encodeURIComponent(o)}`});let h=await this.provider.login({approval:s,token:e?.token}),{address:v="",signature:m=""}=h??{};return t.handleClose({isLoginFinished:!!v}),{address:v,signature:m}}catch{return await r()}};if(!this._approval)throw new Error("Approval or login is not initialized");try{let t=await this.provider.login({approval:this._approval.bind(this),token:e?.token}),{address:o="",signature:s=""}=t??{};return y.getInstance().handleClose({isLoginFinished:!!o}),{address:o,signature:s}}catch(t){return console.error("User rejected connection proposal",t),await r()}}async sendCustomRequest({action:e,method:r}){if(!this.provider)throw new Error("Provider is not initialized.");try{await this.provider.sendCustomRequest?.({request:{method:r,params:{action:e}}})}catch(t){console.error("Unable to send event",t)}}};var A=class{static set customProviders(i){this._customProviders=i}static get customProviders(){return this._customProviders}static async create({type:i,anchor:e}){let r=null;switch(i){case n.extension:{r=new k;break}case n.crossWindow:{r=new z;break}case n.ledger:{r=new f({anchor:e}),await S.getInstance().init();break}case n.metamask:{r=new T({type:pe.metamask});break}case n.passkey:{r=new T({type:pe.passkey});break}case n.walletConnect:{let s=G(l());if(!s?.walletConnectV2ProjectId)throw new Error("Invalid WalletConnect setup");r=new _({anchor:e,...s});break}case n.webview:{r=new ae;break}default:{let s=q();for(let d of this._customProviders)d.type===i&&(r=await d.constructor({address:s,anchor:e}));break}}if(!r)throw new Error("Unable to create provider");await r.init();let t=new M(r);C(t);let o=n.crossWindow===i;return se(o?{skipLoginMethod:i}:null),t}static async destroy(){L().cancelLogin(),C(null),F(n.none)}};A._customProviders=[];var Pe=(a,i)=>a.some(e=>e.type===i);async function g({message:a,handleSignMessage:i,cancelAction:e,providerType:r}){return await new Promise(async(o,s)=>{let{manager:d,onClose:h}=await Z({cancelAction:e}),v=Object.values(A.customProviders),m=v.reduce((u,N)=>(u[N.type]=N.name,u),{}),x={...c,...m},W=async()=>{await h({shouldCancelAction:!0}),s({message:"Signing canceled"})};d.subscribeToEventBus("CLOSE_PENDING_TRANSACTIONS",W);let w=Pe(v,r)?r:n.none;d.updateData({name:x[w],type:w});try{let u=await i(a);o(u)}catch(u){await h({shouldCancelAction:!0}),s(u)}finally{d.closeUI()}})}async function ce({message:a,handleSignMessage:i}){try{return await g({message:a,handleSignMessage:i,providerType:c.ledger})}catch(e){let{errorMessage:r}=ee(e);throw r?{message:r}:e}}export{ce as a,f as b,S as c,A as d,g as e,z as f,k as g,T as h,_ as i};
2
+ //# sourceMappingURL=chunk-4AVJA7MF.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as p}from"./chunk-MFMWGMLN.mjs";import{a as d}from"./chunk-Q3AAD4PW.mjs";import{a as f}from"./chunk-QN2BIRAC.mjs";import{a as h}from"./chunk-3L7HZ2SO.mjs";var g=t=>t.sort((n,i)=>i.timestamp-n.timestamp),k=async({transactions:t,address:n,explorerAddress:i,egldLabel:u,skipFetchingTransactions:I=!1})=>{let o=[],e=[];if(t.forEach(s=>{let a=f(s.hash);a?o.push(a):e.push(s.hash)}),e.length===0)return g(o);let c=I?t.map(s=>({...s,txHash:s.hash})):await p(e),l=c.map(s=>s.txHash),T=e.filter(s=>!l.includes(s));if(T.length>0){let a=t.filter(r=>T.includes(r.hash)).map(r=>({...r,txHash:r.hash,price:0,status:"pending",gasUsed:0,miniBlockHash:"",receiverShard:0,round:0,senderShard:0,timestamp:Date.now()}));c.push(...a)}let m=new Map;return o.forEach(s=>{let a=s.hash;a&&m.set(String(a),s)}),c.forEach(s=>{let a=h({transaction:s,address:n,explorerAddress:i,egldLabel:u});a.status!=="pending"&&d({key:`transaction-${s.txHash}`,value:a}),m.set(s.txHash,a)}),g(Array.from(m.values()))};export{k as a};
2
- //# sourceMappingURL=chunk-66D2TGF6.mjs.map
1
+ import{a as p}from"./chunk-II663X5B.mjs";import{a as d}from"./chunk-DGL4E36L.mjs";import{a as f}from"./chunk-QMHHBZ5O.mjs";import{a as h}from"./chunk-3L7HZ2SO.mjs";var g=t=>t.sort((n,i)=>i.timestamp-n.timestamp),k=async({transactions:t,address:n,explorerAddress:i,egldLabel:u,skipFetchingTransactions:I=!1})=>{let o=[],e=[];if(t.forEach(s=>{let a=f(s.hash);a?o.push(a):e.push(s.hash)}),e.length===0)return g(o);let c=I?t.map(s=>({...s,txHash:s.hash})):await p(e),l=c.map(s=>s.txHash),T=e.filter(s=>!l.includes(s));if(T.length>0){let a=t.filter(r=>T.includes(r.hash)).map(r=>({...r,txHash:r.hash,price:0,status:"pending",gasUsed:0,miniBlockHash:"",receiverShard:0,round:0,senderShard:0,timestamp:Date.now()}));c.push(...a)}let m=new Map;return o.forEach(s=>{let a=s.hash;a&&m.set(String(a),s)}),c.forEach(s=>{let a=h({transaction:s,address:n,explorerAddress:i,egldLabel:u});a.status!=="pending"&&d({key:`transaction-${s.txHash}`,value:a}),m.set(s.txHash,a)}),g(Array.from(m.values()))};export{k as a};
2
+ //# sourceMappingURL=chunk-4CK3GBRH.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-DLWDO7M6.mjs";import{d as v}from"./chunk-4AVJA7MF.mjs";import{v as m}from"./chunk-5K2UH5QL.mjs";import{s as n}from"./chunk-RQG6ZONS.mjs";import{d as s}from"./chunk-VNLGNNIL.mjs";import{a as i}from"./chunk-LJX4MW7B.mjs";import{a as p}from"./chunk-YJMGYDU3.mjs";async function g(){let t=a(),d=p(),r=s(n()),e=d||t?i.webview:r,c=Object.values(i).includes(r);if(r&&!c&&(e=r),!e)return;let o=await v.create({type:e});if(!o)throw new Error("Provider not found");(t||e===i.webview&&o.isInitialized())&&await o.login(),m(o)}export{g as a};
2
+ //# sourceMappingURL=chunk-4KTXRMDS.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-ETED4JB5.mjs";function r(t){try{if(!e)return;e.document.documentElement.dataset.mvxTheme=t}catch{console.log("Error switching the theme!")}}export{r as a};
2
- //# sourceMappingURL=chunk-LS5QVDML.mjs.map
1
+ import{a as e}from"./chunk-ENHFZ4TV.mjs";function r(t){try{if(!e)return;e.document.documentElement.dataset.mvxTheme=t}catch{console.log("Error switching the theme!")}}export{r as a};
2
+ //# sourceMappingURL=chunk-4YUEQAGD.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as Et}from"./chunk-P5EDEM26.mjs";import{a as gt}from"./chunk-3462VWV2.mjs";import{a as It}from"./chunk-6UZHM5LW.mjs";import{a as k}from"./chunk-355TDGZM.mjs";import{a as xt}from"./chunk-6OBHBOL7.mjs";import{a as wt}from"./chunk-FQTEXMMN.mjs";import{a as At}from"./chunk-RSJC4YBI.mjs";import{a as Lt}from"./chunk-GRU4NOFI.mjs";import{a as y}from"./chunk-FMQYLMTU.mjs";import{a as Ct}from"./chunk-MFUQ5NBC.mjs";import{a as Rt}from"./chunk-4ODPAHHA.mjs";import{a as Ot}from"./chunk-NPF3MLTJ.mjs";import{b as F}from"./chunk-NOAPU5US.mjs";import{a as kt}from"./chunk-DJCWPLIW.mjs";import{a as Mt}from"./chunk-MDVI45IV.mjs";import{a as Ft}from"./chunk-PM2CIPJB.mjs";import{a as S}from"./chunk-5DKIUS4V.mjs";import{a as ut}from"./chunk-WGESEEJ2.mjs";import{a as yt}from"./chunk-BYMTQKPA.mjs";import{a as x}from"./chunk-NN2ODLFY.mjs";import{a as O,f as bt}from"./chunk-ZVDPYIMB.mjs";import{b as f,c as q,d as vt}from"./chunk-OQOS52S7.mjs";import{k as ft,l as N,n as ht}from"./chunk-65L5EBBL.mjs";import{b as Nt}from"./chunk-A7PB4MFL.mjs";import{a as M}from"./chunk-HORSXVIV.mjs";import{a as Pt}from"./chunk-ENGIAAJA.mjs";import{a as ct}from"./chunk-LIQTTAAS.mjs";import{a as L}from"./chunk-QTKK6OSJ.mjs";import{a as rt}from"./chunk-6ACLOUQ3.mjs";import{a as A}from"./chunk-NZYB675D.mjs";import{a as at}from"./chunk-YSCND2MX.mjs";import{a as Dt}from"./chunk-NJN53MJV.mjs";import{a as lt,b as pt,g as Tt,l as dt}from"./chunk-2IUBMLF4.mjs";import{b as mt}from"./chunk-TQA3JDNV.mjs";import{a as nt,b as it,q as u,s as E}from"./chunk-MSFYVSIA.mjs";import{c as Q,d as X,f as tt}from"./chunk-UERJ6AKK.mjs";import{b as v}from"./chunk-VNLGNNIL.mjs";import{b}from"./chunk-6JM4DPOH.mjs";import{b as st,c as et,f as ot}from"./chunk-NTEMINYA.mjs";import{b as Bt}from"./chunk-UCRVRBTA.mjs";import{a as St}from"./chunk-B6YF7H7U.mjs";import{c as w}from"./chunk-5Q2JDZD3.mjs";import{b as z}from"./chunk-GGBMHKR4.mjs";import{a as C}from"./chunk-LJX4MW7B.mjs";import J from"lodash.isequal";import Ut from"lodash.isequal";var Zt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",P=class o extends yt{constructor(){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.store=u();this.initialData={pendingTransactions:[],historicTransactions:[]};this.data={...this.initialData}}static getInstance(){return o.instance||(o.instance=new o),o.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){T.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let e=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Ut(r.transactionToasts,n.transactionToasts)||!Ut(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Zt,[e]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let s=T.getInstance();this.closeUI(),await s.showToasts()}async setupEventListeners(){this.eventBus&&(this.subscribeToEventBus("CLOSE_NOTIFICATIONS_FEED",this.handleCloseUI.bind(this)),this.subscribeToEventBus("CLEAR_NOTIFICATIONS_FEED_HISTORY",this.handleClearNotificationsFeedHistory.bind(this)))}async updateDataAndNotifications(){let{transactions:s,account:e,toasts:n,network:i}=this.store.getState(),{pendingTransactionToasts:r}=await k({toastList:n,transactionsSessions:s,account:e});this.data.pendingTransactions=r,this.data.historicTransactions=await gt.getTransactionsHistory({transactionsSessions:s,address:e.address,explorerAddress:i.network.explorerAddress,egldLabel:i.network.egldLabel}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){vt(),this.resetData(),this.updateNotificationsFeed()}async updateNotificationsFeed(){this.eventBus&&(this.eventBus.publish("PENDING_TRANSACTIONS_UPDATE",this.data.pendingTransactions),this.eventBus.publish("TRANSACTIONS_HISTORY_UPDATE",this.data.historicTransactions))}};import V from"bignumber.js";var R=class o{constructor(){this.store=u();this.warningLogoutTimeoutRef=null;this.actualLogoutTimeoutRef=null;this.plannedLogoutTimeoutRef=null;this.plannedLogoutKey=null;this.init=async()=>{if(!this.shouldStart())return;let t=this.store.getState(),s=v(t),{isExpired:e}=L(s?.nativeAuthToken);e?I().logout():this.addPlannedLogout()};this.stop=()=>{clearTimeout(this.warningLogoutTimeoutRef??0),clearTimeout(this.plannedLogoutTimeoutRef??0),clearTimeout(this.actualLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=null,this.plannedLogoutTimeoutRef=null,this.actualLogoutTimeoutRef=null,this.plannedLogoutKey=null};this.shouldStart=()=>{let t=this.store.getState(),s=v(t),e=tt(t);return!!(s?.nativeAuthToken&&e)};this.addPlannedLogout=()=>{let t=I(),s=Q(this.store.getState()),e=t.getType()===C.webview;if(!s||e)return;this.addLogoutWarning();let n=v(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=L(n?.nativeAuthToken),c=new V(String(i)),a=`${s}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let d=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},d.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},d.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=b(this.store.getState()),s=v(this.store.getState()),{secondsUntilExpires:e}=L(s?.nativeAuthToken),n=new V(String(e)),i=n.times(1e3);if(!e||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new V(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=It(i.toNumber()),l=a.isLessThanOrEqualTo(0)?0:a.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-expired",iconClassName:"warning",title:"Session Expiration Warning",icon:"hourglass",message:`Your session will expire in ${m}!`}),this.warningLogoutTimeoutRef=null},l)}}static getInstance(){return o.instance||(o.instance=new o),o.instance}};var B={};async function Qt({serverTransaction:o,sessionId:t,isSequential:s}){let{hash:e,status:n,results:i,invalidTransaction:r,hasStatusChanged:c}=o;try{if(B[e]>30){f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"});return}if(r&&!s||n==="sent"){B[e]=B[e]?B[e]+1:1;return}if(s&&!n){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m});return}if(c){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m})}N(n)&&await Lt({sessionId:t,hash:e,results:i})}catch(a){console.error(a),f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"})}}async function _t({sessionId:o,transactionBatch:t,isSequential:s}){try{if(t==null)return;let e=wt(),n=Ct(t),i=await Et(n);for(let p of i)await Qt({serverTransaction:p,sessionId:o,isSequential:s});if(!i.every(p=>p.status!=="pending"))return;e&&await D();let{transactions:c}=u().getState(),a=c[o];if(a.transactions.every(p=>p.status==="success"))return f({sessionId:o,status:"success"});if(a.transactions.some(p=>p.status==="fail"))return f({sessionId:o,status:"fail"});if(a.transactions.every(p=>p.status==="not executed"))return f({sessionId:o,status:"invalid"})}catch(e){console.error(e)}}async function Wt(){let o=mt(E());if(Object.keys(o).length>0)for(let[t,{transactions:s}]of Object.entries(o))await _t({sessionId:t,transactionBatch:s})}async function U(){let o=u(),t=At(),s=null,e=null,n=X(o.getState())?.timestamp,i=()=>{Wt()},r=()=>{s??=setInterval(i,t)},c=()=>{s&&(clearInterval(s),s=null)},a=()=>{c();let p=o.subscribe(({account:{websocketEvent:g}})=>{g?.message&&n!==g.timestamp&&(n=g.timestamp,i())});w.set("websocketEventReceived",p)},m=()=>{z.status!=="not_initialized"||e||(e=setInterval(()=>{z.status==="completed"&&(clearInterval(e),e=null,a())},1e3))};i();let l=()=>{c(),e&&(clearInterval(e),e=null)},d=o.subscribe(({account:{address:p},config:{websocketStatus:g}},jt)=>{if(jt.config.websocketStatus!==g)switch(g){case"completed":a();break;case"pending":r(),m();break;default:p?r():l();break}});return w.set("websocketStatusChanged",d),w.set("websocketEventReceived",l),{stopTransactionsTracking:l}}async function j({address:o,provider:t,apiAddress:s}){let e=await A({address:o,baseURL:s});if(!e)throw new Error("Account not found");Nt({address:o,providerType:t.getType()});let n={...e,username:M(e.username),nonce:x(e)};O(n),await F(o),U(),e.shard!=null&&await xt({shard:Number(e.shard),apiAddress:s})}async function Xt(o){let{network:{apiAddress:t}}=S();await o.login();let s=await o.getAddress();if(!s)throw new Error("Address not found");return await j({address:s,provider:o,apiAddress:t}),{address:s}}async function ts({provider:o,nativeAuthConfig:t,token:s}){let{network:{apiAddress:e}}=S(),n=ct(t),i=s;i||(i=await n.initialize({noCache:!0}));let{address:r,signature:c,...a}=await o.login({token:i});if(!r)return console.warn("Login cancelled."),null;if(!c)return console.error("Failed to sign login token"),null;let l=rt(a?.accessToken)?a.accessToken:n.getToken({address:r,token:i,signature:c});it({loginToken:i,signature:c,nativeAuthToken:l});let d=await kt({loginToken:i,extraInfoData:{multisig:a?.multisig,impersonate:a?.impersonate},address:r});return await j({address:d,provider:o,apiAddress:e}),{address:d,signature:c}}async function Ht(o,t){let s=b(E());if(s)return await ts({provider:o,nativeAuthConfig:s,token:t?.token});let{address:e}=await Xt(o);return await F(e),U(),{address:e,signature:""}}var Y={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${pt}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${lt}-${Date.now()}`}},ss={extensionResponse:"Unable to sign transactions","Transaction canceled":"Transaction canceled","cancelled by user":"Transaction signing cancelled by user","denied by the user":"Transaction signing denied by the user"},es=o=>{for(let[t,s]of Object.entries(ss))if(o.includes(t))return s;return"Error when signing"};function Z(o,t="error"){let s=o?.message,e=es(s),i=e!=="Error when signing"?"warning":t,r=Object.keys(Y).includes(i)?Y[i]:Y.error,{toastId:c,iconClassName:a,title:m}=r;return _({toastId:c,duration:1e4,icon:"times",iconClassName:a,message:e,title:m}),e}async function Gt({provider:o,transactions:t,options:s={}}){await D();let{isGuarded:e,activeGuardianAddress:n,nonce:i}=Pt(),r=o.getType()===C.ledger,c=Rt({latestNonce:i,transactions:t}),a=n&&e&&!s.skipGuardian?c?.map(l=>(l.version=st.withTxOptions().valueOf(),l.options=ot.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),l.guardian=et.newFromBech32(n),l)):c,m=await o.signTransactions(a)??[];return bt(i+m.length),m}var W=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let s=await Ht(this.provider,t);return nt(this.provider.getType()),$t(this),R.getInstance().init(),s}isInitialized(){return this.provider.isInitialized()}async logout(t={shouldBroadcastLogoutAcrossTabs:!0}){if(this._isLoggingOut)return console.warn("Logout already in progress"),!1;this._isLoggingOut=!0;let s=await Ot({provider:this.provider,options:t});return this._isLoggingOut=!1,s}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,s){try{return await Gt({provider:this.provider,transactions:t,options:s})}catch(e){let n=Z(e);throw new Error(n)}}async signMessage(t,s){try{return await Ft({provider:this.provider,message:t,options:s})}catch(e){let n=Z(e,"warning");throw new Error(n)}}async verifyMessage(t){return await Mt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var Kt=null;function $t(o){Kt=o}function I(){return Kt||new W(Bt)}var os=async()=>{try{let o=ut(),{network:t}=S();try{let s=await A({address:o,baseURL:t.apiAddress});if(s!=null){let e={...s,username:M(s.username),nonce:x(s)};return O(e),e}}catch(s){console.error("Failed getting account ",s)}}catch(o){console.error("Failed getting address ",o)}return null};async function D(){let o=I();if(o==null)throw"Provider not initialized";try{if(!o.init)throw"Current provider does not have init() function";return await o.init()?await os():void 0}catch(t){console.error("Failed initializing provider ",t)}}var H={},h={},ns=(o,t)=>{u().setState(({toasts:s})=>{let e=s.customToasts.length>0?Math.max(...s.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${e+1}`,i=s.customToasts.findIndex(a=>a.toastId===n),r={...o,toastId:n};if(i!==-1){s.customToasts[i]=r;return}s.customToasts.push({...r,toastId:n})},!1,"addCustomToast")},G=o=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(s=>s.toastId!==o)},!1,"removeCustomToast")},zt=()=>{u().setState(({toasts:o})=>{o.customToasts=[]},!1,"removeAllCustomToasts")},Wo=()=>{u().setState(({toasts:o})=>{o.transactionToasts=[]})},qt=({toastId:o,totalDuration:t})=>{let s="";return u().setState(({toasts:e})=>{let n=e.transactionToasts.length>0?Math.max(...e.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;s=o??`transaction-toast-${n+1}`,e.transactionToasts.push({startTime:at(),endTime:Dt(t),toastId:s})},!1,"addTransactionToast"),s},$=o=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(s=>s.toastId!==o)},!1,"removeTransactionToast"),delete h[o],delete H[o]},_=o=>{let{toasts:t}=u().getState(),s=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,e=o.toastId||`custom-toast-${s+1}`;return o.onClose&&(h[e]=o.onClose),o.instantiateToastElement?(H[e]=o.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===e),r={...o,instantiateToastElement:null,toastId:e};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),e):(ns(o,e),e)};var Vt=1e4,K=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=Vt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let s=setTimeout(()=>{$(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,s)};this.startWithCustomDuration=(t,s)=>{if(this.stop(t),s<=0)return;let e=setTimeout(()=>{G(t);let n=h[t];n?.()},s);this.timeoutIntervals.set(t,e)};this.stop=t=>{let s=this.timeoutIntervals.get(t);s&&(clearTimeout(s),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t||Vt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};var T=class o{constructor(){this.isCreatingElement=!1;this.toastsElement=null;this.transactionToasts=[];this.customToasts=[];this.storeToastsSubscription=()=>null;this.eventBusUnsubscribeFunctions=[];this.eventBus=null;this.store=u();this.destroy(),this.lifetimeManager=new K,this.notificationsFeedManager=P.getInstance()}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),await this.updateTransactionToastsList(),await this.updateCustomToastList(),await this.subscribeToEventBusNotifications(),this.storeToastsSubscription=this.store.subscribe(async({toasts:s,transactions:e},{toasts:n,transactions:i})=>{let r=!J(n.transactionToasts,s.transactionToasts),c=!J(i,e);(r||c)&&await this.updateTransactionToastsList({skipFetchingTransactions:c}),!J(n.customToasts,s.customToasts)&&await this.updateCustomToastList()})}static getInstance(){return o.instance||(o.instance=new o),o.instance}handleCompletedTransaction(t){let{transactions:s}=this.store.getState(),e=s[t];if(!e)return!1;let{status:n}=e,i=ht(n),r=N(n),c=ft(n),a=r||c||i;return a?(this.successfulToastLifetime&&this.lifetimeManager.start(t),a):(this.lifetimeManager.stop(t),a)}async createTransactionToast(t,s){let e=qt({toastId:t,totalDuration:s});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),e}createCustomToast(t){let s=_(t);return this.updateCustomToastList(),s}async updateTransactionToastsList(t){let{toasts:s,transactions:e,account:n}=this.store.getState(),{pendingTransactionToasts:i,completedTransactionToasts:r}=await k({toastList:s,transactionsSessions:e,account:n,skipFetchingTransactions:t?.skipFetchingTransactions});this.transactionToasts=[...i,...r];for(let c of s.transactionToasts)this.handleCompletedTransaction(c.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let s of t.customToasts){let n="message"in s?{...s}:{...s,instantiateToastElement:H[s.toastId]};this.customToasts.push(n),s.duration&&this.lifetimeManager.startWithCustomDuration(s.toastId,s.duration)}this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await St.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}handleTransactionToastClose(t){this.handleCompletedTransaction(t)&&$(t)}async subscribeToEventBusNotifications(){let t=await this.createToastListElement();if(t){if(this.eventBus=await t.getEventBus(),!this.eventBus)throw new Error("eventBus is not initialized");this.eventBus.subscribe("CLOSE_TOAST",this.closeToast.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.closeToast.bind(this))}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}async showToasts(){this.eventBus?.publish("SHOW_TOAST_LIST",null),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.eventBus?.publish("HIDE_TOAST_LIST",null)}async handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}closeToast(t){if(this.customToasts.find(e=>e.toastId===t)){this.lifetimeManager.stop(t);let e=h[t];e?.(),G(t);return}this.handleTransactionToastClose(t)}async publishTransactionToasts(){if(this.notificationsFeedManager.isNotificationsFeedOpen()&&this.eventBus){this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts),this.hideToasts();return}if(!this.eventBus){let t=await this.createToastListElement();if(!t)return;this.eventBus=await t.getEventBus()}this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts)}destroy(){this.storeToastsSubscription(),this.lifetimeManager?.destroy(),this.notificationsFeedManager?.destroy(),zt(),this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[]}};export{P as a,H as b,h as c,ns as d,G as e,zt as f,Wo as g,qt as h,$ as i,_ as j,K as k,T as l,R as m,_t as n,Wt as o,U as p,j as q,Ht as r,Z as s,Gt as t,W as u,$t as v,I as w,D as x};
2
- //# sourceMappingURL=chunk-YEQDJ3AV.mjs.map
1
+ import{a as Et}from"./chunk-ZTLWHYQL.mjs";import{a as gt}from"./chunk-VFIKV2UU.mjs";import{a as It}from"./chunk-6UZHM5LW.mjs";import{a as k}from"./chunk-RHP2BLW4.mjs";import{a as xt}from"./chunk-T5FALTG2.mjs";import{a as wt}from"./chunk-RCM3SNZB.mjs";import{a as At}from"./chunk-YY55H5EM.mjs";import{a as Lt}from"./chunk-IT3RZ4HT.mjs";import{a as y}from"./chunk-KDWLSBQB.mjs";import{a as Ct}from"./chunk-MFUQ5NBC.mjs";import{a as Rt}from"./chunk-4ODPAHHA.mjs";import{a as Ot}from"./chunk-K4BSSSHE.mjs";import{b as F}from"./chunk-CCFQYROV.mjs";import{a as kt}from"./chunk-LDIEAM6D.mjs";import{a as Mt}from"./chunk-MDVI45IV.mjs";import{a as Ft}from"./chunk-YQ63ZYW2.mjs";import{a as S}from"./chunk-SDJQOCX2.mjs";import{a as ut}from"./chunk-VN62BHIP.mjs";import{a as yt}from"./chunk-PSSRDP4O.mjs";import{a as x}from"./chunk-CHCWBFEG.mjs";import{a as O,f as bt}from"./chunk-SJCFVUWO.mjs";import{b as f,c as q,d as vt}from"./chunk-RMSMZKTD.mjs";import{k as ft,l as N,n as ht}from"./chunk-65L5EBBL.mjs";import{b as Nt}from"./chunk-NQZVWZM5.mjs";import{a as M}from"./chunk-HORSXVIV.mjs";import{a as Pt}from"./chunk-GQAGO7KW.mjs";import{a as ct}from"./chunk-VHHB4LMW.mjs";import{a as L}from"./chunk-QTKK6OSJ.mjs";import{a as rt}from"./chunk-6ACLOUQ3.mjs";import{a as A}from"./chunk-NZYB675D.mjs";import{a as at}from"./chunk-YSCND2MX.mjs";import{a as Dt}from"./chunk-NJN53MJV.mjs";import{a as lt,b as pt,g as Tt,l as dt}from"./chunk-2IUBMLF4.mjs";import{b as mt}from"./chunk-TQA3JDNV.mjs";import{a as nt,b as it,q as u,s as E}from"./chunk-RQG6ZONS.mjs";import{c as Q,d as X,f as tt}from"./chunk-UERJ6AKK.mjs";import{b as v}from"./chunk-VNLGNNIL.mjs";import{b}from"./chunk-6JM4DPOH.mjs";import{b as st,c as et,f as ot}from"./chunk-NTEMINYA.mjs";import{b as Bt}from"./chunk-UCRVRBTA.mjs";import{a as St}from"./chunk-44EDRVCP.mjs";import{c as w}from"./chunk-CYWOWIRB.mjs";import{b as z}from"./chunk-GGBMHKR4.mjs";import{a as C}from"./chunk-LJX4MW7B.mjs";import J from"lodash.isequal";import Ut from"lodash.isequal";var Zt="NOTIFICATIONS_FEED_STORE_SUBSCRIBE",P=class o extends yt{constructor(){super({uiDataUpdateEvent:"OPEN_NOTIFICATIONS_FEED",uiTag:"mvx-notifications-feed"});this.store=u();this.initialData={pendingTransactions:[],historicTransactions:[]};this.data={...this.initialData}}static getInstance(){return o.instance||(o.instance=new o),o.instance}isNotificationsFeedOpen(){return this.isOpen}async openNotificationsFeed(){T.getInstance().hideToasts(),await this.openUI(),await this.updateDataAndNotifications();let e=this.store.subscribe(async({toasts:n,transactions:i},{toasts:r,transactions:c})=>{(!Ut(r.transactionToasts,n.transactionToasts)||!Ut(c,i))&&await this.updateDataAndNotifications()});this.unsubscribeFunctions.set(Zt,[e]),this.eventBus?.publish("OPEN_NOTIFICATIONS_FEED"),await this.updateDataAndNotifications()}async handleCloseUI(){let s=T.getInstance();this.closeUI(),await s.showToasts()}async setupEventListeners(){this.eventBus&&(this.subscribeToEventBus("CLOSE_NOTIFICATIONS_FEED",this.handleCloseUI.bind(this)),this.subscribeToEventBus("CLEAR_NOTIFICATIONS_FEED_HISTORY",this.handleClearNotificationsFeedHistory.bind(this)))}async updateDataAndNotifications(){let{transactions:s,account:e,toasts:n,network:i}=this.store.getState(),{pendingTransactionToasts:r}=await k({toastList:n,transactionsSessions:s,account:e});this.data.pendingTransactions=r,this.data.historicTransactions=await gt.getTransactionsHistory({transactionsSessions:s,address:e.address,explorerAddress:i.network.explorerAddress,egldLabel:i.network.egldLabel}),await this.updateNotificationsFeed()}handleClearNotificationsFeedHistory(){vt(),this.resetData(),this.updateNotificationsFeed()}async updateNotificationsFeed(){this.eventBus&&(this.eventBus.publish("PENDING_TRANSACTIONS_UPDATE",this.data.pendingTransactions),this.eventBus.publish("TRANSACTIONS_HISTORY_UPDATE",this.data.historicTransactions))}};import V from"bignumber.js";var R=class o{constructor(){this.store=u();this.warningLogoutTimeoutRef=null;this.actualLogoutTimeoutRef=null;this.plannedLogoutTimeoutRef=null;this.plannedLogoutKey=null;this.init=async()=>{if(!this.shouldStart())return;let t=this.store.getState(),s=v(t),{isExpired:e}=L(s?.nativeAuthToken);e?I().logout():this.addPlannedLogout()};this.stop=()=>{clearTimeout(this.warningLogoutTimeoutRef??0),clearTimeout(this.plannedLogoutTimeoutRef??0),clearTimeout(this.actualLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=null,this.plannedLogoutTimeoutRef=null,this.actualLogoutTimeoutRef=null,this.plannedLogoutKey=null};this.shouldStart=()=>{let t=this.store.getState(),s=v(t),e=tt(t);return!!(s?.nativeAuthToken&&e)};this.addPlannedLogout=()=>{let t=I(),s=Q(this.store.getState()),e=t.getType()===C.webview;if(!s||e)return;this.addLogoutWarning();let n=v(this.store.getState()),{secondsUntilExpires:i,expiresAt:r}=L(n?.nativeAuthToken),c=new V(String(i)),a=`${s}_${r}`,m=this.plannedLogoutKey===a;if(!(i&&c.isGreaterThan(0))||m)return;this.plannedLogoutKey=a,clearTimeout(this.plannedLogoutTimeoutRef??0);let d=c.times(1e3);this.actualLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-logout",iconClassName:"warning",title:"Logging out",icon:"times",message:"Your session has expired!"}),this.actualLogoutTimeoutRef=null},d.toNumber()-3e3),this.plannedLogoutTimeoutRef=setTimeout(()=>{t.logout(),this.plannedLogoutTimeoutRef=null,this.plannedLogoutKey=null},d.toNumber())};this.addLogoutWarning=()=>{if(this.warningLogoutTimeoutRef)return;let t=b(this.store.getState()),s=v(this.store.getState()),{secondsUntilExpires:e}=L(s?.nativeAuthToken),n=new V(String(e)),i=n.times(1e3);if(!e||n.isLessThanOrEqualTo(0)||!t?.tokenExpirationToastWarningSeconds)return;let c=new V(t?.tokenExpirationToastWarningSeconds??0).times(1e3),a=n.times(1e3).minus(c),m=It(i.toNumber()),l=a.isLessThanOrEqualTo(0)?0:a.toNumber();clearTimeout(this.warningLogoutTimeoutRef??0),this.warningLogoutTimeoutRef=setTimeout(()=>{T.getInstance().createCustomToast({toastId:"native-auth-expired",iconClassName:"warning",title:"Session Expiration Warning",icon:"hourglass",message:`Your session will expire in ${m}!`}),this.warningLogoutTimeoutRef=null},l)}}static getInstance(){return o.instance||(o.instance=new o),o.instance}};var B={};async function Qt({serverTransaction:o,sessionId:t,isSequential:s}){let{hash:e,status:n,results:i,invalidTransaction:r,hasStatusChanged:c}=o;try{if(B[e]>30){f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"});return}if(r&&!s||n==="sent"){B[e]=B[e]?B[e]+1:1;return}if(s&&!n){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m});return}if(c){let m=q({sessionId:t,transaction:o});await y({sessionId:t,status:m})}N(n)&&await Lt({sessionId:t,hash:e,results:i})}catch(a){console.error(a),f({sessionId:t,status:"timedOut"}),await y({sessionId:t,status:"timedOut"})}}async function _t({sessionId:o,transactionBatch:t,isSequential:s}){try{if(t==null)return;let e=wt(),n=Ct(t),i=await Et(n);for(let p of i)await Qt({serverTransaction:p,sessionId:o,isSequential:s});if(!i.every(p=>p.status!=="pending"))return;e&&await D();let{transactions:c}=u().getState(),a=c[o];if(a.transactions.every(p=>p.status==="success"))return f({sessionId:o,status:"success"});if(a.transactions.some(p=>p.status==="fail"))return f({sessionId:o,status:"fail"});if(a.transactions.every(p=>p.status==="not executed"))return f({sessionId:o,status:"invalid"})}catch(e){console.error(e)}}async function Wt(){let o=mt(E());if(Object.keys(o).length>0)for(let[t,{transactions:s}]of Object.entries(o))await _t({sessionId:t,transactionBatch:s})}async function U(){let o=u(),t=At(),s=null,e=null,n=X(o.getState())?.timestamp,i=()=>{Wt()},r=()=>{s??=setInterval(i,t)},c=()=>{s&&(clearInterval(s),s=null)},a=()=>{c();let p=o.subscribe(({account:{websocketEvent:g}})=>{g?.message&&n!==g.timestamp&&(n=g.timestamp,i())});w.set("websocketEventReceived",p)},m=()=>{z.status!=="not_initialized"||e||(e=setInterval(()=>{z.status==="completed"&&(clearInterval(e),e=null,a())},1e3))};i();let l=()=>{c(),e&&(clearInterval(e),e=null)},d=o.subscribe(({account:{address:p},config:{websocketStatus:g}},jt)=>{if(jt.config.websocketStatus!==g)switch(g){case"completed":a();break;case"pending":r(),m();break;default:p?r():l();break}});return w.set("websocketStatusChanged",d),w.set("websocketEventReceived",l),{stopTransactionsTracking:l}}async function j({address:o,provider:t,apiAddress:s}){let e=await A({address:o,baseURL:s});if(!e)throw new Error("Account not found");Nt({address:o,providerType:t.getType()});let n={...e,username:M(e.username),nonce:x(e)};O(n),await F(o),U(),e.shard!=null&&await xt({shard:Number(e.shard),apiAddress:s})}async function Xt(o){let{network:{apiAddress:t}}=S();await o.login();let s=await o.getAddress();if(!s)throw new Error("Address not found");return await j({address:s,provider:o,apiAddress:t}),{address:s}}async function ts({provider:o,nativeAuthConfig:t,token:s}){let{network:{apiAddress:e}}=S(),n=ct(t),i=s;i||(i=await n.initialize({noCache:!0}));let{address:r,signature:c,...a}=await o.login({token:i});if(!r)return console.warn("Login cancelled."),null;if(!c)return console.error("Failed to sign login token"),null;let l=rt(a?.accessToken)?a.accessToken:n.getToken({address:r,token:i,signature:c});it({loginToken:i,signature:c,nativeAuthToken:l});let d=await kt({loginToken:i,extraInfoData:{multisig:a?.multisig,impersonate:a?.impersonate},address:r});return await j({address:d,provider:o,apiAddress:e}),{address:d,signature:c}}async function Ht(o,t){let s=b(E());if(s)return await ts({provider:o,nativeAuthConfig:s,token:t?.token});let{address:e}=await Xt(o);return await F(e),U(),{address:e,signature:""}}var Y={error:{title:"Error when signing".toString(),iconClassName:"danger",toastId:`${pt}-${Date.now()}`},warning:{title:"Signing canceled".toString(),iconClassName:"warning",toastId:`${lt}-${Date.now()}`}},ss={extensionResponse:"Unable to sign transactions","Transaction canceled":"Transaction canceled","cancelled by user":"Transaction signing cancelled by user","denied by the user":"Transaction signing denied by the user"},es=o=>{for(let[t,s]of Object.entries(ss))if(o.includes(t))return s;return"Error when signing"};function Z(o,t="error"){let s=o?.message,e=es(s),i=e!=="Error when signing"?"warning":t,r=Object.keys(Y).includes(i)?Y[i]:Y.error,{toastId:c,iconClassName:a,title:m}=r;return _({toastId:c,duration:1e4,icon:"times",iconClassName:a,message:e,title:m}),e}async function Gt({provider:o,transactions:t,options:s={}}){await D();let{isGuarded:e,activeGuardianAddress:n,nonce:i}=Pt(),r=o.getType()===C.ledger,c=Rt({latestNonce:i,transactions:t}),a=n&&e&&!s.skipGuardian?c?.map(l=>(l.version=st.withTxOptions().valueOf(),l.options=ot.withOptions({guarded:!0,...r?{hashSign:!0}:{}}).valueOf(),l.guardian=et.newFromBech32(n),l)):c,m=await o.signTransactions(a)??[];return bt(i+m.length),m}var W=class{constructor(t){this._isLoggingOut=!1;this.provider=t}init(){return this.provider.init()}async login(t){let s=await Ht(this.provider,t);return nt(this.provider.getType()),$t(this),R.getInstance().init(),s}isInitialized(){return this.provider.isInitialized()}async logout(t={shouldBroadcastLogoutAcrossTabs:!0}){if(this._isLoggingOut)return console.warn("Logout already in progress"),!1;this._isLoggingOut=!0;let s=await Ot({provider:this.provider,options:t});return this._isLoggingOut=!1,s}getType(){return this.provider.getType()}getProvider(){return this.provider}async signTransactions(t,s){try{return await Gt({provider:this.provider,transactions:t,options:s})}catch(e){let n=Z(e);throw new Error(n)}}async signMessage(t,s){try{return await Ft({provider:this.provider,message:t,options:s})}catch(e){let n=Z(e,"warning");throw new Error(n)}}async verifyMessage(t){return await Mt(t)}cancelLogin(){this.provider.cancelLogin?.()}};var Kt=null;function $t(o){Kt=o}function I(){return Kt||new W(Bt)}var os=async()=>{try{let o=ut(),{network:t}=S();try{let s=await A({address:o,baseURL:t.apiAddress});if(s!=null){let e={...s,username:M(s.username),nonce:x(s)};return O(e),e}}catch(s){console.error("Failed getting account ",s)}}catch(o){console.error("Failed getting address ",o)}return null};async function D(){let o=I();if(o==null)throw"Provider not initialized";try{if(!o.init)throw"Current provider does not have init() function";return await o.init()?await os():void 0}catch(t){console.error("Failed initializing provider ",t)}}var H={},h={},ns=(o,t)=>{u().setState(({toasts:s})=>{let e=s.customToasts.length>0?Math.max(...s.customToasts.map(a=>parseInt(a.toastId.split("-").pop()??"0"))):0,n=t??`custom-toast-${e+1}`,i=s.customToasts.findIndex(a=>a.toastId===n),r={...o,toastId:n};if(i!==-1){s.customToasts[i]=r;return}s.customToasts.push({...r,toastId:n})},!1,"addCustomToast")},G=o=>{u().setState(({toasts:t})=>{t.customToasts=t.customToasts.filter(s=>s.toastId!==o)},!1,"removeCustomToast")},zt=()=>{u().setState(({toasts:o})=>{o.customToasts=[]},!1,"removeAllCustomToasts")},Wo=()=>{u().setState(({toasts:o})=>{o.transactionToasts=[]})},qt=({toastId:o,totalDuration:t})=>{let s="";return u().setState(({toasts:e})=>{let n=e.transactionToasts.length>0?Math.max(...e.transactionToasts.map(i=>parseInt(i.toastId.split("-").pop()??"0"))):0;s=o??`transaction-toast-${n+1}`,e.transactionToasts.push({startTime:at(),endTime:Dt(t),toastId:s})},!1,"addTransactionToast"),s},$=o=>{u().setState(({toasts:t})=>{t.transactionToasts=t.transactionToasts.filter(s=>s.toastId!==o)},!1,"removeTransactionToast"),delete h[o],delete H[o]},_=o=>{let{toasts:t}=u().getState(),s=t.customToasts.length>0?Math.max(...t.customToasts.map(n=>parseInt(n.toastId.split("-").pop()??"0"))):0,e=o.toastId||`custom-toast-${s+1}`;return o.onClose&&(h[e]=o.onClose),o.instantiateToastElement?(H[e]=o.instantiateToastElement,u().setState(({toasts:n})=>{let i=n.customToasts.findIndex(a=>a.toastId===e),r={...o,instantiateToastElement:null,toastId:e};i!==-1?n.customToasts[i]=r:n.customToasts.push(r)},!1,"createCustomToast"),e):(ns(o,e),e)};var Vt=1e4,K=class{constructor(){this.timeoutIntervals=new Map;this.successfulToastLifetime=Vt;this.start=t=>{if(this.stop(t),this.successfulToastLifetime<=0)return;let s=setTimeout(()=>{$(t)},this.successfulToastLifetime);this.timeoutIntervals.set(t,s)};this.startWithCustomDuration=(t,s)=>{if(this.stop(t),s<=0)return;let e=setTimeout(()=>{G(t);let n=h[t];n?.()},s);this.timeoutIntervals.set(t,e)};this.stop=t=>{let s=this.timeoutIntervals.get(t);s&&(clearTimeout(s),this.timeoutIntervals.delete(t))}}init({successfulToastLifetime:t}){this.successfulToastLifetime=t||Vt}destroy(){this.timeoutIntervals.forEach(t=>clearTimeout(t)),this.timeoutIntervals.clear()}};var T=class o{constructor(){this.isCreatingElement=!1;this.toastsElement=null;this.transactionToasts=[];this.customToasts=[];this.storeToastsSubscription=()=>null;this.eventBusUnsubscribeFunctions=[];this.eventBus=null;this.store=u();this.destroy(),this.lifetimeManager=new K,this.notificationsFeedManager=P.getInstance()}async init({successfulToastLifetime:t=5e3}={}){this.successfulToastLifetime=t,this.lifetimeManager.init({successfulToastLifetime:t}),await this.updateTransactionToastsList(),await this.updateCustomToastList(),await this.subscribeToEventBusNotifications(),this.storeToastsSubscription=this.store.subscribe(async({toasts:s,transactions:e},{toasts:n,transactions:i})=>{let r=!J(n.transactionToasts,s.transactionToasts),c=!J(i,e);(r||c)&&await this.updateTransactionToastsList({skipFetchingTransactions:c}),!J(n.customToasts,s.customToasts)&&await this.updateCustomToastList()})}static getInstance(){return o.instance||(o.instance=new o),o.instance}handleCompletedTransaction(t){let{transactions:s}=this.store.getState(),e=s[t];if(!e)return!1;let{status:n}=e,i=ht(n),r=N(n),c=ft(n),a=r||c||i;return a?(this.successfulToastLifetime&&this.lifetimeManager.start(t),a):(this.lifetimeManager.stop(t),a)}async createTransactionToast(t,s){let e=qt({toastId:t,totalDuration:s});return this.handleCompletedTransaction(t),await this.updateTransactionToastsList(),e}createCustomToast(t){let s=_(t);return this.updateCustomToastList(),s}async updateTransactionToastsList(t){let{toasts:s,transactions:e,account:n}=this.store.getState(),{pendingTransactionToasts:i,completedTransactionToasts:r}=await k({toastList:s,transactionsSessions:e,account:n,skipFetchingTransactions:t?.skipFetchingTransactions});this.transactionToasts=[...i,...r];for(let c of s.transactionToasts)this.handleCompletedTransaction(c.toastId);await this.publishTransactionToasts()}async updateCustomToastList(){let{toasts:t}=this.store.getState();this.customToasts=[];for(let s of t.customToasts){let n="message"in s?{...s}:{...s,instantiateToastElement:H[s.toastId]};this.customToasts.push(n),s.duration&&this.lifetimeManager.startWithCustomDuration(s.toastId,s.duration)}this.eventBus?.publish("CUSTOM_TOAST_DATA_UPDATE",this.customToasts)}async createToastListElement(){return this.toastsElement?this.toastsElement:(this.isCreatingElement||(this.isCreatingElement=!0,this.toastsElement=await St.create({name:"mvx-toast-list"}),this.isCreatingElement=!1),this.toastsElement)}handleTransactionToastClose(t){this.handleCompletedTransaction(t)&&$(t)}async subscribeToEventBusNotifications(){let t=await this.createToastListElement();if(t){if(this.eventBus=await t.getEventBus(),!this.eventBus)throw new Error("eventBus is not initialized");this.eventBus.subscribe("CLOSE_TOAST",this.closeToast.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("CLOSE_TOAST",this.closeToast.bind(this))}),this.eventBus.subscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this)),this.eventBusUnsubscribeFunctions.push(()=>{this.eventBus?.unsubscribe("OPEN_NOTIFICATIONS_FEED",this.handleOpenNotificationsFeed.bind(this))})}}async showToasts(){this.eventBus?.publish("SHOW_TOAST_LIST",null),await this.updateCustomToastList(),await this.updateTransactionToastsList()}hideToasts(){this.eventBus?.publish("HIDE_TOAST_LIST",null)}async handleOpenNotificationsFeed(){this.notificationsFeedManager.openNotificationsFeed()}closeToast(t){if(this.customToasts.find(e=>e.toastId===t)){this.lifetimeManager.stop(t);let e=h[t];e?.(),G(t);return}this.handleTransactionToastClose(t)}async publishTransactionToasts(){if(this.notificationsFeedManager.isNotificationsFeedOpen()&&this.eventBus){this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts),this.hideToasts();return}if(!this.eventBus){let t=await this.createToastListElement();if(!t)return;this.eventBus=await t.getEventBus()}this.eventBus.publish("TRANSACTION_TOAST_DATA_UPDATE",this.transactionToasts)}destroy(){this.storeToastsSubscription(),this.lifetimeManager?.destroy(),this.notificationsFeedManager?.destroy(),zt(),this.eventBusUnsubscribeFunctions.forEach(t=>t()),this.eventBusUnsubscribeFunctions=[]}};export{P as a,H as b,h as c,ns as d,G as e,zt as f,Wo as g,qt as h,$ as i,_ as j,K as k,T as l,R as m,_t as n,Wt as o,U as p,j as q,Ht as r,Z as s,Gt as t,W as u,$t as v,I as w,D as x};
2
+ //# sourceMappingURL=chunk-5K2UH5QL.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-ICDR3HC5.mjs";var c=class n extends i{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE",uiTag:"mvx-ledger-connect"});this.addressesPerPage=10;this.allAccounts=[];this.initialConnectScreenData={};this.connectScreenData={...this.initialConnectScreenData};this.initialAccountScreenData={accounts:this.allAccounts,startIndex:0,addressesPerPage:this.addressesPerPage,isLoading:!0};this.accountScreenData={...this.initialAccountScreenData};this.initialConfirmScreenData={selectedAddress:"",explorerLink:""};this.confirmScreenData={...this.initialConfirmScreenData};this.initialData={connectScreenData:this.initialConnectScreenData,accountScreenData:this.initialAccountScreenData,confirmScreenData:this.initialConfirmScreenData};this.data=this.getInitialData()}static getInstance(){return n.instance||(n.instance=new n),n.instance}updateAllAccounts(e){this.allAccounts=e,this.accountScreenData.accounts=e}updateStartIndex(e){this.accountScreenData.startIndex=e}updateConnectScreen(e){this.connectScreenData={...this.connectScreenData,...e},this.data.confirmScreenData=null,this.data.accountScreenData=null,this.data.connectScreenData=this.connectScreenData,this.notifyDataUpdate()}updateAccountScreen(e){this.accountScreenData={...this.accountScreenData,...e},this.data.confirmScreenData=null,this.data.accountScreenData=this.accountScreenData,this.notifyDataUpdate()}updateConfirmScreen(e){this.confirmScreenData={...this.confirmScreenData,...e},this.data.accountScreenData=null,this.data.confirmScreenData=this.confirmScreenData,this.notifyDataUpdate()}getAccountScreenData(){return this.data.accountScreenData}getConfirmScreenData(){return this.data.confirmScreenData}getAllAccounts(){return this.allAccounts}subscribeToProviderInit({handleRetry:e,handleCancel:t}){this.eventBus&&(this.eventBus.subscribe("CONNECT_DEVICE",e),this.eventBus.subscribe("CLOSE",t),this.eventBus.subscribe("UI_DISCONNECTED",this.destroy.bind(this)))}unsubscribeFromProviderInit({handleRetry:e,handleCancel:t}){this.eventBus&&(this.eventBus.unsubscribe("CONNECT_DEVICE",e),this.eventBus.unsubscribe("CLOSE",t),this.eventBus.unsubscribe("UI_DISCONNECTED",this.destroy.bind(this)))}subscribeToAuthEvents({handleCancel:e,handleAccessWallet:t,handleGoToPage:a}){this.eventBus&&(this.eventBus.subscribe("CLOSE",e),this.eventBus.subscribe("ACCESS_WALLET",t),this.eventBus.subscribe("GO_TO_PAGE",a))}unsubscribeFromAuthEvents({handleCancel:e,handleAccessWallet:t,handleGoToPage:a}){this.eventBus&&(this.eventBus.unsubscribe("CLOSE",e),this.eventBus.unsubscribe("ACCESS_WALLET",t),this.eventBus.unsubscribe("GO_TO_PAGE",a))}handleClose(){this.anchor?this.anchor?.dispatchEvent(new CustomEvent("ANCHOR_CLOSE",{composed:!1,bubbles:!1})):this.destroy()}resetData(){this.accountScreenData={...this.initialAccountScreenData},this.confirmScreenData={...this.initialConfirmScreenData},this.connectScreenData={...this.initialConnectScreenData},super.resetData()}async setupEventListeners(){this.eventBus&&this.eventBus.subscribe("CLOSE",this.handleClose.bind(this))}};export{c as a};
2
- //# sourceMappingURL=chunk-4PIR4ESS.mjs.map
1
+ import{a as i}from"./chunk-UA5WGULZ.mjs";var c=class n extends i{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE",uiTag:"mvx-ledger-connect"});this.addressesPerPage=10;this.allAccounts=[];this.initialConnectScreenData={};this.connectScreenData={...this.initialConnectScreenData};this.initialAccountScreenData={accounts:this.allAccounts,startIndex:0,addressesPerPage:this.addressesPerPage,isLoading:!0};this.accountScreenData={...this.initialAccountScreenData};this.initialConfirmScreenData={selectedAddress:"",explorerLink:""};this.confirmScreenData={...this.initialConfirmScreenData};this.initialData={connectScreenData:this.initialConnectScreenData,accountScreenData:this.initialAccountScreenData,confirmScreenData:this.initialConfirmScreenData};this.data=this.getInitialData()}static getInstance(){return n.instance||(n.instance=new n),n.instance}updateAllAccounts(e){this.allAccounts=e,this.accountScreenData.accounts=e}updateStartIndex(e){this.accountScreenData.startIndex=e}updateConnectScreen(e){this.connectScreenData={...this.connectScreenData,...e},this.data.confirmScreenData=null,this.data.accountScreenData=null,this.data.connectScreenData=this.connectScreenData,this.notifyDataUpdate()}updateAccountScreen(e){this.accountScreenData={...this.accountScreenData,...e},this.data.confirmScreenData=null,this.data.accountScreenData=this.accountScreenData,this.notifyDataUpdate()}updateConfirmScreen(e){this.confirmScreenData={...this.confirmScreenData,...e},this.data.accountScreenData=null,this.data.confirmScreenData=this.confirmScreenData,this.notifyDataUpdate()}getAccountScreenData(){return this.data.accountScreenData}getConfirmScreenData(){return this.data.confirmScreenData}getAllAccounts(){return this.allAccounts}subscribeToProviderInit({handleRetry:e,handleCancel:t}){this.eventBus&&(this.eventBus.subscribe("CONNECT_DEVICE",e),this.eventBus.subscribe("CLOSE",t),this.eventBus.subscribe("UI_DISCONNECTED",this.destroy.bind(this)))}unsubscribeFromProviderInit({handleRetry:e,handleCancel:t}){this.eventBus&&(this.eventBus.unsubscribe("CONNECT_DEVICE",e),this.eventBus.unsubscribe("CLOSE",t),this.eventBus.unsubscribe("UI_DISCONNECTED",this.destroy.bind(this)))}subscribeToAuthEvents({handleCancel:e,handleAccessWallet:t,handleGoToPage:a}){this.eventBus&&(this.eventBus.subscribe("CLOSE",e),this.eventBus.subscribe("ACCESS_WALLET",t),this.eventBus.subscribe("GO_TO_PAGE",a))}unsubscribeFromAuthEvents({handleCancel:e,handleAccessWallet:t,handleGoToPage:a}){this.eventBus&&(this.eventBus.unsubscribe("CLOSE",e),this.eventBus.unsubscribe("ACCESS_WALLET",t),this.eventBus.unsubscribe("GO_TO_PAGE",a))}handleClose(){this.anchor?this.anchor?.dispatchEvent(new CustomEvent("ANCHOR_CLOSE",{composed:!1,bubbles:!1})):this.destroy()}resetData(){this.accountScreenData={...this.initialAccountScreenData},this.confirmScreenData={...this.initialConfirmScreenData},this.connectScreenData={...this.initialConnectScreenData},super.resetData()}async setupEventListeners(){this.eventBus&&this.eventBus.subscribe("CLOSE",this.handleClose.bind(this))}};export{c as a};
2
+ //# sourceMappingURL=chunk-632VK5RN.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-ICDR3HC5.mjs";var n=class t extends e{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE",uiTag:"mvx-wallet-connect"});this.initialData={wcURI:"",walletConnectDeepLink:""};this.data={...this.initialData}}static getInstance(){return t.instance||(t.instance=new t),t.instance}handleClose(a){a?.isLoginFinished||(this.anchor?this.anchor.dispatchEvent(new CustomEvent("ANCHOR_CLOSE",{composed:!1,bubbles:!1})):this.destroy())}async setupEventListeners(){this.eventBus&&(this.eventBus.subscribe("CLOSE",this.handleClose.bind(this)),this.eventBus.subscribe("UI_DISCONNECTED",this.destroy.bind(this)))}};export{n as a};
2
- //# sourceMappingURL=chunk-LMG7PLUI.mjs.map
1
+ import{a as e}from"./chunk-UA5WGULZ.mjs";var n=class t extends e{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE",uiTag:"mvx-wallet-connect"});this.initialData={wcURI:"",walletConnectDeepLink:""};this.data={...this.initialData}}static getInstance(){return t.instance||(t.instance=new t),t.instance}handleClose(a){a?.isLoginFinished||(this.anchor?this.anchor.dispatchEvent(new CustomEvent("ANCHOR_CLOSE",{composed:!1,bubbles:!1})):this.destroy())}async setupEventListeners(){this.eventBus&&(this.eventBus.subscribe("CLOSE",this.handleClose.bind(this)),this.eventBus.subscribe("UI_DISCONNECTED",this.destroy.bind(this)))}};export{n as a};
2
+ //# sourceMappingURL=chunk-6GKWP4IU.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as S}from"./chunk-EAJBSX6Y.mjs";import{a as s}from"./chunk-NTOY6GTP.mjs";import{c as r,d as a}from"./chunk-2IUBMLF4.mjs";import{s as e}from"./chunk-MSFYVSIA.mjs";import{a as n}from"./chunk-UERJ6AKK.mjs";var u=t=>{let o=0,i=n(e())?.shard;return S(t)?(t.forEach(c=>{let m=s(c,i);o+=m?5*6e3:6e3}),o):(o=s(t,i)?5*6e3:6e3,o)};export{u as a};
2
- //# sourceMappingURL=chunk-5LDRZKQG.mjs.map
1
+ import{a as S}from"./chunk-EAJBSX6Y.mjs";import{a as s}from"./chunk-NTOY6GTP.mjs";import{c as r,d as a}from"./chunk-2IUBMLF4.mjs";import{s as e}from"./chunk-RQG6ZONS.mjs";import{a as n}from"./chunk-UERJ6AKK.mjs";var u=t=>{let o=0,i=n(e())?.shard;return S(t)?(t.forEach(c=>{let m=s(c,i);o+=m?5*6e3:6e3}),o):(o=s(t,i)?5*6e3:6e3,o)};export{u as a};
2
+ //# sourceMappingURL=chunk-6QDJ2IO3.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-JBNKG6XC.mjs";async function i(a){let n=e.getInstance();return await n.openUI(),{manager:n,onClose:async({shouldCancelAction:t=!0}={})=>{n.closeUI(),t&&a?.cancelAction&&await a.cancelAction()}}}export{i as a};
2
- //# sourceMappingURL=chunk-SJDGXLII.mjs.map
1
+ import{a as e}from"./chunk-FZKGYTPJ.mjs";async function i(a){let n=e.getInstance();return await n.openUI(),{manager:n,onClose:async({shouldCancelAction:t=!0}={})=>{n.closeUI(),t&&a?.cancelAction&&await a.cancelAction()}}}export{i as a};
2
+ //# sourceMappingURL=chunk-A6XTQQEL.mjs.map
@@ -1,2 +1,2 @@
1
- import{s as r}from"./chunk-MSFYVSIA.mjs";import{b as e}from"./chunk-SAAOQW7P.mjs";var d=s=>{let o=e(r()),t=s??o.apiAddress;return t.endsWith("/")?t.slice(0,-1):t};export{d as a};
2
- //# sourceMappingURL=chunk-Y57ROHMV.mjs.map
1
+ import{s as r}from"./chunk-RQG6ZONS.mjs";import{b as e}from"./chunk-SAAOQW7P.mjs";var d=s=>{let o=e(r()),t=s??o.apiAddress;return t.endsWith("/")?t.slice(0,-1):t};export{d as a};
2
+ //# sourceMappingURL=chunk-AQ7ZQRAJ.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-6KIQJGRP.mjs";async function g({originalLoginToken:i,extraInfoData:n,address:o}){let e=await t({loginToken:i,extraInfoData:n}),s=n.multisig||n.impersonate||o;return{address:e!=null?s:o,modifiedLoginToken:e}}export{g as a};
2
- //# sourceMappingURL=chunk-LH5IBSC3.mjs.map
1
+ import{a as t}from"./chunk-ZM3VDK22.mjs";async function g({originalLoginToken:i,extraInfoData:n,address:o}){let e=await t({loginToken:i,extraInfoData:n}),s=n.multisig||n.impersonate||o;return{address:e!=null?s:o,modifiedLoginToken:e}}export{g as a};
2
+ //# sourceMappingURL=chunk-C22Q5W5S.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-A4WTVE3V.mjs";var t={closeConnectionRef:void 0};async function c(n){let{closeConnection:o}=await e(n);t.closeConnectionRef=o}export{t as a,c as b};
2
- //# sourceMappingURL=chunk-NOAPU5US.mjs.map
1
+ import{a as e}from"./chunk-TJYIVY7J.mjs";var t={closeConnectionRef:void 0};async function c(n){let{closeConnection:o}=await e(n);t.closeConnectionRef=o}export{t as a,c as b};
2
+ //# sourceMappingURL=chunk-CCFQYROV.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-TQA3JDNV.mjs";import{s}from"./chunk-MSFYVSIA.mjs";import{e as a}from"./chunk-UERJ6AKK.mjs";function x(n){let e=s(),o=u(e),c=a(e),t=Object.keys(o).map(Number).reduce((r,m)=>{let i=o[m]?.transactions||[];return Math.max(r,...i.map(l=>l.nonce),0)},0);return t>0&&(t+=1),n==null?Math.max(t,c):Math.max(t,n.nonce,c)}export{x as a};
2
- //# sourceMappingURL=chunk-NN2ODLFY.mjs.map
1
+ import{a as u}from"./chunk-TQA3JDNV.mjs";import{s}from"./chunk-RQG6ZONS.mjs";import{e as a}from"./chunk-UERJ6AKK.mjs";function x(n){let e=s(),o=u(e),c=a(e),t=Object.keys(o).map(Number).reduce((r,m)=>{let i=o[m]?.transactions||[];return Math.max(r,...i.map(l=>l.nonce),0)},0);return t>0&&(t+=1),n==null?Math.max(t,c):Math.max(t,n.nonce,c)}export{x as a};
2
+ //# sourceMappingURL=chunk-CHCWBFEG.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-ETED4JB5.mjs";var t=()=>{if(!e)return"";try{let r=e.document?.referrer;return r?new URL(r).origin:""}catch(r){return console.error(r),""}};export{t as a};
2
- //# sourceMappingURL=chunk-L5WRBBHH.mjs.map
1
+ import{a as e}from"./chunk-ENHFZ4TV.mjs";var t=()=>{if(!e)return"";try{let r=e.document?.referrer;return r?new URL(r).origin:""}catch(r){return console.error(r),""}};export{t as a};
2
+ //# sourceMappingURL=chunk-CLPLLK67.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-ETED4JB5.mjs";import{createJSONStorage as o}from"zustand/middleware";var r={persistReducersStorageType:"localStorage"},i=e?o(()=>e[r.persistReducersStorageType]):void 0,p=new Map,n=3e3;export{r as a,i as b,p as c,n as d};
2
- //# sourceMappingURL=chunk-5Q2JDZD3.mjs.map
1
+ import{a as e}from"./chunk-ENHFZ4TV.mjs";import{createJSONStorage as o}from"zustand/middleware";var r={persistReducersStorageType:"localStorage"},i=e?o(()=>e[r.persistReducersStorageType]):void 0,p=new Map,n=3e3;export{r as a,i as b,p as c,n as d};
2
+ //# sourceMappingURL=chunk-CYWOWIRB.mjs.map
@@ -0,0 +1,2 @@
1
+ import{s as o}from"./chunk-RQG6ZONS.mjs";import{b as t}from"./chunk-UERJ6AKK.mjs";function c(r=o()){return t(r)}export{c as a};
2
+ //# sourceMappingURL=chunk-D4V7EOIL.mjs.map
@@ -1,2 +1,2 @@
1
- import{q as a}from"./chunk-MSFYVSIA.mjs";var r=({key:e,value:t})=>{a().setState(({cache:c})=>{c[e]=t},!1,"saveToCache")},s=e=>{a().setState(({cache:t})=>{delete t[e]},!1,"removeFromCache")},h=()=>{a().setState(({cache:e})=>{Object.keys(e).forEach(t=>{delete e[t]})},!1,"clearCache")};export{r as a,s as b,h as c};
2
- //# sourceMappingURL=chunk-Q3AAD4PW.mjs.map
1
+ import{q as a}from"./chunk-RQG6ZONS.mjs";var r=({key:e,value:t})=>{a().setState(({cache:c})=>{c[e]=t},!1,"saveToCache")},s=e=>{a().setState(({cache:t})=>{delete t[e]},!1,"removeFromCache")},h=()=>{a().setState(({cache:e})=>{Object.keys(e).forEach(t=>{delete e[t]})},!1,"clearCache")};export{r as a,s as b,h as c};
2
+ //# sourceMappingURL=chunk-DGL4E36L.mjs.map
@@ -0,0 +1,2 @@
1
+ import{q as e}from"./chunk-RQG6ZONS.mjs";var o=t=>e().setState(({ui:n})=>{n.isSidePanelOpen=t},!1,"setIsSidePanelOpen");export{o as a};
2
+ //# sourceMappingURL=chunk-DT3MXNJI.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as k}from"./chunk-4FD6QSAE.mjs";import{a as T}from"./chunk-XCVEFI4B.mjs";import{a as i}from"./chunk-W5MTQBQF.mjs";import{a as m}from"./chunk-UNBTFF6K.mjs";import{a as l}from"./chunk-U3UMCTU6.mjs";import{c as d}from"./chunk-PJWJZHIS.mjs";import{a as o}from"./chunk-7CELSV4S.mjs";var p=class{static async processTransactions({address:u,egldLabel:v,explorerAddress:g,transactions:L}){let f=L.map(e=>m({address:u,explorerAddress:g,transaction:e}));return await Promise.all(f.map(async e=>{let s=e.receiverAssets?.name.replace(/\p{Emoji}/gu,""),a=e.senderAssets?.name.replace(/\p{Emoji}/gu,""),{senderLockedAccount:h,receiverLockedAccount:D}=await k({receiver:e.receiver,sender:e.sender,tokenId:e.tokenIdentifier}),{egldValueData:t,tokenValueData:n,nftValueData:r}=T({transaction:e}),x=r?.token.type==="MetaESDT"?void 0:r?.badgeText,c=l.getData({input:t?.value??n?.value??r?.value??"",decimals:t?.decimals??n?.decimals??r?.decimals??d,digits:2}),y={badge:x??void 0,collection:n?.token.collection??r?.token.collection,egldLabel:t?v:"",link:n?.tokenExplorerLink??r?.tokenExplorerLink,linkText:n?.tokenLinkText??r?.tokenLinkText,name:n?.token.name??r?.token.name,showFormattedAmount:!!(t||n?.tokenFormattedAmount||r?.tokenFormattedAmount),svgUrl:n?.token.svgUrl??r?.token.svgUrl,ticker:n?.token.ticker??r?.token.ticker,titleText:n?.titleText??r?.titleText,valueDecimal:c.valueDecimal,valueInteger:c.valueInteger},w=i(e.receiverShard),A=i(e.senderShard);return{age:e.transactionDetails.age,direction:e.transactionDetails.direction,method:e.transactionDetails.method,iconInfo:e.transactionDetails.iconInfo,link:e.links.transactionLink??"",txHash:e.txHash,receiver:{address:e.receiver,name:s??"",description:`${s??e.receiver} (${e.receiver})`,isContract:o(e.receiver),isTokenLocked:!!D,link:e.links.receiverLink??"",shard:w,shardLink:e.links.receiverLink,showLink:e.transactionDetails.direction!=="In"},sender:{address:e.sender,name:a??"",description:`${a??e.sender} (${e.sender})`,isContract:o(e.sender),isTokenLocked:!!h,link:e.links.senderLink??"",shard:A,shardLink:e.links.senderShardLink,showLink:e.transactionDetails.direction!=="Out"},value:y}}))}};export{p as a};
2
- //# sourceMappingURL=chunk-OPVHND3O.mjs.map
1
+ import{a as k}from"./chunk-VQ4W2MEF.mjs";import{a as T}from"./chunk-XCVEFI4B.mjs";import{a as i}from"./chunk-W5MTQBQF.mjs";import{a as m}from"./chunk-UNBTFF6K.mjs";import{a as l}from"./chunk-U3UMCTU6.mjs";import{c as d}from"./chunk-PJWJZHIS.mjs";import{a as o}from"./chunk-7CELSV4S.mjs";var p=class{static async processTransactions({address:u,egldLabel:v,explorerAddress:g,transactions:L}){let f=L.map(e=>m({address:u,explorerAddress:g,transaction:e}));return await Promise.all(f.map(async e=>{let s=e.receiverAssets?.name.replace(/\p{Emoji}/gu,""),a=e.senderAssets?.name.replace(/\p{Emoji}/gu,""),{senderLockedAccount:h,receiverLockedAccount:D}=await k({receiver:e.receiver,sender:e.sender,tokenId:e.tokenIdentifier}),{egldValueData:t,tokenValueData:n,nftValueData:r}=T({transaction:e}),x=r?.token.type==="MetaESDT"?void 0:r?.badgeText,c=l.getData({input:t?.value??n?.value??r?.value??"",decimals:t?.decimals??n?.decimals??r?.decimals??d,digits:2}),y={badge:x??void 0,collection:n?.token.collection??r?.token.collection,egldLabel:t?v:"",link:n?.tokenExplorerLink??r?.tokenExplorerLink,linkText:n?.tokenLinkText??r?.tokenLinkText,name:n?.token.name??r?.token.name,showFormattedAmount:!!(t||n?.tokenFormattedAmount||r?.tokenFormattedAmount),svgUrl:n?.token.svgUrl??r?.token.svgUrl,ticker:n?.token.ticker??r?.token.ticker,titleText:n?.titleText??r?.titleText,valueDecimal:c.valueDecimal,valueInteger:c.valueInteger},w=i(e.receiverShard),A=i(e.senderShard);return{age:e.transactionDetails.age,direction:e.transactionDetails.direction,method:e.transactionDetails.method,iconInfo:e.transactionDetails.iconInfo,link:e.links.transactionLink??"",txHash:e.txHash,receiver:{address:e.receiver,name:s??"",description:`${s??e.receiver} (${e.receiver})`,isContract:o(e.receiver),isTokenLocked:!!D,link:e.links.receiverLink??"",shard:w,shardLink:e.links.receiverLink,showLink:e.transactionDetails.direction!=="In"},sender:{address:e.sender,name:a??"",description:`${a??e.sender} (${e.sender})`,isContract:o(e.sender),isTokenLocked:!!h,link:e.links.senderLink??"",shard:A,shardLink:e.links.senderShardLink,showLink:e.transactionDetails.direction!=="Out"},value:y}}))}};export{p as a};
2
+ //# sourceMappingURL=chunk-EIL6PTC4.mjs.map
@@ -0,0 +1,2 @@
1
+ var o=typeof window<"u"?window:{},n="5.1.9";export{o as a,n as b};
2
+ //# sourceMappingURL=chunk-ENHFZ4TV.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.1.8'; // will be replaced at build time\n"],
4
+ "sourcesContent": ["export const safeWindow: Window =\n typeof window !== 'undefined' ? window : ({} as Window);\n\nexport const version = '5.1.9'; // 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 o}from"./chunk-ETED4JB5.mjs";var i=String(o?.navigator?.userAgent),t=/^((?!chrome|android).)*safari/i.test(i),r=/firefox/i.test(i)&&/windows/i.test(i),n=t||r;export{t as a,n as b};
2
- //# sourceMappingURL=chunk-QUVHL3QF.mjs.map
1
+ import{a as o}from"./chunk-ENHFZ4TV.mjs";var i=String(o?.navigator?.userAgent),t=/^((?!chrome|android).)*safari/i.test(i),r=/firefox/i.test(i)&&/windows/i.test(i),n=t||r;export{t as a,n as b};
2
+ //# sourceMappingURL=chunk-EQOLFL4H.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-BYMTQKPA.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-JBNKG6XC.mjs.map
1
+ import{a as t}from"./chunk-PSSRDP4O.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-FZKGYTPJ.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-DQUL7SM3.mjs";import{a}from"./chunk-YUFPUG5O.mjs";import{a as c}from"./chunk-FQTEXMMN.mjs";var p="Check if the MultiversX App is open on Ledger";async function v({manager:e,resolve:n,reject:d,shouldInitProvider:s}){let i=!c(),t=()=>v({manager:e,resolve:n,reject:d,shouldInitProvider:s}),o=()=>d("Device unavailable");try{e?.updateAccountScreen({isLoading:!0}),e&&i&&e.subscribeToProviderInit({handleRetry:t,handleCancel:o});let r=await l({shouldInitProvider:s});e&&i&&e.unsubscribeFromProviderInit({handleRetry:t,handleCancel:o}),n(r)}catch(r){if(!i)throw r;let{errorMessage:u,defaultErrorMessage:g}=a(r);e?.updateConnectScreen({error:u??g??p}),e&&e.subscribeToProviderInit({handleRetry:t,handleCancel:o})}}export{v as a};
2
- //# sourceMappingURL=chunk-IMXMFXER.mjs.map
1
+ import{a as l}from"./chunk-VHOQPKEC.mjs";import{a}from"./chunk-YUFPUG5O.mjs";import{a as c}from"./chunk-RCM3SNZB.mjs";var p="Check if the MultiversX App is open on Ledger";async function v({manager:e,resolve:n,reject:d,shouldInitProvider:s}){let i=!c(),t=()=>v({manager:e,resolve:n,reject:d,shouldInitProvider:s}),o=()=>d("Device unavailable");try{e?.updateAccountScreen({isLoading:!0}),e&&i&&e.subscribeToProviderInit({handleRetry:t,handleCancel:o});let r=await l({shouldInitProvider:s});e&&i&&e.unsubscribeFromProviderInit({handleRetry:t,handleCancel:o}),n(r)}catch(r){if(!i)throw r;let{errorMessage:u,defaultErrorMessage:g}=a(r);e?.updateConnectScreen({error:u??g??p}),e&&e.subscribeToProviderInit({handleRetry:t,handleCancel:o})}}export{v as a};
2
+ //# sourceMappingURL=chunk-GF3J27ZR.mjs.map
@@ -0,0 +1,2 @@
1
+ import{s as o}from"./chunk-RQG6ZONS.mjs";import{a as t}from"./chunk-UERJ6AKK.mjs";function n(r=o()){return t(r)}export{n as a};
2
+ //# sourceMappingURL=chunk-GQAGO7KW.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-LGAWIVRO.mjs";import{s as m}from"./chunk-MSFYVSIA.mjs";import{b as a}from"./chunk-SAAOQW7P.mjs";import{o as s,u as o}from"./chunk-KD2IQ32V.mjs";import{a as c}from"./chunk-3FXHIV6O.mjs";async function I({tokenId:n}){let t=a(m()),r={tokenDecimals:Number(t.decimals),tokenLabel:"",tokenImageUrl:""},{isNft:k}=c(n),i=n,p=k?s:o;if(!i)return r;try{let e=await g(`${t.apiAddress}/${p}/${i}`),l=e?e?.decimals:Number(t.decimals),f=e?e?.name:"",T=e?e?.assets?.svgUrl??e?.media?.[0]?.thumbnailUrl:"";return{tokenDecimals:l,tokenLabel:f,type:e?.type,tokenImageUrl:T,identifier:e?.identifier,assets:e?.assets,esdtPrice:e?.price,ticker:e?.ticker,name:e?.name}}catch(e){return{...r,error:`${e}`}}}export{I as a};
2
- //# sourceMappingURL=chunk-6KB3FBQO.mjs.map
1
+ import{a as g}from"./chunk-LGAWIVRO.mjs";import{s as m}from"./chunk-RQG6ZONS.mjs";import{b as a}from"./chunk-SAAOQW7P.mjs";import{o as s,u as o}from"./chunk-KD2IQ32V.mjs";import{a as c}from"./chunk-3FXHIV6O.mjs";async function I({tokenId:n}){let t=a(m()),r={tokenDecimals:Number(t.decimals),tokenLabel:"",tokenImageUrl:""},{isNft:k}=c(n),i=n,p=k?s:o;if(!i)return r;try{let e=await g(`${t.apiAddress}/${p}/${i}`),l=e?e?.decimals:Number(t.decimals),f=e?e?.name:"",T=e?e?.assets?.svgUrl??e?.media?.[0]?.thumbnailUrl:"";return{tokenDecimals:l,tokenLabel:f,type:e?.type,tokenImageUrl:T,identifier:e?.identifier,assets:e?.assets,esdtPrice:e?.price,ticker:e?.ticker,name:e?.name}}catch(e){return{...r,error:`${e}`}}}export{I as a};
2
+ //# sourceMappingURL=chunk-HSAPJUAV.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as w}from"./chunk-YK7T6MBD.mjs";import{a as l}from"./chunk-KMJMQEXI.mjs";import{q as u}from"./chunk-MSFYVSIA.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-AUZPUAD4.mjs.map
1
+ import{a as w}from"./chunk-YK7T6MBD.mjs";import{a as l}from"./chunk-KMJMQEXI.mjs";import{q as u}from"./chunk-RQG6ZONS.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-IDCBOZNB.mjs.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-MSFYVSIA.mjs";import{b as t}from"./chunk-SAAOQW7P.mjs";import{x as r}from"./chunk-KD2IQ32V.mjs";import i from"axios";var T=async o=>{let{apiAddress:s}=t(e()),{data:a}=await i.get(`${s}/${r}`,{params:{hashes:o.join(","),withScResults:!0}});return a};export{T as a};
2
- //# sourceMappingURL=chunk-MFMWGMLN.mjs.map
1
+ import{s as e}from"./chunk-RQG6ZONS.mjs";import{b as t}from"./chunk-SAAOQW7P.mjs";import{x as r}from"./chunk-KD2IQ32V.mjs";import i from"axios";var T=async o=>{let{apiAddress:s}=t(e()),{data:a}=await i.get(`${s}/${r}`,{params:{hashes:o.join(","),withScResults:!0}});return a};export{T as a};
2
+ //# sourceMappingURL=chunk-II663X5B.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-SUBC3H4J.mjs";import{a as t}from"./chunk-U64LDJTG.mjs";import{a as n}from"./chunk-ENGIAAJA.mjs";import{s as e}from"./chunk-MSFYVSIA.mjs";import{b as o}from"./chunk-SAAOQW7P.mjs";var w=async r=>{let{isGuarded:i}=n();if(!s({isGuarded:i,transactions:r}))return r;let a=r[0].sender.toBech32(),{walletAddress:d}=o(e());return await(await t({address:a,walletUrl:d}))?.guardTransactions(r)||[]};export{w as a};
2
- //# sourceMappingURL=chunk-FODR6WTG.mjs.map
1
+ import{a as s}from"./chunk-SUBC3H4J.mjs";import{a as t}from"./chunk-U64LDJTG.mjs";import{a as n}from"./chunk-GQAGO7KW.mjs";import{s as e}from"./chunk-RQG6ZONS.mjs";import{b as o}from"./chunk-SAAOQW7P.mjs";var w=async r=>{let{isGuarded:i}=n();if(!s({isGuarded:i,transactions:r}))return r;let a=r[0].sender.toBech32(),{walletAddress:d}=o(e());return await(await t({address:a,walletUrl:d}))?.guardTransactions(r)||[]};export{w as a};
2
+ //# sourceMappingURL=chunk-IJWIF6QG.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as o}from"./chunk-FMQYLMTU.mjs";import{b as e,c as i}from"./chunk-OQOS52S7.mjs";import{j as r}from"./chunk-65L5EBBL.mjs";import{q as n}from"./chunk-MSFYVSIA.mjs";async function E({results:u,hash:c,sessionId:s}){let a=u?.find(t=>t?.returnMessage!=="");i({sessionId:s,transaction:{...a,hash:c,status:"fail",inTransit:!1}});let{transactions:m}=n().getState();m[s].transactions.some(t=>r(t.status))||(e({sessionId:s,status:"fail",errorMessage:a?.returnMessage}),await o({sessionId:s,status:"fail"}))}export{E as a};
2
- //# sourceMappingURL=chunk-GRU4NOFI.mjs.map
1
+ import{a as o}from"./chunk-KDWLSBQB.mjs";import{b as e,c as i}from"./chunk-RMSMZKTD.mjs";import{j as r}from"./chunk-65L5EBBL.mjs";import{q as n}from"./chunk-RQG6ZONS.mjs";async function E({results:u,hash:c,sessionId:s}){let a=u?.find(t=>t?.returnMessage!=="");i({sessionId:s,transaction:{...a,hash:c,status:"fail",inTransit:!1}});let{transactions:m}=n().getState();m[s].transactions.some(t=>r(t.status))||(e({sessionId:s,status:"fail",errorMessage:a?.returnMessage}),await o({sessionId:s,status:"fail"}))}export{E as a};
2
+ //# sourceMappingURL=chunk-IT3RZ4HT.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-BYMTQKPA.mjs";import{c as e}from"./chunk-MGFIOCA4.mjs";var o=class i extends s{constructor(){super({uiDataUpdateEvent:"DATA_UPDATE_SIGN_TRANSACTIONS",uiTag:"mvx-sign-transactions-panel"});this.addressesPerPage=10;this._ppuMap={};this.initialData={commonData:{transactionsCount:0,currentIndexToSign:0,egldLabel:"",currentIndex:0,ppuOptions:[],address:"",origin:""},tokenTransaction:null,nftTransaction:null,sftTransaction:null};this.data={...this.initialData}}static getInstance(){return i.instance||(i.instance=new i),i.instance}get transactionsCount(){return this.data.commonData.transactionsCount}initializeGasPriceMap(a){let t=0;a.filter(n=>n!=null).forEach(n=>{let r=n?Number(n.gasPrice):0;this.updateGasPriceMap({nonce:Number(n.nonce),ppu:t,initialGasPrice:r})}),this.updateCommonData({ppu:t})}updateGasPriceMap({nonce:a,ppu:t,initialGasPrice:n}){this._ppuMap[a]={...this._ppuMap[a],ppu:t},n&&(this._ppuMap[a].initialGasPrice=n)}updateCommonData(a){this.data.commonData={...this.data.commonData,...a},this.notifyDataUpdate()}updateIsLoading(a){this.data.isLoading=a,this.notifyDataUpdate()}updateTokenTransaction(a){this.data.tokenTransaction=a,this.data.sftTransaction=null,this.data.nftTransaction=null,this.notifyDataUpdate()}updateNonFungibleTransaction(a,t){switch(a){case"NonFungibleESDT":this.data.nftTransaction=t,this.data.tokenTransaction=null,this.data.sftTransaction=null;break;case"SemiFungibleESDT":this.data.sftTransaction=t,this.data.nftTransaction=null,this.data.tokenTransaction=null;break;default:break}this.notifyDataUpdate()}get currentScreenIndex(){return this.data.commonData.currentIndex}get ppuMap(){return this._ppuMap}async setupEventListeners(){this.eventBus&&this.subscribeToEventBus("CLOSE_SIGN_TRANSACTIONS",this.closeUI.bind(this))}};export{o as a};
2
- //# sourceMappingURL=chunk-OD7MJ7CA.mjs.map
1
+ import{a as s}from"./chunk-PSSRDP4O.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-IXHQSJBO.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-NOAPU5US.mjs";import{a}from"./chunk-WGESEEJ2.mjs";import{a as u}from"./chunk-A7PB4MFL.mjs";import{c as n}from"./chunk-5Q2JDZD3.mjs";import{a as s}from"./chunk-ETED4JB5.mjs";var c=(o,t)=>{let r=`sdk-dapp-logout-event-${o}`,e=t.getItem(r);e&&o!==e||(t.setItem(r,o),t.removeItem(r))};async function L({provider:o,options:t={shouldBroadcastLogoutAcrossTabs:!0}}){let r=a();t.shouldBroadcastLogoutAcrossTabs&&s.localStorage&&c(r,s.localStorage);try{return u(),n.forEach(g=>g()),n.clear(),i.closeConnectionRef?.(),await o.logout()}catch(e){return console.error("Logging out error:",e),!1}}export{L as a};
2
- //# sourceMappingURL=chunk-NPF3MLTJ.mjs.map
1
+ import{a as i}from"./chunk-CCFQYROV.mjs";import{a}from"./chunk-VN62BHIP.mjs";import{a as u}from"./chunk-NQZVWZM5.mjs";import{c as n}from"./chunk-CYWOWIRB.mjs";import{a as s}from"./chunk-ENHFZ4TV.mjs";var c=(o,t)=>{let r=`sdk-dapp-logout-event-${o}`,e=t.getItem(r);e&&o!==e||(t.setItem(r,o),t.removeItem(r))};async function L({provider:o,options:t={shouldBroadcastLogoutAcrossTabs:!0}}){let r=a();t.shouldBroadcastLogoutAcrossTabs&&s.localStorage&&c(r,s.localStorage);try{return u(),n.forEach(g=>g()),n.clear(),i.closeConnectionRef?.(),await o.logout()}catch(e){return console.error("Logging out error:",e),!1}}export{L as a};
2
+ //# sourceMappingURL=chunk-K4BSSSHE.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-2VG3V3VD.mjs";async function i({sessionId:a,status:s}){let c=n(a);if(s!=null)switch(s){case"success":await c?.onSuccess?.(a);break;case"fail":case"cancelled":case"timedOut":case"invalid":await c?.onFail?.(a);break}}export{i as a};
2
+ //# sourceMappingURL=chunk-KDWLSBQB.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/methods/trackTransactions/helpers/checkTransactionStatus/runSessionCallbacks.ts"],
4
+ "sourcesContent": ["import { getCallbacks } from 'managers/TransactionManager/helpers/sessionCallbacks';\nimport { TransactionBatchStatusesEnum } from 'types/enums.types';\n\ninterface RunSessionCallbacksPropsType {\n sessionId: string;\n status?: TransactionBatchStatusesEnum | null;\n}\n\nexport async function runSessionCallbacks({\n sessionId,\n status\n}: RunSessionCallbacksPropsType) {\n const callbacks = getCallbacks(sessionId);\n\n if (status == null) {\n return;\n }\n\n switch (status) {\n case TransactionBatchStatusesEnum.success:\n await callbacks?.onSuccess?.(sessionId);\n break;\n case TransactionBatchStatusesEnum.fail:\n case TransactionBatchStatusesEnum.cancelled:\n case TransactionBatchStatusesEnum.timedOut:\n case TransactionBatchStatusesEnum.invalid:\n await callbacks?.onFail?.(sessionId);\n break;\n }\n}\n"],
5
+ "mappings": "yCAQA,eAAsBA,EAAoB,CACxC,UAAAC,EACA,OAAAC,CACF,EAAiC,CAC/B,IAAMC,EAAYC,EAAaH,CAAS,EAExC,GAAIC,GAAU,KAId,OAAQA,EAAQ,CACd,cACE,MAAMC,GAAW,YAAYF,CAAS,EACtC,MACF,WACA,gBACA,eACA,cACE,MAAME,GAAW,SAASF,CAAS,EACnC,KACJ,CACF",
6
+ "names": ["runSessionCallbacks", "sessionId", "status", "callbacks", "getCallbacks"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-V5VIOBBE.mjs";var i=e=>{let t=a();return{origin:e?.origin??t.origin,blockHashShard:e?.blockHashShard,expirySeconds:e?.expirySeconds??t.expirySeconds,apiAddress:e?.apiAddress??t.apiAddress,tokenExpirationToastWarningSeconds:e?.tokenExpirationToastWarningSeconds??t.tokenExpirationToastWarningSeconds,extraInfo:e?.extraInfo??{},gatewayUrl:e?.gatewayUrl,extraRequestHeaders:e?.extraRequestHeaders??{}}};export{i as a};
2
- //# sourceMappingURL=chunk-CQXLKX4W.mjs.map
1
+ import{a}from"./chunk-KMKXCFDQ.mjs";var i=e=>{let t=a();return{origin:e?.origin??t.origin,blockHashShard:e?.blockHashShard,expirySeconds:e?.expirySeconds??t.expirySeconds,apiAddress:e?.apiAddress??t.apiAddress,tokenExpirationToastWarningSeconds:e?.tokenExpirationToastWarningSeconds??t.tokenExpirationToastWarningSeconds,extraInfo:e?.extraInfo??{},gatewayUrl:e?.gatewayUrl,extraRequestHeaders:e?.extraRequestHeaders??{}}};export{i as a};
2
+ //# sourceMappingURL=chunk-KGKDFREW.mjs.map
@@ -1,2 +1,2 @@
1
- import{s as e}from"./chunk-MSFYVSIA.mjs";import{b as o}from"./chunk-SAAOQW7P.mjs";import{a as i}from"./chunk-CKTFPRJS.mjs";var n="https://api.multiversx.com",s=60*60*24,a=5*60,d=t=>{let r=o(e());return{origin:t?.origin||i().origin,apiAddress:t?.apiAddress||r.apiAddress||n,expirySeconds:t?.expirySeconds||s,tokenExpirationToastWarningSeconds:t?.tokenExpirationToastWarningSeconds||a}};export{d as a};
2
- //# sourceMappingURL=chunk-V5VIOBBE.mjs.map
1
+ import{s as e}from"./chunk-RQG6ZONS.mjs";import{b as o}from"./chunk-SAAOQW7P.mjs";import{a as i}from"./chunk-CKTFPRJS.mjs";var n="https://api.multiversx.com",s=60*60*24,a=5*60,d=t=>{let r=o(e());return{origin:t?.origin||i().origin,apiAddress:t?.apiAddress||r.apiAddress||n,expirySeconds:t?.expirySeconds||s,tokenExpirationToastWarningSeconds:t?.tokenExpirationToastWarningSeconds||a}};export{d as a};
2
+ //# sourceMappingURL=chunk-KMKXCFDQ.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-ENHFZ4TV.mjs";var o=()=>a.localStorage;export{o as a};
2
+ //# sourceMappingURL=chunk-KNZRUMOW.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as t}from"./chunk-C22Q5W5S.mjs";import{c as n}from"./chunk-RQG6ZONS.mjs";async function c({loginToken:r,extraInfoData:i,address:e}){let o=await t({originalLoginToken:r,extraInfoData:i,address:e});return o.modifiedLoginToken&&n(o.modifiedLoginToken),o.address}export{c as a};
2
+ //# sourceMappingURL=chunk-LDIEAM6D.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as A}from"./chunk-6QDJ2IO3.mjs";import{a as I}from"./chunk-EAJBSX6Y.mjs";import{a as b}from"./chunk-Y3BNMQFP.mjs";import{h as S}from"./chunk-5K2UH5QL.mjs";import{b as T}from"./chunk-2VG3V3VD.mjs";import{a as y}from"./chunk-RMSMZKTD.mjs";import{a as f}from"./chunk-L3MWDI6J.mjs";import{a as h}from"./chunk-GQAGO7KW.mjs";import{h as g}from"./chunk-2IUBMLF4.mjs";import{s as l}from"./chunk-RQG6ZONS.mjs";import{b as m}from"./chunk-SAAOQW7P.mjs";import w from"axios";var r=class r{constructor(){this.setCallbacks=({onSuccess:t,onFail:a})=>{T({onSuccess:t,onFail:a})};this.send=async t=>{if(t.length===0)throw new Error("No transactions to send");try{if(!I(t))return await this.sendSignedTransactions(t);let a=await this.sendSignedBatchTransactions(t);if(!a.data||a.data.error)throw new Error(a.data?.error??"Failed to send transactions");return a.data.transactions}catch(a){throw a.response?.data?.message??a.message}};this.track=async(t,a={disableToasts:!1})=>{let s=this.sequentialToFlatArray(t).map(e=>({...e,status:e.status??"pending"})),o=f(s),n=y({transactions:s,transactionsDisplayInfo:a.transactionsDisplayInfo,status:o??"sent",sessionInformation:a.sessionInformation});if(a.disableToasts===!0)return n;a.onSuccess&&T({onSuccess:a.onSuccess,sessionId:n}),a.onFail&&T({onFail:a.onFail,sessionId:n});let i=A(t);return S({toastId:n,totalDuration:i}),n};this.sendSignedTransactions=async t=>{let{apiAddress:a,apiTimeout:s}=m(l());return await Promise.all(t.map(async n=>{let i=await w.post(`${a}/transactions`,n.toPlainObject(),{timeout:Number(s)}),e=i.data.txHash;return{...n.toPlainObject(),...i.data,status:"pending",hash:e}}))};this.sendSignedBatchTransactions=async t=>{let{address:a}=h(),{apiAddress:s,apiTimeout:o}=m(l());if(!a)return{error:"Invalid address provided. You need to be logged in to send transactions"};let n=this.buildBatchId(a),e={transactions:t.map(p=>p.map(c=>c.toPlainObject())),id:n},{data:u}=await w.post(`${s}/batch`,e,{timeout:Number(o)}),B=u.transactions.map(p=>p.map(c=>{let d={...c,status:"pending",hash:c.hash};return b({data:d.data})&&(delete d.senderUsername,delete d.receiverUsername),d}));return{data:{...u,transactions:B}}};this.buildBatchId=t=>`${Date.now().toString()}${g}${t}`;this.sequentialToFlatArray=(t=[])=>this.getIsSequential(t)?t.flat():t;this.getIsSequential=t=>t?.every(a=>Array.isArray(a))}static getInstance(){return r.instance||(r.instance=new r),r.instance}};r.instance=null;var v=r;export{v as a};
2
+ //# sourceMappingURL=chunk-LKPI47RK.mjs.map