Giter Site home page Giter Site logo

sugar's Introduction

Crate Downloads Stars Forks Release Build and Release License

Sugar: A Candy Machine CLI

Sugar is an alternative to the current Metaplex Candy Machine CLI. It has been written from the ground up and includes several improvements:

  • better performance for upload of media/metadata files and deploy of the candy machine — these operations take advantage of multithreaded systems to significantly speed up the computational time needed;
  • simplified build and installation procedures taking advantage of cargo package management, including a binary distributable package ready to use;
  • robust error handling and validation of inputs, including improvements to config and cache files, leading to more informative error messages.

See the docs for full installation and usage instructions.

Installation

Recommended Method

For macOS, Linux and Windows Subsystem Linux (WSL), run the following install script in your terminal:

bash <(curl -sSf https://raw.githubusercontent.com/metaplex-foundation/sugar/main/script/sugar-install.sh)

For Windows:

Download this installer binary and execute it. Since it is not a verified Windows binary you may have to choose "Run Anyway" from "More Info" on the pop-up Windows dialog.

Dependencies: When installing on Ubuntu or WSL (Windows Subsystem Linux), you may need to install some additional dependencies:

sudo apt install libudev-dev pkg-config unzip

Developers

Using Crates.io:

cargo install sugar-cli

Build From Source:

cargo install --path ./

Quick Start

Set up your Solana CLI config with an RPC url and a keypair:

solana config set --url <rpc url> --keypair <path to keypair file>

Sugar will then use these settings by default if you don't specify them as CLI options, allowing commands to be much simpler.

Create a folder named assets to store your json and media file pairs with the naming convention 0.json, 0., 1.json, 1., etc., where the extension is .png, .jpg, etc. This is the same format described in the Candy Machine v2 documentation.

You can then use the launch command to start an interactive process to create your config file and deploy a Candy Machine to Solana:

sugar launch

At the end of the execution of the launch command, the Candy Machine will be deployed on-chain.

sugar's People

Contributors

alexitc avatar blockchain-bros avatar blockiosaurus avatar brandontulsi avatar cryptorrivem avatar deepgreenai avatar febo avatar goriunov avatar heisenberglit avatar jshiohaha avatar kartiksoneji avatar kespinola avatar marksackerberg avatar mcintyre94 avatar mugveiga avatar ohaddahan avatar robbestad avatar samheutmaker avatar samuelvanderwaal avatar statikdev avatar stegabob avatar steveluscher avatar stranzhay avatar sunguru98 avatar the-mercenaries-ltd avatar wooddyy-sol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sugar's Issues

Upgrade Anchor deps to 0.24.2.

All Anchor versions prior to v0.24.2 have been yanked again. We need to upgrade to 0.24.2 to ensure people don't have problems building during the alpha release testing.

Hopefully this is a fairly minor refactor but I think it requires changing the Anchor Client as it gets wrapped in a Rc in newer versions, IIRC.

withdraw-all command

Add a new sub-command called withdraw-all that finds all existing candy machine accounts for a given keypair and withdraws all funds from them to the keypair.

Much of the work from withdraw can be used to avoid code duplication.

Add Create Config interactive command

Write an interactive command for setting up a config.json file.

The current sugar config file looks like this, which is a little different from the current CLI format:

{
  "price": 0.5,
  "number": 10,
  "gatekeeper": null,
  "solTreasuryAccount": "8SpEHRSuJoi24S6BvWadxZNqNiriy9jUo4zHxM1TMCzJ",
  "splTokenAccount": null,
  "splToken": null,
  "goLiveDate": "2022-01-22T00:00:00-00:00",
  "endSettings": null,
  "whitelistMintSettings": null,
  "hiddenSettings": null,
  "uploadMethod": "metaplex",
  "ipfsInfuraProjectId": null,
  "ipfsInfuraSecret": null,
  "awsS3Bucket": null,
  "retainAuthority": false,
  "isMutable": true
}

Upload methods will change and are a placeholder. Likely will be: bundlr, metaplex, ipfs, etc. Objects like endSettings map to Rust structs so are different than the CLI config. (Closer to the on-chain values.) See the code for source of truth or ask me.

Command upload-assets should check files that need upload

At the moment, cache is only created/updated at the end of the upload. This is not ideal for large collection, since if there is an error during the upload nothing gets saved. The command should:

  1. save the upload images/metadata
  2. When re-run, check the assets already in the cache

wrong help text

Running ./sugar deploy without existing cache file results in the following error.

🛑 Error running command (re-run needed): Cache file 'cache.json' not found. Run sugar upload-assets to create it or provide it with the --cache option.

running that results in
error: The subcommand 'upload-assets' wasn't recognized

looks like that help text is wrong

Refactor `upload` to use an Arc for `program`

Instead of creating a new client each time in the addConfigLine function, create it once in the addConfigLInes or processUpload functions and wrap it in an Arc and clone it for each iteration.

Publish required MPL packages for Sugar

Metaplex pacakges to publish:

  • mpl-token-vault v0.0.1
  • mpl-token-metadata v1.1.0
  • nft-candy-machine v2.0.0

Fork the on-chain-identity-gateway repo and deploy a version since they haven't responded to my issue.

  • Make a PR for Bundlr to get to a minimum package level

Pre-Populate Certain Values During Config Creation

Because certain values need to match what pre-exists in a config file (seller fee basis points, collection symbol, potentially more), a nice UX enhancement would be to read these values from 0.json and prompt the user - "Is this accurate?" If they say 'no,' exit and instruct them to update their metadata. Currently, they are prompted to essentially re-enter these values during config creation.

Sugar Readme

1-2 pager describing the basic commands and describing config changes

`sugar launch` command

Once validate, upload-assets, upload and verify commands all work, add a sugar launch command which goes through each step sequentially.

Complete upload-assets command

upload-assets command should take an assets folder and upload images to Bundlr, insert the Arweave links into the metadata files, upload the metadata files, and insert the Arweave links into the cache items.

Add show command

Create a new command to retrieve the candy machine config values on chain.

Add CandyMachineCreator to cache file.

Add the candy machine creator address to the cache file under program. This is the PDA from the seeds: "candy_machine" and the candy_machine_id address. mint/pdas has a function that finds it: get_candy_machine_creator_pda.

Remove unused fields from cache

UUID will be deprecated going forward so we won't need it
We don't use the env or cache_name fields either. If there's no use for them we should remove them from the cache.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.