@babylonlabs-io/ts-sdk 0.15.1 → 0.15.3
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/{challengeAssert-CenzzhZU.js → challengeAssert-C5DQSUnp.js} +249 -265
- package/dist/challengeAssert-C5DQSUnp.js.map +1 -0
- package/dist/challengeAssert-D7SqsNpQ.cjs +2 -0
- package/dist/challengeAssert-D7SqsNpQ.cjs.map +1 -0
- package/dist/errors-BZc3Urez.cjs +2 -0
- package/dist/errors-BZc3Urez.cjs.map +1 -0
- package/dist/{errors-2TV9gKO6.js → errors-UqmtfBtv.js} +780 -638
- package/dist/errors-UqmtfBtv.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +60 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +2 -2
- package/dist/tbv/core/managers/PeginManager.d.ts +64 -6
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.d.ts +1 -1
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +1 -1
- package/dist/tbv/core/primitives/psbt/__tests__/constants.d.ts +2 -13
- package/dist/tbv/core/primitives/psbt/__tests__/constants.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/depositorPayout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/noPayout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/scripts/payout.d.ts +7 -0
- package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts +17 -0
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
- package/dist/tbv/core/utils/transaction/createSplitTransaction.d.ts.map +1 -1
- package/dist/tbv/core/utils/transaction/fundPeginTransaction.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +2 -2
- package/package.json +3 -3
- package/dist/challengeAssert-BpzES0KW.cjs +0 -2
- package/dist/challengeAssert-BpzES0KW.cjs.map +0 -1
- package/dist/challengeAssert-CenzzhZU.js.map +0 -1
- package/dist/errors-2TV9gKO6.js.map +0 -1
- package/dist/errors-ryNiW8NM.cjs +0 -2
- package/dist/errors-ryNiW8NM.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./shared/index.cjs"),e=require("./challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./shared/index.cjs"),e=require("./challengeAssert-D7SqsNpQ.cjs"),r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),t=require("./errors-BZc3Urez.cjs");exports.BitcoinNetworks=i.BitcoinNetworks;exports.BTC_DUST_SAT=e.BTC_DUST_SAT;exports.DUST_THRESHOLD=e.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=e.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=e.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=e.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=e.P2TR_INPUT_SIZE;exports.PEGIN_FIXED_OUTPUTS=e.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=e.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=e.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=e.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.buildChallengeAssertPsbt=e.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=e.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=e.buildNoPayoutPsbt;exports.buildPayoutPsbt=e.buildPayoutPsbt;exports.buildPeginInputPsbt=e.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=e.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=e.buildPrePeginPsbt;exports.buildRefundPsbt=e.buildRefundPsbt;exports.computeNumLocalChallengers=e.computeNumLocalChallengers;exports.createPayoutScript=e.createPayoutScript;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.extractPayoutSignature=e.extractPayoutSignature;exports.extractPeginInputSignature=e.extractPeginInputSignature;exports.finalizePeginInputPsbt=e.finalizePeginInputPsbt;exports.fundPeginTransaction=e.fundPeginTransaction;exports.getNetwork=e.getNetwork;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.parseUnfundedWasmTransaction=e.parseUnfundedWasmTransaction;exports.peginOutputCount=e.peginOutputCount;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.rateBasedTxBufferFee=e.rateBasedTxBufferFee;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>r.deriveVaultId});exports.BTCVaultRegistryABI=t.BTCVaultRegistryABI;exports.BitcoinScriptType=t.BitcoinScriptType;exports.CONTRACT_ERRORS=t.CONTRACT_ERRORS;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.PayoutManager=t.PayoutManager;exports.PeginManager=t.PeginManager;exports.calculateBtcTxHash=t.calculateBtcTxHash;exports.computeWotsPkHash=t.computeWotsPkHash;exports.createSplitTransaction=t.createSplitTransaction;exports.createSplitTransactionPsbt=t.createSplitTransactionPsbt;exports.createTaprootScriptPathSignOptions=t.createTaprootScriptPathSignOptions;exports.deriveWotsKeypair=t.deriveWotsKeypair;exports.deriveWotsPkHash=t.deriveWotsPkHash;exports.extractErrorData=t.extractErrorData;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getContractErrorMessage=t.getContractErrorMessage;exports.getDustThreshold=t.getDustThreshold;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getPsbtInputFields=t.getPsbtInputFields;exports.getScriptType=t.getScriptType;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.handleContractError=t.handleContractError;exports.isKnownContractError=t.isKnownContractError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.keypairToPublicKey=t.keypairToPublicKey;exports.mnemonicToWotsSeed=t.mnemonicToWotsSeed;exports.pushTx=t.pushTx;exports.selectUtxosForPegin=t.selectUtxosForPegin;exports.shouldAddChangeOutput=t.shouldAddChangeOutput;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BitcoinNetworks as e } from "./shared/index.js";
|
|
2
|
-
import { B as r, D as o, F as i, L as n, M as u, P as T, z as P, S as d, T as l, W as c, l as p, j as g, k as E, h as _, d as A, a as x, b as S, g as b, c as y, m as I, n as R, o as m, s as C, i as F, e as U, f as O, E as f, G as h, p as L, q as M, r as H, C as N, A as B, t as D, y as W, u as k, v, w, x as X } from "./challengeAssert-
|
|
2
|
+
import { B as r, D as o, F as i, L as n, M as u, P as T, z as P, S as d, T as l, W as c, l as p, j as g, k as E, h as _, d as A, a as x, b as S, g as b, c as y, m as I, n as R, o as m, s as C, i as F, e as U, f as O, E as f, G as h, p as L, q as M, r as H, C as N, A as B, t as D, y as W, u as k, v, w, x as X } from "./challengeAssert-C5DQSUnp.js";
|
|
3
3
|
import { computeMinClaimValue as V, deriveVaultId as Y } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
4
|
-
import { r as z, B as Z, C as j, M as q, i as J, P as Q, c as $, A as aa, b as sa, d as ea, h as ta, y as ra, D as oa, t as ia, j as na, k as ua, u as Ta, g as Pa, l as da, m as la, f as ca, e as pa, n as ga, o as Ea, p as _a, w as Aa, v as xa, E as Sa, z as ba, x as ya, q as Ia, s as Ra, a as ma } from "./errors-
|
|
4
|
+
import { r as z, B as Z, C as j, M as q, i as J, P as Q, c as $, A as aa, b as sa, d as ea, h as ta, y as ra, D as oa, t as ia, j as na, k as ua, u as Ta, g as Pa, l as da, m as la, f as ca, e as pa, n as ga, o as Ea, p as _a, w as Aa, v as xa, E as Sa, z as ba, x as ya, q as Ia, s as Ra, a as ma } from "./errors-UqmtfBtv.js";
|
|
5
5
|
export {
|
|
6
6
|
z as BTCVaultRegistryABI,
|
|
7
7
|
r as BTC_DUST_SAT,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* Minimal ABI for BTCVaultRegistry contract.
|
|
11
|
-
* Contains submitPeginRequest, activateVaultWithSecret, getPegInFee, and getBTCVault.
|
|
11
|
+
* Contains submitPeginRequest, submitPeginRequestBatch, activateVaultWithSecret, getPegInFee, and getBTCVault.
|
|
12
12
|
*/
|
|
13
13
|
export declare const BTCVaultRegistryABI: readonly [{
|
|
14
14
|
readonly type: "function";
|
|
@@ -114,6 +114,65 @@ export declare const BTCVaultRegistryABI: readonly [{
|
|
|
114
114
|
readonly internalType: "bytes32";
|
|
115
115
|
}];
|
|
116
116
|
readonly stateMutability: "payable";
|
|
117
|
+
}, {
|
|
118
|
+
readonly type: "function";
|
|
119
|
+
readonly name: "submitPeginRequestBatch";
|
|
120
|
+
readonly inputs: readonly [{
|
|
121
|
+
readonly name: "depositor";
|
|
122
|
+
readonly type: "address";
|
|
123
|
+
readonly internalType: "address";
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "vaultProvider";
|
|
126
|
+
readonly type: "address";
|
|
127
|
+
readonly internalType: "address";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "requests";
|
|
130
|
+
readonly type: "tuple[]";
|
|
131
|
+
readonly internalType: "struct IBTCVaultRegistry.BatchPeginRequest[]";
|
|
132
|
+
readonly components: readonly [{
|
|
133
|
+
readonly name: "depositorBtcPubKey";
|
|
134
|
+
readonly type: "bytes32";
|
|
135
|
+
readonly internalType: "bytes32";
|
|
136
|
+
}, {
|
|
137
|
+
readonly name: "btcPopSignature";
|
|
138
|
+
readonly type: "bytes";
|
|
139
|
+
readonly internalType: "bytes";
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "unsignedPrePeginTx";
|
|
142
|
+
readonly type: "bytes";
|
|
143
|
+
readonly internalType: "bytes";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "depositorSignedPeginTx";
|
|
146
|
+
readonly type: "bytes";
|
|
147
|
+
readonly internalType: "bytes";
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "hashlock";
|
|
150
|
+
readonly type: "bytes32";
|
|
151
|
+
readonly internalType: "bytes32";
|
|
152
|
+
}, {
|
|
153
|
+
readonly name: "htlcVout";
|
|
154
|
+
readonly type: "uint8";
|
|
155
|
+
readonly internalType: "uint8";
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "referralCode";
|
|
158
|
+
readonly type: "uint32";
|
|
159
|
+
readonly internalType: "uint32";
|
|
160
|
+
}, {
|
|
161
|
+
readonly name: "depositorPayoutBtcAddress";
|
|
162
|
+
readonly type: "bytes";
|
|
163
|
+
readonly internalType: "bytes";
|
|
164
|
+
}, {
|
|
165
|
+
readonly name: "depositorWotsPkHash";
|
|
166
|
+
readonly type: "bytes32";
|
|
167
|
+
readonly internalType: "bytes32";
|
|
168
|
+
}];
|
|
169
|
+
}];
|
|
170
|
+
readonly outputs: readonly [{
|
|
171
|
+
readonly name: "vaultIds";
|
|
172
|
+
readonly type: "bytes32[]";
|
|
173
|
+
readonly internalType: "bytes32[]";
|
|
174
|
+
}];
|
|
175
|
+
readonly stateMutability: "payable";
|
|
117
176
|
}, {
|
|
118
177
|
readonly type: "function";
|
|
119
178
|
readonly name: "activateVaultWithSecret";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BTCVaultRegistry.abi.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/contracts/abis/BTCVaultRegistry.abi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"BTCVaultRegistry.abi.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/contracts/abis/BTCVaultRegistry.abi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqStB,CAAC"}
|
package/dist/tbv/core/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../challengeAssert-D7SqsNpQ.cjs"),r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),t=require("../../errors-BZc3Urez.cjs");exports.BTC_DUST_SAT=e.BTC_DUST_SAT;exports.DUST_THRESHOLD=e.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=e.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=e.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=e.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=e.P2TR_INPUT_SIZE;exports.PEGIN_FIXED_OUTPUTS=e.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=e.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=e.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=e.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.buildChallengeAssertPsbt=e.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=e.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=e.buildNoPayoutPsbt;exports.buildPayoutPsbt=e.buildPayoutPsbt;exports.buildPeginInputPsbt=e.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=e.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=e.buildPrePeginPsbt;exports.buildRefundPsbt=e.buildRefundPsbt;exports.computeNumLocalChallengers=e.computeNumLocalChallengers;exports.createPayoutScript=e.createPayoutScript;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.extractPayoutSignature=e.extractPayoutSignature;exports.extractPeginInputSignature=e.extractPeginInputSignature;exports.finalizePeginInputPsbt=e.finalizePeginInputPsbt;exports.fundPeginTransaction=e.fundPeginTransaction;exports.getNetwork=e.getNetwork;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.parseUnfundedWasmTransaction=e.parseUnfundedWasmTransaction;exports.peginOutputCount=e.peginOutputCount;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.rateBasedTxBufferFee=e.rateBasedTxBufferFee;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>r.deriveVaultId});exports.BTCVaultRegistryABI=t.BTCVaultRegistryABI;exports.BitcoinScriptType=t.BitcoinScriptType;exports.CONTRACT_ERRORS=t.CONTRACT_ERRORS;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.PayoutManager=t.PayoutManager;exports.PeginManager=t.PeginManager;exports.calculateBtcTxHash=t.calculateBtcTxHash;exports.computeWotsPkHash=t.computeWotsPkHash;exports.createSplitTransaction=t.createSplitTransaction;exports.createSplitTransactionPsbt=t.createSplitTransactionPsbt;exports.createTaprootScriptPathSignOptions=t.createTaprootScriptPathSignOptions;exports.deriveWotsKeypair=t.deriveWotsKeypair;exports.deriveWotsPkHash=t.deriveWotsPkHash;exports.extractErrorData=t.extractErrorData;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getContractErrorMessage=t.getContractErrorMessage;exports.getDustThreshold=t.getDustThreshold;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getPsbtInputFields=t.getPsbtInputFields;exports.getScriptType=t.getScriptType;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.handleContractError=t.handleContractError;exports.isKnownContractError=t.isKnownContractError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.keypairToPublicKey=t.keypairToPublicKey;exports.mnemonicToWotsSeed=t.mnemonicToWotsSeed;exports.pushTx=t.pushTx;exports.selectUtxosForPegin=t.selectUtxosForPegin;exports.shouldAddChangeOutput=t.shouldAddChangeOutput;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as e, D as t, F as r, L as i, M as o, P as n, z as u, S as T, T as P, W as d, l, j as c, k as g, h as p, d as E, a as _, b as A, g as S, c as x, m as b, n as y, o as I, s as R, i as C, e as F, f as U, E as m, G as O, p as h, q as f, r as L, C as M, A as H, t as N, y as B, u as D, v as W, w as v, x as k } from "../../challengeAssert-
|
|
1
|
+
import { B as e, D as t, F as r, L as i, M as o, P as n, z as u, S as T, T as P, W as d, l, j as c, k as g, h as p, d as E, a as _, b as A, g as S, c as x, m as b, n as y, o as I, s as R, i as C, e as F, f as U, E as m, G as O, p as h, q as f, r as L, C as M, A as H, t as N, y as B, u as D, v as W, w as v, x as k } from "../../challengeAssert-C5DQSUnp.js";
|
|
2
2
|
import { computeMinClaimValue as X, deriveVaultId as K } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { r as Y, B as G, C as z, M as Z, i as j, P as q, c as J, A as Q, b as $, d as aa, h as sa, y as ea, D as ta, t as ra, j as ia, k as oa, u as na, g as ua, l as Ta, m as Pa, f as da, e as la, n as ca, o as ga, p as pa, w as Ea, v as _a, E as Aa, z as Sa, x as xa, q as ba, s as ya, a as Ia } from "../../errors-
|
|
3
|
+
import { r as Y, B as G, C as z, M as Z, i as j, P as q, c as J, A as Q, b as $, d as aa, h as sa, y as ea, D as ta, t as ra, j as ia, k as oa, u as na, g as ua, l as Ta, m as Pa, f as da, e as la, n as ca, o as ga, p as pa, w as Ea, v as _a, E as Aa, z as Sa, x as xa, q as ba, s as ya, a as Ia } from "../../errors-UqmtfBtv.js";
|
|
4
4
|
export {
|
|
5
5
|
Y as BTCVaultRegistryABI,
|
|
6
6
|
e as BTC_DUST_SAT,
|
|
@@ -210,12 +210,6 @@ export interface RegisterPeginParams {
|
|
|
210
210
|
* Useful for multi-vault deposits where PoP only needs to be signed once.
|
|
211
211
|
*/
|
|
212
212
|
preSignedBtcPopSignature?: Hex;
|
|
213
|
-
/**
|
|
214
|
-
* SHA-256 hash of the depositor's secret (bytes32).
|
|
215
|
-
* Required for the new peg-in flow deposits.
|
|
216
|
-
* TODO: Wire into submitPeginRequest contract call when contract ABI is updated to support the new peg-in flow.
|
|
217
|
-
*/
|
|
218
|
-
depositorSecretHash?: Hex;
|
|
219
213
|
/**
|
|
220
214
|
* Zero-based index of the HTLC output in the Pre-PegIn transaction that
|
|
221
215
|
* this PegIn spends. In a batch Pre-PegIn with N HTLC outputs, each vault
|
|
@@ -247,6 +241,59 @@ export interface RegisterPeginResult {
|
|
|
247
241
|
*/
|
|
248
242
|
btcPopSignature: Hex;
|
|
249
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Single request in a batch pegin registration.
|
|
246
|
+
* All requests in a batch share the same vault provider and depositor.
|
|
247
|
+
*/
|
|
248
|
+
export interface BatchPeginRequestItem {
|
|
249
|
+
/** Depositor's BTC public key (x-only, 64-char hex or with 0x prefix) */
|
|
250
|
+
depositorBtcPubkey: string;
|
|
251
|
+
/** Unsigned Pre-PegIn tx hex (same for all vaults in batch) */
|
|
252
|
+
unsignedPrePeginTx: string;
|
|
253
|
+
/** Signed PegIn tx hex for this vault */
|
|
254
|
+
depositorSignedPeginTx: string;
|
|
255
|
+
/** SHA256 hashlock for HTLC activation (bytes32 hex) */
|
|
256
|
+
hashlock: Hex;
|
|
257
|
+
/** Zero-based HTLC output index in the Pre-PegIn tx */
|
|
258
|
+
htlcVout: number;
|
|
259
|
+
/** Depositor's BTC payout address (required — funds are sent here on payout) */
|
|
260
|
+
depositorPayoutBtcAddress: string;
|
|
261
|
+
/** Keccak256 hash of the depositor's WOTS public key (bytes32) */
|
|
262
|
+
depositorWotsPkHash: Hex;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Parameters for registerPeginBatchOnChain.
|
|
266
|
+
*/
|
|
267
|
+
export interface RegisterPeginBatchParams {
|
|
268
|
+
/** Vault provider address (shared across all vaults in batch) */
|
|
269
|
+
vaultProvider: Address;
|
|
270
|
+
/** Individual pegin requests (one per vault) */
|
|
271
|
+
requests: BatchPeginRequestItem[];
|
|
272
|
+
/** Pre-signed BTC PoP signature (signed once, reused for all vaults) */
|
|
273
|
+
preSignedBtcPopSignature?: Hex;
|
|
274
|
+
/** Called after PoP is signed (before ETH tx) */
|
|
275
|
+
onPopSigned?: () => void | Promise<void>;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Per-vault result from a batch pegin registration.
|
|
279
|
+
*/
|
|
280
|
+
export interface BatchPeginResultItem {
|
|
281
|
+
/** Derived vault ID: keccak256(abi.encode(peginTxHash, depositor)) */
|
|
282
|
+
vaultId: Hex;
|
|
283
|
+
/** Raw BTC pegin transaction hash */
|
|
284
|
+
peginTxHash: Hex;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Result of registering a batch of pegins on Ethereum in a single transaction.
|
|
288
|
+
*/
|
|
289
|
+
export interface RegisterPeginBatchResult {
|
|
290
|
+
/** Ethereum transaction hash */
|
|
291
|
+
ethTxHash: Hex;
|
|
292
|
+
/** Per-vault results (same order as input requests) */
|
|
293
|
+
vaults: BatchPeginResultItem[];
|
|
294
|
+
/** The BTC PoP signature used (for reference) */
|
|
295
|
+
btcPopSignature: Hex;
|
|
296
|
+
}
|
|
250
297
|
export declare class PeginManager {
|
|
251
298
|
private readonly config;
|
|
252
299
|
/**
|
|
@@ -318,6 +365,17 @@ export declare class PeginManager {
|
|
|
318
365
|
* @throws Error if contract simulation fails (e.g., invalid signature, unauthorized)
|
|
319
366
|
*/
|
|
320
367
|
registerPeginOnChain(params: RegisterPeginParams): Promise<RegisterPeginResult>;
|
|
368
|
+
/**
|
|
369
|
+
* Register multiple pegins on Ethereum in a single transaction.
|
|
370
|
+
*
|
|
371
|
+
* Uses the contract's submitPeginRequestBatch() to submit all vault
|
|
372
|
+
* registrations atomically. All vaults must share the same vault provider.
|
|
373
|
+
* The PoP signature is signed once and included in each request.
|
|
374
|
+
*
|
|
375
|
+
* @param params - Batch registration parameters
|
|
376
|
+
* @returns Batch result with per-vault IDs and single ETH tx hash
|
|
377
|
+
*/
|
|
378
|
+
registerPeginBatchOnChain(params: RegisterPeginBatchParams): Promise<RegisterPeginBatchResult>;
|
|
321
379
|
/**
|
|
322
380
|
* Check if a vault already exists for a given vault ID.
|
|
323
381
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAmB,MAAM,yBAAyB,CAAC;AAIpF,OAAO,EAQL,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"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"}
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
* @module managers
|
|
68
68
|
*/
|
|
69
69
|
export { PeginManager } from './PeginManager';
|
|
70
|
-
export type { PreparePeginResult, PreparePeginParams, PeginManagerConfig, RegisterPeginParams, RegisterPeginResult, SignAndBroadcastParams, } from './PeginManager';
|
|
70
|
+
export type { PreparePeginResult, PreparePeginParams, PeginManagerConfig, RegisterPeginParams, RegisterPeginResult, SignAndBroadcastParams, BatchPeginRequestItem, RegisterPeginBatchParams, BatchPeginResultItem, RegisterPeginBatchResult, } from './PeginManager';
|
|
71
71
|
export { PayoutManager } from './PayoutManager';
|
|
72
72
|
export type { PayoutManagerConfig, PayoutSignatureResult, SignPayoutParams, } from './PayoutManager';
|
|
73
73
|
export type { UTXO } from '../utils/utxo/selectUtxos';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACtD,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,kDAAkD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../challengeAssert-D7SqsNpQ.cjs"),t=require("@babylonlabs-io/babylon-tbv-rust-wasm");exports.buildChallengeAssertPsbt=e.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=e.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=e.buildNoPayoutPsbt;exports.buildPayoutPsbt=e.buildPayoutPsbt;exports.buildPeginInputPsbt=e.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=e.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=e.buildPrePeginPsbt;exports.buildRefundPsbt=e.buildRefundPsbt;exports.computeNumLocalChallengers=e.computeNumLocalChallengers;exports.createPayoutScript=e.createPayoutScript;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.extractPayoutSignature=e.extractPayoutSignature;exports.extractPeginInputSignature=e.extractPeginInputSignature;exports.finalizePeginInputPsbt=e.finalizePeginInputPsbt;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>t.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>t.deriveVaultId});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as s, j as t, k as i, h as r, d as u, a as l, b as P, g as o, c as d, m as n, n as b, o as p, s as x, i as g, e as y, f as c, p as m, q as f, r as v, t as A, u as T, v as h, w as H, x as I } from "../../../challengeAssert-
|
|
1
|
+
import { l as s, j as t, k as i, h as r, d as u, a as l, b as P, g as o, c as d, m as n, n as b, o as p, s as x, i as g, e as y, f as c, p as m, q as f, r as v, t as A, u as T, v as h, w as H, x as I } from "../../../challengeAssert-C5DQSUnp.js";
|
|
2
2
|
import { computeMinClaimValue as C, deriveVaultId as F } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
3
|
export {
|
|
4
4
|
s as buildChallengeAssertPsbt,
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* The value 0xc0 (binary: 11000000) represents:
|
|
6
|
-
* - Bit 0: Parity bit for output key y-coordinate
|
|
7
|
-
* - Bits 1-7: Leaf version (0xc0 >> 1 = 0x60)
|
|
8
|
-
*
|
|
9
|
-
* This is the standard leaf version for Tapscript execution.
|
|
10
|
-
*
|
|
11
|
-
* @see https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki
|
|
12
|
-
* @see Rust: bitcoin::taproot::LeafVersion::TapScript
|
|
13
|
-
*/
|
|
14
|
-
export declare const TAPSCRIPT_LEAF_VERSION = 192;
|
|
2
|
+
import { TAPSCRIPT_LEAF_VERSION } from '../../utils/bitcoin';
|
|
3
|
+
export { TAPSCRIPT_LEAF_VERSION };
|
|
15
4
|
/**
|
|
16
5
|
* Maximum sequence value (no relative timelock).
|
|
17
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/psbt/__tests__/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/psbt/__tests__/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAElC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,SAAS,CAAC;AAIlC;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,qBAAsB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,YAAY,qBAAsB,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,YAAY,qBAAsB,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,YAAY,qBAAyB,CAAC;AAInD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,UAAW,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,SAAU,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,UAAW,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,SAAU,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAIxC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,GAAE,MAAY,GAAG,MAAM,CAMhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAQxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"challengeAssert.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/challengeAssert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,8BAA8B,EAGpC,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"challengeAssert.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/challengeAssert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,8BAA8B,EAGpC,MAAM,uCAAuC,CAAC;AAU/C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qFAAqF;IACrF,QAAQ,EAAE,KAAK,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,wFAAwF;IACxF,uBAAuB,EAAE,8BAA8B,EAAE,CAAC;CAC3D;AAED;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC,CA4DjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"depositorPayout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/depositorPayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"depositorPayout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/depositorPayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,uCAAuC,CAAC;AAU/C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,QAAQ,EAAE,KAAK,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,mFAAmF;IACnF,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC,CA0DjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noPayout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/noPayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,KAAK,mCAAmC,EAGzC,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"noPayout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/noPayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,KAAK,mCAAmC,EAGzC,MAAM,uCAAuC,CAAC;AAU/C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,gBAAgB,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,EAAE,KAAK,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,0DAA0D;IAC1D,eAAe,EAAE,mCAAmC,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC,CA6DjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/payout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,KAAK,OAAO,EAEb,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/payout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,KAAK,OAAO,EAEb,MAAM,uCAAuC,CAAC;AAW/C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAEhC;;OAEG;IACH,6BAA6B,EAAE,MAAM,EAAE,CAAC;IAExC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAqI3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,EACvB,UAAU,SAAI,GACb,MAAM,CAsCR"}
|
|
@@ -80,6 +80,13 @@ export interface PayoutScriptResult {
|
|
|
80
80
|
* that can be used to receive funds into the vault.
|
|
81
81
|
*/
|
|
82
82
|
address: string;
|
|
83
|
+
/**
|
|
84
|
+
* Serialized control block for Taproot script path spend (hex encoded).
|
|
85
|
+
*
|
|
86
|
+
* Computed by the Rust WASM PeginPayoutConnector. Used directly in
|
|
87
|
+
* tapLeafScript when building payout PSBTs.
|
|
88
|
+
*/
|
|
89
|
+
payoutControlBlock: string;
|
|
83
90
|
}
|
|
84
91
|
/**
|
|
85
92
|
* Create payout script and taproot information using WASM.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/scripts/payout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,KAAK,OAAO,EACb,MAAM,uCAAuC,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAE/B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/scripts/payout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,KAAK,OAAO,EACb,MAAM,uCAAuC,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAE/B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAoB7B"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { networks } from 'bitcoinjs-lib';
|
|
2
2
|
import { Network } from '@babylonlabs-io/babylon-tbv-rust-wasm';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
|
+
/**
|
|
5
|
+
* BIP-341 Tapscript leaf version for script-path spends.
|
|
6
|
+
* @see https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki
|
|
7
|
+
* @see Rust: bitcoin::taproot::LeafVersion::TapScript
|
|
8
|
+
*/
|
|
9
|
+
export declare const TAPSCRIPT_LEAF_VERSION = 192;
|
|
4
10
|
/**
|
|
5
11
|
* Strip "0x" prefix from hex string if present.
|
|
6
12
|
*
|
|
@@ -100,6 +106,17 @@ export interface WalletPubkeyValidationResult {
|
|
|
100
106
|
* @throws If wallet pubkey doesn't match expected depositor pubkey
|
|
101
107
|
*/
|
|
102
108
|
export declare function validateWalletPubkey(walletPubkeyRaw: string, expectedDepositorPubkey?: string): WalletPubkeyValidationResult;
|
|
109
|
+
/**
|
|
110
|
+
* Lazily initialize the ECC library for bitcoinjs-lib.
|
|
111
|
+
*
|
|
112
|
+
* Must be called before any P2TR / Taproot address operation.
|
|
113
|
+
* Safe to call multiple times — only runs verification once.
|
|
114
|
+
*
|
|
115
|
+
* Why lazy: module-level `initEccLib(ecc)` breaks vitest because
|
|
116
|
+
* `vi.mock()` hoists above imports, so the mocked bitcoinjs-lib
|
|
117
|
+
* hasn't loaded the real ECC backend when the module evaluates.
|
|
118
|
+
*/
|
|
119
|
+
export declare function ensureEcc(): void;
|
|
103
120
|
/**
|
|
104
121
|
* Map SDK network type to bitcoinjs-lib Network object.
|
|
105
122
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/utils/bitcoin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAc,QAAQ,EAAY,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAUvD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAEtD;AAaD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAuBpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG/C;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,yEAAyE;IACzE,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,4BAA4B,CAa9B;
|
|
1
|
+
{"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/utils/bitcoin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAc,QAAQ,EAAY,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,MAAO,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAUvD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAEtD;AAaD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAuBpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG/C;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,yEAAyE;IACzE,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,4BAA4B,CAa9B;AAQD;;;;;;;;;GASG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAKhC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAY7D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,GACf,MAAM,CAWR;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,GACf,MAAM,CAiBR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAgCT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSplitTransaction.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/transaction/createSplitTransaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"createSplitTransaction.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/transaction/createSplitTransaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,OAAO,EAAE,KAAK,CAAC;QACb,oCAAoC;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,mBAAmB;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,yBAAyB;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,wBAAwB;QACxB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,IAAI,EAAE,EACd,OAAO,EAAE,WAAW,EAAE,EACtB,OAAO,EAAE,OAAO,GACf,sBAAsB,CAgFxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,IAAI,EAAE,EACd,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAyFR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fundPeginTransaction.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/transaction/fundPeginTransaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"fundPeginTransaction.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/transaction/fundPeginTransaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,WAAW,0BAA0B;IACzC,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,aAAa,EAAE,IAAI,EAAE,CAAC;IACtB,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;CAC1B;AAED,gEAAgE;AAChE,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oDAAoD;AACpD,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,MAAM,GACpB,gBAAgB,CAmDlB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,GACjC,MAAM,CAkCR;AAGD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/tbv/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../challengeAssert-D7SqsNpQ.cjs"),r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),t=require("../errors-BZc3Urez.cjs");exports.BTC_DUST_SAT=e.BTC_DUST_SAT;exports.DUST_THRESHOLD=e.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=e.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=e.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=e.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=e.P2TR_INPUT_SIZE;exports.PEGIN_FIXED_OUTPUTS=e.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=e.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=e.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=e.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.buildChallengeAssertPsbt=e.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=e.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=e.buildNoPayoutPsbt;exports.buildPayoutPsbt=e.buildPayoutPsbt;exports.buildPeginInputPsbt=e.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=e.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=e.buildPrePeginPsbt;exports.buildRefundPsbt=e.buildRefundPsbt;exports.computeNumLocalChallengers=e.computeNumLocalChallengers;exports.createPayoutScript=e.createPayoutScript;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.extractPayoutSignature=e.extractPayoutSignature;exports.extractPeginInputSignature=e.extractPeginInputSignature;exports.finalizePeginInputPsbt=e.finalizePeginInputPsbt;exports.fundPeginTransaction=e.fundPeginTransaction;exports.getNetwork=e.getNetwork;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.parseUnfundedWasmTransaction=e.parseUnfundedWasmTransaction;exports.peginOutputCount=e.peginOutputCount;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.rateBasedTxBufferFee=e.rateBasedTxBufferFee;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>r.deriveVaultId});exports.BTCVaultRegistryABI=t.BTCVaultRegistryABI;exports.BitcoinScriptType=t.BitcoinScriptType;exports.CONTRACT_ERRORS=t.CONTRACT_ERRORS;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.PayoutManager=t.PayoutManager;exports.PeginManager=t.PeginManager;exports.calculateBtcTxHash=t.calculateBtcTxHash;exports.computeWotsPkHash=t.computeWotsPkHash;exports.createSplitTransaction=t.createSplitTransaction;exports.createSplitTransactionPsbt=t.createSplitTransactionPsbt;exports.createTaprootScriptPathSignOptions=t.createTaprootScriptPathSignOptions;exports.deriveWotsKeypair=t.deriveWotsKeypair;exports.deriveWotsPkHash=t.deriveWotsPkHash;exports.extractErrorData=t.extractErrorData;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getContractErrorMessage=t.getContractErrorMessage;exports.getDustThreshold=t.getDustThreshold;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getPsbtInputFields=t.getPsbtInputFields;exports.getScriptType=t.getScriptType;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.handleContractError=t.handleContractError;exports.isKnownContractError=t.isKnownContractError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.keypairToPublicKey=t.keypairToPublicKey;exports.mnemonicToWotsSeed=t.mnemonicToWotsSeed;exports.pushTx=t.pushTx;exports.selectUtxosForPegin=t.selectUtxosForPegin;exports.shouldAddChangeOutput=t.shouldAddChangeOutput;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as e, D as t, F as r, L as i, M as o, P as n, z as u, S as T, T as P, W as d, l, j as c, k as g, h as p, d as E, a as _, b as A, g as S, c as x, m as b, n as y, o as I, s as R, i as C, e as F, f as U, E as m, G as O, p as h, q as f, r as L, C as M, A as H, t as N, y as B, u as D, v as W, w as v, x as k } from "../challengeAssert-
|
|
1
|
+
import { B as e, D as t, F as r, L as i, M as o, P as n, z as u, S as T, T as P, W as d, l, j as c, k as g, h as p, d as E, a as _, b as A, g as S, c as x, m as b, n as y, o as I, s as R, i as C, e as F, f as U, E as m, G as O, p as h, q as f, r as L, C as M, A as H, t as N, y as B, u as D, v as W, w as v, x as k } from "../challengeAssert-C5DQSUnp.js";
|
|
2
2
|
import { computeMinClaimValue as X, deriveVaultId as K } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { r as Y, B as G, C as z, M as Z, i as j, P as q, c as J, A as Q, b as $, d as aa, h as sa, y as ea, D as ta, t as ra, j as ia, k as oa, u as na, g as ua, l as Ta, m as Pa, f as da, e as la, n as ca, o as ga, p as pa, w as Ea, v as _a, E as Aa, z as Sa, x as xa, q as ba, s as ya, a as Ia } from "../errors-
|
|
3
|
+
import { r as Y, B as G, C as z, M as Z, i as j, P as q, c as J, A as Q, b as $, d as aa, h as sa, y as ea, D as ta, t as ra, j as ia, k as oa, u as na, g as ua, l as Ta, m as Pa, f as da, e as la, n as ca, o as ga, p as pa, w as Ea, v as _a, E as Aa, z as Sa, x as xa, q as ba, s as ya, a as Ia } from "../errors-UqmtfBtv.js";
|
|
4
4
|
export {
|
|
5
5
|
Y as BTCVaultRegistryABI,
|
|
6
6
|
e as BTC_DUST_SAT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonlabs-io/ts-sdk",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"license": "ISC",
|
|
68
68
|
"description": "TypeScript SDK for Babylon protocol integrations",
|
|
69
69
|
"dependencies": {
|
|
70
|
+
"@babylonlabs-io/babylon-tbv-rust-wasm": "0.7.1",
|
|
70
71
|
"@bitcoin-js/tiny-secp256k1-asmjs": "2.2.3",
|
|
71
72
|
"@noble/hashes": "2.0.1",
|
|
72
73
|
"@scure/bip39": "2.0.1",
|
|
73
74
|
"bitcoinjs-lib": "6.1.7",
|
|
74
|
-
"buffer": "6.0.3"
|
|
75
|
-
"@babylonlabs-io/babylon-tbv-rust-wasm": "0.1.0"
|
|
75
|
+
"buffer": "6.0.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"viem": "^2.38.2"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const g=require("@babylonlabs-io/babylon-tbv-rust-wasm"),l=require("bitcoinjs-lib"),a=require("buffer"),D=require("@bitcoin-js/tiny-secp256k1-asmjs");function $(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const C=$(l),I=$(D);function y(t){return t.startsWith("0x")?t.slice(2):t}function M(t){return t.startsWith("0x")?t:`0x${t}`}function h(t){const e=y(t);if(!B(e))throw new Error(`Invalid hex string: ${t}`);const n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.slice(r,r+2),16);return n}function k(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function O(t){return t.length===32?t:t.slice(1,33)}function B(t){return/^[0-9a-fA-F]*$/.test(t)&&t.length%2===0}function m(t){const e=y(t);if(!B(e))throw new Error(`Invalid hex characters in public key: ${t}`);if(e.length===64)return e;if(e.length!==66&&e.length!==130)throw new Error(`Invalid public key length: ${e.length} (expected 64, 66, or 130 hex chars)`);const n=h(e);return k(O(n))}function X(t){const e=y(t);return B(e)}function Y(t,e){const n=m(t),r=e??n;if(n.toLowerCase()!==r.toLowerCase())throw new Error(`Wallet public key does not match vault depositor. Expected: ${r}, Got: ${n}. Please connect the wallet that was used to create this vault.`);return{walletPubkeyRaw:t,walletPubkeyXOnly:n,depositorPubkey:r}}let L=!1;function G(){L||(l.initEccLib(I),L=!0)}function H(t){switch(t){case"bitcoin":return l.networks.bitcoin;case"testnet":case"signet":return l.networks.testnet;case"regtest":return l.networks.regtest;default:throw new Error(`Unknown network: ${t}`)}}function R(t,e){G();const n=h(m(t)),{address:r}=l.payments.p2tr({internalPubkey:a.Buffer.from(n),network:H(e)});if(!r)throw new Error("Failed to derive taproot address from public key");return r}function F(t,e){const n=y(t);if(n.length!==66)throw new Error(`Native SegWit requires a compressed public key (66 hex chars), got ${n.length}`);const{address:r}=l.payments.p2wpkh({pubkey:a.Buffer.from(h(n)),network:H(e)});if(!r)throw new Error("Failed to derive native segwit address from public key");return r}function Z(t,e,n){const r=y(e);try{if(t===R(r,n))return!0}catch{}const o=[];r.length===66?o.push(r):r.length===64&&o.push(`02${r}`,`03${r}`);for(const s of o)try{if(t===F(s,n))return!0}catch{}return!1}function E(t){return m(t).toLowerCase()}function j(t,e,n){const r=new Set;r.add(E(t));for(const o of e)r.add(E(o));return r.delete(E(n)),r.size}const Q=58,J=43,tt=11,V=546,N=BigInt(V),W=30,K=2,et=1.1;function nt(t){return t<=K?W:0}const q=1;function rt(t){return t+q}const ot=5;function A(t){const n=t.substring(8,12)==="0001"?12:8,r=parseInt(t.substring(n,n+2),16),o=parseInt(t.substring(n+2,n+4),16);if(r!==0)throw new Error(`Expected 0 inputs from WASM, got ${r}`);if(o===0)throw new Error("Expected at least 1 output from WASM, got 0");const s=a.Buffer.from(t.substring(0,8),"hex").readUInt32LE(0),c=a.Buffer.from(t.substring(t.length-8),"hex").readUInt32LE(0),i=[];let u=n+4;for(let p=0;p<o;p++){const f=t.substring(u,u+16),d=Number(a.Buffer.from(f,"hex").readBigUInt64LE(0));u+=16;const P=parseInt(t.substring(u,u+2),16);u+=2;const x=t.substring(u,u+P*2),b=a.Buffer.from(x,"hex");u+=P*2,i.push({value:d,script:b})}return{version:s,locktime:c,outputs:i}}function st(t){const{unfundedTxHex:e,selectedUTXOs:n,changeAddress:r,changeAmount:o,network:s}=t,{version:c,locktime:i,outputs:u}=A(e),p=new C.Transaction;p.version=c,p.locktime=i;for(const f of n){const d=a.Buffer.from(f.txid,"hex").reverse();p.addInput(d,f.vout)}for(const f of u)p.addOutput(f.script,f.value);if(o>N){const f=C.address.toOutputScript(r,s);p.addOutput(f,Number(o))}return p.toHex()}async function it(t){const e=await g.createPrePeginTransaction({depositorPubkey:t.depositorPubkey,vaultProviderPubkey:t.vaultProviderPubkey,vaultKeeperPubkeys:t.vaultKeeperPubkeys,universalChallengerPubkeys:t.universalChallengerPubkeys,hashlocks:[...t.hashlocks],timelockRefund:t.timelockRefund,pegInAmounts:[...t.pegInAmounts],feeRate:t.feeRate,numLocalChallengers:t.numLocalChallengers,councilQuorum:t.councilQuorum,councilSize:t.councilSize,network:t.network}),r=A(e.txHex).outputs.reduce((o,s)=>o+BigInt(s.value),0n);return{psbtHex:e.txHex,totalOutputValue:r,htlcValues:e.htlcValues,htlcScriptPubKeys:e.htlcScriptPubKeys,htlcAddresses:e.htlcAddresses,peginAmounts:e.peginAmounts,depositorClaimValue:e.depositorClaimValue}}async function ut(t){const e=await g.buildPeginTxFromPrePegin({depositorPubkey:t.prePeginParams.depositorPubkey,vaultProviderPubkey:t.prePeginParams.vaultProviderPubkey,vaultKeeperPubkeys:t.prePeginParams.vaultKeeperPubkeys,universalChallengerPubkeys:t.prePeginParams.universalChallengerPubkeys,hashlocks:[...t.prePeginParams.hashlocks],timelockRefund:t.prePeginParams.timelockRefund,pegInAmounts:[...t.prePeginParams.pegInAmounts],feeRate:t.prePeginParams.feeRate,numLocalChallengers:t.prePeginParams.numLocalChallengers,councilQuorum:t.prePeginParams.councilQuorum,councilSize:t.prePeginParams.councilSize,network:t.prePeginParams.network},t.timelockPegin,t.fundedPrePeginTxHex,t.htlcVout);return{txHex:e.txHex,txid:e.txid,vaultScriptPubKey:e.vaultScriptPubKey,vaultValue:e.vaultValue}}async function ct(t){const e=y(t.peginTxHex),n=y(t.fundedPrePeginTxHex),r=await g.getPrePeginHtlcConnectorInfo({depositorPubkey:t.depositorPubkey,vaultProviderPubkey:t.vaultProviderPubkey,vaultKeeperPubkeys:t.vaultKeeperPubkeys,universalChallengerPubkeys:t.universalChallengerPubkeys,hashlock:t.hashlock,timelockRefund:t.timelockRefund,network:t.network}),o=l.Transaction.fromHex(e),s=l.Transaction.fromHex(n);if(o.ins.length!==1)throw new Error(`PegIn transaction must have exactly 1 input, got ${o.ins.length}`);const c=o.ins[0],i=s.getId(),u=k(new Uint8Array(c.hash).slice().reverse());if(u!==i)throw new Error(`PegIn input does not reference the Pre-PegIn transaction. Expected ${i}, got ${u}`);const p=s.outs[c.index];if(!p)throw new Error(`Pre-PegIn output ${c.index} not found (Pre-PegIn has ${s.outs.length} outputs)`);const f=h(r.hashlockScript),d=h(r.hashlockControlBlock),P=new l.Psbt;P.setVersion(o.version),P.setLocktime(o.locktime),P.addInput({hash:c.hash,index:c.index,sequence:c.sequence,witnessUtxo:{script:p.script,value:p.value},tapLeafScript:[{leafVersion:192,script:a.Buffer.from(f),controlBlock:a.Buffer.from(d)}],tapInternalKey:a.Buffer.from(g.tapInternalPubkey)});for(const x of o.outs)P.addOutput({script:x.script,value:x.value});return{psbtHex:P.toHex()}}function at(t,e){const r=l.Psbt.fromHex(t).data.inputs[0];if(!r)throw new Error("PegIn PSBT has no inputs");if(r.tapScriptSig&&r.tapScriptSig.length>0){const o=a.Buffer.from(h(e));for(const s of r.tapScriptSig)if(s.pubkey.equals(o))return ft(s.signature);throw new Error(`No PegIn input signature found for depositor pubkey: ${e}`)}throw r.finalScriptWitness&&r.finalScriptWitness.length>0?new Error("PegIn input PSBT is already finalized. Cannot reliably extract the depositor signature from the witness stack. Ensure the wallet returns a non-finalized PSBT with tapScriptSig entries."):new Error("No tapScriptSig or finalScriptWitness found in signed PegIn input PSBT")}function lt(t){const e=l.Psbt.fromHex(t);try{e.finalizeAllInputs()}catch(n){if(!e.data.inputs.every(o=>o.finalScriptWitness||o.finalScriptSig))throw new Error(`PSBT finalization failed and wallet did not auto-finalize: ${n}`)}return e.extractTransaction().toHex()}function ft(t){if(t.length===64)return k(new Uint8Array(t));if(t.length===65)return k(new Uint8Array(t.subarray(0,64)));throw new Error(`Unexpected PegIn input signature length: ${t.length}`)}async function pt(t){await g.initWasm();const{prePeginParams:e,fundedPrePeginTxHex:n,htlcVout:r,refundFee:o,hashlock:s}=t,c=new g.WasmPrePeginTx(e.depositorPubkey,e.vaultProviderPubkey,e.vaultKeeperPubkeys,e.universalChallengerPubkeys,[...e.hashlocks],new BigUint64Array(e.pegInAmounts),e.timelockRefund,e.feeRate,e.numLocalChallengers,e.councilQuorum,e.councilSize,e.network);let i=null;try{i=c.fromFundedTransaction(n);const u=i.buildRefundTx(o,r),p=await g.getPrePeginHtlcConnectorInfo({depositorPubkey:e.depositorPubkey,vaultProviderPubkey:e.vaultProviderPubkey,vaultKeeperPubkeys:e.vaultKeeperPubkeys,universalChallengerPubkeys:e.universalChallengerPubkeys,hashlock:s,timelockRefund:e.timelockRefund,network:e.network}),f=n.startsWith("0x")?n.slice(2):n,d=l.Transaction.fromHex(f),P=d.outs[r];if(!P)throw new Error(`HTLC output at vout ${r} not found in funded Pre-PegIn tx (tx has ${d.outs.length} outputs)`);const x=l.Transaction.fromHex(u);if(x.ins.length!==1)throw new Error(`Refund transaction must have exactly 1 input, got ${x.ins.length}`);const b=x.ins[0],v=d.getId(),S=k(new Uint8Array(b.hash).slice().reverse());if(S!==v)throw new Error(`Refund input does not reference the Pre-PegIn transaction. Expected ${v}, got ${S}`);if(b.index!==r)throw new Error(`Refund input index ${b.index} does not match expected htlcVout ${r}`);const w=new l.Psbt;w.setVersion(x.version),w.setLocktime(x.locktime),w.addInput({hash:b.hash,index:b.index,sequence:b.sequence,witnessUtxo:{script:P.script,value:P.value},tapLeafScript:[{leafVersion:192,script:a.Buffer.from(h(p.refundScript)),controlBlock:a.Buffer.from(h(p.refundControlBlock))}],tapInternalKey:a.Buffer.from(g.tapInternalPubkey)});for(const T of x.outs)w.addOutput({script:T.script,value:T.value});return{psbtHex:w.toHex()}}finally{i==null||i.free(),c.free()}}async function z(t){const e=await g.createPayoutConnector({depositor:t.depositor,vaultProvider:t.vaultProvider,vaultKeepers:t.vaultKeepers,universalChallengers:t.universalChallengers,timelockPegin:t.timelockPegin},t.network);return{payoutScript:e.payoutScript,taprootScriptHash:e.taprootScriptHash,scriptPubKey:e.scriptPubKey,address:e.address}}l.initEccLib(I);async function dt(t){const e=y(t.payoutTxHex),n=y(t.peginTxHex),r=y(t.assertTxHex),o=await z({depositor:t.depositorBtcPubkey,vaultProvider:t.vaultProviderBtcPubkey,vaultKeepers:t.vaultKeeperBtcPubkeys,universalChallengers:t.universalChallengerBtcPubkeys,timelockPegin:t.timelockPegin,network:t.network}),s=h(o.payoutScript),c=gt(g.tapInternalPubkey,s),i=l.Transaction.fromHex(e),u=l.Transaction.fromHex(n),p=l.Transaction.fromHex(r),f=new l.Psbt;if(f.setVersion(i.version),f.setLocktime(i.locktime),i.ins.length!==2)throw new Error(`Payout transaction must have exactly 2 inputs, got ${i.ins.length}`);const d=i.ins[0],P=i.ins[1],x=k(new Uint8Array(d.hash).slice().reverse()),b=u.getId();if(x!==b)throw new Error(`Input 0 does not reference pegin transaction. Expected ${b}, got ${x}`);const v=k(new Uint8Array(P.hash).slice().reverse()),S=p.getId();if(v!==S)throw new Error(`Input 1 does not reference assert transaction. Expected ${S}, got ${v}`);const w=u.outs[d.index];if(!w)throw new Error(`Previous output not found for input 0 (txid: ${x}, index: ${d.index})`);const T=p.outs[P.index];if(!T)throw new Error(`Previous output not found for input 1 (txid: ${v}, index: ${P.index})`);f.addInput({hash:d.hash,index:d.index,sequence:d.sequence,witnessUtxo:{script:w.script,value:w.value},tapLeafScript:[{leafVersion:192,script:a.Buffer.from(s),controlBlock:a.Buffer.from(c)}],tapInternalKey:a.Buffer.from(g.tapInternalPubkey)}),f.addInput({hash:P.hash,index:P.index,sequence:P.sequence,witnessUtxo:{script:T.script,value:T.value}});for(const _ of i.outs)f.addOutput({script:_.script,value:_.value});return{psbtHex:f.toHex()}}function Pt(t,e,n=0){const r=l.Psbt.fromHex(t);if(n>=r.data.inputs.length)throw new Error(`Input index ${n} out of range (${r.data.inputs.length} inputs)`);const o=r.data.inputs[n];if(o.tapScriptSig&&o.tapScriptSig.length>0){const s=h(e);for(const c of o.tapScriptSig)if(c.pubkey.equals(a.Buffer.from(s)))return U(c.signature,n);throw new Error(`No signature found for depositor pubkey: ${e} at input ${n}`)}if(o.finalScriptWitness&&o.finalScriptWitness.length>0){const s=ht(o.finalScriptWitness);if(s.length>=1)return U(s[0],n)}throw new Error(`No tapScriptSig or finalScriptWitness found in signed PSBT at input ${n}`)}function U(t,e){if(t.length===64)return k(new Uint8Array(t));if(t.length===65){const n=t[64];if(n!==l.Transaction.SIGHASH_ALL)throw new Error(`Unexpected sighash type 0x${n.toString(16).padStart(2,"0")} at input ${e}. Expected SIGHASH_ALL (0x01).`);return k(new Uint8Array(t.subarray(0,64)))}throw new Error(`Unexpected signature length at input ${e}: ${t.length}`)}function ht(t){const e=[];let n=0;const r=()=>{const s=t[n++];if(s<253)return s;if(s===253){const c=t[n]|t[n+1]<<8;return n+=2,c}if(s===254){const c=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;return n+=4,c}return n+=8,0},o=r();for(let s=0;s<o;s++){const c=r();e.push(t.subarray(n,n+c)),n+=c}return e}function gt(t,e){const n={output:a.Buffer.from(e)},o=l.payments.p2tr({internalPubkey:a.Buffer.from(t),scriptTree:n}).pubkey;if(!o)throw new Error("Failed to compute output key");const s=192,c=o[0]===3?1:0,i=s|c,u=new Uint8Array(1+t.length);return u[0]=i,u.set(t,1),u}l.initEccLib(I);async function yt(t){const e=y(t.payoutTxHex),n=l.Transaction.fromHex(e),r=await g.getPeginPayoutScript(t.connectorParams),o=h(r),s=xt(g.tapInternalPubkey,o),c=new l.Psbt;c.setVersion(n.version),c.setLocktime(n.locktime);for(let i=0;i<n.ins.length;i++){const u=n.ins[i],p=t.prevouts[i];if(!p)throw new Error(`Missing prevout data for input ${i}`);const f={hash:u.hash,index:u.index,sequence:u.sequence,witnessUtxo:{script:a.Buffer.from(h(y(p.script_pubkey))),value:p.value}};i===0&&(f.tapLeafScript=[{leafVersion:192,script:a.Buffer.from(o),controlBlock:a.Buffer.from(s)}],f.tapInternalKey=a.Buffer.from(g.tapInternalPubkey)),c.addInput(f)}for(const i of n.outs)c.addOutput({script:i.script,value:i.value});return c.toHex()}function xt(t,e){const n={output:a.Buffer.from(e)},o=l.payments.p2tr({internalPubkey:a.Buffer.from(t),scriptTree:n}).pubkey;if(!o)throw new Error("Failed to compute output key");const s=192,c=o[0]===3?1:0,i=s|c,u=new Uint8Array(1+t.length);return u[0]=i,u.set(t,1),u}async function bt(t){const e=y(t.noPayoutTxHex),n=l.Transaction.fromHex(e),{noPayoutScript:r,noPayoutControlBlock:o}=await g.getAssertNoPayoutScriptInfo(t.connectorParams,t.challengerPubkey),s=h(r),c=h(o),i=new l.Psbt;i.setVersion(n.version),i.setLocktime(n.locktime);for(let u=0;u<n.ins.length;u++){const p=n.ins[u],f=t.prevouts[u];if(!f)throw new Error(`Missing prevout data for input ${u}`);const d={hash:p.hash,index:p.index,sequence:p.sequence,witnessUtxo:{script:a.Buffer.from(h(y(f.script_pubkey))),value:f.value}};u===0&&(d.tapLeafScript=[{leafVersion:192,script:a.Buffer.from(s),controlBlock:a.Buffer.from(c)}],d.tapInternalKey=a.Buffer.from(g.tapInternalPubkey)),i.addInput(d)}for(const u of n.outs)i.addOutput({script:u.script,value:u.value});return i.toHex()}async function kt(t){const e=y(t.challengeAssertTxHex),n=l.Transaction.fromHex(e);if(t.connectorParamsPerInput.length!==n.ins.length)throw new Error(`Expected ${n.ins.length} connector params, got ${t.connectorParamsPerInput.length}`);const r=await Promise.all(t.connectorParamsPerInput.map(s=>g.getChallengeAssertScriptInfo(s))),o=new l.Psbt;o.setVersion(n.version),o.setLocktime(n.locktime);for(let s=0;s<n.ins.length;s++){const c=n.ins[s],i=t.prevouts[s];if(!i)throw new Error(`Missing prevout data for input ${s}`);const{script:u,controlBlock:p}=r[s],f=h(u),d=h(p);o.addInput({hash:c.hash,index:c.index,sequence:c.sequence,witnessUtxo:{script:a.Buffer.from(h(y(i.script_pubkey))),value:i.value},tapLeafScript:[{leafVersion:192,script:a.Buffer.from(f),controlBlock:a.Buffer.from(d)}],tapInternalKey:a.Buffer.from(g.tapInternalPubkey)})}for(const s of n.outs)o.addOutput({script:s.script,value:s.value});return o.toHex()}exports.BTC_DUST_SAT=V;exports.DUST_THRESHOLD=N;exports.FEE_SAFETY_MARGIN=et;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=W;exports.MAX_NON_LEGACY_OUTPUT_SIZE=J;exports.P2TR_INPUT_SIZE=Q;exports.PEGIN_FIXED_OUTPUTS=q;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=ot;exports.TX_BUFFER_SIZE_OVERHEAD=tt;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=K;exports.buildChallengeAssertPsbt=kt;exports.buildDepositorPayoutPsbt=yt;exports.buildNoPayoutPsbt=bt;exports.buildPayoutPsbt=dt;exports.buildPeginInputPsbt=ct;exports.buildPeginTxFromFundedPrePegin=ut;exports.buildPrePeginPsbt=it;exports.buildRefundPsbt=pt;exports.computeNumLocalChallengers=j;exports.createPayoutScript=z;exports.deriveNativeSegwitAddress=F;exports.deriveTaprootAddress=R;exports.ensureHexPrefix=M;exports.extractPayoutSignature=Pt;exports.extractPeginInputSignature=at;exports.finalizePeginInputPsbt=lt;exports.fundPeginTransaction=st;exports.getNetwork=H;exports.hexToUint8Array=h;exports.isAddressFromPublicKey=Z;exports.isValidHex=X;exports.parseUnfundedWasmTransaction=A;exports.peginOutputCount=rt;exports.processPublicKeyToXOnly=m;exports.rateBasedTxBufferFee=nt;exports.stripHexPrefix=y;exports.toXOnly=O;exports.uint8ArrayToHex=k;exports.validateWalletPubkey=Y;
|
|
2
|
-
//# sourceMappingURL=challengeAssert-BpzES0KW.cjs.map
|