CKB Pulse

Todas as lições · xUDT and tokens · Começa aqui · Glossário

Carry type script and data into the output when spending a lock-only custody cellPráticoDe uma correção

De uma correção · Verificação: em parte certa · Verificada em 2026-11-19

When a custom lock's spend rebuilds an output from an input cell that may carry a type script (a UDT held in custody, say), copy cell.cellOutput.type and cell.outputData into the output and change only the lock; writing outputsData "0x" with no type burns or strands the token. Add the type script's cell deps to the transaction before signing, because the signature covers the cell deps and callers cannot append them afterwards, and refuse to build the spend if a typed cell comes without them. If the lock also constrains who gets the capacity (as Tranfr's recipient claim does today), follow that rule instead of a plain copy.

Porque importa: Without it, the spend rebuilds the custody cell as plain capacity with empty data, so a UDT held in it is dropped. A typed cell's script would also lack its cell deps, which cannot be added once the transaction is signed.

Padrão

Preferir
outputs: [{ lock: toLock, type: cell.cellOutput.type, capacity: cell.cellOutput.capacity }], outputsData: [cell.outputData],

Tirado do commit, encurtado.

Um teste mudou no mesmo commit

Está ao lado da correcção. Nós não o corremos.

Conceitos
Transaction building and fees, Cell deps and script lookup, Witnesses and signatures
Evidência
De uma correção: de um projeto, verificada contra o commit
Vista pela primeira vez
2026-10-21
Última mudança
2026-10-21
Última verificação
2026-11-19
Verificação contra o commit
em parte certa: um núcleo verdadeiro, com uma parte solta ou demasiado larga

Fontes (1)

Mais sobre xUDT and tokens

Ver as 2 deste tema

Manténs um projeto de onde esta lição veio? Confirma ou corrige

Citar esta lição
LusoCryptoLabs, "Carry type script and data into the output when spending a lock-only custody cell", CKB lessons, https://pulse.lusocryptolabs.com/learned/xudt/carry-type-script-and-data-into-the-output-when-spending-a-l, CC BY 4.0, last changed 2026-10-21.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.