From 2551d3d362f887f927e37ca2d3c2aa56062518c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ordo=C3=B1ez?= Date: Tue, 6 Jun 2023 22:32:56 +0200 Subject: [PATCH] Update readme --- .DS_Store | Bin 10244 -> 6148 bytes README.md | 39 ++++++++------------------------------- src/candy-machine.ts | 1 - src/utils.ts | 13 +++++++++---- 4 files changed, 17 insertions(+), 36 deletions(-) diff --git a/.DS_Store b/.DS_Store index b1ef843a553da5e251c5f28c73bb14300e868ea4..8226fa15e6f40c2c25394b3be20194153157672b 100644 GIT binary patch delta 133 zcmZn(XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50D9Q_x2a6RkF;0d64S3NmS9;dkcA{3@Oxa~YT* Oc7Uv9*c{I@hZz8$$`woi literal 10244 zcmeI1O>+`K5Qcj-rHM(Y7puHj#nBTbkPYER5R4|#ib;ski$WlT@Ua-cgd8mH{s;ep zzt59CJ-cP?K!RTUC~IbGw`XUjXWo9hd#G7N#48MIDUpPT%yX-}yTs#?qWyYLm1|MU zeWZuJ$hlPISk7cm{Hf8d!7<<%a11yG90QJle}Mshv$f1GhSEJ91C9a5zz+s=e@Jkv z%tvw@O0#wFFh>C79L=Us=Nw>k5|PYDavVyd%ADcp!HZPA=!oHk>hvdcI5Ho}aVSG| z@j`X+qLsbqgyNai(My=&;^jl>o{j;>z%&DTb}w*R_hngLSm*Z(IiaN~TXG;>8BjZ> zf0wpBsY!rVMmlmNALNZ`E%CM{?`avK(cyV0ZzUxwvdY{mTxn{)sih<Lx4y)~;3La9}dw~4>%@hN=fZl;L7~Nu?g1lm-Q`V>(^i^4Bj+d;#Ze3u8|9;bQ~`FIb}qQ#+un zgF6FH%Ud5*%H#!Cm0ANvhFG?Newq7?JVC!^Vf0}!2Xf^y1HUsdDvuV% zJIr;+N^Pz>HT7!%wj_*nrD1!)Sokq!;R4!S&<_}Yf(91Z8r~B32X?hyW4SaBwg@yjNx?Hk57u>FMhK8$o2IW*qblM?zxI9X+`V`j=&oM>!ijW?AO z{}(ukW4t95SWuo%S+R%qU@{)DLL?buLhagNbOj%s!ebxbJqP7J-n{@}4vT!S_ONh7 zPleXk;P>&^2K^)B;~|*$n4w8;ma#p0;_>J+kLKnhbFKcwF6G{i$3KNpV^K3b{nL2- zI)$+ScYWC=U(eyQ1(#2GmSIA(BLkydvfGExDsj;xhDv6<#(tMI17a&+2P)wYBADno zqh;UXaRvTDd|AWh%$&K_n80}Z*E7ab`|Q}#Y}1@+f-Q;PJJPmuMq|tJ+XCz9u2CTl z>z76&JC7BO_lVsltPId=!qbpinAdN~^RP#w`dkL~+Gd}P$MqcJbsw78kChW^KfY;f z(tY5PeZw#qXJLua0T}CeMYFmFLfwBRR?*$VvTKRiE3nbx*)Uw3U?qG`SOM#n-VO9x zU~8c>vd0=r;ufzFQR_rohsf#Ui)HvbAd)qAbM&N%tN}A^QC|l|hnUmrjIlX-HFWRg|0+hexMRRE@Ov5X=8C(;0&7Iy)~8m}Z|w>0cidWZ+&Gj*g@^eZ rk2Ig-dC|}D54m;hBb8dH=OZ}|B`uUc{%63<^OrmSyYv75fBydtaG|fS diff --git a/README.md b/README.md index b315e05..17abc65 100644 --- a/README.md +++ b/README.md @@ -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` \ No newline at end of file +`yarn start airdrop --args` + +To see available options just for any command, just run it without any parameter, like `yarn start airdrop` \ No newline at end of file diff --git a/src/candy-machine.ts b/src/candy-machine.ts index 7656656..37f3d9d 100644 --- a/src/candy-machine.ts +++ b/src/candy-machine.ts @@ -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) diff --git a/src/utils.ts b/src/utils.ts index 2c3dee4..adaaeb6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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' @@ -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) => {