Skip to content

Commit

Permalink
add missing fields to Get NFT (#1447)
Browse files Browse the repository at this point in the history
* add missing fields to Get NFT

* bump version
  • Loading branch information
ryanio committed Apr 17, 2024
1 parent 7871778 commit e0a9749
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
22 changes: 22 additions & 0 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ export type NFT = {
image_url: string;
/** URL of metadata */
metadata_url: string;
/** URL on OpenSea */
opensea_url: string;
/** Date of latest NFT update */
updated_at: string;
/** Whether NFT is disabled for trading on OpenSea */
Expand All @@ -219,6 +221,26 @@ export type NFT = {
is_nsfw: boolean;
/** Traits for the NFT, returns null if the NFT has than 50 traits */
traits: Trait[] | null;
/** Creator of the NFT */
creator: string;
/** Owners of the NFT */
owners: {
address: string;
quantity: number;
};
/** Rarity of the NFT */
rarity: null | {
strategy_id: string | null;
strategy_version: string | null;
rank: number | null;
score: number | null;
calculated_at: string;
max_rank: number | null;
tokens_scored: number | null;
ranking_features: null | {
unique_attribute_count: number;
};
};
};

/**
Expand Down
20 changes: 4 additions & 16 deletions test/integration/getNFTs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,11 @@ suite("SDK: NFTs", () => {

test("Get NFT", async () => {
const tokenAddress = "0x4768cbf202f365fbf704b9b9d397551a0443909b"; // Roo Troop
const identifier = "2";
const response = await sdk.api.getNFT(
tokenAddress,
identifier,
Chain.Polygon,
);
const tokenId = "2";
const response = await sdk.api.getNFT(tokenAddress, tokenId, Chain.Polygon);
assert(response.nft, "Response should contain nft.");
assert.equal(
response.nft.contract,
tokenAddress,
"NFT address should match token address",
);
assert.equal(
response.nft.identifier,
identifier,
"NFT address should match token address",
);
assert.equal(response.nft.contract, tokenAddress, "The address matches");
assert.equal(response.nft.identifier, tokenId, "The token id matches");
});

test("Refresh NFT", async () => {
Expand Down

0 comments on commit e0a9749

Please sign in to comment.