diff --git a/docs-src/src/collections.md b/docs-src/src/collections.md index 88c0203c..267a353a 100644 --- a/docs-src/src/collections.md +++ b/docs-src/src/collections.md @@ -1,6 +1,6 @@ -## Collections +# Collections -### Migrate +## Migrate Migrate a collection of NFTs to be part of a single on-chain Metaplex Certified Collection (MCC). @@ -94,12 +94,34 @@ Use `--output-file` or `-o` to specify the path and name of the JSON file to wri e.g.: -``` +```bash metaboss collections migrate -L devnet_test_mints.json -m 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq -o ~/Desktop/my-cache3.json ``` This will override both the default cache file name ('mb-cache-migrate.json') and the cache file name passed in with `--cache-file`. +## Get and Check Collection Items + +### Get-Items + +Metaboss now has experimental support for getting all collection items from a given mint using off-chain, indexed data from https://theindex.io/. Other indexers or methods may be supported later. To use this feature, you need to sign up for a free account with TheIndex to get an API key. + +```bash +metaboss collections get-items --collection-mint --api-key +``` +where `--collection_mint` is the mint account of the parent collection NFT and `--api-key` is your API Key from theindex.io. There's an additional command `--method` which can be used to support other indexers in the future but defaults to theindex.io for now so can be elided. + +This command creates a JSON file named `_collection_items.json` in the directory it is run in. + +### Check-Items + +Given a list of mint addresses and a collection mint address, this command checks all the items in the list to see if they belong to the specified collection. + +```bash +metaboss collections check-items --collection-mint -L +``` + +This command has a `--debug` flag, which creates a JSON file when set with a mapping of all collection NFTs found associated with the list of addresses and which ones belong to each. Report bugs and questions to the [Metaboss Discord](https://discord.gg/2f7N25NJkg). diff --git a/src/collections/data.rs b/src/collections/data.rs index 67dd5069..066208de 100644 --- a/src/collections/data.rs +++ b/src/collections/data.rs @@ -93,7 +93,7 @@ impl FromStr for GetCollectionItemsMethods { fn from_str(s: &str) -> Result { match s { - "the_indexer" => Ok(GetCollectionItemsMethods::TheIndexIO), + "the_index_io" => Ok(GetCollectionItemsMethods::TheIndexIO), _ => Err(format!("Invalid method: {}", s)), } } diff --git a/src/collections/methods.rs b/src/collections/methods.rs index 4b1a4595..1abe4a62 100644 --- a/src/collections/methods.rs +++ b/src/collections/methods.rs @@ -439,7 +439,7 @@ pub async fn get_collection_items_by_the_index_io( .map(|nft| nft.metadata.mint.clone()) .collect(); - let file_name = format!("{collection_mint}-collection_items.json"); + let file_name = format!("{collection_mint}_collection_items.json"); let f = File::create(&file_name).unwrap(); serde_json::to_writer_pretty(f, &mints).unwrap(); println!("Data written to {file_name}"); diff --git a/src/opt.rs b/src/opt.rs index 1941d517..f32d3d9c 100644 --- a/src/opt.rs +++ b/src/opt.rs @@ -319,7 +319,7 @@ pub enum CollectionsSubcommands { collection_mint: String, /// Method to use for getting collection items. See docs. - #[structopt(short, long, default_value = "the_indexer")] + #[structopt(short, long, default_value = "the_index_io")] method: GetCollectionItemsMethods, /// API Key for an indexer, if used.