Skip to content

Commit 9f7203f

Browse files
sahar-fehriMajorLift
authored andcommitted
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 8ea6ab2 commit 9f7203f

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
@@ -65,6 +65,7 @@ import type {
6565
Attributes,
6666
LastSale,
6767
GetCollectionsResponse,
68+
TopBid,
6869
} from './NftDetectionController';
6970

7071
type NFTStandardType = 'ERC721' | 'ERC1155';
@@ -176,9 +177,10 @@ export type NftMetadata = {
176177
tokenURI?: string | null;
177178
collection?: Collection;
178179
address?: string;
179-
attributes?: Attributes;
180+
attributes?: Attributes[];
180181
lastSale?: LastSale;
181182
rarityRank?: string;
183+
topBid?: TopBid;
182184
};
183185

184186
/**

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)