@0xsequence/marketplace-sdk 0.4.4 → 0.4.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-6XUCLBZC.js → chunk-2FOUCP2R.js} +275 -210
- package/dist/chunk-2FOUCP2R.js.map +1 -0
- package/dist/{chunk-GLOIEUWC.js → chunk-36NGHJH5.js} +51 -611
- package/dist/chunk-36NGHJH5.js.map +1 -0
- package/dist/{chunk-LHN6EBLM.js → chunk-3C2MT5TM.js} +9 -10
- package/dist/chunk-3C2MT5TM.js.map +1 -0
- package/dist/{chunk-PAZ4MQXZ.js → chunk-5D3ARFFZ.js} +1 -1
- package/dist/chunk-5D3ARFFZ.js.map +1 -0
- package/dist/{chunk-ZEKRTFBU.js → chunk-DNVERQ5J.js} +12 -2
- package/dist/chunk-DNVERQ5J.js.map +1 -0
- package/dist/{chunk-4VS5NKDD.js → chunk-LTHX6RXH.js} +2 -2
- package/dist/{chunk-URX7ZHX4.js → chunk-QVOUL555.js} +2 -2
- package/dist/{chunk-J4TRSLTB.js → chunk-RD7HPANB.js} +4 -4
- package/dist/chunk-RD7HPANB.js.map +1 -0
- package/dist/chunk-WM4RGBFQ.js +155 -0
- package/dist/{chunk-DNDPYQKV.js.map → chunk-WM4RGBFQ.js.map} +1 -1
- package/dist/{chunk-IQXJZBMR.js → chunk-ZEH4JI2U.js} +2 -2
- package/dist/{create-config-8sffBvlt.d.ts → create-config-BBTTSJyp.d.ts} +2 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +6 -6
- package/dist/{marketplace-config-Bbxl-uKX.d.ts → marketplace-config-vioKvBQe.d.ts} +2 -0
- package/dist/react/_internal/api/index.d.ts +2 -3
- package/dist/react/_internal/api/index.js +2 -2
- package/dist/react/_internal/index.d.ts +6 -7
- package/dist/react/_internal/index.js +6 -4
- package/dist/react/_internal/wagmi/index.d.ts +3 -3
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +106 -307
- package/dist/react/hooks/index.js +7 -10
- package/dist/react/index.d.ts +10 -8
- package/dist/react/index.js +12 -12
- package/dist/react/ssr/index.d.ts +14 -0
- package/dist/react/ssr/index.js +10 -32
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/index.d.ts +4 -3
- package/dist/react/ui/components/index.js +10 -10
- package/dist/react/ui/index.d.ts +5 -4
- package/dist/react/ui/index.js +10 -10
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +3 -2
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +7 -7
- package/dist/react/ui/styles/index.d.ts +1 -1
- package/dist/{marketplace.gen-jdKqutnd.d.ts → sdk-config-CasNGLz4.d.ts} +24 -1
- package/dist/{services-C2O-7p_M.d.ts → services-CbsurKYr.d.ts} +1 -2
- package/dist/styles/index.d.ts +1 -1
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.js +4 -4
- package/dist/types-rupsBCjv.d.ts +70 -0
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/src/react/_internal/types.ts +51 -1
- package/src/react/_internal/{transaction-machine/utils.ts → utils.ts} +1 -1
- package/src/react/_internal/{transaction-machine → wallet}/wallet.ts +2 -2
- package/src/react/hooks/index.ts +0 -1
- package/src/react/hooks/useCancelOrder.tsx +22 -3
- package/src/react/hooks/useCancelTransactionSteps.tsx +9 -8
- package/src/react/hooks/useCurrencies.tsx +16 -18
- package/src/react/hooks/useCurrency.tsx +1 -1
- package/src/react/provider.tsx +18 -3
- package/src/react/ssr/create-ssr-client.ts +9 -5
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -1
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +1 -1
- package/src/react/ui/modals/BuyModal/Modal.tsx +4 -0
- package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +33 -7
- package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +1 -1
- package/src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx +12 -3
- package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +8 -3
- package/src/react/ui/modals/BuyModal/store.ts +14 -0
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +30 -5
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +35 -29
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +27 -35
- package/src/react/ui/modals/CreateListingModal/store.ts +3 -3
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +17 -24
- package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +36 -30
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +22 -6
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +33 -33
- package/src/react/ui/modals/MakeOfferModal/store.ts +4 -4
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +1 -1
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +10 -23
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +39 -55
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +1 -1
- package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +3 -1
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +4 -0
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +11 -1
- package/src/react/ui/modals/_internal/components/priceInput/hooks/usePriceInput.ts +3 -3
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +3 -0
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +2 -1
- package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +16 -7
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts +1 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts +12 -1
- package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts +1 -1
- package/src/types/marketplace-config.ts +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-6XUCLBZC.js.map +0 -1
- package/dist/chunk-DNDPYQKV.js +0 -307
- package/dist/chunk-GLOIEUWC.js.map +0 -1
- package/dist/chunk-J4TRSLTB.js.map +0 -1
- package/dist/chunk-LHN6EBLM.js.map +0 -1
- package/dist/chunk-PAZ4MQXZ.js.map +0 -1
- package/dist/chunk-ZEKRTFBU.js.map +0 -1
- package/dist/sdk-config-xWkdBdrL.d.ts +0 -24
- package/dist/types-DZb7GsfL.d.ts +0 -28
- package/src/react/_internal/transaction-machine/execute-transaction.ts +0 -676
- package/src/react/_internal/transaction-machine/useTransactionMachine.ts +0 -140
- package/src/react/hooks/useBuyCollectable.tsx +0 -61
- /package/dist/{chunk-4VS5NKDD.js.map → chunk-LTHX6RXH.js.map} +0 -0
- /package/dist/{chunk-URX7ZHX4.js.map → chunk-QVOUL555.js.map} +0 -0
- /package/dist/{chunk-IQXJZBMR.js.map → chunk-ZEH4JI2U.js.map} +0 -0
- /package/src/react/_internal/{transaction-machine/logger.ts → logger.ts} +0 -0
- /package/src/react/_internal/{transaction-machine → wallet}/useWallet.ts +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ActionModal,
|
|
4
4
|
CustomSelect,
|
|
5
5
|
useCurrencyBalance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RD7HPANB.js";
|
|
7
7
|
import {
|
|
8
8
|
CalendarIcon_default,
|
|
9
9
|
MinusIcon_default,
|
|
@@ -46,20 +46,19 @@ import {
|
|
|
46
46
|
useGenerateListingTransaction,
|
|
47
47
|
useGenerateOfferTransaction,
|
|
48
48
|
useGenerateSellTransaction,
|
|
49
|
-
useGetReceiptFromHash,
|
|
50
49
|
useHighestOffer,
|
|
51
50
|
useListBalances,
|
|
52
51
|
useLowestListing,
|
|
53
52
|
useMarketplaceConfig,
|
|
54
53
|
useRoyaltyPercentage,
|
|
55
54
|
useTransferTokens
|
|
56
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-36NGHJH5.js";
|
|
57
56
|
import {
|
|
58
57
|
AlertMessage,
|
|
59
58
|
switchChainModal_default,
|
|
60
59
|
useSwitchChainModal,
|
|
61
60
|
useWallet
|
|
62
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-3C2MT5TM.js";
|
|
63
62
|
import {
|
|
64
63
|
iconVariants
|
|
65
64
|
} from "./chunk-LF44FCG5.js";
|
|
@@ -67,19 +66,20 @@ import {
|
|
|
67
66
|
calculatePriceDifferencePercentage,
|
|
68
67
|
getPublicRpcClient,
|
|
69
68
|
truncateMiddle
|
|
70
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-LTHX6RXH.js";
|
|
71
70
|
import {
|
|
72
71
|
getProviderEl
|
|
73
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-DNVERQ5J.js";
|
|
74
73
|
import {
|
|
75
74
|
balanceQueries,
|
|
75
|
+
collectableKeys,
|
|
76
76
|
getMarketplaceClient,
|
|
77
77
|
getQueryClient
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-QVOUL555.js";
|
|
79
79
|
import {
|
|
80
80
|
InvalidContractTypeError,
|
|
81
81
|
InvalidStepError
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-WM4RGBFQ.js";
|
|
83
83
|
|
|
84
84
|
// src/react/ui/modals/modal-provider.tsx
|
|
85
85
|
import { observer as observer14 } from "@legendapp/state/react";
|
|
@@ -103,12 +103,15 @@ var AccountModal = observer(function AccountModal2() {
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
// src/react/ui/modals/MakeOfferModal/Modal.tsx
|
|
106
|
-
import { Show, observer as observer7
|
|
106
|
+
import { Show, observer as observer7 } from "@legendapp/state/react";
|
|
107
107
|
import { useState as useState7 } from "react";
|
|
108
|
-
import { parseUnits as parseUnits2
|
|
108
|
+
import { parseUnits as parseUnits2 } from "viem";
|
|
109
|
+
|
|
110
|
+
// src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx
|
|
111
|
+
import { useEffect as useEffect3 } from "react";
|
|
109
112
|
|
|
110
113
|
// src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx
|
|
111
|
-
import { useQuery } from "@tanstack/react-query";
|
|
114
|
+
import { skipToken, useQuery } from "@tanstack/react-query";
|
|
112
115
|
var ONE_DAY_IN_SECONDS = 60 * 60 * 24;
|
|
113
116
|
var useGetTokenApprovalData = (params) => {
|
|
114
117
|
const config = useConfig();
|
|
@@ -118,12 +121,13 @@ var useGetTokenApprovalData = (params) => {
|
|
|
118
121
|
tokenId: params.tokenId,
|
|
119
122
|
quantity: "1",
|
|
120
123
|
currencyAddress: params.currencyAddress,
|
|
121
|
-
pricePerToken: "
|
|
124
|
+
pricePerToken: "1",
|
|
122
125
|
expiry: String(Number(dateToUnixTime(/* @__PURE__ */ new Date())) + ONE_DAY_IN_SECONDS)
|
|
123
126
|
};
|
|
127
|
+
const isEnabled = wallet && params.query?.enabled !== false;
|
|
124
128
|
const { data, isLoading, isSuccess } = useQuery({
|
|
125
129
|
queryKey: ["token-approval-data", params.currencyAddress],
|
|
126
|
-
queryFn: async () => {
|
|
130
|
+
queryFn: isEnabled ? async () => {
|
|
127
131
|
const args = {
|
|
128
132
|
collectionAddress: params.collectionAddress,
|
|
129
133
|
maker: await wallet.address(),
|
|
@@ -144,7 +148,7 @@ var useGetTokenApprovalData = (params) => {
|
|
|
144
148
|
return {
|
|
145
149
|
step: tokenApprovalStep
|
|
146
150
|
};
|
|
147
|
-
},
|
|
151
|
+
} : skipToken,
|
|
148
152
|
enabled: !!wallet && !!params.collectionAddress && !!params.currencyAddress
|
|
149
153
|
});
|
|
150
154
|
return {
|
|
@@ -487,6 +491,9 @@ var closeButton3 = "fyvr11lw fyvr1tc fyvr1mo";
|
|
|
487
491
|
var dialogOverlay3 = "fyvr1m0 fyvr1o8 fyvr1qg fyvr1so fyvr11vl fyvr11m0 fyvr11rs";
|
|
488
492
|
var transactionStatusModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11ul fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
|
|
489
493
|
|
|
494
|
+
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts
|
|
495
|
+
import { formatUnits as formatUnits2 } from "viem";
|
|
496
|
+
|
|
490
497
|
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts
|
|
491
498
|
function getFormattedType(transactionType, verb = false) {
|
|
492
499
|
switch (transactionType) {
|
|
@@ -512,12 +519,17 @@ function getTransactionStatusModalMessage({
|
|
|
512
519
|
transactionStatus,
|
|
513
520
|
transactionType,
|
|
514
521
|
collectibleName,
|
|
515
|
-
orderId
|
|
522
|
+
orderId,
|
|
523
|
+
price
|
|
516
524
|
}) {
|
|
517
525
|
const hideCollectibleName = transactionType === "CANCEL";
|
|
526
|
+
const formattedPrice = price ? formatUnits2(BigInt(price.amountRaw), price.currency.decimals) : "";
|
|
518
527
|
if (orderId) {
|
|
519
528
|
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It's been confirmed on the blockchain!`;
|
|
520
529
|
}
|
|
530
|
+
if (transactionType === "OFFER" /* OFFER */) {
|
|
531
|
+
return `You just offered ${formattedPrice} ${price?.currency.symbol} for ${collectibleName}. It's been confirmed on the blockchain!`;
|
|
532
|
+
}
|
|
521
533
|
switch (transactionStatus) {
|
|
522
534
|
case "PENDING":
|
|
523
535
|
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It should be confirmed on the blockchain shortly.`;
|
|
@@ -569,6 +581,12 @@ var useTransactionStatusModal = () => {
|
|
|
569
581
|
close: () => transactionStatusModal$.close()
|
|
570
582
|
};
|
|
571
583
|
};
|
|
584
|
+
var invalidateQueries = async (queriesToInvalidate) => {
|
|
585
|
+
const queryClient = getQueryClient();
|
|
586
|
+
for (const queryKey of queriesToInvalidate) {
|
|
587
|
+
await queryClient.invalidateQueries({ queryKey });
|
|
588
|
+
}
|
|
589
|
+
};
|
|
572
590
|
var TransactionStatusModal = observer3(() => {
|
|
573
591
|
const {
|
|
574
592
|
type,
|
|
@@ -590,6 +608,7 @@ var TransactionStatusModal = observer3(() => {
|
|
|
590
608
|
const [transactionStatus, setTransactionStatus] = useState2(
|
|
591
609
|
orderId ? "SUCCESS" : "PENDING"
|
|
592
610
|
);
|
|
611
|
+
const queryClient = getQueryClient();
|
|
593
612
|
useEffect2(() => {
|
|
594
613
|
if (!transactionStatusModal$.isOpen.get() || orderId) return;
|
|
595
614
|
console.log("Waiting for transaction receipt ...");
|
|
@@ -602,6 +621,11 @@ var TransactionStatusModal = observer3(() => {
|
|
|
602
621
|
} else {
|
|
603
622
|
console.debug("onSuccess callback not provided:", hash);
|
|
604
623
|
}
|
|
624
|
+
if (queriesToInvalidate) {
|
|
625
|
+
invalidateQueries(queriesToInvalidate);
|
|
626
|
+
} else {
|
|
627
|
+
queryClient.invalidateQueries();
|
|
628
|
+
}
|
|
605
629
|
}
|
|
606
630
|
}).catch((error) => {
|
|
607
631
|
if (callbacks?.onError) {
|
|
@@ -615,9 +639,6 @@ var TransactionStatusModal = observer3(() => {
|
|
|
615
639
|
}
|
|
616
640
|
setTransactionStatus("FAILED");
|
|
617
641
|
});
|
|
618
|
-
if (queriesToInvalidate) {
|
|
619
|
-
queryClient.invalidateQueries({ queryKey: [...queriesToInvalidate] });
|
|
620
|
-
}
|
|
621
642
|
return () => {
|
|
622
643
|
setTransactionStatus("PENDING");
|
|
623
644
|
};
|
|
@@ -638,9 +659,9 @@ var TransactionStatusModal = observer3(() => {
|
|
|
638
659
|
transactionStatus,
|
|
639
660
|
transactionType: type,
|
|
640
661
|
collectibleName: collectible?.name || "",
|
|
641
|
-
orderId
|
|
662
|
+
orderId,
|
|
663
|
+
price
|
|
642
664
|
});
|
|
643
|
-
const queryClient = getQueryClient();
|
|
644
665
|
const publicClient = chainId ? getPublicRpcClient(chainId) : null;
|
|
645
666
|
const waitForTransactionReceiptPromise = publicClient?.waitForTransactionReceipt({
|
|
646
667
|
confirmations: confirmations || TRANSACTION_CONFIRMATIONS_DEFAULT,
|
|
@@ -719,13 +740,16 @@ var useTransactionSteps = ({
|
|
|
719
740
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
720
741
|
const sdkConfig = useConfig();
|
|
721
742
|
const marketplaceClient = getMarketplaceClient(chainId, sdkConfig);
|
|
722
|
-
const { waitForReceipt } = useGetReceiptFromHash();
|
|
723
743
|
const { generateOfferTransactionAsync, isPending: generatingSteps } = useGenerateOfferTransaction({
|
|
724
744
|
chainId,
|
|
725
745
|
onSuccess: (steps) => {
|
|
726
746
|
if (!steps) return;
|
|
727
747
|
}
|
|
728
748
|
});
|
|
749
|
+
const { data: currency } = useCurrency({
|
|
750
|
+
chainId,
|
|
751
|
+
currencyAddress: offerInput.offer.currencyAddress
|
|
752
|
+
});
|
|
729
753
|
const getOfferSteps = async () => {
|
|
730
754
|
if (!wallet) return;
|
|
731
755
|
try {
|
|
@@ -748,7 +772,6 @@ var useTransactionSteps = ({
|
|
|
748
772
|
} else {
|
|
749
773
|
console.debug("onError callback not provided:", error);
|
|
750
774
|
}
|
|
751
|
-
throw error;
|
|
752
775
|
}
|
|
753
776
|
};
|
|
754
777
|
const executeApproval = async () => {
|
|
@@ -762,14 +785,11 @@ var useTransactionSteps = ({
|
|
|
762
785
|
Number(chainId),
|
|
763
786
|
approvalStep
|
|
764
787
|
);
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
steps$.approval.exist.set(false);
|
|
769
|
-
}
|
|
788
|
+
await wallet.handleConfirmTransactionStep(hash, Number(chainId));
|
|
789
|
+
steps$.approval.isExecuting.set(false);
|
|
790
|
+
steps$.approval.exist.set(false);
|
|
770
791
|
} catch (error) {
|
|
771
792
|
steps$.approval.isExecuting.set(false);
|
|
772
|
-
throw error;
|
|
773
793
|
}
|
|
774
794
|
};
|
|
775
795
|
const makeOffer = async () => {
|
|
@@ -803,22 +823,27 @@ var useTransactionSteps = ({
|
|
|
803
823
|
collectibleId: offerInput.offer.tokenId,
|
|
804
824
|
hash,
|
|
805
825
|
orderId,
|
|
806
|
-
callbacks
|
|
826
|
+
callbacks,
|
|
827
|
+
queriesToInvalidate: [
|
|
828
|
+
balanceQueries.all,
|
|
829
|
+
collectableKeys.highestOffers,
|
|
830
|
+
collectableKeys.offers,
|
|
831
|
+
collectableKeys.offersCount,
|
|
832
|
+
collectableKeys.userBalances
|
|
833
|
+
],
|
|
834
|
+
price: {
|
|
835
|
+
amountRaw: offerInput.offer.pricePerToken,
|
|
836
|
+
currency
|
|
837
|
+
}
|
|
807
838
|
});
|
|
808
839
|
if (hash) {
|
|
809
|
-
await
|
|
840
|
+
await wallet.handleConfirmTransactionStep(hash, Number(chainId));
|
|
810
841
|
steps$.transaction.isExecuting.set(false);
|
|
811
842
|
steps$.transaction.exist.set(false);
|
|
812
|
-
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
813
|
-
callbacks.onSuccess({ hash });
|
|
814
|
-
}
|
|
815
843
|
}
|
|
816
844
|
if (orderId) {
|
|
817
845
|
steps$.transaction.isExecuting.set(false);
|
|
818
846
|
steps$.transaction.exist.set(false);
|
|
819
|
-
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
820
|
-
callbacks.onSuccess({ orderId });
|
|
821
|
-
}
|
|
822
847
|
}
|
|
823
848
|
} catch (error) {
|
|
824
849
|
steps$.transaction.isExecuting.set(false);
|
|
@@ -826,7 +851,6 @@ var useTransactionSteps = ({
|
|
|
826
851
|
if (callbacks?.onError && typeof callbacks.onError === "function") {
|
|
827
852
|
callbacks.onError(error);
|
|
828
853
|
}
|
|
829
|
-
throw error;
|
|
830
854
|
}
|
|
831
855
|
};
|
|
832
856
|
const executeTransaction = async ({
|
|
@@ -861,23 +885,30 @@ var useTransactionSteps = ({
|
|
|
861
885
|
};
|
|
862
886
|
|
|
863
887
|
// src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx
|
|
864
|
-
import { useEffect as useEffect3 } from "react";
|
|
865
888
|
var useMakeOffer = ({
|
|
866
889
|
offerInput,
|
|
867
890
|
chainId,
|
|
868
891
|
collectionAddress,
|
|
869
|
-
orderbookKind
|
|
892
|
+
orderbookKind,
|
|
870
893
|
callbacks,
|
|
871
894
|
closeMainModal,
|
|
872
895
|
steps$
|
|
873
896
|
}) => {
|
|
897
|
+
const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
|
|
898
|
+
const collectionConfig = marketplaceConfig?.collections.find(
|
|
899
|
+
(c) => c.collectionAddress === collectionAddress
|
|
900
|
+
);
|
|
901
|
+
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
|
|
874
902
|
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData({
|
|
875
903
|
chainId,
|
|
876
904
|
tokenId: offerInput.offer.tokenId,
|
|
877
905
|
collectionAddress,
|
|
878
906
|
currencyAddress: offerInput.offer.currencyAddress,
|
|
879
907
|
contractType: offerInput.contractType,
|
|
880
|
-
orderbook: orderbookKind
|
|
908
|
+
orderbook: orderbookKind,
|
|
909
|
+
query: {
|
|
910
|
+
enabled: !marketplaceIsLoading
|
|
911
|
+
}
|
|
881
912
|
});
|
|
882
913
|
useEffect3(() => {
|
|
883
914
|
if (tokenApproval?.step && !tokenApprovalIsLoading) {
|
|
@@ -909,7 +940,8 @@ var ErrorModal = ({
|
|
|
909
940
|
isOpen,
|
|
910
941
|
chainId,
|
|
911
942
|
onClose,
|
|
912
|
-
title
|
|
943
|
+
title,
|
|
944
|
+
message
|
|
913
945
|
}) => /* @__PURE__ */ jsx6(
|
|
914
946
|
ActionModal,
|
|
915
947
|
{
|
|
@@ -918,7 +950,7 @@ var ErrorModal = ({
|
|
|
918
950
|
onClose,
|
|
919
951
|
title,
|
|
920
952
|
ctas: [],
|
|
921
|
-
children: /* @__PURE__ */ jsx6(Box5, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: "Error loading item details" })
|
|
953
|
+
children: /* @__PURE__ */ jsx6(Box5, { display: "flex", justifyContent: "center", alignItems: "center", padding: "4", children: message || "Error loading item details" })
|
|
922
954
|
}
|
|
923
955
|
);
|
|
924
956
|
|
|
@@ -1036,6 +1068,11 @@ function CalendarPopover({
|
|
|
1036
1068
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
1037
1069
|
import { useState as useState3 } from "react";
|
|
1038
1070
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1071
|
+
var setToEndOfDay = (date) => {
|
|
1072
|
+
const endOfDay = new Date(date);
|
|
1073
|
+
endOfDay.setHours(23, 59, 59, 999);
|
|
1074
|
+
return endOfDay;
|
|
1075
|
+
};
|
|
1039
1076
|
var PRESET_RANGES = {
|
|
1040
1077
|
TODAY: {
|
|
1041
1078
|
label: "Today",
|
|
@@ -1077,7 +1114,8 @@ var ExpirationDateSelect = observer4(function ExpirationDateSelect2({
|
|
|
1077
1114
|
if (!presetRange) {
|
|
1078
1115
|
return;
|
|
1079
1116
|
}
|
|
1080
|
-
const
|
|
1117
|
+
const baseDate = /* @__PURE__ */ new Date();
|
|
1118
|
+
const newDate = presetRange.value === "today" ? setToEndOfDay(baseDate) : addDays(baseDate, presetRange.offset);
|
|
1081
1119
|
$date.set(newDate);
|
|
1082
1120
|
}
|
|
1083
1121
|
function handleDateValueChange(date) {
|
|
@@ -1248,13 +1286,15 @@ var CurrencyOptionsSelect = observer5(function CurrencyOptionsSelect2({
|
|
|
1248
1286
|
chainId,
|
|
1249
1287
|
collectionAddress,
|
|
1250
1288
|
secondCurrencyAsDefault,
|
|
1251
|
-
selectedCurrency
|
|
1289
|
+
selectedCurrency$,
|
|
1290
|
+
includeNativeCurrency
|
|
1252
1291
|
}) {
|
|
1253
1292
|
const currency = selectedCurrency$.get();
|
|
1254
1293
|
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
1255
1294
|
const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
|
|
1256
1295
|
chainId,
|
|
1257
|
-
currencyOptions
|
|
1296
|
+
currencyOptions,
|
|
1297
|
+
includeNativeCurrency
|
|
1258
1298
|
});
|
|
1259
1299
|
useEffect4(() => {
|
|
1260
1300
|
if (currencies && currencies.length > 0 && !selectedCurrency$.get()?.contractAddress) {
|
|
@@ -1387,7 +1427,8 @@ var PriceInput = observer6(function PriceInput2({
|
|
|
1387
1427
|
$price,
|
|
1388
1428
|
onPriceChange,
|
|
1389
1429
|
checkBalance,
|
|
1390
|
-
secondCurrencyAsDefault
|
|
1430
|
+
secondCurrencyAsDefault,
|
|
1431
|
+
includeNativeCurrency
|
|
1391
1432
|
}) {
|
|
1392
1433
|
const { address: accountAddress } = useAccount2();
|
|
1393
1434
|
const currencyDecimals = $price.currency.decimals.get() || 18;
|
|
@@ -1451,7 +1492,8 @@ var PriceInput = observer6(function PriceInput2({
|
|
|
1451
1492
|
selectedCurrency$: $price.currency,
|
|
1452
1493
|
collectionAddress,
|
|
1453
1494
|
chainId,
|
|
1454
|
-
secondCurrencyAsDefault
|
|
1495
|
+
secondCurrencyAsDefault,
|
|
1496
|
+
includeNativeCurrency
|
|
1455
1497
|
}
|
|
1456
1498
|
),
|
|
1457
1499
|
value,
|
|
@@ -1547,7 +1589,7 @@ function QuantityInput({
|
|
|
1547
1589
|
/* @__PURE__ */ jsx15(
|
|
1548
1590
|
IconButton2,
|
|
1549
1591
|
{
|
|
1550
|
-
disabled: !quantity || Number(quantity) <=
|
|
1592
|
+
disabled: !quantity || Number(quantity) <= 1,
|
|
1551
1593
|
onClick: handleDecrement,
|
|
1552
1594
|
background: "buttonGlass",
|
|
1553
1595
|
size: "xs",
|
|
@@ -1557,6 +1599,7 @@ function QuantityInput({
|
|
|
1557
1599
|
/* @__PURE__ */ jsx15(
|
|
1558
1600
|
IconButton2,
|
|
1559
1601
|
{
|
|
1602
|
+
disabled: !quantity || Number(quantity) >= Number(maxQuantity),
|
|
1560
1603
|
onClick: handleIncrement,
|
|
1561
1604
|
background: "buttonGlass",
|
|
1562
1605
|
size: "xs",
|
|
@@ -1644,7 +1687,7 @@ var initialState2 = {
|
|
|
1644
1687
|
collectionAddress: "",
|
|
1645
1688
|
chainId: "",
|
|
1646
1689
|
collectibleId: "",
|
|
1647
|
-
orderbookKind:
|
|
1690
|
+
orderbookKind: void 0,
|
|
1648
1691
|
callbacks: void 0,
|
|
1649
1692
|
offerPrice: {
|
|
1650
1693
|
amountRaw: "0",
|
|
@@ -1688,7 +1731,6 @@ var makeOfferModal$ = observable3({
|
|
|
1688
1731
|
});
|
|
1689
1732
|
|
|
1690
1733
|
// src/react/ui/modals/MakeOfferModal/Modal.tsx
|
|
1691
|
-
import { Box as Box12 } from "@0xsequence/design-system";
|
|
1692
1734
|
import { Fragment, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1693
1735
|
var MakeOfferModal = () => {
|
|
1694
1736
|
return /* @__PURE__ */ jsx17(Show, { if: makeOfferModal$.isOpen, children: () => /* @__PURE__ */ jsx17(Modal2, {}) });
|
|
@@ -1731,9 +1773,9 @@ var Modal2 = observer7(() => {
|
|
|
1731
1773
|
isError: currenciesIsError
|
|
1732
1774
|
} = useCurrencies({
|
|
1733
1775
|
chainId,
|
|
1734
|
-
currencyOptions
|
|
1776
|
+
currencyOptions,
|
|
1777
|
+
includeNativeCurrency: false
|
|
1735
1778
|
});
|
|
1736
|
-
const selectedCurrency = use$(makeOfferModal$.offerPrice.currency);
|
|
1737
1779
|
const { isLoading, executeApproval, makeOffer } = useMakeOffer({
|
|
1738
1780
|
offerInput: {
|
|
1739
1781
|
contractType: collection?.type,
|
|
@@ -1777,7 +1819,18 @@ var Modal2 = observer7(() => {
|
|
|
1777
1819
|
}
|
|
1778
1820
|
);
|
|
1779
1821
|
}
|
|
1780
|
-
|
|
1822
|
+
if (!currencies || currencies.length === 0) {
|
|
1823
|
+
return /* @__PURE__ */ jsx17(
|
|
1824
|
+
ErrorModal,
|
|
1825
|
+
{
|
|
1826
|
+
isOpen: makeOfferModal$.isOpen.get(),
|
|
1827
|
+
chainId: Number(chainId),
|
|
1828
|
+
onClose: makeOfferModal$.close,
|
|
1829
|
+
title: "Make an offer",
|
|
1830
|
+
message: "No ERC-20s are configured for the marketplace, contact the marketplace owners"
|
|
1831
|
+
}
|
|
1832
|
+
);
|
|
1833
|
+
}
|
|
1781
1834
|
const ctas = [
|
|
1782
1835
|
{
|
|
1783
1836
|
label: "Approve TOKEN",
|
|
@@ -1791,10 +1844,9 @@ var Modal2 = observer7(() => {
|
|
|
1791
1844
|
label: "Make offer",
|
|
1792
1845
|
onClick: () => makeOffer(),
|
|
1793
1846
|
pending: steps$.transaction.isExecuting.get(),
|
|
1794
|
-
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity
|
|
1847
|
+
disabled: steps$.approval.isExecuting.get() || steps$.approval.exist.get() || offerPrice.amountRaw === "0" || insufficientBalance || isLoading || invalidQuantity
|
|
1795
1848
|
}
|
|
1796
1849
|
];
|
|
1797
|
-
const secondCurrencyAsDefault = orderbookKind !== "sequence_marketplace_v2" /* sequence_marketplace_v2 */ && currencies && currencies[0]?.contractAddress === zeroAddress;
|
|
1798
1850
|
return /* @__PURE__ */ jsx17(Fragment, { children: /* @__PURE__ */ jsxs10(
|
|
1799
1851
|
ActionModal,
|
|
1800
1852
|
{
|
|
@@ -1820,7 +1872,7 @@ var Modal2 = observer7(() => {
|
|
|
1820
1872
|
collectionAddress,
|
|
1821
1873
|
$price: makeOfferModal$.offerPrice,
|
|
1822
1874
|
onPriceChange: () => makeOfferModal$.offerPriceChanged.set(true),
|
|
1823
|
-
|
|
1875
|
+
includeNativeCurrency: false,
|
|
1824
1876
|
checkBalance: {
|
|
1825
1877
|
enabled: true,
|
|
1826
1878
|
callback: (state2) => setInsufficientBalance(state2)
|
|
@@ -1845,8 +1897,7 @@ var Modal2 = observer7(() => {
|
|
|
1845
1897
|
price: offerPrice
|
|
1846
1898
|
}
|
|
1847
1899
|
),
|
|
1848
|
-
/* @__PURE__ */ jsx17(expirationDateSelect_default, { $date: makeOfferModal$.expiry })
|
|
1849
|
-
invalidCurrency && /* @__PURE__ */ jsx17(Box12, { color: "negative", fontSize: "small", children: "Native currency offers are not supported on this marketplace. Please select another currency to continue" })
|
|
1900
|
+
/* @__PURE__ */ jsx17(expirationDateSelect_default, { $date: makeOfferModal$.expiry })
|
|
1850
1901
|
]
|
|
1851
1902
|
}
|
|
1852
1903
|
) });
|
|
@@ -1857,8 +1908,8 @@ import { Show as Show2, observer as observer8 } from "@legendapp/state/react";
|
|
|
1857
1908
|
import { parseUnits as parseUnits3 } from "viem";
|
|
1858
1909
|
|
|
1859
1910
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1860
|
-
import { Box as
|
|
1861
|
-
import { formatUnits as
|
|
1911
|
+
import { Box as Box12, Image as Image3, Skeleton as Skeleton6, Text as Text10 } from "@0xsequence/design-system";
|
|
1912
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
1862
1913
|
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1863
1914
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
1864
1915
|
function TransactionDetails({
|
|
@@ -1879,7 +1930,7 @@ function TransactionDetails({
|
|
|
1879
1930
|
collectibleId
|
|
1880
1931
|
});
|
|
1881
1932
|
const priceLoading = !price || marketplaceConfigLoading || royaltyPercentageLoading;
|
|
1882
|
-
let formattedAmount = price &&
|
|
1933
|
+
let formattedAmount = price && formatUnits3(BigInt(price.amountRaw), price.currency.decimals);
|
|
1883
1934
|
if (royaltyPercentage !== void 0 && formattedAmount && price) {
|
|
1884
1935
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * Number(royaltyPercentage) / 100).toFixed(price.currency.decimals);
|
|
1885
1936
|
}
|
|
@@ -1887,7 +1938,7 @@ function TransactionDetails({
|
|
|
1887
1938
|
formattedAmount = (Number.parseFloat(formattedAmount) - Number.parseFloat(formattedAmount) * marketplaceFeePercentage / 100).toFixed(price.currency.decimals);
|
|
1888
1939
|
}
|
|
1889
1940
|
return /* @__PURE__ */ jsxs11(
|
|
1890
|
-
|
|
1941
|
+
Box12,
|
|
1891
1942
|
{
|
|
1892
1943
|
width: "full",
|
|
1893
1944
|
display: "flex",
|
|
@@ -1895,7 +1946,7 @@ function TransactionDetails({
|
|
|
1895
1946
|
alignItems: "center",
|
|
1896
1947
|
children: [
|
|
1897
1948
|
/* @__PURE__ */ jsx18(Text10, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
|
|
1898
|
-
/* @__PURE__ */ jsxs11(
|
|
1949
|
+
/* @__PURE__ */ jsxs11(Box12, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
1899
1950
|
/* @__PURE__ */ jsx18(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
1900
1951
|
priceLoading ? /* @__PURE__ */ jsx18(Skeleton6, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs11(Text10, { fontSize: "small", color: "text100", fontFamily: "body", children: [
|
|
1901
1952
|
showPlaceholderPrice ? "0" : formattedAmount,
|
|
@@ -1909,7 +1960,7 @@ function TransactionDetails({
|
|
|
1909
1960
|
}
|
|
1910
1961
|
|
|
1911
1962
|
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
1912
|
-
import { Box as
|
|
1963
|
+
import { Box as Box13, Image as Image4, Skeleton as Skeleton7, Text as Text11 } from "@0xsequence/design-system";
|
|
1913
1964
|
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
1914
1965
|
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1915
1966
|
function TransactionHeader({
|
|
@@ -1917,7 +1968,7 @@ function TransactionHeader({
|
|
|
1917
1968
|
currencyImageUrl,
|
|
1918
1969
|
date
|
|
1919
1970
|
}) {
|
|
1920
|
-
return /* @__PURE__ */ jsxs12(
|
|
1971
|
+
return /* @__PURE__ */ jsxs12(Box13, { display: "flex", alignItems: "center", width: "full", children: [
|
|
1921
1972
|
/* @__PURE__ */ jsx19(
|
|
1922
1973
|
Text11,
|
|
1923
1974
|
{
|
|
@@ -2073,7 +2124,6 @@ var useTransactionSteps2 = ({
|
|
|
2073
2124
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
2074
2125
|
const sdkConfig = useConfig();
|
|
2075
2126
|
const marketplaceClient = getMarketplaceClient(chainId, sdkConfig);
|
|
2076
|
-
const { waitForReceipt } = useGetReceiptFromHash();
|
|
2077
2127
|
const { amount, receiver } = useFees({
|
|
2078
2128
|
chainId: Number(chainId),
|
|
2079
2129
|
collectionAddress
|
|
@@ -2108,7 +2158,6 @@ var useTransactionSteps2 = ({
|
|
|
2108
2158
|
} else {
|
|
2109
2159
|
console.debug("onError callback not provided:", error);
|
|
2110
2160
|
}
|
|
2111
|
-
throw error;
|
|
2112
2161
|
}
|
|
2113
2162
|
};
|
|
2114
2163
|
const executeApproval = async () => {
|
|
@@ -2122,14 +2171,11 @@ var useTransactionSteps2 = ({
|
|
|
2122
2171
|
Number(chainId),
|
|
2123
2172
|
approvalStep
|
|
2124
2173
|
);
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
steps$.approval.exist.set(false);
|
|
2129
|
-
}
|
|
2174
|
+
await wallet.handleConfirmTransactionStep(hash, Number(chainId));
|
|
2175
|
+
steps$.approval.isExecuting.set(false);
|
|
2176
|
+
steps$.approval.exist.set(false);
|
|
2130
2177
|
} catch (error) {
|
|
2131
2178
|
steps$.approval.isExecuting.set(false);
|
|
2132
|
-
throw error;
|
|
2133
2179
|
}
|
|
2134
2180
|
};
|
|
2135
2181
|
const sell = async () => {
|
|
@@ -2161,22 +2207,17 @@ var useTransactionSteps2 = ({
|
|
|
2161
2207
|
collectibleId,
|
|
2162
2208
|
hash,
|
|
2163
2209
|
orderId,
|
|
2164
|
-
callbacks
|
|
2210
|
+
callbacks,
|
|
2211
|
+
queriesToInvalidate: [balanceQueries.all, collectableKeys.userBalances]
|
|
2165
2212
|
});
|
|
2166
2213
|
if (hash) {
|
|
2167
|
-
await
|
|
2214
|
+
await wallet.handleConfirmTransactionStep(hash, Number(chainId));
|
|
2168
2215
|
steps$.transaction.isExecuting.set(false);
|
|
2169
2216
|
steps$.transaction.exist.set(false);
|
|
2170
|
-
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
2171
|
-
callbacks.onSuccess({ hash });
|
|
2172
|
-
}
|
|
2173
2217
|
}
|
|
2174
2218
|
if (orderId) {
|
|
2175
2219
|
steps$.transaction.isExecuting.set(false);
|
|
2176
2220
|
steps$.transaction.exist.set(false);
|
|
2177
|
-
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
2178
|
-
callbacks.onSuccess({ orderId });
|
|
2179
|
-
}
|
|
2180
2221
|
}
|
|
2181
2222
|
} catch (error) {
|
|
2182
2223
|
steps$.transaction.isExecuting.set(false);
|
|
@@ -2184,7 +2225,6 @@ var useTransactionSteps2 = ({
|
|
|
2184
2225
|
if (callbacks?.onError && typeof callbacks.onError === "function") {
|
|
2185
2226
|
callbacks.onError(error);
|
|
2186
2227
|
}
|
|
2187
|
-
throw error;
|
|
2188
2228
|
}
|
|
2189
2229
|
};
|
|
2190
2230
|
const executeTransaction = async ({
|
|
@@ -2390,7 +2430,7 @@ var Modal3 = observer8(() => {
|
|
|
2390
2430
|
|
|
2391
2431
|
// src/react/ui/modals/SuccessfulPurchaseModal/index.tsx
|
|
2392
2432
|
import {
|
|
2393
|
-
Box as
|
|
2433
|
+
Box as Box14,
|
|
2394
2434
|
Button as Button3,
|
|
2395
2435
|
CloseIcon as CloseIcon2,
|
|
2396
2436
|
ExternalLinkIcon,
|
|
@@ -2455,7 +2495,7 @@ var SuccessfulPurchaseModal = observer9(() => {
|
|
|
2455
2495
|
return /* @__PURE__ */ jsx21(Root3, { open: successfulPurchaseModal$.isOpen.get(), children: /* @__PURE__ */ jsxs14(Portal3, { children: [
|
|
2456
2496
|
/* @__PURE__ */ jsx21(Overlay2, { className: dialogOverlay }),
|
|
2457
2497
|
/* @__PURE__ */ jsxs14(Content3, { className: dialogContent.narrow, children: [
|
|
2458
|
-
/* @__PURE__ */ jsxs14(
|
|
2498
|
+
/* @__PURE__ */ jsxs14(Box14, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
|
|
2459
2499
|
/* @__PURE__ */ jsx21(
|
|
2460
2500
|
Text12,
|
|
2461
2501
|
{
|
|
@@ -2472,7 +2512,7 @@ var SuccessfulPurchaseModal = observer9(() => {
|
|
|
2472
2512
|
collectibles: successfulPurchaseModal$.state.get().collectibles
|
|
2473
2513
|
}
|
|
2474
2514
|
),
|
|
2475
|
-
/* @__PURE__ */ jsxs14(
|
|
2515
|
+
/* @__PURE__ */ jsxs14(Box14, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
2476
2516
|
/* @__PURE__ */ jsx21(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
|
|
2477
2517
|
/* @__PURE__ */ jsx21(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
|
|
2478
2518
|
/* @__PURE__ */ jsx21(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
|
|
@@ -2495,7 +2535,7 @@ var SuccessfulPurchaseModal = observer9(() => {
|
|
|
2495
2535
|
] }) });
|
|
2496
2536
|
});
|
|
2497
2537
|
function SuccessfulPurchaseActions() {
|
|
2498
|
-
return /* @__PURE__ */ jsxs14(
|
|
2538
|
+
return /* @__PURE__ */ jsxs14(Box14, { display: "flex", flexDirection: "column", gap: "2", children: [
|
|
2499
2539
|
successfulPurchaseModal$.state.ctaOptions.get() && /* @__PURE__ */ jsx21(
|
|
2500
2540
|
Button3,
|
|
2501
2541
|
{
|
|
@@ -2524,10 +2564,10 @@ function SuccessfulPurchaseActions() {
|
|
|
2524
2564
|
function CollectiblesGrid({ collectibles }) {
|
|
2525
2565
|
const total = collectibles.length;
|
|
2526
2566
|
const shownCollectibles = total > 4 ? collectibles.slice(0, 4) : collectibles;
|
|
2527
|
-
return /* @__PURE__ */ jsx21(
|
|
2567
|
+
return /* @__PURE__ */ jsx21(Box14, { className: collectiblesGrid, display: "grid", gap: "2", children: shownCollectibles.map((collectible) => {
|
|
2528
2568
|
const showPlus = total > 4 && collectibles.indexOf(collectible) === 3;
|
|
2529
2569
|
return /* @__PURE__ */ jsxs14(
|
|
2530
|
-
|
|
2570
|
+
Box14,
|
|
2531
2571
|
{
|
|
2532
2572
|
className: collectiblesGridItem,
|
|
2533
2573
|
position: "relative",
|
|
@@ -2544,7 +2584,7 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2544
2584
|
}
|
|
2545
2585
|
),
|
|
2546
2586
|
showPlus && /* @__PURE__ */ jsx21(
|
|
2547
|
-
|
|
2587
|
+
Box14,
|
|
2548
2588
|
{
|
|
2549
2589
|
position: "absolute",
|
|
2550
2590
|
top: "0",
|
|
@@ -2629,7 +2669,7 @@ var initialState5 = {
|
|
|
2629
2669
|
var transferModal$ = observable6(initialState5);
|
|
2630
2670
|
|
|
2631
2671
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2632
|
-
import { Box as
|
|
2672
|
+
import { Box as Box15, Button as Button4, Text as Text13, TextInput } from "@0xsequence/design-system";
|
|
2633
2673
|
import { observable as observable7 } from "@legendapp/state";
|
|
2634
2674
|
import { isAddress } from "viem";
|
|
2635
2675
|
import { useAccount as useAccount3 } from "wagmi";
|
|
@@ -2656,58 +2696,44 @@ var useHandleTransfer = () => {
|
|
|
2656
2696
|
} = transferModal$.state.get();
|
|
2657
2697
|
const { transferTokensAsync } = useTransferTokens();
|
|
2658
2698
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
2699
|
+
const getHash = async () => {
|
|
2700
|
+
if (collectionType === "ERC721" /* ERC721 */) {
|
|
2701
|
+
return await transferTokensAsync({
|
|
2702
|
+
receiverAddress,
|
|
2703
|
+
collectionAddress,
|
|
2704
|
+
tokenId: collectibleId,
|
|
2705
|
+
chainId,
|
|
2706
|
+
contractType: "ERC721" /* ERC721 */
|
|
2707
|
+
});
|
|
2708
|
+
}
|
|
2709
|
+
return await transferTokensAsync({
|
|
2710
|
+
receiverAddress,
|
|
2711
|
+
collectionAddress,
|
|
2712
|
+
tokenId: collectibleId,
|
|
2713
|
+
chainId,
|
|
2714
|
+
contractType: "ERC1155" /* ERC1155 */,
|
|
2715
|
+
quantity: String(quantity)
|
|
2716
|
+
});
|
|
2717
|
+
};
|
|
2659
2718
|
async function transfer() {
|
|
2660
2719
|
if (collectionType !== "ERC721" /* ERC721 */ && collectionType !== "ERC1155" /* ERC1155 */) {
|
|
2661
2720
|
throw new InvalidContractTypeError(collectionType);
|
|
2662
2721
|
}
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
price: void 0,
|
|
2679
|
-
type: "TRANSFER" /* TRANSFER */,
|
|
2680
|
-
queriesToInvalidate: balanceQueries.all
|
|
2681
|
-
});
|
|
2682
|
-
} catch (error) {
|
|
2683
|
-
transferModal$.view.set("enterReceiverAddress");
|
|
2684
|
-
callbacks?.onError?.(error);
|
|
2685
|
-
}
|
|
2686
|
-
}
|
|
2687
|
-
if (collectionType === "ERC1155" /* ERC1155 */) {
|
|
2688
|
-
try {
|
|
2689
|
-
const hash = await transferTokensAsync({
|
|
2690
|
-
receiverAddress,
|
|
2691
|
-
collectionAddress,
|
|
2692
|
-
tokenId: collectibleId,
|
|
2693
|
-
chainId,
|
|
2694
|
-
contractType: "ERC1155" /* ERC1155 */,
|
|
2695
|
-
quantity: String(quantity)
|
|
2696
|
-
});
|
|
2697
|
-
transferModal$.close();
|
|
2698
|
-
showTransactionStatusModal({
|
|
2699
|
-
hash,
|
|
2700
|
-
collectionAddress,
|
|
2701
|
-
chainId,
|
|
2702
|
-
collectibleId,
|
|
2703
|
-
price: void 0,
|
|
2704
|
-
type: "TRANSFER" /* TRANSFER */,
|
|
2705
|
-
queriesToInvalidate: balanceQueries.all
|
|
2706
|
-
});
|
|
2707
|
-
} catch (error) {
|
|
2708
|
-
transferModal$.view.set("enterReceiverAddress");
|
|
2709
|
-
callbacks?.onError?.(error);
|
|
2710
|
-
}
|
|
2722
|
+
try {
|
|
2723
|
+
const hash = await getHash();
|
|
2724
|
+
transferModal$.close();
|
|
2725
|
+
showTransactionStatusModal({
|
|
2726
|
+
hash,
|
|
2727
|
+
collectionAddress,
|
|
2728
|
+
chainId,
|
|
2729
|
+
collectibleId,
|
|
2730
|
+
price: void 0,
|
|
2731
|
+
type: "TRANSFER" /* TRANSFER */,
|
|
2732
|
+
queriesToInvalidate: [balanceQueries.all, collectableKeys.userBalances]
|
|
2733
|
+
});
|
|
2734
|
+
} catch (error) {
|
|
2735
|
+
transferModal$.view.set("enterReceiverAddress");
|
|
2736
|
+
callbacks?.onError?.(error);
|
|
2711
2737
|
}
|
|
2712
2738
|
}
|
|
2713
2739
|
return { transfer };
|
|
@@ -2748,9 +2774,9 @@ var EnterWalletAddressView = () => {
|
|
|
2748
2774
|
transfer();
|
|
2749
2775
|
transferModal$.view.set("followWalletInstructions");
|
|
2750
2776
|
}
|
|
2751
|
-
return /* @__PURE__ */ jsxs15(
|
|
2777
|
+
return /* @__PURE__ */ jsxs15(Box15, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2752
2778
|
/* @__PURE__ */ jsx22(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2753
|
-
/* @__PURE__ */ jsxs15(
|
|
2779
|
+
/* @__PURE__ */ jsxs15(Box15, { display: "flex", flexDirection: "column", gap: "3", children: [
|
|
2754
2780
|
/* @__PURE__ */ jsx22(
|
|
2755
2781
|
AlertMessage,
|
|
2756
2782
|
{
|
|
@@ -2810,13 +2836,13 @@ var EnterWalletAddressView = () => {
|
|
|
2810
2836
|
var enterWalletAddress_default = EnterWalletAddressView;
|
|
2811
2837
|
|
|
2812
2838
|
// src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
|
|
2813
|
-
import { Box as
|
|
2839
|
+
import { Box as Box16, Button as Button5, Text as Text14 } from "@0xsequence/design-system";
|
|
2814
2840
|
import { observer as observer10 } from "@legendapp/state/react";
|
|
2815
2841
|
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2816
2842
|
var FollowWalletInstructionsView = observer10(() => {
|
|
2817
|
-
return /* @__PURE__ */ jsxs16(
|
|
2843
|
+
return /* @__PURE__ */ jsxs16(Box16, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2818
2844
|
/* @__PURE__ */ jsx23(Text14, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2819
|
-
/* @__PURE__ */ jsx23(
|
|
2845
|
+
/* @__PURE__ */ jsx23(Box16, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx23(
|
|
2820
2846
|
AlertMessage,
|
|
2821
2847
|
{
|
|
2822
2848
|
message: getMessage("followWalletInstructions"),
|
|
@@ -2904,7 +2930,7 @@ var TransactionModalView = observer11(() => {
|
|
|
2904
2930
|
});
|
|
2905
2931
|
|
|
2906
2932
|
// src/react/ui/modals/CreateListingModal/Modal.tsx
|
|
2907
|
-
import { Box as
|
|
2933
|
+
import { Box as Box17 } from "@0xsequence/design-system";
|
|
2908
2934
|
import { Show as Show4, observer as observer12 } from "@legendapp/state/react";
|
|
2909
2935
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2910
2936
|
import { useAccount as useAccount5 } from "wagmi";
|
|
@@ -2964,7 +2990,7 @@ var createListingModal$ = observable8({
|
|
|
2964
2990
|
import { useEffect as useEffect8 } from "react";
|
|
2965
2991
|
|
|
2966
2992
|
// src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts
|
|
2967
|
-
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
2993
|
+
import { skipToken as skipToken2, useQuery as useQuery3 } from "@tanstack/react-query";
|
|
2968
2994
|
var ONE_DAY_IN_SECONDS2 = 60 * 60 * 24;
|
|
2969
2995
|
var useGetTokenApprovalData3 = (params) => {
|
|
2970
2996
|
const config = useConfig();
|
|
@@ -2977,9 +3003,10 @@ var useGetTokenApprovalData3 = (params) => {
|
|
|
2977
3003
|
pricePerToken: "100000",
|
|
2978
3004
|
expiry: String(Number(dateToUnixTime(/* @__PURE__ */ new Date())) + ONE_DAY_IN_SECONDS2)
|
|
2979
3005
|
};
|
|
3006
|
+
const isEnabled = wallet && params.query?.enabled !== false;
|
|
2980
3007
|
const { data, isLoading, isSuccess } = useQuery3({
|
|
2981
3008
|
queryKey: ["token-approval-data", params.currencyAddress],
|
|
2982
|
-
queryFn: async () => {
|
|
3009
|
+
queryFn: isEnabled ? async () => {
|
|
2983
3010
|
const args = {
|
|
2984
3011
|
collectionAddress: params.collectionAddress,
|
|
2985
3012
|
owner: await wallet.address(),
|
|
@@ -3000,7 +3027,7 @@ var useGetTokenApprovalData3 = (params) => {
|
|
|
3000
3027
|
return {
|
|
3001
3028
|
step: tokenApprovalStep
|
|
3002
3029
|
};
|
|
3003
|
-
}
|
|
3030
|
+
} : skipToken2
|
|
3004
3031
|
});
|
|
3005
3032
|
return {
|
|
3006
3033
|
data,
|
|
@@ -3014,7 +3041,7 @@ var useTransactionSteps3 = ({
|
|
|
3014
3041
|
listingInput,
|
|
3015
3042
|
chainId,
|
|
3016
3043
|
collectionAddress,
|
|
3017
|
-
orderbookKind
|
|
3044
|
+
orderbookKind,
|
|
3018
3045
|
callbacks,
|
|
3019
3046
|
closeMainModal,
|
|
3020
3047
|
steps$
|
|
@@ -3024,7 +3051,6 @@ var useTransactionSteps3 = ({
|
|
|
3024
3051
|
const { show: showTransactionStatusModal } = useTransactionStatusModal();
|
|
3025
3052
|
const sdkConfig = useConfig();
|
|
3026
3053
|
const marketplaceClient = getMarketplaceClient(chainId, sdkConfig);
|
|
3027
|
-
const { waitForReceipt } = useGetReceiptFromHash();
|
|
3028
3054
|
const { generateListingTransactionAsync, isPending: generatingSteps } = useGenerateListingTransaction({
|
|
3029
3055
|
chainId,
|
|
3030
3056
|
onSuccess: (steps) => {
|
|
@@ -3053,7 +3079,6 @@ var useTransactionSteps3 = ({
|
|
|
3053
3079
|
} else {
|
|
3054
3080
|
console.debug("onError callback not provided:", error);
|
|
3055
3081
|
}
|
|
3056
|
-
throw error;
|
|
3057
3082
|
}
|
|
3058
3083
|
};
|
|
3059
3084
|
const executeApproval = async () => {
|
|
@@ -3067,14 +3092,11 @@ var useTransactionSteps3 = ({
|
|
|
3067
3092
|
Number(chainId),
|
|
3068
3093
|
approvalStep
|
|
3069
3094
|
);
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
steps$.approval.exist.set(false);
|
|
3074
|
-
}
|
|
3095
|
+
await wallet.handleConfirmTransactionStep(hash, Number(chainId));
|
|
3096
|
+
steps$.approval.isExecuting.set(false);
|
|
3097
|
+
steps$.approval.exist.set(false);
|
|
3075
3098
|
} catch (error) {
|
|
3076
3099
|
steps$.approval.isExecuting.set(false);
|
|
3077
|
-
throw error;
|
|
3078
3100
|
}
|
|
3079
3101
|
};
|
|
3080
3102
|
const createListing = async () => {
|
|
@@ -3108,22 +3130,23 @@ var useTransactionSteps3 = ({
|
|
|
3108
3130
|
collectibleId: listingInput.listing.tokenId,
|
|
3109
3131
|
hash,
|
|
3110
3132
|
orderId,
|
|
3111
|
-
callbacks
|
|
3133
|
+
callbacks,
|
|
3134
|
+
queriesToInvalidate: [
|
|
3135
|
+
balanceQueries.all,
|
|
3136
|
+
collectableKeys.lowestListings,
|
|
3137
|
+
collectableKeys.listings,
|
|
3138
|
+
collectableKeys.listingsCount,
|
|
3139
|
+
collectableKeys.userBalances
|
|
3140
|
+
]
|
|
3112
3141
|
});
|
|
3113
3142
|
if (hash) {
|
|
3114
|
-
await
|
|
3143
|
+
await wallet.handleConfirmTransactionStep(hash, Number(chainId));
|
|
3115
3144
|
steps$.transaction.isExecuting.set(false);
|
|
3116
3145
|
steps$.transaction.exist.set(false);
|
|
3117
|
-
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
3118
|
-
callbacks.onSuccess({ hash });
|
|
3119
|
-
}
|
|
3120
3146
|
}
|
|
3121
3147
|
if (orderId) {
|
|
3122
3148
|
steps$.transaction.isExecuting.set(false);
|
|
3123
3149
|
steps$.transaction.exist.set(false);
|
|
3124
|
-
if (callbacks?.onSuccess && typeof callbacks.onSuccess === "function") {
|
|
3125
|
-
callbacks.onSuccess({ orderId });
|
|
3126
|
-
}
|
|
3127
3150
|
}
|
|
3128
3151
|
} catch (error) {
|
|
3129
3152
|
steps$.transaction.isExecuting.set(false);
|
|
@@ -3131,7 +3154,6 @@ var useTransactionSteps3 = ({
|
|
|
3131
3154
|
if (callbacks?.onError && typeof callbacks.onError === "function") {
|
|
3132
3155
|
callbacks.onError(error);
|
|
3133
3156
|
}
|
|
3134
|
-
throw error;
|
|
3135
3157
|
}
|
|
3136
3158
|
};
|
|
3137
3159
|
const executeTransaction = async ({
|
|
@@ -3170,18 +3192,26 @@ var useCreateListing = ({
|
|
|
3170
3192
|
listingInput,
|
|
3171
3193
|
chainId,
|
|
3172
3194
|
collectionAddress,
|
|
3173
|
-
orderbookKind
|
|
3195
|
+
orderbookKind,
|
|
3174
3196
|
steps$,
|
|
3175
3197
|
callbacks,
|
|
3176
3198
|
closeMainModal
|
|
3177
3199
|
}) => {
|
|
3200
|
+
const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
|
|
3201
|
+
const collectionConfig = marketplaceConfig?.collections.find(
|
|
3202
|
+
(c) => c.collectionAddress === collectionAddress
|
|
3203
|
+
);
|
|
3204
|
+
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
|
|
3178
3205
|
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData3({
|
|
3179
3206
|
chainId,
|
|
3180
3207
|
tokenId: listingInput.listing.tokenId,
|
|
3181
3208
|
collectionAddress,
|
|
3182
3209
|
currencyAddress: listingInput.listing.currencyAddress,
|
|
3183
3210
|
contractType: listingInput.contractType,
|
|
3184
|
-
orderbook: orderbookKind
|
|
3211
|
+
orderbook: orderbookKind,
|
|
3212
|
+
query: {
|
|
3213
|
+
enabled: !marketplaceIsLoading
|
|
3214
|
+
}
|
|
3185
3215
|
});
|
|
3186
3216
|
useEffect8(() => {
|
|
3187
3217
|
if (tokenApproval?.step && !tokenApprovalIsLoading) {
|
|
@@ -3323,7 +3353,7 @@ var Modal5 = observer12(() => {
|
|
|
3323
3353
|
chainId
|
|
3324
3354
|
}
|
|
3325
3355
|
),
|
|
3326
|
-
/* @__PURE__ */ jsxs18(
|
|
3356
|
+
/* @__PURE__ */ jsxs18(Box17, { display: "flex", flexDirection: "column", width: "full", gap: "1", children: [
|
|
3327
3357
|
/* @__PURE__ */ jsx25(
|
|
3328
3358
|
priceInput_default,
|
|
3329
3359
|
{
|
|
@@ -3368,7 +3398,7 @@ var Modal5 = observer12(() => {
|
|
|
3368
3398
|
});
|
|
3369
3399
|
|
|
3370
3400
|
// src/react/ui/modals/BuyModal/Modal.tsx
|
|
3371
|
-
import { use$
|
|
3401
|
+
import { use$ } from "@legendapp/state/react";
|
|
3372
3402
|
|
|
3373
3403
|
// src/react/ui/modals/BuyModal/store.ts
|
|
3374
3404
|
import { observable as observable9 } from "@legendapp/state";
|
|
@@ -3383,7 +3413,9 @@ var initialState7 = {
|
|
|
3383
3413
|
quantity: args.order.quantityAvailableFormatted,
|
|
3384
3414
|
order: args.order,
|
|
3385
3415
|
modalId: buyModal$.state.modalId.get() + 1,
|
|
3386
|
-
invalidQuantity: false
|
|
3416
|
+
invalidQuantity: false,
|
|
3417
|
+
checkoutModalIsLoading: false,
|
|
3418
|
+
checkoutModalLoaded: false
|
|
3387
3419
|
});
|
|
3388
3420
|
buyModal$.callbacks.set(callbacks || defaultCallbacks);
|
|
3389
3421
|
buyModal$.isOpen.set(true);
|
|
@@ -3395,7 +3427,15 @@ var initialState7 = {
|
|
|
3395
3427
|
order: void 0,
|
|
3396
3428
|
quantity: "1",
|
|
3397
3429
|
modalId: 0,
|
|
3398
|
-
invalidQuantity: false
|
|
3430
|
+
invalidQuantity: false,
|
|
3431
|
+
checkoutModalIsLoading: false,
|
|
3432
|
+
checkoutModalLoaded: false
|
|
3433
|
+
},
|
|
3434
|
+
setCheckoutModalIsLoading: (isLoading) => {
|
|
3435
|
+
buyModal$.state.checkoutModalIsLoading.set(isLoading);
|
|
3436
|
+
},
|
|
3437
|
+
setCheckoutModalLoaded: (isLoaded) => {
|
|
3438
|
+
buyModal$.state.checkoutModalLoaded.set(isLoaded);
|
|
3399
3439
|
},
|
|
3400
3440
|
callbacks: void 0
|
|
3401
3441
|
};
|
|
@@ -3420,15 +3460,12 @@ function CheckoutModal({ buy, collectable, order }) {
|
|
|
3420
3460
|
}
|
|
3421
3461
|
|
|
3422
3462
|
// src/react/ui/modals/BuyModal/modals/Modal1155.tsx
|
|
3423
|
-
import { Box as
|
|
3463
|
+
import { Box as Box18, Text as Text15, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
3424
3464
|
import { observer as observer13 } from "@legendapp/state/react";
|
|
3425
|
-
import { formatUnits as
|
|
3465
|
+
import { formatUnits as formatUnits4, parseUnits as parseUnits6 } from "viem";
|
|
3426
3466
|
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3427
3467
|
var ERC1155QuantityModal = observer13(
|
|
3428
3468
|
({ buy, collectable, order }) => {
|
|
3429
|
-
buyModal$.state.quantity.set(
|
|
3430
|
-
Math.min(Number(order.quantityRemaining), 1).toString()
|
|
3431
|
-
);
|
|
3432
3469
|
const currencyOptions = useCurrencyOptions({
|
|
3433
3470
|
collectionAddress: order.collectionContractAddress
|
|
3434
3471
|
});
|
|
@@ -3442,6 +3479,9 @@ var ERC1155QuantityModal = observer13(
|
|
|
3442
3479
|
const quantity = Number(buyModal$.state.quantity.get());
|
|
3443
3480
|
const pricePerToken = order.priceAmount;
|
|
3444
3481
|
const totalPrice = (BigInt(quantity) * BigInt(pricePerToken)).toString();
|
|
3482
|
+
if (buyModal$.state.checkoutModalLoaded.get()) {
|
|
3483
|
+
return null;
|
|
3484
|
+
}
|
|
3445
3485
|
return /* @__PURE__ */ jsx26(
|
|
3446
3486
|
ActionModal,
|
|
3447
3487
|
{
|
|
@@ -3453,6 +3493,7 @@ var ERC1155QuantityModal = observer13(
|
|
|
3453
3493
|
{
|
|
3454
3494
|
label: "Buy now",
|
|
3455
3495
|
onClick: () => {
|
|
3496
|
+
buyModal$.state.checkoutModalIsLoading.set(true);
|
|
3456
3497
|
buy({
|
|
3457
3498
|
quantity: parseUnits6(
|
|
3458
3499
|
buyModal$.state.quantity.get(),
|
|
@@ -3462,10 +3503,12 @@ var ERC1155QuantityModal = observer13(
|
|
|
3462
3503
|
collectableDecimals: collectable.decimals || 0,
|
|
3463
3504
|
marketplace: order.marketplace
|
|
3464
3505
|
});
|
|
3465
|
-
}
|
|
3506
|
+
},
|
|
3507
|
+
disabled: buyModal$.state.checkoutModalIsLoading.get(),
|
|
3508
|
+
pending: buyModal$.state.checkoutModalIsLoading.get()
|
|
3466
3509
|
}
|
|
3467
3510
|
],
|
|
3468
|
-
children: /* @__PURE__ */ jsxs19(
|
|
3511
|
+
children: /* @__PURE__ */ jsxs19(Box18, { display: "flex", flexDirection: "column", gap: "4", children: [
|
|
3469
3512
|
/* @__PURE__ */ jsx26(
|
|
3470
3513
|
QuantityInput,
|
|
3471
3514
|
{
|
|
@@ -3475,11 +3518,11 @@ var ERC1155QuantityModal = observer13(
|
|
|
3475
3518
|
maxQuantity: order.quantityRemaining
|
|
3476
3519
|
}
|
|
3477
3520
|
),
|
|
3478
|
-
/* @__PURE__ */ jsxs19(
|
|
3521
|
+
/* @__PURE__ */ jsxs19(Box18, { display: "flex", justifyContent: "space-between", children: [
|
|
3479
3522
|
/* @__PURE__ */ jsx26(Text15, { color: "text50", fontSize: "small", children: "Total Price" }),
|
|
3480
|
-
/* @__PURE__ */ jsxs19(
|
|
3523
|
+
/* @__PURE__ */ jsxs19(Box18, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
3481
3524
|
/* @__PURE__ */ jsx26(TokenImage2, { src: currency?.imageUrl, size: "xs" }),
|
|
3482
|
-
/* @__PURE__ */ jsx26(Text15, { color: "text100", fontSize: "small", fontWeight: "bold", children:
|
|
3525
|
+
/* @__PURE__ */ jsx26(Text15, { color: "text100", fontSize: "small", fontWeight: "bold", children: formatUnits4(BigInt(totalPrice), currency?.decimals || 0) })
|
|
3483
3526
|
] })
|
|
3484
3527
|
] })
|
|
3485
3528
|
] })
|
|
@@ -3574,7 +3617,9 @@ var useBuyCollectable = ({
|
|
|
3574
3617
|
collectionAddress,
|
|
3575
3618
|
tokenId,
|
|
3576
3619
|
callbacks,
|
|
3577
|
-
priceCurrencyAddress
|
|
3620
|
+
priceCurrencyAddress,
|
|
3621
|
+
setCheckoutModalIsLoading,
|
|
3622
|
+
setCheckoutModalLoaded
|
|
3578
3623
|
}) => {
|
|
3579
3624
|
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
3580
3625
|
const config = useConfig();
|
|
@@ -3587,6 +3632,12 @@ var useBuyCollectable = ({
|
|
|
3587
3632
|
if (isError || !wallet) {
|
|
3588
3633
|
return { status: "error", buy: null, isLoading, isError: true };
|
|
3589
3634
|
}
|
|
3635
|
+
const invalidateQueries2 = async (queriesToInvalidate) => {
|
|
3636
|
+
const queryClient = getQueryClient();
|
|
3637
|
+
for (const queryKey of queriesToInvalidate) {
|
|
3638
|
+
await queryClient.invalidateQueries({ queryKey });
|
|
3639
|
+
}
|
|
3640
|
+
};
|
|
3590
3641
|
return {
|
|
3591
3642
|
status: "ready",
|
|
3592
3643
|
isLoading,
|
|
@@ -3605,6 +3656,8 @@ var useBuyCollectable = ({
|
|
|
3605
3656
|
additionalFees: [fees],
|
|
3606
3657
|
walletType: "unknown" /* unknown */
|
|
3607
3658
|
});
|
|
3659
|
+
setCheckoutModalLoaded(true);
|
|
3660
|
+
setCheckoutModalIsLoading(false);
|
|
3608
3661
|
const step = steps[0];
|
|
3609
3662
|
openSelectPaymentModal({
|
|
3610
3663
|
chain: chainId,
|
|
@@ -3624,10 +3677,18 @@ var useBuyCollectable = ({
|
|
|
3624
3677
|
enableMainCurrencyPayment: true,
|
|
3625
3678
|
enableSwapPayments: !!input.checkoutOptions.swap,
|
|
3626
3679
|
creditCardProviders: input.checkoutOptions.nftCheckout || [],
|
|
3627
|
-
onSuccess: (hash) =>
|
|
3680
|
+
onSuccess: (hash) => {
|
|
3681
|
+
invalidateQueries2([
|
|
3682
|
+
collectableKeys.listings,
|
|
3683
|
+
collectableKeys.listingsCount,
|
|
3684
|
+
collectableKeys.lists,
|
|
3685
|
+
collectableKeys.userBalances,
|
|
3686
|
+
balanceQueries.all
|
|
3687
|
+
]);
|
|
3688
|
+
callbacks?.onSuccess?.({ hash });
|
|
3689
|
+
},
|
|
3628
3690
|
onError: callbacks?.onError,
|
|
3629
3691
|
onClose: () => {
|
|
3630
|
-
console.log("onClose");
|
|
3631
3692
|
buyModal$.close();
|
|
3632
3693
|
}
|
|
3633
3694
|
});
|
|
@@ -3638,20 +3699,22 @@ var useBuyCollectable = ({
|
|
|
3638
3699
|
// src/react/ui/modals/BuyModal/Modal.tsx
|
|
3639
3700
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3640
3701
|
var BuyModal = () => {
|
|
3641
|
-
const isOpen = use$
|
|
3702
|
+
const isOpen = use$(buyModal$.isOpen);
|
|
3642
3703
|
if (!isOpen) return null;
|
|
3643
3704
|
return /* @__PURE__ */ jsx27(BuyModalContent, {});
|
|
3644
3705
|
};
|
|
3645
3706
|
var BuyModalContent = () => {
|
|
3646
|
-
const chainId = String(use$
|
|
3647
|
-
const collectionAddress = use$
|
|
3707
|
+
const chainId = String(use$(buyModal$.state.order.chainId));
|
|
3708
|
+
const collectionAddress = use$(
|
|
3648
3709
|
buyModal$.state.order.collectionContractAddress
|
|
3649
3710
|
);
|
|
3650
|
-
const collectibleId = use$
|
|
3651
|
-
const modalId = use$
|
|
3652
|
-
const callbacks = use$
|
|
3653
|
-
const order = use$
|
|
3654
|
-
const isOpen = use$
|
|
3711
|
+
const collectibleId = use$(buyModal$.state.order.tokenId);
|
|
3712
|
+
const modalId = use$(buyModal$.state.modalId);
|
|
3713
|
+
const callbacks = use$(buyModal$.callbacks);
|
|
3714
|
+
const order = use$(buyModal$.state.order);
|
|
3715
|
+
const isOpen = use$(buyModal$.isOpen);
|
|
3716
|
+
const setCheckoutModalIsLoading = use$(buyModal$.setCheckoutModalIsLoading);
|
|
3717
|
+
const setCheckoutModalLoaded = use$(buyModal$.setCheckoutModalLoaded);
|
|
3655
3718
|
const { collection, collectable, checkoutOptions, isLoading, isError } = useLoadData({
|
|
3656
3719
|
chainId: Number(chainId),
|
|
3657
3720
|
collectionAddress,
|
|
@@ -3668,7 +3731,9 @@ var BuyModalContent = () => {
|
|
|
3668
3731
|
collectionAddress,
|
|
3669
3732
|
callbacks,
|
|
3670
3733
|
tokenId: collectibleId,
|
|
3671
|
-
priceCurrencyAddress: order.priceCurrencyAddress
|
|
3734
|
+
priceCurrencyAddress: order.priceCurrencyAddress,
|
|
3735
|
+
setCheckoutModalIsLoading,
|
|
3736
|
+
setCheckoutModalLoaded
|
|
3672
3737
|
});
|
|
3673
3738
|
if (isLoading || !collection || !collectable || !checkoutOptions || buyIsLoading) {
|
|
3674
3739
|
return /* @__PURE__ */ jsx27(
|
|
@@ -3761,11 +3826,11 @@ var useBuyModal = (callbacks) => {
|
|
|
3761
3826
|
|
|
3762
3827
|
// src/react/ui/components/collectible-card/CollectibleCard.tsx
|
|
3763
3828
|
import { useState as useState8 } from "react";
|
|
3764
|
-
import { Box as
|
|
3829
|
+
import { Box as Box22, IconButton as IconButton6, Skeleton as Skeleton8 } from "@0xsequence/design-system";
|
|
3765
3830
|
import { useAccount as useAccount7 } from "wagmi";
|
|
3766
3831
|
|
|
3767
3832
|
// src/react/ui/icons/DiamondEye.tsx
|
|
3768
|
-
import { Box as
|
|
3833
|
+
import { Box as Box19 } from "@0xsequence/design-system";
|
|
3769
3834
|
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3770
3835
|
var Svg = () => /* @__PURE__ */ jsxs21(
|
|
3771
3836
|
"svg",
|
|
@@ -3792,7 +3857,7 @@ var Svg = () => /* @__PURE__ */ jsxs21(
|
|
|
3792
3857
|
}
|
|
3793
3858
|
);
|
|
3794
3859
|
var SvgDiamondEyeIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx29(
|
|
3795
|
-
|
|
3860
|
+
Box19,
|
|
3796
3861
|
{
|
|
3797
3862
|
as: Svg,
|
|
3798
3863
|
className: iconVariants({
|
|
@@ -3917,12 +3982,12 @@ function ActionButtonBody({ label, onClick }) {
|
|
|
3917
3982
|
}
|
|
3918
3983
|
|
|
3919
3984
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
3920
|
-
import { Box as
|
|
3921
|
-
import { formatUnits as
|
|
3985
|
+
import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as Text16 } from "@0xsequence/design-system";
|
|
3986
|
+
import { formatUnits as formatUnits5 } from "viem";
|
|
3922
3987
|
import { useAccount as useAccount6 } from "wagmi";
|
|
3923
3988
|
|
|
3924
3989
|
// src/react/ui/icons/Bell.tsx
|
|
3925
|
-
import { Box as
|
|
3990
|
+
import { Box as Box20 } from "@0xsequence/design-system";
|
|
3926
3991
|
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3927
3992
|
var Svg2 = () => /* @__PURE__ */ jsxs22(
|
|
3928
3993
|
"svg",
|
|
@@ -3949,7 +4014,7 @@ var Svg2 = () => /* @__PURE__ */ jsxs22(
|
|
|
3949
4014
|
}
|
|
3950
4015
|
);
|
|
3951
4016
|
var SvgBellIcon = ({ size = "sm", ...props }) => /* @__PURE__ */ jsx31(
|
|
3952
|
-
|
|
4017
|
+
Box20,
|
|
3953
4018
|
{
|
|
3954
4019
|
as: Svg2,
|
|
3955
4020
|
className: iconVariants({
|
|
@@ -3981,7 +4046,7 @@ var Footer = ({
|
|
|
3981
4046
|
name = `${name.substring(0, 17)}...`;
|
|
3982
4047
|
}
|
|
3983
4048
|
return /* @__PURE__ */ jsxs23(
|
|
3984
|
-
|
|
4049
|
+
Box21,
|
|
3985
4050
|
{
|
|
3986
4051
|
display: "flex",
|
|
3987
4052
|
flexDirection: "column",
|
|
@@ -3993,7 +4058,7 @@ var Footer = ({
|
|
|
3993
4058
|
className: !!address && isAnimated ? footer.animated : footer.static,
|
|
3994
4059
|
children: [
|
|
3995
4060
|
/* @__PURE__ */ jsxs23(
|
|
3996
|
-
|
|
4061
|
+
Box21,
|
|
3997
4062
|
{
|
|
3998
4063
|
display: "flex",
|
|
3999
4064
|
alignItems: "center",
|
|
@@ -4031,7 +4096,7 @@ var Footer = ({
|
|
|
4031
4096
|
]
|
|
4032
4097
|
}
|
|
4033
4098
|
),
|
|
4034
|
-
/* @__PURE__ */ jsxs23(
|
|
4099
|
+
/* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
4035
4100
|
listed && /* @__PURE__ */ jsx32(Image6, { src: lowestListingCurrency?.imageUrl, width: "3", height: "3" }),
|
|
4036
4101
|
/* @__PURE__ */ jsxs23(
|
|
4037
4102
|
Text16,
|
|
@@ -4042,7 +4107,7 @@ var Footer = ({
|
|
|
4042
4107
|
textAlign: "left",
|
|
4043
4108
|
fontFamily: "body",
|
|
4044
4109
|
children: [
|
|
4045
|
-
listed && `${
|
|
4110
|
+
listed && `${formatUnits5(
|
|
4046
4111
|
BigInt(lowestListingPriceAmount),
|
|
4047
4112
|
lowestListingCurrency.decimals
|
|
4048
4113
|
)} ${lowestListingCurrency.symbol}`,
|
|
@@ -4081,7 +4146,7 @@ var TokenTypeBalancePill = ({
|
|
|
4081
4146
|
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4082
4147
|
function CollectibleSkeleton() {
|
|
4083
4148
|
return /* @__PURE__ */ jsxs24(
|
|
4084
|
-
|
|
4149
|
+
Box22,
|
|
4085
4150
|
{
|
|
4086
4151
|
className: collectibleCard,
|
|
4087
4152
|
borderRadius: "md",
|
|
@@ -4096,7 +4161,7 @@ function CollectibleSkeleton() {
|
|
|
4096
4161
|
}
|
|
4097
4162
|
),
|
|
4098
4163
|
/* @__PURE__ */ jsxs24(
|
|
4099
|
-
|
|
4164
|
+
Box22,
|
|
4100
4165
|
{
|
|
4101
4166
|
display: "flex",
|
|
4102
4167
|
flexDirection: "column",
|
|
@@ -4147,14 +4212,14 @@ function CollectibleCard({
|
|
|
4147
4212
|
const image = collectibleMetadata?.image;
|
|
4148
4213
|
const externalUrl = collectibleMetadata?.external_url;
|
|
4149
4214
|
return /* @__PURE__ */ jsx33(
|
|
4150
|
-
|
|
4215
|
+
Box22,
|
|
4151
4216
|
{
|
|
4152
4217
|
className: collectibleCard,
|
|
4153
4218
|
borderRadius: "md",
|
|
4154
4219
|
overflow: "hidden",
|
|
4155
4220
|
background: "backgroundPrimary",
|
|
4156
4221
|
children: /* @__PURE__ */ jsx33(
|
|
4157
|
-
|
|
4222
|
+
Box22,
|
|
4158
4223
|
{
|
|
4159
4224
|
display: "flex",
|
|
4160
4225
|
flexDirection: "column",
|
|
@@ -4210,7 +4275,7 @@ function CollectibleCard({
|
|
|
4210
4275
|
}
|
|
4211
4276
|
),
|
|
4212
4277
|
accountAddress && (highestOffer || lowestListing) && /* @__PURE__ */ jsx33(
|
|
4213
|
-
|
|
4278
|
+
Box22,
|
|
4214
4279
|
{
|
|
4215
4280
|
display: "flex",
|
|
4216
4281
|
alignItems: "center",
|
|
@@ -4249,4 +4314,4 @@ export {
|
|
|
4249
4314
|
useBuyModal,
|
|
4250
4315
|
CollectibleCard
|
|
4251
4316
|
};
|
|
4252
|
-
//# sourceMappingURL=chunk-
|
|
4317
|
+
//# sourceMappingURL=chunk-2FOUCP2R.js.map
|