@b3dotfun/sdk 0.0.40-test.6 → 0.0.41-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +0 -1
  2. package/dist/cjs/anyspend/constants/index.js +1 -2
  3. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +11 -1
  4. package/dist/cjs/anyspend/react/components/AnySpend.js +22 -10
  5. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
  6. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
  7. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  8. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +41 -20
  9. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  10. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  11. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
  12. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  13. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +10 -8
  14. package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +1 -2
  15. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
  16. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +7 -4
  17. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  18. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
  19. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  20. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  21. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
  22. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
  23. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +24 -23
  24. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
  25. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  26. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  27. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  28. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +10 -6
  29. package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
  30. package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
  31. package/dist/cjs/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  32. package/dist/cjs/anyspend/react/components/common/PointsBadge.js +7 -0
  33. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  34. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
  35. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
  36. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
  37. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  38. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
  39. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  40. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +18 -8
  41. package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  42. package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
  43. package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
  44. package/dist/cjs/anyspend/react/providers/index.js +3 -0
  45. package/dist/cjs/anyspend/services/anyspend.d.ts +1 -1
  46. package/dist/cjs/anyspend/services/anyspend.js +2 -0
  47. package/dist/cjs/anyspend/types/api.d.ts +51 -1
  48. package/dist/cjs/anyspend/utils/chain.js +1 -1
  49. package/dist/cjs/anyspend/utils/orderPayload.js +3 -0
  50. package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
  51. package/dist/cjs/bondkit/bondkitToken.js +268 -2
  52. package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
  53. package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
  54. package/dist/cjs/bondkit/components/TradingView.js +3 -4
  55. package/dist/cjs/bondkit/config.d.ts +1 -1
  56. package/dist/cjs/bondkit/config.js +5 -2
  57. package/dist/cjs/bondkit/constants.d.ts +4 -0
  58. package/dist/cjs/bondkit/constants.js +6 -1
  59. package/dist/cjs/bondkit/index.d.ts +1 -0
  60. package/dist/cjs/bondkit/index.js +4 -1
  61. package/dist/cjs/bondkit/swapService.d.ts +43 -0
  62. package/dist/cjs/bondkit/swapService.js +376 -0
  63. package/dist/cjs/bondkit/types.d.ts +10 -4
  64. package/dist/cjs/bondkit/types.js +4 -5
  65. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
  66. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +27 -28
  67. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
  68. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  69. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
  70. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
  71. package/dist/cjs/global-account/react/hooks/index.js +3 -1
  72. package/dist/cjs/global-account/react/hooks/useAccountAssets.js +5 -2
  73. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +0 -12
  74. package/dist/cjs/global-account/react/hooks/useAuthentication.js +2 -3
  75. package/dist/cjs/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
  76. package/dist/cjs/global-account/react/hooks/useGlobalAccount.js +32 -0
  77. package/dist/cjs/global-account/react/hooks/useQueryB3.js +5 -2
  78. package/dist/cjs/global-account/react/hooks/useQueryBSMNT.js +5 -2
  79. package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
  80. package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +7 -1
  81. package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +2 -2
  82. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +28 -24
  83. package/dist/cjs/shared/utils/fetchBalances.d.ts +1 -1
  84. package/dist/esm/anyspend/constants/index.d.ts +0 -1
  85. package/dist/esm/anyspend/constants/index.js +0 -1
  86. package/dist/esm/anyspend/react/components/AnySpend.d.ts +11 -1
  87. package/dist/esm/anyspend/react/components/AnySpend.js +23 -11
  88. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
  89. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
  90. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  91. package/dist/esm/anyspend/react/components/AnySpendCustom.js +41 -20
  92. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  93. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  94. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
  95. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  96. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -9
  97. package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +1 -2
  98. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
  99. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +8 -5
  100. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  101. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
  102. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  103. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  104. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +40 -37
  105. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
  106. package/dist/esm/anyspend/react/components/common/OrderDetails.js +25 -24
  107. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
  108. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  109. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  110. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  111. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +10 -6
  112. package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
  113. package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
  114. package/dist/esm/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  115. package/dist/esm/anyspend/react/components/common/PointsBadge.js +4 -0
  116. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  117. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
  118. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
  119. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
  120. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  121. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
  122. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  123. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +18 -8
  124. package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  125. package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
  126. package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
  127. package/dist/esm/anyspend/react/providers/index.js +1 -0
  128. package/dist/esm/anyspend/services/anyspend.d.ts +1 -1
  129. package/dist/esm/anyspend/services/anyspend.js +2 -0
  130. package/dist/esm/anyspend/types/api.d.ts +51 -1
  131. package/dist/esm/anyspend/utils/chain.js +1 -1
  132. package/dist/esm/anyspend/utils/orderPayload.js +3 -0
  133. package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
  134. package/dist/esm/bondkit/bondkitToken.js +268 -2
  135. package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
  136. package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
  137. package/dist/esm/bondkit/components/TradingView.js +3 -4
  138. package/dist/esm/bondkit/config.d.ts +1 -1
  139. package/dist/esm/bondkit/config.js +5 -2
  140. package/dist/esm/bondkit/constants.d.ts +4 -0
  141. package/dist/esm/bondkit/constants.js +5 -0
  142. package/dist/esm/bondkit/index.d.ts +1 -0
  143. package/dist/esm/bondkit/index.js +2 -0
  144. package/dist/esm/bondkit/swapService.d.ts +43 -0
  145. package/dist/esm/bondkit/swapService.js +372 -0
  146. package/dist/esm/bondkit/types.d.ts +10 -4
  147. package/dist/esm/bondkit/types.js +4 -5
  148. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
  149. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +27 -28
  150. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
  151. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  152. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  153. package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
  154. package/dist/esm/global-account/react/hooks/index.js +1 -0
  155. package/dist/esm/global-account/react/hooks/useAccountAssets.js +2 -2
  156. package/dist/esm/global-account/react/hooks/useAccountWallet.js +0 -12
  157. package/dist/esm/global-account/react/hooks/useAuthentication.js +2 -3
  158. package/dist/esm/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
  159. package/dist/esm/global-account/react/hooks/useGlobalAccount.js +29 -0
  160. package/dist/esm/global-account/react/hooks/useQueryB3.js +5 -2
  161. package/dist/esm/global-account/react/hooks/useQueryBSMNT.js +5 -2
  162. package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
  163. package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -1
  164. package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +2 -2
  165. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +29 -25
  166. package/dist/esm/shared/utils/fetchBalances.d.ts +1 -1
  167. package/dist/styles/index.css +1 -1
  168. package/dist/types/anyspend/constants/index.d.ts +0 -1
  169. package/dist/types/anyspend/react/components/AnySpend.d.ts +11 -1
  170. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
  171. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -1
  172. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  173. package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
  174. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  175. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  176. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
  177. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  178. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  179. package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
  180. package/dist/types/anyspend/react/components/common/PointsBadge.d.ts +7 -0
  181. package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  182. package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
  183. package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  184. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  185. package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  186. package/dist/types/anyspend/react/providers/index.d.ts +1 -0
  187. package/dist/types/anyspend/services/anyspend.d.ts +1 -1
  188. package/dist/types/anyspend/types/api.d.ts +51 -1
  189. package/dist/types/bondkit/bondkitToken.d.ts +37 -2
  190. package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
  191. package/dist/types/bondkit/config.d.ts +1 -1
  192. package/dist/types/bondkit/constants.d.ts +4 -0
  193. package/dist/types/bondkit/index.d.ts +1 -0
  194. package/dist/types/bondkit/swapService.d.ts +43 -0
  195. package/dist/types/bondkit/types.d.ts +10 -4
  196. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
  197. package/dist/types/global-account/react/hooks/index.d.ts +1 -0
  198. package/dist/types/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
  199. package/dist/types/shared/utils/fetchBalances.d.ts +1 -1
  200. package/package.json +1 -1
  201. package/src/anyspend/constants/index.ts +0 -2
  202. package/src/anyspend/react/components/AnySpend.tsx +52 -18
  203. package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
  204. package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
  205. package/src/anyspend/react/components/AnySpendCustom.tsx +82 -34
  206. package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
  207. package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
  208. package/src/anyspend/react/components/AnyspendDepositHype.tsx +38 -18
  209. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +1 -2
  210. package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +12 -4
  211. package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
  212. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
  213. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +61 -45
  214. package/src/anyspend/react/components/common/OrderDetails.tsx +60 -47
  215. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
  216. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
  217. package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
  218. package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
  219. package/src/anyspend/react/components/common/PointsBadge.tsx +20 -0
  220. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
  221. package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
  222. package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
  223. package/src/anyspend/react/hooks/useAnyspendFlow.ts +18 -8
  224. package/src/anyspend/react/hooks/useAnyspendOrderAndTransactions.ts +1 -1
  225. package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +1 -1
  226. package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
  227. package/src/anyspend/react/providers/index.ts +1 -0
  228. package/src/anyspend/services/anyspend.ts +3 -1
  229. package/src/anyspend/types/api.ts +51 -1
  230. package/src/anyspend/types/api_req_res.ts +6 -10
  231. package/src/anyspend/utils/chain.ts +1 -1
  232. package/src/anyspend/utils/orderPayload.ts +3 -0
  233. package/src/bondkit/bondkitToken.ts +323 -3
  234. package/src/bondkit/bondkitTokenFactory.ts +2 -2
  235. package/src/bondkit/components/TradingView.tsx +3 -5
  236. package/src/bondkit/config.ts +5 -2
  237. package/src/bondkit/constants.ts +7 -0
  238. package/src/bondkit/index.ts +3 -0
  239. package/src/bondkit/swapService.ts +464 -0
  240. package/src/bondkit/types.ts +12 -5
  241. package/src/global-account/react/components/B3Provider/B3Provider.tsx +31 -32
  242. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
  243. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
  244. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
  245. package/src/global-account/react/hooks/index.ts +1 -0
  246. package/src/global-account/react/hooks/useAccountAssets.ts +4 -3
  247. package/src/global-account/react/hooks/useAccountWallet.tsx +0 -13
  248. package/src/global-account/react/hooks/useAuthentication.ts +2 -3
  249. package/src/global-account/react/hooks/useGlobalAccount.tsx +36 -0
  250. package/src/global-account/react/hooks/useOneBalance.tsx +1 -1
  251. package/src/global-account/react/hooks/useQueryB3.ts +22 -15
  252. package/src/global-account/react/hooks/useQueryBSMNT.ts +22 -15
  253. package/src/global-account/react/hooks/useSimBalance.ts +2 -2
  254. package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -1
  255. package/src/global-account/react/hooks/useTokenFromUrl.tsx +2 -2
  256. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +30 -26
  257. package/src/shared/utils/fetchBalances.ts +1 -1
  258. package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
  259. package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
  260. package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
  261. package/dist/esm/global-account/examples/client-selection-example.js +0 -93
  262. package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
  263. package/src/global-account/docs/client-selection.md +0 -292
  264. package/src/global-account/examples/client-selection-example.tsx +0 -197
@@ -10,6 +10,7 @@ const react_1 = require("../../../../global-account/react");
10
10
  const SignOutIcon_1 = require("../../../../global-account/react/components/icons/SignOutIcon");
11
11
  const formatNumber_1 = require("../../../../shared/utils/formatNumber");
12
12
  const thirdweb_1 = require("../../../../shared/utils/thirdweb");
13
+ const truncateAddress_1 = require("../../../../shared/utils/truncateAddress");
13
14
  const lucide_react_1 = require("lucide-react");
14
15
  const react_2 = require("react");
15
16
  const sonner_1 = require("sonner");
@@ -18,6 +19,21 @@ const viem_1 = require("viem");
18
19
  const profileDisplay_1 = require("../../utils/profileDisplay");
19
20
  const AccountAssets_1 = require("../AccountAssets/AccountAssets");
20
21
  const ContentTokens_1 = require("./ContentTokens");
22
+ // Helper function to check if a string is a wallet address and format it
23
+ const formatProfileTitle = (title) => {
24
+ // Check if title looks like an Ethereum address (0x followed by 40 hex characters)
25
+ const isEthereumAddress = /^0x[a-fA-F0-9]{40}$/.test(title);
26
+ if (isEthereumAddress) {
27
+ return {
28
+ displayTitle: (0, truncateAddress_1.truncateAddress)(title),
29
+ isAddress: true,
30
+ };
31
+ }
32
+ return {
33
+ displayTitle: title,
34
+ isAddress: false,
35
+ };
36
+ };
21
37
  const BalanceContent_1 = require("./BalanceContent");
22
38
  function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, showSwap, showDeposit, }) {
23
39
  const [revokingSignerId, setRevokingSignerId] = (0, react_2.useState)(null);
@@ -117,7 +133,7 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
117
133
  }
118
134
  };
119
135
  const profiles = profilesRaw
120
- .filter((profile) => !["custom_auth_endpoint", "siwe"].includes(profile.type))
136
+ .filter((profile) => !["custom_auth_endpoint"].includes(profile.type))
121
137
  .map((profile) => ({
122
138
  ...(0, profileDisplay_1.getProfileDisplayInfo)(profile),
123
139
  originalProfile: profile,
@@ -152,7 +168,24 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
152
168
  },
153
169
  });
154
170
  };
155
- return ((0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-settings space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-section space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "linked-accounts-settings-button linked-accounts-link-button bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-accounts-link-loading text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "linked-accounts-link-icon text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "linked-accounts-link-text text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-loading flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-list space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "linked-account-item bg-b3-line flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-info flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { className: "linked-account-details", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-title-row flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "linked-account-title text-b3-grey font-neue-montreal-semibold", children: profile.title }), (0, jsx_runtime_1.jsx)("span", { className: "linked-account-type text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "linked-account-unlink-button text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-account-unlink-loading animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16, className: "linked-account-unlink-icon" })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-empty text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
171
+ console.log("@@profiles", profiles);
172
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-settings space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-section space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { className: "linked-accounts-settings-button linked-accounts-link-button bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-accounts-link-loading text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "linked-accounts-link-icon text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "linked-accounts-link-text text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-loading flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-list space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "linked-account-item bg-b3-line group flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-info flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { className: "linked-account-details", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-title-row flex items-center gap-2", children: [(() => {
173
+ const { displayTitle, isAddress } = formatProfileTitle(profile.title);
174
+ const handleCopyAddress = async (e) => {
175
+ e.stopPropagation();
176
+ try {
177
+ await navigator.clipboard.writeText(profile.title);
178
+ sonner_1.toast.success("Address copied to clipboard!");
179
+ }
180
+ catch (error) {
181
+ sonner_1.toast.error("Failed to copy address");
182
+ }
183
+ };
184
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: `linked-account-title text-b3-grey font-neue-montreal-semibold ${isAddress
185
+ ? "font-mono text-sm" // Use monospace font for addresses
186
+ : "break-words" // Use break-words for emails/names (better than break-all)
187
+ }`, title: isAddress ? profile.title : undefined, children: displayTitle }), isAddress && ((0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "linked-account-copy-button ml-1 rounded p-1 opacity-0 transition-opacity hover:bg-gray-100 group-hover:opacity-100", title: "Copy full address", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { size: 12, className: "text-gray-500 hover:text-gray-700" }) }))] }));
188
+ })(), (0, jsx_runtime_1.jsx)("span", { className: "linked-account-type text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "linked-account-unlink-button text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-account-unlink-loading animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16, className: "linked-account-unlink-icon" })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-empty text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
156
189
  /* Referral Section */
157
190
  (0, jsx_runtime_1.jsxs)("div", { className: "referrals-section space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "referrals-title text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), (0, jsx_runtime_1.jsxs)("div", { className: "referral-code-container bg-b3-line rounded-xl p-4", children: [isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-header-editing", children: [(0, jsx_runtime_1.jsx)("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "referral-code-content flex items-center justify-between", children: [!isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-actions flex items-center gap-2", children: isEditingCode ? ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-edit-form flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "referral-code-input rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", className: "referral-code-save-button", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "referral-code-save-loading h-4 w-4 animate-spin" })) : ("Save") }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", variant: "ghost", className: "referral-code-cancel-button", onClick: () => {
158
191
  setIsEditingCode(false);
@@ -8,6 +8,7 @@ const thirdweb_1 = require("../../../../../shared/utils/thirdweb");
8
8
  const react_2 = require("react");
9
9
  const react_3 = require("thirdweb/react");
10
10
  const wallets_1 = require("thirdweb/wallets");
11
+ const debug = (0, debug_1.debugB3React)("LoginStepCustom");
11
12
  function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
12
13
  const [isLoading, setIsLoading] = (0, react_2.useState)(false);
13
14
  const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
@@ -24,7 +25,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
24
25
  const handleConnect = async (strategy) => {
25
26
  try {
26
27
  setIsLoading(true);
27
- (0, debug_1.debug)("setIsAuthenticating:true:3");
28
+ debug("setIsAuthenticating:true:3");
28
29
  setIsAuthenticating(true);
29
30
  const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
30
31
  let connectResult;
@@ -45,7 +46,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
45
46
  connectResult = await connect(options);
46
47
  }
47
48
  const account = connectResult?.getAccount();
48
- console.log("@@gio:connectResult", { connectResult, account, options });
49
+ debug("@@connectResult", { connectResult, account, options });
49
50
  if (!account)
50
51
  throw new Error("Failed to connect");
51
52
  await onSuccess(account);
@@ -58,7 +59,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
58
59
  }
59
60
  finally {
60
61
  setIsLoading(false);
61
- (0, debug_1.debug)("setIsAuthenticating:false:3");
62
+ debug("setIsAuthenticating:false:3");
62
63
  setIsAuthenticating(false);
63
64
  }
64
65
  };
@@ -14,6 +14,7 @@ export { useExchangeRate } from "./useExchangeRate";
14
14
  export { useFirstEOA } from "./useFirstEOA";
15
15
  export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
16
16
  export { useGetGeo } from "./useGetGeo";
17
+ export { useGlobalAccount } from "./useGlobalAccount";
17
18
  export { useHandleConnectWithPrivy } from "./useHandleConnectWithPrivy";
18
19
  export { useHasMounted } from "./useHasMounted";
19
20
  export { useIsMobile } from "./useIsMobile";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
17
+ exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalance = exports.useSiwe = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfilePreference = exports.useProfile = exports.useOneBalance = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useBestTransactionPath = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = void 0;
18
18
  var useAccountAssets_1 = require("./useAccountAssets");
19
19
  Object.defineProperty(exports, "useAccountAssets", { enumerable: true, get: function () { return useAccountAssets_1.useAccountAssets; } });
20
20
  var useAccountWallet_1 = require("./useAccountWallet");
@@ -46,6 +46,8 @@ var useGetAllTWSigners_1 = require("./useGetAllTWSigners");
46
46
  Object.defineProperty(exports, "useGetAllTWSigners", { enumerable: true, get: function () { return useGetAllTWSigners_1.useGetAllTWSigners; } });
47
47
  var useGetGeo_1 = require("./useGetGeo");
48
48
  Object.defineProperty(exports, "useGetGeo", { enumerable: true, get: function () { return useGetGeo_1.useGetGeo; } });
49
+ var useGlobalAccount_1 = require("./useGlobalAccount");
50
+ Object.defineProperty(exports, "useGlobalAccount", { enumerable: true, get: function () { return useGlobalAccount_1.useGlobalAccount; } });
49
51
  var useHandleConnectWithPrivy_1 = require("./useHandleConnectWithPrivy");
50
52
  Object.defineProperty(exports, "useHandleConnectWithPrivy", { enumerable: true, get: function () { return useHandleConnectWithPrivy_1.useHandleConnectWithPrivy; } });
51
53
  var useHasMounted_1 = require("./useHasMounted");
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.useAccountAssets = useAccountAssets;
4
7
  const simplehash_1 = require("../../../shared/utils/simplehash");
5
8
  const react_query_1 = require("@tanstack/react-query");
9
+ const invariant_1 = __importDefault(require("invariant"));
6
10
  async function fetchAccountAssets(address) {
7
- if (!address)
8
- throw new Error("Address is required");
11
+ (0, invariant_1.default)(address, "Address is required");
9
12
  const [nftResponse] = await Promise.all([
10
13
  (0, simplehash_1.fetchSimpleHashData)(`/v0/nfts/owners`, {
11
14
  chains: "b3,b3-sepolia,base",
@@ -43,18 +43,6 @@ function useAccountWallet() {
43
43
  const { data: profileData } = (0, react_1.useProfile)({ address: account?.address });
44
44
  const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
45
45
  const avatarUrl = user?.avatar ? (0, ipfs_1.getIpfsUrl)(user?.avatar) : profileData?.avatar;
46
- console.log("@@gio:connectedWallets", connectedWallets);
47
- // useEffect(() => {
48
- // if (connectedWallets.length > 0) {
49
- // console.log("connectedWallets:1", connectedWallets);
50
- // // force autoconnect
51
- // const firstWallet = connectedWallets[0];
52
- // console.log("firstWallet:1", firstWallet);
53
- // firstWallet.autoConnect({
54
- // client: client,
55
- // });
56
- // }
57
- // }, [connectedWallets]);
58
46
  const res = (0, react_2.useMemo)(() => ({
59
47
  wallet: {
60
48
  ...account,
@@ -98,7 +98,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
98
98
  setIsAuthenticating(false);
99
99
  }
100
100
  useAutoConnectLoadingPrevious.current = useAutoConnectLoading;
101
- }, [useAutoConnectLoading]);
101
+ }, [useAutoConnectLoading, hasStartedConnecting, setIsAuthenticating]);
102
102
  // Ensure isAuthenticating stays true until we're fully ready
103
103
  (0, react_2.useEffect)(() => {
104
104
  if (useAutoConnectLoading) {
@@ -122,8 +122,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
122
122
  if (activeWallet) {
123
123
  debug("@@logout:activeWallet", activeWallet);
124
124
  disconnect(activeWallet);
125
- debug("@@logout:disconnected");
126
- console.log("@@gio:logout:activeWallet", activeWallet);
125
+ debug("@@logout:activeWallet", activeWallet);
127
126
  }
128
127
  // Log out of each wallet
129
128
  wallets.forEach(wallet => {
@@ -0,0 +1,6 @@
1
+ import { Wallet } from "thirdweb/wallets";
2
+ export declare function useGlobalAccount(): {
3
+ account: Wallet | undefined;
4
+ address: string | undefined;
5
+ info: import("@tanstack/react-query").UseQueryResult<import("thirdweb/wallets").WalletInfo, Error>;
6
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useGlobalAccount = useGlobalAccount;
4
+ const react_1 = require("../../../global-account/react");
5
+ const debug_1 = require("../../../shared/utils/debug");
6
+ const react_2 = require("react");
7
+ const react_3 = require("thirdweb/react");
8
+ const debug = (0, debug_1.debugB3React)("useGlobalAccount");
9
+ function useGlobalAccount() {
10
+ const wallets = (0, react_3.useConnectedWallets)();
11
+ const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
12
+ const [globalAccount, setGlobalAccount] = (0, react_2.useState)(undefined);
13
+ const [address, setAddress] = (0, react_2.useState)(undefined);
14
+ const walletInfo = (0, react_3.useWalletInfo)(globalAccount?.id);
15
+ (0, react_2.useEffect)(() => {
16
+ if (!isConnected) {
17
+ debug("Not connected");
18
+ setGlobalAccount(undefined);
19
+ setAddress(undefined);
20
+ return;
21
+ }
22
+ const globalAccountWallet = wallets.find(wallet => wallet.id.startsWith("ecosystem."));
23
+ const account = globalAccountWallet?.getAccount();
24
+ setGlobalAccount(globalAccountWallet);
25
+ setAddress(account?.address);
26
+ }, [isConnected, wallets]);
27
+ return {
28
+ account: globalAccount,
29
+ address,
30
+ info: walletInfo,
31
+ };
32
+ }
@@ -30,11 +30,14 @@ fetchInitially = true) {
30
30
  finally {
31
31
  setIsLoading(false);
32
32
  }
33
- }, []);
33
+ }, [service, method]);
34
+ // Serialize params for stable comparison
35
+ const paramsJson = JSON.stringify(params);
34
36
  (0, react_1.useEffect)(() => {
35
37
  if (fetchInitially) {
36
38
  runQuery(params);
37
39
  }
38
- }, [runQuery, fetchInitially, JSON.stringify(params)]);
40
+ // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ }, [runQuery, fetchInitially, paramsJson]);
39
42
  return { data, error, isLoading, runQuery };
40
43
  }
@@ -30,11 +30,14 @@ fetchInitially = true) {
30
30
  finally {
31
31
  setIsLoading(false);
32
32
  }
33
- }, []);
33
+ }, [service, method]);
34
+ // Serialize params for stable comparison
35
+ const paramsJson = JSON.stringify(params);
34
36
  (0, react_1.useEffect)(() => {
35
37
  if (fetchInitially) {
36
38
  runQuery(params);
37
39
  }
38
- }, [runQuery, fetchInitially, JSON.stringify(params)]);
40
+ // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ }, [runQuery, fetchInitially, paramsJson]);
39
42
  return { data, error, isLoading, runQuery };
40
43
  }
@@ -6,8 +6,8 @@ async function fetchSimBalance(address) {
6
6
  if (!address)
7
7
  throw new Error("Address is required");
8
8
  let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
9
- if (process.env.PUBLIC_LOCAL_KEY) {
10
- url += `&localkey=${process.env.PUBLIC_LOCAL_KEY}`;
9
+ if (process.env.NEXT_PUBLIC_LOCAL_KEY) {
10
+ url += `&localkey=${process.env.NEXT_PUBLIC_LOCAL_KEY}`;
11
11
  }
12
12
  const response = await fetch(url);
13
13
  if (!response.ok) {
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
3
6
  Object.defineProperty(exports, "__esModule", { value: true });
4
7
  exports.useTokenBalancesByChain = useTokenBalancesByChain;
5
8
  const thirdweb_insights_1 = require("../../../shared/utils/thirdweb-insights");
@@ -8,6 +11,7 @@ const b3Chain_1 = require("../../../shared/constants/chains/b3Chain");
8
11
  const chains_1 = require("../../../shared/utils/chains");
9
12
  const thirdweb_1 = require("../../../shared/utils/thirdweb");
10
13
  const wallets_1 = require("thirdweb/wallets");
14
+ const invariant_1 = __importDefault(require("invariant"));
11
15
  function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
12
16
  // Normalize chains to array
13
17
  const chainIds = Array.isArray(chainsIds) ? chainsIds : [chainsIds];
@@ -19,10 +23,12 @@ function useTokenBalancesByChain({ address, chainsIds, enabled = true, }) {
19
23
  const [nativeTokens, fungibleResponse] = await Promise.all([
20
24
  // Fetch native token balances
21
25
  Promise.all(chainIds.map(async (chainId) => {
26
+ const chain = (0, chains_1.getChainById)(chainId);
27
+ (0, invariant_1.default)(chain, "Chain is required");
22
28
  const walletBalance = await (0, wallets_1.getWalletBalance)({
23
29
  address,
24
30
  client: thirdweb_1.client,
25
- chain: (0, b3Chain_1.viemToThirdwebChain)((0, chains_1.getChainById)(chainId)),
31
+ chain: (0, b3Chain_1.viemToThirdwebChain)(chain),
26
32
  });
27
33
  return {
28
34
  ...walletBalance,
@@ -38,7 +38,7 @@ function useTokenFromUrl({ defaultToken, prefix }) {
38
38
  const network = chainIdParam ? (0, supported_1.getCoingeckoChainInfo)(Number(chainIdParam)).coingecko_id : "";
39
39
  const { data: tokenInfo, isError } = (0, react_query_1.useQuery)({
40
40
  queryKey: ["tokenInfo", network, currencyParam],
41
- queryFn: () => fetchTokenInfo(network, currencyParam),
41
+ queryFn: () => fetchTokenInfo(network, currencyParam || ""),
42
42
  enabled: shouldFetchToken,
43
43
  staleTime: Infinity,
44
44
  gcTime: Infinity,
@@ -51,7 +51,7 @@ function useTokenFromUrl({ defaultToken, prefix }) {
51
51
  if (isError || !tokenInfo) {
52
52
  return {
53
53
  ...defaultToken,
54
- address: currencyParam,
54
+ address: currencyParam || "",
55
55
  chainId: Number(chainIdParam),
56
56
  };
57
57
  }
@@ -12,50 +12,56 @@ const invariant_1 = __importDefault(require("invariant"));
12
12
  const react_1 = require("react");
13
13
  const sonner_1 = require("sonner");
14
14
  const thirdweb_2 = require("thirdweb");
15
+ const react_2 = require("thirdweb/react");
16
+ const viem_1 = require("viem");
15
17
  const wagmi_1 = require("wagmi");
16
18
  const components_1 = require("../components");
17
19
  const useAccountWallet_1 = require("./useAccountWallet");
18
- const viem_1 = require("viem");
19
20
  const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
20
21
  process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
21
22
  process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID ||
22
23
  process.env.NEXT_PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID);
23
24
  (0, invariant_1.default)(partnerId, "Partner ID is required");
24
25
  function useUnifiedChainSwitchAndExecute() {
25
- const { data: walletClient } = (0, wagmi_1.useWalletClient)();
26
26
  const { switchChainAsync } = (0, wagmi_1.useSwitchChain)();
27
27
  const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0, react_1.useState)(false);
28
- const { isActiveSmartWallet, isActiveEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
28
+ const activeWallet = (0, react_2.useActiveWallet)();
29
+ const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
29
30
  const { account: aaAccount } = (0, components_1.useB3)();
30
31
  // Handle EOA wallet chain switch and execute transaction
31
32
  const handleEOASwitchChainAndSendTransaction = (0, react_1.useCallback)(async (targetChainId, params) => {
32
- if (!walletClient) {
33
+ if (!connectedEOAWallet) {
33
34
  sonner_1.toast.error("Please connect your wallet");
34
35
  return;
35
36
  }
36
- const providerId = walletClient.chain.id;
37
- const onCorrectChain = providerId === targetChainId;
37
+ // Get target chain configuration once
38
+ const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
39
+ if (!targetChain) {
40
+ sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
41
+ return;
42
+ }
43
+ const currentChainId = activeWallet?.getChain()?.id;
44
+ const onCorrectChain = currentChainId === targetChainId;
38
45
  // Helper function to execute the transaction
39
46
  const executeTransaction = async () => {
40
- const signer = walletClient.account;
47
+ const signer = activeWallet?.getAccount();
41
48
  if (!signer) {
42
49
  throw new Error("No account connected");
43
50
  }
44
- // Get the target chain configuration instead of using potentially stale walletClient.chain
45
- const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
46
- if (!targetChain) {
47
- throw new Error(`Chain ${targetChainId} is not supported`);
51
+ // Coinbase Smart Wallet specific chain switching (different behavior from other wallets)
52
+ const walletChain = connectedEOAWallet.getChain();
53
+ if (walletChain?.id !== targetChainId) {
54
+ activeWallet?.switchChain((0, supported_1.getThirdwebChain)(targetChainId));
48
55
  }
49
56
  (0, invariant_1.default)((0, viem_1.isAddress)(params.to), "params.to is not a valid address");
50
- const hash = await walletClient.sendTransaction({
51
- account: signer,
52
- chain: targetChain,
57
+ const result = await signer.sendTransaction({
58
+ chainId: targetChainId,
53
59
  to: params.to,
54
60
  data: params.data,
55
61
  value: params.value,
56
62
  });
57
- sonner_1.toast.success(`Transaction sent: ${hash.slice(0, 10)}...`);
58
- return hash;
63
+ sonner_1.toast.success(`Transaction sent: ${result.transactionHash.slice(0, 10)}...`);
64
+ return result.transactionHash;
59
65
  };
60
66
  try {
61
67
  setIsSwitchingOrExecuting(true);
@@ -63,11 +69,6 @@ function useUnifiedChainSwitchAndExecute() {
63
69
  return await executeTransaction();
64
70
  }
65
71
  const switchingToastId = sonner_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
66
- const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
67
- if (!targetChain) {
68
- sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
69
- return;
70
- }
71
72
  const blockExplorerUrl = targetChain.blockExplorers?.default.url;
72
73
  (0, invariant_1.default)(blockExplorerUrl, "Block explorer URL is required");
73
74
  const nativeCurrency = (0, anyspend_1.getNativeToken)(targetChainId);
@@ -102,7 +103,7 @@ function useUnifiedChainSwitchAndExecute() {
102
103
  finally {
103
104
  setIsSwitchingOrExecuting(false);
104
105
  }
105
- }, [walletClient, switchChainAsync]);
106
+ }, [connectedEOAWallet, activeWallet, switchChainAsync]);
106
107
  // Handle AA wallet transaction (no chain switch needed for AA)
107
108
  const handleAASendTransaction = (0, react_1.useCallback)(async (targetChainId, params) => {
108
109
  if (!aaAccount) {
@@ -130,18 +131,21 @@ function useUnifiedChainSwitchAndExecute() {
130
131
  });
131
132
  }
132
133
  catch (err) {
133
- console.error(err);
134
+ console.error("Create global-accounts-intents error", err);
134
135
  }
135
136
  sonner_1.toast.info("Sending transaction…");
137
+ const start = performance.now();
136
138
  const sendTxResponse = await (0, thirdweb_2.sendTransaction)({
137
139
  account: aaAccount,
138
140
  transaction,
139
141
  });
142
+ const end = performance.now();
143
+ console.log("Time taken to send transaction", end - start);
140
144
  sonner_1.toast.success("Transaction sent successfully");
141
145
  return sendTxResponse.transactionHash;
142
146
  }
143
147
  catch (err) {
144
- console.error(err);
148
+ console.error("Send transaction error", err);
145
149
  sonner_1.toast.error(err?.message ?? "Transaction failed");
146
150
  return undefined;
147
151
  }
@@ -13,4 +13,4 @@ export interface AssetBalance {
13
13
  totalBalance: string;
14
14
  chainBalances: ChainBalance[];
15
15
  }
16
- export declare const fetchBalances: (address: string, testnet?: boolean) => Promise<AssetBalance[]>;
16
+ export declare const fetchBalances: (address: string | undefined, testnet?: boolean) => Promise<AssetBalance[]>;
@@ -37,4 +37,3 @@ export declare const VENDOR_DISPLAY_NAMES: {
37
37
  readonly stripe: "Stripe";
38
38
  readonly unknown: "Unknown Vendor";
39
39
  };
40
- export declare const DEPOSIT_HYPE_ACTION = "deposit_hype";
@@ -78,4 +78,3 @@ export const VENDOR_DISPLAY_NAMES = {
78
78
  stripe: "Stripe",
79
79
  unknown: "Unknown Vendor",
80
80
  };
81
- export const DEPOSIT_HYPE_ACTION = "deposit_hype";
@@ -1,3 +1,4 @@
1
+ import { components } from "../../types/api";
1
2
  export interface RecipientOption {
2
3
  address: string;
3
4
  icon?: string;
@@ -12,7 +13,8 @@ export declare enum PanelView {
12
13
  FIAT_PAYMENT = 4,
13
14
  RECIPIENT_SELECTION = 5,
14
15
  CRYPTO_PAYMENT_METHOD = 6,
15
- FIAT_PAYMENT_METHOD = 7
16
+ FIAT_PAYMENT_METHOD = 7,
17
+ POINTS_DETAIL = 8
16
18
  }
17
19
  export declare function AnySpend(props: {
18
20
  mode?: "page" | "modal";
@@ -22,4 +24,12 @@ export declare function AnySpend(props: {
22
24
  recipientAddress?: string;
23
25
  loadOrder?: string;
24
26
  hideTransactionHistoryButton?: boolean;
27
+ /**
28
+ * Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
29
+ * Useful for handling special cases like B3 token selection.
30
+ */
31
+ onTokenSelect?: (token: components["schemas"]["Token"], event: {
32
+ preventDefault: () => void;
33
+ }) => void;
34
+ onSuccess?: (txHash?: string) => void;
25
35
  }): import("react/jsx-runtime").JSX.Element;