metaplex-foundation / sugar

Candy Machine Rust CLI.
Apache License 2.0
205 stars 117 forks source link

[Feature]: Allow an existing collection on sugar deploy #431

Closed AlexITC closed 1 year ago

AlexITC commented 1 year ago

Feature

Recently, I had to mint NFTs from a candymachine but these tokens had to be linked to an existing collection, unfortunately, Sugar does not allow this as it creates a collection when creating a candymachine.

sugar deploy --collection <ADDRESS> could deploy cache items into candy machine config on-chain (taking an existing collection.

Ideal solution or implementation

sugar deploy could work without a collection.json, right now, the command supports two cases:

  1. The candymachine already exists, in which case, it proceeds with deploy.
  2. The candymachine does not exists, in this case, the cli expects that collection.json/collection.png are present, which are used for creating a new collection.

It would be ideal to support a 3rd case, where the candymachine does not exists but we don't want a new collection to be created.

Alternative solutions or implementations

I had to create a candymachine using the js sdk to later proceed with sugar deploy, while this works, it isn't ideal.

Other context

No response

samuelvanderwaal commented 1 year ago

https://docs.metaplex.com/developer-tools/sugar/reference/commands#collection

AlexITC commented 1 year ago

sugar collection set

This is a workaround but it isn't ideal, a collection needs to be minted first so that the candy machine gets assigned to another collection later.

The only way I'm aware to create a candy machine with an existing collection is to use the js sdk for that.

Ref: https://github.com/metaplex-foundation/sugar/blob/main/src/deploy/process.rs#L117