Skip to content

Commit e0a9749

Browse files
authored
add missing fields to Get NFT (#1447)
* add missing fields to Get NFT * bump version
1 parent 7871778 commit e0a9749

2 files changed

Lines changed: 26 additions & 16 deletions

File tree

src/api/types.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ export type NFT = {
211211
image_url: string;
212212
/** URL of metadata */
213213
metadata_url: string;
214+
/** URL on OpenSea */
215+
opensea_url: string;
214216
/** Date of latest NFT update */
215217
updated_at: string;
216218
/** Whether NFT is disabled for trading on OpenSea */
@@ -219,6 +221,26 @@ export type NFT = {
219221
is_nsfw: boolean;
220222
/** Traits for the NFT, returns null if the NFT has than 50 traits */
221223
traits: Trait[] | null;
224+
/** Creator of the NFT */
225+
creator: string;
226+
/** Owners of the NFT */
227+
owners: {
228+
address: string;
229+
quantity: number;
230+
};
231+
/** Rarity of the NFT */
232+
rarity: null | {
233+
strategy_id: string | null;
234+
strategy_version: string | null;
235+
rank: number | null;
236+
score: number | null;
237+
calculated_at: string;
238+
max_rank: number | null;
239+
tokens_scored: number | null;
240+
ranking_features: null | {
241+
unique_attribute_count: number;
242+
};
243+
};
222244
};
223245

224246
/**

test/integration/getNFTs.spec.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,11 @@ suite("SDK: NFTs", () => {
3434

3535
test("Get NFT", async () => {
3636
const tokenAddress = "0x4768cbf202f365fbf704b9b9d397551a0443909b"; // Roo Troop
37-
const identifier = "2";
38-
const response = await sdk.api.getNFT(
39-
tokenAddress,
40-
identifier,
41-
Chain.Polygon,
42-
);
37+
const tokenId = "2";
38+
const response = await sdk.api.getNFT(tokenAddress, tokenId, Chain.Polygon);
4339
assert(response.nft, "Response should contain nft.");
44-
assert.equal(
45-
response.nft.contract,
46-
tokenAddress,
47-
"NFT address should match token address",
48-
);
49-
assert.equal(
50-
response.nft.identifier,
51-
identifier,
52-
"NFT address should match token address",
53-
);
40+
assert.equal(response.nft.contract, tokenAddress, "The address matches");
41+
assert.equal(response.nft.identifier, tokenId, "The token id matches");
5442
});
5543

5644
test("Refresh NFT", async () => {

0 commit comments

Comments
 (0)