@bitgo-beta/babylonlabs-io-btc-staking-ts 0.4.0-beta.644 → 0.4.0-beta.645

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  BabylonBtcStakingManager: () => BabylonBtcStakingManager,
34
34
  BitcoinScriptType: () => BitcoinScriptType,
35
35
  ObservableStaking: () => ObservableStaking,
@@ -70,7 +70,7 @@ __export(src_exports, {
70
70
  withdrawSlashingTransaction: () => withdrawSlashingTransaction,
71
71
  withdrawTimelockUnbondedTransaction: () => withdrawTimelockUnbondedTransaction
72
72
  });
73
- module.exports = __toCommonJS(src_exports);
73
+ module.exports = __toCommonJS(index_exports);
74
74
 
75
75
  // src/error/index.ts
76
76
  var StakingError = class _StakingError extends Error {
@@ -433,10 +433,8 @@ var stakingPsbt = (stakingTx, network, inputUTXOs, publicKeyNoCoord) => {
433
433
  throw new Error("Invalid public key");
434
434
  }
435
435
  const psbt = new import_bitcoinjs_lib4.Psbt({ network });
436
- if (stakingTx.version !== void 0)
437
- psbt.setVersion(stakingTx.version);
438
- if (stakingTx.locktime !== void 0)
439
- psbt.setLocktime(stakingTx.locktime);
436
+ if (stakingTx.version !== void 0) psbt.setVersion(stakingTx.version);
437
+ if (stakingTx.locktime !== void 0) psbt.setLocktime(stakingTx.locktime);
440
438
  stakingTx.ins.forEach((input) => {
441
439
  const inputUTXO = findInputUTXO(inputUTXOs, input);
442
440
  const psbtInputData = getPsbtInputFields(inputUTXO, publicKeyNoCoord);
@@ -454,10 +452,8 @@ var stakingPsbt = (stakingTx, network, inputUTXOs, publicKeyNoCoord) => {
454
452
  };
455
453
  var stakingExpansionPsbt = (network, stakingTx, previousStakingTxInfo, inputUTXOs, previousScripts, publicKeyNoCoord) => {
456
454
  const psbt = new import_bitcoinjs_lib4.Psbt({ network });
457
- if (stakingTx.version !== void 0)
458
- psbt.setVersion(stakingTx.version);
459
- if (stakingTx.locktime !== void 0)
460
- psbt.setLocktime(stakingTx.locktime);
455
+ if (stakingTx.version !== void 0) psbt.setVersion(stakingTx.version);
456
+ if (stakingTx.locktime !== void 0) psbt.setLocktime(stakingTx.locktime);
461
457
  if (publicKeyNoCoord && publicKeyNoCoord.length !== NO_COORD_PK_BYTE_LENGTH) {
462
458
  throw new Error("Invalid public key");
463
459
  }
@@ -2061,8 +2057,7 @@ var BABYLON_REGISTRY_TYPE_URLS = {
2061
2057
  // src/utils/index.ts
2062
2058
  var reverseBuffer = (buffer) => {
2063
2059
  const clonedBuffer = new Uint8Array(buffer);
2064
- if (clonedBuffer.length < 1)
2065
- return clonedBuffer;
2060
+ if (clonedBuffer.length < 1) return clonedBuffer;
2066
2061
  for (let i = 0, j = clonedBuffer.length - 1; i < clonedBuffer.length / 2; i++, j--) {
2067
2062
  let tmp = clonedBuffer[i];
2068
2063
  clonedBuffer[i] = clonedBuffer[j];
@@ -2098,14 +2093,12 @@ var getBabylonParamByBtcHeight = (height, babylonParamsVersions) => {
2098
2093
  const params = sortedParams.find(
2099
2094
  (p) => height >= p.btcActivationHeight
2100
2095
  );
2101
- if (!params)
2102
- throw new Error(`Babylon params not found for height ${height}`);
2096
+ if (!params) throw new Error(`Babylon params not found for height ${height}`);
2103
2097
  return params;
2104
2098
  };
2105
2099
  var getBabylonParamByVersion = (version, babylonParams) => {
2106
2100
  const params = babylonParams.find((p) => p.version === version);
2107
- if (!params)
2108
- throw new Error(`Babylon params not found for version ${version}`);
2101
+ if (!params) throw new Error(`Babylon params not found for version ${version}`);
2109
2102
  return params;
2110
2103
  };
2111
2104