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,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletUnspentSigner = void 0;
4
+ const WalletKeys_1 = require("./WalletKeys");
5
+ class WalletUnspentSigner {
6
+ constructor(walletKeys, signer, cosigner) {
7
+ this.signer = signer;
8
+ this.cosigner = cosigner;
9
+ if (Array.isArray(walletKeys)) {
10
+ walletKeys = new WalletKeys_1.RootWalletKeys(walletKeys);
11
+ }
12
+ this.signerIndex = walletKeys.triple.findIndex((k) => WalletKeys_1.eqPublicKey(k, signer));
13
+ if (this.signerIndex === undefined) {
14
+ throw new Error(`signer not part of walletKeys`);
15
+ }
16
+ this.cosignerIndex = walletKeys.triple.findIndex((k) => WalletKeys_1.eqPublicKey(k, cosigner));
17
+ if (this.cosignerIndex === undefined) {
18
+ throw new Error(`cosigner not part of walletKeys`);
19
+ }
20
+ this.walletKeys = walletKeys;
21
+ if (WalletKeys_1.eqPublicKey(signer, cosigner)) {
22
+ throw new Error(`signer must not equal cosigner`);
23
+ }
24
+ if (signer.isNeutered()) {
25
+ throw new Error(`signer must have private key`);
26
+ }
27
+ }
28
+ static from(walletKeys, signer, cosigner) {
29
+ return new WalletUnspentSigner(walletKeys, signer, cosigner);
30
+ }
31
+ /**
32
+ * @param chain
33
+ * @param index
34
+ * @return WalletUnspentSigner that contains keys for generating output scripts and signatures.
35
+ */
36
+ deriveForChainAndIndex(chain, index) {
37
+ if (this.walletKeys instanceof WalletKeys_1.DerivedWalletKeys) {
38
+ throw new Error(`cannot derive again from DerivedWalletKeys`);
39
+ }
40
+ if (this.walletKeys instanceof WalletKeys_1.RootWalletKeys) {
41
+ return new WalletUnspentSigner(this.walletKeys.deriveForChainAndIndex(chain, index), this.signer.derivePath(this.walletKeys.getDerivationPath(this.signer, chain, index)), this.cosigner.derivePath(this.walletKeys.getDerivationPath(this.cosigner, chain, index)));
42
+ }
43
+ throw new Error(`invalid state`);
44
+ }
45
+ }
46
+ exports.WalletUnspentSigner = WalletUnspentSigner;
47
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2FsbGV0VW5zcGVudFNpZ25lci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iaXRnby93YWxsZXQvV2FsbGV0VW5zcGVudFNpZ25lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSw2Q0FBMEY7QUFHMUYsTUFBYSxtQkFBbUI7SUFjOUIsWUFDRSxVQUErQyxFQUN4QyxNQUFzQixFQUN0QixRQUF3QjtRQUR4QixXQUFNLEdBQU4sTUFBTSxDQUFnQjtRQUN0QixhQUFRLEdBQVIsU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leXMpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgY2Fubm90IGRlcml2ZSBhZ2FpbiBmcm9tIERlcml2ZWRXYWxsZXRLZXlzYCk7XG4gICAgfVxuXG4gICAgaWYgKHRoaXMud2FsbGV0S2V5cyBpbnN0YW5jZW9mIFJvb3RXYWxsZXRLZXlzKSB7XG4gICAgICByZXR1cm4gbmV3IFdhbGxldFVuc3BlbnRTaWduZXIoXG4gICAgICAgIHRoaXMud2FsbGV0S2V5cy5kZXJpdmVGb3JDaGFpbkFuZEluZGV4KGNoYWluLCBpbmRleCksXG4gICAgICAgIHRoaXMuc2lnbmVyLmRlcml2ZVBhdGgodGhpcy53YWxsZXRLZXlzLmdldERlcml2YXRpb25QYXRoKHRoaXMuc2lnbmVyLCBjaGFpbiwgaW5kZXgpKSxcbiAgICAgICAgdGhpcy5jb3NpZ25lci5kZXJpdmVQYXRoKHRoaXMud2FsbGV0S2V5cy5nZXREZXJpdmF0aW9uUGF0aCh0aGlzLmNvc2lnbmVyLCBjaGFpbiwgaW5kZXgpKVxuICAgICAgKTtcbiAgICB9XG5cbiAgICB0aHJvdyBuZXcgRXJyb3IoYGludmFsaWQgc3RhdGVgKTtcbiAgfVxufVxuIl19
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Defines BitGo mappings between bip32 derivation path and script type.
3
+ *
4
+ * The scripts for a BitGo wallet address are defined by their derivation path.
5
+ *
6
+ * The derivation path has the format `0/0/${chain}/${index}` (in rare cases the prefix is not 0/0)
7
+ *
8
+ * The address script type (ScriptType2Of3) is defined by the `chain` parameter.
9
+ *
10
+ * This file defines the mapping between chain parameter and address type.
11
+ */
12
+ import { ScriptType2Of3 } from '../outputScripts';
13
+ /**
14
+ * All valid chain codes
15
+ */
16
+ export declare const chainCodesP2sh: readonly [0, 1];
17
+ export declare const chainCodesP2shP2wsh: readonly [10, 11];
18
+ export declare const chainCodesP2wsh: readonly [20, 21];
19
+ export declare const chainCodesP2tr: readonly [30, 31];
20
+ export declare const chainCodesP2trMusig2: readonly [40, 41];
21
+ export declare const chainCodes: (0 | 30 | 1 | 20 | 10 | 11 | 21 | 31 | 40 | 41)[];
22
+ export declare type ChainCode = typeof chainCodes[number];
23
+ export declare function isChainCode(n: unknown): n is ChainCode;
24
+ /**
25
+ * A script type maps to two ChainCodes:
26
+ * External addresses are intended for deposits, internal addresses are intended for change outputs.
27
+ */
28
+ export declare type ChainCodePair = Readonly<[external: ChainCode, internal: ChainCode]>;
29
+ /**
30
+ * @return ChainCodePair for input
31
+ */
32
+ export declare function toChainPair(v: ChainCodePair | ChainCode | ScriptType2Of3): ChainCodePair;
33
+ /**
34
+ * @return ScriptType2Of3 for input
35
+ */
36
+ export declare function scriptTypeForChain(chain: ChainCode): ScriptType2Of3;
37
+ /**
38
+ * @return chain code intended for external addresses
39
+ */
40
+ export declare function getExternalChainCode(v: ChainCodePair | ScriptType2Of3 | ChainCode): ChainCode;
41
+ /**
42
+ * @return chain code intended for change outputs
43
+ */
44
+ export declare function getInternalChainCode(v: ChainCodePair | ScriptType2Of3 | ChainCode): ChainCode;
45
+ /**
46
+ * @return true iff chain code is external
47
+ */
48
+ export declare function isExternalChainCode(v: ChainCode): boolean;
49
+ /**
50
+ * @return true iff chain code is internal
51
+ */
52
+ export declare function isInternalChainCode(v: ChainCode): boolean;
53
+ /**
54
+ * @return true iff chain code is a segwit address
55
+ */
56
+ export declare function isSegwit(v: ChainCode): boolean;
57
+ //# sourceMappingURL=chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/wallet/chains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,cAAc,iBAAkB,CAAC;AAC9C,eAAO,MAAM,mBAAmB,mBAAoB,CAAC;AACrD,eAAO,MAAM,eAAe,mBAAoB,CAAC;AACjD,eAAO,MAAM,cAAc,mBAAoB,CAAC;AAChD,eAAO,MAAM,oBAAoB,mBAAoB,CAAC;AACtD,eAAO,MAAM,UAAU,mDAMtB,CAAC;AACF,oBAAY,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAClD,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD;AAED;;;GAGG;AACH,oBAAY,aAAa,GAAG,QAAQ,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAcjF;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,cAAc,GAAG,aAAa,CAiBxF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,cAAc,CAOnE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GAAG,SAAS,CAE7F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,GAAG,SAAS,CAE7F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAQ9C"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSegwit = exports.isInternalChainCode = exports.isExternalChainCode = exports.getInternalChainCode = exports.getExternalChainCode = exports.scriptTypeForChain = exports.toChainPair = exports.isChainCode = exports.chainCodes = exports.chainCodesP2trMusig2 = exports.chainCodesP2tr = exports.chainCodesP2wsh = exports.chainCodesP2shP2wsh = exports.chainCodesP2sh = void 0;
4
+ /**
5
+ * All valid chain codes
6
+ */
7
+ exports.chainCodesP2sh = [0, 1];
8
+ exports.chainCodesP2shP2wsh = [10, 11];
9
+ exports.chainCodesP2wsh = [20, 21];
10
+ exports.chainCodesP2tr = [30, 31];
11
+ exports.chainCodesP2trMusig2 = [40, 41];
12
+ exports.chainCodes = [
13
+ ...exports.chainCodesP2sh,
14
+ ...exports.chainCodesP2shP2wsh,
15
+ ...exports.chainCodesP2wsh,
16
+ ...exports.chainCodesP2tr,
17
+ ...exports.chainCodesP2trMusig2,
18
+ ];
19
+ function isChainCode(n) {
20
+ return exports.chainCodes.includes(n);
21
+ }
22
+ exports.isChainCode = isChainCode;
23
+ const map = new Map([
24
+ ['p2sh', exports.chainCodesP2sh],
25
+ ['p2shP2wsh', exports.chainCodesP2shP2wsh],
26
+ ['p2wsh', exports.chainCodesP2wsh],
27
+ ['p2tr', exports.chainCodesP2tr],
28
+ ['p2trMusig2', exports.chainCodesP2trMusig2],
29
+ ].map(([k, v]) => [k, Object.freeze(v)]));
30
+ const pairs = [...map.values()];
31
+ /**
32
+ * @return ChainCodePair for input
33
+ */
34
+ function toChainPair(v) {
35
+ let pair;
36
+ if (Array.isArray(v)) {
37
+ if (pairs.includes(v)) {
38
+ pair = v;
39
+ }
40
+ }
41
+ if (typeof v === 'string') {
42
+ pair = map.get(v);
43
+ }
44
+ if (typeof v === 'number') {
45
+ pair = pairs.find((p) => p.includes(v));
46
+ }
47
+ if (!pair) {
48
+ throw new Error(`no pair for input ${v}`);
49
+ }
50
+ return pair;
51
+ }
52
+ exports.toChainPair = toChainPair;
53
+ /**
54
+ * @return ScriptType2Of3 for input
55
+ */
56
+ function scriptTypeForChain(chain) {
57
+ for (const [scriptType, pair] of map.entries()) {
58
+ if (pair.includes(chain)) {
59
+ return scriptType;
60
+ }
61
+ }
62
+ throw new Error(`invalid chain ${chain}`);
63
+ }
64
+ exports.scriptTypeForChain = scriptTypeForChain;
65
+ /**
66
+ * @return chain code intended for external addresses
67
+ */
68
+ function getExternalChainCode(v) {
69
+ return toChainPair(v)[0];
70
+ }
71
+ exports.getExternalChainCode = getExternalChainCode;
72
+ /**
73
+ * @return chain code intended for change outputs
74
+ */
75
+ function getInternalChainCode(v) {
76
+ return toChainPair(v)[1];
77
+ }
78
+ exports.getInternalChainCode = getInternalChainCode;
79
+ /**
80
+ * @return true iff chain code is external
81
+ */
82
+ function isExternalChainCode(v) {
83
+ return toChainPair(v).indexOf(v) === 0;
84
+ }
85
+ exports.isExternalChainCode = isExternalChainCode;
86
+ /**
87
+ * @return true iff chain code is internal
88
+ */
89
+ function isInternalChainCode(v) {
90
+ return toChainPair(v).indexOf(v) === 1;
91
+ }
92
+ exports.isInternalChainCode = isInternalChainCode;
93
+ /**
94
+ * @return true iff chain code is a segwit address
95
+ */
96
+ function isSegwit(v) {
97
+ const segwitCodes = [
98
+ ...exports.chainCodesP2shP2wsh,
99
+ ...exports.chainCodesP2wsh,
100
+ ...exports.chainCodesP2tr,
101
+ ...exports.chainCodesP2trMusig2,
102
+ ];
103
+ return segwitCodes.includes(v);
104
+ }
105
+ exports.isSegwit = isSegwit;
106
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2JpdGdvL3dhbGxldC9jaGFpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBYUE7O0dBRUc7QUFDVSxRQUFBLGNBQWMsR0FBRyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQVUsQ0FBQztBQUNqQyxRQUFBLG1CQUFtQixHQUFHLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBVSxDQUFDO0FBQ3hDLFFBQUEsZUFBZSxHQUFHLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBVSxDQUFDO0FBQ3BDLFFBQUEsY0FBYyxH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nN0IHNlZ3dpdENvZGVzOiBDaGFpbkNvZGVbXSA9IFtcbiAgICAuLi5jaGFpbkNvZGVzUDJzaFAyd3NoLFxuICAgIC4uLmNoYWluQ29kZXNQMndzaCxcbiAgICAuLi5jaGFpbkNvZGVzUDJ0cixcbiAgICAuLi5jaGFpbkNvZGVzUDJ0ck11c2lnMixcbiAgXTtcbiAgcmV0dXJuIHNlZ3dpdENvZGVzLmluY2x1ZGVzKHYpO1xufVxuIl19
@@ -0,0 +1,8 @@
1
+ export * from './chains';
2
+ export * from './Psbt';
3
+ export * from './Unspent';
4
+ export * from './WalletOutput';
5
+ export * from './WalletUnspentSigner';
6
+ export * from './WalletScripts';
7
+ export * from './WalletKeys';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,20 @@
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("./chains"), exports);
14
+ __exportStar(require("./Psbt"), exports);
15
+ __exportStar(require("./Unspent"), exports);
16
+ __exportStar(require("./WalletOutput"), exports);
17
+ __exportStar(require("./WalletUnspentSigner"), exports);
18
+ __exportStar(require("./WalletScripts"), exports);
19
+ __exportStar(require("./WalletKeys"), exports);
20
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vd2FsbGV0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLDJDQUF5QjtBQUN6Qix5Q0FBdUI7QUFDdkIsNENBQTBCO0FBQzFCLGlEQUErQjtBQUMvQix3REFBc0M7QUFDdEMsa0RBQWdDO0FBQ2hDLCtDQUE2QiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vY2hhaW5zJztcbmV4cG9ydCAqIGZyb20gJy4vUHNidCc7XG5leHBvcnQgKiBmcm9tICcuL1Vuc3BlbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9XYWxsZXRPdXRwdXQnO1xuZXhwb3J0ICogZnJvbSAnLi9XYWxsZXRVbnNwZW50U2lnbmVyJztcbmV4cG9ydCAqIGZyb20gJy4vV2FsbGV0U2NyaXB0cyc7XG5leHBvcnQgKiBmcm9tICcuL1dhbGxldEtleXMnO1xuIl19
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Transaction (de)serialization helpers.
4
+ * Only supports full transparent transactions without shielded inputs or outputs.
5
+ *
6
+ * References:
7
+ * - https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L771
8
+ */
9
+ import { TxInput, TxOutput } from 'bitcoinjs-lib';
10
+ import { BufferReader, BufferWriter } from 'bitcoinjs-lib/src/bufferutils';
11
+ import { ZcashTransaction } from './ZcashTransaction';
12
+ export declare const VALUE_INT64_ZERO: Buffer;
13
+ export declare function readInputs(bufferReader: BufferReader): TxInput[];
14
+ export declare function readOutputs<TNumber extends number | bigint>(bufferReader: BufferReader, amountType?: 'number' | 'bigint'): TxOutput<TNumber>[];
15
+ export declare function readEmptyVector(bufferReader: BufferReader): void;
16
+ export declare function readEmptyOrchardBundle(bufferReader: BufferReader): void;
17
+ export declare function writeEmptyOrchardBundle(bufferWriter: BufferWriter): void;
18
+ export declare function readEmptySaplingBundle(bufferReader: BufferReader): void;
19
+ export declare function writeEmptySamplingBundle(bufferWriter: BufferWriter): void;
20
+ export declare function fromBufferV4<TNumber extends number | bigint>(bufferReader: BufferReader, tx: ZcashTransaction<TNumber>, amountType?: 'number' | 'bigint'): void;
21
+ export declare function fromBufferV5<TNumber extends number | bigint>(bufferReader: BufferReader, tx: ZcashTransaction<TNumber>, amountType?: 'number' | 'bigint'): void;
22
+ export declare function writeInputs(bufferWriter: BufferWriter, ins: TxInput[]): void;
23
+ export declare function writeOutputs<TNumber extends number | bigint>(bufferWriter: BufferWriter, outs: TxOutput<TNumber>[]): void;
24
+ export declare function toBufferV4<TNumber extends number | bigint>(bufferWriter: BufferWriter, tx: ZcashTransaction<TNumber>): void;
25
+ export declare function toBufferV5<TNumber extends number | bigint>(bufferWriter: BufferWriter, tx: ZcashTransaction<TNumber>): void;
26
+ //# sourceMappingURL=ZcashBufferutils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZcashBufferutils.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/zcash/ZcashBufferutils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAA+B,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,eAAO,MAAM,gBAAgB,QAAyC,CAAC;AAEvE,wBAAgB,UAAU,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,EAAE,CAahE;AAED,wBAAgB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AAED,wBAAgB,UAAU,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACxD,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAC5B,IAAI,CAYN"}
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toBufferV5 = exports.toBufferV4 = exports.writeOutputs = exports.writeInputs = exports.fromBufferV5 = exports.fromBufferV4 = exports.writeEmptySamplingBundle = exports.readEmptySaplingBundle = exports.writeEmptyOrchardBundle = exports.readEmptyOrchardBundle = exports.readEmptyVector = exports.readOutputs = exports.readInputs = exports.VALUE_INT64_ZERO = void 0;
4
+ const ZcashTransaction_1 = require("./ZcashTransaction");
5
+ exports.VALUE_INT64_ZERO = Buffer.from('0000000000000000', 'hex');
6
+ function readInputs(bufferReader) {
7
+ const vinLen = bufferReader.readVarInt();
8
+ const ins = [];
9
+ for (let i = 0; i < vinLen; ++i) {
10
+ ins.push({
11
+ hash: bufferReader.readSlice(32),
12
+ index: bufferReader.readUInt32(),
13
+ script: bufferReader.readVarSlice(),
14
+ sequence: bufferReader.readUInt32(),
15
+ witness: [],
16
+ });
17
+ }
18
+ return ins;
19
+ }
20
+ exports.readInputs = readInputs;
21
+ function readOutputs(bufferReader, amountType = 'number') {
22
+ const voutLen = bufferReader.readVarInt();
23
+ const outs = [];
24
+ for (let i = 0; i < voutLen; ++i) {
25
+ outs.push({
26
+ value: (amountType === 'bigint' ? bufferReader.readUInt64BigInt() : bufferReader.readUInt64()),
27
+ script: bufferReader.readVarSlice(),
28
+ });
29
+ }
30
+ return outs;
31
+ }
32
+ exports.readOutputs = readOutputs;
33
+ function readEmptyVector(bufferReader) {
34
+ const n = bufferReader.readVarInt();
35
+ if (n !== 0) {
36
+ throw new ZcashTransaction_1.UnsupportedTransactionError(`expected empty vector`);
37
+ }
38
+ }
39
+ exports.readEmptyVector = readEmptyVector;
40
+ function readEmptyOrchardBundle(bufferReader) {
41
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/orchard.h#L66
42
+ // https://github.com/zcash/librustzcash/blob/edcde252de221d4851f1e5145306c2caf95453bc/zcash_primitives/src/transaction/components/orchard.rs#L36
43
+ const v = bufferReader.readUInt8();
44
+ if (v !== 0x00) {
45
+ throw new ZcashTransaction_1.UnsupportedTransactionError(`expected byte 0x00`);
46
+ }
47
+ }
48
+ exports.readEmptyOrchardBundle = readEmptyOrchardBundle;
49
+ function writeEmptyOrchardBundle(bufferWriter) {
50
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/orchard.h#L66
51
+ // https://github.com/zcash/librustzcash/blob/edcde252de221d4851f1e5145306c2caf95453bc/zcash_primitives/src/transaction/components/orchard.rs#L201
52
+ bufferWriter.writeUInt8(0);
53
+ }
54
+ exports.writeEmptyOrchardBundle = writeEmptyOrchardBundle;
55
+ function readEmptySaplingBundle(bufferReader) {
56
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L283
57
+ readEmptyVector(bufferReader) /* vSpendsSapling */;
58
+ readEmptyVector(bufferReader) /* vOutputsSapling */;
59
+ }
60
+ exports.readEmptySaplingBundle = readEmptySaplingBundle;
61
+ function writeEmptySamplingBundle(bufferWriter) {
62
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L283
63
+ bufferWriter.writeVarInt(0) /* vSpendsSapling */;
64
+ bufferWriter.writeVarInt(0) /* vOutputsSapling */;
65
+ }
66
+ exports.writeEmptySamplingBundle = writeEmptySamplingBundle;
67
+ function fromBufferV4(bufferReader, tx, amountType = 'number') {
68
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L855-L857
69
+ tx.ins = readInputs(bufferReader);
70
+ tx.outs = readOutputs(bufferReader, amountType);
71
+ tx.locktime = bufferReader.readUInt32();
72
+ if (tx.isOverwinterCompatible()) {
73
+ tx.expiryHeight = bufferReader.readUInt32();
74
+ }
75
+ if (tx.isSaplingCompatible()) {
76
+ const valueBalance = bufferReader.readSlice(8);
77
+ if (!valueBalance.equals(exports.VALUE_INT64_ZERO)) {
78
+ /* istanbul ignore next */
79
+ throw new ZcashTransaction_1.UnsupportedTransactionError(`valueBalance must be zero`);
80
+ }
81
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L863
82
+ readEmptySaplingBundle(bufferReader);
83
+ }
84
+ if (tx.supportsJoinSplits()) {
85
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L869
86
+ readEmptyVector(bufferReader) /* vJoinSplit */;
87
+ }
88
+ }
89
+ exports.fromBufferV4 = fromBufferV4;
90
+ function fromBufferV5(bufferReader, tx, amountType = 'number') {
91
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L815
92
+ tx.consensusBranchId = bufferReader.readUInt32();
93
+ tx.locktime = bufferReader.readUInt32();
94
+ tx.expiryHeight = bufferReader.readUInt32();
95
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L828
96
+ tx.ins = readInputs(bufferReader);
97
+ tx.outs = readOutputs(bufferReader, amountType);
98
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L835
99
+ readEmptySaplingBundle(bufferReader);
100
+ readEmptyOrchardBundle(bufferReader);
101
+ }
102
+ exports.fromBufferV5 = fromBufferV5;
103
+ function writeInputs(bufferWriter, ins) {
104
+ bufferWriter.writeVarInt(ins.length);
105
+ ins.forEach(function (txIn) {
106
+ bufferWriter.writeSlice(txIn.hash);
107
+ bufferWriter.writeUInt32(txIn.index);
108
+ bufferWriter.writeVarSlice(txIn.script);
109
+ bufferWriter.writeUInt32(txIn.sequence);
110
+ });
111
+ }
112
+ exports.writeInputs = writeInputs;
113
+ function writeOutputs(bufferWriter, outs) {
114
+ bufferWriter.writeVarInt(outs.length);
115
+ outs.forEach(function (txOut) {
116
+ if (txOut.valueBuffer) {
117
+ bufferWriter.writeSlice(txOut.valueBuffer);
118
+ }
119
+ else {
120
+ bufferWriter.writeUInt64(txOut.value);
121
+ }
122
+ bufferWriter.writeVarSlice(txOut.script);
123
+ });
124
+ }
125
+ exports.writeOutputs = writeOutputs;
126
+ function toBufferV4(bufferWriter, tx) {
127
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L1083
128
+ writeInputs(bufferWriter, tx.ins);
129
+ writeOutputs(bufferWriter, tx.outs);
130
+ bufferWriter.writeUInt32(tx.locktime);
131
+ if (tx.isOverwinterCompatible()) {
132
+ bufferWriter.writeUInt32(tx.expiryHeight);
133
+ }
134
+ if (tx.isSaplingCompatible()) {
135
+ bufferWriter.writeSlice(exports.VALUE_INT64_ZERO);
136
+ bufferWriter.writeVarInt(0); // vShieldedSpendLength
137
+ bufferWriter.writeVarInt(0); // vShieldedOutputLength
138
+ }
139
+ if (tx.supportsJoinSplits()) {
140
+ bufferWriter.writeVarInt(0); // joinsSplits length
141
+ }
142
+ }
143
+ exports.toBufferV4 = toBufferV4;
144
+ function toBufferV5(bufferWriter, tx) {
145
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L825-L826
146
+ bufferWriter.writeUInt32(tx.consensusBranchId);
147
+ bufferWriter.writeUInt32(tx.locktime);
148
+ bufferWriter.writeUInt32(tx.expiryHeight);
149
+ writeInputs(bufferWriter, tx.ins);
150
+ writeOutputs(bufferWriter, tx.outs);
151
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L1063
152
+ writeEmptySamplingBundle(bufferWriter);
153
+ // https://github.com/zcash/zcash/blob/v4.5.1/src/primitives/transaction.h#L1081
154
+ writeEmptyOrchardBundle(bufferWriter);
155
+ }
156
+ exports.toBufferV5 = toBufferV5;
157
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiWmNhc2hCdWZmZXJ1dGlscy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy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iXX0=
@@ -0,0 +1,36 @@
1
+ /// <reference types="node" />
2
+ import { PsbtOpts, UtxoPsbt } from '../UtxoPsbt';
3
+ import { ZcashTransaction } from './ZcashTransaction';
4
+ import { Network, Signer } from '../../';
5
+ import { Psbt as PsbtBase } from 'bip174';
6
+ import { ValidateSigFunction } from 'bitcoinjs-lib/src/psbt';
7
+ export declare class ZcashPsbt extends UtxoPsbt<ZcashTransaction<bigint>> {
8
+ protected static transactionFromBuffer(buffer: Buffer, network: Network): ZcashTransaction<bigint>;
9
+ static createPsbt(opts: PsbtOpts, data?: PsbtBase): ZcashPsbt;
10
+ /**
11
+ * In version < 5 of Zcash transactions, the consensus branch ID is not serialized in the transaction
12
+ * whereas in version 5 it is. If the transaction is less than a version 5, set the consensus branch id
13
+ * in the global map in the psbt. If it is a version 5 transaction, throw an error if the consensus
14
+ * branch id is set in the psbt (because it should be on the transaction already).
15
+ * @param buffer Psbt buffer
16
+ * @param opts options
17
+ */
18
+ static fromBuffer(buffer: Buffer, opts: PsbtOpts): UtxoPsbt<ZcashTransaction<bigint>>;
19
+ /**
20
+ * If it is a version 4 transaction, add the consensus branch id to
21
+ * the global map. If it is a version 5 transaction, just return the
22
+ * buffer because the consensus branch id is already serialized in
23
+ * the transaction.
24
+ */
25
+ toBuffer(): Buffer;
26
+ setVersion(version: number, overwinter?: boolean): this;
27
+ setDefaultsForVersion(network: Network, version: number): void;
28
+ signInput(inputIndex: number, keyPair: Signer, sighashTypes?: number[]): this;
29
+ validateSignaturesOfInput(inputIndex: number, validator: ValidateSigFunction, pubkey?: Buffer): boolean;
30
+ private withUnsafeSignNonSegwitTrue;
31
+ private setPropertyCheckSignatures;
32
+ setConsensusBranchId(consensusBranchId: number): void;
33
+ setVersionGroupId(versionGroupId: number): void;
34
+ setExpiryHeight(expiryHeight: number): void;
35
+ }
36
+ //# sourceMappingURL=ZcashPsbt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZcashPsbt.d.ts","sourceRoot":"","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