@babylonlabs-io/ts-sdk 0.37.1 → 0.37.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/{PayoutManager-BxAY2x0g.cjs → PayoutManager-BfT0V-tm.cjs} +2 -2
- package/dist/{PayoutManager-BxAY2x0g.cjs.map → PayoutManager-BfT0V-tm.cjs.map} +1 -1
- package/dist/{PayoutManager-sfxuOBGq.js → PayoutManager-Cf51DBcu.js} +2 -2
- package/dist/{PayoutManager-sfxuOBGq.js.map → PayoutManager-Cf51DBcu.js.map} +1 -1
- package/dist/PeginManager-CTznAVPT.cjs +2 -0
- package/dist/PeginManager-CTznAVPT.cjs.map +1 -0
- package/dist/{PeginManager-C7-XYrkK.js → PeginManager-HCYTUzh6.js} +325 -315
- package/dist/{PeginManager-C7-XYrkK.js.map → PeginManager-HCYTUzh6.js.map} +1 -1
- package/dist/assertPsbtUnsignedTxMatches-CagW7XqW.cjs +2 -0
- package/dist/assertPsbtUnsignedTxMatches-CagW7XqW.cjs.map +1 -0
- package/dist/{assertPsbtUnsignedTxMatches-D7RxpR4A.js → assertPsbtUnsignedTxMatches-Dry5dTfl.js} +84 -81
- package/dist/assertPsbtUnsignedTxMatches-Dry5dTfl.js.map +1 -0
- package/dist/{buildAndBroadcastRefund-_CEDUU5H.cjs → buildAndBroadcastRefund-Bj2e94CC.cjs} +2 -2
- package/dist/{buildAndBroadcastRefund-_CEDUU5H.cjs.map → buildAndBroadcastRefund-Bj2e94CC.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-C1eOhIdo.js → buildAndBroadcastRefund-CI_x6OtX.js} +21 -16
- package/dist/{buildAndBroadcastRefund-C1eOhIdo.js.map → buildAndBroadcastRefund-CI_x6OtX.js.map} +1 -1
- package/dist/challengeAssert-CMb7r-je.cjs +2 -0
- package/dist/challengeAssert-CMb7r-je.cjs.map +1 -0
- package/dist/{challengeAssert-BXESW00N.js → challengeAssert-D7OCrDIc.js} +29 -29
- package/dist/challengeAssert-D7OCrDIc.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +5 -5
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +2 -2
- package/dist/tbv/core/primitives/psbt/payout.d.ts +2 -2
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +5 -5
- package/package.json +1 -1
- package/dist/PeginManager-CRuwG4I-.cjs +0 -2
- package/dist/PeginManager-CRuwG4I-.cjs.map +0 -1
- package/dist/assertPsbtUnsignedTxMatches-BoHwgW30.cjs +0 -2
- package/dist/assertPsbtUnsignedTxMatches-BoHwgW30.cjs.map +0 -1
- package/dist/assertPsbtUnsignedTxMatches-D7RxpR4A.js.map +0 -1
- package/dist/challengeAssert-BKDS_ADt.cjs +0 -2
- package/dist/challengeAssert-BKDS_ADt.cjs.map +0 -1
- package/dist/challengeAssert-BXESW00N.js.map +0 -1
|
@@ -2,32 +2,32 @@ import { p as S, s as x, k as y, h as T, T as E } from "./bitcoin-B5aNKtsk.js";
|
|
|
2
2
|
import { getPeginPayoutScriptInfo as U, tapInternalPubkey as v, getChallengeAssertScriptInfo as _ } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
3
|
import { Buffer as l } from "buffer";
|
|
4
4
|
import { Transaction as d, Psbt as O } from "bitcoinjs-lib";
|
|
5
|
-
|
|
5
|
+
import { D as A, f as m, A as w } from "./assertPsbtUnsignedTxMatches-Dry5dTfl.js";
|
|
6
|
+
function I(n) {
|
|
6
7
|
return S(n).toLowerCase();
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
+
function N(n, t, c) {
|
|
9
10
|
const r = /* @__PURE__ */ new Set();
|
|
10
|
-
r.add(
|
|
11
|
+
r.add(I(n));
|
|
11
12
|
for (const o of t)
|
|
12
|
-
r.add(
|
|
13
|
-
return r.delete(
|
|
13
|
+
r.add(I(o));
|
|
14
|
+
return r.delete(I(c)), r.size;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
async function N(n) {
|
|
16
|
+
async function q(n) {
|
|
17
17
|
const t = d.fromHex(x(n.payoutTxHex)), c = d.fromHex(x(n.peginTxHex)), r = d.fromHex(x(n.assertTxHex));
|
|
18
18
|
if (t.ins.length !== A)
|
|
19
19
|
throw new Error(
|
|
20
20
|
`Depositor Payout transaction must have exactly ${A} inputs, got ${t.ins.length}`
|
|
21
21
|
);
|
|
22
|
-
const o = t.ins[0], i = t.ins[1],
|
|
23
|
-
if (
|
|
22
|
+
const o = t.ins[0], i = t.ins[1], a = y(o), e = c.getId();
|
|
23
|
+
if (a !== e || o.index !== m)
|
|
24
24
|
throw new Error(
|
|
25
|
-
`Depositor Payout input 0 must spend PegIn:${
|
|
25
|
+
`Depositor Payout input 0 must spend PegIn:${m}. Expected ${e}:${m}, got ${a}:${o.index}`
|
|
26
26
|
);
|
|
27
|
-
const s = y(i),
|
|
28
|
-
if (s !==
|
|
27
|
+
const s = y(i), u = r.getId();
|
|
28
|
+
if (s !== u || i.index !== w)
|
|
29
29
|
throw new Error(
|
|
30
|
-
`Depositor Payout input 1 must spend Assert:${
|
|
30
|
+
`Depositor Payout input 1 must spend Assert:${w}. Expected ${u}:${w}, got ${s}:${i.index}`
|
|
31
31
|
);
|
|
32
32
|
const f = c.outs[o.index], h = r.outs[i.index], { payoutScript: P, payoutControlBlock: g } = await U(
|
|
33
33
|
n.connectorParams
|
|
@@ -64,7 +64,7 @@ async function N(n) {
|
|
|
64
64
|
});
|
|
65
65
|
return p.toHex();
|
|
66
66
|
}
|
|
67
|
-
async function
|
|
67
|
+
async function V(n) {
|
|
68
68
|
const t = d.fromHex(
|
|
69
69
|
x(n.challengeAssertTxHex)
|
|
70
70
|
), c = d.fromHex(x(n.assertTxHex)), r = c.getId();
|
|
@@ -74,10 +74,10 @@ async function q(n) {
|
|
|
74
74
|
);
|
|
75
75
|
const o = /* @__PURE__ */ new Set();
|
|
76
76
|
for (let e = 0; e < t.ins.length; e++) {
|
|
77
|
-
const s = t.ins[e],
|
|
78
|
-
if (
|
|
77
|
+
const s = t.ins[e], u = y(s);
|
|
78
|
+
if (u !== r)
|
|
79
79
|
throw new Error(
|
|
80
|
-
`ChallengeAssert input ${e} must spend an Assert output. Expected txid ${r}, got ${
|
|
80
|
+
`ChallengeAssert input ${e} must spend an Assert output. Expected txid ${r}, got ${u}`
|
|
81
81
|
);
|
|
82
82
|
if (!c.outs[s.index])
|
|
83
83
|
throw new Error(
|
|
@@ -91,17 +91,17 @@ async function q(n) {
|
|
|
91
91
|
}
|
|
92
92
|
const i = await Promise.all(
|
|
93
93
|
n.connectorParamsPerInput.map((e) => _(e))
|
|
94
|
-
),
|
|
95
|
-
|
|
94
|
+
), a = new O();
|
|
95
|
+
a.setVersion(t.version), a.setLocktime(t.locktime);
|
|
96
96
|
for (let e = 0; e < t.ins.length; e++) {
|
|
97
|
-
const s = t.ins[e],
|
|
98
|
-
|
|
97
|
+
const s = t.ins[e], u = c.outs[s.index], { script: f, controlBlock: h } = i[e], P = T(f), g = T(h);
|
|
98
|
+
a.addInput({
|
|
99
99
|
hash: s.hash,
|
|
100
100
|
index: s.index,
|
|
101
101
|
sequence: s.sequence,
|
|
102
102
|
witnessUtxo: {
|
|
103
|
-
script:
|
|
104
|
-
value:
|
|
103
|
+
script: u.script,
|
|
104
|
+
value: u.value
|
|
105
105
|
},
|
|
106
106
|
tapLeafScript: [
|
|
107
107
|
{
|
|
@@ -114,15 +114,15 @@ async function q(n) {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
for (const e of t.outs)
|
|
117
|
-
|
|
117
|
+
a.addOutput({
|
|
118
118
|
script: e.script,
|
|
119
119
|
value: e.value
|
|
120
120
|
});
|
|
121
|
-
return
|
|
121
|
+
return a.toHex();
|
|
122
122
|
}
|
|
123
123
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
V as a,
|
|
125
|
+
q as b,
|
|
126
|
+
N as c
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=challengeAssert-
|
|
128
|
+
//# sourceMappingURL=challengeAssert-D7OCrDIc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"challengeAssert-D7OCrDIc.js","sources":["../src/tbv/core/primitives/challengers.ts","../src/tbv/core/primitives/psbt/depositorPayout.ts","../src/tbv/core/primitives/psbt/challengeAssert.ts"],"sourcesContent":["/**\n * Challenger counting utilities.\n *\n * Used for UI-level validation (e.g. computing minimum deposit amounts)\n * where the depositor's identity is known. The transaction builders use\n * `vaultKeeperBtcPubkeys.length` to match the VP's current validation.\n */\n\nimport { processPublicKeyToXOnly } from \"./utils/bitcoin\";\n\n/**\n * Normalize a public key to lowercase x-only hex for reliable comparison.\n *\n * Handles `0x` prefixes, compressed (33-byte), and uncompressed (65-byte) keys.\n */\nfunction normalizeKey(key: string): string {\n return processPublicKeyToXOnly(key).toLowerCase();\n}\n\n/**\n * Compute the number of local challengers for a vault.\n *\n * Mirrors the VP's `compute_num_challengers()` logic:\n * local challengers = {vault_provider} ∪ {vault_keepers} − {depositor}\n *\n * Keys are normalized to x-only lowercase hex before comparison, so\n * `0x`-prefixed, compressed, or mixed-case keys are handled correctly.\n *\n * @param vaultProviderPubkey - Vault provider BTC public key\n * @param vaultKeeperPubkeys - Vault keeper BTC public keys\n * @param depositorPubkey - Depositor (claimer) BTC public key\n * @returns Number of local challengers\n */\nexport function computeNumLocalChallengers(\n vaultProviderPubkey: string,\n vaultKeeperPubkeys: string[],\n depositorPubkey: string,\n): number {\n const localSet = new Set<string>();\n localSet.add(normalizeKey(vaultProviderPubkey));\n for (const vk of vaultKeeperPubkeys) {\n localSet.add(normalizeKey(vk));\n }\n localSet.delete(normalizeKey(depositorPubkey));\n return localSet.size;\n}\n","/**\n * Depositor Payout PSBT Builder\n *\n * Builds unsigned PSBTs for the depositor's own Payout transaction\n * (depositor-as-claimer path). The depositor signs input 0 using the\n * payout taproot script from WasmPeginPayoutConnector (PegIn vault UTXO).\n *\n * Input 0 spends PegIn:0 (the vault UTXO) — the same connector used for\n * VP/VK payout signing. The VP verifies this signature using the\n * PeginPayoutConnector's payout script.\n *\n * @module primitives/psbt/depositorPayout\n * @see btc-vault crates/vault/src/sign.rs — verify_depositor_signature / get_payout_tap_leaf_hash\n */\n\nimport {\n type PayoutConnectorParams,\n getPeginPayoutScriptInfo,\n tapInternalPubkey,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction } from \"bitcoinjs-lib\";\n\nimport {\n TAPSCRIPT_LEAF_VERSION,\n hexToUint8Array,\n inputTxidHex,\n stripHexPrefix,\n} from \"../utils/bitcoin\";\nimport {\n ASSERT_PAYOUT_OUTPUT_INDEX,\n DEPOSITOR_PAYOUT_INPUT_COUNT,\n PEGIN_VAULT_OUTPUT_INDEX,\n} from \"./constants\";\n\n/**\n * Parameters for building a depositor Payout PSBT\n */\nexport interface DepositorPayoutParams {\n /** Payout transaction hex (unsigned) */\n payoutTxHex: string;\n /** Authoritative PegIn transaction hex — input 0 must spend PegIn:0 */\n peginTxHex: string;\n /** Authoritative Assert transaction hex — input 1 must spend Assert:0 */\n assertTxHex: string;\n /** Parameters for the PeginPayout connector (depositor, VP, VKs, UCs, timelock) */\n connectorParams: PayoutConnectorParams;\n}\n\n/**\n * Build unsigned depositor Payout PSBT.\n *\n * The depositor's payout transaction has 2 inputs:\n * - Input 0: PegIn:0 (vault UTXO) — depositor signs using PeginPayoutConnector payout script\n * - Input 1: Assert:0 — NOT signed by depositor\n *\n * Both inputs must be present in the PSBT because Taproot SIGHASH_DEFAULT\n * commits to all input prevouts. Prevout script_pubkey/value are derived\n * from the authoritative parent transactions, not trusted from external input.\n *\n * @param params - Depositor payout parameters\n * @returns Unsigned PSBT hex ready for signing\n *\n * @throws If the payout transaction does not have exactly 2 inputs\n * @throws If input 0 does not reference peginTxHex at output index 0\n * @throws If input 1 does not reference assertTxHex at output index 0\n */\nexport async function buildDepositorPayoutPsbt(\n params: DepositorPayoutParams,\n): Promise<string> {\n const payoutTx = Transaction.fromHex(stripHexPrefix(params.payoutTxHex));\n const peginTx = Transaction.fromHex(stripHexPrefix(params.peginTxHex));\n const assertTx = Transaction.fromHex(stripHexPrefix(params.assertTxHex));\n\n if (payoutTx.ins.length !== DEPOSITOR_PAYOUT_INPUT_COUNT) {\n throw new Error(\n `Depositor Payout transaction must have exactly ${DEPOSITOR_PAYOUT_INPUT_COUNT} inputs, got ${payoutTx.ins.length}`,\n );\n }\n\n const input0 = payoutTx.ins[0];\n const input1 = payoutTx.ins[1];\n\n const input0Txid = inputTxidHex(input0);\n const peginTxid = peginTx.getId();\n if (input0Txid !== peginTxid || input0.index !== PEGIN_VAULT_OUTPUT_INDEX) {\n throw new Error(\n `Depositor Payout input 0 must spend PegIn:${PEGIN_VAULT_OUTPUT_INDEX}. ` +\n `Expected ${peginTxid}:${PEGIN_VAULT_OUTPUT_INDEX}, got ${input0Txid}:${input0.index}`,\n );\n }\n\n const input1Txid = inputTxidHex(input1);\n const assertTxid = assertTx.getId();\n if (input1Txid !== assertTxid || input1.index !== ASSERT_PAYOUT_OUTPUT_INDEX) {\n throw new Error(\n `Depositor Payout input 1 must spend Assert:${ASSERT_PAYOUT_OUTPUT_INDEX}. ` +\n `Expected ${assertTxid}:${ASSERT_PAYOUT_OUTPUT_INDEX}, got ${input1Txid}:${input1.index}`,\n );\n }\n\n const peginPrevOut = peginTx.outs[input0.index];\n const assertPrevOut = assertTx.outs[input1.index];\n\n const { payoutScript, payoutControlBlock } = await getPeginPayoutScriptInfo(\n params.connectorParams,\n );\n const scriptBytes = hexToUint8Array(payoutScript);\n const controlBlock = hexToUint8Array(payoutControlBlock);\n\n const psbt = new Psbt();\n psbt.setVersion(payoutTx.version);\n psbt.setLocktime(payoutTx.locktime);\n\n psbt.addInput({\n hash: input0.hash,\n index: input0.index,\n sequence: input0.sequence,\n witnessUtxo: {\n script: peginPrevOut.script,\n value: peginPrevOut.value,\n },\n tapLeafScript: [\n {\n leafVersion: TAPSCRIPT_LEAF_VERSION,\n script: Buffer.from(scriptBytes),\n controlBlock: Buffer.from(controlBlock),\n },\n ],\n tapInternalKey: Buffer.from(tapInternalPubkey),\n });\n\n psbt.addInput({\n hash: input1.hash,\n index: input1.index,\n sequence: input1.sequence,\n witnessUtxo: {\n script: assertPrevOut.script,\n value: assertPrevOut.value,\n },\n });\n\n for (const output of payoutTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return psbt.toHex();\n}\n","/**\n * ChallengeAssert PSBT Builder\n *\n * Builds an unsigned PSBT for a ChallengeAssert transaction\n * (depositor-as-claimer path, per challenger). The ChallengeAssert tx has\n * NUM_UTXOS_FOR_CHALLENGE_ASSERT (3) inputs, each spending a different Assert\n * output segment. The depositor signs ALL inputs, each with its own taproot\n * script derived from the per-segment connector params.\n *\n * @module primitives/psbt/challengeAssert\n * @see btc-vault crates/vault/docs/btc-transactions-spec.md — ChallengeAssert connector (NUM_UTXOS_FOR_CHALLENGE_ASSERT=3)\n */\n\nimport {\n type ChallengeAssertConnectorParams,\n getChallengeAssertScriptInfo,\n tapInternalPubkey,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction } from \"bitcoinjs-lib\";\n\nimport {\n TAPSCRIPT_LEAF_VERSION,\n hexToUint8Array,\n inputTxidHex,\n stripHexPrefix,\n} from \"../utils/bitcoin\";\n\n/**\n * Parameters for building a ChallengeAssert PSBT\n */\nexport interface ChallengeAssertParams {\n /** ChallengeAssert transaction hex (unsigned) */\n challengeAssertTxHex: string;\n /** Authoritative Assert transaction hex — every input must spend an Assert output */\n assertTxHex: string;\n /** Per-input connector params (one per input/segment, determines the taproot script) */\n connectorParamsPerInput: ChallengeAssertConnectorParams[];\n}\n\n/**\n * Build unsigned ChallengeAssert PSBT.\n *\n * The ChallengeAssert transaction has 3 inputs (one per Assert output segment).\n * Each input has its own taproot script derived from its connector params.\n * The depositor signs all inputs. Every prevout is derived from the\n * authoritative Assert transaction, never trusted from external input.\n *\n * @param params - ChallengeAssert parameters\n * @returns Unsigned PSBT hex ready for signing\n *\n * @throws If the number of connector params does not match the number of inputs\n * @throws If any input does not reference assertTxHex\n * @throws If any referenced Assert output is missing\n * @throws If two inputs reference the same Assert output index\n */\nexport async function buildChallengeAssertPsbt(\n params: ChallengeAssertParams,\n): Promise<string> {\n const challengeAssertTx = Transaction.fromHex(\n stripHexPrefix(params.challengeAssertTxHex),\n );\n const assertTx = Transaction.fromHex(stripHexPrefix(params.assertTxHex));\n const assertTxid = assertTx.getId();\n\n if (params.connectorParamsPerInput.length !== challengeAssertTx.ins.length) {\n throw new Error(\n `Expected ${challengeAssertTx.ins.length} connector params, got ${params.connectorParamsPerInput.length}`,\n );\n }\n\n const seenAssertOutputs = new Set<number>();\n for (let i = 0; i < challengeAssertTx.ins.length; i++) {\n const input = challengeAssertTx.ins[i];\n const inputTxid = inputTxidHex(input);\n if (inputTxid !== assertTxid) {\n throw new Error(\n `ChallengeAssert input ${i} must spend an Assert output. ` +\n `Expected txid ${assertTxid}, got ${inputTxid}`,\n );\n }\n if (!assertTx.outs[input.index]) {\n throw new Error(\n `Assert output ${input.index} not found for ChallengeAssert input ${i} (txid: ${assertTxid})`,\n );\n }\n if (seenAssertOutputs.has(input.index)) {\n throw new Error(\n `ChallengeAssert input ${i} duplicates Assert output index ${input.index}`,\n );\n }\n seenAssertOutputs.add(input.index);\n }\n\n const scriptInfos = await Promise.all(\n params.connectorParamsPerInput.map((cp) => getChallengeAssertScriptInfo(cp)),\n );\n\n const psbt = new Psbt();\n psbt.setVersion(challengeAssertTx.version);\n psbt.setLocktime(challengeAssertTx.locktime);\n\n for (let i = 0; i < challengeAssertTx.ins.length; i++) {\n const input = challengeAssertTx.ins[i];\n const assertPrevOut = assertTx.outs[input.index];\n\n const { script, controlBlock } = scriptInfos[i];\n const scriptBytes = hexToUint8Array(script);\n const controlBlockBytes = hexToUint8Array(controlBlock);\n\n psbt.addInput({\n hash: input.hash,\n index: input.index,\n sequence: input.sequence,\n witnessUtxo: {\n script: assertPrevOut.script,\n value: assertPrevOut.value,\n },\n tapLeafScript: [\n {\n leafVersion: TAPSCRIPT_LEAF_VERSION,\n script: Buffer.from(scriptBytes),\n controlBlock: Buffer.from(controlBlockBytes),\n },\n ],\n tapInternalKey: Buffer.from(tapInternalPubkey),\n });\n }\n\n for (const output of challengeAssertTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return psbt.toHex();\n}\n"],"names":["normalizeKey","key","processPublicKeyToXOnly","computeNumLocalChallengers","vaultProviderPubkey","vaultKeeperPubkeys","depositorPubkey","localSet","vk","buildDepositorPayoutPsbt","params","payoutTx","Transaction","stripHexPrefix","peginTx","assertTx","DEPOSITOR_PAYOUT_INPUT_COUNT","input0","input1","input0Txid","inputTxidHex","peginTxid","PEGIN_VAULT_OUTPUT_INDEX","input1Txid","assertTxid","ASSERT_PAYOUT_OUTPUT_INDEX","peginPrevOut","assertPrevOut","payoutScript","payoutControlBlock","getPeginPayoutScriptInfo","scriptBytes","hexToUint8Array","controlBlock","psbt","Psbt","TAPSCRIPT_LEAF_VERSION","Buffer","tapInternalPubkey","output","buildChallengeAssertPsbt","challengeAssertTx","seenAssertOutputs","i","input","inputTxid","scriptInfos","cp","getChallengeAssertScriptInfo","script","controlBlockBytes"],"mappings":";;;;;AAeA,SAASA,EAAaC,GAAqB;AACzC,SAAOC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a;AAAA,QACX,QAAQjB,EAAc;AAAA,QACtB,OAAOA,EAAc;AAAA,MAAA;AAAA,MAEvB,eAAe;AAAA,QACb;AAAA,UACE,aAAaS;AAAA,UACb,QAAQC,EAAO,KAAKN,CAAW;AAAA,UAC/B,cAAcM,EAAO,KAAKa,CAAiB;AAAA,QAAA;AAAA,MAC7C;AAAA,MAEF,gBAAgBb,EAAO,KAAKC,CAAiB;AAAA,IAAA,CAC9C;AAAA,EACH;AAEA,aAAWC,KAAUE,EAAkB;AACrC,IAAAP,EAAK,UAAU;AAAA,MACb,QAAQK,EAAO;AAAA,MACf,OAAOA,EAAO;AAAA,IAAA,CACf;AAGH,SAAOL,EAAK,MAAA;AACd;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./challengeAssert-CMb7r-je.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),d=require("./peginInput-57FK2O99.cjs"),E=require("./noPayout-B6s8vrW6.cjs"),u=require("./assertPsbtUnsignedTxMatches-CagW7XqW.cjs"),r=require("./bitcoin-CHfKAhcI.cjs"),_=require("./signing-Bnsro0hE.cjs"),P=require("./validation-u8W7Lp2x.cjs"),n=require("./PeginManager-CTznAVPT.cjs"),g=require("./PayoutManager-BfT0V-tm.cjs"),R=require("./ProtocolParams.abi-BmvHwQJV.cjs"),m=require("./BTCVaultRegistry.abi-ZdPpION2.cjs"),T=require("./errors-BP73_stm.cjs"),b=require("./shared/index.cjs"),i=require("./waitForTransactionReceiptSmartAware-tv1mtSIY.cjs"),a=require("./fundPeginTransaction-BBE3wTjR.cjs"),l=require("./reservation-hjXStM03.cjs"),s=require("./mempoolApi-YNkKjQCU.cjs"),t=require("./vault-registry-reader-7gOYnrQD.cjs"),o=require("./types-DnyyBNcC.cjs"),A=require("./errors-Bu0H-dZD.cjs"),e=require("./buildAndBroadcastRefund-Bj2e94CC.cjs"),p=require("./peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=S.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=S.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=S.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>c.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>c.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>c.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>c.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>c.expandWotsSeed});exports.buildPeginInputPsbt=d.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=d.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=d.buildPrePeginPsbt;exports.extractPeginInputSignature=d.extractPeginInputSignature;exports.finalizePeginInputPsbt=d.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.PsbtSubstitutionError=u.PsbtSubstitutionError;exports.assertPayoutOutputMatchesRegistered=u.assertPayoutOutputMatchesRegistered;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=_.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.PeginManager=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.PayoutManager=g.PayoutManager;exports.computeHashlock=g.computeHashlock;exports.validateSecretAgainstHashlock=g.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=R.ApplicationRegistryABI;exports.ProtocolParamsABI=R.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=T.CONTRACT_ERRORS;exports.extractErrorData=T.extractErrorData;exports.getContractErrorMessage=T.getContractErrorMessage;exports.handleContractError=T.handleContractError;exports.isKnownContractError=T.isKnownContractError;exports.BitcoinNetworks=b.BitcoinNetworks;exports.BitcoinScriptType=i.BitcoinScriptType;exports.applyChangeOutputPolicy=i.applyChangeOutputPolicy;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.computeChangeOutputFeeSats=i.computeChangeOutputFeeSats;exports.computeMaxDeposit=i.computeMaxDeposit;exports.computePeginBaseFeeSats=i.computePeginBaseFeeSats;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=i.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.UtxoNotAvailableError=l.UtxoNotAvailableError;exports.assertUtxosAvailable=l.assertUtxosAvailable;exports.collectReservedUtxoRefs=l.collectReservedUtxoRefs;exports.extractInputsFromTransaction=l.extractInputsFromTransaction;exports.selectUtxosForDeposit=l.selectUtxosForDeposit;exports.validateUtxosAvailable=l.validateUtxosAvailable;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.ServerIdentityError=t.ServerIdentityError;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.VpTokenRegistry=t.VpTokenRegistry;exports.batchPollByProvider=t.batchPollByProvider;exports.createAuthenticatedVpClient=t.createAuthenticatedVpClient;exports.primeVpTokenRegistry=t.primeVpTokenRegistry;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateOffchainParams=t.validateOffchainParams;exports.validatePegInConfiguration=t.validatePegInConfiguration;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.validateTBVProtocolParams=t.validateTBVProtocolParams;exports.verifyServerIdentity=t.verifyServerIdentity;exports.vpTokenRegistry=t.vpTokenRegistry;exports.DaemonStatus=o.DaemonStatus;exports.JSON_RPC_ERROR_CODES=o.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=o.JsonRpcClient;exports.JsonRpcError=o.JsonRpcError;exports.POST_WOTS_STATUSES=o.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=o.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=o.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=o.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_STATUSES=o.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=o.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=A.isWotsMismatchError;exports.parseFundingOutpointsFromTx=A.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as s, b as t, c as r } from "./challengeAssert-
|
|
1
|
+
import { a as s, b as t, c as r } from "./challengeAssert-D7OCrDIc.js";
|
|
2
2
|
import { computeMinClaimValue as i, deriveVaultId as n, expandAuthAnchor as u, expandHashlockSecret as l, expandWotsSeed as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
3
|
import { c, a as P, b as T, e as S, f as g } from "./peginInput-CYJzbuwA.js";
|
|
4
4
|
import { a as E, b as R } from "./noPayout-BhgknZBx.js";
|
|
5
|
-
import { P as _, a as x, c as f, b, d as v, e as I } from "./assertPsbtUnsignedTxMatches-
|
|
5
|
+
import { P as _, a as x, c as f, b, d as v, e as I } from "./assertPsbtUnsignedTxMatches-Dry5dTfl.js";
|
|
6
6
|
import { d as V, a as y, b as O, e as h, f as U, j as F, g as B, h as N, i as D, c as M, p as H, s as L, t as k, u as W, v as X } from "./bitcoin-B5aNKtsk.js";
|
|
7
7
|
import { c as K } from "./signing-DaLvGwQe.js";
|
|
8
8
|
import { B as Y, H as Z, K as J, M as j, T as z } from "./validation-CxqROCno.js";
|
|
9
|
-
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "./PeginManager-
|
|
10
|
-
import { P as ia, c as na, v as ua } from "./PayoutManager-
|
|
9
|
+
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "./PeginManager-HCYTUzh6.js";
|
|
10
|
+
import { P as ia, c as na, v as ua } from "./PayoutManager-Cf51DBcu.js";
|
|
11
11
|
import { A as pa, P as da } from "./ProtocolParams.abi-DXu8L0Fn.js";
|
|
12
12
|
import { B as Pa } from "./BTCVaultRegistry.abi-DbJ5lsFJ.js";
|
|
13
13
|
import { C as Sa, e as ga, g as ma, h as Ea, i as Ra } from "./errors-CznAK5NB.js";
|
|
@@ -19,7 +19,7 @@ import { M as oe, g as ie, a as ne, b as ue, c as le, d as pe, e as de, f as ce,
|
|
|
19
19
|
import { S as Se, V as ge, j as me, k as Ee, l as Re, m as Ae, a as _e, d as xe, b as fe, f as be, p as ve, r as Ie, g as Ce, h as Ve, v as ye, i as Oe, c as he, e as Ue } from "./vault-registry-reader-Blhu9FW2.js";
|
|
20
20
|
import { D as Be, b as Ne, J as De, a as Me, d as He, P as Le, R as ke, e as We, c as Xe, V as we } from "./types-TiIjyo2b.js";
|
|
21
21
|
import { i as Ge, p as Ye } from "./errors-9AkghWyk.js";
|
|
22
|
-
import { B as Je, C as je, p as ze, R as qe, a as Qe, n as $e, o as as, i as es, m as ss, l as ts, j as rs, r as os, b as is, s as ns, v as us, g as ls, h as ps, d as ds, c as cs, e as Ps, f as Ts, k as Ss, w as gs } from "./buildAndBroadcastRefund-
|
|
22
|
+
import { B as Je, C as je, p as ze, R as qe, a as Qe, n as $e, o as as, i as es, m as ss, l as ts, j as rs, r as os, b as is, s as ns, v as us, g as ls, h as ps, d as ds, c as cs, e as Ps, f as Ts, k as Ss, w as gs } from "./buildAndBroadcastRefund-CI_x6OtX.js";
|
|
23
23
|
import { C as Es, P as Rs, c as As, g as _s } from "./peginState-CBAlxgXk.js";
|
|
24
24
|
export {
|
|
25
25
|
pa as ApplicationRegistryABI,
|
package/dist/tbv/core/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../challengeAssert-CMb7r-je.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),d=require("../../peginInput-57FK2O99.cjs"),E=require("../../noPayout-B6s8vrW6.cjs"),u=require("../../assertPsbtUnsignedTxMatches-CagW7XqW.cjs"),r=require("../../bitcoin-CHfKAhcI.cjs"),_=require("../../signing-Bnsro0hE.cjs"),P=require("../../validation-u8W7Lp2x.cjs"),n=require("../../PeginManager-CTznAVPT.cjs"),g=require("../../PayoutManager-BfT0V-tm.cjs"),R=require("../../ProtocolParams.abi-BmvHwQJV.cjs"),m=require("../../BTCVaultRegistry.abi-ZdPpION2.cjs"),T=require("../../errors-BP73_stm.cjs"),i=require("../../waitForTransactionReceiptSmartAware-tv1mtSIY.cjs"),a=require("../../fundPeginTransaction-BBE3wTjR.cjs"),l=require("../../reservation-hjXStM03.cjs"),s=require("../../mempoolApi-YNkKjQCU.cjs"),t=require("../../vault-registry-reader-7gOYnrQD.cjs"),o=require("../../types-DnyyBNcC.cjs"),A=require("../../errors-Bu0H-dZD.cjs"),e=require("../../buildAndBroadcastRefund-Bj2e94CC.cjs"),p=require("../../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=S.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=S.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=S.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>c.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>c.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>c.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>c.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>c.expandWotsSeed});exports.buildPeginInputPsbt=d.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=d.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=d.buildPrePeginPsbt;exports.extractPeginInputSignature=d.extractPeginInputSignature;exports.finalizePeginInputPsbt=d.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.PsbtSubstitutionError=u.PsbtSubstitutionError;exports.assertPayoutOutputMatchesRegistered=u.assertPayoutOutputMatchesRegistered;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=_.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.PeginManager=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.PayoutManager=g.PayoutManager;exports.computeHashlock=g.computeHashlock;exports.validateSecretAgainstHashlock=g.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=R.ApplicationRegistryABI;exports.ProtocolParamsABI=R.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=T.CONTRACT_ERRORS;exports.extractErrorData=T.extractErrorData;exports.getContractErrorMessage=T.getContractErrorMessage;exports.handleContractError=T.handleContractError;exports.isKnownContractError=T.isKnownContractError;exports.BitcoinScriptType=i.BitcoinScriptType;exports.applyChangeOutputPolicy=i.applyChangeOutputPolicy;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.computeChangeOutputFeeSats=i.computeChangeOutputFeeSats;exports.computeMaxDeposit=i.computeMaxDeposit;exports.computePeginBaseFeeSats=i.computePeginBaseFeeSats;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=i.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.UtxoNotAvailableError=l.UtxoNotAvailableError;exports.assertUtxosAvailable=l.assertUtxosAvailable;exports.collectReservedUtxoRefs=l.collectReservedUtxoRefs;exports.extractInputsFromTransaction=l.extractInputsFromTransaction;exports.selectUtxosForDeposit=l.selectUtxosForDeposit;exports.validateUtxosAvailable=l.validateUtxosAvailable;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.ServerIdentityError=t.ServerIdentityError;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.VpTokenRegistry=t.VpTokenRegistry;exports.batchPollByProvider=t.batchPollByProvider;exports.createAuthenticatedVpClient=t.createAuthenticatedVpClient;exports.primeVpTokenRegistry=t.primeVpTokenRegistry;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateOffchainParams=t.validateOffchainParams;exports.validatePegInConfiguration=t.validatePegInConfiguration;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.validateTBVProtocolParams=t.validateTBVProtocolParams;exports.verifyServerIdentity=t.verifyServerIdentity;exports.vpTokenRegistry=t.vpTokenRegistry;exports.DaemonStatus=o.DaemonStatus;exports.JSON_RPC_ERROR_CODES=o.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=o.JsonRpcClient;exports.JsonRpcError=o.JsonRpcError;exports.POST_WOTS_STATUSES=o.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=o.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=o.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=o.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_STATUSES=o.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=o.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=A.isWotsMismatchError;exports.parseFundingOutpointsFromTx=A.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/core/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as s, b as t, c as r } from "../../challengeAssert-
|
|
1
|
+
import { a as s, b as t, c as r } from "../../challengeAssert-D7OCrDIc.js";
|
|
2
2
|
import { computeMinClaimValue as i, deriveVaultId as n, expandAuthAnchor as u, expandHashlockSecret as l, expandWotsSeed as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
3
|
import { c as P, a as c, b as T, e as S, f as g } from "../../peginInput-CYJzbuwA.js";
|
|
4
4
|
import { a as m, b as R } from "../../noPayout-BhgknZBx.js";
|
|
5
|
-
import { P as _, a as x, c as f, b, d as v, e as I } from "../../assertPsbtUnsignedTxMatches-
|
|
5
|
+
import { P as _, a as x, c as f, b, d as v, e as I } from "../../assertPsbtUnsignedTxMatches-Dry5dTfl.js";
|
|
6
6
|
import { d as V, a as y, b as O, e as h, f as U, j as F, g as B, h as N, i as D, c as M, p as H, s as L, t as k, u as W, v as X } from "../../bitcoin-B5aNKtsk.js";
|
|
7
7
|
import { c as K } from "../../signing-DaLvGwQe.js";
|
|
8
8
|
import { B as Y, H as Z, K as J, M as j, T as z } from "../../validation-CxqROCno.js";
|
|
9
|
-
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "../../PeginManager-
|
|
10
|
-
import { P as ia, c as na, v as ua } from "../../PayoutManager-
|
|
9
|
+
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "../../PeginManager-HCYTUzh6.js";
|
|
10
|
+
import { P as ia, c as na, v as ua } from "../../PayoutManager-Cf51DBcu.js";
|
|
11
11
|
import { A as pa, P as da } from "../../ProtocolParams.abi-DXu8L0Fn.js";
|
|
12
12
|
import { B as ca } from "../../BTCVaultRegistry.abi-DbJ5lsFJ.js";
|
|
13
13
|
import { C as Sa, e as ga, g as Ea, h as ma, i as Ra } from "../../errors-CznAK5NB.js";
|
|
@@ -18,7 +18,7 @@ import { M as te, g as re, a as oe, b as ie, c as ne, d as ue, e as le, f as pe,
|
|
|
18
18
|
import { S as ce, V as Te, j as Se, k as ge, l as Ee, m as me, a as Re, d as Ae, b as _e, f as xe, p as fe, r as be, g as ve, h as Ie, v as Ce, i as Ve, c as ye, e as Oe } from "../../vault-registry-reader-Blhu9FW2.js";
|
|
19
19
|
import { D as Ue, b as Fe, J as Be, a as Ne, d as De, P as Me, R as He, e as Le, c as ke, V as We } from "../../types-TiIjyo2b.js";
|
|
20
20
|
import { i as we, p as Ke } from "../../errors-9AkghWyk.js";
|
|
21
|
-
import { B as Ye, C as Ze, p as Je, R as je, a as ze, n as qe, o as Qe, i as $e, m as as, l as es, j as ss, r as ts, b as rs, s as os, v as is, g as ns, h as us, d as ls, c as ps, e as ds, f as Ps, k as cs, w as Ts } from "../../buildAndBroadcastRefund-
|
|
21
|
+
import { B as Ye, C as Ze, p as Je, R as je, a as ze, n as qe, o as Qe, i as $e, m as as, l as es, j as ss, r as ts, b as rs, s as os, v as is, g as ns, h as us, d as ls, c as ps, e as ds, f as Ps, k as cs, w as Ts } from "../../buildAndBroadcastRefund-CI_x6OtX.js";
|
|
22
22
|
import { C as gs, P as Es, c as ms, g as Rs } from "../../peginState-CBAlxgXk.js";
|
|
23
23
|
export {
|
|
24
24
|
pa as ApplicationRegistryABI,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAcH,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAmB,MAAM,yBAAyB,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAG1E,OAAO,
|
|
1
|
+
{"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAcH,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,KA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;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,yBAAyB;IA6BjC;;;;;OAKG;IACG,qBAAqB,IAAI,OAAO,CAAC,YAAY,CAAC;IAyBpD;;;;;;;OAOG;YACW,yBAAyB;IAkBvC;;;;OAIG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;OAIG;IACH,uBAAuB,IAAI,OAAO;CAGnC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-CTznAVPT.cjs"),a=require("../../../PayoutManager-BfT0V-tm.cjs");exports.PeginManager=e.PeginManager;exports.PayoutManager=a.PayoutManager;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as e } from "../../../PeginManager-
|
|
2
|
-
import { P } from "../../../PayoutManager-
|
|
1
|
+
import { P as e } from "../../../PeginManager-HCYTUzh6.js";
|
|
2
|
+
import { P } from "../../../PayoutManager-Cf51DBcu.js";
|
|
3
3
|
export {
|
|
4
4
|
P as PayoutManager,
|
|
5
5
|
e as PeginManager
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../challengeAssert-CMb7r-je.cjs"),s=require("@babylonlabs-io/babylon-tbv-rust-wasm"),i=require("../../../peginInput-57FK2O99.cjs"),u=require("../../../noPayout-B6s8vrW6.cjs"),t=require("../../../assertPsbtUnsignedTxMatches-CagW7XqW.cjs"),e=require("../../../bitcoin-CHfKAhcI.cjs");exports.buildChallengeAssertPsbt=r.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=r.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=r.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>s.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>s.deriveVaultId});exports.buildPeginInputPsbt=i.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=i.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=i.buildPrePeginPsbt;exports.extractPeginInputSignature=i.extractPeginInputSignature;exports.finalizePeginInputPsbt=i.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=u.buildNoPayoutPsbt;exports.buildRefundPsbt=u.buildRefundPsbt;exports.PsbtSubstitutionError=t.PsbtSubstitutionError;exports.assertPayoutOutputMatchesRegistered=t.assertPayoutOutputMatchesRegistered;exports.assertPsbtUnsignedTxMatches=t.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=t.buildPayoutPsbt;exports.createPayoutScript=t.createPayoutScript;exports.extractPayoutSignature=t.extractPayoutSignature;exports.deriveBip86ScriptPubKeyHex=e.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.formatSatoshisToBtc=e.formatSatoshisToBtc;exports.getSortedXOnlyPubkeys=e.getSortedXOnlyPubkeys;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,8 +1,8 @@
|
|
|
1
|
-
import { a, b as t, c as r } from "../../../challengeAssert-
|
|
1
|
+
import { a, b as t, c as r } from "../../../challengeAssert-D7OCrDIc.js";
|
|
2
2
|
import { computeMinClaimValue as o, deriveVaultId as u } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
3
|
import { c as b, a as d, b as l, e as n, f as p } from "../../../peginInput-CYJzbuwA.js";
|
|
4
4
|
import { a as x, b as y } from "../../../noPayout-BhgknZBx.js";
|
|
5
|
-
import { P as f, a as m, c as S, b as h, d as v, e as T } from "../../../assertPsbtUnsignedTxMatches-
|
|
5
|
+
import { P as f, a as m, c as S, b as h, d as v, e as T } from "../../../assertPsbtUnsignedTxMatches-Dry5dTfl.js";
|
|
6
6
|
import { d as H, a as I, b as O, e as C, f as F, g as K, h as M, i as N, c as V, p as X, s as k, t as B, u as R, v as U } from "../../../bitcoin-B5aNKtsk.js";
|
|
7
7
|
export {
|
|
8
8
|
f as PsbtSubstitutionError,
|
|
@@ -72,8 +72,8 @@ export interface PayoutPsbtResult {
|
|
|
72
72
|
* @returns Unsigned PSBT ready for depositor to sign
|
|
73
73
|
*
|
|
74
74
|
* @throws If payout transaction does not have exactly 2 inputs
|
|
75
|
-
* @throws If input 0 does not
|
|
76
|
-
* @throws If input 1 does not
|
|
75
|
+
* @throws If input 0 does not spend PegIn:0 (vault UTXO)
|
|
76
|
+
* @throws If input 1 does not spend Assert:0 (proof output)
|
|
77
77
|
* @throws If previous output is not found for either input
|
|
78
78
|
*/
|
|
79
79
|
export declare function buildPayoutPsbt(params: PayoutParams): Promise<PayoutPsbtResult>;
|
|
@@ -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;AA2B/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,CAwI3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,MAAM,EACnB,4BAA4B,EAAE,MAAM,GACnC,IAAI,CAwBN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,EACvB,UAAU,SAAI,GACb,MAAM,CA+CR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../PayoutManager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../PayoutManager-BfT0V-tm.cjs"),t=require("../../../buildAndBroadcastRefund-Bj2e94CC.cjs"),e=require("../../../peginState-BijNNT15.cjs");exports.computeHashlock=a.computeHashlock;exports.validateSecretAgainstHashlock=a.validateSecretAgainstHashlock;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=t.RegisteredVaultVersionMismatchError;exports.activateVault=t.activateVault;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=t.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=t.validateOnChainParticipantKeys;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=t.verifyRegisteredVaultVersions;exports.waitForPeginStatus=t.waitForPeginStatus;exports.ContractStatus=e.ContractStatus;exports.PeginAction=e.PeginAction;exports.canPerformAction=e.canPerformAction;exports.getPeginProtocolState=e.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, v as e } from "../../../PayoutManager-
|
|
2
|
-
import { B as o, C as r, p as n, R as u, a as l, n as c, o as d, i as g, m, l as P, j as p, r as v, b as V, s as S, v as R, g as f, h, d as A, c as C, e as D, f as b, k as y, w as E } from "../../../buildAndBroadcastRefund-
|
|
1
|
+
import { c as s, v as e } from "../../../PayoutManager-Cf51DBcu.js";
|
|
2
|
+
import { B as o, C as r, p as n, R as u, a as l, n as c, o as d, i as g, m, l as P, j as p, r as v, b as V, s as S, v as R, g as f, h, d as A, c as C, e as D, f as b, k as y, w as E } from "../../../buildAndBroadcastRefund-CI_x6OtX.js";
|
|
3
3
|
import { C as F, P as M, c as w, g as x } from "../../../peginState-CBAlxgXk.js";
|
|
4
4
|
export {
|
|
5
5
|
o as BIP68NotMatureError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAndBroadcastRefund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/refund/buildAndBroadcastRefund.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"buildAndBroadcastRefund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/refund/buildAndBroadcastRefund.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AA0B3F,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAOnE;AAsBD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IA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C;IAChB,4EAA4E;IAC5E,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,oEAAoE;IACpE,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC/B,uCAAuC;IACvC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAqGD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,uBAAuB,CAC3C,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,EACjD,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAoFnC"}
|
package/dist/tbv/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../challengeAssert-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../challengeAssert-CMb7r-je.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),d=require("../peginInput-57FK2O99.cjs"),E=require("../noPayout-B6s8vrW6.cjs"),u=require("../assertPsbtUnsignedTxMatches-CagW7XqW.cjs"),r=require("../bitcoin-CHfKAhcI.cjs"),_=require("../signing-Bnsro0hE.cjs"),P=require("../validation-u8W7Lp2x.cjs"),n=require("../PeginManager-CTznAVPT.cjs"),g=require("../PayoutManager-BfT0V-tm.cjs"),R=require("../ProtocolParams.abi-BmvHwQJV.cjs"),m=require("../BTCVaultRegistry.abi-ZdPpION2.cjs"),T=require("../errors-BP73_stm.cjs"),i=require("../waitForTransactionReceiptSmartAware-tv1mtSIY.cjs"),a=require("../fundPeginTransaction-BBE3wTjR.cjs"),l=require("../reservation-hjXStM03.cjs"),s=require("../mempoolApi-YNkKjQCU.cjs"),t=require("../vault-registry-reader-7gOYnrQD.cjs"),o=require("../types-DnyyBNcC.cjs"),A=require("../errors-Bu0H-dZD.cjs"),e=require("../buildAndBroadcastRefund-Bj2e94CC.cjs"),p=require("../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=S.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=S.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=S.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>c.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>c.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>c.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>c.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>c.expandWotsSeed});exports.buildPeginInputPsbt=d.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=d.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=d.buildPrePeginPsbt;exports.extractPeginInputSignature=d.extractPeginInputSignature;exports.finalizePeginInputPsbt=d.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.PsbtSubstitutionError=u.PsbtSubstitutionError;exports.assertPayoutOutputMatchesRegistered=u.assertPayoutOutputMatchesRegistered;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=_.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.PeginManager=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.PayoutManager=g.PayoutManager;exports.computeHashlock=g.computeHashlock;exports.validateSecretAgainstHashlock=g.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=R.ApplicationRegistryABI;exports.ProtocolParamsABI=R.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=T.CONTRACT_ERRORS;exports.extractErrorData=T.extractErrorData;exports.getContractErrorMessage=T.getContractErrorMessage;exports.handleContractError=T.handleContractError;exports.isKnownContractError=T.isKnownContractError;exports.BitcoinScriptType=i.BitcoinScriptType;exports.applyChangeOutputPolicy=i.applyChangeOutputPolicy;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.computeChangeOutputFeeSats=i.computeChangeOutputFeeSats;exports.computeMaxDeposit=i.computeMaxDeposit;exports.computePeginBaseFeeSats=i.computePeginBaseFeeSats;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=i.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.UtxoNotAvailableError=l.UtxoNotAvailableError;exports.assertUtxosAvailable=l.assertUtxosAvailable;exports.collectReservedUtxoRefs=l.collectReservedUtxoRefs;exports.extractInputsFromTransaction=l.extractInputsFromTransaction;exports.selectUtxosForDeposit=l.selectUtxosForDeposit;exports.validateUtxosAvailable=l.validateUtxosAvailable;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.ServerIdentityError=t.ServerIdentityError;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.VpTokenRegistry=t.VpTokenRegistry;exports.batchPollByProvider=t.batchPollByProvider;exports.createAuthenticatedVpClient=t.createAuthenticatedVpClient;exports.primeVpTokenRegistry=t.primeVpTokenRegistry;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateOffchainParams=t.validateOffchainParams;exports.validatePegInConfiguration=t.validatePegInConfiguration;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.validateTBVProtocolParams=t.validateTBVProtocolParams;exports.verifyServerIdentity=t.verifyServerIdentity;exports.vpTokenRegistry=t.vpTokenRegistry;exports.DaemonStatus=o.DaemonStatus;exports.JSON_RPC_ERROR_CODES=o.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=o.JsonRpcClient;exports.JsonRpcError=o.JsonRpcError;exports.POST_WOTS_STATUSES=o.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=o.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=o.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=o.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_STATUSES=o.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=o.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=A.isWotsMismatchError;exports.parseFundingOutpointsFromTx=A.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as s, b as t, c as r } from "../challengeAssert-
|
|
1
|
+
import { a as s, b as t, c as r } from "../challengeAssert-D7OCrDIc.js";
|
|
2
2
|
import { computeMinClaimValue as i, deriveVaultId as n, expandAuthAnchor as u, expandHashlockSecret as l, expandWotsSeed as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
3
|
import { c as P, a as c, b as T, e as S, f as g } from "../peginInput-CYJzbuwA.js";
|
|
4
4
|
import { a as m, b as R } from "../noPayout-BhgknZBx.js";
|
|
5
|
-
import { P as _, a as x, c as f, b, d as v, e as I } from "../assertPsbtUnsignedTxMatches-
|
|
5
|
+
import { P as _, a as x, c as f, b, d as v, e as I } from "../assertPsbtUnsignedTxMatches-Dry5dTfl.js";
|
|
6
6
|
import { d as V, a as y, b as O, e as h, f as U, j as F, g as B, h as N, i as D, c as M, p as H, s as L, t as k, u as W, v as X } from "../bitcoin-B5aNKtsk.js";
|
|
7
7
|
import { c as K } from "../signing-DaLvGwQe.js";
|
|
8
8
|
import { B as Y, H as Z, K as J, M as j, T as z } from "../validation-CxqROCno.js";
|
|
9
|
-
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "../PeginManager-
|
|
10
|
-
import { P as ia, c as na, v as ua } from "../PayoutManager-
|
|
9
|
+
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "../PeginManager-HCYTUzh6.js";
|
|
10
|
+
import { P as ia, c as na, v as ua } from "../PayoutManager-Cf51DBcu.js";
|
|
11
11
|
import { A as pa, P as da } from "../ProtocolParams.abi-DXu8L0Fn.js";
|
|
12
12
|
import { B as ca } from "../BTCVaultRegistry.abi-DbJ5lsFJ.js";
|
|
13
13
|
import { C as Sa, e as ga, g as Ea, h as ma, i as Ra } from "../errors-CznAK5NB.js";
|
|
@@ -18,7 +18,7 @@ import { M as te, g as re, a as oe, b as ie, c as ne, d as ue, e as le, f as pe,
|
|
|
18
18
|
import { S as ce, V as Te, j as Se, k as ge, l as Ee, m as me, a as Re, d as Ae, b as _e, f as xe, p as fe, r as be, g as ve, h as Ie, v as Ce, i as Ve, c as ye, e as Oe } from "../vault-registry-reader-Blhu9FW2.js";
|
|
19
19
|
import { D as Ue, b as Fe, J as Be, a as Ne, d as De, P as Me, R as He, e as Le, c as ke, V as We } from "../types-TiIjyo2b.js";
|
|
20
20
|
import { i as we, p as Ke } from "../errors-9AkghWyk.js";
|
|
21
|
-
import { B as Ye, C as Ze, p as Je, R as je, a as ze, n as qe, o as Qe, i as $e, m as as, l as es, j as ss, r as ts, b as rs, s as os, v as is, g as ns, h as us, d as ls, c as ps, e as ds, f as Ps, k as cs, w as Ts } from "../buildAndBroadcastRefund-
|
|
21
|
+
import { B as Ye, C as Ze, p as Je, R as je, a as ze, n as qe, o as Qe, i as $e, m as as, l as es, j as ss, r as ts, b as rs, s as os, v as is, g as ns, h as us, d as ls, c as ps, e as ds, f as Ps, k as cs, w as Ts } from "../buildAndBroadcastRefund-CI_x6OtX.js";
|
|
22
22
|
import { C as gs, P as Es, c as ms, g as Rs } from "../peginState-CBAlxgXk.js";
|
|
23
23
|
export {
|
|
24
24
|
pa as ApplicationRegistryABI,
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var Ut=Object.defineProperty;var Vt=(n,t,e)=>t in n?Ut(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var T=(n,t,e)=>Vt(n,typeof t!="symbol"?t+"":t,e);const P=require("./sha2-DsrLC4NM.cjs"),K=require("bitcoinjs-lib"),Y=require("buffer"),C=require("viem"),$=require("./BTCVaultRegistry.abi-ZdPpION2.cjs"),H=require("./errors-BP73_stm.cjs"),L=require("@babylonlabs-io/babylon-tbv-rust-wasm"),R=require("./peginInput-57FK2O99.cjs"),u=require("./bitcoin-CHfKAhcI.cjs"),Nt=require("./signing-Bnsro0hE.cjs"),st=require("./validation-u8W7Lp2x.cjs"),Lt=require("./PayoutManager-BxAY2x0g.cjs"),S=require("./waitForTransactionReceiptSmartAware-tv1mtSIY.cjs"),ot=require("./fundPeginTransaction-BBE3wTjR.cjs"),pt=require("./mempoolApi-YNkKjQCU.cjs");function Wt(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const mt=Wt(K),W=BigInt(2**32-1),it=BigInt(32);function Ft(n,t=!1){return t?{h:Number(n&W),l:Number(n>>it&W)}:{h:Number(n>>it&W)|0,l:Number(n&W)|0}}function Mt(n,t=!1){const e=n.length;let r=new Uint32Array(e),s=new Uint32Array(e);for(let o=0;o<e;o++){const{h:i,l:a}=Ft(n[o],t);[r[o],s[o]]=[i,a]}return[r,s]}const Xt=(n,t,e)=>n<<e|t>>>32-e,Kt=(n,t,e)=>t<<e|n>>>32-e,Dt=(n,t,e)=>t<<e-32|n>>>64-e,qt=(n,t,e)=>n<<e-32|t>>>64-e,zt=106,jt=32,at=34;function Gt(n,t,e){const r=u.stripHexPrefix(n),s=mt.Transaction.fromHex(r);if(s.outs.length<=t)throw new Error(`Pre-PegIn auth-anchor OP_RETURN missing: tx has ${s.outs.length} outputs, expected at least ${t+1} (vault outputs + OP_RETURN)`);const o=s.outs[t],i=o.script;if(i.length!==at||i[0]!==zt||i[1]!==jt)throw new Error(`Pre-PegIn auth-anchor OP_RETURN at vout ${t} has unexpected script encoding (got ${i.length}-byte script with prefix 0x${i.slice(0,Math.min(2,i.length)).toString("hex")}; expected ${at}-byte OP_RETURN + PUSH32 layout)`);const a=i.slice(2).toString("hex").toLowerCase();if(a!==e.toLowerCase())throw new Error(`Pre-PegIn auth-anchor OP_RETURN payload mismatch at vout ${t}: tx pushes ${a}, expected ${e}`);if(o.value!==0)throw new Error(`Pre-PegIn auth-anchor OP_RETURN at vout ${t} has non-zero value ${o.value}; OP_RETURN outputs must be 0-value`)}const N=32,j=32,J=36,Pt=32,D=4,Zt=D+N+D+Pt;function tt(n,t,e){n[t]=e>>>24&255,n[t+1]=e>>>16&255,n[t+2]=e>>>8&255,n[t+3]=e&255}function Qt(n){if(n.txid.length!==j)throw new Error(`outpoint.txid must be exactly ${j} bytes, got ${n.txid.length}`);if(!Number.isInteger(n.vout)||n.vout<0||n.vout>4294967295)throw new Error(`outpoint.vout must be a u32, got ${n.vout}`);const t=new Uint8Array(J);return t.set(n.txid,0),tt(t,j,n.vout),t}function ct(n,t){const e=Math.min(n.length,t.length);for(let r=0;r<e;r++)if(n[r]!==t[r])return n[r]-t[r];return n.length-t.length}function xt(n){if(n.length===0)throw new Error("buildFundingOutpointsCommitment: outpoints must be non-empty");const t=n.map(Qt);t.sort(ct);for(let r=1;r<t.length;r++)if(ct(t[r-1],t[r])===0)throw new Error("buildFundingOutpointsCommitment: duplicate outpoint detected");const e=new Uint8Array(t.length*J);for(let r=0;r<t.length;r++)e.set(t[r],r*J);return P.sha256(e)}function wt(n){if(n.depositorBtcPubkey.length!==N)throw new Error(`vaultContext: depositorBtcPubkey must be exactly ${N} bytes, got ${n.depositorBtcPubkey.length}`);const t=xt(n.fundingOutpoints),e=new Uint8Array(Zt);let r=0;return tt(e,r,N),r+=D,e.set(n.depositorBtcPubkey,r),r+=N,tt(e,r,Pt),r+=D,e.set(t,r),e}const bt="babylon-btc-vault",yt=32,lt=yt*2,Yt=/^[0-9a-f]+$/;async function kt(n,t){const e=wt(t),r=u.uint8ArrayToHex(e),s=await n.deriveContextHash(bt,r);if(typeof s!="string")throw new Error(`deriveVaultRoot: wallet must return a string, got ${typeof s}`);if(s.length!==lt)throw new Error(`deriveVaultRoot: wallet must return a ${lt}-character hex string (${yt} bytes), got length ${s.length}`);if(!Yt.test(s))throw new Error("deriveVaultRoot: wallet must return lowercase hex per derive-context-hash.md §2.1; got value with non-lowercase or non-hex characters");return u.hexToUint8Array(s)}const Jt=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Et=Uint8Array.from(new Array(16).fill(0).map((n,t)=>t)),te=Et.map(n=>(9*n+5)%16),Tt=(()=>{const e=[[Et],[te]];for(let r=0;r<4;r++)for(let s of e)s.push(s[r].map(o=>Jt[o]));return e})(),_t=Tt[0],Bt=Tt[1],vt=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(n=>Uint8Array.from(n)),ee=_t.map((n,t)=>n.map(e=>vt[t][e])),ne=Bt.map((n,t)=>n.map(e=>vt[t][e])),re=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),se=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function ut(n,t,e,r){return n===0?t^e^r:n===1?t&e|~t&r:n===2?(t|~e)^r:n===3?t&r|e&~r:t^(e|~r)}const F=new Uint32Array(16);class oe extends P.HashMD{constructor(){super(64,20,8,!0);T(this,"h0",1732584193);T(this,"h1",-271733879);T(this,"h2",-1732584194);T(this,"h3",271733878);T(this,"h4",-1009589776)}get(){const{h0:e,h1:r,h2:s,h3:o,h4:i}=this;return[e,r,s,o,i]}set(e,r,s,o,i){this.h0=e|0,this.h1=r|0,this.h2=s|0,this.h3=o|0,this.h4=i|0}process(e,r){for(let g=0;g<16;g++,r+=4)F[g]=e.getUint32(r,!0);let s=this.h0|0,o=s,i=this.h1|0,a=i,c=this.h2|0,h=c,l=this.h3|0,x=l,w=this.h4|0,b=w;for(let g=0;g<5;g++){const f=4-g,_=re[g],A=se[g],p=_t[g],k=Bt[g],E=ee[g],m=ne[g];for(let y=0;y<16;y++){const d=P.rotl(s+ut(g,i,c,l)+F[p[y]]+_,E[y])+w|0;s=w,w=l,l=P.rotl(c,10)|0,c=i,i=d}for(let y=0;y<16;y++){const d=P.rotl(o+ut(f,a,h,x)+F[k[y]]+A,m[y])+b|0;o=b,b=x,x=P.rotl(h,10)|0,h=a,a=d}}this.set(this.h1+c+x|0,this.h2+l+b|0,this.h3+w+o|0,this.h4+s+a|0,this.h0+i+h|0)}roundClean(){P.clean(F)}destroy(){this.destroyed=!0,P.clean(this.buffer),this.set(0,0,0,0,0)}}const ie=P.createHasher(()=>new oe),ae=BigInt(0),U=BigInt(1),ce=BigInt(2),le=BigInt(7),ue=BigInt(256),he=BigInt(113),At=[],It=[],St=[];for(let n=0,t=U,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],At.push(2*(5*r+e)),It.push((n+1)*(n+2)/2%64);let s=ae;for(let o=0;o<7;o++)t=(t<<U^(t>>le)*he)%ue,t&ce&&(s^=U<<(U<<BigInt(o))-U);St.push(s)}const Ht=Mt(St,!0),de=Ht[0],ge=Ht[1],ht=(n,t,e)=>e>32?Dt(n,t,e):Xt(n,t,e),dt=(n,t,e)=>e>32?qt(n,t,e):Kt(n,t,e);function fe(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)e[i]=n[i]^n[i+10]^n[i+20]^n[i+30]^n[i+40];for(let i=0;i<10;i+=2){const a=(i+8)%10,c=(i+2)%10,h=e[c],l=e[c+1],x=ht(h,l,1)^e[a],w=dt(h,l,1)^e[a+1];for(let b=0;b<50;b+=10)n[i+b]^=x,n[i+b+1]^=w}let s=n[2],o=n[3];for(let i=0;i<24;i++){const a=It[i],c=ht(s,o,a),h=dt(s,o,a),l=At[i];s=n[l],o=n[l+1],n[l]=c,n[l+1]=h}for(let i=0;i<50;i+=10){for(let a=0;a<10;a++)e[a]=n[i+a];for(let a=0;a<10;a++)n[i+a]^=~e[(a+2)%10]&e[(a+4)%10]}n[0]^=de[r],n[1]^=ge[r]}P.clean(e)}class nt{constructor(t,e,r,s=!1,o=24){T(this,"state");T(this,"pos",0);T(this,"posOut",0);T(this,"finished",!1);T(this,"state32");T(this,"destroyed",!1);T(this,"blockLen");T(this,"suffix");T(this,"outputLen");T(this,"enableXOF",!1);T(this,"rounds");if(this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=s,this.rounds=o,P.anumber(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=P.u32(this.state)}clone(){return this._cloneInto()}keccak(){P.swap32IfBE(this.state32),fe(this.state32,this.rounds),P.swap32IfBE(this.state32),this.posOut=0,this.pos=0}update(t){P.aexists(this),P.abytes(t);const{blockLen:e,state:r}=this,s=t.length;for(let o=0;o<s;){const i=Math.min(e-this.pos,s-o);for(let a=0;a<i;a++)r[this.pos++]^=t[o++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:s}=this;t[r]^=e,(e&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){P.aexists(this,!1),P.abytes(t),this.finish();const e=this.state,{blockLen:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,o-s);t.set(e.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return P.anumber(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(P.aoutput(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,P.clean(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:s,rounds:o,enableXOF:i}=this;return t||(t=new nt(e,r,s,i,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=s,t.enableXOF=i,t.destroyed=this.destroyed,t}}const pe=(n,t,e,r={})=>P.createHasher(()=>new nt(t,n,e),r),me=pe(1,136,32),gt=64,B=20,et=4,Rt=2,Pe=0,xe=1,M=[64,64],we=n=>Array.from(n).map(t=>t.toString(16).padStart(2,"0")).join("");function rt(n){return ie(P.sha256(n))}function Ot(n){return(1<<n)-1}function be(n){let t=1;for(;t*t<n+1;)t++;return Math.max(t,2)}function ye(n){const t=et,e=n*Ot(t);return{d:t,n,checksum_radix:be(e)}}function G(n,t){const e=[];let r=t;for(;r>0;)e.push(r&255),r>>>=8;const s=new Uint8Array(n.length+e.length);s.set(n);for(let o=0;o<e.length;o++)s[n.length+o]=e[o];return rt(s)}function Z(n,t){let e=n;for(let r=0;r<t;r++)e=rt(e);return e}function ke(n,t){const e=Ot(t.d),r=t.checksum_radix-1,s=Math.floor(t.n*e/t.checksum_radix),o=[];for(let l=0;l<t.n;l++){const x=G(n,l+Rt),w=Z(x,e);o.push(Array.from(w))}const i=G(n,Pe),a=Z(i,r),c=G(n,xe),h=Z(c,s);return{config:t,message_terminals:o,checksum_major_terminal:Array.from(h),checksum_minor_terminal:Array.from(a)}}async function Ct(n){try{if(n.length!==gt)throw new Error(`WOTS seed must be exactly ${gt} bytes, got ${n.length}`);const t=[];for(let e=0;e<M.length;e++){const r=M[e],s=ye(r),o=new Uint8Array(n.length+1);o.set(n),o[n.length]=e;const i=rt(o);try{const a=ke(i,s);if(a.config.d!==et)throw new Error(`Block ${e}: expected d=${et}, got d=${a.config.d}`);if(a.config.n!==r)throw new Error(`Block ${e}: expected n=${r}, got n=${a.config.n}`);if(a.message_terminals.length!==r)throw new Error(`Block ${e}: expected ${r} message terminals, got ${a.message_terminals.length}`);for(let c=0;c<a.message_terminals.length;c++)if(a.message_terminals[c].length!==B)throw new Error(`Block ${e} terminal ${c}: expected ${B} bytes, got ${a.message_terminals[c].length}`);if(a.checksum_minor_terminal.length!==B)throw new Error(`Block ${e} checksum_minor: expected ${B} bytes`);if(a.checksum_major_terminal.length!==B)throw new Error(`Block ${e} checksum_major: expected ${B} bytes`);t.push(a)}finally{o.fill(0),i.fill(0)}}if(t.length!==M.length)throw new Error(`Expected ${M.length} blocks, got ${t.length}`);return t}finally{n.fill(0)}}function Q(n,t,e){if(n.length!==B)throw new Error(`Block ${t} ${e}: expected ${B} bytes, got ${n.length}`);for(let r=0;r<n.length;r++){const s=n[r];if(!Number.isInteger(s)||s<0||s>255)throw new Error(`Block ${t} ${e}[${r}]: invalid byte value ${s}`)}}function $t(n){if(n.length===0)throw new Error("Public keys array must not be empty");for(let o=0;o<n.length;o++){const i=n[o];Q(i.checksum_minor_terminal,o,"checksum_minor_terminal"),Q(i.checksum_major_terminal,o,"checksum_major_terminal");for(let a=0;a<i.message_terminals.length;a++)Q(i.message_terminals[a],o,`message_terminal[${a}]`)}let t=0;for(const o of n)t+=Rt+o.message_terminals.length;const e=new Uint8Array(t*B);let r=0;for(const o of n){e.set(o.checksum_minor_terminal,r),r+=B,e.set(o.checksum_major_terminal,r),r+=B;for(const i of o.message_terminals)e.set(i,r),r+=B}const s=me(e);return`0x${we(s)}`}async function Ee(n,t){const e=[],r=[],s=[],o=[];try{for(let i=0;i<t;i++){const a=await L.expandWotsSeed(n,i);try{const h=await Ct(a);e.push(h),r.push($t(h))}finally{a.fill(0)}const c=await L.expandHashlockSecret(n,i);try{const h=u.uint8ArrayToHex(c);s.push(h),o.push(Lt.computeHashlock(u.ensureHexPrefix(h)).slice(2))}finally{c.fill(0)}}}finally{n.fill(0)}return{perVaultWotsKeys:e,wotsPkHashes:r,htlcSecretHexes:s,hashlocks:o}}const Te=/^0x[0-9a-f]+$/i,_e=/^[0-9a-f]+$/i,Be=/^[A-Za-z0-9+/]+={0,2}$/;function V(n){if(typeof n!="string"||n.length===0)throw new Error("BTC wallet returned empty public key");return u.processPublicKeyToXOnly(n).toLowerCase()}function ve(n){if(typeof n!="string"||n.length===0)throw new Error("BTC wallet returned empty BIP-322 signature");if(n.startsWith("0x")||n.startsWith("0X")){if(!Te.test(n)||n.length<4||n.length%2!==0)throw new Error("BTC wallet returned malformed hex BIP-322 signature");return n.toLowerCase()}if(_e.test(n)){if(n.length%2!==0)throw new Error("BTC wallet returned malformed hex BIP-322 signature");return`0x${n.toLowerCase()}`}if(!Be.test(n)||n.length%4!==0)throw new Error("BTC wallet returned malformed base64 BIP-322 signature");const t=Y.Buffer.from(n,"base64");if(t.length===0||t.toString("base64")!==n)throw new Error("BTC wallet returned malformed base64 BIP-322 signature");return`0x${t.toString("hex")}`}async function Ae(n,t,e){if(typeof n.signPsbts=="function"){const s=await n.signPsbts(t,e);if(s.length!==t.length)throw new Error(`Expected ${t.length} signed PSBTs but received ${s.length}`);return s}const r=[];for(let s=0;s<t.length;s++){const o=await n.signPsbt(t[s],e[s]);r.push(o)}return r}const Ie=0,X="00".repeat(32);function Se(n,t,e,r){const s=e==null?void 0:e[`${n}:${t}`];return s?Promise.resolve({txid:n,vout:t,value:s.value,scriptPubKey:s.scriptPubKey}):pt.getUtxoInfo(n,t,r)}const ft=12e4;class He{constructor(t){T(this,"config");this.config=t}async preparePegin(t){if(t.amounts.length===0)throw new Error("amounts must contain at least one entry");const e=await this.config.btcWallet.getPublicKeyHex(),r=V(e);if(!u.isAddressFromPublicKey(t.changeAddress,e,this.config.btcNetwork))throw new Error(`Pre-PegIn changeAddress "${t.changeAddress}" is not derived from the connected wallet's public key. Refusing to build a tx that would send change to an address the signing key doesn't control.`);const s=await this.prepareSizing(r,t),o=s.selectedUTXOs.map(f=>({txid:u.hexToUint8Array(f.txid),vout:f.vout})),i=await kt(this.config.btcWallet,{depositorBtcPubkey:u.hexToUint8Array(r),fundingOutpoints:o});let a,c;try{const f=await L.expandAuthAnchor(i);try{a=u.uint8ArrayToHex(f),c=u.uint8ArrayToHex(P.sha256(f))}finally{f.fill(0)}}catch(f){throw i.fill(0),f}const h=await Ee(i,t.amounts.length),{perVaultWotsKeys:l,wotsPkHashes:x,htlcSecretHexes:w,hashlocks:b}=h,g=await this.preparePeginCommit({depositorBtcPubkeyRaw:e,depositorBtcPubkey:r,hashlocks:b,authAnchorHash:c,sizing:s,params:t});for(let f=0;f<g.perVault.length;f++)if(g.perVault[f].htlcVout!==f)throw new Error(`Internal invariant violation: htlcVout/index mismatch at vault ${f} (expected ${f}, got ${g.perVault[f].htlcVout})`);return Gt(g.fundedPrePeginTxHex,t.amounts.length,c),{transaction:{...g,selectedUTXOs:s.selectedUTXOs,fee:s.fee,changeAmount:s.changeAmount},depositorBtcPubkey:r,derivedSecrets:{perVaultWotsKeys:l,wotsPkHashes:x,htlcSecretHexes:w,authAnchorHex:a}}}async prepareSizing(t,e){const r=e.amounts.map(()=>X),s=e.vaultKeeperBtcPubkeys.length,o=await R.buildPrePeginPsbt({depositorPubkey:t,vaultProviderPubkey:u.stripHexPrefix(e.vaultProviderBtcPubkey),vaultKeeperPubkeys:e.vaultKeeperBtcPubkeys.map(u.stripHexPrefix),universalChallengerPubkeys:e.universalChallengerBtcPubkeys.map(u.stripHexPrefix),hashlocks:r,timelockRefund:e.timelockRefund,pegInAmounts:e.amounts,feeRate:e.protocolFeeRate,numLocalChallengers:s,councilQuorum:e.councilQuorum,councilSize:e.councilSize,network:this.config.btcNetwork,authAnchorHash:X}),i=S.selectUtxosForPegin([...e.availableUTXOs],o.totalOutputValue,e.mempoolFeeRate,ot.peginOutputCount(o.htlcValues.length,X));return{selectedUTXOs:i.selectedUTXOs,fee:i.fee,changeAmount:i.changeAmount}}async preparePeginCommit(t){const{depositorBtcPubkeyRaw:e,depositorBtcPubkey:r,hashlocks:s,authAnchorHash:o,sizing:i,params:a}=t,c=X.toLowerCase();for(let d=0;d<s.length;d++)if(s[d].toLowerCase()===c)throw new Error(`preparePeginCommit refusing to build with sizing-pass placeholder hashlock at vault ${d} — internal substitution bug`);if(o.toLowerCase()===c)throw new Error("preparePeginCommit refusing to build with sizing-pass placeholder auth-anchor hash — internal substitution bug");const h=u.stripHexPrefix(a.vaultProviderBtcPubkey),l=a.vaultKeeperBtcPubkeys.map(u.stripHexPrefix),x=a.universalChallengerBtcPubkeys.map(u.stripHexPrefix),w=l.length,b={depositorPubkey:r,vaultProviderPubkey:h,vaultKeeperPubkeys:l,universalChallengerPubkeys:x,hashlocks:s,timelockRefund:a.timelockRefund,pegInAmounts:a.amounts,feeRate:a.protocolFeeRate,numLocalChallengers:w,councilQuorum:a.councilQuorum,councilSize:a.councilSize,network:this.config.btcNetwork,authAnchorHash:o},g=await R.buildPrePeginPsbt(b),f=u.getNetwork(this.config.btcNetwork),_=ot.fundPeginTransaction({unfundedTxHex:g.psbtHex,selectedUTXOs:i.selectedUTXOs,changeAddress:a.changeAddress,changeAmount:i.changeAmount,network:f}),A=u.stripHexPrefix(S.calculateBtcTxHash(_)),p=[],k=[],E=[];for(let d=0;d<s.length;d++){const I=await R.buildPeginTxFromFundedPrePegin({prePeginParams:b,timelockPegin:a.timelockPegin,fundedPrePeginTxHex:_,htlcVout:d}),v=await R.buildPeginInputPsbt({peginTxHex:I.txHex,fundedPrePeginTxHex:_,depositorPubkey:r,vaultProviderPubkey:h,vaultKeeperPubkeys:l,universalChallengerPubkeys:x,hashlock:s[d],timelockRefund:a.timelockRefund,network:this.config.btcNetwork});p.push(I),k.push(v.psbtHex),E.push(Nt.createTaprootScriptPathSignOptions(e,1))}const m=await Ae(this.config.btcWallet,k,E),y=[];for(let d=0;d<m.length;d++){const I=R.extractPeginInputSignature(m[d],r),v=R.finalizePeginInputPsbt(m[d]);y.push({htlcVout:d,htlcValue:g.htlcValues[d],peginTxHex:v,peginTxid:p[d].txid,peginInputSignature:I,vaultScriptPubKey:p[d].vaultScriptPubKey})}return{fundedPrePeginTxHex:_,prePeginTxid:A,perVault:y}}async signAndBroadcast(t){const{fundedPrePeginTxHex:e,depositorBtcPubkey:r}=t,s=e.startsWith("0x")?e.slice(2):e,o=K.Transaction.fromHex(s);if(o.ins.length===0)throw new Error("Transaction has no inputs");const i=new K.Psbt;i.setVersion(o.version),i.setLocktime(o.locktime);const a=Y.Buffer.from(V(r),"hex"),c=this.config.mempoolApiUrl,h=o.ins.map(p=>{const k=Y.Buffer.from(p.hash).reverse().toString("hex"),E=p.index;return Se(k,E,t.localPrevouts,c).then(m=>({input:p,utxoData:m,txid:k,vout:E}))}),l=await Promise.all(h),x=l.reduce((p,k)=>p+BigInt(k.utxoData.value),0n),w=o.outs.reduce((p,k)=>p+BigInt(k.value),0n);if(x<w)throw new Error(`UTXO value mismatch: total input value (${x} sat) is less than total output value (${w} sat). This may indicate the mempool API returned manipulated UTXO data.`);const b=x-w;if(b>st.MAX_REASONABLE_FEE_SATS)throw new Error(`Implied transaction fee (${b} sat) exceeds maximum reasonable fee (${st.MAX_REASONABLE_FEE_SATS} sat). This may indicate manipulated UTXO data.`);for(const{input:p,utxoData:k,txid:E,vout:m}of l){const y=S.getPsbtInputFields({value:k.value,scriptPubKey:k.scriptPubKey},a);i.addInput({hash:p.hash,index:p.index,sequence:p.sequence,...y})}for(const p of o.outs)i.addOutput({script:p.script,value:p.value});const g=await this.config.btcWallet.signPsbt(i.toHex()),f=K.Psbt.fromHex(g);try{f.finalizeAllInputs()}catch(p){if(!f.data.inputs.every(E=>E.finalScriptWitness||E.finalScriptSig))throw new Error(`PSBT finalization failed and wallet did not auto-finalize: ${p}`)}const _=f.extractTransaction().toHex();return await pt.pushTx(_,c)}async registerPeginOnChain(t){const{unsignedPrePeginTx:e,depositorSignedPeginTx:r,vaultProvider:s,hashlock:o,htlcVout:i,depositorPayoutBtcAddress:a,depositorWotsPkHash:c,popSignature:h}=t;if(!this.config.ethWallet.account)throw new Error("Ethereum wallet account not found");const l=this.config.ethWallet.account.address;if(!C.isAddressEqual(h.depositorEthAddress,l))throw new Error(`Proof of possession was signed for ${h.depositorEthAddress} but the Ethereum wallet is currently connected to ${l}. Reconnect the original account or call signProofOfPossession() again.`);const x=await this.assertPopMatchesBtcWallet(h),w=h.btcPopSignature,b=u.ensureHexPrefix(h.depositorBtcPubkey),g=u.ensureHexPrefix(e),f=u.ensureHexPrefix(r),_=a??await this.config.btcWallet.getAddress(),A=this.resolvePayoutScriptPubKey(x,_),p=S.calculateBtcTxHash(f),k=await L.deriveVaultId(u.stripHexPrefix(p),u.stripHexPrefix(l)),E=u.ensureHexPrefix(k);if(await this.checkVaultExists(E))throw new Error(`Vault already exists (ID: ${E}, peginTxHash: ${p}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`);const y=this.config.publicClient;let d;try{d=await y.readContract({address:this.config.vaultContracts.btcVaultRegistry,abi:$.BTCVaultRegistryABI,functionName:"getPegInFee",args:[s]})}catch(O){throw new Error("Failed to query pegin fee from the contract. Please check your network connection and that the contract address is correct.",{cause:O})}const I=C.encodeFunctionData({abi:$.BTCVaultRegistryABI,functionName:"submitPeginRequest",args:[l,b,w,g,f,s,o,i,A,c]});let v;try{v=await y.estimateGas({to:this.config.vaultContracts.btcVaultRegistry,data:I,value:d,account:this.config.ethWallet.account.address})}catch(O){H.handleContractError(O)}let q;try{q=await this.config.ethWallet.sendTransaction({to:this.config.vaultContracts.btcVaultRegistry,data:I,value:d,account:this.config.ethWallet.account,chain:this.config.ethChain,gas:v})}catch(O){H.handleContractError(O)}const z=await S.waitForTransactionReceiptSmartAware({publicClient:y,walletAddress:this.config.ethWallet.account.address,hash:q,timeout:ft});return z.status==="reverted"&&H.handleContractError(new Error(`Transaction reverted. Hash: ${z.transactionHash}. Check the transaction on block explorer for details.`)),{ethTxHash:z.transactionHash,vaultId:E,peginTxHash:p}}async registerPeginBatchOnChain(t){const{vaultProvider:e,unsignedPrePeginTx:r,requests:s,popSignature:o}=t;if(s.length===0)throw new Error("Batch pegin requires at least one request");if(!this.config.ethWallet.account)throw new Error("Ethereum wallet account not found");const i=this.config.ethWallet.account.address;if(!C.isAddressEqual(o.depositorEthAddress,i))throw new Error(`Proof of possession was signed for ${o.depositorEthAddress} but the Ethereum wallet is currently connected to ${i}. Reconnect the original account or call signProofOfPossession() again.`);const a=await this.assertPopMatchesBtcWallet(o),c=o.btcPopSignature,h=s.map(m=>this.resolvePayoutScriptPubKey(a,m.depositorPayoutBtcAddress)),l=[];for(const m of s){const y=u.ensureHexPrefix(m.depositorSignedPeginTx),d=S.calculateBtcTxHash(y),I=await L.deriveVaultId(u.stripHexPrefix(d),u.stripHexPrefix(i)),v=u.ensureHexPrefix(I);if(await this.checkVaultExists(v))throw new Error(`Vault already exists (ID: ${v}, peginTxHash: ${d}). To create a new vault, use different UTXOs or a different amount.`);l.push({vaultId:v,peginTxHash:d})}const x=this.config.publicClient;let w;try{w=await x.readContract({address:this.config.vaultContracts.btcVaultRegistry,abi:$.BTCVaultRegistryABI,functionName:"getPegInFee",args:[e]})}catch(m){throw new Error("Failed to query pegin fee from the contract. Please check your network connection and that the contract address is correct.",{cause:m})}const b=w*BigInt(s.length),g=u.ensureHexPrefix(o.depositorBtcPubkey),f=u.ensureHexPrefix(r),_=s.map((m,y)=>({depositorBtcPubKey:g,btcPopSignature:c,unsignedPrePeginTx:f,depositorSignedPeginTx:u.ensureHexPrefix(m.depositorSignedPeginTx),hashlock:m.hashlock,htlcVout:m.htlcVout,referralCode:Ie,depositorPayoutBtcAddress:h[y],depositorWotsPkHash:m.depositorWotsPkHash})),A=C.encodeFunctionData({abi:$.BTCVaultRegistryABI,functionName:"submitPeginRequestBatch",args:[i,e,_]});let p;try{p=await x.estimateGas({to:this.config.vaultContracts.btcVaultRegistry,data:A,value:b,account:this.config.ethWallet.account.address})}catch(m){H.handleContractError(m)}let k;try{k=await this.config.ethWallet.sendTransaction({to:this.config.vaultContracts.btcVaultRegistry,data:A,value:b,account:this.config.ethWallet.account,chain:this.config.ethChain,gas:p})}catch(m){H.handleContractError(m)}const E=await S.waitForTransactionReceiptSmartAware({publicClient:x,walletAddress:this.config.ethWallet.account.address,hash:k,timeout:ft});return E.status==="reverted"&&H.handleContractError(new Error(`Batch transaction reverted. Hash: ${E.transactionHash}. Check the transaction on block explorer for details.`)),{ethTxHash:E.transactionHash,vaults:l}}async checkVaultExists(t){return(await this.config.publicClient.readContract({address:this.config.vaultContracts.btcVaultRegistry,abi:$.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[t]})).depositor!==C.zeroAddress}resolvePayoutScriptPubKey(t,e){if(!u.isAddressFromPublicKey(e,t,this.config.btcNetwork))throw new Error(`BTC payout address "${e}" is not derived from the connected wallet's public key. The payout sink must be controlled by the same key that signs the pegin; refusing to register a mismatched address.`);const r=u.getNetwork(this.config.btcNetwork);try{return`0x${mt.address.toOutputScript(e,r).toString("hex")}`}catch{throw new Error(`Invalid BTC payout address: "${e}". Please provide a valid Bitcoin address for the ${this.config.btcNetwork} network.`)}}async signProofOfPossession(){if(!this.config.ethWallet.account)throw new Error("Ethereum wallet account not found");const t=this.config.ethWallet.account.address,e=V(await this.config.btcWallet.getPublicKeyHex()),r=this.config.vaultContracts.btcVaultRegistry,s=`${t.toLowerCase()}:${this.config.ethChain.id}:pegin:${r.toLowerCase()}`,o=await this.config.btcWallet.signMessage(s,"bip322-simple");return{btcPopSignature:ve(o),depositorEthAddress:t,depositorBtcPubkey:e}}async assertPopMatchesBtcWallet(t){const e=await this.config.btcWallet.getPublicKeyHex(),r=V(e),s=V(t.depositorBtcPubkey);if(r!==s)throw new Error(`Proof of possession was signed with BTC pubkey ${s} but the BTC wallet is currently connected to ${r}. Reconnect the original wallet or call signProofOfPossession() again.`);return e}getNetwork(){return this.config.btcNetwork}getVaultContractAddress(){return this.config.vaultContracts.btcVaultRegistry}}exports.PeginManager=He;exports.VAULT_APP_NAME=bt;exports.buildFundingOutpointsCommitment=xt;exports.buildVaultContext=wt;exports.computeWotsBlockPublicKeysHash=$t;exports.deriveVaultRoot=kt;exports.deriveWotsBlocksFromSeed=Ct;
|
|
2
|
-
//# sourceMappingURL=PeginManager-CRuwG4I-.cjs.map
|