@babylonlabs-io/ts-sdk 0.46.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{buildAndBroadcastRefund-CZj2z7PJ.js → buildAndBroadcastRefund-BssyvGWW.js} +2 -2
- package/dist/{buildAndBroadcastRefund-CZj2z7PJ.js.map → buildAndBroadcastRefund-BssyvGWW.js.map} +1 -1
- package/dist/{buildAndBroadcastRefund-Ux587SFf.cjs → buildAndBroadcastRefund-CgUJ7Mpf.cjs} +2 -2
- package/dist/{buildAndBroadcastRefund-Ux587SFf.cjs.map → buildAndBroadcastRefund-CgUJ7Mpf.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/{primeVpAuth-7EYTPSTj.cjs → primeVpAuth-Br6RwE3r.cjs} +2 -2
- package/dist/{primeVpAuth-7EYTPSTj.cjs.map → primeVpAuth-Br6RwE3r.cjs.map} +1 -1
- package/dist/{primeVpAuth-DZlsu0di.js → primeVpAuth-rbejoBPu.js} +2 -2
- package/dist/{primeVpAuth-DZlsu0di.js.map → primeVpAuth-rbejoBPu.js.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/clients/vault-provider/types.d.ts +3 -0
- package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +3 -3
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +3 -3
- package/dist/{types-BqGAMOZM.js → types-CQDRQvV-.js} +11 -10
- package/dist/types-CQDRQvV-.js.map +1 -0
- package/dist/{types-eYlq0p1o.cjs → types-WA0LrDk1.cjs} +2 -2
- package/dist/types-WA0LrDk1.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/types-BqGAMOZM.js.map +0 -1
- package/dist/types-eYlq0p1o.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./challengeAssert-Cmj_OG6V.cjs"),l=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("./assertPsbtUnsignedTxMatches-CABhEADu.cjs"),p=require("./peginInput-DH6X4ITS.cjs"),S=require("./noPayout-DliaHuc6.cjs"),t=require("./bitcoin-CHfKAhcI.cjs"),R=require("./signing-Bnsro0hE.cjs"),c=require("./validation-u8W7Lp2x.cjs"),n=require("./PeginManager-CeloRUHV.cjs"),A=require("./PayoutManager-BwYlPF2C.cjs"),_=require("./ApplicationRegistry.abi-BAPhJch3.cjs"),m=require("./BTCVaultRegistry.abi-JdeqLz4x.cjs"),d=require("./errors-CGcNP0rV.cjs"),b=require("./shared/index.cjs"),o=require("./waitForTransactionReceiptSmartAware-BFMQFEzj.cjs"),r=require("./fundPeginTransaction-C8qsXxNV.cjs"),P=require("./reservation-xTL2a9Q-.cjs"),a=require("./mempoolApi-C_9JhjCI.cjs"),i=require("./primeVpAuth-7EYTPSTj.cjs"),s=require("./types-eYlq0p1o.cjs"),g=require("./errors-Bu0H-dZD.cjs"),e=require("./buildAndBroadcastRefund-Ux587SFf.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=u.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=u.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=u.buildPrePeginPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.buildPeginInputPsbt=p.buildPeginInputPsbt;exports.extractPeginInputSignature=p.extractPeginInputSignature;exports.finalizePeginInputPsbt=p.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=S.buildNoPayoutPsbt;exports.buildRefundPsbt=S.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=t.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=t.deriveNativeSegwitAddress;exports.deriveTaprootAddress=t.deriveTaprootAddress;exports.ensureHexPrefix=t.ensureHexPrefix;exports.formatSatoshisToBtc=t.formatSatoshisToBtc;exports.getNetwork=t.getNetwork;exports.getSortedXOnlyPubkeys=t.getSortedXOnlyPubkeys;exports.hexToUint8Array=t.hexToUint8Array;exports.isAddressFromPublicKey=t.isAddressFromPublicKey;exports.isValidHex=t.isValidHex;exports.processPublicKeyToXOnly=t.processPublicKeyToXOnly;exports.stripHexPrefix=t.stripHexPrefix;exports.toXOnly=t.toXOnly;exports.uint8ArrayToHex=t.uint8ArrayToHex;exports.validateWalletPubkey=t.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=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=n.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=A.PayoutManager;exports.computeHashlock=A.computeHashlock;exports.validateSecretAgainstHashlock=A.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=d.CONTRACT_ERRORS;exports.extractErrorData=d.extractErrorData;exports.getContractErrorMessage=d.getContractErrorMessage;exports.handleContractError=d.handleContractError;exports.isKnownContractError=d.isKnownContractError;exports.BitcoinNetworks=b.BitcoinNetworks;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=r.BTC_DUST_SAT;exports.DUST_THRESHOLD=r.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=r.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=r.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=r.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=r.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=r.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=r.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=r.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=r.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=r.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=r.fundPeginTransaction;exports.parseUnfundedWasmTransaction=r.parseUnfundedWasmTransaction;exports.peginOutputCount=r.peginOutputCount;exports.rateBasedTxBufferFee=r.rateBasedTxBufferFee;exports.UtxoNotAvailableError=P.UtxoNotAvailableError;exports.assertUtxosAvailable=P.assertUtxosAvailable;exports.extractInputsFromTransaction=P.extractInputsFromTransaction;exports.findOverlappingPendingVaults=P.findOverlappingPendingVaults;exports.validateUtxosAvailable=P.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-Cmj_OG6V.cjs"),l=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("./assertPsbtUnsignedTxMatches-CABhEADu.cjs"),p=require("./peginInput-DH6X4ITS.cjs"),S=require("./noPayout-DliaHuc6.cjs"),t=require("./bitcoin-CHfKAhcI.cjs"),R=require("./signing-Bnsro0hE.cjs"),c=require("./validation-u8W7Lp2x.cjs"),n=require("./PeginManager-CeloRUHV.cjs"),A=require("./PayoutManager-BwYlPF2C.cjs"),_=require("./ApplicationRegistry.abi-BAPhJch3.cjs"),m=require("./BTCVaultRegistry.abi-JdeqLz4x.cjs"),d=require("./errors-CGcNP0rV.cjs"),b=require("./shared/index.cjs"),o=require("./waitForTransactionReceiptSmartAware-BFMQFEzj.cjs"),r=require("./fundPeginTransaction-C8qsXxNV.cjs"),P=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-CgUJ7Mpf.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=u.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=u.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=u.buildPrePeginPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.buildPeginInputPsbt=p.buildPeginInputPsbt;exports.extractPeginInputSignature=p.extractPeginInputSignature;exports.finalizePeginInputPsbt=p.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=S.buildNoPayoutPsbt;exports.buildRefundPsbt=S.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=t.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=t.deriveNativeSegwitAddress;exports.deriveTaprootAddress=t.deriveTaprootAddress;exports.ensureHexPrefix=t.ensureHexPrefix;exports.formatSatoshisToBtc=t.formatSatoshisToBtc;exports.getNetwork=t.getNetwork;exports.getSortedXOnlyPubkeys=t.getSortedXOnlyPubkeys;exports.hexToUint8Array=t.hexToUint8Array;exports.isAddressFromPublicKey=t.isAddressFromPublicKey;exports.isValidHex=t.isValidHex;exports.processPublicKeyToXOnly=t.processPublicKeyToXOnly;exports.stripHexPrefix=t.stripHexPrefix;exports.toXOnly=t.toXOnly;exports.uint8ArrayToHex=t.uint8ArrayToHex;exports.validateWalletPubkey=t.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=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=n.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=A.PayoutManager;exports.computeHashlock=A.computeHashlock;exports.validateSecretAgainstHashlock=A.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=d.CONTRACT_ERRORS;exports.extractErrorData=d.extractErrorData;exports.getContractErrorMessage=d.getContractErrorMessage;exports.handleContractError=d.handleContractError;exports.isKnownContractError=d.isKnownContractError;exports.BitcoinNetworks=b.BitcoinNetworks;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=r.BTC_DUST_SAT;exports.DUST_THRESHOLD=r.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=r.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=r.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=r.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=r.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=r.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=r.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=r.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=r.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=r.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=r.fundPeginTransaction;exports.parseUnfundedWasmTransaction=r.parseUnfundedWasmTransaction;exports.peginOutputCount=r.peginOutputCount;exports.rateBasedTxBufferFee=r.rateBasedTxBufferFee;exports.UtxoNotAvailableError=P.UtxoNotAvailableError;exports.assertUtxosAvailable=P.assertUtxosAvailable;exports.extractInputsFromTransaction=P.extractInputsFromTransaction;exports.findOverlappingPendingVaults=P.findOverlappingPendingVaults;exports.validateUtxosAvailable=P.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/index.js
CHANGED
|
@@ -16,10 +16,10 @@ import { B as ba, a as Ia, f as Oa, c as Va, b as va, d as Ca, g as Fa, i as ha,
|
|
|
16
16
|
import { B as Ma, D as Ha, F as La, L as Xa, M as ka, P as Wa, b as wa, a as Ka, S as Ga, T as Ya, W as Za, f as Ja, c as ja, p as qa, r as za } from "./fundPeginTransaction-C11tYf6I.js";
|
|
17
17
|
import { U as $a, a as ae, e as ee, f as se, v as te } from "./reservation-BxvKbQH2.js";
|
|
18
18
|
import { M as oe, V as ie, g as ne, a as ue, b as le, c as pe, d as de, e as Pe, f as ce, h as Te, p as Ee, v as Ae, i as Se, j as _e } from "./mempoolApi-BxT89SAq.js";
|
|
19
|
-
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-
|
|
20
|
-
import { A as De, D as Me, b as He, J as Le, a as Xe, d as ke, P as We, R as we, e as Ke, c as Ge, V as Ye } from "./types-
|
|
19
|
+
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-rbejoBPu.js";
|
|
20
|
+
import { A as De, D as Me, b as He, J as Le, a as Xe, d as ke, P as We, R as we, e as Ke, c as Ge, V as Ye } from "./types-CQDRQvV-.js";
|
|
21
21
|
import { i as Je, p as je } from "./errors-9AkghWyk.js";
|
|
22
|
-
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 ds, b as Ps, s as cs, v as Ts, g as Es, h as As, d as Ss, c as _s, e as gs, f as Rs, k as ms, w as xs } from "./buildAndBroadcastRefund-
|
|
22
|
+
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 ds, b as Ps, s as cs, v as Ts, g as Es, h as As, d as Ss, c as _s, e as gs, f as Rs, k as ms, w as xs } from "./buildAndBroadcastRefund-BssyvGWW.js";
|
|
23
23
|
import { C as bs, P as Is, c as Os, g as Vs } from "./peginState-CBAlxgXk.js";
|
|
24
24
|
export {
|
|
25
25
|
De as AUTH_EXPIRED_DATA_KIND,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var ge=Object.defineProperty;var fe=(r,e,t)=>e in r?ge(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var p=(r,e,t)=>fe(r,typeof e!="symbol"?e+"":e,t);const K=require("./BTCVaultRegistry.abi-JdeqLz4x.cjs"),f=require("./ApplicationRegistry.abi-BAPhJch3.cjs"),E=require("./mempoolApi-C_9JhjCI.cjs"),H=require("./types-eYlq0p1o.cjs"),m=require("./bitcoin-CHfKAhcI.cjs"),k=require("./validation-u8W7Lp2x.cjs"),_e=require("@bitcoin-js/tiny-secp256k1-asmjs"),C=require("bitcoinjs-lib"),S=require("buffer"),X=require("./sha2-DsrLC4NM.cjs");function me(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const U=me(_e);async function be(r,e){const[t,n]=await r.multicall({contracts:[{address:e,abi:K.BTCVaultRegistryABI,functionName:"protocolParams"},{address:e,abi:K.BTCVaultRegistryABI,functionName:"applicationRegistry"}],allowFailure:!1});return{protocolParams:t,applicationRegistry:n}}const q=65535;function I(r){return{timelockAssert:r.timelockAssert,timelockChallengeAssert:r.timelockChallengeAssert,securityCouncilKeys:[...r.securityCouncilKeys],councilQuorum:r.councilQuorum,feeRate:r.feeRate,babeTotalInstances:r.babeTotalInstances,babeInstancesToFinalize:r.babeInstancesToFinalize,minVpCommissionBps:r.minVpCommissionBps,tRefund:r.tRefund,tStale:r.tStale,minPeginFeeRate:r.minPeginFeeRate,proverCircuitVersion:r.proverCircuitVersion,minPrepeginDepth:r.minPrepeginDepth}}function J(r){return{minimumPegInAmount:r.minimumPegInAmount,maxPegInAmount:r.maxPegInAmount,pegInAckTimeout:r.pegInAckTimeout,pegInActivationTimeout:r.pegInActivationTimeout,maxHtlcOutputCount:r.maxHtlcOutputCount,expiredPegInGraceBlocks:r.expiredPegInGraceBlocks}}function Y(r){if(r>BigInt(q))throw new Error(`timelockAssert value ${r} exceeds uint16 max (${q})`);return Number(r)}class ye{constructor(e,t){this.publicClient=e,this.contractAddress=t}async getTBVProtocolParams(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getTBVProtocolParams"}),t=J(e);return E.validateTBVProtocolParams(t),t}async getLatestOffchainParams(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getLatestOffchainParams"}),t=I(e);return E.validateOffchainParams(t),t}async getOffchainParamsByVersion(e){const t=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getOffchainParamsByVersion",args:[e]}),n=I(t);return E.validateOffchainParams(n),n}async getLatestOffchainParamsVersion(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"latestOffchainParamsVersion"}),t=Number(e);return E.assertValidOffchainParamsVersion(t),t}async getTimelockPeginByVersion(e){const t=await this.getOffchainParamsByVersion(e);return Y(t.timelockAssert)}async getPegInConfiguration(){const e=await this.publicClient.multicall({contracts:[{address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getTBVProtocolParams"},{address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getLatestOffchainParams"},{address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"latestOffchainParamsVersion"}],allowFailure:!1}),t=J(e[0]),n=I(e[1]),s=Number(e[2]),i={minimumPegInAmount:t.minimumPegInAmount,maxPegInAmount:t.maxPegInAmount,pegInAckTimeout:t.pegInAckTimeout,pegInActivationTimeout:t.pegInActivationTimeout,maxHtlcOutputCount:t.maxHtlcOutputCount,expiredPegInGraceBlocks:t.expiredPegInGraceBlocks,timelockPegin:Y(n.timelockAssert),timelockRefund:n.tRefund,minVpCommissionBps:n.minVpCommissionBps,offchainParams:n,offchainParamsVersion:s};return E.validatePegInConfiguration(i),i}async fetchAllOffchainParams(e){const t=await this.getLatestOffchainParamsVersion();if(t===0)return{byVersion:new Map,latestVersion:0};const n=Array.from({length:t},(c,u)=>u+1),s=n.map(c=>({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getOffchainParamsByVersion",args:[c]})),i=await this.publicClient.multicall({contracts:s,allowFailure:!1}),o=new Map;for(let c=0;c<n.length;c++){const u=I(i[c]);try{E.validateOffchainParams(u),o.set(n[c],u)}catch(d){e==null||e(n[c],d instanceof Error?d:new Error(String(d)))}}return{byVersion:o,latestVersion:t}}}function N(r){return r.map(e=>({ethAddress:e.ethAddress,btcPubKey:e.btcPubKey}))}class Pe{constructor(e,t){this.publicClient=e,this.contractAddress=t}async getVaultKeepersByVersion(e,t){const n=await this.publicClient.readContract({address:this.contractAddress,abi:f.ApplicationRegistryABI,functionName:"getVaultKeepersByVersion",args:[e,t]});return N(n)}async getCurrentVaultKeepers(e){const t=await this.publicClient.readContract({address:this.contractAddress,abi:f.ApplicationRegistryABI,functionName:"getCurrentVaultKeepers",args:[e]});return N(t)}async getCurrentVaultKeepersVersion(e){return await this.publicClient.readContract({address:this.contractAddress,abi:f.ApplicationRegistryABI,functionName:"getCurrentVaultKeepersVersion",args:[e]})}}class we{constructor(e,t){this.publicClient=e,this.contractAddress=t}async getUniversalChallengersByVersion(e){const t=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getUniversalChallengersByVersion",args:[e]});return N(t)}async getCurrentUniversalChallengers(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getCurrentUniversalChallengers"});return N(e)}async getLatestUniversalChallengersVersion(){return await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"latestUniversalChallengersVersion"})}}var te=(r=>(r[r.PENDING=0]="PENDING",r[r.VERIFIED=1]="VERIFIED",r[r.ACTIVE=2]="ACTIVE",r[r.REDEEMED=3]="REDEEMED",r[r.EXPIRED=4]="EXPIRED",r))(te||{});const z=new Set(Object.values(H.DaemonStatus)),ve=200;function l(r){var e;return((e=JSON.stringify(r))==null?void 0:e.slice(0,ve))??"undefined"}const xe="The vault provider returned an unexpected response. Please try again or contact support.";class a extends Error{constructor(t){super(xe);p(this,"detail");this.name="VpResponseValidationError",this.detail=t}}const T=64;function v(r){return typeof r=="string"&&r.length>0&&k.HEX_RE.test(r)}function re(r){return typeof r=="string"&&r.length>0}function ne(r,e){if(!v(r))throw new a(`VP response validation failed: "${e}" must be a non-empty hex string, got ${l(r)}`)}function b(r,e){if(!re(r))throw new a(`VP response validation failed: "${e}" must be a non-empty string, got ${l(r)}`)}function M(r,e){if(!v(r)||r.length!==m.X_ONLY_PUBKEY_HEX_LEN&&r.length!==m.COMPRESSED_PUBKEY_HEX_LEN)throw new a(`VP response validation failed: "${e}" must be a ${m.X_ONLY_PUBKEY_HEX_LEN} or ${m.COMPRESSED_PUBKEY_HEX_LEN}-char hex string (BTC pubkey), got ${l(r)}`)}function Ae(r){const e=r.presigning;if(e==null)return;if(typeof e!="object"||Array.isArray(e))throw new a('VP response validation failed: "progress.presigning" must be an object if present');const t=e;if(t.depositor_graph_created!==void 0&&typeof t.depositor_graph_created!="boolean")throw new a(`VP response validation failed: "progress.presigning.depositor_graph_created" must be a boolean if present, got ${l(t.depositor_graph_created)}`);if(t.vk_challenger_presigning_completed!==void 0&&typeof t.vk_challenger_presigning_completed!="number")throw new a(`VP response validation failed: "progress.presigning.vk_challenger_presigning_completed" must be a number if present, got ${l(t.vk_challenger_presigning_completed)}`);if(t.vk_challenger_presigning_total!==void 0&&typeof t.vk_challenger_presigning_total!="number")throw new a(`VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${l(t.vk_challenger_presigning_total)}`)}function se(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: getPeginStatus response is not an object");const e=r;if(!v(e.pegin_txid)||e.pegin_txid.length!==T)throw new a(`VP response validation failed: "pegin_txid" must be a ${T}-char hex string (txid), got ${l(e.pegin_txid)}`);if(typeof e.status!="string")throw new a('VP response validation failed: "status" must be a string');if(!z.has(e.status))throw new a(`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...z].join(", ")}`);if(e.progress===null||typeof e.progress!="object"||Array.isArray(e.progress))throw new a('VP response validation failed: "progress" must be an object');if(Ae(e.progress),typeof e.health_info!="string")throw new a('VP response validation failed: "health_info" must be a string');if(e.last_error!==void 0&&typeof e.last_error!="string")throw new a(`VP response validation failed: "last_error" must be a string if present, got ${l(e.last_error)}`)}function Ee(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: requestDepositorPresignTransactions response is not an object");const e=r;if(!Array.isArray(e.txs))throw new a('VP response validation failed: "txs" must be an array');for(let t=0;t<e.txs.length;t++)Se(e.txs[t],`txs[${t}]`);if(e.depositor_graph===null||typeof e.depositor_graph!="object")throw new a('VP response validation failed: "depositor_graph" must be an object');Be(e.depositor_graph)}function P(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);ne(r.tx_hex,`${e}.tx_hex`)}function Se(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);const t=r;M(t.claimer_pubkey,`${e}.claimer_pubkey`),P(t.claim_tx,`${e}.claim_tx`),P(t.assert_tx,`${e}.assert_tx`),P(t.payout_tx,`${e}.payout_tx`),b(t.payout_psbt,`${e}.payout_psbt`)}function Te(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);const t=r;b(t.wots_pks_json,`${e}.wots_pks_json`),b(t.gc_wots_keys_json,`${e}.gc_wots_keys_json`)}function ke(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);const t=r;if(M(t.challenger_pubkey,`${e}.challenger_pubkey`),P(t.challenge_assert_x_tx,`${e}.challenge_assert_x_tx`),P(t.challenge_assert_y_tx,`${e}.challenge_assert_y_tx`),P(t.nopayout_tx,`${e}.nopayout_tx`),b(t.nopayout_psbt,`${e}.nopayout_psbt`),!Array.isArray(t.challenge_assert_connectors))throw new a(`VP response validation failed: "${e}.challenge_assert_connectors" must be an array`);for(let n=0;n<t.challenge_assert_connectors.length;n++)Te(t.challenge_assert_connectors[n],`${e}.challenge_assert_connectors[${n}]`);if(!Array.isArray(t.output_label_hashes))throw new a(`VP response validation failed: "${e}.output_label_hashes" must be an array`);for(let n=0;n<t.output_label_hashes.length;n++)ne(t.output_label_hashes[n],`${e}.output_label_hashes[${n}]`)}function ie(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: requestDepositorClaimerArtifacts response is not an object");const e=r;if(!re(e.tx_graph_json))throw new a(`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${l(e.tx_graph_json)}`);if(!v(e.verifying_key_hex))throw new a(`VP response validation failed: "verifying_key_hex" must be a non-empty hex string, got ${l(e.verifying_key_hex)}`);if(e.babe_sessions===null||typeof e.babe_sessions!="object"||Array.isArray(e.babe_sessions))throw new a('VP response validation failed: "babe_sessions" must be an object');const t=Object.entries(e.babe_sessions);if(t.length===0)throw new a('VP response validation failed: "babe_sessions" must contain at least one challenger entry');for(const[n,s]of t){if(M(n,`babe_sessions["${n}"]`),s===null||typeof s!="object")throw new a(`VP response validation failed: "babe_sessions.${n}" must be an object`);const i=s;if(!v(i.decryptor_artifacts_hex))throw new a(`VP response validation failed: "babe_sessions.${n}.decryptor_artifacts_hex" must be a non-empty hex string, got ${l(i.decryptor_artifacts_hex)}`)}}function Ve(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: pegout status payload is not an object");const e=r;if(!v(e.pegin_txid)||e.pegin_txid.length!==T)throw new a(`VP response validation failed: "pegin_txid" must be a ${T}-char hex string (txid), got ${l(e.pegin_txid)}`);if(typeof e.found!="boolean")throw new a(`VP response validation failed: "found" must be a boolean, got ${l(e.found)}`);if(e.claimer!==null){if(typeof e.claimer!="object")throw new a(`VP response validation failed: "claimer" must be an object or null, got ${l(e.claimer)}`);$e(e.claimer)}if(!Array.isArray(e.challengers))throw new a(`VP response validation failed: "challengers" must be an array, got ${l(e.challengers)}`);for(let t=0;t<e.challengers.length;t++)Ce(e.challengers[t],t)}function $e(r){if(b(r.status,"claimer.status"),typeof r.failed!="boolean")throw new a(`VP response validation failed: "claimer.failed" must be a boolean, got ${l(r.failed)}`);if(b(r.claim_txid,"claimer.claim_txid"),b(r.claimer_pubkey,"claimer.claimer_pubkey"),b(r.assert_txid,"claimer.assert_txid"),typeof r.created_at!="number")throw new a(`VP response validation failed: "claimer.created_at" must be a number, got ${l(r.created_at)}`);if(typeof r.updated_at!="number")throw new a(`VP response validation failed: "claimer.updated_at" must be a number, got ${l(r.updated_at)}`)}function Ce(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "challengers[${e}]" must be an object, got ${l(r)}`);const t=r;if(b(t.status,`challengers[${e}].status`),b(t.claim_txid,`challengers[${e}].claim_txid`),b(t.claimer_pubkey,`challengers[${e}].claimer_pubkey`),R(t.assert_txid,`challengers[${e}].assert_txid`),R(t.challenge_assert_x_txid,`challengers[${e}].challenge_assert_x_txid`),R(t.challenge_assert_y_txid,`challengers[${e}].challenge_assert_y_txid`),R(t.nopayout_txid,`challengers[${e}].nopayout_txid`),typeof t.created_at!="number")throw new a(`VP response validation failed: "challengers[${e}].created_at" must be a number, got ${l(t.created_at)}`);if(typeof t.updated_at!="number")throw new a(`VP response validation failed: "challengers[${e}].updated_at" must be a number, got ${l(t.updated_at)}`)}function R(r,e){if(r!==null&&typeof r!="string")throw new a(`VP response validation failed: "${e}" must be a string or null, got ${l(r)}`)}function Ie(r){ae(r,"batchGetPeginStatus",e=>{e.result!==null&&se(e.result)})}function Re(r){ae(r,"batchGetPegoutStatus",e=>{e.result!==null&&Ve(e.result)})}function ae(r,e,t){if(r===null||typeof r!="object")throw new a(`VP response validation failed: ${e} response is not an object`);const n=r;if(!Array.isArray(n.results))throw new a(`VP response validation failed: "${e}.results" must be an array, got ${l(n.results)}`);for(let s=0;s<n.results.length;s++){const i=n.results[s];if(i===null||typeof i!="object")throw new a(`VP response validation failed: "${e}.results[${s}]" must be an object, got ${l(i)}`);const o=i;if(!v(o.pegin_txid)||o.pegin_txid.length!==T)throw new a(`VP response validation failed: "${e}.results[${s}].pegin_txid" must be a ${T}-char hex string, got ${l(o.pegin_txid)}`);if(o.error!==null&&typeof o.error!="string")throw new a(`VP response validation failed: "${e}.results[${s}].error" must be a string or null, got ${l(o.error)}`);if(o.result===null&&o.error===null)throw new a(`VP response validation failed: "${e}.results[${s}]" has neither "result" nor "error" populated`);if(o.result!==null&&o.error!==null)throw new a(`VP response validation failed: "${e}.results[${s}]" has both "result" and "error" populated`);t(o,s)}}function Be(r){if(P(r.claim_tx,"depositor_graph.claim_tx"),P(r.assert_tx,"depositor_graph.assert_tx"),P(r.payout_tx,"depositor_graph.payout_tx"),b(r.payout_psbt,"depositor_graph.payout_psbt"),!Array.isArray(r.challenger_presign_data))throw new a('VP response validation failed: "depositor_graph.challenger_presign_data" must be an array');for(let e=0;e<r.challenger_presign_data.length;e++)ke(r.challenger_presign_data[e],`depositor_graph.challenger_presign_data[${e}]`);if(typeof r.offchain_params_version!="number")throw new a('VP response validation failed: "depositor_graph.offchain_params_version" must be a number')}const Ne=6e4;class oe{constructor(e,t){p(this,"client");const n={baseUrl:e,timeout:(t==null?void 0:t.timeout)??Ne,retries:t==null?void 0:t.retries,retryDelay:t==null?void 0:t.retryDelay,retryableFor:t==null?void 0:t.retryableFor,headers:t==null?void 0:t.headers,tokenProvider:t==null?void 0:t.tokenProvider,maxResponseBytes:t==null?void 0:t.maxResponseBytes};this.client=new H.JsonRpcClient(n)}async requestDepositorPresignTransactions(e,t){const n=await this.client.call("vaultProvider_requestDepositorPresignTransactions",e,t);return Ee(n),n}async submitDepositorPresignatures(e,t){return this.client.call("vaultProvider_submitDepositorPresignatures",e,t)}async submitDepositorWotsKey(e,t){return this.client.call("vaultProvider_submitDepositorWotsKey",e,t)}async requestDepositorClaimerArtifacts(e,t){const n=await this.client.call("vaultProvider_requestDepositorClaimerArtifacts",e,t);return ie(n),n}async getPeginStatus(e,t){const n=await this.client.call("vaultProvider_getPeginStatus",e,t);return se(n),n}async batchGetPeginStatus(e,t){const n=await this.client.call("vaultProvider_batchGetPeginStatus",e,t);return Ie(n),n}async batchGetPegoutStatus(e,t){const n=await this.client.call("vaultProvider_batchGetPegoutStatus",e,t);return Re(n),n}}function De(r,e){const t=new Set;for(const u of r)t.add(u.toLowerCase());const n=new Map,s=new Set,i=[],o=[];for(const u of e){const d=u.pegin_txid.toLowerCase();if(!t.has(d)){o.push(d);continue}if(s.has(d)){i.push(d);continue}s.add(d),n.set(d,{result:u.result,error:u.error})}const c=[];for(const u of t)s.has(u)||c.push(u);return{byTxid:n,missing:c,unexpected:o,duplicate:i}}async function He(r){const{items:e,getTxid:t,batchCall:n,onItem:s,onMissing:i,onDuplicate:o,onDuplicateBatch:c,onWholeBatchError:u,onUnexpected:d,batchSize:_=H.VP_BATCH_MAX_SIZE}=r;if(!Number.isInteger(_)||_<=0)throw new Error(`batchPollByProvider: batchSize must be a positive integer, got ${_}`);for(let w=0;w<e.length;w+=_){const x=e.slice(w,w+_),V=new Map,O=[];for(const h of x){const y=t(h).toLowerCase();V.set(y,h),O.push(y)}let A;try{const h=await n(O);A=De(O,h.results)}catch(h){u(x,h);continue}d&&A.unexpected.length>0&&d(A.unexpected);const $=new Set(A.duplicate);for(const h of $){const y=V.get(h);y&&o(y)}c&&$.size>0&&c($.size);for(const h of A.missing){const y=V.get(h);y&&i(y)}for(const[h,y]of A.byTxid){if($.has(h))continue;const F=V.get(h);F&&s(F,{pegin_txid:h,result:y.result,error:y.error})}}}const Oe="BIP0322-signed-message",Ge="TapTweak",ce=32,je=64;function le(r,e){const t=new TextEncoder().encode(r),n=X.sha256(t),s=new Uint8Array(n.length*2+e.length);return s.set(n,0),s.set(n,n.length),s.set(e,n.length*2),X.sha256(s)}function Ue(r){if(r.length!==ce)return null;const e=le(Ge,r),t=U.xOnlyPointAddTweak(r,e);return t?t.xOnlyPubkey:null}function Me(r,e,t){if(e.length!==ce||t.length!==je)return!1;try{const n=le(Oe,r),s=C.payments.p2tr({internalPubkey:S.Buffer.from(e)});if(!s.output)return!1;const i=s.output,o=0,c=new C.Transaction;c.version=0,c.locktime=0;const u=S.Buffer.concat([S.Buffer.from([0,32]),S.Buffer.from(n)]);c.addInput(S.Buffer.alloc(32,0),4294967295,0,u),c.addOutput(i,o);const d=new C.Transaction;d.version=0,d.locktime=0;const _=c.getHash();d.addInput(_,0,0),d.addOutput(S.Buffer.from([106]),o);const w=d.hashForWitnessV1(0,[i],[o],C.Transaction.SIGHASH_DEFAULT),x=Ue(e);return x?U.verifySchnorr(w,x,t):!1}catch{return!1}}function D(r,e){const t=(r&7)<<5,n=typeof e=="bigint"?e:BigInt(e);if(n<0n)throw new Error("cborHead: negative argument");if(n<24n)return new Uint8Array([t|Number(n)]);if(n<0x100n)return new Uint8Array([t|24,Number(n)]);if(n<0x10000n){const i=Number(n);return new Uint8Array([t|25,i>>>8&255,i&255])}if(n<0x100000000n){const i=Number(n);return new Uint8Array([t|26,i>>>24&255,i>>>16&255,i>>>8&255,i&255])}const s=new Uint8Array(9);s[0]=t|27;for(let i=7;i>=0;i--)s[1+i]=Number(n>>BigInt((7-i)*8))&255;return s}function ue(...r){const e=r.reduce((s,i)=>s+i.length,0),t=new Uint8Array(e);let n=0;for(const s of r)t.set(s,n),n+=s.length;return t}function W(r){const t=[D(4,r.length)];for(const n of r)t.push(D(0,n));return ue(...t)}function Le(r,e,t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`encodeServerIdentityPayload: expires_at must be a non-negative safe integer, got ${t}`);const n=D(4,3),s=W(r),i=W(e),o=D(0,t);return ue(n,s,i,o)}const Fe=new TextEncoder().encode("btc-auth.server-identity.v1"),Ke=2*3600;class g extends Error{constructor(e,t){super(e),this.reason=t,this.name="ServerIdentityError"}}function B(r){const e=new Uint8Array(r.length/2);for(let t=0;t<e.length;t++)e[t]=parseInt(r.slice(t*2,t*2+2),16);return e}function de(r){const{proof:e,pinnedServerPubkey:t,now:n}=r,s=r.maxLifetimeSecs??Ke,i=m.stripHexPrefix(t).toLowerCase();if(i.length!==m.X_ONLY_PUBKEY_HEX_LEN||!k.HEX_RE.test(i))throw new g(`pinnedServerPubkey must be 32-byte hex; got ${i.length} chars`,"invalid_pubkey_encoding");const o=m.stripHexPrefix(e.server_pubkey).toLowerCase();if(o.length!==m.X_ONLY_PUBKEY_HEX_LEN||!k.HEX_RE.test(o))throw new g(`server_pubkey must be 32-byte hex; got ${o.length} chars`,"invalid_pubkey_encoding");if(o!==i)throw new g(`server_pubkey does not match pinned value: expected ${i}, got ${o}`,"pinned_pubkey_mismatch");if(!Number.isSafeInteger(e.expires_at))throw new g(`expires_at must be a finite integer; got ${JSON.stringify(e.expires_at)}`,"invalid_expires_at");if(!Number.isSafeInteger(n))throw new g(`now must be a finite integer; got ${JSON.stringify(n)}`,"invalid_expires_at");if(e.expires_at<=n)throw new g(`server identity proof expired at ${e.expires_at}, now ${n}`,"expired");if(!Number.isSafeInteger(s)||s<=0)throw new g(`maxLifetimeSecs must be a positive safe integer; got ${JSON.stringify(s)}`,"invalid_max_lifetime");if(e.expires_at-n>s)throw new g(`server identity proof expires too far in the future: expires_at=${e.expires_at}, now=${n}, max lifetime=${s}s`,"expires_too_far");const c=m.stripHexPrefix(e.ephemeral_pubkey).toLowerCase();if(c.length!==m.COMPRESSED_PUBKEY_HEX_LEN||!k.HEX_RE.test(c))throw new g(`ephemeral_pubkey must be 33-byte compressed hex; got ${c.length} chars`,"invalid_ephemeral_pubkey");const u=c.slice(0,2);if(u!=="02"&&u!=="03")throw new g(`ephemeral_pubkey must be compressed (prefix 02/03); got ${u}`,"invalid_ephemeral_pubkey");const d=B(c);if(!U.isPoint(d))throw new g("ephemeral_pubkey is not a valid secp256k1 point","invalid_ephemeral_pubkey");const _=m.stripHexPrefix(e.signature).toLowerCase();if(_.length!==m.SCHNORR_SIG_HEX_LEN||!k.HEX_RE.test(_))throw new g(`signature must be 64-byte Schnorr hex; got ${_.length} chars`,"invalid_signature_encoding");const w=Le(Fe,B(c),e.expires_at);if(!Me(w,B(o),B(_)))throw new g("BIP-322 signature verification failed — ephemeral key is not attested by pinned server pubkey","signature_verification_failed")}const Z=new Set(["vaultProvider_submitDepositorWotsKey","vaultProvider_submitDepositorPresignatures","vaultProvider_requestDepositorPresignTransactions"]),Q=new Set(["vaultProvider_requestDepositorClaimerArtifacts"]),Xe=6e4,G="auth_createDepositorToken",j="auth_createDepositorTokenGrpc";function pe(r,e){return new H.JsonRpcClient({baseUrl:r,timeout:Xe,headers:e,retryableFor:t=>t===G||t===j})}const ee=4102444800,qe=30;class Je{constructor(e){p(this,"client");p(this,"peginTxid");p(this,"authAnchorHex");p(this,"pinnedServerPubkey");p(this,"authGatedMethods");p(this,"grpcGatedMethods");p(this,"refreshSkewSecs");p(this,"now");p(this,"cachedJsonRpc",null);p(this,"inFlightJsonRpc",null);p(this,"cachedGrpc",null);p(this,"inFlightGrpc",null);this.client=e.client,this.peginTxid=e.peginTxid,this.authAnchorHex=e.authAnchorHex,this.pinnedServerPubkey=e.pinnedServerPubkey,this.authGatedMethods=e.authGatedMethods,this.grpcGatedMethods=e.grpcGatedMethods,this.refreshSkewSecs=e.refreshSkewSecs??qe,this.now=e.now??(()=>Math.floor(Date.now()/1e3))}async getToken(e){return e===G||e===j?null:this.grpcGatedMethods.has(e)?this.getTokenForSubject("grpc"):this.authGatedMethods.has(e)?this.getTokenForSubject("jsonrpc"):null}invalidate(){this.cachedJsonRpc=null,this.cachedGrpc=null}async getTokenForSubject(e){const t=e==="grpc"?this.cachedGrpc:this.cachedJsonRpc;return t&&this.now()+this.refreshSkewSecs<t.expiresAt?t.token:(await this.acquireSingleFlight(e)).token}setClient(e){this.client=e}acquireSingleFlight(e){const t=e==="grpc"?this.inFlightGrpc:this.inFlightJsonRpc;if(t)return t;const n=e==="grpc"?j:G,s=(async()=>{try{const i=await this.client.call(n,{pegin_txid:this.peginTxid,auth_anchor:this.authAnchorHex});if(de({proof:i.server_identity,pinnedServerPubkey:this.pinnedServerPubkey,now:this.now()}),typeof i.token!="string"||i.token.length===0)throw new Error(`VpTokenProvider: invalid token in acquire response (expected non-empty string, got ${typeof i.token})`);const o=this.now();if(!Number.isSafeInteger(i.expires_at)||i.expires_at<=o||i.expires_at>ee)throw new Error(`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(i.expires_at)}; must be a safe integer in (${o}, ${ee}])`);const c={token:i.token,expiresAt:i.expires_at};return e==="grpc"?this.cachedGrpc=c:this.cachedJsonRpc=c,c}finally{e==="grpc"?this.inFlightGrpc=null:this.inFlightJsonRpc=null}})();return e==="grpc"?this.inFlightGrpc=s:this.inFlightJsonRpc=s,s}}class he{constructor(){p(this,"entries",new Map)}getOrCreate(e){const t=e.enableGrpcArtifactAuth??!1,n=this.entries.get(e.peginTxid);if(n){if(n.authAnchorHex!==e.authAnchorHex)throw new Error(`VpTokenRegistry: peginTxid ${e.peginTxid} already bound to authAnchorHex ${n.authAnchorHex.slice(0,8)}…; got ${e.authAnchorHex.slice(0,8)}…`);if(n.pinnedServerPubkey!==e.pinnedServerPubkey)throw new Error(`VpTokenRegistry: peginTxid ${e.peginTxid} already bound to pinnedServerPubkey ${n.pinnedServerPubkey.slice(0,8)}…; got ${e.pinnedServerPubkey.slice(0,8)}…`);if(n.enableGrpcArtifactAuth!==t)throw new Error(`VpTokenRegistry: peginTxid ${e.peginTxid} already bound to enableGrpcArtifactAuth=${n.enableGrpcArtifactAuth}; got ${t}`);return n.provider.setClient(e.client),n.provider}const s=new Je({client:e.client,peginTxid:e.peginTxid,authAnchorHex:e.authAnchorHex,pinnedServerPubkey:e.pinnedServerPubkey,authGatedMethods:t?Z:new Set([...Z,...Q]),grpcGatedMethods:t?Q:new Set});return this.entries.set(e.peginTxid,{provider:s,authAnchorHex:e.authAnchorHex,pinnedServerPubkey:e.pinnedServerPubkey,enableGrpcArtifactAuth:t}),s}peek(e){var t;return(t=this.entries.get(e))==null?void 0:t.provider}release(e){this.entries.delete(e)}clear(){this.entries.clear()}get size(){return this.entries.size}}const L=new he;function Ye(r){var n;const e=pe(r.baseUrl,(n=r.options)==null?void 0:n.headers),t=L.getOrCreate({client:e,peginTxid:r.peginTxid,authAnchorHex:r.authAnchorHex,pinnedServerPubkey:r.pinnedServerPubkey,enableGrpcArtifactAuth:r.enableGrpcArtifactAuth});return new oe(r.baseUrl,{...r.options,tokenProvider:t})}function ze(r){L.getOrCreate({client:pe(r.baseUrl,r.headers),peginTxid:r.peginTxid,authAnchorHex:r.authAnchorHex,pinnedServerPubkey:r.pinnedServerPubkey,enableGrpcArtifactAuth:r.enableGrpcArtifactAuth})}exports.OnChainBtcVaultStatus=te;exports.ServerIdentityError=g;exports.VaultProviderRpcClient=oe;exports.ViemProtocolParamsReader=ye;exports.ViemUniversalChallengerReader=we;exports.ViemVaultKeeperReader=Pe;exports.VpResponseValidationError=a;exports.VpTokenRegistry=he;exports.batchPollByProvider=He;exports.createAuthenticatedVpClient=Ye;exports.primeVpTokenRegistry=ze;exports.resolveProtocolAddresses=be;exports.validateRequestDepositorClaimerArtifactsResponse=ie;exports.verifyServerIdentity=de;exports.vpTokenRegistry=L;
|
|
2
|
-
//# sourceMappingURL=primeVpAuth-
|
|
1
|
+
"use strict";var ge=Object.defineProperty;var fe=(r,e,t)=>e in r?ge(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var p=(r,e,t)=>fe(r,typeof e!="symbol"?e+"":e,t);const K=require("./BTCVaultRegistry.abi-JdeqLz4x.cjs"),f=require("./ApplicationRegistry.abi-BAPhJch3.cjs"),E=require("./mempoolApi-C_9JhjCI.cjs"),H=require("./types-WA0LrDk1.cjs"),m=require("./bitcoin-CHfKAhcI.cjs"),k=require("./validation-u8W7Lp2x.cjs"),_e=require("@bitcoin-js/tiny-secp256k1-asmjs"),C=require("bitcoinjs-lib"),S=require("buffer"),X=require("./sha2-DsrLC4NM.cjs");function me(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const U=me(_e);async function be(r,e){const[t,n]=await r.multicall({contracts:[{address:e,abi:K.BTCVaultRegistryABI,functionName:"protocolParams"},{address:e,abi:K.BTCVaultRegistryABI,functionName:"applicationRegistry"}],allowFailure:!1});return{protocolParams:t,applicationRegistry:n}}const q=65535;function I(r){return{timelockAssert:r.timelockAssert,timelockChallengeAssert:r.timelockChallengeAssert,securityCouncilKeys:[...r.securityCouncilKeys],councilQuorum:r.councilQuorum,feeRate:r.feeRate,babeTotalInstances:r.babeTotalInstances,babeInstancesToFinalize:r.babeInstancesToFinalize,minVpCommissionBps:r.minVpCommissionBps,tRefund:r.tRefund,tStale:r.tStale,minPeginFeeRate:r.minPeginFeeRate,proverCircuitVersion:r.proverCircuitVersion,minPrepeginDepth:r.minPrepeginDepth}}function J(r){return{minimumPegInAmount:r.minimumPegInAmount,maxPegInAmount:r.maxPegInAmount,pegInAckTimeout:r.pegInAckTimeout,pegInActivationTimeout:r.pegInActivationTimeout,maxHtlcOutputCount:r.maxHtlcOutputCount,expiredPegInGraceBlocks:r.expiredPegInGraceBlocks}}function Y(r){if(r>BigInt(q))throw new Error(`timelockAssert value ${r} exceeds uint16 max (${q})`);return Number(r)}class ye{constructor(e,t){this.publicClient=e,this.contractAddress=t}async getTBVProtocolParams(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getTBVProtocolParams"}),t=J(e);return E.validateTBVProtocolParams(t),t}async getLatestOffchainParams(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getLatestOffchainParams"}),t=I(e);return E.validateOffchainParams(t),t}async getOffchainParamsByVersion(e){const t=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getOffchainParamsByVersion",args:[e]}),n=I(t);return E.validateOffchainParams(n),n}async getLatestOffchainParamsVersion(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"latestOffchainParamsVersion"}),t=Number(e);return E.assertValidOffchainParamsVersion(t),t}async getTimelockPeginByVersion(e){const t=await this.getOffchainParamsByVersion(e);return Y(t.timelockAssert)}async getPegInConfiguration(){const e=await this.publicClient.multicall({contracts:[{address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getTBVProtocolParams"},{address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getLatestOffchainParams"},{address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"latestOffchainParamsVersion"}],allowFailure:!1}),t=J(e[0]),n=I(e[1]),s=Number(e[2]),i={minimumPegInAmount:t.minimumPegInAmount,maxPegInAmount:t.maxPegInAmount,pegInAckTimeout:t.pegInAckTimeout,pegInActivationTimeout:t.pegInActivationTimeout,maxHtlcOutputCount:t.maxHtlcOutputCount,expiredPegInGraceBlocks:t.expiredPegInGraceBlocks,timelockPegin:Y(n.timelockAssert),timelockRefund:n.tRefund,minVpCommissionBps:n.minVpCommissionBps,offchainParams:n,offchainParamsVersion:s};return E.validatePegInConfiguration(i),i}async fetchAllOffchainParams(e){const t=await this.getLatestOffchainParamsVersion();if(t===0)return{byVersion:new Map,latestVersion:0};const n=Array.from({length:t},(c,u)=>u+1),s=n.map(c=>({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getOffchainParamsByVersion",args:[c]})),i=await this.publicClient.multicall({contracts:s,allowFailure:!1}),o=new Map;for(let c=0;c<n.length;c++){const u=I(i[c]);try{E.validateOffchainParams(u),o.set(n[c],u)}catch(d){e==null||e(n[c],d instanceof Error?d:new Error(String(d)))}}return{byVersion:o,latestVersion:t}}}function N(r){return r.map(e=>({ethAddress:e.ethAddress,btcPubKey:e.btcPubKey}))}class Pe{constructor(e,t){this.publicClient=e,this.contractAddress=t}async getVaultKeepersByVersion(e,t){const n=await this.publicClient.readContract({address:this.contractAddress,abi:f.ApplicationRegistryABI,functionName:"getVaultKeepersByVersion",args:[e,t]});return N(n)}async getCurrentVaultKeepers(e){const t=await this.publicClient.readContract({address:this.contractAddress,abi:f.ApplicationRegistryABI,functionName:"getCurrentVaultKeepers",args:[e]});return N(t)}async getCurrentVaultKeepersVersion(e){return await this.publicClient.readContract({address:this.contractAddress,abi:f.ApplicationRegistryABI,functionName:"getCurrentVaultKeepersVersion",args:[e]})}}class we{constructor(e,t){this.publicClient=e,this.contractAddress=t}async getUniversalChallengersByVersion(e){const t=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getUniversalChallengersByVersion",args:[e]});return N(t)}async getCurrentUniversalChallengers(){const e=await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"getCurrentUniversalChallengers"});return N(e)}async getLatestUniversalChallengersVersion(){return await this.publicClient.readContract({address:this.contractAddress,abi:f.ProtocolParamsABI,functionName:"latestUniversalChallengersVersion"})}}var te=(r=>(r[r.PENDING=0]="PENDING",r[r.VERIFIED=1]="VERIFIED",r[r.ACTIVE=2]="ACTIVE",r[r.REDEEMED=3]="REDEEMED",r[r.EXPIRED=4]="EXPIRED",r))(te||{});const z=new Set(Object.values(H.DaemonStatus)),ve=200;function l(r){var e;return((e=JSON.stringify(r))==null?void 0:e.slice(0,ve))??"undefined"}const xe="The vault provider returned an unexpected response. Please try again or contact support.";class a extends Error{constructor(t){super(xe);p(this,"detail");this.name="VpResponseValidationError",this.detail=t}}const T=64;function v(r){return typeof r=="string"&&r.length>0&&k.HEX_RE.test(r)}function re(r){return typeof r=="string"&&r.length>0}function ne(r,e){if(!v(r))throw new a(`VP response validation failed: "${e}" must be a non-empty hex string, got ${l(r)}`)}function b(r,e){if(!re(r))throw new a(`VP response validation failed: "${e}" must be a non-empty string, got ${l(r)}`)}function M(r,e){if(!v(r)||r.length!==m.X_ONLY_PUBKEY_HEX_LEN&&r.length!==m.COMPRESSED_PUBKEY_HEX_LEN)throw new a(`VP response validation failed: "${e}" must be a ${m.X_ONLY_PUBKEY_HEX_LEN} or ${m.COMPRESSED_PUBKEY_HEX_LEN}-char hex string (BTC pubkey), got ${l(r)}`)}function Ae(r){const e=r.presigning;if(e==null)return;if(typeof e!="object"||Array.isArray(e))throw new a('VP response validation failed: "progress.presigning" must be an object if present');const t=e;if(t.depositor_graph_created!==void 0&&typeof t.depositor_graph_created!="boolean")throw new a(`VP response validation failed: "progress.presigning.depositor_graph_created" must be a boolean if present, got ${l(t.depositor_graph_created)}`);if(t.vk_challenger_presigning_completed!==void 0&&typeof t.vk_challenger_presigning_completed!="number")throw new a(`VP response validation failed: "progress.presigning.vk_challenger_presigning_completed" must be a number if present, got ${l(t.vk_challenger_presigning_completed)}`);if(t.vk_challenger_presigning_total!==void 0&&typeof t.vk_challenger_presigning_total!="number")throw new a(`VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${l(t.vk_challenger_presigning_total)}`)}function se(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: getPeginStatus response is not an object");const e=r;if(!v(e.pegin_txid)||e.pegin_txid.length!==T)throw new a(`VP response validation failed: "pegin_txid" must be a ${T}-char hex string (txid), got ${l(e.pegin_txid)}`);if(typeof e.status!="string")throw new a('VP response validation failed: "status" must be a string');if(!z.has(e.status))throw new a(`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...z].join(", ")}`);if(e.progress===null||typeof e.progress!="object"||Array.isArray(e.progress))throw new a('VP response validation failed: "progress" must be an object');if(Ae(e.progress),typeof e.health_info!="string")throw new a('VP response validation failed: "health_info" must be a string');if(e.last_error!==void 0&&typeof e.last_error!="string")throw new a(`VP response validation failed: "last_error" must be a string if present, got ${l(e.last_error)}`)}function Ee(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: requestDepositorPresignTransactions response is not an object");const e=r;if(!Array.isArray(e.txs))throw new a('VP response validation failed: "txs" must be an array');for(let t=0;t<e.txs.length;t++)Se(e.txs[t],`txs[${t}]`);if(e.depositor_graph===null||typeof e.depositor_graph!="object")throw new a('VP response validation failed: "depositor_graph" must be an object');Be(e.depositor_graph)}function P(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);ne(r.tx_hex,`${e}.tx_hex`)}function Se(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);const t=r;M(t.claimer_pubkey,`${e}.claimer_pubkey`),P(t.claim_tx,`${e}.claim_tx`),P(t.assert_tx,`${e}.assert_tx`),P(t.payout_tx,`${e}.payout_tx`),b(t.payout_psbt,`${e}.payout_psbt`)}function Te(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);const t=r;b(t.wots_pks_json,`${e}.wots_pks_json`),b(t.gc_wots_keys_json,`${e}.gc_wots_keys_json`)}function ke(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "${e}" must be an object`);const t=r;if(M(t.challenger_pubkey,`${e}.challenger_pubkey`),P(t.challenge_assert_x_tx,`${e}.challenge_assert_x_tx`),P(t.challenge_assert_y_tx,`${e}.challenge_assert_y_tx`),P(t.nopayout_tx,`${e}.nopayout_tx`),b(t.nopayout_psbt,`${e}.nopayout_psbt`),!Array.isArray(t.challenge_assert_connectors))throw new a(`VP response validation failed: "${e}.challenge_assert_connectors" must be an array`);for(let n=0;n<t.challenge_assert_connectors.length;n++)Te(t.challenge_assert_connectors[n],`${e}.challenge_assert_connectors[${n}]`);if(!Array.isArray(t.output_label_hashes))throw new a(`VP response validation failed: "${e}.output_label_hashes" must be an array`);for(let n=0;n<t.output_label_hashes.length;n++)ne(t.output_label_hashes[n],`${e}.output_label_hashes[${n}]`)}function ie(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: requestDepositorClaimerArtifacts response is not an object");const e=r;if(!re(e.tx_graph_json))throw new a(`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${l(e.tx_graph_json)}`);if(!v(e.verifying_key_hex))throw new a(`VP response validation failed: "verifying_key_hex" must be a non-empty hex string, got ${l(e.verifying_key_hex)}`);if(e.babe_sessions===null||typeof e.babe_sessions!="object"||Array.isArray(e.babe_sessions))throw new a('VP response validation failed: "babe_sessions" must be an object');const t=Object.entries(e.babe_sessions);if(t.length===0)throw new a('VP response validation failed: "babe_sessions" must contain at least one challenger entry');for(const[n,s]of t){if(M(n,`babe_sessions["${n}"]`),s===null||typeof s!="object")throw new a(`VP response validation failed: "babe_sessions.${n}" must be an object`);const i=s;if(!v(i.decryptor_artifacts_hex))throw new a(`VP response validation failed: "babe_sessions.${n}.decryptor_artifacts_hex" must be a non-empty hex string, got ${l(i.decryptor_artifacts_hex)}`)}}function Ve(r){if(r===null||typeof r!="object")throw new a("VP response validation failed: pegout status payload is not an object");const e=r;if(!v(e.pegin_txid)||e.pegin_txid.length!==T)throw new a(`VP response validation failed: "pegin_txid" must be a ${T}-char hex string (txid), got ${l(e.pegin_txid)}`);if(typeof e.found!="boolean")throw new a(`VP response validation failed: "found" must be a boolean, got ${l(e.found)}`);if(e.claimer!==null){if(typeof e.claimer!="object")throw new a(`VP response validation failed: "claimer" must be an object or null, got ${l(e.claimer)}`);$e(e.claimer)}if(!Array.isArray(e.challengers))throw new a(`VP response validation failed: "challengers" must be an array, got ${l(e.challengers)}`);for(let t=0;t<e.challengers.length;t++)Ce(e.challengers[t],t)}function $e(r){if(b(r.status,"claimer.status"),typeof r.failed!="boolean")throw new a(`VP response validation failed: "claimer.failed" must be a boolean, got ${l(r.failed)}`);if(b(r.claim_txid,"claimer.claim_txid"),b(r.claimer_pubkey,"claimer.claimer_pubkey"),b(r.assert_txid,"claimer.assert_txid"),typeof r.created_at!="number")throw new a(`VP response validation failed: "claimer.created_at" must be a number, got ${l(r.created_at)}`);if(typeof r.updated_at!="number")throw new a(`VP response validation failed: "claimer.updated_at" must be a number, got ${l(r.updated_at)}`)}function Ce(r,e){if(r===null||typeof r!="object")throw new a(`VP response validation failed: "challengers[${e}]" must be an object, got ${l(r)}`);const t=r;if(b(t.status,`challengers[${e}].status`),b(t.claim_txid,`challengers[${e}].claim_txid`),b(t.claimer_pubkey,`challengers[${e}].claimer_pubkey`),R(t.assert_txid,`challengers[${e}].assert_txid`),R(t.challenge_assert_x_txid,`challengers[${e}].challenge_assert_x_txid`),R(t.challenge_assert_y_txid,`challengers[${e}].challenge_assert_y_txid`),R(t.nopayout_txid,`challengers[${e}].nopayout_txid`),typeof t.created_at!="number")throw new a(`VP response validation failed: "challengers[${e}].created_at" must be a number, got ${l(t.created_at)}`);if(typeof t.updated_at!="number")throw new a(`VP response validation failed: "challengers[${e}].updated_at" must be a number, got ${l(t.updated_at)}`)}function R(r,e){if(r!==null&&typeof r!="string")throw new a(`VP response validation failed: "${e}" must be a string or null, got ${l(r)}`)}function Ie(r){ae(r,"batchGetPeginStatus",e=>{e.result!==null&&se(e.result)})}function Re(r){ae(r,"batchGetPegoutStatus",e=>{e.result!==null&&Ve(e.result)})}function ae(r,e,t){if(r===null||typeof r!="object")throw new a(`VP response validation failed: ${e} response is not an object`);const n=r;if(!Array.isArray(n.results))throw new a(`VP response validation failed: "${e}.results" must be an array, got ${l(n.results)}`);for(let s=0;s<n.results.length;s++){const i=n.results[s];if(i===null||typeof i!="object")throw new a(`VP response validation failed: "${e}.results[${s}]" must be an object, got ${l(i)}`);const o=i;if(!v(o.pegin_txid)||o.pegin_txid.length!==T)throw new a(`VP response validation failed: "${e}.results[${s}].pegin_txid" must be a ${T}-char hex string, got ${l(o.pegin_txid)}`);if(o.error!==null&&typeof o.error!="string")throw new a(`VP response validation failed: "${e}.results[${s}].error" must be a string or null, got ${l(o.error)}`);if(o.result===null&&o.error===null)throw new a(`VP response validation failed: "${e}.results[${s}]" has neither "result" nor "error" populated`);if(o.result!==null&&o.error!==null)throw new a(`VP response validation failed: "${e}.results[${s}]" has both "result" and "error" populated`);t(o,s)}}function Be(r){if(P(r.claim_tx,"depositor_graph.claim_tx"),P(r.assert_tx,"depositor_graph.assert_tx"),P(r.payout_tx,"depositor_graph.payout_tx"),b(r.payout_psbt,"depositor_graph.payout_psbt"),!Array.isArray(r.challenger_presign_data))throw new a('VP response validation failed: "depositor_graph.challenger_presign_data" must be an array');for(let e=0;e<r.challenger_presign_data.length;e++)ke(r.challenger_presign_data[e],`depositor_graph.challenger_presign_data[${e}]`);if(typeof r.offchain_params_version!="number")throw new a('VP response validation failed: "depositor_graph.offchain_params_version" must be a number')}const Ne=6e4;class oe{constructor(e,t){p(this,"client");const n={baseUrl:e,timeout:(t==null?void 0:t.timeout)??Ne,retries:t==null?void 0:t.retries,retryDelay:t==null?void 0:t.retryDelay,retryableFor:t==null?void 0:t.retryableFor,headers:t==null?void 0:t.headers,tokenProvider:t==null?void 0:t.tokenProvider,maxResponseBytes:t==null?void 0:t.maxResponseBytes};this.client=new H.JsonRpcClient(n)}async requestDepositorPresignTransactions(e,t){const n=await this.client.call("vaultProvider_requestDepositorPresignTransactions",e,t);return Ee(n),n}async submitDepositorPresignatures(e,t){return this.client.call("vaultProvider_submitDepositorPresignatures",e,t)}async submitDepositorWotsKey(e,t){return this.client.call("vaultProvider_submitDepositorWotsKey",e,t)}async requestDepositorClaimerArtifacts(e,t){const n=await this.client.call("vaultProvider_requestDepositorClaimerArtifacts",e,t);return ie(n),n}async getPeginStatus(e,t){const n=await this.client.call("vaultProvider_getPeginStatus",e,t);return se(n),n}async batchGetPeginStatus(e,t){const n=await this.client.call("vaultProvider_batchGetPeginStatus",e,t);return Ie(n),n}async batchGetPegoutStatus(e,t){const n=await this.client.call("vaultProvider_batchGetPegoutStatus",e,t);return Re(n),n}}function De(r,e){const t=new Set;for(const u of r)t.add(u.toLowerCase());const n=new Map,s=new Set,i=[],o=[];for(const u of e){const d=u.pegin_txid.toLowerCase();if(!t.has(d)){o.push(d);continue}if(s.has(d)){i.push(d);continue}s.add(d),n.set(d,{result:u.result,error:u.error})}const c=[];for(const u of t)s.has(u)||c.push(u);return{byTxid:n,missing:c,unexpected:o,duplicate:i}}async function He(r){const{items:e,getTxid:t,batchCall:n,onItem:s,onMissing:i,onDuplicate:o,onDuplicateBatch:c,onWholeBatchError:u,onUnexpected:d,batchSize:_=H.VP_BATCH_MAX_SIZE}=r;if(!Number.isInteger(_)||_<=0)throw new Error(`batchPollByProvider: batchSize must be a positive integer, got ${_}`);for(let w=0;w<e.length;w+=_){const x=e.slice(w,w+_),V=new Map,O=[];for(const h of x){const y=t(h).toLowerCase();V.set(y,h),O.push(y)}let A;try{const h=await n(O);A=De(O,h.results)}catch(h){u(x,h);continue}d&&A.unexpected.length>0&&d(A.unexpected);const $=new Set(A.duplicate);for(const h of $){const y=V.get(h);y&&o(y)}c&&$.size>0&&c($.size);for(const h of A.missing){const y=V.get(h);y&&i(y)}for(const[h,y]of A.byTxid){if($.has(h))continue;const F=V.get(h);F&&s(F,{pegin_txid:h,result:y.result,error:y.error})}}}const Oe="BIP0322-signed-message",Ge="TapTweak",ce=32,je=64;function le(r,e){const t=new TextEncoder().encode(r),n=X.sha256(t),s=new Uint8Array(n.length*2+e.length);return s.set(n,0),s.set(n,n.length),s.set(e,n.length*2),X.sha256(s)}function Ue(r){if(r.length!==ce)return null;const e=le(Ge,r),t=U.xOnlyPointAddTweak(r,e);return t?t.xOnlyPubkey:null}function Me(r,e,t){if(e.length!==ce||t.length!==je)return!1;try{const n=le(Oe,r),s=C.payments.p2tr({internalPubkey:S.Buffer.from(e)});if(!s.output)return!1;const i=s.output,o=0,c=new C.Transaction;c.version=0,c.locktime=0;const u=S.Buffer.concat([S.Buffer.from([0,32]),S.Buffer.from(n)]);c.addInput(S.Buffer.alloc(32,0),4294967295,0,u),c.addOutput(i,o);const d=new C.Transaction;d.version=0,d.locktime=0;const _=c.getHash();d.addInput(_,0,0),d.addOutput(S.Buffer.from([106]),o);const w=d.hashForWitnessV1(0,[i],[o],C.Transaction.SIGHASH_DEFAULT),x=Ue(e);return x?U.verifySchnorr(w,x,t):!1}catch{return!1}}function D(r,e){const t=(r&7)<<5,n=typeof e=="bigint"?e:BigInt(e);if(n<0n)throw new Error("cborHead: negative argument");if(n<24n)return new Uint8Array([t|Number(n)]);if(n<0x100n)return new Uint8Array([t|24,Number(n)]);if(n<0x10000n){const i=Number(n);return new Uint8Array([t|25,i>>>8&255,i&255])}if(n<0x100000000n){const i=Number(n);return new Uint8Array([t|26,i>>>24&255,i>>>16&255,i>>>8&255,i&255])}const s=new Uint8Array(9);s[0]=t|27;for(let i=7;i>=0;i--)s[1+i]=Number(n>>BigInt((7-i)*8))&255;return s}function ue(...r){const e=r.reduce((s,i)=>s+i.length,0),t=new Uint8Array(e);let n=0;for(const s of r)t.set(s,n),n+=s.length;return t}function W(r){const t=[D(4,r.length)];for(const n of r)t.push(D(0,n));return ue(...t)}function Le(r,e,t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`encodeServerIdentityPayload: expires_at must be a non-negative safe integer, got ${t}`);const n=D(4,3),s=W(r),i=W(e),o=D(0,t);return ue(n,s,i,o)}const Fe=new TextEncoder().encode("btc-auth.server-identity.v1"),Ke=2*3600;class g extends Error{constructor(e,t){super(e),this.reason=t,this.name="ServerIdentityError"}}function B(r){const e=new Uint8Array(r.length/2);for(let t=0;t<e.length;t++)e[t]=parseInt(r.slice(t*2,t*2+2),16);return e}function de(r){const{proof:e,pinnedServerPubkey:t,now:n}=r,s=r.maxLifetimeSecs??Ke,i=m.stripHexPrefix(t).toLowerCase();if(i.length!==m.X_ONLY_PUBKEY_HEX_LEN||!k.HEX_RE.test(i))throw new g(`pinnedServerPubkey must be 32-byte hex; got ${i.length} chars`,"invalid_pubkey_encoding");const o=m.stripHexPrefix(e.server_pubkey).toLowerCase();if(o.length!==m.X_ONLY_PUBKEY_HEX_LEN||!k.HEX_RE.test(o))throw new g(`server_pubkey must be 32-byte hex; got ${o.length} chars`,"invalid_pubkey_encoding");if(o!==i)throw new g(`server_pubkey does not match pinned value: expected ${i}, got ${o}`,"pinned_pubkey_mismatch");if(!Number.isSafeInteger(e.expires_at))throw new g(`expires_at must be a finite integer; got ${JSON.stringify(e.expires_at)}`,"invalid_expires_at");if(!Number.isSafeInteger(n))throw new g(`now must be a finite integer; got ${JSON.stringify(n)}`,"invalid_expires_at");if(e.expires_at<=n)throw new g(`server identity proof expired at ${e.expires_at}, now ${n}`,"expired");if(!Number.isSafeInteger(s)||s<=0)throw new g(`maxLifetimeSecs must be a positive safe integer; got ${JSON.stringify(s)}`,"invalid_max_lifetime");if(e.expires_at-n>s)throw new g(`server identity proof expires too far in the future: expires_at=${e.expires_at}, now=${n}, max lifetime=${s}s`,"expires_too_far");const c=m.stripHexPrefix(e.ephemeral_pubkey).toLowerCase();if(c.length!==m.COMPRESSED_PUBKEY_HEX_LEN||!k.HEX_RE.test(c))throw new g(`ephemeral_pubkey must be 33-byte compressed hex; got ${c.length} chars`,"invalid_ephemeral_pubkey");const u=c.slice(0,2);if(u!=="02"&&u!=="03")throw new g(`ephemeral_pubkey must be compressed (prefix 02/03); got ${u}`,"invalid_ephemeral_pubkey");const d=B(c);if(!U.isPoint(d))throw new g("ephemeral_pubkey is not a valid secp256k1 point","invalid_ephemeral_pubkey");const _=m.stripHexPrefix(e.signature).toLowerCase();if(_.length!==m.SCHNORR_SIG_HEX_LEN||!k.HEX_RE.test(_))throw new g(`signature must be 64-byte Schnorr hex; got ${_.length} chars`,"invalid_signature_encoding");const w=Le(Fe,B(c),e.expires_at);if(!Me(w,B(o),B(_)))throw new g("BIP-322 signature verification failed — ephemeral key is not attested by pinned server pubkey","signature_verification_failed")}const Z=new Set(["vaultProvider_submitDepositorWotsKey","vaultProvider_submitDepositorPresignatures","vaultProvider_requestDepositorPresignTransactions"]),Q=new Set(["vaultProvider_requestDepositorClaimerArtifacts"]),Xe=6e4,G="auth_createDepositorToken",j="auth_createDepositorTokenGrpc";function pe(r,e){return new H.JsonRpcClient({baseUrl:r,timeout:Xe,headers:e,retryableFor:t=>t===G||t===j})}const ee=4102444800,qe=30;class Je{constructor(e){p(this,"client");p(this,"peginTxid");p(this,"authAnchorHex");p(this,"pinnedServerPubkey");p(this,"authGatedMethods");p(this,"grpcGatedMethods");p(this,"refreshSkewSecs");p(this,"now");p(this,"cachedJsonRpc",null);p(this,"inFlightJsonRpc",null);p(this,"cachedGrpc",null);p(this,"inFlightGrpc",null);this.client=e.client,this.peginTxid=e.peginTxid,this.authAnchorHex=e.authAnchorHex,this.pinnedServerPubkey=e.pinnedServerPubkey,this.authGatedMethods=e.authGatedMethods,this.grpcGatedMethods=e.grpcGatedMethods,this.refreshSkewSecs=e.refreshSkewSecs??qe,this.now=e.now??(()=>Math.floor(Date.now()/1e3))}async getToken(e){return e===G||e===j?null:this.grpcGatedMethods.has(e)?this.getTokenForSubject("grpc"):this.authGatedMethods.has(e)?this.getTokenForSubject("jsonrpc"):null}invalidate(){this.cachedJsonRpc=null,this.cachedGrpc=null}async getTokenForSubject(e){const t=e==="grpc"?this.cachedGrpc:this.cachedJsonRpc;return t&&this.now()+this.refreshSkewSecs<t.expiresAt?t.token:(await this.acquireSingleFlight(e)).token}setClient(e){this.client=e}acquireSingleFlight(e){const t=e==="grpc"?this.inFlightGrpc:this.inFlightJsonRpc;if(t)return t;const n=e==="grpc"?j:G,s=(async()=>{try{const i=await this.client.call(n,{pegin_txid:this.peginTxid,auth_anchor:this.authAnchorHex});if(de({proof:i.server_identity,pinnedServerPubkey:this.pinnedServerPubkey,now:this.now()}),typeof i.token!="string"||i.token.length===0)throw new Error(`VpTokenProvider: invalid token in acquire response (expected non-empty string, got ${typeof i.token})`);const o=this.now();if(!Number.isSafeInteger(i.expires_at)||i.expires_at<=o||i.expires_at>ee)throw new Error(`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(i.expires_at)}; must be a safe integer in (${o}, ${ee}])`);const c={token:i.token,expiresAt:i.expires_at};return e==="grpc"?this.cachedGrpc=c:this.cachedJsonRpc=c,c}finally{e==="grpc"?this.inFlightGrpc=null:this.inFlightJsonRpc=null}})();return e==="grpc"?this.inFlightGrpc=s:this.inFlightJsonRpc=s,s}}class he{constructor(){p(this,"entries",new Map)}getOrCreate(e){const t=e.enableGrpcArtifactAuth??!1,n=this.entries.get(e.peginTxid);if(n){if(n.authAnchorHex!==e.authAnchorHex)throw new Error(`VpTokenRegistry: peginTxid ${e.peginTxid} already bound to authAnchorHex ${n.authAnchorHex.slice(0,8)}…; got ${e.authAnchorHex.slice(0,8)}…`);if(n.pinnedServerPubkey!==e.pinnedServerPubkey)throw new Error(`VpTokenRegistry: peginTxid ${e.peginTxid} already bound to pinnedServerPubkey ${n.pinnedServerPubkey.slice(0,8)}…; got ${e.pinnedServerPubkey.slice(0,8)}…`);if(n.enableGrpcArtifactAuth!==t)throw new Error(`VpTokenRegistry: peginTxid ${e.peginTxid} already bound to enableGrpcArtifactAuth=${n.enableGrpcArtifactAuth}; got ${t}`);return n.provider.setClient(e.client),n.provider}const s=new Je({client:e.client,peginTxid:e.peginTxid,authAnchorHex:e.authAnchorHex,pinnedServerPubkey:e.pinnedServerPubkey,authGatedMethods:t?Z:new Set([...Z,...Q]),grpcGatedMethods:t?Q:new Set});return this.entries.set(e.peginTxid,{provider:s,authAnchorHex:e.authAnchorHex,pinnedServerPubkey:e.pinnedServerPubkey,enableGrpcArtifactAuth:t}),s}peek(e){var t;return(t=this.entries.get(e))==null?void 0:t.provider}release(e){this.entries.delete(e)}clear(){this.entries.clear()}get size(){return this.entries.size}}const L=new he;function Ye(r){var n;const e=pe(r.baseUrl,(n=r.options)==null?void 0:n.headers),t=L.getOrCreate({client:e,peginTxid:r.peginTxid,authAnchorHex:r.authAnchorHex,pinnedServerPubkey:r.pinnedServerPubkey,enableGrpcArtifactAuth:r.enableGrpcArtifactAuth});return new oe(r.baseUrl,{...r.options,tokenProvider:t})}function ze(r){L.getOrCreate({client:pe(r.baseUrl,r.headers),peginTxid:r.peginTxid,authAnchorHex:r.authAnchorHex,pinnedServerPubkey:r.pinnedServerPubkey,enableGrpcArtifactAuth:r.enableGrpcArtifactAuth})}exports.OnChainBtcVaultStatus=te;exports.ServerIdentityError=g;exports.VaultProviderRpcClient=oe;exports.ViemProtocolParamsReader=ye;exports.ViemUniversalChallengerReader=we;exports.ViemVaultKeeperReader=Pe;exports.VpResponseValidationError=a;exports.VpTokenRegistry=he;exports.batchPollByProvider=He;exports.createAuthenticatedVpClient=Ye;exports.primeVpTokenRegistry=ze;exports.resolveProtocolAddresses=be;exports.validateRequestDepositorClaimerArtifactsResponse=ie;exports.verifyServerIdentity=de;exports.vpTokenRegistry=L;
|
|
2
|
+
//# sourceMappingURL=primeVpAuth-Br6RwE3r.cjs.map
|