@babylonlabs-io/ts-sdk 0.48.2 → 0.48.4
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-DD1audlx.cjs → PayoutManager-BZVEyi10.cjs} +2 -2
- package/dist/{PayoutManager-DD1audlx.cjs.map → PayoutManager-BZVEyi10.cjs.map} +1 -1
- package/dist/{PayoutManager-D02AePm4.js → PayoutManager-D26nGR-e.js} +2 -2
- package/dist/{PayoutManager-D02AePm4.js.map → PayoutManager-D26nGR-e.js.map} +1 -1
- package/dist/{PeginManager-6seoi9mV.js → PeginManager-CNhDl1eC.js} +3 -3
- package/dist/{PeginManager-6seoi9mV.js.map → PeginManager-CNhDl1eC.js.map} +1 -1
- package/dist/{PeginManager-CHZieoEQ.cjs → PeginManager-NfDjKQGV.cjs} +2 -2
- package/dist/{PeginManager-CHZieoEQ.cjs.map → PeginManager-NfDjKQGV.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-Bi07LxuY.cjs → buildAndBroadcastRefund-BOtxUi05.cjs} +2 -2
- package/dist/{buildAndBroadcastRefund-Bi07LxuY.cjs.map → buildAndBroadcastRefund-BOtxUi05.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-DXHs6unL.js → buildAndBroadcastRefund-o9Byvkut.js} +4 -4
- package/dist/{buildAndBroadcastRefund-DXHs6unL.js.map → buildAndBroadcastRefund-o9Byvkut.js.map} +1 -1
- package/dist/challengeAssert-HNbugpqL.cjs +2 -0
- package/dist/challengeAssert-HNbugpqL.cjs.map +1 -0
- package/dist/{challengeAssert-ChvLypwc.js → challengeAssert-csvYXBJB.js} +7 -7
- package/dist/challengeAssert-csvYXBJB.js.map +1 -0
- package/dist/constants-CSG2XeD8.cjs +2 -0
- package/dist/constants-CSG2XeD8.cjs.map +1 -0
- package/dist/constants-Cd_fN8VT.js +12 -0
- package/dist/constants-Cd_fN8VT.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/{noPayout-CA4-x5vZ.js → noPayout-C1WCsqfd.js} +46 -44
- package/dist/noPayout-C1WCsqfd.js.map +1 -0
- package/dist/noPayout-lyIRiUyG.cjs +2 -0
- package/dist/noPayout-lyIRiUyG.cjs.map +1 -0
- package/dist/{primeVpAuth-rbejoBPu.js → primeVpAuth-Dzxxy0-F.js} +174 -169
- package/dist/primeVpAuth-Dzxxy0-F.js.map +1 -0
- package/dist/primeVpAuth-wKbRw0m4.cjs +2 -0
- package/dist/primeVpAuth-wKbRw0m4.cjs.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +1 -1
- package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +7 -7
- 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.js +3 -3
- package/dist/tbv/core/primitives/psbt/__tests__/peginAmountsGuard.test.d.ts +8 -0
- package/dist/tbv/core/primitives/psbt/__tests__/peginAmountsGuard.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts +4 -4
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/constants.d.ts +8 -0
- package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +7 -7
- package/dist/{verifyScriptPathSchnorrSignature-DFJAEleY.js → verifyScriptPathSchnorrSignature-CeZp6tMw.js} +77 -79
- package/dist/verifyScriptPathSchnorrSignature-CeZp6tMw.js.map +1 -0
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/challengeAssert-ChvLypwc.js.map +0 -1
- package/dist/challengeAssert-Culc7DoS.cjs +0 -2
- package/dist/challengeAssert-Culc7DoS.cjs.map +0 -1
- package/dist/noPayout-CA4-x5vZ.js.map +0 -1
- package/dist/noPayout-CJ_Acpl_.cjs +0 -2
- package/dist/noPayout-CJ_Acpl_.cjs.map +0 -1
- package/dist/primeVpAuth-Br6RwE3r.cjs +0 -2
- package/dist/primeVpAuth-Br6RwE3r.cjs.map +0 -1
- package/dist/primeVpAuth-rbejoBPu.js.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-D43cncKJ.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-D43cncKJ.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-DFJAEleY.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, v as e } from "../../../PayoutManager-
|
|
2
|
-
import { B as o, C as r, p as u, q as n, t as l, u as c, R as d, a as R, n as g, o as E, i as m, m as A, l as P, j as p, r as v, b as V, s as _, v as F, g as S, h as D, d as N, c as M, e as f, f as C, k as h, w as T } from "../../../buildAndBroadcastRefund-
|
|
1
|
+
import { c as s, v as e } from "../../../PayoutManager-D26nGR-e.js";
|
|
2
|
+
import { B as o, C as r, p as u, q as n, t as l, u as c, R as d, a as R, n as g, o as E, i as m, m as A, l as P, j as p, r as v, b as V, s as _, v as F, g as S, h as D, d as N, c as M, e as f, f as C, k as h, w as T } from "../../../buildAndBroadcastRefund-o9Byvkut.js";
|
|
3
3
|
import { C as O, P as b, c as y, g as U } from "../../../peginState-CBAlxgXk.js";
|
|
4
4
|
export {
|
|
5
5
|
o as BIP68NotMatureError,
|
package/dist/tbv/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../challengeAssert-Culc7DoS.cjs"),l=require("@babylonlabs-io/babylon-tbv-rust-wasm"),n=require("../verifyScriptPathSchnorrSignature-D43cncKJ.cjs"),S=require("../peginInput-DH6X4ITS.cjs"),A=require("../noPayout-CJ_Acpl_.cjs"),r=require("../bitcoin-CHfKAhcI.cjs"),R=require("../signing-Bnsro0hE.cjs"),c=require("../validation-u8W7Lp2x.cjs"),u=require("../PeginManager-CHZieoEQ.cjs"),p=require("../PayoutManager-DD1audlx.cjs"),_=require("../ApplicationRegistry.abi-BAPhJch3.cjs"),m=require("../BTCVaultRegistry.abi-JdeqLz4x.cjs"),P=require("../errors-CGcNP0rV.cjs"),o=require("../waitForTransactionReceiptSmartAware-U706oKTc.cjs"),t=require("../fundPeginTransaction-DuMwnytD.cjs"),d=require("../reservation-xTL2a9Q-.cjs"),a=require("../mempoolApi-C_9JhjCI.cjs"),i=require("../primeVpAuth-Br6RwE3r.cjs"),s=require("../types-WA0LrDk1.cjs"),g=require("../errors-Bu0H-dZD.cjs"),e=require("../buildAndBroadcastRefund-Bi07LxuY.cjs"),T=require("../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=E.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=E.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>l.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>l.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>l.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>l.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>l.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>l.expandWotsSeed});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.createPayoutScript=n.createPayoutScript;exports.extractPayoutSignature=n.extractPayoutSignature;exports.buildPeginInputPsbt=S.buildPeginInputPsbt;exports.extractPeginInputSignature=S.extractPeginInputSignature;exports.finalizePeginInputPsbt=S.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=A.buildNoPayoutPsbt;exports.buildRefundPsbt=A.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=R.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=c.BITCOIN_ADDRESS_RE;exports.HEX_RE=c.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=c.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=c.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=c.TXID_RE;exports.PeginManager=u.PeginManager;exports.VAULT_APP_NAME=u.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=u.buildFundingOutpointsCommitment;exports.buildVaultContext=u.buildVaultContext;exports.computeWotsBlockPublicKeysHash=u.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=u.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=u.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=u.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=p.PayoutManager;exports.computeHashlock=p.computeHashlock;exports.validateSecretAgainstHashlock=p.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=P.CONTRACT_ERRORS;exports.extractErrorData=P.extractErrorData;exports.getContractErrorMessage=P.getContractErrorMessage;exports.handleContractError=P.handleContractError;exports.isKnownContractError=P.isKnownContractError;exports.BitcoinScriptType=o.BitcoinScriptType;exports.applyChangeOutputPolicy=o.applyChangeOutputPolicy;exports.calculateBtcTxHash=o.calculateBtcTxHash;exports.computeChangeOutputFeeSats=o.computeChangeOutputFeeSats;exports.computeMaxDeposit=o.computeMaxDeposit;exports.computePeginBaseFeeSats=o.computePeginBaseFeeSats;exports.getDustThreshold=o.getDustThreshold;exports.getPsbtInputFields=o.getPsbtInputFields;exports.getScriptType=o.getScriptType;exports.selectUtxosForPegin=o.selectUtxosForPegin;exports.shouldAddChangeOutput=o.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=o.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=t.BTC_DUST_SAT;exports.DUST_THRESHOLD=t.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=t.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=t.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=t.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=t.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=t.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=t.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=t.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=t.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=t.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=t.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=t.fundPeginTransaction;exports.parseUnfundedWasmTransaction=t.parseUnfundedWasmTransaction;exports.peginOutputCount=t.peginOutputCount;exports.rateBasedTxBufferFee=t.rateBasedTxBufferFee;exports.UtxoNotAvailableError=d.UtxoNotAvailableError;exports.assertUtxosAvailable=d.assertUtxosAvailable;exports.extractInputsFromTransaction=d.extractInputsFromTransaction;exports.findOverlappingPendingVaults=d.findOverlappingPendingVaults;exports.validateUtxosAvailable=d.validateUtxosAvailable;exports.MEMPOOL_API_URLS=a.MEMPOOL_API_URLS;exports.ViemVaultRegistryReader=a.ViemVaultRegistryReader;exports.getAddressTxs=a.getAddressTxs;exports.getAddressUtxos=a.getAddressUtxos;exports.getMempoolApiUrl=a.getMempoolApiUrl;exports.getNetworkFees=a.getNetworkFees;exports.getTipHeight=a.getTipHeight;exports.getTxHex=a.getTxHex;exports.getTxInfo=a.getTxInfo;exports.getUtxoInfo=a.getUtxoInfo;exports.pushTx=a.pushTx;exports.validateOffchainParams=a.validateOffchainParams;exports.validatePegInConfiguration=a.validatePegInConfiguration;exports.validateTBVProtocolParams=a.validateTBVProtocolParams;exports.OnChainBtcVaultStatus=i.OnChainBtcVaultStatus;exports.ServerIdentityError=i.ServerIdentityError;exports.VaultProviderRpcClient=i.VaultProviderRpcClient;exports.ViemProtocolParamsReader=i.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=i.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=i.ViemVaultKeeperReader;exports.VpResponseValidationError=i.VpResponseValidationError;exports.VpTokenRegistry=i.VpTokenRegistry;exports.batchPollByProvider=i.batchPollByProvider;exports.createAuthenticatedVpClient=i.createAuthenticatedVpClient;exports.primeVpTokenRegistry=i.primeVpTokenRegistry;exports.resolveProtocolAddresses=i.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=i.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=i.verifyServerIdentity;exports.vpTokenRegistry=i.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=s.AUTH_EXPIRED_DATA_KIND;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_BATCH_MAX_SIZE=s.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=s.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=g.isWotsMismatchError;exports.parseFundingOutpointsFromTx=g.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=T.ContractStatus;exports.PeginAction=T.PeginAction;exports.canPerformAction=T.canPerformAction;exports.getPeginProtocolState=T.getPeginProtocolState;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../challengeAssert-HNbugpqL.cjs"),l=require("@babylonlabs-io/babylon-tbv-rust-wasm"),n=require("../verifyScriptPathSchnorrSignature-Cl7tu77P.cjs"),S=require("../peginInput-DH6X4ITS.cjs"),A=require("../noPayout-lyIRiUyG.cjs"),r=require("../bitcoin-CHfKAhcI.cjs"),R=require("../signing-Bnsro0hE.cjs"),c=require("../validation-u8W7Lp2x.cjs"),u=require("../PeginManager-NfDjKQGV.cjs"),p=require("../PayoutManager-BZVEyi10.cjs"),_=require("../ApplicationRegistry.abi-BAPhJch3.cjs"),m=require("../BTCVaultRegistry.abi-JdeqLz4x.cjs"),P=require("../errors-CGcNP0rV.cjs"),o=require("../waitForTransactionReceiptSmartAware-U706oKTc.cjs"),t=require("../fundPeginTransaction-DuMwnytD.cjs"),d=require("../reservation-xTL2a9Q-.cjs"),a=require("../mempoolApi-C_9JhjCI.cjs"),i=require("../primeVpAuth-wKbRw0m4.cjs"),s=require("../types-WA0LrDk1.cjs"),g=require("../errors-Bu0H-dZD.cjs"),e=require("../buildAndBroadcastRefund-BOtxUi05.cjs"),T=require("../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=E.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=E.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>l.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>l.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>l.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>l.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>l.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>l.expandWotsSeed});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.createPayoutScript=n.createPayoutScript;exports.extractPayoutSignature=n.extractPayoutSignature;exports.buildPeginInputPsbt=S.buildPeginInputPsbt;exports.extractPeginInputSignature=S.extractPeginInputSignature;exports.finalizePeginInputPsbt=S.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=A.buildNoPayoutPsbt;exports.buildRefundPsbt=A.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=R.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=c.BITCOIN_ADDRESS_RE;exports.HEX_RE=c.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=c.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=c.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=c.TXID_RE;exports.PeginManager=u.PeginManager;exports.VAULT_APP_NAME=u.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=u.buildFundingOutpointsCommitment;exports.buildVaultContext=u.buildVaultContext;exports.computeWotsBlockPublicKeysHash=u.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=u.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=u.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=u.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=p.PayoutManager;exports.computeHashlock=p.computeHashlock;exports.validateSecretAgainstHashlock=p.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=P.CONTRACT_ERRORS;exports.extractErrorData=P.extractErrorData;exports.getContractErrorMessage=P.getContractErrorMessage;exports.handleContractError=P.handleContractError;exports.isKnownContractError=P.isKnownContractError;exports.BitcoinScriptType=o.BitcoinScriptType;exports.applyChangeOutputPolicy=o.applyChangeOutputPolicy;exports.calculateBtcTxHash=o.calculateBtcTxHash;exports.computeChangeOutputFeeSats=o.computeChangeOutputFeeSats;exports.computeMaxDeposit=o.computeMaxDeposit;exports.computePeginBaseFeeSats=o.computePeginBaseFeeSats;exports.getDustThreshold=o.getDustThreshold;exports.getPsbtInputFields=o.getPsbtInputFields;exports.getScriptType=o.getScriptType;exports.selectUtxosForPegin=o.selectUtxosForPegin;exports.shouldAddChangeOutput=o.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=o.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=t.BTC_DUST_SAT;exports.DUST_THRESHOLD=t.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=t.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=t.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=t.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=t.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=t.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=t.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=t.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=t.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=t.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=t.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=t.fundPeginTransaction;exports.parseUnfundedWasmTransaction=t.parseUnfundedWasmTransaction;exports.peginOutputCount=t.peginOutputCount;exports.rateBasedTxBufferFee=t.rateBasedTxBufferFee;exports.UtxoNotAvailableError=d.UtxoNotAvailableError;exports.assertUtxosAvailable=d.assertUtxosAvailable;exports.extractInputsFromTransaction=d.extractInputsFromTransaction;exports.findOverlappingPendingVaults=d.findOverlappingPendingVaults;exports.validateUtxosAvailable=d.validateUtxosAvailable;exports.MEMPOOL_API_URLS=a.MEMPOOL_API_URLS;exports.ViemVaultRegistryReader=a.ViemVaultRegistryReader;exports.getAddressTxs=a.getAddressTxs;exports.getAddressUtxos=a.getAddressUtxos;exports.getMempoolApiUrl=a.getMempoolApiUrl;exports.getNetworkFees=a.getNetworkFees;exports.getTipHeight=a.getTipHeight;exports.getTxHex=a.getTxHex;exports.getTxInfo=a.getTxInfo;exports.getUtxoInfo=a.getUtxoInfo;exports.pushTx=a.pushTx;exports.validateOffchainParams=a.validateOffchainParams;exports.validatePegInConfiguration=a.validatePegInConfiguration;exports.validateTBVProtocolParams=a.validateTBVProtocolParams;exports.OnChainBtcVaultStatus=i.OnChainBtcVaultStatus;exports.ServerIdentityError=i.ServerIdentityError;exports.VaultProviderRpcClient=i.VaultProviderRpcClient;exports.ViemProtocolParamsReader=i.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=i.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=i.ViemVaultKeeperReader;exports.VpResponseValidationError=i.VpResponseValidationError;exports.VpTokenRegistry=i.VpTokenRegistry;exports.batchPollByProvider=i.batchPollByProvider;exports.createAuthenticatedVpClient=i.createAuthenticatedVpClient;exports.primeVpTokenRegistry=i.primeVpTokenRegistry;exports.resolveProtocolAddresses=i.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=i.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=i.verifyServerIdentity;exports.vpTokenRegistry=i.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=s.AUTH_EXPIRED_DATA_KIND;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_BATCH_MAX_SIZE=s.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=s.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=g.isWotsMismatchError;exports.parseFundingOutpointsFromTx=g.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=T.ContractStatus;exports.PeginAction=T.PeginAction;exports.canPerformAction=T.canPerformAction;exports.getPeginProtocolState=T.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as s, b as t, c as r } from "../challengeAssert-
|
|
1
|
+
import { a as s, b as t, c as r } from "../challengeAssert-csvYXBJB.js";
|
|
2
2
|
import { computeMinClaimValue as i, computeMinPeginFee as n, deriveVaultId as u, expandAuthAnchor as l, expandHashlockSecret as p, expandWotsSeed as P } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { P as c, d as T, f as E, c as S, b as A, a as _, g, e as R } from "../verifyScriptPathSchnorrSignature-
|
|
3
|
+
import { P as c, d as T, f as E, c as S, b as A, a as _, g, e as R } from "../verifyScriptPathSchnorrSignature-CeZp6tMw.js";
|
|
4
4
|
import { b as x, e as f, f as b } from "../peginInput-BPRB9tUi.js";
|
|
5
|
-
import { a as O, b as V } from "../noPayout-
|
|
5
|
+
import { a as O, b as V } from "../noPayout-C1WCsqfd.js";
|
|
6
6
|
import { d as C, a as F, b as h, e as U, f as N, j as y, g as B, h as D, i as M, c as H, p as L, s as X, t as k, u as W, v as K } from "../bitcoin-B5aNKtsk.js";
|
|
7
7
|
import { c as G } from "../signing-DaLvGwQe.js";
|
|
8
8
|
import { B as Z, H as J, K as j, M as q, T as z } from "../validation-CxqROCno.js";
|
|
9
|
-
import { P as $, V as aa, b as ea, a as sa, c as ta, f as ra, d as oa, e as ia } from "../PeginManager-
|
|
10
|
-
import { P as ua, c as la, v as pa } from "../PayoutManager-
|
|
9
|
+
import { P as $, V as aa, b as ea, a as sa, c as ta, f as ra, d as oa, e as ia } from "../PeginManager-CNhDl1eC.js";
|
|
10
|
+
import { P as ua, c as la, v as pa } from "../PayoutManager-D26nGR-e.js";
|
|
11
11
|
import { A as da, P as ca } from "../ApplicationRegistry.abi-Dn2qk6JG.js";
|
|
12
12
|
import { B as Ea } from "../BTCVaultRegistry.abi-Chs4AFBj.js";
|
|
13
13
|
import { C as Aa, e as _a, g as ga, h as Ra, i as ma } from "../errors-Blc-JWnI.js";
|
|
@@ -15,10 +15,10 @@ import { B as fa, a as ba, f as Ia, c as Oa, b as Va, d as va, g as Ca, i as Fa,
|
|
|
15
15
|
import { B as Da, D as Ma, F as Ha, L as La, M as Xa, c as ka, P as Wa, b as Ka, a as wa, S as Ga, T as Ya, W as Za, f as Ja, d as ja, p as qa, r as za } from "../fundPeginTransaction-96FxwYYJ.js";
|
|
16
16
|
import { U as $a, a as ae, e as ee, f as se, v as te } from "../reservation-BxvKbQH2.js";
|
|
17
17
|
import { M as oe, V as ie, g as ne, a as ue, b as le, c as pe, d as Pe, e as de, f as ce, h as Te, p as Ee, v as Se, i as Ae, j as _e } from "../mempoolApi-BxT89SAq.js";
|
|
18
|
-
import { O as Re, S as me, V as xe, g as fe, h as be, i as Ie, a as Oe, d as Ve, b as ve, f as Ce, p as Fe, r as he, v as Ue, c as Ne, e as ye } from "../primeVpAuth-
|
|
18
|
+
import { O as Re, S as me, V as xe, g as fe, h as be, i as Ie, a as Oe, d as Ve, b as ve, f as Ce, p as Fe, r as he, v as Ue, c as Ne, e as ye } from "../primeVpAuth-Dzxxy0-F.js";
|
|
19
19
|
import { A as De, D as Me, b as He, J as Le, a as Xe, d as ke, P as We, R as Ke, e as we, c as Ge, V as Ye } from "../types-CQDRQvV-.js";
|
|
20
20
|
import { i as Je, p as je } from "../errors-9AkghWyk.js";
|
|
21
|
-
import { B as ze, C as Qe, p as $e, q as as, t as es, u as ss, R as ts, a as rs, n as os, o as is, i as ns, m as us, l as ls, j as ps, r as Ps, b as ds, s as cs, v as Ts, g as Es, h as Ss, d as As, c as _s, e as gs, f as Rs, k as ms, w as xs } from "../buildAndBroadcastRefund-
|
|
21
|
+
import { B as ze, C as Qe, p as $e, q as as, t as es, u as ss, R as ts, a as rs, n as os, o as is, i as ns, m as us, l as ls, j as ps, r as Ps, b as ds, s as cs, v as Ts, g as Es, h as Ss, d as As, c as _s, e as gs, f as Rs, k as ms, w as xs } from "../buildAndBroadcastRefund-o9Byvkut.js";
|
|
22
22
|
import { C as bs, P as Is, c as Os, g as Vs } from "../peginState-CBAlxgXk.js";
|
|
23
23
|
export {
|
|
24
24
|
De as AUTH_EXPIRED_DATA_KIND,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { computeMinClaimValue as Q, buildPeginTxFromPrePegin as Z, createPrePeginTransaction as j, createPayoutConnector as J, tapInternalPubkey as ee } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
2
2
|
import { c as L, d as te } from "./fundPeginTransaction-96FxwYYJ.js";
|
|
3
|
-
import { Buffer as
|
|
4
|
-
import { Transaction as S, Psbt as
|
|
3
|
+
import { Buffer as c } from "buffer";
|
|
4
|
+
import { Transaction as S, Psbt as k, crypto as ne } from "bitcoinjs-lib";
|
|
5
5
|
import { s as x, h as E, u as _, T as H, c as re, d as oe, S as B, X as R } from "./bitcoin-B5aNKtsk.js";
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import { P as T, A as C, a as q, M as I, V as ie, N } from "./constants-Cd_fN8VT.js";
|
|
7
|
+
import * as se from "@bitcoin-js/tiny-secp256k1-asmjs";
|
|
8
|
+
async function ue(e, t) {
|
|
8
9
|
const n = t.pegInAmounts.length;
|
|
9
10
|
if (e.htlcValues.length !== n)
|
|
10
11
|
throw new Error(
|
|
@@ -31,7 +32,7 @@ async function se(e, t) {
|
|
|
31
32
|
);
|
|
32
33
|
const o = t.minPeginFeeRate * L;
|
|
33
34
|
for (let i = 0; i < n; i++) {
|
|
34
|
-
const u = t.pegInAmounts[i], s = e.peginAmounts[i],
|
|
35
|
+
const u = t.pegInAmounts[i], s = e.peginAmounts[i], a = e.htlcValues[i];
|
|
35
36
|
if (s !== u)
|
|
36
37
|
throw new Error(
|
|
37
38
|
`WASM Pre-PegIn peginAmount[${i}] ${s} does not match the requested amount ${u}; refusing to build a tx whose recorded amount differs from the depositor's request.`
|
|
@@ -40,22 +41,22 @@ async function se(e, t) {
|
|
|
40
41
|
throw new Error(
|
|
41
42
|
`WASM Pre-PegIn peginAmount[${i}] is non-positive (${s}); expected > 0.`
|
|
42
43
|
);
|
|
43
|
-
if (
|
|
44
|
+
if (a <= 0n)
|
|
44
45
|
throw new Error(
|
|
45
|
-
`WASM Pre-PegIn htlcValue[${i}] is non-positive (${
|
|
46
|
+
`WASM Pre-PegIn htlcValue[${i}] is non-positive (${a}); expected > 0.`
|
|
46
47
|
);
|
|
47
|
-
const l =
|
|
48
|
+
const l = a - s - e.depositorClaimValue;
|
|
48
49
|
if (l <= 0n)
|
|
49
50
|
throw new Error(
|
|
50
|
-
`WASM Pre-PegIn htlcValue[${i}] ${
|
|
51
|
+
`WASM Pre-PegIn htlcValue[${i}] ${a} does not strictly cover peginAmount ${s} + depositorClaimValue ${e.depositorClaimValue} + a PegIn fee (implied fee ${l}).`
|
|
51
52
|
);
|
|
52
53
|
if (l > o)
|
|
53
54
|
throw new Error(
|
|
54
|
-
`WASM Pre-PegIn implied PegIn fee for HTLC[${i}] (${l} sat) exceeds the plausibility cap ${o} sat (minPeginFeeRate=${t.minPeginFeeRate} × ${L} vbytes); htlcValue ${
|
|
55
|
+
`WASM Pre-PegIn implied PegIn fee for HTLC[${i}] (${l} sat) exceeds the plausibility cap ${o} sat (minPeginFeeRate=${t.minPeginFeeRate} × ${L} vbytes); htlcValue ${a} appears grossly inflated.`
|
|
55
56
|
);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function ae(e, t, n) {
|
|
59
60
|
if (e.length < t.length)
|
|
60
61
|
throw new Error(
|
|
61
62
|
`Encoded Pre-PegIn tx has ${e.length} output(s), fewer than the ${t.length} HTLC output(s) the cross-check validated.`
|
|
@@ -73,8 +74,8 @@ function ue(e, t, n) {
|
|
|
73
74
|
);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
const
|
|
77
|
-
async function
|
|
77
|
+
const M = 64, ce = /^[0-9a-fA-F]+$/;
|
|
78
|
+
async function Ae(e) {
|
|
78
79
|
const t = G(e.authAnchorHash), n = await j({
|
|
79
80
|
depositorPubkey: e.depositorPubkey,
|
|
80
81
|
vaultProviderPubkey: e.vaultProviderPubkey,
|
|
@@ -91,9 +92,9 @@ async function be(e) {
|
|
|
91
92
|
network: e.network,
|
|
92
93
|
authAnchorHash: t
|
|
93
94
|
});
|
|
94
|
-
await
|
|
95
|
+
await ue(n, e);
|
|
95
96
|
const r = te(n.txHex);
|
|
96
|
-
|
|
97
|
+
ae(
|
|
97
98
|
r.outputs,
|
|
98
99
|
n.htlcValues,
|
|
99
100
|
n.htlcScriptPubKeys
|
|
@@ -116,13 +117,13 @@ async function be(e) {
|
|
|
116
117
|
function G(e) {
|
|
117
118
|
if (e === void 0) return;
|
|
118
119
|
const t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e;
|
|
119
|
-
if (t.length !==
|
|
120
|
+
if (t.length !== M || !ce.test(t))
|
|
120
121
|
throw new Error(
|
|
121
|
-
`authAnchorHash must be 32-byte hex (${
|
|
122
|
+
`authAnchorHash must be 32-byte hex (${M} chars, no 0x prefix); got length ${t.length}`
|
|
122
123
|
);
|
|
123
124
|
return t.toLowerCase();
|
|
124
125
|
}
|
|
125
|
-
async function
|
|
126
|
+
async function ke(e) {
|
|
126
127
|
const t = await Z(
|
|
127
128
|
{
|
|
128
129
|
depositorPubkey: e.prePeginParams.depositorPubkey,
|
|
@@ -153,7 +154,7 @@ async function Ae(e) {
|
|
|
153
154
|
vaultValue: t.vaultValue
|
|
154
155
|
};
|
|
155
156
|
}
|
|
156
|
-
async function
|
|
157
|
+
async function le(e) {
|
|
157
158
|
const t = await J(
|
|
158
159
|
{
|
|
159
160
|
depositor: e.depositor,
|
|
@@ -172,26 +173,26 @@ async function ae(e) {
|
|
|
172
173
|
payoutControlBlock: t.payoutControlBlock
|
|
173
174
|
};
|
|
174
175
|
}
|
|
175
|
-
const
|
|
176
|
-
async function
|
|
177
|
-
const t = x(e.payoutTxHex), n = x(e.peginTxHex), r = x(e.assertTxHex), o = await
|
|
176
|
+
const K = 3, F = 10, X = 100;
|
|
177
|
+
async function Te(e) {
|
|
178
|
+
const t = x(e.payoutTxHex), n = x(e.peginTxHex), r = x(e.assertTxHex), o = await le({
|
|
178
179
|
depositor: e.depositorBtcPubkey,
|
|
179
180
|
vaultProvider: e.vaultProviderBtcPubkey,
|
|
180
181
|
vaultKeepers: e.vaultKeeperBtcPubkeys,
|
|
181
182
|
universalChallengers: e.universalChallengerBtcPubkeys,
|
|
182
183
|
timelockPegin: e.timelockPegin,
|
|
183
184
|
network: e.network
|
|
184
|
-
}), i = E(o.payoutScript), u = E(o.payoutControlBlock), s = S.fromHex(t),
|
|
185
|
+
}), i = E(o.payoutScript), u = E(o.payoutControlBlock), s = S.fromHex(t), a = S.fromHex(n), l = S.fromHex(r), p = new k();
|
|
185
186
|
if (p.setVersion(s.version), p.setLocktime(s.locktime), s.ins.length !== 2)
|
|
186
187
|
throw new Error(
|
|
187
188
|
`Payout transaction must have exactly 2 inputs, got ${s.ins.length}`
|
|
188
189
|
);
|
|
189
190
|
const f = s.ins[0], P = s.ins[1], h = _(
|
|
190
191
|
new Uint8Array(f.hash).slice().reverse()
|
|
191
|
-
), w =
|
|
192
|
-
if (h !== w || f.index !==
|
|
192
|
+
), w = a.getId();
|
|
193
|
+
if (h !== w || f.index !== T)
|
|
193
194
|
throw new Error(
|
|
194
|
-
`Input 0 must spend PegIn:${
|
|
195
|
+
`Input 0 must spend PegIn:${T}. Expected ${w}:${T}, got ${h}:${f.index}`
|
|
195
196
|
);
|
|
196
197
|
const $ = _(
|
|
197
198
|
new Uint8Array(P.hash).slice().reverse()
|
|
@@ -200,7 +201,7 @@ async function ke(e) {
|
|
|
200
201
|
throw new Error(
|
|
201
202
|
`Input 1 must spend Assert:${C}. Expected ${d}:${C}, got ${$}:${P.index}`
|
|
202
203
|
);
|
|
203
|
-
const g =
|
|
204
|
+
const g = a.outs[f.index];
|
|
204
205
|
if (!g)
|
|
205
206
|
throw new Error(
|
|
206
207
|
`Previous output not found for input 0 (txid: ${h}, index: ${f.index})`
|
|
@@ -227,12 +228,12 @@ async function ke(e) {
|
|
|
227
228
|
throw new Error(
|
|
228
229
|
`Payout outputs (${b} sats) exceed inputs (${v} sats); invalid transaction.`
|
|
229
230
|
);
|
|
230
|
-
const
|
|
231
|
+
const O = v - b, U = Math.floor(
|
|
231
232
|
v * F / X
|
|
232
233
|
);
|
|
233
|
-
if (
|
|
234
|
+
if (O > U)
|
|
234
235
|
throw new Error(
|
|
235
|
-
`Payout implicit fee ${
|
|
236
|
+
`Payout implicit fee ${O} sats exceeds the safety cap of ${U} sats (${F}/${X} of inputs=${v}); refusing to sign payout.`
|
|
236
237
|
);
|
|
237
238
|
p.addInput({
|
|
238
239
|
hash: f.hash,
|
|
@@ -245,11 +246,11 @@ async function ke(e) {
|
|
|
245
246
|
tapLeafScript: [
|
|
246
247
|
{
|
|
247
248
|
leafVersion: H,
|
|
248
|
-
script:
|
|
249
|
-
controlBlock:
|
|
249
|
+
script: c.from(i),
|
|
250
|
+
controlBlock: c.from(u)
|
|
250
251
|
}
|
|
251
252
|
],
|
|
252
|
-
tapInternalKey:
|
|
253
|
+
tapInternalKey: c.from(ee)
|
|
253
254
|
// sighashType omitted - defaults to SIGHASH_DEFAULT (0x00) for Taproot
|
|
254
255
|
}), p.addInput({
|
|
255
256
|
hash: P.hash,
|
|
@@ -279,7 +280,7 @@ function he(e) {
|
|
|
279
280
|
depositorBtcPubkey: i,
|
|
280
281
|
vaultKeeperBtcPubkeys: u,
|
|
281
282
|
registeredPayoutScriptPubKey: s,
|
|
282
|
-
commissionBps:
|
|
283
|
+
commissionBps: a
|
|
283
284
|
} = e;
|
|
284
285
|
if (!re(s))
|
|
285
286
|
throw new Error("Invalid registeredPayoutScriptPubKey: not valid hex");
|
|
@@ -288,11 +289,11 @@ function he(e) {
|
|
|
288
289
|
);
|
|
289
290
|
let h, w, $;
|
|
290
291
|
if (l === p)
|
|
291
|
-
h = "vp-claimer", w =
|
|
292
|
+
h = "vp-claimer", w = ie, $ = x(s);
|
|
292
293
|
else if (l === f)
|
|
293
|
-
h = "depositor-as-claimer", w =
|
|
294
|
+
h = "depositor-as-claimer", w = N, $ = x(s);
|
|
294
295
|
else if (P.includes(l))
|
|
295
|
-
h = "vk-claimer", w =
|
|
296
|
+
h = "vk-claimer", w = N, $ = x(oe(l));
|
|
296
297
|
else
|
|
297
298
|
throw new Error(
|
|
298
299
|
`Unknown claimer pubkey ${l}: not VP, depositor, or a registered vault keeper`
|
|
@@ -301,32 +302,32 @@ function he(e) {
|
|
|
301
302
|
throw new Error(
|
|
302
303
|
`Payout transaction has ${t.outs.length} output(s), expected exactly ${w} for role ${h}.`
|
|
303
304
|
);
|
|
304
|
-
const d =
|
|
305
|
+
const d = c.from($, "hex");
|
|
305
306
|
if (!t.outs[0].script.equals(d))
|
|
306
307
|
throw new Error(
|
|
307
308
|
`Payout transaction output 0 does not pay the expected scriptPubKey for role ${h}`
|
|
308
309
|
);
|
|
309
310
|
const g = w - 1;
|
|
310
|
-
if (t.outs[g].value !==
|
|
311
|
+
if (t.outs[g].value !== q)
|
|
311
312
|
throw new Error(
|
|
312
|
-
`Payout CPFP anchor (out ${g}) value ${t.outs[g].value} sats must equal ${
|
|
313
|
+
`Payout CPFP anchor (out ${g}) value ${t.outs[g].value} sats must equal ${q} sats`
|
|
313
314
|
);
|
|
314
315
|
if (h === "vp-claimer") {
|
|
315
|
-
if (!Number.isInteger(
|
|
316
|
+
if (!Number.isInteger(a) || a < 0 || a >= I)
|
|
316
317
|
throw new Error(
|
|
317
|
-
`commissionBps must be an integer in [0, ${I}), got ${
|
|
318
|
+
`commissionBps must be an integer in [0, ${I}), got ${a}`
|
|
318
319
|
);
|
|
319
320
|
const y = Math.floor(
|
|
320
|
-
n *
|
|
321
|
+
n * a / I
|
|
321
322
|
);
|
|
322
323
|
if (t.outs[1].value > y)
|
|
323
324
|
throw new Error(
|
|
324
|
-
`Payout VP commission (out 1) value ${t.outs[1].value} sats exceeds cap ${y} sats (${
|
|
325
|
+
`Payout VP commission (out 1) value ${t.outs[1].value} sats exceeds cap ${y} sats (${a} bps of peginValue=${n})`
|
|
325
326
|
);
|
|
326
327
|
}
|
|
327
328
|
}
|
|
328
329
|
function Ce(e, t, n = 0) {
|
|
329
|
-
const r =
|
|
330
|
+
const r = k.fromHex(e);
|
|
330
331
|
if (n >= r.data.inputs.length)
|
|
331
332
|
throw new Error(
|
|
332
333
|
`Input index ${n} out of range (${r.data.inputs.length} inputs)`
|
|
@@ -335,7 +336,7 @@ function Ce(e, t, n = 0) {
|
|
|
335
336
|
if (o.tapScriptSig && o.tapScriptSig.length > 0) {
|
|
336
337
|
const i = E(t);
|
|
337
338
|
for (const u of o.tapScriptSig)
|
|
338
|
-
if (u.pubkey.equals(
|
|
339
|
+
if (u.pubkey.equals(c.from(i)))
|
|
339
340
|
return W(u.signature, n);
|
|
340
341
|
throw new Error(
|
|
341
342
|
`No signature found for depositor pubkey: ${t} at input ${n}`
|
|
@@ -343,9 +344,9 @@ function Ce(e, t, n = 0) {
|
|
|
343
344
|
}
|
|
344
345
|
if (o.finalScriptWitness && o.finalScriptWitness.length > 0) {
|
|
345
346
|
const i = de(o.finalScriptWitness);
|
|
346
|
-
if (i.length !==
|
|
347
|
+
if (i.length !== K)
|
|
347
348
|
throw new Error(
|
|
348
|
-
`Unexpected finalized witness stack size at input ${n}: expected ${
|
|
349
|
+
`Unexpected finalized witness stack size at input ${n}: expected ${K} items (signature, script, controlBlock), got ${i.length}`
|
|
349
350
|
);
|
|
350
351
|
return W(i[0], n);
|
|
351
352
|
}
|
|
@@ -390,7 +391,7 @@ function de(e) {
|
|
|
390
391
|
}, i = o();
|
|
391
392
|
for (let u = 0; u < i; u++) {
|
|
392
393
|
const s = o();
|
|
393
|
-
r(s), t.push(
|
|
394
|
+
r(s), t.push(c.from(e.subarray(n, n + s))), n += s;
|
|
394
395
|
}
|
|
395
396
|
if (n !== e.length)
|
|
396
397
|
throw new Error(
|
|
@@ -407,19 +408,19 @@ class m extends Error {
|
|
|
407
408
|
}
|
|
408
409
|
function z(e, t) {
|
|
409
410
|
try {
|
|
410
|
-
return
|
|
411
|
+
return k.fromHex(t);
|
|
411
412
|
} catch (n) {
|
|
412
413
|
const r = n instanceof Error ? n.message : String(n);
|
|
413
414
|
throw new Error(`Failed to parse ${e} PSBT: ${r}`);
|
|
414
415
|
}
|
|
415
416
|
}
|
|
416
417
|
const pe = 8;
|
|
417
|
-
function
|
|
418
|
+
function V(e) {
|
|
418
419
|
return `${e.toString("hex").slice(0, pe)}…`;
|
|
419
420
|
}
|
|
420
|
-
function
|
|
421
|
-
const t =
|
|
422
|
-
return
|
|
421
|
+
function Y(e) {
|
|
422
|
+
const t = c.from(e).reverse();
|
|
423
|
+
return V(t);
|
|
423
424
|
}
|
|
424
425
|
function Ie(e) {
|
|
425
426
|
const t = z("requested", e.requestedPsbtHex), n = z("returned", e.returnedPsbtHex);
|
|
@@ -443,7 +444,7 @@ function Ie(e) {
|
|
|
443
444
|
const o = t.txInputs[r], i = n.txInputs[r];
|
|
444
445
|
if (!o.hash.equals(i.hash))
|
|
445
446
|
throw new m(
|
|
446
|
-
`input ${r} prevout txid differs (requested=${
|
|
447
|
+
`input ${r} prevout txid differs (requested=${Y(o.hash)}, returned=${Y(i.hash)})`
|
|
447
448
|
);
|
|
448
449
|
if (o.index !== i.index)
|
|
449
450
|
throw new m(
|
|
@@ -458,7 +459,7 @@ function Ie(e) {
|
|
|
458
459
|
const o = t.txOutputs[r], i = n.txOutputs[r];
|
|
459
460
|
if (!o.script.equals(i.script))
|
|
460
461
|
throw new m(
|
|
461
|
-
`output ${r} scriptPubKey differs (requested=${
|
|
462
|
+
`output ${r} scriptPubKey differs (requested=${V(o.script)}, returned=${V(i.script)})`
|
|
462
463
|
);
|
|
463
464
|
if (o.value !== i.value)
|
|
464
465
|
throw new m(
|
|
@@ -466,26 +467,26 @@ function Ie(e) {
|
|
|
466
467
|
);
|
|
467
468
|
}
|
|
468
469
|
}
|
|
469
|
-
const
|
|
470
|
+
const D = 253, fe = 254, ge = 65535, Pe = 4294967295;
|
|
470
471
|
function xe(e) {
|
|
471
|
-
if (e <
|
|
472
|
-
return
|
|
472
|
+
if (e < D)
|
|
473
|
+
return c.from([e]);
|
|
473
474
|
if (e <= ge) {
|
|
474
|
-
const t =
|
|
475
|
-
return t.writeUInt16LE(e),
|
|
475
|
+
const t = c.alloc(2);
|
|
476
|
+
return t.writeUInt16LE(e), c.concat([c.from([D]), t]);
|
|
476
477
|
}
|
|
477
478
|
if (e <= Pe) {
|
|
478
|
-
const t =
|
|
479
|
-
return t.writeUInt32LE(e),
|
|
479
|
+
const t = c.alloc(4);
|
|
480
|
+
return t.writeUInt32LE(e), c.concat([c.from([fe]), t]);
|
|
480
481
|
}
|
|
481
482
|
throw new Error(`Script too large to encode as CompactSize: ${e} bytes`);
|
|
482
483
|
}
|
|
483
484
|
const we = "TapLeaf";
|
|
484
485
|
function $e(e, t) {
|
|
485
|
-
const n =
|
|
486
|
-
|
|
486
|
+
const n = c.concat([
|
|
487
|
+
c.from([e]),
|
|
487
488
|
xe(t.length),
|
|
488
|
-
|
|
489
|
+
c.from(t)
|
|
489
490
|
]);
|
|
490
491
|
return ne.taggedHash(we, n);
|
|
491
492
|
}
|
|
@@ -500,19 +501,19 @@ function _e(e) {
|
|
|
500
501
|
throw new Error(
|
|
501
502
|
`Signer x-only pubkey for input ${o} must be ${R} hex chars (32 bytes), got ${u.length}.`
|
|
502
503
|
);
|
|
503
|
-
const s =
|
|
504
|
+
const s = k.fromHex(t);
|
|
504
505
|
if (o < 0 || o >= s.data.inputs.length)
|
|
505
506
|
throw new Error(
|
|
506
507
|
`Input index ${o} out of range (${s.data.inputs.length} inputs).`
|
|
507
508
|
);
|
|
508
|
-
const
|
|
509
|
+
const a = [], l = [];
|
|
509
510
|
for (let d = 0; d < s.data.inputs.length; d++) {
|
|
510
511
|
const g = s.data.inputs[d].witnessUtxo;
|
|
511
512
|
if (!g)
|
|
512
513
|
throw new Error(
|
|
513
514
|
`Cannot verify signature: input ${d} of the requested PSBT has no witnessUtxo (required to recompute the Taproot sighash).`
|
|
514
515
|
);
|
|
515
|
-
|
|
516
|
+
a.push(g.script), l.push(g.value);
|
|
516
517
|
}
|
|
517
518
|
const p = s.data.inputs[o].tapLeafScript;
|
|
518
519
|
if (!p || p.length !== 1)
|
|
@@ -532,12 +533,12 @@ function _e(e) {
|
|
|
532
533
|
h.addOutput(d.script, d.value);
|
|
533
534
|
const w = h.hashForWitnessV1(
|
|
534
535
|
o,
|
|
535
|
-
|
|
536
|
+
a,
|
|
536
537
|
l,
|
|
537
538
|
S.SIGHASH_DEFAULT,
|
|
538
539
|
P
|
|
539
540
|
);
|
|
540
|
-
if (!
|
|
541
|
+
if (!se.verifySchnorr(
|
|
541
542
|
w,
|
|
542
543
|
E(u),
|
|
543
544
|
E(i)
|
|
@@ -547,17 +548,14 @@ function _e(e) {
|
|
|
547
548
|
);
|
|
548
549
|
}
|
|
549
550
|
export {
|
|
550
|
-
C as A,
|
|
551
|
-
Te as D,
|
|
552
551
|
m as P,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
552
|
+
Ae as a,
|
|
553
|
+
ke as b,
|
|
554
|
+
Te as c,
|
|
556
555
|
Ie as d,
|
|
557
556
|
Ce as e,
|
|
558
557
|
_e as f,
|
|
559
|
-
|
|
560
|
-
k as h,
|
|
558
|
+
le as g,
|
|
561
559
|
G as n
|
|
562
560
|
};
|
|
563
|
-
//# sourceMappingURL=verifyScriptPathSchnorrSignature-
|
|
561
|
+
//# sourceMappingURL=verifyScriptPathSchnorrSignature-CeZp6tMw.js.map
|