@opensea/sdk 9.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 (363) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +70 -0
  3. package/lib/api/accounts.d.ts +27 -0
  4. package/lib/api/accounts.js +46 -0
  5. package/lib/api/accounts.js.map +1 -0
  6. package/lib/api/api.d.ts +489 -0
  7. package/lib/api/api.js +754 -0
  8. package/lib/api/api.js.map +1 -0
  9. package/lib/api/apiPaths.d.ts +46 -0
  10. package/lib/api/apiPaths.js +176 -0
  11. package/lib/api/apiPaths.js.map +1 -0
  12. package/lib/api/chains.d.ts +13 -0
  13. package/lib/api/chains.js +22 -0
  14. package/lib/api/chains.js.map +1 -0
  15. package/lib/api/collections.d.ts +34 -0
  16. package/lib/api/collections.js +80 -0
  17. package/lib/api/collections.js.map +1 -0
  18. package/lib/api/drops.d.ts +21 -0
  19. package/lib/api/drops.js +39 -0
  20. package/lib/api/drops.js.map +1 -0
  21. package/lib/api/events.d.ts +26 -0
  22. package/lib/api/events.js +43 -0
  23. package/lib/api/events.js.map +1 -0
  24. package/lib/api/fetcher.d.ts +24 -0
  25. package/lib/api/fetcher.js +3 -0
  26. package/lib/api/fetcher.js.map +1 -0
  27. package/lib/api/index.d.ts +2 -0
  28. package/lib/api/index.js +19 -0
  29. package/lib/api/index.js.map +1 -0
  30. package/lib/api/listings.d.ts +44 -0
  31. package/lib/api/listings.js +88 -0
  32. package/lib/api/listings.js.map +1 -0
  33. package/lib/api/nfts.d.ts +39 -0
  34. package/lib/api/nfts.js +79 -0
  35. package/lib/api/nfts.js.map +1 -0
  36. package/lib/api/offers.d.ts +54 -0
  37. package/lib/api/offers.js +124 -0
  38. package/lib/api/offers.js.map +1 -0
  39. package/lib/api/orders.d.ts +50 -0
  40. package/lib/api/orders.js +153 -0
  41. package/lib/api/orders.js.map +1 -0
  42. package/lib/api/search.d.ts +13 -0
  43. package/lib/api/search.js +22 -0
  44. package/lib/api/search.js.map +1 -0
  45. package/lib/api/tokens.d.ts +25 -0
  46. package/lib/api/tokens.js +43 -0
  47. package/lib/api/tokens.js.map +1 -0
  48. package/lib/api/types.d.ts +1113 -0
  49. package/lib/api/types.js +65 -0
  50. package/lib/api/types.js.map +1 -0
  51. package/lib/constants.d.ts +22 -0
  52. package/lib/constants.js +52 -0
  53. package/lib/constants.js.map +1 -0
  54. package/lib/index.d.ts +18 -0
  55. package/lib/index.js +24 -0
  56. package/lib/index.js.map +1 -0
  57. package/lib/orders/privateListings.d.ts +12 -0
  58. package/lib/orders/privateListings.js +130 -0
  59. package/lib/orders/privateListings.js.map +1 -0
  60. package/lib/orders/types.d.ts +160 -0
  61. package/lib/orders/types.js +10 -0
  62. package/lib/orders/types.js.map +1 -0
  63. package/lib/orders/utils.d.ts +89 -0
  64. package/lib/orders/utils.js +177 -0
  65. package/lib/orders/utils.js.map +1 -0
  66. package/lib/sdk/assets.d.ts +104 -0
  67. package/lib/sdk/assets.js +398 -0
  68. package/lib/sdk/assets.js.map +1 -0
  69. package/lib/sdk/cancellation.d.ts +97 -0
  70. package/lib/sdk/cancellation.js +235 -0
  71. package/lib/sdk/cancellation.js.map +1 -0
  72. package/lib/sdk/context.d.ts +28 -0
  73. package/lib/sdk/context.js +3 -0
  74. package/lib/sdk/context.js.map +1 -0
  75. package/lib/sdk/fulfillment.d.ts +153 -0
  76. package/lib/sdk/fulfillment.js +298 -0
  77. package/lib/sdk/fulfillment.js.map +1 -0
  78. package/lib/sdk/orders.d.ts +253 -0
  79. package/lib/sdk/orders.js +679 -0
  80. package/lib/sdk/orders.js.map +1 -0
  81. package/lib/sdk/tokens.d.ts +31 -0
  82. package/lib/sdk/tokens.js +65 -0
  83. package/lib/sdk/tokens.js.map +1 -0
  84. package/lib/sdk.d.ts +560 -0
  85. package/lib/sdk.js +693 -0
  86. package/lib/sdk.js.map +1 -0
  87. package/lib/src/api/accounts.d.ts +18 -0
  88. package/lib/src/api/accounts.js +30 -0
  89. package/lib/src/api/accounts.js.map +1 -0
  90. package/lib/src/api/api.d.ts +429 -0
  91. package/lib/src/api/api.js +652 -0
  92. package/lib/src/api/api.js.map +1 -0
  93. package/lib/src/api/apiPaths.d.ts +37 -0
  94. package/lib/src/api/apiPaths.js +140 -0
  95. package/lib/src/api/apiPaths.js.map +1 -0
  96. package/lib/src/api/collections.d.ts +26 -0
  97. package/lib/src/api/collections.js +57 -0
  98. package/lib/src/api/collections.js.map +1 -0
  99. package/lib/src/api/events.d.ts +26 -0
  100. package/lib/src/api/events.js +42 -0
  101. package/lib/src/api/events.js.map +1 -0
  102. package/lib/src/api/fetcher.d.ts +24 -0
  103. package/lib/src/api/fetcher.js +3 -0
  104. package/lib/src/api/fetcher.js.map +1 -0
  105. package/lib/src/api/index.d.ts +2 -0
  106. package/lib/src/api/index.js +19 -0
  107. package/lib/src/api/index.js.map +1 -0
  108. package/lib/src/api/listings.d.ts +44 -0
  109. package/lib/src/api/listings.js +86 -0
  110. package/lib/src/api/listings.js.map +1 -0
  111. package/lib/src/api/nfts.d.ts +35 -0
  112. package/lib/src/api/nfts.js +66 -0
  113. package/lib/src/api/nfts.js.map +1 -0
  114. package/lib/src/api/offers.d.ts +54 -0
  115. package/lib/src/api/offers.js +122 -0
  116. package/lib/src/api/offers.js.map +1 -0
  117. package/lib/src/api/orders.d.ts +50 -0
  118. package/lib/src/api/orders.js +151 -0
  119. package/lib/src/api/orders.js.map +1 -0
  120. package/lib/src/api/search.d.ts +13 -0
  121. package/lib/src/api/search.js +21 -0
  122. package/lib/src/api/search.js.map +1 -0
  123. package/lib/src/api/tokens.d.ts +25 -0
  124. package/lib/src/api/tokens.js +42 -0
  125. package/lib/src/api/tokens.js.map +1 -0
  126. package/lib/src/api/types.d.ts +840 -0
  127. package/lib/src/api/types.js +65 -0
  128. package/lib/src/api/types.js.map +1 -0
  129. package/lib/src/constants.d.ts +22 -0
  130. package/lib/src/constants.js +52 -0
  131. package/lib/src/constants.js.map +1 -0
  132. package/lib/src/index.d.ts +18 -0
  133. package/lib/src/index.js +24 -0
  134. package/lib/src/index.js.map +1 -0
  135. package/lib/src/orders/privateListings.d.ts +12 -0
  136. package/lib/src/orders/privateListings.js +130 -0
  137. package/lib/src/orders/privateListings.js.map +1 -0
  138. package/lib/src/orders/types.d.ts +160 -0
  139. package/lib/src/orders/types.js +10 -0
  140. package/lib/src/orders/types.js.map +1 -0
  141. package/lib/src/orders/utils.d.ts +89 -0
  142. package/lib/src/orders/utils.js +177 -0
  143. package/lib/src/orders/utils.js.map +1 -0
  144. package/lib/src/sdk/assets.d.ts +104 -0
  145. package/lib/src/sdk/assets.js +397 -0
  146. package/lib/src/sdk/assets.js.map +1 -0
  147. package/lib/src/sdk/cancellation.d.ts +97 -0
  148. package/lib/src/sdk/cancellation.js +234 -0
  149. package/lib/src/sdk/cancellation.js.map +1 -0
  150. package/lib/src/sdk/context.d.ts +28 -0
  151. package/lib/src/sdk/context.js +3 -0
  152. package/lib/src/sdk/context.js.map +1 -0
  153. package/lib/src/sdk/fulfillment.d.ts +153 -0
  154. package/lib/src/sdk/fulfillment.js +296 -0
  155. package/lib/src/sdk/fulfillment.js.map +1 -0
  156. package/lib/src/sdk/orders.d.ts +253 -0
  157. package/lib/src/sdk/orders.js +677 -0
  158. package/lib/src/sdk/orders.js.map +1 -0
  159. package/lib/src/sdk/tokens.d.ts +31 -0
  160. package/lib/src/sdk/tokens.js +64 -0
  161. package/lib/src/sdk/tokens.js.map +1 -0
  162. package/lib/src/sdk.d.ts +560 -0
  163. package/lib/src/sdk.js +675 -0
  164. package/lib/src/sdk.js.map +1 -0
  165. package/lib/src/typechain/contracts/ERC1155.d.ts +236 -0
  166. package/lib/src/typechain/contracts/ERC1155.js +3 -0
  167. package/lib/src/typechain/contracts/ERC1155.js.map +1 -0
  168. package/lib/src/typechain/contracts/ERC20.d.ts +141 -0
  169. package/lib/src/typechain/contracts/ERC20.js +3 -0
  170. package/lib/src/typechain/contracts/ERC20.js.map +1 -0
  171. package/lib/src/typechain/contracts/ERC721.d.ts +213 -0
  172. package/lib/src/typechain/contracts/ERC721.js +3 -0
  173. package/lib/src/typechain/contracts/ERC721.js.map +1 -0
  174. package/lib/src/typechain/contracts/Multicall3.d.ts +57 -0
  175. package/lib/src/typechain/contracts/Multicall3.js +3 -0
  176. package/lib/src/typechain/contracts/Multicall3.js.map +1 -0
  177. package/lib/src/typechain/contracts/TransferHelper.d.ts +55 -0
  178. package/lib/src/typechain/contracts/TransferHelper.js +3 -0
  179. package/lib/src/typechain/contracts/TransferHelper.js.map +1 -0
  180. package/lib/src/typechain/contracts/common.d.ts +50 -0
  181. package/lib/src/typechain/contracts/common.js +3 -0
  182. package/lib/src/typechain/contracts/common.js.map +1 -0
  183. package/lib/src/typechain/contracts/factories/ERC1155__factory.d.ts +250 -0
  184. package/lib/src/typechain/contracts/factories/ERC1155__factory.js +332 -0
  185. package/lib/src/typechain/contracts/factories/ERC1155__factory.js.map +1 -0
  186. package/lib/src/typechain/contracts/factories/ERC20__factory.d.ts +174 -0
  187. package/lib/src/typechain/contracts/factories/ERC20__factory.js +240 -0
  188. package/lib/src/typechain/contracts/factories/ERC20__factory.js.map +1 -0
  189. package/lib/src/typechain/contracts/factories/ERC721__factory.d.ts +268 -0
  190. package/lib/src/typechain/contracts/factories/ERC721__factory.js +351 -0
  191. package/lib/src/typechain/contracts/factories/ERC721__factory.js.map +1 -0
  192. package/lib/src/typechain/contracts/factories/Multicall3__factory.d.ts +43 -0
  193. package/lib/src/typechain/contracts/factories/Multicall3__factory.js +68 -0
  194. package/lib/src/typechain/contracts/factories/Multicall3__factory.js.map +1 -0
  195. package/lib/src/typechain/contracts/factories/TransferHelper__factory.d.ts +46 -0
  196. package/lib/src/typechain/contracts/factories/TransferHelper__factory.js +71 -0
  197. package/lib/src/typechain/contracts/factories/TransferHelper__factory.js.map +1 -0
  198. package/lib/src/typechain/contracts/factories/index.d.ts +5 -0
  199. package/lib/src/typechain/contracts/factories/index.js +17 -0
  200. package/lib/src/typechain/contracts/factories/index.js.map +1 -0
  201. package/lib/src/typechain/contracts/index.d.ts +11 -0
  202. package/lib/src/typechain/contracts/index.js +48 -0
  203. package/lib/src/typechain/contracts/index.js.map +1 -0
  204. package/lib/src/types.d.ts +387 -0
  205. package/lib/src/types.js +127 -0
  206. package/lib/src/types.js.map +1 -0
  207. package/lib/src/utils/chain.d.ts +60 -0
  208. package/lib/src/utils/chain.js +248 -0
  209. package/lib/src/utils/chain.js.map +1 -0
  210. package/lib/src/utils/converters.d.ts +37 -0
  211. package/lib/src/utils/converters.js +137 -0
  212. package/lib/src/utils/converters.js.map +1 -0
  213. package/lib/src/utils/dateHelper.d.ts +38 -0
  214. package/lib/src/utils/dateHelper.js +52 -0
  215. package/lib/src/utils/dateHelper.js.map +1 -0
  216. package/lib/src/utils/fees.d.ts +13 -0
  217. package/lib/src/utils/fees.js +29 -0
  218. package/lib/src/utils/fees.js.map +1 -0
  219. package/lib/src/utils/index.d.ts +2 -0
  220. package/lib/src/utils/index.js +19 -0
  221. package/lib/src/utils/index.js.map +1 -0
  222. package/lib/src/utils/protocol.d.ts +75 -0
  223. package/lib/src/utils/protocol.js +161 -0
  224. package/lib/src/utils/protocol.js.map +1 -0
  225. package/lib/src/utils/rateLimit.d.ts +34 -0
  226. package/lib/src/utils/rateLimit.js +97 -0
  227. package/lib/src/utils/rateLimit.js.map +1 -0
  228. package/lib/src/utils/stringHelper.d.ts +18 -0
  229. package/lib/src/utils/stringHelper.js +24 -0
  230. package/lib/src/utils/stringHelper.js.map +1 -0
  231. package/lib/src/utils/utils.d.ts +18 -0
  232. package/lib/src/utils/utils.js +45 -0
  233. package/lib/src/utils/utils.js.map +1 -0
  234. package/lib/typechain/contracts/ERC1155.d.ts +236 -0
  235. package/lib/typechain/contracts/ERC1155.js +3 -0
  236. package/lib/typechain/contracts/ERC1155.js.map +1 -0
  237. package/lib/typechain/contracts/ERC20.d.ts +141 -0
  238. package/lib/typechain/contracts/ERC20.js +3 -0
  239. package/lib/typechain/contracts/ERC20.js.map +1 -0
  240. package/lib/typechain/contracts/ERC721.d.ts +213 -0
  241. package/lib/typechain/contracts/ERC721.js +3 -0
  242. package/lib/typechain/contracts/ERC721.js.map +1 -0
  243. package/lib/typechain/contracts/Multicall3.d.ts +57 -0
  244. package/lib/typechain/contracts/Multicall3.js +3 -0
  245. package/lib/typechain/contracts/Multicall3.js.map +1 -0
  246. package/lib/typechain/contracts/TransferHelper.d.ts +55 -0
  247. package/lib/typechain/contracts/TransferHelper.js +3 -0
  248. package/lib/typechain/contracts/TransferHelper.js.map +1 -0
  249. package/lib/typechain/contracts/common.d.ts +50 -0
  250. package/lib/typechain/contracts/common.js +3 -0
  251. package/lib/typechain/contracts/common.js.map +1 -0
  252. package/lib/typechain/contracts/factories/ERC1155__factory.d.ts +250 -0
  253. package/lib/typechain/contracts/factories/ERC1155__factory.js +332 -0
  254. package/lib/typechain/contracts/factories/ERC1155__factory.js.map +1 -0
  255. package/lib/typechain/contracts/factories/ERC20__factory.d.ts +174 -0
  256. package/lib/typechain/contracts/factories/ERC20__factory.js +240 -0
  257. package/lib/typechain/contracts/factories/ERC20__factory.js.map +1 -0
  258. package/lib/typechain/contracts/factories/ERC721__factory.d.ts +268 -0
  259. package/lib/typechain/contracts/factories/ERC721__factory.js +351 -0
  260. package/lib/typechain/contracts/factories/ERC721__factory.js.map +1 -0
  261. package/lib/typechain/contracts/factories/Multicall3__factory.d.ts +43 -0
  262. package/lib/typechain/contracts/factories/Multicall3__factory.js +68 -0
  263. package/lib/typechain/contracts/factories/Multicall3__factory.js.map +1 -0
  264. package/lib/typechain/contracts/factories/TransferHelper__factory.d.ts +46 -0
  265. package/lib/typechain/contracts/factories/TransferHelper__factory.js +71 -0
  266. package/lib/typechain/contracts/factories/TransferHelper__factory.js.map +1 -0
  267. package/lib/typechain/contracts/factories/index.d.ts +5 -0
  268. package/lib/typechain/contracts/factories/index.js +17 -0
  269. package/lib/typechain/contracts/factories/index.js.map +1 -0
  270. package/lib/typechain/contracts/index.d.ts +11 -0
  271. package/lib/typechain/contracts/index.js +48 -0
  272. package/lib/typechain/contracts/index.js.map +1 -0
  273. package/lib/types.d.ts +389 -0
  274. package/lib/types.js +129 -0
  275. package/lib/types.js.map +1 -0
  276. package/lib/utils/chain.d.ts +64 -0
  277. package/lib/utils/chain.js +211 -0
  278. package/lib/utils/chain.js.map +1 -0
  279. package/lib/utils/chainIds.generated.d.ts +7 -0
  280. package/lib/utils/chainIds.generated.js +37 -0
  281. package/lib/utils/chainIds.generated.js.map +1 -0
  282. package/lib/utils/converters.d.ts +37 -0
  283. package/lib/utils/converters.js +137 -0
  284. package/lib/utils/converters.js.map +1 -0
  285. package/lib/utils/dateHelper.d.ts +38 -0
  286. package/lib/utils/dateHelper.js +52 -0
  287. package/lib/utils/dateHelper.js.map +1 -0
  288. package/lib/utils/fees.d.ts +13 -0
  289. package/lib/utils/fees.js +29 -0
  290. package/lib/utils/fees.js.map +1 -0
  291. package/lib/utils/index.d.ts +2 -0
  292. package/lib/utils/index.js +19 -0
  293. package/lib/utils/index.js.map +1 -0
  294. package/lib/utils/protocol.d.ts +75 -0
  295. package/lib/utils/protocol.js +161 -0
  296. package/lib/utils/protocol.js.map +1 -0
  297. package/lib/utils/rateLimit.d.ts +34 -0
  298. package/lib/utils/rateLimit.js +97 -0
  299. package/lib/utils/rateLimit.js.map +1 -0
  300. package/lib/utils/stringHelper.d.ts +18 -0
  301. package/lib/utils/stringHelper.js +24 -0
  302. package/lib/utils/stringHelper.js.map +1 -0
  303. package/lib/utils/utils.d.ts +18 -0
  304. package/lib/utils/utils.js +45 -0
  305. package/lib/utils/utils.js.map +1 -0
  306. package/package.json +72 -0
  307. package/src/abi/ERC1155.json +314 -0
  308. package/src/abi/ERC20.json +222 -0
  309. package/src/abi/ERC721.json +333 -0
  310. package/src/abi/Multicall3.json +50 -0
  311. package/src/abi/TransferHelper.json +53 -0
  312. package/src/api/accounts.ts +69 -0
  313. package/src/api/api.ts +1152 -0
  314. package/src/api/apiPaths.ts +208 -0
  315. package/src/api/chains.ts +18 -0
  316. package/src/api/collections.ts +120 -0
  317. package/src/api/drops.ts +49 -0
  318. package/src/api/events.ts +71 -0
  319. package/src/api/fetcher.ts +31 -0
  320. package/src/api/index.ts +2 -0
  321. package/src/api/listings.ts +126 -0
  322. package/src/api/nfts.ts +144 -0
  323. package/src/api/offers.ts +242 -0
  324. package/src/api/orders.ts +283 -0
  325. package/src/api/search.ts +21 -0
  326. package/src/api/tokens.ts +67 -0
  327. package/src/api/types.ts +1210 -0
  328. package/src/constants.ts +90 -0
  329. package/src/index.ts +22 -0
  330. package/src/orders/privateListings.ts +173 -0
  331. package/src/orders/types.ts +191 -0
  332. package/src/orders/utils.ts +253 -0
  333. package/src/sdk/assets.ts +591 -0
  334. package/src/sdk/cancellation.ts +346 -0
  335. package/src/sdk/context.ts +33 -0
  336. package/src/sdk/fulfillment.ts +478 -0
  337. package/src/sdk/orders.ts +1149 -0
  338. package/src/sdk/tokens.ts +95 -0
  339. package/src/sdk.ts +1051 -0
  340. package/src/typechain/contracts/ERC1155.ts +440 -0
  341. package/src/typechain/contracts/ERC20.ts +286 -0
  342. package/src/typechain/contracts/ERC721.ts +412 -0
  343. package/src/typechain/contracts/Multicall3.ts +117 -0
  344. package/src/typechain/contracts/TransferHelper.ts +122 -0
  345. package/src/typechain/contracts/common.ts +131 -0
  346. package/src/typechain/contracts/factories/ERC1155__factory.ts +331 -0
  347. package/src/typechain/contracts/factories/ERC20__factory.ts +239 -0
  348. package/src/typechain/contracts/factories/ERC721__factory.ts +350 -0
  349. package/src/typechain/contracts/factories/Multicall3__factory.ts +67 -0
  350. package/src/typechain/contracts/factories/TransferHelper__factory.ts +76 -0
  351. package/src/typechain/contracts/factories/index.ts +8 -0
  352. package/src/typechain/contracts/index.ts +14 -0
  353. package/src/types.ts +413 -0
  354. package/src/utils/chain.ts +224 -0
  355. package/src/utils/chainIds.generated.ts +34 -0
  356. package/src/utils/converters.ts +145 -0
  357. package/src/utils/dateHelper.ts +48 -0
  358. package/src/utils/fees.ts +31 -0
  359. package/src/utils/index.ts +2 -0
  360. package/src/utils/protocol.ts +185 -0
  361. package/src/utils/rateLimit.ts +147 -0
  362. package/src/utils/stringHelper.ts +25 -0
  363. package/src/utils/utils.ts +36 -0
@@ -0,0 +1,652 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenSeaAPI = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const constants_1 = require("../constants");
6
+ const types_1 = require("../types");
7
+ const rateLimit_1 = require("../utils/rateLimit");
8
+ const accounts_1 = require("./accounts");
9
+ const collections_1 = require("./collections");
10
+ const events_1 = require("./events");
11
+ const listings_1 = require("./listings");
12
+ const nfts_1 = require("./nfts");
13
+ const offers_1 = require("./offers");
14
+ const orders_1 = require("./orders");
15
+ const search_1 = require("./search");
16
+ const tokens_1 = require("./tokens");
17
+ const types_2 = require("./types");
18
+ /**
19
+ * The API class for the OpenSea SDK.
20
+ * @category Main Classes
21
+ */
22
+ class OpenSeaAPI {
23
+ /**
24
+ * Create an instance of the OpenSeaAPI
25
+ * @param config OpenSeaAPIConfig for setting up the API, including an optional API key, Chain name, and base URL
26
+ * @param logger Optional function for logging debug strings before and after requests are made. Defaults to no logging
27
+ */
28
+ constructor(config, logger) {
29
+ /**
30
+ * Default size to use for fetching orders
31
+ */
32
+ this.pageSize = 20;
33
+ this.apiKey = config.apiKey;
34
+ this.chain = config.chain ?? types_1.Chain.Mainnet;
35
+ if (config.apiBaseUrl) {
36
+ this.apiBaseUrl = config.apiBaseUrl;
37
+ }
38
+ else {
39
+ this.apiBaseUrl = constants_1.API_BASE_MAINNET;
40
+ }
41
+ // Debugging: default to nothing
42
+ this.logger = logger ?? ((arg) => arg);
43
+ // Create fetcher context
44
+ const fetcher = {
45
+ get: this.get.bind(this),
46
+ post: this.post.bind(this),
47
+ };
48
+ // Initialize specialized API clients
49
+ this.ordersAPI = new orders_1.OrdersAPI(fetcher, this.chain);
50
+ this.offersAPI = new offers_1.OffersAPI(fetcher, this.chain);
51
+ this.listingsAPI = new listings_1.ListingsAPI(fetcher, this.chain);
52
+ this.collectionsAPI = new collections_1.CollectionsAPI(fetcher);
53
+ this.nftsAPI = new nfts_1.NFTsAPI(fetcher, this.chain);
54
+ this.accountsAPI = new accounts_1.AccountsAPI(fetcher, this.chain);
55
+ this.eventsAPI = new events_1.EventsAPI(fetcher);
56
+ this.searchAPI = new search_1.SearchAPI(fetcher);
57
+ this.tokensAPI = new tokens_1.TokensAPI(fetcher);
58
+ }
59
+ /**
60
+ * Gets an order from API based on query options.
61
+ * @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
62
+ * @param options Query options for fetching an order
63
+ * @returns The first {@link OrderV2} returned by the API
64
+ *
65
+ * @throws An error if there are no matching orders.
66
+ */
67
+ async getOrder(options) {
68
+ return this.ordersAPI.getOrder(options);
69
+ }
70
+ /**
71
+ * Gets a single order by its order hash.
72
+ * @param orderHash The hash of the order to fetch
73
+ * @param protocolAddress The address of the seaport contract
74
+ * @param chain The chain where the order is located. Defaults to the chain set in the constructor.
75
+ * @returns The {@link GetOrderByHashResponse} returned by the API (can be Offer or Listing)
76
+ * @throws An error if the order is not found
77
+ */
78
+ async getOrderByHash(orderHash, protocolAddress, chain = this.chain) {
79
+ return this.ordersAPI.getOrderByHash(orderHash, protocolAddress, chain);
80
+ }
81
+ /**
82
+ * Gets a list of orders from API based on query options.
83
+ * @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
84
+ * @param options Query options for fetching orders
85
+ * @returns The {@link GetOrdersResponse} returned by the API.
86
+ */
87
+ async getOrders(options) {
88
+ return this.ordersAPI.getOrders({ ...options, pageSize: this.pageSize });
89
+ }
90
+ /**
91
+ * Gets all offers for a given collection.
92
+ * @param collectionSlug The slug of the collection.
93
+ * @param limit The number of offers to return. Must be between 1 and 100. Default: 100
94
+ * @param next The cursor for the next page of results. This is returned from a previous request.
95
+ * @returns The {@link GetOffersResponse} returned by the API.
96
+ */
97
+ async getAllOffers(collectionSlug, limit, next) {
98
+ return this.offersAPI.getAllOffers(collectionSlug, limit, next);
99
+ }
100
+ /**
101
+ * Gets all listings for a given collection.
102
+ * @param collectionSlug The slug of the collection.
103
+ * @param limit The number of listings to return. Must be between 1 and 100. Default: 100
104
+ * @param next The cursor for the next page of results. This is returned from a previous request.
105
+ * @param includePrivateListings Whether to include private listings (default: false)
106
+ * @returns The {@link GetListingsResponse} returned by the API.
107
+ */
108
+ async getAllListings(collectionSlug, limit, next, includePrivateListings) {
109
+ return this.listingsAPI.getAllListings(collectionSlug, limit, next, includePrivateListings);
110
+ }
111
+ /**
112
+ * Gets trait offers for a given collection.
113
+ * @param collectionSlug The slug of the collection.
114
+ * @param type The name of the trait (e.g. 'Background').
115
+ * @param value The value of the trait (e.g. 'Red').
116
+ * @param limit The number of offers to return. Must be between 1 and 100. Default: 100
117
+ * @param next The cursor for the next page of results. This is returned from a previous request.
118
+ * @param floatValue The value of the trait for decimal-based numeric traits.
119
+ * @param intValue The value of the trait for integer-based numeric traits.
120
+ * @returns The {@link GetOffersResponse} returned by the API.
121
+ */
122
+ async getTraitOffers(collectionSlug, type, value, limit, next, floatValue, intValue) {
123
+ return this.offersAPI.getTraitOffers(collectionSlug, type, value, limit, next, floatValue, intValue);
124
+ }
125
+ /**
126
+ * Gets the best offer for a given token.
127
+ * @param collectionSlug The slug of the collection.
128
+ * @param tokenId The token identifier.
129
+ * @returns The {@link GetBestOfferResponse} returned by the API.
130
+ */
131
+ async getBestOffer(collectionSlug, tokenId) {
132
+ return this.offersAPI.getBestOffer(collectionSlug, tokenId);
133
+ }
134
+ /**
135
+ * Gets the best listing for a given token.
136
+ * @param collectionSlug The slug of the collection.
137
+ * @param tokenId The token identifier.
138
+ * @param includePrivateListings Whether to include private listings (default: false)
139
+ * @returns The {@link GetBestListingResponse} returned by the API.
140
+ */
141
+ async getBestListing(collectionSlug, tokenId, includePrivateListings) {
142
+ return this.listingsAPI.getBestListing(collectionSlug, tokenId, includePrivateListings);
143
+ }
144
+ /**
145
+ * Gets the best listings for a given collection.
146
+ * @param collectionSlug The slug of the collection.
147
+ * @param limit The number of listings to return. Must be between 1 and 100. Default: 100
148
+ * @param next The cursor for the next page of results. This is returned from a previous request.
149
+ * @param includePrivateListings Whether to include private listings (default: false)
150
+ * @returns The {@link GetListingsResponse} returned by the API.
151
+ */
152
+ async getBestListings(collectionSlug, limit, next, includePrivateListings) {
153
+ return this.listingsAPI.getBestListings(collectionSlug, limit, next, includePrivateListings);
154
+ }
155
+ /**
156
+ * Generate the data needed to fulfill a listing or an offer onchain.
157
+ * @param fulfillerAddress The wallet address which will be used to fulfill the order
158
+ * @param orderHash The hash of the order to fulfill
159
+ * @param protocolAddress The address of the seaport contract
160
+ * @param side The side of the order (buy or sell)
161
+ * @param assetContractAddress Optional address of the NFT contract for criteria offers (e.g., collection offers)
162
+ * @param tokenId Optional token ID for criteria offers (e.g., collection offers)
163
+ * @param unitsToFill Optional number of units to fill. Defaults to 1 for both listings and offers.
164
+ * @param recipientAddress Optional recipient address for the NFT when fulfilling a listing. Not applicable for offers.
165
+ * @param includeOptionalCreatorFees Whether to include optional creator fees in the fulfillment. If creator fees are already required, this is a no-op. Defaults to false.
166
+ * @returns The {@link FulfillmentDataResponse}
167
+ */
168
+ async generateFulfillmentData(fulfillerAddress, orderHash, protocolAddress, side, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees = false) {
169
+ return this.ordersAPI.generateFulfillmentData(fulfillerAddress, orderHash, protocolAddress, side, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees);
170
+ }
171
+ /**
172
+ * Post an order to OpenSea.
173
+ * @deprecated Use postListing or postOffer instead.
174
+ * @param order The order to post
175
+ * @param apiOptions API options for the order
176
+ * @returns The {@link OrderV2} posted to the API.
177
+ */
178
+ async postOrder(order, apiOptions) {
179
+ return this.ordersAPI.postOrder(order, apiOptions);
180
+ }
181
+ /**
182
+ * Post a listing to OpenSea. Returns the new v2 Listing response format.
183
+ * @param order The order to post
184
+ * @param protocolAddress The contract address of the seaport protocol
185
+ * @returns The {@link Listing} posted to the API.
186
+ */
187
+ async postListing(order, protocolAddress) {
188
+ return this.ordersAPI.postListing(order, protocolAddress);
189
+ }
190
+ /**
191
+ * Post an offer to OpenSea. Returns the new v2 Offer response format.
192
+ * @param order The order to post
193
+ * @param protocolAddress The contract address of the seaport protocol
194
+ * @returns The {@link Offer} posted to the API.
195
+ */
196
+ async postOffer(order, protocolAddress) {
197
+ return this.ordersAPI.postOffer(order, protocolAddress);
198
+ }
199
+ /**
200
+ * Build a OpenSea collection offer.
201
+ * @param offererAddress The wallet address which is creating the offer.
202
+ * @param quantity The number of NFTs requested in the offer.
203
+ * @param collectionSlug The slug (identifier) of the collection to build the offer for.
204
+ * @param offerProtectionEnabled Build the offer on OpenSea's signed zone to provide offer protections from receiving an item which is disabled from trading.
205
+ * @param traitType If defined, the trait name to create the collection offer for.
206
+ * @param traitValue If defined, the trait value to create the collection offer for.
207
+ * @param traits If defined, an array of traits to create the multi-trait collection offer for.
208
+ * @param numericTraits If defined, an array of numeric trait criteria with min/max ranges.
209
+ * @returns The {@link BuildOfferResponse} returned by the API.
210
+ */
211
+ async buildOffer(offererAddress, quantity, collectionSlug, offerProtectionEnabled = true, traitType, traitValue, traits, numericTraits) {
212
+ return this.offersAPI.buildOffer(offererAddress, quantity, collectionSlug, offerProtectionEnabled, traitType, traitValue, traits, numericTraits);
213
+ }
214
+ /**
215
+ * Get a list collection offers for a given slug.
216
+ * @param slug The slug (identifier) of the collection to list offers for
217
+ * @param limit Optional limit for number of results.
218
+ * @param next Optional cursor for pagination.
219
+ * @returns The {@link GetOffersResponse} returned by the API.
220
+ */
221
+ async getCollectionOffers(slug, limit, next) {
222
+ return this.offersAPI.getCollectionOffers(slug, limit, next);
223
+ }
224
+ /**
225
+ * Post a collection offer to OpenSea.
226
+ * @param order The collection offer to post.
227
+ * @param slug The slug (identifier) of the collection to post the offer for.
228
+ * @param traitType If defined, the trait name to create the collection offer for.
229
+ * @param traitValue If defined, the trait value to create the collection offer for.
230
+ * @param traits If defined, an array of traits to create the multi-trait collection offer for.
231
+ * @param numericTraits If defined, an array of numeric trait criteria with min/max ranges.
232
+ * @returns The {@link Offer} returned to the API.
233
+ */
234
+ async postCollectionOffer(order, slug, traitType, traitValue, traits, numericTraits) {
235
+ return this.offersAPI.postCollectionOffer(order, slug, traitType, traitValue, traits, numericTraits);
236
+ }
237
+ /**
238
+ * Fetch multiple NFTs for a collection.
239
+ * @param slug The slug (identifier) of the collection
240
+ * @param limit The number of NFTs to retrieve. Must be greater than 0 and less than 51.
241
+ * @param next Cursor to retrieve the next page of NFTs
242
+ * @returns The {@link ListNFTsResponse} returned by the API.
243
+ */
244
+ async getNFTsByCollection(slug, limit = undefined, next = undefined) {
245
+ return this.nftsAPI.getNFTsByCollection(slug, limit, next);
246
+ }
247
+ /**
248
+ * Fetch multiple NFTs for a contract.
249
+ * @param address The NFT's contract address.
250
+ * @param limit The number of NFTs to retrieve. Must be greater than 0 and less than 51.
251
+ * @param next Cursor to retrieve the next page of NFTs.
252
+ * @param chain The NFT's chain.
253
+ * @returns The {@link ListNFTsResponse} returned by the API.
254
+ */
255
+ async getNFTsByContract(address, limit = undefined, next = undefined, chain = this.chain) {
256
+ return this.nftsAPI.getNFTsByContract(address, limit, next, chain);
257
+ }
258
+ /**
259
+ * Fetch NFTs owned by an account.
260
+ * @param address The address of the account
261
+ * @param limit The number of NFTs to retrieve. Must be greater than 0 and less than 51.
262
+ * @param next Cursor to retrieve the next page of NFTs
263
+ * @param chain The chain to query. Defaults to the chain set in the constructor.
264
+ * @returns The {@link ListNFTsResponse} returned by the API.
265
+ */
266
+ async getNFTsByAccount(address, limit = undefined, next = undefined, chain = this.chain) {
267
+ return this.nftsAPI.getNFTsByAccount(address, limit, next, chain);
268
+ }
269
+ /**
270
+ * Fetch metadata, traits, ownership information, and rarity for a single NFT.
271
+ * @param address The NFT's contract address.
272
+ * @param identifier the identifier of the NFT (i.e. Token ID)
273
+ * @param chain The NFT's chain.
274
+ * @returns The {@link GetNFTResponse} returned by the API.
275
+ */
276
+ async getNFT(address, identifier, chain = this.chain) {
277
+ return this.nftsAPI.getNFT(address, identifier, chain);
278
+ }
279
+ /**
280
+ * Fetch an OpenSea collection.
281
+ * @param slug The slug (identifier) of the collection.
282
+ * @returns The {@link OpenSeaCollection} returned by the API.
283
+ */
284
+ async getCollection(slug) {
285
+ return this.collectionsAPI.getCollection(slug);
286
+ }
287
+ /**
288
+ * Fetch a list of OpenSea collections.
289
+ * @param orderBy The order to return the collections in. Default: CREATED_DATE
290
+ * @param chain The chain to filter the collections on. Default: all chains
291
+ * @param creatorUsername The creator's OpenSea username to filter the collections on.
292
+ * @param includeHidden If hidden collections should be returned. Default: false
293
+ * @param limit The limit of collections to return.
294
+ * @param next The cursor for the next page of results. This is returned from a previous request.
295
+ * @returns List of {@link OpenSeaCollection} returned by the API.
296
+ */
297
+ async getCollections(orderBy = types_2.CollectionOrderByOption.CREATED_DATE, chain, creatorUsername, includeHidden = false, limit, next) {
298
+ return this.collectionsAPI.getCollections(orderBy, chain, creatorUsername, includeHidden, limit, next);
299
+ }
300
+ /**
301
+ * Fetch stats for an OpenSea collection.
302
+ * @param slug The slug (identifier) of the collection.
303
+ * @returns The {@link OpenSeaCollection} returned by the API.
304
+ */
305
+ async getCollectionStats(slug) {
306
+ return this.collectionsAPI.getCollectionStats(slug);
307
+ }
308
+ /**
309
+ * Fetch a payment token.
310
+ * @param address The address of the payment token
311
+ * @param chain The chain of the payment token
312
+ * @returns The {@link OpenSeaPaymentToken} returned by the API.
313
+ */
314
+ async getPaymentToken(address, chain = this.chain) {
315
+ return this.accountsAPI.getPaymentToken(address, chain);
316
+ }
317
+ /**
318
+ * Fetch account for an address.
319
+ * @param address The address to fetch the account for
320
+ * @returns The {@link OpenSeaAccount} returned by the API.
321
+ */
322
+ async getAccount(address) {
323
+ return this.accountsAPI.getAccount(address);
324
+ }
325
+ /**
326
+ * Force refresh the metadata for an NFT.
327
+ * @param address The address of the NFT's contract.
328
+ * @param identifier The identifier of the NFT.
329
+ * @param chain The chain where the NFT is located.
330
+ * @returns The response from the API.
331
+ */
332
+ async refreshNFTMetadata(address, identifier, chain = this.chain) {
333
+ return this.nftsAPI.refreshNFTMetadata(address, identifier, chain);
334
+ }
335
+ /**
336
+ * Offchain cancel an order, offer or listing, by its order hash when protected by the SignedZone.
337
+ * Protocol and Chain are required to prevent hash collisions.
338
+ * Please note cancellation is only assured if a fulfillment signature was not vended prior to cancellation.
339
+ * @param protocolAddress The Seaport address for the order.
340
+ * @param orderHash The order hash, or external identifier, of the order.
341
+ * @param chain The chain where the order is located.
342
+ * @param offererSignature An EIP-712 signature from the offerer of the order.
343
+ * If this is not provided, the user associated with the API Key will be checked instead.
344
+ * The signature must be a EIP-712 signature consisting of the order's Seaport contract's
345
+ * name, version, address, and chain. The struct to sign is `OrderHash` containing a
346
+ * single bytes32 field.
347
+ * @returns The response from the API.
348
+ */
349
+ async offchainCancelOrder(protocolAddress, orderHash, chain = this.chain, offererSignature) {
350
+ return this.ordersAPI.offchainCancelOrder(protocolAddress, orderHash, chain, offererSignature);
351
+ }
352
+ /**
353
+ * Gets a list of events based on query parameters.
354
+ * @param args Query parameters for filtering events.
355
+ * @returns The {@link GetEventsResponse} returned by the API.
356
+ */
357
+ async getEvents(args) {
358
+ return this.eventsAPI.getEvents(args);
359
+ }
360
+ /**
361
+ * Gets a list of events for a specific account.
362
+ * @param address The account address.
363
+ * @param args Query parameters for filtering events.
364
+ * @returns The {@link GetEventsResponse} returned by the API.
365
+ */
366
+ async getEventsByAccount(address, args) {
367
+ return this.eventsAPI.getEventsByAccount(address, args);
368
+ }
369
+ /**
370
+ * Gets a list of events for a specific collection.
371
+ * @param collectionSlug The slug (identifier) of the collection.
372
+ * @param args Query parameters for filtering events.
373
+ * @returns The {@link GetEventsResponse} returned by the API.
374
+ */
375
+ async getEventsByCollection(collectionSlug, args) {
376
+ return this.eventsAPI.getEventsByCollection(collectionSlug, args);
377
+ }
378
+ /**
379
+ * Gets a list of events for a specific NFT.
380
+ * @param chain The chain where the NFT is located.
381
+ * @param address The contract address of the NFT.
382
+ * @param identifier The token identifier.
383
+ * @param args Query parameters for filtering events.
384
+ * @returns The {@link GetEventsResponse} returned by the API.
385
+ */
386
+ async getEventsByNFT(chain, address, identifier, args) {
387
+ return this.eventsAPI.getEventsByNFT(chain, address, identifier, args);
388
+ }
389
+ /**
390
+ * Fetch smart contract information for a given chain and address.
391
+ * @param address The contract address.
392
+ * @param chain The chain where the contract is deployed. Defaults to the chain set in the constructor.
393
+ * @returns The {@link GetContractResponse} returned by the API.
394
+ */
395
+ async getContract(address, chain = this.chain) {
396
+ return this.nftsAPI.getContract(address, chain);
397
+ }
398
+ /**
399
+ * Fetch all traits for a collection with their possible values and counts.
400
+ * @param collectionSlug The slug (identifier) of the collection.
401
+ * @returns The {@link GetTraitsResponse} returned by the API.
402
+ */
403
+ async getTraits(collectionSlug) {
404
+ return this.collectionsAPI.getTraits(collectionSlug);
405
+ }
406
+ /**
407
+ * Gets a list of trending tokens.
408
+ * @param args Optional query parameters for pagination.
409
+ * @returns The {@link GetTrendingTokensResponse} returned by the API.
410
+ */
411
+ async getTrendingTokens(args) {
412
+ return this.tokensAPI.getTrendingTokens(args);
413
+ }
414
+ /**
415
+ * Gets a list of top tokens.
416
+ * @param args Optional query parameters for pagination.
417
+ * @returns The {@link GetTopTokensResponse} returned by the API.
418
+ */
419
+ async getTopTokens(args) {
420
+ return this.tokensAPI.getTopTokens(args);
421
+ }
422
+ /**
423
+ * Gets a swap quote for exchanging tokens.
424
+ * @param args Query parameters for the swap quote including token addresses, amount, and chain.
425
+ * @returns The {@link GetSwapQuoteResponse} returned by the API.
426
+ */
427
+ async getSwapQuote(args) {
428
+ return this.tokensAPI.getSwapQuote(args);
429
+ }
430
+ /**
431
+ * Gets details for a specific token.
432
+ * @param chain The chain the token is on.
433
+ * @param address The token contract address.
434
+ * @returns The {@link GetTokenResponse} returned by the API.
435
+ */
436
+ async getToken(chain, address) {
437
+ return this.tokensAPI.getToken(chain, address);
438
+ }
439
+ /**
440
+ * Search across collections, tokens, NFTs, and accounts.
441
+ * Results are ranked by relevance.
442
+ * @param args Query parameters including query text, optional chain/asset type filters, and limit.
443
+ * @returns The {@link SearchResponse} returned by the API.
444
+ */
445
+ async search(args) {
446
+ return this.searchAPI.search(args);
447
+ }
448
+ /**
449
+ * Gets all active offers for a specific NFT (not just the best offer).
450
+ * @param assetContractAddress The NFT contract address.
451
+ * @param tokenId The token identifier.
452
+ * @param limit The number of offers to return. Must be between 1 and 100.
453
+ * @param next The cursor for the next page of results. This is returned from a previous request.
454
+ * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
455
+ * @returns The {@link GetOffersResponse} returned by the API.
456
+ */
457
+ async getNFTOffers(assetContractAddress, tokenId, limit, next, chain = this.chain) {
458
+ return this.offersAPI.getNFTOffers(assetContractAddress, tokenId, limit, next, chain);
459
+ }
460
+ /**
461
+ * Gets all active listings for a specific NFT (not just the best listing).
462
+ * @param assetContractAddress The NFT contract address.
463
+ * @param tokenId The token identifier.
464
+ * @param limit The number of listings to return. Must be between 1 and 100.
465
+ * @param next The cursor for the next page of results. This is returned from a previous request.
466
+ * @param chain The chain where the NFT is located. Defaults to the chain set in the constructor.
467
+ * @param includePrivateListings Whether to include private listings (default: false)
468
+ * @returns The {@link GetListingsResponse} returned by the API.
469
+ */
470
+ async getNFTListings(assetContractAddress, tokenId, limit, next, chain = this.chain, includePrivateListings) {
471
+ return this.listingsAPI.getNFTListings(assetContractAddress, tokenId, limit, next, chain, includePrivateListings);
472
+ }
473
+ /**
474
+ * Generic fetch method for any API endpoint with automatic rate limit retry
475
+ * @param apiPath Path to URL endpoint under API
476
+ * @param query URL query params. Will be used to create a URLSearchParams object.
477
+ * @param options Request options like timeout and abort signal.
478
+ * @returns @typeParam T The response from the API.
479
+ */
480
+ async get(apiPath, query = {}, options) {
481
+ return (0, rateLimit_1.executeWithRateLimit)(async () => {
482
+ const qs = this.objectToSearchParams(query);
483
+ const url = qs
484
+ ? `${this.apiBaseUrl}${apiPath}?${qs}`
485
+ : `${this.apiBaseUrl}${apiPath}`;
486
+ return await this._fetch(url, undefined, undefined, options);
487
+ }, { logger: this.logger });
488
+ }
489
+ /**
490
+ * Generic post method for any API endpoint with automatic rate limit retry
491
+ * @param apiPath Path to URL endpoint under API
492
+ * @param body Data to send.
493
+ * @param headers Additional headers to send with the request.
494
+ * @param options Request options like timeout and abort signal.
495
+ * @returns @typeParam T The response from the API.
496
+ */
497
+ async post(apiPath, body, headers, options) {
498
+ return (0, rateLimit_1.executeWithRateLimit)(async () => {
499
+ const url = `${this.apiBaseUrl}${apiPath}`;
500
+ return await this._fetch(url, headers, body, options);
501
+ }, { logger: this.logger });
502
+ }
503
+ objectToSearchParams(params = {}) {
504
+ const urlSearchParams = new URLSearchParams();
505
+ Object.entries(params).forEach(([key, value]) => {
506
+ if (Array.isArray(value)) {
507
+ value.forEach(item => {
508
+ if (item != null) {
509
+ urlSearchParams.append(key, String(item));
510
+ }
511
+ });
512
+ }
513
+ else if (value != null) {
514
+ urlSearchParams.append(key, String(value));
515
+ }
516
+ });
517
+ return urlSearchParams.toString();
518
+ }
519
+ /**
520
+ * Fetch from an API Endpoint, sending auth token in headers
521
+ * @param url The URL to fetch
522
+ * @param headers Additional headers to send with the request
523
+ * @param body Optional body to send. If set, will POST, otherwise GET
524
+ * @param options Request options like timeout and abort signal
525
+ */
526
+ async _fetch(url, headers, body, options) {
527
+ // Create the fetch request
528
+ const req = new ethers_1.ethers.FetchRequest(url);
529
+ // Set the headers
530
+ headers = {
531
+ "x-app-id": "opensea-js",
532
+ ...(this.apiKey ? { "X-API-KEY": this.apiKey } : {}),
533
+ ...headers,
534
+ };
535
+ for (const [key, value] of Object.entries(headers)) {
536
+ req.setHeader(key, value);
537
+ }
538
+ // Set the body if provided
539
+ if (body) {
540
+ req.body = body;
541
+ }
542
+ // Apply request options
543
+ if (options?.timeout !== undefined) {
544
+ req.timeout = options.timeout;
545
+ }
546
+ // Set up abort signal handling
547
+ let abortHandler;
548
+ if (options?.signal) {
549
+ if (options.signal.aborted) {
550
+ throw new Error("Request aborted");
551
+ }
552
+ abortHandler = () => req.cancel();
553
+ options.signal.addEventListener("abort", abortHandler);
554
+ }
555
+ // Set the throttle params
556
+ req.setThrottleParams({ slotInterval: 1000 });
557
+ const sanitizedHeaders = { ...req.headers };
558
+ delete sanitizedHeaders["X-API-KEY"];
559
+ this.logger(`Sending request: ${url} ${JSON.stringify({
560
+ method: body ? "POST" : "GET",
561
+ headers: sanitizedHeaders,
562
+ body: body ? JSON.stringify(body, null, 2) : undefined,
563
+ })}`);
564
+ try {
565
+ const response = await req.send();
566
+ if (!response.ok()) {
567
+ // Handle rate limit errors (429 Too Many Requests and 599 custom rate limit)
568
+ if (response.statusCode === 599 || response.statusCode === 429) {
569
+ throw this._createRateLimitError(response);
570
+ }
571
+ // If an errors array is returned, throw with the error messages.
572
+ const errors = response.bodyJson?.errors;
573
+ if (errors?.length > 0) {
574
+ let errorMessage = Array.isArray(errors)
575
+ ? errors.join(", ")
576
+ : String(errors);
577
+ if (errorMessage === "[object Object]") {
578
+ errorMessage = JSON.stringify(errors);
579
+ }
580
+ throw new Error(`Server Error: ${errorMessage}`);
581
+ }
582
+ else {
583
+ // Otherwise, let ethers throw a SERVER_ERROR since it will include
584
+ // more context about the request and response.
585
+ response.assertOk();
586
+ }
587
+ }
588
+ return response.bodyJson;
589
+ }
590
+ finally {
591
+ // Clean up abort handler
592
+ if (abortHandler && options?.signal) {
593
+ options.signal.removeEventListener("abort", abortHandler);
594
+ }
595
+ }
596
+ }
597
+ /**
598
+ * Parses the retry-after header from the response with robust error handling.
599
+ * @param response The HTTP response object from the API
600
+ * @returns The retry-after value in seconds (capped at 5 minutes), or undefined if not present or invalid
601
+ */
602
+ _parseRetryAfter(response) {
603
+ const retryAfterHeader = response.headers["retry-after"] || response.headers["Retry-After"];
604
+ if (retryAfterHeader) {
605
+ const trimmed = retryAfterHeader.trim();
606
+ // If it starts with a digit or minus sign, treat as numeric
607
+ if (/^-?\d/.test(trimmed)) {
608
+ // Only accept fully numeric integer values, reject malformed inputs like "5s" or "1.5"
609
+ if (!/^-?\d+$/.test(trimmed)) {
610
+ return undefined;
611
+ }
612
+ const parsedSeconds = Number(trimmed);
613
+ if (!Number.isSafeInteger(parsedSeconds) || parsedSeconds <= 0) {
614
+ return undefined;
615
+ }
616
+ return Math.min(parsedSeconds, OpenSeaAPI.MAX_RETRY_AFTER_SECONDS);
617
+ }
618
+ // Otherwise, try to parse as HTTP-date
619
+ const parsedDateMs = Date.parse(trimmed);
620
+ if (Number.isNaN(parsedDateMs)) {
621
+ return undefined;
622
+ }
623
+ const diffSeconds = Math.ceil((parsedDateMs - Date.now()) / 1000);
624
+ if (diffSeconds <= 0) {
625
+ return undefined;
626
+ }
627
+ return Math.min(diffSeconds, OpenSeaAPI.MAX_RETRY_AFTER_SECONDS);
628
+ }
629
+ return undefined;
630
+ }
631
+ /**
632
+ * Creates a rate limit error with status code and retry-after information.
633
+ * @param response The HTTP response object from the API
634
+ * @returns An enhanced Error object with statusCode, retryAfter and responseBody properties
635
+ */
636
+ _createRateLimitError(response) {
637
+ const retryAfter = this._parseRetryAfter(response);
638
+ const error = new Error(`${response.statusCode} ${response.statusMessage}`);
639
+ // Add status code and retry-after information to the error object
640
+ error.statusCode = response.statusCode;
641
+ error.retryAfter = retryAfter;
642
+ error.responseBody = response.bodyJson;
643
+ return error;
644
+ }
645
+ }
646
+ exports.OpenSeaAPI = OpenSeaAPI;
647
+ /**
648
+ * Maximum retry-after value in seconds (5 minutes).
649
+ * Prevents excessively long waits from buggy or malicious servers.
650
+ */
651
+ OpenSeaAPI.MAX_RETRY_AFTER_SECONDS = 300;
652
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"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