@n1xyz/wallet-widget 0.0.34 → 0.0.35-alpha.1
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/dist/bridge-assist/cctp-solana.d.ts +33 -0
- package/dist/bridge-assist/cctp-solana.js +392 -0
- package/dist/bridge-assist/cctp-solana.js.map +1 -0
- package/dist/main.css +1 -2
- package/dist/src/adapters/evm.d.ts +39 -0
- package/dist/src/adapters/evm.js +338 -0
- package/dist/src/adapters/evm.js.map +1 -0
- package/dist/src/adapters/factory.d.ts +37 -0
- package/dist/src/adapters/factory.js +82 -0
- package/dist/src/adapters/factory.js.map +1 -0
- package/dist/src/adapters/index.d.ts +33 -0
- package/dist/src/adapters/index.js +36 -0
- package/dist/src/adapters/index.js.map +1 -0
- package/dist/src/adapters/solana.d.ts +37 -0
- package/dist/src/adapters/solana.js +359 -0
- package/dist/src/adapters/solana.js.map +1 -0
- package/dist/src/adapters/types.d.ts +160 -0
- package/dist/src/adapters/types.js +20 -0
- package/dist/src/adapters/types.js.map +1 -0
- package/dist/src/animations/N1Loader.js.map +1 -0
- package/dist/src/animations/N1Loader.json +1 -0
- package/dist/src/animations/Processing.js.map +1 -0
- package/dist/src/animations/Processing.json +1 -0
- package/dist/{components → src/components}/LoadingFallback.d.ts +3 -0
- package/dist/{components → src/components}/LoadingFallback.js +3 -0
- package/dist/src/components/LoadingFallback.js.map +1 -0
- package/dist/{components → src/components}/Logo.d.ts +4 -0
- package/dist/{components → src/components}/Logo.js +4 -0
- package/dist/src/components/Logo.js.map +1 -0
- package/dist/src/components/N1ConnectButton.d.ts +13 -0
- package/dist/src/components/N1ConnectButton.js +66 -0
- package/dist/src/components/N1ConnectButton.js.map +1 -0
- package/dist/src/components/logos/ArbitrumLogo.js.map +1 -0
- package/dist/src/components/logos/BaseLogo.js +6 -0
- package/dist/src/components/logos/BaseLogo.js.map +1 -0
- package/dist/src/components/logos/BeraLogo.js.map +1 -0
- package/dist/src/components/logos/BitcoinLogo.js.map +1 -0
- package/dist/src/components/logos/EthereumLogo.js.map +1 -0
- package/dist/{components → src/components}/logos/HyperliquidLogo.js +1 -1
- package/dist/src/components/logos/HyperliquidLogo.js.map +1 -0
- package/dist/src/components/logos/OptimismLogo.js.map +1 -0
- package/dist/src/components/logos/SolanaLogo.js.map +1 -0
- package/dist/src/components/logos/ZeroOneLogo.js.map +1 -0
- package/dist/src/components/logos/index.js.map +1 -0
- package/dist/src/config/chains.d.ts +18 -0
- package/dist/src/config/chains.js +58 -0
- package/dist/src/config/chains.js.map +1 -0
- package/dist/src/config/dynamic.js +18 -0
- package/dist/src/config/dynamic.js.map +1 -0
- package/dist/src/config/solana.js.map +1 -0
- package/dist/src/config/turnkey.d.ts +2 -0
- package/dist/{config → src/config}/turnkey.js +9 -12
- package/dist/src/config/turnkey.js.map +1 -0
- package/dist/src/context/n1-wallet-context.js.map +1 -0
- package/dist/src/errors/types.d.ts +72 -0
- package/dist/src/errors/types.js +140 -0
- package/dist/src/errors/types.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/N1WalletModal.js +44 -29
- package/dist/src/features/onboarding-flow/N1WalletModal.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/OnboardingFlow.d.ts +2 -1
- package/dist/{features → src/features}/onboarding-flow/OnboardingFlow.js +54 -8
- package/dist/src/features/onboarding-flow/OnboardingFlow.js.map +1 -0
- package/dist/src/features/onboarding-flow/bridge-assist/client.d.ts +42 -0
- package/dist/src/features/onboarding-flow/bridge-assist/client.js +268 -0
- package/dist/src/features/onboarding-flow/bridge-assist/client.js.map +1 -0
- package/dist/src/features/onboarding-flow/bridge-assist/config.d.ts +4 -0
- package/dist/src/features/onboarding-flow/bridge-assist/config.js +11 -0
- package/dist/src/features/onboarding-flow/bridge-assist/config.js.map +1 -0
- package/dist/src/features/onboarding-flow/bridge-assist/index.d.ts +1 -0
- package/dist/src/features/onboarding-flow/bridge-assist/index.js +2 -0
- package/dist/src/features/onboarding-flow/bridge-assist/index.js.map +1 -0
- package/dist/src/features/onboarding-flow/bridge-assist/types.d.ts +5 -0
- package/dist/src/features/onboarding-flow/bridge-assist/types.js +28 -0
- package/dist/src/features/onboarding-flow/bridge-assist/types.js.map +1 -0
- package/dist/src/features/onboarding-flow/cctp/bridgeKitClient.d.ts +35 -0
- package/dist/src/features/onboarding-flow/cctp/bridgeKitClient.js +391 -0
- package/dist/src/features/onboarding-flow/cctp/bridgeKitClient.js.map +1 -0
- package/dist/src/features/onboarding-flow/cctp/clientFactory.d.ts +6 -0
- package/dist/src/features/onboarding-flow/cctp/clientFactory.js +9 -0
- package/dist/src/features/onboarding-flow/cctp/clientFactory.js.map +1 -0
- package/dist/src/features/onboarding-flow/cctp/config.d.ts +16 -0
- package/dist/src/features/onboarding-flow/cctp/config.js +55 -0
- package/dist/src/features/onboarding-flow/cctp/config.js.map +1 -0
- package/dist/src/features/onboarding-flow/cctp/mockCctpClient.d.ts +11 -0
- package/dist/src/features/onboarding-flow/cctp/mockCctpClient.js +85 -0
- package/dist/src/features/onboarding-flow/cctp/mockCctpClient.js.map +1 -0
- package/dist/src/features/onboarding-flow/cctp/solanaClaim.d.ts +1 -0
- package/dist/src/features/onboarding-flow/cctp/solanaClaim.js +2 -0
- package/dist/src/features/onboarding-flow/cctp/solanaClaim.js.map +1 -0
- package/dist/src/features/onboarding-flow/cctp/types.d.ts +50 -0
- package/dist/src/features/onboarding-flow/cctp/types.js +2 -0
- package/dist/src/features/onboarding-flow/cctp/types.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/components/ChainButton.d.ts +5 -2
- package/dist/src/features/onboarding-flow/components/ChainButton.js +14 -0
- package/dist/src/features/onboarding-flow/components/ChainButton.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/components/Header.d.ts +2 -2
- package/dist/src/features/onboarding-flow/components/Header.js +69 -0
- package/dist/src/features/onboarding-flow/components/Header.js.map +1 -0
- package/dist/src/features/onboarding-flow/components/ImageWithFallback.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/components/TransactionTable.d.ts +5 -0
- package/dist/{features → src/features}/onboarding-flow/components/TransactionTable.js +8 -3
- package/dist/src/features/onboarding-flow/components/TransactionTable.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/components/WaitingMessage.d.ts +4 -0
- package/dist/src/features/onboarding-flow/components/WaitingMessage.js.map +1 -0
- package/dist/src/features/onboarding-flow/components/index.js.map +1 -0
- package/dist/src/features/onboarding-flow/errors/depositError.d.ts +36 -0
- package/dist/src/features/onboarding-flow/errors/depositError.js +134 -0
- package/dist/src/features/onboarding-flow/errors/depositError.js.map +1 -0
- package/dist/src/features/onboarding-flow/hooks/useBridgeDeposit.d.ts +35 -0
- package/dist/src/features/onboarding-flow/hooks/useBridgeDeposit.js +585 -0
- package/dist/src/features/onboarding-flow/hooks/useBridgeDeposit.js.map +1 -0
- package/dist/src/features/onboarding-flow/hooks/useDepositAuth.d.ts +6 -0
- package/dist/src/features/onboarding-flow/hooks/useDepositAuth.js +141 -0
- package/dist/src/features/onboarding-flow/hooks/useDepositAuth.js.map +1 -0
- package/dist/src/features/onboarding-flow/hooks/useDepositHydration.d.ts +15 -0
- package/dist/src/features/onboarding-flow/hooks/useDepositHydration.js +83 -0
- package/dist/src/features/onboarding-flow/hooks/useDepositHydration.js.map +1 -0
- package/dist/src/features/onboarding-flow/hooks/usePendingDepositState.d.ts +6 -0
- package/dist/src/features/onboarding-flow/hooks/usePendingDepositState.js +45 -0
- package/dist/src/features/onboarding-flow/hooks/usePendingDepositState.js.map +1 -0
- package/dist/src/features/onboarding-flow/hooks/useSolanaDeposit.d.ts +13 -0
- package/dist/src/features/onboarding-flow/hooks/useSolanaDeposit.js +161 -0
- package/dist/src/features/onboarding-flow/hooks/useSolanaDeposit.js.map +1 -0
- package/dist/src/features/onboarding-flow/index.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/providers/DepositFlowProvider.d.ts +10 -3
- package/dist/src/features/onboarding-flow/providers/DepositFlowProvider.js +762 -0
- package/dist/src/features/onboarding-flow/providers/DepositFlowProvider.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/providers/OnboardingStateProvider.d.ts +5 -0
- package/dist/src/features/onboarding-flow/providers/OnboardingStateProvider.js +399 -0
- package/dist/src/features/onboarding-flow/providers/OnboardingStateProvider.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/providers/StateProvider.d.ts +2 -2
- package/dist/{features → src/features}/onboarding-flow/providers/StateProvider.js +2 -2
- package/dist/src/features/onboarding-flow/providers/StateProvider.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/providers/WalletConnectionProvider.d.ts +8 -0
- package/dist/src/features/onboarding-flow/providers/WalletConnectionProvider.js +938 -0
- package/dist/src/features/onboarding-flow/providers/WalletConnectionProvider.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/providers/debug.js +5 -1
- package/dist/src/features/onboarding-flow/providers/debug.js.map +1 -0
- package/dist/src/features/onboarding-flow/providers/index.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/providers/onboardingStateMachine.d.ts +28 -1
- package/dist/{features → src/features}/onboarding-flow/providers/onboardingStateMachine.js +38 -4
- package/dist/src/features/onboarding-flow/providers/onboardingStateMachine.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/00-EntrySelectionScreen.d.ts +4 -0
- package/dist/src/features/onboarding-flow/screens/00-EntrySelectionScreen.js +32 -0
- package/dist/src/features/onboarding-flow/screens/00-EntrySelectionScreen.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/01-ConnectWalletScreen.d.ts +5 -0
- package/dist/{features → src/features}/onboarding-flow/screens/01-ConnectWalletScreen.js +5 -0
- package/dist/src/features/onboarding-flow/screens/01-ConnectWalletScreen.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/screens/02-TurnkeyAuthScreen.js +8 -1
- package/dist/src/features/onboarding-flow/screens/02-TurnkeyAuthScreen.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/screens/03-TurnkeyPreparingScreen.js +8 -1
- package/dist/src/features/onboarding-flow/screens/03-TurnkeyPreparingScreen.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/screens/04-ChainSelectionScreen.d.ts +11 -11
- package/dist/{features → src/features}/onboarding-flow/screens/04-ChainSelectionScreen.js +59 -29
- package/dist/src/features/onboarding-flow/screens/04-ChainSelectionScreen.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/05-AmountInputScreen.d.ts +11 -0
- package/dist/src/features/onboarding-flow/screens/05-AmountInputScreen.js +585 -0
- package/dist/src/features/onboarding-flow/screens/05-AmountInputScreen.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/screens/06-DepositProgressScreen.d.ts +5 -0
- package/dist/src/features/onboarding-flow/screens/06-DepositProgressScreen.js +367 -0
- package/dist/src/features/onboarding-flow/screens/06-DepositProgressScreen.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/07-DepositSuccessScreen.d.ts +6 -0
- package/dist/{features → src/features}/onboarding-flow/screens/07-DepositSuccessScreen.js +11 -5
- package/dist/src/features/onboarding-flow/screens/07-DepositSuccessScreen.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/08-AuthLoadingScreen.d.ts +5 -0
- package/dist/{features → src/features}/onboarding-flow/screens/08-AuthLoadingScreen.js +5 -1
- package/dist/src/features/onboarding-flow/screens/08-AuthLoadingScreen.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/09-ErrorScreen.d.ts +5 -0
- package/dist/src/features/onboarding-flow/screens/09-ErrorScreen.js +43 -0
- package/dist/src/features/onboarding-flow/screens/09-ErrorScreen.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/index.d.ts +10 -0
- package/dist/src/features/onboarding-flow/screens/index.js +11 -0
- package/dist/src/features/onboarding-flow/screens/index.js.map +1 -0
- package/dist/src/features/onboarding-flow/turnkey/turnkeySessionMachine.d.ts +1 -0
- package/dist/src/features/onboarding-flow/turnkey/turnkeySessionMachine.js +2 -0
- package/dist/src/features/onboarding-flow/turnkey/turnkeySessionMachine.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/types.d.ts +38 -11
- package/dist/{features → src/features}/onboarding-flow/types.js +5 -0
- package/dist/src/features/onboarding-flow/types.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/bridgeUtils.d.ts +6 -0
- package/dist/src/features/onboarding-flow/utils/bridgeUtils.js +34 -0
- package/dist/src/features/onboarding-flow/utils/bridgeUtils.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/attestationUtils.d.ts +29 -0
- package/dist/src/features/onboarding-flow/utils/deposit/attestationUtils.js +82 -0
- package/dist/src/features/onboarding-flow/utils/deposit/attestationUtils.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/bridgeUtils.d.ts +5 -0
- package/dist/src/features/onboarding-flow/utils/deposit/bridgeUtils.js +10 -0
- package/dist/src/features/onboarding-flow/utils/deposit/bridgeUtils.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/claimConfirmation.d.ts +14 -0
- package/dist/src/features/onboarding-flow/utils/deposit/claimConfirmation.js +94 -0
- package/dist/src/features/onboarding-flow/utils/deposit/claimConfirmation.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/claimSubmission.d.ts +25 -0
- package/dist/src/features/onboarding-flow/utils/deposit/claimSubmission.js +212 -0
- package/dist/src/features/onboarding-flow/utils/deposit/claimSubmission.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/depositPolling.d.ts +37 -0
- package/dist/src/features/onboarding-flow/utils/deposit/depositPolling.js +199 -0
- package/dist/src/features/onboarding-flow/utils/deposit/depositPolling.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/evmTxInterceptor.d.ts +27 -0
- package/dist/src/features/onboarding-flow/utils/deposit/evmTxInterceptor.js +149 -0
- package/dist/src/features/onboarding-flow/utils/deposit/evmTxInterceptor.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/nonceUtils.d.ts +5 -0
- package/dist/src/features/onboarding-flow/utils/deposit/nonceUtils.js +121 -0
- package/dist/src/features/onboarding-flow/utils/deposit/nonceUtils.js.map +1 -0
- package/dist/{features/onboarding-flow/utils/transaction.d.ts → src/features/onboarding-flow/utils/deposit/solanaDepositTransaction.d.ts} +3 -3
- package/dist/src/features/onboarding-flow/utils/deposit/solanaDepositTransaction.js +8 -0
- package/dist/src/features/onboarding-flow/utils/deposit/solanaDepositTransaction.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/solanaUtils.d.ts +12 -0
- package/dist/src/features/onboarding-flow/utils/deposit/solanaUtils.js +150 -0
- package/dist/src/features/onboarding-flow/utils/deposit/solanaUtils.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/storage.d.ts +52 -0
- package/dist/src/features/onboarding-flow/utils/deposit/storage.js +243 -0
- package/dist/src/features/onboarding-flow/utils/deposit/storage.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/deposit/walletUtils.d.ts +36 -0
- package/dist/src/features/onboarding-flow/utils/deposit/walletUtils.js +304 -0
- package/dist/src/features/onboarding-flow/utils/deposit/walletUtils.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/depositPolling.d.ts +1 -0
- package/dist/src/features/onboarding-flow/utils/depositPolling.js +3 -0
- package/dist/src/features/onboarding-flow/utils/depositPolling.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/explorerUrl.d.ts +14 -0
- package/dist/src/features/onboarding-flow/utils/explorerUrl.js +44 -0
- package/dist/src/features/onboarding-flow/utils/explorerUrl.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/nordUtils.d.ts +8 -0
- package/dist/{features/onboarding-flow/utils/nordUser.js → src/features/onboarding-flow/utils/nordUtils.js} +14 -1
- package/dist/src/features/onboarding-flow/utils/nordUtils.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/pendingDepositCookie.d.ts +13 -0
- package/dist/src/features/onboarding-flow/utils/pendingDepositCookie.js +15 -0
- package/dist/src/features/onboarding-flow/utils/pendingDepositCookie.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/pendingDepositStorage.d.ts +15 -0
- package/dist/src/features/onboarding-flow/utils/pendingDepositStorage.js +94 -0
- package/dist/src/features/onboarding-flow/utils/pendingDepositStorage.js.map +1 -0
- package/dist/{features → src/features}/onboarding-flow/utils/utils.d.ts +9 -2
- package/dist/{features → src/features}/onboarding-flow/utils/utils.js +9 -4
- package/dist/src/features/onboarding-flow/utils/utils.js.map +1 -0
- package/dist/src/features/onboarding-flow/utils/withImageFallback.d.ts +6 -0
- package/dist/{features → src/features}/onboarding-flow/utils/withImageFallback.js +2 -3
- package/dist/src/features/onboarding-flow/utils/withImageFallback.js.map +1 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/useN1Wallet.d.ts +12 -0
- package/dist/{hooks → src/hooks}/useN1Wallet.js +10 -0
- package/dist/src/hooks/useN1Wallet.js.map +1 -0
- package/dist/src/hooks/useNordUserInitialization.d.ts +12 -0
- package/dist/{hooks → src/hooks}/useNordUserInitialization.js +74 -33
- package/dist/src/hooks/useNordUserInitialization.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +16 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/providers/LazyWalletProvider.d.ts +4 -0
- package/dist/src/providers/LazyWalletProvider.js +404 -0
- package/dist/src/providers/LazyWalletProvider.js.map +1 -0
- package/dist/src/providers/N1WalletProvider/ContextBridge.d.ts +28 -0
- package/dist/src/providers/N1WalletProvider/ContextBridge.js +273 -0
- package/dist/src/providers/N1WalletProvider/ContextBridge.js.map +1 -0
- package/dist/src/providers/N1WalletProvider/ModalProvider.d.ts +113 -0
- package/dist/src/providers/N1WalletProvider/ModalProvider.js +319 -0
- package/dist/src/providers/N1WalletProvider/ModalProvider.js.map +1 -0
- package/dist/src/providers/N1WalletProvider/NetworkProvider.d.ts +88 -0
- package/dist/src/providers/N1WalletProvider/NetworkProvider.js +252 -0
- package/dist/src/providers/N1WalletProvider/NetworkProvider.js.map +1 -0
- package/dist/src/providers/N1WalletProvider/SessionProvider.d.ts +71 -0
- package/dist/src/providers/N1WalletProvider/SessionProvider.js +187 -0
- package/dist/src/providers/N1WalletProvider/SessionProvider.js.map +1 -0
- package/dist/src/providers/N1WalletProvider/SigningProvider.d.ts +58 -0
- package/dist/src/providers/N1WalletProvider/SigningProvider.js +134 -0
- package/dist/src/providers/N1WalletProvider/SigningProvider.js.map +1 -0
- package/dist/src/providers/N1WalletProvider/ThemingProvider.d.ts +50 -0
- package/dist/src/providers/N1WalletProvider/ThemingProvider.js +102 -0
- package/dist/src/providers/N1WalletProvider/ThemingProvider.js.map +1 -0
- package/dist/src/providers/N1WalletProvider/index.d.ts +21 -0
- package/dist/src/providers/N1WalletProvider/index.js +27 -0
- package/dist/src/providers/N1WalletProvider/index.js.map +1 -0
- package/dist/src/providers/N1WalletProvider.d.ts +17 -0
- package/dist/src/providers/N1WalletProvider.js +102 -0
- package/dist/src/providers/N1WalletProvider.js.map +1 -0
- package/dist/{providers → src/providers}/ShadowRootWrapper.d.ts +4 -0
- package/dist/{providers → src/providers}/ShadowRootWrapper.js +4 -0
- package/dist/src/providers/ShadowRootWrapper.js.map +1 -0
- package/dist/{providers → src/providers}/WalletErrorBoundary.d.ts +7 -2
- package/dist/{providers → src/providers}/WalletErrorBoundary.js +5 -1
- package/dist/src/providers/WalletErrorBoundary.js.map +1 -0
- package/dist/src/services/bootstrap/DepositRecoveryService.d.ts +64 -0
- package/dist/src/services/bootstrap/DepositRecoveryService.js +245 -0
- package/dist/src/services/bootstrap/DepositRecoveryService.js.map +1 -0
- package/dist/src/services/bootstrap/DynamicSdkService.d.ts +62 -0
- package/dist/src/services/bootstrap/DynamicSdkService.js +335 -0
- package/dist/src/services/bootstrap/DynamicSdkService.js.map +1 -0
- package/dist/src/services/bootstrap/SessionBootstrapService.d.ts +78 -0
- package/dist/src/services/bootstrap/SessionBootstrapService.js +280 -0
- package/dist/src/services/bootstrap/SessionBootstrapService.js.map +1 -0
- package/dist/src/services/bootstrap/TurnkeyBootstrapService.d.ts +92 -0
- package/dist/src/services/bootstrap/TurnkeyBootstrapService.js +253 -0
- package/dist/src/services/bootstrap/TurnkeyBootstrapService.js.map +1 -0
- package/dist/src/services/bootstrap/index.d.ts +13 -0
- package/dist/src/services/bootstrap/index.js +16 -0
- package/dist/src/services/bootstrap/index.js.map +1 -0
- package/dist/src/services/bootstrap/types.d.ts +92 -0
- package/dist/src/services/bootstrap/types.js +7 -0
- package/dist/src/services/bootstrap/types.js.map +1 -0
- package/dist/src/services/storage/StorageService.d.ts +98 -0
- package/dist/src/services/storage/StorageService.js +360 -0
- package/dist/src/services/storage/StorageService.js.map +1 -0
- package/dist/src/services/storage/index.d.ts +9 -0
- package/dist/src/services/storage/index.js +10 -0
- package/dist/src/services/storage/index.js.map +1 -0
- package/dist/src/services/storage/keys.d.ts +28 -0
- package/dist/src/services/storage/keys.js +45 -0
- package/dist/src/services/storage/keys.js.map +1 -0
- package/dist/src/services/storage/types.d.ts +73 -0
- package/dist/src/services/storage/types.js +23 -0
- package/dist/src/services/storage/types.js.map +1 -0
- package/dist/src/store/index.d.ts +8 -0
- package/dist/src/store/index.js +24 -0
- package/dist/src/store/index.js.map +1 -0
- package/dist/src/store/selectors.d.ts +105 -0
- package/dist/src/store/selectors.js +183 -0
- package/dist/src/store/selectors.js.map +1 -0
- package/dist/src/store/slices/bootstrapSlice.d.ts +64 -0
- package/dist/src/store/slices/bootstrapSlice.js +78 -0
- package/dist/src/store/slices/bootstrapSlice.js.map +1 -0
- package/dist/src/store/slices/configSlice.d.ts +7 -0
- package/dist/src/store/slices/configSlice.js +14 -0
- package/dist/src/store/slices/configSlice.js.map +1 -0
- package/dist/src/store/slices/index.d.ts +10 -0
- package/dist/src/store/slices/index.js +10 -0
- package/dist/src/store/slices/index.js.map +1 -0
- package/dist/src/store/slices/sessionSlice.d.ts +7 -0
- package/dist/src/store/slices/sessionSlice.js +17 -0
- package/dist/src/store/slices/sessionSlice.js.map +1 -0
- package/dist/src/store/slices/signingSlice.d.ts +7 -0
- package/dist/src/store/slices/signingSlice.js +14 -0
- package/dist/src/store/slices/signingSlice.js.map +1 -0
- package/dist/src/store/slices/uiSlice.d.ts +9 -0
- package/dist/src/store/slices/uiSlice.js +25 -0
- package/dist/src/store/slices/uiSlice.js.map +1 -0
- package/dist/src/store/slices/walletSlice.d.ts +7 -0
- package/dist/src/store/slices/walletSlice.js +21 -0
- package/dist/src/store/slices/walletSlice.js.map +1 -0
- package/dist/src/store/store.d.ts +50 -0
- package/dist/src/store/store.js +259 -0
- package/dist/src/store/store.js.map +1 -0
- package/dist/src/store/subscriptions/depositPersistence.d.ts +32 -0
- package/dist/src/store/subscriptions/depositPersistence.js +106 -0
- package/dist/src/store/subscriptions/depositPersistence.js.map +1 -0
- package/dist/src/store/subscriptions/index.d.ts +34 -0
- package/dist/src/store/subscriptions/index.js +73 -0
- package/dist/src/store/subscriptions/index.js.map +1 -0
- package/dist/src/store/subscriptions/turnkeyPersistence.d.ts +42 -0
- package/dist/src/store/subscriptions/turnkeyPersistence.js +127 -0
- package/dist/src/store/subscriptions/turnkeyPersistence.js.map +1 -0
- package/dist/src/store/types.d.ts +166 -0
- package/dist/src/store/types.js +7 -0
- package/dist/src/store/types.js.map +1 -0
- package/dist/src/styles/cdn-fonts.d.ts +12 -0
- package/dist/src/styles/cdn-fonts.js +63 -0
- package/dist/src/styles/cdn-fonts.js.map +1 -0
- package/dist/src/styles/embedded-main-css.d.ts +2 -0
- package/dist/src/styles/embedded-main-css.js +3 -0
- package/dist/src/styles/embedded-main-css.js.map +1 -0
- package/dist/src/turnkey/TurnkeyProvider.d.ts +21 -0
- package/dist/src/turnkey/TurnkeyProvider.js +695 -0
- package/dist/src/turnkey/TurnkeyProvider.js.map +1 -0
- package/dist/src/turnkey/createTurnkeyWallet.d.ts +39 -0
- package/dist/src/turnkey/createTurnkeyWallet.js +319 -0
- package/dist/src/turnkey/createTurnkeyWallet.js.map +1 -0
- package/dist/src/turnkey/createWalletProvider.d.ts +8 -0
- package/dist/src/turnkey/createWalletProvider.js +286 -0
- package/dist/src/turnkey/createWalletProvider.js.map +1 -0
- package/dist/src/turnkey/index.d.ts +3 -0
- package/dist/src/turnkey/index.js +3 -0
- package/dist/src/turnkey/index.js.map +1 -0
- package/dist/src/turnkey/turnkeySessionMachine.d.ts +39 -0
- package/dist/src/turnkey/turnkeySessionMachine.js +77 -0
- package/dist/src/turnkey/turnkeySessionMachine.js.map +1 -0
- package/dist/src/turnkey/turnkeySessionStorage.d.ts +48 -0
- package/dist/src/turnkey/turnkeySessionStorage.js +183 -0
- package/dist/src/turnkey/turnkeySessionStorage.js.map +1 -0
- package/dist/{turnkey → src/turnkey}/types.d.ts +21 -8
- package/dist/src/turnkey/types.js +12 -0
- package/dist/src/turnkey/types.js.map +1 -0
- package/dist/{types → src/types}/wallet.d.ts +39 -13
- package/dist/src/types/wallet.js.map +1 -0
- package/dist/src/utils/address.d.ts +130 -0
- package/dist/src/utils/address.js +274 -0
- package/dist/src/utils/address.js.map +1 -0
- package/dist/src/utils/chain.d.ts +89 -0
- package/dist/src/utils/chain.js +282 -0
- package/dist/src/utils/chain.js.map +1 -0
- package/dist/{utils → src/utils}/ed25519.d.ts +0 -2
- package/dist/{utils → src/utils}/ed25519.js +4 -19
- package/dist/src/utils/ed25519.js.map +1 -0
- package/dist/src/utils/errors.d.ts +68 -0
- package/dist/src/utils/errors.js +190 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/events.d.ts +124 -0
- package/dist/src/utils/events.js +155 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/formatAmount.d.ts +4 -0
- package/dist/src/utils/formatAmount.js +9 -0
- package/dist/src/utils/formatAmount.js.map +1 -0
- package/dist/src/utils/logger.d.ts +45 -0
- package/dist/{utils → src/utils}/logger.js +68 -2
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/shortenString.d.ts +5 -0
- package/dist/src/utils/shortenString.js +16 -0
- package/dist/src/utils/shortenString.js.map +1 -0
- package/package.json +37 -15
- package/dist/animations/N1Loader.js.map +0 -1
- package/dist/animations/Processing.js.map +0 -1
- package/dist/components/LoadingFallback.js.map +0 -1
- package/dist/components/Logo.js.map +0 -1
- package/dist/components/N1ConnectButton.d.ts +0 -5
- package/dist/components/N1ConnectButton.js +0 -49
- package/dist/components/N1ConnectButton.js.map +0 -1
- package/dist/components/logos/ArbitrumLogo.js.map +0 -1
- package/dist/components/logos/BaseLogo.js +0 -6
- package/dist/components/logos/BaseLogo.js.map +0 -1
- package/dist/components/logos/BeraLogo.js.map +0 -1
- package/dist/components/logos/BitcoinLogo.js.map +0 -1
- package/dist/components/logos/EthereumLogo.js.map +0 -1
- package/dist/components/logos/HyperliquidLogo.js.map +0 -1
- package/dist/components/logos/OptimismLogo.js.map +0 -1
- package/dist/components/logos/SolanaLogo.js.map +0 -1
- package/dist/components/logos/ZeroOneLogo.js.map +0 -1
- package/dist/components/logos/index.js.map +0 -1
- package/dist/config/chains.d.ts +0 -0
- package/dist/config/chains.js +0 -2
- package/dist/config/chains.js.map +0 -1
- package/dist/config/dynamic.js +0 -13
- package/dist/config/dynamic.js.map +0 -1
- package/dist/config/solana.js.map +0 -1
- package/dist/config/turnkey.d.ts +0 -2
- package/dist/config/turnkey.js.map +0 -1
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -3
- package/dist/config.js.map +0 -1
- package/dist/context/n1-wallet-context.js.map +0 -1
- package/dist/errors/types.d.ts +0 -25
- package/dist/errors/types.js +0 -77
- package/dist/errors/types.js.map +0 -1
- package/dist/features/onboarding-flow/N1WalletModal.js.map +0 -1
- package/dist/features/onboarding-flow/OnboardingFlow.js.map +0 -1
- package/dist/features/onboarding-flow/components/ChainButton.js +0 -21
- package/dist/features/onboarding-flow/components/ChainButton.js.map +0 -1
- package/dist/features/onboarding-flow/components/Header.js +0 -45
- package/dist/features/onboarding-flow/components/Header.js.map +0 -1
- package/dist/features/onboarding-flow/components/ImageWithFallback.js.map +0 -1
- package/dist/features/onboarding-flow/components/TransactionTable.js.map +0 -1
- package/dist/features/onboarding-flow/components/WaitingMessage.js.map +0 -1
- package/dist/features/onboarding-flow/components/index.js.map +0 -1
- package/dist/features/onboarding-flow/index.js.map +0 -1
- package/dist/features/onboarding-flow/providers/DepositFlowProvider.js +0 -525
- package/dist/features/onboarding-flow/providers/DepositFlowProvider.js.map +0 -1
- package/dist/features/onboarding-flow/providers/OnboardingStateProvider.js +0 -185
- package/dist/features/onboarding-flow/providers/OnboardingStateProvider.js.map +0 -1
- package/dist/features/onboarding-flow/providers/StateProvider.js.map +0 -1
- package/dist/features/onboarding-flow/providers/WalletConnectionProvider.js +0 -394
- package/dist/features/onboarding-flow/providers/WalletConnectionProvider.js.map +0 -1
- package/dist/features/onboarding-flow/providers/debug.js.map +0 -1
- package/dist/features/onboarding-flow/providers/index.js.map +0 -1
- package/dist/features/onboarding-flow/providers/onboardingStateMachine.js.map +0 -1
- package/dist/features/onboarding-flow/screens/01-ConnectWalletScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/01-ConnectWalletScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/02-ChainSelectionScreen.d.ts +0 -31
- package/dist/features/onboarding-flow/screens/02-ChainSelectionScreen.js +0 -100
- package/dist/features/onboarding-flow/screens/02-ChainSelectionScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/02-TurnkeyAuthScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/03-AmountInputScreen.d.ts +0 -6
- package/dist/features/onboarding-flow/screens/03-AmountInputScreen.js +0 -360
- package/dist/features/onboarding-flow/screens/03-AmountInputScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/03-TurnkeyPreparingScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/04-ChainSelectionScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/04-DepositProgressScreen.d.ts +0 -3
- package/dist/features/onboarding-flow/screens/04-DepositProgressScreen.js +0 -31
- package/dist/features/onboarding-flow/screens/04-DepositProgressScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/05-AmountInputScreen.d.ts +0 -6
- package/dist/features/onboarding-flow/screens/05-AmountInputScreen.js +0 -360
- package/dist/features/onboarding-flow/screens/05-AmountInputScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/05-DepositSuccessScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/05-DepositSuccessScreen.js +0 -136
- package/dist/features/onboarding-flow/screens/05-DepositSuccessScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/06-AuthLoadingScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/06-AuthLoadingScreen.js +0 -31
- package/dist/features/onboarding-flow/screens/06-AuthLoadingScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/06-DepositProgressScreen.js +0 -31
- package/dist/features/onboarding-flow/screens/06-DepositProgressScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/07-DepositSuccessScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/07-DepositSuccessScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/07-ErrorScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/07-ErrorScreen.js +0 -14
- package/dist/features/onboarding-flow/screens/07-ErrorScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/08-AuthLoadingScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/08-AuthLoadingScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/08-TurnkeyAuthScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/08-TurnkeyAuthScreen.js +0 -18
- package/dist/features/onboarding-flow/screens/08-TurnkeyAuthScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/09-ErrorScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/09-ErrorScreen.js +0 -14
- package/dist/features/onboarding-flow/screens/09-ErrorScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/09-TurnkeyPreparingScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/09-TurnkeyPreparingScreen.js +0 -18
- package/dist/features/onboarding-flow/screens/09-TurnkeyPreparingScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/TurnkeyAuthScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/TurnkeyAuthScreen.js +0 -18
- package/dist/features/onboarding-flow/screens/TurnkeyAuthScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/TurnkeyPreparingScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/TurnkeyPreparingScreen.js +0 -18
- package/dist/features/onboarding-flow/screens/TurnkeyPreparingScreen.js.map +0 -1
- package/dist/features/onboarding-flow/screens/index.d.ts +0 -7
- package/dist/features/onboarding-flow/screens/index.js +0 -8
- package/dist/features/onboarding-flow/screens/index.js.map +0 -1
- package/dist/features/onboarding-flow/types.js.map +0 -1
- package/dist/features/onboarding-flow/utils/depositStorage.d.ts +0 -4
- package/dist/features/onboarding-flow/utils/depositStorage.js +0 -48
- package/dist/features/onboarding-flow/utils/depositStorage.js.map +0 -1
- package/dist/features/onboarding-flow/utils/imageUtils.d.ts +0 -21
- package/dist/features/onboarding-flow/utils/imageUtils.js +0 -110
- package/dist/features/onboarding-flow/utils/imageUtils.js.map +0 -1
- package/dist/features/onboarding-flow/utils/nordUser.d.ts +0 -1
- package/dist/features/onboarding-flow/utils/nordUser.js.map +0 -1
- package/dist/features/onboarding-flow/utils/nordUtils.d.ts +0 -40
- package/dist/features/onboarding-flow/utils/nordUtils.js +0 -64
- package/dist/features/onboarding-flow/utils/nordUtils.js.map +0 -1
- package/dist/features/onboarding-flow/utils/session.d.ts +0 -17
- package/dist/features/onboarding-flow/utils/session.js +0 -69
- package/dist/features/onboarding-flow/utils/session.js.map +0 -1
- package/dist/features/onboarding-flow/utils/transaction.js +0 -8
- package/dist/features/onboarding-flow/utils/transaction.js.map +0 -1
- package/dist/features/onboarding-flow/utils/utils.js.map +0 -1
- package/dist/features/onboarding-flow/utils/withImageFallback.d.ts +0 -7
- package/dist/features/onboarding-flow/utils/withImageFallback.js.map +0 -1
- package/dist/features/turnkey/createTurnkeyWallet.d.ts +0 -25
- package/dist/features/turnkey/createTurnkeyWallet.js +0 -119
- package/dist/features/turnkey/createTurnkeyWallet.js.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useN1Wallet.d.ts +0 -2
- package/dist/hooks/useN1Wallet.js.map +0 -1
- package/dist/hooks/useNordUserInitialization.d.ts +0 -1
- package/dist/hooks/useNordUserInitialization.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/polyfills/windowEthereumGuard.d.ts +0 -6
- package/dist/polyfills/windowEthereumGuard.js +0 -28
- package/dist/polyfills/windowEthereumGuard.js.map +0 -1
- package/dist/providers/LazyWalletProvider.d.ts +0 -1
- package/dist/providers/LazyWalletProvider.js +0 -230
- package/dist/providers/LazyWalletProvider.js.map +0 -1
- package/dist/providers/N1WalletProvider.d.ts +0 -3
- package/dist/providers/N1WalletProvider.js +0 -267
- package/dist/providers/N1WalletProvider.js.map +0 -1
- package/dist/providers/ShadowRootWrapper.js.map +0 -1
- package/dist/providers/TurnkeyProviderBridge.d.ts +0 -7
- package/dist/providers/TurnkeyProviderBridge.js +0 -20
- package/dist/providers/TurnkeyProviderBridge.js.map +0 -1
- package/dist/providers/WalletErrorBoundary.js.map +0 -1
- package/dist/styles/embedded-main-css.d.ts +0 -2
- package/dist/styles/embedded-main-css.js +0 -3
- package/dist/styles/embedded-main-css.js.map +0 -1
- package/dist/turnkey/TurnkeyProvider.d.ts +0 -9
- package/dist/turnkey/TurnkeyProvider.js +0 -378
- package/dist/turnkey/TurnkeyProvider.js.map +0 -1
- package/dist/turnkey/createWalletProvider.d.ts +0 -3
- package/dist/turnkey/createWalletProvider.js +0 -180
- package/dist/turnkey/createWalletProvider.js.map +0 -1
- package/dist/turnkey/index.d.ts +0 -3
- package/dist/turnkey/index.js +0 -3
- package/dist/turnkey/index.js.map +0 -1
- package/dist/turnkey/types.js +0 -8
- package/dist/turnkey/types.js.map +0 -1
- package/dist/types/wallet.js.map +0 -1
- package/dist/utils/ed25519.js.map +0 -1
- package/dist/utils/getPseudoName.d.ts +0 -1
- package/dist/utils/getPseudoName.js +0 -5826
- package/dist/utils/getPseudoName.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -21
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/shortenString.d.ts +0 -2
- package/dist/utils/shortenString.js +0 -9
- package/dist/utils/shortenString.js.map +0 -1
- package/dist/utils/turnkeySessionStorage.d.ts +0 -3
- package/dist/utils/turnkeySessionStorage.js +0 -33
- package/dist/utils/turnkeySessionStorage.js.map +0 -1
- package/dist/utils/words.d.ts +0 -9
- package/dist/utils/words.js +0 -93572
- package/dist/utils/words.js.map +0 -1
- /package/dist/{animations → src/animations}/N1Loader.d.ts +0 -0
- /package/dist/{animations → src/animations}/N1Loader.js +0 -0
- /package/dist/{animations → src/animations}/Processing.d.ts +0 -0
- /package/dist/{animations → src/animations}/Processing.js +0 -0
- /package/dist/{components → src/components}/logos/ArbitrumLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/ArbitrumLogo.js +0 -0
- /package/dist/{components → src/components}/logos/BaseLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/BeraLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/BeraLogo.js +0 -0
- /package/dist/{components → src/components}/logos/BitcoinLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/BitcoinLogo.js +0 -0
- /package/dist/{components → src/components}/logos/EthereumLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/EthereumLogo.js +0 -0
- /package/dist/{components → src/components}/logos/HyperliquidLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/OptimismLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/OptimismLogo.js +0 -0
- /package/dist/{components → src/components}/logos/SolanaLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/SolanaLogo.js +0 -0
- /package/dist/{components → src/components}/logos/ZeroOneLogo.d.ts +0 -0
- /package/dist/{components → src/components}/logos/ZeroOneLogo.js +0 -0
- /package/dist/{components → src/components}/logos/index.d.ts +0 -0
- /package/dist/{components → src/components}/logos/index.js +0 -0
- /package/dist/{config → src/config}/dynamic.d.ts +0 -0
- /package/dist/{config → src/config}/solana.d.ts +0 -0
- /package/dist/{config → src/config}/solana.js +0 -0
- /package/dist/{context → src/context}/n1-wallet-context.d.ts +0 -0
- /package/dist/{context → src/context}/n1-wallet-context.js +0 -0
- /package/dist/{features → src/features}/onboarding-flow/N1WalletModal.d.ts +0 -0
- /package/dist/{features → src/features}/onboarding-flow/components/ImageWithFallback.d.ts +0 -0
- /package/dist/{features → src/features}/onboarding-flow/components/ImageWithFallback.js +0 -0
- /package/dist/{features → src/features}/onboarding-flow/components/WaitingMessage.js +0 -0
- /package/dist/{features → src/features}/onboarding-flow/components/index.d.ts +0 -0
- /package/dist/{features → src/features}/onboarding-flow/components/index.js +0 -0
- /package/dist/{features → src/features}/onboarding-flow/index.d.ts +0 -0
- /package/dist/{features → src/features}/onboarding-flow/index.js +0 -0
- /package/dist/{features → src/features}/onboarding-flow/providers/debug.d.ts +0 -0
- /package/dist/{features → src/features}/onboarding-flow/providers/index.d.ts +0 -0
- /package/dist/{features → src/features}/onboarding-flow/providers/index.js +0 -0
- /package/dist/{features → src/features}/onboarding-flow/screens/02-TurnkeyAuthScreen.d.ts +0 -0
- /package/dist/{features → src/features}/onboarding-flow/screens/03-TurnkeyPreparingScreen.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/index.js +0 -0
- /package/dist/{types → src/types}/wallet.js +0 -0
|
@@ -0,0 +1,585 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
+
if (ar || !(i in from)) {
|
|
51
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
+
ar[i] = from[i];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
+
};
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
58
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
59
|
+
import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
|
|
60
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
61
|
+
import { SolanaLogo } from "../../../components/logos";
|
|
62
|
+
import { useN1WalletContext } from "../../../hooks";
|
|
63
|
+
import { useNetwork } from "../../../providers/N1WalletProvider/NetworkProvider";
|
|
64
|
+
import { logger } from "../../../utils/logger";
|
|
65
|
+
import { formatAmount } from "../../../utils/formatAmount";
|
|
66
|
+
import { useDepositFlow, useOnboardingState, useWalletConnection } from "../providers";
|
|
67
|
+
import { isNordConfigured } from "../utils/nordUtils";
|
|
68
|
+
import { getSolanaRpcUrl } from "../../../config/solana";
|
|
69
|
+
/**
|
|
70
|
+
* Screen for entering deposit amount with balance checking and validation.
|
|
71
|
+
* Supports both Solana and EVM chains, fetches USDC balances, and validates minimum deposits.
|
|
72
|
+
*/
|
|
73
|
+
export var DEFAULT_MIN_DEPOSIT = 2;
|
|
74
|
+
export var BRIDGE_FEE = 1;
|
|
75
|
+
var EVM_USDC_DECIMALS = 6;
|
|
76
|
+
export var BALANCE_REFRESH_MS = 20000;
|
|
77
|
+
var ERC20_BALANCE_OF_SELECTOR = "0x70a08231";
|
|
78
|
+
var parseNumber = function (value) {
|
|
79
|
+
if (!value)
|
|
80
|
+
return undefined;
|
|
81
|
+
var parsed = Number(value);
|
|
82
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
83
|
+
};
|
|
84
|
+
var parseList = function (value) {
|
|
85
|
+
return value
|
|
86
|
+
? value
|
|
87
|
+
.split(",")
|
|
88
|
+
.map(function (v) { return v.trim(); })
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
: [];
|
|
91
|
+
};
|
|
92
|
+
var EVM_CHAIN_CONFIG = {
|
|
93
|
+
ethereum: {
|
|
94
|
+
nativeSymbol: (_a = process.env.NEXT_PUBLIC_NATIVE_SYMBOL_ETHEREUM) !== null && _a !== void 0 ? _a : "ETH",
|
|
95
|
+
nativeDecimals: (_b = parseNumber(process.env.NEXT_PUBLIC_NATIVE_DECIMALS_ETHEREUM)) !== null && _b !== void 0 ? _b : 18,
|
|
96
|
+
usdcAddress: process.env.NEXT_PUBLIC_USDC_ETHEREUM,
|
|
97
|
+
usdcDecimals: (_c = parseNumber(process.env.NEXT_PUBLIC_USDC_DECIMALS_ETHEREUM)) !== null && _c !== void 0 ? _c : 6,
|
|
98
|
+
rpcUrls: parseList(process.env.NEXT_PUBLIC_RPC_ETHEREUM).length > 0
|
|
99
|
+
? parseList(process.env.NEXT_PUBLIC_RPC_ETHEREUM)
|
|
100
|
+
: ["https://ethereum-sepolia-rpc.publicnode.com"],
|
|
101
|
+
minNativeForFees: (_d = parseNumber(process.env.NEXT_PUBLIC_MIN_NATIVE_FOR_FEES_ETHEREUM)) !== null && _d !== void 0 ? _d : 0.002,
|
|
102
|
+
},
|
|
103
|
+
arbitrum: {
|
|
104
|
+
nativeSymbol: (_e = process.env.NEXT_PUBLIC_NATIVE_SYMBOL_ARBITRUM) !== null && _e !== void 0 ? _e : "ETH",
|
|
105
|
+
nativeDecimals: (_f = parseNumber(process.env.NEXT_PUBLIC_NATIVE_DECIMALS_ARBITRUM)) !== null && _f !== void 0 ? _f : 18,
|
|
106
|
+
usdcAddress: process.env.NEXT_PUBLIC_USDC_ARBITRUM,
|
|
107
|
+
usdcDecimals: (_g = parseNumber(process.env.NEXT_PUBLIC_USDC_DECIMALS_ARBITRUM)) !== null && _g !== void 0 ? _g : 6,
|
|
108
|
+
rpcUrls: parseList(process.env.NEXT_PUBLIC_RPC_ARBITRUM).length > 0
|
|
109
|
+
? parseList(process.env.NEXT_PUBLIC_RPC_ARBITRUM)
|
|
110
|
+
: ["https://sepolia-rollup.arbitrum.io/rpc"],
|
|
111
|
+
minNativeForFees: (_h = parseNumber(process.env.NEXT_PUBLIC_MIN_NATIVE_FOR_FEES_ARBITRUM)) !== null && _h !== void 0 ? _h : 0.002,
|
|
112
|
+
},
|
|
113
|
+
base: {
|
|
114
|
+
nativeSymbol: (_j = process.env.NEXT_PUBLIC_NATIVE_SYMBOL_BASE) !== null && _j !== void 0 ? _j : "ETH",
|
|
115
|
+
nativeDecimals: (_k = parseNumber(process.env.NEXT_PUBLIC_NATIVE_DECIMALS_BASE)) !== null && _k !== void 0 ? _k : 18,
|
|
116
|
+
usdcAddress: process.env.NEXT_PUBLIC_USDC_BASE,
|
|
117
|
+
usdcDecimals: (_l = parseNumber(process.env.NEXT_PUBLIC_USDC_DECIMALS_BASE)) !== null && _l !== void 0 ? _l : 6,
|
|
118
|
+
rpcUrls: parseList(process.env.NEXT_PUBLIC_RPC_BASE).length > 0
|
|
119
|
+
? parseList(process.env.NEXT_PUBLIC_RPC_BASE)
|
|
120
|
+
: ["https://sepolia.base.org"],
|
|
121
|
+
minNativeForFees: (_m = parseNumber(process.env.NEXT_PUBLIC_MIN_NATIVE_FOR_FEES_BASE)) !== null && _m !== void 0 ? _m : 0.002,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
var normalizeChainId = function (chain) {
|
|
125
|
+
if (!chain)
|
|
126
|
+
return "solana";
|
|
127
|
+
var lower = chain.toLowerCase();
|
|
128
|
+
if (lower === "evm")
|
|
129
|
+
return "ethereum";
|
|
130
|
+
if (lower === "arb" || lower === "arbitrum" || lower === "arbitrum-one")
|
|
131
|
+
return "arbitrum";
|
|
132
|
+
if (lower === "base")
|
|
133
|
+
return "base";
|
|
134
|
+
return lower;
|
|
135
|
+
};
|
|
136
|
+
var formatBalanceFromHex = function (value, decimals) {
|
|
137
|
+
if (!value)
|
|
138
|
+
return 0;
|
|
139
|
+
try {
|
|
140
|
+
var raw = BigInt(value);
|
|
141
|
+
return Number(raw) / Math.pow(10, decimals);
|
|
142
|
+
}
|
|
143
|
+
catch (_a) {
|
|
144
|
+
return 0;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var buildBalanceOfData = function (wallet) {
|
|
148
|
+
var stripped = wallet.toLowerCase().replace(/^0x/, "");
|
|
149
|
+
return "".concat(ERC20_BALANCE_OF_SELECTOR).concat(stripped.padStart(64, "0"));
|
|
150
|
+
};
|
|
151
|
+
export function AmountInputScreen(_a) {
|
|
152
|
+
var _this = this;
|
|
153
|
+
var _b, _c, _d, _e;
|
|
154
|
+
var context = useOnboardingState().context;
|
|
155
|
+
var _f = useDepositFlow(), amount = _f.amount, updateAmount = _f.updateAmount, startDeposit = _f.startDeposit;
|
|
156
|
+
var nord = useN1WalletContext().nord;
|
|
157
|
+
var _g = useNetwork(), address = _g.solanaAddress, evmAddress = _g.evmAddress;
|
|
158
|
+
var turnkeyAddress = useWalletConnection().turnkeyAddress;
|
|
159
|
+
var _h = useState(null), tokenSymbol = _h[0], setTokenSymbol = _h[1];
|
|
160
|
+
var _j = useState(null), tokenDecimals = _j[0], setTokenDecimals = _j[1];
|
|
161
|
+
var _k = useState(null), nordTokens = _k[0], setNordTokens = _k[1];
|
|
162
|
+
var _l = useState({
|
|
163
|
+
usdc: null,
|
|
164
|
+
native: null,
|
|
165
|
+
loading: false,
|
|
166
|
+
error: null,
|
|
167
|
+
}), walletBalances = _l[0], setWalletBalances = _l[1];
|
|
168
|
+
var isMountedRef = useRef(true);
|
|
169
|
+
useEffect(function () {
|
|
170
|
+
return function () {
|
|
171
|
+
isMountedRef.current = false;
|
|
172
|
+
};
|
|
173
|
+
}, []);
|
|
174
|
+
// Set default amount only on initial mount
|
|
175
|
+
useEffect(function () {
|
|
176
|
+
if (!amount) {
|
|
177
|
+
updateAmount("10");
|
|
178
|
+
}
|
|
179
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
180
|
+
}, []);
|
|
181
|
+
var normalizedChain = useMemo(function () {
|
|
182
|
+
return normalizeChainId(context.selectedChainId || context.selectedChain || context.entryNetwork);
|
|
183
|
+
}, [context.entryNetwork, context.selectedChain, context.selectedChainId]);
|
|
184
|
+
var selectedChainName = useMemo(function () {
|
|
185
|
+
if (context.selectedChain) {
|
|
186
|
+
return context.selectedChain;
|
|
187
|
+
}
|
|
188
|
+
switch (normalizedChain) {
|
|
189
|
+
case "ethereum":
|
|
190
|
+
return "Ethereum";
|
|
191
|
+
case "arbitrum":
|
|
192
|
+
return "Arbitrum";
|
|
193
|
+
case "base":
|
|
194
|
+
return "Base";
|
|
195
|
+
default:
|
|
196
|
+
return "Solana";
|
|
197
|
+
}
|
|
198
|
+
}, [context.selectedChain, normalizedChain]);
|
|
199
|
+
var _m = useState(null), tokenMintAddress = _m[0], setTokenMintAddress = _m[1];
|
|
200
|
+
var solanaRecipient = address || turnkeyAddress || null;
|
|
201
|
+
// Simple rule: on EVM chains we always treat the deposit token as USDC with 6 decimals.
|
|
202
|
+
// This avoids depending on Nord token metadata to enable the amount screen.
|
|
203
|
+
useEffect(function () {
|
|
204
|
+
if (normalizedChain === "solana") {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (tokenSymbol !== "USDC") {
|
|
208
|
+
setTokenSymbol("USDC");
|
|
209
|
+
}
|
|
210
|
+
if (tokenDecimals !== EVM_USDC_DECIMALS) {
|
|
211
|
+
setTokenDecimals(EVM_USDC_DECIMALS);
|
|
212
|
+
}
|
|
213
|
+
if (tokenMintAddress !== null) {
|
|
214
|
+
setTokenMintAddress(null);
|
|
215
|
+
}
|
|
216
|
+
}, [normalizedChain, tokenDecimals, tokenMintAddress, tokenSymbol]);
|
|
217
|
+
var handleDepositClick = useCallback(function () {
|
|
218
|
+
logger.debug("Deposit button clicked", {
|
|
219
|
+
selectedChain: normalizedChain,
|
|
220
|
+
hasEvm: Boolean(evmAddress),
|
|
221
|
+
hasSolana: Boolean(address),
|
|
222
|
+
hasTurnkey: Boolean(turnkeyAddress),
|
|
223
|
+
});
|
|
224
|
+
void startDeposit();
|
|
225
|
+
}, [address, evmAddress, normalizedChain, startDeposit, turnkeyAddress, amount, solanaRecipient]);
|
|
226
|
+
useEffect(function () {
|
|
227
|
+
var isCancelled = false;
|
|
228
|
+
var loadNordTokens = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
229
|
+
var error_1;
|
|
230
|
+
return __generator(this, function (_a) {
|
|
231
|
+
switch (_a.label) {
|
|
232
|
+
case 0:
|
|
233
|
+
if (!nord || !isNordConfigured(nord)) {
|
|
234
|
+
if (!isCancelled) {
|
|
235
|
+
setNordTokens(null);
|
|
236
|
+
}
|
|
237
|
+
return [2 /*return*/];
|
|
238
|
+
}
|
|
239
|
+
if (Array.isArray(nord.tokens) && nord.tokens.length > 0) {
|
|
240
|
+
if (!isCancelled) {
|
|
241
|
+
setNordTokens(nord.tokens);
|
|
242
|
+
}
|
|
243
|
+
return [2 /*return*/];
|
|
244
|
+
}
|
|
245
|
+
if (typeof nord.fetchNordInfo !== "function") {
|
|
246
|
+
return [2 /*return*/];
|
|
247
|
+
}
|
|
248
|
+
_a.label = 1;
|
|
249
|
+
case 1:
|
|
250
|
+
_a.trys.push([1, 3, , 4]);
|
|
251
|
+
return [4 /*yield*/, nord.fetchNordInfo()];
|
|
252
|
+
case 2:
|
|
253
|
+
_a.sent();
|
|
254
|
+
if (isCancelled) {
|
|
255
|
+
return [2 /*return*/];
|
|
256
|
+
}
|
|
257
|
+
if (Array.isArray(nord.tokens) && nord.tokens.length > 0) {
|
|
258
|
+
setNordTokens(nord.tokens);
|
|
259
|
+
}
|
|
260
|
+
return [3 /*break*/, 4];
|
|
261
|
+
case 3:
|
|
262
|
+
error_1 = _a.sent();
|
|
263
|
+
if (!isCancelled) {
|
|
264
|
+
logger.warn("Unable to fetch Nord info:", error_1);
|
|
265
|
+
setNordTokens(null);
|
|
266
|
+
}
|
|
267
|
+
return [3 /*break*/, 4];
|
|
268
|
+
case 4: return [2 /*return*/];
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}); };
|
|
272
|
+
loadNordTokens();
|
|
273
|
+
return function () {
|
|
274
|
+
isCancelled = true;
|
|
275
|
+
};
|
|
276
|
+
}, [nord]);
|
|
277
|
+
useEffect(function () {
|
|
278
|
+
if (nord && isNordConfigured(nord)) {
|
|
279
|
+
try {
|
|
280
|
+
if (!nordTokens || nordTokens.length === 0) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
var usdcToken = nordTokens.find(function (t) { return t.symbol === "USDC_2"; }) || nordTokens[0];
|
|
284
|
+
if (usdcToken) {
|
|
285
|
+
if (!usdcToken.symbol) {
|
|
286
|
+
throw new Error("Nord token configuration missing symbol");
|
|
287
|
+
}
|
|
288
|
+
if (!Number.isFinite(usdcToken.decimals)) {
|
|
289
|
+
throw new Error("Nord token configuration missing decimals");
|
|
290
|
+
}
|
|
291
|
+
if (!usdcToken.mintAddr) {
|
|
292
|
+
throw new Error("Nord token configuration missing mint address");
|
|
293
|
+
}
|
|
294
|
+
setTokenSymbol(usdcToken.symbol);
|
|
295
|
+
setTokenDecimals(usdcToken.decimals);
|
|
296
|
+
setTokenMintAddress(usdcToken.mintAddr);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
logger.warn("Error getting token information from Nord:", error);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}, [nord, nordTokens]);
|
|
304
|
+
var minDeposit = useMemo(function () {
|
|
305
|
+
var _a, _b;
|
|
306
|
+
if (!nord ||
|
|
307
|
+
!isNordConfigured(nord) ||
|
|
308
|
+
!tokenMintAddress ||
|
|
309
|
+
tokenDecimals == null) {
|
|
310
|
+
return DEFAULT_MIN_DEPOSIT;
|
|
311
|
+
}
|
|
312
|
+
try {
|
|
313
|
+
// @ts-ignore
|
|
314
|
+
var mintInfo = (_b = (_a = nord.protonClient) === null || _a === void 0 ? void 0 : _a.mintInfo) === null || _b === void 0 ? void 0 : _b.get(tokenMintAddress);
|
|
315
|
+
if (mintInfo === null || mintInfo === void 0 ? void 0 : mintInfo.minDeposit) {
|
|
316
|
+
var minDepositUnits = Number(mintInfo.minDeposit);
|
|
317
|
+
var divisor = Math.pow(10, (tokenDecimals !== null && tokenDecimals !== void 0 ? tokenDecimals : 0));
|
|
318
|
+
if (Number.isFinite(minDepositUnits) && divisor > 0) {
|
|
319
|
+
return minDepositUnits / divisor;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
logger.warn("Unable to derive min deposit from Nord config", error);
|
|
325
|
+
}
|
|
326
|
+
return DEFAULT_MIN_DEPOSIT;
|
|
327
|
+
}, [nord, tokenMintAddress, tokenDecimals]);
|
|
328
|
+
var effectiveMinDeposit = useMemo(function () {
|
|
329
|
+
// For EVM chains we enforce: min_deposit + bridge_fee.
|
|
330
|
+
// For Solana: min_deposit only.
|
|
331
|
+
return normalizedChain === "solana" ? minDeposit : minDeposit + BRIDGE_FEE;
|
|
332
|
+
}, [minDeposit, normalizedChain]);
|
|
333
|
+
var fetchBalances = useCallback(function () {
|
|
334
|
+
var args_1 = [];
|
|
335
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
336
|
+
args_1[_i] = arguments[_i];
|
|
337
|
+
}
|
|
338
|
+
return __awaiter(_this, __spreadArray([], args_1, true), void 0, function (showSpinner) {
|
|
339
|
+
var isSolanaChain, ownerAddress, evmConfig, rpcUrl, rpcEndpoint, connection, ownerKey, _a, solLamports, tokenAccounts, usdcTotal, normalizedOwner, requestRpc, _b, nativeHex, usdcHex, usdcBalance, nativeBalance, error_2;
|
|
340
|
+
var _this = this;
|
|
341
|
+
var _c;
|
|
342
|
+
if (showSpinner === void 0) { showSpinner = true; }
|
|
343
|
+
return __generator(this, function (_d) {
|
|
344
|
+
switch (_d.label) {
|
|
345
|
+
case 0:
|
|
346
|
+
isSolanaChain = normalizedChain === "solana";
|
|
347
|
+
ownerAddress = isSolanaChain ? address : evmAddress;
|
|
348
|
+
evmConfig = isSolanaChain ? null : EVM_CHAIN_CONFIG[normalizedChain];
|
|
349
|
+
rpcUrl = (_c = evmConfig === null || evmConfig === void 0 ? void 0 : evmConfig.rpcUrls.find(Boolean)) !== null && _c !== void 0 ? _c : null;
|
|
350
|
+
if (!ownerAddress || (isSolanaChain && !tokenMintAddress)) {
|
|
351
|
+
if (isMountedRef.current) {
|
|
352
|
+
setWalletBalances({
|
|
353
|
+
usdc: null,
|
|
354
|
+
native: null,
|
|
355
|
+
loading: false,
|
|
356
|
+
error: null,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
return [2 /*return*/];
|
|
360
|
+
}
|
|
361
|
+
if (showSpinner) {
|
|
362
|
+
setWalletBalances(function (prev) { return (__assign(__assign({}, prev), { loading: true, error: null })); });
|
|
363
|
+
}
|
|
364
|
+
_d.label = 1;
|
|
365
|
+
case 1:
|
|
366
|
+
_d.trys.push([1, 5, , 6]);
|
|
367
|
+
if (!isSolanaChain) return [3 /*break*/, 3];
|
|
368
|
+
rpcEndpoint = getSolanaRpcUrl();
|
|
369
|
+
connection = new Connection(rpcEndpoint, "confirmed");
|
|
370
|
+
ownerKey = new PublicKey(ownerAddress);
|
|
371
|
+
return [4 /*yield*/, Promise.all([
|
|
372
|
+
connection.getBalance(ownerKey),
|
|
373
|
+
connection.getParsedTokenAccountsByOwner(ownerKey, {
|
|
374
|
+
mint: new PublicKey(tokenMintAddress),
|
|
375
|
+
}),
|
|
376
|
+
])];
|
|
377
|
+
case 2:
|
|
378
|
+
_a = _d.sent(), solLamports = _a[0], tokenAccounts = _a[1];
|
|
379
|
+
usdcTotal = tokenAccounts.value.reduce(function (total, _a) {
|
|
380
|
+
var _b, _c;
|
|
381
|
+
var account = _a.account;
|
|
382
|
+
var info = (_b = account.data.parsed) === null || _b === void 0 ? void 0 : _b.info;
|
|
383
|
+
var tokenAmount = info === null || info === void 0 ? void 0 : info.tokenAmount;
|
|
384
|
+
if (!tokenAmount) {
|
|
385
|
+
return total;
|
|
386
|
+
}
|
|
387
|
+
var uiAmount = typeof tokenAmount.uiAmount === "number"
|
|
388
|
+
? tokenAmount.uiAmount
|
|
389
|
+
: parseFloat((_c = tokenAmount.uiAmountString) !== null && _c !== void 0 ? _c : "0");
|
|
390
|
+
return total + (Number.isFinite(uiAmount) ? uiAmount : 0);
|
|
391
|
+
}, 0);
|
|
392
|
+
if (!isMountedRef.current) {
|
|
393
|
+
return [2 /*return*/];
|
|
394
|
+
}
|
|
395
|
+
setWalletBalances({
|
|
396
|
+
usdc: usdcTotal,
|
|
397
|
+
native: solLamports / LAMPORTS_PER_SOL,
|
|
398
|
+
loading: false,
|
|
399
|
+
error: null,
|
|
400
|
+
});
|
|
401
|
+
return [2 /*return*/];
|
|
402
|
+
case 3:
|
|
403
|
+
if (!evmConfig || !rpcUrl) {
|
|
404
|
+
throw new Error("Unsupported chain for balance lookup.");
|
|
405
|
+
}
|
|
406
|
+
if (!evmConfig.usdcAddress) {
|
|
407
|
+
throw new Error("USDC contract is not configured for this chain.");
|
|
408
|
+
}
|
|
409
|
+
normalizedOwner = ownerAddress.startsWith("0x")
|
|
410
|
+
? ownerAddress
|
|
411
|
+
: "0x".concat(ownerAddress);
|
|
412
|
+
requestRpc = function (method, params) { return __awaiter(_this, void 0, void 0, function () {
|
|
413
|
+
var response, payload;
|
|
414
|
+
var _a;
|
|
415
|
+
return __generator(this, function (_b) {
|
|
416
|
+
switch (_b.label) {
|
|
417
|
+
case 0: return [4 /*yield*/, fetch(rpcUrl, {
|
|
418
|
+
method: "POST",
|
|
419
|
+
headers: { "Content-Type": "application/json" },
|
|
420
|
+
body: JSON.stringify({
|
|
421
|
+
jsonrpc: "2.0",
|
|
422
|
+
id: Date.now(),
|
|
423
|
+
method: method,
|
|
424
|
+
params: params,
|
|
425
|
+
}),
|
|
426
|
+
})];
|
|
427
|
+
case 1:
|
|
428
|
+
response = _b.sent();
|
|
429
|
+
if (!response.ok) {
|
|
430
|
+
throw new Error("RPC request failed with status ".concat(response.status));
|
|
431
|
+
}
|
|
432
|
+
return [4 /*yield*/, response.json()];
|
|
433
|
+
case 2:
|
|
434
|
+
payload = _b.sent();
|
|
435
|
+
if (payload === null || payload === void 0 ? void 0 : payload.error) {
|
|
436
|
+
throw new Error(((_a = payload.error) === null || _a === void 0 ? void 0 : _a.message) || "RPC request failed for balances.");
|
|
437
|
+
}
|
|
438
|
+
return [2 /*return*/, payload === null || payload === void 0 ? void 0 : payload.result];
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}); };
|
|
442
|
+
return [4 /*yield*/, Promise.all([
|
|
443
|
+
requestRpc("eth_getBalance", [normalizedOwner, "latest"]),
|
|
444
|
+
requestRpc("eth_call", [
|
|
445
|
+
{ to: evmConfig.usdcAddress, data: buildBalanceOfData(normalizedOwner) },
|
|
446
|
+
"latest",
|
|
447
|
+
]),
|
|
448
|
+
])];
|
|
449
|
+
case 4:
|
|
450
|
+
_b = _d.sent(), nativeHex = _b[0], usdcHex = _b[1];
|
|
451
|
+
usdcBalance = formatBalanceFromHex(usdcHex, evmConfig.usdcDecimals);
|
|
452
|
+
nativeBalance = formatBalanceFromHex(nativeHex, evmConfig.nativeDecimals);
|
|
453
|
+
if (!isMountedRef.current) {
|
|
454
|
+
return [2 /*return*/];
|
|
455
|
+
}
|
|
456
|
+
setWalletBalances({
|
|
457
|
+
usdc: usdcBalance,
|
|
458
|
+
native: nativeBalance,
|
|
459
|
+
loading: false,
|
|
460
|
+
error: null,
|
|
461
|
+
});
|
|
462
|
+
return [3 /*break*/, 6];
|
|
463
|
+
case 5:
|
|
464
|
+
error_2 = _d.sent();
|
|
465
|
+
logger.warn("Failed to load wallet balances", error_2);
|
|
466
|
+
if (!isMountedRef.current) {
|
|
467
|
+
return [2 /*return*/];
|
|
468
|
+
}
|
|
469
|
+
setWalletBalances(function (prev) { return (__assign(__assign({}, prev), { loading: false, error: "Unable to fetch wallet balances. Please try again." })); });
|
|
470
|
+
return [3 /*break*/, 6];
|
|
471
|
+
case 6: return [2 /*return*/];
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
}, [address, evmAddress, normalizedChain, tokenMintAddress]);
|
|
476
|
+
useEffect(function () {
|
|
477
|
+
if (normalizedChain === "solana" && !tokenMintAddress) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
fetchBalances();
|
|
481
|
+
var interval = setInterval(function () {
|
|
482
|
+
fetchBalances(false);
|
|
483
|
+
}, BALANCE_REFRESH_MS);
|
|
484
|
+
return function () { return clearInterval(interval); };
|
|
485
|
+
}, [fetchBalances, normalizedChain, tokenMintAddress]);
|
|
486
|
+
var isSolana = normalizedChain === "solana";
|
|
487
|
+
var nativeSymbol = isSolana
|
|
488
|
+
? "SOL"
|
|
489
|
+
: (_c = (_b = EVM_CHAIN_CONFIG[normalizedChain]) === null || _b === void 0 ? void 0 : _b.nativeSymbol) !== null && _c !== void 0 ? _c : "ETH";
|
|
490
|
+
var requiredNativeForFees = isSolana
|
|
491
|
+
? 0.002
|
|
492
|
+
: (_e = (_d = EVM_CHAIN_CONFIG[normalizedChain]) === null || _d === void 0 ? void 0 : _d.minNativeForFees) !== null && _e !== void 0 ? _e : 0.002;
|
|
493
|
+
var gasFeeDisplay = isSolana ? "~$0.30" : "~$0.40";
|
|
494
|
+
var minDepositDisplay = effectiveMinDeposit.toString();
|
|
495
|
+
var tokenSymbolDisplay = tokenSymbol !== null && tokenSymbol !== void 0 ? tokenSymbol : "—";
|
|
496
|
+
var formattedBalance = walletBalances.usdc == null || tokenDecimals == null
|
|
497
|
+
? walletBalances.loading
|
|
498
|
+
? "Loading..."
|
|
499
|
+
: "—"
|
|
500
|
+
: formatAmount(walletBalances.usdc, tokenDecimals);
|
|
501
|
+
var formattedNativeBalance = walletBalances.native == null
|
|
502
|
+
? walletBalances.loading
|
|
503
|
+
? "Loading..."
|
|
504
|
+
: "—"
|
|
505
|
+
: walletBalances.native.toFixed(4);
|
|
506
|
+
var numericAmount = Number(amount || 0);
|
|
507
|
+
var hasEnteredAmount = Number.isFinite(numericAmount) && numericAmount > 0;
|
|
508
|
+
var meetsMinDeposit = numericAmount >= effectiveMinDeposit;
|
|
509
|
+
var hasSufficientUsdc = walletBalances.usdc == null ? false : numericAmount <= walletBalances.usdc;
|
|
510
|
+
var hasSufficientNative = walletBalances.native == null
|
|
511
|
+
? false
|
|
512
|
+
: walletBalances.native >= requiredNativeForFees;
|
|
513
|
+
var validationError = useMemo(function () {
|
|
514
|
+
if (isSolana && !address) {
|
|
515
|
+
return "Connect a wallet to continue.";
|
|
516
|
+
}
|
|
517
|
+
if (!isSolana && !evmAddress) {
|
|
518
|
+
return "Connect an EVM wallet to continue.";
|
|
519
|
+
}
|
|
520
|
+
if (walletBalances.error) {
|
|
521
|
+
return walletBalances.error;
|
|
522
|
+
}
|
|
523
|
+
if (!tokenSymbol || tokenDecimals == null) {
|
|
524
|
+
return "Token information unavailable. Please try again later.";
|
|
525
|
+
}
|
|
526
|
+
if (!hasEnteredAmount) {
|
|
527
|
+
return "Enter an amount to continue.";
|
|
528
|
+
}
|
|
529
|
+
if (walletBalances.loading ||
|
|
530
|
+
walletBalances.usdc == null ||
|
|
531
|
+
walletBalances.native == null) {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
if (!isSolana && !solanaRecipient) {
|
|
535
|
+
return "Preparing Solana deposit address. Please wait a moment and retry.";
|
|
536
|
+
}
|
|
537
|
+
if (!meetsMinDeposit) {
|
|
538
|
+
return "Minimum deposit is ".concat(effectiveMinDeposit, " ").concat(tokenSymbolDisplay, ".");
|
|
539
|
+
}
|
|
540
|
+
if (!hasSufficientUsdc) {
|
|
541
|
+
return "Insufficient ".concat(tokenSymbol, " balance for this deposit.");
|
|
542
|
+
}
|
|
543
|
+
if (!hasSufficientNative) {
|
|
544
|
+
return "Not enough ".concat(nativeSymbol, " to cover network fees.");
|
|
545
|
+
}
|
|
546
|
+
return null;
|
|
547
|
+
}, [
|
|
548
|
+
address,
|
|
549
|
+
evmAddress,
|
|
550
|
+
walletBalances.error,
|
|
551
|
+
walletBalances.loading,
|
|
552
|
+
walletBalances.usdc,
|
|
553
|
+
walletBalances.native,
|
|
554
|
+
hasEnteredAmount,
|
|
555
|
+
hasSufficientNative,
|
|
556
|
+
hasSufficientUsdc,
|
|
557
|
+
meetsMinDeposit,
|
|
558
|
+
tokenSymbol,
|
|
559
|
+
tokenDecimals,
|
|
560
|
+
effectiveMinDeposit,
|
|
561
|
+
isSolana,
|
|
562
|
+
nativeSymbol,
|
|
563
|
+
solanaRecipient,
|
|
564
|
+
tokenSymbolDisplay,
|
|
565
|
+
]);
|
|
566
|
+
var isValidAmount = !walletBalances.loading && validationError === null;
|
|
567
|
+
var handleUseMax = function () {
|
|
568
|
+
if (walletBalances.usdc == null ||
|
|
569
|
+
walletBalances.usdc <= 0 ||
|
|
570
|
+
tokenDecimals == null) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
updateAmount(walletBalances.usdc.toFixed(tokenDecimals));
|
|
574
|
+
};
|
|
575
|
+
return (_jsxs("div", { className: "overflow-hidden relative", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsx("h2", { className: "text-sm text-white font-medium", children: "Deposit From" }), _jsxs("div", { className: "flex items-center space-x-2 rounded-md bg-n1-ww-border h-5 justify-center p-1", children: [isSolana ? (_jsx("div", { className: "rounded-full flex items-center justify-center bg-black h-3 w-3", children: _jsx(SolanaLogo, { width: 6, height: 6 }) })) : (_jsx("div", { className: "w-4 h-4 rounded-full bg-n1-ww-gray-600" })), _jsx("span", { className: "text-white text-xs font-medium", children: selectedChainName })] })] }), _jsxs("div", { className: "space-y-3 mb-4 text-white text-xs font-light", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { children: "Available Balance:" }), _jsxs("span", { children: [formattedBalance, " ", tokenSymbolDisplay] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { children: [nativeSymbol, " Balance:"] }), _jsxs("span", { children: [formattedNativeBalance, " ", nativeSymbol] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { children: "Minimum Deposit:" }), _jsxs("span", { children: [minDepositDisplay, " ", tokenSymbolDisplay] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { children: "Gas Fee:" }), _jsx("span", { children: gasFeeDisplay })] })] }), _jsx("div", { className: "h-px bg-n1-ww-border mb-4" }), _jsxs("div", { className: "mb-4 flex justify-between w-full", children: [_jsx("div", { className: "flex items-center gap-3", children: _jsxs("div", { className: "flex items-center justify-between border border-n1-ww-gray-400 bg-n1-ww-gray-600 flex-1 w-[292px] rounded h-8 px-2", children: [_jsx("span", { className: "text-white text-sm font-medium", children: "Amount" }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "text", inputMode: "decimal", value: amount, onChange: function (e) {
|
|
576
|
+
var val = e.target.value;
|
|
577
|
+
// Allow empty, or valid decimal numbers
|
|
578
|
+
if (val === "" || /^\d*\.?\d*$/.test(val)) {
|
|
579
|
+
updateAmount(val);
|
|
580
|
+
}
|
|
581
|
+
}, className: "text-white font-light text-xs text-right bg-transparent border-none outline-none focus:ring-2 focus:ring-n1-ww-main focus:ring-offset-0 rounded px-1 w-20" }), _jsx("button", { className: "border border-n1-ww-gray-400 h-5 text-white text-xs font-light flex items-center justify-center px-1 rounded transition-colors", children: tokenSymbolDisplay })] })] }) }), _jsx("button", { className: "border border-n1-ww-gray-400 bg-n1-ww-gray-600 rounded text-white text-sm font-medium px-2 h-8 hover:bg-n1-ww-gray-800 transition-colors w-[68px]", onClick: handleUseMax, type: "button", children: "Max" })] }), validationError && (_jsx("p", { className: "mb-2 text-xs", style: { color: '#f87171' }, children: validationError })), _jsx("button", { onClick: handleDepositClick, disabled: !isValidAmount, type: "button", className: "\n w-full h-8 rounded border bg-transparent flex font-medium items-center justify-center\n transition-all duration-200 transform\n ".concat(isValidAmount
|
|
582
|
+
? "border-n1-ww-main hover:bg-n1-ww-gray-900 cursor-pointer"
|
|
583
|
+
: "border-n1-ww-border opacity-50 cursor-not-allowed", "\n "), children: _jsx("span", { className: "\n font-medium text-sm opacity-90\n ".concat(isValidAmount ? "text-n1-ww-main" : "text-n1-ww-gray-600", "\n "), children: "Deposit" }) })] }));
|
|
584
|
+
}
|
|
585
|
+
//# sourceMappingURL=05-AmountInputScreen.js.map
|