@b3dotfun/sdk 0.1.70-alpha.2 → 0.1.70-alpha.21

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 (355) hide show
  1. package/README.md +3 -3
  2. package/constants/chains/b3Chain.js +3 -1
  3. package/dist/cjs/anyspend/constants/rpc.d.ts +3 -1
  4. package/dist/cjs/anyspend/constants/rpc.js +6 -2
  5. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +9 -1
  6. package/dist/cjs/anyspend/react/components/AnySpend.js +123 -46
  7. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +8 -10
  8. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +15 -3
  9. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +78 -25
  10. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +32 -13
  11. package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +32 -10
  12. package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +22 -3
  13. package/dist/cjs/anyspend/react/components/QRDeposit.js +25 -16
  14. package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +18 -11
  15. package/dist/cjs/anyspend/react/components/common/PureTransferView.d.ts +30 -0
  16. package/dist/cjs/anyspend/react/components/common/PureTransferView.js +64 -0
  17. package/dist/cjs/anyspend/react/components/common/TokenBalance.js +4 -5
  18. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
  19. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
  20. package/dist/cjs/anyspend/utils/address.d.ts +2 -1
  21. package/dist/cjs/anyspend/utils/address.js +12 -9
  22. package/dist/cjs/anyspend/utils/chain.d.ts +84 -1
  23. package/dist/cjs/anyspend/utils/chain.js +73 -3
  24. package/dist/cjs/anyspend/utils/token.d.ts +2 -0
  25. package/dist/cjs/anyspend/utils/token.js +15 -1
  26. package/dist/cjs/app.shared.d.ts +9 -1
  27. package/dist/cjs/app.shared.js +19 -0
  28. package/dist/cjs/global-account/app.native.d.ts +1 -1
  29. package/dist/cjs/global-account/better-auth-client.d.ts +3314 -36
  30. package/dist/cjs/global-account/better-auth-client.js +28 -3
  31. package/dist/cjs/global-account/bsmnt.d.ts +2 -2
  32. package/dist/cjs/global-account/bsmnt.native.d.ts +1 -1
  33. package/dist/cjs/global-account/client-manager.d.ts +7 -5
  34. package/dist/cjs/global-account/client-manager.js +51 -4
  35. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +6 -11
  36. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +11 -0
  37. package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +12 -0
  38. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +12 -2
  39. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +25 -3
  40. package/dist/cjs/global-account/react/components/B3Provider/BetterAuthProvider.js +45 -4
  41. package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
  42. package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +11 -5
  43. package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +23 -15
  44. package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +2 -2
  45. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +8 -6
  46. package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
  47. package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +17 -8
  48. package/dist/cjs/global-account/react/components/Send/Send.js +15 -11
  49. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +3 -1
  50. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -5
  51. package/dist/cjs/global-account/react/components/SignInWithB3/components/AuthButton.js +2 -1
  52. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +1 -0
  53. package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +3 -2
  54. package/dist/cjs/global-account/react/components/SignInWithB3/utils/signInUtils.js +3 -3
  55. package/dist/cjs/global-account/react/components/index.d.ts +1 -1
  56. package/dist/cjs/global-account/react/components/index.js +3 -3
  57. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -3
  58. package/dist/cjs/global-account/react/hooks/index.js +7 -10
  59. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +5 -4
  60. package/dist/cjs/global-account/react/hooks/useAuth.js +1 -0
  61. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +3 -2
  62. package/dist/cjs/global-account/react/hooks/useAuthentication.js +2 -1
  63. package/dist/cjs/global-account/react/hooks/useBetterAuth.d.ts +1657 -22
  64. package/dist/cjs/global-account/react/hooks/useBetterAuth.js +7 -7
  65. package/dist/cjs/global-account/react/hooks/useClient.d.ts +3 -3
  66. package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
  67. package/dist/cjs/global-account/react/hooks/useFirstEOA.js +1 -0
  68. package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -2
  69. package/dist/cjs/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
  70. package/dist/cjs/global-account/react/hooks/usePortfolioBalance.js +76 -0
  71. package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
  72. package/dist/cjs/global-account/react/hooks/usePortfolioCollectibles.js +178 -0
  73. package/dist/cjs/global-account/react/hooks/useSiwe.d.ts +1 -1
  74. package/dist/cjs/global-account/react/hooks/useSiwe.native.d.ts +1 -1
  75. package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +1 -1
  76. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
  77. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +37 -27
  78. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +14 -2
  79. package/dist/cjs/global-account/types/b3-api.types.d.ts +5 -0
  80. package/dist/cjs/global-account/types/feature-flags.d.ts +5 -5
  81. package/dist/cjs/notifications/services/api.js +1 -0
  82. package/dist/cjs/shared/constants/chains/b3Chain.d.ts +30 -54
  83. package/dist/cjs/shared/constants/chains/b3Chain.js +5 -41
  84. package/dist/cjs/shared/constants/chains/supported.d.ts +1 -49
  85. package/dist/cjs/shared/constants/chains/supported.js +8 -36
  86. package/dist/cjs/shared/constants/index.d.ts +4 -0
  87. package/dist/cjs/shared/utils/chain-transformers.d.ts +4 -4
  88. package/dist/cjs/shared/utils/chain-transformers.js +38 -37
  89. package/dist/cjs/shared/utils/thirdweb-insights.js +2 -2
  90. package/dist/cjs/shared/utils/upload.d.ts +9 -0
  91. package/dist/cjs/shared/utils/upload.js +34 -0
  92. package/dist/cjs/shared/utils/zerionPositions.d.ts +96 -0
  93. package/dist/cjs/shared/utils/zerionPositions.js +188 -0
  94. package/dist/esm/anyspend/constants/rpc.d.ts +3 -1
  95. package/dist/esm/anyspend/constants/rpc.js +5 -1
  96. package/dist/esm/anyspend/react/components/AnySpend.d.ts +9 -1
  97. package/dist/esm/anyspend/react/components/AnySpend.js +124 -47
  98. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +9 -11
  99. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +15 -3
  100. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +80 -27
  101. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +33 -14
  102. package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +33 -11
  103. package/dist/esm/anyspend/react/components/QRDeposit.d.ts +22 -3
  104. package/dist/esm/anyspend/react/components/QRDeposit.js +27 -18
  105. package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +21 -14
  106. package/dist/esm/anyspend/react/components/common/PureTransferView.d.ts +30 -0
  107. package/dist/esm/anyspend/react/components/common/PureTransferView.js +61 -0
  108. package/dist/esm/anyspend/react/components/common/TokenBalance.js +6 -7
  109. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
  110. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
  111. package/dist/esm/anyspend/utils/address.d.ts +2 -1
  112. package/dist/esm/anyspend/utils/address.js +9 -6
  113. package/dist/esm/anyspend/utils/chain.d.ts +84 -1
  114. package/dist/esm/anyspend/utils/chain.js +73 -5
  115. package/dist/esm/anyspend/utils/token.d.ts +2 -0
  116. package/dist/esm/anyspend/utils/token.js +13 -0
  117. package/dist/esm/app.shared.d.ts +9 -1
  118. package/dist/esm/app.shared.js +17 -0
  119. package/dist/esm/global-account/app.native.d.ts +1 -1
  120. package/dist/esm/global-account/better-auth-client.d.ts +3314 -36
  121. package/dist/esm/global-account/better-auth-client.js +27 -4
  122. package/dist/esm/global-account/bsmnt.d.ts +2 -2
  123. package/dist/esm/global-account/bsmnt.native.d.ts +1 -1
  124. package/dist/esm/global-account/client-manager.d.ts +7 -5
  125. package/dist/esm/global-account/client-manager.js +51 -5
  126. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +6 -11
  127. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +11 -0
  128. package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +11 -0
  129. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +12 -2
  130. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +26 -4
  131. package/dist/esm/global-account/react/components/B3Provider/BetterAuthProvider.js +46 -5
  132. package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
  133. package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +11 -5
  134. package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +24 -16
  135. package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +3 -3
  136. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +9 -7
  137. package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +1 -1
  138. package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +18 -9
  139. package/dist/esm/global-account/react/components/Send/Send.js +16 -12
  140. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +3 -1
  141. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +1 -5
  142. package/dist/esm/global-account/react/components/SignInWithB3/components/AuthButton.js +2 -1
  143. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +1 -0
  144. package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +3 -2
  145. package/dist/esm/global-account/react/components/SignInWithB3/utils/signInUtils.js +3 -3
  146. package/dist/esm/global-account/react/components/index.d.ts +1 -1
  147. package/dist/esm/global-account/react/components/index.js +1 -1
  148. package/dist/esm/global-account/react/hooks/index.d.ts +2 -3
  149. package/dist/esm/global-account/react/hooks/index.js +2 -3
  150. package/dist/esm/global-account/react/hooks/useAuth.d.ts +5 -4
  151. package/dist/esm/global-account/react/hooks/useAuth.js +1 -0
  152. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +3 -2
  153. package/dist/esm/global-account/react/hooks/useAuthentication.js +2 -1
  154. package/dist/esm/global-account/react/hooks/useBetterAuth.d.ts +1657 -22
  155. package/dist/esm/global-account/react/hooks/useBetterAuth.js +8 -8
  156. package/dist/esm/global-account/react/hooks/useClient.d.ts +3 -3
  157. package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
  158. package/dist/esm/global-account/react/hooks/useFirstEOA.js +1 -0
  159. package/dist/esm/global-account/react/hooks/useNativeBalance.js +1 -1
  160. package/dist/esm/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
  161. package/dist/esm/global-account/react/hooks/usePortfolioBalance.js +72 -0
  162. package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
  163. package/dist/esm/global-account/react/hooks/usePortfolioCollectibles.js +175 -0
  164. package/dist/esm/global-account/react/hooks/useSiwe.d.ts +1 -1
  165. package/dist/esm/global-account/react/hooks/useSiwe.native.d.ts +1 -1
  166. package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +1 -1
  167. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
  168. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +37 -27
  169. package/dist/esm/global-account/react/stores/useModalStore.d.ts +14 -2
  170. package/dist/esm/global-account/types/b3-api.types.d.ts +5 -0
  171. package/dist/esm/global-account/types/feature-flags.d.ts +5 -5
  172. package/dist/esm/notifications/services/api.js +1 -0
  173. package/dist/esm/shared/constants/chains/b3Chain.d.ts +30 -54
  174. package/dist/esm/shared/constants/chains/b3Chain.js +4 -38
  175. package/dist/esm/shared/constants/chains/supported.d.ts +1 -49
  176. package/dist/esm/shared/constants/chains/supported.js +7 -35
  177. package/dist/esm/shared/constants/index.d.ts +4 -0
  178. package/dist/esm/shared/utils/chain-transformers.d.ts +4 -4
  179. package/dist/esm/shared/utils/chain-transformers.js +38 -37
  180. package/dist/esm/shared/utils/thirdweb-insights.js +2 -2
  181. package/dist/esm/shared/utils/upload.d.ts +9 -0
  182. package/dist/esm/shared/utils/upload.js +31 -0
  183. package/dist/esm/shared/utils/zerionPositions.d.ts +96 -0
  184. package/dist/esm/shared/utils/zerionPositions.js +180 -0
  185. package/dist/styles/index.css +1 -1
  186. package/dist/types/anyspend/constants/rpc.d.ts +3 -1
  187. package/dist/types/anyspend/react/components/AnySpend.d.ts +9 -1
  188. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +15 -3
  189. package/dist/types/anyspend/react/components/QRDeposit.d.ts +22 -3
  190. package/dist/types/anyspend/react/components/common/PureTransferView.d.ts +30 -0
  191. package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +3 -3
  192. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
  193. package/dist/types/anyspend/utils/address.d.ts +2 -1
  194. package/dist/types/anyspend/utils/chain.d.ts +84 -1
  195. package/dist/types/anyspend/utils/token.d.ts +2 -0
  196. package/dist/types/app.shared.d.ts +9 -1
  197. package/dist/types/global-account/app.native.d.ts +1 -1
  198. package/dist/types/global-account/better-auth-client.d.ts +3314 -36
  199. package/dist/types/global-account/bsmnt.d.ts +2 -2
  200. package/dist/types/global-account/bsmnt.native.d.ts +1 -1
  201. package/dist/types/global-account/client-manager.d.ts +7 -5
  202. package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +11 -0
  203. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +12 -2
  204. package/dist/types/global-account/react/components/B3Provider/RelayKitProviderWrapper.d.ts +1 -2
  205. package/dist/types/global-account/react/components/SignInWithB3/utils/signInUtils.d.ts +3 -2
  206. package/dist/types/global-account/react/components/index.d.ts +1 -1
  207. package/dist/types/global-account/react/hooks/index.d.ts +2 -3
  208. package/dist/types/global-account/react/hooks/useAuth.d.ts +5 -4
  209. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +3 -2
  210. package/dist/types/global-account/react/hooks/useBetterAuth.d.ts +1657 -22
  211. package/dist/types/global-account/react/hooks/useClient.d.ts +3 -3
  212. package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -7666
  213. package/dist/types/global-account/react/hooks/usePortfolioBalance.d.ts +15 -0
  214. package/dist/types/global-account/react/hooks/usePortfolioCollectibles.d.ts +12 -0
  215. package/dist/types/global-account/react/hooks/useSiwe.d.ts +1 -1
  216. package/dist/types/global-account/react/hooks/useSiwe.native.d.ts +1 -1
  217. package/dist/types/global-account/react/hooks/useTWAuth.d.ts +1 -1
  218. package/dist/types/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +1 -0
  219. package/dist/types/global-account/react/stores/useModalStore.d.ts +14 -2
  220. package/dist/types/global-account/types/b3-api.types.d.ts +5 -0
  221. package/dist/types/global-account/types/feature-flags.d.ts +5 -5
  222. package/dist/types/shared/constants/chains/b3Chain.d.ts +30 -54
  223. package/dist/types/shared/constants/chains/supported.d.ts +1 -49
  224. package/dist/types/shared/constants/index.d.ts +4 -0
  225. package/dist/types/shared/utils/chain-transformers.d.ts +4 -4
  226. package/dist/types/shared/utils/upload.d.ts +9 -0
  227. package/dist/types/shared/utils/zerionPositions.d.ts +96 -0
  228. package/node_modules/@b3/chain-registry/chains.json +1225 -0
  229. package/node_modules/@b3/chain-registry/dist/chains.json +1225 -0
  230. package/node_modules/@b3/chain-registry/dist/index.cjs +1676 -0
  231. package/node_modules/@b3/chain-registry/dist/index.d.cts +195 -0
  232. package/node_modules/@b3/chain-registry/dist/index.d.ts +195 -0
  233. package/node_modules/@b3/chain-registry/dist/index.mjs +1604 -0
  234. package/node_modules/@b3/chain-registry/dist/src/index.d.ts +193 -0
  235. package/node_modules/@b3/chain-registry/dist/src/index.js +408 -0
  236. package/node_modules/@b3/chain-registry/package.json +66 -0
  237. package/node_modules/@b3/chain-registry/src/index.test.ts +432 -0
  238. package/node_modules/@b3/chain-registry/src/index.ts +672 -0
  239. package/package.json +81 -30
  240. package/src/anyspend/README.md +2 -2
  241. package/src/anyspend/constants/rpc.ts +5 -2
  242. package/src/anyspend/docs/components.md +6 -6
  243. package/src/anyspend/docs/contributing.md +1 -1
  244. package/src/anyspend/docs/hooks.md +3 -3
  245. package/src/anyspend/docs/installation.md +2 -2
  246. package/src/anyspend/react/components/AnySpend.tsx +163 -47
  247. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +10 -11
  248. package/src/anyspend/react/components/AnySpendDeposit.tsx +130 -31
  249. package/src/anyspend/react/components/AnySpendStakeB3.tsx +55 -14
  250. package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +55 -11
  251. package/src/anyspend/react/components/QRDeposit.tsx +101 -22
  252. package/src/anyspend/react/components/__tests__/QRDeposit.test.tsx +331 -0
  253. package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +38 -16
  254. package/src/anyspend/react/components/common/PureTransferView.tsx +212 -0
  255. package/src/anyspend/react/components/common/TokenBalance.tsx +10 -7
  256. package/src/anyspend/react/hooks/useAnyspendQuote.ts +13 -13
  257. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +4 -4
  258. package/src/anyspend/services/gas.test.ts +95 -18
  259. package/src/anyspend/types/api_req_res.ts +10 -5
  260. package/src/anyspend/utils/__tests__/address.test.ts +39 -0
  261. package/src/anyspend/utils/__tests__/deprecatedChains.test.ts +44 -0
  262. package/src/anyspend/utils/__tests__/toRegistryChainId.test.ts +17 -0
  263. package/src/anyspend/utils/address.ts +8 -6
  264. package/src/anyspend/utils/chain.ts +79 -3
  265. package/src/anyspend/utils/token.ts +14 -0
  266. package/src/app.shared.ts +21 -1
  267. package/src/global-account/app.native.ts +5 -1
  268. package/src/global-account/better-auth-client.ts +30 -4
  269. package/src/global-account/bsmnt.native.ts +5 -1
  270. package/src/global-account/bsmnt.ts +9 -2
  271. package/src/global-account/client-manager.ts +74 -9
  272. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +6 -11
  273. package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +12 -0
  274. package/src/global-account/react/components/B3Provider/B3Provider.tsx +40 -4
  275. package/src/global-account/react/components/B3Provider/BetterAuthProvider.tsx +51 -5
  276. package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +11 -11
  277. package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +50 -21
  278. package/src/global-account/react/components/ManageAccount/NFTContent.tsx +5 -3
  279. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -6
  280. package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +1 -1
  281. package/src/global-account/react/components/ManageAccount/TokenContent.tsx +22 -9
  282. package/src/global-account/react/components/Send/Send.tsx +39 -15
  283. package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +12 -1
  284. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +1 -4
  285. package/src/global-account/react/components/SignInWithB3/components/AuthButton.tsx +9 -1
  286. package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +1 -0
  287. package/src/global-account/react/components/SignInWithB3/utils/signInUtils.ts +4 -4
  288. package/src/global-account/react/components/index.ts +1 -1
  289. package/src/global-account/react/components/ui/button.tsx +1 -2
  290. package/src/global-account/react/hooks/__tests__/useUnifiedChainSwitchAndExecute.test.tsx +156 -0
  291. package/src/global-account/react/hooks/index.ts +2 -3
  292. package/src/global-account/react/hooks/useAuth.ts +5 -4
  293. package/src/global-account/react/hooks/useAuthentication.ts +5 -4
  294. package/src/global-account/react/hooks/useBetterAuth.ts +10 -10
  295. package/src/global-account/react/hooks/useClient.ts +11 -2
  296. package/src/global-account/react/hooks/useFirstEOA.tsx +9 -2
  297. package/src/global-account/react/hooks/useNativeBalance.tsx +1 -1
  298. package/src/global-account/react/hooks/usePortfolioBalance.ts +89 -0
  299. package/src/global-account/react/hooks/usePortfolioCollectibles.ts +212 -0
  300. package/src/global-account/react/hooks/useSiwe.native.tsx +1 -1
  301. package/src/global-account/react/hooks/useSiwe.tsx +1 -1
  302. package/src/global-account/react/hooks/useTWAuth.tsx +1 -1
  303. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +47 -31
  304. package/src/global-account/react/stores/useModalStore.ts +14 -2
  305. package/src/global-account/types/b3-api.types.ts +5 -1
  306. package/src/notifications/services/api.ts +1 -0
  307. package/src/shared/constants/chains/b3Chain.ts +4 -43
  308. package/src/shared/constants/chains/supported.ts +9 -48
  309. package/src/shared/constants/index.ts +8 -0
  310. package/src/shared/react/hooks/__tests__/useCurrencyConversion.test.ts +54 -43
  311. package/src/shared/utils/__tests__/zerionPositions.test.ts +248 -0
  312. package/src/shared/utils/chain-transformers.ts +41 -39
  313. package/src/shared/utils/thirdweb-insights.ts +2 -2
  314. package/src/shared/utils/upload.ts +48 -0
  315. package/src/shared/utils/zerionPositions.ts +247 -0
  316. package/src/styles/index.css +27 -0
  317. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +0 -10
  318. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +0 -46
  319. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +0 -11
  320. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +0 -70
  321. package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +0 -59
  322. package/dist/cjs/global-account/react/hooks/useSimBalance.js +0 -98
  323. package/dist/cjs/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
  324. package/dist/cjs/global-account/react/hooks/useSimCollectibles.js +0 -190
  325. package/dist/cjs/global-account/react/utils/simdune.d.ts +0 -7
  326. package/dist/cjs/global-account/react/utils/simdune.js +0 -21
  327. package/dist/cjs/global-account/types/chain-networks.d.ts +0 -44
  328. package/dist/cjs/global-account/types/chain-networks.js +0 -48
  329. package/dist/cjs/shared/generated/chain-networks.json +0 -684
  330. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +0 -10
  331. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +0 -43
  332. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +0 -11
  333. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +0 -67
  334. package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +0 -59
  335. package/dist/esm/global-account/react/hooks/useSimBalance.js +0 -93
  336. package/dist/esm/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
  337. package/dist/esm/global-account/react/hooks/useSimCollectibles.js +0 -187
  338. package/dist/esm/global-account/react/utils/simdune.d.ts +0 -7
  339. package/dist/esm/global-account/react/utils/simdune.js +0 -17
  340. package/dist/esm/global-account/types/chain-networks.d.ts +0 -44
  341. package/dist/esm/global-account/types/chain-networks.js +0 -45
  342. package/dist/esm/shared/generated/chain-networks.json +0 -684
  343. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +0 -10
  344. package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +0 -11
  345. package/dist/types/global-account/react/hooks/useSimBalance.d.ts +0 -59
  346. package/dist/types/global-account/react/hooks/useSimCollectibles.d.ts +0 -45
  347. package/dist/types/global-account/react/utils/simdune.d.ts +0 -7
  348. package/dist/types/global-account/types/chain-networks.d.ts +0 -44
  349. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +0 -63
  350. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +0 -79
  351. package/src/global-account/react/hooks/useSimBalance.ts +0 -164
  352. package/src/global-account/react/hooks/useSimCollectibles.ts +0 -238
  353. package/src/global-account/react/utils/simdune.ts +0 -20
  354. package/src/global-account/types/chain-networks.ts +0 -54
  355. package/src/shared/generated/chain-networks.json +0 -684
@@ -1,4 +1,5 @@
1
1
  import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend/constants";
2
+ import { SOLANA_CHAIN_ID } from "@b3dotfun/sdk/shared/utils/zerionPositions";
2
3
  import {
3
4
  ABSTRACT_PUBLIC_RPC,
4
5
  ARBITRUM_PUBLIC_RPC,
@@ -8,7 +9,9 @@ import {
8
9
  ETHEREUM_PUBLIC_RPC,
9
10
  HYPEREVM_PUBLIC_RPC,
10
11
  OPTIMISM_PUBLIC_RPC,
12
+ PLUME_PUBLIC_RPC,
11
13
  POLYGON_PUBLIC_RPC,
14
+ ROBINHOOD_PUBLIC_RPC,
12
15
  } from "@b3dotfun/sdk/anyspend/constants/rpc";
13
16
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
14
17
  import { b3Viem } from "@b3dotfun/sdk/shared/constants/chains/b3Viem";
@@ -25,7 +28,7 @@ import {
25
28
  Transport,
26
29
  WalletClient,
27
30
  } from "viem";
28
- import { abstract, arbitrum, avalanche, base, bsc, mainnet, optimism, polygon } from "viem/chains";
31
+ import { abstract, arbitrum, avalanche, base, bsc, mainnet, optimism, polygon, robinhood } from "viem/chains";
29
32
  import { ChainType, IBaseChain, IEVMChain, IHyperliquidChain, ISolanaChain } from "../types/chain";
30
33
  import {
31
34
  getAvaxToken,
@@ -33,10 +36,12 @@ import {
33
36
  getEthToken,
34
37
  getHyperEVMNativeToken,
35
38
  getHyperliquidUSDCToken,
39
+ getPlumeNativeToken,
36
40
  getPolToken,
37
41
  getSolanaToken,
38
42
  HYPEREVM_CHAIN_ID,
39
43
  HYPERLIQUID_CHAIN_ID,
44
+ PLUME_CHAIN_ID,
40
45
  } from "./token";
41
46
 
42
47
  function getCustomEvmChain(chain: Chain, rpcUrl: string): Chain {
@@ -84,11 +89,19 @@ export function clearChainRpcOverrides(): void {
84
89
  export const hyperEVM = defineChain({
85
90
  id: HYPEREVM_CHAIN_ID,
86
91
  name: "HyperEVM",
87
- nativeCurrency: { name: "HyperEVM", symbol: "HYPE", decimals: 18 },
92
+ nativeCurrency: { name: "Hyperliquid", symbol: "HYPE", decimals: 18 },
88
93
  rpcUrls: { default: { http: [HYPEREVM_PUBLIC_RPC] } },
89
94
  blockExplorers: { default: { name: "HyperEVM Explorer", url: "https://hyperevmscan.io/" } },
90
95
  });
91
96
 
97
+ export const plume = defineChain({
98
+ id: PLUME_CHAIN_ID,
99
+ name: "Plume",
100
+ nativeCurrency: { name: "Plume", symbol: "PLUME", decimals: 18 },
101
+ rpcUrls: { default: { http: [PLUME_PUBLIC_RPC] } },
102
+ blockExplorers: { default: { name: "Plume Explorer", url: "https://explorer.plume.org" } },
103
+ });
104
+
92
105
  // export const b4testnet = defineChain({
93
106
  // id: 19934,
94
107
  // name: "B4 Testnet",
@@ -247,6 +260,34 @@ export const EVM_MAINNET: Record<number, IEVMChain> = {
247
260
  coingeckoName: "hyperevm",
248
261
  wethAddress: "0x5555555555555555555555555555555555555555",
249
262
  },
263
+ [plume.id]: {
264
+ id: plume.id,
265
+ name: plume.name,
266
+ logoUrl: "https://cdn.b3.fun/b3os-icons/plume.svg",
267
+ type: ChainType.EVM,
268
+ nativeRequired: parseEther("5"), // 5 PLUME ≈ $0.06 — gas reserve; Plume gasPrice ~1000 gwei × 2.2M gas (approve+deposit) needs ~2.2 PLUME, +headroom for spikes
269
+ canDepositNative: true,
270
+ defaultToken: getPlumeNativeToken(),
271
+ nativeToken: getPlumeNativeToken(),
272
+ viem: plume,
273
+ pollingInterval: 1000, // 1 second for Plume (L2 fast blocks)
274
+ coingeckoName: "plume-network",
275
+ wethAddress: "0xea237441c92cae6fc17caaf9a7acb3f953be4bd1", // WPLUME (wrapped native)
276
+ },
277
+ [robinhood.id]: {
278
+ id: robinhood.id,
279
+ name: robinhood.name,
280
+ logoUrl: "https://assets.relay.link/icons/square/4663/light.png",
281
+ type: ChainType.EVM,
282
+ nativeRequired: parseEther("0.0001"),
283
+ canDepositNative: true,
284
+ defaultToken: getEthToken(robinhood.id),
285
+ nativeToken: getEthToken(robinhood.id),
286
+ viem: getCustomEvmChain(robinhood, ROBINHOOD_PUBLIC_RPC),
287
+ pollingInterval: 1000, // 1 second for Robinhood Chain (Arbitrum Orbit fast blocks)
288
+ coingeckoName: "robinhood",
289
+ wethAddress: "0x0bd7d308f8e1639fab988df18a8011f41eacad73", // wrapped native ETH (registry wrappedNative)
290
+ },
250
291
  };
251
292
 
252
293
  export const EVM_TESTNET: Record<number, IEVMChain> = {
@@ -331,6 +372,17 @@ export const EVM_CHAINS: Record<number, IEVMChain> = { ...EVM_MAINNET, ...EVM_TE
331
372
 
332
373
  export const SOLANA_CHAINS: Record<number, ISolanaChain> = { [RELAY_SOLANA_MAINNET_CHAIN_ID]: SOLANA_MAINNET };
333
374
 
375
+ /**
376
+ * Translate a Relay-numbered chain id into the id the chain registry uses.
377
+ *
378
+ * Relay numbers Solana 792703809; every other chain shares the universal EVM id. Balance rows are
379
+ * keyed by the registry's id, so handing Relay's number to a balance lookup matches nothing at all
380
+ * — and a funded Solana wallet then reads as empty rather than as unreadable.
381
+ */
382
+ export function toRegistryChainId(chainId: number): number {
383
+ return chainId === RELAY_SOLANA_MAINNET_CHAIN_ID ? SOLANA_CHAIN_ID : chainId;
384
+ }
385
+
334
386
  export const HYPERLIQUID_CHAINS: Record<number, IHyperliquidChain> = {
335
387
  [HYPERLIQUID_CHAIN_ID]: HYPERLIQUID_MAINNET,
336
388
  };
@@ -655,6 +707,26 @@ export function getHyperliquidChain(chainId: number): IHyperliquidChain {
655
707
  return HYPERLIQUID_CHAINS[chainId];
656
708
  }
657
709
 
710
+ /**
711
+ * Chains AnySpend no longer accepts orders on, as either source or destination.
712
+ *
713
+ * They stay in ALL_CHAINS on purpose. That map answers "what is this chain" — name, logo, token,
714
+ * decimals — which every order that ever existed still needs in order to render; removing an entry
715
+ * would make getChainName and friends throw on historical rows. Whether new orders are accepted is
716
+ * this separate question.
717
+ *
718
+ * anyspend-service imports this list rather than keeping its own, so the API and the chain picker
719
+ * can never disagree about what is on offer.
720
+ */
721
+ export const DEPRECATED_CHAIN_IDS: readonly number[] = [
722
+ 8333, // B3
723
+ 98866, // Plume
724
+ ];
725
+
726
+ export function isDeprecatedChain(chainId?: number): boolean {
727
+ return chainId !== undefined && DEPRECATED_CHAIN_IDS.includes(chainId);
728
+ }
729
+
658
730
  /**
659
731
  * Get available chain IDs for AnySpend based on context (source or destination).
660
732
  * Filters out chains that shouldn't be available for the given context.
@@ -670,7 +742,11 @@ export function getHyperliquidChain(chainId: number): IHyperliquidChain {
670
742
  * const destChains = getAvailableChainIds("to") // [1, 8453, 137, ..., 1337]
671
743
  */
672
744
  export function getAvailableChainIds(context: "from" | "to"): number[] {
673
- const allChainIds = Object.values(ALL_CHAINS).map(chain => chain.id);
745
+ // Deprecated chains are excluded from both directions: the API rejects them, so offering them in
746
+ // a picker would let a user select something that then fails at order creation.
747
+ const allChainIds = Object.values(ALL_CHAINS)
748
+ .map(chain => chain.id)
749
+ .filter(chainId => !isDeprecatedChain(chainId));
674
750
 
675
751
  if (context === "from") {
676
752
  // Hyperliquid is only supported as destination chain, not source chain
@@ -4,6 +4,7 @@ import { avalanche, bsc, polygon } from "viem/chains";
4
4
 
5
5
  export const HYPERLIQUID_CHAIN_ID = 1337;
6
6
  export const HYPEREVM_CHAIN_ID = 999;
7
+ export const PLUME_CHAIN_ID = 98866;
7
8
 
8
9
  /**
9
10
  * Hyperliquid uses a special 34-character USDC address format (0x + 32 hex digits)
@@ -106,3 +107,16 @@ export function getHyperliquidUSDCToken(): components["schemas"]["Token"] {
106
107
  },
107
108
  };
108
109
  }
110
+
111
+ export function getPlumeNativeToken(): components["schemas"]["Token"] {
112
+ return {
113
+ chainId: PLUME_CHAIN_ID,
114
+ address: ZERO_ADDRESS,
115
+ symbol: "PLUME",
116
+ name: "Plume",
117
+ decimals: 18,
118
+ metadata: {
119
+ logoURI: "https://cdn.b3.fun/b3os-icons/plume.svg",
120
+ },
121
+ };
122
+ }
package/src/app.shared.ts CHANGED
@@ -4,15 +4,35 @@ import Cookies from "js-cookie";
4
4
  import { B3_AUTH_COOKIE_NAME } from "./shared/constants";
5
5
  import { getSessionDurationDays } from "./shared/utils/session-duration";
6
6
 
7
+ /** Default API URL derived from environment variables. */
7
8
  export const B3_API_URL =
8
9
  process.env.EXPO_PUBLIC_B3_API || process.env.NEXT_PUBLIC_B3_API || process.env.PUBLIC_B3_API || "https://api.b3.fun";
9
10
 
11
+ /**
12
+ * Runtime-overridable API URL. Set by `B3Provider` when an `apiUrl` prop
13
+ * is provided. Falls back to the env-var-derived `B3_API_URL`.
14
+ */
15
+ let _apiUrlOverride: string | null = null;
16
+
17
+ /**
18
+ * Override the B3 API URL at runtime. Called by `B3Provider` when an
19
+ * `apiUrl` prop is provided. Pass `null` to revert to the default.
20
+ */
21
+ export function setB3ApiUrl(url: string | null): void {
22
+ _apiUrlOverride = url;
23
+ }
24
+
25
+ /** Get the current B3 API URL (prefers runtime override, then env var). */
26
+ export function getB3ApiUrl(): string {
27
+ return _apiUrlOverride || B3_API_URL;
28
+ }
29
+
10
30
  export const authenticate = async (
11
31
  app: ClientApplication,
12
32
  accessToken: string,
13
33
  identityToken: string,
14
34
  params?: Record<string, any>,
15
- ) => {
35
+ ): Promise<Record<string, any> | null> => {
16
36
  const fullToken = `${accessToken}+${identityToken}`;
17
37
 
18
38
  // Do not authenticate if there is no token
@@ -77,7 +77,11 @@ const app = createClient(socketio(socket), {
77
77
  storageKey: B3_AUTH_COOKIE_NAME,
78
78
  });
79
79
 
80
- export const authenticate = async (accessToken: string, identityToken: string, params?: Record<string, any>) => {
80
+ export const authenticate = async (
81
+ accessToken: string,
82
+ identityToken: string,
83
+ params?: Record<string, any>,
84
+ ): Promise<Record<string, any> | null> => {
81
85
  const fullToken = `${accessToken}+${identityToken}`;
82
86
 
83
87
  // Do not authenticate if there is no token
@@ -1,17 +1,43 @@
1
1
  import { createAuthClient } from "better-auth/client";
2
- import { B3_API_URL } from "../app.shared";
2
+ import { twoFactorClient } from "better-auth/client/plugins";
3
+ import { getB3ApiUrl } from "../app.shared";
3
4
 
4
5
  export type B3BetterAuthClient = ReturnType<typeof createB3BetterAuthClient>;
5
6
 
6
- export function createB3BetterAuthClient(baseURL: string = B3_API_URL) {
7
+ export function createB3BetterAuthClient(baseURL?: string) {
7
8
  return createAuthClient({
8
- baseURL,
9
+ baseURL: baseURL ?? getB3ApiUrl(),
9
10
  basePath: "/auth",
10
11
  fetchOptions: {
11
12
  credentials: "include",
12
13
  },
14
+ plugins: [twoFactorClient()],
13
15
  });
14
16
  }
15
17
 
16
- // Default singleton for standard usage
18
+ // Lazily-initialized singleton. Recreated when the API URL changes via
19
+ // `resetBetterAuthClient()` (called by B3Provider when `apiUrl` changes).
20
+ let _client: B3BetterAuthClient | null = null;
21
+ let _clientUrl: string | null = null;
22
+
23
+ /** Get the shared BetterAuth client, creating it if needed. */
24
+ export function getBetterAuthClient(): B3BetterAuthClient {
25
+ const url = getB3ApiUrl();
26
+ if (!_client || _clientUrl !== url) {
27
+ _client = createB3BetterAuthClient(url);
28
+ _clientUrl = url;
29
+ }
30
+ return _client;
31
+ }
32
+
33
+ /** Force-recreate the client on next access (e.g. after API URL change). */
34
+ export function resetBetterAuthClient(): void {
35
+ _client = null;
36
+ _clientUrl = null;
37
+ }
38
+
39
+ /**
40
+ * @deprecated Use `getBetterAuthClient()` instead. This static singleton
41
+ * does not reflect runtime API URL changes via `B3Provider apiUrl` prop.
42
+ */
17
43
  export const betterAuthClient = createB3BetterAuthClient();
@@ -80,7 +80,11 @@ const app = createClient(socketio(socket), {
80
80
  storageKey: BSMNT_AUTH_COOKIE_NAME,
81
81
  });
82
82
 
83
- export const authenticate = async (accessToken: string, identityToken: string, params?: Record<string, any>) => {
83
+ export const authenticate = async (
84
+ accessToken: string,
85
+ identityToken: string,
86
+ params?: Record<string, any>,
87
+ ): Promise<Record<string, any> | null> => {
84
88
  const fullToken = `${accessToken}+${identityToken}`;
85
89
 
86
90
  // Do not authenticate if there is no token
@@ -42,7 +42,11 @@ const app = createClient(socketio(socket), {
42
42
  storageKey: BSMNT_AUTH_COOKIE_NAME,
43
43
  });
44
44
 
45
- export const authenticate = async (accessToken: string, identityToken: string, params?: Record<string, any>) => {
45
+ export const authenticate = async (
46
+ accessToken: string,
47
+ identityToken: string,
48
+ params?: Record<string, any>,
49
+ ): Promise<Record<string, any> | null> => {
46
50
  const fullToken = `${accessToken}+${identityToken}`;
47
51
 
48
52
  // Do not authenticate if there is no token
@@ -73,7 +77,10 @@ export const resetSocket = () => {
73
77
  // reset the socket connection
74
78
  };
75
79
 
76
- export const authenticateWithB3JWT = async (fullToken: string, params?: Record<string, any>) => {
80
+ export const authenticateWithB3JWT = async (
81
+ fullToken: string,
82
+ params?: Record<string, any>,
83
+ ): Promise<Record<string, any> | null> => {
77
84
  // Do not authenticate if there is no token
78
85
  if (!fullToken) {
79
86
  console.log("No token found, not authenticating");
@@ -2,7 +2,7 @@ import { ClientApplication, createClient } from "@b3dotfun/b3-api";
2
2
  import rest from "@feathersjs/rest-client";
3
3
  import socketio from "@feathersjs/socketio-client";
4
4
  import io from "socket.io-client";
5
- import { authenticate as authenticateB3, B3_API_URL, clientOptions } from "../app.shared";
5
+ import { authenticate as authenticateB3, getB3ApiUrl, clientOptions } from "../app.shared";
6
6
 
7
7
  export type ClientType = "socket" | "rest";
8
8
 
@@ -13,17 +13,53 @@ let currentClient: ClientApplication | null = null;
13
13
  // Socket client instance
14
14
  let socketClient: ClientApplication | null = null;
15
15
  let socketInstance: any = null;
16
+ let socketClientUrl: string | null = null;
16
17
 
17
18
  // REST client instance
18
19
  let restClient: ClientApplication | null = null;
20
+ let restClientUrl: string | null = null;
21
+
22
+ // The pinned @b3dotfun/b3-api client's generated usersMethods predates `setBio`,
23
+ // so `users.setBio(...)` throws "setBio is not a function". Re-register the users
24
+ // service with the full list (mirrors users.shared.ts). Remove once the
25
+ // @b3dotfun/b3-api pin includes setBio.
26
+ const USERS_METHODS = [
27
+ "find",
28
+ "get",
29
+ "create",
30
+ "patch",
31
+ "remove",
32
+ "setReferralCode",
33
+ "syncTwProfiles",
34
+ "setAvatar",
35
+ "setBio",
36
+ "registerUsername",
37
+ "getMe",
38
+ ];
39
+
40
+ // Re-register on every client the manager builds — the active transport
41
+ // (REST/socket) switches at runtime.
42
+ function ensureUsersCustomMethods(client: ClientApplication): void {
43
+ try {
44
+ const connection = (client as any).get("connection");
45
+ if (connection?.service) {
46
+ (client as any).use("users", connection.service("users"), { methods: USERS_METHODS });
47
+ }
48
+ } catch {
49
+ // Non-fatal: keep whatever methods the generated client already exposes.
50
+ }
51
+ }
19
52
 
20
53
  /**
21
54
  * Creates a socket client
22
55
  */
23
56
  function createSocketClient(): ClientApplication {
24
- if (!socketClient) {
25
- socketInstance = io(B3_API_URL, { transports: ["websocket"] });
57
+ const url = getB3ApiUrl();
58
+ if (!socketClient || socketClientUrl !== url) {
59
+ socketInstance = io(url, { transports: ["websocket"] });
26
60
  socketClient = createClient(socketio(socketInstance), clientOptions);
61
+ ensureUsersCustomMethods(socketClient);
62
+ socketClientUrl = url;
27
63
  }
28
64
  return socketClient;
29
65
  }
@@ -40,13 +76,25 @@ function resolveFetch(): typeof fetch {
40
76
  }
41
77
 
42
78
  function createRestClient(): ClientApplication {
43
- if (!restClient) {
44
- const connection = rest(B3_API_URL).fetch(resolveFetch());
79
+ const url = getB3ApiUrl();
80
+ if (!restClient || restClientUrl !== url) {
81
+ const connection = rest(url).fetch(resolveFetch());
45
82
  restClient = createClient(connection, clientOptions);
83
+ ensureUsersCustomMethods(restClient);
84
+ restClientUrl = url;
46
85
  }
47
86
  return restClient;
48
87
  }
49
88
 
89
+ /** Reset all cached clients (called when API URL changes). */
90
+ export function resetClients(): void {
91
+ socketClient = null;
92
+ socketClientUrl = null;
93
+ restClient = null;
94
+ restClientUrl = null;
95
+ currentClient = null;
96
+ }
97
+
50
98
  /**
51
99
  * Sets the active client type and creates the appropriate client
52
100
  *
@@ -99,7 +147,11 @@ export function resetSocket(): void {
99
147
  /**
100
148
  * Authenticates with the current active client
101
149
  */
102
- export const authenticate = async (accessToken: string, identityToken: string, params?: Record<string, any>) => {
150
+ export const authenticate = async (
151
+ accessToken: string,
152
+ identityToken: string,
153
+ params?: Record<string, any>,
154
+ ): Promise<Record<string, any> | null> => {
103
155
  return authenticateB3(getClient(), accessToken, identityToken, params);
104
156
  };
105
157
 
@@ -111,7 +163,7 @@ export const authenticateWithClient = async (
111
163
  accessToken: string,
112
164
  identityToken: string,
113
165
  params?: Record<string, any>,
114
- ) => {
166
+ ): Promise<Record<string, any> | null> => {
115
167
  const client = getClientByType(clientType);
116
168
  return authenticateB3(client, accessToken, identityToken, params);
117
169
  };
@@ -119,7 +171,15 @@ export const authenticateWithClient = async (
119
171
  /**
120
172
  * Authenticates with both clients in parallel (useful for migration scenarios)
121
173
  */
122
- export const authenticateBoth = async (accessToken: string, identityToken: string, params?: Record<string, any>) => {
174
+ export const authenticateBoth = async (
175
+ accessToken: string,
176
+ identityToken: string,
177
+ params?: Record<string, any>,
178
+ ): Promise<{
179
+ socket: Record<string, any> | null;
180
+ rest: Record<string, any> | null;
181
+ success: boolean;
182
+ }> => {
123
183
  const [socketResult, restResult] = await Promise.allSettled([
124
184
  authenticateWithClient("socket", accessToken, identityToken, params),
125
185
  authenticateWithClient("rest", accessToken, identityToken, params),
@@ -135,7 +195,12 @@ export const authenticateBoth = async (accessToken: string, identityToken: strin
135
195
  /**
136
196
  * Switches the client type and authenticates
137
197
  */
138
- export async function switchClientAndAuth(type: ClientType, access: string, id: string, params?: any) {
198
+ export async function switchClientAndAuth(
199
+ type: ClientType,
200
+ access: string,
201
+ id: string,
202
+ params?: any,
203
+ ): Promise<Record<string, any> | null> {
139
204
  setClientType(type);
140
205
  return authenticateWithClient(type, access, id, params);
141
206
  }
@@ -13,7 +13,7 @@ import { validateImageUrl } from "@b3dotfun/sdk/global-account/react/utils/profi
13
13
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
14
14
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
15
15
  import { getIpfsUrl } from "@b3dotfun/sdk/shared/utils/ipfs";
16
- import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
16
+ import { uploadFile as uploadToB3 } from "@b3dotfun/sdk/shared/utils/upload";
17
17
  import { Loader2, Upload, X } from "lucide-react";
18
18
  import { useCallback, useRef, useState } from "react";
19
19
  import type { Area } from "react-easy-crop";
@@ -21,7 +21,6 @@ import Cropper from "react-easy-crop";
21
21
  import "react-easy-crop/react-easy-crop.css";
22
22
 
23
23
  import { useActiveAccount } from "thirdweb/react";
24
- import { upload } from "thirdweb/storage";
25
24
  import { useModalStore } from "../../stores";
26
25
  import ModalHeader from "../ModalHeader/ModalHeader";
27
26
 
@@ -243,22 +242,18 @@ export function AvatarEditor({ onSetAvatar, className }: AvatarEditorProps) {
243
242
  }
244
243
  }
245
244
 
246
- // Upload to IPFS if we have a file
245
+ // Upload file if we have one
247
246
  if (fileToUpload) {
248
- debug("Starting upload to IPFS", fileToUpload);
247
+ debug("Starting upload", fileToUpload);
249
248
 
250
- // Upload to IPFS using Thirdweb
251
- const ipfsUrl = await upload({
252
- client,
253
- files: [fileToUpload],
254
- });
249
+ const avatarUrl = await uploadToB3(fileToUpload);
255
250
 
256
- debug("Upload successful", ipfsUrl);
251
+ debug("Upload successful", avatarUrl);
257
252
 
258
253
  // Save avatar URL using profiles service
259
254
  const user = await app.service("users").setAvatar(
260
255
  {
261
- avatar: ipfsUrl,
256
+ avatar: avatarUrl,
262
257
  },
263
258
  // @ts-expect-error - our typed client is expecting context even though it's set elsewhere
264
259
  {},
@@ -84,3 +84,15 @@ export function useB3Config(): B3ConfigContextType {
84
84
  }
85
85
  return context;
86
86
  }
87
+
88
+ /**
89
+ * Overrides ONLY `partnerId` for a subtree, inheriting every other config value from the parent
90
+ * B3ConfigProvider. Lets a single route attribute its AnySpend orders/quotes to a different partner
91
+ * (e.g. `/b3os-deposit` → the b3os partner) without standing up a second B3Provider — the config
92
+ * context is separate from the wallet/modal machinery, so nothing re-initializes. Must be rendered
93
+ * inside an existing B3ConfigProvider.
94
+ */
95
+ export function B3ConfigPartnerOverride({ partnerId, children }: { partnerId: string; children: React.ReactNode }) {
96
+ const parent = useB3Config();
97
+ return <B3ConfigContext.Provider value={{ ...parent, partnerId }}>{children}</B3ConfigContext.Provider>;
98
+ }
@@ -11,7 +11,10 @@ import { QueryClient } from "@tanstack/react-query";
11
11
  import { useEffect, useMemo } from "react";
12
12
  import { Account, EIP1193, Wallet } from "thirdweb/wallets";
13
13
  import { CreateConnectorFn } from "wagmi";
14
- import { ClientType, setClientType } from "../../../client-manager";
14
+ import { ClientType, resetClients, setClientType } from "../../../client-manager";
15
+ import { setB3ApiUrl } from "../../../../app.shared";
16
+ import { setApiUrl as setNotificationsApiUrl } from "../../../../notifications/services/api";
17
+ import { resetBetterAuthClient } from "../../../better-auth-client";
15
18
  import { StyleRoot } from "../StyleRoot";
16
19
  import { setToastContext, ToastProvider, useToastContext } from "../Toast/index";
17
20
  import AuthenticationProvider from "./AuthenticationProvider";
@@ -19,6 +22,11 @@ import { B3ConfigProvider } from "./B3ConfigProvider";
19
22
  import BetterAuthProvider from "./BetterAuthProvider";
20
23
  import { LocalSDKProvider } from "./LocalSDKProvider";
21
24
 
25
+ const NOTIFICATIONS_URL_BY_ENV = {
26
+ development: "https://dev-notifications.b3.fun",
27
+ production: "https://notifications.b3.fun",
28
+ } as const;
29
+
22
30
  /**
23
31
  * Main B3Provider component
24
32
  */
@@ -29,7 +37,6 @@ export function B3Provider({
29
37
  environment,
30
38
  automaticallySetFirstEoa,
31
39
  defaultEoaProvider,
32
- simDuneApiKey,
33
40
  // deprecated since v0.0.87
34
41
  toaster: _toaster,
35
42
  clientType = "rest",
@@ -45,6 +52,8 @@ export function B3Provider({
45
52
  disableBSMNTAuthentication = false,
46
53
  queryClient,
47
54
  authStrategy = "thirdweb",
55
+ apiUrl,
56
+ notificationsApiUrl,
48
57
  }: {
49
58
  theme: "light" | "dark";
50
59
  children: React.ReactNode;
@@ -53,7 +62,6 @@ export function B3Provider({
53
62
  automaticallySetFirstEoa?: boolean;
54
63
  /** EIP-1193 provider to auto-connect as the default EOA wallet (e.g., Farcaster frame wallet) */
55
64
  defaultEoaProvider?: EIP1193.EIP1193Provider;
56
- simDuneApiKey?: string;
57
65
  toaster?: {
58
66
  position?: "top-center" | "top-right" | "bottom-center" | "bottom-right";
59
67
  style?: React.CSSProperties;
@@ -74,7 +82,35 @@ export function B3Provider({
74
82
  queryClient?: QueryClient;
75
83
  /** Auth strategy: "thirdweb" (default, ecosystem wallet) or "better-auth" (email/password via Better Auth) */
76
84
  authStrategy?: AuthStrategy;
85
+ /**
86
+ * Override the B3 API URL. When provided, all SDK requests (auth, Feathers,
87
+ * BetterAuth) will use this URL instead of the `NEXT_PUBLIC_B3_API` env var.
88
+ *
89
+ * Useful for local development: pass `http://localhost:3031` to route
90
+ * OAuth callbacks and session checks through your local B3 API.
91
+ * If omitted, defaults to `NEXT_PUBLIC_B3_API` or `https://api.b3.fun`.
92
+ */
93
+ apiUrl?: string;
94
+ /** Override the notifications worker URL. Defaults to `https://notifications.b3.fun`. */
95
+ notificationsApiUrl?: string;
77
96
  }) {
97
+ // Override the B3 API URL when the `apiUrl` prop is provided.
98
+ // Must run before client initialization and auth providers mount.
99
+ useEffect(() => {
100
+ setB3ApiUrl(apiUrl ?? null);
101
+ if (apiUrl) {
102
+ resetBetterAuthClient();
103
+ resetClients();
104
+ }
105
+ return () => {
106
+ setB3ApiUrl(null);
107
+ };
108
+ }, [apiUrl]);
109
+
110
+ useEffect(() => {
111
+ setNotificationsApiUrl(notificationsApiUrl ?? NOTIFICATIONS_URL_BY_ENV[environment ?? "production"]);
112
+ }, [notificationsApiUrl, environment]);
113
+
78
114
  // Initialize Google Analytics on mount
79
115
  useEffect(() => {
80
116
  loadGA4Script();
@@ -112,7 +148,7 @@ export function B3Provider({
112
148
  authStrategy={authStrategy}
113
149
  >
114
150
  <ToastContextConnector />
115
- <RelayKitProviderWrapper simDuneApiKey={simDuneApiKey}>
151
+ <RelayKitProviderWrapper>
116
152
  {children}
117
153
  {/* For the modal https://github.com/b3-fun/b3/blob/main/packages/sdk/src/global-account/react/components/ui/dialog.tsx#L46 */}
118
154
  <StyleRoot id="b3-root" />