@opcat-labs/opcat 1.0.1 → 1.0.3

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 (293) hide show
  1. package/.cjs2esm.json +18 -0
  2. package/.mocharc.yaml +1 -1
  3. package/CHANGELOG.md +12 -0
  4. package/README.md +6 -0
  5. package/{lib/address.js → cjs/address.cjs} +77 -72
  6. package/cjs/block/block.cjs +332 -0
  7. package/{lib/block/blockheader.js → cjs/block/blockheader.cjs} +8 -7
  8. package/cjs/block/index.cjs +2 -0
  9. package/{lib/block/merkleblock.js → cjs/block/merkleblock.cjs} +23 -15
  10. package/cjs/bn.cjs +3411 -0
  11. package/{lib/crypto/bn.js → cjs/crypto/bn.cjs} +3 -3
  12. package/{lib/crypto/ecdsa.js → cjs/crypto/ecdsa.cjs} +150 -14
  13. package/{lib/crypto/hash.node.js → cjs/crypto/hash.cjs} +13 -2
  14. package/cjs/crypto/index.cjs +16 -0
  15. package/{lib/crypto/point.js → cjs/crypto/point.cjs} +11 -4
  16. package/cjs/crypto/random.cjs +18 -0
  17. package/{lib/crypto/signature.js → cjs/crypto/signature.cjs} +158 -8
  18. package/{lib/encoding/base58.js → cjs/encoding/base58.cjs} +58 -2
  19. package/cjs/encoding/base58check.cjs +192 -0
  20. package/cjs/encoding/bufferreader.cjs +333 -0
  21. package/cjs/encoding/bufferwriter.cjs +244 -0
  22. package/{lib/encoding/decode-asm.js → cjs/encoding/decode-asm.cjs} +4 -4
  23. package/{lib/encoding/decode-hex.js → cjs/encoding/decode-hex.cjs} +1 -1
  24. package/cjs/encoding/index.cjs +14 -0
  25. package/cjs/encoding/varint.cjs +116 -0
  26. package/{lib/errors/index.js → cjs/errors/index.cjs} +9 -9
  27. package/{lib/errors/spec.js → cjs/errors/spec.cjs} +2 -2
  28. package/cjs/hash-cache.cjs +98 -0
  29. package/{lib/hdprivatekey.js → cjs/hdprivatekey.cjs} +232 -140
  30. package/{lib/hdpublickey.js → cjs/hdpublickey.cjs} +120 -93
  31. package/cjs/index.cjs +94 -0
  32. package/cjs/interpreter/index.cjs +2 -0
  33. package/cjs/interpreter/interpreter.cjs +1988 -0
  34. package/{lib/script/stack.js → cjs/interpreter/stack.cjs} +9 -2
  35. package/{lib/message/message.js → cjs/message/message.cjs} +62 -25
  36. package/cjs/mnemonic/index.cjs +3 -0
  37. package/{lib/mnemonic/mnemonic.js → cjs/mnemonic/mnemonic.cjs} +44 -13
  38. package/{lib/mnemonic/pbkdf2.node.js → cjs/mnemonic/pbkdf2.cjs} +9 -2
  39. package/cjs/mnemonic/words/index.cjs +66 -0
  40. package/cjs/network.cjs +13 -0
  41. package/cjs/networks.cjs +321 -0
  42. package/{lib/opcode.js → cjs/opcode.cjs} +69 -5
  43. package/cjs/privatekey.cjs +422 -0
  44. package/{lib/publickey.js → cjs/publickey.cjs} +14 -16
  45. package/cjs/script/index.cjs +2 -0
  46. package/{lib/script/script.js → cjs/script/script.cjs} +322 -67
  47. package/cjs/transaction/index.cjs +5 -0
  48. package/cjs/transaction/input/index.cjs +34 -0
  49. package/cjs/transaction/input/input.cjs +396 -0
  50. package/{lib/transaction/input/multisig.js → cjs/transaction/input/multisig.cjs} +112 -18
  51. package/{lib/transaction/input/publickey.js → cjs/transaction/input/publickey.cjs} +29 -19
  52. package/{lib/transaction/input/publickeyhash.js → cjs/transaction/input/publickeyhash.cjs} +25 -17
  53. package/{lib/transaction/output.js → cjs/transaction/output.cjs} +100 -15
  54. package/cjs/transaction/sighash.cjs +187 -0
  55. package/{lib/transaction/signature.js → cjs/transaction/signature.cjs} +30 -6
  56. package/cjs/transaction/transaction.cjs +2000 -0
  57. package/{lib/transaction/unspentoutput.js → cjs/transaction/unspentoutput.cjs} +5 -5
  58. package/cjs/util/derivation.cjs +53 -0
  59. package/cjs/util/index.cjs +11 -0
  60. package/cjs/util/js.cjs +95 -0
  61. package/{lib/util/preconditions.js → cjs/util/preconditions.cjs} +2 -2
  62. package/esm/address.js +483 -0
  63. package/{lib → esm}/block/block.js +82 -27
  64. package/esm/block/blockheader.js +296 -0
  65. package/esm/block/index.js +2 -0
  66. package/esm/block/merkleblock.js +331 -0
  67. package/esm/bn.js +3411 -0
  68. package/esm/crypto/bn.js +278 -0
  69. package/esm/crypto/ecdsa.js +475 -0
  70. package/{lib/crypto/hash.browser.js → esm/crypto/hash.js} +18 -7
  71. package/esm/crypto/index.js +16 -0
  72. package/esm/crypto/point.js +228 -0
  73. package/esm/crypto/random.js +18 -0
  74. package/esm/crypto/signature.js +475 -0
  75. package/esm/encoding/base58.js +167 -0
  76. package/esm/encoding/base58check.js +192 -0
  77. package/esm/encoding/bufferreader.js +333 -0
  78. package/esm/encoding/bufferwriter.js +243 -0
  79. package/esm/encoding/decode-asm.js +24 -0
  80. package/esm/encoding/decode-hex.js +32 -0
  81. package/esm/encoding/decode-script-chunks.js +43 -0
  82. package/esm/encoding/encode-hex.js +284 -0
  83. package/esm/encoding/index.js +14 -0
  84. package/esm/encoding/is-hex.js +7 -0
  85. package/esm/encoding/varint.js +116 -0
  86. package/esm/errors/index.js +54 -0
  87. package/esm/errors/spec.js +314 -0
  88. package/esm/hash-cache.js +98 -0
  89. package/esm/hdprivatekey.js +768 -0
  90. package/esm/hdpublickey.js +549 -0
  91. package/esm/index.js +66 -0
  92. package/esm/interpreter/index.js +2 -0
  93. package/{lib/script → esm/interpreter}/interpreter.js +219 -66
  94. package/esm/interpreter/stack.js +116 -0
  95. package/esm/message/message.js +228 -0
  96. package/esm/mnemonic/index.js +3 -0
  97. package/esm/mnemonic/mnemonic.js +332 -0
  98. package/{lib/mnemonic/pbkdf2.browser.js → esm/mnemonic/pbkdf2.js} +13 -6
  99. package/esm/mnemonic/words/chinese.js +2054 -0
  100. package/esm/mnemonic/words/english.js +2054 -0
  101. package/esm/mnemonic/words/french.js +2054 -0
  102. package/esm/mnemonic/words/index.js +66 -0
  103. package/esm/mnemonic/words/italian.js +2054 -0
  104. package/esm/mnemonic/words/japanese.js +2054 -0
  105. package/esm/mnemonic/words/spanish.js +2054 -0
  106. package/esm/network.js +13 -0
  107. package/{lib → esm}/networks.js +61 -120
  108. package/esm/opcode.js +319 -0
  109. package/{lib → esm}/privatekey.js +76 -28
  110. package/esm/publickey.js +384 -0
  111. package/esm/script/index.js +2 -0
  112. package/esm/script/script.js +1329 -0
  113. package/esm/script/write-i32-le.js +17 -0
  114. package/esm/script/write-push-data.js +35 -0
  115. package/esm/script/write-u16-le.js +12 -0
  116. package/esm/script/write-u32-le.js +16 -0
  117. package/esm/script/write-u64-le.js +24 -0
  118. package/esm/script/write-u8-le.js +8 -0
  119. package/esm/script/write-varint.js +46 -0
  120. package/esm/transaction/index.js +5 -0
  121. package/esm/transaction/input/index.js +33 -0
  122. package/{lib → esm}/transaction/input/input.js +132 -90
  123. package/esm/transaction/input/multisig.js +335 -0
  124. package/esm/transaction/input/publickey.js +108 -0
  125. package/esm/transaction/input/publickeyhash.js +124 -0
  126. package/esm/transaction/output.js +316 -0
  127. package/{lib → esm}/transaction/sighash.js +42 -22
  128. package/esm/transaction/signature.js +120 -0
  129. package/{lib → esm}/transaction/transaction.js +522 -163
  130. package/esm/transaction/unspentoutput.js +112 -0
  131. package/esm/util/_.js +47 -0
  132. package/esm/util/derivation.js +53 -0
  133. package/esm/util/index.js +12 -0
  134. package/esm/util/js.js +95 -0
  135. package/esm/util/preconditions.js +33 -0
  136. package/fixup.cjs +17 -0
  137. package/package.json +18 -4
  138. package/test/{address.js → address.cjs} +14 -43
  139. package/test/block/{block.js → block.cjs} +3 -5
  140. package/test/block/{blockheader.js → blockheader.cjs} +2 -2
  141. package/test/block/{merklebloack.js → merklebloack.cjs} +2 -2
  142. package/test/crypto/{ecdsa.js → ecdsa.cjs} +9 -9
  143. package/test/crypto/{hash.browser.js → hash.browser.cjs} +2 -1
  144. package/test/crypto/{signature.js → signature.cjs} +2 -2
  145. package/test/data/bitcoind/script_tests.json +5 -5
  146. package/test/{hashCache.js → hashCache.cjs} +2 -1
  147. package/test/{hdkeys.js → hdkeys.cjs} +4 -2
  148. package/test/{hdprivatekey.js → hdprivatekey.cjs} +7 -6
  149. package/test/{hdpublickey.js → hdpublickey.cjs} +2 -7
  150. package/test/mnemonic/{pbkdf2.test.js → pbkdf2.test.cjs} +2 -2
  151. package/test/{networks.js → networks.cjs} +12 -31
  152. package/test/{publickey.js → publickey.cjs} +2 -2
  153. package/test/script/{interpreter.js → interpreter.cjs} +5 -5
  154. package/test/script/{script.js → script.cjs} +8 -2
  155. package/test/transaction/{deserialize.js → deserialize.cjs} +2 -2
  156. package/test/transaction/input/{input.js → input.cjs} +1 -1
  157. package/test/transaction/input/{multisig.js → multisig.cjs} +2 -1
  158. package/test/transaction/input/{publickeyhash.js → publickeyhash.cjs} +1 -1
  159. package/test/transaction/{sighash.js → sighash.cjs} +1 -1
  160. package/test/transaction/{transaction.js → transaction.cjs} +2 -2
  161. package/tsconfig.json +13 -0
  162. package/types/address.d.cts +252 -0
  163. package/types/block/block.d.cts +139 -0
  164. package/types/block/blockheader.d.cts +125 -0
  165. package/types/block/index.d.cts +2 -0
  166. package/types/block/merkleblock.d.cts +95 -0
  167. package/types/bn.d.cts +202 -0
  168. package/types/crypto/bn.d.cts +2 -0
  169. package/types/crypto/ecdsa.d.cts +187 -0
  170. package/types/crypto/hash.d.cts +118 -0
  171. package/types/crypto/index.d.cts +7 -0
  172. package/types/crypto/point.d.cts +134 -0
  173. package/types/crypto/random.d.cts +13 -0
  174. package/types/crypto/signature.d.cts +160 -0
  175. package/types/encoding/base58.d.cts +106 -0
  176. package/types/encoding/base58check.d.cts +107 -0
  177. package/types/encoding/bufferreader.d.cts +164 -0
  178. package/types/encoding/bufferwriter.d.cts +126 -0
  179. package/types/encoding/decode-asm.d.cts +2 -0
  180. package/types/encoding/decode-hex.d.cts +2 -0
  181. package/types/encoding/decode-script-chunks.d.cts +14 -0
  182. package/types/encoding/encode-hex.d.cts +2 -0
  183. package/types/encoding/index.d.cts +6 -0
  184. package/types/encoding/is-hex.d.cts +2 -0
  185. package/types/encoding/varint.d.cts +66 -0
  186. package/types/errors/index.d.cts +4 -0
  187. package/types/errors/spec.d.cts +22 -0
  188. package/types/hash-cache.d.cts +65 -0
  189. package/types/hdprivatekey.d.cts +281 -0
  190. package/types/hdpublickey.d.cts +240 -0
  191. package/types/index.d.cts +26 -0
  192. package/types/interpreter/index.d.cts +2 -0
  193. package/types/interpreter/interpreter.d.cts +228 -0
  194. package/types/interpreter/stack.d.cts +35 -0
  195. package/types/message/message.d.cts +110 -0
  196. package/types/mnemonic/index.d.cts +2 -0
  197. package/types/mnemonic/mnemonic.d.cts +171 -0
  198. package/types/mnemonic/pbkdf2.d.cts +14 -0
  199. package/types/mnemonic/words/chinese.d.cts +2 -0
  200. package/types/mnemonic/words/english.d.cts +2 -0
  201. package/types/mnemonic/words/french.d.cts +2 -0
  202. package/types/mnemonic/words/index.d.cts +22 -0
  203. package/types/mnemonic/words/italian.d.cts +2 -0
  204. package/types/mnemonic/words/japanese.d.cts +2 -0
  205. package/types/mnemonic/words/spanish.d.cts +2 -0
  206. package/types/network.d.cts +11 -0
  207. package/types/networks.d.cts +76 -0
  208. package/types/opcode.d.cts +93 -0
  209. package/types/privatekey.d.cts +169 -0
  210. package/types/publickey.d.cts +202 -0
  211. package/types/script/index.d.cts +2 -0
  212. package/types/script/script.d.cts +449 -0
  213. package/types/script/write-i32-le.d.cts +2 -0
  214. package/types/script/write-push-data.d.cts +2 -0
  215. package/types/script/write-u16-le.d.cts +2 -0
  216. package/types/script/write-u32-le.d.cts +2 -0
  217. package/types/script/write-u64-le.d.cts +2 -0
  218. package/types/script/write-u8-le.d.cts +2 -0
  219. package/types/script/write-varint.d.cts +2 -0
  220. package/types/transaction/index.d.cts +2 -0
  221. package/types/transaction/input/index.d.cts +2 -0
  222. package/types/transaction/input/input.d.cts +178 -0
  223. package/types/transaction/input/multisig.d.cts +127 -0
  224. package/types/transaction/input/publickey.d.cts +44 -0
  225. package/types/transaction/input/publickeyhash.d.cts +45 -0
  226. package/types/transaction/output.d.cts +118 -0
  227. package/types/transaction/sighash.d.cts +61 -0
  228. package/types/transaction/signature.d.cts +43 -0
  229. package/types/transaction/transaction.d.cts +716 -0
  230. package/types/transaction/unspentoutput.d.cts +83 -0
  231. package/types/util/_.d.cts +26 -0
  232. package/types/util/derivation.d.cts +21 -0
  233. package/types/util/index.d.cts +5 -0
  234. package/types/util/js.d.cts +50 -0
  235. package/types/util/preconditions.d.cts +3 -0
  236. package/index.d.ts +0 -1541
  237. package/index.js +0 -74
  238. package/lib/block/index.js +0 -4
  239. package/lib/bn.js +0 -3423
  240. package/lib/crypto/hash.js +0 -2
  241. package/lib/crypto/random.browser.js +0 -28
  242. package/lib/crypto/random.js +0 -2
  243. package/lib/crypto/random.node.js +0 -11
  244. package/lib/encoding/base58check.js +0 -121
  245. package/lib/encoding/bufferreader.js +0 -212
  246. package/lib/encoding/bufferwriter.js +0 -140
  247. package/lib/encoding/varint.js +0 -75
  248. package/lib/hash-cache.js +0 -50
  249. package/lib/mnemonic/pbkdf2.js +0 -2
  250. package/lib/mnemonic/words/index.js +0 -8
  251. package/lib/script/index.js +0 -5
  252. package/lib/transaction/index.js +0 -7
  253. package/lib/transaction/input/index.js +0 -5
  254. package/lib/util/js.js +0 -90
  255. /package/{lib/encoding/decode-script-chunks.js → cjs/encoding/decode-script-chunks.cjs} +0 -0
  256. /package/{lib/encoding/encode-hex.js → cjs/encoding/encode-hex.cjs} +0 -0
  257. /package/{lib/encoding/is-hex.js → cjs/encoding/is-hex.cjs} +0 -0
  258. /package/{lib/mnemonic/words/chinese.js → cjs/mnemonic/words/chinese.cjs} +0 -0
  259. /package/{lib/mnemonic/words/english.js → cjs/mnemonic/words/english.cjs} +0 -0
  260. /package/{lib/mnemonic/words/french.js → cjs/mnemonic/words/french.cjs} +0 -0
  261. /package/{lib/mnemonic/words/italian.js → cjs/mnemonic/words/italian.cjs} +0 -0
  262. /package/{lib/mnemonic/words/japanese.js → cjs/mnemonic/words/japanese.cjs} +0 -0
  263. /package/{lib/mnemonic/words/spanish.js → cjs/mnemonic/words/spanish.cjs} +0 -0
  264. /package/{lib/script/write-i32-le.js → cjs/script/write-i32-le.cjs} +0 -0
  265. /package/{lib/script/write-push-data.js → cjs/script/write-push-data.cjs} +0 -0
  266. /package/{lib/script/write-u16-le.js → cjs/script/write-u16-le.cjs} +0 -0
  267. /package/{lib/script/write-u32-le.js → cjs/script/write-u32-le.cjs} +0 -0
  268. /package/{lib/script/write-u64-le.js → cjs/script/write-u64-le.cjs} +0 -0
  269. /package/{lib/script/write-u8-le.js → cjs/script/write-u8-le.cjs} +0 -0
  270. /package/{lib/script/write-varint.js → cjs/script/write-varint.cjs} +0 -0
  271. /package/{lib/util/_.js → cjs/util/_.cjs} +0 -0
  272. /package/test/crypto/{bn.js → bn.cjs} +0 -0
  273. /package/test/crypto/{hash.js → hash.cjs} +0 -0
  274. /package/test/crypto/{point.js → point.cjs} +0 -0
  275. /package/test/crypto/{random.js → random.cjs} +0 -0
  276. /package/test/data/{blk86756-testnet.js → blk86756-testnet.cjs} +0 -0
  277. /package/test/data/{merkleblocks.js → merkleblocks.cjs} +0 -0
  278. /package/test/encoding/{base58.js → base58.cjs} +0 -0
  279. /package/test/encoding/{base58check.js → base58check.cjs} +0 -0
  280. /package/test/encoding/{bufferreader.js → bufferreader.cjs} +0 -0
  281. /package/test/encoding/{bufferwriter.js → bufferwriter.cjs} +0 -0
  282. /package/test/encoding/{varint.js → varint.cjs} +0 -0
  283. /package/test/{index.js → index.cjs} +0 -0
  284. /package/test/message/{message.js → message.cjs} +0 -0
  285. /package/test/mnemonic/{mnemonic.js → mnemonic.cjs} +0 -0
  286. /package/test/{opcode.js → opcode.cjs} +0 -0
  287. /package/test/{privatekey.js → privatekey.cjs} +0 -0
  288. /package/test/transaction/input/{publickey.js → publickey.cjs} +0 -0
  289. /package/test/transaction/{output.js → output.cjs} +0 -0
  290. /package/test/transaction/{signature.js → signature.cjs} +0 -0
  291. /package/test/transaction/{unspentoutput.js → unspentoutput.cjs} +0 -0
  292. /package/test/util/{js.js → js.cjs} +0 -0
  293. /package/test/util/{preconditions.js → preconditions.cjs} +0 -0
@@ -0,0 +1,449 @@
1
+ export = Script;
2
+ /**
3
+ * A bitcoin transaction script. Each transaction's inputs and outputs
4
+ * has a script that is evaluated to validate it's spending.
5
+ *
6
+ * See https://en.bitcoin.it/wiki/Script
7
+ *
8
+ * @constructor
9
+ * @param {Object|string|Buffer} [from] optional data to populate script
10
+ */
11
+ declare function Script(from?: any | string | Buffer): Script;
12
+ declare class Script {
13
+ /**
14
+ * A bitcoin transaction script. Each transaction's inputs and outputs
15
+ * has a script that is evaluated to validate it's spending.
16
+ *
17
+ * See https://en.bitcoin.it/wiki/Script
18
+ *
19
+ * @constructor
20
+ * @param {Object|string|Buffer} [from] optional data to populate script
21
+ */
22
+ constructor(from?: any | string | Buffer);
23
+ buffer: Buffer;
24
+ /**
25
+ * Sets the script content from an object.
26
+ * @param {Object} obj - The source object containing either chunks array or buffer.
27
+ * @param {Array} [obj.chunks] - Optional array of chunks to create script from.
28
+ * @param {Buffer} [obj.buffer] - Optional buffer containing script data.
29
+ * @returns {Script} Returns the script instance for chaining.
30
+ * @throws Will throw if argument is invalid (not object or missing required buffer).
31
+ */
32
+ set(obj: {
33
+ chunks?: any[];
34
+ buffer?: Buffer;
35
+ }): Script;
36
+ /**
37
+ * Returns the underlying buffer of the script.
38
+ * @returns {Buffer} The script's buffer data.
39
+ */
40
+ toBuffer(): Buffer;
41
+ /**
42
+ * Gets a portion of the script's buffer as a new buffer.
43
+ * @param {number} [start] - The beginning index of the specified portion of the buffer.
44
+ * @param {number} [end] - The end index of the specified portion of the buffer.
45
+ * @returns {Buffer} A new Buffer that contains the specified portion of the original buffer.
46
+ */
47
+ slice(start?: number, end?: number): Buffer;
48
+ get chunks(): any;
49
+ get length(): number;
50
+ private _chunkToString;
51
+ /**
52
+ * Converts the script chunks to ASM (Assembly) format string representation.
53
+ * Iterates through each chunk and appends its ASM string representation.
54
+ * @returns {string} The ASM formatted string (excluding the first character).
55
+ */
56
+ toASM(): string;
57
+ /**
58
+ * Converts the script's chunks to a string representation.
59
+ * Iterates through each chunk and appends its string representation,
60
+ * then removes the leading character from the result.
61
+ * @returns {string} The concatenated string of all chunks.
62
+ */
63
+ toString(): string;
64
+ /**
65
+ * Converts the script's buffer to a hexadecimal string.
66
+ * @returns {string} Hex-encoded representation of the script buffer.
67
+ */
68
+ toHex(): string;
69
+ /**
70
+ * Custom inspect method for Script instances.
71
+ * @returns {string} String representation of the Script object in format '<Script: [content]>'.
72
+ */
73
+ inspect(): string;
74
+ /**
75
+ * Checks if the script is a standard public key hash output script (P2PKH).
76
+ * @returns {boolean} True if the script matches the P2PKH pattern:
77
+ * - OP_DUP
78
+ * - OP_HASH160
79
+ * - 20-byte hash
80
+ * - OP_EQUALVERIFY
81
+ * - OP_CHECKSIG
82
+ */
83
+ isPublicKeyHashOut(): boolean;
84
+ /**
85
+ * Checks if the script contains a valid public key hash.
86
+ * @returns {boolean} True if the script has exactly 2 chunks (signature and public key),
87
+ * the signature starts with 0x30, and the public key has a valid version
88
+ * and length (65 bytes for versions 0x04/0x06/0x07, 33 bytes for 0x02/0x03).
89
+ */
90
+ isPublicKeyHashIn(): boolean;
91
+ /**
92
+ * Gets the public key from a script output.
93
+ * @returns {Buffer} The public key buffer.
94
+ * @throws {Error} If the script is not a public key output.
95
+ */
96
+ getPublicKey(): Buffer;
97
+ /**
98
+ * Retrieves the PublicKeyHash from a script output.
99
+ * @returns {Buffer} The PublicKeyHash buffer.
100
+ * @throws {Error} If the script output is not a PublicKeyHash output.
101
+ */
102
+ getPublicKeyHash(): Buffer;
103
+ /**
104
+ * Checks if the script is a standard public key output script.
105
+ * @returns {boolean} True if the script matches the standard public key output format:
106
+ * - Contains exactly 2 chunks
107
+ * - First chunk is a valid public key buffer (65 bytes for uncompressed, 33 bytes for compressed)
108
+ * - Second chunk is OP_CHECKSIG opcode
109
+ */
110
+ isPublicKeyOut(): boolean;
111
+ /**
112
+ * Checks if the script contains a valid public key signature.
113
+ * @returns {boolean} True if the script has exactly one chunk that starts with 0x30 (DER signature marker), false otherwise.
114
+ */
115
+ isPublicKeyIn(): boolean;
116
+ /**
117
+ * Checks if the script is a multisig output script.
118
+ * @returns {boolean} True if the script matches the multisig output pattern:
119
+ * - Has more than 3 chunks
120
+ * - First chunk is a small integer opcode
121
+ * - Middle chunks are all buffers
122
+ * - Second-to-last chunk is a small integer opcode
123
+ * - Last chunk is OP_CHECKMULTISIG
124
+ */
125
+ isMultisigOut(): boolean;
126
+ /**
127
+ * Decodes a multisig output script into its components.
128
+ * @returns {Object} An object containing:
129
+ * - m {number} The required number of signatures (m-of-n)
130
+ * - n {number} The total number of public keys
131
+ * - pubkeys {Buffer[]} Array of public keys involved in the multisig
132
+ */
133
+ decodeMultisigOut(): any;
134
+ /**
135
+ * Checks if the script is a multisig input script.
136
+ * @returns {boolean} True if the script is a valid multisig input (starts with OP_0 and has valid DER signatures).
137
+ */
138
+ isMultisigIn(): boolean;
139
+ /**
140
+ * Checks if the script is a data-only output script (OP_RETURN followed by push-only data).
141
+ * @returns {boolean} True if the script is a valid data-only output, false otherwise.
142
+ */
143
+ isDataOut(): boolean;
144
+ /**
145
+ * Checks if the script is a safe data output script.
146
+ * A safe data output script must start with OP_FALSE followed by a valid data output script.
147
+ * @returns {boolean} True if the script is a safe data output, false otherwise.
148
+ */
149
+ isSafeDataOut(): boolean;
150
+ /**
151
+ * Retrieve the associated data for this script.
152
+ * In the case of a pay to public key hash, return the hash.
153
+ * In the case of safe OP_RETURN data, return an array of buffers
154
+ * In the case of a standard deprecated OP_RETURN, return the data
155
+ * @returns {Buffer}
156
+ */
157
+ getData(): Buffer;
158
+ /**
159
+ * Checks if the script consists only of push operations (OP_0 to OP_16) or data push operations (OP_PUSHDATA1/2/4).
160
+ * @returns {boolean} True if all chunks are push operations, false otherwise.
161
+ */
162
+ isPushOnly(): boolean;
163
+ /**
164
+ * @returns {object} The Script type if it is a known form,
165
+ * or Script.UNKNOWN if it isn't
166
+ */
167
+ classify(): object;
168
+ /**
169
+ * @returns {object} The Script type if it is a known form,
170
+ * or Script.UNKNOWN if it isn't
171
+ */
172
+ classifyOutput(): object;
173
+ /**
174
+ * @returns {object} The Script type if it is a known form,
175
+ * or Script.UNKNOWN if it isn't
176
+ */
177
+ classifyInput(): object;
178
+ /**
179
+ * @returns {boolean} if script is one of the known types
180
+ */
181
+ isStandard(): boolean;
182
+ /**
183
+ * Adds a script element at the start of the script.
184
+ * @param {*} obj a string, number, Opcode, Buffer, or object to add
185
+ * @returns {Script} this script instance
186
+ */
187
+ prepend(obj: any): Script;
188
+ /**
189
+ * Compares this script with another script for equality.
190
+ * @param {Script} script - The script to compare with.
191
+ * @returns {boolean} True if the scripts have identical buffer contents, false otherwise.
192
+ * @throws {Error} If the provided argument is not a Script instance.
193
+ */
194
+ equals(script: Script): boolean;
195
+ /**
196
+ * Adds a script element to the end of the script.
197
+ * @param {Object} obj - The object to add.
198
+ * @returns {Script} Returns the script instance for chaining.
199
+ */
200
+ add(obj: any): Script;
201
+ private _addByType;
202
+ private _insertAtPosition;
203
+ /**
204
+ * Adds an opcode to the script.
205
+ * @param {number|Opcode|string} opcode - The opcode to add (can be a number, Opcode instance, or string).
206
+ * @param {boolean} [prepend=false] - Whether to prepend the opcode (true) or append it (false).
207
+ * @returns {Script} Returns the script instance for chaining.
208
+ * @throws {errors.Script.InvalidOpcode} Throws if the opcode value exceeds 255.
209
+ */
210
+ _addOpcode(opcode: number | Opcode | string, prepend?: boolean): Script;
211
+ /**
212
+ * Adds a buffer to the script with appropriate opcode based on buffer length.
213
+ * Handles different buffer sizes by using corresponding pushdata opcodes.
214
+ * @param {Buffer} buf - The buffer to add to the script
215
+ * @param {boolean} [prepend] - Whether to prepend the buffer (default: append)
216
+ * @returns {Script} Returns the script instance for chaining
217
+ * @throws {Error} If buffer length exceeds maximum allowed size (2^32)
218
+ */
219
+ _addBuffer(buf: Buffer, prepend?: boolean): Script;
220
+ /**
221
+ * Creates a shallow copy of the Script instance.
222
+ * @returns {Script} A new Script instance with the same buffer content.
223
+ */
224
+ clone(): Script;
225
+ /**
226
+ * Removes all OP_CODESEPARATOR opcodes from the script chunks.
227
+ * Updates the script buffer with the filtered chunks and clears the cache.
228
+ * @returns {Script} The modified script instance for chaining.
229
+ */
230
+ removeCodeseparators(): Script;
231
+ /**
232
+ * If the script does not contain any OP_CODESEPARATOR, Return all scripts
233
+ * If the script contains any OP_CODESEPARATOR, the scriptCode is the script but removing everything up to and including the last executed OP_CODESEPARATOR before the signature checking opcode being executed
234
+ * @param {n} The {n}th codeseparator in the script
235
+ *
236
+ * @returns {Script} Subset of script starting at the {n}th codeseparator
237
+ */
238
+ subScript(n: any): Script;
239
+ /**
240
+ * Gets address information for the script.
241
+ * For input scripts, returns input address info.
242
+ * For output scripts, returns output address info.
243
+ * For general scripts, tries output address info first, falls back to input if not available.
244
+ * @returns {Object} Address information object
245
+ */
246
+ getAddressInfo(): any;
247
+ /**
248
+ * Gets the output address information from the script.
249
+ * @returns {Object|boolean} An object containing the hash buffer and address type if the script is a public key hash output, otherwise false.
250
+ * @property {Buffer} info.hashBuffer - The hash buffer of the address.
251
+ * @property {number} info.type - The type of the address (Address.PayToPublicKeyHash).
252
+ */
253
+ _getOutputAddressInfo(): any | boolean;
254
+ private _getInputAddressInfo;
255
+ /**
256
+ * Converts the script to an Address object for the specified network.
257
+ * @param {string|Network} [network] - optianal, the network name or identifier.
258
+ * @returns {Address} The derived Address object.
259
+ * @throws {errors.Script.CantDeriveAddress} If address information cannot be derived from the script.
260
+ */
261
+ toAddress(network?: string | Network): Address;
262
+ /**
263
+ * Finds and deletes a matching script chunk from the current script.
264
+ * Analogous to bitcoind's FindAndDelete. Find and delete equivalent chunks,
265
+ * typically used with push data chunks. Note that this will find and delete
266
+ * not just the same data, but the same data with the same push data op as
267
+ * produced by default. i.e., if a pushdata in a tx does not use the minimal
268
+ * pushdata op, then when you try to remove the data it is pushing, it will not
269
+ * be removed, because they do not use the same pushdata op.
270
+ * @param {Script} script - The script chunk to find and delete.
271
+ * @returns {Script} The modified script instance after deletion.
272
+ */
273
+ findAndDelete(script: Script): Script;
274
+ /**
275
+ * Checks if a script chunk uses the minimal push operation possible.
276
+ *
277
+ * @param {number} i - Index of the chunk to check
278
+ * @returns {boolean} True if the chunk uses minimal push operation, false otherwise
279
+ *
280
+ * The function verifies if the chunk could have been represented with:
281
+ * - OP_0 for empty buffer
282
+ * - OP_1 to OP_16 for single-byte values 1-16
283
+ * - OP_1NEGATE for 0x81
284
+ * - Direct push for buffers ≤75 bytes
285
+ * - OP_PUSHDATA1 for buffers ≤255 bytes
286
+ * - OP_PUSHDATA2 for buffers ≤65535 bytes
287
+ */
288
+ checkMinimalPush(i: number): boolean;
289
+ private _decodeOP_N;
290
+ /**
291
+ * Counts the number of signature operations in the script.
292
+ * @param {boolean} [accurate=true] - Whether to count accurately for OP_CHECKMULTISIG(VERIFY).
293
+ * @returns {number} The total count of signature operations.
294
+ */
295
+ getSignatureOperationsCount(accurate?: boolean): number;
296
+ }
297
+ declare namespace Script {
298
+ /**
299
+ * Creates a Script instance from a Buffer.
300
+ * @param {Buffer} buffer - The buffer containing the script data.
301
+ * @returns {Script} A new Script instance with the provided buffer.
302
+ * @throws {Error} Throws if the input is not a Buffer.
303
+ */
304
+ function fromBuffer(buffer: Buffer): Script;
305
+ /**
306
+ * Creates a Script instance from an array of opcode chunks.
307
+ * Handles different pushdata opcodes (OP_PUSHDATA1, OP_PUSHDATA2, OP_PUSHDATA4)
308
+ * by writing appropriate length prefixes before the buffer data.
309
+ * @param {Array} chunks - Array of opcode chunks containing opcodenum and optional buf/len
310
+ * @returns {Script} A new Script instance with compiled buffer
311
+ */
312
+ function fromChunks(chunks: any[]): Script;
313
+ /**
314
+ * Creates a Script instance from ASM (Assembly) formatted string.
315
+ * @param {string} str - ASM formatted string to decode
316
+ * @returns {Script} Script instance created from decoded ASM
317
+ */
318
+ function fromASM(str: string): Script;
319
+ /**
320
+ * Creates a Script instance from a hex string.
321
+ * @param {string} str - Hex string to convert to Script.
322
+ * @returns {Script} New Script instance created from the hex string.
323
+ */
324
+ function fromHex(str: string): Script;
325
+ /**
326
+ * Converts a string representation of a script into a Script object.
327
+ * Handles hex strings, empty strings, and space-separated opcode tokens.
328
+ * For pushdata operations (OP_PUSHDATA1/2/4), validates format and length.
329
+ * Throws errors for invalid script formats or data lengths.
330
+ * @param {string} str - The script string to parse (hex or opcode tokens)
331
+ * @returns {Script} The constructed Script object
332
+ * @throws {Error} When script format is invalid or data lengths don't match
333
+ */
334
+ function fromString(str: string): Script;
335
+ namespace types {
336
+ let UNKNOWN: string;
337
+ let PUBKEY_OUT: string;
338
+ let PUBKEY_IN: string;
339
+ let PUBKEYHASH_OUT: string;
340
+ let PUBKEYHASH_IN: string;
341
+ let SCRIPTHASH_OUT: string;
342
+ let SCRIPTHASH_IN: string;
343
+ let MULTISIG_OUT: string;
344
+ let MULTISIG_IN: string;
345
+ let DATA_OUT: string;
346
+ let SAFE_DATA_OUT: string;
347
+ }
348
+ namespace outputIdentifiers {
349
+ let PUBKEY_OUT_1: any;
350
+ export { PUBKEY_OUT_1 as PUBKEY_OUT };
351
+ let PUBKEYHASH_OUT_1: any;
352
+ export { PUBKEYHASH_OUT_1 as PUBKEYHASH_OUT };
353
+ let MULTISIG_OUT_1: any;
354
+ export { MULTISIG_OUT_1 as MULTISIG_OUT };
355
+ let DATA_OUT_1: any;
356
+ export { DATA_OUT_1 as DATA_OUT };
357
+ let SAFE_DATA_OUT_1: any;
358
+ export { SAFE_DATA_OUT_1 as SAFE_DATA_OUT };
359
+ }
360
+ namespace inputIdentifiers {
361
+ let PUBKEY_IN_1: any;
362
+ export { PUBKEY_IN_1 as PUBKEY_IN };
363
+ let PUBKEYHASH_IN_1: any;
364
+ export { PUBKEYHASH_IN_1 as PUBKEYHASH_IN };
365
+ let MULTISIG_IN_1: any;
366
+ export { MULTISIG_IN_1 as MULTISIG_IN };
367
+ }
368
+ /**
369
+ * Builds a multisig output script from given public keys and threshold.
370
+ * @param {Array} publicKeys - Array of public keys to include in the multisig
371
+ * @param {number} threshold - Minimum number of signatures required
372
+ * @param {Object} [opts] - Optional parameters
373
+ * @param {boolean} [opts.noSorting] - If true, skips sorting of public keys
374
+ * @returns {Script} The constructed multisig script
375
+ */
376
+ function buildMultisigOut(publicKeys: any[], threshold: number, opts?: {
377
+ noSorting?: boolean;
378
+ }): Script;
379
+ /**
380
+ * A new Multisig input script for the given public keys, requiring m of those public keys to spend
381
+ *
382
+ * @param {PublicKey[]} pubkeys list of all public keys controlling the output
383
+ * @param {number} threshold amount of required signatures to spend the output
384
+ * @param {Array} signatures and array of signature buffers to append to the script
385
+ * @param {Object=} opts
386
+ * @param {boolean=} opts.noSorting don't sort the given public keys before creating the script (false by default)
387
+ * @param {Script=} opts.cachedMultisig don't recalculate the redeemScript
388
+ *
389
+ * @returns {Script}
390
+ */
391
+ function buildMultisigIn(pubkeys: PublicKey[], threshold: number, signatures: any[], opts?: any): Script;
392
+ /**
393
+ * Builds a standard P2PKH (Pay-to-Public-Key-Hash) script for a given recipient.
394
+ * @param {PublicKey|Address|string} to - Recipient's public key, address, or address string
395
+ * @returns {Script} A P2PKH script with the format: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
396
+ * @throws {Error} If 'to' argument is undefined or invalid type
397
+ */
398
+ function buildPublicKeyHashOut(to: string | Address | PublicKey): Script;
399
+ /**
400
+ * Builds a standard P2PK (Pay-to-Public-Key) script output.
401
+ * @param {PublicKey} pubkey - The public key to create the script for
402
+ * @returns {Script} A new script containing the public key and OP_CHECKSIG opcode
403
+ */
404
+ function buildPublicKeyOut(pubkey: PublicKey): Script;
405
+ /**
406
+ * @returns {Script} a new OP_RETURN script with data
407
+ * @param {string|Buffer|Array} data - the data to embed in the output - it is a string, buffer, or array of strings or buffers
408
+ * @param {string} encoding - the type of encoding of the string(s)
409
+ */
410
+ function buildDataOut(data: string | any[] | Buffer, encoding: string): Script;
411
+ /**
412
+ * @returns {Script} a new OP_RETURN script with data
413
+ * @param {string|Buffer|Array} data - the data to embed in the output - it is a string, buffer, or array of strings or buffers
414
+ * @param {string} encoding - the type of encoding of the string(s)
415
+ */
416
+ function buildSafeDataOut(data: string | any[] | Buffer, encoding: string): Script;
417
+ /**
418
+ * Builds a scriptSig (a script for an input) that signs a public key output script.
419
+ *
420
+ * @param {Signature|Buffer} signature - a Signature object, or the signature in DER canonical encoding
421
+ * @param {number} [sigtype] - the type of the signature (defaults to SIGHASH_ALL)
422
+ */
423
+ function buildPublicKeyIn(signature: Buffer | Signature, sigtype?: number): Script;
424
+ /**
425
+ * Builds a scriptSig (a script for an input) that signs a public key hash
426
+ * output script.
427
+ *
428
+ * @param {Buffer|string|PublicKey} publicKey
429
+ * @param {Signature|Buffer} signature - a Signature object, or the signature in DER canonical encoding
430
+ * @param {number} [sigtype] - the type of the signature (defaults to SIGHASH_ALL)
431
+ */
432
+ function buildPublicKeyHashIn(publicKey: string | Buffer | PublicKey, signature: Buffer | Signature, sigtype?: number): Script;
433
+ /**
434
+ * Creates and returns an empty Script instance.
435
+ * @returns {Script} A new empty Script object.
436
+ */
437
+ function empty(): Script;
438
+ /**
439
+ * Creates a Script from an address.
440
+ * @param {Address|string} address - The address to convert to a script.
441
+ * @returns {Script} A Pay-to-PublicKeyHash (P2PKH) script for the given address.
442
+ * @throws {errors.Script.UnrecognizedAddress} If the address type is not supported.
443
+ */
444
+ function fromAddress(address: string | Address): Script;
445
+ }
446
+ import Opcode = require("../opcode.cjs");
447
+ import Address = require("../address.cjs");
448
+ import PublicKey = require("../publickey.cjs");
449
+ import Signature = require("../crypto/signature.cjs");
@@ -0,0 +1,2 @@
1
+ export = writeI32LE;
2
+ declare function writeI32LE(writer: any, n: any): any;
@@ -0,0 +1,2 @@
1
+ export = writePushData;
2
+ declare function writePushData(writer: any, buffer: any): any;
@@ -0,0 +1,2 @@
1
+ export = writeU16LE;
2
+ declare function writeU16LE(writer: any, n: any): any;
@@ -0,0 +1,2 @@
1
+ export = writeU32LE;
2
+ declare function writeU32LE(writer: any, n: any): any;
@@ -0,0 +1,2 @@
1
+ export = writeU64LE;
2
+ declare function writeU64LE(writer: any, n: any): any;
@@ -0,0 +1,2 @@
1
+ export = writeU8LE;
2
+ declare function writeU8LE(writer: any, n: any): any;
@@ -0,0 +1,2 @@
1
+ export = writeVarint;
2
+ declare function writeVarint(writer: any, n: any): any;
@@ -0,0 +1,2 @@
1
+ export = Transaction;
2
+ import Transaction = require("./transaction.cjs");
@@ -0,0 +1,2 @@
1
+ export = Input;
2
+ import Input = require("./input.cjs");
@@ -0,0 +1,178 @@
1
+ export = Input;
2
+ /**
3
+ * Creates an Input instance from parameters.
4
+ * @constructor
5
+ * @param {Object} params - Input parameters object
6
+ * @param {string|Buffer} params.prevTxId - Previous transaction ID (hex string or Buffer)
7
+ * @param {number} params.outputIndex - Output index in previous transaction
8
+ * @param {Output} [params.output] - Output instance or output parameters
9
+ * @param {number} [params.sequenceNumber] - Sequence number (defaults to DEFAULT_SEQNUMBER)
10
+ * @param {Script|Buffer|string} [params.script] - Script instance, buffer or hex string
11
+ * @returns {Input} New Input instance or initialized instance if params provided.
12
+ */
13
+ declare function Input(params: {
14
+ prevTxId: string | Buffer;
15
+ outputIndex: number;
16
+ output?: Output;
17
+ sequenceNumber?: number;
18
+ script?: Script | Buffer | string;
19
+ }): Input;
20
+ declare class Input {
21
+ /**
22
+ * Creates an Input instance from parameters.
23
+ * @constructor
24
+ * @param {Object} params - Input parameters object
25
+ * @param {string|Buffer} params.prevTxId - Previous transaction ID (hex string or Buffer)
26
+ * @param {number} params.outputIndex - Output index in previous transaction
27
+ * @param {Output} [params.output] - Output instance or output parameters
28
+ * @param {number} [params.sequenceNumber] - Sequence number (defaults to DEFAULT_SEQNUMBER)
29
+ * @param {Script|Buffer|string} [params.script] - Script instance, buffer or hex string
30
+ * @returns {Input} New Input instance or initialized instance if params provided.
31
+ */
32
+ constructor(params: {
33
+ prevTxId: string | Buffer;
34
+ outputIndex: number;
35
+ output?: Output;
36
+ sequenceNumber?: number;
37
+ script?: Script | Buffer | string;
38
+ });
39
+ get script(): any;
40
+ private _fromObject;
41
+ output: Output;
42
+ prevTxId: any;
43
+ outputIndex: any;
44
+ sequenceNumber: any;
45
+ /**
46
+ * Converts the Input instance to a plain object for JSON serialization.
47
+ * Includes prevTxId, outputIndex, sequenceNumber, and script as hex strings.
48
+ * Optionally adds human-readable scriptString if script is valid,
49
+ * and includes the output object if present.
50
+ * @returns {Object} A plain object representation of the Input.
51
+ */
52
+ toObject: () => any;
53
+ toJSON(): any;
54
+ /**
55
+ * Serializes the input to a BufferWriter.
56
+ * @param {boolean} hashScriptSig - Whether to hash the script (true) or include it directly (false).
57
+ * @param {BufferWriter} [writer] - Optional BufferWriter instance to write to.
58
+ * @returns {BufferWriter} The BufferWriter containing the serialized input.
59
+ */
60
+ toBufferWriter(hashScriptSig: boolean, writer?: BufferWriter): BufferWriter;
61
+ /**
62
+ * Converts the input to a prevout format (txid + output index) as a buffer.
63
+ * @returns {Buffer} The serialized prevout data.
64
+ */
65
+ toPrevout(): Buffer;
66
+ /**
67
+ * Sets the script for this input.
68
+ * @param {Script|string|Buffer|null} script - Can be a Script object, hex string, human-readable string, Buffer, or null (for empty script)
69
+ * @returns {Input} Returns the Input instance for chaining
70
+ * @throws {TypeError} If script is of invalid type
71
+ */
72
+ setScript(script: Script | string | Buffer | null): Input;
73
+ _script: Script;
74
+ _scriptBuffer: Buffer;
75
+ /**
76
+ * Retrieve signatures for the provided PrivateKey.
77
+ *
78
+ * @param {Transaction} transaction - the transaction to be signed
79
+ * @param {PrivateKey | Array} privateKeys - the private key to use when signing
80
+ * @param {number} inputIndex - the index of this input in the provided transaction
81
+ * @param {number} sigType - defaults to Signature.SIGHASH_ALL
82
+ */
83
+ getSignatures(transaction: Transaction, privateKeys: PrivateKey | any[], inputIndex: number, sigtype: any): TransactionSignature[];
84
+ /**
85
+ * Retrieve preimage for the Input.
86
+ *
87
+ * @param {Transaction} transaction - the transaction to be signed
88
+ * @param {number} inputIndex - the index of this input in the provided transaction
89
+ * @param {number} sigType - defaults to Signature.SIGHASH_ALL
90
+ * @param {boolean} isLowS - true if the sig hash is safe for low s.
91
+ */
92
+ getPreimage(transaction: Transaction, inputIndex: number, sigtype: any, isLowS: boolean): Buffer;
93
+ /**
94
+ * Abstract method that throws an error when invoked. Must be implemented by subclasses
95
+ * to determine if all required signatures are present on this input.
96
+ * @throws {AbstractMethodInvoked} Always throws to indicate abstract method usage
97
+ * @abstract
98
+ */
99
+ isFullySigned(): never;
100
+ /**
101
+ * Checks if the input is final (has maximum sequence number).
102
+ * @returns {boolean} True if the input is final, false otherwise.
103
+ */
104
+ isFinal(): boolean;
105
+ /**
106
+ * Abstract method to add a signature to the transaction input.
107
+ * Must be implemented by concrete input types.
108
+ * @param {Object} transaction - The transaction to sign
109
+ * @param {Object} signature - The signature to add
110
+ * @abstract
111
+ */
112
+ addSignature(_transaction: any, _signature: any): void;
113
+ /**
114
+ * Clears all signatures from the input.
115
+ * @abstract
116
+ */
117
+ clearSignatures(): void;
118
+ /**
119
+ * Verifies if a signature is valid for this input in the given transaction.
120
+ * Note: Temporarily modifies the signature object by setting nhashtype from sigtype.
121
+ *
122
+ * @param {Object} transaction - The transaction to verify against
123
+ * @param {TransactionSignature} signature - Signature object containing signature, publicKey, etc.
124
+ * @returns {boolean} True if the signature is valid, false otherwise
125
+ */
126
+ isValidSignature(transaction: any, signature: TransactionSignature): boolean;
127
+ /**
128
+ * @returns true if this is a coinbase input (represents no input)
129
+ */
130
+ isNull(): boolean;
131
+ private _estimateSize;
132
+ }
133
+ declare namespace Input {
134
+ export { MAXINT };
135
+ export { DEFAULT_SEQNUMBER };
136
+ export { DEFAULT_LOCKTIME_SEQNUMBER };
137
+ export { DEFAULT_RBF_SEQNUMBER };
138
+ export let BASE_SIZE: number;
139
+ /**
140
+ * Creates an Input instance from a plain JavaScript object.
141
+ * @param {Object} params - Input parameters object
142
+ * @param {string|Buffer} params.prevTxId - Previous transaction ID (hex string or Buffer)
143
+ * @param {number} params.outputIndex - Output index in previous transaction
144
+ * @param {Output} [params.output] - Output instance or output parameters
145
+ * @param {number} [params.sequenceNumber] - Sequence number (defaults to DEFAULT_SEQNUMBER)
146
+ * @param {Script|Buffer|string} [params.script] - Script instance, buffer or hex string
147
+ * @returns {Input} The created Input instance.
148
+ * @throws {Error} Will throw if the argument is not an object.
149
+ */
150
+ export function fromObject(params: {
151
+ prevTxId: string | Buffer;
152
+ outputIndex: number;
153
+ output?: Output;
154
+ sequenceNumber?: number;
155
+ script?: string | Buffer | Script;
156
+ }): Input;
157
+ /**
158
+ * Creates an Input instance from a BufferReader.
159
+ * @param {BufferReader} br - The buffer reader containing input data.
160
+ * @returns {Input} The parsed Input object with properties:
161
+ * - prevTxId: Reversed 32-byte previous transaction ID.
162
+ * - outputIndex: LE uint32 output index.
163
+ * - _scriptBuffer: Var-length script buffer.
164
+ * - sequenceNumber: LE uint32 sequence number.
165
+ * @note TODO: Return specialized input types (CoinbaseInput, PublicKeyHashInput, etc.).
166
+ * @static
167
+ */
168
+ export function fromBufferReader(br: BufferReader): Input;
169
+ }
170
+ import Output = require("../output.cjs");
171
+ import Script = require("../../script/script.cjs");
172
+ import BufferWriter = require("../../encoding/bufferwriter.cjs");
173
+ import PrivateKey = require("../../privatekey.cjs");
174
+ import TransactionSignature = require("../signature.cjs");
175
+ declare var MAXINT: number;
176
+ declare var DEFAULT_SEQNUMBER: number;
177
+ declare var DEFAULT_LOCKTIME_SEQNUMBER: number;
178
+ declare var DEFAULT_RBF_SEQNUMBER: number;