@0xsequence/marketplace-sdk 0.2.0 → 0.3.0
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/chess-tile-6BS5MQT5.png +0 -0
- package/dist/{chunk-5EOVZAKT.js → chunk-BJE7AG6V.js} +213 -97
- package/dist/chunk-BJE7AG6V.js.map +1 -0
- package/dist/{chunk-FCQCNLFZ.js → chunk-G33554LK.js} +4 -1
- package/dist/chunk-G33554LK.js.map +1 -0
- package/dist/{chunk-GZIA25G4.js → chunk-GZG2QO64.js} +22 -6
- package/dist/chunk-GZG2QO64.js.map +1 -0
- package/dist/{chunk-4E34HVSA.js → chunk-MQR6SHXZ.js} +93 -93
- package/dist/chunk-MQR6SHXZ.js.map +1 -0
- package/dist/{chunk-LFQB477Y.js → chunk-OUWB3FHZ.js} +17 -17
- package/dist/chunk-OUWB3FHZ.js.map +1 -0
- package/dist/{chunk-MD4JHPMH.js → chunk-QXLZPSSR.js} +1195 -694
- package/dist/chunk-QXLZPSSR.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/{marketplace.gen-Ceofb9Cs.d.ts → marketplace.gen-BLP7822q.d.ts} +17 -5
- package/dist/react/_internal/api/index.d.ts +4 -2
- package/dist/react/_internal/api/index.js +1 -1
- package/dist/react/_internal/index.d.ts +3 -3
- package/dist/react/_internal/index.js +7 -7
- package/dist/react/hooks/index.d.ts +242 -31
- package/dist/react/hooks/index.js +15 -3
- package/dist/react/index.css +66 -26
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +23 -9
- package/dist/react/ssr/index.js +4 -3
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/index.css +276 -0
- package/dist/react/ui/components/index.css.map +1 -0
- package/dist/react/ui/components/index.d.ts +17 -0
- package/dist/react/ui/components/index.js +24 -0
- package/dist/react/ui/components/index.js.map +1 -0
- package/dist/react/ui/icons/index.js +1 -1
- package/dist/react/ui/index.css +66 -26
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +5 -2
- package/dist/react/ui/index.js +9 -7
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +1 -1
- package/dist/{services-Dei25J6_.d.ts → services-C9-lvWcC.d.ts} +1 -1
- package/dist/styles/index.js +4 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{types-BzZVURNL.d.ts → types-QqXjNuUP.d.ts} +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +3 -3
- package/package.json +1 -1
- package/src/react/_internal/api/get-query-client.ts +3 -3
- package/src/react/_internal/api/marketplace.gen.ts +34 -10
- package/src/react/_internal/api/query-keys.ts +8 -0
- package/src/react/hooks/index.ts +3 -0
- package/src/react/hooks/useCheckoutOptions.tsx +43 -43
- package/src/react/hooks/useCountOfCollectables.tsx +52 -52
- package/src/react/hooks/useCurrencies.tsx +60 -60
- package/src/react/hooks/useCurrency.tsx +64 -0
- package/src/react/hooks/useGenerateCancleTransaction.tsx +50 -0
- package/src/react/hooks/useListBalances.tsx +2 -3
- package/src/react/hooks/useListCollectibles.tsx +5 -6
- package/src/react/hooks/useListCollections.tsx +88 -0
- package/src/react/hooks/useListListingsForCollectible.tsx +61 -0
- package/src/react/hooks/useListOffersForCollectible.tsx +14 -16
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +164 -0
- package/src/react/ui/components/_internals/custom-network-image/CustomNetworkImage.tsx +27 -0
- package/src/react/ui/components/_internals/custom-network-image/styles.css.ts +51 -0
- package/src/react/ui/components/_internals/pill/Pill.tsx +20 -0
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +194 -0
- package/src/react/ui/components/collectible-card/Footer.tsx +121 -0
- package/src/react/ui/components/collectible-card/styles.css.ts +62 -0
- package/src/react/ui/components/index.ts +1 -0
- package/src/react/ui/icons/Bell.tsx +31 -0
- package/src/react/ui/icons/DiamondEye.tsx +31 -0
- package/src/react/ui/images/chess-tile.png +0 -0
- package/src/react/ui/index.ts +3 -0
- package/src/react/ui/modals/CreateListingModal/index.tsx +152 -152
- package/src/react/ui/modals/SellModal/index.tsx +0 -1
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +92 -92
- package/src/react/ui/modals/TransferModal/index.tsx +1 -1
- package/src/react/ui/modals/modal-provider.tsx +2 -3
- package/src/types/custom.d.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-4E34HVSA.js.map +0 -1
- package/dist/chunk-5EOVZAKT.js.map +0 -1
- package/dist/chunk-FCQCNLFZ.js.map +0 -1
- package/dist/chunk-GZIA25G4.js.map +0 -1
- package/dist/chunk-LFQB477Y.js.map +0 -1
- package/dist/chunk-MD4JHPMH.js.map +0 -1
|
Binary file
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getPublicRpcClient
|
|
4
4
|
} from "./chunk-6JWGELXL.js";
|
|
5
|
-
import {
|
|
6
|
-
EIP2981_ABI
|
|
7
|
-
} from "./chunk-DBFOPEV6.js";
|
|
8
5
|
import {
|
|
9
6
|
ERC1155_ABI
|
|
10
7
|
} from "./chunk-O5JXKTWP.js";
|
|
8
|
+
import {
|
|
9
|
+
EIP2981_ABI
|
|
10
|
+
} from "./chunk-DBFOPEV6.js";
|
|
11
11
|
import {
|
|
12
12
|
AddressSchema,
|
|
13
13
|
ChainIdSchema,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
getMarketplaceClient,
|
|
45
45
|
getMetadataClient,
|
|
46
46
|
getQueryClient
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-GZG2QO64.js";
|
|
48
48
|
|
|
49
49
|
// src/react/hooks/useBalanceOfCollectible.tsx
|
|
50
50
|
import { queryOptions, skipToken, useQuery } from "@tanstack/react-query";
|
|
@@ -783,11 +783,44 @@ var useCurrencies = (args) => {
|
|
|
783
783
|
return useQuery5(currenciesOptions(args, config));
|
|
784
784
|
};
|
|
785
785
|
|
|
786
|
-
// src/react/hooks/
|
|
786
|
+
// src/react/hooks/useCurrency.tsx
|
|
787
787
|
import { queryOptions as queryOptions6, useQuery as useQuery6 } from "@tanstack/react-query";
|
|
788
788
|
import { z as z7 } from "zod";
|
|
789
|
-
var
|
|
790
|
-
|
|
789
|
+
var ChainIdCoerce2 = ChainIdSchema.transform((val) => val.toString());
|
|
790
|
+
var UseCurrencyArgsSchema = z7.object({
|
|
791
|
+
chainId: ChainIdCoerce2,
|
|
792
|
+
currencyAddress: AddressSchema,
|
|
793
|
+
query: QueryArgSchema
|
|
794
|
+
});
|
|
795
|
+
var fetchCurrency = async (chainId, currencyAddress, config) => {
|
|
796
|
+
const parsedChainId = ChainIdCoerce2.parse(chainId);
|
|
797
|
+
const queryClient = getQueryClient();
|
|
798
|
+
let currencies = queryClient.getQueryData([...currencyKeys.lists, chainId]);
|
|
799
|
+
if (!currencies) {
|
|
800
|
+
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
801
|
+
currencies = await marketplaceClient.listCurrencies().then((resp) => resp.currencies);
|
|
802
|
+
}
|
|
803
|
+
return currencies?.find(
|
|
804
|
+
(currency) => currency.contractAddress.toLowerCase() === currencyAddress.toLowerCase()
|
|
805
|
+
);
|
|
806
|
+
};
|
|
807
|
+
var currencyOptions = (args, config) => {
|
|
808
|
+
return queryOptions6({
|
|
809
|
+
...args.query,
|
|
810
|
+
queryKey: [...currencyKeys.details, args.chainId, args.currencyAddress],
|
|
811
|
+
queryFn: () => fetchCurrency(args.chainId, args.currencyAddress, config)
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
var useCurrency = (args) => {
|
|
815
|
+
const config = useConfig();
|
|
816
|
+
return useQuery6(currencyOptions(args, config));
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
// src/react/hooks/useFilters.tsx
|
|
820
|
+
import { queryOptions as queryOptions7, useQuery as useQuery7 } from "@tanstack/react-query";
|
|
821
|
+
import { z as z8 } from "zod";
|
|
822
|
+
var UseFiltersSchema = z8.object({
|
|
823
|
+
chainId: ChainIdSchema.pipe(z8.coerce.string()),
|
|
791
824
|
collectionAddress: AddressSchema,
|
|
792
825
|
query: QueryArgSchema
|
|
793
826
|
});
|
|
@@ -800,7 +833,7 @@ var fetchFilters = async (args, config) => {
|
|
|
800
833
|
}).then((resp) => resp.filters);
|
|
801
834
|
};
|
|
802
835
|
var filtersOptions = (args, config) => {
|
|
803
|
-
return
|
|
836
|
+
return queryOptions7({
|
|
804
837
|
...args.query,
|
|
805
838
|
queryKey: [...collectableKeys.filter, args, config],
|
|
806
839
|
queryFn: () => fetchFilters(args, config)
|
|
@@ -808,14 +841,14 @@ var filtersOptions = (args, config) => {
|
|
|
808
841
|
};
|
|
809
842
|
var useFilters = (args) => {
|
|
810
843
|
const config = useConfig();
|
|
811
|
-
return
|
|
844
|
+
return useQuery7(filtersOptions(args, config));
|
|
812
845
|
};
|
|
813
846
|
|
|
814
847
|
// src/react/hooks/useFloorOrder.tsx
|
|
815
|
-
import { queryOptions as
|
|
816
|
-
import { z as
|
|
817
|
-
var UseFloorOrderSchema =
|
|
818
|
-
chainId: ChainIdSchema.pipe(
|
|
848
|
+
import { queryOptions as queryOptions8, useQuery as useQuery8 } from "@tanstack/react-query";
|
|
849
|
+
import { z as z9 } from "zod";
|
|
850
|
+
var UseFloorOrderSchema = z9.object({
|
|
851
|
+
chainId: ChainIdSchema.pipe(z9.coerce.string()),
|
|
819
852
|
collectionAddress: AddressSchema,
|
|
820
853
|
query: QueryArgSchema
|
|
821
854
|
});
|
|
@@ -824,24 +857,24 @@ var fetchFloorOrder = async (args, config) => {
|
|
|
824
857
|
return marketplaceClient.getFloorOrder({ contractAddress: args.collectionAddress }).then((data) => data.collectible);
|
|
825
858
|
};
|
|
826
859
|
var floorOrderOptions = (args, config) => {
|
|
827
|
-
return
|
|
860
|
+
return queryOptions8({
|
|
828
861
|
queryKey: [...collectableKeys.floorOrders, args, config],
|
|
829
862
|
queryFn: () => fetchFloorOrder(args, config)
|
|
830
863
|
});
|
|
831
864
|
};
|
|
832
865
|
var useFloorOrder = (args) => {
|
|
833
866
|
const config = useConfig();
|
|
834
|
-
return
|
|
867
|
+
return useQuery8(floorOrderOptions(args, config));
|
|
835
868
|
};
|
|
836
869
|
|
|
837
870
|
// src/react/hooks/useHighestOffer.tsx
|
|
838
|
-
import { queryOptions as
|
|
839
|
-
import { z as
|
|
871
|
+
import { queryOptions as queryOptions9, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
872
|
+
import { z as z10 } from "zod";
|
|
840
873
|
var UseHighestOfferArgsSchema = getCollectibleHighestOfferArgsSchema.omit({
|
|
841
874
|
contractAddress: true
|
|
842
875
|
}).extend({
|
|
843
876
|
collectionAddress: AddressSchema,
|
|
844
|
-
chainId: ChainIdSchema.pipe(
|
|
877
|
+
chainId: ChainIdSchema.pipe(z10.coerce.string()),
|
|
845
878
|
query: QueryArgSchema
|
|
846
879
|
});
|
|
847
880
|
var fetchHighestOffer = async (args, config) => {
|
|
@@ -853,7 +886,7 @@ var fetchHighestOffer = async (args, config) => {
|
|
|
853
886
|
});
|
|
854
887
|
};
|
|
855
888
|
var highestOfferOptions = (args, config) => {
|
|
856
|
-
return
|
|
889
|
+
return queryOptions9({
|
|
857
890
|
...args.query,
|
|
858
891
|
queryKey: [...collectableKeys.highestOffers, args, config],
|
|
859
892
|
queryFn: () => fetchHighestOffer(args, config)
|
|
@@ -861,44 +894,44 @@ var highestOfferOptions = (args, config) => {
|
|
|
861
894
|
};
|
|
862
895
|
var useHighestOffer = (args) => {
|
|
863
896
|
const config = useConfig();
|
|
864
|
-
return
|
|
897
|
+
return useQuery9(highestOfferOptions(args, config));
|
|
865
898
|
};
|
|
866
899
|
|
|
867
900
|
// src/react/hooks/useListBalances.tsx
|
|
868
901
|
import { SortOrder as SortOrder2 } from "@0xsequence/indexer";
|
|
869
902
|
import { infiniteQueryOptions, useInfiniteQuery } from "@tanstack/react-query";
|
|
870
|
-
import { z as
|
|
871
|
-
var metadataOptionsSchema =
|
|
872
|
-
verifiedOnly:
|
|
873
|
-
unverifiedOnly:
|
|
874
|
-
includeContracts:
|
|
875
|
-
});
|
|
876
|
-
var sortOrderSchema2 =
|
|
877
|
-
var sortBySchema2 =
|
|
878
|
-
column:
|
|
903
|
+
import { z as z11 } from "zod";
|
|
904
|
+
var metadataOptionsSchema = z11.object({
|
|
905
|
+
verifiedOnly: z11.boolean().optional(),
|
|
906
|
+
unverifiedOnly: z11.boolean().optional(),
|
|
907
|
+
includeContracts: z11.array(z11.string()).optional()
|
|
908
|
+
});
|
|
909
|
+
var sortOrderSchema2 = z11.nativeEnum(SortOrder2);
|
|
910
|
+
var sortBySchema2 = z11.object({
|
|
911
|
+
column: z11.string(),
|
|
879
912
|
order: sortOrderSchema2
|
|
880
913
|
});
|
|
881
|
-
var pageSchema2 =
|
|
882
|
-
page:
|
|
883
|
-
column:
|
|
884
|
-
before:
|
|
885
|
-
after:
|
|
886
|
-
sort:
|
|
887
|
-
pageSize:
|
|
888
|
-
more:
|
|
889
|
-
});
|
|
890
|
-
var useListBalancesArgsSchema =
|
|
891
|
-
chainId: ChainIdSchema.pipe(
|
|
914
|
+
var pageSchema2 = z11.object({
|
|
915
|
+
page: z11.number().optional(),
|
|
916
|
+
column: z11.string().optional(),
|
|
917
|
+
before: z11.any().optional(),
|
|
918
|
+
after: z11.any().optional(),
|
|
919
|
+
sort: z11.array(sortBySchema2).optional(),
|
|
920
|
+
pageSize: z11.number().optional(),
|
|
921
|
+
more: z11.boolean().optional()
|
|
922
|
+
});
|
|
923
|
+
var useListBalancesArgsSchema = z11.object({
|
|
924
|
+
chainId: ChainIdSchema.pipe(z11.coerce.number()),
|
|
892
925
|
accountAddress: AddressSchema.optional(),
|
|
893
926
|
contractAddress: AddressSchema.optional(),
|
|
894
|
-
tokenId:
|
|
895
|
-
includeMetadata:
|
|
927
|
+
tokenId: z11.string().optional(),
|
|
928
|
+
includeMetadata: z11.boolean().optional(),
|
|
896
929
|
metadataOptions: metadataOptionsSchema.optional(),
|
|
897
|
-
includeCollectionTokens:
|
|
930
|
+
includeCollectionTokens: z11.boolean().optional(),
|
|
898
931
|
page: pageSchema2.optional(),
|
|
899
932
|
query: QueryArgSchema
|
|
900
933
|
});
|
|
901
|
-
var fetchBalances = async (args,
|
|
934
|
+
var fetchBalances = async (args, config, page) => {
|
|
902
935
|
const parsedArgs = useListBalancesArgsSchema.parse(args);
|
|
903
936
|
const indexerClient = getIndexerClient(parsedArgs.chainId, config);
|
|
904
937
|
return indexerClient.getTokenBalances({
|
|
@@ -911,7 +944,7 @@ var listBalancesOptions = (args, config) => {
|
|
|
911
944
|
return infiniteQueryOptions({
|
|
912
945
|
...args.query,
|
|
913
946
|
queryKey: [...balanceQueries.lists, args, config],
|
|
914
|
-
queryFn: ({ pageParam }) => fetchBalances(args,
|
|
947
|
+
queryFn: ({ pageParam }) => fetchBalances(args, config, pageParam),
|
|
915
948
|
initialPageParam: { page: 1, pageSize: 30 },
|
|
916
949
|
getNextPageParam: (lastPage) => lastPage.page.after
|
|
917
950
|
});
|
|
@@ -923,15 +956,15 @@ var useListBalances = (args) => {
|
|
|
923
956
|
|
|
924
957
|
// src/react/hooks/useListCollectibles.tsx
|
|
925
958
|
import { infiniteQueryOptions as infiniteQueryOptions2, useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
926
|
-
import { z as
|
|
959
|
+
import { z as z12 } from "zod";
|
|
927
960
|
var UseListCollectiblesArgsSchema = listCollectiblesArgsSchema.omit({
|
|
928
961
|
contractAddress: true
|
|
929
962
|
}).extend({
|
|
930
963
|
collectionAddress: AddressSchema,
|
|
931
|
-
chainId: ChainIdSchema.pipe(
|
|
964
|
+
chainId: ChainIdSchema.pipe(z12.coerce.string()),
|
|
932
965
|
query: QueryArgSchema
|
|
933
966
|
});
|
|
934
|
-
var fetchCollectibles = async (args,
|
|
967
|
+
var fetchCollectibles = async (args, marketplaceClient, page) => {
|
|
935
968
|
const parsedArgs = UseListCollectiblesArgsSchema.parse(args);
|
|
936
969
|
const arg = {
|
|
937
970
|
...parsedArgs,
|
|
@@ -943,8 +976,8 @@ var fetchCollectibles = async (args, page, marketplaceClient) => {
|
|
|
943
976
|
var listCollectiblesOptions = (args, config) => {
|
|
944
977
|
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
945
978
|
return infiniteQueryOptions2({
|
|
946
|
-
queryKey: [...collectableKeys.lists, args
|
|
947
|
-
queryFn: ({ pageParam }) => fetchCollectibles(args,
|
|
979
|
+
queryKey: [...collectableKeys.lists, args],
|
|
980
|
+
queryFn: ({ pageParam }) => fetchCollectibles(args, marketplaceClient, pageParam),
|
|
948
981
|
initialPageParam: { page: 1, pageSize: 30 },
|
|
949
982
|
getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0
|
|
950
983
|
});
|
|
@@ -955,42 +988,71 @@ var useListCollectibles = (args) => {
|
|
|
955
988
|
};
|
|
956
989
|
|
|
957
990
|
// src/react/hooks/useListOffersForCollectible.tsx
|
|
958
|
-
import {
|
|
959
|
-
import { z as
|
|
991
|
+
import { queryOptions as queryOptions10, useQuery as useQuery10 } from "@tanstack/react-query";
|
|
992
|
+
import { z as z13 } from "zod";
|
|
960
993
|
var UseListOffersForCollectibleArgsSchema = listOffersForCollectibleArgsSchema.extend({
|
|
961
|
-
chainId: ChainIdSchema.pipe(
|
|
962
|
-
|
|
963
|
-
|
|
994
|
+
chainId: ChainIdSchema.pipe(z13.coerce.string()),
|
|
995
|
+
collectionAddress: z13.string(),
|
|
996
|
+
collectibleId: z13.string()
|
|
997
|
+
}).omit({ contractAddress: true, tokenId: true });
|
|
998
|
+
var fetchListOffersForCollectible = async (config, args) => {
|
|
964
999
|
const arg = {
|
|
965
|
-
contractAddress: args.
|
|
966
|
-
tokenId: args.
|
|
1000
|
+
contractAddress: args.collectionAddress,
|
|
1001
|
+
tokenId: args.collectibleId,
|
|
967
1002
|
filter: args.filter,
|
|
968
|
-
page
|
|
1003
|
+
page: args.page
|
|
969
1004
|
};
|
|
970
1005
|
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
971
1006
|
return marketplaceClient.listCollectibleOffers(arg);
|
|
972
1007
|
};
|
|
973
1008
|
var listOffersForCollectibleOptions = (args, config) => {
|
|
974
|
-
return
|
|
1009
|
+
return queryOptions10({
|
|
975
1010
|
queryKey: [...collectableKeys.offers, args, config],
|
|
976
|
-
queryFn: (
|
|
977
|
-
initialPageParam: { page: 1, pageSize: 30 },
|
|
978
|
-
getNextPageParam: (lastPage) => lastPage.page?.more ? lastPage.page : void 0
|
|
1011
|
+
queryFn: () => fetchListOffersForCollectible(config, args)
|
|
979
1012
|
});
|
|
980
1013
|
};
|
|
981
1014
|
var useListOffersForCollectible = (args) => {
|
|
982
1015
|
const config = useConfig();
|
|
983
|
-
return
|
|
1016
|
+
return useQuery10(listOffersForCollectibleOptions(args, config));
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
// src/react/hooks/useListListingsForCollectible.tsx
|
|
1020
|
+
import { queryOptions as queryOptions11, useQuery as useQuery11 } from "@tanstack/react-query";
|
|
1021
|
+
import { z as z14 } from "zod";
|
|
1022
|
+
var UseListListingsForCollectibleArgsSchema = listListingsForCollectibleArgsSchema.extend({
|
|
1023
|
+
chainId: ChainIdSchema.pipe(z14.coerce.string()),
|
|
1024
|
+
collectionAddress: z14.string(),
|
|
1025
|
+
collectibleId: z14.string()
|
|
1026
|
+
}).omit({ contractAddress: true, tokenId: true });
|
|
1027
|
+
var fetchListListingsForCollectible = async (config, args) => {
|
|
1028
|
+
const arg = {
|
|
1029
|
+
contractAddress: args.collectionAddress,
|
|
1030
|
+
tokenId: args.collectibleId,
|
|
1031
|
+
filter: args.filter,
|
|
1032
|
+
page: args.page
|
|
1033
|
+
};
|
|
1034
|
+
const marketplaceClient = getMarketplaceClient(args.chainId, config);
|
|
1035
|
+
return marketplaceClient.listCollectibleListings(arg);
|
|
1036
|
+
};
|
|
1037
|
+
var listListingsForCollectibleOptions = (args, config) => {
|
|
1038
|
+
return queryOptions11({
|
|
1039
|
+
queryKey: [...collectableKeys.offers, args, config],
|
|
1040
|
+
queryFn: () => fetchListListingsForCollectible(config, args)
|
|
1041
|
+
});
|
|
1042
|
+
};
|
|
1043
|
+
var useListListingsForCollectible = (args) => {
|
|
1044
|
+
const config = useConfig();
|
|
1045
|
+
return useQuery11(listListingsForCollectibleOptions(args, config));
|
|
984
1046
|
};
|
|
985
1047
|
|
|
986
1048
|
// src/react/hooks/useLowestListing.tsx
|
|
987
|
-
import { queryOptions as
|
|
988
|
-
import { z as
|
|
1049
|
+
import { queryOptions as queryOptions12, useQuery as useQuery12 } from "@tanstack/react-query";
|
|
1050
|
+
import { z as z15 } from "zod";
|
|
989
1051
|
var UseLowestListingSchema = getCollectibleLowestListingArgsSchema.omit({
|
|
990
1052
|
contractAddress: true
|
|
991
1053
|
}).extend({
|
|
992
1054
|
collectionAddress: AddressSchema,
|
|
993
|
-
chainId: ChainIdSchema.pipe(
|
|
1055
|
+
chainId: ChainIdSchema.pipe(z15.coerce.string()),
|
|
994
1056
|
query: QueryArgSchema
|
|
995
1057
|
});
|
|
996
1058
|
var fetchLowestListing = async (args, config) => {
|
|
@@ -1002,7 +1064,7 @@ var fetchLowestListing = async (args, config) => {
|
|
|
1002
1064
|
});
|
|
1003
1065
|
};
|
|
1004
1066
|
var lowestListingOptions = (args, config) => {
|
|
1005
|
-
return
|
|
1067
|
+
return queryOptions12({
|
|
1006
1068
|
...args.query,
|
|
1007
1069
|
queryKey: [...collectableKeys.lowestListings, args, config],
|
|
1008
1070
|
queryFn: () => fetchLowestListing(args, config)
|
|
@@ -1010,14 +1072,14 @@ var lowestListingOptions = (args, config) => {
|
|
|
1010
1072
|
};
|
|
1011
1073
|
var useLowestListing = (args) => {
|
|
1012
1074
|
const config = useConfig();
|
|
1013
|
-
return
|
|
1075
|
+
return useQuery12(lowestListingOptions(args, config));
|
|
1014
1076
|
};
|
|
1015
1077
|
|
|
1016
1078
|
// src/react/hooks/useMarketplaceConfig.tsx
|
|
1017
|
-
import { useQuery as
|
|
1079
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
1018
1080
|
|
|
1019
1081
|
// src/react/hooks/options/marketplaceConfigOptions.ts
|
|
1020
|
-
import { queryOptions as
|
|
1082
|
+
import { queryOptions as queryOptions13 } from "@tanstack/react-query";
|
|
1021
1083
|
var fetchBuilderConfig = async (projectId, env) => {
|
|
1022
1084
|
const url = `${builderMarketplaceApi(projectId, env)}`;
|
|
1023
1085
|
const response = await fetch(`${url}/config.json`);
|
|
@@ -1057,7 +1119,7 @@ var marketplaceConfigOptions = (config) => {
|
|
|
1057
1119
|
env = config._internal.builderEnv ?? env;
|
|
1058
1120
|
}
|
|
1059
1121
|
const projectId = config.projectId;
|
|
1060
|
-
return
|
|
1122
|
+
return queryOptions13({
|
|
1061
1123
|
queryKey: [...configKeys.marketplace, env, projectId],
|
|
1062
1124
|
queryFn: () => fetchMarketplaceConfig(env, projectId)
|
|
1063
1125
|
});
|
|
@@ -1066,17 +1128,17 @@ var marketplaceConfigOptions = (config) => {
|
|
|
1066
1128
|
// src/react/hooks/useMarketplaceConfig.tsx
|
|
1067
1129
|
var useMarketplaceConfig = () => {
|
|
1068
1130
|
const config = useConfig();
|
|
1069
|
-
return
|
|
1131
|
+
return useQuery13(marketplaceConfigOptions(config));
|
|
1070
1132
|
};
|
|
1071
1133
|
|
|
1072
1134
|
// src/react/hooks/useRoyaltyPercentage.tsx
|
|
1073
|
-
import { queryOptions as
|
|
1135
|
+
import { queryOptions as queryOptions14, useQuery as useQuery14 } from "@tanstack/react-query";
|
|
1074
1136
|
import { getContract } from "viem";
|
|
1075
|
-
import { z as
|
|
1076
|
-
var UseRoyaletyPercentageSchema =
|
|
1077
|
-
chainId: ChainIdSchema.pipe(
|
|
1137
|
+
import { z as z16 } from "zod";
|
|
1138
|
+
var UseRoyaletyPercentageSchema = z16.object({
|
|
1139
|
+
chainId: ChainIdSchema.pipe(z16.coerce.string()),
|
|
1078
1140
|
collectionAddress: AddressSchema,
|
|
1079
|
-
collectibleId:
|
|
1141
|
+
collectibleId: z16.string(),
|
|
1080
1142
|
query: QueryArgSchema
|
|
1081
1143
|
});
|
|
1082
1144
|
var fetchRoyaletyPercentage = async (args) => {
|
|
@@ -1097,13 +1159,13 @@ var fetchRoyaletyPercentage = async (args) => {
|
|
|
1097
1159
|
return 0n;
|
|
1098
1160
|
}
|
|
1099
1161
|
};
|
|
1100
|
-
var royaletyPercentageOptions = (args) =>
|
|
1162
|
+
var royaletyPercentageOptions = (args) => queryOptions14({
|
|
1101
1163
|
...args.query,
|
|
1102
1164
|
queryKey: [...collectableKeys.royaltyPercentage, args],
|
|
1103
1165
|
queryFn: () => fetchRoyaletyPercentage(args)
|
|
1104
1166
|
});
|
|
1105
1167
|
var useRoyaltyPercentage = (args) => {
|
|
1106
|
-
return
|
|
1168
|
+
return useQuery14(royaletyPercentageOptions(args));
|
|
1107
1169
|
};
|
|
1108
1170
|
|
|
1109
1171
|
// src/react/hooks/useGenerateListingTransaction.tsx
|
|
@@ -1159,13 +1221,13 @@ var useGenerateOfferTransaction = (params) => {
|
|
|
1159
1221
|
|
|
1160
1222
|
// src/react/hooks/useGenerateSellTransaction.tsx
|
|
1161
1223
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1162
|
-
import { z as
|
|
1163
|
-
var UserGeneratSellTransactionArgsSchema =
|
|
1164
|
-
chainId: ChainIdSchema.pipe(
|
|
1165
|
-
onSuccess:
|
|
1224
|
+
import { z as z17 } from "zod";
|
|
1225
|
+
var UserGeneratSellTransactionArgsSchema = z17.object({
|
|
1226
|
+
chainId: ChainIdSchema.pipe(z17.coerce.string()),
|
|
1227
|
+
onSuccess: z17.function().args(stepSchema.array().optional()).optional()
|
|
1166
1228
|
});
|
|
1167
1229
|
var generateSellTransaction = async (args, config, chainId) => {
|
|
1168
|
-
const parsedChainId = ChainIdSchema.pipe(
|
|
1230
|
+
const parsedChainId = ChainIdSchema.pipe(z17.coerce.string()).parse(chainId);
|
|
1169
1231
|
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
1170
1232
|
return marketplaceClient.generateSellTransaction(args).then((data) => data.steps);
|
|
1171
1233
|
};
|
|
@@ -1238,17 +1300,17 @@ var useTransferTokens = () => {
|
|
|
1238
1300
|
};
|
|
1239
1301
|
|
|
1240
1302
|
// src/react/hooks/useCheckoutOptions.tsx
|
|
1241
|
-
import { queryOptions as
|
|
1242
|
-
import { z as
|
|
1243
|
-
var UseCheckoutOptionsSchema =
|
|
1244
|
-
chainId: ChainIdSchema.pipe(
|
|
1303
|
+
import { queryOptions as queryOptions15, useQuery as useQuery15 } from "@tanstack/react-query";
|
|
1304
|
+
import { z as z18 } from "zod";
|
|
1305
|
+
var UseCheckoutOptionsSchema = z18.object({
|
|
1306
|
+
chainId: ChainIdSchema.pipe(z18.coerce.string()),
|
|
1245
1307
|
walletAddress: AddressSchema,
|
|
1246
|
-
orders:
|
|
1247
|
-
|
|
1308
|
+
orders: z18.array(
|
|
1309
|
+
z18.object({
|
|
1248
1310
|
collectionAddress: AddressSchema,
|
|
1249
|
-
orderId:
|
|
1250
|
-
quantity:
|
|
1251
|
-
marketplace:
|
|
1311
|
+
orderId: z18.string(),
|
|
1312
|
+
quantity: z18.number(),
|
|
1313
|
+
marketplace: z18.nativeEnum(MarketplaceKind)
|
|
1252
1314
|
})
|
|
1253
1315
|
),
|
|
1254
1316
|
query: QueryArgSchema
|
|
@@ -1268,14 +1330,62 @@ var fetchCheckoutOptions = async (args, config) => {
|
|
|
1268
1330
|
});
|
|
1269
1331
|
};
|
|
1270
1332
|
var checkoutOptionsOptions = (args, config) => {
|
|
1271
|
-
return
|
|
1333
|
+
return queryOptions15({
|
|
1272
1334
|
queryKey: ["checkoutOptions", args],
|
|
1273
1335
|
queryFn: () => fetchCheckoutOptions(args, config)
|
|
1274
1336
|
});
|
|
1275
1337
|
};
|
|
1276
1338
|
var useCheckoutOptions = (args) => {
|
|
1277
1339
|
const config = useConfig();
|
|
1278
|
-
return
|
|
1340
|
+
return useQuery15(checkoutOptionsOptions(args, config));
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
// src/react/hooks/useListCollections.tsx
|
|
1344
|
+
import { queryOptions as queryOptions16, useQuery as useQuery16 } from "@tanstack/react-query";
|
|
1345
|
+
import { z as z19 } from "zod";
|
|
1346
|
+
var UseListCollectionsSchema = z19.object({
|
|
1347
|
+
query: QueryArgSchema.optional().default({})
|
|
1348
|
+
});
|
|
1349
|
+
var fetchListCollections = async ({ marketplaceConfig }, config) => {
|
|
1350
|
+
const metadataClient = getMetadataClient(config);
|
|
1351
|
+
if (!marketplaceConfig?.collections?.length) {
|
|
1352
|
+
return [];
|
|
1353
|
+
}
|
|
1354
|
+
const collectionsByChain = marketplaceConfig.collections.reduce((acc, curr) => {
|
|
1355
|
+
const { chainId, collectionAddress } = curr;
|
|
1356
|
+
if (!acc[chainId]) {
|
|
1357
|
+
acc[chainId] = [];
|
|
1358
|
+
}
|
|
1359
|
+
acc[chainId].push(collectionAddress);
|
|
1360
|
+
return acc;
|
|
1361
|
+
}, {});
|
|
1362
|
+
const promises = Object.entries(collectionsByChain).map(
|
|
1363
|
+
([chainId, addresses]) => metadataClient.getContractInfoBatch({
|
|
1364
|
+
chainID: chainId,
|
|
1365
|
+
contractAddresses: addresses
|
|
1366
|
+
}).then((resp) => Object.values(resp.contractInfoMap))
|
|
1367
|
+
);
|
|
1368
|
+
const results = await Promise.all(promises);
|
|
1369
|
+
return results.flat();
|
|
1370
|
+
};
|
|
1371
|
+
var listCollectionsOptions = (args, config) => {
|
|
1372
|
+
return queryOptions16({
|
|
1373
|
+
...args.query,
|
|
1374
|
+
queryKey: [...collectionKeys.list],
|
|
1375
|
+
queryFn: () => fetchListCollections(args, config)
|
|
1376
|
+
});
|
|
1377
|
+
};
|
|
1378
|
+
var useListCollections = (args = {}) => {
|
|
1379
|
+
const config = useConfig();
|
|
1380
|
+
const { data: marketplaceConfig, isLoading: isLoadingConfig } = useMarketplaceConfig();
|
|
1381
|
+
return useQuery16({
|
|
1382
|
+
...listCollectionsOptions(
|
|
1383
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
1384
|
+
{ marketplaceConfig, query: args.query },
|
|
1385
|
+
config
|
|
1386
|
+
),
|
|
1387
|
+
enabled: !isLoadingConfig && !!marketplaceConfig
|
|
1388
|
+
});
|
|
1279
1389
|
};
|
|
1280
1390
|
|
|
1281
1391
|
export {
|
|
@@ -1292,6 +1402,8 @@ export {
|
|
|
1292
1402
|
useCollection,
|
|
1293
1403
|
currenciesOptions,
|
|
1294
1404
|
useCurrencies,
|
|
1405
|
+
currencyOptions,
|
|
1406
|
+
useCurrency,
|
|
1295
1407
|
fetchFilters,
|
|
1296
1408
|
filtersOptions,
|
|
1297
1409
|
useFilters,
|
|
@@ -1306,6 +1418,8 @@ export {
|
|
|
1306
1418
|
useListCollectibles,
|
|
1307
1419
|
listOffersForCollectibleOptions,
|
|
1308
1420
|
useListOffersForCollectible,
|
|
1421
|
+
listListingsForCollectibleOptions,
|
|
1422
|
+
useListListingsForCollectible,
|
|
1309
1423
|
lowestListingOptions,
|
|
1310
1424
|
useLowestListing,
|
|
1311
1425
|
marketplaceConfigOptions,
|
|
@@ -1320,6 +1434,8 @@ export {
|
|
|
1320
1434
|
useGenerateSellTransaction,
|
|
1321
1435
|
useTransferTokens,
|
|
1322
1436
|
checkoutOptionsOptions,
|
|
1323
|
-
useCheckoutOptions
|
|
1437
|
+
useCheckoutOptions,
|
|
1438
|
+
listCollectionsOptions,
|
|
1439
|
+
useListCollections
|
|
1324
1440
|
};
|
|
1325
|
-
//# sourceMappingURL=chunk-
|
|
1441
|
+
//# sourceMappingURL=chunk-BJE7AG6V.js.map
|