@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 +10 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -359,10 +359,8 @@ var stakingPsbt = (stakingTx, network, inputUTXOs, publicKeyNoCoord) => {
|
|
|
359
359
|
throw new Error("Invalid public key");
|
|
360
360
|
}
|
|
361
361
|
const psbt = new Psbt({ network });
|
|
362
|
-
if (stakingTx.version !== void 0)
|
|
363
|
-
|
|
364
|
-
if (stakingTx.locktime !== void 0)
|
|
365
|
-
psbt.setLocktime(stakingTx.locktime);
|
|
362
|
+
if (stakingTx.version !== void 0) psbt.setVersion(stakingTx.version);
|
|
363
|
+
if (stakingTx.locktime !== void 0) psbt.setLocktime(stakingTx.locktime);
|
|
366
364
|
stakingTx.ins.forEach((input) => {
|
|
367
365
|
const inputUTXO = findInputUTXO(inputUTXOs, input);
|
|
368
366
|
const psbtInputData = getPsbtInputFields(inputUTXO, publicKeyNoCoord);
|
|
@@ -380,10 +378,8 @@ var stakingPsbt = (stakingTx, network, inputUTXOs, publicKeyNoCoord) => {
|
|
|
380
378
|
};
|
|
381
379
|
var stakingExpansionPsbt = (network, stakingTx, previousStakingTxInfo, inputUTXOs, previousScripts, publicKeyNoCoord) => {
|
|
382
380
|
const psbt = new Psbt({ network });
|
|
383
|
-
if (stakingTx.version !== void 0)
|
|
384
|
-
|
|
385
|
-
if (stakingTx.locktime !== void 0)
|
|
386
|
-
psbt.setLocktime(stakingTx.locktime);
|
|
381
|
+
if (stakingTx.version !== void 0) psbt.setVersion(stakingTx.version);
|
|
382
|
+
if (stakingTx.locktime !== void 0) psbt.setLocktime(stakingTx.locktime);
|
|
387
383
|
if (publicKeyNoCoord && publicKeyNoCoord.length !== NO_COORD_PK_BYTE_LENGTH) {
|
|
388
384
|
throw new Error("Invalid public key");
|
|
389
385
|
}
|
|
@@ -1997,8 +1993,7 @@ var BABYLON_REGISTRY_TYPE_URLS = {
|
|
|
1997
1993
|
// src/utils/index.ts
|
|
1998
1994
|
var reverseBuffer = (buffer) => {
|
|
1999
1995
|
const clonedBuffer = new Uint8Array(buffer);
|
|
2000
|
-
if (clonedBuffer.length < 1)
|
|
2001
|
-
return clonedBuffer;
|
|
1996
|
+
if (clonedBuffer.length < 1) return clonedBuffer;
|
|
2002
1997
|
for (let i = 0, j = clonedBuffer.length - 1; i < clonedBuffer.length / 2; i++, j--) {
|
|
2003
1998
|
let tmp = clonedBuffer[i];
|
|
2004
1999
|
clonedBuffer[i] = clonedBuffer[j];
|
|
@@ -2034,14 +2029,12 @@ var getBabylonParamByBtcHeight = (height, babylonParamsVersions) => {
|
|
|
2034
2029
|
const params = sortedParams.find(
|
|
2035
2030
|
(p) => height >= p.btcActivationHeight
|
|
2036
2031
|
);
|
|
2037
|
-
if (!params)
|
|
2038
|
-
throw new Error(`Babylon params not found for height ${height}`);
|
|
2032
|
+
if (!params) throw new Error(`Babylon params not found for height ${height}`);
|
|
2039
2033
|
return params;
|
|
2040
2034
|
};
|
|
2041
2035
|
var getBabylonParamByVersion = (version, babylonParams) => {
|
|
2042
2036
|
const params = babylonParams.find((p) => p.version === version);
|
|
2043
|
-
if (!params)
|
|
2044
|
-
throw new Error(`Babylon params not found for version ${version}`);
|
|
2037
|
+
if (!params) throw new Error(`Babylon params not found for version ${version}`);
|
|
2045
2038
|
return params;
|
|
2046
2039
|
};
|
|
2047
2040
|
|