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,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UtxoTransaction = exports.varSliceSize = void 0;
4
+ const assert = require("assert");
5
+ const bitcoinjs = require("bitcoinjs-lib");
6
+ const varuint = require("varuint-bitcoin");
7
+ const tnumber_1 = require("./tnumber");
8
+ const networks_1 = require("../networks");
9
+ function varSliceSize(slice) {
10
+ const length = slice.length;
11
+ return varuint.encodingLength(length) + length;
12
+ }
13
+ exports.varSliceSize = varSliceSize;
14
+ class UtxoTransaction extends bitcoinjs.Transaction {
15
+ constructor(network, transaction, amountType) {
16
+ super();
17
+ this.network = network;
18
+ if (transaction) {
19
+ this.version = transaction.version;
20
+ this.locktime = transaction.locktime;
21
+ this.ins = transaction.ins.map((v) => ({ ...v, witness: [...v.witness] }));
22
+ if (transaction.outs.length) {
23
+ // amountType only matters if there are outs
24
+ const inAmountType = typeof transaction.outs[0].value;
25
+ assert(inAmountType === 'number' || inAmountType === 'bigint');
26
+ const outAmountType = amountType || inAmountType;
27
+ this.outs = transaction.outs.map((v) => ({ ...v, value: tnumber_1.toTNumber(v.value, outAmountType) }));
28
+ }
29
+ }
30
+ }
31
+ static newTransaction(network, transaction, amountType) {
32
+ return new UtxoTransaction(network, transaction, amountType);
33
+ }
34
+ static fromBuffer(buf, noStrict, amountType = 'number', network, prevOutput) {
35
+ if (!network) {
36
+ throw new Error(`must provide network`);
37
+ }
38
+ return this.newTransaction(network, bitcoinjs.Transaction.fromBuffer(buf, noStrict, amountType), amountType);
39
+ }
40
+ addForkId(hashType) {
41
+ if (hashType & UtxoTransaction.SIGHASH_FORKID) {
42
+ const forkId = networks_1.isBitcoinGold(this.network) ? 79 : 0;
43
+ return (hashType | (forkId << 8)) >>> 0;
44
+ }
45
+ return hashType;
46
+ }
47
+ hashForWitnessV0(inIndex, prevOutScript, value, hashType) {
48
+ return super.hashForWitnessV0(inIndex, prevOutScript, value, this.addForkId(hashType));
49
+ }
50
+ /**
51
+ * Calculate the hash to verify the signature against
52
+ */
53
+ hashForSignatureByNetwork(inIndex, prevoutScript, value, hashType) {
54
+ switch (networks_1.getMainnet(this.network)) {
55
+ case networks_1.networks.zcash:
56
+ throw new Error(`illegal state`);
57
+ case networks_1.networks.bitcoincash:
58
+ case networks_1.networks.bitcoinsv:
59
+ case networks_1.networks.bitcoingold:
60
+ case networks_1.networks.ecash:
61
+ /*
62
+ Bitcoin Cash supports a FORKID flag. When set, we hash using hashing algorithm
63
+ that is used for segregated witness transactions (defined in BIP143).
64
+
65
+ The flag is also used by BitcoinSV and BitcoinGold
66
+
67
+ https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/replay-protected-sighash.md
68
+ */
69
+ const addForkId = (hashType & UtxoTransaction.SIGHASH_FORKID) > 0;
70
+ if (addForkId) {
71
+ /*
72
+ ``The sighash type is altered to include a 24-bit fork id in its most significant bits.''
73
+ We also use unsigned right shift operator `>>>` to cast to UInt32
74
+ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unsigned_right_shift
75
+ */
76
+ if (value === undefined) {
77
+ throw new Error(`must provide value`);
78
+ }
79
+ return super.hashForWitnessV0(inIndex, prevoutScript, value, this.addForkId(hashType));
80
+ }
81
+ }
82
+ return super.hashForSignature(inIndex, prevoutScript, hashType);
83
+ }
84
+ hashForSignature(inIndex, prevOutScript, hashType, value) {
85
+ value = value !== null && value !== void 0 ? value : this.ins[inIndex].value;
86
+ return this.hashForSignatureByNetwork(inIndex, prevOutScript, value, hashType);
87
+ }
88
+ clone(amountType) {
89
+ // No need to clone. Everything is copied in the constructor.
90
+ return new UtxoTransaction(this.network, this, amountType);
91
+ }
92
+ }
93
+ exports.UtxoTransaction = UtxoTransaction;
94
+ UtxoTransaction.SIGHASH_FORKID = 0x40;
95
+ /** @deprecated use SIGHASH_FORKID */
96
+ UtxoTransaction.SIGHASH_BITCOINCASHBIP143 = UtxoTransaction.SIGHASH_FORKID;
97
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXR4b1RyYW5zYWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2JpdGdvL1V0eG9UcmFuc2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpQ0FBaUM7QUFDakMsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyx1Q0FBc0M7QUFFdEMsMENBQTJFO0FBRTNFLFNBQWdCLFlBQVksQ0FBQyxLQUFhO0lBQ3hDLE1BQU0sTUFBTSxHQUFHLEtBQUssQ0FBQyxNQUFNLENBQUM7SUFDNUIsT0FBTyxPQUFPLENBQUMsY0FBYy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GV4OiBudW1iZXIsIHByZXZPdXRTY3JpcHQ6IEJ1ZmZlciwgaGFzaFR5cGU6IG51bWJlciwgdmFsdWU/OiBUTnVtYmVyKTogQnVmZmVyIHtcbiAgICB2YWx1ZSA9IHZhbHVlID8/ICh0aGlzLmluc1tpbkluZGV4XSBhcyBhbnkpLnZhbHVlO1xuICAgIHJldHVybiB0aGlzLmhhc2hGb3JTaWduYXR1cmVCeU5ldHdvcmsoaW5JbmRleCwgcHJldk91dFNjcmlwdCwgdmFsdWUsIGhhc2hUeXBlKTtcbiAgfVxuXG4gIGNsb25lPFROMiBleHRlbmRzIGJpZ2ludCB8IG51bWJlciA9IFROdW1iZXI+KGFtb3VudFR5cGU/OiAnbnVtYmVyJyB8ICdiaWdpbnQnKTogVXR4b1RyYW5zYWN0aW9uPFROMj4ge1xuICAgIC8vIE5vIG5lZWQgdG8gY2xvbmUuIEV2ZXJ5dGhpbmcgaXMgY29waWVkIGluIHRoZSBjb25zdHJ1Y3Rvci5cbiAgICByZXR1cm4gbmV3IFV0eG9UcmFuc2FjdGlvbjxUTjI+KHRoaXMubmV0d29yaywgdGhpcywgYW1vdW50VHlwZSk7XG4gIH1cbn1cbiJdfQ==
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import { TxOutput, Transaction } from 'bitcoinjs-lib';
3
+ import { Network } from '..';
4
+ import { Signer, TransactionBuilder } from '../transaction_builder';
5
+ import { UtxoTransaction } from './UtxoTransaction';
6
+ export interface TxbSignArg<TNumber extends number | bigint = number> {
7
+ prevOutScriptType: string;
8
+ vin: number;
9
+ keyPair: Signer;
10
+ redeemScript?: Buffer;
11
+ hashType?: number;
12
+ witnessValue?: TNumber;
13
+ witnessScript?: Buffer;
14
+ controlBlock?: Buffer;
15
+ }
16
+ export declare class UtxoTransactionBuilder<TNumber extends number | bigint = number, T extends UtxoTransaction<TNumber> = UtxoTransaction<TNumber>> extends TransactionBuilder<TNumber> {
17
+ constructor(network: Network, tx?: UtxoTransaction<TNumber>);
18
+ protected static newTransactionBuilder<TNumber extends number | bigint>(network: Network, tx: UtxoTransaction<TNumber>): UtxoTransactionBuilder<TNumber>;
19
+ protected createInitialTransaction(network: Network, tx?: Transaction<TNumber>): UtxoTransaction<TNumber>;
20
+ static fromTransaction<TNumber extends number | bigint = number>(tx: UtxoTransaction<TNumber>, network?: Network, prevOutputs?: TxOutput<TNumber>[]): UtxoTransactionBuilder<TNumber>;
21
+ get tx(): T;
22
+ build(): T;
23
+ buildIncomplete(): T;
24
+ sign(signParams: number | TxbSignArg<TNumber>, keyPair?: Signer, redeemScript?: Buffer, hashType?: number, witnessValue?: TNumber, witnessScript?: Buffer): void;
25
+ }
26
+ //# sourceMappingURL=UtxoTransactionBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UtxoTransactionBuilder.d.ts","sourceRoot":"","sources":["../../../src/bitgo/UtxoTransactionBuilder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,UAAU,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM;IAClE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,sBAAsB,CACjC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EACxC,CAAC,SAAS,eAAe,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,CAC7D,SAAQ,kBAAkB,CAAC,OAAO,CAAC;gBACvB,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC;IAM3D,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACpE,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,GAC3B,sBAAsB,CAAC,OAAO,CAAC;IAIlC,SAAS,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC;IAIzG,MAAM,CAAC,eAAe,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAC7D,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,EAC5B,OAAO,CAAC,EAAE,OAAO,EACjB,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,GAChC,sBAAsB,CAAC,OAAO,CAAC;IAmBlC,IAAI,EAAE,IAAI,CAAC,CAEV;IAED,KAAK,IAAI,CAAC;IAIV,eAAe,IAAI,CAAC;IAIpB,IAAI,CACF,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,EACxC,OAAO,CAAC,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,OAAO,EACtB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI;CAyBR"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UtxoTransactionBuilder = void 0;
4
+ const transaction_builder_1 = require("../transaction_builder");
5
+ const UtxoTransaction_1 = require("./UtxoTransaction");
6
+ class UtxoTransactionBuilder extends transaction_builder_1.TransactionBuilder {
7
+ constructor(network, tx) {
8
+ super();
9
+ this.network = network;
10
+ this.__TX = this.createInitialTransaction(network, tx);
11
+ }
12
+ static newTransactionBuilder(network, tx) {
13
+ return new UtxoTransactionBuilder(network, tx);
14
+ }
15
+ createInitialTransaction(network, tx) {
16
+ return new UtxoTransaction_1.UtxoTransaction(network, tx);
17
+ }
18
+ static fromTransaction(tx, network, prevOutputs) {
19
+ const txb = transaction_builder_1.TransactionBuilder.fromTransaction(tx, network, prevOutputs);
20
+ const utxb = this.newTransactionBuilder(tx.network, tx);
21
+ utxb.__INPUTS = txb.__INPUTS;
22
+ if (prevOutputs) {
23
+ const txbInputs = utxb.__INPUTS;
24
+ if (prevOutputs.length !== txbInputs.length) {
25
+ throw new Error(`prevOuts must match txbInput length`);
26
+ }
27
+ prevOutputs.forEach((o, i) => {
28
+ txbInputs[i].value = o.value;
29
+ txbInputs[i].prevOutScript = o.script;
30
+ });
31
+ }
32
+ return utxb;
33
+ }
34
+ get tx() {
35
+ return this.__TX;
36
+ }
37
+ build() {
38
+ return super.build();
39
+ }
40
+ buildIncomplete() {
41
+ return super.buildIncomplete();
42
+ }
43
+ sign(signParams, keyPair, redeemScript, hashType, witnessValue, witnessScript) {
44
+ // Regular bitcoin p2sh-p2ms inputs do not include the input amount (value) in the signature and
45
+ // thus do not require the parameter `value` to be set.
46
+ // For bitcoincash and bitcoinsv p2sh-p2ms inputs, the value parameter *is* required however.
47
+ // Since the `value` parameter is not passed to the legacy hashing method, we must store it
48
+ // on the transaction input object.
49
+ if (typeof signParams === 'number') {
50
+ if (typeof witnessValue === 'number' || typeof witnessValue === 'bigint') {
51
+ this.tx.ins[signParams].value = witnessValue;
52
+ }
53
+ return super.sign(signParams, keyPair, redeemScript, hashType, witnessValue, witnessScript);
54
+ }
55
+ if (signParams.witnessValue !== undefined) {
56
+ this.tx.ins[signParams.vin].value = signParams.witnessValue;
57
+ }
58
+ // When calling the sign method via TxbSignArg, the `value` parameter is actually not permitted
59
+ // to be set for p2sh-p2ms transactions.
60
+ if (signParams.prevOutScriptType === 'p2sh-p2ms') {
61
+ delete signParams.witnessValue;
62
+ }
63
+ return super.sign(signParams);
64
+ }
65
+ }
66
+ exports.UtxoTransactionBuilder = UtxoTransactionBuilder;
67
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXR4b1RyYW5zYWN0aW9uQnVpbGRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9iaXRnby9VdHhvVHJhbnNhY3Rpb25CdWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUlBLGdFQUFvRTtBQUNwRSx1REFBb0Q7QUFhcEQsTUFBYSxzQkFHWCxTQUFRLHdDQUEyQjtJQUNuQyxZQUFZLE9BQWdCLEVBQUUsRUFBNkI7UUFDekQsS0FBSyxFQUFFLENBQUM7UUFDUixJQUFJLENBQUMsT0FBTyxHQUFHLE9BQU8sQ0FBQztRQUN0QixJQUFZLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFDbEUsQ0FBQztJQUVTLE1BQU0sQ0FBQyxxQkFBcUIsQ0FDcEMsT0FBZ0IsRUFDaEIsRUFBNEI7UUFFNUIsT0FBTyxJQUFJLHNCQUFzQixDQUFVLE9BQU8sRUFBRSxFQUFFLENBQUMsQ0FBQztJQUMxRCxDQUFDO0lBRVMsd0JBQXdCLENBQUMsT0FBZ0IsRUFBRSxFQUF5QjtRQUM1RSxPQUFPLElBQUksaUNBQWUsQ0FBVSxPQUFPLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFDbkQsQ0FBQztJQUVELE1BQU0sQ0FBQyxlQUFlLENBQ3BCLEVBQTRCLEVBQzVCLE9BQWlCLEVBQ2pCLFdBQWlDO1FBRWpDLE1BQU0sR0FBR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x1ZSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAodGhpcy50eC5pbnNbc2lnblBhcmFtcy52aW5dIGFzIGFueSkudmFsdWUgPSBzaWduUGFyYW1zLndpdG5lc3NWYWx1ZTtcbiAgICB9XG4gICAgLy8gV2hlbiBjYWxsaW5nIHRoZSBzaWduIG1ldGhvZCB2aWEgVHhiU2lnbkFyZywgdGhlIGB2YWx1ZWAgcGFyYW1ldGVyIGlzIGFjdHVhbGx5IG5vdCBwZXJtaXR0ZWRcbiAgICAvLyB0byBiZSBzZXQgZm9yIHAyc2gtcDJtcyB0cmFuc2FjdGlvbnMuXG4gICAgaWYgKHNpZ25QYXJhbXMucHJldk91dFNjcmlwdFR5cGUgPT09ICdwMnNoLXAybXMnKSB7XG4gICAgICBkZWxldGUgc2lnblBhcmFtcy53aXRuZXNzVmFsdWU7XG4gICAgfVxuICAgIHJldHVybiBzdXBlci5zaWduKHNpZ25QYXJhbXMpO1xuICB9XG59XG4iXX0=
@@ -0,0 +1,12 @@
1
+ /// <reference types="node" />
2
+ import { DashTransaction } from './DashTransaction';
3
+ import { PsbtOpts, UtxoPsbt } from '../UtxoPsbt';
4
+ import { Network } from '../../networks';
5
+ import { Psbt as PsbtBase } from 'bip174';
6
+ export declare class DashPsbt extends UtxoPsbt<DashTransaction<bigint>> {
7
+ protected static transactionFromBuffer(buffer: Buffer, network: Network): DashTransaction<bigint>;
8
+ static createPsbt(opts: PsbtOpts, data?: PsbtBase): DashPsbt;
9
+ setType(type: number): DashPsbt;
10
+ setExtraPayload(extraPayload?: Buffer): DashPsbt;
11
+ }
12
+ //# sourceMappingURL=DashPsbt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashPsbt.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/bbc/DashPsbt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAG1C,qBAAa,QAAS,SAAQ,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC7D,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC;IAIjG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAO5D,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;IAM/B,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ;CAKjD"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DashPsbt = void 0;
4
+ const DashTransaction_1 = require("./DashTransaction");
5
+ const UtxoPsbt_1 = require("../UtxoPsbt");
6
+ const bip174_1 = require("bip174");
7
+ const bitcoinjs_lib_1 = require("bitcoinjs-lib");
8
+ class DashPsbt extends UtxoPsbt_1.UtxoPsbt {
9
+ static transactionFromBuffer(buffer, network) {
10
+ return DashTransaction_1.DashTransaction.fromBuffer(buffer, false, 'bigint', network);
11
+ }
12
+ static createPsbt(opts, data) {
13
+ return new DashPsbt(opts, data || new bip174_1.Psbt(new bitcoinjs_lib_1.PsbtTransaction({ tx: new DashTransaction_1.DashTransaction(opts.network) })));
14
+ }
15
+ setType(type) {
16
+ this.checkForSignatures('type');
17
+ this.tx.type = type;
18
+ return this;
19
+ }
20
+ setExtraPayload(extraPayload) {
21
+ this.checkForSignatures('extraPayload');
22
+ this.tx.extraPayload = extraPayload;
23
+ return this;
24
+ }
25
+ }
26
+ exports.DashPsbt = DashPsbt;
27
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJ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lwZTogbnVtYmVyKTogRGFzaFBzYnQge1xuICAgIHRoaXMuY2hlY2tGb3JTaWduYXR1cmVzKCd0eXBlJyk7XG4gICAgdGhpcy50eC50eXBlID0gdHlwZTtcbiAgICByZXR1cm4gdGhpcztcbiAgfVxuXG4gIHNldEV4dHJhUGF5bG9hZChleHRyYVBheWxvYWQ/OiBCdWZmZXIpOiBEYXNoUHNidCB7XG4gICAgdGhpcy5jaGVja0ZvclNpZ25hdHVyZXMoJ2V4dHJhUGF5bG9hZCcpO1xuICAgIHRoaXMudHguZXh0cmFQYXlsb2FkID0gZXh0cmFQYXlsb2FkO1xuICAgIHJldHVybiB0aGlzO1xuICB9XG59XG4iXX0=
@@ -0,0 +1,39 @@
1
+ /// <reference types="node" />
2
+ import { Transaction } from 'bitcoinjs-lib';
3
+ import { UtxoTransaction } from '../UtxoTransaction';
4
+ import { Network } from '../../networks';
5
+ export declare class DashTransaction<TNumber extends number | bigint = number> extends UtxoTransaction<TNumber> {
6
+ static DASH_NORMAL: number;
7
+ static DASH_PROVIDER_REGISTER: number;
8
+ static DASH_PROVIDER_UPDATE_SERVICE: number;
9
+ static DASH_PROVIDER_UPDATE_REGISTRAR: number;
10
+ static DASH_PROVIDER_UPDATE_REVOKE: number;
11
+ static DASH_COINBASE: number;
12
+ static DASH_QUORUM_COMMITMENT: number;
13
+ type: number;
14
+ extraPayload?: Buffer;
15
+ constructor(network: Network, tx?: Transaction<bigint | number>, amountType?: 'bigint' | 'number');
16
+ protected static newTransaction<TNumber extends number | bigint = number>(network: Network, transaction?: DashTransaction<number | bigint>, amountType?: 'number' | 'bigint'): DashTransaction<TNumber>;
17
+ static fromBuffer<TNumber extends number | bigint = number>(buffer: Buffer, noStrict: boolean, amountType: "number" | "bigint" | undefined, network: Network): DashTransaction<TNumber>;
18
+ clone<TN2 extends bigint | number = TNumber>(amountType?: 'number' | 'bigint'): DashTransaction<TN2>;
19
+ byteLength(_ALLOW_WITNESS?: boolean): number;
20
+ /**
21
+ * Helper to override `__toBuffer()` of bitcoinjs.Transaction.
22
+ * Since the method is private, we use a hack in the constructor to make it work.
23
+ *
24
+ * TODO: remove `private` modifier in bitcoinjs `__toBuffer()` or find some other solution
25
+ *
26
+ * @param buffer - optional target buffer
27
+ * @param initialOffset - can only be undefined or 0. Other values are only used for serialization in blocks.
28
+ * @param _ALLOW_WITNESS - ignored
29
+ */
30
+ private toBufferWithExtraPayload;
31
+ getHash(forWitness?: boolean): Buffer;
32
+ /**
33
+ * Build a hash for all or none of the transaction inputs depending on the hashtype
34
+ * @param hashType
35
+ * @returns Buffer
36
+ */
37
+ getPrevoutHash(hashType: number): Buffer;
38
+ }
39
+ //# sourceMappingURL=DashTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashTransaction.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/bbc/DashTransaction.ts"],"names":[],"mappings":";AACA,OAAO,EAAqB,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAgB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAS,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEhD,qBAAa,eAAe,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IACrG,MAAM,CAAC,WAAW,SAAK;IACvB,MAAM,CAAC,sBAAsB,SAAK;IAClC,MAAM,CAAC,4BAA4B,SAAK;IACxC,MAAM,CAAC,8BAA8B,SAAK;IAC1C,MAAM,CAAC,2BAA2B,SAAK;IACvC,MAAM,CAAC,aAAa,SAAK;IACzB,MAAM,CAAC,sBAAsB,SAAK;IAE3B,IAAI,SAAK;IACT,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAoBjG,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EACtE,OAAO,EAAE,OAAO,EAChB,WAAW,CAAC,EAAE,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC,EAC9C,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAC/B,eAAe,CAAC,OAAO,CAAC;IAI3B,MAAM,CAAC,UAAU,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EACxD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,EACjB,UAAU,iCAAgC,EAC1C,OAAO,EAAE,OAAO,GACf,eAAe,CAAC,OAAO,CAAC;IAW3B,KAAK,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC;IAIpG,UAAU,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM;IAI5C;;;;;;;;;OASG;IACH,OAAO,CAAC,wBAAwB;IA8BhC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAOrC;;;;OAIG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAczC"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DashTransaction = void 0;
4
+ const bufferutils_1 = require("bitcoinjs-lib/src/bufferutils");
5
+ const bitcoinjs_lib_1 = require("bitcoinjs-lib");
6
+ const UtxoTransaction_1 = require("../UtxoTransaction");
7
+ const networks_1 = require("../../networks");
8
+ class DashTransaction extends UtxoTransaction_1.UtxoTransaction {
9
+ constructor(network, tx, amountType) {
10
+ super(network, tx, amountType);
11
+ this.type = 0;
12
+ if (!networks_1.isBbc(network)) {
13
+ throw new Error(`invalid network`);
14
+ }
15
+ if (tx) {
16
+ this.version = tx.version;
17
+ if (tx instanceof DashTransaction) {
18
+ this.type = tx.type;
19
+ this.extraPayload = tx.extraPayload;
20
+ }
21
+ }
22
+ // since `__toBuffer` is private we have to do a little hack here
23
+ this.__toBuffer = this.toBufferWithExtraPayload;
24
+ }
25
+ static newTransaction(network, transaction, amountType) {
26
+ return new DashTransaction(network, transaction, amountType);
27
+ }
28
+ static fromBuffer(buffer, noStrict, amountType = 'number', network) {
29
+ const tx = new DashTransaction(network, super.fromBuffer(buffer, true, amountType, network));
30
+ tx.type = tx.version >> 16;
31
+ tx.version = tx.version & 0xffff;
32
+ if (tx.byteLength() !== buffer.length) {
33
+ const bufferReader = new bufferutils_1.BufferReader(buffer, tx.byteLength());
34
+ tx.extraPayload = bufferReader.readVarSlice();
35
+ }
36
+ return tx;
37
+ }
38
+ clone(amountType) {
39
+ return new DashTransaction(this.network, this, amountType);
40
+ }
41
+ byteLength(_ALLOW_WITNESS) {
42
+ return super.byteLength(_ALLOW_WITNESS) + (this.extraPayload ? UtxoTransaction_1.varSliceSize(this.extraPayload) : 0);
43
+ }
44
+ /**
45
+ * Helper to override `__toBuffer()` of bitcoinjs.Transaction.
46
+ * Since the method is private, we use a hack in the constructor to make it work.
47
+ *
48
+ * TODO: remove `private` modifier in bitcoinjs `__toBuffer()` or find some other solution
49
+ *
50
+ * @param buffer - optional target buffer
51
+ * @param initialOffset - can only be undefined or 0. Other values are only used for serialization in blocks.
52
+ * @param _ALLOW_WITNESS - ignored
53
+ */
54
+ toBufferWithExtraPayload(buffer, initialOffset, _ALLOW_WITNESS = false) {
55
+ // We can ignore the `_ALLOW_WITNESS` parameter here since it has no effect.
56
+ if (!buffer) {
57
+ buffer = Buffer.allocUnsafe(this.byteLength(false));
58
+ }
59
+ if (initialOffset !== undefined && initialOffset !== 0) {
60
+ throw new Error(`not supported`);
61
+ }
62
+ // Start out with regular bitcoin byte sequence.
63
+ // This buffer will have excess size because it uses `byteLength()` to allocate.
64
+ const baseBuffer = bitcoinjs_lib_1.Transaction.prototype.__toBuffer.call(this);
65
+ baseBuffer.copy(buffer);
66
+ // overwrite leading version bytes (uint16 version, uint16 type)
67
+ const bufferWriter = new bufferutils_1.BufferWriter(buffer, 0);
68
+ bufferWriter.writeUInt32((this.version & 0xffff) | (this.type << 16));
69
+ // Seek to end of original byte sequence and add extraPayload.
70
+ // We must use the byteLength as calculated by the bitcoinjs implementation since
71
+ // `baseBuffer` has an excess size.
72
+ if (this.extraPayload) {
73
+ bufferWriter.offset = bitcoinjs_lib_1.Transaction.prototype.byteLength.call(this);
74
+ bufferWriter.writeVarSlice(this.extraPayload);
75
+ }
76
+ return buffer;
77
+ }
78
+ getHash(forWitness) {
79
+ if (forWitness) {
80
+ throw new Error(`invalid argument`);
81
+ }
82
+ return bitcoinjs_lib_1.crypto.hash256(this.toBuffer());
83
+ }
84
+ /**
85
+ * Build a hash for all or none of the transaction inputs depending on the hashtype
86
+ * @param hashType
87
+ * @returns Buffer
88
+ */
89
+ getPrevoutHash(hashType) {
90
+ if (!(hashType & UtxoTransaction_1.UtxoTransaction.SIGHASH_ANYONECANPAY)) {
91
+ const bufferWriter = new bufferutils_1.BufferWriter(Buffer.allocUnsafe(36 * this.ins.length));
92
+ this.ins.forEach(function (txIn) {
93
+ bufferWriter.writeSlice(txIn.hash);
94
+ bufferWriter.writeUInt32(txIn.index);
95
+ });
96
+ return bitcoinjs_lib_1.crypto.hash256(bufferWriter.buffer);
97
+ }
98
+ return Buffer.alloc(32, 0);
99
+ }
100
+ }
101
+ exports.DashTransaction = DashTransaction;
102
+ DashTransaction.DASH_NORMAL = 0;
103
+ DashTransaction.DASH_PROVIDER_REGISTER = 1;
104
+ DashTransaction.DASH_PROVIDER_UPDATE_SERVICE = 2;
105
+ DashTransaction.DASH_PROVIDER_UPDATE_REGISTRAR = 3;
106
+ DashTransaction.DASH_PROVIDER_UPDATE_REVOKE = 4;
107
+ DashTransaction.DASH_COINBASE = 5;
108
+ DashTransaction.DASH_QUORUM_COMMITMENT = 6;
109
+ //# sourceMappingURL=data:application/json;base64,eyJ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YWN0aW9uLlNJR0hBU0hfQU5ZT05FQ0FOUEFZKSkge1xuICAgICAgY29uc3QgYnVmZmVyV3JpdGVyID0gbmV3IEJ1ZmZlcldyaXRlcihCdWZmZXIuYWxsb2NVbnNhZmUoMzYgKiB0aGlzLmlucy5sZW5ndGgpKTtcblxuICAgICAgdGhpcy5pbnMuZm9yRWFjaChmdW5jdGlvbiAodHhJbikge1xuICAgICAgICBidWZmZXJXcml0ZXIud3JpdGVTbGljZSh0eEluLmhhc2gpO1xuICAgICAgICBidWZmZXJXcml0ZXIud3JpdGVVSW50MzIodHhJbi5pbmRleCk7XG4gICAgICB9KTtcblxuICAgICAgcmV0dXJuIGJjcnlwdG8uaGFzaDI1NihidWZmZXJXcml0ZXIuYnVmZmVyKTtcbiAgICB9XG5cbiAgICByZXR1cm4gQnVmZmVyLmFsbG9jKDMyLCAwKTtcbiAgfVxufVxuIl19
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ import * as bitcoinjs from 'bitcoinjs-lib';
3
+ import { Network } from '../../networks';
4
+ import { UtxoTransactionBuilder } from '../UtxoTransactionBuilder';
5
+ import { DashTransaction } from './DashTransaction';
6
+ import { UtxoTransaction } from '../UtxoTransaction';
7
+ export declare class DashTransactionBuilder<TNumber extends number | bigint = number> extends UtxoTransactionBuilder<TNumber, DashTransaction<TNumber>> {
8
+ constructor(network: Network, tx?: UtxoTransaction<TNumber>);
9
+ protected static newTransactionBuilder<TNumber extends number | bigint>(network: Network, tx: UtxoTransaction<TNumber>): DashTransactionBuilder<TNumber>;
10
+ protected createInitialTransaction(network: Network, tx?: bitcoinjs.Transaction<TNumber>): DashTransaction<TNumber>;
11
+ setType(type: number): void;
12
+ setExtraPayload(extraPayload?: Buffer): void;
13
+ }
14
+ //# sourceMappingURL=DashTransactionBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashTransactionBuilder.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/bbc/DashTransactionBuilder.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,sBAAsB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAE,SAAQ,sBAAsB,CAC1G,OAAO,EACP,eAAe,CAAC,OAAO,CAAC,CACzB;gBACa,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC;IAQ3D,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACpE,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,GAC3B,sBAAsB,CAAC,OAAO,CAAC;IAIlC,SAAS,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC;IAInH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3B,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;CAG7C"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DashTransactionBuilder = void 0;
4
+ const UtxoTransactionBuilder_1 = require("../UtxoTransactionBuilder");
5
+ const DashTransaction_1 = require("./DashTransaction");
6
+ class DashTransactionBuilder extends UtxoTransactionBuilder_1.UtxoTransactionBuilder {
7
+ constructor(network, tx) {
8
+ super(network, tx);
9
+ if (tx instanceof DashTransaction_1.DashTransaction) {
10
+ this.setType(tx.type);
11
+ this.setExtraPayload(tx.extraPayload);
12
+ }
13
+ }
14
+ static newTransactionBuilder(network, tx) {
15
+ return new DashTransactionBuilder(network, tx);
16
+ }
17
+ createInitialTransaction(network, tx) {
18
+ return new DashTransaction_1.DashTransaction(network, tx);
19
+ }
20
+ setType(type) {
21
+ this.tx.type = type;
22
+ }
23
+ setExtraPayload(extraPayload) {
24
+ this.tx.extraPayload = extraPayload;
25
+ }
26
+ }
27
+ exports.DashTransactionBuilder = DashTransactionBuilder;
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGFzaFRyYW5zYWN0aW9uQnVpbGRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iaXRnby9iYmMvRGFzaFRyYW5zYWN0aW9uQnVpbGRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxzRUFBbUU7QUFDbkUsdURBQW9EO0FBR3BELE1BQWEsc0JBQWlFLFNBQVEsK0NBR3JGO0lBQ0MsWUFBWSxPQUFnQixFQUFFLEVBQTZCO1FBQ3pELEtBQUssQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFDbkIsSUFBSSxFQUFFLFlBQVksaUNBQWUsRUFBRTtZQUNqQyxJQUFJLENBQUMsT0FBTyxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUN0QixJQUFJLENBQUMsZUFBZSxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsQ0FBQztTQUN2QztJQUNILENBQUM7SUFFUyxNQUFNLENBQUMscUJBQXFCLENBQ3BDLE9BQWdCLEVBQ2hCLEVBQTRCO1FBRTVCLE9BQU8sSUFBSSxzQkFBc0IsQ0FBVSxPQUFPLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFDMUQsQ0FBQztJQUVTLHdCQUF3QixDQUFDLE9BQWdCLEVBQUUsRUFBbUM7UUFDdEYsT0FB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ikge1xuICAgICAgdGhpcy5zZXRUeXBlKHR4LnR5cGUpO1xuICAgICAgdGhpcy5zZXRFeHRyYVBheWxvYWQodHguZXh0cmFQYXlsb2FkKTtcbiAgICB9XG4gIH1cblxuICBwcm90ZWN0ZWQgc3RhdGljIG5ld1RyYW5zYWN0aW9uQnVpbGRlcjxUTnVtYmVyIGV4dGVuZHMgbnVtYmVyIHwgYmlnaW50PihcbiAgICBuZXR3b3JrOiBOZXR3b3JrLFxuICAgIHR4OiBVdHhvVHJhbnNhY3Rpb248VE51bWJlcj5cbiAgKTogRGFzaFRyYW5zYWN0aW9uQnVpbGRlcjxUTnVtYmVyPiB7XG4gICAgcmV0dXJuIG5ldyBEYXNoVHJhbnNhY3Rpb25CdWlsZGVyPFROdW1iZXI+KG5ldHdvcmssIHR4KTtcbiAgfVxuXG4gIHByb3RlY3RlZCBjcmVhdGVJbml0aWFsVHJhbnNhY3Rpb24obmV0d29yazogTmV0d29yaywgdHg/OiBiaXRjb2luanMuVHJhbnNhY3Rpb248VE51bWJlcj4pOiBEYXNoVHJhbnNhY3Rpb248VE51bWJlcj4ge1xuICAgIHJldHVybiBuZXcgRGFzaFRyYW5zYWN0aW9uPFROdW1iZXI+KG5ldHdvcmssIHR4KTtcbiAgfVxuXG4gIHNldFR5cGUodHlwZTogbnVtYmVyKTogdm9pZCB7XG4gICAgdGhpcy50eC50eXBlID0gdHlwZTtcbiAgfVxuXG4gIHNldEV4dHJhUGF5bG9hZChleHRyYVBheWxvYWQ/OiBCdWZmZXIpOiB2b2lkIHtcbiAgICB0aGlzLnR4LmV4dHJhUGF5bG9hZCA9IGV4dHJhUGF5bG9hZDtcbiAgfVxufVxuIl19
@@ -0,0 +1,4 @@
1
+ export * from './DashPsbt';
2
+ export * from './DashTransaction';
3
+ export * from './DashTransactionBuilder';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/bbc/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./DashPsbt"), exports);
14
+ __exportStar(require("./DashTransaction"), exports);
15
+ __exportStar(require("./DashTransactionBuilder"), exports);
16
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vYmJjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLDZDQUEyQjtBQUMzQixvREFBa0M7QUFDbEMsMkRBQXlDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9EYXNoUHNidCc7XG5leHBvcnQgKiBmcm9tICcuL0Rhc2hUcmFuc2FjdGlvbic7XG5leHBvcnQgKiBmcm9tICcuL0Rhc2hUcmFuc2FjdGlvbkJ1aWxkZXInO1xuIl19
@@ -0,0 +1,35 @@
1
+ /// <reference types="node" />
2
+ import { Network } from '../../networks';
3
+ import { AddressFormat } from '../../addressFormat';
4
+ /**
5
+ * @param network
6
+ * @return network-specific cashaddr prefix
7
+ */
8
+ export declare function getPrefix(network: Network): string;
9
+ /**
10
+ * @param outputScript
11
+ * @param network
12
+ * @return outputScript encoded as cashaddr (prefixed, lowercase)
13
+ */
14
+ export declare function fromOutputScriptToCashAddress(outputScript: Buffer, network: Network): string;
15
+ /**
16
+ * @param address - Accepts addresses with and without prefix. Accepts all-lowercase and all-uppercase addresses. Rejects mixed-case addresses.
17
+ * @param network
18
+ * @return decoded output script
19
+ */
20
+ export declare function toOutputScriptFromCashAddress(address: string, network: Network): Buffer;
21
+ /**
22
+ * @param outputScript
23
+ * @param format
24
+ * @param network
25
+ * @return address in specified format
26
+ */
27
+ export declare function fromOutputScriptWithFormat(outputScript: Buffer, format: AddressFormat, network: Network): string;
28
+ /**
29
+ * @param address
30
+ * @param format
31
+ * @param network
32
+ * @return output script from address in specified format
33
+ */
34
+ export declare function toOutputScriptWithFormat(address: string, format: AddressFormat, network: Network): Buffer;
35
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/bitcoincash/address.ts"],"names":[],"mappings":";AAeA,OAAO,EAA0C,OAAO,EAAY,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAoBpD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAalD;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAc5F;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CA6BvF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAchH;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAczG"}