-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-templates.js
executable file
·54 lines (46 loc) · 1.71 KB
/
create-templates.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
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
const { createSchema } = require('./nft/create-schema')
const { createTemplate } = require('./nft/create-template')
const COLLECTION_NAME = 'test1test1'
const SCHEMA_NAME = 'test'
const SCHEMA = {
series: 'uint16',
name: 'string',
image: 'string',
}
const templates = [
{ max_supply: 100, series: 1, name: 'Circuits', image: 'QmSZH4X1LqQVscGjvQeVCLUNjxs2ZyFSepisQnd77eXCHw' },
{ max_supply: 100, series: 1, name: 'Fire Keyboard', image: 'QmPLx7CoNmWsZJAe8peoyAiiY5K69W9HepV61NHmKPKimq' },
{ max_supply: 100, series: 1, name: 'Coding left', image: 'QmWYfGbELmYhiPVwurrL71SmdnsP5V1VsvP8AcjqjHaw2e' },
{ max_supply: 100, series: 1, name: 'Coding top', image: 'QmWuTSW2YnmwTqYP73CoCBiWL9F1udMGWyGodrnKEBkujV' },
{ max_supply: 100, series: 1, name: 'Coding right', image: 'QmcTWenDjqGDpJeajiNPHVedZTnNAEgQfgeAPuL2tisnjj' },
{ max_supply: 100, series: 1, name: 'Matrix screen', image: 'QmPpa2WHBBknqYRUcrRqgLicYzGc4KXkgHe1gQhHucJkCZ' },
]
const timer = ms => new Promise(res => setTimeout(res, ms))
const doSchema = async () => {
await createSchema({
collection_name: COLLECTION_NAME,
schema_name: SCHEMA_NAME,
schema: SCHEMA
})
}
const doTemplate = async (template) => {
await createTemplate({
collection_name: COLLECTION_NAME,
schema_name: SCHEMA_NAME,
max_supply: template.max_supply,
immutable_data: Object.entries(SCHEMA).map(([key, type]) => ({
key: key,
value: [type, template[key]]
}))
})
}
const main = async () => {
await doSchema()
await timer(3000)
for (i=0;i < templates.length;i++) {
await doTemplate(templates[i])
await timer(2000)
}
}
main()