Skip to content

Commit

Permalink
Merge pull request #25 from samuelvanderwaal/develop
Browse files Browse the repository at this point in the history
v0.3.0-beta
  • Loading branch information
samuelvanderwaal authored Nov 30, 2021
2 parents 31d55d6 + 9db5de0 commit 04935e6
Show file tree
Hide file tree
Showing 17 changed files with 702 additions and 140 deletions.
55 changes: 50 additions & 5 deletions Cargo.lock

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

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
[package]
name = "metaboss"
version = "0.2.3"
version = "0.3.0-beta"
edition = "2018"

[dependencies]
anyhow = "1.0.44"
borsh = "0.9.1"
bs58 = "0.4.0"
env_logger = "0.9.0"
glob = "0.3.0"
indicatif = { version = "0.16.2", features = ["rayon"] }
lazy_static = "1.4.0"
log = "0.4.14"
metaplex-token-metadata = "0.0.1"
num_cpus = "1.13.0"
ratelimit = "0.4.4"
rayon = "1.5.1"
reqwest = "0.11.5"
serde = "1.0.130"
serde_json = "1.0.68"
Expand Down
74 changes: 73 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ metaboss update data --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-

The JSON file should include all the fields of the metadata `Data` struct and should match `creator` `verified` bools for existing creators. E.g. if your NFT was minted by the Metaplex Candy Machine program, and you wish to keep your candy machine as a verified creator _you must add the candy machine to your creators array with `verified` set to `true`_.

**Make sure you understand how the Metaplex Metadata `Data` struct works and how this command will affect your NFT. Always test on `devnet` before running on mainnet. **
Note: The on-chain `Data` struct is *different* than the external metadata stored at the link in the `uri` field so make you understand the difference before running this command.

**Make sure you understand how the Metaplex Metadata `Data` struct works and how this command will affect your NFT. Always test on `devnet` before running on mainnet.**

```json
{
Expand Down Expand Up @@ -480,6 +482,53 @@ The JSON file should include all the fields of the metadata `Data` struct and sh

Outputs a TxId to the command line so you can check the result.

#### Update Data All

Update the `Data` struct on a list of NFTs from JSON files.

##### Usage

```bash
metaboss update data-all --keypair <PATH_TO_KEYPAIR> --data-dir <PATH_TO_DATA_DIR>
```

Each JSON file in the data directory should include the mint account and all the fields of the metadata `Data` struct and should match `creator` `verified` bools for existing creators. E.g. if your NFT was minted by the Metaplex Candy Machine program, and you wish to keep your candy machine as a verified creator _you must add the candy machine to your creators array with `verified` set to `true`_.

Note: The on-chain `Data` struct is *different* than the external metadata stored at the link in the `uri` field so make you understand the difference before running this command.

**Make sure you understand how the Metaplex Metadata `Data` struct works and how this command will affect your NFT. Always test on `devnet` before running on mainnet.**

```json
{
"mint_account": "CQNKXw1rw2eWwi812Exk4cKUjKuomZ2156STGRyXd2Mp",
"nft_data":
{
"name": "FerrisCrab #4",
"symbol": "FERRIS",
"uri": "https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls",
"seller_fee_basis_points": 100,
"creators": [
{
"address": "<YOUR_CANDY_MACHINE_ID>",
"verified": true,
"share": 0
},
{
"address": "<KEYPAIR_CREATOR>",
"verified": true,
"share": 50
},
{
"address": "42NevAWA6A8m9prDvZRUYReQmhNC3NtSZQNFUppPJDRB",
"verified": false,
"share": 50
}
}
}
```

Outputs a TxId to the command line so you can check the result.

#### Update URI

Update the metadata URI, keeping the rest of the `Data` struct the same.
Expand All @@ -489,3 +538,26 @@ Update the metadata URI, keeping the rest of the `Data` struct the same.
```bash
metaboss update uri --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-uri <NEW_URI>
```

#### Update URI All

Update the metadata URI for a list of mint accounts, keeping the rest of the `Data` struct the same.

##### Usage

```bash
metaboss update uri-all --keypair <PATH_TO_KEYPAIR> --json-file <PATH_TO_JSON_FILE>
```

```json
[
{
"mint_account": "xZ43...",
"new_uri": "https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls"
},
{
"mint_account": "71bk...",
"new_uri": "https://arweave.net/FPGAv1XnyZidnqquOdEbSY6_ES735ckcDTdaAtI7GFw"
}
]
```
21 changes: 21 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use lazy_static::lazy_static;
use std::sync::RwLock;

pub const MAX_NAME_LENGTH: usize = 32;
pub const MAX_URI_LENGTH: usize = 200;
pub const MAX_SYMBOL_LENGTH: usize = 10;
Expand All @@ -7,3 +10,21 @@ pub const METAPLEX_PROGRAM_ID: &'static str = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6
pub const CANDY_MACHINE_PROGRAM_ID: &'static str = "cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ";

pub const DEFAULT_RPC_DELAY_MS: u64 = 300;

pub const PUBLIC_RPC_URLS: &'static [&'static str] = &[
"https://api.devnet.solana.com",
"https://api.testnet.solana.com",
"https://api.mainnet-beta.solana.com",
"https://solana-api.projectserum.com",
];

pub const MAX_REQUESTS: u64 = 40;
pub const TIME_PER_MAX_REQUESTS_NS: u64 = 10_000_000_000;
pub const TIME_BUFFER_NS: u32 = 50_000_000;

// Delay in milliseconds between RPC requests
pub const RATE_LIMIT: u64 = 500;

lazy_static! {
pub static ref USE_RATE_LIMIT: RwLock<bool> = RwLock::new(false);
}
12 changes: 12 additions & 0 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ pub struct NFTData {
pub creators: Option<Vec<NFTCreator>>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct UpdateNFTData {
pub mint_account: String,
pub nft_data: NFTData,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct UpdateUriData {
pub mint_account: String,
pub new_uri: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct NFTCreator {
pub address: String,
Expand Down
Loading

0 comments on commit 04935e6

Please sign in to comment.