CKB Pulse

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

Prefer
{ 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)

More about CCC (TypeScript SDK)

All 33 in this topic

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.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.