Skip to content

Commit

Permalink
Fix incorrect fields in NftNamespace (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
thebrianchen authored Dec 4, 2023
1 parent 2ce49cc commit b5de62f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

### Major Changes

### Minor Changes

- Added a missing `marketplaceAddress` field to the `NftSale` in `NftNamespace.getNftSales()`.
- Fixed an incorrect field name for `bannerImageUrl` in `OpenSeaCollectionMetadata`. Deprecated the old field name `imageBannerUrl`.

## 3.1.0

### Major Changes
Expand Down
1 change: 1 addition & 0 deletions src/internal/raw-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ export interface RawGetNftSalesResponse {

export interface RawNftSale {
marketplace: string;
marketplaceAddress: string;
contractAddress: string;
tokenId: string;
quantity: string;
Expand Down
10 changes: 9 additions & 1 deletion src/types/nft-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,9 @@ export interface NftSale {
/** The marketplace the sale took place on. */
marketplace: NftSaleMarketplace;

/** The marketplace address the sale was on. */
marketplaceAddress: string;

/** The NFT contract address. */
contractAddress: string;

Expand Down Expand Up @@ -1119,8 +1122,13 @@ export interface OpenSeaCollectionMetadata {
safelistRequestStatus?: OpenSeaSafelistRequestStatus;
/** The image URL determined by OpenSea. */
imageUrl?: string;
/** The banner image URL determined by OpenSea. */
/**
* The banner image URL determined by OpenSea.
* @deprecated Use {@link bannerImageUrl} instead.
*/
imageBannerUrl?: string;
/** The banner image URL determined by OpenSea. */
bannerImageUrl?: string;
/** The description of the collection on OpenSea. */
description?: string;
/** The homepage of the collection as determined by OpenSea. */
Expand Down
2 changes: 2 additions & 0 deletions test/test-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export function createOwnedNft(
}

export function createRawNftSale(
marketplaceAddress: string,
contractAddress: string,
tokenId: string,
marketplace: NftSaleMarketplace,
Expand All @@ -195,6 +196,7 @@ export function createRawNftSale(
blockNumber: 15948091,
bundleIndex: 0,
buyerAddress,
marketplaceAddress,
contractAddress,
logIndex: 392,
marketplace,
Expand Down
4 changes: 4 additions & 0 deletions test/unit/nft-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,12 +1399,14 @@ describe('NFT module', () => {

describe('getNftSales', () => {
const contractAddress = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d';
const marketplaceAddress = '0x000440f08436a7b866d1ae42db5e0be801da722a';
const tokenId = '42';
const buyerAddress = '0xa56c6b57127e8881fbe51046058d0ddc1bb9e24f';
const sellerAddress = '0xb60653cc0acff21cdf59e57bcd5de99e305a4c1c';
const templateResponse: RawGetNftSalesResponse = {
nftSales: [
createRawNftSale(
marketplaceAddress,
contractAddress,
tokenId,
NftSaleMarketplace.LOOKSRARE,
Expand All @@ -1413,6 +1415,7 @@ describe('NFT module', () => {
sellerAddress
),
createRawNftSale(
marketplaceAddress,
contractAddress,
tokenId,
NftSaleMarketplace.SEAPORT,
Expand All @@ -1421,6 +1424,7 @@ describe('NFT module', () => {
sellerAddress
),
createRawNftSale(
marketplaceAddress,
contractAddress,
tokenId,
NftSaleMarketplace.X2Y2,
Expand Down

0 comments on commit b5de62f

Please sign in to comment.