@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.
Files changed (108) hide show
  1. package/README.md +127 -131
  2. package/lib/api/api.d.ts +7 -711
  3. package/lib/api/api.js +6 -870
  4. package/lib/api/api.js.map +1 -1
  5. package/lib/api/collections.d.ts +3 -3
  6. package/lib/api/collections.js +5 -4
  7. package/lib/api/collections.js.map +1 -1
  8. package/lib/api/drops.d.ts +1 -1
  9. package/lib/api/drops.js +1 -1
  10. package/lib/api/events.js +1 -1
  11. package/lib/api/events.js.map +1 -1
  12. package/lib/api/fetcher.d.ts +1 -1
  13. package/lib/api/listings.d.ts +2 -3
  14. package/lib/api/listings.js +2 -3
  15. package/lib/api/listings.js.map +1 -1
  16. package/lib/api/nfts.d.ts +1 -1
  17. package/lib/api/nfts.js +1 -1
  18. package/lib/api/orders.d.ts +1 -1
  19. package/lib/api/orders.js +1 -1
  20. package/lib/api/tokens.js +2 -23
  21. package/lib/api/tokens.js.map +1 -1
  22. package/lib/api/types.d.ts +11 -20
  23. package/lib/api/walletAuth.d.ts +2 -2
  24. package/lib/api/walletAuth.js +2 -2
  25. package/lib/auth/index.d.ts +2 -2
  26. package/lib/auth/index.js +1 -3
  27. package/lib/auth/index.js.map +1 -1
  28. package/lib/auth/oauth.d.ts +4 -4
  29. package/lib/auth/oauth.js +4 -4
  30. package/lib/auth/siwx.d.ts +1 -8
  31. package/lib/auth/siwx.js +1 -1
  32. package/lib/auth/siwx.js.map +1 -1
  33. package/lib/auth/types.d.ts +0 -12
  34. package/lib/provider/ethers-adapter.d.ts +1 -1
  35. package/lib/provider/ethers-adapter.js +1 -1
  36. package/lib/provider/seaport-bridge.js +1 -1
  37. package/lib/provider/seaport-bridge.js.map +1 -1
  38. package/lib/provider/viem-adapter.d.ts +1 -1
  39. package/lib/provider/viem-adapter.js +1 -1
  40. package/lib/sdk/assets.d.ts +2 -2
  41. package/lib/sdk/assets.js +2 -2
  42. package/lib/sdk/base.js +2 -2
  43. package/lib/sdk/base.js.map +1 -1
  44. package/lib/sdk/cancellation.d.ts +3 -3
  45. package/lib/sdk/cancellation.js +6 -6
  46. package/lib/sdk/cancellation.js.map +1 -1
  47. package/lib/sdk/fulfillment.d.ts +2 -3
  48. package/lib/sdk/fulfillment.js +3 -4
  49. package/lib/sdk/fulfillment.js.map +1 -1
  50. package/lib/sdk/orders.d.ts +6 -6
  51. package/lib/sdk/orders.js +21 -21
  52. package/lib/sdk/orders.js.map +1 -1
  53. package/lib/stream/client.d.ts +2 -14
  54. package/lib/stream/client.js +3 -19
  55. package/lib/stream/client.js.map +1 -1
  56. package/lib/stream/types.d.ts +3 -26
  57. package/lib/stream/types.js +0 -8
  58. package/lib/stream/types.js.map +1 -1
  59. package/lib/types.d.ts +3 -9
  60. package/lib/types.js +1 -1
  61. package/lib/utils/address.d.ts +2 -2
  62. package/lib/utils/address.js +2 -2
  63. package/lib/utils/case.d.ts +3 -3
  64. package/lib/utils/case.js +1 -1
  65. package/lib/utils/fees.js +1 -1
  66. package/lib/utils/fees.js.map +1 -1
  67. package/lib/utils/rateLimit.d.ts +0 -11
  68. package/lib/utils/rateLimit.js +1 -29
  69. package/lib/utils/rateLimit.js.map +1 -1
  70. package/lib/viem.js +1 -1
  71. package/lib/viem.js.map +1 -1
  72. package/package.json +2 -2
  73. package/src/api/api.ts +12 -1447
  74. package/src/api/collections.ts +7 -4
  75. package/src/api/drops.ts +1 -1
  76. package/src/api/events.ts +1 -1
  77. package/src/api/fetcher.ts +1 -1
  78. package/src/api/listings.ts +2 -3
  79. package/src/api/nfts.ts +1 -1
  80. package/src/api/orders.ts +1 -1
  81. package/src/api/tokens.ts +2 -24
  82. package/src/api/types.ts +15 -23
  83. package/src/api/walletAuth.ts +2 -2
  84. package/src/auth/index.ts +4 -7
  85. package/src/auth/oauth.ts +4 -4
  86. package/src/auth/siwx.ts +1 -8
  87. package/src/auth/types.ts +0 -13
  88. package/src/provider/ethers-adapter.ts +1 -1
  89. package/src/provider/seaport-bridge.ts +1 -1
  90. package/src/provider/viem-adapter.ts +1 -1
  91. package/src/sdk/assets.ts +2 -2
  92. package/src/sdk/base.ts +3 -2
  93. package/src/sdk/cancellation.ts +6 -6
  94. package/src/sdk/fulfillment.ts +14 -14
  95. package/src/sdk/orders.ts +30 -21
  96. package/src/stream/client.ts +2 -26
  97. package/src/stream/types.ts +3 -29
  98. package/src/types.ts +4 -11
  99. package/src/utils/address.ts +2 -2
  100. package/src/utils/case.ts +3 -3
  101. package/src/utils/fees.ts +1 -1
  102. package/src/utils/rateLimit.ts +3 -49
  103. package/src/viem.ts +1 -1
  104. package/src/abi/ERC1155.json +0 -314
  105. package/src/abi/ERC20.json +0 -222
  106. package/src/abi/ERC721.json +0 -333
  107. package/src/abi/Multicall3.json +0 -50
  108. package/src/abi/TransferHelper.json +0 -53
package/src/sdk/orders.ts CHANGED
@@ -312,13 +312,15 @@ export class OrdersManager {
312
312
  }) {
313
313
  await this.context.requireAccountIsAvailable(accountAddress)
314
314
 
315
- const { nft } = await this.context.api.getNFT(
315
+ const { nft } = await this.context.api.nfts.getNFT(
316
316
  asset.tokenAddress,
317
317
  asset.tokenId,
318
318
  )
319
319
  const offerAssetItems = this.getNFTItems([nft], [BigInt(quantity ?? 1)])
320
320
 
321
- const collection = await this.context.api.getCollection(nft.collection)
321
+ const collection = await this.context.api.collections.getCollection(
322
+ nft.collection,
323
+ )
322
324
 
323
325
  const paymentTokenAddress =
324
326
  collection.pricingCurrencies?.listingCurrency?.address ??
@@ -446,7 +448,7 @@ export class OrdersManager {
446
448
  }) {
447
449
  await this.context.requireAccountIsAvailable(accountAddress)
448
450
 
449
- const { nft } = await this.context.api.getNFT(
451
+ const { nft } = await this.context.api.nfts.getNFT(
450
452
  asset.tokenAddress,
451
453
  asset.tokenId,
452
454
  )
@@ -455,7 +457,9 @@ export class OrdersManager {
455
457
  [BigInt(quantity ?? 1)],
456
458
  )
457
459
 
458
- const collection = await this.context.api.getCollection(nft.collection)
460
+ const collection = await this.context.api.collections.getCollection(
461
+ nft.collection,
462
+ )
459
463
 
460
464
  const paymentTokenAddress = this.resolveOfferPaymentToken(collection)
461
465
 
@@ -589,7 +593,7 @@ export class OrdersManager {
589
593
  })
590
594
  const order = await useCase.executeAllActions()
591
595
 
592
- return this.context.api.postOffer(
596
+ return this.context.api.orders.postOffer(
593
597
  order,
594
598
  this.context.seaport.contract.target as string,
595
599
  )
@@ -602,7 +606,7 @@ export class OrdersManager {
602
606
  * @param options.accountAddress Address of the wallet making the listing
603
607
  * @param options.amount Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
604
608
  * @param options.quantity Number of assets to list. Defaults to 1.
605
- * @param options.domain Optional domain for onchain attribution. Hashed and included in salt. This can be used for onchain order attribution to assist with analytics.
609
+ * @param options.domain Optional domain for onchain attribution. Hashed and included in the salt.
606
610
  * @param options.salt Arbitrary salt. Auto-generated if not provided.
607
611
  * @param options.listingTime Optional time when the order will become fulfillable, in UTC seconds. Undefined means it will start now.
608
612
  * @param options.expirationTime Expiration time for the order, in UTC seconds.
@@ -655,7 +659,7 @@ export class OrdersManager {
655
659
  })
656
660
  const order = await useCase.executeAllActions()
657
661
 
658
- return this.context.api.postListing(
662
+ return this.context.api.orders.postListing(
659
663
  order,
660
664
  this.context.seaport.contract.target as string,
661
665
  )
@@ -666,8 +670,8 @@ export class OrdersManager {
666
670
  * This method uses a single signature for all listings and submits them individually to the OpenSea API with rate limit handling.
667
671
  * All listings must be from the same account address.
668
672
  *
669
- * Note: If only one listing is provided, this method will use a normal order signature instead of a bulk signature,
670
- * as bulk signatures are more expensive to decode onchain due to the merkle proof verification.
673
+ * With a single listing, this uses a normal order signature instead of a bulk signature,
674
+ * since bulk signatures cost more to verify onchain (merkle proof).
671
675
  *
672
676
  * @param options
673
677
  * @param options.listings Array of listing parameters. Each listing requires asset, amount, and optionally other listing parameters.
@@ -745,11 +749,13 @@ export class OrdersManager {
745
749
  } = listing
746
750
 
747
751
  // Fetch NFT and collection data
748
- const { nft } = await this.context.api.getNFT(
752
+ const { nft } = await this.context.api.nfts.getNFT(
749
753
  asset.tokenAddress,
750
754
  asset.tokenId,
751
755
  )
752
- const collection = await this.context.api.getCollection(nft.collection)
756
+ const collection = await this.context.api.collections.getCollection(
757
+ nft.collection,
758
+ )
753
759
 
754
760
  const paymentTokenAddress =
755
761
  collection.pricingCurrencies?.listingCurrency?.address ??
@@ -842,7 +848,7 @@ export class OrdersManager {
842
848
  orders,
843
849
  noun: "listing",
844
850
  post: order =>
845
- this.context.api.postListing(
851
+ this.context.api.orders.postListing(
846
852
  order,
847
853
  this.context.seaport.contract.target as string,
848
854
  ),
@@ -856,8 +862,8 @@ export class OrdersManager {
856
862
  * This method uses a single signature for all offers and submits them individually to the OpenSea API with rate limit handling.
857
863
  * All offers must be from the same account address.
858
864
  *
859
- * Note: If only one offer is provided, this method will use a normal order signature instead of a bulk signature,
860
- * as bulk signatures are more expensive to decode onchain due to the merkle proof verification.
865
+ * With a single offer, this uses a normal order signature instead of a bulk signature,
866
+ * since bulk signatures cost more to verify onchain (merkle proof).
861
867
  *
862
868
  * @param options
863
869
  * @param options.offers Array of offer parameters. Each offer requires asset, amount, and optionally other offer parameters.
@@ -928,11 +934,13 @@ export class OrdersManager {
928
934
  } = offer
929
935
 
930
936
  // Fetch NFT and collection data
931
- const { nft } = await this.context.api.getNFT(
937
+ const { nft } = await this.context.api.nfts.getNFT(
932
938
  asset.tokenAddress,
933
939
  asset.tokenId,
934
940
  )
935
- const collection = await this.context.api.getCollection(nft.collection)
941
+ const collection = await this.context.api.collections.getCollection(
942
+ nft.collection,
943
+ )
936
944
 
937
945
  const paymentTokenAddress = this.resolveOfferPaymentToken(collection)
938
946
 
@@ -1007,7 +1015,7 @@ export class OrdersManager {
1007
1015
  orders,
1008
1016
  noun: "offer",
1009
1017
  post: order =>
1010
- this.context.api.postOffer(
1018
+ this.context.api.orders.postOffer(
1011
1019
  order,
1012
1020
  this.context.seaport.contract.target as string,
1013
1021
  ),
@@ -1023,7 +1031,7 @@ export class OrdersManager {
1023
1031
  * @param options.accountAddress Address of the wallet making the offer.
1024
1032
  * @param options.amount Amount in decimal format (e.g., "1.5" for 1.5 ETH, not wei). Automatically converted to base units.
1025
1033
  * @param options.quantity Number of assets to bid for.
1026
- * @param options.domain Optional domain for onchain attribution. Hashed and included in salt. This can be used for onchain order attribution to assist with analytics.
1034
+ * @param options.domain Optional domain for onchain attribution. Hashed and included in the salt.
1027
1035
  * @param options.salt Arbitrary salt. Auto-generated if not provided.
1028
1036
  * @param options.expirationTime Expiration time for the order, in UTC seconds.
1029
1037
  * @param options.offerProtectionEnabled Use signed zone for protection against disabled items. Default: true.
@@ -1062,11 +1070,12 @@ export class OrdersManager {
1062
1070
  }): Promise<CollectionOffer | null> {
1063
1071
  await this.context.requireAccountIsAvailable(accountAddress)
1064
1072
 
1065
- const collection = await this.context.api.getCollection(collectionSlug)
1073
+ const collection =
1074
+ await this.context.api.collections.getCollection(collectionSlug)
1066
1075
 
1067
1076
  const paymentTokenAddress = this.resolveOfferPaymentToken(collection)
1068
1077
 
1069
- const buildOfferResult = await this.context.api.buildOffer(
1078
+ const buildOfferResult = await this.context.api.offers.buildOffer(
1070
1079
  accountAddress,
1071
1080
  quantity,
1072
1081
  collectionSlug,
@@ -1124,7 +1133,7 @@ export class OrdersManager {
1124
1133
  )
1125
1134
  const order = await executeAllActions()
1126
1135
 
1127
- return this.context.api.postCollectionOffer(
1136
+ return this.context.api.offers.postCollectionOffer(
1128
1137
  order,
1129
1138
  collectionSlug,
1130
1139
  traitType,
@@ -12,7 +12,6 @@ import {
12
12
  type ItemListedEvent,
13
13
  type ItemMetadataUpdate,
14
14
  type ItemReceivedBidEvent,
15
- type ItemReceivedOfferEvent,
16
15
  type ItemSoldEvent,
17
16
  type ItemTransferredEvent,
18
17
  LogLevel,
@@ -46,15 +45,13 @@ export class OpenSeaStreamClient {
46
45
  constructor({
47
46
  network = Network.MAINNET,
48
47
  apiKey,
49
- token,
50
48
  apiUrl,
51
49
  connectOptions,
52
50
  logLevel = LogLevel.INFO,
53
51
  onError,
54
52
  onEvent = () => true,
55
53
  }: ClientConfig) {
56
- const key = apiKey ?? token
57
- if (!key) {
54
+ if (!apiKey) {
58
55
  throw new Error(
59
56
  "An OpenSea API key is required. Pass it as `apiKey` when constructing OpenSeaStreamClient.",
60
57
  )
@@ -68,7 +65,7 @@ export class OpenSeaStreamClient {
68
65
 
69
66
  this.transport = new PhoenixChannelsTransport({
70
67
  endpoint,
71
- params: { token: key, ...params },
68
+ params: { token: apiKey, ...params },
72
69
  ...transportOptions,
73
70
  logger: message => this.debug(message),
74
71
  })
@@ -199,27 +196,6 @@ export class OpenSeaStreamClient {
199
196
  return this.on(EventType.ITEM_TRANSFERRED, collectionSlug, callback)
200
197
  }
201
198
 
202
- /**
203
- * No-op. The Stream API does not emit `item_received_offer` and never has, so
204
- * this only ever registered a handler that could not fire. Item-level offers
205
- * arrive as `item_received_bid`, so use {@link onItemReceivedBid} instead.
206
- *
207
- * Kept callable, and kept from opening a connection for a topic that yields
208
- * nothing, so existing call sites keep compiling and running unchanged.
209
- *
210
- * @deprecated Use {@link onItemReceivedBid}. This does nothing.
211
- * @hidden
212
- */
213
- public onItemReceivedOffer = (
214
- _collectionSlug: string,
215
- _callback: Callback<ItemReceivedOfferEvent>,
216
- ) => {
217
- this.warn(
218
- "onItemReceivedOffer does nothing: the Stream API does not emit item_received_offer. Item-level offers arrive as item_received_bid, via onItemReceivedBid.",
219
- )
220
- return () => {}
221
- }
222
-
223
199
  public onItemReceivedBid = (
224
200
  collectionSlug: string,
225
201
  callback: Callback<ItemReceivedBidEvent>,
@@ -35,10 +35,8 @@ export type StreamConnectOptions = {
35
35
  /**
36
36
  * OpenSea Stream API configuration object.
37
37
  *
38
- * @param apiKey OpenSea API key. Preferred over `token`, and named to match
39
- * `OpenSeaAPIConfig.apiKey` used elsewhere in the SDK.
40
- * @param token Deprecated alias for `apiKey`, kept so code migrating from
41
- * `@opensea/stream-js` keeps working unchanged.
38
+ * @param apiKey OpenSea API key, named to match `OpenSeaAPIConfig.apiKey`
39
+ * used elsewhere in the SDK.
42
40
  * @param network `Network` to use. Defaults to `Network.MAINNET`.
43
41
  * @param apiUrl Optional base URL override for the socket.
44
42
  * @param connectOptions connection tuning, see `StreamConnectOptions`.
@@ -51,10 +49,8 @@ export type StreamConnectOptions = {
51
49
  export type ClientConfig = {
52
50
  network?: Network
53
51
  apiUrl?: string
54
- /** OpenSea API key. Provide either this or `token`. */
52
+ /** OpenSea API key. */
55
53
  apiKey?: string
56
- /** @deprecated Use `apiKey` instead. */
57
- token?: string
58
54
  connectOptions?: StreamConnectOptions
59
55
  onError?: (error: unknown) => void
60
56
  logLevel?: LogLevel
@@ -70,14 +66,6 @@ export enum EventType {
70
66
  ITEM_LISTED = "item_listed",
71
67
  ITEM_SOLD = "item_sold",
72
68
  ITEM_TRANSFERRED = "item_transferred",
73
- /**
74
- * Never emitted by the Stream API. Item-level offers arrive as
75
- * {@link EventType.ITEM_RECEIVED_BID}. Kept so existing references compile.
76
- *
77
- * @deprecated Use {@link EventType.ITEM_RECEIVED_BID}.
78
- * @hidden
79
- */
80
- ITEM_RECEIVED_OFFER = "item_received_offer",
81
69
  ITEM_RECEIVED_BID = "item_received_bid",
82
70
  ITEM_CANCELLED = "item_cancelled",
83
71
  COLLECTION_OFFER = "collection_offer",
@@ -218,20 +206,6 @@ export interface ItemReceivedBidEventPayload
218
206
  export type ItemReceivedBidEvent =
219
207
  BaseStreamMessage<ItemReceivedBidEventPayload>
220
208
 
221
- /**
222
- * @deprecated Never emitted. Use {@link ItemReceivedBidEventPayload}.
223
- * @hidden
224
- */
225
- export interface ItemReceivedOfferEventPayload
226
- extends ItemReceivedBidEventPayload {}
227
-
228
- /**
229
- * @deprecated Never emitted. Use {@link ItemReceivedBidEvent}.
230
- * @hidden
231
- */
232
- export type ItemReceivedOfferEvent =
233
- BaseStreamMessage<ItemReceivedOfferEventPayload>
234
-
235
209
  export interface ItemCancelledEventPayload extends BasePricedOrderEventPayload {
236
210
  listing_type: string
237
211
  listing_date: string
package/src/types.ts CHANGED
@@ -19,7 +19,7 @@ export type { FetchImpl } from "./utils/fetchTransport"
19
19
  /**
20
20
  * Numeric type for amounts (replaces ethers BigNumberish).
21
21
  * Prefer `string` for decimal amounts (e.g. "1.5") to avoid floating point
22
- * precision issues — `number` values like `0.1 + 0.2` produce `0.30000000000000004`.
22
+ * errors: `number` math like `0.1 + 0.2` gives `0.30000000000000004`.
23
23
  */
24
24
  export type Amount = string | number | bigint
25
25
 
@@ -175,7 +175,7 @@ export interface OpenSeaAPIConfig {
175
175
 
176
176
  /**
177
177
  * Each of the possible chains that OpenSea supports.
178
- * ⚠️NOTE: When adding to this list, also update:
178
+ * When adding a chain, also update:
179
179
  * - `scripts/chain-data.json` + run `pnpm sync-chains` (generates `getChainId` mapping)
180
180
  * - `getListingPaymentToken`
181
181
  * - `getOfferPaymentToken`
@@ -215,7 +215,7 @@ export enum Chain {
215
215
  }
216
216
 
217
217
  // Compile-time check: every ChainIdentifier from the API spec must be assignable to Chain.
218
- // If the API adds a new chain, this will error — add it to the Chain enum above.
218
+ // If the API adds a new chain, this errors: add it to the Chain enum above.
219
219
  // The SDK may have chains not yet in the API spec (e.g. testnets, upcoming chains).
220
220
  type _AssertAPIChainsCovered = ChainIdentifier extends `${Chain}` ? true : never
221
221
 
@@ -296,7 +296,7 @@ export interface AssetWithTokenStandard extends Asset {
296
296
  }
297
297
 
298
298
  /**
299
- * OpenSea Collection Stats — sourced from api-types `CollectionStatsResponse`.
299
+ * OpenSea collection stats, from api-types `CollectionStatsResponse`.
300
300
  * @category API Models
301
301
  */
302
302
  export type OpenSeaCollectionStats = Camelize<CollectionStatsResponse>
@@ -354,13 +354,6 @@ export interface OpenSeaApiError extends Error {
354
354
  responseBody?: unknown
355
355
  }
356
356
 
357
- /**
358
- * @deprecated Use {@link OpenSeaApiError}. Retained as an alias: the shape is identical and
359
- * `retryAfter` was always optional, so existing rate-limit handling is unaffected.
360
- * @category API Models
361
- */
362
- export type OpenSeaRateLimitError = OpenSeaApiError
363
-
364
357
  /**
365
358
  * Options for controlling HTTP request behavior.
366
359
  * @category API Models
@@ -4,8 +4,8 @@ import { bytesToHex } from "@noble/hashes/utils.js"
4
4
  /**
5
5
  * EIP-55 checksum an Ethereum address.
6
6
  *
7
- * If the input contains mixed case, it is validated as an existing checksum —
8
- * an incorrect checksum throws (matching ethers.getAddress behavior).
7
+ * Mixed-case input is validated as an existing checksum, and an incorrect
8
+ * checksum throws (matching ethers.getAddress behavior).
9
9
  * All-lowercase and all-uppercase inputs are checksummed without validation.
10
10
  *
11
11
  * @param address The address to checksum (must be a valid 0x-prefixed hex address).
package/src/utils/case.ts CHANGED
@@ -54,7 +54,7 @@ function snakeToCamel(key: string): string {
54
54
  * `userID` → `user_i_d`, `NFTContract` → `n_f_t_contract`. This is deliberate
55
55
  * (the roundtrip with `camelizeKeysDeep` is consistent under generic rules)
56
56
  * but consumers calling `snakeizeKeysDeep` directly should avoid PascalCase
57
- * acronyms in key names — use `userId` / `nftContract` instead.
57
+ * acronyms in key names. Use `userId` / `nftContract` instead.
58
58
  */
59
59
  export function snakeizeKeysDeep<T>(value: T): Snakeize<T> {
60
60
  return walkSnake(value) as Snakeize<T>
@@ -94,7 +94,7 @@ type IsUppercaseLetter<Ch extends string> =
94
94
  * `"isNsfw"` → `"is_nsfw"`. The inverse of {@link Camelize}.
95
95
  *
96
96
  * Position 0 is special-cased so that PascalCase or acronym keys (`"URL"`,
97
- * `"MyKey"`) don't gain a leading underscore — this mirrors the runtime
97
+ * `"MyKey"`) don't gain a leading underscore, matching the runtime
98
98
  * {@link camelToSnake} behavior.
99
99
  */
100
100
  type CamelToSnakeInner<S extends string> =
@@ -192,7 +192,7 @@ type SnakeToCamel<S extends string> =
192
192
  * Recursively rewrites object keys from snake_case to camelCase. Preserves
193
193
  * arrays, primitives, and non-plain objects (Date, etc.).
194
194
  *
195
- * SDK consumers see camelCase types even though api-types ships snake_case —
195
+ * SDK consumers see camelCase types even though api-types ships snake_case;
196
196
  * the runtime {@link camelizeKeysDeep} keeps shapes in sync.
197
197
  *
198
198
  * Reach for this when a response has no dedicated camelized alias in this
package/src/utils/fees.ts CHANGED
@@ -29,7 +29,7 @@ export const basisPointsForFee = (fee: Fee): bigint => {
29
29
  // (1e-7).toString() → "1e-7", which needs to become "0.0000001"
30
30
  let str = fee.fee.toString()
31
31
  if (str.includes("e") || str.includes("E")) {
32
- // toFixed(10) covers fees down to 0.00000001% — far beyond realistic usage.
32
+ // toFixed(10) covers fees down to 0.00000001%, well below any realistic fee.
33
33
  str = fee.fee.toFixed(10).replace(/0+$/, "").replace(/\.$/, "")
34
34
  }
35
35
 
@@ -1,5 +1,4 @@
1
- import type { OpenSeaRateLimitError } from "../types"
2
- import { pluralize } from "./stringHelper"
1
+ import type { OpenSeaApiError } from "../types"
3
2
 
4
3
  /**
5
4
  * Default configuration for rate limit handling
@@ -88,9 +87,9 @@ export async function executeWithRateLimit<T>(
88
87
  return await operation()
89
88
  } catch (error) {
90
89
  lastError = error as Error
91
- const rateLimitError = error as OpenSeaRateLimitError
90
+ const rateLimitError = error as OpenSeaApiError
92
91
 
93
- // Check if this is a rate limit error by status code (robust) or retry-after header
92
+ // Rate limit error if the status code matches (preferred) or a retry-after header is present
94
93
  const isRateLimitError =
95
94
  rateLimitError?.statusCode === RATE_LIMIT_STATUS_CODE ||
96
95
  rateLimitError?.statusCode === CUSTOM_RATE_LIMIT_STATUS_CODE ||
@@ -125,48 +124,3 @@ export async function executeWithRateLimit<T>(
125
124
  // Should never reach here, but TypeScript needs this
126
125
  throw lastError
127
126
  }
128
-
129
- /**
130
- * Execute an array of async operations sequentially with rate limit handling.
131
- * Logs progress after each operation.
132
- *
133
- * @param operations Array of async operations to execute
134
- * @param options Configuration for rate limit handling and progress logging
135
- * @returns Array of results from each operation
136
- */
137
- export async function executeSequentialWithRateLimit<T>(
138
- operations: Array<() => Promise<T>>,
139
- options: RateLimitOptions & {
140
- operationName?: string
141
- } = {},
142
- ): Promise<T[]> {
143
- const {
144
- logger = () => {},
145
- operationName = "operation",
146
- ...rateLimitOptions
147
- } = options
148
-
149
- const results: T[] = []
150
- const total = operations.length
151
-
152
- logger(`Starting ${total} ${pluralize(total, operationName)}...`)
153
-
154
- for (let i = 0; i < operations.length; i++) {
155
- const operation = operations[i]
156
- logger(`Executing ${operationName} ${i + 1}/${total}...`)
157
-
158
- const result = await executeWithRateLimit(operation, {
159
- ...rateLimitOptions,
160
- logger,
161
- })
162
-
163
- results.push(result)
164
- logger(`Completed ${operationName} ${i + 1}/${total}`)
165
- }
166
-
167
- logger(
168
- `All ${total} ${pluralize(total, operationName)} completed successfully`,
169
- )
170
-
171
- return results
172
- }
package/src/viem.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  // seaport-js has a hard dependency on ethers, so importing it pulls ethers
21
- // into the bundle. This is a known tradeoff — see FAQ for details.
21
+ // into the bundle. This is a known tradeoff; see the FAQ.
22
22
  import { Seaport } from "@opensea/seaport-js"
23
23
  import { OpenSeaAPI } from "./api/api"
24
24
  import { createSeaportBridge } from "./provider/seaport-bridge"