@babylonlabs-io/ts-sdk 3.0.0 → 3.0.2

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.
Files changed (112) hide show
  1. package/dist/{PeginManager-CKf7Bjmj.js → PeginManager-D8WGB8eN.js} +2 -2
  2. package/dist/{PeginManager-CKf7Bjmj.js.map → PeginManager-D8WGB8eN.js.map} +1 -1
  3. package/dist/{PeginManager-Dt2Z5ljw.cjs → PeginManager-IgDHy_eU.cjs} +2 -2
  4. package/dist/{PeginManager-Dt2Z5ljw.cjs.map → PeginManager-IgDHy_eU.cjs.map} +1 -1
  5. package/dist/buildAndBroadcastReclaim-B8aFMGf-.cjs +2 -0
  6. package/dist/buildAndBroadcastReclaim-B8aFMGf-.cjs.map +1 -0
  7. package/dist/{buildAndBroadcastReclaim-T5ZFPUpM.js → buildAndBroadcastReclaim-D5520lbL.js} +1015 -935
  8. package/dist/buildAndBroadcastReclaim-D5520lbL.js.map +1 -0
  9. package/dist/index-D2mybjXD.js +522 -0
  10. package/dist/index-D2mybjXD.js.map +1 -0
  11. package/dist/index-MRdle0fs.cjs +2 -0
  12. package/dist/index-MRdle0fs.cjs.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +215 -214
  15. package/dist/pegin-registration-client-B0j6ugt9.cjs +2 -0
  16. package/dist/pegin-registration-client-B0j6ugt9.cjs.map +1 -0
  17. package/dist/{pegin-registration-client-C5Hktrja.js → pegin-registration-client-ilkV1mLP.js} +103 -88
  18. package/dist/pegin-registration-client-ilkV1mLP.js.map +1 -0
  19. package/dist/primeVpAuth-BDWBKYhv.cjs +2 -0
  20. package/dist/primeVpAuth-BDWBKYhv.cjs.map +1 -0
  21. package/dist/primeVpAuth-D0ZnsjRi.js +805 -0
  22. package/dist/primeVpAuth-D0ZnsjRi.js.map +1 -0
  23. package/dist/state-C4WoNCy1.cjs +2 -0
  24. package/dist/state-C4WoNCy1.cjs.map +1 -0
  25. package/dist/{state-mE-QfITd.js → state-CFn1rT74.js} +128 -101
  26. package/dist/state-CFn1rT74.js.map +1 -0
  27. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  28. package/dist/tbv/core/clients/eth/index.js +2 -2
  29. package/dist/tbv/core/clients/eth/types.d.ts +12 -5
  30. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  31. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +12 -3
  32. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  33. package/dist/tbv/core/clients/index.cjs +1 -1
  34. package/dist/tbv/core/clients/index.js +52 -51
  35. package/dist/tbv/core/clients/mempool/index.cjs +1 -1
  36. package/dist/tbv/core/clients/mempool/index.cjs.map +1 -1
  37. package/dist/tbv/core/clients/mempool/index.d.ts +1 -1
  38. package/dist/tbv/core/clients/mempool/index.d.ts.map +1 -1
  39. package/dist/tbv/core/clients/mempool/index.js +85 -71
  40. package/dist/tbv/core/clients/mempool/index.js.map +1 -1
  41. package/dist/tbv/core/clients/mempool/mempoolApi.d.ts +10 -0
  42. package/dist/tbv/core/clients/mempool/mempoolApi.d.ts.map +1 -1
  43. package/dist/tbv/core/clients/vault-provider/api.d.ts +17 -14
  44. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  45. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts +8 -0
  46. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts.map +1 -1
  47. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +1 -1
  48. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -1
  49. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts +8 -0
  50. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts.map +1 -1
  51. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +18 -2
  52. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
  53. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts +26 -6
  54. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -1
  55. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts +17 -15
  56. package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts.map +1 -1
  57. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts +15 -9
  58. package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts.map +1 -1
  59. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +3 -2
  60. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
  61. package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
  62. package/dist/tbv/core/clients/vault-provider/status/index.js +2 -2
  63. package/dist/tbv/core/clients/vault-provider/types.d.ts +36 -23
  64. package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
  65. package/dist/tbv/core/clients/vault-provider/validators.d.ts +12 -4
  66. package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
  67. package/dist/tbv/core/index.cjs +1 -1
  68. package/dist/tbv/core/index.js +213 -212
  69. package/dist/tbv/core/managers/index.cjs +1 -1
  70. package/dist/tbv/core/managers/index.js +1 -1
  71. package/dist/tbv/core/services/deposit/graphFingerprint.d.ts +39 -0
  72. package/dist/tbv/core/services/deposit/graphFingerprint.d.ts.map +1 -1
  73. package/dist/tbv/core/services/deposit/interfaces.d.ts +2 -2
  74. package/dist/tbv/core/services/deposit/interfaces.d.ts.map +1 -1
  75. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +3 -1
  76. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
  77. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  78. package/dist/tbv/core/services/deposit/submitWotsPublicKey.d.ts +3 -1
  79. package/dist/tbv/core/services/deposit/submitWotsPublicKey.d.ts.map +1 -1
  80. package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts +11 -2
  81. package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts.map +1 -1
  82. package/dist/tbv/core/services/index.cjs +1 -1
  83. package/dist/tbv/core/services/index.js +2 -2
  84. package/dist/tbv/core/services/pegout/state.d.ts +2 -2
  85. package/dist/tbv/index.cjs +1 -1
  86. package/dist/tbv/index.js +213 -212
  87. package/dist/{toRefundInputs-DIIdhjvu.js → toRefundInputs-10RYIfh1.js} +2 -2
  88. package/dist/{toRefundInputs-DIIdhjvu.js.map → toRefundInputs-10RYIfh1.js.map} +1 -1
  89. package/dist/{toRefundInputs-B_GlIXjk.cjs → toRefundInputs-a-0HRyrl.cjs} +2 -2
  90. package/dist/{toRefundInputs-B_GlIXjk.cjs.map → toRefundInputs-a-0HRyrl.cjs.map} +1 -1
  91. package/dist/{types-DJxOEU3P.cjs → types-BueQoMjO.cjs} +2 -2
  92. package/dist/{types-DJxOEU3P.cjs.map → types-BueQoMjO.cjs.map} +1 -1
  93. package/dist/{types-Dz1kVqn6.js → types-DGkejGZH.js} +2 -2
  94. package/dist/{types-Dz1kVqn6.js.map → types-DGkejGZH.js.map} +1 -1
  95. package/package.json +3 -3
  96. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs +0 -2
  97. package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs.map +0 -1
  98. package/dist/buildAndBroadcastReclaim-T5ZFPUpM.js.map +0 -1
  99. package/dist/index-B6w5MM-8.js +0 -528
  100. package/dist/index-B6w5MM-8.js.map +0 -1
  101. package/dist/index-EHLYplSd.cjs +0 -2
  102. package/dist/index-EHLYplSd.cjs.map +0 -1
  103. package/dist/pegin-registration-client-BdJ6c7si.cjs +0 -2
  104. package/dist/pegin-registration-client-BdJ6c7si.cjs.map +0 -1
  105. package/dist/pegin-registration-client-C5Hktrja.js.map +0 -1
  106. package/dist/primeVpAuth-Bdy_B_Sq.js +0 -745
  107. package/dist/primeVpAuth-Bdy_B_Sq.js.map +0 -1
  108. package/dist/primeVpAuth-CQRsu6VB.cjs +0 -2
  109. package/dist/primeVpAuth-CQRsu6VB.cjs.map +0 -1
  110. package/dist/state-DMFlvLL3.cjs +0 -2
  111. package/dist/state-DMFlvLL3.cjs.map +0 -1
  112. package/dist/state-mE-QfITd.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/tbv/core/clients/mempool/mempoolApi.ts"],"sourcesContent":["/**\n * Mempool API Client\n *\n * Client for interacting with mempool.space API for Bitcoin network operations.\n * Used for broadcasting transactions and fetching UTXO data.\n *\n * @module clients/mempool/mempoolApi\n */\n\nimport { combineAbortSignals } from \"../../utils/abortSignals\";\nimport {\n BITCOIN_ADDRESS_RE,\n HEX_RE,\n KNOWN_SCRIPT_PREFIXES,\n TXID_RE,\n} from \"../../utils/validation\";\n\nimport type {\n MempoolUTXO,\n NetworkFees,\n OutspendStatus,\n TxInfo,\n UtxoInfo,\n} from \"./types\";\n\n/** Maximum valid satoshi value: 21 million BTC × 10^8 sats/BTC */\nconst MAX_SATOSHIS = 21_000_000 * 1e8;\n\n/** Timeout for mempool API requests — prevents indefinite hangs from stalled endpoints */\nconst MEMPOOL_REQUEST_TIMEOUT_MS = 30_000;\n\n/**\n * Fetch wrapper with AbortController-based timeout.\n * Ensures all mempool API requests fail bounded rather than hanging indefinitely.\n */\nasync function fetchWithTimeout(\n url: string,\n options?: RequestInit,\n): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n MEMPOOL_REQUEST_TIMEOUT_MS,\n );\n\n // Compose timeout signal with any caller-supplied signal so both can cancel\n const signals = [controller.signal, options?.signal].filter(\n Boolean,\n ) as AbortSignal[];\n const combined = combineAbortSignals(signals);\n\n try {\n // Don't clear timeout here — let it cover body consumption by callers.\n // For the same reason the composed signal keeps its listeners attached on\n // the success path: detaching them would stop the timeout from aborting a\n // stalled body read.\n return await fetch(url, {\n ...options,\n signal: combined.signal,\n });\n } catch (error) {\n clearTimeout(timeoutId);\n combined.cleanup();\n if (\n error != null &&\n typeof error === \"object\" &&\n \"name\" in error &&\n error.name === \"AbortError\"\n ) {\n throw new Error(\n `Mempool API request timed out after ${MEMPOOL_REQUEST_TIMEOUT_MS}ms: ${url}`,\n );\n }\n throw error;\n }\n}\n\n/**\n * Maximum sane fee rate in sat/vByte.\n * The April 2024 Runes spike peaked around 1,805 sat/vB — 10,000 provides ample headroom.\n */\nconst MAX_FEE_RATE = 10_000;\n\nfunction isValidSatoshiValue(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_SATOSHIS;\n}\n\nfunction isValidFeeRate(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_FEE_RATE;\n}\n\nfunction isValidVout(vout: number, outputCount?: number): boolean {\n if (!Number.isInteger(vout) || vout < 0) return false;\n return outputCount === undefined || vout < outputCount;\n}\n\n\nfunction assertValidTxid(txid: string): void {\n if (!TXID_RE.test(txid)) {\n throw new Error(`Invalid transaction ID format: ${txid}`);\n }\n}\n\nfunction assertValidAddress(address: string): void {\n if (!BITCOIN_ADDRESS_RE.test(address)) {\n throw new Error(`Invalid Bitcoin address format: ${address}`);\n }\n}\n\nfunction assertValidScriptPubKey(scriptPubKey: string, context: string): void {\n if (!HEX_RE.test(scriptPubKey)) {\n throw new Error(\n `Invalid scriptPubKey: not valid hex for ${context}`,\n );\n }\n const matchesKnownType = KNOWN_SCRIPT_PREFIXES.some((prefix) =>\n scriptPubKey.toLowerCase().startsWith(prefix),\n );\n if (!matchesKnownType) {\n throw new Error(\n `Unrecognized scriptPubKey type for ${context}: ` +\n `prefix ${scriptPubKey.slice(0, 6)} does not match any known Bitcoin script type`,\n );\n }\n}\n\n/**\n * Default mempool API URLs by network.\n */\nexport const MEMPOOL_API_URLS = {\n mainnet: \"https://mempool.space/api\",\n testnet: \"https://mempool.space/testnet/api\",\n signet: \"https://mempool.space/signet/api\",\n} as const;\n\n/**\n * Fetch wrapper with error handling.\n */\nasync function fetchApi<T>(\n url: string,\n options?: RequestInit,\n): Promise<T> {\n try {\n const response = await fetchWithTimeout(url, options);\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n const contentType = response.headers.get(\"content-type\");\n if (contentType?.includes(\"application/json\")) {\n return (await response.json()) as T;\n } else {\n return (await response.text()) as T;\n }\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to fetch from mempool API: ${error.message}`);\n }\n throw new Error(\"Failed to fetch from mempool API: Unknown error\");\n }\n}\n\n/**\n * Push a signed transaction to the Bitcoin network.\n *\n * @param txHex - The signed transaction hex string\n * @param apiUrl - Mempool API base URL\n * @returns The transaction ID\n * @throws Error if broadcasting fails\n */\nexport async function pushTx(txHex: string, apiUrl: string): Promise<string> {\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx`, {\n method: \"POST\",\n body: txHex,\n headers: {\n \"Content-Type\": \"text/plain\",\n },\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n // Try to extract error message from response using robust JSON parsing\n let message: string | undefined;\n try {\n const errorJson = JSON.parse(errorText);\n message = errorJson.message ?? errorJson.error;\n } catch {\n // Not JSON, use raw text\n message = errorText;\n }\n throw new Error(\n message || `Failed to broadcast transaction: ${response.statusText}`,\n );\n }\n\n // Response is the transaction ID (plain text)\n const txId = await response.text();\n return txId;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to broadcast BTC transaction: ${error.message}`);\n }\n throw new Error(\"Failed to broadcast BTC transaction: Unknown error\");\n }\n}\n\n/**\n * Get transaction information from mempool.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns Transaction information\n */\nexport async function getTxInfo(txid: string, apiUrl: string): Promise<TxInfo> {\n assertValidTxid(txid);\n return fetchApi<TxInfo>(`${apiUrl}/tx/${txid}`);\n}\n\n/**\n * Get the current block tip height.\n *\n * Source: mempool.space API — `GET /api/blocks/tip/height` returns the height\n * of the most recent block as a plain-text integer.\n *\n * The digit check alone is not enough to honour the contract below. A long\n * enough run of digits passes `/^\\d+$/` and then parses to a value no caller\n * can use: 400 digits yields `Infinity`, and 20 digits yields a finite but\n * unsafe integer. Callers subtract this from a confirmed block height to get a\n * confirmation depth, so either one produces an enormous depth and clears any\n * threshold it is compared against. Bound it to a safe integer here rather\n * than leaving each caller to discover the gap.\n *\n * @param apiUrl - Mempool API base URL\n * @returns The height of the most recent block\n * @throws Error if the response is not a whole number a caller can compute on\n */\nexport async function getTipHeight(apiUrl: string): Promise<number> {\n const raw = await fetchApi<string>(`${apiUrl}/blocks/tip/height`);\n const trimmed = raw.trim();\n const height = /^\\d+$/.test(trimmed) ? Number.parseInt(trimmed, 10) : NaN;\n if (!Number.isSafeInteger(height) || height < 0) {\n throw new Error(\n `Mempool API returned an invalid block tip height: \"${raw}\"`,\n );\n }\n return height;\n}\n\n/**\n * Get the spend status of a specific transaction output.\n *\n * Calls the esplora-compatible `GET /tx/{txid}/outspend/{vout}` endpoint\n * (mempool.space backend, mempool/electrs `rest.rs`). Returns\n * `{ spent: false }` for an unspent output, or\n * `{ spent: true, txid, vin, status }` when the output has been spent.\n *\n * @param txid - The transaction id whose output is being checked (no 0x prefix)\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns The output's spend status\n */\nexport async function getOutspend(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<OutspendStatus> {\n assertValidTxid(txid);\n if (!isValidVout(vout)) {\n throw new Error(`Invalid vout ${vout} for transaction ${txid}`);\n }\n return fetchApi<OutspendStatus>(`${apiUrl}/tx/${txid}/outspend/${vout}`);\n}\n\n/**\n * Get the hex representation of a transaction.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns The transaction hex string\n * @throws Error if the request fails or transaction is not found\n */\nexport async function getTxHex(txid: string, apiUrl: string): Promise<string> {\n assertValidTxid(txid);\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx/${txid}/hex`);\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n return await response.text();\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to get transaction hex for ${txid}: ${error.message}`);\n }\n throw new Error(`Failed to get transaction hex for ${txid}: Unknown error`);\n }\n}\n\n/**\n * Get UTXO information for a specific transaction output.\n *\n * This is used for constructing PSBTs where we need the witnessUtxo data.\n * Only supports Taproot (P2TR) and native SegWit (P2WPKH, P2WSH) script types.\n *\n * @param txid - The transaction ID containing the UTXO\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns UTXO information with value and scriptPubKey\n */\nexport async function getUtxoInfo(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<UtxoInfo> {\n assertValidTxid(txid);\n const txInfo = await getTxInfo(txid, apiUrl);\n\n if (!isValidVout(vout, txInfo.vout.length)) {\n throw new Error(\n `Invalid vout ${vout} for transaction ${txid} (has ${txInfo.vout.length} outputs)`,\n );\n }\n\n const output = txInfo.vout[vout];\n if (!isValidSatoshiValue(output.value)) {\n throw new Error(`Invalid UTXO value ${output.value} for ${txid}:${vout}`);\n }\n assertValidScriptPubKey(output.scriptpubkey, `${txid}:${vout}`);\n\n return {\n txid,\n vout,\n value: output.value,\n scriptPubKey: output.scriptpubkey,\n };\n}\n\n/**\n * Get all UTXOs for a Bitcoin address.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of UTXOs sorted by value (largest first)\n */\nexport async function getAddressUtxos(\n address: string,\n apiUrl: string,\n): Promise<MempoolUTXO[]> {\n assertValidAddress(address);\n try {\n // Fetch UTXOs for the address\n const utxos = await fetchApi<\n {\n txid: string;\n vout: number;\n value: number;\n status: {\n confirmed: boolean;\n };\n }[]\n >(`${apiUrl}/address/${address}/utxo`);\n\n // Fetch scriptPubKey for the address\n const addressInfo = await fetchApi<{\n isvalid: boolean;\n scriptPubKey: string;\n }>(`${apiUrl}/v1/validate-address/${address}`);\n\n if (!addressInfo.isvalid) {\n throw new Error(\n `Invalid Bitcoin address: ${address}. Mempool API validation failed.`,\n );\n }\n assertValidScriptPubKey(addressInfo.scriptPubKey, address);\n\n // Validate UTXO fields from the listing endpoint.\n // Per-UTXO cross-verification against /tx/{txid} is intentionally NOT done\n // here — it would be expensive (N API calls) and redundant: the broadcast\n // path already verifies each selected input via getUtxoInfo before signing.\n // Both endpoints come from the same mempool API, so cross-checking one\n // against the other on the same server does not add real security.\n for (const utxo of utxos) {\n assertValidTxid(utxo.txid);\n if (!isValidVout(utxo.vout)) {\n throw new Error(`Invalid vout ${utxo.vout} for ${utxo.txid}`);\n }\n if (!isValidSatoshiValue(utxo.value)) {\n throw new Error(\n `Invalid UTXO value ${utxo.value} for ${utxo.txid}:${utxo.vout}`,\n );\n }\n }\n\n // Sort by value (largest first) and map to our UTXO format\n const sortedUTXOs = utxos.sort((a, b) => b.value - a.value);\n\n return sortedUTXOs.map((utxo) => ({\n txid: utxo.txid,\n vout: utxo.vout,\n value: utxo.value,\n scriptPubKey: addressInfo.scriptPubKey,\n confirmed: utxo.status.confirmed,\n }));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(\n `Failed to get UTXOs for address ${address}: ${error.message}`,\n );\n }\n throw new Error(\n `Failed to get UTXOs for address ${address}: Unknown error`,\n );\n }\n}\n\n/**\n * Get the mempool API URL for a given network.\n *\n * @param network - Bitcoin network (mainnet, testnet, signet)\n * @returns The mempool API URL\n */\nexport function getMempoolApiUrl(\n network: \"mainnet\" | \"testnet\" | \"signet\",\n): string {\n return MEMPOOL_API_URLS[network];\n}\n\n/**\n * Transaction summary from address transactions endpoint.\n */\nexport interface AddressTx {\n txid: string;\n status: {\n confirmed: boolean;\n block_height?: number;\n };\n}\n\n/**\n * Get recent transactions for a Bitcoin address.\n *\n * Returns the last 25 confirmed transactions plus any unconfirmed (mempool) transactions.\n * This is useful for checking if a specific transaction has been broadcast.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of recent transactions\n */\nexport async function getAddressTxs(\n address: string,\n apiUrl: string,\n): Promise<AddressTx[]> {\n assertValidAddress(address);\n return fetchApi<AddressTx[]>(`${apiUrl}/address/${address}/txs`);\n}\n\n/**\n * Fetches Bitcoin network fee recommendations from mempool.space API.\n *\n * @param apiUrl - Mempool API base URL\n * @returns Fee rates in sat/vbyte for different confirmation times\n * @throws Error if request fails or returns invalid data\n *\n * @see https://mempool.space/docs/api/rest#get-recommended-fees\n */\nexport async function getNetworkFees(apiUrl: string): Promise<NetworkFees> {\n const response = await fetchWithTimeout(`${apiUrl}/v1/fees/recommended`);\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch network fees: ${response.status} ${response.statusText}`,\n );\n }\n\n const data = await response.json();\n\n const feeFields = [\n \"fastestFee\",\n \"halfHourFee\",\n \"hourFee\",\n \"economyFee\",\n \"minimumFee\",\n ] as const;\n\n for (const field of feeFields) {\n if (!isValidFeeRate(data[field])) {\n throw new Error(\n `Invalid fee rate ${field}=${data[field]} from mempool API: expected a positive number ≤ ${MAX_FEE_RATE}`,\n );\n }\n }\n\n if (\n data.minimumFee > data.economyFee ||\n data.economyFee > data.hourFee ||\n data.hourFee > data.halfHourFee ||\n data.halfHourFee > data.fastestFee\n ) {\n throw new Error(\n `Fee rate ordering violation from mempool API: expected ` +\n `minimumFee (${data.minimumFee}) <= economyFee (${data.economyFee}) <= ` +\n `hourFee (${data.hourFee}) <= halfHourFee (${data.halfHourFee}) <= ` +\n `fastestFee (${data.fastestFee}).`,\n );\n }\n\n return data as NetworkFees;\n}\n\n"],"names":["MAX_SATOSHIS","MEMPOOL_REQUEST_TIMEOUT_MS","fetchWithTimeout","url","options","controller","timeoutId","signals","combined","combineAbortSignals","error","MAX_FEE_RATE","isValidSatoshiValue","value","isValidFeeRate","isValidVout","vout","outputCount","assertValidTxid","txid","TXID_RE","assertValidAddress","address","BITCOIN_ADDRESS_RE","assertValidScriptPubKey","scriptPubKey","context","HEX_RE","KNOWN_SCRIPT_PREFIXES","prefix","MEMPOOL_API_URLS","fetchApi","response","errorText","contentType","pushTx","txHex","apiUrl","message","errorJson","getTxInfo","getTipHeight","raw","trimmed","height","getOutspend","getTxHex","getUtxoInfo","txInfo","output","getAddressUtxos","utxos","addressInfo","utxo","a","b","getMempoolApiUrl","network","getAddressTxs","getNetworkFees","data","feeFields","field"],"mappings":";;AA0BA,MAAMA,IAAe,OAAa,KAG5BC,IAA6B;AAMnC,eAAeC,EACbC,GACAC,GACmB;AACnB,QAAMC,IAAa,IAAI,gBAAA,GACjBC,IAAY;AAAA,IAChB,MAAMD,EAAW,MAAA;AAAA,IACjBJ;AAAA,EAAA,GAIIM,IAAU,CAACF,EAAW,QAAQD,KAAA,gBAAAA,EAAS,MAAM,EAAE;AAAA,IACnD;AAAA,EAAA,GAEII,IAAWC,EAAoBF,CAAO;AAE5C,MAAI;AAKF,WAAO,MAAM,MAAMJ,GAAK;AAAA,MACtB,GAAGC;AAAA,MACH,QAAQI,EAAS;AAAA,IAAA,CAClB;AAAA,EACH,SAASE,GAAO;AAGd,UAFA,aAAaJ,CAAS,GACtBE,EAAS,QAAA,GAEPE,KAAS,QACT,OAAOA,KAAU,YACjB,UAAUA,KACVA,EAAM,SAAS,eAET,IAAI;AAAA,MACR,uCAAuCT,CAA0B,OAAOE,CAAG;AAAA,IAAA,IAGzEO;AAAA,EACR;AACF;AAMA,MAAMC,IAAe;AAErB,SAASC,EAAoBC,GAAwB;AACnD,SAAO,OAAO,UAAUA,CAAK,KAAKA,IAAQ,KAAKA,KAASb;AAC1D;AAEA,SAASc,EAAeD,GAAwB;AAC9C,SAAO,OAAO,UAAUA,CAAK,KAAKA,IAAQ,KAAKA,KAASF;AAC1D;AAEA,SAASI,EAAYC,GAAcC,GAA+B;AAChE,SAAI,CAAC,OAAO,UAAUD,CAAI,KAAKA,IAAO,IAAU,KACzCC,MAAgB,UAAaD,IAAOC;AAC7C;AAGA,SAASC,EAAgBC,GAAoB;AAC3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B,GAAsC;AACzE,QAAML,IAAW,MAAM9B,EAAiB,GAAGmC,CAAM,sBAAsB;AAEvE,MAAI,CAACL,EAAS;AACZ,UAAM,IAAI;AAAA,MACR,iCAAiCA,EAAS,MAAM,IAAIA,EAAS,UAAU;AAAA,IAAA;AAI3E,QAAM4B,IAAO,MAAM5B,EAAS,KAAA,GAEtB6B,IAAY;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,aAAWC,KAASD;AAClB,QAAI,CAAC/C,EAAe8C,EAAKE,CAAK,CAAC;AAC7B,YAAM,IAAI;AAAA,QACR,oBAAoBA,CAAK,IAAIF,EAAKE,CAAK,CAAC,mDAAmDnD,CAAY;AAAA,MAAA;AAK7G,MACEiD,EAAK,aAAaA,EAAK,cACvBA,EAAK,aAAaA,EAAK,WACvBA,EAAK,UAAUA,EAAK,eACpBA,EAAK,cAAcA,EAAK;AAExB,UAAM,IAAI;AAAA,MACR,sEACiBA,EAAK,UAAU,oBAAoBA,EAAK,UAAU,iBACrDA,EAAK,OAAO,qBAAqBA,EAAK,WAAW,oBAC9CA,EAAK,UAAU;AAAA,IAAA;AAIpC,SAAOA;AACT;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/tbv/core/clients/mempool/mempoolApi.ts"],"sourcesContent":["/**\n * Mempool API Client\n *\n * Client for interacting with mempool.space API for Bitcoin network operations.\n * Used for broadcasting transactions and fetching UTXO data.\n *\n * @module clients/mempool/mempoolApi\n */\n\nimport { combineAbortSignals } from \"../../utils/abortSignals\";\nimport {\n BITCOIN_ADDRESS_RE,\n HEX_RE,\n KNOWN_SCRIPT_PREFIXES,\n TXID_RE,\n} from \"../../utils/validation\";\n\nimport type {\n MempoolUTXO,\n NetworkFees,\n OutspendStatus,\n TxInfo,\n UtxoInfo,\n} from \"./types\";\n\n/** Maximum valid satoshi value: 21 million BTC × 10^8 sats/BTC */\nconst MAX_SATOSHIS = 21_000_000 * 1e8;\n\n/** Timeout for mempool API requests — prevents indefinite hangs from stalled endpoints */\nconst MEMPOOL_REQUEST_TIMEOUT_MS = 30_000;\n\n/** HTTP status the mempool API answers for an unknown transaction or resource */\nconst HTTP_NOT_FOUND = 404;\n\n/**\n * Fetch wrapper with AbortController-based timeout.\n * Ensures all mempool API requests fail bounded rather than hanging indefinitely.\n */\nasync function fetchWithTimeout(\n url: string,\n options?: RequestInit,\n): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n MEMPOOL_REQUEST_TIMEOUT_MS,\n );\n\n // Compose timeout signal with any caller-supplied signal so both can cancel\n const signals = [controller.signal, options?.signal].filter(\n Boolean,\n ) as AbortSignal[];\n const combined = combineAbortSignals(signals);\n\n try {\n // Don't clear timeout here — let it cover body consumption by callers.\n // For the same reason the composed signal keeps its listeners attached on\n // the success path: detaching them would stop the timeout from aborting a\n // stalled body read.\n return await fetch(url, {\n ...options,\n signal: combined.signal,\n });\n } catch (error) {\n clearTimeout(timeoutId);\n combined.cleanup();\n if (\n error != null &&\n typeof error === \"object\" &&\n \"name\" in error &&\n error.name === \"AbortError\"\n ) {\n throw new Error(\n `Mempool API request timed out after ${MEMPOOL_REQUEST_TIMEOUT_MS}ms: ${url}`,\n );\n }\n throw error;\n }\n}\n\n/**\n * Maximum sane fee rate in sat/vByte.\n * The April 2024 Runes spike peaked around 1,805 sat/vB — 10,000 provides ample headroom.\n */\nconst MAX_FEE_RATE = 10_000;\n\nfunction isValidSatoshiValue(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_SATOSHIS;\n}\n\nfunction isValidFeeRate(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_FEE_RATE;\n}\n\nfunction isValidVout(vout: number, outputCount?: number): boolean {\n if (!Number.isInteger(vout) || vout < 0) return false;\n return outputCount === undefined || vout < outputCount;\n}\n\n\nfunction assertValidTxid(txid: string): void {\n if (!TXID_RE.test(txid)) {\n throw new Error(`Invalid transaction ID format: ${txid}`);\n }\n}\n\nfunction assertValidAddress(address: string): void {\n if (!BITCOIN_ADDRESS_RE.test(address)) {\n throw new Error(`Invalid Bitcoin address format: ${address}`);\n }\n}\n\nfunction assertValidScriptPubKey(scriptPubKey: string, context: string): void {\n if (!HEX_RE.test(scriptPubKey)) {\n throw new Error(\n `Invalid scriptPubKey: not valid hex for ${context}`,\n );\n }\n const matchesKnownType = KNOWN_SCRIPT_PREFIXES.some((prefix) =>\n scriptPubKey.toLowerCase().startsWith(prefix),\n );\n if (!matchesKnownType) {\n throw new Error(\n `Unrecognized scriptPubKey type for ${context}: ` +\n `prefix ${scriptPubKey.slice(0, 6)} does not match any known Bitcoin script type`,\n );\n }\n}\n\n/**\n * Default mempool API URLs by network.\n */\nexport const MEMPOOL_API_URLS = {\n mainnet: \"https://mempool.space/api\",\n testnet: \"https://mempool.space/testnet/api\",\n signet: \"https://mempool.space/signet/api\",\n} as const;\n\n/**\n * Thrown by `getTxInfo`, `getUtxoInfo`, `getTipHeight`, `getOutspend` and\n * `getAddressTxs` when the mempool API answers HTTP 404, for example for a\n * transaction it does not know. Their other failures throw a plain `Error`.\n */\nexport class MempoolNotFoundError extends Error {\n /** HTTP status of the failed response. */\n readonly status = HTTP_NOT_FOUND;\n\n constructor(message: string) {\n super(message);\n this.name = \"MempoolNotFoundError\";\n }\n}\n\n/**\n * Fetch wrapper with error handling.\n */\nasync function fetchApi<T>(\n url: string,\n options?: RequestInit,\n): Promise<T> {\n try {\n const response = await fetchWithTimeout(url, options);\n\n if (!response.ok) {\n const errorText = await response.text();\n const ErrorType =\n response.status === HTTP_NOT_FOUND ? MempoolNotFoundError : Error;\n throw new ErrorType(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n const contentType = response.headers.get(\"content-type\");\n if (contentType?.includes(\"application/json\")) {\n return (await response.json()) as T;\n } else {\n return (await response.text()) as T;\n }\n } catch (error) {\n if (error instanceof MempoolNotFoundError) {\n throw new MempoolNotFoundError(\n `Failed to fetch from mempool API: ${error.message}`,\n );\n }\n if (error instanceof Error) {\n throw new Error(`Failed to fetch from mempool API: ${error.message}`);\n }\n throw new Error(\"Failed to fetch from mempool API: Unknown error\");\n }\n}\n\n/**\n * Push a signed transaction to the Bitcoin network.\n *\n * @param txHex - The signed transaction hex string\n * @param apiUrl - Mempool API base URL\n * @returns The transaction ID\n * @throws Error if broadcasting fails\n */\nexport async function pushTx(txHex: string, apiUrl: string): Promise<string> {\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx`, {\n method: \"POST\",\n body: txHex,\n headers: {\n \"Content-Type\": \"text/plain\",\n },\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n // Try to extract error message from response using robust JSON parsing\n let message: string | undefined;\n try {\n const errorJson = JSON.parse(errorText);\n message = errorJson.message ?? errorJson.error;\n } catch {\n // Not JSON, use raw text\n message = errorText;\n }\n throw new Error(\n message || `Failed to broadcast transaction: ${response.statusText}`,\n );\n }\n\n // Response is the transaction ID (plain text)\n const txId = await response.text();\n return txId;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to broadcast BTC transaction: ${error.message}`);\n }\n throw new Error(\"Failed to broadcast BTC transaction: Unknown error\");\n }\n}\n\n/**\n * Get transaction information from mempool.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns Transaction information\n */\nexport async function getTxInfo(txid: string, apiUrl: string): Promise<TxInfo> {\n assertValidTxid(txid);\n return fetchApi<TxInfo>(`${apiUrl}/tx/${txid}`);\n}\n\n/**\n * Get the current block tip height.\n *\n * Source: mempool.space API — `GET /api/blocks/tip/height` returns the height\n * of the most recent block as a plain-text integer.\n *\n * The digit check alone is not enough to honour the contract below. A long\n * enough run of digits passes `/^\\d+$/` and then parses to a value no caller\n * can use: 400 digits yields `Infinity`, and 20 digits yields a finite but\n * unsafe integer. Callers subtract this from a confirmed block height to get a\n * confirmation depth, so either one produces an enormous depth and clears any\n * threshold it is compared against. Bound it to a safe integer here rather\n * than leaving each caller to discover the gap.\n *\n * @param apiUrl - Mempool API base URL\n * @returns The height of the most recent block\n * @throws Error if the response is not a whole number a caller can compute on\n */\nexport async function getTipHeight(apiUrl: string): Promise<number> {\n const raw = await fetchApi<string>(`${apiUrl}/blocks/tip/height`);\n const trimmed = raw.trim();\n const height = /^\\d+$/.test(trimmed) ? Number.parseInt(trimmed, 10) : NaN;\n if (!Number.isSafeInteger(height) || height < 0) {\n throw new Error(\n `Mempool API returned an invalid block tip height: \"${raw}\"`,\n );\n }\n return height;\n}\n\n/**\n * Get the spend status of a specific transaction output.\n *\n * Calls the esplora-compatible `GET /tx/{txid}/outspend/{vout}` endpoint\n * (mempool.space backend, mempool/electrs `rest.rs`). Returns\n * `{ spent: false }` for an unspent output, or\n * `{ spent: true, txid, vin, status }` when the output has been spent.\n *\n * @param txid - The transaction id whose output is being checked (no 0x prefix)\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns The output's spend status\n */\nexport async function getOutspend(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<OutspendStatus> {\n assertValidTxid(txid);\n if (!isValidVout(vout)) {\n throw new Error(`Invalid vout ${vout} for transaction ${txid}`);\n }\n return fetchApi<OutspendStatus>(`${apiUrl}/tx/${txid}/outspend/${vout}`);\n}\n\n/**\n * Get the hex representation of a transaction.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns The transaction hex string\n * @throws Error if the request fails or transaction is not found\n */\nexport async function getTxHex(txid: string, apiUrl: string): Promise<string> {\n assertValidTxid(txid);\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx/${txid}/hex`);\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n return await response.text();\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to get transaction hex for ${txid}: ${error.message}`);\n }\n throw new Error(`Failed to get transaction hex for ${txid}: Unknown error`);\n }\n}\n\n/**\n * Get UTXO information for a specific transaction output.\n *\n * This is used for constructing PSBTs where we need the witnessUtxo data.\n * Only supports Taproot (P2TR) and native SegWit (P2WPKH, P2WSH) script types.\n *\n * @param txid - The transaction ID containing the UTXO\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns UTXO information with value and scriptPubKey\n */\nexport async function getUtxoInfo(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<UtxoInfo> {\n assertValidTxid(txid);\n const txInfo = await getTxInfo(txid, apiUrl);\n\n if (!isValidVout(vout, txInfo.vout.length)) {\n throw new Error(\n `Invalid vout ${vout} for transaction ${txid} (has ${txInfo.vout.length} outputs)`,\n );\n }\n\n const output = txInfo.vout[vout];\n if (!isValidSatoshiValue(output.value)) {\n throw new Error(`Invalid UTXO value ${output.value} for ${txid}:${vout}`);\n }\n assertValidScriptPubKey(output.scriptpubkey, `${txid}:${vout}`);\n\n return {\n txid,\n vout,\n value: output.value,\n scriptPubKey: output.scriptpubkey,\n };\n}\n\n/**\n * Get all UTXOs for a Bitcoin address.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of UTXOs sorted by value (largest first)\n */\nexport async function getAddressUtxos(\n address: string,\n apiUrl: string,\n): Promise<MempoolUTXO[]> {\n assertValidAddress(address);\n try {\n // Fetch UTXOs for the address\n const utxos = await fetchApi<\n {\n txid: string;\n vout: number;\n value: number;\n status: {\n confirmed: boolean;\n };\n }[]\n >(`${apiUrl}/address/${address}/utxo`);\n\n // Fetch scriptPubKey for the address\n const addressInfo = await fetchApi<{\n isvalid: boolean;\n scriptPubKey: string;\n }>(`${apiUrl}/v1/validate-address/${address}`);\n\n if (!addressInfo.isvalid) {\n throw new Error(\n `Invalid Bitcoin address: ${address}. Mempool API validation failed.`,\n );\n }\n assertValidScriptPubKey(addressInfo.scriptPubKey, address);\n\n // Validate UTXO fields from the listing endpoint.\n // Per-UTXO cross-verification against /tx/{txid} is intentionally NOT done\n // here — it would be expensive (N API calls) and redundant: the broadcast\n // path already verifies each selected input via getUtxoInfo before signing.\n // Both endpoints come from the same mempool API, so cross-checking one\n // against the other on the same server does not add real security.\n for (const utxo of utxos) {\n assertValidTxid(utxo.txid);\n if (!isValidVout(utxo.vout)) {\n throw new Error(`Invalid vout ${utxo.vout} for ${utxo.txid}`);\n }\n if (!isValidSatoshiValue(utxo.value)) {\n throw new Error(\n `Invalid UTXO value ${utxo.value} for ${utxo.txid}:${utxo.vout}`,\n );\n }\n }\n\n // Sort by value (largest first) and map to our UTXO format\n const sortedUTXOs = utxos.sort((a, b) => b.value - a.value);\n\n return sortedUTXOs.map((utxo) => ({\n txid: utxo.txid,\n vout: utxo.vout,\n value: utxo.value,\n scriptPubKey: addressInfo.scriptPubKey,\n confirmed: utxo.status.confirmed,\n }));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(\n `Failed to get UTXOs for address ${address}: ${error.message}`,\n );\n }\n throw new Error(\n `Failed to get UTXOs for address ${address}: Unknown error`,\n );\n }\n}\n\n/**\n * Get the mempool API URL for a given network.\n *\n * @param network - Bitcoin network (mainnet, testnet, signet)\n * @returns The mempool API URL\n */\nexport function getMempoolApiUrl(\n network: \"mainnet\" | \"testnet\" | \"signet\",\n): string {\n return MEMPOOL_API_URLS[network];\n}\n\n/**\n * Transaction summary from address transactions endpoint.\n */\nexport interface AddressTx {\n txid: string;\n status: {\n confirmed: boolean;\n block_height?: number;\n };\n}\n\n/**\n * Get recent transactions for a Bitcoin address.\n *\n * Returns the last 25 confirmed transactions plus any unconfirmed (mempool) transactions.\n * This is useful for checking if a specific transaction has been broadcast.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of recent transactions\n */\nexport async function getAddressTxs(\n address: string,\n apiUrl: string,\n): Promise<AddressTx[]> {\n assertValidAddress(address);\n return fetchApi<AddressTx[]>(`${apiUrl}/address/${address}/txs`);\n}\n\n/**\n * Fetches Bitcoin network fee recommendations from mempool.space API.\n *\n * @param apiUrl - Mempool API base URL\n * @returns Fee rates in sat/vbyte for different confirmation times\n * @throws Error if request fails or returns invalid data\n *\n * @see https://mempool.space/docs/api/rest#get-recommended-fees\n */\nexport async function getNetworkFees(apiUrl: string): Promise<NetworkFees> {\n const response = await fetchWithTimeout(`${apiUrl}/v1/fees/recommended`);\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch network fees: ${response.status} ${response.statusText}`,\n );\n }\n\n const data = await response.json();\n\n const feeFields = [\n \"fastestFee\",\n \"halfHourFee\",\n \"hourFee\",\n \"economyFee\",\n \"minimumFee\",\n ] as const;\n\n for (const field of feeFields) {\n if (!isValidFeeRate(data[field])) {\n throw new Error(\n `Invalid fee rate ${field}=${data[field]} from mempool API: expected a positive number ≤ ${MAX_FEE_RATE}`,\n );\n }\n }\n\n if (\n data.minimumFee > data.economyFee ||\n data.economyFee > data.hourFee ||\n data.hourFee > data.halfHourFee ||\n data.halfHourFee > data.fastestFee\n ) {\n throw new Error(\n `Fee rate ordering violation from mempool API: expected ` +\n `minimumFee (${data.minimumFee}) <= economyFee (${data.economyFee}) <= ` +\n `hourFee (${data.hourFee}) <= halfHourFee (${data.halfHourFee}) <= ` +\n `fastestFee (${data.fastestFee}).`,\n );\n }\n\n return data as NetworkFees;\n}\n\n"],"names":["MAX_SATOSHIS","MEMPOOL_REQUEST_TIMEOUT_MS","HTTP_NOT_FOUND","fetchWithTimeout","url","options","controller","timeoutId","signals","combined","combineAbortSignals","error","MAX_FEE_RATE","isValidSatoshiValue","value","isValidFeeRate","isValidVout","vout","outputCount","assertValidTxid","txid","TXID_RE","assertValidAddress","address","BITCOIN_ADDRESS_RE","assertValidScriptPubKey","scriptPubKey","context","HEX_RE","KNOWN_SCRIPT_PREFIXES","prefix","MEMPOOL_API_URLS","MempoolNotFoundError","message","__publicField","fetchApi","response","errorText","ErrorType","contentType","pushTx","txHex","apiUrl","errorJson","getTxInfo","getTipHeight","raw","trimmed","height","getOutspend","getTxHex","getUtxoInfo","txInfo","output","getAddressUtxos","utxos","addressInfo","utx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ACAmB,GACsB;AACtB,SAAApB,EAAmBC,CAAO,GACnBY,EAAsB,GAAGO,CAAM,YAAYnB,CAAO,MAAM;AACjE;AAWA,eAAsBwC,EAAerB,GAAsC;AACzE,QAAMN,IAAW,MAAMjC,EAAiB,GAAGuC,CAAM,sBAAsB;AAEvE,MAAI,CAACN,EAAS;AACZ,UAAM,IAAI;AAAA,MACR,iCAAiCA,EAAS,MAAM,IAAIA,EAAS,UAAU;AAAA,IAAA;AAI3E,QAAM4B,IAAO,MAAM5B,EAAS,KAAA,GAEtB6B,IAAY;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,aAAWC,KAASD;AAClB,QAAI,CAAClD,EAAeiD,EAAKE,CAAK,CAAC;AAC7B,YAAM,IAAI;AAAA,QACR,oBAAoBA,CAAK,IAAIF,EAAKE,CAAK,CAAC,mDAAmDtD,CAAY;AAAA,MAAA;AAK7G,MACEoD,EAAK,aAAaA,EAAK,cACvBA,EAAK,aAAaA,EAAK,WACvBA,EAAK,UAAUA,EAAK,eACpBA,EAAK,cAAcA,EAAK;AAExB,UAAM,IAAI;AAAA,MACR,sEACiBA,EAAK,UAAU,oBAAoBA,EAAK,UAAU,iBACrDA,EAAK,OAAO,qBAAqBA,EAAK,WAAW,oBAC9CA,EAAK,UAAU;AAAA,IAAA;AAIpC,SAAOA;AACT;"}
@@ -7,6 +7,16 @@ export declare const MEMPOOL_API_URLS: {
7
7
  readonly testnet: "https://mempool.space/testnet/api";
8
8
  readonly signet: "https://mempool.space/signet/api";
9
9
  };
10
+ /**
11
+ * Thrown by `getTxInfo`, `getUtxoInfo`, `getTipHeight`, `getOutspend` and
12
+ * `getAddressTxs` when the mempool API answers HTTP 404, for example for a
13
+ * transaction it does not know. Their other failures throw a plain `Error`.
14
+ */
15
+ export declare class MempoolNotFoundError extends Error {
16
+ /** HTTP status of the failed response. */
17
+ readonly status = 404;
18
+ constructor(message: string);
19
+ }
10
20
  /**
11
21
  * Push a signed transaction to the Bitcoin network.
12
22
  *
@@ -1 +1 @@
1
- {"version":3,"file":"mempoolApi.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/mempool/mempoolApi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,cAAc,EACd,MAAM,EACN,QAAQ,EACT,MAAM,SAAS,CAAC;AAuGjB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAiCX;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC3E;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC,CAMzB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB5E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,CAAC,CAsBnB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,EAAE,CAAC,CAkExB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GACxC,MAAM,CAER;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QACN,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,SAAS,EAAE,CAAC,CAGtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA0CzE"}
1
+ {"version":3,"file":"mempoolApi.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/mempool/mempoolApi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,cAAc,EACd,MAAM,EACN,QAAQ,EACT,MAAM,SAAS,CAAC;AA0GjB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,OAAkB;gBAErB,OAAO,EAAE,MAAM;CAI5B;AAwCD;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC3E;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC,CAMzB;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB5E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,CAAC,CAsBnB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,EAAE,CAAC,CAkExB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GACxC,MAAM,CAER;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QACN,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,SAAS,EAAE,CAAC,CAGtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA0CzE"}
@@ -1,6 +1,6 @@
1
1
  import { PeginStatusReader, WotsKeySubmitter, PresignClient, ClaimerArtifactsReader } from '../../services/deposit/interfaces';
2
2
  import { BearerTokenProvider } from './json-rpc-client';
3
- import { BatchGetPeginStatusParams, BatchGetPeginStatusResponse, BatchGetPegoutStatusParams, BatchGetPegoutStatusResponse, GetPeginStatusParams, GetPeginStatusResponse, RequestDepositorClaimerArtifactsParams, RequestDepositorClaimerArtifactsResponse, RequestDepositorPresignTransactionsParams, RequestDepositorPresignTransactionsResponse, SubmitDepositorPresignaturesParams, SubmitDepositorWotsKeyParams } from './types';
3
+ import { BatchGetPeginStatusByVaultIdParams, BatchGetPeginStatusResponse, BatchGetPegoutStatusByVaultIdParams, BatchGetPegoutStatusResponse, GetPeginStatusByVaultIdParams, GetPeginStatusResponse, RequestDepositorClaimerArtifactsParams, RequestDepositorClaimerArtifactsResponse, RequestDepositorPresignTransactionsParams, RequestDepositorPresignTransactionsResponse, SubmitDepositorPresignaturesParams, SubmitDepositorWotsKeyParams } from './types';
4
4
  export interface VaultProviderRpcClientOptions {
5
5
  /** Timeout in milliseconds per request (default: 60000) */
6
6
  timeout?: number;
@@ -10,8 +10,8 @@ export interface VaultProviderRpcClientOptions {
10
10
  retryDelay?: number;
11
11
  /**
12
12
  * Custom retry predicate. Default retries only the idempotent read
13
- * methods: `getPeginStatus`, `batchGetPeginStatus`, `batchGetPegoutStatus`,
14
- * `requestDepositorPresignTransactions`.
13
+ * methods: `getPeginStatusByVaultId`, `batchGetPeginStatusByVaultId`,
14
+ * `batchGetPegoutStatusByVaultId`, `requestDepositorPresignTransactions`.
15
15
  */
16
16
  retryableFor?: (method: string) => boolean;
17
17
  /** Custom headers. */
@@ -31,7 +31,7 @@ export interface VaultProviderRpcClientOptions {
31
31
  * Usage:
32
32
  * ```ts
33
33
  * const client = new VaultProviderRpcClient("https://vp.example.com/rpc");
34
- * const status = await client.getPeginStatus({ pegin_txid: "abc..." });
34
+ * const status = await client.getPeginStatusByVaultId({ vault_id: "0xabc..." });
35
35
  * ```
36
36
  */
37
37
  export declare class VaultProviderRpcClient implements PeginStatusReader, WotsKeySubmitter, PresignClient, ClaimerArtifactsReader {
@@ -58,19 +58,22 @@ export declare class VaultProviderRpcClient implements PeginStatusReader, WotsKe
58
58
  * independently evaluate garbled circuits during a challenge.
59
59
  */
60
60
  requestDepositorClaimerArtifacts(params: RequestDepositorClaimerArtifactsParams, signal?: AbortSignal): Promise<RequestDepositorClaimerArtifactsResponse>;
61
- /** Get the current pegin status from the vault provider daemon. */
62
- getPeginStatus(params: GetPeginStatusParams, signal?: AbortSignal): Promise<GetPeginStatusResponse>;
63
61
  /**
64
- * Get pegin status for many txids in one round trip. Per-result envelope
65
- * isolates per-pegin failures from the overall RPC. Caller must chunk
66
- * inputs at `VP_BATCH_MAX_SIZE`.
62
+ * Get the current pegin status from the vault provider daemon,
63
+ * addressed by the depositor-bound `vault_id`.
67
64
  */
68
- batchGetPeginStatus(params: BatchGetPeginStatusParams, signal?: AbortSignal): Promise<BatchGetPeginStatusResponse>;
65
+ getPeginStatusByVaultId(params: GetPeginStatusByVaultIdParams, signal?: AbortSignal): Promise<GetPeginStatusResponse>;
69
66
  /**
70
- * Get pegout status for many txids in one round trip. Same per-result
71
- * envelope semantics as `batchGetPeginStatus`. A legacy claimer status
72
- * from an older daemon is replaced with its current name.
67
+ * Get pegin status for many vault ids in one round trip. Per-result
68
+ * envelope isolates per-vault failures from the overall RPC. Caller must
69
+ * chunk inputs at `VP_BATCH_MAX_SIZE`.
73
70
  */
74
- batchGetPegoutStatus(params: BatchGetPegoutStatusParams, signal?: AbortSignal): Promise<BatchGetPegoutStatusResponse>;
71
+ batchGetPeginStatusByVaultId(params: BatchGetPeginStatusByVaultIdParams, signal?: AbortSignal): Promise<BatchGetPeginStatusResponse>;
72
+ /**
73
+ * Get pegout status for many vault ids in one round trip. Same per-result
74
+ * envelope semantics as `batchGetPeginStatusByVaultId`. A legacy claimer
75
+ * status from an older daemon is replaced with its current name.
76
+ */
77
+ batchGetPegoutStatusByVaultId(params: BatchGetPegoutStatusByVaultIdParams, signal?: AbortSignal): Promise<BatchGetPegoutStatusResponse>;
75
78
  }
76
79
  //# sourceMappingURL=api.d.ts.map
@@ -1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OAAO,CAAC,2CAA2C,CAAC;IASvD;;;OAGG;IACG,4BAA4B,CAChC,MAAM,EAAE,kCAAkC,EAC1C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC;IAQhB;;;;OAIG;IACG,sBAAsB,CAC1B,MAAM,EAAE,4BAA4B,EACpC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC;IAQhB;;;OAGG;IACG,gCAAgC,CACpC,MAAM,EAAE,sCAAsC,EAC9C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,wCAAwC,CAAC;IASpD,mEAAmE;IAC7D,cAAc,CAClB,MAAM,EAAE,oBAAoB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC;IAUlC;;;;OAIG;IACG,mBAAmB,CACvB,MAAM,EAAE,yBAAyB,EACjC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,2BAA2B,CAAC;IASvC;;;;OAIG;IACG,oBAAoB,CACxB,MAAM,EAAE,0BAA0B,EAClC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,4BAA4B,CAAC;CAYzC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGpI,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,kCAAkC,EAClC,2BAA2B,EAC3B,mCAAmC,EACnC,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,sCAAsC,EACtC,wCAAwC,EACxC,yCAAyC,EACzC,2CAA2C,EAC3C,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,SAAS,C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;IASlC;;;;OAIG;IACG,4BAA4B,CAChC,MAAM,EAAE,kCAAkC,EAC1C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,2BAA2B,CAAC;IASvC;;;;OAIG;IACG,6BAA6B,CACjC,MAAM,EAAE,mCAAmC,EAC3C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,4BAA4B,CAAC;CAYzC"}
@@ -7,8 +7,16 @@ export interface AuthenticatedVpClientConfig {
7
7
  peginTxid: string;
8
8
  /** Already-derived 32-byte auth-anchor preimage (64-char hex, no `0x`). */
9
9
  authAnchorHex: string;
10
+ /** Stable vault-provider address used to scope the registry entry. */
11
+ providerAddress: string;
10
12
  /** On-chain VP pubkey, branded so it can only come from the registry reader. */
11
13
  pinnedServerPubkey: OnChainBtcPubkey;
14
+ /** Frozen-epoch VP pubkey used by the gRPC-subject bootstrap. */
15
+ grpcPinnedServerPubkey: OnChainBtcPubkey;
16
+ /** Vault's frozen VP epoch, paired with `grpcPinnedServerPubkey`. */
17
+ grpcKeyEpoch: bigint;
18
+ /** Re-read the current operation key after a JSON-RPC identity mismatch. */
19
+ refreshJsonRpcPinnedServerPubkey?: () => Promise<OnChainBtcPubkey>;
12
20
  /**
13
21
  * Depositor BTC pubkey (x-only or compressed hex). Normalized to
14
22
  * x-only and asserted against every issued token's CWT `aud` claim.
@@ -1 +1 @@
1
- {"version":3,"file":"createAuthenticatedVpClient.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,EACnC,MAAM,QAAQ,CAAC;AAKhB,MAAM,WAAW,2BAA2B;IAC1C,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,aAAa,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,kBAAkB,EAAE,gBAAgB,CAAC;IACrC;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,OAAO,CAAC,EAAE,6BAA6B,CAAC;CACzC;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,2BAA2B,GAClC,sBAAsB,CAoBxB"}
1
+ {"version":3,"file":"createAuthenticatedVpClient.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,EACnC,MAAM,QAAQ,CAAC;AAKhB,MAAM,WAAW,2BAA2B;IAC1C,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,aAAa,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,eAAe,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,kBAAkB,EAAE,gBAAgB,CAAC;IACrC,iEAAiE;IACjE,sBAAsB,EAAE,gBAAgB,CAAC;IACzC,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,gCAAgC,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnE;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,OAAO,CAAC,EAAE,6BAA6B,CAAC;CACzC;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,2BAA2B,GAClC,sBAAsB,CAwBxB"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export { ServerIdentityError, verifyServerIdentity } from './serverIdentity';
7
7
  export type { ServerIdentityResponse, VerifyServerIdentityInput, } from './serverIdentity';
8
- export { VpTokenRegistry, vpTokenRegistry, type VpTokenRegistryInput, } from './tokenRegistry';
8
+ export { VpTokenRegistry, vpTokenRegistry, type VpTokenRegistryInput, type VpTokenRegistryLookup, } from './tokenRegistry';
9
9
  export { createAuthenticatedVpClient } from './createAuthenticatedVpClient';
10
10
  export type { AuthenticatedVpClientConfig } from './createAuthenticatedVpClient';
11
11
  export { primeVpTokenRegistry } from './primeVpAuth';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EACV,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EACV,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,GAC3B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
@@ -3,7 +3,15 @@ export interface PrimeVpAuthInput {
3
3
  baseUrl: string;
4
4
  peginTxid: string;
5
5
  authAnchorHex: string;
6
+ /** Stable vault-provider address used to scope the registry entry. */
7
+ providerAddress: string;
6
8
  pinnedServerPubkey: OnChainBtcPubkey;
9
+ /** Frozen-epoch VP pubkey used by the gRPC-subject bootstrap. */
10
+ grpcPinnedServerPubkey: OnChainBtcPubkey;
11
+ /** Vault's frozen VP epoch, paired with `grpcPinnedServerPubkey`. */
12
+ grpcKeyEpoch: bigint;
13
+ /** Re-read the current operation key after a JSON-RPC identity mismatch. */
14
+ refreshJsonRpcPinnedServerPubkey?: () => Promise<OnChainBtcPubkey>;
7
15
  /**
8
16
  * Depositor BTC pubkey (x-only or compressed hex). Normalized to
9
17
  * x-only and asserted against every issued token's CWT `aud` claim.
@@ -1 +1 @@
1
- {"version":3,"file":"primeVpAuth.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/primeVpAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,gBAAgB,CAAC;IACrC;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAUlE"}
1
+ {"version":3,"file":"primeVpAuth.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/primeVpAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,gBAAgB,CAAC;IACrC,iEAAiE;IACjE,sBAAsB,EAAE,gBAAgB,CAAC;IACzC,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,gCAAgC,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnE;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAclE"}
@@ -18,8 +18,19 @@ export interface VpTokenProviderConfig {
18
18
  peginTxid: string;
19
19
  /** 64-char hex of the 32-byte OP_RETURN auth-anchor preimage. */
20
20
  authAnchorHex: string;
21
- /** Pinned VP pubkey from the on-chain registry; branded so indexer mirrors can't substitute. */
21
+ /** Live JSON-RPC-subject VP pubkey from chain; branded so mirrors can't substitute it. */
22
22
  pinnedServerPubkey: OnChainBtcPubkey;
23
+ /**
24
+ * Pin for the gRPC-subject bootstrap. This must be the operation key at the
25
+ * vault's frozen VP epoch: vaultd signs this subject with that key.
26
+ */
27
+ grpcPinnedServerPubkey: OnChainBtcPubkey;
28
+ /**
29
+ * Re-read the authoritative current operation key after a JSON-RPC-subject
30
+ * identity mismatch. The provider retries at most once, and only when the
31
+ * chain returns a key different from the stale pin.
32
+ */
33
+ refreshJsonRpcPinnedServerPubkey?: () => Promise<OnChainBtcPubkey>;
23
34
  /**
24
35
  * Depositor x-only pubkey (32-byte hex). Asserted against every
25
36
  * issued token's CWT `aud` claim so a token minted for a different
@@ -56,7 +67,9 @@ export declare class VpTokenProvider implements BearerTokenProvider {
56
67
  private client;
57
68
  private readonly peginTxid;
58
69
  private readonly authAnchorHex;
59
- private readonly pinnedServerPubkey;
70
+ private jsonRpcPinnedServerPubkey;
71
+ private readonly grpcPinnedServerPubkey;
72
+ private readonly refreshJsonRpcPinnedServerPubkey?;
60
73
  private readonly expectedAudienceXOnlyPubkey;
61
74
  private readonly authGatedMethods;
62
75
  private readonly grpcGatedMethods;
@@ -108,6 +121,9 @@ export declare class VpTokenProvider implements BearerTokenProvider {
108
121
  * old client (it captured the reference); next call uses the new.
109
122
  */
110
123
  setClient(client: JsonRpcClient): void;
124
+ /** Current subject-specific pin, exposed for registry identity checks. */
125
+ getPinnedServerPubkey(subject: "jsonrpc" | "grpc"): OnChainBtcPubkey;
111
126
  private acquireSingleFlight;
127
+ private acquireAndVerify;
112
128
  }
113
129
  //# sourceMappingURL=tokenProvider.d.ts.map
@@ -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;AAK7E,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,kBAAkB,CAAC;AAqB1B;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,U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,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IActD;;;;;;;;;OASG;IACH,UAAU,IAAI,IAAI;YASJ,kBAAkB;IAYhC;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAItC,OAAO,CAAC,mBAAmB;CAyF5B"}
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,EAEL,KAAK,sBAAsB,EAE5B,MAAM,kBAAkB,CAAC;AAsB1B;;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,0FAA0F;IAC1F,kBAAkB,EAAE,gBAAgB,CAAC;IACrC;;;OAGG;IACH,sBAAsB,EAAE,gBAAgB,CAAC;IACzC;;;;OAIG;IACH,gCAAgC,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnE;;;;;OAKG;IACH,2BAA2B,EAAE,MAAM,CAAC;IACpC;;;;;OAKG;IACH,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC;;;;;OAKG;IACH,gBAAgB,EAAE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@ -5,21 +5,41 @@ export interface VpTokenRegistryInput {
5
5
  client: JsonRpcClient;
6
6
  peginTxid: string;
7
7
  authAnchorHex: string;
8
+ /** Stable provider identity used to prevent cross-provider cache reuse. */
9
+ providerAddress: string;
8
10
  pinnedServerPubkey: OnChainBtcPubkey;
11
+ /** Frozen-epoch issuer used only by the gRPC token subject. */
12
+ grpcPinnedServerPubkey: OnChainBtcPubkey;
13
+ /** Frozen VP epoch that selected `grpcPinnedServerPubkey`. */
14
+ grpcKeyEpoch: bigint;
15
+ /** Authoritative live-key resolver for bounded JSON-RPC pin recovery. */
16
+ refreshJsonRpcPinnedServerPubkey?: () => Promise<OnChainBtcPubkey>;
9
17
  /** Depositor x-only pubkey (32-byte hex), asserted against each token's CWT `aud`. */
10
18
  expectedAudienceXOnlyPubkey: string;
11
19
  }
20
+ export interface VpTokenRegistryLookup {
21
+ peginTxid: string;
22
+ providerAddress: string;
23
+ expectedAudienceXOnlyPubkey: string;
24
+ }
12
25
  export declare class VpTokenRegistry {
13
26
  private readonly entries;
14
27
  /**
15
28
  * Return the cached `VpTokenProvider` for `peginTxid` if one exists
16
- * with matching `authAnchorHex` and `pinnedServerPubkey`, otherwise
17
- * construct and cache a fresh provider. A mismatch on either throws —
18
- * silent overwrite would mask derivation drift or VP pubkey rotation.
29
+ * with matching anchor, provider, audience, and subject-specific issuer
30
+ * bindings, otherwise construct and cache a fresh provider. A mismatch
31
+ * throws — silent overwrite would mask derivation drift or cross-provider
32
+ * cache reuse. A legitimate live JSON-RPC key rotation is handled inside
33
+ * `VpTokenProvider` through its chain-backed refresh callback.
19
34
  */
20
35
  getOrCreate(input: VpTokenRegistryInput): VpTokenProvider;
21
- /** Return the cached provider, or `undefined` if none. */
22
- peek(peginTxid: string): VpTokenProvider | undefined;
36
+ /**
37
+ * Return the cached provider only when its request-facing identity matches.
38
+ * A missing entry is a normal cold-cache result; a binding mismatch throws
39
+ * so callers cannot attach one provider's bearer to another provider or
40
+ * depositor request.
41
+ */
42
+ peek(input: VpTokenRegistryLookup): VpTokenProvider | undefined;
23
43
  /**
24
44
  * Evict the entry for `peginTxid`. Idempotent. Called on terminal
25
45
  * paths — activation success, user-cancel, or component unmount —
@@ -41,7 +61,7 @@ export declare class VpTokenRegistry {
41
61
  */
42
62
  export interface VpTokenRegistryPublic {
43
63
  getOrCreate(input: VpTokenRegistryInput): VpTokenProvider;
44
- peek(peginTxid: string): VpTokenProvider | undefined;
64
+ peek(input: VpTokenRegistryLookup): VpTokenProvider | undefined;
45
65
  release(peginTxid: string): void;
46
66
  readonly size: number;
47
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tokenRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/tokenRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,gBAAgB,CAAC;IACrC,sFAAsF;IACtF,2BAA2B,EAAE,MAAM,CAAC;CACrC;AASD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAE5D;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe;IA8CzD,0DAA0D;IAC1D,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIpD;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIhC;;;;;OAKG;IACH,KAAK,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"}
1
+ {"version":3,"file":"tokenRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/tokenRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,gBAAgB,CAAC;IACrC,+DAA+D;IAC/D,sBAAsB,EAAE,gBAAgB,CAAC;IACzC,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,gCAAgC,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnE,sFAAsF;IACtF,2BAA2B,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,2BAA2B,EAAE,MAAM,CAAC;CACrC;AAUD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAE5D;;;;;;;OAOG;IACH,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe;IA2EzD;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,eAAe,GAAG,SAAS;IAwB/D;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIhC;;;;;OAKG;IACH,KAAK,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,KAAK,EAAE,qBAAqB,GAAG,eAAe,GAAG,SAAS,CAAC;IAChE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,EAAE,qBAA6C,CAAC"}
@@ -1,45 +1,47 @@
1
1
  /**
2
2
  * Defensive helper for attributing per-item results in a VP batch RPC
3
- * response back to the requested txids. The server promises 1:1 ordered
3
+ * response back to the requested vault ids. The server promises 1:1 ordered
4
4
  * results, but we don't trust that promise — a server bug could duplicate,
5
5
  * skip, or scramble items, and silent attribution-by-array-index would
6
6
  * mask the bug.
7
7
  *
8
- * Lowercases all txids on both sides to absorb case mismatch (the FE
9
- * strips `0x` but doesn't otherwise normalize).
8
+ * Normalizes vault ids on both sides (strip `0x`, lowercase) to absorb
9
+ * prefix and case mismatch — the server echoes the request string verbatim.
10
10
  *
11
11
  * @module tbv/core/clients/vault-provider/batchAttribution
12
12
  */
13
13
  /** Per-item entry in a VP batch response. */
14
14
  export interface BatchResultEntry<T> {
15
- pegin_txid: string;
15
+ vault_id: string;
16
16
  result: T | null;
17
17
  error: string | null;
18
18
  }
19
19
  /** Output of {@link attributeBatchResults}. */
20
20
  export interface BatchAttributionResult<T> {
21
- /** Lowercase requested txid -> per-item envelope. */
22
- byTxid: Map<string, {
21
+ /** Normalized requested vault id -> per-item envelope. */
22
+ byVaultId: Map<string, {
23
23
  result: T | null;
24
24
  error: string | null;
25
25
  }>;
26
- /** Requested txids that did not appear in the response. */
26
+ /** Requested vault ids that did not appear in the response. */
27
27
  missing: string[];
28
- /** Echoed txids that were not in the request — logged + dropped. */
28
+ /** Echoed vault ids that were not in the request — logged + dropped. */
29
29
  unexpected: string[];
30
- /** Echoed txids that appeared more than once — first kept, rest dropped. */
30
+ /** Echoed vault ids that appeared more than once — first kept, rest dropped. */
31
31
  duplicate: string[];
32
32
  }
33
+ /** Normalize a vault id for map keys: strip an optional `0x`, lowercase. */
34
+ export declare function vaultIdKey(vaultId: string): string;
33
35
  /**
34
- * Attribute batch results to requested txids defensively.
36
+ * Attribute batch results to requested vault ids defensively.
35
37
  *
36
- * Both `requestedTxids` and the echoed `pegin_txid` field on each result
37
- * are lowercased before lookup. Duplicates and unexpected echoes are
38
+ * Both `requestedVaultIds` and the echoed `vault_id` field on each result
39
+ * are normalized before lookup. Duplicates and unexpected echoes are
38
40
  * surfaced so callers can flag the affected items as errored rather than
39
41
  * silently overwriting state.
40
42
  *
41
- * `requestedTxids` may contain duplicates; they are de-duplicated for the
42
- * purposes of map keys (each unique txid becomes a single map entry).
43
+ * `requestedVaultIds` may contain duplicates; they are de-duplicated for the
44
+ * purposes of map keys (each unique vault id becomes a single map entry).
43
45
  */
44
- export declare function attributeBatchResults<T>(requestedTxids: string[], results: ReadonlyArray<BatchResultEntry<T>>): BatchAttributionResult<T>;
46
+ export declare function attributeBatchResults<T>(requestedVaultIds: string[], results: ReadonlyArray<BatchResultEntry<T>>): BatchAttributionResult<T>;
45
47
  //# sourceMappingURL=batchAttribution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batchAttribution.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/batchAttribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,+CAA+C;AAC/C,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,qDAAqD;IACrD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAChE,2DAA2D;IAC3D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oEAAoE;IACpE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,4EAA4E;IAC5E,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,cAAc,EAAE,MAAM,EAAE,EACxB,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC1C,sBAAsB,CAAC,CAAC,CAAC,CAkC3B"}
1
+ {"version":3,"file":"batchAttribution.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/batchAttribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,+CAA+C;AAC/C,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,0DAA0D;IAC1D,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACnE,+DAA+D;IAC/D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wEAAwE;IACxE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gFAAgF;IAChF,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,iBAAiB,EAAE,MAAM,EAAE,EAC3B,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC1C,sBAAsB,CAAC,CAAC,CAAC,CAkC3B"}
@@ -2,22 +2,28 @@ import { BatchResultEntry } from './batchAttribution';
2
2
  export interface BatchPollByProviderOptions<TItem, TResult> {
3
3
  /** Items to poll for this provider, e.g. `DepositToPoll[]`. */
4
4
  items: TItem[];
5
- /** Extract the canonical txid for each item. Helper lowercases it. */
6
- getTxid: (item: TItem) => string;
5
+ /** Extract the on-chain vault id for each item. Helper normalizes it. */
6
+ getVaultId: (item: TItem) => string;
7
7
  /**
8
- * Per-chunk RPC call. Receives lowercased txids; returns the batch
9
- * envelope. Caller wraps `rpcClient.batchGet*Status({ pegin_txids })`.
8
+ * Per-chunk RPC call. Receives normalized (unprefixed, lowercase)
9
+ * vault ids; returns the batch envelope. Caller wraps
10
+ * `rpcClient.batchGet*StatusByVaultId({ vault_ids })`.
10
11
  */
11
- batchCall: (txids: string[]) => Promise<{
12
+ batchCall: (vaultIds: string[]) => Promise<{
12
13
  results: ReadonlyArray<BatchResultEntry<TResult>>;
13
14
  }>;
14
15
  /**
15
16
  * Handle a per-item envelope. Exactly one of `result` / `error` is
16
17
  * populated (validator invariant). Caller decides UI state, logging,
17
- * etc. Not invoked for txids surfaced via {@link onDuplicate}.
18
+ * etc. Not invoked for vault ids surfaced via {@link onDuplicate}.
18
19
  *
19
- * Note: `envelope.pegin_txid` is the lowercased txid the helper
20
+ * Note: `envelope.vault_id` is the normalized vault id the helper
20
21
  * sent in the request, not whatever case/encoding the server echoed.
22
+ *
23
+ * Also dispatched with a locally-produced `error` for an item whose
24
+ * `getVaultId` is not a well-formed vault id. Such an item is never
25
+ * sent, because an unattributable id comes back as `missing` and would
26
+ * blame the provider for a caller-side defect.
21
27
  */
22
28
  onItem: (item: TItem, envelope: BatchResultEntry<TResult>) => void;
23
29
  /** Server omitted this item from the response. */
@@ -38,12 +44,12 @@ export interface BatchPollByProviderOptions<TItem, TResult> {
38
44
  */
39
45
  onWholeBatchError: (chunk: TItem[], error: unknown) => void;
40
46
  /**
41
- * Server returned txids that were not in the request. Caller
47
+ * Server returned vault ids that were not in the request. Caller
42
48
  * typically logs the count for observability — there's no recovery
43
49
  * action since the original request items are unaffected. Optional;
44
50
  * defaults to no-op.
45
51
  */
46
- onUnexpected?: (echoedTxids: string[]) => void;
52
+ onUnexpected?: (echoedVaultIds: string[]) => void;
47
53
  /**
48
54
  * Maximum items per RPC call. Defaults to {@link VP_BATCH_MAX_SIZE}.
49
55
  * Exposed for tests so chunking can be exercised without 50+
@@ -1 +1 @@
1
- {"version":3,"file":"batchPoll.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/batchPoll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,0BAA0B,CAAC,KAAK,EAAE,OAAO;IACxD,+DAA+D;IAC/D,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,sEAAsE;IACtE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACjC;;;OAGG;IACH,SAAS,EAAE,CACT,KAAK,EAAE,MAAM,EAAE,KACZ,OAAO,CAAC;QAAE,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAA;KAAE,CAAC,CAAC;IACpE;;;;;;;OAOG;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C,CAAA;KAAE,CAAC,CAAC;IACpE;;;;;;;;;;;;OAYG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACnE,kDAAkD;IAClD,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,uEAAuE;IACvE,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IACnC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5D;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EACtD,OAAO,EAAE,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,GAClD,OAAO,CAAC,IAAI,CAAC,CAoFf"}
@@ -65,8 +65,9 @@ export interface JsonRpcClientConfig {
65
65
  maxResponseBytes?: number;
66
66
  /**
67
67
  * Predicate that decides which methods retry on transient errors.
68
- * Default retries only `getPeginStatus`, `batchGetPeginStatus`,
69
- * `batchGetPegoutStatus`, and `requestDepositorPresignTransactions`.
68
+ * Default retries only `getPeginStatusByVaultId`,
69
+ * `batchGetPeginStatusByVaultId`, `batchGetPegoutStatusByVaultId`, and
70
+ * `requestDepositorPresignTransactions`.
70
71
  * Write methods are not retried by default.
71
72
  */
72
73
  retryableFor?: (method: string) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"json-rpc-client.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/json-rpc-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,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC;YA0CL,QAAQ;IAqEtB;;;;;;;;;OASG;IACG,OAAO,CAAC,OAAO,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,CAAC;YAIN,cAAc;IA+G5B,OAAO,CAAC,KAAK;IAkBb,UAAU,IAAI,MAAM;CAGrB"}
1
+ {"version":3,"file":"json-rpc-client.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/vault-provider/json-rpc-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,CAAC;IACV,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO;IACjD,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,CAAC,CAAC;IACV,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IACnC,sBAAsB,CAAC,CAAC,CAAC,GACzB,oBAAoB,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAA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AS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,aAAa,CAAC,CAAsB;gBAEhC,MAAM,EAAE,mBAAmB;YAkBzB,YAAY;IAe1B;;;;;;;;;;;;OAYG;IACG,IAAI,CAAC,OAAO,EAAE,OAAO,EACzB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC;YA0CL,QAAQ;IAqEtB;;;;;;;;;OASG;IACG,OAAO,CAAC,OAAO,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,CAAC;YAIN,cAAc;IA+G5B,OAAO,CAAC,KAAK;IAkBb,UAAU,IAAI,MAAM;CAGrB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../index-EHLYplSd.cjs"),S=require("../../../../../state-DMFlvLL3.cjs");exports.VaultProviderRpcClient=r.VaultProviderRpcClient;exports.VpResponseValidationError=r.VpResponseValidationError;exports.batchPollByProvider=r.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=r.isUnrecognizedDaemonStatusError;exports.DaemonStatus=S.DaemonStatus;exports.JSON_RPC_ERROR_CODES=S.JSON_RPC_ERROR_CODES;exports.JsonRpcError=S.JsonRpcError;exports.POST_WOTS_STATUSES=S.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=S.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=S.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=S.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=S.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=S.VP_TRANSIENT_STATUSES;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../index-MRdle0fs.cjs"),S=require("../../../../../state-C4WoNCy1.cjs");exports.VaultProviderRpcClient=r.VaultProviderRpcClient;exports.VpResponseValidationError=r.VpResponseValidationError;exports.batchPollByProvider=r.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=r.isUnrecognizedDaemonStatusError;exports.DaemonStatus=S.DaemonStatus;exports.JSON_RPC_ERROR_CODES=S.JSON_RPC_ERROR_CODES;exports.JsonRpcError=S.JsonRpcError;exports.POST_WOTS_STATUSES=S.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=S.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=S.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=S.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=S.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=S.VP_TRANSIENT_STATUSES;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { V as r, a as s, b as o, i as E } from "../../../../../index-B6w5MM-8.js";
2
- import { D as _, J as R, b as e, d as P, P as t, R as A, e as i, c as n, V } from "../../../../../state-mE-QfITd.js";
1
+ import { V as r, a as s, b as o, i as E } from "../../../../../index-D2mybjXD.js";
2
+ import { D as _, J as R, b as e, d as P, P as t, R as A, e as i, c as n, V } from "../../../../../state-CFn1rT74.js";
3
3
  export {
4
4
  _ as DaemonStatus,
5
5
  R as JSON_RPC_ERROR_CODES,