@n1xyz/wallet-widget 0.0.35-alpha.0 → 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.d.ts +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/src/config/turnkey.js +32 -0
- 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/{features → src/features}/onboarding-flow/components/ImageWithFallback.d.ts +2 -5
- package/dist/src/features/onboarding-flow/components/ImageWithFallback.js +33 -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/src/features/onboarding-flow/screens/02-TurnkeyAuthScreen.d.ts +1 -0
- package/dist/src/features/onboarding-flow/screens/02-TurnkeyAuthScreen.js +25 -0
- package/dist/src/features/onboarding-flow/screens/02-TurnkeyAuthScreen.js.map +1 -0
- package/dist/src/features/onboarding-flow/screens/03-TurnkeyPreparingScreen.d.ts +1 -0
- package/dist/src/features/onboarding-flow/screens/03-TurnkeyPreparingScreen.js +25 -0
- package/dist/src/features/onboarding-flow/screens/03-TurnkeyPreparingScreen.js.map +1 -0
- package/dist/{features/onboarding-flow/screens/02-ChainSelectionScreen.d.ts → src/features/onboarding-flow/screens/04-ChainSelectionScreen.d.ts} +11 -11
- package/dist/{features/onboarding-flow/screens/02-ChainSelectionScreen.js → src/features/onboarding-flow/screens/04-ChainSelectionScreen.js} +60 -30
- 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/onboarding-flow/screens/04-DepositProgressScreen.d.ts → 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/onboarding-flow/screens/05-DepositSuccessScreen.js → src/features/onboarding-flow/screens/07-DepositSuccessScreen.js} +12 -6
- 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/onboarding-flow/screens/06-AuthLoadingScreen.js → src/features/onboarding-flow/screens/08-AuthLoadingScreen.js} +6 -2
- 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 -5
- 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/{styles → src/styles}/cdn-fonts.js +20 -2
- 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/src/turnkey/types.d.ts +61 -0
- 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 +5 -20
- 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 +45 -29
- 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/solana.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 +0 -63
- 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.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/04-DepositProgressScreen.js +0 -31
- package/dist/features/onboarding-flow/screens/04-DepositProgressScreen.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.map +0 -1
- package/dist/features/onboarding-flow/screens/06-AuthLoadingScreen.d.ts +0 -1
- package/dist/features/onboarding-flow/screens/06-AuthLoadingScreen.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/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/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 -271
- package/dist/providers/N1WalletProvider.js.map +0 -1
- package/dist/providers/ShadowRootWrapper.js.map +0 -1
- package/dist/providers/WalletErrorBoundary.js.map +0 -1
- package/dist/styles/cdn-fonts.d.ts +0 -1
- package/dist/styles/cdn-fonts.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/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/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}/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/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/{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,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Address utilities for validation and normalization across Solana and EVM chains.
|
|
3
|
+
* Uses library functions from @solana/web3.js and viem for proper validation.
|
|
4
|
+
* Centralizes address handling that was previously scattered across multiple files.
|
|
5
|
+
*/
|
|
6
|
+
import { PublicKey } from '@solana/web3.js';
|
|
7
|
+
import { isAddress as viemIsAddress, getAddress as viemGetAddress } from 'viem';
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Solana Address Validation
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
/**
|
|
12
|
+
* Validates a Solana address by attempting to construct a PublicKey.
|
|
13
|
+
* This validates the base58 encoding and length.
|
|
14
|
+
*
|
|
15
|
+
* @param address - The address to validate
|
|
16
|
+
* @returns true if valid Solana address format
|
|
17
|
+
*/
|
|
18
|
+
export function isValidSolanaAddress(address) {
|
|
19
|
+
if (!address || typeof address !== 'string') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
new PublicKey(address);
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
catch (_a) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validates a Solana wallet address (must be on the ed25519 curve).
|
|
32
|
+
* PDAs (Program Derived Addresses) are intentionally off-curve and will return false.
|
|
33
|
+
* Use isValidSolanaAddress() if you need to accept PDAs.
|
|
34
|
+
*
|
|
35
|
+
* @param address - The address to validate
|
|
36
|
+
* @returns true if valid Solana wallet address on the ed25519 curve
|
|
37
|
+
*/
|
|
38
|
+
export function isValidSolanaWalletAddress(address) {
|
|
39
|
+
if (!address || typeof address !== 'string') {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
var pubkey = new PublicKey(address);
|
|
44
|
+
return PublicKey.isOnCurve(pubkey.toBytes());
|
|
45
|
+
}
|
|
46
|
+
catch (_a) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// EVM Address Validation
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
/**
|
|
54
|
+
* Validates an EVM address using viem's isAddress function.
|
|
55
|
+
* Uses strict: false to accept addresses regardless of checksum.
|
|
56
|
+
*
|
|
57
|
+
* @param address - The address to validate
|
|
58
|
+
* @returns true if valid EVM address format
|
|
59
|
+
*/
|
|
60
|
+
export function isValidEVMAddress(address) {
|
|
61
|
+
if (!address || typeof address !== 'string') {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
// Use strict: false to accept addresses regardless of checksum
|
|
65
|
+
return viemIsAddress(address, { strict: false });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validates an EVM address with strict checksum validation.
|
|
69
|
+
*
|
|
70
|
+
* @param address - The address to validate
|
|
71
|
+
* @returns true if valid EVM address with correct checksum
|
|
72
|
+
*/
|
|
73
|
+
export function isValidEVMAddressStrict(address) {
|
|
74
|
+
if (!address || typeof address !== 'string') {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return viemIsAddress(address, { strict: true });
|
|
78
|
+
}
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// Universal Validation
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
/**
|
|
83
|
+
* Validates an address for either Solana or EVM.
|
|
84
|
+
*
|
|
85
|
+
* @param address - The address to validate
|
|
86
|
+
* @returns Object with isValid flag and detected network type
|
|
87
|
+
*/
|
|
88
|
+
export function validateAddress(address) {
|
|
89
|
+
if (isValidEVMAddress(address)) {
|
|
90
|
+
return { isValid: true, network: 'evm' };
|
|
91
|
+
}
|
|
92
|
+
if (isValidSolanaAddress(address)) {
|
|
93
|
+
return { isValid: true, network: 'solana' };
|
|
94
|
+
}
|
|
95
|
+
return { isValid: false, network: null };
|
|
96
|
+
}
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Normalization
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
/**
|
|
101
|
+
* Normalizes an EVM address to checksummed format using viem.
|
|
102
|
+
* This is the canonical format for EVM addresses.
|
|
103
|
+
*
|
|
104
|
+
* @param address - The EVM address to normalize
|
|
105
|
+
* @returns Checksummed address, or empty string if invalid
|
|
106
|
+
*/
|
|
107
|
+
export function normalizeEVMAddress(address) {
|
|
108
|
+
if (!address || typeof address !== 'string') {
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
return viemGetAddress(address);
|
|
113
|
+
}
|
|
114
|
+
catch (_a) {
|
|
115
|
+
// If getAddress fails, return lowercase as fallback
|
|
116
|
+
return address.toLowerCase().trim();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Normalizes an EVM address to lowercase for comparison purposes.
|
|
121
|
+
* This replaces the duplicated normalizeAddress functions in TurnkeyProvider.tsx
|
|
122
|
+
* and turnkeySessionStorage.ts.
|
|
123
|
+
*
|
|
124
|
+
* @param address - The EVM address to normalize
|
|
125
|
+
* @returns Lowercase address, or empty string if invalid
|
|
126
|
+
*/
|
|
127
|
+
export function normalizeEVMAddressLowercase(address) {
|
|
128
|
+
if (!address || typeof address !== 'string') {
|
|
129
|
+
return '';
|
|
130
|
+
}
|
|
131
|
+
return address.toLowerCase().trim();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Normalizes a Solana address (trimming whitespace).
|
|
135
|
+
* Solana addresses are case-sensitive (base58), so we only trim.
|
|
136
|
+
*
|
|
137
|
+
* @param address - The Solana address to normalize
|
|
138
|
+
* @returns Trimmed address, or empty string if invalid
|
|
139
|
+
*/
|
|
140
|
+
export function normalizeSolanaAddress(address) {
|
|
141
|
+
if (!address || typeof address !== 'string') {
|
|
142
|
+
return '';
|
|
143
|
+
}
|
|
144
|
+
return address.trim();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Normalizes any address based on detected type.
|
|
148
|
+
* EVM addresses are lowercased, Solana addresses are trimmed.
|
|
149
|
+
*
|
|
150
|
+
* @param address - The address to normalize
|
|
151
|
+
* @returns Normalized address
|
|
152
|
+
*/
|
|
153
|
+
export function normalizeAddress(address) {
|
|
154
|
+
if (!address || typeof address !== 'string') {
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
var trimmed = address.trim();
|
|
158
|
+
// If it looks like an EVM address, lowercase it for comparison
|
|
159
|
+
if (trimmed.startsWith('0x')) {
|
|
160
|
+
return trimmed.toLowerCase();
|
|
161
|
+
}
|
|
162
|
+
// Otherwise treat as Solana (case-sensitive)
|
|
163
|
+
return trimmed;
|
|
164
|
+
}
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Comparison
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
/**
|
|
169
|
+
* Compares two addresses for equality.
|
|
170
|
+
* Handles case-insensitive comparison for EVM and case-sensitive for Solana.
|
|
171
|
+
*
|
|
172
|
+
* @param a - First address
|
|
173
|
+
* @param b - Second address
|
|
174
|
+
* @returns true if addresses are equal
|
|
175
|
+
*/
|
|
176
|
+
export function compareAddresses(a, b) {
|
|
177
|
+
if (!a || !b) {
|
|
178
|
+
return a === b; // Both null/undefined = equal, one null = not equal
|
|
179
|
+
}
|
|
180
|
+
return normalizeAddress(a) === normalizeAddress(b);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Compares two EVM addresses for equality using viem's address comparison.
|
|
184
|
+
* More robust than string comparison.
|
|
185
|
+
*
|
|
186
|
+
* @param a - First EVM address
|
|
187
|
+
* @param b - Second EVM address
|
|
188
|
+
* @returns true if addresses are equal
|
|
189
|
+
*/
|
|
190
|
+
export function compareEVMAddresses(a, b) {
|
|
191
|
+
if (!a || !b) {
|
|
192
|
+
return a === b;
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
return viemGetAddress(a) === viemGetAddress(b);
|
|
196
|
+
}
|
|
197
|
+
catch (_a) {
|
|
198
|
+
// Fall back to lowercase comparison if getAddress fails
|
|
199
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// ---------------------------------------------------------------------------
|
|
203
|
+
// Formatting
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
/**
|
|
206
|
+
* Shortens an address for display.
|
|
207
|
+
* Example: "0x1234567890abcdef1234567890abcdef12345678" -> "0x1234...5678"
|
|
208
|
+
*
|
|
209
|
+
* @param address - The address to shorten
|
|
210
|
+
* @param chars - Number of characters to show at start/end (default: 4)
|
|
211
|
+
* @returns Shortened address
|
|
212
|
+
*/
|
|
213
|
+
export function shortenAddress(address, chars) {
|
|
214
|
+
if (chars === void 0) { chars = 4; }
|
|
215
|
+
if (!address || typeof address !== 'string') {
|
|
216
|
+
return '';
|
|
217
|
+
}
|
|
218
|
+
var trimmed = address.trim();
|
|
219
|
+
// If address is short enough, return as-is
|
|
220
|
+
if (trimmed.length <= chars * 2 + 3) {
|
|
221
|
+
return trimmed;
|
|
222
|
+
}
|
|
223
|
+
// Handle EVM addresses (0x prefix)
|
|
224
|
+
if (trimmed.startsWith('0x')) {
|
|
225
|
+
return "".concat(trimmed.slice(0, chars + 2), "...").concat(trimmed.slice(-chars));
|
|
226
|
+
}
|
|
227
|
+
// Handle Solana or other addresses
|
|
228
|
+
return "".concat(trimmed.slice(0, chars), "...").concat(trimmed.slice(-chars));
|
|
229
|
+
}
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
// Conversion
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
/**
|
|
234
|
+
* Converts a Solana PublicKey to its base58 string representation.
|
|
235
|
+
*
|
|
236
|
+
* @param pubkey - The PublicKey to convert (can be PublicKey object or Uint8Array)
|
|
237
|
+
* @returns Base58 string representation
|
|
238
|
+
*/
|
|
239
|
+
export function solanaPublicKeyToString(pubkey) {
|
|
240
|
+
if (pubkey instanceof PublicKey) {
|
|
241
|
+
return pubkey.toBase58();
|
|
242
|
+
}
|
|
243
|
+
return new PublicKey(pubkey).toBase58();
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Converts a base58 string to a Solana PublicKey.
|
|
247
|
+
*
|
|
248
|
+
* @param address - The base58 address string
|
|
249
|
+
* @returns PublicKey object, or null if invalid
|
|
250
|
+
*/
|
|
251
|
+
export function stringToSolanaPublicKey(address) {
|
|
252
|
+
try {
|
|
253
|
+
return new PublicKey(address);
|
|
254
|
+
}
|
|
255
|
+
catch (_a) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
// Type Guards
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
/**
|
|
263
|
+
* Type guard to check if an address is a valid EVM address.
|
|
264
|
+
*/
|
|
265
|
+
export function isEVMAddress(address) {
|
|
266
|
+
return typeof address === 'string' && isValidEVMAddress(address);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Type guard to check if an address is a valid Solana address.
|
|
270
|
+
*/
|
|
271
|
+
export function isSolanaAddress(address) {
|
|
272
|
+
return typeof address === 'string' && isValidSolanaAddress(address);
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src/utils/address.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Address utilities for validation and normalization across Solana and EVM chains.\n * Uses library functions from @solana/web3.js and viem for proper validation.\n * Centralizes address handling that was previously scattered across multiple files.\n */\n\nimport { PublicKey } from '@solana/web3.js';\nimport { isAddress as viemIsAddress, getAddress as viemGetAddress } from 'viem';\n\n// ---------------------------------------------------------------------------\n// Solana Address Validation\n// ---------------------------------------------------------------------------\n\n/**\n * Validates a Solana address by attempting to construct a PublicKey.\n * This validates the base58 encoding and length.\n *\n * @param address - The address to validate\n * @returns true if valid Solana address format\n */\nexport function isValidSolanaAddress(address: string): boolean {\n if (!address || typeof address !== 'string') {\n return false;\n }\n\n try {\n new PublicKey(address);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Validates a Solana wallet address (must be on the ed25519 curve).\n * PDAs (Program Derived Addresses) are intentionally off-curve and will return false.\n * Use isValidSolanaAddress() if you need to accept PDAs.\n *\n * @param address - The address to validate\n * @returns true if valid Solana wallet address on the ed25519 curve\n */\nexport function isValidSolanaWalletAddress(address: string): boolean {\n if (!address || typeof address !== 'string') {\n return false;\n }\n\n try {\n const pubkey = new PublicKey(address);\n return PublicKey.isOnCurve(pubkey.toBytes());\n } catch {\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// EVM Address Validation\n// ---------------------------------------------------------------------------\n\n/**\n * Validates an EVM address using viem's isAddress function.\n * Uses strict: false to accept addresses regardless of checksum.\n *\n * @param address - The address to validate\n * @returns true if valid EVM address format\n */\nexport function isValidEVMAddress(address: string): boolean {\n if (!address || typeof address !== 'string') {\n return false;\n }\n\n // Use strict: false to accept addresses regardless of checksum\n return viemIsAddress(address, { strict: false });\n}\n\n/**\n * Validates an EVM address with strict checksum validation.\n *\n * @param address - The address to validate\n * @returns true if valid EVM address with correct checksum\n */\nexport function isValidEVMAddressStrict(address: string): boolean {\n if (!address || typeof address !== 'string') {\n return false;\n }\n\n return viemIsAddress(address, { strict: true });\n}\n\n// ---------------------------------------------------------------------------\n// Universal Validation\n// ---------------------------------------------------------------------------\n\n/**\n * Validates an address for either Solana or EVM.\n *\n * @param address - The address to validate\n * @returns Object with isValid flag and detected network type\n */\nexport function validateAddress(address: string): {\n isValid: boolean;\n network: 'solana' | 'evm' | null;\n} {\n if (isValidEVMAddress(address)) {\n return { isValid: true, network: 'evm' };\n }\n if (isValidSolanaAddress(address)) {\n return { isValid: true, network: 'solana' };\n }\n return { isValid: false, network: null };\n}\n\n// ---------------------------------------------------------------------------\n// Normalization\n// ---------------------------------------------------------------------------\n\n/**\n * Normalizes an EVM address to checksummed format using viem.\n * This is the canonical format for EVM addresses.\n *\n * @param address - The EVM address to normalize\n * @returns Checksummed address, or empty string if invalid\n */\nexport function normalizeEVMAddress(address: string | null | undefined): string {\n if (!address || typeof address !== 'string') {\n return '';\n }\n\n try {\n return viemGetAddress(address);\n } catch {\n // If getAddress fails, return lowercase as fallback\n return address.toLowerCase().trim();\n }\n}\n\n/**\n * Normalizes an EVM address to lowercase for comparison purposes.\n * This replaces the duplicated normalizeAddress functions in TurnkeyProvider.tsx\n * and turnkeySessionStorage.ts.\n *\n * @param address - The EVM address to normalize\n * @returns Lowercase address, or empty string if invalid\n */\nexport function normalizeEVMAddressLowercase(address: string | null | undefined): string {\n if (!address || typeof address !== 'string') {\n return '';\n }\n return address.toLowerCase().trim();\n}\n\n/**\n * Normalizes a Solana address (trimming whitespace).\n * Solana addresses are case-sensitive (base58), so we only trim.\n *\n * @param address - The Solana address to normalize\n * @returns Trimmed address, or empty string if invalid\n */\nexport function normalizeSolanaAddress(address: string | null | undefined): string {\n if (!address || typeof address !== 'string') {\n return '';\n }\n return address.trim();\n}\n\n/**\n * Normalizes any address based on detected type.\n * EVM addresses are lowercased, Solana addresses are trimmed.\n *\n * @param address - The address to normalize\n * @returns Normalized address\n */\nexport function normalizeAddress(address: string | null | undefined): string {\n if (!address || typeof address !== 'string') {\n return '';\n }\n\n const trimmed = address.trim();\n\n // If it looks like an EVM address, lowercase it for comparison\n if (trimmed.startsWith('0x')) {\n return trimmed.toLowerCase();\n }\n\n // Otherwise treat as Solana (case-sensitive)\n return trimmed;\n}\n\n// ---------------------------------------------------------------------------\n// Comparison\n// ---------------------------------------------------------------------------\n\n/**\n * Compares two addresses for equality.\n * Handles case-insensitive comparison for EVM and case-sensitive for Solana.\n *\n * @param a - First address\n * @param b - Second address\n * @returns true if addresses are equal\n */\nexport function compareAddresses(\n a: string | null | undefined,\n b: string | null | undefined\n): boolean {\n if (!a || !b) {\n return a === b; // Both null/undefined = equal, one null = not equal\n }\n\n return normalizeAddress(a) === normalizeAddress(b);\n}\n\n/**\n * Compares two EVM addresses for equality using viem's address comparison.\n * More robust than string comparison.\n *\n * @param a - First EVM address\n * @param b - Second EVM address\n * @returns true if addresses are equal\n */\nexport function compareEVMAddresses(\n a: string | null | undefined,\n b: string | null | undefined\n): boolean {\n if (!a || !b) {\n return a === b;\n }\n\n try {\n return viemGetAddress(a) === viemGetAddress(b);\n } catch {\n // Fall back to lowercase comparison if getAddress fails\n return a.toLowerCase() === b.toLowerCase();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Formatting\n// ---------------------------------------------------------------------------\n\n/**\n * Shortens an address for display.\n * Example: \"0x1234567890abcdef1234567890abcdef12345678\" -> \"0x1234...5678\"\n *\n * @param address - The address to shorten\n * @param chars - Number of characters to show at start/end (default: 4)\n * @returns Shortened address\n */\nexport function shortenAddress(address: string | null | undefined, chars: number = 4): string {\n if (!address || typeof address !== 'string') {\n return '';\n }\n\n const trimmed = address.trim();\n\n // If address is short enough, return as-is\n if (trimmed.length <= chars * 2 + 3) {\n return trimmed;\n }\n\n // Handle EVM addresses (0x prefix)\n if (trimmed.startsWith('0x')) {\n return `${trimmed.slice(0, chars + 2)}...${trimmed.slice(-chars)}`;\n }\n\n // Handle Solana or other addresses\n return `${trimmed.slice(0, chars)}...${trimmed.slice(-chars)}`;\n}\n\n// ---------------------------------------------------------------------------\n// Conversion\n// ---------------------------------------------------------------------------\n\n/**\n * Converts a Solana PublicKey to its base58 string representation.\n *\n * @param pubkey - The PublicKey to convert (can be PublicKey object or Uint8Array)\n * @returns Base58 string representation\n */\nexport function solanaPublicKeyToString(pubkey: PublicKey | Uint8Array): string {\n if (pubkey instanceof PublicKey) {\n return pubkey.toBase58();\n }\n return new PublicKey(pubkey).toBase58();\n}\n\n/**\n * Converts a base58 string to a Solana PublicKey.\n *\n * @param address - The base58 address string\n * @returns PublicKey object, or null if invalid\n */\nexport function stringToSolanaPublicKey(address: string): PublicKey | null {\n try {\n return new PublicKey(address);\n } catch {\n return null;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Type Guards\n// ---------------------------------------------------------------------------\n\n/**\n * Type guard to check if an address is a valid EVM address.\n */\nexport function isEVMAddress(address: unknown): address is string {\n return typeof address === 'string' && isValidEVMAddress(address);\n}\n\n/**\n * Type guard to check if an address is a valid Solana address.\n */\nexport function isSolanaAddress(address: unknown): address is string {\n return typeof address === 'string' && isValidSolanaAddress(address);\n}\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain utilities for handling chain IDs and network identification.
|
|
3
|
+
* Centralizes chain handling that was previously scattered across multiple files.
|
|
4
|
+
*
|
|
5
|
+
* Integrates with:
|
|
6
|
+
* - viem's Chain type for EVM chains
|
|
7
|
+
* - Project's src/config/chains.tsx for network configuration
|
|
8
|
+
*/
|
|
9
|
+
import type { Chain as ViemChain } from 'viem';
|
|
10
|
+
export type NetworkType = 'solana' | 'evm';
|
|
11
|
+
export interface ChainInfo {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
network: NetworkType;
|
|
15
|
+
chainId?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes a chain ID to hexadecimal format (e.g., "0x1").
|
|
19
|
+
* This is the format expected by EIP-1193 providers.
|
|
20
|
+
*
|
|
21
|
+
* Handles:
|
|
22
|
+
* - Numbers (1 -> "0x1")
|
|
23
|
+
* - Hex strings ("0x1" -> "0x1")
|
|
24
|
+
* - Decimal strings ("1" -> "0x1")
|
|
25
|
+
* - Objects with chainId or id properties (viem Chain objects)
|
|
26
|
+
*
|
|
27
|
+
* Replaces the normalizeChainId function in createWalletProvider.ts
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeChainId(value: unknown): string;
|
|
30
|
+
/**
|
|
31
|
+
* Converts a chain ID to a number.
|
|
32
|
+
* Handles hex strings, decimal strings, numbers, and viem Chain objects.
|
|
33
|
+
*/
|
|
34
|
+
export declare function chainIdToNumber(value: unknown): number | null;
|
|
35
|
+
/**
|
|
36
|
+
* Normalizes a chain identifier to a canonical name.
|
|
37
|
+
* Handles various formats: names, aliases, chain IDs (number or hex).
|
|
38
|
+
*
|
|
39
|
+
* Examples:
|
|
40
|
+
* - "arb" -> "arbitrum"
|
|
41
|
+
* - "ETH" -> "ethereum"
|
|
42
|
+
* - "arbitrum-one" -> "arbitrum"
|
|
43
|
+
* - "0x1" -> "ethereum"
|
|
44
|
+
* - 42161 -> "arbitrum"
|
|
45
|
+
*/
|
|
46
|
+
export declare function normalizeChainName(chain: string | number | null | undefined): string;
|
|
47
|
+
/**
|
|
48
|
+
* Normalizes a chain for CCTP (Circle's Cross-Chain Transfer Protocol).
|
|
49
|
+
* Replaces normalizeCctpChain in bridgeUtils.ts
|
|
50
|
+
*/
|
|
51
|
+
export declare function normalizeCctpChain(chain: string | null | undefined): string;
|
|
52
|
+
/**
|
|
53
|
+
* Derives a chain label for display.
|
|
54
|
+
* Returns both an id and a display name.
|
|
55
|
+
* Replaces deriveChainLabel in bridgeUtils.ts
|
|
56
|
+
*/
|
|
57
|
+
export declare function deriveChainLabel(chainId: string | null | undefined): {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Gets chain information from a chain identifier.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getChainInfo(chain: string | number | null | undefined): ChainInfo | null;
|
|
65
|
+
/**
|
|
66
|
+
* Checks if a chain is Solana.
|
|
67
|
+
*/
|
|
68
|
+
export declare function isSolanaChain(chain: string | null | undefined): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Checks if a chain is an EVM chain.
|
|
71
|
+
*/
|
|
72
|
+
export declare function isEVMChain(chain: string | number | null | undefined): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Detects the network type from a chain identifier.
|
|
75
|
+
*/
|
|
76
|
+
export declare function detectNetworkType(chain: string | number | null | undefined): NetworkType | null;
|
|
77
|
+
/**
|
|
78
|
+
* Extracts the chain ID from a viem Chain object.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getChainIdFromViemChain(chain: ViemChain | null | undefined): number | null;
|
|
81
|
+
/**
|
|
82
|
+
* Checks if a chain ID matches a viem Chain object.
|
|
83
|
+
*/
|
|
84
|
+
export declare function chainIdMatchesViemChain(chainId: unknown, chain: ViemChain): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Validates a chain ID format.
|
|
87
|
+
* Returns true if it's a valid hex string or positive number.
|
|
88
|
+
*/
|
|
89
|
+
export declare function isValidChainId(value: unknown): boolean;
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain utilities for handling chain IDs and network identification.
|
|
3
|
+
* Centralizes chain handling that was previously scattered across multiple files.
|
|
4
|
+
*
|
|
5
|
+
* Integrates with:
|
|
6
|
+
* - viem's Chain type for EVM chains
|
|
7
|
+
* - Project's src/config/chains.tsx for network configuration
|
|
8
|
+
*/
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Chain ID Normalization (from createWalletProvider.ts)
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes a chain ID to hexadecimal format (e.g., "0x1").
|
|
14
|
+
* This is the format expected by EIP-1193 providers.
|
|
15
|
+
*
|
|
16
|
+
* Handles:
|
|
17
|
+
* - Numbers (1 -> "0x1")
|
|
18
|
+
* - Hex strings ("0x1" -> "0x1")
|
|
19
|
+
* - Decimal strings ("1" -> "0x1")
|
|
20
|
+
* - Objects with chainId or id properties (viem Chain objects)
|
|
21
|
+
*
|
|
22
|
+
* Replaces the normalizeChainId function in createWalletProvider.ts
|
|
23
|
+
*/
|
|
24
|
+
export function normalizeChainId(value) {
|
|
25
|
+
// Handle objects with chainId or id properties (including viem Chain objects)
|
|
26
|
+
if (value && typeof value === 'object') {
|
|
27
|
+
var candidate = value;
|
|
28
|
+
if (typeof candidate.chainId === 'number' || typeof candidate.chainId === 'string') {
|
|
29
|
+
return normalizeChainId(candidate.chainId);
|
|
30
|
+
}
|
|
31
|
+
if (typeof candidate.id === 'number' || typeof candidate.id === 'string') {
|
|
32
|
+
return normalizeChainId(candidate.id);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Handle numbers
|
|
36
|
+
if (typeof value === 'number') {
|
|
37
|
+
return "0x".concat(value.toString(16));
|
|
38
|
+
}
|
|
39
|
+
// Handle strings
|
|
40
|
+
if (typeof value === 'string') {
|
|
41
|
+
// Already hex format
|
|
42
|
+
if (value.startsWith('0x')) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
// Try to parse as decimal
|
|
46
|
+
var numeric = Number(value);
|
|
47
|
+
if (!Number.isNaN(numeric)) {
|
|
48
|
+
return "0x".concat(numeric.toString(16));
|
|
49
|
+
}
|
|
50
|
+
// Return as-is (might be a chain name)
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
// Default to Ethereum mainnet
|
|
54
|
+
return '0x1';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts a chain ID to a number.
|
|
58
|
+
* Handles hex strings, decimal strings, numbers, and viem Chain objects.
|
|
59
|
+
*/
|
|
60
|
+
export function chainIdToNumber(value) {
|
|
61
|
+
// Handle viem Chain objects
|
|
62
|
+
if (value && typeof value === 'object') {
|
|
63
|
+
var candidate = value;
|
|
64
|
+
if (typeof candidate.id === 'number')
|
|
65
|
+
return candidate.id;
|
|
66
|
+
if (typeof candidate.chainId === 'number')
|
|
67
|
+
return candidate.chainId;
|
|
68
|
+
}
|
|
69
|
+
if (typeof value === 'number') {
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
if (typeof value === 'string') {
|
|
73
|
+
if (value.startsWith('0x')) {
|
|
74
|
+
return parseInt(value, 16);
|
|
75
|
+
}
|
|
76
|
+
var parsed = parseInt(value, 10);
|
|
77
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Chain Name Normalization (from bridgeUtils.ts)
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
/**
|
|
85
|
+
* Chain name aliases mapped to canonical names.
|
|
86
|
+
*/
|
|
87
|
+
var CHAIN_ALIASES = {
|
|
88
|
+
// Ethereum
|
|
89
|
+
eth: 'ethereum',
|
|
90
|
+
mainnet: 'ethereum',
|
|
91
|
+
evm: 'ethereum',
|
|
92
|
+
// Arbitrum
|
|
93
|
+
arb: 'arbitrum',
|
|
94
|
+
'arbitrum-one': 'arbitrum',
|
|
95
|
+
// Solana
|
|
96
|
+
sol: 'solana',
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Known EVM chain IDs to canonical names.
|
|
100
|
+
*/
|
|
101
|
+
var CHAIN_ID_TO_NAME = {
|
|
102
|
+
// Mainnets
|
|
103
|
+
1: 'ethereum',
|
|
104
|
+
42161: 'arbitrum',
|
|
105
|
+
8453: 'base',
|
|
106
|
+
// Testnets
|
|
107
|
+
11155111: 'ethereum',
|
|
108
|
+
421614: 'arbitrum',
|
|
109
|
+
84532: 'base',
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Normalizes a chain identifier to a canonical name.
|
|
113
|
+
* Handles various formats: names, aliases, chain IDs (number or hex).
|
|
114
|
+
*
|
|
115
|
+
* Examples:
|
|
116
|
+
* - "arb" -> "arbitrum"
|
|
117
|
+
* - "ETH" -> "ethereum"
|
|
118
|
+
* - "arbitrum-one" -> "arbitrum"
|
|
119
|
+
* - "0x1" -> "ethereum"
|
|
120
|
+
* - 42161 -> "arbitrum"
|
|
121
|
+
*/
|
|
122
|
+
export function normalizeChainName(chain) {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
if (chain === null || chain === undefined)
|
|
125
|
+
return 'ethereum';
|
|
126
|
+
// Handle numeric chain IDs
|
|
127
|
+
if (typeof chain === 'number') {
|
|
128
|
+
return (_a = CHAIN_ID_TO_NAME[chain]) !== null && _a !== void 0 ? _a : 'ethereum';
|
|
129
|
+
}
|
|
130
|
+
var lower = chain.toLowerCase().trim();
|
|
131
|
+
// Check if it's a hex chain ID
|
|
132
|
+
if (lower.startsWith('0x')) {
|
|
133
|
+
var numericId = parseInt(lower, 16);
|
|
134
|
+
return (_b = CHAIN_ID_TO_NAME[numericId]) !== null && _b !== void 0 ? _b : 'ethereum';
|
|
135
|
+
}
|
|
136
|
+
// Check if it's a decimal chain ID string
|
|
137
|
+
var numeric = parseInt(lower, 10);
|
|
138
|
+
if (!Number.isNaN(numeric) && CHAIN_ID_TO_NAME[numeric]) {
|
|
139
|
+
return CHAIN_ID_TO_NAME[numeric];
|
|
140
|
+
}
|
|
141
|
+
// Check aliases
|
|
142
|
+
if (CHAIN_ALIASES[lower]) {
|
|
143
|
+
return CHAIN_ALIASES[lower];
|
|
144
|
+
}
|
|
145
|
+
// Return as-is if it's a known chain name or unknown
|
|
146
|
+
return lower;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Normalizes a chain for CCTP (Circle's Cross-Chain Transfer Protocol).
|
|
150
|
+
* Replaces normalizeCctpChain in bridgeUtils.ts
|
|
151
|
+
*/
|
|
152
|
+
export function normalizeCctpChain(chain) {
|
|
153
|
+
if (!chain)
|
|
154
|
+
return 'ethereum';
|
|
155
|
+
var lower = chain.toLowerCase();
|
|
156
|
+
if (lower === 'evm')
|
|
157
|
+
return 'ethereum';
|
|
158
|
+
if (lower === 'arb' || lower === 'arbitrum' || lower === 'arbitrum-one')
|
|
159
|
+
return 'arbitrum';
|
|
160
|
+
if (lower === 'base')
|
|
161
|
+
return 'base';
|
|
162
|
+
return lower;
|
|
163
|
+
}
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Chain Info & Labels (from bridgeUtils.ts)
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
var CHAIN_DISPLAY_NAMES = {
|
|
168
|
+
solana: 'Solana',
|
|
169
|
+
ethereum: 'Ethereum',
|
|
170
|
+
arbitrum: 'Arbitrum',
|
|
171
|
+
base: 'Base',
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Derives a chain label for display.
|
|
175
|
+
* Returns both an id and a display name.
|
|
176
|
+
* Replaces deriveChainLabel in bridgeUtils.ts
|
|
177
|
+
*/
|
|
178
|
+
export function deriveChainLabel(chainId) {
|
|
179
|
+
var _a;
|
|
180
|
+
if (!chainId)
|
|
181
|
+
return { id: 'solana', name: 'Solana' };
|
|
182
|
+
var normalized = normalizeChainName(chainId);
|
|
183
|
+
var displayName = (_a = CHAIN_DISPLAY_NAMES[normalized]) !== null && _a !== void 0 ? _a : chainId;
|
|
184
|
+
return { id: normalized, name: displayName };
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Gets chain information from a chain identifier.
|
|
188
|
+
*/
|
|
189
|
+
export function getChainInfo(chain) {
|
|
190
|
+
if (chain === null || chain === undefined)
|
|
191
|
+
return null;
|
|
192
|
+
var normalized = normalizeChainName(chain);
|
|
193
|
+
var displayName = CHAIN_DISPLAY_NAMES[normalized];
|
|
194
|
+
if (!displayName)
|
|
195
|
+
return null;
|
|
196
|
+
var network = normalized === 'solana' ? 'solana' : 'evm';
|
|
197
|
+
return {
|
|
198
|
+
id: normalized,
|
|
199
|
+
name: displayName,
|
|
200
|
+
network: network,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
// Network Type Detection
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
/**
|
|
207
|
+
* Checks if a chain is Solana.
|
|
208
|
+
*/
|
|
209
|
+
export function isSolanaChain(chain) {
|
|
210
|
+
if (!chain)
|
|
211
|
+
return false;
|
|
212
|
+
return normalizeChainName(chain) === 'solana';
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Checks if a chain is an EVM chain.
|
|
216
|
+
*/
|
|
217
|
+
export function isEVMChain(chain) {
|
|
218
|
+
if (chain === null || chain === undefined)
|
|
219
|
+
return false;
|
|
220
|
+
// Numeric chain IDs are always EVM
|
|
221
|
+
if (typeof chain === 'number')
|
|
222
|
+
return true;
|
|
223
|
+
var lower = chain.toLowerCase().trim();
|
|
224
|
+
// Hex chain IDs are EVM
|
|
225
|
+
if (lower.startsWith('0x'))
|
|
226
|
+
return true;
|
|
227
|
+
// Normalize and check
|
|
228
|
+
var normalized = normalizeChainName(chain);
|
|
229
|
+
return normalized !== 'solana';
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Detects the network type from a chain identifier.
|
|
233
|
+
*/
|
|
234
|
+
export function detectNetworkType(chain) {
|
|
235
|
+
if (chain === null || chain === undefined)
|
|
236
|
+
return null;
|
|
237
|
+
if (isSolanaChain(chain))
|
|
238
|
+
return 'solana';
|
|
239
|
+
if (isEVMChain(chain))
|
|
240
|
+
return 'evm';
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
// ---------------------------------------------------------------------------
|
|
244
|
+
// Viem Chain Helpers
|
|
245
|
+
// ---------------------------------------------------------------------------
|
|
246
|
+
/**
|
|
247
|
+
* Extracts the chain ID from a viem Chain object.
|
|
248
|
+
*/
|
|
249
|
+
export function getChainIdFromViemChain(chain) {
|
|
250
|
+
if (!chain)
|
|
251
|
+
return null;
|
|
252
|
+
return chain.id;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Checks if a chain ID matches a viem Chain object.
|
|
256
|
+
*/
|
|
257
|
+
export function chainIdMatchesViemChain(chainId, chain) {
|
|
258
|
+
var numericId = chainIdToNumber(chainId);
|
|
259
|
+
return numericId === chain.id;
|
|
260
|
+
}
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
// Chain ID Validation
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
/**
|
|
265
|
+
* Validates a chain ID format.
|
|
266
|
+
* Returns true if it's a valid hex string or positive number.
|
|
267
|
+
*/
|
|
268
|
+
export function isValidChainId(value) {
|
|
269
|
+
if (typeof value === 'number' && Number.isFinite(value) && value > 0) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
if (typeof value === 'string') {
|
|
273
|
+
if (value.startsWith('0x')) {
|
|
274
|
+
var hex = value.slice(2);
|
|
275
|
+
return /^[0-9a-fA-F]+$/.test(hex) && hex.length > 0;
|
|
276
|
+
}
|
|
277
|
+
var numeric = parseInt(value, 10);
|
|
278
|
+
return !Number.isNaN(numeric) && numeric > 0;
|
|
279
|
+
}
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=chain.js.map
|