"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.importTRC20Exchange = void 0;
const fs_1 = __importDefault(require("fs"));
const fetch_1 = require("../fetch");
const importTRC20Exchange = async (outputDir) => {
    console.log("importing TRC20 exchange...");
    try {
        const [trc20Exchange, hash] = await (0, fetch_1.fetchTokensFromCDN)("exchange/trc20.json");
        fs_1.default.writeFileSync(`${outputDir}/exchange/trc20.json`, JSON.stringify(trc20Exchange));
        if (hash) {
            fs_1.default.writeFileSync(`${outputDir}/exchange/trc20-hash.json`, JSON.stringify(hash));
        }
        const trc20typeStringified = `export type TRC20Exchange = [string, string, string];`;
        const hashStringified = hash ? `export { default as hash } from "./trc20-hash.json";` : "";
        const exchangesStringified = `import exchanges from "./trc20.json";`;
        const exportStringified = `export default exchanges as TRC20Exchange[];`;
        fs_1.default.writeFileSync(`${outputDir}/exchange/trc20.ts`, `${trc20typeStringified}

${hashStringified}

${exchangesStringified}

${exportStringified}
`);
        console.log("importing TRC20 exchange success");
    }
    catch (err) {
        console.error(err);
    }
};
exports.importTRC20Exchange = importTRC20Exchange;
//# sourceMappingURL=trc20.js.map