@babylonlabs-io/ts-sdk 0.26.3 → 0.27.1
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/{bitcoin-nOOgeRyl.js → bitcoin-B-Y0DlqR.js} +63 -60
- package/dist/bitcoin-B-Y0DlqR.js.map +1 -0
- package/dist/bitcoin-DIN0OupO.cjs +2 -0
- package/dist/bitcoin-DIN0OupO.cjs.map +1 -0
- package/dist/buildAndBroadcastRefund-BEASMFsz.cjs +2 -0
- package/dist/buildAndBroadcastRefund-BEASMFsz.cjs.map +1 -0
- package/dist/buildAndBroadcastRefund-BzYJv-Fv.js +862 -0
- package/dist/buildAndBroadcastRefund-BzYJv-Fv.js.map +1 -0
- package/dist/challengeAssert-BM8m9gPM.cjs +2 -0
- package/dist/challengeAssert-BM8m9gPM.cjs.map +1 -0
- package/dist/{challengeAssert-CH32j5cZ.js → challengeAssert-j2Vwqo0-.js} +135 -120
- package/dist/challengeAssert-j2Vwqo0-.js.map +1 -0
- package/dist/context-B4fYDTxy.cjs +2 -0
- package/dist/context-B4fYDTxy.cjs.map +1 -0
- package/dist/{errors-kc6XZy1U.js → context-ktqanzXE.js} +442 -324
- package/dist/context-ktqanzXE.js.map +1 -0
- package/dist/fundPeginTransaction-DaWoYCgO.cjs +2 -0
- package/dist/fundPeginTransaction-DaWoYCgO.cjs.map +1 -0
- package/dist/fundPeginTransaction-oV-dNJOU.js +76 -0
- package/dist/fundPeginTransaction-oV-dNJOU.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +100 -91
- package/dist/{payout-DzGsAnhf.js → payout-B_fvQU3q.js} +2 -2
- package/dist/{payout-DzGsAnhf.js.map → payout-B_fvQU3q.js.map} +1 -1
- package/dist/{payout-RFIh7GLN.cjs → payout-DP6KMFP1.cjs} +2 -2
- package/dist/{payout-RFIh7GLN.cjs.map → payout-DP6KMFP1.cjs.map} +1 -1
- package/dist/psbtInputFields-CB8hqjQ5.cjs +2 -0
- package/dist/psbtInputFields-CB8hqjQ5.cjs.map +1 -0
- package/dist/{psbtInputFields-B_cRzwBi.js → psbtInputFields-DeTFSJOq.js} +71 -65
- package/dist/psbtInputFields-DeTFSJOq.js.map +1 -0
- package/dist/sha2-1XZuToHP.cjs +2 -0
- package/dist/sha2-1XZuToHP.cjs.map +1 -0
- package/dist/sha2-ZzfZqQSw.js +1123 -0
- package/dist/sha2-ZzfZqQSw.js.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +27 -24
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts +17 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/cbor.test.d.ts +15 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/cbor.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/goldenVectors.d.ts +44 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/goldenVectors.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/serverIdentity.test.d.ts +2 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/serverIdentity.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenProvider.test.d.ts +2 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenProvider.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts +56 -0
- package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/cbor.d.ts +44 -0
- package/dist/tbv/core/clients/vault-provider/auth/cbor.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +10 -0
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts +68 -0
- package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +81 -0
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/index.d.ts +2 -1
- package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +66 -1
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.d.ts +3 -0
- package/dist/tbv/core/index.d.ts.map +1 -1
- package/dist/tbv/core/index.js +96 -87
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +3 -3
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +17 -2
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts +19 -0
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +1 -1
- package/dist/tbv/core/utils/fee/__tests__/constants.test.d.ts +2 -0
- package/dist/tbv/core/utils/fee/__tests__/constants.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/fee/constants.d.ts +30 -9
- package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -1
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +28 -27
- package/dist/tbv/core/utils/utxo/reservation.d.ts +5 -0
- package/dist/tbv/core/utils/utxo/reservation.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/__tests__/context.golden.test.d.ts +34 -0
- package/dist/tbv/core/vault-secrets/__tests__/context.golden.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/__tests__/context.test.d.ts +6 -0
- package/dist/tbv/core/vault-secrets/__tests__/context.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts +10 -0
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/__tests__/info.test.d.ts +8 -0
- package/dist/tbv/core/vault-secrets/__tests__/info.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/context.d.ts +52 -0
- package/dist/tbv/core/vault-secrets/context.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/expand.d.ts +43 -0
- package/dist/tbv/core/vault-secrets/expand.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/index.d.ts +16 -0
- package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/info.d.ts +55 -0
- package/dist/tbv/core/vault-secrets/info.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +96 -87
- package/dist/vault-registry-reader-BizmBSBV.cjs +2 -0
- package/dist/vault-registry-reader-BizmBSBV.cjs.map +1 -0
- package/dist/{index-D7s2ilf8.js → vault-registry-reader-CpCOte7w.js} +522 -268
- package/dist/vault-registry-reader-CpCOte7w.js.map +1 -0
- package/package.json +6 -1
- package/dist/bitcoin-CNnPFU6Y.cjs +0 -2
- package/dist/bitcoin-CNnPFU6Y.cjs.map +0 -1
- package/dist/bitcoin-nOOgeRyl.js.map +0 -1
- package/dist/buildAndBroadcastRefund-Ccp-2GWW.js +0 -1334
- package/dist/buildAndBroadcastRefund-Ccp-2GWW.js.map +0 -1
- package/dist/buildAndBroadcastRefund-Mr3ck5ek.cjs +0 -2
- package/dist/buildAndBroadcastRefund-Mr3ck5ek.cjs.map +0 -1
- package/dist/challengeAssert-CH32j5cZ.js.map +0 -1
- package/dist/challengeAssert-X7V3Ik_Q.cjs +0 -2
- package/dist/challengeAssert-X7V3Ik_Q.cjs.map +0 -1
- package/dist/errors-DJkMz2Gt.cjs +0 -2
- package/dist/errors-DJkMz2Gt.cjs.map +0 -1
- package/dist/errors-kc6XZy1U.js.map +0 -1
- package/dist/fundPeginTransaction-BLYXxLBv.js +0 -70
- package/dist/fundPeginTransaction-BLYXxLBv.js.map +0 -1
- package/dist/fundPeginTransaction-DxNOeyNI.cjs +0 -2
- package/dist/fundPeginTransaction-DxNOeyNI.cjs.map +0 -1
- package/dist/index-CIuXb72l.cjs +0 -2
- package/dist/index-CIuXb72l.cjs.map +0 -1
- package/dist/index-D7s2ilf8.js.map +0 -1
- package/dist/psbtInputFields-B_cRzwBi.js.map +0 -1
- package/dist/psbtInputFields-DFwuqxdh.cjs +0 -2
- package/dist/psbtInputFields-DFwuqxdh.cjs.map +0 -1
- package/dist/types-WrGfwlJd.js +0 -608
- package/dist/types-WrGfwlJd.js.map +0 -1
- package/dist/types-xU3SBcpH.cjs +0 -2
- package/dist/types-xU3SBcpH.cjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../challengeAssert-BM8m9gPM.cjs"),r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),i=require("../../../payout-DP6KMFP1.cjs"),e=require("../../../bitcoin-DIN0OupO.cjs");exports.buildChallengeAssertPsbt=t.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=t.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=t.buildNoPayoutPsbt;exports.buildPeginInputPsbt=t.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=t.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=t.buildPrePeginPsbt;exports.computeNumLocalChallengers=t.computeNumLocalChallengers;exports.extractPeginInputSignature=t.extractPeginInputSignature;exports.finalizePeginInputPsbt=t.finalizePeginInputPsbt;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>r.deriveVaultId});exports.buildPayoutPsbt=i.buildPayoutPsbt;exports.buildRefundPsbt=i.buildRefundPsbt;exports.createPayoutScript=i.createPayoutScript;exports.extractPayoutSignature=i.extractPayoutSignature;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.formatSatoshisToBtc=e.formatSatoshisToBtc;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;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as s, g as t, h as i, d as r, a as o, b as u, c as P, e as d, f as l } from "../../../challengeAssert-
|
|
1
|
+
import { i as s, g as t, h as i, d as r, a as o, b as u, c as P, e as d, f as l } from "../../../challengeAssert-j2Vwqo0-.js";
|
|
2
2
|
import { computeMinClaimValue as n, deriveVaultId as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { a as c, b as g, c as y, e as f } from "../../../payout-
|
|
4
|
-
import { d as h, a as v, e as A, f as T, h as S, i as H, b as I, p as C, s as F, t as N, u as V, v as K } from "../../../bitcoin-
|
|
3
|
+
import { a as c, b as g, c as y, e as f } from "../../../payout-B_fvQU3q.js";
|
|
4
|
+
import { d as h, a as v, e as A, f as T, h as S, i as H, b as I, p as C, s as F, t as N, u as V, v as K } from "../../../bitcoin-B-Y0DlqR.js";
|
|
5
5
|
export {
|
|
6
6
|
s as buildChallengeAssertPsbt,
|
|
7
7
|
t as buildDepositorPayoutPsbt,
|
|
@@ -27,13 +27,22 @@ export interface PrePeginParams {
|
|
|
27
27
|
councilSize: number;
|
|
28
28
|
/** Bitcoin network */
|
|
29
29
|
network: Network;
|
|
30
|
+
/**
|
|
31
|
+
* Optional 32-byte `SHA256(auth_anchor)` commitment (64-char hex, no
|
|
32
|
+
* `0x` prefix). If provided, the Pre-PegIn tx will include an
|
|
33
|
+
* `OP_RETURN <PUSH32 authAnchorHash>` output at vout =
|
|
34
|
+
* `hashlocks.length`, binding the depositor's bearer-token
|
|
35
|
+
* `auth_anchor` preimage to this Pre-PegIn.
|
|
36
|
+
*/
|
|
37
|
+
authAnchorHash?: string;
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* Result of building an unfunded Pre-PegIn transaction
|
|
33
41
|
*/
|
|
34
42
|
export interface PrePeginPsbtResult {
|
|
35
43
|
/**
|
|
36
|
-
* Unfunded transaction hex (no inputs, HTLC
|
|
44
|
+
* Unfunded transaction hex (no inputs, HTLC outputs + optional
|
|
45
|
+
* auth-anchor OP_RETURN + CPFP anchor).
|
|
37
46
|
*
|
|
38
47
|
* The caller is responsible for:
|
|
39
48
|
* - Selecting UTXOs covering totalOutputValue + network fees
|
|
@@ -41,7 +50,7 @@ export interface PrePeginPsbtResult {
|
|
|
41
50
|
* - Calling buildPeginTxFromFundedPrePegin() with the funded tx hex
|
|
42
51
|
*/
|
|
43
52
|
psbtHex: string;
|
|
44
|
-
/** Sum of all unfunded outputs
|
|
53
|
+
/** Sum of all unfunded outputs — use this for UTXO selection */
|
|
45
54
|
totalOutputValue: bigint;
|
|
46
55
|
/** HTLC output values in satoshis, one per deposit (each includes peginAmount + depositorClaimValue + minPeginFee) */
|
|
47
56
|
htlcValues: readonly bigint[];
|
|
@@ -53,6 +62,12 @@ export interface PrePeginPsbtResult {
|
|
|
53
62
|
peginAmounts: readonly bigint[];
|
|
54
63
|
/** Depositor claim value computed by WASM from contract parameters */
|
|
55
64
|
depositorClaimValue: bigint;
|
|
65
|
+
/**
|
|
66
|
+
* Vout index of the auth-anchor `OP_RETURN` output if one was
|
|
67
|
+
* included (i.e. `authAnchorHash` was provided), or `null` if not.
|
|
68
|
+
* Always equals `htlcValues.length` when present.
|
|
69
|
+
*/
|
|
70
|
+
authAnchorVout: number | null;
|
|
56
71
|
}
|
|
57
72
|
/**
|
|
58
73
|
* Parameters for building the PegIn transaction from a funded Pre-PegIn tx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pegin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/pegin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,uCAAuC,CAAC;AAI/C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,eAAe,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kEAAkE;IAClE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,0EAA0E;IAC1E,0BAA0B,EAAE,MAAM,EAAE,CAAC;IACrC,+DAA+D;IAC/D,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"pegin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/pegin.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AAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,cAAc,EAAE,cAAc,CAAC;IAC/B,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,kBAAkB,CAAC,CA2C7B;AAuBD;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,aAAa,CAAC,CAoCxB"}
|
|
@@ -7,6 +7,25 @@ import { Hex } from 'viem';
|
|
|
7
7
|
* @see Rust: bitcoin::taproot::LeafVersion::TapScript
|
|
8
8
|
*/
|
|
9
9
|
export declare const TAPSCRIPT_LEAF_VERSION = 192;
|
|
10
|
+
/**
|
|
11
|
+
* Hex-string length of a 32-byte BIP-340 x-only public key (taproot,
|
|
12
|
+
* Schnorr). Doubles the byte count: `2 * 32 = 64`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const X_ONLY_PUBKEY_HEX_LEN = 64;
|
|
15
|
+
/**
|
|
16
|
+
* Hex-string length of a 33-byte SEC1-compressed secp256k1 public key
|
|
17
|
+
* (`0x02` or `0x03` prefix + 32-byte x-coordinate). `2 * 33 = 66`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const COMPRESSED_PUBKEY_HEX_LEN = 66;
|
|
20
|
+
/**
|
|
21
|
+
* Hex-string length of a 65-byte SEC1-uncompressed secp256k1 public
|
|
22
|
+
* key (`0x04` prefix + 32-byte x + 32-byte y). `2 * 65 = 130`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const UNCOMPRESSED_PUBKEY_HEX_LEN = 130;
|
|
25
|
+
/**
|
|
26
|
+
* Hex-string length of a 64-byte BIP-340 Schnorr signature. `2 * 64 = 128`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SCHNORR_SIG_HEX_LEN = 128;
|
|
10
29
|
/**
|
|
11
30
|
* Strip "0x" prefix from hex string if present.
|
|
12
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/utils/bitcoin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AAEnD,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,CAIhD;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,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M,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;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAS5D;AA8BD;;;;;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,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../buildAndBroadcastRefund-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../buildAndBroadcastRefund-BEASMFsz.cjs"),a=require("../../../signing-DHSXjhLM.cjs");exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.activateVault=t.activateVault;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.computeHashlock=t.computeHashlock;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.pollAndSignPayouts=t.pollAndSignPayouts;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateSecretAgainstHashlock=t.validateSecretAgainstHashlock;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.waitForPeginStatus=t.waitForPeginStatus;exports.ContractStatus=a.ContractStatus;exports.PeginAction=a.PeginAction;exports.canPerformAction=a.canPerformAction;exports.getPeginProtocolState=a.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as s, C as e, a as i, m as o, h as u, i as l, l as r, k as n, p as d, b as c, s as P, v as g, g as m, d as p, c as v, j as S, e as A, f as V, w as b } from "../../../buildAndBroadcastRefund-
|
|
1
|
+
import { B as s, C as e, a as i, m as o, h as u, i as l, l as r, k as n, p as d, b as c, s as P, v as g, g as m, d as p, c as v, j as S, e as A, f as V, w as b } from "../../../buildAndBroadcastRefund-BzYJv-Fv.js";
|
|
2
2
|
import { C, P as h, a as k, g as y } from "../../../signing-BZigafm0.js";
|
|
3
3
|
export {
|
|
4
4
|
s as BIP68NotMatureError,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.test.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/utils/fee/__tests__/constants.test.ts"],"names":[],"mappings":""}
|
|
@@ -23,21 +23,42 @@ export declare const FEE_SAFETY_MARGIN = 1.1;
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function rateBasedTxBufferFee(feeRate: number): number;
|
|
25
25
|
/**
|
|
26
|
-
* Number of fixed (non-HTLC) outputs in a Pre-PegIn
|
|
27
|
-
* Currently this is 1 CPFP anchor output.
|
|
26
|
+
* Number of always-present fixed (non-HTLC) outputs in a Pre-PegIn
|
|
27
|
+
* transaction. Currently this is 1 CPFP anchor output.
|
|
28
28
|
*/
|
|
29
29
|
export declare const PEGIN_FIXED_OUTPUTS = 1;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Size of the auth-anchor `OP_RETURN` output when committed into a
|
|
32
|
+
* Pre-PegIn. The output carries `OP_RETURN <PUSH32 hash>` = 34 script
|
|
33
|
+
* bytes, plus 8 bytes value + 1 byte scriptLen = ~43 bytes total —
|
|
34
|
+
* same as {@link MAX_NON_LEGACY_OUTPUT_SIZE}. Counted as one output
|
|
35
|
+
* toward the fee-estimation output budget.
|
|
36
|
+
*/
|
|
37
|
+
export declare const PEGIN_AUTH_ANCHOR_OUTPUTS = 1;
|
|
38
|
+
/**
|
|
39
|
+
* Compute the total number of outputs (before change) in a Pre-PegIn
|
|
40
|
+
* transaction.
|
|
41
|
+
*
|
|
42
|
+
* A Pre-PegIn tx has: N HTLC outputs (one per vault) + optional
|
|
43
|
+
* auth-anchor OP_RETURN output + fixed outputs (CPFP anchor). This
|
|
44
|
+
* count is used for fee estimation — the change output is handled
|
|
45
|
+
* separately by `selectUtxosForPegin` when the change amount exceeds
|
|
46
|
+
* the dust threshold.
|
|
32
47
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
48
|
+
* `authAnchorHash` is the same value forwarded into `buildPrePeginPsbt`:
|
|
49
|
+
* when truthy the Pre-PegIn carries an OP_RETURN commitment, so callers
|
|
50
|
+
* pass the same value to both functions and the fee budget stays in
|
|
51
|
+
* lockstep with the output set. Passing `undefined`/`null` reproduces
|
|
52
|
+
* the legacy single-arg behavior (HTLCs + CPFP only).
|
|
36
53
|
*
|
|
37
|
-
* @param vaultCount
|
|
38
|
-
* @
|
|
54
|
+
* @param vaultCount - Number of vaults in the batch (≥1).
|
|
55
|
+
* @param authAnchorHash - The same auth-anchor commitment passed to
|
|
56
|
+
* `buildPrePeginPsbt`. Truthy → counts the
|
|
57
|
+
* OP_RETURN output in the budget.
|
|
58
|
+
* @returns Total output count before change.
|
|
59
|
+
* @throws If `vaultCount` is not a positive integer.
|
|
39
60
|
*/
|
|
40
|
-
export declare function peginOutputCount(vaultCount: number): number;
|
|
61
|
+
export declare function peginOutputCount(vaultCount: number, authAnchorHash?: string | null): number;
|
|
41
62
|
/**
|
|
42
63
|
* Safety multiplier for split transaction fee validation.
|
|
43
64
|
* The signed PSBT's fee rate and absolute fee must not exceed this multiple
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/fee/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,eAAe,KAAK,CAAC;AAGlC,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAG7C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAG1C,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,oFAAoF;AACpF,eAAO,MAAM,cAAc,QAAuB,CAAC;AAGnD,eAAO,MAAM,mCAAmC,KAAK,CAAC;AAGtD,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAGjD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/fee/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,eAAe,KAAK,CAAC;AAGlC,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAG7C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAG1C,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,oFAAoF;AACpF,eAAO,MAAM,cAAc,QAAuB,CAAC;AAGnD,eAAO,MAAM,mCAAmC,KAAK,CAAC;AAGtD,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAGjD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC7B,MAAM,CAaR;AAED;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,IAAI,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../signing-DHSXjhLM.cjs"),T=require("../../../validation-u8W7Lp2x.cjs"),t=require("../../../fundPeginTransaction-DaWoYCgO.cjs"),e=require("../../../psbtInputFields-CB8hqjQ5.cjs"),E=require("../../../bitcoin-DIN0OupO.cjs");exports.createTaprootScriptPathSignOptions=_.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=T.BITCOIN_ADDRESS_RE;exports.HEX_RE=T.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=T.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=T.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=T.TXID_RE;exports.BTC_DUST_SAT=t.BTC_DUST_SAT;exports.DUST_THRESHOLD=t.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=t.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=t.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=t.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=t.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=t.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=t.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=t.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=t.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=t.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=t.fundPeginTransaction;exports.parseUnfundedWasmTransaction=t.parseUnfundedWasmTransaction;exports.peginOutputCount=t.peginOutputCount;exports.rateBasedTxBufferFee=t.rateBasedTxBufferFee;exports.BitcoinScriptType=e.BitcoinScriptType;exports.UtxoNotAvailableError=e.UtxoNotAvailableError;exports.assertUtxosAvailable=e.assertUtxosAvailable;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.collectReservedUtxoRefs=e.collectReservedUtxoRefs;exports.extractInputsFromTransaction=e.extractInputsFromTransaction;exports.getDustThreshold=e.getDustThreshold;exports.getPsbtInputFields=e.getPsbtInputFields;exports.getScriptType=e.getScriptType;exports.selectUtxosForDeposit=e.selectUtxosForDeposit;exports.selectUtxosForPegin=e.selectUtxosForPegin;exports.shouldAddChangeOutput=e.shouldAddChangeOutput;exports.validateUtxosAvailable=e.validateUtxosAvailable;exports.getNetwork=E.getNetwork;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { c as t } from "../../../signing-BZigafm0.js";
|
|
2
|
-
import { B as
|
|
3
|
-
import { B as A, D as R, F as
|
|
4
|
-
import { B as f, U as B, a as D, f as L, c as
|
|
5
|
-
import { g as
|
|
2
|
+
import { B as T, H as _, K as E, M as o, T as r } from "../../../validation-CxqROCno.js";
|
|
3
|
+
import { B as A, D as R, F as U, L as i, M as p, P as I, b as c, a as n, S as F, T as l, W as O, f as P, c as x, p as N, r as u } from "../../../fundPeginTransaction-oV-dNJOU.js";
|
|
4
|
+
import { B as f, U as B, a as D, f as L, c as g, e as C, g as H, i as X, h, s as m, b as M, d as b, v } from "../../../psbtInputFields-DeTFSJOq.js";
|
|
5
|
+
import { g as Y } from "../../../bitcoin-B-Y0DlqR.js";
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
T as BITCOIN_ADDRESS_RE,
|
|
8
8
|
A as BTC_DUST_SAT,
|
|
9
9
|
f as BitcoinScriptType,
|
|
10
10
|
R as DUST_THRESHOLD,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
U as FEE_SAFETY_MARGIN,
|
|
12
|
+
_ as HEX_RE,
|
|
13
|
+
E as KNOWN_SCRIPT_PREFIXES,
|
|
14
|
+
i as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
15
|
+
p as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
16
16
|
o as MAX_REASONABLE_FEE_SATS,
|
|
17
17
|
I as P2TR_INPUT_SIZE,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
c as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
19
|
+
n as PEGIN_FIXED_OUTPUTS,
|
|
20
|
+
F as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
20
21
|
r as TXID_RE,
|
|
21
|
-
|
|
22
|
+
l as TX_BUFFER_SIZE_OVERHEAD,
|
|
22
23
|
B as UtxoNotAvailableError,
|
|
23
|
-
|
|
24
|
+
O as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
24
25
|
D as assertUtxosAvailable,
|
|
25
26
|
L as calculateBtcTxHash,
|
|
26
|
-
|
|
27
|
+
g as collectReservedUtxoRefs,
|
|
27
28
|
t as createTaprootScriptPathSignOptions,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
C as extractInputsFromTransaction,
|
|
30
|
+
P as fundPeginTransaction,
|
|
31
|
+
H as getDustThreshold,
|
|
32
|
+
Y as getNetwork,
|
|
33
|
+
X as getPsbtInputFields,
|
|
34
|
+
h as getScriptType,
|
|
35
|
+
x as parseUnfundedWasmTransaction,
|
|
36
|
+
N as peginOutputCount,
|
|
36
37
|
u as rateBasedTxBufferFee,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
m as selectUtxosForDeposit,
|
|
39
|
+
M as selectUtxosForPegin,
|
|
40
|
+
b as shouldAddChangeOutput,
|
|
41
|
+
v as validateUtxosAvailable
|
|
41
42
|
};
|
|
42
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -47,9 +47,14 @@ export interface SelectUtxosForDepositParams<T extends {
|
|
|
47
47
|
/** Fee rate in sat/vB. Used to estimate fee buffer for sufficiency check. */
|
|
48
48
|
feeRate: number;
|
|
49
49
|
}
|
|
50
|
+
/** Narrow structural type for early UTXO reservations (pre-ETH-registration). */
|
|
51
|
+
export interface UtxoReservationLike {
|
|
52
|
+
unsignedTxHex: string;
|
|
53
|
+
}
|
|
50
54
|
export interface CollectReservedUtxoRefsParams {
|
|
51
55
|
vaults?: VaultLike[];
|
|
52
56
|
pendingPegins?: PendingPeginLike[];
|
|
57
|
+
utxoReservations?: UtxoReservationLike[];
|
|
53
58
|
}
|
|
54
59
|
/**
|
|
55
60
|
* Collect UTXO refs from in-flight deposits (PENDING/VERIFIED vaults and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reservation.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/utxo/reservation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH,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A2B,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAuC7C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-implementation golden vectors for `buildFundingOutpointsCommitment`
|
|
3
|
+
* and `buildVaultContext`.
|
|
4
|
+
*
|
|
5
|
+
* Pins the byte-level encoding (in particular, the **big-endian** vout
|
|
6
|
+
* encoding inside each serialized outpoint and the `I2OSP(32, 4)` length
|
|
7
|
+
* prefix in `vaultContext`) against an independent Rust implementation
|
|
8
|
+
* derived directly from the spec
|
|
9
|
+
* (`docs/specs/derive-vault-secrets.md` §2.3) — addressing Govard's P1
|
|
10
|
+
* review on PR babylonlabs-io/babylon-toolkit#1458.
|
|
11
|
+
*
|
|
12
|
+
* ## Reproduction recipe (Rust side)
|
|
13
|
+
*
|
|
14
|
+
* The Rust hex constants below were produced by a temporary
|
|
15
|
+
* `#[cfg(test)] mod golden_vault_context` block added to
|
|
16
|
+
* `~/babylon/btc-vault/crates/crypto/src/hash.rs` that re-implements the
|
|
17
|
+
* spec from scratch (no shared code path with the TS impl) using
|
|
18
|
+
* `sha2::Sha256` and `u32::to_be_bytes()`. The block was reverted from
|
|
19
|
+
* btc-vault after capture; recreate it (or any equivalent independent
|
|
20
|
+
* implementation) and run:
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
* cargo test --manifest-path /path/to/btc-vault/Cargo.toml \
|
|
24
|
+
* -p btc-vault-crypto --lib \
|
|
25
|
+
* hash::golden_vault_context::print_golden_hex \
|
|
26
|
+
* -- --nocapture --exact
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* If the Rust side switches to little-endian for `vout`, this test
|
|
30
|
+
* fails — surfacing the cross-impl divergence the PR review asked us
|
|
31
|
+
* to lock down.
|
|
32
|
+
*/
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=context.golden.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.golden.test.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/vault-secrets/__tests__/context.golden.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.test.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/vault-secrets/__tests__/context.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for HKDF-Expand-based vault-secret derivation
|
|
3
|
+
* (`derive-vault-secrets.md` §2.2).
|
|
4
|
+
*
|
|
5
|
+
* Covers output sizes, determinism, cross-independence, input
|
|
6
|
+
* validation, and reference equivalence with a direct
|
|
7
|
+
* `@noble/hashes/hkdf` expand call.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=expand.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.test.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/vault-secrets/__tests__/expand.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.test.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/vault-secrets/__tests__/info.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical `vaultContext` byte encoding per
|
|
3
|
+
* `derive-vault-secrets.md` §2.3.
|
|
4
|
+
*
|
|
5
|
+
* ```
|
|
6
|
+
* vaultContext :=
|
|
7
|
+
* I2OSP(32, 4) || depositorBtcPubkey // 32B x-only
|
|
8
|
+
* || I2OSP(32, 4) || fundingOutpointsCommitment // 32B SHA-256
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* `fundingOutpointsCommitment` is SHA-256 over the canonically-sorted
|
|
12
|
+
* funding outpoints of the Pre-PegIn transaction, serialized as
|
|
13
|
+
* `txid (32B display/RPC order) || vout (4B u32 big-endian)` per
|
|
14
|
+
* outpoint. Sorting by 36-byte lex order makes the commitment
|
|
15
|
+
* invariant under tx-level input reordering, so same-inputs RBF and
|
|
16
|
+
* reorg rebroadcasts yield the same context.
|
|
17
|
+
*
|
|
18
|
+
* @module vault-secrets/context
|
|
19
|
+
*/
|
|
20
|
+
export interface FundingOutpoint {
|
|
21
|
+
/**
|
|
22
|
+
* Bitcoin txid in **display / RPC order** (byte-reversed from the
|
|
23
|
+
* internal little-endian wire form used when hashing a raw tx).
|
|
24
|
+
*/
|
|
25
|
+
txid: Uint8Array;
|
|
26
|
+
/** Output index within the referenced transaction (u32). */
|
|
27
|
+
vout: number;
|
|
28
|
+
}
|
|
29
|
+
export interface VaultContextInput {
|
|
30
|
+
/** Depositor's x-only BTC public key (32 bytes). */
|
|
31
|
+
depositorBtcPubkey: Uint8Array;
|
|
32
|
+
/** Funding outpoints of the Pre-PegIn transaction. MUST be non-empty. */
|
|
33
|
+
fundingOutpoints: readonly FundingOutpoint[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Compute SHA-256 over canonically-sorted funding outpoints.
|
|
37
|
+
*
|
|
38
|
+
* Outpoints are serialized as 36-byte `txid || vout_BE`, sorted
|
|
39
|
+
* ascending lexicographically, concatenated, then hashed.
|
|
40
|
+
*
|
|
41
|
+
* @throws If `outpoints` is empty or contains duplicates.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildFundingOutpointsCommitment(outpoints: readonly FundingOutpoint[]): Uint8Array;
|
|
44
|
+
/**
|
|
45
|
+
* Build the canonical `vaultContext` byte string fed into the wallet's
|
|
46
|
+
* `deriveContextHash` (or a locally-implemented equivalent on the
|
|
47
|
+
* app side).
|
|
48
|
+
*
|
|
49
|
+
* Output length is always 72 bytes.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildVaultContext(input: VaultContextInput): Uint8Array;
|
|
52
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/vault-secrets/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAeH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,kBAAkB,EAAE,UAAU,CAAC;IAC/B,yEAAyE;IACzE,gBAAgB,EAAE,SAAS,eAAe,EAAE,CAAC;CAC9C;AAoCD;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,SAAS,eAAe,EAAE,GACpC,UAAU,CAsBZ;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,UAAU,CAqBtE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HKDF-Expand-based vault-secret derivation per
|
|
3
|
+
* `derive-vault-secrets.md` §2.2.
|
|
4
|
+
*
|
|
5
|
+
* Pure, synchronous expanders that derive three domain-separated
|
|
6
|
+
* secrets from a 32-byte `root`. The root is spec-opaque — it may come
|
|
7
|
+
* from a wallet's `deriveContextHash`, a mnemonic-backed derivation,
|
|
8
|
+
* a hardware-backed KMS, or any other 32-byte source.
|
|
9
|
+
*
|
|
10
|
+
* All expand calls use HKDF-Expand-SHA-256 with `root` directly as the
|
|
11
|
+
* PRK (RFC 5869 §3.3: the Extract step is omitted when the input is
|
|
12
|
+
* already a uniformly-distributed pseudorandom key of HashLen bytes).
|
|
13
|
+
*
|
|
14
|
+
* @module vault-secrets/expand
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Derive the 32-byte `authAnchor` shared across a single Pre-PegIn
|
|
18
|
+
* transaction.
|
|
19
|
+
*
|
|
20
|
+
* `SHA256(authAnchor)` is committed as the OP_RETURN preimage hash in
|
|
21
|
+
* the Pre-PegIn; the raw preimage is revealed to the vault provider's
|
|
22
|
+
* `auth_createDepositorToken` RPC in exchange for a CWT bearer token.
|
|
23
|
+
*/
|
|
24
|
+
export declare function expandAuthAnchor(root: Uint8Array): Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* Derive the 32-byte `hashlockSecret` for the HTLC at output index
|
|
27
|
+
* `htlcVout`.
|
|
28
|
+
*
|
|
29
|
+
* `SHA256(hashlockSecret)` is committed as the HTLC taproot hashlock
|
|
30
|
+
* at vout = `htlcVout` in the Pre-PegIn. The raw preimage is revealed
|
|
31
|
+
* on Ethereum via `activateVaultWithSecret`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function expandHashlockSecret(root: Uint8Array, htlcVout: number): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* Derive the 64-byte `wotsSeed` for the vault at output index
|
|
36
|
+
* `htlcVout`.
|
|
37
|
+
*
|
|
38
|
+
* Fed into the per-vault WOTS block-keypair derivation. Only the
|
|
39
|
+
* `keccak256` hash of the derived public keys appears on-chain
|
|
40
|
+
* (committed as `depositorWotsPkHash`).
|
|
41
|
+
*/
|
|
42
|
+
export declare function expandWotsSeed(root: Uint8Array, htlcVout: number): Uint8Array;
|
|
43
|
+
//# sourceMappingURL=expand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/vault-secrets/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0BH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAQ7D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,GACf,UAAU,CAQZ;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAQ7E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vault secrets: HKDF-Expand-based derivation of three domain-separated
|
|
3
|
+
* secrets (HTLC hashlock preimage, depositor auth anchor, WOTS seed)
|
|
4
|
+
* from a single 32-byte root.
|
|
5
|
+
*
|
|
6
|
+
* Implements `derive-vault-secrets.md` §2.2 and Appendix A. The root is
|
|
7
|
+
* spec-opaque — callers produce it however they like (today: BIP-39
|
|
8
|
+
* mnemonic → HKDF; tomorrow: `wallet.deriveContextHash`). The SDK is
|
|
9
|
+
* provenance-agnostic and only consumes the 32 bytes.
|
|
10
|
+
*
|
|
11
|
+
* @module tbv/core/vault-secrets
|
|
12
|
+
*/
|
|
13
|
+
export { expandAuthAnchor, expandHashlockSecret, expandWotsSeed, } from './expand';
|
|
14
|
+
export { buildFundingOutpointsCommitment, buildVaultContext } from './context';
|
|
15
|
+
export type { FundingOutpoint, VaultContextInput } from './context';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/vault-secrets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE/E,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Info encoding for HKDF-Expand per `derive-vault-secrets.md` Appendix A.
|
|
3
|
+
*
|
|
4
|
+
* ```
|
|
5
|
+
* info(label, ctx) :=
|
|
6
|
+
* "babylonvault" // fixed 12-byte ASCII domain tag
|
|
7
|
+
* || I2OSP(len(label), 1) // 1-byte label length
|
|
8
|
+
* || label // ASCII bytes of the label
|
|
9
|
+
* || I2OSP(len(ctx), 2) // 2-byte big-endian ctx length
|
|
10
|
+
* || ctx // opaque per-label context bytes
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* The fixed-width length prefixes make the encoding injective over the
|
|
14
|
+
* set of legal `(label, ctx)` pairs, which is what lets distinct labels
|
|
15
|
+
* produce computationally-independent HKDF-Expand outputs under the
|
|
16
|
+
* HMAC-SHA-256 PRF assumption.
|
|
17
|
+
*
|
|
18
|
+
* @module vault-secrets/info
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @internal Label for the per-HTLC hashlock preimage (Appendix A §A.2).
|
|
22
|
+
* Exported only so the spec-conformance tests can pin the literal value.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LABEL_HASHLOCK = "hashlock";
|
|
25
|
+
/**
|
|
26
|
+
* @internal Label for the per-Pre-PegIn shared auth-anchor (Appendix A §A.2).
|
|
27
|
+
* Exported only so the spec-conformance tests can pin the literal value.
|
|
28
|
+
*/
|
|
29
|
+
export declare const LABEL_AUTH_ANCHOR = "auth-anchor";
|
|
30
|
+
/**
|
|
31
|
+
* @internal Label for the per-HTLC WOTS block-derivation seed (Appendix A §A.2).
|
|
32
|
+
* Exported only so the spec-conformance tests can pin the literal value.
|
|
33
|
+
*/
|
|
34
|
+
export declare const LABEL_WOTS_SEED = "wots-seed";
|
|
35
|
+
/**
|
|
36
|
+
* Encode a 32-bit unsigned integer as 4 big-endian bytes (RFC 8017 §4.1,
|
|
37
|
+
* `I2OSP(n, 4)`).
|
|
38
|
+
*
|
|
39
|
+
* @internal Helper used by `buildInfo` and the per-HTLC `expand*`
|
|
40
|
+
* functions; consumed directly only by tests.
|
|
41
|
+
*
|
|
42
|
+
* @throws If `value` is not a non-negative integer ≤ `0xffffffff`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function i2osp4(value: number): Uint8Array;
|
|
45
|
+
/**
|
|
46
|
+
* Build the `info` byte-string for an HKDF-Expand invocation.
|
|
47
|
+
*
|
|
48
|
+
* @internal Used by the per-HTLC `expand*` functions; exposed for the
|
|
49
|
+
* spec-conformance tests that pin the encoded byte layout.
|
|
50
|
+
*
|
|
51
|
+
* @param label - ASCII label tag. Length MUST be in `[1, 255]`.
|
|
52
|
+
* @param ctx - Optional opaque context bytes. Length MUST be in `[0, 65535]`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildInfo(label: string, ctx?: Uint8Array): Uint8Array;
|
|
55
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/vault-secrets/info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAaH;;;GAGG;AACH,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAUhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,UAA8B,GAClC,UAAU,CAyCZ"}
|