@0xsequence/marketplace-sdk 0.3.5 → 0.3.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.
- package/dist/{chunk-URTXTVOU.js → chunk-F42XMKDS.js} +437 -381
- package/dist/chunk-F42XMKDS.js.map +1 -0
- package/dist/{chunk-Q57TEA3Z.js → chunk-NMCGA2TB.js} +4 -2
- package/dist/chunk-NMCGA2TB.js.map +1 -0
- package/dist/{chunk-6LQST3KZ.js → chunk-Z3VR2KMP.js} +30 -18
- package/dist/chunk-Z3VR2KMP.js.map +1 -0
- package/dist/index.js +11 -11
- package/dist/react/hooks/index.d.ts +3 -1
- package/dist/react/hooks/index.js +4 -4
- package/dist/react/index.js +6 -6
- package/dist/react/ui/components/index.js +6 -6
- package/dist/react/ui/index.d.ts +4 -21
- package/dist/react/ui/index.js +6 -6
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +1 -1
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/src/react/_internal/transaction-machine/execute-transaction.ts +10 -3
- package/src/react/_internal/transaction-machine/useTransactionMachine.ts +18 -5
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -1
- package/src/react/ui/modals/BuyModal/index.tsx +42 -10
- package/src/react/ui/modals/CreateListingModal/index.tsx +9 -16
- package/src/react/ui/modals/MakeOfferModal/_store.ts +1 -1
- package/src/react/ui/modals/MakeOfferModal/index.tsx +9 -12
- package/src/react/ui/modals/SellModal/index.tsx +10 -10
- package/src/react/ui/modals/TransferModal/_store.ts +12 -10
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +2 -2
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +16 -38
- package/src/react/ui/modals/TransferModal/index.tsx +7 -9
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +4 -2
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +25 -3
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +2 -0
- package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +4 -4
- package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +7 -4
- package/src/react/ui/modals/_internal/components/transactionPreview/consts.ts +10 -5
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +27 -8
- package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +3 -5
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +80 -62
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +21 -29
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts +23 -0
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts +29 -0
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts +43 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-6LQST3KZ.js.map +0 -1
- package/dist/chunk-Q57TEA3Z.js.map +0 -1
- package/dist/chunk-URTXTVOU.js.map +0 -1
- package/src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts +0 -30
- package/src/react/ui/modals/MakeOfferModal/_utils/getMakeOfferTransactionTitleMessage.ts +0 -28
- package/src/react/ui/modals/SellModal/_utils/getSellTransactionTitleMessage.ts +0 -28
- package/src/react/ui/modals/TransferModal/_utils/getTransferTransactionTitleMessage.ts +0 -28
- package/src/types/callbacks.ts +0 -51
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import {
|
|
3
3
|
ActionModal
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NMCGA2TB.js";
|
|
5
5
|
import {
|
|
6
6
|
CalendarIcon_default,
|
|
7
7
|
MinusIcon_default,
|
|
@@ -48,12 +48,13 @@ import {
|
|
|
48
48
|
useSwitchChainModal,
|
|
49
49
|
useTransactionMachine,
|
|
50
50
|
useTransferTokens
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-Z3VR2KMP.js";
|
|
52
52
|
import {
|
|
53
53
|
iconVariants
|
|
54
54
|
} from "./chunk-SBVLWSRZ.js";
|
|
55
55
|
import {
|
|
56
56
|
calculatePriceDifferencePercentage,
|
|
57
|
+
getPublicRpcClient,
|
|
57
58
|
truncateMiddle
|
|
58
59
|
} from "./chunk-OUZ42I6B.js";
|
|
59
60
|
import {
|
|
@@ -88,6 +89,7 @@ var AccountModal = observer(function AccountModal2() {
|
|
|
88
89
|
});
|
|
89
90
|
|
|
90
91
|
// src/react/ui/modals/BuyModal/index.tsx
|
|
92
|
+
import { Box as Box3, Text as Text2, TokenImage } from "@0xsequence/design-system";
|
|
91
93
|
import { Show, observer as observer2, useSelector } from "@legendapp/state/react";
|
|
92
94
|
import { useEffect } from "react";
|
|
93
95
|
|
|
@@ -101,9 +103,15 @@ function QuantityInput({
|
|
|
101
103
|
maxQuantity
|
|
102
104
|
}) {
|
|
103
105
|
function handleChangeQuantity(value) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
const sanitizedValue = value.replace(/[^\d.]/g, "");
|
|
107
|
+
const decimalParts = sanitizedValue.split(".");
|
|
108
|
+
let formattedValue = sanitizedValue;
|
|
109
|
+
if (decimalParts.length > 2) {
|
|
110
|
+
formattedValue = decimalParts[0] + "." + decimalParts[1];
|
|
111
|
+
}
|
|
112
|
+
const finalValue = formatQuantity(formattedValue);
|
|
113
|
+
$quantity.set(finalValue);
|
|
114
|
+
validateQuantity(finalValue);
|
|
107
115
|
}
|
|
108
116
|
function validateQuantity(value) {
|
|
109
117
|
if (!value || value.trim() === "" || isNaN(Number(value))) {
|
|
@@ -111,12 +119,21 @@ function QuantityInput({
|
|
|
111
119
|
return;
|
|
112
120
|
}
|
|
113
121
|
const numValue = Number(value);
|
|
122
|
+
const decimalParts = value.split(".");
|
|
123
|
+
if (decimalParts.length > 1 && decimalParts[1].length > decimals) {
|
|
124
|
+
$invalidQuantity.set(true);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
114
127
|
$invalidQuantity.set(numValue <= 0 || numValue > Number(maxQuantity));
|
|
115
128
|
}
|
|
116
129
|
function formatQuantity(value) {
|
|
117
130
|
if (!value || isNaN(Number(value))) {
|
|
118
131
|
return "0";
|
|
119
132
|
}
|
|
133
|
+
const decimalParts = value.split(".");
|
|
134
|
+
if (decimalParts.length > 1 && decimalParts[1].length > decimals) {
|
|
135
|
+
return Number(value).toFixed(decimals);
|
|
136
|
+
}
|
|
120
137
|
if (Number(value) > Number(maxQuantity)) {
|
|
121
138
|
return maxQuantity;
|
|
122
139
|
}
|
|
@@ -220,7 +237,8 @@ var initialState = {
|
|
|
220
237
|
var buyModal$ = observable2(initialState);
|
|
221
238
|
|
|
222
239
|
// src/react/ui/modals/BuyModal/index.tsx
|
|
223
|
-
import {
|
|
240
|
+
import { formatUnits, parseUnits } from "viem";
|
|
241
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
224
242
|
var useBuyModal = (callbacks) => {
|
|
225
243
|
return {
|
|
226
244
|
show: (args) => buyModal$.open({ ...args, defaultCallbacks: callbacks }),
|
|
@@ -288,7 +306,7 @@ function CheckoutModal({
|
|
|
288
306
|
buy({
|
|
289
307
|
orderId: order.orderId,
|
|
290
308
|
collectableDecimals: collectable.decimals || 0,
|
|
291
|
-
quantity: "1",
|
|
309
|
+
quantity: parseUnits("1", collectable.decimals || 0).toString(),
|
|
292
310
|
marketplace: order.marketplace
|
|
293
311
|
});
|
|
294
312
|
};
|
|
@@ -299,8 +317,18 @@ function CheckoutModal({
|
|
|
299
317
|
var ERC1155QuantityModal = observer2(
|
|
300
318
|
({ buy, collectable, order }) => {
|
|
301
319
|
buyModal$.state.quantity.set(
|
|
302
|
-
Math.
|
|
320
|
+
Math.min(Number(order.quantityRemaining), 1).toString()
|
|
303
321
|
);
|
|
322
|
+
const { data: currencies } = useCurrencies({
|
|
323
|
+
chainId: order.chainId,
|
|
324
|
+
collectionAddress: order.collectionContractAddress
|
|
325
|
+
});
|
|
326
|
+
const currency = currencies?.find(
|
|
327
|
+
(currency2) => currency2.contractAddress === order.priceCurrencyAddress
|
|
328
|
+
);
|
|
329
|
+
const quantity = Number(buyModal$.state.quantity.get());
|
|
330
|
+
const pricePerToken = order.priceAmount;
|
|
331
|
+
const totalPrice = (BigInt(quantity) * BigInt(pricePerToken)).toString();
|
|
304
332
|
return /* @__PURE__ */ jsx3(
|
|
305
333
|
ActionModal,
|
|
306
334
|
{
|
|
@@ -309,10 +337,13 @@ var ERC1155QuantityModal = observer2(
|
|
|
309
337
|
title: "Select Quantity",
|
|
310
338
|
ctas: [
|
|
311
339
|
{
|
|
312
|
-
label: "
|
|
340
|
+
label: "Buy now",
|
|
313
341
|
onClick: () => {
|
|
314
342
|
buy({
|
|
315
|
-
quantity:
|
|
343
|
+
quantity: parseUnits(
|
|
344
|
+
buyModal$.state.quantity.get(),
|
|
345
|
+
collectable.decimals || 0
|
|
346
|
+
).toString(),
|
|
316
347
|
orderId: order.orderId,
|
|
317
348
|
collectableDecimals: collectable.decimals || 0,
|
|
318
349
|
marketplace: order.marketplace
|
|
@@ -321,23 +352,33 @@ var ERC1155QuantityModal = observer2(
|
|
|
321
352
|
}
|
|
322
353
|
}
|
|
323
354
|
],
|
|
324
|
-
children: /* @__PURE__ */
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
355
|
+
children: /* @__PURE__ */ jsxs3(Box3, { display: "flex", flexDirection: "column", gap: "4", children: [
|
|
356
|
+
/* @__PURE__ */ jsx3(
|
|
357
|
+
QuantityInput,
|
|
358
|
+
{
|
|
359
|
+
$quantity: buyModal$.state.quantity,
|
|
360
|
+
$invalidQuantity: buyModal$.state.invalidQuantity,
|
|
361
|
+
decimals: order.quantityDecimals,
|
|
362
|
+
maxQuantity: order.quantityRemaining
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
/* @__PURE__ */ jsxs3(Box3, { display: "flex", flexDirection: "column", gap: "2", children: [
|
|
366
|
+
/* @__PURE__ */ jsx3(Text2, { color: "text50", fontSize: "small", children: "Total Price" }),
|
|
367
|
+
/* @__PURE__ */ jsxs3(Box3, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
368
|
+
/* @__PURE__ */ jsx3(TokenImage, { src: currency?.imageUrl, size: "xs" }),
|
|
369
|
+
/* @__PURE__ */ jsx3(Text2, { color: "text", fontSize: "large", fontWeight: "bold", children: formatUnits(BigInt(totalPrice), currency?.decimals || 0) })
|
|
370
|
+
] })
|
|
371
|
+
] })
|
|
372
|
+
] })
|
|
333
373
|
}
|
|
334
374
|
);
|
|
335
375
|
}
|
|
336
376
|
);
|
|
337
377
|
|
|
338
378
|
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
339
|
-
import { Box as
|
|
379
|
+
import { Box as Box13 } from "@0xsequence/design-system";
|
|
340
380
|
import { Show as Show2, observer as observer8 } from "@legendapp/state/react";
|
|
381
|
+
import { parseUnits as parseUnits3 } from "viem";
|
|
341
382
|
import { useAccount as useAccount3 } from "wagmi";
|
|
342
383
|
|
|
343
384
|
// src/react/hooks/useCreateListing.tsx
|
|
@@ -385,18 +426,18 @@ var useCreateListing = ({
|
|
|
385
426
|
};
|
|
386
427
|
|
|
387
428
|
// src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx
|
|
388
|
-
import { Box as
|
|
429
|
+
import { Box as Box4 } from "@0xsequence/design-system";
|
|
389
430
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
390
|
-
var ErrorModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx4(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx4(
|
|
431
|
+
var ErrorModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx4(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx4(Box4, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: "Error loading item details" }) });
|
|
391
432
|
|
|
392
433
|
// src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx
|
|
393
|
-
import { Box as
|
|
434
|
+
import { Box as Box5, Spinner } from "@0xsequence/design-system";
|
|
394
435
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
395
|
-
var LoadingModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx5(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx5(
|
|
436
|
+
var LoadingModal = ({ store, onClose, title }) => /* @__PURE__ */ jsx5(ActionModal, { store, onClose, title, ctas: [], children: /* @__PURE__ */ jsx5(Box5, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: /* @__PURE__ */ jsx5(Spinner, { size: "lg" }) }) });
|
|
396
437
|
|
|
397
438
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
398
439
|
import { useState as useState2 } from "react";
|
|
399
|
-
import { Box as
|
|
440
|
+
import { Box as Box6, Text as Text3 } from "@0xsequence/design-system";
|
|
400
441
|
import { observer as observer3 } from "@legendapp/state/react";
|
|
401
442
|
import { addDays, isSameDay } from "date-fns";
|
|
402
443
|
|
|
@@ -412,9 +453,9 @@ var itemIndicator = "fyvr11lw fyvr1qk fyvr11lk fyvr11ow fyvr11no";
|
|
|
412
453
|
var trigger = "fyvr11hk fyvr11i8 fyvr11g8 fyvr11gw fyvr1zg fyvr111k fyvr11lk fyvr11ow fyvr11no fyvr11ik fyvr14g fyvr11cg fyvr11wr fyvr12w9 fyvr12zf fyvr12s9 fyvr11a4";
|
|
413
454
|
|
|
414
455
|
// src/react/ui/components/_internals/custom-select/CustomSelect.tsx
|
|
415
|
-
import { jsx as jsx6, jsxs as
|
|
456
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
416
457
|
var CustomSelectItem = React.forwardRef(({ children, ...props }, forwardedRef) => {
|
|
417
|
-
return /* @__PURE__ */
|
|
458
|
+
return /* @__PURE__ */ jsxs4(Select.Item, { className: item, ...props, ref: forwardedRef, children: [
|
|
418
459
|
/* @__PURE__ */ jsx6(Select.ItemText, { children }),
|
|
419
460
|
/* @__PURE__ */ jsx6(Select.ItemIndicator, { className: itemIndicator, children: /* @__PURE__ */ jsx6(CheckmarkIcon, { size: "xs" }) })
|
|
420
461
|
] });
|
|
@@ -425,8 +466,8 @@ var CustomSelect = ({
|
|
|
425
466
|
onValueChange,
|
|
426
467
|
defaultValue
|
|
427
468
|
}) => {
|
|
428
|
-
return /* @__PURE__ */
|
|
429
|
-
/* @__PURE__ */
|
|
469
|
+
return /* @__PURE__ */ jsxs4(Select.Root, { onValueChange, defaultValue, children: [
|
|
470
|
+
/* @__PURE__ */ jsxs4(Select.Trigger, { className: trigger, children: [
|
|
430
471
|
/* @__PURE__ */ jsx6(Select.Value, { placeholder }),
|
|
431
472
|
/* @__PURE__ */ jsx6(Select.Icon, { children: /* @__PURE__ */ jsx6(ChevronDownIcon, { size: "xs" }) })
|
|
432
473
|
] }),
|
|
@@ -501,12 +542,12 @@ Calendar.displayName = "Calendar";
|
|
|
501
542
|
var calendar_default = Calendar;
|
|
502
543
|
|
|
503
544
|
// src/react/ui/modals/_internal/components/calendarPopover/index.tsx
|
|
504
|
-
import { jsx as jsx8, jsxs as
|
|
545
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
505
546
|
function CalendarPopover({
|
|
506
547
|
selectedDate,
|
|
507
548
|
setSelectedDate
|
|
508
549
|
}) {
|
|
509
|
-
return /* @__PURE__ */
|
|
550
|
+
return /* @__PURE__ */ jsxs5(Root2, { children: [
|
|
510
551
|
/* @__PURE__ */ jsx8(Trigger2, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
511
552
|
Button2,
|
|
512
553
|
{
|
|
@@ -529,7 +570,7 @@ function CalendarPopover({
|
|
|
529
570
|
}
|
|
530
571
|
|
|
531
572
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
532
|
-
import { jsx as jsx9, jsxs as
|
|
573
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
533
574
|
var PRESET_RANGES = {
|
|
534
575
|
TODAY: {
|
|
535
576
|
label: "Today",
|
|
@@ -582,9 +623,9 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
582
623
|
}
|
|
583
624
|
$date.set(date);
|
|
584
625
|
}
|
|
585
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ jsxs6(Box6, { width: "full", position: "relative", children: [
|
|
586
627
|
/* @__PURE__ */ jsx9(
|
|
587
|
-
|
|
628
|
+
Text3,
|
|
588
629
|
{
|
|
589
630
|
fontSize: "small",
|
|
590
631
|
fontWeight: "medium",
|
|
@@ -595,8 +636,8 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
595
636
|
children: "Set expiry"
|
|
596
637
|
}
|
|
597
638
|
),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
|
|
639
|
+
/* @__PURE__ */ jsxs6(
|
|
640
|
+
Box6,
|
|
600
641
|
{
|
|
601
642
|
className,
|
|
602
643
|
width: "full",
|
|
@@ -606,7 +647,7 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
606
647
|
marginTop: "0.5",
|
|
607
648
|
children: [
|
|
608
649
|
/* @__PURE__ */ jsx9(
|
|
609
|
-
|
|
650
|
+
Box6,
|
|
610
651
|
{
|
|
611
652
|
position: "absolute",
|
|
612
653
|
right: "0",
|
|
@@ -651,7 +692,7 @@ var ExpirationDateSelect = observer3(function ExpirationDateSelect2({
|
|
|
651
692
|
var expirationDateSelect_default = ExpirationDateSelect;
|
|
652
693
|
|
|
653
694
|
// src/react/ui/modals/_internal/components/floorPriceText/index.tsx
|
|
654
|
-
import { Text as
|
|
695
|
+
import { Text as Text4 } from "@0xsequence/design-system";
|
|
655
696
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
656
697
|
function FloorPriceText({
|
|
657
698
|
chainId,
|
|
@@ -678,7 +719,7 @@ function FloorPriceText({
|
|
|
678
719
|
});
|
|
679
720
|
const floorPriceDifferenceText = floorPriceRaw === price.amountRaw ? "Same as floor price" : `${floorPriceDifference}% ${floorPriceRaw > price.amountRaw ? "below" : "above"} floor price`;
|
|
680
721
|
return /* @__PURE__ */ jsx10(
|
|
681
|
-
|
|
722
|
+
Text4,
|
|
682
723
|
{
|
|
683
724
|
fontSize: "small",
|
|
684
725
|
fontWeight: "medium",
|
|
@@ -692,10 +733,10 @@ function FloorPriceText({
|
|
|
692
733
|
}
|
|
693
734
|
|
|
694
735
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
695
|
-
import { Box as
|
|
736
|
+
import { Box as Box7, NumericInput as NumericInput2, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
696
737
|
import { observer as observer5 } from "@legendapp/state/react";
|
|
697
738
|
import { useState as useState3 } from "react";
|
|
698
|
-
import { erc20Abi, parseUnits } from "viem";
|
|
739
|
+
import { erc20Abi, parseUnits as parseUnits2 } from "viem";
|
|
699
740
|
import { useAccount as useAccount2, useReadContract } from "wagmi";
|
|
700
741
|
|
|
701
742
|
// src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx
|
|
@@ -737,7 +778,7 @@ var CurrencyOptionsSelect = observer4(function CurrencyOptionsSelect2({
|
|
|
737
778
|
var currencyOptionsSelect_default = CurrencyOptionsSelect;
|
|
738
779
|
|
|
739
780
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
740
|
-
import { jsx as jsx12, jsxs as
|
|
781
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
741
782
|
var PriceInput = observer5(function PriceInput2({
|
|
742
783
|
chainId,
|
|
743
784
|
collectionAddress,
|
|
@@ -770,20 +811,20 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
770
811
|
};
|
|
771
812
|
const changeListingPrice = (value2) => {
|
|
772
813
|
setValue(value2);
|
|
773
|
-
const parsedAmount =
|
|
814
|
+
const parsedAmount = parseUnits2(value2, Number(currencyDecimals));
|
|
774
815
|
$listingPrice.amountRaw.set(parsedAmount.toString());
|
|
775
816
|
checkBalance && checkInsufficientBalance(parsedAmount.toString());
|
|
776
817
|
};
|
|
777
|
-
return /* @__PURE__ */
|
|
818
|
+
return /* @__PURE__ */ jsxs7(Box7, { className: priceInputWrapper, position: "relative", children: [
|
|
778
819
|
/* @__PURE__ */ jsx12(
|
|
779
|
-
|
|
820
|
+
Box7,
|
|
780
821
|
{
|
|
781
822
|
className: priceInputCurrencyImage,
|
|
782
823
|
position: "absolute",
|
|
783
824
|
left: "2",
|
|
784
825
|
display: "flex",
|
|
785
826
|
alignItems: "center",
|
|
786
|
-
children: /* @__PURE__ */ jsx12(
|
|
827
|
+
children: /* @__PURE__ */ jsx12(TokenImage2, { src: $listingPrice.currency.imageUrl.get(), size: "xs" })
|
|
787
828
|
}
|
|
788
829
|
),
|
|
789
830
|
/* @__PURE__ */ jsx12(
|
|
@@ -806,19 +847,19 @@ var PriceInput = observer5(function PriceInput2({
|
|
|
806
847
|
width: "full"
|
|
807
848
|
}
|
|
808
849
|
),
|
|
809
|
-
balanceError && /* @__PURE__ */ jsx12(
|
|
850
|
+
balanceError && /* @__PURE__ */ jsx12(Box7, { color: "negative", fontSize: "small", children: balanceError })
|
|
810
851
|
] });
|
|
811
852
|
});
|
|
812
853
|
var priceInput_default = PriceInput;
|
|
813
854
|
|
|
814
855
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
815
|
-
import { Box as
|
|
856
|
+
import { Box as Box8, Image, Skeleton as Skeleton2, Text as Text5 } from "@0xsequence/design-system";
|
|
816
857
|
|
|
817
858
|
// src/react/ui/images/chess-tile.png
|
|
818
859
|
var chess_tile_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK8AAACuCAYAAABAzl3QAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgB7dyxbUMxEAXBs6FEjagv91/AD+keeNFCMw1csmBEvJ/P53Nm4Xme2Xi/37Ph/nfeP+f8/Q5EiZcs8ZIlXrLES5Z4yRIvWeIlS7xkiZcs8ZIlXrLES5Z4yRIvWS//Ud2v3vfykiVessRLlnjJEi9Z4iVLvGSJlyzxkiVessRLlnjJEi9Z4iVLvGS9/Ed1v3j/nOPlpUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMmyz+v+bNjnhQviJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWfV73Z8M+L1wQL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6y7PO6Pxv2eeGCeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSZZ/X/dmwzwsXxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPu87s+GfV64IF6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZNnndX827PPCBfGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1niJcs+r/uzYZ8XLoiXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6yxEuWeMkSL1n2ed2fDfu8cEG8ZImXLPGSJV6yxEuWeMkSL1niJUu8ZImXLPGSJV6y/gF97MkwfJRH7QAAAABJRU5ErkJggg==";
|
|
819
860
|
|
|
820
861
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
821
|
-
import { jsx as jsx13, jsxs as
|
|
862
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
822
863
|
function TokenPreview({
|
|
823
864
|
collectionName,
|
|
824
865
|
collectionAddress,
|
|
@@ -831,15 +872,15 @@ function TokenPreview({
|
|
|
831
872
|
collectibleId
|
|
832
873
|
});
|
|
833
874
|
if (collectibleLoading) {
|
|
834
|
-
return /* @__PURE__ */
|
|
875
|
+
return /* @__PURE__ */ jsxs8(Box8, { display: "flex", alignItems: "center", gap: "3", width: "full", children: [
|
|
835
876
|
/* @__PURE__ */ jsx13(Skeleton2, { width: "9", height: "9", borderRadius: "xs" }),
|
|
836
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ jsxs8(Box8, { display: "flex", flexGrow: "1", gap: "1", flexDirection: "column", children: [
|
|
837
878
|
/* @__PURE__ */ jsx13(Skeleton2, { width: "1/3", height: "3" }),
|
|
838
879
|
/* @__PURE__ */ jsx13(Skeleton2, { width: "1/2", height: "3" })
|
|
839
880
|
] })
|
|
840
881
|
] });
|
|
841
882
|
}
|
|
842
|
-
return /* @__PURE__ */
|
|
883
|
+
return /* @__PURE__ */ jsxs8(Box8, { className: tokenPreview, children: [
|
|
843
884
|
/* @__PURE__ */ jsx13(
|
|
844
885
|
Image,
|
|
845
886
|
{
|
|
@@ -850,9 +891,9 @@ function TokenPreview({
|
|
|
850
891
|
borderRadius: "xs"
|
|
851
892
|
}
|
|
852
893
|
),
|
|
853
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ jsxs8(Box8, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
|
|
854
895
|
/* @__PURE__ */ jsx13(
|
|
855
|
-
|
|
896
|
+
Text5,
|
|
856
897
|
{
|
|
857
898
|
fontSize: "small",
|
|
858
899
|
color: "text80",
|
|
@@ -862,7 +903,7 @@ function TokenPreview({
|
|
|
862
903
|
}
|
|
863
904
|
),
|
|
864
905
|
/* @__PURE__ */ jsx13(
|
|
865
|
-
|
|
906
|
+
Text5,
|
|
866
907
|
{
|
|
867
908
|
fontSize: "small",
|
|
868
909
|
fontWeight: "bold",
|
|
@@ -876,9 +917,9 @@ function TokenPreview({
|
|
|
876
917
|
}
|
|
877
918
|
|
|
878
919
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
879
|
-
import { Box as
|
|
880
|
-
import { formatUnits } from "viem";
|
|
881
|
-
import { jsx as jsx14, jsxs as
|
|
920
|
+
import { Box as Box9, Image as Image2, Skeleton as Skeleton3, Text as Text6 } from "@0xsequence/design-system";
|
|
921
|
+
import { formatUnits as formatUnits2 } from "viem";
|
|
922
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
882
923
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
883
924
|
function TransactionDetails({
|
|
884
925
|
collectibleId,
|
|
@@ -897,25 +938,25 @@ function TransactionDetails({
|
|
|
897
938
|
collectibleId
|
|
898
939
|
});
|
|
899
940
|
const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
|
|
900
|
-
let formattedAmount = price &&
|
|
941
|
+
let formattedAmount = price && formatUnits2(BigInt(price.amountRaw), price.currency.decimals);
|
|
901
942
|
if (royaltyPercentage !== void 0 && formattedAmount) {
|
|
902
943
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).toString();
|
|
903
944
|
}
|
|
904
945
|
if (marketplaceFeePercentage !== void 0 && formattedAmount) {
|
|
905
946
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).toString();
|
|
906
947
|
}
|
|
907
|
-
return /* @__PURE__ */
|
|
908
|
-
|
|
948
|
+
return /* @__PURE__ */ jsxs9(
|
|
949
|
+
Box9,
|
|
909
950
|
{
|
|
910
951
|
width: "full",
|
|
911
952
|
display: "flex",
|
|
912
953
|
justifyContent: "space-between",
|
|
913
954
|
alignItems: "center",
|
|
914
955
|
children: [
|
|
915
|
-
/* @__PURE__ */ jsx14(
|
|
916
|
-
/* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ jsx14(Text6, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
|
|
957
|
+
/* @__PURE__ */ jsxs9(Box9, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
917
958
|
/* @__PURE__ */ jsx14(Image2, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
918
|
-
priceLoading ? /* @__PURE__ */ jsx14(Skeleton3, { width: "16", height: "4" }) : /* @__PURE__ */
|
|
959
|
+
priceLoading ? /* @__PURE__ */ jsx14(Skeleton3, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs9(Text6, { fontSize: "small", color: "text100", fontFamily: "body", children: [
|
|
919
960
|
formattedAmount,
|
|
920
961
|
" ",
|
|
921
962
|
price.currency.symbol
|
|
@@ -930,32 +971,33 @@ function TransactionDetails({
|
|
|
930
971
|
import {
|
|
931
972
|
CloseIcon,
|
|
932
973
|
IconButton as IconButton2,
|
|
933
|
-
Skeleton as
|
|
934
|
-
Text as
|
|
974
|
+
Skeleton as Skeleton5,
|
|
975
|
+
Text as Text10
|
|
935
976
|
} from "@0xsequence/design-system";
|
|
936
977
|
import { observer as observer7 } from "@legendapp/state/react";
|
|
937
978
|
import { Close, Content as Content3, Overlay, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
|
|
938
|
-
import { useEffect as useEffect4 } from "react";
|
|
939
|
-
import {
|
|
979
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
980
|
+
import { WaitForTransactionReceiptTimeoutError } from "viem";
|
|
940
981
|
|
|
941
982
|
// src/react/ui/modals/_internal/components/transaction-footer/index.tsx
|
|
942
|
-
import { Box as Box9, Spinner as Spinner2, Text as Text6 } from "@0xsequence/design-system";
|
|
943
983
|
import { networks } from "@0xsequence/network";
|
|
944
|
-
import {
|
|
984
|
+
import { Box as Box10, Spinner as Spinner2, Text as Text7 } from "@0xsequence/design-system";
|
|
985
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
945
986
|
function TransactionFooter({
|
|
946
987
|
transactionHash,
|
|
947
988
|
isConfirming,
|
|
948
989
|
isConfirmed,
|
|
949
990
|
isFailed,
|
|
991
|
+
isTimeout,
|
|
950
992
|
chainId
|
|
951
993
|
}) {
|
|
952
994
|
const icon = isConfirming && /* @__PURE__ */ jsx15(Spinner2, { size: "md" }) || isConfirmed && /* @__PURE__ */ jsx15(PositiveCircleIcon_default, { size: "md" });
|
|
953
|
-
const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed";
|
|
995
|
+
const title = isConfirming && "Processing transaction" || isConfirmed && "Transaction complete" || isFailed && "Transaction failed" || isTimeout && "Transaction took longer than expected";
|
|
954
996
|
const transactionUrl = `${networks[chainId]?.blockExplorer?.rootUrl}tx/${transactionHash}`;
|
|
955
|
-
return /* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ jsxs10(Box10, { display: "flex", alignItems: "center", children: [
|
|
956
998
|
icon,
|
|
957
999
|
/* @__PURE__ */ jsx15(
|
|
958
|
-
|
|
1000
|
+
Text7,
|
|
959
1001
|
{
|
|
960
1002
|
color: "text50",
|
|
961
1003
|
fontSize: "normal",
|
|
@@ -966,7 +1008,7 @@ function TransactionFooter({
|
|
|
966
1008
|
}
|
|
967
1009
|
),
|
|
968
1010
|
/* @__PURE__ */ jsx15(
|
|
969
|
-
|
|
1011
|
+
Box10,
|
|
970
1012
|
{
|
|
971
1013
|
as: "a",
|
|
972
1014
|
flexGrow: "1",
|
|
@@ -977,7 +1019,7 @@ function TransactionFooter({
|
|
|
977
1019
|
textAlign: "right",
|
|
978
1020
|
textDecoration: "none",
|
|
979
1021
|
children: /* @__PURE__ */ jsx15(
|
|
980
|
-
|
|
1022
|
+
Text7,
|
|
981
1023
|
{
|
|
982
1024
|
color: "polygonLight",
|
|
983
1025
|
textAlign: "right",
|
|
@@ -993,12 +1035,18 @@ function TransactionFooter({
|
|
|
993
1035
|
}
|
|
994
1036
|
|
|
995
1037
|
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
996
|
-
import {
|
|
1038
|
+
import {
|
|
1039
|
+
Box as Box12,
|
|
1040
|
+
Image as Image3,
|
|
1041
|
+
NetworkImage,
|
|
1042
|
+
Skeleton as Skeleton4,
|
|
1043
|
+
Text as Text9
|
|
1044
|
+
} from "@0xsequence/design-system";
|
|
997
1045
|
import { observer as observer6 } from "@legendapp/state/react";
|
|
998
|
-
import { formatUnits as
|
|
1046
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
999
1047
|
|
|
1000
1048
|
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
1001
|
-
import { Box as
|
|
1049
|
+
import { Box as Box11, Text as Text8 } from "@0xsequence/design-system";
|
|
1002
1050
|
import { formatDistanceToNow } from "date-fns";
|
|
1003
1051
|
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
1004
1052
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
@@ -1011,13 +1059,13 @@ function TimeAgo({ date }) {
|
|
|
1011
1059
|
return () => clearInterval(interval);
|
|
1012
1060
|
}, [date]);
|
|
1013
1061
|
return /* @__PURE__ */ jsx16(
|
|
1014
|
-
|
|
1062
|
+
Box11,
|
|
1015
1063
|
{
|
|
1016
1064
|
flexGrow: "1",
|
|
1017
1065
|
display: "flex",
|
|
1018
1066
|
alignItems: "center",
|
|
1019
1067
|
justifyContent: "flex-end",
|
|
1020
|
-
children: /* @__PURE__ */ jsx16(
|
|
1068
|
+
children: /* @__PURE__ */ jsx16(Text8, { color: "text50", fontSize: "small", children: timeAgo })
|
|
1021
1069
|
}
|
|
1022
1070
|
);
|
|
1023
1071
|
}
|
|
@@ -1031,12 +1079,12 @@ var initialState2 = {
|
|
|
1031
1079
|
price,
|
|
1032
1080
|
collectionAddress,
|
|
1033
1081
|
chainId,
|
|
1034
|
-
|
|
1035
|
-
getTitle,
|
|
1036
|
-
getMessage: getMessage2,
|
|
1082
|
+
collectibleId,
|
|
1037
1083
|
type,
|
|
1038
1084
|
callbacks,
|
|
1039
|
-
queriesToInvalidate
|
|
1085
|
+
queriesToInvalidate,
|
|
1086
|
+
confirmations,
|
|
1087
|
+
blocked
|
|
1040
1088
|
}) => {
|
|
1041
1089
|
transactionStatusModal$.state.set({
|
|
1042
1090
|
...transactionStatusModal$.state.get(),
|
|
@@ -1044,12 +1092,12 @@ var initialState2 = {
|
|
|
1044
1092
|
price,
|
|
1045
1093
|
collectionAddress,
|
|
1046
1094
|
chainId,
|
|
1047
|
-
|
|
1048
|
-
getTitle,
|
|
1049
|
-
getMessage: getMessage2,
|
|
1095
|
+
collectibleId,
|
|
1050
1096
|
type,
|
|
1051
1097
|
callbacks,
|
|
1052
|
-
queriesToInvalidate
|
|
1098
|
+
queriesToInvalidate,
|
|
1099
|
+
confirmations,
|
|
1100
|
+
blocked
|
|
1053
1101
|
});
|
|
1054
1102
|
transactionStatusModal$.isOpen.set(true);
|
|
1055
1103
|
},
|
|
@@ -1065,10 +1113,12 @@ var initialState2 = {
|
|
|
1065
1113
|
price: void 0,
|
|
1066
1114
|
collectionAddress: "",
|
|
1067
1115
|
chainId: "",
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1116
|
+
collectibleId: "",
|
|
1117
|
+
type: void 0,
|
|
1118
|
+
callbacks: void 0,
|
|
1119
|
+
queriesToInvalidate: [],
|
|
1120
|
+
confirmations: -1,
|
|
1121
|
+
blocked: false
|
|
1072
1122
|
}
|
|
1073
1123
|
};
|
|
1074
1124
|
var transactionStatusModal$ = observable3(initialState2);
|
|
@@ -1078,30 +1128,35 @@ import { useMemo } from "react";
|
|
|
1078
1128
|
|
|
1079
1129
|
// src/react/ui/modals/_internal/components/transactionPreview/consts.ts
|
|
1080
1130
|
var TRANSACTION_TITLES = {
|
|
1081
|
-
|
|
1131
|
+
SELL: {
|
|
1082
1132
|
confirming: "Selling",
|
|
1083
1133
|
confirmed: "Sold",
|
|
1084
1134
|
failed: "Sale failed"
|
|
1085
1135
|
},
|
|
1086
|
-
|
|
1136
|
+
LISTING: {
|
|
1087
1137
|
confirming: "Creating listing",
|
|
1088
1138
|
confirmed: "Listed",
|
|
1089
1139
|
failed: "Listing failed"
|
|
1090
1140
|
},
|
|
1091
|
-
|
|
1141
|
+
OFFER: {
|
|
1092
1142
|
confirming: "Creating offer",
|
|
1093
1143
|
confirmed: "Offer created",
|
|
1094
1144
|
failed: "Offer failed"
|
|
1095
1145
|
},
|
|
1096
|
-
|
|
1146
|
+
BUY: {
|
|
1097
1147
|
confirming: "Buying",
|
|
1098
1148
|
confirmed: "Bought",
|
|
1099
1149
|
failed: "Purchase failed"
|
|
1100
1150
|
},
|
|
1101
|
-
|
|
1151
|
+
TRANSFER: {
|
|
1102
1152
|
confirming: "Transferring",
|
|
1103
1153
|
confirmed: "Transferred",
|
|
1104
1154
|
failed: "Transfer failed"
|
|
1155
|
+
},
|
|
1156
|
+
CANCEL: {
|
|
1157
|
+
confirming: "Cancelling",
|
|
1158
|
+
confirmed: "Cancelled",
|
|
1159
|
+
failed: "Cancellation failed"
|
|
1105
1160
|
}
|
|
1106
1161
|
};
|
|
1107
1162
|
|
|
@@ -1119,35 +1174,40 @@ function useTransactionPreviewTitle(status, type) {
|
|
|
1119
1174
|
}
|
|
1120
1175
|
|
|
1121
1176
|
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
1122
|
-
import { jsx as jsx17, jsxs as
|
|
1177
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1123
1178
|
var TransactionPreview = observer6(
|
|
1124
1179
|
({
|
|
1125
1180
|
price,
|
|
1126
1181
|
collectionAddress,
|
|
1127
1182
|
chainId,
|
|
1128
1183
|
collectible,
|
|
1184
|
+
collectibleLoading,
|
|
1129
1185
|
currencyImageUrl,
|
|
1130
1186
|
isConfirming,
|
|
1131
1187
|
isConfirmed,
|
|
1132
|
-
isFailed
|
|
1188
|
+
isFailed,
|
|
1189
|
+
isTimeout
|
|
1133
1190
|
}) => {
|
|
1134
1191
|
const { type } = transactionStatusModal$.state.get();
|
|
1135
1192
|
const title = useTransactionPreviewTitle(
|
|
1136
|
-
{ isConfirmed, isConfirming, isFailed },
|
|
1193
|
+
{ isConfirmed, isConfirming, isFailed, isTimeout },
|
|
1137
1194
|
type
|
|
1138
1195
|
);
|
|
1139
|
-
const { data: collection } = useCollection({
|
|
1196
|
+
const { data: collection, isLoading: collectionLoading } = useCollection({
|
|
1140
1197
|
collectionAddress,
|
|
1141
1198
|
chainId
|
|
1142
1199
|
});
|
|
1143
|
-
const collectibleImage2 = collectible
|
|
1144
|
-
const collectibleName = collectible
|
|
1200
|
+
const collectibleImage2 = collectible?.image;
|
|
1201
|
+
const collectibleName = collectible?.name;
|
|
1145
1202
|
const collectionName = collection?.name;
|
|
1146
|
-
const priceFormatted = price ?
|
|
1147
|
-
|
|
1148
|
-
/* @__PURE__ */
|
|
1203
|
+
const priceFormatted = price ? formatUnits3(BigInt(price.amountRaw), price.currency.decimals) : void 0;
|
|
1204
|
+
if (collectibleLoading || collectionLoading) {
|
|
1205
|
+
return /* @__PURE__ */ jsx17(Box12, { style: { height: 83 }, width: "full", borderRadius: "md", children: /* @__PURE__ */ jsx17(Skeleton4, { style: { width: "100%", height: "100%" } }) });
|
|
1206
|
+
}
|
|
1207
|
+
return /* @__PURE__ */ jsxs11(Box12, { padding: "3", background: "backgroundSecondary", borderRadius: "md", children: [
|
|
1208
|
+
/* @__PURE__ */ jsxs11(Box12, { display: "flex", alignItems: "center", children: [
|
|
1149
1209
|
/* @__PURE__ */ jsx17(
|
|
1150
|
-
|
|
1210
|
+
Text9,
|
|
1151
1211
|
{
|
|
1152
1212
|
color: "text50",
|
|
1153
1213
|
fontSize: "small",
|
|
@@ -1160,7 +1220,7 @@ var TransactionPreview = observer6(
|
|
|
1160
1220
|
/* @__PURE__ */ jsx17(NetworkImage, { chainId: Number(chainId), size: "xs" }),
|
|
1161
1221
|
isConfirming && /* @__PURE__ */ jsx17(TimeAgo, { date: /* @__PURE__ */ new Date() })
|
|
1162
1222
|
] }),
|
|
1163
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsxs11(Box12, { display: "flex", alignItems: "center", marginTop: "2", children: [
|
|
1164
1224
|
/* @__PURE__ */ jsx17(
|
|
1165
1225
|
Image3,
|
|
1166
1226
|
{
|
|
@@ -1169,11 +1229,12 @@ var TransactionPreview = observer6(
|
|
|
1169
1229
|
width: "9",
|
|
1170
1230
|
height: "9",
|
|
1171
1231
|
borderRadius: "xs",
|
|
1172
|
-
marginRight: "3"
|
|
1232
|
+
marginRight: "3",
|
|
1233
|
+
style: { objectFit: "cover" }
|
|
1173
1234
|
}
|
|
1174
1235
|
),
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
|
|
1236
|
+
/* @__PURE__ */ jsxs11(
|
|
1237
|
+
Box12,
|
|
1177
1238
|
{
|
|
1178
1239
|
display: "flex",
|
|
1179
1240
|
flexDirection: "column",
|
|
@@ -1181,7 +1242,7 @@ var TransactionPreview = observer6(
|
|
|
1181
1242
|
gap: "0.5",
|
|
1182
1243
|
children: [
|
|
1183
1244
|
/* @__PURE__ */ jsx17(
|
|
1184
|
-
|
|
1245
|
+
Text9,
|
|
1185
1246
|
{
|
|
1186
1247
|
color: "text80",
|
|
1187
1248
|
fontSize: "small",
|
|
@@ -1190,12 +1251,12 @@ var TransactionPreview = observer6(
|
|
|
1190
1251
|
children: collectibleName
|
|
1191
1252
|
}
|
|
1192
1253
|
),
|
|
1193
|
-
/* @__PURE__ */ jsx17(
|
|
1254
|
+
/* @__PURE__ */ jsx17(Text9, { color: "text100", fontSize: "small", fontFamily: "body", children: collectionName })
|
|
1194
1255
|
]
|
|
1195
1256
|
}
|
|
1196
1257
|
),
|
|
1197
|
-
price && /* @__PURE__ */
|
|
1198
|
-
|
|
1258
|
+
price && /* @__PURE__ */ jsxs11(
|
|
1259
|
+
Box12,
|
|
1199
1260
|
{
|
|
1200
1261
|
flexGrow: "1",
|
|
1201
1262
|
display: "flex",
|
|
@@ -1204,8 +1265,8 @@ var TransactionPreview = observer6(
|
|
|
1204
1265
|
gap: "1",
|
|
1205
1266
|
children: [
|
|
1206
1267
|
/* @__PURE__ */ jsx17(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
|
|
1268
|
+
/* @__PURE__ */ jsxs11(
|
|
1269
|
+
Text9,
|
|
1209
1270
|
{
|
|
1210
1271
|
color: "text80",
|
|
1211
1272
|
fontSize: "small",
|
|
@@ -1233,62 +1294,140 @@ var dialogOverlay3 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11xl fyvr11m0 fyvr11rs
|
|
|
1233
1294
|
var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
|
|
1234
1295
|
|
|
1235
1296
|
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1236
|
-
import {
|
|
1297
|
+
import { TRANSACTION_CONFIRMATIONS_DEFAULT } from "@0xsequence/kit";
|
|
1298
|
+
|
|
1299
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts
|
|
1300
|
+
function getFormattedType(transactionType, verb = false) {
|
|
1301
|
+
switch (transactionType) {
|
|
1302
|
+
case "TRANSFER" /* TRANSFER */:
|
|
1303
|
+
return verb ? "transferred" : "transfer";
|
|
1304
|
+
case "LISTING" /* LISTING */:
|
|
1305
|
+
return verb ? "listed" : "listing";
|
|
1306
|
+
case "BUY" /* BUY */:
|
|
1307
|
+
return verb ? "purchased" : "purchase";
|
|
1308
|
+
case "SELL" /* SELL */:
|
|
1309
|
+
return verb ? "sold" : "sale";
|
|
1310
|
+
case "CANCEL" /* CANCEL */:
|
|
1311
|
+
return verb ? "cancelled" : "cancellation";
|
|
1312
|
+
case "OFFER" /* OFFER */:
|
|
1313
|
+
return verb ? "offered" : "offer";
|
|
1314
|
+
default:
|
|
1315
|
+
return "transaction";
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts
|
|
1320
|
+
function getTransactionStatusModalTitle({
|
|
1321
|
+
transactionStatus,
|
|
1322
|
+
transactionType
|
|
1323
|
+
}) {
|
|
1324
|
+
switch (transactionStatus) {
|
|
1325
|
+
case "PENDING":
|
|
1326
|
+
return `Your ${getFormattedType(transactionType)} is processing`;
|
|
1327
|
+
case "SUCCESS":
|
|
1328
|
+
return `Your ${getFormattedType(transactionType)} has processed`;
|
|
1329
|
+
case "FAILED":
|
|
1330
|
+
return `Your ${getFormattedType(transactionType)} has failed`;
|
|
1331
|
+
case "TIMEOUT":
|
|
1332
|
+
return `Your ${getFormattedType(transactionType)} takes too long`;
|
|
1333
|
+
default:
|
|
1334
|
+
return "Your transaction is processing";
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts
|
|
1339
|
+
function getTransactionStatusModalMessage({
|
|
1340
|
+
transactionStatus,
|
|
1341
|
+
transactionType,
|
|
1342
|
+
collectibleName
|
|
1343
|
+
}) {
|
|
1344
|
+
const hideCollectibleName = transactionType === "CANCEL";
|
|
1345
|
+
switch (transactionStatus) {
|
|
1346
|
+
case "PENDING":
|
|
1347
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It should be confirmed on the blockchain shortly.`;
|
|
1348
|
+
case "SUCCESS":
|
|
1349
|
+
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It\u2019s been confirmed on the blockchain!`;
|
|
1350
|
+
case "FAILED":
|
|
1351
|
+
return `Your ${getFormattedType(transactionType)} has failed.`;
|
|
1352
|
+
case "TIMEOUT":
|
|
1353
|
+
return `Your ${getFormattedType(transactionType)} takes too long. Click the link below to track it on the explorer.`;
|
|
1354
|
+
default:
|
|
1355
|
+
return "Your transaction is processing";
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1360
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1237
1361
|
var useTransactionStatusModal = () => {
|
|
1238
1362
|
return {
|
|
1239
|
-
show: (args) =>
|
|
1363
|
+
show: (args) => {
|
|
1364
|
+
if (args.blocked) return;
|
|
1365
|
+
transactionStatusModal$.open(args);
|
|
1366
|
+
},
|
|
1240
1367
|
close: () => transactionStatusModal$.close()
|
|
1241
1368
|
};
|
|
1242
1369
|
};
|
|
1243
1370
|
var TransactionStatusModal = observer7(() => {
|
|
1244
1371
|
const {
|
|
1372
|
+
type,
|
|
1245
1373
|
hash,
|
|
1246
1374
|
price,
|
|
1247
1375
|
collectionAddress,
|
|
1248
1376
|
chainId,
|
|
1249
|
-
|
|
1250
|
-
getTitle,
|
|
1251
|
-
getMessage: getMessage2,
|
|
1377
|
+
collectibleId,
|
|
1252
1378
|
callbacks,
|
|
1253
|
-
queriesToInvalidate
|
|
1379
|
+
queriesToInvalidate,
|
|
1380
|
+
confirmations
|
|
1254
1381
|
} = transactionStatusModal$.state.get();
|
|
1255
|
-
const { data: collectible } = useCollectible({
|
|
1382
|
+
const { data: collectible, isLoading: collectibleLoading } = useCollectible({
|
|
1256
1383
|
collectionAddress,
|
|
1257
1384
|
chainId,
|
|
1258
|
-
collectibleId
|
|
1385
|
+
collectibleId
|
|
1259
1386
|
});
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1387
|
+
const [transactionStatus, setTransactionStatus] = useState5("PENDING");
|
|
1388
|
+
const title = getTransactionStatusModalTitle({
|
|
1389
|
+
transactionStatus,
|
|
1390
|
+
transactionType: type
|
|
1391
|
+
});
|
|
1392
|
+
const message = getTransactionStatusModalMessage({
|
|
1393
|
+
transactionStatus,
|
|
1394
|
+
transactionType: type,
|
|
1395
|
+
collectibleName: collectible?.name || ""
|
|
1396
|
+
});
|
|
1397
|
+
const { onError, onSuccess } = callbacks || {};
|
|
1270
1398
|
const queryClient = getQueryClient();
|
|
1399
|
+
const publicClient = chainId ? getPublicRpcClient(chainId) : null;
|
|
1400
|
+
const waitForTransactionReceiptPromise = publicClient?.waitForTransactionReceipt({
|
|
1401
|
+
confirmations: confirmations || TRANSACTION_CONFIRMATIONS_DEFAULT,
|
|
1402
|
+
hash
|
|
1403
|
+
});
|
|
1271
1404
|
useEffect4(() => {
|
|
1272
1405
|
if (!transactionStatusModal$.isOpen.get()) return;
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1406
|
+
console.log("Waiting for transaction receipt ...");
|
|
1407
|
+
waitForTransactionReceiptPromise?.then((receipt) => {
|
|
1408
|
+
if (receipt.status === "success") {
|
|
1409
|
+
console.log("receipt", receipt);
|
|
1410
|
+
setTransactionStatus("SUCCESS");
|
|
1411
|
+
}
|
|
1412
|
+
}).catch((error) => {
|
|
1413
|
+
if (error instanceof WaitForTransactionReceiptTimeoutError) {
|
|
1414
|
+
setTransactionStatus("TIMEOUT");
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1417
|
+
setTransactionStatus("FAILED");
|
|
1418
|
+
});
|
|
1419
|
+
if (queriesToInvalidate) {
|
|
1281
1420
|
queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
|
|
1282
1421
|
}
|
|
1283
1422
|
return () => {
|
|
1284
|
-
|
|
1423
|
+
setTransactionStatus("PENDING");
|
|
1285
1424
|
};
|
|
1286
|
-
}, [
|
|
1287
|
-
return /* @__PURE__ */ jsx18(Root3, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */
|
|
1425
|
+
}, [onSuccess, onError, transactionStatusModal$.isOpen.get()]);
|
|
1426
|
+
return /* @__PURE__ */ jsx18(Root3, { open: transactionStatusModal$.isOpen.get(), children: /* @__PURE__ */ jsxs12(Portal3, { children: [
|
|
1288
1427
|
/* @__PURE__ */ jsx18(Overlay, { className: dialogOverlay3 }),
|
|
1289
|
-
/* @__PURE__ */
|
|
1428
|
+
/* @__PURE__ */ jsxs12(Content3, { className: transactionStatusModalContent, children: [
|
|
1290
1429
|
title ? /* @__PURE__ */ jsx18(
|
|
1291
|
-
|
|
1430
|
+
Text10,
|
|
1292
1431
|
{
|
|
1293
1432
|
fontSize: "large",
|
|
1294
1433
|
fontWeight: "bold",
|
|
@@ -1296,28 +1435,31 @@ var TransactionStatusModal = observer7(() => {
|
|
|
1296
1435
|
fontFamily: "body",
|
|
1297
1436
|
children: title
|
|
1298
1437
|
}
|
|
1299
|
-
) : /* @__PURE__ */ jsx18(
|
|
1300
|
-
message ? /* @__PURE__ */ jsx18(
|
|
1301
|
-
|
|
1438
|
+
) : /* @__PURE__ */ jsx18(Skeleton5, { width: "16", height: "6" }),
|
|
1439
|
+
message ? /* @__PURE__ */ jsx18(Text10, { fontSize: "small", color: "text80", fontFamily: "body", children: message }) : /* @__PURE__ */ jsx18(Skeleton5, { width: "20", height: "4" }),
|
|
1440
|
+
/* @__PURE__ */ jsx18(
|
|
1302
1441
|
transactionPreview_default,
|
|
1303
1442
|
{
|
|
1304
1443
|
price,
|
|
1305
1444
|
collectionAddress,
|
|
1306
1445
|
chainId,
|
|
1307
1446
|
collectible,
|
|
1447
|
+
collectibleLoading,
|
|
1308
1448
|
currencyImageUrl: price?.currency.imageUrl,
|
|
1309
|
-
isConfirming,
|
|
1310
|
-
isConfirmed,
|
|
1311
|
-
isFailed:
|
|
1449
|
+
isConfirming: transactionStatus === "PENDING",
|
|
1450
|
+
isConfirmed: transactionStatus === "SUCCESS",
|
|
1451
|
+
isFailed: transactionStatus === "FAILED",
|
|
1452
|
+
isTimeout: transactionStatus === "TIMEOUT"
|
|
1312
1453
|
}
|
|
1313
1454
|
),
|
|
1314
1455
|
/* @__PURE__ */ jsx18(
|
|
1315
1456
|
TransactionFooter,
|
|
1316
1457
|
{
|
|
1317
1458
|
transactionHash: hash,
|
|
1318
|
-
isConfirming,
|
|
1319
|
-
isConfirmed,
|
|
1320
|
-
isFailed:
|
|
1459
|
+
isConfirming: transactionStatus === "PENDING",
|
|
1460
|
+
isConfirmed: transactionStatus === "SUCCESS",
|
|
1461
|
+
isFailed: transactionStatus === "FAILED",
|
|
1462
|
+
isTimeout: transactionStatus === "TIMEOUT",
|
|
1321
1463
|
chainId
|
|
1322
1464
|
}
|
|
1323
1465
|
),
|
|
@@ -1373,28 +1515,8 @@ var initialState3 = {
|
|
|
1373
1515
|
};
|
|
1374
1516
|
var createListingModal$ = observable4(initialState3);
|
|
1375
1517
|
|
|
1376
|
-
// src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts
|
|
1377
|
-
var getCreateListingTransactionTitle = (params) => {
|
|
1378
|
-
if (params.isConfirmed) {
|
|
1379
|
-
return "Listing has processed";
|
|
1380
|
-
}
|
|
1381
|
-
if (params.isFailed) {
|
|
1382
|
-
return "Listing has failed";
|
|
1383
|
-
}
|
|
1384
|
-
return "Listing is processing";
|
|
1385
|
-
};
|
|
1386
|
-
var getCreateListingTransactionMessage = (params, collectibleName) => {
|
|
1387
|
-
if (params.isConfirmed) {
|
|
1388
|
-
return `You just listed ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
|
|
1389
|
-
}
|
|
1390
|
-
if (params.isFailed) {
|
|
1391
|
-
return `Your listing of ${collectibleName} has failed. Please try again.`;
|
|
1392
|
-
}
|
|
1393
|
-
return `You just listed ${collectibleName}. It should be confirmed on the blockchain shortly.`;
|
|
1394
|
-
};
|
|
1395
|
-
|
|
1396
1518
|
// src/react/ui/modals/CreateListingModal/index.tsx
|
|
1397
|
-
import { jsx as jsx19, jsxs as
|
|
1519
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1398
1520
|
var useCreateListingModal = (callbacks) => {
|
|
1399
1521
|
return {
|
|
1400
1522
|
show: (args) => createListingModal$.open({ ...args, defaultCallbacks: callbacks }),
|
|
@@ -1445,10 +1567,8 @@ var Modal2 = observer8(
|
|
|
1445
1567
|
collectionAddress,
|
|
1446
1568
|
chainId,
|
|
1447
1569
|
price: createListingModal$.listingPrice.get(),
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
getMessage: (params) => getCreateListingTransactionMessage(params, collectible?.name || ""),
|
|
1451
|
-
type: "createListing" /* createListing */,
|
|
1570
|
+
collectibleId,
|
|
1571
|
+
type: "LISTING" /* LISTING */,
|
|
1452
1572
|
queriesToInvalidate: collectableKeys.all
|
|
1453
1573
|
});
|
|
1454
1574
|
createListingModal$.close();
|
|
@@ -1492,11 +1612,13 @@ var Modal2 = observer8(
|
|
|
1492
1612
|
}
|
|
1493
1613
|
const dateToUnixTime = (date) => Math.floor(date.getTime() / 1e3).toString();
|
|
1494
1614
|
const { isLoading, steps, refreshSteps } = getListingSteps({
|
|
1495
|
-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1496
1615
|
contractType: collection.type,
|
|
1497
1616
|
listing: {
|
|
1498
1617
|
tokenId: collectibleId,
|
|
1499
|
-
quantity:
|
|
1618
|
+
quantity: parseUnits3(
|
|
1619
|
+
createListingModal$.quantity.get(),
|
|
1620
|
+
collectible?.decimals || 0
|
|
1621
|
+
).toString(),
|
|
1500
1622
|
expiry: dateToUnixTime(createListingModal$.expiry.get()),
|
|
1501
1623
|
currencyAddress: listingPrice.currency.contractAddress,
|
|
1502
1624
|
pricePerToken: listingPrice.amountRaw
|
|
@@ -1518,7 +1640,7 @@ var Modal2 = observer8(
|
|
|
1518
1640
|
disabled: steps?.approval.isPending || listingPrice.amountRaw === "0" || isLoading || createListingModal$.invalidQuantity.get()
|
|
1519
1641
|
}
|
|
1520
1642
|
];
|
|
1521
|
-
return /* @__PURE__ */
|
|
1643
|
+
return /* @__PURE__ */ jsxs13(
|
|
1522
1644
|
ActionModal,
|
|
1523
1645
|
{
|
|
1524
1646
|
store: createListingModal$,
|
|
@@ -1535,7 +1657,7 @@ var Modal2 = observer8(
|
|
|
1535
1657
|
chainId
|
|
1536
1658
|
}
|
|
1537
1659
|
),
|
|
1538
|
-
/* @__PURE__ */
|
|
1660
|
+
/* @__PURE__ */ jsxs13(Box13, { display: "flex", flexDirection: "column", width: "full", gap: "1", children: [
|
|
1539
1661
|
/* @__PURE__ */ jsx19(
|
|
1540
1662
|
priceInput_default,
|
|
1541
1663
|
{
|
|
@@ -1582,18 +1704,19 @@ var Modal2 = observer8(
|
|
|
1582
1704
|
|
|
1583
1705
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1584
1706
|
import { Show as Show3, observer as observer9 } from "@legendapp/state/react";
|
|
1585
|
-
import { useEffect as useEffect5, useState as
|
|
1707
|
+
import { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1708
|
+
import { parseUnits as parseUnits4 } from "viem";
|
|
1586
1709
|
|
|
1587
1710
|
// src/react/hooks/useMakeOffer.tsx
|
|
1588
|
-
import { useCallback as useCallback2, useState as
|
|
1711
|
+
import { useCallback as useCallback2, useState as useState6 } from "react";
|
|
1589
1712
|
var useMakeOffer = ({
|
|
1590
1713
|
onSuccess,
|
|
1591
1714
|
onError,
|
|
1592
1715
|
onTransactionSent,
|
|
1593
1716
|
...config
|
|
1594
1717
|
}) => {
|
|
1595
|
-
const [isLoading, setIsLoading] =
|
|
1596
|
-
const [steps, setSteps] =
|
|
1718
|
+
const [isLoading, setIsLoading] = useState6(false);
|
|
1719
|
+
const [steps, setSteps] = useState6(null);
|
|
1597
1720
|
const { machine, isLoading: isMachineLoading } = useTransactionMachine(
|
|
1598
1721
|
{
|
|
1599
1722
|
...config,
|
|
@@ -1638,7 +1761,7 @@ var initialState4 = {
|
|
|
1638
1761
|
collectibleId: "",
|
|
1639
1762
|
callbacks: void 0,
|
|
1640
1763
|
offerPrice: {
|
|
1641
|
-
amountRaw: "
|
|
1764
|
+
amountRaw: "1",
|
|
1642
1765
|
currency: {}
|
|
1643
1766
|
},
|
|
1644
1767
|
quantity: "1",
|
|
@@ -1658,28 +1781,8 @@ var initialState4 = {
|
|
|
1658
1781
|
};
|
|
1659
1782
|
var makeOfferModal$ = observable5(initialState4);
|
|
1660
1783
|
|
|
1661
|
-
// src/react/ui/modals/MakeOfferModal/_utils/getMakeOfferTransactionTitleMessage.ts
|
|
1662
|
-
var getMakeOfferTransactionTitle = (params) => {
|
|
1663
|
-
if (params.isConfirmed) {
|
|
1664
|
-
return "Your offer has processed";
|
|
1665
|
-
}
|
|
1666
|
-
if (params.isFailed) {
|
|
1667
|
-
return "Your offer has failed";
|
|
1668
|
-
}
|
|
1669
|
-
return "Your offer is processing";
|
|
1670
|
-
};
|
|
1671
|
-
var getMakeOfferTransactionMessage = (params, collectibleName) => {
|
|
1672
|
-
if (params.isConfirmed) {
|
|
1673
|
-
return `You just made offer for ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
|
|
1674
|
-
}
|
|
1675
|
-
if (params.isFailed) {
|
|
1676
|
-
return `Your offer for ${collectibleName} has failed. Please try again.`;
|
|
1677
|
-
}
|
|
1678
|
-
return `You just made offer for ${collectibleName}. It should be confirmed on the blockchain shortly.`;
|
|
1679
|
-
};
|
|
1680
|
-
|
|
1681
1784
|
// src/react/ui/modals/MakeOfferModal/index.tsx
|
|
1682
|
-
import { jsx as jsx20, jsxs as
|
|
1785
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1683
1786
|
var useMakeOfferModal = (defaultCallbacks) => ({
|
|
1684
1787
|
show: (args) => makeOfferModal$.open({ ...args, callbacks: defaultCallbacks }),
|
|
1685
1788
|
close: makeOfferModal$.close
|
|
@@ -1694,7 +1797,7 @@ var ModalContent = observer9(
|
|
|
1694
1797
|
}) => {
|
|
1695
1798
|
const state = makeOfferModal$.get();
|
|
1696
1799
|
const { collectionAddress, chainId, offerPrice, collectibleId } = state;
|
|
1697
|
-
const [insufficientBalance, setInsufficientBalance] =
|
|
1800
|
+
const [insufficientBalance, setInsufficientBalance] = useState7(false);
|
|
1698
1801
|
const {
|
|
1699
1802
|
data: collectible,
|
|
1700
1803
|
isLoading: collectableIsLoading,
|
|
@@ -1726,10 +1829,8 @@ var ModalContent = observer9(
|
|
|
1726
1829
|
price: makeOfferModal$.offerPrice.get(),
|
|
1727
1830
|
collectionAddress,
|
|
1728
1831
|
chainId,
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
getMessage: (params) => getMakeOfferTransactionMessage(params, collectible?.name || ""),
|
|
1732
|
-
type: "createOffer" /* createOffer */,
|
|
1832
|
+
collectibleId,
|
|
1833
|
+
type: "OFFER" /* OFFER */,
|
|
1733
1834
|
queriesToInvalidate: collectableKeys.all
|
|
1734
1835
|
});
|
|
1735
1836
|
makeOfferModal$.close();
|
|
@@ -1755,7 +1856,10 @@ var ModalContent = observer9(
|
|
|
1755
1856
|
contractType: collection.type,
|
|
1756
1857
|
offer: {
|
|
1757
1858
|
tokenId: collectibleId,
|
|
1758
|
-
quantity:
|
|
1859
|
+
quantity: parseUnits4(
|
|
1860
|
+
makeOfferModal$.quantity.get(),
|
|
1861
|
+
collectible?.decimals || 0
|
|
1862
|
+
).toString(),
|
|
1759
1863
|
expiry: dateToUnixTime(makeOfferModal$.expiry.get()),
|
|
1760
1864
|
currencyAddress,
|
|
1761
1865
|
pricePerToken: offerPrice.amountRaw
|
|
@@ -1810,7 +1914,7 @@ var ModalContent = observer9(
|
|
|
1810
1914
|
disabled: steps?.approval.isPending || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || makeOfferModal$.invalidQuantity.get()
|
|
1811
1915
|
}
|
|
1812
1916
|
];
|
|
1813
|
-
return /* @__PURE__ */
|
|
1917
|
+
return /* @__PURE__ */ jsxs14(
|
|
1814
1918
|
ActionModal,
|
|
1815
1919
|
{
|
|
1816
1920
|
store: makeOfferModal$,
|
|
@@ -1866,17 +1970,18 @@ var ModalContent = observer9(
|
|
|
1866
1970
|
|
|
1867
1971
|
// src/react/ui/modals/SellModal/index.tsx
|
|
1868
1972
|
import { Show as Show4, observer as observer10 } from "@legendapp/state/react";
|
|
1973
|
+
import { parseUnits as parseUnits5 } from "viem";
|
|
1869
1974
|
|
|
1870
1975
|
// src/react/hooks/useSell.tsx
|
|
1871
|
-
import { useCallback as useCallback3, useState as
|
|
1976
|
+
import { useCallback as useCallback3, useState as useState8 } from "react";
|
|
1872
1977
|
var useSell = ({
|
|
1873
1978
|
onSuccess,
|
|
1874
1979
|
onError,
|
|
1875
1980
|
onTransactionSent,
|
|
1876
1981
|
...config
|
|
1877
1982
|
}) => {
|
|
1878
|
-
const [isLoading, setIsLoading] =
|
|
1879
|
-
const [steps, setSteps] =
|
|
1983
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
1984
|
+
const [steps, setSteps] = useState8(null);
|
|
1880
1985
|
const { machine, isLoading: isMachineLoading } = useTransactionMachine(
|
|
1881
1986
|
{
|
|
1882
1987
|
...config,
|
|
@@ -1912,17 +2017,17 @@ var useSell = ({
|
|
|
1912
2017
|
};
|
|
1913
2018
|
|
|
1914
2019
|
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
1915
|
-
import { Box as
|
|
2020
|
+
import { Box as Box14, Image as Image4, Skeleton as Skeleton6, Text as Text11 } from "@0xsequence/design-system";
|
|
1916
2021
|
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
1917
|
-
import { jsx as jsx21, jsxs as
|
|
2022
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1918
2023
|
function TransactionHeader({
|
|
1919
2024
|
title,
|
|
1920
2025
|
currencyImageUrl,
|
|
1921
2026
|
date
|
|
1922
2027
|
}) {
|
|
1923
|
-
return /* @__PURE__ */
|
|
2028
|
+
return /* @__PURE__ */ jsxs15(Box14, { display: "flex", alignItems: "center", width: "full", children: [
|
|
1924
2029
|
/* @__PURE__ */ jsx21(
|
|
1925
|
-
|
|
2030
|
+
Text11,
|
|
1926
2031
|
{
|
|
1927
2032
|
fontSize: "small",
|
|
1928
2033
|
fontWeight: "medium",
|
|
@@ -1933,8 +2038,8 @@ function TransactionHeader({
|
|
|
1933
2038
|
}
|
|
1934
2039
|
),
|
|
1935
2040
|
/* @__PURE__ */ jsx21(Image4, { src: currencyImageUrl, width: "3", height: "3", marginRight: "1" }),
|
|
1936
|
-
date && /* @__PURE__ */
|
|
1937
|
-
|
|
2041
|
+
date && /* @__PURE__ */ jsxs15(
|
|
2042
|
+
Text11,
|
|
1938
2043
|
{
|
|
1939
2044
|
fontSize: "small",
|
|
1940
2045
|
color: "text50",
|
|
@@ -1946,7 +2051,7 @@ function TransactionHeader({
|
|
|
1946
2051
|
" ago"
|
|
1947
2052
|
]
|
|
1948
2053
|
}
|
|
1949
|
-
) || /* @__PURE__ */ jsx21(
|
|
2054
|
+
) || /* @__PURE__ */ jsx21(Skeleton6, { width: "8", height: "4" })
|
|
1950
2055
|
] });
|
|
1951
2056
|
}
|
|
1952
2057
|
|
|
@@ -1974,28 +2079,8 @@ var initialState5 = {
|
|
|
1974
2079
|
};
|
|
1975
2080
|
var sellModal$ = observable6(initialState5);
|
|
1976
2081
|
|
|
1977
|
-
// src/react/ui/modals/SellModal/_utils/getSellTransactionTitleMessage.ts
|
|
1978
|
-
var getSellTransactionTitle = (params) => {
|
|
1979
|
-
if (params.isConfirmed) {
|
|
1980
|
-
return "Your sale has processed";
|
|
1981
|
-
}
|
|
1982
|
-
if (params.isFailed) {
|
|
1983
|
-
return "Your sale has failed";
|
|
1984
|
-
}
|
|
1985
|
-
return "Your sale is processing";
|
|
1986
|
-
};
|
|
1987
|
-
var getSellTransactionMessage = (params, collectibleName) => {
|
|
1988
|
-
if (params.isConfirmed) {
|
|
1989
|
-
return `You just sold ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
|
|
1990
|
-
}
|
|
1991
|
-
if (params.isFailed) {
|
|
1992
|
-
return `Your sale of ${collectibleName} has failed. Please try again.`;
|
|
1993
|
-
}
|
|
1994
|
-
return `You just sold ${collectibleName}. It should be confirmed on the blockchain shortly.`;
|
|
1995
|
-
};
|
|
1996
|
-
|
|
1997
2082
|
// src/react/ui/modals/SellModal/index.tsx
|
|
1998
|
-
import { jsx as jsx22, jsxs as
|
|
2083
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1999
2084
|
var useSellModal = (defaultCallbacks) => ({
|
|
2000
2085
|
show: (args) => sellModal$.open({ ...args, callbacks: defaultCallbacks }),
|
|
2001
2086
|
close: sellModal$.close
|
|
@@ -2028,10 +2113,8 @@ var ModalContent2 = observer10(
|
|
|
2028
2113
|
},
|
|
2029
2114
|
collectionAddress,
|
|
2030
2115
|
chainId,
|
|
2031
|
-
tokenId,
|
|
2032
|
-
|
|
2033
|
-
getMessage: (params) => getSellTransactionMessage(params, collectible?.name || ""),
|
|
2034
|
-
type: "sell" /* sell */,
|
|
2116
|
+
collectibleId: tokenId,
|
|
2117
|
+
type: "SELL" /* SELL */,
|
|
2035
2118
|
queriesToInvalidate: [
|
|
2036
2119
|
...collectableKeys.all,
|
|
2037
2120
|
balanceQueries.all
|
|
@@ -2089,7 +2172,7 @@ var ModalContent2 = observer10(
|
|
|
2089
2172
|
const currency = currencies?.find(
|
|
2090
2173
|
(c) => c.contractAddress === order?.priceCurrencyAddress
|
|
2091
2174
|
);
|
|
2092
|
-
return /* @__PURE__ */
|
|
2175
|
+
return /* @__PURE__ */ jsxs16(
|
|
2093
2176
|
ActionModal,
|
|
2094
2177
|
{
|
|
2095
2178
|
store: sellModal$,
|
|
@@ -2100,7 +2183,11 @@ var ModalContent2 = observer10(
|
|
|
2100
2183
|
label: "Accept",
|
|
2101
2184
|
onClick: () => sell({
|
|
2102
2185
|
orderId: order?.orderId,
|
|
2103
|
-
marketplace: order?.marketplace
|
|
2186
|
+
marketplace: order?.marketplace,
|
|
2187
|
+
quantity: order?.quantityRemaining ? parseUnits5(
|
|
2188
|
+
order.quantityRemaining,
|
|
2189
|
+
collectible?.decimals || 0
|
|
2190
|
+
).toString() : "1"
|
|
2104
2191
|
})
|
|
2105
2192
|
}
|
|
2106
2193
|
],
|
|
@@ -2143,13 +2230,13 @@ var ModalContent2 = observer10(
|
|
|
2143
2230
|
|
|
2144
2231
|
// src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
|
|
2145
2232
|
import {
|
|
2146
|
-
Box as
|
|
2233
|
+
Box as Box15,
|
|
2147
2234
|
Button as Button3,
|
|
2148
2235
|
CloseIcon as CloseIcon2,
|
|
2149
2236
|
ExternalLinkIcon,
|
|
2150
2237
|
IconButton as IconButton3,
|
|
2151
2238
|
Image as Image5,
|
|
2152
|
-
Text as
|
|
2239
|
+
Text as Text12
|
|
2153
2240
|
} from "@0xsequence/design-system";
|
|
2154
2241
|
import { observer as observer11 } from "@legendapp/state/react";
|
|
2155
2242
|
import { Close as Close2, Content as Content4, Overlay as Overlay2, Portal as Portal4, Root as Root4 } from "@radix-ui/react-dialog";
|
|
@@ -2197,7 +2284,7 @@ var initialState6 = {
|
|
|
2197
2284
|
var successfulPurchaseModal$ = observable7(initialState6);
|
|
2198
2285
|
|
|
2199
2286
|
// src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
|
|
2200
|
-
import { jsx as jsx23, jsxs as
|
|
2287
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2201
2288
|
var useSuccessfulPurchaseModal = (callbacks) => {
|
|
2202
2289
|
return {
|
|
2203
2290
|
show: (args) => successfulPurchaseModal$.open({ ...args, defaultCallbacks: callbacks }),
|
|
@@ -2205,12 +2292,12 @@ var useSuccessfulPurchaseModal = (callbacks) => {
|
|
|
2205
2292
|
};
|
|
2206
2293
|
};
|
|
2207
2294
|
var SuccessfulPurchaseModal = observer11(() => {
|
|
2208
|
-
return /* @__PURE__ */ jsx23(Root4, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsx23(Root4, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs17(Portal4, { children: [
|
|
2209
2296
|
/* @__PURE__ */ jsx23(Overlay2, { className: dialogOverlay }),
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2297
|
+
/* @__PURE__ */ jsxs17(Content4, { className: dialogContent.narrow, children: [
|
|
2298
|
+
/* @__PURE__ */ jsxs17(Box15, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
|
|
2212
2299
|
/* @__PURE__ */ jsx23(
|
|
2213
|
-
|
|
2300
|
+
Text12,
|
|
2214
2301
|
{
|
|
2215
2302
|
textAlign: "center",
|
|
2216
2303
|
fontSize: "medium",
|
|
@@ -2225,11 +2312,11 @@ var SuccessfulPurchaseModal = observer11(() => {
|
|
|
2225
2312
|
collectibles: successfulPurchaseModal$.state.get().collectibles
|
|
2226
2313
|
}
|
|
2227
2314
|
),
|
|
2228
|
-
/* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */ jsx23(
|
|
2230
|
-
/* @__PURE__ */ jsx23(
|
|
2231
|
-
/* @__PURE__ */ jsx23(
|
|
2232
|
-
/* @__PURE__ */ jsx23(
|
|
2315
|
+
/* @__PURE__ */ jsxs17(Box15, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
2316
|
+
/* @__PURE__ */ jsx23(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
|
|
2317
|
+
/* @__PURE__ */ jsx23(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
|
|
2318
|
+
/* @__PURE__ */ jsx23(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
|
|
2319
|
+
/* @__PURE__ */ jsx23(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
|
|
2233
2320
|
] }),
|
|
2234
2321
|
/* @__PURE__ */ jsx23(SuccessfulPurchaseActions, {})
|
|
2235
2322
|
] }),
|
|
@@ -2248,7 +2335,7 @@ var SuccessfulPurchaseModal = observer11(() => {
|
|
|
2248
2335
|
] }) });
|
|
2249
2336
|
});
|
|
2250
2337
|
function SuccessfulPurchaseActions() {
|
|
2251
|
-
return /* @__PURE__ */
|
|
2338
|
+
return /* @__PURE__ */ jsxs17(Box15, { display: "flex", flexDirection: "column", gap: "2", children: [
|
|
2252
2339
|
successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx23(
|
|
2253
2340
|
Button3,
|
|
2254
2341
|
{
|
|
@@ -2277,10 +2364,10 @@ function SuccessfulPurchaseActions() {
|
|
|
2277
2364
|
function CollectiblesGrid({ collectibles }) {
|
|
2278
2365
|
const total = collectibles.length;
|
|
2279
2366
|
const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
|
|
2280
|
-
return /* @__PURE__ */ jsx23(
|
|
2367
|
+
return /* @__PURE__ */ jsx23(Box15, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
|
|
2281
2368
|
const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
|
|
2282
|
-
return /* @__PURE__ */
|
|
2283
|
-
|
|
2369
|
+
return /* @__PURE__ */ jsxs17(
|
|
2370
|
+
Box15,
|
|
2284
2371
|
{
|
|
2285
2372
|
className: collectiblesGridItem,
|
|
2286
2373
|
position: "relative",
|
|
@@ -2297,7 +2384,7 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2297
2384
|
}
|
|
2298
2385
|
),
|
|
2299
2386
|
showPlus && /* @__PURE__ */ jsx23(
|
|
2300
|
-
|
|
2387
|
+
Box15,
|
|
2301
2388
|
{
|
|
2302
2389
|
position: "absolute",
|
|
2303
2390
|
top: "0",
|
|
@@ -2309,8 +2396,8 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2309
2396
|
justifyContent: "center",
|
|
2310
2397
|
background: "backgroundOverlay",
|
|
2311
2398
|
backdropFilter: "blur",
|
|
2312
|
-
children: /* @__PURE__ */
|
|
2313
|
-
|
|
2399
|
+
children: /* @__PURE__ */ jsxs17(
|
|
2400
|
+
Text12,
|
|
2314
2401
|
{
|
|
2315
2402
|
fontSize: "small",
|
|
2316
2403
|
fontWeight: "medium",
|
|
@@ -2346,12 +2433,18 @@ import { useAccount as useAccount5 } from "wagmi";
|
|
|
2346
2433
|
import { observable as observable8 } from "@legendapp/state";
|
|
2347
2434
|
var initialState7 = {
|
|
2348
2435
|
isOpen: false,
|
|
2349
|
-
open: ({
|
|
2436
|
+
open: ({
|
|
2437
|
+
chainId,
|
|
2438
|
+
collectionAddress,
|
|
2439
|
+
collectibleId,
|
|
2440
|
+
callbacks
|
|
2441
|
+
}) => {
|
|
2350
2442
|
transferModal$.state.set({
|
|
2351
2443
|
...transferModal$.state.get(),
|
|
2352
2444
|
chainId,
|
|
2353
2445
|
collectionAddress,
|
|
2354
|
-
|
|
2446
|
+
collectibleId,
|
|
2447
|
+
callbacks
|
|
2355
2448
|
});
|
|
2356
2449
|
transferModal$.isOpen.set(true);
|
|
2357
2450
|
},
|
|
@@ -2367,7 +2460,7 @@ var initialState7 = {
|
|
|
2367
2460
|
receiverAddress: "",
|
|
2368
2461
|
collectionAddress: "0x",
|
|
2369
2462
|
chainId: "",
|
|
2370
|
-
|
|
2463
|
+
collectibleId: "",
|
|
2371
2464
|
quantity: "1"
|
|
2372
2465
|
},
|
|
2373
2466
|
view: "enterReceiverAddress",
|
|
@@ -2376,7 +2469,7 @@ var initialState7 = {
|
|
|
2376
2469
|
var transferModal$ = observable8(initialState7);
|
|
2377
2470
|
|
|
2378
2471
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2379
|
-
import { Box as
|
|
2472
|
+
import { Box as Box16, Button as Button4, Text as Text13, TextInput } from "@0xsequence/design-system";
|
|
2380
2473
|
import { observable as observable9 } from "@legendapp/state";
|
|
2381
2474
|
import { isAddress } from "viem";
|
|
2382
2475
|
import { useAccount as useAccount4 } from "wagmi";
|
|
@@ -2390,45 +2483,19 @@ function getMessage(key) {
|
|
|
2390
2483
|
return baseMessages[key];
|
|
2391
2484
|
}
|
|
2392
2485
|
|
|
2393
|
-
// src/react/ui/modals/TransferModal/_utils/getTransferTransactionTitleMessage.ts
|
|
2394
|
-
var getTransferTransactionTitle = (params) => {
|
|
2395
|
-
if (params.isConfirmed) {
|
|
2396
|
-
return "Transfer has processed";
|
|
2397
|
-
}
|
|
2398
|
-
if (params.isFailed) {
|
|
2399
|
-
return "Transfer has failed";
|
|
2400
|
-
}
|
|
2401
|
-
return "Transfer is processing";
|
|
2402
|
-
};
|
|
2403
|
-
var getTransferTransactionMessage = (params, collectibleName) => {
|
|
2404
|
-
if (params.isConfirmed) {
|
|
2405
|
-
return `You just tranferred ${collectibleName}. It\u2019s been confirmed on the blockchain!`;
|
|
2406
|
-
}
|
|
2407
|
-
if (params.isFailed) {
|
|
2408
|
-
return `Transferring ${collectibleName} has failed. Please try again.`;
|
|
2409
|
-
}
|
|
2410
|
-
return `You just transferred ${collectibleName}. It should be confirmed on the blockchain shortly.`;
|
|
2411
|
-
};
|
|
2412
|
-
|
|
2413
2486
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx
|
|
2414
2487
|
var useHandleTransfer = () => {
|
|
2415
2488
|
const {
|
|
2416
2489
|
receiverAddress,
|
|
2417
2490
|
collectionAddress,
|
|
2418
|
-
|
|
2491
|
+
collectibleId,
|
|
2419
2492
|
quantity,
|
|
2420
2493
|
chainId,
|
|
2421
2494
|
collectionType,
|
|
2422
|
-
|
|
2423
|
-
errorCallbacks
|
|
2495
|
+
callbacks
|
|
2424
2496
|
} = transferModal$.state.get();
|
|
2425
2497
|
const { transferTokensAsync } = useTransferTokens();
|
|
2426
2498
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
2427
|
-
const { data: collectible } = useCollectible({
|
|
2428
|
-
collectionAddress,
|
|
2429
|
-
collectibleId: tokenId,
|
|
2430
|
-
chainId
|
|
2431
|
-
});
|
|
2432
2499
|
async function transfer() {
|
|
2433
2500
|
if (collectionType !== "ERC721" /* ERC721 */ && collectionType !== "ERC1155" /* ERC1155 */) {
|
|
2434
2501
|
throw new InvalidContractTypeError(collectionType);
|
|
@@ -2438,7 +2505,7 @@ var useHandleTransfer = () => {
|
|
|
2438
2505
|
const hash = await transferTokensAsync({
|
|
2439
2506
|
receiverAddress,
|
|
2440
2507
|
collectionAddress,
|
|
2441
|
-
tokenId,
|
|
2508
|
+
tokenId: collectibleId,
|
|
2442
2509
|
chainId,
|
|
2443
2510
|
contractType: "ERC721" /* ERC721 */
|
|
2444
2511
|
});
|
|
@@ -2447,20 +2514,14 @@ var useHandleTransfer = () => {
|
|
|
2447
2514
|
hash,
|
|
2448
2515
|
collectionAddress,
|
|
2449
2516
|
chainId,
|
|
2450
|
-
|
|
2517
|
+
collectibleId,
|
|
2451
2518
|
price: void 0,
|
|
2452
|
-
|
|
2453
|
-
getMessage: (params) => getTransferTransactionMessage(params, collectible.name),
|
|
2454
|
-
type: "transfer",
|
|
2455
|
-
callbacks: {
|
|
2456
|
-
onSuccess: successCallbacks?.onTransferSuccess,
|
|
2457
|
-
onUnknownError: errorCallbacks?.onTransferError
|
|
2458
|
-
},
|
|
2519
|
+
type: "TRANSFER" /* TRANSFER */,
|
|
2459
2520
|
queriesToInvalidate: balanceQueries.all
|
|
2460
2521
|
});
|
|
2461
2522
|
} catch (error) {
|
|
2462
2523
|
transferModal$.view.set("enterReceiverAddress");
|
|
2463
|
-
|
|
2524
|
+
callbacks?.onError?.(error);
|
|
2464
2525
|
}
|
|
2465
2526
|
}
|
|
2466
2527
|
if (collectionType === "ERC1155" /* ERC1155 */) {
|
|
@@ -2468,7 +2529,7 @@ var useHandleTransfer = () => {
|
|
|
2468
2529
|
const hash = await transferTokensAsync({
|
|
2469
2530
|
receiverAddress,
|
|
2470
2531
|
collectionAddress,
|
|
2471
|
-
tokenId,
|
|
2532
|
+
tokenId: collectibleId,
|
|
2472
2533
|
chainId,
|
|
2473
2534
|
contractType: "ERC1155" /* ERC1155 */,
|
|
2474
2535
|
quantity: String(quantity)
|
|
@@ -2478,19 +2539,14 @@ var useHandleTransfer = () => {
|
|
|
2478
2539
|
hash,
|
|
2479
2540
|
collectionAddress,
|
|
2480
2541
|
chainId,
|
|
2481
|
-
|
|
2542
|
+
collectibleId,
|
|
2482
2543
|
price: void 0,
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
type: "transfer",
|
|
2486
|
-
callbacks: {
|
|
2487
|
-
onSuccess: successCallbacks?.onTransferSuccess,
|
|
2488
|
-
onUnknownError: errorCallbacks?.onTransferError
|
|
2489
|
-
}
|
|
2544
|
+
type: "TRANSFER" /* TRANSFER */,
|
|
2545
|
+
queriesToInvalidate: balanceQueries.all
|
|
2490
2546
|
});
|
|
2491
2547
|
} catch (error) {
|
|
2492
2548
|
transferModal$.view.set("enterReceiverAddress");
|
|
2493
|
-
|
|
2549
|
+
callbacks?.onError?.(error);
|
|
2494
2550
|
}
|
|
2495
2551
|
}
|
|
2496
2552
|
}
|
|
@@ -2499,10 +2555,10 @@ var useHandleTransfer = () => {
|
|
|
2499
2555
|
var useHandleTransfer_default = useHandleTransfer;
|
|
2500
2556
|
|
|
2501
2557
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2502
|
-
import { Fragment, jsx as jsx24, jsxs as
|
|
2558
|
+
import { Fragment, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2503
2559
|
var EnterWalletAddressView = () => {
|
|
2504
2560
|
const { address } = useAccount4();
|
|
2505
|
-
const { collectionAddress,
|
|
2561
|
+
const { collectionAddress, collectibleId, chainId, collectionType } = transferModal$.state.get();
|
|
2506
2562
|
const $quantity = transferModal$.state.quantity;
|
|
2507
2563
|
const $invalidQuantity = observable9(false);
|
|
2508
2564
|
const isWalletAddressValid = isAddress(
|
|
@@ -2511,7 +2567,7 @@ var EnterWalletAddressView = () => {
|
|
|
2511
2567
|
const { data: tokenBalance } = useListBalances({
|
|
2512
2568
|
chainId,
|
|
2513
2569
|
contractAddress: collectionAddress,
|
|
2514
|
-
tokenId,
|
|
2570
|
+
tokenId: collectibleId,
|
|
2515
2571
|
accountAddress: address,
|
|
2516
2572
|
query: { enabled: !!address }
|
|
2517
2573
|
});
|
|
@@ -2532,9 +2588,9 @@ var EnterWalletAddressView = () => {
|
|
|
2532
2588
|
transfer();
|
|
2533
2589
|
transferModal$.view.set("followWalletInstructions");
|
|
2534
2590
|
}
|
|
2535
|
-
return /* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */ jsx24(
|
|
2537
|
-
/* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ jsxs18(Box16, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2592
|
+
/* @__PURE__ */ jsx24(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2593
|
+
/* @__PURE__ */ jsxs18(Box16, { display: "flex", flexDirection: "column", gap: "3", children: [
|
|
2538
2594
|
/* @__PURE__ */ jsx24(
|
|
2539
2595
|
AlertMessage,
|
|
2540
2596
|
{
|
|
@@ -2553,7 +2609,7 @@ var EnterWalletAddressView = () => {
|
|
|
2553
2609
|
placeholder: "Enter wallet address of recipient"
|
|
2554
2610
|
}
|
|
2555
2611
|
),
|
|
2556
|
-
collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */
|
|
2612
|
+
collectionType === "ERC1155" /* ERC1155 */ && balanceAmount && /* @__PURE__ */ jsxs18(Fragment, { children: [
|
|
2557
2613
|
/* @__PURE__ */ jsx24(
|
|
2558
2614
|
QuantityInput,
|
|
2559
2615
|
{
|
|
@@ -2564,7 +2620,7 @@ var EnterWalletAddressView = () => {
|
|
|
2564
2620
|
}
|
|
2565
2621
|
),
|
|
2566
2622
|
/* @__PURE__ */ jsx24(
|
|
2567
|
-
|
|
2623
|
+
Text13,
|
|
2568
2624
|
{
|
|
2569
2625
|
color: insufficientBalance ? "negative" : "text50",
|
|
2570
2626
|
fontSize: "small",
|
|
@@ -2594,13 +2650,13 @@ var EnterWalletAddressView = () => {
|
|
|
2594
2650
|
var enterWalletAddress_default = EnterWalletAddressView;
|
|
2595
2651
|
|
|
2596
2652
|
// src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
|
|
2597
|
-
import { Box as
|
|
2653
|
+
import { Box as Box17, Button as Button5, Text as Text14 } from "@0xsequence/design-system";
|
|
2598
2654
|
import { observer as observer12 } from "@legendapp/state/react";
|
|
2599
|
-
import { jsx as jsx25, jsxs as
|
|
2655
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2600
2656
|
var FollowWalletInstructionsView = observer12(() => {
|
|
2601
|
-
return /* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */ jsx25(
|
|
2603
|
-
/* @__PURE__ */ jsx25(
|
|
2657
|
+
return /* @__PURE__ */ jsxs19(Box17, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2658
|
+
/* @__PURE__ */ jsx25(Text14, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2659
|
+
/* @__PURE__ */ jsx25(Box17, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx25(
|
|
2604
2660
|
AlertMessage,
|
|
2605
2661
|
{
|
|
2606
2662
|
message: getMessage("followWalletInstructions"),
|
|
@@ -2625,7 +2681,7 @@ var FollowWalletInstructionsView = observer12(() => {
|
|
|
2625
2681
|
var followWalletInstructions_default = FollowWalletInstructionsView;
|
|
2626
2682
|
|
|
2627
2683
|
// src/react/ui/modals/TransferModal/index.tsx
|
|
2628
|
-
import { jsx as jsx26, jsxs as
|
|
2684
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2629
2685
|
var useTransferModal = () => {
|
|
2630
2686
|
const { chainId: accountChainId } = useAccount5();
|
|
2631
2687
|
const { show: showSwitchNetworkModal } = useSwitchChainModal();
|
|
@@ -2649,13 +2705,13 @@ var useTransferModal = () => {
|
|
|
2649
2705
|
onError: (callbacks) => {
|
|
2650
2706
|
transferModal$.state.set({
|
|
2651
2707
|
...transferModal$.state.get(),
|
|
2652
|
-
|
|
2708
|
+
callbacks
|
|
2653
2709
|
});
|
|
2654
2710
|
},
|
|
2655
2711
|
onSuccess: (callbacks) => {
|
|
2656
2712
|
transferModal$.state.set({
|
|
2657
2713
|
...transferModal$.state.get(),
|
|
2658
|
-
|
|
2714
|
+
callbacks
|
|
2659
2715
|
});
|
|
2660
2716
|
}
|
|
2661
2717
|
};
|
|
@@ -2667,9 +2723,9 @@ var Modal3 = () => {
|
|
|
2667
2723
|
return /* @__PURE__ */ jsx26(ModalContent3, {});
|
|
2668
2724
|
};
|
|
2669
2725
|
var ModalContent3 = observer13(() => {
|
|
2670
|
-
return /* @__PURE__ */ jsx26(Root5, { open: true, children: /* @__PURE__ */
|
|
2726
|
+
return /* @__PURE__ */ jsx26(Root5, { open: true, children: /* @__PURE__ */ jsxs20(Portal5, { children: [
|
|
2671
2727
|
/* @__PURE__ */ jsx26(Overlay3, { className: dialogOverlay2 }),
|
|
2672
|
-
/* @__PURE__ */
|
|
2728
|
+
/* @__PURE__ */ jsxs20(Content5, { className: transferModalContent, children: [
|
|
2673
2729
|
/* @__PURE__ */ jsx26(TransactionModalView, {}),
|
|
2674
2730
|
/* @__PURE__ */ jsx26(Close3, { onClick: transferModal$.close, className: closeButton2, asChild: true, children: /* @__PURE__ */ jsx26(IconButton4, { size: "xs", "aria-label": "Close modal", icon: CloseIcon3 }) })
|
|
2675
2731
|
] })
|
|
@@ -2688,9 +2744,9 @@ var TransactionModalView = observer13(() => {
|
|
|
2688
2744
|
});
|
|
2689
2745
|
|
|
2690
2746
|
// src/react/ui/modals/modal-provider.tsx
|
|
2691
|
-
import { Fragment as Fragment2, jsx as jsx27, jsxs as
|
|
2747
|
+
import { Fragment as Fragment2, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2692
2748
|
var ModalProvider = observer14(() => {
|
|
2693
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ jsxs21(Fragment2, { children: [
|
|
2694
2750
|
/* @__PURE__ */ jsx27(AccountModal, {}),
|
|
2695
2751
|
/* @__PURE__ */ jsx27(CreateListingModal, {}),
|
|
2696
2752
|
/* @__PURE__ */ jsx27(MakeOfferModal, {}),
|
|
@@ -2704,12 +2760,12 @@ var ModalProvider = observer14(() => {
|
|
|
2704
2760
|
});
|
|
2705
2761
|
|
|
2706
2762
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
2707
|
-
import { useState as
|
|
2708
|
-
import { Box as
|
|
2763
|
+
import { useState as useState9 } from "react";
|
|
2764
|
+
import { Box as Box21, IconButton as IconButton6, Skeleton as Skeleton7 } from "@0xsequence/design-system";
|
|
2709
2765
|
import { useAccount as useAccount7 } from "wagmi";
|
|
2710
2766
|
|
|
2711
2767
|
// src/react/ui/icons/DiamondEye.tsx
|
|
2712
|
-
import { Box as
|
|
2768
|
+
import { Box as Box18 } from "@0xsequence/design-system";
|
|
2713
2769
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2714
2770
|
var Svg = () => /* @__PURE__ */ jsx28(
|
|
2715
2771
|
"svg",
|
|
@@ -2731,7 +2787,7 @@ var Svg = () => /* @__PURE__ */ jsx28(
|
|
|
2731
2787
|
}
|
|
2732
2788
|
);
|
|
2733
2789
|
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx28(
|
|
2734
|
-
|
|
2790
|
+
Box18,
|
|
2735
2791
|
{
|
|
2736
2792
|
as: Svg,
|
|
2737
2793
|
className: iconVariants({
|
|
@@ -2826,7 +2882,7 @@ var ActionButton = observer15(
|
|
|
2826
2882
|
onClick: () => showTransferModal({
|
|
2827
2883
|
collectionAddress,
|
|
2828
2884
|
chainId,
|
|
2829
|
-
tokenId
|
|
2885
|
+
collectibleId: tokenId
|
|
2830
2886
|
})
|
|
2831
2887
|
}
|
|
2832
2888
|
);
|
|
@@ -2853,12 +2909,12 @@ function ActionButtonBody({ label, onClick }) {
|
|
|
2853
2909
|
}
|
|
2854
2910
|
|
|
2855
2911
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
2856
|
-
import { Box as
|
|
2857
|
-
import { formatUnits as
|
|
2912
|
+
import { Box as Box20, IconButton as IconButton5, Image as Image6, Text as Text15 } from "@0xsequence/design-system";
|
|
2913
|
+
import { formatUnits as formatUnits4 } from "viem";
|
|
2858
2914
|
import { useAccount as useAccount6 } from "wagmi";
|
|
2859
2915
|
|
|
2860
2916
|
// src/react/ui/icons/Bell.tsx
|
|
2861
|
-
import { Box as
|
|
2917
|
+
import { Box as Box19 } from "@0xsequence/design-system";
|
|
2862
2918
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2863
2919
|
var Svg2 = () => /* @__PURE__ */ jsx30(
|
|
2864
2920
|
"svg",
|
|
@@ -2880,7 +2936,7 @@ var Svg2 = () => /* @__PURE__ */ jsx30(
|
|
|
2880
2936
|
}
|
|
2881
2937
|
);
|
|
2882
2938
|
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx30(
|
|
2883
|
-
|
|
2939
|
+
Box19,
|
|
2884
2940
|
{
|
|
2885
2941
|
as: Svg2,
|
|
2886
2942
|
className: iconVariants({
|
|
@@ -2892,7 +2948,7 @@ var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx30(
|
|
|
2892
2948
|
var Bell_default = SvgBellIcon;
|
|
2893
2949
|
|
|
2894
2950
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
2895
|
-
import { jsx as jsx31, jsxs as
|
|
2951
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2896
2952
|
var Footer = ({
|
|
2897
2953
|
name,
|
|
2898
2954
|
type,
|
|
@@ -2910,8 +2966,8 @@ var Footer = ({
|
|
|
2910
2966
|
if (name.length > 17 && !highestOffer) {
|
|
2911
2967
|
name = name.substring(0, 17) + "...";
|
|
2912
2968
|
}
|
|
2913
|
-
return /* @__PURE__ */
|
|
2914
|
-
|
|
2969
|
+
return /* @__PURE__ */ jsxs22(
|
|
2970
|
+
Box20,
|
|
2915
2971
|
{
|
|
2916
2972
|
display: "flex",
|
|
2917
2973
|
flexDirection: "column",
|
|
@@ -2922,8 +2978,8 @@ var Footer = ({
|
|
|
2922
2978
|
position: "relative",
|
|
2923
2979
|
className: !!address && isAnimated ? footer.animated : footer.static,
|
|
2924
2980
|
children: [
|
|
2925
|
-
/* @__PURE__ */
|
|
2926
|
-
|
|
2981
|
+
/* @__PURE__ */ jsxs22(
|
|
2982
|
+
Box20,
|
|
2927
2983
|
{
|
|
2928
2984
|
display: "flex",
|
|
2929
2985
|
alignItems: "center",
|
|
@@ -2932,7 +2988,7 @@ var Footer = ({
|
|
|
2932
2988
|
width: "full",
|
|
2933
2989
|
children: [
|
|
2934
2990
|
/* @__PURE__ */ jsx31(
|
|
2935
|
-
|
|
2991
|
+
Text15,
|
|
2936
2992
|
{
|
|
2937
2993
|
color: "text100",
|
|
2938
2994
|
fontSize: "normal",
|
|
@@ -2961,10 +3017,10 @@ var Footer = ({
|
|
|
2961
3017
|
]
|
|
2962
3018
|
}
|
|
2963
3019
|
),
|
|
2964
|
-
lowestListingPriceAmount && lowestListingCurrency && /* @__PURE__ */
|
|
3020
|
+
lowestListingPriceAmount && lowestListingCurrency && /* @__PURE__ */ jsxs22(Box20, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
2965
3021
|
/* @__PURE__ */ jsx31(Image6, { src: lowestListingCurrency?.imageUrl, width: "3", height: "3" }),
|
|
2966
|
-
/* @__PURE__ */
|
|
2967
|
-
|
|
3022
|
+
/* @__PURE__ */ jsxs22(
|
|
3023
|
+
Text15,
|
|
2968
3024
|
{
|
|
2969
3025
|
color: "text100",
|
|
2970
3026
|
fontSize: "small",
|
|
@@ -2972,7 +3028,7 @@ var Footer = ({
|
|
|
2972
3028
|
textAlign: "left",
|
|
2973
3029
|
fontFamily: "body",
|
|
2974
3030
|
children: [
|
|
2975
|
-
|
|
3031
|
+
formatUnits4(
|
|
2976
3032
|
BigInt(lowestListingPriceAmount),
|
|
2977
3033
|
lowestListingCurrency.decimals
|
|
2978
3034
|
),
|
|
@@ -2992,7 +3048,7 @@ var TokenTypeBalancePill = ({
|
|
|
2992
3048
|
}) => {
|
|
2993
3049
|
const displayText = type === "ERC1155" /* ERC1155 */ ? !!balance ? `Owned: ${balance}` : "ERC-1155" : "ERC-721";
|
|
2994
3050
|
return /* @__PURE__ */ jsx31(
|
|
2995
|
-
|
|
3051
|
+
Text15,
|
|
2996
3052
|
{
|
|
2997
3053
|
background: "backgroundSecondary",
|
|
2998
3054
|
color: "text80",
|
|
@@ -3008,10 +3064,10 @@ var TokenTypeBalancePill = ({
|
|
|
3008
3064
|
};
|
|
3009
3065
|
|
|
3010
3066
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
3011
|
-
import { jsx as jsx32, jsxs as
|
|
3067
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3012
3068
|
function CollectibleSkeleton() {
|
|
3013
|
-
return /* @__PURE__ */
|
|
3014
|
-
|
|
3069
|
+
return /* @__PURE__ */ jsxs23(
|
|
3070
|
+
Box21,
|
|
3015
3071
|
{
|
|
3016
3072
|
className: collectibleCard,
|
|
3017
3073
|
borderRadius: "md",
|
|
@@ -3019,14 +3075,14 @@ function CollectibleSkeleton() {
|
|
|
3019
3075
|
background: "backgroundPrimary",
|
|
3020
3076
|
children: [
|
|
3021
3077
|
/* @__PURE__ */ jsx32(
|
|
3022
|
-
|
|
3078
|
+
Skeleton7,
|
|
3023
3079
|
{
|
|
3024
3080
|
size: "lg",
|
|
3025
3081
|
style: { width: "100%", height: 164, borderRadius: 0, paddingTop: 16 }
|
|
3026
3082
|
}
|
|
3027
3083
|
),
|
|
3028
|
-
/* @__PURE__ */
|
|
3029
|
-
|
|
3084
|
+
/* @__PURE__ */ jsxs23(
|
|
3085
|
+
Box21,
|
|
3030
3086
|
{
|
|
3031
3087
|
display: "flex",
|
|
3032
3088
|
flexDirection: "column",
|
|
@@ -3035,8 +3091,8 @@ function CollectibleSkeleton() {
|
|
|
3035
3091
|
paddingBottom: "4",
|
|
3036
3092
|
marginTop: "2",
|
|
3037
3093
|
children: [
|
|
3038
|
-
/* @__PURE__ */ jsx32(
|
|
3039
|
-
/* @__PURE__ */ jsx32(
|
|
3094
|
+
/* @__PURE__ */ jsx32(Skeleton7, { size: "lg" }),
|
|
3095
|
+
/* @__PURE__ */ jsx32(Skeleton7, { size: "sm" })
|
|
3040
3096
|
]
|
|
3041
3097
|
}
|
|
3042
3098
|
)
|
|
@@ -3057,7 +3113,7 @@ function CollectibleCard({
|
|
|
3057
3113
|
}) {
|
|
3058
3114
|
const { address: accountAddress } = useAccount7();
|
|
3059
3115
|
const collectibleMetadata = lowestListing?.metadata;
|
|
3060
|
-
const [imageLoadingError, setImageLoadingError] =
|
|
3116
|
+
const [imageLoadingError, setImageLoadingError] = useState9(false);
|
|
3061
3117
|
const { data: highestOffer, isLoading: highestOfferLoading } = useHighestOffer({
|
|
3062
3118
|
chainId: String(chainId),
|
|
3063
3119
|
collectionAddress,
|
|
@@ -3075,14 +3131,14 @@ function CollectibleCard({
|
|
|
3075
3131
|
const image = collectibleMetadata?.image;
|
|
3076
3132
|
const externalUrl = collectibleMetadata?.external_url;
|
|
3077
3133
|
return /* @__PURE__ */ jsx32(
|
|
3078
|
-
|
|
3134
|
+
Box21,
|
|
3079
3135
|
{
|
|
3080
3136
|
className: collectibleCard,
|
|
3081
3137
|
borderRadius: "md",
|
|
3082
3138
|
overflow: "hidden",
|
|
3083
3139
|
background: "backgroundPrimary",
|
|
3084
3140
|
children: /* @__PURE__ */ jsx32(
|
|
3085
|
-
|
|
3141
|
+
Box21,
|
|
3086
3142
|
{
|
|
3087
3143
|
display: "flex",
|
|
3088
3144
|
flexDirection: "column",
|
|
@@ -3097,7 +3153,7 @@ function CollectibleCard({
|
|
|
3097
3153
|
cursor: "pointer",
|
|
3098
3154
|
padding: "0",
|
|
3099
3155
|
className: collectibleTileWrapper,
|
|
3100
|
-
children: /* @__PURE__ */
|
|
3156
|
+
children: /* @__PURE__ */ jsxs23("article", { style: { width: "100%" }, children: [
|
|
3101
3157
|
externalUrl && /* @__PURE__ */ jsx32(
|
|
3102
3158
|
IconButton6,
|
|
3103
3159
|
{
|
|
@@ -3138,7 +3194,7 @@ function CollectibleCard({
|
|
|
3138
3194
|
}
|
|
3139
3195
|
),
|
|
3140
3196
|
accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */ jsx32(
|
|
3141
|
-
|
|
3197
|
+
Box21,
|
|
3142
3198
|
{
|
|
3143
3199
|
display: "flex",
|
|
3144
3200
|
alignItems: "center",
|
|
@@ -3176,4 +3232,4 @@ export {
|
|
|
3176
3232
|
ModalProvider,
|
|
3177
3233
|
CollectibleCard
|
|
3178
3234
|
};
|
|
3179
|
-
//# sourceMappingURL=chunk-
|
|
3235
|
+
//# sourceMappingURL=chunk-F42XMKDS.js.map
|