diff --git a/docs/Contracts/deploy.md b/docs/Contracts/deploy.md deleted file mode 100644 index dce1e92..0000000 --- a/docs/Contracts/deploy.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Deploy Smart Contract - -Once a Contract File has been finalized, it needs to be deployed to a blockchain network to make it operational. -NFT Toolbox makes this very simple with the `deployContract` function. - -The function uses the parameters provided to initialize Contract object to locate the Contract File, -establish an [ethers.js](https://ethers.org/) connection to the Blockchain network, Deploy the contract -and initialize it. - -**After [Initializing the Contract Object](/docs/Contracts/initializeContract),** - -```javascript -nftToolbox.deployContract(); -``` - -:::note -The directory path provided as parameter `dir` to `initContract` function must contain a Solidity file -with file name same as the parameter `name` passed to `initContract` function. This is the Contract file -that will be deployed by NFT Toolbox. -::: diff --git a/docs/Contracts/draft.md b/docs/Contracts/draft.md deleted file mode 100644 index 71d0060..0000000 --- a/docs/Contracts/draft.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Draft Contract File - -The **ERC721** and **ERC1155** standards created by [Open Zeppelin](https://www.openzeppelin.com/contracts) -are the most popular NFT Contracts used by the community. -The [Open Zeppelin Wizard](https://wizard.openzeppelin.com/) is a tool that programatically generates -Smart Contracts based on provided configurations. -NFT Toolbox provides the `draftContract` function that acts as an interface to Open Zeppelin Wizard. -Thus enabling users to generate Solidity Smart Contracts specifically to be used in their NFT projects. - -## Parameters - -:::info -The configurations listed below are directly passed to [Open Zeppelin Wizard](https://wizard.openzeppelin.com/). -See the platform to test the generated contract before using them in NFT Toolbox. -::: - -The parameters of `initContract` function are described as follows. - -| Name | Type | Standard Supported | Description | -| -------------- | ------- | ---------------------- | ------------------------------------------ | -| `baseUri` | string | `ERC721` and `ERC1155` | Base URI used in deployment | -| `burnable` | boolean | `ERC721` and `ERC1155` | Allow Tokens to be Burned | -| `pausable` | boolean | `ERC721` and `ERC1155` | Allow Transactions to be Paused | -| `mintable` | boolean | `ERC721` and `ERC1155` | Allow minting of new tokens | -| `enumerable` | boolean | `ERC721` | Allow enumerating the tokens on chain | -| `uriStorage` | boolean | `ERC721` | Include Storage based URI management | -| `incremental` | boolean | `ERC721` | Assign incremental id to new Tokens | -| `votes` | boolean | `ERC721` | Include support for voting and delegation | -| `supply` | boolean | `ERC1155` | Track Total Supply | -| `updatableUri` | boolean | `ERC1155` | Allow Privileged accounts to set a new URI | - -## Examples - -**After [Initializing the Contract Object](/docs/Contracts/initializeContract),** - -Pass the required configurations to `draftContract` function to create a Solidity File. - -- **Standard: ERC271** - -```javascript -nftToolbox.draftContract({ - baseUri: "ipfs://exampleCID/" - // Common options - burnable: false - pausable: false - mintable: false - // ERC721 options - enumerable: false - uriStorage: false - incremental: false - votes: false - // ERC1155 options - supply: false; - updatableUri: false; -}); -``` - -- **Standard: ERC1155** - -```javascript -nftToolbox.draftContract({ - baseUri: "ipfs://exampleCID/" - // Common options - burnable: false - pausable: false - mintable: false - // ERC721 options - enumerable: false - uriStorage: false - incremental: false - votes: false - // ERC1155 options - supply: false; - updatableUri: false; -}); -``` diff --git a/docs/Contracts/initializeContract.md b/docs/Contracts/initializeContract.md deleted file mode 100644 index d7679ae..0000000 --- a/docs/Contracts/initializeContract.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Initialize Contract Object - -Before jumping into any functionality, a Contract object has to be initialized in the Toolbox. -This is done with the `initContract` function. - -## Parameters - -The parameters of `initContract` function are described as follows. - -| Name | Type | Description | -| ------------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | string | Name of the Contract used on deployment | -| `symbol` | string | Symbol of the Contract used on deployment | -| `dir` | string | Path to directory where the new Contract File is to be created | -| `standard` | string | `"ERC721"` or `"ERC1155"` | -| `connection` | object | Used to set up **ethers.js** connection. Described [here](/docs/Contracts/initializeContract#connection-details) | -| `deployed` | object | _(optional)_ Used for initialization of deployed contracts. Described [here](/docs/Contracts/initializeContract#initialization-for-deployed-contract) | - -### Connection Details - -The fields of `connection` parameter are described as follows. - -| Name | Type | Description | -| ---------- | ------ | ------------------------------------------------------------ | -| `network` | string | The Blockchain network on which contract is (to be) deployed | -| `provider` | object | Details of the JSON RPC provider to be used | -| `wallet` | object | Contains `privateKey` of wallet to be used on the network | - -:::info -The contents of `connection` parameter in `initContract` function are used to set up an -[ethers.js](https://ethers.org/) connection. -See their [documentation](https://docs.ethers.io/v5/) for more details. -::: - -#### Supported Networks - -- Ethereum Mainnet (`"homestead"`) -- Ropsten Testnet (`"ropsten"`) -- Rinkeby Testnet (`"rinkeby"`) -- Goerli Testnet (`"goerli"`) -- Kovan Testnet (`"kovan"`) -- Polygon Mainnet (`"matic"`) -- Polygon Mumbai Testnet (`"maticmum"`) - -#### Supported Providers - -- [Etherscan](https://etherscan.io/apis) -- [Infura](https://infura.io/register) -- [Alchemy](https://dashboard.alchemyapi.io/signup?referral=55a35117-028e-4b7c-9e47-e275ad0acc6d) -- [Pocket Gateway](https://pokt.network/pocket-gateway-ethereum-mainnet/) -- [Ankr](https://www.ankr.com/protocol/public/) - -:::note -See Supported Providers on ethers.js [here](https://docs.ethers.io/v5/api-keys/) -::: - -### Initialization for Deployed Contract - -A Contract object can be initialized from an alredy deployed contract as well by passing the optional parameter -`deployed` to `initContract` function. -The fields of `deployed` parameter are described as follows. - -| Name | Type | Description | -| --------- | ------ | ------------------------------------------- | -| `address` | string | Address of the deployed contract on network | -| `abi` | object | ABI of the contract | - -:::note -The initialization for deployed contracts will only be useful in the Interacting Functionality and not in -Draft or Deploy functionalities. -::: - -## Example - -**After [Importing the package](/docs/intro#import-it-in-your-project),** - -```javascript -nftToolbox.initContract({ - name: "YourContract", - symbol: "YOUR", - dir: "./path/to/directory/Contracts/", - standard: "ERC721", - connection: { - network: "homestead", - provider: { - infura: { - projectId: "PROJECT_ID", - projectSecret: "PROJECT_SECRET", - }, - }, - wallet: { privateKey: "YOUR_PRIVATE_KEY" }, - }, - deployed: { - address: "0xADDRESS", - abi: JSON.parse( - fs.readFileSync("./path/to/directory/Contracts/ContractAbi.json") - ), - }, -}); -``` diff --git a/docs/Contracts/interact.md b/docs/Contracts/interact.md deleted file mode 100644 index 1f4f5fc..0000000 --- a/docs/Contracts/interact.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -sidebar_position: 4 ---- - -# Interact with Smart Contract - -NFT Toolbox provides the functionality to interact with a deployed Smart Contract on a Blockchain Network. -This is done with `readContract` and `writeContract` functions. - -Both the functions accept two parameters. - -- **(string)** The name of the Contract method to be called -- **(array)** The parameters to be passed to the Contract method in order - -`readContract` is used to call the _view_ methods on the Smart Contract which do not manipulate it's state. -It returns the response from the Smart Contract. - -`writeContract` is used to call the methods on the Smart Contract which manipulate it's state. -It returns the [ethers.js](https://ethers.org/) transaction object created on the Contract. - -## Example - -**After [Deploying a Contract](/docs/Contracts/deploy) or [Initializing a Deployed Contract](/docs/Contracts/initializeContract#initialization-for-deployed-contract)** - -```javascript -const exampleMintNFT = async () => { - const address = "0xADDRESS"; - - const tx = await nftToolbox.writeContract("safeMint", [address]); - await tx.wait(); - - const bal = await nftToolbox.readContract("balanceOf", [address]); - console.log(bal.toString()); -}; - -exampleMintNFT(); -``` diff --git a/docs/Upload/initializeFileStorage.md b/docs/Upload/initializeFileStorage.md deleted file mode 100644 index 9a47087..0000000 --- a/docs/Upload/initializeFileStorage.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Initialize File Storage - -The first step in this functionality is to initialize the Toolbox with a File Storage Platform. - -In order to incorporate as many user requirements as possible and not impose any choice on them, -NFT Toolbox has support for multiple File Storage Platforms. - -## Supported Platforms - -The platforms currently supported are as follows: - -- [NFT.storage](https://nft.storage/) (IPFS) -- [Pinata](https://www.pinata.cloud/) (IPFS) -- [Storj](https://www.storj.io/ipfs) (IPFS) -- [Infura](https://infura.io/product/ipfs) (IPFS) -- [Arweave](https://www.arweave.org/) - -Users can choose any of the above platforms according to their requirements. - -## Parameters - -Initialization is done with the `initFileStorage` function. -`initFileStorage` function takes a string parameter for selecting the File Storage Platform and -the user's credentials for the Platform. - -The Platforms and Credentials are as follows. - -| Platform | Parameter | Type | Description | -| ----------- | --------- | ---------------- | ------------------------------------- | -| NFT.Storage | service | string | `nft.storage` | -| | key | string | API Key for NFT.Storage Account | -| Pinata | service | string | `pinata` | -| | key | string | API Key for Pinata Account | -| | secret | string | API Key Secret | -| Storj | service | string | `storj` | -| | username | string | Username for Storj IPFS Account | -| | password | string | Password for Storj IPFS Account | -| Infura | service | string | `infura` | -| | username | string | Username for Infura IPFS Project | -| | password | string | Password for Infura IPFS Project | -| Arweave | service | string | `arweave` | -| | currency | string | Currency used for Bundlr Transactions | -| | wallet | string or object | Private Key or JSON Wallet | - -:::note -NFT Toolbox uses [Bundlr](https://bundlr.network/) to upload files to Arweave. See the [Supported currencies for Bundlr](https://docs.bundlr.network/docs/currencies). -::: - -## Examples - -Examples of initializing File Storage are as follows. - -**After [Importing the package](/docs/intro#import-it-in-your-project),** - -- NFT.Storage - -```javascript -nftToolbox.initFileStorageService({ - service: "nft.storage", - key: "NFT_STORAGE_KEY", -}); -``` - -- Pinata - -```javascript -nftToolbox.initFileStorageService({ - service: "pinata", - key: "PINATA_KEY", - secret: "PINATA_SECURITY", -}); -``` - -- Storj - -```javascript -nftToolbox.initFileStorageService({ - service: "storj", - username: "STORJ_USERNAME", - password: "STORJ_PASSWORD", -}); -``` - -- Infura - -```javascript -nftToolbox.initFileStorageService({ - service: "infura", - username: "INFURA_USERNAME", - password: "INFURA_PASSWORD", -}); -``` - -- Arweave - -```javascript -nftToolbox.initFileStorageService({ - service: "arweave", - currency: "arweave", - wallet: JSON.parse(readFileSync("ARWEAVE_WALLET.json").toString()), -}); -``` diff --git a/docs/Upload/uploadCollection.md b/docs/Upload/uploadCollection.md deleted file mode 100644 index e410394..0000000 --- a/docs/Upload/uploadCollection.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Upload an NFT Collection - -In addition to Single NFTs, NFT Toolbox also provides the functionality to upload entire -NFT collections to chosen File Storage Platform. - -In order to be uploaded, a Collection has to first be initialized in the Toolbox. Here is how to -[Initialize a Collection](/docs/generate#initialize-a-collection). - -:::note -The structure of directory provided to `initCollection` as parameter `dir` is restricted. -It must contain two directories named `assets` and `metadata`. These are the directories that NFT Toolbox -will upload to File Storage. The names of Asset and corresponding Metadata files must be same. -::: - -NFT Collections are uploaded to File Storage with the `uploadCollection` function in Toolbox. The -`uploadCollection` function first uploads the `assets` directory to File Storage. Then each metadata file -in the `metadata` folder is updated with the corresponding asset's URL. -Finally the `metadata` directory is uploaded to File Storage and both Asset and Metadata -[CIDs](https://docs.ipfs.tech/concepts/content-addressing/) are returned. - -:::note -The `image` field in Metadata is named and updated in accordance with the -[OpenSea Metadata Standards](https://docs.opensea.io/docs/metadata-standards). -If a different format is required, it can be updated separately using the -[CIDs](https://docs.ipfs.tech/concepts/content-addressing/) returned by the function. -::: - -## Example - -**After [Initializing a Collection](/docs/generate#initialize-a-collection) and [Initializing the File Storage](/docs/Upload/initializeFileStorage),** - -```javascript -const uploadCollectionExample = async function () { - const { assetCID, metadataCID } = await nftToolbox.uploadCollectionNFT(); - console.log(assetCID, metadataCID); -}; -uploadCollectionExample(); -``` diff --git a/docs/Upload/uploadSingle.md b/docs/Upload/uploadSingle.md deleted file mode 100644 index 51f5263..0000000 --- a/docs/Upload/uploadSingle.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Upload a Single NFT - -An NFT is represented by a digital asset and its metadata. NFT Toolbox provides the functionality to -upload a single NFT to the chosen File Storage Platform. - -This is done with the `uploadSingleNFT` function. It takes the Path to an Asset File and a Metadata Object -as parameters. First the Asset file is uploaded. The Uploaded Asset's URL is updated in the Metadata's `image` -field. Finally the updated Metadata is uploaded and both Asset and Metadata -[CIDs](https://docs.ipfs.tech/concepts/content-addressing/) are returned. - -:::note -The `image` field in Metadata is named and updated in accordance with the -[OpenSea Metadata Standards](https://docs.opensea.io/docs/metadata-standards). -If a different format is required, it can be updated separately using the -[CIDs](https://docs.ipfs.tech/concepts/content-addressing/) returned by the function. -::: - -## Example - -**After [Initializing the File Storage](/docs/Upload/initializeFileStorage),** - -```javascript -const nftImagePath = "./path/to/YourAsset.png"; -const nftMetadata = { - name: "Your Single NFT", - description: "This is a single NFT", -}; - -const uploadSingleExample = async function () { - const { assetCID, metadataCID } = await nftToolbox.uploadSingleNFT( - nftImagePath, - nftMetadata - ); - console.log(assetCID, metadataCID); -}; -uploadSingleExample(); -``` diff --git a/docs/generate.md b/docs/generate.md deleted file mode 100644 index 4437d18..0000000 --- a/docs/generate.md +++ /dev/null @@ -1,115 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Generate Collections - -NFT Toolbox provides the functionality for generating Image and Metadata files for an NFT Collection -by super-imposing Layer Images according to a schema. This is a popular method for creating collections -in the NFT community. Read more about it [here](https://danewesolko.com/how-to-create-layers-for-nft-art-projects/). - -## Layer Images - -To generate NFT Images you will first need a directory of Layer Images. -The structure of this directory and the file names of images are used to generate the metadata files for the collection. -So they must be as described below. - -### Directory Structure - -Images of each Layer should be in a separate directory. These Layer directories should all preferrably be in a parent directory. -But a separate path can be provided for each Layer directory. - -Each Layer directory can optionally be named same as the **Layer Name** (Used as _trait_type_ in metadata attributes). - -Each Layer directory must only contain image files with the same file format. - -### File Name - -The Image file names should be the **Image Name** (Used as the _value_ in metadata attributes). - -The **Image Name** can optionally be appended with a **Rarity Delimiter** followed by its **Rarity Weight**. - -The **Rarity Delimiter** is a character, preferrably non alpha-numeric, other than '.' - -The **Rarity Weight** of an image is used to specify how frequently it is to be used instead of other images in the same Layer. -**Rarity Weight** must be a positive integer. - -Examples of the two permissible file names would be _Black.png_ and _White#10.png_ where '#' is the **Rarity Delimiter**. - -## Initialize a Collection - -**After [Importing the package](/docs/intro#import-it-in-your-project),** - -Call the `initCollection` function to initialize a Collection with the basic details. - -```javascript -nftToolbox.initCollection({ - name: "Your Collection", - dir: "/path/to/directory/Your Collection/", - description: "Short description for Your Collecion", -}); -``` - -## Provide a Schema - -Call the `generateNFTs` function with a **Schema** object to start the generation. - -```javascript -nftToolbox.generateNFTs({ - dir: "/path/to/directory/Layers/", - size: 100, - layersOrder: [ - { name: "first layer" }, - { name: "second layer" }, - { name: "third layer", dir: "/path/to/other/directory/Third Layer/" }, - ], - format: { - width: 512, - height: 512, - smoothing: true, - }, - background: { - generate: true; - static: true; - default?: string; - brightness?: number; - }, - dnaCollisionTolerance: 1000, - rarityDelimiter: "#", - rarityDefault: "1", - shuffleIndexes: true, -}); -``` - -The attributes of **Schema** object are described below. - -| Name | Type | Description | -| ------------------------- | ------- | ------------------------------------------------------------------------------------- | -| `dir` | string | Path to parent directory containing Layer directories | -| `size` | integer | Total number of images to be generated | -| `layersOrder` | array | Array of Object containing `name` and `dir` in the Order of super-imposition. | -| `layersOrder`>`name` | string | Name of Layer (Used as _trait_type_ in metadata attributes) | -| `layersOrder`>`dir` | string | _(optional)_ Path to Layer directory. Defaults to `Schema`>`dir`/`layersOrder`>`name` | -| `format` | object | Object containing `width` `height` and `smoothing` | -| `format`>`width` | integer | Width of generated images in Pixels | -| `format`>`height` | integer | Height of generated images in Pixels | -| `format`>`smoothing` | boolean | Smoothen the Layer images after super-imposition | -| `background` | object | Object containing `generate` `static` `default` and `brightness` | -| `background`>`generate` | boolean | Add a Solid Background to all generated images | -| `background`>`static` | boolean | Use same color for all images or select colors randomly. Defaults to _false_ | -| `background`>`default` | string | Required if `static` is _true_. Hex string of color to be used | -| `background`>`brightness` | integer | Brightness of Solid Background to be added. Defaults to 50% | -| `dnaCollisionTolerance` | integer | Number of collisions required to conclude that too few layer images are provided | -| `rarityDelimiter` | string | The character used as Rarity Delimiter | -| `rarityDefault` | integer | Default value of Rarity Weight to be used for images when not specified in file name | -| `shuffleIndexes` | boolean | Generate Indexes in a shuffled order | - -:::note -The `generateNFTs` function creates Image and Metadata files in `assets` and `metadata` -directories inside the Collection Directory. -::: - -:::caution -Images and Metadata files will be created by `generateNFTs` function in the directory path provided as -`dir` to `initCollection` function. Present contents in the directory if any will be deleted. -::: diff --git a/docs/intro.md b/docs/intro.md deleted file mode 100644 index b6ce0ee..0000000 --- a/docs/intro.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Introduction - -Welcome to NFT Toolbox Documentation! - -NFT Toolbox provides simplistic implementations for the various functionalities that are a part of an -NFT creation process. -The following functionalities are currently supported : - -- Generating Images and Metadata files for an NFT Collection from Layer Images -- Uploading Asset and Metadata files to multiple decentralized file storage platforms -- Drafting (Programatically generating) Solidity Smart Contracts for NFTs for Ethereum compatible blockchains -- Deploying Smart Contracts to Ethereum compatible blockchain networks -- Interacting with Smart Contracts on Ethereum compatible blockchain networks - -## Workflows - -![Project Workflows](/workflows.png) - -## Installation and Usage - -### Install the package - -Navigate to your [Node.js](https://nodejs.org/en/download/) project and run - -```bash -npm install nft-toolbox -``` - -### Import it in your project - -The package has a Toolbox Object as the only export. It contains all the functionalities you will -need in your NFT creation process. - -```javascript -import { nftToolbox } from "nft-toolbox"; -``` - -**Ready to go!** - -You are all set to use **NFT Toolbox** in your project. -Read the subsequent sections for details of the functionalities. diff --git a/docs/workflows.png b/docs/workflows.png deleted file mode 100644 index cc52990..0000000 Binary files a/docs/workflows.png and /dev/null differ diff --git a/documentation/docs/intro.md b/documentation/docs/intro.md index b6ce0ee..fffa8fa 100644 --- a/documentation/docs/intro.md +++ b/documentation/docs/intro.md @@ -18,7 +18,7 @@ The following functionalities are currently supported : ## Workflows -![Project Workflows](/workflows.png) +![Project Workflows](../static/img/workflows.png) ## Installation and Usage diff --git a/documentation/docusaurus.config.js b/documentation/docusaurus.config.js index 14b5135..a6ac35a 100644 --- a/documentation/docusaurus.config.js +++ b/documentation/docusaurus.config.js @@ -52,7 +52,7 @@ const config = { title: "NFT Toolbox", logo: { alt: "NFT Toolbox Logo", - src: "img/logo.svg", + src: "img/main-logo.png", }, items: [ { diff --git a/documentation/static/img/docusaurus.png b/documentation/static/img/docusaurus.png deleted file mode 100644 index f458149..0000000 Binary files a/documentation/static/img/docusaurus.png and /dev/null differ diff --git a/documentation/static/img/logo.svg b/documentation/static/img/logo.svg deleted file mode 100644 index 9db6d0d..0000000 --- a/documentation/static/img/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/documentation/static/img/main-logo.png b/documentation/static/img/main-logo.png new file mode 100644 index 0000000..4798467 Binary files /dev/null and b/documentation/static/img/main-logo.png differ