0.22.2 • Published 4 days ago
@ckb-lumos/molecule v0.22.2
@ckb-lumos/molecule
A molecule parser written in JavaScript that helps developers to parse molecule into a codec map.
const { createParser } = require("@ckb-lumos/molecule");
const parser = createParser();
const codecMap = parser.parse(`
array Uint8 [byte; 1];
`);
codecMap.Uint8.pack(1);
lumos-molecule-codegen
A CLI to generate a set of TypeScript-friendly codec from a Molecule schema file.
To use it, you need to install @ckb-lumos/molecule
and @ckb-lumos/codec
first. The @ckb-lumos/molecule
could be devDependencies
if you only use it for codegen.
npm install -D @ckb-lumos/molecule
npm install @ckb-lumos/codec
Then you can create a lumos-molecule-codegen.json
file to configure the codegen.
// lumos-molecule-codegen.json
{
// keep | camelcase
objectKeyFormat: "camelcase",
// prepend the import statement to custom and override the generated codec
prepend: "import { Uint32, Uint64, Uint128 } from './customized'",
// the input schema file
schemaFile: "blockchain.mol",
}
Finally, run the following command to generate code to write to generated.ts
.
npx lumos-molecule-codegen > generated.ts
0.0.0-canary-eb5839a-20240515054220
4 days ago
0.0.0-canary-22a6fc2-20240515060237
4 days ago
0.0.0-canary-b70c877-20240514090823
5 days ago
0.0.0-canary-14ed633-20240513054710
6 days ago
0.0.0-canary-ed7c2fa-20240511022143
8 days ago
0.0.0-canary-aef7250-20240506034257
13 days ago
0.0.0-canary-c37d5b8-20240429081316
20 days ago
0.0.0-canary-1f22441-20240412100720
1 month ago
0.22.2
1 month ago
0.22.1
1 month ago
0.0.0-canary-2b03027-20240408033631
1 month ago
0.22.0
1 month ago
0.0.0-canary-f4b4024-20240407060721
1 month ago
0.0.0-experimental-joyid-0855d00-20240319125140
2 months ago
0.0.0-canary-f2fbef5-20240311091511
2 months ago
0.22.0-next.5
2 months ago
0.0.0-canary-4edfce4-20240312061325
2 months ago
0.0.0-canary-a1592dd-20240311153616
2 months ago
0.0.0-canary-b6a3229-20240306105347
2 months ago
0.0.0-canary-e34daa1-20240229110147
3 months ago
0.0.0-canary-3f37c5b-20240228111419
3 months ago