@babylonlabs-io/ts-sdk 0.39.5 → 0.41.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/dist/PayoutManager-B5bovfkD.cjs.map +1 -1
- package/dist/PayoutManager-DChODEOJ.js.map +1 -1
- package/dist/{PeginManager-B1qjHs90.js → PeginManager-D9ZZ8wx2.js} +2 -2
- package/dist/{PeginManager-B1qjHs90.js.map → PeginManager-D9ZZ8wx2.js.map} +1 -1
- package/dist/{PeginManager-Dof0ZO1S.cjs → PeginManager-UqbOj2oV.cjs} +2 -2
- package/dist/{PeginManager-Dof0ZO1S.cjs.map → PeginManager-UqbOj2oV.cjs.map} +1 -1
- package/dist/assertPsbtUnsignedTxMatches-CzVv57QF.js.map +1 -1
- package/dist/assertPsbtUnsignedTxMatches-r1svclbd.cjs.map +1 -1
- package/dist/bitcoin-B5aNKtsk.js.map +1 -1
- package/dist/bitcoin-CHfKAhcI.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +74 -73
- package/dist/{mempoolApi-CAIge7Nj.js → mempoolApi-C7hkVkym.js} +31 -22
- package/dist/mempoolApi-C7hkVkym.js.map +1 -0
- package/dist/mempoolApi-DEAS9wVa.cjs +2 -0
- package/dist/mempoolApi-DEAS9wVa.cjs.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +33 -32
- package/dist/tbv/core/clients/mempool/index.d.ts +1 -1
- package/dist/tbv/core/clients/mempool/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts +11 -0
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts +0 -7
- package/dist/tbv/core/clients/vault-provider/auth/serverIdentity.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +74 -73
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +1 -1
- package/dist/tbv/core/managers/pegin/assertAuthAnchorOpReturn.d.ts +0 -17
- package/dist/tbv/core/managers/pegin/assertAuthAnchorOpReturn.d.ts.map +1 -1
- package/dist/tbv/core/managers/pegin/index.d.ts +1 -1
- package/dist/tbv/core/managers/pegin/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/constants.d.ts +0 -4
- package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts +0 -5
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +74 -73
- 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.js +265 -270
- package/dist/tbv/integrations/aave/index.js.map +1 -1
- package/dist/tbv/integrations/aave/utils/cascadeSimulation.d.ts +9 -0
- package/dist/tbv/integrations/aave/utils/cascadeSimulation.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/utils/optimalOrder.d.ts +20 -3
- package/dist/tbv/integrations/aave/utils/optimalOrder.d.ts.map +1 -1
- package/dist/types-0bvDGR4x.js.map +1 -1
- package/dist/types-Be3sAYzr.cjs.map +1 -1
- package/package.json +3 -3
- package/dist/mempoolApi-CAIge7Nj.js.map +0 -1
- package/dist/mempoolApi-YNkKjQCU.cjs +0 -2
- package/dist/mempoolApi-YNkKjQCU.cjs.map +0 -1
- package/dist/tbv/core/primitives/psbt/index.d.ts +0 -34
- package/dist/tbv/core/primitives/psbt/index.d.ts.map +0 -1
- package/dist/tbv/core/primitives/scripts/index.d.ts +0 -10
- package/dist/tbv/core/primitives/scripts/index.d.ts.map +0 -1
- package/dist/tbv/core/primitives/utils/index.d.ts +0 -9
- package/dist/tbv/core/primitives/utils/index.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mempoolApi-C7hkVkym.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 {\n BITCOIN_ADDRESS_RE,\n HEX_RE,\n KNOWN_SCRIPT_PREFIXES,\n TXID_RE,\n} from \"../../utils/validation\";\n\nimport type { MempoolUTXO, NetworkFees, TxInfo, UtxoInfo } 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\n try {\n // Don't clear timeout here — let it cover body consumption by callers\n return await fetch(url, {\n ...options,\n signal: AbortSignal.any(signals),\n });\n } catch (error) {\n clearTimeout(timeoutId);\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;\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 * @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\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 if (!/^\\d+$/.test(trimmed)) {\n throw new Error(\n `Mempool API returned an invalid block tip height: \"${raw}\"`,\n );\n }\n return Number.parseInt(trimmed, 10);\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","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","getTxInfo","getTipHeight","raw","trimmed","getTxHex","getUtxoInfo","txInfo","output","getAddressUtxos","utxos","addressInfo","utxo","a","b","getMempoolApiUrl","network","getAddressTxs","getNetworkFees","data","feeFields","field"],"mappings":";AAmBA,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;AAGF,MAAI;AAEF,WAAO,MAAM,MAAMD,GAAK;AAAA,MACtB,GAAGC;AAAA,MACH,QAAQ,YAAY,IAAIG,CAAO;AAAA,IAAA,CAChC;AAAA,EACH,SAASC,GAAO;AAEd,UADA,aAAaF,CAAS,GAEpBE,KAAS,QACT,OAAOA,KAAU,YACjB,UAAUA,KACVA,EAAM,SAAS,eAET,IAAI;AAAA,MACR,uCAAuCP,CAA0B,OAAOE,CAAG;AAAA,IAAA,IAGzEK;AAAA,EACR;AACF;AAMA,MAAMC,IAAe;AAErB,SAASC,EAAoBC,GAAwB;AACnD,SAAO,OAAO,UAAUA,CAAK,KAAKA,IAAQ,KAAKA,KAASX;AAC1D;AAEA,SAASY,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,KAC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AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,aAAWC,KAASD;AAClB,QAAI,CAAC5C,EAAe2C,EAAKE,CAAK,CAAC;AAC7B,YAAM,IAAI;AAAA,QACR,oBAAoBA,CAAK,IAAIF,EAAKE,CAAK,CAAC,mDAAmDhD,CAAY;AAAA,MAAA;AAK7G,MACE8C,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;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const i=require("./validation-u8W7Lp2x.cjs"),g=21e6*1e8,l=3e4;async function c(e,r){const t=new AbortController,n=setTimeout(()=>t.abort(),l),s=[t.signal,r==null?void 0:r.signal].filter(Boolean);try{return await fetch(e,{...r,signal:AbortSignal.any(s)})}catch(o){throw clearTimeout(n),o!=null&&typeof o=="object"&&"name"in o&&o.name==="AbortError"?new Error(`Mempool API request timed out after ${l}ms: ${e}`):o}}const w=1e4;function m(e){return Number.isInteger(e)&&e>0&&e<=g}function I(e){return Number.isInteger(e)&&e>0&&e<=w}function h(e,r){return!Number.isInteger(e)||e<0?!1:r===void 0||e<r}function f(e){if(!i.TXID_RE.test(e))throw new Error(`Invalid transaction ID format: ${e}`)}function d(e){if(!i.BITCOIN_ADDRESS_RE.test(e))throw new Error(`Invalid Bitcoin address format: ${e}`)}function $(e,r){if(!i.HEX_RE.test(e))throw new Error(`Invalid scriptPubKey: not valid hex for ${r}`);if(!i.KNOWN_SCRIPT_PREFIXES.some(n=>e.toLowerCase().startsWith(n)))throw new Error(`Unrecognized scriptPubKey type for ${r}: prefix ${e.slice(0,6)} does not match any known Bitcoin script type`)}const p={mainnet:"https://mempool.space/api",testnet:"https://mempool.space/testnet/api",signet:"https://mempool.space/signet/api"};async function a(e,r){try{const t=await c(e,r);if(!t.ok){const s=await t.text();throw new Error(`Mempool API error (${t.status}): ${s||t.statusText}`)}const n=t.headers.get("content-type");return n!=null&&n.includes("application/json")?await t.json():await t.text()}catch(t){throw t instanceof Error?new Error(`Failed to fetch from mempool API: ${t.message}`):new Error("Failed to fetch from mempool API: Unknown error")}}async function F(e,r){try{const t=await c(`${r}/tx`,{method:"POST",body:e,headers:{"Content-Type":"text/plain"}});if(!t.ok){const s=await t.text();let o;try{o=JSON.parse(s).message}catch{o=s}throw new Error(o||`Failed to broadcast transaction: ${t.statusText}`)}return await t.text()}catch(t){throw t instanceof Error?new Error(`Failed to broadcast BTC transaction: ${t.message}`):new Error("Failed to broadcast BTC transaction: Unknown error")}}async function E(e,r){return f(e),a(`${r}/tx/${e}`)}async function T(e){const r=await a(`${e}/blocks/tip/height`),t=r.trim();if(!/^\d+$/.test(t))throw new Error(`Mempool API returned an invalid block tip height: "${r}"`);return Number.parseInt(t,10)}async function x(e,r){f(e);try{const t=await c(`${r}/tx/${e}/hex`);if(!t.ok){const n=await t.text();throw new Error(`Mempool API error (${t.status}): ${n||t.statusText}`)}return await t.text()}catch(t){throw t instanceof Error?new Error(`Failed to get transaction hex for ${e}: ${t.message}`):new Error(`Failed to get transaction hex for ${e}: Unknown error`)}}async function y(e,r,t){f(e);const n=await E(e,t);if(!h(r,n.vout.length))throw new Error(`Invalid vout ${r} for transaction ${e} (has ${n.vout.length} outputs)`);const s=n.vout[r];if(!m(s.value))throw new Error(`Invalid UTXO value ${s.value} for ${e}:${r}`);return $(s.scriptpubkey,`${e}:${r}`),{txid:e,vout:r,value:s.value,scriptPubKey:s.scriptpubkey}}async function v(e,r){d(e);try{const t=await a(`${r}/address/${e}/utxo`),n=await a(`${r}/v1/validate-address/${e}`);if(!n.isvalid)throw new Error(`Invalid Bitcoin address: ${e}. Mempool API validation failed.`);$(n.scriptPubKey,e);for(const o of t){if(f(o.txid),!h(o.vout))throw new Error(`Invalid vout ${o.vout} for ${o.txid}`);if(!m(o.value))throw new Error(`Invalid UTXO value ${o.value} for ${o.txid}:${o.vout}`)}return t.sort((o,u)=>u.value-o.value).map(o=>({txid:o.txid,vout:o.vout,value:o.value,scriptPubKey:n.scriptPubKey,confirmed:o.status.confirmed}))}catch(t){throw t instanceof Error?new Error(`Failed to get UTXOs for address ${e}: ${t.message}`):new Error(`Failed to get UTXOs for address ${e}: Unknown error`)}}function A(e){return p[e]}async function b(e,r){return d(e),a(`${r}/address/${e}/txs`)}async function P(e){const r=await c(`${e}/v1/fees/recommended`);if(!r.ok)throw new Error(`Failed to fetch network fees: ${r.status} ${r.statusText}`);const t=await r.json(),n=["fastestFee","halfHourFee","hourFee","economyFee","minimumFee"];for(const s of n)if(!I(t[s]))throw new Error(`Invalid fee rate ${s}=${t[s]} from mempool API: expected a positive number ≤ ${w}`);if(t.minimumFee>t.economyFee||t.economyFee>t.hourFee||t.hourFee>t.halfHourFee||t.halfHourFee>t.fastestFee)throw new Error(`Fee rate ordering violation from mempool API: expected minimumFee (${t.minimumFee}) <= economyFee (${t.economyFee}) <= hourFee (${t.hourFee}) <= halfHourFee (${t.halfHourFee}) <= fastestFee (${t.fastestFee}).`);return t}exports.MEMPOOL_API_URLS=p;exports.getAddressTxs=b;exports.getAddressUtxos=v;exports.getMempoolApiUrl=A;exports.getNetworkFees=P;exports.getTipHeight=T;exports.getTxHex=x;exports.getTxInfo=E;exports.getUtxoInfo=y;exports.pushTx=F;
|
|
2
|
+
//# sourceMappingURL=mempoolApi-DEAS9wVa.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mempoolApi-DEAS9wVa.cjs","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 {\n BITCOIN_ADDRESS_RE,\n HEX_RE,\n KNOWN_SCRIPT_PREFIXES,\n TXID_RE,\n} from \"../../utils/validation\";\n\nimport type { MempoolUTXO, NetworkFees, TxInfo, UtxoInfo } 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\n try {\n // Don't clear timeout here — let it cover body consumption by callers\n return await fetch(url, {\n ...options,\n signal: AbortSignal.any(signals),\n });\n } catch (error) {\n clearTimeout(timeoutId);\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;\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 * @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\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 if (!/^\\d+$/.test(trimmed)) {\n throw new Error(\n `Mempool API returned an invalid block tip height: \"${raw}\"`,\n );\n }\n return Number.parseInt(trimmed, 10);\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","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","getTxInfo","getTipHeight","raw","trimmed","getTxHex","getUtxoInfo","txInfo","output","getAddressUtxos","utxos","addressInfo","utxo","a","b","getMempoolApiUrl","network","getAddressTxs","getNetworkFees","data","feeFields","field"],"mappings":"0DAmBMA,EAAe,KAAa,IAG5BC,EAA6B,IAMnC,eAAeC,EACbC,EACAC,EACmB,CACnB,MAAMC,EAAa,IAAI,gBACjBC,EAAY,WAChB,IAAMD,EAAW,MAAA,EACjBJ,CAAA,EAIIM,EAAU,CAACF,EAAW,OAAQD,GAAA,YAAAA,EAAS,MAAM,EAAE,OACnD,OAAA,EAGF,GAAI,CAEF,OAAO,MAAM,MAAMD,EAAK,CACtB,GAAGC,EACH,OAAQ,YAAY,IAAIG,CAAO,CAAA,CAChC,CACH,OAASC,EAAO,CAEd,MADA,aAAaF,CAAS,EAEpBE,GAAS,MACT,OAAOA,GAAU,UACjB,SAAUA,GACVA,EAAM,OAAS,aAET,IAAI,MACR,uCAAuCP,CAA0B,OAAOE,CAAG,EAAA,EAGzEK,CACR,CACF,CAMA,MAAMC,EAAe,IAErB,SAASC,EAAoBC,EAAwB,CACnD,OAAO,OAAO,UAAUA,CAAK,GAAKA,EAAQ,GAAKA,GAASX,CAC1D,CAEA,SAASY,EAAeD,EAAwB,CAC9C,OAAO,OAAO,UAAUA,CAAK,GAAKA,EAAQ,GAAKA,GAASF,CAC1D,CAEA,SAASI,EAAYC,EAAcC,EAA+B,CAChE,MAAI,CAAC,OAAO,UAAUD,CAAI,GAAKA,EAAO,EAAU,GACzCC,IAAgB,QAAaD,EAAOC,CAC7C,CAGA,SAASC,EAAgBC,EAAoB,CAC3C,GAAI,CAACC,EAAAA,QAAQ,KAAKD,CAAI,EACpB,MAAM,IAAI,MAAM,kCAAkCA,CAAI,EAAE,CAE5D,CAEA,SAASE,EAAmBC,EAAuB,CACjD,GAAI,CAACC,EAAAA,mBAAmB,KAAKD,CAAO,EAClC,MAAM,IA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AA,EACvB,CACJ,OAASxC,EAAO,CACd,MAAIA,aAAiB,MACb,IAAI,MACR,mCAAmCY,CAAO,KAAKZ,EAAM,OAAO,EAAA,EAG1D,IAAI,MACR,mCAAmCY,CAAO,iBAAA,CAE9C,CACF,CAQO,SAAS+B,EACdC,EACQ,CACR,OAAOxB,EAAiBwB,CAAO,CACjC,CAuBA,eAAsBC,EACpBjC,EACAe,EACsB,CACtB,OAAAhB,EAAmBC,CAAO,EACnBS,EAAsB,GAAGM,CAAM,YAAYf,CAAO,MAAM,CACjE,CAWA,eAAsBkC,EAAenB,EAAsC,CACzE,MAAML,EAAW,MAAM5B,EAAiB,GAAGiC,CAAM,sBAAsB,EAEvE,GAAI,CAACL,EAAS,GACZ,MAAM,IAAI,MACR,iCAAiCA,EAAS,MAAM,IAAIA,EAAS,UAAU,EAAA,EAI3E,MAAMyB,EAAO,MAAMzB,EAAS,KAAA,EAEtB0B,EAAY,CAChB,aACA,cACA,UACA,aACA,YAAA,EAGF,UAAWC,KAASD,EAClB,GAAI,CAAC5C,EAAe2C,EAAKE,CAAK,CAAC,EAC7B,MAAM,IAAI,MACR,oBAAoBA,CAAK,IAAIF,EAAKE,CAAK,CAAC,mDAAmDhD,CAAY,EAAA,EAK7G,GACE8C,EAAK,WAAaA,EAAK,YACvBA,EAAK,WAAaA,EAAK,SACvBA,EAAK,QAAUA,EAAK,aACpBA,EAAK,YAAcA,EAAK,WAExB,MAAM,IAAI,MACR,sEACiBA,EAAK,UAAU,oBAAoBA,EAAK,UAAU,iBACrDA,EAAK,OAAO,qBAAqBA,EAAK,WAAW,oBAC9CA,EAAK,UAAU,IAAA,EAIpC,OAAOA,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../mempoolApi-DEAS9wVa.cjs"),e=require("../../../types-Be3sAYzr.cjs"),t=require("../../../types-eYlq0p1o.cjs");exports.MEMPOOL_API_URLS=r.MEMPOOL_API_URLS;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.OnChainBtcVaultStatus=e.OnChainBtcVaultStatus;exports.ServerIdentityError=e.ServerIdentityError;exports.VaultProviderRpcClient=e.VaultProviderRpcClient;exports.ViemProtocolParamsReader=e.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=e.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=e.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=e.ViemVaultRegistryReader;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.validateOffchainParams=e.validateOffchainParams;exports.validatePegInConfiguration=e.validatePegInConfiguration;exports.validateRequestDepositorClaimerArtifactsResponse=e.validateRequestDepositorClaimerArtifactsResponse;exports.validateTBVProtocolParams=e.validateTBVProtocolParams;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,45 +1,46 @@
|
|
|
1
|
-
import { M as s, g as r, a as t, b as o, c as i, d as R, e as
|
|
2
|
-
import { O as
|
|
3
|
-
import { A as
|
|
1
|
+
import { M as s, g as r, a as t, b as o, c as i, d as R, e as T, f as S, h as l, p as n } from "../../../mempoolApi-C7hkVkym.js";
|
|
2
|
+
import { O as p, S as A, V as P, j as _, k as E, l as V, m as g, a as c, d as m, b as I, f as v, p as f, r as O, g as C, h as U, v as u, i as x, c as h, e as y } from "../../../types-0bvDGR4x.js";
|
|
3
|
+
import { A as N, D as M, b as k, J as b, 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
N as AUTH_EXPIRED_DATA_KIND,
|
|
6
|
+
M as DaemonStatus,
|
|
7
|
+
k as JSON_RPC_ERROR_CODES,
|
|
8
|
+
b as JsonRpcClient,
|
|
9
|
+
B as JsonRpcError,
|
|
10
10
|
s as MEMPOOL_API_URLS,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
p as OnChainBtcVaultStatus,
|
|
12
|
+
H as POST_WOTS_STATUSES,
|
|
13
13
|
J as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
14
14
|
L as RpcErrorCode,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
A as ServerIdentityError,
|
|
16
|
+
F as VP_BATCH_MAX_SIZE,
|
|
17
|
+
K as VP_TERMINAL_FAILURE_STATUSES,
|
|
18
|
+
X as VP_TRANSIENT_STATUSES,
|
|
19
|
+
P as VaultProviderRpcClient,
|
|
20
|
+
_ as ViemProtocolParamsReader,
|
|
21
|
+
E as ViemUniversalChallengerReader,
|
|
22
|
+
V as ViemVaultKeeperReader,
|
|
23
|
+
g as ViemVaultRegistryReader,
|
|
24
24
|
c as VpResponseValidationError,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
m as VpTokenRegistry,
|
|
26
|
+
I as batchPollByProvider,
|
|
27
|
+
v as createAuthenticatedVpClient,
|
|
28
28
|
r as getAddressTxs,
|
|
29
29
|
t as getAddressUtxos,
|
|
30
30
|
o as getMempoolApiUrl,
|
|
31
31
|
i as getNetworkFees,
|
|
32
|
-
R as
|
|
32
|
+
R as getTipHeight,
|
|
33
|
+
T as getTxHex,
|
|
33
34
|
S as getTxInfo,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
l as getUtxoInfo,
|
|
36
|
+
f as primeVpTokenRegistry,
|
|
37
|
+
n as pushTx,
|
|
38
|
+
O as resolveProtocolAddresses,
|
|
39
|
+
C as validateOffchainParams,
|
|
40
|
+
U as validatePegInConfiguration,
|
|
41
|
+
u as validateRequestDepositorClaimerArtifactsResponse,
|
|
42
|
+
x as validateTBVProtocolParams,
|
|
43
|
+
h as verifyServerIdentity,
|
|
43
44
|
y as vpTokenRegistry
|
|
44
45
|
};
|
|
45
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module clients/mempool
|
|
7
7
|
*/
|
|
8
|
-
export { getAddressTxs, getAddressUtxos, getMempoolApiUrl, getNetworkFees, getTxHex, getTxInfo, getUtxoInfo, MEMPOOL_API_URLS, pushTx, } from './mempoolApi';
|
|
8
|
+
export { getAddressTxs, getAddressUtxos, getMempoolApiUrl, getNetworkFees, getTipHeight, getTxHex, getTxInfo, getUtxoInfo, MEMPOOL_API_URLS, pushTx, } from './mempoolApi';
|
|
9
9
|
export type { AddressTx } from './mempoolApi';
|
|
10
10
|
export type { MempoolUTXO, NetworkFees, TxInfo, TxInput, TxOutput, TxStatus, UtxoInfo, } from './types';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/mempool/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,YAAY,EACV,WAAW,EACX,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/mempool/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,YAAY,EACV,WAAW,EACX,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,SAAS,CAAC"}
|
|
@@ -24,6 +24,17 @@ export declare function pushTx(txHex: string, apiUrl: string): Promise<string>;
|
|
|
24
24
|
* @returns Transaction information
|
|
25
25
|
*/
|
|
26
26
|
export declare function getTxInfo(txid: string, apiUrl: string): Promise<TxInfo>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the current block tip height.
|
|
29
|
+
*
|
|
30
|
+
* Source: mempool.space API — `GET /api/blocks/tip/height` returns the height
|
|
31
|
+
* of the most recent block as a plain-text integer.
|
|
32
|
+
*
|
|
33
|
+
* @param apiUrl - Mempool API base URL
|
|
34
|
+
* @returns The height of the most recent block
|
|
35
|
+
* @throws Error if the response is not a whole number
|
|
36
|
+
*/
|
|
37
|
+
export declare function getTipHeight(apiUrl: string): Promise<number>;
|
|
27
38
|
/**
|
|
28
39
|
* Get the hex representation of a transaction.
|
|
29
40
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mempoolApi.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/mempool/mempoolApi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAkG1E;;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;;;;;;;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;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAkG1E;;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;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASlE;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"}
|
|
@@ -16,13 +16,6 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @module tbv/core/clients/vault-provider/auth/serverIdentity
|
|
18
18
|
*/
|
|
19
|
-
/**
|
|
20
|
-
* Cap on `proof.expires_at - now`. Bounds how long a leaked VP
|
|
21
|
-
* ephemeral key stays usable; the bearer token's own TTL does not
|
|
22
|
-
* (different trust boundary). 2h = Rust ref VP's 1h rotation × 2 for
|
|
23
|
-
* clock skew. Override per call via `maxLifetimeSecs`.
|
|
24
|
-
*/
|
|
25
|
-
export declare const DEFAULT_MAX_PROOF_LIFETIME_SECS: number;
|
|
26
19
|
/**
|
|
27
20
|
* Wire representation from btc-vault's `ServerIdentityResponse`.
|
|
28
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverIdentity.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/serverIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"serverIdentity.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/clients/vault-provider/auth/serverIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAiCH;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,yDAAyD;IACzD,KAAK,EAAE,sBAAsB,CAAC;IAC9B;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,sGAAsG;IACtG,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAG1B,MAAM,EAClB,wBAAwB,GACxB,SAAS,GACT,iBAAiB,GACjB,oBAAoB,GACpB,sBAAsB,GACtB,yBAAyB,GACzB,0BAA0B,GAC1B,4BAA4B,GAC5B,+BAA+B;gBAVnC,OAAO,EAAE,MAAM,EACC,MAAM,EAClB,wBAAwB,GACxB,SAAS,GACT,iBAAiB,GACjB,oBAAoB,GACpB,sBAAsB,GACtB,yBAAyB,GACzB,0BAA0B,GAC1B,4BAA4B,GAC5B,+BAA+B;CAKtC;AAYD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,IAAI,CAuH3E"}
|
package/dist/tbv/core/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../../challengeAssert-rpDaS3fH.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("../../assertPsbtUnsignedTxMatches-r1svclbd.cjs"),A=require("../../peginInput-DH6X4ITS.cjs"),_=require("../../noPayout-B06Z9RTe.cjs"),r=require("../../bitcoin-CHfKAhcI.cjs"),g=require("../../signing-Bnsro0hE.cjs"),d=require("../../validation-u8W7Lp2x.cjs"),n=require("../../PeginManager-Dof0ZO1S.cjs"),S=require("../../PayoutManager-B5bovfkD.cjs"),p=require("../../ProtocolParams.abi-DQhcqsNr.cjs"),m=require("../../BTCVaultRegistry.abi-CHFGevwa.cjs"),P=require("../../errors-BP73_stm.cjs"),i=require("../../waitForTransactionReceiptSmartAware-tv1mtSIY.cjs"),a=require("../../fundPeginTransaction-BBE3wTjR.cjs"),l=require("../../reservation-hjXStM03.cjs"),s=require("../../mempoolApi-YNkKjQCU.cjs"),t=require("../../types-Be3sAYzr.cjs"),o=require("../../types-eYlq0p1o.cjs"),R=require("../../errors-Bu0H-dZD.cjs"),e=require("../../buildAndBroadcastRefund-Cj8JDI7F.cjs"),T=require("../../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=E.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=E.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>c.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>c.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>c.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>c.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>c.expandWotsSeed});exports.PsbtSubstitutionError=u.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=u.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=u.buildPrePeginPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.buildPeginInputPsbt=A.buildPeginInputPsbt;exports.extractPeginInputSignature=A.extractPeginInputSignature;exports.finalizePeginInputPsbt=A.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=_.buildNoPayoutPsbt;exports.buildRefundPsbt=_.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=g.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=d.BITCOIN_ADDRESS_RE;exports.HEX_RE=d.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=d.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=d.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=d.TXID_RE;exports.PeginManager=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=n.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=S.PayoutManager;exports.computeHashlock=S.computeHashlock;exports.validateSecretAgainstHashlock=S.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=p.ApplicationRegistryABI;exports.ProtocolParamsABI=p.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=P.CONTRACT_ERRORS;exports.extractErrorData=P.extractErrorData;exports.getContractErrorMessage=P.getContractErrorMessage;exports.handleContractError=P.handleContractError;exports.isKnownContractError=P.isKnownContractError;exports.BitcoinScriptType=i.BitcoinScriptType;exports.applyChangeOutputPolicy=i.applyChangeOutputPolicy;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.computeChangeOutputFeeSats=i.computeChangeOutputFeeSats;exports.computeMaxDeposit=i.computeMaxDeposit;exports.computePeginBaseFeeSats=i.computePeginBaseFeeSats;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=i.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.UtxoNotAvailableError=l.UtxoNotAvailableError;exports.assertUtxosAvailable=l.assertUtxosAvailable;exports.collectReservedUtxoRefs=l.collectReservedUtxoRefs;exports.extractInputsFromTransaction=l.extractInputsFromTransaction;exports.selectUtxosForDeposit=l.selectUtxosForDeposit;exports.validateUtxosAvailable=l.validateUtxosAvailable;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.OnChainBtcVaultStatus=t.OnChainBtcVaultStatus;exports.ServerIdentityError=t.ServerIdentityError;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.VpTokenRegistry=t.VpTokenRegistry;exports.batchPollByProvider=t.batchPollByProvider;exports.createAuthenticatedVpClient=t.createAuthenticatedVpClient;exports.primeVpTokenRegistry=t.primeVpTokenRegistry;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateOffchainParams=t.validateOffchainParams;exports.validatePegInConfiguration=t.validatePegInConfiguration;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.validateTBVProtocolParams=t.validateTBVProtocolParams;exports.verifyServerIdentity=t.verifyServerIdentity;exports.vpTokenRegistry=t.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=o.AUTH_EXPIRED_DATA_KIND;exports.DaemonStatus=o.DaemonStatus;exports.JSON_RPC_ERROR_CODES=o.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=o.JsonRpcClient;exports.JsonRpcError=o.JsonRpcError;exports.POST_WOTS_STATUSES=o.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=o.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=o.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=o.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=o.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=o.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=R.isWotsMismatchError;exports.parseFundingOutpointsFromTx=R.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=T.ContractStatus;exports.PeginAction=T.PeginAction;exports.canPerformAction=T.canPerformAction;exports.getPeginProtocolState=T.getPeginProtocolState;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../../challengeAssert-rpDaS3fH.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("../../assertPsbtUnsignedTxMatches-r1svclbd.cjs"),A=require("../../peginInput-DH6X4ITS.cjs"),p=require("../../noPayout-B06Z9RTe.cjs"),r=require("../../bitcoin-CHfKAhcI.cjs"),g=require("../../signing-Bnsro0hE.cjs"),d=require("../../validation-u8W7Lp2x.cjs"),n=require("../../PeginManager-UqbOj2oV.cjs"),S=require("../../PayoutManager-B5bovfkD.cjs"),_=require("../../ProtocolParams.abi-DQhcqsNr.cjs"),m=require("../../BTCVaultRegistry.abi-CHFGevwa.cjs"),P=require("../../errors-BP73_stm.cjs"),i=require("../../waitForTransactionReceiptSmartAware-tv1mtSIY.cjs"),a=require("../../fundPeginTransaction-BBE3wTjR.cjs"),l=require("../../reservation-hjXStM03.cjs"),s=require("../../mempoolApi-DEAS9wVa.cjs"),t=require("../../types-Be3sAYzr.cjs"),o=require("../../types-eYlq0p1o.cjs"),R=require("../../errors-Bu0H-dZD.cjs"),e=require("../../buildAndBroadcastRefund-Cj8JDI7F.cjs"),T=require("../../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=E.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=E.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>c.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>c.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>c.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>c.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>c.expandWotsSeed});exports.PsbtSubstitutionError=u.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=u.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=u.buildPrePeginPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.buildPeginInputPsbt=A.buildPeginInputPsbt;exports.extractPeginInputSignature=A.extractPeginInputSignature;exports.finalizePeginInputPsbt=A.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=p.buildNoPayoutPsbt;exports.buildRefundPsbt=p.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=g.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=d.BITCOIN_ADDRESS_RE;exports.HEX_RE=d.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=d.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=d.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=d.TXID_RE;exports.PeginManager=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=n.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=S.PayoutManager;exports.computeHashlock=S.computeHashlock;exports.validateSecretAgainstHashlock=S.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=P.CONTRACT_ERRORS;exports.extractErrorData=P.extractErrorData;exports.getContractErrorMessage=P.getContractErrorMessage;exports.handleContractError=P.handleContractError;exports.isKnownContractError=P.isKnownContractError;exports.BitcoinScriptType=i.BitcoinScriptType;exports.applyChangeOutputPolicy=i.applyChangeOutputPolicy;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.computeChangeOutputFeeSats=i.computeChangeOutputFeeSats;exports.computeMaxDeposit=i.computeMaxDeposit;exports.computePeginBaseFeeSats=i.computePeginBaseFeeSats;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=i.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.UtxoNotAvailableError=l.UtxoNotAvailableError;exports.assertUtxosAvailable=l.assertUtxosAvailable;exports.collectReservedUtxoRefs=l.collectReservedUtxoRefs;exports.extractInputsFromTransaction=l.extractInputsFromTransaction;exports.selectUtxosForDeposit=l.selectUtxosForDeposit;exports.validateUtxosAvailable=l.validateUtxosAvailable;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getTipHeight=s.getTipHeight;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.OnChainBtcVaultStatus=t.OnChainBtcVaultStatus;exports.ServerIdentityError=t.ServerIdentityError;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.VpTokenRegistry=t.VpTokenRegistry;exports.batchPollByProvider=t.batchPollByProvider;exports.createAuthenticatedVpClient=t.createAuthenticatedVpClient;exports.primeVpTokenRegistry=t.primeVpTokenRegistry;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateOffchainParams=t.validateOffchainParams;exports.validatePegInConfiguration=t.validatePegInConfiguration;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.validateTBVProtocolParams=t.validateTBVProtocolParams;exports.verifyServerIdentity=t.verifyServerIdentity;exports.vpTokenRegistry=t.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=o.AUTH_EXPIRED_DATA_KIND;exports.DaemonStatus=o.DaemonStatus;exports.JSON_RPC_ERROR_CODES=o.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=o.JsonRpcClient;exports.JsonRpcError=o.JsonRpcError;exports.POST_WOTS_STATUSES=o.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=o.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=o.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=o.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=o.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=o.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=R.isWotsMismatchError;exports.parseFundingOutpointsFromTx=R.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=T.ContractStatus;exports.PeginAction=T.PeginAction;exports.canPerformAction=T.canPerformAction;exports.getPeginProtocolState=T.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/core/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { a as b, b as I } from "../../noPayout-CS2wnluA.js";
|
|
|
6
6
|
import { d as O, a as v, b as F, e as V, f as U, j as h, g as y, h as N, i as D, c as B, p as M, s as H, t as L, u as X, v as k } from "../../bitcoin-B5aNKtsk.js";
|
|
7
7
|
import { c as K } from "../../signing-DaLvGwQe.js";
|
|
8
8
|
import { B as G, H as Y, K as Z, M as J, T as j } from "../../validation-CxqROCno.js";
|
|
9
|
-
import { P as z, V as Q, b as $, a as aa, c as ea, f as sa, d as ta, e as ra } from "../../PeginManager-
|
|
9
|
+
import { P as z, V as Q, b as $, a as aa, c as ea, f as sa, d as ta, e as ra } from "../../PeginManager-D9ZZ8wx2.js";
|
|
10
10
|
import { P as ia, c as na, v as ua } from "../../PayoutManager-DChODEOJ.js";
|
|
11
11
|
import { A as pa, P as da } from "../../ProtocolParams.abi-C2brDWTI.js";
|
|
12
12
|
import { B as ca } from "../../BTCVaultRegistry.abi-Cq9-JlqT.js";
|
|
@@ -14,75 +14,75 @@ import { C as Ea, e as Aa, g as Sa, h as Ra, i as _a } from "../../errors-CznAK5
|
|
|
14
14
|
import { B as ma, a as xa, f as fa, c as ba, b as Ia, d as Ca, g as Oa, i as va, h as Fa, s as Va, e as Ua, w as ha } from "../../waitForTransactionReceiptSmartAware-CmgFXFza.js";
|
|
15
15
|
import { B as Na, D as Da, F as Ba, L as Ma, M as Ha, P as La, b as Xa, a as ka, S as Wa, T as Ka, W as wa, f as Ga, c as Ya, p as Za, r as Ja } from "../../fundPeginTransaction-t-6TsHAY.js";
|
|
16
16
|
import { U as qa, a as za, c as Qa, e as $a, s as ae, v as ee } from "../../reservation-CB-4FBPk.js";
|
|
17
|
-
import { M as te, g as re, a as oe, b as ie, c as ne, d as ue, e as le, f as pe,
|
|
18
|
-
import { O as
|
|
19
|
-
import { A as
|
|
20
|
-
import { i as
|
|
21
|
-
import { B as
|
|
22
|
-
import { C as
|
|
17
|
+
import { M as te, g as re, a as oe, b as ie, c as ne, d as ue, e as le, f as pe, h as de, p as Pe } from "../../mempoolApi-C7hkVkym.js";
|
|
18
|
+
import { O as Te, S as Ee, V as Ae, j as Se, k as Re, l as _e, m as ge, a as me, d as xe, b as fe, f as be, p as Ie, r as Ce, g as Oe, h as ve, v as Fe, i as Ve, c as Ue, e as he } from "../../types-0bvDGR4x.js";
|
|
19
|
+
import { A as Ne, D as De, b as Be, J as Me, a as He, d as Le, P as Xe, R as ke, e as We, c as Ke, V as we } from "../../types-BqGAMOZM.js";
|
|
20
|
+
import { i as Ye, p as Ze } from "../../errors-9AkghWyk.js";
|
|
21
|
+
import { B as je, C as qe, p as ze, q as Qe, t as $e, u as as, R as es, a as ss, n as ts, o as rs, i as os, m as is, l as ns, j as us, r as ls, b as ps, s as ds, v as Ps, g as cs, h as Ts, d as Es, c as As, e as Ss, f as Rs, k as _s, w as gs } from "../../buildAndBroadcastRefund-fIHDHiFh.js";
|
|
22
|
+
import { C as xs, P as fs, c as bs, g as Is } from "../../peginState-CBAlxgXk.js";
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
Ne as AUTH_EXPIRED_DATA_KIND,
|
|
25
25
|
pa as ApplicationRegistryABI,
|
|
26
|
-
|
|
26
|
+
je as BIP68NotMatureError,
|
|
27
27
|
G as BITCOIN_ADDRESS_RE,
|
|
28
28
|
ca as BTCVaultRegistryABI,
|
|
29
29
|
Na as BTC_DUST_SAT,
|
|
30
30
|
ma as BitcoinScriptType,
|
|
31
31
|
Ea as CONTRACT_ERRORS,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
qe as ClaimerPegoutStatusValue,
|
|
33
|
+
xs as ContractStatus,
|
|
34
34
|
Da as DUST_THRESHOLD,
|
|
35
|
-
|
|
35
|
+
De as DaemonStatus,
|
|
36
36
|
Ba as FEE_SAFETY_MARGIN,
|
|
37
37
|
Y as HEX_RE,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
Be as JSON_RPC_ERROR_CODES,
|
|
39
|
+
Me as JsonRpcClient,
|
|
40
|
+
He as JsonRpcError,
|
|
41
41
|
Z as KNOWN_SCRIPT_PREFIXES,
|
|
42
42
|
Ma as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
43
43
|
Ha as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
44
44
|
J as MAX_REASONABLE_FEE_SATS,
|
|
45
45
|
te as MEMPOOL_API_URLS,
|
|
46
|
-
|
|
46
|
+
Te as OnChainBtcVaultStatus,
|
|
47
47
|
La as P2TR_INPUT_SIZE,
|
|
48
48
|
Xa as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
49
49
|
ka as PEGIN_FIXED_OUTPUTS,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Le as POST_WOTS_STATUSES,
|
|
51
|
+
Xe as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
52
52
|
ia as PayoutManager,
|
|
53
|
-
|
|
53
|
+
fs as PeginAction,
|
|
54
54
|
z as PeginManager,
|
|
55
55
|
da as ProtocolParamsABI,
|
|
56
56
|
P as PsbtSubstitutionError,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
ze as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
|
|
58
|
+
Qe as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
59
|
+
$e as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
60
|
+
as as REFUND_VSIZE,
|
|
61
|
+
es as RegisteredVaultVersionMismatchError,
|
|
62
|
+
ke as RpcErrorCode,
|
|
63
63
|
Wa as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
64
|
-
|
|
64
|
+
Ee as ServerIdentityError,
|
|
65
65
|
j as TXID_RE,
|
|
66
66
|
Ka as TX_BUFFER_SIZE_OVERHEAD,
|
|
67
67
|
qa as UtxoNotAvailableError,
|
|
68
68
|
Q as VAULT_APP_NAME,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
We as VP_BATCH_MAX_SIZE,
|
|
70
|
+
Ke as VP_TERMINAL_FAILURE_STATUSES,
|
|
71
|
+
we as VP_TRANSIENT_STATUSES,
|
|
72
|
+
Ae as VaultProviderRpcClient,
|
|
73
|
+
Se as ViemProtocolParamsReader,
|
|
74
|
+
Re as ViemUniversalChallengerReader,
|
|
75
|
+
_e as ViemVaultKeeperReader,
|
|
76
|
+
ge as ViemVaultRegistryReader,
|
|
77
|
+
me as VpResponseValidationError,
|
|
78
|
+
xe as VpTokenRegistry,
|
|
79
79
|
wa as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
80
|
-
|
|
80
|
+
ss as activateVault,
|
|
81
81
|
xa as applyChangeOutputPolicy,
|
|
82
82
|
c as assertPsbtUnsignedTxMatches,
|
|
83
83
|
za as assertUtxosAvailable,
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
fe as batchPollByProvider,
|
|
85
|
+
ts as buildAndBroadcastRefund,
|
|
86
86
|
s as buildChallengeAssertPsbt,
|
|
87
87
|
t as buildDepositorPayoutPsbt,
|
|
88
88
|
$ as buildFundingOutpointsCommitment,
|
|
@@ -94,7 +94,7 @@ export {
|
|
|
94
94
|
I as buildRefundPsbt,
|
|
95
95
|
aa as buildVaultContext,
|
|
96
96
|
fa as calculateBtcTxHash,
|
|
97
|
-
|
|
97
|
+
bs as canPerformAction,
|
|
98
98
|
Qa as collectReservedUtxoRefs,
|
|
99
99
|
ba as computeChangeOutputFeeSats,
|
|
100
100
|
na as computeHashlock,
|
|
@@ -103,7 +103,7 @@ export {
|
|
|
103
103
|
r as computeNumLocalChallengers,
|
|
104
104
|
Ca as computePeginBaseFeeSats,
|
|
105
105
|
ea as computeWotsBlockPublicKeysHash,
|
|
106
|
-
|
|
106
|
+
be as createAuthenticatedVpClient,
|
|
107
107
|
S as createPayoutScript,
|
|
108
108
|
K as createTaprootScriptPathSignOptions,
|
|
109
109
|
O as deriveBip86ScriptPubKeyHex,
|
|
@@ -113,7 +113,7 @@ export {
|
|
|
113
113
|
sa as deriveVaultRoot,
|
|
114
114
|
ta as deriveWotsBlocksFromSeed,
|
|
115
115
|
V as ensureHexPrefix,
|
|
116
|
-
|
|
116
|
+
rs as estimateRefundFeeSats,
|
|
117
117
|
ra as estimateSubmitPeginRequestBatchGas,
|
|
118
118
|
u as expandAuthAnchor,
|
|
119
119
|
l as expandHashlockSecret,
|
|
@@ -132,58 +132,59 @@ export {
|
|
|
132
132
|
ie as getMempoolApiUrl,
|
|
133
133
|
h as getNetwork,
|
|
134
134
|
ne as getNetworkFees,
|
|
135
|
-
|
|
135
|
+
Is as getPeginProtocolState,
|
|
136
136
|
va as getPsbtInputFields,
|
|
137
137
|
Fa as getScriptType,
|
|
138
138
|
y as getSortedXOnlyPubkeys,
|
|
139
|
-
ue as
|
|
140
|
-
le as
|
|
141
|
-
pe as
|
|
139
|
+
ue as getTipHeight,
|
|
140
|
+
le as getTxHex,
|
|
141
|
+
pe as getTxInfo,
|
|
142
|
+
de as getUtxoInfo,
|
|
142
143
|
Ra as handleContractError,
|
|
143
144
|
N as hexToUint8Array,
|
|
144
145
|
D as isAddressFromPublicKey,
|
|
145
|
-
|
|
146
|
+
os as isDepositAmountValid,
|
|
146
147
|
_a as isKnownContractError,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
is as isPegoutTerminalStatus,
|
|
149
|
+
ns as isRecognizedPegoutStatus,
|
|
150
|
+
us as isRegisteredVaultVersionMismatchError,
|
|
150
151
|
B as isValidHex,
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
Ye as isWotsMismatchError,
|
|
153
|
+
Ze as parseFundingOutpointsFromTx,
|
|
153
154
|
Ya as parseUnfundedWasmTransaction,
|
|
154
155
|
Za as peginOutputCount,
|
|
155
|
-
|
|
156
|
+
Ie as primeVpTokenRegistry,
|
|
156
157
|
M as processPublicKeyToXOnly,
|
|
157
|
-
|
|
158
|
+
Pe as pushTx,
|
|
158
159
|
Ja as rateBasedTxBufferFee,
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
Ce as resolveProtocolAddresses,
|
|
161
|
+
ls as runDepositorPresignFlow,
|
|
161
162
|
ae as selectUtxosForDeposit,
|
|
162
163
|
Va as selectUtxosForPegin,
|
|
163
164
|
Ua as shouldAddChangeOutput,
|
|
164
|
-
|
|
165
|
+
ps as signDepositorGraph,
|
|
165
166
|
H as stripHexPrefix,
|
|
166
|
-
|
|
167
|
+
ds as submitWotsPublicKey,
|
|
167
168
|
L as toXOnly,
|
|
168
169
|
X as uint8ArrayToHex,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
170
|
+
Ps as validateDepositAmount,
|
|
171
|
+
cs as validateMultiVaultDepositInputs,
|
|
172
|
+
Oe as validateOffchainParams,
|
|
173
|
+
Ts as validateOnChainParticipantKeys,
|
|
174
|
+
ve as validatePegInConfiguration,
|
|
175
|
+
Es as validateProviderSelection,
|
|
176
|
+
As as validateRemainingCapacity,
|
|
177
|
+
Fe as validateRequestDepositorClaimerArtifactsResponse,
|
|
177
178
|
ua as validateSecretAgainstHashlock,
|
|
178
|
-
|
|
179
|
+
Ve as validateTBVProtocolParams,
|
|
179
180
|
ee as validateUtxosAvailable,
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
Ss as validateVaultAmounts,
|
|
182
|
+
Rs as validateVaultProviderPubkey,
|
|
182
183
|
k as validateWalletPubkey,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
_s as verifyRegisteredVaultVersions,
|
|
185
|
+
Ue as verifyServerIdentity,
|
|
186
|
+
he as vpTokenRegistry,
|
|
187
|
+
gs as waitForPeginStatus,
|
|
187
188
|
ha as waitForTransactionReceiptSmartAware
|
|
188
189
|
};
|
|
189
190
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-UqbOj2oV.cjs"),a=require("../../../PayoutManager-B5bovfkD.cjs");exports.PeginManager=e.PeginManager;exports.estimateSubmitPeginRequestBatchGas=e.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=a.PayoutManager;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -22,23 +22,6 @@
|
|
|
22
22
|
* pushes a payload other than `expectedAuthAnchorHashHex`.
|
|
23
23
|
*/
|
|
24
24
|
export declare function assertAuthAnchorOpReturn(fundedPrePeginTxHex: string, vaultCount: number, expectedAuthAnchorHashHex: string): void;
|
|
25
|
-
/**
|
|
26
|
-
* Best-effort reader for the auth-anchor OP_RETURN payload at `vout` of
|
|
27
|
-
* a funded Pre-PegIn transaction.
|
|
28
|
-
*
|
|
29
|
-
* Returns the 32-byte payload as lowercase hex (no `0x` prefix) if the
|
|
30
|
-
* output at `vout` is exactly `OP_RETURN || PUSH32 || <32 bytes>` with
|
|
31
|
-
* a zero value. Returns `undefined` for any structural mismatch —
|
|
32
|
-
* missing output, wrong script shape, non-zero value — so legacy
|
|
33
|
-
* non-auth-anchored Pre-PegIns parse as "no anchor" rather than
|
|
34
|
-
* raising.
|
|
35
|
-
*
|
|
36
|
-
* Used by the refund flow to reconstruct the unfunded WASM template
|
|
37
|
-
* with the same output shape as the on-chain funded transaction.
|
|
38
|
-
* Assertion semantics (compare against an expected value, throw on
|
|
39
|
-
* mismatch) live in {@link assertAuthAnchorOpReturn}.
|
|
40
|
-
*/
|
|
41
|
-
export declare function readAuthAnchorOpReturn(fundedPrePeginTxHex: string, vout: number): string | undefined;
|
|
42
25
|
/**
|
|
43
26
|
* Scan a funded Pre-PegIn transaction for its auth-anchor commitment
|
|
44
27
|
* (an `OP_RETURN || PUSH32 || <32 bytes>` output with value 0).
|