@ckb-ccc/core 0.0.4-alpha.6 → 0.0.4

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 (165) hide show
  1. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts +12 -0
  2. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
  3. package/dist/signer/btc/signerBtcPublicKeyReadonly.js +16 -0
  4. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts +12 -0
  5. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
  6. package/dist/signer/ckb/signerCkbScriptReadonly.js +16 -0
  7. package/dist/signer/evm/signerEvm.d.ts +5 -1
  8. package/dist/signer/evm/signerEvm.d.ts.map +1 -1
  9. package/dist/signer/evm/signerEvm.js +20 -6
  10. package/dist/signer/evm/signerEvmAddressReadonly.d.ts +13 -1
  11. package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  12. package/dist/signer/evm/signerEvmAddressReadonly.js +16 -0
  13. package/dist/signer/helpers.d.ts.map +1 -1
  14. package/dist/signer/helpers.js +4 -3
  15. package/dist/signer/signer.d.ts +16 -4
  16. package/dist/signer/signer.d.ts.map +1 -1
  17. package/dist/signer/signer.js +5 -2
  18. package/dist.commonjs/address/address.advanced.d.ts +65 -0
  19. package/dist.commonjs/address/address.advanced.d.ts.map +1 -0
  20. package/dist.commonjs/address/address.advanced.js +149 -0
  21. package/dist.commonjs/address/advanced.d.ts +2 -0
  22. package/dist.commonjs/address/advanced.d.ts.map +1 -0
  23. package/dist.commonjs/address/advanced.js +17 -0
  24. package/dist.commonjs/address/index.d.ts +54 -0
  25. package/dist.commonjs/address/index.d.ts.map +1 -0
  26. package/dist.commonjs/address/index.js +84 -0
  27. package/dist.commonjs/advanced.d.ts +3 -0
  28. package/dist.commonjs/advanced.d.ts.map +1 -0
  29. package/dist.commonjs/advanced.js +31 -0
  30. package/dist.commonjs/advancedBarrel.d.ts +5 -0
  31. package/dist.commonjs/advancedBarrel.d.ts.map +1 -0
  32. package/dist.commonjs/advancedBarrel.js +20 -0
  33. package/dist.commonjs/barrel.d.ts +11 -0
  34. package/dist.commonjs/barrel.d.ts.map +1 -0
  35. package/dist.commonjs/barrel.js +26 -0
  36. package/dist.commonjs/bytes/advanced.d.ts +5 -0
  37. package/dist.commonjs/bytes/advanced.d.ts.map +1 -0
  38. package/dist.commonjs/bytes/advanced.js +2 -0
  39. package/dist.commonjs/bytes/index.d.ts +64 -0
  40. package/dist.commonjs/bytes/index.d.ts.map +1 -0
  41. package/dist.commonjs/bytes/index.js +97 -0
  42. package/dist.commonjs/ckb/advanced.d.ts +4 -0
  43. package/dist.commonjs/ckb/advanced.d.ts.map +1 -0
  44. package/dist.commonjs/ckb/advanced.js +32 -0
  45. package/dist.commonjs/ckb/index.d.ts +3 -0
  46. package/dist.commonjs/ckb/index.d.ts.map +1 -0
  47. package/dist.commonjs/ckb/index.js +18 -0
  48. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +355 -0
  49. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts.map +1 -0
  50. package/dist.commonjs/ckb/molecule.advanced/generated.js +1536 -0
  51. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +6 -0
  52. package/dist.commonjs/ckb/molecule.advanced/index.d.ts.map +1 -0
  53. package/dist.commonjs/ckb/molecule.advanced/index.js +25 -0
  54. package/dist.commonjs/ckb/script.advanced.d.ts +5 -0
  55. package/dist.commonjs/ckb/script.advanced.d.ts.map +1 -0
  56. package/dist.commonjs/ckb/script.advanced.js +16 -0
  57. package/dist.commonjs/ckb/script.d.ts +126 -0
  58. package/dist.commonjs/ckb/script.d.ts.map +1 -0
  59. package/dist.commonjs/ckb/script.js +188 -0
  60. package/dist.commonjs/ckb/transaction.advanced.d.ts +5 -0
  61. package/dist.commonjs/ckb/transaction.advanced.d.ts.map +1 -0
  62. package/dist.commonjs/ckb/transaction.advanced.js +12 -0
  63. package/dist.commonjs/ckb/transaction.d.ts +533 -0
  64. package/dist.commonjs/ckb/transaction.d.ts.map +1 -0
  65. package/dist.commonjs/ckb/transaction.js +665 -0
  66. package/dist.commonjs/client/advanced.d.ts +4 -0
  67. package/dist.commonjs/client/advanced.d.ts.map +1 -0
  68. package/dist.commonjs/client/advanced.js +19 -0
  69. package/dist.commonjs/client/client.d.ts +19 -0
  70. package/dist.commonjs/client/client.d.ts.map +1 -0
  71. package/dist.commonjs/client/client.js +30 -0
  72. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +4 -0
  73. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -0
  74. package/dist.commonjs/client/clientPublicMainnet.advanced.js +26 -0
  75. package/dist.commonjs/client/clientPublicMainnet.d.ts +9 -0
  76. package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -0
  77. package/dist.commonjs/client/clientPublicMainnet.js +17 -0
  78. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +4 -0
  79. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts.map +1 -0
  80. package/dist.commonjs/client/clientPublicTestnet.advanced.js +26 -0
  81. package/dist.commonjs/client/clientPublicTestnet.d.ts +9 -0
  82. package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -0
  83. package/dist.commonjs/client/clientPublicTestnet.js +17 -0
  84. package/dist.commonjs/client/clientTypes.d.ts +8 -0
  85. package/dist.commonjs/client/clientTypes.d.ts.map +1 -0
  86. package/dist.commonjs/client/clientTypes.js +2 -0
  87. package/dist.commonjs/client/index.d.ts +6 -0
  88. package/dist.commonjs/client/index.d.ts.map +1 -0
  89. package/dist.commonjs/client/index.js +21 -0
  90. package/dist.commonjs/client/jsonRpc/advanced.d.ts +3 -0
  91. package/dist.commonjs/client/jsonRpc/advanced.d.ts.map +1 -0
  92. package/dist.commonjs/client/jsonRpc/advanced.js +18 -0
  93. package/dist.commonjs/client/jsonRpc/index.d.ts +68 -0
  94. package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -0
  95. package/dist.commonjs/client/jsonRpc/index.js +128 -0
  96. package/dist.commonjs/client/jsonRpc/transformers.d.ts +28 -0
  97. package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +1 -0
  98. package/dist.commonjs/client/jsonRpc/transformers.js +126 -0
  99. package/dist.commonjs/client/jsonRpc/types.d.ts +41 -0
  100. package/dist.commonjs/client/jsonRpc/types.d.ts.map +1 -0
  101. package/dist.commonjs/client/jsonRpc/types.js +2 -0
  102. package/dist.commonjs/fixedPoint/index.d.ts +49 -0
  103. package/dist.commonjs/fixedPoint/index.d.ts.map +1 -0
  104. package/dist.commonjs/fixedPoint/index.js +65 -0
  105. package/dist.commonjs/hasher/advanced.d.ts +2 -0
  106. package/dist.commonjs/hasher/advanced.d.ts.map +1 -0
  107. package/dist.commonjs/hasher/advanced.js +4 -0
  108. package/dist.commonjs/hasher/index.d.ts +52 -0
  109. package/dist.commonjs/hasher/index.d.ts.map +1 -0
  110. package/dist.commonjs/hasher/index.js +68 -0
  111. package/dist.commonjs/hex/index.d.ts +24 -0
  112. package/dist.commonjs/hex/index.d.ts.map +1 -0
  113. package/dist.commonjs/hex/index.js +20 -0
  114. package/dist.commonjs/index.d.ts +3 -0
  115. package/dist.commonjs/index.d.ts.map +1 -0
  116. package/dist.commonjs/index.js +31 -0
  117. package/dist.commonjs/num/index.d.ts +112 -0
  118. package/dist.commonjs/num/index.d.ts.map +1 -0
  119. package/dist.commonjs/num/index.js +139 -0
  120. package/dist.commonjs/signer/btc/index.d.ts +3 -0
  121. package/dist.commonjs/signer/btc/index.d.ts.map +1 -0
  122. package/dist.commonjs/signer/btc/index.js +18 -0
  123. package/dist.commonjs/signer/btc/signerBtc.d.ts +50 -0
  124. package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -0
  125. package/dist.commonjs/signer/btc/signerBtc.js +71 -0
  126. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +60 -0
  127. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -0
  128. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +72 -0
  129. package/dist.commonjs/signer/ckb/index.d.ts +2 -0
  130. package/dist.commonjs/signer/ckb/index.d.ts.map +1 -0
  131. package/dist.commonjs/signer/ckb/index.js +17 -0
  132. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +59 -0
  133. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -0
  134. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +71 -0
  135. package/dist.commonjs/signer/evm/index.d.ts +3 -0
  136. package/dist.commonjs/signer/evm/index.d.ts.map +1 -0
  137. package/dist.commonjs/signer/evm/index.js +18 -0
  138. package/dist.commonjs/signer/evm/signerEvm.d.ts +46 -0
  139. package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -0
  140. package/dist.commonjs/signer/evm/signerEvm.js +83 -0
  141. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +52 -0
  142. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -0
  143. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +62 -0
  144. package/dist.commonjs/signer/helpers.d.ts +40 -0
  145. package/dist.commonjs/signer/helpers.d.ts.map +1 -0
  146. package/dist.commonjs/signer/helpers.js +96 -0
  147. package/dist.commonjs/signer/index.d.ts +6 -0
  148. package/dist.commonjs/signer/index.d.ts.map +1 -0
  149. package/dist.commonjs/signer/index.js +21 -0
  150. package/dist.commonjs/signer/signer.d.ts +125 -0
  151. package/dist.commonjs/signer/signer.d.ts.map +1 -0
  152. package/dist.commonjs/signer/signer.js +109 -0
  153. package/dist.commonjs/tsconfig.commonjs.tsbuildinfo +1 -0
  154. package/dist.commonjs/utils/index.d.ts +7 -0
  155. package/dist.commonjs/utils/index.d.ts.map +1 -0
  156. package/dist.commonjs/utils/index.js +10 -0
  157. package/package.json +20 -7
  158. package/src/signer/btc/signerBtcPublicKeyReadonly.ts +18 -0
  159. package/src/signer/ckb/signerCkbScriptReadonly.ts +18 -0
  160. package/src/signer/evm/signerEvm.ts +55 -12
  161. package/src/signer/evm/signerEvmAddressReadonly.ts +19 -1
  162. package/src/signer/helpers.ts +6 -4
  163. package/src/signer/signer.ts +20 -3
  164. package/tsconfig.base.json +21 -0
  165. package/tsconfig.commonjs.json +8 -0
@@ -0,0 +1,533 @@
1
+ import type { TransactionSkeletonType } from "@ckb-lumos/helpers";
2
+ import { Bytes, BytesLike } from "../bytes";
3
+ import { Client } from "../client";
4
+ import { Hasher } from "../hasher";
5
+ import { Hex, HexLike } from "../hex";
6
+ import { Num, NumLike } from "../num";
7
+ import * as mol from "./molecule.advanced";
8
+ import { Script, ScriptLike } from "./script";
9
+ export type DepTypeLike = string | number | bigint;
10
+ export type DepType = "depGroup" | "code";
11
+ /**
12
+ * Converts a DepTypeLike value to a DepType.
13
+ *
14
+ * @param val - The value to convert, which can be a string, number, or bigint.
15
+ * @returns The corresponding DepType.
16
+ *
17
+ * @throws Will throw an error if the input value is not a valid dep type.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const depType = depTypeFrom(1); // Outputs "code"
22
+ * const depType = depTypeFrom("depGroup"); // Outputs "depGroup"
23
+ * ```
24
+ */
25
+ export declare function depTypeFrom(val: DepTypeLike): DepType;
26
+ /**
27
+ * Converts a DepTypeLike value to its corresponding byte representation.
28
+ *
29
+ * @param depType - The dep type value to convert.
30
+ * @returns A Uint8Array containing the byte representation of the dep type.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const depTypeBytes = depTypeToBytes("code"); // Outputs Uint8Array [1]
35
+ * ```
36
+ */
37
+ export declare function depTypeToBytes(depType: DepTypeLike): Bytes;
38
+ /**
39
+ * Converts a byte-like value to a DepType.
40
+ *
41
+ * @param bytes - The byte-like value to convert.
42
+ * @returns The corresponding DepType.
43
+ *
44
+ * @throws Will throw an error if the input bytes do not correspond to a valid dep type.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const depType = depTypeFromBytes(new Uint8Array([1])); // Outputs "code"
49
+ * ```
50
+ */
51
+ export declare function depTypeFromBytes(bytes: BytesLike): DepType;
52
+ export type OutPointLike = {
53
+ txHash: HexLike;
54
+ index: NumLike;
55
+ };
56
+ export declare class OutPoint {
57
+ txHash: Hex;
58
+ index: Num;
59
+ /**
60
+ * Creates an instance of OutPoint.
61
+ *
62
+ * @param txHash - The transaction hash.
63
+ * @param index - The index of the output in the transaction.
64
+ */
65
+ constructor(txHash: Hex, index: Num);
66
+ /**
67
+ * Creates an OutPoint instance from an OutPointLike object.
68
+ *
69
+ * @param outPoint - An OutPointLike object or an instance of OutPoint.
70
+ * @returns An OutPoint instance.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const outPoint = OutPoint.from({ txHash: "0x...", index: 0 });
75
+ * ```
76
+ */
77
+ static from(outPoint: OutPointLike): OutPoint;
78
+ /**
79
+ * Converts the OutPoint instance to molecule data format.
80
+ *
81
+ * @returns An object representing the outpoint in molecule data format.
82
+ */
83
+ _toMolData(): {
84
+ txHash: Uint8Array;
85
+ index: Uint8Array;
86
+ };
87
+ /**
88
+ * Converts the OutPoint instance to bytes.
89
+ *
90
+ * @returns A Uint8Array containing the outpoint bytes.
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const outPointBytes = outPoint.encode();
95
+ * ```
96
+ */
97
+ encode(): Bytes;
98
+ /**
99
+ * Creates an OutPoint instance from a byte-like value or molecule OutPoint.
100
+ *
101
+ * @param bytes - The byte-like value or molecule OutPoint to convert.
102
+ * @returns An OutPoint instance.
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const outPoint = OutPoint.fromBytes(new Uint8Array([/* outpoint bytes *\/]));
107
+ * ```
108
+ */
109
+ static fromBytes(bytes: BytesLike | mol.OutPoint): OutPoint;
110
+ }
111
+ export type CellOutputLike = {
112
+ capacity: NumLike;
113
+ lock: ScriptLike;
114
+ type?: ScriptLike;
115
+ };
116
+ export declare class CellOutput {
117
+ capacity: Num;
118
+ lock: Script;
119
+ type?: Script | undefined;
120
+ /**
121
+ * Creates an instance of CellOutput.
122
+ *
123
+ * @param capacity - The capacity of the cell.
124
+ * @param lock - The lock script of the cell.
125
+ * @param type - The optional type script of the cell.
126
+ */
127
+ constructor(capacity: Num, lock: Script, type?: Script | undefined);
128
+ /**
129
+ * Creates a CellOutput instance from a CellOutputLike object.
130
+ *
131
+ * @param cellOutput - A CellOutputLike object or an instance of CellOutput.
132
+ * @returns A CellOutput instance.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const cellOutput = CellOutput.from({
137
+ * capacity: 1000n,
138
+ * lock: { codeHash: "0x...", hashType: "type", args: "0x..." },
139
+ * type: { codeHash: "0x...", hashType: "type", args: "0x..." }
140
+ * });
141
+ * ```
142
+ */
143
+ static from(cellOutput: CellOutputLike): CellOutput;
144
+ /**
145
+ * Converts the CellOutput instance to molecule data format.
146
+ *
147
+ * @returns An object representing the cell output in molecule data format.
148
+ */
149
+ _toMolData(): {
150
+ capacity: Uint8Array;
151
+ lock: {
152
+ codeHash: Uint8Array;
153
+ hashType: Uint8Array;
154
+ args: Uint8Array;
155
+ };
156
+ type: {
157
+ codeHash: Uint8Array;
158
+ hashType: Uint8Array;
159
+ args: Uint8Array;
160
+ } | undefined;
161
+ };
162
+ /**
163
+ * Converts the CellOutput instance to bytes.
164
+ *
165
+ * @returns A Uint8Array containing the cell output bytes.
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * const cellOutputBytes = cellOutput.toBytes();
170
+ * ```
171
+ */
172
+ toBytes(): Bytes;
173
+ /**
174
+ * Creates a CellOutput instance from a byte-like value or molecule CellOutput.
175
+ *
176
+ * @param bytes - The byte-like value or molecule CellOutput to convert.
177
+ * @returns A CellOutput instance.
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * const cellOutput = CellOutput.fromBytes(new Uint8Array([/* cell output bytes *\/]));
182
+ * ```
183
+ */
184
+ static fromBytes(bytes: BytesLike | mol.CellOutput): CellOutput;
185
+ }
186
+ export type CellLike = {
187
+ cellOutput: CellOutputLike;
188
+ outputData: HexLike;
189
+ };
190
+ export declare class Cell {
191
+ cellOutput: CellOutput;
192
+ outputData: Hex;
193
+ /**
194
+ * Creates an instance of Cell.
195
+ *
196
+ * @param cellOutput - The cell output of the cell.
197
+ * @param outputData - The output data of the cell.
198
+ */
199
+ constructor(cellOutput: CellOutput, outputData: Hex);
200
+ /**
201
+ * Creates a Cell instance from a CellLike object.
202
+ *
203
+ * @param cell - A CellLike object or an instance of Cell.
204
+ * @returns A Cell instance.
205
+ */
206
+ static from(cell: CellLike): Cell;
207
+ }
208
+ export type CellInputLike = {
209
+ previousOutput: OutPointLike;
210
+ since: NumLike;
211
+ cellOutput?: CellOutputLike;
212
+ outputData?: HexLike;
213
+ };
214
+ export declare class CellInput {
215
+ previousOutput: OutPoint;
216
+ since: Num;
217
+ cellOutput?: CellOutput | undefined;
218
+ outputData?: `0x${string}` | undefined;
219
+ /**
220
+ * Creates an instance of CellInput.
221
+ *
222
+ * @param previousOutput - The previous outpoint of the cell.
223
+ * @param since - The since value of the cell input.
224
+ * @param cellOutput - The optional cell output associated with the cell input.
225
+ * @param outputData - The optional output data associated with the cell input.
226
+ */
227
+ constructor(previousOutput: OutPoint, since: Num, cellOutput?: CellOutput | undefined, outputData?: `0x${string}` | undefined);
228
+ /**
229
+ * Creates a CellInput instance from a CellInputLike object.
230
+ *
231
+ * @param cellInput - A CellInputLike object or an instance of CellInput.
232
+ * @returns A CellInput instance.
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * const cellInput = CellInput.from({
237
+ * previousOutput: { txHash: "0x...", index: 0 },
238
+ * since: 0n
239
+ * });
240
+ * ```
241
+ */
242
+ static from(cellInput: CellInputLike): CellInput;
243
+ /**
244
+ * Complete extra infos in the input. Like the output of the out point.
245
+ * The instance will be modified.
246
+ *
247
+ * @returns The completed instance.
248
+ * @example
249
+ * ```typescript
250
+ * if (!cellInput.cellOutput) {
251
+ * await cellInput.completeExtraInfos();
252
+ * }
253
+ * ```
254
+ */
255
+ completeExtraInfos(client: Client): Promise<CellInput>;
256
+ /**
257
+ * Converts the CellInput instance to molecule data format.
258
+ *
259
+ * @returns An object representing the cell input in molecule data format.
260
+ */
261
+ _toMolData(): {
262
+ previousOutput: {
263
+ txHash: Uint8Array;
264
+ index: Uint8Array;
265
+ };
266
+ since: Uint8Array;
267
+ };
268
+ /**
269
+ * Converts the CellInput instance to bytes.
270
+ *
271
+ * @returns A Uint8Array containing the cell input bytes.
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * const cellInputBytes = cellInput.toBytes();
276
+ * ```
277
+ */
278
+ toBytes(): Bytes;
279
+ /**
280
+ * Creates a CellInput instance from a byte-like value or molecule CellInput.
281
+ *
282
+ * @param bytes - The byte-like value or molecule CellInput to convert.
283
+ * @returns A CellInput instance.
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * const cellInput = CellInput.fromBytes(new Uint8Array([/* cell input bytes *\/]));
288
+ * ```
289
+ */
290
+ static fromBytes(bytes: BytesLike | mol.CellInput): CellInput;
291
+ }
292
+ export type CellDepLike = {
293
+ outPoint: OutPointLike;
294
+ depType: DepTypeLike;
295
+ };
296
+ export declare class CellDep {
297
+ outPoint: OutPoint;
298
+ depType: DepType;
299
+ /**
300
+ * Creates an instance of CellDep.
301
+ *
302
+ * @param outPoint - The outpoint of the cell dependency.
303
+ * @param depType - The dependency type.
304
+ */
305
+ constructor(outPoint: OutPoint, depType: DepType);
306
+ /**
307
+ * Creates a CellDep instance from a CellDepLike object.
308
+ *
309
+ * @param cellDep - A CellDepLike object or an instance of CellDep.
310
+ * @returns A CellDep instance.
311
+ *
312
+ * @example
313
+ * ```typescript
314
+ * const cellDep = CellDep.from({
315
+ * outPoint: { txHash: "0x...", index: 0 },
316
+ * depType: "depGroup"
317
+ * });
318
+ * ```
319
+ */
320
+ static from(cellDep: CellDepLike): CellDep;
321
+ /**
322
+ * Converts the CellDep instance to molecule data format.
323
+ *
324
+ * @returns An object representing the cell dependency in molecule data format.
325
+ */
326
+ _toMolData(): {
327
+ outPoint: {
328
+ txHash: Uint8Array;
329
+ index: Uint8Array;
330
+ };
331
+ depType: Uint8Array;
332
+ };
333
+ /**
334
+ * Converts the CellDep instance to bytes.
335
+ *
336
+ * @returns A Uint8Array containing the cell dependency bytes.
337
+ *
338
+ * @example
339
+ * ```typescript
340
+ * const cellDepBytes = cellDep.toBytes();
341
+ * ```
342
+ */
343
+ toBytes(): Bytes;
344
+ /**
345
+ * Creates a CellDep instance from a byte-like value or molecule CellDep.
346
+ *
347
+ * @param bytes - The byte-like value or molecule CellDep to convert.
348
+ * @returns A CellDep instance.
349
+ *
350
+ * @example
351
+ * ```typescript
352
+ * const cellDep = CellDep.fromBytes(new Uint8Array([/* cell dep bytes *\/]));
353
+ * ```
354
+ */
355
+ fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
356
+ }
357
+ export type WitnessArgsLike = {
358
+ lock?: HexLike;
359
+ inputType?: HexLike;
360
+ outputType?: HexLike;
361
+ };
362
+ export declare class WitnessArgs {
363
+ lock?: `0x${string}` | undefined;
364
+ inputType?: `0x${string}` | undefined;
365
+ outputType?: `0x${string}` | undefined;
366
+ /**
367
+ * Creates an instance of WitnessArgs.
368
+ *
369
+ * @param lock - The optional lock field of the witness.
370
+ * @param inputType - The optional input type field of the witness.
371
+ * @param outputType - The optional output type field of the witness.
372
+ */
373
+ constructor(lock?: `0x${string}` | undefined, inputType?: `0x${string}` | undefined, outputType?: `0x${string}` | undefined);
374
+ /**
375
+ * Creates a WitnessArgs instance from a WitnessArgsLike object.
376
+ *
377
+ * @param witnessArgs - A WitnessArgsLike object or an instance of WitnessArgs.
378
+ * @returns A WitnessArgs instance.
379
+ *
380
+ * @example
381
+ * ```typescript
382
+ * const witnessArgs = WitnessArgs.from({
383
+ * lock: "0x...",
384
+ * inputType: "0x...",
385
+ * outputType: "0x..."
386
+ * });
387
+ * ```
388
+ */
389
+ static from(witnessArgs: WitnessArgsLike): WitnessArgs;
390
+ /**
391
+ * Converts the WitnessArgs instance to molecule data format.
392
+ *
393
+ * @returns An object representing the witness arguments in molecule data format.
394
+ */
395
+ _toMolData(): {
396
+ lock: Uint8Array | undefined;
397
+ inputType: Uint8Array | undefined;
398
+ outputType: Uint8Array | undefined;
399
+ };
400
+ /**
401
+ * Converts the WitnessArgs instance to bytes.
402
+ *
403
+ * @returns A Uint8Array containing the witness arguments bytes.
404
+ *
405
+ * @example
406
+ * ```typescript
407
+ * const witnessArgsBytes = witnessArgs.toBytes();
408
+ * ```
409
+ */
410
+ toBytes(): Bytes;
411
+ /**
412
+ * Creates a WitnessArgs instance from a byte-like value or molecule WitnessArgs.
413
+ *
414
+ * @param bytes - The byte-like value or molecule WitnessArgs to convert.
415
+ * @returns A WitnessArgs instance.
416
+ *
417
+ * @example
418
+ * ```typescript
419
+ * const witnessArgs = WitnessArgs.fromBytes(new Uint8Array([/* witness args bytes *\/]));
420
+ * ```
421
+ */
422
+ static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
423
+ }
424
+ export type TransactionLike = {
425
+ version: NumLike;
426
+ cellDeps: CellDepLike[];
427
+ headerDeps: HexLike[];
428
+ inputs: CellInputLike[];
429
+ outputs: CellOutputLike[];
430
+ outputsData: HexLike[];
431
+ witnesses: HexLike[];
432
+ };
433
+ export declare class Transaction {
434
+ version: Num;
435
+ cellDeps: CellDep[];
436
+ headerDeps: Hex[];
437
+ inputs: CellInput[];
438
+ outputs: CellOutput[];
439
+ outputsData: Hex[];
440
+ witnesses: Hex[];
441
+ /**
442
+ * Creates an instance of Transaction.
443
+ *
444
+ * @param version - The version of the transaction.
445
+ * @param cellDeps - The cell dependencies of the transaction.
446
+ * @param headerDeps - The header dependencies of the transaction.
447
+ * @param inputs - The inputs of the transaction.
448
+ * @param outputs - The outputs of the transaction.
449
+ * @param outputsData - The data associated with the outputs.
450
+ * @param witnesses - The witnesses of the transaction.
451
+ */
452
+ constructor(version: Num, cellDeps: CellDep[], headerDeps: Hex[], inputs: CellInput[], outputs: CellOutput[], outputsData: Hex[], witnesses: Hex[]);
453
+ /**
454
+ * Creates a default Transaction instance with empty fields.
455
+ *
456
+ * @returns A default Transaction instance.
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * const defaultTx = Transaction.default();
461
+ * ```
462
+ */
463
+ static default(): Transaction;
464
+ /**
465
+ * Creates a Transaction instance from a TransactionLike object.
466
+ *
467
+ * @param tx - A TransactionLike object or an instance of Transaction.
468
+ * @returns A Transaction instance.
469
+ *
470
+ * @example
471
+ * ```typescript
472
+ * const transaction = Transaction.from({
473
+ * version: 0,
474
+ * cellDeps: [],
475
+ * headerDeps: [],
476
+ * inputs: [],
477
+ * outputs: [],
478
+ * outputsData: [],
479
+ * witnesses: []
480
+ * });
481
+ * ```
482
+ */
483
+ static from(tx: TransactionLike): Transaction;
484
+ /**
485
+ * Creates a Transaction instance from a Lumos skeleton.
486
+ *
487
+ * @param skeleton - The Lumos transaction skeleton.
488
+ * @returns A Transaction instance.
489
+ *
490
+ * @throws Will throw an error if an input's outPoint is missing.
491
+ *
492
+ * @example
493
+ * ```typescript
494
+ * const transaction = Transaction.fromLumosSkeleton(skeleton);
495
+ * ```
496
+ */
497
+ static fromLumosSkeleton(skeleton: TransactionSkeletonType): Transaction;
498
+ /**
499
+ * Converts the raw transaction data to bytes.
500
+ *
501
+ * @returns A Uint8Array containing the raw transaction bytes.
502
+ *
503
+ * @example
504
+ * ```typescript
505
+ * const rawTxBytes = transaction.rawToBytes();
506
+ * ```
507
+ */
508
+ rawToBytes(): Bytes;
509
+ /**
510
+ * Calculates the hash of the transaction.
511
+ *
512
+ * @returns The hash of the transaction.
513
+ *
514
+ * @example
515
+ * ```typescript
516
+ * const txHash = transaction.hash();
517
+ * ```
518
+ */
519
+ hash(): `0x${string}`;
520
+ /**
521
+ * Hashes a witness and updates the hasher.
522
+ *
523
+ * @param witness - The witness to hash.
524
+ * @param hasher - The hasher instance to update.
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * Transaction.hashWitnessToHasher("0x...", hasher);
529
+ * ```
530
+ */
531
+ static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
532
+ }
533
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/ckb/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAW,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAqC,MAAM,QAAQ,CAAC;AAEzE,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAgBrD;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,KAAK,CAE1D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAE1D;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AACF,qBAAa,QAAQ;IASV,MAAM,EAAE,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