forked from samuelvanderwaal/metaboss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collections migration (samuelvanderwaal#126)
* feat(collections): add collections migration command * feat(collections): support retrying migrations from a cache file * refactor(mint): update spl_associated_token_account imports * style: remove println * docs: update docs * refactor(collections): fix clippy lints
- Loading branch information
1 parent
a3b56a2
commit c64aeeb
Showing
34 changed files
with
1,526 additions
and
383 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
## Collections | ||
|
||
### Migrate | ||
|
||
Migrate a collection of NFTs to be part of a single on-chain Metaplex Certified Collection (MCC). | ||
|
||
1. Create your Collection Parent NFT using a minting tool such as [justmint](https://justmint.xyz/) or [NFT Armory](https://www.nftarmory.me/). Alternately, use `metaboss mint one`. This NFT will have your collection name, cover art, description, traits etc. It's the parent NFT for you collection and all items in your collection will point to this mint account. | ||
|
||
2. Get your mint list. If your collection is a single candy machine you can use the `--candy-machine-id` option, otherwise provide the path to your mint list formatted as a JSON file with the `--mint-list` option. | ||
|
||
Example contents of the mint list file: | ||
|
||
```json | ||
[ | ||
"D5ycm2mgBWDR37QVkvM389x84V4ux48bSeHLeiHPtX28", | ||
"4kYdMRRYtXjmkusgKEBntSXLDhqkHNE57GF3RPdtx6MW", | ||
"J8xuCFCeBRESoXewtMwrrpVUGikUG3B1WznNdLffyymz", | ||
"4gRtRjrbD7g5ZKUvSVA1tYMK9LZqz6uWuSc3rKeinySh" | ||
] | ||
``` | ||
|
||
Your Collection Parent NFT must have the *same update authority* as the items you will put in the collection. If you don't want to connect your update authority keypair to a website, you can mint with a different keypair and then change the update authority with Metaboss, or mint with Metaboss's `mint one` command. | ||
|
||
### Running the Commands | ||
|
||
#### Single Candy Machine Collection | ||
|
||
Let's say you've created a parent NFT for your collection with a mint address of `9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq` and you have a candy machine id of `8yuhovH7fb63ed7Q3rcxL3kYZDhps4qspjaxx1N8WSni` and your update authority is in the file `my_keypair.json` in the same directory you are running the command. Your Metaboss command would be: | ||
|
||
```bash | ||
metaboss collections migrate -k my_keypair.json -c 8yuhovH7fb63ed7Q3rcxL3kYZDhps4qspjaxx1N8WSni --mint-address 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq | ||
``` | ||
|
||
#### Using a Mint List File | ||
|
||
Assume the same scenario above but with a mint list file named "my_mint_list.json" in the same directory you are running the command. Your Metaboss command would be: | ||
|
||
```bash | ||
metaboss collections migrate -k my_keypair.json -L my_mint_list.json --mint-address 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq | ||
``` | ||
|
||
This assumes you have your RPC set in your [Solana config](https://docs.solana.com/cli/choose-a-cluster), otherwise it can be passed in with the `-r` option. As with all Metaboss commands, if you've set your keypair in your Solana config, you can omit the `-k` option. I recommend setting both in the Solana config to simplify commands: | ||
|
||
``` | ||
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 give you an option to retry them. You can press "y" to retry the failed migrations or "n" to stop trying. When you press "n" it will write all remaining migrations to a cache file so you can retry them later. | ||
|
||
![retry flow](retry_flow.png) | ||
|
||
To retry from a cache file, you can use the `--cache-file` option. | ||
|
||
```metaboss | ||
metaboss collections migrate -k my_keypair.json --cache-file metaboss-cache-migrate-collections.json --mint-address 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq | ||
``` | ||
|
||
This will read the items from the cache file and retry them. | ||
|
||
When retrying, if you consistently end up with the same number being retried each time it probably indicates those items cannot be migrated for some reason. Exit out of the retry flow by pressing "n" and then check the errors on the items that failed to migrate. | ||
|
||
Example cache file: | ||
|
||
```json | ||
{ | ||
"FqKGC9CCVThn857VAyZtZQq5L31njnbeUTe1JoCsCX8J": { | ||
"error": "Migration failed with error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x39 [5 log messages]" | ||
}, | ||
"H7xrCZwA7oqsFeRcPsP6EEYHCxqq7atUBuuQAursXvWF": { | ||
"error": "Migration failed with error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x39 [5 log messages]" | ||
} | ||
} | ||
``` | ||
|
||
In this case [our error is](https://github.com/samuelvanderwaal/wtf-is): | ||
|
||
``` | ||
0x39: | ||
Token Metadata | IncorrectOwner: Incorrect account owner | ||
``` | ||
|
||
which means these items cannot be migrated over as they must have the same update authority as all items in the collection must have the same update authority as the Parent NFT. | ||
|
||
|
||
|
||
Report bugs and questions to the [Metaboss Discord](https://discord.gg/2f7N25NJkg). | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.