From 9ccc6120d1e2df9ed4d37fcd42dc71d723ce6e47 Mon Sep 17 00:00:00 2001 From: hashlips Date: Tue, 19 Oct 2021 23:18:44 +0200 Subject: [PATCH 1/2] Updated Solana Metadata --- constants/network.js | 10 ++++++++++ layers/.DS_Store | Bin 6148 -> 6148 bytes src/config.js | 25 +++++++++++++++++++++++-- src/main.js | 36 +++++++++++++++++++++++++++++++++--- utils/update_info.js | 35 ++++++++++++++++++++++++++++++----- 5 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 constants/network.js diff --git a/constants/network.js b/constants/network.js new file mode 100644 index 000000000..67e78f741 --- /dev/null +++ b/constants/network.js @@ -0,0 +1,10 @@ +"use strict"; + +const NETWORK = { + eth: "eth", + sol: "sol", +}; + +module.exports = { + NETWORK, +}; diff --git a/layers/.DS_Store b/layers/.DS_Store index 1c5c3d85c0289d55050e7d48724b3fcb53aeadff..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 100644 GIT binary patch delta 70 zcmZoMXfc=|#>AjHu~2NHo+1YW5HK<@2y8yc=*G7B0%I2AW_AvK4xj>{$am(+{342+ UKzW7)kiy9(Jj$D6L{=~Z05sDNYXATM delta 263 zcmYk1Jqp4=5QSg<+-M2~*VM@cBv$rb4GaM;@>l^pTXvAhvN8D~b Z*K_I3MtrS$%tObdx { const addMetadata = (_dna, _edition) => { let dateTime = Date.now(); let tempMetadata = { - dna: sha1(_dna), - name: `#${_edition}`, + name: `${namePrefix} #${_edition}`, description: description, image: `${baseUri}/${_edition}.png`, + dna: sha1(_dna), edition: _edition, date: dateTime, ...extraMetadata, attributes: attributesList, compiler: "HashLips Art Engine", }; + if (network == NETWORK.sol) { + tempMetadata = { + //Added metadata for solana + name: tempMetadata.name, + symbol: solanaMetadata.symbol, + description: tempMetadata.description, + //Added metadata for solana + seller_fee_basis_points: solanaMetadata.seller_fee_basis_points, + image: `image.png`, + //Added metadata for solana + external_url: solanaMetadata.external_url, + edition: _edition, + ...extraMetadata, + attributes: tempMetadata.attributes, + properties: { + files: [ + { + uri: "image.png", + type: "image/png", + }, + ], + category: "image", + creators: solanaMetadata.creators, + }, + }; + } metadataList.push(tempMetadata); attributesList = []; }; @@ -254,7 +284,7 @@ const startCreating = async () => { let failedCount = 0; let abstractedIndexes = []; for ( - let i = 1; + let i = network == NETWORK.sol ? 0 : 1; i <= layerConfigurations[layerConfigurations.length - 1].growEditionSizeTo; i++ ) { diff --git a/utils/update_info.js b/utils/update_info.js index da3c17c8e..be5854f3c 100644 --- a/utils/update_info.js +++ b/utils/update_info.js @@ -3,18 +3,32 @@ const path = require("path"); const isLocal = typeof process.pkg === "undefined"; const basePath = isLocal ? process.cwd() : path.dirname(process.execPath); +const { NETWORK } = require(path.join(basePath, "constants/network.js")); const fs = require("fs"); console.log(path.join(basePath, "/src/config.js")); -const { baseUri, description } = require(path.join(basePath, "/src/config.js")); +const { + baseUri, + description, + namePrefix, + network, + solanaMetadata, +} = require(path.join(basePath, "/src/config.js")); // read json data let rawdata = fs.readFileSync(`${basePath}/build/json/_metadata.json`); let data = JSON.parse(rawdata); data.forEach((item) => { - item.description = description; - item.image = `${baseUri}/${item.edition}.png`; + if (network == NETWORK.sol) { + item.name = `${namePrefix} #${item.edition}`; + item.description = description; + item.creators = solanaMetadata.creators; + } else { + item.name = `${namePrefix} #${item.edition}`; + item.description = description; + item.image = `${baseUri}/${item.edition}.png`; + } fs.writeFileSync( `${basePath}/build/json/${item.edition}.json`, JSON.stringify(item, null, 2) @@ -26,5 +40,16 @@ fs.writeFileSync( JSON.stringify(data, null, 2) ); -console.log(`Updated baseUri for images to ===> ${baseUri}`); -console.log(`Updated description for images to ===> ${description}`); +if (network == NETWORK.sol) { + console.log(`Updated description for images to ===> ${description}`); + console.log(`Updated name prefix for images to ===> ${namePrefix}`); + console.log( + `Updated creators for images to ===> ${JSON.stringify( + solanaMetadata.creators + )}` + ); +} else { + console.log(`Updated baseUri for images to ===> ${baseUri}`); + console.log(`Updated description for images to ===> ${description}`); + console.log(`Updated name prefix for images to ===> ${namePrefix}`); +} From 7b7ba012c9840eaec171344e338c4d8bb24294af Mon Sep 17 00:00:00 2001 From: hashlips Date: Tue, 19 Oct 2021 23:20:30 +0200 Subject: [PATCH 2/2] Fix opacity --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 359349236..0bee7278a 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ const layerConfigurations = [ name: "Eye color", options: { blend: MODE.destinationIn, - opcacity: 0.2, + opacity: 0.2, displayName: "Awesome Eye Color", }, },