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,469 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UtxoPsbt = exports.ProprietaryKeySubtype = exports.PSBT_PROPRIETARY_IDENTIFIER = void 0;
4
+ const bip174_1 = require("bip174");
5
+ const utils_1 = require("bip174/src/lib/utils");
6
+ const bufferutils_1 = require("bitcoinjs-lib/src/bufferutils");
7
+ const __1 = require("..");
8
+ const UtxoTransaction_1 = require("./UtxoTransaction");
9
+ const Unspent_1 = require("./Unspent");
10
+ const scriptTypes_1 = require("./psbt/scriptTypes");
11
+ const fromHalfSigned_1 = require("./psbt/fromHalfSigned");
12
+ const outputScripts_1 = require("./outputScripts");
13
+ const parseInput_1 = require("./parseInput");
14
+ const bip32_1 = require("bip32");
15
+ const bs58check = require("bs58check");
16
+ const proprietaryKeyVal_1 = require("bip174/src/lib/proprietaryKeyVal");
17
+ exports.PSBT_PROPRIETARY_IDENTIFIER = 'BITGO';
18
+ var ProprietaryKeySubtype;
19
+ (function (ProprietaryKeySubtype) {
20
+ ProprietaryKeySubtype[ProprietaryKeySubtype["ZEC_CONSENSUS_BRANCH_ID"] = 0] = "ZEC_CONSENSUS_BRANCH_ID";
21
+ ProprietaryKeySubtype[ProprietaryKeySubtype["MUSIG2_PARTICIPANT_PUB_KEYS"] = 1] = "MUSIG2_PARTICIPANT_PUB_KEYS";
22
+ ProprietaryKeySubtype[ProprietaryKeySubtype["MUSIG2_PUB_NONCE"] = 2] = "MUSIG2_PUB_NONCE";
23
+ })(ProprietaryKeySubtype = exports.ProprietaryKeySubtype || (exports.ProprietaryKeySubtype = {}));
24
+ // TODO: upstream does `checkInputsForPartialSigs` before doing things like
25
+ // `setVersion`. Our inputs could have tapscriptsigs (or in future tapkeysigs)
26
+ // and not fail that check. Do we want to do anything about that?
27
+ class UtxoPsbt extends __1.Psbt {
28
+ static transactionFromBuffer(buffer, network) {
29
+ return UtxoTransaction_1.UtxoTransaction.fromBuffer(buffer, false, 'bigint', network);
30
+ }
31
+ static createPsbt(opts, data) {
32
+ return new UtxoPsbt(opts, data || new bip174_1.Psbt(new __1.PsbtTransaction({ tx: new UtxoTransaction_1.UtxoTransaction(opts.network) })));
33
+ }
34
+ static fromBuffer(buffer, opts) {
35
+ const transactionFromBuffer = (buffer) => {
36
+ const tx = this.transactionFromBuffer(buffer, opts.network);
37
+ return new __1.PsbtTransaction({ tx });
38
+ };
39
+ const psbtBase = bip174_1.Psbt.fromBuffer(buffer, transactionFromBuffer, {
40
+ bip32PathsAbsolute: opts.bip32PathsAbsolute,
41
+ });
42
+ const psbt = this.createPsbt(opts, psbtBase);
43
+ // Upstream checks for duplicate inputs here, but it seems to be of dubious value.
44
+ return psbt;
45
+ }
46
+ static fromHex(data, opts) {
47
+ return this.fromBuffer(Buffer.from(data, 'hex'), opts);
48
+ }
49
+ get network() {
50
+ return this.tx.network;
51
+ }
52
+ toHex() {
53
+ return this.toBuffer().toString('hex');
54
+ }
55
+ /**
56
+ * @return true iff PSBT input is finalized
57
+ */
58
+ isInputFinalized(inputIndex) {
59
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
60
+ return Buffer.isBuffer(input.finalScriptSig) || Buffer.isBuffer(input.finalScriptWitness);
61
+ }
62
+ /**
63
+ * @return partialSig/tapScriptSig count iff input is not finalized
64
+ */
65
+ getSignatureCount(inputIndex) {
66
+ if (this.isInputFinalized(inputIndex)) {
67
+ throw new Error('Input is already finalized');
68
+ }
69
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
70
+ return Math.max(Array.isArray(input.partialSig) ? input.partialSig.length : 0, Array.isArray(input.tapScriptSig) ? input.tapScriptSig.length : 0);
71
+ }
72
+ getNonWitnessPreviousTxids() {
73
+ const txInputs = this.txInputs; // These are somewhat costly to extract
74
+ const txidSet = new Set();
75
+ this.data.inputs.forEach((input, index) => {
76
+ if (!input.witnessUtxo) {
77
+ throw new Error('Must have witness UTXO for all inputs');
78
+ }
79
+ if (!scriptTypes_1.isSegwit(input.witnessUtxo.script, input.redeemScript)) {
80
+ txidSet.add(Unspent_1.getOutputIdForInput(txInputs[index]).txid);
81
+ }
82
+ });
83
+ return [...txidSet];
84
+ }
85
+ addNonWitnessUtxos(txBufs) {
86
+ const txInputs = this.txInputs; // These are somewhat costly to extract
87
+ this.data.inputs.forEach((input, index) => {
88
+ if (!input.witnessUtxo) {
89
+ throw new Error('Must have witness UTXO for all inputs');
90
+ }
91
+ if (!scriptTypes_1.isSegwit(input.witnessUtxo.script, input.redeemScript)) {
92
+ const { txid } = Unspent_1.getOutputIdForInput(txInputs[index]);
93
+ if (txBufs[txid] === undefined) {
94
+ throw new Error('Not all required previous transactions provided');
95
+ }
96
+ this.updateInput(index, { nonWitnessUtxo: txBufs[txid] });
97
+ }
98
+ });
99
+ return this;
100
+ }
101
+ static fromTransaction(transaction, prevOutputs) {
102
+ if (prevOutputs.length !== transaction.ins.length) {
103
+ throw new Error(`Transaction has ${transaction.ins.length} inputs, but ${prevOutputs.length} previous outputs provided`);
104
+ }
105
+ const clonedTransaction = transaction.clone();
106
+ const updates = fromHalfSigned_1.unsign(clonedTransaction, prevOutputs);
107
+ const psbtBase = new bip174_1.Psbt(new __1.PsbtTransaction({ tx: clonedTransaction }));
108
+ clonedTransaction.ins.forEach(() => psbtBase.inputs.push({ unknownKeyVals: [] }));
109
+ clonedTransaction.outs.forEach(() => psbtBase.outputs.push({ unknownKeyVals: [] }));
110
+ const psbt = this.createPsbt({ network: transaction.network }, psbtBase);
111
+ updates.forEach((update, index) => {
112
+ psbt.updateInput(index, update);
113
+ psbt.updateInput(index, { witnessUtxo: { script: prevOutputs[index].script, value: prevOutputs[index].value } });
114
+ });
115
+ return psbt;
116
+ }
117
+ getUnsignedTx() {
118
+ return this.tx.clone();
119
+ }
120
+ static newTransaction(network) {
121
+ return new UtxoTransaction_1.UtxoTransaction(network);
122
+ }
123
+ get tx() {
124
+ return this.data.globalMap.unsignedTx.tx;
125
+ }
126
+ checkForSignatures(propName) {
127
+ this.data.inputs.forEach((input) => {
128
+ var _a, _b;
129
+ if (((_a = input.tapScriptSig) === null || _a === void 0 ? void 0 : _a.length) || input.tapKeySig || ((_b = input.partialSig) === null || _b === void 0 ? void 0 : _b.length)) {
130
+ throw new Error(`Cannot modify ${propName !== null && propName !== void 0 ? propName : 'transaction'} - signatures exist.`);
131
+ }
132
+ });
133
+ }
134
+ /**
135
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
136
+ */
137
+ finalizeAllInputs() {
138
+ utils_1.checkForInput(this.data.inputs, 0); // making sure we have at least one
139
+ this.data.inputs.map((input, idx) => {
140
+ var _a;
141
+ return ((_a = input.tapScriptSig) === null || _a === void 0 ? void 0 : _a.length) ? this.finalizeTaprootInput(idx) : this.finalizeInput(idx);
142
+ });
143
+ return this;
144
+ }
145
+ finalizeTaprootInput(inputIndex) {
146
+ var _a, _b;
147
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
148
+ // witness = control-block script first-sig second-sig
149
+ if (((_a = input.tapLeafScript) === null || _a === void 0 ? void 0 : _a.length) !== 1) {
150
+ throw new Error('Only one leaf script supported for finalizing');
151
+ }
152
+ const { controlBlock, script } = input.tapLeafScript[0];
153
+ const witness = [script, controlBlock];
154
+ const [pubkey1, pubkey2] = parseInput_1.parsePubScript(script, 'p2tr').publicKeys;
155
+ for (const pk of [pubkey1, pubkey2]) {
156
+ const sig = (_b = input.tapScriptSig) === null || _b === void 0 ? void 0 : _b.find(({ pubkey }) => pubkey.equals(pk));
157
+ if (!sig) {
158
+ throw new Error('Could not find signatures in Script Sig.');
159
+ }
160
+ witness.unshift(sig.signature);
161
+ }
162
+ const witnessLength = witness.reduce((s, b) => s + b.length + bufferutils_1.varuint.encodingLength(b.length), 1);
163
+ const bufferWriter = bufferutils_1.BufferWriter.withCapacity(witnessLength);
164
+ bufferWriter.writeVector(witness);
165
+ const finalScriptWitness = bufferWriter.end();
166
+ this.data.updateInput(inputIndex, { finalScriptWitness });
167
+ this.data.clearFinalizedInput(inputIndex);
168
+ return this;
169
+ }
170
+ finalizeTapInputWithSingleLeafScriptAndSignature(inputIndex) {
171
+ var _a, _b;
172
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
173
+ if (((_a = input.tapLeafScript) === null || _a === void 0 ? void 0 : _a.length) !== 1) {
174
+ throw new Error('Only one leaf script supported for finalizing');
175
+ }
176
+ if (((_b = input.tapScriptSig) === null || _b === void 0 ? void 0 : _b.length) !== 1) {
177
+ throw new Error('Could not find signatures in Script Sig.');
178
+ }
179
+ const { controlBlock, script } = input.tapLeafScript[0];
180
+ const witness = [input.tapScriptSig[0].signature, script, controlBlock];
181
+ const witnessLength = witness.reduce((s, b) => s + b.length + bufferutils_1.varuint.encodingLength(b.length), 1);
182
+ const bufferWriter = bufferutils_1.BufferWriter.withCapacity(witnessLength);
183
+ bufferWriter.writeVector(witness);
184
+ const finalScriptWitness = bufferWriter.end();
185
+ this.data.updateInput(inputIndex, { finalScriptWitness });
186
+ this.data.clearFinalizedInput(inputIndex);
187
+ return this;
188
+ }
189
+ /**
190
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
191
+ *
192
+ * Unlike the function it overrides, this does not take a validator. In BitGo
193
+ * context, we know how we want to validate so we just hard code the right
194
+ * validator.
195
+ */
196
+ validateSignaturesOfAllInputs() {
197
+ utils_1.checkForInput(this.data.inputs, 0); // making sure we have at least one
198
+ const results = this.data.inputs.map((input, idx) => {
199
+ var _a;
200
+ return ((_a = input.tapScriptSig) === null || _a === void 0 ? void 0 : _a.length)
201
+ ? this.validateTaprootSignaturesOfInput(idx)
202
+ : this.validateSignaturesOfInput(idx, (p, m, s) => __1.ecc.verify(m, p, s));
203
+ });
204
+ return results.reduce((final, res) => res && final, true);
205
+ }
206
+ validateTaprootSignaturesOfInput(inputIndex, pubkey) {
207
+ const input = this.data.inputs[inputIndex];
208
+ const tapSigs = (input || {}).tapScriptSig;
209
+ if (!input || !tapSigs || tapSigs.length < 1) {
210
+ throw new Error('No signatures to validate');
211
+ }
212
+ let mySigs;
213
+ if (pubkey) {
214
+ const xOnlyPubkey = outputScripts_1.toXOnlyPublicKey(pubkey);
215
+ mySigs = tapSigs.filter((sig) => sig.pubkey.equals(xOnlyPubkey));
216
+ if (mySigs.length < 1) {
217
+ throw new Error('No signatures for this pubkey');
218
+ }
219
+ }
220
+ else {
221
+ mySigs = tapSigs;
222
+ }
223
+ const results = [];
224
+ for (const pSig of mySigs) {
225
+ const { signature, leafHash, pubkey } = pSig;
226
+ let sigHashType;
227
+ let sig;
228
+ if (signature.length === 65) {
229
+ sigHashType = signature[64];
230
+ sig = signature.slice(0, 64);
231
+ }
232
+ else {
233
+ sigHashType = __1.Transaction.SIGHASH_DEFAULT;
234
+ sig = signature;
235
+ }
236
+ const { hash } = this.getTaprootHashForSig(inputIndex, [sigHashType], leafHash);
237
+ results.push(__1.ecc.verifySchnorr(hash, pubkey, sig));
238
+ }
239
+ return results.every((res) => res === true);
240
+ }
241
+ /**
242
+ * @return array of boolean values. True when corresponding index in `publicKeys` has signed the transaction.
243
+ * If no signature in the tx or no public key matching signature, the validation is considered as false.
244
+ */
245
+ getSignatureValidationArray(inputIndex) {
246
+ var _a;
247
+ const noSigErrorMessages = ['No signatures to validate', 'No signatures for this pubkey'];
248
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
249
+ const isP2tr = (_a = input.tapScriptSig) === null || _a === void 0 ? void 0 : _a.length;
250
+ if (!this.data.globalMap.globalXpub) {
251
+ throw new Error('Cannot get signature validation array without global xpubs');
252
+ }
253
+ if (this.data.globalMap.globalXpub.length !== 3) {
254
+ throw new Error(`There must be 3 global xpubs and there are ${this.data.globalMap.globalXpub.length}`);
255
+ }
256
+ return this.data.globalMap.globalXpub.map((xpub) => {
257
+ // const bip32 = ECPair.fromPublicKey(xpub.extendedPubkey, { network: (this as any).opts.network });
258
+ const bip32 = bip32_1.BIP32Factory(__1.ecc).fromBase58(bs58check.encode(xpub.extendedPubkey));
259
+ try {
260
+ return isP2tr
261
+ ? this.validateTaprootSignaturesOfInput(inputIndex, bip32.publicKey)
262
+ : this.validateSignaturesOfInput(inputIndex, (p, m, s) => __1.ecc.verify(m, p, s), bip32.publicKey);
263
+ }
264
+ catch (err) {
265
+ // Not an elegant solution. Might need upstream changes like custom error types.
266
+ if (noSigErrorMessages.includes(err.message)) {
267
+ return false;
268
+ }
269
+ throw err;
270
+ }
271
+ });
272
+ }
273
+ /**
274
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
275
+ */
276
+ signAllInputsHD(hdKeyPair, sighashTypes = [__1.Transaction.SIGHASH_DEFAULT, __1.Transaction.SIGHASH_ALL]) {
277
+ var _a;
278
+ if (!hdKeyPair || !hdKeyPair.publicKey || !hdKeyPair.fingerprint) {
279
+ throw new Error('Need HDSigner to sign input');
280
+ }
281
+ const results = [];
282
+ for (let i = 0; i < this.data.inputs.length; i++) {
283
+ try {
284
+ if ((_a = this.data.inputs[i].tapBip32Derivation) === null || _a === void 0 ? void 0 : _a.length) {
285
+ this.signTaprootInputHD(i, hdKeyPair, sighashTypes);
286
+ }
287
+ else {
288
+ this.signInputHD(i, hdKeyPair, sighashTypes);
289
+ }
290
+ results.push(true);
291
+ }
292
+ catch (err) {
293
+ results.push(false);
294
+ }
295
+ }
296
+ if (results.every((v) => v === false)) {
297
+ throw new Error('No inputs were signed');
298
+ }
299
+ return this;
300
+ }
301
+ /**
302
+ * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts:signInputHD
303
+ */
304
+ signTaprootInputHD(inputIndex, hdKeyPair, sighashTypes = [__1.Transaction.SIGHASH_DEFAULT, __1.Transaction.SIGHASH_ALL]) {
305
+ if (!hdKeyPair || !hdKeyPair.publicKey || !hdKeyPair.fingerprint) {
306
+ throw new Error('Need HDSigner to sign input');
307
+ }
308
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
309
+ if (!input.tapBip32Derivation || input.tapBip32Derivation.length === 0) {
310
+ throw new Error('Need tapBip32Derivation to sign Taproot with HD');
311
+ }
312
+ const myDerivations = input.tapBip32Derivation
313
+ .map((bipDv) => {
314
+ if (bipDv.masterFingerprint.equals(hdKeyPair.fingerprint)) {
315
+ return bipDv;
316
+ }
317
+ })
318
+ .filter((v) => !!v);
319
+ if (myDerivations.length === 0) {
320
+ throw new Error('Need one tapBip32Derivation masterFingerprint to match the HDSigner fingerprint');
321
+ }
322
+ const signers = myDerivations.map((bipDv) => {
323
+ const node = hdKeyPair.derivePath(bipDv.path);
324
+ if (!bipDv.pubkey.equals(node.publicKey.slice(1))) {
325
+ throw new Error('pubkey did not match tapBip32Derivation');
326
+ }
327
+ return { signer: node, leafHashes: bipDv.leafHashes };
328
+ });
329
+ signers.forEach(({ signer, leafHashes }) => this.signTaprootInput(inputIndex, signer, leafHashes, sighashTypes));
330
+ return this;
331
+ }
332
+ signTaprootInput(inputIndex, signer, leafHashes, sighashTypes = [__1.Transaction.SIGHASH_DEFAULT, __1.Transaction.SIGHASH_ALL]) {
333
+ var _a;
334
+ const pubkey = outputScripts_1.toXOnlyPublicKey(signer.publicKey);
335
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
336
+ // Figure out if this is script path or not, if not, tweak the private key
337
+ if (!((_a = input.tapLeafScript) === null || _a === void 0 ? void 0 : _a.length)) {
338
+ // See BitGo/BitGoJS/modules/utxo_lib/src/transaction_builder.ts:trySign for how to support it.
339
+ throw new Error('Taproot key path signing is not supported.');
340
+ }
341
+ if (input.tapLeafScript.length !== 1) {
342
+ throw new Error('Only one leaf script supported for signing');
343
+ }
344
+ const tapLeafScript = input.tapLeafScript[0];
345
+ const parsedControlBlock = __1.taproot.parseControlBlock(__1.ecc, tapLeafScript.controlBlock);
346
+ const { leafVersion } = parsedControlBlock;
347
+ if (leafVersion !== tapLeafScript.leafVersion) {
348
+ throw new Error('Tap script leaf version mismatch with control block');
349
+ }
350
+ const leafHash = __1.taproot.getTapleafHash(__1.ecc, parsedControlBlock, tapLeafScript.script);
351
+ if (!leafHashes.find((l) => l.equals(leafHash))) {
352
+ throw new Error(`Signer cannot sign for leaf hash ${leafHash.toString('hex')}`);
353
+ }
354
+ const { hash, sighashType } = this.getTaprootHashForSig(inputIndex, sighashTypes, leafHash);
355
+ let signature = signer.signSchnorr(hash);
356
+ if (sighashType !== __1.Transaction.SIGHASH_DEFAULT) {
357
+ signature = Buffer.concat([signature, Buffer.of(sighashType)]);
358
+ }
359
+ this.data.updateInput(inputIndex, {
360
+ tapScriptSig: [
361
+ {
362
+ pubkey,
363
+ signature,
364
+ leafHash,
365
+ },
366
+ ],
367
+ });
368
+ return this;
369
+ }
370
+ getTaprootHashForSig(inputIndex, sighashTypes, leafHash) {
371
+ const sighashType = this.data.inputs[inputIndex].sighashType || __1.Transaction.SIGHASH_DEFAULT;
372
+ if (sighashTypes && sighashTypes.indexOf(sighashType) < 0) {
373
+ throw new Error(`Sighash type is not allowed. Retry the sign method passing the ` +
374
+ `sighashTypes array of whitelisted types. Sighash type: ${sighashType}`);
375
+ }
376
+ const txInputs = this.txInputs; // These are somewhat costly to extract
377
+ const prevoutScripts = [];
378
+ const prevoutValues = [];
379
+ this.data.inputs.forEach((input, i) => {
380
+ let prevout;
381
+ if (input.nonWitnessUtxo) {
382
+ // TODO: This could be costly, either cache it here, or find a way to share with super
383
+ const nonWitnessUtxoTx = this.constructor.transactionFromBuffer(input.nonWitnessUtxo, this.tx.network);
384
+ const prevoutHash = txInputs[i].hash;
385
+ const utxoHash = nonWitnessUtxoTx.getHash();
386
+ // If a non-witness UTXO is provided, its hash must match the hash specified in the prevout
387
+ if (!prevoutHash.equals(utxoHash)) {
388
+ throw new Error(`Non-witness UTXO hash for input #${i} doesn't match the hash specified in the prevout`);
389
+ }
390
+ const prevoutIndex = txInputs[i].index;
391
+ prevout = nonWitnessUtxoTx.outs[prevoutIndex];
392
+ }
393
+ else if (input.witnessUtxo) {
394
+ prevout = input.witnessUtxo;
395
+ }
396
+ else {
397
+ throw new Error('Need a Utxo input item for signing');
398
+ }
399
+ prevoutScripts.push(prevout.script);
400
+ prevoutValues.push(prevout.value);
401
+ });
402
+ const hash = this.tx.hashForWitnessV1(inputIndex, prevoutScripts, prevoutValues, sighashType, leafHash);
403
+ return { hash, sighashType };
404
+ }
405
+ /**
406
+ * @retuns true iff the input is taproot.
407
+ */
408
+ isTaprootInput(inputIndex) {
409
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
410
+ function isP2tr(output) {
411
+ try {
412
+ __1.p2trPayments.p2tr({ output }, { eccLib: __1.ecc });
413
+ return true;
414
+ }
415
+ catch (err) {
416
+ return false;
417
+ }
418
+ }
419
+ return !!(input.tapInternalKey ||
420
+ input.tapMerkleRoot ||
421
+ (input.tapLeafScript && input.tapLeafScript.length) ||
422
+ (input.tapBip32Derivation && input.tapBip32Derivation.length) ||
423
+ (input.witnessUtxo && isP2tr(input.witnessUtxo.script)));
424
+ }
425
+ /**
426
+ * @returns hash and hashType for taproot input at inputIndex
427
+ * @throws error if input at inputIndex is not a taproot input
428
+ */
429
+ getTaprootHashForSigChecked(inputIndex, sighashTypes = [__1.Transaction.SIGHASH_DEFAULT, __1.Transaction.SIGHASH_ALL], leafHash) {
430
+ if (!this.isTaprootInput(inputIndex)) {
431
+ throw new Error(`${inputIndex} input is not a taproot type to take taproot tx hash`);
432
+ }
433
+ return this.getTaprootHashForSig(inputIndex, sighashTypes, leafHash);
434
+ }
435
+ /**
436
+ * Adds proprietary key value pair to PSBT input.
437
+ * Default identifierEncoding is utf-8 for identifier.
438
+ */
439
+ addProprietaryKeyValToInput(inputIndex, keyValueData) {
440
+ return this.addUnknownKeyValToInput(inputIndex, {
441
+ key: proprietaryKeyVal_1.encodeProprietaryKey(keyValueData.key),
442
+ value: keyValueData.value,
443
+ });
444
+ }
445
+ /**
446
+ * To search any data from proprietary key value againts keydata.
447
+ * Default identifierEncoding is utf-8 for identifier.
448
+ */
449
+ getProprietaryKeyVals(inputIndex, keySearch) {
450
+ const input = utils_1.checkForInput(this.data.inputs, inputIndex);
451
+ if (!input.unknownKeyVals || input.unknownKeyVals.length === 0) {
452
+ return [];
453
+ }
454
+ const keyVals = input.unknownKeyVals.map(({ key, value }, i) => {
455
+ return { key: proprietaryKeyVal_1.decodeProprietaryKey(key), value };
456
+ });
457
+ return keyVals.filter((keyVal) => {
458
+ return (keySearch === undefined ||
459
+ (keySearch.identifier === keyVal.key.identifier &&
460
+ keySearch.subtype === keyVal.key.subtype &&
461
+ (!Buffer.isBuffer(keySearch.keydata) || keySearch.keydata.equals(keyVal.key.keydata))));
462
+ });
463
+ }
464
+ clone() {
465
+ return super.clone();
466
+ }
467
+ }
468
+ exports.UtxoPsbt = UtxoPsbt;
469
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXR4b1BzYn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Jlciwga2V5U2VhcmNoPzogUHJvcHJpZXRhcnlLZXlTZWFyY2gpOiBQcm9wcmlldGFyeUtleVZhbHVlRGF0YVtdIHtcbiAgICBjb25zdCBpbnB1dCA9IGNoZWNrRm9ySW5wdXQodGhpcy5kYXRhLmlucHV0cywgaW5wdXRJbmRleCk7XG4gICAgaWYgKCFpbnB1dC51bmtub3duS2V5VmFscyB8fCBpbnB1dC51bmtub3duS2V5VmFscy5sZW5ndGggPT09IDApIHtcbiAgICAgIHJldHVybiBbXTtcbiAgICB9XG4gICAgY29uc3Qga2V5VmFscyA9IGlucHV0LnVua25vd25LZXlWYWxzLm1hcCgoeyBrZXksIHZhbHVlIH0sIGkpID0+IHtcbiAgICAgIHJldHVybiB7IGtleTogZGVjb2RlUHJvcHJpZXRhcnlLZXkoa2V5KSwgdmFsdWUgfTtcbiAgICB9KTtcbiAgICByZXR1cm4ga2V5VmFscy5maWx0ZXIoKGtleVZhbCkgPT4ge1xuICAgICAgcmV0dXJuIChcbiAgICAgICAga2V5U2VhcmNoID09PSB1bmRlZmluZWQgfHxcbiAgICAgICAgKGtleVNlYXJjaC5pZGVudGlmaWVyID09PSBrZXlWYWwua2V5LmlkZW50aWZpZXIgJiZcbiAgICAgICAgICBrZXlTZWFyY2guc3VidHlwZSA9PT0ga2V5VmFsLmtleS5zdWJ0eXBlICYmXG4gICAgICAgICAgKCFCdWZmZXIuaXNCdWZmZXIoa2V5U2VhcmNoLmtleWRhdGEpIHx8IGtleVNlYXJjaC5rZXlkYXRhLmVxdWFscyhrZXlWYWwua2V5LmtleWRhdGEpKSlcbiAgICAgICk7XG4gICAgfSk7XG4gIH1cblxuICBjbG9uZSgpOiB0aGlzIHtcbiAgICByZXR1cm4gc3VwZXIuY2xvbmUoKSBhcyB0aGlzO1xuICB9XG59XG4iXX0=
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ import * as bitcoinjs from 'bitcoinjs-lib';
3
+ import { Network } from '../networks';
4
+ export declare function varSliceSize(slice: Buffer): number;
5
+ export declare class UtxoTransaction<TNumber extends number | bigint = number> extends bitcoinjs.Transaction<TNumber> {
6
+ network: Network;
7
+ static SIGHASH_FORKID: number;
8
+ /** @deprecated use SIGHASH_FORKID */
9
+ static SIGHASH_BITCOINCASHBIP143: number;
10
+ constructor(network: Network, transaction?: bitcoinjs.Transaction<bigint | number>, amountType?: 'bigint' | 'number');
11
+ protected static newTransaction<TNumber extends number | bigint = number>(network: Network, transaction?: bitcoinjs.Transaction<bigint | number>, amountType?: 'number' | 'bigint'): UtxoTransaction<TNumber>;
12
+ static fromBuffer<TNumber extends number | bigint = number>(buf: Buffer, noStrict: boolean, amountType?: 'number' | 'bigint', network?: Network, prevOutput?: bitcoinjs.TxOutput<TNumber>[]): UtxoTransaction<TNumber>;
13
+ addForkId(hashType: number): number;
14
+ hashForWitnessV0(inIndex: number, prevOutScript: Buffer, value: TNumber, hashType: number): Buffer;
15
+ /**
16
+ * Calculate the hash to verify the signature against
17
+ */
18
+ hashForSignatureByNetwork(inIndex: number, prevoutScript: Buffer, value: TNumber | undefined, hashType: number): Buffer;
19
+ hashForSignature(inIndex: number, prevOutScript: Buffer, hashType: number, value?: TNumber): Buffer;
20
+ clone<TN2 extends bigint | number = TNumber>(amountType?: 'number' | 'bigint'): UtxoTransaction<TN2>;
21
+ }
22
+ //# sourceMappingURL=UtxoTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UtxoTransaction.d.ts","sourceRoot":"","sources":["../../../src/bitgo/UtxoTransaction.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,SAAS,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAY,OAAO,EAA6B,MAAM,aAAa,CAAC;AAE3E,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED,qBAAa,eAAe,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC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