@b3dotfun/sdk 0.0.23 → 0.0.24

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 (252) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +5 -8
  2. package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
  3. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +35 -28
  4. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -4
  5. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +35 -28
  6. package/dist/cjs/anyspend/react/components/common/Accordion.d.ts +7 -0
  7. package/dist/cjs/anyspend/react/components/common/Accordion.js +53 -0
  8. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +3 -22
  9. package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  10. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +76 -83
  11. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +1 -1
  12. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -3
  13. package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -5
  14. package/dist/cjs/anyspend/react/components/common/StepProgress.js +2 -2
  15. package/dist/cjs/anyspend/react/components/common/TokenBalance.js +1 -1
  16. package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
  17. package/dist/cjs/anyspend/react/hooks/useGeoOnrampOptions.js +2 -4
  18. package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +2 -2
  19. package/dist/cjs/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
  20. package/dist/cjs/anyspend/react/hooks/useStripeSupport.js +0 -1
  21. package/dist/cjs/anyspend/utils/chain.js +1 -1
  22. package/dist/cjs/bondkit/abis/BondkitTokenABI.d.ts +1020 -0
  23. package/dist/cjs/bondkit/abis/BondkitTokenABI.js +1332 -0
  24. package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.d.ts +391 -0
  25. package/dist/cjs/bondkit/abis/BondkitTokenFactoryABI.js +514 -0
  26. package/dist/cjs/bondkit/abis/index.d.ts +2 -0
  27. package/dist/cjs/bondkit/abis/index.js +18 -0
  28. package/dist/cjs/bondkit/bondkitToken.d.ts +68 -0
  29. package/dist/cjs/bondkit/bondkitToken.js +456 -0
  30. package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +60 -0
  31. package/dist/cjs/bondkit/bondkitTokenFactory.js +274 -0
  32. package/dist/cjs/bondkit/components/TradingView.d.ts +3 -0
  33. package/dist/cjs/bondkit/components/TradingView.js +296 -0
  34. package/dist/cjs/bondkit/components/config/cdn.d.ts +42 -0
  35. package/dist/cjs/bondkit/components/config/cdn.js +63 -0
  36. package/dist/cjs/bondkit/components/index.d.ts +5 -0
  37. package/dist/cjs/bondkit/components/index.js +25 -0
  38. package/dist/cjs/bondkit/components/types.d.ts +8 -0
  39. package/dist/cjs/bondkit/components/types.js +5 -0
  40. package/dist/cjs/bondkit/components/utils/cdn-loader.d.ts +24 -0
  41. package/dist/cjs/bondkit/components/utils/cdn-loader.js +73 -0
  42. package/dist/cjs/bondkit/components/utils/format.d.ts +4 -0
  43. package/dist/cjs/bondkit/components/utils/format.js +31 -0
  44. package/dist/cjs/bondkit/config.d.ts +10 -0
  45. package/dist/cjs/bondkit/config.js +18 -0
  46. package/dist/cjs/bondkit/constants.d.ts +3 -0
  47. package/dist/cjs/bondkit/constants.js +5 -0
  48. package/dist/cjs/bondkit/index.d.ts +7 -0
  49. package/dist/cjs/bondkit/index.js +33 -0
  50. package/dist/cjs/bondkit/json_abis/BondkitABI.json +1329 -0
  51. package/dist/cjs/bondkit/json_abis/BondkitFactoryABI.json +511 -0
  52. package/dist/cjs/bondkit/json_abis/index.d.ts +3 -0
  53. package/dist/cjs/bondkit/json_abis/index.js +10 -0
  54. package/dist/cjs/bondkit/json_abis/index.ts +4 -0
  55. package/dist/cjs/bondkit/types.d.ts +77 -0
  56. package/dist/cjs/bondkit/types.js +11 -0
  57. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -1
  58. package/dist/cjs/global-account/react/components/MintButton/MintButton.js +0 -1
  59. package/dist/cjs/global-account/react/components/SendERC20Button/SendERC20Button.d.ts +13 -0
  60. package/dist/cjs/global-account/react/components/SendERC20Button/SendERC20Button.js +33 -0
  61. package/dist/cjs/global-account/react/components/SendETHButton/SendETHButton.d.ts +12 -0
  62. package/dist/cjs/global-account/react/components/SendETHButton/SendETHButton.js +23 -0
  63. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +4 -2
  64. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
  65. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  66. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  67. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  68. package/dist/cjs/global-account/react/components/index.d.ts +2 -0
  69. package/dist/cjs/global-account/react/components/index.js +8 -2
  70. package/dist/cjs/global-account/react/components/ui/scroll-area.js +1 -1
  71. package/dist/cjs/global-account/react/components/ui/tooltip.d.ts +1 -1
  72. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -1
  73. package/dist/cjs/global-account/react/hooks/index.js +18 -3
  74. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +8 -0
  75. package/dist/cjs/global-account/react/hooks/useAuthentication.js +4 -4
  76. package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.d.ts +1 -2
  77. package/dist/cjs/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
  78. package/dist/cjs/global-account/react/hooks/useFirstEOA.js +9 -7
  79. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +11 -0
  80. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +160 -0
  81. package/dist/cjs/shared/constants/chains/supported.d.ts +4 -0
  82. package/dist/cjs/shared/constants/chains/supported.js +11 -0
  83. package/dist/cjs/shared/generated/chain-networks.json +1 -1
  84. package/dist/esm/anyspend/react/components/AnySpend.js +5 -8
  85. package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
  86. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +37 -30
  87. package/dist/esm/anyspend/react/components/AnySpendCustom.js +4 -4
  88. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +37 -30
  89. package/dist/esm/anyspend/react/components/common/Accordion.d.ts +7 -0
  90. package/dist/esm/anyspend/react/components/common/Accordion.js +14 -0
  91. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +3 -22
  92. package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
  93. package/dist/esm/anyspend/react/components/common/OrderDetails.js +79 -86
  94. package/dist/esm/anyspend/react/components/common/OrderStatus.js +1 -1
  95. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +5 -4
  96. package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -5
  97. package/dist/esm/anyspend/react/components/common/StepProgress.js +2 -2
  98. package/dist/esm/anyspend/react/components/common/TokenBalance.js +1 -1
  99. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
  100. package/dist/esm/anyspend/react/hooks/useGeoOnrampOptions.js +2 -4
  101. package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +2 -2
  102. package/dist/esm/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
  103. package/dist/esm/anyspend/react/hooks/useStripeSupport.js +0 -1
  104. package/dist/esm/anyspend/utils/chain.js +1 -1
  105. package/dist/esm/bondkit/abis/BondkitTokenABI.d.ts +1020 -0
  106. package/dist/esm/bondkit/abis/BondkitTokenABI.js +1329 -0
  107. package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.d.ts +391 -0
  108. package/dist/esm/bondkit/abis/BondkitTokenFactoryABI.js +511 -0
  109. package/dist/esm/bondkit/abis/index.d.ts +2 -0
  110. package/dist/esm/bondkit/abis/index.js +2 -0
  111. package/dist/esm/bondkit/bondkitToken.d.ts +68 -0
  112. package/dist/esm/bondkit/bondkitToken.js +452 -0
  113. package/dist/esm/bondkit/bondkitTokenFactory.d.ts +60 -0
  114. package/dist/esm/bondkit/bondkitTokenFactory.js +270 -0
  115. package/dist/esm/bondkit/components/TradingView.d.ts +3 -0
  116. package/dist/esm/bondkit/components/TradingView.js +294 -0
  117. package/dist/esm/bondkit/components/config/cdn.d.ts +42 -0
  118. package/dist/esm/bondkit/components/config/cdn.js +55 -0
  119. package/dist/esm/bondkit/components/index.d.ts +5 -0
  120. package/dist/esm/bondkit/components/index.js +4 -0
  121. package/dist/esm/bondkit/components/types.d.ts +8 -0
  122. package/dist/esm/bondkit/components/types.js +4 -0
  123. package/dist/esm/bondkit/components/utils/cdn-loader.d.ts +24 -0
  124. package/dist/esm/bondkit/components/utils/cdn-loader.js +66 -0
  125. package/dist/esm/bondkit/components/utils/format.d.ts +4 -0
  126. package/dist/esm/bondkit/components/utils/format.js +28 -0
  127. package/dist/esm/bondkit/config.d.ts +10 -0
  128. package/dist/esm/bondkit/config.js +14 -0
  129. package/dist/esm/bondkit/constants.d.ts +3 -0
  130. package/dist/esm/bondkit/constants.js +2 -0
  131. package/dist/esm/bondkit/index.d.ts +7 -0
  132. package/dist/esm/bondkit/index.js +12 -0
  133. package/dist/esm/bondkit/json_abis/BondkitABI.json +1329 -0
  134. package/dist/esm/bondkit/json_abis/BondkitFactoryABI.json +511 -0
  135. package/dist/esm/bondkit/json_abis/index.d.ts +3 -0
  136. package/dist/esm/bondkit/json_abis/index.js +3 -0
  137. package/dist/esm/bondkit/json_abis/index.ts +4 -0
  138. package/dist/esm/bondkit/types.d.ts +77 -0
  139. package/dist/esm/bondkit/types.js +8 -0
  140. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
  141. package/dist/esm/global-account/react/components/MintButton/MintButton.js +0 -1
  142. package/dist/esm/global-account/react/components/SendERC20Button/SendERC20Button.d.ts +13 -0
  143. package/dist/esm/global-account/react/components/SendERC20Button/SendERC20Button.js +30 -0
  144. package/dist/esm/global-account/react/components/SendETHButton/SendETHButton.d.ts +12 -0
  145. package/dist/esm/global-account/react/components/SendETHButton/SendETHButton.js +20 -0
  146. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -2
  147. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -2
  148. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  149. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  150. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  151. package/dist/esm/global-account/react/components/index.d.ts +2 -0
  152. package/dist/esm/global-account/react/components/index.js +4 -0
  153. package/dist/esm/global-account/react/components/ui/scroll-area.js +1 -1
  154. package/dist/esm/global-account/react/components/ui/tooltip.d.ts +1 -1
  155. package/dist/esm/global-account/react/hooks/index.d.ts +2 -1
  156. package/dist/esm/global-account/react/hooks/index.js +2 -1
  157. package/dist/esm/global-account/react/hooks/useAccountWallet.js +8 -0
  158. package/dist/esm/global-account/react/hooks/useAuthentication.js +4 -4
  159. package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.d.ts +1 -2
  160. package/dist/esm/global-account/react/hooks/useChainSwitchWithAction.js +2 -2
  161. package/dist/esm/global-account/react/hooks/useFirstEOA.js +9 -7
  162. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +11 -0
  163. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +154 -0
  164. package/dist/esm/shared/constants/chains/supported.d.ts +4 -0
  165. package/dist/esm/shared/constants/chains/supported.js +10 -0
  166. package/dist/esm/shared/generated/chain-networks.json +1 -1
  167. package/dist/styles/index.css +1 -1
  168. package/dist/types/anyspend/react/components/common/Accordion.d.ts +7 -0
  169. package/dist/types/anyspend/react/hooks/useGeoOnrampOptions.d.ts +0 -1
  170. package/dist/types/anyspend/react/hooks/useSigMint.d.ts +2 -2
  171. package/dist/types/anyspend/react/hooks/useStripeSupport.d.ts +0 -1
  172. package/dist/types/bondkit/abis/BondkitTokenABI.d.ts +1020 -0
  173. package/dist/types/bondkit/abis/BondkitTokenFactoryABI.d.ts +391 -0
  174. package/dist/types/bondkit/abis/index.d.ts +2 -0
  175. package/dist/types/bondkit/bondkitToken.d.ts +68 -0
  176. package/dist/types/bondkit/bondkitTokenFactory.d.ts +60 -0
  177. package/dist/types/bondkit/components/TradingView.d.ts +3 -0
  178. package/dist/types/bondkit/components/config/cdn.d.ts +42 -0
  179. package/dist/types/bondkit/components/index.d.ts +5 -0
  180. package/dist/types/bondkit/components/types.d.ts +8 -0
  181. package/dist/types/bondkit/components/utils/cdn-loader.d.ts +24 -0
  182. package/dist/types/bondkit/components/utils/format.d.ts +4 -0
  183. package/dist/types/bondkit/config.d.ts +10 -0
  184. package/dist/types/bondkit/constants.d.ts +3 -0
  185. package/dist/types/bondkit/index.d.ts +7 -0
  186. package/dist/types/bondkit/json_abis/index.d.ts +3 -0
  187. package/dist/types/bondkit/types.d.ts +77 -0
  188. package/dist/types/global-account/react/components/SendERC20Button/SendERC20Button.d.ts +13 -0
  189. package/dist/types/global-account/react/components/SendETHButton/SendETHButton.d.ts +12 -0
  190. package/dist/types/global-account/react/components/index.d.ts +2 -0
  191. package/dist/types/global-account/react/components/ui/tooltip.d.ts +1 -1
  192. package/dist/types/global-account/react/hooks/index.d.ts +2 -1
  193. package/dist/types/global-account/react/hooks/useChainSwitchWithAction.d.ts +1 -2
  194. package/dist/types/global-account/react/hooks/useUnifiedChainSwitchAndExecute.d.ts +11 -0
  195. package/dist/types/shared/constants/chains/supported.d.ts +4 -0
  196. package/package.json +42 -7
  197. package/src/anyspend/react/components/AnySpend.tsx +5 -23
  198. package/src/anyspend/react/components/AnySpendBondKit.tsx +2 -2
  199. package/src/anyspend/react/components/AnySpendBuySpin.tsx +42 -32
  200. package/src/anyspend/react/components/AnySpendCustom.tsx +7 -13
  201. package/src/anyspend/react/components/AnySpendStakeB3.tsx +44 -34
  202. package/src/anyspend/react/components/common/Accordion.tsx +56 -0
  203. package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +0 -25
  204. package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +1 -2
  205. package/src/anyspend/react/components/common/OrderDetails.tsx +292 -260
  206. package/src/anyspend/react/components/common/OrderStatus.tsx +1 -1
  207. package/src/anyspend/react/components/common/PanelOnramp.tsx +7 -7
  208. package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +0 -6
  209. package/src/anyspend/react/components/common/StepProgress.tsx +2 -2
  210. package/src/anyspend/react/components/common/TokenBalance.tsx +3 -3
  211. package/src/anyspend/react/hooks/useGeoOnrampOptions.ts +2 -4
  212. package/src/anyspend/react/hooks/useStripeSupport.ts +0 -1
  213. package/src/anyspend/utils/chain.ts +1 -1
  214. package/src/bondkit/abis/BondkitTokenABI.ts +1329 -0
  215. package/src/bondkit/abis/BondkitTokenFactoryABI.ts +511 -0
  216. package/src/bondkit/abis/index.ts +2 -0
  217. package/src/bondkit/bondkitToken.ts +539 -0
  218. package/src/bondkit/bondkitTokenFactory.ts +336 -0
  219. package/src/bondkit/components/TradingView.tsx +341 -0
  220. package/src/bondkit/components/config/cdn.ts +63 -0
  221. package/src/bondkit/components/index.ts +5 -0
  222. package/src/bondkit/components/types.ts +9 -0
  223. package/src/bondkit/components/utils/cdn-loader.ts +77 -0
  224. package/src/bondkit/components/utils/format.ts +36 -0
  225. package/src/bondkit/config.ts +26 -0
  226. package/src/bondkit/constants.ts +5 -0
  227. package/src/bondkit/index.ts +16 -0
  228. package/src/bondkit/json_abis/BondkitABI.json +1329 -0
  229. package/src/bondkit/json_abis/BondkitFactoryABI.json +511 -0
  230. package/src/bondkit/json_abis/index.ts +4 -0
  231. package/src/bondkit/types.ts +98 -0
  232. package/src/global-account/react/components/B3DynamicModal.tsx +2 -1
  233. package/src/global-account/react/components/MintButton/MintButton.tsx +0 -1
  234. package/src/global-account/react/components/SendERC20Button/SendERC20Button.tsx +57 -0
  235. package/src/global-account/react/components/SendETHButton/SendETHButton.tsx +37 -0
  236. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +21 -22
  237. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +2 -2
  238. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +1 -1
  239. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  240. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  241. package/src/global-account/react/components/index.ts +6 -0
  242. package/src/global-account/react/components/ui/scroll-area.tsx +2 -2
  243. package/src/global-account/react/components/ui/tooltip.tsx +1 -1
  244. package/src/global-account/react/hooks/index.ts +2 -1
  245. package/src/global-account/react/hooks/useAccountWallet.tsx +10 -1
  246. package/src/global-account/react/hooks/useAuthentication.ts +4 -4
  247. package/src/global-account/react/hooks/useChainSwitchWithAction.ts +3 -4
  248. package/src/global-account/react/hooks/useFirstEOA.tsx +10 -7
  249. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +186 -0
  250. package/src/shared/constants/chains/supported.ts +11 -0
  251. package/src/shared/generated/chain-networks.json +1 -1
  252. package/src/styles/index.css +27 -0
@@ -2,7 +2,6 @@
2
2
 
3
3
  import {
4
4
  ALL_CHAINS,
5
- EVM_CHAINS,
6
5
  getChainName,
7
6
  getErrorDisplay,
8
7
  getExplorerTxUrl,
@@ -22,9 +21,9 @@ import {
22
21
  TextLoop,
23
22
  TextShimmer,
24
23
  useAccountWallet,
25
- useChainSwitchWithAction,
26
24
  useModalStore,
27
25
  useProfile,
26
+ useUnifiedChainSwitchAndExecute,
28
27
  } from "@b3dotfun/sdk/global-account/react";
29
28
  import { useRouter, useSearchParams } from "@b3dotfun/sdk/shared/react/hooks";
30
29
  import { cn } from "@b3dotfun/sdk/shared/utils";
@@ -44,10 +43,10 @@ import { QRCodeSVG } from "qrcode.react";
44
43
  import { memo, useCallback, useEffect, useMemo, useState } from "react";
45
44
  import TimeAgo from "react-timeago";
46
45
  import { toast } from "sonner";
47
- import { Address } from "thirdweb";
48
- import { erc20Abi, WalletClient } from "viem";
46
+ import { encodeFunctionData, erc20Abi } from "viem";
49
47
  import { b3 } from "viem/chains";
50
48
  import { useWaitForTransactionReceipt, useWalletClient } from "wagmi";
49
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./Accordion";
51
50
  import ConnectWalletPayment from "./ConnectWalletPayment";
52
51
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
53
52
  import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
@@ -228,7 +227,7 @@ export const OrderDetails = memo(function OrderDetails({
228
227
  const [showQRCode, setShowQRCode] = useState(false);
229
228
  const { isLoading: txLoading, isSuccess: txSuccess } = useWaitForTransactionReceipt({ hash: txHash });
230
229
 
231
- const { switchChainAndExecute, isSwitchingOrExecuting } = useChainSwitchWithAction();
230
+ const { switchChainAndExecute, isSwitchingOrExecuting } = useUnifiedChainSwitchAndExecute();
232
231
 
233
232
  const { colorMode } = useColorMode();
234
233
 
@@ -242,45 +241,33 @@ export const OrderDetails = memo(function OrderDetails({
242
241
  return roundTokenAmount(formattedSrcAmount);
243
242
  }, [order.srcAmount, srcToken]);
244
243
 
245
- // This function handles the actual payment process
246
- const handlePaymentProcess = useCallback(
247
- async (currentWalletClient: WalletClient) => {
248
- if (!currentWalletClient || !currentWalletClient?.chain?.id) {
249
- toast.error("Please connect your wallet");
250
- return;
251
- }
244
+ // Unified payment handler for both EOA and AA wallets
245
+ const handleUnifiedPaymentProcess = useCallback(async () => {
246
+ let txData: `0x${string}` | undefined;
247
+ let value: bigint;
248
+ let to: `0x${string}`;
252
249
 
253
- console.log("Processing transaction on chain:", currentWalletClient.chain.id);
250
+ if (isNativeToken(order.srcTokenAddress)) {
251
+ // Native token transfer
252
+ to = order.globalAddress as `0x${string}`;
253
+ value = BigInt(order.srcAmount);
254
+ } else {
255
+ // ERC20 token transfer - encode the transfer function call using proper ABI
256
+ txData = encodeFunctionData({
257
+ abi: erc20Abi,
258
+ functionName: "transfer",
259
+ args: [order.globalAddress as `0x${string}`, BigInt(order.srcAmount)],
260
+ });
261
+ to = order.srcTokenAddress as `0x${string}`;
262
+ value = BigInt(0);
263
+ }
254
264
 
255
- const signer = currentWalletClient.account;
256
- if (!signer) {
257
- toast.error("No account connected");
258
- return;
259
- }
265
+ const txHash = await switchChainAndExecute(order.srcChain, { to, data: txData, value });
260
266
 
261
- // Send transaction
262
- if (isNativeToken(order.srcTokenAddress)) {
263
- const hash = await currentWalletClient.sendTransaction({
264
- account: signer,
265
- chain: EVM_CHAINS[order.srcChain].viem,
266
- to: order.globalAddress as `0x${string}`,
267
- value: BigInt(order.srcAmount),
268
- });
269
- setTxHash(hash);
270
- } else {
271
- const hash = await currentWalletClient.writeContract({
272
- account: signer,
273
- chain: EVM_CHAINS[order.srcChain].viem,
274
- address: order.srcTokenAddress as `0x${string}`,
275
- abi: erc20Abi,
276
- functionName: "transfer",
277
- args: [order.globalAddress as Address, BigInt(order.srcAmount)],
278
- });
279
- setTxHash(hash);
280
- }
281
- },
282
- [order],
283
- );
267
+ if (txHash) {
268
+ setTxHash(txHash as `0x${string}`);
269
+ }
270
+ }, [order, switchChainAndExecute]);
284
271
 
285
272
  // Main payment handler that triggers chain switch and payment
286
273
  const handlePayment = async () => {
@@ -288,7 +275,8 @@ export const OrderDetails = memo(function OrderDetails({
288
275
  if (order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID) {
289
276
  await initiatePhantomTransfer(order.srcAmount, order.srcTokenAddress, order.globalAddress);
290
277
  } else {
291
- await switchChainAndExecute(order.srcChain, handlePaymentProcess);
278
+ // Use unified payment process for both EOA and AA wallets
279
+ await handleUnifiedPaymentProcess();
292
280
  }
293
281
  };
294
282
 
@@ -546,42 +534,57 @@ export const OrderDetails = memo(function OrderDetails({
546
534
  if (refundTxs) {
547
535
  return (
548
536
  <>
549
- <div className="relative mt-4 flex w-full flex-col gap-4">
550
- <div className="bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2">
551
- <motion.div
552
- className="from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent"
553
- initial={{ height: "0%" }}
554
- animate={{ height: "100%" }}
555
- transition={{ duration: 1.5, ease: "easeInOut" }}
556
- ></motion.div>
557
- </div>
558
- {depositTxs
559
- ? depositTxs.map(dTx => (
560
- <TransactionDetails
561
- key={dTx.txHash}
562
- title={
563
- order.onrampMetadata?.vendor === "stripe-web2"
564
- ? `Received payment`
565
- : `Received ${formatTokenAmount(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`
566
- }
567
- chainId={order.srcChain}
568
- tx={dTx}
569
- isProcessing={false}
570
- />
571
- ))
572
- : null}
573
- {refundTxs
574
- ? refundTxs.map(rTx => (
575
- <TransactionDetails
576
- key={rTx.txHash}
577
- title={`Refunded ${formatTokenAmount(BigInt(rTx.amount), srcToken.decimals)} ${srcToken.symbol}`}
578
- chainId={order.srcChain}
579
- tx={rTx}
580
- isProcessing={false}
581
- />
582
- ))
583
- : null}
584
- </div>
537
+ <OrderDetailsCollapsible
538
+ order={order}
539
+ dstToken={dstToken}
540
+ tournament={tournament}
541
+ nft={nft}
542
+ recipientName={recipientName}
543
+ formattedExpectedDstAmount={formattedExpectedDstAmount}
544
+ />
545
+ <Accordion type="single" collapsible className="w-full">
546
+ <AccordionItem value="refund-details">
547
+ <AccordionTrigger>Transaction Details</AccordionTrigger>
548
+ <AccordionContent>
549
+ <div className="relative flex w-full flex-col gap-4">
550
+ <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
551
+ <motion.div
552
+ className="bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]"
553
+ initial={{ height: "0%" }}
554
+ animate={{ height: "100%" }}
555
+ transition={{ duration: 1.5, ease: "easeInOut" }}
556
+ ></motion.div>
557
+ </div>
558
+ {depositTxs
559
+ ? depositTxs.map(dTx => (
560
+ <TransactionDetails
561
+ key={dTx.txHash}
562
+ title={
563
+ order.onrampMetadata?.vendor === "stripe-web2"
564
+ ? `Received payment`
565
+ : `Received ${formatTokenAmount(BigInt(dTx.amount), srcToken.decimals)} ${srcToken.symbol}`
566
+ }
567
+ chainId={order.srcChain}
568
+ tx={dTx}
569
+ isProcessing={false}
570
+ />
571
+ ))
572
+ : null}
573
+ {refundTxs
574
+ ? refundTxs.map(rTx => (
575
+ <TransactionDetails
576
+ key={rTx.txHash}
577
+ title={`Refunded ${formatTokenAmount(BigInt(rTx.amount), srcToken.decimals)} ${srcToken.symbol}`}
578
+ chainId={order.srcChain}
579
+ tx={rTx}
580
+ isProcessing={false}
581
+ />
582
+ ))
583
+ : null}
584
+ </div>
585
+ </AccordionContent>
586
+ </AccordionItem>
587
+ </Accordion>
585
588
  {order.errorDetails && (
586
589
  <div className="flex justify-center">
587
590
  <span className="text-as-primary/50 text-center text-sm" style={{ maxWidth: "40ch" }}>
@@ -608,55 +611,70 @@ export const OrderDetails = memo(function OrderDetails({
608
611
  if (executeTx) {
609
612
  return (
610
613
  <>
611
- <div className="relative mt-4 flex w-full flex-col gap-4">
612
- <div className="bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2">
613
- <motion.div
614
- className="from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent"
615
- initial={{ height: "0%" }}
616
- animate={{ height: "100%" }}
617
- transition={{ duration: 1.5, ease: "easeInOut" }}
618
- ></motion.div>
619
- </div>
620
- {depositTxs
621
- ? depositTxs.map(dTxs => (
614
+ <OrderDetailsCollapsible
615
+ order={order}
616
+ dstToken={dstToken}
617
+ tournament={tournament}
618
+ nft={nft}
619
+ recipientName={recipientName}
620
+ formattedExpectedDstAmount={formattedExpectedDstAmount}
621
+ />
622
+ <Accordion type="single" collapsible className="w-full">
623
+ <AccordionItem value="execute-details">
624
+ <AccordionTrigger>Transaction Details</AccordionTrigger>
625
+ <AccordionContent>
626
+ <div className="relative flex w-full flex-col gap-4">
627
+ <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
628
+ <motion.div
629
+ className="bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]"
630
+ initial={{ height: "0%" }}
631
+ animate={{ height: "100%" }}
632
+ transition={{ duration: 1.5, ease: "easeInOut" }}
633
+ ></motion.div>
634
+ </div>
635
+ {depositTxs
636
+ ? depositTxs.map(dTxs => (
637
+ <TransactionDetails
638
+ key={dTxs.txHash}
639
+ title={
640
+ order.onrampMetadata?.vendor === "stripe-web2"
641
+ ? `Received payment`
642
+ : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`
643
+ }
644
+ chainId={order.srcChain}
645
+ tx={dTxs}
646
+ isProcessing={false}
647
+ />
648
+ ))
649
+ : null}
650
+ <TransactionDetails
651
+ title="Processed Transaction"
652
+ chainId={order.srcChain}
653
+ tx={relayTx}
654
+ delay={0.5}
655
+ isProcessing={false}
656
+ />
622
657
  <TransactionDetails
623
- key={dTxs.txHash}
624
658
  title={
625
- order.onrampMetadata?.vendor === "stripe-web2"
626
- ? `Received payment`
627
- : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`
659
+ order.type === "swap"
660
+ ? "Processed Swap"
661
+ : order.type === "mint_nft"
662
+ ? "Minted NFT"
663
+ : order.type === "join_tournament"
664
+ ? "Joined Tournament"
665
+ : order.type === "fund_tournament"
666
+ ? "Funded Tournament"
667
+ : "Processed Order"
628
668
  }
629
- chainId={order.srcChain}
630
- tx={dTxs}
669
+ chainId={order.dstChain}
670
+ tx={executeTx}
631
671
  isProcessing={false}
672
+ delay={1}
632
673
  />
633
- ))
634
- : null}
635
- <TransactionDetails
636
- title="Processed Transaction"
637
- chainId={order.srcChain}
638
- tx={relayTx}
639
- delay={0.5}
640
- isProcessing={false}
641
- />
642
- <TransactionDetails
643
- title={
644
- order.type === "swap"
645
- ? "Processed Swap"
646
- : order.type === "mint_nft"
647
- ? "Minted NFT"
648
- : order.type === "join_tournament"
649
- ? "Joined Tournament"
650
- : order.type === "fund_tournament"
651
- ? "Funded Tournament"
652
- : "Processed Order"
653
- }
654
- chainId={order.dstChain}
655
- tx={executeTx}
656
- isProcessing={false}
657
- delay={1}
658
- />
659
- </div>
674
+ </div>
675
+ </AccordionContent>
676
+ </AccordionItem>
677
+ </Accordion>
660
678
  <div className="flex w-full flex-col gap-8">
661
679
  <Button variant="link" asChild>
662
680
  <a
@@ -720,78 +738,85 @@ export const OrderDetails = memo(function OrderDetails({
720
738
  recipientName={recipientName}
721
739
  formattedExpectedDstAmount={formattedExpectedDstAmount}
722
740
  />
723
- <div className="relative mt-4 flex w-full flex-col gap-4">
724
- <div className="bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2">
725
- <motion.div
726
- className="from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent"
727
- initial={{ height: "0%" }}
728
- animate={{ height: "100%" }}
729
- transition={{ duration: 1.5, ease: "easeInOut" }}
730
- ></motion.div>
731
- </div>
732
- {depositTxs
733
- ? depositTxs.map(dTxs => (
734
- <TransactionDetails
735
- key={dTxs.txHash}
736
- title={
737
- order.onrampMetadata?.vendor === "stripe-web2"
738
- ? `Received payment`
739
- : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`
740
- }
741
- chainId={order.srcChain}
742
- tx={dTxs}
743
- isProcessing={false}
744
- />
745
- ))
746
- : null}
747
- {/* If the source and destination chains are the same, AnySpend doesn't have executeTransaction */}
748
- {order.srcChain === order.dstChain ? (
749
- <TransactionDetails
750
- title={
751
- order.type === "swap"
752
- ? "Processed Swap"
753
- : order.type === "mint_nft"
754
- ? "Minted NFT"
755
- : order.type === "join_tournament"
756
- ? "Joined Tournament"
757
- : order.type === "fund_tournament"
758
- ? "Funded Tournament"
759
- : "Processed Transaction"
760
- }
761
- chainId={order.srcChain}
762
- isProcessing={false}
763
- tx={relayTx}
764
- delay={0.5}
765
- />
766
- ) : (
767
- <>
768
- <TransactionDetails
769
- title="Processed Transaction"
770
- chainId={order.srcChain}
771
- isProcessing={false}
772
- tx={relayTx}
773
- delay={0.5}
774
- />
775
- <TransactionDetails
776
- title={
777
- order.type === "swap"
778
- ? "Processing Swap"
779
- : order.type === "mint_nft"
780
- ? "Minting NFT"
781
- : order.type === "join_tournament"
782
- ? "Joining Tournament"
783
- : order.type === "fund_tournament"
784
- ? "Funding Tournament"
785
- : "Processing Bridge"
786
- }
787
- chainId={order.dstChain}
788
- isProcessing={true}
789
- tx={executeTx}
790
- delay={1}
791
- />
792
- </>
793
- )}
794
- </div>
741
+ <Accordion type="single" collapsible className="w-full">
742
+ <AccordionItem value="more-details">
743
+ <AccordionTrigger>More Details</AccordionTrigger>
744
+ <AccordionContent>
745
+ <div className="relative flex w-full flex-col gap-4">
746
+ <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
747
+ <motion.div
748
+ className="bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]"
749
+ initial={{ height: "0%" }}
750
+ animate={{ height: "100%" }}
751
+ transition={{ duration: 1.5, ease: "easeInOut" }}
752
+ ></motion.div>
753
+ </div>
754
+ {depositTxs
755
+ ? depositTxs.map(dTxs => (
756
+ <TransactionDetails
757
+ key={dTxs.txHash}
758
+ title={
759
+ order.onrampMetadata?.vendor === "stripe-web2"
760
+ ? `Received payment`
761
+ : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`
762
+ }
763
+ chainId={order.srcChain}
764
+ tx={dTxs}
765
+ isProcessing={false}
766
+ />
767
+ ))
768
+ : null}
769
+ {/* If the source and destination chains are the same, AnySpend doesn't have executeTransaction */}
770
+ {order.srcChain === order.dstChain ? (
771
+ <TransactionDetails
772
+ title={
773
+ order.type === "swap"
774
+ ? "Processed Swap"
775
+ : order.type === "mint_nft"
776
+ ? "Minted NFT"
777
+ : order.type === "join_tournament"
778
+ ? "Joined Tournament"
779
+ : order.type === "fund_tournament"
780
+ ? "Funded Tournament"
781
+ : "Processed Transaction"
782
+ }
783
+ chainId={order.srcChain}
784
+ isProcessing={false}
785
+ tx={relayTx}
786
+ delay={0.5}
787
+ />
788
+ ) : (
789
+ <>
790
+ <TransactionDetails
791
+ title="Processed Transaction"
792
+ chainId={order.srcChain}
793
+ isProcessing={false}
794
+ tx={relayTx}
795
+ delay={0.5}
796
+ />
797
+ <TransactionDetails
798
+ title={
799
+ order.type === "swap"
800
+ ? "Processing Swap"
801
+ : order.type === "mint_nft"
802
+ ? "Minting NFT"
803
+ : order.type === "join_tournament"
804
+ ? "Joining Tournament"
805
+ : order.type === "fund_tournament"
806
+ ? "Funding Tournament"
807
+ : "Processing Bridge"
808
+ }
809
+ chainId={order.dstChain}
810
+ isProcessing={true}
811
+ tx={executeTx}
812
+ delay={1}
813
+ />
814
+ </>
815
+ )}
816
+ </div>
817
+ </AccordionContent>
818
+ </AccordionItem>
819
+ </Accordion>
795
820
 
796
821
  <div className="flex w-full flex-col gap-8">
797
822
  <Button variant="link" asChild>
@@ -858,68 +883,75 @@ export const OrderDetails = memo(function OrderDetails({
858
883
  recipientName={recipientName}
859
884
  formattedExpectedDstAmount={formattedExpectedDstAmount}
860
885
  />
861
- <div className="relative mt-4 flex w-full flex-col gap-6">
862
- <div className="bg-b3-react-background absolute bottom-2 left-4 top-2 z-[5] w-2">
863
- <motion.div
864
- className="from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent"
865
- initial={{ height: "0%" }}
866
- animate={{ height: "100%" }}
867
- transition={{ duration: 1, ease: "easeInOut" }}
868
- ></motion.div>
869
- </div>
870
- {(depositTxs || []).map((dTxs, index) => (
871
- <TransactionDetails
872
- key={dTxs.txHash}
873
- title={
874
- order.onrampMetadata?.vendor === "stripe-web2"
875
- ? `Received payment`
876
- : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`
877
- }
878
- chainId={order.srcChain}
879
- tx={dTxs}
880
- isProcessing={index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount}
881
- />
882
- ))}
883
- {statusDisplay === "failure" ? (
884
- <TransactionDetails
885
- title={statusText}
886
- chainId={order.srcChain}
887
- tx={null}
888
- isProcessing={false}
889
- delay={0.5}
890
- />
891
- ) : depositEnoughAmount ? (
892
- <TransactionDetails
893
- title={
894
- order.type === "swap"
895
- ? "Processing Swap"
896
- : order.type === "mint_nft"
897
- ? "Minting NFT"
898
- : order.type === "join_tournament"
899
- ? "Joining Tournament"
900
- : order.type === "fund_tournament"
901
- ? "Funding Tournament"
902
- : "Processing Transaction"
903
- }
904
- chainId={order.srcChain}
905
- tx={null}
906
- isProcessing={true}
907
- delay={0.5}
908
- />
909
- ) : (
910
- <TransactionDetails
911
- title={
912
- order.onrampMetadata?.vendor === "stripe-web2"
913
- ? `Waiting for payment`
914
- : `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`
915
- }
916
- chainId={order.srcChain}
917
- tx={null}
918
- isProcessing={true}
919
- delay={0.5}
920
- />
921
- )}
922
- </div>
886
+ <Accordion type="single" collapsible className="w-full">
887
+ <AccordionItem value="deposit-details">
888
+ <AccordionTrigger>Transaction Details</AccordionTrigger>
889
+ <AccordionContent>
890
+ <div className="relative flex w-full flex-col gap-6">
891
+ <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
892
+ <motion.div
893
+ className="from-as-brand/50 absolute left-[2px] top-0 z-10 w-[3px] bg-gradient-to-b from-20% via-purple-500/50 via-80% to-transparent"
894
+ initial={{ height: "0%" }}
895
+ animate={{ height: "100%" }}
896
+ transition={{ duration: 1, ease: "easeInOut" }}
897
+ ></motion.div>
898
+ </div>
899
+ {(depositTxs || []).map((dTxs, index) => (
900
+ <TransactionDetails
901
+ key={dTxs.txHash}
902
+ title={
903
+ order.onrampMetadata?.vendor === "stripe-web2"
904
+ ? `Received payment`
905
+ : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`
906
+ }
907
+ chainId={order.srcChain}
908
+ tx={dTxs}
909
+ isProcessing={index < (depositTxs || []).length - 1 ? false : !depositEnoughAmount}
910
+ />
911
+ ))}
912
+ {statusDisplay === "failure" ? (
913
+ <TransactionDetails
914
+ title={statusText}
915
+ chainId={order.srcChain}
916
+ tx={null}
917
+ isProcessing={false}
918
+ delay={0.5}
919
+ />
920
+ ) : depositEnoughAmount ? (
921
+ <TransactionDetails
922
+ title={
923
+ order.type === "swap"
924
+ ? "Processing Swap"
925
+ : order.type === "mint_nft"
926
+ ? "Minting NFT"
927
+ : order.type === "join_tournament"
928
+ ? "Joining Tournament"
929
+ : order.type === "fund_tournament"
930
+ ? "Funding Tournament"
931
+ : "Processing Transaction"
932
+ }
933
+ chainId={order.srcChain}
934
+ tx={null}
935
+ isProcessing={true}
936
+ delay={0.5}
937
+ />
938
+ ) : (
939
+ <TransactionDetails
940
+ title={
941
+ order.onrampMetadata?.vendor === "stripe-web2"
942
+ ? `Waiting for payment`
943
+ : `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`
944
+ }
945
+ chainId={order.srcChain}
946
+ tx={null}
947
+ isProcessing={true}
948
+ delay={0.5}
949
+ />
950
+ )}
951
+ </div>
952
+ </AccordionContent>
953
+ </AccordionItem>
954
+ </Accordion>
923
955
 
924
956
  {/* <DelayedSupportMessage /> */}
925
957
  </>
@@ -1140,13 +1172,13 @@ function TransactionDetails({
1140
1172
  return (
1141
1173
  <div className={"relative flex w-full flex-1 items-center justify-between gap-4"}>
1142
1174
  <div className="flex grow items-center gap-4">
1143
- <motion.div className="bg-b3-react-background relative h-10 w-10 rounded-full">
1175
+ <motion.div className="bg-as-surface-secondary relative h-10 w-10 rounded-full">
1144
1176
  {isProcessing ? (
1145
1177
  <motion.div
1146
1178
  initial={{ opacity: 0, scale: 0.3 }}
1147
1179
  animate={{ opacity: 1, scale: 1 }}
1148
1180
  transition={{ duration: 0.5, ease: "easeInOut", delay }}
1149
- className="absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 shadow-lg backdrop-blur-sm"
1181
+ className="border-as-border-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border-2 shadow-lg backdrop-blur-sm"
1150
1182
  >
1151
1183
  <Loader2 className="text-as-primary h-4 w-4 animate-spin" />
1152
1184
  </motion.div>
@@ -1155,9 +1187,9 @@ function TransactionDetails({
1155
1187
  initial={{ opacity: 0, scale: 0.3 }}
1156
1188
  animate={{ opacity: 1, scale: 1 }}
1157
1189
  transition={{ duration: 0.5, ease: "easeOut", delay }}
1158
- className="bg-as-brand/70 absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm"
1190
+ className="bg-as-success-secondary absolute z-10 m-2 flex h-6 w-6 items-center justify-center rounded-full border border-white/30 shadow-lg backdrop-blur-sm"
1159
1191
  >
1160
- <CheckIcon className="text-as-primary h-3 w-3" />
1192
+ <CheckIcon className="text-as-content-icon-success h-4 w-4" />
1161
1193
  </motion.div>
1162
1194
  )}
1163
1195
  </motion.div>