@n1xyz/wallet-widget 0.0.34 → 0.0.35-alpha.1

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