@opensea/sdk 12.12.0 → 12.13.1

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.
@@ -1,4 +1,4 @@
1
- import type { AccountResolveResponse, AccountSearchResponse as ApiAccountSearchResponse, AgentProfileRelationshipsResponse as ApiAgentProfileRelationshipsResponse, BuildOfferResponse as ApiBuildOfferResponse, CancelResponse as ApiCancelResponse, CollectionSearchResponse as ApiCollectionSearchResponse, DropMintRequest as ApiDropMintRequest, DropMintResponse as ApiDropMintResponse, Listing as ApiListing, Nft as ApiNft, NftSearchResponse as ApiNftSearchResponse, Offer as ApiOffer, Order as ApiOrder, OrderAsset as ApiOrderAsset, Payment as ApiPayment, Price as ApiPrice, SearchResponse as ApiSearchResponse, SearchResultResponse as ApiSearchResultResponse, SvmInstructionAccountResponse as ApiSvmInstructionAccountResponse, SvmInstructionResponse as ApiSvmInstructionResponse, SvmTransactionDetailsResponse as ApiSvmTransactionDetailsResponse, SwapExecuteRequest as ApiSwapExecuteRequest, SwapExecuteResponse as ApiSwapExecuteResponse, SwapQuoteResponse as ApiSwapQuoteResponse, SweepCollectionRequest as ApiSweepCollectionRequest, SweepCollectionResponse as ApiSweepCollectionResponse, TokenDetailedResponse as ApiTokenDetailedResponse, TokenResponse as ApiTokenResponse, TokenSearchResponse as ApiTokenSearchResponse, Trait as ApiTrait, TraitFloorResponse as ApiTraitFloorResponse, TraitFloorsResponse as ApiTraitFloorsResponse, TransactionReceiptRequest as ApiTransactionReceiptRequest, TransactionReceiptResponse as ApiTransactionReceiptResponse, ValidateMetadataResponse as ApiValidateMetadataResponse, WalletVisibilityResponse as ApiWalletVisibilityResponse, AssetMetadataResponse, ChainIdentifier, ChainListResponse, ChainResponse, ContractResponse, DropDetailedResponse, DropResponse, DropStageResponse, InstantApiKeyResponse, ListingsResponse, NftDetailed, NftListResponse, NftResponse, OffersResponse, paths, StandardizedNft, StandardizedNftFacetsResponse, StandardizedNftListResponse, TokenAccountActivityPaginatedResponse, TokenBalancePaginatedResponse, TokenBalanceResponse, TokenGroupPaginatedResponse, TokenGroupResponse, TokenPaginatedResponse } from "@opensea/api-types";
1
+ import type { AccountResolveResponse, AccountSearchResponse as ApiAccountSearchResponse, AgentProfileRelationshipsResponse as ApiAgentProfileRelationshipsResponse, BuildOfferResponse as ApiBuildOfferResponse, CancelResponse as ApiCancelResponse, CollectionPfpProfilesResponse as ApiCollectionPfpProfilesResponse, CollectionSearchResponse as ApiCollectionSearchResponse, CreatorFeeEnforcementStatusResponse as ApiCreatorFeeEnforcementStatusResponse, DropMintRequest as ApiDropMintRequest, DropMintResponse as ApiDropMintResponse, Listing as ApiListing, Nft as ApiNft, NftSearchResponse as ApiNftSearchResponse, Offer as ApiOffer, Order as ApiOrder, OrderAsset as ApiOrderAsset, Payment as ApiPayment, Price as ApiPrice, SearchResponse as ApiSearchResponse, SearchResultResponse as ApiSearchResultResponse, SvmInstructionAccountResponse as ApiSvmInstructionAccountResponse, SvmInstructionResponse as ApiSvmInstructionResponse, SvmTransactionDetailsResponse as ApiSvmTransactionDetailsResponse, SwapExecuteRequest as ApiSwapExecuteRequest, SwapExecuteResponse as ApiSwapExecuteResponse, SwapQuoteResponse as ApiSwapQuoteResponse, SweepCollectionRequest as ApiSweepCollectionRequest, SweepCollectionResponse as ApiSweepCollectionResponse, TokenDetailedResponse as ApiTokenDetailedResponse, TokenResponse as ApiTokenResponse, TokenSearchResponse as ApiTokenSearchResponse, TopPfpCollectionsResponse as ApiTopPfpCollectionsResponse, Trait as ApiTrait, TraitFloorResponse as ApiTraitFloorResponse, TraitFloorsResponse as ApiTraitFloorsResponse, TransactionReceiptRequest as ApiTransactionReceiptRequest, TransactionReceiptResponse as ApiTransactionReceiptResponse, ValidateMetadataResponse as ApiValidateMetadataResponse, WalletVisibilityResponse as ApiWalletVisibilityResponse, AssetMetadataResponse, ChainIdentifier, ChainListResponse, ChainResponse, ContractResponse, DropDetailedResponse, DropResponse, DropStageResponse, InstantApiKeyResponse, ListingsResponse, NftDetailed, NftListResponse, NftResponse, OffersResponse, OperationQueryParams, paths, RegisteredToolResponse, StandardizedNft, StandardizedNftFacetsResponse, StandardizedNftListResponse, TokenAccountActivityPaginatedResponse, TokenBalancePaginatedResponse, TokenBalanceResponse, TokenGroupPaginatedResponse, TokenGroupResponse, TokenPaginatedResponse, ToolActivityPaginatedResponse, ToolListPaginatedResponse, ToolSearchPaginatedResponse, ToolUsageRequest, ToolUsageResponse } from "@opensea/api-types";
2
2
  import type { OrderType, ProtocolData } from "../orders/types";
3
3
  import type { OpenSeaCollection } from "../types";
4
4
  import type { Camelize } from "../utils/case";
@@ -1032,6 +1032,33 @@ export type TraitFloor = Camelize<ApiTraitFloorResponse>;
1032
1032
  * @category API Response Types
1033
1033
  */
1034
1034
  export type TraitFloorsResponse = Camelize<ApiTraitFloorsResponse>;
1035
+ /**
1036
+ * Whether a collection enforces creator fees onchain, and whether its contract supports turning
1037
+ * enforcement on.
1038
+ * @category API Response Types
1039
+ */
1040
+ export type CreatorFeeEnforcementStatusResponse = Camelize<ApiCreatorFeeEnforcementStatusResponse>;
1041
+ /**
1042
+ * Query args for `GET /api/v2/collections/{slug}/pfp-profiles`, derived from the spec.
1043
+ * @category API Query Args
1044
+ */
1045
+ export type GetCollectionPfpProfilesArgs = Camelize<OperationQueryParams<"get_collection_pfp_profiles">>;
1046
+ /**
1047
+ * Profiles wearing a verified NFT from a collection as their profile picture.
1048
+ * @category API Response Types
1049
+ */
1050
+ export type CollectionPfpProfilesResponse = Camelize<ApiCollectionPfpProfilesResponse>;
1051
+ /**
1052
+ * Query args for `GET /api/v2/pfp/top-collections`, derived from the spec. `limit` (1-50) is
1053
+ * required.
1054
+ * @category API Query Args
1055
+ */
1056
+ export type GetTopPfpCollectionsArgs = Camelize<OperationQueryParams<"get_top_pfp_collections">>;
1057
+ /**
1058
+ * Collections ranked by verified NFT profile-picture wearer count.
1059
+ * @category API Response Types
1060
+ */
1061
+ export type TopPfpCollectionsResponse = Camelize<ApiTopPfpCollectionsResponse>;
1035
1062
  export type CreateOfferActionsResponse = Camelize<ApiCreateOfferActionsResponse>;
1036
1063
  export type CreateOfferFulfillmentActionsResponse = Camelize<ApiFulfillmentActionsResponse>;
1037
1064
  export type CrossChainDropMintResponse = Camelize<ApiCrossChainDropMintResponse>;
@@ -1350,4 +1377,54 @@ export type ProfileListingsResponse = Camelize<ListingsResponse>;
1350
1377
  * @category API Response Types
1351
1378
  */
1352
1379
  export type ProfileOffersResponse = Camelize<OffersResponse>;
1380
+ /**
1381
+ * Query args for `GET /api/v2/tools`. Derived from the spec. Beta: the endpoint may change
1382
+ * without notice.
1383
+ * @category API Query Args
1384
+ */
1385
+ export type ListToolsArgs = Camelize<OperationQueryParams<"list_tools">>;
1386
+ /**
1387
+ * Query args for `GET /api/v2/tools/search`. Derived from the spec. Beta: the endpoint may change
1388
+ * without notice.
1389
+ * @category API Query Args
1390
+ */
1391
+ export type SearchToolsArgs = Camelize<OperationQueryParams<"search_tools">>;
1392
+ /**
1393
+ * Query args for `GET /api/v2/tools/{registry_chain}/{registry_addr}/{tool_id}/activity`.
1394
+ * Derived from the spec. Beta: the endpoint may change without notice.
1395
+ * @category API Query Args
1396
+ */
1397
+ export type GetToolActivityArgs = Camelize<OperationQueryParams<"get_tool_activity">>;
1398
+ /**
1399
+ * Body for `POST /api/v2/tools/usage`. Identify the tool by `toolChainId`, `toolRegistryAddress`
1400
+ * and `toolOnchainId`, or by `toolEndpoint` alone. Beta: the endpoint may change without notice.
1401
+ * @category API Models
1402
+ */
1403
+ export type ReportToolUsageRequest = Camelize<ToolUsageRequest>;
1404
+ /**
1405
+ * Response from `POST /api/v2/tools/usage`. Beta.
1406
+ * @category API Response Types
1407
+ */
1408
+ export type ReportToolUsageResponse = Camelize<ToolUsageResponse>;
1409
+ /**
1410
+ * Response from `GET /api/v2/tools`. Beta.
1411
+ * @category API Response Types
1412
+ */
1413
+ export type ListToolsResponse = Camelize<ToolListPaginatedResponse>;
1414
+ /**
1415
+ * Response from `GET /api/v2/tools/search`. Beta.
1416
+ * @category API Response Types
1417
+ */
1418
+ export type SearchToolsResponse = Camelize<ToolSearchPaginatedResponse>;
1419
+ /**
1420
+ * A registered tool. `inputs` and `outputs` are the tool's own JSON Schemas and keep their
1421
+ * wire keys; every other field is camelized. Beta.
1422
+ * @category API Response Types
1423
+ */
1424
+ export type GetToolResponse = Omit<Camelize<RegisteredToolResponse>, "inputs" | "outputs"> & Pick<RegisteredToolResponse, "inputs" | "outputs">;
1425
+ /**
1426
+ * Response from the tool activity endpoint. Beta.
1427
+ * @category API Response Types
1428
+ */
1429
+ export type GetToolActivityResponse = Camelize<ToolActivityPaginatedResponse>;
1353
1430
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":";;;AAiGA,8CAIC;AAVD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,MAAiC;IAEjC,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACzE,CAAC;AA0ED,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,wDAA6B,CAAA;IAC7B,4DAAiC,CAAA;IACjC,gEAAqC,CAAA;IACrC,gEAAqC,CAAA;IACrC,oDAAyB,CAAA;IACzB,oDAAyB,CAAA;AAC3B,CAAC,EAPW,uBAAuB,uCAAvB,uBAAuB,QAOlC;AAED;;;GAGG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;AACzB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AA2ND;;;;GAIG;AACH,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACj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zB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AA2ND;;;;GAIG;AACH,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,yDAAqC,CAAA;IACrC,iDAA6B,CAAA;IAC7B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,uCAAuC;IACvC,iCAAa,CAAA;AACf,CAAC,EARW,gBAAgB,gCAAhB,gBAAgB,QAQ3B;AAED;;;GAGG;AACH,IAAY,cASX;AATD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,uCAAqB,CAAA;IACrB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,6CAA2B,CAAA;IAC3B,uDAAqC,CAAA;AACvC,CAAC,EATW,cAAc,8BAAd,cAAc,QASzB;AAED;;;GAGG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,uDAAqC,CAAA;IACrC,6CAA2B,CAAA;AAC7B,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB"}
@@ -0,0 +1,50 @@
1
+ import type { UploadContext } from "@opensea/api-types";
2
+ export type { UploadContext };
3
+ /**
4
+ * File bytes accepted by {@link uploadToContext}. A `File` is a `Blob`, and a
5
+ * Node `Buffer` is a `Uint8Array`.
6
+ */
7
+ export type UploadContextFile = Blob | ArrayBuffer | Uint8Array;
8
+ /**
9
+ * A storage upload that returned a non-2xx status. Only the status is kept:
10
+ * the response body is never read, because storage error bodies can echo
11
+ * signed request material such as `StringToSign` or `AWSAccessKeyId`.
12
+ */
13
+ export declare class UploadContextError extends Error {
14
+ status: number;
15
+ constructor(status: number);
16
+ }
17
+ /**
18
+ * Narrow a value to a single `UploadContext`. An array (the shape
19
+ * `createDropItemMediaUpload` returns) is accepted only with an `index`.
20
+ *
21
+ * This checks shape, not origin. Pass only a value that came from an OpenSea
22
+ * API response, such as the `walletAuth` upload helpers, never untrusted
23
+ * user-supplied JSON.
24
+ */
25
+ export declare function selectUploadContext(value: unknown, index?: number): UploadContext;
26
+ /**
27
+ * Perform the storage upload an `UploadContext` describes and return its
28
+ * token for the follow-up OpenSea call.
29
+ *
30
+ * The request goes straight to the context's storage URL through the global
31
+ * `fetch`, with no OpenSea API key or wallet token. For POST, every entry of
32
+ * `fields` is sent unchanged as a multipart text field, then the file as the
33
+ * last part, named `file`; the multipart boundary and Content-Type header are
34
+ * left to fetch. For PUT, the bytes are sent as the body with no headers of
35
+ * our own, so a `Blob` with a `type` sets the Content-Type and raw bytes set
36
+ * none. Any 2xx response is success. The url must be HTTPS, and a redirect
37
+ * fails the upload rather than resending the file elsewhere. The response
38
+ * body is never read: it is cancelled on success and on failure.
39
+ *
40
+ * The file goes to whatever HTTPS URL the context names, so the context must
41
+ * come from an OpenSea API response, such as the `walletAuth` upload helpers.
42
+ *
43
+ * @throws {UploadContextError} when storage answers with a non-2xx status.
44
+ */
45
+ export declare function uploadToContext(context: UploadContext, file: UploadContextFile, options?: {
46
+ filename?: string;
47
+ signal?: AbortSignal;
48
+ }): Promise<{
49
+ token: string;
50
+ }>;
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadContextError = void 0;
4
+ exports.selectUploadContext = selectUploadContext;
5
+ exports.uploadToContext = uploadToContext;
6
+ /**
7
+ * A storage upload that returned a non-2xx status. Only the status is kept:
8
+ * the response body is never read, because storage error bodies can echo
9
+ * signed request material such as `StringToSign` or `AWSAccessKeyId`.
10
+ */
11
+ class UploadContextError extends Error {
12
+ status;
13
+ constructor(status) {
14
+ super(`Storage upload failed with HTTP ${status}`);
15
+ this.status = status;
16
+ this.name = "UploadContextError";
17
+ }
18
+ }
19
+ exports.UploadContextError = UploadContextError;
20
+ /**
21
+ * OpenSea upload contexts always point at HTTPS storage. Refusing anything else
22
+ * keeps a hand-edited or foreign context from sending the file in cleartext or
23
+ * to a non-network scheme.
24
+ */
25
+ function assertHttpsUrl(url) {
26
+ let parsed;
27
+ try {
28
+ parsed = new URL(url);
29
+ }
30
+ catch {
31
+ throw new Error("Upload context url is not a valid URL");
32
+ }
33
+ if (parsed.protocol !== "https:") {
34
+ throw new Error(`Upload context url must use https, not ${parsed.protocol.replace(/:$/, "")}`);
35
+ }
36
+ }
37
+ /**
38
+ * `instanceof Blob` is false for a Blob or File from another realm (an iframe,
39
+ * a worker), and copying one through `new Uint8Array` yields zero bytes, so
40
+ * Blob-like values are recognized by shape instead.
41
+ */
42
+ function isBlobLike(file) {
43
+ if (file instanceof Blob)
44
+ return true;
45
+ const candidate = file;
46
+ return (typeof candidate.arrayBuffer === "function" &&
47
+ typeof candidate.size === "number" &&
48
+ typeof candidate.type === "string");
49
+ }
50
+ function toBlob(file) {
51
+ if (isBlobLike(file))
52
+ return file;
53
+ return new Blob([file instanceof ArrayBuffer ? file : new Uint8Array(file)]);
54
+ }
55
+ /**
56
+ * Narrow a value to a single `UploadContext`. An array (the shape
57
+ * `createDropItemMediaUpload` returns) is accepted only with an `index`.
58
+ *
59
+ * This checks shape, not origin. Pass only a value that came from an OpenSea
60
+ * API response, such as the `walletAuth` upload helpers, never untrusted
61
+ * user-supplied JSON.
62
+ */
63
+ function selectUploadContext(value, index) {
64
+ let candidate = value;
65
+ if (Array.isArray(value)) {
66
+ if (index === undefined) {
67
+ throw new Error(`Upload context is an array of ${value.length}; pass the index of the one to use`);
68
+ }
69
+ if (!Number.isInteger(index) || index < 0 || index >= value.length) {
70
+ throw new Error(`Index ${index} is out of range for ${value.length} upload contexts`);
71
+ }
72
+ candidate = value[index];
73
+ }
74
+ else if (index !== undefined) {
75
+ throw new Error("An index applies only to an array of upload contexts");
76
+ }
77
+ const context = candidate;
78
+ if (!context ||
79
+ typeof context !== "object" ||
80
+ typeof context.url !== "string" ||
81
+ typeof context.token !== "string" ||
82
+ (context.method !== "POST" && context.method !== "PUT") ||
83
+ !context.fields ||
84
+ typeof context.fields !== "object") {
85
+ throw new Error("Not an upload context: expected an object with url, method (POST or PUT), fields and token");
86
+ }
87
+ return context;
88
+ }
89
+ /**
90
+ * Perform the storage upload an `UploadContext` describes and return its
91
+ * token for the follow-up OpenSea call.
92
+ *
93
+ * The request goes straight to the context's storage URL through the global
94
+ * `fetch`, with no OpenSea API key or wallet token. For POST, every entry of
95
+ * `fields` is sent unchanged as a multipart text field, then the file as the
96
+ * last part, named `file`; the multipart boundary and Content-Type header are
97
+ * left to fetch. For PUT, the bytes are sent as the body with no headers of
98
+ * our own, so a `Blob` with a `type` sets the Content-Type and raw bytes set
99
+ * none. Any 2xx response is success. The url must be HTTPS, and a redirect
100
+ * fails the upload rather than resending the file elsewhere. The response
101
+ * body is never read: it is cancelled on success and on failure.
102
+ *
103
+ * The file goes to whatever HTTPS URL the context names, so the context must
104
+ * come from an OpenSea API response, such as the `walletAuth` upload helpers.
105
+ *
106
+ * @throws {UploadContextError} when storage answers with a non-2xx status.
107
+ */
108
+ async function uploadToContext(context, file, options) {
109
+ const valid = selectUploadContext(context);
110
+ assertHttpsUrl(valid.url);
111
+ const blob = toBlob(file);
112
+ let response;
113
+ if (valid.method === "PUT") {
114
+ response = await fetch(valid.url, {
115
+ method: "PUT",
116
+ body: blob,
117
+ redirect: "error",
118
+ signal: options?.signal,
119
+ });
120
+ }
121
+ else {
122
+ const form = new FormData();
123
+ for (const [name, value] of Object.entries(valid.fields)) {
124
+ form.append(name, value);
125
+ }
126
+ form.append("file", blob, options?.filename ?? "file");
127
+ response = await fetch(valid.url, {
128
+ method: "POST",
129
+ body: form,
130
+ redirect: "error",
131
+ signal: options?.signal,
132
+ });
133
+ }
134
+ await discardBody(response);
135
+ if (!response.ok)
136
+ throw new UploadContextError(response.status);
137
+ return { token: valid.token };
138
+ }
139
+ async function discardBody(response) {
140
+ await Promise.resolve()
141
+ .then(() => response.body?.cancel())
142
+ .catch(() => undefined);
143
+ }
144
+ //# sourceMappingURL=uploadContext.js.map
@@ -0,0 +1 @@
1
+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AK,EAAE,CAAA;AAC/B,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,QAAkB;IAC3C,MAAM,OAAO,CAAC,OAAO,EAAE;SACpB,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;SACnC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;AAC3B,CAAC"}
@@ -195,6 +195,29 @@ export declare class WalletAuthAPI {
195
195
  mediaToken: string;
196
196
  mediaType?: string | null | undefined;
197
197
  }>;
198
+ /**
199
+ * The drop's saved items, including a draft's, one page at a time. Only the
200
+ * collection owner or an authorized editor can list them.
201
+ */
202
+ listDropItems(slug: string, query?: WalletAuthQuery<"list_drop_items">): Promise<{
203
+ items: {
204
+ tokenId: string;
205
+ name?: string | null | undefined;
206
+ description?: string | null | undefined;
207
+ imageUrl: string;
208
+ attributes: {
209
+ traitType: string;
210
+ value: string;
211
+ }[];
212
+ mediaToken: string;
213
+ contractStandard: string;
214
+ externalUrl?: string | null | undefined;
215
+ animationUrl?: string | null | undefined;
216
+ chain: string;
217
+ contractAddress: string;
218
+ }[];
219
+ next?: string | null | undefined;
220
+ }>;
198
221
  saveSelfMintDropItem(slug: string, body: WalletAuthRequest<"save_self_mint_drop_item">): Promise<{
199
222
  to: string;
200
223
  from: string;
@@ -351,6 +374,227 @@ export declare class WalletAuthAPI {
351
374
  };
352
375
  token: string;
353
376
  }>;
377
+ /**
378
+ * `placement` is one of hero_desktop, hero_mobile, about_preview,
379
+ * about_section, overview, overview_background or team. The response is not
380
+ * camelized, for the `UploadContext.fields` reason on
381
+ * `createCollectionImageUpload`.
382
+ */
383
+ createCollectionPageMediaUpload(slug: string, placement: string, contentType: WalletAuthQuery<"upload_collection_page_media">["contentType"]): Promise<{
384
+ url: string;
385
+ method: "POST" | "PUT";
386
+ fields: {
387
+ [key: string]: string;
388
+ };
389
+ token: string;
390
+ }>;
391
+ getCollectionMetadata(slug: string): Promise<{
392
+ hero?: {
393
+ desktopHeroMedia?: {
394
+ image?: {
395
+ url: string;
396
+ } | null | undefined;
397
+ video?: {
398
+ url: string;
399
+ thumbnailUrl?: string | null | undefined;
400
+ } | null | undefined;
401
+ muxVideo?: {
402
+ playbackId: string;
403
+ thumbnailUrl?: string | null | undefined;
404
+ } | null | undefined;
405
+ } | null | undefined;
406
+ mobileHeroMedia?: {
407
+ image?: {
408
+ url: string;
409
+ } | null | undefined;
410
+ video?: {
411
+ url: string;
412
+ thumbnailUrl?: string | null | undefined;
413
+ } | null | undefined;
414
+ muxVideo?: {
415
+ playbackId: string;
416
+ thumbnailUrl?: string | null | undefined;
417
+ } | null | undefined;
418
+ } | null | undefined;
419
+ } | null | undefined;
420
+ about?: {
421
+ previewMedia: {
422
+ image?: {
423
+ url: string;
424
+ } | null | undefined;
425
+ video?: {
426
+ url: string;
427
+ thumbnailUrl?: string | null | undefined;
428
+ } | null | undefined;
429
+ muxVideo?: {
430
+ playbackId: string;
431
+ thumbnailUrl?: string | null | undefined;
432
+ } | null | undefined;
433
+ }[];
434
+ sections: {
435
+ id?: string | null | undefined;
436
+ title?: string | null | undefined;
437
+ description?: string | null | undefined;
438
+ media: {
439
+ image?: {
440
+ url: string;
441
+ } | null | undefined;
442
+ video?: {
443
+ url: string;
444
+ thumbnailUrl?: string | null | undefined;
445
+ } | null | undefined;
446
+ muxVideo?: {
447
+ playbackId: string;
448
+ thumbnailUrl?: string | null | undefined;
449
+ } | null | undefined;
450
+ }[];
451
+ }[];
452
+ } | null | undefined;
453
+ overview?: {
454
+ modules: {
455
+ narrative: {
456
+ id?: string | null | undefined;
457
+ index: number;
458
+ title?: string | null | undefined;
459
+ description?: string | null | undefined;
460
+ media: {
461
+ image?: {
462
+ url: string;
463
+ } | null | undefined;
464
+ video?: {
465
+ url: string;
466
+ thumbnailUrl?: string | null | undefined;
467
+ } | null | undefined;
468
+ muxVideo?: {
469
+ playbackId: string;
470
+ thumbnailUrl?: string | null | undefined;
471
+ } | null | undefined;
472
+ }[];
473
+ horizontalTextPosition?: string | null | undefined;
474
+ verticalTextPosition?: string | null | undefined;
475
+ desktopBackgroundMedia?: {
476
+ image?: {
477
+ url: string;
478
+ } | null | undefined;
479
+ video?: {
480
+ url: string;
481
+ thumbnailUrl?: string | null | undefined;
482
+ } | null | undefined;
483
+ muxVideo?: {
484
+ playbackId: string;
485
+ thumbnailUrl?: string | null | undefined;
486
+ } | null | undefined;
487
+ } | null | undefined;
488
+ mobileBackgroundMedia?: {
489
+ image?: {
490
+ url: string;
491
+ } | null | undefined;
492
+ video?: {
493
+ url: string;
494
+ thumbnailUrl?: string | null | undefined;
495
+ } | null | undefined;
496
+ muxVideo?: {
497
+ playbackId: string;
498
+ thumbnailUrl?: string | null | undefined;
499
+ } | null | undefined;
500
+ } | null | undefined;
501
+ variant?: string | null | undefined;
502
+ }[];
503
+ contentBlock: {
504
+ id?: string | null | undefined;
505
+ index: number;
506
+ title?: string | null | undefined;
507
+ description?: string | null | undefined;
508
+ sections: {
509
+ id?: string | null | undefined;
510
+ moduleType: string;
511
+ title?: string | null | undefined;
512
+ description?: string | null | undefined;
513
+ date?: string | null | undefined;
514
+ externalLink?: {
515
+ href?: string | null | undefined;
516
+ label?: string | null | undefined;
517
+ } | null | undefined;
518
+ media?: {
519
+ image?: {
520
+ url: string;
521
+ } | null | undefined;
522
+ video?: {
523
+ url: string;
524
+ thumbnailUrl?: string | null | undefined;
525
+ } | null | undefined;
526
+ muxVideo?: {
527
+ playbackId: string;
528
+ thumbnailUrl?: string | null | undefined;
529
+ } | null | undefined;
530
+ } | null | undefined;
531
+ collectionSlug?: string | null | undefined;
532
+ tokenId?: string | null | undefined;
533
+ }[];
534
+ }[];
535
+ team: {
536
+ index: number;
537
+ hidden?: boolean | null | undefined;
538
+ title?: string | null | undefined;
539
+ description?: string | null | undefined;
540
+ sections: {
541
+ id?: string | null | undefined;
542
+ name?: string | null | undefined;
543
+ title?: string | null | undefined;
544
+ bio?: string | null | undefined;
545
+ websiteUrl?: string | null | undefined;
546
+ twitterUrl?: string | null | undefined;
547
+ instagramUrl?: string | null | undefined;
548
+ media: {
549
+ image?: {
550
+ url: string;
551
+ } | null | undefined;
552
+ video?: {
553
+ url: string;
554
+ thumbnailUrl?: string | null | undefined;
555
+ } | null | undefined;
556
+ muxVideo?: {
557
+ playbackId: string;
558
+ thumbnailUrl?: string | null | undefined;
559
+ } | null | undefined;
560
+ }[];
561
+ }[];
562
+ }[];
563
+ faq: {
564
+ index: number;
565
+ hidden?: boolean | null | undefined;
566
+ title?: string | null | undefined;
567
+ description?: string | null | undefined;
568
+ sections: {
569
+ id?: string | null | undefined;
570
+ question?: string | null | undefined;
571
+ answer?: string | null | undefined;
572
+ }[];
573
+ }[];
574
+ };
575
+ } | null | undefined;
576
+ }>;
577
+ setCollectionPricingCurrency(slug: string, body: WalletAuthRequest<"set_collection_pricing_currency">): Promise<{
578
+ success: boolean;
579
+ workflowId?: string | null | undefined;
580
+ }>;
581
+ /**
582
+ * Send the returned transactions in order from each one's `from`, the
583
+ * contract's onchain owner. The list is empty when the contract is already
584
+ * in the requested state.
585
+ */
586
+ buildCreatorFeeEnforcementTransactions(slug: string, body: WalletAuthRequest<"build_creator_fee_enforcement_transactions">): Promise<{
587
+ transactions: {
588
+ to: string;
589
+ from: string;
590
+ data: string;
591
+ value: string;
592
+ chain: string;
593
+ }[];
594
+ }>;
595
+ refreshCollectionMetadata(slug: string): Promise<{
596
+ success: boolean;
597
+ }>;
354
598
  /**
355
599
  * `UpdateProfileSettingsRequest` is camelCase on the wire (`displayName`,
356
600
  * `externalUrl`, `profileImageToken`, `bannerImageToken`), so the body is sent
@@ -396,6 +640,30 @@ export declare class WalletAuthAPI {
396
640
  clearProfileNftPfp(): Promise<{
397
641
  success: boolean;
398
642
  }>;
643
+ /**
644
+ * Public read: an API key alone is enough, and the wallet token is sent only
645
+ * when one is configured.
646
+ */
647
+ getProfileShelves(address: string): Promise<{
648
+ id: string;
649
+ accountAddress?: string | null | undefined;
650
+ title: string;
651
+ description?: string | null | undefined;
652
+ displayOrder: number;
653
+ items: {
654
+ chain: string;
655
+ contractAddress: string;
656
+ tokenId: string;
657
+ }[];
658
+ icon?: string | null | undefined;
659
+ view?: string | null | undefined;
660
+ singleItemShelfSide?: string | null | undefined;
661
+ shelfItemMetadata: {
662
+ [x: string]: {
663
+ description?: string | null | undefined;
664
+ };
665
+ };
666
+ }[]>;
399
667
  createProfileShelf(body: WalletAuthRequest<"create_profile_shelf">): Promise<{
400
668
  id: string;
401
669
  accountAddress?: string | null | undefined;
@@ -79,6 +79,13 @@ class WalletAuthAPI {
79
79
  savePrerevealDropItem(slug, body) {
80
80
  return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/prereveal-item`, body);
81
81
  }
82
+ /**
83
+ * The drop's saved items, including a draft's, one page at a time. Only the
84
+ * collection owner or an authorized editor can list them.
85
+ */
86
+ listDropItems(slug, query) {
87
+ return this.fetcher.get(`/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/items`, query);
88
+ }
82
89
  saveSelfMintDropItem(slug, body) {
83
90
  return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/items`, body);
84
91
  }
@@ -182,6 +189,33 @@ class WalletAuthAPI {
182
189
  const query = new URLSearchParams({ content_type: contentType });
183
190
  return this.fetcher.request("POST", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/images/${(0, apiPaths_1.segment)(imageType)}?${query}`, undefined, undefined, { camelizeResponse: false });
184
191
  }
192
+ /**
193
+ * `placement` is one of hero_desktop, hero_mobile, about_preview,
194
+ * about_section, overview, overview_background or team. The response is not
195
+ * camelized, for the `UploadContext.fields` reason on
196
+ * `createCollectionImageUpload`.
197
+ */
198
+ createCollectionPageMediaUpload(slug, placement, contentType) {
199
+ const query = new URLSearchParams({ content_type: contentType });
200
+ return this.fetcher.request("POST", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/media/${(0, apiPaths_1.segment)(placement)}?${query}`, undefined, undefined, { camelizeResponse: false });
201
+ }
202
+ getCollectionMetadata(slug) {
203
+ return this.fetcher.get(`/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/metadata`);
204
+ }
205
+ setCollectionPricingCurrency(slug, body) {
206
+ return this.fetcher.request("POST", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/pricing_currency`, body);
207
+ }
208
+ /**
209
+ * Send the returned transactions in order from each one's `from`, the
210
+ * contract's onchain owner. The list is empty when the contract is already
211
+ * in the requested state.
212
+ */
213
+ buildCreatorFeeEnforcementTransactions(slug, body) {
214
+ return this.fetcher.request("POST", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/creator_fee_enforcement`, body);
215
+ }
216
+ refreshCollectionMetadata(slug) {
217
+ return this.fetcher.request("POST", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/refresh`);
218
+ }
185
219
  /**
186
220
  * `UpdateProfileSettingsRequest` is camelCase on the wire (`displayName`,
187
221
  * `externalUrl`, `profileImageToken`, `bannerImageToken`), so the body is sent
@@ -215,6 +249,13 @@ class WalletAuthAPI {
215
249
  clearProfileNftPfp() {
216
250
  return this.fetcher.request("DELETE", "/api/v2/profile/nft-pfp");
217
251
  }
252
+ /**
253
+ * Public read: an API key alone is enough, and the wallet token is sent only
254
+ * when one is configured.
255
+ */
256
+ getProfileShelves(address) {
257
+ return this.fetcher.get("/api/v2/profile/shelves", { address });
258
+ }
218
259
  createProfileShelf(body) {
219
260
  return this.fetcher.request("POST", "/api/v2/profile/shelves", body);
220
261
  }