utxo-lib 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -0
  3. package/dist/src/address.d.ts +11 -0
  4. package/dist/src/address.d.ts.map +1 -0
  5. package/dist/src/address.js +37 -0
  6. package/dist/src/addressFormat.d.ts +53 -0
  7. package/dist/src/addressFormat.d.ts.map +1 -0
  8. package/dist/src/addressFormat.js +110 -0
  9. package/dist/src/bitgo/Musig2.d.ts +51 -0
  10. package/dist/src/bitgo/Musig2.d.ts.map +1 -0
  11. package/dist/src/bitgo/Musig2.js +175 -0
  12. package/dist/src/bitgo/Unspent.d.ts +95 -0
  13. package/dist/src/bitgo/Unspent.d.ts.map +1 -0
  14. package/dist/src/bitgo/Unspent.js +138 -0
  15. package/dist/src/bitgo/UtxoPsbt.d.ts +132 -0
  16. package/dist/src/bitgo/UtxoPsbt.d.ts.map +1 -0
  17. package/dist/src/bitgo/UtxoPsbt.js +469 -0
  18. package/dist/src/bitgo/UtxoTransaction.d.ts +22 -0
  19. package/dist/src/bitgo/UtxoTransaction.d.ts.map +1 -0
  20. package/dist/src/bitgo/UtxoTransaction.js +97 -0
  21. package/dist/src/bitgo/UtxoTransactionBuilder.d.ts +26 -0
  22. package/dist/src/bitgo/UtxoTransactionBuilder.d.ts.map +1 -0
  23. package/dist/src/bitgo/UtxoTransactionBuilder.js +67 -0
  24. package/dist/src/bitgo/bbc/DashPsbt.d.ts +12 -0
  25. package/dist/src/bitgo/bbc/DashPsbt.d.ts.map +1 -0
  26. package/dist/src/bitgo/bbc/DashPsbt.js +27 -0
  27. package/dist/src/bitgo/bbc/DashTransaction.d.ts +39 -0
  28. package/dist/src/bitgo/bbc/DashTransaction.d.ts.map +1 -0
  29. package/dist/src/bitgo/bbc/DashTransaction.js +109 -0
  30. package/dist/src/bitgo/bbc/DashTransactionBuilder.d.ts +14 -0
  31. package/dist/src/bitgo/bbc/DashTransactionBuilder.d.ts.map +1 -0
  32. package/dist/src/bitgo/bbc/DashTransactionBuilder.js +28 -0
  33. package/dist/src/bitgo/bbc/index.d.ts +4 -0
  34. package/dist/src/bitgo/bbc/index.d.ts.map +1 -0
  35. package/dist/src/bitgo/bbc/index.js +16 -0
  36. package/dist/src/bitgo/bitcoincash/address.d.ts +35 -0
  37. package/dist/src/bitgo/bitcoincash/address.d.ts.map +1 -0
  38. package/dist/src/bitgo/bitcoincash/address.js +151 -0
  39. package/dist/src/bitgo/bitcoincash/index.d.ts +2 -0
  40. package/dist/src/bitgo/bitcoincash/index.d.ts.map +1 -0
  41. package/dist/src/bitgo/bitcoincash/index.js +14 -0
  42. package/dist/src/bitgo/dash/DashPsbt.d.ts +12 -0
  43. package/dist/src/bitgo/dash/DashPsbt.d.ts.map +1 -0
  44. package/dist/src/bitgo/dash/DashPsbt.js +27 -0
  45. package/dist/src/bitgo/dash/DashTransaction.d.ts +39 -0
  46. package/dist/src/bitgo/dash/DashTransaction.d.ts.map +1 -0
  47. package/dist/src/bitgo/dash/DashTransaction.js +109 -0
  48. package/dist/src/bitgo/dash/DashTransactionBuilder.d.ts +14 -0
  49. package/dist/src/bitgo/dash/DashTransactionBuilder.d.ts.map +1 -0
  50. package/dist/src/bitgo/dash/DashTransactionBuilder.js +28 -0
  51. package/dist/src/bitgo/dash/index.d.ts +4 -0
  52. package/dist/src/bitgo/dash/index.d.ts.map +1 -0
  53. package/dist/src/bitgo/dash/index.js +16 -0
  54. package/dist/src/bitgo/index.d.ts +17 -0
  55. package/dist/src/bitgo/index.d.ts.map +1 -0
  56. package/dist/src/bitgo/index.js +30 -0
  57. package/dist/src/bitgo/keyutil.d.ts +17 -0
  58. package/dist/src/bitgo/keyutil.d.ts.map +1 -0
  59. package/dist/src/bitgo/keyutil.js +37 -0
  60. package/dist/src/bitgo/nonStandardHalfSigned.d.ts +7 -0
  61. package/dist/src/bitgo/nonStandardHalfSigned.d.ts.map +1 -0
  62. package/dist/src/bitgo/nonStandardHalfSigned.js +56 -0
  63. package/dist/src/bitgo/outputScripts.d.ts +84 -0
  64. package/dist/src/bitgo/outputScripts.d.ts.map +1 -0
  65. package/dist/src/bitgo/outputScripts.js +297 -0
  66. package/dist/src/bitgo/parseInput.d.ts +92 -0
  67. package/dist/src/bitgo/parseInput.d.ts.map +1 -0
  68. package/dist/src/bitgo/parseInput.js +344 -0
  69. package/dist/src/bitgo/psbt/fromHalfSigned.d.ts +24 -0
  70. package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +1 -0
  71. package/dist/src/bitgo/psbt/fromHalfSigned.js +91 -0
  72. package/dist/src/bitgo/psbt/scriptTypes.d.ts +6 -0
  73. package/dist/src/bitgo/psbt/scriptTypes.d.ts.map +1 -0
  74. package/dist/src/bitgo/psbt/scriptTypes.js +23 -0
  75. package/dist/src/bitgo/signature.d.ts +84 -0
  76. package/dist/src/bitgo/signature.d.ts.map +1 -0
  77. package/dist/src/bitgo/signature.js +222 -0
  78. package/dist/src/bitgo/tnumber.d.ts +9 -0
  79. package/dist/src/bitgo/tnumber.d.ts.map +1 -0
  80. package/dist/src/bitgo/tnumber.js +31 -0
  81. package/dist/src/bitgo/transaction.d.ts +29 -0
  82. package/dist/src/bitgo/transaction.d.ts.map +1 -0
  83. package/dist/src/bitgo/transaction.js +247 -0
  84. package/dist/src/bitgo/types.d.ts +5 -0
  85. package/dist/src/bitgo/types.d.ts.map +1 -0
  86. package/dist/src/bitgo/types.js +12 -0
  87. package/dist/src/bitgo/wallet/Psbt.d.ts +47 -0
  88. package/dist/src/bitgo/wallet/Psbt.d.ts.map +1 -0
  89. package/dist/src/bitgo/wallet/Psbt.js +232 -0
  90. package/dist/src/bitgo/wallet/Unspent.d.ts +47 -0
  91. package/dist/src/bitgo/wallet/Unspent.d.ts.map +1 -0
  92. package/dist/src/bitgo/wallet/Unspent.js +154 -0
  93. package/dist/src/bitgo/wallet/WalletKeys.d.ts +72 -0
  94. package/dist/src/bitgo/wallet/WalletKeys.d.ts.map +1 -0
  95. package/dist/src/bitgo/wallet/WalletKeys.js +104 -0
  96. package/dist/src/bitgo/wallet/WalletOutput.d.ts +18 -0
  97. package/dist/src/bitgo/wallet/WalletOutput.d.ts.map +1 -0
  98. package/dist/src/bitgo/wallet/WalletOutput.js +69 -0
  99. package/dist/src/bitgo/wallet/WalletScripts.d.ts +7 -0
  100. package/dist/src/bitgo/wallet/WalletScripts.d.ts.map +1 -0
  101. package/dist/src/bitgo/wallet/WalletScripts.js +15 -0
  102. package/dist/src/bitgo/wallet/WalletUnspentSigner.d.ts +19 -0
  103. package/dist/src/bitgo/wallet/WalletUnspentSigner.d.ts.map +1 -0
  104. package/dist/src/bitgo/wallet/WalletUnspentSigner.js +47 -0
  105. package/dist/src/bitgo/wallet/chains.d.ts +57 -0
  106. package/dist/src/bitgo/wallet/chains.d.ts.map +1 -0
  107. package/dist/src/bitgo/wallet/chains.js +106 -0
  108. package/dist/src/bitgo/wallet/index.d.ts +8 -0
  109. package/dist/src/bitgo/wallet/index.d.ts.map +1 -0
  110. package/dist/src/bitgo/wallet/index.js +20 -0
  111. package/dist/src/bitgo/zcash/ZcashBufferutils.d.ts +26 -0
  112. package/dist/src/bitgo/zcash/ZcashBufferutils.d.ts.map +1 -0
  113. package/dist/src/bitgo/zcash/ZcashBufferutils.js +157 -0
  114. package/dist/src/bitgo/zcash/ZcashPsbt.d.ts +36 -0
  115. package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +1 -0
  116. package/dist/src/bitgo/zcash/ZcashPsbt.js +146 -0
  117. package/dist/src/bitgo/zcash/ZcashTransaction.d.ts +61 -0
  118. package/dist/src/bitgo/zcash/ZcashTransaction.d.ts.map +1 -0
  119. package/dist/src/bitgo/zcash/ZcashTransaction.js +341 -0
  120. package/dist/src/bitgo/zcash/ZcashTransactionBuilder.d.ts +21 -0
  121. package/dist/src/bitgo/zcash/ZcashTransactionBuilder.d.ts.map +1 -0
  122. package/dist/src/bitgo/zcash/ZcashTransactionBuilder.js +105 -0
  123. package/dist/src/bitgo/zcash/address.d.ts +8 -0
  124. package/dist/src/bitgo/zcash/address.d.ts.map +1 -0
  125. package/dist/src/bitgo/zcash/address.js +57 -0
  126. package/dist/src/bitgo/zcash/hashZip0244.d.ts +27 -0
  127. package/dist/src/bitgo/zcash/hashZip0244.d.ts.map +1 -0
  128. package/dist/src/bitgo/zcash/hashZip0244.js +184 -0
  129. package/dist/src/bitgo/zcash/index.d.ts +4 -0
  130. package/dist/src/bitgo/zcash/index.d.ts.map +1 -0
  131. package/dist/src/bitgo/zcash/index.js +16 -0
  132. package/dist/src/classify.d.ts +19 -0
  133. package/dist/src/classify.d.ts.map +1 -0
  134. package/dist/src/classify.js +89 -0
  135. package/dist/src/index.d.ts +13 -0
  136. package/dist/src/index.d.ts.map +1 -0
  137. package/dist/src/index.js +36 -0
  138. package/dist/src/networks.d.ts +119 -0
  139. package/dist/src/networks.d.ts.map +1 -0
  140. package/dist/src/networks.js +477 -0
  141. package/dist/src/noble_ecc.d.ts +28 -0
  142. package/dist/src/noble_ecc.d.ts.map +1 -0
  143. package/dist/src/noble_ecc.js +168 -0
  144. package/dist/src/payments/index.d.ts +4 -0
  145. package/dist/src/payments/index.d.ts.map +1 -0
  146. package/dist/src/payments/index.js +8 -0
  147. package/dist/src/payments/p2tr.d.ts +3 -0
  148. package/dist/src/payments/p2tr.d.ts.map +1 -0
  149. package/dist/src/payments/p2tr.js +348 -0
  150. package/dist/src/payments/p2tr_ns.d.ts +3 -0
  151. package/dist/src/payments/p2tr_ns.d.ts.map +1 -0
  152. package/dist/src/payments/p2tr_ns.js +134 -0
  153. package/dist/src/taproot.d.ts +141 -0
  154. package/dist/src/taproot.d.ts.map +1 -0
  155. package/dist/src/taproot.js +384 -0
  156. package/dist/src/templates/multisig/index.d.ts +4 -0
  157. package/dist/src/templates/multisig/index.d.ts.map +1 -0
  158. package/dist/src/templates/multisig/index.js +8 -0
  159. package/dist/src/templates/multisig/input.d.ts +7 -0
  160. package/dist/src/templates/multisig/input.d.ts.map +1 -0
  161. package/dist/src/templates/multisig/input.js +25 -0
  162. package/dist/src/templates/multisig/output.d.ts +7 -0
  163. package/dist/src/templates/multisig/output.d.ts.map +1 -0
  164. package/dist/src/templates/multisig/output.js +38 -0
  165. package/dist/src/templates/nulldata.d.ts +10 -0
  166. package/dist/src/templates/nulldata.d.ts.map +1 -0
  167. package/dist/src/templates/nulldata.js +17 -0
  168. package/dist/src/templates/pubkey/index.d.ts +4 -0
  169. package/dist/src/templates/pubkey/index.d.ts.map +1 -0
  170. package/dist/src/templates/pubkey/index.js +8 -0
  171. package/dist/src/templates/pubkey/input.d.ts +7 -0
  172. package/dist/src/templates/pubkey/input.d.ts.map +1 -0
  173. package/dist/src/templates/pubkey/input.js +14 -0
  174. package/dist/src/templates/pubkey/output.d.ts +7 -0
  175. package/dist/src/templates/pubkey/output.d.ts.map +1 -0
  176. package/dist/src/templates/pubkey/output.js +15 -0
  177. package/dist/src/templates/pubkeyhash/index.d.ts +4 -0
  178. package/dist/src/templates/pubkeyhash/index.d.ts.map +1 -0
  179. package/dist/src/templates/pubkeyhash/index.js +8 -0
  180. package/dist/src/templates/pubkeyhash/input.d.ts +7 -0
  181. package/dist/src/templates/pubkeyhash/input.d.ts.map +1 -0
  182. package/dist/src/templates/pubkeyhash/input.js +16 -0
  183. package/dist/src/templates/pubkeyhash/output.d.ts +6 -0
  184. package/dist/src/templates/pubkeyhash/output.d.ts.map +1 -0
  185. package/dist/src/templates/pubkeyhash/output.js +20 -0
  186. package/dist/src/templates/scripthash/index.d.ts +4 -0
  187. package/dist/src/templates/scripthash/index.d.ts.map +1 -0
  188. package/dist/src/templates/scripthash/index.js +8 -0
  189. package/dist/src/templates/scripthash/input.d.ts +6 -0
  190. package/dist/src/templates/scripthash/input.d.ts.map +1 -0
  191. package/dist/src/templates/scripthash/input.js +43 -0
  192. package/dist/src/templates/scripthash/output.d.ts +6 -0
  193. package/dist/src/templates/scripthash/output.d.ts.map +1 -0
  194. package/dist/src/templates/scripthash/output.js +15 -0
  195. package/dist/src/templates/taproot/index.d.ts +4 -0
  196. package/dist/src/templates/taproot/index.d.ts.map +1 -0
  197. package/dist/src/templates/taproot/index.js +8 -0
  198. package/dist/src/templates/taproot/input.d.ts +6 -0
  199. package/dist/src/templates/taproot/input.d.ts.map +1 -0
  200. package/dist/src/templates/taproot/input.js +23 -0
  201. package/dist/src/templates/taproot/output.d.ts +6 -0
  202. package/dist/src/templates/taproot/output.d.ts.map +1 -0
  203. package/dist/src/templates/taproot/output.js +15 -0
  204. package/dist/src/templates/taprootnofn/index.d.ts +4 -0
  205. package/dist/src/templates/taprootnofn/index.d.ts.map +1 -0
  206. package/dist/src/templates/taprootnofn/index.js +8 -0
  207. package/dist/src/templates/taprootnofn/input.d.ts +7 -0
  208. package/dist/src/templates/taprootnofn/input.d.ts.map +1 -0
  209. package/dist/src/templates/taprootnofn/input.js +24 -0
  210. package/dist/src/templates/taprootnofn/output.d.ts +7 -0
  211. package/dist/src/templates/taprootnofn/output.d.ts.map +1 -0
  212. package/dist/src/templates/taprootnofn/output.js +28 -0
  213. package/dist/src/templates/witnesscommitment/index.d.ts +3 -0
  214. package/dist/src/templates/witnesscommitment/index.d.ts.map +1 -0
  215. package/dist/src/templates/witnesscommitment/index.js +6 -0
  216. package/dist/src/templates/witnesscommitment/output.d.ts +8 -0
  217. package/dist/src/templates/witnesscommitment/output.d.ts.map +1 -0
  218. package/dist/src/templates/witnesscommitment/output.js +31 -0
  219. package/dist/src/templates/witnesspubkeyhash/index.d.ts +4 -0
  220. package/dist/src/templates/witnesspubkeyhash/index.d.ts.map +1 -0
  221. package/dist/src/templates/witnesspubkeyhash/index.js +8 -0
  222. package/dist/src/templates/witnesspubkeyhash/input.d.ts +7 -0
  223. package/dist/src/templates/witnesspubkeyhash/input.d.ts.map +1 -0
  224. package/dist/src/templates/witnesspubkeyhash/input.js +19 -0
  225. package/dist/src/templates/witnesspubkeyhash/output.d.ts +6 -0
  226. package/dist/src/templates/witnesspubkeyhash/output.d.ts.map +1 -0
  227. package/dist/src/templates/witnesspubkeyhash/output.js +15 -0
  228. package/dist/src/templates/witnessscripthash/index.d.ts +4 -0
  229. package/dist/src/templates/witnessscripthash/index.d.ts.map +1 -0
  230. package/dist/src/templates/witnessscripthash/index.js +8 -0
  231. package/dist/src/templates/witnessscripthash/input.d.ts +6 -0
  232. package/dist/src/templates/witnessscripthash/input.d.ts.map +1 -0
  233. package/dist/src/templates/witnessscripthash/input.js +35 -0
  234. package/dist/src/templates/witnessscripthash/output.d.ts +6 -0
  235. package/dist/src/templates/witnessscripthash/output.d.ts.map +1 -0
  236. package/dist/src/templates/witnessscripthash/output.js +15 -0
  237. package/dist/src/testutil/index.d.ts +3 -0
  238. package/dist/src/testutil/index.d.ts.map +1 -0
  239. package/dist/src/testutil/index.js +15 -0
  240. package/dist/src/testutil/keys.d.ts +10 -0
  241. package/dist/src/testutil/keys.d.ts.map +1 -0
  242. package/dist/src/testutil/keys.js +40 -0
  243. package/dist/src/testutil/mock.d.ts +21 -0
  244. package/dist/src/testutil/mock.d.ts.map +1 -0
  245. package/dist/src/testutil/mock.js +86 -0
  246. package/dist/src/transaction_builder.d.ts +47 -0
  247. package/dist/src/transaction_builder.d.ts.map +1 -0
  248. package/dist/src/transaction_builder.js +1084 -0
  249. package/package.json +87 -0
@@ -0,0 +1,95 @@
1
+ /// <reference types="node" />
2
+ import { TxOutput } from 'bitcoinjs-lib';
3
+ import { Network } from '..';
4
+ import { UtxoTransactionBuilder } from './UtxoTransactionBuilder';
5
+ import { UtxoTransaction } from './UtxoTransaction';
6
+ /**
7
+ * Public unspent data in BitGo-specific representation.
8
+ */
9
+ export interface Unspent<TNumber extends number | bigint = number> {
10
+ /**
11
+ * Format: ${txid}:${vout}.
12
+ * Use `parseOutputId(id)` to parse.
13
+ */
14
+ id: string;
15
+ /**
16
+ * The network-specific encoded address.
17
+ * Use `toOutputScript(address, network)` to obtain scriptPubKey.
18
+ */
19
+ address: string;
20
+ /**
21
+ * The amount in satoshi.
22
+ */
23
+ value: TNumber;
24
+ }
25
+ export interface UnspentWithPrevTx<TNumber extends number | bigint = number> extends Unspent<TNumber> {
26
+ prevTx: Buffer;
27
+ }
28
+ export declare function isUnspentWithPrevTx<TNumber extends number | bigint, TUnspent extends Unspent<TNumber>>(u: Unspent<TNumber>): u is TUnspent & {
29
+ prevTx: Buffer;
30
+ };
31
+ /**
32
+ * @return TxOutput from Unspent
33
+ */
34
+ export declare function toOutput<TNumber extends number | bigint>(u: Unspent<TNumber>, network: Network): TxOutput<TNumber>;
35
+ /**
36
+ * @return Unspent from TxOutput
37
+ */
38
+ export declare function fromOutput<TNumber extends number | bigint>(tx: UtxoTransaction<TNumber>, vout: number): Unspent<TNumber>;
39
+ export declare function fromOutputWithPrevTx<TNumber extends number | bigint>(tx: UtxoTransaction<TNumber>, vout: number): UnspentWithPrevTx<TNumber>;
40
+ /**
41
+ * @param outputId
42
+ * @return TxOutPoint
43
+ */
44
+ export declare function parseOutputId(outputId: string): TxOutPoint;
45
+ /**
46
+ * @param txid
47
+ * @param vout
48
+ * @return outputId
49
+ */
50
+ export declare function formatOutputId({ txid, vout }: TxOutPoint): string;
51
+ export declare function getOutputIdForInput(i: {
52
+ hash: Buffer;
53
+ index: number;
54
+ }): TxOutPoint;
55
+ /**
56
+ * Reference to output of an existing transaction
57
+ */
58
+ export declare type TxOutPoint = {
59
+ txid: string;
60
+ vout: number;
61
+ };
62
+ /**
63
+ * Output reference and script data.
64
+ * Suitable for use for `txb.addInput()`
65
+ */
66
+ export declare type PrevOutput<TNumber extends number | bigint = number> = TxOutPoint & TxOutput<TNumber> & {
67
+ prevTx?: Buffer;
68
+ };
69
+ /**
70
+ * @return PrevOutput from Unspent
71
+ */
72
+ export declare function toPrevOutput<TNumber extends number | bigint>(u: Unspent<TNumber>, network: Network): PrevOutput<TNumber>;
73
+ /**
74
+ * @return PrevOutput with prevTx from Unspent
75
+ */
76
+ export declare function toPrevOutputWithPrevTx<TNumber extends number | bigint>(u: Unspent<TNumber> & {
77
+ prevTx?: unknown;
78
+ }, network: Network): PrevOutput<TNumber>;
79
+ /**
80
+ * @param txb
81
+ * @param u
82
+ * @param sequence - sequenceId
83
+ */
84
+ export declare function addToTransactionBuilder<TNumber extends number | bigint>(txb: UtxoTransactionBuilder<TNumber>, u: Unspent<TNumber>, sequence?: number): void;
85
+ /**
86
+ * Sum the values of the unspents.
87
+ * Throws error if sum is not a safe integer value, or if unspent amount types do not match `amountType`
88
+ * @param unspents - array of unspents to sum
89
+ * @param amountType - expected value type of unspents
90
+ * @return unspentSum - type matches amountType
91
+ */
92
+ export declare function unspentSum<TNumber extends number | bigint>(unspents: {
93
+ value: TNumber;
94
+ }[], amountType?: 'number' | 'bigint'): TNumber;
95
+ //# sourceMappingURL=Unspent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unspent.d.ts","sourceRoot":"","sources":["../../../src/bitgo/Unspent.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM;IAC/D;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAE,SAAQ,OAAO,CAAC,OAAO,CAAC;IACnG,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,SAAS,OAAO,CAAC,OAAO,CAAC,EACpG,CA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YAAY,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC1D,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EACnB,OAAO,EAAE,OAAO,GACf,UAAU,CAAC,OAAO,CAAC,CAKrB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACpE,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,EAC1C,OAAO,EAAE,OAAO,GACf,UAAU,CAAC,OAAO,CAAC,CAcrB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACrE,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAGN;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACxD,QAAQ,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,EAC9B,UAAU,GAAE,QAAQ,GAAG,QAAmB,GACzC,OAAO,CAUT"}
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unspentSum = exports.addToTransactionBuilder = exports.toPrevOutputWithPrevTx = exports.toPrevOutput = exports.getOutputIdForInput = exports.formatOutputId = exports.parseOutputId = exports.fromOutputWithPrevTx = exports.fromOutput = exports.toOutput = exports.isUnspentWithPrevTx = void 0;
4
+ const address_1 = require("../address");
5
+ function isUnspentWithPrevTx(u) {
6
+ return Buffer.isBuffer(u.prevTx);
7
+ }
8
+ exports.isUnspentWithPrevTx = isUnspentWithPrevTx;
9
+ /**
10
+ * @return TxOutput from Unspent
11
+ */
12
+ function toOutput(u, network) {
13
+ return {
14
+ script: address_1.toOutputScript(u.address, network),
15
+ value: u.value,
16
+ };
17
+ }
18
+ exports.toOutput = toOutput;
19
+ /**
20
+ * @return Unspent from TxOutput
21
+ */
22
+ function fromOutput(tx, vout) {
23
+ const o = tx.outs[vout];
24
+ if (!o) {
25
+ throw new Error(`invalid vout`);
26
+ }
27
+ return {
28
+ id: formatOutputId({ txid: tx.getId(), vout }),
29
+ address: address_1.fromOutputScript(o.script, tx.network),
30
+ value: o.value,
31
+ };
32
+ }
33
+ exports.fromOutput = fromOutput;
34
+ function fromOutputWithPrevTx(tx, vout) {
35
+ return {
36
+ ...fromOutput(tx, vout),
37
+ prevTx: tx.toBuffer(),
38
+ };
39
+ }
40
+ exports.fromOutputWithPrevTx = fromOutputWithPrevTx;
41
+ /**
42
+ * @param outputId
43
+ * @return TxOutPoint
44
+ */
45
+ function parseOutputId(outputId) {
46
+ const parts = outputId.split(':');
47
+ if (parts.length !== 2) {
48
+ throw new Error(`invalid outputId, must have format txid:vout`);
49
+ }
50
+ const [txid, voutStr] = parts;
51
+ const vout = Number(voutStr);
52
+ if (txid.length !== 64) {
53
+ throw new Error(`invalid txid ${txid} ${txid.length}`);
54
+ }
55
+ if (Number.isNaN(vout) || vout < 0 || !Number.isSafeInteger(vout)) {
56
+ throw new Error(`invalid vout: must be integer >= 0`);
57
+ }
58
+ return { txid, vout };
59
+ }
60
+ exports.parseOutputId = parseOutputId;
61
+ /**
62
+ * @param txid
63
+ * @param vout
64
+ * @return outputId
65
+ */
66
+ function formatOutputId({ txid, vout }) {
67
+ return `${txid}:${vout}`;
68
+ }
69
+ exports.formatOutputId = formatOutputId;
70
+ function getOutputIdForInput(i) {
71
+ return {
72
+ txid: Buffer.from(i.hash).reverse().toString('hex'),
73
+ vout: i.index,
74
+ };
75
+ }
76
+ exports.getOutputIdForInput = getOutputIdForInput;
77
+ /**
78
+ * @return PrevOutput from Unspent
79
+ */
80
+ function toPrevOutput(u, network) {
81
+ return {
82
+ ...parseOutputId(u.id),
83
+ ...toOutput(u, network),
84
+ };
85
+ }
86
+ exports.toPrevOutput = toPrevOutput;
87
+ /**
88
+ * @return PrevOutput with prevTx from Unspent
89
+ */
90
+ function toPrevOutputWithPrevTx(u, network) {
91
+ let prevTx;
92
+ if (typeof u.prevTx === 'string') {
93
+ prevTx = Buffer.from(u.prevTx, 'hex');
94
+ }
95
+ else if (Buffer.isBuffer(u.prevTx)) {
96
+ prevTx = u.prevTx;
97
+ }
98
+ else if (u.prevTx !== undefined) {
99
+ throw new Error(`Invalid prevTx type for unspent ${u.prevTx}`);
100
+ }
101
+ return {
102
+ ...parseOutputId(u.id),
103
+ ...toOutput(u, network),
104
+ prevTx,
105
+ };
106
+ }
107
+ exports.toPrevOutputWithPrevTx = toPrevOutputWithPrevTx;
108
+ /**
109
+ * @param txb
110
+ * @param u
111
+ * @param sequence - sequenceId
112
+ */
113
+ function addToTransactionBuilder(txb, u, sequence) {
114
+ const { txid, vout, script, value } = toPrevOutput(u, txb.network);
115
+ txb.addInput(txid, vout, sequence, script, value);
116
+ }
117
+ exports.addToTransactionBuilder = addToTransactionBuilder;
118
+ /**
119
+ * Sum the values of the unspents.
120
+ * Throws error if sum is not a safe integer value, or if unspent amount types do not match `amountType`
121
+ * @param unspents - array of unspents to sum
122
+ * @param amountType - expected value type of unspents
123
+ * @return unspentSum - type matches amountType
124
+ */
125
+ function unspentSum(unspents, amountType = 'number') {
126
+ if (amountType === 'bigint') {
127
+ return unspents.reduce((sum, u) => sum + u.value, BigInt(0));
128
+ }
129
+ else {
130
+ const sum = unspents.reduce((sum, u) => sum + u.value, Number(0));
131
+ if (!Number.isSafeInteger(sum)) {
132
+ throw new Error('unspent sum is not a safe integer number, consider using bigint');
133
+ }
134
+ return sum;
135
+ }
136
+ }
137
+ exports.unspentSum = unspentSum;
138
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVW5zcGVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9iaXRnby9Vb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Vuc3BlbnQgYW1vdW50IHR5cGVzIGRvIG5vdCBtYXRjaCBgYW1vdW50VHlwZWBcbiAqIEBwYXJhbSB1bnNwZW50cyAtIGFycmF5IG9mIHVuc3BlbnRzIHRvIHN1bVxuICogQHBhcmFtIGFtb3VudFR5cGUgLSBleHBlY3RlZCB2YWx1ZSB0eXBlIG9mIHVuc3BlbnRzXG4gKiBAcmV0dXJuIHVuc3BlbnRTdW0gLSB0eXBlIG1hdGNoZXMgYW1vdW50VHlwZVxuICovXG5leHBvcnQgZnVuY3Rpb24gdW5zcGVudFN1bTxUTnVtYmVyIGV4dGVuZHMgbnVtYmVyIHwgYmlnaW50PihcbiAgdW5zcGVudHM6IHsgdmFsdWU6IFROdW1iZXIgfVtdLFxuICBhbW91bnRUeXBlOiAnbnVtYmVyJyB8ICdiaWdpbnQnID0gJ251bWJlcidcbik6IFROdW1iZXIge1xuICBpZiAoYW1vdW50VHlwZSA9PT0gJ2JpZ2ludCcpIHtcbiAgICByZXR1cm4gdW5zcGVudHMucmVkdWNlKChzdW0sIHUpID0+IHN1bSArICh1LnZhbHVlIGFzIGJpZ2ludCksIEJpZ0ludCgwKSkgYXMgVE51bWJlcjtcbiAgfSBlbHNlIHtcbiAgICBjb25zdCBzdW0gPSB1bnNwZW50cy5yZWR1Y2UoKHN1bSwgdSkgPT4gc3VtICsgKHUudmFsdWUgYXMgbnVtYmVyKSwgTnVtYmVyKDApKTtcbiAgICBpZiAoIU51bWJlci5pc1NhZmVJbnRlZ2VyKHN1bSkpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcigndW5zcGVudCBzdW0gaXMgbm90IGEgc2FmZSBpbnRlZ2VyIG51bWJlciwgY29uc2lkZXIgdXNpbmcgYmlnaW50Jyk7XG4gICAgfVxuICAgIHJldHVybiBzdW0gYXMgVE51bWJlcjtcbiAgfVxufVxuIl19
@@ -0,0 +1,132 @@
1
+ /// <reference types="node" />
2
+ import { Psbt as PsbtBase } from 'bip174';
3
+ import { HDSigner, Psbt, TxOutput, Network } from '..';
4
+ import { UtxoTransaction } from './UtxoTransaction';
5
+ import { ProprietaryKey } from 'bip174/src/lib/proprietaryKeyVal';
6
+ export declare const PSBT_PROPRIETARY_IDENTIFIER = "BITGO";
7
+ export declare enum ProprietaryKeySubtype {
8
+ ZEC_CONSENSUS_BRANCH_ID = 0,
9
+ MUSIG2_PARTICIPANT_PUB_KEYS = 1,
10
+ MUSIG2_PUB_NONCE = 2
11
+ }
12
+ export interface HDTaprootSigner extends HDSigner {
13
+ /**
14
+ * The path string must match /^m(\/\d+'?)+$/
15
+ * ex. m/44'/0'/0'/1/23 levels with ' must be hard derivations
16
+ */
17
+ derivePath(path: string): HDTaprootSigner;
18
+ /**
19
+ * Input hash (the "message digest") for the signature algorithm
20
+ * Return a 64 byte signature (32 byte r and 32 byte s in that order)
21
+ */
22
+ signSchnorr(hash: Buffer): Buffer;
23
+ }
24
+ export interface SchnorrSigner {
25
+ publicKey: Buffer;
26
+ signSchnorr(hash: Buffer): Buffer;
27
+ }
28
+ export interface TaprootSigner {
29
+ leafHashes: Buffer[];
30
+ signer: SchnorrSigner;
31
+ }
32
+ export interface PsbtOpts {
33
+ network: Network;
34
+ maximumFeeRate?: number;
35
+ bip32PathsAbsolute?: boolean;
36
+ }
37
+ /**
38
+ * Psbt proprietary keydata object.
39
+ * <compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata>
40
+ * => <bytes valuedata>
41
+ */
42
+ export interface ProprietaryKeyValueData {
43
+ key: ProprietaryKey;
44
+ value: Buffer;
45
+ }
46
+ /**
47
+ * Psbt proprietary keydata object search fields.
48
+ * <compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata>
49
+ */
50
+ export interface ProprietaryKeySearch {
51
+ identifier: string;
52
+ subtype: number;
53
+ keydata?: Buffer;
54
+ identifierEncoding?: BufferEncoding;
55
+ }
56
+ export declare class UtxoPsbt<Tx extends UtxoTransaction<bigint> = UtxoTransaction<bigint>> extends Psbt {
57
+ protected static transactionFromBuffer(buffer: Buffer, network: Network): UtxoTransaction<bigint>;
58
+ static createPsbt(opts: PsbtOpts, data?: PsbtBase): UtxoPsbt;
59
+ static fromBuffer(buffer: Buffer, opts: PsbtOpts): UtxoPsbt;
60
+ static fromHex(data: string, opts: PsbtOpts): UtxoPsbt;
61
+ get network(): Network;
62
+ toHex(): string;
63
+ /**
64
+ * @return true iff PSBT input is finalized
65
+ */
66
+ isInputFinalized(inputIndex: number): boolean;
67
+ /**
68
+ * @return partialSig/tapScriptSig count iff input is not finalized
69
+ */
70
+ getSignatureCount(inputIndex: number): number;
71
+ getNonWitnessPreviousTxids(): string[];
72
+ addNonWitnessUtxos(txBufs: Record<string, Buffer>): this;
73
+ static fromTransaction(transaction: UtxoTransaction<bigint>, prevOutputs: TxOutput<bigint>[]): UtxoPsbt;
74
+ getUnsignedTx(): UtxoTransaction<bigint>;
75
+ protected static newTransaction(network: Network): UtxoTransaction<bigint>;
76
+ protected get tx(): Tx;
77
+ protected checkForSignatures(propName?: string): void;
78
+ /**
79
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
80
+ */
81
+ finalizeAllInputs(): this;
82
+ finalizeTaprootInput(inputIndex: number): this;
83
+ finalizeTapInputWithSingleLeafScriptAndSignature(inputIndex: number): this;
84
+ /**
85
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
86
+ *
87
+ * Unlike the function it overrides, this does not take a validator. In BitGo
88
+ * context, we know how we want to validate so we just hard code the right
89
+ * validator.
90
+ */
91
+ validateSignaturesOfAllInputs(): boolean;
92
+ validateTaprootSignaturesOfInput(inputIndex: number, pubkey?: Buffer): boolean;
93
+ /**
94
+ * @return array of boolean values. True when corresponding index in `publicKeys` has signed the transaction.
95
+ * If no signature in the tx or no public key matching signature, the validation is considered as false.
96
+ */
97
+ getSignatureValidationArray(inputIndex: number): boolean[];
98
+ /**
99
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
100
+ */
101
+ signAllInputsHD(hdKeyPair: HDTaprootSigner, sighashTypes?: number[]): this;
102
+ /**
103
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts:signInputHD
104
+ */
105
+ signTaprootInputHD(inputIndex: number, hdKeyPair: HDTaprootSigner, sighashTypes?: number[]): this;
106
+ signTaprootInput(inputIndex: number, signer: SchnorrSigner, leafHashes: Buffer[], sighashTypes?: number[]): this;
107
+ private getTaprootHashForSig;
108
+ /**
109
+ * @retuns true iff the input is taproot.
110
+ */
111
+ isTaprootInput(inputIndex: number): boolean;
112
+ /**
113
+ * @returns hash and hashType for taproot input at inputIndex
114
+ * @throws error if input at inputIndex is not a taproot input
115
+ */
116
+ getTaprootHashForSigChecked(inputIndex: number, sighashTypes?: number[], leafHash?: Buffer): {
117
+ hash: Buffer;
118
+ sighashType: number;
119
+ };
120
+ /**
121
+ * Adds proprietary key value pair to PSBT input.
122
+ * Default identifierEncoding is utf-8 for identifier.
123
+ */
124
+ addProprietaryKeyValToInput(inputIndex: number, keyValueData: ProprietaryKeyValueData): this;
125
+ /**
126
+ * To search any data from proprietary key value againts keydata.
127
+ * Default identifierEncoding is utf-8 for identifier.
128
+ */
129
+ getProprietaryKeyVals(inputIndex: number, keySearch?: ProprietaryKeySearch): ProprietaryKeyValueData[];
130
+ clone(): this;
131
+ }
132
+ //# sourceMappingURL=UtxoPsbt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UtxoPsbt.d.ts","sourceRoot":"","sources":["../../../src/bitgo/UtxoPsbt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAK1C,OAAO,EAEL,QAAQ,EACR,IAAI,EAGJ,QAAQ,EACR,OAAO,EAGR,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,EAA8C,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAE9G,eAAO,MAAM,2BAA2B,UAAU,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