Giter VIP home page Giter VIP logo

stargaze-tools's Introduction

Stargaze Tools V2

Stargaze Tools is a set of tools to interact with Launchpad smart contracts on Stargaze.

It's designed for creators and developers to help launch and manage collections. As use cases grow, more tools and scripts will be added.

Setup project

git clone https://github.com/public-awesome/stargaze-tools
cd stargaze-tools
yarn install

Create an account on testnet

yarn account

This outputs an address you can use to instantiate your minter contract.

Get funds from faucet

Ask for funds from the #faucet channel in Discord Stargaze.

$request [address]

Configure project

Copy config.example.js to config.js. Edit config.js with your project configuration.

Vending Minter

A vending minter is suitable for PFP-style 10,000 item or less generative collections.

Initialize a vending minter contract

A minter is created from a factory contract.

yarn minter

Creating an updatable vending collection requires adding --updatable-vending to the above command.

yarn minter --updatable-vending

Mint

Mint a specific NFT to an address

yarn mint --for [token_id] [address]

[address] can be any Cosmos address. It'll be converted automatically into a Stargaze address.

Mint to an address

yarn mint --to [address]

This mints the next available token ID to the given address.

Batch mint

Mint num NFTs to an address.

yarn mint --to [address] --batch [num]

Same as mint --to but mints the next [num] tokens sequentially to the given address.

Batch update token URIs

Only available for updatable collections.

yarn update-metadata

Update a single token's metadata

yarn update-metadata 1 ipfs://somethinghere

Whitelist (optional)

Instantiate a whitelist contract:

yarn whitelist

The output of the above command should give you a whitelist contract address. Edit config.js and update the whitelist field with this value. Next, set this address in your minter contract with:

yarn minter --whitelist [whitelist_address]

To add addresses to the whitelist, use:

yarn whitelist --add [stars1..., stars2..., etc.]

Base Minter (1/1s)

A base minter is suitable for collections of 1/1s.

Initialize a base minter contract

A minter is created from a factory contract.

yarn base-minter

Mint

yarn mint --token-uri [token-uri]

Open Edition Minter

Open edition minter allows multiple copies of a single NFT to be minted for a given time interval.

Initialize an open edition minter contract

Specify the collection info and open edition minter configuration in config.js, then run:

yarn open-edition-minter

The user is prompted to choose whether the metadata will be stored off-chain or on-chain.

  • off-chain: the metadata needs to be uploaded to IPFS beforehand and the URI should be specified as tokenUri in config.js/openEditionMinterConfig
  • on-chain: the metadata will be stored on-chain upon collection creation and should be specified as metadata in config.js/openEditionMinterConfig

Mint

Mint a token to an address

Specify the minter contract address in config.js and run:

yarn mint --to [address]

This mints a token to the given address.

Batch mint tokens to an address

Mint num tokens to an address.

yarn mint --to [address] --batch [num]

Update trading start time

Specify the new startTradingTime in config.js/openEditionMinterConfig and run:

yarn open-edition-minter --update-start-trading-time

Update per address limit

Specify the new perAddressLimit in config.js/openEditionMinterConfig and run:

yarn open-edition-minter --update-per-address-limit

Query sg721

You can run queries against an instantiated sg721 contract with:

yarn query

For all possible queries, see the query types.

Transfer NFT

You can transfer your nft to another address with:

yarn transfer-nft [sg721_address] [token_id] [recipient_address]

SG-721 Batch Transfer

You can batch transfer tokens from a file. Copy transfer.example.csv to transfer.csv and configure for recipients and their token_id. Then use the following command:

yarn transfer-file

Splits (optional)

Splits allow splitting mint revenue and secondary sale royalties across multiple accounts.

Define split members and allocations in config.js, and run:

yarn group

This command will output the group contract address. Now use this address to create a splits contract:

yarn splits [group-address]

Now the address of the splits contract can be used for the paymentAddress (primary sales) and/or royaltyPaymentAddress (secondary sales) in config.js when creating a minter.

To distribute funds from the splits contract(defined in config.js), make sure you are either the admin or a member of the group, and run:

yarn distribute-splits

Query Splits

This command will query the splits contract.

yarn query-splits <query-type>

Possible query types:

  • member [member-address] | | Query a member of the group with given address
  • group | | Query the group contract
  • list-members | | Query all members of the group
  • admin | | Query the admin of the group

Snapshot

Create a snapshot of owners of a vending collection:

yarn vending-snapshot [collection] [expected_num_tokens]

For example, to do a snapshot of all owners of Bad Kids:

yarn vending-snapshot stars19jq6mj84cnt9p7sagjxqf8hxtczwc8wlpuwe4sh62w45aheseues57n420 9999

This generates a CSV file called snapshot.csv. Burned tokens will show as burned for the owner address.

Snapshot + Airdrop

You can airdrop a new collection to owners of an existing vending collection.

First configure a new minter following instructions above.

Then generate a snapshot. For example, to airdrop a new collection to owners of Bad Kids:

yarn vending-snapshot stars19jq6mj84cnt9p7sagjxqf8hxtczwc8wlpuwe4sh62w45aheseues57n420 9999

Then Airdrop to each address in the snapshot:

yarn mint-for-file

Note: Burned tokens will be minted to your account.

Flexible Whitelist

Use a whitelist that has custom per_address_limit based on NFT ownership of a different collection. This requires using the flexible factory address, flexible minter code id, and flexible whitelist code id.

yarn minter --flex-vending
yarn vending-snapshot
yarn query-owner-nft-count
# creates owner-nft-count.csv with the number of NFTs owned by each address
yarn whitelist-flex
yarn whitelist-flex-file
yarn minter --whitelist [whitelist_address]

Testnet

Test your contract. Make sure it's visible in launchpad. Try minting and viewing the NFT in your profile. https://testnet.publicawesome.dev/

Video Tutorials

https://www.youtube.com/watch?v=1gvDlBWKEUc by Meta-induction

https://www.youtube.com/watch?v=lw6w5zlRj14 by Cosmos Tutorials

https://asciinema.org/a/485818

More documentation

A more comprehensive guide is available at Stargaze Docs.

Copyrighted Content

You represent and warrant that you have, or have obtained, all rights, licenses, consents, permissions, power and/or authority necessary to grant the rights granted herein for any content that you create, submit, post, promote, or display on or through the Service. You represent and warrant that such content does not contain material subject to copyright, trademark, publicity rights, or other intellectual property rights, unless you have necessary permission or are otherwise legally entitled to post the material and to grant Stargaze Parties the license described above, and that the content does not violate any laws.

Disclaimer

STARGAZE TOOLS IS PROVIDED β€œAS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. No developer or entity involved in creating Stargaze Tools or smart contracts will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of Stargaze, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. Although Public Awesome, LLC and it's affiliates developed the initial code for Stargaze, it does not own or control the Stargaze network, which is run by a decentralized validator set.

Terms and Conditions

By using this code you agree to the following terms and conditions.

stargaze-tools's People

Contributors

4coffeeihadbreakfast avatar a-mummey avatar dpdanpittman avatar jakehartnell avatar jamesmurdza avatar jason-c-child avatar jhernandezb avatar kevin-kidd avatar mightofoaks avatar msteiner96 avatar ninjatosba avatar shanev avatar star-potato avatar tkd-alex avatar yubrew 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

Watchers

 avatar  avatar  avatar  avatar  avatar

stargaze-tools's Issues

Verify by querying contract

Show an example of querying contracts, i.e: number of tokens.

The best to probably do this is to have a scrip that loads the contract. i.e:

yarn run load

This will load the contract and allow querying.

Validate init inputs

Validate inputs before they hit the chain, i.e:

  • URLs should be valid
  • addresses should be valid
  • min and max values for num tokens, unit price, etc.

Add creation fee when instantiating nft collection

Error: Error when broadcasting tx 0349271DC9267082AEE8A3F8E5D1BAEA26E14D074B12A58C665A05F7C360C943 at height 1716. Code: 4; Raw log: failed to execute message; message index: 0: dispatch: submessages: No funds sent: instantiate wasm contract failed

toStars Cannot find module '../src/utils'

node_modules/@cosmjs/cli/[eval].ts:4:25 - error TS2307: Cannot find module '../src/utils' or its corresponding type declarations.
4 import { toStars } from '../src/utils';

add whitelist addresses with file

A popular creator has 5,000 whitelist addresses, it is cumbersome to copy and paste into a script.

It will throw an error if one of the addresses is bad. Maybe pre-validate addresses and console.log the bad ones at the end.

Add unsigned JSON output for Keplr signing

Add a parameter like --generate--only to all instantiate and execute commands that outputs the unsigned JSON that can be copied into a web page for signing with the CosmWasm Stargate signer (which works with Keplr).

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.