@babylonlabs-io/ts-sdk 3.1.2 → 3.2.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.
Files changed (88) hide show
  1. package/dist/BTCVaultRegistry.abi-BH2-LHxN.cjs +2 -0
  2. package/dist/BTCVaultRegistry.abi-BH2-LHxN.cjs.map +1 -0
  3. package/dist/{BTCVaultRegistry.abi-BmHpMUWD.js → BTCVaultRegistry.abi-BzNTa_EU.js} +19 -1
  4. package/dist/BTCVaultRegistry.abi-BzNTa_EU.js.map +1 -0
  5. package/dist/{PeginManager-PyKbfy5q.cjs → PeginManager-BHplS4dM.cjs} +2 -2
  6. package/dist/{PeginManager-PyKbfy5q.cjs.map → PeginManager-BHplS4dM.cjs.map} +1 -1
  7. package/dist/{PeginManager-Dfr5Qe1g.js → PeginManager-DcwGom01.js} +2 -2
  8. package/dist/{PeginManager-Dfr5Qe1g.js.map → PeginManager-DcwGom01.js.map} +1 -1
  9. package/dist/buildAndBroadcastReclaim-C7bq5wNM.cjs +2 -0
  10. package/dist/buildAndBroadcastReclaim-C7bq5wNM.cjs.map +1 -0
  11. package/dist/{buildAndBroadcastReclaim-R0HNpLMD.js → buildAndBroadcastReclaim-CcQ0b1be.js} +466 -456
  12. package/dist/buildAndBroadcastReclaim-CcQ0b1be.js.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +74 -74
  15. package/dist/pegin-registration-client-BogzOk8B.cjs +2 -0
  16. package/dist/pegin-registration-client-BogzOk8B.cjs.map +1 -0
  17. package/dist/{pegin-registration-client-kdz4fT5_.js → pegin-registration-client-DvyrUNku.js} +44 -43
  18. package/dist/pegin-registration-client-DvyrUNku.js.map +1 -0
  19. package/dist/peginState-CIibG9S_.js +75 -0
  20. package/dist/peginState-CIibG9S_.js.map +1 -0
  21. package/dist/peginState-IyE22wWh.cjs +2 -0
  22. package/dist/peginState-IyE22wWh.cjs.map +1 -0
  23. package/dist/{reservation-DOAHVT3B.js → reservation-BZQABu4g.js} +2 -2
  24. package/dist/{reservation-DOAHVT3B.js.map → reservation-BZQABu4g.js.map} +1 -1
  25. package/dist/{reservation-ECxjZi5t.cjs → reservation-CA5knoQ0.cjs} +2 -2
  26. package/dist/{reservation-ECxjZi5t.cjs.map → reservation-CA5knoQ0.cjs.map} +1 -1
  27. package/dist/{signer-set-reader-DFAu6I-v.cjs → signer-set-reader-D-CyIYR5.cjs} +2 -2
  28. package/dist/{signer-set-reader-DFAu6I-v.cjs.map → signer-set-reader-D-CyIYR5.cjs.map} +1 -1
  29. package/dist/{signer-set-reader-BCtmSKUM.js → signer-set-reader-DFF9MgQN.js} +2 -2
  30. package/dist/{signer-set-reader-BCtmSKUM.js.map → signer-set-reader-DFF9MgQN.js.map} +1 -1
  31. package/dist/tbv/core/clients/eth/index.cjs +1 -1
  32. package/dist/tbv/core/clients/eth/index.js +2 -2
  33. package/dist/tbv/core/clients/eth/types.d.ts +8 -0
  34. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  35. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  36. package/dist/tbv/core/clients/index.cjs +1 -1
  37. package/dist/tbv/core/clients/index.js +2 -2
  38. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +14 -0
  39. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
  40. package/dist/tbv/core/contracts/index.cjs +1 -1
  41. package/dist/tbv/core/contracts/index.js +1 -1
  42. package/dist/tbv/core/index.cjs +1 -1
  43. package/dist/tbv/core/index.js +84 -84
  44. package/dist/tbv/core/managers/index.cjs +1 -1
  45. package/dist/tbv/core/managers/index.js +1 -1
  46. package/dist/tbv/core/services/activation/activateVault.d.ts +50 -0
  47. package/dist/tbv/core/services/activation/activateVault.d.ts.map +1 -1
  48. package/dist/tbv/core/services/activation/index.d.ts +1 -1
  49. package/dist/tbv/core/services/activation/index.d.ts.map +1 -1
  50. package/dist/tbv/core/services/delegated-claim/__tests__/realWasmWatchtowerArtifacts.test.d.ts +9 -0
  51. package/dist/tbv/core/services/delegated-claim/__tests__/realWasmWatchtowerArtifacts.test.d.ts.map +1 -0
  52. package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts +5 -7
  53. package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts.map +1 -1
  54. package/dist/tbv/core/services/delegated-claim/index.d.ts +3 -4
  55. package/dist/tbv/core/services/delegated-claim/index.d.ts.map +1 -1
  56. package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts.map +1 -1
  57. package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts +14 -8
  58. package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts.map +1 -1
  59. package/dist/tbv/core/services/delegated-claim/types.d.ts +32 -19
  60. package/dist/tbv/core/services/delegated-claim/types.d.ts.map +1 -1
  61. package/dist/tbv/core/services/deposit/peginState.d.ts +20 -1
  62. package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
  63. package/dist/tbv/core/services/index.cjs +1 -1
  64. package/dist/tbv/core/services/index.js +58 -58
  65. package/dist/tbv/core/utils/index.cjs +1 -1
  66. package/dist/tbv/core/utils/index.js +1 -1
  67. package/dist/tbv/index.cjs +1 -1
  68. package/dist/tbv/index.js +84 -84
  69. package/dist/{toRefundInputs-BbAOOUg6.cjs → toRefundInputs-8DgBT_Bg.cjs} +2 -2
  70. package/dist/{toRefundInputs-BbAOOUg6.cjs.map → toRefundInputs-8DgBT_Bg.cjs.map} +1 -1
  71. package/dist/{toRefundInputs-DW14g6wH.js → toRefundInputs-CCMNAoRx.js} +2 -2
  72. package/dist/{toRefundInputs-DW14g6wH.js.map → toRefundInputs-CCMNAoRx.js.map} +1 -1
  73. package/dist/types-Bda75Od0.cjs.map +1 -1
  74. package/dist/types-C5jj3Cc-.js.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/BTCVaultRegistry.abi-BmHpMUWD.js.map +0 -1
  77. package/dist/BTCVaultRegistry.abi-DffWFdpA.cjs +0 -2
  78. package/dist/BTCVaultRegistry.abi-DffWFdpA.cjs.map +0 -1
  79. package/dist/buildAndBroadcastReclaim-Da8rD5Z7.cjs +0 -2
  80. package/dist/buildAndBroadcastReclaim-Da8rD5Z7.cjs.map +0 -1
  81. package/dist/buildAndBroadcastReclaim-R0HNpLMD.js.map +0 -1
  82. package/dist/pegin-registration-client-C-abxMWq.cjs +0 -2
  83. package/dist/pegin-registration-client-C-abxMWq.cjs.map +0 -1
  84. package/dist/pegin-registration-client-kdz4fT5_.js.map +0 -1
  85. package/dist/peginState-BU2ONFXF.js +0 -68
  86. package/dist/peginState-BU2ONFXF.js.map +0 -1
  87. package/dist/peginState-DUv10EJR.cjs +0 -2
  88. package/dist/peginState-DUv10EJR.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"reservation-DOAHVT3B.js","sources":["../src/tbv/core/utils/utxo/availability.ts","../src/tbv/core/utils/utxo/reservation.ts"],"sourcesContent":["/**\n * UTXO Availability Validation\n *\n * Validates that UTXOs referenced in a pre-pegin transaction are still unspent\n * BEFORE asking the user to sign. This prevents wasted signing effort when\n * UTXOs have already been spent by unrelated transactions.\n *\n * These functions are pure — they accept pre-fetched UTXOs and perform no I/O.\n * The vault service wrapper is responsible for fetching UTXOs from the mempool.\n */\n\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\n/**\n * Reference to a Bitcoin UTXO by its outpoint (txid + vout).\n *\n * Used by the availability check to compare a Pre-PegIn transaction's\n * declared inputs against the wallet's current spendable set. Txids are\n * compared case-insensitively; callers should treat the txid as opaque\n * lowercase hex.\n */\nexport interface UtxoRef {\n txid: string;\n vout: number;\n}\n\n/**\n * Information about a missing/spent UTXO.\n */\nexport interface MissingUtxoInfo {\n /** Transaction ID of the missing UTXO */\n txid: string;\n /** Output index of the missing UTXO */\n vout: number;\n}\n\n/**\n * Result of UTXO validation.\n */\nexport interface UtxoValidationResult {\n /** Whether all UTXOs are still available */\n allAvailable: boolean;\n /** List of missing UTXOs (if any) */\n missingUtxos: MissingUtxoInfo[];\n /** Total number of inputs checked */\n totalInputs: number;\n}\n\n/**\n * Error thrown when UTXOs are not available.\n */\nexport class UtxoNotAvailableError extends Error {\n public readonly missingUtxos: MissingUtxoInfo[];\n\n constructor(missingUtxos: MissingUtxoInfo[]) {\n const count = missingUtxos.length;\n const message =\n count === 1\n ? \"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.\"\n : `${count} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;\n\n super(message);\n this.name = \"UtxoNotAvailableError\";\n this.missingUtxos = missingUtxos;\n }\n}\n\n/**\n * Extract input references (txid:vout) from an unsigned transaction.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @returns Array of input references\n */\nexport function extractInputsFromTransaction(\n unsignedTxHex: string,\n): Array<{ txid: string; vout: number }> {\n const cleanHex = unsignedTxHex.startsWith(\"0x\")\n ? unsignedTxHex.slice(2)\n : unsignedTxHex;\n\n let tx: Transaction;\n try {\n tx = Transaction.fromHex(cleanHex);\n } catch (error) {\n throw new Error(\n `Failed to parse BTC transaction: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return tx.ins.map((input) => ({\n // Bitcoin stores txid in reverse byte order\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n}\n\n/**\n * Validate that all UTXOs in a transaction are still available.\n *\n * Pure function — accepts pre-fetched UTXOs instead of making network calls.\n * This should be called BEFORE signing to avoid wasting user effort\n * signing a transaction that will fail to broadcast.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @returns Validation result with missing UTXO details\n */\nexport function validateUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): UtxoValidationResult {\n const inputs = extractInputsFromTransaction(unsignedTxHex);\n\n if (inputs.length === 0) {\n throw new Error(\"Transaction has no inputs\");\n }\n\n // Detect duplicate inputs (same txid:vout referenced more than once).\n // This would produce an invalid Bitcoin transaction.\n const inputKeys = new Set<string>();\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (inputKeys.has(key)) {\n throw new Error(\n `Transaction contains duplicate input ${input.txid}:${input.vout}. ` +\n `This would produce an invalid Bitcoin transaction.`,\n );\n }\n inputKeys.add(key);\n }\n\n // Set of available outpoints for O(1) lookup. Lowercased so the comparison\n // is case-insensitive against whatever case the wallet returned.\n const availableSet = new Set(\n availableUtxos.map((utxo) => `${utxo.txid.toLowerCase()}:${utxo.vout}`),\n );\n\n // Check which inputs are missing\n const missingUtxos: MissingUtxoInfo[] = [];\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (!availableSet.has(key)) {\n missingUtxos.push({\n txid: input.txid,\n vout: input.vout,\n });\n }\n }\n\n return {\n allAvailable: missingUtxos.length === 0,\n missingUtxos,\n totalInputs: inputs.length,\n };\n}\n\n/**\n * Validate UTXOs and throw if any are not available.\n *\n * Pure convenience function that combines validation and error throwing.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @throws UtxoNotAvailableError if any UTXOs are not available\n * @throws Error if validation fails\n */\nexport function assertUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): void {\n const result = validateUtxosAvailable(unsignedTxHex, availableUtxos);\n\n if (!result.allAvailable) {\n throw new UtxoNotAvailableError(result.missingUtxos);\n }\n}\n","/**\n * Pending-vault outpoint overlap detection.\n *\n * Given the depositor's pending vaults (indexer + local cache) and the\n * outpoints a new deposit's coin selector picked, return the set of\n * pending vault ids whose Pre-PegIn BTC tx shares an input. Advisory\n * only — used to warn the user before signing.\n *\n * Only `PENDING` vaults contribute: VERIFIED+ have their Pre-PegIn\n * already confirmed on-chain, so those inputs cannot still appear in\n * the wallet's spendable set.\n */\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { stripHexPrefix } from \"../../primitives/utils/bitcoin\";\nimport { ContractStatus } from \"../../services/deposit/peginState\";\n\nimport type { UtxoRef } from \"./availability\";\n\n/** Locally-known pending pegin. `id` is the bytes32 vault id. */\nexport interface PendingPeginLike {\n id?: string;\n unsignedTxHex?: string;\n}\n\n/** On-chain vault row from the indexer. */\nexport interface VaultLike {\n id?: string;\n status: number;\n unsignedPrePeginTx: string;\n}\n\nexport interface FindOverlappingPendingVaultsParams {\n selectedOutpoints: ReadonlyArray<UtxoRef>;\n vaults?: ReadonlyArray<VaultLike>;\n pendingPegins?: ReadonlyArray<PendingPeginLike>;\n}\n\nfunction extractInputUtxoRefs(txHex: string): UtxoRef[] {\n try {\n const tx = Transaction.fromHex(stripHexPrefix(txHex));\n return tx.ins.map((input) => ({\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n } catch {\n return [];\n }\n}\n\nfunction outpointKey(o: UtxoRef): string {\n return `${o.txid.toLowerCase()}:${o.vout}`;\n}\n\n/**\n * Return the ids of pending vaults whose committed Pre-PegIn inputs\n * overlap any of the just-selected outpoints. On-chain `PENDING` vaults\n * take precedence over a same-id local pegin entry.\n */\nexport function findOverlappingPendingVaults(\n params: FindOverlappingPendingVaultsParams,\n): string[] {\n const { selectedOutpoints, vaults = [], pendingPegins = [] } = params;\n\n const selectedSet = new Set(selectedOutpoints.map(outpointKey));\n if (selectedSet.size === 0) return [];\n\n const seenIds = new Set<string>();\n const impacted = new Set<string>();\n\n const consider = (id: string | undefined, txHex: string): void => {\n if (!id) return;\n const idLower = id.toLowerCase();\n if (seenIds.has(idLower)) return;\n seenIds.add(idLower);\n const inputs = extractInputUtxoRefs(txHex);\n for (const input of inputs) {\n if (selectedSet.has(outpointKey(input))) {\n impacted.add(id);\n return;\n }\n }\n };\n\n // On-chain wins on id collision.\n for (const v of vaults) {\n if (v.status !== ContractStatus.PENDING) continue;\n consider(v.id, v.unsignedPrePeginTx);\n }\n for (const p of pendingPegins) {\n if (!p.unsignedTxHex) continue;\n consider(p.id, p.unsignedTxHex);\n }\n\n return Array.from(impacted);\n}\n"],"names":["UtxoNotAvailableError","missingUtxos","count","message","__publicField","extractInputsFromTransaction","unsignedTxHex","cleanHex","tx","Transaction","error","input","Buffer","validateUtxosAvailable","availableUtxos","inputs","inputKeys","key","availableSet","utxo","assertUtxosAvailable","result","extractInputUtxoRefs","txHex","stripHexPrefix","outpointKey","o","findOverlappingPendingVaults","params","selectedOutpoints","vaults","pendingPegins","selectedSet","seenIds","impacted","consider","id","idLower","v","ContractStatus","p"],"mappings":";;;;;;;AAoDO,MAAMA,UAA8B,MAAM;AAAA,EAG/C,YAAYC,GAAiC;AAC3C,UAAMC,IAAQD,EAAa,QACrBE,IACJD,MAAU,IACN,8JACA,GAAGA,CAAK;AAEd,UAAMC,CAAO;AATC,IAAAC,EAAA;AAUd,SAAK,OAAO,yBACZ,KAAK,eAAeH;AAAA,EACtB;AACF;AAQO,SAASI,EACdC,GACuC;AACvC,QAAMC,IAAWD,EAAc,WAAW,IAAI,IAC1CA,EAAc,MAAM,CAAC,IACrBA;AAEJ,MAAIE;AACJ,MAAI;AACF,IAAAA,IAAKC,EAAY,QAAQF,CAAQ;AAAA,EACnC,SAASG,GAAO;AACd,UAAM,IAAI;AAAA,MACR,oCAAoCA,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,CAAC;AAAA,IAAA;AAAA,EAE9F;AAEA,SAAOF,EAAG,IAAI,IAAI,CAACG,OAAW;AAAA;AAAA,IAE5B,MAAMC,EAAO,KAAKD,EAAM,IAAI,EAAE,QAAA,EAAU,SAAS,KAAK;AAAA,IACtD,MAAMA,EAAM;AAAA,EAAA,EACZ;AACJ;AAaO,SAASE,EACdP,GACAQ,GACsB;AACtB,QAAMC,IAASV,EAA6BC,CAAa;AAEzD,MAAIS,E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,SAASc,EAAYC,GAAoB;AACvC,SAAO,GAAGA,EAAE,KAAK,aAAa,IAAIA,EAAE,IAAI;AAC1C;AAOO,SAASC,EACdC,GACU;AACV,QAAM,EAAE,mBAAAC,GAAmB,QAAAC,IAAS,CAAA,GAAI,eAAAC,IAAgB,CAAA,MAAOH,GAEzDI,IAAc,IAAI,IAAIH,EAAkB,IAAIJ,CAAW,CAAC;AAC9D,MAAIO,EAAY,SAAS,EAAG,QAAO,CAAA;AAEnC,QAAMC,wBAAc,IAAA,GACdC,wBAAe,IAAA,GAEfC,IAAW,CAACC,GAAwBb,MAAwB;AAChE,QAAI,CAACa,EAAI;AACT,UAAMC,IAAUD,EAAG,YAAA;AACnB,QAAIH,EAAQ,IAAII,CAAO,EAAG;AAC1B,IAAAJ,EAAQ,IAAII,CAAO;AACnB,UAAMtB,IAASO,EAAqBC,CAAK;AACzC,eAAWZ,KAASI;AAClB,UAAIiB,EAAY,IAAIP,EAAYd,CAAK,CAAC,GAAG;AACvC,QAAAuB,EAAS,IAAIE,CAAE;AACf;AAAA,MACF;AAAA,EAEJ;AAGA,aAAWE,KAAKR;AACd,IAAIQ,EAAE,WAAWC,EAAe,WAChCJ,EAASG,EAAE,IAAIA,EAAE,kBAAkB;AAErC,aAAWE,KAAKT;AACd,IAAKS,EAAE,iBACPL,EAASK,EAAE,IAAIA,EAAE,aAAa;AAGhC,SAAO,MAAM,KAAKN,CAAQ;AAC5B;"}
1
+ {"version":3,"file":"reservation-BZQABu4g.js","sources":["../src/tbv/core/utils/utxo/availability.ts","../src/tbv/core/utils/utxo/reservation.ts"],"sourcesContent":["/**\n * UTXO Availability Validation\n *\n * Validates that UTXOs referenced in a pre-pegin transaction are still unspent\n * BEFORE asking the user to sign. This prevents wasted signing effort when\n * UTXOs have already been spent by unrelated transactions.\n *\n * These functions are pure — they accept pre-fetched UTXOs and perform no I/O.\n * The vault service wrapper is responsible for fetching UTXOs from the mempool.\n */\n\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\n/**\n * Reference to a Bitcoin UTXO by its outpoint (txid + vout).\n *\n * Used by the availability check to compare a Pre-PegIn transaction's\n * declared inputs against the wallet's current spendable set. Txids are\n * compared case-insensitively; callers should treat the txid as opaque\n * lowercase hex.\n */\nexport interface UtxoRef {\n txid: string;\n vout: number;\n}\n\n/**\n * Information about a missing/spent UTXO.\n */\nexport interface MissingUtxoInfo {\n /** Transaction ID of the missing UTXO */\n txid: string;\n /** Output index of the missing UTXO */\n vout: number;\n}\n\n/**\n * Result of UTXO validation.\n */\nexport interface UtxoValidationResult {\n /** Whether all UTXOs are still available */\n allAvailable: boolean;\n /** List of missing UTXOs (if any) */\n missingUtxos: MissingUtxoInfo[];\n /** Total number of inputs checked */\n totalInputs: number;\n}\n\n/**\n * Error thrown when UTXOs are not available.\n */\nexport class UtxoNotAvailableError extends Error {\n public readonly missingUtxos: MissingUtxoInfo[];\n\n constructor(missingUtxos: MissingUtxoInfo[]) {\n const count = missingUtxos.length;\n const message =\n count === 1\n ? \"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.\"\n : `${count} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;\n\n super(message);\n this.name = \"UtxoNotAvailableError\";\n this.missingUtxos = missingUtxos;\n }\n}\n\n/**\n * Extract input references (txid:vout) from an unsigned transaction.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @returns Array of input references\n */\nexport function extractInputsFromTransaction(\n unsignedTxHex: string,\n): Array<{ txid: string; vout: number }> {\n const cleanHex = unsignedTxHex.startsWith(\"0x\")\n ? unsignedTxHex.slice(2)\n : unsignedTxHex;\n\n let tx: Transaction;\n try {\n tx = Transaction.fromHex(cleanHex);\n } catch (error) {\n throw new Error(\n `Failed to parse BTC transaction: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return tx.ins.map((input) => ({\n // Bitcoin stores txid in reverse byte order\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n}\n\n/**\n * Validate that all UTXOs in a transaction are still available.\n *\n * Pure function — accepts pre-fetched UTXOs instead of making network calls.\n * This should be called BEFORE signing to avoid wasting user effort\n * signing a transaction that will fail to broadcast.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @returns Validation result with missing UTXO details\n */\nexport function validateUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): UtxoValidationResult {\n const inputs = extractInputsFromTransaction(unsignedTxHex);\n\n if (inputs.length === 0) {\n throw new Error(\"Transaction has no inputs\");\n }\n\n // Detect duplicate inputs (same txid:vout referenced more than once).\n // This would produce an invalid Bitcoin transaction.\n const inputKeys = new Set<string>();\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (inputKeys.has(key)) {\n throw new Error(\n `Transaction contains duplicate input ${input.txid}:${input.vout}. ` +\n `This would produce an invalid Bitcoin transaction.`,\n );\n }\n inputKeys.add(key);\n }\n\n // Set of available outpoints for O(1) lookup. Lowercased so the comparison\n // is case-insensitive against whatever case the wallet returned.\n const availableSet = new Set(\n availableUtxos.map((utxo) => `${utxo.txid.toLowerCase()}:${utxo.vout}`),\n );\n\n // Check which inputs are missing\n const missingUtxos: MissingUtxoInfo[] = [];\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (!availableSet.has(key)) {\n missingUtxos.push({\n txid: input.txid,\n vout: input.vout,\n });\n }\n }\n\n return {\n allAvailable: missingUtxos.length === 0,\n missingUtxos,\n totalInputs: inputs.length,\n };\n}\n\n/**\n * Validate UTXOs and throw if any are not available.\n *\n * Pure convenience function that combines validation and error throwing.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @throws UtxoNotAvailableError if any UTXOs are not available\n * @throws Error if validation fails\n */\nexport function assertUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): void {\n const result = validateUtxosAvailable(unsignedTxHex, availableUtxos);\n\n if (!result.allAvailable) {\n throw new UtxoNotAvailableError(result.missingUtxos);\n }\n}\n","/**\n * Pending-vault outpoint overlap detection.\n *\n * Given the depositor's pending vaults (indexer + local cache) and the\n * outpoints a new deposit's coin selector picked, return the set of\n * pending vault ids whose Pre-PegIn BTC tx shares an input. Advisory\n * only — used to warn the user before signing.\n *\n * Only `PENDING` vaults contribute: VERIFIED+ have their Pre-PegIn\n * already confirmed on-chain, so those inputs cannot still appear in\n * the wallet's spendable set.\n */\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { stripHexPrefix } from \"../../primitives/utils/bitcoin\";\nimport { ContractStatus } from \"../../services/deposit/peginState\";\n\nimport type { UtxoRef } from \"./availability\";\n\n/** Locally-known pending pegin. `id` is the bytes32 vault id. */\nexport interface PendingPeginLike {\n id?: string;\n unsignedTxHex?: string;\n}\n\n/** On-chain vault row from the indexer. */\nexport interface VaultLike {\n id?: string;\n status: number;\n unsignedPrePeginTx: string;\n}\n\nexport interface FindOverlappingPendingVaultsParams {\n selectedOutpoints: ReadonlyArray<UtxoRef>;\n vaults?: ReadonlyArray<VaultLike>;\n pendingPegins?: ReadonlyArray<PendingPeginLike>;\n}\n\nfunction extractInputUtxoRefs(txHex: string): UtxoRef[] {\n try {\n const tx = Transaction.fromHex(stripHexPrefix(txHex));\n return tx.ins.map((input) => ({\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n } catch {\n return [];\n }\n}\n\nfunction outpointKey(o: UtxoRef): string {\n return `${o.txid.toLowerCase()}:${o.vout}`;\n}\n\n/**\n * Return the ids of pending vaults whose committed Pre-PegIn inputs\n * overlap any of the just-selected outpoints. On-chain `PENDING` vaults\n * take precedence over a same-id local pegin entry.\n */\nexport function findOverlappingPendingVaults(\n params: FindOverlappingPendingVaultsParams,\n): string[] {\n const { selectedOutpoints, vaults = [], pendingPegins = [] } = params;\n\n const selectedSet = new Set(selectedOutpoints.map(outpointKey));\n if (selectedSet.size === 0) return [];\n\n const seenIds = new Set<string>();\n const impacted = new Set<string>();\n\n const consider = (id: string | undefined, txHex: string): void => {\n if (!id) return;\n const idLower = id.toLowerCase();\n if (seenIds.has(idLower)) return;\n seenIds.add(idLower);\n const inputs = extractInputUtxoRefs(txHex);\n for (const input of inputs) {\n if (selectedSet.has(outpointKey(input))) {\n impacted.add(id);\n return;\n }\n }\n };\n\n // On-chain wins on id collision.\n for (const v of vaults) {\n if (v.status !== ContractStatus.PENDING) continue;\n consider(v.id, v.unsignedPrePeginTx);\n }\n for (const p of pendingPegins) {\n if (!p.unsignedTxHex) continue;\n consider(p.id, p.unsignedTxHex);\n }\n\n return Array.from(impacted);\n}\n"],"names":["UtxoNotAvailableError","missingUtxos","count","message","__publicField","extractInputsFromTransaction","unsignedTxHex","cleanHex","tx","Transaction","error","input","Buffer","validateUtxosAvailable","availableUtxos","inputs","inputKeys","key","availableSet","utxo","assertUtxosAvailable","result","extractInputUtxoRefs","txHex","stripHexPrefix","outpointKey","o","findOverlappingPendingVaults","params","selectedOutpoints","vaults","pendingPegins","selectedSet","seenIds","impacted","consider","id","idLower","v","ContractStatus","p"],"mappings":";;;;;;;AAoDO,MAAMA,UAA8B,MAAM;AAAA,EAG/C,YAAYC,GAAiC;AAC3C,UAAMC,IAAQD,EAAa,QACrBE,IACJD,MAAU,IACN,8JACA,GAAGA,CAAK;AAEd,UAAMC,CAAO;AATC,IAAAC,EAAA;AAUd,SAAK,OAAO,yBACZ,KAAK,eAAeH;AAAA,EACtB;AACF;AAQO,SAASI,EACdC,GACuC;AACvC,QAAMC,IAAWD,EAAc,WAAW,IAAI,IAC1CA,EAAc,MAAM,CAAC,IACrBA;AAEJ,MAAIE;AACJ,MAAI;AACF,IAAAA,IAAKC,EAAY,QAAQF,CAAQ;AAAA,EACnC,SAASG,GAAO;AACd,UAAM,IAAI;AAAA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
@@ -1,2 +1,2 @@
1
- "use strict";var b=Object.defineProperty;var T=(e,n,t)=>n in e?b(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>T(e,typeof n!="symbol"?n+"":n,t);const d=require("bitcoinjs-lib"),x=require("buffer"),U=require("./bitcoin-D-O2GjbC.cjs"),$=require("./peginState-DUv10EJR.cjs");class p extends Error{constructor(t){const r=t.length,a=r===1?"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.":`${r} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;super(a);l(this,"missingUtxos");this.name="UtxoNotAvailableError",this.missingUtxos=t}}function h(e){const n=e.startsWith("0x")?e.slice(2):e;let t;try{t=d.Transaction.fromHex(n)}catch(r){throw new Error(`Failed to parse BTC transaction: ${r instanceof Error?r.message:String(r)}`)}return t.ins.map(r=>({txid:x.Buffer.from(r.hash).reverse().toString("hex"),vout:r.index}))}function v(e,n){const t=h(e);if(t.length===0)throw new Error("Transaction has no inputs");const r=new Set;for(const o of t){const i=`${o.txid.toLowerCase()}:${o.vout}`;if(r.has(i))throw new Error(`Transaction contains duplicate input ${o.txid}:${o.vout}. This would produce an invalid Bitcoin transaction.`);r.add(i)}const a=new Set(n.map(o=>`${o.txid.toLowerCase()}:${o.vout}`)),c=[];for(const o of t){const i=`${o.txid.toLowerCase()}:${o.vout}`;a.has(i)||c.push({txid:o.txid,vout:o.vout})}return{allAvailable:c.length===0,missingUtxos:c,totalInputs:t.length}}function S(e,n){const t=v(e,n);if(!t.allAvailable)throw new p(t.missingUtxos)}function y(e){try{return d.Transaction.fromHex(U.stripHexPrefix(e)).ins.map(t=>({txid:x.Buffer.from(t.hash).reverse().toString("hex"),vout:t.index}))}catch{return[]}}function f(e){return`${e.txid.toLowerCase()}:${e.vout}`}function A(e){const{selectedOutpoints:n,vaults:t=[],pendingPegins:r=[]}=e,a=new Set(n.map(f));if(a.size===0)return[];const c=new Set,o=new Set,i=(s,g)=>{if(!s)return;const u=s.toLowerCase();if(c.has(u))return;c.add(u);const w=y(g);for(const m of w)if(a.has(f(m))){o.add(s);return}};for(const s of t)s.status===$.ContractStatus.PENDING&&i(s.id,s.unsignedPrePeginTx);for(const s of r)s.unsignedTxHex&&i(s.id,s.unsignedTxHex);return Array.from(o)}exports.UtxoNotAvailableError=p;exports.assertUtxosAvailable=S;exports.extractInputsFromTransaction=h;exports.findOverlappingPendingVaults=A;exports.validateUtxosAvailable=v;
2
- //# sourceMappingURL=reservation-ECxjZi5t.cjs.map
1
+ "use strict";var b=Object.defineProperty;var T=(e,n,t)=>n in e?b(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>T(e,typeof n!="symbol"?n+"":n,t);const d=require("bitcoinjs-lib"),x=require("buffer"),U=require("./bitcoin-D-O2GjbC.cjs"),$=require("./peginState-IyE22wWh.cjs");class p extends Error{constructor(t){const r=t.length,a=r===1?"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.":`${r} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;super(a);l(this,"missingUtxos");this.name="UtxoNotAvailableError",this.missingUtxos=t}}function h(e){const n=e.startsWith("0x")?e.slice(2):e;let t;try{t=d.Transaction.fromHex(n)}catch(r){throw new Error(`Failed to parse BTC transaction: ${r instanceof Error?r.message:String(r)}`)}return t.ins.map(r=>({txid:x.Buffer.from(r.hash).reverse().toString("hex"),vout:r.index}))}function v(e,n){const t=h(e);if(t.length===0)throw new Error("Transaction has no inputs");const r=new Set;for(const o of t){const i=`${o.txid.toLowerCase()}:${o.vout}`;if(r.has(i))throw new Error(`Transaction contains duplicate input ${o.txid}:${o.vout}. This would produce an invalid Bitcoin transaction.`);r.add(i)}const a=new Set(n.map(o=>`${o.txid.toLowerCase()}:${o.vout}`)),c=[];for(const o of t){const i=`${o.txid.toLowerCase()}:${o.vout}`;a.has(i)||c.push({txid:o.txid,vout:o.vout})}return{allAvailable:c.length===0,missingUtxos:c,totalInputs:t.length}}function S(e,n){const t=v(e,n);if(!t.allAvailable)throw new p(t.missingUtxos)}function y(e){try{return d.Transaction.fromHex(U.stripHexPrefix(e)).ins.map(t=>({txid:x.Buffer.from(t.hash).reverse().toString("hex"),vout:t.index}))}catch{return[]}}function f(e){return`${e.txid.toLowerCase()}:${e.vout}`}function A(e){const{selectedOutpoints:n,vaults:t=[],pendingPegins:r=[]}=e,a=new Set(n.map(f));if(a.size===0)return[];const c=new Set,o=new Set,i=(s,g)=>{if(!s)return;const u=s.toLowerCase();if(c.has(u))return;c.add(u);const w=y(g);for(const m of w)if(a.has(f(m))){o.add(s);return}};for(const s of t)s.status===$.ContractStatus.PENDING&&i(s.id,s.unsignedPrePeginTx);for(const s of r)s.unsignedTxHex&&i(s.id,s.unsignedTxHex);return Array.from(o)}exports.UtxoNotAvailableError=p;exports.assertUtxosAvailable=S;exports.extractInputsFromTransaction=h;exports.findOverlappingPendingVaults=A;exports.validateUtxosAvailable=v;
2
+ //# sourceMappingURL=reservation-CA5knoQ0.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"reservation-ECxjZi5t.cjs","sources":["../src/tbv/core/utils/utxo/availability.ts","../src/tbv/core/utils/utxo/reservation.ts"],"sourcesContent":["/**\n * UTXO Availability Validation\n *\n * Validates that UTXOs referenced in a pre-pegin transaction are still unspent\n * BEFORE asking the user to sign. This prevents wasted signing effort when\n * UTXOs have already been spent by unrelated transactions.\n *\n * These functions are pure — they accept pre-fetched UTXOs and perform no I/O.\n * The vault service wrapper is responsible for fetching UTXOs from the mempool.\n */\n\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\n/**\n * Reference to a Bitcoin UTXO by its outpoint (txid + vout).\n *\n * Used by the availability check to compare a Pre-PegIn transaction's\n * declared inputs against the wallet's current spendable set. Txids are\n * compared case-insensitively; callers should treat the txid as opaque\n * lowercase hex.\n */\nexport interface UtxoRef {\n txid: string;\n vout: number;\n}\n\n/**\n * Information about a missing/spent UTXO.\n */\nexport interface MissingUtxoInfo {\n /** Transaction ID of the missing UTXO */\n txid: string;\n /** Output index of the missing UTXO */\n vout: number;\n}\n\n/**\n * Result of UTXO validation.\n */\nexport interface UtxoValidationResult {\n /** Whether all UTXOs are still available */\n allAvailable: boolean;\n /** List of missing UTXOs (if any) */\n missingUtxos: MissingUtxoInfo[];\n /** Total number of inputs checked */\n totalInputs: number;\n}\n\n/**\n * Error thrown when UTXOs are not available.\n */\nexport class UtxoNotAvailableError extends Error {\n public readonly missingUtxos: MissingUtxoInfo[];\n\n constructor(missingUtxos: MissingUtxoInfo[]) {\n const count = missingUtxos.length;\n const message =\n count === 1\n ? \"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.\"\n : `${count} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;\n\n super(message);\n this.name = \"UtxoNotAvailableError\";\n this.missingUtxos = missingUtxos;\n }\n}\n\n/**\n * Extract input references (txid:vout) from an unsigned transaction.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @returns Array of input references\n */\nexport function extractInputsFromTransaction(\n unsignedTxHex: string,\n): Array<{ txid: string; vout: number }> {\n const cleanHex = unsignedTxHex.startsWith(\"0x\")\n ? unsignedTxHex.slice(2)\n : unsignedTxHex;\n\n let tx: Transaction;\n try {\n tx = Transaction.fromHex(cleanHex);\n } catch (error) {\n throw new Error(\n `Failed to parse BTC transaction: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return tx.ins.map((input) => ({\n // Bitcoin stores txid in reverse byte order\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n}\n\n/**\n * Validate that all UTXOs in a transaction are still available.\n *\n * Pure function — accepts pre-fetched UTXOs instead of making network calls.\n * This should be called BEFORE signing to avoid wasting user effort\n * signing a transaction that will fail to broadcast.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @returns Validation result with missing UTXO details\n */\nexport function validateUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): UtxoValidationResult {\n const inputs = extractInputsFromTransaction(unsignedTxHex);\n\n if (inputs.length === 0) {\n throw new Error(\"Transaction has no inputs\");\n }\n\n // Detect duplicate inputs (same txid:vout referenced more than once).\n // This would produce an invalid Bitcoin transaction.\n const inputKeys = new Set<string>();\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (inputKeys.has(key)) {\n throw new Error(\n `Transaction contains duplicate input ${input.txid}:${input.vout}. ` +\n `This would produce an invalid Bitcoin transaction.`,\n );\n }\n inputKeys.add(key);\n }\n\n // Set of available outpoints for O(1) lookup. Lowercased so the comparison\n // is case-insensitive against whatever case the wallet returned.\n const availableSet = new Set(\n availableUtxos.map((utxo) => `${utxo.txid.toLowerCase()}:${utxo.vout}`),\n );\n\n // Check which inputs are missing\n const missingUtxos: MissingUtxoInfo[] = [];\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (!availableSet.has(key)) {\n missingUtxos.push({\n txid: input.txid,\n vout: input.vout,\n });\n }\n }\n\n return {\n allAvailable: missingUtxos.length === 0,\n missingUtxos,\n totalInputs: inputs.length,\n };\n}\n\n/**\n * Validate UTXOs and throw if any are not available.\n *\n * Pure convenience function that combines validation and error throwing.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @throws UtxoNotAvailableError if any UTXOs are not available\n * @throws Error if validation fails\n */\nexport function assertUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): void {\n const result = validateUtxosAvailable(unsignedTxHex, availableUtxos);\n\n if (!result.allAvailable) {\n throw new UtxoNotAvailableError(result.missingUtxos);\n }\n}\n","/**\n * Pending-vault outpoint overlap detection.\n *\n * Given the depositor's pending vaults (indexer + local cache) and the\n * outpoints a new deposit's coin selector picked, return the set of\n * pending vault ids whose Pre-PegIn BTC tx shares an input. Advisory\n * only — used to warn the user before signing.\n *\n * Only `PENDING` vaults contribute: VERIFIED+ have their Pre-PegIn\n * already confirmed on-chain, so those inputs cannot still appear in\n * the wallet's spendable set.\n */\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { stripHexPrefix } from \"../../primitives/utils/bitcoin\";\nimport { ContractStatus } from \"../../services/deposit/peginState\";\n\nimport type { UtxoRef } from \"./availability\";\n\n/** Locally-known pending pegin. `id` is the bytes32 vault id. */\nexport interface PendingPeginLike {\n id?: string;\n unsignedTxHex?: string;\n}\n\n/** On-chain vault row from the indexer. */\nexport interface VaultLike {\n id?: string;\n status: number;\n unsignedPrePeginTx: string;\n}\n\nexport interface FindOverlappingPendingVaultsParams {\n selectedOutpoints: ReadonlyArray<UtxoRef>;\n vaults?: ReadonlyArray<VaultLike>;\n pendingPegins?: ReadonlyArray<PendingPeginLike>;\n}\n\nfunction extractInputUtxoRefs(txHex: string): UtxoRef[] {\n try {\n const tx = Transaction.fromHex(stripHexPrefix(txHex));\n return tx.ins.map((input) => ({\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n } catch {\n return [];\n }\n}\n\nfunction outpointKey(o: UtxoRef): string {\n return `${o.txid.toLowerCase()}:${o.vout}`;\n}\n\n/**\n * Return the ids of pending vaults whose committed Pre-PegIn inputs\n * overlap any of the just-selected outpoints. On-chain `PENDING` vaults\n * take precedence over a same-id local pegin entry.\n */\nexport function findOverlappingPendingVaults(\n params: FindOverlappingPendingVaultsParams,\n): string[] {\n const { selectedOutpoints, vaults = [], pendingPegins = [] } = params;\n\n const selectedSet = new Set(selectedOutpoints.map(outpointKey));\n if (selectedSet.size === 0) return [];\n\n const seenIds = new Set<string>();\n const impacted = new Set<string>();\n\n const consider = (id: string | undefined, txHex: string): void => {\n if (!id) return;\n const idLower = id.toLowerCase();\n if (seenIds.has(idLower)) return;\n seenIds.add(idLower);\n const inputs = extractInputUtxoRefs(txHex);\n for (const input of inputs) {\n if (selectedSet.has(outpointKey(input))) {\n impacted.add(id);\n return;\n }\n }\n };\n\n // On-chain wins on id collision.\n for (const v of vaults) {\n if (v.status !== ContractStatus.PENDING) continue;\n consider(v.id, v.unsignedPrePeginTx);\n }\n for (const p of pendingPegins) {\n if (!p.unsignedTxHex) continue;\n consider(p.id, p.unsignedTxHex);\n }\n\n return Array.from(impacted);\n}\n"],"names":["UtxoNotAvailableError","missingUtxos","count","message","__publicField","extractInputsFromTransaction","unsignedTxHex","cleanHex","tx","Transaction","error","input","Buffer","validateUtxosAvailable","availableUtxos","inputs","inputKeys","key","availableSet","utxo","assertUtxosAvailable","result","extractInputUtxoRefs","txHex","stripHexPrefix","outpointKey","o","findOverlappingPendingVaults","params","selectedOutpoints","vaults","pendingPegins","selectedSet","seenIds","impacted","consider","id","idLower","v","ContractStatus","p"],"mappings":"iTAoDO,MAAMA,UAA8B,KAAM,CAG/C,YAAYC,EAAiC,CAC3C,MAAMC,EAAQD,EAAa,OACrBE,EACJD,IAAU,EACN,4JACA,GAAGA,CAAK,qIAEd,MAAMC,CAAO,EATCC,EAAA,qBAUd,KAAK,KAAO,wBACZ,KAAK,aAAeH,CACtB,CACF,CAQO,SAASI,EACdC,EACuC,CACvC,MAAMC,EAAWD,EAAc,WAAW,IAAI,EAC1CA,EAAc,MAAM,CAAC,EACrBA,EAEJ,IAAIE,EACJ,GAAI,CACFA,EAAKC,EAAAA,YAAY,QAAQF,CAAQ,CACnC,OAASG,EAAO,CACd,MAAM,IAAI,MACR,oCAAoCA,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC,EAAA,CAE9F,CAEA,OAAOF,EAAG,IAAI,IAAKG,IAAW,CAE5B,KAAMC,EAAAA,OAAO,KAAKD,EAAM,IAAI,EAAE,QAAA,EAAU,SAAS,KAAK,EACtD,KAAMA,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AYC,EAAoB,CACvC,MAAO,GAAGA,EAAE,KAAK,aAAa,IAAIA,EAAE,IAAI,EAC1C,CAOO,SAASC,EACdC,EACU,CACV,KAAM,CAAE,kBAAAC,EAAmB,OAAAC,EAAS,CAAA,EAAI,cAAAC,EAAgB,CAAA,GAAOH,EAEzDI,EAAc,IAAI,IAAIH,EAAkB,IAAIJ,CAAW,CAAC,EAC9D,GAAIO,EAAY,OAAS,EAAG,MAAO,CAAA,EAEnC,MAAMC,MAAc,IACdC,MAAe,IAEfC,EAAW,CAACC,EAAwBb,IAAwB,CAChE,GAAI,CAACa,EAAI,OACT,MAAMC,EAAUD,EAAG,YAAA,EACnB,GAAIH,EAAQ,IAAII,CAAO,EAAG,OAC1BJ,EAAQ,IAAII,CAAO,EACnB,MAAMtB,EAASO,EAAqBC,CAAK,EACzC,UAAWZ,KAASI,EAClB,GAAIiB,EAAY,IAAIP,EAAYd,CAAK,CAAC,EAAG,CACvCuB,EAAS,IAAIE,CAAE,EACf,MACF,CAEJ,EAGA,UAAWE,KAAKR,EACVQ,EAAE,SAAWC,EAAAA,eAAe,SAChCJ,EAASG,EAAE,GAAIA,EAAE,kBAAkB,EAErC,UAAWE,KAAKT,EACTS,EAAE,eACPL,EAASK,EAAE,GAAIA,EAAE,aAAa,EAGhC,OAAO,MAAM,KAAKN,CAAQ,CAC5B"}
1
+ {"version":3,"file":"reservation-CA5knoQ0.cjs","sources":["../src/tbv/core/utils/utxo/availability.ts","../src/tbv/core/utils/utxo/reservation.ts"],"sourcesContent":["/**\n * UTXO Availability Validation\n *\n * Validates that UTXOs referenced in a pre-pegin transaction are still unspent\n * BEFORE asking the user to sign. This prevents wasted signing effort when\n * UTXOs have already been spent by unrelated transactions.\n *\n * These functions are pure — they accept pre-fetched UTXOs and perform no I/O.\n * The vault service wrapper is responsible for fetching UTXOs from the mempool.\n */\n\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\n/**\n * Reference to a Bitcoin UTXO by its outpoint (txid + vout).\n *\n * Used by the availability check to compare a Pre-PegIn transaction's\n * declared inputs against the wallet's current spendable set. Txids are\n * compared case-insensitively; callers should treat the txid as opaque\n * lowercase hex.\n */\nexport interface UtxoRef {\n txid: string;\n vout: number;\n}\n\n/**\n * Information about a missing/spent UTXO.\n */\nexport interface MissingUtxoInfo {\n /** Transaction ID of the missing UTXO */\n txid: string;\n /** Output index of the missing UTXO */\n vout: number;\n}\n\n/**\n * Result of UTXO validation.\n */\nexport interface UtxoValidationResult {\n /** Whether all UTXOs are still available */\n allAvailable: boolean;\n /** List of missing UTXOs (if any) */\n missingUtxos: MissingUtxoInfo[];\n /** Total number of inputs checked */\n totalInputs: number;\n}\n\n/**\n * Error thrown when UTXOs are not available.\n */\nexport class UtxoNotAvailableError extends Error {\n public readonly missingUtxos: MissingUtxoInfo[];\n\n constructor(missingUtxos: MissingUtxoInfo[]) {\n const count = missingUtxos.length;\n const message =\n count === 1\n ? \"The UTXO for this peg-in is no longer available. It may have been spent in another transaction. Please create a new peg-in request with a different UTXO.\"\n : `${count} UTXOs for this peg-in are no longer available. They may have been spent. Please create a new peg-in request with different UTXOs.`;\n\n super(message);\n this.name = \"UtxoNotAvailableError\";\n this.missingUtxos = missingUtxos;\n }\n}\n\n/**\n * Extract input references (txid:vout) from an unsigned transaction.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @returns Array of input references\n */\nexport function extractInputsFromTransaction(\n unsignedTxHex: string,\n): Array<{ txid: string; vout: number }> {\n const cleanHex = unsignedTxHex.startsWith(\"0x\")\n ? unsignedTxHex.slice(2)\n : unsignedTxHex;\n\n let tx: Transaction;\n try {\n tx = Transaction.fromHex(cleanHex);\n } catch (error) {\n throw new Error(\n `Failed to parse BTC transaction: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return tx.ins.map((input) => ({\n // Bitcoin stores txid in reverse byte order\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n}\n\n/**\n * Validate that all UTXOs in a transaction are still available.\n *\n * Pure function — accepts pre-fetched UTXOs instead of making network calls.\n * This should be called BEFORE signing to avoid wasting user effort\n * signing a transaction that will fail to broadcast.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @returns Validation result with missing UTXO details\n */\nexport function validateUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): UtxoValidationResult {\n const inputs = extractInputsFromTransaction(unsignedTxHex);\n\n if (inputs.length === 0) {\n throw new Error(\"Transaction has no inputs\");\n }\n\n // Detect duplicate inputs (same txid:vout referenced more than once).\n // This would produce an invalid Bitcoin transaction.\n const inputKeys = new Set<string>();\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (inputKeys.has(key)) {\n throw new Error(\n `Transaction contains duplicate input ${input.txid}:${input.vout}. ` +\n `This would produce an invalid Bitcoin transaction.`,\n );\n }\n inputKeys.add(key);\n }\n\n // Set of available outpoints for O(1) lookup. Lowercased so the comparison\n // is case-insensitive against whatever case the wallet returned.\n const availableSet = new Set(\n availableUtxos.map((utxo) => `${utxo.txid.toLowerCase()}:${utxo.vout}`),\n );\n\n // Check which inputs are missing\n const missingUtxos: MissingUtxoInfo[] = [];\n for (const input of inputs) {\n const key = `${input.txid.toLowerCase()}:${input.vout}`;\n if (!availableSet.has(key)) {\n missingUtxos.push({\n txid: input.txid,\n vout: input.vout,\n });\n }\n }\n\n return {\n allAvailable: missingUtxos.length === 0,\n missingUtxos,\n totalInputs: inputs.length,\n };\n}\n\n/**\n * Validate UTXOs and throw if any are not available.\n *\n * Pure convenience function that combines validation and error throwing.\n *\n * @param unsignedTxHex - Unsigned transaction hex\n * @param availableUtxos - Pre-fetched list of available UTXOs for the depositor\n * @throws UtxoNotAvailableError if any UTXOs are not available\n * @throws Error if validation fails\n */\nexport function assertUtxosAvailable(\n unsignedTxHex: string,\n availableUtxos: UtxoRef[],\n): void {\n const result = validateUtxosAvailable(unsignedTxHex, availableUtxos);\n\n if (!result.allAvailable) {\n throw new UtxoNotAvailableError(result.missingUtxos);\n }\n}\n","/**\n * Pending-vault outpoint overlap detection.\n *\n * Given the depositor's pending vaults (indexer + local cache) and the\n * outpoints a new deposit's coin selector picked, return the set of\n * pending vault ids whose Pre-PegIn BTC tx shares an input. Advisory\n * only — used to warn the user before signing.\n *\n * Only `PENDING` vaults contribute: VERIFIED+ have their Pre-PegIn\n * already confirmed on-chain, so those inputs cannot still appear in\n * the wallet's spendable set.\n */\nimport { Transaction } from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { stripHexPrefix } from \"../../primitives/utils/bitcoin\";\nimport { ContractStatus } from \"../../services/deposit/peginState\";\n\nimport type { UtxoRef } from \"./availability\";\n\n/** Locally-known pending pegin. `id` is the bytes32 vault id. */\nexport interface PendingPeginLike {\n id?: string;\n unsignedTxHex?: string;\n}\n\n/** On-chain vault row from the indexer. */\nexport interface VaultLike {\n id?: string;\n status: number;\n unsignedPrePeginTx: string;\n}\n\nexport interface FindOverlappingPendingVaultsParams {\n selectedOutpoints: ReadonlyArray<UtxoRef>;\n vaults?: ReadonlyArray<VaultLike>;\n pendingPegins?: ReadonlyArray<PendingPeginLike>;\n}\n\nfunction extractInputUtxoRefs(txHex: string): UtxoRef[] {\n try {\n const tx = Transaction.fromHex(stripHexPrefix(txHex));\n return tx.ins.map((input) => ({\n txid: Buffer.from(input.hash).reverse().toString(\"hex\"),\n vout: input.index,\n }));\n } catch {\n return [];\n }\n}\n\nfunction outpointKey(o: UtxoRef): string {\n return `${o.txid.toLowerCase()}:${o.vout}`;\n}\n\n/**\n * Return the ids of pending vaults whose committed Pre-PegIn inputs\n * overlap any of the just-selected outpoints. On-chain `PENDING` vaults\n * take precedence over a same-id local pegin entry.\n */\nexport function findOverlappingPendingVaults(\n params: FindOverlappingPendingVaultsParams,\n): string[] {\n const { selectedOutpoints, vaults = [], pendingPegins = [] } = params;\n\n const selectedSet = new Set(selectedOutpoints.map(outpointKey));\n if (selectedSet.size === 0) return [];\n\n const seenIds = new Set<string>();\n const impacted = new Set<string>();\n\n const consider = (id: string | undefined, txHex: string): void => {\n if (!id) return;\n const idLower = id.toLowerCase();\n if (seenIds.has(idLower)) return;\n seenIds.add(idLower);\n const inputs = extractInputUtxoRefs(txHex);\n for (const input of inputs) {\n if (selectedSet.has(outpointKey(input))) {\n impacted.add(id);\n return;\n }\n }\n };\n\n // On-chain wins on id collision.\n for (const v of vaults) {\n if (v.status !== ContractStatus.PENDING) continue;\n consider(v.id, v.unsignedPrePeginTx);\n }\n for (const p of pendingPegins) {\n if (!p.unsignedTxHex) continue;\n consider(p.id, p.unsignedTxHex);\n }\n\n return Array.from(impacted);\n}\n"],"names":["UtxoNotAvailableError","missingUtxos","count","message","__publicField","extractInputsFromTransaction","unsignedTxHex","cleanHex","tx","Transaction","error","input","Buffer","validateUtxosAvailable","availableUtxos","inputs","inputKeys","key","availableSet","utxo","assertUtxosAvailable","result","extractInputUtxoRefs","txHex","stripHexPrefix","outpointKey","o","findOverlappingPendingVaults","params","selectedOutpoints","vaults","pendingPegins","selectedSet","seenIds","impacted","consider","id","idLower","v","ContractStatus","p"],"mappings":"iTAoDO,MAAMA,UAA8B,KAAM,CAG/C,YAAYC,EAAiC,CAC3C,MAAMC,EAAQD,EAAa,OACrBE,EACJD,IAAU,EACN,4JACA,GAAGA,CAAK,qIAEd,MAAMC,CAAO,EATCC,EAAA,qBAUd,KAAK,KAAO,wBACZ,KAAK,aAAeH,CACtB,CACF,CAQO,SAASI,EACdC,EACuC,CACvC,MAAMC,EAAWD,EAAc,WAAW,IAAI,EAC1CA,EAAc,MAAM,CAAC,EACrBA,EAEJ,IAAIE,EACJ,GAAI,CACFA,EAAKC,EAAAA,YAAY,QAAQF,CAAQ,CACnC,OAASG,EAAO,CACd,MAAM,IAAI,MACR,oCAAoCA,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC,EAAA,CAE9F,CAEA,OAA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AI,EAAE,QAAA,EAAU,SAAS,KAAK,EACtD,KAAMA,EAAM,KAAA,EACZ,CACJ,MAAQ,CACN,MAAO,CAAA,CACT,CACF,CAEA,SAASc,EAAYC,EAAoB,CACvC,MAAO,GAAGA,EAAE,KAAK,aAAa,IAAIA,EAAE,IAAI,EAC1C,CAOO,SAASC,EACdC,EACU,CACV,KAAM,CAAE,kBAAAC,EAAmB,OAAAC,EAAS,CAAA,EAAI,cAAAC,EAAgB,CAAA,GAAOH,EAEzDI,EAAc,IAAI,IAAIH,EAAkB,IAAIJ,CAAW,CAAC,EAC9D,GAAIO,EAAY,OAAS,EAAG,MAAO,CAAA,EAEnC,MAAMC,MAAc,IACdC,MAAe,IAEfC,EAAW,CAACC,EAAwBb,IAAwB,CAChE,GAAI,CAACa,EAAI,OACT,MAAMC,EAAUD,EAAG,YAAA,EACnB,GAAIH,EAAQ,IAAII,CAAO,EAAG,OAC1BJ,EAAQ,IAAII,CAAO,EACnB,MAAMtB,EAASO,EAAqBC,CAAK,EACzC,UAAWZ,KAASI,EAClB,GAAIiB,EAAY,IAAIP,EAAYd,CAAK,CAAC,EAAG,CACvCuB,EAAS,IAAIE,CAAE,EACf,MACF,CAEJ,EAGA,UAAWE,KAAKR,EACVQ,EAAE,SAAWC,EAAAA,eAAe,SAChCJ,EAASG,EAAE,GAAIA,EAAE,kBAAkB,EAErC,UAAWE,KAAKT,EACTS,EAAE,eACPL,EAASK,EAAE,GAAIA,EAAE,aAAa,EAGhC,OAAO,MAAM,KAAKN,CAAQ,CAC5B"}
@@ -1,2 +1,2 @@
1
- "use strict";const c=require("./BTCVaultRegistry.abi-DffWFdpA.cjs"),i=require("./ApplicationRegistry.abi-sMiTWmnL.cjs"),n=require("./ProtocolParams.abi-CjrT0545.cjs");async function g(a,t){const[e,r]=await a.multicall({contracts:[{address:t,abi:c.BTCVaultRegistryABI,functionName:"protocolParams"},{address:t,abi:c.BTCVaultRegistryABI,functionName:"applicationRegistry"}],allowFailure:!1});return{protocolParams:e,applicationRegistry:r}}function u(a,t,e){if(a!==t)throw new Error(`${e}: multicall returned ${a} results for ${t} calls, so the results are not roster-aligned; refusing to use them`)}function h(a,t){return{vaultProvider:a[0],vaultKeepers:a.slice(1,1+t),universalChallengers:a.slice(1+t)}}class y{constructor(t,e){this.publicClient=t,this.contracts=e}async readAll(t,e,r,s,d){const l=await this.publicClient.multicall({contracts:t,allowFailure:!1,blockNumber:d});return u(l.length,1+e+r,s),h(l,e)}async getCurrentOperationKeys(t,e){const r=[{address:this.contracts.btcVaultRegistry,abi:c.BTCVaultRegistryABI,functionName:"getCurrentOperationBtcKey",args:[t.vaultProviderEthAddress]},...t.vaultKeepers.map(s=>({address:this.contracts.applicationRegistry,abi:i.ApplicationRegistryABI,functionName:"getCurrentOperationBtcKey",args:[t.applicationEntryPoint,s.ethAddress]})),...t.universalChallengers.map(s=>({address:this.contracts.protocolParams,abi:n.ProtocolParamsABI,functionName:"getCurrentOperationBtcKey",args:[s.ethAddress]}))];return this.readAll(r,t.vaultKeepers.length,t.universalChallengers.length,"getCurrentOperationKeys",e)}async getOperationKeysAtEpochs(t,e){const r=[{address:this.contracts.btcVaultRegistry,abi:c.BTCVaultRegistryABI,functionName:"getOperationBtcKeyAtEpoch",args:[t.vaultProviderEthAddress,e.vpKeyEpoch]},...t.vaultKeepers.map(s=>({address:this.contracts.applicationRegistry,abi:i.ApplicationRegistryABI,functionName:"getOperationBtcKeyAtEpochOrGenesis",args:[t.applicationEntryPoint,s.ethAddress,e.appKeeperKeyEpoch,s.btcPubKey]})),...t.universalChallengers.map(s=>({address:this.contracts.protocolParams,abi:n.ProtocolParamsABI,functionName:"getOperationBtcKeyAtEpochOrGenesis",args:[s.ethAddress,e.ucKeyEpoch,s.btcPubKey]}))];return this.readAll(r,t.vaultKeepers.length,t.universalChallengers.length,"getOperationKeysAtEpochs")}async getPayoutScriptsAtEpochs(t,e){const r=await this.publicClient.multicall({contracts:[{address:this.contracts.btcVaultRegistry,abi:c.BTCVaultRegistryABI,functionName:"getPayoutScriptAtEpoch",args:[t.vaultProviderEthAddress,e.vpKeyEpoch]},...t.vaultKeepers.map(s=>({address:this.contracts.applicationRegistry,abi:i.ApplicationRegistryABI,functionName:"getPayoutScriptAtEpoch",args:[t.applicationEntryPoint,s.ethAddress,e.appKeeperKeyEpoch]}))],allowFailure:!1});return u(r.length,1+t.vaultKeepers.length,"getPayoutScriptsAtEpochs"),{vaultProvider:r[0],vaultKeepers:[...r.slice(1)]}}}function o(a){return a.map(t=>({ethAddress:t.ethAddress,btcPubKey:t.btcPubKey}))}function p(a,t){if(typeof a!="bigint")throw new Error(`Invalid ${t} from contract: must be a bigint, got ${typeof a}`);return a}class A{constructor(t,e){this.publicClient=t,this.contractAddress=e}async getVaultKeepersByVersion(t,e,r){const s=await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"getVaultKeepersByVersion",args:[t,e],blockNumber:r});return o(s)}async getCurrentVaultKeepers(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"getCurrentVaultKeepers",args:[t]});return o(e)}async getCurrentVaultKeepersVersion(t,e){return await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"getCurrentVaultKeepersVersion",args:[t],blockNumber:e})}async getCurrentAppKeeperKeyEpoch(t,e){const r=await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"appKeeperKeyEpochCurrent",args:[t],blockNumber:e});return p(r,"appKeeperKeyEpochCurrent")}}class C{constructor(t,e){this.publicClient=t,this.contractAddress=e}async getUniversalChallengersByVersion(t,e){const r=await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"getUniversalChallengersByVersion",args:[t],blockNumber:e});return o(r)}async getCurrentUniversalChallengers(){const t=await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"getCurrentUniversalChallengers"});return o(t)}async getLatestUniversalChallengersVersion(t){return await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"latestUniversalChallengersVersion",blockNumber:t})}async getCurrentUcKeyEpoch(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"ucKeyEpochCurrent",blockNumber:t});return p(e,"ucKeyEpochCurrent")}}exports.ViemOperationKeyReader=y;exports.ViemUniversalChallengerReader=C;exports.ViemVaultKeeperReader=A;exports.resolveProtocolAddresses=g;
2
- //# sourceMappingURL=signer-set-reader-DFAu6I-v.cjs.map
1
+ "use strict";const c=require("./BTCVaultRegistry.abi-BH2-LHxN.cjs"),i=require("./ApplicationRegistry.abi-sMiTWmnL.cjs"),n=require("./ProtocolParams.abi-CjrT0545.cjs");async function g(a,t){const[e,r]=await a.multicall({contracts:[{address:t,abi:c.BTCVaultRegistryABI,functionName:"protocolParams"},{address:t,abi:c.BTCVaultRegistryABI,functionName:"applicationRegistry"}],allowFailure:!1});return{protocolParams:e,applicationRegistry:r}}function u(a,t,e){if(a!==t)throw new Error(`${e}: multicall returned ${a} results for ${t} calls, so the results are not roster-aligned; refusing to use them`)}function h(a,t){return{vaultProvider:a[0],vaultKeepers:a.slice(1,1+t),universalChallengers:a.slice(1+t)}}class y{constructor(t,e){this.publicClient=t,this.contracts=e}async readAll(t,e,r,s,d){const l=await this.publicClient.multicall({contracts:t,allowFailure:!1,blockNumber:d});return u(l.length,1+e+r,s),h(l,e)}async getCurrentOperationKeys(t,e){const r=[{address:this.contracts.btcVaultRegistry,abi:c.BTCVaultRegistryABI,functionName:"getCurrentOperationBtcKey",args:[t.vaultProviderEthAddress]},...t.vaultKeepers.map(s=>({address:this.contracts.applicationRegistry,abi:i.ApplicationRegistryABI,functionName:"getCurrentOperationBtcKey",args:[t.applicationEntryPoint,s.ethAddress]})),...t.universalChallengers.map(s=>({address:this.contracts.protocolParams,abi:n.ProtocolParamsABI,functionName:"getCurrentOperationBtcKey",args:[s.ethAddress]}))];return this.readAll(r,t.vaultKeepers.length,t.universalChallengers.length,"getCurrentOperationKeys",e)}async getOperationKeysAtEpochs(t,e){const r=[{address:this.contracts.btcVaultRegistry,abi:c.BTCVaultRegistryABI,functionName:"getOperationBtcKeyAtEpoch",args:[t.vaultProviderEthAddress,e.vpKeyEpoch]},...t.vaultKeepers.map(s=>({address:this.contracts.applicationRegistry,abi:i.ApplicationRegistryABI,functionName:"getOperationBtcKeyAtEpochOrGenesis",args:[t.applicationEntryPoint,s.ethAddress,e.appKeeperKeyEpoch,s.btcPubKey]})),...t.universalChallengers.map(s=>({address:this.contracts.protocolParams,abi:n.ProtocolParamsABI,functionName:"getOperationBtcKeyAtEpochOrGenesis",args:[s.ethAddress,e.ucKeyEpoch,s.btcPubKey]}))];return this.readAll(r,t.vaultKeepers.length,t.universalChallengers.length,"getOperationKeysAtEpochs")}async getPayoutScriptsAtEpochs(t,e){const r=await this.publicClient.multicall({contracts:[{address:this.contracts.btcVaultRegistry,abi:c.BTCVaultRegistryABI,functionName:"getPayoutScriptAtEpoch",args:[t.vaultProviderEthAddress,e.vpKeyEpoch]},...t.vaultKeepers.map(s=>({address:this.contracts.applicationRegistry,abi:i.ApplicationRegistryABI,functionName:"getPayoutScriptAtEpoch",args:[t.applicationEntryPoint,s.ethAddress,e.appKeeperKeyEpoch]}))],allowFailure:!1});return u(r.length,1+t.vaultKeepers.length,"getPayoutScriptsAtEpochs"),{vaultProvider:r[0],vaultKeepers:[...r.slice(1)]}}}function o(a){return a.map(t=>({ethAddress:t.ethAddress,btcPubKey:t.btcPubKey}))}function p(a,t){if(typeof a!="bigint")throw new Error(`Invalid ${t} from contract: must be a bigint, got ${typeof a}`);return a}class A{constructor(t,e){this.publicClient=t,this.contractAddress=e}async getVaultKeepersByVersion(t,e,r){const s=await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"getVaultKeepersByVersion",args:[t,e],blockNumber:r});return o(s)}async getCurrentVaultKeepers(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"getCurrentVaultKeepers",args:[t]});return o(e)}async getCurrentVaultKeepersVersion(t,e){return await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"getCurrentVaultKeepersVersion",args:[t],blockNumber:e})}async getCurrentAppKeeperKeyEpoch(t,e){const r=await this.publicClient.readContract({address:this.contractAddress,abi:i.ApplicationRegistryABI,functionName:"appKeeperKeyEpochCurrent",args:[t],blockNumber:e});return p(r,"appKeeperKeyEpochCurrent")}}class C{constructor(t,e){this.publicClient=t,this.contractAddress=e}async getUniversalChallengersByVersion(t,e){const r=await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"getUniversalChallengersByVersion",args:[t],blockNumber:e});return o(r)}async getCurrentUniversalChallengers(){const t=await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"getCurrentUniversalChallengers"});return o(t)}async getLatestUniversalChallengersVersion(t){return await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"latestUniversalChallengersVersion",blockNumber:t})}async getCurrentUcKeyEpoch(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:n.ProtocolParamsABI,functionName:"ucKeyEpochCurrent",blockNumber:t});return p(e,"ucKeyEpochCurrent")}}exports.ViemOperationKeyReader=y;exports.ViemUniversalChallengerReader=C;exports.ViemVaultKeeperReader=A;exports.resolveProtocolAddresses=g;
2
+ //# sourceMappingURL=signer-set-reader-D-CyIYR5.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"signer-set-reader-DFAu6I-v.cjs","sources":["../src/tbv/core/clients/eth/contract-address-resolver.ts","../src/tbv/core/clients/eth/operation-key-reader.ts","../src/tbv/core/clients/eth/signer-set-reader.ts"],"sourcesContent":["/**\n * Contract Address Resolver\n *\n * Resolves ProtocolParams and ApplicationRegistry contract addresses\n * from the BTCVaultRegistry contract. These addresses are needed to\n * construct the SDK's contract readers.\n *\n * @module clients/eth/contract-address-resolver\n */\n\nimport type { Address, PublicClient } from \"viem\";\n\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\n\nexport interface ProtocolAddresses {\n /** Address of the ProtocolParams contract */\n protocolParams: Address;\n /** Address of the ApplicationRegistry contract */\n applicationRegistry: Address;\n}\n\n/**\n * Resolve ProtocolParams and ApplicationRegistry addresses from BTCVaultRegistry.\n *\n * Uses a single multicall for atomicity and efficiency.\n *\n * @param publicClient - viem PublicClient instance\n * @param btcVaultRegistryAddress - Address of the BTCVaultRegistry contract\n * @returns Resolved contract addresses\n */\nexport async function resolveProtocolAddresses(\n publicClient: PublicClient,\n btcVaultRegistryAddress: Address,\n): Promise<ProtocolAddresses> {\n const [protocolParams, applicationRegistry] = await publicClient.multicall({\n contracts: [\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"protocolParams\",\n },\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"applicationRegistry\",\n },\n ],\n allowFailure: false,\n });\n\n return {\n protocolParams: protocolParams as Address,\n applicationRegistry: applicationRegistry as Address,\n };\n}\n","/**\n * Concrete RFC-006 operation-key reader spanning all three registries.\n *\n * This is an optional utility — callers can use their own implementation of\n * the {@link OperationKeyReader} interface.\n */\n\nimport type { Abi, Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n KeyEpochs,\n OperationKeyQuery,\n OperationKeyReader,\n RawOperationKeys,\n RawPayoutScripts,\n} from \"./types\";\n\n/** Addresses of the three registries an operation-key resolution spans. */\nexport interface OperationKeyContracts {\n btcVaultRegistry: Address;\n applicationRegistry: Address;\n protocolParams: Address;\n}\n\n/** One `multicall` entry. Loosely typed because the three ABIs differ. */\ntype Call = {\n address: Address;\n abi: Abi;\n functionName: string;\n args: readonly unknown[];\n};\n\n/**\n * Reject a multicall result that is not one-per-call.\n *\n * Every method here relies on positional alignment between calls and results,\n * so a short array does not fail — it silently hands back `undefined` for the\n * tail entries. Downstream that surfaces as a complaint about whichever\n * operator happens to occupy the missing slot, blaming a participant that is\n * perfectly fine for a read that came back incomplete. Assert the length where\n * the array arrives so the error names the real fault.\n */\nfunction assertMulticallLength(\n actual: number,\n expected: number,\n label: string,\n): void {\n if (actual !== expected) {\n throw new Error(\n `${label}: multicall returned ${actual} results for ${expected} calls, ` +\n `so the results are not roster-aligned; refusing to use them`,\n );\n }\n}\n\n/**\n * Split a flat multicall result into VP / keepers / challengers.\n *\n * Every method below builds its calls in the same order — vault provider\n * first, then keepers in roster order, then challengers in roster order — so\n * the results stay index-aligned with `query.vaultKeepers` /\n * `query.universalChallengers`. That alignment is what lets the resolver pair\n * a resolved key back to its admin address; the sorted key arrays it exposes\n * are derived from those pairs, never the other way round.\n */\nfunction partition<T>(\n results: readonly T[],\n keeperCount: number,\n): { vaultProvider: T; vaultKeepers: T[]; universalChallengers: T[] } {\n return {\n vaultProvider: results[0],\n vaultKeepers: results.slice(1, 1 + keeperCount),\n universalChallengers: results.slice(1 + keeperCount),\n };\n}\n\n/**\n * Reads RFC-006 operation keys and payout scripts.\n *\n * Usage:\n * ```ts\n * const reader = new ViemOperationKeyReader(publicClient, contracts);\n * const keys = await reader.getCurrentOperationKeys(query);\n * ```\n */\nexport class ViemOperationKeyReader implements OperationKeyReader {\n constructor(\n private publicClient: PublicClient,\n private contracts: OperationKeyContracts,\n ) {}\n\n /**\n * One multicall, `allowFailure: false`, so every key in the set is read at\n * the same block. A rotation landing between two separate `eth_call`s would\n * otherwise produce a mixed-epoch key set and a lock no counterparty agrees\n * with.\n */\n private async readAll<T>(\n calls: Call[],\n keeperCount: number,\n challengerCount: number,\n label: string,\n blockNumber?: bigint,\n ) {\n const results = (await this.publicClient.multicall({\n contracts: calls,\n allowFailure: false,\n blockNumber,\n })) as readonly T[];\n\n assertMulticallLength(\n results.length,\n 1 + keeperCount + challengerCount,\n label,\n );\n\n return partition(results, keeperCount);\n }\n\n async getCurrentOperationKeys(\n query: OperationKeyQuery,\n blockNumber?: bigint,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.vaultProviderEthAddress],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.applicationEntryPoint, keeper.ethAddress],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [challenger.ethAddress],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getCurrentOperationKeys\",\n blockNumber,\n );\n }\n\n async getOperationKeysAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n // The VP takes the plain `AtEpoch` variant: it has no membership\n // version, so its genesis (the registration key at version 0) is\n // unambiguous and the contract resolves it internally.\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n // Keepers and challengers take `...OrGenesis` with their roster key\n // passed explicitly, because the correct genesis for them is their key\n // in *this vault's frozen membership version*. An operator dropped from\n // the current roster, or listed under a different key in an older\n // version, would otherwise resolve against the wrong genesis.\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n keeper.btcPubKey,\n ],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [challenger.ethAddress, epochs.ucKeyEpoch, challenger.btcPubKey],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getOperationKeysAtEpochs\",\n );\n }\n\n async getPayoutScriptsAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawPayoutScripts> {\n // Universal challengers are never claimers, so they have no payout script\n // and no call here.\n const results = (await this.publicClient.multicall({\n contracts: [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n ],\n })),\n ],\n allowFailure: false,\n })) as readonly Hex[];\n\n // Expected length is `1 + keepers`, with no challenger term — see the\n // comment above on why universal challengers have no call here.\n assertMulticallLength(\n results.length,\n 1 + query.vaultKeepers.length,\n \"getPayoutScriptsAtEpochs\",\n );\n\n return {\n vaultProvider: results[0],\n vaultKeepers: [...results.slice(1)],\n };\n }\n}\n","/**\n * Concrete signer-set readers for vault keepers and universal challengers.\n *\n * These are optional utilities — callers can use their own implementations\n * of the VaultKeeperReader and UniversalChallengerReader interfaces.\n */\n\nimport type { Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n AddressBTCKeyPair,\n UniversalChallengerReader,\n VaultKeeperReader,\n} from \"./types\";\n\n/** Map viem tuple array to AddressBTCKeyPair[]. */\nfunction mapKeyPairs(\n result: readonly { ethAddress: Address; btcPubKey: Hex }[],\n): AddressBTCKeyPair[] {\n return result.map((pair) => ({\n ethAddress: pair.ethAddress,\n btcPubKey: pair.btcPubKey,\n }));\n}\n\n/**\n * Both key-epoch getters return `uint64` and feed the peg-in config\n * fingerprint, where the contract encodes them as `uint64`. A `Number`\n * narrowing would silently truncate above 2^53 and produce a fingerprint the\n * registry cannot reproduce, so the payload is asserted to be a `bigint` and\n * carried as one — never coerced, never defaulted.\n */\nfunction assertKeyEpoch(raw: unknown, label: string): bigint {\n if (typeof raw !== \"bigint\") {\n throw new Error(\n `Invalid ${label} from contract: must be a bigint, got ${typeof raw}`,\n );\n }\n return raw;\n}\n\n/**\n * Reads vault keepers from the ApplicationRegistry contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemVaultKeeperReader(publicClient, applicationRegistryAddress);\n * const keepers = await reader.getCurrentVaultKeepers(appEntryPoint);\n * ```\n */\nexport class ViemVaultKeeperReader implements VaultKeeperReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getVaultKeepersByVersion(\n appEntryPoint: Address,\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getVaultKeepersByVersion\",\n args: [appEntryPoint, version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepers(\n appEntryPoint: Address,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepers\",\n args: [appEntryPoint],\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepersVersion(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepersVersion\",\n args: [appEntryPoint],\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentAppKeeperKeyEpoch(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"appKeeperKeyEpochCurrent\",\n args: [appEntryPoint],\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"appKeeperKeyEpochCurrent\");\n }\n}\n\n/**\n * Reads universal challengers from the ProtocolParams contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemUniversalChallengerReader(publicClient, protocolParamsAddress);\n * const challengers = await reader.getCurrentUniversalChallengers();\n * ```\n */\nexport class ViemUniversalChallengerReader implements UniversalChallengerReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getUniversalChallengersByVersion(\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getUniversalChallengersByVersion\",\n args: [version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentUniversalChallengers(): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getCurrentUniversalChallengers\",\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getLatestUniversalChallengersVersion(\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"latestUniversalChallengersVersion\",\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentUcKeyEpoch(blockNumber?: bigint): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"ucKeyEpochCurrent\",\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"ucKeyEpochCurrent\");\n }\n}\n"],"names":["resolveProtocolAddresses","publicClient","btcVaultRegistryAddress","protocolParams","applicationRegistry","BTCVaultRegistryABI","assertMulticallLength","actual","expected","label","partition","results","keeperCount","ViemOperationKeyReader","contracts","calls","challengerCount","blockNumber","query","keeper","ApplicationRegistryABI","challenger","ProtocolParamsABI","epochs","mapKeyPairs","result","pair","assertKeyEpoch","raw","ViemVaultKeeperReader","contractAddress","appEntryPoint","version","ViemUniversalChallengerReader"],"mappings":"uKA8BA,eAAsBA,EACpBC,EACAC,EAC4B,CAC5B,KAAM,CAACC,EAAgBC,CAAmB,EAAI,MAAMH,EAAa,UAAU,CACzE,UAAW,CACT,CACE,QAASC,EACT,IAAKG,EAAAA,oBACL,aAAc,gBAAA,EAEhB,CACE,QAASH,EACT,IAAKG,EAAAA,oBACL,aAAc,qBAAA,CAChB,EAEF,aAAc,EAAA,CACf,EAED,MAAO,CACL,eAAAF,EACA,oBAAAC,CAAA,CAEJ,CCTA,SAASE,EACPC,EACAC,EACAC,EACM,CACN,GAAIF,IAAWC,EACb,MAAM,IAAI,MACR,GAAGC,CAAK,wBAAwBF,CAAM,gBAAgBC,CAAQ,qEAAA,CAIpE,CAYA,SAASE,EACPC,EACAC,EACoE,CACpE,MAAO,CACL,cAAeD,EAAQ,CAAC,EACxB,aAAcA,EAAQ,MAAM,EAAG,EAAIC,CAAW,EAC9C,qBAAsBD,EAAQ,MAAM,EAAIC,CAAW,CAAA,CAEvD,CAWO,MAAMC,CAAqD,CAChE,YACUZ,EACAa,EACR,CAFQ,KAAA,aAAAb,EACA,KAAA,UAAAa,CACP,CAQH,MAAc,QACZ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EA,MAAM,qBAAqBA,EAAuC,CAChE,MAAMW,EAAe,MAAM,KAAK,aAAa,aAAa,CACxD,QAAS,KAAK,gBACd,IAAKN,EAAAA,kBACL,aAAc,oBACd,YAAAL,CAAA,CACD,EAED,OAAOU,EAAeC,EAAK,mBAAmB,CAChD,CACF"}
1
+ {"version":3,"file":"signer-set-reader-D-CyIYR5.cjs","sources":["../src/tbv/core/clients/eth/contract-address-resolver.ts","../src/tbv/core/clients/eth/operation-key-reader.ts","../src/tbv/core/clients/eth/signer-set-reader.ts"],"sourcesContent":["/**\n * Contract Address Resolver\n *\n * Resolves ProtocolParams and ApplicationRegistry contract addresses\n * from the BTCVaultRegistry contract. These addresses are needed to\n * construct the SDK's contract readers.\n *\n * @module clients/eth/contract-address-resolver\n */\n\nimport type { Address, PublicClient } from \"viem\";\n\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\n\nexport interface ProtocolAddresses {\n /** Address of the ProtocolParams contract */\n protocolParams: Address;\n /** Address of the ApplicationRegistry contract */\n applicationRegistry: Address;\n}\n\n/**\n * Resolve ProtocolParams and ApplicationRegistry addresses from BTCVaultRegistry.\n *\n * Uses a single multicall for atomicity and efficiency.\n *\n * @param publicClient - viem PublicClient instance\n * @param btcVaultRegistryAddress - Address of the BTCVaultRegistry contract\n * @returns Resolved contract addresses\n */\nexport async function resolveProtocolAddresses(\n publicClient: PublicClient,\n btcVaultRegistryAddress: Address,\n): Promise<ProtocolAddresses> {\n const [protocolParams, applicationRegistry] = await publicClient.multicall({\n contracts: [\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"protocolParams\",\n },\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"applicationRegistry\",\n },\n ],\n allowFailure: false,\n });\n\n return {\n protocolParams: protocolParams as Address,\n applicationRegistry: applicationRegistry as Address,\n };\n}\n","/**\n * Concrete RFC-006 operation-key reader spanning all three registries.\n *\n * This is an optional utility — callers can use their own implementation of\n * the {@link OperationKeyReader} interface.\n */\n\nimport type { Abi, Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n KeyEpochs,\n OperationKeyQuery,\n OperationKeyReader,\n RawOperationKeys,\n RawPayoutScripts,\n} from \"./types\";\n\n/** Addresses of the three registries an operation-key resolution spans. */\nexport interface OperationKeyContracts {\n btcVaultRegistry: Address;\n applicationRegistry: Address;\n protocolParams: Address;\n}\n\n/** One `multicall` entry. Loosely typed because the three ABIs differ. */\ntype Call = {\n address: Address;\n abi: Abi;\n functionName: string;\n args: readonly unknown[];\n};\n\n/**\n * Reject a multicall result that is not one-per-call.\n *\n * Every method here relies on positional alignment between calls and results,\n * so a short array does not fail — it silently hands back `undefined` for the\n * tail entries. Downstream that surfaces as a complaint about whichever\n * operator happens to occupy the missing slot, blaming a participant that is\n * perfectly fine for a read that came back incomplete. Assert the length where\n * the array arrives so the error names the real fault.\n */\nfunction assertMulticallLength(\n actual: number,\n expected: number,\n label: string,\n): void {\n if (actual !== expected) {\n throw new Error(\n `${label}: multicall returned ${actual} results for ${expected} calls, ` +\n `so the results are not roster-aligned; refusing to use them`,\n );\n }\n}\n\n/**\n * Split a flat multicall result into VP / keepers / challengers.\n *\n * Every method below builds its calls in the same order — vault provider\n * first, then keepers in roster order, then challengers in roster order — so\n * the results stay index-aligned with `query.vaultKeepers` /\n * `query.universalChallengers`. That alignment is what lets the resolver pair\n * a resolved key back to its admin address; the sorted key arrays it exposes\n * are derived from those pairs, never the other way round.\n */\nfunction partition<T>(\n results: readonly T[],\n keeperCount: number,\n): { vaultProvider: T; vaultKeepers: T[]; universalChallengers: T[] } {\n return {\n vaultProvider: results[0],\n vaultKeepers: results.slice(1, 1 + keeperCount),\n universalChallengers: results.slice(1 + keeperCount),\n };\n}\n\n/**\n * Reads RFC-006 operation keys and payout scripts.\n *\n * Usage:\n * ```ts\n * const reader = new ViemOperationKeyReader(publicClient, contracts);\n * const keys = await reader.getCurrentOperationKeys(query);\n * ```\n */\nexport class ViemOperationKeyReader implements OperationKeyReader {\n constructor(\n private publicClient: PublicClient,\n private contracts: OperationKeyContracts,\n ) {}\n\n /**\n * One multicall, `allowFailure: false`, so every key in the set is read at\n * the same block. A rotation landing between two separate `eth_call`s would\n * otherwise produce a mixed-epoch key set and a lock no counterparty agrees\n * with.\n */\n private async readAll<T>(\n calls: Call[],\n keeperCount: number,\n challengerCount: number,\n label: string,\n blockNumber?: bigint,\n ) {\n const results = (await this.publicClient.multicall({\n contracts: calls,\n allowFailure: false,\n blockNumber,\n })) as readonly T[];\n\n assertMulticallLength(\n results.length,\n 1 + keeperCount + challengerCount,\n label,\n );\n\n return partition(results, keeperCount);\n }\n\n async getCurrentOperationKeys(\n query: OperationKeyQuery,\n blockNumber?: bigint,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.vaultProviderEthAddress],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.applicationEntryPoint, keeper.ethAddress],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [challenger.ethAddress],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getCurrentOperationKeys\",\n blockNumber,\n );\n }\n\n async getOperationKeysAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n // The VP takes the plain `AtEpoch` variant: it has no membership\n // version, so its genesis (the registration key at version 0) is\n // unambiguous and the contract resolves it internally.\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n // Keepers and challengers take `...OrGenesis` with their roster key\n // passed explicitly, because the correct genesis for them is their key\n // in *this vault's frozen membership version*. An operator dropped from\n // the current roster, or listed under a different key in an older\n // version, would otherwise resolve against the wrong genesis.\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n keeper.btcPubKey,\n ],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [challenger.ethAddress, epochs.ucKeyEpoch, challenger.btcPubKey],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getOperationKeysAtEpochs\",\n );\n }\n\n async getPayoutScriptsAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawPayoutScripts> {\n // Universal challengers are never claimers, so they have no payout script\n // and no call here.\n const results = (await this.publicClient.multicall({\n contracts: [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n ],\n })),\n ],\n allowFailure: false,\n })) as readonly Hex[];\n\n // Expected length is `1 + keepers`, with no challenger term — see the\n // comment above on why universal challengers have no call here.\n assertMulticallLength(\n results.length,\n 1 + query.vaultKeepers.length,\n \"getPayoutScriptsAtEpochs\",\n );\n\n return {\n vaultProvider: results[0],\n vaultKeepers: [...results.slice(1)],\n };\n }\n}\n","/**\n * Concrete signer-set readers for vault keepers and universal challengers.\n *\n * These are optional utilities — callers can use their own implementations\n * of the VaultKeeperReader and UniversalChallengerReader interfaces.\n */\n\nimport type { Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n AddressBTCKeyPair,\n UniversalChallengerReader,\n VaultKeeperReader,\n} from \"./types\";\n\n/** Map viem tuple array to AddressBTCKeyPair[]. */\nfunction mapKeyPairs(\n result: readonly { ethAddress: Address; btcPubKey: Hex }[],\n): AddressBTCKeyPair[] {\n return result.map((pair) => ({\n ethAddress: pair.ethAddress,\n btcPubKey: pair.btcPubKey,\n }));\n}\n\n/**\n * Both key-epoch getters return `uint64` and feed the peg-in config\n * fingerprint, where the contract encodes them as `uint64`. A `Number`\n * narrowing would silently truncate above 2^53 and produce a fingerprint the\n * registry cannot reproduce, so the payload is asserted to be a `bigint` and\n * carried as one — never coerced, never defaulted.\n */\nfunction assertKeyEpoch(raw: unknown, label: string): bigint {\n if (typeof raw !== \"bigint\") {\n throw new Error(\n `Invalid ${label} from contract: must be a bigint, got ${typeof raw}`,\n );\n }\n return raw;\n}\n\n/**\n * Reads vault keepers from the ApplicationRegistry contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemVaultKeeperReader(publicClient, applicationRegistryAddress);\n * const keepers = await reader.getCurrentVaultKeepers(appEntryPoint);\n * ```\n */\nexport class ViemVaultKeeperReader implements VaultKeeperReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getVaultKeepersByVersion(\n appEntryPoint: Address,\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getVaultKeepersByVersion\",\n args: [appEntryPoint, version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepers(\n appEntryPoint: Address,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepers\",\n args: [appEntryPoint],\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepersVersion(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepersVersion\",\n args: [appEntryPoint],\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentAppKeeperKeyEpoch(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"appKeeperKeyEpochCurrent\",\n args: [appEntryPoint],\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"appKeeperKeyEpochCurrent\");\n }\n}\n\n/**\n * Reads universal challengers from the ProtocolParams contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemUniversalChallengerReader(publicClient, protocolParamsAddress);\n * const challengers = await reader.getCurrentUniversalChallengers();\n * ```\n */\nexport class ViemUniversalChallengerReader implements UniversalChallengerReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getUniversalChallengersByVersion(\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getUniversalChallengersByVersion\",\n args: [version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentUniversalChallengers(): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getCurrentUniversalChallengers\",\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getLatestUniversalChallengersVersion(\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"latestUniversalChallengersVersion\",\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentUcKeyEpoch(blockNumber?: bigint): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"ucKeyEpochCurrent\",\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"ucKeyEpochCurrent\");\n }\n}\n"],"names":["resolveProtocolAddresses","publicClient","btcVaultRegistryAddress","protocolParams","applicationRegistry","BTCVaultRegistryABI","assertMulticallLength","actual","expected","label","partition","results","keeperCount","ViemOperationKeyReader","contracts","calls","challengerCount","blockNumber","query","keeper","ApplicationRegistryABI","challenger","ProtocolParamsABI","epochs","mapKeyPairs","result","pair","assertKeyEpoch","raw","ViemVaultKeeperReader","contractAddress","appEntryPoint","version","ViemUniversalChallengerReader"],"mappings":"uKA8BA,eAAsBA,EACpBC,EACAC,EAC4B,CAC5B,KAAM,CAACC,EAAgBC,CAAmB,EAAI,MAAMH,EAAa,UAAU,CACzE,UAAW,CACT,CACE,QAASC,EACT,IAAKG,EAAAA,oBACL,aAAc,gBAAA,EAEhB,CACE,QAASH,EACT,IAAKG,EAAAA,oBACL,aAAc,qBAAA,CAChB,EAE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9B,MAAMQ,EAAU,MAAM,KAAK,aAAa,aAAa,CACnD,QAAS,KAAK,gBACd,IAAKH,EAAAA,kBACL,aAAc,mCACd,KAAM,CAACU,CAAO,EACd,YAAAf,CAAA,CACD,EAED,OAAOO,EAAYC,CAAM,CAC3B,CAEA,MAAM,gCAA+D,CACnE,MAAMA,EAAU,MAAM,KAAK,aAAa,aAAa,CACnD,QAAS,KAAK,gBACd,IAAKH,EAAAA,kBACL,aAAc,gCAAA,CACf,EAED,OAAOE,EAAYC,CAAM,CAC3B,CAEA,MAAM,qCACJR,EACiB,CAQjB,OAPgB,MAAM,KAAK,aAAa,aAAa,CACnD,QAAS,KAAK,gBACd,IAAKK,EAAAA,kBACL,aAAc,oCACd,YAAAL,CAAA,CACD,CAGH,CAEA,MAAM,qBAAqBA,EAAuC,CAChE,MAAMW,EAAe,MAAM,KAAK,aAAa,aAAa,CACxD,QAAS,KAAK,gBACd,IAAKN,EAAAA,kBACL,aAAc,oBACd,YAAAL,CAAA,CACD,EAED,OAAOU,EAAeC,EAAK,mBAAmB,CAChD,CACF"}
@@ -1,4 +1,4 @@
1
- import { B as c } from "./BTCVaultRegistry.abi-BmHpMUWD.js";
1
+ import { B as c } from "./BTCVaultRegistry.abi-BzNTa_EU.js";
2
2
  import { A as n } from "./ApplicationRegistry.abi-s8cQ1ooR.js";
3
3
  import { P as i } from "./ProtocolParams.abi-CKOVqFJP.js";
4
4
  async function K(s, t) {
@@ -261,4 +261,4 @@ export {
261
261
  b,
262
262
  K as r
263
263
  };
264
- //# sourceMappingURL=signer-set-reader-BCtmSKUM.js.map
264
+ //# sourceMappingURL=signer-set-reader-DFF9MgQN.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signer-set-reader-BCtmSKUM.js","sources":["../src/tbv/core/clients/eth/contract-address-resolver.ts","../src/tbv/core/clients/eth/operation-key-reader.ts","../src/tbv/core/clients/eth/signer-set-reader.ts"],"sourcesContent":["/**\n * Contract Address Resolver\n *\n * Resolves ProtocolParams and ApplicationRegistry contract addresses\n * from the BTCVaultRegistry contract. These addresses are needed to\n * construct the SDK's contract readers.\n *\n * @module clients/eth/contract-address-resolver\n */\n\nimport type { Address, PublicClient } from \"viem\";\n\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\n\nexport interface ProtocolAddresses {\n /** Address of the ProtocolParams contract */\n protocolParams: Address;\n /** Address of the ApplicationRegistry contract */\n applicationRegistry: Address;\n}\n\n/**\n * Resolve ProtocolParams and ApplicationRegistry addresses from BTCVaultRegistry.\n *\n * Uses a single multicall for atomicity and efficiency.\n *\n * @param publicClient - viem PublicClient instance\n * @param btcVaultRegistryAddress - Address of the BTCVaultRegistry contract\n * @returns Resolved contract addresses\n */\nexport async function resolveProtocolAddresses(\n publicClient: PublicClient,\n btcVaultRegistryAddress: Address,\n): Promise<ProtocolAddresses> {\n const [protocolParams, applicationRegistry] = await publicClient.multicall({\n contracts: [\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"protocolParams\",\n },\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"applicationRegistry\",\n },\n ],\n allowFailure: false,\n });\n\n return {\n protocolParams: protocolParams as Address,\n applicationRegistry: applicationRegistry as Address,\n };\n}\n","/**\n * Concrete RFC-006 operation-key reader spanning all three registries.\n *\n * This is an optional utility — callers can use their own implementation of\n * the {@link OperationKeyReader} interface.\n */\n\nimport type { Abi, Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n KeyEpochs,\n OperationKeyQuery,\n OperationKeyReader,\n RawOperationKeys,\n RawPayoutScripts,\n} from \"./types\";\n\n/** Addresses of the three registries an operation-key resolution spans. */\nexport interface OperationKeyContracts {\n btcVaultRegistry: Address;\n applicationRegistry: Address;\n protocolParams: Address;\n}\n\n/** One `multicall` entry. Loosely typed because the three ABIs differ. */\ntype Call = {\n address: Address;\n abi: Abi;\n functionName: string;\n args: readonly unknown[];\n};\n\n/**\n * Reject a multicall result that is not one-per-call.\n *\n * Every method here relies on positional alignment between calls and results,\n * so a short array does not fail — it silently hands back `undefined` for the\n * tail entries. Downstream that surfaces as a complaint about whichever\n * operator happens to occupy the missing slot, blaming a participant that is\n * perfectly fine for a read that came back incomplete. Assert the length where\n * the array arrives so the error names the real fault.\n */\nfunction assertMulticallLength(\n actual: number,\n expected: number,\n label: string,\n): void {\n if (actual !== expected) {\n throw new Error(\n `${label}: multicall returned ${actual} results for ${expected} calls, ` +\n `so the results are not roster-aligned; refusing to use them`,\n );\n }\n}\n\n/**\n * Split a flat multicall result into VP / keepers / challengers.\n *\n * Every method below builds its calls in the same order — vault provider\n * first, then keepers in roster order, then challengers in roster order — so\n * the results stay index-aligned with `query.vaultKeepers` /\n * `query.universalChallengers`. That alignment is what lets the resolver pair\n * a resolved key back to its admin address; the sorted key arrays it exposes\n * are derived from those pairs, never the other way round.\n */\nfunction partition<T>(\n results: readonly T[],\n keeperCount: number,\n): { vaultProvider: T; vaultKeepers: T[]; universalChallengers: T[] } {\n return {\n vaultProvider: results[0],\n vaultKeepers: results.slice(1, 1 + keeperCount),\n universalChallengers: results.slice(1 + keeperCount),\n };\n}\n\n/**\n * Reads RFC-006 operation keys and payout scripts.\n *\n * Usage:\n * ```ts\n * const reader = new ViemOperationKeyReader(publicClient, contracts);\n * const keys = await reader.getCurrentOperationKeys(query);\n * ```\n */\nexport class ViemOperationKeyReader implements OperationKeyReader {\n constructor(\n private publicClient: PublicClient,\n private contracts: OperationKeyContracts,\n ) {}\n\n /**\n * One multicall, `allowFailure: false`, so every key in the set is read at\n * the same block. A rotation landing between two separate `eth_call`s would\n * otherwise produce a mixed-epoch key set and a lock no counterparty agrees\n * with.\n */\n private async readAll<T>(\n calls: Call[],\n keeperCount: number,\n challengerCount: number,\n label: string,\n blockNumber?: bigint,\n ) {\n const results = (await this.publicClient.multicall({\n contracts: calls,\n allowFailure: false,\n blockNumber,\n })) as readonly T[];\n\n assertMulticallLength(\n results.length,\n 1 + keeperCount + challengerCount,\n label,\n );\n\n return partition(results, keeperCount);\n }\n\n async getCurrentOperationKeys(\n query: OperationKeyQuery,\n blockNumber?: bigint,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.vaultProviderEthAddress],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.applicationEntryPoint, keeper.ethAddress],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [challenger.ethAddress],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getCurrentOperationKeys\",\n blockNumber,\n );\n }\n\n async getOperationKeysAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n // The VP takes the plain `AtEpoch` variant: it has no membership\n // version, so its genesis (the registration key at version 0) is\n // unambiguous and the contract resolves it internally.\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n // Keepers and challengers take `...OrGenesis` with their roster key\n // passed explicitly, because the correct genesis for them is their key\n // in *this vault's frozen membership version*. An operator dropped from\n // the current roster, or listed under a different key in an older\n // version, would otherwise resolve against the wrong genesis.\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n keeper.btcPubKey,\n ],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [challenger.ethAddress, epochs.ucKeyEpoch, challenger.btcPubKey],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getOperationKeysAtEpochs\",\n );\n }\n\n async getPayoutScriptsAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawPayoutScripts> {\n // Universal challengers are never claimers, so they have no payout script\n // and no call here.\n const results = (await this.publicClient.multicall({\n contracts: [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n ],\n })),\n ],\n allowFailure: false,\n })) as readonly Hex[];\n\n // Expected length is `1 + keepers`, with no challenger term — see the\n // comment above on why universal challengers have no call here.\n assertMulticallLength(\n results.length,\n 1 + query.vaultKeepers.length,\n \"getPayoutScriptsAtEpochs\",\n );\n\n return {\n vaultProvider: results[0],\n vaultKeepers: [...results.slice(1)],\n };\n }\n}\n","/**\n * Concrete signer-set readers for vault keepers and universal challengers.\n *\n * These are optional utilities — callers can use their own implementations\n * of the VaultKeeperReader and UniversalChallengerReader interfaces.\n */\n\nimport type { Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n AddressBTCKeyPair,\n UniversalChallengerReader,\n VaultKeeperReader,\n} from \"./types\";\n\n/** Map viem tuple array to AddressBTCKeyPair[]. */\nfunction mapKeyPairs(\n result: readonly { ethAddress: Address; btcPubKey: Hex }[],\n): AddressBTCKeyPair[] {\n return result.map((pair) => ({\n ethAddress: pair.ethAddress,\n btcPubKey: pair.btcPubKey,\n }));\n}\n\n/**\n * Both key-epoch getters return `uint64` and feed the peg-in config\n * fingerprint, where the contract encodes them as `uint64`. A `Number`\n * narrowing would silently truncate above 2^53 and produce a fingerprint the\n * registry cannot reproduce, so the payload is asserted to be a `bigint` and\n * carried as one — never coerced, never defaulted.\n */\nfunction assertKeyEpoch(raw: unknown, label: string): bigint {\n if (typeof raw !== \"bigint\") {\n throw new Error(\n `Invalid ${label} from contract: must be a bigint, got ${typeof raw}`,\n );\n }\n return raw;\n}\n\n/**\n * Reads vault keepers from the ApplicationRegistry contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemVaultKeeperReader(publicClient, applicationRegistryAddress);\n * const keepers = await reader.getCurrentVaultKeepers(appEntryPoint);\n * ```\n */\nexport class ViemVaultKeeperReader implements VaultKeeperReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getVaultKeepersByVersion(\n appEntryPoint: Address,\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getVaultKeepersByVersion\",\n args: [appEntryPoint, version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepers(\n appEntryPoint: Address,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepers\",\n args: [appEntryPoint],\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepersVersion(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepersVersion\",\n args: [appEntryPoint],\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentAppKeeperKeyEpoch(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"appKeeperKeyEpochCurrent\",\n args: [appEntryPoint],\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"appKeeperKeyEpochCurrent\");\n }\n}\n\n/**\n * Reads universal challengers from the ProtocolParams contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemUniversalChallengerReader(publicClient, protocolParamsAddress);\n * const challengers = await reader.getCurrentUniversalChallengers();\n * ```\n */\nexport class ViemUniversalChallengerReader implements UniversalChallengerReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getUniversalChallengersByVersion(\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getUniversalChallengersByVersion\",\n args: [version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentUniversalChallengers(): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getCurrentUniversalChallengers\",\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getLatestUniversalChallengersVersion(\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"latestUniversalChallengersVersion\",\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentUcKeyEpoch(blockNumber?: bigint): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"ucKeyEpochCurrent\",\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"ucKeyEpochCurrent\");\n }\n}\n"],"names":["resolveProtocolAddresses","publicClient","btcVaultRegistryAddress","protocolParams","applicationRegistry","BTCVaultRegistryABI","assertMulticallLength","actual","expected","label","partition","results","keeperCount","ViemOperationKeyReader","contracts","calls","challengerCount","blockNumber","query","keeper","ApplicationRegistryABI","challenger","ProtocolParamsABI","epochs","mapKeyPairs","result","pair","assertKeyEpoch","raw","ViemVaultKeeperReader","contractAddress","appEntryPoint","version","ViemUniversalChallengerReader"],"mappings":";;;AA8BA,eAAsBA,EACpBC,GACAC,GAC4B;AAC5B,QAAM,CAACC,GAAgBC,CAAmB,IAAI,MAAMH,EAAa,UAAU;AAAA,IACzE,WAAW;AAAA,MACT;AAAA,QACE,SAASC;AAAA,QACT,KAAKG;AAAA,QACL,cAAc;AAAA,MAAA;AAAA,MAEhB;AAAA,QACE,SAASH;AAAA,QACT,KAAKG;AAAA,QACL,cAAc;AAAA,MAAA;AAAA,IAChB;AAAA,IAEF,cAAc;AAAA,EAAA,CACf;AAED,SAAO;AAAA,IACL,gBAAAF;AAAA,IACA,qBAAAC;AAAA,EAAA;AAEJ;ACTA,SAASE,EACPC,GACAC,GACAC,GACM;AACN,MAAIF,MAAWC;AACb,UAAM,IAAI;AAAA,MACR,GAAGC,CAAK,wBAAwBF,CAAM,gBAAgBC,CAAQ;AAAA,IAAA;AAIpE;AAYA,SAASE,EACPC,GACAC,GACoE;AACpE,SAAO;AAAA,IACL,eAAeD,EAAQ,CAAC;AAAA,IACx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KAAKN;AAAA,MACL,cAAc;AAAA,MACd,aAAAL;AAAA,IAAA,CACD;AAED,WAAOU,EAAeC,GAAK,mBAAmB;AAAA,EAChD;AACF;"}
1
+ {"version":3,"file":"signer-set-reader-DFF9MgQN.js","sources":["../src/tbv/core/clients/eth/contract-address-resolver.ts","../src/tbv/core/clients/eth/operation-key-reader.ts","../src/tbv/core/clients/eth/signer-set-reader.ts"],"sourcesContent":["/**\n * Contract Address Resolver\n *\n * Resolves ProtocolParams and ApplicationRegistry contract addresses\n * from the BTCVaultRegistry contract. These addresses are needed to\n * construct the SDK's contract readers.\n *\n * @module clients/eth/contract-address-resolver\n */\n\nimport type { Address, PublicClient } from \"viem\";\n\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\n\nexport interface ProtocolAddresses {\n /** Address of the ProtocolParams contract */\n protocolParams: Address;\n /** Address of the ApplicationRegistry contract */\n applicationRegistry: Address;\n}\n\n/**\n * Resolve ProtocolParams and ApplicationRegistry addresses from BTCVaultRegistry.\n *\n * Uses a single multicall for atomicity and efficiency.\n *\n * @param publicClient - viem PublicClient instance\n * @param btcVaultRegistryAddress - Address of the BTCVaultRegistry contract\n * @returns Resolved contract addresses\n */\nexport async function resolveProtocolAddresses(\n publicClient: PublicClient,\n btcVaultRegistryAddress: Address,\n): Promise<ProtocolAddresses> {\n const [protocolParams, applicationRegistry] = await publicClient.multicall({\n contracts: [\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"protocolParams\",\n },\n {\n address: btcVaultRegistryAddress,\n abi: BTCVaultRegistryABI,\n functionName: \"applicationRegistry\",\n },\n ],\n allowFailure: false,\n });\n\n return {\n protocolParams: protocolParams as Address,\n applicationRegistry: applicationRegistry as Address,\n };\n}\n","/**\n * Concrete RFC-006 operation-key reader spanning all three registries.\n *\n * This is an optional utility — callers can use their own implementation of\n * the {@link OperationKeyReader} interface.\n */\n\nimport type { Abi, Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { BTCVaultRegistryABI } from \"../../contracts/abis/BTCVaultRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n KeyEpochs,\n OperationKeyQuery,\n OperationKeyReader,\n RawOperationKeys,\n RawPayoutScripts,\n} from \"./types\";\n\n/** Addresses of the three registries an operation-key resolution spans. */\nexport interface OperationKeyContracts {\n btcVaultRegistry: Address;\n applicationRegistry: Address;\n protocolParams: Address;\n}\n\n/** One `multicall` entry. Loosely typed because the three ABIs differ. */\ntype Call = {\n address: Address;\n abi: Abi;\n functionName: string;\n args: readonly unknown[];\n};\n\n/**\n * Reject a multicall result that is not one-per-call.\n *\n * Every method here relies on positional alignment between calls and results,\n * so a short array does not fail — it silently hands back `undefined` for the\n * tail entries. Downstream that surfaces as a complaint about whichever\n * operator happens to occupy the missing slot, blaming a participant that is\n * perfectly fine for a read that came back incomplete. Assert the length where\n * the array arrives so the error names the real fault.\n */\nfunction assertMulticallLength(\n actual: number,\n expected: number,\n label: string,\n): void {\n if (actual !== expected) {\n throw new Error(\n `${label}: multicall returned ${actual} results for ${expected} calls, ` +\n `so the results are not roster-aligned; refusing to use them`,\n );\n }\n}\n\n/**\n * Split a flat multicall result into VP / keepers / challengers.\n *\n * Every method below builds its calls in the same order — vault provider\n * first, then keepers in roster order, then challengers in roster order — so\n * the results stay index-aligned with `query.vaultKeepers` /\n * `query.universalChallengers`. That alignment is what lets the resolver pair\n * a resolved key back to its admin address; the sorted key arrays it exposes\n * are derived from those pairs, never the other way round.\n */\nfunction partition<T>(\n results: readonly T[],\n keeperCount: number,\n): { vaultProvider: T; vaultKeepers: T[]; universalChallengers: T[] } {\n return {\n vaultProvider: results[0],\n vaultKeepers: results.slice(1, 1 + keeperCount),\n universalChallengers: results.slice(1 + keeperCount),\n };\n}\n\n/**\n * Reads RFC-006 operation keys and payout scripts.\n *\n * Usage:\n * ```ts\n * const reader = new ViemOperationKeyReader(publicClient, contracts);\n * const keys = await reader.getCurrentOperationKeys(query);\n * ```\n */\nexport class ViemOperationKeyReader implements OperationKeyReader {\n constructor(\n private publicClient: PublicClient,\n private contracts: OperationKeyContracts,\n ) {}\n\n /**\n * One multicall, `allowFailure: false`, so every key in the set is read at\n * the same block. A rotation landing between two separate `eth_call`s would\n * otherwise produce a mixed-epoch key set and a lock no counterparty agrees\n * with.\n */\n private async readAll<T>(\n calls: Call[],\n keeperCount: number,\n challengerCount: number,\n label: string,\n blockNumber?: bigint,\n ) {\n const results = (await this.publicClient.multicall({\n contracts: calls,\n allowFailure: false,\n blockNumber,\n })) as readonly T[];\n\n assertMulticallLength(\n results.length,\n 1 + keeperCount + challengerCount,\n label,\n );\n\n return partition(results, keeperCount);\n }\n\n async getCurrentOperationKeys(\n query: OperationKeyQuery,\n blockNumber?: bigint,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.vaultProviderEthAddress],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [query.applicationEntryPoint, keeper.ethAddress],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getCurrentOperationBtcKey\",\n args: [challenger.ethAddress],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getCurrentOperationKeys\",\n blockNumber,\n );\n }\n\n async getOperationKeysAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawOperationKeys> {\n const calls: Call[] = [\n // The VP takes the plain `AtEpoch` variant: it has no membership\n // version, so its genesis (the registration key at version 0) is\n // unambiguous and the contract resolves it internally.\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n // Keepers and challengers take `...OrGenesis` with their roster key\n // passed explicitly, because the correct genesis for them is their key\n // in *this vault's frozen membership version*. An operator dropped from\n // the current roster, or listed under a different key in an older\n // version, would otherwise resolve against the wrong genesis.\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n keeper.btcPubKey,\n ],\n })),\n ...query.universalChallengers.map((challenger) => ({\n address: this.contracts.protocolParams,\n abi: ProtocolParamsABI as Abi,\n functionName: \"getOperationBtcKeyAtEpochOrGenesis\",\n args: [challenger.ethAddress, epochs.ucKeyEpoch, challenger.btcPubKey],\n })),\n ];\n\n return this.readAll<Hex>(\n calls,\n query.vaultKeepers.length,\n query.universalChallengers.length,\n \"getOperationKeysAtEpochs\",\n );\n }\n\n async getPayoutScriptsAtEpochs(\n query: OperationKeyQuery,\n epochs: KeyEpochs,\n ): Promise<RawPayoutScripts> {\n // Universal challengers are never claimers, so they have no payout script\n // and no call here.\n const results = (await this.publicClient.multicall({\n contracts: [\n {\n address: this.contracts.btcVaultRegistry,\n abi: BTCVaultRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [query.vaultProviderEthAddress, epochs.vpKeyEpoch],\n },\n ...query.vaultKeepers.map((keeper) => ({\n address: this.contracts.applicationRegistry,\n abi: ApplicationRegistryABI as Abi,\n functionName: \"getPayoutScriptAtEpoch\",\n args: [\n query.applicationEntryPoint,\n keeper.ethAddress,\n epochs.appKeeperKeyEpoch,\n ],\n })),\n ],\n allowFailure: false,\n })) as readonly Hex[];\n\n // Expected length is `1 + keepers`, with no challenger term — see the\n // comment above on why universal challengers have no call here.\n assertMulticallLength(\n results.length,\n 1 + query.vaultKeepers.length,\n \"getPayoutScriptsAtEpochs\",\n );\n\n return {\n vaultProvider: results[0],\n vaultKeepers: [...results.slice(1)],\n };\n }\n}\n","/**\n * Concrete signer-set readers for vault keepers and universal challengers.\n *\n * These are optional utilities — callers can use their own implementations\n * of the VaultKeeperReader and UniversalChallengerReader interfaces.\n */\n\nimport type { Address, Hex, PublicClient } from \"viem\";\n\nimport { ApplicationRegistryABI } from \"../../contracts/abis/ApplicationRegistry.abi\";\nimport { ProtocolParamsABI } from \"../../contracts/abis/ProtocolParams.abi\";\nimport type {\n AddressBTCKeyPair,\n UniversalChallengerReader,\n VaultKeeperReader,\n} from \"./types\";\n\n/** Map viem tuple array to AddressBTCKeyPair[]. */\nfunction mapKeyPairs(\n result: readonly { ethAddress: Address; btcPubKey: Hex }[],\n): AddressBTCKeyPair[] {\n return result.map((pair) => ({\n ethAddress: pair.ethAddress,\n btcPubKey: pair.btcPubKey,\n }));\n}\n\n/**\n * Both key-epoch getters return `uint64` and feed the peg-in config\n * fingerprint, where the contract encodes them as `uint64`. A `Number`\n * narrowing would silently truncate above 2^53 and produce a fingerprint the\n * registry cannot reproduce, so the payload is asserted to be a `bigint` and\n * carried as one — never coerced, never defaulted.\n */\nfunction assertKeyEpoch(raw: unknown, label: string): bigint {\n if (typeof raw !== \"bigint\") {\n throw new Error(\n `Invalid ${label} from contract: must be a bigint, got ${typeof raw}`,\n );\n }\n return raw;\n}\n\n/**\n * Reads vault keepers from the ApplicationRegistry contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemVaultKeeperReader(publicClient, applicationRegistryAddress);\n * const keepers = await reader.getCurrentVaultKeepers(appEntryPoint);\n * ```\n */\nexport class ViemVaultKeeperReader implements VaultKeeperReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getVaultKeepersByVersion(\n appEntryPoint: Address,\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getVaultKeepersByVersion\",\n args: [appEntryPoint, version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepers(\n appEntryPoint: Address,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepers\",\n args: [appEntryPoint],\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentVaultKeepersVersion(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"getCurrentVaultKeepersVersion\",\n args: [appEntryPoint],\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentAppKeeperKeyEpoch(\n appEntryPoint: Address,\n blockNumber?: bigint,\n ): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ApplicationRegistryABI,\n functionName: \"appKeeperKeyEpochCurrent\",\n args: [appEntryPoint],\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"appKeeperKeyEpochCurrent\");\n }\n}\n\n/**\n * Reads universal challengers from the ProtocolParams contract.\n *\n * Usage:\n * ```ts\n * const reader = new ViemUniversalChallengerReader(publicClient, protocolParamsAddress);\n * const challengers = await reader.getCurrentUniversalChallengers();\n * ```\n */\nexport class ViemUniversalChallengerReader implements UniversalChallengerReader {\n constructor(\n private publicClient: PublicClient,\n private contractAddress: Address,\n ) {}\n\n async getUniversalChallengersByVersion(\n version: number,\n blockNumber?: bigint,\n ): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getUniversalChallengersByVersion\",\n args: [version],\n blockNumber,\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getCurrentUniversalChallengers(): Promise<AddressBTCKeyPair[]> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"getCurrentUniversalChallengers\",\n })) as readonly { ethAddress: Address; btcPubKey: Hex }[];\n\n return mapKeyPairs(result);\n }\n\n async getLatestUniversalChallengersVersion(\n blockNumber?: bigint,\n ): Promise<number> {\n const result = (await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"latestUniversalChallengersVersion\",\n blockNumber,\n })) as number;\n\n return result;\n }\n\n async getCurrentUcKeyEpoch(blockNumber?: bigint): Promise<bigint> {\n const raw: unknown = await this.publicClient.readContract({\n address: this.contractAddress,\n abi: ProtocolParamsABI,\n functionName: \"ucKeyEpochCurrent\",\n blockNumber,\n });\n\n return assertKeyEpoch(raw, \"ucKeyEpochCurrent\");\n }\n}\n"],"names":["resolveProtocolAddresses","publicClient","btcVaultRegistryAddress","protocolParams","applicationRegistry","BTCVaultRegistryABI","assertMulticallLength","actual","expected","label","partition","results","keeperCount","ViemOperationKeyReader","contracts","calls","challengerCount","blockNumber","query","keeper","ApplicationRegistryABI","challenger","ProtocolParamsABI","epochs","mapKeyPairs","result","pair","assertKeyEpoch","raw","ViemVaultKeeperReader","contractAddress","appEntryPoint","version","ViemUniversalChallengerReader"],"mappings":";;;AA8BA,eAAsBA,EACpBC,GACAC,GAC4B;AAC5B,QAAM,CAACC,GAAgBC,CAAmB,IAAI,MAAMH,EAAa,UAAU;AAAA,IACzE,WAAW;AAAA,MACT;AAAA,QACE,SAASC;AAAA,QACT,KAAKG;AAAA,QACL,cAAc;AAAA,MAAA;AAAA,MAEhB;AAAA,QACE,SAASH;AAAA,QACT,KAAKG;AAAA,QACL,cAAc;AAAA,MAAA;AAAA,IAChB;AAAA,IAEF,cAAc;AAAA,EAAA,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;AAAA,EAC3B;AAAA,EAEA,MAAM,qCACJR,GACiB;AAQjB,WAPgB,MAAM,KAAK,aAAa,aAAa;AAAA,MACnD,SAAS,KAAK;AAAA,MACd,KAAKK;AAAA,MACL,cAAc;AAAA,MACd,aAAAL;AAAA,IAAA,CACD;AAAA,EAGH;AAAA,EAEA,MAAM,qBAAqBA,GAAuC;AAChE,UAAMW,IAAe,MAAM,KAAK,aAAa,aAAa;AAAA,MACxD,SAAS,KAAK;AAAA,MACd,KAAKN;AAAA,MACL,cAAc;AAAA,MACd,aAAAL;AAAA,IAAA,CACD;AAED,WAAOU,EAAeC,GAAK,mBAAmB;AAAA,EAChD;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../registration-records-DFQgBaYi.cjs"),a=require("../../../../signer-set-reader-DFAu6I-v.cjs"),r=require("../../../../pegin-registration-client-C-abxMWq.cjs"),i=require("../../../../types-Bda75Od0.cjs"),t=require("../../../../secp256k1-DDHQ1_za.cjs");exports.RegistrationLogsUnavailableError=e.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=e.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=e.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=e.assertRegisteredPayoutScriptBounds;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.derivePeginVaultId=e.derivePeginVaultId;exports.findRegistrationRecord=e.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=e.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=e.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=e.registrationPrePeginTxHash;exports.validateOffchainParams=e.validateOffchainParams;exports.validatePegInConfiguration=e.validatePegInConfiguration;exports.validateTBVProtocolParams=e.validateTBVProtocolParams;exports.ViemOperationKeyReader=a.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=a.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=a.ViemVaultKeeperReader;exports.resolveProtocolAddresses=a.resolveProtocolAddresses;exports.ViemPeginRegistrationClient=r.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=r.ViemVaultRegistryReader;exports.OnChainBtcVaultStatus=i.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=i.ViemProtocolParamsReader;exports.assertValidVaultCoreVersion=t.assertValidVaultCoreVersion;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../registration-records-DFQgBaYi.cjs"),a=require("../../../../signer-set-reader-D-CyIYR5.cjs"),r=require("../../../../pegin-registration-client-BogzOk8B.cjs"),i=require("../../../../types-Bda75Od0.cjs"),t=require("../../../../secp256k1-DDHQ1_za.cjs");exports.RegistrationLogsUnavailableError=e.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=e.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=e.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=e.assertRegisteredPayoutScriptBounds;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.derivePeginVaultId=e.derivePeginVaultId;exports.findRegistrationRecord=e.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=e.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=e.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=e.registrationPrePeginTxHash;exports.validateOffchainParams=e.validateOffchainParams;exports.validatePegInConfiguration=e.validatePegInConfiguration;exports.validateTBVProtocolParams=e.validateTBVProtocolParams;exports.ViemOperationKeyReader=a.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=a.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=a.ViemVaultKeeperReader;exports.resolveProtocolAddresses=a.resolveProtocolAddresses;exports.ViemPeginRegistrationClient=r.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=r.ViemVaultRegistryReader;exports.OnChainBtcVaultStatus=i.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=i.ViemProtocolParamsReader;exports.assertValidVaultCoreVersion=t.assertValidVaultCoreVersion;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
1
  import { R as r, V as s, a as t, f as i, h as o, d as l, g as n, e as d, i as V, r as g, v as m, b as u, c as P } from "../../../../registration-records-CKLAv3gw.js";
2
- import { V as c, a as f, b as v, r as p } from "../../../../signer-set-reader-BCtmSKUM.js";
3
- import { V as b, a as h } from "../../../../pegin-registration-client-kdz4fT5_.js";
2
+ import { V as c, a as f, b as v, r as p } from "../../../../signer-set-reader-DFF9MgQN.js";
3
+ import { V as b, a as h } from "../../../../pegin-registration-client-DvyrUNku.js";
4
4
  import { O as B, V as y } from "../../../../types-C5jj3Cc-.js";
5
5
  import { a as E } from "../../../../secp256k1-BuxBFUHm.js";
6
6
  export {
@@ -59,6 +59,14 @@ export interface VaultProtocolInfo {
59
59
  depositorPopSignature: Hex;
60
60
  prePeginTxHash: Hex;
61
61
  vaultProviderCommissionBps: number;
62
+ /**
63
+ * Last ETH block (inclusive) at which `claimExpiredVault` is accepted for
64
+ * this vault. Frozen when the vault is reported expired, as that block plus
65
+ * `expiredPegInGraceBlocks`; zero until then. Only meaningful for a vault
66
+ * that expired after reaching Verified (`verifiedAt > 0`) — the contract
67
+ * rejects the claim for any other.
68
+ */
69
+ claimExpiredUntil: bigint;
62
70
  /** Vault core version (uint16) stamped at registration. VP-side gating only — see #1690. */
63
71
  vaultCoreVersion: number;
64
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/eth/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAMzC,OAAO,CAAC,MAAM,qBAAqB,EAAE,OAAO,MAAM,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IACtC,QAAQ,CA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AO,EAAE,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAW9D,oBAAoB,CACxB,QAAQ,EAAE,SAAS,GAAG,EAAE,GACvB,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAiC/B;;;OAGG;IACG,WAAW,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAS1D;;;;;;OAMG;IACG,0BAA0B,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBnE,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC;IAqCpD,kBAAkB;IACZ,6BAA6B,CACjC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAiDrC;;;;;;;;;;;;OAYG;IACG,kCAAkC,CACtC,QAAQ,EAAE,SAAS,GAAG,EAAE,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,EAAE,CAAC;IAWpB,kBAAkB;IACZ,mBAAmB,CACvB,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,qBAAqB,CAAC;CAkFlC"}
1
+ {"version":3,"file":"vault-registry-reader.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/eth/vault-registry-reader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAO,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAU5D,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AA2NjB;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAE/D,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,eAAe;gBADf,YAAY,EAAE,YAAY,EAC1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AAM,GAChB,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAiDrC;;;;;;;;;;;;OAYG;IACG,kCAAkC,CACtC,QAAQ,EAAE,SAAS,GAAG,EAAE,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,EAAE,CAAC;IAWpB,kBAAkB;IACZ,mBAAmB,CACvB,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,qBAAqB,CAAC;CAkFlC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./mempool/index.cjs"),e=require("../../../registration-records-DFQgBaYi.cjs"),a=require("../../../signer-set-reader-DFAu6I-v.cjs"),s=require("../../../pegin-registration-client-C-abxMWq.cjs"),n=require("../../../types-Bda75Od0.cjs"),l=require("../../../secp256k1-DDHQ1_za.cjs"),o=require("../../../index-DpjYs5yr.cjs"),t=require("../../../state-C4WoNCy1.cjs"),i=require("../../../primeVpAuth-BPj2TPdD.cjs");exports.MEMPOOL_API_URLS=r.MEMPOOL_API_URLS;exports.MempoolNotFoundError=r.MempoolNotFoundError;exports.getAddressTxs=r.getAddressTxs;exports.getAddressUtxos=r.getAddressUtxos;exports.getMempoolApiUrl=r.getMempoolApiUrl;exports.getNetworkFees=r.getNetworkFees;exports.getOutspend=r.getOutspend;exports.getTipHeight=r.getTipHeight;exports.getTxHex=r.getTxHex;exports.getTxInfo=r.getTxInfo;exports.getUtxoInfo=r.getUtxoInfo;exports.pushTx=r.pushTx;exports.RegistrationLogsUnavailableError=e.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=e.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=e.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=e.assertRegisteredPayoutScriptBounds;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.derivePeginVaultId=e.derivePeginVaultId;exports.findRegistrationRecord=e.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=e.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=e.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=e.registrationPrePeginTxHash;exports.validateOffchainParams=e.validateOffchainParams;exports.validatePegInConfiguration=e.validatePegInConfiguration;exports.validateTBVProtocolParams=e.validateTBVProtocolParams;exports.ViemOperationKeyReader=a.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=a.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=a.ViemVaultKeeperReader;exports.resolveProtocolAddresses=a.resolveProtocolAddresses;exports.ViemPeginRegistrationClient=s.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=s.ViemVaultRegistryReader;exports.OnChainBtcVaultStatus=n.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=n.ViemProtocolParamsReader;exports.assertValidVaultCoreVersion=l.assertValidVaultCoreVersion;exports.VaultProviderRpcClient=o.VaultProviderRpcClient;exports.VpResponseValidationError=o.VpResponseValidationError;exports.batchPollByProvider=o.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=o.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=o.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=t.AUTH_REJECTED_RPC_CODE;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;exports.isAuthRejectedError=t.isAuthRejectedError;exports.ServerIdentityError=i.ServerIdentityError;exports.VpTokenRegistry=i.VpTokenRegistry;exports.createAuthenticatedVpClient=i.createAuthenticatedVpClient;exports.primeVpTokenRegistry=i.primeVpTokenRegistry;exports.verifyServerIdentity=i.verifyServerIdentity;exports.vpTokenRegistry=i.vpTokenRegistry;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./mempool/index.cjs"),e=require("../../../registration-records-DFQgBaYi.cjs"),a=require("../../../signer-set-reader-D-CyIYR5.cjs"),s=require("../../../pegin-registration-client-BogzOk8B.cjs"),n=require("../../../types-Bda75Od0.cjs"),l=require("../../../secp256k1-DDHQ1_za.cjs"),o=require("../../../index-DpjYs5yr.cjs"),t=require("../../../state-C4WoNCy1.cjs"),i=require("../../../primeVpAuth-BPj2TPdD.cjs");exports.MEMPOOL_API_URLS=r.MEMPOOL_API_URLS;exports.MempoolNotFoundError=r.MempoolNotFoundError;exports.getAddressTxs=r.getAddressTxs;exports.getAddressUtxos=r.getAddressUtxos;exports.getMempoolApiUrl=r.getMempoolApiUrl;exports.getNetworkFees=r.getNetworkFees;exports.getOutspend=r.getOutspend;exports.getTipHeight=r.getTipHeight;exports.getTxHex=r.getTxHex;exports.getTxInfo=r.getTxInfo;exports.getUtxoInfo=r.getUtxoInfo;exports.pushTx=r.pushTx;exports.RegistrationLogsUnavailableError=e.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=e.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=e.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=e.assertRegisteredPayoutScriptBounds;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.derivePeginVaultId=e.derivePeginVaultId;exports.findRegistrationRecord=e.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=e.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=e.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=e.registrationPrePeginTxHash;exports.validateOffchainParams=e.validateOffchainParams;exports.validatePegInConfiguration=e.validatePegInConfiguration;exports.validateTBVProtocolParams=e.validateTBVProtocolParams;exports.ViemOperationKeyReader=a.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=a.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=a.ViemVaultKeeperReader;exports.resolveProtocolAddresses=a.resolveProtocolAddresses;exports.ViemPeginRegistrationClient=s.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=s.ViemVaultRegistryReader;exports.OnChainBtcVaultStatus=n.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=n.ViemProtocolParamsReader;exports.assertValidVaultCoreVersion=l.assertValidVaultCoreVersion;exports.VaultProviderRpcClient=o.VaultProviderRpcClient;exports.VpResponseValidationError=o.VpResponseValidationError;exports.batchPollByProvider=o.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=o.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=o.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=t.AUTH_REJECTED_RPC_CODE;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;exports.isAuthRejectedError=t.isAuthRejectedError;exports.ServerIdentityError=i.ServerIdentityError;exports.VpTokenRegistry=i.VpTokenRegistry;exports.createAuthenticatedVpClient=i.createAuthenticatedVpClient;exports.primeVpTokenRegistry=i.primeVpTokenRegistry;exports.verifyServerIdentity=i.verifyServerIdentity;exports.vpTokenRegistry=i.vpTokenRegistry;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  import { MEMPOOL_API_URLS as r, MempoolNotFoundError as s, getAddressTxs as t, getAddressUtxos as o, getMempoolApiUrl as i, getNetworkFees as n, getOutspend as l, getTipHeight as R, getTxHex as d, getTxInfo as p, getUtxoInfo as V, pushTx as g } from "./mempool/index.js";
2
2
  import { R as T, V as S, a as P, f as m, h as c, d as u, g as _, e as A, i as C, r as f, v, b as x, c as O } from "../../../registration-records-CKLAv3gw.js";
3
- import { V as y, a as I, b as h, r as b } from "../../../signer-set-reader-BCtmSKUM.js";
4
- import { V as N, a as D } from "../../../pegin-registration-client-kdz4fT5_.js";
3
+ import { V as y, a as I, b as h, r as b } from "../../../signer-set-reader-DFF9MgQN.js";
4
+ import { V as N, a as D } from "../../../pegin-registration-client-DvyrUNku.js";
5
5
  import { O as L, V as M } from "../../../types-C5jj3Cc-.js";
6
6
  import { a as F } from "../../../secp256k1-BuxBFUHm.js";
7
7
  import { V as K, a as j, b as q, i as w, v as z } from "../../../index-CVBtBjQ5.js";
@@ -230,6 +230,20 @@ export declare const BTCVaultRegistryABI: readonly [{
230
230
  }];
231
231
  readonly outputs: readonly [];
232
232
  readonly stateMutability: "nonpayable";
233
+ }, {
234
+ readonly type: "function";
235
+ readonly name: "claimExpiredVault";
236
+ readonly inputs: readonly [{
237
+ readonly name: "vaultId";
238
+ readonly type: "bytes32";
239
+ readonly internalType: "bytes32";
240
+ }, {
241
+ readonly name: "s";
242
+ readonly type: "bytes32";
243
+ readonly internalType: "bytes32";
244
+ }];
245
+ readonly outputs: readonly [];
246
+ readonly stateMutability: "nonpayable";
233
247
  }, {
234
248
  readonly type: "function";
235
249
  readonly name: "getPegInFee";
@@ -1 +1 @@
1
- {"version":3,"file":"BTCVaultRegistry.abi.d.ts","sourceRoot":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAu+BtB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../ApplicationRegistry.abi-sMiTWmnL.cjs"),e=require("../../../BTCVaultRegistry.abi-DffWFdpA.cjs"),r=require("../../../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),o=require("../../../ProtocolParams.abi-CjrT0545.cjs"),i=require("../../../VaultErrors.abi-DQ18kM0L.cjs");exports.ApplicationRegistryABI=t.ApplicationRegistryABI;exports.BTCVaultRegistryABI=e.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=r.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=r.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=r.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=r.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=r.PeginFingerprintChangedError;exports.extractErrorData=r.extractErrorData;exports.getContractErrorMessage=r.getContractErrorMessage;exports.handleContractError=r.handleContractError;exports.isKnownContractError=r.isKnownContractError;exports.isPeginFingerprintChangedError=r.isPeginFingerprintChangedError;exports.ProtocolParamsABI=o.ProtocolParamsABI;exports.VAULT_ERROR_ABI=i.VAULT_ERROR_ABI;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../ApplicationRegistry.abi-sMiTWmnL.cjs"),e=require("../../../BTCVaultRegistry.abi-BH2-LHxN.cjs"),r=require("../../../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),o=require("../../../ProtocolParams.abi-CjrT0545.cjs"),i=require("../../../VaultErrors.abi-DQ18kM0L.cjs");exports.ApplicationRegistryABI=t.ApplicationRegistryABI;exports.BTCVaultRegistryABI=e.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=r.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=r.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=r.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=r.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=r.PeginFingerprintChangedError;exports.extractErrorData=r.extractErrorData;exports.getContractErrorMessage=r.getContractErrorMessage;exports.handleContractError=r.handleContractError;exports.isKnownContractError=r.isKnownContractError;exports.isPeginFingerprintChangedError=r.isPeginFingerprintChangedError;exports.ProtocolParamsABI=o.ProtocolParamsABI;exports.VAULT_ERROR_ABI=i.VAULT_ERROR_ABI;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
1
  import { A as o } from "../../../ApplicationRegistry.abi-s8cQ1ooR.js";
2
- import { B as s } from "../../../BTCVaultRegistry.abi-BmHpMUWD.js";
2
+ import { B as s } from "../../../BTCVaultRegistry.abi-BzNTa_EU.js";
3
3
  import { B as E, C as n, E as R, P as i, a as g, e as C, g as A, h as p, i as B, b as P } from "../../../BTCVaultRegistryKeyEpochs.abi-Btg0nBz1.js";
4
4
  import { P as I } from "../../../ProtocolParams.abi-CKOVqFJP.js";
5
5
  import { V as c } from "../../../VaultErrors.abi-Boz4w97c.js";