curio-wrapper-truffle/scripts/query-metadata.js

19 lines
544 B
JavaScript
Raw Normal View History

2023-01-30 03:21:37 +00:00
const Wrapper = artifacts.require("CurioERC1155Wrapper");
module.exports = async (callback) => {
const nftId = parseInt(process.argv[6]);
console.log(`Querying metadata for ID: ${nftId}`);
2023-01-30 03:21:37 +00:00
const wrapper = await Wrapper.deployed();
const dataURI = await wrapper.uri(nftId);
2023-01-30 03:21:37 +00:00
console.log(`Data URI: ${dataURI}`);
const data = dataURI.split(',')[1];
const raw = Buffer.from(data, "base64").toString("utf8");
console.log(JSON.stringify(JSON.parse(raw), null, 4));
console.log("Done.");
callback();
}