query metadata script

This commit is contained in:
Moon Man 2023-01-29 22:21:37 -05:00
parent c4d1ab0b7f
commit c29b0a0336
1 changed files with 17 additions and 0 deletions

17
scripts/query-metadata.js Normal file
View File

@ -0,0 +1,17 @@
const Wrapper = artifacts.require("CurioERC1155Wrapper");
module.exports = async (callback) => {
console.log("Start.");
const wrapper = await Wrapper.deployed();
const dataURI = await wrapper.uri(1);
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();
}