@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
@@ -10,7 +10,7 @@ import { FIAT_PAYMENT_METHOD_DISPLAY, FiatPaymentMethod } from "./FiatPaymentMet
10
10
  import { OrderTokenAmountFiat } from "./OrderTokenAmountFiat.js";
11
11
  import { PointsBadge } from "./PointsBadge.js";
12
12
  const ONE_CHAR_WIDTH = 30;
13
- export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues = ["5", "10", "20", "25"], customRecipientLabel, }) {
13
+ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPaymentMethod, setActivePanel, _recipientAddress, destinationToken, destinationChainId, destinationAmount, onDestinationTokenChange, onDestinationChainChange, fiatPaymentMethodIndex, recipientSelectionPanelIndex, dstTokenSymbol, hideDstToken = false, anyspendQuote, onShowPointsDetail, onShowFeeDetail, customUsdInputValues = ["5", "10", "20", "25"], }) {
14
14
  // Helper function to get fees from anyspend quote
15
15
  const getFeeFromApi = (paymentMethod) => {
16
16
  // Try to get fee from anyspend quote first (most accurate)
@@ -87,8 +87,7 @@ export function PanelOnramp({ srcAmountOnRamp, setSrcAmountOnRamp, selectedPayme
87
87
  .filter(v => !isNaN(Number(v)))
88
88
  .map(value => (_jsxs("button", { onClick: () => handleQuickAmount(value), className: `bg-as-surface-secondary border-as-border-secondary hover:border-as-border-secondary h-7 w-14 rounded-lg border text-sm font-medium transition-all duration-200 ${srcAmountOnRamp === value
89
89
  ? "border-as-border-secondary bg-as-surface-secondary"
90
- : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children: customRecipientLabel ||
91
- (recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress)) }), _jsx(ChevronRight, { size: 16 })] })) : (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between gap-4", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex flex-wrap items-center justify-end gap-1", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Total" }), anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) })), anyspendQuote?.data?.pointsAmount && anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod.NONE).toFixed(2)] }), (() => {
90
+ : "bg-as-surface-secondary hover:bg-as-surface-secondary"}`, children: ["$", value] }, value))) }), destinationToken && destinationChainId && !hideDstToken && (_jsx(OrderTokenAmountFiat, { address: _recipientAddress, context: "to", inputValue: destinationAmount || "0", onChangeInput: () => { }, chainId: destinationChainId, setChainId: onDestinationChainChange || (() => { }), token: destinationToken, setToken: onDestinationTokenChange || (() => { }) }))] }), _jsxs("div", { className: "border-as-border-secondary bg-as-surface-secondary mt-4 flex w-full flex-col gap-3 rounded-xl border p-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "text-as-tertiarry flex items-center text-sm", children: "Recipient" }), _recipientAddress ? (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(recipientSelectionPanelIndex), children: [_jsx("span", { className: "text-sm", children: recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress) }), _jsx(ChevronRight, { size: 16 })] })) : (_jsxs("button", { className: "text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700", onClick: () => setActivePanel(5), children: [_jsx(Wallet, { className: "text-as-brand", size: 16 }), "Select recipient", _jsx(ChevronRight, { size: 16 })] }))] }), _jsx("div", { className: "divider w-full" }), _jsxs("div", { className: "flex items-center justify-between gap-4", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Expected to receive" }), _jsxs("div", { className: "flex flex-wrap items-center justify-end gap-1", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: [destinationAmount || "0", " ", dstTokenSymbol || destinationToken?.symbol || ""] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsxs("span", { className: "text-as-tertiarry text-sm", children: ["on ", destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""] }), destinationToken && destinationChainId && destinationToken.metadata?.logoURI && (_jsx("img", { src: ALL_CHAINS[destinationChainId]?.logoUrl, alt: "Chain", className: "h-4 w-4 rounded-full" }))] })] })] }), _jsx("div", { className: "divider w-full" }), _jsx("div", { className: "", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "text-as-tertiarry text-sm", children: "Total" }), anyspendQuote?.data?.fee && onShowFeeDetail && (_jsx("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: _jsx(Info, { className: "h-4 w-4" }) })), anyspendQuote?.data?.pointsAmount && anyspendQuote?.data?.pointsAmount > 0 && (_jsx(PointsBadge, { pointsAmount: anyspendQuote.data.pointsAmount, pointsMultiplier: anyspendQuote.data.pointsMultiplier, onClick: () => onShowPointsDetail?.() }))] }), _jsxs("div", { className: "flex flex-col items-end gap-0.5", children: [_jsxs("span", { className: "text-as-primary font-semibold", children: ["$", getTotalAmount(selectedPaymentMethod || FiatPaymentMethod.NONE).toFixed(2)] }), (() => {
92
91
  // For fiat payments, show the fee from the payment method
93
92
  const fiatFee = getFeeFromApi(selectedPaymentMethod || FiatPaymentMethod.NONE);
94
93
  if (fiatFee !== null && fiatFee > 0) {
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getStripePromise } from "../../../../shared/utils/payment.utils.js";
2
3
  import { OrderDetailsCollapsible, useStripeClientSecret } from "../../../../anyspend/react/index.js";
3
- import { ShinyButton, useB3Config, useModalStore, useProfile } from "../../../../global-account/react/index.js";
4
+ import { ShinyButton, useB3, useModalStore, useProfile } from "../../../../global-account/react/index.js";
4
5
  import { formatTokenAmount } from "../../../../shared/utils/number.js";
5
- import { formatStripeAmount, getStripePromise } from "../../../../shared/utils/payment.utils.js";
6
+ import { formatStripeAmount } from "../../../../shared/utils/payment.utils.js";
6
7
  import { AddressElement, Elements, PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
7
8
  import { X } from "lucide-react";
8
9
  import { useEffect, useState } from "react";
@@ -10,7 +11,7 @@ import { AnySpendFingerprintWrapper, getFingerprintConfig } from "../AnySpendFin
10
11
  import HowItWorks from "./HowItWorks.js";
11
12
  import PaymentMethodIcons from "./PaymentMethodIcons.js";
12
13
  export default function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }) {
13
- const { theme, stripePublishableKey } = useB3Config();
14
+ const { theme, stripePublishableKey } = useB3();
14
15
  const fingerprintConfig = getFingerprintConfig();
15
16
  const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = useStripeClientSecret(stripePaymentIntentId);
16
17
  if (isLoadingStripeClientSecret) {
@@ -7,7 +7,6 @@ export * from "./useAnyspendQuote";
7
7
  export * from "./useAnyspendTokens";
8
8
  export * from "./useCoinbaseOnrampOptions";
9
9
  export * from "./useConnectedUserProfile";
10
- export * from "./useGasPrice";
11
10
  export * from "./useGeoOnrampOptions";
12
11
  export * from "./useGetGeo";
13
12
  export * from "./useHyperliquidTransfer";
@@ -7,7 +7,6 @@ export * from "./useAnyspendQuote.js";
7
7
  export * from "./useAnyspendTokens.js";
8
8
  export * from "./useCoinbaseOnrampOptions.js";
9
9
  export * from "./useConnectedUserProfile.js";
10
- export * from "./useGasPrice.js";
11
10
  export * from "./useGeoOnrampOptions.js";
12
11
  export * from "./useGetGeo.js";
13
12
  export * from "./useHyperliquidTransfer.js";
@@ -1,7 +1,7 @@
1
1
  import { USDC_BASE } from "../../../anyspend/constants/index.js";
2
2
  import { anyspendService } from "../../../anyspend/services/anyspend.js";
3
3
  import { buildMetadata, buildPayload, normalizeAddress } from "../../../anyspend/utils/index.js";
4
- import { useB3Config } from "../../../global-account/react/index.js";
4
+ import { useB3 } from "../../../global-account/react/index.js";
5
5
  import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
6
6
  import { useMutation } from "@tanstack/react-query";
7
7
  import { useMemo } from "react";
@@ -14,7 +14,7 @@ import { useValidatedClientReferenceId } from "./useValidatedClientReferenceId.j
14
14
  */
15
15
  export function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
16
16
  // Get B3 context values
17
- const { partnerId } = useB3Config();
17
+ const { partnerId } = useB3();
18
18
  // Get validated client reference ID from B3 context
19
19
  const createValidatedClientReferenceId = useValidatedClientReferenceId();
20
20
  // Get fingerprint data
@@ -1,6 +1,6 @@
1
1
  import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { buildMetadata, buildPayload, normalizeAddress } from "../../../anyspend/utils/index.js";
3
- import { useB3Config } from "../../../global-account/react/index.js";
3
+ import { useB3 } from "../../../global-account/react/index.js";
4
4
  import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
5
5
  import { useMutation } from "@tanstack/react-query";
6
6
  import { useMemo } from "react";
@@ -12,7 +12,7 @@ import { useValidatedClientReferenceId } from "./useValidatedClientReferenceId.j
12
12
  */
13
13
  export function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
14
14
  // Get B3 context values
15
- const { partnerId } = useB3Config();
15
+ const { partnerId } = useB3();
16
16
  // Get validated client reference ID from B3 context
17
17
  const createValidatedClientReferenceId = useValidatedClientReferenceId();
18
18
  // Get fingerprint data
@@ -1,6 +1,6 @@
1
1
  import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
2
  import { normalizeAddress } from "../../../anyspend/utils/index.js";
3
- import { useB3Config } from "../../../global-account/react/index.js";
3
+ import { useB3 } from "../../../global-account/react/index.js";
4
4
  import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
5
5
  import { useMutation } from "@tanstack/react-query";
6
6
  import { useMemo } from "react";
@@ -9,7 +9,7 @@ import { useMemo } from "react";
9
9
  * This order type doesn't require srcAmount - the user deposits tokens after the order is created.
10
10
  */
11
11
  export function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
12
- const { partnerId } = useB3Config();
12
+ const { partnerId } = useB3();
13
13
  const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
14
14
  const visitorData = fpData && {
15
15
  requestId: fpData.requestId,
@@ -1,12 +1,12 @@
1
1
  import { Validators } from "../../../anyspend/utils/validation.js";
2
- import { useB3Config } from "../../../global-account/react/index.js";
2
+ import { useB3 } from "../../../global-account/react/index.js";
3
3
  import { useCallback } from "react";
4
4
  /**
5
5
  * Hook that provides a validated client reference ID
6
6
  * Gets the createClientReferenceId function from B3 context and validates the result
7
7
  */
8
8
  export function useValidatedClientReferenceId() {
9
- const { createClientReferenceId } = useB3Config();
9
+ const { createClientReferenceId } = useB3();
10
10
  const createValidatedClientReferenceId = useCallback(async (params) => {
11
11
  // If no function provided, return undefined
12
12
  if (!createClientReferenceId) {
@@ -4,13 +4,14 @@ import { AnySpendDepositHype } from "../../../anyspend/react/components/Anyspend
4
4
  import { AnySpendDepositUpside } from "../../../anyspend/react/components/AnySpendDepositUpside.js";
5
5
  import { AnySpendStakeUpside } from "../../../anyspend/react/components/AnySpendStakeUpside.js";
6
6
  import { AnySpendStakeUpsideExactIn } from "../../../anyspend/react/components/AnySpendStakeUpsideExactIn.js";
7
- import { useB3Config, useGlobalAccount, useIsMobile, useModalStore } from "../../../global-account/react/index.js";
7
+ import { useGlobalAccount, useIsMobile, useModalStore } from "../../../global-account/react/index.js";
8
8
  import { cn } from "../../../shared/utils/cn.js";
9
9
  import { debugB3React } from "../../../shared/utils/debug.js";
10
10
  import { AnimatePresence, motion } from "framer-motion";
11
11
  import { useEffect, useRef } from "react";
12
12
  import { useSetActiveWallet } from "thirdweb/react";
13
13
  import { AvatarEditor } from "./AvatarEditor/AvatarEditor.js";
14
+ import { useB3 } from "./B3Provider/useB3.js";
14
15
  import { Deposit } from "./Deposit/Deposit.js";
15
16
  import { LinkAccount } from "./LinkAccount/LinkAccount.js";
16
17
  import { LinkNewAccount } from "./LinkAccount/LinkNewAccount.js";
@@ -19,8 +20,8 @@ import NotificationsContent from "./ManageAccount/NotificationsContent.js";
19
20
  import { RequestPermissions } from "./RequestPermissions/RequestPermissions.js";
20
21
  import { Send } from "./Send/Send.js";
21
22
  import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow.js";
22
- import { ToastContainer, useToastContext } from "./Toast/index.js";
23
23
  import { TurnkeyAuthModal } from "./TurnkeyAuthModal.js";
24
+ import { ToastContainer, useToastContext } from "./Toast/index.js";
24
25
  import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog.js";
25
26
  import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer.js";
26
27
  const debug = debugB3React("B3DynamicModal");
@@ -29,7 +30,7 @@ export function B3DynamicModal() {
29
30
  const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
30
31
  const contentType = useModalStore(state => state.contentType);
31
32
  const navigateBack = useModalStore(state => state.navigateBack);
32
- const { theme } = useB3Config();
33
+ const { theme } = useB3();
33
34
  const isMobile = useIsMobile();
34
35
  const prevIsOpenRef = useRef(isOpen);
35
36
  const { wallet } = useGlobalAccount();
@@ -5,14 +5,15 @@ import "@relayprotocol/relay-kit-ui/styles.css";
5
5
  import { Account, Wallet } from "thirdweb/wallets";
6
6
  import { CreateConnectorFn } from "wagmi";
7
7
  import { ClientType } from "../../../client-manager";
8
+ import { B3ContextType } from "./types";
8
9
  /**
9
10
  * Main B3Provider component
10
11
  */
11
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, defaultPermissions, }: {
12
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
12
13
  theme: "light" | "dark";
13
14
  children: React.ReactNode;
14
15
  accountOverride?: Account;
15
- environment?: "development" | "production";
16
+ environment: B3ContextType["environment"];
16
17
  automaticallySetFirstEoa?: boolean;
17
18
  simDuneApiKey?: string;
18
19
  toaster?: {
@@ -29,5 +30,20 @@ export declare function B3Provider({ theme, children, accountOverride, environme
29
30
  overrideDefaultConnectors?: boolean;
30
31
  createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
31
32
  enableTurnkey?: boolean;
33
+ }): import("react/jsx-runtime").JSX.Element;
34
+ /**
35
+ * Inner provider component that provides the actual B3Context
36
+ */
37
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
38
+ children: React.ReactNode;
39
+ accountOverride?: Account;
40
+ environment: B3ContextType["environment"];
32
41
  defaultPermissions?: PermissionsConfig;
42
+ automaticallySetFirstEoa: boolean;
43
+ theme: "light" | "dark";
44
+ clientType?: ClientType;
45
+ partnerId: string;
46
+ stripePublishableKey?: string;
47
+ createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
48
+ enableTurnkey?: boolean;
33
49
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RelayKitProviderWrapper, TooltipProvider } from "../../../../global-account/react/index.js";
2
+ import { RelayKitProviderWrapper, TooltipProvider, useAuthentication, useAuthStore, } from "../../../../global-account/react/index.js";
3
+ import { useAutoSelectWallet } from "../../../../global-account/react/hooks/useAutoSelectWallet.js";
3
4
  import { createWagmiConfig } from "../../../../global-account/react/utils/createWagmiConfig.js";
4
5
  import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
5
6
  import "@relayprotocol/relay-kit-ui/styles.css";
6
7
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
7
8
  import { useEffect, useMemo } from "react";
8
- import { ThirdwebProvider } from "thirdweb/react";
9
+ import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
9
10
  import { WagmiProvider } from "wagmi";
10
11
  import { setClientType } from "../../../client-manager.js";
11
- import { useB3ConfigStore } from "../../stores/configStore.js";
12
12
  import { StyleRoot } from "../StyleRoot.js";
13
13
  import { setToastContext, ToastProvider, useToastContext } from "../Toast/index.js";
14
- import AuthenticationProvider from "./AuthenticationProvider.js";
15
14
  import { LocalSDKProvider } from "./LocalSDKProvider.js";
15
+ import { B3Context } from "./types.js";
16
+ /**
17
+ * Default permissions configuration for B3 provider
18
+ */
19
+ const DEFAULT_PERMISSIONS = {
20
+ approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
21
+ nativeTokenLimitPerTransaction: 0.1, // in ETH
22
+ startDate: new Date(),
23
+ endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
24
+ };
16
25
  // Create queryClient instance
17
26
  const queryClient = new QueryClient();
18
27
  /**
@@ -20,35 +29,7 @@ const queryClient = new QueryClient();
20
29
  */
21
30
  export function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
22
31
  // deprecated since v0.0.87
23
- toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
24
- const setConfig = useB3ConfigStore(state => state.setConfig);
25
- // Initialize config store on mount
26
- useEffect(() => {
27
- setConfig({
28
- accountOverride,
29
- environment: environment ?? "development",
30
- automaticallySetFirstEoa: !!automaticallySetFirstEoa,
31
- theme,
32
- clientType,
33
- partnerId,
34
- stripePublishableKey,
35
- createClientReferenceId,
36
- enableTurnkey,
37
- defaultPermissions,
38
- });
39
- }, [
40
- accountOverride,
41
- environment,
42
- automaticallySetFirstEoa,
43
- theme,
44
- clientType,
45
- partnerId,
46
- stripePublishableKey,
47
- createClientReferenceId,
48
- enableTurnkey,
49
- defaultPermissions,
50
- setConfig,
51
- ]); // eslint-disable-line react-hooks/exhaustive-deps
32
+ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
52
33
  // Initialize Google Analytics on mount
53
34
  useEffect(() => {
54
35
  loadGA4Script();
@@ -58,7 +39,50 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
58
39
  setClientType(clientType);
59
40
  }, [clientType]);
60
41
  const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
61
- return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsxs(LocalSDKProvider, { onConnectCallback: onConnect, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] }), _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }));
42
+ return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsxs(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
43
+ }
44
+ /**
45
+ * Inner provider component that provides the actual B3Context
46
+ */
47
+ export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
48
+ const activeAccount = useActiveAccount();
49
+ const isAuthenticated = useAuthStore(state => state.isAuthenticated);
50
+ //const isConnected = useAuthStore(state => state.isConnected);
51
+ //const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
52
+ // Note: This fixes a bug where useAuthentication is no longer rendered on every page, as of this PR https://github.com/b3-fun/b3/pull/385/files#diff-3ef996931b8fc8e49021ba1b42ddaa97535214681610dc5fdacf63542e261af7
53
+ // The above PR removes useAuthentication from the overall B3Provider. useAuthentication should be everywhere the provider is, since it sets the overall auth state
54
+ // By just calling it manually, we fix that issue
55
+ // As a follow up, we should fix the SDK directly
56
+ useAuthentication(partnerId);
57
+ // Use given accountOverride or activeAccount from thirdweb
58
+ // WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
59
+ // skip isAuthenticated check ?
60
+ const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
61
+ // Wrapper to set active wallet via thirdweb
62
+ // Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
63
+ // Auto-select first EOA wallet when enabled
64
+ useAutoSelectWallet({
65
+ enabled: automaticallySetFirstEoa,
66
+ });
67
+ return (_jsx(B3Context.Provider, { value: {
68
+ account: effectiveAccount,
69
+ // setWallet,
70
+ //wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
71
+ //user,
72
+ //setUser,
73
+ //refetchUser,
74
+ initialized: true,
75
+ ready: !!effectiveAccount,
76
+ automaticallySetFirstEoa,
77
+ environment,
78
+ defaultPermissions,
79
+ theme,
80
+ clientType,
81
+ partnerId: partnerId,
82
+ stripePublishableKey,
83
+ createClientReferenceId,
84
+ enableTurnkey,
85
+ }, children: children }));
62
86
  }
63
87
  /**
64
88
  * Component to connect the toast context to the global toast API
@@ -1,27 +1,27 @@
1
1
  import { PermissionsConfig } from "../../../../global-account/types/permissions";
2
2
  import { Account, Wallet } from "thirdweb/wallets";
3
3
  import { ClientType } from "../../../client-manager";
4
+ import { B3ContextType } from "./types";
4
5
  /**
5
6
  * Main B3Provider component
6
7
  */
7
- export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, defaultPermissions, }: {
8
+ export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, }: {
8
9
  theme: "light" | "dark";
9
10
  children: React.ReactNode;
10
11
  accountOverride?: Account;
11
- environment?: "development" | "production";
12
+ environment: B3ContextType["environment"];
12
13
  clientType?: ClientType;
13
14
  partnerId: string;
14
15
  rpcUrls?: Record<number, string>;
15
16
  onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
16
- defaultPermissions?: PermissionsConfig;
17
17
  }): import("react/jsx-runtime").JSX.Element;
18
18
  /**
19
- * Inner provider component for native
19
+ * Inner provider component that provides the actual B3Context
20
20
  */
21
21
  export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
22
22
  children: React.ReactNode;
23
23
  accountOverride?: Account;
24
- environment?: "development" | "production";
24
+ environment: B3ContextType["environment"];
25
25
  defaultPermissions?: PermissionsConfig;
26
26
  theme: "light" | "dark";
27
27
  clientType?: ClientType;
@@ -1,50 +1,50 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
- import { useEffect } from "react";
4
- import { ThirdwebProvider } from "thirdweb/react";
3
+ import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
5
4
  import { WagmiProvider } from "wagmi";
6
- import { useB3ConfigStore } from "../../stores/configStore.js";
7
5
  import { createWagmiConfig } from "../../utils/createWagmiConfig.js";
8
- import AuthenticationProvider from "./AuthenticationProvider.js";
9
6
  import { LocalSDKProvider } from "./LocalSDKProvider.js";
7
+ import { B3Context } from "./types.js";
8
+ /**
9
+ * Default permissions configuration for B3 provider
10
+ */
11
+ const DEFAULT_PERMISSIONS = {
12
+ approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
13
+ nativeTokenLimitPerTransaction: 0.1, // in ETH
14
+ startDate: new Date(),
15
+ endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
16
+ };
10
17
  // Create queryClient instance
11
18
  const queryClient = new QueryClient();
12
19
  /**
13
20
  * Main B3Provider component
14
21
  */
15
- export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, defaultPermissions, }) {
16
- const setConfig = useB3ConfigStore(state => state.setConfig);
17
- // Initialize config store on mount - props are static and never change
18
- useEffect(() => {
19
- setConfig({
20
- accountOverride,
21
- environment: environment ?? "development",
22
- automaticallySetFirstEoa: false,
23
- theme,
24
- clientType,
25
- partnerId,
26
- defaultPermissions,
27
- });
28
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
29
- return (_jsx(ThirdwebProvider, { children: _jsxs(LocalSDKProvider, { onConnectCallback: onConnect, children: [children, _jsx(AuthenticationProvider, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }));
22
+ export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, }) {
23
+ return (_jsx(ThirdwebProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, clientType: clientType, partnerId: partnerId, rpcUrls: rpcUrls, children: children }) }) }));
30
24
  }
31
25
  /**
32
- * Inner provider component for native
26
+ * Inner provider component that provides the actual B3Context
33
27
  */
34
- export function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
35
- const setConfig = useB3ConfigStore(state => state.setConfig);
28
+ export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
29
+ const activeAccount = useActiveAccount();
30
+ //const { user, setUser, refetchUser } = useAuthentication(partnerId);
36
31
  const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
37
- // Initialize config store on mount - props are static and never change
38
- useEffect(() => {
39
- setConfig({
40
- accountOverride,
41
- environment: environment ?? "development",
42
- automaticallySetFirstEoa: false,
43
- theme,
44
- clientType,
45
- partnerId,
46
- defaultPermissions,
47
- });
48
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
49
- return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: children }) }));
32
+ // Use given accountOverride or activeAccount from thirdweb
33
+ const effectiveAccount = accountOverride || activeAccount;
34
+ return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(B3Context.Provider, { value: {
35
+ //account: effectiveAccount,
36
+ automaticallySetFirstEoa: false,
37
+ //setWallet: () => {},
38
+ wallet: undefined,
39
+ //user,
40
+ //setUser,
41
+ initialized: true,
42
+ ready: !!effectiveAccount,
43
+ environment,
44
+ defaultPermissions,
45
+ theme,
46
+ clientType,
47
+ partnerId,
48
+ //refetchUser,
49
+ }, children: children }) }) }));
50
50
  }
@@ -11,8 +11,6 @@ export function RelayKitProviderWrapper({ children, simDuneApiKey, }) {
11
11
  };
12
12
  fetchChains();
13
13
  }, []);
14
- const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
15
- const appName = isTurnkeyPrimary ? "Smart Wallet" : "AnySpend";
16
14
  return (_jsx(RelayKitProvider, { options: {
17
15
  baseApiUrl: MAINNET_RELAY_API,
18
16
  source: "anyspend",
@@ -22,7 +20,7 @@ export function RelayKitProviderWrapper({ children, simDuneApiKey, }) {
22
20
  },
23
21
  chains: relayChains,
24
22
  privateChainIds: undefined,
25
- appName,
23
+ appName: "AnySpend",
26
24
  useGasFeeEstimations: true,
27
25
  }, children: _jsx(_Fragment, { children: children }) }));
28
26
  }
@@ -0,0 +1,27 @@
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>;
@@ -0,0 +1,21 @@
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,16 +1,6 @@
1
1
  /**
2
- * Hook to access the B3 configuration
3
- * @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
2
+ * Hook to access the B3 context
3
+ * @throws Error if used outside a B3Provider
4
+ * @deprecated Use useB3Config or useB3Account instead
4
5
  */
5
- export declare function useB3(): {
6
- automaticallySetFirstEoa: boolean;
7
- environment: "development" | "production";
8
- theme: "light" | "dark";
9
- clientType: import("../../../client-manager").ClientType;
10
- partnerId: string;
11
- createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
12
- enableTurnkey: boolean;
13
- stripePublishableKey: string | undefined;
14
- defaultPermissions: import("../../../types/permissions").PermissionsConfig;
15
- accountOverride: import("thirdweb/wallets").Account | undefined;
16
- };
6
+ export declare function useB3(): import("./types").B3ContextType;
@@ -1,8 +1,15 @@
1
- import { useB3Config } from "./useB3Config.js";
1
+ import { useContext, useMemo } from "react";
2
+ import { B3Context } from "./types.js";
2
3
  /**
3
- * Hook to access the B3 configuration
4
- * @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
4
+ * Hook to access the B3 context
5
+ * @throws Error if used outside a B3Provider
6
+ * @deprecated Use useB3Config or useB3Account instead
5
7
  */
6
8
  export function useB3() {
7
- return useB3Config();
9
+ const context = useContext(B3Context);
10
+ if (!context.initialized) {
11
+ throw new Error("useB3 must be used within a B3Provider");
12
+ }
13
+ // Return a stable reference
14
+ return useMemo(() => context, [context]);
8
15
  }
@@ -1,9 +1,6 @@
1
1
  import { useActiveAccount } from "thirdweb/react";
2
- import { useAuthStore } from "../../stores/useAuthStore.js";
3
2
  // Wrapper around useActiveAccount
4
3
  export const useB3Account = () => {
5
- const isAuthenticated = useAuthStore(state => state.isAuthenticated);
6
- const activeAccount = useActiveAccount();
7
- const effectiveAccount = isAuthenticated ? activeAccount : undefined;
8
- return effectiveAccount;
4
+ const account = useActiveAccount();
5
+ return account;
9
6
  };
@@ -1,17 +1,9 @@
1
- /**
2
- * Hook to access B3 configuration
3
- * Returns all config values from the Zustand store
4
- * Since config is static (set once at initialization), destructuring is fine here
5
- */
6
1
  export declare const useB3Config: () => {
7
2
  automaticallySetFirstEoa: boolean;
8
- environment: "development" | "production";
3
+ environment: "development" | "production" | undefined;
9
4
  theme: "light" | "dark";
10
5
  clientType: import("../../../client-manager").ClientType;
11
6
  partnerId: string;
12
7
  createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
13
- enableTurnkey: boolean;
14
- stripePublishableKey: string | undefined;
15
- defaultPermissions: import("../../../types/permissions").PermissionsConfig;
16
- accountOverride: import("thirdweb/wallets").Account | undefined;
8
+ enableTurnkey: boolean | undefined;
17
9
  };