utxo-lib 1.0.7 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -268,7 +268,7 @@ function parseSignatureScript(input) {
268
268
  const parsers = [parseP2sh2Of3, parseP2shP2wsh2Of3, parseP2wsh2Of3, parseP2tr2Of3, parseP2shP2pk];
269
269
  for (const f of parsers) {
270
270
  const parsed = f({
271
- script: (decScript === null || decScript === void 0 ? void 0 : decScript.length) === 0 ? null : decScript,
271
+ script: decScript?.length === 0 ? null : decScript,
272
272
  witness: input.witness.length === 0 ? null : input.witness,
273
273
  });
274
274
  if (parsed instanceof MatchError) {
@@ -341,4 +341,4 @@ function parsePubScript(inputPubScript, scriptType) {
341
341
  return result;
342
342
  }
343
343
  exports.parsePubScript = parsePubScript;
344
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VJbnB1dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9iaXRnby9wYXJzZUlucHV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHVDQUF1QztBQUN2QyxpREFBMkQ7QUFFM0QsbURBQStFO0FBQy9FLG1DQUFtQztBQUVuQyxTQUFnQixzQkFBc0IsQ0FBQyxDQUFrQjtJQUN2RCxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLEVBQUU7UUFDdEIsT0FBTyxDQUFDLENBQUMsTUFBTSxLQUFLLENBQUMsQ0FBQztLQUN2QjtJQUNELE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQztBQUNqQixDQUFDO0FBTEQsd0RBS0M7QUFFRDs7R0FFRztBQUNILFNBQWdCLGtCQUFrQixDQUFDLFlBQW9CO0lBQ3JELHNGQUFzRjtJQUN0RixPQUFPLE1BQU0sQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLElBQUksRUFBRSxJQUFJLFlBQVksQ0FBQyxNQUFNLElBQUksWUF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wdXRQdWJTY3JpcHQsIHNjcmlwdFR5cGUpO1xuXG4gIGlmIChyZXN1bHQgaW5zdGFuY2VvZiBNYXRjaEVycm9yKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKHJlc3VsdC5tZXNzYWdlKTtcbiAgfVxuXG4gIGlmIChyZXN1bHQucHVibGljS2V5cy5sZW5ndGggIT09IDMgJiYgKHJlc3VsdC5wdWJsaWNLZXlzLmxlbmd0aCAhPT0gMiB8fCByZXN1bHQuc2NyaXB0VHlwZSAhPT0gJ3AydHInKSkge1xuICAgIHRocm93IG5ldyBFcnJvcigndW5leHBlY3RlZCBwdWJrZXkgY291bnQnKTtcbiAgfVxuXG4gIHJldHVybiByZXN1bHQ7XG59XG4iXX0=
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isSegwit = exports.isTaproot = exports.isP2wpkh = exports.isP2wsh = void 0;
4
4
  const opcodes = require("bitcoin-ops");
5
5
  function isP2wsh(scriptPubkey, redeemScript) {
6
- const witnessProgramCandidate = redeemScript !== null && redeemScript !== void 0 ? redeemScript : scriptPubkey;
6
+ const witnessProgramCandidate = redeemScript ?? scriptPubkey;
7
7
  return witnessProgramCandidate[0] === opcodes.OP_0 && witnessProgramCandidate.length === 34;
8
8
  }
9
9
  exports.isP2wsh = isP2wsh;
10
10
  function isP2wpkh(scriptPubkey, redeemScript) {
11
- const witnessProgramCandidate = redeemScript !== null && redeemScript !== void 0 ? redeemScript : scriptPubkey;
11
+ const witnessProgramCandidate = redeemScript ?? scriptPubkey;
12
12
  return witnessProgramCandidate[0] === opcodes.OP_0 && witnessProgramCandidate.length === 22;
13
13
  }
14
14
  exports.isP2wpkh = isP2wpkh;
@@ -20,4 +20,4 @@ function isSegwit(scriptPubkey, redeemScript) {
20
20
  return isTaproot(scriptPubkey) || isP2wsh(scriptPubkey, redeemScript) || isP2wpkh(scriptPubkey, redeemScript);
21
21
  }
22
22
  exports.isSegwit = isSegwit;
23
- //# sourceMapp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tQ2FuZGlkYXRlLmxlbmd0aCA9PT0gMjI7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBpc1RhcHJvb3Qoc2NyaXB0UHVia2V5OiBCdWZmZXIpOiBib29sZWFuIHtcbiAgcmV0dXJuIHNjcmlwdFB1YmtleVswXSA9PT0gb3Bjb2Rlcy5PUF8xICYmIHNjcmlwdFB1YmtleS5sZW5ndGggPT09IDM0O1xufVxuXG5leHBvcnQgZnVuY3Rpb24gaXNTZWd3aXQoc2NyaXB0UHVia2V5OiBCdWZmZXIsIHJlZGVlbVNjcmlwdD86IEJ1ZmZlcik6IGJvb2xlYW4ge1xuICByZXR1cm4gaXNUYXByb290KHNjcmlwdFB1YmtleSkgfHwgaXNQMndzaChzY3JpcHRQdWJrZXksIHJlZGVlbVNjcmlwdCkgfHwgaXNQMndwa2goc2NyaXB0UHVia2V5LCByZWRlZW1TY3JpcHQpO1xufVxuIl19
@@ -18,7 +18,7 @@ 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 | 1 | 31 | 20 | 10 | 11 | 21 | 30 | 40 | 41)[];
21
+ export declare const chainCodes: (0 | 30 | 1 | 31 | 20 | 10 | 11 | 21 | 40 | 41)[];
22
22
  export declare type ChainCode = typeof chainCodes[number];
23
23
  export declare function isChainCode(n: unknown): n is ChainCode;
24
24
  /**
@@ -29,11 +29,10 @@ class ZcashPsbt extends UtxoPsbt_1.UtxoPsbt {
29
29
  * @param opts options
30
30
  */
31
31
  static fromBuffer(buffer, opts) {
32
- var _a;
33
32
  const psbt = super.fromBuffer(buffer, opts);
34
33
  // Read `consensusBranchId` from the global-map
35
34
  let consensusBranchId = undefined;
36
- (_a = psbt.data.globalMap.unknownKeyVals) === null || _a === void 0 ? void 0 : _a.forEach(({ key, value }, i) => {
35
+ psbt.data.globalMap.unknownKeyVals?.forEach(({ key, value }, i) => {
37
36
  if (key.equals(CONSENSUS_BRANCH_ID_KEY)) {
38
37
  consensusBranchId = value.readUint32LE();
39
38
  }
@@ -143,4 +142,4 @@ class ZcashPsbt extends UtxoPsbt_1.UtxoPsbt {
143
142
  }
144
143
  }
145
144
  exports.ZcashPsbt = ZcashPsbt;
146
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiWmNhc2hQc2J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2JpdGdvL3pjYXNoL1pjYXNoUHNidC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQ0FBcUc7QUFDckcseURBSTRCO0FBQzVCLDhCQUEwRDtBQUMxRCxtQ0FBMEM7QUFDMUMsaURBQWlEO0FBRWpELE1BQU0sU0FBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUV2QyxNQUFNLHVCQUF1QixHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUM7SUFDNUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUM7SUFDZixNQUFNLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsc0NBQTJCLENBQUM7SUFDeEMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxnQ0FBcUIsQ0FBQyx1QkFBdUIsQ0FBQztDQUN6RCxDQUFDLENBQUM7QUFFSCxNQUFhLFNBQVUsU0FBUSxtQkFBa0M7SUFDckQsTUFBTSxDQUFDLHFCQUFxQixDQUFDLE1BQWMsRUFBRSxPQUFnQjtRQUNyRSxPQUFPLG1DQUFnQixDQUFDLFVBQVUsQ0FBUyxNQUFNLEVBQUUsS0FBSyxFQUFFLFFBQVEsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUMvRSxDQUFDO0lBRUQ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hcm91cElkKHZlcnNpb25Hcm91cElkOiBudW1iZXIpOiB2b2lkIHtcbiAgICB0eXBlZm9yY2UodHlwZXMuVUludDMyLCB2ZXJzaW9uR3JvdXBJZCk7XG4gICAgdGhpcy5zZXRQcm9wZXJ0eUNoZWNrU2lnbmF0dXJlcygndmVyc2lvbkdyb3VwSWQnLCB2ZXJzaW9uR3JvdXBJZCk7XG4gIH1cblxuICBzZXRFeHBpcnlIZWlnaHQoZXhwaXJ5SGVpZ2h0OiBudW1iZXIpOiB2b2lkIHtcbiAgICB0eXBlZm9yY2UodHlwZXMuVUludDMyLCBleHBpcnlIZWlnaHQpO1xuICAgIHRoaXMuc2V0UHJvcGVydHlDaGVja1NpZ25hdHVyZXMoJ2V4cGlyeUhlaWdodCcsIGV4cGlyeUhlaWdodCk7XG4gIH1cbn1cbiJdfQ==
@@ -74,7 +74,7 @@ class ZcashTransaction extends UtxoTransaction_1.UtxoTransaction {
74
74
  consensusBranchId = tx.consensusBranchId;
75
75
  }
76
76
  }
77
- this.consensusBranchId = consensusBranchId !== null && consensusBranchId !== void 0 ? consensusBranchId : getDefaultConsensusBranchIdForVersion(network, this.version);
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiWmNhc2hUcmFuc2FjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iaXRnby96Y2FzaC9aY2FzaFRyYW5zYWN0aW9u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