@b3dotfun/sdk 0.0.1-alpha.13 → 0.0.1-alpha.15

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 (30) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -1
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +4 -4
  3. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +124 -53
  5. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  6. package/dist/cjs/global-account/types/chain-networks.d.ts +34 -34
  7. package/dist/cjs/global-account/types/feature-flags.d.ts +5 -5
  8. package/dist/cjs/shared/constants/chains/supported.d.ts +1 -0
  9. package/dist/cjs/shared/constants/chains/supported.js +3 -1
  10. package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -1
  11. package/dist/esm/anyspend/react/components/AnySpend.js +4 -4
  12. package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  13. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +124 -53
  14. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  15. package/dist/esm/global-account/types/chain-networks.d.ts +34 -34
  16. package/dist/esm/global-account/types/feature-flags.d.ts +5 -5
  17. package/dist/esm/shared/constants/chains/supported.d.ts +1 -0
  18. package/dist/esm/shared/constants/chains/supported.js +2 -0
  19. package/dist/styles/index.css +1 -1
  20. package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -1
  21. package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +2 -1
  22. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  23. package/dist/types/global-account/types/chain-networks.d.ts +34 -34
  24. package/dist/types/global-account/types/feature-flags.d.ts +5 -5
  25. package/dist/types/shared/constants/chains/supported.d.ts +1 -0
  26. package/package.json +1 -1
  27. package/src/anyspend/react/components/AnySpend.tsx +6 -5
  28. package/src/anyspend/react/components/AnySpendBuySpin.tsx +233 -184
  29. package/src/global-account/react/stores/useModalStore.ts +2 -0
  30. package/src/shared/constants/chains/supported.ts +2 -0
@@ -11,7 +11,7 @@ export declare enum PanelView {
11
11
  LOADING = 3,
12
12
  FIAT_PAYMENT = 4
13
13
  }
14
- export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton }: {
14
+ export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }: {
15
15
  destinationTokenAddress?: string;
16
16
  destinationTokenChainId?: number;
17
17
  isMainnet?: boolean;
@@ -19,4 +19,5 @@ export declare function AnySpend({ destinationTokenAddress, destinationTokenChai
19
19
  defaultActiveTab?: "crypto" | "fiat";
20
20
  loadOrder?: string;
21
21
  hideTransactionHistoryButton?: boolean;
22
+ recipientAddress?: string;
22
23
  }): import("react/jsx-runtime").JSX.Element;
@@ -9,8 +9,8 @@ exports.AnySpend = AnySpend;
9
9
  const jsx_runtime_1 = require("react/jsx-runtime");
10
10
  const anyspend_1 = require("../../../anyspend");
11
11
  const react_1 = require("../../../global-account/react");
12
- const formatAddress_1 = require("../../../shared/utils/formatAddress");
13
12
  const cn_1 = require("../../../shared/utils/cn");
13
+ const formatAddress_1 = require("../../../shared/utils/formatAddress");
14
14
  const number_1 = require("../../../shared/utils/number");
15
15
  const framer_motion_1 = require("framer-motion");
16
16
  const invariant_1 = __importDefault(require("invariant"));
@@ -36,7 +36,7 @@ var PanelView;
36
36
  PanelView[PanelView["FIAT_PAYMENT"] = 4] = "FIAT_PAYMENT";
37
37
  })(PanelView || (exports.PanelView = PanelView = {}));
38
38
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
39
- function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton }) {
39
+ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }) {
40
40
  const searchParams = (0, react_1.useSearchParamsSSR)();
41
41
  const router = (0, react_1.useRouter)();
42
42
  // Determine if we're in "buy mode" based on whether destination token props are provided
@@ -279,8 +279,8 @@ function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet
279
279
  const { address: globalAddress, wallet: globalWallet } = (0, react_1.useAccountWallet)();
280
280
  // Set default recipient address when wallet changes
281
281
  (0, react_2.useEffect)(() => {
282
- setRecipientAddress(globalAddress);
283
- }, [globalAddress]);
282
+ setRecipientAddress(recipientAddressFromProps || globalAddress);
283
+ }, [recipientAddressFromProps, globalAddress]);
284
284
  // Get anyspend price
285
285
  const activeInputAmountInWei = isSrcInputDirty
286
286
  ? (0, viem_1.parseUnits)(srcAmount.replaceAll(",", ""), selectedSrcToken.decimals).toString()
@@ -1,9 +1,10 @@
1
- export declare function AnySpendBuySpin({ isMainnet, loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, onSuccess }: {
1
+ export declare function AnySpendBuySpin({ isMainnet, loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess }: {
2
2
  isMainnet?: boolean;
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  spinwheelContractAddress: string;
6
6
  chainId: number;
7
7
  recipientAddress: string;
8
+ prefillQuantity?: string;
8
9
  onSuccess?: (txHash?: string) => void;
9
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AnySpendBuySpin = AnySpendBuySpin;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const anyspend_1 = require("../../../anyspend");
9
+ const supported_1 = require("../../../shared/constants/chains/supported");
9
10
  const EthIcon_1 = require("./icons/EthIcon");
10
11
  const SolIcon_1 = require("./icons/SolIcon");
11
12
  const USDCIcon_1 = require("./icons/USDCIcon");
@@ -17,7 +18,6 @@ const lucide_react_1 = require("lucide-react");
17
18
  const react_3 = require("react");
18
19
  const sonner_1 = require("sonner");
19
20
  const viem_1 = require("viem");
20
- const chains_1 = require("viem/chains");
21
21
  const wagmi_1 = require("wagmi");
22
22
  const AnySpendCustom_1 = require("./AnySpendCustom");
23
23
  const SPIN_WHEEL_ABI = [
@@ -49,8 +49,37 @@ const SPIN_WHEEL_ABI = [
49
49
  outputs: [],
50
50
  stateMutability: "payable",
51
51
  type: "function"
52
+ },
53
+ {
54
+ inputs: [],
55
+ name: "getWheelInfo",
56
+ outputs: [
57
+ { internalType: "address", name: "creator_", type: "address" },
58
+ { internalType: "uint256", name: "startTime_", type: "uint256" },
59
+ { internalType: "uint256", name: "endTime_", type: "uint256" },
60
+ { internalType: "uint256", name: "totalPrizesAvailable_", type: "uint256" },
61
+ { internalType: "uint256", name: "prizesRequestedCount_", type: "uint256" },
62
+ { internalType: "enum SpinWheelV2.WheelState", name: "state_", type: "uint8" }
63
+ ],
64
+ stateMutability: "view",
65
+ type: "function"
52
66
  }
53
67
  ];
68
+ function getWheelStatus(wheelInfo) {
69
+ const now = BigInt(Math.floor(Date.now() / 1000));
70
+ console.log("@@anyspend-buy-spin:now:", now);
71
+ console.log("@@anyspend-buy-spin:wheelInfo:", wheelInfo);
72
+ if (now < wheelInfo.startTime_) {
73
+ return "not_started";
74
+ }
75
+ if (now > wheelInfo.endTime_) {
76
+ return "ended";
77
+ }
78
+ if (wheelInfo.totalPrizesAvailable_ <= wheelInfo.prizesRequestedCount_) {
79
+ return "sold_out";
80
+ }
81
+ return "active";
82
+ }
54
83
  function generateEncodedDataForBuyEntriesAndSpin(user, quantity) {
55
84
  (0, invariant_1.default)(BigInt(quantity) > 0, "Quantity must be greater than zero");
56
85
  console.log("@@anyspend-buy-spin:encoded-data:", { user, quantity });
@@ -62,16 +91,17 @@ function generateEncodedDataForBuyEntriesAndSpin(user, quantity) {
62
91
  return encodedData;
63
92
  }
64
93
  const basePublicClient = (0, viem_1.createPublicClient)({
65
- chain: chains_1.base,
94
+ chain: supported_1.baseMainnet,
66
95
  transport: (0, viem_1.http)()
67
96
  });
68
- function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, onSuccess }) {
97
+ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess }) {
69
98
  const hasMounted = (0, react_2.useHasMounted)();
70
99
  const { setB3ModalOpen } = (0, react_2.useModalStore)();
71
100
  // Payment config state
72
101
  const [paymentConfig, setPaymentConfig] = (0, react_3.useState)(null);
73
102
  const [isLoadingConfig, setIsLoadingConfig] = (0, react_3.useState)(true);
74
103
  const [configError, setConfigError] = (0, react_3.useState)("");
104
+ const [wheelInfo, setWheelInfo] = (0, react_3.useState)(null);
75
105
  // Fetch B3 token balance
76
106
  const { formattedBalance: b3Balance, isLoading: isBalanceLoading, rawBalance: b3RawBalance } = (0, react_2.useTokenBalance)({
77
107
  token: anyspend_1.B3_TOKEN
@@ -83,22 +113,29 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
83
113
  // State for direct buying flow (when user has B3 tokens)
84
114
  const [isBuying, setIsBuying] = (0, react_3.useState)(false);
85
115
  const [buyingTxHash, setBuyingTxHash] = (0, react_3.useState)("");
86
- const [showSuccessModal, setShowSuccessModal] = (0, react_3.useState)(false);
87
- // Wait for transaction confirmation
88
- const { isLoading: isTxPending, isSuccess: isTxSuccess } = (0, wagmi_1.useWaitForTransactionReceipt)({
116
+ const { isLoading: isTxPending, isSuccess: isTxSuccess, isError: isTxError, error: txError } = (0, wagmi_1.useWaitForTransactionReceipt)({
89
117
  hash: buyingTxHash,
90
118
  query: {
91
119
  structuralSharing: false
92
120
  }
93
121
  });
94
- // Show success modal when transaction is confirmed
122
+ // Handle transaction status
95
123
  (0, react_3.useEffect)(() => {
96
- if (isTxSuccess && buyingTxHash) {
97
- setShowAmountPrompt(false);
98
- setShowSuccessModal(true);
124
+ if (!buyingTxHash)
125
+ return;
126
+ if (isTxSuccess) {
127
+ setB3ModalOpen(false);
128
+ onSuccess?.(buyingTxHash);
129
+ sonner_1.toast.success("Spin purchase transaction confirmed!");
130
+ setIsBuying(false);
131
+ }
132
+ else if (isTxError) {
133
+ console.error("@@anyspend-buy-spin:tx-error:", txError);
134
+ sonner_1.toast.error("Transaction failed. Please try again.");
135
+ setB3ModalOpen(false);
99
136
  setIsBuying(false);
100
137
  }
101
- }, [isTxSuccess, buyingTxHash]);
138
+ }, [isTxSuccess, isTxError, buyingTxHash, onSuccess, setB3ModalOpen, txError]);
102
139
  // Spin quantity state
103
140
  const [userSpinQuantity, setUserSpinQuantity] = (0, react_3.useState)("");
104
141
  const [showAmountPrompt, setShowAmountPrompt] = (0, react_3.useState)(true);
@@ -106,9 +143,17 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
106
143
  const [validationError, setValidationError] = (0, react_3.useState)("");
107
144
  const [displayQuantity, setDisplayQuantity] = (0, react_3.useState)("");
108
145
  const [debouncedQuantity, setDebouncedQuantity] = (0, react_3.useState)("");
146
+ const [debouncedUserSpinQuantity, setDebouncedUserSpinQuantity] = (0, react_3.useState)("");
147
+ (0, react_3.useEffect)(() => {
148
+ if (prefillQuantity && wheelInfo) {
149
+ const remainingSpins = wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_;
150
+ const adjustedQuantity = BigInt(prefillQuantity) > remainingSpins ? remainingSpins.toString() : prefillQuantity;
151
+ validateAndSetQuantity(adjustedQuantity);
152
+ }
153
+ }, [prefillQuantity, wheelInfo]);
109
154
  // Calculate total cost
110
155
  const totalCost = paymentConfig && userSpinQuantity ? paymentConfig.pricePerEntry * BigInt(userSpinQuantity) : BigInt(0);
111
- // Fetch payment configuration
156
+ // Fetch payment configuration and wheel info
112
157
  const fetchPaymentConfig = (0, react_3.useCallback)(async () => {
113
158
  if (!basePublicClient || !spinwheelContractAddress)
114
159
  return;
@@ -116,7 +161,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
116
161
  setIsLoadingConfig(true);
117
162
  setConfigError("");
118
163
  console.log("@@anyspend-buy-spin:fetch-config:", { spinwheelContractAddress, chainId });
119
- const [config, entryModuleAddress] = await Promise.all([
164
+ const [config, entryModuleAddress, wheelInfo] = await Promise.all([
120
165
  basePublicClient.readContract({
121
166
  address: spinwheelContractAddress,
122
167
  abi: SPIN_WHEEL_ABI,
@@ -126,6 +171,11 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
126
171
  address: spinwheelContractAddress,
127
172
  abi: SPIN_WHEEL_ABI,
128
173
  functionName: "entryModule"
174
+ }),
175
+ basePublicClient.readContract({
176
+ address: spinwheelContractAddress,
177
+ abi: SPIN_WHEEL_ABI,
178
+ functionName: "getWheelInfo"
129
179
  })
130
180
  ]);
131
181
  const paymentConfig = {
@@ -134,13 +184,16 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
134
184
  paymentRecipient: config[3],
135
185
  entryModule: entryModuleAddress
136
186
  };
137
- console.log("@@anyspend-buy-spin:config-fetched:", {
138
- pricePerEntry: paymentConfig.pricePerEntry.toString(),
139
- maxEntriesPerUser: paymentConfig.maxEntriesPerUser.toString(),
140
- paymentRecipient: paymentConfig.paymentRecipient,
141
- entryModule: paymentConfig.entryModule
142
- });
187
+ const wheelInfoData = {
188
+ creator_: wheelInfo[0],
189
+ startTime_: wheelInfo[1],
190
+ endTime_: wheelInfo[2],
191
+ totalPrizesAvailable_: wheelInfo[3],
192
+ prizesRequestedCount_: wheelInfo[4],
193
+ state_: wheelInfo[5]
194
+ };
143
195
  setPaymentConfig(paymentConfig);
196
+ setWheelInfo(wheelInfoData);
144
197
  }
145
198
  catch (error) {
146
199
  console.error("@@anyspend-buy-spin:config-error:", error);
@@ -159,6 +212,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
159
212
  (0, react_3.useEffect)(() => {
160
213
  const timer = setTimeout(() => {
161
214
  setDebouncedQuantity(displayQuantity);
215
+ setDebouncedUserSpinQuantity(userSpinQuantity);
162
216
  }, 500);
163
217
  return () => clearTimeout(timer);
164
218
  }, [displayQuantity, userSpinQuantity]);
@@ -184,14 +238,19 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
184
238
  return;
185
239
  }
186
240
  // Check maximum entries per user (0 means no limit)
187
- if (paymentConfig &&
188
- paymentConfig.maxEntriesPerUser > BigInt(0) &&
189
- BigInt(numValue) > paymentConfig.maxEntriesPerUser) {
241
+ if (paymentConfig && paymentConfig.maxEntriesPerUser > 0n && BigInt(numValue) > paymentConfig.maxEntriesPerUser) {
190
242
  setIsQuantityValid(false);
191
243
  setUserSpinQuantity("");
192
244
  setValidationError(`Maximum ${paymentConfig.maxEntriesPerUser.toString()} spins allowed`);
193
245
  return;
194
246
  }
247
+ // Check if quantity exceeds remaining entries
248
+ if (wheelInfo && BigInt(numValue) > wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_) {
249
+ setIsQuantityValid(false);
250
+ setUserSpinQuantity("");
251
+ setValidationError(`Only ${(wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_).toString()} spins remaining`);
252
+ return;
253
+ }
195
254
  setUserSpinQuantity(value);
196
255
  setIsQuantityValid(true);
197
256
  setValidationError("");
@@ -241,7 +300,7 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
241
300
  catch (error) {
242
301
  console.error("@@anyspend-buy-spin:error:", error);
243
302
  sonner_1.toast.error("Spin purchase failed. Please try again.");
244
- setShowSuccessModal(false);
303
+ setB3ModalOpen(false);
245
304
  }
246
305
  finally {
247
306
  setIsBuying(false);
@@ -279,46 +338,58 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
279
338
  // Render quantity input prompt
280
339
  if (showAmountPrompt) {
281
340
  const pricePerEntry = (0, viem_1.formatUnits)(paymentConfig.pricePerEntry, 18);
341
+ const remainingEntries = wheelInfo ? wheelInfo.totalPrizesAvailable_ - wheelInfo.prizesRequestedCount_ : 0n;
342
+ const wheelStatus = wheelInfo ? getWheelStatus(wheelInfo) : null;
343
+ const isSoldOut = wheelStatus === "sold_out";
344
+ const isActive = wheelStatus === "active";
345
+ const getStatusMessage = () => {
346
+ if (!wheelInfo)
347
+ return null;
348
+ const formatDate = (timestamp) => {
349
+ return new Date(Number(timestamp) * 1000).toLocaleString();
350
+ };
351
+ switch (wheelStatus) {
352
+ case "not_started":
353
+ return {
354
+ title: "Spin Wheel Not Started",
355
+ message: `Starts at ${formatDate(wheelInfo.startTime_)}`
356
+ };
357
+ case "ended":
358
+ return {
359
+ title: "Spin Wheel Ended",
360
+ message: `Ended at ${formatDate(wheelInfo.endTime_)}`
361
+ };
362
+ case "sold_out":
363
+ return {
364
+ title: "All Spins Have Been Claimed",
365
+ message: "Stay tuned for the next spin wheel event!"
366
+ };
367
+ default:
368
+ return null;
369
+ }
370
+ };
371
+ const statusInfo = getStatusMessage();
282
372
  return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full px-4 pb-2 pt-4", children: [(0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
283
373
  opacity: hasMounted ? 1 : 0,
284
374
  y: hasMounted ? 0 : 20,
285
375
  filter: hasMounted ? "blur(0px)" : "blur(10px)"
286
- }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "mb-4 flex justify-center", children: (0, jsx_runtime_1.jsx)("img", { alt: "B3 Token", loading: "lazy", width: "64", height: "64", decoding: "async", className: "rounded-full", src: "https://cdn.b3.fun/b3-coin-3d.png" }) }), (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
287
- opacity: hasMounted ? 1 : 0,
288
- y: hasMounted ? 0 : 20,
289
- filter: hasMounted ? "blur(0px)" : "blur(10px)"
290
- }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "font-sf-rounded text-as-primary mb-2 text-2xl font-bold", children: (() => {
291
- const hasEnoughBalance = b3RawBalance && totalCost <= b3RawBalance;
292
- return hasEnoughBalance || !debouncedQuantity ? "Buy Spins" : `Swap & Buy Spins`;
293
- })() }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-on-surface-2/50 inline-flex items-center gap-2 rounded-full border border-white/10 px-3 py-1 backdrop-blur-sm", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-primary/80 text-sm", children: [pricePerEntry, " $B3 per spin"] }) })] })] }), (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
294
- opacity: hasMounted ? 1 : 0,
295
- y: hasMounted ? 0 : 20,
296
- filter: hasMounted ? "blur(0px)" : "blur(10px)"
297
- }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "Number of spins" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary/50 flex items-center gap-1 text-sm", children: ["Available: ", isBalanceLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-3 w-3 animate-spin" }) : `${b3Balance} B3`] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)(react_2.Input, { onFocus: onFocusQuantityInput, type: "text", placeholder: "1", value: displayQuantity, onChange: e => validateAndSetQuantity(e.target.value), className: `h-14 px-4 pr-20 text-lg ${!isQuantityValid && displayQuantity ? "border-as-red" : "border-b3-react-border"}` }), (0, jsx_runtime_1.jsx)("div", { className: "font-pack absolute right-4 top-1/2 -translate-y-1/2 text-lg font-medium text-blue-500/70", children: displayQuantity === "1" ? "Spin" : "Spins" })] }), !isQuantityValid && displayQuantity && (0, jsx_runtime_1.jsx)("p", { className: "text-as-red text-sm", children: validationError }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-lg font-bold", children: [displayQuantity && isQuantityValid ? (0, viem_1.formatUnits)(totalCost, 18) : "0", " B3"] }) })] }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-4", children: (() => {
298
- const hasEnoughBalance = b3RawBalance && totalCost <= b3RawBalance;
299
- if (!hasEnoughBalance && debouncedQuantity) {
300
- return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 flex flex-col items-center gap-2 rounded-lg p-4 pb-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: "Swap & buy from any token" }), (0, jsx_runtime_1.jsxs)(react_2.TextLoop, { children: [(0, jsx_runtime_1.jsx)(EthIcon_1.EthIcon, { className: "h-8 w-8" }), (0, jsx_runtime_1.jsx)(SolIcon_1.SolIcon, { className: "h-8 w-8" }), (0, jsx_runtime_1.jsx)(USDCIcon_1.UsdcIcon, { className: "h-8 w-8" })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRight, { className: "text-as-primary h-4 w-4" }), (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3-coin-3d.png", className: "h-7 w-7", alt: "B3 Token" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/50 text-sm font-medium", children: "No problem, we'll help you swap to B3 for your spins!" })] }));
301
- }
302
- })() }), (0, jsx_runtime_1.jsx)(react_2.Button, { onClick: confirmQuantity, disabled: !isQuantityValid || !displayQuantity || isBuying || isTxPending, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: isBuying ? "Buying..." : isTxPending ? "Confirming..." : "Continue" })] })] }) }));
303
- }
304
- // Success Modal for Direct Buying
305
- if (showSuccessModal) {
306
- return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex w-full flex-col items-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-full p-4", children: [(0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
307
- opacity: hasMounted ? 1 : 0,
308
- y: hasMounted ? 0 : 20,
309
- filter: hasMounted ? "blur(0px)" : "blur(10px)"
310
- }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "relative mx-auto mb-4 size-[120px]", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 scale-95 rounded-[50%] bg-gradient-to-br from-green-500/30 to-blue-500/30 blur-xl" }), (0, jsx_runtime_1.jsxs)(react_2.GlareCardRounded, { className: "overflow-hidden rounded-full border-none bg-gradient-to-br from-green-500/10 to-blue-500/10 backdrop-blur-sm", children: [(0, jsx_runtime_1.jsx)("img", { alt: "B3 Token", loading: "lazy", width: "120", height: "120", decoding: "async", "data-nimg": "1", className: "size-full shrink-0 bg-transparent text-transparent", src: "https://cdn.b3.fun/b3-coin-3d.png" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 rounded-[50%] border border-white/20" })] })] }), (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
376
+ }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: `flex justify-center ${isActive ? "mb-4" : ""}`, children: (0, jsx_runtime_1.jsx)("img", { alt: "B3 Token", loading: "lazy", width: "64", height: "64", decoding: "async", className: "rounded-full", src: "https://cdn.b3.fun/b3-coin-3d.png" }) }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
311
377
  opacity: hasMounted ? 1 : 0,
312
378
  y: hasMounted ? 0 : 20,
313
379
  filter: hasMounted ? "blur(0px)" : "blur(10px)"
314
- }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "font-sf-rounded mb-3 bg-gradient-to-r from-green-400 to-blue-500 bg-clip-text text-3xl font-bold text-transparent", children: "\uD83C\uDF89 Purchase Complete!" }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-on-surface-2/50 inline-flex items-center gap-2 rounded-full border border-white/10 px-4 py-2 backdrop-blur-sm", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary/80 text-sm font-medium", children: [userSpinQuantity, " Spin", userSpinQuantity !== "1" ? "s" : "", " \u2022 ", (0, viem_1.formatUnits)(totalCost, 18), " B3"] }) })] })] }), (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: false, animate: {
380
+ }, transition: { duration: 0.3, delay: 0.1, ease: "easeInOut" }, className: "text-center", children: isActive ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "font-sf-rounded text-as-primary mb-4 text-2xl font-bold", children: (() => {
381
+ const hasEnoughBalance = b3RawBalance && totalCost <= b3RawBalance;
382
+ return hasEnoughBalance || !debouncedQuantity ? "Buy Spins" : `Swap & Buy Spins`;
383
+ })() }), wheelInfo && ((0, jsx_runtime_1.jsxs)("div", { className: "inline-flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/10 border-as-brand/10 inline-flex items-center rounded-full border px-3 py-1", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-brand text-sm font-medium", children: [pricePerEntry, " $B3 per spin"] }) }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-brand/10 border-as-brand/10 inline-flex items-center rounded-full border px-3 py-1", children: (0, jsx_runtime_1.jsxs)("p", { className: "text-as-brand text-sm font-medium", children: [remainingEntries.toString(), " remaining"] }) })] }))] })) : (statusInfo && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-primary text-lg font-semibold", children: statusInfo.title }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 mt-2 text-sm", children: statusInfo.message })] }))) })] }), (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: false, animate: {
315
384
  opacity: hasMounted ? 1 : 0,
316
385
  y: hasMounted ? 0 : 20,
317
386
  filter: hasMounted ? "blur(0px)" : "blur(10px)"
318
- }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-6", children: (0, jsx_runtime_1.jsx)("a", { href: `https://basescan.org/tx/${buyingTxHash}`, target: "_blank", rel: "noopener noreferrer", className: "text-as-primary/70 hover:text-as-primary block break-all text-center font-mono text-sm underline transition-colors", children: "View transaction" }) }), (0, jsx_runtime_1.jsx)(react_2.Button, { onClick: () => {
319
- setB3ModalOpen(false);
320
- onSuccess?.(buyingTxHash);
321
- }, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary h-14 w-full rounded-xl text-lg font-medium", children: "Done" })] })] }) }));
387
+ }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: "bg-b3-react-background w-full p-6", children: isActive ? ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/70 text-sm font-medium", children: "Number of spins" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary/50 flex items-center gap-1 text-sm", children: ["Available: ", isBalanceLoading ? (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-3 w-3 animate-spin" }) : `${b3Balance} B3`] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)(react_2.Input, { onFocus: onFocusQuantityInput, type: "text", placeholder: "1", value: displayQuantity, onChange: e => validateAndSetQuantity(e.target.value), className: `h-14 px-4 pr-20 text-lg ${!isQuantityValid && displayQuantity ? "border-as-red" : "border-b3-react-border"}` }), (0, jsx_runtime_1.jsx)("div", { className: "font-pack absolute right-4 top-1/2 -translate-y-1/2 text-lg font-medium text-blue-500/70", children: displayQuantity === "1" ? "Spin" : "Spins" })] }), !isQuantityValid && displayQuantity && (0, jsx_runtime_1.jsx)("p", { className: "text-as-red text-sm", children: validationError }), (0, jsx_runtime_1.jsx)("div", { className: "bg-as-on-surface-2/30 rounded-lg border border-white/10 p-4 backdrop-blur-sm", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary/70 text-sm font-medium", children: "Total Cost:" }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-as-primary text-lg font-bold", children: [displayQuantity && isQuantityValid ? (0, viem_1.formatUnits)(totalCost, 18) : "0", " B3"] }) })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "mt-4", children: (() => {
388
+ const hasEnoughBalance = b3RawBalance && totalCost <= b3RawBalance;
389
+ if (!hasEnoughBalance && debouncedQuantity) {
390
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-as-brand/10 flex flex-col items-center gap-2 rounded-lg p-4 pb-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-as-primary text-sm font-semibold", children: "Swap & buy from any token" }), (0, jsx_runtime_1.jsxs)(react_2.TextLoop, { children: [(0, jsx_runtime_1.jsx)(EthIcon_1.EthIcon, { className: "h-8 w-8" }), (0, jsx_runtime_1.jsx)(SolIcon_1.SolIcon, { className: "h-8 w-8" }), (0, jsx_runtime_1.jsx)(USDCIcon_1.UsdcIcon, { className: "h-8 w-8" })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowRight, { className: "text-as-primary h-4 w-4" }), (0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3-coin-3d.png", className: "h-7 w-7", alt: "B3 Token" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-as-primary/50 text-sm font-medium", children: "No problem, we'll help you swap to B3 for your spins!" })] }));
391
+ }
392
+ })() }), (0, jsx_runtime_1.jsx)(react_2.Button, { onClick: confirmQuantity, disabled: !isQuantityValid || !displayQuantity || isBuying || isTxPending, className: "bg-as-brand hover:bg-as-brand/90 text-as-primary mt-4 h-14 w-full rounded-xl text-lg font-medium", children: isBuying ? "Buying..." : isTxPending ? "Confirming..." : "Continue" })] })) : null })] }) }));
322
393
  }
323
394
  // AnySpend flow for when user needs to swap to B3
324
395
  const encodedData = generateEncodedDataForBuyEntriesAndSpin(address || "", userSpinQuantity);
@@ -231,6 +231,8 @@ export interface AnySpendBuySpinProps extends BaseModalProps {
231
231
  recipientAddress: string;
232
232
  /** Callback function called when the spin purchase is successful */
233
233
  onSuccess?: (txHash?: string) => void;
234
+ /** Prefill quantity of spins to purchase */
235
+ prefillQuantity?: string;
234
236
  }
235
237
  /**
236
238
  * Union type of all possible modal content types
@@ -1,44 +1,44 @@
1
1
  import { Static } from "@feathersjs/typebox";
2
- export declare const chainNetworksSchema: import("@sinclair/typebox").TObject<{
3
- _id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TObject<{}>]>;
4
- id: import("@sinclair/typebox").TInteger;
5
- name: import("@sinclair/typebox").TString<string>;
6
- rpcUrls: import("@sinclair/typebox").TObject<{
7
- default: import("@sinclair/typebox").TObject<{
8
- http: import("@sinclair/typebox").TString<"uri">;
9
- ws: import("@sinclair/typebox").TString<"uri">;
2
+ export declare const chainNetworksSchema: import("@feathersjs/typebox").TObject<{
3
+ _id: import("@feathersjs/typebox").TUnion<[import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TObject<{}>]>;
4
+ id: import("@feathersjs/typebox").TInteger;
5
+ name: import("@feathersjs/typebox").TString<string>;
6
+ rpcUrls: import("@feathersjs/typebox").TObject<{
7
+ default: import("@feathersjs/typebox").TObject<{
8
+ http: import("@feathersjs/typebox").TString<"uri">;
9
+ ws: import("@feathersjs/typebox").TString<"uri">;
10
10
  }>;
11
- backups: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
12
- type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"http">, import("@sinclair/typebox").TLiteral<"ws">]>;
13
- uri: import("@sinclair/typebox").TString<string>;
11
+ backups: import("@feathersjs/typebox").TArray<import("@feathersjs/typebox").TObject<{
12
+ type: import("@feathersjs/typebox").TUnion<[import("@feathersjs/typebox").TLiteral<"http">, import("@feathersjs/typebox").TLiteral<"ws">]>;
13
+ uri: import("@feathersjs/typebox").TString<string>;
14
14
  }>>;
15
15
  }>;
16
- icon: import("@sinclair/typebox").TObject<{
17
- url: import("@sinclair/typebox").TString<"uri">;
18
- width: import("@sinclair/typebox").TInteger;
19
- height: import("@sinclair/typebox").TInteger;
20
- format: import("@sinclair/typebox").TString<string>;
16
+ icon: import("@feathersjs/typebox").TObject<{
17
+ url: import("@feathersjs/typebox").TString<"uri">;
18
+ width: import("@feathersjs/typebox").TInteger;
19
+ height: import("@feathersjs/typebox").TInteger;
20
+ format: import("@feathersjs/typebox").TString<string>;
21
21
  }>;
22
- blockExplorers: import("@sinclair/typebox").TObject<{
23
- explorerTitle: import("@sinclair/typebox").TString<string>;
24
- default: import("@sinclair/typebox").TString<"uri">;
22
+ blockExplorers: import("@feathersjs/typebox").TObject<{
23
+ explorerTitle: import("@feathersjs/typebox").TString<string>;
24
+ default: import("@feathersjs/typebox").TString<"uri">;
25
25
  }>;
26
- nativeCurrency: import("@sinclair/typebox").TObject<{
27
- name: import("@sinclair/typebox").TString<string>;
28
- symbol: import("@sinclair/typebox").TString<string>;
29
- decimals: import("@sinclair/typebox").TInteger;
26
+ nativeCurrency: import("@feathersjs/typebox").TObject<{
27
+ name: import("@feathersjs/typebox").TString<string>;
28
+ symbol: import("@feathersjs/typebox").TString<string>;
29
+ decimals: import("@feathersjs/typebox").TInteger;
30
30
  }>;
31
- testnet: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
32
- testnetConfigID: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
33
- sourceId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
34
- contracts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TObject<{
35
- address: import("@sinclair/typebox").TString<string>;
36
- blockCreated: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
31
+ testnet: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TBoolean>;
32
+ testnetConfigID: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TInteger>;
33
+ sourceId: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TInteger>;
34
+ contracts: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TRecord<import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TObject<{
35
+ address: import("@feathersjs/typebox").TString<string>;
36
+ blockCreated: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TInteger>;
37
37
  }>>>;
38
- formatters: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TAny>>;
39
- fees: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TAny>>;
40
- badge: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<"uri">>;
41
- color: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>;
42
- enabledFeatures: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString<string>>>;
38
+ formatters: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TRecord<import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TAny>>;
39
+ fees: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TRecord<import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TAny>>;
40
+ badge: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TString<"uri">>;
41
+ color: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TString<string>>;
42
+ enabledFeatures: import("@feathersjs/typebox").TOptional<import("@feathersjs/typebox").TArray<import("@feathersjs/typebox").TString<string>>>;
43
43
  }>;
44
44
  export type ChainNetworks = Static<typeof chainNetworksSchema>;
@@ -1,8 +1,8 @@
1
1
  import { Static } from "@feathersjs/typebox";
2
- export declare const featureFlagsSchema: import("@sinclair/typebox").TObject<{
3
- _id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TObject<{}>]>;
4
- id: import("@sinclair/typebox").TString<string>;
5
- enabled: import("@sinclair/typebox").TBoolean;
6
- description: import("@sinclair/typebox").TString<string>;
2
+ export declare const featureFlagsSchema: import("@feathersjs/typebox").TObject<{
3
+ _id: import("@feathersjs/typebox").TUnion<[import("@feathersjs/typebox").TString<string>, import("@feathersjs/typebox").TObject<{}>]>;
4
+ id: import("@feathersjs/typebox").TString<string>;
5
+ enabled: import("@feathersjs/typebox").TBoolean;
6
+ description: import("@feathersjs/typebox").TString<string>;
7
7
  }>;
8
8
  export type FeatureFlags = Static<typeof featureFlagsSchema>;
@@ -45,6 +45,7 @@ export declare const supportedChainNetworks: {
45
45
  }[];
46
46
  export declare const b3Mainnet: import("viem").Chain;
47
47
  export declare const b3Testnet: import("viem").Chain;
48
+ export declare const baseMainnet: import("viem").Chain | undefined;
48
49
  export declare const b3MainnetThirdWeb: Readonly<import("thirdweb/dist/types/chains/types").ChainOptions & {
49
50
  rpc: string;
50
51
  }>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.b3TestnetThirdWeb = exports.b3MainnetThirdWeb = exports.b3Testnet = exports.b3Mainnet = exports.supportedChainNetworks = exports.supportedChainsTW = exports.supportedChains = void 0;
6
+ exports.b3TestnetThirdWeb = exports.b3MainnetThirdWeb = exports.baseMainnet = exports.b3Testnet = exports.b3Mainnet = exports.supportedChainNetworks = exports.supportedChainsTW = exports.supportedChains = void 0;
7
7
  const chain_transformers_1 = require("../../../shared/utils/chain-transformers");
8
8
  // Import the JSON directly
9
9
  // @ts-ignore
@@ -30,6 +30,8 @@ exports.b3Mainnet = exports.supportedChains.find(chain => chain.id === 8333);
30
30
  (0, invariant_1.default)(exports.b3Mainnet, "B3 mainnet chain not found in supported chains");
31
31
  exports.b3Testnet = exports.supportedChains.find(chain => chain.id === 1993);
32
32
  (0, invariant_1.default)(exports.b3Testnet, "B3 testnet chain not found in supported chains");
33
+ exports.baseMainnet = exports.supportedChains.find(chain => chain.id === 8453);
34
+ (0, invariant_1.default)(exports.baseMainnet, "Base mainnet chain not found in supported chains");
33
35
  exports.b3MainnetThirdWeb = exports.supportedChainsTW.find(chain => chain.id === 8333);
34
36
  (0, invariant_1.default)(exports.b3MainnetThirdWeb, "B3 mainnet chain not found in supported chains TW");
35
37
  exports.b3TestnetThirdWeb = exports.supportedChainsTW.find(chain => chain.id === 1993);
@@ -11,7 +11,7 @@ export declare enum PanelView {
11
11
  LOADING = 3,
12
12
  FIAT_PAYMENT = 4
13
13
  }
14
- export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton }: {
14
+ export declare function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet, mode, defaultActiveTab, loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }: {
15
15
  destinationTokenAddress?: string;
16
16
  destinationTokenChainId?: number;
17
17
  isMainnet?: boolean;
@@ -19,4 +19,5 @@ export declare function AnySpend({ destinationTokenAddress, destinationTokenChai
19
19
  defaultActiveTab?: "crypto" | "fiat";
20
20
  loadOrder?: string;
21
21
  hideTransactionHistoryButton?: boolean;
22
+ recipientAddress?: string;
22
23
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,8 +2,8 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { getDefaultToken, OrderType, TradeType, USDC_BASE, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote } from "../../../anyspend";
4
4
  import { Button, ShinyButton, StyleRoot, TransitionPanel, useAccountWallet, useOnchainName, useRouter, useSearchParamsSSR, useTokenData, useTokenFromUrl } from "../../../global-account/react";
5
- import { shortenAddress } from "../../../shared/utils/formatAddress";
6
5
  import { cn } from "../../../shared/utils/cn";
6
+ import { shortenAddress } from "../../../shared/utils/formatAddress";
7
7
  import { formatDisplayNumber, formatTokenAmount } from "../../../shared/utils/number";
8
8
  import { motion } from "framer-motion";
9
9
  import invariant from "invariant";
@@ -29,7 +29,7 @@ export var PanelView;
29
29
  PanelView[PanelView["FIAT_PAYMENT"] = 4] = "FIAT_PAYMENT";
30
30
  })(PanelView || (PanelView = {}));
31
31
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
32
- export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton }) {
32
+ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isMainnet = true, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps }) {
33
33
  const searchParams = useSearchParamsSSR();
34
34
  const router = useRouter();
35
35
  // Determine if we're in "buy mode" based on whether destination token props are provided
@@ -272,8 +272,8 @@ export function AnySpend({ destinationTokenAddress, destinationTokenChainId, isM
272
272
  const { address: globalAddress, wallet: globalWallet } = useAccountWallet();
273
273
  // Set default recipient address when wallet changes
274
274
  useEffect(() => {
275
- setRecipientAddress(globalAddress);
276
- }, [globalAddress]);
275
+ setRecipientAddress(recipientAddressFromProps || globalAddress);
276
+ }, [recipientAddressFromProps, globalAddress]);
277
277
  // Get anyspend price
278
278
  const activeInputAmountInWei = isSrcInputDirty
279
279
  ? parseUnits(srcAmount.replaceAll(",", ""), selectedSrcToken.decimals).toString()
@@ -1,9 +1,10 @@
1
- export declare function AnySpendBuySpin({ isMainnet, loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, onSuccess }: {
1
+ export declare function AnySpendBuySpin({ isMainnet, loadOrder, mode, spinwheelContractAddress, chainId, recipientAddress, prefillQuantity, onSuccess }: {
2
2
  isMainnet?: boolean;
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  spinwheelContractAddress: string;
6
6
  chainId: number;
7
7
  recipientAddress: string;
8
+ prefillQuantity?: string;
8
9
  onSuccess?: (txHash?: string) => void;
9
10
  }): import("react/jsx-runtime").JSX.Element;