@b3dotfun/sdk 0.1.2-alpha.0 → 0.1.2-alpha.2
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.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +12 -6
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +10 -4
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +7 -4
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +3 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/cjs/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/cjs/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/cjs/anyspend/react/components/types/classes.js +6 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +3 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +3 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +12 -6
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +10 -4
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +4 -1
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +19 -4
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/esm/anyspend/react/components/QRDeposit.js +12 -4
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +7 -5
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +4 -3
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +7 -6
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +15 -6
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +10 -6
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +7 -4
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +3 -2
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +2 -2
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +20 -7
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +3 -2
- package/dist/esm/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +5 -2
- package/dist/esm/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/TabSection.js +16 -7
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +3 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/esm/anyspend/react/components/common/WarningText.js +5 -6
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/esm/anyspend/react/components/types/classes.js +5 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +3 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +3 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +3 -0
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +4 -1
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +4 -1
- package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FeeDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/FiatPaymentMethod.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/PanelOnrampPayment.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/RecipientSelection.d.ts +6 -1
- package/dist/types/anyspend/react/components/common/TabSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +8 -7
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/types/classes.d.ts +390 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +3 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +41 -20
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +31 -13
- package/src/anyspend/react/components/AnySpendDeposit.tsx +171 -52
- package/src/anyspend/react/components/QRDeposit.tsx +91 -35
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +31 -19
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +14 -4
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +43 -23
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +53 -32
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +26 -13
- package/src/anyspend/react/components/common/OrderDetails.tsx +16 -3
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +5 -1
- package/src/anyspend/react/components/common/OrderHistory.tsx +2 -1
- package/src/anyspend/react/components/common/PanelOnramp.tsx +4 -1
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +118 -40
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +28 -14
- package/src/anyspend/react/components/common/RecipientSelection.tsx +20 -5
- package/src/anyspend/react/components/common/TabSection.tsx +21 -12
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +12 -4
- package/src/anyspend/react/components/common/WarningText.tsx +10 -10
- package/src/anyspend/react/components/index.ts +16 -0
- package/src/anyspend/react/components/types/classes.ts +476 -0
- package/src/global-account/react/stores/useModalStore.ts +3 -0
|
@@ -14,6 +14,7 @@ import { ChainTokenIcon } from "./common/ChainTokenIcon";
|
|
|
14
14
|
import { OrderDetails } from "./common/OrderDetails";
|
|
15
15
|
import { TransferResultScreen } from "./common/TransferResultScreen";
|
|
16
16
|
import { ChainWarningText, WarningText } from "./common/WarningText";
|
|
17
|
+
import type { QRDepositClasses } from "./types/classes";
|
|
17
18
|
|
|
18
19
|
export interface QRDepositProps {
|
|
19
20
|
/** Display mode */
|
|
@@ -40,6 +41,8 @@ export interface QRDepositProps {
|
|
|
40
41
|
onOrderCreated?: (orderId: string) => void;
|
|
41
42
|
/** Callback when deposit is completed */
|
|
42
43
|
onSuccess?: (txHash?: string) => void;
|
|
44
|
+
/** Custom classes for styling */
|
|
45
|
+
classes?: QRDepositClasses;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
// Default source token: ETH on Base
|
|
@@ -81,6 +84,7 @@ export function QRDeposit({
|
|
|
81
84
|
onClose,
|
|
82
85
|
onOrderCreated,
|
|
83
86
|
onSuccess,
|
|
87
|
+
classes,
|
|
84
88
|
}: QRDepositProps) {
|
|
85
89
|
const [copied, setCopied] = useState(false);
|
|
86
90
|
const [orderId, setOrderId] = useState<string | undefined>();
|
|
@@ -238,12 +242,17 @@ export function QRDeposit({
|
|
|
238
242
|
if (oat?.data && oat.data.depositTxs && oat.data.depositTxs.length > 0) {
|
|
239
243
|
return (
|
|
240
244
|
<div
|
|
241
|
-
className={
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
className={
|
|
246
|
+
classes?.orderDetailsContainer ||
|
|
247
|
+
cn(
|
|
248
|
+
"anyspend-container anyspend-qr-order-details font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6",
|
|
249
|
+
mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
250
|
+
)
|
|
251
|
+
}
|
|
245
252
|
>
|
|
246
|
-
<div
|
|
253
|
+
<div
|
|
254
|
+
className={classes?.orderDetailsContent || "anyspend-qr-order-details-content relative flex flex-col gap-4"}
|
|
255
|
+
>
|
|
247
256
|
<OrderDetails
|
|
248
257
|
mode={mode}
|
|
249
258
|
order={oat.data.order}
|
|
@@ -262,14 +271,26 @@ export function QRDeposit({
|
|
|
262
271
|
if (isCreatingOrder && !orderId && !isPureTransfer) {
|
|
263
272
|
return (
|
|
264
273
|
<div
|
|
265
|
-
className={
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
274
|
+
className={
|
|
275
|
+
classes?.loadingContainer ||
|
|
276
|
+
cn(
|
|
277
|
+
"anyspend-container anyspend-qr-loading font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6",
|
|
278
|
+
mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
279
|
+
)
|
|
280
|
+
}
|
|
269
281
|
>
|
|
270
|
-
<div
|
|
271
|
-
|
|
272
|
-
|
|
282
|
+
<div
|
|
283
|
+
className={
|
|
284
|
+
classes?.loadingContent ||
|
|
285
|
+
"anyspend-qr-loading-content flex flex-col items-center justify-center gap-4 py-12"
|
|
286
|
+
}
|
|
287
|
+
>
|
|
288
|
+
<Loader2
|
|
289
|
+
className={classes?.loadingSpinner || "anyspend-qr-loading-spinner text-as-brand h-8 w-8 animate-spin"}
|
|
290
|
+
/>
|
|
291
|
+
<p className={classes?.loadingText || "anyspend-qr-loading-text text-as-secondary text-sm"}>
|
|
292
|
+
Creating deposit order...
|
|
293
|
+
</p>
|
|
273
294
|
</div>
|
|
274
295
|
</div>
|
|
275
296
|
);
|
|
@@ -277,22 +298,31 @@ export function QRDeposit({
|
|
|
277
298
|
|
|
278
299
|
return (
|
|
279
300
|
<div
|
|
280
|
-
className={
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
301
|
+
className={
|
|
302
|
+
classes?.container ||
|
|
303
|
+
cn(
|
|
304
|
+
"anyspend-container anyspend-qr-deposit font-inter bg-as-surface-primary mx-auto w-full max-w-[460px] p-6",
|
|
305
|
+
mode === "page" && "border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl",
|
|
306
|
+
)
|
|
307
|
+
}
|
|
284
308
|
>
|
|
285
|
-
<div className="anyspend-qr-deposit-content flex flex-col gap-4">
|
|
309
|
+
<div className={classes?.content || "anyspend-qr-deposit-content flex flex-col gap-4"}>
|
|
286
310
|
{/* Header with back button and close button */}
|
|
287
|
-
<div className="anyspend-qr-header flex items-center justify-between">
|
|
288
|
-
<button
|
|
311
|
+
<div className={classes?.header || "anyspend-qr-header flex items-center justify-between"}>
|
|
312
|
+
<button
|
|
313
|
+
onClick={handleBack}
|
|
314
|
+
className={classes?.backButton || "anyspend-qr-back-button text-as-secondary hover:text-as-primary"}
|
|
315
|
+
>
|
|
289
316
|
<svg className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
290
317
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
|
|
291
318
|
</svg>
|
|
292
319
|
</button>
|
|
293
|
-
<h2 className="anyspend-qr-title text-as-primary text-base font-semibold">Deposit</h2>
|
|
320
|
+
<h2 className={classes?.title || "anyspend-qr-title text-as-primary text-base font-semibold"}>Deposit</h2>
|
|
294
321
|
{onClose ? (
|
|
295
|
-
<button
|
|
322
|
+
<button
|
|
323
|
+
onClick={handleClose}
|
|
324
|
+
className={classes?.closeButton || "anyspend-qr-close-button text-as-secondary hover:text-as-primary"}
|
|
325
|
+
>
|
|
296
326
|
<svg className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
297
327
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
|
298
328
|
</svg>
|
|
@@ -303,8 +333,10 @@ export function QRDeposit({
|
|
|
303
333
|
</div>
|
|
304
334
|
|
|
305
335
|
{/* Token selector */}
|
|
306
|
-
<div className="anyspend-qr-token-selector flex flex-col gap-1.5">
|
|
307
|
-
<label className="anyspend-qr-token-label text-as-secondary text-sm">
|
|
336
|
+
<div className={classes?.tokenSelectorContainer || "anyspend-qr-token-selector flex flex-col gap-1.5"}>
|
|
337
|
+
<label className={classes?.tokenSelectorLabel || "anyspend-qr-token-label text-as-secondary text-sm"}>
|
|
338
|
+
Send
|
|
339
|
+
</label>
|
|
308
340
|
<TokenSelector
|
|
309
341
|
chainIdsFilter={getAvailableChainIds("from")}
|
|
310
342
|
context="from"
|
|
@@ -320,7 +352,10 @@ export function QRDeposit({
|
|
|
320
352
|
<Button
|
|
321
353
|
variant="outline"
|
|
322
354
|
role="combobox"
|
|
323
|
-
className=
|
|
355
|
+
className={
|
|
356
|
+
classes?.tokenSelectorTrigger ||
|
|
357
|
+
"anyspend-qr-token-trigger border-as-stroke bg-as-surface-secondary flex h-auto w-full items-center justify-between gap-2 rounded-xl border px-3 py-2.5"
|
|
358
|
+
}
|
|
324
359
|
>
|
|
325
360
|
<div className="flex items-center gap-2">
|
|
326
361
|
{sourceToken.metadata?.logoURI ? (
|
|
@@ -344,27 +379,40 @@ export function QRDeposit({
|
|
|
344
379
|
</div>
|
|
345
380
|
|
|
346
381
|
{/* QR Code and Address - horizontal layout */}
|
|
347
|
-
<div
|
|
382
|
+
<div
|
|
383
|
+
className={
|
|
384
|
+
classes?.qrContent || "anyspend-qr-content border-as-stroke flex items-start gap-4 rounded-xl border p-4"
|
|
385
|
+
}
|
|
386
|
+
>
|
|
348
387
|
{/* QR Code */}
|
|
349
|
-
<div className="anyspend-qr-code-container flex flex-col items-center gap-2">
|
|
350
|
-
<div className="anyspend-qr-code rounded-lg bg-white p-2">
|
|
388
|
+
<div className={classes?.qrCodeContainer || "anyspend-qr-code-container flex flex-col items-center gap-2"}>
|
|
389
|
+
<div className={classes?.qrCode || "anyspend-qr-code rounded-lg bg-white p-2"}>
|
|
351
390
|
<QRCodeSVG value={displayAddress} size={120} level="M" marginSize={0} />
|
|
352
391
|
</div>
|
|
353
|
-
<span className="anyspend-qr-scan-hint text-as-secondary text-xs">
|
|
392
|
+
<span className={classes?.qrScanHint || "anyspend-qr-scan-hint text-as-secondary text-xs"}>
|
|
354
393
|
SCAN WITH <span className="inline-block">🦊</span>
|
|
355
394
|
</span>
|
|
356
395
|
</div>
|
|
357
396
|
|
|
358
397
|
{/* Address info */}
|
|
359
|
-
<div className="anyspend-qr-address-container flex flex-1 flex-col gap-1">
|
|
360
|
-
<span className="anyspend-qr-address-label text-as-secondary text-sm">
|
|
361
|
-
|
|
362
|
-
|
|
398
|
+
<div className={classes?.addressContainer || "anyspend-qr-address-container flex flex-1 flex-col gap-1"}>
|
|
399
|
+
<span className={classes?.addressLabel || "anyspend-qr-address-label text-as-secondary text-sm"}>
|
|
400
|
+
Deposit address:
|
|
401
|
+
</span>
|
|
402
|
+
<div className={classes?.addressRow || "anyspend-qr-address-row flex items-start gap-1"}>
|
|
403
|
+
<span
|
|
404
|
+
className={
|
|
405
|
+
classes?.address || "anyspend-qr-address text-as-primary break-all font-mono text-sm leading-relaxed"
|
|
406
|
+
}
|
|
407
|
+
>
|
|
363
408
|
{displayAddress}
|
|
364
409
|
</span>
|
|
365
410
|
<button
|
|
366
411
|
onClick={handleCopyAddress}
|
|
367
|
-
className=
|
|
412
|
+
className={
|
|
413
|
+
classes?.addressCopyIcon ||
|
|
414
|
+
"anyspend-qr-copy-icon text-as-secondary hover:text-as-primary mt-0.5 shrink-0"
|
|
415
|
+
}
|
|
368
416
|
>
|
|
369
417
|
{copied ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
|
|
370
418
|
</button>
|
|
@@ -381,7 +429,12 @@ export function QRDeposit({
|
|
|
381
429
|
|
|
382
430
|
{/* Watching indicator for pure transfers */}
|
|
383
431
|
{isPureTransfer && isWatchingTransfer && (
|
|
384
|
-
<div
|
|
432
|
+
<div
|
|
433
|
+
className={
|
|
434
|
+
classes?.watchingIndicator ||
|
|
435
|
+
"anyspend-qr-watching flex items-center justify-center gap-2 rounded-lg bg-blue-500/10 p-3"
|
|
436
|
+
}
|
|
437
|
+
>
|
|
385
438
|
<Loader2 className="h-4 w-4 animate-spin text-blue-500" />
|
|
386
439
|
<span className="text-sm text-blue-500">Watching for incoming transfer...</span>
|
|
387
440
|
</div>
|
|
@@ -390,7 +443,10 @@ export function QRDeposit({
|
|
|
390
443
|
{/* Copy button */}
|
|
391
444
|
<button
|
|
392
445
|
onClick={handleCopyAddress}
|
|
393
|
-
className=
|
|
446
|
+
className={
|
|
447
|
+
classes?.copyButton ||
|
|
448
|
+
"anyspend-qr-copy-button flex w-full items-center justify-center gap-2 rounded-xl bg-blue-500 py-3.5 font-medium text-white transition-all hover:bg-blue-600"
|
|
449
|
+
}
|
|
394
450
|
>
|
|
395
451
|
Copy deposit address
|
|
396
452
|
</button>
|
|
@@ -5,6 +5,7 @@ import { motion } from "motion/react";
|
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
6
|
import { components } from "../../../types/api";
|
|
7
7
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay";
|
|
8
|
+
import type { CryptoPaySectionClasses } from "../types/classes";
|
|
8
9
|
import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
|
|
9
10
|
import { CryptoPaymentMethodDisplay } from "./CryptoPaymentMethodDisplay";
|
|
10
11
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
@@ -29,6 +30,8 @@ interface CryptoPaySectionProps {
|
|
|
29
30
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
30
31
|
// Fee detail callback
|
|
31
32
|
onShowFeeDetail?: () => void;
|
|
33
|
+
// Custom classes for styling
|
|
34
|
+
classes?: CryptoPaySectionClasses;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export function CryptoPaySection({
|
|
@@ -45,6 +48,7 @@ export function CryptoPaySection({
|
|
|
45
48
|
anyspendQuote,
|
|
46
49
|
onTokenSelect,
|
|
47
50
|
onShowFeeDetail,
|
|
51
|
+
classes,
|
|
48
52
|
}: CryptoPaySectionProps) {
|
|
49
53
|
const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
|
|
50
54
|
|
|
@@ -87,10 +91,13 @@ export function CryptoPaySection({
|
|
|
87
91
|
initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
|
|
88
92
|
animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
|
|
89
93
|
transition={{ duration: 0.3, delay: 0, ease: "easeInOut" }}
|
|
90
|
-
className=
|
|
94
|
+
className={
|
|
95
|
+
classes?.container ||
|
|
96
|
+
"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"
|
|
97
|
+
}
|
|
91
98
|
>
|
|
92
99
|
<div className="flex items-center justify-between">
|
|
93
|
-
<div className="text-as-primary/50 flex h-7 items-center gap-1.5 text-sm">
|
|
100
|
+
<div className={classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm"}>
|
|
94
101
|
Pay
|
|
95
102
|
{!isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (
|
|
96
103
|
<button onClick={onShowFeeDetail} className="text-as-primary/40 hover:text-as-primary/60 transition-colors">
|
|
@@ -99,7 +106,10 @@ export function CryptoPaySection({
|
|
|
99
106
|
)}
|
|
100
107
|
</div>
|
|
101
108
|
<button
|
|
102
|
-
className=
|
|
109
|
+
className={
|
|
110
|
+
classes?.paymentMethodButton ||
|
|
111
|
+
"text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none"
|
|
112
|
+
}
|
|
103
113
|
onClick={onSelectCryptoPaymentMethod}
|
|
104
114
|
>
|
|
105
115
|
<CryptoPaymentMethodDisplay
|
|
@@ -109,22 +119,24 @@ export function CryptoPaySection({
|
|
|
109
119
|
/>
|
|
110
120
|
</button>
|
|
111
121
|
</div>
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
<div className={classes?.inputContainer}>
|
|
123
|
+
<OrderTokenAmount
|
|
124
|
+
address={walletAddress}
|
|
125
|
+
walletAddress={walletAddress}
|
|
126
|
+
context="from"
|
|
127
|
+
inputValue={srcAmount}
|
|
128
|
+
onChangeInput={value => {
|
|
129
|
+
setIsSrcInputDirty(true);
|
|
130
|
+
setSrcAmount(value);
|
|
131
|
+
}}
|
|
132
|
+
chainId={selectedSrcChainId}
|
|
133
|
+
setChainId={setSelectedSrcChainId}
|
|
134
|
+
token={selectedSrcToken}
|
|
135
|
+
setToken={setSelectedSrcToken}
|
|
136
|
+
onTokenSelect={onTokenSelect}
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
<div className={classes?.balanceRow || "flex items-center justify-between"}>
|
|
128
140
|
<div className="text-as-primary/50 flex h-5 items-center text-sm">
|
|
129
141
|
{formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
|
|
130
142
|
style: "currency",
|
|
@@ -8,6 +8,7 @@ import { ChevronLeft, ChevronRightCircle, Wallet, X, ZapIcon } from "lucide-reac
|
|
|
8
8
|
import { useConnectModal, useDisconnect, useWalletInfo } from "thirdweb/react";
|
|
9
9
|
import { createWallet } from "thirdweb/wallets";
|
|
10
10
|
import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay";
|
|
11
|
+
import type { CryptoPaymentMethodClasses } from "../types/classes";
|
|
11
12
|
|
|
12
13
|
export enum CryptoPaymentMethodType {
|
|
13
14
|
NONE = "none",
|
|
@@ -29,6 +30,7 @@ interface CryptoPaymentMethodProps {
|
|
|
29
30
|
isCreatingOrder: boolean;
|
|
30
31
|
onBack: () => void;
|
|
31
32
|
onSelectPaymentMethod: (method: CryptoPaymentMethodType) => void;
|
|
33
|
+
classes?: CryptoPaymentMethodClasses;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export function CryptoPaymentMethod({
|
|
@@ -37,6 +39,7 @@ export function CryptoPaymentMethod({
|
|
|
37
39
|
isCreatingOrder,
|
|
38
40
|
onBack,
|
|
39
41
|
onSelectPaymentMethod,
|
|
42
|
+
classes,
|
|
40
43
|
}: CryptoPaymentMethodProps) {
|
|
41
44
|
const { connectedEOAWallet, connectedSmartWallet } = useAccountWallet();
|
|
42
45
|
const { disconnect } = useDisconnect();
|
|
@@ -96,16 +99,23 @@ export function CryptoPaymentMethod({
|
|
|
96
99
|
};
|
|
97
100
|
|
|
98
101
|
return (
|
|
99
|
-
<div
|
|
102
|
+
<div
|
|
103
|
+
className={
|
|
104
|
+
classes?.container || "crypto-payment-method mx-auto h-fit w-[460px] max-w-full px-5 pb-5 pt-5 sm:px-0 sm:pt-5"
|
|
105
|
+
}
|
|
106
|
+
>
|
|
100
107
|
<div className={cn("relative flex flex-col gap-10")}>
|
|
101
108
|
{/* Header */}
|
|
102
109
|
<button
|
|
103
110
|
onClick={onBack}
|
|
104
|
-
className=
|
|
111
|
+
className={
|
|
112
|
+
classes?.backButton ||
|
|
113
|
+
"text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors"
|
|
114
|
+
}
|
|
105
115
|
>
|
|
106
116
|
<ChevronLeft className="h-6 w-6" />
|
|
107
117
|
</button>
|
|
108
|
-
<div className="flex items-center justify-around gap-4">
|
|
118
|
+
<div className={classes?.header || "flex items-center justify-around gap-4"}>
|
|
109
119
|
<div className="flex-1 text-center">
|
|
110
120
|
<h2 className="text-as-primary text-lg font-semibold">Select a payment method</h2>
|
|
111
121
|
</div>
|
|
@@ -155,7 +165,7 @@ export function CryptoPaymentMethod({
|
|
|
155
165
|
)}
|
|
156
166
|
|
|
157
167
|
{/* Payment Methods */}
|
|
158
|
-
<div className="crypto-payment-methods flex flex-col gap-4">
|
|
168
|
+
<div className={classes?.optionsList || "crypto-payment-methods flex flex-col gap-4"}>
|
|
159
169
|
{/* Installed Wallets Section */}
|
|
160
170
|
{(shouldShowConnectedEOA || globalAddress) && (
|
|
161
171
|
<div className="installed-wallets">
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ALL_CHAINS } from "@b3dotfun/sdk/anyspend";
|
|
2
2
|
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
3
|
-
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
3
|
import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
|
|
5
4
|
import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
|
|
6
5
|
import { ChevronRight, Info } from "lucide-react";
|
|
7
6
|
import { motion } from "motion/react";
|
|
8
7
|
import { components } from "../../../types/api";
|
|
8
|
+
import type { CryptoReceiveSectionClasses } from "../types/classes";
|
|
9
9
|
import { OrderTokenAmount } from "./OrderTokenAmount";
|
|
10
10
|
import { PointsBadge } from "./PointsBadge";
|
|
11
11
|
|
|
@@ -36,6 +36,8 @@ interface CryptoReceiveSectionProps {
|
|
|
36
36
|
onShowPointsDetail?: () => void;
|
|
37
37
|
// Fee detail navigation
|
|
38
38
|
onShowFeeDetail?: () => void;
|
|
39
|
+
// Custom classes for styling
|
|
40
|
+
classes?: CryptoReceiveSectionClasses;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export function CryptoReceiveSection({
|
|
@@ -57,16 +59,20 @@ export function CryptoReceiveSection({
|
|
|
57
59
|
dstTokenLogoURI,
|
|
58
60
|
onShowPointsDetail,
|
|
59
61
|
onShowFeeDetail,
|
|
62
|
+
classes,
|
|
60
63
|
}: CryptoReceiveSectionProps) {
|
|
61
64
|
return (
|
|
62
65
|
<motion.div
|
|
63
66
|
initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
|
|
64
67
|
animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
|
|
65
68
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
66
|
-
className=
|
|
69
|
+
className={
|
|
70
|
+
classes?.container ||
|
|
71
|
+
"receive-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"
|
|
72
|
+
}
|
|
67
73
|
>
|
|
68
74
|
<div className="flex w-full items-center justify-between">
|
|
69
|
-
<div className="text-as-primary/50 flex h-7 items-center gap-1.5 text-sm">
|
|
75
|
+
<div className={classes?.label || "text-as-primary/50 flex h-7 items-center gap-1.5 text-sm"}>
|
|
70
76
|
{isDepositMode ? "Deposit" : "Receive"}
|
|
71
77
|
{isSrcInputDirty && anyspendQuote?.data?.fee && onShowFeeDetail && (
|
|
72
78
|
<button onClick={onShowFeeDetail} className="text-as-primary/40 hover:text-as-primary/60 transition-colors">
|
|
@@ -76,11 +82,11 @@ export function CryptoReceiveSection({
|
|
|
76
82
|
</div>
|
|
77
83
|
{effectiveRecipientAddress ? (
|
|
78
84
|
<button
|
|
79
|
-
className={
|
|
85
|
+
className={classes?.recipientButton || "text-as-tertiarry flex h-7 items-center gap-2 rounded-lg"}
|
|
80
86
|
onClick={onSelectRecipient}
|
|
81
87
|
>
|
|
82
88
|
<>
|
|
83
|
-
<span className="text-as-tertiarry flex items-center gap-1 text-sm">
|
|
89
|
+
<span className={classes?.recipientValue || "text-as-tertiarry flex items-center gap-1 text-sm"}>
|
|
84
90
|
{customRecipientLabel ||
|
|
85
91
|
(recipientName ? formatUsername(recipientName) : shortenAddress(effectiveRecipientAddress || ""))}
|
|
86
92
|
</span>
|
|
@@ -88,50 +94,64 @@ export function CryptoReceiveSection({
|
|
|
88
94
|
</>
|
|
89
95
|
</button>
|
|
90
96
|
) : (
|
|
91
|
-
<button
|
|
97
|
+
<button
|
|
98
|
+
className={classes?.recipientButton || "text-as-primary/70 flex items-center gap-1 rounded-lg"}
|
|
99
|
+
onClick={onSelectRecipient}
|
|
100
|
+
>
|
|
92
101
|
<div className="text-sm font-medium">Select recipient</div>
|
|
93
102
|
</button>
|
|
94
103
|
)}
|
|
95
104
|
</div>
|
|
96
105
|
{isBuyMode || isDepositMode ? (
|
|
97
106
|
// Fixed destination token display for buy mode and deposit mode
|
|
98
|
-
<div className="flex items-center justify-between">
|
|
99
|
-
<div className="text-as-primary text-2xl font-bold">{dstAmount || "0"}</div>
|
|
100
|
-
<div
|
|
107
|
+
<div className={classes?.inputContainer || "flex items-center justify-between"}>
|
|
108
|
+
<div className={classes?.input || "text-as-primary text-2xl font-bold"}>{dstAmount || "0"}</div>
|
|
109
|
+
<div
|
|
110
|
+
className={
|
|
111
|
+
classes?.tokenSelector ||
|
|
112
|
+
"bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3"
|
|
113
|
+
}
|
|
114
|
+
>
|
|
101
115
|
{(dstTokenLogoURI || dstToken.metadata?.logoURI) && (
|
|
102
116
|
<div className="relative">
|
|
103
117
|
<img
|
|
104
118
|
src={dstTokenLogoURI || dstToken.metadata?.logoURI}
|
|
105
119
|
alt={dstTokenSymbol || dstToken.symbol}
|
|
106
|
-
className="h-8 w-8 rounded-full"
|
|
120
|
+
className={classes?.tokenIcon || "h-8 w-8 rounded-full"}
|
|
107
121
|
/>
|
|
108
122
|
{/* Chain logo overlay */}
|
|
109
123
|
{ALL_CHAINS[dstToken.chainId]?.logoUrl && (
|
|
110
124
|
<img
|
|
111
125
|
src={ALL_CHAINS[dstToken.chainId].logoUrl}
|
|
112
126
|
alt="Chain"
|
|
113
|
-
className=
|
|
127
|
+
className={
|
|
128
|
+
classes?.chainBadge || "absolute -bottom-1 -right-1 h-4 w-4 rounded-full border border-white"
|
|
129
|
+
}
|
|
114
130
|
/>
|
|
115
131
|
)}
|
|
116
132
|
</div>
|
|
117
133
|
)}
|
|
118
|
-
<span className="text-as-brand text-lg font-bold"
|
|
134
|
+
<span className={classes?.tokenSymbol || "text-as-brand text-lg font-bold"}>
|
|
135
|
+
{dstTokenSymbol || dstToken.symbol}
|
|
136
|
+
</span>
|
|
119
137
|
</div>
|
|
120
138
|
</div>
|
|
121
139
|
) : (
|
|
122
140
|
// Token selection for regular swap mode
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
141
|
+
<div className={classes?.inputContainer}>
|
|
142
|
+
<OrderTokenAmount
|
|
143
|
+
address={effectiveRecipientAddress}
|
|
144
|
+
context="to"
|
|
145
|
+
inputValue={dstAmount}
|
|
146
|
+
onChangeInput={onChangeDstAmount || (() => {})}
|
|
147
|
+
chainId={selectedDstChainId || dstToken.chainId}
|
|
148
|
+
setChainId={setSelectedDstChainId || (() => {})}
|
|
149
|
+
token={dstToken}
|
|
150
|
+
setToken={setSelectedDstToken || (() => {})}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
133
153
|
)}
|
|
134
|
-
<div className="text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm">
|
|
154
|
+
<div className={classes?.feeRow || "text-as-primary/50 flex h-5 items-center justify-start gap-2 text-sm"}>
|
|
135
155
|
<div className="flex items-center gap-2">
|
|
136
156
|
{formatDisplayNumber(anyspendQuote?.data?.currencyOut?.amountUsd, {
|
|
137
157
|
style: "currency",
|