@b3dotfun/sdk 0.1.1-test.0 → 0.1.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 (252) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
  2. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  3. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +22 -14
  4. package/dist/cjs/anyspend/react/components/QRDeposit.js +31 -5
  5. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +9 -2
  6. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
  7. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +1 -1
  8. package/dist/cjs/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  9. package/dist/cjs/anyspend/react/components/common/TransferResultScreen.js +25 -0
  10. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  11. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
  14. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
  15. package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
  16. package/dist/cjs/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  17. package/dist/cjs/anyspend/react/hooks/useWatchTransfer.js +75 -0
  18. package/dist/cjs/anyspend/utils/address.d.ts +5 -0
  19. package/dist/cjs/anyspend/utils/address.js +8 -0
  20. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +1 -1
  21. package/dist/cjs/global-account/react/components/B3DynamicModal.js +5 -1
  22. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  23. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
  24. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  25. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +37 -0
  26. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
  27. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +7 -57
  28. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
  29. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +11 -35
  30. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  31. package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  32. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +3 -3
  33. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -10
  34. package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
  35. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
  36. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +2 -20
  37. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
  38. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
  39. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +1 -1
  40. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +1 -1
  41. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +1 -1
  42. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +1 -1
  43. package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +1 -1
  44. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  45. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -1
  46. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  47. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  48. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  49. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  50. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +163 -0
  51. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  52. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.js +5 -0
  53. package/dist/cjs/global-account/react/components/StyleRoot.js +2 -2
  54. package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  55. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
  56. package/dist/cjs/global-account/react/components/index.d.ts +3 -2
  57. package/dist/cjs/global-account/react/components/index.js +6 -6
  58. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
  59. package/dist/cjs/global-account/react/hooks/index.js +3 -1
  60. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -2
  61. package/dist/cjs/global-account/react/hooks/useAuth.js +2 -2
  62. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  63. package/dist/cjs/global-account/react/hooks/useAuthentication.js +6 -3
  64. package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
  65. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
  66. package/dist/cjs/global-account/react/hooks/useNotifications.js +1 -1
  67. package/dist/cjs/global-account/react/hooks/useProfile.js +4 -23
  68. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
  69. package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +1 -1
  70. package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
  71. package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
  72. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +6 -7
  73. package/dist/cjs/global-account/react/hooks/useUserQuery.js +64 -39
  74. package/dist/cjs/global-account/react/index.native.d.ts +0 -2
  75. package/dist/cjs/global-account/react/index.native.js +1 -5
  76. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +63 -1
  77. package/dist/cjs/global-account/react/stores/useModalStore.js +3 -0
  78. package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
  79. package/dist/cjs/global-account/react/stores/userStore.js +30 -0
  80. package/dist/cjs/global-account/react/utils/profileApi.d.ts +13 -0
  81. package/dist/cjs/global-account/react/utils/profileApi.js +29 -0
  82. package/dist/esm/anyspend/react/components/AnySpend.js +3 -3
  83. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  84. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +23 -15
  85. package/dist/esm/anyspend/react/components/QRDeposit.js +32 -6
  86. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +10 -3
  87. package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
  88. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
  89. package/dist/esm/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  90. package/dist/esm/anyspend/react/components/common/TransferResultScreen.js +22 -0
  91. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  92. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  93. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
  94. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  95. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
  96. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
  97. package/dist/esm/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  98. package/dist/esm/anyspend/react/hooks/useWatchTransfer.js +72 -0
  99. package/dist/esm/anyspend/utils/address.d.ts +5 -0
  100. package/dist/esm/anyspend/utils/address.js +7 -0
  101. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -2
  102. package/dist/esm/global-account/react/components/B3DynamicModal.js +6 -2
  103. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  104. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
  105. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  106. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +33 -0
  107. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
  108. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +6 -58
  109. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
  110. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +10 -37
  111. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  112. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  113. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +3 -3
  114. package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -10
  115. package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
  116. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
  117. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +1 -19
  118. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
  119. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
  120. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
  121. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
  122. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
  123. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
  124. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +2 -2
  125. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  126. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
  127. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  128. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  129. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  130. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  131. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +160 -0
  132. package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  133. package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.js +1 -0
  134. package/dist/esm/global-account/react/components/StyleRoot.js +2 -2
  135. package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  136. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
  137. package/dist/esm/global-account/react/components/index.d.ts +3 -2
  138. package/dist/esm/global-account/react/components/index.js +3 -2
  139. package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
  140. package/dist/esm/global-account/react/hooks/index.js +1 -0
  141. package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -2
  142. package/dist/esm/global-account/react/hooks/useAuth.js +3 -3
  143. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  144. package/dist/esm/global-account/react/hooks/useAuthentication.js +6 -3
  145. package/dist/esm/global-account/react/hooks/useClient.js +2 -2
  146. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  147. package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
  148. package/dist/esm/global-account/react/hooks/useProfile.js +1 -20
  149. package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
  150. package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +2 -2
  151. package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
  152. package/dist/esm/global-account/react/hooks/useUser.js +17 -0
  153. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +6 -7
  154. package/dist/esm/global-account/react/hooks/useUserQuery.js +63 -37
  155. package/dist/esm/global-account/react/index.native.d.ts +0 -2
  156. package/dist/esm/global-account/react/index.native.js +0 -2
  157. package/dist/esm/global-account/react/stores/useModalStore.d.ts +63 -1
  158. package/dist/esm/global-account/react/stores/useModalStore.js +3 -0
  159. package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
  160. package/dist/esm/global-account/react/stores/userStore.js +27 -0
  161. package/dist/esm/global-account/react/utils/profileApi.d.ts +13 -0
  162. package/dist/esm/global-account/react/utils/profileApi.js +25 -0
  163. package/dist/styles/index.css +1 -1
  164. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  165. package/dist/types/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  166. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  167. package/dist/types/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  168. package/dist/types/anyspend/utils/address.d.ts +5 -0
  169. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  170. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  171. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
  172. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
  173. package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  174. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +3 -3
  175. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
  176. package/dist/types/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  177. package/dist/types/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  178. package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  179. package/dist/types/global-account/react/components/index.d.ts +3 -2
  180. package/dist/types/global-account/react/hooks/index.d.ts +1 -0
  181. package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -2
  182. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  183. package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
  184. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +6 -7
  185. package/dist/types/global-account/react/index.native.d.ts +0 -2
  186. package/dist/types/global-account/react/stores/useModalStore.d.ts +63 -1
  187. package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
  188. package/dist/types/global-account/react/utils/profileApi.d.ts +13 -0
  189. package/package.json +6 -1
  190. package/src/anyspend/react/components/AnySpend.tsx +3 -2
  191. package/src/anyspend/react/components/AnySpendDeposit.tsx +60 -42
  192. package/src/anyspend/react/components/QRDeposit.tsx +57 -5
  193. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +13 -3
  194. package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
  195. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +2 -2
  196. package/src/anyspend/react/components/common/TransferResultScreen.tsx +107 -0
  197. package/src/anyspend/react/hooks/index.ts +1 -0
  198. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
  199. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
  200. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
  201. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
  202. package/src/anyspend/react/hooks/useWatchTransfer.ts +114 -0
  203. package/src/anyspend/utils/address.ts +13 -0
  204. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +2 -2
  205. package/src/global-account/react/components/B3DynamicModal.tsx +6 -2
  206. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
  207. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +84 -0
  208. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +26 -45
  209. package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -103
  210. package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
  211. package/src/global-account/react/components/B3Provider/useB3.ts +4 -12
  212. package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
  213. package/src/global-account/react/components/B3Provider/useB3Config.ts +1 -34
  214. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
  215. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
  216. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
  217. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
  218. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
  219. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
  220. package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +2 -2
  221. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  222. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +2 -2
  223. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
  224. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  225. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  226. package/src/global-account/react/components/SingleUserSearchSelector/README.md +266 -0
  227. package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +330 -0
  228. package/src/global-account/react/components/SingleUserSearchSelector/index.ts +2 -0
  229. package/src/global-account/react/components/StyleRoot.tsx +2 -2
  230. package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
  231. package/src/global-account/react/components/index.ts +8 -2
  232. package/src/global-account/react/hooks/index.ts +1 -0
  233. package/src/global-account/react/hooks/useAuth.ts +3 -3
  234. package/src/global-account/react/hooks/useAuthentication.ts +7 -3
  235. package/src/global-account/react/hooks/useClient.ts +2 -2
  236. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
  237. package/src/global-account/react/hooks/useNotifications.ts +2 -2
  238. package/src/global-account/react/hooks/useProfile.ts +1 -32
  239. package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
  240. package/src/global-account/react/hooks/useTurnkeyAuth.ts +2 -2
  241. package/src/global-account/react/hooks/useUser.ts +20 -0
  242. package/src/global-account/react/hooks/useUserQuery.ts +64 -51
  243. package/src/global-account/react/index.native.ts +0 -2
  244. package/src/global-account/react/stores/useModalStore.ts +67 -1
  245. package/src/global-account/react/stores/userStore.ts +41 -0
  246. package/src/global-account/react/utils/profileApi.ts +38 -0
  247. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
  248. package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
  249. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
  250. package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
  251. package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
  252. package/src/global-account/react/components/B3Provider/types.ts +0 -50
@@ -61,7 +61,7 @@ function AnySpend(props) {
61
61
  function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }) {
62
62
  const searchParams = (0, react_2.useSearchParamsSSR)();
63
63
  const router = (0, react_2.useRouter)();
64
- const { partnerId } = (0, react_2.useB3)();
64
+ const { partnerId } = (0, react_2.useB3Config)();
65
65
  const setB3ModalContentType = (0, react_2.useModalStore)(state => state.setB3ModalContentType);
66
66
  // Determine if we're in "buy mode" based on whether destination token props are provided
67
67
  const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
@@ -831,7 +831,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
831
831
  navigateBack();
832
832
  // Reset payment methods when going back
833
833
  resetPaymentMethods();
834
- }, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel })) }) }));
834
+ }, returnToHomeUrl: returnToHomeUrl, returnHomeLabel: returnHomeLabel, disableUrlParamManagement: disableUrlParamManagement })) }) }));
835
835
  const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2 pt-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex w-full max-w-full flex-col items-center gap-2 px-5", children: [isBuyMode && !hideHeader && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && ((0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), (0, jsx_runtime_1.jsx)(TabSection_1.TabSection, { activeTab: activeTab, setActiveTab: tab => {
836
836
  setActiveTab(tab);
837
837
  // Reset payment methods when switching tabs
@@ -35,10 +35,10 @@ export interface AnySpendDepositProps {
35
35
  sourceTokenAddress?: string;
36
36
  /** Source chain ID to pre-select. If not provided, shows chain selection */
37
37
  sourceTokenChainId?: number;
38
- /** The destination token to receive */
39
- destinationToken: components["schemas"]["Token"];
38
+ /** The destination token address */
39
+ destinationTokenAddress: string;
40
40
  /** The destination chain ID */
41
- destinationChainId: number;
41
+ destinationTokenChainId: number;
42
42
  /** Callback when deposit succeeds */
43
43
  onSuccess?: (amount: string) => void;
44
44
  /** Callback for opening a custom modal (e.g., for special token handling) */
@@ -89,6 +89,11 @@ export interface AnySpendDepositProps {
89
89
  customRecipientLabel?: string;
90
90
  /** Custom label for the return home button (overrides "Return to Home" / "Close") */
91
91
  returnHomeLabel?: string;
92
+ /** Whether the deposit requires a custom function (uses AnySpendCustomExactIn).
93
+ * When false, uses simple swap flow (AnySpend).
94
+ * Defaults to false.
95
+ */
96
+ isCustomDeposit?: boolean;
92
97
  }
93
98
  /**
94
99
  * A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
@@ -97,8 +102,8 @@ export interface AnySpendDepositProps {
97
102
  * // Simple deposit with chain selection
98
103
  * <AnySpendDeposit
99
104
  * recipientAddress={userAddress}
100
- * destinationToken={myToken}
101
- * destinationChainId={base.id}
105
+ * destinationTokenAddress="0x..."
106
+ * destinationTokenChainId={base.id}
102
107
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
103
108
  * />
104
109
  *
@@ -106,8 +111,8 @@ export interface AnySpendDepositProps {
106
111
  * // Skip chain selection by providing sourceTokenChainId
107
112
  * <AnySpendDeposit
108
113
  * recipientAddress={userAddress}
109
- * destinationToken={myToken}
110
- * destinationChainId={base.id}
114
+ * destinationTokenAddress="0x..."
115
+ * destinationTokenChainId={base.id}
111
116
  * sourceTokenChainId={base.id}
112
117
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
113
118
  * />
@@ -116,8 +121,8 @@ export interface AnySpendDepositProps {
116
121
  * // Deposit with custom contract
117
122
  * <AnySpendDeposit
118
123
  * recipientAddress={userAddress}
119
- * destinationToken={myToken}
120
- * destinationChainId={base.id}
124
+ * destinationTokenAddress="0x..."
125
+ * destinationTokenChainId={base.id}
121
126
  * depositContractConfig={{
122
127
  * contractAddress: "0x...",
123
128
  * functionName: "depositFor",
@@ -125,4 +130,4 @@ export interface AnySpendDepositProps {
125
130
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
126
131
  * />
127
132
  */
128
- export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
133
+ export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AnySpendDeposit = AnySpendDeposit;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const anyspend_1 = require("../../../anyspend");
6
5
  const react_1 = require("../../../global-account/react");
7
6
  const cn_1 = require("../../../shared/utils/cn");
8
7
  const react_2 = require("@web3icons/react");
@@ -70,8 +69,8 @@ function ChainIcon({ chainId, className }) {
70
69
  * // Simple deposit with chain selection
71
70
  * <AnySpendDeposit
72
71
  * recipientAddress={userAddress}
73
- * destinationToken={myToken}
74
- * destinationChainId={base.id}
72
+ * destinationTokenAddress="0x..."
73
+ * destinationTokenChainId={base.id}
75
74
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
76
75
  * />
77
76
  *
@@ -79,8 +78,8 @@ function ChainIcon({ chainId, className }) {
79
78
  * // Skip chain selection by providing sourceTokenChainId
80
79
  * <AnySpendDeposit
81
80
  * recipientAddress={userAddress}
82
- * destinationToken={myToken}
83
- * destinationChainId={base.id}
81
+ * destinationTokenAddress="0x..."
82
+ * destinationTokenChainId={base.id}
84
83
  * sourceTokenChainId={base.id}
85
84
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
86
85
  * />
@@ -89,8 +88,8 @@ function ChainIcon({ chainId, className }) {
89
88
  * // Deposit with custom contract
90
89
  * <AnySpendDeposit
91
90
  * recipientAddress={userAddress}
92
- * destinationToken={myToken}
93
- * destinationChainId={base.id}
91
+ * destinationTokenAddress="0x..."
92
+ * destinationTokenChainId={base.id}
94
93
  * depositContractConfig={{
95
94
  * contractAddress: "0x...",
96
95
  * functionName: "depositFor",
@@ -98,7 +97,7 @@ function ChainIcon({ chainId, className }) {
98
97
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
99
98
  * />
100
99
  */
101
- function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, }) {
100
+ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, }) {
102
101
  const { connectedEOAWallet } = (0, react_1.useAccountWallet)();
103
102
  const eoaAddress = connectedEOAWallet?.getAccount()?.address;
104
103
  // Determine if we should show chain selection
@@ -106,6 +105,17 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
106
105
  const [step, setStep] = (0, react_3.useState)(shouldShowChainSelection ? "select-chain" : "deposit");
107
106
  const [selectedChainId, setSelectedChainId] = (0, react_3.useState)(initialSourceChainId);
108
107
  const [paymentType, setPaymentType] = (0, react_3.useState)(initialPaymentType ?? "crypto");
108
+ // Fetch destination token data
109
+ const { data: destinationTokenData } = (0, react_1.useTokenData)(destinationTokenChainId, destinationTokenAddress);
110
+ // Construct full destination token object
111
+ const destinationToken = (0, react_3.useMemo)(() => ({
112
+ address: destinationTokenAddress,
113
+ chainId: destinationTokenChainId,
114
+ symbol: destinationTokenData?.symbol ?? "",
115
+ name: destinationTokenData?.name ?? "",
116
+ decimals: destinationTokenData?.decimals ?? 18,
117
+ metadata: { logoURI: destinationTokenData?.logoURI },
118
+ }), [destinationTokenAddress, destinationTokenChainId, destinationTokenData]);
109
119
  // Fetch balances for EOA wallet
110
120
  const { data: balanceData, isLoading: isBalanceLoading } = (0, react_1.useSimBalance)(shouldShowChainSelection ? eoaAddress : undefined, supportedChains.map(c => c.id));
111
121
  // Group balances by chain and calculate total USD value per chain
@@ -148,7 +158,7 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
148
158
  }, [chainBalances]);
149
159
  if (!recipientAddress)
150
160
  return null;
151
- const tokenSymbol = destinationToken.symbol ?? "TOKEN";
161
+ const tokenSymbol = destinationToken.symbol || "TOKEN";
152
162
  // Determine order type based on config
153
163
  const effectiveOrderType = orderType ?? (depositContractConfig ? "custom_exact_in" : "swap");
154
164
  // Default header if not provided
@@ -177,14 +187,12 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
177
187
  };
178
188
  // Chain selection view
179
189
  if (step === "select-chain") {
180
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-deposit anyspend-deposit-chain-selection font-inter bg-as-surface-primary relative mx-auto w-full max-w-[460px]", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: [onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), !isBalanceLoading && totalBalance > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-balance border-theme-border-secondary border-b p-5", children: [(0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-balance-label text-as-secondary text-sm", children: "Your Balance" }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-balance-value text-as-primary text-3xl font-semibold", children: [formatDecimal(totalBalance), " ", (0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: "USD" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-options flex flex-col gap-2 p-6", children: [isBalanceLoading && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains-skeleton flex flex-col gap-2", children: [1, 2].map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "border-border-primary flex items-center justify-between rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-32" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-3 w-20" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-5 w-5" })] }, i))) })), topChainsWithBalance.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains flex flex-col gap-2", children: topChainsWithBalance.map(chain => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleSelectChain(chain.id), className: "anyspend-deposit-chain-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chain-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-chain-info", children: [(0, jsx_runtime_1.jsxs)("span", { className: "anyspend-deposit-chain-name text-as-primary flex items-center gap-1.5 font-medium", children: ["Deposit from ", chain.name, (0, jsx_runtime_1.jsx)(ChainIcon, { chainId: chain.id, className: "h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-chain-balance text-as-secondary text-xs", children: [formatUsd(chain.balance), " available"] })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-chain-chevron text-as-secondary h-5 w-5" })] }, chain.id))) })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-general-options flex flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectCrypto, className: "anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-option-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-divider flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectQrDeposit, className: "anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(QrCodeIcon_1.QrCodeIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(CreditCardIcon_1.CreditCardIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "mt-2" })] })] }));
190
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("anyspend-deposit anyspend-deposit-chain-selection font-inter bg-as-surface-primary relative mx-auto w-full max-w-[460px]", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: [onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), !isBalanceLoading && totalBalance > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-balance border-theme-border-secondary border-b p-5", children: [(0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-balance-label text-as-secondary text-sm", children: "Your Balance" }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-balance-value text-as-primary text-3xl font-semibold", children: [formatDecimal(totalBalance), " ", (0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: "USD" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-options flex flex-col gap-2 p-6", children: [isBalanceLoading && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains-skeleton flex flex-col gap-2", children: [1, 2].map((_, i) => ((0, jsx_runtime_1.jsxs)("div", { className: "border-border-primary flex items-center justify-between rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-6 w-6 rounded-full" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [(0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-4 w-32" }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-3 w-20" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Skeleton, { className: "h-5 w-5" })] }, i))) })), topChainsWithBalance.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chains flex flex-col gap-2", children: topChainsWithBalance.map(chain => ((0, jsx_runtime_1.jsxs)("button", { onClick: () => handleSelectChain(chain.id), className: "anyspend-deposit-chain-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-chain-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-chain-info", children: [(0, jsx_runtime_1.jsxs)("span", { className: "anyspend-deposit-chain-name text-as-primary flex items-center gap-1.5 font-medium", children: ["Deposit from ", chain.name, (0, jsx_runtime_1.jsx)(ChainIcon, { chainId: chain.id, className: "h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("p", { className: "anyspend-deposit-chain-balance text-as-secondary text-xs", children: [formatUsd(chain.balance), " available"] })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-chain-chevron text-as-secondary h-5 w-5" })] }, chain.id))) })), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-general-options flex flex-col gap-2", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectCrypto, className: "anyspend-deposit-option-button anyspend-deposit-crypto-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-deposit-option-content", children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit Crypto" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Swap from any token on any chain" })] }) }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-divider flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-divider-text text-as-secondary text-sm", children: "More options" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-stroke h-px flex-1" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectQrDeposit, className: "anyspend-deposit-option-button anyspend-deposit-qr-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left shadow-sm transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(QrCodeIcon_1.QrCodeIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Deposit with QR Code" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Send tokens directly to deposit address" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleSelectFiat, className: "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-content flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(CreditCardIcon_1.CreditCardIcon, { className: "anyspend-deposit-option-icon h-10 w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit-option-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-option-title text-as-primary font-medium", children: "Fund with Fiat" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-deposit-option-description text-as-secondary text-xs", children: "Pay with card or bank transfer" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "anyspend-deposit-option-chevron text-as-secondary h-5 w-5" })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, className: "mt-2" })] })] }));
181
191
  }
182
192
  // QR Deposit view
183
193
  if (step === "qr-deposit") {
184
- return ((0, jsx_runtime_1.jsx)(QRDeposit_1.QRDeposit, { mode: mode, recipientAddress: recipientAddress, destinationToken: destinationToken, destinationChainId: destinationChainId, depositContractConfig: depositContractConfig, onBack: handleBack, onClose: onClose ?? handleBack }));
194
+ return ((0, jsx_runtime_1.jsx)(QRDeposit_1.QRDeposit, { mode: mode, recipientAddress: recipientAddress, destinationToken: destinationToken, destinationChainId: destinationTokenChainId, depositContractConfig: depositContractConfig, onBack: handleBack, onClose: onClose ?? handleBack }));
185
195
  }
186
- // Check if destination is Hyperliquid
187
- const isHyperliquidDeposit = destinationChainId === anyspend_1.HYPERLIQUID_CHAIN_ID;
188
196
  // Deposit view
189
- return ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isHyperliquidDeposit ? ((0, jsx_runtime_1.jsx)(AnySpend_1.AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationToken.address, destinationTokenChainId: destinationChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) : ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId, className: "px-4 pb-4" })] }));
197
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleBack, className: "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), (0, jsx_runtime_1.jsx)("span", { className: "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isCustomDeposit ? ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationTokenChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) : ((0, jsx_runtime_1.jsx)(AnySpend_1.AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel }, selectedChainId)) }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, className: "px-4 pb-4" })] }));
190
198
  }
@@ -11,8 +11,10 @@ const qrcode_react_1 = require("qrcode.react");
11
11
  const react_2 = require("react");
12
12
  const useAnyspendOrderAndTransactions_1 = require("../hooks/useAnyspendOrderAndTransactions");
13
13
  const useCreateDepositFirstOrder_1 = require("../hooks/useCreateDepositFirstOrder");
14
+ const useWatchTransfer_1 = require("../hooks/useWatchTransfer");
14
15
  const ChainTokenIcon_1 = require("./common/ChainTokenIcon");
15
16
  const OrderDetails_1 = require("./common/OrderDetails");
17
+ const TransferResultScreen_1 = require("./common/TransferResultScreen");
16
18
  const WarningText_1 = require("./common/WarningText");
17
19
  // Default source token: ETH on Base
18
20
  const DEFAULT_ETH_ON_BASE = {
@@ -45,9 +47,24 @@ function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenP
45
47
  const [globalAddress, setGlobalAddress] = (0, react_2.useState)();
46
48
  const orderCreatedRef = (0, react_2.useRef)(false);
47
49
  const onSuccessCalled = (0, react_2.useRef)(false);
50
+ const [transferResult, setTransferResult] = (0, react_2.useState)(null);
48
51
  // Source token/chain as state (can be changed by user)
49
52
  const [sourceChainId, setSourceChainId] = (0, react_2.useState)(sourceChainIdProp ?? 8453);
50
53
  const [sourceToken, setSourceToken] = (0, react_2.useState)(sourceTokenProp ?? DEFAULT_ETH_ON_BASE);
54
+ // Check if this is a pure transfer (same chain and token)
55
+ const isPureTransfer = (0, anyspend_1.isSameChainAndToken)(sourceChainId, sourceToken.address, destinationChainId, destinationToken.address);
56
+ // Watch for pure transfers (same chain and token)
57
+ const { isWatching: isWatchingTransfer } = (0, useWatchTransfer_1.useWatchTransfer)({
58
+ address: recipientAddress,
59
+ chainId: sourceChainId,
60
+ tokenAddress: sourceToken.address,
61
+ tokenDecimals: sourceToken.decimals,
62
+ enabled: isPureTransfer && !transferResult,
63
+ onTransferDetected: result => {
64
+ setTransferResult(result);
65
+ onSuccess?.();
66
+ },
67
+ });
51
68
  // Handle token selection from TokenSelector
52
69
  const handleTokenSelect = (newToken) => {
53
70
  const token = {
@@ -62,6 +79,7 @@ function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenP
62
79
  setOrderId(undefined);
63
80
  setGlobalAddress(undefined);
64
81
  orderCreatedRef.current = false;
82
+ setTransferResult(null);
65
83
  // Update token and chain
66
84
  setSourceChainId(newToken.chainId);
67
85
  setSourceToken(token);
@@ -82,10 +100,12 @@ function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenP
82
100
  });
83
101
  // Fetch order status
84
102
  const { orderAndTransactions: oat } = (0, useAnyspendOrderAndTransactions_1.useAnyspendOrderAndTransactions)(orderId);
85
- // Create order on mount
103
+ // Create order on mount (skip for pure transfers)
86
104
  (0, react_2.useEffect)(() => {
87
105
  if (orderCreatedRef.current)
88
106
  return;
107
+ if (isPureTransfer)
108
+ return; // Skip order creation for pure transfers
89
109
  orderCreatedRef.current = true;
90
110
  createOrder({
91
111
  recipientAddress,
@@ -105,6 +125,7 @@ function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenP
105
125
  creatorAddress,
106
126
  depositContractConfig,
107
127
  createOrder,
128
+ isPureTransfer,
108
129
  ]);
109
130
  // Call onSuccess when order is executed
110
131
  (0, react_2.useEffect)(() => {
@@ -118,7 +139,8 @@ function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenP
118
139
  (0, react_2.useEffect)(() => {
119
140
  onSuccessCalled.current = false;
120
141
  }, [orderId]);
121
- const displayAddress = globalAddress || recipientAddress;
142
+ // For pure transfers, always use recipient address; for orders, use global address
143
+ const displayAddress = isPureTransfer ? recipientAddress : globalAddress || recipientAddress;
122
144
  const handleCopyAddress = async () => {
123
145
  if (displayAddress) {
124
146
  await navigator.clipboard.writeText(displayAddress);
@@ -134,13 +156,17 @@ function QRDeposit({ mode = "modal", recipientAddress, sourceToken: sourceTokenP
134
156
  setCopied(false);
135
157
  onClose?.();
136
158
  };
159
+ // Show transfer result screen for completed pure transfers
160
+ if (isPureTransfer && transferResult) {
161
+ return ((0, jsx_runtime_1.jsx)(TransferResultScreen_1.TransferResultScreen, { mode: mode, transferResult: transferResult, token: sourceToken, chainId: sourceChainId, recipientAddress: recipientAddress, onBack: onBack, onClose: onClose }));
162
+ }
137
163
  // Show order details if order has deposits or is being processed
138
164
  if (oat?.data && oat.data.depositTxs && oat.data.depositTxs.length > 0) {
139
165
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-qr-order-details font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsx)("div", { className: "anyspend-qr-order-details-content relative flex flex-col gap-4", children: (0, jsx_runtime_1.jsx)(OrderDetails_1.OrderDetails, { mode: mode, order: oat.data.order, depositTxs: oat.data.depositTxs, relayTxs: oat.data.relayTxs, executeTx: oat.data.executeTx, refundTxs: oat.data.refundTxs, onBack: handleBack }) }) }));
140
166
  }
141
- // Show loading state while creating order (but not if we already have an orderId)
142
- if (isCreatingOrder && !orderId) {
167
+ // Show loading state while creating order (but not if we already have an orderId or for pure transfers)
168
+ if (isCreatingOrder && !orderId && !isPureTransfer) {
143
169
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-qr-loading font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-loading-content flex flex-col items-center justify-center gap-4 py-12", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "anyspend-qr-loading-spinner text-as-brand h-8 w-8 animate-spin" }), (0, jsx_runtime_1.jsx)("p", { className: "anyspend-qr-loading-text text-as-secondary text-sm", children: "Creating deposit order..." })] }) }));
144
170
  }
145
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-qr-deposit font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-deposit-content flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleBack, className: "anyspend-qr-back-button text-as-secondary hover:text-as-primary", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }), (0, jsx_runtime_1.jsx)("h2", { className: "anyspend-qr-title text-as-primary text-base font-semibold", children: "Deposit" }), onClose ? ((0, jsx_runtime_1.jsx)("button", { onClick: handleClose, className: "anyspend-qr-close-button text-as-secondary hover:text-as-primary", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "w-5" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-token-selector flex flex-col gap-1.5", children: [(0, jsx_runtime_1.jsx)("label", { className: "anyspend-qr-token-label text-as-secondary text-sm", children: "Send" }), (0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { chainIdsFilter: (0, anyspend_1.getAvailableChainIds)("from"), context: "from", fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)("from"), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, setToken: handleTokenSelect, supportedWalletVMs: ["evm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)(react_1.Button, { variant: "outline", role: "combobox", className: "anyspend-qr-token-trigger border-as-stroke bg-as-surface-secondary flex h-auto w-full items-center justify-between gap-2 rounded-xl border px-3 py-2.5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [sourceToken.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[sourceChainId]?.logoUrl, tokenUrl: sourceToken.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: sourceToken.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/70 text-xs", children: anyspend_1.ALL_CHAINS[sourceChainId]?.name ?? "Unknown" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-content border-as-stroke flex items-start gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-code-container flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-qr-code rounded-lg bg-white p-2", children: (0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: displayAddress, size: 120, level: "M", marginSize: 0 }) }), (0, jsx_runtime_1.jsxs)("span", { className: "anyspend-qr-scan-hint text-as-secondary text-xs", children: ["SCAN WITH ", (0, jsx_runtime_1.jsx)("span", { className: "inline-block", children: "\uD83E\uDD8A" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-address-container flex flex-1 flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-qr-address-label text-as-secondary text-sm", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-address-row flex items-start gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-qr-address text-as-primary break-all font-mono text-sm leading-relaxed", children: displayAddress }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-icon text-as-secondary hover:text-as-primary mt-0.5 shrink-0", children: copied ? (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-4 w-4" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" }) })] })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId }), (0, jsx_runtime_1.jsxs)(WarningText_1.WarningText, { children: ["Only send ", sourceToken.symbol, " on ", anyspend_1.ALL_CHAINS[sourceChainId]?.name ?? "the specified chain", ". Other tokens will not be converted."] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-button flex w-full items-center justify-center gap-2 rounded-xl bg-blue-500 py-3.5 font-medium text-white transition-all hover:bg-blue-600", children: "Copy deposit address" })] }) }));
171
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-qr-deposit font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-deposit-content flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleBack, className: "anyspend-qr-back-button text-as-secondary hover:text-as-primary", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }), (0, jsx_runtime_1.jsx)("h2", { className: "anyspend-qr-title text-as-primary text-base font-semibold", children: "Deposit" }), onClose ? ((0, jsx_runtime_1.jsx)("button", { onClick: handleClose, className: "anyspend-qr-close-button text-as-secondary hover:text-as-primary", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "w-5" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-token-selector flex flex-col gap-1.5", children: [(0, jsx_runtime_1.jsx)("label", { className: "anyspend-qr-token-label text-as-secondary text-sm", children: "Send" }), (0, jsx_runtime_1.jsx)(relay_kit_ui_1.TokenSelector, { chainIdsFilter: (0, anyspend_1.getAvailableChainIds)("from"), context: "from", fromChainWalletVMSupported: true, isValidAddress: true, lockedChainIds: (0, anyspend_1.getAvailableChainIds)("from"), multiWalletSupportEnabled: true, onAnalyticEvent: undefined, setToken: handleTokenSelect, supportedWalletVMs: ["evm"], token: undefined, trigger: (0, jsx_runtime_1.jsxs)(react_1.Button, { variant: "outline", role: "combobox", className: "anyspend-qr-token-trigger border-as-stroke bg-as-surface-secondary flex h-auto w-full items-center justify-between gap-2 rounded-xl border px-3 py-2.5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [sourceToken.metadata?.logoURI ? ((0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: anyspend_1.ALL_CHAINS[sourceChainId]?.logoUrl, tokenUrl: sourceToken.metadata.logoURI, className: "h-8 min-h-8 w-8 min-w-8" })) : ((0, jsx_runtime_1.jsx)("div", { className: "h-8 w-8 rounded-full bg-gray-700" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-start gap-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary font-semibold", children: sourceToken.symbol }), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/70 text-xs", children: anyspend_1.ALL_CHAINS[sourceChainId]?.name ?? "Unknown" })] })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-70" })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-content border-as-stroke flex items-start gap-4 rounded-xl border p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-code-container flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-qr-code rounded-lg bg-white p-2", children: (0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeSVG, { value: displayAddress, size: 120, level: "M", marginSize: 0 }) }), (0, jsx_runtime_1.jsxs)("span", { className: "anyspend-qr-scan-hint text-as-secondary text-xs", children: ["SCAN WITH ", (0, jsx_runtime_1.jsx)("span", { className: "inline-block", children: "\uD83E\uDD8A" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-address-container flex flex-1 flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-qr-address-label text-as-secondary text-sm", children: "Deposit address:" }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-address-row flex items-start gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "anyspend-qr-address text-as-primary break-all font-mono text-sm leading-relaxed", children: displayAddress }), (0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-icon text-as-secondary hover:text-as-primary mt-0.5 shrink-0", children: copied ? (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-4 w-4" }) : (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { className: "h-4 w-4" }) })] })] })] }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationChainId }), (0, jsx_runtime_1.jsxs)(WarningText_1.WarningText, { children: ["Only send ", sourceToken.symbol, " on ", anyspend_1.ALL_CHAINS[sourceChainId]?.name ?? "the specified chain", ". Other tokens will not be converted."] }), isPureTransfer && isWatchingTransfer && ((0, jsx_runtime_1.jsxs)("div", { className: "anyspend-qr-watching flex items-center justify-center gap-2 rounded-lg bg-blue-500/10 p-3", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin text-blue-500" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-blue-500", children: "Watching for incoming transfer..." })] })), (0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "anyspend-qr-copy-button flex w-full items-center justify-center gap-2 rounded-xl bg-blue-500 py-3.5 font-medium text-white transition-all hover:bg-blue-600", children: "Copy deposit address" })] }) }));
146
172
  }
@@ -33,12 +33,16 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
33
33
  const globalAddress = connectedSmartWallet?.getAccount()?.address;
34
34
  // Use custom hook to determine wallet display logic
35
35
  const { shouldShowConnectedEOA } = (0, useConnectedWalletDisplay_1.useConnectedWalletDisplay)(selectedPaymentMethod);
36
+ // Get modal store to block parent modal closing while connect modal is open
37
+ const setClosable = (0, react_1.useModalStore)(state => state.setClosable);
36
38
  // Handle wallet connection using thirdweb modal
37
39
  const handleConnectWallet = async () => {
40
+ // Block parent B3 modal from closing while thirdweb connect modal is open
41
+ setClosable(false);
38
42
  try {
39
43
  // Disconnect current wallet before connecting a new one
40
44
  if (connectedEOAWallet) {
41
- await disconnect(connectedEOAWallet);
45
+ disconnect(connectedEOAWallet);
42
46
  }
43
47
  const wallet = await openConnectModal({
44
48
  client: thirdweb_1.client,
@@ -48,7 +52,6 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
48
52
  wallets: recommendWallets,
49
53
  });
50
54
  if (wallet) {
51
- // setActiveWallet(wallet);
52
55
  setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
53
56
  onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
54
57
  react_1.toast.success("Wallet connected");
@@ -68,6 +71,10 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
68
71
  }
69
72
  }
70
73
  }
74
+ finally {
75
+ // Always re-enable parent modal closing when connect modal closes
76
+ setClosable(true);
77
+ }
71
78
  };
72
79
  return ((0, jsx_runtime_1.jsx)("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full px-5 pb-5 pt-5 sm:px-0 sm:pt-5", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("relative flex flex-col gap-10"), children: [(0, jsx_runtime_1.jsx)("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-around gap-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 text-center", children: (0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), process.env.NODE_ENV === "development" && ((0, jsx_runtime_1.jsxs)("div", { className: "rounded-lg border border-yellow-500/50 bg-yellow-50 p-3 dark:bg-yellow-950/20", children: [(0, jsx_runtime_1.jsx)("p", { className: "mb-2 text-xs font-semibold text-yellow-800 dark:text-yellow-300", children: "\uD83E\uDDEA Toast Test (Dev Only)" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap gap-2", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => react_1.toast.success("Success! Transaction completed"), className: "rounded bg-green-600 px-2 py-1 text-xs font-medium text-white hover:bg-green-700", children: "Success" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => react_1.toast.error("Error! Transaction failed"), className: "rounded bg-red-600 px-2 py-1 text-xs font-medium text-white hover:bg-red-700", children: "Error" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => react_1.toast.info("Info: Processing your request..."), className: "rounded bg-blue-600 px-2 py-1 text-xs font-medium text-white hover:bg-blue-700", children: "Info" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => react_1.toast.warning("Warning: Low balance detected"), className: "rounded bg-yellow-600 px-2 py-1 text-xs font-medium text-white hover:bg-yellow-700", children: "Warning" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => {
73
80
  react_1.toast.success("Multiple test 1");
@@ -141,7 +141,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
141
141
  const router = (0, hooks_1.useRouter)();
142
142
  const searchParams = (0, hooks_1.useSearchParams)();
143
143
  // Get theme from B3Provider context
144
- const { theme } = (0, react_1.useB3)();
144
+ const { theme } = (0, react_1.useB3Config)();
145
145
  const colorMode = theme || "light";
146
146
  // Read crypto payment method from URL parameters
147
147
  const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod");
@@ -16,7 +16,7 @@ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
16
16
  const HowItWorks_1 = __importDefault(require("./HowItWorks"));
17
17
  const PaymentMethodIcons_1 = __importDefault(require("./PaymentMethodIcons"));
18
18
  function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }) {
19
- const { theme, stripePublishableKey } = (0, react_2.useB3)();
19
+ const { theme, stripePublishableKey } = (0, react_2.useB3Config)();
20
20
  const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
21
21
  const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = (0, react_1.useStripeClientSecret)(stripePaymentIntentId);
22
22
  if (isLoadingStripeClientSecret) {
@@ -0,0 +1,22 @@
1
+ import { components } from "../../../../anyspend/types/api";
2
+ import { TransferResult } from "../../hooks/useWatchTransfer";
3
+ export interface TransferResultScreenProps {
4
+ mode?: "modal" | "page";
5
+ /** The transfer result containing amount info */
6
+ transferResult: TransferResult;
7
+ /** The token that was transferred */
8
+ token: components["schemas"]["Token"];
9
+ /** The chain ID where the transfer happened */
10
+ chainId: number;
11
+ /** The recipient address */
12
+ recipientAddress: string;
13
+ /** Callback when back/close button is clicked */
14
+ onBack?: () => void;
15
+ /** Callback when close button is clicked */
16
+ onClose?: () => void;
17
+ }
18
+ /**
19
+ * A component for displaying the result of a pure transfer (same chain, same token).
20
+ * Shows the transferred amount with success styling.
21
+ */
22
+ export declare function TransferResultScreen({ mode, transferResult, token, chainId, recipientAddress, onBack, onClose, }: TransferResultScreenProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TransferResultScreen = TransferResultScreen;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const anyspend_1 = require("../../../../anyspend");
7
+ const cn_1 = require("../../../../shared/utils/cn");
8
+ const lucide_react_1 = require("lucide-react");
9
+ const ChainTokenIcon_1 = require("./ChainTokenIcon");
10
+ /**
11
+ * A component for displaying the result of a pure transfer (same chain, same token).
12
+ * Shows the transferred amount with success styling.
13
+ */
14
+ function TransferResultScreen({ mode = "modal", transferResult, token, chainId, recipientAddress, onBack, onClose, }) {
15
+ const chain = anyspend_1.ALL_CHAINS[chainId];
16
+ const handleClose = () => {
17
+ if (onClose) {
18
+ onClose();
19
+ }
20
+ else if (onBack) {
21
+ onBack();
22
+ }
23
+ };
24
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("anyspend-container anyspend-transfer-result font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6", mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-transfer-result-content flex flex-col items-center gap-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "anyspend-transfer-success-icon bg-as-success-secondary flex h-16 w-16 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)(lucide_react_1.CheckCircle2, { className: "text-as-content-icon-success h-10 w-10" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-transfer-success-message flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-xl font-semibold", children: "Transfer Received!" }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-secondary text-center text-sm", children: "Your transfer has been successfully received." })] }), (0, jsx_runtime_1.jsx)("div", { className: "anyspend-transfer-amount border-as-border-secondary bg-as-surface-secondary flex w-full flex-col items-center gap-3 rounded-xl border p-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(ChainTokenIcon_1.ChainTokenIcon, { chainUrl: chain?.logoUrl, tokenUrl: token.metadata?.logoURI, className: "h-10 min-h-10 w-10 min-w-10" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-2xl font-bold", children: [transferResult.formattedAmount, " ", token.symbol] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-secondary text-sm", children: ["on ", chain?.name ?? "Unknown Chain"] })] })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "anyspend-transfer-recipient flex w-full flex-col gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-secondary text-xs", children: "Received at" }), (0, jsx_runtime_1.jsx)("span", { className: "text-as-primary break-all font-mono text-sm", children: recipientAddress })] }), (0, jsx_runtime_1.jsx)("button", { onClick: handleClose, className: "anyspend-transfer-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-xl py-3.5 font-medium text-white transition-all hover:opacity-90", children: mode === "page" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Return to Home ", (0, jsx_runtime_1.jsx)(lucide_react_1.Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") })] }) }));
25
+ }
@@ -15,3 +15,4 @@ export * from "./useRecipientAddressState";
15
15
  export * from "./useSigMint";
16
16
  export * from "./useStripeClientSecret";
17
17
  export * from "./useStripeSupport";
18
+ export * from "./useWatchTransfer";
@@ -31,3 +31,4 @@ __exportStar(require("./useRecipientAddressState"), exports);
31
31
  __exportStar(require("./useSigMint"), exports);
32
32
  __exportStar(require("./useStripeClientSecret"), exports);
33
33
  __exportStar(require("./useStripeSupport"), exports);
34
+ __exportStar(require("./useWatchTransfer"), exports);
@@ -17,7 +17,7 @@ const useValidatedClientReferenceId_1 = require("./useValidatedClientReferenceId
17
17
  */
18
18
  function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
19
19
  // Get B3 context values
20
- const { partnerId } = (0, react_1.useB3)();
20
+ const { partnerId } = (0, react_1.useB3Config)();
21
21
  // Get validated client reference ID from B3 context
22
22
  const createValidatedClientReferenceId = (0, useValidatedClientReferenceId_1.useValidatedClientReferenceId)();
23
23
  // Get fingerprint data
@@ -15,7 +15,7 @@ const useValidatedClientReferenceId_1 = require("./useValidatedClientReferenceId
15
15
  */
16
16
  function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
17
17
  // Get B3 context values
18
- const { partnerId } = (0, react_1.useB3)();
18
+ const { partnerId } = (0, react_1.useB3Config)();
19
19
  // Get validated client reference ID from B3 context
20
20
  const createValidatedClientReferenceId = (0, useValidatedClientReferenceId_1.useValidatedClientReferenceId)();
21
21
  // Get fingerprint data
@@ -12,7 +12,7 @@ const react_2 = require("react");
12
12
  * This order type doesn't require srcAmount - the user deposits tokens after the order is created.
13
13
  */
14
14
  function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
15
- const { partnerId } = (0, react_1.useB3)();
15
+ const { partnerId } = (0, react_1.useB3Config)();
16
16
  const { data: fpData } = (0, fingerprintjs_pro_react_1.useVisitorData)({ extendedResult: true }, { immediate: true });
17
17
  const visitorData = fpData && {
18
18
  requestId: fpData.requestId,
@@ -9,7 +9,7 @@ const react_2 = require("react");
9
9
  * Gets the createClientReferenceId function from B3 context and validates the result
10
10
  */
11
11
  function useValidatedClientReferenceId() {
12
- const { createClientReferenceId } = (0, react_1.useB3)();
12
+ const { createClientReferenceId } = (0, react_1.useB3Config)();
13
13
  const createValidatedClientReferenceId = (0, react_2.useCallback)(async (params) => {
14
14
  // If no function provided, return undefined
15
15
  if (!createClientReferenceId) {
@@ -0,0 +1,41 @@
1
+ export interface TransferResult {
2
+ amount: string;
3
+ formattedAmount: string;
4
+ txHash?: string;
5
+ timestamp: number;
6
+ }
7
+ export interface UseWatchTransferProps {
8
+ /** Address to watch for incoming transfers */
9
+ address: string;
10
+ /** Chain ID to watch on */
11
+ chainId: number;
12
+ /** Token address (use zero address for native token) */
13
+ tokenAddress: string;
14
+ /** Token decimals */
15
+ tokenDecimals: number;
16
+ /** Whether watching is enabled */
17
+ enabled?: boolean;
18
+ /** Callback when a transfer is detected */
19
+ onTransferDetected?: (result: TransferResult) => void;
20
+ }
21
+ /**
22
+ * Hook to watch for incoming transfers to an address by monitoring balance changes.
23
+ * When a transfer is detected (balance increases), it captures the amount and notifies.
24
+ */
25
+ export declare function useWatchTransfer({ address, chainId, tokenAddress, tokenDecimals, enabled, onTransferDetected, }: UseWatchTransferProps): {
26
+ /** Whether currently watching for transfers */
27
+ isWatching: boolean;
28
+ /** The detected transfer result, if any */
29
+ transferResult: TransferResult | null;
30
+ /** Whether a transfer has been detected */
31
+ hasTransfer: boolean;
32
+ /** Reset and start watching again */
33
+ reset: () => void;
34
+ /** Manually refetch balance */
35
+ refetchBalance: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<{
36
+ decimals: number;
37
+ formatted: string;
38
+ symbol: string;
39
+ value: bigint;
40
+ }, import("viem").GetBalanceErrorType>>;
41
+ };