@ckb-ccc/core 0.0.8-alpha.3 → 0.0.9-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/ckb/script.js +2 -2
  2. package/dist/ckb/transaction.js +2 -2
  3. package/dist/client/client.d.ts +1 -0
  4. package/dist/client/client.d.ts.map +1 -1
  5. package/dist/client/client.js +1 -0
  6. package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  7. package/dist/client/clientPublicMainnet.advanced.js +35 -1
  8. package/dist/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  9. package/dist/client/clientPublicTestnet.advanced.js +20 -0
  10. package/dist/hasher/index.d.ts +17 -2
  11. package/dist/hasher/index.d.ts.map +1 -1
  12. package/dist/hasher/index.js +19 -2
  13. package/dist/signer/nostr/signerNostr.js +2 -2
  14. package/dist/signer/signer/index.d.ts +12 -0
  15. package/dist/signer/signer/index.d.ts.map +1 -1
  16. package/dist/signer/signer/index.js +18 -0
  17. package/dist.commonjs/address/address.advanced.d.ts +24 -29
  18. package/dist.commonjs/address/address.advanced.js +89 -115
  19. package/dist.commonjs/address/advanced.d.ts +1 -1
  20. package/dist.commonjs/address/advanced.js +14 -30
  21. package/dist.commonjs/address/index.d.ts +44 -51
  22. package/dist.commonjs/address/index.js +65 -84
  23. package/dist.commonjs/advanced.d.ts +1 -1
  24. package/dist.commonjs/advanced.js +22 -47
  25. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  26. package/dist.commonjs/advancedBarrel.js +14 -30
  27. package/dist.commonjs/barrel.d.ts +1 -1
  28. package/dist.commonjs/barrel.js +14 -30
  29. package/dist.commonjs/bytes/advanced.d.ts +2 -11
  30. package/dist.commonjs/bytes/index.d.ts +3 -9
  31. package/dist.commonjs/bytes/index.js +26 -28
  32. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  33. package/dist.commonjs/ckb/advanced.js +22 -47
  34. package/dist.commonjs/ckb/index.d.ts +1 -1
  35. package/dist.commonjs/ckb/index.js +14 -30
  36. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +260 -420
  37. package/dist.commonjs/ckb/molecule.advanced/generated.js +1332 -1536
  38. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  39. package/dist.commonjs/ckb/molecule.advanced/index.js +18 -34
  40. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  41. package/dist.commonjs/ckb/script.advanced.js +9 -12
  42. package/dist.commonjs/ckb/script.d.ts +117 -121
  43. package/dist.commonjs/ckb/script.js +176 -220
  44. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  45. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  46. package/dist.commonjs/ckb/transaction.d.ts +717 -792
  47. package/dist.commonjs/ckb/transaction.js +1155 -1383
  48. package/dist.commonjs/client/advanced.d.ts +1 -1
  49. package/dist.commonjs/client/advanced.js +14 -30
  50. package/dist.commonjs/client/client.advanced.d.ts +6 -23
  51. package/dist.commonjs/client/client.advanced.js +61 -89
  52. package/dist.commonjs/client/client.d.ts +54 -113
  53. package/dist.commonjs/client/client.d.ts.map +1 -1
  54. package/dist.commonjs/client/client.js +182 -214
  55. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +4 -8
  56. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  57. package/dist.commonjs/client/clientPublicMainnet.advanced.js +161 -144
  58. package/dist.commonjs/client/clientPublicMainnet.d.ts +6 -8
  59. package/dist.commonjs/client/clientPublicMainnet.js +15 -17
  60. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +3 -6
  61. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  62. package/dist.commonjs/client/clientPublicTestnet.advanced.js +199 -204
  63. package/dist.commonjs/client/clientPublicTestnet.d.ts +6 -8
  64. package/dist.commonjs/client/clientPublicTestnet.js +13 -13
  65. package/dist.commonjs/client/clientTypes.advanced.d.ts +14 -14
  66. package/dist.commonjs/client/clientTypes.advanced.js +1 -1
  67. package/dist.commonjs/client/clientTypes.d.ts +26 -51
  68. package/dist.commonjs/client/clientTypes.js +22 -56
  69. package/dist.commonjs/client/index.d.ts +1 -1
  70. package/dist.commonjs/client/index.js +14 -30
  71. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  72. package/dist.commonjs/client/jsonRpc/advanced.js +14 -30
  73. package/dist.commonjs/client/jsonRpc/index.d.ts +75 -94
  74. package/dist.commonjs/client/jsonRpc/index.js +108 -135
  75. package/dist.commonjs/client/jsonRpc/transformers.d.ts +36 -76
  76. package/dist.commonjs/client/jsonRpc/transformers.js +152 -174
  77. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  78. package/dist.commonjs/fixedPoint/index.d.ts +3 -9
  79. package/dist.commonjs/fixedPoint/index.js +20 -26
  80. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  81. package/dist.commonjs/fixedPoint/index.test.js +36 -42
  82. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  83. package/dist.commonjs/hasher/index.d.ts +53 -38
  84. package/dist.commonjs/hasher/index.d.ts.map +1 -1
  85. package/dist.commonjs/hasher/index.js +69 -58
  86. package/dist.commonjs/hex/index.d.ts +1 -1
  87. package/dist.commonjs/hex/index.js +1 -1
  88. package/dist.commonjs/index.d.ts +1 -1
  89. package/dist.commonjs/index.js +22 -47
  90. package/dist.commonjs/num/index.d.ts +1 -1
  91. package/dist.commonjs/num/index.js +27 -39
  92. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  93. package/dist.commonjs/signer/btc/index.js +14 -30
  94. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  95. package/dist.commonjs/signer/btc/signerBtc.js +66 -89
  96. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  97. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  98. package/dist.commonjs/signer/btc/verify.d.ts +2 -6
  99. package/dist.commonjs/signer/btc/verify.js +3 -10
  100. package/dist.commonjs/signer/ckb/index.d.ts +1 -1
  101. package/dist.commonjs/signer/ckb/index.js +14 -30
  102. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  103. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  104. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +2 -6
  105. package/dist.commonjs/signer/ckb/verifyJoyId.js +8 -11
  106. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  107. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  108. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  109. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  110. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  111. package/dist.commonjs/signer/dummy/index.js +14 -30
  112. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  113. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  114. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  115. package/dist.commonjs/signer/evm/index.js +14 -30
  116. package/dist.commonjs/signer/evm/signerEvm.d.ts +38 -42
  117. package/dist.commonjs/signer/evm/signerEvm.js +70 -105
  118. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
  119. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  120. package/dist.commonjs/signer/evm/verify.d.ts +2 -6
  121. package/dist.commonjs/signer/evm/verify.js +2 -7
  122. package/dist.commonjs/signer/index.d.ts +1 -1
  123. package/dist.commonjs/signer/index.js +14 -30
  124. package/dist.commonjs/signer/nostr/index.d.ts +1 -1
  125. package/dist.commonjs/signer/nostr/index.js +14 -30
  126. package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
  127. package/dist.commonjs/signer/nostr/signerNostr.js +71 -100
  128. package/dist.commonjs/signer/nostr/verify.d.ts +3 -9
  129. package/dist.commonjs/signer/nostr/verify.js +39 -50
  130. package/dist.commonjs/signer/signer/index.d.ts +162 -156
  131. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  132. package/dist.commonjs/signer/signer/index.js +199 -208
  133. package/dist.commonjs/utils/index.d.ts +8 -38
  134. package/dist.commonjs/utils/index.js +12 -18
  135. package/package.json +3 -3
  136. package/src/ckb/script.ts +2 -2
  137. package/src/ckb/transaction.ts +2 -2
  138. package/src/client/client.ts +1 -0
  139. package/src/client/clientPublicMainnet.advanced.ts +40 -1
  140. package/src/client/clientPublicTestnet.advanced.ts +23 -0
  141. package/src/hasher/index.ts +27 -2
  142. package/src/signer/nostr/signerNostr.ts +2 -2
  143. package/src/signer/signer/index.ts +45 -0
@@ -52,828 +52,753 @@ export declare function depTypeToBytes(depType: DepTypeLike): Bytes;
52
52
  */
53
53
  export declare function depTypeFromBytes(bytes: BytesLike): DepType;
54
54
  export type OutPointLike = {
55
- txHash: HexLike;
56
- index: NumLike;
55
+ txHash: HexLike;
56
+ index: NumLike;
57
57
  };
58
58
  export declare class OutPoint {
59
- txHash: Hex;
60
- index: Num;
61
- /**
62
- * Creates an instance of OutPoint.
63
- *
64
- * @param txHash - The transaction hash.
65
- * @param index - The index of the output in the transaction.
66
- */
67
- constructor(txHash: Hex, index: Num);
68
- /**
69
- * Clone an OutPoint.
70
- *
71
- * @returns A cloned OutPoint instance.
72
- *
73
- * @example
74
- * ```typescript
75
- * const outPoint1 = outPoint0.clone();
76
- * ```
77
- */
78
- clone(): OutPoint;
79
- /**
80
- * Creates an OutPoint instance from an OutPointLike object.
81
- *
82
- * @param outPoint - An OutPointLike object or an instance of OutPoint.
83
- * @returns An OutPoint instance.
84
- *
85
- * @example
86
- * ```typescript
87
- * const outPoint = OutPoint.from({ txHash: "0x...", index: 0 });
88
- * ```
89
- */
90
- static from(outPoint: OutPointLike): OutPoint;
91
- /**
92
- * Converts the OutPoint instance to molecule data format.
93
- *
94
- * @returns An object representing the outpoint in molecule data format.
95
- */
96
- _toMolData(): {
97
- txHash: Uint8Array;
98
- index: Uint8Array;
99
- };
100
- /**
101
- * Converts the OutPoint instance to bytes.
102
- *
103
- * @returns A Uint8Array containing the outpoint bytes.
104
- *
105
- * @example
106
- * ```typescript
107
- * const outPointBytes = outPoint.toBytes();
108
- * ```
109
- */
110
- toBytes(): Bytes;
111
- /**
112
- * Creates an OutPoint instance from a byte-like value or molecule OutPoint.
113
- *
114
- * @param bytes - The byte-like value or molecule OutPoint to convert.
115
- * @returns An OutPoint instance.
116
- *
117
- * @example
118
- * ```typescript
119
- * const outPoint = OutPoint.fromBytes(new Uint8Array([/* outpoint bytes *\/]));
120
- * ```
121
- */
122
- static fromBytes(bytes: BytesLike | mol.OutPoint): OutPoint;
123
- /**
124
- * Compares the current OutPoint instance with another OutPointLike object for equality.
125
- *
126
- * @param val - The OutPointLike object to compare with.
127
- * @returns True if the out points are equal, otherwise false.
128
- *
129
- * @example
130
- * ```typescript
131
- * const isEqual = outPoint.eq(anotherOutPoint);
132
- * ```
133
- */
134
- eq(val: OutPointLike): boolean;
59
+ txHash: Hex;
60
+ index: Num;
61
+ /**
62
+ * Creates an instance of OutPoint.
63
+ *
64
+ * @param txHash - The transaction hash.
65
+ * @param index - The index of the output in the transaction.
66
+ */
67
+ constructor(txHash: Hex, index: Num);
68
+ /**
69
+ * Clone an OutPoint.
70
+ *
71
+ * @returns A cloned OutPoint instance.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const outPoint1 = outPoint0.clone();
76
+ * ```
77
+ */
78
+ clone(): OutPoint;
79
+ /**
80
+ * Creates an OutPoint instance from an OutPointLike object.
81
+ *
82
+ * @param outPoint - An OutPointLike object or an instance of OutPoint.
83
+ * @returns An OutPoint instance.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const outPoint = OutPoint.from({ txHash: "0x...", index: 0 });
88
+ * ```
89
+ */
90
+ static from(outPoint: OutPointLike): OutPoint;
91
+ /**
92
+ * Converts the OutPoint instance to molecule data format.
93
+ *
94
+ * @returns An object representing the outpoint in molecule data format.
95
+ */
96
+ _toMolData(): {
97
+ txHash: Uint8Array;
98
+ index: Uint8Array;
99
+ };
100
+ /**
101
+ * Converts the OutPoint instance to bytes.
102
+ *
103
+ * @returns A Uint8Array containing the outpoint bytes.
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * const outPointBytes = outPoint.toBytes();
108
+ * ```
109
+ */
110
+ toBytes(): Bytes;
111
+ /**
112
+ * Creates an OutPoint instance from a byte-like value or molecule OutPoint.
113
+ *
114
+ * @param bytes - The byte-like value or molecule OutPoint to convert.
115
+ * @returns An OutPoint instance.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * const outPoint = OutPoint.fromBytes(new Uint8Array([/* outpoint bytes *\/]));
120
+ * ```
121
+ */
122
+ static fromBytes(bytes: BytesLike | mol.OutPoint): OutPoint;
123
+ /**
124
+ * Compares the current OutPoint instance with another OutPointLike object for equality.
125
+ *
126
+ * @param val - The OutPointLike object to compare with.
127
+ * @returns True if the out points are equal, otherwise false.
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * const isEqual = outPoint.eq(anotherOutPoint);
132
+ * ```
133
+ */
134
+ eq(val: OutPointLike): boolean;
135
135
  }
136
136
  export type CellOutputLike = {
137
- capacity: NumLike;
138
- lock: ScriptLike;
139
- type?: ScriptLike;
137
+ capacity: NumLike;
138
+ lock: ScriptLike;
139
+ type?: ScriptLike;
140
140
  };
141
141
  export declare class CellOutput {
142
- capacity: Num;
143
- lock: Script;
144
- type?: Script | undefined;
145
- /**
146
- * Creates an instance of CellOutput.
147
- *
148
- * @param capacity - The capacity of the cell.
149
- * @param lock - The lock script of the cell.
150
- * @param type - The optional type script of the cell.
151
- */
152
- constructor(capacity: Num, lock: Script, type?: Script | undefined);
153
- get occupiedSize(): number;
154
- /**
155
- * Clone a CellOutput.
156
- *
157
- * @returns A cloned CellOutput instance.
158
- *
159
- * @example
160
- * ```typescript
161
- * const cellOutput1 = cellOutput0.clone();
162
- * ```
163
- */
164
- clone(): CellOutput;
165
- /**
166
- * Creates a CellOutput instance from a CellOutputLike object.
167
- *
168
- * @param cellOutput - A CellOutputLike object or an instance of CellOutput.
169
- * @returns A CellOutput instance.
170
- *
171
- * @example
172
- * ```typescript
173
- * const cellOutput = CellOutput.from({
174
- * capacity: 1000n,
175
- * lock: { codeHash: "0x...", hashType: "type", args: "0x..." },
176
- * type: { codeHash: "0x...", hashType: "type", args: "0x..." }
177
- * });
178
- * ```
179
- */
180
- static from(cellOutput: CellOutputLike): CellOutput;
181
- /**
182
- * Converts the CellOutput instance to molecule data format.
183
- *
184
- * @returns An object representing the cell output in molecule data format.
185
- */
186
- _toMolData(): {
187
- capacity: Uint8Array;
188
- lock: {
189
- codeHash: Uint8Array;
190
- hashType: Uint8Array;
191
- args: Uint8Array;
142
+ capacity: Num;
143
+ lock: Script;
144
+ type?: Script | undefined;
145
+ /**
146
+ * Creates an instance of CellOutput.
147
+ *
148
+ * @param capacity - The capacity of the cell.
149
+ * @param lock - The lock script of the cell.
150
+ * @param type - The optional type script of the cell.
151
+ */
152
+ constructor(capacity: Num, lock: Script, type?: Script | undefined);
153
+ get occupiedSize(): number;
154
+ /**
155
+ * Clone a CellOutput.
156
+ *
157
+ * @returns A cloned CellOutput instance.
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * const cellOutput1 = cellOutput0.clone();
162
+ * ```
163
+ */
164
+ clone(): CellOutput;
165
+ /**
166
+ * Creates a CellOutput instance from a CellOutputLike object.
167
+ *
168
+ * @param cellOutput - A CellOutputLike object or an instance of CellOutput.
169
+ * @returns A CellOutput instance.
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * const cellOutput = CellOutput.from({
174
+ * capacity: 1000n,
175
+ * lock: { codeHash: "0x...", hashType: "type", args: "0x..." },
176
+ * type: { codeHash: "0x...", hashType: "type", args: "0x..." }
177
+ * });
178
+ * ```
179
+ */
180
+ static from(cellOutput: CellOutputLike): CellOutput;
181
+ /**
182
+ * Converts the CellOutput instance to molecule data format.
183
+ *
184
+ * @returns An object representing the cell output in molecule data format.
185
+ */
186
+ _toMolData(): {
187
+ capacity: Uint8Array;
188
+ lock: {
189
+ codeHash: Uint8Array;
190
+ hashType: Uint8Array;
191
+ args: Uint8Array;
192
+ };
193
+ type: {
194
+ codeHash: Uint8Array;
195
+ hashType: Uint8Array;
196
+ args: Uint8Array;
197
+ } | undefined;
192
198
  };
193
- type:
194
- | {
195
- codeHash: Uint8Array;
196
- hashType: Uint8Array;
197
- args: Uint8Array;
198
- }
199
- | undefined;
200
- };
201
- /**
202
- * Converts the CellOutput instance to bytes.
203
- *
204
- * @returns A Uint8Array containing the cell output bytes.
205
- *
206
- * @example
207
- * ```typescript
208
- * const cellOutputBytes = cellOutput.toBytes();
209
- * ```
210
- */
211
- toBytes(): Bytes;
212
- /**
213
- * Creates a CellOutput instance from a byte-like value or molecule CellOutput.
214
- *
215
- * @param bytes - The byte-like value or molecule CellOutput to convert.
216
- * @returns A CellOutput instance.
217
- *
218
- * @example
219
- * ```typescript
220
- * const cellOutput = CellOutput.fromBytes(new Uint8Array([/* cell output bytes *\/]));
221
- * ```
222
- */
223
- static fromBytes(bytes: BytesLike | mol.CellOutput): CellOutput;
199
+ /**
200
+ * Converts the CellOutput instance to bytes.
201
+ *
202
+ * @returns A Uint8Array containing the cell output bytes.
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * const cellOutputBytes = cellOutput.toBytes();
207
+ * ```
208
+ */
209
+ toBytes(): Bytes;
210
+ /**
211
+ * Creates a CellOutput instance from a byte-like value or molecule CellOutput.
212
+ *
213
+ * @param bytes - The byte-like value or molecule CellOutput to convert.
214
+ * @returns A CellOutput instance.
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const cellOutput = CellOutput.fromBytes(new Uint8Array([/* cell output bytes *\/]));
219
+ * ```
220
+ */
221
+ static fromBytes(bytes: BytesLike | mol.CellOutput): CellOutput;
224
222
  }
225
223
  export type CellLike = {
226
- outPoint: OutPointLike;
227
- cellOutput: CellOutputLike;
228
- outputData: HexLike;
224
+ outPoint: OutPointLike;
225
+ cellOutput: CellOutputLike;
226
+ outputData: HexLike;
229
227
  };
230
228
  export declare class Cell {
231
- outPoint: OutPoint;
232
- cellOutput: CellOutput;
233
- outputData: Hex;
234
- /**
235
- * Creates an instance of Cell.
236
- *
237
- * @param outPoint - The output point of the cell.
238
- * @param cellOutput - The cell output of the cell.
239
- * @param outputData - The output data of the cell.
240
- */
241
- constructor(outPoint: OutPoint, cellOutput: CellOutput, outputData: Hex);
242
- /**
243
- * Creates a Cell instance from a CellLike object.
244
- *
245
- * @param cell - A CellLike object or an instance of Cell.
246
- * @returns A Cell instance.
247
- */
248
- static from(cell: CellLike): Cell;
249
- /**
250
- * Clone a Cell
251
- *
252
- * @returns A cloned Cell instance.
253
- *
254
- * @example
255
- * ```typescript
256
- * const cell1 = cell0.clone();
257
- * ```
258
- */
259
- clone(): Cell;
229
+ outPoint: OutPoint;
230
+ cellOutput: CellOutput;
231
+ outputData: Hex;
232
+ /**
233
+ * Creates an instance of Cell.
234
+ *
235
+ * @param outPoint - The output point of the cell.
236
+ * @param cellOutput - The cell output of the cell.
237
+ * @param outputData - The output data of the cell.
238
+ */
239
+ constructor(outPoint: OutPoint, cellOutput: CellOutput, outputData: Hex);
240
+ /**
241
+ * Creates a Cell instance from a CellLike object.
242
+ *
243
+ * @param cell - A CellLike object or an instance of Cell.
244
+ * @returns A Cell instance.
245
+ */
246
+ static from(cell: CellLike): Cell;
247
+ /**
248
+ * Clone a Cell
249
+ *
250
+ * @returns A cloned Cell instance.
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * const cell1 = cell0.clone();
255
+ * ```
256
+ */
257
+ clone(): Cell;
260
258
  }
261
259
  export type CellInputLike = {
262
- previousOutput: OutPointLike;
263
- since?: NumLike;
264
- cellOutput?: CellOutputLike;
265
- outputData?: HexLike;
260
+ previousOutput: OutPointLike;
261
+ since?: NumLike;
262
+ cellOutput?: CellOutputLike;
263
+ outputData?: HexLike;
266
264
  };
267
265
  export declare class CellInput {
268
- previousOutput: OutPoint;
269
- since: Num;
270
- cellOutput?: CellOutput | undefined;
271
- outputData?: `0x${string}` | undefined;
272
- /**
273
- * Creates an instance of CellInput.
274
- *
275
- * @param previousOutput - The previous outpoint of the cell.
276
- * @param since - The since value of the cell input.
277
- * @param cellOutput - The optional cell output associated with the cell input.
278
- * @param outputData - The optional output data associated with the cell input.
279
- */
280
- constructor(
281
- previousOutput: OutPoint,
282
- since: Num,
283
- cellOutput?: CellOutput | undefined,
284
- outputData?: `0x${string}` | undefined,
285
- );
286
- /**
287
- * Clone a CellInput.
288
- *
289
- * @returns A cloned CellInput instance.
290
- *
291
- * @example
292
- * ```typescript
293
- * const cellInput1 = cellInput0.clone();
294
- * ```
295
- */
296
- clone(): CellInput;
297
- /**
298
- * Creates a CellInput instance from a CellInputLike object.
299
- *
300
- * @param cellInput - A CellInputLike object or an instance of CellInput.
301
- * @returns A CellInput instance.
302
- *
303
- * @example
304
- * ```typescript
305
- * const cellInput = CellInput.from({
306
- * previousOutput: { txHash: "0x...", index: 0 },
307
- * since: 0n
308
- * });
309
- * ```
310
- */
311
- static from(cellInput: CellInputLike): CellInput;
312
- /**
313
- * Complete extra infos in the input. Like the output of the out point.
314
- * The instance will be modified.
315
- *
316
- * @returns true if succeed.
317
- * @example
318
- * ```typescript
319
- * await cellInput.completeExtraInfos();
320
- * ```
321
- */
322
- completeExtraInfos(client: Client): Promise<void>;
323
- /**
324
- * Converts the CellInput instance to molecule data format.
325
- *
326
- * @returns An object representing the cell input in molecule data format.
327
- */
328
- _toMolData(): {
329
- previousOutput: {
330
- txHash: Uint8Array;
331
- index: Uint8Array;
266
+ previousOutput: OutPoint;
267
+ since: Num;
268
+ cellOutput?: CellOutput | undefined;
269
+ outputData?: `0x${string}` | undefined;
270
+ /**
271
+ * Creates an instance of CellInput.
272
+ *
273
+ * @param previousOutput - The previous outpoint of the cell.
274
+ * @param since - The since value of the cell input.
275
+ * @param cellOutput - The optional cell output associated with the cell input.
276
+ * @param outputData - The optional output data associated with the cell input.
277
+ */
278
+ constructor(previousOutput: OutPoint, since: Num, cellOutput?: CellOutput | undefined, outputData?: `0x${string}` | undefined);
279
+ /**
280
+ * Clone a CellInput.
281
+ *
282
+ * @returns A cloned CellInput instance.
283
+ *
284
+ * @example
285
+ * ```typescript
286
+ * const cellInput1 = cellInput0.clone();
287
+ * ```
288
+ */
289
+ clone(): CellInput;
290
+ /**
291
+ * Creates a CellInput instance from a CellInputLike object.
292
+ *
293
+ * @param cellInput - A CellInputLike object or an instance of CellInput.
294
+ * @returns A CellInput instance.
295
+ *
296
+ * @example
297
+ * ```typescript
298
+ * const cellInput = CellInput.from({
299
+ * previousOutput: { txHash: "0x...", index: 0 },
300
+ * since: 0n
301
+ * });
302
+ * ```
303
+ */
304
+ static from(cellInput: CellInputLike): CellInput;
305
+ /**
306
+ * Complete extra infos in the input. Like the output of the out point.
307
+ * The instance will be modified.
308
+ *
309
+ * @returns true if succeed.
310
+ * @example
311
+ * ```typescript
312
+ * await cellInput.completeExtraInfos();
313
+ * ```
314
+ */
315
+ completeExtraInfos(client: Client): Promise<void>;
316
+ /**
317
+ * Converts the CellInput instance to molecule data format.
318
+ *
319
+ * @returns An object representing the cell input in molecule data format.
320
+ */
321
+ _toMolData(): {
322
+ previousOutput: {
323
+ txHash: Uint8Array;
324
+ index: Uint8Array;
325
+ };
326
+ since: Uint8Array;
332
327
  };
333
- since: Uint8Array;
334
- };
335
- /**
336
- * Converts the CellInput instance to bytes.
337
- *
338
- * @returns A Uint8Array containing the cell input bytes.
339
- *
340
- * @example
341
- * ```typescript
342
- * const cellInputBytes = cellInput.toBytes();
343
- * ```
344
- */
345
- toBytes(): Bytes;
346
- /**
347
- * Creates a CellInput instance from a byte-like value or molecule CellInput.
348
- *
349
- * @param bytes - The byte-like value or molecule CellInput to convert.
350
- * @returns A CellInput instance.
351
- *
352
- * @example
353
- * ```typescript
354
- * const cellInput = CellInput.fromBytes(new Uint8Array([/* cell input bytes *\/]));
355
- * ```
356
- */
357
- static fromBytes(bytes: BytesLike | mol.CellInput): CellInput;
328
+ /**
329
+ * Converts the CellInput instance to bytes.
330
+ *
331
+ * @returns A Uint8Array containing the cell input bytes.
332
+ *
333
+ * @example
334
+ * ```typescript
335
+ * const cellInputBytes = cellInput.toBytes();
336
+ * ```
337
+ */
338
+ toBytes(): Bytes;
339
+ /**
340
+ * Creates a CellInput instance from a byte-like value or molecule CellInput.
341
+ *
342
+ * @param bytes - The byte-like value or molecule CellInput to convert.
343
+ * @returns A CellInput instance.
344
+ *
345
+ * @example
346
+ * ```typescript
347
+ * const cellInput = CellInput.fromBytes(new Uint8Array([/* cell input bytes *\/]));
348
+ * ```
349
+ */
350
+ static fromBytes(bytes: BytesLike | mol.CellInput): CellInput;
358
351
  }
359
352
  export type CellDepLike = {
360
- outPoint: OutPointLike;
361
- depType: DepTypeLike;
353
+ outPoint: OutPointLike;
354
+ depType: DepTypeLike;
362
355
  };
363
356
  export declare class CellDep {
364
- outPoint: OutPoint;
365
- depType: DepType;
366
- /**
367
- * Creates an instance of CellDep.
368
- *
369
- * @param outPoint - The outpoint of the cell dependency.
370
- * @param depType - The dependency type.
371
- */
372
- constructor(outPoint: OutPoint, depType: DepType);
373
- /**
374
- * Clone a CellDep.
375
- *
376
- * @returns A cloned CellDep instance.
377
- *
378
- * @example
379
- * ```typescript
380
- * const cellDep1 = cellDep0.clone();
381
- * ```
382
- */
383
- clone(): CellDep;
384
- /**
385
- * Creates a CellDep instance from a CellDepLike object.
386
- *
387
- * @param cellDep - A CellDepLike object or an instance of CellDep.
388
- * @returns A CellDep instance.
389
- *
390
- * @example
391
- * ```typescript
392
- * const cellDep = CellDep.from({
393
- * outPoint: { txHash: "0x...", index: 0 },
394
- * depType: "depGroup"
395
- * });
396
- * ```
397
- */
398
- static from(cellDep: CellDepLike): CellDep;
399
- /**
400
- * Converts the CellDep instance to molecule data format.
401
- *
402
- * @returns An object representing the cell dependency in molecule data format.
403
- */
404
- _toMolData(): {
405
- outPoint: {
406
- txHash: Uint8Array;
407
- index: Uint8Array;
357
+ outPoint: OutPoint;
358
+ depType: DepType;
359
+ /**
360
+ * Creates an instance of CellDep.
361
+ *
362
+ * @param outPoint - The outpoint of the cell dependency.
363
+ * @param depType - The dependency type.
364
+ */
365
+ constructor(outPoint: OutPoint, depType: DepType);
366
+ /**
367
+ * Clone a CellDep.
368
+ *
369
+ * @returns A cloned CellDep instance.
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * const cellDep1 = cellDep0.clone();
374
+ * ```
375
+ */
376
+ clone(): CellDep;
377
+ /**
378
+ * Creates a CellDep instance from a CellDepLike object.
379
+ *
380
+ * @param cellDep - A CellDepLike object or an instance of CellDep.
381
+ * @returns A CellDep instance.
382
+ *
383
+ * @example
384
+ * ```typescript
385
+ * const cellDep = CellDep.from({
386
+ * outPoint: { txHash: "0x...", index: 0 },
387
+ * depType: "depGroup"
388
+ * });
389
+ * ```
390
+ */
391
+ static from(cellDep: CellDepLike): CellDep;
392
+ /**
393
+ * Converts the CellDep instance to molecule data format.
394
+ *
395
+ * @returns An object representing the cell dependency in molecule data format.
396
+ */
397
+ _toMolData(): {
398
+ outPoint: {
399
+ txHash: Uint8Array;
400
+ index: Uint8Array;
401
+ };
402
+ depType: Uint8Array;
408
403
  };
409
- depType: Uint8Array;
410
- };
411
- /**
412
- * Converts the CellDep instance to bytes.
413
- *
414
- * @returns A Uint8Array containing the cell dependency bytes.
415
- *
416
- * @example
417
- * ```typescript
418
- * const cellDepBytes = cellDep.toBytes();
419
- * ```
420
- */
421
- toBytes(): Bytes;
422
- /**
423
- * Creates a CellDep instance from a byte-like value or molecule CellDep.
424
- *
425
- * @param bytes - The byte-like value or molecule CellDep to convert.
426
- * @returns A CellDep instance.
427
- *
428
- * @example
429
- * ```typescript
430
- * const cellDep = CellDep.fromBytes(new Uint8Array([/* cell dep bytes *\/]));
431
- * ```
432
- */
433
- fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
434
- /**
435
- * Compares the current CellDep instance with another CellDepLike object for equality.
436
- *
437
- * @param val - The CellDepLike object to compare with.
438
- * @returns True if the cell deps are equal, otherwise false.
439
- *
440
- * @example
441
- * ```typescript
442
- * const isEqual = cellDep.eq(anotherCellDep);
443
- * ```
444
- */
445
- eq(val: CellDepLike): boolean;
404
+ /**
405
+ * Converts the CellDep instance to bytes.
406
+ *
407
+ * @returns A Uint8Array containing the cell dependency bytes.
408
+ *
409
+ * @example
410
+ * ```typescript
411
+ * const cellDepBytes = cellDep.toBytes();
412
+ * ```
413
+ */
414
+ toBytes(): Bytes;
415
+ /**
416
+ * Creates a CellDep instance from a byte-like value or molecule CellDep.
417
+ *
418
+ * @param bytes - The byte-like value or molecule CellDep to convert.
419
+ * @returns A CellDep instance.
420
+ *
421
+ * @example
422
+ * ```typescript
423
+ * const cellDep = CellDep.fromBytes(new Uint8Array([/* cell dep bytes *\/]));
424
+ * ```
425
+ */
426
+ fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
427
+ /**
428
+ * Compares the current CellDep instance with another CellDepLike object for equality.
429
+ *
430
+ * @param val - The CellDepLike object to compare with.
431
+ * @returns True if the cell deps are equal, otherwise false.
432
+ *
433
+ * @example
434
+ * ```typescript
435
+ * const isEqual = cellDep.eq(anotherCellDep);
436
+ * ```
437
+ */
438
+ eq(val: CellDepLike): boolean;
446
439
  }
447
440
  export type WitnessArgsLike = {
448
- lock?: HexLike;
449
- inputType?: HexLike;
450
- outputType?: HexLike;
441
+ lock?: HexLike;
442
+ inputType?: HexLike;
443
+ outputType?: HexLike;
451
444
  };
452
445
  export declare class WitnessArgs {
453
- lock?: `0x${string}` | undefined;
454
- inputType?: `0x${string}` | undefined;
455
- outputType?: `0x${string}` | undefined;
456
- /**
457
- * Creates an instance of WitnessArgs.
458
- *
459
- * @param lock - The optional lock field of the witness.
460
- * @param inputType - The optional input type field of the witness.
461
- * @param outputType - The optional output type field of the witness.
462
- */
463
- constructor(
464
- lock?: `0x${string}` | undefined,
465
- inputType?: `0x${string}` | undefined,
466
- outputType?: `0x${string}` | undefined,
467
- );
468
- /**
469
- * Creates a WitnessArgs instance from a WitnessArgsLike object.
470
- *
471
- * @param witnessArgs - A WitnessArgsLike object or an instance of WitnessArgs.
472
- * @returns A WitnessArgs instance.
473
- *
474
- * @example
475
- * ```typescript
476
- * const witnessArgs = WitnessArgs.from({
477
- * lock: "0x...",
478
- * inputType: "0x...",
479
- * outputType: "0x..."
480
- * });
481
- * ```
482
- */
483
- static from(witnessArgs: WitnessArgsLike): WitnessArgs;
484
- /**
485
- * Converts the WitnessArgs instance to molecule data format.
486
- *
487
- * @returns An object representing the witness arguments in molecule data format.
488
- */
489
- _toMolData(): {
490
- lock: Uint8Array | undefined;
491
- inputType: Uint8Array | undefined;
492
- outputType: Uint8Array | undefined;
493
- };
494
- /**
495
- * Converts the WitnessArgs instance to bytes.
496
- *
497
- * @returns A Uint8Array containing the witness arguments bytes.
498
- *
499
- * @example
500
- * ```typescript
501
- * const witnessArgsBytes = witnessArgs.toBytes();
502
- * ```
503
- */
504
- toBytes(): Bytes;
505
- /**
506
- * Creates a WitnessArgs instance from a byte-like value or molecule WitnessArgs.
507
- *
508
- * @param bytes - The byte-like value or molecule WitnessArgs to convert.
509
- * @returns A WitnessArgs instance.
510
- *
511
- * @example
512
- * ```typescript
513
- * const witnessArgs = WitnessArgs.fromBytes(new Uint8Array([/* witness args bytes *\/]));
514
- * ```
515
- */
516
- static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
446
+ lock?: `0x${string}` | undefined;
447
+ inputType?: `0x${string}` | undefined;
448
+ outputType?: `0x${string}` | undefined;
449
+ /**
450
+ * Creates an instance of WitnessArgs.
451
+ *
452
+ * @param lock - The optional lock field of the witness.
453
+ * @param inputType - The optional input type field of the witness.
454
+ * @param outputType - The optional output type field of the witness.
455
+ */
456
+ constructor(lock?: `0x${string}` | undefined, inputType?: `0x${string}` | undefined, outputType?: `0x${string}` | undefined);
457
+ /**
458
+ * Creates a WitnessArgs instance from a WitnessArgsLike object.
459
+ *
460
+ * @param witnessArgs - A WitnessArgsLike object or an instance of WitnessArgs.
461
+ * @returns A WitnessArgs instance.
462
+ *
463
+ * @example
464
+ * ```typescript
465
+ * const witnessArgs = WitnessArgs.from({
466
+ * lock: "0x...",
467
+ * inputType: "0x...",
468
+ * outputType: "0x..."
469
+ * });
470
+ * ```
471
+ */
472
+ static from(witnessArgs: WitnessArgsLike): WitnessArgs;
473
+ /**
474
+ * Converts the WitnessArgs instance to molecule data format.
475
+ *
476
+ * @returns An object representing the witness arguments in molecule data format.
477
+ */
478
+ _toMolData(): {
479
+ lock: Uint8Array | undefined;
480
+ inputType: Uint8Array | undefined;
481
+ outputType: Uint8Array | undefined;
482
+ };
483
+ /**
484
+ * Converts the WitnessArgs instance to bytes.
485
+ *
486
+ * @returns A Uint8Array containing the witness arguments bytes.
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * const witnessArgsBytes = witnessArgs.toBytes();
491
+ * ```
492
+ */
493
+ toBytes(): Bytes;
494
+ /**
495
+ * Creates a WitnessArgs instance from a byte-like value or molecule WitnessArgs.
496
+ *
497
+ * @param bytes - The byte-like value or molecule WitnessArgs to convert.
498
+ * @returns A WitnessArgs instance.
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * const witnessArgs = WitnessArgs.fromBytes(new Uint8Array([/* witness args bytes *\/]));
503
+ * ```
504
+ */
505
+ static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
517
506
  }
518
507
  export declare function udtBalanceFrom(dataLike: BytesLike): bigint;
519
508
  export type TransactionLike = {
520
- version?: NumLike;
521
- cellDeps?: CellDepLike[];
522
- headerDeps?: HexLike[];
523
- inputs?: CellInputLike[];
524
- outputs?: (Omit<CellOutputLike, "capacity"> &
525
- Partial<Pick<CellOutputLike, "capacity">>)[];
526
- outputsData?: HexLike[];
527
- witnesses?: HexLike[];
509
+ version?: NumLike;
510
+ cellDeps?: CellDepLike[];
511
+ headerDeps?: HexLike[];
512
+ inputs?: CellInputLike[];
513
+ outputs?: (Omit<CellOutputLike, "capacity"> & Partial<Pick<CellOutputLike, "capacity">>)[];
514
+ outputsData?: HexLike[];
515
+ witnesses?: HexLike[];
528
516
  };
529
517
  export declare class Transaction {
530
- version: Num;
531
- cellDeps: CellDep[];
532
- headerDeps: Hex[];
533
- inputs: CellInput[];
534
- outputs: CellOutput[];
535
- outputsData: Hex[];
536
- witnesses: Hex[];
537
- /**
538
- * Creates an instance of Transaction.
539
- *
540
- * @param version - The version of the transaction.
541
- * @param cellDeps - The cell dependencies of the transaction.
542
- * @param headerDeps - The header dependencies of the transaction.
543
- * @param inputs - The inputs of the transaction.
544
- * @param outputs - The outputs of the transaction.
545
- * @param outputsData - The data associated with the outputs.
546
- * @param witnesses - The witnesses of the transaction.
547
- */
548
- constructor(
549
- version: Num,
550
- cellDeps: CellDep[],
551
- headerDeps: Hex[],
552
- inputs: CellInput[],
553
- outputs: CellOutput[],
554
- outputsData: Hex[],
555
- witnesses: Hex[],
556
- );
557
- /**
558
- * Creates a default Transaction instance with empty fields.
559
- *
560
- * @returns A default Transaction instance.
561
- *
562
- * @example
563
- * ```typescript
564
- * const defaultTx = Transaction.default();
565
- * ```
566
- */
567
- static default(): Transaction;
568
- /**
569
- * Copy every properties from another transaction.
570
- *
571
- * @example
572
- * ```typescript
573
- * this.copy(Transaction.default());
574
- * ```
575
- */
576
- copy(txLike: TransactionLike): void;
577
- /**
578
- * Clone a Transaction.
579
- *
580
- * @returns A cloned instance
581
- *
582
- * @example
583
- * ```typescript
584
- * const tx1 = tx0.clone();
585
- * ```
586
- */
587
- clone(): Transaction;
588
- /**
589
- * Creates a Transaction instance from a TransactionLike object.
590
- *
591
- * @param tx - A TransactionLike object or an instance of Transaction.
592
- * @returns A Transaction instance.
593
- *
594
- * @example
595
- * ```typescript
596
- * const transaction = Transaction.from({
597
- * version: 0,
598
- * cellDeps: [],
599
- * headerDeps: [],
600
- * inputs: [],
601
- * outputs: [],
602
- * outputsData: [],
603
- * witnesses: []
604
- * });
605
- * ```
606
- */
607
- static from(tx: TransactionLike): Transaction;
608
- /**
609
- * Creates a Transaction instance from a Lumos skeleton.
610
- *
611
- * @param skeleton - The Lumos transaction skeleton.
612
- * @returns A Transaction instance.
613
- *
614
- * @throws Will throw an error if an input's outPoint is missing.
615
- *
616
- * @example
617
- * ```typescript
618
- * const transaction = Transaction.fromLumosSkeleton(skeleton);
619
- * ```
620
- */
621
- static fromLumosSkeleton(skeleton: TransactionSkeletonType): Transaction;
622
- stringify(): string;
623
- /**
624
- * Converts the raw transaction data to bytes.
625
- *
626
- * @returns A Uint8Array containing the raw transaction bytes.
627
- *
628
- * @example
629
- * ```typescript
630
- * const rawTxBytes = transaction.rawToBytes();
631
- * ```
632
- */
633
- rawToBytes(): Bytes;
634
- /**
635
- * Converts the whole transaction data to bytes.
636
- *
637
- * @returns A Uint8Array containing the full transaction bytes.
638
- *
639
- * @example
640
- * ```typescript
641
- * const txBytes = transaction.toBytes();
642
- * ```
643
- */
644
- toBytes(): Bytes;
645
- /**
646
- * Calculates the hash of the transaction.
647
- *
648
- * @returns The hash of the transaction.
649
- *
650
- * @example
651
- * ```typescript
652
- * const txHash = transaction.hash();
653
- * ```
654
- */
655
- hash(): `0x${string}`;
656
- /**
657
- * Hashes a witness and updates the hasher.
658
- *
659
- * @param witness - The witness to hash.
660
- * @param hasher - The hasher instance to update.
661
- *
662
- * @example
663
- * ```typescript
664
- * Transaction.hashWitnessToHasher("0x...", hasher);
665
- * ```
666
- */
667
- static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
668
- /**
669
- * Computes the signing hash information for a given script.
670
- *
671
- * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
672
- * @param client - The client for complete extra infos in the transaction.
673
- * @returns A promise that resolves to an object containing the signing message and the witness position,
674
- * or undefined if no matching input is found.
675
- *
676
- * @example
677
- * ```typescript
678
- * const signHashInfo = await tx.getSignHashInfo(scriptLike, client);
679
- * if (signHashInfo) {
680
- * console.log(signHashInfo.message); // Outputs the signing message
681
- * console.log(signHashInfo.position); // Outputs the witness position
682
- * }
683
- * ```
684
- */
685
- getSignHashInfo(
686
- scriptLike: ScriptLike,
687
- client: Client,
688
- ): Promise<
689
- | {
518
+ version: Num;
519
+ cellDeps: CellDep[];
520
+ headerDeps: Hex[];
521
+ inputs: CellInput[];
522
+ outputs: CellOutput[];
523
+ outputsData: Hex[];
524
+ witnesses: Hex[];
525
+ /**
526
+ * Creates an instance of Transaction.
527
+ *
528
+ * @param version - The version of the transaction.
529
+ * @param cellDeps - The cell dependencies of the transaction.
530
+ * @param headerDeps - The header dependencies of the transaction.
531
+ * @param inputs - The inputs of the transaction.
532
+ * @param outputs - The outputs of the transaction.
533
+ * @param outputsData - The data associated with the outputs.
534
+ * @param witnesses - The witnesses of the transaction.
535
+ */
536
+ constructor(version: Num, cellDeps: CellDep[], headerDeps: Hex[], inputs: CellInput[], outputs: CellOutput[], outputsData: Hex[], witnesses: Hex[]);
537
+ /**
538
+ * Creates a default Transaction instance with empty fields.
539
+ *
540
+ * @returns A default Transaction instance.
541
+ *
542
+ * @example
543
+ * ```typescript
544
+ * const defaultTx = Transaction.default();
545
+ * ```
546
+ */
547
+ static default(): Transaction;
548
+ /**
549
+ * Copy every properties from another transaction.
550
+ *
551
+ * @example
552
+ * ```typescript
553
+ * this.copy(Transaction.default());
554
+ * ```
555
+ */
556
+ copy(txLike: TransactionLike): void;
557
+ /**
558
+ * Clone a Transaction.
559
+ *
560
+ * @returns A cloned instance
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * const tx1 = tx0.clone();
565
+ * ```
566
+ */
567
+ clone(): Transaction;
568
+ /**
569
+ * Creates a Transaction instance from a TransactionLike object.
570
+ *
571
+ * @param tx - A TransactionLike object or an instance of Transaction.
572
+ * @returns A Transaction instance.
573
+ *
574
+ * @example
575
+ * ```typescript
576
+ * const transaction = Transaction.from({
577
+ * version: 0,
578
+ * cellDeps: [],
579
+ * headerDeps: [],
580
+ * inputs: [],
581
+ * outputs: [],
582
+ * outputsData: [],
583
+ * witnesses: []
584
+ * });
585
+ * ```
586
+ */
587
+ static from(tx: TransactionLike): Transaction;
588
+ /**
589
+ * Creates a Transaction instance from a Lumos skeleton.
590
+ *
591
+ * @param skeleton - The Lumos transaction skeleton.
592
+ * @returns A Transaction instance.
593
+ *
594
+ * @throws Will throw an error if an input's outPoint is missing.
595
+ *
596
+ * @example
597
+ * ```typescript
598
+ * const transaction = Transaction.fromLumosSkeleton(skeleton);
599
+ * ```
600
+ */
601
+ static fromLumosSkeleton(skeleton: TransactionSkeletonType): Transaction;
602
+ stringify(): string;
603
+ /**
604
+ * Converts the raw transaction data to bytes.
605
+ *
606
+ * @returns A Uint8Array containing the raw transaction bytes.
607
+ *
608
+ * @example
609
+ * ```typescript
610
+ * const rawTxBytes = transaction.rawToBytes();
611
+ * ```
612
+ */
613
+ rawToBytes(): Bytes;
614
+ /**
615
+ * Converts the whole transaction data to bytes.
616
+ *
617
+ * @returns A Uint8Array containing the full transaction bytes.
618
+ *
619
+ * @example
620
+ * ```typescript
621
+ * const txBytes = transaction.toBytes();
622
+ * ```
623
+ */
624
+ toBytes(): Bytes;
625
+ /**
626
+ * Calculates the hash of the transaction.
627
+ *
628
+ * @returns The hash of the transaction.
629
+ *
630
+ * @example
631
+ * ```typescript
632
+ * const txHash = transaction.hash();
633
+ * ```
634
+ */
635
+ hash(): `0x${string}`;
636
+ /**
637
+ * Hashes a witness and updates the hasher.
638
+ *
639
+ * @param witness - The witness to hash.
640
+ * @param hasher - The hasher instance to update.
641
+ *
642
+ * @example
643
+ * ```typescript
644
+ * Transaction.hashWitnessToHasher("0x...", hasher);
645
+ * ```
646
+ */
647
+ static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
648
+ /**
649
+ * Computes the signing hash information for a given script.
650
+ *
651
+ * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
652
+ * @param client - The client for complete extra infos in the transaction.
653
+ * @returns A promise that resolves to an object containing the signing message and the witness position,
654
+ * or undefined if no matching input is found.
655
+ *
656
+ * @example
657
+ * ```typescript
658
+ * const signHashInfo = await tx.getSignHashInfo(scriptLike, client);
659
+ * if (signHashInfo) {
660
+ * console.log(signHashInfo.message); // Outputs the signing message
661
+ * console.log(signHashInfo.position); // Outputs the witness position
662
+ * }
663
+ * ```
664
+ */
665
+ getSignHashInfo(scriptLike: ScriptLike, client: Client): Promise<{
690
666
  message: Hex;
691
667
  position: number;
692
- }
693
- | undefined
694
- >;
695
- /**
696
- * Find the first occurrence of a input with the specified lock
697
- *
698
- * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
699
- * @param client - The client for complete extra infos in the transaction.
700
- * @returns A promise that resolves to the prepared transaction
701
- *
702
- * @example
703
- * ```typescript
704
- * const index = await tx.findInputIndexByLock(scriptLike, client);
705
- * ```
706
- */
707
- findInputIndexByLock(
708
- scriptLike: ScriptLike,
709
- client: Client,
710
- ): Promise<number | undefined>;
711
- /**
712
- * Find the last occurrence of a input with the specified lock
713
- *
714
- * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
715
- * @param client - The client for complete extra infos in the transaction.
716
- * @returns A promise that resolves to the prepared transaction
717
- *
718
- * @example
719
- * ```typescript
720
- * const index = await tx.findLastInputIndexByLock(scriptLike, client);
721
- * ```
722
- */
723
- findLastInputIndexByLock(
724
- scriptLike: ScriptLike,
725
- client: Client,
726
- ): Promise<number | undefined>;
727
- /**
728
- * Add cell deps if they are not existed
729
- *
730
- * @param cellDepLikes - The cell deps to add
731
- *
732
- * @example
733
- * ```typescript
734
- * tx.addCellDeps(cellDep);
735
- * ```
736
- */
737
- addCellDeps(...cellDepsLike: (CellDepLike | CellDepLike[])[]): void;
738
- /**
739
- * Add cell dep from infos if they are not existed
740
- *
741
- * @param client - A client for searching cell deps
742
- * @param cellDepLikes - The cell dep infos to add
743
- *
744
- * @example
745
- * ```typescript
746
- * tx.addCellDepInfos(client, cellDepInfos);
747
- * ```
748
- */
749
- addCellDepInfos(
750
- client: Client,
751
- ...cellDepInfosLike: (CellDepInfoLike | CellDepInfoLike[])[]
752
- ): Promise<void>;
753
- /**
754
- * Add cell deps from known script
755
- *
756
- * @param client - The client for searching known script and cell deps
757
- * @param scripts - The known scripts to add
758
- *
759
- * @example
760
- * ```typescript
761
- * tx.addCellDepsOfKnownScripts(client, KnownScript.OmniLock);
762
- * ```
763
- */
764
- addCellDepsOfKnownScripts(
765
- client: Client,
766
- ...scripts: (KnownScript | KnownScript[])[]
767
- ): Promise<void>;
768
- /**
769
- * Set output data at index.
770
- *
771
- * @param index - The index of the output data.
772
- * @param witness - The data to set.
773
- *
774
- * @example
775
- * ```typescript
776
- * await tx.setOutputData(0, "0x00");
777
- * ```
778
- */
779
- setOutputDataAt(index: number, data: HexLike): void;
780
- /**
781
- * Add output
782
- *
783
- * @param output - The cell output to add
784
- * @param data - optional output data
785
- *
786
- * @example
787
- * ```typescript
788
- * await tx.addOutput(cellOutput, "0xabcd");
789
- * ```
790
- */
791
- addOutput(
792
- outputLike: Omit<CellOutputLike, "capacity"> &
793
- Partial<Pick<CellOutputLike, "capacity">>,
794
- outputData?: HexLike,
795
- ): void;
796
- /**
797
- * Get witness at index as WitnessArgs
798
- *
799
- * @param index - The index of the witness.
800
- * @returns The witness parsed as WitnessArgs.
801
- *
802
- * @example
803
- * ```typescript
804
- * const witnessArgs = await tx.getWitnessArgsAt(0);
805
- * ```
806
- */
807
- getWitnessArgsAt(index: number): WitnessArgs | undefined;
808
- /**
809
- * Set witness at index by WitnessArgs
810
- *
811
- * @param index - The index of the witness.
812
- * @param witness - The WitnessArgs to set.
813
- *
814
- * @example
815
- * ```typescript
816
- * await tx.setWitnessArgsAt(0, witnessArgs);
817
- * ```
818
- */
819
- setWitnessArgsAt(index: number, witness: WitnessArgs): void;
820
- /**
821
- * Prepare dummy witness for sighash all method
822
- *
823
- * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
824
- * @param lockLen - The length of dummy lock bytes.
825
- * @param client - The client for complete extra infos in the transaction.
826
- * @returns A promise that resolves to the prepared transaction
827
- *
828
- * @example
829
- * ```typescript
830
- * await tx.prepareSighashAllWitness(scriptLike, 85, client);
831
- * ```
832
- */
833
- prepareSighashAllWitness(
834
- scriptLike: ScriptLike,
835
- lockLen: number,
836
- client: Client,
837
- ): Promise<void>;
838
- getInputsCapacity(client: Client): Promise<Num>;
839
- getOutputsCapacity(): Num;
840
- getInputsUdtBalance(client: Client, type: ScriptLike): Promise<Num>;
841
- getOutputsUdtBalance(type: ScriptLike): Num;
842
- completeInputs<T>(
843
- from: Signer,
844
- filter: ClientCollectableSearchKeyFilterLike,
845
- accumulator: (
846
- acc: T,
847
- v: Cell,
848
- i: number,
849
- array: Cell[],
850
- ) => Promise<T | undefined> | T | undefined,
851
- init: T,
852
- ): Promise<number>;
853
- completeInputsByCapacity(
854
- from: Signer,
855
- capacityTweak?: NumLike,
856
- filter?: ClientCollectableSearchKeyFilterLike,
857
- ): Promise<number>;
858
- completeInputsByUdt(from: Signer, type: ScriptLike): Promise<number>;
859
- estimateFee(feeRate: NumLike): Num;
860
- completeFee(
861
- from: Signer,
862
- change: (tx: Transaction, capacity: Num) => Promise<NumLike> | NumLike,
863
- feeRate: NumLike,
864
- filter?: ClientCollectableSearchKeyFilterLike,
865
- ): Promise<[number, boolean]>;
866
- completeFeeChangeToLock(
867
- from: Signer,
868
- change: ScriptLike,
869
- feeRate: NumLike,
870
- filter?: ClientCollectableSearchKeyFilterLike,
871
- ): Promise<[number, boolean]>;
872
- completeFeeChangeToOutput(
873
- from: Signer,
874
- index: NumLike,
875
- feeRate: NumLike,
876
- filter?: ClientCollectableSearchKeyFilterLike,
877
- ): Promise<[number, boolean]>;
668
+ } | undefined>;
669
+ /**
670
+ * Find the first occurrence of a input with the specified lock
671
+ *
672
+ * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
673
+ * @param client - The client for complete extra infos in the transaction.
674
+ * @returns A promise that resolves to the prepared transaction
675
+ *
676
+ * @example
677
+ * ```typescript
678
+ * const index = await tx.findInputIndexByLock(scriptLike, client);
679
+ * ```
680
+ */
681
+ findInputIndexByLock(scriptLike: ScriptLike, client: Client): Promise<number | undefined>;
682
+ /**
683
+ * Find the last occurrence of a input with the specified lock
684
+ *
685
+ * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
686
+ * @param client - The client for complete extra infos in the transaction.
687
+ * @returns A promise that resolves to the prepared transaction
688
+ *
689
+ * @example
690
+ * ```typescript
691
+ * const index = await tx.findLastInputIndexByLock(scriptLike, client);
692
+ * ```
693
+ */
694
+ findLastInputIndexByLock(scriptLike: ScriptLike, client: Client): Promise<number | undefined>;
695
+ /**
696
+ * Add cell deps if they are not existed
697
+ *
698
+ * @param cellDepLikes - The cell deps to add
699
+ *
700
+ * @example
701
+ * ```typescript
702
+ * tx.addCellDeps(cellDep);
703
+ * ```
704
+ */
705
+ addCellDeps(...cellDepsLike: (CellDepLike | CellDepLike[])[]): void;
706
+ /**
707
+ * Add cell dep from infos if they are not existed
708
+ *
709
+ * @param client - A client for searching cell deps
710
+ * @param cellDepLikes - The cell dep infos to add
711
+ *
712
+ * @example
713
+ * ```typescript
714
+ * tx.addCellDepInfos(client, cellDepInfos);
715
+ * ```
716
+ */
717
+ addCellDepInfos(client: Client, ...cellDepInfosLike: (CellDepInfoLike | CellDepInfoLike[])[]): Promise<void>;
718
+ /**
719
+ * Add cell deps from known script
720
+ *
721
+ * @param client - The client for searching known script and cell deps
722
+ * @param scripts - The known scripts to add
723
+ *
724
+ * @example
725
+ * ```typescript
726
+ * tx.addCellDepsOfKnownScripts(client, KnownScript.OmniLock);
727
+ * ```
728
+ */
729
+ addCellDepsOfKnownScripts(client: Client, ...scripts: (KnownScript | KnownScript[])[]): Promise<void>;
730
+ /**
731
+ * Set output data at index.
732
+ *
733
+ * @param index - The index of the output data.
734
+ * @param witness - The data to set.
735
+ *
736
+ * @example
737
+ * ```typescript
738
+ * await tx.setOutputData(0, "0x00");
739
+ * ```
740
+ */
741
+ setOutputDataAt(index: number, data: HexLike): void;
742
+ /**
743
+ * Add output
744
+ *
745
+ * @param output - The cell output to add
746
+ * @param data - optional output data
747
+ *
748
+ * @example
749
+ * ```typescript
750
+ * await tx.addOutput(cellOutput, "0xabcd");
751
+ * ```
752
+ */
753
+ addOutput(outputLike: Omit<CellOutputLike, "capacity"> & Partial<Pick<CellOutputLike, "capacity">>, outputData?: HexLike): void;
754
+ /**
755
+ * Get witness at index as WitnessArgs
756
+ *
757
+ * @param index - The index of the witness.
758
+ * @returns The witness parsed as WitnessArgs.
759
+ *
760
+ * @example
761
+ * ```typescript
762
+ * const witnessArgs = await tx.getWitnessArgsAt(0);
763
+ * ```
764
+ */
765
+ getWitnessArgsAt(index: number): WitnessArgs | undefined;
766
+ /**
767
+ * Set witness at index by WitnessArgs
768
+ *
769
+ * @param index - The index of the witness.
770
+ * @param witness - The WitnessArgs to set.
771
+ *
772
+ * @example
773
+ * ```typescript
774
+ * await tx.setWitnessArgsAt(0, witnessArgs);
775
+ * ```
776
+ */
777
+ setWitnessArgsAt(index: number, witness: WitnessArgs): void;
778
+ /**
779
+ * Prepare dummy witness for sighash all method
780
+ *
781
+ * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
782
+ * @param lockLen - The length of dummy lock bytes.
783
+ * @param client - The client for complete extra infos in the transaction.
784
+ * @returns A promise that resolves to the prepared transaction
785
+ *
786
+ * @example
787
+ * ```typescript
788
+ * await tx.prepareSighashAllWitness(scriptLike, 85, client);
789
+ * ```
790
+ */
791
+ prepareSighashAllWitness(scriptLike: ScriptLike, lockLen: number, client: Client): Promise<void>;
792
+ getInputsCapacity(client: Client): Promise<Num>;
793
+ getOutputsCapacity(): Num;
794
+ getInputsUdtBalance(client: Client, type: ScriptLike): Promise<Num>;
795
+ getOutputsUdtBalance(type: ScriptLike): Num;
796
+ completeInputs<T>(from: Signer, filter: ClientCollectableSearchKeyFilterLike, accumulator: (acc: T, v: Cell, i: number, array: Cell[]) => Promise<T | undefined> | T | undefined, init: T): Promise<number>;
797
+ completeInputsByCapacity(from: Signer, capacityTweak?: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<number>;
798
+ completeInputsByUdt(from: Signer, type: ScriptLike): Promise<number>;
799
+ estimateFee(feeRate: NumLike): Num;
800
+ completeFee(from: Signer, change: (tx: Transaction, capacity: Num) => Promise<NumLike> | NumLike, feeRate: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<[number, boolean]>;
801
+ completeFeeChangeToLock(from: Signer, change: ScriptLike, feeRate: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<[number, boolean]>;
802
+ completeFeeChangeToOutput(from: Signer, index: NumLike, feeRate: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<[number, boolean]>;
878
803
  }
879
- //# sourceMappingURL=transaction.d.ts.map
804
+ //# sourceMappingURL=transaction.d.ts.map