utxo-lib 1.0.8 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +19 -16
- package/dist/src/address.d.ts.map +1 -1
- package/dist/src/address.js +11 -1
- package/dist/src/addressFormat.d.ts +1 -1
- package/dist/src/addressFormat.d.ts.map +1 -1
- package/dist/src/addressFormat.js +1 -1
- package/dist/src/base_crypto.d.ts +14 -0
- package/dist/src/base_crypto.d.ts.map +1 -0
- package/dist/src/base_crypto.js +215 -0
- package/dist/src/bitgo/Musig2.d.ts +115 -17
- package/dist/src/bitgo/Musig2.d.ts.map +1 -1
- package/dist/src/bitgo/Musig2.js +283 -101
- package/dist/src/bitgo/PsbtUtil.d.ts +59 -0
- package/dist/src/bitgo/PsbtUtil.d.ts.map +1 -0
- package/dist/src/bitgo/PsbtUtil.js +91 -0
- package/dist/src/bitgo/UtxoPsbt.d.ts +180 -47
- package/dist/src/bitgo/UtxoPsbt.d.ts.map +1 -1
- package/dist/src/bitgo/UtxoPsbt.js +657 -121
- package/dist/src/bitgo/UtxoTransaction.js +2 -2
- package/dist/src/bitgo/bitcoincash/address.js +2 -2
- package/dist/src/bitgo/index.d.ts +11 -0
- package/dist/src/bitgo/index.d.ts.map +1 -1
- package/dist/src/bitgo/index.js +6 -2
- package/dist/src/bitgo/legacysafe/index.d.ts +15 -0
- package/dist/src/bitgo/legacysafe/index.d.ts.map +1 -0
- package/dist/src/bitgo/legacysafe/index.js +61 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts +10 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.js +17 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts +16 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.js +46 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts +10 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.js +15 -0
- package/dist/src/bitgo/litecoin/index.d.ts +4 -0
- package/dist/src/bitgo/litecoin/index.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/index.js +16 -0
- package/dist/src/bitgo/outputScripts.d.ts +3 -1
- package/dist/src/bitgo/outputScripts.d.ts.map +1 -1
- package/dist/src/bitgo/outputScripts.js +20 -12
- package/dist/src/bitgo/parseInput.d.ts +49 -20
- package/dist/src/bitgo/parseInput.d.ts.map +1 -1
- package/dist/src/bitgo/parseInput.js +110 -26
- package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +1 -1
- package/dist/src/bitgo/psbt/fromHalfSigned.js +9 -6
- package/dist/src/bitgo/psbt/scriptTypes.js +3 -3
- package/dist/src/bitgo/signature.d.ts +3 -3
- package/dist/src/bitgo/signature.d.ts.map +1 -1
- package/dist/src/bitgo/signature.js +48 -16
- package/dist/src/bitgo/transaction.d.ts +18 -3
- package/dist/src/bitgo/transaction.d.ts.map +1 -1
- package/dist/src/bitgo/transaction.js +28 -15
- package/dist/src/bitgo/types.d.ts +2 -0
- package/dist/src/bitgo/types.d.ts.map +1 -1
- package/dist/src/bitgo/types.js +1 -1
- package/dist/src/bitgo/wallet/Psbt.d.ts +104 -12
- package/dist/src/bitgo/wallet/Psbt.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/Psbt.js +285 -70
- package/dist/src/bitgo/wallet/Unspent.d.ts +28 -0
- package/dist/src/bitgo/wallet/Unspent.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/Unspent.js +172 -68
- package/dist/src/bitgo/wallet/WalletOutput.d.ts +17 -1
- package/dist/src/bitgo/wallet/WalletOutput.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/WalletOutput.js +64 -23
- package/dist/src/bitgo/wallet/chains.d.ts +2 -2
- package/dist/src/bitgo/wallet/chains.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/chains.js +1 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts +0 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +1 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.js +7 -16
- package/dist/src/bitgo/zcash/ZcashTransaction.js +2 -2
- package/dist/src/musig.d.ts +390 -0
- package/dist/src/musig.d.ts.map +1 -0
- package/dist/src/musig.js +447 -0
- package/dist/src/networks.d.ts +1 -2
- package/dist/src/networks.d.ts.map +1 -1
- package/dist/src/networks.js +22 -29
- package/dist/src/noble_ecc.d.ts +1 -1
- package/dist/src/noble_ecc.d.ts.map +1 -1
- package/dist/src/noble_ecc.js +11 -7
- package/dist/src/payments/p2tr.d.ts.map +1 -1
- package/dist/src/payments/p2tr.js +21 -19
- package/dist/src/payments/p2tr_ns.js +2 -3
- package/dist/src/taproot.d.ts +16 -0
- package/dist/src/taproot.d.ts.map +1 -1
- package/dist/src/taproot.js +45 -4
- package/dist/src/testutil/index.d.ts +2 -0
- package/dist/src/testutil/index.d.ts.map +1 -1
- package/dist/src/testutil/index.js +3 -1
- package/dist/src/testutil/keys.d.ts +3 -0
- package/dist/src/testutil/keys.d.ts.map +1 -1
- package/dist/src/testutil/keys.js +17 -2
- package/dist/src/testutil/mock.d.ts +1 -1
- package/dist/src/testutil/mock.d.ts.map +1 -1
- package/dist/src/testutil/mock.js +12 -4
- package/dist/src/testutil/psbt.d.ts +89 -0
- package/dist/src/testutil/psbt.d.ts.map +1 -0
- package/dist/src/testutil/psbt.js +150 -0
- package/dist/src/testutil/transaction.d.ts +70 -0
- package/dist/src/testutil/transaction.d.ts.map +1 -0
- package/dist/src/testutil/transaction.js +107 -0
- package/dist/src/transaction_builder.js +2 -2
- package/package.json +6 -7
@@ -1,13 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.addWalletOutputToPsbt = void 0;
|
3
|
+
exports.updateWalletOutputForPsbt = exports.addWalletOutputToPsbt = void 0;
|
4
4
|
const bitcoinjs_lib_1 = require("bitcoinjs-lib");
|
5
5
|
const chains_1 = require("./chains");
|
6
6
|
const outputScripts_1 = require("../outputScripts");
|
7
7
|
/**
|
8
8
|
* Add a verifiable wallet output to the PSBT. The output and all data
|
9
9
|
* needed to verify it from public keys only are added to the PSBT.
|
10
|
-
* Typically these are change outputs
|
10
|
+
* Typically these are change outputs.
|
11
11
|
*
|
12
12
|
* @param psbt the PSBT to add change output to
|
13
13
|
* @param rootWalletKeys keys that will be able to spend the output
|
@@ -22,13 +22,53 @@ function addWalletOutputToPsbt(psbt, rootWalletKeys, chain, index, value) {
|
|
22
22
|
const scriptType = chains_1.scriptTypeForChain(chain);
|
23
23
|
if (scriptType === 'p2tr' || scriptType === 'p2trMusig2') {
|
24
24
|
const payment = scriptType === 'p2tr' ? outputScripts_1.createPaymentP2tr(walletKeys.publicKeys) : outputScripts_1.createPaymentP2trMusig2(walletKeys.publicKeys);
|
25
|
+
psbt.addOutput({ script: payment.output, value });
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
const { scriptPubKey: script } = outputScripts_1.createOutputScript2of3(walletKeys.publicKeys, scriptType);
|
29
|
+
psbt.addOutput({ script, value });
|
30
|
+
}
|
31
|
+
updateWalletOutputForPsbt(psbt, rootWalletKeys, psbt.data.outputs.length - 1, chain, index);
|
32
|
+
}
|
33
|
+
exports.addWalletOutputToPsbt = addWalletOutputToPsbt;
|
34
|
+
/**
|
35
|
+
* Update the wallet output with the required information when necessary. If the
|
36
|
+
* information is there already, it will skip over it.
|
37
|
+
*
|
38
|
+
* This function assumes that the output script and value have already been set.
|
39
|
+
*
|
40
|
+
* @param psbt the PSBT to update change output at
|
41
|
+
* @param rootWalletKeys keys that will be able to spend the output
|
42
|
+
* @param outputIndex output index where to update the output
|
43
|
+
* @param chain chain code to use for deriving scripts (and to determine script
|
44
|
+
* type) chain is an API parameter in the BitGo API, and may be
|
45
|
+
* any valid ChainCode
|
46
|
+
* @param index derivation index for the change address
|
47
|
+
* @param value value of the change output
|
48
|
+
*/
|
49
|
+
function updateWalletOutputForPsbt(psbt, rootWalletKeys, outputIndex, chain, index) {
|
50
|
+
if (psbt.data.outputs.length <= outputIndex) {
|
51
|
+
throw new Error(`outputIndex (${outputIndex}) is too large for the number of outputs (${psbt.data.outputs.length})`);
|
52
|
+
}
|
53
|
+
const outputScript = psbt.getOutputScript(outputIndex);
|
54
|
+
const walletKeys = rootWalletKeys.deriveForChainAndIndex(chain, index);
|
55
|
+
const scriptType = chains_1.scriptTypeForChain(chain);
|
56
|
+
const output = psbt.data.outputs[outputIndex];
|
57
|
+
const update = {};
|
58
|
+
if (scriptType === 'p2tr' || scriptType === 'p2trMusig2') {
|
59
|
+
const payment = scriptType === 'p2tr' ? outputScripts_1.createPaymentP2tr(walletKeys.publicKeys) : outputScripts_1.createPaymentP2trMusig2(walletKeys.publicKeys);
|
60
|
+
if (!payment.output || !payment.output.equals(outputScript)) {
|
61
|
+
throw new Error(`cannot update a p2tr output where the scripts do not match - Failing.`);
|
62
|
+
}
|
25
63
|
const allLeafHashes = payment.redeems.map((r) => bitcoinjs_lib_1.taproot.hashTapLeaf(r.output));
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
tapInternalKey
|
31
|
-
|
64
|
+
if (!output.tapTree) {
|
65
|
+
update.tapTree = payment.tapTree;
|
66
|
+
}
|
67
|
+
if (!output.tapInternalKey) {
|
68
|
+
update.tapInternalKey = payment.internalPubkey;
|
69
|
+
}
|
70
|
+
if (!output.tapBip32Derivation) {
|
71
|
+
update.tapBip32Derivation = [0, 1, 2].map((idx) => {
|
32
72
|
const pubkey = outputScripts_1.toXOnlyPublicKey(walletKeys.triple[idx].publicKey);
|
33
73
|
const leafHashes = [];
|
34
74
|
payment.redeems.forEach((r, idx) => {
|
@@ -42,28 +82,29 @@ function addWalletOutputToPsbt(psbt, rootWalletKeys, chain, index, value) {
|
|
42
82
|
path: walletKeys.paths[idx],
|
43
83
|
masterFingerprint: rootWalletKeys.triple[idx].fingerprint,
|
44
84
|
};
|
45
|
-
})
|
46
|
-
}
|
85
|
+
});
|
86
|
+
}
|
47
87
|
}
|
48
88
|
else {
|
49
89
|
const { scriptPubKey, witnessScript, redeemScript } = outputScripts_1.createOutputScript2of3(walletKeys.publicKeys, scriptType);
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
90
|
+
if (!scriptPubKey.equals(outputScript)) {
|
91
|
+
throw new Error(`cannot update an output where the scripts do not match - Failing.`);
|
92
|
+
}
|
93
|
+
if (!output.bip32Derivation) {
|
94
|
+
update.bip32Derivation = [0, 1, 2].map((idx) => ({
|
54
95
|
pubkey: walletKeys.triple[idx].publicKey,
|
55
96
|
path: walletKeys.paths[idx],
|
56
97
|
masterFingerprint: rootWalletKeys.triple[idx].fingerprint,
|
57
|
-
}))
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
psbt.updateOutput(outputIndex, { witnessScript });
|
98
|
+
}));
|
99
|
+
}
|
100
|
+
if (!output.witnessScript && witnessScript) {
|
101
|
+
update.witnessScript = witnessScript;
|
62
102
|
}
|
63
|
-
if (redeemScript) {
|
64
|
-
|
103
|
+
if (!output.redeemScript && redeemScript) {
|
104
|
+
update.redeemScript = redeemScript;
|
65
105
|
}
|
66
106
|
}
|
107
|
+
psbt.updateOutput(outputIndex, update);
|
67
108
|
}
|
68
|
-
exports.
|
69
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2FsbGV0T3V0cHV0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2JpdGdvL3dhbGxldC9XYWxsZXRPdXRwdXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsaURBQXdDO0FBR3hDLHFDQUF5RDtBQUN6RCxvREFBd0g7QUFFeEg7Ozs7Ozs7Ozs7OztHQVlHO0FBQ0gsU0FBZ0IscUJB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VkZWVtU2NyaXB0ICYmIHJlZGVlbVNjcmlwdCkge1xuICAgICAgdXBkYXRlLnJlZGVlbVNjcmlwdCA9IHJlZGVlbVNjcmlwdDtcbiAgICB9XG4gIH1cbiAgcHNidC51cGRhdGVPdXRwdXQob3V0cHV0SW5kZXgsIHVwZGF0ZSk7XG59XG4iXX0=
|
@@ -18,8 +18,8 @@ export declare const chainCodesP2shP2wsh: readonly [10, 11];
|
|
18
18
|
export declare const chainCodesP2wsh: readonly [20, 21];
|
19
19
|
export declare const chainCodesP2tr: readonly [30, 31];
|
20
20
|
export declare const chainCodesP2trMusig2: readonly [40, 41];
|
21
|
-
export declare const chainCodes: (0 |
|
22
|
-
export declare type ChainCode = typeof chainCodes[number];
|
21
|
+
export declare const chainCodes: (0 | 30 | 1 | 31 | 10 | 11 | 20 | 21 | 40 | 41)[];
|
22
|
+
export declare type ChainCode = (typeof chainCodes)[number];
|
23
23
|
export declare function isChainCode(n: unknown): n is ChainCode;
|
24
24
|
/**
|
25
25
|
* A script type maps to two ChainCodes:
|
@@ -1 +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;
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/wallet/chains.ts"],"names":[],"mappings":"AAAA;;;;;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103
103
|
return segwitCodes.includes(v);
|
104
104
|
}
|
105
105
|
exports.isSegwit = isSegwit;
|
106
|
-
//# sourceMappingURL=data:application/json;base64,
|
106
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2JpdGdvL3dhbGxldC9jaGFpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBYUE7O0dBRUc7QUFDVSxRQUFBLGNBQWMsR0FBRyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQVUsQ0FBQztBQUNqQyxRQUFBLG1CQUFtQixHQUFHLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBVSxDQUFDO0FBQ3hDLFFBQUEsZUFBZSxHQUFHLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBVSxDQUFDO0FBQ3BDLFFBQUEsY0FBYyxHQUFHLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBVSxDQUFDO0FBQ25DLFFBQUEsb0JBQW9CLEdBQUcsQ0FBQyxFQUFFLEVBQUUsRUFBRSxDQUFVLENBQUM7QUFDekMsUUFBQSxVQUFVLEdBQUc7SUFDeEIsR0FBRyxzQkFBYztJQUNqQixHQUFHLDJCQUFtQjtJQUN0QixHQUFHLHVCQUFlO0lBQ2xCLEdBQUcsc0JBQWM7SUFDakIsR0FBRyw0QkFBb0I7Q0FDeEIsQ0FBQztBQUVGLFNBQWdCLFdBQVcsQ0FBQyxDQUFVO0lBQ3BDLE9BQU8sa0JBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBYyxDQUFDLENBQUM7QUFDN0MsQ0FBQztBQUZELGtDQUVDO0FBUUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQ2pCO0lBQ0UsQ0FBQyxNQUFNLEVBQUUsc0JBQWMsQ0FBQztJQUN4QixDQUFDLFdBQ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4cG9ydCBmdW5jdGlvbiBpc0V4dGVybmFsQ2hhaW5Db2RlKHY6IENoYWluQ29kZSk6IGJvb2xlYW4ge1xuICByZXR1cm4gdG9DaGFpblBhaXIodikuaW5kZXhPZih2KSA9PT0gMDtcbn1cblxuLyoqXG4gKiBAcmV0dXJuIHRydWUgaWZmIGNoYWluIGNvZGUgaXMgaW50ZXJuYWxcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzSW50ZXJuYWxDaGFpbkNvZGUodjogQ2hhaW5Db2RlKTogYm9vbGVhbiB7XG4gIHJldHVybiB0b0NoYWluUGFpcih2KS5pbmRleE9mKHYpID09PSAxO1xufVxuXG4vKipcbiAqIEByZXR1cm4gdHJ1ZSBpZmYgY2hhaW4gY29kZSBpcyBhIHNlZ3dpdCBhZGRyZXNzXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBpc1NlZ3dpdCh2OiBDaGFpbkNvZGUpOiBib29sZWFuIHtcbiAgY29uc3Qgc2Vnd2l0Q29kZXM6IENoYWluQ29kZVtdID0gW1xuICAgIC4uLmNoYWluQ29kZXNQMnNoUDJ3c2gsXG4gICAgLi4uY2hhaW5Db2Rlc1Ayd3NoLFxuICAgIC4uLmNoYWluQ29kZXNQMnRyLFxuICAgIC4uLmNoYWluQ29kZXNQMnRyTXVzaWcyLFxuICBdO1xuICByZXR1cm4gc2Vnd2l0Q29kZXMuaW5jbHVkZXModik7XG59XG4iXX0=
|
@@ -27,7 +27,6 @@ export declare class ZcashPsbt extends UtxoPsbt<ZcashTransaction<bigint>> {
|
|
27
27
|
setDefaultsForVersion(network: Network, version: number): void;
|
28
28
|
signInput(inputIndex: number, keyPair: Signer, sighashTypes?: number[]): this;
|
29
29
|
validateSignaturesOfInput(inputIndex: number, validator: ValidateSigFunction, pubkey?: Buffer): boolean;
|
30
|
-
private withUnsafeSignNonSegwitTrue;
|
31
30
|
private setPropertyCheckSignatures;
|
32
31
|
setConsensusBranchId(consensusBranchId: number): void;
|
33
32
|
setVersionGroupId(versionGroupId: number): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ZcashPsbt.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/zcash/ZcashPsbt.ts"],"names":[],"mappings":";AAAA,OAAO,
|
1
|
+
{"version":3,"file":"ZcashPsbt.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/zcash/ZcashPsbt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAGL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAmB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAW7D,qBAAa,SAAU,SAAQ,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/D,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAIlG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS;IAO7D;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAqCrF;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;IAelB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,IAAI;IAOpD,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAsB9D,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAI7E,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO;IAIvG,OAAO,CAAC,0BAA0B;IAQlC,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI;IAKrD,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAK/C,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CAI5C"}
|
@@ -6,12 +6,13 @@ const ZcashTransaction_1 = require("./ZcashTransaction");
|
|
6
6
|
const __1 = require("../../");
|
7
7
|
const bip174_1 = require("bip174");
|
8
8
|
const types = require("bitcoinjs-lib/src/types");
|
9
|
+
const PsbtUtil_1 = require("../PsbtUtil");
|
9
10
|
const typeforce = require('typeforce');
|
10
11
|
const CONSENSUS_BRANCH_ID_KEY = Buffer.concat([
|
11
12
|
Buffer.of(0xfc),
|
12
13
|
Buffer.of(0x05),
|
13
|
-
Buffer.from(
|
14
|
-
Buffer.of(
|
14
|
+
Buffer.from(PsbtUtil_1.PSBT_PROPRIETARY_IDENTIFIER),
|
15
|
+
Buffer.of(PsbtUtil_1.ProprietaryKeySubtype.ZEC_CONSENSUS_BRANCH_ID),
|
15
16
|
]);
|
16
17
|
class ZcashPsbt extends UtxoPsbt_1.UtxoPsbt {
|
17
18
|
static transactionFromBuffer(buffer, network) {
|
@@ -29,11 +30,10 @@ class ZcashPsbt extends UtxoPsbt_1.UtxoPsbt {
|
|
29
30
|
* @param opts options
|
30
31
|
*/
|
31
32
|
static fromBuffer(buffer, opts) {
|
32
|
-
var _a;
|
33
33
|
const psbt = super.fromBuffer(buffer, opts);
|
34
34
|
// Read `consensusBranchId` from the global-map
|
35
35
|
let consensusBranchId = undefined;
|
36
|
-
|
36
|
+
psbt.data.globalMap.unknownKeyVals?.forEach(({ key, value }, i) => {
|
37
37
|
if (key.equals(CONSENSUS_BRANCH_ID_KEY)) {
|
38
38
|
consensusBranchId = value.readUint32LE();
|
39
39
|
}
|
@@ -108,19 +108,10 @@ class ZcashPsbt extends UtxoPsbt_1.UtxoPsbt {
|
|
108
108
|
// transactions because zcash hashes the value directly. Thus, it is unnecessary to have
|
109
109
|
// the previous transaction hash on the unspent.
|
110
110
|
signInput(inputIndex, keyPair, sighashTypes) {
|
111
|
-
return
|
111
|
+
return PsbtUtil_1.withUnsafeNonSegwit(this, super.signInput.bind(this, inputIndex, keyPair, sighashTypes));
|
112
112
|
}
|
113
113
|
validateSignaturesOfInput(inputIndex, validator, pubkey) {
|
114
|
-
return
|
115
|
-
}
|
116
|
-
withUnsafeSignNonSegwitTrue(fn) {
|
117
|
-
this.__CACHE.__UNSAFE_SIGN_NONSEGWIT = true;
|
118
|
-
try {
|
119
|
-
return fn();
|
120
|
-
}
|
121
|
-
finally {
|
122
|
-
this.__CACHE.__UNSAFE_SIGN_NONSEGWIT = false;
|
123
|
-
}
|
114
|
+
return PsbtUtil_1.withUnsafeNonSegwit(this, super.validateSignaturesOfInput.bind(this, inputIndex, validator, pubkey));
|
124
115
|
}
|
125
116
|
setPropertyCheckSignatures(propName, value) {
|
126
117
|
if (this.tx[propName] === value) {
|
@@ -143,4 +134,4 @@ class ZcashPsbt extends UtxoPsbt_1.UtxoPsbt {
|
|
143
134
|
}
|
144
135
|
}
|
145
136
|
exports.ZcashPsbt = ZcashPsbt;
|
146
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiWmNhc2hQc2J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2JpdGdvL3pjYXNoL1pjYXNoUHNidC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQ0FBcUc7QUFDckcseURBSTRCO0FBQzVCLDhCQUEwRDtBQUMxRCxtQ0FBMEM7QUFDMUMsaURBQ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lzLnNldFByb3BlcnR5Q2hlY2tTaWduYXR1cmVzKCdjb25zZW5zdXNCcmFuY2hJZCcsIGNvbnNlbnN1c0JyYW5jaElkKTtcbiAgfVxuXG4gIHNldFZlcnNpb25Hcm91cElkKHZlcnNpb25Hcm91cElkOiBudW1iZXIpOiB2b2lkIHtcbiAgICB0eXBlZm9yY2UodHlwZXMuVUludDMyLCB2ZXJzaW9uR3JvdXBJZCk7XG4gICAgdGhpcy5zZXRQcm9wZXJ0eUNoZWNrU2lnbmF0dXJlcygndmVyc2lvbkdyb3VwSWQnLCB2ZXJzaW9uR3JvdXBJZCk7XG4gIH1cblxuICBzZXRFeHBpcnlIZWlnaHQoZXhwaXJ5SGVpZ2h0OiBudW1iZXIpOiB2b2lkIHtcbiAgICB0eXBlZm9yY2UodHlwZXMuVUludDMyLCBleHBpcnlIZWlnaHQpO1xuICAgIHRoaXMuc2V0UHJvcGVydHlDaGVja1NpZ25hdHVyZXMoJ2V4cGlyeUhlaWdodCcsIGV4cGlyeUhlaWdodCk7XG4gIH1cbn1cbiJdfQ==
|
@@ -74,7 +74,7 @@ class ZcashTransaction extends UtxoTransaction_1.UtxoTransaction {
|
|
74
74
|
consensusBranchId = tx.consensusBranchId;
|
75
75
|
}
|
76
76
|
}
|
77
|
-
this.consensusBranchId = consensusBranchId
|
77
|
+
this.consensusBranchId = consensusBranchId ?? getDefaultConsensusBranchIdForVersion(network, this.version);
|
78
78
|
}
|
79
79
|
static fromBuffer(buffer, __noStrict, amountType = 'number', network) {
|
80
80
|
/* istanbul ignore next */
|
@@ -338,4 +338,4 @@ ZcashTransaction.VERSION_SAPLING = 4;
|
|
338
338
|
ZcashTransaction.VERSION4_BRANCH_CANOPY = 400;
|
339
339
|
ZcashTransaction.VERSION4_BRANCH_NU5 = 450;
|
340
340
|
ZcashTransaction.VERSION5_BRANCH_NU5 = 500;
|
341
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiWmNhc2hUc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