Skip to content
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ Batch mint a collection:
mint --name <my_nft_collection> --amount 1
```

Batch mint a list of CIDs from a text file, one per line:

```shell
mint --lines cids.txt --amount 1
```

Mint a specific set of IDs:

```shell
Expand Down
9 changes: 9 additions & 0 deletions python/minter.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def parse_args():
batch_group = parser.add_argument_group(title="Batch mint", description="Use these options to batch mint multiple NFTs:")
batch_group.add_argument("--name", help="Specify the name of a collection to batch mint", type=str)
batch_group.add_argument("-j", "--json", help="Specify a json file containing a list of CIDv0 hash to batch mint", type=str)
batch_group.add_argument("-l", "--lines", help="Specify a text file containing a list of CIDv0 hash, one per line, to batch mint", type=str)
batch_group.add_argument("-s", "--start", help="Specify the the starting ID to batch mint", type=int)
batch_group.add_argument("-e", "--end", help="Specify the last ID to batch mint", type=int)
try:
Expand All @@ -140,6 +141,9 @@ def parse_args():
elif args.json: # --json
assert os.path.exists(args.json), f"JSON file not found: {args.json}"
args.cid = None
elif args.lines: # --lines
assert os.path.exists(args.lines), f"Line-delimited file not found: {args.lines}"
args.cid = None
elif args.cid: # --cid
args.json = None
assert args.cid[:2] == "Qm", f"Invalid cid: {args.cid}" # Support CIDv0 only
Expand Down Expand Up @@ -404,6 +408,11 @@ async def main():
if args.json:
with open(args.json, 'r') as f:
all_cids = json.load(f)
elif args.lines:
all_cids = []
with open(args.lines, 'r') as f:
for x, line in enumerate(f):
all_cids.append({"ID": x+1, "CID": line.strip()})
elif args.cid:
all_cids = [{"ID": 1, "CID": args.cid}]

Expand Down