@vechain/vebetterdao-contracts
Version:
Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.
17 lines (16 loc) • 787 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.uploadMetadataToIpfs = uploadMetadataToIpfs;
const _1 = require(".");
async function uploadMetadataToIpfs(METADATA_PATH) {
try {
// Zip the directory and get the path to the zip file
await (0, _1.zipFolder)(METADATA_PATH, `${METADATA_PATH}.zip`);
const [metadataIpfsUrl] = await (0, _1.uploadDirectoryToIPFS)(`${METADATA_PATH}.zip`, METADATA_PATH);
console.log("Metadata IPFS URL:", (0, _1.toIPFSURL)(metadataIpfsUrl, undefined, (0, _1.getFolderName)(METADATA_PATH)));
}
catch (error) {
console.error("Error uploading metadata to IPFS:", error);
throw error; // Rethrow the error after logging to handle it further up the call stack.
}
}