Skip to content

Commit

Permalink
docs: update docs for get-items & check-items and make minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelvanderwaal committed May 28, 2022
1 parent e0ffd88 commit 4e0a066
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
28 changes: 25 additions & 3 deletions docs-src/src/collections.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down Expand Up @@ -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 <COLLECTION_NFT_MINT_ADDRESS> --api-key <THE_INDEX_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_MINT>_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 <COLLECTION_NFT_MINT_ADDRESS> -L <PATH_TO_MINT_LIST>
```

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).
Expand Down
2 changes: 1 addition & 1 deletion src/collections/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl FromStr for GetCollectionItemsMethods {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"the_indexer" => Ok(GetCollectionItemsMethods::TheIndexIO),
"the_index_io" => Ok(GetCollectionItemsMethods::TheIndexIO),
_ => Err(format!("Invalid method: {}", s)),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/collections/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
Expand Down
2 changes: 1 addition & 1 deletion src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4e0a066

Please sign in to comment.