@opensea/sdk 13.0.6 → 14.0.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 +127 -131
- package/lib/api/api.d.ts +7 -711
- package/lib/api/api.js +6 -870
- package/lib/api/api.js.map +1 -1
- package/lib/api/collections.d.ts +3 -3
- package/lib/api/collections.js +5 -4
- package/lib/api/collections.js.map +1 -1
- package/lib/api/drops.d.ts +1 -1
- package/lib/api/drops.js +1 -1
- package/lib/api/events.js +1 -1
- package/lib/api/events.js.map +1 -1
- package/lib/api/fetcher.d.ts +1 -1
- package/lib/api/listings.d.ts +2 -3
- package/lib/api/listings.js +2 -3
- package/lib/api/listings.js.map +1 -1
- package/lib/api/nfts.d.ts +1 -1
- package/lib/api/nfts.js +1 -1
- package/lib/api/orders.d.ts +1 -1
- package/lib/api/orders.js +1 -1
- package/lib/api/tokens.js +2 -23
- package/lib/api/tokens.js.map +1 -1
- package/lib/api/types.d.ts +11 -20
- package/lib/api/walletAuth.d.ts +2 -2
- package/lib/api/walletAuth.js +2 -2
- package/lib/auth/index.d.ts +2 -2
- package/lib/auth/index.js +1 -3
- package/lib/auth/index.js.map +1 -1
- package/lib/auth/oauth.d.ts +4 -4
- package/lib/auth/oauth.js +4 -4
- package/lib/auth/siwx.d.ts +1 -8
- package/lib/auth/siwx.js +1 -1
- package/lib/auth/siwx.js.map +1 -1
- package/lib/auth/types.d.ts +0 -12
- package/lib/provider/ethers-adapter.d.ts +1 -1
- package/lib/provider/ethers-adapter.js +1 -1
- package/lib/provider/seaport-bridge.js +1 -1
- package/lib/provider/seaport-bridge.js.map +1 -1
- package/lib/provider/viem-adapter.d.ts +1 -1
- package/lib/provider/viem-adapter.js +1 -1
- package/lib/sdk/assets.d.ts +2 -2
- package/lib/sdk/assets.js +2 -2
- package/lib/sdk/base.js +2 -2
- package/lib/sdk/base.js.map +1 -1
- package/lib/sdk/cancellation.d.ts +3 -3
- package/lib/sdk/cancellation.js +6 -6
- package/lib/sdk/cancellation.js.map +1 -1
- package/lib/sdk/fulfillment.d.ts +2 -3
- package/lib/sdk/fulfillment.js +3 -4
- package/lib/sdk/fulfillment.js.map +1 -1
- package/lib/sdk/orders.d.ts +6 -6
- package/lib/sdk/orders.js +21 -21
- package/lib/sdk/orders.js.map +1 -1
- package/lib/stream/client.d.ts +2 -14
- package/lib/stream/client.js +3 -19
- package/lib/stream/client.js.map +1 -1
- package/lib/stream/types.d.ts +3 -26
- package/lib/stream/types.js +0 -8
- package/lib/stream/types.js.map +1 -1
- package/lib/types.d.ts +3 -9
- package/lib/types.js +1 -1
- package/lib/utils/address.d.ts +2 -2
- package/lib/utils/address.js +2 -2
- package/lib/utils/case.d.ts +3 -3
- package/lib/utils/case.js +1 -1
- package/lib/utils/fees.js +1 -1
- package/lib/utils/fees.js.map +1 -1
- package/lib/utils/rateLimit.d.ts +0 -11
- package/lib/utils/rateLimit.js +1 -29
- package/lib/utils/rateLimit.js.map +1 -1
- package/lib/viem.js +1 -1
- package/lib/viem.js.map +1 -1
- package/package.json +2 -2
- package/src/api/api.ts +12 -1447
- package/src/api/collections.ts +7 -4
- package/src/api/drops.ts +1 -1
- package/src/api/events.ts +1 -1
- package/src/api/fetcher.ts +1 -1
- package/src/api/listings.ts +2 -3
- package/src/api/nfts.ts +1 -1
- package/src/api/orders.ts +1 -1
- package/src/api/tokens.ts +2 -24
- package/src/api/types.ts +15 -23
- package/src/api/walletAuth.ts +2 -2
- package/src/auth/index.ts +4 -7
- package/src/auth/oauth.ts +4 -4
- package/src/auth/siwx.ts +1 -8
- package/src/auth/types.ts +0 -13
- package/src/provider/ethers-adapter.ts +1 -1
- package/src/provider/seaport-bridge.ts +1 -1
- package/src/provider/viem-adapter.ts +1 -1
- package/src/sdk/assets.ts +2 -2
- package/src/sdk/base.ts +3 -2
- package/src/sdk/cancellation.ts +6 -6
- package/src/sdk/fulfillment.ts +14 -14
- package/src/sdk/orders.ts +30 -21
- package/src/stream/client.ts +2 -26
- package/src/stream/types.ts +3 -29
- package/src/types.ts +4 -11
- package/src/utils/address.ts +2 -2
- package/src/utils/case.ts +3 -3
- package/src/utils/fees.ts +1 -1
- package/src/utils/rateLimit.ts +3 -49
- package/src/viem.ts +1 -1
- package/src/abi/ERC1155.json +0 -314
- package/src/abi/ERC20.json +0 -222
- package/src/abi/ERC721.json +0 -333
- package/src/abi/Multicall3.json +0 -50
- package/src/abi/TransferHelper.json +0 -53
package/src/api/collections.ts
CHANGED
|
@@ -166,8 +166,8 @@ export class CollectionsAPI {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
* Fetch aggregated
|
|
170
|
-
*
|
|
169
|
+
* Fetch aggregated offers for a collection: top offers grouped by price
|
|
170
|
+
* level, for displaying offer-book depth.
|
|
171
171
|
*/
|
|
172
172
|
async getCollectionOfferAggregates(
|
|
173
173
|
slug: string,
|
|
@@ -235,14 +235,17 @@ export class CollectionsAPI {
|
|
|
235
235
|
/**
|
|
236
236
|
* Fetch collections ranked by how many accounts wear one of their verified NFTs as a profile
|
|
237
237
|
* picture. Pass `args.chains` to count wearers on those chains only, or omit it to rank across
|
|
238
|
-
* every chain.
|
|
238
|
+
* every chain.
|
|
239
239
|
*/
|
|
240
240
|
async getTopPfpCollections(
|
|
241
241
|
args: GetTopPfpCollectionsArgs,
|
|
242
242
|
): Promise<TopPfpCollectionsResponse> {
|
|
243
|
+
const { chain: _chain, ...query } = args as GetTopPfpCollectionsArgs & {
|
|
244
|
+
chain?: unknown
|
|
245
|
+
}
|
|
243
246
|
return this.fetcher.get<TopPfpCollectionsResponse>(
|
|
244
247
|
getTopPfpCollectionsPath(),
|
|
245
|
-
|
|
248
|
+
query,
|
|
246
249
|
)
|
|
247
250
|
}
|
|
248
251
|
}
|
package/src/api/drops.ts
CHANGED
|
@@ -77,7 +77,7 @@ export class DropsAPI {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Builds a deploy-contract transaction for a new drop. Returns
|
|
80
|
-
* ready-to-sign transaction data
|
|
80
|
+
* ready-to-sign transaction data. The caller submits it onchain, then polls
|
|
81
81
|
* `getDeployReceipt` until the contract address is available.
|
|
82
82
|
*/
|
|
83
83
|
async deployDropContract(
|
package/src/api/events.ts
CHANGED
|
@@ -91,7 +91,7 @@ export class EventsAPI {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// Returns `undefined` (not `{}`) when no args were passed so the fetcher
|
|
94
|
-
// receives the same shape as before `traits` existed
|
|
94
|
+
// receives the same shape as before `traits` existed, keeping the
|
|
95
95
|
// pre-feature query string for callers that don't set any args.
|
|
96
96
|
function encodeArgs(args?: GetEventsByCollectionArgs) {
|
|
97
97
|
if (!args) return args
|
package/src/api/fetcher.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type HttpMethod = "POST" | "PUT" | "PATCH" | "DELETE"
|
|
|
31
31
|
* Fetcher context interface for making HTTP requests to the OpenSea API.
|
|
32
32
|
* This interface abstracts the HTTP methods used by specialized API clients.
|
|
33
33
|
*
|
|
34
|
-
* Responses are camelized at this boundary
|
|
34
|
+
* Responses are camelized at this boundary: pass the API's snake_case shape
|
|
35
35
|
* (e.g. an api-types response type) as `T` and the return is the camelCase
|
|
36
36
|
* view. See `utils/case.ts`. Endpoints whose response keys are data rather
|
|
37
37
|
* than field names opt out with {@link RequestOptions.camelizeResponse}, and
|
package/src/api/listings.ts
CHANGED
|
@@ -134,9 +134,8 @@ export class ListingsAPI {
|
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* Get an ordered list of blockchain actions required to create one or more
|
|
137
|
-
* listings
|
|
138
|
-
* to sign.
|
|
139
|
-
* approval graph.
|
|
137
|
+
* listings: token approvals, then a final action with the Seaport order
|
|
138
|
+
* to sign. For clients that want the server to compute the approval graph.
|
|
140
139
|
*/
|
|
141
140
|
async createListingActions(
|
|
142
141
|
request: CreateListingActionsRequest,
|
package/src/api/nfts.ts
CHANGED
package/src/api/orders.ts
CHANGED
|
@@ -96,7 +96,7 @@ export class OrdersAPI {
|
|
|
96
96
|
* The body uses mixed casing per the OpenSea OpenAPI spec: the outer
|
|
97
97
|
* envelope (`protocol_address`) is snake_case, but the inner Seaport
|
|
98
98
|
* struct (`parameters.startTime`, `parameters.orderType`, `offer[].itemType`,
|
|
99
|
-
* etc.) mirrors the
|
|
99
|
+
* etc.) mirrors the onchain struct names and must stay camelCase on the
|
|
100
100
|
* wire. We pass `snakeizeBody: false` and emit the body in exact wire shape.
|
|
101
101
|
*/
|
|
102
102
|
async postListing(
|
package/src/api/tokens.ts
CHANGED
|
@@ -46,28 +46,6 @@ import type {
|
|
|
46
46
|
TokenTimeSeriesArgs,
|
|
47
47
|
} from "./types"
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Forwards a deprecated `next` as `cursor`.
|
|
51
|
-
*
|
|
52
|
-
* These endpoints name the request parameter `cursor` and the response field `next`, so callers
|
|
53
|
-
* who paged by feeding `next` straight back got the first page every time, with no error to notice.
|
|
54
|
-
* `cursor` wins when both are set.
|
|
55
|
-
*/
|
|
56
|
-
function withCursor(args?: GetTokensArgs): GetTokensArgs | undefined {
|
|
57
|
-
// Presence, not truthiness: `next: ""` is still the deprecated key, and a falsy check would
|
|
58
|
-
// leave it on the wire as an undocumented parameter, which is the failure this exists to fix.
|
|
59
|
-
if (args === undefined || !("next" in args)) {
|
|
60
|
-
return args
|
|
61
|
-
}
|
|
62
|
-
const { next, ...rest } = args
|
|
63
|
-
// An empty or absent `next` carries no cursor, so it is dropped rather than forwarded as an
|
|
64
|
-
// empty `cursor`, which would put a meaningless parameter on the wire in its place.
|
|
65
|
-
if (rest.cursor !== undefined || !next) {
|
|
66
|
-
return rest
|
|
67
|
-
}
|
|
68
|
-
return { ...rest, cursor: next }
|
|
69
|
-
}
|
|
70
|
-
|
|
71
49
|
/**
|
|
72
50
|
* Token-related API operations
|
|
73
51
|
*/
|
|
@@ -82,7 +60,7 @@ export class TokensAPI {
|
|
|
82
60
|
): Promise<GetTrendingTokensResponse> {
|
|
83
61
|
const response = await this.fetcher.get<GetTrendingTokensResponse>(
|
|
84
62
|
getTrendingTokensPath(),
|
|
85
|
-
|
|
63
|
+
args,
|
|
86
64
|
)
|
|
87
65
|
return response
|
|
88
66
|
}
|
|
@@ -93,7 +71,7 @@ export class TokensAPI {
|
|
|
93
71
|
async getTopTokens(args?: GetTokensArgs): Promise<GetTopTokensResponse> {
|
|
94
72
|
const response = await this.fetcher.get<GetTopTokensResponse>(
|
|
95
73
|
getTopTokensPath(),
|
|
96
|
-
|
|
74
|
+
args,
|
|
97
75
|
)
|
|
98
76
|
return response
|
|
99
77
|
}
|
package/src/api/types.ts
CHANGED
|
@@ -90,7 +90,7 @@ export type Price = Camelize<ApiPrice>
|
|
|
90
90
|
* specified trait.
|
|
91
91
|
*
|
|
92
92
|
* Distinct from {@link TraitCriteria} (`{type, value}`) which is the offer-
|
|
93
|
-
* creation shape
|
|
93
|
+
* creation shape. The wire format differs across endpoints.
|
|
94
94
|
*
|
|
95
95
|
* @category API Query Args
|
|
96
96
|
*/
|
|
@@ -137,7 +137,7 @@ export type BuildOfferResponse = Camelize<ApiBuildOfferResponse>
|
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Criteria returned by the build offer endpoint. Subset of the wire-format
|
|
140
|
-
* criteria
|
|
140
|
+
* criteria: only collection and trait fields.
|
|
141
141
|
* @category API Response Types
|
|
142
142
|
*/
|
|
143
143
|
export type BuildOfferCriteria = {
|
|
@@ -221,7 +221,7 @@ export enum OrderStatus {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
* Base Order shape
|
|
224
|
+
* Base Order shape, camelized from `@opensea/api-types`, with `protocolData`
|
|
225
225
|
* narrowed to the seaport-js `OrderWithCounter` type (a.k.a. {@link ProtocolData})
|
|
226
226
|
* since SDK callers pass this directly to Seaport.
|
|
227
227
|
* @category API Models
|
|
@@ -242,7 +242,7 @@ export type Offer = Camelize<Omit<ApiOffer, "protocol_data" | "status">> & {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
|
-
* Collection
|
|
245
|
+
* Collection offer: an {@link Offer} with `criteria` always present.
|
|
246
246
|
* @category API Models
|
|
247
247
|
*/
|
|
248
248
|
export type CollectionOffer = Offer & {
|
|
@@ -432,7 +432,7 @@ export type NFT = Camelize<NftDetailed>
|
|
|
432
432
|
|
|
433
433
|
/**
|
|
434
434
|
* Trait type returned by OpenSea API. Sourced from api-types `Trait`.
|
|
435
|
-
* For numeric traits, `value` arrives as a string
|
|
435
|
+
* For numeric traits, `value` arrives as a string; callers parse as needed.
|
|
436
436
|
* @category API Models
|
|
437
437
|
*/
|
|
438
438
|
export type Trait = Camelize<ApiTrait>
|
|
@@ -848,19 +848,10 @@ export interface GetTokensArgs {
|
|
|
848
848
|
/** Limit the number of results */
|
|
849
849
|
limit?: number
|
|
850
850
|
/**
|
|
851
|
-
* Cursor for pagination, taken from the `next` field of the previous response.
|
|
852
|
-
*
|
|
853
|
-
* The request parameter is `cursor` while the response field is `next`, which is why
|
|
854
|
-
* {@link GetTokensArgs.next} looked correct and silently paginated nowhere.
|
|
851
|
+
* Cursor for pagination, taken from the `next` field of the previous response. The request
|
|
852
|
+
* parameter is `cursor` even though the response field is `next`.
|
|
855
853
|
*/
|
|
856
854
|
cursor?: string
|
|
857
|
-
/**
|
|
858
|
-
* @deprecated Use {@link GetTokensArgs.cursor}. These endpoints never read a `next` query
|
|
859
|
-
* parameter, so passing this alone returned the first page every time. It is now forwarded as
|
|
860
|
-
* `cursor` so existing callers start paginating instead of looping, and `cursor` wins if both
|
|
861
|
-
* are set.
|
|
862
|
-
*/
|
|
863
|
-
next?: string
|
|
864
855
|
/** Filter to these chains */
|
|
865
856
|
chains?: ChainIdentifier[]
|
|
866
857
|
/**
|
|
@@ -1288,7 +1279,7 @@ import type {
|
|
|
1288
1279
|
WalletPnlResponse as ApiWalletPnlResponse,
|
|
1289
1280
|
} from "@opensea/api-types"
|
|
1290
1281
|
|
|
1291
|
-
// Request types
|
|
1282
|
+
// Request types, camelized for consumers. The fetcher snakeizes the body on
|
|
1292
1283
|
// the way out (see `api.ts`), so passing camelCase here hits the API correctly.
|
|
1293
1284
|
export type BatchCollectionsRequest = Camelize<ApiBatchCollectionsRequest>
|
|
1294
1285
|
export type BatchNftsRequest = Camelize<ApiBatchNftsRequest>
|
|
@@ -1310,7 +1301,7 @@ export type FulfillerObject = Camelize<ApiFulfillerObject>
|
|
|
1310
1301
|
export type ListingObject = Camelize<ApiListingObject>
|
|
1311
1302
|
export type TransferRequest = Camelize<ApiTransferRequest>
|
|
1312
1303
|
|
|
1313
|
-
// Response types
|
|
1304
|
+
// Response types, camelized for consumers.
|
|
1314
1305
|
export type CollectionBatchResponse = Camelize<ApiCollectionBatchResponse>
|
|
1315
1306
|
export type CollectionHoldersPaginatedResponse =
|
|
1316
1307
|
Camelize<ApiCollectionHoldersPaginatedResponse>
|
|
@@ -1360,11 +1351,12 @@ export type CollectionPfpProfilesResponse =
|
|
|
1360
1351
|
|
|
1361
1352
|
/**
|
|
1362
1353
|
* Query args for `GET /api/v2/pfp/top-collections`, derived from the spec. `limit` (1-50) is
|
|
1363
|
-
* required.
|
|
1354
|
+
* required. The spec's deprecated single `chain` parameter is left out: use `chains`.
|
|
1364
1355
|
* @category API Query Args
|
|
1365
1356
|
*/
|
|
1366
|
-
export type GetTopPfpCollectionsArgs =
|
|
1367
|
-
OperationQueryParams<"get_top_pfp_collections"
|
|
1357
|
+
export type GetTopPfpCollectionsArgs = Omit<
|
|
1358
|
+
Camelize<OperationQueryParams<"get_top_pfp_collections">>,
|
|
1359
|
+
"chain"
|
|
1368
1360
|
>
|
|
1369
1361
|
|
|
1370
1362
|
/**
|
|
@@ -1418,7 +1410,7 @@ export interface PaginatedAnalyticsArgs {
|
|
|
1418
1410
|
}
|
|
1419
1411
|
|
|
1420
1412
|
/**
|
|
1421
|
-
* Query args for the collection holders endpoint
|
|
1413
|
+
* Query args for the collection holders endpoint. Adds an optional `owned_by`
|
|
1422
1414
|
* filter on top of {@link PaginatedAnalyticsArgs}.
|
|
1423
1415
|
* @category API Query Args
|
|
1424
1416
|
*/
|
|
@@ -1719,7 +1711,7 @@ export interface ProfileCollectionsArgs {
|
|
|
1719
1711
|
}
|
|
1720
1712
|
|
|
1721
1713
|
/**
|
|
1722
|
-
* Response from the account favorites endpoint
|
|
1714
|
+
* Response from the account favorites endpoint (favorited NFTs).
|
|
1723
1715
|
* @category API Response Types
|
|
1724
1716
|
*/
|
|
1725
1717
|
export type ProfileFavoritesResponse = Camelize<NftListResponse>
|
package/src/api/walletAuth.ts
CHANGED
|
@@ -178,7 +178,7 @@ export class WalletAuthAPI {
|
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* `CancelRequest` carries `offererSignature`, which is camelCase on the wire.
|
|
181
|
-
* It is optional, so snake-casing it didn't fail the request
|
|
181
|
+
* It is optional, so snake-casing it didn't fail the request; it silently dropped
|
|
182
182
|
* the signature, turning a signed cancel into an unsigned one. Sent verbatim.
|
|
183
183
|
*/
|
|
184
184
|
cancelOrder(
|
|
@@ -494,7 +494,7 @@ export class WalletAuthAPI {
|
|
|
494
494
|
* `UpdateProfileSettingsRequest` is camelCase on the wire (`displayName`,
|
|
495
495
|
* `externalUrl`, `profileImageToken`, `bannerImageToken`), so the body is sent
|
|
496
496
|
* verbatim. Snake-casing it silently drops every field except `bio`, which
|
|
497
|
-
* survives only because it is a single word
|
|
497
|
+
* survives only because it is a single word. The request still returns 200,
|
|
498
498
|
* so the loss is invisible to the caller.
|
|
499
499
|
*/
|
|
500
500
|
updateProfileSettings(body: WalletAuthRequest<"update_profile_settings">) {
|
package/src/auth/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ import type {
|
|
|
5
5
|
AuthNonceResponse,
|
|
6
6
|
AuthSigner,
|
|
7
7
|
AuthToken,
|
|
8
|
-
AuthTokenResponse,
|
|
9
8
|
OpenSeaAuthConfig,
|
|
10
9
|
} from "./types"
|
|
11
10
|
|
|
@@ -30,7 +29,6 @@ export type {
|
|
|
30
29
|
AuthNonceResponse,
|
|
31
30
|
AuthSigner,
|
|
32
31
|
AuthToken,
|
|
33
|
-
AuthTokenResponse,
|
|
34
32
|
OpenSeaAuthConfig,
|
|
35
33
|
}
|
|
36
34
|
|
|
@@ -85,11 +83,10 @@ export class OpenSeaAuth {
|
|
|
85
83
|
private sessionCookies: string | undefined
|
|
86
84
|
|
|
87
85
|
constructor(config: OpenSeaAuthConfig = {}) {
|
|
88
|
-
this.apiBaseUrl = (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
).replace(/\/$/, "")
|
|
86
|
+
this.apiBaseUrl = (config.apiBaseUrl ?? DEFAULT_API_BASE_URL).replace(
|
|
87
|
+
/\/$/,
|
|
88
|
+
"",
|
|
89
|
+
)
|
|
93
90
|
// Stored as given, including undefined: fetchWith falls back to globalThis.fetch at call
|
|
94
91
|
// time, so a caller who swaps globalThis.fetch after construction still takes effect.
|
|
95
92
|
this.fetchImpl = config.fetch
|
package/src/auth/oauth.ts
CHANGED
|
@@ -20,7 +20,7 @@ const DEFAULT_TIMEOUT_MS = 30_000
|
|
|
20
20
|
* OAuth 2.1 authorization-code + PKCE helper for OpenSea (OS2-33722).
|
|
21
21
|
*
|
|
22
22
|
* Runs the standard flow against the OpenSea authorization server (Zitadel at
|
|
23
|
-
* `auth.opensea.io`)
|
|
23
|
+
* `auth.opensea.io`) as a public client: no client secret, no private key,
|
|
24
24
|
* no SIWE message signing. This is the same flow spec-compliant MCP clients
|
|
25
25
|
* discover via the MCP server's Protected Resource Metadata, exposed here for
|
|
26
26
|
* programmatic consumers (the CLI's keyless `opensea login` is built on it).
|
|
@@ -187,7 +187,7 @@ export class OpenSeaOAuth {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
|
-
* Start a device authorization flow (RFC 8628)
|
|
190
|
+
* Start a device authorization flow (RFC 8628), for headless environments
|
|
191
191
|
* where a browser redirect is not possible.
|
|
192
192
|
*/
|
|
193
193
|
async requestDeviceAuthorization(options?: {
|
|
@@ -529,7 +529,7 @@ export function extractLinkedWallets(accessToken: string): string[] {
|
|
|
529
529
|
* OpenSea issues both JWT and opaque access tokens, so "not a JWT" is an
|
|
530
530
|
* expected input here rather than an error. Prefer this over wrapping
|
|
531
531
|
* {@link decodeJwtPayload} in a try/catch, and use it to tell "no claim to
|
|
532
|
-
* read" apart from "claim read, and it was empty"
|
|
532
|
+
* read" apart from "claim read, and it was empty": {@link extractLinkedWallets}
|
|
533
533
|
* and {@link extractOpenSeaScopes} both return `[]` for either case.
|
|
534
534
|
*/
|
|
535
535
|
export function tryDecodeJwtPayload(
|
|
@@ -544,7 +544,7 @@ export function tryDecodeJwtPayload(
|
|
|
544
544
|
|
|
545
545
|
/**
|
|
546
546
|
* Decode a JWT payload without verifying the signature. Intended for reading
|
|
547
|
-
* claims
|
|
547
|
+
* claims from a token the authorization server just issued to us over TLS,
|
|
548
548
|
* NOT for validating inbound tokens.
|
|
549
549
|
*
|
|
550
550
|
* Throws when `token` is not a JWT. {@link tryDecodeJwtPayload} is the
|
package/src/auth/siwx.ts
CHANGED
|
@@ -50,13 +50,6 @@ export interface LinkWalletWithSiwxOptions
|
|
|
50
50
|
CreateSiwxMessageOptions,
|
|
51
51
|
"address" | "chainId" | "nonce" | "statement"
|
|
52
52
|
> {
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated Ignored. The statement is issued by the API together with the wallet-link nonce
|
|
55
|
-
* and signed verbatim, so a caller-supplied statement can no longer be used.
|
|
56
|
-
*/
|
|
57
|
-
statement?: string
|
|
58
|
-
/** @deprecated Nonces now come from apiBaseUrl. */
|
|
59
|
-
authBaseUrl?: string
|
|
60
53
|
apiBaseUrl?: string
|
|
61
54
|
apiKey?: string
|
|
62
55
|
authToken: string
|
|
@@ -349,7 +342,7 @@ export async function requestWalletLinkNonce(
|
|
|
349
342
|
* Fetch a wallet-link nonce, sign the SIWX message, and submit the wallet-link request.
|
|
350
343
|
*
|
|
351
344
|
* The message carries the nonce and statement issued by
|
|
352
|
-
* {@link requestWalletLinkNonce}
|
|
345
|
+
* {@link requestWalletLinkNonce}.
|
|
353
346
|
*/
|
|
354
347
|
export async function linkWalletWithSiwx(
|
|
355
348
|
signer: AuthSigner,
|
package/src/auth/types.ts
CHANGED
|
@@ -28,8 +28,6 @@ export interface AuthenticateOptions {
|
|
|
28
28
|
export interface OpenSeaAuthConfig {
|
|
29
29
|
/** OpenSea API base URL. Defaults to `https://api.opensea.io`. */
|
|
30
30
|
apiBaseUrl?: string
|
|
31
|
-
/** @deprecated Use `apiBaseUrl`. */
|
|
32
|
-
authBaseUrl?: string
|
|
33
31
|
/**
|
|
34
32
|
* Transport used for every request this instance makes, defaulting to the global `fetch`.
|
|
35
33
|
* Same seam as {@link OpenSeaAPIConfig.fetch}, so one wrapper can cover the auth flow and the
|
|
@@ -51,17 +49,6 @@ export interface AuthSigner {
|
|
|
51
49
|
signMessage(message: string): Promise<string>
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
/**
|
|
55
|
-
* Legacy auth response shape retained for source compatibility.
|
|
56
|
-
* @deprecated The public wallet-auth API now returns scoped-token and exchange responses.
|
|
57
|
-
*/
|
|
58
|
-
export interface AuthTokenResponse {
|
|
59
|
-
access_token: string
|
|
60
|
-
refresh_token: string
|
|
61
|
-
expires_in: number
|
|
62
|
-
scopes: string[]
|
|
63
|
-
}
|
|
64
|
-
|
|
65
52
|
/**
|
|
66
53
|
* Response from the SIWE nonce endpoint.
|
|
67
54
|
*/
|
|
@@ -24,7 +24,7 @@ export function createSeaportBridge(
|
|
|
24
24
|
// We need the chain's RPC URL to create an ethers provider for seaport-js.
|
|
25
25
|
// Prefer an explicit rpcUrl if provided (needed for non-HTTP transports).
|
|
26
26
|
// Otherwise, extract it from the viem transport's internal properties.
|
|
27
|
-
//
|
|
27
|
+
// transport.url / transport.value.url are viem internals and may
|
|
28
28
|
// change across viem versions.
|
|
29
29
|
const transport = (publicClient as any).transport
|
|
30
30
|
const detectedUrl = transport?.url ?? transport?.value?.url
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Viem adapter
|
|
2
|
+
* Viem adapter: wraps a viem WalletClient/PublicClient in the SDK's abstract interfaces.
|
|
3
3
|
*
|
|
4
4
|
* viem is an optional peerDependency and a devDependency (for type-checking).
|
|
5
5
|
* This module is only executed at runtime by code importing from "@opensea/sdk/viem",
|
package/src/sdk/assets.ts
CHANGED
|
@@ -217,8 +217,8 @@ export class AssetsManager {
|
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
219
|
* Bulk transfer multiple assets using OpenSea's TransferHelper contract.
|
|
220
|
-
*
|
|
221
|
-
*
|
|
220
|
+
* Uses less gas than calling transfer() for each asset.
|
|
221
|
+
* All assets must be approved for transfer to the OpenSea conduit first.
|
|
222
222
|
* @param options
|
|
223
223
|
* @param options.assets Array of assets to transfer. Each asset must have tokenStandard set.
|
|
224
224
|
* @param options.fromAddress The address to transfer from
|
package/src/sdk/base.ts
CHANGED
|
@@ -389,7 +389,7 @@ export class BaseOpenSeaSDK {
|
|
|
389
389
|
paymentTokenAddress: string
|
|
390
390
|
recipientAddress?: string
|
|
391
391
|
}) {
|
|
392
|
-
return this.api.getCrossChainFulfillmentData({
|
|
392
|
+
return this.api.listings.getCrossChainFulfillmentData({
|
|
393
393
|
listings: options.listings.map(l => ({
|
|
394
394
|
hash: l.hash,
|
|
395
395
|
chain: l.chain,
|
|
@@ -606,7 +606,8 @@ export class BaseOpenSeaSDK {
|
|
|
606
606
|
if (tokenAddress in this._cachedPaymentTokenDecimals) {
|
|
607
607
|
decimals = this._cachedPaymentTokenDecimals[tokenAddress]
|
|
608
608
|
} else {
|
|
609
|
-
const paymentToken =
|
|
609
|
+
const paymentToken =
|
|
610
|
+
await this.api.accounts.getPaymentToken(tokenAddress)
|
|
610
611
|
this._cachedPaymentTokenDecimals[tokenAddress] = paymentToken.decimals
|
|
611
612
|
decimals = paymentToken.decimals
|
|
612
613
|
}
|
package/src/sdk/cancellation.ts
CHANGED
|
@@ -27,7 +27,7 @@ export class CancellationManager {
|
|
|
27
27
|
* @param options.orderHash Optional order hash to cancel. Must provide protocolAddress if using this.
|
|
28
28
|
* @param options.accountAddress The account address that will be cancelling the order.
|
|
29
29
|
* @param options.protocolAddress Required when using orderHash. The Seaport protocol address for the order.
|
|
30
|
-
* @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata
|
|
30
|
+
* @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata, used for onchain order attribution in analytics.
|
|
31
31
|
* @returns Transaction hash of the cancellation.
|
|
32
32
|
*
|
|
33
33
|
* @throws Error if neither order nor orderHash is provided.
|
|
@@ -72,7 +72,7 @@ export class CancellationManager {
|
|
|
72
72
|
} else if (orderHash) {
|
|
73
73
|
// Fetch order from API using order hash
|
|
74
74
|
requireValidProtocol(protocolAddress)
|
|
75
|
-
const fetchedOrder = await this.context.api.getOrderByHash(
|
|
75
|
+
const fetchedOrder = await this.context.api.orders.getOrderByHash(
|
|
76
76
|
orderHash,
|
|
77
77
|
protocolAddress,
|
|
78
78
|
this.context.chain,
|
|
@@ -208,7 +208,7 @@ export class CancellationManager {
|
|
|
208
208
|
// Fetch orders from the API using order hashes
|
|
209
209
|
const fetchedOrders: (Offer | Listing)[] = []
|
|
210
210
|
for (const hash of orderHashes) {
|
|
211
|
-
const fetched = await this.context.api.getOrderByHash(
|
|
211
|
+
const fetched = await this.context.api.orders.getOrderByHash(
|
|
212
212
|
hash,
|
|
213
213
|
protocolAddress,
|
|
214
214
|
this.context.chain,
|
|
@@ -282,8 +282,8 @@ export class CancellationManager {
|
|
|
282
282
|
* @param options
|
|
283
283
|
* @param options.orders The orders to cancel
|
|
284
284
|
* @param options.accountAddress The account address cancelling the orders.
|
|
285
|
-
* @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata
|
|
286
|
-
*
|
|
285
|
+
* @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata,
|
|
286
|
+
* used for onchain order attribution in analytics.
|
|
287
287
|
* @param options.overrides Transaction overrides, ignored if not set.
|
|
288
288
|
* @returns Transaction hash of the order.
|
|
289
289
|
*/
|
|
@@ -371,7 +371,7 @@ export class CancellationManager {
|
|
|
371
371
|
)
|
|
372
372
|
}
|
|
373
373
|
try {
|
|
374
|
-
return await this.context.api.offchainCancelOrder(
|
|
374
|
+
return await this.context.api.orders.offchainCancelOrder(
|
|
375
375
|
protocolAddress,
|
|
376
376
|
orderHash,
|
|
377
377
|
chain,
|
package/src/sdk/fulfillment.ts
CHANGED
|
@@ -178,17 +178,18 @@ export class FulfillmentManager {
|
|
|
178
178
|
const unitsToFillStr =
|
|
179
179
|
unitsToFill !== undefined ? unitsToFill.toString() : "1"
|
|
180
180
|
|
|
181
|
-
const fulfillmentData =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
const fulfillmentData =
|
|
182
|
+
await this.context.api.orders.generateFulfillmentData(
|
|
183
|
+
accountAddress,
|
|
184
|
+
orderHash,
|
|
185
|
+
protocolAddress,
|
|
186
|
+
side,
|
|
187
|
+
assetContractAddress,
|
|
188
|
+
tokenId,
|
|
189
|
+
unitsToFillStr,
|
|
190
|
+
recipientAddress,
|
|
191
|
+
includeOptionalCreatorFees,
|
|
192
|
+
)
|
|
192
193
|
|
|
193
194
|
// Use the transaction data returned by the API
|
|
194
195
|
const transaction = fulfillmentData.fulfillmentData.transaction
|
|
@@ -439,10 +440,9 @@ export class FulfillmentManager {
|
|
|
439
440
|
}
|
|
440
441
|
|
|
441
442
|
/**
|
|
442
|
-
*
|
|
443
|
-
* with an onchain transaction.
|
|
443
|
+
* Approve an order with an onchain transaction instead of an offchain signature.
|
|
444
444
|
* @param order Order to approve
|
|
445
|
-
* @param domain An optional domain to be hashed and included at the end of fulfillment calldata
|
|
445
|
+
* @param domain An optional domain to be hashed and included at the end of fulfillment calldata, used for onchain order attribution in analytics.
|
|
446
446
|
* @returns Transaction hash of the approval transaction
|
|
447
447
|
*
|
|
448
448
|
* @throws Error if the accountAddress is not available through wallet or provider.
|