@babylonlabs-io/ts-sdk 0.27.1 → 0.28.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/PeginManager-Da4uSHzl.cjs +2 -0
- package/dist/PeginManager-Da4uSHzl.cjs.map +1 -0
- package/dist/{context-ktqanzXE.js → PeginManager-DzMSIQ0I.js} +1100 -1058
- package/dist/PeginManager-DzMSIQ0I.js.map +1 -0
- package/dist/buildAndBroadcastRefund-DkEpTFkv.cjs +2 -0
- package/dist/buildAndBroadcastRefund-DkEpTFkv.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-BzYJv-Fv.js → buildAndBroadcastRefund-xWS8frc6.js} +338 -348
- package/dist/buildAndBroadcastRefund-xWS8frc6.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +55 -55
- package/dist/sha2-6wN58S6R.js +280 -0
- package/dist/sha2-6wN58S6R.js.map +1 -0
- package/dist/sha2-CsTynrfJ.cjs +2 -0
- package/dist/sha2-CsTynrfJ.cjs.map +1 -0
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/wallets/index.d.ts +2 -1
- package/dist/shared/wallets/index.d.ts.map +1 -1
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts +8 -0
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts.map +1 -1
- package/dist/signing-BZigafm0.js.map +1 -1
- package/dist/signing-DHSXjhLM.cjs.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +80 -70
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +52 -52
- package/dist/tbv/core/managers/PeginManager.d.ts +64 -27
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.d.ts +1 -1
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts +1 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/validation.d.ts +0 -4
- package/dist/tbv/core/services/deposit/validation.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +1 -1
- package/dist/tbv/core/vault-secrets/__tests__/deriveVaultRoot.test.d.ts +13 -0
- package/dist/tbv/core/vault-secrets/__tests__/deriveVaultRoot.test.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/context.d.ts +9 -0
- package/dist/tbv/core/vault-secrets/context.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts +56 -0
- package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/expand.d.ts +18 -3
- package/dist/tbv/core/vault-secrets/expand.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/index.d.ts +6 -3
- package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
- package/dist/tbv/core/wots/blockDerivation.d.ts +20 -24
- package/dist/tbv/core/wots/blockDerivation.d.ts.map +1 -1
- package/dist/tbv/core/wots/errors.d.ts +3 -1
- package/dist/tbv/core/wots/errors.d.ts.map +1 -1
- package/dist/tbv/core/wots/index.d.ts +1 -2
- package/dist/tbv/core/wots/index.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +52 -52
- package/dist/testing/MockBitcoinWallet.d.ts +10 -3
- package/dist/testing/MockBitcoinWallet.d.ts.map +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +67 -55
- package/dist/testing/index.js.map +1 -1
- package/dist/types-CnG3JsRs.js +680 -0
- package/dist/types-CnG3JsRs.js.map +1 -0
- package/dist/types-jmEyzzhY.cjs +2 -0
- package/dist/types-jmEyzzhY.cjs.map +1 -0
- package/dist/{vault-registry-reader-CpCOte7w.js → vault-registry-reader-BywZhqJL.js} +65 -64
- package/dist/{vault-registry-reader-CpCOte7w.js.map → vault-registry-reader-BywZhqJL.js.map} +1 -1
- package/dist/vault-registry-reader-DdruADqa.cjs +2 -0
- package/dist/{vault-registry-reader-BizmBSBV.cjs.map → vault-registry-reader-DdruADqa.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/buildAndBroadcastRefund-BEASMFsz.cjs +0 -2
- package/dist/buildAndBroadcastRefund-BEASMFsz.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-BzYJv-Fv.js.map +0 -1
- package/dist/context-B4fYDTxy.cjs +0 -2
- package/dist/context-B4fYDTxy.cjs.map +0 -1
- package/dist/context-ktqanzXE.js.map +0 -1
- package/dist/sha2-1XZuToHP.cjs +0 -2
- package/dist/sha2-1XZuToHP.cjs.map +0 -1
- package/dist/sha2-ZzfZqQSw.js +0 -1123
- package/dist/sha2-ZzfZqQSw.js.map +0 -1
- package/dist/tbv/core/wots/deriveWotsPkHash.d.ts +0 -9
- package/dist/tbv/core/wots/deriveWotsPkHash.d.ts.map +0 -1
- package/dist/vault-registry-reader-BizmBSBV.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signing-BZigafm0.js","sources":["../src/tbv/core/services/deposit/peginState.ts","../src/tbv/core/utils/signing.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-7). 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\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-enter mnemonic) */\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 /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\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\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 } = 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 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 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 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","import type { SignPsbtOptions } from \"../../../shared/wallets/interfaces\";\n\n/**\n * Create SignPsbtOptions for Taproot script-path PSBT signing.\n *\n * All vault protocol signing operations are Taproot script-path spends that\n * require `useTweakedSigner: false` (untweaked key) and `autoFinalized: false`\n * (to preserve tapScriptSig for Schnorr signature extraction).\n *\n * @param publicKey - Signer's BTC public key (hex). Accepts both compressed\n * (66-char) and x-only (64-char) formats — the wallet connector handles both.\n * @param inputCount - Number of inputs to sign. Generates entries\n * for indices 0 through inputCount-1.\n */\nexport function createTaprootScriptPathSignOptions(\n publicKey: string,\n inputCount: number,\n): SignPsbtOptions {\n if (!Number.isInteger(inputCount) || inputCount < 1) {\n throw new Error(`inputCount must be a positive integer, got ${inputCount}`);\n }\n\n return {\n autoFinalized: false,\n signInputs: Array.from({ length: inputCount }, (_, i) => ({\n index: i,\n publicKey,\n useTweakedSigner: false,\n })),\n };\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","canPerformAction","state","action","createTaprootScriptPathSignOptions","publicKey","inputCount","_","i"],"mappings":"AAeO,IAAKA,sBAAAA,OAEVA,EAAAA,EAAA,UAAU,CAAA,IAAV,WAEAA,EAAAA,EAAA,WAAW,CAAA,IAAX,YAEAA,EAAAA,EAAA,SAAS,CAAA,IAAT,UAEAA,EAAAA,EAAA,WAAW,CAAA,IAAX,YAEAA,EAAAA,EAAA,aAAa,CAAA,IAAb,cAEAA,EAAAA,EAAA,UAAU,CAAA,IAAV,WAEAA,EAAAA,EAAA,sBAAsB,CAAA,IAAtB,uBAEAA,EAAAA,EAAA,UAAU,CAAA,IAAV,WAhBUA,IAAAA,KAAA,CAAA,CAAA,GAgCAC,sBAAAA,OAEVA,EAAA,kBAAkB,mBAElBA,EAAA,2BAA2B,4BAE3BA,EAAA,gCAAgC,iCAEhCA,EAAA,iBAAiB,kBAEjBA,EAAA,cAAc,eAVJA,IAAAA,KAAA,CAAA,CAAA;AA4DL,SAASC,EACdC,GACAC,IAAwC,IACpB;AACpB,QAAM;AAAA,IACJ,mBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,4BAAAC;AAAA,EAAA,IACEL;AAEJ,SAAID,MAAmB,IACjBM,IACK,EAAE,gBAAAN,GAAgB,kBAAkB,GAAC,IAG1CG,IACK;AAAA,IACL,gBAAAH;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAA2B,IAI9CI,MAAqB,MAAQ,CAACF,IACzB;AAAA,IACL,gBAAAF;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAAyC,IAI5DI,MAAqB,UAAa,CAACF,IAC9B,EAAE,gBAAAF,GAAgB,kBAAkB,GAAC,IAGzCE,IAIE;AAAA,IACL,gBAAAF;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAAoC,IALhD,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAS5CA,MAAmB,IACd;AAAA,IACL,gBAAAA;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAA0B,IAI7CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd;AAAA,IACL,gBAAAA;AAAA,IACA,kBAAkBK,IAAY;AAAA,MAAC;AAAA;AAAA,QAA2B,CAAA;AAAA,EAAC,IAI3DL,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAGvC,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC;AAC9C;AAKO,SAASO,EACdC,GACAC,GACS;AACT,SAAOD,EAAM,iBAAiB,SAASC,CAAM;AAC/C;ACvLO,SAASC,EACdC,GACAC,GACiB;AACjB,MAAI,CAAC,OAAO,UAAUA,CAAU,KAAKA,IAAa;AAChD,UAAM,IAAI,MAAM,8CAA8CA,CAAU,EAAE;AAG5E,SAAO;AAAA,IACL,eAAe;AAAA,IACf,YAAY,MAAM,KAAK,EAAE,QAAQA,KAAc,CAACC,GAAGC,OAAO;AAAA,MACxD,OAAOA;AAAA,MACP,WAAAH;AAAA,MACA,kBAAkB;AAAA,IAAA,EAClB;AAAA,EAAA;AAEN;"}
|
|
1
|
+
{"version":3,"file":"signing-BZigafm0.js","sources":["../src/tbv/core/services/deposit/peginState.ts","../src/tbv/core/utils/signing.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-7). 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\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 /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\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\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 } = 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 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 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 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","import type { SignPsbtOptions } from \"../../../shared/wallets/interfaces\";\n\n/**\n * Create SignPsbtOptions for Taproot script-path PSBT signing.\n *\n * All vault protocol signing operations are Taproot script-path spends that\n * require `useTweakedSigner: false` (untweaked key) and `autoFinalized: false`\n * (to preserve tapScriptSig for Schnorr signature extraction).\n *\n * @param publicKey - Signer's BTC public key (hex). Accepts both compressed\n * (66-char) and x-only (64-char) formats — the wallet connector handles both.\n * @param inputCount - Number of inputs to sign. Generates entries\n * for indices 0 through inputCount-1.\n */\nexport function createTaprootScriptPathSignOptions(\n publicKey: string,\n inputCount: number,\n): SignPsbtOptions {\n if (!Number.isInteger(inputCount) || inputCount < 1) {\n throw new Error(`inputCount must be a positive integer, got ${inputCount}`);\n }\n\n return {\n autoFinalized: false,\n signInputs: Array.from({ length: inputCount }, (_, i) => ({\n index: i,\n publicKey,\n useTweakedSigner: false,\n })),\n };\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","canPerformAction","state","action","createTaprootScriptPathSignOptions","publicKey","inputCount","_","i"],"mappings":"AAeO,IAAKA,sBAAAA,OAEVA,EAAAA,EAAA,UAAU,CAAA,IAAV,WAEAA,EAAAA,EAAA,WAAW,CAAA,IAAX,YAEAA,EAAAA,EAAA,SAAS,CAAA,IAAT,UAEAA,EAAAA,EAAA,WAAW,CAAA,IAAX,YAEAA,EAAAA,EAAA,aAAa,CAAA,IAAb,cAEAA,EAAAA,EAAA,UAAU,CAAA,IAAV,WAEAA,EAAAA,EAAA,sBAAsB,CAAA,IAAtB,uBAEAA,EAAAA,EAAA,UAAU,CAAA,IAAV,WAhBUA,IAAAA,KAAA,CAAA,CAAA,GAgCAC,sBAAAA,OAEVA,EAAA,kBAAkB,mBAElBA,EAAA,2BAA2B,4BAE3BA,EAAA,gCAAgC,iCAEhCA,EAAA,iBAAiB,kBAEjBA,EAAA,cAAc,eAVJA,IAAAA,KAAA,CAAA,CAAA;AA4DL,SAASC,EACdC,GACAC,IAAwC,IACpB;AACpB,QAAM;AAAA,IACJ,mBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,4BAAAC;AAAA,EAAA,IACEL;AAEJ,SAAID,MAAmB,IACjBM,IACK,EAAE,gBAAAN,GAAgB,kBAAkB,GAAC,IAG1CG,IACK;AAAA,IACL,gBAAAH;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAA2B,IAI9CI,MAAqB,MAAQ,CAACF,IACzB;AAAA,IACL,gBAAAF;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAAyC,IAI5DI,MAAqB,UAAa,CAACF,IAC9B,EAAE,gBAAAF,GAAgB,kBAAkB,GAAC,IAGzCE,IAIE;AAAA,IACL,gBAAAF;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAAoC,IALhD,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAS5CA,MAAmB,IACd;AAAA,IACL,gBAAAA;AAAA,IACA,kBAAkB;AAAA,MAAC;AAAA;AAAA,IAAA;AAAA,EAA0B,IAI7CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd;AAAA,IACL,gBAAAA;AAAA,IACA,kBAAkBK,IAAY;AAAA,MAAC;AAAA;AAAA,QAA2B,CAAA;AAAA,EAAC,IAI3DL,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAG1CA,MAAmB,IACd,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC,IAGvC,EAAE,gBAAAA,GAAgB,kBAAkB,GAAC;AAC9C;AAKO,SAASO,EACdC,GACAC,GACS;AACT,SAAOD,EAAM,iBAAiB,SAASC,CAAM;AAC/C;ACvLO,SAASC,EACdC,GACAC,GACiB;AACjB,MAAI,CAAC,OAAO,UAAUA,CAAU,KAAKA,IAAa;AAChD,UAAM,IAAI,MAAM,8CAA8CA,CAAU,EAAE;AAG5E,SAAO;AAAA,IACL,eAAe;AAAA,IACf,YAAY,MAAM,KAAK,EAAE,QAAQA,KAAc,CAACC,GAAGC,OAAO;AAAA,MACxD,OAAOA;AAAA,MACP,WAAAH;AAAA,MACA,kBAAkB;AAAA,IAAA,EAClB;AAAA,EAAA;AAEN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signing-DHSXjhLM.cjs","sources":["../src/tbv/core/services/deposit/peginState.ts","../src/tbv/core/utils/signing.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-7). 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\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-enter mnemonic) */\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 /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\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\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 } = 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 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 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 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","import type { SignPsbtOptions } from \"../../../shared/wallets/interfaces\";\n\n/**\n * Create SignPsbtOptions for Taproot script-path PSBT signing.\n *\n * All vault protocol signing operations are Taproot script-path spends that\n * require `useTweakedSigner: false` (untweaked key) and `autoFinalized: false`\n * (to preserve tapScriptSig for Schnorr signature extraction).\n *\n * @param publicKey - Signer's BTC public key (hex). Accepts both compressed\n * (66-char) and x-only (64-char) formats — the wallet connector handles both.\n * @param inputCount - Number of inputs to sign. Generates entries\n * for indices 0 through inputCount-1.\n */\nexport function createTaprootScriptPathSignOptions(\n publicKey: string,\n inputCount: number,\n): SignPsbtOptions {\n if (!Number.isInteger(inputCount) || inputCount < 1) {\n throw new Error(`inputCount must be a positive integer, got ${inputCount}`);\n }\n\n return {\n autoFinalized: false,\n signInputs: Array.from({ length: inputCount }, (_, i) => ({\n index: i,\n publicKey,\n useTweakedSigner: false,\n })),\n };\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","canPerformAction","state","action","createTaprootScriptPathSignOptions","publicKey","inputCount","_","i"],"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,UAhBUA,IAAAA,GAAA,CAAA,CAAA,EAgCAC,GAAAA,IAEVA,EAAA,gBAAkB,kBAElBA,EAAA,yBAA2B,2BAE3BA,EAAA,8BAAgC,gCAEhCA,EAAA,eAAiB,iBAEjBA,EAAA,YAAc,cAVJA,IAAAA,GAAA,CAAA,CAAA,EA4DL,SAASC,EACdC,EACAC,EAAwC,GACpB,CACpB,KAAM,CACJ,kBAAAC,EACA,aAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,2BAAAC,CAAA,EACEL,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,EACd,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,EACd,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,EAGvC,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,CAC9C,CAKO,SAASO,EACdC,EACAC,EACS,CACT,OAAOD,EAAM,iBAAiB,SAASC,CAAM,CAC/C,CCvLO,SAASC,EACdC,EACAC,EACiB,CACjB,GAAI,CAAC,OAAO,UAAUA,CAAU,GAAKA,EAAa,EAChD,MAAM,IAAI,MAAM,8CAA8CA,CAAU,EAAE,EAG5E,MAAO,CACL,cAAe,GACf,WAAY,MAAM,KAAK,CAAE,OAAQA,GAAc,CAACC,EAAGC,KAAO,CACxD,MAAOA,EACP,UAAAH,EACA,iBAAkB,EAAA,EAClB,CAAA,CAEN"}
|
|
1
|
+
{"version":3,"file":"signing-DHSXjhLM.cjs","sources":["../src/tbv/core/services/deposit/peginState.ts","../src/tbv/core/utils/signing.ts"],"sourcesContent":["// ============================================================================\n// State Definitions\n// ============================================================================\n\n/**\n * Vault status — combines on-chain contract status (0-4) with indexer-derived\n * statuses (5-7). 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\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 /** Sign and broadcast HTLC refund transaction for an expired vault */\n REFUND_HTLC = \"REFUND_HTLC\",\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\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 } = 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 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 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 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","import type { SignPsbtOptions } from \"../../../shared/wallets/interfaces\";\n\n/**\n * Create SignPsbtOptions for Taproot script-path PSBT signing.\n *\n * All vault protocol signing operations are Taproot script-path spends that\n * require `useTweakedSigner: false` (untweaked key) and `autoFinalized: false`\n * (to preserve tapScriptSig for Schnorr signature extraction).\n *\n * @param publicKey - Signer's BTC public key (hex). Accepts both compressed\n * (66-char) and x-only (64-char) formats — the wallet connector handles both.\n * @param inputCount - Number of inputs to sign. Generates entries\n * for indices 0 through inputCount-1.\n */\nexport function createTaprootScriptPathSignOptions(\n publicKey: string,\n inputCount: number,\n): SignPsbtOptions {\n if (!Number.isInteger(inputCount) || inputCount < 1) {\n throw new Error(`inputCount must be a positive integer, got ${inputCount}`);\n }\n\n return {\n autoFinalized: false,\n signInputs: Array.from({ length: inputCount }, (_, i) => ({\n index: i,\n publicKey,\n useTweakedSigner: false,\n })),\n };\n}\n"],"names":["ContractStatus","PeginAction","getPeginProtocolState","contractStatus","options","transactionsReady","needsWotsKey","pendingIngestion","canRefund","hasProviderTerminalFailure","canPerformAction","state","action","createTaprootScriptPathSignOptions","publicKey","inputCount","_","i"],"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,UAhBUA,IAAAA,GAAA,CAAA,CAAA,EAgCAC,GAAAA,IAEVA,EAAA,gBAAkB,kBAElBA,EAAA,yBAA2B,2BAE3BA,EAAA,8BAAgC,gCAEhCA,EAAA,eAAiB,iBAEjBA,EAAA,YAAc,cAVJA,IAAAA,GAAA,CAAA,CAAA,EA4DL,SAASC,EACdC,EACAC,EAAwC,GACpB,CACpB,KAAM,CACJ,kBAAAC,EACA,aAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,2BAAAC,CAAA,EACEL,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,EACd,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,EACd,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,EAGvC,CAAE,eAAAA,EAAgB,iBAAkB,EAAC,CAC9C,CAKO,SAASO,EACdC,EACAC,EACS,CACT,OAAOD,EAAM,iBAAiB,SAASC,CAAM,CAC/C,CCvLO,SAASC,EACdC,EACAC,EACiB,CACjB,GAAI,CAAC,OAAO,UAAUA,CAAU,GAAKA,EAAa,EAChD,MAAM,IAAI,MAAM,8CAA8CA,CAAU,EAAE,EAG5E,MAAO,CACL,cAAe,GACf,WAAY,MAAM,KAAK,CAAE,OAAQA,GAAc,CAACC,EAAGC,KAAO,CACxD,MAAOA,EACP,UAAAH,EACA,iBAAkB,EAAA,EAClB,CAAA,CAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault-registry-reader.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/eth/vault-registry-reader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAGvD,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAE/D,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,eAAe;gBADf,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO;IAG5B,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"vault-registry-reader.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/eth/vault-registry-reader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAGvD,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAE/D,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,eAAe;gBADf,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO;IAG5B,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC;IA2BxD,oBAAoB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAmC9D,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC;CAiBrD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../vault-registry-reader-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../vault-registry-reader-DdruADqa.cjs"),r=require("../../../types-jmEyzzhY.cjs");exports.MEMPOOL_API_URLS=e.MEMPOOL_API_URLS;exports.ServerIdentityError=e.ServerIdentityError;exports.VaultProviderRpcClient=e.VaultProviderRpcClient;exports.ViemProtocolParamsReader=e.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=e.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=e.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=e.ViemVaultRegistryReader;exports.VpResponseValidationError=e.VpResponseValidationError;exports.VpTokenProvider=e.VpTokenProvider;exports.getAddressTxs=e.getAddressTxs;exports.getAddressUtxos=e.getAddressUtxos;exports.getMempoolApiUrl=e.getMempoolApiUrl;exports.getNetworkFees=e.getNetworkFees;exports.getTxHex=e.getTxHex;exports.getTxInfo=e.getTxInfo;exports.getUtxoInfo=e.getUtxoInfo;exports.pushTx=e.pushTx;exports.resolveProtocolAddresses=e.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=e.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=e.verifyServerIdentity;exports.DaemonStatus=r.DaemonStatus;exports.JSON_RPC_ERROR_CODES=r.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=r.JsonRpcClient;exports.JsonRpcError=r.JsonRpcError;exports.POST_WOTS_STATUSES=r.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=r.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=r.RpcErrorCode;exports.VP_TERMINAL_STATUSES=r.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=r.VP_TRANSIENT_STATUSES;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as a, S as r, V as o, k as t, l as S, m as R, n as i, h as T, j as d, g as l, a as n, b as p, c as E, d as P, e as V, f as _, p as A, r as m, v as g, i as c } from "../../../vault-registry-reader-
|
|
2
|
-
import { D as x, b as I, J as O, a as U, d as f, P as C, R as u, c as N, V as D } from "../../../
|
|
1
|
+
import { M as a, S as r, V as o, k as t, l as S, m as R, n as i, h as T, j as d, g as l, a as n, b as p, c as E, d as P, e as V, f as _, p as A, r as m, v as g, i as c } from "../../../vault-registry-reader-BywZhqJL.js";
|
|
2
|
+
import { D as x, b as I, J as O, a as U, d as f, P as C, R as u, c as N, V as D } from "../../../types-CnG3JsRs.js";
|
|
3
3
|
export {
|
|
4
4
|
x as DaemonStatus,
|
|
5
5
|
I as JSON_RPC_ERROR_CODES,
|
|
@@ -214,33 +214,38 @@ export declare const BTCVaultRegistryABI: readonly [{
|
|
|
214
214
|
readonly internalType: "bytes32";
|
|
215
215
|
}];
|
|
216
216
|
readonly outputs: readonly [{
|
|
217
|
-
readonly name: "
|
|
218
|
-
readonly type: "
|
|
219
|
-
readonly internalType: "
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
217
|
+
readonly name: "vBasic";
|
|
218
|
+
readonly type: "tuple";
|
|
219
|
+
readonly internalType: "struct BTCVaultTypes.BTCVaultBasicInfo";
|
|
220
|
+
readonly components: readonly [{
|
|
221
|
+
readonly name: "depositor";
|
|
222
|
+
readonly type: "address";
|
|
223
|
+
readonly internalType: "address";
|
|
224
|
+
}, {
|
|
225
|
+
readonly name: "depositorBtcPubKey";
|
|
226
|
+
readonly type: "bytes32";
|
|
227
|
+
readonly internalType: "bytes32";
|
|
228
|
+
}, {
|
|
229
|
+
readonly name: "amount";
|
|
230
|
+
readonly type: "uint256";
|
|
231
|
+
readonly internalType: "uint256";
|
|
232
|
+
}, {
|
|
233
|
+
readonly name: "vaultProvider";
|
|
234
|
+
readonly type: "address";
|
|
235
|
+
readonly internalType: "address";
|
|
236
|
+
}, {
|
|
237
|
+
readonly name: "status";
|
|
238
|
+
readonly type: "uint8";
|
|
239
|
+
readonly internalType: "enum IBTCVaultRegistry.BTCVaultStatus";
|
|
240
|
+
}, {
|
|
241
|
+
readonly name: "applicationEntryPoint";
|
|
242
|
+
readonly type: "address";
|
|
243
|
+
readonly internalType: "address";
|
|
244
|
+
}, {
|
|
245
|
+
readonly name: "createdAt";
|
|
246
|
+
readonly type: "uint256";
|
|
247
|
+
readonly internalType: "uint256";
|
|
248
|
+
}];
|
|
244
249
|
}];
|
|
245
250
|
readonly stateMutability: "view";
|
|
246
251
|
}, {
|
|
@@ -292,49 +297,54 @@ export declare const BTCVaultRegistryABI: readonly [{
|
|
|
292
297
|
readonly internalType: "bytes32";
|
|
293
298
|
}];
|
|
294
299
|
readonly outputs: readonly [{
|
|
295
|
-
readonly name: "
|
|
296
|
-
readonly type: "
|
|
297
|
-
readonly internalType: "
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
300
|
+
readonly name: "vProtocol";
|
|
301
|
+
readonly type: "tuple";
|
|
302
|
+
readonly internalType: "struct BTCVaultRegistryTypes.BTCVaultProtocolInfo";
|
|
303
|
+
readonly components: readonly [{
|
|
304
|
+
readonly name: "depositorSignedPeginTx";
|
|
305
|
+
readonly type: "bytes";
|
|
306
|
+
readonly internalType: "bytes";
|
|
307
|
+
}, {
|
|
308
|
+
readonly name: "universalChallengersVersion";
|
|
309
|
+
readonly type: "uint16";
|
|
310
|
+
readonly internalType: "uint16";
|
|
311
|
+
}, {
|
|
312
|
+
readonly name: "appVaultKeepersVersion";
|
|
313
|
+
readonly type: "uint16";
|
|
314
|
+
readonly internalType: "uint16";
|
|
315
|
+
}, {
|
|
316
|
+
readonly name: "offchainParamsVersion";
|
|
317
|
+
readonly type: "uint16";
|
|
318
|
+
readonly internalType: "uint16";
|
|
319
|
+
}, {
|
|
320
|
+
readonly name: "verifiedAt";
|
|
321
|
+
readonly type: "uint256";
|
|
322
|
+
readonly internalType: "uint256";
|
|
323
|
+
}, {
|
|
324
|
+
readonly name: "depositorWotsPkHash";
|
|
325
|
+
readonly type: "bytes32";
|
|
326
|
+
readonly internalType: "bytes32";
|
|
327
|
+
}, {
|
|
328
|
+
readonly name: "hashlock";
|
|
329
|
+
readonly type: "bytes32";
|
|
330
|
+
readonly internalType: "bytes32";
|
|
331
|
+
}, {
|
|
332
|
+
readonly name: "htlcVout";
|
|
333
|
+
readonly type: "uint8";
|
|
334
|
+
readonly internalType: "uint8";
|
|
335
|
+
}, {
|
|
336
|
+
readonly name: "depositorPopSignature";
|
|
337
|
+
readonly type: "bytes";
|
|
338
|
+
readonly internalType: "bytes";
|
|
339
|
+
}, {
|
|
340
|
+
readonly name: "prePeginTxHash";
|
|
341
|
+
readonly type: "bytes32";
|
|
342
|
+
readonly internalType: "bytes32";
|
|
343
|
+
}, {
|
|
344
|
+
readonly name: "vaultProviderCommissionBps";
|
|
345
|
+
readonly type: "uint16";
|
|
346
|
+
readonly internalType: "uint16";
|
|
347
|
+
}];
|
|
338
348
|
}];
|
|
339
349
|
readonly stateMutability: "view";
|
|
340
350
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BTCVaultRegistry.abi.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/contracts/abis/BTCVaultRegistry.abi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"BTCVaultRegistry.abi.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/contracts/abis/BTCVaultRegistry.abi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkZtB,CAAC"}
|
package/dist/tbv/core/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../challengeAssert-BM8m9gPM.cjs"),P=require("@babylonlabs-io/babylon-tbv-rust-wasm"),d=require("../../payout-DP6KMFP1.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../challengeAssert-BM8m9gPM.cjs"),P=require("@babylonlabs-io/babylon-tbv-rust-wasm"),d=require("../../payout-DP6KMFP1.cjs"),o=require("../../bitcoin-DIN0OupO.cjs"),l=require("../../signing-DHSXjhLM.cjs"),u=require("../../validation-u8W7Lp2x.cjs"),t=require("../../buildAndBroadcastRefund-DkEpTFkv.cjs"),a=require("../../fundPeginTransaction-DaWoYCgO.cjs"),i=require("../../psbtInputFields-CB8hqjQ5.cjs"),r=require("../../PeginManager-Da4uSHzl.cjs"),e=require("../../vault-registry-reader-DdruADqa.cjs"),s=require("../../types-jmEyzzhY.cjs");exports.buildChallengeAssertPsbt=n.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=n.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=n.buildNoPayoutPsbt;exports.buildPeginInputPsbt=n.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.extractPeginInputSignature=n.extractPeginInputSignature;exports.finalizePeginInputPsbt=n.finalizePeginInputPsbt;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>P.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>P.deriveVaultId});exports.buildPayoutPsbt=d.buildPayoutPsbt;exports.buildRefundPsbt=d.buildRefundPsbt;exports.createPayoutScript=d.createPayoutScript;exports.extractPayoutSignature=d.extractPayoutSignature;exports.deriveNativeSegwitAddress=o.deriveNativeSegwitAddress;exports.deriveTaprootAddress=o.deriveTaprootAddress;exports.ensureHexPrefix=o.ensureHexPrefix;exports.formatSatoshisToBtc=o.formatSatoshisToBtc;exports.getNetwork=o.getNetwork;exports.hexToUint8Array=o.hexToUint8Array;exports.isAddressFromPublicKey=o.isAddressFromPublicKey;exports.isValidHex=o.isValidHex;exports.processPublicKeyToXOnly=o.processPublicKeyToXOnly;exports.stripHexPrefix=o.stripHexPrefix;exports.toXOnly=o.toXOnly;exports.uint8ArrayToHex=o.uint8ArrayToHex;exports.validateWalletPubkey=o.validateWalletPubkey;exports.ContractStatus=l.ContractStatus;exports.PeginAction=l.PeginAction;exports.canPerformAction=l.canPerformAction;exports.createTaprootScriptPathSignOptions=l.createTaprootScriptPathSignOptions;exports.getPeginProtocolState=l.getPeginProtocolState;exports.BITCOIN_ADDRESS_RE=u.BITCOIN_ADDRESS_RE;exports.HEX_RE=u.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=u.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=u.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=u.TXID_RE;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.PayoutManager=t.PayoutManager;exports.activateVault=t.activateVault;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.computeHashlock=t.computeHashlock;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.pollAndSignPayouts=t.pollAndSignPayouts;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateSecretAgainstHashlock=t.validateSecretAgainstHashlock;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.waitForPeginStatus=t.waitForPeginStatus;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.BitcoinScriptType=i.BitcoinScriptType;exports.UtxoNotAvailableError=i.UtxoNotAvailableError;exports.assertUtxosAvailable=i.assertUtxosAvailable;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.collectReservedUtxoRefs=i.collectReservedUtxoRefs;exports.extractInputsFromTransaction=i.extractInputsFromTransaction;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForDeposit=i.selectUtxosForDeposit;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.validateUtxosAvailable=i.validateUtxosAvailable;exports.CONTRACT_ERRORS=r.CONTRACT_ERRORS;exports.PeginManager=r.PeginManager;exports.VAULT_APP_NAME=r.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=r.buildFundingOutpointsCommitment;exports.buildVaultContext=r.buildVaultContext;exports.computeWotsBlockPublicKeysHash=r.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=r.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=r.deriveWotsBlocksFromSeed;exports.expandAuthAnchor=r.expandAuthAnchor;exports.expandHashlockSecret=r.expandHashlockSecret;exports.expandWotsSeed=r.expandWotsSeed;exports.extractErrorData=r.extractErrorData;exports.getContractErrorMessage=r.getContractErrorMessage;exports.handleContractError=r.handleContractError;exports.isKnownContractError=r.isKnownContractError;exports.isWotsMismatchError=r.isWotsMismatchError;exports.ApplicationRegistryABI=e.ApplicationRegistryABI;exports.MEMPOOL_API_URLS=e.MEMPOOL_API_URLS;exports.ProtocolParamsABI=e.ProtocolParamsABI;exports.ServerIdentityError=e.ServerIdentityError;exports.VaultProviderRpcClient=e.VaultProviderRpcClient;exports.ViemProtocolParamsReader=e.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=e.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=e.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=e.ViemVaultRegistryReader;exports.VpResponseValidationError=e.VpResponseValidationError;exports.VpTokenProvider=e.VpTokenProvider;exports.getAddressTxs=e.getAddressTxs;exports.getAddressUtxos=e.getAddressUtxos;exports.getMempoolApiUrl=e.getMempoolApiUrl;exports.getNetworkFees=e.getNetworkFees;exports.getTxHex=e.getTxHex;exports.getTxInfo=e.getTxInfo;exports.getUtxoInfo=e.getUtxoInfo;exports.pushTx=e.pushTx;exports.resolveProtocolAddresses=e.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=e.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=e.verifyServerIdentity;exports.BTCVaultRegistryABI=s.BTCVaultRegistryABI;exports.DaemonStatus=s.DaemonStatus;exports.JSON_RPC_ERROR_CODES=s.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=s.JsonRpcClient;exports.JsonRpcError=s.JsonRpcError;exports.POST_WOTS_STATUSES=s.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=s.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=s.RpcErrorCode;exports.VP_TERMINAL_STATUSES=s.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/core/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { i as e, g as t, h as r, d as o, a as i, b as n, c as l, e as u, f as d } from "../../challengeAssert-j2Vwqo0-.js";
|
|
2
2
|
import { computeMinClaimValue as c, deriveVaultId as T } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { a as S, b as
|
|
4
|
-
import { d as
|
|
5
|
-
import { C as F, P as B, a as D, c as
|
|
3
|
+
import { a as S, b as A, c as E, e as _ } from "../../payout-B_fvQU3q.js";
|
|
4
|
+
import { d as R, a as m, e as x, f as b, g as I, h as f, i as v, b as C, p as U, s as O, t as V, u as h, v as y } from "../../bitcoin-B-Y0DlqR.js";
|
|
5
|
+
import { C as F, P as B, a as D, c as M, g as H } from "../../signing-BZigafm0.js";
|
|
6
6
|
import { B as k, H as W, K as X, M as K, T as w } from "../../validation-CxqROCno.js";
|
|
7
|
-
import { B as Y, C as J, P as j, a as Z, m as z, h as q, i as Q, l as $, k as aa, p as sa, b as ea, s as ta, v as ra, g as oa, d as ia, c as na, j as la, e as ua, f as da, w as Pa } from "../../buildAndBroadcastRefund-
|
|
8
|
-
import { B as Ta, D as pa, F as Sa, L as
|
|
9
|
-
import { B as Oa, U as
|
|
10
|
-
import { C as Ka, P as wa,
|
|
11
|
-
import { A as is, M as ns, P as ls, S as us, V as ds, k as Ps, l as cs, m as Ts, n as ps, h as Ss, j as
|
|
12
|
-
import { B as Os, D as
|
|
7
|
+
import { B as Y, C as J, P as j, a as Z, m as z, h as q, i as Q, l as $, k as aa, p as sa, b as ea, s as ta, v as ra, g as oa, d as ia, c as na, j as la, e as ua, f as da, w as Pa } from "../../buildAndBroadcastRefund-xWS8frc6.js";
|
|
8
|
+
import { B as Ta, D as pa, F as Sa, L as Aa, M as Ea, P as _a, b as ga, a as Ra, S as ma, T as xa, W as ba, f as Ia, c as fa, p as va, r as Ca } from "../../fundPeginTransaction-oV-dNJOU.js";
|
|
9
|
+
import { B as Oa, U as Va, a as ha, f as ya, c as Na, e as Fa, g as Ba, i as Da, h as Ma, s as Ha, b as La, d as ka, v as Wa } from "../../psbtInputFields-DeTFSJOq.js";
|
|
10
|
+
import { C as Ka, P as wa, V as Ga, k as Ya, l as Ja, c as ja, m as Za, d as za, b as qa, f as Qa, j as $a, e as as, g as ss, h as es, i as ts, a as rs } from "../../PeginManager-DzMSIQ0I.js";
|
|
11
|
+
import { A as is, M as ns, P as ls, S as us, V as ds, k as Ps, l as cs, m as Ts, n as ps, h as Ss, j as As, g as Es, a as _s, b as gs, c as Rs, d as ms, e as xs, f as bs, p as Is, r as fs, v as vs, i as Cs } from "../../vault-registry-reader-BywZhqJL.js";
|
|
12
|
+
import { B as Os, D as Vs, b as hs, J as ys, a as Ns, d as Fs, P as Bs, R as Ds, c as Ms, V as Hs } from "../../types-CnG3JsRs.js";
|
|
13
13
|
export {
|
|
14
14
|
is as ApplicationRegistryABI,
|
|
15
15
|
Y as BIP68NotMatureError,
|
|
@@ -21,20 +21,20 @@ export {
|
|
|
21
21
|
J as ClaimerPegoutStatusValue,
|
|
22
22
|
F as ContractStatus,
|
|
23
23
|
pa as DUST_THRESHOLD,
|
|
24
|
-
|
|
24
|
+
Vs as DaemonStatus,
|
|
25
25
|
Sa as FEE_SAFETY_MARGIN,
|
|
26
26
|
W as HEX_RE,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
hs as JSON_RPC_ERROR_CODES,
|
|
28
|
+
ys as JsonRpcClient,
|
|
29
29
|
Ns as JsonRpcError,
|
|
30
30
|
X as KNOWN_SCRIPT_PREFIXES,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
Aa as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
32
|
+
Ea as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
33
33
|
K as MAX_REASONABLE_FEE_SATS,
|
|
34
34
|
ns as MEMPOOL_API_URLS,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
_a as P2TR_INPUT_SIZE,
|
|
36
|
+
ga as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
37
|
+
Ra as PEGIN_FIXED_OUTPUTS,
|
|
38
38
|
Fs as POST_WOTS_STATUSES,
|
|
39
39
|
Bs as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
40
40
|
j as PayoutManager,
|
|
@@ -46,78 +46,78 @@ export {
|
|
|
46
46
|
us as ServerIdentityError,
|
|
47
47
|
w as TXID_RE,
|
|
48
48
|
xa as TX_BUFFER_SIZE_OVERHEAD,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Ms as
|
|
49
|
+
Va as UtxoNotAvailableError,
|
|
50
|
+
Ga as VAULT_APP_NAME,
|
|
51
|
+
Ms as VP_TERMINAL_STATUSES,
|
|
52
|
+
Hs as VP_TRANSIENT_STATUSES,
|
|
52
53
|
ds as VaultProviderRpcClient,
|
|
53
54
|
Ps as ViemProtocolParamsReader,
|
|
54
55
|
cs as ViemUniversalChallengerReader,
|
|
55
56
|
Ts as ViemVaultKeeperReader,
|
|
56
57
|
ps as ViemVaultRegistryReader,
|
|
57
58
|
Ss as VpResponseValidationError,
|
|
58
|
-
|
|
59
|
+
As as VpTokenProvider,
|
|
59
60
|
ba as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
60
61
|
Z as activateVault,
|
|
61
|
-
|
|
62
|
+
ha as assertUtxosAvailable,
|
|
62
63
|
z as buildAndBroadcastRefund,
|
|
63
64
|
e as buildChallengeAssertPsbt,
|
|
64
65
|
t as buildDepositorPayoutPsbt,
|
|
65
|
-
|
|
66
|
+
Ya as buildFundingOutpointsCommitment,
|
|
66
67
|
r as buildNoPayoutPsbt,
|
|
67
68
|
S as buildPayoutPsbt,
|
|
68
69
|
o as buildPeginInputPsbt,
|
|
69
70
|
i as buildPeginTxFromFundedPrePegin,
|
|
70
71
|
n as buildPrePeginPsbt,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
A as buildRefundPsbt,
|
|
73
|
+
Ja as buildVaultContext,
|
|
74
|
+
ya as calculateBtcTxHash,
|
|
74
75
|
D as canPerformAction,
|
|
75
76
|
Na as collectReservedUtxoRefs,
|
|
76
77
|
q as computeHashlock,
|
|
77
78
|
c as computeMinClaimValue,
|
|
78
79
|
l as computeNumLocalChallengers,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
ja as computeWotsBlockPublicKeysHash,
|
|
81
|
+
E as createPayoutScript,
|
|
82
|
+
M as createTaprootScriptPathSignOptions,
|
|
83
|
+
R as deriveNativeSegwitAddress,
|
|
83
84
|
m as deriveTaprootAddress,
|
|
84
85
|
T as deriveVaultId,
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
Za as deriveVaultRoot,
|
|
87
|
+
za as deriveWotsBlocksFromSeed,
|
|
87
88
|
x as ensureHexPrefix,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
qa as expandAuthAnchor,
|
|
90
|
+
Qa as expandHashlockSecret,
|
|
91
|
+
$a as expandWotsSeed,
|
|
92
|
+
as as extractErrorData,
|
|
92
93
|
Fa as extractInputsFromTransaction,
|
|
93
|
-
|
|
94
|
+
_ as extractPayoutSignature,
|
|
94
95
|
u as extractPeginInputSignature,
|
|
95
96
|
d as finalizePeginInputPsbt,
|
|
96
97
|
b as formatSatoshisToBtc,
|
|
97
98
|
Ia as fundPeginTransaction,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
Es as getAddressTxs,
|
|
100
|
+
_s as getAddressUtxos,
|
|
101
|
+
ss as getContractErrorMessage,
|
|
101
102
|
Ba as getDustThreshold,
|
|
102
|
-
|
|
103
|
+
gs as getMempoolApiUrl,
|
|
103
104
|
I as getNetwork,
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
Rs as getNetworkFees,
|
|
106
|
+
H as getPeginProtocolState,
|
|
106
107
|
Da as getPsbtInputFields,
|
|
107
|
-
|
|
108
|
+
Ma as getScriptType,
|
|
108
109
|
ms as getTxHex,
|
|
109
110
|
xs as getTxInfo,
|
|
110
111
|
bs as getUtxoInfo,
|
|
111
|
-
|
|
112
|
+
es as handleContractError,
|
|
112
113
|
f as hexToUint8Array,
|
|
113
114
|
v as isAddressFromPublicKey,
|
|
114
115
|
Q as isDepositAmountValid,
|
|
115
|
-
|
|
116
|
+
ts as isKnownContractError,
|
|
116
117
|
$ as isPegoutTerminalStatus,
|
|
117
118
|
aa as isRecognizedPegoutStatus,
|
|
118
119
|
C as isValidHex,
|
|
119
|
-
|
|
120
|
-
rs as mnemonicToWotsSeed,
|
|
120
|
+
rs as isWotsMismatchError,
|
|
121
121
|
fa as parseUnfundedWasmTransaction,
|
|
122
122
|
va as peginOutputCount,
|
|
123
123
|
sa as pollAndSignPayouts,
|
|
@@ -125,14 +125,14 @@ export {
|
|
|
125
125
|
Is as pushTx,
|
|
126
126
|
Ca as rateBasedTxBufferFee,
|
|
127
127
|
fs as resolveProtocolAddresses,
|
|
128
|
-
|
|
128
|
+
Ha as selectUtxosForDeposit,
|
|
129
129
|
La as selectUtxosForPegin,
|
|
130
130
|
ka as shouldAddChangeOutput,
|
|
131
131
|
ea as signDepositorGraph,
|
|
132
132
|
O as stripHexPrefix,
|
|
133
133
|
ta as submitWotsPublicKey,
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
V as toXOnly,
|
|
135
|
+
h as uint8ArrayToHex,
|
|
136
136
|
ra as validateDepositAmount,
|
|
137
137
|
oa as validateMultiVaultDepositInputs,
|
|
138
138
|
ia as validateProviderSelection,
|
|
@@ -142,7 +142,7 @@ export {
|
|
|
142
142
|
Wa as validateUtxosAvailable,
|
|
143
143
|
ua as validateVaultAmounts,
|
|
144
144
|
da as validateVaultProviderPubkey,
|
|
145
|
-
|
|
145
|
+
y as validateWalletPubkey,
|
|
146
146
|
Cs as verifyServerIdentity,
|
|
147
147
|
Pa as waitForPeginStatus
|
|
148
148
|
};
|