Skip to content

[FR] Merge iCKB Utils UDTHandler features into CCC's Udt #227

@phroi

Description

@phroi

Hello CKB DevRel folks!!
I was wondering, have you considered merging iCKB Utils' UDTHandler Features into the CCC library's Udt?

Summary

We currently maintain three parallel UDT implementations:

  1. CCC's Udt class (metadata, transfer, mint, basic completeBy)
  2. iCKB Utils' UdtHandler/UdtManager (SmartTransaction-aware balance tracking, input aggregation, change-cell via completeUdt)
  3. iCKB Core's IckbUdtManager (overrides input balance for iCKB UDT cells, receipt and deposit transformation logic)

This duplication leads to inconsistent behaviors, extra maintenance, and diverging sUDT data-length checks.

CCC Feature Request

In the CCC library's Udt class, add methods/properties from iCKB Utils' UdtManager:

  • getInputsUdtBalance(client, tx) (open to change the name)
  • getOutputsUdtBalance(tx) (we can find a better name)
  • completeBy(tx, signer, options?), support shouldAddInputs?: boolean and compressState?: boolean as options
  • cellDeps: ccc.CellDep[];

Note: I'm open to change any of the previous names if necessary.

ICKB side of things

Deprecate iCKB Utils' standalone UdtHandler/UdtManager. Instead, let IckbUdtManager extend the enhanced CCC Udt class, overriding only:

  • The xUDT data-length check (≥16 bytes on-chain)
  • Custom input-balance logic for:
    • iCKB receipt cells
    • DAO deposit/withdrawal cells
  • Accept both ccc.Transaction and SmartTransaction as completeBy inputs, detect type, use smartTransaction.copy(tx) when needed in SmartTransaction completeFee, and return the same transaction type.

Keep up the Great Work, Phroi %28

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions