@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,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface that matches the EIP-1193 request method signature.
|
|
3
|
+
*/
|
|
4
|
+
interface Eip1193Provider {
|
|
5
|
+
request: (args: {
|
|
6
|
+
method: string;
|
|
7
|
+
params?: any[] | any;
|
|
8
|
+
}) => Promise<any>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Intercepts EIP-1193 provider requests to capture transaction hashes for specific actions.
|
|
12
|
+
* This is used to capture the "Burn" transaction hash in CCTP flows *before* the
|
|
13
|
+
* high-level BridgeKit client resolves, allowing for immediate UI updates and state persistence.
|
|
14
|
+
*/
|
|
15
|
+
export declare class EvmTxInterceptor {
|
|
16
|
+
private capturedTx;
|
|
17
|
+
private readonly callback;
|
|
18
|
+
constructor(onTxCaptured: (txHash: string) => void);
|
|
19
|
+
/**
|
|
20
|
+
* Wraps an EIP-1193 provider (or generic wallet object with a request method)
|
|
21
|
+
* to intercept eth_sendTransaction and eth_sendRawTransaction calls.
|
|
22
|
+
*/
|
|
23
|
+
wrap(provider: Eip1193Provider | any): any;
|
|
24
|
+
private inspectRequest;
|
|
25
|
+
private shouldIgnoreTransaction;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
import { logger } from '../../../../utils/logger';
|
|
49
|
+
/**
|
|
50
|
+
* ERC20 function selectors to ignore when looking for burn transactions.
|
|
51
|
+
* Currently ignoring:
|
|
52
|
+
* - increaseAllowance(address,uint256) -> 0x39509351
|
|
53
|
+
*/
|
|
54
|
+
var IGNORED_SELECTORS = new Set([
|
|
55
|
+
'0x39509351', // increaseAllowance
|
|
56
|
+
]);
|
|
57
|
+
/**
|
|
58
|
+
* Intercepts EIP-1193 provider requests to capture transaction hashes for specific actions.
|
|
59
|
+
* This is used to capture the "Burn" transaction hash in CCTP flows *before* the
|
|
60
|
+
* high-level BridgeKit client resolves, allowing for immediate UI updates and state persistence.
|
|
61
|
+
*/
|
|
62
|
+
var EvmTxInterceptor = /** @class */ (function () {
|
|
63
|
+
function EvmTxInterceptor(onTxCaptured) {
|
|
64
|
+
this.capturedTx = null;
|
|
65
|
+
this.callback = onTxCaptured;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Wraps an EIP-1193 provider (or generic wallet object with a request method)
|
|
69
|
+
* to intercept eth_sendTransaction and eth_sendRawTransaction calls.
|
|
70
|
+
*/
|
|
71
|
+
EvmTxInterceptor.prototype.wrap = function (provider) {
|
|
72
|
+
var _this = this;
|
|
73
|
+
if (!provider || typeof provider.request !== 'function') {
|
|
74
|
+
return provider;
|
|
75
|
+
}
|
|
76
|
+
var self = this;
|
|
77
|
+
var originalRequest = provider.request.bind(provider);
|
|
78
|
+
return __assign(__assign({}, provider), { request: function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
79
|
+
var result;
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0: return [4 /*yield*/, originalRequest(args)];
|
|
83
|
+
case 1:
|
|
84
|
+
result = _a.sent();
|
|
85
|
+
self.inspectRequest(args, result);
|
|
86
|
+
return [2 /*return*/, result];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}); } });
|
|
90
|
+
};
|
|
91
|
+
EvmTxInterceptor.prototype.inspectRequest = function (args, result) {
|
|
92
|
+
var _a;
|
|
93
|
+
// If we already captured a tx, we stop inspecting to avoid overwriting with subsequent calls
|
|
94
|
+
// (though typically there's only one relevant tx per flow).
|
|
95
|
+
if (this.capturedTx)
|
|
96
|
+
return;
|
|
97
|
+
var method = String((_a = args === null || args === void 0 ? void 0 : args.method) !== null && _a !== void 0 ? _a : '');
|
|
98
|
+
// We only care about transaction sending methods
|
|
99
|
+
if (method !== 'eth_sendTransaction' && method !== 'eth_sendRawTransaction') {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// Result of these methods should be a transaction hash string (0x...)
|
|
103
|
+
if (typeof result !== 'string' || !result.startsWith('0x')) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
if (this.shouldIgnoreTransaction(method, args)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
// If we got here, it's a transaction we want to capture
|
|
111
|
+
this.capturedTx = result;
|
|
112
|
+
logger.info('[EvmTxInterceptor] Captured EVM tx hash', {
|
|
113
|
+
method: method,
|
|
114
|
+
tx: result,
|
|
115
|
+
});
|
|
116
|
+
this.callback(result);
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
logger.warn('[EvmTxInterceptor] Failed to inspect transaction', e);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
EvmTxInterceptor.prototype.shouldIgnoreTransaction = function (method, args) {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
// If it's a raw tx string, we can't easily parse it without a library like ethers/viem
|
|
125
|
+
// to decode the RLP and data. For safety, we avoid capturing these unless we are sure.
|
|
126
|
+
// However, typically CCTP flows via wagmi/viem might use sendTransaction with an object.
|
|
127
|
+
var params = Array.isArray(args === null || args === void 0 ? void 0 : args.params) ? args.params[0] : undefined;
|
|
128
|
+
// eth_sendRawTransaction takes a hex string as the first param
|
|
129
|
+
if (method === 'eth_sendRawTransaction' && typeof params === 'string') {
|
|
130
|
+
// Logic decision: If we can't inspect the data, we might capture the wrong tx (e.g. approve).
|
|
131
|
+
// So we skip raw transactions. BridgeKit usually handles the flow so we rely on return value fallback.
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
// eth_sendTransaction takes a transaction object
|
|
135
|
+
if (typeof params === 'object' && params !== null) {
|
|
136
|
+
var dataField = ((_b = (_a = params.data) !== null && _a !== void 0 ? _a : params.input) !== null && _b !== void 0 ? _b : '');
|
|
137
|
+
var data = typeof dataField === 'string' ? dataField.toLowerCase() : '';
|
|
138
|
+
// Check function selector (first 4 bytes = 8 hex chars + '0x' prefix = 10 chars)
|
|
139
|
+
var selector = data.length >= 10 ? data.slice(0, 10) : '';
|
|
140
|
+
if (selector && IGNORED_SELECTORS.has(selector)) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
};
|
|
146
|
+
return EvmTxInterceptor;
|
|
147
|
+
}());
|
|
148
|
+
export { EvmTxInterceptor };
|
|
149
|
+
//# sourceMappingURL=evmTxInterceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evmTxInterceptor.js","sourceRoot":"","sources":["../../../../../../src/features/onboarding-flow/utils/deposit/evmTxInterceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AASlD;;;;GAIG;AACH,IAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAC9B,YAAY,EAAE,oBAAoB;CACrC,CAAC,CAAC;AAEH;;;;GAIG;AACH;IAII,0BAAY,YAAsC;QAH1C,eAAU,GAAkB,IAAI,CAAC;QAIrC,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,+BAAI,GAAX,UAAY,QAA+B;QAA3C,iBAgBC;QAfG,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YACtD,OAAO,QAAQ,CAAC;QACpB,CAAC;QAED,IAAM,IAAI,GAAG,IAAI,CAAC;QAClB,IAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAExD,6BACO,QAAQ,KACX,OAAO,EAAE,UAAO,IAAS;;;;gCACN,qBAAM,eAAe,CAAC,IAAI,CAAC,EAAA;;4BAApC,MAAM,GAAG,SAA2B;4BAC1C,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;4BAClC,sBAAO,MAAM,EAAC;;;iBACjB,IACH;IACN,CAAC;IAEO,yCAAc,GAAtB,UAAuB,IAAS,EAAE,MAAW;;QACzC,6FAA6F;QAC7F,4DAA4D;QAC5D,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAE5B,IAAM,MAAM,GAAG,MAAM,CAAC,MAAA,IAAI,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KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAChD,IAAM,SAAS,GAAG,CAAC,MAAA,MAAA,MAAM,CAAC,IAAI,mCAAI,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAY,CAAC;YACjE,IAAM,IAAI,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAE1E,iFAAiF;YACjF,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAE5D,IAAI,QAAQ,IAAI,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9C,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IACL,uBAAC;AAAD,CAAC,AA9FD,IA8FC","sourcesContent":["import { logger } from '../../../../utils/logger';\n\n/**\n * Interface that matches the EIP-1193 request method signature.\n */\ninterface Eip1193Provider {\n request: (args: { method: string; params?: any[] | any }) => Promise<any>;\n}\n\n/**\n * ERC20 function selectors to ignore when looking for burn transactions.\n * Currently ignoring:\n * - increaseAllowance(address,uint256) -> 0x39509351\n */\nconst IGNORED_SELECTORS = new Set([\n '0x39509351', // increaseAllowance\n]);\n\n/**\n * Intercepts EIP-1193 provider requests to capture transaction hashes for specific actions.\n * This is used to capture the \"Burn\" transaction hash in CCTP flows *before* the\n * high-level BridgeKit client resolves, allowing for immediate UI updates and state persistence.\n */\nexport class EvmTxInterceptor {\n private capturedTx: string | null = null;\n private readonly callback: (txHash: string) => void;\n\n constructor(onTxCaptured: (txHash: string) => void) {\n this.callback = onTxCaptured;\n }\n\n /**\n * Wraps an EIP-1193 provider (or generic wallet object with a request method)\n * to intercept eth_sendTransaction and eth_sendRawTransaction calls.\n */\n public wrap(provider: Eip1193Provider | any): any {\n if (!provider || typeof provider.request !== 'function') {\n return provider;\n }\n\n const self = this;\n const originalRequest = provider.request.bind(provider);\n\n return {\n ...provider,\n request: async (args: any) => {\n const result = await originalRequest(args);\n self.inspectRequest(args, result);\n return result;\n },\n };\n }\n\n private inspectRequest(args: any, result: any) {\n // If we already captured a tx, we stop inspecting to avoid overwriting with subsequent calls\n // (though typically there's only one relevant tx per flow).\n if (this.capturedTx) return;\n\n const method = String(args?.method ?? '');\n\n // We only care about transaction sending methods\n if (method !== 'eth_sendTransaction' && method !== 'eth_sendRawTransaction') {\n return;\n }\n\n // Result of these methods should be a transaction hash string (0x...)\n if (typeof result !== 'string' || !result.startsWith('0x')) {\n return;\n }\n\n try {\n if (this.shouldIgnoreTransaction(method, args)) {\n return;\n }\n\n // If we got here, it's a transaction we want to capture\n this.capturedTx = result;\n logger.info('[EvmTxInterceptor] Captured EVM tx hash', {\n method,\n tx: result,\n });\n\n this.callback(result);\n\n } catch (e) {\n logger.warn('[EvmTxInterceptor] Failed to inspect transaction', e);\n }\n }\n\n private shouldIgnoreTransaction(method: string, args: any): boolean {\n // If it's a raw tx string, we can't easily parse it without a library like ethers/viem\n // to decode the RLP and data. For safety, we avoid capturing these unless we are sure.\n // However, typically CCTP flows via wagmi/viem might use sendTransaction with an object.\n const params = Array.isArray(args?.params) ? args.params[0] : undefined;\n\n // eth_sendRawTransaction takes a hex string as the first param\n if (method === 'eth_sendRawTransaction' && typeof params === 'string') {\n // Logic decision: If we can't inspect the data, we might capture the wrong tx (e.g. approve).\n // So we skip raw transactions. BridgeKit usually handles the flow so we rely on return value fallback.\n return true;\n }\n\n // eth_sendTransaction takes a transaction object\n if (typeof params === 'object' && params !== null) {\n const dataField = (params.data ?? params.input ?? '') as unknown;\n const data = typeof dataField === 'string' ? dataField.toLowerCase() : '';\n\n // Check function selector (first 4 bytes = 8 hex chars + '0x' prefix = 10 chars)\n const selector = data.length >= 10 ? data.slice(0, 10) : '';\n\n if (selector && IGNORED_SELECTORS.has(selector)) {\n return true;\n }\n }\n\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
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);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { Connection, PublicKey } from '@solana/web3.js';
|
|
38
|
+
import { Buffer } from 'buffer';
|
|
39
|
+
import { getSolanaRpcUrl } from '../../../../config/solana';
|
|
40
|
+
import { logger } from '../../../../utils/logger';
|
|
41
|
+
import { mapChainToBridgeKit } from '../../cctp/bridgeKitClient';
|
|
42
|
+
// Normalize nonce from Iris API (decimal) or hex into a 32-byte buffer for PDA derivation.
|
|
43
|
+
var normalizeNonceToBuffer = function (nonce) {
|
|
44
|
+
try {
|
|
45
|
+
var trimmed = nonce.trim();
|
|
46
|
+
if (!trimmed)
|
|
47
|
+
return null;
|
|
48
|
+
var hex = '';
|
|
49
|
+
if (trimmed.startsWith('0x')) {
|
|
50
|
+
hex = trimmed.slice(2);
|
|
51
|
+
}
|
|
52
|
+
else if (/^\d+$/.test(trimmed)) {
|
|
53
|
+
hex = BigInt(trimmed).toString(16);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
hex = trimmed;
|
|
57
|
+
}
|
|
58
|
+
var paddedHex = hex.padStart(64, '0');
|
|
59
|
+
var buf = Buffer.from(paddedHex, 'hex');
|
|
60
|
+
if (buf.length !== 32)
|
|
61
|
+
return null;
|
|
62
|
+
return { buf: buf, hex: paddedHex };
|
|
63
|
+
}
|
|
64
|
+
catch (_a) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Checks if the `used_nonce` PDA exists for the given nonce.
|
|
70
|
+
* If it exists, the claim was already processed on Solana and we should not submit it again.
|
|
71
|
+
*/
|
|
72
|
+
export var checkUsedNonceAccount = function (nonce) { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var solanaChain, v2config, normalized, connection, messageTransmitterProgramId, usedNoncePda, accountInfo, exists, error_1;
|
|
74
|
+
var _a, _b, _c, _d, _e, _f;
|
|
75
|
+
return __generator(this, function (_g) {
|
|
76
|
+
switch (_g.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
if (!nonce)
|
|
79
|
+
return [2 /*return*/, false];
|
|
80
|
+
_g.label = 1;
|
|
81
|
+
case 1:
|
|
82
|
+
_g.trys.push([1, 3, , 4]);
|
|
83
|
+
solanaChain = mapChainToBridgeKit('solana');
|
|
84
|
+
v2config = (_b = (_a = solanaChain.cctp) === null || _a === void 0 ? void 0 : _a.contracts) === null || _b === void 0 ? void 0 : _b.v2;
|
|
85
|
+
if (!v2config || v2config.type !== 'split') {
|
|
86
|
+
logger.warn('[BridgeDeposit] Cannot check used nonce: unsupported CCTP config');
|
|
87
|
+
return [2 /*return*/, false];
|
|
88
|
+
}
|
|
89
|
+
normalized = normalizeNonceToBuffer(nonce);
|
|
90
|
+
if (!normalized) {
|
|
91
|
+
logger.warn('[BridgeDeposit] Invalid nonce format for used_nonce check', { nonce: nonce });
|
|
92
|
+
return [2 /*return*/, false];
|
|
93
|
+
}
|
|
94
|
+
connection = new Connection(process.env.NEXT_PUBLIC_NORD_SOLANA_URL || getSolanaRpcUrl());
|
|
95
|
+
messageTransmitterProgramId = new PublicKey(v2config.messageTransmitter);
|
|
96
|
+
usedNoncePda = PublicKey.findProgramAddressSync([Buffer.from('used_nonce'), normalized.buf], messageTransmitterProgramId)[0];
|
|
97
|
+
return [4 /*yield*/, connection.getAccountInfo(usedNoncePda)];
|
|
98
|
+
case 2:
|
|
99
|
+
accountInfo = _g.sent();
|
|
100
|
+
exists = !!accountInfo && ((_d = (_c = accountInfo.data) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0;
|
|
101
|
+
logger.info('[BridgeDeposit] Used nonce account check', {
|
|
102
|
+
nonce: nonce,
|
|
103
|
+
paddedNonceHex: normalized.hex,
|
|
104
|
+
usedNoncePda: usedNoncePda.toBase58(),
|
|
105
|
+
exists: exists,
|
|
106
|
+
dataLength: (_f = (_e = accountInfo === null || accountInfo === void 0 ? void 0 : accountInfo.data) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0,
|
|
107
|
+
});
|
|
108
|
+
return [2 /*return*/, exists];
|
|
109
|
+
case 3:
|
|
110
|
+
error_1 = _g.sent();
|
|
111
|
+
logger.warn('[BridgeDeposit] Failed to check used nonce account', {
|
|
112
|
+
nonce: nonce,
|
|
113
|
+
error: error_1,
|
|
114
|
+
errorMessage: error_1 instanceof Error ? error_1.message : String(error_1),
|
|
115
|
+
});
|
|
116
|
+
return [2 /*return*/, false];
|
|
117
|
+
case 4: return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}); };
|
|
121
|
+
//# sourceMappingURL=nonceUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonceUtils.js","sourceRoot":"","sources":["../../../../../../src/features/onboarding-flow/utils/deposit/nonceUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA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AW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,0CAAE,MAAM,mCAAI,CAAC;iBAC3C,CAAC,CAAC;gBAEH,sBAAO,MAAM,EAAC;;;gBAEd,MAAM,CAAC,IAAI,CAAC,oDAAoD,EAAE;oBAChE,KAAK,OAAA;oBACL,KAAK,SAAA;oBACL,YAAY,EAAE,OAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAK,CAAC;iBACrE,CAAC,CAAC;gBACH,sBAAO,KAAK,EAAC;;;;KAEhB,CAAC","sourcesContent":["import { Connection, PublicKey } from '@solana/web3.js';\nimport { Buffer } from 'buffer';\nimport { getSolanaRpcUrl } from '../../../../config/solana';\nimport { logger } from '../../../../utils/logger';\nimport { mapChainToBridgeKit } from '../../cctp/bridgeKitClient';\n\n// Normalize nonce from Iris API (decimal) or hex into a 32-byte buffer for PDA derivation.\nconst normalizeNonceToBuffer = (nonce: string): { buf: Buffer; hex: string } | null => {\n try {\n const trimmed = nonce.trim();\n if (!trimmed) return null;\n\n let hex = '';\n if (trimmed.startsWith('0x')) {\n hex = trimmed.slice(2);\n } else if (/^\\d+$/.test(trimmed)) {\n hex = BigInt(trimmed).toString(16);\n } else {\n hex = trimmed;\n }\n\n const paddedHex = hex.padStart(64, '0');\n const buf = Buffer.from(paddedHex, 'hex');\n if (buf.length !== 32) return null;\n\n return { buf, hex: paddedHex };\n } catch {\n return null;\n }\n};\n\n/**\n * Checks if the `used_nonce` PDA exists for the given nonce.\n * If it exists, the claim was already processed on Solana and we should not submit it again.\n */\nexport const checkUsedNonceAccount = async (nonce?: string | null): Promise<boolean> => {\n if (!nonce) return false;\n\n try {\n const solanaChain = mapChainToBridgeKit('solana');\n const v2config = solanaChain.cctp?.contracts?.v2;\n if (!v2config || v2config.type !== 'split') {\n logger.warn('[BridgeDeposit] Cannot check used nonce: unsupported CCTP config');\n return false;\n }\n\n const normalized = normalizeNonceToBuffer(nonce);\n if (!normalized) {\n logger.warn('[BridgeDeposit] Invalid nonce format for used_nonce check', { nonce });\n return false;\n }\n\n const connection = new Connection(process.env.NEXT_PUBLIC_NORD_SOLANA_URL || getSolanaRpcUrl());\n const messageTransmitterProgramId = new PublicKey(v2config.messageTransmitter);\n const [usedNoncePda] = PublicKey.findProgramAddressSync(\n [Buffer.from('used_nonce'), normalized.buf],\n messageTransmitterProgramId,\n );\n const accountInfo = await connection.getAccountInfo(usedNoncePda);\n const exists = !!accountInfo && (accountInfo.data?.length ?? 0) > 0;\n\n logger.info('[BridgeDeposit] Used nonce account check', {\n nonce,\n paddedNonceHex: normalized.hex,\n usedNoncePda: usedNoncePda.toBase58(),\n exists,\n dataLength: accountInfo?.data?.length ?? 0,\n });\n\n return exists;\n } catch (error) {\n logger.warn('[BridgeDeposit] Failed to check used nonce account', {\n nonce,\n error,\n errorMessage: error instanceof Error ? error.message : String(error),\n });\n return false;\n }\n};\n\n\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Interface for transaction result
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface SolanaDepositTransactionResult {
|
|
5
5
|
success: boolean;
|
|
6
6
|
transactionId: string;
|
|
7
7
|
amount: string;
|
|
@@ -14,6 +14,6 @@ export interface TransactionResult {
|
|
|
14
14
|
error?: Error;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Constructs Solana explorer URL for a transaction ID (devnet cluster).
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function getSolanaExplorerUrl(transactionId: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructs Solana explorer URL for a transaction ID (devnet cluster).
|
|
3
|
+
*/
|
|
4
|
+
export function getSolanaExplorerUrl(transactionId) {
|
|
5
|
+
var baseUrl = 'https://explorer.solana.com/tx/';
|
|
6
|
+
return "".concat(baseUrl).concat(transactionId, "?cluster=devnet");
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=solanaDepositTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solanaDepositTransaction.js","sourceRoot":"","sources":["../../../../../../src/features/onboarding-flow/utils/deposit/solanaDepositTransaction.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,aAAqB;IACxD,IAAM,OAAO,GAAG,iCAAiC,CAAC;IAClD,OAAO,UAAG,OAAO,SAAG,aAAa,oBAAiB,CAAC;AACrD,CAAC","sourcesContent":["/**\n * Interface for transaction result\n */\nexport interface SolanaDepositTransactionResult {\n success: boolean;\n transactionId: string;\n amount: string;\n tokenSymbol: string;\n fromAddress: string;\n toAddress: string;\n networkName: string;\n status: 'Completed' | 'Failed' | 'Pending';\n explorerUrl?: string;\n error?: Error;\n}\n\n/**\n * Constructs Solana explorer URL for a transaction ID (devnet cluster).\n */\nexport function getSolanaExplorerUrl(transactionId: string) {\n const baseUrl = 'https://explorer.solana.com/tx/';\n return `${baseUrl}${transactionId}?cluster=devnet`;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import { ProtonClientLike, SolanaConnectionLike } from '../../types';
|
|
3
|
+
export declare const DEPOSIT_POLL_INTERVAL_MS = 5000;
|
|
4
|
+
export declare const SLOT_LOOKUP_TIMEOUT_MS: number;
|
|
5
|
+
export declare const DEPOSIT_EVENT_TIMEOUT_MS: number;
|
|
6
|
+
export declare const NORD_ACK_TIMEOUT_MS: number;
|
|
7
|
+
export declare const delay: (ms: number) => Promise<void>;
|
|
8
|
+
export declare const waitForTransactionSlot: (connection: SolanaConnectionLike, signature: string) => Promise<number>;
|
|
9
|
+
export declare const waitForDepositEventIndex: (protonClient: ProtonClientLike, recipient: PublicKey, slot: number) => Promise<number>;
|
|
10
|
+
export declare const waitForNordAcknowledgement: (nord: {
|
|
11
|
+
getActionNonce: () => Promise<number | string | bigint>;
|
|
12
|
+
}, targetEventIndex: number) => Promise<void>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
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);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { logger } from '../../../../utils/logger';
|
|
38
|
+
export var DEPOSIT_POLL_INTERVAL_MS = 5000;
|
|
39
|
+
export var SLOT_LOOKUP_TIMEOUT_MS = 2 * 60 * 1000;
|
|
40
|
+
export var DEPOSIT_EVENT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
41
|
+
export var NORD_ACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
42
|
+
export var delay = function (ms) {
|
|
43
|
+
return new Promise(function (resolve) {
|
|
44
|
+
setTimeout(resolve, ms);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export var waitForTransactionSlot = function (connection, signature) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
+
var deadline, status_1, info;
|
|
49
|
+
var _a;
|
|
50
|
+
return __generator(this, function (_b) {
|
|
51
|
+
switch (_b.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
logger.debug('Waiting for Solana confirmation for deposit', { signature: signature });
|
|
54
|
+
deadline = Date.now() + SLOT_LOOKUP_TIMEOUT_MS;
|
|
55
|
+
_b.label = 1;
|
|
56
|
+
case 1:
|
|
57
|
+
if (!(Date.now() < deadline)) return [3 /*break*/, 4];
|
|
58
|
+
return [4 /*yield*/, connection.getSignatureStatuses([signature], {
|
|
59
|
+
searchTransactionHistory: true,
|
|
60
|
+
})];
|
|
61
|
+
case 2:
|
|
62
|
+
status_1 = _b.sent();
|
|
63
|
+
info = (_a = status_1.value) === null || _a === void 0 ? void 0 : _a[0];
|
|
64
|
+
if (info === null || info === void 0 ? void 0 : info.err) {
|
|
65
|
+
throw new Error('Deposit transaction failed to confirm on Solana.');
|
|
66
|
+
}
|
|
67
|
+
if (info && typeof info.slot === 'number') {
|
|
68
|
+
return [2 /*return*/, info.slot];
|
|
69
|
+
}
|
|
70
|
+
return [4 /*yield*/, delay(2000)];
|
|
71
|
+
case 3:
|
|
72
|
+
_b.sent();
|
|
73
|
+
return [3 /*break*/, 1];
|
|
74
|
+
case 4: throw new Error('Timed out waiting for Solana confirmation of the deposit.');
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
export var waitForDepositEventIndex = function (protonClient, recipient, slot) { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
+
var deadline, deposits, matchingDeposit, rawEventIndex;
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
logger.debug('Polling Proton for deposit entry', { slot: slot });
|
|
84
|
+
deadline = Date.now() + DEPOSIT_EVENT_TIMEOUT_MS;
|
|
85
|
+
_a.label = 1;
|
|
86
|
+
case 1:
|
|
87
|
+
if (!(Date.now() < deadline)) return [3 /*break*/, 4];
|
|
88
|
+
return [4 /*yield*/, protonClient.depositsForRecipient(recipient, {
|
|
89
|
+
startSlot: slot,
|
|
90
|
+
order: 'desc',
|
|
91
|
+
})];
|
|
92
|
+
case 2:
|
|
93
|
+
deposits = _a.sent();
|
|
94
|
+
if (Array.isArray(deposits)) {
|
|
95
|
+
matchingDeposit = deposits.find(function (deposit) {
|
|
96
|
+
var depositSlot = typeof deposit.createdAtSlot === 'string'
|
|
97
|
+
? Number(deposit.createdAtSlot)
|
|
98
|
+
: deposit.createdAtSlot;
|
|
99
|
+
return Number.isFinite(depositSlot) && depositSlot === slot;
|
|
100
|
+
});
|
|
101
|
+
if (matchingDeposit) {
|
|
102
|
+
rawEventIndex = matchingDeposit.eventIndex === undefined ||
|
|
103
|
+
matchingDeposit.eventIndex === null
|
|
104
|
+
? null
|
|
105
|
+
: Number(matchingDeposit.eventIndex);
|
|
106
|
+
if (Number.isFinite(rawEventIndex)) {
|
|
107
|
+
return [2 /*return*/, rawEventIndex];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return [4 /*yield*/, delay(DEPOSIT_POLL_INTERVAL_MS)];
|
|
112
|
+
case 3:
|
|
113
|
+
_a.sent();
|
|
114
|
+
return [3 /*break*/, 1];
|
|
115
|
+
case 4: throw new Error('Timed out waiting for Nord to index the deposit event.');
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
119
|
+
export var waitForNordAcknowledgement = function (nord, targetEventIndex) { return __awaiter(void 0, void 0, void 0, function () {
|
|
120
|
+
var deadline, nonce, normalized;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
logger.debug('Polling Nord for deposit acknowledgement', {
|
|
125
|
+
targetEventIndex: targetEventIndex,
|
|
126
|
+
});
|
|
127
|
+
deadline = Date.now() + NORD_ACK_TIMEOUT_MS;
|
|
128
|
+
_a.label = 1;
|
|
129
|
+
case 1:
|
|
130
|
+
if (!(Date.now() < deadline)) return [3 /*break*/, 4];
|
|
131
|
+
return [4 /*yield*/, nord.getActionNonce()];
|
|
132
|
+
case 2:
|
|
133
|
+
nonce = _a.sent();
|
|
134
|
+
normalized = typeof nonce === 'bigint'
|
|
135
|
+
? Number(nonce)
|
|
136
|
+
: typeof nonce === 'string'
|
|
137
|
+
? Number(nonce)
|
|
138
|
+
: nonce;
|
|
139
|
+
if (Number.isFinite(normalized) && normalized >= targetEventIndex) {
|
|
140
|
+
return [2 /*return*/];
|
|
141
|
+
}
|
|
142
|
+
return [4 /*yield*/, delay(DEPOSIT_POLL_INTERVAL_MS)];
|
|
143
|
+
case 3:
|
|
144
|
+
_a.sent();
|
|
145
|
+
return [3 /*break*/, 1];
|
|
146
|
+
case 4: throw new Error('Timed out waiting for N1 to process the deposit.');
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}); };
|
|
150
|
+
//# sourceMappingURL=solanaUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solanaUtils.js","sourceRoot":"","sources":["../../../../../../src/features/onboarding-flow/utils/deposit/solanaUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,MAAM,CAAC,IAAM,wBAAwB,GAAG,IAAK,CAAC;AAC9C,MAAM,CAAC,IAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAK,CAAC;AACrD,MAAM,CAAC,IAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAK,CAAC;AACvD,MAAM,CAAC,IAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAK,CAAC;AAElD,MAAM,CAAC,IAAM,KAAK,GAAG,UAAC,EAAU;IAC9B,OAAA,IAAI,OAAO,CAAO,UAAC,OAAO;QACxB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC;AAFF,CAEE,CAAC;AAEL,MAAM,CAAC,IAAM,sBAAsB,GAAG,UACpC,UAAgC,EAChC,SAAiB;;;;;;gBAEjB,MAAM,CAAC,KAAK,CAAC,6CAA6C,EAAE,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;gBACrE,QAAQ,GAAG,IAAI,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,KAAK,QAAQ;wBACzB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;wBACf,CAAC,CAAC,KAAK,CAAC;gBAEd,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,IAAI,gBAAgB,EAAE,CAAC;oBAClE,sBAAO;gBACT,CAAC;gBAED,qBAAM,KAAK,CAAC,wBAAwB,CAAC,EAAA;;gBAArC,SAAqC,CAAC;;oBAGxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;;;KACrE,CAAC","sourcesContent":["import { PublicKey } from '@solana/web3.js';\nimport { logger } from '../../../../utils/logger';\nimport { ProtonClientLike, SolanaConnectionLike } from '../../types';\n\nexport const DEPOSIT_POLL_INTERVAL_MS = 5_000;\nexport const SLOT_LOOKUP_TIMEOUT_MS = 2 * 60 * 1_000;\nexport const DEPOSIT_EVENT_TIMEOUT_MS = 5 * 60 * 1_000;\nexport const NORD_ACK_TIMEOUT_MS = 5 * 60 * 1_000;\n\nexport const delay = (ms: number) =>\n new Promise<void>((resolve) => {\n setTimeout(resolve, ms);\n });\n\nexport const waitForTransactionSlot = async (\n connection: SolanaConnectionLike,\n signature: string\n): Promise<number> => {\n logger.debug('Waiting for Solana confirmation for deposit', { signature });\n const deadline = Date.now() + SLOT_LOOKUP_TIMEOUT_MS;\n\n while (Date.now() < deadline) {\n const status = await connection.getSignatureStatuses([signature], {\n searchTransactionHistory: true,\n });\n const info = status.value?.[0];\n\n if (info?.err) {\n throw new Error('Deposit transaction failed to confirm on Solana.');\n }\n\n if (info && typeof info.slot === 'number') {\n return info.slot;\n }\n\n await delay(2_000);\n }\n\n throw new Error('Timed out waiting for Solana confirmation of the deposit.');\n};\n\nexport const waitForDepositEventIndex = async (\n protonClient: ProtonClientLike,\n recipient: PublicKey,\n slot: number\n): Promise<number> => {\n logger.debug('Polling Proton for deposit entry', { slot });\n const deadline = Date.now() + DEPOSIT_EVENT_TIMEOUT_MS;\n\n while (Date.now() < deadline) {\n const deposits = await protonClient.depositsForRecipient(recipient, {\n startSlot: slot,\n order: 'desc',\n });\n\n if (Array.isArray(deposits)) {\n const matchingDeposit = deposits.find((deposit) => {\n const depositSlot =\n typeof deposit.createdAtSlot === 'string'\n ? Number(deposit.createdAtSlot)\n : deposit.createdAtSlot;\n return Number.isFinite(depositSlot) && depositSlot === slot;\n });\n\n if (matchingDeposit) {\n const rawEventIndex =\n matchingDeposit.eventIndex === undefined ||\n matchingDeposit.eventIndex === null\n ? null\n : Number(matchingDeposit.eventIndex);\n\n if (Number.isFinite(rawEventIndex)) {\n return rawEventIndex as number;\n }\n }\n }\n\n await delay(DEPOSIT_POLL_INTERVAL_MS);\n }\n\n throw new Error('Timed out waiting for Nord to index the deposit event.');\n};\n\nexport const waitForNordAcknowledgement = async (\n nord: { getActionNonce: () => Promise<number | string | bigint> },\n targetEventIndex: number\n): Promise<void> => {\n logger.debug('Polling Nord for deposit acknowledgement', {\n targetEventIndex,\n });\n const deadline = Date.now() + NORD_ACK_TIMEOUT_MS;\n\n while (Date.now() < deadline) {\n const nonce = await nord.getActionNonce();\n const normalized =\n typeof nonce === 'bigint'\n ? Number(nonce)\n : typeof nonce === 'string'\n ? Number(nonce)\n : nonce;\n\n if (Number.isFinite(normalized) && normalized >= targetEventIndex) {\n return;\n }\n\n await delay(DEPOSIT_POLL_INTERVAL_MS);\n }\n\n throw new Error('Timed out waiting for N1 to process the deposit.');\n};\n\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { StoredDepositRecord } from '../../types';
|
|
2
|
+
export type PendingDepositStage = 'initiated' | 'bridge_submitted' | 'bridge_confirmed' | 'solana_submitted' | 'solana_confirmed' | 'failed';
|
|
3
|
+
export interface PendingDepositState {
|
|
4
|
+
depositId: string;
|
|
5
|
+
wallet: string;
|
|
6
|
+
chain: string;
|
|
7
|
+
amount: string;
|
|
8
|
+
stage: PendingDepositStage;
|
|
9
|
+
tx?: string | null;
|
|
10
|
+
mintTx?: string | null;
|
|
11
|
+
attestationId?: string | null;
|
|
12
|
+
explorerUrl?: string | null;
|
|
13
|
+
reason?: string | null;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Saves the last completed deposit record for a wallet address.
|
|
18
|
+
*/
|
|
19
|
+
export declare function saveLastDepositRecord(address: string | null | undefined, record: StoredDepositRecord): void;
|
|
20
|
+
/**
|
|
21
|
+
* Reads the last completed deposit record for a wallet address.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readLastDepositRecord(address: string | null | undefined): StoredDepositRecord | null;
|
|
24
|
+
export declare function clearLastDepositRecord(address: string | null | undefined): void;
|
|
25
|
+
/**
|
|
26
|
+
* Reads pending deposit from localStorage - includes chain
|
|
27
|
+
*/
|
|
28
|
+
export declare function readPendingDeposit(now?: number): PendingDepositState | null;
|
|
29
|
+
/**
|
|
30
|
+
* Writes pending deposit to localStorage - includes chain
|
|
31
|
+
*/
|
|
32
|
+
export declare function writePendingDeposit(state: PendingDepositState, now?: number): PendingDepositState;
|
|
33
|
+
export declare function clearPendingDeposit(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Advances the state of a pending deposit.
|
|
36
|
+
* Note: Only wallet and depositId are persisted, other fields are ignored.
|
|
37
|
+
*/
|
|
38
|
+
export declare function advancePendingDeposit(previous: PendingDepositState, updates: Partial<Omit<PendingDepositState, 'depositId' | 'wallet' | 'chain'>> & {
|
|
39
|
+
stage: PendingDepositStage;
|
|
40
|
+
}, now?: number): PendingDepositState;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new pending deposit draft.
|
|
43
|
+
* Only wallet and depositId are persisted to localStorage.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createPendingDepositDraft(params: {
|
|
46
|
+
depositId: string;
|
|
47
|
+
wallet: string;
|
|
48
|
+
chain: string;
|
|
49
|
+
amount: string;
|
|
50
|
+
now?: number;
|
|
51
|
+
}): PendingDepositState;
|
|
52
|
+
export declare function reconcileStages(localStage: PendingDepositStage, remoteStage: PendingDepositStage | null | undefined): PendingDepositStage;
|