All lessons · CCC (TypeScript SDK) · Start here · Glossary
Convert Fiber RPC snake_case scripts to CCC camelCase ScriptLikeWorkingReproduced
Reproduced · Check: right · Checked 2026-11-19
Fiber RPC returns scripts as { code_hash, hash_type, args }, but CCC's ScriptLike expects { codeHash, hashType, args }. In this commit a Fiber shaped lock was passed to a CCC based sweep as if it were a ccc.ScriptLike and the sweep failed, so map the fields explicitly before handing the script to CCC.
Why it matters: If a Fiber snake_case script is passed where CCC expects a ScriptLike, codeHash and hashType come through undefined, so the hosted settlement sweep failed and the user's funds were not swept.
Pattern
{ codeHash: to.code_hash, hashType: to.hash_type, args: to.args }Taken from the commit, shortened.
Reproduced by a test
A public test runs what this lesson says on @ckb-ccc/core 1.23.1, with no node. Anyone can run it.
tests/ccc/fiber-snake-case-script.test.mjs
- Concepts
- Data encoding (molecule, hex, bigints), Channels and payments
- Evidence
- Reproduced: reproduced by a public test
- First seen
- 2026-10-14
- Last changed
- 2026-10-14
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-10-14 · officialcmg/ckb-keyway · more from this project
More about CCC (TypeScript SDK)
- Hand-rolled Script hash: hash_type byte mapping and molecule offsets, checked against CCC
- Parsing snake_case JSON-RPC transactions in CCC
- Use JsonRpcTransformers.transactionFrom to serialize CCC transactions for CKB/Fiber RPC
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Convert Fiber RPC snake_case scripts to CCC camelCase ScriptLike", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/convert-fiber-rpc-snake-case-scripts-to-ccc-camelcase-script, CC BY 4.0, last changed 2026-10-14.