Code Monkey home page Code Monkey logo

split-mint's Introduction

split-mint

A package to split the SOL funds raised from an NFT mint between various creators. This was made in order to attempt to provide a way to split the funds raised from the initial mint as can be done using the creators array for royalties from secondary market sales.

Overview

While this program is running, it will pick up all transactions made to the Treasury Account (or whatever address you specify), and distribute the funds between a different group of accounts. Similiar to how royalties on sales of NFTs on secondary markets distributed to various creators works.

Suggestions and PRs welcome!

Note: This is experimental software for a young ecosystem. Use at your own risk. The author is not responsible for misuse of the software or for the user failing to test on devnet before using in production.

Installation

Clone the repository

git clone https://github.com/stephenwilliams1990/split-mint.git

To get started, you will need to make the following changes to the files in the package:

1. Update the .envexample file with your Treasury Private Key

In the .envexample file, there is only 1 variable needed to update. Change the TREASURY_SECRET_KEY to the byte array of the Private Key of the Treasury wallet set in your Candy Machine config setup. Make sure you enter it WITHOUT the brackets [].

For example, if your private key is: [1,2,3,4,5,...,64]

You would enter:

TREASURY_SECRET_KEY=1,2,3,4,5,...,64

Once this is done you can save the file as .env.

2. Update the variables in utils.js

There are 2 variables to update here, being the creators array and the network.

Update the creators array as required. Add more creators and change the share as necessary. Note a share of 50 means that the creator will receive 50% of the funds. Within the creators array, the address should be the string of the creators' address, and share should be a number. For example:

export const creators = [
    { 
        "address" : 'BdmWyA3TNjthQddscAsqEfB18F2Fh8QtFAcshbHt6xcZ',
        "share" : 50
    },
    { 
        "address" : '8tVhVuphrKs9TeZPkJgU5im3qVZfonNCpKZe5mBbWFHx',
        "share": 50
    }
]

Set the network as required. NB Please do your own testing on devnet before deploying this on mainnet-beta.

export const network = 'devnet' // 'mainnet-beta'

Once this is done, run the following commands

yarn install

yarn start

And it should be running! Whilst the program is running, it should distribute all payments made to the Treasury Account to the creators with the specified splits as entered by the user. Simply stop the program if you wish to stop the distribution of payments made to this account.

Disclaimer

This is a beta version! Please do your own testing and use at your own risk.

Contributing

All contributions are welcome and encouraged. Send through a PR if you find any bugs. In an ideal world, this would be converted into a Rust program to deploy as well. That build is on my list for when I can find the time. If someone beats me to it I wouldn't mind at all!

Contact

Twitter: @WallyWilliams2

Discord: @wallypues#2876

split-mint's People

Contributors

stephenwilliams1990 avatar

Watchers

James Cloos avatar

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.