Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6613081
docs(01-ickb-utils-smarttransaction-removal): research phase domain
phroi Feb 22, 2026
a01c7e2
docs(01): create phase plan
phroi Feb 22, 2026
7081869
feat(01-01): add ErrorNervosDaoOutputLimit and assertDaoOutputLimit i…
phroi Feb 22, 2026
2decd06
refactor(01-01): replace 7 inline DAO output checks with assertDaoOut…
phroi Feb 22, 2026
88aed6a
docs(01-01): complete DAO output limit consolidation plan
phroi Feb 22, 2026
85ead3a
refactor(01-02): inline getHeader/addHeaders and remove from public API
phroi Feb 22, 2026
6fe464d
docs(01-02): complete getHeader/addHeaders removal plan
phroi Feb 22, 2026
2e832ae
refactor(01-03): update all method signatures from SmartTransaction t…
phroi Feb 22, 2026
de8f4a7
refactor(01-03): delete SmartTransaction class, CapacityManager class…
phroi Feb 22, 2026
534a251
docs(01-03): complete SmartTransaction/CapacityManager deletion plan
phroi Feb 22, 2026
9e75c62
docs(phase-1): complete phase execution
phroi Feb 22, 2026
12c2b58
refactor(ccc-dev): replace local DAO patch with upstream CCC PR #359
phroi Feb 22, 2026
2198f2b
refactor(01-03): rename @param tx → txLike in JSDoc comments
phroi Feb 22, 2026
d0604f2
docs: restructure AGENTS.md with PR workflow and CCC upstream sections
phroi Feb 22, 2026
3b086d2
build: default noEmit in root tsconfig, override in emitting packages
phroi Feb 22, 2026
1e1c0b8
chore: add changeset for SmartTransaction removal
phroi Feb 22, 2026
3126894
refactor(ccc-dev): update PR #359 merge ref after adding changeset
phroi Feb 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/remove-smarttx-capacitymgr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@ickb/utils": major
"@ickb/core": major
"@ickb/dao": major
"@ickb/order": major
"@ickb/sdk": major
---

Remove SmartTransaction and CapacityManager in favor of plain TransactionLike

- Delete `SmartTransaction` class and `CapacityManager` class from `@ickb/utils`
- Replace all `SmartTransaction` parameters with `ccc.TransactionLike` across all packages
- Inline `getHeader`/`addHeaders` helpers and remove from public API
- Consolidate 7 inline DAO output limit checks into `assertDaoOutputLimit` in CCC core
- Change `UdtHandler.completeUdt` return type from `[number, boolean]` to `[ccc.Transaction, number, boolean]`
- Replace local CCC patch with upstream PR #359
22 changes: 11 additions & 11 deletions .planning/REQUIREMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Requirements for initial milestone. Each maps to roadmap phases.

### SmartTransaction Removal

- [ ] **SMTX-01**: All manager method signatures across all 5 library packages accept `ccc.TransactionLike` instead of `SmartTransaction`, following CCC's convention (TransactionLike input, Transaction output); `CapacityManager` is deleted (not migrated)
- [ ] **SMTX-02**: `SmartTransaction` class and its `completeFee()` override are deleted from `@ickb/utils`
- [x] **SMTX-01**: All manager method signatures across all 5 library packages accept `ccc.TransactionLike` instead of `SmartTransaction`, following CCC's convention (TransactionLike input, Transaction output); `CapacityManager` is deleted (not migrated)
- [x] **SMTX-02**: `SmartTransaction` class and its `completeFee()` override are deleted from `@ickb/utils`
- [ ] **SMTX-03**: Fee completion uses CCC-native `ccc.Transaction.completeFeeBy()` or `completeFeeChangeToLock()` with DAO-aware capacity calculation
- [ ] **SMTX-04**: `getHeader()` function and `HeaderKey` type are removed from `@ickb/utils`; all call sites inline CCC client calls (`client.getTransactionWithHeader()`, `client.getHeaderByNumber()`); header caching handled transparently by `ccc.Client.cache`
- [ ] **SMTX-05**: UDT handler registration (`addUdtHandlers()`) is replaced by direct `Udt` instance usage or standalone utility functions
- [ ] **SMTX-06**: 64-output NervosDAO limit check is consolidated into a single utility function (currently scattered across 6 locations)
- [x] **SMTX-04**: `getHeader()` function and `HeaderKey` type are removed from `@ickb/utils`; all call sites inline CCC client calls (`client.getTransactionWithHeader()`, `client.getHeaderByNumber()`); header caching handled transparently by `ccc.Client.cache`
- [x] **SMTX-05**: UDT handler registration (`addUdtHandlers()`) is replaced by direct `Udt` instance usage or standalone utility functions
- [x] **SMTX-06**: 64-output NervosDAO limit check is consolidated into a single utility function (currently scattered across 6 locations)
- [ ] **SMTX-07**: `IckbUdtManager` multi-representation UDT balance logic (xUDT + receipts + deposits) survives removal intact -- conservation law `Input UDT + Input Receipts = Output UDT + Input Deposits` is preserved
- [ ] **SMTX-08**: `IckbSdk.estimate()` and `IckbSdk.maturity()` continue working after SmartTransaction removal
- [ ] **SMTX-09**: All 5 library packages (`@ickb/utils`, `@ickb/dao`, `@ickb/order`, `@ickb/core`, `@ickb/sdk`) compile and pass type checking after removal
Expand Down Expand Up @@ -81,12 +81,12 @@ Which phases cover which requirements. Updated during roadmap creation.

| Requirement | Phase | Status | Notes |
|-------------|-------|--------|-------|
| SMTX-01 | Phase 1 | Pending | Feature-slice: all signatures migrated to TransactionLike across all packages |
| SMTX-02 | Phase 1 | Pending | |
| SMTX-01 | Phase 1 | Complete | All signatures migrated to TransactionLike across all packages (01-03) |
| SMTX-02 | Phase 1 | Complete | SmartTransaction class deleted from @ickb/utils (01-03) |
| SMTX-03 | Phase 6 | Pending | |
| SMTX-04 | Phase 1 | Pending | getHeader()/HeaderKey removed, CCC client calls inlined |
| SMTX-05 | Phase 4, 5 | Pending | addUdtHandlers() removed in Phase 1; replacement pattern finalized in Phase 4-5 after Phase 3 decision |
| SMTX-06 | Phase 1 | Pending | DAO check contributed to CCC core via ccc-dev/ |
| SMTX-04 | Phase 1 | Complete | getHeader()/HeaderKey removed, CCC client calls inlined |
| SMTX-05 | Phase 1, 4, 5 | Complete | addUdtHandlers() replaced with tx.addCellDeps(udtHandler.cellDeps) (01-03); UdtHandler/UdtManager replacement deferred to Phase 4-5 |
| SMTX-06 | Phase 1 | Complete | DAO check contributed to CCC core via ccc-dev/ (01-01) |
| SMTX-07 | Phase 5 | Pending | |
| SMTX-08 | Phase 6 | Pending | |
| SMTX-09 | Phase 7 | Pending | |
Expand All @@ -109,4 +109,4 @@ Which phases cover which requirements. Updated during roadmap creation.

---
*Requirements defined: 2026-02-21*
*Last updated: 2026-02-22 after Phase 1 context (feature-slice restructure)*
*Last updated: 2026-02-22 after 01-03 execution (SMTX-01, SMTX-02, SMTX-05 completed; Phase 1 complete)*
12 changes: 6 additions & 6 deletions .planning/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This roadmap delivers the v1 milestone: removing the abandoned SmartTransaction

Decimal phases appear between their surrounding integers in numeric order.

- [ ] **Phase 1: SmartTransaction Removal (feature-slice)** - Delete SmartTransaction class and infrastructure across all packages; contribute 64-output DAO limit check to CCC core; migrate all method signatures to ccc.TransactionLike
- [x] **Phase 1: SmartTransaction Removal (feature-slice)** - Delete SmartTransaction class and infrastructure across all packages; contribute 64-output DAO limit check to CCC core; migrate all method signatures to ccc.TransactionLike
- [ ] **Phase 2: CCC Utility Adoption** - Replace local utility functions that duplicate CCC equivalents across all packages; preserve iCKB-unique utilities
- [ ] **Phase 3: CCC Udt Integration Investigation** - Assess feasibility of subclassing CCC's Udt class for iCKB's multi-representation value; design header access pattern; document decision
- [ ] **Phase 4: Deprecated CCC API Replacement** - Replace deprecated CCC API calls (`udtBalanceFrom`, etc.) with `@ckb-ccc/udt` equivalents in dao and order packages; finalize UDT handler replacement pattern based on Phase 3 findings
Expand All @@ -33,12 +33,12 @@ Decimal phases appear between their surrounding integers in numeric order.
4. A 64-output NervosDAO limit check exists in CCC core (via `ccc-dev/`): `completeFee()` safety net, standalone async utility, and `ErrorNervosDaoOutputLimit` error class; all 6+ scattered checks across dao/core packages are replaced with calls to this CCC utility
5. ALL manager method signatures across ALL 5 library packages accept `ccc.TransactionLike` instead of `SmartTransaction`, following CCC's convention (TransactionLike input, Transaction output with `Transaction.from()` conversion at entry point)
6. `pnpm check:full` passes after each feature-slice removal step — no intermediate broken states
**Plans**: TBD
**Plans**: 3 plans

Plans:
- [ ] 01-01: TBD
- [ ] 01-02: TBD
- [ ] 01-03: TBD
- [x] 01-01-PLAN.md — Build CCC DAO utility (ErrorNervosDaoOutputLimit + assertDaoOutputLimit) and replace all 7 scattered DAO checks
- [x] 01-02-PLAN.md — Remove getHeader()/HeaderKey, inline CCC client calls at all call sites, replace addHeaders with headerDeps push
- [x] 01-03-PLAN.md — Delete SmartTransaction + CapacityManager, update all method signatures to TransactionLike, clean SDK

### Phase 2: CCC Utility Adoption
**Goal**: Local utility functions that duplicate CCC core functionality are replaced with CCC equivalents across all packages; iCKB-unique utilities are explicitly preserved
Expand Down Expand Up @@ -138,7 +138,7 @@ Phases execute in numeric order: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7

| Phase | Plans Complete | Status | Completed |
|-------|----------------|--------|-----------|
| 1. SmartTransaction Removal (feature-slice) | 0/3 | Not started | - |
| 1. SmartTransaction Removal (feature-slice) | 3/3 | Complete | 2026-02-22 |
| 2. CCC Utility Adoption | 0/2 | Not started | - |
| 3. CCC Udt Integration Investigation | 0/2 | Not started | - |
| 4. Deprecated CCC API Replacement | 0/2 | Not started | - |
Expand Down
40 changes: 25 additions & 15 deletions .planning/STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ See: .planning/PROJECT.md (updated 2026-02-20)

## Current Position

Phase: 1 of 7 (SmartTransaction Removal feature-slice)
Plan: 0 of 3 in current phase
Status: Context gathered, ready to plan
Last activity: 2026-02-22 -- Phase 1 context gathered
Phase: 1 of 7 (SmartTransaction Removal -- feature-slice)
Plan: 3 of 3 in current phase (phase complete)
Status: Phase 01 complete, ready for phase 02
Last activity: 2026-02-22 -- Plan 01-03 executed (SmartTransaction/CapacityManager deletion)

Progress: [░░░░░░░░░░] 0%
Progress: [██░░░░░░░░] 15%

## Performance Metrics

**Velocity:**
- Total plans completed: 0
- Average duration: -
- Total execution time: 0 hours
- Total plans completed: 3
- Average duration: ~17min
- Total execution time: 0.9 hours

**By Phase:**

| Phase | Plans | Total | Avg/Plan |
|-------|-------|-------|----------|
| - | - | - | - |
| 01 | 3/3 | 52min | 17min |

**Recent Trend:**
- Last 5 plans: -
- Trend: -
- Last 5 plans: 01-01 (~30min), 01-02 (~6min), 01-03 (~16min)
- Trend: accelerating

*Updated after each plan completion*

Expand All @@ -42,12 +42,22 @@ Progress: [░░░░░░░░░░] 0%
Decisions are logged in PROJECT.md Key Decisions table.
Recent decisions affecting current work:

- [Roadmap]: Phase 1 uses feature-slice approach each removal chased across all packages, build stays green after every step. SMTX-01 (all signatures to TransactionLike) completed in Phase 1, not Phase 5.
- [Roadmap]: Phase 1 uses feature-slice approach -- each removal chased across all packages, build stays green after every step. SMTX-01 (all signatures to TransactionLike) completed in Phase 1, not Phase 5.
- [Roadmap]: UDT investigation (Phase 3) is a design phase that produces a decision document; its outcome determines UdtHandler/UdtManager replacement pattern used in Phases 4-5
- [Roadmap]: Phases 4-5 reduced in scope: Phase 4 focuses on deprecated API replacement + UDT pattern finalization in dao/order; Phase 5 focuses on IckbUdt implementation + conservation law in core
- [Phase 1 Context]: DAO 64-output limit check contributed to CCC core via ccc-dev/, CCC PR submitted during Phase 1
- [Phase 1 Context]: getHeader()/HeaderKey removed entirely inline CCC client calls at read-only call sites; addHeaders() call sites in DaoManager/LogicManager push to tx.headerDeps directly
- [Phase 1 Context]: getHeader()/HeaderKey removed entirely -- inline CCC client calls at read-only call sites; addHeaders() call sites in DaoManager/LogicManager push to tx.headerDeps directly
- [Phase 1 Context]: Script comparison must always use full Script.eq(), never just codeHash comparison
- [01-01]: Added ccc-dev local patch mechanism (pins/local/*.patch) for deterministic replay of CCC modifications
- [01-01]: DaoManager.requestWithdrawal/withdraw client parameter placed before optional options for cleaner API
- [01-01]: assertDaoOutputLimit uses early return when outputs <= 64 for zero-cost common case
- [01-02]: Moved getHeader/HeaderKey to transaction.ts as non-exported internals (SmartTransaction still uses internally until Plan 03 deletion)
- [01-02]: TransactionHeader moved to utils.ts as canonical location for downstream consumers
- [01-02]: Inlined CCC client calls use explicit null checks with descriptive error messages
- [01-03]: All manager methods accept ccc.TransactionLike and return ccc.Transaction (TransactionLike pattern)
- [01-03]: Replaced addUdtHandlers with tx.addCellDeps(this.udtHandler.cellDeps) across all packages
- [01-03]: SmartTransaction class and CapacityManager class fully deleted from @ickb/utils
- [01-03]: SDK getCkb() uses direct client.findCellsOnChain instead of CapacityManager

### Pending Todos

Expand All @@ -61,5 +71,5 @@ None yet.
## Session Continuity

Last session: 2026-02-22
Stopped at: Phase 1 context gathered
Resume file: .planning/phases/01-ickb-utils-smarttransaction-removal/01-CONTEXT.md
Stopped at: Completed 01-03-PLAN.md (Phase 01 complete)
Resume file: .planning/phases/01-ickb-utils-smarttransaction-removal/01-03-SUMMARY.md
Loading