-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrenderNewMetadata.js
44 lines (37 loc) · 1.32 KB
/
renderNewMetadata.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';
const {create} = require('ipfs-http-client');
const fs = require('fs');
const runAsync = async () => {
// const ipfs = create('/ip4/127.0.0.1/tcp/5001')
let imagesUrl = ["ipfs://QmWGhDYrpax3T2r6pt6sCfk6PKHSVs4mMzJVds35YyR7b7"]
// let metaDatas = [
// {
// "name": "The Sevens V4 #1",
// "image": "ipfs://QmWGhDYrpax3T2r6pt6sCfk6PKHSVs4mMzJVds35YyR7b7",
// "attributes": [
// {
// "trait_type": "Status",
// "value": "Revealed"
// }
// ]
// },
// {
// "name": "The Sevens V4 #2",
// "image": "ipfs://QmSngWdmbnfhUydbJtGqrSrZePKpVdTYSeKJFcD1VZRHFE",
// "attributes": [
// {
// "trait_type": "Status",
// "value": "Revealed"
// }
// ]
// }
// ]
for (let i = 0; i < 10000; i++) {
// let data = JSON.stringify(metaDatas[i - 1]);
const data = fs.readFileSync(`./smart-contract-metadata/metadata/${i + 1}`, 'utf8');
const dataToJSON = JSON.parse(data);
dataToJSON.image = imagesUrl[0];
fs.writeFileSync(`./smart-contract-metadata/realMetadata/${i + 1}`, JSON.stringify(dataToJSON));
}
}
runAsync();