The two node programs and the data file from f7a2437 regenerate the name and
url of each token in src/shared/tokenList.js. They are now CommonJS under
script/lib/, find their files from their own location, and read
ethereum-lists at a pinned commit. The apply step also rewrites an entry that
already has a name and url, so it runs on the current list. It is exported as
applyEnrichment, and tests/applyEnrichment.test.js fails when the committed
list differs from what it writes from the committed data. make enrich-tokens
and make apply-enrichment run them. script/check-censored allows the MUSD
token's on-chain name in the data file.
Model: opus-5-5
20 lines
805 B
JavaScript
20 lines
805 B
JavaScript
// The token names and URLs in src/shared/tokenList.js are written from
|
|
// script/lib/token-enrichment.json by script/lib/apply-enrichment.js
|
|
// (`make apply-enrichment`). The committed list must be exactly what it writes
|
|
// from the committed data, so the list, the data and the script cannot drift
|
|
// apart.
|
|
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const enrichment = require("../script/lib/token-enrichment.json");
|
|
const { applyEnrichment } = require("../script/lib/apply-enrichment");
|
|
|
|
test("src/shared/tokenList.js is what make apply-enrichment writes from the committed data", () => {
|
|
const committed = fs.readFileSync(
|
|
path.join(__dirname, "..", "src/shared/tokenList.js"),
|
|
"utf8",
|
|
);
|
|
expect(applyEnrichment(committed, enrichment)).toBe(committed);
|
|
});
|