"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.importBEP20Exchange = void 0;
const fs_1 = __importDefault(require("fs"));
const fetch_1 = require("../fetch");
const importBEP20Exchange = async (outputDir) => {
    console.log("importing bep 20 exchange tokens...");
    try {
        const [bep20Exchange, hash] = await (0, fetch_1.fetchTokensFromCDN)("exchange/bep20.json");
        fs_1.default.writeFileSync(`${outputDir}/exchange/bep20.json`, JSON.stringify(bep20Exchange));
        if (hash) {
            fs_1.default.writeFileSync(`${outputDir}/exchange/bep20-hash.json`, JSON.stringify(hash));
        }
        const bep20ExchangeTypeStringified = `export type BEP20Exchange = [string, string, string];`;
        const hashStringified = hash ? `export { default as hash } from "./bep20-hash.json";` : "";
        const tokensStringified = `import tokens from "./bep20.json";`;
        const exportstringified = `export default tokens as BEP20Exchange[];`;
        const tsFile = `${bep20ExchangeTypeStringified}

${hashStringified}

${tokensStringified}

${exportstringified}
`;
        fs_1.default.writeFileSync(`${outputDir}/exchange/bep20.ts`, tsFile);
        console.log("importing bep 20 exchange tokens success");
    }
    catch (err) {
        console.error(err);
    }
};
exports.importBEP20Exchange = importBEP20Exchange;
//# sourceMappingURL=bep20.js.map