diff --git a/constants/network.js b/constants/network.js index bd962822e..c47463ae6 100644 --- a/constants/network.js +++ b/constants/network.js @@ -1,6 +1,7 @@ const NETWORK = { eth: "eth", sol: "sol", + chia: "chia" }; module.exports = { diff --git a/src/config.js b/src/config.js index c46d867a0..ec14ee323 100644 --- a/src/config.js +++ b/src/config.js @@ -21,6 +21,36 @@ const solanaMetadata = { ], }; +const chiaMetadata = { + format: "CHIP-0007", + sensitive_content: false, + collection: { + id: "4fa5e6b1-231a-7bae-b18e-c86dced47f52", + name: "collection name", + attributes: [ + { + type: "description", + value: "A NFT collection which only purpose is to test minting. Be ready for the testnet to be flooded with this collection :D! (Love to the Chia community <3)" + }, + { + "type": "twitter", + "value": "@twitterAccount" + }, + { + "type": "website", + "value": "https://mywebsite.com" + }, + { + "type": "icon", + "value": "https://mywebsite.com/icon" + }, + { + "type": "banner", + "value": "https://mywebsite.com/banner" + } + ] + } +}; // If you have selected Solana then the collection starts from 0 automatically const layerConfigurations = [ { @@ -117,6 +147,7 @@ module.exports = { namePrefix, network, solanaMetadata, + chiaMetadata, gif, preview_gif, }; diff --git a/src/main.js b/src/main.js index e9c08dcf2..9ded2eb41 100644 --- a/src/main.js +++ b/src/main.js @@ -20,6 +20,7 @@ const { namePrefix, network, solanaMetadata, + chiaMetadata, gif, } = require(`${basePath}/src/config.js`); const canvas = createCanvas(format.width, format.height); @@ -141,6 +142,21 @@ const addMetadata = (_dna, _edition) => { attributes: attributesList, compiler: "HashLips Art Engine", }; + + if (network == NETWORK.chia) { + tempMetadata = { + format: chiaMetadata.format, + name: tempMetadata.name, + description: tempMetadata.description, + minting_tool: tempMetadata.compiler, + sensitive_content: chiaMetadata.sensitive_content, + series_number: _edition, + series_total: layerConfigurations[layerConfigurations.length - 1].growEditionSizeTo, + attributes: tempMetadata.attributes, + collection: chiaMetadata.collection + }; + } + if (network == NETWORK.sol) { tempMetadata = { //Added metadata for solana @@ -308,7 +324,11 @@ const writeMetaData = (_data) => { }; const saveMetaDataSingleFile = (_editionCount) => { - let metadata = metadataList.find((meta) => meta.edition == _editionCount); + let findFunction = (meta) => meta.edition == _editionCount; + if (network == NETWORK.chia){ + findFunction = (meta) => meta.series_number == _editionCount; + } + let metadata = metadataList.find(findFunction); debugLogs ? console.log( `Writing metadata for ${_editionCount}: ${JSON.stringify(metadata)}`