@0xsequence/marketplace-sdk 0.8.1 → 0.8.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/.changeset/flat-parks-clean.md +8 -0
- package/.changeset/red-buckets-deny.md +6 -0
- package/CHANGELOG.md +17 -0
- package/dist/{builder-types-QlHwc9bI.d.ts → builder-types-BY6eD6vD.d.ts} +1 -1
- package/dist/{chunk-IZ44XPBH.js → chunk-25CAMYCG.js} +2 -2
- package/dist/{chunk-ABSYNRT5.js → chunk-5ATGT5S4.js} +3 -11
- package/dist/chunk-5ATGT5S4.js.map +1 -0
- package/dist/{chunk-BNAUZXPV.js → chunk-ALICO7NG.js} +3 -3
- package/dist/chunk-ALICO7NG.js.map +1 -0
- package/dist/{chunk-Q5RKAMYF.js → chunk-BGY4WXER.js} +43 -1
- package/dist/chunk-BGY4WXER.js.map +1 -0
- package/dist/{chunk-X3QNSQER.js → chunk-DFI52A2E.js} +56 -86
- package/dist/chunk-DFI52A2E.js.map +1 -0
- package/dist/{chunk-A5ACY5YV.js → chunk-FH4TZRDV.js} +2 -2
- package/dist/{chunk-3JU7SQVE.js → chunk-FSJKN4YN.js} +61 -24
- package/dist/chunk-FSJKN4YN.js.map +1 -0
- package/dist/{chunk-3II5GLHE.js → chunk-HGKWWZWY.js} +2 -2
- package/dist/{chunk-BN36GABQ.js → chunk-QTV77W42.js} +89 -65
- package/dist/chunk-QTV77W42.js.map +1 -0
- package/dist/{chunk-BCO4CYE4.js → chunk-SJU6QZHM.js} +2 -2
- package/dist/{chunk-2VHHJNXY.js → chunk-WXKV5N4T.js} +3 -3
- package/dist/{chunk-GBQVYNCD.js → chunk-XUNDLCEH.js} +3 -3
- package/dist/{create-config-ClkUr27C.d.ts → create-config-qDML4ZNn.d.ts} +1 -1
- package/dist/{index-CnaFSNE9.d.ts → index-DtWR0b_l.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -10
- package/dist/{listCollectibles-B0tbqnRd.d.ts → lowestListing-DUZ_nYml.d.ts} +49 -42
- package/dist/{marketplace.gen-BTHxxhG2.d.ts → marketplace.gen-DS-MmGEB.d.ts} +35 -4
- package/dist/react/_internal/api/index.d.ts +2 -2
- package/dist/react/_internal/api/index.js +1 -1
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +10 -10
- package/dist/react/_internal/index.d.ts +5 -5
- package/dist/react/_internal/index.js +2 -2
- 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 +68 -183
- package/dist/react/hooks/index.js +11 -13
- package/dist/react/hooks/options/index.d.ts +3 -3
- package/dist/react/hooks/options/index.js +4 -4
- package/dist/react/index.d.ts +8 -8
- package/dist/react/index.js +15 -17
- package/dist/react/queries/index.d.ts +2 -2
- package/dist/react/queries/index.js +11 -28
- package/dist/react/queries/index.js.map +1 -1
- package/dist/react/ssr/index.d.ts +2 -2
- package/dist/react/ssr/index.js +3 -3
- package/dist/react/ui/components/collectible-card/index.d.ts +1 -1
- package/dist/react/ui/components/collectible-card/index.js +13 -13
- package/dist/react/ui/icons/index.js +6 -6
- package/dist/react/ui/index.d.ts +1 -1
- package/dist/react/ui/index.js +13 -13
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +10 -10
- package/dist/{services-ybGoDJd9.d.ts → services-BOX67E7W.d.ts} +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +2 -4
- package/dist/{types-o_pKUpQG.d.ts → types-CJLhc2VZ.d.ts} +2 -2
- package/dist/utils/abi/index.js +5 -5
- package/dist/utils/index.d.ts +54 -2
- package/dist/utils/index.js +12 -8
- package/package.json +4 -2
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +5 -2
- package/src/react/_internal/api/marketplace.gen.ts +39 -6
- package/src/react/_internal/api/zod-schema.ts +7 -18
- package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +10 -2
- package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +10 -2
- package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +5 -1
- package/src/react/hooks/__tests__/useHighestOffer.test.tsx +7 -8
- package/src/react/hooks/__tests__/useLowestListing.test.tsx +4 -5
- package/src/react/hooks/useCancelTransactionSteps.tsx +2 -2
- package/src/react/hooks/useHighestOffer.tsx +1 -39
- package/src/react/hooks/useLowestListing.tsx +4 -51
- package/src/react/queries/highestOffer.ts +25 -30
- package/src/react/queries/index.ts +1 -0
- package/src/react/queries/lowestListing.ts +52 -0
- package/src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx +6 -9
- package/src/react/ui/modals/BuyModal/Modal.tsx +26 -8
- package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +6 -2
- package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +2 -2
- package/src/react/ui/modals/MakeOfferModal/Modal.tsx +4 -4
- package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +2 -2
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +2 -2
- package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +1 -5
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +4 -4
- package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +18 -14
- package/src/types/api-types.ts +1 -2
- package/src/types/types.ts +5 -0
- package/src/utils/price.ts +103 -0
- package/dist/chunk-3JU7SQVE.js.map +0 -1
- package/dist/chunk-ABSYNRT5.js.map +0 -1
- package/dist/chunk-BN36GABQ.js.map +0 -1
- package/dist/chunk-BNAUZXPV.js.map +0 -1
- package/dist/chunk-Q5RKAMYF.js.map +0 -1
- package/dist/chunk-X3QNSQER.js.map +0 -1
- /package/dist/{chunk-IZ44XPBH.js.map → chunk-25CAMYCG.js.map} +0 -0
- /package/dist/{chunk-A5ACY5YV.js.map → chunk-FH4TZRDV.js.map} +0 -0
- /package/dist/{chunk-3II5GLHE.js.map → chunk-HGKWWZWY.js.map} +0 -0
- /package/dist/{chunk-BCO4CYE4.js.map → chunk-SJU6QZHM.js.map} +0 -0
- /package/dist/{chunk-2VHHJNXY.js.map → chunk-WXKV5N4T.js.map} +0 -0
- /package/dist/{chunk-GBQVYNCD.js.map → chunk-XUNDLCEH.js.map} +0 -0
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ActionModal
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5ATGT5S4.js";
|
|
6
6
|
import {
|
|
7
7
|
useAnalytics
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FH4TZRDV.js";
|
|
9
9
|
import {
|
|
10
10
|
BellIcon_default,
|
|
11
11
|
CalendarIcon_default,
|
|
12
12
|
CartIcon_default
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WXKV5N4T.js";
|
|
14
14
|
import {
|
|
15
15
|
AlertMessage,
|
|
16
16
|
MODAL_OVERLAY_PROPS,
|
|
@@ -33,15 +33,17 @@ import {
|
|
|
33
33
|
useSwitchChainModal,
|
|
34
34
|
useTransferTokens,
|
|
35
35
|
useWallet
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DFI52A2E.js";
|
|
37
37
|
import {
|
|
38
38
|
DEFAULT_MARKETPLACE_FEE_PERCENTAGE
|
|
39
39
|
} from "./chunk-Y63BOO6M.js";
|
|
40
40
|
import {
|
|
41
|
+
calculateEarningsAfterFees,
|
|
41
42
|
cn,
|
|
42
43
|
compareAddress,
|
|
44
|
+
formatPriceWithFee,
|
|
43
45
|
truncateMiddle
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-BGY4WXER.js";
|
|
45
47
|
import {
|
|
46
48
|
InvalidContractTypeError,
|
|
47
49
|
InvalidStepError,
|
|
@@ -49,14 +51,16 @@ import {
|
|
|
49
51
|
collectableKeys,
|
|
50
52
|
getMarketplaceClient,
|
|
51
53
|
getQueryClient
|
|
52
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-ALICO7NG.js";
|
|
53
55
|
|
|
54
56
|
// src/react/ui/modals/modal-provider.tsx
|
|
55
57
|
import { observer as observer17 } from "@legendapp/state/react";
|
|
56
58
|
|
|
57
59
|
// src/react/ui/modals/BuyModal/Modal.tsx
|
|
58
|
-
import {
|
|
59
|
-
|
|
60
|
+
import {
|
|
61
|
+
useSelectPaymentModal
|
|
62
|
+
} from "@0xsequence/checkout";
|
|
63
|
+
import { useEffect, useRef } from "react";
|
|
60
64
|
|
|
61
65
|
// src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx
|
|
62
66
|
import { Text } from "@0xsequence/design-system";
|
|
@@ -116,7 +120,6 @@ var LoadingModal = ({
|
|
|
116
120
|
|
|
117
121
|
// src/react/ui/modals/BuyModal/ERC1155QuantityModal.tsx
|
|
118
122
|
import { use$, useObservable } from "@legendapp/state/react";
|
|
119
|
-
import * as dn2 from "dnum";
|
|
120
123
|
import { Text as Text2, TokenImage } from "@0xsequence/design-system";
|
|
121
124
|
|
|
122
125
|
// src/react/ui/modals/_internal/components/quantityInput/index.tsx
|
|
@@ -364,17 +367,16 @@ var TotalPrice = ({
|
|
|
364
367
|
let formattedPrice = "0";
|
|
365
368
|
if (currency) {
|
|
366
369
|
try {
|
|
367
|
-
const price = dn2.from(order.priceAmount, currency.decimals);
|
|
368
|
-
const totalPriceWithoutFees = dn2.multiply(quantityStr, price);
|
|
369
370
|
const marketplaceFeePercentage = marketplaceConfig?.collections.find(
|
|
370
371
|
(collection) => compareAddress(collection.address, order.collectionContractAddress)
|
|
371
372
|
)?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
const quantity = BigInt(quantityStr);
|
|
374
|
+
const totalPriceRaw = BigInt(order.priceAmount) * quantity;
|
|
375
|
+
formattedPrice = formatPriceWithFee(
|
|
376
|
+
totalPriceRaw,
|
|
377
|
+
currency.decimals,
|
|
378
|
+
marketplaceFeePercentage
|
|
375
379
|
);
|
|
376
|
-
const totalPrice = dn2.multiply(totalPriceWithoutFees, feeMultiplier);
|
|
377
|
-
formattedPrice = dn2.format(totalPrice, { trailingZeros: false });
|
|
378
380
|
} catch (e) {
|
|
379
381
|
console.error("Error formatting price", e);
|
|
380
382
|
error = "Unable to calculate total price";
|
|
@@ -549,7 +551,8 @@ var getBuyCollectableParams = async ({
|
|
|
549
551
|
quantity,
|
|
550
552
|
collectable,
|
|
551
553
|
checkoutOptions,
|
|
552
|
-
fee
|
|
554
|
+
fee,
|
|
555
|
+
skipNativeBalanceCheck
|
|
553
556
|
}) => {
|
|
554
557
|
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
555
558
|
const { steps: steps3 } = await marketplaceClient.generateBuyTransaction({
|
|
@@ -604,6 +607,7 @@ var getBuyCollectableParams = async ({
|
|
|
604
607
|
queryClient.invalidateQueries();
|
|
605
608
|
buyModalStore.send({ type: "close" });
|
|
606
609
|
},
|
|
610
|
+
skipNativeBalanceCheck,
|
|
607
611
|
...customCreditCardProviderCallback && {
|
|
608
612
|
customProviderCallback: () => {
|
|
609
613
|
customCreditCardProviderCallback(buyStep);
|
|
@@ -621,6 +625,7 @@ var usePaymentModalParams = (args) => {
|
|
|
621
625
|
priceCurrencyAddress,
|
|
622
626
|
quantity
|
|
623
627
|
} = args;
|
|
628
|
+
const buyModalProps = useBuyModalProps();
|
|
624
629
|
const {
|
|
625
630
|
chainId,
|
|
626
631
|
collectionAddress,
|
|
@@ -628,7 +633,7 @@ var usePaymentModalParams = (args) => {
|
|
|
628
633
|
orderId,
|
|
629
634
|
customCreditCardProviderCallback,
|
|
630
635
|
skipNativeBalanceCheck
|
|
631
|
-
} =
|
|
636
|
+
} = buyModalProps;
|
|
632
637
|
const config = useConfig();
|
|
633
638
|
const fee = useFees({
|
|
634
639
|
chainId,
|
|
@@ -638,7 +643,7 @@ var usePaymentModalParams = (args) => {
|
|
|
638
643
|
const onError = useOnError();
|
|
639
644
|
const enabled = !!wallet && !!marketplace && !!collectable && !!checkoutOptions && !!priceCurrencyAddress && !!quantity;
|
|
640
645
|
return useQuery2({
|
|
641
|
-
queryKey: ["buyCollectableParams",
|
|
646
|
+
queryKey: ["buyCollectableParams", buyModalProps, args, fee],
|
|
642
647
|
queryFn: enabled ? () => getBuyCollectableParams({
|
|
643
648
|
chainId,
|
|
644
649
|
config,
|
|
@@ -672,9 +677,8 @@ var BuyModal = () => {
|
|
|
672
677
|
return /* @__PURE__ */ jsx5(BuyModalContent, {});
|
|
673
678
|
};
|
|
674
679
|
var BuyModalContent = () => {
|
|
675
|
-
const { chainId
|
|
680
|
+
const { chainId } = useBuyModalProps();
|
|
676
681
|
const onError = useOnError();
|
|
677
|
-
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
678
682
|
const quantity = useQuantity();
|
|
679
683
|
const {
|
|
680
684
|
collection,
|
|
@@ -729,12 +733,22 @@ var BuyModalContent = () => {
|
|
|
729
733
|
return /* @__PURE__ */ jsx5(ERC1155QuantityModal, { order });
|
|
730
734
|
}
|
|
731
735
|
if (paymentModalParams) {
|
|
732
|
-
|
|
733
|
-
...paymentModalParams,
|
|
734
|
-
skipNativeBalanceCheck
|
|
735
|
-
});
|
|
736
|
+
return /* @__PURE__ */ jsx5(PaymentModalOpener, { paymentModalParams });
|
|
736
737
|
}
|
|
737
738
|
};
|
|
739
|
+
var PaymentModalOpener = ({
|
|
740
|
+
paymentModalParams
|
|
741
|
+
}) => {
|
|
742
|
+
const { openSelectPaymentModal } = useSelectPaymentModal();
|
|
743
|
+
const hasOpenedRef = useRef(false);
|
|
744
|
+
useEffect(() => {
|
|
745
|
+
if (!hasOpenedRef.current) {
|
|
746
|
+
hasOpenedRef.current = true;
|
|
747
|
+
openSelectPaymentModal(paymentModalParams);
|
|
748
|
+
}
|
|
749
|
+
}, []);
|
|
750
|
+
return null;
|
|
751
|
+
};
|
|
738
752
|
|
|
739
753
|
// src/react/ui/modals/CreateListingModal/Modal.tsx
|
|
740
754
|
import { Show, observer as observer7 } from "@legendapp/state/react";
|
|
@@ -755,7 +769,7 @@ import {
|
|
|
755
769
|
DropdownMenuRoot,
|
|
756
770
|
DropdownMenuTrigger
|
|
757
771
|
} from "@0xsequence/design-system";
|
|
758
|
-
import { differenceInDays, format
|
|
772
|
+
import { differenceInDays, format, isSameDay, startOfDay } from "date-fns";
|
|
759
773
|
|
|
760
774
|
// src/react/ui/modals/_internal/components/calendar/index.tsx
|
|
761
775
|
import { DayPicker } from "react-day-picker";
|
|
@@ -848,7 +862,7 @@ function CalendarDropdown({
|
|
|
848
862
|
leftIcon: CalendarIcon_default,
|
|
849
863
|
className: "h-9 flex-1 rounded-sm p-2 font-medium text-xs",
|
|
850
864
|
variant: "base",
|
|
851
|
-
label:
|
|
865
|
+
label: format(selectedDate, "dd/MM/yyyy HH:mm"),
|
|
852
866
|
shape: "square",
|
|
853
867
|
onClick: () => setIsOpen(!isOpen)
|
|
854
868
|
}
|
|
@@ -1002,18 +1016,18 @@ function FloorPriceText({
|
|
|
1002
1016
|
tokenId,
|
|
1003
1017
|
chainId,
|
|
1004
1018
|
collectionAddress,
|
|
1005
|
-
|
|
1019
|
+
filter: {
|
|
1006
1020
|
currencies: [price.currency.contractAddress]
|
|
1007
1021
|
}
|
|
1008
1022
|
});
|
|
1009
|
-
const floorPriceRaw = listing?.
|
|
1010
|
-
const floorPriceFormatted = listing?.
|
|
1023
|
+
const floorPriceRaw = listing?.priceAmount;
|
|
1024
|
+
const floorPriceFormatted = listing?.priceAmountFormatted;
|
|
1011
1025
|
const { data: priceComparison, isLoading: comparisonLoading } = useComparePrices({
|
|
1012
1026
|
chainId,
|
|
1013
1027
|
priceAmountRaw: price.amountRaw || "0",
|
|
1014
1028
|
priceCurrencyAddress: price.currency.contractAddress,
|
|
1015
1029
|
compareToPriceAmountRaw: floorPriceRaw || "0",
|
|
1016
|
-
compareToPriceCurrencyAddress: listing?.
|
|
1030
|
+
compareToPriceCurrencyAddress: listing?.priceCurrencyAddress || price.currency.contractAddress,
|
|
1017
1031
|
query: {
|
|
1018
1032
|
enabled: !!floorPriceRaw && !listingLoading && price.amountRaw !== "0"
|
|
1019
1033
|
}
|
|
@@ -1057,7 +1071,7 @@ function FloorPriceText({
|
|
|
1057
1071
|
// src/react/ui/modals/_internal/components/priceInput/index.tsx
|
|
1058
1072
|
import { NumericInput as NumericInput2, Text as Text6 } from "@0xsequence/design-system";
|
|
1059
1073
|
import { use$ as use$2 } from "@legendapp/state/react";
|
|
1060
|
-
import { useEffect as useEffect3, useRef, useState as useState5 } from "react";
|
|
1074
|
+
import { useEffect as useEffect3, useRef as useRef2, useState as useState5 } from "react";
|
|
1061
1075
|
import { parseUnits } from "viem";
|
|
1062
1076
|
import { useAccount } from "wagmi";
|
|
1063
1077
|
|
|
@@ -1299,7 +1313,7 @@ function PriceInput({
|
|
|
1299
1313
|
disabled
|
|
1300
1314
|
}) {
|
|
1301
1315
|
const { address: accountAddress } = useAccount();
|
|
1302
|
-
const inputRef =
|
|
1316
|
+
const inputRef = useRef2(null);
|
|
1303
1317
|
const currencyDecimals = use$2($price.currency.decimals);
|
|
1304
1318
|
const currencyAddress = use$2($price.currency.contractAddress);
|
|
1305
1319
|
const priceAmountRaw = use$2($price.amountRaw);
|
|
@@ -1318,7 +1332,7 @@ function PriceInput({
|
|
|
1318
1332
|
checkBalance.callback(balanceError);
|
|
1319
1333
|
}
|
|
1320
1334
|
const [value, setValue] = useState5("0");
|
|
1321
|
-
const prevCurrencyDecimals =
|
|
1335
|
+
const prevCurrencyDecimals = useRef2(currencyDecimals);
|
|
1322
1336
|
useEffect3(() => {
|
|
1323
1337
|
if (prevCurrencyDecimals.current !== currencyDecimals && value !== "0") {
|
|
1324
1338
|
try {
|
|
@@ -1661,7 +1675,7 @@ var SelectWaasFeeOptions = observer5(
|
|
|
1661
1675
|
),
|
|
1662
1676
|
children: [
|
|
1663
1677
|
/* @__PURE__ */ jsx17(Divider, { className: "mt-0 mb-4" }),
|
|
1664
|
-
/* @__PURE__ */ jsx17(Text9, { className: "mb-2 font-body text-large
|
|
1678
|
+
/* @__PURE__ */ jsx17(Text9, { className: "mb-2 font-body font-bold text-large text-text-100", children: feeOptionsConfirmed ? titleOnConfirm : "Select a fee option" }),
|
|
1665
1679
|
!feeOptionsConfirmed && !pendingFeeOptionConfirmation && /* @__PURE__ */ jsx17(Skeleton4, { className: "h-[52px] w-full animate-shimmer rounded-xl" }),
|
|
1666
1680
|
(feeOptionsConfirmed || pendingFeeOptionConfirmation) && /* @__PURE__ */ jsx17(
|
|
1667
1681
|
"div",
|
|
@@ -1765,7 +1779,6 @@ function TokenPreview({
|
|
|
1765
1779
|
|
|
1766
1780
|
// src/react/ui/modals/_internal/components/transactionDetails/index.tsx
|
|
1767
1781
|
import { Image as Image3, Skeleton as Skeleton6, Text as Text11 } from "@0xsequence/design-system";
|
|
1768
|
-
import { formatUnits as formatUnits3 } from "viem";
|
|
1769
1782
|
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1770
1783
|
function TransactionDetails({
|
|
1771
1784
|
collectibleId,
|
|
@@ -1786,12 +1799,20 @@ function TransactionDetails({
|
|
|
1786
1799
|
collectibleId
|
|
1787
1800
|
});
|
|
1788
1801
|
const priceLoading = !price || marketplaceConfigLoading || royaltyLoading;
|
|
1789
|
-
let formattedAmount =
|
|
1790
|
-
if (
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1802
|
+
let formattedAmount = "0";
|
|
1803
|
+
if (price) {
|
|
1804
|
+
const fees = [];
|
|
1805
|
+
if (royalty !== null) {
|
|
1806
|
+
fees.push(Number(royalty.percentage));
|
|
1807
|
+
}
|
|
1808
|
+
if (marketplaceFeePercentage > 0) {
|
|
1809
|
+
fees.push(marketplaceFeePercentage);
|
|
1810
|
+
}
|
|
1811
|
+
formattedAmount = calculateEarningsAfterFees(
|
|
1812
|
+
BigInt(price.amountRaw),
|
|
1813
|
+
price.currency.decimals,
|
|
1814
|
+
fees
|
|
1815
|
+
);
|
|
1795
1816
|
}
|
|
1796
1817
|
return /* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center justify-between", children: [
|
|
1797
1818
|
/* @__PURE__ */ jsx19(Text11, { className: "font-body font-medium text-xs", color: "text50", children: "Total earnings" }),
|
|
@@ -1892,7 +1913,7 @@ var useGetTokenApprovalData = (params) => {
|
|
|
1892
1913
|
};
|
|
1893
1914
|
|
|
1894
1915
|
// src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx
|
|
1895
|
-
import { formatUnits as
|
|
1916
|
+
import { formatUnits as formatUnits5 } from "viem";
|
|
1896
1917
|
|
|
1897
1918
|
// src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx
|
|
1898
1919
|
import { Modal, Skeleton as Skeleton8, Text as Text15 } from "@0xsequence/design-system";
|
|
@@ -1949,7 +1970,7 @@ var PositiveCircle = () => /* @__PURE__ */ jsx20("div", { className: "flex h-5 w
|
|
|
1949
1970
|
// src/react/ui/modals/_internal/components/transactionPreview/index.tsx
|
|
1950
1971
|
import { Image as Image4, NetworkImage, Skeleton as Skeleton7, Text as Text14 } from "@0xsequence/design-system";
|
|
1951
1972
|
import { observer as observer6 } from "@legendapp/state/react";
|
|
1952
|
-
import { formatUnits as
|
|
1973
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
1953
1974
|
|
|
1954
1975
|
// src/react/ui/modals/_internal/components/timeAgo/index.tsx
|
|
1955
1976
|
import { Text as Text13 } from "@0xsequence/design-system";
|
|
@@ -2091,7 +2112,7 @@ var TransactionPreview = observer6(
|
|
|
2091
2112
|
const collectibleImage = collectible?.image;
|
|
2092
2113
|
const collectibleName = collectible?.name;
|
|
2093
2114
|
const collectionName = collection?.name;
|
|
2094
|
-
const priceFormatted = price ?
|
|
2115
|
+
const priceFormatted = price ? formatUnits3(BigInt(price?.amountRaw), price?.currency.decimals) : void 0;
|
|
2095
2116
|
if (collectibleLoading || collectionLoading) {
|
|
2096
2117
|
return /* @__PURE__ */ jsx22("div", { className: "w-full rounded-xl", style: { height: 83 }, children: /* @__PURE__ */ jsx22(Skeleton7, { style: { width: "100%", height: "100%" } }) });
|
|
2097
2118
|
}
|
|
@@ -2222,7 +2243,7 @@ var useTransactionStatus = (hash, chainId, callbacks) => {
|
|
|
2222
2243
|
var useTransactionStatus_default = useTransactionStatus;
|
|
2223
2244
|
|
|
2224
2245
|
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts
|
|
2225
|
-
import { formatUnits as
|
|
2246
|
+
import { formatUnits as formatUnits4 } from "viem";
|
|
2226
2247
|
|
|
2227
2248
|
// src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts
|
|
2228
2249
|
function getFormattedType(transactionType, verb = false) {
|
|
@@ -2253,7 +2274,7 @@ function getTransactionStatusModalMessage({
|
|
|
2253
2274
|
price
|
|
2254
2275
|
}) {
|
|
2255
2276
|
const hideCollectibleName = transactionType === "CANCEL";
|
|
2256
|
-
const formattedPrice = price ?
|
|
2277
|
+
const formattedPrice = price ? formatUnits4(BigInt(price.amountRaw), price.currency.decimals) : "";
|
|
2257
2278
|
if (orderId) {
|
|
2258
2279
|
return `You just ${getFormattedType(transactionType, true)}${!hideCollectibleName ? ` ${collectibleName}` : ""}. It's been confirmed on the blockchain!`;
|
|
2259
2280
|
}
|
|
@@ -2567,7 +2588,7 @@ var useTransactionSteps = ({
|
|
|
2567
2588
|
)?.decimals || 0;
|
|
2568
2589
|
const currencyValueRaw = Number(listingInput.listing.pricePerToken);
|
|
2569
2590
|
const currencyValueDecimal = Number(
|
|
2570
|
-
|
|
2591
|
+
formatUnits5(BigInt(currencyValueRaw), currencyDecimal)
|
|
2571
2592
|
);
|
|
2572
2593
|
analytics.trackCreateListing({
|
|
2573
2594
|
props: {
|
|
@@ -2611,7 +2632,8 @@ var useTransactionSteps = ({
|
|
|
2611
2632
|
);
|
|
2612
2633
|
const result = await marketplaceClient.execute({
|
|
2613
2634
|
signature,
|
|
2614
|
-
|
|
2635
|
+
method: signatureStep.post?.method,
|
|
2636
|
+
endpoint: signatureStep.post?.endpoint,
|
|
2615
2637
|
body: signatureStep.post?.body
|
|
2616
2638
|
});
|
|
2617
2639
|
return result.orderId;
|
|
@@ -3029,7 +3051,7 @@ var useGetTokenApprovalData2 = (params) => {
|
|
|
3029
3051
|
};
|
|
3030
3052
|
|
|
3031
3053
|
// src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx
|
|
3032
|
-
import { formatUnits as
|
|
3054
|
+
import { formatUnits as formatUnits6 } from "viem";
|
|
3033
3055
|
var useTransactionSteps2 = ({
|
|
3034
3056
|
offerInput,
|
|
3035
3057
|
chainId,
|
|
@@ -3157,7 +3179,7 @@ var useTransactionSteps2 = ({
|
|
|
3157
3179
|
const currencyDecimal = currency?.decimals || 0;
|
|
3158
3180
|
const currencyValueRaw = Number(offerInput.offer.pricePerToken);
|
|
3159
3181
|
const currencyValueDecimal = Number(
|
|
3160
|
-
|
|
3182
|
+
formatUnits6(BigInt(currencyValueRaw), currencyDecimal)
|
|
3161
3183
|
);
|
|
3162
3184
|
analytics.trackCreateOffer({
|
|
3163
3185
|
props: {
|
|
@@ -3201,7 +3223,8 @@ var useTransactionSteps2 = ({
|
|
|
3201
3223
|
);
|
|
3202
3224
|
const result = await marketplaceClient.execute({
|
|
3203
3225
|
signature,
|
|
3204
|
-
|
|
3226
|
+
method: signatureStep.post?.method,
|
|
3227
|
+
endpoint: signatureStep.post?.endpoint,
|
|
3205
3228
|
body: signatureStep.post?.body
|
|
3206
3229
|
});
|
|
3207
3230
|
return result.orderId;
|
|
@@ -3404,7 +3427,7 @@ var Modal3 = observer8(() => {
|
|
|
3404
3427
|
tokenId: collectibleId,
|
|
3405
3428
|
chainId,
|
|
3406
3429
|
collectionAddress,
|
|
3407
|
-
|
|
3430
|
+
filter: {
|
|
3408
3431
|
currencies: [offerPrice2.currency.contractAddress]
|
|
3409
3432
|
}
|
|
3410
3433
|
});
|
|
@@ -3523,13 +3546,13 @@ var Modal3 = observer8(() => {
|
|
|
3523
3546
|
price: offerPrice2,
|
|
3524
3547
|
onBuyNow: () => {
|
|
3525
3548
|
makeOfferModal$.close();
|
|
3526
|
-
if (lowestListing
|
|
3549
|
+
if (lowestListing) {
|
|
3527
3550
|
buyModal.show({
|
|
3528
3551
|
chainId,
|
|
3529
3552
|
collectionAddress,
|
|
3530
3553
|
collectibleId,
|
|
3531
|
-
orderId: lowestListing.
|
|
3532
|
-
marketplace: lowestListing.
|
|
3554
|
+
orderId: lowestListing.orderId,
|
|
3555
|
+
marketplace: lowestListing.marketplace
|
|
3533
3556
|
});
|
|
3534
3557
|
}
|
|
3535
3558
|
}
|
|
@@ -3652,7 +3675,7 @@ var useGetTokenApprovalData3 = (params) => {
|
|
|
3652
3675
|
};
|
|
3653
3676
|
|
|
3654
3677
|
// src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx
|
|
3655
|
-
import { formatUnits as
|
|
3678
|
+
import { formatUnits as formatUnits7 } from "viem";
|
|
3656
3679
|
var useTransactionSteps3 = ({
|
|
3657
3680
|
collectibleId,
|
|
3658
3681
|
chainId,
|
|
@@ -3777,7 +3800,7 @@ var useTransactionSteps3 = ({
|
|
|
3777
3800
|
const currencySymbol = currency?.symbol || "";
|
|
3778
3801
|
const currencyValueRaw = Number(ordersData[0].pricePerToken);
|
|
3779
3802
|
const currencyValueDecimal = Number(
|
|
3780
|
-
|
|
3803
|
+
formatUnits7(BigInt(currencyValueRaw), currencyDecimal)
|
|
3781
3804
|
);
|
|
3782
3805
|
analytics.trackSellItems({
|
|
3783
3806
|
props: {
|
|
@@ -3821,7 +3844,8 @@ var useTransactionSteps3 = ({
|
|
|
3821
3844
|
);
|
|
3822
3845
|
const result = await marketplaceClient.execute({
|
|
3823
3846
|
signature,
|
|
3824
|
-
|
|
3847
|
+
method: signatureStep.post?.method,
|
|
3848
|
+
endpoint: signatureStep.post?.endpoint,
|
|
3825
3849
|
body: signatureStep.post?.body
|
|
3826
3850
|
});
|
|
3827
3851
|
return result.orderId;
|
|
@@ -5056,7 +5080,7 @@ var ActionButton = observer18(
|
|
|
5056
5080
|
|
|
5057
5081
|
// src/react/ui/components/collectible-card/CollectibleAsset.tsx
|
|
5058
5082
|
import { Skeleton as Skeleton10 } from "@0xsequence/design-system";
|
|
5059
|
-
import { useEffect as useEffect12, useRef as
|
|
5083
|
+
import { useEffect as useEffect12, useRef as useRef3, useState as useState10 } from "react";
|
|
5060
5084
|
import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5061
5085
|
function CollectibleAssetSkeleton() {
|
|
5062
5086
|
return /* @__PURE__ */ jsx40(
|
|
@@ -5085,7 +5109,7 @@ function CollectibleAsset({
|
|
|
5085
5109
|
}) {
|
|
5086
5110
|
const [assetLoadFailed, setAssetLoadFailed] = useState10(false);
|
|
5087
5111
|
const [assetLoading, setAssetLoading] = useState10(true);
|
|
5088
|
-
const videoRef =
|
|
5112
|
+
const videoRef = useRef3(null);
|
|
5089
5113
|
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
5090
5114
|
const placeholderImage = chess_tile_default;
|
|
5091
5115
|
const assetUrl = collectibleMetadata?.image || collectibleMetadata?.video || collectibleMetadata?.animation_url || collectibleMetadata?.assets?.[0]?.url || placeholderImage;
|
|
@@ -5166,12 +5190,12 @@ import {
|
|
|
5166
5190
|
Image as Image7,
|
|
5167
5191
|
Text as Text21
|
|
5168
5192
|
} from "@0xsequence/design-system";
|
|
5169
|
-
import { formatUnits as
|
|
5193
|
+
import { formatUnits as formatUnits8 } from "viem";
|
|
5170
5194
|
import { jsx as jsx41, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5171
5195
|
var OVERFLOW_PRICE = 1e8;
|
|
5172
5196
|
var UNDERFLOW_PRICE = 1e-4;
|
|
5173
5197
|
var formatPrice = (amount, currency) => {
|
|
5174
|
-
const formattedPrice =
|
|
5198
|
+
const formattedPrice = formatUnits8(BigInt(amount), currency.decimals);
|
|
5175
5199
|
const numericPrice = Number.parseFloat(formattedPrice);
|
|
5176
5200
|
if (numericPrice < UNDERFLOW_PRICE) {
|
|
5177
5201
|
return /* @__PURE__ */ jsxs30("div", { className: "flex items-center", children: [
|
|
@@ -5268,7 +5292,7 @@ var TokenTypeBalancePill = ({
|
|
|
5268
5292
|
type,
|
|
5269
5293
|
decimals
|
|
5270
5294
|
}) => {
|
|
5271
|
-
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${
|
|
5295
|
+
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${formatUnits8(BigInt(balance), decimals ?? 0)}` : "ERC-1155" : "ERC-721";
|
|
5272
5296
|
return /* @__PURE__ */ jsx41(Text21, { className: "rounded-lg bg-background-secondary px-2 py-1 text-left font-medium text-text-80 text-xs", children: displayText });
|
|
5273
5297
|
};
|
|
5274
5298
|
|
|
@@ -5380,4 +5404,4 @@ export {
|
|
|
5380
5404
|
useSellModal,
|
|
5381
5405
|
CollectibleCard
|
|
5382
5406
|
};
|
|
5383
|
-
//# sourceMappingURL=chunk-
|
|
5407
|
+
//# sourceMappingURL=chunk-QTV77W42.js.map
|