@0xsequence/marketplace-sdk 0.0.1 → 0.1.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/chunk-7CL54NCX.js +41 -0
- package/dist/chunk-7CL54NCX.js.map +1 -0
- package/dist/{chunk-G3D572BT.js → chunk-G3YU4NQ2.js} +24 -1
- package/dist/chunk-G3YU4NQ2.js.map +1 -0
- package/dist/{chunk-SM7V6ZWI.js → chunk-GNB736ZE.js} +226 -208
- package/dist/chunk-GNB736ZE.js.map +1 -0
- package/dist/chunk-ITJEOCDV.js +1006 -0
- package/dist/chunk-ITJEOCDV.js.map +1 -0
- package/dist/{chunk-QOJXWHRZ.js → chunk-LFQB477Y.js} +3 -1
- package/dist/chunk-LFQB477Y.js.map +1 -0
- package/dist/{chunk-VPGWEMWL.js → chunk-M4MXVMAM.js} +134 -25
- package/dist/chunk-M4MXVMAM.js.map +1 -0
- package/dist/{chunk-4PFMUVE4.js → chunk-SNOEEUPZ.js} +2 -2
- package/dist/{create-config-Dz0gCiQ0.d.ts → create-config-Cto2ehcz.d.ts} +1 -1
- package/dist/index.css +4 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/{marketplace-config-DZbtyrma.d.ts → marketplace-config-Bbxl-uKX.d.ts} +2 -1
- package/dist/react/_internal/index.d.ts +4 -3
- package/dist/react/_internal/index.js +9 -1
- package/dist/react/_internal/wagmi/index.d.ts +2 -2
- package/dist/react/hooks/index.d.ts +1363 -101
- package/dist/react/hooks/index.js +13 -7
- package/dist/react/index.css +4 -1
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.ts +6 -5
- package/dist/react/index.js +28 -22
- package/dist/react/ssr/index.d.ts +2 -1
- package/dist/react/ssr/index.js +23 -0
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/index.css +4 -1
- package/dist/react/ui/index.css.map +1 -1
- package/dist/react/ui/index.d.ts +4 -4
- package/dist/react/ui/index.js +5 -5
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +2 -2
- package/dist/styles/index.css +4 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/index.d.ts +2 -1
- package/dist/styles/index.js +3 -4972
- package/dist/styles/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +1 -1
- package/dist/types-BzZVURNL.d.ts +19 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +1 -1
- package/package.json +3 -2
- package/src/react/_internal/api/zod-schema.ts +636 -0
- package/src/react/_internal/types.ts +32 -8
- package/src/react/hooks/index.ts +1 -0
- package/src/react/hooks/useBalanceOfCollectible.tsx +43 -18
- package/src/react/hooks/useCollectible.tsx +17 -11
- package/src/react/hooks/useCollection.tsx +35 -29
- package/src/react/hooks/useCountOfCollectables.tsx +77 -0
- package/src/react/hooks/useCurrencies.tsx +23 -12
- package/src/react/hooks/useFilters.tsx +15 -9
- package/src/react/hooks/useFloorOrder.tsx +23 -8
- package/src/react/hooks/useGenerateSellTransaction.tsx +16 -9
- package/src/react/hooks/useHighestOffer.tsx +23 -13
- package/src/react/hooks/useListBalances.tsx +57 -26
- package/src/react/hooks/useListCollectibles.tsx +25 -12
- package/src/react/hooks/useListOffersForCollectible.tsx +13 -5
- package/src/react/hooks/useLowestListing.tsx +23 -14
- package/src/react/hooks/useRoyaltyPercentage.tsx +18 -8
- package/src/react/hooks/useTransferTokens.tsx +3 -3
- package/src/react/ui/modals/CreateListingModal/_store.ts +5 -5
- package/src/react/ui/modals/CreateListingModal/index.tsx +5 -4
- package/src/react/ui/modals/MakeOfferModal/_store.ts +6 -9
- package/src/react/ui/modals/MakeOfferModal/index.tsx +15 -25
- package/src/react/ui/modals/SellModal/_store.ts +28 -23
- package/src/react/ui/modals/SellModal/index.tsx +11 -10
- package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +8 -7
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +2 -1
- package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +3 -2
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +55 -12
- package/src/react/ui/modals/_internal/components/priceInput/styles.css.ts +4 -0
- package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +2 -1
- package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +2 -1
- package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +2 -2
- package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +4 -4
- package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +14 -14
- package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +5 -5
- package/src/types/marketplace-config.ts +2 -1
- package/dist/chunk-G3D572BT.js.map +0 -1
- package/dist/chunk-QOJXWHRZ.js.map +0 -1
- package/dist/chunk-SM7V6ZWI.js.map +0 -1
- package/dist/chunk-STO74F2I.js +0 -14
- package/dist/chunk-STO74F2I.js.map +0 -1
- package/dist/chunk-VPGWEMWL.js.map +0 -1
- package/dist/chunk-ZE2LNX65.js +0 -394
- package/dist/chunk-ZE2LNX65.js.map +0 -1
- package/dist/types-BrAQ8-w4.d.ts +0 -12
- package/src/react/hooks/useCollectionCounts.tsx +0 -61
- /package/dist/{chunk-4PFMUVE4.js.map → chunk-SNOEEUPZ.js.map} +0 -0
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import {
|
|
3
|
+
getPublicRpcClient
|
|
4
|
+
} from "./chunk-RNUHUVLC.js";
|
|
5
|
+
import {
|
|
6
|
+
EIP2981_ABI
|
|
7
|
+
} from "./chunk-DBFOPEV6.js";
|
|
8
|
+
import {
|
|
9
|
+
ERC1155_ABI
|
|
10
|
+
} from "./chunk-O5JXKTWP.js";
|
|
11
|
+
import {
|
|
12
|
+
AddressSchema,
|
|
13
|
+
ChainIdSchema,
|
|
14
|
+
PROVIDER_ID,
|
|
15
|
+
QueryArgSchema
|
|
16
|
+
} from "./chunk-7CL54NCX.js";
|
|
17
|
+
import {
|
|
18
|
+
CollectibleStatus,
|
|
19
|
+
CollectionStatus,
|
|
20
|
+
ContractType,
|
|
21
|
+
ExecuteType,
|
|
22
|
+
MarketplaceKind,
|
|
23
|
+
OrderSide,
|
|
24
|
+
OrderStatus,
|
|
25
|
+
OrderbookKind,
|
|
26
|
+
ProjectStatus,
|
|
27
|
+
PropertyType,
|
|
28
|
+
SortOrder,
|
|
29
|
+
SourceKind,
|
|
30
|
+
StepType,
|
|
31
|
+
TransactionCrypto,
|
|
32
|
+
TransactionNFTCheckoutProvider,
|
|
33
|
+
TransactionOnRampProvider,
|
|
34
|
+
TransactionSwapProvider,
|
|
35
|
+
WalletKind,
|
|
36
|
+
balanceQueries,
|
|
37
|
+
builderMarketplaceApi,
|
|
38
|
+
collectableKeys,
|
|
39
|
+
collectionKeys,
|
|
40
|
+
configKeys,
|
|
41
|
+
currencyKeys,
|
|
42
|
+
getIndexerClient,
|
|
43
|
+
getMarketplaceClient,
|
|
44
|
+
getMetadataClient,
|
|
45
|
+
getQueryClient
|
|
46
|
+
} from "./chunk-HGBEC3WX.js";
|
|
47
|
+
|
|
48
|
+
// src/react/provider.tsx
|
|
49
|
+
import { createContext } from "react";
|
|
50
|
+
import "@0xsequence/design-system/styles.css";
|
|
51
|
+
import { jsx } from "react/jsx-runtime";
|
|
52
|
+
var MarketplaceSdkContext = createContext({});
|
|
53
|
+
function MarketplaceProvider({
|
|
54
|
+
config,
|
|
55
|
+
children
|
|
56
|
+
}) {
|
|
57
|
+
return /* @__PURE__ */ jsx(MarketplaceSdkContext.Provider, { value: config, children: /* @__PURE__ */ jsx("div", { id: PROVIDER_ID, children }) });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/react/hooks/useConfig.tsx
|
|
61
|
+
import { useContext } from "react";
|
|
62
|
+
function useConfig() {
|
|
63
|
+
const context = useContext(MarketplaceSdkContext);
|
|
64
|
+
if (!context) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
"Marketplace SDK must be used within a MarketplaceSdkProvider"
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return context;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/react/hooks/useCollectible.tsx
|
|
73
|
+
import { queryOptions, useQuery } from "@tanstack/react-query";
|
|
74
|
+
import { z } from "zod";
|
|
75
|
+
var UseCollectibleSchema = z.object({
|
|
76
|
+
chainId: ChainIdSchema.pipe(z.coerce.string()),
|
|
77
|
+
collectionAddress: AddressSchema,
|
|
78
|
+
collectibleId: z.string(),
|
|
79
|
+
query: QueryArgSchema
|
|
80
|
+
});
|
|
81
|
+
var fetchCollectible = async (args, config) => {
|
|
82
|
+
const parsedArgs = UseCollectibleSchema.parse(args);
|
|
83
|
+
const metadataClient = getMetadataClient(config);
|
|
84
|
+
return metadataClient.getTokenMetadata({
|
|
85
|
+
chainID: parsedArgs.chainId,
|
|
86
|
+
contractAddress: parsedArgs.collectionAddress,
|
|
87
|
+
tokenIDs: [parsedArgs.collectibleId]
|
|
88
|
+
}).then((resp) => resp.tokenMetadata[0]);
|
|
89
|
+
};
|
|
90
|
+
var collectibleOptions = (args, config) => {
|
|
91
|
+
return queryOptions({
|
|
92
|
+
...args.query,
|
|
93
|
+
queryKey: [...collectableKeys.details, args, config],
|
|
94
|
+
queryFn: () => fetchCollectible(args, config)
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
var useCollectible = (args) => {
|
|
98
|
+
const config = useConfig();
|
|
99
|
+
return useQuery(collectibleOptions(args, config));
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/react/hooks/useCollection.tsx
|
|
103
|
+
import { queryOptions as queryOptions2, useQuery as useQuery2 } from "@tanstack/react-query";
|
|
104
|
+
import { z as z2 } from "zod";
|
|
105
|
+
var UseCollectionSchema = z2.object({
|
|
106
|
+
chainId: ChainIdSchema.pipe(z2.coerce.string()),
|
|
107
|
+
collectionAddress: AddressSchema,
|
|
108
|
+
query: QueryArgSchema
|
|
109
|
+
});
|
|
110
|
+
var fetchCollection = async (args, config) => {
|
|
111
|
+
const parsedArgs = UseCollectionSchema.parse(args);
|
|
112
|
+
const metadataClient = getMetadataClient(config);
|
|
113
|
+
return metadataClient.getContractInfo({
|
|
114
|
+
chainID: parsedArgs.chainId,
|
|
115
|
+
contractAddress: parsedArgs.collectionAddress
|
|
116
|
+
}).then((resp) => resp.contractInfo);
|
|
117
|
+
};
|
|
118
|
+
var collectionOptions = (args, config) => {
|
|
119
|
+
return queryOptions2({
|
|
120
|
+
...args.query,
|
|
121
|
+
queryKey: [...collectionKeys.detail, args, config],
|
|
122
|
+
queryFn: () => fetchCollection(args, config)
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
var useCollection = (args) => {
|
|
126
|
+
const config = useConfig();
|
|
127
|
+
return useQuery2(collectionOptions(args, config));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/react/hooks/useCurrencies.tsx
|
|
131
|
+
import { queryOptions as queryOptions3, useQuery as useQuery3 } from "@tanstack/react-query";
|
|
132
|
+
import { z as z3 } from "zod";
|
|
133
|
+
var ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
|
|
134
|
+
var UseCurrenciesArgsSchema = z3.object({
|
|
135
|
+
chainId: ChainIdCoerce,
|
|
136
|
+
collectionAddress: AddressSchema.optional(),
|
|
137
|
+
includeNativeCurrency: z3.boolean().optional(),
|
|
138
|
+
query: QueryArgSchema
|
|
139
|
+
});
|
|
140
|
+
var fetchCurrencies = async (chainId, config) => {
|
|
141
|
+
const parsedChainId = ChainIdCoerce.parse(chainId);
|
|
142
|
+
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
143
|
+
return marketplaceClient.listCurrencies().then((resp) => resp.currencies);
|
|
144
|
+
};
|
|
145
|
+
var selectCurrencies = (data, args) => {
|
|
146
|
+
const argsParsed = UseCurrenciesArgsSchema.parse(args);
|
|
147
|
+
if (argsParsed.collectionAddress) {
|
|
148
|
+
const queryClient = getQueryClient();
|
|
149
|
+
const marketplaceConfigCache = queryClient.getQueriesData({
|
|
150
|
+
queryKey: configKeys.marketplace
|
|
151
|
+
})[0][1];
|
|
152
|
+
const collection = marketplaceConfigCache?.collections.find(
|
|
153
|
+
(collection2) => collection2.collectionAddress === argsParsed.collectionAddress
|
|
154
|
+
);
|
|
155
|
+
if (!collection) {
|
|
156
|
+
throw new Error("Collection doesn't exist");
|
|
157
|
+
}
|
|
158
|
+
return data.filter(
|
|
159
|
+
(currency) => collection.currencyOptions?.includes(currency.contractAddress) || // biome-ignore lint/suspicious/noDoubleEquals: <explanation>
|
|
160
|
+
currency.nativeCurrency == argsParsed.includeNativeCurrency || currency.defaultChainCurrency
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
if (argsParsed.includeNativeCurrency) {
|
|
164
|
+
return data;
|
|
165
|
+
}
|
|
166
|
+
return data.filter((currency) => !currency.nativeCurrency);
|
|
167
|
+
};
|
|
168
|
+
var currenciesOptions = (args, config) => {
|
|
169
|
+
return queryOptions3({
|
|
170
|
+
...args.query,
|
|
171
|
+
queryKey: [...currencyKeys.lists, args.chainId],
|
|
172
|
+
queryFn: () => fetchCurrencies(args.chainId, config),
|
|
173
|
+
select: (data) => selectCurrencies(data, args),
|
|
174
|
+
enabled: args.query?.enabled
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
var useCurrencies = (args) => {
|
|
178
|
+
const config = useConfig();
|
|
179
|
+
return useQuery3(currenciesOptions(args, config));
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/react/hooks/useListBalances.tsx
|
|
183
|
+
import { SortOrder as SortOrder2 } from "@0xsequence/indexer";
|
|
184
|
+
import { infiniteQueryOptions, useInfiniteQuery } from "@tanstack/react-query";
|
|
185
|
+
import { z as z4 } from "zod";
|
|
186
|
+
var metadataOptionsSchema = z4.object({
|
|
187
|
+
verifiedOnly: z4.boolean().optional(),
|
|
188
|
+
unverifiedOnly: z4.boolean().optional(),
|
|
189
|
+
includeContracts: z4.array(z4.string()).optional()
|
|
190
|
+
});
|
|
191
|
+
var sortOrderSchema = z4.nativeEnum(SortOrder2);
|
|
192
|
+
var sortBySchema = z4.object({
|
|
193
|
+
column: z4.string(),
|
|
194
|
+
order: sortOrderSchema
|
|
195
|
+
});
|
|
196
|
+
var pageSchema = z4.object({
|
|
197
|
+
page: z4.number().optional(),
|
|
198
|
+
column: z4.string().optional(),
|
|
199
|
+
before: z4.any().optional(),
|
|
200
|
+
after: z4.any().optional(),
|
|
201
|
+
sort: z4.array(sortBySchema).optional(),
|
|
202
|
+
pageSize: z4.number().optional(),
|
|
203
|
+
more: z4.boolean().optional()
|
|
204
|
+
});
|
|
205
|
+
var useListBalancesArgsSchema = z4.object({
|
|
206
|
+
chainId: ChainIdSchema.pipe(z4.coerce.number()),
|
|
207
|
+
accountAddress: AddressSchema.optional(),
|
|
208
|
+
contractAddress: AddressSchema.optional(),
|
|
209
|
+
tokenId: z4.string().optional(),
|
|
210
|
+
includeMetadata: z4.boolean().optional(),
|
|
211
|
+
metadataOptions: metadataOptionsSchema.optional(),
|
|
212
|
+
includeCollectionTokens: z4.boolean().optional(),
|
|
213
|
+
page: pageSchema.optional(),
|
|
214
|
+
query: QueryArgSchema
|
|
215
|
+
});
|
|
216
|
+
var fetchBalances = async (args, page, config) => {
|
|
217
|
+
const parsedArgs = useListBalancesArgsSchema.parse(args);
|
|
218
|
+
const indexerClient = getIndexerClient(parsedArgs.chainId, config);
|
|
219
|
+
return indexerClient.getTokenBalances({
|
|
220
|
+
...parsedArgs,
|
|
221
|
+
tokenID: parsedArgs.tokenId,
|
|
222
|
+
page
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
var listBalancesOptions = (args, config) => {
|
|
226
|
+
return infiniteQueryOptions({
|
|
227
|
+
...args.query,
|
|
228
|
+
queryKey: [...balanceQueries.lists, args, config],
|
|
229
|
+
queryFn: ({ pageParam }) => fetchBalances(args, pageParam, config),
|
|
230
|
+
initialPageParam: { page: 1, pageSize: 30 },
|
|
231
|
+
getNextPageParam: (lastPage) => lastPage.page.after
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
var useListBalances = (args) => {
|
|
235
|
+
const config = useConfig();
|
|
236
|
+
return useInfiniteQuery(listBalancesOptions(args, config));
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// src/react/hooks/useLowestListing.tsx
|
|
240
|
+
import { queryOptions as queryOptions4, useQuery as useQuery4 } from "@tanstack/react-query";
|
|
241
|
+
import { z as z6 } from "zod";
|
|
242
|
+
|
|
243
|
+
// src/react/_internal/api/zod-schema.ts
|
|
244
|
+
import { z as z5 } from "zod";
|
|
245
|
+
var assetSchema = z5.object({
|
|
246
|
+
id: z5.number(),
|
|
247
|
+
collectionId: z5.number(),
|
|
248
|
+
tokenId: z5.string(),
|
|
249
|
+
url: z5.string().optional(),
|
|
250
|
+
metadataField: z5.string(),
|
|
251
|
+
name: z5.string().optional(),
|
|
252
|
+
filesize: z5.number().optional(),
|
|
253
|
+
mimeType: z5.string().optional(),
|
|
254
|
+
width: z5.number().optional(),
|
|
255
|
+
height: z5.number().optional(),
|
|
256
|
+
updatedAt: z5.string().optional()
|
|
257
|
+
});
|
|
258
|
+
var sortOrderSchema2 = z5.nativeEnum(SortOrder);
|
|
259
|
+
var propertyTypeSchema = z5.nativeEnum(PropertyType);
|
|
260
|
+
var marketplaceKindSchema = z5.nativeEnum(MarketplaceKind);
|
|
261
|
+
var orderbookKindSchema = z5.nativeEnum(OrderbookKind);
|
|
262
|
+
var sourceKindSchema = z5.nativeEnum(SourceKind);
|
|
263
|
+
var orderSideSchema = z5.nativeEnum(OrderSide);
|
|
264
|
+
var orderStatusSchema = z5.nativeEnum(OrderStatus);
|
|
265
|
+
var contractTypeSchema = z5.nativeEnum(ContractType);
|
|
266
|
+
var collectionStatusSchema = z5.nativeEnum(CollectionStatus);
|
|
267
|
+
var projectStatusSchema = z5.nativeEnum(ProjectStatus);
|
|
268
|
+
var collectibleStatusSchema = z5.nativeEnum(CollectibleStatus);
|
|
269
|
+
var walletKindSchema = z5.nativeEnum(WalletKind);
|
|
270
|
+
var stepTypeSchema = z5.nativeEnum(StepType);
|
|
271
|
+
var transactionCryptoSchema = z5.nativeEnum(TransactionCrypto);
|
|
272
|
+
var transactionNFTCheckoutProviderSchema = z5.nativeEnum(
|
|
273
|
+
TransactionNFTCheckoutProvider
|
|
274
|
+
);
|
|
275
|
+
var transactionOnRampProviderSchema = z5.nativeEnum(
|
|
276
|
+
TransactionOnRampProvider
|
|
277
|
+
);
|
|
278
|
+
var transactionSwapProviderSchema = z5.nativeEnum(
|
|
279
|
+
TransactionSwapProvider
|
|
280
|
+
);
|
|
281
|
+
var executeTypeSchema = z5.nativeEnum(ExecuteType);
|
|
282
|
+
var sortBySchema2 = z5.object({
|
|
283
|
+
column: z5.string(),
|
|
284
|
+
order: sortOrderSchema2
|
|
285
|
+
});
|
|
286
|
+
var propertyFilterSchema = z5.object({
|
|
287
|
+
name: z5.string(),
|
|
288
|
+
type: propertyTypeSchema,
|
|
289
|
+
min: z5.number().optional(),
|
|
290
|
+
max: z5.number().optional(),
|
|
291
|
+
values: z5.array(z5.any()).optional()
|
|
292
|
+
});
|
|
293
|
+
var collectiblesFilterSchema = z5.object({
|
|
294
|
+
includeEmpty: z5.boolean(),
|
|
295
|
+
searchText: z5.string().optional(),
|
|
296
|
+
properties: z5.array(propertyFilterSchema).optional(),
|
|
297
|
+
marketplaces: z5.array(marketplaceKindSchema).optional(),
|
|
298
|
+
inAccounts: z5.array(z5.string()).optional(),
|
|
299
|
+
notInAccounts: z5.array(z5.string()).optional(),
|
|
300
|
+
ordersCreatedBy: z5.array(z5.string()).optional(),
|
|
301
|
+
ordersNotCreatedBy: z5.array(z5.string()).optional()
|
|
302
|
+
});
|
|
303
|
+
var feeBreakdownSchema = z5.object({
|
|
304
|
+
kind: z5.string(),
|
|
305
|
+
recipientAddress: z5.string(),
|
|
306
|
+
bps: z5.number()
|
|
307
|
+
});
|
|
308
|
+
var orderFilterSchema = z5.object({
|
|
309
|
+
createdBy: z5.array(z5.string()).optional(),
|
|
310
|
+
marketplace: z5.array(marketplaceKindSchema).optional(),
|
|
311
|
+
currencies: z5.array(z5.string()).optional()
|
|
312
|
+
});
|
|
313
|
+
var collectionLastSyncedSchema = z5.object({
|
|
314
|
+
allOrders: z5.string(),
|
|
315
|
+
newOrders: z5.string()
|
|
316
|
+
});
|
|
317
|
+
var projectSchema = z5.object({
|
|
318
|
+
projectId: z5.number(),
|
|
319
|
+
chainId: z5.number(),
|
|
320
|
+
contractAddress: z5.string(),
|
|
321
|
+
status: projectStatusSchema,
|
|
322
|
+
createdAt: z5.string(),
|
|
323
|
+
updatedAt: z5.string(),
|
|
324
|
+
deletedAt: z5.string().optional()
|
|
325
|
+
});
|
|
326
|
+
var collectibleSchema = z5.object({
|
|
327
|
+
chainId: z5.number(),
|
|
328
|
+
contractAddress: z5.string(),
|
|
329
|
+
status: collectibleStatusSchema,
|
|
330
|
+
tokenId: z5.string(),
|
|
331
|
+
createdAt: z5.string(),
|
|
332
|
+
updatedAt: z5.string(),
|
|
333
|
+
deletedAt: z5.string().optional()
|
|
334
|
+
});
|
|
335
|
+
var currencySchema = z5.object({
|
|
336
|
+
chainId: z5.number(),
|
|
337
|
+
contractAddress: z5.string(),
|
|
338
|
+
name: z5.string(),
|
|
339
|
+
symbol: z5.string(),
|
|
340
|
+
decimals: z5.number(),
|
|
341
|
+
imageUrl: z5.string(),
|
|
342
|
+
exchangeRate: z5.number(),
|
|
343
|
+
defaultChainCurrency: z5.boolean(),
|
|
344
|
+
nativeCurrency: z5.boolean(),
|
|
345
|
+
createdAt: z5.string(),
|
|
346
|
+
updatedAt: z5.string(),
|
|
347
|
+
deletedAt: z5.string().optional()
|
|
348
|
+
});
|
|
349
|
+
var orderDataSchema = z5.object({
|
|
350
|
+
orderId: z5.string(),
|
|
351
|
+
quantity: z5.string()
|
|
352
|
+
});
|
|
353
|
+
var additionalFeeSchema = z5.object({
|
|
354
|
+
amount: z5.string(),
|
|
355
|
+
receiver: z5.string()
|
|
356
|
+
});
|
|
357
|
+
var postRequestSchema = z5.object({
|
|
358
|
+
endpoint: z5.string(),
|
|
359
|
+
method: z5.string(),
|
|
360
|
+
body: z5.any()
|
|
361
|
+
});
|
|
362
|
+
var createReqSchema = z5.object({
|
|
363
|
+
tokenId: z5.string(),
|
|
364
|
+
quantity: z5.string(),
|
|
365
|
+
expiry: z5.string(),
|
|
366
|
+
currencyAddress: z5.string(),
|
|
367
|
+
pricePerToken: z5.string()
|
|
368
|
+
});
|
|
369
|
+
var getOrdersInputSchema = z5.object({
|
|
370
|
+
contractAddress: z5.string(),
|
|
371
|
+
orderId: z5.string(),
|
|
372
|
+
marketplace: marketplaceKindSchema
|
|
373
|
+
});
|
|
374
|
+
var domainSchema = z5.object({
|
|
375
|
+
name: z5.string(),
|
|
376
|
+
version: z5.string(),
|
|
377
|
+
chainId: z5.number(),
|
|
378
|
+
verifyingContract: z5.string()
|
|
379
|
+
});
|
|
380
|
+
var checkoutOptionsMarketplaceOrderSchema = z5.object({
|
|
381
|
+
contractAddress: z5.string(),
|
|
382
|
+
orderId: z5.string(),
|
|
383
|
+
marketplace: marketplaceKindSchema
|
|
384
|
+
});
|
|
385
|
+
var checkoutOptionsItemSchema = z5.object({
|
|
386
|
+
tokenId: z5.string(),
|
|
387
|
+
quantity: z5.string()
|
|
388
|
+
});
|
|
389
|
+
var checkoutOptionsSchema = z5.object({
|
|
390
|
+
crypto: transactionCryptoSchema,
|
|
391
|
+
swap: z5.array(transactionSwapProviderSchema),
|
|
392
|
+
nftCheckout: z5.array(transactionNFTCheckoutProviderSchema),
|
|
393
|
+
onRamp: z5.array(transactionOnRampProviderSchema)
|
|
394
|
+
});
|
|
395
|
+
var listCurrenciesArgsSchema = z5.object({});
|
|
396
|
+
var listCurrenciesReturnSchema = z5.object({
|
|
397
|
+
currencies: z5.array(currencySchema)
|
|
398
|
+
});
|
|
399
|
+
var getCollectibleArgsSchema = z5.object({
|
|
400
|
+
contractAddress: z5.string(),
|
|
401
|
+
tokenId: z5.string()
|
|
402
|
+
});
|
|
403
|
+
var getLowestPriceOfferForCollectibleArgsSchema = z5.object({
|
|
404
|
+
contractAddress: z5.string(),
|
|
405
|
+
tokenId: z5.string(),
|
|
406
|
+
filter: orderFilterSchema.optional()
|
|
407
|
+
});
|
|
408
|
+
var getHighestPriceOfferForCollectibleArgsSchema = z5.object({
|
|
409
|
+
contractAddress: z5.string(),
|
|
410
|
+
tokenId: z5.string(),
|
|
411
|
+
filter: orderFilterSchema.optional()
|
|
412
|
+
});
|
|
413
|
+
var getLowestPriceListingForCollectibleArgsSchema = z5.object({
|
|
414
|
+
contractAddress: z5.string(),
|
|
415
|
+
tokenId: z5.string(),
|
|
416
|
+
filter: orderFilterSchema.optional()
|
|
417
|
+
});
|
|
418
|
+
var getHighestPriceListingForCollectibleArgsSchema = z5.object({
|
|
419
|
+
contractAddress: z5.string(),
|
|
420
|
+
tokenId: z5.string(),
|
|
421
|
+
filter: orderFilterSchema.optional()
|
|
422
|
+
});
|
|
423
|
+
var getCollectibleLowestOfferArgsSchema = z5.object({
|
|
424
|
+
contractAddress: z5.string(),
|
|
425
|
+
tokenId: z5.string(),
|
|
426
|
+
filter: orderFilterSchema.optional()
|
|
427
|
+
});
|
|
428
|
+
var getCollectibleHighestOfferArgsSchema = z5.object({
|
|
429
|
+
contractAddress: z5.string(),
|
|
430
|
+
tokenId: z5.string(),
|
|
431
|
+
filter: orderFilterSchema.optional()
|
|
432
|
+
});
|
|
433
|
+
var getCollectibleLowestListingArgsSchema = z5.object({
|
|
434
|
+
contractAddress: z5.string(),
|
|
435
|
+
tokenId: z5.string(),
|
|
436
|
+
filters: orderFilterSchema.optional()
|
|
437
|
+
});
|
|
438
|
+
var getCollectibleHighestListingArgsSchema = z5.object({
|
|
439
|
+
contractAddress: z5.string(),
|
|
440
|
+
tokenId: z5.string(),
|
|
441
|
+
filter: orderFilterSchema.optional()
|
|
442
|
+
});
|
|
443
|
+
var generateBuyTransactionArgsSchema = z5.object({
|
|
444
|
+
collectionAddress: z5.string(),
|
|
445
|
+
buyer: z5.string(),
|
|
446
|
+
marketplace: marketplaceKindSchema,
|
|
447
|
+
ordersData: z5.array(orderDataSchema),
|
|
448
|
+
additionalFees: z5.array(additionalFeeSchema),
|
|
449
|
+
walletType: walletKindSchema.optional()
|
|
450
|
+
});
|
|
451
|
+
var generateSellTransactionArgsSchema = z5.object({
|
|
452
|
+
collectionAddress: z5.string(),
|
|
453
|
+
seller: z5.string(),
|
|
454
|
+
marketplace: marketplaceKindSchema,
|
|
455
|
+
ordersData: z5.array(orderDataSchema),
|
|
456
|
+
additionalFees: z5.array(additionalFeeSchema),
|
|
457
|
+
walletType: walletKindSchema.optional()
|
|
458
|
+
});
|
|
459
|
+
var generateListingTransactionArgsSchema = z5.object({
|
|
460
|
+
collectionAddress: z5.string(),
|
|
461
|
+
owner: z5.string(),
|
|
462
|
+
contractType: contractTypeSchema,
|
|
463
|
+
orderbook: orderbookKindSchema,
|
|
464
|
+
listing: createReqSchema,
|
|
465
|
+
walletType: walletKindSchema.optional()
|
|
466
|
+
});
|
|
467
|
+
var generateOfferTransactionArgsSchema = z5.object({
|
|
468
|
+
collectionAddress: z5.string(),
|
|
469
|
+
maker: z5.string(),
|
|
470
|
+
contractType: contractTypeSchema,
|
|
471
|
+
orderbook: orderbookKindSchema,
|
|
472
|
+
offer: createReqSchema,
|
|
473
|
+
walletType: walletKindSchema.optional()
|
|
474
|
+
});
|
|
475
|
+
var executeArgsSchema = z5.object({
|
|
476
|
+
signature: z5.string(),
|
|
477
|
+
executeType: executeTypeSchema,
|
|
478
|
+
body: z5.any()
|
|
479
|
+
});
|
|
480
|
+
var executeReturnSchema = z5.object({
|
|
481
|
+
orderId: z5.string()
|
|
482
|
+
});
|
|
483
|
+
var getCountOfAllCollectiblesArgsSchema = z5.object({
|
|
484
|
+
contractAddress: z5.string()
|
|
485
|
+
});
|
|
486
|
+
var getCountOfAllCollectiblesReturnSchema = z5.object({
|
|
487
|
+
count: z5.number()
|
|
488
|
+
});
|
|
489
|
+
var getCountOfFilteredCollectiblesArgsSchema = z5.object({
|
|
490
|
+
side: orderSideSchema,
|
|
491
|
+
contractAddress: z5.string(),
|
|
492
|
+
filter: collectiblesFilterSchema.optional()
|
|
493
|
+
});
|
|
494
|
+
var getCountOfFilteredCollectiblesReturnSchema = z5.object({
|
|
495
|
+
count: z5.number()
|
|
496
|
+
});
|
|
497
|
+
var getFloorOrderArgsSchema = z5.object({
|
|
498
|
+
contractAddress: z5.string(),
|
|
499
|
+
filter: collectiblesFilterSchema.optional()
|
|
500
|
+
});
|
|
501
|
+
var syncOrderReturnSchema = z5.object({});
|
|
502
|
+
var syncOrdersReturnSchema = z5.object({});
|
|
503
|
+
var checkoutOptionsMarketplaceArgsSchema = z5.object({
|
|
504
|
+
wallet: z5.string(),
|
|
505
|
+
orders: z5.array(checkoutOptionsMarketplaceOrderSchema),
|
|
506
|
+
additionalFee: z5.number()
|
|
507
|
+
});
|
|
508
|
+
var checkoutOptionsMarketplaceReturnSchema = z5.object({
|
|
509
|
+
options: checkoutOptionsSchema
|
|
510
|
+
});
|
|
511
|
+
var checkoutOptionsSalesContractArgsSchema = z5.object({
|
|
512
|
+
wallet: z5.string(),
|
|
513
|
+
contractAddress: z5.string(),
|
|
514
|
+
collectionAddress: z5.string(),
|
|
515
|
+
items: z5.array(checkoutOptionsItemSchema)
|
|
516
|
+
});
|
|
517
|
+
var checkoutOptionsSalesContractReturnSchema = z5.object({
|
|
518
|
+
options: checkoutOptionsSchema
|
|
519
|
+
});
|
|
520
|
+
var tokenMetadataSchema = z5.object({
|
|
521
|
+
tokenId: z5.string(),
|
|
522
|
+
name: z5.string(),
|
|
523
|
+
description: z5.string().optional(),
|
|
524
|
+
image: z5.string().optional(),
|
|
525
|
+
video: z5.string().optional(),
|
|
526
|
+
audio: z5.string().optional(),
|
|
527
|
+
properties: z5.record(z5.any()).optional(),
|
|
528
|
+
attributes: z5.array(z5.record(z5.any())),
|
|
529
|
+
image_data: z5.string().optional(),
|
|
530
|
+
external_url: z5.string().optional(),
|
|
531
|
+
background_color: z5.string().optional(),
|
|
532
|
+
animation_url: z5.string().optional(),
|
|
533
|
+
decimals: z5.number().optional(),
|
|
534
|
+
updatedAt: z5.string().optional(),
|
|
535
|
+
assets: z5.array(assetSchema).optional()
|
|
536
|
+
});
|
|
537
|
+
var pageSchema2 = z5.object({
|
|
538
|
+
page: z5.number(),
|
|
539
|
+
pageSize: z5.number(),
|
|
540
|
+
more: z5.boolean().optional(),
|
|
541
|
+
sort: z5.array(sortBySchema2).optional()
|
|
542
|
+
});
|
|
543
|
+
var filterSchema = z5.object({
|
|
544
|
+
text: z5.string().optional(),
|
|
545
|
+
properties: z5.array(propertyFilterSchema).optional()
|
|
546
|
+
});
|
|
547
|
+
var orderSchema = z5.object({
|
|
548
|
+
orderId: z5.string(),
|
|
549
|
+
marketplace: marketplaceKindSchema,
|
|
550
|
+
side: orderSideSchema,
|
|
551
|
+
status: orderStatusSchema,
|
|
552
|
+
chainId: z5.number(),
|
|
553
|
+
collectionContractAddress: z5.string(),
|
|
554
|
+
tokenId: z5.string(),
|
|
555
|
+
createdBy: z5.string(),
|
|
556
|
+
priceAmount: z5.string(),
|
|
557
|
+
priceAmountFormatted: z5.string(),
|
|
558
|
+
priceAmountNet: z5.string(),
|
|
559
|
+
priceAmountNetFormatted: z5.string(),
|
|
560
|
+
priceCurrencyAddress: z5.string(),
|
|
561
|
+
priceDecimals: z5.number(),
|
|
562
|
+
priceUSD: z5.number(),
|
|
563
|
+
quantityInitial: z5.string(),
|
|
564
|
+
quantityInitialFormatted: z5.string(),
|
|
565
|
+
quantityRemaining: z5.string(),
|
|
566
|
+
quantityRemainingFormatted: z5.string(),
|
|
567
|
+
quantityAvailable: z5.string(),
|
|
568
|
+
quantityAvailableFormatted: z5.string(),
|
|
569
|
+
quantityDecimals: z5.number(),
|
|
570
|
+
feeBps: z5.number(),
|
|
571
|
+
feeBreakdown: z5.array(feeBreakdownSchema),
|
|
572
|
+
validFrom: z5.string(),
|
|
573
|
+
validUntil: z5.string(),
|
|
574
|
+
blockNumber: z5.number(),
|
|
575
|
+
orderCreatedAt: z5.string().optional(),
|
|
576
|
+
orderUpdatedAt: z5.string().optional(),
|
|
577
|
+
createdAt: z5.string(),
|
|
578
|
+
updatedAt: z5.string(),
|
|
579
|
+
deletedAt: z5.string().optional()
|
|
580
|
+
});
|
|
581
|
+
var collectibleOrderSchema = z5.object({
|
|
582
|
+
metadata: tokenMetadataSchema,
|
|
583
|
+
order: orderSchema.optional()
|
|
584
|
+
});
|
|
585
|
+
var activitySchema = z5.object({
|
|
586
|
+
type: z5.string(),
|
|
587
|
+
fromAddress: z5.string(),
|
|
588
|
+
toAddress: z5.string(),
|
|
589
|
+
txHash: z5.string(),
|
|
590
|
+
timestamp: z5.number(),
|
|
591
|
+
tokenId: z5.string(),
|
|
592
|
+
tokenImage: z5.string(),
|
|
593
|
+
tokenName: z5.string(),
|
|
594
|
+
currency: currencySchema.optional()
|
|
595
|
+
});
|
|
596
|
+
var collectionConfigSchema = z5.object({
|
|
597
|
+
lastSynced: z5.record(collectionLastSyncedSchema),
|
|
598
|
+
collectiblesSynced: z5.string()
|
|
599
|
+
});
|
|
600
|
+
var signatureSchema = z5.object({
|
|
601
|
+
domain: domainSchema,
|
|
602
|
+
types: z5.any(),
|
|
603
|
+
primaryType: z5.string(),
|
|
604
|
+
value: z5.any()
|
|
605
|
+
});
|
|
606
|
+
var getCollectibleReturnSchema = z5.object({
|
|
607
|
+
metadata: tokenMetadataSchema
|
|
608
|
+
});
|
|
609
|
+
var getLowestPriceOfferForCollectibleReturnSchema = z5.object({
|
|
610
|
+
order: orderSchema
|
|
611
|
+
});
|
|
612
|
+
var getHighestPriceOfferForCollectibleReturnSchema = z5.object({
|
|
613
|
+
order: orderSchema
|
|
614
|
+
});
|
|
615
|
+
var getLowestPriceListingForCollectibleReturnSchema = z5.object({
|
|
616
|
+
order: orderSchema
|
|
617
|
+
});
|
|
618
|
+
var getHighestPriceListingForCollectibleReturnSchema = z5.object({
|
|
619
|
+
order: orderSchema
|
|
620
|
+
});
|
|
621
|
+
var listListingsForCollectibleArgsSchema = z5.object({
|
|
622
|
+
contractAddress: z5.string(),
|
|
623
|
+
tokenId: z5.string(),
|
|
624
|
+
filter: orderFilterSchema.optional(),
|
|
625
|
+
page: pageSchema2.optional()
|
|
626
|
+
});
|
|
627
|
+
var listListingsForCollectibleReturnSchema = z5.object({
|
|
628
|
+
listings: z5.array(orderSchema),
|
|
629
|
+
page: pageSchema2.optional()
|
|
630
|
+
});
|
|
631
|
+
var listOffersForCollectibleArgsSchema = z5.object({
|
|
632
|
+
contractAddress: z5.string(),
|
|
633
|
+
tokenId: z5.string(),
|
|
634
|
+
filter: orderFilterSchema.optional(),
|
|
635
|
+
page: pageSchema2.optional()
|
|
636
|
+
});
|
|
637
|
+
var listOffersForCollectibleReturnSchema = z5.object({
|
|
638
|
+
offers: z5.array(orderSchema),
|
|
639
|
+
page: pageSchema2.optional()
|
|
640
|
+
});
|
|
641
|
+
var getCollectibleLowestOfferReturnSchema = z5.object({
|
|
642
|
+
order: orderSchema.optional()
|
|
643
|
+
});
|
|
644
|
+
var getCollectibleHighestOfferReturnSchema = z5.object({
|
|
645
|
+
order: orderSchema.optional()
|
|
646
|
+
});
|
|
647
|
+
var getCollectibleLowestListingReturnSchema = z5.object({
|
|
648
|
+
order: orderSchema.optional()
|
|
649
|
+
});
|
|
650
|
+
var getCollectibleHighestListingReturnSchema = z5.object({
|
|
651
|
+
order: orderSchema.optional()
|
|
652
|
+
});
|
|
653
|
+
var listCollectibleListingsArgsSchema = z5.object({
|
|
654
|
+
contractAddress: z5.string(),
|
|
655
|
+
tokenId: z5.string(),
|
|
656
|
+
filter: orderFilterSchema.optional(),
|
|
657
|
+
page: pageSchema2.optional()
|
|
658
|
+
});
|
|
659
|
+
var listCollectibleListingsReturnSchema = z5.object({
|
|
660
|
+
listings: z5.array(orderSchema),
|
|
661
|
+
page: pageSchema2.optional()
|
|
662
|
+
});
|
|
663
|
+
var listCollectibleOffersArgsSchema = z5.object({
|
|
664
|
+
contractAddress: z5.string(),
|
|
665
|
+
tokenId: z5.string(),
|
|
666
|
+
filter: orderFilterSchema.optional(),
|
|
667
|
+
page: pageSchema2.optional()
|
|
668
|
+
});
|
|
669
|
+
var listCollectibleOffersReturnSchema = z5.object({
|
|
670
|
+
offers: z5.array(orderSchema),
|
|
671
|
+
page: pageSchema2.optional()
|
|
672
|
+
});
|
|
673
|
+
var listCollectiblesArgsSchema = z5.object({
|
|
674
|
+
side: orderSideSchema,
|
|
675
|
+
contractAddress: z5.string(),
|
|
676
|
+
filter: collectiblesFilterSchema.optional(),
|
|
677
|
+
page: pageSchema2.optional()
|
|
678
|
+
});
|
|
679
|
+
var listCollectiblesReturnSchema = z5.object({
|
|
680
|
+
collectibles: z5.array(collectibleOrderSchema),
|
|
681
|
+
page: pageSchema2.optional()
|
|
682
|
+
});
|
|
683
|
+
var getFloorOrderReturnSchema = z5.object({
|
|
684
|
+
collectible: collectibleOrderSchema
|
|
685
|
+
});
|
|
686
|
+
var listCollectiblesWithLowestListingArgsSchema = z5.object({
|
|
687
|
+
contractAddress: z5.string(),
|
|
688
|
+
filter: collectiblesFilterSchema.optional(),
|
|
689
|
+
page: pageSchema2.optional()
|
|
690
|
+
});
|
|
691
|
+
var listCollectiblesWithLowestListingReturnSchema = z5.object({
|
|
692
|
+
collectibles: z5.array(collectibleOrderSchema),
|
|
693
|
+
page: pageSchema2.optional()
|
|
694
|
+
});
|
|
695
|
+
var listCollectiblesWithHighestOfferArgsSchema = z5.object({
|
|
696
|
+
contractAddress: z5.string(),
|
|
697
|
+
filter: collectiblesFilterSchema.optional(),
|
|
698
|
+
page: pageSchema2.optional()
|
|
699
|
+
});
|
|
700
|
+
var listCollectiblesWithHighestOfferReturnSchema = z5.object({
|
|
701
|
+
collectibles: z5.array(collectibleOrderSchema),
|
|
702
|
+
page: pageSchema2.optional()
|
|
703
|
+
});
|
|
704
|
+
var syncOrderArgsSchema = z5.object({
|
|
705
|
+
order: orderSchema
|
|
706
|
+
});
|
|
707
|
+
var syncOrdersArgsSchema = z5.object({
|
|
708
|
+
orders: z5.array(orderSchema)
|
|
709
|
+
});
|
|
710
|
+
var getOrdersArgsSchema = z5.object({
|
|
711
|
+
input: z5.array(getOrdersInputSchema),
|
|
712
|
+
page: pageSchema2.optional()
|
|
713
|
+
});
|
|
714
|
+
var getOrdersReturnSchema = z5.object({
|
|
715
|
+
orders: z5.array(orderSchema),
|
|
716
|
+
page: pageSchema2.optional()
|
|
717
|
+
});
|
|
718
|
+
var collectionSchema = z5.object({
|
|
719
|
+
status: collectionStatusSchema,
|
|
720
|
+
chainId: z5.number(),
|
|
721
|
+
contractAddress: z5.string(),
|
|
722
|
+
contractType: contractTypeSchema,
|
|
723
|
+
tokenQuantityDecimals: z5.number(),
|
|
724
|
+
config: collectionConfigSchema,
|
|
725
|
+
createdAt: z5.string(),
|
|
726
|
+
updatedAt: z5.string(),
|
|
727
|
+
deletedAt: z5.string().optional()
|
|
728
|
+
});
|
|
729
|
+
var stepSchema = z5.object({
|
|
730
|
+
id: stepTypeSchema,
|
|
731
|
+
data: z5.string(),
|
|
732
|
+
to: z5.string(),
|
|
733
|
+
value: z5.string(),
|
|
734
|
+
signature: signatureSchema.optional(),
|
|
735
|
+
post: postRequestSchema.optional(),
|
|
736
|
+
executeType: executeTypeSchema.optional()
|
|
737
|
+
});
|
|
738
|
+
var generateBuyTransactionReturnSchema = z5.object({
|
|
739
|
+
steps: z5.array(stepSchema)
|
|
740
|
+
});
|
|
741
|
+
var generateSellTransactionReturnSchema = z5.object({
|
|
742
|
+
steps: z5.array(stepSchema)
|
|
743
|
+
});
|
|
744
|
+
var generateListingTransactionReturnSchema = z5.object({
|
|
745
|
+
steps: z5.array(stepSchema)
|
|
746
|
+
});
|
|
747
|
+
var generateOfferTransactionReturnSchema = z5.object({
|
|
748
|
+
steps: z5.array(stepSchema)
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
// src/react/hooks/useLowestListing.tsx
|
|
752
|
+
var UseLowestListingSchema = getCollectibleLowestListingArgsSchema.omit({
|
|
753
|
+
contractAddress: true
|
|
754
|
+
}).extend({
|
|
755
|
+
collectionAddress: AddressSchema,
|
|
756
|
+
chainId: ChainIdSchema.pipe(z6.coerce.string()),
|
|
757
|
+
query: QueryArgSchema
|
|
758
|
+
});
|
|
759
|
+
var fetchLowestListing = async (args, config) => {
|
|
760
|
+
const parsedArgs = UseLowestListingSchema.parse(args);
|
|
761
|
+
const marketplaceClient = getMarketplaceClient(parsedArgs.chainId, config);
|
|
762
|
+
return marketplaceClient.getCollectibleLowestListing({
|
|
763
|
+
...parsedArgs,
|
|
764
|
+
contractAddress: parsedArgs.collectionAddress
|
|
765
|
+
});
|
|
766
|
+
};
|
|
767
|
+
var lowestListingOptions = (args, config) => {
|
|
768
|
+
return queryOptions4({
|
|
769
|
+
...args.query,
|
|
770
|
+
queryKey: [...collectableKeys.lowestListings, args, config],
|
|
771
|
+
queryFn: () => fetchLowestListing(args, config)
|
|
772
|
+
});
|
|
773
|
+
};
|
|
774
|
+
var useLowestListing = (args) => {
|
|
775
|
+
const config = useConfig();
|
|
776
|
+
return useQuery4(lowestListingOptions(args, config));
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
// src/react/hooks/options/marketplaceConfigOptions.ts
|
|
780
|
+
import { queryOptions as queryOptions5 } from "@tanstack/react-query";
|
|
781
|
+
var fetchBuilderConfig = async (projectId, env) => {
|
|
782
|
+
const url = `${builderMarketplaceApi(projectId, env)}`;
|
|
783
|
+
const response = await fetch(`${url}/config.json`);
|
|
784
|
+
const json = await response.json();
|
|
785
|
+
if (!response.ok) {
|
|
786
|
+
console.error("Failed to fetch marketplace config:", response.status, json);
|
|
787
|
+
switch (json.code) {
|
|
788
|
+
case 3e3:
|
|
789
|
+
throw new Error(`Project id: ${projectId} not found, ${url}`);
|
|
790
|
+
default:
|
|
791
|
+
throw new Error(`Failed to fetch marketplace config: ${json.msg}`);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return json;
|
|
795
|
+
};
|
|
796
|
+
var fetchStyles = async (projectId, env) => {
|
|
797
|
+
const response = await fetch(
|
|
798
|
+
`${builderMarketplaceApi(projectId, env)}/styles.css`
|
|
799
|
+
);
|
|
800
|
+
const styles = await response.text();
|
|
801
|
+
return styles.replaceAll(/['"]/g, "");
|
|
802
|
+
};
|
|
803
|
+
var fetchMarketplaceConfig = async (env, projectId) => {
|
|
804
|
+
const [marketplaceConfig, cssString] = await Promise.all([
|
|
805
|
+
fetchBuilderConfig(projectId, env),
|
|
806
|
+
fetchStyles(projectId, env)
|
|
807
|
+
]);
|
|
808
|
+
return {
|
|
809
|
+
...marketplaceConfig,
|
|
810
|
+
cssString,
|
|
811
|
+
manifestUrl: `${builderMarketplaceApi(projectId, env)}/manifest.json`
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
var marketplaceConfigOptions = (config) => {
|
|
815
|
+
let env = "production";
|
|
816
|
+
if ("_internal" in config && config._internal !== void 0) {
|
|
817
|
+
env = config._internal.builderEnv ?? env;
|
|
818
|
+
}
|
|
819
|
+
const projectId = config.projectId;
|
|
820
|
+
return queryOptions5({
|
|
821
|
+
queryKey: [...configKeys.marketplace, env, projectId],
|
|
822
|
+
queryFn: () => fetchMarketplaceConfig(env, projectId)
|
|
823
|
+
});
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
// src/react/hooks/useMarketplaceConfig.tsx
|
|
827
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
828
|
+
var useMarketplaceConfig = () => {
|
|
829
|
+
const config = useConfig();
|
|
830
|
+
return useQuery5(marketplaceConfigOptions(config));
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
// src/react/hooks/useRoyaltyPercentage.tsx
|
|
834
|
+
import { queryOptions as queryOptions6, useQuery as useQuery6 } from "@tanstack/react-query";
|
|
835
|
+
import { getContract } from "viem";
|
|
836
|
+
import { z as z7 } from "zod";
|
|
837
|
+
var UseRoyaletyPercentageSchema = z7.object({
|
|
838
|
+
chainId: ChainIdSchema.pipe(z7.coerce.string()),
|
|
839
|
+
collectionAddress: AddressSchema,
|
|
840
|
+
collectibleId: z7.string(),
|
|
841
|
+
query: QueryArgSchema
|
|
842
|
+
});
|
|
843
|
+
var fetchRoyaletyPercentage = async (args) => {
|
|
844
|
+
const parsedArgs = UseRoyaletyPercentageSchema.parse(args);
|
|
845
|
+
const publicClient = getPublicRpcClient(parsedArgs.chainId);
|
|
846
|
+
const contract = getContract({
|
|
847
|
+
address: parsedArgs.collectionAddress,
|
|
848
|
+
abi: EIP2981_ABI,
|
|
849
|
+
client: publicClient
|
|
850
|
+
});
|
|
851
|
+
try {
|
|
852
|
+
const [_, royaltyPercentage] = await contract.read.royaltyInfo([
|
|
853
|
+
BigInt(args.collectibleId),
|
|
854
|
+
100n
|
|
855
|
+
]);
|
|
856
|
+
return royaltyPercentage;
|
|
857
|
+
} catch {
|
|
858
|
+
return 0n;
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
var royaletyPercentageOptions = (args) => queryOptions6({
|
|
862
|
+
...args.query,
|
|
863
|
+
queryKey: [...collectableKeys.royaltyPercentage, args],
|
|
864
|
+
queryFn: () => fetchRoyaletyPercentage(args)
|
|
865
|
+
});
|
|
866
|
+
var useRoyaltyPercentage = (args) => {
|
|
867
|
+
return useQuery6(royaletyPercentageOptions(args));
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
// src/react/hooks/useGenerateListingTransaction.tsx
|
|
871
|
+
import { useMutation } from "@tanstack/react-query";
|
|
872
|
+
var dateToUnixTime = (date) => Math.floor(date.getTime() / 1e3).toString();
|
|
873
|
+
var generateListingTransaction = async (params, config, chainId) => {
|
|
874
|
+
const args = {
|
|
875
|
+
...params,
|
|
876
|
+
listing: {
|
|
877
|
+
...params.listing,
|
|
878
|
+
expiry: dateToUnixTime(params.listing.expiry)
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
882
|
+
return (await marketplaceClient.generateListingTransaction(args)).steps;
|
|
883
|
+
};
|
|
884
|
+
var useGenerateListingTransaction = (params) => {
|
|
885
|
+
const config = useConfig();
|
|
886
|
+
const { mutate, mutateAsync, ...result } = useMutation({
|
|
887
|
+
onSuccess: params.onSuccess,
|
|
888
|
+
mutationFn: (args) => generateListingTransaction(args, config, params.chainId)
|
|
889
|
+
});
|
|
890
|
+
return {
|
|
891
|
+
...result,
|
|
892
|
+
generateListingTransaction: mutate,
|
|
893
|
+
generateListingTransactionAsync: mutateAsync
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
// src/react/hooks/useGenerateOfferTransaction.tsx
|
|
898
|
+
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
899
|
+
var dateToUnixTime2 = (date) => Math.floor(date.getTime() / 1e3).toString();
|
|
900
|
+
var generateOfferTransaction = async (params, config, chainId) => {
|
|
901
|
+
const args = {
|
|
902
|
+
...params,
|
|
903
|
+
offer: { ...params.offer, expiry: dateToUnixTime2(params.offer.expiry) }
|
|
904
|
+
};
|
|
905
|
+
const marketplaceClient = getMarketplaceClient(chainId, config);
|
|
906
|
+
return (await marketplaceClient.generateOfferTransaction(args)).steps;
|
|
907
|
+
};
|
|
908
|
+
var useGenerateOfferTransaction = (params) => {
|
|
909
|
+
const config = useConfig();
|
|
910
|
+
const { mutate, mutateAsync, ...result } = useMutation2({
|
|
911
|
+
onSuccess: params.onSuccess,
|
|
912
|
+
mutationFn: (args) => generateOfferTransaction(args, config, params.chainId)
|
|
913
|
+
});
|
|
914
|
+
return {
|
|
915
|
+
...result,
|
|
916
|
+
generateOfferTransaction: mutate,
|
|
917
|
+
generateOfferTransactionAsync: mutateAsync
|
|
918
|
+
};
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// src/react/hooks/useTransferTokens.tsx
|
|
922
|
+
import { erc721Abi } from "viem";
|
|
923
|
+
import { useAccount, useWriteContract } from "wagmi";
|
|
924
|
+
var prepareTransferConfig = (params, accountAddress) => {
|
|
925
|
+
if (params.contractType === "ERC721") {
|
|
926
|
+
return {
|
|
927
|
+
abi: erc721Abi,
|
|
928
|
+
address: params.collectionAddress,
|
|
929
|
+
functionName: "safeTransferFrom",
|
|
930
|
+
args: [
|
|
931
|
+
accountAddress,
|
|
932
|
+
params.receiverAddress,
|
|
933
|
+
BigInt(params.tokenId)
|
|
934
|
+
]
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
return {
|
|
938
|
+
abi: ERC1155_ABI,
|
|
939
|
+
address: params.collectionAddress,
|
|
940
|
+
functionName: "safeTransferFrom",
|
|
941
|
+
args: [
|
|
942
|
+
accountAddress,
|
|
943
|
+
params.receiverAddress,
|
|
944
|
+
BigInt(params.tokenId),
|
|
945
|
+
params.quantity,
|
|
946
|
+
"0x"
|
|
947
|
+
// data
|
|
948
|
+
]
|
|
949
|
+
};
|
|
950
|
+
};
|
|
951
|
+
var useTransferTokens = () => {
|
|
952
|
+
const { address: accountAddress } = useAccount();
|
|
953
|
+
const {
|
|
954
|
+
writeContractAsync,
|
|
955
|
+
data: hash,
|
|
956
|
+
isPending,
|
|
957
|
+
isError,
|
|
958
|
+
isSuccess
|
|
959
|
+
} = useWriteContract();
|
|
960
|
+
const transferTokensAsync = async (params) => {
|
|
961
|
+
if (!accountAddress) {
|
|
962
|
+
throw new Error("No wallet connected");
|
|
963
|
+
}
|
|
964
|
+
const config = prepareTransferConfig(params, accountAddress);
|
|
965
|
+
return await writeContractAsync(config);
|
|
966
|
+
};
|
|
967
|
+
return {
|
|
968
|
+
transferTokensAsync,
|
|
969
|
+
hash,
|
|
970
|
+
transferring: isPending,
|
|
971
|
+
transferFailed: isError,
|
|
972
|
+
transferSuccess: isSuccess
|
|
973
|
+
};
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
export {
|
|
977
|
+
MarketplaceSdkContext,
|
|
978
|
+
MarketplaceProvider,
|
|
979
|
+
useConfig,
|
|
980
|
+
collectiblesFilterSchema,
|
|
981
|
+
getCollectibleHighestOfferArgsSchema,
|
|
982
|
+
listOffersForCollectibleArgsSchema,
|
|
983
|
+
listCollectiblesArgsSchema,
|
|
984
|
+
stepSchema,
|
|
985
|
+
collectibleOptions,
|
|
986
|
+
useCollectible,
|
|
987
|
+
collectionOptions,
|
|
988
|
+
useCollection,
|
|
989
|
+
currenciesOptions,
|
|
990
|
+
useCurrencies,
|
|
991
|
+
metadataOptionsSchema,
|
|
992
|
+
listBalancesOptions,
|
|
993
|
+
useListBalances,
|
|
994
|
+
lowestListingOptions,
|
|
995
|
+
useLowestListing,
|
|
996
|
+
marketplaceConfigOptions,
|
|
997
|
+
useMarketplaceConfig,
|
|
998
|
+
royaletyPercentageOptions,
|
|
999
|
+
useRoyaltyPercentage,
|
|
1000
|
+
generateListingTransaction,
|
|
1001
|
+
useGenerateListingTransaction,
|
|
1002
|
+
generateOfferTransaction,
|
|
1003
|
+
useGenerateOfferTransaction,
|
|
1004
|
+
useTransferTokens
|
|
1005
|
+
};
|
|
1006
|
+
//# sourceMappingURL=chunk-ITJEOCDV.js.map
|