Skip to content

Commit 54014c0

Browse files
committed
add types for core assets
1 parent 3d2a59a commit 54014c0

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

clients/js/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Examples are provided [here](#examples) and you can learn more about this libra
3737
> **Note**
3838
> The plugin can be used with any RPC that supports the Metaplex DAS API specification. You might need to contact your RPC provider to "enable" the Metaplex DAS API on your endpoint.
3939
40+
## Working with `mpl-core`
41+
42+
Core assets and collections are also indexed by DAS. It is recommended to use this package in conjunction with the [mpl-core-das](http://github.com/metaplex-foundation/mpl-core-das) if you are working with Core assets.
43+
4044
## Methods
4145

4246
> 💡 You can test each method of the API using the [OpenRPC playground](https://playground.open-rpc.org/?url=https://raw.githubusercontent.com/metaplex-foundation/digital-asset-standard-api/main/specification/metaplex-das-api.json).

clients/js/src/types.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,44 @@ export type DasApiAsset = {
216216
* Indicates whether the asset is burnt or not.
217217
*/
218218
burnt: boolean;
219+
} & DasApiCoreAssetFields;
220+
221+
/**
222+
* Optional fields on an asset if the interface is for Core (i.e. interface is 'MplCoreAsset' or 'MplCoreCollection')
223+
* It is recommended to use the mpl-core-das package along with this one to convert the types
224+
* to be consistent with mpl-core (e.g. AssetV1)
225+
*/
226+
export type DasApiCoreAssetFields = {
227+
/**
228+
* Plugins active on the asset or collection
229+
*/
230+
plugins?: Record<string, any>;
231+
/**
232+
* External plugins active on the asset or collection
233+
*/
234+
external_plugins?: Record<string, any>[];
235+
/**
236+
* Plugins on asset that were unknown at the time of indexing.
237+
* Contact your DAS provider to update their core indexing version if this field is being populated.
238+
* If you have a newer version of mpl-core-das installed, that library will also try to deserialize the plugin
239+
*/
240+
unknown_plugins?: Record<string, any>[];
241+
/**
242+
* Additional fields that are indexed for Core assets or collections
243+
*/
244+
mpl_core_info?: {
245+
/**
246+
* Number of assets minted to this collection
247+
* Only applicable for collections
248+
*/
249+
num_minted?: number;
250+
/**
251+
* Current number of assets in this collection
252+
* Only applicable for collections
253+
*/
254+
current_size?: number;
255+
plugins_json_version: number;
256+
};
219257
};
220258

221259
/**
@@ -296,7 +334,9 @@ export type DasApiAssetInterface =
296334
| 'Custom'
297335
| 'Identity'
298336
| 'Executable'
299-
| 'ProgrammableNFT';
337+
| 'ProgrammableNFT'
338+
| 'MplCoreAsset'
339+
| 'MplCoreCollection';
300340

301341
export type DasApiAssetContent = {
302342
json_uri: string;

0 commit comments

Comments
 (0)