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,151 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toOutputScriptWithFormat = exports.fromOutputScriptWithFormat = exports.toOutputScriptFromCashAddress = exports.fromOutputScriptToCashAddress = exports.getPrefix = void 0;
4
+ /**
5
+ * Wrapper around `cashaddress` library.
6
+ *
7
+ * Performs some address sanitation:
8
+ * - add prefix if missing
9
+ * - normalize to lower-case
10
+ * - reject mixed-case
11
+ *
12
+ * Based on these documents
13
+ *
14
+ * - https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md
15
+ * - https://www.bitcoinabc.org/cashaddr/
16
+ */
17
+ const cashaddress = require("cashaddress");
18
+ const bitcoinjs = require("bitcoinjs-lib");
19
+ const networks_1 = require("../../networks");
20
+ /**
21
+ * @param name
22
+ * @param output
23
+ * @return the encoded pubkeyhash or scripthash
24
+ */
25
+ function getHashFromOutputScript(name, output) {
26
+ const func = bitcoinjs.payments[name];
27
+ if (!func) {
28
+ throw new Error(`no payment with name ${name}`);
29
+ }
30
+ try {
31
+ return func({ output }).hash;
32
+ }
33
+ catch (e) {
34
+ return undefined;
35
+ }
36
+ }
37
+ /**
38
+ * @param network
39
+ * @return network-specific cashaddr prefix
40
+ */
41
+ function getPrefix(network) {
42
+ switch (network) {
43
+ case networks_1.networks.bitcoincash:
44
+ return 'bitcoincash';
45
+ case networks_1.networks.bitcoincashTestnet:
46
+ return 'bchtest';
47
+ case networks_1.networks.ecash:
48
+ return 'ecash';
49
+ case networks_1.networks.ecashTest:
50
+ return 'ecashtest';
51
+ default:
52
+ throw new Error(`unsupported prefix for ${networks_1.getNetworkName(network)}`);
53
+ }
54
+ }
55
+ exports.getPrefix = getPrefix;
56
+ /**
57
+ * @param outputScript
58
+ * @param network
59
+ * @return outputScript encoded as cashaddr (prefixed, lowercase)
60
+ */
61
+ function fromOutputScriptToCashAddress(outputScript, network) {
62
+ if (!networks_1.isBitcoinCash(network) && !networks_1.isECash(network)) {
63
+ throw new Error(`invalid network`);
64
+ }
65
+ for (const [paymentName, scriptType] of [
66
+ ['p2pkh', 'pubkeyhash'],
67
+ ['p2sh', 'scripthash'],
68
+ ]) {
69
+ const hash = getHashFromOutputScript(paymentName, outputScript);
70
+ if (hash) {
71
+ return cashaddress.encode(getPrefix(network), scriptType, hash);
72
+ }
73
+ }
74
+ throw new Error(`could not determine hash for outputScript`);
75
+ }
76
+ exports.fromOutputScriptToCashAddress = fromOutputScriptToCashAddress;
77
+ /**
78
+ * @param address - Accepts addresses with and without prefix. Accepts all-lowercase and all-uppercase addresses. Rejects mixed-case addresses.
79
+ * @param network
80
+ * @return decoded output script
81
+ */
82
+ function toOutputScriptFromCashAddress(address, network) {
83
+ if (!networks_1.isBitcoinCash(network) && !networks_1.isECash(network)) {
84
+ throw new Error(`invalid network`);
85
+ }
86
+ if (address === address.toUpperCase()) {
87
+ address = address.toLowerCase();
88
+ }
89
+ if (address !== address.toLowerCase()) {
90
+ throw new Error(`mixed-case addresses not allowed`);
91
+ }
92
+ if (!address.startsWith(getPrefix(network) + ':')) {
93
+ address = `${getPrefix(network)}:${address}`;
94
+ }
95
+ const decoded = cashaddress.decode(address);
96
+ let outputScript;
97
+ switch (decoded.version) {
98
+ case 'scripthash':
99
+ outputScript = bitcoinjs.payments.p2sh({ hash: decoded.hash }).output;
100
+ break;
101
+ case 'pubkeyhash':
102
+ outputScript = bitcoinjs.payments.p2pkh({ hash: decoded.hash }).output;
103
+ break;
104
+ default:
105
+ throw new Error(`unknown version ${decoded.version}`);
106
+ }
107
+ if (!outputScript) {
108
+ throw new Error(`could not determine output script`);
109
+ }
110
+ return outputScript;
111
+ }
112
+ exports.toOutputScriptFromCashAddress = toOutputScriptFromCashAddress;
113
+ /**
114
+ * @param outputScript
115
+ * @param format
116
+ * @param network
117
+ * @return address in specified format
118
+ */
119
+ function fromOutputScriptWithFormat(outputScript, format, network) {
120
+ if (!networks_1.isBitcoinCash(network) && !networks_1.isECash(network)) {
121
+ throw new Error(`invalid network`);
122
+ }
123
+ if (format === 'cashaddr') {
124
+ return fromOutputScriptToCashAddress(outputScript, network);
125
+ }
126
+ if (format === 'default') {
127
+ return bitcoinjs.address.fromOutputScript(outputScript, network);
128
+ }
129
+ throw new Error(`invalid format`);
130
+ }
131
+ exports.fromOutputScriptWithFormat = fromOutputScriptWithFormat;
132
+ /**
133
+ * @param address
134
+ * @param format
135
+ * @param network
136
+ * @return output script from address in specified format
137
+ */
138
+ function toOutputScriptWithFormat(address, format, network) {
139
+ if (!networks_1.isBitcoinCash(network) && !networks_1.isECash(network)) {
140
+ throw new Error(`invalid network`);
141
+ }
142
+ if (format === 'cashaddr') {
143
+ return toOutputScriptFromCashAddress(address, network);
144
+ }
145
+ if (format === 'default') {
146
+ return bitcoinjs.address.toOutputScript(address, network);
147
+ }
148
+ throw new Error(`invalid format`);
149
+ }
150
+ exports.toOutputScriptWithFormat = toOutputScriptWithFormat;
151
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iaXRnby9iaXRjb2luY2FzaC9hZGRyZXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBOzs7Ozs7Ozs7Ozs7R0FZRztBQUNILDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsNkNBQTJGO0FBRzNGOzs7O0dBSUc7QUFDSCxTQUFTLHVCQUF1QixDQUFDLElBQVksRUFBRSxNQUFjO0lBRTNELE1BQU0sSUFBSSxHQUFJLFNBQVMsQ0FBQyxRQUFtRCxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ2xGLElBQUksQ0FBQyxJQUFJLEVBQUU7UUFDVCxNQUFNLElBQUksS0FBSyxDQUFDLHdCQUF3QixJQUFJLEVBQUUsQ0FBQyxDQUFDO0tBQ2pEO0lBQ0QsSUFBSTtRQUNGLE9BQU8sSUFBSSxDQUFDLEVBQUUsTUFBTSxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUM7S0FDOUI7SUFBQyxPQUFPLENBQUMsRUFBRTtRQUNWLE9BQU8sU0FBUyxDQUFDO0tBQ2xCO0FBQ0gsQ0FBQztBQUVEOzs7R0FHRztBQUNILFNBQWdCLFNBQVMsQ0FBQyxPQUFnQjtJQUN4QyxRQUFRLE9BQU8sRUFBRTtRQUNmLEtBQUssbUJBQVEsQ0FBQyxXQUFXO1lBQ3ZCLE9BQU8sYUFBYSxDQUFDO1FBQ3ZCLEtBQUssbUJBQVEsQ0FBQyxrQkFBa0I7WUFDOUIsT0FBTyxTQUFTLENBQUM7UUFDbkIsS0FBSyxtQk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cmlwdEZyb21DYXNoQWRkcmVzcyhhZGRyZXNzLCBuZXR3b3JrKTtcbiAgfVxuXG4gIGlmIChmb3JtYXQgPT09ICdkZWZhdWx0Jykge1xuICAgIHJldHVybiBiaXRjb2luanMuYWRkcmVzcy50b091dHB1dFNjcmlwdChhZGRyZXNzLCBuZXR3b3JrIGFzIGJpdGNvaW5qcy5OZXR3b3JrKTtcbiAgfVxuXG4gIHRocm93IG5ldyBFcnJvcihgaW52YWxpZCBmb3JtYXRgKTtcbn1cbiJdfQ==
@@ -0,0 +1,2 @@
1
+ export * from './address';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/bitcoincash/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,14 @@
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("./address"), exports);
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vYml0Y29pbmNhc2gvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsNENBQTBCIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9hZGRyZXNzJztcbiJdfQ==
@@ -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/dash/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGFzaFBzYnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vZGFzaC9EYXNoUHNidC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSx1REFBb0Q7QUFDcEQsMENBQWlEO0FBRWpELG1DQUEwQztBQUMxQyxpREFBZ0Q7QUFFaEQsTUFBYSxRQUFTLFNBQVEsbUJBQWlDO0lBQ25ELE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxNQUFjLEVBQUUsT0FBZ0I7UUFDckUsT0FBTyxpQ0FBZSxDQUFDLFVBQVUsQ0FBUyxNQUFNLEVBQUUsS0FBSyxFQUFFLFFBQVEsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUM5RSxDQUFDO0lBRUQsTUFBTSxDQUFDLFVBQVUsQ0FBQyxJQUFjLEVBQ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aWdpbnQ+PiB7XG4gIHByb3RlY3RlZCBzdGF0aWMgdHJhbnNhY3Rpb25Gcm9tQnVmZmVyKGJ1ZmZlcjogQnVmZmVyLCBuZXR3b3JrOiBOZXR3b3JrKTogRGFzaFRyYW5zYWN0aW9uPGJpZ2ludD4ge1xuICAgIHJldHVybiBEYXNoVHJhbnNhY3Rpb24uZnJvbUJ1ZmZlcjxiaWdpbnQ+KGJ1ZmZlciwgZmFsc2UsICdiaWdpbnQnLCBuZXR3b3JrKTtcbiAgfVxuXG4gIHN0YXRpYyBjcmVhdGVQc2J0KG9wdHM6IFBzYnRPcHRzLCBkYXRhPzogUHNidEJhc2UpOiBEYXNoUHNidCB7XG4gICAgcmV0dXJuIG5ldyBEYXNoUHNidChcbiAgICAgIG9wdHMsXG4gICAgICBkYXRhIHx8IG5ldyBQc2J0QmFzZShuZXcgUHNidFRyYW5zYWN0aW9uKHsgdHg6IG5ldyBEYXNoVHJhbnNhY3Rpb248YmlnaW50PihvcHRzLm5ldHdvcmspIH0pKVxuICAgICk7XG4gIH1cblxuICBzZXRUeXBlKHR5cGU6IG51bWJlcik6IERhc2hQc2J0IHtcbiAgICB0aGlzLmNoZWNrRm9yU2lnbmF0dXJlcygndHlwZScpO1xuICAgIHRoaXMudHgudHlwZSA9IHR5cGU7XG4gICAgcmV0dXJuIHRoaXM7XG4gIH1cblxuICBzZXRFeHRyYVBheWxvYWQoZXh0cmFQYXlsb2FkPzogQnVmZmVyKTogRGFzaFBzYnQge1xuICAgIHRoaXMuY2hlY2tGb3JTaWduYXR1cmVzKCdleHRyYVBheWxvYWQnKTtcbiAgICB0aGlzLnR4LmV4dHJhUGF5bG9hZCA9IGV4dHJhUGF5bG9hZDtcbiAgICByZXR1cm4gdGhpcztcbiAgfVxufVxuIl19
@@ -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/dash/DashTransaction.ts"],"names":[],"mappings":";AACA,OAAO,E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C;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.isDash(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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGFzaFRyYW5zYWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2JpdGdvL2Rhc2gvRGFzaFRyYW5zYWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtEQUEyRTtBQUMzRSxpREFBK0Q7QUFFL0Qsd0RBQW1FO0FBQ25FLDZDQUFpRDtBQUVqRCxNQUFhLGVBQTBELFNBQVEsaUNBQXdCO0lBWXJHLFlBQVksT0FBZ0IsRUFBRSxFQUFpQyxFQUFFLFVBQWdDO1FBQy9GLEtBQUssQ0FBQyxPQUFPLEVBQUUsRUFBRSxFQUFFLFVBQVUsQ0FBQyxDQUFDO1FBSjFCLFNBQUksR0FBRyxDQUFDLENBQUM7UUFNZCxJQUFJLENBQUMsaUJB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19
@@ -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/dash/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGFzaFRyYW5zYWN0aW9uQnVpbGRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iaXRnby9kYXNoL0Rhc2hUcmFuc2FjdGlvbkJ1aWxkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5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YXRlSW5pdGlhbFRyYW5zYWN0aW9uKG5ldHdvcms6IE5ldHdvcmssIHR4PzogYml0Y29pbmpzLlRyYW5zYWN0aW9uPFROdW1iZXI+KTogRGFzaFRyYW5zYWN0aW9uPFROdW1iZXI+IHtcbiAgICByZXR1cm4gbmV3IERhc2hUcmFuc2FjdGlvbjxUTnVtYmVyPihuZXR3b3JrLCB0eCk7XG4gIH1cblxuICBzZXRUeXBlKHR5cGU6IG51bWJlcik6IHZvaWQge1xuICAgIHRoaXMudHgudHlwZSA9IHR5cGU7XG4gIH1cblxuICBzZXRFeHRyYVBheWxvYWQoZXh0cmFQYXlsb2FkPzogQnVmZmVyKTogdm9pZCB7XG4gICAgdGhpcy50eC5leHRyYVBheWxvYWQgPSBleHRyYVBheWxvYWQ7XG4gIH1cbn1cbiJdfQ==
@@ -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/dash/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vZGFzaC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSw2Q0FBMkI7QUFDM0Isb0RBQWtDO0FBQ2xDLDJEQUF5QyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vRGFzaFBzYnQnO1xuZXhwb3J0ICogZnJvbSAnLi9EYXNoVHJhbnNhY3Rpb24nO1xuZXhwb3J0ICogZnJvbSAnLi9EYXNoVHJhbnNhY3Rpb25CdWlsZGVyJztcbiJdfQ==
@@ -0,0 +1,17 @@
1
+ export * as bcashAddress from './bitcoincash';
2
+ export * as keyutil from './keyutil';
3
+ export * as nonStandardHalfSigned from './nonStandardHalfSigned';
4
+ export * as outputScripts from './outputScripts';
5
+ export * from './dash';
6
+ export * from './parseInput';
7
+ export * from './signature';
8
+ export * from './transaction';
9
+ export * from './types';
10
+ export * from './Unspent';
11
+ export * from './UtxoPsbt';
12
+ export * from './UtxoTransaction';
13
+ export * from './UtxoTransactionBuilder';
14
+ export * from './wallet';
15
+ export * from './zcash';
16
+ export * from './tnumber';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bitgo/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,qBAAqB,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,30 @@
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
+ exports.outputScripts = exports.nonStandardHalfSigned = exports.keyutil = exports.bcashAddress = void 0;
14
+ exports.bcashAddress = require("./bitcoincash");
15
+ exports.keyutil = require("./keyutil");
16
+ exports.nonStandardHalfSigned = require("./nonStandardHalfSigned");
17
+ exports.outputScripts = require("./outputScripts");
18
+ __exportStar(require("./dash"), exports);
19
+ __exportStar(require("./parseInput"), exports);
20
+ __exportStar(require("./signature"), exports);
21
+ __exportStar(require("./transaction"), exports);
22
+ __exportStar(require("./types"), exports);
23
+ __exportStar(require("./Unspent"), exports);
24
+ __exportStar(require("./UtxoPsbt"), exports);
25
+ __exportStar(require("./UtxoTransaction"), exports);
26
+ __exportStar(require("./UtxoTransactionBuilder"), exports);
27
+ __exportStar(require("./wallet"), exports);
28
+ __exportStar(require("./zcash"), exports);
29
+ __exportStar(require("./tnumber"), exports);
30
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia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c2FjdGlvbkJ1aWxkZXInO1xuZXhwb3J0ICogZnJvbSAnLi93YWxsZXQnO1xuZXhwb3J0ICogZnJvbSAnLi96Y2FzaCc7XG5leHBvcnQgKiBmcm9tICcuL3RudW1iZXInO1xuIl19
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ import { ECPairInterface } from 'ecpair';
3
+ import { Network } from '../networks';
4
+ /**
5
+ * Create an ECPair from the raw private key bytes
6
+ * @param {Buffer} buffer - Private key for the ECPair. Must be exactly 32 bytes.
7
+ * @param {Object} [network] - Network for the ECPair. Defaults to bitcoin.
8
+ * @return {ECPair}
9
+ */
10
+ export declare function privateKeyBufferToECPair(buffer: Buffer, network?: Network): ECPairInterface;
11
+ /**
12
+ * Get the private key as a 32 bytes buffer. If it is smaller than 32 bytes, pad it with zeros
13
+ * @param {ECPair} ecPair
14
+ * @return Buffer 32 bytes
15
+ */
16
+ export declare function privateKeyBufferFromECPair(ecPair: ECPairInterface): Buffer;
17
+ //# sourceMappingURL=keyutil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyutil.d.ts","sourceRoot":"","sources":["../../../src/bitgo/keyutil.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,eAAe,CAM3F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAc1E"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.privateKeyBufferFromECPair = exports.privateKeyBufferToECPair = void 0;
4
+ const noble_ecc_1 = require("../noble_ecc");
5
+ /**
6
+ * Create an ECPair from the raw private key bytes
7
+ * @param {Buffer} buffer - Private key for the ECPair. Must be exactly 32 bytes.
8
+ * @param {Object} [network] - Network for the ECPair. Defaults to bitcoin.
9
+ * @return {ECPair}
10
+ */
11
+ function privateKeyBufferToECPair(buffer, network) {
12
+ if (!Buffer.isBuffer(buffer) || buffer.length !== 32) {
13
+ throw new Error('invalid private key buffer');
14
+ }
15
+ return noble_ecc_1.ECPair.fromPrivateKey(buffer);
16
+ }
17
+ exports.privateKeyBufferToECPair = privateKeyBufferToECPair;
18
+ /**
19
+ * Get the private key as a 32 bytes buffer. If it is smaller than 32 bytes, pad it with zeros
20
+ * @param {ECPair} ecPair
21
+ * @return Buffer 32 bytes
22
+ */
23
+ function privateKeyBufferFromECPair(ecPair) {
24
+ if (ecPair.constructor.name !== 'ECPair') {
25
+ throw new TypeError(`invalid argument ecpair`);
26
+ }
27
+ const privkey = ecPair.privateKey;
28
+ if (!Buffer.isBuffer(privkey)) {
29
+ throw new Error(`unexpected privkey type`);
30
+ }
31
+ if (privkey.length !== 32) {
32
+ throw new Error(`unexpected privkey length`);
33
+ }
34
+ return privkey;
35
+ }
36
+ exports.privateKeyBufferFromECPair = privateKeyBufferFromECPair;
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5dXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9iaXRnby9rZXl1dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUVBLDRDQUFzQztBQUV0Qzs7Ozs7R0FLRztBQUNILFNBQWdCLHdCQUF3QixDQUFDLE1BQWMsRUFBRSxPQUFpQjtJQUN4RSxJQUFJLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsSUFBSSxNQUFNLENBQUMsTUFBTSxLQUFLLEVBQUUsRUFBRTtRQUNwRCxNQUFNLElBQUksS0FBSyxDQUFDLDRCQUE0QixDQUFDLENBQUM7S0FDL0M7SUFFR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ApO1xuICB9XG4gIGlmIChwcml2a2V5Lmxlbmd0aCAhPT0gMzIpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYHVuZXhwZWN0ZWQgcHJpdmtleSBsZW5ndGhgKTtcbiAgfVxuXG4gIHJldHVybiBwcml2a2V5O1xufVxuIl19
@@ -0,0 +1,7 @@
1
+ import { TxInput } from '../';
2
+ /**
3
+ * @param input - Input of non-standard half-signed transaction created with `tx.build()` instead of `tx.buildIncomplete()`.
4
+ * @param signatureIndex - Position to map the existing signatures to. Other signatures will be padded with OP_0.
5
+ */
6
+ export declare function padInputScript(input: TxInput, signatureIndex: number): void;
7
+ //# sourceMappingURL=nonStandardHalfSigned.d.ts.map