@b3dotfun/sdk 0.0.33-alpha.5 → 0.0.33-alpha.7

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 (57) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
  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 +40 -36
  9. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +1 -1
  10. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
  11. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  14. package/dist/cjs/anyspend/types/api.d.ts +130 -14
  15. package/dist/cjs/anyspend/utils/chain.js +1 -1
  16. package/dist/cjs/anyspend/utils/format.js +1 -0
  17. package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
  18. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
  19. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  20. package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
  21. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  22. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
  23. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  24. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +22 -0
  25. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  26. package/dist/esm/anyspend/react/components/common/OrderDetails.js +40 -36
  27. package/dist/esm/anyspend/react/components/common/OrderStatus.js +1 -1
  28. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
  29. package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  30. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  31. package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
  32. package/dist/esm/anyspend/types/api.d.ts +130 -14
  33. package/dist/esm/anyspend/utils/chain.js +1 -1
  34. package/dist/esm/anyspend/utils/format.js +1 -0
  35. package/dist/esm/anyspend/utils/orderPayload.js +7 -0
  36. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
  37. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
  38. package/dist/types/anyspend/react/components/common/InsufficientDepositPayment.d.ts +12 -0
  39. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
  40. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
  41. package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
  42. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
  43. package/dist/types/anyspend/types/api.d.ts +130 -14
  44. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
  45. package/package.json +1 -1
  46. package/src/anyspend/react/components/AnySpend.tsx +1 -1
  47. package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
  48. package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
  49. package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +144 -0
  50. package/src/anyspend/react/components/common/OrderDetails.tsx +85 -64
  51. package/src/anyspend/react/components/common/OrderStatus.tsx +1 -1
  52. package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
  53. package/src/anyspend/types/api.ts +131 -11
  54. package/src/anyspend/utils/chain.ts +1 -1
  55. package/src/anyspend/utils/format.ts +1 -0
  56. package/src/anyspend/utils/orderPayload.ts +7 -0
  57. package/src/global-account/react/stores/useModalStore.ts +0 -2
@@ -21,6 +21,7 @@ import { useWaitForTransactionReceipt, useWalletClient } from "wagmi";
21
21
  import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./Accordion.js";
22
22
  import ConnectWalletPayment from "./ConnectWalletPayment.js";
23
23
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
24
+ import { InsufficientDepositPayment } from "./InsufficientDepositPayment.js";
24
25
  import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible.js";
25
26
  import PaymentVendorUI from "./PaymentVendorUI.js";
26
27
  import { TransferCryptoDetails } from "./TransferCryptoDetails.js";
@@ -47,6 +48,9 @@ function getOrderSuccessText({ order, tournament, formattedActualDstAmount, dstT
47
48
  }
48
49
  actionText = order.metadata.action || `executed contract`;
49
50
  return `Successfully ${actionText}`;
51
+ case "hype_duel":
52
+ actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
53
+ return `Successfully ${actionText} to ${recipient}`;
50
54
  default:
51
55
  throw new Error("Invalid order type");
52
56
  }
@@ -123,7 +127,7 @@ function roundTokenAmount(amount) {
123
127
  const roundedDecimalPart = digits.join("");
124
128
  return `${wholePart}.${roundedDecimalPart}`;
125
129
  }
126
- export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTx, executeTx, refundTxs, cryptoPaymentMethod, onBack, disableUrlParamManagement = false, }) {
130
+ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order, depositTxs, relayTxs, executeTx, refundTxs, cryptoPaymentMethod, onBack, disableUrlParamManagement = false, }) {
127
131
  const router = useRouter();
128
132
  const searchParams = useSearchParams();
129
133
  // Get theme from B3Provider context
@@ -153,22 +157,37 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
153
157
  : undefined;
154
158
  return roundTokenAmount(formattedSrcAmount);
155
159
  }, [order.srcAmount, srcToken]);
160
+ // Calculate deposit amounts - moved here to be used in useCallback hooks
161
+ const depositedAmount = useMemo(() => {
162
+ return depositTxs ? depositTxs.reduce((acc, curr) => acc + BigInt(curr.amount), BigInt(0)) : BigInt(0);
163
+ }, [depositTxs]);
164
+ const depositDeficit = useMemo(() => {
165
+ return BigInt(order.srcAmount) - depositedAmount;
166
+ }, [order.srcAmount, depositedAmount]);
167
+ const depositEnoughAmount = useMemo(() => {
168
+ return depositDeficit <= BigInt(0);
169
+ }, [depositDeficit]);
170
+ const formattedDepositDeficit = useMemo(() => {
171
+ return formatTokenAmount(BigInt(depositDeficit), srcToken.decimals);
172
+ }, [depositDeficit, srcToken.decimals]);
156
173
  // Unified payment handler for both EOA and AA wallets
157
174
  const handleUnifiedPaymentProcess = useCallback(async () => {
158
175
  let txData;
159
176
  let value;
160
177
  let to;
178
+ // Use the existing depositDeficit calculation to determine amount to send
179
+ const amountToSend = depositDeficit > BigInt(0) ? depositDeficit : BigInt(order.srcAmount);
161
180
  if (isNativeToken(order.srcTokenAddress)) {
162
181
  // Native token transfer
163
182
  to = order.globalAddress;
164
- value = BigInt(order.srcAmount);
183
+ value = amountToSend;
165
184
  }
166
185
  else {
167
186
  // ERC20 token transfer - encode the transfer function call using proper ABI
168
187
  txData = encodeFunctionData({
169
188
  abi: erc20Abi,
170
189
  functionName: "transfer",
171
- args: [order.globalAddress, BigInt(order.srcAmount)],
190
+ args: [order.globalAddress, amountToSend],
172
191
  });
173
192
  to = order.srcTokenAddress;
174
193
  value = BigInt(0);
@@ -177,12 +196,14 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
177
196
  if (txHash) {
178
197
  setTxHash(txHash);
179
198
  }
180
- }, [order, switchChainAndExecuteWithEOA]);
199
+ }, [order, switchChainAndExecuteWithEOA, depositDeficit]);
181
200
  // Main payment handler that triggers chain switch and payment
182
201
  const handlePayment = async () => {
183
202
  console.log("Initiating payment process. Target chain:", order.srcChain, "Current chain:", walletClient?.chain?.id);
184
203
  if (order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID) {
185
- await initiatePhantomTransfer(order.srcAmount, order.srcTokenAddress, order.globalAddress);
204
+ // Use the existing depositDeficit calculation to determine amount to send
205
+ const amountToSend = depositDeficit > BigInt(0) ? depositDeficit.toString() : order.srcAmount;
206
+ await initiatePhantomTransfer(amountToSend, order.srcTokenAddress, order.globalAddress);
186
207
  }
187
208
  else {
188
209
  // Use unified payment process for both EOA and AA wallets
@@ -255,12 +276,6 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
255
276
  const formattedActualDstAmount = actualDstAmount
256
277
  ? formatTokenAmount(BigInt(actualDstAmount), dstToken.decimals)
257
278
  : undefined;
258
- const depositedAmount = depositTxs
259
- ? depositTxs.reduce((acc, curr) => acc + BigInt(curr.amount), BigInt(0))
260
- : BigInt(0);
261
- const depositDeficit = BigInt(order.srcAmount) - depositedAmount;
262
- const depositEnoughAmount = depositDeficit <= BigInt(0);
263
- const formattedDepositDeficit = formatTokenAmount(BigInt(depositDeficit), srcToken.decimals);
264
279
  const { text: statusText, status: statusDisplay } = getStatusDisplay(order);
265
280
  const initiatePhantomTransfer = async (amountLamports, tokenAddress, recipientAddress) => {
266
281
  try {
@@ -393,7 +408,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
393
408
  }
394
409
  }
395
410
  };
396
- if (refundTxs) {
411
+ if (refundTxs.length > 0) {
397
412
  return (_jsxs(_Fragment, { children: [_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "w-full", children: _jsxs(AccordionItem, { value: "refund-details", children: [_jsx(AccordionTrigger, { children: "Transaction Details" }), _jsx(AccordionContent, { className: "pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
398
413
  ? depositTxs.map(dTx => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
399
414
  ? `Received payment`
@@ -407,7 +422,9 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
407
422
  ? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
408
423
  ? `Received payment`
409
424
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
410
- : null, _jsx(TransactionDetails, { title: "Processed Transaction", chainId: order.srcChain, tx: relayTx, delay: 0.5, isProcessing: false }), _jsx(TransactionDetails, { title: order.type === "swap"
425
+ : null, relayTxs
426
+ ? relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: "Processed Transaction", chainId: relayTx.chain, tx: relayTx, delay: 0.5, isProcessing: false }, relayTx.txHash)))
427
+ : null, _jsx(TransactionDetails, { title: order.type === "swap"
411
428
  ? "Processed Swap"
412
429
  : order.type === "mint_nft"
413
430
  ? "Minted NFT"
@@ -424,35 +441,22 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
424
441
  centerTruncate,
425
442
  }), _jsx(ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && (_jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [_jsx("span", { className: "pl-4", children: "Continue to Tournament" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && (_jsx("button", { className: "order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
426
443
  }
427
- if (relayTx && relayTx.status === "success") {
444
+ if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
428
445
  return (_jsxs(_Fragment, { children: [_jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }), _jsx(Accordion, { type: "single", collapsible: true, className: "w-full", children: _jsxs(AccordionItem, { value: "more-details", children: [_jsx(AccordionTrigger, { children: "More Details" }), _jsx(AccordionContent, { className: "pl-2", children: _jsxs("div", { className: "relative flex w-full flex-col gap-4", children: [_jsx("div", { className: "bg-as-surface-secondary absolute bottom-2 left-4 top-2 z-[5] w-2", children: _jsx(motion.div, { className: "bg-as-border-primary absolute left-[2px] top-0 z-10 w-[3px]", initial: { height: "0%" }, animate: { height: "100%" }, transition: { duration: 1.5, ease: "easeInOut" } }) }), depositTxs
429
446
  ? depositTxs.map(dTxs => (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
430
447
  ? `Received payment`
431
448
  : `Received ${formatTokenAmount(BigInt(dTxs.amount), srcToken.decimals)} ${srcToken.symbol}`, chainId: order.srcChain, tx: dTxs, isProcessing: false }, dTxs.txHash)))
432
- : null, order.srcChain === order.dstChain ? (_jsx(TransactionDetails, { title: order.type === "swap"
433
- ? "Processed Swap"
449
+ : null, relayTxs.map(relayTx => (_jsx(TransactionDetails, { title: "Processed Transaction", chainId: relayTx.chain, isProcessing: false, tx: relayTx, delay: 0.5 }))), order.status === "executing" && (_jsx(TransactionDetails, { title: order.type === "swap"
450
+ ? "Processing Swap"
434
451
  : order.type === "mint_nft"
435
- ? "Minted NFT"
452
+ ? "Minting NFT"
436
453
  : order.type === "join_tournament"
437
- ? "Joined Tournament"
454
+ ? "Joining Tournament"
438
455
  : order.type === "fund_tournament"
439
- ? "Funded Tournament"
440
- : "Processed Transaction", chainId: order.srcChain, isProcessing: false, tx: relayTx, delay: 0.5 })) : (_jsxs(_Fragment, { children: [_jsx(TransactionDetails, { title: "Processed Transaction", chainId: order.srcChain, isProcessing: false, tx: relayTx, delay: 0.5 }), _jsx(TransactionDetails, { title: order.type === "swap"
441
- ? "Processing Swap"
442
- : order.type === "mint_nft"
443
- ? "Minting NFT"
444
- : order.type === "join_tournament"
445
- ? "Joining Tournament"
446
- : order.type === "fund_tournament"
447
- ? "Funding Tournament"
448
- : "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: executeTx, delay: 1 })] }))] }) })] }) }), _jsx("div", { className: "flex w-full flex-col gap-8", children: _jsx(Button, { variant: "link", asChild: true, children: _jsxs("a", { href: getExplorerTxUrl(order.dstChain, relayTx.txHash), target: "_blank", className: "order-success-text text-as-primary/70 hover:text-as-primary", style: { whiteSpace: "normal" }, children: [getOrderSuccessText({
449
- order,
450
- tournament,
451
- formattedActualDstAmount,
452
- dstToken,
453
- recipientName,
454
- centerTruncate,
455
- }), _jsx(ExternalLink, { className: "ml-2 h-4 w-4" })] }) }) }), order.type === "join_tournament" && order.status === "executed" && (_jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [_jsx("span", { className: "pl-4", children: "Continue to Tournament" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && (_jsx("button", { className: "order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
456
+ ? "Funding Tournament"
457
+ : order.type === "hype_duel"
458
+ ? "Depositing Hype Duel"
459
+ : "Processing Bridge", chainId: order.dstChain, isProcessing: true, tx: null, delay: 1 }))] }) })] }) }), order.type === "join_tournament" && order.status === "executed" && (_jsxs(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-full items-center gap-2", disabled: txLoading || isSwitchingOrExecuting, onClick: handleCloseModal, children: [_jsx("span", { className: "pl-4", children: "Continue to Tournament" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })), order.status === "executed" && (_jsx("button", { className: "order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white", onClick: mode === "page" ? handleBack : handleCloseModal, children: mode === "page" ? (_jsxs(_Fragment, { children: ["Return to Home ", _jsx(Home, { className: "ml-2 h-4 w-4" })] })) : ("Close") }))] }));
456
460
  }
457
461
  // This boolean indicates that user finish payment, and waiting for the deposit to be confirmed. We get this from query params (waitingForDeposit=true)
458
462
  const waitingForDeposit = new URLSearchParams(window.location.search).get("waitingForDeposit") === "true";
@@ -469,7 +473,7 @@ export const OrderDetails = memo(function OrderDetails({ mode = "modal", order,
469
473
  ? "Funding Tournament"
470
474
  : "Processing Transaction", chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 })) : (_jsx(TransactionDetails, { title: order.onrampMetadata?.vendor === "stripe-web2"
471
475
  ? `Waiting for payment`
472
- : `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) })] }));
476
+ : `Waiting for deposit ${formattedDepositDeficit} ${srcToken.symbol}`, chainId: order.srcChain, tx: null, isProcessing: true, delay: 0.5 }))] }) })] }) }), !depositEnoughAmount && order.status !== "expired" && (_jsx(InsufficientDepositPayment, { order: order, srcToken: srcToken, depositDeficit: depositDeficit, phantomWalletAddress: phantomWalletAddress, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, onPayment: handlePayment }))] }));
473
477
  }
474
478
  return (_jsxs(_Fragment, { children: [statusDisplay === "processing" && (_jsx(_Fragment, { children: order.onrampMetadata ? (_jsx(PaymentVendorUI, { order: order, dstTokenSymbol: dstToken.symbol })) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsx(ConnectWalletPayment, { order: order, onPayment: handlePayment, onCancel: handleBack, txLoading: txLoading, isSwitchingOrExecuting: isSwitchingOrExecuting, phantomWalletAddress: phantomWalletAddress, tournament: tournament, nft: nft })) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
475
479
  // Transfer Crypto Payment Method - Show new card-based UI
@@ -29,7 +29,7 @@ export const OrderStatus = memo(function OrderStatus({ order, selectedCryptoPaym
29
29
  return _jsx(StepProgress, { steps: paymentSteps, currentStepIndex: 0 });
30
30
  }
31
31
  }
32
- if (["relay", "sending_token_from_vault"].includes(order.status)) {
32
+ if (["relay", "executing", "sending_token_from_vault"].includes(order.status)) {
33
33
  return _jsx(StepProgress, { steps: paymentSteps, currentStepIndex: 1 });
34
34
  }
35
35
  if (selectedCryptoPaymentMethod === "transfer_crypto" && order.status === "scanning_deposit_transaction") {
@@ -31,10 +31,10 @@ export declare function useAnyspendFlow({ paymentType, recipientAddress, loadOrd
31
31
  message: string;
32
32
  data: {
33
33
  order: components["schemas"]["Order"];
34
- depositTxs: components["schemas"]["DepositTx"][] | null;
35
- relayTx: components["schemas"]["RelayTx"] | null;
34
+ depositTxs: components["schemas"]["DepositTx"][];
35
+ relayTxs: components["schemas"]["RelayTx"][];
36
36
  executeTx: components["schemas"]["ExecuteTx"] | null;
37
- refundTxs: components["schemas"]["RefundTx"][] | null;
37
+ refundTxs: components["schemas"]["RefundTx"][];
38
38
  };
39
39
  statusCode: number;
40
40
  } | undefined;
@@ -4,10 +4,10 @@ export declare function useAnyspendOrderAndTransactions(orderId: string | undefi
4
4
  message: string;
5
5
  data: {
6
6
  order: import("../..").components["schemas"]["Order"];
7
- depositTxs: import("../..").components["schemas"]["DepositTx"][] | null;
8
- relayTx: import("../..").components["schemas"]["RelayTx"] | null;
7
+ depositTxs: import("../..").components["schemas"]["DepositTx"][];
8
+ relayTxs: import("../..").components["schemas"]["RelayTx"][];
9
9
  executeTx: import("../..").components["schemas"]["ExecuteTx"] | null;
10
- refundTxs: import("../..").components["schemas"]["RefundTx"][] | null;
10
+ refundTxs: import("../..").components["schemas"]["RefundTx"][];
11
11
  };
12
12
  statusCode: number;
13
13
  } | undefined;
@@ -18,10 +18,10 @@ export declare function useAnyspendOrderAndTransactions(orderId: string | undefi
18
18
  message: string;
19
19
  data: {
20
20
  order: import("../..").components["schemas"]["Order"];
21
- depositTxs: import("../..").components["schemas"]["DepositTx"][] | null;
22
- relayTx: import("../..").components["schemas"]["RelayTx"] | null;
21
+ depositTxs: import("../..").components["schemas"]["DepositTx"][];
22
+ relayTxs: import("../..").components["schemas"]["RelayTx"][];
23
23
  executeTx: import("../..").components["schemas"]["ExecuteTx"] | null;
24
- refundTxs: import("../..").components["schemas"]["RefundTx"][] | null;
24
+ refundTxs: import("../..").components["schemas"]["RefundTx"][];
25
25
  };
26
26
  statusCode: number;
27
27
  }, Error>>;
@@ -8,7 +8,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
8
8
  srcTokenAddress: string;
9
9
  dstTokenAddress: string;
10
10
  srcAmount: string;
11
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
11
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
12
12
  errorDetails: string | null;
13
13
  createdAt: number;
14
14
  expiredAt: number;
@@ -30,7 +30,29 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
30
30
  srcTokenAddress: string;
31
31
  dstTokenAddress: string;
32
32
  srcAmount: string;
33
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
33
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
34
+ errorDetails: string | null;
35
+ createdAt: number;
36
+ expiredAt: number;
37
+ creatorAddress: string | null;
38
+ partnerId: string | null;
39
+ onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
40
+ oneClickBuyUrl: string | null;
41
+ stripePaymentIntentId: string | null;
42
+ } & {
43
+ type: "hype_duel";
44
+ payload: import("../..").components["schemas"]["HypeDuelPayload"];
45
+ metadata: import("../..").components["schemas"]["HypeDuelMetadata"];
46
+ }) | ({
47
+ id: string;
48
+ recipientAddress: string;
49
+ globalAddress: string;
50
+ srcChain: number;
51
+ dstChain: number;
52
+ srcTokenAddress: string;
53
+ dstTokenAddress: string;
54
+ srcAmount: string;
55
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
34
56
  errorDetails: string | null;
35
57
  createdAt: number;
36
58
  expiredAt: number;
@@ -52,7 +74,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
52
74
  srcTokenAddress: string;
53
75
  dstTokenAddress: string;
54
76
  srcAmount: string;
55
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
77
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
56
78
  errorDetails: string | null;
57
79
  createdAt: number;
58
80
  expiredAt: number;
@@ -74,7 +96,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
74
96
  srcTokenAddress: string;
75
97
  dstTokenAddress: string;
76
98
  srcAmount: string;
77
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
99
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
78
100
  errorDetails: string | null;
79
101
  createdAt: number;
80
102
  expiredAt: number;
@@ -96,7 +118,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
96
118
  srcTokenAddress: string;
97
119
  dstTokenAddress: string;
98
120
  srcAmount: string;
99
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
121
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
100
122
  errorDetails: string | null;
101
123
  createdAt: number;
102
124
  expiredAt: number;
@@ -121,7 +143,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
121
143
  srcTokenAddress: string;
122
144
  dstTokenAddress: string;
123
145
  srcAmount: string;
124
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
146
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
125
147
  errorDetails: string | null;
126
148
  createdAt: number;
127
149
  expiredAt: number;
@@ -143,7 +165,29 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
143
165
  srcTokenAddress: string;
144
166
  dstTokenAddress: string;
145
167
  srcAmount: string;
146
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
168
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
169
+ errorDetails: string | null;
170
+ createdAt: number;
171
+ expiredAt: number;
172
+ creatorAddress: string | null;
173
+ partnerId: string | null;
174
+ onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
175
+ oneClickBuyUrl: string | null;
176
+ stripePaymentIntentId: string | null;
177
+ } & {
178
+ type: "hype_duel";
179
+ payload: import("../..").components["schemas"]["HypeDuelPayload"];
180
+ metadata: import("../..").components["schemas"]["HypeDuelMetadata"];
181
+ }) | ({
182
+ id: string;
183
+ recipientAddress: string;
184
+ globalAddress: string;
185
+ srcChain: number;
186
+ dstChain: number;
187
+ srcTokenAddress: string;
188
+ dstTokenAddress: string;
189
+ srcAmount: string;
190
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
147
191
  errorDetails: string | null;
148
192
  createdAt: number;
149
193
  expiredAt: number;
@@ -165,7 +209,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
165
209
  srcTokenAddress: string;
166
210
  dstTokenAddress: string;
167
211
  srcAmount: string;
168
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
212
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
169
213
  errorDetails: string | null;
170
214
  createdAt: number;
171
215
  expiredAt: number;
@@ -187,7 +231,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
187
231
  srcTokenAddress: string;
188
232
  dstTokenAddress: string;
189
233
  srcAmount: string;
190
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
234
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
191
235
  errorDetails: string | null;
192
236
  createdAt: number;
193
237
  expiredAt: number;
@@ -209,7 +253,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
209
253
  srcTokenAddress: string;
210
254
  dstTokenAddress: string;
211
255
  srcAmount: string;
212
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
256
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
213
257
  errorDetails: string | null;
214
258
  createdAt: number;
215
259
  expiredAt: number;
@@ -11,7 +11,7 @@ export function useAnyspendQuote(req) {
11
11
  req.dstChain &&
12
12
  req.srcTokenAddress &&
13
13
  req.dstTokenAddress &&
14
- BigInt(req.type === "swap"
14
+ BigInt(req.type === "swap" || req.type === "hype_duel"
15
15
  ? req.amount
16
16
  : req.type === "mint_nft"
17
17
  ? req.price
@@ -417,18 +417,23 @@ export interface paths {
417
417
  * }
418
418
  * ]
419
419
  */
420
- depositTxs: components["schemas"]["DepositTx"][] | null;
421
- /** @example {
422
- * "orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
423
- * "chain": 8453,
424
- * "txHash": "0x9df917e14bb089f74763d1d2662761d75c97a5a068b8a9e411c3d384c9c40d19",
425
- * "status": "success",
426
- * "createdAt": 1752505817654
427
- * } */
428
- relayTx: components["schemas"]["RelayTx"] | null;
420
+ depositTxs: components["schemas"]["DepositTx"][];
421
+ /**
422
+ * @description Cross-chain relay transactions
423
+ * @example [
424
+ * {
425
+ * "orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
426
+ * "chain": 8453,
427
+ * "txHash": "0x9df917e14bb089f74763d1d2662761d75c97a5a068b8a9e411c3d384c9c40d19",
428
+ * "status": "success",
429
+ * "createdAt": 1752505817654
430
+ * }
431
+ * ]
432
+ */
433
+ relayTxs: components["schemas"]["RelayTx"][];
429
434
  executeTx: components["schemas"]["ExecuteTx"] | null;
430
435
  /** @description Refund transactions if order failed */
431
- refundTxs: components["schemas"]["RefundTx"][] | null;
436
+ refundTxs: components["schemas"]["RefundTx"][];
432
437
  };
433
438
  /** @example 200 */
434
439
  statusCode: number;
@@ -467,7 +472,7 @@ export interface paths {
467
472
  "/orders/quote": {
468
473
  /**
469
474
  * Get anyspend quote
470
- * @description Retrieves a quote to swap or execute contract
475
+ * @description Retrieves a quote to swap, execute contract, or participate in HypeDuel
471
476
  */
472
477
  post: {
473
478
  requestBody: {
@@ -591,6 +596,42 @@ export interface paths {
591
596
  onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
592
597
  contractAddress: string;
593
598
  fundAmount: string;
599
+ } | {
600
+ /**
601
+ * @description Order type for HypeDuel
602
+ * @enum {string}
603
+ */
604
+ type: "hype_duel";
605
+ /**
606
+ * @description Source chain ID
607
+ * @example 1
608
+ */
609
+ srcChain: number;
610
+ /**
611
+ * @description Destination chain ID
612
+ * @example 8453
613
+ */
614
+ dstChain: number;
615
+ /**
616
+ * @description Source token contract address
617
+ * @example 0x0000000000000000000000000000000000000000
618
+ */
619
+ srcTokenAddress: string;
620
+ /**
621
+ * @description Destination token contract address
622
+ * @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
623
+ */
624
+ dstTokenAddress: string;
625
+ /**
626
+ * @description Amount to quote
627
+ * @example 1000000000000000000
628
+ */
629
+ amount: string;
630
+ /**
631
+ * @description Optional onramp vendor
632
+ * @enum {string}
633
+ */
634
+ onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
594
635
  };
595
636
  };
596
637
  };
@@ -1037,6 +1078,19 @@ export interface components {
1037
1078
  */
1038
1079
  actualDstAmount: string | null;
1039
1080
  };
1081
+ /** @description HypeDuel-specific payload */
1082
+ HypeDuelPayload: {
1083
+ /**
1084
+ * @description Expected amount of destination tokens
1085
+ * @example 990000
1086
+ */
1087
+ expectedDstAmount: string;
1088
+ /**
1089
+ * @description Actual received amount (null for new orders)
1090
+ * @example 990000
1091
+ */
1092
+ actualDstAmount: string | null;
1093
+ };
1040
1094
  /** @description Custom execution payload */
1041
1095
  CustomPayload: {
1042
1096
  /**
@@ -1115,6 +1169,11 @@ export interface components {
1115
1169
  srcToken: components["schemas"]["Token"];
1116
1170
  dstToken: components["schemas"]["Token"];
1117
1171
  };
1172
+ /** @description HypeDuel metadata for display purposes */
1173
+ HypeDuelMetadata: {
1174
+ srcToken: components["schemas"]["Token"];
1175
+ dstToken: components["schemas"]["Token"];
1176
+ };
1118
1177
  /** @description Custom metadata for display purposes */
1119
1178
  CustomMetadata: {
1120
1179
  srcToken: components["schemas"]["Token"];
@@ -1185,7 +1244,7 @@ export interface components {
1185
1244
  * @example executed
1186
1245
  * @enum {string}
1187
1246
  */
1188
- status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
1247
+ status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
1189
1248
  /** @description Error details if order failed */
1190
1249
  errorDetails: string | null;
1191
1250
  /**
@@ -1224,6 +1283,15 @@ export interface components {
1224
1283
  payload: components["schemas"]["SwapPayload"];
1225
1284
  metadata: components["schemas"]["SwapMetadata"];
1226
1285
  };
1286
+ HypeDuelOrder: components["schemas"]["BaseOrder"] & {
1287
+ /**
1288
+ * @description Order type
1289
+ * @enum {string}
1290
+ */
1291
+ type: "hype_duel";
1292
+ payload: components["schemas"]["HypeDuelPayload"];
1293
+ metadata: components["schemas"]["HypeDuelMetadata"];
1294
+ };
1227
1295
  CustomOrder: components["schemas"]["BaseOrder"] & {
1228
1296
  /**
1229
1297
  * @description Order type
@@ -1260,7 +1328,7 @@ export interface components {
1260
1328
  payload: components["schemas"]["FundTournamentPayload"];
1261
1329
  metadata: components["schemas"]["TournamentMetadata"];
1262
1330
  };
1263
- Order: components["schemas"]["SwapOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
1331
+ Order: components["schemas"]["SwapOrder"] | components["schemas"]["HypeDuelOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
1264
1332
  /** @description Swap order request */
1265
1333
  SwapOrderRequest: {
1266
1334
  /**
@@ -1309,6 +1377,54 @@ export interface components {
1309
1377
  */
1310
1378
  creatorAddress?: string;
1311
1379
  };
1380
+ /** @description HypeDuel order request */
1381
+ HypeDuelOrderRequest: {
1382
+ /**
1383
+ * @description Order type
1384
+ * @enum {string}
1385
+ */
1386
+ type: "hype_duel";
1387
+ /**
1388
+ * @description Address to receive the destination tokens
1389
+ * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1390
+ */
1391
+ recipientAddress: string;
1392
+ /**
1393
+ * @description Source chain ID
1394
+ * @example 1
1395
+ */
1396
+ srcChain: number;
1397
+ /**
1398
+ * @description Destination chain ID
1399
+ * @example 8453
1400
+ */
1401
+ dstChain: number;
1402
+ /**
1403
+ * @description Source token contract address
1404
+ * @example 0xA0b86a33E6441E8A91DEF8f5663ACb4C9B4a1234
1405
+ */
1406
+ srcTokenAddress: string;
1407
+ /**
1408
+ * @description Destination token contract address
1409
+ * @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
1410
+ */
1411
+ dstTokenAddress: string;
1412
+ /**
1413
+ * @description Amount of source tokens for HypeDuel
1414
+ * @example 1000000
1415
+ */
1416
+ srcAmount: string;
1417
+ payload: components["schemas"]["HypeDuelPayload"];
1418
+ metadata: components["schemas"]["HypeDuelMetadata"];
1419
+ /** @description Optional partner identifier */
1420
+ partnerId?: string;
1421
+ onramp?: components["schemas"]["Onramp"];
1422
+ /**
1423
+ * @description Optional address of the order creator
1424
+ * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
1425
+ */
1426
+ creatorAddress?: string;
1427
+ };
1312
1428
  /** @description Custom order request */
1313
1429
  CustomOrderRequest: {
1314
1430
  /**
@@ -1501,7 +1617,7 @@ export interface components {
1501
1617
  */
1502
1618
  creatorAddress?: string;
1503
1619
  };
1504
- OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
1620
+ OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["HypeDuelOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
1505
1621
  /** @description Deposit transaction (payment from user) */
1506
1622
  DepositTx: {
1507
1623
  /**
@@ -34,7 +34,7 @@ export const EVM_MAINNET = {
34
34
  name: "Arbitrum",
35
35
  type: ChainType.EVM,
36
36
  logoUrl: "https://assets.relay.link/icons/square/42161/light.png",
37
- nativeRequired: parseEther("0.0001"),
37
+ nativeRequired: parseEther("0.0003"),
38
38
  canDepositNative: true,
39
39
  defaultToken: getEthToken(arbitrum.id),
40
40
  nativeToken: getEthToken(arbitrum.id),
@@ -20,6 +20,7 @@ export const getStatusDisplay = (order) => {
20
20
  case "sending_token_from_vault":
21
21
  return { text: "Sending Token", status: "processing" };
22
22
  case "relay":
23
+ case "executing":
23
24
  return {
24
25
  text: "Executing Order",
25
26
  status: "processing",
@@ -38,6 +38,11 @@ export const buildPayload = (orderType, params) => {
38
38
  };
39
39
  case "custom":
40
40
  return { ...payload };
41
+ case "hype_duel":
42
+ return {
43
+ expectedDstAmount,
44
+ actualDstAmount: null,
45
+ };
41
46
  default:
42
47
  throw new Error(`Invalid order type: ${orderType}`);
43
48
  }
@@ -58,6 +63,8 @@ export const buildMetadata = (orderType, params) => {
58
63
  return { ...baseMetadata, tournament };
59
64
  case "custom":
60
65
  return { ...baseMetadata, action: payload.action };
66
+ case "hype_duel":
67
+ return { ...baseMetadata };
61
68
  default:
62
69
  throw new Error(`Invalid order type: ${orderType}`);
63
70
  }