@babylonlabs-io/ts-sdk 5.1.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PayoutManager-BHeiLQ1j.js → PayoutManager-3-MzBVLj.js} +2 -2
- package/dist/{PayoutManager-BHeiLQ1j.js.map → PayoutManager-3-MzBVLj.js.map} +1 -1
- package/dist/{PayoutManager-B5nR0x1t.cjs → PayoutManager-PQqeqX41.cjs} +2 -2
- package/dist/{PayoutManager-B5nR0x1t.cjs.map → PayoutManager-PQqeqX41.cjs.map} +1 -1
- package/dist/{PeginManager-6ghglb4r.cjs → PeginManager-D_ZUfbIy.cjs} +2 -2
- package/dist/{PeginManager-6ghglb4r.cjs.map → PeginManager-D_ZUfbIy.cjs.map} +1 -1
- package/dist/{PeginManager-CXNqbgA4.js → PeginManager-m3IlM4wS.js} +4 -4
- package/dist/{PeginManager-CXNqbgA4.js.map → PeginManager-m3IlM4wS.js.map} +1 -1
- package/dist/{buildAndBroadcastReclaim-Cf05JFP-.cjs → buildAndBroadcastReclaim-CMjlyooo.cjs} +2 -2
- package/dist/{buildAndBroadcastReclaim-Cf05JFP-.cjs.map → buildAndBroadcastReclaim-CMjlyooo.cjs.map} +1 -1
- package/dist/{buildAndBroadcastReclaim-Acz637Vf.js → buildAndBroadcastReclaim-D8l-QJWo.js} +793 -772
- package/dist/{buildAndBroadcastReclaim-Acz637Vf.js.map → buildAndBroadcastReclaim-D8l-QJWo.js.map} +1 -1
- package/dist/{challengeAssert-CuX_8Twt.cjs → challengeAssert-DlzX_kjF.cjs} +2 -2
- package/dist/{challengeAssert-CuX_8Twt.cjs.map → challengeAssert-DlzX_kjF.cjs.map} +1 -1
- package/dist/{challengeAssert-D_lRvsO0.js → challengeAssert-hpOHGPXX.js} +2 -2
- package/dist/{challengeAssert-D_lRvsO0.js.map → challengeAssert-hpOHGPXX.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +312 -309
- package/dist/index.js.map +1 -1
- package/dist/peginState-B4t_PDgj.cjs.map +1 -1
- package/dist/peginState-CXdbSit3.js.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +306 -303
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.d.ts +5 -0
- package/dist/tbv/core/primitives/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.js +31 -29
- package/dist/tbv/core/primitives/index.js.map +1 -1
- package/dist/tbv/core/primitives/psbt/__tests__/signetPeginHashlockSpend.fixture.d.ts +19 -0
- package/dist/tbv/core/primitives/psbt/__tests__/signetPeginHashlockSpend.fixture.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/__tests__/verifyPeginHashlockSpend.test.d.ts +9 -0
- package/dist/tbv/core/primitives/psbt/__tests__/verifyPeginHashlockSpend.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/verifyPeginHashlockSpend.d.ts +73 -0
- package/dist/tbv/core/primitives/psbt/verifyPeginHashlockSpend.d.ts.map +1 -0
- package/dist/tbv/core/recovery/reconstructPeginParams.d.ts +6 -0
- package/dist/tbv/core/recovery/reconstructPeginParams.d.ts.map +1 -1
- package/dist/tbv/core/recovery/toRefundInputs.d.ts +0 -2
- package/dist/tbv/core/recovery/toRefundInputs.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts +16 -5
- package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +74 -73
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +6 -2
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
- package/dist/tbv/core/services/refund/errors.d.ts +15 -0
- package/dist/tbv/core/services/refund/errors.d.ts.map +1 -1
- package/dist/tbv/core/services/refund/index.d.ts +1 -1
- package/dist/tbv/core/services/refund/index.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +306 -303
- package/dist/tbv/index.js.map +1 -1
- package/dist/{toRefundInputs-DwXpKQxN.js → toRefundInputs-D5tx3eeA.js} +152 -152
- package/dist/{toRefundInputs-DwXpKQxN.js.map → toRefundInputs-D5tx3eeA.js.map} +1 -1
- package/dist/{toRefundInputs-BzyN0zvj.cjs → toRefundInputs-Df6eRITl.cjs} +2 -2
- package/dist/{toRefundInputs-BzyN0zvj.cjs.map → toRefundInputs-Df6eRITl.cjs.map} +1 -1
- package/dist/{verifyKeyPathSchnorrSignature-BVrAmVL3.cjs → verifyKeyPathSchnorrSignature-B7Za6aa1.cjs} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-BVrAmVL3.cjs.map → verifyKeyPathSchnorrSignature-B7Za6aa1.cjs.map} +1 -1
- package/dist/{verifyKeyPathSchnorrSignature-CIE3jlVt.js → verifyKeyPathSchnorrSignature-dw7xhm5Y.js} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-CIE3jlVt.js.map → verifyKeyPathSchnorrSignature-dw7xhm5Y.js.map} +1 -1
- package/dist/verifyPeginHashlockSpend-CdTFR2K6.js +167 -0
- package/dist/verifyPeginHashlockSpend-CdTFR2K6.js.map +1 -0
- package/dist/verifyPeginHashlockSpend-CisfqMuT.cjs +2 -0
- package/dist/verifyPeginHashlockSpend-CisfqMuT.cjs.map +1 -0
- package/dist/{verifyScriptPathSchnorrSignature-DLNGgm4j.js → verifyScriptPathSchnorrSignature-BVGPEZXW.js} +9 -8
- package/dist/{verifyScriptPathSchnorrSignature-DLNGgm4j.js.map → verifyScriptPathSchnorrSignature-BVGPEZXW.js.map} +1 -1
- package/dist/{verifyScriptPathSchnorrSignature-BHskbJJx.cjs → verifyScriptPathSchnorrSignature-p3sVoWQi.cjs} +2 -2
- package/dist/{verifyScriptPathSchnorrSignature-BHskbJJx.cjs.map → verifyScriptPathSchnorrSignature-p3sVoWQi.cjs.map} +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peginState-B4t_PDgj.cjs","sources":["../src/tbv/core/services/deposit/peginState.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-8). The contract enum (BTCVaultRegistry.sol BTCVaultStatus) only\n * has: Pending(0), Verified(1), Active(2), Redeemed(3), Expired(4).\n * The indexer maps these and adds extra statuses for UI display.\n *\n * IMPORTANT: With the new contract architecture:\n * - Core vault status (BTCVaultRegistry) does NOT change when used by applications\n * - Vaults remain at ACTIVE status even when used in DeFi positions\n * - Application usage status is tracked separately by each integration controller\n */\nexport enum ContractStatus {\n /** Status 0: Request submitted, waiting for ACKs */\n PENDING = 0,\n /** Status 1: All ACKs collected, ready for secret activation */\n VERIFIED = 1,\n /** Status 2: HTLC secret revealed, vault is active and usable (stays here even when used by apps) */\n ACTIVE = 2,\n /** Status 3: Vault has been redeemed, BTC is claimable */\n REDEEMED = 3,\n /** Status 4 (indexer-only): Vault was liquidated (collateral seized due to unpaid debt) */\n LIQUIDATED = 4,\n /** Status 5 (indexer-only): Vault is invalid — BTC UTXOs were spent in a different transaction */\n INVALID = 5,\n /** Status 6 (indexer-only): Depositor has withdrawn their BTC (redemption complete) */\n DEPOSITOR_WITHDRAWN = 6,\n /** Status 7 (indexer-only): Vault expired due to AckTimeout or ActivationTimeout */\n EXPIRED = 7,\n /**\n * Status 8 (indexer-only): a redeemed vault's BTC was spent on Bitcoin to a\n * script other than the depositor's payout script, in practice a vault\n * keeper's claim that no challenger blocked. The vault's BTC is gone; only\n * the depositor's PegIn output 1 reserve may remain.\n */\n NON_DEPOSITOR_SPEND = 8,\n}\n\n/** Reason why a vault expired */\nexport type ExpirationReason =\n | \"ack_timeout\"\n | \"proof_timeout\"\n | \"activation_timeout\";\n\n// ============================================================================\n// Protocol State Model\n// ============================================================================\n\n/**\n * Available actions user can take\n */\nexport enum PeginAction {\n /** Submit WOTS key (re-derives via wallet `deriveContextHash`) */\n SUBMIT_WOTS_KEY = \"SUBMIT_WOTS_KEY\",\n /** Sign payout transactions */\n SIGN_PAYOUT_TRANSACTIONS = \"SIGN_PAYOUT_TRANSACTIONS\",\n /** Sign and broadcast peg-in transaction to Bitcoin */\n SIGN_AND_BROADCAST_TO_BITCOIN = \"SIGN_AND_BROADCAST_TO_BITCOIN\",\n /** Reveal HTLC secret on Ethereum to activate vault */\n ACTIVATE_VAULT = \"ACTIVATE_VAULT\",\n /**\n * Escape hatch: reveal the HTLC secret and immediately redeem the vault for\n * the depositor (`activateVaultWithSecretAndRedeem`), skipping application\n * activation. Recovery path when the peg-in was swept on Bitcoin but the\n * vault could not be activated (application paused / activation revert).\n */\n ACTIVATE_AND_REDEEM = \"ACTIVATE_AND_REDEEM\",\n /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\n /**\n * Reveal the HTLC secret for a vault that expired after reaching Verified\n * (`claimExpiredVault`), so the BTC the PegIn swept into the vault is\n * claimed out to the keys recorded on chain. The only exit once the PegIn\n * has spent the HTLC; the contract accepts it until the vault's\n * `claimExpiredUntil` block.\n */\n CLAIM_EXPIRED_VAULT = \"CLAIM_EXPIRED_VAULT\",\n}\n\n/**\n * Protocol-level peg-in state (framework-agnostic)\n */\nexport interface PeginProtocolState {\n /** Smart contract status (source of truth for on-chain state) */\n contractStatus: ContractStatus;\n /** Available user actions (empty array when no action is available) */\n availableActions: PeginAction[];\n}\n\n/**\n * Options for getPeginProtocolState function.\n *\n * All fields represent protocol-level state from the vault provider or\n * on-chain contracts. Client-side tracking (localStorage, polling state)\n * is NOT included — consumers handle that in their own layer.\n */\nexport interface GetPeginProtocolStateOptions {\n /** Whether claim/payout transactions are ready from VP */\n transactionsReady?: boolean;\n /** Whether the vault provider is waiting for the depositor's WOTS public key */\n needsWotsKey?: boolean;\n /** Whether the vault provider hasn't ingested this peg-in yet */\n pendingIngestion?: boolean;\n /** Whether the depositor can refund the HTLC (Pre-PegIn tx available) */\n canRefund?: boolean;\n /** Whether the vault provider reported a terminal failure */\n hasProviderTerminalFailure?: boolean;\n /**\n * VERIFIED only: the Pre-PegIn HTLC outpoint has been spent on Bitcoin BY\n * THE PEGIN TRANSACTION while the vault is still Verified on Ethereum. The\n * secret was revealed (e.g. in the calldata of a reverted activation) and\n * the peg-in swept without the vault activating, so the normal activation\n * no longer returns value to the depositor and the CSV refund can never\n * broadcast. The remaining recovery is the activate-and-redeem escape\n * hatch.\n *\n * The caller MUST prove the spender by comparing the outspend's\n * `spendingTxid` against the vault's PegIn txid before setting this. A\n * bare \"spent\" observation is not sufficient: the spend may be the\n * depositor's own CSV refund, and offering the secret-revealing hatch\n * against a refund burns the secret for a vault whose funds already\n * returned.\n */\n htlcSpentByPeginTx?: boolean;\n /**\n * EXPIRED only: the vault expired after reaching Verified, the PegIn\n * transaction has spent the Pre-PegIn HTLC, and the claim window has not\n * elapsed. The CSV refund is gone, so the claim is the remaining exit.\n *\n * The same spender proof as `htlcSpentByPeginTx` applies: offering the claim\n * while the HTLC is unspent reveals the secret and lets anyone broadcast the\n * PegIn ahead of the depositor's refund. When set, it takes precedence over\n * `canRefund`, which a proven PegIn spend makes impossible.\n */\n canClaimExpired?: boolean;\n}\n\n// ============================================================================\n// State Machine Logic\n// ============================================================================\n\n/**\n * Determine the current protocol state and available actions based on contract\n * status and vault provider state. Framework-agnostic: returns only\n * protocol-level data with no display labels, messages, or UI concerns.\n *\n * Client-side tracking overrides (e.g. suppressing actions after the user\n * has already acted but on-chain state hasn't caught up) are the caller's\n * responsibility.\n *\n * @param contractStatus - On-chain contract status (source of truth)\n * @param options - Vault provider state\n * @returns Protocol state with available actions\n */\nexport function getPeginProtocolState(\n contractStatus: ContractStatus,\n options: GetPeginProtocolStateOptions = {},\n): PeginProtocolState {\n const {\n transactionsReady,\n needsWotsKey,\n pendingIngestion,\n canRefund,\n hasProviderTerminalFailure,\n htlcSpentByPeginTx,\n canClaimExpired,\n } = options;\n\n if (contractStatus === ContractStatus.PENDING) {\n if (hasProviderTerminalFailure) {\n return { contractStatus, availableActions: [] };\n }\n\n if (needsWotsKey) {\n return {\n contractStatus,\n availableActions: [PeginAction.SUBMIT_WOTS_KEY],\n };\n }\n\n if (pendingIngestion === true && !transactionsReady) {\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_AND_BROADCAST_TO_BITCOIN],\n };\n }\n\n if (pendingIngestion === undefined && !transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n if (!transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_PAYOUT_TRANSACTIONS],\n };\n }\n\n if (contractStatus === ContractStatus.VERIFIED) {\n // A spent HTLC while still Verified means the peg-in was swept without\n // activation: activating normally would hand the collateral to an\n // application flow that already failed once, and refunding is impossible\n // (the outpoint is gone). Surface only the escape hatch.\n if (htlcSpentByPeginTx) {\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_AND_REDEEM],\n };\n }\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_VAULT],\n };\n }\n\n if (contractStatus === ContractStatus.ACTIVE) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.REDEEMED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.LIQUIDATED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.EXPIRED) {\n if (canClaimExpired) {\n return {\n contractStatus,\n availableActions: [PeginAction.CLAIM_EXPIRED_VAULT],\n };\n }\n return {\n contractStatus,\n availableActions: canRefund ? [PeginAction.REFUND_HTLC] : [],\n };\n }\n\n if (contractStatus === ContractStatus.INVALID) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.DEPOSITOR_WITHDRAWN) {\n return { contractStatus, availableActions: [] };\n }\n\n // Terminal like DEPOSITOR_WITHDRAWN: the vault output is spent. The reserve\n // reclaim is decided by the app from Bitcoin reads, not offered here.\n if (contractStatus === ContractStatus.NON_DEPOSITOR_SPEND) {\n return { contractStatus, availableActions: [] };\n }\n\n return { contractStatus, availableActions: [] };\n}\n\n/**\n * Check if a specific action is available in the current state\n */\nexport function canPerformAction(\n state: PeginProtocolState,\n action: PeginAction,\n): boolean {\n return state.availableActions.includes(action);\n}\n\n// ============================================================================\n// Activation deadline\n// ============================================================================\n\n/**\n * Whether a vault's on-chain activation window has closed. Mirrors the\n * BTCVaultRegistry check that reverts `ActivationDeadlineExpired`:\n * `block.number > createdAt + pegInActivationTimeout` — strict `>`, so a\n * boundary-equal block is NOT expired. All values are Ethereum block numbers.\n */\nexport function isActivationDeadlinePassedOnChain(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): boolean {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n return currentBlock > createdAtBlock + pegInActivationTimeout;\n}\n\n/**\n * Blocks still available for an activation transaction to be mined; `0` once\n * the window has closed.\n *\n * `isActivationDeadlinePassedOnChain` answers whether the window is already\n * shut, which is the right question for a badge but the wrong one for a\n * secret-bearing call. An activation submitted in the last block before the\n * deadline reverts if it lands one block late, and by then `s` is public\n * calldata: the vault expires with `ActivationTimeout`, and the vault\n * provider, which holds the rest of the HTLC signature set, can broadcast the\n * PegIn with that secret. The caller therefore needs the remaining margin,\n * not a boolean.\n *\n * The contract accepts a transaction mined at `block.number <= createdAt +\n * timeout`. `currentBlock` is the chain head, which is already mined, so a new\n * transaction lands at `currentBlock + 1` at the earliest: at\n * `currentBlock === createdAt + timeout` no usable block remains.\n */\nexport function activationDeadlineBlocksRemaining(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): number {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n const lastUsableBlock = createdAtBlock + pegInActivationTimeout;\n if (currentBlock >= lastUsableBlock) return 0;\n return Number(lastUsableBlock - currentBlock);\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","htlcSpentByPeginTx","canClaimExpired","canPerformAction","state","action","isActivationDeadlinePassedOnChain","params","currentBlock","createdAtBlock","pegInActivationTimeout","activationDeadlineBlocksRemaining","lastUsableBlock"],"mappings":"aAeO,IAAKA,GAAAA,IAEVA,EAAAA,EAAA,QAAU,CAAA,EAAV,UAEAA,EAAAA,EAAA,SAAW,CAAA,EAAX,WAEAA,EAAAA,EAAA,OAAS,CAAA,EAAT,SAEAA,EAAAA,EAAA,SAAW,CAAA,EAAX,WAEAA,EAAAA,EAAA,WAAa,CAAA,EAAb,aAEAA,EAAAA,EAAA,QAAU,CAAA,EAAV,UAEAA,EAAAA,EAAA,oBAAsB,CAAA,EAAtB,sBAEAA,EAAAA,EAAA,QAAU,CAAA,EAAV,UAOAA,EAAAA,EAAA,oBAAsB,CAAA,EAAtB,sBAvBUA,IAAAA,GAAA,CAAA,CAAA,EAuCAC,GAAAA,IAEVA,EAAA,gBAAkB,kBAElBA,EAAA,yBAA2B,2BAE3BA,EAAA,8BAAgC,gCAEhCA,EAAA,eAAiB,iBAOjBA,EAAA,oBAAsB,sBAEtBA,EAAA,YAAc,cAQdA,EAAA,oBAAsB,sBAzBZA,IAAAA,GAAA,CAAA,CAAA,EAuGL,SAASC,EACdC,EACAC,EAAwC,GACpB,CACpB,KAAM,CACJ,kBAAAC,EACA,aAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,2BAAAC,EACA,mBAAAC,EACA,gBAAAC,CAAA,EACEP,EAEJ,OAAID,IAAmB,EACjBM,EACK,CAAE,eAAAN,EAAgB,iBAAkB,EAAC,EAG1CG,EACK,CACL,eAAAH,EACA,iBAAkB,CAAC,iBAAA,CAA2B,EAI9CI,IAAqB,IAAQ,CAACF,EACzB,CACL,eAAAF,EACA,iBAAkB,CAAC,+BAAA,CAAyC,EAI5DI,IAAqB,QAAa,CAACF,EAC9B,CAAE,eAAAF,EAAgB,iBAAkB,EAAC,EAGzCE,EAIE,CACL,eAAAF,EACA,iBAAkB,CAAC,0BAAA,CAAoC,EALhD,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAS5CA,IAAmB,EAKjBO,EACK,CACL,eAAAP,EACA,iBAAkB,CAAC,qBAAA,CAA+B,EAG/C,CACL,eAAAA,EACA,iBAAkB,CAAC,gBAAA,CAA0B,EAI7CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACjBQ,EACK,CACL,eAAAR,EACA,iBAAkB,CAAC,qBAAA,CAA+B,EAG/C,CACL,eAAAA,EACA,iBAAkBK,EAAY,CAAC,eAA2B,CAAA,CAAC,EAI3DL,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAK1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAGvC,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,CAC9C,CAKO,SAASS,EACdC,EACAC,EACS,CACT,OAAOD,EAAM,iBAAiB,SAASC,CAAM,CAC/C,CAYO,SAASC,EAAkCC,EAItC,CACV,KAAM,CAAE,aAAAC,EAAc,eAAAC,EAAgB,uBAAAC,CAAA,EAA2BH,EACjE,OAAOC,EAAeC,EAAiBC,CACzC,CAoBO,SAASC,EAAkCJ,EAIvC,CACT,KAAM,CAAE,aAAAC,EAAc,eAAAC,EAAgB,uBAAAC,CAAA,EAA2BH,EAC3DK,EAAkBH,EAAiBC,EACzC,OAAIF,GAAgBI,EAAwB,EACrC,OAAOA,EAAkBJ,CAAY,CAC9C"}
|
|
1
|
+
{"version":3,"file":"peginState-B4t_PDgj.cjs","sources":["../src/tbv/core/services/deposit/peginState.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-8). The contract enum (BTCVaultRegistry.sol BTCVaultStatus) only\n * has: Pending(0), Verified(1), Active(2), Redeemed(3), Expired(4).\n * The indexer maps these and adds extra statuses for UI display.\n *\n * IMPORTANT: With the new contract architecture:\n * - Core vault status (BTCVaultRegistry) does NOT change when used by applications\n * - Vaults remain at ACTIVE status even when used in DeFi positions\n * - Application usage status is tracked separately by each integration controller\n */\nexport enum ContractStatus {\n /** Status 0: Request submitted, waiting for ACKs */\n PENDING = 0,\n /** Status 1: All ACKs collected, ready for secret activation */\n VERIFIED = 1,\n /** Status 2: HTLC secret revealed, vault is active and usable (stays here even when used by apps) */\n ACTIVE = 2,\n /** Status 3: Vault has been redeemed, BTC is claimable */\n REDEEMED = 3,\n /** Status 4 (indexer-only): Vault was liquidated (collateral seized due to unpaid debt) */\n LIQUIDATED = 4,\n /** Status 5 (indexer-only): Vault is invalid — BTC UTXOs were spent in a different transaction */\n INVALID = 5,\n /** Status 6 (indexer-only): Depositor has withdrawn their BTC (redemption complete) */\n DEPOSITOR_WITHDRAWN = 6,\n /** Status 7 (indexer-only): Vault expired due to AckTimeout or ActivationTimeout */\n EXPIRED = 7,\n /**\n * Status 8 (indexer-only): a redeemed vault's BTC was spent on Bitcoin to a\n * script other than the depositor's payout script, in practice a vault\n * keeper's claim that no challenger blocked. The vault's BTC is gone; only\n * the depositor's PegIn output 1 reserve may remain.\n */\n NON_DEPOSITOR_SPEND = 8,\n}\n\n/** Reason why a vault expired */\nexport type ExpirationReason =\n | \"ack_timeout\"\n | \"proof_timeout\"\n | \"activation_timeout\";\n\n// ============================================================================\n// Protocol State Model\n// ============================================================================\n\n/**\n * Available actions user can take\n */\nexport enum PeginAction {\n /** Submit WOTS key (re-derives via wallet `deriveContextHash`) */\n SUBMIT_WOTS_KEY = \"SUBMIT_WOTS_KEY\",\n /** Sign payout transactions */\n SIGN_PAYOUT_TRANSACTIONS = \"SIGN_PAYOUT_TRANSACTIONS\",\n /** Sign and broadcast peg-in transaction to Bitcoin */\n SIGN_AND_BROADCAST_TO_BITCOIN = \"SIGN_AND_BROADCAST_TO_BITCOIN\",\n /** Reveal HTLC secret on Ethereum to activate vault */\n ACTIVATE_VAULT = \"ACTIVATE_VAULT\",\n /**\n * Escape hatch: reveal the HTLC secret and immediately redeem the vault for\n * the depositor (`activateVaultWithSecretAndRedeem`), skipping application\n * activation. Recovery path when the peg-in was swept on Bitcoin but the\n * vault could not be activated (application paused / activation revert).\n */\n ACTIVATE_AND_REDEEM = \"ACTIVATE_AND_REDEEM\",\n /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\n /**\n * Reveal the HTLC secret for a vault that expired after reaching Verified\n * (`claimExpiredVault`), so the BTC the PegIn swept into the vault is\n * claimed out to the keys recorded on chain. The only exit once the PegIn\n * has spent the HTLC; the contract accepts it until the vault's\n * `claimExpiredUntil` block.\n */\n CLAIM_EXPIRED_VAULT = \"CLAIM_EXPIRED_VAULT\",\n}\n\n/**\n * Protocol-level peg-in state (framework-agnostic)\n */\nexport interface PeginProtocolState {\n /** Smart contract status (source of truth for on-chain state) */\n contractStatus: ContractStatus;\n /** Available user actions (empty array when no action is available) */\n availableActions: PeginAction[];\n}\n\n/**\n * Options for getPeginProtocolState function.\n *\n * All fields represent protocol-level state from the vault provider or\n * on-chain contracts. Client-side tracking (localStorage, polling state)\n * is NOT included — consumers handle that in their own layer.\n */\nexport interface GetPeginProtocolStateOptions {\n /** Whether claim/payout transactions are ready from VP */\n transactionsReady?: boolean;\n /** Whether the vault provider is waiting for the depositor's WOTS public key */\n needsWotsKey?: boolean;\n /** Whether the vault provider hasn't ingested this peg-in yet */\n pendingIngestion?: boolean;\n /** Whether the depositor can refund the HTLC (Pre-PegIn tx available) */\n canRefund?: boolean;\n /** Whether the vault provider reported a terminal failure */\n hasProviderTerminalFailure?: boolean;\n /**\n * VERIFIED only: the Pre-PegIn HTLC outpoint has been spent on Bitcoin BY\n * THE PEGIN TRANSACTION while the vault is still Verified on Ethereum. The\n * secret was revealed (e.g. in the calldata of a reverted activation) and\n * the peg-in swept without the vault activating, so the normal activation\n * no longer returns value to the depositor and the CSV refund can never\n * broadcast. The remaining recovery is the activate-and-redeem escape\n * hatch.\n *\n * The caller MUST prove the spender by comparing the outspend's\n * `spendingTxid` against the vault's PegIn txid before setting this. A\n * bare \"spent\" observation is not sufficient: the spend may be the\n * depositor's own CSV refund, and offering the secret-revealing hatch\n * against a refund burns the secret for a vault whose funds already\n * returned. Nor is that match alone, when the outspend comes from an API\n * the caller does not control: the PegIn txid is public, so an API can name\n * it for a healthy vault and hide the normal activation. Fetch the PegIn by\n * the txid of the on-chain signed PegIn and require its HTLC input's\n * witness to pass `verifyPeginHashlockSpend`. Then the PegIn is a valid\n * spend of the HTLC — broadcast, or broadcastable by anyone while the HTLC\n * is unspent: the participants' signatures are public, so a witness Bitcoin\n * would accept needs only the secret, which an API cannot produce before it\n * is public.\n */\n htlcSpentByPeginTx?: boolean;\n /**\n * EXPIRED only: the vault expired after reaching Verified, the PegIn\n * transaction has spent the Pre-PegIn HTLC, and the claim window has not\n * elapsed. The CSV refund is gone, so the claim is the remaining exit.\n *\n * Set it from the same spender attribution as `htlcSpentByPeginTx` — the\n * outspend's `spendingTxid` equal to the vault's PegIn txid — never from a\n * bare \"spent\". Before the claim reveals the secret, the PegIn must also\n * pass `verifyPeginHashlockSpend`, as for `htlcSpentByPeginTx`: revealing\n * the secret while the HTLC is unspent lets anyone broadcast the PegIn ahead\n * of the depositor's refund. When set, it takes precedence over\n * `canRefund`: once the PegIn has spent the HTLC, the refund cannot.\n */\n canClaimExpired?: boolean;\n}\n\n// ============================================================================\n// State Machine Logic\n// ============================================================================\n\n/**\n * Determine the current protocol state and available actions based on contract\n * status and vault provider state. Framework-agnostic: returns only\n * protocol-level data with no display labels, messages, or UI concerns.\n *\n * Client-side tracking overrides (e.g. suppressing actions after the user\n * has already acted but on-chain state hasn't caught up) are the caller's\n * responsibility.\n *\n * @param contractStatus - On-chain contract status (source of truth)\n * @param options - Vault provider state\n * @returns Protocol state with available actions\n */\nexport function getPeginProtocolState(\n contractStatus: ContractStatus,\n options: GetPeginProtocolStateOptions = {},\n): PeginProtocolState {\n const {\n transactionsReady,\n needsWotsKey,\n pendingIngestion,\n canRefund,\n hasProviderTerminalFailure,\n htlcSpentByPeginTx,\n canClaimExpired,\n } = options;\n\n if (contractStatus === ContractStatus.PENDING) {\n if (hasProviderTerminalFailure) {\n return { contractStatus, availableActions: [] };\n }\n\n if (needsWotsKey) {\n return {\n contractStatus,\n availableActions: [PeginAction.SUBMIT_WOTS_KEY],\n };\n }\n\n if (pendingIngestion === true && !transactionsReady) {\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_AND_BROADCAST_TO_BITCOIN],\n };\n }\n\n if (pendingIngestion === undefined && !transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n if (!transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_PAYOUT_TRANSACTIONS],\n };\n }\n\n if (contractStatus === ContractStatus.VERIFIED) {\n // A spent HTLC while still Verified means the peg-in was swept without\n // activation: activating normally would hand the collateral to an\n // application flow that already failed once, and refunding is impossible\n // (the outpoint is gone). Surface only the escape hatch.\n if (htlcSpentByPeginTx) {\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_AND_REDEEM],\n };\n }\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_VAULT],\n };\n }\n\n if (contractStatus === ContractStatus.ACTIVE) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.REDEEMED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.LIQUIDATED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.EXPIRED) {\n if (canClaimExpired) {\n return {\n contractStatus,\n availableActions: [PeginAction.CLAIM_EXPIRED_VAULT],\n };\n }\n return {\n contractStatus,\n availableActions: canRefund ? [PeginAction.REFUND_HTLC] : [],\n };\n }\n\n if (contractStatus === ContractStatus.INVALID) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.DEPOSITOR_WITHDRAWN) {\n return { contractStatus, availableActions: [] };\n }\n\n // Terminal like DEPOSITOR_WITHDRAWN: the vault output is spent. The reserve\n // reclaim is decided by the app from Bitcoin reads, not offered here.\n if (contractStatus === ContractStatus.NON_DEPOSITOR_SPEND) {\n return { contractStatus, availableActions: [] };\n }\n\n return { contractStatus, availableActions: [] };\n}\n\n/**\n * Check if a specific action is available in the current state\n */\nexport function canPerformAction(\n state: PeginProtocolState,\n action: PeginAction,\n): boolean {\n return state.availableActions.includes(action);\n}\n\n// ============================================================================\n// Activation deadline\n// ============================================================================\n\n/**\n * Whether a vault's on-chain activation window has closed. Mirrors the\n * BTCVaultRegistry check that reverts `ActivationDeadlineExpired`:\n * `block.number > createdAt + pegInActivationTimeout` — strict `>`, so a\n * boundary-equal block is NOT expired. All values are Ethereum block numbers.\n */\nexport function isActivationDeadlinePassedOnChain(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): boolean {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n return currentBlock > createdAtBlock + pegInActivationTimeout;\n}\n\n/**\n * Blocks still available for an activation transaction to be mined; `0` once\n * the window has closed.\n *\n * `isActivationDeadlinePassedOnChain` answers whether the window is already\n * shut, which is the right question for a badge but the wrong one for a\n * secret-bearing call. An activation submitted in the last block before the\n * deadline reverts if it lands one block late, and by then `s` is public\n * calldata: the vault expires with `ActivationTimeout`, and the vault\n * provider, which holds the rest of the HTLC signature set, can broadcast the\n * PegIn with that secret. The caller therefore needs the remaining margin,\n * not a boolean.\n *\n * The contract accepts a transaction mined at `block.number <= createdAt +\n * timeout`. `currentBlock` is the chain head, which is already mined, so a new\n * transaction lands at `currentBlock + 1` at the earliest: at\n * `currentBlock === createdAt + timeout` no usable block remains.\n */\nexport function activationDeadlineBlocksRemaining(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): number {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n const lastUsableBlock = createdAtBlock + pegInActivationTimeout;\n if (currentBlock >= lastUsableBlock) return 0;\n return Number(lastUsableBlock - currentBlock);\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","htlcSpentByPeginTx","canClaimExpired","canPerformAction","state","action","isActivationDeadlinePassedOnChain","params","currentBlock","createdAtBlock","pegInActivationTimeout","activationDeadlineBlocksRemaining","lastUsableBlock"],"mappings":"aAeO,IAAKA,GAAAA,IAEVA,EAAAA,EAAA,QAAU,CAAA,EAAV,UAEAA,EAAAA,EAAA,SAAW,CAAA,EAAX,WAEAA,EAAAA,EAAA,OAAS,CAAA,EAAT,SAEAA,EAAAA,EAAA,SAAW,CAAA,EAAX,WAEAA,EAAAA,EAAA,WAAa,CAAA,EAAb,aAEAA,EAAAA,EAAA,QAAU,CAAA,EAAV,UAEAA,EAAAA,EAAA,oBAAsB,CAAA,EAAtB,sBAEAA,EAAAA,EAAA,QAAU,CAAA,EAAV,UAOAA,EAAAA,EAAA,oBAAsB,CAAA,EAAtB,sBAvBUA,IAAAA,GAAA,CAAA,CAAA,EAuCAC,GAAAA,IAEVA,EAAA,gBAAkB,kBAElBA,EAAA,yBAA2B,2BAE3BA,EAAA,8BAAgC,gCAEhCA,EAAA,eAAiB,iBAOjBA,EAAA,oBAAsB,sBAEtBA,EAAA,YAAc,cAQdA,EAAA,oBAAsB,sBAzBZA,IAAAA,GAAA,CAAA,CAAA,EAkHL,SAASC,EACdC,EACAC,EAAwC,GACpB,CACpB,KAAM,CACJ,kBAAAC,EACA,aAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,2BAAAC,EACA,mBAAAC,EACA,gBAAAC,CAAA,EACEP,EAEJ,OAAID,IAAmB,EACjBM,EACK,CAAE,eAAAN,EAAgB,iBAAkB,EAAC,EAG1CG,EACK,CACL,eAAAH,EACA,iBAAkB,CAAC,iBAAA,CAA2B,EAI9CI,IAAqB,IAAQ,CAACF,EACzB,CACL,eAAAF,EACA,iBAAkB,CAAC,+BAAA,CAAyC,EAI5DI,IAAqB,QAAa,CAACF,EAC9B,CAAE,eAAAF,EAAgB,iBAAkB,EAAC,EAGzCE,EAIE,CACL,eAAAF,EACA,iBAAkB,CAAC,0BAAA,CAAoC,EALhD,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAS5CA,IAAmB,EAKjBO,EACK,CACL,eAAAP,EACA,iBAAkB,CAAC,qBAAA,CAA+B,EAG/C,CACL,eAAAA,EACA,iBAAkB,CAAC,gBAAA,CAA0B,EAI7CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACjBQ,EACK,CACL,eAAAR,EACA,iBAAkB,CAAC,qBAAA,CAA+B,EAG/C,CACL,eAAAA,EACA,iBAAkBK,EAAY,CAAC,eAA2B,CAAA,CAAC,EAI3DL,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAG1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAK1CA,IAAmB,EACd,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,EAGvC,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,CAC9C,CAKO,SAASS,EACdC,EACAC,EACS,CACT,OAAOD,EAAM,iBAAiB,SAASC,CAAM,CAC/C,CAYO,SAASC,EAAkCC,EAItC,CACV,KAAM,CAAE,aAAAC,EAAc,eAAAC,EAAgB,uBAAAC,CAAA,EAA2BH,EACjE,OAAOC,EAAeC,EAAiBC,CACzC,CAoBO,SAASC,EAAkCJ,EAIvC,CACT,KAAM,CAAE,aAAAC,EAAc,eAAAC,EAAgB,uBAAAC,CAAA,EAA2BH,EAC3DK,EAAkBH,EAAiBC,EACzC,OAAIF,GAAgBI,EAAwB,EACrC,OAAOA,EAAkBJ,CAAY,CAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peginState-CXdbSit3.js","sources":["../src/tbv/core/services/deposit/peginState.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-8). The contract enum (BTCVaultRegistry.sol BTCVaultStatus) only\n * has: Pending(0), Verified(1), Active(2), Redeemed(3), Expired(4).\n * The indexer maps these and adds extra statuses for UI display.\n *\n * IMPORTANT: With the new contract architecture:\n * - Core vault status (BTCVaultRegistry) does NOT change when used by applications\n * - Vaults remain at ACTIVE status even when used in DeFi positions\n * - Application usage status is tracked separately by each integration controller\n */\nexport enum ContractStatus {\n /** Status 0: Request submitted, waiting for ACKs */\n PENDING = 0,\n /** Status 1: All ACKs collected, ready for secret activation */\n VERIFIED = 1,\n /** Status 2: HTLC secret revealed, vault is active and usable (stays here even when used by apps) */\n ACTIVE = 2,\n /** Status 3: Vault has been redeemed, BTC is claimable */\n REDEEMED = 3,\n /** Status 4 (indexer-only): Vault was liquidated (collateral seized due to unpaid debt) */\n LIQUIDATED = 4,\n /** Status 5 (indexer-only): Vault is invalid — BTC UTXOs were spent in a different transaction */\n INVALID = 5,\n /** Status 6 (indexer-only): Depositor has withdrawn their BTC (redemption complete) */\n DEPOSITOR_WITHDRAWN = 6,\n /** Status 7 (indexer-only): Vault expired due to AckTimeout or ActivationTimeout */\n EXPIRED = 7,\n /**\n * Status 8 (indexer-only): a redeemed vault's BTC was spent on Bitcoin to a\n * script other than the depositor's payout script, in practice a vault\n * keeper's claim that no challenger blocked. The vault's BTC is gone; only\n * the depositor's PegIn output 1 reserve may remain.\n */\n NON_DEPOSITOR_SPEND = 8,\n}\n\n/** Reason why a vault expired */\nexport type ExpirationReason =\n | \"ack_timeout\"\n | \"proof_timeout\"\n | \"activation_timeout\";\n\n// ============================================================================\n// Protocol State Model\n// ============================================================================\n\n/**\n * Available actions user can take\n */\nexport enum PeginAction {\n /** Submit WOTS key (re-derives via wallet `deriveContextHash`) */\n SUBMIT_WOTS_KEY = \"SUBMIT_WOTS_KEY\",\n /** Sign payout transactions */\n SIGN_PAYOUT_TRANSACTIONS = \"SIGN_PAYOUT_TRANSACTIONS\",\n /** Sign and broadcast peg-in transaction to Bitcoin */\n SIGN_AND_BROADCAST_TO_BITCOIN = \"SIGN_AND_BROADCAST_TO_BITCOIN\",\n /** Reveal HTLC secret on Ethereum to activate vault */\n ACTIVATE_VAULT = \"ACTIVATE_VAULT\",\n /**\n * Escape hatch: reveal the HTLC secret and immediately redeem the vault for\n * the depositor (`activateVaultWithSecretAndRedeem`), skipping application\n * activation. Recovery path when the peg-in was swept on Bitcoin but the\n * vault could not be activated (application paused / activation revert).\n */\n ACTIVATE_AND_REDEEM = \"ACTIVATE_AND_REDEEM\",\n /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\n /**\n * Reveal the HTLC secret for a vault that expired after reaching Verified\n * (`claimExpiredVault`), so the BTC the PegIn swept into the vault is\n * claimed out to the keys recorded on chain. The only exit once the PegIn\n * has spent the HTLC; the contract accepts it until the vault's\n * `claimExpiredUntil` block.\n */\n CLAIM_EXPIRED_VAULT = \"CLAIM_EXPIRED_VAULT\",\n}\n\n/**\n * Protocol-level peg-in state (framework-agnostic)\n */\nexport interface PeginProtocolState {\n /** Smart contract status (source of truth for on-chain state) */\n contractStatus: ContractStatus;\n /** Available user actions (empty array when no action is available) */\n availableActions: PeginAction[];\n}\n\n/**\n * Options for getPeginProtocolState function.\n *\n * All fields represent protocol-level state from the vault provider or\n * on-chain contracts. Client-side tracking (localStorage, polling state)\n * is NOT included — consumers handle that in their own layer.\n */\nexport interface GetPeginProtocolStateOptions {\n /** Whether claim/payout transactions are ready from VP */\n transactionsReady?: boolean;\n /** Whether the vault provider is waiting for the depositor's WOTS public key */\n needsWotsKey?: boolean;\n /** Whether the vault provider hasn't ingested this peg-in yet */\n pendingIngestion?: boolean;\n /** Whether the depositor can refund the HTLC (Pre-PegIn tx available) */\n canRefund?: boolean;\n /** Whether the vault provider reported a terminal failure */\n hasProviderTerminalFailure?: boolean;\n /**\n * VERIFIED only: the Pre-PegIn HTLC outpoint has been spent on Bitcoin BY\n * THE PEGIN TRANSACTION while the vault is still Verified on Ethereum. The\n * secret was revealed (e.g. in the calldata of a reverted activation) and\n * the peg-in swept without the vault activating, so the normal activation\n * no longer returns value to the depositor and the CSV refund can never\n * broadcast. The remaining recovery is the activate-and-redeem escape\n * hatch.\n *\n * The caller MUST prove the spender by comparing the outspend's\n * `spendingTxid` against the vault's PegIn txid before setting this. A\n * bare \"spent\" observation is not sufficient: the spend may be the\n * depositor's own CSV refund, and offering the secret-revealing hatch\n * against a refund burns the secret for a vault whose funds already\n * returned.\n */\n htlcSpentByPeginTx?: boolean;\n /**\n * EXPIRED only: the vault expired after reaching Verified, the PegIn\n * transaction has spent the Pre-PegIn HTLC, and the claim window has not\n * elapsed. The CSV refund is gone, so the claim is the remaining exit.\n *\n * The same spender proof as `htlcSpentByPeginTx` applies: offering the claim\n * while the HTLC is unspent reveals the secret and lets anyone broadcast the\n * PegIn ahead of the depositor's refund. When set, it takes precedence over\n * `canRefund`, which a proven PegIn spend makes impossible.\n */\n canClaimExpired?: boolean;\n}\n\n// ============================================================================\n// State Machine Logic\n// ============================================================================\n\n/**\n * Determine the current protocol state and available actions based on contract\n * status and vault provider state. Framework-agnostic: returns only\n * protocol-level data with no display labels, messages, or UI concerns.\n *\n * Client-side tracking overrides (e.g. suppressing actions after the user\n * has already acted but on-chain state hasn't caught up) are the caller's\n * responsibility.\n *\n * @param contractStatus - On-chain contract status (source of truth)\n * @param options - Vault provider state\n * @returns Protocol state with available actions\n */\nexport function getPeginProtocolState(\n contractStatus: ContractStatus,\n options: GetPeginProtocolStateOptions = {},\n): PeginProtocolState {\n const {\n transactionsReady,\n needsWotsKey,\n pendingIngestion,\n canRefund,\n hasProviderTerminalFailure,\n htlcSpentByPeginTx,\n canClaimExpired,\n } = options;\n\n if (contractStatus === ContractStatus.PENDING) {\n if (hasProviderTerminalFailure) {\n return { contractStatus, availableActions: [] };\n }\n\n if (needsWotsKey) {\n return {\n contractStatus,\n availableActions: [PeginAction.SUBMIT_WOTS_KEY],\n };\n }\n\n if (pendingIngestion === true && !transactionsReady) {\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_AND_BROADCAST_TO_BITCOIN],\n };\n }\n\n if (pendingIngestion === undefined && !transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n if (!transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_PAYOUT_TRANSACTIONS],\n };\n }\n\n if (contractStatus === ContractStatus.VERIFIED) {\n // A spent HTLC while still Verified means the peg-in was swept without\n // activation: activating normally would hand the collateral to an\n // application flow that already failed once, and refunding is impossible\n // (the outpoint is gone). Surface only the escape hatch.\n if (htlcSpentByPeginTx) {\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_AND_REDEEM],\n };\n }\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_VAULT],\n };\n }\n\n if (contractStatus === ContractStatus.ACTIVE) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.REDEEMED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.LIQUIDATED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.EXPIRED) {\n if (canClaimExpired) {\n return {\n contractStatus,\n availableActions: [PeginAction.CLAIM_EXPIRED_VAULT],\n };\n }\n return {\n contractStatus,\n availableActions: canRefund ? [PeginAction.REFUND_HTLC] : [],\n };\n }\n\n if (contractStatus === ContractStatus.INVALID) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.DEPOSITOR_WITHDRAWN) {\n return { contractStatus, availableActions: [] };\n }\n\n // Terminal like DEPOSITOR_WITHDRAWN: the vault output is spent. The reserve\n // reclaim is decided by the app from Bitcoin reads, not offered here.\n if (contractStatus === ContractStatus.NON_DEPOSITOR_SPEND) {\n return { contractStatus, availableActions: [] };\n }\n\n return { contractStatus, availableActions: [] };\n}\n\n/**\n * Check if a specific action is available in the current state\n */\nexport function canPerformAction(\n state: PeginProtocolState,\n action: PeginAction,\n): boolean {\n return state.availableActions.includes(action);\n}\n\n// ============================================================================\n// Activation deadline\n// ============================================================================\n\n/**\n * Whether a vault's on-chain activation window has closed. Mirrors the\n * BTCVaultRegistry check that reverts `ActivationDeadlineExpired`:\n * `block.number > createdAt + pegInActivationTimeout` — strict `>`, so a\n * boundary-equal block is NOT expired. All values are Ethereum block numbers.\n */\nexport function isActivationDeadlinePassedOnChain(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): boolean {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n return currentBlock > createdAtBlock + pegInActivationTimeout;\n}\n\n/**\n * Blocks still available for an activation transaction to be mined; `0` once\n * the window has closed.\n *\n * `isActivationDeadlinePassedOnChain` answers whether the window is already\n * shut, which is the right question for a badge but the wrong one for a\n * secret-bearing call. An activation submitted in the last block before the\n * deadline reverts if it lands one block late, and by then `s` is public\n * calldata: the vault expires with `ActivationTimeout`, and the vault\n * provider, which holds the rest of the HTLC signature set, can broadcast the\n * PegIn with that secret. The caller therefore needs the remaining margin,\n * not a boolean.\n *\n * The contract accepts a transaction mined at `block.number <= createdAt +\n * timeout`. `currentBlock` is the chain head, which is already mined, so a new\n * transaction lands at `currentBlock + 1` at the earliest: at\n * `currentBlock === createdAt + timeout` no usable block remains.\n */\nexport function activationDeadlineBlocksRemaining(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): number {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n const lastUsableBlock = createdAtBlock + pegInActivationTimeout;\n if (currentBlock >= lastUsableBlock) return 0;\n return Number(lastUsableBlock - currentBlock);\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","htlcSpentByPeginTx","canClaimExpired","canPerformAction","state","action","isActivationDeadlinePassedOnChain","params","currentBlock","createdAtBlock","pegInActivationTimeout","activationDeadlineBlocksRemaining","lastUsableBlock"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"peginState-CXdbSit3.js","sources":["../src/tbv/core/services/deposit/peginState.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-8). The contract enum (BTCVaultRegistry.sol BTCVaultStatus) only\n * has: Pending(0), Verified(1), Active(2), Redeemed(3), Expired(4).\n * The indexer maps these and adds extra statuses for UI display.\n *\n * IMPORTANT: With the new contract architecture:\n * - Core vault status (BTCVaultRegistry) does NOT change when used by applications\n * - Vaults remain at ACTIVE status even when used in DeFi positions\n * - Application usage status is tracked separately by each integration controller\n */\nexport enum ContractStatus {\n /** Status 0: Request submitted, waiting for ACKs */\n PENDING = 0,\n /** Status 1: All ACKs collected, ready for secret activation */\n VERIFIED = 1,\n /** Status 2: HTLC secret revealed, vault is active and usable (stays here even when used by apps) */\n ACTIVE = 2,\n /** Status 3: Vault has been redeemed, BTC is claimable */\n REDEEMED = 3,\n /** Status 4 (indexer-only): Vault was liquidated (collateral seized due to unpaid debt) */\n LIQUIDATED = 4,\n /** Status 5 (indexer-only): Vault is invalid — BTC UTXOs were spent in a different transaction */\n INVALID = 5,\n /** Status 6 (indexer-only): Depositor has withdrawn their BTC (redemption complete) */\n DEPOSITOR_WITHDRAWN = 6,\n /** Status 7 (indexer-only): Vault expired due to AckTimeout or ActivationTimeout */\n EXPIRED = 7,\n /**\n * Status 8 (indexer-only): a redeemed vault's BTC was spent on Bitcoin to a\n * script other than the depositor's payout script, in practice a vault\n * keeper's claim that no challenger blocked. The vault's BTC is gone; only\n * the depositor's PegIn output 1 reserve may remain.\n */\n NON_DEPOSITOR_SPEND = 8,\n}\n\n/** Reason why a vault expired */\nexport type ExpirationReason =\n | \"ack_timeout\"\n | \"proof_timeout\"\n | \"activation_timeout\";\n\n// ============================================================================\n// Protocol State Model\n// ============================================================================\n\n/**\n * Available actions user can take\n */\nexport enum PeginAction {\n /** Submit WOTS key (re-derives via wallet `deriveContextHash`) */\n SUBMIT_WOTS_KEY = \"SUBMIT_WOTS_KEY\",\n /** Sign payout transactions */\n SIGN_PAYOUT_TRANSACTIONS = \"SIGN_PAYOUT_TRANSACTIONS\",\n /** Sign and broadcast peg-in transaction to Bitcoin */\n SIGN_AND_BROADCAST_TO_BITCOIN = \"SIGN_AND_BROADCAST_TO_BITCOIN\",\n /** Reveal HTLC secret on Ethereum to activate vault */\n ACTIVATE_VAULT = \"ACTIVATE_VAULT\",\n /**\n * Escape hatch: reveal the HTLC secret and immediately redeem the vault for\n * the depositor (`activateVaultWithSecretAndRedeem`), skipping application\n * activation. Recovery path when the peg-in was swept on Bitcoin but the\n * vault could not be activated (application paused / activation revert).\n */\n ACTIVATE_AND_REDEEM = \"ACTIVATE_AND_REDEEM\",\n /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\n /**\n * Reveal the HTLC secret for a vault that expired after reaching Verified\n * (`claimExpiredVault`), so the BTC the PegIn swept into the vault is\n * claimed out to the keys recorded on chain. The only exit once the PegIn\n * has spent the HTLC; the contract accepts it until the vault's\n * `claimExpiredUntil` block.\n */\n CLAIM_EXPIRED_VAULT = \"CLAIM_EXPIRED_VAULT\",\n}\n\n/**\n * Protocol-level peg-in state (framework-agnostic)\n */\nexport interface PeginProtocolState {\n /** Smart contract status (source of truth for on-chain state) */\n contractStatus: ContractStatus;\n /** Available user actions (empty array when no action is available) */\n availableActions: PeginAction[];\n}\n\n/**\n * Options for getPeginProtocolState function.\n *\n * All fields represent protocol-level state from the vault provider or\n * on-chain contracts. Client-side tracking (localStorage, polling state)\n * is NOT included — consumers handle that in their own layer.\n */\nexport interface GetPeginProtocolStateOptions {\n /** Whether claim/payout transactions are ready from VP */\n transactionsReady?: boolean;\n /** Whether the vault provider is waiting for the depositor's WOTS public key */\n needsWotsKey?: boolean;\n /** Whether the vault provider hasn't ingested this peg-in yet */\n pendingIngestion?: boolean;\n /** Whether the depositor can refund the HTLC (Pre-PegIn tx available) */\n canRefund?: boolean;\n /** Whether the vault provider reported a terminal failure */\n hasProviderTerminalFailure?: boolean;\n /**\n * VERIFIED only: the Pre-PegIn HTLC outpoint has been spent on Bitcoin BY\n * THE PEGIN TRANSACTION while the vault is still Verified on Ethereum. The\n * secret was revealed (e.g. in the calldata of a reverted activation) and\n * the peg-in swept without the vault activating, so the normal activation\n * no longer returns value to the depositor and the CSV refund can never\n * broadcast. The remaining recovery is the activate-and-redeem escape\n * hatch.\n *\n * The caller MUST prove the spender by comparing the outspend's\n * `spendingTxid` against the vault's PegIn txid before setting this. A\n * bare \"spent\" observation is not sufficient: the spend may be the\n * depositor's own CSV refund, and offering the secret-revealing hatch\n * against a refund burns the secret for a vault whose funds already\n * returned. Nor is that match alone, when the outspend comes from an API\n * the caller does not control: the PegIn txid is public, so an API can name\n * it for a healthy vault and hide the normal activation. Fetch the PegIn by\n * the txid of the on-chain signed PegIn and require its HTLC input's\n * witness to pass `verifyPeginHashlockSpend`. Then the PegIn is a valid\n * spend of the HTLC — broadcast, or broadcastable by anyone while the HTLC\n * is unspent: the participants' signatures are public, so a witness Bitcoin\n * would accept needs only the secret, which an API cannot produce before it\n * is public.\n */\n htlcSpentByPeginTx?: boolean;\n /**\n * EXPIRED only: the vault expired after reaching Verified, the PegIn\n * transaction has spent the Pre-PegIn HTLC, and the claim window has not\n * elapsed. The CSV refund is gone, so the claim is the remaining exit.\n *\n * Set it from the same spender attribution as `htlcSpentByPeginTx` — the\n * outspend's `spendingTxid` equal to the vault's PegIn txid — never from a\n * bare \"spent\". Before the claim reveals the secret, the PegIn must also\n * pass `verifyPeginHashlockSpend`, as for `htlcSpentByPeginTx`: revealing\n * the secret while the HTLC is unspent lets anyone broadcast the PegIn ahead\n * of the depositor's refund. When set, it takes precedence over\n * `canRefund`: once the PegIn has spent the HTLC, the refund cannot.\n */\n canClaimExpired?: boolean;\n}\n\n// ============================================================================\n// State Machine Logic\n// ============================================================================\n\n/**\n * Determine the current protocol state and available actions based on contract\n * status and vault provider state. Framework-agnostic: returns only\n * protocol-level data with no display labels, messages, or UI concerns.\n *\n * Client-side tracking overrides (e.g. suppressing actions after the user\n * has already acted but on-chain state hasn't caught up) are the caller's\n * responsibility.\n *\n * @param contractStatus - On-chain contract status (source of truth)\n * @param options - Vault provider state\n * @returns Protocol state with available actions\n */\nexport function getPeginProtocolState(\n contractStatus: ContractStatus,\n options: GetPeginProtocolStateOptions = {},\n): PeginProtocolState {\n const {\n transactionsReady,\n needsWotsKey,\n pendingIngestion,\n canRefund,\n hasProviderTerminalFailure,\n htlcSpentByPeginTx,\n canClaimExpired,\n } = options;\n\n if (contractStatus === ContractStatus.PENDING) {\n if (hasProviderTerminalFailure) {\n return { contractStatus, availableActions: [] };\n }\n\n if (needsWotsKey) {\n return {\n contractStatus,\n availableActions: [PeginAction.SUBMIT_WOTS_KEY],\n };\n }\n\n if (pendingIngestion === true && !transactionsReady) {\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_AND_BROADCAST_TO_BITCOIN],\n };\n }\n\n if (pendingIngestion === undefined && !transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n if (!transactionsReady) {\n return { contractStatus, availableActions: [] };\n }\n\n return {\n contractStatus,\n availableActions: [PeginAction.SIGN_PAYOUT_TRANSACTIONS],\n };\n }\n\n if (contractStatus === ContractStatus.VERIFIED) {\n // A spent HTLC while still Verified means the peg-in was swept without\n // activation: activating normally would hand the collateral to an\n // application flow that already failed once, and refunding is impossible\n // (the outpoint is gone). Surface only the escape hatch.\n if (htlcSpentByPeginTx) {\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_AND_REDEEM],\n };\n }\n return {\n contractStatus,\n availableActions: [PeginAction.ACTIVATE_VAULT],\n };\n }\n\n if (contractStatus === ContractStatus.ACTIVE) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.REDEEMED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.LIQUIDATED) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.EXPIRED) {\n if (canClaimExpired) {\n return {\n contractStatus,\n availableActions: [PeginAction.CLAIM_EXPIRED_VAULT],\n };\n }\n return {\n contractStatus,\n availableActions: canRefund ? [PeginAction.REFUND_HTLC] : [],\n };\n }\n\n if (contractStatus === ContractStatus.INVALID) {\n return { contractStatus, availableActions: [] };\n }\n\n if (contractStatus === ContractStatus.DEPOSITOR_WITHDRAWN) {\n return { contractStatus, availableActions: [] };\n }\n\n // Terminal like DEPOSITOR_WITHDRAWN: the vault output is spent. The reserve\n // reclaim is decided by the app from Bitcoin reads, not offered here.\n if (contractStatus === ContractStatus.NON_DEPOSITOR_SPEND) {\n return { contractStatus, availableActions: [] };\n }\n\n return { contractStatus, availableActions: [] };\n}\n\n/**\n * Check if a specific action is available in the current state\n */\nexport function canPerformAction(\n state: PeginProtocolState,\n action: PeginAction,\n): boolean {\n return state.availableActions.includes(action);\n}\n\n// ============================================================================\n// Activation deadline\n// ============================================================================\n\n/**\n * Whether a vault's on-chain activation window has closed. Mirrors the\n * BTCVaultRegistry check that reverts `ActivationDeadlineExpired`:\n * `block.number > createdAt + pegInActivationTimeout` — strict `>`, so a\n * boundary-equal block is NOT expired. All values are Ethereum block numbers.\n */\nexport function isActivationDeadlinePassedOnChain(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): boolean {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n return currentBlock > createdAtBlock + pegInActivationTimeout;\n}\n\n/**\n * Blocks still available for an activation transaction to be mined; `0` once\n * the window has closed.\n *\n * `isActivationDeadlinePassedOnChain` answers whether the window is already\n * shut, which is the right question for a badge but the wrong one for a\n * secret-bearing call. An activation submitted in the last block before the\n * deadline reverts if it lands one block late, and by then `s` is public\n * calldata: the vault expires with `ActivationTimeout`, and the vault\n * provider, which holds the rest of the HTLC signature set, can broadcast the\n * PegIn with that secret. The caller therefore needs the remaining margin,\n * not a boolean.\n *\n * The contract accepts a transaction mined at `block.number <= createdAt +\n * timeout`. `currentBlock` is the chain head, which is already mined, so a new\n * transaction lands at `currentBlock + 1` at the earliest: at\n * `currentBlock === createdAt + timeout` no usable block remains.\n */\nexport function activationDeadlineBlocksRemaining(params: {\n currentBlock: bigint;\n createdAtBlock: bigint;\n pegInActivationTimeout: bigint;\n}): number {\n const { currentBlock, createdAtBlock, pegInActivationTimeout } = params;\n const lastUsableBlock = createdAtBlock + pegInActivationTimeout;\n if (currentBlock >= lastUsableBlock) return 0;\n return Number(lastUsableBlock - currentBlock);\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","htlcSpentByPeginTx","canClaimExpired","canPerformAction","state","action","isActivationDeadlinePassedOnChain","params","currentBlock","createdAtBlock","pegInActivationTimeout","activationDeadlineBlocksRemaining","lastUsableBlock"],"mappings":"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"}
|
package/dist/tbv/core/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../verifyScriptPathSchnorrSignature-BHskbJJx.cjs"),O=require("../../secp256k1-DDHQ1_za.cjs"),o=require("./wasm/index.cjs"),R=require("../../verifyKeyPathSchnorrSignature-BVrAmVL3.cjs"),E=require("../../challengeAssert-CuX_8Twt.cjs"),r=require("../../bitcoin-D-O2GjbC.cjs"),y=require("../../abortSignals-msbmbqFe.cjs"),I=require("../../signing-DvISftFk.cjs"),P=require("../../validation-C6XTfZak.cjs"),F=require("./utils/eth/index.cjs"),_=require("../../PeginManager-6ghglb4r.cjs"),d=require("../../PayoutManager-B5nR0x1t.cjs"),s=require("./clients/mempool/index.cjs"),l=require("../../registration-records-CKc0OVuK.cjs"),C=require("../../signer-set-reader-CJfV-GDz.cjs"),A=require("../../pegin-registration-client-DOb-Iznp.cjs"),h=require("../../types-BnZIbDHb.cjs"),V=require("../../ApplicationRegistry.abi-sMiTWmnL.cjs"),N=require("../../BTCVaultRegistry.abi-DzbfZ9_s.cjs"),u=require("../../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),M=require("../../ProtocolParams.abi-DWfIh6VH.cjs"),b=require("../../VaultErrors.abi-Hjn1CdLs.cjs"),v=require("../../buildVaultContextInputForClaim-9XZaqIiw.cjs"),S=require("../../deriveVaultRoot-C3uqnJto.cjs"),D=require("../../parseFundingOutpoints-C_-PT9BT.cjs"),U=require("../../btcTxHash-CGb5BqFL.cjs"),c=require("../../psbtInputFields-BrV_ZfL_.cjs"),i=require("../../fundPeginTransaction-54-Rwb2k.cjs"),T=require("../../reservation-D9ftyiwP.cjs"),m=require("../../index-Dn7RlsKK.cjs"),a=require("../../state-C4WoNCy1.cjs"),p=require("../../primeVpAuth-Ch-ig2My.cjs"),t=require("../../toRefundInputs-BzyN0zvj.cjs"),e=require("../../buildAndBroadcastReclaim-Cf05JFP-.cjs"),g=require("../../peginState-B4t_PDgj.cjs");exports.PEGIN_DEPOSITOR_CLAIM_VOUT=n.PEGIN_DEPOSITOR_CLAIM_VOUT;exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=n.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.createPayoutScript=n.createPayoutScript;exports.deriveDepositorClaimDescriptor=n.deriveDepositorClaimDescriptor;exports.deriveDepositorClaimScriptPubKey=n.deriveDepositorClaimScriptPubKey;exports.extractPayoutSignature=n.extractPayoutSignature;exports.assertValidVaultCoreVersion=O.assertValidVaultCoreVersion;exports.attachFinalizedAssert=o.attachFinalizedAssert;exports.computeMinClaimValue=o.computeMinClaimValue;exports.computeMinPeginFee=o.computeMinPeginFee;exports.deriveVaultId=o.deriveVaultId;exports.expandAuthAnchor=o.expandAuthAnchor;exports.expandHashlockSecret=o.expandHashlockSecret;exports.expandWotsSeed=o.expandWotsSeed;exports.finalizePayout=o.finalizePayout;exports.finalizeWronglyChallenged=o.finalizeWronglyChallenged;exports.peginP2aAnchorOutput=o.peginP2aAnchorOutput;exports.pinPegoutProof=o.pinPegoutProof;exports.supportedTxGraphVersions=o.supportedTxGraphVersions;exports.validatePeginP2aAnchor=o.validatePeginP2aAnchor;exports.assertKeyPathSchnorrSignature=R.assertKeyPathSchnorrSignature;exports.assertReturnedKeyPathSignatures=R.assertReturnedKeyPathSignatures;exports.buildPeginInputPsbt=R.buildPeginInputPsbt;exports.extractPeginInputSignature=R.extractPeginInputSignature;exports.finalizePeginInputPsbt=R.finalizePeginInputPsbt;exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildReclaimPsbt=E.buildReclaimPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.estimateReclaimFeeSats=E.estimateReclaimFeeSats;exports.finalizeScriptPathWithSignatures=E.finalizeScriptPathWithSignatures;exports.reclaimVsize=E.reclaimVsize;exports.canonicalizeBtcPubkey=r.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.combineAbortSignals=y.combineAbortSignals;exports.createTaprootScriptPathSignOptions=I.createTaprootScriptPathSignOptions;exports.createTaprootScriptPathSignOptionsForInput=I.createTaprootScriptPathSignOptionsForInput;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.COMPRESSED_PUBKEY_HEX_LEN=P.COMPRESSED_PUBKEY_HEX_LEN;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.X_ONLY_PUBKEY_HEX_LEN=P.X_ONLY_PUBKEY_HEX_LEN;exports.waitForTransactionReceiptSmartAware=F.waitForTransactionReceiptSmartAware;exports.PeginManager=_.PeginManager;exports.buildDepositTerms=_.buildDepositTerms;exports.computeWotsBlockPublicKeysHash=_.computeWotsBlockPublicKeysHash;exports.deriveWotsBlocksFromSeed=_.deriveWotsBlocksFromSeed;exports.ensurePrePeginTermsApproval=_.ensurePrePeginTermsApproval;exports.PayoutManager=d.PayoutManager;exports.computeHashlock=d.computeHashlock;exports.forwardDepositApproval=d.forwardDepositApproval;exports.requireChangeAddress=d.requireChangeAddress;exports.supportsDepositApproval=d.supportsDepositApproval;exports.validateSecretAgainstHashlock=d.validateSecretAgainstHashlock;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.MempoolNotFoundError=s.MempoolNotFoundError;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getOutspend=s.getOutspend;exports.getTipHeight=s.getTipHeight;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.RegistrationLogsUnavailableError=l.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=l.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=l.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=l.assertRegisteredPayoutScriptBounds;exports.derivePeginVaultId=l.derivePeginVaultId;exports.findRegistrationRecord=l.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=l.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=l.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=l.registrationPrePeginTxHash;exports.validateOffchainParams=l.validateOffchainParams;exports.validatePegInConfiguration=l.validatePegInConfiguration;exports.validateTBVProtocolParams=l.validateTBVProtocolParams;exports.ViemOperationKeyReader=C.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=C.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=C.ViemVaultKeeperReader;exports.resolveProtocolAddresses=C.resolveProtocolAddresses;exports.COMMISSION_BPS_HEADROOM=A.COMMISSION_BPS_HEADROOM;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=A.MAX_ACCEPTABLE_COMMISSION_BPS_CAP;exports.ViemPeginRegistrationClient=A.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=A.ViemVaultRegistryReader;exports.capMaxAcceptableCommissionBps=A.capMaxAcceptableCommissionBps;exports.OnChainBtcVaultStatus=h.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=h.ViemProtocolParamsReader;exports.ApplicationRegistryABI=V.ApplicationRegistryABI;exports.BTCVaultRegistryABI=N.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=u.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=u.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=u.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=u.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=u.PeginFingerprintChangedError;exports.extractErrorData=u.extractErrorData;exports.getContractErrorMessage=u.getContractErrorMessage;exports.handleContractError=u.handleContractError;exports.isKnownContractError=u.isKnownContractError;exports.isPeginFingerprintChangedError=u.isPeginFingerprintChangedError;exports.ProtocolParamsABI=M.ProtocolParamsABI;exports.VAULT_ERROR_ABI=b.VAULT_ERROR_ABI;exports.buildVaultContextInputForClaim=v.buildVaultContextInputForClaim;exports.VAULT_APP_NAME=S.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=S.buildFundingOutpointsCommitment;exports.buildVaultContext=S.buildVaultContext;exports.deriveVaultRoot=S.deriveVaultRoot;exports.forwardDeriveContextHash=S.forwardDeriveContextHash;exports.parseFundingOutpointsFromTx=D.parseFundingOutpointsFromTx;exports.calculateBtcTxHash=U.calculateBtcTxHash;exports.BitcoinScriptType=c.BitcoinScriptType;exports.applyChangeOutputPolicy=c.applyChangeOutputPolicy;exports.computeChangeOutputFeeSats=c.computeChangeOutputFeeSats;exports.computeMaxDeposit=c.computeMaxDeposit;exports.computePeginBaseFeeSats=c.computePeginBaseFeeSats;exports.getDustThreshold=c.getDustThreshold;exports.getPsbtInputFields=c.getPsbtInputFields;exports.getScriptType=c.getScriptType;exports.selectUtxosForPegin=c.selectUtxosForPegin;exports.shouldAddChangeOutput=c.shouldAddChangeOutput;exports.BTC_DUST_SAT=i.BTC_DUST_SAT;exports.DUST_THRESHOLD=i.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=i.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=i.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=i.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=i.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=i.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=i.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=i.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=i.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=i.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=i.fundPeginTransaction;exports.parseUnfundedWasmTransaction=i.parseUnfundedWasmTransaction;exports.peginOutputCount=i.peginOutputCount;exports.rateBasedTxBufferFee=i.rateBasedTxBufferFee;exports.UtxoNotAvailableError=T.UtxoNotAvailableError;exports.assertUtxosAvailable=T.assertUtxosAvailable;exports.extractInputsFromTransaction=T.extractInputsFromTransaction;exports.findOverlappingPendingVaults=T.findOverlappingPendingVaults;exports.validateUtxosAvailable=T.validateUtxosAvailable;exports.VaultProviderRpcClient=m.VaultProviderRpcClient;exports.VpResponseValidationError=m.VpResponseValidationError;exports.batchPollByProvider=m.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=m.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=m.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=a.AUTH_REJECTED_RPC_CODE;exports.ClaimerPegoutStatusValue=a.ClaimerPegoutStatusValue;exports.DaemonStatus=a.DaemonStatus;exports.JSON_RPC_ERROR_CODES=a.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=a.JsonRpcClient;exports.JsonRpcError=a.JsonRpcError;exports.POST_WOTS_STATUSES=a.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=a.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=a.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=a.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=a.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=a.VP_TRANSIENT_STATUSES;exports.isAuthRejectedError=a.isAuthRejectedError;exports.isPegoutTerminalStatus=a.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=a.isRecognizedPegoutStatus;exports.ServerIdentityError=p.ServerIdentityError;exports.VpTokenRegistry=p.VpTokenRegistry;exports.createAuthenticatedVpClient=p.createAuthenticatedVpClient;exports.primeVpTokenRegistry=p.primeVpTokenRegistry;exports.verifyServerIdentity=p.verifyServerIdentity;exports.vpTokenRegistry=p.vpTokenRegistry;exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=t.DEPOSIT_TERMS_REJECTED_ERROR_NAME;exports.DepositTermsRejectedError=t.DepositTermsRejectedError;exports.PEGIN_FINGERPRINT_DOMAIN=t.PEGIN_FINGERPRINT_DOMAIN;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=t.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE;exports.PeginFingerprintInputError=t.PeginFingerprintInputError;exports.PeginParamsAmbiguousError=t.PeginParamsAmbiguousError;exports.PeginParamsIncompleteSpaceError=t.PeginParamsIncompleteSpaceError;exports.PeginParamsNotFoundError=t.PeginParamsNotFoundError;exports.PeginSizingIntegrityError=t.PeginSizingIntegrityError;exports.UnanchoredPrePeginError=t.UnanchoredPrePeginError;exports.VaultRootMismatchError=t.VaultRootMismatchError;exports.assertClaimBatchHomogeneous=t.assertClaimBatchHomogeneous;exports.buildPeginParamsCandidates=t.buildPeginParamsCandidates;exports.computeFundedPrePeginFee=t.computeFundedPrePeginFee;exports.computePeginFingerprint=t.computePeginFingerprint;exports.deriveHashlocksFromPrePegin=t.deriveHashlocksFromPrePegin;exports.describePeginParamsCandidate=t.describePeginParamsCandidate;exports.describeUnresolvedVersion=t.describeUnresolvedVersion;exports.encodePeginFingerprintPreimage=t.encodePeginFingerprintPreimage;exports.isDepositTermsRejectedError=t.isDepositTermsRejectedError;exports.isPeginFingerprintInputError=t.isPeginFingerprintInputError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.orderClaimBatchByHtlcVout=t.orderClaimBatchByHtlcVout;exports.rebuildDepositTermsCore=t.rebuildDepositTermsCore;exports.rebuildDepositTermsForClaim=t.rebuildDepositTermsForClaim;exports.reconstructPeginParams=t.reconstructPeginParams;exports.selectSiblingRegistrations=t.selectSiblingRegistrations;exports.toRefundInputs=t.toRefundInputs;exports.ApplicationEntryPointMismatchError=e.ApplicationEntryPointMismatchError;exports.ArtifactsVaultMismatchError=e.ArtifactsVaultMismatchError;exports.AssertBindingError=e.AssertBindingError;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ChallengerSetMismatchError=e.ChallengerSetMismatchError;exports.DELEGATED_CLAIM_TX_GRAPH_VERSION=e.DELEGATED_CLAIM_TX_GRAPH_VERSION;exports.DelegatedClaimSigningIncompleteError=e.DelegatedClaimSigningIncompleteError;exports.GraphFingerprintError=e.GraphFingerprintError;exports.PEGIN_ETH_CONFIRMATIONS=e.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=e.ParticipantKeyDriftError;exports.PayoutDestinationError=e.PayoutDestinationError;exports.PayoutInputLeafError=e.PayoutInputLeafError;exports.PeginRegistrationMissingError=e.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=e.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=e.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=e.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=e.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=e.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.ReclaimUneconomicalError=e.ReclaimUneconomicalError;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.SigningPlanMismatchError=e.SigningPlanMismatchError;exports.UnsupportedPayoutScriptError=e.UnsupportedPayoutScriptError;exports.VaultIdBindingError=e.VaultIdBindingError;exports.activateVault=e.activateVault;exports.activateVaultAndRedeem=e.activateVaultAndRedeem;exports.assembleWatchtowerArtifacts=e.assembleWatchtowerArtifacts;exports.assembleWatchtowerArtifactsFromSignatures=e.assembleWatchtowerArtifactsFromSignatures;exports.assertArtifactsUsableForVault=e.assertArtifactsUsableForVault;exports.assertAssertBindsClaimAndPayout=e.assertAssertBindsClaimAndPayout;exports.assertChallengerSetMatchesVault=e.assertChallengerSetMatchesVault;exports.assertClaimSpendsVault=e.assertClaimSpendsVault;exports.assertPayoutPaysRegisteredScript=e.assertPayoutPaysRegisteredScript;exports.assertReturnedGraphMatchesFingerprint=e.assertReturnedGraphMatchesFingerprint;exports.assertStandardPayoutScriptsAtEpochs=e.assertStandardPayoutScriptsAtEpochs;exports.assertTermsMatchVault=e.assertTermsMatchVault;exports.assertVaultProviderHintAccepted=e.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=e.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.claimExpiredVault=e.claimExpiredVault;exports.copyAssertConnectorLeaf=e.copyAssertConnectorLeaf;exports.deriveClaimerWotsKeypair=e.deriveClaimerWotsKeypair;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.fingerprintReturnedGraph=e.fingerprintReturnedGraph;exports.isApplicationEntryPointMismatchError=e.isApplicationEntryPointMismatchError;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isHintAccepted=e.isHintAccepted;exports.isParticipantKeyDriftError=e.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=e.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=e.isPeginRegistrationNotFinalError;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.isUnsupportedPayoutScriptError=e.isUnsupportedPayoutScriptError;exports.matchKeyHint=e.matchKeyHint;exports.matchKeySetHint=e.matchKeySetHint;exports.planDelegatedClaimSigning=e.planDelegatedClaimSigning;exports.readDelegatedClaimVaultContext=e.readDelegatedClaimVaultContext;exports.readRefundPrePeginContext=e.readRefundPrePeginContext;exports.readStampedParticipantKeys=e.readStampedParticipantKeys;exports.resolveCurrentParticipantKeys=e.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=e.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDelegatedClaimPlan=e.signDelegatedClaimPlan;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.summarizeWatchtowerArtifacts=e.summarizeWatchtowerArtifacts;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=e.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=e.waitForPeginRegistrationDepth;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=g.ContractStatus;exports.PeginAction=g.PeginAction;exports.activationDeadlineBlocksRemaining=g.activationDeadlineBlocksRemaining;exports.canPerformAction=g.canPerformAction;exports.getPeginProtocolState=g.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=g.isActivationDeadlinePassedOnChain;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../verifyScriptPathSchnorrSignature-p3sVoWQi.cjs"),O=require("../../secp256k1-DDHQ1_za.cjs"),o=require("./wasm/index.cjs"),R=require("../../verifyKeyPathSchnorrSignature-B7Za6aa1.cjs"),E=require("../../challengeAssert-DlzX_kjF.cjs"),y=require("../../verifyPeginHashlockSpend-CisfqMuT.cjs"),r=require("../../bitcoin-D-O2GjbC.cjs"),F=require("../../abortSignals-msbmbqFe.cjs"),I=require("../../signing-DvISftFk.cjs"),P=require("../../validation-C6XTfZak.cjs"),V=require("./utils/eth/index.cjs"),_=require("../../PeginManager-D_ZUfbIy.cjs"),d=require("../../PayoutManager-PQqeqX41.cjs"),s=require("./clients/mempool/index.cjs"),l=require("../../registration-records-CKc0OVuK.cjs"),C=require("../../signer-set-reader-CJfV-GDz.cjs"),A=require("../../pegin-registration-client-DOb-Iznp.cjs"),h=require("../../types-BnZIbDHb.cjs"),N=require("../../ApplicationRegistry.abi-sMiTWmnL.cjs"),M=require("../../BTCVaultRegistry.abi-DzbfZ9_s.cjs"),u=require("../../BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),b=require("../../ProtocolParams.abi-DWfIh6VH.cjs"),v=require("../../VaultErrors.abi-Hjn1CdLs.cjs"),D=require("../../buildVaultContextInputForClaim-9XZaqIiw.cjs"),S=require("../../deriveVaultRoot-C3uqnJto.cjs"),U=require("../../parseFundingOutpoints-C_-PT9BT.cjs"),B=require("../../btcTxHash-CGb5BqFL.cjs"),c=require("../../psbtInputFields-BrV_ZfL_.cjs"),i=require("../../fundPeginTransaction-54-Rwb2k.cjs"),T=require("../../reservation-D9ftyiwP.cjs"),m=require("../../index-Dn7RlsKK.cjs"),a=require("../../state-C4WoNCy1.cjs"),p=require("../../primeVpAuth-Ch-ig2My.cjs"),t=require("../../toRefundInputs-Df6eRITl.cjs"),e=require("../../buildAndBroadcastReclaim-CMjlyooo.cjs"),g=require("../../peginState-B4t_PDgj.cjs");exports.PEGIN_DEPOSITOR_CLAIM_VOUT=n.PEGIN_DEPOSITOR_CLAIM_VOUT;exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=n.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.createPayoutScript=n.createPayoutScript;exports.deriveDepositorClaimDescriptor=n.deriveDepositorClaimDescriptor;exports.deriveDepositorClaimScriptPubKey=n.deriveDepositorClaimScriptPubKey;exports.extractPayoutSignature=n.extractPayoutSignature;exports.assertValidVaultCoreVersion=O.assertValidVaultCoreVersion;exports.attachFinalizedAssert=o.attachFinalizedAssert;exports.computeMinClaimValue=o.computeMinClaimValue;exports.computeMinPeginFee=o.computeMinPeginFee;exports.deriveVaultId=o.deriveVaultId;exports.expandAuthAnchor=o.expandAuthAnchor;exports.expandHashlockSecret=o.expandHashlockSecret;exports.expandWotsSeed=o.expandWotsSeed;exports.finalizePayout=o.finalizePayout;exports.finalizeWronglyChallenged=o.finalizeWronglyChallenged;exports.peginP2aAnchorOutput=o.peginP2aAnchorOutput;exports.pinPegoutProof=o.pinPegoutProof;exports.supportedTxGraphVersions=o.supportedTxGraphVersions;exports.validatePeginP2aAnchor=o.validatePeginP2aAnchor;exports.assertKeyPathSchnorrSignature=R.assertKeyPathSchnorrSignature;exports.assertReturnedKeyPathSignatures=R.assertReturnedKeyPathSignatures;exports.buildPeginInputPsbt=R.buildPeginInputPsbt;exports.extractPeginInputSignature=R.extractPeginInputSignature;exports.finalizePeginInputPsbt=R.finalizePeginInputPsbt;exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildReclaimPsbt=E.buildReclaimPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.estimateReclaimFeeSats=E.estimateReclaimFeeSats;exports.finalizeScriptPathWithSignatures=E.finalizeScriptPathWithSignatures;exports.reclaimVsize=E.reclaimVsize;exports.verifyPeginHashlockSpend=y.verifyPeginHashlockSpend;exports.canonicalizeBtcPubkey=r.canonicalizeBtcPubkey;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.combineAbortSignals=F.combineAbortSignals;exports.createTaprootScriptPathSignOptions=I.createTaprootScriptPathSignOptions;exports.createTaprootScriptPathSignOptionsForInput=I.createTaprootScriptPathSignOptionsForInput;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.COMPRESSED_PUBKEY_HEX_LEN=P.COMPRESSED_PUBKEY_HEX_LEN;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.X_ONLY_PUBKEY_HEX_LEN=P.X_ONLY_PUBKEY_HEX_LEN;exports.waitForTransactionReceiptSmartAware=V.waitForTransactionReceiptSmartAware;exports.PeginManager=_.PeginManager;exports.buildDepositTerms=_.buildDepositTerms;exports.computeWotsBlockPublicKeysHash=_.computeWotsBlockPublicKeysHash;exports.deriveWotsBlocksFromSeed=_.deriveWotsBlocksFromSeed;exports.ensurePrePeginTermsApproval=_.ensurePrePeginTermsApproval;exports.PayoutManager=d.PayoutManager;exports.computeHashlock=d.computeHashlock;exports.forwardDepositApproval=d.forwardDepositApproval;exports.requireChangeAddress=d.requireChangeAddress;exports.supportsDepositApproval=d.supportsDepositApproval;exports.validateSecretAgainstHashlock=d.validateSecretAgainstHashlock;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.MempoolNotFoundError=s.MempoolNotFoundError;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getOutspend=s.getOutspend;exports.getTipHeight=s.getTipHeight;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.RegistrationLogsUnavailableError=l.RegistrationLogsUnavailableError;exports.VaultClaimableByNotFoundError=l.VaultClaimableByNotFoundError;exports.assertOnChainBtcPubkey=l.assertOnChainBtcPubkey;exports.assertRegisteredPayoutScriptBounds=l.assertRegisteredPayoutScriptBounds;exports.derivePeginVaultId=l.derivePeginVaultId;exports.findRegistrationRecord=l.findRegistrationRecord;exports.isRegistrationLogsUnavailableError=l.isRegistrationLogsUnavailableError;exports.isVaultClaimableByNotFoundError=l.isVaultClaimableByNotFoundError;exports.registrationPrePeginTxHash=l.registrationPrePeginTxHash;exports.validateOffchainParams=l.validateOffchainParams;exports.validatePegInConfiguration=l.validatePegInConfiguration;exports.validateTBVProtocolParams=l.validateTBVProtocolParams;exports.ViemOperationKeyReader=C.ViemOperationKeyReader;exports.ViemUniversalChallengerReader=C.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=C.ViemVaultKeeperReader;exports.resolveProtocolAddresses=C.resolveProtocolAddresses;exports.COMMISSION_BPS_HEADROOM=A.COMMISSION_BPS_HEADROOM;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=A.MAX_ACCEPTABLE_COMMISSION_BPS_CAP;exports.ViemPeginRegistrationClient=A.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=A.ViemVaultRegistryReader;exports.capMaxAcceptableCommissionBps=A.capMaxAcceptableCommissionBps;exports.OnChainBtcVaultStatus=h.OnChainBtcVaultStatus;exports.ViemProtocolParamsReader=h.ViemProtocolParamsReader;exports.ApplicationRegistryABI=N.ApplicationRegistryABI;exports.BTCVaultRegistryABI=M.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=u.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=u.CONTRACT_ERRORS;exports.EMPTY_REVERT_MESSAGE=u.EMPTY_REVERT_MESSAGE;exports.PEGIN_FINGERPRINT_CHANGED_SELECTOR=u.PEGIN_FINGERPRINT_CHANGED_SELECTOR;exports.PeginFingerprintChangedError=u.PeginFingerprintChangedError;exports.extractErrorData=u.extractErrorData;exports.getContractErrorMessage=u.getContractErrorMessage;exports.handleContractError=u.handleContractError;exports.isKnownContractError=u.isKnownContractError;exports.isPeginFingerprintChangedError=u.isPeginFingerprintChangedError;exports.ProtocolParamsABI=b.ProtocolParamsABI;exports.VAULT_ERROR_ABI=v.VAULT_ERROR_ABI;exports.buildVaultContextInputForClaim=D.buildVaultContextInputForClaim;exports.VAULT_APP_NAME=S.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=S.buildFundingOutpointsCommitment;exports.buildVaultContext=S.buildVaultContext;exports.deriveVaultRoot=S.deriveVaultRoot;exports.forwardDeriveContextHash=S.forwardDeriveContextHash;exports.parseFundingOutpointsFromTx=U.parseFundingOutpointsFromTx;exports.calculateBtcTxHash=B.calculateBtcTxHash;exports.BitcoinScriptType=c.BitcoinScriptType;exports.applyChangeOutputPolicy=c.applyChangeOutputPolicy;exports.computeChangeOutputFeeSats=c.computeChangeOutputFeeSats;exports.computeMaxDeposit=c.computeMaxDeposit;exports.computePeginBaseFeeSats=c.computePeginBaseFeeSats;exports.getDustThreshold=c.getDustThreshold;exports.getPsbtInputFields=c.getPsbtInputFields;exports.getScriptType=c.getScriptType;exports.selectUtxosForPegin=c.selectUtxosForPegin;exports.shouldAddChangeOutput=c.shouldAddChangeOutput;exports.BTC_DUST_SAT=i.BTC_DUST_SAT;exports.DUST_THRESHOLD=i.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=i.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=i.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=i.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=i.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=i.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=i.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=i.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=i.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=i.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=i.fundPeginTransaction;exports.parseUnfundedWasmTransaction=i.parseUnfundedWasmTransaction;exports.peginOutputCount=i.peginOutputCount;exports.rateBasedTxBufferFee=i.rateBasedTxBufferFee;exports.UtxoNotAvailableError=T.UtxoNotAvailableError;exports.assertUtxosAvailable=T.assertUtxosAvailable;exports.extractInputsFromTransaction=T.extractInputsFromTransaction;exports.findOverlappingPendingVaults=T.findOverlappingPendingVaults;exports.validateUtxosAvailable=T.validateUtxosAvailable;exports.VaultProviderRpcClient=m.VaultProviderRpcClient;exports.VpResponseValidationError=m.VpResponseValidationError;exports.batchPollByProvider=m.batchPollByProvider;exports.isUnrecognizedDaemonStatusError=m.isUnrecognizedDaemonStatusError;exports.validateRequestDepositorClaimerArtifactsResponse=m.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=a.AUTH_REJECTED_RPC_CODE;exports.ClaimerPegoutStatusValue=a.ClaimerPegoutStatusValue;exports.DaemonStatus=a.DaemonStatus;exports.JSON_RPC_ERROR_CODES=a.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=a.JsonRpcClient;exports.JsonRpcError=a.JsonRpcError;exports.POST_WOTS_STATUSES=a.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=a.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=a.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=a.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=a.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=a.VP_TRANSIENT_STATUSES;exports.isAuthRejectedError=a.isAuthRejectedError;exports.isPegoutTerminalStatus=a.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=a.isRecognizedPegoutStatus;exports.ServerIdentityError=p.ServerIdentityError;exports.VpTokenRegistry=p.VpTokenRegistry;exports.createAuthenticatedVpClient=p.createAuthenticatedVpClient;exports.primeVpTokenRegistry=p.primeVpTokenRegistry;exports.verifyServerIdentity=p.verifyServerIdentity;exports.vpTokenRegistry=p.vpTokenRegistry;exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=t.DEPOSIT_TERMS_REJECTED_ERROR_NAME;exports.DepositTermsRejectedError=t.DepositTermsRejectedError;exports.PEGIN_FINGERPRINT_DOMAIN=t.PEGIN_FINGERPRINT_DOMAIN;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=t.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE;exports.PeginFingerprintInputError=t.PeginFingerprintInputError;exports.PeginParamsAmbiguousError=t.PeginParamsAmbiguousError;exports.PeginParamsIncompleteSpaceError=t.PeginParamsIncompleteSpaceError;exports.PeginParamsNotFoundError=t.PeginParamsNotFoundError;exports.PeginSizingIntegrityError=t.PeginSizingIntegrityError;exports.UnanchoredPrePeginError=t.UnanchoredPrePeginError;exports.VaultRootMismatchError=t.VaultRootMismatchError;exports.assertClaimBatchHomogeneous=t.assertClaimBatchHomogeneous;exports.buildPeginParamsCandidates=t.buildPeginParamsCandidates;exports.computeFundedPrePeginFee=t.computeFundedPrePeginFee;exports.computePeginFingerprint=t.computePeginFingerprint;exports.deriveHashlocksFromPrePegin=t.deriveHashlocksFromPrePegin;exports.describePeginParamsCandidate=t.describePeginParamsCandidate;exports.describeUnresolvedVersion=t.describeUnresolvedVersion;exports.encodePeginFingerprintPreimage=t.encodePeginFingerprintPreimage;exports.isDepositTermsRejectedError=t.isDepositTermsRejectedError;exports.isPeginFingerprintInputError=t.isPeginFingerprintInputError;exports.isWotsMismatchError=t.isWotsMismatchError;exports.orderClaimBatchByHtlcVout=t.orderClaimBatchByHtlcVout;exports.rebuildDepositTermsCore=t.rebuildDepositTermsCore;exports.rebuildDepositTermsForClaim=t.rebuildDepositTermsForClaim;exports.reconstructPeginParams=t.reconstructPeginParams;exports.selectSiblingRegistrations=t.selectSiblingRegistrations;exports.toRefundInputs=t.toRefundInputs;exports.ApplicationEntryPointMismatchError=e.ApplicationEntryPointMismatchError;exports.ArtifactsVaultMismatchError=e.ArtifactsVaultMismatchError;exports.AssertBindingError=e.AssertBindingError;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ChallengerSetMismatchError=e.ChallengerSetMismatchError;exports.DELEGATED_CLAIM_TX_GRAPH_VERSION=e.DELEGATED_CLAIM_TX_GRAPH_VERSION;exports.DelegatedClaimSigningIncompleteError=e.DelegatedClaimSigningIncompleteError;exports.GraphFingerprintError=e.GraphFingerprintError;exports.PEGIN_ETH_CONFIRMATIONS=e.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=e.ParticipantKeyDriftError;exports.PayoutDestinationError=e.PayoutDestinationError;exports.PayoutInputLeafError=e.PayoutInputLeafError;exports.PeginRegistrationMissingError=e.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=e.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=e.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=e.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=e.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=e.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.ReclaimUneconomicalError=e.ReclaimUneconomicalError;exports.RefundBroadcastRejectedError=e.RefundBroadcastRejectedError;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.SigningPlanMismatchError=e.SigningPlanMismatchError;exports.UnsupportedPayoutScriptError=e.UnsupportedPayoutScriptError;exports.VaultIdBindingError=e.VaultIdBindingError;exports.activateVault=e.activateVault;exports.activateVaultAndRedeem=e.activateVaultAndRedeem;exports.assembleWatchtowerArtifacts=e.assembleWatchtowerArtifacts;exports.assembleWatchtowerArtifactsFromSignatures=e.assembleWatchtowerArtifactsFromSignatures;exports.assertArtifactsUsableForVault=e.assertArtifactsUsableForVault;exports.assertAssertBindsClaimAndPayout=e.assertAssertBindsClaimAndPayout;exports.assertChallengerSetMatchesVault=e.assertChallengerSetMatchesVault;exports.assertClaimSpendsVault=e.assertClaimSpendsVault;exports.assertPayoutPaysRegisteredScript=e.assertPayoutPaysRegisteredScript;exports.assertReturnedGraphMatchesFingerprint=e.assertReturnedGraphMatchesFingerprint;exports.assertStandardPayoutScriptsAtEpochs=e.assertStandardPayoutScriptsAtEpochs;exports.assertTermsMatchVault=e.assertTermsMatchVault;exports.assertVaultProviderHintAccepted=e.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=e.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.claimExpiredVault=e.claimExpiredVault;exports.copyAssertConnectorLeaf=e.copyAssertConnectorLeaf;exports.deriveClaimerWotsKeypair=e.deriveClaimerWotsKeypair;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.fingerprintReturnedGraph=e.fingerprintReturnedGraph;exports.isApplicationEntryPointMismatchError=e.isApplicationEntryPointMismatchError;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isHintAccepted=e.isHintAccepted;exports.isParticipantKeyDriftError=e.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=e.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=e.isPeginRegistrationNotFinalError;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.isUnsupportedPayoutScriptError=e.isUnsupportedPayoutScriptError;exports.matchKeyHint=e.matchKeyHint;exports.matchKeySetHint=e.matchKeySetHint;exports.planDelegatedClaimSigning=e.planDelegatedClaimSigning;exports.readDelegatedClaimVaultContext=e.readDelegatedClaimVaultContext;exports.readRefundPrePeginContext=e.readRefundPrePeginContext;exports.readStampedParticipantKeys=e.readStampedParticipantKeys;exports.resolveCurrentParticipantKeys=e.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=e.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDelegatedClaimPlan=e.signDelegatedClaimPlan;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.summarizeWatchtowerArtifacts=e.summarizeWatchtowerArtifacts;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=e.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=e.waitForPeginRegistrationDepth;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=g.ContractStatus;exports.PeginAction=g.PeginAction;exports.activationDeadlineBlocksRemaining=g.activationDeadlineBlocksRemaining;exports.canPerformAction=g.canPerformAction;exports.getPeginProtocolState=g.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=g.isActivationDeadlinePassedOnChain;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|