@0xsequence/marketplace-sdk 0.3.9 → 0.3.10
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/{chunk-OQDNL7UW.js → chunk-NS5J356Z.js} +102 -89
- package/dist/chunk-NS5J356Z.js.map +1 -0
- package/dist/{chunk-VOSDZXYO.js → chunk-RJTMPFSZ.js} +3 -16
- package/dist/chunk-RJTMPFSZ.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/react/hooks/index.js +2 -2
- package/dist/react/index.js +3 -3
- package/dist/react/ui/components/index.js +3 -3
- package/dist/react/ui/index.js +3 -3
- package/dist/utils/abi/index.js +5 -5
- package/dist/utils/index.js +5 -5
- package/package.json +1 -1
- package/src/react/hooks/index.ts +1 -0
- package/dist/chunk-OQDNL7UW.js.map +0 -1
- package/dist/chunk-VOSDZXYO.js.map +0 -1
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
getPresentableChainName,
|
|
15
15
|
getPublicRpcClient
|
|
16
16
|
} from "./chunk-KRMV6FJE.js";
|
|
17
|
-
import {
|
|
18
|
-
EIP2981_ABI
|
|
19
|
-
} from "./chunk-3OHM45R3.js";
|
|
20
17
|
import {
|
|
21
18
|
ERC1155_ABI
|
|
22
19
|
} from "./chunk-WFE6OCYF.js";
|
|
20
|
+
import {
|
|
21
|
+
EIP2981_ABI
|
|
22
|
+
} from "./chunk-3OHM45R3.js";
|
|
23
23
|
import {
|
|
24
24
|
AddressSchema,
|
|
25
25
|
ChainIdSchema,
|
|
@@ -846,8 +846,76 @@ var useCurrencies = (args) => {
|
|
|
846
846
|
return useQuery5(currenciesOptions(args, config));
|
|
847
847
|
};
|
|
848
848
|
|
|
849
|
+
// src/react/hooks/useMarketplaceConfig.tsx
|
|
850
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
851
|
+
|
|
852
|
+
// src/react/hooks/options/marketplaceConfigOptions.ts
|
|
853
|
+
import { queryOptions as queryOptions6 } from "@tanstack/react-query";
|
|
854
|
+
var fetchBuilderConfig = async (projectId, env) => {
|
|
855
|
+
const url = `${builderMarketplaceApi(projectId, env)}`;
|
|
856
|
+
const response = await fetch(`${url}/config.json`);
|
|
857
|
+
const json = await response.json();
|
|
858
|
+
if (!response.ok) {
|
|
859
|
+
console.error("Failed to fetch marketplace config:", response.status, json);
|
|
860
|
+
switch (json.code) {
|
|
861
|
+
case 3e3:
|
|
862
|
+
throw new ProjectNotFoundError(projectId, url);
|
|
863
|
+
default:
|
|
864
|
+
throw new MarketplaceConfigFetchError(json.msg);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return json;
|
|
868
|
+
};
|
|
869
|
+
var fetchStyles = async (projectId, env) => {
|
|
870
|
+
const response = await fetch(
|
|
871
|
+
`${builderMarketplaceApi(projectId, env)}/styles.css`
|
|
872
|
+
);
|
|
873
|
+
const styles = await response.text();
|
|
874
|
+
return styles.replaceAll(/['"]/g, "");
|
|
875
|
+
};
|
|
876
|
+
var fetchMarketplaceConfig = async (env, projectId) => {
|
|
877
|
+
const [marketplaceConfig, cssString] = await Promise.all([
|
|
878
|
+
fetchBuilderConfig(projectId, env),
|
|
879
|
+
fetchStyles(projectId, env)
|
|
880
|
+
]);
|
|
881
|
+
return {
|
|
882
|
+
...marketplaceConfig,
|
|
883
|
+
cssString,
|
|
884
|
+
manifestUrl: `${builderMarketplaceApi(projectId, env)}/manifest.json`
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
var marketplaceConfigOptions = (config) => {
|
|
888
|
+
let env = "production";
|
|
889
|
+
if ("_internal" in config && config._internal !== void 0) {
|
|
890
|
+
env = config._internal.builderEnv ?? env;
|
|
891
|
+
}
|
|
892
|
+
const projectId = config.projectId;
|
|
893
|
+
return queryOptions6({
|
|
894
|
+
queryKey: [...configKeys.marketplace, env, projectId],
|
|
895
|
+
queryFn: () => fetchMarketplaceConfig(env, projectId)
|
|
896
|
+
});
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
// src/react/hooks/useMarketplaceConfig.tsx
|
|
900
|
+
var useMarketplaceConfig = () => {
|
|
901
|
+
const config = useConfig();
|
|
902
|
+
return useQuery6(marketplaceConfigOptions(config));
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
// src/react/hooks/useCurrencyOptions.tsx
|
|
906
|
+
function useCurrencyOptions({
|
|
907
|
+
collectionAddress
|
|
908
|
+
}) {
|
|
909
|
+
const { data: marketplaceConfig } = useMarketplaceConfig();
|
|
910
|
+
const collections = marketplaceConfig?.collections;
|
|
911
|
+
const currencyOptions2 = collections?.find(
|
|
912
|
+
(collection) => collection.collectionAddress === collectionAddress
|
|
913
|
+
)?.currencyOptions;
|
|
914
|
+
return currencyOptions2;
|
|
915
|
+
}
|
|
916
|
+
|
|
849
917
|
// src/react/hooks/useCurrency.tsx
|
|
850
|
-
import { queryOptions as
|
|
918
|
+
import { queryOptions as queryOptions7, useQuery as useQuery7 } from "@tanstack/react-query";
|
|
851
919
|
import { z as z7 } from "zod";
|
|
852
920
|
var ChainIdCoerce2 = ChainIdSchema.transform((val) => val.toString());
|
|
853
921
|
var UseCurrencyArgsSchema = z7.object({
|
|
@@ -868,7 +936,7 @@ var fetchCurrency = async (chainId, currencyAddress, config) => {
|
|
|
868
936
|
);
|
|
869
937
|
};
|
|
870
938
|
var currencyOptions = (args, config) => {
|
|
871
|
-
return
|
|
939
|
+
return queryOptions7({
|
|
872
940
|
...args.query,
|
|
873
941
|
queryKey: [...currencyKeys.details, args.chainId, args.currencyAddress],
|
|
874
942
|
queryFn: () => fetchCurrency(args.chainId, args.currencyAddress, config)
|
|
@@ -876,11 +944,11 @@ var currencyOptions = (args, config) => {
|
|
|
876
944
|
};
|
|
877
945
|
var useCurrency = (args) => {
|
|
878
946
|
const config = useConfig();
|
|
879
|
-
return
|
|
947
|
+
return useQuery7(currencyOptions(args, config));
|
|
880
948
|
};
|
|
881
949
|
|
|
882
950
|
// src/react/hooks/useFilters.tsx
|
|
883
|
-
import { queryOptions as
|
|
951
|
+
import { queryOptions as queryOptions8, useQuery as useQuery8 } from "@tanstack/react-query";
|
|
884
952
|
import { z as z8 } from "zod";
|
|
885
953
|
var UseFiltersSchema = z8.object({
|
|
886
954
|
chainId: ChainIdSchema.pipe(z8.coerce.string()),
|
|
@@ -896,7 +964,7 @@ var fetchFilters = async (args, config) => {
|
|
|
896
964
|
}).then((resp) => resp.filters);
|
|
897
965
|
};
|
|
898
966
|
var filtersOptions = (args, config) => {
|
|
899
|
-
return
|
|
967
|
+
return queryOptions8({
|
|
900
968
|
...args.query,
|
|
901
969
|
queryKey: [...collectableKeys.filter, args, config],
|
|
902
970
|
queryFn: () => fetchFilters(args, config)
|
|
@@ -904,11 +972,11 @@ var filtersOptions = (args, config) => {
|
|
|
904
972
|
};
|
|
905
973
|
var useFilters = (args) => {
|
|
906
974
|
const config = useConfig();
|
|
907
|
-
return
|
|
975
|
+
return useQuery8(filtersOptions(args, config));
|
|
908
976
|
};
|
|
909
977
|
|
|
910
978
|
// src/react/hooks/useFloorOrder.tsx
|
|
911
|
-
import { queryOptions as
|
|
979
|
+
import { queryOptions as queryOptions9, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
912
980
|
import { z as z9 } from "zod";
|
|
913
981
|
var UseFloorOrderSchema = z9.object({
|
|
914
982
|
chainId: ChainIdSchema.pipe(z9.coerce.string()),
|
|
@@ -920,18 +988,18 @@ var fetchFloorOrder = async (args, config) => {
|
|
|
920
988
|
return marketplaceClient.getFloorOrder({ contractAddress: args.collectionAddress }).then((data) => data.collectible);
|
|
921
989
|
};
|
|
922
990
|
var floorOrderOptions = (args, config) => {
|
|
923
|
-
return
|
|
991
|
+
return queryOptions9({
|
|
924
992
|
queryKey: [...collectableKeys.floorOrders, args, config],
|
|
925
993
|
queryFn: () => fetchFloorOrder(args, config)
|
|
926
994
|
});
|
|
927
995
|
};
|
|
928
996
|
var useFloorOrder = (args) => {
|
|
929
997
|
const config = useConfig();
|
|
930
|
-
return
|
|
998
|
+
return useQuery9(floorOrderOptions(args, config));
|
|
931
999
|
};
|
|
932
1000
|
|
|
933
1001
|
// src/react/hooks/useHighestOffer.tsx
|
|
934
|
-
import { queryOptions as
|
|
1002
|
+
import { queryOptions as queryOptions10, useQuery as useQuery10 } from "@tanstack/react-query";
|
|
935
1003
|
import { z as z10 } from "zod";
|
|
936
1004
|
var UseHighestOfferArgsSchema = getCollectibleHighestOfferArgsSchema.omit({
|
|
937
1005
|
contractAddress: true
|
|
@@ -949,7 +1017,7 @@ var fetchHighestOffer = async (args, config) => {
|
|
|
949
1017
|
});
|
|
950
1018
|
};
|
|
951
1019
|
var highestOfferOptions = (args, config) => {
|
|
952
|
-
return
|
|
1020
|
+
return queryOptions10({
|
|
953
1021
|
...args.query,
|
|
954
1022
|
queryKey: [...collectableKeys.highestOffers, args, config],
|
|
955
1023
|
queryFn: () => fetchHighestOffer(args, config)
|
|
@@ -957,7 +1025,7 @@ var highestOfferOptions = (args, config) => {
|
|
|
957
1025
|
};
|
|
958
1026
|
var useHighestOffer = (args) => {
|
|
959
1027
|
const config = useConfig();
|
|
960
|
-
return
|
|
1028
|
+
return useQuery10(highestOfferOptions(args, config));
|
|
961
1029
|
};
|
|
962
1030
|
|
|
963
1031
|
// src/react/hooks/useListBalances.tsx
|
|
@@ -1051,7 +1119,7 @@ var useListCollectibles = (args) => {
|
|
|
1051
1119
|
};
|
|
1052
1120
|
|
|
1053
1121
|
// src/react/hooks/useListOffersForCollectible.tsx
|
|
1054
|
-
import { queryOptions as
|
|
1122
|
+
import { queryOptions as queryOptions11, useQuery as useQuery11 } from "@tanstack/react-query";
|
|
1055
1123
|
import { z as z13 } from "zod";
|
|
1056
1124
|
var UseListOffersForCollectibleArgsSchema = listOffersForCollectibleArgsSchema.extend({
|
|
1057
1125
|
chainId: ChainIdSchema.pipe(z13.coerce.string()),
|
|
@@ -1069,18 +1137,18 @@ var fetchListOffersForCollectible = async (config, args) => {
|
|
|
1069
1137
|
return marketplaceClient.listCollectibleOffers(arg);
|
|
1070
1138
|
};
|
|
1071
1139
|
var listOffersForCollectibleOptions = (args, config) => {
|
|
1072
|
-
return
|
|
1140
|
+
return queryOptions11({
|
|
1073
1141
|
queryKey: [...collectableKeys.offers, args, config],
|
|
1074
1142
|
queryFn: () => fetchListOffersForCollectible(config, args)
|
|
1075
1143
|
});
|
|
1076
1144
|
};
|
|
1077
1145
|
var useListOffersForCollectible = (args) => {
|
|
1078
1146
|
const config = useConfig();
|
|
1079
|
-
return
|
|
1147
|
+
return useQuery11(listOffersForCollectibleOptions(args, config));
|
|
1080
1148
|
};
|
|
1081
1149
|
|
|
1082
1150
|
// src/react/hooks/useCountOffersForCollectible.tsx
|
|
1083
|
-
import { queryOptions as
|
|
1151
|
+
import { queryOptions as queryOptions12, useQuery as useQuery12 } from "@tanstack/react-query";
|
|
1084
1152
|
import { z as z14 } from "zod";
|
|
1085
1153
|
var UseCountOffersForCollectibleArgsSchema = countOffersForCollectibleArgsSchema.omit({
|
|
1086
1154
|
contractAddress: true,
|
|
@@ -1101,7 +1169,7 @@ var fetchCountOffersForCollectible = async (args, config) => {
|
|
|
1101
1169
|
});
|
|
1102
1170
|
};
|
|
1103
1171
|
var countOffersForCollectibleOptions = (args, config) => {
|
|
1104
|
-
return
|
|
1172
|
+
return queryOptions12({
|
|
1105
1173
|
...args.query,
|
|
1106
1174
|
queryKey: [...collectableKeys.offersCount, args, config],
|
|
1107
1175
|
queryFn: () => fetchCountOffersForCollectible(args, config)
|
|
@@ -1109,11 +1177,11 @@ var countOffersForCollectibleOptions = (args, config) => {
|
|
|
1109
1177
|
};
|
|
1110
1178
|
var useCountOffersForCollectible = (args) => {
|
|
1111
1179
|
const config = useConfig();
|
|
1112
|
-
return
|
|
1180
|
+
return useQuery12(countOffersForCollectibleOptions(args, config));
|
|
1113
1181
|
};
|
|
1114
1182
|
|
|
1115
1183
|
// src/react/hooks/useListListingsForCollectible.tsx
|
|
1116
|
-
import { queryOptions as
|
|
1184
|
+
import { queryOptions as queryOptions13, useQuery as useQuery13 } from "@tanstack/react-query";
|
|
1117
1185
|
import { z as z15 } from "zod";
|
|
1118
1186
|
var UseListListingsForCollectibleArgsSchema = listListingsForCollectibleArgsSchema.extend({
|
|
1119
1187
|
chainId: ChainIdSchema.pipe(z15.coerce.string()),
|
|
@@ -1131,18 +1199,18 @@ var fetchListListingsForCollectible = async (config, args) => {
|
|
|
1131
1199
|
return marketplaceClient.listCollectibleListings(arg);
|
|
1132
1200
|
};
|
|
1133
1201
|
var listListingsForCollectibleOptions = (args, config) => {
|
|
1134
|
-
return
|
|
1202
|
+
return queryOptions13({
|
|
1135
1203
|
queryKey: [...collectableKeys.listings, args, config],
|
|
1136
1204
|
queryFn: () => fetchListListingsForCollectible(config, args)
|
|
1137
1205
|
});
|
|
1138
1206
|
};
|
|
1139
1207
|
var useListListingsForCollectible = (args) => {
|
|
1140
1208
|
const config = useConfig();
|
|
1141
|
-
return
|
|
1209
|
+
return useQuery13(listListingsForCollectibleOptions(args, config));
|
|
1142
1210
|
};
|
|
1143
1211
|
|
|
1144
1212
|
// src/react/hooks/useCountListingsForCollectible.tsx
|
|
1145
|
-
import { queryOptions as
|
|
1213
|
+
import { queryOptions as queryOptions14, useQuery as useQuery14 } from "@tanstack/react-query";
|
|
1146
1214
|
import { z as z16 } from "zod";
|
|
1147
1215
|
var UseCountListingsForCollectibleArgsSchema = countListingsForCollectibleArgsSchema.omit({
|
|
1148
1216
|
contractAddress: true,
|
|
@@ -1163,7 +1231,7 @@ var fetchCountListingsForCollectible = async (args, config) => {
|
|
|
1163
1231
|
});
|
|
1164
1232
|
};
|
|
1165
1233
|
var countListingsForCollectibleOptions = (args, config) => {
|
|
1166
|
-
return
|
|
1234
|
+
return queryOptions14({
|
|
1167
1235
|
...args.query,
|
|
1168
1236
|
queryKey: [...collectableKeys.listingsCount, args, config],
|
|
1169
1237
|
queryFn: () => fetchCountListingsForCollectible(args, config)
|
|
@@ -1171,11 +1239,11 @@ var countListingsForCollectibleOptions = (args, config) => {
|
|
|
1171
1239
|
};
|
|
1172
1240
|
var useCountListingsForCollectible = (args) => {
|
|
1173
1241
|
const config = useConfig();
|
|
1174
|
-
return
|
|
1242
|
+
return useQuery14(countListingsForCollectibleOptions(args, config));
|
|
1175
1243
|
};
|
|
1176
1244
|
|
|
1177
1245
|
// src/react/hooks/useLowestListing.tsx
|
|
1178
|
-
import { queryOptions as
|
|
1246
|
+
import { queryOptions as queryOptions15, useQuery as useQuery15 } from "@tanstack/react-query";
|
|
1179
1247
|
import { z as z17 } from "zod";
|
|
1180
1248
|
var UseLowestListingSchema = getCollectibleLowestListingArgsSchema.omit({
|
|
1181
1249
|
contractAddress: true
|
|
@@ -1193,7 +1261,7 @@ var fetchLowestListing = async (args, config) => {
|
|
|
1193
1261
|
});
|
|
1194
1262
|
};
|
|
1195
1263
|
var lowestListingOptions = (args, config) => {
|
|
1196
|
-
return
|
|
1264
|
+
return queryOptions15({
|
|
1197
1265
|
...args.query,
|
|
1198
1266
|
queryKey: [...collectableKeys.lowestListings, args, config],
|
|
1199
1267
|
queryFn: () => fetchLowestListing(args, config)
|
|
@@ -1201,63 +1269,7 @@ var lowestListingOptions = (args, config) => {
|
|
|
1201
1269
|
};
|
|
1202
1270
|
var useLowestListing = (args) => {
|
|
1203
1271
|
const config = useConfig();
|
|
1204
|
-
return
|
|
1205
|
-
};
|
|
1206
|
-
|
|
1207
|
-
// src/react/hooks/useMarketplaceConfig.tsx
|
|
1208
|
-
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
1209
|
-
|
|
1210
|
-
// src/react/hooks/options/marketplaceConfigOptions.ts
|
|
1211
|
-
import { queryOptions as queryOptions15 } from "@tanstack/react-query";
|
|
1212
|
-
var fetchBuilderConfig = async (projectId, env) => {
|
|
1213
|
-
const url = `${builderMarketplaceApi(projectId, env)}`;
|
|
1214
|
-
const response = await fetch(`${url}/config.json`);
|
|
1215
|
-
const json = await response.json();
|
|
1216
|
-
if (!response.ok) {
|
|
1217
|
-
console.error("Failed to fetch marketplace config:", response.status, json);
|
|
1218
|
-
switch (json.code) {
|
|
1219
|
-
case 3e3:
|
|
1220
|
-
throw new ProjectNotFoundError(projectId, url);
|
|
1221
|
-
default:
|
|
1222
|
-
throw new MarketplaceConfigFetchError(json.msg);
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
return json;
|
|
1226
|
-
};
|
|
1227
|
-
var fetchStyles = async (projectId, env) => {
|
|
1228
|
-
const response = await fetch(
|
|
1229
|
-
`${builderMarketplaceApi(projectId, env)}/styles.css`
|
|
1230
|
-
);
|
|
1231
|
-
const styles = await response.text();
|
|
1232
|
-
return styles.replaceAll(/['"]/g, "");
|
|
1233
|
-
};
|
|
1234
|
-
var fetchMarketplaceConfig = async (env, projectId) => {
|
|
1235
|
-
const [marketplaceConfig, cssString] = await Promise.all([
|
|
1236
|
-
fetchBuilderConfig(projectId, env),
|
|
1237
|
-
fetchStyles(projectId, env)
|
|
1238
|
-
]);
|
|
1239
|
-
return {
|
|
1240
|
-
...marketplaceConfig,
|
|
1241
|
-
cssString,
|
|
1242
|
-
manifestUrl: `${builderMarketplaceApi(projectId, env)}/manifest.json`
|
|
1243
|
-
};
|
|
1244
|
-
};
|
|
1245
|
-
var marketplaceConfigOptions = (config) => {
|
|
1246
|
-
let env = "production";
|
|
1247
|
-
if ("_internal" in config && config._internal !== void 0) {
|
|
1248
|
-
env = config._internal.builderEnv ?? env;
|
|
1249
|
-
}
|
|
1250
|
-
const projectId = config.projectId;
|
|
1251
|
-
return queryOptions15({
|
|
1252
|
-
queryKey: [...configKeys.marketplace, env, projectId],
|
|
1253
|
-
queryFn: () => fetchMarketplaceConfig(env, projectId)
|
|
1254
|
-
});
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
// src/react/hooks/useMarketplaceConfig.tsx
|
|
1258
|
-
var useMarketplaceConfig = () => {
|
|
1259
|
-
const config = useConfig();
|
|
1260
|
-
return useQuery15(marketplaceConfigOptions(config));
|
|
1272
|
+
return useQuery15(lowestListingOptions(args, config));
|
|
1261
1273
|
};
|
|
1262
1274
|
|
|
1263
1275
|
// src/react/hooks/useRoyaltyPercentage.tsx
|
|
@@ -2350,6 +2362,9 @@ export {
|
|
|
2350
2362
|
useCollection,
|
|
2351
2363
|
currenciesOptions,
|
|
2352
2364
|
useCurrencies,
|
|
2365
|
+
marketplaceConfigOptions,
|
|
2366
|
+
useMarketplaceConfig,
|
|
2367
|
+
useCurrencyOptions,
|
|
2353
2368
|
currencyOptions,
|
|
2354
2369
|
useCurrency,
|
|
2355
2370
|
fetchFilters,
|
|
@@ -2374,8 +2389,6 @@ export {
|
|
|
2374
2389
|
useCountListingsForCollectible,
|
|
2375
2390
|
lowestListingOptions,
|
|
2376
2391
|
useLowestListing,
|
|
2377
|
-
marketplaceConfigOptions,
|
|
2378
|
-
useMarketplaceConfig,
|
|
2379
2392
|
royaletyPercentageOptions,
|
|
2380
2393
|
useRoyaltyPercentage,
|
|
2381
2394
|
generateListingTransaction,
|
|
@@ -2402,4 +2415,4 @@ export {
|
|
|
2402
2415
|
useCancelOrder,
|
|
2403
2416
|
useBuyCollectable
|
|
2404
2417
|
};
|
|
2405
|
-
//# sourceMappingURL=chunk-
|
|
2418
|
+
//# sourceMappingURL=chunk-NS5J356Z.js.map
|