Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mordonez-me committed Jun 6, 2023
1 parent f03fcab commit 2551d3d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 36 deletions.
Binary file modified .DS_Store
Binary file not shown.
39 changes: 8 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,18 @@

This project can be used to create a collection and mint nfts from it to a specific list. Each item of the collection will use the same image as the collection, personalize it as needed.


## How to setup


1. Change parameters on settings.ts

```
export const pkPath = PATH_TO_PRIVATE_KEY_FILE
export const itemImagePath = PATH_TO_COLLECTION_KEY_FILE
export const cluster = URL_OF_THE_CLUSTER
export const collectionSize = NUMBER_OF_NFTS_IN_COLLECTION
export const startDate = START_DATE_TO_ALLOW_MINT // e.g. 2023-01-20T09:00:00Z
export const endDate = END_DATE_TO_DISABLE_MINT // e.g. 2023-01-21T09:00:00Z
export const configFile = PATH_TO_FILE_FOR_CONFIG // This file contains info like candymachine id. This is autogenerated but can be used if just airdrop is needed
export const distributionListFile = PATH_TO_FILE_FOR_AIRDROP_ADDRESSES
export const collectionName = NAME_OF_COLLECTION
export const itemImageName = NAME_OF_IMAGE // The name to be assigned to itemImagePath in Arweave
export const itemImageDescription = DESCRIPTION_OF_IMAGE
export const itemImageAttributes = ARRAY_WITH_TRAITS // e.g.[{ "trait_type": "Location", "value": "Twitter Space" }]
export const itemName = NAME_FOR_EACH_NFT //just support same name or prefix e.g. "Solana University POAP #$ID+1$"
export const nameLength = NAME_LENGTH // e.g. 0, because the use of prefix
export const prefixUri = PREFIX_OF_URI_ITEM //e.g."https://arweave.net/"
export const prefixUriLength = PREFIX_URI_LENGTH // For arweave is 43 fixed size for id
```

2. Add the file defined on distributionListFile variable on setttings.ts
3. Add image file defined on itemImagePath variable on setttings.ts
4. Add private key file defined on itemImagePath variable on setttings.ts

## Commands

Create a collection

`yarn create-collection`
`yarn start create-collection --args`

Create a Candy Machine

`yarn start create-candy-machine --args`

Airdrop collection using candymachine id in .config

`yarn airdrop`
`yarn start airdrop --args`

To see available options just for any command, just run it without any parameter, like `yarn start airdrop`
1 change: 0 additions & 1 deletion src/candy-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export interface CreateCandyMachineParams {

export const init = async (params: CreateCandyMachineParams) => {
const { privateKey, cluster, collectionAddress, quantity, itemName, imagePath, imageName, imageDescription, attributes } = params
console.log('itemName', itemName)

const keypair = getKeypair(privateKey)
const metaplex = initializeMetaplex(cluster, keypair)
Expand Down
13 changes: 9 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { bundlrStorage, keypairIdentity, Metaplex, toMetaplexFile } from "@metaplex-foundation/js"
import { Connection, Keypair } from "@solana/web3.js"
import { clusterApiUrl, Connection, Keypair } from "@solana/web3.js"
import { Dictionary } from 'lodash'
import * as fp from 'lodash/fp'
import * as fs from 'fs'
Expand All @@ -13,11 +13,16 @@ export const getKeypair = (path: string): Keypair => {

export const initializeMetaplex = (cluster: string, keypair: Keypair) => {
const connection = new Connection(cluster);
return Metaplex.make(connection)
const metaplaex = Metaplex.make(connection)
.use(keypairIdentity(keypair))
.use(bundlrStorage({
address: 'https://devnet.bundlr.network', // remove this to use main
if (cluster == clusterApiUrl('devnet')) {
return metaplaex.use(bundlrStorage({
address: 'https://devnet.bundlr.network',
}));
} else {
return metaplaex
}

}

export const getDistributionList = (distributionListFile: string) => {
Expand Down

0 comments on commit 2551d3d

Please sign in to comment.