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

${hashStringified}

${exchangesStringified}

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