@n1xyz/wallet-widget 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -19
- package/dist/Logic/sessionManager.d.ts +53 -0
- package/dist/Logic/sessionManager.js +178 -0
- package/dist/Logic/transactionManager.d.ts +41 -0
- package/dist/Logic/transactionManager.js +192 -0
- package/dist/Modal/BackButton.js +1 -1
- package/dist/Modal/ConnectView.js +1 -1
- package/dist/Modal/CreateSessionView.js +1 -1
- package/dist/Modal/LoadingFallback.d.ts +2 -0
- package/dist/Modal/LoadingFallback.js +2 -0
- package/dist/Modal/ModalHeader.js +1 -1
- package/dist/Modal/N1WalletModal.js +88 -81
- package/dist/Modal/NTSFlow/LoadingFallback.d.ts +2 -0
- package/dist/Modal/NTSFlow/LoadingFallback.js +2 -0
- package/dist/Modal/NTSFlow/NTSFlow.d.ts +4 -0
- package/dist/Modal/NTSFlow/NTSFlow.js +30 -0
- package/dist/Modal/NTSFlow/NordFlow/WalletConnectionFlow.d.ts +9 -0
- package/dist/Modal/NTSFlow/NordFlow/WalletConnectionFlow.js +145 -0
- package/dist/Modal/NTSFlow/NordFlow/components/AnimatedButton.d.ts +14 -0
- package/dist/Modal/NTSFlow/NordFlow/components/AnimatedButton.js +75 -0
- package/dist/Modal/NTSFlow/NordFlow/components/ChainButton.d.ts +7 -0
- package/dist/Modal/NTSFlow/NordFlow/components/ChainButton.js +5 -0
- package/dist/Modal/NTSFlow/NordFlow/components/LoadingSquares.d.ts +1 -0
- package/dist/Modal/NTSFlow/NordFlow/components/LoadingSquares.js +5 -0
- package/dist/Modal/NTSFlow/NordFlow/components/TransactionTable.d.ts +13 -0
- package/dist/Modal/NTSFlow/NordFlow/components/TransactionTable.js +58 -0
- package/dist/Modal/NTSFlow/NordFlow/components/WaitingMessage.d.ts +6 -0
- package/dist/Modal/NTSFlow/NordFlow/components/WaitingMessage.js +6 -0
- package/dist/Modal/NTSFlow/NordFlow/components/index.d.ts +5 -0
- package/dist/Modal/NTSFlow/NordFlow/components/index.js +5 -0
- package/dist/Modal/NTSFlow/NordFlow/constants.d.ts +37 -0
- package/dist/Modal/NTSFlow/NordFlow/constants.js +223 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/index.d.ts +8 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/index.js +8 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useButtonTyping.d.ts +7 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useButtonTyping.js +43 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useDepositFlow.d.ts +38 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useDepositFlow.js +166 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useFlowState.d.ts +32 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useFlowState.js +163 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useInterruptHandler.d.ts +27 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useInterruptHandler.js +101 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useNordSession.d.ts +32 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useNordSession.js +193 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useTableValues.d.ts +2 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useTableValues.js +69 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useWaitingMessage.d.ts +6 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useWaitingMessage.js +89 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useWalletConnect.d.ts +30 -0
- package/dist/Modal/NTSFlow/NordFlow/hooks/useWalletConnect.js +132 -0
- package/dist/Modal/NTSFlow/NordFlow/index.d.ts +3 -0
- package/dist/Modal/NTSFlow/NordFlow/index.js +3 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/01-ConnectWalletScreen.d.ts +6 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/01-ConnectWalletScreen.js +17 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/02-EvmWalletAuthScreen.d.ts +6 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/02-EvmWalletAuthScreen.js +47 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/03-ChainSelectionScreen.d.ts +7 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/03-ChainSelectionScreen.js +7 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/04-AmountInputScreen.d.ts +8 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/04-AmountInputScreen.js +20 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/05-DepositProgressScreen.d.ts +7 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/05-DepositProgressScreen.js +6 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/06-DepositSuccessScreen.d.ts +8 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/06-DepositSuccessScreen.js +99 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/07-NordAuthScreen.d.ts +7 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/07-NordAuthScreen.js +14 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/08-AuthLoadingScreen.d.ts +6 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/08-AuthLoadingScreen.js +20 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/09-FinalSuccessScreen.d.ts +5 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/09-FinalSuccessScreen.js +18 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/10-ErrorScreen.d.ts +7 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/10-ErrorScreen.js +13 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/index.d.ts +10 -0
- package/dist/Modal/NTSFlow/NordFlow/screens/index.js +10 -0
- package/dist/Modal/NTSFlow/NordFlow/types.d.ts +105 -0
- package/dist/Modal/NTSFlow/NordFlow/types.js +34 -0
- package/dist/Modal/NTSFlow/NordFlow/utils/persistence.d.ts +24 -0
- package/dist/Modal/NTSFlow/NordFlow/utils/persistence.js +83 -0
- package/dist/Modal/NTSFlow/components/BackButton.d.ts +3 -0
- package/dist/Modal/NTSFlow/components/BackButton.js +26 -0
- package/dist/Modal/NTSFlow/components/ModalHeader.d.ts +1 -0
- package/dist/Modal/NTSFlow/components/ModalHeader.js +20 -0
- package/dist/Modal/NTSFlow/index.d.ts +1 -0
- package/dist/Modal/NTSFlow/index.js +1 -0
- package/dist/Modal/NTSFlow/views/ConnectView.d.ts +1 -0
- package/dist/Modal/NTSFlow/views/ConnectView.js +68 -0
- package/dist/Modal/NTSFlow/views/CreateSessionView.d.ts +1 -0
- package/dist/Modal/NTSFlow/views/CreateSessionView.js +245 -0
- package/dist/Modal/NTSFlow/views/CreateUserView.d.ts +1 -0
- package/dist/Modal/NTSFlow/views/CreateUserView.js +105 -0
- package/dist/Modal/NTSFlow/views/NoWhitelistView.d.ts +1 -0
- package/dist/Modal/NTSFlow/views/NoWhitelistView.js +42 -0
- package/dist/Modal/NTSFlow/views/SigningView.d.ts +1 -0
- package/dist/Modal/NTSFlow/views/SigningView.js +5 -0
- package/dist/Modal/NTSFlow/views/SuccessView.d.ts +1 -0
- package/dist/Modal/NTSFlow/views/SuccessView.js +10 -0
- package/dist/Modal/NoWhitelistView.js +1 -1
- package/dist/Modal/NordFlow/NordFlow.d.ts +9 -0
- package/dist/Modal/NordFlow/NordFlow.js +262 -0
- package/dist/Modal/NordFlow/NordFlowWrapper.d.ts +11 -0
- package/dist/Modal/NordFlow/NordFlowWrapper.js +11 -0
- package/dist/Modal/NordFlow/WalletConnectionFlow.d.ts +9 -0
- package/dist/Modal/NordFlow/WalletConnectionFlow.js +145 -0
- package/dist/Modal/NordFlow/components/AnimatedButton.d.ts +14 -0
- package/dist/Modal/NordFlow/components/AnimatedButton.js +75 -0
- package/dist/Modal/NordFlow/components/ChainButton.d.ts +8 -0
- package/dist/Modal/NordFlow/components/ChainButton.js +21 -0
- package/dist/Modal/NordFlow/components/ImageWithFallback.d.ts +17 -0
- package/dist/Modal/NordFlow/components/ImageWithFallback.js +32 -0
- package/dist/Modal/NordFlow/components/LoadingSquares.d.ts +1 -0
- package/dist/Modal/NordFlow/components/LoadingSquares.js +5 -0
- package/dist/Modal/NordFlow/components/TransactionTable.d.ts +13 -0
- package/dist/Modal/NordFlow/components/TransactionTable.js +83 -0
- package/dist/Modal/NordFlow/components/WaitingMessage.d.ts +6 -0
- package/dist/Modal/NordFlow/components/WaitingMessage.js +6 -0
- package/dist/Modal/NordFlow/components/index.d.ts +5 -0
- package/dist/Modal/NordFlow/components/index.js +5 -0
- package/dist/Modal/NordFlow/constants.d.ts +37 -0
- package/dist/Modal/NordFlow/constants.js +192 -0
- package/dist/Modal/NordFlow/hoc/index.d.ts +1 -0
- package/dist/Modal/NordFlow/hoc/index.js +1 -0
- package/dist/Modal/NordFlow/hoc/withImageFallback.d.ts +7 -0
- package/dist/Modal/NordFlow/hoc/withImageFallback.js +60 -0
- package/dist/Modal/NordFlow/hooks/index.d.ts +5 -0
- package/dist/Modal/NordFlow/hooks/index.js +5 -0
- package/dist/Modal/NordFlow/hooks/useButtonTyping.d.ts +7 -0
- package/dist/Modal/NordFlow/hooks/useButtonTyping.js +43 -0
- package/dist/Modal/NordFlow/hooks/useDepositFlow.d.ts +52 -0
- package/dist/Modal/NordFlow/hooks/useDepositFlow.js +365 -0
- package/dist/Modal/NordFlow/hooks/useFlowState.d.ts +32 -0
- package/dist/Modal/NordFlow/hooks/useFlowState.js +166 -0
- package/dist/Modal/NordFlow/hooks/useInterruptHandler.d.ts +24 -0
- package/dist/Modal/NordFlow/hooks/useInterruptHandler.js +56 -0
- package/dist/Modal/NordFlow/hooks/useNordInstance.d.ts +10 -0
- package/dist/Modal/NordFlow/hooks/useNordInstance.js +310 -0
- package/dist/Modal/NordFlow/hooks/useNordSession.d.ts +32 -0
- package/dist/Modal/NordFlow/hooks/useNordSession.js +391 -0
- package/dist/Modal/NordFlow/hooks/useNordWalletConnect.d.ts +14 -0
- package/dist/Modal/NordFlow/hooks/useNordWalletConnect.js +231 -0
- package/dist/Modal/NordFlow/hooks/useTableValues.d.ts +2 -0
- package/dist/Modal/NordFlow/hooks/useTableValues.js +69 -0
- package/dist/Modal/NordFlow/hooks/useWaitingMessage.d.ts +6 -0
- package/dist/Modal/NordFlow/hooks/useWaitingMessage.js +89 -0
- package/dist/Modal/NordFlow/hooks/useWalletConnect.d.ts +14 -0
- package/dist/Modal/NordFlow/hooks/useWalletConnect.js +221 -0
- package/dist/Modal/NordFlow/index copy.d.ts +1 -0
- package/dist/Modal/NordFlow/index copy.js +1 -0
- package/dist/Modal/NordFlow/index.d.ts +1 -0
- package/dist/Modal/NordFlow/index.js +1 -0
- package/dist/Modal/NordFlow/screens/01-ConnectWalletScreen.d.ts +6 -0
- package/dist/Modal/NordFlow/screens/01-ConnectWalletScreen.js +17 -0
- package/dist/Modal/NordFlow/screens/02-EvmWalletAuthScreen.d.ts +6 -0
- package/dist/Modal/NordFlow/screens/02-EvmWalletAuthScreen.js +47 -0
- package/dist/Modal/NordFlow/screens/03-ChainSelectionScreen.d.ts +7 -0
- package/dist/Modal/NordFlow/screens/03-ChainSelectionScreen.js +47 -0
- package/dist/Modal/NordFlow/screens/04-AmountInputScreen.d.ts +10 -0
- package/dist/Modal/NordFlow/screens/04-AmountInputScreen.js +165 -0
- package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.d.ts +6 -0
- package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.js +44 -0
- package/dist/Modal/NordFlow/screens/06-DepositSuccessScreen.d.ts +8 -0
- package/dist/Modal/NordFlow/screens/06-DepositSuccessScreen.js +119 -0
- package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.d.ts +6 -0
- package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.js +126 -0
- package/dist/Modal/NordFlow/screens/07-NordAuthScreen.d.ts +5 -0
- package/dist/Modal/NordFlow/screens/07-NordAuthScreen.js +17 -0
- package/dist/Modal/NordFlow/screens/08-AuthLoadingScreen.d.ts +6 -0
- package/dist/Modal/NordFlow/screens/08-AuthLoadingScreen.js +153 -0
- package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.d.ts +5 -0
- package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.js +36 -0
- package/dist/Modal/NordFlow/screens/09-ErrorScreen.d.ts +7 -0
- package/dist/Modal/NordFlow/screens/09-ErrorScreen.js +62 -0
- package/dist/Modal/NordFlow/screens/09-FinalSuccessScreen.d.ts +5 -0
- package/dist/Modal/NordFlow/screens/09-FinalSuccessScreen.js +47 -0
- package/dist/Modal/NordFlow/screens/10-ErrorScreen.d.ts +7 -0
- package/dist/Modal/NordFlow/screens/10-ErrorScreen.js +62 -0
- package/dist/Modal/NordFlow/screens/index.d.ts +9 -0
- package/dist/Modal/NordFlow/screens/index.js +9 -0
- package/dist/Modal/NordFlow/types.d.ts +108 -0
- package/dist/Modal/NordFlow/types.js +32 -0
- package/dist/Modal/NordFlow/utils/imageUtils.d.ts +21 -0
- package/dist/Modal/NordFlow/utils/imageUtils.js +109 -0
- package/dist/Modal/NordFlow/utils/index.d.ts +3 -0
- package/dist/Modal/NordFlow/utils/index.js +3 -0
- package/dist/Modal/NordFlow/utils/nordUtils.d.ts +40 -0
- package/dist/Modal/NordFlow/utils/nordUtils.js +61 -0
- package/dist/Modal/NordFlow/utils/persistence.d.ts +24 -0
- package/dist/Modal/NordFlow/utils/persistence.js +83 -0
- package/dist/Modal/Sidebar/N1Sidebar.js +32 -18
- package/dist/Modal/Sidebar/NordTradingView/AccountSummary/AccountSummary.d.ts +1 -0
- package/dist/Modal/Sidebar/NordTradingView/AccountSummary/AccountSummary.js +116 -0
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketOverview.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketOverview.js +86 -0
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.d.ts +6 -0
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.js +38 -0
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketStats.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketStats.js +15 -0
- package/dist/Modal/Sidebar/NordTradingView/NordTradingView.d.ts +1 -0
- package/dist/Modal/Sidebar/NordTradingView/NordTradingView.js +54 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBook.d.ts +5 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBook.js +197 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookDepthVisualizer.d.ts +10 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookDepthVisualizer.js +61 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.js +28 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.d.ts +11 -0
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.js +22 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/AmountInput.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/AmountInput.js +19 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/BuySellTabs.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/BuySellTabs.js +23 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.js +76 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.d.ts +9 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.js +103 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.js +29 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.d.ts +9 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.js +39 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.d.ts +7 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.js +7 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.d.ts +8 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.js +249 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeHistory/TradeHistory.d.ts +5 -0
- package/dist/Modal/Sidebar/NordTradingView/TradeHistory/TradeHistory.js +138 -0
- package/dist/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.d.ts +1 -0
- package/dist/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.js +108 -0
- package/dist/Modal/Sidebar/NordTradingView/UserOrders/UserOrders.d.ts +1 -0
- package/dist/Modal/Sidebar/NordTradingView/UserOrders/UserOrders.js +177 -0
- package/dist/Modal/Sidebar/NordTradingView/UserPositions/UserPositions.d.ts +1 -0
- package/dist/Modal/Sidebar/NordTradingView/UserPositions/UserPositions.js +188 -0
- package/dist/NordFlow/WalletConnectionFlow.d.ts +9 -0
- package/dist/NordFlow/WalletConnectionFlow.js +145 -0
- package/dist/NordFlow/components/AnimatedButton.d.ts +14 -0
- package/dist/NordFlow/components/AnimatedButton.js +75 -0
- package/dist/NordFlow/components/ChainButton.d.ts +7 -0
- package/dist/NordFlow/components/ChainButton.js +5 -0
- package/dist/NordFlow/components/LoadingSquares.d.ts +1 -0
- package/dist/NordFlow/components/LoadingSquares.js +5 -0
- package/dist/NordFlow/components/TransactionTable.d.ts +13 -0
- package/dist/NordFlow/components/TransactionTable.js +58 -0
- package/dist/NordFlow/components/WaitingMessage.d.ts +6 -0
- package/dist/NordFlow/components/WaitingMessage.js +6 -0
- package/dist/NordFlow/components/index.d.ts +5 -0
- package/dist/NordFlow/components/index.js +5 -0
- package/dist/NordFlow/constants.d.ts +37 -0
- package/dist/NordFlow/constants.js +223 -0
- package/dist/NordFlow/hooks/index.d.ts +8 -0
- package/dist/NordFlow/hooks/index.js +8 -0
- package/dist/NordFlow/hooks/useButtonTyping.d.ts +7 -0
- package/dist/NordFlow/hooks/useButtonTyping.js +43 -0
- package/dist/NordFlow/hooks/useDepositFlow.d.ts +38 -0
- package/dist/NordFlow/hooks/useDepositFlow.js +166 -0
- package/dist/NordFlow/hooks/useFlowState.d.ts +32 -0
- package/dist/NordFlow/hooks/useFlowState.js +163 -0
- package/dist/NordFlow/hooks/useInterruptHandler.d.ts +27 -0
- package/dist/NordFlow/hooks/useInterruptHandler.js +101 -0
- package/dist/NordFlow/hooks/useNordSession.d.ts +32 -0
- package/dist/NordFlow/hooks/useNordSession.js +193 -0
- package/dist/NordFlow/hooks/useTableValues.d.ts +2 -0
- package/dist/NordFlow/hooks/useTableValues.js +69 -0
- package/dist/NordFlow/hooks/useWaitingMessage.d.ts +6 -0
- package/dist/NordFlow/hooks/useWaitingMessage.js +89 -0
- package/dist/NordFlow/hooks/useWalletConnect.d.ts +30 -0
- package/dist/NordFlow/hooks/useWalletConnect.js +132 -0
- package/dist/NordFlow/index.d.ts +3 -0
- package/dist/NordFlow/index.js +3 -0
- package/dist/NordFlow/screens/01-ConnectWalletScreen.d.ts +6 -0
- package/dist/NordFlow/screens/01-ConnectWalletScreen.js +17 -0
- package/dist/NordFlow/screens/02-EvmWalletAuthScreen.d.ts +6 -0
- package/dist/NordFlow/screens/02-EvmWalletAuthScreen.js +47 -0
- package/dist/NordFlow/screens/03-ChainSelectionScreen.d.ts +7 -0
- package/dist/NordFlow/screens/03-ChainSelectionScreen.js +7 -0
- package/dist/NordFlow/screens/04-AmountInputScreen.d.ts +8 -0
- package/dist/NordFlow/screens/04-AmountInputScreen.js +20 -0
- package/dist/NordFlow/screens/05-DepositProgressScreen.d.ts +7 -0
- package/dist/NordFlow/screens/05-DepositProgressScreen.js +6 -0
- package/dist/NordFlow/screens/06-DepositSuccessScreen.d.ts +8 -0
- package/dist/NordFlow/screens/06-DepositSuccessScreen.js +99 -0
- package/dist/NordFlow/screens/07-NordAuthScreen.d.ts +7 -0
- package/dist/NordFlow/screens/07-NordAuthScreen.js +14 -0
- package/dist/NordFlow/screens/08-AuthLoadingScreen.d.ts +6 -0
- package/dist/NordFlow/screens/08-AuthLoadingScreen.js +20 -0
- package/dist/NordFlow/screens/09-FinalSuccessScreen.d.ts +5 -0
- package/dist/NordFlow/screens/09-FinalSuccessScreen.js +18 -0
- package/dist/NordFlow/screens/10-ErrorScreen.d.ts +7 -0
- package/dist/NordFlow/screens/10-ErrorScreen.js +13 -0
- package/dist/NordFlow/screens/index.d.ts +10 -0
- package/dist/NordFlow/screens/index.js +10 -0
- package/dist/NordFlow/types.d.ts +105 -0
- package/dist/NordFlow/types.js +34 -0
- package/dist/NordFlow/utils/persistence.d.ts +24 -0
- package/dist/NordFlow/utils/persistence.js +83 -0
- package/dist/Provider/LazyWalletProvider.js +75 -42
- package/dist/Provider/N1WalletProvider.d.ts +1 -1
- package/dist/Provider/N1WalletProvider.js +61 -43
- package/dist/Provider/types.d.ts +61 -0
- package/dist/WalletConnectionFlow/WalletConnectionFlow.d.ts +9 -0
- package/dist/WalletConnectionFlow/WalletConnectionFlow.js +145 -0
- package/dist/WalletConnectionFlow/components/AnimatedButton.d.ts +14 -0
- package/dist/WalletConnectionFlow/components/AnimatedButton.js +75 -0
- package/dist/WalletConnectionFlow/components/ChainButton.d.ts +7 -0
- package/dist/WalletConnectionFlow/components/ChainButton.js +5 -0
- package/dist/WalletConnectionFlow/components/LoadingSquares.d.ts +1 -0
- package/dist/WalletConnectionFlow/components/LoadingSquares.js +5 -0
- package/dist/WalletConnectionFlow/components/TransactionTable.d.ts +13 -0
- package/dist/WalletConnectionFlow/components/TransactionTable.js +58 -0
- package/dist/WalletConnectionFlow/components/WaitingMessage.d.ts +6 -0
- package/dist/WalletConnectionFlow/components/WaitingMessage.js +6 -0
- package/dist/WalletConnectionFlow/components/index.d.ts +5 -0
- package/dist/WalletConnectionFlow/components/index.js +5 -0
- package/dist/WalletConnectionFlow/constants.d.ts +37 -0
- package/dist/WalletConnectionFlow/constants.js +223 -0
- package/dist/WalletConnectionFlow/hooks/index.d.ts +8 -0
- package/dist/WalletConnectionFlow/hooks/index.js +8 -0
- package/dist/WalletConnectionFlow/hooks/useButtonTyping.d.ts +7 -0
- package/dist/WalletConnectionFlow/hooks/useButtonTyping.js +43 -0
- package/dist/WalletConnectionFlow/hooks/useDepositFlow.d.ts +38 -0
- package/dist/WalletConnectionFlow/hooks/useDepositFlow.js +166 -0
- package/dist/WalletConnectionFlow/hooks/useFlowState.d.ts +32 -0
- package/dist/WalletConnectionFlow/hooks/useFlowState.js +163 -0
- package/dist/WalletConnectionFlow/hooks/useInterruptHandler.d.ts +27 -0
- package/dist/WalletConnectionFlow/hooks/useInterruptHandler.js +101 -0
- package/dist/WalletConnectionFlow/hooks/useNordSession.d.ts +32 -0
- package/dist/WalletConnectionFlow/hooks/useNordSession.js +193 -0
- package/dist/WalletConnectionFlow/hooks/useTableValues.d.ts +2 -0
- package/dist/WalletConnectionFlow/hooks/useTableValues.js +69 -0
- package/dist/WalletConnectionFlow/hooks/useWaitingMessage.d.ts +6 -0
- package/dist/WalletConnectionFlow/hooks/useWaitingMessage.js +89 -0
- package/dist/WalletConnectionFlow/hooks/useWalletConnect.d.ts +30 -0
- package/dist/WalletConnectionFlow/hooks/useWalletConnect.js +132 -0
- package/dist/WalletConnectionFlow/index.d.ts +3 -0
- package/dist/WalletConnectionFlow/index.js +3 -0
- package/dist/WalletConnectionFlow/screens/01-ConnectWalletScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/01-ConnectWalletScreen.js +17 -0
- package/dist/WalletConnectionFlow/screens/02-EvmWalletAuthScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/02-EvmWalletAuthScreen.js +47 -0
- package/dist/WalletConnectionFlow/screens/03-ChainSelectionScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/03-ChainSelectionScreen.js +7 -0
- package/dist/WalletConnectionFlow/screens/04-AmountInputScreen.d.ts +8 -0
- package/dist/WalletConnectionFlow/screens/04-AmountInputScreen.js +20 -0
- package/dist/WalletConnectionFlow/screens/05-DepositProgressScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/05-DepositProgressScreen.js +6 -0
- package/dist/WalletConnectionFlow/screens/06-DepositSuccessScreen.d.ts +8 -0
- package/dist/WalletConnectionFlow/screens/06-DepositSuccessScreen.js +99 -0
- package/dist/WalletConnectionFlow/screens/07-NordAuthScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/07-NordAuthScreen.js +14 -0
- package/dist/WalletConnectionFlow/screens/08-AuthLoadingScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/08-AuthLoadingScreen.js +20 -0
- package/dist/WalletConnectionFlow/screens/09-FinalSuccessScreen.d.ts +5 -0
- package/dist/WalletConnectionFlow/screens/09-FinalSuccessScreen.js +18 -0
- package/dist/WalletConnectionFlow/screens/10-ErrorScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/10-ErrorScreen.js +13 -0
- package/dist/WalletConnectionFlow/screens/AmountInputScreen.d.ts +8 -0
- package/dist/WalletConnectionFlow/screens/AmountInputScreen.js +20 -0
- package/dist/WalletConnectionFlow/screens/AppsTableScreen.d.ts +8 -0
- package/dist/WalletConnectionFlow/screens/AppsTableScreen.js +28 -0
- package/dist/WalletConnectionFlow/screens/AuthLoadingScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/AuthLoadingScreen.js +20 -0
- package/dist/WalletConnectionFlow/screens/ChainSelectionScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/ChainSelectionScreen.js +7 -0
- package/dist/WalletConnectionFlow/screens/ConnectWalletScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/ConnectWalletScreen.js +17 -0
- package/dist/WalletConnectionFlow/screens/DepositProgressScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/DepositProgressScreen.js +6 -0
- package/dist/WalletConnectionFlow/screens/DepositSuccessScreen.d.ts +8 -0
- package/dist/WalletConnectionFlow/screens/DepositSuccessScreen.js +99 -0
- package/dist/WalletConnectionFlow/screens/ErrorScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/ErrorScreen.js +13 -0
- package/dist/WalletConnectionFlow/screens/EthToSolAuthScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/EthToSolAuthScreen.js +47 -0
- package/dist/WalletConnectionFlow/screens/EvmWalletAuthScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/EvmWalletAuthScreen.js +47 -0
- package/dist/WalletConnectionFlow/screens/FinalSuccessScreen.d.ts +5 -0
- package/dist/WalletConnectionFlow/screens/FinalSuccessScreen.js +18 -0
- package/dist/WalletConnectionFlow/screens/NordAuthScreen.d.ts +7 -0
- package/dist/WalletConnectionFlow/screens/NordAuthScreen.js +14 -0
- package/dist/WalletConnectionFlow/screens/SigningScreen.d.ts +6 -0
- package/dist/WalletConnectionFlow/screens/SigningScreen.js +6 -0
- package/dist/WalletConnectionFlow/screens/index.d.ts +10 -0
- package/dist/WalletConnectionFlow/screens/index.js +10 -0
- package/dist/WalletConnectionFlow/types.d.ts +105 -0
- package/dist/WalletConnectionFlow/types.js +34 -0
- package/dist/WalletConnectionFlow/utils/persistence.d.ts +24 -0
- package/dist/WalletConnectionFlow/utils/persistence.js +83 -0
- package/dist/components/WalletDeposit/components/TransactionTable.d.ts +9 -2
- package/dist/components/WalletDeposit/components/TransactionTable.js +55 -5
- package/dist/components/WalletDeposit/types.d.ts +5 -0
- package/dist/config/dynamic.d.ts +20 -0
- package/dist/config/dynamic.js +47 -0
- package/dist/config/solana.d.ts +25 -0
- package/dist/config/solana.js +41 -0
- package/dist/errors/types.d.ts +5 -1
- package/dist/errors/types.js +12 -0
- package/dist/hooks/useSolanaSession.d.ts +17 -0
- package/dist/hooks/useSolanaSession.js +180 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/main.css +1 -1
- package/dist/utils/solana-session.d.ts +84 -0
- package/dist/utils/solana-session.js +230 -0
- package/package.json +14 -11
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TableValues } from '../types';
|
|
2
|
+
interface TransactionTableProps {
|
|
3
|
+
tableValues: TableValues & {
|
|
4
|
+
amount?: {
|
|
5
|
+
text: string;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
typing: boolean;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function TransactionTable({ tableValues, onClose }: TransactionTableProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { shortenAddress } from '../utils/nordUtils';
|
|
3
|
+
import { getExplorerUrl } from '../../../Logic/transactionManager';
|
|
4
|
+
export function TransactionTable(_a) {
|
|
5
|
+
var tableValues = _a.tableValues, onClose = _a.onClose;
|
|
6
|
+
// Friendly labels for the keys
|
|
7
|
+
var getLabel = function (key) {
|
|
8
|
+
var labels = {
|
|
9
|
+
amount: 'Amount',
|
|
10
|
+
tx: 'Transaction ID',
|
|
11
|
+
from: 'From',
|
|
12
|
+
to: 'To',
|
|
13
|
+
network: 'Network',
|
|
14
|
+
status: 'Status'
|
|
15
|
+
};
|
|
16
|
+
return labels[key] || key;
|
|
17
|
+
};
|
|
18
|
+
// Get appropriate color for values based on key
|
|
19
|
+
var getValueStyles = function (key, value) {
|
|
20
|
+
if (key === 'status') {
|
|
21
|
+
if (value.toLowerCase().includes('success') || value.toLowerCase().includes('confirmed')) {
|
|
22
|
+
return 'text-green-500 dark:text-emerald-500 font-medium';
|
|
23
|
+
}
|
|
24
|
+
if (value.toLowerCase().includes('pending')) {
|
|
25
|
+
return 'text-amber-500 dark:text-amber-400 font-medium';
|
|
26
|
+
}
|
|
27
|
+
if (value.toLowerCase().includes('fail') || value.toLowerCase().includes('error')) {
|
|
28
|
+
return 'text-red-500 dark:text-red-400 font-medium';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (key === 'tx') {
|
|
32
|
+
return 'text-primary-600 dark:text-primary-400 text-xs font-medium hover:text-primary-700 dark:hover:text-primary-300 transition-colors duration-200';
|
|
33
|
+
}
|
|
34
|
+
if (key === 'network') {
|
|
35
|
+
return 'text-purple-600 dark:text-purple-400 font-medium';
|
|
36
|
+
}
|
|
37
|
+
if (key === 'from' || key === 'to') {
|
|
38
|
+
return 'text-gray-800 dark:text-gray-200 text-xs font-medium hover:text-primary-600 dark:hover:text-primary-400 transition-colors duration-200';
|
|
39
|
+
}
|
|
40
|
+
if (key === 'amount') {
|
|
41
|
+
return 'text-green-600 dark:text-emerald-500 font-semibold';
|
|
42
|
+
}
|
|
43
|
+
return 'text-gray-900 dark:text-gray-50 font-medium';
|
|
44
|
+
};
|
|
45
|
+
// Format display value with ellipsis for long text
|
|
46
|
+
var getDisplayValue = function (key, value) {
|
|
47
|
+
if (key === 'tx') {
|
|
48
|
+
return shortenAddress(value, 5, 4);
|
|
49
|
+
}
|
|
50
|
+
if (key === 'from' || key === 'to') {
|
|
51
|
+
return shortenAddress(value, 5, 4);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
};
|
|
55
|
+
// Get explorer URL for transaction ID or address
|
|
56
|
+
var getExplorerLink = function (key, value) {
|
|
57
|
+
var _a;
|
|
58
|
+
// Extract network from tableValues to determine which explorer to use
|
|
59
|
+
var network = ((_a = tableValues.network) === null || _a === void 0 ? void 0 : _a.text) || 'solana-mainnet';
|
|
60
|
+
if (key === 'tx') {
|
|
61
|
+
return getExplorerUrl(value, network);
|
|
62
|
+
}
|
|
63
|
+
if (key === 'from') {
|
|
64
|
+
return "https://explorer.solana.com/address/".concat(value, "?cluster=devnet");
|
|
65
|
+
}
|
|
66
|
+
return '';
|
|
67
|
+
};
|
|
68
|
+
// Order of fields to display
|
|
69
|
+
var fieldOrder = ['amount', 'status', 'network', 'from', 'to', 'tx'];
|
|
70
|
+
// Sort entries based on fieldOrder
|
|
71
|
+
var sortedEntries = Object.entries(tableValues)
|
|
72
|
+
.sort(function (_a, _b) {
|
|
73
|
+
var keyA = _a[0];
|
|
74
|
+
var keyB = _b[0];
|
|
75
|
+
var indexA = fieldOrder.indexOf(keyA);
|
|
76
|
+
var indexB = fieldOrder.indexOf(keyB);
|
|
77
|
+
return (indexA === -1 ? 999 : indexA) - (indexB === -1 ? 999 : indexB);
|
|
78
|
+
});
|
|
79
|
+
return (_jsxs("div", { className: "relative w-full h-full bg-gray-100 dark:bg-gray-950 border border-gray-200 dark:border-gray-800 p-5 rounded-sm flex flex-col justify-center", children: [onClose && (_jsx("button", { onClick: onClose, className: "absolute top-3 right-2 text-gray-500 dark:text-gray-600 hover:text-gray-500 dark:hover:text-gray-300 transition-colors duration-200 focus:outline-none", "aria-label": "Close details", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), _jsx("div", { className: "space-y-3 text-sm pt-5", children: sortedEntries.map(function (_a) {
|
|
80
|
+
var key = _a[0], value = _a[1];
|
|
81
|
+
return (_jsxs("div", { className: "flex items-center justify-between py-2 ", children: [_jsx("span", { className: "text-gray-500 dark:text-gray-400 font-medium min-w-[120px]", children: getLabel(key) }), _jsxs("div", { className: "relative transition-all duration-300 ".concat(value.visible ? 'opacity-100' : 'opacity-0', " max-w-[65%] text-right flex-1"), children: [(key === 'tx' || key === 'from') && getExplorerLink(key, value.text) ? (_jsxs("a", { href: getExplorerLink(key, value.text), target: "_blank", rel: "noopener noreferrer", className: "".concat(getValueStyles(key, value.text), " break-all inline-block group"), title: value.text, children: [_jsx("span", { className: 'underline hover:font-bold', children: getDisplayValue(key, value.text) }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-3 w-3 ml-1 inline-block opacity-50 group-hover:opacity-100 transition-opacity duration-200", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })] })) : (_jsx("span", { className: "".concat(getValueStyles(key, value.text), " break-all inline-block"), title: value.text, children: value.text })), value.typing && (_jsx("span", { className: "inline-block ml-1 w-[2px] h-[14px] bg-primary-500 dark:bg-primary-400 animate-pulse" }))] })] }, key));
|
|
82
|
+
}) })] }));
|
|
83
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingSquares } from './LoadingSquares';
|
|
3
|
+
export function WaitingMessage(_a) {
|
|
4
|
+
var message = _a.message;
|
|
5
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center py-12 space-y-6", children: [_jsx(LoadingSquares, {}), _jsxs("div", { className: "space-y-2 text-center w-[300px]", children: [_jsxs("h3", { className: "text-xl text-gray-800 dark:text-white transition-all duration-300 h-[32px] flex items-center justify-center relative font-semibold", children: [_jsx("span", { className: "opacity-0 absolute select-none", "aria-hidden": "true", children: "Waiting for transaction" }), _jsx("div", { className: "absolute min-w-[280px]", children: message.visible && message.title })] }), _jsxs("div", { className: "text-sm text-gray-600 dark:text-neutral-400 h-[20px] flex items-center justify-center relative", children: [_jsx("span", { className: "opacity-0 absolute select-none", "aria-hidden": "true", children: "Please sign the transaction in your wallet" }), _jsx("div", { className: "absolute min-w-[280px]", children: message.visible && message.subtitle })] })] })] }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { StateTransition } from './types';
|
|
2
|
+
export declare const ANIMATION_EASE = "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
3
|
+
export declare const TYPING_INTERVAL = 50;
|
|
4
|
+
export declare const ANIMATION_DURATION = 3000;
|
|
5
|
+
export declare const MIN_DEPOSIT = 10000;
|
|
6
|
+
export declare const MAX_DEPOSIT = 10000;
|
|
7
|
+
export declare const INITIAL_APPS: {
|
|
8
|
+
name: string;
|
|
9
|
+
color: string;
|
|
10
|
+
progress: number;
|
|
11
|
+
}[];
|
|
12
|
+
/**
|
|
13
|
+
* Available chains for deposit
|
|
14
|
+
*/
|
|
15
|
+
export declare const AVAILABLE_CHAINS: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
logo: string;
|
|
19
|
+
}[];
|
|
20
|
+
export declare const CHAINS: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
logo: string;
|
|
24
|
+
}[];
|
|
25
|
+
/**
|
|
26
|
+
* State machine transitions
|
|
27
|
+
* Defines all possible transitions between states and their conditions
|
|
28
|
+
*/
|
|
29
|
+
export declare const STATE_TRANSITIONS: StateTransition[];
|
|
30
|
+
/**
|
|
31
|
+
* Local storage key for persisting flow state
|
|
32
|
+
*/
|
|
33
|
+
export declare const FLOW_STATE_STORAGE_KEY = "n1_wallet_connection_flow_state";
|
|
34
|
+
/**
|
|
35
|
+
* Time in milliseconds after which a persisted state is considered stale
|
|
36
|
+
*/
|
|
37
|
+
export declare const STATE_EXPIRY_TIME: number;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { FlowState } from './types';
|
|
2
|
+
export var ANIMATION_EASE = 'cubic-bezier(0.16, 1, 0.3, 1)';
|
|
3
|
+
export var TYPING_INTERVAL = 50;
|
|
4
|
+
export var ANIMATION_DURATION = 3000;
|
|
5
|
+
export var MIN_DEPOSIT = 10000;
|
|
6
|
+
export var MAX_DEPOSIT = 10000;
|
|
7
|
+
export var INITIAL_APPS = Array.from({ length: 20 }, function (_, i) { return ({
|
|
8
|
+
name: "App".concat(i + 1),
|
|
9
|
+
color: '#ff2b1f',
|
|
10
|
+
progress: 0,
|
|
11
|
+
}); });
|
|
12
|
+
/**
|
|
13
|
+
* Available chains for deposit
|
|
14
|
+
*/
|
|
15
|
+
export var AVAILABLE_CHAINS = [
|
|
16
|
+
{
|
|
17
|
+
id: 'ethereum',
|
|
18
|
+
name: 'Ethereum',
|
|
19
|
+
logo: 'ethereum-logo.svg',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'solana',
|
|
23
|
+
name: 'Solana',
|
|
24
|
+
logo: 'solana-logo.svg',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
export var CHAINS = [
|
|
28
|
+
{
|
|
29
|
+
id: 'ethereum',
|
|
30
|
+
name: 'Ethereum',
|
|
31
|
+
logo: '/images/chains/ethereum.svg',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'polygon',
|
|
35
|
+
name: 'Polygon',
|
|
36
|
+
logo: '/images/chains/polygon.svg',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'arbitrum',
|
|
40
|
+
name: 'Arbitrum',
|
|
41
|
+
logo: '/images/chains/arbitrum.svg',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'optimism',
|
|
45
|
+
name: 'Optimism',
|
|
46
|
+
logo: '/images/chains/optimism.svg',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* State machine transitions
|
|
51
|
+
* Defines all possible transitions between states and their conditions
|
|
52
|
+
*/
|
|
53
|
+
export var STATE_TRANSITIONS = [
|
|
54
|
+
// From IDLE state
|
|
55
|
+
{
|
|
56
|
+
from: FlowState.IDLE,
|
|
57
|
+
to: FlowState.CONNECTING_WALLET,
|
|
58
|
+
condition: function (context) { return !context.walletType; }, // Only if wallet is not connected
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
from: FlowState.CONNECTING_WALLET,
|
|
62
|
+
to: FlowState.ERROR,
|
|
63
|
+
// When wallet connection fails
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
from: FlowState.CONNECTING_WALLET,
|
|
67
|
+
to: FlowState.CHAIN_SELECTION,
|
|
68
|
+
condition: function (context) {
|
|
69
|
+
return context.walletType === 'solana';
|
|
70
|
+
}, // If Solana wallet and no Nord account
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
from: FlowState.CONNECTING_WALLET,
|
|
74
|
+
to: FlowState.AUTH_LOADING,
|
|
75
|
+
condition: function (context) {
|
|
76
|
+
return context.walletType === 'solana' && context.hasNordAccount;
|
|
77
|
+
}, // If Solana wallet and no Nord account
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
from: FlowState.CONNECTING_WALLET,
|
|
81
|
+
to: FlowState.FINAL_SUCCESS,
|
|
82
|
+
condition: function (context) {
|
|
83
|
+
return context.walletType === 'solana' && context.hasNordAccount && context.hasActiveSession;
|
|
84
|
+
}, // If Solana wallet and no Nord account
|
|
85
|
+
},
|
|
86
|
+
// From ETH_TO_SOL_AUTH state
|
|
87
|
+
{
|
|
88
|
+
from: FlowState.ETH_TO_SOL_AUTH,
|
|
89
|
+
to: FlowState.CHAIN_SELECTION,
|
|
90
|
+
condition: function (context) { return !context.hasNordAccount; }, // After ETH auth, if no Nord account
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
from: FlowState.ETH_TO_SOL_AUTH,
|
|
94
|
+
to: FlowState.AUTH_LOADING,
|
|
95
|
+
condition: function (context) { return context.hasNordAccount && !context.hasActiveSession; },
|
|
96
|
+
// After ETH auth, if has Nord account but no active session
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
from: FlowState.ETH_TO_SOL_AUTH,
|
|
100
|
+
to: FlowState.FINAL_SUCCESS,
|
|
101
|
+
condition: function (context) { return context.hasNordAccount && context.hasActiveSession; },
|
|
102
|
+
// After ETH auth, if has Nord account and active session
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
from: FlowState.ETH_TO_SOL_AUTH,
|
|
106
|
+
to: FlowState.ERROR,
|
|
107
|
+
// If ETH to SOL auth fails
|
|
108
|
+
},
|
|
109
|
+
// From CHAIN_SELECTION state
|
|
110
|
+
{
|
|
111
|
+
from: FlowState.CHAIN_SELECTION,
|
|
112
|
+
to: FlowState.AMOUNT_INPUT,
|
|
113
|
+
// After chain selection
|
|
114
|
+
},
|
|
115
|
+
// From AMOUNT_INPUT state
|
|
116
|
+
{
|
|
117
|
+
from: FlowState.AMOUNT_INPUT,
|
|
118
|
+
to: FlowState.DEPOSIT_PROGRESS,
|
|
119
|
+
// After amount input
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
from: FlowState.AMOUNT_INPUT,
|
|
123
|
+
to: FlowState.CHAIN_SELECTION,
|
|
124
|
+
// If user goes back to chain selection
|
|
125
|
+
},
|
|
126
|
+
// From DEPOSIT_PROGRESS state
|
|
127
|
+
{
|
|
128
|
+
from: FlowState.DEPOSIT_PROGRESS,
|
|
129
|
+
to: FlowState.DEPOSIT_SUCCESS,
|
|
130
|
+
// When deposit is successful
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
from: FlowState.DEPOSIT_PROGRESS,
|
|
134
|
+
to: FlowState.ERROR,
|
|
135
|
+
// When deposit fails
|
|
136
|
+
},
|
|
137
|
+
// From DEPOSIT_SUCCESS state
|
|
138
|
+
{
|
|
139
|
+
from: FlowState.DEPOSIT_SUCCESS,
|
|
140
|
+
to: FlowState.AUTH_LOADING,
|
|
141
|
+
condition: function (context) { return !context.hasActiveSession; }, // If no active Nord session
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
from: FlowState.DEPOSIT_SUCCESS,
|
|
145
|
+
to: FlowState.FINAL_SUCCESS,
|
|
146
|
+
condition: function (context) { return context.hasActiveSession; }, // If active Nord session exists
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
from: FlowState.AUTH_LOADING,
|
|
150
|
+
to: FlowState.ERROR,
|
|
151
|
+
// When Nord auth fails to start
|
|
152
|
+
},
|
|
153
|
+
// From AUTH_LOADING state
|
|
154
|
+
{
|
|
155
|
+
from: FlowState.AUTH_LOADING,
|
|
156
|
+
to: FlowState.FINAL_SUCCESS,
|
|
157
|
+
// When auth is successful
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
from: FlowState.AUTH_LOADING,
|
|
161
|
+
to: FlowState.ERROR,
|
|
162
|
+
// When auth fails
|
|
163
|
+
},
|
|
164
|
+
// From ERROR state
|
|
165
|
+
{
|
|
166
|
+
from: FlowState.ERROR,
|
|
167
|
+
to: FlowState.IDLE,
|
|
168
|
+
// When restarting after error
|
|
169
|
+
},
|
|
170
|
+
// Global recovery transition (can happen from any state upon recovery)
|
|
171
|
+
{
|
|
172
|
+
from: [
|
|
173
|
+
FlowState.CONNECTING_WALLET,
|
|
174
|
+
FlowState.ETH_TO_SOL_AUTH,
|
|
175
|
+
FlowState.CHAIN_SELECTION,
|
|
176
|
+
FlowState.AMOUNT_INPUT,
|
|
177
|
+
FlowState.DEPOSIT_PROGRESS,
|
|
178
|
+
FlowState.DEPOSIT_SUCCESS,
|
|
179
|
+
FlowState.AUTH_LOADING,
|
|
180
|
+
],
|
|
181
|
+
to: FlowState.IDLE,
|
|
182
|
+
// For recovery after interruption
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
/**
|
|
186
|
+
* Local storage key for persisting flow state
|
|
187
|
+
*/
|
|
188
|
+
export var FLOW_STATE_STORAGE_KEY = 'n1_wallet_connection_flow_state';
|
|
189
|
+
/**
|
|
190
|
+
* Time in milliseconds after which a persisted state is considered stale
|
|
191
|
+
*/
|
|
192
|
+
export var STATE_EXPIRY_TIME = 30 * 60 * 1000; // 30 minutes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './withImageFallback';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './withImageFallback';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A Higher-Order Component (HOC) that adds image fallback functionality to a component
|
|
4
|
+
* @param WrappedComponent The component to wrap
|
|
5
|
+
* @returns A new component with image fallback functionality
|
|
6
|
+
*/
|
|
7
|
+
export declare function withImageFallback<P extends object>(WrappedComponent: ComponentType<P>): React.FC<P>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import { ImageWithFallback } from '../components';
|
|
26
|
+
/**
|
|
27
|
+
* A Higher-Order Component (HOC) that adds image fallback functionality to a component
|
|
28
|
+
* @param WrappedComponent The component to wrap
|
|
29
|
+
* @returns A new component with image fallback functionality
|
|
30
|
+
*/
|
|
31
|
+
export function withImageFallback(WrappedComponent) {
|
|
32
|
+
// Create a new component that wraps the original component
|
|
33
|
+
var WithImageFallback = function (props) {
|
|
34
|
+
// Function to recursively process React elements
|
|
35
|
+
var processNode = function (node) {
|
|
36
|
+
if (!React.isValidElement(node)) {
|
|
37
|
+
return node;
|
|
38
|
+
}
|
|
39
|
+
var element = node;
|
|
40
|
+
// If it's an img element, replace it with ImageWithFallback
|
|
41
|
+
if (element.type === 'img') {
|
|
42
|
+
var _a = element.props, src = _a.src, alt = _a.alt, width = _a.width, height = _a.height, className = _a.className, rest = __rest(_a, ["src", "alt", "width", "height", "className"]);
|
|
43
|
+
return (_jsx(ImageWithFallback, __assign({ src: src, alt: alt || 'Image', width: width, height: height, className: className }, rest)));
|
|
44
|
+
}
|
|
45
|
+
// If it has children, process them recursively
|
|
46
|
+
if (element.props && element.props.children) {
|
|
47
|
+
var children = React.Children.map(element.props.children, processNode);
|
|
48
|
+
return React.cloneElement(element, __assign({}, element.props), children);
|
|
49
|
+
}
|
|
50
|
+
return element;
|
|
51
|
+
};
|
|
52
|
+
// Render the wrapped component and process its output
|
|
53
|
+
var renderedComponent = _jsx(WrappedComponent, __assign({}, props));
|
|
54
|
+
return processNode(renderedComponent);
|
|
55
|
+
};
|
|
56
|
+
// Set display name for debugging
|
|
57
|
+
var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
58
|
+
WithImageFallback.displayName = "withImageFallback(".concat(wrappedComponentName, ")");
|
|
59
|
+
return WithImageFallback;
|
|
60
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { ButtonKey, ButtonStates } from '../types';
|
|
3
|
+
interface ButtonConfig {
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function useButtonTyping(buttonStates: ButtonStates, setButtonStates: Dispatch<SetStateAction<ButtonStates>>, buttonConfigs?: Record<ButtonKey, ButtonConfig>): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { useEffect } from 'react';
|
|
13
|
+
import { TYPING_INTERVAL } from '../constants';
|
|
14
|
+
var DEFAULT_BUTTON_CONFIGS = {
|
|
15
|
+
deposit: { text: 'Deposit' },
|
|
16
|
+
continue: { text: 'Continue' },
|
|
17
|
+
openApp: { text: 'Launch' },
|
|
18
|
+
};
|
|
19
|
+
export function useButtonTyping(buttonStates, setButtonStates, buttonConfigs) {
|
|
20
|
+
if (buttonConfigs === void 0) { buttonConfigs = DEFAULT_BUTTON_CONFIGS; }
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
Object.entries(buttonStates).forEach(function (_a) {
|
|
23
|
+
var key = _a[0], state = _a[1];
|
|
24
|
+
if (state.isTyping) {
|
|
25
|
+
var config_1 = buttonConfigs[key];
|
|
26
|
+
var index_1 = 0;
|
|
27
|
+
var interval_1 = setInterval(function () {
|
|
28
|
+
if (index_1 <= config_1.text.length) {
|
|
29
|
+
setButtonStates(function (prev) {
|
|
30
|
+
var _a;
|
|
31
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[key] = __assign(__assign({}, prev[key]), { text: config_1.text.slice(0, index_1) }), _a)));
|
|
32
|
+
});
|
|
33
|
+
index_1++;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
clearInterval(interval_1);
|
|
37
|
+
}
|
|
38
|
+
}, TYPING_INTERVAL);
|
|
39
|
+
return function () { return clearInterval(interval_1); };
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}, [buttonStates, setButtonStates, buttonConfigs]);
|
|
43
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FlowContext, FlowState } from '../types';
|
|
2
|
+
import { TransactionResult } from '../../../Logic/transactionManager';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for handling the deposit flow
|
|
5
|
+
*
|
|
6
|
+
* @param options Configuration options
|
|
7
|
+
* @returns Deposit flow methods and state
|
|
8
|
+
*/
|
|
9
|
+
export declare const useDepositFlow: (options: {
|
|
10
|
+
/**
|
|
11
|
+
* Flow state
|
|
12
|
+
*/
|
|
13
|
+
state: FlowState;
|
|
14
|
+
/**
|
|
15
|
+
* Flow context
|
|
16
|
+
*/
|
|
17
|
+
context: FlowContext;
|
|
18
|
+
/**
|
|
19
|
+
* Transition to a new state
|
|
20
|
+
*/
|
|
21
|
+
transition: (newState: FlowState, contextUpdates?: Partial<FlowContext>) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Handle errors
|
|
24
|
+
*/
|
|
25
|
+
handleError: (error: Error) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Update context
|
|
28
|
+
*/
|
|
29
|
+
updateContext?: (contextUpdates: Partial<FlowContext>) => void;
|
|
30
|
+
}) => {
|
|
31
|
+
selectedChain: string | null;
|
|
32
|
+
setSelectedChain: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
33
|
+
amount: string;
|
|
34
|
+
setAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
35
|
+
isDepositing: boolean;
|
|
36
|
+
transactionId: string | null;
|
|
37
|
+
transactionResult: TransactionResult | null;
|
|
38
|
+
selectChain: (chainId: string) => void;
|
|
39
|
+
updateAmount: (newAmount: string) => void;
|
|
40
|
+
startDeposit: () => Promise<void>;
|
|
41
|
+
completeDeposit: () => void;
|
|
42
|
+
goBackToChainSelection: () => void;
|
|
43
|
+
getTransactionDetails: () => {
|
|
44
|
+
amount: string;
|
|
45
|
+
tx: string;
|
|
46
|
+
from: string;
|
|
47
|
+
to: string;
|
|
48
|
+
network: string;
|
|
49
|
+
status: string;
|
|
50
|
+
explorerUrl: string;
|
|
51
|
+
};
|
|
52
|
+
};
|