utxo-lib 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,7 +74,7 @@ class ZcashTransaction extends UtxoTransaction_1.UtxoTransaction {
74
74
  consensusBranchId = tx.consensusBranchId;
75
75
  }
76
76
  }
77
- this.consensusBranchId = consensusBranchId ?? getDefaultConsensusBranchIdForVersion(network, this.version);
77
+ this.consensusBranchId = consensusBranchId !== null && consensusBranchId !== void 0 ? 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiWmNhc2hUcmFuc2FjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iaXRnby96Y2FzaC9aY2FzaFRyYW5zYWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLGlEQUFvRDtBQUNwRCxpREFBaUQ7QUFDakQsK0RBQTJFO0FBRTNFLE1BQU0sT0FBTyxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDO0FBQzNDLE1BQU0sU0FBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUd2Qyx3REFBbUU7QUFDbkUseURBQTBHO0FBQzFHLCtDQUFrRjtBQUVsRixNQUFNLElBQUksR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDLGtFQUFrRSxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBSXBHLDhFQUE4RTtBQUM5RSxNQUFNLHdCQU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zaW9uID09PSA1KSB7XG4gICAgICByZXR1cm4gZ2V0VHhpZERpZ2VzdCh0aGlzKTtcbiAgICB9XG4gICAgcmV0dXJuIGNyeXB0by5oYXNoMjU2KHRoaXMudG9CdWZmZXIoKSk7XG4gIH1cblxuICBjbG9uZTxUTjIgZXh0ZW5kcyBudW1iZXIgfCBiaWdpbnQgPSBUTnVtYmVyPihhbW91bnRUeXBlPzogJ2JpZ2ludCcgfCAnbnVtYmVyJyk6IFpjYXNoVHJhbnNhY3Rpb248VE4yPiB7XG4gICAgcmV0dXJuIG5ldyBaY2FzaFRyYW5zYWN0aW9uPFROMj4odGhpcy5uZXR3b3JrLCB0aGlzLCBhbW91bnRUeXBlKTtcbiAgfVxufVxuIl19
@@ -1,6 +1,6 @@
1
1
  import { ECPairAPI, ECPairInterface } from 'ecpair';
2
2
  import { BIP32API, BIP32Interface } from 'bip32';
3
- import { MuSig } from './musig';
3
+ import { MuSig } from '@brandonblack/musig';
4
4
  declare const ecc: {
5
5
  isPoint: (p: Uint8Array) => boolean;
6
6
  isPrivate: (d: Uint8Array) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"noble_ecc.d.ts","sourceRoot":"","sources":["../../src/noble_ecc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAiB,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAgB,cAAc,EAAE,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,KAAK,EAAgB,MAAM,SAAS,CAAC;AAyC9C,QAAA,MAAM,GAAG;iBACM,UAAU,KAAG,OAAO;mBAClB,UAAU,KAAG,OAAO;sBACjB,UAAU,KAAG,OAAO;4BAEd,UAAU,SAAS,UAAU,KAAG;QAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,WAAW,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI;0BAOnF,UAAU,uCAAyB,UAAU,GAAG,IAAI;uBAGvD,UAAU,uCAAyB,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G,IAAI;uBAGvD,UAAU,uCAAyB,UAAU;uBAI7C,UAAU,SAAS,UAAU,uCAAyB,UAAU,GAAG,IAAI;kBAG5E,UAAU,KAAK,UAAU,uCAAyB,UAAU,GAAG,IAAI;wBAO7D,UAAU,SAAS,UAAU,uCAAyB,UAAU,GAAG,IAAI;oBAG3E,UAAU,SAAS,UAAU,KAAG,UAAU,GAAG,IAAI;uBAS9C,UAAU,KAAG,UAAU;cAEhC,UAAU,KAAK,UAAU,iCAAmB,UAAU;qBAI/C,UAAU,KAAK,UAAU,MAAK,UAAU,KAA4B,UAAU;gBAInF,UAAU,KAAK,UAAU,aAAa,UAAU,mCAAqB,OAAO;uBAIrE,UAAU,KAAK,UAAU,aAAa,UAAU,KAAG,OAAO;CAG9E,CAAC;AAkEF,QAAA,MAAM,MAAM,EAAE,SAA8B,CAAC;AAC7C,QAAA,MAAM,KAAK,EAAE,QAA4B,CAAC;AAC1C,QAAA,MAAM,KAAK,EAAE,KAA4B,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC"}
@@ -7,9 +7,9 @@ const ecpair_1 = require("ecpair");
7
7
  const necc = require("@noble/secp256k1");
8
8
  const bip32_1 = require("bip32");
9
9
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
- // @ts-ignore base_crypto is exported as a subPath export, ignoring since compiler complains about importing like this // #9286F8 Fixing import in react-native
11
- const baseCrypto = require("./base_crypto");
12
- const musig_1 = require("./musig");
10
+ // @ts-ignore base_crypto is exported as a subPath export, ignoring since compiler complains about importing like this
11
+ const baseCrypto = require("@brandonblack/musig/lib/base_crypto");
12
+ const musig_1 = require("@brandonblack/musig");
13
13
  necc.utils.sha256Sync = (...messages) => {
14
14
  const sha256 = createHash('sha256');
15
15
  for (const message of messages)
@@ -71,7 +71,7 @@ const ecc = {
71
71
  const res = necc.utils.privateAdd(d, tweak);
72
72
  // tiny-secp256k1 returns null rather than allowing a 0 private key to be returned
73
73
  // ECPair.testEcc() requires that behavior.
74
- if (res?.every((i) => i === 0))
74
+ if (res === null || res === void 0 ? void 0 : res.every((i) => i === 0))
75
75
  return null;
76
76
  return res;
77
77
  }),
@@ -169,4 +169,4 @@ const bip32 = bip32_1.BIP32Factory(ecc);
169
169
  exports.bip32 = bip32;
170
170
  const musig = musig_1.MuSigFactory(crypto);
171
171
  exports.musig = musig;
172
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9ibGVfZWNjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL25vYmxlX2VjYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQ0FBMEM7QUFDMUMsMENBQTBDO0FBQzFDLG1DQUFtRTtBQUNuRSx5Q0FBeUM7QUFDekMsaUNBQStEO0FBQy9ELDZEQUE2RDtBQUM3RCwrSkFBK0o7QUFDL0osNENBQTRDO0FBQzVDLG1DQUE4QztBQUU5QyxJQUFJLENBQUMsS0FBSyxDQUFDLFVBQVUsR0FBRyxDQUFDLEdBQUcsUUFBc0IsRUFBYyxFQUFFO0lBQ2hFLE1BQU0sTUFBTSxHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUNwQyxLQUFLLE1BQU0sT0FBTyxJQUFJLFFBQVE7UUFBRSxNQUFNLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3ZELE9BQU8sTUFBTSxDQUFDLE1BQU0sRUFBRSxDQUFDO0FBQ3pCLENBQUMsQ0FBQztBQUVGLElBQUksQ0FBQyxLQUFLLENBQUMsY0FBYyxHQUFHLENBQUMsR0FBZSxFQUFFLEdBQUcsUUFBc0IsRUFBYyxFQUFFO0lBQ3JGLE1BQU0sSUFBSSxHQUFHLFVBQVUsQ0FBQyxRQU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eSB7XG4gICAgICByZXR1cm4gbmVjYy5nZXRQdWJsaWNLZXkocywgY29tcHJlc3MpO1xuICAgIH0gY2F0Y2gge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuICB9LFxuICB0YWdnZWRIYXNoOiBuZWNjLnV0aWxzLnRhZ2dlZEhhc2hTeW5jLFxuICBzaGEyNTYoLi4ubWVzc2FnZXM6IFVpbnQ4QXJyYXlbXSk6IFVpbnQ4QXJyYXkge1xuICAgIGNvbnN0IHNoYTI1NiA9IGNyZWF0ZUhhc2goJ3NoYTI1NicpO1xuICAgIGZvciAoY29uc3QgbWVzc2FnZSBvZiBtZXNzYWdlcykgc2hhMjU2LnVwZGF0ZShtZXNzYWdlKTtcbiAgICByZXR1cm4gc2hhMjU2LmRpZ2VzdCgpO1xuICB9LFxufTtcblxuY29uc3QgRUNQYWlyOiBFQ1BhaXJBUEkgPSBFQ1BhaXJGYWN0b3J5KGVjYyk7XG5jb25zdCBiaXAzMjogQklQMzJBUEkgPSBCSVAzMkZhY3RvcnkoZWNjKTtcbmNvbnN0IG11c2lnOiBNdVNpZyA9IE11U2lnRmFjdG9yeShjcnlwdG8pO1xuXG5leHBvcnQgeyBlY2MsIEVDUGFpciwgRUNQYWlyQVBJLCBFQ1BhaXJJbnRlcmZhY2UsIGJpcDMyLCBCSVAzMkFQSSwgQklQMzJJbnRlcmZhY2UsIG11c2lnLCBNdVNpZyB9O1xuIl19
@@ -33,6 +33,7 @@ function isPlainPubkeys(pubkeys) {
33
33
  }
34
34
  // output: OP_1 {witnessProgram}
35
35
  function p2tr(a, opts) {
36
+ var _a, _b, _c, _d;
36
37
  if (!a.address && !a.pubkey && !a.pubkeys && !(a.redeems && a.redeems.length) && !a.output && !a.witness) {
37
38
  throw new TypeError('Not enough data');
38
39
  }
@@ -109,6 +110,7 @@ function p2tr(a, opts) {
109
110
  }
110
111
  });
111
112
  bitcoinjs_lib_1.lazy.prop(o, 'internalPubkey', () => {
113
+ var _a;
112
114
  if (a.pubkey) {
113
115
  // single pubkey
114
116
  return a.pubkey;
@@ -124,7 +126,7 @@ function p2tr(a, opts) {
124
126
  return Buffer.from(taproot.aggregateMuSigPubkeys(ecc, a.pubkeys));
125
127
  }
126
128
  else if (_parsedControlBlock()) {
127
- return _parsedControlBlock()?.internalPubkey;
129
+ return (_a = _parsedControlBlock()) === null || _a === void 0 ? void 0 : _a.internalPubkey;
128
130
  }
129
131
  else {
130
132
  // If there is no key path spending condition, we use an internal key with unknown secret key.
@@ -137,6 +139,7 @@ function p2tr(a, opts) {
137
139
  }
138
140
  });
139
141
  bitcoinjs_lib_1.lazy.prop(o, 'taptreeRoot', () => {
142
+ var _a;
140
143
  const parsedControlBlock = _parsedControlBlock();
141
144
  const parsedWitness = _parsedWitness();
142
145
  let taptreeRoot;
@@ -154,7 +157,7 @@ function p2tr(a, opts) {
154
157
  taptreeRoot = taproot.getTaptreeRoot(ecc, parsedControlBlock, tapscript);
155
158
  }
156
159
  if (!taptreeRoot && _taprootPaths())
157
- taptreeRoot = _taprootPaths()?.root;
160
+ taptreeRoot = (_a = _taprootPaths()) === null || _a === void 0 ? void 0 : _a.root;
158
161
  return taptreeRoot;
159
162
  });
160
163
  const _taprootPubkey = bitcoinjs_lib_1.lazy.value(() => {
@@ -163,7 +166,7 @@ function p2tr(a, opts) {
163
166
  if (!a.pubkey && !(a.pubkeys && a.pubkeys.length) && !a.redeems && !taptreeRoot) {
164
167
  return;
165
168
  }
166
- return taproot.tapTweakPubkey(ecc, o?.internalPubkey, taptreeRoot);
169
+ return taproot.tapTweakPubkey(ecc, o === null || o === void 0 ? void 0 : o.internalPubkey, taptreeRoot);
167
170
  });
168
171
  bitcoinjs_lib_1.lazy.prop(o, 'tapTree', () => {
169
172
  if (!a.redeems)
@@ -186,7 +189,8 @@ function p2tr(a, opts) {
186
189
  };
187
190
  });
188
191
  bitcoinjs_lib_1.lazy.prop(o, 'address', () => {
189
- const pubkey = _outputPubkey() || (_taprootPubkey() && _taprootPubkey()?.xOnlyPubkey);
192
+ var _a;
193
+ const pubkey = _outputPubkey() || (_taprootPubkey() && ((_a = _taprootPubkey()) === null || _a === void 0 ? void 0 : _a.xOnlyPubkey));
190
194
  // only encode the 32 byte witness program as bech32m
191
195
  const words = bech32m.toWords(pubkey);
192
196
  words.unshift(0x01);
@@ -284,23 +288,23 @@ function p2tr(a, opts) {
284
288
  throw new TypeError('Output is invalid');
285
289
  }
286
290
  // if we're passed both an output script and an address, ensure they match
287
- if (a.address && _outputPubkey && !_outputPubkey()?.equals(_address()?.data)) {
291
+ if (a.address && _outputPubkey && !((_a = _outputPubkey()) === null || _a === void 0 ? void 0 : _a.equals((_b = _address()) === null || _b === void 0 ? void 0 : _b.data))) {
288
292
  throw new TypeError('mismatch between address & output');
289
293
  }
290
294
  // Wrapping `taprootPubkey.xOnlyPubkey` in Buffer because of a peculiar issue in the frontend
291
295
  // where a polyfill for Buffer is used. Refer: https://bitgoinc.atlassian.net/browse/BG-61420
292
- if (taprootPubkey && _outputPubkey && !_outputPubkey()?.equals(Buffer.from(taprootPubkey.xOnlyPubkey))) {
296
+ if (taprootPubkey && _outputPubkey && !((_c = _outputPubkey()) === null || _c === void 0 ? void 0 : _c.equals(Buffer.from(taprootPubkey.xOnlyPubkey)))) {
293
297
  throw new TypeError('mismatch between output and taproot pubkey');
294
298
  }
295
299
  }
296
300
  if (a.address) {
297
- if (taprootPubkey && !_address()?.data.equals(Buffer.from(taprootPubkey.xOnlyPubkey))) {
301
+ if (taprootPubkey && !((_d = _address()) === null || _d === void 0 ? void 0 : _d.data.equals(Buffer.from(taprootPubkey.xOnlyPubkey)))) {
298
302
  throw new TypeError('mismatch between address and taproot pubkey');
299
303
  }
300
304
  }
301
305
  const parsedControlBlock = _parsedControlBlock();
302
306
  if (parsedControlBlock) {
303
- if (!parsedControlBlock.internalPubkey.equals(o?.internalPubkey)) {
307
+ if (!parsedControlBlock.internalPubkey.equals(o === null || o === void 0 ? void 0 : o.internalPubkey)) {
304
308
  throw new TypeError('Internal pubkey mismatch');
305
309
  }
306
310
  if (taprootPubkey && parsedControlBlock.parity !== taprootPubkey.parity) {
@@ -347,4 +351,4 @@ function p2tr(a, opts) {
347
351
  return Object.assign(o, a);
348
352
  }
349
353
  exports.p2tr = p2tr;
350
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicDJ0ci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wYXltZW50cy9wMnRyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwyREFBMkQ7QUFDM0QsaUVBQWlFOzs7QUFFakUsMENBQXVDO0FBQ3ZDLGlEQUE4RTtBQUM5RSxzQ0FBc0M7QUFDdEMsNENBQXFDO0FBQ3JDLHlDQUF5QztBQUV6QyxNQUFNLEtBQUssR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUM7QUFDbkMsTUFBTSxHQUFHLEdBQUcsc0JBQU8sQ0FBQyxHQUFHLENBQUM7QUFFeEIsTUFBTSxFQUFFLE9BQU8sRUFBRSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUV0QyxNQUFNLGVBQWUsR0FBRyxtQkFBUSxDQUFDLE9BQU8sQ0FBQztBQUV6Qzs7O0dBR0c7QUFDSCxNQUFNLENBQUMsR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDLGtFQUFrRSxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQ2pHLE1BQU0sWUFBWSxHQUFHLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFFckMsU0FBUyxhQUFhLENBQUMsTUFBa0I7SUFDdkMsSUFBSSxNQUFNLENBQUMsTUFBTSxLQUFLLEVBQUU7UUFBRSxPQUFPLEtBQUssQ0FBQztJQUN2QyxJQUFJO1FBQ0YsT0FBTyxDQUFDLENBQUMsSUFBSSxDQUFDLEtBQU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