Skip to content

Commit aae51a9

Browse files
authored
fix: fix types (#4522)
## Explanation Added optional types on the `NftMetadata` type. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? For example: * Fixes #12345 * Related to #67890 --> ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/assets-controllers` - **ADDED**: Added optional `topBid` type in `NftMetadata` type - **ADDED**: Added optional `floorAsk` in `TokenCollection` type - **FIXED**: Fixed type. attributes in NftMetadata to be `Attributes[]` ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate
1 parent 6aaa484 commit aae51a9

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/assets-controllers/src/NftController.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import type {
5858
Attributes,
5959
LastSale,
6060
GetCollectionsResponse,
61+
TopBid,
6162
} from './NftDetectionController';
6263

6364
type NFTStandardType = 'ERC721' | 'ERC1155';
@@ -169,9 +170,10 @@ export type NftMetadata = {
169170
tokenURI?: string | null;
170171
collection?: Collection;
171172
address?: string;
172-
attributes?: Attributes;
173+
attributes?: Attributes[];
173174
lastSale?: LastSale;
174175
rarityRank?: string;
176+
topBid?: TopBid;
175177
};
176178

177179
/**

packages/assets-controllers/src/NftDetectionController.ts

+21
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,26 @@ export type CollectionResponse = {
351351
};
352352
};
353353

354+
export type FloorAskCollection = {
355+
id?: string;
356+
price?: Price;
357+
maker?: string;
358+
kind?: string;
359+
validFrom?: number;
360+
validUntil?: number;
361+
source?: SourceCollection;
362+
rawData?: Metadata;
363+
isNativeOffChainCancellable?: boolean;
364+
};
365+
366+
export type SourceCollection = {
367+
id: string;
368+
domain: string;
369+
name: string;
370+
icon: string;
371+
url: string;
372+
};
373+
354374
export type TokenCollection = {
355375
id?: string;
356376
name?: string;
@@ -367,6 +387,7 @@ export type TokenCollection = {
367387
floorAskPrice?: Price;
368388
royaltiesBps?: number;
369389
royalties?: Royalties[];
390+
floorAsk?: FloorAskCollection;
370391
};
371392

372393
export type Collection = TokenCollection & CollectionResponse;

0 commit comments

Comments
 (0)