@0xsequence/marketplace-sdk 0.5.2 → 0.5.4
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 +73 -0
- package/dist/{chunk-XP3WY5AX.js → chunk-7C7ADZ2H.js} +3 -3
- package/dist/{chunk-XP3WY5AX.js.map → chunk-7C7ADZ2H.js.map} +1 -1
- package/dist/{chunk-FCF57DZI.js → chunk-7FN62HOP.js} +5 -9
- package/dist/chunk-7FN62HOP.js.map +1 -0
- package/dist/chunk-DZKPDV63.js +27 -0
- package/dist/chunk-DZKPDV63.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-I37CRQ4S.js → chunk-JWNONWD6.js} +259 -173
- package/dist/chunk-JWNONWD6.js.map +1 -0
- package/dist/{chunk-LJAB3S6U.js → chunk-TFRAOS7F.js} +22 -13
- package/dist/chunk-TFRAOS7F.js.map +1 -0
- package/dist/{chunk-MKGSGTQC.js → chunk-TLNRD4BQ.js} +3 -3
- 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-WGGZEQHL.js +56 -0
- package/dist/chunk-WGGZEQHL.js.map +1 -0
- package/dist/{chunk-MWDG7UTB.js → chunk-ZBLU3Q22.js} +1 -1
- package/dist/{chunk-MSTTVFVQ.js → chunk-ZGVCOQ4I.js} +383 -283
- package/dist/chunk-ZGVCOQ4I.js.map +1 -0
- package/dist/{create-config-BXvwUh55.d.ts → create-config-DOUq8Day.d.ts} +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +10 -6
- package/dist/{sdk-config-B32_2bG3.d.ts → marketplace.gen-D0ADxbfH.d.ts} +1 -24
- package/dist/react/_internal/api/index.d.ts +3 -2
- package/dist/react/_internal/databeat/index.css +82 -0
- package/dist/react/_internal/databeat/index.css.map +1 -0
- package/dist/react/_internal/databeat/index.d.ts +68 -0
- package/dist/react/_internal/databeat/index.js +26 -0
- package/dist/react/_internal/databeat/index.js.map +1 -0
- package/dist/react/_internal/index.d.ts +6 -5
- package/dist/react/_internal/index.js +6 -6
- package/dist/react/_internal/wagmi/index.d.ts +4 -4
- package/dist/react/_internal/wagmi/index.js +1 -1
- package/dist/react/hooks/index.d.ts +367 -22
- package/dist/react/hooks/index.js +9 -7
- package/dist/react/index.css +1 -1
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +7 -6
- package/dist/react/index.js +15 -12
- 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 +4 -3
- package/dist/react/ui/components/collectible-card/index.js +9 -8
- package/dist/react/ui/components/marketplace-logos/index.js +1 -1
- package/dist/react/ui/index.css +1 -1
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +4 -3
- package/dist/react/ui/index.js +9 -8
- package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +4 -3
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +6 -6
- package/dist/react/ui/styles/index.d.ts +1 -1
- package/dist/sdk-config-xWkdBdrL.d.ts +24 -0
- package/dist/{services-BRBVE0mm.d.ts → services-Dd2MoBTM.d.ts} +2 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/types/index.d.ts +4 -5
- package/dist/types/index.js +9 -5
- package/dist/{types-Yto6KrTN.d.ts → types-vOfhbBkR.d.ts} +3 -2
- package/dist/utils/index.d.ts +4 -3
- package/dist/utils/index.js +4 -4
- package/package.json +12 -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/databeat/index.ts +63 -0
- package/src/react/_internal/databeat/types.ts +70 -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__/useListCollectiblesPaginated.test.tsx +217 -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 +1 -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 +75 -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/useListCollectiblesPaginated.tsx +78 -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/useTransactionSteps.tsx +47 -7
- 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 +34 -6
- package/src/react/ui/modals/SellModal/Modal.tsx +3 -1
- 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 +11 -7
- package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +58 -16
- 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-FCF57DZI.js.map +0 -1
- package/dist/chunk-I37CRQ4S.js.map +0 -1
- package/dist/chunk-LJAB3S6U.js.map +0 -1
- package/dist/chunk-MSTTVFVQ.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-TLNRD4BQ.js.map} +0 -0
- /package/dist/{chunk-MWDG7UTB.js.map → chunk-ZBLU3Q22.js.map} +0 -0
|
@@ -15,9 +15,10 @@ import {
|
|
|
15
15
|
switchChainModalContent
|
|
16
16
|
} from "./chunk-FI723DGL.js";
|
|
17
17
|
import {
|
|
18
|
+
compareAddress,
|
|
18
19
|
getPresentableChainName,
|
|
19
20
|
getPublicRpcClient
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-7C7ADZ2H.js";
|
|
21
22
|
import {
|
|
22
23
|
EIP2981_ABI
|
|
23
24
|
} from "./chunk-3OHM45R3.js";
|
|
@@ -78,9 +79,9 @@ import {
|
|
|
78
79
|
|
|
79
80
|
// src/react/hooks/useAutoSelectFeeOption.tsx
|
|
80
81
|
import { zeroAddress } from "viem";
|
|
81
|
-
import { useAccount } from "wagmi";
|
|
82
|
-
import { useCallback } from "react";
|
|
83
82
|
import { useChain } from "@0xsequence/kit";
|
|
83
|
+
import { useCallback } from "react";
|
|
84
|
+
import { useAccount } from "wagmi";
|
|
84
85
|
|
|
85
86
|
// src/react/hooks/useCollectionBalanceDetails.tsx
|
|
86
87
|
import { z } from "zod";
|
|
@@ -981,65 +982,18 @@ var useCollection = (args) => {
|
|
|
981
982
|
};
|
|
982
983
|
|
|
983
984
|
// src/react/hooks/useCurrencies.tsx
|
|
984
|
-
import { queryOptions as
|
|
985
|
+
import { queryOptions as queryOptions7, useQuery as useQuery7 } from "@tanstack/react-query";
|
|
985
986
|
import { zeroAddress as zeroAddress2 } from "viem";
|
|
986
987
|
import { z as z7 } from "zod";
|
|
987
|
-
var ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
|
|
988
|
-
var UseCurrenciesArgsSchema = z7.object({
|
|
989
|
-
chainId: ChainIdCoerce,
|
|
990
|
-
includeNativeCurrency: z7.boolean().optional().default(true),
|
|
991
|
-
currencyOptions: z7.array(AddressSchema).optional(),
|
|
992
|
-
query: QueryArgSchema
|
|
993
|
-
});
|
|
994
|
-
var fetchCurrencies = async (chainId, config) => {
|
|
995
|
-
const parsedChainId = ChainIdCoerce.parse(chainId);
|
|
996
|
-
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
997
|
-
return marketplaceClient.listCurrencies().then(
|
|
998
|
-
(resp) => resp.currencies.map((currency) => ({
|
|
999
|
-
...currency,
|
|
1000
|
-
// TODO: remove this, when we are sure of the schema
|
|
1001
|
-
contractAddress: currency.contractAddress || zeroAddress2
|
|
1002
|
-
}))
|
|
1003
|
-
);
|
|
1004
|
-
};
|
|
1005
|
-
var selectCurrencies = (data, args) => {
|
|
1006
|
-
const argsParsed = UseCurrenciesArgsSchema.parse(args);
|
|
1007
|
-
let filteredData = data;
|
|
1008
|
-
if (!argsParsed.includeNativeCurrency) {
|
|
1009
|
-
filteredData = filteredData.filter((currency) => !currency.nativeCurrency);
|
|
1010
|
-
}
|
|
1011
|
-
if (argsParsed.currencyOptions) {
|
|
1012
|
-
const lowerCaseCurrencyOptions = argsParsed.currencyOptions.map(
|
|
1013
|
-
(option) => option.toLowerCase()
|
|
1014
|
-
);
|
|
1015
|
-
filteredData = filteredData.filter(
|
|
1016
|
-
(currency) => lowerCaseCurrencyOptions.includes(currency.contractAddress.toLowerCase())
|
|
1017
|
-
);
|
|
1018
|
-
}
|
|
1019
|
-
return filteredData;
|
|
1020
|
-
};
|
|
1021
|
-
var currenciesOptions = (args, config) => {
|
|
1022
|
-
return queryOptions6({
|
|
1023
|
-
...args.query,
|
|
1024
|
-
queryKey: [...currencyKeys.lists, args.chainId],
|
|
1025
|
-
queryFn: () => fetchCurrencies(args.chainId, config),
|
|
1026
|
-
select: (data) => selectCurrencies(data, args),
|
|
1027
|
-
enabled: args.query?.enabled
|
|
1028
|
-
});
|
|
1029
|
-
};
|
|
1030
|
-
var useCurrencies = (args) => {
|
|
1031
|
-
const config = useConfig();
|
|
1032
|
-
return useQuery6(currenciesOptions(args, config));
|
|
1033
|
-
};
|
|
1034
988
|
|
|
1035
989
|
// src/react/hooks/useMarketplaceConfig.tsx
|
|
1036
|
-
import { useQuery as
|
|
990
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
1037
991
|
|
|
1038
992
|
// src/react/hooks/options/marketplaceConfigOptions.ts
|
|
1039
|
-
import { queryOptions as
|
|
993
|
+
import { queryOptions as queryOptions6 } from "@tanstack/react-query";
|
|
1040
994
|
var fetchBuilderConfig = async (projectId, env) => {
|
|
1041
995
|
const url = `${builderMarketplaceApi(projectId, env)}`;
|
|
1042
|
-
const response = await fetch(`${url}/
|
|
996
|
+
const response = await fetch(`${url}/settings.json`);
|
|
1043
997
|
const json = await response.json();
|
|
1044
998
|
if (!response.ok) {
|
|
1045
999
|
console.error("Failed to fetch marketplace config:", response.status, json);
|
|
@@ -1076,7 +1030,7 @@ var marketplaceConfigOptions = (config) => {
|
|
|
1076
1030
|
env = config._internal.builderEnv ?? env;
|
|
1077
1031
|
}
|
|
1078
1032
|
const projectId = config.projectId;
|
|
1079
|
-
return
|
|
1033
|
+
return queryOptions6({
|
|
1080
1034
|
queryKey: [...configKeys.marketplace, env, projectId],
|
|
1081
1035
|
queryFn: () => fetchMarketplaceConfig(env, projectId)
|
|
1082
1036
|
});
|
|
@@ -1085,19 +1039,56 @@ var marketplaceConfigOptions = (config) => {
|
|
|
1085
1039
|
// src/react/hooks/useMarketplaceConfig.tsx
|
|
1086
1040
|
var useMarketplaceConfig = () => {
|
|
1087
1041
|
const config = useConfig();
|
|
1088
|
-
return
|
|
1042
|
+
return useQuery6(marketplaceConfigOptions(config));
|
|
1089
1043
|
};
|
|
1090
1044
|
|
|
1091
|
-
// src/react/hooks/
|
|
1092
|
-
var
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1045
|
+
// src/react/hooks/useCurrencies.tsx
|
|
1046
|
+
var ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
|
|
1047
|
+
var UseCurrenciesArgsSchema = z7.object({
|
|
1048
|
+
chainId: ChainIdCoerce,
|
|
1049
|
+
includeNativeCurrency: z7.boolean().optional().default(true),
|
|
1050
|
+
collectionAddress: AddressSchema.optional(),
|
|
1051
|
+
query: QueryArgSchema
|
|
1052
|
+
});
|
|
1053
|
+
var fetchCurrencies = async (args, config) => {
|
|
1054
|
+
const parsedArgs = UseCurrenciesArgsSchema.parse(args);
|
|
1055
|
+
const marketplaceClient = getMarketplaceClient(parsedArgs.chainId, config);
|
|
1056
|
+
let currencies = await marketplaceClient.listCurrencies().then(
|
|
1057
|
+
(resp) => resp.currencies.map((currency) => ({
|
|
1058
|
+
...currency,
|
|
1059
|
+
contractAddress: currency.contractAddress || zeroAddress2
|
|
1060
|
+
}))
|
|
1061
|
+
);
|
|
1062
|
+
if (parsedArgs.collectionAddress) {
|
|
1063
|
+
const queryClient = getQueryClient();
|
|
1064
|
+
const marketplaceConfig = await queryClient.fetchQuery(
|
|
1065
|
+
marketplaceConfigOptions(config)
|
|
1066
|
+
);
|
|
1067
|
+
const currenciesOptions2 = marketplaceConfig.collections.find(
|
|
1068
|
+
(collection) => collection.address === args.collectionAddress
|
|
1069
|
+
)?.currencyOptions;
|
|
1070
|
+
if (currenciesOptions2) {
|
|
1071
|
+
currencies = currencies.filter(
|
|
1072
|
+
(currency) => currenciesOptions2.includes(currency.contractAddress)
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
if (!parsedArgs.includeNativeCurrency) {
|
|
1077
|
+
currencies = currencies.filter((currency) => !currency.nativeCurrency);
|
|
1078
|
+
}
|
|
1079
|
+
return currencies;
|
|
1080
|
+
};
|
|
1081
|
+
var currenciesOptions = (args, config) => {
|
|
1082
|
+
return queryOptions7({
|
|
1083
|
+
...args.query,
|
|
1084
|
+
queryKey: [...currencyKeys.lists, args],
|
|
1085
|
+
queryFn: () => fetchCurrencies(args, config),
|
|
1086
|
+
enabled: args.query?.enabled
|
|
1087
|
+
});
|
|
1088
|
+
};
|
|
1089
|
+
var useCurrencies = (args) => {
|
|
1090
|
+
const config = useConfig();
|
|
1091
|
+
return useQuery7(currenciesOptions(args, config));
|
|
1101
1092
|
};
|
|
1102
1093
|
|
|
1103
1094
|
// src/react/hooks/useCurrency.tsx
|
|
@@ -1146,15 +1137,53 @@ import { z as z9 } from "zod";
|
|
|
1146
1137
|
var UseFiltersSchema = z9.object({
|
|
1147
1138
|
chainId: ChainIdSchema.pipe(z9.coerce.string()),
|
|
1148
1139
|
collectionAddress: AddressSchema,
|
|
1140
|
+
showAllFilters: z9.boolean().default(false).optional(),
|
|
1149
1141
|
query: QueryArgSchema
|
|
1150
1142
|
});
|
|
1151
1143
|
var fetchFilters = async (args, config) => {
|
|
1152
1144
|
const parsedArgs = UseFiltersSchema.parse(args);
|
|
1153
1145
|
const metadataClient = getMetadataClient(config);
|
|
1154
|
-
|
|
1146
|
+
const filters = await metadataClient.tokenCollectionFilters({
|
|
1155
1147
|
chainID: parsedArgs.chainId,
|
|
1156
1148
|
contractAddress: parsedArgs.collectionAddress
|
|
1157
1149
|
}).then((resp) => resp.filters);
|
|
1150
|
+
if (args.showAllFilters) return filters;
|
|
1151
|
+
const queryClient = getQueryClient();
|
|
1152
|
+
const marketplaceConfig = await queryClient.fetchQuery(
|
|
1153
|
+
marketplaceConfigOptions(config)
|
|
1154
|
+
);
|
|
1155
|
+
const collectionFilters = marketplaceConfig.collections.find(
|
|
1156
|
+
(c) => compareAddress(c.address, parsedArgs.collectionAddress)
|
|
1157
|
+
)?.filterSettings;
|
|
1158
|
+
if (!collectionFilters?.exclusions || collectionFilters.exclusions.length === 0 || !collectionFilters.filterOrder || collectionFilters.filterOrder.length === 0)
|
|
1159
|
+
return filters;
|
|
1160
|
+
const { filterOrder, exclusions } = collectionFilters;
|
|
1161
|
+
const sortedFilters = filters.toSorted((a, b) => {
|
|
1162
|
+
const aIndex = filterOrder.indexOf(a.name) > -1 ? filterOrder.indexOf(a.name) : filterOrder.length;
|
|
1163
|
+
const bIndex = filterOrder.indexOf(b.name) > -1 ? filterOrder.indexOf(b.name) : filterOrder.length;
|
|
1164
|
+
return aIndex - bIndex;
|
|
1165
|
+
});
|
|
1166
|
+
const filteredResults = sortedFilters.reduce(
|
|
1167
|
+
(acc, filter) => {
|
|
1168
|
+
const exclusionRule = exclusions.find((rule) => rule.key === filter.name);
|
|
1169
|
+
if (!exclusionRule) {
|
|
1170
|
+
acc.push(filter);
|
|
1171
|
+
return acc;
|
|
1172
|
+
}
|
|
1173
|
+
if (exclusionRule.condition === "ENTIRE_KEY" /* ENTIRE_KEY */) {
|
|
1174
|
+
return acc;
|
|
1175
|
+
}
|
|
1176
|
+
if (exclusionRule.condition === "SPECIFIC_VALUE" /* SPECIFIC_VALUE */ && exclusionRule.value) {
|
|
1177
|
+
const filteredValues = filter.values?.filter((value) => value !== exclusionRule.value) || [];
|
|
1178
|
+
if (filteredValues.length > 0) {
|
|
1179
|
+
acc.push({ ...filter, values: filteredValues });
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
return acc;
|
|
1183
|
+
},
|
|
1184
|
+
[]
|
|
1185
|
+
);
|
|
1186
|
+
return filteredResults;
|
|
1158
1187
|
};
|
|
1159
1188
|
var filtersOptions = (args, config) => {
|
|
1160
1189
|
return queryOptions9({
|
|
@@ -1298,7 +1327,8 @@ var fetchCollectibleActivities = async (args, config) => {
|
|
|
1298
1327
|
var listCollectibleActivitiesOptions = (args, config) => {
|
|
1299
1328
|
return queryOptions12({
|
|
1300
1329
|
queryKey: [...collectableKeys.collectibleActivities, args, config],
|
|
1301
|
-
queryFn: () => fetchCollectibleActivities(args, config)
|
|
1330
|
+
queryFn: () => fetchCollectibleActivities(args, config),
|
|
1331
|
+
enabled: args.query?.enabled ?? true
|
|
1302
1332
|
});
|
|
1303
1333
|
};
|
|
1304
1334
|
var useListCollectibleActivities = (args) => {
|
|
@@ -1331,7 +1361,8 @@ var listCollectiblesOptions = (args, config) => {
|
|
|
1331
1361
|
queryKey: [...collectableKeys.lists, args],
|
|
1332
1362
|
queryFn: ({ pageParam }) => fetchCollectibles(args, marketplaceClient, pageParam),
|
|
1333
1363
|
initialPageParam: { page: 1, pageSize: 30 },
|
|
1334
|
-
getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0
|
|
1364
|
+
getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0,
|
|
1365
|
+
enabled: args.query?.enabled ?? true
|
|
1335
1366
|
});
|
|
1336
1367
|
};
|
|
1337
1368
|
var useListCollectibles = (args) => {
|
|
@@ -1339,8 +1370,51 @@ var useListCollectibles = (args) => {
|
|
|
1339
1370
|
return useInfiniteQuery2(listCollectiblesOptions(args, config));
|
|
1340
1371
|
};
|
|
1341
1372
|
|
|
1342
|
-
// src/react/hooks/
|
|
1373
|
+
// src/react/hooks/useListCollectiblesPaginated.tsx
|
|
1343
1374
|
import { queryOptions as queryOptions13, useQuery as useQuery13 } from "@tanstack/react-query";
|
|
1375
|
+
import { z as z14 } from "zod";
|
|
1376
|
+
var UseListCollectiblesPaginatedArgsSchema = listCollectiblesArgsSchema.omit({
|
|
1377
|
+
contractAddress: true
|
|
1378
|
+
}).extend({
|
|
1379
|
+
collectionAddress: AddressSchema,
|
|
1380
|
+
chainId: ChainIdSchema.pipe(z14.coerce.string()),
|
|
1381
|
+
query: z14.object({
|
|
1382
|
+
enabled: z14.boolean().optional(),
|
|
1383
|
+
page: z14.number().optional().default(1),
|
|
1384
|
+
pageSize: z14.number().optional().default(30)
|
|
1385
|
+
}).optional().default({})
|
|
1386
|
+
});
|
|
1387
|
+
var fetchCollectiblesPaginated = async (args, marketplaceClient) => {
|
|
1388
|
+
const parsedArgs = UseListCollectiblesPaginatedArgsSchema.parse(args);
|
|
1389
|
+
const page = {
|
|
1390
|
+
page: parsedArgs.query?.page ?? 1,
|
|
1391
|
+
pageSize: parsedArgs.query?.pageSize ?? 30
|
|
1392
|
+
};
|
|
1393
|
+
const arg = {
|
|
1394
|
+
...parsedArgs,
|
|
1395
|
+
contractAddress: parsedArgs.collectionAddress,
|
|
1396
|
+
page
|
|
1397
|
+
};
|
|
1398
|
+
return marketplaceClient.listCollectibles(arg);
|
|
1399
|
+
};
|
|
1400
|
+
var listCollectiblesPaginatedOptions = (args, config) => {
|
|
1401
|
+
const marketplaceClient = getMarketplaceClient(
|
|
1402
|
+
args.chainId,
|
|
1403
|
+
config
|
|
1404
|
+
);
|
|
1405
|
+
return queryOptions13({
|
|
1406
|
+
queryKey: [...collectableKeys.lists, "paginated", args],
|
|
1407
|
+
queryFn: () => fetchCollectiblesPaginated(args, marketplaceClient),
|
|
1408
|
+
enabled: args.query?.enabled ?? true
|
|
1409
|
+
});
|
|
1410
|
+
};
|
|
1411
|
+
var useListCollectiblesPaginated = (args) => {
|
|
1412
|
+
const config = useConfig();
|
|
1413
|
+
return useQuery13(listCollectiblesPaginatedOptions(args, config));
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
// src/react/hooks/useListCollectionActivities.tsx
|
|
1417
|
+
import { queryOptions as queryOptions14, useQuery as useQuery14 } from "@tanstack/react-query";
|
|
1344
1418
|
var fetchListCollectionActivities = async (args, config) => {
|
|
1345
1419
|
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1346
1420
|
return marketplaceClient.listCollectionActivities({
|
|
@@ -1356,23 +1430,24 @@ var fetchListCollectionActivities = async (args, config) => {
|
|
|
1356
1430
|
}));
|
|
1357
1431
|
};
|
|
1358
1432
|
var listCollectionActivitiesOptions = (args, config) => {
|
|
1359
|
-
return
|
|
1433
|
+
return queryOptions14({
|
|
1360
1434
|
queryKey: [...collectionKeys.collectionActivities, args, config],
|
|
1361
|
-
queryFn: () => fetchListCollectionActivities(args, config)
|
|
1435
|
+
queryFn: () => fetchListCollectionActivities(args, config),
|
|
1436
|
+
enabled: args.query?.enabled ?? true
|
|
1362
1437
|
});
|
|
1363
1438
|
};
|
|
1364
1439
|
var useListCollectionActivities = (args) => {
|
|
1365
1440
|
const config = useConfig();
|
|
1366
|
-
return
|
|
1441
|
+
return useQuery14(listCollectionActivitiesOptions(args, config));
|
|
1367
1442
|
};
|
|
1368
1443
|
|
|
1369
1444
|
// src/react/hooks/useListOffersForCollectible.tsx
|
|
1370
|
-
import { queryOptions as
|
|
1371
|
-
import { z as
|
|
1445
|
+
import { queryOptions as queryOptions15, useQuery as useQuery15 } from "@tanstack/react-query";
|
|
1446
|
+
import { z as z15 } from "zod";
|
|
1372
1447
|
var UseListOffersForCollectibleArgsSchema = listOffersForCollectibleArgsSchema.extend({
|
|
1373
|
-
chainId: ChainIdSchema.pipe(
|
|
1374
|
-
collectionAddress:
|
|
1375
|
-
collectibleId:
|
|
1448
|
+
chainId: ChainIdSchema.pipe(z15.coerce.string()),
|
|
1449
|
+
collectionAddress: z15.string(),
|
|
1450
|
+
collectibleId: z15.string()
|
|
1376
1451
|
}).omit({ contractAddress: true, tokenId: true });
|
|
1377
1452
|
var fetchListOffersForCollectible = async (config, args) => {
|
|
1378
1453
|
const arg = {
|
|
@@ -1385,26 +1460,26 @@ var fetchListOffersForCollectible = async (config, args) => {
|
|
|
1385
1460
|
return marketplaceClient.listCollectibleOffers(arg);
|
|
1386
1461
|
};
|
|
1387
1462
|
var listOffersForCollectibleOptions = (args, config) => {
|
|
1388
|
-
return
|
|
1463
|
+
return queryOptions15({
|
|
1389
1464
|
queryKey: [...collectableKeys.offers, args, config],
|
|
1390
1465
|
queryFn: () => fetchListOffersForCollectible(config, args)
|
|
1391
1466
|
});
|
|
1392
1467
|
};
|
|
1393
1468
|
var useListOffersForCollectible = (args) => {
|
|
1394
1469
|
const config = useConfig();
|
|
1395
|
-
return
|
|
1470
|
+
return useQuery15(listOffersForCollectibleOptions(args, config));
|
|
1396
1471
|
};
|
|
1397
1472
|
|
|
1398
1473
|
// src/react/hooks/useCountOffersForCollectible.tsx
|
|
1399
|
-
import { queryOptions as
|
|
1400
|
-
import { z as
|
|
1474
|
+
import { queryOptions as queryOptions16, useQuery as useQuery16 } from "@tanstack/react-query";
|
|
1475
|
+
import { z as z16 } from "zod";
|
|
1401
1476
|
var UseCountOffersForCollectibleArgsSchema = countOffersForCollectibleArgsSchema.omit({
|
|
1402
1477
|
contractAddress: true,
|
|
1403
1478
|
tokenId: true
|
|
1404
1479
|
}).extend({
|
|
1405
1480
|
collectionAddress: AddressSchema,
|
|
1406
|
-
collectibleId:
|
|
1407
|
-
chainId: ChainIdSchema.pipe(
|
|
1481
|
+
collectibleId: z16.string(),
|
|
1482
|
+
chainId: ChainIdSchema.pipe(z16.coerce.string()),
|
|
1408
1483
|
query: QueryArgSchema
|
|
1409
1484
|
});
|
|
1410
1485
|
var fetchCountOffersForCollectible = async (args, config) => {
|
|
@@ -1417,7 +1492,7 @@ var fetchCountOffersForCollectible = async (args, config) => {
|
|
|
1417
1492
|
});
|
|
1418
1493
|
};
|
|
1419
1494
|
var countOffersForCollectibleOptions = (args, config) => {
|
|
1420
|
-
return
|
|
1495
|
+
return queryOptions16({
|
|
1421
1496
|
...args.query,
|
|
1422
1497
|
queryKey: [...collectableKeys.offersCount, args, config],
|
|
1423
1498
|
queryFn: () => fetchCountOffersForCollectible(args, config)
|
|
@@ -1425,16 +1500,16 @@ var countOffersForCollectibleOptions = (args, config) => {
|
|
|
1425
1500
|
};
|
|
1426
1501
|
var useCountOffersForCollectible = (args) => {
|
|
1427
1502
|
const config = useConfig();
|
|
1428
|
-
return
|
|
1503
|
+
return useQuery16(countOffersForCollectibleOptions(args, config));
|
|
1429
1504
|
};
|
|
1430
1505
|
|
|
1431
1506
|
// src/react/hooks/useListListingsForCollectible.tsx
|
|
1432
|
-
import { queryOptions as
|
|
1433
|
-
import { z as
|
|
1507
|
+
import { queryOptions as queryOptions17, useQuery as useQuery17 } from "@tanstack/react-query";
|
|
1508
|
+
import { z as z17 } from "zod";
|
|
1434
1509
|
var UseListListingsForCollectibleArgsSchema = listListingsForCollectibleArgsSchema.extend({
|
|
1435
|
-
chainId: ChainIdSchema.pipe(
|
|
1436
|
-
collectionAddress:
|
|
1437
|
-
collectibleId:
|
|
1510
|
+
chainId: ChainIdSchema.pipe(z17.coerce.string()),
|
|
1511
|
+
collectionAddress: z17.string(),
|
|
1512
|
+
collectibleId: z17.string()
|
|
1438
1513
|
}).omit({ contractAddress: true, tokenId: true });
|
|
1439
1514
|
var fetchListListingsForCollectible = async (config, args) => {
|
|
1440
1515
|
const arg = {
|
|
@@ -1447,26 +1522,26 @@ var fetchListListingsForCollectible = async (config, args) => {
|
|
|
1447
1522
|
return marketplaceClient.listCollectibleListings(arg);
|
|
1448
1523
|
};
|
|
1449
1524
|
var listListingsForCollectibleOptions = (args, config) => {
|
|
1450
|
-
return
|
|
1525
|
+
return queryOptions17({
|
|
1451
1526
|
queryKey: [...collectableKeys.listings, args, config],
|
|
1452
1527
|
queryFn: () => fetchListListingsForCollectible(config, args)
|
|
1453
1528
|
});
|
|
1454
1529
|
};
|
|
1455
1530
|
var useListListingsForCollectible = (args) => {
|
|
1456
1531
|
const config = useConfig();
|
|
1457
|
-
return
|
|
1532
|
+
return useQuery17(listListingsForCollectibleOptions(args, config));
|
|
1458
1533
|
};
|
|
1459
1534
|
|
|
1460
1535
|
// src/react/hooks/useCountListingsForCollectible.tsx
|
|
1461
|
-
import { queryOptions as
|
|
1462
|
-
import { z as
|
|
1536
|
+
import { queryOptions as queryOptions18, useQuery as useQuery18 } from "@tanstack/react-query";
|
|
1537
|
+
import { z as z18 } from "zod";
|
|
1463
1538
|
var UseCountListingsForCollectibleArgsSchema = countListingsForCollectibleArgsSchema.omit({
|
|
1464
1539
|
contractAddress: true,
|
|
1465
1540
|
tokenId: true
|
|
1466
1541
|
}).extend({
|
|
1467
1542
|
collectionAddress: AddressSchema,
|
|
1468
|
-
collectibleId:
|
|
1469
|
-
chainId: ChainIdSchema.pipe(
|
|
1543
|
+
collectibleId: z18.string(),
|
|
1544
|
+
chainId: ChainIdSchema.pipe(z18.coerce.string()),
|
|
1470
1545
|
query: QueryArgSchema
|
|
1471
1546
|
});
|
|
1472
1547
|
var fetchCountListingsForCollectible = async (args, config) => {
|
|
@@ -1479,7 +1554,7 @@ var fetchCountListingsForCollectible = async (args, config) => {
|
|
|
1479
1554
|
});
|
|
1480
1555
|
};
|
|
1481
1556
|
var countListingsForCollectibleOptions = (args, config) => {
|
|
1482
|
-
return
|
|
1557
|
+
return queryOptions18({
|
|
1483
1558
|
...args.query,
|
|
1484
1559
|
queryKey: [...collectableKeys.listingsCount, args, config],
|
|
1485
1560
|
queryFn: () => fetchCountListingsForCollectible(args, config)
|
|
@@ -1487,17 +1562,17 @@ var countListingsForCollectibleOptions = (args, config) => {
|
|
|
1487
1562
|
};
|
|
1488
1563
|
var useCountListingsForCollectible = (args) => {
|
|
1489
1564
|
const config = useConfig();
|
|
1490
|
-
return
|
|
1565
|
+
return useQuery18(countListingsForCollectibleOptions(args, config));
|
|
1491
1566
|
};
|
|
1492
1567
|
|
|
1493
1568
|
// src/react/hooks/useLowestListing.tsx
|
|
1494
|
-
import { queryOptions as
|
|
1495
|
-
import { z as
|
|
1569
|
+
import { queryOptions as queryOptions19, useQuery as useQuery19 } from "@tanstack/react-query";
|
|
1570
|
+
import { z as z19 } from "zod";
|
|
1496
1571
|
var UseLowestListingSchema = getCollectibleLowestListingArgsSchema.omit({
|
|
1497
1572
|
contractAddress: true
|
|
1498
1573
|
}).extend({
|
|
1499
1574
|
collectionAddress: AddressSchema,
|
|
1500
|
-
chainId: ChainIdSchema.pipe(
|
|
1575
|
+
chainId: ChainIdSchema.pipe(z19.coerce.string()),
|
|
1501
1576
|
query: QueryArgSchema
|
|
1502
1577
|
});
|
|
1503
1578
|
var fetchLowestListing = async (args, config) => {
|
|
@@ -1509,7 +1584,7 @@ var fetchLowestListing = async (args, config) => {
|
|
|
1509
1584
|
});
|
|
1510
1585
|
};
|
|
1511
1586
|
var lowestListingOptions = (args, config) => {
|
|
1512
|
-
return
|
|
1587
|
+
return queryOptions19({
|
|
1513
1588
|
...args.query,
|
|
1514
1589
|
queryKey: [...collectableKeys.lowestListings, args, config],
|
|
1515
1590
|
queryFn: () => fetchLowestListing(args, config)
|
|
@@ -1517,17 +1592,17 @@ var lowestListingOptions = (args, config) => {
|
|
|
1517
1592
|
};
|
|
1518
1593
|
var useLowestListing = (args) => {
|
|
1519
1594
|
const config = useConfig();
|
|
1520
|
-
return
|
|
1595
|
+
return useQuery19(lowestListingOptions(args, config));
|
|
1521
1596
|
};
|
|
1522
1597
|
|
|
1523
1598
|
// src/react/hooks/useRoyaltyPercentage.tsx
|
|
1524
|
-
import { queryOptions as
|
|
1599
|
+
import { queryOptions as queryOptions20, useQuery as useQuery20 } from "@tanstack/react-query";
|
|
1525
1600
|
import { getContract } from "viem";
|
|
1526
|
-
import { z as
|
|
1527
|
-
var UseRoyaletyPercentageSchema =
|
|
1528
|
-
chainId: ChainIdSchema.pipe(
|
|
1601
|
+
import { z as z20 } from "zod";
|
|
1602
|
+
var UseRoyaletyPercentageSchema = z20.object({
|
|
1603
|
+
chainId: ChainIdSchema.pipe(z20.coerce.string()),
|
|
1529
1604
|
collectionAddress: AddressSchema,
|
|
1530
|
-
collectibleId:
|
|
1605
|
+
collectibleId: z20.string(),
|
|
1531
1606
|
query: QueryArgSchema
|
|
1532
1607
|
});
|
|
1533
1608
|
var fetchRoyaletyPercentage = async (args) => {
|
|
@@ -1548,13 +1623,13 @@ var fetchRoyaletyPercentage = async (args) => {
|
|
|
1548
1623
|
return 0n;
|
|
1549
1624
|
}
|
|
1550
1625
|
};
|
|
1551
|
-
var royaletyPercentageOptions = (args) =>
|
|
1626
|
+
var royaletyPercentageOptions = (args) => queryOptions20({
|
|
1552
1627
|
...args.query,
|
|
1553
1628
|
queryKey: [...collectableKeys.royaltyPercentage, args],
|
|
1554
1629
|
queryFn: () => fetchRoyaletyPercentage(args)
|
|
1555
1630
|
});
|
|
1556
1631
|
var useRoyaltyPercentage = (args) => {
|
|
1557
|
-
return
|
|
1632
|
+
return useQuery20(royaletyPercentageOptions(args));
|
|
1558
1633
|
};
|
|
1559
1634
|
|
|
1560
1635
|
// src/react/hooks/useGenerateListingTransaction.tsx
|
|
@@ -1613,13 +1688,13 @@ var useGenerateOfferTransaction = (params) => {
|
|
|
1613
1688
|
|
|
1614
1689
|
// src/react/hooks/useGenerateSellTransaction.tsx
|
|
1615
1690
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1616
|
-
import { z as
|
|
1617
|
-
var UserGeneratSellTransactionArgsSchema =
|
|
1618
|
-
chainId: ChainIdSchema.pipe(
|
|
1619
|
-
onSuccess:
|
|
1691
|
+
import { z as z21 } from "zod";
|
|
1692
|
+
var UserGeneratSellTransactionArgsSchema = z21.object({
|
|
1693
|
+
chainId: ChainIdSchema.pipe(z21.coerce.string()),
|
|
1694
|
+
onSuccess: z21.function().args(stepSchema.array().optional()).optional()
|
|
1620
1695
|
});
|
|
1621
1696
|
var generateSellTransaction = async (args, config, chainId) => {
|
|
1622
|
-
const parsedChainId = ChainIdSchema.pipe(
|
|
1697
|
+
const parsedChainId = ChainIdSchema.pipe(z21.coerce.string()).parse(chainId);
|
|
1623
1698
|
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
1624
1699
|
return marketplaceClient.generateSellTransaction(args).then((data) => data.steps);
|
|
1625
1700
|
};
|
|
@@ -1638,13 +1713,13 @@ var useGenerateSellTransaction = (params) => {
|
|
|
1638
1713
|
|
|
1639
1714
|
// src/react/hooks/useGenerateCancelTransaction.tsx
|
|
1640
1715
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
1641
|
-
import { z as
|
|
1642
|
-
var UserGenerateCancelTransactionArgsSchema =
|
|
1643
|
-
chainId: ChainIdSchema.pipe(
|
|
1644
|
-
onSuccess:
|
|
1716
|
+
import { z as z22 } from "zod";
|
|
1717
|
+
var UserGenerateCancelTransactionArgsSchema = z22.object({
|
|
1718
|
+
chainId: ChainIdSchema.pipe(z22.coerce.string()),
|
|
1719
|
+
onSuccess: z22.function().args(stepSchema.array().optional()).optional()
|
|
1645
1720
|
});
|
|
1646
1721
|
var generateCancelTransaction = async (args, config, chainId) => {
|
|
1647
|
-
const parsedChainId = ChainIdSchema.pipe(
|
|
1722
|
+
const parsedChainId = ChainIdSchema.pipe(z22.coerce.string()).parse(chainId);
|
|
1648
1723
|
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
1649
1724
|
return marketplaceClient.generateCancelTransaction(args).then((data) => data.steps);
|
|
1650
1725
|
};
|
|
@@ -1717,16 +1792,16 @@ var useTransferTokens = () => {
|
|
|
1717
1792
|
};
|
|
1718
1793
|
|
|
1719
1794
|
// src/react/hooks/useCheckoutOptions.tsx
|
|
1720
|
-
import { queryOptions as
|
|
1795
|
+
import { queryOptions as queryOptions21, useQuery as useQuery21 } from "@tanstack/react-query";
|
|
1721
1796
|
import { useAccount as useAccount3 } from "wagmi";
|
|
1722
|
-
import { z as
|
|
1723
|
-
var UseCheckoutOptionsSchema =
|
|
1724
|
-
chainId: ChainIdSchema.pipe(
|
|
1725
|
-
orders:
|
|
1726
|
-
|
|
1797
|
+
import { z as z23 } from "zod";
|
|
1798
|
+
var UseCheckoutOptionsSchema = z23.object({
|
|
1799
|
+
chainId: ChainIdSchema.pipe(z23.coerce.string()),
|
|
1800
|
+
orders: z23.array(
|
|
1801
|
+
z23.object({
|
|
1727
1802
|
collectionAddress: AddressSchema,
|
|
1728
|
-
orderId:
|
|
1729
|
-
marketplace:
|
|
1803
|
+
orderId: z23.string(),
|
|
1804
|
+
marketplace: z23.nativeEnum(MarketplaceKind)
|
|
1730
1805
|
})
|
|
1731
1806
|
),
|
|
1732
1807
|
query: QueryArgSchema
|
|
@@ -1745,7 +1820,7 @@ var fetchCheckoutOptions = async (args, config) => {
|
|
|
1745
1820
|
});
|
|
1746
1821
|
};
|
|
1747
1822
|
var checkoutOptionsOptions = (args, config) => {
|
|
1748
|
-
return
|
|
1823
|
+
return queryOptions21({
|
|
1749
1824
|
queryKey: ["checkoutOptions", args],
|
|
1750
1825
|
queryFn: () => fetchCheckoutOptions(args, config)
|
|
1751
1826
|
});
|
|
@@ -1753,16 +1828,16 @@ var checkoutOptionsOptions = (args, config) => {
|
|
|
1753
1828
|
var useCheckoutOptions = (args) => {
|
|
1754
1829
|
const { address } = useAccount3();
|
|
1755
1830
|
const config = useConfig();
|
|
1756
|
-
return
|
|
1831
|
+
return useQuery21(
|
|
1757
1832
|
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1758
1833
|
checkoutOptionsOptions({ walletAddress: address, ...args }, config)
|
|
1759
1834
|
);
|
|
1760
1835
|
};
|
|
1761
1836
|
|
|
1762
1837
|
// src/react/hooks/useListCollections.tsx
|
|
1763
|
-
import { queryOptions as
|
|
1764
|
-
import { z as
|
|
1765
|
-
var UseListCollectionsSchema =
|
|
1838
|
+
import { queryOptions as queryOptions22, useQuery as useQuery22 } from "@tanstack/react-query";
|
|
1839
|
+
import { z as z24 } from "zod";
|
|
1840
|
+
var UseListCollectionsSchema = z24.object({
|
|
1766
1841
|
query: QueryArgSchema.optional().default({})
|
|
1767
1842
|
});
|
|
1768
1843
|
var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
@@ -1771,11 +1846,11 @@ var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
|
1771
1846
|
return [];
|
|
1772
1847
|
}
|
|
1773
1848
|
const collectionsByChain = marketplaceConfig.collections.reduce((acc, curr) => {
|
|
1774
|
-
const { chainId,
|
|
1849
|
+
const { chainId, address } = curr;
|
|
1775
1850
|
if (!acc[chainId]) {
|
|
1776
1851
|
acc[chainId] = [];
|
|
1777
1852
|
}
|
|
1778
|
-
acc[chainId].push(
|
|
1853
|
+
acc[chainId].push(address);
|
|
1779
1854
|
return acc;
|
|
1780
1855
|
}, {});
|
|
1781
1856
|
const promises = Object.entries(collectionsByChain).map(
|
|
@@ -1788,7 +1863,7 @@ var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
|
1788
1863
|
return results.flat();
|
|
1789
1864
|
};
|
|
1790
1865
|
var listCollectionsOptions = (args, config) => {
|
|
1791
|
-
return
|
|
1866
|
+
return queryOptions22({
|
|
1792
1867
|
...args.query,
|
|
1793
1868
|
queryKey: [...collectionKeys.list],
|
|
1794
1869
|
queryFn: () => fetchListCollections(args, config)
|
|
@@ -1797,7 +1872,7 @@ var listCollectionsOptions = (args, config) => {
|
|
|
1797
1872
|
var useListCollections = (args = {}) => {
|
|
1798
1873
|
const config = useConfig();
|
|
1799
1874
|
const { data: marketplaceConfig, isLoading: isLoadingConfig } = useMarketplaceConfig();
|
|
1800
|
-
return
|
|
1875
|
+
return useQuery22({
|
|
1801
1876
|
...listCollectionsOptions(
|
|
1802
1877
|
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1803
1878
|
{ marketplaceConfig, query: args.query },
|
|
@@ -1808,21 +1883,21 @@ var useListCollections = (args = {}) => {
|
|
|
1808
1883
|
};
|
|
1809
1884
|
|
|
1810
1885
|
// src/react/hooks/useGenerateBuyTransaction.tsx
|
|
1811
|
-
import { queryOptions as
|
|
1886
|
+
import { queryOptions as queryOptions23, skipToken as skipToken2, useQuery as useQuery23 } from "@tanstack/react-query";
|
|
1812
1887
|
import { useAccount as useAccount4 } from "wagmi";
|
|
1813
|
-
import { z as
|
|
1814
|
-
var UseGenerateBuyTransactionArgsSchema =
|
|
1815
|
-
chainId: ChainIdSchema.pipe(
|
|
1888
|
+
import { z as z25 } from "zod";
|
|
1889
|
+
var UseGenerateBuyTransactionArgsSchema = z25.object({
|
|
1890
|
+
chainId: ChainIdSchema.pipe(z25.coerce.string()),
|
|
1816
1891
|
collectionAddress: AddressSchema,
|
|
1817
|
-
marketplace:
|
|
1818
|
-
ordersData:
|
|
1819
|
-
|
|
1820
|
-
orderId:
|
|
1821
|
-
quantity:
|
|
1822
|
-
marketplace:
|
|
1892
|
+
marketplace: z25.nativeEnum(MarketplaceKind),
|
|
1893
|
+
ordersData: z25.array(
|
|
1894
|
+
z25.object({
|
|
1895
|
+
orderId: z25.string(),
|
|
1896
|
+
quantity: z25.string(),
|
|
1897
|
+
marketplace: z25.string()
|
|
1823
1898
|
})
|
|
1824
1899
|
),
|
|
1825
|
-
walletType:
|
|
1900
|
+
walletType: z25.nativeEnum(WalletKind).optional(),
|
|
1826
1901
|
query: QueryArgSchema
|
|
1827
1902
|
});
|
|
1828
1903
|
var fetchGenerateBuyTransaction = async (args, config) => {
|
|
@@ -1836,7 +1911,7 @@ var fetchGenerateBuyTransaction = async (args, config) => {
|
|
|
1836
1911
|
}).then((data) => data.steps);
|
|
1837
1912
|
};
|
|
1838
1913
|
var generateBuyTransactionOptions = (args, config) => {
|
|
1839
|
-
return
|
|
1914
|
+
return queryOptions23({
|
|
1840
1915
|
queryKey: ["generateBuyTransaction", args],
|
|
1841
1916
|
queryFn: () => fetchGenerateBuyTransaction(args, config),
|
|
1842
1917
|
...args.query
|
|
@@ -1845,10 +1920,15 @@ var generateBuyTransactionOptions = (args, config) => {
|
|
|
1845
1920
|
var useGenerateBuyTransaction = (args) => {
|
|
1846
1921
|
const { address } = useAccount4();
|
|
1847
1922
|
const config = useConfig();
|
|
1848
|
-
return
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1923
|
+
return useQuery23({
|
|
1924
|
+
queryKey: ["generateBuyTransaction", args],
|
|
1925
|
+
queryFn: address ? () => {
|
|
1926
|
+
return fetchGenerateBuyTransaction(
|
|
1927
|
+
{ buyer: address, ...args },
|
|
1928
|
+
config
|
|
1929
|
+
);
|
|
1930
|
+
} : skipToken2
|
|
1931
|
+
});
|
|
1852
1932
|
};
|
|
1853
1933
|
|
|
1854
1934
|
// src/react/hooks/useCancelOrder.tsx
|
|
@@ -1856,7 +1936,7 @@ import { useState, useEffect } from "react";
|
|
|
1856
1936
|
|
|
1857
1937
|
// src/react/_internal/wallet/useWallet.ts
|
|
1858
1938
|
import { useAccount as useAccount5, useChainId, useSwitchChain, useWalletClient } from "wagmi";
|
|
1859
|
-
import { useQuery as
|
|
1939
|
+
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
1860
1940
|
|
|
1861
1941
|
// src/react/_internal/wallet/wallet.ts
|
|
1862
1942
|
import {
|
|
@@ -1978,6 +2058,7 @@ var wallet = ({
|
|
|
1978
2058
|
});
|
|
1979
2059
|
return await wallet2.signTypedData({
|
|
1980
2060
|
account: wallet2.account,
|
|
2061
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1981
2062
|
domain: stepItem.signature.domain,
|
|
1982
2063
|
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1983
2064
|
types: stepItem.signature.types,
|
|
@@ -2115,7 +2196,7 @@ var useWallet = () => {
|
|
|
2115
2196
|
const { connector, isConnected, isConnecting } = useAccount5();
|
|
2116
2197
|
const sdkConfig = useConfig();
|
|
2117
2198
|
const chainId = useChainId();
|
|
2118
|
-
const { data, isLoading, isError } =
|
|
2199
|
+
const { data, isLoading, isError } = useQuery24({
|
|
2119
2200
|
queryKey: ["wallet", chainId, connector?.uid],
|
|
2120
2201
|
queryFn: () => {
|
|
2121
2202
|
if (!walletClient || !connector || !isConnected) {
|
|
@@ -2292,10 +2373,10 @@ var useCancelTransactionSteps = ({
|
|
|
2292
2373
|
chainId
|
|
2293
2374
|
});
|
|
2294
2375
|
const getWalletChainId = async () => {
|
|
2295
|
-
return await wallet2
|
|
2376
|
+
return await wallet2?.getChainId();
|
|
2296
2377
|
};
|
|
2297
2378
|
const switchChain = async () => {
|
|
2298
|
-
await wallet2
|
|
2379
|
+
await wallet2?.switchChain(Number(chainId));
|
|
2299
2380
|
};
|
|
2300
2381
|
const checkAndSwitchChain = async () => {
|
|
2301
2382
|
const walletChainId = await getWalletChainId();
|
|
@@ -2323,7 +2404,10 @@ var useCancelTransactionSteps = ({
|
|
|
2323
2404
|
marketplace
|
|
2324
2405
|
}) => {
|
|
2325
2406
|
try {
|
|
2326
|
-
const address = await wallet2
|
|
2407
|
+
const address = await wallet2?.address();
|
|
2408
|
+
if (!address) {
|
|
2409
|
+
throw new Error("Wallet address not found");
|
|
2410
|
+
}
|
|
2327
2411
|
const steps = await generateCancelTransactionAsync({
|
|
2328
2412
|
collectionAddress,
|
|
2329
2413
|
maker: address,
|
|
@@ -2368,7 +2452,8 @@ var useCancelTransactionSteps = ({
|
|
|
2368
2452
|
if (!transactionStep && !signatureStep) {
|
|
2369
2453
|
throw new Error("No transaction or signature step found");
|
|
2370
2454
|
}
|
|
2371
|
-
let hash
|
|
2455
|
+
let hash;
|
|
2456
|
+
let reservoirOrderId;
|
|
2372
2457
|
if (transactionStep && wallet2) {
|
|
2373
2458
|
hash = await executeTransaction({ transactionStep });
|
|
2374
2459
|
if (hash) {
|
|
@@ -2407,7 +2492,7 @@ var useCancelTransactionSteps = ({
|
|
|
2407
2492
|
const executeTransaction = async ({
|
|
2408
2493
|
transactionStep
|
|
2409
2494
|
}) => {
|
|
2410
|
-
const hash = await wallet2
|
|
2495
|
+
const hash = await wallet2?.handleSendTransactionStep(
|
|
2411
2496
|
Number(chainId),
|
|
2412
2497
|
transactionStep
|
|
2413
2498
|
);
|
|
@@ -2416,7 +2501,7 @@ var useCancelTransactionSteps = ({
|
|
|
2416
2501
|
const executeSignature = async ({
|
|
2417
2502
|
signatureStep
|
|
2418
2503
|
}) => {
|
|
2419
|
-
const signature = await wallet2
|
|
2504
|
+
const signature = await wallet2?.handleSignMessageStep(
|
|
2420
2505
|
signatureStep
|
|
2421
2506
|
);
|
|
2422
2507
|
const result = await marketplaceClient.execute({
|
|
@@ -2506,7 +2591,7 @@ var useCancelOrder = ({
|
|
|
2506
2591
|
};
|
|
2507
2592
|
|
|
2508
2593
|
// src/react/hooks/useCollectionDetails.tsx
|
|
2509
|
-
import { queryOptions as
|
|
2594
|
+
import { queryOptions as queryOptions24, useQuery as useQuery25 } from "@tanstack/react-query";
|
|
2510
2595
|
var fetchCollectionDetails = async (args, marketplaceClient) => {
|
|
2511
2596
|
const { collection } = await marketplaceClient.getCollectionDetail({
|
|
2512
2597
|
contractAddress: args.collectionAddress
|
|
@@ -2515,18 +2600,18 @@ var fetchCollectionDetails = async (args, marketplaceClient) => {
|
|
|
2515
2600
|
};
|
|
2516
2601
|
var collectionDetailsOptions = (args, config) => {
|
|
2517
2602
|
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
2518
|
-
return
|
|
2603
|
+
return queryOptions24({
|
|
2519
2604
|
queryKey: ["collectionDetails", args],
|
|
2520
2605
|
queryFn: () => fetchCollectionDetails(args, marketplaceClient)
|
|
2521
2606
|
});
|
|
2522
2607
|
};
|
|
2523
2608
|
var useCollectionDetails = (args) => {
|
|
2524
2609
|
const config = useConfig();
|
|
2525
|
-
return
|
|
2610
|
+
return useQuery25(collectionDetailsOptions(args, config));
|
|
2526
2611
|
};
|
|
2527
2612
|
|
|
2528
2613
|
// src/react/hooks/useCollectionDetailsPolling.tsx
|
|
2529
|
-
import { queryOptions as
|
|
2614
|
+
import { queryOptions as queryOptions25, useQuery as useQuery26 } from "@tanstack/react-query";
|
|
2530
2615
|
var INITIAL_POLLING_INTERVAL = 2e3;
|
|
2531
2616
|
var MAX_POLLING_INTERVAL = 3e4;
|
|
2532
2617
|
var MAX_ATTEMPTS = 30;
|
|
@@ -2539,7 +2624,7 @@ var isTerminalState = (status) => {
|
|
|
2539
2624
|
].includes(status);
|
|
2540
2625
|
};
|
|
2541
2626
|
var collectionDetailsPollingOptions = (args, config) => {
|
|
2542
|
-
return
|
|
2627
|
+
return queryOptions25({
|
|
2543
2628
|
...collectionDetailsOptions(args, config),
|
|
2544
2629
|
refetchInterval: (query) => {
|
|
2545
2630
|
const data = query.state.data;
|
|
@@ -2551,7 +2636,7 @@ var collectionDetailsPollingOptions = (args, config) => {
|
|
|
2551
2636
|
return false;
|
|
2552
2637
|
}
|
|
2553
2638
|
const interval = Math.min(
|
|
2554
|
-
INITIAL_POLLING_INTERVAL *
|
|
2639
|
+
INITIAL_POLLING_INTERVAL * 1.5 ** currentAttempt,
|
|
2555
2640
|
MAX_POLLING_INTERVAL
|
|
2556
2641
|
);
|
|
2557
2642
|
return interval;
|
|
@@ -2562,7 +2647,7 @@ var collectionDetailsPollingOptions = (args, config) => {
|
|
|
2562
2647
|
};
|
|
2563
2648
|
var useCollectionDetailsPolling = (args) => {
|
|
2564
2649
|
const config = useConfig();
|
|
2565
|
-
return
|
|
2650
|
+
return useQuery26(collectionDetailsPollingOptions(args, config));
|
|
2566
2651
|
};
|
|
2567
2652
|
|
|
2568
2653
|
export {
|
|
@@ -2581,11 +2666,10 @@ export {
|
|
|
2581
2666
|
useCollectible,
|
|
2582
2667
|
collectionOptions,
|
|
2583
2668
|
useCollection,
|
|
2584
|
-
currenciesOptions,
|
|
2585
|
-
useCurrencies,
|
|
2586
2669
|
marketplaceConfigOptions,
|
|
2587
2670
|
useMarketplaceConfig,
|
|
2588
|
-
|
|
2671
|
+
currenciesOptions,
|
|
2672
|
+
useCurrencies,
|
|
2589
2673
|
currencyOptions,
|
|
2590
2674
|
useCurrency,
|
|
2591
2675
|
fetchFilters,
|
|
@@ -2602,6 +2686,8 @@ export {
|
|
|
2602
2686
|
useListCollectibleActivities,
|
|
2603
2687
|
listCollectiblesOptions,
|
|
2604
2688
|
useListCollectibles,
|
|
2689
|
+
listCollectiblesPaginatedOptions,
|
|
2690
|
+
useListCollectiblesPaginated,
|
|
2605
2691
|
listCollectionActivitiesOptions,
|
|
2606
2692
|
useListCollectionActivities,
|
|
2607
2693
|
listOffersForCollectibleOptions,
|
|
@@ -2644,4 +2730,4 @@ export {
|
|
|
2644
2730
|
collectionDetailsPollingOptions,
|
|
2645
2731
|
useCollectionDetailsPolling
|
|
2646
2732
|
};
|
|
2647
|
-
//# sourceMappingURL=chunk-
|
|
2733
|
+
//# sourceMappingURL=chunk-JWNONWD6.js.map
|