chore: bring the token-list enrichment tooling into script/lib (closes #495)
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/ 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, and stops on an address that matches no list entry. Exported as
applyEnrichment, it is run by tests/applyEnrichment.test.js, which fails when
the committed list differs from what it writes. Its table of websites now gives
FLOKI and TURBO a URL. make enrich-tokens and make apply-enrichment run the
programs. script/check-censored allows the MUSD token's on-chain name in the
data file.
Model: opus-5-5
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// 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`). This fails when the committed list differs from
|
||||
// what the script writes from the committed data, and when the data or the
|
||||
// script's table of websites has an address that no entry in the list matches.
|
||||
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user