@b3dotfun/sdk 0.0.86 → 0.0.87-alpha.1

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 (97) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -0
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +59 -49
  3. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
  5. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +190 -0
  7. package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +43 -0
  8. package/dist/cjs/anyspend/react/components/QRDeposit.js +146 -0
  9. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -12
  10. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
  11. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
  12. package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
  13. package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +32 -0
  14. package/dist/cjs/anyspend/react/components/common/WarningText.js +36 -0
  15. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
  16. package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +6 -0
  17. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
  18. package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +6 -0
  19. package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
  20. package/dist/cjs/anyspend/react/components/index.js +3 -1
  21. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  22. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  23. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  24. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +35 -11
  25. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +76 -16
  26. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
  27. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +86 -0
  28. package/dist/cjs/anyspend/types/api.d.ts +65 -3
  29. package/dist/cjs/anyspend/utils/format.js +28 -5
  30. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
  31. package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -0
  32. package/dist/esm/anyspend/react/components/AnySpend.js +59 -49
  33. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  34. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
  35. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
  36. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +187 -0
  37. package/dist/esm/anyspend/react/components/QRDeposit.d.ts +43 -0
  38. package/dist/esm/anyspend/react/components/QRDeposit.js +143 -0
  39. package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -12
  40. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
  41. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
  42. package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
  43. package/dist/esm/anyspend/react/components/common/WarningText.d.ts +32 -0
  44. package/dist/esm/anyspend/react/components/common/WarningText.js +32 -0
  45. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
  46. package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +2 -0
  47. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
  48. package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +2 -0
  49. package/dist/esm/anyspend/react/components/index.d.ts +2 -0
  50. package/dist/esm/anyspend/react/components/index.js +1 -0
  51. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  52. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  53. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  54. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -11
  55. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +76 -16
  56. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
  57. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +83 -0
  58. package/dist/esm/anyspend/types/api.d.ts +65 -3
  59. package/dist/esm/anyspend/utils/format.js +28 -5
  60. package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
  61. package/dist/styles/index.css +1 -1
  62. package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -0
  63. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
  64. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
  65. package/dist/types/anyspend/react/components/QRDeposit.d.ts +43 -0
  66. package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
  67. package/dist/types/anyspend/react/components/common/WarningText.d.ts +32 -0
  68. package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
  69. package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
  70. package/dist/types/anyspend/react/components/index.d.ts +2 -0
  71. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  72. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
  73. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +76 -16
  74. package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
  75. package/dist/types/anyspend/types/api.d.ts +65 -3
  76. package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
  77. package/package.json +3 -3
  78. package/src/anyspend/react/components/AnySpend.tsx +68 -45
  79. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -3
  80. package/src/anyspend/react/components/AnySpendDeposit.tsx +578 -0
  81. package/src/anyspend/react/components/QRDeposit.tsx +348 -0
  82. package/src/anyspend/react/components/common/OrderDetails.tsx +26 -8
  83. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +20 -8
  84. package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
  85. package/src/anyspend/react/components/common/WarningText.tsx +52 -0
  86. package/src/anyspend/react/components/icons/CreditCardIcon.tsx +25 -0
  87. package/src/anyspend/react/components/icons/QrCodeIcon.tsx +25 -0
  88. package/src/anyspend/react/components/icons/credit-card.svg +5 -0
  89. package/src/anyspend/react/components/icons/qr-code.svg +5 -0
  90. package/src/anyspend/react/components/index.ts +2 -0
  91. package/src/anyspend/react/hooks/index.ts +1 -0
  92. package/src/anyspend/react/hooks/useAnyspendFlow.ts +37 -12
  93. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +110 -0
  94. package/src/anyspend/types/api.ts +67 -2
  95. package/src/anyspend/utils/format.ts +33 -5
  96. package/src/global-account/react/stores/useModalStore.ts +4 -0
  97. package/src/styles/index.css +2 -0
@@ -0,0 +1,5 @@
1
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z" fill="#F4F4F5"/>
3
+ <path d="M8 0.5H32C36.1421 0.5 39.5 3.85786 39.5 8V32C39.5 36.1421 36.1421 39.5 32 39.5H8C3.85786 39.5 0.5 36.1421 0.5 32V8C0.5 3.85786 3.85786 0.5 8 0.5Z" stroke="#E4E4E7"/>
4
+ <path d="M15 20H20V25M11.01 20H11M16.01 25H16M20.01 29H20M29.01 20H29M11 25H12.5M23.5 20H25.5M11 29H16M20 10V16M25.6 29H27.4C27.9601 29 28.2401 29 28.454 28.891C28.6422 28.7951 28.7951 28.6422 28.891 28.454C29 28.2401 29 27.9601 29 27.4V25.6C29 25.0399 29 24.7599 28.891 24.546C28.7951 24.3578 28.6422 24.2049 28.454 24.109C28.2401 24 27.9601 24 27.4 24H25.6C25.0399 24 24.7599 24 24.546 24.109C24.3578 24.2049 24.2049 24.3578 24.109 24.546C24 24.7599 24 25.0399 24 25.6V27.4C24 27.9601 24 28.2401 24.109 28.454C24.2049 28.6422 24.3578 28.7951 24.546 28.891C24.7599 29 25.0399 29 25.6 29ZM25.6 16H27.4C27.9601 16 28.2401 16 28.454 15.891C28.6422 15.7951 28.7951 15.6422 28.891 15.454C29 15.2401 29 14.9601 29 14.4V12.6C29 12.0399 29 11.7599 28.891 11.546C28.7951 11.3578 28.6422 11.2049 28.454 11.109C28.2401 11 27.9601 11 27.4 11H25.6C25.0399 11 24.7599 11 24.546 11.109C24.3578 11.2049 24.2049 11.3578 24.109 11.546C24 11.7599 24 12.0399 24 12.6V14.4C24 14.9601 24 15.2401 24.109 15.454C24.2049 15.6422 24.3578 15.7951 24.546 15.891C24.7599 16 25.0399 16 25.6 16ZM12.6 16H14.4C14.9601 16 15.2401 16 15.454 15.891C15.6422 15.7951 15.7951 15.6422 15.891 15.454C16 15.2401 16 14.9601 16 14.4V12.6C16 12.0399 16 11.7599 15.891 11.546C15.7951 11.3578 15.6422 11.2049 15.454 11.109C15.2401 11 14.9601 11 14.4 11H12.6C12.0399 11 11.7599 11 11.546 11.109C11.3578 11.2049 11.2049 11.3578 11.109 11.546C11 11.7599 11 12.0399 11 12.6V14.4C11 14.9601 11 15.2401 11.109 15.454C11.2049 15.6422 11.3578 15.7951 11.546 15.891C11.7599 16 12.0399 16 12.6 16Z" stroke="#51525C" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </svg>
@@ -5,6 +5,8 @@ export { AnySpendBuySpin } from "./AnySpendBuySpin";
5
5
  export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
6
6
  export { AnySpendCustom } from "./AnySpendCustom";
7
7
  export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
8
+ export { AnySpendDeposit } from "./AnySpendDeposit";
9
+ export type { AnySpendDepositProps, ChainConfig, DepositContractConfig } from "./AnySpendDeposit";
8
10
  export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
9
11
  export * from "./AnySpendFingerprintWrapper";
10
12
  export { AnySpendNFT } from "./AnySpendNFT";
@@ -1,5 +1,6 @@
1
1
  export * from "./useAnyspendCreateOnrampOrder";
2
2
  export * from "./useAnyspendCreateOrder";
3
+ export * from "./useCreateDepositFirstOrder";
3
4
  export * from "./useAnyspendOrderAndTransactions";
4
5
  export * from "./useAnyspendOrderHistory";
5
6
  export * from "./useAnyspendQuote";
@@ -21,6 +21,7 @@ import { useEffect, useMemo, useState } from "react";
21
21
  import { parseUnits } from "viem";
22
22
  import { base, mainnet } from "viem/chains";
23
23
  import { components } from "../../types/api";
24
+ import { GetQuoteRequest } from "../../types/api_req_res";
24
25
  import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
25
26
  import { FiatPaymentMethod } from "../components/common/FiatPaymentMethod";
26
27
  import { useAutoSelectCryptoPaymentMethod } from "./useAutoSelectCryptoPaymentMethod";
@@ -52,7 +53,7 @@ interface UseAnyspendFlowProps {
52
53
  destinationTokenChainId?: number;
53
54
  slippage?: number;
54
55
  disableUrlParamManagement?: boolean;
55
- orderType?: "hype_duel" | "custom_exact_in";
56
+ orderType?: "hype_duel" | "custom_exact_in" | "swap";
56
57
  }
57
58
 
58
59
  // This hook serves for order hype_duel and custom_exact_in
@@ -60,7 +61,6 @@ export function useAnyspendFlow({
60
61
  paymentType = "crypto",
61
62
  recipientAddress,
62
63
  loadOrder,
63
- isDepositMode = false,
64
64
  onOrderSuccess,
65
65
  onTransactionSuccess,
66
66
  sourceTokenAddress,
@@ -199,16 +199,41 @@ export function useAnyspendFlow({
199
199
  // For fiat payments, always use USDC decimals (6) regardless of selectedSrcToken
200
200
  const effectiveDecimals = paymentType === "fiat" ? USDC_BASE.decimals : selectedSrcToken.decimals;
201
201
  const activeInputAmountInWei = parseUnits(srcAmount.replace(/,/g, ""), effectiveDecimals).toString();
202
- const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote({
203
- srcChain: paymentType === "fiat" ? base.id : selectedSrcChainId,
204
- dstChain: isDepositMode ? base.id : selectedDstChainId, // For deposits, always Base; for swaps, use selected destination
205
- srcTokenAddress: paymentType === "fiat" ? USDC_BASE.address : selectedSrcToken.address,
206
- dstTokenAddress: selectedDstToken.address,
207
- type: orderType,
208
- amount: activeInputAmountInWei,
209
- recipientAddress: effectiveRecipientAddress,
210
- onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
211
- });
202
+
203
+ // Build quote request based on order type
204
+ const quoteRequest: GetQuoteRequest = (() => {
205
+ const baseParams = {
206
+ srcChain: paymentType === "fiat" ? base.id : selectedSrcChainId,
207
+ dstChain: selectedDstChainId ?? base.id,
208
+ srcTokenAddress: paymentType === "fiat" ? USDC_BASE.address : selectedSrcToken.address,
209
+ dstTokenAddress: selectedDstToken.address,
210
+ recipientAddress: effectiveRecipientAddress,
211
+ onrampVendor: paymentType === "fiat" ? getOnrampVendor(selectedFiatPaymentMethod) : undefined,
212
+ };
213
+
214
+ if (orderType === "swap") {
215
+ return {
216
+ ...baseParams,
217
+ type: "swap" as const,
218
+ tradeType: "EXACT_INPUT" as const,
219
+ amount: activeInputAmountInWei,
220
+ };
221
+ } else if (orderType === "hype_duel") {
222
+ return {
223
+ ...baseParams,
224
+ type: "hype_duel" as const,
225
+ amount: activeInputAmountInWei,
226
+ };
227
+ } else {
228
+ return {
229
+ ...baseParams,
230
+ type: "custom_exact_in" as const,
231
+ amount: activeInputAmountInWei,
232
+ };
233
+ }
234
+ })();
235
+
236
+ const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote(quoteRequest);
212
237
 
213
238
  // Get geo options for fiat
214
239
  const { geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support } = useGeoOnrampOptions(
@@ -0,0 +1,110 @@
1
+ import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend";
2
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
3
+ import { VisitorData } from "@b3dotfun/sdk/anyspend/types/fingerprint";
4
+ import { normalizeAddress } from "@b3dotfun/sdk/anyspend/utils";
5
+ import { useB3 } from "@b3dotfun/sdk/global-account/react";
6
+ import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
7
+ import { useMutation } from "@tanstack/react-query";
8
+ import { useMemo } from "react";
9
+ import { DepositContractConfig } from "../components/AnySpendDeposit";
10
+
11
+ export type CreateDepositFirstOrderParams = {
12
+ recipientAddress: string;
13
+ srcChain: number;
14
+ dstChain: number;
15
+ srcToken: components["schemas"]["Token"];
16
+ dstToken: components["schemas"]["Token"];
17
+ creatorAddress?: string;
18
+ /** Optional contract config for custom execution after deposit */
19
+ contractConfig?: DepositContractConfig;
20
+ };
21
+
22
+ export type UseCreateDepositFirstOrderProps = {
23
+ onSuccess?: (data: any) => void;
24
+ onError?: (error: Error) => void;
25
+ };
26
+
27
+ /**
28
+ * Hook for creating deposit_first orders in the Anyspend protocol.
29
+ * This order type doesn't require srcAmount - the user deposits tokens after the order is created.
30
+ */
31
+ export function useCreateDepositFirstOrder({ onSuccess, onError }: UseCreateDepositFirstOrderProps = {}) {
32
+ const { partnerId } = useB3();
33
+
34
+ const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
35
+ const visitorData: VisitorData | undefined = fpData && {
36
+ requestId: fpData.requestId,
37
+ visitorId: fpData.visitorId,
38
+ };
39
+
40
+ const { mutate: createOrder, isPending } = useMutation({
41
+ mutationFn: async (params: CreateDepositFirstOrderParams) => {
42
+ const { recipientAddress, srcChain, dstChain, srcToken, dstToken, creatorAddress, contractConfig } = params;
43
+
44
+ // Build payload based on whether we have a contract config
45
+ const payload = contractConfig
46
+ ? {
47
+ functionAbi: contractConfig.functionAbi,
48
+ functionName: contractConfig.functionName,
49
+ functionArgs: contractConfig.functionArgs,
50
+ to: normalizeAddress(contractConfig.to),
51
+ spenderAddress: contractConfig.spenderAddress ? normalizeAddress(contractConfig.spenderAddress) : undefined,
52
+ action: contractConfig.action,
53
+ }
54
+ : {};
55
+
56
+ try {
57
+ return await anyspendService.createOrder({
58
+ recipientAddress: normalizeAddress(recipientAddress),
59
+ type: "deposit_first",
60
+ srcChain,
61
+ dstChain,
62
+ srcTokenAddress: normalizeAddress(srcToken.address),
63
+ dstTokenAddress: normalizeAddress(dstToken.address),
64
+ srcAmount: "", // Not required for deposit_first
65
+ payload,
66
+ metadata: {
67
+ srcToken: {
68
+ chainId: srcToken.chainId,
69
+ address: srcToken.address,
70
+ symbol: srcToken.symbol,
71
+ name: srcToken.name,
72
+ decimals: srcToken.decimals,
73
+ metadata: srcToken.metadata || {},
74
+ },
75
+ dstToken: {
76
+ chainId: dstToken.chainId,
77
+ address: dstToken.address,
78
+ symbol: dstToken.symbol,
79
+ name: dstToken.name,
80
+ decimals: dstToken.decimals,
81
+ metadata: dstToken.metadata || {},
82
+ },
83
+ },
84
+ creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
85
+ partnerId,
86
+ visitorData,
87
+ });
88
+ } catch (error: any) {
89
+ if (error?.data) {
90
+ throw error.data;
91
+ }
92
+ throw error;
93
+ }
94
+ },
95
+ onSuccess: (data: any) => {
96
+ onSuccess?.(data);
97
+ },
98
+ onError: (error: Error) => {
99
+ onError?.(error);
100
+ },
101
+ });
102
+
103
+ return useMemo(
104
+ () => ({
105
+ createOrder,
106
+ isCreatingOrder: isPending,
107
+ }),
108
+ [createOrder, isPending],
109
+ );
110
+ }
@@ -1961,6 +1961,15 @@ export interface components {
1961
1961
  */
1962
1962
  fundAmount: string;
1963
1963
  };
1964
+ /** @description DepositFirst payload - empty at creation time, details determined after deposit is detected */
1965
+ DepositFirstPayload: Record<string, never>;
1966
+ /** @description DepositFirst metadata for display purposes */
1967
+ DepositFirstMetadata: {
1968
+ /** @description Token accepted for deposit */
1969
+ srcToken: components["schemas"]["Token"];
1970
+ /** @description Token to swap to after deposit */
1971
+ dstToken: components["schemas"]["Token"];
1972
+ };
1964
1973
  /** @description Swap metadata for display purposes */
1965
1974
  SwapMetadata: {
1966
1975
  srcToken: components["schemas"]["Token"];
@@ -2051,6 +2060,7 @@ export interface components {
2051
2060
  | "waiting_stripe_payment"
2052
2061
  | "expired"
2053
2062
  | "sending_token_from_vault"
2063
+ | "quoting_after_deposit"
2054
2064
  | "relay"
2055
2065
  | "executing"
2056
2066
  | "executed"
@@ -2186,6 +2196,15 @@ export interface components {
2186
2196
  payload: components["schemas"]["FundTournamentPayload"];
2187
2197
  metadata: components["schemas"]["TournamentMetadata"];
2188
2198
  };
2199
+ DepositFirstOrder: components["schemas"]["BaseOrder"] & {
2200
+ /**
2201
+ * @description Order type for deposit-first flow where amount is determined after deposit
2202
+ * @enum {string}
2203
+ */
2204
+ type: "deposit_first";
2205
+ payload: components["schemas"]["DepositFirstPayload"];
2206
+ metadata: components["schemas"]["DepositFirstMetadata"];
2207
+ };
2189
2208
  Order:
2190
2209
  | components["schemas"]["SwapOrder"]
2191
2210
  | components["schemas"]["X402SwapOrder"]
@@ -2194,7 +2213,8 @@ export interface components {
2194
2213
  | components["schemas"]["CustomExactInOrder"]
2195
2214
  | components["schemas"]["MintNftOrder"]
2196
2215
  | components["schemas"]["JoinTournamentOrder"]
2197
- | components["schemas"]["FundTournamentOrder"];
2216
+ | components["schemas"]["FundTournamentOrder"]
2217
+ | components["schemas"]["DepositFirstOrder"];
2198
2218
  /** @description Swap order request */
2199
2219
  SwapOrderRequest: {
2200
2220
  /**
@@ -2595,6 +2615,50 @@ export interface components {
2595
2615
  */
2596
2616
  creatorAddress?: string;
2597
2617
  };
2618
+ /** @description Deposit-first order request. The srcAmount is determined after deposit is detected, so it is not required at creation time. This flow does not support onramp - users deposit crypto directly. */
2619
+ DepositFirstOrderRequest: {
2620
+ /**
2621
+ * @description Order type for deposit-first flow
2622
+ * @enum {string}
2623
+ */
2624
+ type: "deposit_first";
2625
+ /**
2626
+ * @description Address to receive the destination tokens after swap
2627
+ * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
2628
+ */
2629
+ recipientAddress: string;
2630
+ /**
2631
+ * @description Source chain ID where deposit will be made
2632
+ * @example 8453
2633
+ */
2634
+ srcChain: number;
2635
+ /**
2636
+ * @description Destination chain ID for the swap
2637
+ * @example 8453
2638
+ */
2639
+ dstChain: number;
2640
+ /**
2641
+ * @description Token contract address that will be deposited
2642
+ * @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
2643
+ */
2644
+ srcTokenAddress: string;
2645
+ /**
2646
+ * @description Token contract address to receive after swap
2647
+ * @example 0x0000000000000000000000000000000000000000
2648
+ */
2649
+ dstTokenAddress: string;
2650
+ payload: components["schemas"]["DepositFirstPayload"];
2651
+ metadata: components["schemas"]["DepositFirstMetadata"];
2652
+ /** @description Optional partner identifier */
2653
+ partnerId?: string;
2654
+ /** @description Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars) */
2655
+ clientReferenceId?: string;
2656
+ /**
2657
+ * @description Optional address of the order creator
2658
+ * @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
2659
+ */
2660
+ creatorAddress?: string;
2661
+ };
2598
2662
  OrderRequest:
2599
2663
  | components["schemas"]["SwapOrderRequest"]
2600
2664
  | components["schemas"]["X402SwapOrderRequest"]
@@ -2603,7 +2667,8 @@ export interface components {
2603
2667
  | components["schemas"]["CustomExactInOrderRequest"]
2604
2668
  | components["schemas"]["MintNftOrderRequest"]
2605
2669
  | components["schemas"]["JoinTournamentOrderRequest"]
2606
- | components["schemas"]["FundTournamentOrderRequest"];
2670
+ | components["schemas"]["FundTournamentOrderRequest"]
2671
+ | components["schemas"]["DepositFirstOrderRequest"];
2607
2672
  /** @description Deposit transaction (payment from user) */
2608
2673
  DepositTx: {
2609
2674
  /**
@@ -1,14 +1,29 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
+ import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
2
3
 
3
4
  export const getStatusDisplay = (
4
5
  order: components["schemas"]["Order"],
5
6
  ): { text: string; status: "processing" | "success" | "failure"; description?: string } => {
7
+ const srcToken = order.metadata?.srcToken;
8
+ const dstToken = order.metadata?.dstToken;
9
+ const formattedSrcAmount = srcToken ? formatTokenAmount(BigInt(order.srcAmount), srcToken.decimals) : undefined;
10
+ const actualDstAmount = order.settlement?.actualDstAmount;
11
+ const formattedActualDstAmount =
12
+ actualDstAmount && dstToken ? formatTokenAmount(BigInt(actualDstAmount), dstToken.decimals) : undefined;
13
+
6
14
  switch (order.status) {
7
- case "scanning_deposit_transaction":
15
+ case "scanning_deposit_transaction": {
16
+ const depositText =
17
+ formattedSrcAmount && srcToken
18
+ ? `Awaiting ${formattedSrcAmount} ${srcToken.symbol}`
19
+ : order.onrampMetadata
20
+ ? "Awaiting Payment"
21
+ : "Awaiting Deposit";
8
22
  return {
9
- text: order.onrampMetadata ? "Awaiting Payment" : "Awaiting Deposit",
23
+ text: depositText,
10
24
  status: "processing",
11
25
  };
26
+ }
12
27
  case "waiting_stripe_payment":
13
28
  return {
14
29
  text: "Awaiting Payment",
@@ -34,16 +49,18 @@ export const getStatusDisplay = (
34
49
  description: "It will take approximately one minute to complete.",
35
50
  };
36
51
  case "executed": {
52
+ const receivedText =
53
+ formattedActualDstAmount && dstToken ? `Received ${formattedActualDstAmount} ${dstToken.symbol}` : undefined;
37
54
  const { text, description } =
38
55
  order.type === "swap"
39
- ? { text: "Swap Complete", description: "Your swap has been completed successfully." }
56
+ ? { text: receivedText || "Swap Complete", description: "Your swap has been completed successfully." }
40
57
  : order.type === "mint_nft"
41
58
  ? { text: "NFT Minted", description: "Your NFT has been minted" }
42
59
  : order.type === "join_tournament"
43
60
  ? { text: "Tournament Joined", description: "You have joined the tournament" }
44
61
  : order.type === "fund_tournament"
45
62
  ? { text: "Tournament Funded", description: "You have funded the tournament" }
46
- : { text: "Order Complete", description: "Your order has been completed" };
63
+ : { text: receivedText || "Order Complete", description: "Your order has been completed" };
47
64
  return { text, status: "success", description };
48
65
  }
49
66
 
@@ -59,8 +76,19 @@ export const getStatusDisplay = (
59
76
  description: "This order has failed. Please try again or contact support.",
60
77
  };
61
78
 
79
+ case "quoting_after_deposit": {
80
+ return {
81
+ text: "Quoting After Deposit",
82
+ status: "processing",
83
+ description: "Getting quote for the order",
84
+ };
85
+ }
86
+
62
87
  default:
63
- throw new Error("Invalid order status");
88
+ return {
89
+ text: order.status,
90
+ status: "processing",
91
+ };
64
92
  }
65
93
  };
66
94
 
@@ -151,6 +151,10 @@ export interface AnySpendModalProps extends BaseModalProps {
151
151
  customUsdInputValues?: string[];
152
152
  /** Client-provided reference ID for tracking orders */
153
153
  clientReferenceId?: string;
154
+ /** Whether to hide the header */
155
+ hideHeader?: boolean;
156
+ /** When true, disables URL parameter management for swap configuration */
157
+ disableUrlParamManagement?: boolean;
154
158
  }
155
159
 
156
160
  /**
@@ -152,6 +152,7 @@
152
152
  --red-100: #fde6d7;
153
153
  --green-100: #dff9e8;
154
154
  --border-brand: #2a9fff;
155
+ --border-primary: #d1d1d6;
155
156
  --yellow-100: #fee6c7;
156
157
  --purple-100: #f5edfa;
157
158
  --purple-300: #ddc3ef;
@@ -249,6 +250,7 @@ html[data-theme="dark"] .b3-root,
249
250
  --red-100: #6a5550;
250
251
  --green-100: rgba(68, 90, 76, 0.57);
251
252
  --border-brand: #2a9fff;
253
+ --border-primary: #d1d1d6;
252
254
  --yellow-100: #957a6c;
253
255
  --purple-100: rgba(113, 88, 126, 0.38);
254
256
  --purple-300: #a375c3;