Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate output dir #132

Merged
merged 2 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "metaboss"
version = "0.6.5"
version = "0.6.6"
edition = "2021"
description="The Metaplex NFT-standard Swiss Army Knife tool."
repository="https://github.com/samuelvanderwaal/metaboss"
Expand Down
13 changes: 12 additions & 1 deletion docs-src/src/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ solana config set --url <rpc url> --keypair <path to keypair file>
```



#### Retry Flow and Cache File

The `migrate` command rapidly fires off a lot of network requests to try to migrate over your collection as quickly as possible. If some of them fail, it keeps track of them and will automatically retry them based on the maximum number of retries you specify with the `--retries` option. (Defaults to one retry.)
Expand Down Expand Up @@ -89,6 +88,18 @@ In this case [our error is](https://github.com/samuelvanderwaal/wtf-is):

which means these items cannot be migrated over as all items in the collection must have the same update authority as the Parent NFT.

### Output File

Use `--output-file` or `-o` to specify the path and name of the JSON file to write the cache results to.

e.g.:

```
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`.



Report bugs and questions to the [Metaboss Discord](https://discord.gg/2f7N25NJkg).
Expand Down
6 changes: 6 additions & 0 deletions docs/collections.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ <h4 id="retry-flow-and-cache-file"><a class="header" href="#retry-flow-and-cache
Token Metadata | IncorrectOwner: Incorrect account owner
</code></pre>
<p>which means these items cannot be migrated over as all items in the collection must have the same update authority as the Parent NFT.</p>
<h3 id="output-file"><a class="header" href="#output-file">Output File</a></h3>
<p>Use <code>--output-file</code> or <code>-o</code> to specify the path and name of the JSON file to write the cache results to. </p>
<p>e.g.:</p>
<pre><code>metaboss collections migrate -L devnet_test_mints.json -m 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq -o ~/Desktop/my-cache3.json
</code></pre>
<p>This will override both the default cache file name ('mb-cache-migrate.json') and the cache file name passed in with <code>--cache-file</code>.</p>
<p>Report bugs and questions to the <a href="https://discord.gg/2f7N25NJkg">Metaboss Discord</a>.</p>

</main>
Expand Down
6 changes: 6 additions & 0 deletions docs/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ <h4 id="retry-flow-and-cache-file"><a class="header" href="#retry-flow-and-cache
Token Metadata | IncorrectOwner: Incorrect account owner
</code></pre>
<p>which means these items cannot be migrated over as all items in the collection must have the same update authority as the Parent NFT.</p>
<h3 id="output-file"><a class="header" href="#output-file">Output File</a></h3>
<p>Use <code>--output-file</code> or <code>-o</code> to specify the path and name of the JSON file to write the cache results to. </p>
<p>e.g.:</p>
<pre><code>metaboss collections migrate -L devnet_test_mints.json -m 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq -o ~/Desktop/my-cache3.json
</code></pre>
<p>This will override both the default cache file name ('mb-cache-migrate.json') and the cache file name passed in with <code>--cache-file</code>.</p>
<p>Report bugs and questions to the <a href="https://discord.gg/2f7N25NJkg">Metaboss Discord</a>.</p>
<div style="break-before: page; page-break-before: always;"></div><h2 id="decode"><a class="header" href="#decode">Decode</a></h2>
<h3 id="decode-mint"><a class="header" href="#decode-mint">Decode Mint</a></h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub struct MigrateArgs {
pub mint_list: Option<String>,
pub cache_file: Option<String>,
pub retries: u8,
pub output_file: Option<String>,
}

#[derive(Debug, Deserialize, Serialize)]
Expand Down Expand Up @@ -312,7 +313,8 @@ pub async fn migrate_collection(args: MigrateArgs) -> AnyResult<()> {
));
}

let mut cache_file_name = "metaboss-cache-migrate-collection.json".to_string();
// Default name, if we don't get an output_file option or a cache file.
let mut cache_file_name = String::from("mb-cache-migrate.json");
let mut cache = MigrateCache::new();

let solana_opts = parse_solana_config();
Expand All @@ -337,6 +339,11 @@ pub async fn migrate_collection(args: MigrateArgs) -> AnyResult<()> {
));
};

// If output file is specified, write to that file.
if let Some(path) = args.output_file {
cache_file_name = path;
}

let f = if !Path::new(&cache_file_name).exists() {
File::create(&cache_file_name)?
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ pub enum CollectionsSubcommands {
/// Maximum retries: retry failed items up to this many times.
#[structopt(long, default_value = "1")]
retries: u8,

/// Output file path for the cache file. Defaults to mb-cache-migrate.json.
#[structopt(short, long)]
output_file: Option<String>,
},
}

Expand Down
2 changes: 2 additions & 0 deletions src/process_subcommands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ pub async fn process_collections(
mint_list,
cache_file,
retries,
output_file,
} => {
migrate_collection(MigrateArgs {
client,
Expand All @@ -132,6 +133,7 @@ pub async fn process_collections(
mint_list,
cache_file,
retries,
output_file,
})
.await
}
Expand Down