2023-07-28 15:11:38 +03:00
|
|
|
// @ts-ignore
|
|
|
|
import contentHash from "content-hash";
|
|
|
|
import fs from "fs";
|
|
|
|
import path from "path";
|
|
|
|
|
|
|
|
import { DeclCalculator } from "./utils";
|
2023-08-30 22:05:46 +03:00
|
|
|
import { classicUiIpfsCid, novaUiIpfsCid, relayersUiIpfsCid, docsIpfsCid } from "./constants";
|
2023-07-28 15:11:38 +03:00
|
|
|
|
|
|
|
const contentHashToBytesMemory = (hash: string) => `hex"${hash}"`;
|
|
|
|
|
2023-08-30 22:05:46 +03:00
|
|
|
const classicUiIPFSContenthash = contentHash.fromIpfs(classicUiIpfsCid);
|
|
|
|
const novaUiIPFSContenthash = contentHash.fromIpfs(novaUiIpfsCid);
|
|
|
|
const relayersUiIPFSContenthash = contentHash.fromIpfs(relayersUiIpfsCid);
|
|
|
|
const docsIPFSContenthash = contentHash.fromIpfs(docsIpfsCid);
|
2023-07-28 15:11:38 +03:00
|
|
|
|
|
|
|
const solidityDoublePadding = " ".repeat(8);
|
|
|
|
const { calculateDecl } = new DeclCalculator("bytes memory", solidityDoublePadding, contentHashToBytesMemory);
|
|
|
|
const solidityCode =
|
|
|
|
calculateDecl({ classicUiIPFSContenthash }) +
|
|
|
|
calculateDecl({ novaUiIPFSContenthash }) +
|
|
|
|
calculateDecl({ relayersUiIPFSContenthash }) +
|
|
|
|
calculateDecl({ docsIPFSContenthash });
|
|
|
|
|
|
|
|
fs.writeFileSync(path.join("data", "ensDomainsIPFSContenthashes.txt"), solidityCode);
|