xpi-ts 0.2.22 → 0.2.24

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 (172) hide show
  1. package/dist/cjs/lib/bitcore/crypto/point.js +2 -2
  2. package/dist/cjs/lib/bitcore/index.js +162 -162
  3. package/dist/esm/lib/bitcore/crypto/point.js +2 -2
  4. package/dist/esm/lib/bitcore/index.js +42 -42
  5. package/dist/types/index.d.ts +5 -0
  6. package/dist/types/index.d.ts.map +1 -1
  7. package/dist/types/lib/bitcore/address.d.ts +116 -0
  8. package/dist/types/lib/bitcore/address.d.ts.map +1 -1
  9. package/dist/types/lib/bitcore/block/block.d.ts +214 -0
  10. package/dist/types/lib/bitcore/block/block.d.ts.map +1 -1
  11. package/dist/types/lib/bitcore/block/blockheader.d.ts +220 -0
  12. package/dist/types/lib/bitcore/block/blockheader.d.ts.map +1 -1
  13. package/dist/types/lib/bitcore/block/merkleblock.d.ts +206 -0
  14. package/dist/types/lib/bitcore/block/merkleblock.d.ts.map +1 -1
  15. package/dist/types/lib/bitcore/crypto/bn.d.ts +224 -0
  16. package/dist/types/lib/bitcore/crypto/bn.d.ts.map +1 -1
  17. package/dist/types/lib/bitcore/crypto/ecdsa.d.ts +122 -0
  18. package/dist/types/lib/bitcore/crypto/ecdsa.d.ts.map +1 -1
  19. package/dist/types/lib/bitcore/crypto/hash.d.ts +56 -0
  20. package/dist/types/lib/bitcore/crypto/hash.d.ts.map +1 -1
  21. package/dist/types/lib/bitcore/crypto/index.d.ts +4 -0
  22. package/dist/types/lib/bitcore/crypto/index.d.ts.map +1 -1
  23. package/dist/types/lib/bitcore/crypto/musig2.d.ts +282 -0
  24. package/dist/types/lib/bitcore/crypto/musig2.d.ts.map +1 -1
  25. package/dist/types/lib/bitcore/crypto/point.d.ts +87 -0
  26. package/dist/types/lib/bitcore/crypto/point.d.ts.map +1 -1
  27. package/dist/types/lib/bitcore/crypto/random.d.ts +48 -0
  28. package/dist/types/lib/bitcore/crypto/random.d.ts.map +1 -1
  29. package/dist/types/lib/bitcore/crypto/schnorr.d.ts +203 -0
  30. package/dist/types/lib/bitcore/crypto/schnorr.d.ts.map +1 -1
  31. package/dist/types/lib/bitcore/crypto/signature.d.ts +452 -0
  32. package/dist/types/lib/bitcore/crypto/signature.d.ts.map +1 -1
  33. package/dist/types/lib/bitcore/crypto/sigtype.d.ts +46 -0
  34. package/dist/types/lib/bitcore/crypto/sigtype.d.ts.map +1 -1
  35. package/dist/types/lib/bitcore/encoding/base58.d.ts +68 -0
  36. package/dist/types/lib/bitcore/encoding/base58.d.ts.map +1 -1
  37. package/dist/types/lib/bitcore/encoding/base58check.d.ts +58 -0
  38. package/dist/types/lib/bitcore/encoding/base58check.d.ts.map +1 -1
  39. package/dist/types/lib/bitcore/encoding/bufferreader.d.ts +112 -0
  40. package/dist/types/lib/bitcore/encoding/bufferreader.d.ts.map +1 -1
  41. package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts +144 -0
  42. package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts.map +1 -1
  43. package/dist/types/lib/bitcore/encoding/varint.d.ts +86 -0
  44. package/dist/types/lib/bitcore/encoding/varint.d.ts.map +1 -1
  45. package/dist/types/lib/bitcore/errors.d.ts +4 -0
  46. package/dist/types/lib/bitcore/errors.d.ts.map +1 -1
  47. package/dist/types/lib/bitcore/hdprivatekey.d.ts +59 -0
  48. package/dist/types/lib/bitcore/hdprivatekey.d.ts.map +1 -1
  49. package/dist/types/lib/bitcore/hdpublickey.d.ts +145 -0
  50. package/dist/types/lib/bitcore/hdpublickey.d.ts.map +1 -1
  51. package/dist/types/lib/bitcore/index.d.ts +58 -54
  52. package/dist/types/lib/bitcore/index.d.ts.map +1 -1
  53. package/dist/types/lib/bitcore/message.d.ts +63 -0
  54. package/dist/types/lib/bitcore/message.d.ts.map +1 -1
  55. package/dist/types/lib/bitcore/mnemonic/errors.d.ts +4 -0
  56. package/dist/types/lib/bitcore/mnemonic/errors.d.ts.map +1 -1
  57. package/dist/types/lib/bitcore/mnemonic/index.d.ts +4 -0
  58. package/dist/types/lib/bitcore/mnemonic/index.d.ts.map +1 -1
  59. package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts +106 -0
  60. package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts.map +1 -1
  61. package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts +13 -0
  62. package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts.map +1 -1
  63. package/dist/types/lib/bitcore/mnemonic/words/english.d.ts +4 -0
  64. package/dist/types/lib/bitcore/mnemonic/words/english.d.ts.map +1 -1
  65. package/dist/types/lib/bitcore/mnemonic/words/french.d.ts +5 -0
  66. package/dist/types/lib/bitcore/mnemonic/words/french.d.ts.map +1 -1
  67. package/dist/types/lib/bitcore/mnemonic/words/index.d.ts +4 -0
  68. package/dist/types/lib/bitcore/mnemonic/words/index.d.ts.map +1 -1
  69. package/dist/types/lib/bitcore/musig2/index.d.ts +14 -0
  70. package/dist/types/lib/bitcore/musig2/index.d.ts.map +1 -1
  71. package/dist/types/lib/bitcore/musig2/session.d.ts +254 -0
  72. package/dist/types/lib/bitcore/musig2/session.d.ts.map +1 -1
  73. package/dist/types/lib/bitcore/musig2/signer.d.ts +212 -0
  74. package/dist/types/lib/bitcore/musig2/signer.d.ts.map +1 -1
  75. package/dist/types/lib/bitcore/networks.d.ts +17 -0
  76. package/dist/types/lib/bitcore/networks.d.ts.map +1 -1
  77. package/dist/types/lib/bitcore/opcode.d.ts +151 -0
  78. package/dist/types/lib/bitcore/opcode.d.ts.map +1 -1
  79. package/dist/types/lib/bitcore/privatekey.d.ts +80 -0
  80. package/dist/types/lib/bitcore/privatekey.d.ts.map +1 -1
  81. package/dist/types/lib/bitcore/publickey.d.ts +195 -0
  82. package/dist/types/lib/bitcore/publickey.d.ts.map +1 -1
  83. package/dist/types/lib/bitcore/script/chunk.d.ts +51 -0
  84. package/dist/types/lib/bitcore/script/chunk.d.ts.map +1 -1
  85. package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts +60 -0
  86. package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts.map +1 -1
  87. package/dist/types/lib/bitcore/script/interpreter/index.d.ts +23 -0
  88. package/dist/types/lib/bitcore/script/interpreter/index.d.ts.map +1 -1
  89. package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts +86 -0
  90. package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts.map +1 -1
  91. package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts +115 -0
  92. package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts.map +1 -1
  93. package/dist/types/lib/bitcore/script/interpreter/types.d.ts +119 -0
  94. package/dist/types/lib/bitcore/script/interpreter/types.d.ts.map +1 -1
  95. package/dist/types/lib/bitcore/script/taproot.d.ts +297 -0
  96. package/dist/types/lib/bitcore/script/taproot.d.ts.map +1 -1
  97. package/dist/types/lib/bitcore/script.d.ts +510 -0
  98. package/dist/types/lib/bitcore/script.d.ts.map +1 -1
  99. package/dist/types/lib/bitcore/taproot/musig2.d.ts +153 -0
  100. package/dist/types/lib/bitcore/taproot/musig2.d.ts.map +1 -1
  101. package/dist/types/lib/bitcore/transaction/input/multisig.d.ts +8 -0
  102. package/dist/types/lib/bitcore/transaction/input/multisig.d.ts.map +1 -1
  103. package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts +8 -0
  104. package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts.map +1 -1
  105. package/dist/types/lib/bitcore/transaction/input/publickey.d.ts +8 -0
  106. package/dist/types/lib/bitcore/transaction/input/publickey.d.ts.map +1 -1
  107. package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts +14 -0
  108. package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts.map +1 -1
  109. package/dist/types/lib/bitcore/transaction/input/taproot.d.ts +22 -0
  110. package/dist/types/lib/bitcore/transaction/input/taproot.d.ts.map +1 -1
  111. package/dist/types/lib/bitcore/transaction/input.d.ts +418 -0
  112. package/dist/types/lib/bitcore/transaction/input.d.ts.map +1 -1
  113. package/dist/types/lib/bitcore/transaction/outpoint.d.ts +110 -0
  114. package/dist/types/lib/bitcore/transaction/outpoint.d.ts.map +1 -1
  115. package/dist/types/lib/bitcore/transaction/output.d.ts +83 -0
  116. package/dist/types/lib/bitcore/transaction/output.d.ts.map +1 -1
  117. package/dist/types/lib/bitcore/transaction/sighash.d.ts +69 -0
  118. package/dist/types/lib/bitcore/transaction/sighash.d.ts.map +1 -1
  119. package/dist/types/lib/bitcore/transaction/signature.d.ts +98 -0
  120. package/dist/types/lib/bitcore/transaction/signature.d.ts.map +1 -1
  121. package/dist/types/lib/bitcore/transaction/transaction.d.ts +379 -0
  122. package/dist/types/lib/bitcore/transaction/transaction.d.ts.map +1 -1
  123. package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts +61 -0
  124. package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts.map +1 -1
  125. package/dist/types/lib/bitcore/unit.d.ts +140 -0
  126. package/dist/types/lib/bitcore/unit.d.ts.map +1 -1
  127. package/dist/types/lib/bitcore/uri.d.ts +34 -0
  128. package/dist/types/lib/bitcore/uri.d.ts.map +1 -1
  129. package/dist/types/lib/bitcore/util/base32.d.ts +55 -0
  130. package/dist/types/lib/bitcore/util/base32.d.ts.map +1 -1
  131. package/dist/types/lib/bitcore/util/bits.d.ts +76 -0
  132. package/dist/types/lib/bitcore/util/bits.d.ts.map +1 -1
  133. package/dist/types/lib/bitcore/util/buffer.d.ts +135 -0
  134. package/dist/types/lib/bitcore/util/buffer.d.ts.map +1 -1
  135. package/dist/types/lib/bitcore/util/convertBits.d.ts +15 -0
  136. package/dist/types/lib/bitcore/util/convertBits.d.ts.map +1 -1
  137. package/dist/types/lib/bitcore/util/js.d.ts +19 -0
  138. package/dist/types/lib/bitcore/util/js.d.ts.map +1 -1
  139. package/dist/types/lib/bitcore/util/merkle.d.ts +85 -0
  140. package/dist/types/lib/bitcore/util/merkle.d.ts.map +1 -1
  141. package/dist/types/lib/bitcore/util/preconditions.d.ts +29 -0
  142. package/dist/types/lib/bitcore/util/preconditions.d.ts.map +1 -1
  143. package/dist/types/lib/bitcore/util.d.ts +7 -0
  144. package/dist/types/lib/bitcore/util.d.ts.map +1 -1
  145. package/dist/types/lib/bitcore/xaddress.d.ts +117 -0
  146. package/dist/types/lib/bitcore/xaddress.d.ts.map +1 -1
  147. package/dist/types/lib/lokad.d.ts +292 -0
  148. package/dist/types/lib/lokad.d.ts.map +1 -1
  149. package/dist/types/lib/nft.d.ts +434 -0
  150. package/dist/types/lib/nft.d.ts.map +1 -1
  151. package/dist/types/lib/rank/api.d.ts +13 -0
  152. package/dist/types/lib/rank/api.d.ts.map +1 -1
  153. package/dist/types/lib/rank/index.d.ts +153 -0
  154. package/dist/types/lib/rank/index.d.ts.map +1 -1
  155. package/dist/types/lib/rank/opcode.d.ts +6 -2
  156. package/dist/types/lib/rank/opcode.d.ts.map +1 -1
  157. package/dist/types/lib/rank/script.d.ts +10 -0
  158. package/dist/types/lib/rank/script.d.ts.map +1 -1
  159. package/dist/types/lib/rank/transaction.d.ts +11 -0
  160. package/dist/types/lib/rank/transaction.d.ts.map +1 -1
  161. package/dist/types/lib/rpc.d.ts +176 -0
  162. package/dist/types/lib/rpc.d.ts.map +1 -1
  163. package/dist/types/utils/constants.d.ts +27 -0
  164. package/dist/types/utils/constants.d.ts.map +1 -1
  165. package/dist/types/utils/env.d.ts +15 -0
  166. package/dist/types/utils/env.d.ts.map +1 -1
  167. package/dist/types/utils/string.d.ts +57 -0
  168. package/dist/types/utils/string.d.ts.map +1 -1
  169. package/dist/types/utils/wallet.d.ts +43 -1
  170. package/dist/types/utils/wallet.d.ts.map +1 -1
  171. package/package.json +1 -1
  172. package/tsconfig.types.json +2 -1
@@ -1,32 +1,142 @@
1
+ /**
2
+ * COutPoint - A combination of a transaction hash and an index n into its vout
3
+ *
4
+ * Faithful TypeScript implementation of lotusd/src/primitives/transaction.h COutPoint.
5
+ * An outpoint uniquely identifies a specific output of a previous transaction.
6
+ *
7
+ * Serialization format (36 bytes):
8
+ * - txid: 32 bytes (uint256, little-endian)
9
+ * - n: 4 bytes (uint32_t, little-endian)
10
+ *
11
+ * Reference: lotusd/src/primitives/transaction.h lines 22-54
12
+ */
1
13
  import { BufferReader } from '../encoding/bufferreader.js';
2
14
  import { BufferWriter } from '../encoding/bufferwriter.js';
3
15
  import type { Buffer } from 'buffer/';
16
+ /** Serialized size of an outpoint in bytes */
4
17
  export declare const OUTPOINT_SIZE = 36;
18
+ /**
19
+ * Data for constructing an OutPoint from an object
20
+ */
5
21
  export interface OutPointData {
22
+ /** Transaction ID as hex string (big-endian display order) */
6
23
  txid: string;
24
+ /** Output index within the transaction */
7
25
  outputIndex: number;
8
26
  }
27
+ /**
28
+ * Serialized representation of an OutPoint
29
+ */
9
30
  export interface OutPointObject {
31
+ /** Transaction ID as hex string (big-endian display order) */
10
32
  txid: string;
33
+ /** Output index within the transaction */
11
34
  outputIndex: number;
12
35
  }
36
+ /**
37
+ * An outpoint - a combination of a transaction hash and an index n into its
38
+ * vout.
39
+ *
40
+ * Reference: lotusd COutPoint (primitives/transaction.h)
41
+ */
13
42
  export declare class OutPoint {
43
+ /**
44
+ * Sentinel value for null output index.
45
+ * Matches lotusd COutPoint::NULL_INDEX = std::numeric_limits<uint32_t>::max()
46
+ */
14
47
  static readonly NULL_INDEX: number;
48
+ /** Transaction ID (32 bytes, stored as internal little-endian buffer) */
15
49
  private _txid;
50
+ /** Output index within the transaction (uint32) */
16
51
  private _n;
52
+ /**
53
+ * Create a new OutPoint
54
+ *
55
+ * @param txid - Transaction ID as 32-byte Buffer (little-endian) or hex string (big-endian display order)
56
+ * @param n - Output index (uint32), defaults to NULL_INDEX
57
+ */
17
58
  constructor(txid?: Buffer | string, n?: number);
59
+ /**
60
+ * Create an OutPoint from a data object
61
+ *
62
+ * @param data - Object with txid (hex string) and outputIndex
63
+ * @returns New OutPoint instance
64
+ */
18
65
  static fromObject(data: OutPointData): OutPoint;
66
+ /**
67
+ * Deserialize an OutPoint from a buffer
68
+ *
69
+ * @param buf - Buffer containing serialized outpoint (36 bytes)
70
+ * @returns New OutPoint instance
71
+ */
19
72
  static fromBuffer(buf: Buffer): OutPoint;
73
+ /**
74
+ * Deserialize an OutPoint from a BufferReader
75
+ *
76
+ * Reads: txid (32 bytes LE) + n (4 bytes LE)
77
+ * Matches lotusd SERIALIZE_METHODS(COutPoint, obj) { READWRITE(obj.txid, obj.n); }
78
+ *
79
+ * @param reader - BufferReader positioned at the outpoint data
80
+ * @returns New OutPoint instance
81
+ */
20
82
  static fromBufferReader(reader: BufferReader): OutPoint;
83
+ /**
84
+ * Check if this is a null outpoint (all-zero txid and NULL_INDEX)
85
+ *
86
+ * Matches lotusd: bool IsNull() const { return txid.IsNull() && n == NULL_INDEX; }
87
+ */
21
88
  isNull(): boolean;
89
+ /**
90
+ * Get the transaction ID as a hex string (big-endian display order)
91
+ *
92
+ * Matches lotusd: const TxId &GetTxId() const
93
+ */
22
94
  getTxId(): string;
95
+ /**
96
+ * Get the transaction ID as a Buffer (internal little-endian)
97
+ */
23
98
  getTxIdBuffer(): Buffer;
99
+ /**
100
+ * Get the output index
101
+ *
102
+ * Matches lotusd: uint32_t GetN() const
103
+ */
24
104
  getN(): number;
105
+ /**
106
+ * Serialize to a Buffer (36 bytes)
107
+ *
108
+ * Format: txid (32 bytes LE) + n (4 bytes LE)
109
+ * Matches lotusd SERIALIZE_METHODS
110
+ */
25
111
  toBuffer(): Buffer;
112
+ /**
113
+ * Write serialized outpoint to a BufferWriter
114
+ *
115
+ * @param writer - BufferWriter to write to
116
+ * @returns The BufferWriter for chaining
117
+ */
26
118
  toBufferWriter(writer: BufferWriter): BufferWriter;
119
+ /**
120
+ * Convert to a plain object
121
+ */
27
122
  toObject(): OutPointObject;
123
+ /**
124
+ * String representation matching lotusd COutPoint::ToString()
125
+ *
126
+ * Format: "COutPoint(txid_prefix, n)"
127
+ */
28
128
  toString(): string;
129
+ /**
130
+ * Compare two outpoints for equality
131
+ *
132
+ * Matches lotusd: friend bool operator==(const COutPoint &a, const COutPoint &b)
133
+ */
29
134
  equals(other: OutPoint): boolean;
135
+ /**
136
+ * Compare two outpoints for ordering (less-than)
137
+ *
138
+ * Matches lotusd: friend bool operator<(const COutPoint &a, const COutPoint &b)
139
+ */
30
140
  lessThan(other: OutPoint): boolean;
31
141
  }
32
142
  //# sourceMappingURL=outpoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"outpoint.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/outpoint.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,eAAO,MAAM,aAAa,KAAK,CAAA;AAK/B,MAAM,WAAW,YAAY;IAE3B,IAAI,EAAE,MAAM,CAAA;IAEZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAKD,MAAM,WAAW,cAAc;IAE7B,IAAI,EAAE,MAAM,CAAA;IAEZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAQD,qBAAa,QAAQ;IAKnB,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAa;IAG/C,OAAO,CAAC,KAAK,CAAQ;IAGrB,OAAO,CAAC,EAAE,CAAQ;gBAQN,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM;IAiC9C,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ;IAU/C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;IAcxC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ;IAcvD,MAAM,IAAI,OAAO;IAWjB,O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EAAE,YAAY,GAAG,QAAQ;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;IAKxC;;;;;;;;OAQG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ;IASvD;;;;OAIG;IACH,MAAM,IAAI,OAAO;IAMjB;;;;OAIG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;;;OAIG;IACH,IAAI,IAAI,MAAM;IAId;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;IAMlB;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY;IAMlD;;OAEG;IACH,QAAQ,IAAI,cAAc;IAO1B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAIhC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;CAInC"}
@@ -13,6 +13,9 @@ export interface OutputObject {
13
13
  script: string;
14
14
  asm: string;
15
15
  }
16
+ /**
17
+ * Represents a transaction output
18
+ */
16
19
  export declare class Output {
17
20
  satoshis: number;
18
21
  private _satoshisBN;
@@ -20,31 +23,111 @@ export declare class Output {
20
23
  private _script?;
21
24
  constructor(args: OutputData);
22
25
  static create(args: OutputData): Output;
26
+ /**
27
+ * Parse satoshis from various input types
28
+ */
23
29
  private _parseSatoshis;
30
+ /**
31
+ * Get the BN representation of satoshis
32
+ */
24
33
  get satoshisBN(): BN;
34
+ /**
35
+ * Set the BN representation of satoshis
36
+ */
25
37
  set satoshisBN(value: BN);
38
+ /**
39
+ * Get the script for this output
40
+ */
26
41
  get script(): Script;
42
+ /**
43
+ * Get the script buffer
44
+ */
27
45
  get scriptBuffer(): Buffer;
46
+ /**
47
+ * Set the script from a buffer
48
+ */
28
49
  setScriptFromBuffer(buffer: Buffer): void;
50
+ /**
51
+ * Set the script for this output
52
+ */
29
53
  setScript(script: Script | Buffer | string): Output;
54
+ /**
55
+ * Get the amount in XPI
56
+ */
30
57
  getXPI(): number;
58
+ /**
59
+ * Set the amount from XPI
60
+ */
31
61
  setXPI(xpi: number): Output;
62
+ /**
63
+ * Check if this output is valid
64
+ */
32
65
  isValid(): boolean;
66
+ /**
67
+ * Check if this output is dust (too small to be economical)
68
+ */
33
69
  isDust(dustThreshold?: number): boolean;
70
+ /**
71
+ * Check if satoshis are invalid
72
+ */
34
73
  invalidSatoshis(): string | false;
74
+ /**
75
+ * Check if this is an OP_RETURN output
76
+ */
35
77
  isOpReturn(): boolean;
78
+ /**
79
+ * Convert to object representation
80
+ */
36
81
  toObject(): OutputObject;
82
+ /**
83
+ * Convert to JSON
84
+ *
85
+ * @alias Output.toObject
86
+ */
37
87
  toJSON: () => OutputObject;
88
+ /**
89
+ * Debug representation
90
+ */
38
91
  inspect(): string;
92
+ /**
93
+ * Create from buffer reader
94
+ */
39
95
  static fromBufferReader(br: BufferReader): Output;
96
+ /**
97
+ * Serialize to buffer
98
+ */
40
99
  toBuffer(): Buffer;
100
+ /**
101
+ * Serialize to buffer writer
102
+ */
41
103
  toBufferWriter(writer?: BufferWriter): BufferWriter;
104
+ /**
105
+ * Get the size of this output in bytes
106
+ */
42
107
  getSize(): number;
108
+ /**
109
+ * Clone this output
110
+ */
43
111
  clone(): Output;
112
+ /**
113
+ * Create from object
114
+ */
44
115
  static fromObject(data: OutputData): Output;
116
+ /**
117
+ * Check if this output is a Pay-to-Public-Key-Hash output
118
+ */
45
119
  isPayToPublicKeyHash(): boolean;
120
+ /**
121
+ * Check if this output is a Pay-to-Script-Hash output
122
+ */
46
123
  isPayToScriptHash(): boolean;
124
+ /**
125
+ * Check if this output is a Pay-to-Taproot output
126
+ */
47
127
  isPayToTaproot(): boolean;
128
+ /**
129
+ * Get the address for this output (if applicable)
130
+ */
48
131
  getAddress(): string | null;
49
132
  }
50
133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,YAAY,GAAG,MAAM;IAYjD;;OAEG;IACH,QAAQ,IAAI,MAAM;IAQlB;;OAEG;IACH,cAAc,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY;IAWnD;;OAEG;IACH,OAAO,IAAI,MAAM;IAQjB;;OAEG;IACH,KAAK,IAAI,MAAM;IAOf;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;IAI3C;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,UAAU,IAAI,MAAM,GAAG,IAAI;CAQ5B"}
@@ -7,6 +7,7 @@ import { PrivateKey } from '../privatekey';
7
7
  import { PublicKey } from '../publickey';
8
8
  import type { Buffer } from 'buffer/';
9
9
  export interface TransactionLike {
10
+ /** This array is also used */
10
11
  inputs: Array<{
11
12
  prevTxId: Buffer;
12
13
  outputIndex: number;
@@ -23,11 +24,79 @@ export interface TransactionLike {
23
24
  version?: number;
24
25
  nLockTime?: number;
25
26
  }
27
+ /**
28
+ * Calculate the sighash for a transaction
29
+ *
30
+ * This function routes to the appropriate sighash algorithm based on flags:
31
+ * - SIGHASH_LOTUS (0x60): Lotus sighash with merkle trees
32
+ * - SIGHASH_FORKID (0x40): BIP143 sighash
33
+ * - Legacy (0x00): Original Bitcoin sighash
34
+ *
35
+ * Note: SIGHASH_LOTUS requires spent outputs for all inputs to be available
36
+ * in the transaction.spentOutputs property.
37
+ *
38
+ * @param transaction - The transaction being signed (must have spentOutputs for LOTUS)
39
+ * @param sighashType - Signature hash type flags
40
+ * @param inputNumber - Index of input being signed
41
+ * @param subscript - Script being executed/signed
42
+ * @param satoshisBN - Value of output being spent (required for FORKID/LOTUS)
43
+ * @param flags - Script validation flags
44
+ * @returns 32-byte signature hash
45
+ */
26
46
  declare function sighash(transaction: TransactionLike, sighashType: number, inputNumber: number, subscript: Script, satoshisBN?: BN, flags?: number): Buffer;
47
+ /**
48
+ * Sign a transaction input
49
+ *
50
+ * Generates a cryptographic signature for a transaction input using the specified
51
+ * signing method (ECDSA or Schnorr) and sighash algorithm.
52
+ *
53
+ * Sighash Algorithm Selection:
54
+ * - If SIGHASH_LOTUS flag is set: Uses Lotus sighash (requires transaction.spentOutputs)
55
+ * - If SIGHASH_FORKID flag is set: Uses BIP143 sighash
56
+ * - Otherwise: Uses legacy Bitcoin sighash
57
+ *
58
+ * @param transaction - The transaction being signed (must have spentOutputs for LOTUS)
59
+ * @param privateKey - Private key to sign with
60
+ * @param sighashType - Signature hash type (e.g., SIGHASH_ALL | SIGHASH_FORKID)
61
+ * @param inputIndex - Index of the input being signed
62
+ * @param subscript - The script being executed/signed
63
+ * @param satoshisBN - Value of the output being spent
64
+ * @param flags - Script validation flags
65
+ * @param signingMethod - 'ecdsa' (default) or 'schnorr'
66
+ * @returns Signature object with nhashtype set
67
+ * @throws Error if SIGHASH_LOTUS is used without transaction.spentOutputs
68
+ */
27
69
  declare function sign(transaction: TransactionLike, privateKey: PrivateKey, sighashType: number, inputIndex: number, subscript: Script, satoshisBN?: BN, flags?: number, signingMethod?: 'ecdsa' | 'schnorr'): Signature;
70
+ /**
71
+ * Verify a transaction signature
72
+ *
73
+ * Verifies that a signature is valid for the specified transaction input.
74
+ * Automatically uses the correct sighash algorithm based on the signature's
75
+ * nhashtype field (LOTUS, FORKID, or legacy).
76
+ *
77
+ * @param transaction - The transaction being verified (must have spentOutputs for LOTUS)
78
+ * @param signature - The signature to verify (must have nhashtype set)
79
+ * @param publicKey - Public key to verify against
80
+ * @param inputIndex - Index of the input being verified
81
+ * @param subscript - The script being executed
82
+ * @param satoshisBN - Value of the output being spent
83
+ * @param flags - Script validation flags
84
+ * @param signingMethod - 'ecdsa' (default) or 'schnorr'
85
+ * @returns true if signature is valid, false otherwise
86
+ * @throws Error if SIGHASH_LOTUS is used without transaction.spentOutputs
87
+ */
28
88
  declare function verify(transaction: TransactionLike, signature: Signature, publicKey: PublicKey, inputIndex: number, subscript: Script, satoshisBN?: BN, flags?: number, signingMethod?: 'ecdsa' | 'schnorr'): boolean;
89
+ /**
90
+ * Default sign flags
91
+ */
29
92
  export declare const DEFAULT_SIGN_FLAGS: number;
93
+ /**
94
+ * Constants
95
+ */
30
96
  export declare const SIGHASH_SINGLE_BUG = "0000000000000000000000000000000000000000000000000000000000000001";
31
97
  export declare const BITS_64_ON = "ffffffffffffffff";
98
+ /**
99
+ * @namespace Signing
100
+ */
32
101
  export { sighash, sign, verify };
33
102
  //# sourceMappingURL=sighash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sighash.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/sighash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAOjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,eAAe;IAE9B,MAAM,EAAE,KAAK,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAA;QAChB,WAAW,EAAE,MAAM,CAAA;QACnB,cAAc,EAAE,MAAM,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACvB,CAAC,CAAA;IACF,OAAO,EAAE,KAAK,CAAC;QACb,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,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AAM,EACnB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,EAAE,EACf,KAAK,CAAC,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,GAClC,SAAS,CAwBX;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,MAAM,CACb,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,EAAE,EACf,KAAK,CAAC,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,GAClC,OAAO,CA6BT;AAyDD;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAA2B,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,kBAAkB,qEAA2B,CAAA;AAC1D,eAAO,MAAM,UAAU,qBAAmB,CAAA;AAE1C;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA"}
@@ -17,25 +17,123 @@ export interface TransactionSignatureObject {
17
17
  signature: string;
18
18
  sigtype: number;
19
19
  }
20
+ /**
21
+ * Represents a digital signature within a transaction input, including identifying information and the signature itself.
22
+ *
23
+ * The `TransactionSignature` class wraps a low-level cryptography `Signature` class and includes additional context,
24
+ * such as which input/output the signature is for, the signer public key, and the sighash type.
25
+ *
26
+ * CRITICAL: This class maintains automatic synchronization of the sighash type (nhashtype) between
27
+ * the TransactionSignature.sigtype and the inner Signature.nhashtype. This ensures that signature
28
+ * verification and serialization always use the correct sighash type.
29
+ *
30
+ * It automatically detects and parses ECDSA (DER format) and Schnorr signatures, supports serialization/deserialization,
31
+ * and provides basic validation logic.
32
+ *
33
+ * @example
34
+ * const tsig = new TransactionSignature({
35
+ * publicKey: pubkey,
36
+ * prevTxId: txid,
37
+ * outputIndex: 0,
38
+ * inputIndex: 0,
39
+ * signature: sigBuf, // Buffer, Signature, or hex
40
+ * sigtype: Signature.SIGHASH_ALL,
41
+ * });
42
+ */
20
43
  export declare class TransactionSignature {
44
+ /** Public key of the signer */
21
45
  publicKey: PublicKey;
46
+ /** Previous transaction id for the referenced UTXO (as Buffer) */
22
47
  prevTxId: Buffer;
48
+ /** Index of the output in the previous transaction being spent */
23
49
  outputIndex: number;
50
+ /** Index of this input in the current transaction */
24
51
  inputIndex: number;
52
+ /** Signature hash type used for this signature (see Signature.SIGHASH_*) */
25
53
  private _sigtype;
54
+ /** Signature value; can be Schnorr or ECDSA, as a Signature object */
26
55
  private _signature;
56
+ /**
57
+ * Get the signature object
58
+ * @returns The inner Signature object
59
+ */
27
60
  get signature(): Signature;
61
+ /**
62
+ * Set the signature object and automatically sync nhashtype
63
+ * @param sig The signature to set
64
+ */
28
65
  set signature(sig: Signature);
66
+ /**
67
+ * Get the sighash type
68
+ * @returns The sighash type value
69
+ */
29
70
  get sigtype(): number;
71
+ /**
72
+ * Set the sighash type and automatically sync to inner signature
73
+ * @param type The sighash type value
74
+ */
30
75
  set sigtype(type: number);
76
+ /**
77
+ * Creates a new TransactionSignature instance.
78
+ *
79
+ * @param arg - The signature data. Must be a TransactionSignatureData, another TransactionSignature, or (never used) string.
80
+ * @throws {BitcoreError} If required arguments are missing or invalid.
81
+ */
31
82
  constructor(arg?: TransactionSignatureData | TransactionSignature);
83
+ /**
84
+ * Initialize a TransactionSignature instance from an object.
85
+ *
86
+ * This method will set all required properties of the TransactionSignature, including
87
+ * parsing and detecting whether the signature uses Schnorr or ECDSA encoding.
88
+ *
89
+ * @param arg - The object containing properties to initialize the TransactionSignature.
90
+ * @returns The TransactionSignature instance with all fields set.
91
+ * @throws {BitcoreError} If required or invalid arguments are supplied.
92
+ *
93
+ * Signature parsing process:
94
+ * - If the signature is already a Signature instance, it is directly assigned.
95
+ * - If the signature is a Buffer, it detects type (Schnorr/ECDSA) based on length and content,
96
+ * optionally stripping a possible sighash byte for type detection.
97
+ * - If the signature is a string, it is parsed from hex; type detection is performed similarly.
98
+ */
32
99
  private _fromObject;
100
+ /**
101
+ * Validates the input object for TransactionSignature construction.
102
+ *
103
+ * @param arg - The object to validate.
104
+ * @throws {BitcoreError} If required fields are missing or invalid.
105
+ * @private
106
+ */
33
107
  private _checkObjectArgs;
108
+ /**
109
+ * Converts signature to plain JS object representation.
110
+ * @returns The object with all signature fields as string/number types.
111
+ */
34
112
  toObject(): TransactionSignatureObject;
113
+ /**
114
+ * Converts signature to a plain object suitable for JSON serialization.
115
+ */
35
116
  toJSON: () => TransactionSignatureObject;
117
+ /**
118
+ * Factory for constructing a TransactionSignature from an object.
119
+ * @param obj - The signature data.
120
+ * @returns New TransactionSignature instance.
121
+ */
36
122
  static fromObject(obj: TransactionSignatureData): TransactionSignature;
123
+ /**
124
+ * Clone this transaction signature.
125
+ * @returns Deep copy of this TransactionSignature.
126
+ */
37
127
  clone(): TransactionSignature;
128
+ /**
129
+ * Checks if this signature has all required fields and format.
130
+ * @returns True if the signature is structurally valid.
131
+ */
38
132
  isValid(): boolean;
133
+ /**
134
+ * Returns a human-readable string representation.
135
+ * @returns Format like "TransactionSignature(0:0)".
136
+ */
39
137
  toString(): string;
40
138
  }
41
139
  //# sourceMappingURL=signature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/signature.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAA;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;IACtC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,SAA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