Skip to content

Commit 56c35c3

Browse files
committed
fix
1 parent 66ef830 commit 56c35c3

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

src/api/api.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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

src/api/orders.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
import {
77
GetOrdersResponse,
88
CancelOrderResponse,
9-
GetOrderByHashResponse,
9+
Offer,
10+
Listing,
1011
} from "./types";
1112
import {
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
}

src/api/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,6 @@ export type GetBestOfferResponse = Offer | CollectionOffer;
243243
*/
244244
export 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

test/api/getOrderByHash.spec.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import { expect } from "chai";
22
import { suite, test } from "mocha";
33
import * as sinon from "sinon";
44
import { 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";
116
import { OrderType, ProtocolData } from "../../src/orders/types";
127
import { Chain } from "../../src/types";
138
import { 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
);

0 commit comments

Comments
 (0)