@0xsequence/marketplace-sdk 0.5.5 → 0.5.7
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-Jl3Ymws8.d.ts → builder-types-DgncJB3q.d.ts} +1 -1
- package/dist/{chunk-TFRAOS7F.js → chunk-3OP3WHPU.js} +1 -1
- package/dist/chunk-3OP3WHPU.js.map +1 -0
- package/dist/{chunk-J6F5QOW5.js → chunk-3OU7BADC.js} +9 -75
- package/dist/chunk-3OU7BADC.js.map +1 -0
- package/dist/{chunk-Y75XGZOB.js → chunk-5O3ZAEEX.js} +4 -2
- package/dist/chunk-5O3ZAEEX.js.map +1 -0
- package/dist/{chunk-P7UNMRZ5.js → chunk-G2T7HCWE.js} +5 -7
- package/dist/chunk-G2T7HCWE.js.map +1 -0
- package/dist/chunk-GFADBQPX.js +2 -0
- package/dist/chunk-GFADBQPX.js.map +1 -0
- package/dist/{chunk-CIPPTQDA.js → chunk-L2K4DBH2.js} +162 -108
- package/dist/chunk-L2K4DBH2.js.map +1 -0
- package/dist/{chunk-SA3U25NU.js → chunk-LNMMWV77.js} +23 -8
- package/dist/chunk-LNMMWV77.js.map +1 -0
- package/dist/{chunk-7C7ADZ2H.js → chunk-OMCWTRBR.js} +9 -42
- package/dist/chunk-OMCWTRBR.js.map +1 -0
- package/dist/{chunk-7FN62HOP.js → chunk-UMYRZJVY.js} +11 -3
- package/dist/chunk-UMYRZJVY.js.map +1 -0
- package/dist/{chunk-UZIAX32Y.js → chunk-Y56IIYDF.js} +6 -4
- package/dist/{chunk-UZIAX32Y.js.map → chunk-Y56IIYDF.js.map} +1 -1
- package/dist/{chunk-AXTDPTRD.js → chunk-YA3DWLDC.js} +30 -26
- package/dist/chunk-YA3DWLDC.js.map +1 -0
- package/dist/{chunk-3BLBZYQX.js → chunk-YYBU45PK.js} +10 -4
- package/dist/chunk-YYBU45PK.js.map +1 -0
- package/dist/{create-config-DOUq8Day.d.ts → create-config-CILyA_Hy.d.ts} +2 -2
- package/dist/index.css +12 -6
- package/dist/index.d.ts +8 -7
- package/dist/index.js +9 -6
- package/dist/{marketplace.gen-CCJ-URn2.d.ts → marketplace.gen-BVOc6fUW.d.ts} +4 -0
- package/dist/{marketplace.gen-D0ADxbfH.d.ts → marketplace.gen-DLOcW6C4.d.ts} +15 -3
- package/dist/react/_internal/api/index.d.ts +3 -3
- package/dist/react/_internal/api/index.js +1 -1
- package/dist/react/_internal/databeat/index.css.map +1 -1
- package/dist/react/_internal/databeat/index.d.ts +1 -1
- package/dist/react/_internal/databeat/index.js +7 -7
- package/dist/react/_internal/index.d.ts +6 -6
- package/dist/react/_internal/index.js +2 -2
- package/dist/react/_internal/wagmi/index.d.ts +4 -4
- package/dist/react/_internal/wagmi/index.js +1 -1
- package/dist/react/hooks/index.css.map +1 -1
- package/dist/react/hooks/index.d.ts +10 -17
- package/dist/react/hooks/index.js +6 -6
- package/dist/react/index.css +12 -6
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +6 -6
- package/dist/react/index.js +11 -10
- package/dist/react/ssr/index.d.ts +1 -0
- package/dist/react/ssr/index.js +10 -2
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/collectible-card/index.css +12 -6
- package/dist/react/ui/components/collectible-card/index.css.map +1 -1
- package/dist/react/ui/components/collectible-card/index.d.ts +4 -4
- package/dist/react/ui/components/collectible-card/index.js +11 -10
- package/dist/react/ui/icons/index.css.map +1 -1
- package/dist/react/ui/index.css +12 -6
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +11 -10
- package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -1
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +4 -4
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +7 -7
- package/dist/react/ui/styles/index.css.map +1 -1
- package/dist/{sdk-config-xWkdBdrL.d.ts → sdk-config-Bs3H_le_.d.ts} +1 -0
- package/dist/{services-Dd2MoBTM.d.ts → services-C3lzi1sL.d.ts} +2 -2
- package/dist/styles/index.css +12 -6
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/index.d.ts +3 -2
- package/dist/styles/index.js +4 -2
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +2 -2
- package/dist/{types-vOfhbBkR.d.ts → types-BVD42zE_.d.ts} +3 -3
- package/dist/utils/index.d.ts +7 -8
- package/dist/utils/index.js +5 -5
- package/package.json +14 -14
- package/src/consts.ts +2 -0
- package/src/react/_internal/api/__mocks__/marketplace.msw.ts +13 -12
- package/src/react/_internal/api/marketplace.gen.ts +38 -13
- package/src/react/_internal/databeat/index.ts +11 -3
- package/src/react/_internal/utils.ts +3 -0
- package/src/react/_internal/wagmi/create-config.ts +11 -2
- package/src/react/_internal/wallet/__tests__/wallet.test.ts +343 -0
- package/src/react/_internal/wallet/useWallet.ts +22 -15
- package/src/react/_internal/wallet/wallet.ts +11 -9
- package/src/react/hooks/__tests__/useBalanceOfCollectible.test.tsx +6 -14
- package/src/react/hooks/__tests__/useCancelOrder.test.tsx +51 -154
- package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +21 -19
- package/src/react/hooks/__tests__/useCollectionBalanceDetails.test.tsx +5 -14
- package/src/react/hooks/__tests__/useCollectionDetailsPolling.test.tsx +5 -10
- package/src/react/hooks/__tests__/useCurrencyBalance.test.tsx +69 -80
- package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +12 -67
- package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +7 -17
- package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +7 -16
- package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +8 -17
- package/src/react/hooks/__tests__/useListBalances.test.tsx +3 -8
- package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +5 -10
- package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +6 -11
- package/src/react/hooks/__tests__/useListCollections.test.tsx +5 -13
- package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +5 -13
- package/src/react/hooks/__tests__/useRoyaltyPercentage.test.tsx +46 -78
- package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +9 -4
- package/src/react/hooks/useCurrencyBalance.tsx +4 -5
- package/src/react/hooks/useRoyaltyPercentage.tsx +16 -8
- package/src/react/ssr/__tests__/create-ssr-client.test.ts +118 -0
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +25 -6
- package/src/react/ui/components/collectible-card/Footer.tsx +56 -7
- package/src/react/ui/components/collectible-card/styles.css.ts +26 -2
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +10 -28
- package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +9 -36
- package/src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts +2 -24
- package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +16 -5
- package/src/react/ui/modals/CreateListingModal/Modal.tsx +3 -2
- package/src/react/ui/modals/SellModal/Modal.tsx +1 -0
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +8 -7
- package/src/types/sdk-config.ts +1 -0
- package/src/utils/index.ts +0 -1
- package/src/utils/price.ts +11 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-3BLBZYQX.js.map +0 -1
- package/dist/chunk-7C7ADZ2H.js.map +0 -1
- package/dist/chunk-7FN62HOP.js.map +0 -1
- package/dist/chunk-AXTDPTRD.js.map +0 -1
- package/dist/chunk-CIPPTQDA.js.map +0 -1
- package/dist/chunk-J6F5QOW5.js.map +0 -1
- package/dist/chunk-P7UNMRZ5.js.map +0 -1
- package/dist/chunk-SA3U25NU.js.map +0 -1
- package/dist/chunk-TFRAOS7F.js.map +0 -1
- package/dist/chunk-Y75XGZOB.js.map +0 -1
- package/src/react/_internal/test/mocks/publicClient.ts +0 -39
- package/src/react/_internal/test/mocks/wagmi.ts +0 -61
- package/src/utils/__tests__/get-public-rpc-client.test.ts +0 -111
- package/src/utils/get-public-rpc-client.ts +0 -41
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
ActionModal,
|
|
4
4
|
CustomSelect,
|
|
5
5
|
useCurrencyBalance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G2T7HCWE.js";
|
|
7
|
+
import {
|
|
8
|
+
useAnalytics
|
|
9
|
+
} from "./chunk-YYBU45PK.js";
|
|
7
10
|
import {
|
|
8
11
|
CalendarIcon_default,
|
|
9
12
|
MinusIcon_default,
|
|
10
13
|
PlusIcon_default,
|
|
11
14
|
PositiveCircleIcon_default
|
|
12
15
|
} from "./chunk-6YHHCGGY.js";
|
|
13
|
-
import {
|
|
14
|
-
useAnalytics
|
|
15
|
-
} from "./chunk-3BLBZYQX.js";
|
|
16
16
|
import {
|
|
17
17
|
actionWrapper,
|
|
18
18
|
closeButton,
|
|
@@ -30,13 +30,14 @@ import {
|
|
|
30
30
|
dialogOverlay,
|
|
31
31
|
dialogOverlay2,
|
|
32
32
|
footer,
|
|
33
|
+
footerPriceChevron,
|
|
33
34
|
offerBellButton,
|
|
34
35
|
priceInputCurrencyImage,
|
|
35
36
|
priceInputWrapper,
|
|
36
37
|
quantityInputWrapper,
|
|
37
38
|
tokenPreview,
|
|
38
39
|
transferModalContent
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-Y56IIYDF.js";
|
|
40
41
|
import {
|
|
41
42
|
AlertMessage,
|
|
42
43
|
dateToUnixTime,
|
|
@@ -58,13 +59,18 @@ import {
|
|
|
58
59
|
useSwitchChainModal,
|
|
59
60
|
useTransferTokens,
|
|
60
61
|
useWallet
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-YA3DWLDC.js";
|
|
63
|
+
import {
|
|
64
|
+
DEFAULT_MARKETPLACE_FEE_PERCENTAGE
|
|
65
|
+
} from "./chunk-5O3ZAEEX.js";
|
|
62
66
|
import {
|
|
63
67
|
iconVariants
|
|
64
68
|
} from "./chunk-TQWM4ER6.js";
|
|
65
69
|
import {
|
|
70
|
+
compareAddress,
|
|
71
|
+
formatPrice,
|
|
66
72
|
truncateMiddle
|
|
67
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-OMCWTRBR.js";
|
|
68
74
|
import {
|
|
69
75
|
getProviderEl
|
|
70
76
|
} from "./chunk-YOKGP2EQ.js";
|
|
@@ -73,7 +79,7 @@ import {
|
|
|
73
79
|
collectableKeys,
|
|
74
80
|
getMarketplaceClient,
|
|
75
81
|
getQueryClient
|
|
76
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-LNMMWV77.js";
|
|
77
83
|
import {
|
|
78
84
|
InvalidContractTypeError,
|
|
79
85
|
InvalidStepError
|
|
@@ -1936,19 +1942,19 @@ import { parseUnits as parseUnits3 } from "viem";
|
|
|
1936
1942
|
import { Box as Box11, Image as Image3, Skeleton as Skeleton6, Text as Text10 } from "@0xsequence/design-system";
|
|
1937
1943
|
import { formatUnits as formatUnits4 } from "viem";
|
|
1938
1944
|
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1939
|
-
var DEFAULT_MARKETPLACE_FEE_PERCENTAGE = 2.5;
|
|
1940
1945
|
function TransactionDetails({
|
|
1941
1946
|
collectibleId,
|
|
1942
1947
|
collectionAddress,
|
|
1943
1948
|
chainId,
|
|
1949
|
+
includeMarketplaceFee,
|
|
1944
1950
|
price,
|
|
1945
1951
|
showPlaceholderPrice,
|
|
1946
1952
|
currencyImageUrl
|
|
1947
1953
|
}) {
|
|
1948
1954
|
const { data, isLoading: marketplaceConfigLoading } = useMarketplaceConfig();
|
|
1949
|
-
const marketplaceFeePercentage = data?.collections.find(
|
|
1955
|
+
const marketplaceFeePercentage = includeMarketplaceFee ? data?.collections.find(
|
|
1950
1956
|
(collection) => collection.address === collectionAddress
|
|
1951
|
-
)?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
1957
|
+
)?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE : 0;
|
|
1952
1958
|
const { data: royaltyPercentage, isLoading: royaltyPercentageLoading } = useRoyaltyPercentage({
|
|
1953
1959
|
chainId,
|
|
1954
1960
|
collectionAddress,
|
|
@@ -2474,6 +2480,7 @@ var Modal3 = observer5(() => {
|
|
|
2474
2480
|
collectibleId: tokenId,
|
|
2475
2481
|
collectionAddress,
|
|
2476
2482
|
chainId,
|
|
2483
|
+
includeMarketplaceFee: true,
|
|
2477
2484
|
price: currency ? {
|
|
2478
2485
|
amountRaw: order?.priceAmount,
|
|
2479
2486
|
currency
|
|
@@ -2997,63 +3004,6 @@ import { Show as Show4, observer as observer9 } from "@legendapp/state/react";
|
|
|
2997
3004
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2998
3005
|
import { useAccount as useAccount5 } from "wagmi";
|
|
2999
3006
|
|
|
3000
|
-
// src/react/ui/modals/CreateListingModal/store.ts
|
|
3001
|
-
import { observable as observable7 } from "@legendapp/state";
|
|
3002
|
-
import { addDays as addDays3 } from "date-fns/addDays";
|
|
3003
|
-
var listingPrice = {
|
|
3004
|
-
amountRaw: "0",
|
|
3005
|
-
currency: {}
|
|
3006
|
-
};
|
|
3007
|
-
var approval2 = {
|
|
3008
|
-
exist: false,
|
|
3009
|
-
isExecuting: false,
|
|
3010
|
-
execute: () => Promise.resolve()
|
|
3011
|
-
};
|
|
3012
|
-
var transaction2 = {
|
|
3013
|
-
exist: false,
|
|
3014
|
-
isExecuting: false,
|
|
3015
|
-
execute: () => Promise.resolve()
|
|
3016
|
-
};
|
|
3017
|
-
var steps2 = {
|
|
3018
|
-
approval: { ...approval2 },
|
|
3019
|
-
transaction: { ...transaction2 }
|
|
3020
|
-
};
|
|
3021
|
-
var initialState6 = {
|
|
3022
|
-
isOpen: false,
|
|
3023
|
-
collectionAddress: "",
|
|
3024
|
-
chainId: "",
|
|
3025
|
-
collectibleId: "",
|
|
3026
|
-
orderbookKind: "sequence_marketplace_v2" /* sequence_marketplace_v2 */,
|
|
3027
|
-
collectionName: "",
|
|
3028
|
-
collectionType: void 0,
|
|
3029
|
-
listingPrice: { ...listingPrice },
|
|
3030
|
-
quantity: "1",
|
|
3031
|
-
invalidQuantity: false,
|
|
3032
|
-
expiry: new Date(addDays3(/* @__PURE__ */ new Date(), 7).toJSON()),
|
|
3033
|
-
callbacks: void 0,
|
|
3034
|
-
steps: { ...steps2 }
|
|
3035
|
-
};
|
|
3036
|
-
var actions2 = {
|
|
3037
|
-
open: (args) => {
|
|
3038
|
-
createListingModal$.collectionAddress.set(args.collectionAddress);
|
|
3039
|
-
createListingModal$.chainId.set(args.chainId);
|
|
3040
|
-
createListingModal$.collectibleId.set(args.collectibleId);
|
|
3041
|
-
createListingModal$.orderbookKind.set(args.orderbookKind);
|
|
3042
|
-
createListingModal$.callbacks.set(args.callbacks);
|
|
3043
|
-
createListingModal$.isOpen.set(true);
|
|
3044
|
-
},
|
|
3045
|
-
close: () => {
|
|
3046
|
-
createListingModal$.isOpen.set(false);
|
|
3047
|
-
createListingModal$.set({ ...initialState6, ...actions2 });
|
|
3048
|
-
createListingModal$.listingPrice.set({ ...listingPrice });
|
|
3049
|
-
createListingModal$.steps.set({ ...steps2 });
|
|
3050
|
-
}
|
|
3051
|
-
};
|
|
3052
|
-
var createListingModal$ = observable7({
|
|
3053
|
-
...initialState6,
|
|
3054
|
-
...actions2
|
|
3055
|
-
});
|
|
3056
|
-
|
|
3057
3007
|
// src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx
|
|
3058
3008
|
import { useEffect as useEffect7 } from "react";
|
|
3059
3009
|
|
|
@@ -3335,6 +3285,63 @@ var useCreateListing = ({
|
|
|
3335
3285
|
};
|
|
3336
3286
|
};
|
|
3337
3287
|
|
|
3288
|
+
// src/react/ui/modals/CreateListingModal/store.ts
|
|
3289
|
+
import { observable as observable7 } from "@legendapp/state";
|
|
3290
|
+
import { addDays as addDays3 } from "date-fns/addDays";
|
|
3291
|
+
var listingPrice = {
|
|
3292
|
+
amountRaw: "0",
|
|
3293
|
+
currency: {}
|
|
3294
|
+
};
|
|
3295
|
+
var approval2 = {
|
|
3296
|
+
exist: false,
|
|
3297
|
+
isExecuting: false,
|
|
3298
|
+
execute: () => Promise.resolve()
|
|
3299
|
+
};
|
|
3300
|
+
var transaction2 = {
|
|
3301
|
+
exist: false,
|
|
3302
|
+
isExecuting: false,
|
|
3303
|
+
execute: () => Promise.resolve()
|
|
3304
|
+
};
|
|
3305
|
+
var steps2 = {
|
|
3306
|
+
approval: { ...approval2 },
|
|
3307
|
+
transaction: { ...transaction2 }
|
|
3308
|
+
};
|
|
3309
|
+
var initialState6 = {
|
|
3310
|
+
isOpen: false,
|
|
3311
|
+
collectionAddress: "",
|
|
3312
|
+
chainId: "",
|
|
3313
|
+
collectibleId: "",
|
|
3314
|
+
orderbookKind: "sequence_marketplace_v2" /* sequence_marketplace_v2 */,
|
|
3315
|
+
collectionName: "",
|
|
3316
|
+
collectionType: void 0,
|
|
3317
|
+
listingPrice: { ...listingPrice },
|
|
3318
|
+
quantity: "1",
|
|
3319
|
+
invalidQuantity: false,
|
|
3320
|
+
expiry: new Date(addDays3(/* @__PURE__ */ new Date(), 7).toJSON()),
|
|
3321
|
+
callbacks: void 0,
|
|
3322
|
+
steps: { ...steps2 }
|
|
3323
|
+
};
|
|
3324
|
+
var actions2 = {
|
|
3325
|
+
open: (args) => {
|
|
3326
|
+
createListingModal$.collectionAddress.set(args.collectionAddress);
|
|
3327
|
+
createListingModal$.chainId.set(args.chainId);
|
|
3328
|
+
createListingModal$.collectibleId.set(args.collectibleId);
|
|
3329
|
+
createListingModal$.orderbookKind.set(args.orderbookKind);
|
|
3330
|
+
createListingModal$.callbacks.set(args.callbacks);
|
|
3331
|
+
createListingModal$.isOpen.set(true);
|
|
3332
|
+
},
|
|
3333
|
+
close: () => {
|
|
3334
|
+
createListingModal$.isOpen.set(false);
|
|
3335
|
+
createListingModal$.set({ ...initialState6, ...actions2 });
|
|
3336
|
+
createListingModal$.listingPrice.set({ ...listingPrice });
|
|
3337
|
+
createListingModal$.steps.set({ ...steps2 });
|
|
3338
|
+
}
|
|
3339
|
+
};
|
|
3340
|
+
var createListingModal$ = observable7({
|
|
3341
|
+
...initialState6,
|
|
3342
|
+
...actions2
|
|
3343
|
+
});
|
|
3344
|
+
|
|
3338
3345
|
// src/react/ui/modals/CreateListingModal/Modal.tsx
|
|
3339
3346
|
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3340
3347
|
var CreateListingModal = () => {
|
|
@@ -3510,7 +3517,8 @@ var Modal5 = observer9(() => {
|
|
|
3510
3517
|
collectionAddress,
|
|
3511
3518
|
chainId,
|
|
3512
3519
|
price: createListingModal$.listingPrice.get(),
|
|
3513
|
-
currencyImageUrl: listingPrice2.currency.imageUrl
|
|
3520
|
+
currencyImageUrl: listingPrice2.currency.imageUrl,
|
|
3521
|
+
includeMarketplaceFee: false
|
|
3514
3522
|
}
|
|
3515
3523
|
)
|
|
3516
3524
|
]
|
|
@@ -3523,7 +3531,6 @@ import { use$ as use$3 } from "@legendapp/state/react";
|
|
|
3523
3531
|
|
|
3524
3532
|
// src/react/ui/modals/BuyModal/hooks/useBuyCollectable.ts
|
|
3525
3533
|
import { useSelectPaymentModal } from "@0xsequence/kit-checkout";
|
|
3526
|
-
import { zeroAddress } from "viem";
|
|
3527
3534
|
|
|
3528
3535
|
// src/react/ui/modals/BuyModal/store.ts
|
|
3529
3536
|
import { observable as observable8 } from "@legendapp/state";
|
|
@@ -3618,28 +3625,12 @@ var useBuyCollectable = ({
|
|
|
3618
3625
|
additionalFees: [fees],
|
|
3619
3626
|
walletType: "unknown" /* unknown */
|
|
3620
3627
|
});
|
|
3621
|
-
const order = await marketplaceClient.getOrders({
|
|
3622
|
-
input: [
|
|
3623
|
-
{
|
|
3624
|
-
orderId: input.orderId,
|
|
3625
|
-
contractAddress: collectionAddress,
|
|
3626
|
-
marketplace: input.marketplace
|
|
3627
|
-
}
|
|
3628
|
-
]
|
|
3629
|
-
});
|
|
3630
3628
|
setCheckoutModalLoaded(true);
|
|
3631
3629
|
setCheckoutModalIsLoading(false);
|
|
3632
3630
|
const step = steps3.find((step2) => step2.id === "buy" /* buy */);
|
|
3633
3631
|
if (!step) {
|
|
3634
3632
|
throw new Error("Buy step not found");
|
|
3635
3633
|
}
|
|
3636
|
-
const feesBps = BigInt(fees.amount);
|
|
3637
|
-
let price = String(
|
|
3638
|
-
BigInt(order.orders[0].priceAmount) * BigInt(input.quantity) * (10000n + feesBps) / 10000n
|
|
3639
|
-
);
|
|
3640
|
-
if (order.orders[0].priceCurrencyAddress !== zeroAddress) {
|
|
3641
|
-
price = "0";
|
|
3642
|
-
}
|
|
3643
3634
|
openSelectPaymentModal({
|
|
3644
3635
|
chain: chainId,
|
|
3645
3636
|
collectibles: [
|
|
@@ -3650,7 +3641,7 @@ var useBuyCollectable = ({
|
|
|
3650
3641
|
}
|
|
3651
3642
|
],
|
|
3652
3643
|
currencyAddress: priceCurrencyAddress,
|
|
3653
|
-
price,
|
|
3644
|
+
price: step.price,
|
|
3654
3645
|
targetContractAddress: step.to,
|
|
3655
3646
|
txData: step.data,
|
|
3656
3647
|
collectionAddress,
|
|
@@ -3781,17 +3772,22 @@ function CheckoutModal({ buy, collectable, order }) {
|
|
|
3781
3772
|
// src/react/ui/modals/BuyModal/modals/Modal1155.tsx
|
|
3782
3773
|
import { Box as Box17, Text as Text15, TokenImage as TokenImage2 } from "@0xsequence/design-system";
|
|
3783
3774
|
import { observer as observer10 } from "@legendapp/state/react";
|
|
3784
|
-
import {
|
|
3775
|
+
import { parseUnits as parseUnits6 } from "viem";
|
|
3785
3776
|
import { Fragment as Fragment3, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3786
3777
|
var ERC1155QuantityModal = observer10(
|
|
3787
3778
|
({ buy, collectable, order }) => {
|
|
3779
|
+
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
3788
3780
|
const { data: currency, isLoading: isCurrencyLoading } = useCurrency({
|
|
3789
3781
|
chainId: order.chainId,
|
|
3790
3782
|
currencyAddress: order.priceCurrencyAddress
|
|
3791
3783
|
});
|
|
3792
3784
|
const quantity = Number(buyModal$.state.quantity.get());
|
|
3793
3785
|
const pricePerToken = order.priceAmount;
|
|
3794
|
-
const
|
|
3786
|
+
const marketplaceFeePercentage = marketplaceConfig?.collections.find(
|
|
3787
|
+
(collection) => compareAddress(collection.address, order.collectionContractAddress)
|
|
3788
|
+
)?.feePercentage || DEFAULT_MARKETPLACE_FEE_PERCENTAGE;
|
|
3789
|
+
const price = Number(quantity) * Number(pricePerToken);
|
|
3790
|
+
const totalPrice = price + price * Number(marketplaceFeePercentage || 0) / 100;
|
|
3795
3791
|
if (buyModal$.state.checkoutModalLoaded.get() && buyModal$.isOpen.get() && buyModal$.state.checkoutModalIsLoading.get() && buyModal$.state.purchaseProcessing.get()) {
|
|
3796
3792
|
return null;
|
|
3797
3793
|
}
|
|
@@ -3843,7 +3839,7 @@ var ERC1155QuantityModal = observer10(
|
|
|
3843
3839
|
fontSize: "small",
|
|
3844
3840
|
fontWeight: "bold",
|
|
3845
3841
|
fontFamily: "body",
|
|
3846
|
-
children:
|
|
3842
|
+
children: formatPrice(totalPrice, currency.decimals)
|
|
3847
3843
|
}
|
|
3848
3844
|
),
|
|
3849
3845
|
/* @__PURE__ */ jsx25(Text15, { color: "text80", fontSize: "small", fontFamily: "body", children: currency?.symbol })
|
|
@@ -4384,8 +4380,15 @@ var ActionButton = observer12(
|
|
|
4384
4380
|
);
|
|
4385
4381
|
|
|
4386
4382
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
4387
|
-
import {
|
|
4388
|
-
|
|
4383
|
+
import {
|
|
4384
|
+
Box as Box21,
|
|
4385
|
+
ChevronLeftIcon,
|
|
4386
|
+
ChevronRightIcon,
|
|
4387
|
+
IconButton as IconButton5,
|
|
4388
|
+
Image as Image6,
|
|
4389
|
+
Text as Text16
|
|
4390
|
+
} from "@0xsequence/design-system";
|
|
4391
|
+
import { formatUnits as formatUnits7 } from "viem";
|
|
4389
4392
|
|
|
4390
4393
|
// src/react/ui/icons/Bell.tsx
|
|
4391
4394
|
import { Box as Box20 } from "@0xsequence/design-system";
|
|
@@ -4428,10 +4431,35 @@ var Bell_default = SvgBellIcon;
|
|
|
4428
4431
|
|
|
4429
4432
|
// src/react/ui/components/collectible-card/Footer.tsx
|
|
4430
4433
|
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4431
|
-
var
|
|
4432
|
-
|
|
4434
|
+
var OVERFLOW_PRICE = 1e8;
|
|
4435
|
+
var UNDERFLOW_PRICE = 1e-4;
|
|
4436
|
+
var formatPrice2 = (amount, currency) => {
|
|
4437
|
+
const formattedPrice = formatUnits7(BigInt(amount), currency.decimals);
|
|
4433
4438
|
const numericPrice = Number.parseFloat(formattedPrice);
|
|
4434
|
-
|
|
4439
|
+
if (numericPrice < UNDERFLOW_PRICE) {
|
|
4440
|
+
return /* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", children: [
|
|
4441
|
+
/* @__PURE__ */ jsx35(ChevronLeftIcon, { className: footerPriceChevron }),
|
|
4442
|
+
/* @__PURE__ */ jsx35(Text16, { children: `${UNDERFLOW_PRICE} ${currency.symbol}` })
|
|
4443
|
+
] });
|
|
4444
|
+
}
|
|
4445
|
+
if (numericPrice > OVERFLOW_PRICE) {
|
|
4446
|
+
return /* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", children: [
|
|
4447
|
+
/* @__PURE__ */ jsx35(ChevronRightIcon, { className: footerPriceChevron }),
|
|
4448
|
+
/* @__PURE__ */ jsx35(Text16, { children: `${OVERFLOW_PRICE.toLocaleString("en-US", {
|
|
4449
|
+
maximumFractionDigits: 2
|
|
4450
|
+
})} ${currency.symbol}` })
|
|
4451
|
+
] });
|
|
4452
|
+
}
|
|
4453
|
+
const maxDecimals = numericPrice < 0.01 ? 6 : 4;
|
|
4454
|
+
const formattedNumber = numericPrice.toLocaleString("en-US", {
|
|
4455
|
+
minimumFractionDigits: 0,
|
|
4456
|
+
maximumFractionDigits: maxDecimals
|
|
4457
|
+
});
|
|
4458
|
+
return /* @__PURE__ */ jsx35(Box21, { display: "flex", alignItems: "center", gap: "1", children: /* @__PURE__ */ jsxs23(Text16, { children: [
|
|
4459
|
+
formattedNumber,
|
|
4460
|
+
" ",
|
|
4461
|
+
currency.symbol
|
|
4462
|
+
] }) });
|
|
4435
4463
|
};
|
|
4436
4464
|
var Footer = ({
|
|
4437
4465
|
name,
|
|
@@ -4503,7 +4531,17 @@ var Footer = ({
|
|
|
4503
4531
|
}
|
|
4504
4532
|
),
|
|
4505
4533
|
/* @__PURE__ */ jsxs23(Box21, { display: "flex", alignItems: "center", gap: "1", children: [
|
|
4506
|
-
listed && lowestListingCurrency.imageUrl && /* @__PURE__ */ jsx35(
|
|
4534
|
+
listed && lowestListingCurrency.imageUrl && /* @__PURE__ */ jsx35(
|
|
4535
|
+
Image6,
|
|
4536
|
+
{
|
|
4537
|
+
src: lowestListingCurrency.imageUrl,
|
|
4538
|
+
width: "3",
|
|
4539
|
+
height: "3",
|
|
4540
|
+
onError: (e) => {
|
|
4541
|
+
e.currentTarget.style.display = "none";
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
),
|
|
4507
4545
|
/* @__PURE__ */ jsxs23(
|
|
4508
4546
|
Text16,
|
|
4509
4547
|
{
|
|
@@ -4513,7 +4551,7 @@ var Footer = ({
|
|
|
4513
4551
|
textAlign: "left",
|
|
4514
4552
|
fontFamily: "body",
|
|
4515
4553
|
children: [
|
|
4516
|
-
listed &&
|
|
4554
|
+
listed && formatPrice2(lowestListingPriceAmount, lowestListingCurrency),
|
|
4517
4555
|
!listed && "Not listed yet"
|
|
4518
4556
|
]
|
|
4519
4557
|
}
|
|
@@ -4536,7 +4574,7 @@ var TokenTypeBalancePill = ({
|
|
|
4536
4574
|
type,
|
|
4537
4575
|
decimals
|
|
4538
4576
|
}) => {
|
|
4539
|
-
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${
|
|
4577
|
+
const displayText = type === "ERC1155" /* ERC1155 */ ? balance ? `Owned: ${formatUnits7(BigInt(balance), decimals ?? 0)}` : "ERC-1155" : "ERC-721";
|
|
4540
4578
|
return /* @__PURE__ */ jsx35(
|
|
4541
4579
|
Text16,
|
|
4542
4580
|
{
|
|
@@ -4606,6 +4644,7 @@ function CollectibleCard({
|
|
|
4606
4644
|
const collectibleMetadata = lowestListing?.metadata;
|
|
4607
4645
|
const highestOffer = lowestListing?.offer;
|
|
4608
4646
|
const [imageLoadingError, setImageLoadingError] = useState7(false);
|
|
4647
|
+
const [imageLoading, setImageLoading] = useState7(true);
|
|
4609
4648
|
const { data: lowestListingCurrency } = useCurrency({
|
|
4610
4649
|
chainId,
|
|
4611
4650
|
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
@@ -4670,15 +4709,30 @@ function CollectibleCard({
|
|
|
4670
4709
|
icon: DiamondEye_default
|
|
4671
4710
|
}
|
|
4672
4711
|
),
|
|
4673
|
-
/* @__PURE__ */
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4712
|
+
/* @__PURE__ */ jsxs24(Box22, { position: "relative", children: [
|
|
4713
|
+
imageLoading && /* @__PURE__ */ jsx36(
|
|
4714
|
+
Skeleton8,
|
|
4715
|
+
{
|
|
4716
|
+
position: "absolute",
|
|
4717
|
+
top: "0",
|
|
4718
|
+
left: "0",
|
|
4719
|
+
width: "full",
|
|
4720
|
+
height: "full",
|
|
4721
|
+
zIndex: "10",
|
|
4722
|
+
style: { borderRadius: 0 }
|
|
4723
|
+
}
|
|
4724
|
+
),
|
|
4725
|
+
/* @__PURE__ */ jsx36(
|
|
4726
|
+
"img",
|
|
4727
|
+
{
|
|
4728
|
+
src: imageLoadingError ? chess_tile_default : image || chess_tile_default,
|
|
4729
|
+
alt: name,
|
|
4730
|
+
className: imageLoading ? collectibleImage.loading : collectibleImage.loaded,
|
|
4731
|
+
onError: () => setImageLoadingError(true),
|
|
4732
|
+
onLoad: () => setImageLoading(false)
|
|
4733
|
+
}
|
|
4734
|
+
)
|
|
4735
|
+
] }),
|
|
4682
4736
|
/* @__PURE__ */ jsx36(
|
|
4683
4737
|
Footer,
|
|
4684
4738
|
{
|
|
@@ -4735,4 +4789,4 @@ export {
|
|
|
4735
4789
|
useBuyModal,
|
|
4736
4790
|
CollectibleCard
|
|
4737
4791
|
};
|
|
4738
|
-
//# sourceMappingURL=chunk-
|
|
4792
|
+
//# sourceMappingURL=chunk-L2K4DBH2.js.map
|