Skip to content

Commit

Permalink
updated Price type (mismatch with API response) and added a few asser…
Browse files Browse the repository at this point in the history
…ts examples for price in "BestOffer"
  • Loading branch information
crypt0biwan committed Jan 28, 2025
1 parent 831ed21 commit ec6c28a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,9 @@ export type CollectionOffer = Required<Pick<Offer, "criteria">> & Offer;
* @category API Models
*/
export type Price = {
current: {
currency: string;
decimals: number;
value: string;
};
currency: string;
decimals: number;
value: string;
};

/**
Expand Down
4 changes: 4 additions & 0 deletions test/integration/getListingsAndOffers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ suite("SDK: getBestOffer", () => {
const tokenId = 1;
const response = await sdk.api.getBestOffer(slug, tokenId);

assert.isString(response.price.currency, "Currency should be a string");
assert.isNumber(response.price.decimals, "Decimals should be a number");
assert.isString(response.price.value, "Price value should be a string");

assert(response, "Response should not be null");
assert(response.order_hash, "Order hash should not be null");
assert(response.chain, "Chain should not be null");
Expand Down

0 comments on commit ec6c28a

Please sign in to comment.