44 defaultFindCellsLimit ,
55 type ExchangeRatio ,
66 type ScriptDeps ,
7- type UdtHandler ,
87 type ValueComponents ,
98} from "@ickb/utils" ;
109import { Info , OrderData , Ratio , Relative , type InfoLike } from "./entities.js" ;
@@ -19,12 +18,12 @@ export class OrderManager implements ScriptDeps {
1918 *
2019 * @param script - The order script.
2120 * @param cellDeps - The cell dependencies for the order.
22- * @param udtHandler - The handler for UDT (User Defined Token).
21+ * @param udtScript - The UDT (User Defined Token) type script .
2322 */
2423 constructor (
2524 public readonly script : ccc . Script ,
2625 public readonly cellDeps : ccc . CellDep [ ] ,
27- public readonly udtHandler : UdtHandler ,
26+ public readonly udtScript : ccc . Script ,
2827 ) { }
2928
3029 /**
@@ -39,7 +38,7 @@ export class OrderManager implements ScriptDeps {
3938 isOrder ( cell : ccc . Cell ) : boolean {
4039 return (
4140 cell . cellOutput . lock . eq ( this . script ) &&
42- Boolean ( cell . cellOutput . type ?. eq ( this . udtHandler . script ) )
41+ Boolean ( cell . cellOutput . type ?. eq ( this . udtScript ) )
4342 ) ;
4443 }
4544
@@ -156,10 +155,12 @@ export class OrderManager implements ScriptDeps {
156155 *
157156 * The method performs the following:
158157 * - Creates order data using the provided amounts and order information.
159- * - Adds required cell dependencies and UDT handlers to the transaction.
158+ * - Adds required cell dependencies to the transaction.
160159 * - Appends the order cell to the outputs with the UDT data and adjusts the CKB capacity.
161160 * - Appends a corresponding master cell immediately after the order cell.
162161 *
162+ * @remarks Caller must ensure UDT cellDeps are added to the transaction (e.g., via CCC Udt balance completion).
163+ *
163164 * @param txLike - The transaction to which the order will be added.
164165 * @param lock - The lock script for the master cell.
165166 * @param info - The information related to the order, usually calculated using OrderManager.convert.
@@ -187,13 +188,12 @@ export class OrderManager implements ScriptDeps {
187188 } ) ;
188189
189190 tx . addCellDeps ( this . cellDeps ) ;
190- tx . addCellDeps ( this . udtHandler . cellDeps ) ;
191191
192192 // Append order cell to Outputs
193193 const position = tx . addOutput (
194194 {
195195 lock : this . script ,
196- type : this . udtHandler . script ,
196+ type : this . udtScript ,
197197 } ,
198198 data . toBytes ( ) ,
199199 ) ;
@@ -215,6 +215,8 @@ export class OrderManager implements ScriptDeps {
215215 * - Adds the original order as an input.
216216 * - Creates an updated output with adjusted CKB capacity and UDT data.
217217 *
218+ * @remarks Caller must ensure UDT cellDeps are added to the transaction (e.g., via CCC Udt balance completion).
219+ *
218220 * @param txLike - The transaction to which the matches will be added.
219221 * @param match - The match object containing partial matches.
220222 */
@@ -226,14 +228,13 @@ export class OrderManager implements ScriptDeps {
226228 }
227229
228230 tx . addCellDeps ( this . cellDeps ) ;
229- tx . addCellDeps ( this . udtHandler . cellDeps ) ;
230231
231232 for ( const { order, ckbOut, udtOut } of partials ) {
232233 tx . addInput ( order . cell ) ;
233234 tx . addOutput (
234235 {
235236 lock : this . script ,
236- type : this . udtHandler . script ,
237+ type : this . udtScript ,
237238 capacity : ckbOut ,
238239 } ,
239240 OrderData . from ( {
@@ -495,6 +496,8 @@ export class OrderManager implements ScriptDeps {
495496 *
496497 * @param txLike - The transaction to which the groups will be added.
497498 * @param groups - The array of OrderGroup instances to melt.
499+ * @remarks Caller must ensure UDT cellDeps are added to the transaction (e.g., via CCC Udt balance completion).
500+ *
498501 * @param options - Optional parameters:
499502 * @param options.isFulfilledOnly - If true, only groups with fulfilled orders will be melted.
500503 *
@@ -516,7 +519,6 @@ export class OrderManager implements ScriptDeps {
516519 return tx ;
517520 }
518521 tx . addCellDeps ( this . cellDeps ) ;
519- tx . addCellDeps ( this . udtHandler . cellDeps ) ;
520522
521523 for ( const group of groups ) {
522524 tx . addInput ( group . order . cell ) ;
@@ -615,7 +617,7 @@ export class OrderManager implements ScriptDeps {
615617 * Finds simple orders on the blockchain.
616618 *
617619 * Queries cells whose lock script equals the order script and whose type script
618- * matches the UDT handler's script, returning only valid {@link OrderCell} instances.
620+ * matches the UDT type script, returning only valid {@link OrderCell} instances.
619621 *
620622 * @param client – The client used to interact with the blockchain.
621623 * @param limit – Maximum cells to scan per findCells batch.
@@ -632,7 +634,7 @@ export class OrderManager implements ScriptDeps {
632634 script : this . script ,
633635 scriptType : "lock" ,
634636 filter : {
635- script : this . udtHandler . script ,
637+ script : this . udtScript ,
636638 } ,
637639 scriptSearchMode : "exact" ,
638640 withData : true ,
0 commit comments