@ckb-ccc/core 0.0.5-alpha.10 → 0.0.5-alpha.11

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 (110) hide show
  1. package/dist/ckb/transaction.d.ts +2 -4
  2. package/dist/ckb/transaction.d.ts.map +1 -1
  3. package/dist/ckb/transaction.js +12 -12
  4. package/dist/client/client.js +1 -1
  5. package/dist.commonjs/address/address.advanced.d.ts +24 -29
  6. package/dist.commonjs/address/address.advanced.js +92 -114
  7. package/dist.commonjs/address/advanced.d.ts +1 -1
  8. package/dist.commonjs/address/advanced.js +14 -30
  9. package/dist.commonjs/address/index.d.ts +44 -51
  10. package/dist.commonjs/address/index.js +68 -87
  11. package/dist.commonjs/advanced.d.ts +1 -1
  12. package/dist.commonjs/advanced.js +22 -47
  13. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  14. package/dist.commonjs/advancedBarrel.js +14 -30
  15. package/dist.commonjs/barrel.d.ts +1 -1
  16. package/dist.commonjs/barrel.js +14 -30
  17. package/dist.commonjs/bytes/advanced.d.ts +2 -11
  18. package/dist.commonjs/bytes/index.d.ts +3 -9
  19. package/dist.commonjs/bytes/index.js +26 -28
  20. package/dist.commonjs/ckb/advanced.d.ts +1 -1
  21. package/dist.commonjs/ckb/advanced.js +22 -47
  22. package/dist.commonjs/ckb/index.d.ts +1 -1
  23. package/dist.commonjs/ckb/index.js +14 -30
  24. package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +260 -420
  25. package/dist.commonjs/ckb/molecule.advanced/generated.js +1332 -1536
  26. package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
  27. package/dist.commonjs/ckb/molecule.advanced/index.js +18 -34
  28. package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
  29. package/dist.commonjs/ckb/script.advanced.js +9 -12
  30. package/dist.commonjs/ckb/script.d.ts +76 -76
  31. package/dist.commonjs/ckb/script.js +126 -166
  32. package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
  33. package/dist.commonjs/ckb/transaction.advanced.js +4 -4
  34. package/dist.commonjs/ckb/transaction.d.ts +530 -570
  35. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  36. package/dist.commonjs/ckb/transaction.js +722 -839
  37. package/dist.commonjs/client/advanced.d.ts +1 -1
  38. package/dist.commonjs/client/advanced.js +14 -30
  39. package/dist.commonjs/client/client.d.ts +21 -52
  40. package/dist.commonjs/client/client.js +57 -66
  41. package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +2 -5
  42. package/dist.commonjs/client/clientPublicMainnet.advanced.js +24 -30
  43. package/dist.commonjs/client/clientPublicMainnet.d.ts +4 -6
  44. package/dist.commonjs/client/clientPublicMainnet.js +9 -9
  45. package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +2 -5
  46. package/dist.commonjs/client/clientPublicTestnet.advanced.js +24 -30
  47. package/dist.commonjs/client/clientPublicTestnet.d.ts +4 -6
  48. package/dist.commonjs/client/clientPublicTestnet.js +9 -9
  49. package/dist.commonjs/client/clientTypes.d.ts +36 -51
  50. package/dist.commonjs/client/clientTypes.js +19 -34
  51. package/dist.commonjs/client/index.d.ts +1 -1
  52. package/dist.commonjs/client/index.js +14 -30
  53. package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
  54. package/dist.commonjs/client/jsonRpc/advanced.js +14 -30
  55. package/dist.commonjs/client/jsonRpc/index.d.ts +75 -92
  56. package/dist.commonjs/client/jsonRpc/index.js +108 -135
  57. package/dist.commonjs/client/jsonRpc/transformers.d.ts +38 -78
  58. package/dist.commonjs/client/jsonRpc/transformers.js +150 -175
  59. package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
  60. package/dist.commonjs/fixedPoint/index.d.ts +3 -9
  61. package/dist.commonjs/fixedPoint/index.js +20 -26
  62. package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
  63. package/dist.commonjs/fixedPoint/index.test.js +36 -42
  64. package/dist.commonjs/hasher/advanced.d.ts +1 -1
  65. package/dist.commonjs/hasher/index.d.ts +36 -36
  66. package/dist.commonjs/hasher/index.js +45 -52
  67. package/dist.commonjs/hex/index.d.ts +1 -1
  68. package/dist.commonjs/hex/index.js +1 -1
  69. package/dist.commonjs/index.d.ts +1 -1
  70. package/dist.commonjs/index.js +22 -47
  71. package/dist.commonjs/num/index.d.ts +1 -1
  72. package/dist.commonjs/num/index.js +19 -30
  73. package/dist.commonjs/signer/btc/index.d.ts +1 -1
  74. package/dist.commonjs/signer/btc/index.js +14 -30
  75. package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
  76. package/dist.commonjs/signer/btc/signerBtc.js +65 -85
  77. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
  78. package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
  79. package/dist.commonjs/signer/btc/verify.d.ts +2 -6
  80. package/dist.commonjs/signer/btc/verify.js +2 -5
  81. package/dist.commonjs/signer/ckb/index.d.ts +1 -1
  82. package/dist.commonjs/signer/ckb/index.js +14 -30
  83. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
  84. package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
  85. package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +2 -6
  86. package/dist.commonjs/signer/ckb/verifyJoyId.js +8 -11
  87. package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
  88. package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
  89. package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
  90. package/dist.commonjs/signer/dummy/dummy.js +16 -16
  91. package/dist.commonjs/signer/dummy/index.d.ts +1 -1
  92. package/dist.commonjs/signer/dummy/index.js +14 -30
  93. package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
  94. package/dist.commonjs/signer/dummy/openLink.js +7 -7
  95. package/dist.commonjs/signer/evm/index.d.ts +1 -1
  96. package/dist.commonjs/signer/evm/index.js +14 -30
  97. package/dist.commonjs/signer/evm/signerEvm.d.ts +38 -42
  98. package/dist.commonjs/signer/evm/signerEvm.js +68 -100
  99. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
  100. package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
  101. package/dist.commonjs/signer/evm/verify.d.ts +2 -6
  102. package/dist.commonjs/signer/evm/verify.js +2 -7
  103. package/dist.commonjs/signer/index.d.ts +1 -1
  104. package/dist.commonjs/signer/index.js +14 -30
  105. package/dist.commonjs/signer/signer/index.d.ts +153 -159
  106. package/dist.commonjs/signer/signer/index.js +181 -204
  107. package/dist.commonjs/utils/index.d.ts +8 -36
  108. package/dist.commonjs/utils/index.js +12 -18
  109. package/package.json +2 -2
  110. package/src/ckb/transaction.ts +14 -13
@@ -50,605 +50,565 @@ export declare function depTypeToBytes(depType: DepTypeLike): Bytes;
50
50
  */
51
51
  export declare function depTypeFromBytes(bytes: BytesLike): DepType;
52
52
  export type OutPointLike = {
53
- txHash: HexLike;
54
- index: NumLike;
53
+ txHash: HexLike;
54
+ index: NumLike;
55
55
  };
56
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;
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
110
  }
111
111
  export type CellOutputLike = {
112
- capacity: NumLike;
113
- lock: ScriptLike;
114
- type?: ScriptLike;
112
+ capacity: NumLike;
113
+ lock: ScriptLike;
114
+ type?: ScriptLike;
115
115
  };
116
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;
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;
155
161
  };
156
- type:
157
- | {
158
- codeHash: Uint8Array;
159
- hashType: Uint8Array;
160
- args: Uint8Array;
161
- }
162
- | undefined;
163
- };
164
- /**
165
- * Converts the CellOutput instance to bytes.
166
- *
167
- * @returns A Uint8Array containing the cell output bytes.
168
- *
169
- * @example
170
- * ```typescript
171
- * const cellOutputBytes = cellOutput.toBytes();
172
- * ```
173
- */
174
- toBytes(): Bytes;
175
- /**
176
- * Creates a CellOutput instance from a byte-like value or molecule CellOutput.
177
- *
178
- * @param bytes - The byte-like value or molecule CellOutput to convert.
179
- * @returns A CellOutput instance.
180
- *
181
- * @example
182
- * ```typescript
183
- * const cellOutput = CellOutput.fromBytes(new Uint8Array([/* cell output bytes *\/]));
184
- * ```
185
- */
186
- static fromBytes(bytes: BytesLike | mol.CellOutput): CellOutput;
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;
187
185
  }
188
186
  export type CellLike = {
189
- outPoint: OutPointLike;
190
- cellOutput: CellOutputLike;
191
- outputData: HexLike;
192
- blockNumber: NumLike;
187
+ outPoint: OutPointLike;
188
+ cellOutput: CellOutputLike;
189
+ outputData: HexLike;
190
+ blockNumber: NumLike;
193
191
  };
194
192
  export declare class Cell {
195
- outPoint: OutPoint;
196
- cellOutput: CellOutput;
197
- outputData: Hex;
198
- blockNumber: Num;
199
- /**
200
- * Creates an instance of Cell.
201
- *
202
- * @param outPoint - The output point of the cell.
203
- * @param cellOutput - The cell output of the cell.
204
- * @param outputData - The output data of the cell.
205
- * @param blockNumber - The block number of the cell.
206
- */
207
- constructor(
208
- outPoint: OutPoint,
209
- cellOutput: CellOutput,
210
- outputData: Hex,
211
- blockNumber: Num,
212
- );
213
- /**
214
- * Creates a Cell instance from a CellLike object.
215
- *
216
- * @param cell - A CellLike object or an instance of Cell.
217
- * @returns A Cell instance.
218
- */
219
- static from(cell: CellLike): Cell;
193
+ outPoint: OutPoint;
194
+ cellOutput: CellOutput;
195
+ outputData: Hex;
196
+ blockNumber: Num;
197
+ /**
198
+ * Creates an instance of Cell.
199
+ *
200
+ * @param outPoint - The output point of the cell.
201
+ * @param cellOutput - The cell output of the cell.
202
+ * @param outputData - The output data of the cell.
203
+ * @param blockNumber - The block number of the cell.
204
+ */
205
+ constructor(outPoint: OutPoint, cellOutput: CellOutput, outputData: Hex, blockNumber: Num);
206
+ /**
207
+ * Creates a Cell instance from a CellLike object.
208
+ *
209
+ * @param cell - A CellLike object or an instance of Cell.
210
+ * @returns A Cell instance.
211
+ */
212
+ static from(cell: CellLike): Cell;
220
213
  }
221
214
  export type CellInputLike = {
222
- previousOutput: OutPointLike;
223
- since: NumLike;
224
- cellOutput?: CellOutputLike;
225
- outputData?: HexLike;
226
- blockNumber?: NumLike;
215
+ previousOutput: OutPointLike;
216
+ since: NumLike;
217
+ cellOutput?: CellOutputLike;
218
+ outputData?: HexLike;
219
+ blockNumber?: NumLike;
227
220
  };
228
221
  export declare class CellInput {
229
- previousOutput: OutPoint;
230
- since: Num;
231
- cellOutput?: CellOutput | undefined;
232
- outputData?: `0x${string}` | undefined;
233
- blockNumber?: bigint | undefined;
234
- /**
235
- * Creates an instance of CellInput.
236
- *
237
- * @param previousOutput - The previous outpoint of the cell.
238
- * @param since - The since value of the cell input.
239
- * @param cellOutput - The optional cell output associated with the cell input.
240
- * @param outputData - The optional output data associated with the cell input.
241
- * @param blockNumber - The optional block number associated with the cell input.
242
- */
243
- constructor(
244
- previousOutput: OutPoint,
245
- since: Num,
246
- cellOutput?: CellOutput | undefined,
247
- outputData?: `0x${string}` | undefined,
248
- blockNumber?: bigint | undefined,
249
- );
250
- /**
251
- * Creates a CellInput instance from a CellInputLike object.
252
- *
253
- * @param cellInput - A CellInputLike object or an instance of CellInput.
254
- * @returns A CellInput instance.
255
- *
256
- * @example
257
- * ```typescript
258
- * const cellInput = CellInput.from({
259
- * previousOutput: { txHash: "0x...", index: 0 },
260
- * since: 0n
261
- * });
262
- * ```
263
- */
264
- static from(cellInput: CellInputLike): CellInput;
265
- /**
266
- * Complete extra infos in the input. Like the output of the out point.
267
- * The instance will be modified.
268
- *
269
- * @returns The completed instance.
270
- * @example
271
- * ```typescript
272
- * if (!cellInput.cellOutput) {
273
- * await cellInput.completeExtraInfos();
274
- * }
275
- * ```
276
- */
277
- completeExtraInfos(client: Client): Promise<CellInput>;
278
- /**
279
- * Converts the CellInput instance to molecule data format.
280
- *
281
- * @returns An object representing the cell input in molecule data format.
282
- */
283
- _toMolData(): {
284
- previousOutput: {
285
- txHash: Uint8Array;
286
- index: Uint8Array;
222
+ previousOutput: OutPoint;
223
+ since: Num;
224
+ cellOutput?: CellOutput | undefined;
225
+ outputData?: `0x${string}` | undefined;
226
+ blockNumber?: bigint | undefined;
227
+ /**
228
+ * Creates an instance of CellInput.
229
+ *
230
+ * @param previousOutput - The previous outpoint of the cell.
231
+ * @param since - The since value of the cell input.
232
+ * @param cellOutput - The optional cell output associated with the cell input.
233
+ * @param outputData - The optional output data associated with the cell input.
234
+ * @param blockNumber - The optional block number associated with the cell input.
235
+ */
236
+ constructor(previousOutput: OutPoint, since: Num, cellOutput?: CellOutput | undefined, outputData?: `0x${string}` | undefined, blockNumber?: bigint | undefined);
237
+ /**
238
+ * Creates a CellInput instance from a CellInputLike object.
239
+ *
240
+ * @param cellInput - A CellInputLike object or an instance of CellInput.
241
+ * @returns A CellInput instance.
242
+ *
243
+ * @example
244
+ * ```typescript
245
+ * const cellInput = CellInput.from({
246
+ * previousOutput: { txHash: "0x...", index: 0 },
247
+ * since: 0n
248
+ * });
249
+ * ```
250
+ */
251
+ static from(cellInput: CellInputLike): CellInput;
252
+ /**
253
+ * Complete extra infos in the input. Like the output of the out point.
254
+ * The instance will be modified.
255
+ *
256
+ * @returns The completed instance.
257
+ * @example
258
+ * ```typescript
259
+ * await cellInput.completeExtraInfos();
260
+ * ```
261
+ */
262
+ completeExtraInfos(client: Client): Promise<void>;
263
+ /**
264
+ * Converts the CellInput instance to molecule data format.
265
+ *
266
+ * @returns An object representing the cell input in molecule data format.
267
+ */
268
+ _toMolData(): {
269
+ previousOutput: {
270
+ txHash: Uint8Array;
271
+ index: Uint8Array;
272
+ };
273
+ since: Uint8Array;
287
274
  };
288
- since: Uint8Array;
289
- };
290
- /**
291
- * Converts the CellInput instance to bytes.
292
- *
293
- * @returns A Uint8Array containing the cell input bytes.
294
- *
295
- * @example
296
- * ```typescript
297
- * const cellInputBytes = cellInput.toBytes();
298
- * ```
299
- */
300
- toBytes(): Bytes;
301
- /**
302
- * Creates a CellInput instance from a byte-like value or molecule CellInput.
303
- *
304
- * @param bytes - The byte-like value or molecule CellInput to convert.
305
- * @returns A CellInput instance.
306
- *
307
- * @example
308
- * ```typescript
309
- * const cellInput = CellInput.fromBytes(new Uint8Array([/* cell input bytes *\/]));
310
- * ```
311
- */
312
- static fromBytes(bytes: BytesLike | mol.CellInput): CellInput;
275
+ /**
276
+ * Converts the CellInput instance to bytes.
277
+ *
278
+ * @returns A Uint8Array containing the cell input bytes.
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * const cellInputBytes = cellInput.toBytes();
283
+ * ```
284
+ */
285
+ toBytes(): Bytes;
286
+ /**
287
+ * Creates a CellInput instance from a byte-like value or molecule CellInput.
288
+ *
289
+ * @param bytes - The byte-like value or molecule CellInput to convert.
290
+ * @returns A CellInput instance.
291
+ *
292
+ * @example
293
+ * ```typescript
294
+ * const cellInput = CellInput.fromBytes(new Uint8Array([/* cell input bytes *\/]));
295
+ * ```
296
+ */
297
+ static fromBytes(bytes: BytesLike | mol.CellInput): CellInput;
313
298
  }
314
299
  export type CellDepLike = {
315
- outPoint: OutPointLike;
316
- depType: DepTypeLike;
300
+ outPoint: OutPointLike;
301
+ depType: DepTypeLike;
317
302
  };
318
303
  export declare class CellDep {
319
- outPoint: OutPoint;
320
- depType: DepType;
321
- /**
322
- * Creates an instance of CellDep.
323
- *
324
- * @param outPoint - The outpoint of the cell dependency.
325
- * @param depType - The dependency type.
326
- */
327
- constructor(outPoint: OutPoint, depType: DepType);
328
- /**
329
- * Creates a CellDep instance from a CellDepLike object.
330
- *
331
- * @param cellDep - A CellDepLike object or an instance of CellDep.
332
- * @returns A CellDep instance.
333
- *
334
- * @example
335
- * ```typescript
336
- * const cellDep = CellDep.from({
337
- * outPoint: { txHash: "0x...", index: 0 },
338
- * depType: "depGroup"
339
- * });
340
- * ```
341
- */
342
- static from(cellDep: CellDepLike): CellDep;
343
- /**
344
- * Converts the CellDep instance to molecule data format.
345
- *
346
- * @returns An object representing the cell dependency in molecule data format.
347
- */
348
- _toMolData(): {
349
- outPoint: {
350
- txHash: Uint8Array;
351
- index: Uint8Array;
304
+ outPoint: OutPoint;
305
+ depType: DepType;
306
+ /**
307
+ * Creates an instance of CellDep.
308
+ *
309
+ * @param outPoint - The outpoint of the cell dependency.
310
+ * @param depType - The dependency type.
311
+ */
312
+ constructor(outPoint: OutPoint, depType: DepType);
313
+ /**
314
+ * Creates a CellDep instance from a CellDepLike object.
315
+ *
316
+ * @param cellDep - A CellDepLike object or an instance of CellDep.
317
+ * @returns A CellDep instance.
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * const cellDep = CellDep.from({
322
+ * outPoint: { txHash: "0x...", index: 0 },
323
+ * depType: "depGroup"
324
+ * });
325
+ * ```
326
+ */
327
+ static from(cellDep: CellDepLike): CellDep;
328
+ /**
329
+ * Converts the CellDep instance to molecule data format.
330
+ *
331
+ * @returns An object representing the cell dependency in molecule data format.
332
+ */
333
+ _toMolData(): {
334
+ outPoint: {
335
+ txHash: Uint8Array;
336
+ index: Uint8Array;
337
+ };
338
+ depType: Uint8Array;
352
339
  };
353
- depType: Uint8Array;
354
- };
355
- /**
356
- * Converts the CellDep instance to bytes.
357
- *
358
- * @returns A Uint8Array containing the cell dependency bytes.
359
- *
360
- * @example
361
- * ```typescript
362
- * const cellDepBytes = cellDep.toBytes();
363
- * ```
364
- */
365
- toBytes(): Bytes;
366
- /**
367
- * Creates a CellDep instance from a byte-like value or molecule CellDep.
368
- *
369
- * @param bytes - The byte-like value or molecule CellDep to convert.
370
- * @returns A CellDep instance.
371
- *
372
- * @example
373
- * ```typescript
374
- * const cellDep = CellDep.fromBytes(new Uint8Array([/* cell dep bytes *\/]));
375
- * ```
376
- */
377
- fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
340
+ /**
341
+ * Converts the CellDep instance to bytes.
342
+ *
343
+ * @returns A Uint8Array containing the cell dependency bytes.
344
+ *
345
+ * @example
346
+ * ```typescript
347
+ * const cellDepBytes = cellDep.toBytes();
348
+ * ```
349
+ */
350
+ toBytes(): Bytes;
351
+ /**
352
+ * Creates a CellDep instance from a byte-like value or molecule CellDep.
353
+ *
354
+ * @param bytes - The byte-like value or molecule CellDep to convert.
355
+ * @returns A CellDep instance.
356
+ *
357
+ * @example
358
+ * ```typescript
359
+ * const cellDep = CellDep.fromBytes(new Uint8Array([/* cell dep bytes *\/]));
360
+ * ```
361
+ */
362
+ fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
378
363
  }
379
364
  export type WitnessArgsLike = {
380
- lock?: HexLike;
381
- inputType?: HexLike;
382
- outputType?: HexLike;
365
+ lock?: HexLike;
366
+ inputType?: HexLike;
367
+ outputType?: HexLike;
383
368
  };
384
369
  export declare class WitnessArgs {
385
- lock?: `0x${string}` | undefined;
386
- inputType?: `0x${string}` | undefined;
387
- outputType?: `0x${string}` | undefined;
388
- /**
389
- * Creates an instance of WitnessArgs.
390
- *
391
- * @param lock - The optional lock field of the witness.
392
- * @param inputType - The optional input type field of the witness.
393
- * @param outputType - The optional output type field of the witness.
394
- */
395
- constructor(
396
- lock?: `0x${string}` | undefined,
397
- inputType?: `0x${string}` | undefined,
398
- outputType?: `0x${string}` | undefined,
399
- );
400
- /**
401
- * Creates a WitnessArgs instance from a WitnessArgsLike object.
402
- *
403
- * @param witnessArgs - A WitnessArgsLike object or an instance of WitnessArgs.
404
- * @returns A WitnessArgs instance.
405
- *
406
- * @example
407
- * ```typescript
408
- * const witnessArgs = WitnessArgs.from({
409
- * lock: "0x...",
410
- * inputType: "0x...",
411
- * outputType: "0x..."
412
- * });
413
- * ```
414
- */
415
- static from(witnessArgs: WitnessArgsLike): WitnessArgs;
416
- /**
417
- * Converts the WitnessArgs instance to molecule data format.
418
- *
419
- * @returns An object representing the witness arguments in molecule data format.
420
- */
421
- _toMolData(): {
422
- lock: Uint8Array | undefined;
423
- inputType: Uint8Array | undefined;
424
- outputType: Uint8Array | undefined;
425
- };
426
- /**
427
- * Converts the WitnessArgs instance to bytes.
428
- *
429
- * @returns A Uint8Array containing the witness arguments bytes.
430
- *
431
- * @example
432
- * ```typescript
433
- * const witnessArgsBytes = witnessArgs.toBytes();
434
- * ```
435
- */
436
- toBytes(): Bytes;
437
- /**
438
- * Creates a WitnessArgs instance from a byte-like value or molecule WitnessArgs.
439
- *
440
- * @param bytes - The byte-like value or molecule WitnessArgs to convert.
441
- * @returns A WitnessArgs instance.
442
- *
443
- * @example
444
- * ```typescript
445
- * const witnessArgs = WitnessArgs.fromBytes(new Uint8Array([/* witness args bytes *\/]));
446
- * ```
447
- */
448
- static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
370
+ lock?: `0x${string}` | undefined;
371
+ inputType?: `0x${string}` | undefined;
372
+ outputType?: `0x${string}` | undefined;
373
+ /**
374
+ * Creates an instance of WitnessArgs.
375
+ *
376
+ * @param lock - The optional lock field of the witness.
377
+ * @param inputType - The optional input type field of the witness.
378
+ * @param outputType - The optional output type field of the witness.
379
+ */
380
+ constructor(lock?: `0x${string}` | undefined, inputType?: `0x${string}` | undefined, outputType?: `0x${string}` | undefined);
381
+ /**
382
+ * Creates a WitnessArgs instance from a WitnessArgsLike object.
383
+ *
384
+ * @param witnessArgs - A WitnessArgsLike object or an instance of WitnessArgs.
385
+ * @returns A WitnessArgs instance.
386
+ *
387
+ * @example
388
+ * ```typescript
389
+ * const witnessArgs = WitnessArgs.from({
390
+ * lock: "0x...",
391
+ * inputType: "0x...",
392
+ * outputType: "0x..."
393
+ * });
394
+ * ```
395
+ */
396
+ static from(witnessArgs: WitnessArgsLike): WitnessArgs;
397
+ /**
398
+ * Converts the WitnessArgs instance to molecule data format.
399
+ *
400
+ * @returns An object representing the witness arguments in molecule data format.
401
+ */
402
+ _toMolData(): {
403
+ lock: Uint8Array | undefined;
404
+ inputType: Uint8Array | undefined;
405
+ outputType: Uint8Array | undefined;
406
+ };
407
+ /**
408
+ * Converts the WitnessArgs instance to bytes.
409
+ *
410
+ * @returns A Uint8Array containing the witness arguments bytes.
411
+ *
412
+ * @example
413
+ * ```typescript
414
+ * const witnessArgsBytes = witnessArgs.toBytes();
415
+ * ```
416
+ */
417
+ toBytes(): Bytes;
418
+ /**
419
+ * Creates a WitnessArgs instance from a byte-like value or molecule WitnessArgs.
420
+ *
421
+ * @param bytes - The byte-like value or molecule WitnessArgs to convert.
422
+ * @returns A WitnessArgs instance.
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const witnessArgs = WitnessArgs.fromBytes(new Uint8Array([/* witness args bytes *\/]));
427
+ * ```
428
+ */
429
+ static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
449
430
  }
450
431
  export type TransactionLike = {
451
- version: NumLike;
452
- cellDeps: CellDepLike[];
453
- headerDeps: HexLike[];
454
- inputs: CellInputLike[];
455
- outputs: CellOutputLike[];
456
- outputsData: HexLike[];
457
- witnesses: HexLike[];
432
+ version: NumLike;
433
+ cellDeps: CellDepLike[];
434
+ headerDeps: HexLike[];
435
+ inputs: CellInputLike[];
436
+ outputs: CellOutputLike[];
437
+ outputsData: HexLike[];
438
+ witnesses: HexLike[];
458
439
  };
459
440
  export declare class Transaction {
460
- version: Num;
461
- cellDeps: CellDep[];
462
- headerDeps: Hex[];
463
- inputs: CellInput[];
464
- outputs: CellOutput[];
465
- outputsData: Hex[];
466
- witnesses: Hex[];
467
- /**
468
- * Creates an instance of Transaction.
469
- *
470
- * @param version - The version of the transaction.
471
- * @param cellDeps - The cell dependencies of the transaction.
472
- * @param headerDeps - The header dependencies of the transaction.
473
- * @param inputs - The inputs of the transaction.
474
- * @param outputs - The outputs of the transaction.
475
- * @param outputsData - The data associated with the outputs.
476
- * @param witnesses - The witnesses of the transaction.
477
- */
478
- constructor(
479
- version: Num,
480
- cellDeps: CellDep[],
481
- headerDeps: Hex[],
482
- inputs: CellInput[],
483
- outputs: CellOutput[],
484
- outputsData: Hex[],
485
- witnesses: Hex[],
486
- );
487
- /**
488
- * Creates a default Transaction instance with empty fields.
489
- *
490
- * @returns A default Transaction instance.
491
- *
492
- * @example
493
- * ```typescript
494
- * const defaultTx = Transaction.default();
495
- * ```
496
- */
497
- static default(): Transaction;
498
- /**
499
- * Creates a Transaction instance from a TransactionLike object.
500
- *
501
- * @param tx - A TransactionLike object or an instance of Transaction.
502
- * @returns A Transaction instance.
503
- *
504
- * @example
505
- * ```typescript
506
- * const transaction = Transaction.from({
507
- * version: 0,
508
- * cellDeps: [],
509
- * headerDeps: [],
510
- * inputs: [],
511
- * outputs: [],
512
- * outputsData: [],
513
- * witnesses: []
514
- * });
515
- * ```
516
- */
517
- static from(tx: TransactionLike): Transaction;
518
- /**
519
- * Creates a Transaction instance from a Lumos skeleton.
520
- *
521
- * @param skeleton - The Lumos transaction skeleton.
522
- * @returns A Transaction instance.
523
- *
524
- * @throws Will throw an error if an input's outPoint is missing.
525
- *
526
- * @example
527
- * ```typescript
528
- * const transaction = Transaction.fromLumosSkeleton(skeleton);
529
- * ```
530
- */
531
- static fromLumosSkeleton(skeleton: TransactionSkeletonType): Transaction;
532
- stringify(): string;
533
- /**
534
- * Converts the raw transaction data to bytes.
535
- *
536
- * @returns A Uint8Array containing the raw transaction bytes.
537
- *
538
- * @example
539
- * ```typescript
540
- * const rawTxBytes = transaction.rawToBytes();
541
- * ```
542
- */
543
- rawToBytes(): Bytes;
544
- /**
545
- * Calculates the hash of the transaction.
546
- *
547
- * @returns The hash of the transaction.
548
- *
549
- * @example
550
- * ```typescript
551
- * const txHash = transaction.hash();
552
- * ```
553
- */
554
- hash(): `0x${string}`;
555
- /**
556
- * Hashes a witness and updates the hasher.
557
- *
558
- * @param witness - The witness to hash.
559
- * @param hasher - The hasher instance to update.
560
- *
561
- * @example
562
- * ```typescript
563
- * Transaction.hashWitnessToHasher("0x...", hasher);
564
- * ```
565
- */
566
- static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
567
- /**
568
- * Computes the signing hash information for a given script.
569
- *
570
- * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
571
- * @param client - The client for complete extra infos in the transaction.
572
- * @returns A promise that resolves to an object containing the signing message and the witness position,
573
- * or undefined if no matching input is found.
574
- *
575
- * @example
576
- * ```typescript
577
- * const signHashInfo = await tx.getSignHashInfo(scriptLike, client);
578
- * if (signHashInfo) {
579
- * console.log(signHashInfo.message); // Outputs the signing message
580
- * console.log(signHashInfo.position); // Outputs the witness position
581
- * }
582
- * ```
583
- */
584
- getSignHashInfo(
585
- scriptLike: ScriptLike,
586
- client: Client,
587
- ): Promise<
588
- | {
441
+ version: Num;
442
+ cellDeps: CellDep[];
443
+ headerDeps: Hex[];
444
+ inputs: CellInput[];
445
+ outputs: CellOutput[];
446
+ outputsData: Hex[];
447
+ witnesses: Hex[];
448
+ /**
449
+ * Creates an instance of Transaction.
450
+ *
451
+ * @param version - The version of the transaction.
452
+ * @param cellDeps - The cell dependencies of the transaction.
453
+ * @param headerDeps - The header dependencies of the transaction.
454
+ * @param inputs - The inputs of the transaction.
455
+ * @param outputs - The outputs of the transaction.
456
+ * @param outputsData - The data associated with the outputs.
457
+ * @param witnesses - The witnesses of the transaction.
458
+ */
459
+ constructor(version: Num, cellDeps: CellDep[], headerDeps: Hex[], inputs: CellInput[], outputs: CellOutput[], outputsData: Hex[], witnesses: Hex[]);
460
+ /**
461
+ * Creates a default Transaction instance with empty fields.
462
+ *
463
+ * @returns A default Transaction instance.
464
+ *
465
+ * @example
466
+ * ```typescript
467
+ * const defaultTx = Transaction.default();
468
+ * ```
469
+ */
470
+ static default(): Transaction;
471
+ /**
472
+ * Creates a Transaction instance from a TransactionLike object.
473
+ *
474
+ * @param tx - A TransactionLike object or an instance of Transaction.
475
+ * @returns A Transaction instance.
476
+ *
477
+ * @example
478
+ * ```typescript
479
+ * const transaction = Transaction.from({
480
+ * version: 0,
481
+ * cellDeps: [],
482
+ * headerDeps: [],
483
+ * inputs: [],
484
+ * outputs: [],
485
+ * outputsData: [],
486
+ * witnesses: []
487
+ * });
488
+ * ```
489
+ */
490
+ static from(tx: TransactionLike): Transaction;
491
+ /**
492
+ * Creates a Transaction instance from a Lumos skeleton.
493
+ *
494
+ * @param skeleton - The Lumos transaction skeleton.
495
+ * @returns A Transaction instance.
496
+ *
497
+ * @throws Will throw an error if an input's outPoint is missing.
498
+ *
499
+ * @example
500
+ * ```typescript
501
+ * const transaction = Transaction.fromLumosSkeleton(skeleton);
502
+ * ```
503
+ */
504
+ static fromLumosSkeleton(skeleton: TransactionSkeletonType): Transaction;
505
+ stringify(): string;
506
+ /**
507
+ * Converts the raw transaction data to bytes.
508
+ *
509
+ * @returns A Uint8Array containing the raw transaction bytes.
510
+ *
511
+ * @example
512
+ * ```typescript
513
+ * const rawTxBytes = transaction.rawToBytes();
514
+ * ```
515
+ */
516
+ rawToBytes(): Bytes;
517
+ /**
518
+ * Calculates the hash of the transaction.
519
+ *
520
+ * @returns The hash of the transaction.
521
+ *
522
+ * @example
523
+ * ```typescript
524
+ * const txHash = transaction.hash();
525
+ * ```
526
+ */
527
+ hash(): `0x${string}`;
528
+ /**
529
+ * Hashes a witness and updates the hasher.
530
+ *
531
+ * @param witness - The witness to hash.
532
+ * @param hasher - The hasher instance to update.
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * Transaction.hashWitnessToHasher("0x...", hasher);
537
+ * ```
538
+ */
539
+ static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
540
+ /**
541
+ * Computes the signing hash information for a given script.
542
+ *
543
+ * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
544
+ * @param client - The client for complete extra infos in the transaction.
545
+ * @returns A promise that resolves to an object containing the signing message and the witness position,
546
+ * or undefined if no matching input is found.
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * const signHashInfo = await tx.getSignHashInfo(scriptLike, client);
551
+ * if (signHashInfo) {
552
+ * console.log(signHashInfo.message); // Outputs the signing message
553
+ * console.log(signHashInfo.position); // Outputs the witness position
554
+ * }
555
+ * ```
556
+ */
557
+ getSignHashInfo(scriptLike: ScriptLike, client: Client): Promise<{
589
558
  message: Hex;
590
559
  position: number;
591
- }
592
- | undefined
593
- >;
594
- /**
595
- * Find the first occurrence of a input with the specified lock
596
- *
597
- * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
598
- * @param client - The client for complete extra infos in the transaction.
599
- * @returns A promise that resolves to the prepared transaction
600
- *
601
- * @example
602
- * ```typescript
603
- * const index = await tx.findInputIndexByLock(scriptLike, client);
604
- * ```
605
- */
606
- findInputIndexByLock(
607
- scriptLike: ScriptLike,
608
- client: Client,
609
- ): Promise<number | undefined>;
610
- /**
611
- * Get witness at index as WitnessArgs
612
- *
613
- * @param index - The index of the witness.
614
- * @returns The witness parsed as WitnessArgs.
615
- *
616
- * @example
617
- * ```typescript
618
- * const witnessArgs = await tx.getWitnessArgsAt(0);
619
- * ```
620
- */
621
- getWitnessArgsAt(index: number): WitnessArgs | undefined;
622
- /**
623
- * Set witness at index by WitnessArgs
624
- *
625
- * @param index - The index of the witness.
626
- * @param witness - The WitnessArgs to set.
627
- * @returns The transaction itself.
628
- *
629
- * @example
630
- * ```typescript
631
- * await tx.setWitnessArgsAt(0, witnessArgs);
632
- * ```
633
- */
634
- setWitnessArgsAt(index: number, witness: WitnessArgs): void;
635
- /**
636
- * Prepare dummy witness for sighash all method
637
- *
638
- * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
639
- * @param lockLen - The length of dummy lock bytes.
640
- * @param client - The client for complete extra infos in the transaction.
641
- * @returns A promise that resolves to the prepared transaction
642
- *
643
- * @example
644
- * ```typescript
645
- * await tx.prepareSighashAllWitness(scriptLike, 85, client);
646
- * ```
647
- */
648
- prepareSighashAllWitness(
649
- scriptLike: ScriptLike,
650
- lockLen: number,
651
- client: Client,
652
- ): Promise<void>;
560
+ } | undefined>;
561
+ /**
562
+ * Find the first occurrence of a input with the specified lock
563
+ *
564
+ * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
565
+ * @param client - The client for complete extra infos in the transaction.
566
+ * @returns A promise that resolves to the prepared transaction
567
+ *
568
+ * @example
569
+ * ```typescript
570
+ * const index = await tx.findInputIndexByLock(scriptLike, client);
571
+ * ```
572
+ */
573
+ findInputIndexByLock(scriptLike: ScriptLike, client: Client): Promise<number | undefined>;
574
+ /**
575
+ * Get witness at index as WitnessArgs
576
+ *
577
+ * @param index - The index of the witness.
578
+ * @returns The witness parsed as WitnessArgs.
579
+ *
580
+ * @example
581
+ * ```typescript
582
+ * const witnessArgs = await tx.getWitnessArgsAt(0);
583
+ * ```
584
+ */
585
+ getWitnessArgsAt(index: number): WitnessArgs | undefined;
586
+ /**
587
+ * Set witness at index by WitnessArgs
588
+ *
589
+ * @param index - The index of the witness.
590
+ * @param witness - The WitnessArgs to set.
591
+ * @returns The transaction itself.
592
+ *
593
+ * @example
594
+ * ```typescript
595
+ * await tx.setWitnessArgsAt(0, witnessArgs);
596
+ * ```
597
+ */
598
+ setWitnessArgsAt(index: number, witness: WitnessArgs): void;
599
+ /**
600
+ * Prepare dummy witness for sighash all method
601
+ *
602
+ * @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
603
+ * @param lockLen - The length of dummy lock bytes.
604
+ * @param client - The client for complete extra infos in the transaction.
605
+ * @returns A promise that resolves to the prepared transaction
606
+ *
607
+ * @example
608
+ * ```typescript
609
+ * await tx.prepareSighashAllWitness(scriptLike, 85, client);
610
+ * ```
611
+ */
612
+ prepareSighashAllWitness(scriptLike: ScriptLike, lockLen: number, client: Client): Promise<void>;
653
613
  }
654
- //# sourceMappingURL=transaction.d.ts.map
614
+ //# sourceMappingURL=transaction.d.ts.map