File tree Expand file tree Collapse file tree 4 files changed +10
-20
lines changed
Expand file tree Collapse file tree 4 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ import {
3434 GetBestListingResponse ,
3535 GetOffersResponse ,
3636 GetListingsResponse ,
37- GetOrderByHashResponse ,
37+ Offer ,
38+ Listing ,
3839 CollectionOffer ,
3940 CollectionOrderByOption ,
4041 CancelOrderResponse ,
@@ -127,14 +128,14 @@ export class OpenSeaAPI {
127128 * @param orderHash The hash of the order to fetch
128129 * @param protocolAddress The address of the seaport contract
129130 * @param chain The chain where the order is located. Defaults to the chain set in the constructor.
130- * @returns The {@link GetOrderByHashResponse} returned by the API (can be Offer or Listing)
131+ * @returns The {@link Offer} or { @link Listing} returned by the API
131132 * @throws An error if the order is not found
132133 */
133134 public async getOrderByHash (
134135 orderHash : string ,
135136 protocolAddress : string ,
136137 chain : Chain = this . chain ,
137- ) : Promise < GetOrderByHashResponse > {
138+ ) : Promise < Offer | Listing > {
138139 return this . ordersAPI . getOrderByHash ( orderHash , protocolAddress , chain ) ;
139140 }
140141
Original file line number Diff line number Diff line change 66import {
77 GetOrdersResponse ,
88 CancelOrderResponse ,
9- GetOrderByHashResponse ,
9+ Offer ,
10+ Listing ,
1011} from "./types" ;
1112import {
1213 FulfillmentDataResponse ,
@@ -82,9 +83,9 @@ export class OrdersAPI {
8283 orderHash : string ,
8384 protocolAddress : string ,
8485 chain : Chain = this . chain ,
85- ) : Promise < GetOrderByHashResponse > {
86+ ) : Promise < Offer | Listing > {
8687 const response = await this . fetcher . get < {
87- order : GetOrderByHashResponse ;
88+ order : Offer | Listing ;
8889 } > ( getOrderByHashPath ( chain , protocolAddress , orderHash ) ) ;
8990 return response . order ;
9091 }
Original file line number Diff line number Diff line change @@ -243,13 +243,6 @@ export type GetBestOfferResponse = Offer | CollectionOffer;
243243 */
244244export type GetBestListingResponse = Listing ;
245245
246- /**
247- * Response from OpenSea API for fetching an order by hash.
248- * Can be either an Offer or a Listing.
249- * @category API Response Types
250- */
251- export type GetOrderByHashResponse = Offer | Listing ;
252-
253246/**
254247 * Response from OpenSea API for offchain canceling an order.
255248 * @category API Response Types
Original file line number Diff line number Diff line change @@ -2,12 +2,7 @@ import { expect } from "chai";
22import { suite , test } from "mocha" ;
33import * as sinon from "sinon" ;
44import { OrdersAPI } from "../../src/api/orders" ;
5- import {
6- GetOrderByHashResponse ,
7- Offer ,
8- Listing ,
9- OrderStatus ,
10- } from "../../src/api/types" ;
5+ import { Offer , Listing , OrderStatus } from "../../src/api/types" ;
116import { OrderType , ProtocolData } from "../../src/orders/types" ;
127import { Chain } from "../../src/types" ;
138import { createMockFetcher } from "../fixtures/fetcher" ;
@@ -193,7 +188,7 @@ suite("API: OrdersAPI.getOrderByHash", () => {
193188
194189 mockGet . resolves ( { order : mockOffer } ) ;
195190
196- const result : GetOrderByHashResponse = await ordersAPI . getOrderByHash (
191+ const result : Offer | Listing = await ordersAPI . getOrderByHash (
197192 "0x123" ,
198193 "0xprotocol" ,
199194 ) ;
You can’t perform that action at this time.
0 commit comments