@opensea/sdk 10.2.0 → 10.3.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 +13 -2
- package/lib/api/api.d.ts +17 -6
- package/lib/api/api.js +23 -9
- package/lib/api/api.js.map +1 -1
- package/lib/api/apiPaths.d.ts +1 -0
- package/lib/api/apiPaths.js +5 -1
- package/lib/api/apiPaths.js.map +1 -1
- package/lib/api/events.d.ts +4 -3
- package/lib/api/events.js +14 -2
- package/lib/api/events.js.map +1 -1
- package/lib/api/listings.d.ts +10 -7
- package/lib/api/listings.js +13 -6
- package/lib/api/listings.js.map +1 -1
- package/lib/api/nfts.d.ts +4 -3
- package/lib/api/nfts.js +5 -6
- package/lib/api/nfts.js.map +1 -1
- package/lib/api/types.d.ts +95 -1
- package/lib/api/types.js +10 -0
- package/lib/api/types.js.map +1 -1
- package/lib/provider/seaport-bridge.js +6 -2
- package/lib/provider/seaport-bridge.js.map +1 -1
- package/lib/provider/viem-adapter.js +9 -0
- package/lib/provider/viem-adapter.js.map +1 -1
- package/lib/sdk/base.d.ts +23 -0
- package/lib/sdk/base.js +29 -0
- package/lib/sdk/base.js.map +1 -1
- package/package.json +2 -2
- package/src/api/api.ts +31 -7
- package/src/api/apiPaths.ts +4 -0
- package/src/api/events.ts +20 -4
- package/src/api/listings.ts +27 -6
- package/src/api/nfts.ts +13 -12
- package/src/api/types.ts +106 -1
- package/src/provider/seaport-bridge.ts +6 -2
- package/src/provider/viem-adapter.ts +18 -3
- package/src/sdk/base.ts +40 -1
package/lib/api/types.d.ts
CHANGED
|
@@ -2,6 +2,30 @@ import type { AssetMetadataResponse, InstantApiKeyResponse, TokenGroupPaginatedR
|
|
|
2
2
|
import type { ConsiderationItem } from "@opensea/seaport-js/lib/types";
|
|
3
3
|
import type { OrderType, OrderV2, ProtocolData, QueryCursors } from "../orders/types";
|
|
4
4
|
import type { OpenSeaCollection } from "../types";
|
|
5
|
+
/**
|
|
6
|
+
* A single trait filter used by collection-scoped read endpoints (NFTs by
|
|
7
|
+
* collection, best listings by collection, events by collection). Multiple
|
|
8
|
+
* filters in the same query are AND-combined: returned items must match every
|
|
9
|
+
* specified trait.
|
|
10
|
+
*
|
|
11
|
+
* Distinct from {@link TraitCriteria} (`{type, value}`) which is the offer-
|
|
12
|
+
* creation shape — the wire format differs across endpoints.
|
|
13
|
+
*
|
|
14
|
+
* @category API Query Args
|
|
15
|
+
*/
|
|
16
|
+
export interface TraitFilter {
|
|
17
|
+
/** The trait name (e.g. "Background"). */
|
|
18
|
+
traitType: string;
|
|
19
|
+
/** The trait value to match (e.g. "Red"). */
|
|
20
|
+
value: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Encode a {@link TraitFilter} array as the JSON-string form the API expects
|
|
24
|
+
* on the `traits` query parameter, or `undefined` if the array is empty.
|
|
25
|
+
* Callers spread the result into a query object; query encoders skip
|
|
26
|
+
* undefined keys.
|
|
27
|
+
*/
|
|
28
|
+
export declare function encodeTraitsParam(traits: TraitFilter[] | undefined): string | undefined;
|
|
5
29
|
/**
|
|
6
30
|
* Response from OpenSea API for building an offer.
|
|
7
31
|
* @category API Response Types
|
|
@@ -580,7 +604,11 @@ export type TransferEvent = BaseEvent & {
|
|
|
580
604
|
*/
|
|
581
605
|
export type AssetEvent = ListingEvent | OfferEvent | TraitOfferEvent | CollectionOfferEvent | OrderEvent | SaleEvent | TransferEvent | MintEvent;
|
|
582
606
|
/**
|
|
583
|
-
* Query args for
|
|
607
|
+
* Query args for the generic event endpoints (`getEvents`,
|
|
608
|
+
* `getEventsByAccount`, `getEventsByNFT`). For the collection-scoped endpoint
|
|
609
|
+
* see {@link GetEventsByCollectionArgs}, which adds server-side trait
|
|
610
|
+
* filtering on top of these fields.
|
|
611
|
+
*
|
|
584
612
|
* @category API Query Args
|
|
585
613
|
*/
|
|
586
614
|
export interface GetEventsArgs {
|
|
@@ -597,6 +625,17 @@ export interface GetEventsArgs {
|
|
|
597
625
|
/** Chain to filter by */
|
|
598
626
|
chain?: string;
|
|
599
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* Query args for {@link EventsAPI.getEventsByCollection}. Adds server-side
|
|
630
|
+
* trait filtering on top of {@link GetEventsArgs}; multiple traits are
|
|
631
|
+
* AND-combined.
|
|
632
|
+
*
|
|
633
|
+
* @category API Query Args
|
|
634
|
+
*/
|
|
635
|
+
export interface GetEventsByCollectionArgs extends GetEventsArgs {
|
|
636
|
+
/** Trait filters; see {@link TraitFilter}. */
|
|
637
|
+
traits?: TraitFilter[];
|
|
638
|
+
}
|
|
600
639
|
/**
|
|
601
640
|
* Response from OpenSea API for fetching events.
|
|
602
641
|
* @category API Response Types
|
|
@@ -1142,4 +1181,59 @@ export type ValidateMetadataResponse = {
|
|
|
1142
1181
|
* @category API Response Types
|
|
1143
1182
|
*/
|
|
1144
1183
|
export type GetNFTMetadataResponse = AssetMetadataResponse;
|
|
1184
|
+
/**
|
|
1185
|
+
* A single listing to fulfill in a cross-chain fulfillment request.
|
|
1186
|
+
* @category API Models
|
|
1187
|
+
*/
|
|
1188
|
+
export type CrossChainListing = {
|
|
1189
|
+
/** Order hash (66 chars, starts with 0x) */
|
|
1190
|
+
hash: string;
|
|
1191
|
+
/** Chain slug where the listing lives (must be EVM) */
|
|
1192
|
+
chain: string;
|
|
1193
|
+
/** Seaport contract address */
|
|
1194
|
+
protocol_address: string;
|
|
1195
|
+
};
|
|
1196
|
+
/**
|
|
1197
|
+
* Request body for the cross-chain fulfillment endpoint.
|
|
1198
|
+
* @category API Query Args
|
|
1199
|
+
*/
|
|
1200
|
+
export type CrossChainFulfillmentDataRequest = {
|
|
1201
|
+
/** Array of listings to fulfill (up to 50) */
|
|
1202
|
+
listings: CrossChainListing[];
|
|
1203
|
+
/** The buyer's wallet */
|
|
1204
|
+
fulfiller: {
|
|
1205
|
+
address: string;
|
|
1206
|
+
};
|
|
1207
|
+
/** Payment token details */
|
|
1208
|
+
payment: {
|
|
1209
|
+
/** Chain slug of the payment token (EVM or SVM) */
|
|
1210
|
+
chain: string;
|
|
1211
|
+
/** Payment token contract address (0x0...0 for native, Base58 for Solana) */
|
|
1212
|
+
token_address: string;
|
|
1213
|
+
};
|
|
1214
|
+
/** Optional: different recipient address for the NFTs */
|
|
1215
|
+
recipient?: string;
|
|
1216
|
+
};
|
|
1217
|
+
/**
|
|
1218
|
+
* A single transaction returned by the cross-chain fulfillment endpoint.
|
|
1219
|
+
* @category API Response Types
|
|
1220
|
+
*/
|
|
1221
|
+
export type CrossChainTransaction = {
|
|
1222
|
+
/** Chain slug for the transaction */
|
|
1223
|
+
chain: string;
|
|
1224
|
+
/** Contract address to call */
|
|
1225
|
+
to: string;
|
|
1226
|
+
/** Encoded calldata */
|
|
1227
|
+
data: string;
|
|
1228
|
+
/** Wei amount as string */
|
|
1229
|
+
value: string;
|
|
1230
|
+
};
|
|
1231
|
+
/**
|
|
1232
|
+
* Response from the cross-chain fulfillment endpoint.
|
|
1233
|
+
* @category API Response Types
|
|
1234
|
+
*/
|
|
1235
|
+
export type CrossChainFulfillmentDataResponse = {
|
|
1236
|
+
/** Ordered list of transactions to sign and submit */
|
|
1237
|
+
transactions: CrossChainTransaction[];
|
|
1238
|
+
};
|
|
1145
1239
|
export {};
|
package/lib/api/types.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderEventType = exports.AssetEventType = exports.TraitDisplayType = exports.OrderStatus = exports.CollectionOrderByOption = void 0;
|
|
4
|
+
exports.encodeTraitsParam = encodeTraitsParam;
|
|
5
|
+
/**
|
|
6
|
+
* Encode a {@link TraitFilter} array as the JSON-string form the API expects
|
|
7
|
+
* on the `traits` query parameter, or `undefined` if the array is empty.
|
|
8
|
+
* Callers spread the result into a query object; query encoders skip
|
|
9
|
+
* undefined keys.
|
|
10
|
+
*/
|
|
11
|
+
function encodeTraitsParam(traits) {
|
|
12
|
+
return traits && traits.length > 0 ? JSON.stringify(traits) : undefined;
|
|
13
|
+
}
|
|
4
14
|
var CollectionOrderByOption;
|
|
5
15
|
(function (CollectionOrderByOption) {
|
|
6
16
|
CollectionOrderByOption["CREATED_DATE"] = "created_date";
|
package/lib/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":";;;AAuCA,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;AA4GD,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;AA4ND;;;GAGG;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"}
|
|
@@ -89,12 +89,16 @@ class ViemEthersSigner extends ethers_1.AbstractSigner {
|
|
|
89
89
|
chain: this._walletClient.chain,
|
|
90
90
|
});
|
|
91
91
|
// Return an ethers-compatible TransactionResponse by fetching from the provider
|
|
92
|
-
const
|
|
92
|
+
const provider = this.provider;
|
|
93
|
+
if (!provider) {
|
|
94
|
+
throw new Error("Provider is required to fetch transaction response");
|
|
95
|
+
}
|
|
96
|
+
const response = await provider.getTransaction(hash);
|
|
93
97
|
if (!response) {
|
|
94
98
|
// Fallback: construct minimal response if the tx isn't indexed yet
|
|
95
99
|
return {
|
|
96
100
|
hash,
|
|
97
|
-
wait: () =>
|
|
101
|
+
wait: () => provider.waitForTransaction(hash),
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
104
|
return response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seaport-bridge.js","sourceRoot":"","sources":["../../src/provider/seaport-bridge.ts"],"names":[],"mappings":";;AAgBA,kDAmCC;AAnDD;;;GAGG;AACH,mCAKe;AAGf;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,MAAyB,EACzB,MAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAA;IAErE,2EAA2E;IAC3E,0EAA0E;I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CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAc,EAAE;YACxE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;SACpC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAW,EAAE,KAAU,EAAE,KAAU;QACrD,MAAM,WAAW,GACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,cAAc,CAAC;YACtD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAEvB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;YACtC,MAAM,EAAE;gBACN,GAAG,MAAM;gBACT,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;aAC7D;YACD,KAAK;YACL,WAAW;YACX,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;SACpC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -32,6 +32,9 @@ function createViemSigner(walletClient, publicClient) {
|
|
|
32
32
|
return walletClient.account.address;
|
|
33
33
|
},
|
|
34
34
|
async sendTransaction(tx) {
|
|
35
|
+
if (!walletClient.account) {
|
|
36
|
+
throw new Error("WalletClient must have an account. Use `createWalletClient` with an `account` parameter.");
|
|
37
|
+
}
|
|
35
38
|
const hash = await walletClient.sendTransaction({
|
|
36
39
|
to: tx.to,
|
|
37
40
|
data: tx.data,
|
|
@@ -48,6 +51,9 @@ function createViemSigner(walletClient, publicClient) {
|
|
|
48
51
|
};
|
|
49
52
|
},
|
|
50
53
|
async signTypedData(domain, types, value) {
|
|
54
|
+
if (!walletClient.account) {
|
|
55
|
+
throw new Error("WalletClient must have an account. Use `createWalletClient` with an `account` parameter.");
|
|
56
|
+
}
|
|
51
57
|
return walletClient.signTypedData({
|
|
52
58
|
domain: {
|
|
53
59
|
chainId: Number(domain.chainId),
|
|
@@ -91,6 +97,9 @@ function createViemContractCaller(params) {
|
|
|
91
97
|
if (!walletClient) {
|
|
92
98
|
throw new Error("A WalletClient is required for write operations");
|
|
93
99
|
}
|
|
100
|
+
if (!walletClient.account) {
|
|
101
|
+
throw new Error("WalletClient must have an account. Use `createWalletClient` with an `account` parameter.");
|
|
102
|
+
}
|
|
94
103
|
const hash = await walletClient.writeContract({
|
|
95
104
|
address: address,
|
|
96
105
|
abi: abi,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viem-adapter.js","sourceRoot":"","sources":["../../src/provider/viem-adapter.ts"],"names":[],"mappings":";;AAkCA,4CAWC;
|
|
1
|
+
{"version":3,"file":"viem-adapter.js","sourceRoot":"","sources":["../../src/provider/viem-adapter.ts"],"names":[],"mappings":";;AAkCA,4CAWC;AA2ED,4DA2DC;AAnLD;;;;;;GAMG;AACH,+BAIa;AAoBb;;GAEG;AACH,SAAgB,gBAAgB,CAAC,MAAyB;IACxD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;IAExD,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,OAAO;YACL,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;YAClE,QAAQ;SACT,CAAA;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAA;AACrB,CAAC;AAED,SAAS,gBAAgB,CACvB,YAA0B,EAC1B,YAA0B;IAE1B,OAAO;QACL,KAAK,CAAC,UAAU;YACd,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAA;YACH,CAAC;YACD,OAAO,YAAY,CAAC,OAAO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tB,CAAC,CAAA;YACF,OAAO;gBACL,IAAI;gBACJ,KAAK,CAAC,IAAI;oBACR,MAAM,YAAY,CAAC,yBAAyB,CAAC;wBAC3C,IAAI,EAAE,IAAqB;qBAC5B,CAAC,CAAA;gBACJ,CAAC;aACF,CAAA;QACH,CAAC;QAED,kBAAkB,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE;YAC5C,OAAO,IAAA,yBAAsB,EAAC;gBAC5B,GAAG,EAAE,GAAU;gBACf,YAAY;gBACZ,IAAI,EAAE,IAAW;aAClB,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/lib/sdk/base.d.ts
CHANGED
|
@@ -249,6 +249,29 @@ export declare class BaseOpenSeaSDK {
|
|
|
249
249
|
domain?: string;
|
|
250
250
|
overrides?: Record<string, unknown>;
|
|
251
251
|
}): Promise<string>;
|
|
252
|
+
/**
|
|
253
|
+
* Get cross-chain fulfillment data for one or more listings.
|
|
254
|
+
* Supports same-chain, cross-token, and cross-chain purchases (up to 50 listings).
|
|
255
|
+
* All listings must be EVM (Seaport orders). Payment can be from any chain (EVM or SVM).
|
|
256
|
+
* Returns an ordered list of transactions to sign and submit.
|
|
257
|
+
* @param options
|
|
258
|
+
* @param options.listings Array of listings to fulfill (order hash, chain, protocol address)
|
|
259
|
+
* @param options.fulfillerAddress The buyer's wallet address
|
|
260
|
+
* @param options.paymentChain Chain slug of the payment token (EVM or SVM)
|
|
261
|
+
* @param options.paymentTokenAddress Payment token contract address (0x0...0 for native)
|
|
262
|
+
* @param options.recipientAddress Optional different recipient for the NFTs
|
|
263
|
+
*/
|
|
264
|
+
getCrossChainFulfillmentData(options: {
|
|
265
|
+
listings: Array<{
|
|
266
|
+
hash: string;
|
|
267
|
+
chain: string;
|
|
268
|
+
protocolAddress: string;
|
|
269
|
+
}>;
|
|
270
|
+
fulfillerAddress: string;
|
|
271
|
+
paymentChain: string;
|
|
272
|
+
paymentTokenAddress: string;
|
|
273
|
+
recipientAddress?: string;
|
|
274
|
+
}): Promise<import("../api/types").CrossChainFulfillmentDataResponse>;
|
|
252
275
|
/** Returns whether an order is fulfillable. */
|
|
253
276
|
isOrderFulfillable(options: {
|
|
254
277
|
order: OrderV2;
|
package/lib/sdk/base.js
CHANGED
|
@@ -210,6 +210,35 @@ class BaseOpenSeaSDK {
|
|
|
210
210
|
async fulfillPrivateOrder(options) {
|
|
211
211
|
return this._fulfillmentManager.fulfillPrivateOrder(options);
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Get cross-chain fulfillment data for one or more listings.
|
|
215
|
+
* Supports same-chain, cross-token, and cross-chain purchases (up to 50 listings).
|
|
216
|
+
* All listings must be EVM (Seaport orders). Payment can be from any chain (EVM or SVM).
|
|
217
|
+
* Returns an ordered list of transactions to sign and submit.
|
|
218
|
+
* @param options
|
|
219
|
+
* @param options.listings Array of listings to fulfill (order hash, chain, protocol address)
|
|
220
|
+
* @param options.fulfillerAddress The buyer's wallet address
|
|
221
|
+
* @param options.paymentChain Chain slug of the payment token (EVM or SVM)
|
|
222
|
+
* @param options.paymentTokenAddress Payment token contract address (0x0...0 for native)
|
|
223
|
+
* @param options.recipientAddress Optional different recipient for the NFTs
|
|
224
|
+
*/
|
|
225
|
+
async getCrossChainFulfillmentData(options) {
|
|
226
|
+
return this.api.getCrossChainFulfillmentData({
|
|
227
|
+
listings: options.listings.map(l => ({
|
|
228
|
+
hash: l.hash,
|
|
229
|
+
chain: l.chain,
|
|
230
|
+
protocol_address: l.protocolAddress,
|
|
231
|
+
})),
|
|
232
|
+
fulfiller: { address: options.fulfillerAddress },
|
|
233
|
+
payment: {
|
|
234
|
+
chain: options.paymentChain,
|
|
235
|
+
token_address: options.paymentTokenAddress,
|
|
236
|
+
},
|
|
237
|
+
...(options.recipientAddress
|
|
238
|
+
? { recipient: options.recipientAddress }
|
|
239
|
+
: {}),
|
|
240
|
+
});
|
|
241
|
+
}
|
|
213
242
|
/** Returns whether an order is fulfillable. */
|
|
214
243
|
async isOrderFulfillable(options) {
|
|
215
244
|
return this._fulfillmentManager.isOrderFulfillable(options);
|
package/lib/sdk/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/sdk/base.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAI5C,oCAAuC;AAQvC,4CAA2C;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/sdk/base.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAI5C,oCAAuC;AAQvC,4CAA2C;AAU3C,oCAA+C;AAC/C,8CAAkD;AAClD,0CAA2C;AAC3C,qCAAwC;AACxC,iDAAoD;AACpD,+CAAkD;AAClD,qCAA8D;AAC9D,qCAAwC;AAiBxC;;;;GAIG;AACH,MAAa,cAAc;IACzB,+EAA+E;IACxE,OAAO,CAAS;IACvB,4CAA4C;IACrC,MAAM,CAAuB;IACpC,mBAAmB;IACH,GAAG,CAAY;IAC/B,2BAA2B;IACX,KAAK,CAAO;IAElB,OAAO,CAAe;IACtB,eAAe,CAAgB;IACjC,QAAQ,CAAc;IACtB,2BAA2B,CAA+B;IAC1D,qBAAqB,CAAyB;IAEtD,oBAAoB;IACZ,cAAc,CAAe;IAC7B,cAAc,CAAe;IAC7B,oBAAoB,CAAqB;IACzC,cAAc,CAAe;IAC7B,mBAAmB,CAAoB;IAE/C,YAAsB,MAAqB;QACzC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,cAAc,CAAA;QAC5C,IAAI,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AC,kBAAkB,EAAE,oBAAoB,CAAC,CAAA;YAClE,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAA;YAC/D,IAAI,CAAC,MAAM,CAAC,0BAA0B,WAAW,EAAE,CAAC,CAAA;YACpD,IAAI,CAAC,SAAS,CAAC,iBAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAA;QACtE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,uBAAuB,WAAW,EAAE,CAAC,CAAA;YACjD,IAAI,CAAC,SAAS,CAAC,iBAAS,CAAC,iBAAiB,EAAE;gBAC1C,GAAG,oBAAoB;gBACvB,KAAK;aACN,CAAC,CAAA;YACF,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;CACF;AA7kBD,wCA6kBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensea/sdk",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"types": "lib/index.d.ts",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@noble/hashes": "^2.0.1",
|
|
48
|
-
"@opensea/api-types": "^0.2.
|
|
48
|
+
"@opensea/api-types": "^0.2.2",
|
|
49
49
|
"@opensea/seaport-js": "^4.1.1",
|
|
50
50
|
"ethers": "^6.16.0"
|
|
51
51
|
},
|
package/src/api/api.ts
CHANGED
|
@@ -35,6 +35,8 @@ import {
|
|
|
35
35
|
type CancelOrderResponse,
|
|
36
36
|
type CollectionOffer,
|
|
37
37
|
CollectionOrderByOption,
|
|
38
|
+
type CrossChainFulfillmentDataRequest,
|
|
39
|
+
type CrossChainFulfillmentDataResponse,
|
|
38
40
|
type DropMintRequest,
|
|
39
41
|
type DropMintResponse,
|
|
40
42
|
type GetAccountTokensArgs,
|
|
@@ -49,6 +51,7 @@ import {
|
|
|
49
51
|
type GetDropsArgs,
|
|
50
52
|
type GetDropsResponse,
|
|
51
53
|
type GetEventsArgs,
|
|
54
|
+
type GetEventsByCollectionArgs,
|
|
52
55
|
type GetEventsResponse,
|
|
53
56
|
type GetListingsResponse,
|
|
54
57
|
type GetNFTMetadataResponse,
|
|
@@ -75,6 +78,7 @@ import {
|
|
|
75
78
|
type ResolveAccountResponse,
|
|
76
79
|
type SearchArgs,
|
|
77
80
|
type SearchResponse,
|
|
81
|
+
type TraitFilter,
|
|
78
82
|
type ValidateMetadataResponse,
|
|
79
83
|
} from "./types"
|
|
80
84
|
|
|
@@ -298,6 +302,7 @@ export class OpenSeaAPI {
|
|
|
298
302
|
* @param limit The number of listings to return. Must be between 1 and 100. Default: 100
|
|
299
303
|
* @param next The cursor for the next page of results. This is returned from a previous request.
|
|
300
304
|
* @param includePrivateListings Whether to include private listings (default: false)
|
|
305
|
+
* @param traits Optional {@link TraitFilter} array. Returns 400 if a single trait matches more than 1000 items.
|
|
301
306
|
* @returns The {@link GetListingsResponse} returned by the API.
|
|
302
307
|
*/
|
|
303
308
|
public async getBestListings(
|
|
@@ -305,15 +310,30 @@ export class OpenSeaAPI {
|
|
|
305
310
|
limit?: number,
|
|
306
311
|
next?: string,
|
|
307
312
|
includePrivateListings?: boolean,
|
|
313
|
+
traits?: TraitFilter[],
|
|
308
314
|
): Promise<GetListingsResponse> {
|
|
309
315
|
return this.listingsAPI.getBestListings(
|
|
310
316
|
collectionSlug,
|
|
311
317
|
limit,
|
|
312
318
|
next,
|
|
313
319
|
includePrivateListings,
|
|
320
|
+
traits,
|
|
314
321
|
)
|
|
315
322
|
}
|
|
316
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Get cross-chain fulfillment data for one or more listings.
|
|
326
|
+
* Supports same-chain, cross-token, and cross-chain purchases (up to 50 listings).
|
|
327
|
+
* All listings must be EVM (Seaport orders). Payment can be from any chain (EVM or SVM).
|
|
328
|
+
* @param request The cross-chain fulfillment request containing listings, fulfiller, payment, and optional recipient
|
|
329
|
+
* @returns The {@link CrossChainFulfillmentDataResponse} with ordered transactions to sign and submit
|
|
330
|
+
*/
|
|
331
|
+
public async getCrossChainFulfillmentData(
|
|
332
|
+
request: CrossChainFulfillmentDataRequest,
|
|
333
|
+
): Promise<CrossChainFulfillmentDataResponse> {
|
|
334
|
+
return this.listingsAPI.getCrossChainFulfillmentData(request)
|
|
335
|
+
}
|
|
336
|
+
|
|
317
337
|
/**
|
|
318
338
|
* Generate the data needed to fulfill a listing or an offer onchain.
|
|
319
339
|
* @param fulfillerAddress The wallet address which will be used to fulfill the order
|
|
@@ -473,14 +493,16 @@ export class OpenSeaAPI {
|
|
|
473
493
|
* @param slug The slug (identifier) of the collection
|
|
474
494
|
* @param limit The number of NFTs to retrieve. Must be greater than 0 and less than 51.
|
|
475
495
|
* @param next Cursor to retrieve the next page of NFTs
|
|
496
|
+
* @param traits Optional {@link TraitFilter} array. Returns 400 if a single trait matches more than 1000 items.
|
|
476
497
|
* @returns The {@link ListNFTsResponse} returned by the API.
|
|
477
498
|
*/
|
|
478
499
|
public async getNFTsByCollection(
|
|
479
500
|
slug: string,
|
|
480
501
|
limit: number | undefined = undefined,
|
|
481
502
|
next: string | undefined = undefined,
|
|
503
|
+
traits: TraitFilter[] | undefined = undefined,
|
|
482
504
|
): Promise<ListNFTsResponse> {
|
|
483
|
-
return this.nftsAPI.getNFTsByCollection(slug, limit, next)
|
|
505
|
+
return this.nftsAPI.getNFTsByCollection(slug, limit, next, traits)
|
|
484
506
|
}
|
|
485
507
|
|
|
486
508
|
/**
|
|
@@ -668,14 +690,15 @@ export class OpenSeaAPI {
|
|
|
668
690
|
}
|
|
669
691
|
|
|
670
692
|
/**
|
|
671
|
-
* Gets a list of events for a specific collection.
|
|
693
|
+
* Gets a list of events for a specific collection. Pass `args.traits` to
|
|
694
|
+
* filter server-side by item traits (multiple entries are AND-combined).
|
|
672
695
|
* @param collectionSlug The slug (identifier) of the collection.
|
|
673
|
-
* @param args Query parameters
|
|
696
|
+
* @param args Query parameters; see {@link GetEventsByCollectionArgs}.
|
|
674
697
|
* @returns The {@link GetEventsResponse} returned by the API.
|
|
675
698
|
*/
|
|
676
699
|
public async getEventsByCollection(
|
|
677
700
|
collectionSlug: string,
|
|
678
|
-
args?:
|
|
701
|
+
args?: GetEventsByCollectionArgs,
|
|
679
702
|
): Promise<GetEventsResponse> {
|
|
680
703
|
return this.eventsAPI.getEventsByCollection(collectionSlug, args)
|
|
681
704
|
}
|
|
@@ -1093,8 +1116,9 @@ export class OpenSeaAPI {
|
|
|
1093
1116
|
let userAbortHandler: (() => void) | undefined
|
|
1094
1117
|
let signal = options?.signal
|
|
1095
1118
|
if (options?.timeout !== undefined) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1119
|
+
const ctrl = new AbortController()
|
|
1120
|
+
controller = ctrl
|
|
1121
|
+
timeoutId = setTimeout(() => ctrl.abort(), options.timeout)
|
|
1098
1122
|
// If user provided their own signal, abort ours if theirs fires
|
|
1099
1123
|
if (options.signal) {
|
|
1100
1124
|
if (options.signal.aborted) {
|
|
@@ -1102,7 +1126,7 @@ export class OpenSeaAPI {
|
|
|
1102
1126
|
throw new Error("Request aborted")
|
|
1103
1127
|
}
|
|
1104
1128
|
userAbortHandler = () => {
|
|
1105
|
-
|
|
1129
|
+
ctrl.abort()
|
|
1106
1130
|
clearTimeout(timeoutId)
|
|
1107
1131
|
}
|
|
1108
1132
|
options.signal.addEventListener("abort", userAbortHandler)
|
package/src/api/apiPaths.ts
CHANGED
|
@@ -231,6 +231,10 @@ export const getTokenGroupPath = (slug: string) => {
|
|
|
231
231
|
return `${API_V2_PREFIX}/token-groups/${slug}`
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
export const getCrossChainFulfillmentDataPath = () => {
|
|
235
|
+
return `${API_V2_PREFIX}/listings/cross_chain_fulfillment_data`
|
|
236
|
+
}
|
|
237
|
+
|
|
234
238
|
export const getInstantApiKeyPath = () => {
|
|
235
239
|
return `${API_V2_PREFIX}/auth/keys`
|
|
236
240
|
}
|
package/src/api/events.ts
CHANGED
|
@@ -6,7 +6,12 @@ import {
|
|
|
6
6
|
getEventsByNFTAPIPath,
|
|
7
7
|
} from "./apiPaths"
|
|
8
8
|
import type { Fetcher } from "./fetcher"
|
|
9
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
encodeTraitsParam,
|
|
11
|
+
type GetEventsArgs,
|
|
12
|
+
type GetEventsByCollectionArgs,
|
|
13
|
+
type GetEventsResponse,
|
|
14
|
+
} from "./types"
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* Events-related API operations
|
|
@@ -40,15 +45,16 @@ export class EventsAPI {
|
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
/**
|
|
43
|
-
* Gets a list of events for a specific collection.
|
|
48
|
+
* Gets a list of events for a specific collection. Pass `args.traits` to
|
|
49
|
+
* filter server-side; the SDK JSON-encodes the trait array for the request.
|
|
44
50
|
*/
|
|
45
51
|
async getEventsByCollection(
|
|
46
52
|
collectionSlug: string,
|
|
47
|
-
args?:
|
|
53
|
+
args?: GetEventsByCollectionArgs,
|
|
48
54
|
): Promise<GetEventsResponse> {
|
|
49
55
|
const response = await this.fetcher.get<GetEventsResponse>(
|
|
50
56
|
getEventsByCollectionAPIPath(collectionSlug),
|
|
51
|
-
args,
|
|
57
|
+
encodeArgs(args),
|
|
52
58
|
)
|
|
53
59
|
return response
|
|
54
60
|
}
|
|
@@ -69,3 +75,13 @@ export class EventsAPI {
|
|
|
69
75
|
return response
|
|
70
76
|
}
|
|
71
77
|
}
|
|
78
|
+
|
|
79
|
+
// Returns `undefined` (not `{}`) when no args were passed so the fetcher
|
|
80
|
+
// receives the same shape as before `traits` existed — preserves the
|
|
81
|
+
// pre-feature query string for callers that don't set any args.
|
|
82
|
+
function encodeArgs(args?: GetEventsByCollectionArgs) {
|
|
83
|
+
if (!args) return args
|
|
84
|
+
const { traits, ...rest } = args
|
|
85
|
+
const encoded = encodeTraitsParam(traits)
|
|
86
|
+
return encoded === undefined ? rest : { ...rest, traits: encoded }
|
|
87
|
+
}
|
package/src/api/listings.ts
CHANGED
|
@@ -4,10 +4,18 @@ import {
|
|
|
4
4
|
getAllListingsAPIPath,
|
|
5
5
|
getBestListingAPIPath,
|
|
6
6
|
getBestListingsAPIPath,
|
|
7
|
+
getCrossChainFulfillmentDataPath,
|
|
7
8
|
getOrdersAPIPath,
|
|
8
9
|
} from "./apiPaths"
|
|
9
10
|
import type { Fetcher } from "./fetcher"
|
|
10
|
-
import
|
|
11
|
+
import {
|
|
12
|
+
type CrossChainFulfillmentDataRequest,
|
|
13
|
+
type CrossChainFulfillmentDataResponse,
|
|
14
|
+
encodeTraitsParam,
|
|
15
|
+
type GetBestListingResponse,
|
|
16
|
+
type GetListingsResponse,
|
|
17
|
+
type TraitFilter,
|
|
18
|
+
} from "./types"
|
|
11
19
|
|
|
12
20
|
/**
|
|
13
21
|
* Listing-related API operations
|
|
@@ -65,17 +73,15 @@ export class ListingsAPI {
|
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
/**
|
|
68
|
-
* Gets the best listings for a given collection.
|
|
69
|
-
*
|
|
70
|
-
* @param limit The number of listings to return
|
|
71
|
-
* @param next The cursor for pagination
|
|
72
|
-
* @param includePrivateListings Whether to include private listings (default: false)
|
|
76
|
+
* Gets the best listings for a given collection. Pass `traits` to filter
|
|
77
|
+
* server-side by item traits (multiple entries are AND-combined).
|
|
73
78
|
*/
|
|
74
79
|
async getBestListings(
|
|
75
80
|
collectionSlug: string,
|
|
76
81
|
limit?: number,
|
|
77
82
|
next?: string,
|
|
78
83
|
includePrivateListings?: boolean,
|
|
84
|
+
traits?: TraitFilter[],
|
|
79
85
|
): Promise<GetListingsResponse> {
|
|
80
86
|
const response = await this.fetcher.get<GetListingsResponse>(
|
|
81
87
|
getBestListingsAPIPath(collectionSlug),
|
|
@@ -85,6 +91,7 @@ export class ListingsAPI {
|
|
|
85
91
|
...(includePrivateListings !== undefined && {
|
|
86
92
|
include_private_listings: includePrivateListings,
|
|
87
93
|
}),
|
|
94
|
+
traits: encodeTraitsParam(traits),
|
|
88
95
|
},
|
|
89
96
|
)
|
|
90
97
|
return response
|
|
@@ -123,4 +130,18 @@ export class ListingsAPI {
|
|
|
123
130
|
)
|
|
124
131
|
return response
|
|
125
132
|
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get cross-chain fulfillment data for one or more listings.
|
|
136
|
+
* Supports same-chain, cross-token, and cross-chain purchases.
|
|
137
|
+
* @param request The cross-chain fulfillment request
|
|
138
|
+
*/
|
|
139
|
+
async getCrossChainFulfillmentData(
|
|
140
|
+
request: CrossChainFulfillmentDataRequest,
|
|
141
|
+
): Promise<CrossChainFulfillmentDataResponse> {
|
|
142
|
+
return this.fetcher.post<CrossChainFulfillmentDataResponse>(
|
|
143
|
+
getCrossChainFulfillmentDataPath(),
|
|
144
|
+
request,
|
|
145
|
+
)
|
|
146
|
+
}
|
|
126
147
|
}
|
package/src/api/nfts.ts
CHANGED
|
@@ -12,13 +12,15 @@ import {
|
|
|
12
12
|
getValidateMetadataPath,
|
|
13
13
|
} from "./apiPaths"
|
|
14
14
|
import type { Fetcher } from "./fetcher"
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
import {
|
|
16
|
+
encodeTraitsParam,
|
|
17
|
+
type GetCollectionResponse,
|
|
18
|
+
type GetContractResponse,
|
|
19
|
+
type GetNFTMetadataResponse,
|
|
20
|
+
type GetNFTResponse,
|
|
21
|
+
type ListNFTsResponse,
|
|
22
|
+
type TraitFilter,
|
|
23
|
+
type ValidateMetadataResponse,
|
|
22
24
|
} from "./types"
|
|
23
25
|
|
|
24
26
|
/**
|
|
@@ -31,19 +33,18 @@ export class NFTsAPI {
|
|
|
31
33
|
) {}
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
|
-
* Fetch multiple NFTs for a collection.
|
|
36
|
+
* Fetch multiple NFTs for a collection. Pass `traits` to filter server-side
|
|
37
|
+
* by item traits (multiple entries are AND-combined).
|
|
35
38
|
*/
|
|
36
39
|
async getNFTsByCollection(
|
|
37
40
|
slug: string,
|
|
38
41
|
limit: number | undefined = undefined,
|
|
39
42
|
next: string | undefined = undefined,
|
|
43
|
+
traits: TraitFilter[] | undefined = undefined,
|
|
40
44
|
): Promise<ListNFTsResponse> {
|
|
41
45
|
const response = await this.fetcher.get<ListNFTsResponse>(
|
|
42
46
|
getListNFTsByCollectionPath(slug),
|
|
43
|
-
{
|
|
44
|
-
limit,
|
|
45
|
-
next,
|
|
46
|
-
},
|
|
47
|
+
{ limit, next, traits: encodeTraitsParam(traits) },
|
|
47
48
|
)
|
|
48
49
|
return response
|
|
49
50
|
}
|