@opensea/sdk 12.1.0 → 12.2.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/README.md +2 -2
- package/lib/api/accounts.js +1 -1
- package/lib/api/accounts.js.map +1 -1
- package/lib/api/api.d.ts +10 -0
- package/lib/api/api.js +20 -3
- package/lib/api/api.js.map +1 -1
- package/lib/api/apiPaths.d.ts +18 -0
- package/lib/api/apiPaths.js +91 -63
- package/lib/api/apiPaths.js.map +1 -1
- package/lib/api/collections.d.ts +10 -1
- package/lib/api/collections.js +11 -0
- package/lib/api/collections.js.map +1 -1
- package/lib/api/types.d.ts +11 -1
- package/lib/api/types.js.map +1 -1
- package/lib/api/walletAuth.js +31 -31
- package/lib/api/walletAuth.js.map +1 -1
- package/lib/types.d.ts +11 -3
- package/package.json +2 -2
- package/src/api/accounts.ts +1 -1
- package/src/api/api.ts +33 -3
- package/src/api/apiPaths.ts +91 -61
- package/src/api/collections.ts +16 -0
- package/src/api/types.ts +14 -0
- package/src/api/walletAuth.ts +1 -2
- package/src/types.ts +12 -3
package/lib/api/walletAuth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WalletAuthAPI = void 0;
|
|
4
|
-
const
|
|
4
|
+
const apiPaths_1 = require("./apiPaths");
|
|
5
5
|
/** Typed helpers for wallet-authenticated REST operations. */
|
|
6
6
|
class WalletAuthAPI {
|
|
7
7
|
fetcher;
|
|
@@ -9,16 +9,16 @@ class WalletAuthAPI {
|
|
|
9
9
|
this.fetcher = fetcher;
|
|
10
10
|
}
|
|
11
11
|
getDropEligibility(slug) {
|
|
12
|
-
return this.fetcher.get(`/api/v2/drops/${segment(slug)}/eligibility`);
|
|
12
|
+
return this.fetcher.get(`/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/eligibility`);
|
|
13
13
|
}
|
|
14
14
|
getFavorites(address, query) {
|
|
15
|
-
return this.fetcher.get(`/api/v2/account/${segment(address)}/favorites`, query);
|
|
15
|
+
return this.fetcher.get(`/api/v2/account/${(0, apiPaths_1.segment)(address)}/favorites`, query);
|
|
16
16
|
}
|
|
17
17
|
getTokenWatchlist(address) {
|
|
18
|
-
return this.fetcher.get(`/api/v2/account/${segment(address)}/token_watchlist`);
|
|
18
|
+
return this.fetcher.get(`/api/v2/account/${(0, apiPaths_1.segment)(address)}/token_watchlist`);
|
|
19
19
|
}
|
|
20
20
|
getPerpetualWatchlist(address) {
|
|
21
|
-
return this.fetcher.get(`/api/v2/account/${segment(address)}/perpetual_watchlist`);
|
|
21
|
+
return this.fetcher.get(`/api/v2/account/${(0, apiPaths_1.segment)(address)}/perpetual_watchlist`);
|
|
22
22
|
}
|
|
23
23
|
addWatchlistEntry(body) {
|
|
24
24
|
return this.fetcher.request("POST", "/api/v2/watchlist", body);
|
|
@@ -27,25 +27,25 @@ class WalletAuthAPI {
|
|
|
27
27
|
return this.fetcher.request("DELETE", "/api/v2/watchlist", body);
|
|
28
28
|
}
|
|
29
29
|
getAccountRelationship(addressOrUsername) {
|
|
30
|
-
return this.fetcher.get(`/api/v2/accounts/${segment(addressOrUsername)}/relationship`);
|
|
30
|
+
return this.fetcher.get(`/api/v2/accounts/${(0, apiPaths_1.segment)(addressOrUsername)}/relationship`);
|
|
31
31
|
}
|
|
32
32
|
getAccountFollowing(addressOrUsername, query) {
|
|
33
|
-
return this.fetcher.get(`/api/v2/accounts/${segment(addressOrUsername)}/following`, query);
|
|
33
|
+
return this.fetcher.get(`/api/v2/accounts/${(0, apiPaths_1.segment)(addressOrUsername)}/following`, query);
|
|
34
34
|
}
|
|
35
35
|
getAccountFollowers(addressOrUsername, query) {
|
|
36
|
-
return this.fetcher.get(`/api/v2/accounts/${segment(addressOrUsername)}/followers`, query);
|
|
36
|
+
return this.fetcher.get(`/api/v2/accounts/${(0, apiPaths_1.segment)(addressOrUsername)}/followers`, query);
|
|
37
37
|
}
|
|
38
38
|
followAccount(addressOrUsername) {
|
|
39
|
-
return this.fetcher.request("POST", `/api/v2/accounts/${segment(addressOrUsername)}/follow`);
|
|
39
|
+
return this.fetcher.request("POST", `/api/v2/accounts/${(0, apiPaths_1.segment)(addressOrUsername)}/follow`);
|
|
40
40
|
}
|
|
41
41
|
unfollowAccount(addressOrUsername) {
|
|
42
|
-
return this.fetcher.request("DELETE", `/api/v2/accounts/${segment(addressOrUsername)}/follow`);
|
|
42
|
+
return this.fetcher.request("DELETE", `/api/v2/accounts/${(0, apiPaths_1.segment)(addressOrUsername)}/follow`);
|
|
43
43
|
}
|
|
44
44
|
watchAccount(addressOrUsername) {
|
|
45
|
-
return this.fetcher.request("POST", `/api/v2/accounts/${segment(addressOrUsername)}/watch`);
|
|
45
|
+
return this.fetcher.request("POST", `/api/v2/accounts/${(0, apiPaths_1.segment)(addressOrUsername)}/watch`);
|
|
46
46
|
}
|
|
47
47
|
unwatchAccount(addressOrUsername) {
|
|
48
|
-
return this.fetcher.request("DELETE", `/api/v2/accounts/${segment(addressOrUsername)}/watch`);
|
|
48
|
+
return this.fetcher.request("DELETE", `/api/v2/accounts/${(0, apiPaths_1.segment)(addressOrUsername)}/watch`);
|
|
49
49
|
}
|
|
50
50
|
listSavedTools(query) {
|
|
51
51
|
return this.fetcher.get("/api/v2/saved-tools", query);
|
|
@@ -70,22 +70,22 @@ class WalletAuthAPI {
|
|
|
70
70
|
* the signature, turning a signed cancel into an unsigned one. Sent verbatim.
|
|
71
71
|
*/
|
|
72
72
|
cancelOrder(chain, protocolAddress, orderHash, body) {
|
|
73
|
-
return this.fetcher.request("POST", `/api/v2/orders/chain/${segment(chain)}/protocol/${segment(protocolAddress)}/${segment(orderHash)}/cancel`, body, undefined, { snakeizeBody: false });
|
|
73
|
+
return this.fetcher.request("POST", `/api/v2/orders/chain/${(0, apiPaths_1.segment)(chain)}/protocol/${(0, apiPaths_1.segment)(protocolAddress)}/${(0, apiPaths_1.segment)(orderHash)}/cancel`, body, undefined, { snakeizeBody: false });
|
|
74
74
|
}
|
|
75
75
|
saveDropEdits(slug, body) {
|
|
76
|
-
return this.fetcher.request("POST", `/api/v2/drops/${segment(slug)}`, body);
|
|
76
|
+
return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}`, body);
|
|
77
77
|
}
|
|
78
78
|
savePrerevealDropItem(slug, body) {
|
|
79
|
-
return this.fetcher.request("POST", `/api/v2/drops/${segment(slug)}/prereveal-item`, body);
|
|
79
|
+
return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/prereveal-item`, body);
|
|
80
80
|
}
|
|
81
81
|
saveSelfMintDropItem(slug, body) {
|
|
82
|
-
return this.fetcher.request("POST", `/api/v2/drops/${segment(slug)}/items`, body);
|
|
82
|
+
return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/items`, body);
|
|
83
83
|
}
|
|
84
84
|
updateSelfMintDropItem(slug, tokenId, body) {
|
|
85
|
-
return this.fetcher.request("PUT", `/api/v2/drops/${segment(slug)}/items/${segment(tokenId)}`, body);
|
|
85
|
+
return this.fetcher.request("PUT", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/items/${(0, apiPaths_1.segment)(tokenId)}`, body);
|
|
86
86
|
}
|
|
87
87
|
updateDropItem(slug, tokenId, body) {
|
|
88
|
-
return this.fetcher.request("PATCH", `/api/v2/drops/${segment(slug)}/items/${segment(tokenId)}`, body);
|
|
88
|
+
return this.fetcher.request("PATCH", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/items/${(0, apiPaths_1.segment)(tokenId)}`, body);
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* `UploadContext.fields` is an opaque signed multipart field map that the
|
|
@@ -94,10 +94,10 @@ class WalletAuthAPI {
|
|
|
94
94
|
* `successActionStatus` and the form no longer matches the signed policy.
|
|
95
95
|
*/
|
|
96
96
|
createDropItemMediaUpload(slug, body) {
|
|
97
|
-
return this.fetcher.request("POST", `/api/v2/drops/${segment(slug)}/items/media`, body, undefined, { camelizeResponse: false });
|
|
97
|
+
return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/items/media`, body, undefined, { camelizeResponse: false });
|
|
98
98
|
}
|
|
99
99
|
saveDropItemMedia(slug, body) {
|
|
100
|
-
return this.fetcher.request("POST", `/api/v2/drops/${segment(slug)}/items/media/save`, body);
|
|
100
|
+
return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/items/media/save`, body);
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* `UploadContext.fields` is an opaque signed multipart field map that the
|
|
@@ -106,19 +106,19 @@ class WalletAuthAPI {
|
|
|
106
106
|
* `successActionStatus` and the form no longer matches the signed policy.
|
|
107
107
|
*/
|
|
108
108
|
createDropAllowlistUpload(slug) {
|
|
109
|
-
return this.fetcher.request("POST", `/api/v2/drops/${segment(slug)}/allowlist`, undefined, undefined, { camelizeResponse: false });
|
|
109
|
+
return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/allowlist`, undefined, undefined, { camelizeResponse: false });
|
|
110
110
|
}
|
|
111
111
|
validateDropAllowlist(slug, body) {
|
|
112
|
-
return this.fetcher.request("POST", `/api/v2/drops/${segment(slug)}/allowlist/validate`, body);
|
|
112
|
+
return this.fetcher.request("POST", `/api/v2/drops/${(0, apiPaths_1.segment)(slug)}/allowlist/validate`, body);
|
|
113
113
|
}
|
|
114
114
|
modifyCollection(slug, body) {
|
|
115
|
-
return this.fetcher.request("PATCH", `/api/v2/collections/${segment(slug)}`, body);
|
|
115
|
+
return this.fetcher.request("PATCH", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}`, body);
|
|
116
116
|
}
|
|
117
117
|
updateCollectionMetadata(slug, body) {
|
|
118
|
-
return this.fetcher.request("PATCH", `/api/v2/collections/${segment(slug)}/metadata`, body);
|
|
118
|
+
return this.fetcher.request("PATCH", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/metadata`, body);
|
|
119
119
|
}
|
|
120
120
|
setCollectionVisibility(slug, body) {
|
|
121
|
-
return this.fetcher.request("PATCH", `/api/v2/collections/${segment(slug)}/visibility`, body);
|
|
121
|
+
return this.fetcher.request("PATCH", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/visibility`, body);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* `UploadContext.fields` is an opaque signed multipart field map that the
|
|
@@ -128,7 +128,7 @@ class WalletAuthAPI {
|
|
|
128
128
|
*/
|
|
129
129
|
createCollectionImageUpload(slug, imageType, contentType) {
|
|
130
130
|
const query = new URLSearchParams({ content_type: contentType });
|
|
131
|
-
return this.fetcher.request("POST", `/api/v2/collections/${segment(slug)}/images/${segment(imageType)}?${query}`, undefined, undefined, { camelizeResponse: false });
|
|
131
|
+
return this.fetcher.request("POST", `/api/v2/collections/${(0, apiPaths_1.segment)(slug)}/images/${(0, apiPaths_1.segment)(imageType)}?${query}`, undefined, undefined, { camelizeResponse: false });
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* `UpdateProfileSettingsRequest` is camelCase on the wire (`displayName`,
|
|
@@ -170,10 +170,10 @@ class WalletAuthAPI {
|
|
|
170
170
|
return this.fetcher.request("PATCH", "/api/v2/profile/shelves", body);
|
|
171
171
|
}
|
|
172
172
|
updateProfileShelf(shelfId, body) {
|
|
173
|
-
return this.fetcher.request("PATCH", `/api/v2/profile/shelves/${segment(shelfId)}`, body);
|
|
173
|
+
return this.fetcher.request("PATCH", `/api/v2/profile/shelves/${(0, apiPaths_1.segment)(shelfId)}`, body);
|
|
174
174
|
}
|
|
175
175
|
deleteProfileShelf(shelfId) {
|
|
176
|
-
return this.fetcher.request("DELETE", `/api/v2/profile/shelves/${segment(shelfId)}`);
|
|
176
|
+
return this.fetcher.request("DELETE", `/api/v2/profile/shelves/${(0, apiPaths_1.segment)(shelfId)}`);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* `LinkWalletSiwxRequest` is camelCase on the wire. `chainArch` is required, so
|
|
@@ -186,13 +186,13 @@ class WalletAuthAPI {
|
|
|
186
186
|
return this.fetcher.request("POST", "/api/v2/accounts/wallets/siwx", body, undefined, { snakeizeBody: false });
|
|
187
187
|
}
|
|
188
188
|
unlinkWallet(wallet) {
|
|
189
|
-
return this.fetcher.request("DELETE", `/api/v2/accounts/wallets/${segment(wallet)}`);
|
|
189
|
+
return this.fetcher.request("DELETE", `/api/v2/accounts/wallets/${(0, apiPaths_1.segment)(wallet)}`);
|
|
190
190
|
}
|
|
191
191
|
makeWalletPrivate(wallet) {
|
|
192
|
-
return this.fetcher.request("PUT", `/api/v2/accounts/wallets/${segment(wallet)}/private`);
|
|
192
|
+
return this.fetcher.request("PUT", `/api/v2/accounts/wallets/${(0, apiPaths_1.segment)(wallet)}/private`);
|
|
193
193
|
}
|
|
194
194
|
makeWalletPublic(wallet) {
|
|
195
|
-
return this.fetcher.request("DELETE", `/api/v2/accounts/wallets/${segment(wallet)}/private`);
|
|
195
|
+
return this.fetcher.request("DELETE", `/api/v2/accounts/wallets/${(0, apiPaths_1.segment)(wallet)}/private`);
|
|
196
196
|
}
|
|
197
197
|
// ── Agent accounts ────────────────────────────────────────────────
|
|
198
198
|
//
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletAuth.js","sourceRoot":"","sources":["../../src/api/walletAuth.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"walletAuth.js","sourceRoot":"","sources":["../../src/api/walletAuth.ts"],"names":[],"mappings":";;;AAOA,yCAAoC;AAcpC,8DAA8D;AAC9D,MAAa,aAAa;IACJ;IAApB,YAAoB,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAElD,kBAAkB,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,iBAAiB,IAAA,kBAAO,EAAC,I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,CAAC,OAAO,CACzB,QAAQ,EACR,wCAAwC,MAAM,EAAE,CACjD,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,yBAAyB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,sCAAsC,CACvC,CAAA;IACH,CAAC;CACF;AA/hBD,sCA+hBC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -260,17 +260,25 @@ export type OpenSeaAccount = Camelize<AccountResponse>;
|
|
|
260
260
|
*/
|
|
261
261
|
export type SocialMediaAccount = Camelize<ApiSocialMediaAccount>;
|
|
262
262
|
/**
|
|
263
|
-
*
|
|
263
|
+
* Error thrown for any non-OK API response. `statusCode` is always set, so a caller can separate
|
|
264
|
+
* a retryable failure from a permanent one without parsing the message. That matters for clients
|
|
265
|
+
* that scrub remote error text before surfacing it, which have no other way to recover the status.
|
|
264
266
|
* @category API Models
|
|
265
267
|
*/
|
|
266
|
-
export interface
|
|
268
|
+
export interface OpenSeaApiError extends Error {
|
|
267
269
|
/** The HTTP status code of the error response */
|
|
268
270
|
statusCode?: number;
|
|
269
|
-
/** The number of seconds to wait before retrying the request */
|
|
271
|
+
/** The number of seconds to wait before retrying the request, on rate limit responses */
|
|
270
272
|
retryAfter?: number;
|
|
271
273
|
/** The response body from the API */
|
|
272
274
|
responseBody?: unknown;
|
|
273
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* @deprecated Use {@link OpenSeaApiError}. Retained as an alias: the shape is identical and
|
|
278
|
+
* `retryAfter` was always optional, so existing rate-limit handling is unaffected.
|
|
279
|
+
* @category API Models
|
|
280
|
+
*/
|
|
281
|
+
export type OpenSeaRateLimitError = OpenSeaApiError;
|
|
274
282
|
/**
|
|
275
283
|
* Options for controlling HTTP request behavior.
|
|
276
284
|
* @category API Models
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensea/sdk",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.0",
|
|
4
4
|
"description": "TypeScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs, tokens, and our marketplace data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "OpenSea Developers",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"types": "lib/index.d.ts",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@noble/hashes": "^2.0.1",
|
|
50
|
-
"@opensea/api-types": "^0.9.
|
|
50
|
+
"@opensea/api-types": "^0.9.2",
|
|
51
51
|
"@opensea/seaport-js": "^4.2.0",
|
|
52
52
|
"ethers": "^6.16.0"
|
|
53
53
|
},
|
package/src/api/accounts.ts
CHANGED
|
@@ -88,7 +88,7 @@ export class AccountsAPI {
|
|
|
88
88
|
addressOrUsername: string,
|
|
89
89
|
): Promise<AgentProfileRelationshipsResponse> {
|
|
90
90
|
return this.fetcher.get<AgentProfileRelationshipsResponse>(
|
|
91
|
-
getAgentProfileRelationshipsPath(
|
|
91
|
+
getAgentProfileRelationshipsPath(addressOrUsername),
|
|
92
92
|
)
|
|
93
93
|
}
|
|
94
94
|
|
package/src/api/api.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Chain,
|
|
5
5
|
type OpenSeaAccount,
|
|
6
6
|
type OpenSeaAPIConfig,
|
|
7
|
+
type OpenSeaApiError,
|
|
7
8
|
type OpenSeaCollection,
|
|
8
9
|
type OpenSeaCollectionStats,
|
|
9
10
|
type OpenSeaPaymentToken,
|
|
@@ -1634,10 +1635,16 @@ export class OpenSeaAPI {
|
|
|
1634
1635
|
: typeof errors === "string"
|
|
1635
1636
|
? errors
|
|
1636
1637
|
: JSON.stringify(errors)
|
|
1637
|
-
throw
|
|
1638
|
+
throw OpenSeaAPI._createApiError(
|
|
1639
|
+
response,
|
|
1640
|
+
`Server Error: ${errorMessage}`,
|
|
1641
|
+
responseBody,
|
|
1642
|
+
)
|
|
1638
1643
|
}
|
|
1639
|
-
throw
|
|
1644
|
+
throw OpenSeaAPI._createApiError(
|
|
1645
|
+
response,
|
|
1640
1646
|
`Server Error (${response.status}): ${response.statusText}`,
|
|
1647
|
+
responseBody,
|
|
1641
1648
|
)
|
|
1642
1649
|
}
|
|
1643
1650
|
if (
|
|
@@ -1685,7 +1692,8 @@ export class OpenSeaAPI {
|
|
|
1685
1692
|
body: "{}",
|
|
1686
1693
|
})
|
|
1687
1694
|
if (!response.ok) {
|
|
1688
|
-
throw
|
|
1695
|
+
throw OpenSeaAPI._createApiError(
|
|
1696
|
+
response,
|
|
1689
1697
|
`Server Error (${response.status}): ${response.statusText}`,
|
|
1690
1698
|
)
|
|
1691
1699
|
}
|
|
@@ -1744,6 +1752,28 @@ export class OpenSeaAPI {
|
|
|
1744
1752
|
* @param response The HTTP response object from the API
|
|
1745
1753
|
* @returns An enhanced Error object with statusCode, retryAfter and responseBody properties
|
|
1746
1754
|
*/
|
|
1755
|
+
/**
|
|
1756
|
+
* Builds an error carrying the HTTP status. Every non-OK response goes through here or through
|
|
1757
|
+
* {@link _createRateLimitError}, so `statusCode` is present on every API error rather than only
|
|
1758
|
+
* on rate limits. A caller that scrubs remote error text still has the status to retry on.
|
|
1759
|
+
* @param response The HTTP response object from the API
|
|
1760
|
+
* @param message The error message
|
|
1761
|
+
* @param responseBody The already-parsed body, when the caller read one
|
|
1762
|
+
* @returns An Error with `statusCode` and, when available, `responseBody`
|
|
1763
|
+
*/
|
|
1764
|
+
private static _createApiError(
|
|
1765
|
+
response: Response,
|
|
1766
|
+
message: string,
|
|
1767
|
+
responseBody?: unknown,
|
|
1768
|
+
): OpenSeaApiError {
|
|
1769
|
+
const error = new Error(message) as OpenSeaApiError
|
|
1770
|
+
error.statusCode = response.status
|
|
1771
|
+
if (responseBody !== undefined) {
|
|
1772
|
+
error.responseBody = responseBody
|
|
1773
|
+
}
|
|
1774
|
+
return error
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1747
1777
|
private async _createRateLimitError(
|
|
1748
1778
|
response: Response,
|
|
1749
1779
|
): Promise<OpenSeaRateLimitError> {
|