@b3dotfun/sdk 0.1.65-alpha.4 → 0.1.65-alpha.6

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 (62) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -0
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +4 -2
  3. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +62 -50
  4. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
  5. package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +4 -2
  6. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  7. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +2 -2
  8. package/dist/cjs/anyspend/react/components/ccShopAbi.d.ts +113 -0
  9. package/dist/cjs/anyspend/react/components/ccShopAbi.js +63 -0
  10. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +1 -3
  11. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +3 -3
  12. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +1 -4
  13. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +3 -57
  14. package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
  15. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -0
  16. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  17. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -0
  18. package/dist/cjs/anyspend/services/anyspend.d.ts +2 -1
  19. package/dist/cjs/anyspend/services/anyspend.js +2 -1
  20. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  21. package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -0
  22. package/dist/esm/anyspend/react/components/AnySpend.js +4 -2
  23. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +60 -48
  24. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
  25. package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +4 -2
  26. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  27. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +2 -2
  28. package/dist/esm/anyspend/react/components/ccShopAbi.d.ts +113 -0
  29. package/dist/esm/anyspend/react/components/ccShopAbi.js +60 -0
  30. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +1 -3
  31. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +3 -3
  32. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +1 -4
  33. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +2 -56
  34. package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
  35. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -0
  36. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  37. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -0
  38. package/dist/esm/anyspend/services/anyspend.d.ts +2 -1
  39. package/dist/esm/anyspend/services/anyspend.js +2 -1
  40. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  41. package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -0
  42. package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +2 -0
  43. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  44. package/dist/types/anyspend/react/components/ccShopAbi.d.ts +113 -0
  45. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +1 -3
  46. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +1 -4
  47. package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  48. package/dist/types/anyspend/services/anyspend.d.ts +2 -1
  49. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  50. package/package.json +1 -1
  51. package/src/anyspend/react/components/AnySpend.tsx +6 -1
  52. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +76 -51
  53. package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +5 -1
  54. package/src/anyspend/react/components/AnySpendDeposit.tsx +5 -0
  55. package/src/anyspend/react/components/ccShopAbi.ts +64 -0
  56. package/src/anyspend/react/components/common/CryptoPaySection.tsx +0 -5
  57. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +1 -70
  58. package/src/anyspend/react/components/common/PaySection.tsx +0 -1
  59. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +1 -0
  60. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -0
  61. package/src/anyspend/services/anyspend.ts +3 -0
  62. package/src/global-account/react/stores/useModalStore.ts +2 -0
@@ -53,4 +53,6 @@ export declare function AnySpend(props: {
53
53
  allowDirectTransfer?: boolean;
54
54
  /** Fixed destination token amount (in wei/smallest unit). When provided, user cannot change the amount. */
55
55
  destinationTokenAmount?: string;
56
+ /** Opaque metadata passed to the order for callbacks (e.g., workflow form data) */
57
+ callbackMetadata?: Record<string, unknown>;
56
58
  }): import("react/jsx-runtime").JSX.Element;
@@ -62,7 +62,7 @@ function AnySpend(props) {
62
62
  console.log("[mitch] AnySpend rendered with fingerprintConfig:", props, fingerprintConfig);
63
63
  return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendInner, { ...props }) }));
64
64
  }
65
- function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, }) {
65
+ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, }) {
66
66
  const searchParams = (0, react_2.useSearchParamsSSR)();
67
67
  const router = (0, react_2.useRouter)();
68
68
  const { partnerId } = (0, react_2.useB3Config)();
@@ -720,6 +720,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
720
720
  srcAmount: srcAmountBigInt.toString(),
721
721
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount || "0",
722
722
  creatorAddress: globalAddress,
723
+ callbackMetadata,
723
724
  });
724
725
  }
725
726
  catch (err) {
@@ -794,6 +795,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
794
795
  },
795
796
  expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
796
797
  creatorAddress: globalAddress,
798
+ callbackMetadata,
797
799
  });
798
800
  }
799
801
  catch (err) {
@@ -880,7 +882,7 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
880
882
  // Reset payment methods when switching tabs
881
883
  resetPaymentMethods();
882
884
  setSelectedFiatPaymentMethod(FiatPaymentMethod_1.FiatPaymentMethod.NONE);
883
- }, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), skipAutoMaxOnTokenChange: !!destinationTokenAmount })) : ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
885
+ }, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => navigateToPanel(PanelView.CRYPTO_PAYMENT_METHOD, "forward"), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") })) : ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: (panelIndex) => {
884
886
  // Map panel index to navigation with direction
885
887
  const panelsWithForwardNav = [PanelView.FIAT_PAYMENT_METHOD, PanelView.RECIPIENT_SELECTION];
886
888
  if (panelsWithForwardNav.includes(panelIndex)) {
@@ -35,46 +35,11 @@ const react_1 = require("react");
35
35
  const viem_1 = require("viem");
36
36
  const chains_1 = require("viem/chains");
37
37
  const AnySpendCustom_1 = require("./AnySpendCustom");
38
+ const ccShopAbi_1 = require("./ccShopAbi");
38
39
  // Collector Club Shop contract addresses on Base
39
40
  const CC_SHOP_ADDRESS = "0x47366E64E4917dd4DdC04Fb9DC507c1dD2b87294";
40
41
  const CC_SHOP_ADDRESS_STAGING = "0x8b751143342ac41eB965E55430e3F7Adf6BE01fA";
41
42
  const BASE_CHAIN_ID = 8453;
42
- // ABI for buyPacksFor function only
43
- const BUY_PACKS_FOR_ABI = {
44
- inputs: [
45
- { internalType: "address", name: "user", type: "address" },
46
- { internalType: "uint256", name: "packId", type: "uint256" },
47
- { internalType: "uint256", name: "amount", type: "uint256" },
48
- ],
49
- name: "buyPacksFor",
50
- outputs: [],
51
- stateMutability: "nonpayable",
52
- type: "function",
53
- };
54
- // ABI for buyPacksForWithDiscount function (with discount code)
55
- const BUY_PACKS_FOR_WITH_DISCOUNT_ABI = {
56
- inputs: [
57
- { internalType: "address", name: "user", type: "address" },
58
- { internalType: "uint256", name: "packId", type: "uint256" },
59
- { internalType: "uint256", name: "amount", type: "uint256" },
60
- { internalType: "string", name: "discountCode", type: "string" },
61
- ],
62
- name: "buyPacksForWithDiscount",
63
- outputs: [],
64
- stateMutability: "nonpayable",
65
- type: "function",
66
- };
67
- // ABI for isDiscountCodeValid view function
68
- const IS_DISCOUNT_CODE_VALID_ABI = {
69
- inputs: [{ internalType: "string", name: "code", type: "string" }],
70
- name: "isDiscountCodeValid",
71
- outputs: [
72
- { internalType: "bool", name: "isValid", type: "bool" },
73
- { internalType: "uint256", name: "discountAmount", type: "uint256" },
74
- ],
75
- stateMutability: "view",
76
- type: "function",
77
- };
78
43
  const basePublicClient = (0, viem_1.createPublicClient)({
79
44
  chain: chains_1.base,
80
45
  transport: (0, viem_1.http)(constants_2.PUBLIC_BASE_RPC_URL),
@@ -95,38 +60,78 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
95
60
  const [discountInfo, setDiscountInfo] = (0, react_1.useState)({
96
61
  isValid: false,
97
62
  discountAmount: BigInt(0),
63
+ minPurchaseAmount: BigInt(0),
98
64
  isLoading: false,
99
65
  error: null,
100
66
  });
101
67
  // Validate discount code on-chain when provided
102
68
  (0, react_1.useEffect)(() => {
103
69
  if (!discountCode) {
104
- setDiscountInfo({ isValid: false, discountAmount: BigInt(0), isLoading: false, error: null });
70
+ setDiscountInfo({
71
+ isValid: false,
72
+ discountAmount: BigInt(0),
73
+ minPurchaseAmount: BigInt(0),
74
+ isLoading: false,
75
+ error: null,
76
+ });
105
77
  return;
106
78
  }
107
79
  let cancelled = false;
108
80
  const validateDiscount = async () => {
109
81
  setDiscountInfo(prev => ({ ...prev, isLoading: true, error: null }));
110
82
  try {
111
- const result = await basePublicClient.readContract({
112
- address: ccShopAddress,
113
- abi: [IS_DISCOUNT_CODE_VALID_ABI],
114
- functionName: "isDiscountCodeValid",
115
- args: [discountCode],
116
- });
83
+ // Validate against specific pack and fetch full details in parallel
84
+ const [validForPack, codeDetails] = await Promise.all([
85
+ basePublicClient.readContract({
86
+ address: ccShopAddress,
87
+ abi: [ccShopAbi_1.IS_DISCOUNT_CODE_VALID_FOR_PACK_ABI],
88
+ functionName: "isDiscountCodeValidForPack",
89
+ args: [discountCode, BigInt(packId)],
90
+ }),
91
+ basePublicClient.readContract({
92
+ address: ccShopAddress,
93
+ abi: [ccShopAbi_1.GET_DISCOUNT_CODE_ABI],
94
+ functionName: "getDiscountCode",
95
+ args: [discountCode],
96
+ }),
97
+ ]);
117
98
  if (cancelled)
118
99
  return;
119
- const [isValid, discountAmount] = result;
120
- if (!isValid) {
100
+ const [isValid, discountAmount] = validForPack;
101
+ const { minPurchaseAmount, packId: restrictedPackId, exists } = codeDetails;
102
+ if (!exists) {
121
103
  setDiscountInfo({
122
104
  isValid: false,
123
105
  discountAmount: BigInt(0),
106
+ minPurchaseAmount: BigInt(0),
124
107
  isLoading: false,
125
- error: "Invalid or expired discount code",
108
+ error: "Discount code does not exist",
126
109
  });
127
110
  return;
128
111
  }
129
- setDiscountInfo({ isValid: true, discountAmount, isLoading: false, error: null });
112
+ if (!isValid) {
113
+ // Provide specific error based on code details
114
+ if (restrictedPackId !== BigInt(0) && restrictedPackId !== BigInt(packId)) {
115
+ setDiscountInfo({
116
+ isValid: false,
117
+ discountAmount: BigInt(0),
118
+ minPurchaseAmount: BigInt(0),
119
+ isLoading: false,
120
+ error: "Discount code is not valid for this pack",
121
+ });
122
+ }
123
+ else {
124
+ setDiscountInfo({
125
+ isValid: false,
126
+ discountAmount: BigInt(0),
127
+ minPurchaseAmount: BigInt(0),
128
+ isLoading: false,
129
+ error: "Invalid or expired discount code",
130
+ });
131
+ }
132
+ return;
133
+ }
134
+ setDiscountInfo({ isValid: true, discountAmount, minPurchaseAmount, isLoading: false, error: null });
130
135
  }
131
136
  catch (error) {
132
137
  if (cancelled)
@@ -135,6 +140,7 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
135
140
  setDiscountInfo({
136
141
  isValid: false,
137
142
  discountAmount: BigInt(0),
143
+ minPurchaseAmount: BigInt(0),
138
144
  isLoading: false,
139
145
  error: "Failed to validate discount code",
140
146
  });
@@ -144,7 +150,7 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
144
150
  return () => {
145
151
  cancelled = true;
146
152
  };
147
- }, [discountCode, ccShopAddress]);
153
+ }, [discountCode, ccShopAddress, packId]);
148
154
  // Calculate effective dstAmount after discount
149
155
  const effectiveDstAmount = (0, react_1.useMemo)(() => {
150
156
  if (!discountCode || !discountInfo.isValid || discountInfo.discountAmount === BigInt(0)) {
@@ -169,13 +175,13 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
169
175
  try {
170
176
  if (discountCode && discountInfo.isValid) {
171
177
  return (0, viem_1.encodeFunctionData)({
172
- abi: [BUY_PACKS_FOR_WITH_DISCOUNT_ABI],
178
+ abi: [ccShopAbi_1.BUY_PACKS_FOR_WITH_DISCOUNT_ABI],
173
179
  functionName: "buyPacksForWithDiscount",
174
180
  args: [recipientAddress, BigInt(packId), BigInt(packAmount), discountCode],
175
181
  });
176
182
  }
177
183
  return (0, viem_1.encodeFunctionData)({
178
- abi: [BUY_PACKS_FOR_ABI],
184
+ abi: [ccShopAbi_1.BUY_PACKS_FOR_ABI],
179
185
  functionName: "buyPacksFor",
180
186
  args: [recipientAddress, BigInt(packId), BigInt(packAmount)],
181
187
  });
@@ -194,6 +200,12 @@ function AnySpendCollectorClubPurchase({ loadOrder, mode = "modal", activeTab =
194
200
  if (discountCode && discountInfo.error) {
195
201
  return ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-red-500", children: discountInfo.error }) }));
196
202
  }
203
+ if (discountCode &&
204
+ discountInfo.isValid &&
205
+ discountInfo.minPurchaseAmount > BigInt(0) &&
206
+ BigInt(packAmount) < discountInfo.minPurchaseAmount) {
207
+ return ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-sm text-red-500", children: ["Minimum purchase of ", discountInfo.minPurchaseAmount.toString(), " pack", discountInfo.minPurchaseAmount > BigInt(1) ? "s" : "", " required for this discount code"] }) }));
208
+ }
197
209
  if (discountCode && discountInfo.isValid && effectiveDstAmount === "0") {
198
210
  return ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-red-500", children: "Discount exceeds total price" }) }));
199
211
  }
@@ -44,6 +44,8 @@ export interface AnySpendCustomExactInProps {
44
44
  classes?: AnySpendCustomExactInClasses;
45
45
  /** When true, allows direct transfer without swap if source and destination token/chain are the same */
46
46
  allowDirectTransfer?: boolean;
47
+ /** Opaque metadata passed to the order for callbacks (e.g., workflow form data) */
48
+ callbackMetadata?: Record<string, unknown>;
47
49
  }
48
50
  export declare function AnySpendCustomExactIn(props: AnySpendCustomExactInProps): import("react/jsx-runtime").JSX.Element;
49
51
  export {};
@@ -35,7 +35,7 @@ function AnySpendCustomExactIn(props) {
35
35
  const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
36
36
  return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomExactInInner, { ...props }) }));
37
37
  }
38
- function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, destinationTokenAmount, orderType = "custom_exact_in", minDestinationAmount, header, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, }) {
38
+ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, destinationTokenAmount, orderType = "custom_exact_in", minDestinationAmount, header, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, allowDirectTransfer = false, callbackMetadata, }) {
39
39
  const actionLabel = customExactInConfig?.action ?? "Custom Execution";
40
40
  const setB3ModalOpen = (0, react_2.useModalStore)(state => state.setB3ModalOpen);
41
41
  const DESTINATION_TOKEN_DETAILS = {
@@ -228,7 +228,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
228
228
  };
229
229
  const headerContent = header ? (header({ anyspendPrice: anyspendQuote, isLoadingAnyspendPrice: isLoadingAnyspendQuote })) : ((0, jsx_runtime_1.jsx)("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-as-primary text-xl font-bold", children: actionLabel }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-secondary text-sm", children: "Pay from any token to execute a custom exact-in transaction." })] }) }));
230
230
  const mainView = ((0, jsx_runtime_1.jsxs)("div", { className: classes?.container ||
231
- "anyspend-custom-exact-in-container mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [headerContent, (0, jsx_runtime_1.jsx)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(useAnyspendFlow_1.PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect, skipAutoMaxOnTokenChange: !!destinationTokenAmount })) : ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: selectedRecipientOrDefault, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: useAnyspendFlow_1.PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.FEE_DETAIL), customUsdInputValues: customUsdInputValues, customRecipientLabel: customRecipientLabel }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: classes?.swapDirectionButton ||
231
+ "anyspend-custom-exact-in-container mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [headerContent, (0, jsx_runtime_1.jsx)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? ((0, jsx_runtime_1.jsx)(CryptoPaySection_1.CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, isSrcInputDirty: isSrcInputDirty, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: effectiveCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(useAnyspendFlow_1.PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : ((0, jsx_runtime_1.jsx)(react_3.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: (0, jsx_runtime_1.jsx)(PanelOnramp_1.PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: selectedRecipientOrDefault, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: useAnyspendFlow_1.PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.POINTS_DETAIL), onShowFeeDetail: () => setActivePanel(useAnyspendFlow_1.PanelView.FEE_DETAIL), customUsdInputValues: customUsdInputValues, customRecipientLabel: customRecipientLabel }) })), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: (0, jsx_runtime_1.jsx)(react_2.Button, { variant: "ghost", className: classes?.swapDirectionButton ||
232
232
  "swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", children: (0, jsx_runtime_1.jsx)("div", { className: "relative flex items-center justify-center transition-opacity", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && ((0, jsx_runtime_1.jsx)(CryptoReceiveSection_1.CryptoReceiveSection, { isDepositMode: false, isBuyMode: false, effectiveRecipientAddress: selectedRecipientOrDefault, recipientName: recipientName || undefined, customRecipientLabel: customRecipientLabel, onSelectRecipient: () => setActivePanel(useAnyspendFlow_1.PanelView.RECIPIENT_SELECTION), dstAmount: isSrcInputDirty && !destinationTokenAmount ? dstAmount : dstAmountInput, dstToken: selectedDstToken, dstTokenSymbol: DESTINATION_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: DESTINATION_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
233
233
  setIsSrcInputDirty(false);
234
234
  setDstAmountInput(value);
@@ -284,6 +284,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
284
284
  ? (0, utils_1.normalizeAddress)(customExactInConfig.spenderAddress)
285
285
  : undefined,
286
286
  },
287
+ callbackMetadata,
287
288
  });
288
289
  }
289
290
  else {
@@ -301,6 +302,7 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
301
302
  expectedDstAmount: expectedDstAmountRaw,
302
303
  creatorAddress: globalAddress,
303
304
  payload,
305
+ callbackMetadata,
304
306
  });
305
307
  }
306
308
  }
@@ -101,6 +101,8 @@ export interface AnySpendDepositProps {
101
101
  allowDirectTransfer?: boolean;
102
102
  /** Fixed destination token amount (in wei/smallest unit). When provided, user cannot change the amount. */
103
103
  destinationTokenAmount?: string;
104
+ /** Opaque metadata passed to the order for callbacks (e.g., workflow form data) */
105
+ callbackMetadata?: Record<string, unknown>;
104
106
  }
105
107
  /**
106
108
  * A flexible deposit component that wraps AnySpendCustomExactIn with optional chain selection.
@@ -137,4 +139,4 @@ export interface AnySpendDepositProps {
137
139
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
138
140
  * />
139
141
  */
140
- export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
142
+ export declare function AnySpendDeposit({ loadOrder, mode, recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains, minPoolSize, topChainsCount, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit, classes, allowDirectTransfer, destinationTokenAmount, callbackMetadata, }: AnySpendDepositProps): import("react/jsx-runtime").JSX.Element | null;
@@ -97,7 +97,7 @@ function ChainIcon({ chainId, className }) {
97
97
  * onSuccess={(amount) => console.log(`Deposited ${amount}`)}
98
98
  * />
99
99
  */
100
- function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, }) {
100
+ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentType: initialPaymentType, sourceTokenAddress, sourceTokenChainId: initialSourceChainId, destinationTokenAddress, destinationTokenChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, minDestinationAmount, header, orderType, depositContractConfig, showChainSelection, supportedChains = DEFAULT_SUPPORTED_CHAINS, minPoolSize = DEFAULT_MIN_POOL_SIZE, topChainsCount = 3, onClose, returnToHomeUrl, customRecipientLabel, returnHomeLabel, isCustomDeposit = false, classes, allowDirectTransfer = false, destinationTokenAmount, callbackMetadata, }) {
101
101
  // Extract deposit-specific classes for convenience
102
102
  const depositClasses = classes?.deposit;
103
103
  const { connectedEOAWallet } = (0, react_1.useAccountWallet)();
@@ -209,5 +209,5 @@ function AnySpendDeposit({ loadOrder, mode = "modal", recipientAddress, paymentT
209
209
  // Deposit view
210
210
  return ((0, jsx_runtime_1.jsxs)("div", { className: depositClasses?.form || "anyspend-deposit anyspend-deposit-form relative", children: [shouldShowChainSelection && ((0, jsx_runtime_1.jsxs)("button", { onClick: handleBack, className: depositClasses?.backButton ||
211
211
  "anyspend-deposit-back-button text-as-secondary hover:text-as-primary absolute left-4 top-4 z-10 flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: depositClasses?.backIcon || "anyspend-deposit-back-icon h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), (0, jsx_runtime_1.jsx)("span", { className: depositClasses?.backText || "anyspend-deposit-back-text text-sm", children: "Back" })] })), onClose && ((0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: depositClasses?.closeButton ||
212
- "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsx)("div", { className: depositClasses?.formContent || (0, cn_1.cn)("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isCustomDeposit ? ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationTokenChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel, classes: classes?.customExactIn, allowDirectTransfer: allowDirectTransfer, destinationTokenAmount: destinationTokenAmount }, selectedChainId)) : ((0, jsx_runtime_1.jsx)(AnySpend_1.AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel, classes: classes?.anySpend, allowDirectTransfer: allowDirectTransfer, destinationTokenAmount: destinationTokenAmount }, selectedChainId)) }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "px-4 pb-4" } })] }));
212
+ "anyspend-deposit-close-button text-as-secondary hover:text-as-primary absolute right-4 top-4 z-10", children: (0, jsx_runtime_1.jsx)("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), (0, jsx_runtime_1.jsx)("div", { className: depositClasses?.formContent || (0, cn_1.cn)("anyspend-deposit-form-content", shouldShowChainSelection && "pt-8"), children: isCustomDeposit ? ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, paymentType: paymentType, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: selectedChainId, destinationToken: destinationToken, destinationChainId: destinationTokenChainId, orderType: effectiveOrderType, minDestinationAmount: minDestinationAmount, header: header ?? defaultHeader, onSuccess: onSuccess, onOpenCustomModal: onOpenCustomModal, mainFooter: mainFooter, onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, preferEoa: preferEoa, customExactInConfig: depositContractConfig, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel, classes: classes?.customExactIn, allowDirectTransfer: allowDirectTransfer, destinationTokenAmount: destinationTokenAmount, callbackMetadata: callbackMetadata }, selectedChainId)) : ((0, jsx_runtime_1.jsx)(AnySpend_1.AnySpend, { loadOrder: loadOrder, mode: mode, defaultActiveTab: paymentType, recipientAddress: recipientAddress, sourceChainId: selectedChainId, destinationTokenAddress: destinationTokenAddress, destinationTokenChainId: destinationTokenChainId, onSuccess: txHash => onSuccess?.(txHash ?? ""), onTokenSelect: onTokenSelect, customUsdInputValues: customUsdInputValues, hideHeader: true, hideBottomNavigation: true, disableUrlParamManagement: true, returnToHomeUrl: returnToHomeUrl, customRecipientLabel: customRecipientLabel, returnHomeLabel: returnHomeLabel, classes: classes?.anySpend, allowDirectTransfer: allowDirectTransfer, destinationTokenAmount: destinationTokenAmount, callbackMetadata: callbackMetadata }, selectedChainId)) }), (0, jsx_runtime_1.jsx)(WarningText_1.ChainWarningText, { chainId: destinationTokenChainId, classes: classes?.chainWarningText || { root: "px-4 pb-4" } })] }));
213
213
  }
@@ -0,0 +1,113 @@
1
+ export declare const BUY_PACKS_FOR_ABI: {
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "user";
5
+ readonly type: "address";
6
+ }, {
7
+ readonly internalType: "uint256";
8
+ readonly name: "packId";
9
+ readonly type: "uint256";
10
+ }, {
11
+ readonly internalType: "uint256";
12
+ readonly name: "amount";
13
+ readonly type: "uint256";
14
+ }];
15
+ readonly name: "buyPacksFor";
16
+ readonly outputs: readonly [];
17
+ readonly stateMutability: "nonpayable";
18
+ readonly type: "function";
19
+ };
20
+ export declare const BUY_PACKS_FOR_WITH_DISCOUNT_ABI: {
21
+ readonly inputs: readonly [{
22
+ readonly internalType: "address";
23
+ readonly name: "user";
24
+ readonly type: "address";
25
+ }, {
26
+ readonly internalType: "uint256";
27
+ readonly name: "packId";
28
+ readonly type: "uint256";
29
+ }, {
30
+ readonly internalType: "uint256";
31
+ readonly name: "amount";
32
+ readonly type: "uint256";
33
+ }, {
34
+ readonly internalType: "string";
35
+ readonly name: "discountCode";
36
+ readonly type: "string";
37
+ }];
38
+ readonly name: "buyPacksForWithDiscount";
39
+ readonly outputs: readonly [];
40
+ readonly stateMutability: "nonpayable";
41
+ readonly type: "function";
42
+ };
43
+ export declare const IS_DISCOUNT_CODE_VALID_FOR_PACK_ABI: {
44
+ readonly inputs: readonly [{
45
+ readonly internalType: "string";
46
+ readonly name: "code";
47
+ readonly type: "string";
48
+ }, {
49
+ readonly internalType: "uint256";
50
+ readonly name: "packId";
51
+ readonly type: "uint256";
52
+ }];
53
+ readonly name: "isDiscountCodeValidForPack";
54
+ readonly outputs: readonly [{
55
+ readonly internalType: "bool";
56
+ readonly name: "isValid";
57
+ readonly type: "bool";
58
+ }, {
59
+ readonly internalType: "uint256";
60
+ readonly name: "discountAmount";
61
+ readonly type: "uint256";
62
+ }];
63
+ readonly stateMutability: "view";
64
+ readonly type: "function";
65
+ };
66
+ export declare const GET_DISCOUNT_CODE_ABI: {
67
+ readonly inputs: readonly [{
68
+ readonly internalType: "string";
69
+ readonly name: "code";
70
+ readonly type: "string";
71
+ }];
72
+ readonly name: "getDiscountCode";
73
+ readonly outputs: readonly [{
74
+ readonly components: readonly [{
75
+ readonly internalType: "uint256";
76
+ readonly name: "discountAmount";
77
+ readonly type: "uint256";
78
+ }, {
79
+ readonly internalType: "uint256";
80
+ readonly name: "expiresAt";
81
+ readonly type: "uint256";
82
+ }, {
83
+ readonly internalType: "bool";
84
+ readonly name: "used";
85
+ readonly type: "bool";
86
+ }, {
87
+ readonly internalType: "bool";
88
+ readonly name: "exists";
89
+ readonly type: "bool";
90
+ }, {
91
+ readonly internalType: "uint256";
92
+ readonly name: "maxUses";
93
+ readonly type: "uint256";
94
+ }, {
95
+ readonly internalType: "uint256";
96
+ readonly name: "usedCount";
97
+ readonly type: "uint256";
98
+ }, {
99
+ readonly internalType: "uint256";
100
+ readonly name: "packId";
101
+ readonly type: "uint256";
102
+ }, {
103
+ readonly internalType: "uint256";
104
+ readonly name: "minPurchaseAmount";
105
+ readonly type: "uint256";
106
+ }];
107
+ readonly internalType: "struct CCShop.DiscountCode";
108
+ readonly name: "";
109
+ readonly type: "tuple";
110
+ }];
111
+ readonly stateMutability: "view";
112
+ readonly type: "function";
113
+ };
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ // CCShop contract ABI fragments used by AnySpendCollectorClubPurchase
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.GET_DISCOUNT_CODE_ABI = exports.IS_DISCOUNT_CODE_VALID_FOR_PACK_ABI = exports.BUY_PACKS_FOR_WITH_DISCOUNT_ABI = exports.BUY_PACKS_FOR_ABI = void 0;
5
+ exports.BUY_PACKS_FOR_ABI = {
6
+ inputs: [
7
+ { internalType: "address", name: "user", type: "address" },
8
+ { internalType: "uint256", name: "packId", type: "uint256" },
9
+ { internalType: "uint256", name: "amount", type: "uint256" },
10
+ ],
11
+ name: "buyPacksFor",
12
+ outputs: [],
13
+ stateMutability: "nonpayable",
14
+ type: "function",
15
+ };
16
+ exports.BUY_PACKS_FOR_WITH_DISCOUNT_ABI = {
17
+ inputs: [
18
+ { internalType: "address", name: "user", type: "address" },
19
+ { internalType: "uint256", name: "packId", type: "uint256" },
20
+ { internalType: "uint256", name: "amount", type: "uint256" },
21
+ { internalType: "string", name: "discountCode", type: "string" },
22
+ ],
23
+ name: "buyPacksForWithDiscount",
24
+ outputs: [],
25
+ stateMutability: "nonpayable",
26
+ type: "function",
27
+ };
28
+ exports.IS_DISCOUNT_CODE_VALID_FOR_PACK_ABI = {
29
+ inputs: [
30
+ { internalType: "string", name: "code", type: "string" },
31
+ { internalType: "uint256", name: "packId", type: "uint256" },
32
+ ],
33
+ name: "isDiscountCodeValidForPack",
34
+ outputs: [
35
+ { internalType: "bool", name: "isValid", type: "bool" },
36
+ { internalType: "uint256", name: "discountAmount", type: "uint256" },
37
+ ],
38
+ stateMutability: "view",
39
+ type: "function",
40
+ };
41
+ exports.GET_DISCOUNT_CODE_ABI = {
42
+ inputs: [{ internalType: "string", name: "code", type: "string" }],
43
+ name: "getDiscountCode",
44
+ outputs: [
45
+ {
46
+ components: [
47
+ { internalType: "uint256", name: "discountAmount", type: "uint256" },
48
+ { internalType: "uint256", name: "expiresAt", type: "uint256" },
49
+ { internalType: "bool", name: "used", type: "bool" },
50
+ { internalType: "bool", name: "exists", type: "bool" },
51
+ { internalType: "uint256", name: "maxUses", type: "uint256" },
52
+ { internalType: "uint256", name: "usedCount", type: "uint256" },
53
+ { internalType: "uint256", name: "packId", type: "uint256" },
54
+ { internalType: "uint256", name: "minPurchaseAmount", type: "uint256" },
55
+ ],
56
+ internalType: "struct CCShop.DiscountCode",
57
+ name: "",
58
+ type: "tuple",
59
+ },
60
+ ],
61
+ stateMutability: "view",
62
+ type: "function",
63
+ };
@@ -18,8 +18,6 @@ interface CryptoPaySectionProps {
18
18
  }) => void;
19
19
  onShowFeeDetail?: () => void;
20
20
  classes?: CryptoPaySectionClasses;
21
- /** When true, skip auto-setting max balance when token changes (used for fixed destination amount mode) */
22
- skipAutoMaxOnTokenChange?: boolean;
23
21
  }
24
- export declare function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, onShowFeeDetail, classes, skipAutoMaxOnTokenChange, }: CryptoPaySectionProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, onShowFeeDetail, classes, }: CryptoPaySectionProps): import("react/jsx-runtime").JSX.Element;
25
23
  export {};
@@ -11,7 +11,7 @@ const useConnectedWalletDisplay_1 = require("../../hooks/useConnectedWalletDispl
11
11
  const CryptoPaymentMethodDisplay_1 = require("./CryptoPaymentMethodDisplay");
12
12
  const OrderTokenAmount_1 = require("./OrderTokenAmount");
13
13
  const TokenBalance_1 = require("./TokenBalance");
14
- function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, onShowFeeDetail, classes, skipAutoMaxOnTokenChange = false, }) {
14
+ function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, isSrcInputDirty, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, onShowFeeDetail, classes, }) {
15
15
  const { data: srcTokenMetadata } = (0, react_1.useTokenData)(selectedSrcToken?.chainId, selectedSrcToken?.address);
16
16
  // Use custom hook to determine wallet address based on payment method
17
17
  const { walletAddress } = (0, useConnectedWalletDisplay_1.useConnectedWalletDisplay)(selectedCryptoPaymentMethod);
@@ -43,10 +43,10 @@ function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedS
43
43
  }, [selectedSrcToken.address, selectedSrcToken.chainId]);
44
44
  return ((0, jsx_runtime_1.jsxs)(react_2.motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: classes?.container ||
45
45
  "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm", children: ["Pay", !isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && ((0, jsx_runtime_1.jsx)("button", { onClick: onShowFeeDetail, className: "text-as-primary/40 hover:text-as-primary/60 transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Info, { className: "h-4 w-4" }) }))] }), (0, jsx_runtime_1.jsx)("button", { className: classes?.paymentMethodButton ||
46
- "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: (0, jsx_runtime_1.jsx)(CryptoPaymentMethodDisplay_1.CryptoPaymentMethodDisplay, { paymentMethod: selectedCryptoPaymentMethod, connectedAddress: walletAddress, connectedName: connectedName }) })] }), (0, jsx_runtime_1.jsx)("div", { className: classes?.inputContainer, children: (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: walletAddress, walletAddress: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
46
+ "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: (0, jsx_runtime_1.jsx)(CryptoPaymentMethodDisplay_1.CryptoPaymentMethodDisplay, { paymentMethod: selectedCryptoPaymentMethod, connectedAddress: walletAddress, connectedName: connectedName }) })] }), (0, jsx_runtime_1.jsx)("div", { className: classes?.inputContainer, children: (0, jsx_runtime_1.jsx)(OrderTokenAmount_1.OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
47
47
  setIsSrcInputDirty(true);
48
48
  setSrcAmount(value);
49
- }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken, onTokenSelect: onTokenSelect, skipAutoMaxOnTokenChange: skipAutoMaxOnTokenChange }) }), (0, jsx_runtime_1.jsxs)("div", { className: classes?.balanceRow || "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: (0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyIn?.amountUsd, {
49
+ }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken, onTokenSelect: onTokenSelect }) }), (0, jsx_runtime_1.jsxs)("div", { className: classes?.balanceRow || "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: (0, number_1.formatDisplayNumber)(anyspendQuote?.data?.currencyIn?.amountUsd, {
50
50
  style: "currency",
51
51
  fallback: "",
52
52
  }) }), (0, jsx_runtime_1.jsx)(TokenBalance_1.TokenBalance, { token: selectedSrcToken, walletAddress: walletAddress, onChangeInput: value => {
@@ -1,5 +1,5 @@
1
1
  import { components } from "../../../../anyspend/types/api";
2
- export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, walletAddress, skipAutoMaxOnTokenChange, }: {
2
+ export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput, context, address, chainId, setChainId, token, setToken, hideTokenSelect, canEditAmount, className, innerClassName, amountClassName, tokenSelectClassName, onTokenSelect, }: {
3
3
  disabled?: boolean;
4
4
  inputValue: string;
5
5
  onChangeInput: (value: string) => void;
@@ -18,7 +18,4 @@ export declare function OrderTokenAmount({ disabled, inputValue, onChangeInput,
18
18
  onTokenSelect?: (token: components["schemas"]["Token"], event: {
19
19
  preventDefault: () => void;
20
20
  }) => void;
21
- walletAddress?: string | undefined;
22
- /** When true, skip auto-setting max balance when token changes (used for fixed destination amount mode) */
23
- skipAutoMaxOnTokenChange?: boolean;
24
21
  }): import("react/jsx-runtime").JSX.Element;