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

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