@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
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SOLANA_CHAIN_ID = exports.SOLANA_ZERION_SLUG = exports.SOLANA_NATIVE_TOKEN_ADDRESS = exports.EVM_NATIVE_TOKEN_ADDRESS = void 0;
4
+ exports.zerionSlugToChainId = zerionSlugToChainId;
5
+ exports.chainIdToZerionSlug = chainIdToZerionSlug;
6
+ exports.nativeTokenAddressForChain = nativeTokenAddressForChain;
7
+ exports.balanceMatchesToken = balanceMatchesToken;
8
+ exports.adaptZerionPositions = adaptZerionPositions;
9
+ const runtime_1 = require("@b3/chain-registry/runtime");
10
+ /**
11
+ * Canonical browser-side translation of Zerion wallet positions into B3 balance rows.
12
+ *
13
+ * This lives in the published SDK because every browser consumer needs it — the apps in this repo
14
+ * and the sites that install `@b3dotfun/sdk` from npm — and the in-repo Zerion client is a private
15
+ * workspace package that a published package cannot depend on. Backend services keep their own
16
+ * translation: pulling a browser SDK into a Node service to share one function is a worse trade
17
+ * than the second copy.
18
+ *
19
+ * Only the HTTP layer differs between callers. The rules below — which row counts as the chain's
20
+ * native coin, and which rows have no usable identity — must not be re-derived anywhere else.
21
+ */
22
+ /** Address B3 uses for a chain's native coin on EVM. Matches NATIVE_TOKEN_ADDRESSES. */
23
+ exports.EVM_NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
24
+ exports.SOLANA_NATIVE_TOKEN_ADDRESS = runtime_1.SOLANA_NATIVE_ASSET.wrapped
25
+ .address;
26
+ exports.SOLANA_ZERION_SLUG = runtime_1.SOLANA_NATIVE_ASSET.chain;
27
+ /** What Zerion's `quantity.int` is: a base-10 integer, unbounded in length. */
28
+ const DECIMAL_INTEGER_PATTERN = /^\d+$/;
29
+ /** Solana's chain id as the chain registry defines it — the id every balance row is keyed by. */
30
+ exports.SOLANA_CHAIN_ID = runtime_1.SOLANA_NATIVE_ASSET.chainId;
31
+ /**
32
+ * Zerion chain slug → numeric chain id. Slugs are Zerion's own vocabulary and do not always match
33
+ * the chain's common name — Gnosis is `xdai`, Metis is `metis-andromeda` — so an entry invented
34
+ * from the chain name silently drops every position on that chain, because the adapter skips any
35
+ * slug it cannot map. Every entry here is taken from Zerion's `GET /v1/chains/`.
36
+ */
37
+ const ZERION_CHAIN_IDS = {
38
+ ethereum: 1,
39
+ optimism: 10,
40
+ "binance-smart-chain": 56,
41
+ xdai: 100,
42
+ unichain: 130,
43
+ polygon: 137,
44
+ sonic: 146,
45
+ fantom: 250,
46
+ "zksync-era": 324,
47
+ world: 480,
48
+ hyperevm: 999,
49
+ "metis-andromeda": 1088,
50
+ "polygon-zkevm": 1101,
51
+ soneium: 1868,
52
+ ronin: 2020,
53
+ abstract: 2741,
54
+ robinhood: 4663,
55
+ mantle: 5000,
56
+ base: 8453,
57
+ mode: 34443,
58
+ arbitrum: 42161,
59
+ celo: 42220,
60
+ avalanche: 43114,
61
+ linea: 59144,
62
+ berachain: 80094,
63
+ blast: 81457,
64
+ taiko: 167000,
65
+ scroll: 534352,
66
+ zora: 7777777,
67
+ degen: 666666666,
68
+ aurora: 1313161554,
69
+ [exports.SOLANA_ZERION_SLUG]: exports.SOLANA_CHAIN_ID,
70
+ };
71
+ // Maps rather than objects: a slug arrives straight off the wire, and an object lookup resolves an
72
+ // inherited key like `constructor` or `toString` to something truthy instead of reporting the chain
73
+ // as unknown — which would carry a row past the `=== undefined` guard with a function as its id.
74
+ const CHAIN_ID_BY_ZERION_SLUG = new Map(Object.entries(ZERION_CHAIN_IDS));
75
+ const ZERION_SLUG_BY_CHAIN_ID = new Map(Object.entries(ZERION_CHAIN_IDS).map(([slug, id]) => [id, slug]));
76
+ function zerionSlugToChainId(slug) {
77
+ return CHAIN_ID_BY_ZERION_SLUG.get(slug);
78
+ }
79
+ function chainIdToZerionSlug(chainId) {
80
+ return ZERION_SLUG_BY_CHAIN_ID.get(chainId);
81
+ }
82
+ /**
83
+ * Zerion encodes a position's asset in the first hyphen-delimited segment of its resource `id`
84
+ * (`<assetRef>-<chainSlug>-<positionType>-…`). A chain's native coin uses the literal `base`
85
+ * (`base-polygon-asset-asset`); ERC-20s use the contract address
86
+ * (`0x1dd17…-ethereum-asset-asset`).
87
+ *
88
+ * This is the only reliable native signal. A falsy per-chain `implementation.address` looks
89
+ * equivalent and is not: Zerion reports Polygon's native coin at its `0x…1010` system contract and
90
+ * Celo's at a real ERC-20 address, while Polygon simultaneously carries a non-native fungible with
91
+ * the same `POL` symbol. Keying on the address shape misclassifies both.
92
+ */
93
+ function isNativePosition(id, impl) {
94
+ if (id?.startsWith("base-") === true)
95
+ return true;
96
+ // Second signal, for the chains that spell native as an absent address. It requires the
97
+ // implementation to EXIST: a fungible with no entry for this chain tells us nothing about what
98
+ // the row is, and calling that native would hand a value-bearing send an amount we cannot name.
99
+ return impl !== undefined && !impl.address;
100
+ }
101
+ function nativeTokenAddressForChain(slug) {
102
+ return slug === exports.SOLANA_ZERION_SLUG ? exports.SOLANA_NATIVE_TOKEN_ADDRESS : exports.EVM_NATIVE_TOKEN_ADDRESS;
103
+ }
104
+ /**
105
+ * Every spelling of "the chain's own coin" a caller might hold.
106
+ *
107
+ * A token record's address depends on where it came from — a quote provider, a token list, a URL
108
+ * parameter — and each source names the native coin differently. Matching a balance row against any
109
+ * single one of these silently fails for the others.
110
+ */
111
+ const NATIVE_TOKEN_MARKERS = new Set([
112
+ "native",
113
+ "0x0000000000000000000000000000000000000000",
114
+ exports.EVM_NATIVE_TOKEN_ADDRESS,
115
+ exports.SOLANA_NATIVE_TOKEN_ADDRESS.toLowerCase(),
116
+ "11111111111111111111111111111111",
117
+ ]);
118
+ /**
119
+ * Whether `balance` is the token identified by `tokenAddress`.
120
+ *
121
+ * Native coins are matched on the row's `is_native` flag rather than its printed address, because
122
+ * the caller and the adapter rarely spell the native coin the same way.
123
+ */
124
+ function balanceMatchesToken(balance, tokenAddress) {
125
+ const wanted = tokenAddress.toLowerCase();
126
+ if (NATIVE_TOKEN_MARKERS.has(wanted))
127
+ return balance.is_native;
128
+ // Case-insensitive only for hex contract addresses. Solana mints are base58, where case is
129
+ // significant — lowercasing them would let two distinct mints compare equal.
130
+ if (balance.chain === exports.SOLANA_ZERION_SLUG)
131
+ return balance.address === tokenAddress;
132
+ return balance.address.toLowerCase() === wanted;
133
+ }
134
+ /**
135
+ * Adapt raw Zerion positions into balance rows, dropping any row we cannot describe honestly.
136
+ *
137
+ * A row is dropped when its chain slug is absent or unmapped, or when neither the quantity nor the
138
+ * chain implementation carries decimals — an amount rendered against a guessed scale is a wrong
139
+ * number presented as a real one, which is worse for the reader than a missing row.
140
+ *
141
+ * @param slugToChainId overrides slug resolution; return undefined to skip a chain entirely.
142
+ */
143
+ function adaptZerionPositions(positions, slugToChainId = zerionSlugToChainId) {
144
+ const out = [];
145
+ for (const position of positions) {
146
+ const attributes = position.attributes ?? {};
147
+ const flags = attributes.flags;
148
+ if (flags && (flags.displayable === false || flags.is_trash === true))
149
+ continue;
150
+ const slug = position.relationships?.chain?.data?.id;
151
+ if (!slug)
152
+ continue;
153
+ const chainId = slugToChainId(slug);
154
+ if (chainId === undefined)
155
+ continue;
156
+ const fungibleInfo = attributes.fungible_info ?? {};
157
+ const implementation = (fungibleInfo.implementations ?? []).find(entry => entry.chain_id === slug);
158
+ const decimals = attributes.quantity?.decimals ?? implementation?.decimals;
159
+ if (decimals === undefined)
160
+ continue;
161
+ const isNative = isNativePosition(position.id, implementation);
162
+ // A non-native row with no contract address has no on-chain identity — drop it rather than
163
+ // render a holding nothing can name.
164
+ const address = isNative ? nativeTokenAddressForChain(slug) : implementation?.address;
165
+ if (!address)
166
+ continue;
167
+ // A quantity we cannot read is not a zero balance. Must be the base-10 integer `quantity.int`
168
+ // is: `null`, `""`, and any other unusable string all format to NaN, which callers coerce back
169
+ // to 0 and show as "holds none". `"0"` matches, so a real zero balance still comes through.
170
+ const amount = attributes.quantity?.int;
171
+ if (amount === undefined || !DECIMAL_INTEGER_PATTERN.test(amount))
172
+ continue;
173
+ out.push({
174
+ chain: slug,
175
+ chain_id: chainId,
176
+ address,
177
+ amount,
178
+ symbol: fungibleInfo.symbol ?? "",
179
+ decimals,
180
+ is_native: isNative,
181
+ name: fungibleInfo.name,
182
+ price_usd: attributes.price ?? undefined,
183
+ value_usd: attributes.value ?? undefined,
184
+ token_metadata: fungibleInfo.icon?.url ? { logo: fungibleInfo.icon.url } : undefined,
185
+ });
186
+ }
187
+ return out;
188
+ }
@@ -13,9 +13,11 @@ export declare const OPTIMISM_PUBLIC_RPC = "https://optimism-rpc.publicnode.com"
13
13
  export declare const POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
14
14
  export declare const AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
15
15
  export declare const BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
16
- export declare const B3_PUBLIC_RPC = "https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2/";
16
+ export declare const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun";
17
17
  export declare const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
18
18
  export declare const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
19
+ export declare const PLUME_PUBLIC_RPC = "https://rpc.plume.org";
20
+ export declare const ROBINHOOD_PUBLIC_RPC = "https://rpc.mainnet.chain.robinhood.com";
19
21
  /**
20
22
  * Map of chain IDs to their default public RPC URLs.
21
23
  */
@@ -15,9 +15,11 @@ export const POLYGON_PUBLIC_RPC = "https://polygon-bor-rpc.publicnode.com";
15
15
  export const AVALANCHE_PUBLIC_RPC = "https://avalanche-c-chain-rpc.publicnode.com";
16
16
  export const BSC_PUBLIC_RPC = "https://bsc-rpc.publicnode.com";
17
17
  // Chain-specific public endpoints
18
- export const B3_PUBLIC_RPC = "https://late-dimensional-yard.b3-mainnet.quiknode.pro/461dbdbd44158cd7a7a764a58ffb01a67eef77f2/";
18
+ export const B3_PUBLIC_RPC = "https://mainnet-rpc.b3.fun";
19
19
  export const ABSTRACT_PUBLIC_RPC = "https://api.mainnet.abs.xyz";
20
20
  export const HYPEREVM_PUBLIC_RPC = "https://rpc.hyperliquid.xyz/evm";
21
+ export const PLUME_PUBLIC_RPC = "https://rpc.plume.org";
22
+ export const ROBINHOOD_PUBLIC_RPC = "https://rpc.mainnet.chain.robinhood.com";
21
23
  /**
22
24
  * Map of chain IDs to their default public RPC URLs.
23
25
  */
@@ -32,4 +34,6 @@ export const PUBLIC_RPC_URLS = {
32
34
  8333: B3_PUBLIC_RPC, // B3
33
35
  2741: ABSTRACT_PUBLIC_RPC, // Abstract
34
36
  999: HYPEREVM_PUBLIC_RPC, // HyperEVM
37
+ 98866: PLUME_PUBLIC_RPC, // Plume Network
38
+ 4663: ROBINHOOD_PUBLIC_RPC, // Robinhood Chain
35
39
  };
@@ -20,7 +20,8 @@ export declare enum PanelView {
20
20
  FEE_DETAIL = 9,
21
21
  DIRECT_TRANSFER_SUCCESS = 10,
22
22
  FIAT_KYC = 11,
23
- FIAT_AUTH = 12
23
+ FIAT_AUTH = 12,
24
+ PURE_TRANSFER_ADDRESS = 13
24
25
  }
25
26
  export declare function AnySpend(props: {
26
27
  mode?: "page" | "modal";
@@ -28,6 +29,13 @@ export declare function AnySpend(props: {
28
29
  sourceChainId?: number;
29
30
  destinationTokenAddress?: string;
30
31
  destinationTokenChainId?: number;
32
+ /**
33
+ * When false, the destination token is user-selectable even if a default destination token is
34
+ * provided (the provided destination is used only as the initial/default value). Used by the
35
+ * wallet-funding deposit flow so the user can change the receive token away from the default
36
+ * (Base USDC). Defaults to true (locked buy-mode display, current behavior).
37
+ */
38
+ lockDestinationToken?: boolean;
31
39
  recipientAddress?: string;
32
40
  loadOrder?: string;
33
41
  hideTransactionHistoryButton?: boolean;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { eqci, getChainName, getDefaultToken, getExplorerTxUrl, getHyperliquidUSDCToken, HYPERLIQUID_CHAIN_ID, HYPERLIQUID_USDC_ADDRESS, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
3
+ import { eqci, getChainName, getDefaultToken, getExplorerTxUrl, getHyperliquidUSDCToken, isSameChainAndToken, HYPERLIQUID_CHAIN_ID, HYPERLIQUID_USDC_ADDRESS, USDC_BASE, ZERO_ADDRESS, } from "../../../anyspend/index.js";
4
4
  import { useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useGasPrice, useGeoOnrampOptions, } from "../../../anyspend/react/index.js";
5
5
  import { Button, ShinyButton, StyleRoot, TabsPrimitive, toast, TransitionPanel, useAccountWallet, useAuth, useAuthStore, useB3Config, useModalStore, useProfile, useRouter, useSearchParamsSSR, useTokenBalanceDirect, useTokenData, useTokenFromUrl, } from "../../../global-account/react/index.js";
6
6
  import BottomNavigation from "../../../global-account/react/components/ManageAccount/BottomNavigation.js";
@@ -35,6 +35,7 @@ import { LoginStep } from "../../../global-account/react/components/SignInWithB3
35
35
  import { PanelOnramp } from "./common/PanelOnramp.js";
36
36
  import { PanelOnrampPayment } from "./common/PanelOnrampPayment.js";
37
37
  import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
38
+ import { PureTransferView } from "./common/PureTransferView.js";
38
39
  import { RecipientSelection } from "./common/RecipientSelection.js";
39
40
  import { TabSection } from "./common/TabSection.js";
40
41
  import { AnySpendCustomizationProvider, useAnySpendCustomization } from "./context/AnySpendCustomizationContext.js";
@@ -54,13 +55,14 @@ export var PanelView;
54
55
  PanelView[PanelView["DIRECT_TRANSFER_SUCCESS"] = 10] = "DIRECT_TRANSFER_SUCCESS";
55
56
  PanelView[PanelView["FIAT_KYC"] = 11] = "FIAT_KYC";
56
57
  PanelView[PanelView["FIAT_AUTH"] = 12] = "FIAT_AUTH";
58
+ PanelView[PanelView["PURE_TRANSFER_ADDRESS"] = 13] = "PURE_TRANSFER_ADDRESS";
57
59
  })(PanelView || (PanelView = {}));
58
60
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
59
61
  export function AnySpend(props) {
60
62
  const fingerprintConfig = getFingerprintConfig();
61
63
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendCustomizationProvider, { slots: props.slots, content: props.content, theme: props.theme, children: _jsx(AnySpendInner, { ...props }) }) }));
62
64
  }
63
- function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, showFiatOption = true, }) {
65
+ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, lockDestinationToken = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, senderAddress, kycEnabled = false, showFiatOption = true, }) {
64
66
  const { slots, content } = useAnySpendCustomization();
65
67
  const searchParams = useSearchParamsSSR();
66
68
  const router = useRouter();
@@ -74,8 +76,10 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
74
76
  // in the same frame that onStatusResolved sets it (setState is async).
75
77
  // When kycEnabled is false (default), pre-approve so the KYC gate is skipped.
76
78
  const kycApprovedRef = useRef(!kycEnabled);
77
- // Determine if we're in "buy mode" based on whether destination token props are provided
78
- const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
79
+ // Determine if we're in "buy mode" based on whether destination token props are provided.
80
+ // When lockDestinationToken is false, the provided destination is only a default and the user
81
+ // can change the receive token, so we stay out of buy mode (selectable swap mode).
82
+ const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId) && lockDestinationToken;
79
83
  // Add refs to track URL state
80
84
  const initialUrlProcessed = useRef(false);
81
85
  const lastUrlUpdate = useRef(null);
@@ -135,9 +139,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
135
139
  useEffect(() => {
136
140
  sessionStorage.setItem("anyspend_fiat_method", selectedFiatPaymentMethod);
137
141
  }, [selectedFiatPaymentMethod]);
142
+ // Whether a default destination token was provided. When lockDestinationToken is false this is
143
+ // used only as the INITIAL/default value (the user can still change the receive token), so the
144
+ // wallet-funding deposit flow defaults to Base USDC but stays selectable.
145
+ const hasProvidedDestination = !!(destinationTokenAddress && destinationTokenChainId);
138
146
  // Get initial chain IDs from URL or defaults
139
147
  const initialSrcChainId = sourceChainId || parseInt(searchParams.get("fromChainId") || "0") || mainnet.id;
140
- const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") || (isBuyMode ? destinationTokenChainId : base.id);
148
+ const initialDstChainId = parseInt(searchParams.get("toChainId") || "0") ||
149
+ (isBuyMode ? destinationTokenChainId : hasProvidedDestination ? destinationTokenChainId : base.id);
141
150
  // State for source chain/token selection
142
151
  const [selectedSrcChainId, setSelectedSrcChainId] = useState(initialSrcChainId);
143
152
  const defaultSrcToken = getDefaultToken(selectedSrcChainId);
@@ -174,19 +183,25 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
174
183
  });
175
184
  // Helper to check if address is Hyperliquid USDC (supports both 34-char and 42-char formats)
176
185
  const isHyperliquidUSDCAddress = (address) => eqci(address, HYPERLIQUID_USDC_ADDRESS) || eqci(address, ZERO_ADDRESS);
177
- const defaultDstToken = isBuyMode
178
- ? // Special case: Hyperliquid uses zero address for USDC
179
- destinationTokenChainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
180
- ? getHyperliquidUSDCToken()
181
- : {
182
- symbol: "",
183
- chainId: destinationTokenChainId,
184
- address: destinationTokenAddress,
185
- name: "",
186
- decimals: 18,
187
- metadata: {},
188
- }
189
- : getDefaultToken(selectedDstChainId);
186
+ // Build a token object from the provided destination props (handles the Hyperliquid USDC special case).
187
+ // The inline truthiness check lets TypeScript narrow both props to non-null, so it is `undefined`
188
+ // unless both props are provided — i.e. only meaningful when hasProvidedDestination/isBuyMode is true.
189
+ const providedDstToken = destinationTokenChainId && destinationTokenAddress
190
+ ? destinationTokenChainId === HYPERLIQUID_CHAIN_ID && isHyperliquidUSDCAddress(destinationTokenAddress)
191
+ ? getHyperliquidUSDCToken()
192
+ : {
193
+ symbol: "",
194
+ chainId: destinationTokenChainId,
195
+ address: destinationTokenAddress,
196
+ name: "",
197
+ decimals: 18,
198
+ metadata: {},
199
+ }
200
+ : undefined;
201
+ // In buy mode the provided destination is locked. Otherwise, if a default destination was provided
202
+ // (selectable deposit flow) seed it as the default; falling back to the chain's default token only
203
+ // when no destination prop is given (standard swap mode).
204
+ const defaultDstToken = (isBuyMode || hasProvidedDestination) && providedDstToken ? providedDstToken : getDefaultToken(selectedDstChainId);
190
205
  const dstTokenFromUrl = useTokenFromUrl({
191
206
  defaultToken: defaultDstToken,
192
207
  prefix: "to",
@@ -433,7 +448,10 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
433
448
  walletAddress,
434
449
  globalAddress,
435
450
  });
436
- const recipientProfile = useProfile({ address: effectiveRecipientAddress, fresh: true });
451
+ const recipientProfile = useProfile({
452
+ address: effectiveRecipientAddress,
453
+ fresh: true,
454
+ });
437
455
  const recipientName = recipientProfile.data?.name;
438
456
  // Check token balance for crypto payments
439
457
  const effectiveBalanceAddress = senderAddress || connectedEOAWallet?.getAccount()?.address;
@@ -539,12 +557,15 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
539
557
  anyspendQuote.data.currencyOut?.amount &&
540
558
  anyspendQuote.data.currencyOut?.currency?.decimals) {
541
559
  if (isSrcInputDirty) {
542
- // Don't override dstAmount if we have a fixed destinationTokenAmount
543
- if (!destinationTokenAmount) {
544
- const amount = anyspendQuote.data.currencyOut.amount;
545
- const decimals = anyspendQuote.data.currencyOut.currency.decimals;
546
- setDstAmount(formatTokenAmount(BigInt(amount), decimals, 6, false));
547
- }
560
+ // The user is driving the SOURCE (exact-in): reflect the quote's OUTPUT even
561
+ // when a fixed destinationTokenAmount pre-filled the receive. That lock only
562
+ // governs the INITIAL exact-out state (untouched source → compute the pay for
563
+ // the fixed receive). Once the user edits the pay, keeping the receive pinned
564
+ // shows a value that doesn't match the quote — the URL amount "overrides" the
565
+ // real output, an invalid mismatched swap.
566
+ const amount = anyspendQuote.data.currencyOut.amount;
567
+ const decimals = anyspendQuote.data.currencyOut.currency.decimals;
568
+ setDstAmount(formatTokenAmount(BigInt(amount), decimals, 6, false));
548
569
  }
549
570
  else {
550
571
  const amount = anyspendQuote.data.currencyIn.amount;
@@ -554,16 +575,13 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
554
575
  }
555
576
  else {
556
577
  if (isSrcInputDirty) {
557
- // Don't reset dstAmount if we have a fixed destinationTokenAmount
558
- if (!destinationTokenAmount) {
559
- setDstAmount("");
560
- }
578
+ setDstAmount("");
561
579
  }
562
580
  else {
563
581
  setSrcAmount("");
564
582
  }
565
583
  }
566
- }, [anyspendQuote, isSrcInputDirty, destinationTokenAmount]);
584
+ }, [anyspendQuote, isSrcInputDirty]);
567
585
  // Call onSuccess when order is executed
568
586
  useOnOrderSuccess({ orderData: oat, orderId, onSuccess });
569
587
  // Clear all persisted selection state once an order is submitted — next open starts fresh
@@ -624,8 +642,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
624
642
  // Check if it's a same-chain same-token swap
625
643
  const isSameChainSameToken = useMemo(() => {
626
644
  return (activeTab === "crypto" &&
627
- selectedSrcChainId === selectedDstChainId &&
628
- selectedSrcToken.address.toLowerCase() === selectedDstToken.address.toLowerCase());
645
+ isSameChainAndToken(selectedSrcChainId, selectedSrcToken.address, selectedDstChainId, selectedDstToken.address));
629
646
  }, [activeTab, selectedSrcChainId, selectedDstChainId, selectedSrcToken.address, selectedDstToken.address]);
630
647
  // Check if this is a direct transfer (same chain/token with allowDirectTransfer enabled)
631
648
  const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
@@ -634,11 +651,26 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
634
651
  // For fiat tab, check srcAmountOnRamp; for crypto tab, check activeInputAmountInWei
635
652
  const hasAmount = activeTab === "fiat" ? srcAmountOnRamp && parseFloat(srcAmountOnRamp) > 0 : activeInputAmountInWei !== "0";
636
653
  if (!hasAmount)
637
- return { text: "Enter an amount", disable: true, error: false, loading: false };
654
+ return {
655
+ text: "Enter an amount",
656
+ disable: true,
657
+ error: false,
658
+ loading: false,
659
+ };
638
660
  if (isSameChainSameToken && !allowDirectTransfer)
639
- return { text: "Select a different token or chain", disable: true, error: false, loading: false };
661
+ return {
662
+ text: "Select a different token or chain",
663
+ disable: true,
664
+ error: false,
665
+ loading: false,
666
+ };
640
667
  if (isLoadingAnyspendQuote && !isSameChainSameToken)
641
- return { text: "Loading quote...", disable: true, error: false, loading: true };
668
+ return {
669
+ text: "Loading quote...",
670
+ disable: true,
671
+ error: false,
672
+ loading: true,
673
+ };
642
674
  if (isCreatingOrder || isCreatingOnrampOrder || isSwitchingOrExecuting)
643
675
  return {
644
676
  text: isSwitchingOrExecuting ? "Transferring..." : "Creating order...",
@@ -647,14 +679,29 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
647
679
  loading: true,
648
680
  };
649
681
  if ((!anyspendQuote || !anyspendQuote.success) && !(isSameChainSameToken && allowDirectTransfer))
650
- return { text: "No quote found", disable: true, error: false, loading: false };
682
+ return {
683
+ text: "No quote found",
684
+ disable: true,
685
+ error: false,
686
+ loading: false,
687
+ };
651
688
  if (activeTab === "fiat") {
652
689
  // For fiat: check recipient first, then payment method
653
690
  if (!effectiveRecipientAddress)
654
- return { text: "Select recipient", disable: false, error: false, loading: false };
691
+ return {
692
+ text: "Select recipient",
693
+ disable: false,
694
+ error: false,
695
+ loading: false,
696
+ };
655
697
  // If no fiat payment method selected, show "Select payment method"
656
698
  if (selectedFiatPaymentMethod === FiatPaymentMethod.NONE) {
657
- return { text: "Select payment method", disable: false, error: false, loading: false };
699
+ return {
700
+ text: "Select payment method",
701
+ disable: false,
702
+ error: false,
703
+ loading: false,
704
+ };
658
705
  }
659
706
  // If payment method is selected, show "Continue"
660
707
  return { text: "Continue", disable: false, error: false, loading: false };
@@ -663,19 +710,40 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
663
710
  // For crypto: check payment method first, then recipient
664
711
  // If no payment method selected, show "Choose payment method"
665
712
  if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.NONE) {
666
- return { text: "Choose payment method", disable: false, error: false, loading: false };
713
+ return {
714
+ text: "Choose payment method",
715
+ disable: false,
716
+ error: false,
717
+ loading: false,
718
+ };
667
719
  }
668
720
  // Check recipient after payment method
669
721
  if (!effectiveRecipientAddress)
670
- return { text: "Select recipient", disable: false, error: false, loading: false };
722
+ return {
723
+ text: "Select recipient",
724
+ disable: false,
725
+ error: false,
726
+ loading: false,
727
+ };
671
728
  // If payment method selected, show appropriate action
672
729
  if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
673
730
  effectiveCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
674
731
  const buttonText = isSameChainSameToken && allowDirectTransfer ? "Transfer" : "Swap";
675
- return { text: buttonText, disable: false, error: false, loading: false };
732
+ return {
733
+ text: buttonText,
734
+ disable: false,
735
+ error: false,
736
+ loading: false,
737
+ };
676
738
  }
677
739
  if (effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
678
- return { text: "Continue to payment", disable: false, error: false, loading: false };
740
+ const transferText = isSameChainSameToken && allowDirectTransfer ? "Show deposit address" : "Continue to payment";
741
+ return {
742
+ text: transferText,
743
+ disable: false,
744
+ error: false,
745
+ loading: false,
746
+ };
679
747
  }
680
748
  }
681
749
  return { text: "Continue", disable: false, error: false, loading: false };
@@ -767,8 +835,14 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
767
835
  // Handle crypto swap creation
768
836
  const handleCryptoSwap = async (method) => {
769
837
  try {
770
- const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
838
+ // TRANSFER_CRYPTO is the manual deposit-address flow — no connected wallet to send from.
839
+ const isDirectTransfer = isSameChainSameToken && allowDirectTransfer && method !== CryptoPaymentMethodType.TRANSFER_CRYPTO;
771
840
  invariant(effectiveRecipientAddress, "Recipient address is not found");
841
+ // Same-token manual deposit → show recipient address + watch, no relayer order, no fee
842
+ if (isSameChainSameToken && allowDirectTransfer && method === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
843
+ navigateToPanel(PanelView.PURE_TRANSFER_ADDRESS, "forward");
844
+ return;
845
+ }
772
846
  const srcAmountBigInt = parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals);
773
847
  // Handle direct transfer (same chain/token) - bypass backend, transfer directly
774
848
  if (isDirectTransfer) {
@@ -787,9 +861,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
787
861
  }
788
862
  // Regular swap flow - use backend
789
863
  invariant(anyspendQuote, "Relay price is not found");
790
- // Debug: Check payment method values
791
- console.log("handleCryptoSwap - method parameter:", method);
792
- console.log("handleCryptoSwap - selectedCryptoPaymentMethod state:", selectedCryptoPaymentMethod);
793
864
  createOrder({
794
865
  recipientAddress: effectiveRecipientAddress,
795
866
  orderType: "swap",
@@ -797,7 +868,11 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
797
868
  dstChain: isBuyMode ? destinationTokenChainId : selectedDstChainId,
798
869
  srcToken: selectedSrcToken,
799
870
  dstToken: isBuyMode
800
- ? { ...selectedDstToken, chainId: destinationTokenChainId, address: destinationTokenAddress }
871
+ ? {
872
+ ...selectedDstToken,
873
+ chainId: destinationTokenChainId,
874
+ address: destinationTokenAddress,
875
+ }
801
876
  : selectedDstToken,
802
877
  srcAmount: srcAmountBigInt.toString(),
803
878
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount || "0",
@@ -1114,6 +1189,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
1114
1189
  const authView = (_jsx("div", { className: "mx-auto w-full max-w-[460px]", children: _jsx(LoginStep, { chain: baseChain, onSuccess: async () => {
1115
1190
  // isAuthenticated will be true at this point — the useEffect below handles navigation
1116
1191
  } }) }));
1192
+ const pureTransferAddressView = (_jsx(PureTransferView, { mode: mode, recipientAddress: effectiveRecipientAddress ?? "", chainId: selectedSrcChainId, token: selectedSrcToken, displayAmount: srcAmount && srcAmount !== "0" ? `${srcAmount} ${selectedSrcToken.symbol}` : undefined, isActive: activePanel === PanelView.PURE_TRANSFER_ADDRESS, onBack: navigateBack, onClose: () => setB3ModalOpen(false), onTransferDetected: () => onSuccess?.() }));
1117
1193
  // Add tabs to the main component when no order is loaded
1118
1194
  return (_jsx(StyleRoot, { children: _jsx("div", { className: classes?.container ||
1119
1195
  cn("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
@@ -1149,5 +1225,6 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
1149
1225
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: directTransferSuccessView }, "direct-transfer-success-view"),
1150
1226
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: kycView }, "fiat-kyc-view"),
1151
1227
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: authView }, "fiat-auth-view"),
1228
+ _jsx("div", { className: cn(mode === "page" && "p-6"), children: pureTransferAddressView }, "pure-transfer-address-view"),
1152
1229
  ] }) }) }));
1153
1230
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { getChainName, getExplorerTxUrl } from "../../../anyspend/index.js";
3
3
  import { useGasPrice } from "../../../anyspend/react/index.js";
4
- import { normalizeAddress } from "../../../anyspend/utils/index.js";
4
+ import { isSameChainAndToken, normalizeAddress } from "../../../anyspend/utils/index.js";
5
5
  import { Button, ShinyButton, StyleRoot, toast, TransitionPanel, useAccountWallet, useModalStore, } from "../../../global-account/react/index.js";
6
6
  import { cn } from "../../../shared/utils/cn.js";
7
7
  import { formatUnits } from "../../../shared/utils/number.js";
@@ -61,15 +61,10 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
61
61
  // Check if source and destination are the same token on the same chain
62
62
  const isSameChainSameToken = useMemo(() => {
63
63
  return (effectivePaymentType === "crypto" &&
64
- selectedSrcChainId === selectedDstChainId &&
65
- selectedSrcToken?.address?.toLowerCase() === selectedDstToken?.address?.toLowerCase());
66
- }, [
67
- effectivePaymentType,
68
- selectedSrcChainId,
69
- selectedDstChainId,
70
- selectedSrcToken?.address,
71
- selectedDstToken?.address,
72
- ]);
64
+ selectedSrcToken != null &&
65
+ selectedDstToken != null &&
66
+ isSameChainAndToken(selectedSrcChainId, selectedSrcToken.address, selectedDstChainId, selectedDstToken.address));
67
+ }, [effectivePaymentType, selectedSrcChainId, selectedDstChainId, selectedSrcToken, selectedDstToken]);
73
68
  // Check if this is a direct transfer
74
69
  const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
75
70
  // State for direct transfer success
@@ -248,7 +243,10 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
248
243
  cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) })) }), gasPriceData && !isLoadingGas && effectivePaymentType === "crypto" && !isDirectTransfer && (_jsx(GasIndicator, { gasPrice: gasPriceData, className: classes?.gasIndicator || "mt-2 w-full" })), mainFooter ? mainFooter : null] }));
249
244
  const handleCryptoOrder = async () => {
250
245
  try {
251
- const isDirectTransfer = isSameChainSameToken && allowDirectTransfer;
246
+ // TRANSFER_CRYPTO is the manual deposit-address flow — no connected wallet to send from.
247
+ const isDirectTransfer = isSameChainSameToken &&
248
+ allowDirectTransfer &&
249
+ effectiveCryptoPaymentMethod !== CryptoPaymentMethodType.TRANSFER_CRYPTO;
252
250
  if (!isDirectTransfer) {
253
251
  invariant(anyspendQuote, "Relay price is not found");
254
252
  }