@babylonlabs-io/ts-sdk 0.43.0 → 0.45.0
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/README.md +0 -1
- package/dist/{BTCVaultRegistry.abi-Cq9-JlqT.js → BTCVaultRegistry.abi-Chs4AFBj.js} +125 -2
- package/dist/BTCVaultRegistry.abi-Chs4AFBj.js.map +1 -0
- package/dist/{BTCVaultRegistry.abi-CHFGevwa.cjs → BTCVaultRegistry.abi-JdeqLz4x.cjs} +2 -2
- package/dist/BTCVaultRegistry.abi-JdeqLz4x.cjs.map +1 -0
- package/dist/{PeginManager-BezsAEDe.js → PeginManager-CFGjwYtC.js} +4 -4
- package/dist/{PeginManager-BezsAEDe.js.map → PeginManager-CFGjwYtC.js.map} +1 -1
- package/dist/{PeginManager-D-8vmqzq.cjs → PeginManager-CL1Esl1c.cjs} +2 -2
- package/dist/{PeginManager-D-8vmqzq.cjs.map → PeginManager-CL1Esl1c.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-37Bs7-V1.js → buildAndBroadcastRefund-CZj2z7PJ.js} +2 -2
- package/dist/{buildAndBroadcastRefund-37Bs7-V1.js.map → buildAndBroadcastRefund-CZj2z7PJ.js.map} +1 -1
- package/dist/{buildAndBroadcastRefund-DbcNEsOv.cjs → buildAndBroadcastRefund-Ux587SFf.cjs} +2 -2
- package/dist/{buildAndBroadcastRefund-DbcNEsOv.cjs.map → buildAndBroadcastRefund-Ux587SFf.cjs.map} +1 -1
- package/dist/{errors-CznAK5NB.js → errors-Blc-JWnI.js} +71 -46
- package/dist/errors-Blc-JWnI.js.map +1 -0
- package/dist/errors-CGcNP0rV.cjs +2 -0
- package/dist/errors-CGcNP0rV.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +106 -107
- package/dist/{mempoolApi-CknccHKg.cjs → mempoolApi-DcHws8jJ.cjs} +2 -2
- package/dist/{mempoolApi-CknccHKg.cjs.map → mempoolApi-DcHws8jJ.cjs.map} +1 -1
- package/dist/{mempoolApi-DI9HISqi.js → mempoolApi-DnP7d084.js} +2 -2
- package/dist/{mempoolApi-DI9HISqi.js.map → mempoolApi-DnP7d084.js.map} +1 -1
- package/dist/primeVpAuth-BihAGyNf.cjs +2 -0
- package/dist/{primeVpAuth-Duds3vAO.cjs.map → primeVpAuth-BihAGyNf.cjs.map} +1 -1
- package/dist/{primeVpAuth-qEC9TTO_.js → primeVpAuth-DXl9wGBR.js} +361 -341
- package/dist/{primeVpAuth-qEC9TTO_.js.map → primeVpAuth-DXl9wGBR.js.map} +1 -1
- package/dist/reservation-BxvKbQH2.js +107 -0
- package/dist/reservation-BxvKbQH2.js.map +1 -0
- package/dist/reservation-xTL2a9Q-.cjs +2 -0
- package/dist/reservation-xTL2a9Q-.cjs.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts +12 -0
- package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts +8 -0
- package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +42 -13
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -1
- package/dist/tbv/core/contracts/__tests__/errors.test.d.ts +2 -0
- package/dist/tbv/core/contracts/__tests__/errors.test.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +292 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +2 -2
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +102 -103
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +1 -1
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +32 -33
- package/dist/tbv/core/utils/utxo/__tests__/reservation.test.d.ts +0 -1
- package/dist/tbv/core/utils/utxo/__tests__/reservation.test.d.ts.map +1 -1
- package/dist/tbv/core/utils/utxo/availability.d.ts +22 -1
- package/dist/tbv/core/utils/utxo/availability.d.ts.map +1 -1
- package/dist/tbv/core/utils/utxo/reservation.d.ts +11 -86
- package/dist/tbv/core/utils/utxo/reservation.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +102 -103
- package/dist/tbv/integrations/aave/clients/__tests__/oracle.test.d.ts +2 -0
- package/dist/tbv/integrations/aave/clients/__tests__/oracle.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/abis/AaveOracle.abi.json.d.ts +36 -0
- package/dist/tbv/integrations/aave/clients/index.d.ts +1 -0
- package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/clients/oracle.d.ts +14 -0
- package/dist/tbv/integrations/aave/clients/oracle.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/index.cjs +1 -1
- package/dist/tbv/integrations/aave/index.cjs.map +1 -1
- package/dist/tbv/integrations/aave/index.d.ts +1 -1
- package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/index.js +249 -141
- package/dist/tbv/integrations/aave/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/BTCVaultRegistry.abi-CHFGevwa.cjs.map +0 -1
- package/dist/BTCVaultRegistry.abi-Cq9-JlqT.js.map +0 -1
- package/dist/errors-BP73_stm.cjs +0 -2
- package/dist/errors-BP73_stm.cjs.map +0 -1
- package/dist/errors-CznAK5NB.js.map +0 -1
- package/dist/primeVpAuth-Duds3vAO.cjs +0 -2
- package/dist/reservation-Cwf2u4vu.cjs +0 -2
- package/dist/reservation-Cwf2u4vu.cjs.map +0 -1
- package/dist/reservation-DNOGLBt4.js +0 -143
- package/dist/reservation-DNOGLBt4.js.map +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var g = (e, n, t) => n in e ? m(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var f = (e, n, t) => g(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { Transaction as p } from "bitcoinjs-lib";
|
|
5
|
+
import { Buffer as d } from "buffer";
|
|
6
|
+
import { s as w } from "./bitcoin-B5aNKtsk.js";
|
|
7
|
+
import { C as T } from "./peginState-CBAlxgXk.js";
|
|
8
|
+
class U extends Error {
|
|
9
|
+
constructor(t) {
|
|
10
|
+
const r = t.length, a = r === 1 ? "The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO." : `${r} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;
|
|
11
|
+
super(a);
|
|
12
|
+
f(this, "missingUtxos");
|
|
13
|
+
this.name = "UtxoNotAvailableError", this.missingUtxos = t;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function $(e) {
|
|
17
|
+
const n = e.startsWith("0x") ? e.slice(2) : e;
|
|
18
|
+
let t;
|
|
19
|
+
try {
|
|
20
|
+
t = p.fromHex(n);
|
|
21
|
+
} catch (r) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Failed to parse BTC transaction: ${r instanceof Error ? r.message : String(r)}`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return t.ins.map((r) => ({
|
|
27
|
+
// Bitcoin stores txid in reverse byte order
|
|
28
|
+
txid: d.from(r.hash).reverse().toString("hex"),
|
|
29
|
+
vout: r.index
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
function b(e, n) {
|
|
33
|
+
const t = $(e);
|
|
34
|
+
if (t.length === 0)
|
|
35
|
+
throw new Error("Transaction has no inputs");
|
|
36
|
+
const r = /* @__PURE__ */ new Set();
|
|
37
|
+
for (const o of t) {
|
|
38
|
+
const i = `${o.txid.toLowerCase()}:${o.vout}`;
|
|
39
|
+
if (r.has(i))
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Transaction contains duplicate input ${o.txid}:${o.vout}. This would produce an invalid Bitcoin transaction.`
|
|
42
|
+
);
|
|
43
|
+
r.add(i);
|
|
44
|
+
}
|
|
45
|
+
const a = new Set(
|
|
46
|
+
n.map((o) => `${o.txid.toLowerCase()}:${o.vout}`)
|
|
47
|
+
), c = [];
|
|
48
|
+
for (const o of t) {
|
|
49
|
+
const i = `${o.txid.toLowerCase()}:${o.vout}`;
|
|
50
|
+
a.has(i) || c.push({
|
|
51
|
+
txid: o.txid,
|
|
52
|
+
vout: o.vout
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
allAvailable: c.length === 0,
|
|
57
|
+
missingUtxos: c,
|
|
58
|
+
totalInputs: t.length
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function I(e, n) {
|
|
62
|
+
const t = b(e, n);
|
|
63
|
+
if (!t.allAvailable)
|
|
64
|
+
throw new U(t.missingUtxos);
|
|
65
|
+
}
|
|
66
|
+
function S(e) {
|
|
67
|
+
try {
|
|
68
|
+
return p.fromHex(w(e)).ins.map((t) => ({
|
|
69
|
+
txid: d.from(t.hash).reverse().toString("hex"),
|
|
70
|
+
vout: t.index
|
|
71
|
+
}));
|
|
72
|
+
} catch {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function l(e) {
|
|
77
|
+
return `${e.txid.toLowerCase()}:${e.vout}`;
|
|
78
|
+
}
|
|
79
|
+
function L(e) {
|
|
80
|
+
const { selectedOutpoints: n, vaults: t = [], pendingPegins: r = [] } = e, a = new Set(n.map(l));
|
|
81
|
+
if (a.size === 0) return [];
|
|
82
|
+
const c = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), i = (s, h) => {
|
|
83
|
+
if (!s) return;
|
|
84
|
+
const u = s.toLowerCase();
|
|
85
|
+
if (c.has(u)) return;
|
|
86
|
+
c.add(u);
|
|
87
|
+
const x = S(h);
|
|
88
|
+
for (const v of x)
|
|
89
|
+
if (a.has(l(v))) {
|
|
90
|
+
o.add(s);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
for (const s of t)
|
|
95
|
+
s.status === T.PENDING && i(s.id, s.unsignedPrePeginTx);
|
|
96
|
+
for (const s of r)
|
|
97
|
+
s.unsignedTxHex && i(s.id, s.unsignedTxHex);
|
|
98
|
+
return Array.from(o);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
U,
|
|
102
|
+
I as a,
|
|
103
|
+
$ as e,
|
|
104
|
+
L as f,
|
|
105
|
+
b as v
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=reservation-BxvKbQH2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservation-BxvKbQH2.js","sources":["../src/tbv/core/utils/utxo/availability.ts","../src/tbv/core/utils/utxo/reservation.ts"],"sourcesContent":["/**\n * UTXO Availability Validation\n *\n * Validates that UTXOs referenced in a pre-pegin transaction are still unspent\n * BEFORE asking the user to sign. This prevents wasted signing effort when\n * UTXOs have already been spent by unrelated transactions.\n *\n * These functions are pure — they accept pre-fetched UTXOs and perform no I/O.\n * The vault service wrapper is responsible for fetching UTXOs from the mempool.\n */\n\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\n/**\n * Reference to a Bitcoin UTXO by its outpoint (txid + vout).\n *\n * Used by the availability check to compare a Pre-PegIn transaction's\n * declared inputs against the wallet's current spendable set. Txids are\n * compared case-insensitively; callers should treat the txid as opaque\n * lowercase hex.\n */\nexport interface UtxoRef {\n txid: string;\n vout: number;\n}\n\n/**\n * Information about a missing/spent UTXO.\n */\nexport interface MissingUtxoInfo {\n /** Transaction ID of the missing UTXO */\n txid: string;\n /** Output index of the missing UTXO */\n vout: number;\n}\n\n/**\n * Result of UTXO validation.\n */\nexport interface UtxoValidationResult {\n /** Whether all UTXOs are still available */\n allAvailable: boolean;\n /** List of missing UTXOs (if any) */\n missingUtxos: MissingUtxoInfo[];\n /** Total number of inputs checked */\n totalInputs: number;\n}\n\n/**\n * Error thrown when UTXOs are not available.\n */\nexport class UtxoNotAvailableError extends Error {\n public readonly missingUtxos: MissingUtxoInfo[];\n\n constructor(missingUtxos: MissingUtxoInfo[]) {\n const count = missingUtxos.length;\n const message =\n count === 1\n ? \"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.\"\n : `${count} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;\n\n super(message);\n this.name = \"UtxoNotAvailableError\";\n this.missingUtxos = missingUtxos;\n }\n}\n\n/**\n * Extract input references (txid:vout) from an unsigned transaction.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @returns Array of input references\n */\nexport function extractInputsFromTransaction(\n unsignedTxHex: string,\n): Array<{ txid: string; vout: number }> {\n const cleanHex = unsignedTxHex.startsWith(\"0x\")\n ? unsignedTxHex.slice(2)\n : unsignedTxHex;\n\n let tx: Transaction;\n try {\n tx = Transaction.fromHex(cleanHex);\n } catch (error) {\n throw new Error(\n `Failed to parse BTC transaction: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return tx.ins.map((input) => ({\n // Bitcoin stores txid in reverse byte order\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n}\n\n/**\n * Validate that all UTXOs in a transaction are still available.\n *\n * Pure function — accepts pre-fetched UTXOs instead of making network calls.\n * This should be called BEFORE signing to avoid wasting user effort\n * signing a transaction that will fail to broadcast.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @returns Validation result with missing UTXO details\n */\nexport function validateUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): UtxoValidationResult {\n const inputs = extractInputsFromTransaction(unsignedTxHex);\n\n if (inputs.length === 0) {\n throw new Error(\"Transaction has no inputs\");\n }\n\n // Detect duplicate inputs (same txid:vout referenced more than once).\n // This would produce an invalid Bitcoin transaction.\n const inputKeys = new Set<string>();\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (inputKeys.has(key)) {\n throw new Error(\n `Transaction contains duplicate input ${input.txid}:${input.vout}. ` +\n `This would produce an invalid Bitcoin transaction.`,\n );\n }\n inputKeys.add(key);\n }\n\n // Set of available outpoints for O(1) lookup. Lowercased so the comparison\n // is case-insensitive against whatever case the wallet returned.\n const availableSet = new Set(\n availableUtxos.map((utxo) => `${utxo.txid.toLowerCase()}:${utxo.vout}`),\n );\n\n // Check which inputs are missing\n const missingUtxos: MissingUtxoInfo[] = [];\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (!availableSet.has(key)) {\n missingUtxos.push({\n txid: input.txid,\n vout: input.vout,\n });\n }\n }\n\n return {\n allAvailable: missingUtxos.length === 0,\n missingUtxos,\n totalInputs: inputs.length,\n };\n}\n\n/**\n * Validate UTXOs and throw if any are not available.\n *\n * Pure convenience function that combines validation and error throwing.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @throws UtxoNotAvailableError if any UTXOs are not available\n * @throws Error if validation fails\n */\nexport function assertUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): void {\n const result = validateUtxosAvailable(unsignedTxHex, availableUtxos);\n\n if (!result.allAvailable) {\n throw new UtxoNotAvailableError(result.missingUtxos);\n }\n}\n","/**\n * Pending-vault outpoint overlap detection.\n *\n * Given the depositor's pending vaults (indexer + local cache) and the\n * outpoints a new deposit's coin selector picked, return the set of\n * pending vault ids whose Pre-PegIn BTC tx shares an input. Advisory\n * only — used to warn the user before signing.\n *\n * Only `PENDING` vaults contribute: VERIFIED+ have their Pre-PegIn\n * already confirmed on-chain, so those inputs cannot still appear in\n * the wallet's spendable set.\n */\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { stripHexPrefix } from \"../../primitives/utils/bitcoin\";\nimport { ContractStatus } from \"../../services/deposit/peginState\";\n\nimport { type UtxoRef } from \"./availability\";\n\n/** Locally-known pending pegin. `id` is the bytes32 vault id. */\nexport interface PendingPeginLike {\n id?: string;\n unsignedTxHex?: string;\n}\n\n/** On-chain vault row from the indexer. */\nexport interface VaultLike {\n id?: string;\n status: number;\n unsignedPrePeginTx: string;\n}\n\nexport interface FindOverlappingPendingVaultsParams {\n selectedOutpoints: ReadonlyArray<UtxoRef>;\n vaults?: ReadonlyArray<VaultLike>;\n pendingPegins?: ReadonlyArray<PendingPeginLike>;\n}\n\nfunction extractInputUtxoRefs(txHex: string): UtxoRef[] {\n try {\n const tx = Transaction.fromHex(stripHexPrefix(txHex));\n return tx.ins.map((input) => ({\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n } catch {\n return [];\n }\n}\n\nfunction outpointKey(o: UtxoRef): string {\n return `${o.txid.toLowerCase()}:${o.vout}`;\n}\n\n/**\n * Return the ids of pending vaults whose committed Pre-PegIn inputs\n * overlap any of the just-selected outpoints. On-chain `PENDING` vaults\n * take precedence over a same-id local pegin entry.\n */\nexport function findOverlappingPendingVaults(\n params: FindOverlappingPendingVaultsParams,\n): string[] {\n const { selectedOutpoints, vaults = [], pendingPegins = [] } = params;\n\n const selectedSet = new Set(selectedOutpoints.map(outpointKey));\n if (selectedSet.size === 0) return [];\n\n const seenIds = new Set<string>();\n const impacted = new Set<string>();\n\n const consider = (id: string | undefined, txHex: string): void => {\n if (!id) return;\n const idLower = id.toLowerCase();\n if (seenIds.has(idLower)) return;\n seenIds.add(idLower);\n const inputs = extractInputUtxoRefs(txHex);\n for (const input of inputs) {\n if (selectedSet.has(outpointKey(input))) {\n impacted.add(id);\n return;\n }\n }\n };\n\n // On-chain wins on id collision.\n for (const v of vaults) {\n if (v.status !== ContractStatus.PENDING) continue;\n consider(v.id, v.unsignedPrePeginTx);\n }\n for (const p of pendingPegins) {\n if (!p.unsignedTxHex) continue;\n consider(p.id, p.unsignedTxHex);\n }\n\n return Array.from(impacted);\n}\n"],"names":["UtxoNotAvailableError","missingUtxos","count","message","__publicField","extractInputsFromTransaction","unsignedTxHex","cleanHex","tx","Transaction","error","input","Buffer","validateUtxosAvailable","availableUtxos","inputs","inputKeys","key","availableSet","utxo","assertUtxosAvailable","result","extractInputUtxoRefs","txHex","stripHexPrefix","outpointKey","o","findOverlappingPendingVaults","params","selectedOutpoints","vaults","pendingPegins","selectedSet","seenIds","impacted","consider","id","idLower","v","ContractStatus","p"],"mappings":";;;;;;;AAoDO,MAAMA,UAA8B,MAAM;AAAA,EAG/C,YAAYC,GAAiC;AAC3C,UAAMC,IAAQD,EAAa,QACrBE,IACJD,MAAU,IACN,8JACA,GAAGA,CAAK;AAEd,UAAMC,CAAO;AATC,IAAAC,EAAA;AAUd,SAAK,OAAO,yBACZ,KAAK,eAAeH;AAAA,EACtB;AACF;AAQO,SAASI,EACdC,GACuC;AACvC,QAAMC,IAAWD,EAAc,WAAW,IAAI,IAC1CA,EAAc,MAAM,CAAC,IACrBA;AAEJ,MAAIE;AACJ,MAAI;AACF,IAAAA,IAAKC,EAAY,QAAQF,CAAQ;AAAA,EACnC,SAASG,GAAO;AACd,UAAM,IAAI;AAAA,MACR,oCAAoCA,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,CAAC;AAAA,IAAA;AAAA,EAE9F;AAEA,SAAOF,EAAG,IAAI,IAAI,CAACG,OAAW;AAAA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n,t)=>T(e,typeof n!="symbol"?n+"":n,t);const d=require("bitcoinjs-lib"),x=require("buffer"),U=require("./bitcoin-CHfKAhcI.cjs"),$=require("./peginState-BijNNT15.cjs");class p extends Error{constructor(t){const r=t.length,a=r===1?"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.":`${r} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;super(a);l(this,"missingUtxos");this.name="UtxoNotAvailableError",this.missingUtxos=t}}function h(e){const n=e.startsWith("0x")?e.slice(2):e;let t;try{t=d.Transaction.fromHex(n)}catch(r){throw new Error(`Failed to parse BTC transaction: ${r instanceof Error?r.message:String(r)}`)}return t.ins.map(r=>({txid:x.Buffer.from(r.hash).reverse().toString("hex"),vout:r.index}))}function v(e,n){const t=h(e);if(t.length===0)throw new Error("Transaction has no inputs");const r=new Set;for(const o of t){const i=`${o.txid.toLowerCase()}:${o.vout}`;if(r.has(i))throw new Error(`Transaction contains duplicate input ${o.txid}:${o.vout}. This would produce an invalid Bitcoin transaction.`);r.add(i)}const a=new Set(n.map(o=>`${o.txid.toLowerCase()}:${o.vout}`)),c=[];for(const o of t){const i=`${o.txid.toLowerCase()}:${o.vout}`;a.has(i)||c.push({txid:o.txid,vout:o.vout})}return{allAvailable:c.length===0,missingUtxos:c,totalInputs:t.length}}function S(e,n){const t=v(e,n);if(!t.allAvailable)throw new p(t.missingUtxos)}function y(e){try{return d.Transaction.fromHex(U.stripHexPrefix(e)).ins.map(t=>({txid:x.Buffer.from(t.hash).reverse().toString("hex"),vout:t.index}))}catch{return[]}}function f(e){return`${e.txid.toLowerCase()}:${e.vout}`}function A(e){const{selectedOutpoints:n,vaults:t=[],pendingPegins:r=[]}=e,a=new Set(n.map(f));if(a.size===0)return[];const c=new Set,o=new Set,i=(s,g)=>{if(!s)return;const u=s.toLowerCase();if(c.has(u))return;c.add(u);const w=y(g);for(const m of w)if(a.has(f(m))){o.add(s);return}};for(const s of t)s.status===$.ContractStatus.PENDING&&i(s.id,s.unsignedPrePeginTx);for(const s of r)s.unsignedTxHex&&i(s.id,s.unsignedTxHex);return Array.from(o)}exports.UtxoNotAvailableError=p;exports.assertUtxosAvailable=S;exports.extractInputsFromTransaction=h;exports.findOverlappingPendingVaults=A;exports.validateUtxosAvailable=v;
|
|
2
|
+
//# sourceMappingURL=reservation-xTL2a9Q-.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservation-xTL2a9Q-.cjs","sources":["../src/tbv/core/utils/utxo/availability.ts","../src/tbv/core/utils/utxo/reservation.ts"],"sourcesContent":["/**\n * UTXO Availability Validation\n *\n * Validates that UTXOs referenced in a pre-pegin transaction are still unspent\n * BEFORE asking the user to sign. This prevents wasted signing effort when\n * UTXOs have already been spent by unrelated transactions.\n *\n * These functions are pure — they accept pre-fetched UTXOs and perform no I/O.\n * The vault service wrapper is responsible for fetching UTXOs from the mempool.\n */\n\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\n/**\n * Reference to a Bitcoin UTXO by its outpoint (txid + vout).\n *\n * Used by the availability check to compare a Pre-PegIn transaction's\n * declared inputs against the wallet's current spendable set. Txids are\n * compared case-insensitively; callers should treat the txid as opaque\n * lowercase hex.\n */\nexport interface UtxoRef {\n txid: string;\n vout: number;\n}\n\n/**\n * Information about a missing/spent UTXO.\n */\nexport interface MissingUtxoInfo {\n /** Transaction ID of the missing UTXO */\n txid: string;\n /** Output index of the missing UTXO */\n vout: number;\n}\n\n/**\n * Result of UTXO validation.\n */\nexport interface UtxoValidationResult {\n /** Whether all UTXOs are still available */\n allAvailable: boolean;\n /** List of missing UTXOs (if any) */\n missingUtxos: MissingUtxoInfo[];\n /** Total number of inputs checked */\n totalInputs: number;\n}\n\n/**\n * Error thrown when UTXOs are not available.\n */\nexport class UtxoNotAvailableError extends Error {\n public readonly missingUtxos: MissingUtxoInfo[];\n\n constructor(missingUtxos: MissingUtxoInfo[]) {\n const count = missingUtxos.length;\n const message =\n count === 1\n ? \"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.\"\n : `${count} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;\n\n super(message);\n this.name = \"UtxoNotAvailableError\";\n this.missingUtxos = missingUtxos;\n }\n}\n\n/**\n * Extract input references (txid:vout) from an unsigned transaction.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @returns Array of input references\n */\nexport function extractInputsFromTransaction(\n unsignedTxHex: string,\n): Array<{ txid: string; vout: number }> {\n const cleanHex = unsignedTxHex.startsWith(\"0x\")\n ? unsignedTxHex.slice(2)\n : unsignedTxHex;\n\n let tx: Transaction;\n try {\n tx = Transaction.fromHex(cleanHex);\n } catch (error) {\n throw new Error(\n `Failed to parse BTC transaction: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return tx.ins.map((input) => ({\n // Bitcoin stores txid in reverse byte order\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n}\n\n/**\n * Validate that all UTXOs in a transaction are still available.\n *\n * Pure function — accepts pre-fetched UTXOs instead of making network calls.\n * This should be called BEFORE signing to avoid wasting user effort\n * signing a transaction that will fail to broadcast.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @returns Validation result with missing UTXO details\n */\nexport function validateUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): UtxoValidationResult {\n const inputs = extractInputsFromTransaction(unsignedTxHex);\n\n if (inputs.length === 0) {\n throw new Error(\"Transaction has no inputs\");\n }\n\n // Detect duplicate inputs (same txid:vout referenced more than once).\n // This would produce an invalid Bitcoin transaction.\n const inputKeys = new Set<string>();\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (inputKeys.has(key)) {\n throw new Error(\n `Transaction contains duplicate input ${input.txid}:${input.vout}. ` +\n `This would produce an invalid Bitcoin transaction.`,\n );\n }\n inputKeys.add(key);\n }\n\n // Set of available outpoints for O(1) lookup. Lowercased so the comparison\n // is case-insensitive against whatever case the wallet returned.\n const availableSet = new Set(\n availableUtxos.map((utxo) => `${utxo.txid.toLowerCase()}:${utxo.vout}`),\n );\n\n // Check which inputs are missing\n const missingUtxos: MissingUtxoInfo[] = [];\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (!availableSet.has(key)) {\n missingUtxos.push({\n txid: input.txid,\n vout: input.vout,\n });\n }\n }\n\n return {\n allAvailable: missingUtxos.length === 0,\n missingUtxos,\n totalInputs: inputs.length,\n };\n}\n\n/**\n * Validate UTXOs and throw if any are not available.\n *\n * Pure convenience function that combines validation and error throwing.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @throws UtxoNotAvailableError if any UTXOs are not available\n * @throws Error if validation fails\n */\nexport function assertUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): void {\n const result = validateUtxosAvailable(unsignedTxHex, availableUtxos);\n\n if (!result.allAvailable) {\n throw new UtxoNotAvailableError(result.missingUtxos);\n }\n}\n","/**\n * Pending-vault outpoint overlap detection.\n *\n * Given the depositor's pending vaults (indexer + local cache) and the\n * outpoints a new deposit's coin selector picked, return the set of\n * pending vault ids whose Pre-PegIn BTC tx shares an input. Advisory\n * only — used to warn the user before signing.\n *\n * Only `PENDING` vaults contribute: VERIFIED+ have their Pre-PegIn\n * already confirmed on-chain, so those inputs cannot still appear in\n * the wallet's spendable set.\n */\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { stripHexPrefix } from \"../../primitives/utils/bitcoin\";\nimport { ContractStatus } from \"../../services/deposit/peginState\";\n\nimport { type UtxoRef } from \"./availability\";\n\n/** Locally-known pending pegin. `id` is the bytes32 vault id. */\nexport interface PendingPeginLike {\n id?: string;\n unsignedTxHex?: string;\n}\n\n/** On-chain vault row from the indexer. */\nexport interface VaultLike {\n id?: string;\n status: number;\n unsignedPrePeginTx: string;\n}\n\nexport interface FindOverlappingPendingVaultsParams {\n selectedOutpoints: ReadonlyArray<UtxoRef>;\n vaults?: ReadonlyArray<VaultLike>;\n pendingPegins?: ReadonlyArray<PendingPeginLike>;\n}\n\nfunction extractInputUtxoRefs(txHex: string): UtxoRef[] {\n try {\n const tx = Transaction.fromHex(stripHexPrefix(txHex));\n return tx.ins.map((input) => ({\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n } catch {\n return [];\n }\n}\n\nfunction outpointKey(o: UtxoRef): string {\n return `${o.txid.toLowerCase()}:${o.vout}`;\n}\n\n/**\n * Return the ids of pending vaults whose committed Pre-PegIn inputs\n * overlap any of the just-selected outpoints. On-chain `PENDING` vaults\n * take precedence over a same-id local pegin entry.\n */\nexport function findOverlappingPendingVaults(\n params: FindOverlappingPendingVaultsParams,\n): string[] {\n const { selectedOutpoints, vaults = [], pendingPegins = [] } = params;\n\n const selectedSet = new Set(selectedOutpoints.map(outpointKey));\n if (selectedSet.size === 0) return [];\n\n const seenIds = new Set<string>();\n const impacted = new Set<string>();\n\n const consider = (id: string | undefined, txHex: string): void => {\n if (!id) return;\n const idLower = id.toLowerCase();\n if (seenIds.has(idLower)) return;\n seenIds.add(idLower);\n const inputs = extractInputUtxoRefs(txHex);\n for (const input of inputs) {\n if (selectedSet.has(outpointKey(input))) {\n impacted.add(id);\n return;\n }\n }\n };\n\n // On-chain wins on id collision.\n for (const v of vaults) {\n if (v.status !== ContractStatus.PENDING) continue;\n consider(v.id, v.unsignedPrePeginTx);\n }\n for (const p of pendingPegins) {\n if (!p.unsignedTxHex) continue;\n consider(p.id, p.unsignedTxHex);\n }\n\n return Array.from(impacted);\n}\n"],"names":["UtxoNotAvailableError","missingUtxos","count","message","__publicField","extractInputsFromTransaction","unsignedTxHex","cleanHex","tx","Transaction","error","input","Buffer","validateUtxosAvailable","availableUtxos","inputs","inputKeys","key","availableSet","utxo","assertUtxosAvailable","result","extractInputUtxoRefs","txHex","stripHexPrefix","outpointKey","o","findOverlappingPendingVaults","params","selectedOutpoints","vaults","pendingPegins","selectedSet","seenIds","impacted","consider","id","idLower","v","ContractStatus","p"],"mappings":"iTAoDO,MAAMA,UAA8B,KAAM,CAG/C,YAAYC,EAAiC,CAC3C,MAAMC,EAAQD,EAAa,OACrBE,EACJD,IAAU,EACN,4JACA,GAAGA,CAAK,qIAEd,MAAMC,CAAO,EATCC,EAAA,qBAUd,KAAK,KAAO,wBACZ,KAAK,aAAeH,CACtB,CACF,CAQO,SAASI,EACdC,EACuC,CACvC,MAAMC,EAAWD,EAAc,WAAW,IAAI,EAC1CA,EAAc,MAAM,CAAC,EACrBA,EAEJ,IAAIE,EACJ,GAAI,CACFA,EAAKC,EAAAA,YAAY,QAAQF,CAAQ,CACnC,OAASG,EAAO,CACd,MAAM,IAAI,MACR,oCAAoCA,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC,EAAA,CAE9F,CAEA,OAAOF,EAAG,IAAI,IAAKG,IAAW,CAE5B,KAAMC,EAAAA,OAAO,KAAKD,EAAM,IAAI,EAAE,QAAA,EAAU,SAAS,KAAK,EACtD,KAAMA,EAAM,KAAA,EACZ,CACJ,CAaO,SAASE,EACdP,EACAQ,EACsB,CACtB,MAAMC,EAASV,EAA6BC,CAAa,EAEzD,GAAIS,EAAO,SAAW,EACpB,MAAM,IAAI,MAAM,2BAA2B,EAK7C,MAAMC,MAAgB,IACtB,UAAWL,KAASI,EAAQ,CAC1B,MAAME,EAAM,GAAGN,EAAM,KAAK,aAAa,IAAIA,EAAM,IAAI,GACrD,GAAIK,EAAU,IAAIC,CAAG,EACnB,MAAM,IAAI,MACR,wCAAwCN,EAAM,IAAI,IAAIA,EAAM,IAAI,sDAAA,EAIpEK,EAAU,IAAIC,CAAG,CACnB,CAIA,MAAMC,EAAe,IAAI,IACvBJ,EAA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AAO,EAAG,OAC1BJ,EAAQ,IAAII,CAAO,EACnB,MAAMtB,EAASO,EAAqBC,CAAK,EACzC,UAAWZ,KAASI,EAClB,GAAIiB,EAAY,IAAIP,EAAYd,CAAK,CAAC,EAAG,CACvCuB,EAAS,IAAIE,CAAE,EACf,MACF,CAEJ,EAGA,UAAWE,KAAKR,EACVQ,EAAE,SAAWC,EAAAA,eAAe,SAChCJ,EAASG,EAAE,GAAIA,EAAE,kBAAkB,EAErC,UAAWE,KAAKT,EACTS,EAAE,eACPL,EAASK,EAAE,GAAIA,EAAE,aAAa,EAGhC,OAAO,MAAM,KAAKN,CAAQ,CAC5B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../mempoolApi-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../mempoolApi-DcHws8jJ.cjs"),e=require("../../../primeVpAuth-BihAGyNf.cjs"),t=require("../../../types-eYlq0p1o.cjs");exports.MEMPOOL_API_URLS=r.MEMPOOL_API_URLS;exports.ViemVaultRegistryReader=r.ViemVaultRegistryReader;exports.getAddressTxs=r.getAddressTxs;exports.getAddressUtxos=r.getAddressUtxos;exports.getMempoolApiUrl=r.getMempoolApiUrl;exports.getNetworkFees=r.getNetworkFees;exports.getTipHeight=r.getTipHeight;exports.getTxHex=r.getTxHex;exports.getTxInfo=r.getTxInfo;exports.getUtxoInfo=r.getUtxoInfo;exports.pushTx=r.pushTx;exports.validateOffchainParams=r.validateOffchainParams;exports.validatePegInConfiguration=r.validatePegInConfiguration;exports.validateTBVProtocolParams=r.validateTBVProtocolParams;exports.OnChainBtcVaultStatus=e.OnChainBtcVaultStatus;exports.ServerIdentityError=e.ServerIdentityError;exports.VaultProviderRpcClient=e.VaultProviderRpcClient;exports.ViemProtocolParamsReader=e.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=e.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=e.ViemVaultKeeperReader;exports.VpResponseValidationError=e.VpResponseValidationError;exports.VpTokenRegistry=e.VpTokenRegistry;exports.batchPollByProvider=e.batchPollByProvider;exports.createAuthenticatedVpClient=e.createAuthenticatedVpClient;exports.primeVpTokenRegistry=e.primeVpTokenRegistry;exports.resolveProtocolAddresses=e.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=e.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=e.verifyServerIdentity;exports.vpTokenRegistry=e.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=t.AUTH_EXPIRED_DATA_KIND;exports.DaemonStatus=t.DaemonStatus;exports.JSON_RPC_ERROR_CODES=t.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=t.JsonRpcClient;exports.JsonRpcError=t.JsonRpcError;exports.POST_WOTS_STATUSES=t.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=t.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=t.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=t.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=t.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=t.VP_TRANSIENT_STATUSES;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as s, V as r, g as t, a as o, b as i, c as R, d as T, e as S, f as n, h as d, p as l, v as p, i as A, j as P } from "../../../mempoolApi-
|
|
2
|
-
import { O as E, S as V, V as g, g as c, h as m, i as v, a as I, d as f, b as O, f as C, p as U, r as u, v as x, c as h, e as y } from "../../../primeVpAuth-
|
|
1
|
+
import { M as s, V as r, g as t, a as o, b as i, c as R, d as T, e as S, f as n, h as d, p as l, v as p, i as A, j as P } from "../../../mempoolApi-DnP7d084.js";
|
|
2
|
+
import { O as E, S as V, V as g, g as c, h as m, i as v, a as I, d as f, b as O, f as C, p as U, r as u, v as x, c as h, e as y } from "../../../primeVpAuth-DXl9wGBR.js";
|
|
3
3
|
import { A as N, D as M, b, J as k, a as B, d as H, P as J, R as L, e as F, c as K, V as X } from "../../../types-BqGAMOZM.js";
|
|
4
4
|
export {
|
|
5
5
|
N as AUTH_EXPIRED_DATA_KIND,
|
|
@@ -2,9 +2,21 @@
|
|
|
2
2
|
* VP RPC methods that require `Authorization: Bearer <token>`.
|
|
3
3
|
* Protocol invariant — must be kept in sync with the VP server.
|
|
4
4
|
*
|
|
5
|
+
* Split into two sets by the CWT subject the VP demands:
|
|
6
|
+
*
|
|
7
|
+
* - {@link AUTH_GATED_METHODS} — bearer minted by
|
|
8
|
+
* `auth_createDepositorToken` (Subject::VaultdJsonRpc). These run
|
|
9
|
+
* through the proxy's plain JSON-RPC forward path.
|
|
10
|
+
* - {@link GRPC_AUTH_GATED_METHODS} — bearer minted by
|
|
11
|
+
* `auth_createDepositorTokenGrpc` (Subject::VaultdGrpc). The proxy
|
|
12
|
+
* translates these into gRPC calls to vaultd's daemon gRPC server,
|
|
13
|
+
* so a JSON-RPC-subject token would be rejected by
|
|
14
|
+
* `GrpcAuthInterceptor`.
|
|
15
|
+
*
|
|
5
16
|
* @stability frozen
|
|
6
17
|
*
|
|
7
18
|
* @module tbv/core/clients/vault-provider/auth/gatedMethods
|
|
8
19
|
*/
|
|
9
20
|
export declare const AUTH_GATED_METHODS: ReadonlySet<string>;
|
|
21
|
+
export declare const GRPC_AUTH_GATED_METHODS: ReadonlySet<string>;
|
|
10
22
|
//# sourceMappingURL=gatedMethods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatedMethods.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/gatedMethods.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gatedMethods.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/gatedMethods.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAIjD,CAAC;AAEH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAEtD,CAAC"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { JsonRpcClient } from '../json-rpc-client';
|
|
2
2
|
export declare const TOKEN_ISSUE_METHOD = "auth_createDepositorToken";
|
|
3
|
+
/**
|
|
4
|
+
* gRPC-subject sibling of {@link TOKEN_ISSUE_METHOD}. The proxy bridges
|
|
5
|
+
* this call to vaultd's `VaultProviderDepositorAuthService.CreateDepositorToken`
|
|
6
|
+
* so the resulting CWT is bound to `Subject::VaultdGrpc` — required to
|
|
7
|
+
* pass vaultd's `GrpcAuthInterceptor` on methods the proxy translates to
|
|
8
|
+
* gRPC (currently just the artifact stream).
|
|
9
|
+
*/
|
|
10
|
+
export declare const GRPC_TOKEN_ISSUE_METHOD = "auth_createDepositorTokenGrpc";
|
|
3
11
|
export declare function buildInnerTokenClient(baseUrl: string, headers?: Record<string, string>): JsonRpcClient;
|
|
4
12
|
//# sourceMappingURL=innerTokenClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"innerTokenClient.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/innerTokenClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"innerTokenClient.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/innerTokenClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,kCAAkC,CAAC;AAEvE,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,aAAa,CAQf"}
|
|
@@ -20,8 +20,20 @@ export interface VpTokenProviderConfig {
|
|
|
20
20
|
authAnchorHex: string;
|
|
21
21
|
/** Pinned VP pubkey from the on-chain registry; branded so indexer mirrors can't substitute. */
|
|
22
22
|
pinnedServerPubkey: OnChainBtcPubkey;
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Methods that need a JSON-RPC-subject bearer (minted via
|
|
25
|
+
* `auth_createDepositorToken`). Forwarded over plain HTTP JSON-RPC by
|
|
26
|
+
* the proxy. `getToken` returns `null` for any method outside this and
|
|
27
|
+
* {@link grpcGatedMethods}.
|
|
28
|
+
*/
|
|
24
29
|
authGatedMethods: ReadonlySet<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Methods that need a gRPC-subject bearer (minted via
|
|
32
|
+
* `auth_createDepositorTokenGrpc`). The proxy translates these into
|
|
33
|
+
* gRPC calls to vaultd; the JSON-RPC bearer is rejected with a
|
|
34
|
+
* `Subject` mismatch.
|
|
35
|
+
*/
|
|
36
|
+
grpcGatedMethods: ReadonlySet<string>;
|
|
25
37
|
/** Default {@link DEFAULT_REFRESH_SKEW_SECS}. */
|
|
26
38
|
refreshSkewSecs?: number;
|
|
27
39
|
/** Clock source for testability. */
|
|
@@ -39,29 +51,46 @@ export declare class VpTokenProvider implements BearerTokenProvider {
|
|
|
39
51
|
private readonly authAnchorHex;
|
|
40
52
|
private readonly pinnedServerPubkey;
|
|
41
53
|
private readonly authGatedMethods;
|
|
54
|
+
private readonly grpcGatedMethods;
|
|
42
55
|
private readonly refreshSkewSecs;
|
|
43
56
|
private readonly now;
|
|
44
|
-
|
|
45
|
-
private
|
|
57
|
+
/** Cached JSON-RPC-subject bearer (auth_createDepositorToken). */
|
|
58
|
+
private cachedJsonRpc;
|
|
59
|
+
private inFlightJsonRpc;
|
|
60
|
+
/** Cached gRPC-subject bearer (auth_createDepositorTokenGrpc). */
|
|
61
|
+
private cachedGrpc;
|
|
62
|
+
private inFlightGrpc;
|
|
46
63
|
constructor(config: VpTokenProviderConfig);
|
|
47
64
|
/**
|
|
48
65
|
* Return a bearer token for `method`, or `null` if `method` is not
|
|
49
|
-
* auth-gated.
|
|
50
|
-
*
|
|
66
|
+
* auth-gated.
|
|
67
|
+
*
|
|
68
|
+
* Routes by subject: `authGatedMethods` → JSON-RPC bearer (issued via
|
|
69
|
+
* `auth_createDepositorToken`); `grpcGatedMethods` → gRPC bearer
|
|
70
|
+
* (`auth_createDepositorTokenGrpc`). Either path acquires lazily and
|
|
71
|
+
* single-flights concurrent callers; the two cache slots are
|
|
72
|
+
* independent.
|
|
51
73
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* `
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
74
|
+
* Both token-issuing methods are hard-exempted from the gate — if
|
|
75
|
+
* either were ever included in the gated sets (caller misconfiguration)
|
|
76
|
+
* the provider would recurse into `acquireSingleFlight` from inside the
|
|
77
|
+
* JSON-RPC header builder before `inFlight` is assigned, defeating the
|
|
78
|
+
* single-flight guard. Returning `null` here breaks that recursion
|
|
79
|
+
* deterministically.
|
|
58
80
|
*/
|
|
59
81
|
getToken(method: string): Promise<string | null>;
|
|
60
82
|
/**
|
|
61
|
-
* Drop
|
|
62
|
-
* Called by `JsonRpcClient` on wire
|
|
83
|
+
* Drop both cached tokens. Next `getToken` call re-acquires the slot
|
|
84
|
+
* that's actually needed. Called by `JsonRpcClient` on wire
|
|
85
|
+
* `auth_expired` responses; the client doesn't tell us which subject
|
|
86
|
+
* expired, so we evict both to stay correct under either.
|
|
87
|
+
*
|
|
88
|
+
* Worst case is one extra round-trip on the slot that was still fresh,
|
|
89
|
+
* which is cheaper than carrying a `Subject` argument through
|
|
90
|
+
* `BearerTokenProvider`.
|
|
63
91
|
*/
|
|
64
92
|
invalidate(): void;
|
|
93
|
+
private getTokenForSubject;
|
|
65
94
|
/**
|
|
66
95
|
* Swap in a different transport for subsequent token-issuing calls.
|
|
67
96
|
* Used by the registry when a later caller registers the same
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/tokenProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"tokenProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/tokenProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAK7E,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,kBAAkB,CAAC;AAgB1B;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,eAAe,EAAE,sBAAsB,CAAC;CACzC;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,2FAA2F;IAC3F,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,gGAAgG;IAChG,kBAAkB,EAAE,gBAAgB,CAAC;IACrC;;;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AAK,IAAI,IAAI;IAIb,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe,CAAC;IAC1D,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IACrD,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,EAAE,qBAA6C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/contracts/__tests__/errors.test.ts"],"names":[],"mappings":""}
|
|
@@ -415,5 +415,297 @@ export declare const BTCVaultRegistryABI: readonly [{
|
|
|
415
415
|
readonly internalType: "contract IApplicationRegistry";
|
|
416
416
|
}];
|
|
417
417
|
readonly stateMutability: "view";
|
|
418
|
+
}, {
|
|
419
|
+
readonly type: "error";
|
|
420
|
+
readonly name: "ZeroAddress";
|
|
421
|
+
readonly inputs: readonly [];
|
|
422
|
+
}, {
|
|
423
|
+
readonly type: "error";
|
|
424
|
+
readonly name: "Unauthorized";
|
|
425
|
+
readonly inputs: readonly [];
|
|
426
|
+
}, {
|
|
427
|
+
readonly type: "error";
|
|
428
|
+
readonly name: "InvalidAmount";
|
|
429
|
+
readonly inputs: readonly [];
|
|
430
|
+
}, {
|
|
431
|
+
readonly type: "error";
|
|
432
|
+
readonly name: "TransferFailed";
|
|
433
|
+
readonly inputs: readonly [];
|
|
434
|
+
}, {
|
|
435
|
+
readonly type: "error";
|
|
436
|
+
readonly name: "InvalidTransaction";
|
|
437
|
+
readonly inputs: readonly [];
|
|
438
|
+
}, {
|
|
439
|
+
readonly type: "error";
|
|
440
|
+
readonly name: "EmptyPayoutAddress";
|
|
441
|
+
readonly inputs: readonly [];
|
|
442
|
+
}, {
|
|
443
|
+
readonly type: "error";
|
|
444
|
+
readonly name: "PayoutAddressTooLong";
|
|
445
|
+
readonly inputs: readonly [];
|
|
446
|
+
}, {
|
|
447
|
+
readonly type: "error";
|
|
448
|
+
readonly name: "VaultAlreadyExists";
|
|
449
|
+
readonly inputs: readonly [];
|
|
450
|
+
}, {
|
|
451
|
+
readonly type: "error";
|
|
452
|
+
readonly name: "VaultFeeAlreadyEscrowed";
|
|
453
|
+
readonly inputs: readonly [];
|
|
454
|
+
}, {
|
|
455
|
+
readonly type: "error";
|
|
456
|
+
readonly name: "NoEscrowedFees";
|
|
457
|
+
readonly inputs: readonly [];
|
|
458
|
+
}, {
|
|
459
|
+
readonly type: "error";
|
|
460
|
+
readonly name: "BTCVaultNotFound";
|
|
461
|
+
readonly inputs: readonly [];
|
|
462
|
+
}, {
|
|
463
|
+
readonly type: "error";
|
|
464
|
+
readonly name: "InvalidBTCVaultStatus";
|
|
465
|
+
readonly inputs: readonly [];
|
|
466
|
+
}, {
|
|
467
|
+
readonly type: "error";
|
|
468
|
+
readonly name: "PeginNotExpired";
|
|
469
|
+
readonly inputs: readonly [];
|
|
470
|
+
}, {
|
|
471
|
+
readonly type: "error";
|
|
472
|
+
readonly name: "InvalidParticipantsList";
|
|
473
|
+
readonly inputs: readonly [];
|
|
474
|
+
}, {
|
|
475
|
+
readonly type: "error";
|
|
476
|
+
readonly name: "DuplicateParticipant";
|
|
477
|
+
readonly inputs: readonly [];
|
|
478
|
+
}, {
|
|
479
|
+
readonly type: "error";
|
|
480
|
+
readonly name: "ParticipantRoleOverlap";
|
|
481
|
+
readonly inputs: readonly [];
|
|
482
|
+
}, {
|
|
483
|
+
readonly type: "error";
|
|
484
|
+
readonly name: "NotAuthorizedToACK";
|
|
485
|
+
readonly inputs: readonly [];
|
|
486
|
+
}, {
|
|
487
|
+
readonly type: "error";
|
|
488
|
+
readonly name: "UnauthorizedVaultKeeper";
|
|
489
|
+
readonly inputs: readonly [];
|
|
490
|
+
}, {
|
|
491
|
+
readonly type: "error";
|
|
492
|
+
readonly name: "BlocklistedVaultKeeper";
|
|
493
|
+
readonly inputs: readonly [];
|
|
494
|
+
}, {
|
|
495
|
+
readonly type: "error";
|
|
496
|
+
readonly name: "PeginTransactionExpired";
|
|
497
|
+
readonly inputs: readonly [];
|
|
498
|
+
}, {
|
|
499
|
+
readonly type: "error";
|
|
500
|
+
readonly name: "PrePeginOutputAlreadyUsed";
|
|
501
|
+
readonly inputs: readonly [];
|
|
502
|
+
}, {
|
|
503
|
+
readonly type: "error";
|
|
504
|
+
readonly name: "PeginTransactionAlreadyUsed";
|
|
505
|
+
readonly inputs: readonly [];
|
|
506
|
+
}, {
|
|
507
|
+
readonly type: "error";
|
|
508
|
+
readonly name: "InvalidPeginFee";
|
|
509
|
+
readonly inputs: readonly [{
|
|
510
|
+
readonly name: "provided";
|
|
511
|
+
readonly type: "uint256";
|
|
512
|
+
readonly internalType: "uint256";
|
|
513
|
+
}, {
|
|
514
|
+
readonly name: "required";
|
|
515
|
+
readonly type: "uint256";
|
|
516
|
+
readonly internalType: "uint256";
|
|
517
|
+
}];
|
|
518
|
+
}, {
|
|
519
|
+
readonly type: "error";
|
|
520
|
+
readonly name: "AmountBelowMinimumThreshold";
|
|
521
|
+
readonly inputs: readonly [{
|
|
522
|
+
readonly name: "actual";
|
|
523
|
+
readonly type: "uint256";
|
|
524
|
+
readonly internalType: "uint256";
|
|
525
|
+
}, {
|
|
526
|
+
readonly name: "minimum";
|
|
527
|
+
readonly type: "uint256";
|
|
528
|
+
readonly internalType: "uint256";
|
|
529
|
+
}];
|
|
530
|
+
}, {
|
|
531
|
+
readonly type: "error";
|
|
532
|
+
readonly name: "InvalidOutputIndex";
|
|
533
|
+
readonly inputs: readonly [{
|
|
534
|
+
readonly name: "provided";
|
|
535
|
+
readonly type: "uint256";
|
|
536
|
+
readonly internalType: "uint256";
|
|
537
|
+
}, {
|
|
538
|
+
readonly name: "maxValid";
|
|
539
|
+
readonly type: "uint256";
|
|
540
|
+
readonly internalType: "uint256";
|
|
541
|
+
}];
|
|
542
|
+
}, {
|
|
543
|
+
readonly type: "error";
|
|
544
|
+
readonly name: "TooManyHtlcOutputs";
|
|
545
|
+
readonly inputs: readonly [{
|
|
546
|
+
readonly name: "outputCount";
|
|
547
|
+
readonly type: "uint256";
|
|
548
|
+
readonly internalType: "uint256";
|
|
549
|
+
}, {
|
|
550
|
+
readonly name: "maxAllowed";
|
|
551
|
+
readonly type: "uint256";
|
|
552
|
+
readonly internalType: "uint256";
|
|
553
|
+
}];
|
|
554
|
+
}, {
|
|
555
|
+
readonly type: "error";
|
|
556
|
+
readonly name: "VaultBelowMinimum";
|
|
557
|
+
readonly inputs: readonly [{
|
|
558
|
+
readonly name: "actual";
|
|
559
|
+
readonly type: "uint256";
|
|
560
|
+
readonly internalType: "uint256";
|
|
561
|
+
}, {
|
|
562
|
+
readonly name: "minimum";
|
|
563
|
+
readonly type: "uint256";
|
|
564
|
+
readonly internalType: "uint256";
|
|
565
|
+
}];
|
|
566
|
+
}, {
|
|
567
|
+
readonly type: "error";
|
|
568
|
+
readonly name: "VaultAboveMaximum";
|
|
569
|
+
readonly inputs: readonly [{
|
|
570
|
+
readonly name: "actual";
|
|
571
|
+
readonly type: "uint256";
|
|
572
|
+
readonly internalType: "uint256";
|
|
573
|
+
}, {
|
|
574
|
+
readonly name: "maximum";
|
|
575
|
+
readonly type: "uint256";
|
|
576
|
+
readonly internalType: "uint256";
|
|
577
|
+
}];
|
|
578
|
+
}, {
|
|
579
|
+
readonly type: "error";
|
|
580
|
+
readonly name: "InvalidBTCPublicKey";
|
|
581
|
+
readonly inputs: readonly [];
|
|
582
|
+
}, {
|
|
583
|
+
readonly type: "error";
|
|
584
|
+
readonly name: "InvalidDepositorWotsPkHash";
|
|
585
|
+
readonly inputs: readonly [];
|
|
586
|
+
}, {
|
|
587
|
+
readonly type: "error";
|
|
588
|
+
readonly name: "InvalidBTCProofOfPossession";
|
|
589
|
+
readonly inputs: readonly [];
|
|
590
|
+
}, {
|
|
591
|
+
readonly type: "error";
|
|
592
|
+
readonly name: "EthKeyAlreadyRegistered";
|
|
593
|
+
readonly inputs: readonly [];
|
|
594
|
+
}, {
|
|
595
|
+
readonly type: "error";
|
|
596
|
+
readonly name: "BtcKeyAlreadyRegistered";
|
|
597
|
+
readonly inputs: readonly [];
|
|
598
|
+
}, {
|
|
599
|
+
readonly type: "error";
|
|
600
|
+
readonly name: "InvalidRegistrationFee";
|
|
601
|
+
readonly inputs: readonly [];
|
|
602
|
+
}, {
|
|
603
|
+
readonly type: "error";
|
|
604
|
+
readonly name: "CommissionBelowMinimum";
|
|
605
|
+
readonly inputs: readonly [{
|
|
606
|
+
readonly name: "provided";
|
|
607
|
+
readonly type: "uint16";
|
|
608
|
+
readonly internalType: "uint16";
|
|
609
|
+
}, {
|
|
610
|
+
readonly name: "minimum";
|
|
611
|
+
readonly type: "uint16";
|
|
612
|
+
readonly internalType: "uint16";
|
|
613
|
+
}];
|
|
614
|
+
}, {
|
|
615
|
+
readonly type: "error";
|
|
616
|
+
readonly name: "CommissionAboveMaximum";
|
|
617
|
+
readonly inputs: readonly [{
|
|
618
|
+
readonly name: "provided";
|
|
619
|
+
readonly type: "uint16";
|
|
620
|
+
readonly internalType: "uint16";
|
|
621
|
+
}];
|
|
622
|
+
}, {
|
|
623
|
+
readonly type: "error";
|
|
624
|
+
readonly name: "CommissionUnchanged";
|
|
625
|
+
readonly inputs: readonly [];
|
|
626
|
+
}, {
|
|
627
|
+
readonly type: "error";
|
|
628
|
+
readonly name: "VaultProviderCommissionExceeded";
|
|
629
|
+
readonly inputs: readonly [{
|
|
630
|
+
readonly name: "maxAcceptable";
|
|
631
|
+
readonly type: "uint16";
|
|
632
|
+
readonly internalType: "uint16";
|
|
633
|
+
}, {
|
|
634
|
+
readonly name: "actual";
|
|
635
|
+
readonly type: "uint16";
|
|
636
|
+
readonly internalType: "uint16";
|
|
637
|
+
}];
|
|
638
|
+
}, {
|
|
639
|
+
readonly type: "error";
|
|
640
|
+
readonly name: "VaultProviderNotRegistered";
|
|
641
|
+
readonly inputs: readonly [];
|
|
642
|
+
}, {
|
|
643
|
+
readonly type: "error";
|
|
644
|
+
readonly name: "ApplicationAlreadyRegistered";
|
|
645
|
+
readonly inputs: readonly [];
|
|
646
|
+
}, {
|
|
647
|
+
readonly type: "error";
|
|
648
|
+
readonly name: "ApplicationNotRegistered";
|
|
649
|
+
readonly inputs: readonly [];
|
|
650
|
+
}, {
|
|
651
|
+
readonly type: "error";
|
|
652
|
+
readonly name: "ApplicationNotActive";
|
|
653
|
+
readonly inputs: readonly [];
|
|
654
|
+
}, {
|
|
655
|
+
readonly type: "error";
|
|
656
|
+
readonly name: "InvalidApplicationStatus";
|
|
657
|
+
readonly inputs: readonly [];
|
|
658
|
+
}, {
|
|
659
|
+
readonly type: "error";
|
|
660
|
+
readonly name: "OnlyApplicationEntryPoint";
|
|
661
|
+
readonly inputs: readonly [];
|
|
662
|
+
}, {
|
|
663
|
+
readonly type: "error";
|
|
664
|
+
readonly name: "EmptyVaultKeepers";
|
|
665
|
+
readonly inputs: readonly [];
|
|
666
|
+
}, {
|
|
667
|
+
readonly type: "error";
|
|
668
|
+
readonly name: "NoUniversalChallengersConfigured";
|
|
669
|
+
readonly inputs: readonly [];
|
|
670
|
+
}, {
|
|
671
|
+
readonly type: "error";
|
|
672
|
+
readonly name: "NoAppVaultKeepersConfigured";
|
|
673
|
+
readonly inputs: readonly [];
|
|
674
|
+
}, {
|
|
675
|
+
readonly type: "error";
|
|
676
|
+
readonly name: "PeginSignaturesIncomplete";
|
|
677
|
+
readonly inputs: readonly [];
|
|
678
|
+
}, {
|
|
679
|
+
readonly type: "error";
|
|
680
|
+
readonly name: "InvalidSignatureLength";
|
|
681
|
+
readonly inputs: readonly [];
|
|
682
|
+
}, {
|
|
683
|
+
readonly type: "error";
|
|
684
|
+
readonly name: "PeginInputSignatureAlreadySubmitted";
|
|
685
|
+
readonly inputs: readonly [];
|
|
686
|
+
}, {
|
|
687
|
+
readonly type: "error";
|
|
688
|
+
readonly name: "InvalidHashlock";
|
|
689
|
+
readonly inputs: readonly [];
|
|
690
|
+
}, {
|
|
691
|
+
readonly type: "error";
|
|
692
|
+
readonly name: "DuplicateHashlock";
|
|
693
|
+
readonly inputs: readonly [];
|
|
694
|
+
}, {
|
|
695
|
+
readonly type: "error";
|
|
696
|
+
readonly name: "InvalidSecret";
|
|
697
|
+
readonly inputs: readonly [];
|
|
698
|
+
}, {
|
|
699
|
+
readonly type: "error";
|
|
700
|
+
readonly name: "ActivationDeadlineExpired";
|
|
701
|
+
readonly inputs: readonly [];
|
|
702
|
+
}, {
|
|
703
|
+
readonly type: "error";
|
|
704
|
+
readonly name: "PostExpiryGraceWindowElapsed";
|
|
705
|
+
readonly inputs: readonly [];
|
|
706
|
+
}, {
|
|
707
|
+
readonly type: "error";
|
|
708
|
+
readonly name: "CapExceeded";
|
|
709
|
+
readonly inputs: readonly [];
|
|
418
710
|
}];
|
|
419
711
|
//# sourceMappingURL=BTCVaultRegistry.abi.d.ts.map
|