@b3dotfun/sdk 0.0.33 → 0.0.34-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +2 -2
  2. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
  3. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +5 -36
  5. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  6. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +25 -0
  7. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  8. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +65 -60
  9. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
  10. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
  11. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +4 -2
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  14. package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  15. package/dist/cjs/anyspend/types/api.d.ts +130 -14
  16. package/dist/cjs/anyspend/utils/chain.js +1 -1
  17. package/dist/cjs/anyspend/utils/format.js +1 -0
  18. package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
  19. package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -4
  20. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +14 -0
  21. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  22. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +17 -1
  23. package/dist/cjs/global-account/react/components/index.d.ts +8 -9
  24. package/dist/cjs/global-account/react/components/index.js +25 -28
  25. package/dist/cjs/global-account/react/index.native.d.ts +2 -1
  26. package/dist/cjs/global-account/react/index.native.js +5 -3
  27. package/dist/cjs/global-account/react/stores/index.d.ts +1 -1
  28. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -22
  29. package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
  30. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  31. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  32. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
  33. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  34. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +22 -0
  35. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  36. package/dist/esm/anyspend/react/components/common/OrderDetails.js +48 -43
  37. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  38. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
  39. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +4 -2
  40. package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  41. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  42. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  43. package/dist/esm/anyspend/types/api.d.ts +130 -14
  44. package/dist/esm/anyspend/utils/chain.js +1 -1
  45. package/dist/esm/anyspend/utils/format.js +1 -0
  46. package/dist/esm/anyspend/utils/orderPayload.js +7 -0
  47. package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -4
  48. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +11 -0
  49. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  50. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +17 -1
  51. package/dist/esm/global-account/react/components/index.d.ts +8 -9
  52. package/dist/esm/global-account/react/components/index.js +8 -10
  53. package/dist/esm/global-account/react/index.native.d.ts +2 -1
  54. package/dist/esm/global-account/react/index.native.js +2 -1
  55. package/dist/esm/global-account/react/stores/index.d.ts +1 -1
  56. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -22
  57. package/dist/styles/index.css +1 -1
  58. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  59. package/dist/types/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  60. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  61. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -4
  62. package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  63. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  64. package/dist/types/anyspend/types/api.d.ts +130 -14
  65. package/dist/types/global-account/react/components/index.d.ts +8 -9
  66. package/dist/types/global-account/react/index.native.d.ts +2 -1
  67. package/dist/types/global-account/react/stores/index.d.ts +1 -1
  68. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -22
  69. package/package.json +2 -4
  70. package/src/anyspend/react/components/AnySpend.tsx +2 -1
  71. package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
  72. package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
  73. package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +144 -0
  74. package/src/anyspend/react/components/common/OrderDetails.tsx +95 -71
  75. package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
  76. package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -3
  77. package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
  78. package/src/anyspend/types/api.ts +131 -11
  79. package/src/anyspend/utils/chain.ts +1 -1
  80. package/src/anyspend/utils/format.ts +1 -0
  81. package/src/anyspend/utils/orderPayload.ts +7 -0
  82. package/src/global-account/react/components/B3DynamicModal.tsx +0 -4
  83. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +10 -0
  84. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +6 -6
  85. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +17 -1
  86. package/src/global-account/react/components/index.ts +13 -16
  87. package/src/global-account/react/index.native.ts +2 -1
  88. package/src/global-account/react/stores/index.ts +1 -2
  89. package/src/global-account/react/stores/useModalStore.ts +1 -23
  90. package/dist/cjs/global-account/react/components/Transak/TransakModal.d.ts +0 -1
  91. package/dist/cjs/global-account/react/components/Transak/TransakModal.js +0 -110
  92. package/dist/esm/global-account/react/components/Transak/TransakModal.d.ts +0 -1
  93. package/dist/esm/global-account/react/components/Transak/TransakModal.js +0 -104
  94. package/dist/types/global-account/react/components/Transak/TransakModal.d.ts +0 -1
  95. package/src/global-account/react/components/Transak/TransakModal.tsx +0 -131
@@ -0,0 +1,144 @@
1
+ "use client";
2
+
3
+ import {
4
+ ALL_CHAINS,
5
+ getChainName,
6
+ getPaymentUrl,
7
+ RELAY_ETH_ADDRESS,
8
+ RELAY_SOLANA_MAINNET_CHAIN_ID,
9
+ } from "@b3dotfun/sdk/anyspend";
10
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
11
+ import { Badge, CopyToClipboard, ShinyButton, TextLoop } from "@b3dotfun/sdk/global-account/react";
12
+ import { cn } from "@b3dotfun/sdk/shared/utils";
13
+ import { b3 } from "viem/chains";
14
+
15
+ import { formatUnits } from "@b3dotfun/sdk/shared/utils/number";
16
+ import { WalletCoinbase, WalletMetamask, WalletPhantom, WalletTrust } from "@web3icons/react";
17
+ import { ChevronRight, Copy, Loader2 } from "lucide-react";
18
+ import { motion } from "motion/react";
19
+ import { QRCodeSVG } from "qrcode.react";
20
+ import { toast } from "sonner";
21
+
22
+ interface InsufficientDepositPaymentProps {
23
+ order: components["schemas"]["Order"];
24
+ srcToken: components["schemas"]["Token"];
25
+ depositDeficit: bigint;
26
+ phantomWalletAddress: string | null;
27
+ txLoading: boolean;
28
+ isSwitchingOrExecuting: boolean;
29
+ onPayment: () => Promise<void>;
30
+ }
31
+
32
+ export function InsufficientDepositPayment({
33
+ order,
34
+ srcToken,
35
+ depositDeficit,
36
+ phantomWalletAddress,
37
+ txLoading,
38
+ isSwitchingOrExecuting,
39
+ onPayment,
40
+ }: InsufficientDepositPaymentProps) {
41
+ const depositDeficitAmount = formatUnits(depositDeficit.toString(), srcToken.decimals);
42
+ return (
43
+ <div className="insufficient-deposit-payment relative flex w-full flex-1 flex-col">
44
+ <div className="flex flex-col gap-1">
45
+ <span className="insufficient-deposit-payment-text text-as-primary/50">Please send remaining</span>
46
+ <div className="flex w-full flex-wrap items-center gap-6 sm:justify-between sm:gap-0">
47
+ <CopyToClipboard
48
+ text={depositDeficitAmount}
49
+ onCopy={() => {
50
+ toast.success("Copied to clipboard");
51
+ }}
52
+ >
53
+ <div className="flex items-center gap-2">
54
+ <strong className="border-as-brand text-as-primary border-b-2 pb-1 text-2xl font-semibold sm:text-xl">
55
+ {depositDeficitAmount} {srcToken.symbol}
56
+ </strong>
57
+ <Copy className="text-as-primary/50 hover:text-as-primary h-5 w-5 cursor-pointer transition-all duration-200" />
58
+ </div>
59
+ </CopyToClipboard>
60
+
61
+ <Badge variant="outline" className="flex h-10 items-center gap-2 px-3 py-1 pr-2 text-sm">
62
+ on {getChainName(order.srcChain)}
63
+ <img
64
+ src={ALL_CHAINS[order.srcChain].logoUrl}
65
+ alt={getChainName(order.srcChain)}
66
+ className={cn("h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none")}
67
+ />
68
+ </Badge>
69
+ </div>
70
+ <span className={"text-as-primary/50 mb-1 mt-2"}> to the address:</span>
71
+ </div>
72
+ <CopyToClipboard
73
+ text={order.globalAddress}
74
+ onCopy={() => {
75
+ toast.success("Copied to clipboard");
76
+ }}
77
+ >
78
+ <div className="payment-address bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200">
79
+ <div className="text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm">
80
+ {order.globalAddress}
81
+ </div>
82
+ <Copy className="group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" />
83
+ </div>
84
+ </CopyToClipboard>
85
+
86
+ <div className="payment-buttons mt-4 flex w-full flex-col items-center gap-2">
87
+ <ShinyButton
88
+ accentColor={"hsl(var(--as-brand))"}
89
+ textColor="text-white"
90
+ className="flex w-5/6 max-w-[400px] items-center gap-2 sm:px-0"
91
+ disabled={txLoading || isSwitchingOrExecuting}
92
+ onClick={onPayment}
93
+ >
94
+ {txLoading ? (
95
+ <>
96
+ Transaction Pending
97
+ <Loader2 className="ml-2 h-5 w-5 animate-spin" />
98
+ </>
99
+ ) : (
100
+ <>
101
+ <span className="whitespace-nowrap pl-4 text-lg md:text-sm">
102
+ {order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
103
+ ? "Pay from Phantom Wallet"
104
+ : "Pay from Connected Wallet"}
105
+ </span>
106
+ <ChevronRight className="h-4 w-4" />
107
+ </>
108
+ )}
109
+ </ShinyButton>
110
+
111
+ <div>Or</div>
112
+
113
+ <motion.div
114
+ initial={{ opacity: 0, filter: "blur(10px)" }}
115
+ animate={{ opacity: 1, filter: "blur(0px)" }}
116
+ transition={{ duration: 0.5, ease: "easeInOut" }}
117
+ className="flex w-full items-center justify-evenly gap-4"
118
+ >
119
+ <div className="qr-code flex flex-col items-center rounded-lg pb-3">
120
+ <QRCodeSVG
121
+ value={getPaymentUrl(
122
+ order.globalAddress,
123
+ BigInt(depositDeficit),
124
+ order.srcTokenAddress === RELAY_ETH_ADDRESS ? srcToken?.symbol || "ETH" : order.srcTokenAddress,
125
+ order.srcChain,
126
+ srcToken?.decimals,
127
+ )}
128
+ className="max-w-[200px]"
129
+ />
130
+ <div className="mt-3 flex items-center justify-center gap-2 text-sm">
131
+ <span className="label-style text-as-brand/70 text-sm">Scan with</span>
132
+ <TextLoop interval={3}>
133
+ <WalletMetamask className="h-5 w-5" variant="branded" />
134
+ <WalletCoinbase className="h-5 w-5" variant="branded" />
135
+ <WalletPhantom className="h-5 w-5" variant="branded" />
136
+ <WalletTrust className="h-5 w-5" variant="branded" />
137
+ </TextLoop>
138
+ </div>
139
+ </div>
140
+ </motion.div>
141
+ </div>
142
+ </div>
143
+ );
144
+ }
@@ -22,6 +22,7 @@ import {
22
22
  TextLoop,
23
23
  TextShimmer,
24
24
  useAccountWallet,
25
+ useB3,
25
26
  useModalStore,
26
27
  useProfile,
27
28
  useUnifiedChainSwitchAndExecute,
@@ -30,7 +31,7 @@ import { useRouter, useSearchParams } from "@b3dotfun/sdk/shared/react/hooks";
30
31
  import { cn } from "@b3dotfun/sdk/shared/utils";
31
32
  import centerTruncate from "@b3dotfun/sdk/shared/utils/centerTruncate";
32
33
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
33
- import { useColorMode } from "@chakra-ui/react";
34
+
34
35
  import {
35
36
  createAssociatedTokenAccountInstruction,
36
37
  createTransferCheckedInstruction,
@@ -50,6 +51,7 @@ import { useWaitForTransactionReceipt, useWalletClient } from "wagmi";
50
51
  import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./Accordion";
51
52
  import ConnectWalletPayment from "./ConnectWalletPayment";
52
53
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
54
+ import { InsufficientDepositPayment } from "./InsufficientDepositPayment";
53
55
  import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
54
56
  import PaymentVendorUI from "./PaymentVendorUI";
55
57
  import { TransferCryptoDetails } from "./TransferCryptoDetails";
@@ -57,10 +59,10 @@ import { TransferCryptoDetails } from "./TransferCryptoDetails";
57
59
  interface OrderDetailsProps {
58
60
  mode?: "modal" | "page";
59
61
  order: components["schemas"]["Order"];
60
- depositTxs: components["schemas"]["DepositTx"][] | null;
61
- relayTx: components["schemas"]["RelayTx"] | null;
62
+ depositTxs: components["schemas"]["DepositTx"][];
63
+ relayTxs: components["schemas"]["RelayTx"][];
62
64
  executeTx: components["schemas"]["ExecuteTx"] | null;
63
- refundTxs: components["schemas"]["RefundTx"][] | null;
65
+ refundTxs: components["schemas"]["RefundTx"][];
64
66
  cryptoPaymentMethod?: CryptoPaymentMethodType; // Now optional since we read from URL
65
67
  onBack?: () => void;
66
68
  disableUrlParamManagement?: boolean; // When true, will not modify URL parameters
@@ -104,6 +106,9 @@ function getOrderSuccessText({
104
106
  }
105
107
  actionText = order.metadata.action || `executed contract`;
106
108
  return `Successfully ${actionText}`;
109
+ case "hype_duel":
110
+ actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
111
+ return `Successfully ${actionText} to ${recipient}`;
107
112
  default:
108
113
  throw new Error("Invalid order type");
109
114
  }
@@ -198,7 +203,7 @@ export const OrderDetails = memo(function OrderDetails({
198
203
  mode = "modal",
199
204
  order,
200
205
  depositTxs,
201
- relayTx,
206
+ relayTxs,
202
207
  executeTx,
203
208
  refundTxs,
204
209
  cryptoPaymentMethod,
@@ -208,6 +213,10 @@ export const OrderDetails = memo(function OrderDetails({
208
213
  const router = useRouter();
209
214
  const searchParams = useSearchParams();
210
215
 
216
+ // Get theme from B3Provider context
217
+ const { theme } = useB3();
218
+ const colorMode = theme || "light";
219
+
211
220
  // Read crypto payment method from URL parameters
212
221
  const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod") as CryptoPaymentMethodType | null;
213
222
  const effectiveCryptoPaymentMethod =
@@ -233,8 +242,6 @@ export const OrderDetails = memo(function OrderDetails({
233
242
 
234
243
  const { switchChainAndExecuteWithEOA, isSwitchingOrExecuting } = useUnifiedChainSwitchAndExecute();
235
244
 
236
- const { colorMode } = useColorMode();
237
-
238
245
  const roundedUpSrcAmount = useMemo(() => {
239
246
  // Display the full transfer amount without rounding since users need to see the exact value they're transferring.
240
247
  // Use 21 significant digits (max allowed by Intl.NumberFormat)
@@ -245,22 +252,42 @@ export const OrderDetails = memo(function OrderDetails({
245
252
  return roundTokenAmount(formattedSrcAmount);
246
253
  }, [order.srcAmount, srcToken]);
247
254
 
255
+ // Calculate deposit amounts - moved here to be used in useCallback hooks
256
+ const depositedAmount = useMemo(() => {
257
+ return depositTxs ? depositTxs.reduce((acc, curr) => acc + BigInt(curr.amount), BigInt(0)) : BigInt(0);
258
+ }, [depositTxs]);
259
+
260
+ const depositDeficit = useMemo(() => {
261
+ return BigInt(order.srcAmount) - depositedAmount;
262
+ }, [order.srcAmount, depositedAmount]);
263
+
264
+ const depositEnoughAmount = useMemo(() => {
265
+ return depositDeficit <= BigInt(0);
266
+ }, [depositDeficit]);
267
+
268
+ const formattedDepositDeficit = useMemo(() => {
269
+ return formatTokenAmount(BigInt(depositDeficit), srcToken.decimals);
270
+ }, [depositDeficit, srcToken.decimals]);
271
+
248
272
  // Unified payment handler for both EOA and AA wallets
249
273
  const handleUnifiedPaymentProcess = useCallback(async () => {
250
274
  let txData: `0x${string}` | undefined;
251
275
  let value: bigint;
252
276
  let to: `0x${string}`;
253
277
 
278
+ // Use the existing depositDeficit calculation to determine amount to send
279
+ const amountToSend = depositDeficit > BigInt(0) ? depositDeficit : BigInt(order.srcAmount);
280
+
254
281
  if (isNativeToken(order.srcTokenAddress)) {
255
282
  // Native token transfer
256
283
  to = order.globalAddress as `0x${string}`;
257
- value = BigInt(order.srcAmount);
284
+ value = amountToSend;
258
285
  } else {
259
286
  // ERC20 token transfer - encode the transfer function call using proper ABI
260
287
  txData = encodeFunctionData({
261
288
  abi: erc20Abi,
262
289
  functionName: "transfer",
263
- args: [order.globalAddress as `0x${string}`, BigInt(order.srcAmount)],
290
+ args: [order.globalAddress as `0x${string}`, amountToSend],
264
291
  });
265
292
  to = order.srcTokenAddress as `0x${string}`;
266
293
  value = BigInt(0);
@@ -271,13 +298,15 @@ export const OrderDetails = memo(function OrderDetails({
271
298
  if (txHash) {
272
299
  setTxHash(txHash as `0x${string}`);
273
300
  }
274
- }, [order, switchChainAndExecuteWithEOA]);
301
+ }, [order, switchChainAndExecuteWithEOA, depositDeficit]);
275
302
 
276
303
  // Main payment handler that triggers chain switch and payment
277
304
  const handlePayment = async () => {
278
305
  console.log("Initiating payment process. Target chain:", order.srcChain, "Current chain:", walletClient?.chain?.id);
279
306
  if (order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID) {
280
- await initiatePhantomTransfer(order.srcAmount, order.srcTokenAddress, order.globalAddress);
307
+ // Use the existing depositDeficit calculation to determine amount to send
308
+ const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
309
+ await initiatePhantomTransfer(amountToSend, order.srcTokenAddress, order.globalAddress);
281
310
  } else {
282
311
  // Use unified payment process for both EOA and AA wallets
283
312
  await handleUnifiedPaymentProcess();
@@ -361,13 +390,6 @@ export const OrderDetails = memo(function OrderDetails({
361
390
  ? formatTokenAmount(BigInt(actualDstAmount), dstToken.decimals)
362
391
  : undefined;
363
392
 
364
- const depositedAmount = depositTxs
365
- ? depositTxs.reduce((acc, curr) => acc + BigInt(curr.amount), BigInt(0))
366
- : BigInt(0);
367
- const depositDeficit = BigInt(order.srcAmount) - depositedAmount;
368
- const depositEnoughAmount = depositDeficit <= BigInt(0);
369
- const formattedDepositDeficit = formatTokenAmount(BigInt(depositDeficit), srcToken.decimals);
370
-
371
393
  const { text: statusText, status: statusDisplay } = getStatusDisplay(order);
372
394
 
373
395
  const initiatePhantomTransfer = async (amountLamports: string, tokenAddress: string, recipientAddress: string) => {
@@ -537,7 +559,7 @@ export const OrderDetails = memo(function OrderDetails({
537
559
  }
538
560
  };
539
561
 
540
- if (refundTxs) {
562
+ if (refundTxs.length > 0) {
541
563
  return (
542
564
  <>
543
565
  <OrderDetailsCollapsible
@@ -551,7 +573,7 @@ export const OrderDetails = memo(function OrderDetails({
551
573
  <Accordion type="single" collapsible className="w-full">
552
574
  <AccordionItem value="refund-details">
553
575
  <AccordionTrigger>Transaction Details</AccordionTrigger>
554
- <AccordionContent>
576
+ <AccordionContent className="pl-2">
555
577
  <div className="relative flex w-full flex-col gap-4">
556
578
  <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
557
579
  <motion.div
@@ -628,7 +650,7 @@ export const OrderDetails = memo(function OrderDetails({
628
650
  <Accordion type="single" collapsible className="w-full">
629
651
  <AccordionItem value="execute-details">
630
652
  <AccordionTrigger>Transaction Details</AccordionTrigger>
631
- <AccordionContent>
653
+ <AccordionContent className="pl-2">
632
654
  <div className="relative flex w-full flex-col gap-4">
633
655
  <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
634
656
  <motion.div
@@ -653,13 +675,19 @@ export const OrderDetails = memo(function OrderDetails({
653
675
  />
654
676
  ))
655
677
  : null}
656
- <TransactionDetails
657
- title="Processed Transaction"
658
- chainId={order.srcChain}
659
- tx={relayTx}
660
- delay={0.5}
661
- isProcessing={false}
662
- />
678
+ {relayTxs
679
+ ? relayTxs.map(relayTx => (
680
+ <TransactionDetails
681
+ key={relayTx.txHash}
682
+ title="Processed Transaction"
683
+ chainId={relayTx.chain}
684
+ tx={relayTx}
685
+ delay={0.5}
686
+ isProcessing={false}
687
+ />
688
+ ))
689
+ : null}
690
+
663
691
  <TransactionDetails
664
692
  title={
665
693
  order.type === "swap"
@@ -733,7 +761,7 @@ export const OrderDetails = memo(function OrderDetails({
733
761
  );
734
762
  }
735
763
 
736
- if (relayTx && relayTx.status === "success") {
764
+ if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
737
765
  return (
738
766
  <>
739
767
  <OrderDetailsCollapsible
@@ -747,7 +775,7 @@ export const OrderDetails = memo(function OrderDetails({
747
775
  <Accordion type="single" collapsible className="w-full">
748
776
  <AccordionItem value="more-details">
749
777
  <AccordionTrigger>More Details</AccordionTrigger>
750
- <AccordionContent>
778
+ <AccordionContent className="pl-2">
751
779
  <div className="relative flex w-full flex-col gap-4">
752
780
  <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
753
781
  <motion.div
@@ -772,59 +800,42 @@ export const OrderDetails = memo(function OrderDetails({
772
800
  />
773
801
  ))
774
802
  : null}
775
- {/* If the source and destination chains are the same, AnySpend doesn't have executeTransaction */}
776
- {order.srcChain === order.dstChain ? (
803
+ {relayTxs.map(relayTx => (
804
+ <TransactionDetails
805
+ title="Processed Transaction"
806
+ chainId={relayTx.chain}
807
+ isProcessing={false}
808
+ tx={relayTx}
809
+ delay={0.5}
810
+ />
811
+ ))}
812
+ {order.status === "executing" && (
777
813
  <TransactionDetails
778
814
  title={
779
815
  order.type === "swap"
780
- ? "Processed Swap"
816
+ ? "Processing Swap"
781
817
  : order.type === "mint_nft"
782
- ? "Minted NFT"
818
+ ? "Minting NFT"
783
819
  : order.type === "join_tournament"
784
- ? "Joined Tournament"
820
+ ? "Joining Tournament"
785
821
  : order.type === "fund_tournament"
786
- ? "Funded Tournament"
787
- : "Processed Transaction"
822
+ ? "Funding Tournament"
823
+ : order.type === "hype_duel"
824
+ ? "Depositing Hype Duel"
825
+ : "Processing Bridge"
788
826
  }
789
- chainId={order.srcChain}
790
- isProcessing={false}
791
- tx={relayTx}
792
- delay={0.5}
827
+ chainId={order.dstChain}
828
+ isProcessing={true}
829
+ tx={null}
830
+ delay={1}
793
831
  />
794
- ) : (
795
- <>
796
- <TransactionDetails
797
- title="Processed Transaction"
798
- chainId={order.srcChain}
799
- isProcessing={false}
800
- tx={relayTx}
801
- delay={0.5}
802
- />
803
- <TransactionDetails
804
- title={
805
- order.type === "swap"
806
- ? "Processing Swap"
807
- : order.type === "mint_nft"
808
- ? "Minting NFT"
809
- : order.type === "join_tournament"
810
- ? "Joining Tournament"
811
- : order.type === "fund_tournament"
812
- ? "Funding Tournament"
813
- : "Processing Bridge"
814
- }
815
- chainId={order.dstChain}
816
- isProcessing={true}
817
- tx={executeTx}
818
- delay={1}
819
- />
820
- </>
821
832
  )}
822
833
  </div>
823
834
  </AccordionContent>
824
835
  </AccordionItem>
825
836
  </Accordion>
826
837
 
827
- <div className="flex w-full flex-col gap-8">
838
+ {/* <div className="flex w-full flex-col gap-8">
828
839
  <Button variant="link" asChild>
829
840
  <a
830
841
  href={getExplorerTxUrl(order.dstChain, relayTx.txHash)}
@@ -843,7 +854,7 @@ export const OrderDetails = memo(function OrderDetails({
843
854
  <ExternalLink className="ml-2 h-4 w-4" />
844
855
  </a>
845
856
  </Button>
846
- </div>
857
+ </div> */}
847
858
 
848
859
  {order.type === "join_tournament" && order.status === "executed" && (
849
860
  <ShinyButton
@@ -892,7 +903,7 @@ export const OrderDetails = memo(function OrderDetails({
892
903
  <Accordion type="single" collapsible className="w-full">
893
904
  <AccordionItem value="deposit-details">
894
905
  <AccordionTrigger>Transaction Details</AccordionTrigger>
895
- <AccordionContent>
906
+ <AccordionContent className="pl-2">
896
907
  <div className="relative flex w-full flex-col gap-6">
897
908
  <div className="bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2">
898
909
  <motion.div
@@ -959,6 +970,19 @@ export const OrderDetails = memo(function OrderDetails({
959
970
  </AccordionItem>
960
971
  </Accordion>
961
972
 
973
+ {/* Show payment UI when deposit is not enough and order is not expired */}
974
+ {!depositEnoughAmount && order.status !== "expired" && (
975
+ <InsufficientDepositPayment
976
+ order={order}
977
+ srcToken={srcToken}
978
+ depositDeficit={depositDeficit}
979
+ phantomWalletAddress={phantomWalletAddress}
980
+ txLoading={txLoading}
981
+ isSwitchingOrExecuting={isSwitchingOrExecuting}
982
+ onPayment={handlePayment}
983
+ />
984
+ )}
985
+
962
986
  {/* <DelayedSupportMessage /> */}
963
987
  </>
964
988
  );
@@ -41,11 +41,11 @@ export const OrderStatus = memo(function OrderStatus({
41
41
  }
42
42
  }
43
43
 
44
- if (["relay", "sending_token_from_vault"].includes(order.status)) {
44
+ if (["relay", "executing", "sending_token_from_vault"].includes(order.status)) {
45
45
  return <StepProgress steps={paymentSteps} currentStepIndex={1} />;
46
46
  }
47
47
 
48
- if (!isComplete && displayStatus !== "failure") {
48
+ if (selectedCryptoPaymentMethod === "transfer_crypto" && order.status === "scanning_deposit_transaction") {
49
49
  return null;
50
50
  }
51
51
 
@@ -39,7 +39,7 @@ interface UseAnyspendFlowProps {
39
39
  loadOrder?: string;
40
40
  isDepositMode?: boolean;
41
41
  onOrderSuccess?: (orderId: string) => void;
42
- onTransactionSuccess?: () => void;
42
+ onTransactionSuccess?: (amount?: string) => void;
43
43
  sourceTokenAddress?: string;
44
44
  sourceTokenChainId?: number;
45
45
  slippage?: number;
@@ -245,9 +245,11 @@ export function useAnyspendFlow({
245
245
  useEffect(() => {
246
246
  if (oat?.data?.order.status === "executed") {
247
247
  console.log("Order executed successfully");
248
- onTransactionSuccess?.();
248
+ // just get the payload.amount if available from custompayload
249
+ const amount = (oat.data.order.payload as { amount?: string })?.amount;
250
+ onTransactionSuccess?.(amount);
249
251
  }
250
- }, [oat?.data?.order.status, onTransactionSuccess]);
252
+ }, [oat?.data?.order.status, oat?.data?.order.payload, onTransactionSuccess]);
251
253
 
252
254
  return {
253
255
  // State
@@ -27,7 +27,7 @@ export function useAnyspendQuote(req: GetQuoteRequest): UseAnyspendQuoteResult {
27
27
  req.srcTokenAddress &&
28
28
  req.dstTokenAddress &&
29
29
  BigInt(
30
- req.type === "swap"
30
+ req.type === "swap" || req.type === "hype_duel"
31
31
  ? req.amount
32
32
  : req.type === "mint_nft"
33
33
  ? req.price