@b3dotfun/sdk 0.1.1-test.0 → 0.1.2-test.0

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 (255) 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.d.ts +1 -1
  46. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +4 -2
  47. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  48. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  49. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  50. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  51. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +163 -0
  52. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  53. package/dist/cjs/global-account/react/components/SingleUserSearchSelector/index.js +5 -0
  54. package/dist/cjs/global-account/react/components/StyleRoot.js +2 -2
  55. package/dist/cjs/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  56. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
  57. package/dist/cjs/global-account/react/components/index.d.ts +3 -2
  58. package/dist/cjs/global-account/react/components/index.js +6 -6
  59. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
  60. package/dist/cjs/global-account/react/hooks/index.js +3 -1
  61. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -2
  62. package/dist/cjs/global-account/react/hooks/useAuth.js +2 -2
  63. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  64. package/dist/cjs/global-account/react/hooks/useAuthentication.js +6 -3
  65. package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
  66. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
  67. package/dist/cjs/global-account/react/hooks/useNotifications.js +1 -1
  68. package/dist/cjs/global-account/react/hooks/useProfile.js +4 -23
  69. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
  70. package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +1 -1
  71. package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
  72. package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
  73. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +6 -7
  74. package/dist/cjs/global-account/react/hooks/useUserQuery.js +64 -39
  75. package/dist/cjs/global-account/react/index.native.d.ts +0 -2
  76. package/dist/cjs/global-account/react/index.native.js +1 -5
  77. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +66 -1
  78. package/dist/cjs/global-account/react/stores/useModalStore.js +3 -0
  79. package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
  80. package/dist/cjs/global-account/react/stores/userStore.js +30 -0
  81. package/dist/cjs/global-account/react/utils/profileApi.d.ts +13 -0
  82. package/dist/cjs/global-account/react/utils/profileApi.js +29 -0
  83. package/dist/esm/anyspend/react/components/AnySpend.js +3 -3
  84. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  85. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +23 -15
  86. package/dist/esm/anyspend/react/components/QRDeposit.js +32 -6
  87. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +10 -3
  88. package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
  89. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -2
  90. package/dist/esm/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  91. package/dist/esm/anyspend/react/components/common/TransferResultScreen.js +22 -0
  92. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  93. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  94. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
  95. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  96. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
  97. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
  98. package/dist/esm/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  99. package/dist/esm/anyspend/react/hooks/useWatchTransfer.js +72 -0
  100. package/dist/esm/anyspend/utils/address.d.ts +5 -0
  101. package/dist/esm/anyspend/utils/address.js +7 -0
  102. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -2
  103. package/dist/esm/global-account/react/components/B3DynamicModal.js +6 -2
  104. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  105. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
  106. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  107. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +33 -0
  108. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
  109. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +6 -58
  110. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
  111. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +10 -37
  112. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  113. package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +3 -1
  114. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +3 -3
  115. package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -10
  116. package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
  117. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
  118. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +1 -19
  119. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
  120. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -2
  121. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
  122. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
  123. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
  124. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
  125. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +2 -2
  126. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  127. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  128. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +5 -3
  129. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  130. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  131. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  132. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  133. package/dist/esm/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.js +160 -0
  134. package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  135. package/dist/esm/global-account/react/components/SingleUserSearchSelector/index.js +1 -0
  136. package/dist/esm/global-account/react/components/StyleRoot.js +2 -2
  137. package/dist/esm/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  138. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
  139. package/dist/esm/global-account/react/components/index.d.ts +3 -2
  140. package/dist/esm/global-account/react/components/index.js +3 -2
  141. package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
  142. package/dist/esm/global-account/react/hooks/index.js +1 -0
  143. package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -2
  144. package/dist/esm/global-account/react/hooks/useAuth.js +3 -3
  145. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  146. package/dist/esm/global-account/react/hooks/useAuthentication.js +6 -3
  147. package/dist/esm/global-account/react/hooks/useClient.js +2 -2
  148. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  149. package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
  150. package/dist/esm/global-account/react/hooks/useProfile.js +1 -20
  151. package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
  152. package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +2 -2
  153. package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
  154. package/dist/esm/global-account/react/hooks/useUser.js +17 -0
  155. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +6 -7
  156. package/dist/esm/global-account/react/hooks/useUserQuery.js +63 -37
  157. package/dist/esm/global-account/react/index.native.d.ts +0 -2
  158. package/dist/esm/global-account/react/index.native.js +0 -2
  159. package/dist/esm/global-account/react/stores/useModalStore.d.ts +66 -1
  160. package/dist/esm/global-account/react/stores/useModalStore.js +3 -0
  161. package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
  162. package/dist/esm/global-account/react/stores/userStore.js +27 -0
  163. package/dist/esm/global-account/react/utils/profileApi.d.ts +13 -0
  164. package/dist/esm/global-account/react/utils/profileApi.js +25 -0
  165. package/dist/styles/index.css +1 -1
  166. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +15 -10
  167. package/dist/types/anyspend/react/components/common/TransferResultScreen.d.ts +22 -0
  168. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  169. package/dist/types/anyspend/react/hooks/useWatchTransfer.d.ts +41 -0
  170. package/dist/types/anyspend/utils/address.d.ts +5 -0
  171. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  172. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +31 -0
  173. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -18
  174. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -6
  175. package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +3 -1
  176. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +3 -3
  177. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +1 -9
  178. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  179. package/dist/types/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.d.ts +64 -0
  180. package/dist/types/global-account/react/components/SingleUserSearchSelector/index.d.ts +2 -0
  181. package/dist/types/global-account/react/components/WalletImage/WalletImage.d.ts +1 -1
  182. package/dist/types/global-account/react/components/index.d.ts +3 -2
  183. package/dist/types/global-account/react/hooks/index.d.ts +1 -0
  184. package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -2
  185. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  186. package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
  187. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +6 -7
  188. package/dist/types/global-account/react/index.native.d.ts +0 -2
  189. package/dist/types/global-account/react/stores/useModalStore.d.ts +66 -1
  190. package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
  191. package/dist/types/global-account/react/utils/profileApi.d.ts +13 -0
  192. package/package.json +6 -1
  193. package/src/anyspend/react/components/AnySpend.tsx +3 -2
  194. package/src/anyspend/react/components/AnySpendDeposit.tsx +60 -42
  195. package/src/anyspend/react/components/QRDeposit.tsx +57 -5
  196. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +13 -3
  197. package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
  198. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +2 -2
  199. package/src/anyspend/react/components/common/TransferResultScreen.tsx +107 -0
  200. package/src/anyspend/react/hooks/index.ts +1 -0
  201. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
  202. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
  203. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
  204. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
  205. package/src/anyspend/react/hooks/useWatchTransfer.ts +114 -0
  206. package/src/anyspend/utils/address.ts +13 -0
  207. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +2 -2
  208. package/src/global-account/react/components/B3DynamicModal.tsx +6 -2
  209. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
  210. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +84 -0
  211. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +26 -45
  212. package/src/global-account/react/components/B3Provider/B3Provider.tsx +15 -103
  213. package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +5 -0
  214. package/src/global-account/react/components/B3Provider/useB3.ts +4 -12
  215. package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
  216. package/src/global-account/react/components/B3Provider/useB3Config.ts +1 -34
  217. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
  218. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +2 -2
  219. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
  220. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
  221. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
  222. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
  223. package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +2 -2
  224. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  225. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +7 -3
  226. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
  227. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  228. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  229. package/src/global-account/react/components/SingleUserSearchSelector/README.md +266 -0
  230. package/src/global-account/react/components/SingleUserSearchSelector/SingleUserSearchSelector.tsx +330 -0
  231. package/src/global-account/react/components/SingleUserSearchSelector/index.ts +2 -0
  232. package/src/global-account/react/components/StyleRoot.tsx +2 -2
  233. package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
  234. package/src/global-account/react/components/index.ts +8 -2
  235. package/src/global-account/react/hooks/index.ts +1 -0
  236. package/src/global-account/react/hooks/useAuth.ts +3 -3
  237. package/src/global-account/react/hooks/useAuthentication.ts +7 -3
  238. package/src/global-account/react/hooks/useClient.ts +2 -2
  239. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
  240. package/src/global-account/react/hooks/useNotifications.ts +2 -2
  241. package/src/global-account/react/hooks/useProfile.ts +1 -32
  242. package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
  243. package/src/global-account/react/hooks/useTurnkeyAuth.ts +2 -2
  244. package/src/global-account/react/hooks/useUser.ts +20 -0
  245. package/src/global-account/react/hooks/useUserQuery.ts +64 -51
  246. package/src/global-account/react/index.native.ts +0 -2
  247. package/src/global-account/react/stores/useModalStore.ts +70 -1
  248. package/src/global-account/react/stores/userStore.ts +41 -0
  249. package/src/global-account/react/utils/profileApi.ts +38 -0
  250. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
  251. package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
  252. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
  253. package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
  254. package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
  255. package/src/global-account/react/components/B3Provider/types.ts +0 -50
@@ -1,71 +1,84 @@
1
1
  import { Users } from "@b3dotfun/b3-api";
2
- import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
2
  import { useEffect } from "react";
4
- import { create } from "zustand";
5
- import { persist } from "zustand/middleware";
6
-
7
- const debug = debugB3React("useUserQuery");
3
+ import { useUserStore } from "../stores/userStore";
8
4
 
9
5
  const USER_QUERY_KEY = ["b3-user"];
10
6
 
11
- interface UserStore {
12
- user: Users | null;
13
- setUser: (user: Users | undefined) => void;
14
- clearUser: () => void;
15
- }
16
-
17
- /**
18
- * Zustand store for managing user state
19
- * Persists user data to localStorage
20
- */
21
- const useUserStore = create<UserStore>()(
22
- persist(
23
- set => ({
24
- user: null,
25
- setUser: (newUser: Users | undefined) => {
26
- const userToSave = newUser ?? null;
27
- set({ user: userToSave });
28
- debug("User updated", userToSave);
29
- },
30
- clearUser: () => {
31
- set({ user: null });
32
- debug("User cleared");
33
- },
34
- }),
35
- {
36
- name: "b3-user",
37
- onRehydrateStorage: () => (_, error) => {
38
- if (error) {
39
- console.warn("Failed to rehydrate user store:", error);
40
- }
41
- },
42
- },
43
- ),
44
- );
45
-
46
7
  /**
47
8
  * NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
48
9
  *
49
- * Hook to query and manage user data
50
- * Provides user state and methods to update it
51
- * Uses Zustand store with persistence to localStorage
10
+ * Custom hook to manage user state with Zustand
11
+ * This allows for invalidation and refetching of user data
52
12
  */
53
13
  export function useUserQuery() {
54
14
  const user = useUserStore(state => state.user);
55
- const setUser = useUserStore(state => state.setUser);
56
- const clearUser = useUserStore(state => state.clearUser);
15
+ const setUserStore = useUserStore(state => state.setUser);
16
+ const clearUserStore = useUserStore(state => state.clearUser);
57
17
 
18
+ // Listen for storage events from other tabs/windows
58
19
  useEffect(() => {
59
- if (user) {
60
- debug("User loaded from store", user);
20
+ const handleStorageChange = (e: StorageEvent) => {
21
+ if (e.key === "b3-user") {
22
+ // Sync with changes from other tabs/windows
23
+ const stored = e.newValue;
24
+ if (stored) {
25
+ try {
26
+ const parsed = JSON.parse(stored);
27
+ // Zustand persist format: { state: { user: ... }, version: ... }
28
+ const userData = parsed?.state?.user ?? parsed?.user ?? null;
29
+ useUserStore.setState({ user: userData });
30
+ } catch (error) {
31
+ console.warn("Failed to parse user from storage event:", error);
32
+ }
33
+ } else {
34
+ useUserStore.setState({ user: null });
35
+ }
36
+ }
37
+ };
38
+
39
+ window.addEventListener("storage", handleStorageChange);
40
+ return () => {
41
+ window.removeEventListener("storage", handleStorageChange);
42
+ };
43
+ }, []);
44
+
45
+ // Helper function to set user (maintains backward compatibility)
46
+ const setUser = (newUser?: Users) => {
47
+ setUserStore(newUser);
48
+ };
49
+
50
+ // Helper function to invalidate and refetch user
51
+ const refetchUser = async () => {
52
+ // Re-read from localStorage and update store
53
+ // Zustand persist stores data as { state: { user: ... }, version: ... }
54
+ const stored = localStorage.getItem("b3-user");
55
+ if (stored) {
56
+ try {
57
+ const parsed = JSON.parse(stored);
58
+ // Zustand persist format: { state: { user: ... }, version: ... }
59
+ const userData = parsed?.state?.user ?? parsed?.user ?? null;
60
+ useUserStore.setState({ user: userData });
61
+ return userData ?? undefined;
62
+ } catch (error) {
63
+ console.warn("Failed to refetch user from localStorage:", error);
64
+ // Fallback to current store state
65
+ return useUserStore.getState().user ?? undefined;
66
+ }
61
67
  }
62
- }, [user]);
68
+ useUserStore.setState({ user: null });
69
+ return undefined;
70
+ };
71
+
72
+ // Helper function to clear user
73
+ const clearUser = () => {
74
+ clearUserStore();
75
+ };
63
76
 
64
77
  return {
65
- user,
78
+ user: user ?? undefined,
66
79
  setUser,
80
+ refetchUser,
67
81
  clearUser,
82
+ queryKey: USER_QUERY_KEY,
68
83
  };
69
84
  }
70
-
71
- export { USER_QUERY_KEY };
@@ -6,8 +6,6 @@
6
6
 
7
7
  export { B3Provider } from "./components/B3Provider/B3Provider.native";
8
8
 
9
- export { B3Context, type B3ContextType } from "./components/B3Provider/types";
10
- export { useB3 } from "./components/B3Provider/useB3";
11
9
  export { useAccountWallet } from "./hooks/useAccountWallet";
12
10
  export { useAuthentication } from "./hooks/useAuthentication";
13
11
  export { useProfile } from "./hooks/useProfile";
@@ -1,3 +1,4 @@
1
+ import { Users } from "@b3dotfun/b3-api";
1
2
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
3
  import { GenerateSigMintResponse } from "@b3dotfun/sdk/anyspend/types/signatureMint";
3
4
  import { AllowedStrategy } from "@b3dotfun/sdk/global-account/react";
@@ -43,6 +44,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
43
44
  source?: "signInWithB3Button" | "requestPermissions";
44
45
  /** Whether to show the signers enabled modal */
45
46
  signersEnabled?: boolean;
47
+ /** Callback for turnkey auth */
48
+ onTurnkeyConnect?: (user: Users) => void;
46
49
  }
47
50
 
48
51
  /**
@@ -511,6 +514,65 @@ export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
511
514
  forceFiatPayment?: boolean;
512
515
  }
513
516
 
517
+ /**
518
+ * Props for the AnySpend Deposit modal
519
+ * Flexible deposit component with optional chain selection
520
+ */
521
+ export interface AnySpendDepositModalProps extends BaseModalProps {
522
+ /** Modal type identifier */
523
+ type: "anySpendDeposit";
524
+ /** Order ID to load an existing order */
525
+ loadOrder?: string;
526
+ /** The recipient address for the deposit */
527
+ recipientAddress: string;
528
+ /** Payment type - crypto or fiat. If not set, shows chain selection first */
529
+ paymentType?: "crypto" | "fiat";
530
+ /** Source token address to pre-select */
531
+ sourceTokenAddress?: string;
532
+ /** Source chain ID to pre-select. If not provided, shows chain selection */
533
+ sourceTokenChainId?: number;
534
+ /** The destination token address */
535
+ destinationTokenAddress: string;
536
+ /** The destination chain ID */
537
+ destinationTokenChainId: number;
538
+ /** Callback when deposit succeeds */
539
+ onSuccess?: (amount: string) => void;
540
+ /** Callback for opening a custom modal (e.g., for special token handling) */
541
+ onOpenCustomModal?: () => void;
542
+ /** Custom footer content */
543
+ mainFooter?: React.ReactNode;
544
+ /** Called when a token is selected. Call event.preventDefault() to prevent default behavior */
545
+ onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
546
+ /** Custom USD input value presets for fiat payment */
547
+ customUsdInputValues?: string[];
548
+ /** Whether to prefer using connected EOA wallet */
549
+ preferEoa?: boolean;
550
+ /** Minimum destination amount required */
551
+ minDestinationAmount?: number;
552
+ /** Order type for the deposit */
553
+ orderType?: "hype_duel" | "custom_exact_in" | "swap";
554
+ /** Custom action label displayed on buttons */
555
+ actionLabel?: string;
556
+ /** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
557
+ showChainSelection?: boolean;
558
+ /** Minimum pool size for filtering tokens (default: 1,000,000) */
559
+ minPoolSize?: number;
560
+ /** Custom title for chain selection step */
561
+ chainSelectionTitle?: string;
562
+ /** Custom description for chain selection step */
563
+ chainSelectionDescription?: string;
564
+ /** Number of top chains to show (default: 3) */
565
+ topChainsCount?: number;
566
+ /** Custom URL to redirect to when clicking "Return to Home" on complete order screen */
567
+ returnToHomeUrl?: string;
568
+ /** Custom label for recipient display (e.g., "OBSN Telegram Bot") */
569
+ customRecipientLabel?: string;
570
+ /** Custom label for the return home button (overrides "Return to Home" / "Close") */
571
+ returnHomeLabel?: string;
572
+ /** Whether the deposit requires a custom function (uses AnySpendCustomExactIn). Defaults to false. */
573
+ isCustomDeposit?: boolean;
574
+ }
575
+
514
576
  /**
515
577
  * Union type of all possible modal content types
516
578
  */
@@ -540,7 +602,8 @@ export type ModalContentType =
540
602
  | DepositModalProps
541
603
  | SendModalProps
542
604
  | NotificationsModalProps
543
- | AnySpendCollectorClubPurchaseProps;
605
+ | AnySpendCollectorClubPurchaseProps
606
+ | AnySpendDepositModalProps;
544
607
  // Add other modal types here like: | OtherModalProps | AnotherModalProps
545
608
 
546
609
  /**
@@ -571,6 +634,8 @@ interface ModalState {
571
634
  linkingMethod: string | null;
572
635
  /** Function to set the linking state */
573
636
  setLinkingState: (isLinking: boolean, method?: string | null) => void;
637
+ /** Function to update closable property of current content without adding to history */
638
+ setClosable: (closable: boolean) => void;
574
639
  }
575
640
 
576
641
  /**
@@ -610,4 +675,8 @@ export const useModalStore = create<ModalState>(set => ({
610
675
  linkingMethod: null,
611
676
  setLinkingState: (isLinking: boolean, method: string | null = null) =>
612
677
  set({ isLinking, linkingMethod: isLinking ? method : null }),
678
+ setClosable: (closable: boolean) =>
679
+ set(state => ({
680
+ contentType: state.contentType ? { ...state.contentType, closable } : null,
681
+ })),
613
682
  }));
@@ -0,0 +1,41 @@
1
+ import { Users } from "@b3dotfun/b3-api";
2
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
+ import { create } from "zustand";
4
+ import { persist } from "zustand/middleware";
5
+
6
+ const debug = debugB3React("useUserQuery");
7
+
8
+ interface UserStore {
9
+ user: Users | null;
10
+ setUser: (user: Users | undefined) => void;
11
+ clearUser: () => void;
12
+ }
13
+
14
+ /**
15
+ * Zustand store for managing user state
16
+ * Persists user data to localStorage
17
+ */
18
+ export const useUserStore = create<UserStore>()(
19
+ persist(
20
+ set => ({
21
+ user: null,
22
+ setUser: (newUser: Users | undefined) => {
23
+ const userToSave = newUser ?? null;
24
+ set({ user: userToSave });
25
+ debug("User updated", userToSave);
26
+ },
27
+ clearUser: () => {
28
+ set({ user: null });
29
+ debug("User cleared");
30
+ },
31
+ }),
32
+ {
33
+ name: "b3-user",
34
+ onRehydrateStorage: () => (_, error) => {
35
+ if (error) {
36
+ console.warn("Failed to rehydrate user store:", error);
37
+ }
38
+ },
39
+ },
40
+ ),
41
+ );
@@ -0,0 +1,38 @@
1
+ import type { CombinedProfile } from "../hooks/useProfile";
2
+
3
+ export const PROFILES_API_URL = "https://profiles.b3.fun";
4
+
5
+ /**
6
+ * Fetch a user profile from the B3 Profiles API
7
+ * @param params - Search parameters (address, name, or b3GlobalId)
8
+ * @returns Promise resolving to CombinedProfile or null if not found
9
+ */
10
+ export async function fetchProfile({
11
+ address,
12
+ name,
13
+ b3GlobalId,
14
+ fresh = false,
15
+ }: {
16
+ address?: string;
17
+ name?: string;
18
+ b3GlobalId?: string;
19
+ fresh?: boolean;
20
+ }): Promise<CombinedProfile> {
21
+ if (!address && !name && !b3GlobalId) {
22
+ throw new Error("Either address or name or b3GlobalId must be provided");
23
+ }
24
+
25
+ const params = new URLSearchParams();
26
+ if (address) params.append("address", address);
27
+ if (name) params.append("name", name);
28
+ if (b3GlobalId) params.append("b3GlobalId", b3GlobalId);
29
+ if (fresh) params.append("fresh", "true");
30
+
31
+ const response = await fetch(`${PROFILES_API_URL}?${params.toString()}`);
32
+
33
+ if (!response.ok) {
34
+ throw new Error(`Failed to fetch profile: ${response.statusText}`);
35
+ }
36
+
37
+ return response.json();
38
+ }
@@ -1,27 +0,0 @@
1
- import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "../../../../global-account/types/permissions";
4
- import { Account, Wallet } from "thirdweb/wallets";
5
- import { ClientType } from "../../../client-manager";
6
- /**
7
- * Context type for B3Provider
8
- */
9
- export interface B3ContextType {
10
- account?: Account;
11
- automaticallySetFirstEoa: boolean;
12
- wallet?: Wallet;
13
- initialized: boolean;
14
- ready: boolean;
15
- environment?: "development" | "production";
16
- defaultPermissions?: PermissionsConfig;
17
- theme: "light" | "dark";
18
- clientType: ClientType;
19
- partnerId: string;
20
- stripePublishableKey?: string;
21
- createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
22
- enableTurnkey?: boolean;
23
- }
24
- /**
25
- * Context for B3 provider
26
- */
27
- export declare const B3Context: import("react").Context<B3ContextType>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.B3Context = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * Context for B3 provider
7
- */
8
- exports.B3Context = (0, react_1.createContext)({
9
- account: undefined,
10
- automaticallySetFirstEoa: false,
11
- //user: undefined,
12
- //setWallet: () => {},
13
- wallet: undefined,
14
- //setUser: () => {},
15
- //refetchUser: async () => {},
16
- initialized: false,
17
- ready: false,
18
- environment: "development",
19
- theme: "light",
20
- clientType: "rest",
21
- partnerId: "",
22
- createClientReferenceId: undefined,
23
- enableTurnkey: false,
24
- });
@@ -1,27 +0,0 @@
1
- import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "../../../../global-account/types/permissions";
4
- import { Account, Wallet } from "thirdweb/wallets";
5
- import { ClientType } from "../../../client-manager";
6
- /**
7
- * Context type for B3Provider
8
- */
9
- export interface B3ContextType {
10
- account?: Account;
11
- automaticallySetFirstEoa: boolean;
12
- wallet?: Wallet;
13
- initialized: boolean;
14
- ready: boolean;
15
- environment?: "development" | "production";
16
- defaultPermissions?: PermissionsConfig;
17
- theme: "light" | "dark";
18
- clientType: ClientType;
19
- partnerId: string;
20
- stripePublishableKey?: string;
21
- createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
22
- enableTurnkey?: boolean;
23
- }
24
- /**
25
- * Context for B3 provider
26
- */
27
- export declare const B3Context: import("react").Context<B3ContextType>;
@@ -1,21 +0,0 @@
1
- import { createContext } from "react";
2
- /**
3
- * Context for B3 provider
4
- */
5
- export const B3Context = createContext({
6
- account: undefined,
7
- automaticallySetFirstEoa: false,
8
- //user: undefined,
9
- //setWallet: () => {},
10
- wallet: undefined,
11
- //setUser: () => {},
12
- //refetchUser: async () => {},
13
- initialized: false,
14
- ready: false,
15
- environment: "development",
16
- theme: "light",
17
- clientType: "rest",
18
- partnerId: "",
19
- createClientReferenceId: undefined,
20
- enableTurnkey: false,
21
- });
@@ -1,27 +0,0 @@
1
- import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
4
- import { Account, Wallet } from "thirdweb/wallets";
5
- import { ClientType } from "../../../client-manager";
6
- /**
7
- * Context type for B3Provider
8
- */
9
- export interface B3ContextType {
10
- account?: Account;
11
- automaticallySetFirstEoa: boolean;
12
- wallet?: Wallet;
13
- initialized: boolean;
14
- ready: boolean;
15
- environment?: "development" | "production";
16
- defaultPermissions?: PermissionsConfig;
17
- theme: "light" | "dark";
18
- clientType: ClientType;
19
- partnerId: string;
20
- stripePublishableKey?: string;
21
- createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
22
- enableTurnkey?: boolean;
23
- }
24
- /**
25
- * Context for B3 provider
26
- */
27
- export declare const B3Context: import("react").Context<B3ContextType>;
@@ -1,50 +0,0 @@
1
- import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
4
- import { createContext } from "react";
5
- import { Account, Wallet } from "thirdweb/wallets";
6
- import { ClientType } from "../../../client-manager";
7
-
8
- /**
9
- * Context type for B3Provider
10
- */
11
- export interface B3ContextType {
12
- account?: Account;
13
- automaticallySetFirstEoa: boolean;
14
- //user?: Users;
15
- //setWallet: (wallet: Wallet) => void;
16
- wallet?: Wallet;
17
- //setUser: (user?: Users) => void;
18
- //refetchUser: () => Promise<any>;
19
- initialized: boolean;
20
- ready: boolean;
21
- environment?: "development" | "production";
22
- defaultPermissions?: PermissionsConfig;
23
- theme: "light" | "dark";
24
- clientType: ClientType;
25
- partnerId: string;
26
- stripePublishableKey?: string;
27
- createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
28
- enableTurnkey?: boolean;
29
- }
30
-
31
- /**
32
- * Context for B3 provider
33
- */
34
- export const B3Context = createContext<B3ContextType>({
35
- account: undefined,
36
- automaticallySetFirstEoa: false,
37
- //user: undefined,
38
- //setWallet: () => {},
39
- wallet: undefined,
40
- //setUser: () => {},
41
- //refetchUser: async () => {},
42
- initialized: false,
43
- ready: false,
44
- environment: "development",
45
- theme: "light",
46
- clientType: "rest",
47
- partnerId: "",
48
- createClientReferenceId: undefined,
49
- enableTurnkey: false,
50
- });