Nft minting works

This commit is contained in:
2022-01-23 01:18:18 +03:00
parent 11cf01c39d
commit 7f4c9bcd79
5 changed files with 1705 additions and 15176 deletions

View File

@@ -1,15 +1,26 @@
import dotenv from 'dotenv';
dotenv.config();
import Rarepress from 'rarepress';
import Rareterm from 'rareterm.node';
import getImages from './getImages.js';
(async () => {
const rarepress = new Rarepress();
// await rarepress.init({ network: 'mainnet' });
const rarepress = new Rareterm();
await rarepress.init({ host: "https://rinkeby-beta.rarepress.org/v1" });
(await getImages(-1)).forEach((image) => {
console.log(image);
// const cid = await rarepress.fs.add()
(await getImages(-1)).forEach(async (image, index) => {
const cid = await rarepress.fs.add(Buffer.from(image));
const token = await rarepress.token.create({
type: "ERC721",
metadata: {
name: `${index}`,
description: `${index}.svg`,
image: `/ipfs/${cid}`,
},
});
await rarepress.fs.push(cid);
await rarepress.fs.push(token.uri);
const sent = await rarepress.token.send(token);
console.log(`[${index}] published: https://rarible.com/token/${sent.id}`);
})
})();