@opensea/sdk 11.7.0 → 11.8.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 +1 -1
- package/lib/abi/abis.d.ts +16 -0
- package/lib/abi/abis.js +13 -1
- package/lib/abi/abis.js.map +1 -1
- package/lib/api/accounts.d.ts +6 -1
- package/lib/api/accounts.js +7 -0
- package/lib/api/accounts.js.map +1 -1
- package/lib/api/api.d.ts +10 -4
- package/lib/api/api.js +11 -3
- package/lib/api/api.js.map +1 -1
- package/lib/api/apiPaths.d.ts +1 -0
- package/lib/api/apiPaths.js +6 -2
- package/lib/api/apiPaths.js.map +1 -1
- package/lib/api/types.d.ts +26 -1
- package/lib/api/types.js.map +1 -1
- package/lib/api/walletAuth.d.ts +37 -0
- package/lib/api/walletAuth.js +40 -5
- package/lib/api/walletAuth.js.map +1 -1
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +7 -1
- package/lib/constants.js.map +1 -1
- package/lib/orders/erc20Fulfillment.d.ts +41 -0
- package/lib/orders/erc20Fulfillment.js +190 -0
- package/lib/orders/erc20Fulfillment.js.map +1 -0
- package/lib/orders/orderUseCase.d.ts +18 -0
- package/lib/orders/orderUseCase.js +29 -0
- package/lib/orders/orderUseCase.js.map +1 -0
- package/lib/sdk/base.d.ts +32 -7
- package/lib/sdk/base.js +19 -7
- package/lib/sdk/base.js.map +1 -1
- package/lib/sdk/cancellation.d.ts +2 -1
- package/lib/sdk/cancellation.js +2 -0
- package/lib/sdk/cancellation.js.map +1 -1
- package/lib/sdk/fulfillment.d.ts +57 -3
- package/lib/sdk/fulfillment.js +147 -4
- package/lib/sdk/fulfillment.js.map +1 -1
- package/lib/sdk/orders.d.ts +16 -3
- package/lib/sdk/orders.js +27 -13
- package/lib/sdk/orders.js.map +1 -1
- package/lib/types.d.ts +2 -1
- package/lib/types.js +1 -0
- package/lib/types.js.map +1 -1
- package/lib/utils/chain.js +6 -0
- package/lib/utils/chain.js.map +1 -1
- package/lib/utils/chainIds.generated.js +1 -0
- package/lib/utils/chainIds.generated.js.map +1 -1
- package/package.json +3 -3
- package/src/abi/abis.ts +13 -0
- package/src/api/accounts.ts +14 -0
- package/src/api/api.ts +15 -3
- package/src/api/apiPaths.ts +4 -0
- package/src/api/types.ts +38 -0
- package/src/api/walletAuth.ts +53 -0
- package/src/constants.ts +8 -0
- package/src/orders/erc20Fulfillment.ts +218 -0
- package/src/orders/orderUseCase.ts +34 -0
- package/src/sdk/base.ts +20 -6
- package/src/sdk/cancellation.ts +4 -1
- package/src/sdk/fulfillment.ts +188 -6
- package/src/sdk/orders.ts +27 -15
- package/src/types.ts +1 -0
- package/src/utils/chain.ts +10 -0
- package/src/utils/chainIds.generated.ts +1 -0
package/src/sdk/orders.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
} from "@opensea/seaport-js/lib/types"
|
|
6
6
|
import type { CollectionOffer, Listing, NFT, Offer } from "../api/types"
|
|
7
7
|
import { INVERSE_BASIS_POINT, ZERO_ADDRESS } from "../constants"
|
|
8
|
+
import { executeApprovalsAndGetOrderComponents } from "../orders/orderUseCase"
|
|
8
9
|
import type { ProtocolData } from "../orders/types"
|
|
9
10
|
import {
|
|
10
11
|
type Amount,
|
|
@@ -143,7 +144,10 @@ export class OrdersManager {
|
|
|
143
144
|
/**
|
|
144
145
|
* Build listing order without submitting to API
|
|
145
146
|
* @param options Listing parameters
|
|
146
|
-
* @returns
|
|
147
|
+
* @returns The seaport-js use case. Call `executeAllActions()` to approve and
|
|
148
|
+
* sign it for API submission, or
|
|
149
|
+
* {@link executeApprovalsAndGetOrderComponents} to approve it without a
|
|
150
|
+
* signature for onchain validation.
|
|
147
151
|
*/
|
|
148
152
|
private async _buildListingOrder({
|
|
149
153
|
asset,
|
|
@@ -212,7 +216,7 @@ export class OrdersManager {
|
|
|
212
216
|
zone = collection.requiredZone
|
|
213
217
|
}
|
|
214
218
|
|
|
215
|
-
|
|
219
|
+
return this.context.seaport.createOrder(
|
|
216
220
|
{
|
|
217
221
|
offer: offerAssetItems,
|
|
218
222
|
consideration: considerationFeeItems,
|
|
@@ -227,12 +231,15 @@ export class OrdersManager {
|
|
|
227
231
|
},
|
|
228
232
|
accountAddress,
|
|
229
233
|
)
|
|
230
|
-
|
|
231
|
-
return executeAllActions()
|
|
232
234
|
}
|
|
233
235
|
|
|
234
236
|
/**
|
|
235
|
-
* Build listing order components without submitting to API
|
|
237
|
+
* Build listing order components without submitting to API.
|
|
238
|
+
*
|
|
239
|
+
* Runs any token approvals the order needs, but does not ask the wallet to
|
|
240
|
+
* sign: the components are meant for onchain validation, which needs no
|
|
241
|
+
* offchain signature.
|
|
242
|
+
*
|
|
236
243
|
* @param options Listing parameters
|
|
237
244
|
* @returns OrderComponents ready for onchain validation
|
|
238
245
|
*/
|
|
@@ -261,7 +268,7 @@ export class OrdersManager {
|
|
|
261
268
|
includeOptionalCreatorFees?: boolean
|
|
262
269
|
zone?: string
|
|
263
270
|
}): Promise<OrderComponents> {
|
|
264
|
-
const
|
|
271
|
+
const useCase = await this._buildListingOrder({
|
|
265
272
|
asset,
|
|
266
273
|
accountAddress,
|
|
267
274
|
amount,
|
|
@@ -274,7 +281,7 @@ export class OrdersManager {
|
|
|
274
281
|
includeOptionalCreatorFees,
|
|
275
282
|
zone,
|
|
276
283
|
})
|
|
277
|
-
return
|
|
284
|
+
return executeApprovalsAndGetOrderComponents(useCase)
|
|
278
285
|
}
|
|
279
286
|
|
|
280
287
|
/**
|
|
@@ -334,7 +341,7 @@ export class OrdersManager {
|
|
|
334
341
|
zone = collection.requiredZone
|
|
335
342
|
}
|
|
336
343
|
|
|
337
|
-
|
|
344
|
+
return this.context.seaport.createOrder(
|
|
338
345
|
{
|
|
339
346
|
offer: [
|
|
340
347
|
{
|
|
@@ -355,12 +362,15 @@ export class OrdersManager {
|
|
|
355
362
|
},
|
|
356
363
|
accountAddress,
|
|
357
364
|
)
|
|
358
|
-
|
|
359
|
-
return executeAllActions()
|
|
360
365
|
}
|
|
361
366
|
|
|
362
367
|
/**
|
|
363
|
-
* Build offer order components without submitting to API
|
|
368
|
+
* Build offer order components without submitting to API.
|
|
369
|
+
*
|
|
370
|
+
* Runs any token approvals the order needs, but does not ask the wallet to
|
|
371
|
+
* sign: the components are meant for onchain validation, which needs no
|
|
372
|
+
* offchain signature.
|
|
373
|
+
*
|
|
364
374
|
* @param options Offer parameters
|
|
365
375
|
* @returns OrderComponents ready for onchain validation
|
|
366
376
|
*/
|
|
@@ -383,7 +393,7 @@ export class OrdersManager {
|
|
|
383
393
|
expirationTime?: Amount
|
|
384
394
|
zone?: string
|
|
385
395
|
}): Promise<OrderComponents> {
|
|
386
|
-
const
|
|
396
|
+
const useCase = await this._buildOfferOrder({
|
|
387
397
|
asset,
|
|
388
398
|
accountAddress,
|
|
389
399
|
amount,
|
|
@@ -393,7 +403,7 @@ export class OrdersManager {
|
|
|
393
403
|
expirationTime,
|
|
394
404
|
zone,
|
|
395
405
|
})
|
|
396
|
-
return
|
|
406
|
+
return executeApprovalsAndGetOrderComponents(useCase)
|
|
397
407
|
}
|
|
398
408
|
|
|
399
409
|
/**
|
|
@@ -433,7 +443,7 @@ export class OrdersManager {
|
|
|
433
443
|
expirationTime?: Amount
|
|
434
444
|
zone?: string
|
|
435
445
|
}): Promise<Offer> {
|
|
436
|
-
const
|
|
446
|
+
const useCase = await this._buildOfferOrder({
|
|
437
447
|
asset,
|
|
438
448
|
accountAddress,
|
|
439
449
|
amount,
|
|
@@ -443,6 +453,7 @@ export class OrdersManager {
|
|
|
443
453
|
expirationTime,
|
|
444
454
|
zone,
|
|
445
455
|
})
|
|
456
|
+
const order = await useCase.executeAllActions()
|
|
446
457
|
|
|
447
458
|
return this.context.api.postOffer(
|
|
448
459
|
order,
|
|
@@ -495,7 +506,7 @@ export class OrdersManager {
|
|
|
495
506
|
includeOptionalCreatorFees?: boolean
|
|
496
507
|
zone?: string
|
|
497
508
|
}): Promise<Listing> {
|
|
498
|
-
const
|
|
509
|
+
const useCase = await this._buildListingOrder({
|
|
499
510
|
asset,
|
|
500
511
|
accountAddress,
|
|
501
512
|
amount,
|
|
@@ -508,6 +519,7 @@ export class OrdersManager {
|
|
|
508
519
|
includeOptionalCreatorFees,
|
|
509
520
|
zone,
|
|
510
521
|
})
|
|
522
|
+
const order = await useCase.executeAllActions()
|
|
511
523
|
|
|
512
524
|
return this.context.api.postListing(
|
|
513
525
|
order,
|
package/src/types.ts
CHANGED
package/src/utils/chain.ts
CHANGED
|
@@ -106,6 +106,11 @@ export const getOfferPaymentToken = (chain: Chain) => {
|
|
|
106
106
|
return "0x3bd359c1119da7da1d913d1c4d2b7c461115433a" // WMON
|
|
107
107
|
case Chain.Robinhood:
|
|
108
108
|
return "0x0bd7d308f8e1639fab988df18a8011f41eacad73" // WETH
|
|
109
|
+
// Payment tokens not yet mapped in the SDK
|
|
110
|
+
case Chain.StableChain:
|
|
111
|
+
throw new Error(
|
|
112
|
+
`Chain ${chain} is not supported for OpenSea Seaport offers`,
|
|
113
|
+
)
|
|
109
114
|
default: {
|
|
110
115
|
const exhaustiveChain: never = chain
|
|
111
116
|
throw new Error(`Unknown offer currency for ${exhaustiveChain}`)
|
|
@@ -162,6 +167,11 @@ export const getListingPaymentToken = (chain: Chain) => {
|
|
|
162
167
|
return "0x0000000000000000000000000000000000000000" // ANIME
|
|
163
168
|
case Chain.Robinhood:
|
|
164
169
|
return "0x0000000000000000000000000000000000000000" // ETH
|
|
170
|
+
// Payment tokens not yet mapped in the SDK
|
|
171
|
+
case Chain.StableChain:
|
|
172
|
+
throw new Error(
|
|
173
|
+
`Chain ${chain} is not supported for OpenSea Seaport listings`,
|
|
174
|
+
)
|
|
165
175
|
default: {
|
|
166
176
|
const exhaustiveChain: never = chain
|
|
167
177
|
throw new Error(`Unknown listing currency for ${exhaustiveChain}`)
|