@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
@@ -1,525 +0,0 @@
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 { jsx as _jsx } from "react/jsx-runtime";
38
- import { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
39
- import { PublicKey } from '@solana/web3.js';
40
- import { getExplorerUrl, } from '../utils/transaction';
41
- import { useN1WalletContext } from '../../../hooks';
42
- import { logger } from '../../../utils/logger';
43
- import { OnboardingStep } from '../types';
44
- import { useOnboardingState } from './OnboardingStateProvider';
45
- import { clearLastDepositRecord, saveLastDepositRecord } from '../utils/depositStorage';
46
- var DEPOSIT_POLL_INTERVAL_MS = 5000;
47
- var SLOT_LOOKUP_TIMEOUT_MS = 2 * 60 * 1000;
48
- var DEPOSIT_EVENT_TIMEOUT_MS = 5 * 60 * 1000;
49
- var NORD_ACK_TIMEOUT_MS = 5 * 60 * 1000;
50
- // Create the context with a default value
51
- var DepositFlowContext = createContext(undefined);
52
- /**
53
- * Provider component for the deposit flow state
54
- */
55
- export var DepositFlowProvider = function (_a) {
56
- var children = _a.children;
57
- // Get flow state context
58
- var _b = useOnboardingState(), state = _b.state, context = _b.context, flowActions = _b.actions, updateContext = _b.updateContext, isDebugOverride = _b.isDebugOverride;
59
- // Get wallet context
60
- var _c = useN1WalletContext(), address = _c.address, nord = _c.nord, nordUser = _c.nordUser;
61
- // chain
62
- var _d = useState(context.selectedChain), selectedChain = _d[0], setSelectedChain = _d[1];
63
- // transaction & deposit
64
- var _e = useState(context.amount), amount = _e[0], setAmount = _e[1];
65
- var _f = useState(false), isDepositing = _f[0], setIsDepositing = _f[1];
66
- var _g = useState('solana'), depositProgressPhase = _g[0], setDepositProgressPhase = _g[1];
67
- var _h = useState(context.transactionId), transactionId = _h[0], setTransactionId = _h[1];
68
- var _j = useState(null), transactionResult = _j[0], setTransactionResult = _j[1];
69
- // auth
70
- var _k = useState('loading'), authStatus = _k[0], setAuthStatus = _k[1];
71
- var _l = useState(null), authErrorMessage = _l[0], setAuthErrorMessage = _l[1];
72
- var _m = useState(null), authStatusMessage = _m[0], setAuthStatusMessage = _m[1];
73
- // Use refs to track previous values
74
- var prevContextRef = useRef(context);
75
- /**
76
- * Handle an error by transitioning to error state
77
- */
78
- var handleError = useCallback(function (error) {
79
- logger.error('Flow error:', error);
80
- flowActions.setErrorState(error);
81
- }, [flowActions]);
82
- var authInFlightRef = useRef(false);
83
- var waitingForNordUserRef = useRef(false);
84
- /**
85
- * Authenticate session
86
- */
87
- var performAuth = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
88
- var sessionPubKey, sessionId, sessionIdKey, error_1;
89
- return __generator(this, function (_a) {
90
- switch (_a.label) {
91
- case 0:
92
- if (authInFlightRef.current) {
93
- return [2 /*return*/];
94
- }
95
- authInFlightRef.current = true;
96
- _a.label = 1;
97
- case 1:
98
- _a.trys.push([1, 4, 5, 6]);
99
- // Step 1: Tell user to sign transaction
100
- setAuthStatusMessage('Please sign the transaction to authenticate your session');
101
- if (!nordUser) {
102
- waitingForNordUserRef.current = true;
103
- setAuthStatus('loading');
104
- setAuthStatusMessage('Preparing your Nord session…');
105
- return [2 /*return*/];
106
- }
107
- waitingForNordUserRef.current = false;
108
- // Step 2: Call nordUser.refreshSession and get sessionId
109
- setAuthStatusMessage('Session is being authenticated...');
110
- sessionPubKey = nordUser.sessionPubKey;
111
- if (!sessionPubKey) {
112
- throw new Error('Session public key is not available');
113
- }
114
- // Refresh the session
115
- return [4 /*yield*/, nordUser.refreshSession()];
116
- case 2:
117
- // Refresh the session
118
- _a.sent();
119
- return [4 /*yield*/, nordUser.updateAccountId()];
120
- case 3:
121
- _a.sent();
122
- console.log('nordUser', nordUser);
123
- sessionId = nordUser.sessionId;
124
- if (!sessionId) {
125
- throw new Error('Failed to get session ID after refresh');
126
- }
127
- logger.debug('Session refreshed successfully', {
128
- sessionId: sessionId.toString(),
129
- });
130
- // Step 3: Store sessionId in localStorage
131
- if (address) {
132
- sessionIdKey = "n1_sessionId_".concat(address);
133
- localStorage.setItem(sessionIdKey, sessionId.toString());
134
- logger.debug('Stored sessionId in localStorage', { key: sessionIdKey });
135
- }
136
- // Step 4: Update status to success
137
- setAuthStatus('success');
138
- // updateContext({ hasActiveSession: true });
139
- flowActions.completeFlow({
140
- hasActiveSession: true,
141
- hasNordAccount: true,
142
- });
143
- return [3 /*break*/, 6];
144
- case 4:
145
- error_1 = _a.sent();
146
- console.error('Authentication error:', error_1);
147
- setAuthStatus('error');
148
- setAuthErrorMessage(error_1 instanceof Error ? error_1.message : 'Unknown error occurred');
149
- return [3 /*break*/, 6];
150
- case 5:
151
- authInFlightRef.current = false;
152
- return [7 /*endfinally*/];
153
- case 6: return [2 /*return*/];
154
- }
155
- });
156
- }); }, [
157
- updateContext,
158
- flowActions,
159
- address,
160
- nordUser,
161
- setAuthStatus,
162
- setAuthStatusMessage,
163
- setAuthErrorMessage,
164
- ]);
165
- useEffect(function () {
166
- if (waitingForNordUserRef.current && nordUser) {
167
- performAuth();
168
- }
169
- }, [nordUser, performAuth]);
170
- /**
171
- * Update amount for deposit
172
- */
173
- var updateAmount = useCallback(function (newAmount) {
174
- setAmount(newAmount);
175
- updateContext({ amount: newAmount });
176
- }, [updateContext]);
177
- /**
178
- * Start deposit process
179
- */
180
- var startDeposit = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
181
- var protonClient, solanaConnection, recipientKey, usdcToken, normalizedAmount, txId, depositResponse, slot, eventIndex, result, depositRecord, depositError_1, errorMessage;
182
- var _a, _b, _c;
183
- return __generator(this, function (_d) {
184
- switch (_d.label) {
185
- case 0:
186
- if (isDepositing)
187
- return [2 /*return*/];
188
- logger.debug('Starting deposit process');
189
- if (!amount || parseFloat(amount) <= 0) {
190
- handleError(new Error('Invalid amount'));
191
- return [2 /*return*/];
192
- }
193
- if (!nord) {
194
- handleError(new Error('Nord client is unavailable. Please check your configuration and try again.'));
195
- return [2 /*return*/];
196
- }
197
- if (!nordUser) {
198
- handleError(new Error('Your Nord session is not ready yet. Reconnect your wallet to retry.'));
199
- return [2 /*return*/];
200
- }
201
- if (!address) {
202
- handleError(new Error('We were unable to determine your wallet address. Please reconnect your wallet and try again.'));
203
- return [2 /*return*/];
204
- }
205
- protonClient = nord.protonClient;
206
- solanaConnection = nord.solanaConnection;
207
- if (!protonClient || !solanaConnection) {
208
- handleError(new Error('Nord client is missing Solana or Proton configuration. Verify your Nord deployment.'));
209
- return [2 /*return*/];
210
- }
211
- recipientKey = new PublicKey(address);
212
- usdcToken = Array.isArray(nord.tokens)
213
- ? nord.tokens.find(function (t) { return t.symbol === 'USDC'; })
214
- : null;
215
- if (!usdcToken) {
216
- handleError(new Error('Nord token configuration is missing USDC. Verify your Nord deployment.'));
217
- return [2 /*return*/];
218
- }
219
- setIsDepositing(true);
220
- setDepositProgressPhase('solana');
221
- flowActions.startDeposit();
222
- _d.label = 1;
223
- case 1:
224
- _d.trys.push([1, 9, 10, 11]);
225
- normalizedAmount = parseFloat(amount);
226
- txId = null;
227
- if (!(typeof nordUser.deposit === 'function')) return [3 /*break*/, 3];
228
- return [4 /*yield*/, nordUser.deposit({
229
- amount: normalizedAmount,
230
- tokenId: usdcToken.tokenId,
231
- })];
232
- case 2:
233
- depositResponse = _d.sent();
234
- if (depositResponse) {
235
- if (typeof depositResponse === 'string') {
236
- txId = depositResponse;
237
- }
238
- else if (typeof depositResponse === 'object' &&
239
- 'signature' in depositResponse &&
240
- typeof depositResponse.signature === 'string') {
241
- txId = depositResponse.signature;
242
- }
243
- }
244
- _d.label = 3;
245
- case 3:
246
- if (!!txId) return [3 /*break*/, 5];
247
- return [4 /*yield*/, nordUser.depositSpl(normalizedAmount, usdcToken.tokenId)];
248
- case 4:
249
- txId = _d.sent();
250
- _d.label = 5;
251
- case 5:
252
- if (!txId) {
253
- throw new Error('Failed to submit deposit transaction.');
254
- }
255
- logger.debug('Deposit transaction submitted', { txId: txId });
256
- return [4 /*yield*/, waitForTransactionSlot(solanaConnection, txId)];
257
- case 6:
258
- slot = _d.sent();
259
- logger.debug('Solana slot detected for deposit', { slot: slot });
260
- return [4 /*yield*/, waitForDepositEventIndex(protonClient, recipientKey, slot)];
261
- case 7:
262
- eventIndex = _d.sent();
263
- logger.debug('Deposit event indexed', { eventIndex: eventIndex });
264
- setDepositProgressPhase('nord');
265
- return [4 /*yield*/, waitForNordAcknowledgement(nord, eventIndex)];
266
- case 8:
267
- _d.sent();
268
- logger.debug('Nord acknowledged deposit event', { eventIndex: eventIndex });
269
- result = {
270
- success: true,
271
- transactionId: txId,
272
- amount: amount,
273
- tokenSymbol: 'USDC',
274
- fromAddress: address || 'Your Wallet',
275
- toAddress: 'Exchange Account',
276
- networkName: selectedChain,
277
- status: 'Completed',
278
- explorerUrl: getExplorerUrl(txId),
279
- };
280
- depositRecord = {
281
- transactionId: txId,
282
- amount: amount,
283
- tokenSymbol: 'USDC',
284
- chainId: (_a = context.selectedChainId) !== null && _a !== void 0 ? _a : (selectedChain !== null && selectedChain !== void 0 ? selectedChain : 'solana'),
285
- chainName: (_b = context.selectedChain) !== null && _b !== void 0 ? _b : (selectedChain !== null && selectedChain !== void 0 ? selectedChain : 'Solana'),
286
- chainNetwork: (_c = context.selectedChainNetwork) !== null && _c !== void 0 ? _c : null,
287
- timestamp: Date.now(),
288
- };
289
- saveLastDepositRecord(address, depositRecord);
290
- // Update state with transaction result
291
- setTransactionId(txId);
292
- setTransactionResult(result);
293
- logger.debug('Transaction completed successfully');
294
- flowActions.markDepositSuccess({
295
- transactionId: txId,
296
- record: depositRecord,
297
- });
298
- return [3 /*break*/, 11];
299
- case 9:
300
- depositError_1 = _d.sent();
301
- logger.error('Deposit process failed', depositError_1);
302
- errorMessage = depositError_1 instanceof Error
303
- ? depositError_1.message
304
- : 'Failed to process deposit';
305
- flowActions.markDepositFailed(errorMessage);
306
- return [2 /*return*/]; // Exit early
307
- case 10:
308
- setIsDepositing(false);
309
- return [7 /*endfinally*/];
310
- case 11: return [2 /*return*/];
311
- }
312
- });
313
- }); }, [
314
- isDepositing,
315
- selectedChain,
316
- amount,
317
- address,
318
- flowActions,
319
- handleError,
320
- nord,
321
- nordUser,
322
- context.selectedChain,
323
- context.selectedChainId,
324
- context.selectedChainNetwork,
325
- ]);
326
- /**
327
- * Complete the deposit process and move to the next screen
328
- */
329
- var completeDeposit = useCallback(function () {
330
- clearLastDepositRecord(address);
331
- updateContext({ lastDeposit: null });
332
- if (context.isDepositOnlyFlow) {
333
- flowActions.completeFlow({
334
- hasNordAccount: true,
335
- hasActiveSession: true,
336
- });
337
- return;
338
- }
339
- // Check if user has an active session to determine the next state
340
- if (context.hasActiveSession) {
341
- // If user has an active session, go directly to FINAL_SUCCESS
342
- flowActions.completeFlow({
343
- hasNordAccount: true,
344
- hasActiveSession: true,
345
- });
346
- }
347
- else {
348
- // If user doesn't have an active session, go to authentication flow
349
- flowActions.requireAuth({ hasNordAccount: true });
350
- }
351
- }, [context.hasActiveSession, context.isDepositOnlyFlow, flowActions, address, updateContext]);
352
- // Create the context value
353
- var contextValue = {
354
- amount: amount,
355
- isDepositing: isDepositing,
356
- depositProgressPhase: depositProgressPhase,
357
- transactionId: transactionId,
358
- transactionResult: transactionResult,
359
- authStatus: authStatus,
360
- authErrorMessage: authErrorMessage,
361
- authStatusMessage: authStatusMessage,
362
- updateAmount: updateAmount,
363
- startDeposit: startDeposit,
364
- completeDeposit: completeDeposit,
365
- performAuth: performAuth,
366
- };
367
- /**
368
- * Update state based on context changes
369
- */
370
- useEffect(function () {
371
- var prevContext = prevContextRef.current;
372
- // Only update state if the relevant context values have actually changed
373
- if (context.selectedChain !== prevContext.selectedChain) {
374
- setSelectedChain(context.selectedChain);
375
- }
376
- if (context.amount !== prevContext.amount) {
377
- setAmount(context.amount);
378
- }
379
- if (context.transactionId !== prevContext.transactionId) {
380
- setTransactionId(context.transactionId);
381
- }
382
- // Update the ref to the current context
383
- prevContextRef.current = context;
384
- }, [context]);
385
- useEffect(function () {
386
- var _a, _b;
387
- if (!isDebugOverride || state !== OnboardingStep.DEPOSIT_SUCCESS || transactionResult) {
388
- return;
389
- }
390
- var mockTransactionId = (_a = context.transactionId) !== null && _a !== void 0 ? _a : 'debug-tx-12345';
391
- var fallbackChain = (_b = context.selectedChain) !== null && _b !== void 0 ? _b : 'Solana';
392
- setTransactionId(mockTransactionId);
393
- setTransactionResult({
394
- success: true,
395
- transactionId: mockTransactionId,
396
- amount: context.amount || '1,250',
397
- tokenSymbol: 'USDC',
398
- fromAddress: address || 'Debug Wallet',
399
- toAddress: 'Nord Account',
400
- networkName: fallbackChain,
401
- status: 'Completed',
402
- explorerUrl: getExplorerUrl(mockTransactionId),
403
- });
404
- }, [isDebugOverride, state, transactionResult, context, address]);
405
- return (_jsx(DepositFlowContext.Provider, { value: contextValue, children: children }));
406
- };
407
- var delay = function (ms) {
408
- return new Promise(function (resolve) {
409
- setTimeout(resolve, ms);
410
- });
411
- };
412
- var waitForTransactionSlot = function (connection, signature) { return __awaiter(void 0, void 0, void 0, function () {
413
- var deadline, status_1, info;
414
- var _a;
415
- return __generator(this, function (_b) {
416
- switch (_b.label) {
417
- case 0:
418
- logger.debug('Waiting for Solana confirmation for deposit', { signature: signature });
419
- deadline = Date.now() + SLOT_LOOKUP_TIMEOUT_MS;
420
- _b.label = 1;
421
- case 1:
422
- if (!(Date.now() < deadline)) return [3 /*break*/, 4];
423
- return [4 /*yield*/, connection.getSignatureStatuses([signature], {
424
- searchTransactionHistory: true,
425
- })];
426
- case 2:
427
- status_1 = _b.sent();
428
- info = (_a = status_1.value) === null || _a === void 0 ? void 0 : _a[0];
429
- if (info === null || info === void 0 ? void 0 : info.err) {
430
- throw new Error('Deposit transaction failed to confirm on Solana.');
431
- }
432
- if (info && typeof info.slot === 'number') {
433
- return [2 /*return*/, info.slot];
434
- }
435
- return [4 /*yield*/, delay(2000)];
436
- case 3:
437
- _b.sent();
438
- return [3 /*break*/, 1];
439
- case 4: throw new Error('Timed out waiting for Solana confirmation of the deposit.');
440
- }
441
- });
442
- }); };
443
- var waitForDepositEventIndex = function (protonClient, recipient, slot) { return __awaiter(void 0, void 0, void 0, function () {
444
- var deadline, deposits, matchingDeposit, rawEventIndex;
445
- return __generator(this, function (_a) {
446
- switch (_a.label) {
447
- case 0:
448
- logger.debug('Polling Proton for deposit entry', { slot: slot });
449
- deadline = Date.now() + DEPOSIT_EVENT_TIMEOUT_MS;
450
- _a.label = 1;
451
- case 1:
452
- if (!(Date.now() < deadline)) return [3 /*break*/, 4];
453
- return [4 /*yield*/, protonClient.depositsForRecipient(recipient, {
454
- startSlot: slot,
455
- order: 'desc',
456
- })];
457
- case 2:
458
- deposits = _a.sent();
459
- if (Array.isArray(deposits)) {
460
- matchingDeposit = deposits.find(function (deposit) {
461
- var depositSlot = typeof deposit.createdAtSlot === 'string'
462
- ? Number(deposit.createdAtSlot)
463
- : deposit.createdAtSlot;
464
- return Number.isFinite(depositSlot) && depositSlot === slot;
465
- });
466
- if (matchingDeposit) {
467
- rawEventIndex = matchingDeposit.eventIndex === undefined ||
468
- matchingDeposit.eventIndex === null
469
- ? null
470
- : Number(matchingDeposit.eventIndex);
471
- if (Number.isFinite(rawEventIndex)) {
472
- return [2 /*return*/, rawEventIndex];
473
- }
474
- }
475
- }
476
- return [4 /*yield*/, delay(DEPOSIT_POLL_INTERVAL_MS)];
477
- case 3:
478
- _a.sent();
479
- return [3 /*break*/, 1];
480
- case 4: throw new Error('Timed out waiting for Nord to index the deposit event.');
481
- }
482
- });
483
- }); };
484
- var waitForNordAcknowledgement = function (nord, targetEventIndex) { return __awaiter(void 0, void 0, void 0, function () {
485
- var deadline, nonce, normalized;
486
- return __generator(this, function (_a) {
487
- switch (_a.label) {
488
- case 0:
489
- logger.debug('Polling Nord for deposit acknowledgement', {
490
- targetEventIndex: targetEventIndex,
491
- });
492
- deadline = Date.now() + NORD_ACK_TIMEOUT_MS;
493
- _a.label = 1;
494
- case 1:
495
- if (!(Date.now() < deadline)) return [3 /*break*/, 4];
496
- return [4 /*yield*/, nord.getActionNonce()];
497
- case 2:
498
- nonce = _a.sent();
499
- normalized = typeof nonce === 'bigint'
500
- ? Number(nonce)
501
- : typeof nonce === 'string'
502
- ? Number(nonce)
503
- : nonce;
504
- if (Number.isFinite(normalized) && normalized >= targetEventIndex) {
505
- return [2 /*return*/];
506
- }
507
- return [4 /*yield*/, delay(DEPOSIT_POLL_INTERVAL_MS)];
508
- case 3:
509
- _a.sent();
510
- return [3 /*break*/, 1];
511
- case 4: throw new Error('Timed out waiting for N1 to process the deposit.');
512
- }
513
- });
514
- }); };
515
- /**
516
- * Hook to use the deposit flow context
517
- */
518
- export var useDepositFlow = function () {
519
- var context = useContext(DepositFlowContext);
520
- if (context === undefined) {
521
- throw new Error('useDepositFlow must be used within a DepositFlowProvider');
522
- }
523
- return context;
524
- };
525
- //# sourceMappingURL=DepositFlowProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DepositFlowProvider.js","sourceRoot":"","sources":["../../../../src/features/onboarding-flow/providers/DepositFlowProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAc,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnG,OAAO,EAAc,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,cAAc,GAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,M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AAC,CAAC","sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport { Connection, PublicKey } from '@solana/web3.js';\nimport {\n getExplorerUrl,\n TransactionResult,\n} from '../utils/transaction';\nimport { useN1WalletContext } from '../../../hooks';\nimport { logger } from '../../../utils/logger';\nimport { OnboardingStep } from '../types';\nimport { useOnboardingState } from './OnboardingStateProvider';\nimport { clearLastDepositRecord, saveLastDepositRecord } from '../utils/depositStorage';\n\nconst DEPOSIT_POLL_INTERVAL_MS = 5_000;\nconst SLOT_LOOKUP_TIMEOUT_MS = 2 * 60 * 1_000;\nconst DEPOSIT_EVENT_TIMEOUT_MS = 5 * 60 * 1_000;\nconst NORD_ACK_TIMEOUT_MS = 5 * 60 * 1_000;\n\ntype DepositProgressPhase = 'solana' | 'nord';\n\ninterface ProtonDepositRecord {\n eventIndex?: number | string | null;\n createdAtSlot: number;\n amount: number;\n depositorTokenAccount: string;\n bufferAccount: string;\n recipient: string;\n mint: string;\n}\n\ninterface ProtonClientLike {\n depositsForRecipient: (\n recipient: PublicKey,\n options: {\n startSlot?: number;\n order: 'desc' | 'asc';\n }\n ) => Promise<ProtonDepositRecord[]>;\n}\n\n// Define the shape of the deposit state value\nexport interface DepositFlowContextValue {\n amount: string;\n isDepositing: boolean;\n depositProgressPhase: DepositProgressPhase;\n transactionId: string | null;\n transactionResult: TransactionResult | null;\n authStatus: 'loading' | 'success' | 'error';\n authErrorMessage: string | null;\n authStatusMessage: string | null;\n updateAmount: (newAmount: string) => void;\n startDeposit: () => Promise<void>;\n completeDeposit: () => void;\n performAuth: () => Promise<void>;\n}\n\n// Create the context with a default value\nconst DepositFlowContext = createContext<DepositFlowContextValue | undefined>(undefined);\n\n// Props for the provider component\ninterface DepositFlowProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Provider component for the deposit flow state\n */\nexport const DepositFlowProvider: React.FC<DepositFlowProviderProps> = ({\n children,\n}) => {\n // Get flow state context\n const {\n state,\n context,\n actions: flowActions,\n updateContext,\n isDebugOverride,\n } = useOnboardingState();\n\n // Get wallet context\n const {\n address,\n nord,\n nordUser,\n } = useN1WalletContext();\n\n // chain\n const [selectedChain, setSelectedChain] = useState<string | null>(\n context.selectedChain\n );\n\n // transaction & deposit\n const [amount, setAmount] = useState(context.amount);\n const [isDepositing, setIsDepositing] = useState(false);\n const [depositProgressPhase, setDepositProgressPhase] =\n useState<DepositProgressPhase>('solana');\n const [transactionId, setTransactionId] = useState<string | null>(context.transactionId);\n const [transactionResult, setTransactionResult] = useState<TransactionResult | null>(null);\n\n\n // auth\n const [authStatus, setAuthStatus] = useState<'loading' | 'success' | 'error'>('loading');\n const [authErrorMessage, setAuthErrorMessage] = useState<string | null>(null);\n const [authStatusMessage, setAuthStatusMessage] = useState<string | null>(null);\n\n // Use refs to track previous values\n const prevContextRef = useRef(context);\n\n\n /**\n * Handle an error by transitioning to error state\n */\n const handleError = useCallback(\n (error: Error) => {\n logger.error('Flow error:', error);\n flowActions.setErrorState(error);\n },\n [flowActions]\n );\n\n const authInFlightRef = useRef(false);\n const waitingForNordUserRef = useRef(false);\n\n /**\n * Authenticate session\n */\n const performAuth = useCallback(async () => {\n if (authInFlightRef.current) {\n return;\n }\n\n authInFlightRef.current = true;\n try {\n // Step 1: Tell user to sign transaction\n setAuthStatusMessage(\n 'Please sign the transaction to authenticate your session'\n );\n\n if (!nordUser) {\n waitingForNordUserRef.current = true;\n setAuthStatus('loading');\n setAuthStatusMessage('Preparing your Nord session…');\n return;\n }\n\n waitingForNordUserRef.current = false;\n\n // Step 2: Call nordUser.refreshSession and get sessionId\n setAuthStatusMessage('Session is being authenticated...');\n\n // Get the session public key from the nordUser\n const sessionPubKey = nordUser.sessionPubKey;\n if (!sessionPubKey) {\n throw new Error('Session public key is not available');\n }\n\n // Refresh the session\n await nordUser.refreshSession();\n await nordUser.updateAccountId();\n\n console.log('nordUser', nordUser);\n\n // Get the sessionId after refresh\n const sessionId = nordUser.sessionId;\n if (!sessionId) {\n throw new Error('Failed to get session ID after refresh');\n }\n\n logger.debug('Session refreshed successfully', {\n sessionId: sessionId.toString(),\n });\n\n // Step 3: Store sessionId in localStorage\n if (address) {\n const sessionIdKey = `n1_sessionId_${address}`;\n localStorage.setItem(sessionIdKey, sessionId.toString());\n logger.debug('Stored sessionId in localStorage', { key: sessionIdKey });\n }\n\n // Step 4: Update status to success\n setAuthStatus('success');\n\n // updateContext({ hasActiveSession: true });\n flowActions.completeFlow({\n hasActiveSession: true,\n hasNordAccount: true,\n });\n\n } catch (error) {\n console.error('Authentication error:', error);\n setAuthStatus('error');\n setAuthErrorMessage(\n error instanceof Error ? error.message : 'Unknown error occurred'\n );\n } finally {\n authInFlightRef.current = false;\n }\n }, [\n updateContext,\n flowActions,\n address,\n nordUser,\n setAuthStatus,\n setAuthStatusMessage,\n setAuthErrorMessage,\n ]);\n\n useEffect(() => {\n if (waitingForNordUserRef.current && nordUser) {\n performAuth();\n }\n }, [nordUser, performAuth]);\n\n /**\n * Update amount for deposit\n */\n const updateAmount = useCallback(\n (newAmount: string) => {\n setAmount(newAmount);\n updateContext({ amount: newAmount });\n },\n [updateContext]\n );\n\n /**\n * Start deposit process\n */\n const startDeposit = useCallback(async () => {\n if (isDepositing) return;\n\n logger.debug('Starting deposit process');\n\n if (!amount || parseFloat(amount) <= 0) {\n handleError(new Error('Invalid amount'));\n return;\n }\n\n if (!nord) {\n handleError(\n new Error(\n 'Nord client is unavailable. Please check your configuration and try again.'\n )\n );\n return;\n }\n\n if (!nordUser) {\n handleError(\n new Error(\n 'Your Nord session is not ready yet. Reconnect your wallet to retry.'\n )\n );\n return;\n }\n\n if (!address) {\n handleError(\n new Error(\n 'We were unable to determine your wallet address. Please reconnect your wallet and try again.'\n )\n );\n return;\n }\n\n const protonClient = nord.protonClient as ProtonClientLike | undefined;\n const solanaConnection = nord.solanaConnection as Connection | undefined;\n\n if (!protonClient || !solanaConnection) {\n handleError(\n new Error(\n 'Nord client is missing Solana or Proton configuration. Verify your Nord deployment.'\n )\n );\n return;\n }\n\n const recipientKey = new PublicKey(address);\n\n const usdcToken = Array.isArray(nord.tokens)\n ? nord.tokens.find((t: any) => t.symbol === 'USDC')\n : null;\n\n if (!usdcToken) {\n handleError(\n new Error(\n 'Nord token configuration is missing USDC. Verify your Nord deployment.'\n )\n );\n return;\n }\n\n setIsDepositing(true);\n setDepositProgressPhase('solana');\n flowActions.startDeposit();\n\n try {\n const normalizedAmount = parseFloat(amount);\n let txId: string | null = null;\n\n if (typeof nordUser.deposit === 'function') {\n const depositResponse = await nordUser.deposit({\n amount: normalizedAmount,\n tokenId: usdcToken.tokenId,\n });\n\n if (depositResponse) {\n if (typeof depositResponse === 'string') {\n txId = depositResponse;\n } else if (\n typeof depositResponse === 'object' &&\n 'signature' in depositResponse &&\n typeof depositResponse.signature === 'string'\n ) {\n txId = depositResponse.signature;\n }\n }\n }\n\n if (!txId) {\n txId = await nordUser.depositSpl(normalizedAmount, usdcToken.tokenId);\n }\n\n if (!txId) {\n throw new Error('Failed to submit deposit transaction.');\n }\n\n logger.debug('Deposit transaction submitted', { txId });\n\n const slot = await waitForTransactionSlot(solanaConnection, txId);\n logger.debug('Solana slot detected for deposit', { slot });\n\n const eventIndex = await waitForDepositEventIndex(\n protonClient,\n recipientKey,\n slot\n );\n\n logger.debug('Deposit event indexed', { eventIndex });\n setDepositProgressPhase('nord');\n\n await waitForNordAcknowledgement(nord, eventIndex);\n logger.debug('Nord acknowledged deposit event', { eventIndex });\n\n // Create transaction result object immediately after successful deposit\n const result: TransactionResult = {\n success: true,\n transactionId: txId,\n amount,\n tokenSymbol: 'USDC',\n fromAddress: address || 'Your Wallet',\n toAddress: 'Exchange Account',\n networkName: selectedChain!,\n status: 'Completed',\n explorerUrl: getExplorerUrl(txId),\n };\n\n const depositRecord = {\n transactionId: txId,\n amount,\n tokenSymbol: 'USDC',\n chainId: context.selectedChainId ?? (selectedChain ?? 'solana'),\n chainName: context.selectedChain ?? (selectedChain ?? 'Solana'),\n chainNetwork: context.selectedChainNetwork ?? null,\n timestamp: Date.now(),\n };\n\n saveLastDepositRecord(address, depositRecord);\n\n // Update state with transaction result\n setTransactionId(txId);\n setTransactionResult(result);\n logger.debug('Transaction completed successfully');\n flowActions.markDepositSuccess({\n transactionId: txId,\n record: depositRecord,\n });\n } catch (depositError) {\n logger.error('Deposit process failed', depositError);\n const errorMessage = depositError instanceof Error\n ? depositError.message\n : 'Failed to process deposit';\n\n flowActions.markDepositFailed(errorMessage);\n return; // Exit early\n } finally {\n setIsDepositing(false);\n }\n }, [\n isDepositing,\n selectedChain,\n amount,\n address,\n flowActions,\n handleError,\n nord,\n nordUser,\n context.selectedChain,\n context.selectedChainId,\n context.selectedChainNetwork,\n ]);\n\n /**\n * Complete the deposit process and move to the next screen\n */\n const completeDeposit = useCallback(() => {\n clearLastDepositRecord(address);\n updateContext({ lastDeposit: null });\n\n if (context.isDepositOnlyFlow) {\n flowActions.completeFlow({\n hasNordAccount: true,\n hasActiveSession: true,\n });\n return;\n }\n\n // Check if user has an active session to determine the next state\n if (context.hasActiveSession) {\n // If user has an active session, go directly to FINAL_SUCCESS\n flowActions.completeFlow({\n hasNordAccount: true,\n hasActiveSession: true,\n });\n } else {\n // If user doesn't have an active session, go to authentication flow\n flowActions.requireAuth({ hasNordAccount: true });\n }\n }, [context.hasActiveSession, context.isDepositOnlyFlow, flowActions, address, updateContext]);\n\n\n\n\n\n // Create the context value\n const contextValue: DepositFlowContextValue = {\n amount,\n isDepositing,\n depositProgressPhase,\n transactionId,\n transactionResult,\n authStatus,\n authErrorMessage,\n authStatusMessage,\n updateAmount,\n startDeposit,\n completeDeposit,\n performAuth,\n };\n\n\n /**\n * Update state based on context changes\n */\n useEffect(() => {\n const prevContext = prevContextRef.current;\n\n // Only update state if the relevant context values have actually changed\n if (context.selectedChain !== prevContext.selectedChain) {\n setSelectedChain(context.selectedChain);\n }\n\n if (context.amount !== prevContext.amount) {\n setAmount(context.amount);\n }\n\n if (context.transactionId !== prevContext.transactionId) {\n setTransactionId(context.transactionId);\n }\n\n // Update the ref to the current context\n prevContextRef.current = context;\n }, [context]);\n\n useEffect(() => {\n if (!isDebugOverride || state !== OnboardingStep.DEPOSIT_SUCCESS || transactionResult) {\n return;\n }\n\n const mockTransactionId = context.transactionId ?? 'debug-tx-12345';\n const fallbackChain = context.selectedChain ?? 'Solana';\n setTransactionId(mockTransactionId);\n setTransactionResult({\n success: true,\n transactionId: mockTransactionId,\n amount: context.amount || '1,250',\n tokenSymbol: 'USDC',\n fromAddress: address || 'Debug Wallet',\n toAddress: 'Nord Account',\n networkName: fallbackChain,\n status: 'Completed',\n explorerUrl: getExplorerUrl(mockTransactionId),\n });\n }, [isDebugOverride, state, transactionResult, context, address]);\n\n\n\n return (\n <DepositFlowContext.Provider value={contextValue}>\n {children}\n </DepositFlowContext.Provider>\n );\n};\n\nconst delay = (ms: number) =>\n new Promise<void>((resolve) => {\n setTimeout(resolve, ms);\n });\n\nconst waitForTransactionSlot = async (\n connection: Connection,\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\nconst 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\nconst 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/**\n * Hook to use the deposit flow context\n */\nexport const useDepositFlow = (): DepositFlowContextValue => {\n const context = useContext(DepositFlowContext);\n if (context === undefined) {\n throw new Error('useDepositFlow must be used within a DepositFlowProvider');\n }\n return context;\n};\n"]}