@0xsequence/marketplace-sdk 0.5.1 → 0.5.3
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/builder-types-wOwfTJpd.d.ts +73 -0
- package/dist/{chunk-FCF57DZI.js → chunk-7FN62HOP.js} +5 -9
- package/dist/chunk-7FN62HOP.js.map +1 -0
- package/dist/{chunk-F4E3WJ2K.js → chunk-BVXIRVEC.js} +261 -249
- package/dist/chunk-BVXIRVEC.js.map +1 -0
- package/dist/{chunk-XP3WY5AX.js → chunk-BZD2LDJJ.js} +2 -2
- package/dist/{chunk-XP3WY5AX.js.map → chunk-BZD2LDJJ.js.map} +1 -1
- package/dist/chunk-DZKPDV63.js +27 -0
- package/dist/chunk-DZKPDV63.js.map +1 -0
- package/dist/{chunk-I37CRQ4S.js → chunk-H5YWG6WN.js} +128 -88
- package/dist/chunk-H5YWG6WN.js.map +1 -0
- package/dist/{chunk-ZUEQGPLO.js → chunk-J6F5QOW5.js} +2 -2
- package/dist/{chunk-ZUEQGPLO.js.map → chunk-J6F5QOW5.js.map} +1 -1
- package/dist/{chunk-LJAB3S6U.js → chunk-TFRAOS7F.js} +22 -13
- package/dist/chunk-TFRAOS7F.js.map +1 -0
- package/dist/{chunk-5NORRVPM.js → chunk-UZIAX32Y.js} +1 -1
- package/dist/{chunk-5NORRVPM.js.map → chunk-UZIAX32Y.js.map} +1 -1
- package/dist/{chunk-MKGSGTQC.js → chunk-Y7YTLAO2.js} +3 -3
- package/dist/{create-config-BXvwUh55.d.ts → create-config-Bltg8Enl.d.ts} +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -6
- package/dist/react/_internal/index.d.ts +3 -3
- package/dist/react/_internal/index.js +1 -1
- package/dist/react/_internal/wagmi/index.d.ts +2 -3
- package/dist/react/_internal/wagmi/index.js +1 -1
- package/dist/react/hooks/index.d.ts +72 -20
- package/dist/react/hooks/index.js +5 -7
- package/dist/react/index.css +1 -1
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +8 -10
- package/dist/react/ssr/index.d.ts +54 -41
- package/dist/react/ssr/index.js +5 -9
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/collectible-card/index.css +1 -1
- package/dist/react/ui/components/collectible-card/index.css.map +1 -1
- package/dist/react/ui/components/collectible-card/index.d.ts +2 -2
- package/dist/react/ui/components/collectible-card/index.js +8 -8
- package/dist/react/ui/index.css +1 -1
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +2 -2
- package/dist/react/ui/index.js +8 -8
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +6 -6
- package/dist/styles/index.css +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.js +9 -5
- package/dist/{types-Yto6KrTN.d.ts → types-BY3husBh.d.ts} +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +4 -4
- package/package.json +11 -10
- package/src/react/_internal/api/__mocks__/indexer.msw.ts +197 -0
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +140 -1
- package/src/react/_internal/api/__mocks__/metadata.msw.ts +162 -0
- package/src/react/_internal/test/mocks/publicClient.ts +39 -0
- package/src/react/_internal/test/mocks/wagmi.ts +61 -0
- package/src/react/_internal/test/mocks/wallet.ts +61 -0
- package/src/react/_internal/test/setup.ts +28 -0
- package/src/react/_internal/test-utils.tsx +31 -2
- package/src/react/_internal/wagmi/__tests__/create-config.test.ts +53 -20
- package/src/react/_internal/wagmi/create-config.ts +3 -4
- package/src/react/_internal/wagmi/embedded.ts +1 -4
- package/src/react/_internal/wagmi/universal.ts +1 -4
- package/src/react/_internal/wallet/wallet.ts +1 -0
- package/src/react/hooks/__tests__/useAutoSelectFeeOption.test.tsx +314 -0
- package/src/react/hooks/__tests__/useBalanceOfCollectible.test.tsx +148 -0
- package/src/react/hooks/__tests__/useCancelOrder.test.tsx +410 -0
- package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +269 -0
- package/src/react/hooks/__tests__/useCollectible.test.tsx +120 -0
- package/src/react/hooks/__tests__/useCollection.test.tsx +101 -0
- package/src/react/hooks/__tests__/useCollectionBalanceDetails.test.tsx +175 -0
- package/src/react/hooks/__tests__/useCollectionDetails.test.tsx +82 -0
- package/src/react/hooks/__tests__/useCollectionDetailsPolling.test.tsx +133 -0
- package/src/react/hooks/__tests__/useCountListingsForCollectible.test.tsx +108 -0
- package/src/react/hooks/__tests__/useCountOfCollectables.test.tsx +129 -0
- package/src/react/hooks/__tests__/useCountOffersForCollectible.test.tsx +108 -0
- package/src/react/hooks/__tests__/useCurrencies.test.tsx +176 -0
- package/src/react/hooks/__tests__/useCurrency.test.tsx +153 -0
- package/src/react/hooks/__tests__/useCurrencyBalance.test.tsx +111 -0
- package/src/react/hooks/__tests__/useFilters.test.tsx +127 -0
- package/src/react/hooks/__tests__/useFloorOrder.test.tsx +101 -0
- package/src/react/hooks/__tests__/useGenerateBuyTransaction.test.tsx +173 -0
- package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +207 -0
- package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +207 -0
- package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +205 -0
- package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +181 -0
- package/src/react/hooks/__tests__/useHighestOffer.test.tsx +118 -0
- package/src/react/hooks/__tests__/useListBalances.test.tsx +136 -0
- package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +200 -0
- package/src/react/hooks/__tests__/useListCollectibles.test.tsx +232 -0
- package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +235 -0
- package/src/react/hooks/__tests__/useListCollections.test.tsx +296 -0
- package/src/react/hooks/__tests__/useListListingsForCollectible.test.tsx +140 -0
- package/src/react/hooks/__tests__/useListOffersForCollectible.test.tsx +140 -0
- package/src/react/hooks/__tests__/useLowestListing.test.tsx +148 -0
- package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +106 -0
- package/src/react/hooks/__tests__/useRoyaltyPercentage.test.tsx +129 -0
- package/src/react/hooks/index.ts +0 -1
- package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +66 -10
- package/src/react/hooks/options/__tests__/marketplaceConfigOptions.test.tsx +2 -11
- package/src/react/hooks/options/marketplaceConfigOptions.ts +8 -3
- package/src/react/hooks/useAutoSelectFeeOption.tsx +4 -3
- package/src/react/hooks/useCancelTransactionSteps.tsx +17 -9
- package/src/react/hooks/useCollectionDetailsPolling.tsx +1 -1
- package/src/react/hooks/useCurrencies.tsx +29 -28
- package/src/react/hooks/useFilters.tsx +69 -2
- package/src/react/hooks/useGenerateBuyTransaction.tsx +13 -5
- package/src/react/hooks/useListCollectibleActivities.tsx +1 -0
- package/src/react/hooks/useListCollectibles.tsx +1 -0
- package/src/react/hooks/useListCollectionActivities.tsx +1 -0
- package/src/react/hooks/useListCollections.tsx +2 -2
- package/src/react/ui/components/_internals/custom-select/__tests__/CustomSelect.test.tsx +6 -2
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +1 -1
- package/src/react/ui/components/collectible-card/Footer.tsx +9 -5
- package/src/react/ui/modals/BuyModal/Modal.tsx +9 -4
- package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx +0 -1
- package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +4 -2
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useBuyCollectable.test.tsx +1 -24
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +152 -210
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useFees.test.tsx +19 -49
- package/src/react/ui/modals/BuyModal/hooks/useFees.ts +6 -6
- package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +4 -2
- package/src/react/ui/modals/BuyModal/modals/__tests__/Modal1155.test.tsx +161 -52
- package/src/react/ui/modals/BuyModal/store.ts +7 -0
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +1 -3
- package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +59 -227
- package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +2 -1
- package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +8 -2
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +9 -5
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +1 -8
- package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +41 -118
- package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +2 -1
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +9 -5
- package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +4 -3
- package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +33 -31
- package/src/react/ui/modals/SellModal/hooks/useSell.tsx +1 -0
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +9 -5
- package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +0 -1
- package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +4 -2
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +129 -57
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +1 -3
- package/src/react/ui/modals/_internal/components/priceInput/__tests__/index.test.tsx +1 -3
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +8 -8
- package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +1 -0
- package/src/types/builder-types.ts +79 -0
- package/src/types/index.ts +1 -1
- package/src/utils/__tests__/get-public-rpc-client.test.ts +2 -0
- package/src/utils/getMarketplaceDetails.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.js +2 -1
- package/dist/chunk-F4E3WJ2K.js.map +0 -1
- package/dist/chunk-FCF57DZI.js.map +0 -1
- package/dist/chunk-I37CRQ4S.js.map +0 -1
- package/dist/chunk-LJAB3S6U.js.map +0 -1
- package/dist/chunk-RK6KYMZM.js +0 -18
- package/dist/chunk-RK6KYMZM.js.map +0 -1
- package/dist/marketplace-config-znEu4L0K.d.ts +0 -60
- package/src/react/hooks/useCurrencyOptions.tsx +0 -16
- package/src/types/marketplace-config.ts +0 -67
- /package/dist/{chunk-MKGSGTQC.js.map → chunk-Y7YTLAO2.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ActionModal,
|
|
4
4
|
CustomSelect,
|
|
5
5
|
useCurrencyBalance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Y7YTLAO2.js";
|
|
7
7
|
import {
|
|
8
8
|
CalendarIcon_default,
|
|
9
9
|
MinusIcon_default,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
quantityInputWrapper,
|
|
34
34
|
tokenPreview,
|
|
35
35
|
transferModalContent
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-UZIAX32Y.js";
|
|
37
37
|
import {
|
|
38
38
|
AlertMessage,
|
|
39
39
|
dateToUnixTime,
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
useConfig,
|
|
45
45
|
useCurrencies,
|
|
46
46
|
useCurrency,
|
|
47
|
-
useCurrencyOptions,
|
|
48
47
|
useGenerateListingTransaction,
|
|
49
48
|
useGenerateOfferTransaction,
|
|
50
49
|
useGenerateSellTransaction,
|
|
@@ -55,14 +54,14 @@ import {
|
|
|
55
54
|
useSwitchChainModal,
|
|
56
55
|
useTransferTokens,
|
|
57
56
|
useWallet
|
|
58
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-H5YWG6WN.js";
|
|
59
58
|
import {
|
|
60
59
|
iconVariants
|
|
61
60
|
} from "./chunk-TQWM4ER6.js";
|
|
62
61
|
import {
|
|
63
62
|
calculatePriceDifferencePercentage,
|
|
64
63
|
truncateMiddle
|
|
65
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-BZD2LDJJ.js";
|
|
66
65
|
import {
|
|
67
66
|
getProviderEl
|
|
68
67
|
} from "./chunk-YOKGP2EQ.js";
|
|
@@ -837,7 +836,8 @@ var useTransactionSteps = ({
|
|
|
837
836
|
if (!transactionStep && !signatureStep) {
|
|
838
837
|
throw new Error("No transaction or signature step found");
|
|
839
838
|
}
|
|
840
|
-
let hash
|
|
839
|
+
let hash;
|
|
840
|
+
let orderId;
|
|
841
841
|
if (transactionStep) {
|
|
842
842
|
hash = await executeTransaction({ transactionStep });
|
|
843
843
|
}
|
|
@@ -925,7 +925,7 @@ var useMakeOffer = ({
|
|
|
925
925
|
}) => {
|
|
926
926
|
const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
|
|
927
927
|
const collectionConfig = marketplaceConfig?.collections.find(
|
|
928
|
-
(c) => c.
|
|
928
|
+
(c) => c.address === collectionAddress
|
|
929
929
|
);
|
|
930
930
|
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
|
|
931
931
|
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData({
|
|
@@ -963,7 +963,7 @@ var useMakeOffer = ({
|
|
|
963
963
|
};
|
|
964
964
|
|
|
965
965
|
// src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx
|
|
966
|
-
import { Box as Box4 } from "@0xsequence/design-system";
|
|
966
|
+
import { Box as Box4, Text as Text5 } from "@0xsequence/design-system";
|
|
967
967
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
968
968
|
var ErrorModal = ({
|
|
969
969
|
isOpen,
|
|
@@ -987,7 +987,7 @@ var ErrorModal = ({
|
|
|
987
987
|
justifyContent: "center",
|
|
988
988
|
alignItems: "center",
|
|
989
989
|
padding: "4",
|
|
990
|
-
children: message || "Error loading item details"
|
|
990
|
+
children: /* @__PURE__ */ jsx5(Text5, { color: "text80", fontFamily: "body", children: message || "Error loading item details" })
|
|
991
991
|
}
|
|
992
992
|
)
|
|
993
993
|
}
|
|
@@ -1024,7 +1024,7 @@ var LoadingModal = ({
|
|
|
1024
1024
|
);
|
|
1025
1025
|
|
|
1026
1026
|
// src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx
|
|
1027
|
-
import { Box as Box6, Skeleton as Skeleton3, Text as
|
|
1027
|
+
import { Box as Box6, Skeleton as Skeleton3, Text as Text6 } from "@0xsequence/design-system";
|
|
1028
1028
|
import { observer as observer2 } from "@legendapp/state/react";
|
|
1029
1029
|
import { addDays } from "date-fns";
|
|
1030
1030
|
|
|
@@ -1175,7 +1175,7 @@ var ExpirationDateSelect = observer2(function ExpirationDateSelect2({
|
|
|
1175
1175
|
}
|
|
1176
1176
|
return /* @__PURE__ */ jsxs5(Box6, { width: "full", position: "relative", children: [
|
|
1177
1177
|
/* @__PURE__ */ jsx9(
|
|
1178
|
-
|
|
1178
|
+
Text6,
|
|
1179
1179
|
{
|
|
1180
1180
|
fontSize: "small",
|
|
1181
1181
|
fontWeight: "medium",
|
|
@@ -1235,7 +1235,7 @@ var ExpirationDateSelect = observer2(function ExpirationDateSelect2({
|
|
|
1235
1235
|
var expirationDateSelect_default = ExpirationDateSelect;
|
|
1236
1236
|
|
|
1237
1237
|
// src/react/ui/modals/_internal/components/floorPriceText/index.tsx
|
|
1238
|
-
import { Text as
|
|
1238
|
+
import { Text as Text7 } from "@0xsequence/design-system";
|
|
1239
1239
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1240
1240
|
function FloorPriceText({
|
|
1241
1241
|
chainId,
|
|
@@ -1262,7 +1262,7 @@ function FloorPriceText({
|
|
|
1262
1262
|
});
|
|
1263
1263
|
const floorPriceDifferenceText = floorPriceRaw === price.amountRaw ? "Same as floor price" : `${floorPriceDifference}% ${floorPriceRaw > price.amountRaw ? "below" : "above"} floor price`;
|
|
1264
1264
|
return /* @__PURE__ */ jsx10(
|
|
1265
|
-
|
|
1265
|
+
Text7,
|
|
1266
1266
|
{
|
|
1267
1267
|
fontSize: "small",
|
|
1268
1268
|
fontWeight: "medium",
|
|
@@ -1276,7 +1276,7 @@ function FloorPriceText({
|
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
1278
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
1279
|
-
import { Box as Box8, NumericInput, Text as
|
|
1279
|
+
import { Box as Box8, NumericInput, Text as Text8 } from "@0xsequence/design-system";
|
|
1280
1280
|
import { parseUnits } from "viem";
|
|
1281
1281
|
import { useAccount } from "wagmi";
|
|
1282
1282
|
|
|
@@ -1338,10 +1338,9 @@ var CurrencyOptionsSelect = observer3(function CurrencyOptionsSelect2({
|
|
|
1338
1338
|
includeNativeCurrency
|
|
1339
1339
|
}) {
|
|
1340
1340
|
const currency = selectedCurrency$.get();
|
|
1341
|
-
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
1342
1341
|
const { data: currencies, isLoading: currenciesLoading } = useCurrencies({
|
|
1343
1342
|
chainId,
|
|
1344
|
-
|
|
1343
|
+
collectionAddress,
|
|
1345
1344
|
includeNativeCurrency
|
|
1346
1345
|
});
|
|
1347
1346
|
useEffect4(() => {
|
|
@@ -1458,7 +1457,7 @@ function PriceInput({
|
|
|
1458
1457
|
}
|
|
1459
1458
|
),
|
|
1460
1459
|
balanceError && /* @__PURE__ */ jsx13(
|
|
1461
|
-
|
|
1460
|
+
Text8,
|
|
1462
1461
|
{
|
|
1463
1462
|
color: "negative",
|
|
1464
1463
|
fontSize: "xsmall",
|
|
@@ -1586,7 +1585,7 @@ function QuantityInput({
|
|
|
1586
1585
|
}
|
|
1587
1586
|
|
|
1588
1587
|
// src/react/ui/modals/_internal/components/tokenPreview/index.tsx
|
|
1589
|
-
import { Box as Box10, Image as Image2, Skeleton as Skeleton5, Text as
|
|
1588
|
+
import { Box as Box10, Image as Image2, Skeleton as Skeleton5, Text as Text9 } from "@0xsequence/design-system";
|
|
1590
1589
|
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1591
1590
|
function TokenPreview({
|
|
1592
1591
|
collectionName,
|
|
@@ -1622,7 +1621,7 @@ function TokenPreview({
|
|
|
1622
1621
|
),
|
|
1623
1622
|
/* @__PURE__ */ jsxs8(Box10, { display: "flex", flexDirection: "column", marginLeft: "3", children: [
|
|
1624
1623
|
/* @__PURE__ */ jsx15(
|
|
1625
|
-
|
|
1624
|
+
Text9,
|
|
1626
1625
|
{
|
|
1627
1626
|
fontSize: "small",
|
|
1628
1627
|
color: "text80",
|
|
@@ -1632,7 +1631,7 @@ function TokenPreview({
|
|
|
1632
1631
|
}
|
|
1633
1632
|
),
|
|
1634
1633
|
/* @__PURE__ */ jsx15(
|
|
1635
|
-
|
|
1634
|
+
Text9,
|
|
1636
1635
|
{
|
|
1637
1636
|
fontSize: "small",
|
|
1638
1637
|
fontWeight: "bold",
|
|
@@ -1739,14 +1738,12 @@ var Modal2 = observer4(() => {
|
|
|
1739
1738
|
chainId,
|
|
1740
1739
|
collectionAddress
|
|
1741
1740
|
});
|
|
1742
|
-
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
1743
1741
|
const {
|
|
1744
1742
|
data: currencies,
|
|
1745
1743
|
isLoading: currenciesLoading,
|
|
1746
1744
|
isError: currenciesIsError
|
|
1747
1745
|
} = useCurrencies({
|
|
1748
1746
|
chainId,
|
|
1749
|
-
currencyOptions,
|
|
1750
1747
|
includeNativeCurrency: false
|
|
1751
1748
|
});
|
|
1752
1749
|
const { isLoading, executeApproval, makeOffer } = useMakeOffer({
|
|
@@ -1881,7 +1878,7 @@ import { Show as Show2, observer as observer5 } from "@legendapp/state/react";
|
|
|
1881
1878
|
import { parseUnits as parseUnits3 } from "viem";
|
|
1882
1879
|
|
|
1883
1880
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1884
|
-
import { Box as Box11, Image as Image3, Skeleton as Skeleton6, Text as
|
|
1881
|
+
import { Box as Box11, Image as Image3, Skeleton as Skeleton6, Text as Text10 } from "@0xsequence/design-system";
|
|
1885
1882
|
import { formatUnits as formatUnits3 } from "viem";
|
|
1886
1883
|
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1887
1884
|
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
@@ -1895,8 +1892,8 @@ function TransactionDetails({
|
|
|
1895
1892
|
}) {
|
|
1896
1893
|
const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
|
|
1897
1894
|
const marketplaceFeePercentage = data?.collections.find(
|
|
1898
|
-
(collection) => collection.
|
|
1899
|
-
)?.
|
|
1895
|
+
(collection) => collection.address === collectionAddress
|
|
1896
|
+
)?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
1900
1897
|
const { data: royaltyPercentage, isLoading: royaltyPercentageLoading } = useRoyaltyPercentage({
|
|
1901
1898
|
chainId,
|
|
1902
1899
|
collectionAddress,
|
|
@@ -1918,10 +1915,10 @@ function TransactionDetails({
|
|
|
1918
1915
|
justifyContent: "space-between",
|
|
1919
1916
|
alignItems: "center",
|
|
1920
1917
|
children: [
|
|
1921
|
-
/* @__PURE__ */ jsx17(
|
|
1918
|
+
/* @__PURE__ */ jsx17(Text10, { fontSize: "small", color: "text50", fontFamily: "body", children: "Total earnings" }),
|
|
1922
1919
|
/* @__PURE__ */ jsxs10(Box11, { display: "flex", alignItems: "center", gap: "2", children: [
|
|
1923
1920
|
/* @__PURE__ */ jsx17(Image3, { src: currencyImageUrl, width: "3", height: "3" }),
|
|
1924
|
-
priceLoading ? /* @__PURE__ */ jsx17(Skeleton6, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs10(
|
|
1921
|
+
priceLoading ? /* @__PURE__ */ jsx17(Skeleton6, { width: "16", height: "4" }) : /* @__PURE__ */ jsxs10(Text10, { fontSize: "small", color: "text100", fontFamily: "body", children: [
|
|
1925
1922
|
showPlaceholderPrice ? "0" : formattedAmount,
|
|
1926
1923
|
" ",
|
|
1927
1924
|
price.currency.symbol
|
|
@@ -1933,7 +1930,7 @@ function TransactionDetails({
|
|
|
1933
1930
|
}
|
|
1934
1931
|
|
|
1935
1932
|
// src/react/ui/modals/_internal/components/transactionHeader/index.tsx
|
|
1936
|
-
import { Box as Box12, Image as Image4, Skeleton as Skeleton7, Text as
|
|
1933
|
+
import { Box as Box12, Image as Image4, Skeleton as Skeleton7, Text as Text11 } from "@0xsequence/design-system";
|
|
1937
1934
|
import { formatDistanceToNow as formatDistanceToNow2 } from "date-fns";
|
|
1938
1935
|
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1939
1936
|
function TransactionHeader({
|
|
@@ -1943,7 +1940,7 @@ function TransactionHeader({
|
|
|
1943
1940
|
}) {
|
|
1944
1941
|
return /* @__PURE__ */ jsxs11(Box12, { display: "flex", alignItems: "center", width: "full", children: [
|
|
1945
1942
|
/* @__PURE__ */ jsx18(
|
|
1946
|
-
|
|
1943
|
+
Text11,
|
|
1947
1944
|
{
|
|
1948
1945
|
fontSize: "small",
|
|
1949
1946
|
fontWeight: "medium",
|
|
@@ -1955,7 +1952,7 @@ function TransactionHeader({
|
|
|
1955
1952
|
),
|
|
1956
1953
|
/* @__PURE__ */ jsx18(Image4, { src: currencyImageUrl, width: "3", height: "3", marginRight: "1" }),
|
|
1957
1954
|
date && /* @__PURE__ */ jsxs11(
|
|
1958
|
-
|
|
1955
|
+
Text11,
|
|
1959
1956
|
{
|
|
1960
1957
|
fontSize: "small",
|
|
1961
1958
|
color: "text50",
|
|
@@ -2008,7 +2005,7 @@ var initialState3 = {
|
|
|
2008
2005
|
var sellModal$ = observable3(initialState3);
|
|
2009
2006
|
|
|
2010
2007
|
// src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx
|
|
2011
|
-
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
2008
|
+
import { skipToken as skipToken3, useQuery as useQuery3 } from "@tanstack/react-query";
|
|
2012
2009
|
|
|
2013
2010
|
// src/react/ui/modals/BuyModal/hooks/useFees.ts
|
|
2014
2011
|
import { avalanche, optimism } from "viem/chains";
|
|
@@ -2021,15 +2018,13 @@ var useFees = ({
|
|
|
2021
2018
|
const avalancheAndOptimismPlatformFeeRecipient = "0x400cdab4676c17aec07e8ec748a5fc3b674bca41";
|
|
2022
2019
|
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
2023
2020
|
const collection = marketplaceConfig?.collections.find(
|
|
2024
|
-
(collection2) => collection2.
|
|
2021
|
+
(collection2) => collection2.address.toLowerCase() === collectionAddress.toLowerCase() && chainId === Number(collection2.chainId)
|
|
2025
2022
|
);
|
|
2026
2023
|
const avalancheOrOptimism = chainId === avalanche.id || chainId === optimism.id;
|
|
2027
2024
|
const receiver = avalancheOrOptimism ? avalancheAndOptimismPlatformFeeRecipient : defaultPlatformFeeRecipient;
|
|
2028
2025
|
const percentageToBPS = (percentage) => Number(percentage) * 1e4 / 100;
|
|
2029
2026
|
return {
|
|
2030
|
-
amount: percentageToBPS(
|
|
2031
|
-
collection?.marketplaceFeePercentage || defaultFee
|
|
2032
|
-
).toString(),
|
|
2027
|
+
amount: percentageToBPS(collection?.feePercentage || defaultFee).toString(),
|
|
2033
2028
|
receiver
|
|
2034
2029
|
};
|
|
2035
2030
|
};
|
|
@@ -2045,7 +2040,7 @@ var useGetTokenApprovalData2 = (params) => {
|
|
|
2045
2040
|
});
|
|
2046
2041
|
const { data, isLoading, isSuccess } = useQuery3({
|
|
2047
2042
|
queryKey: ["token-approval-data", params.ordersData],
|
|
2048
|
-
queryFn: async () => {
|
|
2043
|
+
queryFn: wallet ? async () => {
|
|
2049
2044
|
const address = await wallet.address();
|
|
2050
2045
|
const args = {
|
|
2051
2046
|
collectionAddress: params.collectionAddress,
|
|
@@ -2072,7 +2067,7 @@ var useGetTokenApprovalData2 = (params) => {
|
|
|
2072
2067
|
return {
|
|
2073
2068
|
step: tokenApprovalStep
|
|
2074
2069
|
};
|
|
2075
|
-
},
|
|
2070
|
+
} : skipToken3,
|
|
2076
2071
|
enabled: !!wallet && !!params.collectionAddress
|
|
2077
2072
|
});
|
|
2078
2073
|
return {
|
|
@@ -2165,7 +2160,8 @@ var useTransactionSteps2 = ({
|
|
|
2165
2160
|
if (!transactionStep && !signatureStep) {
|
|
2166
2161
|
throw new Error("No transaction or signature step found");
|
|
2167
2162
|
}
|
|
2168
|
-
let hash
|
|
2163
|
+
let hash;
|
|
2164
|
+
let orderId;
|
|
2169
2165
|
if (transactionStep) {
|
|
2170
2166
|
hash = await executeTransaction({ transactionStep });
|
|
2171
2167
|
}
|
|
@@ -2409,7 +2405,7 @@ import {
|
|
|
2409
2405
|
ExternalLinkIcon,
|
|
2410
2406
|
IconButton as IconButton3,
|
|
2411
2407
|
Image as Image5,
|
|
2412
|
-
Text as
|
|
2408
|
+
Text as Text12
|
|
2413
2409
|
} from "@0xsequence/design-system";
|
|
2414
2410
|
import { observer as observer6 } from "@legendapp/state/react";
|
|
2415
2411
|
import { Close as Close2, Content as Content3, Overlay as Overlay2, Portal as Portal3, Root as Root3 } from "@radix-ui/react-dialog";
|
|
@@ -2470,7 +2466,7 @@ var SuccessfulPurchaseModal = observer6(() => {
|
|
|
2470
2466
|
/* @__PURE__ */ jsxs13(Content3, { className: dialogContent.narrow, children: [
|
|
2471
2467
|
/* @__PURE__ */ jsxs13(Box13, { display: "flex", flexDirection: "column", gap: "4", width: "full", children: [
|
|
2472
2468
|
/* @__PURE__ */ jsx20(
|
|
2473
|
-
|
|
2469
|
+
Text12,
|
|
2474
2470
|
{
|
|
2475
2471
|
textAlign: "center",
|
|
2476
2472
|
fontSize: "medium",
|
|
@@ -2486,10 +2482,10 @@ var SuccessfulPurchaseModal = observer6(() => {
|
|
|
2486
2482
|
}
|
|
2487
2483
|
),
|
|
2488
2484
|
/* @__PURE__ */ jsxs13(Box13, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
2489
|
-
/* @__PURE__ */ jsx20(
|
|
2490
|
-
/* @__PURE__ */ jsx20(
|
|
2491
|
-
/* @__PURE__ */ jsx20(
|
|
2492
|
-
/* @__PURE__ */ jsx20(
|
|
2485
|
+
/* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "You bought" }),
|
|
2486
|
+
/* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().collectibles.length }),
|
|
2487
|
+
/* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text80", children: "items for" }),
|
|
2488
|
+
/* @__PURE__ */ jsx20(Text12, { fontSize: "normal", fontWeight: "medium", color: "text100", children: successfulPurchaseModal$.state.get().totalPrice })
|
|
2493
2489
|
] }),
|
|
2494
2490
|
/* @__PURE__ */ jsx20(SuccessfulPurchaseActions, {})
|
|
2495
2491
|
] }),
|
|
@@ -2570,7 +2566,7 @@ function CollectiblesGrid({ collectibles }) {
|
|
|
2570
2566
|
background: "backgroundOverlay",
|
|
2571
2567
|
backdropFilter: "blur",
|
|
2572
2568
|
children: /* @__PURE__ */ jsxs13(
|
|
2573
|
-
|
|
2569
|
+
Text12,
|
|
2574
2570
|
{
|
|
2575
2571
|
fontSize: "small",
|
|
2576
2572
|
fontWeight: "medium",
|
|
@@ -2642,7 +2638,7 @@ var initialState5 = {
|
|
|
2642
2638
|
var transferModal$ = observable5(initialState5);
|
|
2643
2639
|
|
|
2644
2640
|
// src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx
|
|
2645
|
-
import { Box as Box14, Button as Button3, Text as
|
|
2641
|
+
import { Box as Box14, Button as Button3, Text as Text13, TextInput } from "@0xsequence/design-system";
|
|
2646
2642
|
import { observable as observable6 } from "@legendapp/state";
|
|
2647
2643
|
import { isAddress } from "viem";
|
|
2648
2644
|
import { useAccount as useAccount2 } from "wagmi";
|
|
@@ -2752,7 +2748,7 @@ var EnterWalletAddressView = () => {
|
|
|
2752
2748
|
transferModal$.view.set("followWalletInstructions");
|
|
2753
2749
|
}
|
|
2754
2750
|
return /* @__PURE__ */ jsxs14(Box14, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2755
|
-
/* @__PURE__ */ jsx21(
|
|
2751
|
+
/* @__PURE__ */ jsx21(Text13, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2756
2752
|
/* @__PURE__ */ jsxs14(Box14, { display: "flex", flexDirection: "column", gap: "3", children: [
|
|
2757
2753
|
/* @__PURE__ */ jsx21(
|
|
2758
2754
|
AlertMessage,
|
|
@@ -2783,7 +2779,7 @@ var EnterWalletAddressView = () => {
|
|
|
2783
2779
|
}
|
|
2784
2780
|
),
|
|
2785
2781
|
/* @__PURE__ */ jsx21(
|
|
2786
|
-
|
|
2782
|
+
Text13,
|
|
2787
2783
|
{
|
|
2788
2784
|
color: insufficientBalance ? "negative" : "text50",
|
|
2789
2785
|
fontSize: "small",
|
|
@@ -2813,12 +2809,12 @@ var EnterWalletAddressView = () => {
|
|
|
2813
2809
|
var enterWalletAddress_default = EnterWalletAddressView;
|
|
2814
2810
|
|
|
2815
2811
|
// src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx
|
|
2816
|
-
import { Box as Box15, Button as Button4, Text as
|
|
2812
|
+
import { Box as Box15, Button as Button4, Text as Text14 } from "@0xsequence/design-system";
|
|
2817
2813
|
import { observer as observer7 } from "@legendapp/state/react";
|
|
2818
2814
|
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2819
2815
|
var FollowWalletInstructionsView = observer7(() => {
|
|
2820
2816
|
return /* @__PURE__ */ jsxs15(Box15, { display: "grid", gap: "6", flexGrow: "1", children: [
|
|
2821
|
-
/* @__PURE__ */ jsx22(
|
|
2817
|
+
/* @__PURE__ */ jsx22(Text14, { color: "white", fontSize: "large", fontWeight: "bold", fontFamily: "body", children: "Transfer your item" }),
|
|
2822
2818
|
/* @__PURE__ */ jsx22(Box15, { display: "flex", flexDirection: "column", gap: "3", children: /* @__PURE__ */ jsx22(
|
|
2823
2819
|
AlertMessage,
|
|
2824
2820
|
{
|
|
@@ -2910,7 +2906,7 @@ var TransactionModalView = observer8(() => {
|
|
|
2910
2906
|
import { Box as Box16 } from "@0xsequence/design-system";
|
|
2911
2907
|
import { Show as Show4, observer as observer9 } from "@legendapp/state/react";
|
|
2912
2908
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2913
|
-
import { useAccount as
|
|
2909
|
+
import { useAccount as useAccount5 } from "wagmi";
|
|
2914
2910
|
|
|
2915
2911
|
// src/react/ui/modals/CreateListingModal/store.ts
|
|
2916
2912
|
import { observable as observable7 } from "@legendapp/state";
|
|
@@ -2973,11 +2969,13 @@ var createListingModal$ = observable7({
|
|
|
2973
2969
|
import { useEffect as useEffect6 } from "react";
|
|
2974
2970
|
|
|
2975
2971
|
// src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts
|
|
2976
|
-
import { skipToken as
|
|
2972
|
+
import { skipToken as skipToken4, useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2973
|
+
import { useAccount as useAccount4 } from "wagmi";
|
|
2977
2974
|
var ONE_DAY_IN_SECONDS2 = 60 * 60 * 24;
|
|
2978
2975
|
var useGetTokenApprovalData3 = (params) => {
|
|
2979
2976
|
const config = useConfig();
|
|
2980
2977
|
const { wallet } = useWallet();
|
|
2978
|
+
const { address } = useAccount4();
|
|
2981
2979
|
const marketplaceClient = getMarketplaceClient(params.chainId, config);
|
|
2982
2980
|
const listing = {
|
|
2983
2981
|
tokenId: params.tokenId,
|
|
@@ -2986,9 +2984,9 @@ var useGetTokenApprovalData3 = (params) => {
|
|
|
2986
2984
|
pricePerToken: "100000",
|
|
2987
2985
|
expiry: String(Number(dateToUnixTime(/* @__PURE__ */ new Date())) + ONE_DAY_IN_SECONDS2)
|
|
2988
2986
|
};
|
|
2989
|
-
const isEnabled = wallet && params.query?.enabled
|
|
2987
|
+
const isEnabled = wallet && address && (params.query?.enabled ?? true) && !!params.currencyAddress;
|
|
2990
2988
|
const { data, isLoading, isSuccess } = useQuery4({
|
|
2991
|
-
queryKey: ["token-approval-data", params
|
|
2989
|
+
queryKey: ["token-approval-data", params, address],
|
|
2992
2990
|
queryFn: isEnabled ? async () => {
|
|
2993
2991
|
const args = {
|
|
2994
2992
|
collectionAddress: params.collectionAddress,
|
|
@@ -3010,7 +3008,7 @@ var useGetTokenApprovalData3 = (params) => {
|
|
|
3010
3008
|
return {
|
|
3011
3009
|
step: tokenApprovalStep
|
|
3012
3010
|
};
|
|
3013
|
-
} :
|
|
3011
|
+
} : skipToken4
|
|
3014
3012
|
});
|
|
3015
3013
|
return {
|
|
3016
3014
|
data,
|
|
@@ -3098,7 +3096,8 @@ var useTransactionSteps3 = ({
|
|
|
3098
3096
|
if (!transactionStep && !signatureStep) {
|
|
3099
3097
|
throw new Error("No transaction or signature step found");
|
|
3100
3098
|
}
|
|
3101
|
-
let hash
|
|
3099
|
+
let hash;
|
|
3100
|
+
let orderId;
|
|
3102
3101
|
if (transactionStep) {
|
|
3103
3102
|
hash = await executeTransaction({ transactionStep });
|
|
3104
3103
|
}
|
|
@@ -3182,7 +3181,7 @@ var useCreateListing = ({
|
|
|
3182
3181
|
}) => {
|
|
3183
3182
|
const { data: marketplaceConfig, isLoading: marketplaceIsLoading } = useMarketplaceConfig();
|
|
3184
3183
|
const collectionConfig = marketplaceConfig?.collections.find(
|
|
3185
|
-
(c) => c.
|
|
3184
|
+
(c) => c.address === collectionAddress
|
|
3186
3185
|
);
|
|
3187
3186
|
orderbookKind = orderbookKind ?? collectionConfig?.destinationMarketplace ?? "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
|
|
3188
3187
|
const { data: tokenApproval, isLoading: tokenApprovalIsLoading } = useGetTokenApprovalData3({
|
|
@@ -3244,14 +3243,13 @@ var Modal5 = observer9(() => {
|
|
|
3244
3243
|
collectionAddress,
|
|
3245
3244
|
collectibleId
|
|
3246
3245
|
});
|
|
3247
|
-
const currencyOptions = useCurrencyOptions({ collectionAddress });
|
|
3248
3246
|
const {
|
|
3249
3247
|
data: currencies,
|
|
3250
3248
|
isLoading: currenciesLoading,
|
|
3251
3249
|
isError: currenciesIsError
|
|
3252
3250
|
} = useCurrencies({
|
|
3253
3251
|
chainId,
|
|
3254
|
-
|
|
3252
|
+
collectionAddress,
|
|
3255
3253
|
includeNativeCurrency: true
|
|
3256
3254
|
});
|
|
3257
3255
|
const {
|
|
@@ -3262,7 +3260,7 @@ var Modal5 = observer9(() => {
|
|
|
3262
3260
|
chainId,
|
|
3263
3261
|
collectionAddress
|
|
3264
3262
|
});
|
|
3265
|
-
const { address } =
|
|
3263
|
+
const { address } = useAccount5();
|
|
3266
3264
|
const { data: balance } = useBalanceOfCollectible({
|
|
3267
3265
|
chainId,
|
|
3268
3266
|
collectionAddress,
|
|
@@ -3406,6 +3404,9 @@ var Modal5 = observer9(() => {
|
|
|
3406
3404
|
// src/react/ui/modals/BuyModal/Modal.tsx
|
|
3407
3405
|
import { use$ as use$3 } from "@legendapp/state/react";
|
|
3408
3406
|
|
|
3407
|
+
// src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts
|
|
3408
|
+
import { useSelectPaymentModal } from "@0xsequence/kit-checkout";
|
|
3409
|
+
|
|
3409
3410
|
// src/react/ui/modals/BuyModal/store.ts
|
|
3410
3411
|
import { observable as observable8 } from "@legendapp/state";
|
|
3411
3412
|
var buyState = {
|
|
@@ -3413,7 +3414,8 @@ var buyState = {
|
|
|
3413
3414
|
quantity: "1",
|
|
3414
3415
|
invalidQuantity: false,
|
|
3415
3416
|
checkoutModalIsLoading: false,
|
|
3416
|
-
checkoutModalLoaded: false
|
|
3417
|
+
checkoutModalLoaded: false,
|
|
3418
|
+
purchaseProcessing: false
|
|
3417
3419
|
};
|
|
3418
3420
|
var initialState7 = {
|
|
3419
3421
|
isOpen: false,
|
|
@@ -3427,7 +3429,8 @@ var initialState7 = {
|
|
|
3427
3429
|
order: args.order,
|
|
3428
3430
|
invalidQuantity: false,
|
|
3429
3431
|
checkoutModalIsLoading: false,
|
|
3430
|
-
checkoutModalLoaded: false
|
|
3432
|
+
checkoutModalLoaded: false,
|
|
3433
|
+
purchaseProcessing: false
|
|
3431
3434
|
});
|
|
3432
3435
|
buyModal$.callbacks.set(callbacks || defaultCallbacks);
|
|
3433
3436
|
buyModal$.isOpen.set(true);
|
|
@@ -3444,10 +3447,180 @@ var initialState7 = {
|
|
|
3444
3447
|
setCheckoutModalLoaded: (isLoaded) => {
|
|
3445
3448
|
buyModal$.state.checkoutModalLoaded.set(isLoaded);
|
|
3446
3449
|
},
|
|
3450
|
+
setPurchaseProcessing: (isProcessing) => {
|
|
3451
|
+
buyModal$.state.purchaseProcessing.set(isProcessing);
|
|
3452
|
+
},
|
|
3447
3453
|
callbacks: void 0
|
|
3448
3454
|
};
|
|
3449
3455
|
var buyModal$ = observable8(initialState7);
|
|
3450
3456
|
|
|
3457
|
+
// src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts
|
|
3458
|
+
var useBuyCollectable = ({
|
|
3459
|
+
chainId,
|
|
3460
|
+
collectionAddress,
|
|
3461
|
+
tokenId,
|
|
3462
|
+
callbacks,
|
|
3463
|
+
priceCurrencyAddress,
|
|
3464
|
+
setCheckoutModalIsLoading,
|
|
3465
|
+
setCheckoutModalLoaded
|
|
3466
|
+
}) => {
|
|
3467
|
+
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
3468
|
+
const config = useConfig();
|
|
3469
|
+
const marketplaceClient = getMarketplaceClient(Number(chainId), config);
|
|
3470
|
+
const fees = useFees({ chainId: Number(chainId), collectionAddress });
|
|
3471
|
+
const { wallet, isLoading, isError } = useWallet();
|
|
3472
|
+
if (isLoading) {
|
|
3473
|
+
return { status: "loading", buy: null, isLoading, isError: false };
|
|
3474
|
+
}
|
|
3475
|
+
if (isError || !wallet) {
|
|
3476
|
+
return { status: "error", buy: null, isLoading, isError: true };
|
|
3477
|
+
}
|
|
3478
|
+
const invalidateQueries2 = async (queriesToInvalidate) => {
|
|
3479
|
+
const queryClient = getQueryClient();
|
|
3480
|
+
for (const queryKey of queriesToInvalidate) {
|
|
3481
|
+
await queryClient.invalidateQueries({ queryKey });
|
|
3482
|
+
}
|
|
3483
|
+
};
|
|
3484
|
+
return {
|
|
3485
|
+
status: "ready",
|
|
3486
|
+
isLoading,
|
|
3487
|
+
isError,
|
|
3488
|
+
buy: async (input) => {
|
|
3489
|
+
setCheckoutModalIsLoading(true);
|
|
3490
|
+
const { steps: steps3 } = await marketplaceClient.generateBuyTransaction({
|
|
3491
|
+
collectionAddress,
|
|
3492
|
+
buyer: await wallet.address(),
|
|
3493
|
+
marketplace: input.marketplace,
|
|
3494
|
+
ordersData: [
|
|
3495
|
+
{
|
|
3496
|
+
orderId: input.orderId,
|
|
3497
|
+
quantity: input.quantity
|
|
3498
|
+
}
|
|
3499
|
+
],
|
|
3500
|
+
additionalFees: [fees],
|
|
3501
|
+
walletType: "unknown" /* unknown */
|
|
3502
|
+
});
|
|
3503
|
+
setCheckoutModalLoaded(true);
|
|
3504
|
+
setCheckoutModalIsLoading(false);
|
|
3505
|
+
const step = steps3[0];
|
|
3506
|
+
openSelectPaymentModal({
|
|
3507
|
+
chain: chainId,
|
|
3508
|
+
collectibles: [
|
|
3509
|
+
{
|
|
3510
|
+
tokenId,
|
|
3511
|
+
quantity: input.quantity,
|
|
3512
|
+
decimals: input.collectableDecimals
|
|
3513
|
+
}
|
|
3514
|
+
],
|
|
3515
|
+
currencyAddress: priceCurrencyAddress,
|
|
3516
|
+
price: step.value,
|
|
3517
|
+
targetContractAddress: step.to,
|
|
3518
|
+
txData: step.data,
|
|
3519
|
+
collectionAddress,
|
|
3520
|
+
recipientAddress: await wallet.address(),
|
|
3521
|
+
enableMainCurrencyPayment: true,
|
|
3522
|
+
enableSwapPayments: !!input.checkoutOptions.swap,
|
|
3523
|
+
creditCardProviders: input.checkoutOptions.nftCheckout || [],
|
|
3524
|
+
onSuccess: (hash) => {
|
|
3525
|
+
callbacks?.onSuccess?.({ hash });
|
|
3526
|
+
},
|
|
3527
|
+
onError: callbacks?.onError,
|
|
3528
|
+
onClose: () => {
|
|
3529
|
+
invalidateQueries2([
|
|
3530
|
+
collectableKeys.listings,
|
|
3531
|
+
collectableKeys.lowestListings,
|
|
3532
|
+
collectableKeys.listingsCount,
|
|
3533
|
+
collectableKeys.lists,
|
|
3534
|
+
collectableKeys.userBalances,
|
|
3535
|
+
balanceQueries.all,
|
|
3536
|
+
balanceQueries.collectionBalanceDetails
|
|
3537
|
+
]);
|
|
3538
|
+
buyModal$.close();
|
|
3539
|
+
}
|
|
3540
|
+
});
|
|
3541
|
+
}
|
|
3542
|
+
};
|
|
3543
|
+
};
|
|
3544
|
+
|
|
3545
|
+
// src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts
|
|
3546
|
+
import { skipToken as skipToken5, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3547
|
+
var useCheckoutOptions = (input) => {
|
|
3548
|
+
const config = useConfig();
|
|
3549
|
+
const { wallet } = useWallet();
|
|
3550
|
+
const fees = useFees({
|
|
3551
|
+
chainId: input.chainId,
|
|
3552
|
+
collectionAddress: input.collectionAddress
|
|
3553
|
+
});
|
|
3554
|
+
return useQuery5({
|
|
3555
|
+
queryKey: [
|
|
3556
|
+
"checkoutOptions",
|
|
3557
|
+
input.chainId,
|
|
3558
|
+
input.collectionAddress,
|
|
3559
|
+
input.orderId,
|
|
3560
|
+
input.marketplace
|
|
3561
|
+
],
|
|
3562
|
+
queryFn: wallet ? async () => {
|
|
3563
|
+
const marketplaceClient = getMarketplaceClient(input.chainId, config);
|
|
3564
|
+
return marketplaceClient.checkoutOptionsMarketplace({
|
|
3565
|
+
wallet: await wallet.address(),
|
|
3566
|
+
orders: [
|
|
3567
|
+
{
|
|
3568
|
+
contractAddress: input.collectionAddress,
|
|
3569
|
+
orderId: input.orderId,
|
|
3570
|
+
marketplace: input.marketplace
|
|
3571
|
+
}
|
|
3572
|
+
],
|
|
3573
|
+
additionalFee: Number(fees.amount)
|
|
3574
|
+
}).then((res) => res.options);
|
|
3575
|
+
} : skipToken5,
|
|
3576
|
+
enabled: !!wallet
|
|
3577
|
+
});
|
|
3578
|
+
};
|
|
3579
|
+
|
|
3580
|
+
// src/react/ui/modals/BuyModal/hooks/useLoadData.ts
|
|
3581
|
+
var useLoadData = ({
|
|
3582
|
+
chainId,
|
|
3583
|
+
collectionAddress,
|
|
3584
|
+
collectibleId,
|
|
3585
|
+
orderId,
|
|
3586
|
+
marketplace
|
|
3587
|
+
}) => {
|
|
3588
|
+
const {
|
|
3589
|
+
data: collection,
|
|
3590
|
+
isLoading: collectionLoading,
|
|
3591
|
+
isError: collectionError
|
|
3592
|
+
} = useCollection({
|
|
3593
|
+
chainId,
|
|
3594
|
+
collectionAddress
|
|
3595
|
+
});
|
|
3596
|
+
const {
|
|
3597
|
+
data: collectable,
|
|
3598
|
+
isLoading: collectableLoading,
|
|
3599
|
+
isError: collectableError
|
|
3600
|
+
} = useCollectible({
|
|
3601
|
+
chainId: String(chainId),
|
|
3602
|
+
collectionAddress,
|
|
3603
|
+
collectibleId
|
|
3604
|
+
});
|
|
3605
|
+
const {
|
|
3606
|
+
data: checkoutOptions,
|
|
3607
|
+
isLoading: checkoutOptionsLoading,
|
|
3608
|
+
isError: checkoutOptionsError
|
|
3609
|
+
} = useCheckoutOptions({
|
|
3610
|
+
chainId,
|
|
3611
|
+
collectionAddress,
|
|
3612
|
+
orderId,
|
|
3613
|
+
marketplace
|
|
3614
|
+
});
|
|
3615
|
+
return {
|
|
3616
|
+
collection,
|
|
3617
|
+
collectable,
|
|
3618
|
+
checkoutOptions,
|
|
3619
|
+
isLoading: collectionLoading || collectableLoading || checkoutOptionsLoading,
|
|
3620
|
+
isError: collectionError || collectableError || checkoutOptionsError
|
|
3621
|
+
};
|
|
3622
|
+
};
|
|
3623
|
+
|
|
3451
3624
|
// src/react/ui/modals/BuyModal/modals/CheckoutModal.tsx
|
|
3452
3625
|
import { useEffect as useEffect7 } from "react";
|
|
3453
3626
|
import { parseUnits as parseUnits5 } from "viem";
|
|
@@ -3469,7 +3642,7 @@ function CheckoutModal({ buy, collectable, order }) {
|
|
|
3469
3642
|
}
|
|
3470
3643
|
|
|
3471
3644
|
// src/react/ui/modals/BuyModal/modals/Modal1155.tsx
|
|
3472
|
-
import { Box as Box17, Text as
|
|
3645
|
+
import { Box as Box17, Text as Text15, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
3473
3646
|
import { observer as observer10 } from "@legendapp/state/react";
|
|
3474
3647
|
import { formatUnits as formatUnits4, parseUnits as parseUnits6 } from "viem";
|
|
3475
3648
|
import { Fragment as Fragment3, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
@@ -3482,7 +3655,7 @@ var ERC1155QuantityModal = observer10(
|
|
|
3482
3655
|
const quantity = Number(buyModal$.state.quantity.get());
|
|
3483
3656
|
const pricePerToken = order.priceAmount;
|
|
3484
3657
|
const totalPrice = (BigInt(quantity) * BigInt(pricePerToken)).toString();
|
|
3485
|
-
if (buyModal$.state.checkoutModalLoaded.get() && buyModal$.isOpen.get() && buyModal$.state.checkoutModalIsLoading.get()) {
|
|
3658
|
+
if (buyModal$.state.checkoutModalLoaded.get() && buyModal$.isOpen.get() && buyModal$.state.checkoutModalIsLoading.get() && buyModal$.state.purchaseProcessing.get()) {
|
|
3486
3659
|
return null;
|
|
3487
3660
|
}
|
|
3488
3661
|
return /* @__PURE__ */ jsx25(
|
|
@@ -3497,6 +3670,7 @@ var ERC1155QuantityModal = observer10(
|
|
|
3497
3670
|
label: "Buy now",
|
|
3498
3671
|
onClick: () => {
|
|
3499
3672
|
buyModal$.state.checkoutModalIsLoading.set(true);
|
|
3673
|
+
buyModal$.state.purchaseProcessing.set(true);
|
|
3500
3674
|
buy({
|
|
3501
3675
|
quantity: parseUnits6(
|
|
3502
3676
|
buyModal$.state.quantity.get(),
|
|
@@ -3522,11 +3696,11 @@ var ERC1155QuantityModal = observer10(
|
|
|
3522
3696
|
}
|
|
3523
3697
|
),
|
|
3524
3698
|
/* @__PURE__ */ jsxs18(Box17, { display: "flex", justifyContent: "space-between", children: [
|
|
3525
|
-
/* @__PURE__ */ jsx25(
|
|
3526
|
-
/* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: isCurrencyLoading || !currency ? /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: /* @__PURE__ */ jsx25(
|
|
3699
|
+
/* @__PURE__ */ jsx25(Text15, { color: "text50", fontSize: "small", fontFamily: "body", children: "Total Price" }),
|
|
3700
|
+
/* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: isCurrencyLoading || !currency ? /* @__PURE__ */ jsx25(Box17, { display: "flex", alignItems: "center", gap: "2", children: /* @__PURE__ */ jsx25(Text15, { color: "text50", fontSize: "small", fontFamily: "body", children: "Loading..." }) }) : /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
3527
3701
|
currency.imageUrl && /* @__PURE__ */ jsx25(TokenImage2, { src: currency.imageUrl, size: "xs" }),
|
|
3528
3702
|
/* @__PURE__ */ jsx25(
|
|
3529
|
-
|
|
3703
|
+
Text15,
|
|
3530
3704
|
{
|
|
3531
3705
|
color: "text100",
|
|
3532
3706
|
fontSize: "small",
|
|
@@ -3535,7 +3709,7 @@ var ERC1155QuantityModal = observer10(
|
|
|
3535
3709
|
children: formatUnits4(BigInt(totalPrice), currency.decimals || 0)
|
|
3536
3710
|
}
|
|
3537
3711
|
),
|
|
3538
|
-
/* @__PURE__ */ jsx25(
|
|
3712
|
+
/* @__PURE__ */ jsx25(Text15, { color: "text80", fontSize: "small", fontFamily: "body", children: currency?.symbol })
|
|
3539
3713
|
] }) })
|
|
3540
3714
|
] })
|
|
3541
3715
|
] })
|
|
@@ -3544,174 +3718,6 @@ var ERC1155QuantityModal = observer10(
|
|
|
3544
3718
|
}
|
|
3545
3719
|
);
|
|
3546
3720
|
|
|
3547
|
-
// src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts
|
|
3548
|
-
import { skipToken as skipToken4, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3549
|
-
var useCheckoutOptions = (input) => {
|
|
3550
|
-
const config = useConfig();
|
|
3551
|
-
const { wallet } = useWallet();
|
|
3552
|
-
const fees = useFees({
|
|
3553
|
-
chainId: input.chainId,
|
|
3554
|
-
collectionAddress: input.collectionAddress
|
|
3555
|
-
});
|
|
3556
|
-
return useQuery5({
|
|
3557
|
-
queryKey: [
|
|
3558
|
-
"checkoutOptions",
|
|
3559
|
-
input.chainId,
|
|
3560
|
-
input.collectionAddress,
|
|
3561
|
-
input.orderId,
|
|
3562
|
-
input.marketplace
|
|
3563
|
-
],
|
|
3564
|
-
queryFn: wallet ? async () => {
|
|
3565
|
-
const marketplaceClient = getMarketplaceClient(input.chainId, config);
|
|
3566
|
-
return marketplaceClient.checkoutOptionsMarketplace({
|
|
3567
|
-
wallet: await wallet.address(),
|
|
3568
|
-
orders: [
|
|
3569
|
-
{
|
|
3570
|
-
contractAddress: input.collectionAddress,
|
|
3571
|
-
orderId: input.orderId,
|
|
3572
|
-
marketplace: input.marketplace
|
|
3573
|
-
}
|
|
3574
|
-
],
|
|
3575
|
-
additionalFee: Number(fees.amount)
|
|
3576
|
-
}).then((res) => res.options);
|
|
3577
|
-
} : skipToken4,
|
|
3578
|
-
enabled: !!wallet
|
|
3579
|
-
});
|
|
3580
|
-
};
|
|
3581
|
-
|
|
3582
|
-
// src/react/ui/modals/BuyModal/hooks/useLoadData.ts
|
|
3583
|
-
var useLoadData = ({
|
|
3584
|
-
chainId,
|
|
3585
|
-
collectionAddress,
|
|
3586
|
-
collectibleId,
|
|
3587
|
-
orderId,
|
|
3588
|
-
marketplace
|
|
3589
|
-
}) => {
|
|
3590
|
-
const {
|
|
3591
|
-
data: collection,
|
|
3592
|
-
isLoading: collectionLoading,
|
|
3593
|
-
isError: collectionError
|
|
3594
|
-
} = useCollection({
|
|
3595
|
-
chainId,
|
|
3596
|
-
collectionAddress
|
|
3597
|
-
});
|
|
3598
|
-
const {
|
|
3599
|
-
data: collectable,
|
|
3600
|
-
isLoading: collectableLoading,
|
|
3601
|
-
isError: collectableError
|
|
3602
|
-
} = useCollectible({
|
|
3603
|
-
chainId: String(chainId),
|
|
3604
|
-
collectionAddress,
|
|
3605
|
-
collectibleId
|
|
3606
|
-
});
|
|
3607
|
-
const {
|
|
3608
|
-
data: checkoutOptions,
|
|
3609
|
-
isLoading: checkoutOptionsLoading,
|
|
3610
|
-
isError: checkoutOptionsError
|
|
3611
|
-
} = useCheckoutOptions({
|
|
3612
|
-
chainId,
|
|
3613
|
-
collectionAddress,
|
|
3614
|
-
orderId,
|
|
3615
|
-
marketplace
|
|
3616
|
-
});
|
|
3617
|
-
return {
|
|
3618
|
-
collection,
|
|
3619
|
-
collectable,
|
|
3620
|
-
checkoutOptions,
|
|
3621
|
-
isLoading: collectionLoading || collectableLoading || checkoutOptionsLoading,
|
|
3622
|
-
isError: collectionError || collectableError || checkoutOptionsError
|
|
3623
|
-
};
|
|
3624
|
-
};
|
|
3625
|
-
|
|
3626
|
-
// src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts
|
|
3627
|
-
import { useSelectPaymentModal } from "@0xsequence/kit-checkout";
|
|
3628
|
-
var useBuyCollectable = ({
|
|
3629
|
-
chainId,
|
|
3630
|
-
collectionAddress,
|
|
3631
|
-
tokenId,
|
|
3632
|
-
callbacks,
|
|
3633
|
-
priceCurrencyAddress,
|
|
3634
|
-
setCheckoutModalIsLoading,
|
|
3635
|
-
setCheckoutModalLoaded
|
|
3636
|
-
}) => {
|
|
3637
|
-
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
3638
|
-
const config = useConfig();
|
|
3639
|
-
const marketplaceClient = getMarketplaceClient(Number(chainId), config);
|
|
3640
|
-
const fees = useFees({ chainId: Number(chainId), collectionAddress });
|
|
3641
|
-
const { wallet, isLoading, isError } = useWallet();
|
|
3642
|
-
if (isLoading) {
|
|
3643
|
-
return { status: "loading", buy: null, isLoading, isError: false };
|
|
3644
|
-
}
|
|
3645
|
-
if (isError || !wallet) {
|
|
3646
|
-
return { status: "error", buy: null, isLoading, isError: true };
|
|
3647
|
-
}
|
|
3648
|
-
const invalidateQueries2 = async (queriesToInvalidate) => {
|
|
3649
|
-
const queryClient = getQueryClient();
|
|
3650
|
-
for (const queryKey of queriesToInvalidate) {
|
|
3651
|
-
await queryClient.invalidateQueries({ queryKey });
|
|
3652
|
-
}
|
|
3653
|
-
};
|
|
3654
|
-
return {
|
|
3655
|
-
status: "ready",
|
|
3656
|
-
isLoading,
|
|
3657
|
-
isError,
|
|
3658
|
-
buy: async (input) => {
|
|
3659
|
-
setCheckoutModalIsLoading(true);
|
|
3660
|
-
const { steps: steps3 } = await marketplaceClient.generateBuyTransaction({
|
|
3661
|
-
collectionAddress,
|
|
3662
|
-
buyer: await wallet.address(),
|
|
3663
|
-
marketplace: input.marketplace,
|
|
3664
|
-
ordersData: [
|
|
3665
|
-
{
|
|
3666
|
-
orderId: input.orderId,
|
|
3667
|
-
quantity: input.quantity
|
|
3668
|
-
}
|
|
3669
|
-
],
|
|
3670
|
-
additionalFees: [fees],
|
|
3671
|
-
walletType: "unknown" /* unknown */
|
|
3672
|
-
});
|
|
3673
|
-
setCheckoutModalLoaded(true);
|
|
3674
|
-
setCheckoutModalIsLoading(false);
|
|
3675
|
-
const step = steps3[0];
|
|
3676
|
-
openSelectPaymentModal({
|
|
3677
|
-
chain: chainId,
|
|
3678
|
-
collectibles: [
|
|
3679
|
-
{
|
|
3680
|
-
tokenId,
|
|
3681
|
-
quantity: input.quantity,
|
|
3682
|
-
decimals: input.collectableDecimals
|
|
3683
|
-
}
|
|
3684
|
-
],
|
|
3685
|
-
currencyAddress: priceCurrencyAddress,
|
|
3686
|
-
price: step.value,
|
|
3687
|
-
targetContractAddress: step.to,
|
|
3688
|
-
txData: step.data,
|
|
3689
|
-
collectionAddress,
|
|
3690
|
-
recipientAddress: await wallet.address(),
|
|
3691
|
-
enableMainCurrencyPayment: true,
|
|
3692
|
-
enableSwapPayments: !!input.checkoutOptions.swap,
|
|
3693
|
-
creditCardProviders: input.checkoutOptions.nftCheckout || [],
|
|
3694
|
-
onSuccess: (hash) => {
|
|
3695
|
-
callbacks?.onSuccess?.({ hash });
|
|
3696
|
-
},
|
|
3697
|
-
onError: callbacks?.onError,
|
|
3698
|
-
onClose: () => {
|
|
3699
|
-
invalidateQueries2([
|
|
3700
|
-
collectableKeys.listings,
|
|
3701
|
-
collectableKeys.lowestListings,
|
|
3702
|
-
collectableKeys.listingsCount,
|
|
3703
|
-
collectableKeys.lists,
|
|
3704
|
-
collectableKeys.userBalances,
|
|
3705
|
-
balanceQueries.all,
|
|
3706
|
-
balanceQueries.collectionBalanceDetails
|
|
3707
|
-
]);
|
|
3708
|
-
buyModal$.close();
|
|
3709
|
-
}
|
|
3710
|
-
});
|
|
3711
|
-
}
|
|
3712
|
-
};
|
|
3713
|
-
};
|
|
3714
|
-
|
|
3715
3721
|
// src/react/ui/modals/BuyModal/Modal.tsx
|
|
3716
3722
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3717
3723
|
var BuyModal = () => {
|
|
@@ -3754,6 +3760,7 @@ var BuyModalContent = () => {
|
|
|
3754
3760
|
const buyAction = (input) => {
|
|
3755
3761
|
if (buy && checkoutOptions) {
|
|
3756
3762
|
buy({ ...input, checkoutOptions });
|
|
3763
|
+
buyModal$.state.purchaseProcessing.set(true);
|
|
3757
3764
|
} else {
|
|
3758
3765
|
console.error("buy is null or undefined");
|
|
3759
3766
|
}
|
|
@@ -3780,6 +3787,9 @@ var BuyModalContent = () => {
|
|
|
3780
3787
|
}
|
|
3781
3788
|
);
|
|
3782
3789
|
}
|
|
3790
|
+
if (buyModal$.state.purchaseProcessing.get()) {
|
|
3791
|
+
return null;
|
|
3792
|
+
}
|
|
3783
3793
|
return collection.type === "ERC721" /* ERC721 */ ? /* @__PURE__ */ jsx26(
|
|
3784
3794
|
CheckoutModal,
|
|
3785
3795
|
{
|
|
@@ -3893,7 +3903,7 @@ import { observer as observer12 } from "@legendapp/state/react";
|
|
|
3893
3903
|
|
|
3894
3904
|
// src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts
|
|
3895
3905
|
import { useEffect as useEffect8 } from "react";
|
|
3896
|
-
import { useAccount as
|
|
3906
|
+
import { useAccount as useAccount6 } from "wagmi";
|
|
3897
3907
|
|
|
3898
3908
|
// src/react/ui/components/_internals/action-button/store.ts
|
|
3899
3909
|
import { observable as observable9 } from "@legendapp/state";
|
|
@@ -3928,7 +3938,7 @@ var useActionButtonLogic = ({
|
|
|
3928
3938
|
action,
|
|
3929
3939
|
onCannotPerformAction
|
|
3930
3940
|
}) => {
|
|
3931
|
-
const { address } =
|
|
3941
|
+
const { address } = useAccount6();
|
|
3932
3942
|
const actionsThatOwnersCannotPerform = [
|
|
3933
3943
|
"Buy" /* BUY */,
|
|
3934
3944
|
"Make an offer" /* OFFER */
|
|
@@ -3973,7 +3983,7 @@ var useActionButtonLogic = ({
|
|
|
3973
3983
|
|
|
3974
3984
|
// src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx
|
|
3975
3985
|
import { Button as Button5 } from "@0xsequence/design-system";
|
|
3976
|
-
import { useAccount as
|
|
3986
|
+
import { useAccount as useAccount7 } from "wagmi";
|
|
3977
3987
|
import { useOpenConnectModal } from "@0xsequence/kit";
|
|
3978
3988
|
|
|
3979
3989
|
// src/react/ui/components/_internals/action-button/styles.css.ts
|
|
@@ -3988,7 +3998,7 @@ function ActionButtonBody({
|
|
|
3988
3998
|
icon,
|
|
3989
3999
|
action
|
|
3990
4000
|
}) {
|
|
3991
|
-
const { address } =
|
|
4001
|
+
const { address } = useAccount7();
|
|
3992
4002
|
const { setOpenConnectModal } = useOpenConnectModal();
|
|
3993
4003
|
const handleClick = (e) => {
|
|
3994
4004
|
e.preventDefault();
|
|
@@ -4237,7 +4247,7 @@ var ActionButton = observer12(
|
|
|
4237
4247
|
);
|
|
4238
4248
|
|
|
4239
4249
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
4240
|
-
import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as
|
|
4250
|
+
import { Box as Box21, IconButton as IconButton5, Image as Image6, Text as Text16 } from "@0xsequence/design-system";
|
|
4241
4251
|
import { formatUnits as formatUnits5 } from "viem";
|
|
4242
4252
|
|
|
4243
4253
|
// src/react/ui/icons/Bell.tsx
|
|
@@ -4281,6 +4291,11 @@ var Bell_default = SvgBellIcon;
|
|
|
4281
4291
|
|
|
4282
4292
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
4283
4293
|
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4294
|
+
var formatPrice = (amount, currency) => {
|
|
4295
|
+
const formattedPrice = formatUnits5(BigInt(amount), currency.decimals);
|
|
4296
|
+
const numericPrice = Number.parseFloat(formattedPrice);
|
|
4297
|
+
return numericPrice < 1e-4 ? `< 0.0001 ${currency.symbol}` : `${formattedPrice} ${currency.symbol}`;
|
|
4298
|
+
};
|
|
4284
4299
|
var Footer = ({
|
|
4285
4300
|
name,
|
|
4286
4301
|
type,
|
|
@@ -4319,7 +4334,7 @@ var Footer = ({
|
|
|
4319
4334
|
width: "full",
|
|
4320
4335
|
children: [
|
|
4321
4336
|
/* @__PURE__ */ jsx35(
|
|
4322
|
-
|
|
4337
|
+
Text16,
|
|
4323
4338
|
{
|
|
4324
4339
|
color: "text100",
|
|
4325
4340
|
fontSize: "normal",
|
|
@@ -4352,7 +4367,7 @@ var Footer = ({
|
|
|
4352
4367
|
/* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
4353
4368
|
listed && lowestListingCurrency.imageUrl && /* @__PURE__ */ jsx35(Image6, { src: lowestListingCurrency.imageUrl, width: "3", height: "3" }),
|
|
4354
4369
|
/* @__PURE__ */ jsxs23(
|
|
4355
|
-
|
|
4370
|
+
Text16,
|
|
4356
4371
|
{
|
|
4357
4372
|
color: listed ? "text100" : "text50",
|
|
4358
4373
|
fontSize: "small",
|
|
@@ -4360,10 +4375,7 @@ var Footer = ({
|
|
|
4360
4375
|
textAlign: "left",
|
|
4361
4376
|
fontFamily: "body",
|
|
4362
4377
|
children: [
|
|
4363
|
-
listed &&
|
|
4364
|
-
BigInt(lowestListingPriceAmount),
|
|
4365
|
-
lowestListingCurrency.decimals
|
|
4366
|
-
)} ${lowestListingCurrency.symbol}`,
|
|
4378
|
+
listed && formatPrice(lowestListingPriceAmount, lowestListingCurrency),
|
|
4367
4379
|
!listed && "Not listed yet"
|
|
4368
4380
|
]
|
|
4369
4381
|
}
|
|
@@ -4380,7 +4392,7 @@ var TokenTypeBalancePill = ({
|
|
|
4380
4392
|
}) => {
|
|
4381
4393
|
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${balance}` : "ERC-1155" : "ERC-721";
|
|
4382
4394
|
return /* @__PURE__ */ jsx35(
|
|
4383
|
-
|
|
4395
|
+
Text16,
|
|
4384
4396
|
{
|
|
4385
4397
|
background: "backgroundSecondary",
|
|
4386
4398
|
color: "text80",
|
|
@@ -4576,4 +4588,4 @@ export {
|
|
|
4576
4588
|
useBuyModal,
|
|
4577
4589
|
CollectibleCard
|
|
4578
4590
|
};
|
|
4579
|
-
//# sourceMappingURL=chunk-
|
|
4591
|
+
//# sourceMappingURL=chunk-BVXIRVEC.js.map
|