@b3dotfun/sdk 0.0.88-alpha.10 → 0.0.88-alpha.2

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 (281) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +0 -2
  2. package/dist/cjs/anyspend/constants/index.js +1 -3
  3. package/dist/cjs/anyspend/index.d.ts +0 -2
  4. package/dist/cjs/anyspend/index.js +0 -3
  5. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +0 -6
  6. package/dist/cjs/anyspend/react/components/AnySpend.js +6 -9
  7. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  8. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  9. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  10. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -3
  11. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  12. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +20 -24
  13. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  14. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
  15. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  16. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
  17. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  18. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
  19. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  20. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +6 -34
  21. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  22. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -3
  23. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
  24. package/dist/cjs/anyspend/react/hooks/index.d.ts +0 -1
  25. package/dist/cjs/anyspend/react/hooks/index.js +0 -1
  26. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
  27. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
  28. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
  29. package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
  30. package/dist/cjs/global-account/react/components/B3DynamicModal.js +3 -2
  31. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  32. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +57 -35
  33. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  34. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +35 -38
  35. package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
  36. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +27 -0
  37. package/dist/cjs/global-account/react/components/B3Provider/types.js +24 -0
  38. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  39. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +11 -4
  40. package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +2 -5
  41. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  42. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +17 -18
  43. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
  44. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
  45. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
  46. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
  47. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
  48. package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +9 -8
  49. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  50. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
  51. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  52. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  53. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  54. package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
  55. package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +1 -3
  56. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  57. package/dist/cjs/global-account/react/components/index.d.ts +2 -1
  58. package/dist/cjs/global-account/react/components/index.js +6 -3
  59. package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
  60. package/dist/cjs/global-account/react/hooks/index.js +1 -5
  61. package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
  62. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
  63. package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
  64. package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
  65. package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
  66. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
  67. package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
  68. package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +22 -50
  69. package/dist/cjs/global-account/react/hooks/useUserQuery.js +35 -9
  70. package/dist/cjs/global-account/react/index.native.d.ts +2 -0
  71. package/dist/cjs/global-account/react/index.native.js +5 -1
  72. package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
  73. package/dist/cjs/global-account/react/stores/index.js +1 -3
  74. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -10
  75. package/dist/esm/anyspend/constants/index.d.ts +0 -2
  76. package/dist/esm/anyspend/constants/index.js +0 -2
  77. package/dist/esm/anyspend/index.d.ts +0 -2
  78. package/dist/esm/anyspend/index.js +0 -3
  79. package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
  80. package/dist/esm/anyspend/react/components/AnySpend.js +8 -11
  81. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  82. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  83. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  84. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -3
  85. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  86. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -8
  87. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  88. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
  89. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  90. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -14
  91. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  92. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -3
  93. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  94. package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -36
  95. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  96. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -3
  97. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +4 -3
  98. package/dist/esm/anyspend/react/hooks/index.d.ts +0 -1
  99. package/dist/esm/anyspend/react/hooks/index.js +0 -1
  100. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
  101. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  102. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
  103. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
  104. package/dist/esm/global-account/react/components/B3DynamicModal.js +4 -3
  105. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  106. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +58 -34
  107. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  108. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
  109. package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
  110. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +27 -0
  111. package/dist/esm/global-account/react/components/B3Provider/types.js +21 -0
  112. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  113. package/dist/esm/global-account/react/components/B3Provider/useB3.js +11 -4
  114. package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +2 -5
  115. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  116. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +17 -18
  117. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
  118. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
  119. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
  120. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
  121. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
  122. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +3 -2
  123. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  124. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -76
  125. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  126. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  127. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  128. package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
  129. package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +3 -5
  130. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  131. package/dist/esm/global-account/react/components/index.d.ts +2 -1
  132. package/dist/esm/global-account/react/components/index.js +2 -1
  133. package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
  134. package/dist/esm/global-account/react/hooks/index.js +0 -2
  135. package/dist/esm/global-account/react/hooks/useClient.js +2 -2
  136. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  137. package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
  138. package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
  139. package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
  140. package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
  141. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +2 -4
  142. package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +22 -50
  143. package/dist/esm/global-account/react/hooks/useUserQuery.js +27 -1
  144. package/dist/esm/global-account/react/index.native.d.ts +2 -0
  145. package/dist/esm/global-account/react/index.native.js +2 -0
  146. package/dist/esm/global-account/react/stores/index.d.ts +0 -1
  147. package/dist/esm/global-account/react/stores/index.js +0 -1
  148. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -10
  149. package/dist/styles/index.css +1 -1
  150. package/dist/types/anyspend/constants/index.d.ts +0 -2
  151. package/dist/types/anyspend/index.d.ts +0 -2
  152. package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
  153. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +1 -5
  154. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
  155. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -6
  156. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +1 -7
  157. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -4
  158. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +1 -3
  159. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +0 -4
  160. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +1 -3
  161. package/dist/types/anyspend/react/hooks/index.d.ts +0 -1
  162. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +18 -2
  163. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  164. package/dist/types/global-account/react/components/B3Provider/types.d.ts +27 -0
  165. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +4 -14
  166. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +2 -10
  167. package/dist/types/global-account/react/components/index.d.ts +2 -1
  168. package/dist/types/global-account/react/hooks/index.d.ts +0 -2
  169. package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
  170. package/dist/types/global-account/react/index.native.d.ts +2 -0
  171. package/dist/types/global-account/react/stores/index.d.ts +0 -1
  172. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -10
  173. package/package.json +1 -1
  174. package/src/anyspend/constants/index.ts +0 -3
  175. package/src/anyspend/index.ts +0 -4
  176. package/src/anyspend/react/components/AnySpend.tsx +2 -28
  177. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +0 -6
  178. package/src/anyspend/react/components/AnySpendCustom.tsx +47 -52
  179. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -23
  180. package/src/anyspend/react/components/AnySpendDeposit.tsx +1 -18
  181. package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -4
  182. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -15
  183. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +1 -5
  184. package/src/anyspend/react/components/common/OrderDetails.tsx +42 -60
  185. package/src/anyspend/react/components/common/PanelOnramp.tsx +1 -5
  186. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +4 -3
  187. package/src/anyspend/react/hooks/index.ts +0 -1
  188. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
  189. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
  190. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
  191. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
  192. package/src/global-account/react/components/B3DynamicModal.tsx +4 -3
  193. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +54 -43
  194. package/src/global-account/react/components/B3Provider/B3Provider.tsx +117 -44
  195. package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
  196. package/src/global-account/react/components/B3Provider/types.ts +50 -0
  197. package/src/global-account/react/components/B3Provider/useB3.ts +13 -4
  198. package/src/global-account/react/components/B3Provider/useB3Account.ts +2 -6
  199. package/src/global-account/react/components/B3Provider/useB3Config.ts +31 -18
  200. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +4 -2
  201. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
  202. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
  203. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
  204. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
  205. package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
  206. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  207. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +100 -168
  208. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
  209. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  210. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  211. package/src/global-account/react/components/StyleRoot.tsx +3 -3
  212. package/src/global-account/react/components/TurnkeyAuthModal.tsx +4 -7
  213. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  214. package/src/global-account/react/components/index.ts +2 -1
  215. package/src/global-account/react/hooks/index.ts +0 -2
  216. package/src/global-account/react/hooks/useClient.ts +2 -2
  217. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
  218. package/src/global-account/react/hooks/useNotifications.ts +2 -2
  219. package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
  220. package/src/global-account/react/hooks/useTokenBalance.tsx +7 -8
  221. package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +2 -4
  222. package/src/global-account/react/hooks/useTurnkeyAuth.ts +23 -54
  223. package/src/global-account/react/hooks/useUserQuery.ts +40 -1
  224. package/src/global-account/react/index.native.ts +2 -0
  225. package/src/global-account/react/stores/index.ts +0 -1
  226. package/src/global-account/react/stores/useModalStore.ts +0 -10
  227. package/dist/cjs/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  228. package/dist/cjs/anyspend/react/components/common/GasIndicator.js +0 -34
  229. package/dist/cjs/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  230. package/dist/cjs/anyspend/react/hooks/useGasPrice.js +0 -43
  231. package/dist/cjs/anyspend/services/gas.d.ts +0 -21
  232. package/dist/cjs/anyspend/services/gas.js +0 -65
  233. package/dist/cjs/anyspend/types/gas.d.ts +0 -61
  234. package/dist/cjs/anyspend/types/gas.js +0 -2
  235. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  236. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -12
  237. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
  238. package/dist/cjs/global-account/react/hooks/useAuth.js +0 -337
  239. package/dist/cjs/global-account/react/hooks/useUser.d.ts +0 -60
  240. package/dist/cjs/global-account/react/hooks/useUser.js +0 -20
  241. package/dist/cjs/global-account/react/stores/configStore.d.ts +0 -24
  242. package/dist/cjs/global-account/react/stores/configStore.js +0 -30
  243. package/dist/cjs/global-account/react/stores/userStore.d.ts +0 -22
  244. package/dist/cjs/global-account/react/stores/userStore.js +0 -30
  245. package/dist/esm/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  246. package/dist/esm/anyspend/react/components/common/GasIndicator.js +0 -31
  247. package/dist/esm/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  248. package/dist/esm/anyspend/react/hooks/useGasPrice.js +0 -40
  249. package/dist/esm/anyspend/services/gas.d.ts +0 -21
  250. package/dist/esm/anyspend/services/gas.js +0 -59
  251. package/dist/esm/anyspend/types/gas.d.ts +0 -61
  252. package/dist/esm/anyspend/types/gas.js +0 -1
  253. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  254. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +0 -10
  255. package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
  256. package/dist/esm/global-account/react/hooks/useAuth.js +0 -331
  257. package/dist/esm/global-account/react/hooks/useUser.d.ts +0 -60
  258. package/dist/esm/global-account/react/hooks/useUser.js +0 -17
  259. package/dist/esm/global-account/react/stores/configStore.d.ts +0 -24
  260. package/dist/esm/global-account/react/stores/configStore.js +0 -27
  261. package/dist/esm/global-account/react/stores/userStore.d.ts +0 -22
  262. package/dist/esm/global-account/react/stores/userStore.js +0 -27
  263. package/dist/types/anyspend/react/components/common/GasIndicator.d.ts +0 -6
  264. package/dist/types/anyspend/react/hooks/useGasPrice.d.ts +0 -37
  265. package/dist/types/anyspend/services/gas.d.ts +0 -21
  266. package/dist/types/anyspend/types/gas.d.ts +0 -61
  267. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +0 -5
  268. package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
  269. package/dist/types/global-account/react/hooks/useUser.d.ts +0 -60
  270. package/dist/types/global-account/react/stores/configStore.d.ts +0 -24
  271. package/dist/types/global-account/react/stores/userStore.d.ts +0 -22
  272. package/src/anyspend/react/components/common/GasIndicator.tsx +0 -59
  273. package/src/anyspend/react/hooks/useGasPrice.ts +0 -70
  274. package/src/anyspend/services/gas.test.ts +0 -31
  275. package/src/anyspend/services/gas.ts +0 -73
  276. package/src/anyspend/types/gas.ts +0 -66
  277. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +0 -19
  278. package/src/global-account/react/hooks/useAuth.ts +0 -379
  279. package/src/global-account/react/hooks/useUser.ts +0 -20
  280. package/src/global-account/react/stores/configStore.ts +0 -51
  281. package/src/global-account/react/stores/userStore.ts +0 -41
@@ -1,19 +0,0 @@
1
- import { useAuthentication } from "../../hooks";
2
- import { useAutoSelectWallet } from "../../hooks/useAutoSelectWallet";
3
-
4
- const AuthenticationProvider = ({
5
- partnerId,
6
- automaticallySetFirstEoa,
7
- }: {
8
- partnerId: string;
9
- automaticallySetFirstEoa: boolean;
10
- }) => {
11
- useAuthentication(partnerId);
12
- useAutoSelectWallet({
13
- enabled: automaticallySetFirstEoa,
14
- });
15
-
16
- return null;
17
- };
18
-
19
- export default AuthenticationProvider;
@@ -1,379 +0,0 @@
1
- import app from "@b3dotfun/sdk/global-account/app";
2
- import { authenticateWithB3JWT } from "@b3dotfun/sdk/global-account/bsmnt";
3
- import { useAuthStore, useB3Config } from "@b3dotfun/sdk/global-account/react";
4
- import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
5
- import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
6
- import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
7
- import { ConnectionOptions } from "@thirdweb-dev/wagmi-adapter";
8
- import { getConnectors } from "@wagmi/core";
9
- import { useCallback, useContext, useEffect, useRef } from "react";
10
- import {
11
- useActiveWallet,
12
- useAutoConnect,
13
- useConnectedWallets,
14
- useDisconnect,
15
- useSetActiveWallet,
16
- } from "thirdweb/react";
17
- import { Wallet, ecosystemWallet } from "thirdweb/wallets";
18
- import { preAuthenticate } from "thirdweb/wallets/in-app";
19
- import { useAccount, useConnect, useSwitchAccount } from "wagmi";
20
- import { LocalSDKContext } from "../components/B3Provider/LocalSDKProvider";
21
- import { createWagmiConfig } from "../utils/createWagmiConfig";
22
- import { useSearchParam } from "./useSearchParamsSSR";
23
- import { useUserQuery } from "./useUserQuery";
24
-
25
- const debug = debugB3React("useAuth");
26
-
27
- /**
28
- * Unified authentication hook that uses Turnkey for authentication
29
- * This replaces the previous Thirdweb-based authentication
30
- *
31
- * This hook provides 1:1 feature parity with useAuthentication.ts
32
- */
33
- export function useAuth() {
34
- const { onConnectCallback } = useContext(LocalSDKContext);
35
- const { disconnect } = useDisconnect();
36
- const wallets = useConnectedWallets();
37
- const activeWallet = useActiveWallet();
38
- const isAuthenticated = useAuthStore(state => state.isAuthenticated);
39
- const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
40
- const setIsConnected = useAuthStore(state => state.setIsConnected);
41
- const isConnecting = useAuthStore(state => state.isConnecting);
42
- const isConnected = useAuthStore(state => state.isConnected);
43
- const isAuthenticating = useAuthStore(state => state.isAuthenticating);
44
- const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
45
- const setHasStartedConnecting = useAuthStore(state => state.setHasStartedConnecting);
46
- const setActiveWallet = useSetActiveWallet();
47
- const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
48
- const useAutoConnectLoadingPrevious = useRef(false);
49
- const referralCode = useSearchParam("referralCode");
50
- const { partnerId } = useB3Config();
51
- const wagmiConfig = createWagmiConfig({ partnerId });
52
- const { connect } = useConnect();
53
- const activeWagmiAccount = useAccount();
54
- const { switchAccount } = useSwitchAccount();
55
- const { user, setUser } = useUserQuery();
56
- debug("@@activeWagmiAccount", activeWagmiAccount);
57
-
58
- const wallet = ecosystemWallet(ecosystemWalletId, {
59
- partnerId: partnerId,
60
- });
61
-
62
- /**
63
- * Re-authenticate using existing session
64
- * Also updates user state and authenticates with BSMNT
65
- */
66
- const reAuthenticate = useCallback(async () => {
67
- debug("Re-authenticating...");
68
- try {
69
- const response = await app.reAuthenticate();
70
- debug("Re-authentication successful", response);
71
-
72
- // Update user state if user data exists
73
- if (response.user) {
74
- setUser(response.user);
75
- debug("User state updated", response.user);
76
- }
77
-
78
- // Authenticate with BSMNT
79
- try {
80
- const b3Jwt = await authenticateWithB3JWT(response.accessToken);
81
- debug("BSMNT re-authentication successful", b3Jwt);
82
- } catch (bsmntError) {
83
- // BSMNT authentication failure shouldn't block the main auth flow
84
- debug("BSMNT re-authentication failed (non-critical)", bsmntError);
85
- }
86
-
87
- return response;
88
- } catch (err: any) {
89
- debug("Re-authentication failed", err);
90
- throw err;
91
- }
92
- }, [setUser]);
93
-
94
- const syncWagmi = useCallback(async () => {
95
- function syncWagmiFunc() {
96
- const connectors = getConnectors(wagmiConfig);
97
- debug("@@syncWagmi", {
98
- connectors,
99
- wallets,
100
- });
101
-
102
- // For each that matchs a TW wallet on wallets, connect to the wagmi connector
103
- // or, since ecosystem wallets is separate, connect those via in-app-wallet from wagmi
104
- connectors.forEach(async connector => {
105
- const twWallet = wallets.find(wallet => wallet.id === connector.id || connector.id === "in-app-wallet");
106
-
107
- // If no TW wallet, do not prompt the user to connect
108
- if (!twWallet) {
109
- return;
110
- }
111
-
112
- // Metamask will prompt to connect, we can just switch accounts here.
113
- if (connector.id === "io.metamask") {
114
- return switchAccount({ connector });
115
- }
116
-
117
- if (
118
- // If it's not an in-app wallet or it is the ecosystem wallet, connect
119
- connector.id !== "in-app-wallet" ||
120
- (connector.id === "in-app-wallet" && twWallet.id === ecosystemWalletId)
121
- ) {
122
- try {
123
- const options = {
124
- wallet: twWallet, // the connected wallet
125
- } satisfies ConnectionOptions;
126
- debug("@@syncWagmi:connecting", { twWallet, connector });
127
- connect({
128
- connector,
129
- ...options,
130
- });
131
- } catch (error) {
132
- console.error("@@syncWagmi:error", error);
133
- }
134
- } else {
135
- debug("@@syncWagmi:not-connecting", connector);
136
- }
137
- });
138
- }
139
- syncWagmiFunc();
140
- // wagmi config shouldn't change
141
- // eslint-disable-next-line react-hooks/exhaustive-deps
142
- }, [partnerId, wallets]);
143
-
144
- useEffect(() => {
145
- syncWagmi();
146
- }, [wallets, syncWagmi]);
147
-
148
- /**
149
- * Authenticate user using Turnkey
150
- * Note: This no longer requires a wallet for authentication.
151
- * Wallets are still used for signing transactions, but authentication is done via Turnkey email OTP.
152
- *
153
- * For backward compatibility, this function still accepts a wallet parameter,
154
- * but it's not used for authentication anymore.
155
- */
156
- const authenticateUser = useCallback(async () => {
157
- setHasStartedConnecting(true);
158
-
159
- // Try to re-authenticate first
160
- try {
161
- const userAuth = await reAuthenticate();
162
- setUser(userAuth.user);
163
- setIsAuthenticated(true);
164
- setIsAuthenticating(false);
165
- debug("Re-authenticated successfully", { userAuth });
166
-
167
- // Authenticate on BSMNT with B3 JWT
168
- const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
169
- debug("@@b3Jwt", b3Jwt);
170
-
171
- return userAuth;
172
- } catch (error) {
173
- // If re-authentication fails, user needs to authenticate via Turnkey
174
- // This should be handled by the Turnkey auth modal/flow
175
- debug("Re-authentication failed. User needs to authenticate via Turnkey.", error);
176
- setIsAuthenticated(false);
177
- setIsAuthenticating(false);
178
- throw new Error("Authentication required. Please authenticate via Turnkey.");
179
- }
180
- }, [reAuthenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
181
-
182
- /**
183
- * Authenticate with Turnkey using email OTP
184
- * This is the primary authentication method, replacing Thirdweb wallet-based auth
185
- *
186
- * This function:
187
- * 1. Authenticates with FeathersJS (persists session via cookies)
188
- * 2. Sets user state in the user store (persists to localStorage)
189
- * 3. Authenticates with BSMNT for basement integration
190
- */
191
- const authenticate = useCallback(
192
- async (turnkeySessionJwt: string, partnerId: string) => {
193
- if (!turnkeySessionJwt) {
194
- throw new Error("Turnkey session JWT is required");
195
- }
196
-
197
- debug("Authenticating with Turnkey JWT", { referralCode, partnerId });
198
-
199
- try {
200
- // Step 1: Authenticate with FeathersJS (session persisted via cookies)
201
- const response = await app.authenticate({
202
- strategy: "turnkey-jwt",
203
- accessToken: turnkeySessionJwt,
204
- referralCode,
205
- partnerId: partnerId,
206
- } as any);
207
-
208
- debug("Authentication successful", response);
209
-
210
- // Step 2: Set user state (persists to localStorage via Zustand)
211
- if (response.user) {
212
- setUser(response.user);
213
- debug("User state updated", response.user);
214
- }
215
-
216
- // Step 3: Authenticate with BSMNT for basement integration
217
- try {
218
- const b3Jwt = await authenticateWithB3JWT(response.accessToken);
219
- debug("BSMNT authentication successful", b3Jwt);
220
- } catch (bsmntError) {
221
- // BSMNT authentication failure shouldn't block the main auth flow
222
- debug("BSMNT authentication failed (non-critical)", bsmntError);
223
- }
224
-
225
- return response;
226
- } catch (err: any) {
227
- debug("Authentication failed", err);
228
- throw err;
229
- }
230
- },
231
- [referralCode, setUser],
232
- );
233
-
234
- /**
235
- * Handle wallet connection
236
- * Note: With Turnkey migration, wallet connection is primarily for signing transactions,
237
- * not for authentication. Authentication should be done separately via Turnkey email OTP.
238
- */
239
- /**
240
- * Handle wallet connection
241
- * Note: With Turnkey migration, wallet connection is primarily for signing transactions,
242
- * not for authentication. Authentication should be done separately via Turnkey email OTP.
243
- */
244
- const onConnect = useCallback(
245
- async (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => {
246
- debug("@@useAuth:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
247
-
248
- const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
249
-
250
- if (!wallet) {
251
- throw new Error("No smart wallet found during auto-connect");
252
- }
253
-
254
- debug("@@useAuth:onConnect", { wallet });
255
-
256
- try {
257
- setHasStartedConnecting(true);
258
- setIsConnected(true);
259
- setIsAuthenticating(true);
260
- await setActiveWallet(wallet);
261
-
262
- // Try to authenticate user (will use re-authenticate if session exists)
263
- // If no session exists, authentication will need to happen via Turnkey flow
264
- try {
265
- const userAuth = await authenticateUser();
266
-
267
- if (userAuth && onConnectCallback) {
268
- await onConnectCallback(wallet, userAuth.accessToken);
269
- }
270
- } catch (authError) {
271
- // Authentication failed - this is expected if user hasn't authenticated via Turnkey yet
272
- // The Turnkey auth modal should handle this
273
- debug("@@useAuth:onConnect:authFailed", { authError });
274
- // Don't set isAuthenticated to false here - let the Turnkey flow handle it
275
- }
276
- } catch (error) {
277
- debug("@@useAuth:onConnect:failed", { error });
278
- setIsAuthenticated(false);
279
- setUser(undefined);
280
- } finally {
281
- setIsAuthenticating(false);
282
- }
283
-
284
- debug({
285
- isAuthenticated,
286
- isAuthenticating,
287
- isConnected,
288
- });
289
- },
290
- [
291
- onConnectCallback,
292
- authenticateUser,
293
- isAuthenticated,
294
- isAuthenticating,
295
- isConnected,
296
- setActiveWallet,
297
- setHasStartedConnecting,
298
- setIsAuthenticated,
299
- setIsAuthenticating,
300
- setIsConnected,
301
- setUser,
302
- ],
303
- );
304
-
305
- const logout = useCallback(
306
- async (callback?: () => void) => {
307
- if (activeWallet) {
308
- debug("@@logout:activeWallet", activeWallet);
309
- disconnect(activeWallet);
310
- debug("@@logout:activeWallet", activeWallet);
311
- }
312
-
313
- // Log out of each wallet
314
- wallets.forEach(wallet => {
315
- console.log("@@logging out", wallet);
316
- disconnect(wallet);
317
- });
318
-
319
- // Delete localStorage thirdweb:connected-wallet-ids
320
- // https://npc-labs.slack.com/archives/C070E6HNG85/p1750185115273099
321
- if (typeof localStorage !== "undefined") {
322
- localStorage.removeItem("thirdweb:connected-wallet-ids");
323
- localStorage.removeItem("wagmi.store");
324
- localStorage.removeItem("lastAuthProvider");
325
- localStorage.removeItem("b3-user");
326
- }
327
-
328
- app.logout();
329
- debug("@@logout:loggedOut");
330
-
331
- setIsAuthenticated(false);
332
- setIsConnected(false);
333
- setUser();
334
- callback?.();
335
- },
336
- [activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected],
337
- );
338
-
339
- const { isLoading: useAutoConnectLoading } = useAutoConnect({
340
- client,
341
- wallets: [wallet],
342
- onConnect,
343
- onTimeout: () => {
344
- logout().catch(error => {
345
- debug("@@useAuth:logout on timeout failed", { error });
346
- });
347
- },
348
- });
349
-
350
- /**
351
- * useAutoConnectLoading starts as false
352
- */
353
- useEffect(() => {
354
- if (!useAutoConnectLoading && useAutoConnectLoadingPrevious.current && !hasStartedConnecting) {
355
- setIsAuthenticating(false);
356
- }
357
- useAutoConnectLoadingPrevious.current = useAutoConnectLoading;
358
- }, [useAutoConnectLoading, hasStartedConnecting, setIsAuthenticating]);
359
-
360
- const isReady = isAuthenticated && !isAuthenticating;
361
-
362
- return {
363
- authenticate,
364
- reAuthenticate,
365
- logout,
366
- isAuthenticated,
367
- isReady,
368
- isConnecting,
369
- isConnected,
370
- wallet,
371
- preAuthenticate,
372
- connect: onConnect,
373
- isAuthenticating,
374
- onConnect,
375
- user,
376
- refetchUser: authenticateUser,
377
- setUser,
378
- };
379
- }
@@ -1,20 +0,0 @@
1
- import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
- import { useUserStore } from "../stores/userStore";
3
-
4
- /**
5
- * Preferred Hook to get the user data
6
- */
7
- export function useUser() {
8
- const user = useUserStore(state => state.user);
9
-
10
- const isConnecting = useAuthStore(state => state.isConnecting);
11
- const isConnected = useAuthStore(state => state.isConnected);
12
- const isAuthenticating = useAuthStore(state => state.isAuthenticating);
13
-
14
- return {
15
- user,
16
- isConnecting,
17
- isConnected,
18
- isAuthenticating,
19
- };
20
- }
@@ -1,51 +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 } from "thirdweb/wallets";
5
- import { create } from "zustand";
6
- import { ClientType } from "../../client-manager";
7
-
8
- /**
9
- * Default permissions configuration for B3 provider
10
- */
11
- const DEFAULT_PERMISSIONS: PermissionsConfig = {
12
- approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
13
- nativeTokenLimitPerTransaction: 0.1,
14
- startDate: new Date(),
15
- endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
16
- };
17
-
18
- interface ConfigStore {
19
- accountOverride?: Account;
20
- automaticallySetFirstEoa: 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
- // Actions
31
- setConfig: (config: Partial<Omit<ConfigStore, "setConfig">>) => void;
32
- }
33
-
34
- /**
35
- * Zustand store for B3 configuration
36
- * NOT persisted - these are developer-set configuration values
37
- */
38
- export const useB3ConfigStore = create<ConfigStore>(set => ({
39
- accountOverride: undefined,
40
- automaticallySetFirstEoa: false,
41
- environment: "development",
42
- defaultPermissions: DEFAULT_PERMISSIONS,
43
- theme: "light",
44
- clientType: "rest",
45
- partnerId: "",
46
- stripePublishableKey: undefined,
47
- createClientReferenceId: undefined,
48
- enableTurnkey: false,
49
-
50
- setConfig: config => set(state => ({ ...state, ...config })),
51
- }));
@@ -1,41 +0,0 @@
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
- );