@btc-vision/transaction 1.8.6 → 1.8.7
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/browser/btc-vision-bitcoin.js +364 -364
- package/browser/index.js +1577 -1276
- package/browser/noble-curves.js +1072 -1173
- package/browser/noble-hashes.js +282 -261
- package/browser/rolldown-runtime.js +7 -7
- package/browser/src/_version.d.ts +1 -0
- package/browser/{abi → src/abi}/ABICoder.d.ts +0 -1
- package/browser/{abi → src/abi}/ABIDataTypes.d.ts +0 -1
- package/browser/{abi → src/abi}/AbiTypes.d.ts +0 -1
- package/browser/{abi → src/abi}/TupleUtils.d.ts +0 -1
- package/browser/{branded → src/branded}/Branded.d.ts +0 -1
- package/browser/{buffer → src/buffer}/BinaryReader.d.ts +0 -1
- package/browser/{buffer → src/buffer}/BinaryWriter.d.ts +0 -1
- package/browser/{bytecode → src/bytecode}/Compressor.d.ts +0 -1
- package/browser/{chain → src/chain}/ChainData.d.ts +1 -2
- package/browser/{consensus → src/consensus}/Consensus.d.ts +0 -1
- package/browser/{consensus → src/consensus}/ConsensusConfig.d.ts +0 -1
- package/browser/{consensus → src/consensus}/IConsensusConfig.d.ts +0 -1
- package/browser/{consensus → src/consensus}/metadata/RoswellConsensus.d.ts +0 -1
- package/browser/{crypto → src/crypto}/crypto.d.ts +1 -2
- package/browser/{deterministic → src/deterministic}/AddressMap.d.ts +0 -1
- package/browser/{deterministic → src/deterministic}/AddressSet.d.ts +0 -1
- package/browser/{deterministic → src/deterministic}/CustomMap.d.ts +0 -1
- package/browser/{deterministic → src/deterministic}/DeterministicMap.d.ts +0 -1
- package/browser/{deterministic → src/deterministic}/DeterministicSet.d.ts +0 -1
- package/browser/{deterministic → src/deterministic}/ExtendedAddressMap.d.ts +0 -1
- package/browser/{deterministic → src/deterministic}/FastMap.d.ts +0 -1
- package/browser/{ecc → src/ecc}/backend.d.ts +1 -2
- package/browser/{epoch → src/epoch}/ChallengeSolution.d.ts +0 -1
- package/browser/{epoch → src/epoch}/interfaces/IChallengeSolution.d.ts +0 -1
- package/browser/{epoch → src/epoch}/validator/EpochValidator.d.ts +0 -1
- package/browser/{event → src/event}/NetEvent.d.ts +0 -1
- package/browser/{generators → src/generators}/AddressGenerator.d.ts +1 -2
- package/browser/{generators → src/generators}/Features.d.ts +0 -1
- package/browser/{generators → src/generators}/Generator.d.ts +1 -2
- package/browser/{generators → src/generators}/MLDSAData.d.ts +1 -2
- package/browser/{generators → src/generators}/builders/CalldataGenerator.d.ts +1 -2
- package/browser/{generators → src/generators}/builders/CustomGenerator.d.ts +1 -2
- package/browser/{generators → src/generators}/builders/DeploymentGenerator.d.ts +1 -2
- package/browser/{generators → src/generators}/builders/HashCommitmentGenerator.d.ts +1 -2
- package/browser/{generators → src/generators}/builders/LegacyCalldataGenerator.d.ts +1 -2
- package/browser/{generators → src/generators}/builders/MultiSignGenerator.d.ts +1 -2
- package/browser/{generators → src/generators}/builders/P2WDAGenerator.d.ts +1 -2
- package/browser/{index.d.ts → src/index.d.ts} +0 -1
- package/browser/{keypair → src/keypair}/Address.d.ts +2 -3
- package/browser/{keypair → src/keypair}/AddressVerificator.d.ts +2 -3
- package/browser/{keypair → src/keypair}/EcKeyPair.d.ts +2 -3
- package/browser/{keypair → src/keypair}/MessageSigner.d.ts +2 -3
- package/browser/{keypair → src/keypair}/Secp256k1PointDeriver.d.ts +0 -1
- package/browser/{keypair → src/keypair}/Wallet.d.ts +2 -3
- package/browser/{keypair → src/keypair}/interfaces/IWallet.d.ts +0 -1
- package/browser/{metadata → src/metadata}/ContractBaseMetadata.d.ts +1 -2
- package/browser/{mnemonic → src/mnemonic}/BIPStandard.d.ts +0 -1
- package/browser/{mnemonic → src/mnemonic}/Mnemonic.d.ts +2 -3
- package/browser/{mnemonic → src/mnemonic}/MnemonicStrength.d.ts +0 -1
- package/browser/{network → src/network}/ChainId.d.ts +0 -1
- package/browser/{opnet.d.ts → src/opnet.d.ts} +2 -2
- package/browser/{p2wda → src/p2wda}/P2WDADetector.d.ts +1 -2
- package/browser/{polyfill → src/polyfill}/disposable.d.ts +0 -1
- package/browser/{signer → src/signer}/AddressRotation.d.ts +0 -1
- package/browser/{signer → src/signer}/IRotationSigner.d.ts +1 -2
- package/browser/{signer → src/signer}/ParallelSignerAdapter.d.ts +1 -2
- package/browser/{signer → src/signer}/SignerUtils.d.ts +1 -2
- package/browser/{signer → src/signer}/TweakedSigner.d.ts +1 -2
- package/browser/{transaction → src/transaction}/ContractAddress.d.ts +0 -1
- package/browser/{transaction → src/transaction}/TransactionFactory.d.ts +1 -2
- package/browser/{transaction → src/transaction}/browser/BrowserSignerBase.d.ts +1 -2
- package/browser/{transaction → src/transaction}/browser/WalletNetworks.d.ts +0 -1
- package/browser/{transaction → src/transaction}/browser/Web3Provider.d.ts +0 -1
- package/browser/{transaction → src/transaction}/browser/extensions/UnisatSigner.d.ts +1 -2
- package/browser/{transaction → src/transaction}/browser/extensions/XverseSigner.d.ts +1 -2
- package/browser/{transaction → src/transaction}/browser/types/OPWallet.d.ts +0 -1
- package/browser/{transaction → src/transaction}/browser/types/Unisat.d.ts +0 -1
- package/browser/{transaction → src/transaction}/browser/types/Xverse.d.ts +0 -1
- package/browser/{transaction → src/transaction}/builders/CancelTransaction.d.ts +1 -2
- package/browser/src/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/browser/{transaction → src/transaction}/builders/ConsolidatedInteractionTransaction.d.ts +0 -1
- package/browser/{transaction → src/transaction}/builders/CustomScriptTransaction.d.ts +1 -2
- package/browser/{transaction → src/transaction}/builders/DeploymentTransaction.d.ts +1 -2
- package/browser/{transaction → src/transaction}/builders/FundingTransaction.d.ts +1 -2
- package/browser/{transaction → src/transaction}/builders/InteractionTransaction.d.ts +1 -2
- package/browser/{transaction → src/transaction}/builders/InteractionTransactionP2WDA.d.ts +1 -2
- package/browser/{transaction → src/transaction}/builders/MultiSignTransaction.d.ts +1 -2
- package/browser/{transaction → src/transaction}/builders/SharedInteractionTransaction.d.ts +1 -2
- package/browser/{transaction → src/transaction}/builders/TransactionBuilder.d.ts +2 -2
- package/browser/{transaction → src/transaction}/enums/TransactionType.d.ts +0 -1
- package/browser/{transaction → src/transaction}/interfaces/ICancelTransactionParameters.d.ts +0 -1
- package/browser/{transaction → src/transaction}/interfaces/IConsolidatedTransactionParameters.d.ts +0 -1
- package/browser/{transaction → src/transaction}/interfaces/ICustomTransactionParameters.d.ts +1 -2
- package/browser/{transaction → src/transaction}/interfaces/ITransactionParameters.d.ts +1 -2
- package/browser/{transaction → src/transaction}/interfaces/ITransactionResponses.d.ts +0 -1
- package/browser/{transaction → src/transaction}/interfaces/ITweakedTransactionData.d.ts +2 -3
- package/browser/{transaction → src/transaction}/interfaces/IWeb3ProviderTypes.d.ts +1 -2
- package/browser/{transaction → src/transaction}/interfaces/Tap.d.ts +1 -2
- package/browser/src/transaction/mineable/CSVMultisigProvider.d.ts +102 -0
- package/browser/{transaction → src/transaction}/mineable/IP2WSHAddress.d.ts +0 -1
- package/browser/{transaction → src/transaction}/mineable/TimelockGenerator.d.ts +1 -2
- package/browser/{transaction → src/transaction}/offline/OfflineTransactionManager.d.ts +51 -2
- package/browser/{transaction → src/transaction}/offline/TransactionReconstructor.d.ts +2 -3
- package/browser/{transaction → src/transaction}/offline/TransactionSerializer.d.ts +0 -1
- package/browser/{transaction → src/transaction}/offline/TransactionStateCapture.d.ts +0 -1
- package/browser/{transaction → src/transaction}/offline/interfaces/ISerializableState.d.ts +10 -3
- package/browser/{transaction → src/transaction}/offline/interfaces/ITypeSpecificData.d.ts +0 -1
- package/browser/{transaction → src/transaction}/psbt/PSBTTypes.d.ts +0 -1
- package/browser/{transaction → src/transaction}/shared/P2MR_MS.d.ts +1 -2
- package/browser/{transaction → src/transaction}/shared/P2TR_MS.d.ts +1 -2
- package/browser/{transaction → src/transaction}/shared/TweakedTransaction.d.ts +21 -3
- package/browser/{transaction → src/transaction}/utils/WitnessUtils.d.ts +0 -1
- package/browser/{utils → src/utils}/BitcoinUtils.d.ts +0 -1
- package/browser/{utils → src/utils}/BufferHelper.d.ts +0 -1
- package/browser/{utils → src/utils}/StringToBuffer.d.ts +0 -1
- package/browser/{utils → src/utils}/lengths.d.ts +0 -1
- package/browser/{utils → src/utils}/types.d.ts +0 -1
- package/browser/{utxo → src/utxo}/OPNetLimitedProvider.d.ts +1 -2
- package/browser/{utxo → src/utxo}/interfaces/BroadcastResponse.d.ts +0 -1
- package/browser/{utxo → src/utxo}/interfaces/IUTXO.d.ts +0 -1
- package/browser/{verification → src/verification}/TapscriptVerificator.d.ts +1 -2
- package/browser/vendors.js +1397 -1397
- package/build/_version.d.ts +1 -2
- package/build/_version.js +1 -2
- package/build/abi/ABICoder.d.ts +0 -1
- package/build/abi/ABICoder.js +0 -1
- package/build/abi/ABIDataTypes.d.ts +0 -1
- package/build/abi/ABIDataTypes.js +0 -1
- package/build/abi/AbiTypes.d.ts +0 -1
- package/build/abi/AbiTypes.js +0 -1
- package/build/abi/TupleUtils.d.ts +0 -1
- package/build/abi/TupleUtils.js +0 -1
- package/build/branded/Branded.d.ts +0 -1
- package/build/branded/Branded.js +0 -1
- package/build/buffer/BinaryReader.d.ts +0 -1
- package/build/buffer/BinaryReader.js +0 -1
- package/build/buffer/BinaryWriter.d.ts +0 -1
- package/build/buffer/BinaryWriter.js +0 -1
- package/build/bytecode/Compressor.d.ts +0 -1
- package/build/bytecode/Compressor.js +0 -1
- package/build/chain/ChainData.d.ts +0 -1
- package/build/chain/ChainData.js +0 -1
- package/build/consensus/Consensus.d.ts +0 -1
- package/build/consensus/Consensus.js +0 -1
- package/build/consensus/ConsensusConfig.d.ts +0 -1
- package/build/consensus/ConsensusConfig.js +0 -1
- package/build/consensus/IConsensusConfig.d.ts +0 -1
- package/build/consensus/IConsensusConfig.js +0 -1
- package/build/consensus/metadata/RoswellConsensus.d.ts +0 -1
- package/build/consensus/metadata/RoswellConsensus.js +0 -1
- package/build/crypto/crypto.d.ts +0 -1
- package/build/crypto/crypto.js +0 -1
- package/build/deterministic/AddressMap.d.ts +0 -1
- package/build/deterministic/AddressMap.js +0 -1
- package/build/deterministic/AddressSet.d.ts +0 -1
- package/build/deterministic/AddressSet.js +0 -1
- package/build/deterministic/CustomMap.d.ts +0 -1
- package/build/deterministic/CustomMap.js +0 -1
- package/build/deterministic/DeterministicMap.d.ts +0 -1
- package/build/deterministic/DeterministicMap.js +0 -1
- package/build/deterministic/DeterministicSet.d.ts +0 -1
- package/build/deterministic/DeterministicSet.js +0 -1
- package/build/deterministic/ExtendedAddressMap.d.ts +0 -1
- package/build/deterministic/ExtendedAddressMap.js +0 -1
- package/build/deterministic/FastMap.d.ts +0 -1
- package/build/deterministic/FastMap.js +0 -1
- package/build/ecc/backend.d.ts +0 -1
- package/build/ecc/backend.js +0 -1
- package/build/epoch/ChallengeSolution.d.ts +0 -1
- package/build/epoch/ChallengeSolution.js +0 -1
- package/build/epoch/interfaces/IChallengeSolution.d.ts +0 -1
- package/build/epoch/interfaces/IChallengeSolution.js +0 -1
- package/build/epoch/validator/EpochValidator.d.ts +0 -1
- package/build/epoch/validator/EpochValidator.js +0 -1
- package/build/event/NetEvent.d.ts +0 -1
- package/build/event/NetEvent.js +0 -1
- package/build/generators/AddressGenerator.d.ts +0 -1
- package/build/generators/AddressGenerator.js +0 -1
- package/build/generators/Features.d.ts +0 -1
- package/build/generators/Features.js +0 -1
- package/build/generators/Generator.d.ts +0 -1
- package/build/generators/Generator.js +0 -1
- package/build/generators/MLDSAData.d.ts +0 -1
- package/build/generators/MLDSAData.js +0 -1
- package/build/generators/builders/CalldataGenerator.d.ts +0 -1
- package/build/generators/builders/CalldataGenerator.js +0 -1
- package/build/generators/builders/CustomGenerator.d.ts +0 -1
- package/build/generators/builders/CustomGenerator.js +0 -1
- package/build/generators/builders/DeploymentGenerator.d.ts +0 -1
- package/build/generators/builders/DeploymentGenerator.js +0 -1
- package/build/generators/builders/HashCommitmentGenerator.d.ts +0 -1
- package/build/generators/builders/HashCommitmentGenerator.js +0 -1
- package/build/generators/builders/LegacyCalldataGenerator.d.ts +0 -1
- package/build/generators/builders/LegacyCalldataGenerator.js +0 -1
- package/build/generators/builders/MultiSignGenerator.d.ts +0 -1
- package/build/generators/builders/MultiSignGenerator.js +0 -1
- package/build/generators/builders/P2WDAGenerator.d.ts +0 -1
- package/build/generators/builders/P2WDAGenerator.js +0 -1
- package/build/index.d.ts +0 -1
- package/build/index.js +0 -1
- package/build/keypair/Address.d.ts +0 -1
- package/build/keypair/Address.js +0 -1
- package/build/keypair/AddressVerificator.d.ts +0 -1
- package/build/keypair/AddressVerificator.js +0 -1
- package/build/keypair/EcKeyPair.d.ts +0 -1
- package/build/keypair/EcKeyPair.js +0 -1
- package/build/keypair/MessageSigner.d.ts +0 -1
- package/build/keypair/MessageSigner.js +0 -1
- package/build/keypair/Secp256k1PointDeriver.d.ts +0 -1
- package/build/keypair/Secp256k1PointDeriver.js +0 -1
- package/build/keypair/Wallet.d.ts +0 -1
- package/build/keypair/Wallet.js +0 -1
- package/build/keypair/interfaces/IWallet.d.ts +0 -1
- package/build/keypair/interfaces/IWallet.js +0 -1
- package/build/metadata/ContractBaseMetadata.d.ts +0 -1
- package/build/metadata/ContractBaseMetadata.js +0 -1
- package/build/mnemonic/BIPStandard.d.ts +0 -1
- package/build/mnemonic/BIPStandard.js +0 -1
- package/build/mnemonic/Mnemonic.d.ts +0 -1
- package/build/mnemonic/Mnemonic.js +0 -1
- package/build/mnemonic/MnemonicStrength.d.ts +0 -1
- package/build/mnemonic/MnemonicStrength.js +0 -1
- package/build/network/ChainId.d.ts +0 -1
- package/build/network/ChainId.js +0 -1
- package/build/opnet.d.ts +1 -1
- package/build/opnet.js +1 -1
- package/build/p2wda/P2WDADetector.d.ts +0 -1
- package/build/p2wda/P2WDADetector.js +0 -1
- package/build/polyfill/disposable.d.ts +0 -1
- package/build/polyfill/disposable.js +0 -1
- package/build/signer/AddressRotation.d.ts +0 -1
- package/build/signer/AddressRotation.js +0 -1
- package/build/signer/IRotationSigner.d.ts +0 -1
- package/build/signer/IRotationSigner.js +0 -1
- package/build/signer/ParallelSignerAdapter.d.ts +0 -1
- package/build/signer/ParallelSignerAdapter.js +0 -1
- package/build/signer/SignerUtils.d.ts +0 -1
- package/build/signer/SignerUtils.js +0 -1
- package/build/signer/TweakedSigner.d.ts +0 -1
- package/build/signer/TweakedSigner.js +0 -1
- package/build/transaction/ContractAddress.d.ts +0 -1
- package/build/transaction/ContractAddress.js +0 -1
- package/build/transaction/TransactionFactory.d.ts +0 -1
- package/build/transaction/TransactionFactory.js +1 -2
- package/build/transaction/browser/BrowserSignerBase.d.ts +0 -1
- package/build/transaction/browser/BrowserSignerBase.js +0 -1
- package/build/transaction/browser/WalletNetworks.d.ts +0 -1
- package/build/transaction/browser/WalletNetworks.js +0 -1
- package/build/transaction/browser/Web3Provider.d.ts +0 -1
- package/build/transaction/browser/Web3Provider.js +0 -1
- package/build/transaction/browser/extensions/UnisatSigner.d.ts +0 -1
- package/build/transaction/browser/extensions/UnisatSigner.js +0 -1
- package/build/transaction/browser/extensions/XverseSigner.d.ts +0 -1
- package/build/transaction/browser/extensions/XverseSigner.js +0 -1
- package/build/transaction/browser/types/OPWallet.d.ts +0 -1
- package/build/transaction/browser/types/OPWallet.js +0 -1
- package/build/transaction/browser/types/Unisat.d.ts +0 -1
- package/build/transaction/browser/types/Unisat.js +0 -1
- package/build/transaction/browser/types/Xverse.d.ts +0 -1
- package/build/transaction/browser/types/Xverse.js +0 -1
- package/build/transaction/builders/CancelTransaction.d.ts +0 -1
- package/build/transaction/builders/CancelTransaction.js +0 -1
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts +0 -1
- package/build/transaction/builders/ChallengeSolutionTransaction.js +0 -1
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +0 -1
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js +0 -1
- package/build/transaction/builders/CustomScriptTransaction.d.ts +0 -1
- package/build/transaction/builders/CustomScriptTransaction.js +0 -1
- package/build/transaction/builders/DeploymentTransaction.d.ts +0 -1
- package/build/transaction/builders/DeploymentTransaction.js +0 -1
- package/build/transaction/builders/FundingTransaction.d.ts +0 -1
- package/build/transaction/builders/FundingTransaction.js +17 -14
- package/build/transaction/builders/InteractionTransaction.d.ts +0 -1
- package/build/transaction/builders/InteractionTransaction.js +0 -1
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts +0 -1
- package/build/transaction/builders/InteractionTransactionP2WDA.js +0 -1
- package/build/transaction/builders/MultiSignTransaction.d.ts +0 -1
- package/build/transaction/builders/MultiSignTransaction.js +0 -1
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +0 -1
- package/build/transaction/builders/SharedInteractionTransaction.js +0 -1
- package/build/transaction/builders/TransactionBuilder.d.ts +1 -1
- package/build/transaction/builders/TransactionBuilder.js +39 -8
- package/build/transaction/enums/TransactionType.d.ts +0 -1
- package/build/transaction/enums/TransactionType.js +0 -1
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts +0 -1
- package/build/transaction/interfaces/ICancelTransactionParameters.js +0 -1
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +0 -1
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js +0 -1
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts +0 -1
- package/build/transaction/interfaces/ICustomTransactionParameters.js +0 -1
- package/build/transaction/interfaces/ITransactionParameters.d.ts +0 -1
- package/build/transaction/interfaces/ITransactionParameters.js +0 -1
- package/build/transaction/interfaces/ITransactionResponses.d.ts +0 -1
- package/build/transaction/interfaces/ITransactionResponses.js +0 -1
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts +0 -1
- package/build/transaction/interfaces/ITweakedTransactionData.js +0 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts +0 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.js +0 -1
- package/build/transaction/interfaces/Tap.d.ts +0 -1
- package/build/transaction/interfaces/Tap.js +0 -1
- package/build/transaction/mineable/CSVMultisigProvider.d.ts +102 -0
- package/build/transaction/mineable/CSVMultisigProvider.js +348 -0
- package/build/transaction/mineable/IP2WSHAddress.d.ts +0 -1
- package/build/transaction/mineable/IP2WSHAddress.js +0 -1
- package/build/transaction/mineable/TimelockGenerator.d.ts +0 -1
- package/build/transaction/mineable/TimelockGenerator.js +0 -1
- package/build/transaction/offline/OfflineTransactionManager.d.ts +50 -1
- package/build/transaction/offline/OfflineTransactionManager.js +142 -2
- package/build/transaction/offline/TransactionReconstructor.d.ts +0 -1
- package/build/transaction/offline/TransactionReconstructor.js +0 -1
- package/build/transaction/offline/TransactionSerializer.d.ts +0 -1
- package/build/transaction/offline/TransactionSerializer.js +9 -1
- package/build/transaction/offline/TransactionStateCapture.d.ts +0 -1
- package/build/transaction/offline/TransactionStateCapture.js +0 -1
- package/build/transaction/offline/interfaces/ISerializableState.d.ts +10 -3
- package/build/transaction/offline/interfaces/ISerializableState.js +3 -3
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts +0 -1
- package/build/transaction/offline/interfaces/ITypeSpecificData.js +0 -1
- package/build/transaction/psbt/PSBTTypes.d.ts +0 -1
- package/build/transaction/psbt/PSBTTypes.js +0 -1
- package/build/transaction/shared/P2MR_MS.d.ts +0 -1
- package/build/transaction/shared/P2MR_MS.js +0 -1
- package/build/transaction/shared/P2TR_MS.d.ts +0 -1
- package/build/transaction/shared/P2TR_MS.js +0 -1
- package/build/transaction/shared/TweakedTransaction.d.ts +19 -1
- package/build/transaction/shared/TweakedTransaction.js +96 -12
- package/build/transaction/utils/WitnessUtils.d.ts +0 -1
- package/build/transaction/utils/WitnessUtils.js +0 -1
- package/build/utils/BitcoinUtils.d.ts +0 -1
- package/build/utils/BitcoinUtils.js +0 -1
- package/build/utils/BufferHelper.d.ts +0 -1
- package/build/utils/BufferHelper.js +0 -1
- package/build/utils/StringToBuffer.d.ts +0 -1
- package/build/utils/StringToBuffer.js +0 -1
- package/build/utils/lengths.d.ts +0 -1
- package/build/utils/lengths.js +0 -1
- package/build/utils/types.d.ts +0 -1
- package/build/utils/types.js +0 -1
- package/build/utxo/OPNetLimitedProvider.d.ts +0 -1
- package/build/utxo/OPNetLimitedProvider.js +0 -1
- package/build/utxo/interfaces/BroadcastResponse.d.ts +0 -1
- package/build/utxo/interfaces/BroadcastResponse.js +0 -1
- package/build/utxo/interfaces/IUTXO.d.ts +0 -1
- package/build/utxo/interfaces/IUTXO.js +0 -1
- package/build/verification/TapscriptVerificator.d.ts +0 -1
- package/build/verification/TapscriptVerificator.js +0 -1
- package/eslint.config.js +5 -0
- package/package.json +20 -17
- package/src/_version.ts +1 -1
- package/src/keypair/Address.ts +1 -1
- package/src/opnet.ts +1 -0
- package/src/transaction/TransactionFactory.ts +1 -1
- package/src/transaction/builders/FundingTransaction.ts +21 -16
- package/src/transaction/builders/TransactionBuilder.ts +56 -10
- package/src/transaction/mineable/CSVMultisigProvider.ts +465 -0
- package/src/transaction/offline/OfflineTransactionManager.ts +191 -1
- package/src/transaction/offline/TransactionSerializer.ts +11 -0
- package/src/transaction/offline/interfaces/ISerializableState.ts +10 -2
- package/src/transaction/shared/TweakedTransaction.ts +123 -10
- package/test/add-refund-output.test.ts +96 -11
- package/test/csv-multisig-offline-edges.test.ts +293 -0
- package/test/csv-multisig-offline.test.ts +202 -0
- package/test/csv-multisig-spend.test.ts +363 -0
- package/test/transaction-builders.test.ts +69 -3
- package/test/web3-provider-types.test.ts +349 -0
- package/test/zero-amount-funding.test.ts +311 -0
- package/tsconfig.base.json +2 -2
- package/tsconfig.build.json +4 -1
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +9 -3
- package/browser/_version.d.ts +0 -2
- package/browser/_version.d.ts.map +0 -1
- package/browser/abi/ABICoder.d.ts.map +0 -1
- package/browser/abi/ABIDataTypes.d.ts.map +0 -1
- package/browser/abi/AbiTypes.d.ts.map +0 -1
- package/browser/abi/TupleUtils.d.ts.map +0 -1
- package/browser/branded/Branded.d.ts.map +0 -1
- package/browser/buffer/BinaryReader.d.ts.map +0 -1
- package/browser/buffer/BinaryWriter.d.ts.map +0 -1
- package/browser/bytecode/Compressor.d.ts.map +0 -1
- package/browser/chain/ChainData.d.ts.map +0 -1
- package/browser/consensus/Consensus.d.ts.map +0 -1
- package/browser/consensus/ConsensusConfig.d.ts.map +0 -1
- package/browser/consensus/IConsensusConfig.d.ts.map +0 -1
- package/browser/consensus/metadata/RoswellConsensus.d.ts.map +0 -1
- package/browser/crypto/crypto.d.ts.map +0 -1
- package/browser/deterministic/AddressMap.d.ts.map +0 -1
- package/browser/deterministic/AddressSet.d.ts.map +0 -1
- package/browser/deterministic/CustomMap.d.ts.map +0 -1
- package/browser/deterministic/DeterministicMap.d.ts.map +0 -1
- package/browser/deterministic/DeterministicSet.d.ts.map +0 -1
- package/browser/deterministic/ExtendedAddressMap.d.ts.map +0 -1
- package/browser/deterministic/FastMap.d.ts.map +0 -1
- package/browser/ecc/backend.d.ts.map +0 -1
- package/browser/epoch/ChallengeSolution.d.ts.map +0 -1
- package/browser/epoch/interfaces/IChallengeSolution.d.ts.map +0 -1
- package/browser/epoch/validator/EpochValidator.d.ts.map +0 -1
- package/browser/event/NetEvent.d.ts.map +0 -1
- package/browser/generators/AddressGenerator.d.ts.map +0 -1
- package/browser/generators/Features.d.ts.map +0 -1
- package/browser/generators/Generator.d.ts.map +0 -1
- package/browser/generators/MLDSAData.d.ts.map +0 -1
- package/browser/generators/builders/CalldataGenerator.d.ts.map +0 -1
- package/browser/generators/builders/CustomGenerator.d.ts.map +0 -1
- package/browser/generators/builders/DeploymentGenerator.d.ts.map +0 -1
- package/browser/generators/builders/HashCommitmentGenerator.d.ts.map +0 -1
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts.map +0 -1
- package/browser/generators/builders/MultiSignGenerator.d.ts.map +0 -1
- package/browser/generators/builders/P2WDAGenerator.d.ts.map +0 -1
- package/browser/index.d.ts.map +0 -1
- package/browser/keypair/Address.d.ts.map +0 -1
- package/browser/keypair/AddressVerificator.d.ts.map +0 -1
- package/browser/keypair/EcKeyPair.d.ts.map +0 -1
- package/browser/keypair/MessageSigner.d.ts.map +0 -1
- package/browser/keypair/Secp256k1PointDeriver.d.ts.map +0 -1
- package/browser/keypair/Wallet.d.ts.map +0 -1
- package/browser/keypair/interfaces/IWallet.d.ts.map +0 -1
- package/browser/metadata/ContractBaseMetadata.d.ts.map +0 -1
- package/browser/mnemonic/BIPStandard.d.ts.map +0 -1
- package/browser/mnemonic/Mnemonic.d.ts.map +0 -1
- package/browser/mnemonic/MnemonicStrength.d.ts.map +0 -1
- package/browser/network/ChainId.d.ts.map +0 -1
- package/browser/opnet.d.ts.map +0 -1
- package/browser/p2wda/P2WDADetector.d.ts.map +0 -1
- package/browser/polyfill/disposable.d.ts.map +0 -1
- package/browser/signer/AddressRotation.d.ts.map +0 -1
- package/browser/signer/IRotationSigner.d.ts.map +0 -1
- package/browser/signer/ParallelSignerAdapter.d.ts.map +0 -1
- package/browser/signer/SignerUtils.d.ts.map +0 -1
- package/browser/signer/TweakedSigner.d.ts.map +0 -1
- package/browser/transaction/ContractAddress.d.ts.map +0 -1
- package/browser/transaction/TransactionFactory.d.ts.map +0 -1
- package/browser/transaction/browser/BrowserSignerBase.d.ts.map +0 -1
- package/browser/transaction/browser/WalletNetworks.d.ts.map +0 -1
- package/browser/transaction/browser/Web3Provider.d.ts.map +0 -1
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts.map +0 -1
- package/browser/transaction/browser/extensions/XverseSigner.d.ts.map +0 -1
- package/browser/transaction/browser/types/OPWallet.d.ts.map +0 -1
- package/browser/transaction/browser/types/Unisat.d.ts.map +0 -1
- package/browser/transaction/browser/types/Xverse.d.ts.map +0 -1
- package/browser/transaction/builders/CancelTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts +0 -2
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/CustomScriptTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/DeploymentTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/FundingTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/InteractionTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts.map +0 -1
- package/browser/transaction/builders/MultiSignTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts.map +0 -1
- package/browser/transaction/builders/TransactionBuilder.d.ts.map +0 -1
- package/browser/transaction/enums/TransactionType.d.ts.map +0 -1
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts.map +0 -1
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +0 -1
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts.map +0 -1
- package/browser/transaction/interfaces/ITransactionParameters.d.ts.map +0 -1
- package/browser/transaction/interfaces/ITransactionResponses.d.ts.map +0 -1
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts.map +0 -1
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +0 -1
- package/browser/transaction/interfaces/Tap.d.ts.map +0 -1
- package/browser/transaction/mineable/IP2WSHAddress.d.ts.map +0 -1
- package/browser/transaction/mineable/TimelockGenerator.d.ts.map +0 -1
- package/browser/transaction/offline/OfflineTransactionManager.d.ts.map +0 -1
- package/browser/transaction/offline/TransactionReconstructor.d.ts.map +0 -1
- package/browser/transaction/offline/TransactionSerializer.d.ts.map +0 -1
- package/browser/transaction/offline/TransactionStateCapture.d.ts.map +0 -1
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts.map +0 -1
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +0 -1
- package/browser/transaction/psbt/PSBTTypes.d.ts.map +0 -1
- package/browser/transaction/shared/P2MR_MS.d.ts.map +0 -1
- package/browser/transaction/shared/P2TR_MS.d.ts.map +0 -1
- package/browser/transaction/shared/TweakedTransaction.d.ts.map +0 -1
- package/browser/transaction/utils/WitnessUtils.d.ts.map +0 -1
- package/browser/utils/BitcoinUtils.d.ts.map +0 -1
- package/browser/utils/BufferHelper.d.ts.map +0 -1
- package/browser/utils/StringToBuffer.d.ts.map +0 -1
- package/browser/utils/lengths.d.ts.map +0 -1
- package/browser/utils/types.d.ts.map +0 -1
- package/browser/utxo/OPNetLimitedProvider.d.ts.map +0 -1
- package/browser/utxo/interfaces/BroadcastResponse.d.ts.map +0 -1
- package/browser/utxo/interfaces/IUTXO.d.ts.map +0 -1
- package/browser/verification/TapscriptVerificator.d.ts.map +0 -1
- package/build/_version.d.ts.map +0 -1
- package/build/_version.js.map +0 -1
- package/build/abi/ABICoder.d.ts.map +0 -1
- package/build/abi/ABICoder.js.map +0 -1
- package/build/abi/ABIDataTypes.d.ts.map +0 -1
- package/build/abi/ABIDataTypes.js.map +0 -1
- package/build/abi/AbiTypes.d.ts.map +0 -1
- package/build/abi/AbiTypes.js.map +0 -1
- package/build/abi/TupleUtils.d.ts.map +0 -1
- package/build/abi/TupleUtils.js.map +0 -1
- package/build/branded/Branded.d.ts.map +0 -1
- package/build/branded/Branded.js.map +0 -1
- package/build/buffer/BinaryReader.d.ts.map +0 -1
- package/build/buffer/BinaryReader.js.map +0 -1
- package/build/buffer/BinaryWriter.d.ts.map +0 -1
- package/build/buffer/BinaryWriter.js.map +0 -1
- package/build/bytecode/Compressor.d.ts.map +0 -1
- package/build/bytecode/Compressor.js.map +0 -1
- package/build/chain/ChainData.d.ts.map +0 -1
- package/build/chain/ChainData.js.map +0 -1
- package/build/consensus/Consensus.d.ts.map +0 -1
- package/build/consensus/Consensus.js.map +0 -1
- package/build/consensus/ConsensusConfig.d.ts.map +0 -1
- package/build/consensus/ConsensusConfig.js.map +0 -1
- package/build/consensus/IConsensusConfig.d.ts.map +0 -1
- package/build/consensus/IConsensusConfig.js.map +0 -1
- package/build/consensus/metadata/RoswellConsensus.d.ts.map +0 -1
- package/build/consensus/metadata/RoswellConsensus.js.map +0 -1
- package/build/crypto/crypto.d.ts.map +0 -1
- package/build/crypto/crypto.js.map +0 -1
- package/build/deterministic/AddressMap.d.ts.map +0 -1
- package/build/deterministic/AddressMap.js.map +0 -1
- package/build/deterministic/AddressSet.d.ts.map +0 -1
- package/build/deterministic/AddressSet.js.map +0 -1
- package/build/deterministic/CustomMap.d.ts.map +0 -1
- package/build/deterministic/CustomMap.js.map +0 -1
- package/build/deterministic/DeterministicMap.d.ts.map +0 -1
- package/build/deterministic/DeterministicMap.js.map +0 -1
- package/build/deterministic/DeterministicSet.d.ts.map +0 -1
- package/build/deterministic/DeterministicSet.js.map +0 -1
- package/build/deterministic/ExtendedAddressMap.d.ts.map +0 -1
- package/build/deterministic/ExtendedAddressMap.js.map +0 -1
- package/build/deterministic/FastMap.d.ts.map +0 -1
- package/build/deterministic/FastMap.js.map +0 -1
- package/build/ecc/backend.d.ts.map +0 -1
- package/build/ecc/backend.js.map +0 -1
- package/build/epoch/ChallengeSolution.d.ts.map +0 -1
- package/build/epoch/ChallengeSolution.js.map +0 -1
- package/build/epoch/interfaces/IChallengeSolution.d.ts.map +0 -1
- package/build/epoch/interfaces/IChallengeSolution.js.map +0 -1
- package/build/epoch/validator/EpochValidator.d.ts.map +0 -1
- package/build/epoch/validator/EpochValidator.js.map +0 -1
- package/build/event/NetEvent.d.ts.map +0 -1
- package/build/event/NetEvent.js.map +0 -1
- package/build/generators/AddressGenerator.d.ts.map +0 -1
- package/build/generators/AddressGenerator.js.map +0 -1
- package/build/generators/Features.d.ts.map +0 -1
- package/build/generators/Features.js.map +0 -1
- package/build/generators/Generator.d.ts.map +0 -1
- package/build/generators/Generator.js.map +0 -1
- package/build/generators/MLDSAData.d.ts.map +0 -1
- package/build/generators/MLDSAData.js.map +0 -1
- package/build/generators/builders/CalldataGenerator.d.ts.map +0 -1
- package/build/generators/builders/CalldataGenerator.js.map +0 -1
- package/build/generators/builders/CustomGenerator.d.ts.map +0 -1
- package/build/generators/builders/CustomGenerator.js.map +0 -1
- package/build/generators/builders/DeploymentGenerator.d.ts.map +0 -1
- package/build/generators/builders/DeploymentGenerator.js.map +0 -1
- package/build/generators/builders/HashCommitmentGenerator.d.ts.map +0 -1
- package/build/generators/builders/HashCommitmentGenerator.js.map +0 -1
- package/build/generators/builders/LegacyCalldataGenerator.d.ts.map +0 -1
- package/build/generators/builders/LegacyCalldataGenerator.js.map +0 -1
- package/build/generators/builders/MultiSignGenerator.d.ts.map +0 -1
- package/build/generators/builders/MultiSignGenerator.js.map +0 -1
- package/build/generators/builders/P2WDAGenerator.d.ts.map +0 -1
- package/build/generators/builders/P2WDAGenerator.js.map +0 -1
- package/build/index.d.ts.map +0 -1
- package/build/index.js.map +0 -1
- package/build/keypair/Address.d.ts.map +0 -1
- package/build/keypair/Address.js.map +0 -1
- package/build/keypair/AddressVerificator.d.ts.map +0 -1
- package/build/keypair/AddressVerificator.js.map +0 -1
- package/build/keypair/EcKeyPair.d.ts.map +0 -1
- package/build/keypair/EcKeyPair.js.map +0 -1
- package/build/keypair/MessageSigner.d.ts.map +0 -1
- package/build/keypair/MessageSigner.js.map +0 -1
- package/build/keypair/Secp256k1PointDeriver.d.ts.map +0 -1
- package/build/keypair/Secp256k1PointDeriver.js.map +0 -1
- package/build/keypair/Wallet.d.ts.map +0 -1
- package/build/keypair/Wallet.js.map +0 -1
- package/build/keypair/interfaces/IWallet.d.ts.map +0 -1
- package/build/keypair/interfaces/IWallet.js.map +0 -1
- package/build/metadata/ContractBaseMetadata.d.ts.map +0 -1
- package/build/metadata/ContractBaseMetadata.js.map +0 -1
- package/build/mnemonic/BIPStandard.d.ts.map +0 -1
- package/build/mnemonic/BIPStandard.js.map +0 -1
- package/build/mnemonic/Mnemonic.d.ts.map +0 -1
- package/build/mnemonic/Mnemonic.js.map +0 -1
- package/build/mnemonic/MnemonicStrength.d.ts.map +0 -1
- package/build/mnemonic/MnemonicStrength.js.map +0 -1
- package/build/network/ChainId.d.ts.map +0 -1
- package/build/network/ChainId.js.map +0 -1
- package/build/opnet.d.ts.map +0 -1
- package/build/opnet.js.map +0 -1
- package/build/p2wda/P2WDADetector.d.ts.map +0 -1
- package/build/p2wda/P2WDADetector.js.map +0 -1
- package/build/polyfill/disposable.d.ts.map +0 -1
- package/build/polyfill/disposable.js.map +0 -1
- package/build/signer/AddressRotation.d.ts.map +0 -1
- package/build/signer/AddressRotation.js.map +0 -1
- package/build/signer/IRotationSigner.d.ts.map +0 -1
- package/build/signer/IRotationSigner.js.map +0 -1
- package/build/signer/ParallelSignerAdapter.d.ts.map +0 -1
- package/build/signer/ParallelSignerAdapter.js.map +0 -1
- package/build/signer/SignerUtils.d.ts.map +0 -1
- package/build/signer/SignerUtils.js.map +0 -1
- package/build/signer/TweakedSigner.d.ts.map +0 -1
- package/build/signer/TweakedSigner.js.map +0 -1
- package/build/transaction/ContractAddress.d.ts.map +0 -1
- package/build/transaction/ContractAddress.js.map +0 -1
- package/build/transaction/TransactionFactory.d.ts.map +0 -1
- package/build/transaction/TransactionFactory.js.map +0 -1
- package/build/transaction/browser/BrowserSignerBase.d.ts.map +0 -1
- package/build/transaction/browser/BrowserSignerBase.js.map +0 -1
- package/build/transaction/browser/WalletNetworks.d.ts.map +0 -1
- package/build/transaction/browser/WalletNetworks.js.map +0 -1
- package/build/transaction/browser/Web3Provider.d.ts.map +0 -1
- package/build/transaction/browser/Web3Provider.js.map +0 -1
- package/build/transaction/browser/extensions/UnisatSigner.d.ts.map +0 -1
- package/build/transaction/browser/extensions/UnisatSigner.js.map +0 -1
- package/build/transaction/browser/extensions/XverseSigner.d.ts.map +0 -1
- package/build/transaction/browser/extensions/XverseSigner.js.map +0 -1
- package/build/transaction/browser/types/OPWallet.d.ts.map +0 -1
- package/build/transaction/browser/types/OPWallet.js.map +0 -1
- package/build/transaction/browser/types/Unisat.d.ts.map +0 -1
- package/build/transaction/browser/types/Unisat.js.map +0 -1
- package/build/transaction/browser/types/Xverse.d.ts.map +0 -1
- package/build/transaction/browser/types/Xverse.js.map +0 -1
- package/build/transaction/builders/CancelTransaction.d.ts.map +0 -1
- package/build/transaction/builders/CancelTransaction.js.map +0 -1
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts.map +0 -1
- package/build/transaction/builders/ChallengeSolutionTransaction.js.map +0 -1
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +0 -1
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js.map +0 -1
- package/build/transaction/builders/CustomScriptTransaction.d.ts.map +0 -1
- package/build/transaction/builders/CustomScriptTransaction.js.map +0 -1
- package/build/transaction/builders/DeploymentTransaction.d.ts.map +0 -1
- package/build/transaction/builders/DeploymentTransaction.js.map +0 -1
- package/build/transaction/builders/FundingTransaction.d.ts.map +0 -1
- package/build/transaction/builders/FundingTransaction.js.map +0 -1
- package/build/transaction/builders/InteractionTransaction.d.ts.map +0 -1
- package/build/transaction/builders/InteractionTransaction.js.map +0 -1
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts.map +0 -1
- package/build/transaction/builders/InteractionTransactionP2WDA.js.map +0 -1
- package/build/transaction/builders/MultiSignTransaction.d.ts.map +0 -1
- package/build/transaction/builders/MultiSignTransaction.js.map +0 -1
- package/build/transaction/builders/SharedInteractionTransaction.d.ts.map +0 -1
- package/build/transaction/builders/SharedInteractionTransaction.js.map +0 -1
- package/build/transaction/builders/TransactionBuilder.d.ts.map +0 -1
- package/build/transaction/builders/TransactionBuilder.js.map +0 -1
- package/build/transaction/enums/TransactionType.d.ts.map +0 -1
- package/build/transaction/enums/TransactionType.js.map +0 -1
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts.map +0 -1
- package/build/transaction/interfaces/ICancelTransactionParameters.js.map +0 -1
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +0 -1
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js.map +0 -1
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts.map +0 -1
- package/build/transaction/interfaces/ICustomTransactionParameters.js.map +0 -1
- package/build/transaction/interfaces/ITransactionParameters.d.ts.map +0 -1
- package/build/transaction/interfaces/ITransactionParameters.js.map +0 -1
- package/build/transaction/interfaces/ITransactionResponses.d.ts.map +0 -1
- package/build/transaction/interfaces/ITransactionResponses.js.map +0 -1
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts.map +0 -1
- package/build/transaction/interfaces/ITweakedTransactionData.js.map +0 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +0 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.js.map +0 -1
- package/build/transaction/interfaces/Tap.d.ts.map +0 -1
- package/build/transaction/interfaces/Tap.js.map +0 -1
- package/build/transaction/mineable/IP2WSHAddress.d.ts.map +0 -1
- package/build/transaction/mineable/IP2WSHAddress.js.map +0 -1
- package/build/transaction/mineable/TimelockGenerator.d.ts.map +0 -1
- package/build/transaction/mineable/TimelockGenerator.js.map +0 -1
- package/build/transaction/offline/OfflineTransactionManager.d.ts.map +0 -1
- package/build/transaction/offline/OfflineTransactionManager.js.map +0 -1
- package/build/transaction/offline/TransactionReconstructor.d.ts.map +0 -1
- package/build/transaction/offline/TransactionReconstructor.js.map +0 -1
- package/build/transaction/offline/TransactionSerializer.d.ts.map +0 -1
- package/build/transaction/offline/TransactionSerializer.js.map +0 -1
- package/build/transaction/offline/TransactionStateCapture.d.ts.map +0 -1
- package/build/transaction/offline/TransactionStateCapture.js.map +0 -1
- package/build/transaction/offline/interfaces/ISerializableState.d.ts.map +0 -1
- package/build/transaction/offline/interfaces/ISerializableState.js.map +0 -1
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +0 -1
- package/build/transaction/offline/interfaces/ITypeSpecificData.js.map +0 -1
- package/build/transaction/psbt/PSBTTypes.d.ts.map +0 -1
- package/build/transaction/psbt/PSBTTypes.js.map +0 -1
- package/build/transaction/shared/P2MR_MS.d.ts.map +0 -1
- package/build/transaction/shared/P2MR_MS.js.map +0 -1
- package/build/transaction/shared/P2TR_MS.d.ts.map +0 -1
- package/build/transaction/shared/P2TR_MS.js.map +0 -1
- package/build/transaction/shared/TweakedTransaction.d.ts.map +0 -1
- package/build/transaction/shared/TweakedTransaction.js.map +0 -1
- package/build/transaction/utils/WitnessUtils.d.ts.map +0 -1
- package/build/transaction/utils/WitnessUtils.js.map +0 -1
- package/build/tsconfig.build.tsbuildinfo +0 -1
- package/build/utils/BitcoinUtils.d.ts.map +0 -1
- package/build/utils/BitcoinUtils.js.map +0 -1
- package/build/utils/BufferHelper.d.ts.map +0 -1
- package/build/utils/BufferHelper.js.map +0 -1
- package/build/utils/StringToBuffer.d.ts.map +0 -1
- package/build/utils/StringToBuffer.js.map +0 -1
- package/build/utils/lengths.d.ts.map +0 -1
- package/build/utils/lengths.js.map +0 -1
- package/build/utils/types.d.ts.map +0 -1
- package/build/utils/types.js.map +0 -1
- package/build/utxo/OPNetLimitedProvider.d.ts.map +0 -1
- package/build/utxo/OPNetLimitedProvider.js.map +0 -1
- package/build/utxo/interfaces/BroadcastResponse.d.ts.map +0 -1
- package/build/utxo/interfaces/BroadcastResponse.js.map +0 -1
- package/build/utxo/interfaces/IUTXO.d.ts.map +0 -1
- package/build/utxo/interfaces/IUTXO.js.map +0 -1
- package/build/verification/TapscriptVerificator.d.ts.map +0 -1
- package/build/verification/TapscriptVerificator.js.map +0 -1
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
import {
|
|
2
|
+
equals,
|
|
3
|
+
fromHex,
|
|
4
|
+
isP2TR,
|
|
5
|
+
type Network,
|
|
6
|
+
opcodes,
|
|
7
|
+
payments,
|
|
8
|
+
type Psbt,
|
|
9
|
+
type Script,
|
|
10
|
+
script,
|
|
11
|
+
type TapScriptSig,
|
|
12
|
+
type XOnlyPublicKey,
|
|
13
|
+
} from '@btc-vision/bitcoin';
|
|
14
|
+
import { witnessStackToScriptWitness } from '../utils/WitnessUtils.js';
|
|
15
|
+
import type { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
16
|
+
|
|
17
|
+
export const NUMS_INTERNAL_KEY: Uint8Array = fromHex(
|
|
18
|
+
'50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const LEAF_VERSION_TAPSCRIPT = 0xc0;
|
|
22
|
+
|
|
23
|
+
export interface CSVMultisigConfig {
|
|
24
|
+
/** x,only (32 byte) pubkeys. Signature order is the reverse of this array. */
|
|
25
|
+
pubkeys: XOnlyPublicKey[];
|
|
26
|
+
|
|
27
|
+
/** k of n threshold, fixed at 2 for CSV2Multisig but kept configurable. */
|
|
28
|
+
threshold: number;
|
|
29
|
+
|
|
30
|
+
/** Block,based relative lock, 1..65535. */
|
|
31
|
+
csvBlocks: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface CSVMultisigAddress {
|
|
35
|
+
address: string;
|
|
36
|
+
tapscript: Uint8Array;
|
|
37
|
+
scriptPubKey: Uint8Array;
|
|
38
|
+
controlBlock: Uint8Array;
|
|
39
|
+
internalPubkey: Uint8Array;
|
|
40
|
+
leafVersion: number;
|
|
41
|
+
config: CSVMultisigConfig;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export class CSVMultisigProvider {
|
|
45
|
+
public static readonly NUMS_INTERNAL_KEY = NUMS_INTERNAL_KEY;
|
|
46
|
+
public static readonly LEAF_VERSION = LEAF_VERSION_TAPSCRIPT;
|
|
47
|
+
|
|
48
|
+
/** Build the CSV + k of n CHECKSIGADD tapscript. */
|
|
49
|
+
public static buildTapscript(cfg: CSVMultisigConfig): Script {
|
|
50
|
+
if (cfg.csvBlocks < 1 || cfg.csvBlocks > 0xffff) {
|
|
51
|
+
throw new Error('csvBlocks must be between 1 and 65535');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (cfg.pubkeys.length === 0) {
|
|
55
|
+
throw new Error('At least one pubkey required');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (cfg.threshold < 1 || cfg.threshold > cfg.pubkeys.length) {
|
|
59
|
+
throw new Error('Invalid threshold');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (const pk of cfg.pubkeys) {
|
|
63
|
+
if (pk.length !== 32) {
|
|
64
|
+
throw new Error('Tapscript pubkeys must be 32 bytes (x,only)');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const chunks: (number | Uint8Array)[] = [];
|
|
69
|
+
|
|
70
|
+
// Relative timelock gate
|
|
71
|
+
chunks.push(script.number.encode(cfg.csvBlocks));
|
|
72
|
+
chunks.push(opcodes.OP_CHECKSEQUENCEVERIFY);
|
|
73
|
+
chunks.push(opcodes.OP_DROP);
|
|
74
|
+
|
|
75
|
+
// k of n multisig
|
|
76
|
+
chunks.push(cfg.pubkeys[0] as XOnlyPublicKey, opcodes.OP_CHECKSIG);
|
|
77
|
+
for (let i = 1; i < cfg.pubkeys.length; i++) {
|
|
78
|
+
chunks.push(cfg.pubkeys[i] as XOnlyPublicKey, opcodes.OP_CHECKSIGADD);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (cfg.threshold >= 1 && cfg.threshold <= 16) {
|
|
82
|
+
chunks.push(opcodes.OP_1 + cfg.threshold - 1);
|
|
83
|
+
} else {
|
|
84
|
+
chunks.push(script.number.encode(cfg.threshold));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
chunks.push(opcodes.OP_NUMEQUAL);
|
|
88
|
+
|
|
89
|
+
return script.compile(chunks);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Convenience: 2 of N with fixed threshold. */
|
|
93
|
+
public static buildCSV2MultisigTapscript(
|
|
94
|
+
pubkeys: XOnlyPublicKey[],
|
|
95
|
+
csvBlocks: number,
|
|
96
|
+
): Uint8Array {
|
|
97
|
+
return this.buildTapscript({ pubkeys, threshold: 2, csvBlocks });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Single leaf tree, NUMS internal key, key path is unspendable. */
|
|
101
|
+
public static generateAddress(cfg: CSVMultisigConfig, network: Network): CSVMultisigAddress {
|
|
102
|
+
const tapscript = this.buildTapscript(cfg);
|
|
103
|
+
|
|
104
|
+
const p2tr = payments.p2tr({
|
|
105
|
+
internalPubkey: NUMS_INTERNAL_KEY as XOnlyPublicKey,
|
|
106
|
+
scriptTree: { output: tapscript },
|
|
107
|
+
redeem: {
|
|
108
|
+
output: tapscript,
|
|
109
|
+
redeemVersion: LEAF_VERSION_TAPSCRIPT,
|
|
110
|
+
},
|
|
111
|
+
network,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (!p2tr.address || !p2tr.output || !p2tr.witness || p2tr.witness.length < 2) {
|
|
115
|
+
throw new Error('Failed to generate CSV multisig P2TR address');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const control = p2tr.witness[p2tr.witness.length - 1];
|
|
119
|
+
if (!control) {
|
|
120
|
+
throw new Error('Failed to generate CSV multisig P2TR address');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
address: p2tr.address,
|
|
125
|
+
tapscript,
|
|
126
|
+
scriptPubKey: p2tr.output,
|
|
127
|
+
controlBlock: control,
|
|
128
|
+
internalPubkey: NUMS_INTERNAL_KEY,
|
|
129
|
+
leafVersion: LEAF_VERSION_TAPSCRIPT,
|
|
130
|
+
config: cfg,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Encode the nSequence value the spending input must use.
|
|
136
|
+
* BIP 68: disable bit (1 << 31) = 0, type,flag (1 << 22) = 0 for blocks,
|
|
137
|
+
* low 16 bits carry the block count.
|
|
138
|
+
*/
|
|
139
|
+
public static encodeSequence(csvBlocks: number): number {
|
|
140
|
+
if (csvBlocks < 1 || csvBlocks > 0xffff) {
|
|
141
|
+
throw new Error('csvBlocks out of range');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return csvBlocks & 0x0000ffff;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Build witness stack for a script path spend.
|
|
149
|
+
*
|
|
150
|
+
* Returns { witness, sequence }. The caller MUST set nSequence = sequence
|
|
151
|
+
* on the spending input, otherwise OP_CHECKSEQUENCEVERIFY will fail.
|
|
152
|
+
* Transaction nVersion must be >= 2 for CSV to be enforced at all.
|
|
153
|
+
*/
|
|
154
|
+
public static buildSpendWitness(
|
|
155
|
+
signatures: Uint8Array[],
|
|
156
|
+
addr: CSVMultisigAddress,
|
|
157
|
+
): { witness: Uint8Array[]; sequence: number } {
|
|
158
|
+
const { config, tapscript, controlBlock } = addr;
|
|
159
|
+
|
|
160
|
+
if (signatures.length !== config.pubkeys.length) {
|
|
161
|
+
throw new Error('signatures length must match pubkeys length');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
for (const sig of signatures) {
|
|
165
|
+
if (sig.length !== 0 && sig.length !== 64 && sig.length !== 65) {
|
|
166
|
+
throw new Error('Each sig must be empty, 64, or 65 bytes');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const provided = signatures.filter((s) => s.length > 0).length;
|
|
171
|
+
if (provided < config.threshold) {
|
|
172
|
+
throw new Error(`Need ${config.threshold} signatures, got ${provided}`);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const witness: Uint8Array[] = [];
|
|
176
|
+
|
|
177
|
+
// Reverse pubkey order: sig for pubkeys[0] must end up on top of stack.
|
|
178
|
+
for (let i = signatures.length - 1; i >= 0; i--) {
|
|
179
|
+
witness.push(signatures[i] as Uint8Array);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
witness.push(tapscript);
|
|
183
|
+
witness.push(controlBlock);
|
|
184
|
+
|
|
185
|
+
return { witness, sequence: this.encodeSequence(config.csvBlocks) };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
public static isP2TRScriptPubKey(scriptPubKey: Uint8Array): boolean {
|
|
189
|
+
return isP2TR(scriptPubKey);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Derive the full CSV multisig address from just the tapscript.
|
|
194
|
+
*
|
|
195
|
+
* The tapscript alone fully determines the address because:
|
|
196
|
+
* - the internal key is the hard coded NUMS point,
|
|
197
|
+
* - the tap tree is a single leaf,
|
|
198
|
+
* - the leaf version is LEAF_VERSION_TAPSCRIPT (0xc0).
|
|
199
|
+
*
|
|
200
|
+
* Returns null when the tapscript does not match the CSV multisig shape.
|
|
201
|
+
*/
|
|
202
|
+
public static deriveAddressFromTapscript(
|
|
203
|
+
tapscript: Uint8Array,
|
|
204
|
+
network: Network,
|
|
205
|
+
): CSVMultisigAddress | null {
|
|
206
|
+
const config = this.parseTapscript(tapscript);
|
|
207
|
+
if (!config) return null;
|
|
208
|
+
|
|
209
|
+
return this.generateAddress(config, network);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Witness stack size needed for fee estimation.
|
|
214
|
+
*
|
|
215
|
+
* threshold 64-byte Schnorr sigs at the bottom (pushed first by the caller),
|
|
216
|
+
* plus (n - threshold) empty placeholders for unsigned slots,
|
|
217
|
+
* plus the tapscript, plus the control block.
|
|
218
|
+
*/
|
|
219
|
+
public static buildDummyWitness(addr: CSVMultisigAddress): Uint8Array[] {
|
|
220
|
+
const { config, tapscript, controlBlock } = addr;
|
|
221
|
+
const witness: Uint8Array[] = [];
|
|
222
|
+
|
|
223
|
+
// Position 0..n-1 maps to pubkey n-1..0 on the stack.
|
|
224
|
+
// For estimation we put real 64-byte sigs in the last `threshold` positions
|
|
225
|
+
// (matching the highest-indexed pubkeys), and empties elsewhere.
|
|
226
|
+
for (let i = 0; i < config.pubkeys.length; i++) {
|
|
227
|
+
const stackPos = config.pubkeys.length - 1 - i;
|
|
228
|
+
if (stackPos < config.threshold) {
|
|
229
|
+
witness.push(new Uint8Array(64));
|
|
230
|
+
} else {
|
|
231
|
+
witness.push(new Uint8Array(0));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
witness.push(tapscript);
|
|
236
|
+
witness.push(controlBlock);
|
|
237
|
+
return witness;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Build the final witness stack from collected PSBT tapScriptSig entries.
|
|
242
|
+
*
|
|
243
|
+
* Each entry is matched to its pubkey in the tapscript. Missing entries
|
|
244
|
+
* produce empty (zero-length) placeholders so the remaining signatures can
|
|
245
|
+
* still validate at positions above threshold.
|
|
246
|
+
*/
|
|
247
|
+
public static buildFinalWitnessFromTapScriptSigs(
|
|
248
|
+
tapScriptSigs: readonly TapScriptSig[],
|
|
249
|
+
addr: CSVMultisigAddress,
|
|
250
|
+
): Uint8Array[] {
|
|
251
|
+
const { config, tapscript, controlBlock } = addr;
|
|
252
|
+
|
|
253
|
+
const sigsByPubkey = new Map<string, Uint8Array>();
|
|
254
|
+
for (const entry of tapScriptSigs) {
|
|
255
|
+
if (!entry.pubkey || entry.pubkey.length !== 32) continue;
|
|
256
|
+
sigsByPubkey.set(toHexKey(entry.pubkey), entry.signature);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const ordered: Uint8Array[] = [];
|
|
260
|
+
let provided = 0;
|
|
261
|
+
for (const pk of config.pubkeys) {
|
|
262
|
+
const sig = sigsByPubkey.get(toHexKey(pk));
|
|
263
|
+
if (sig) {
|
|
264
|
+
if (sig.length !== 64 && sig.length !== 65) {
|
|
265
|
+
throw new Error(
|
|
266
|
+
`Invalid Schnorr signature length ${sig.length} for CSV multisig spend`,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
ordered.push(sig);
|
|
271
|
+
provided++;
|
|
272
|
+
} else {
|
|
273
|
+
ordered.push(new Uint8Array(0));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (provided < config.threshold) {
|
|
278
|
+
throw new Error(
|
|
279
|
+
`CSV multisig spend needs ${config.threshold} signatures, got ${provided}`,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const witness: Uint8Array[] = [];
|
|
284
|
+
// Reverse pubkey order so that the signature for pubkeys[0] lands on top of the stack.
|
|
285
|
+
for (let i = ordered.length - 1; i >= 0; i--) {
|
|
286
|
+
witness.push(ordered[i] as Uint8Array);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
witness.push(tapscript);
|
|
290
|
+
witness.push(controlBlock);
|
|
291
|
+
return witness;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* True when this UTXO is a CSV multisig P2TR output that this provider can spend.
|
|
296
|
+
*
|
|
297
|
+
* Requires both the P2TR scriptPubKey and a witnessScript (the tapscript) on
|
|
298
|
+
* the UTXO, and checks the tapscript shape AND that the scriptPubKey matches
|
|
299
|
+
* the address derived from that tapscript (prevents spoofed witnessScripts).
|
|
300
|
+
*/
|
|
301
|
+
public static isSpendableUTXO(utxo: UTXO, network: Network): boolean {
|
|
302
|
+
if (!utxo.witnessScript) return false;
|
|
303
|
+
|
|
304
|
+
const scriptPub = fromHex(utxo.scriptPubKey.hex);
|
|
305
|
+
if (!isP2TR(scriptPub)) return false;
|
|
306
|
+
|
|
307
|
+
const tapscript =
|
|
308
|
+
utxo.witnessScript instanceof Uint8Array
|
|
309
|
+
? utxo.witnessScript
|
|
310
|
+
: fromHex(utxo.witnessScript);
|
|
311
|
+
|
|
312
|
+
const addr = this.deriveAddressFromTapscript(tapscript, network);
|
|
313
|
+
if (!addr) return false;
|
|
314
|
+
|
|
315
|
+
return equals(addr.scriptPubKey, scriptPub);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Parse a tapscript that matches the CSV + CHECKSIGADD multisig shape.
|
|
320
|
+
* Returns null if the script does not match.
|
|
321
|
+
*/
|
|
322
|
+
public static parseTapscript(tapscript: Uint8Array): CSVMultisigConfig | null {
|
|
323
|
+
const d = script.decompile(tapscript);
|
|
324
|
+
if (!d || d.length < 6) return null;
|
|
325
|
+
|
|
326
|
+
// <csvBlocks> CSV DROP
|
|
327
|
+
// Small values (1..16) are minimally encoded as OP_N opcodes by
|
|
328
|
+
// script.compile, so the chunk may be a number rather than a Uint8Array.
|
|
329
|
+
const csvChunk = d[0];
|
|
330
|
+
let csvBlocks: number;
|
|
331
|
+
if (csvChunk instanceof Uint8Array) {
|
|
332
|
+
try {
|
|
333
|
+
csvBlocks = script.number.decode(csvChunk as Buffer);
|
|
334
|
+
} catch {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
} else if (
|
|
338
|
+
typeof csvChunk === 'number' &&
|
|
339
|
+
csvChunk >= opcodes.OP_1 &&
|
|
340
|
+
csvChunk <= opcodes.OP_16
|
|
341
|
+
) {
|
|
342
|
+
csvBlocks = csvChunk - opcodes.OP_1 + 1;
|
|
343
|
+
} else {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (d[1] !== opcodes.OP_CHECKSEQUENCEVERIFY) return null;
|
|
348
|
+
if (d[2] !== opcodes.OP_DROP) return null;
|
|
349
|
+
|
|
350
|
+
// <pk1> CHECKSIG
|
|
351
|
+
let i = 3;
|
|
352
|
+
if (
|
|
353
|
+
!(d[i] instanceof Uint8Array) ||
|
|
354
|
+
(d[i] as Uint8Array).length !== 32 ||
|
|
355
|
+
d[i + 1] !== opcodes.OP_CHECKSIG
|
|
356
|
+
) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const pubkeys: XOnlyPublicKey[] = [d[i] as XOnlyPublicKey];
|
|
361
|
+
i += 2;
|
|
362
|
+
|
|
363
|
+
// <pkN> CHECKSIGADD pairs
|
|
364
|
+
while (
|
|
365
|
+
i + 1 < d.length &&
|
|
366
|
+
d[i] instanceof Uint8Array &&
|
|
367
|
+
(d[i] as Uint8Array).length === 32 &&
|
|
368
|
+
d[i + 1] === opcodes.OP_CHECKSIGADD
|
|
369
|
+
) {
|
|
370
|
+
pubkeys.push(d[i] as XOnlyPublicKey);
|
|
371
|
+
i += 2;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// threshold + OP_NUMEQUAL at the end
|
|
375
|
+
if (i + 2 !== d.length) return null;
|
|
376
|
+
const threshChunk = d[i];
|
|
377
|
+
let threshold: number;
|
|
378
|
+
if (
|
|
379
|
+
typeof threshChunk === 'number' &&
|
|
380
|
+
threshChunk >= opcodes.OP_1 &&
|
|
381
|
+
threshChunk <= opcodes.OP_16
|
|
382
|
+
) {
|
|
383
|
+
threshold = threshChunk - opcodes.OP_1 + 1;
|
|
384
|
+
} else if (threshChunk instanceof Uint8Array) {
|
|
385
|
+
threshold = script.number.decode(threshChunk as Buffer);
|
|
386
|
+
} else {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (d[i + 1] !== opcodes.OP_NUMEQUAL) return null;
|
|
391
|
+
if (threshold < 1 || threshold > pubkeys.length) return null;
|
|
392
|
+
|
|
393
|
+
return { pubkeys, threshold, csvBlocks };
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Finalize a single PSBT input that was set up as a CSV multisig P2TR spend.
|
|
398
|
+
*
|
|
399
|
+
* Collects the tapScriptSig entries that cosigners have added to the PSBT
|
|
400
|
+
* input and writes the final witness. Designed for the collaborative case
|
|
401
|
+
* where signers accumulate signatures on a shared PSBT and then anyone
|
|
402
|
+
* finalizes once threshold is met.
|
|
403
|
+
*
|
|
404
|
+
* `addr` may be omitted when the input's first tapLeafScript carries the
|
|
405
|
+
* tapscript — it is then re-derived here.
|
|
406
|
+
*/
|
|
407
|
+
public static finalizePsbtInput(
|
|
408
|
+
psbt: Psbt,
|
|
409
|
+
inputIndex: number,
|
|
410
|
+
network: Network,
|
|
411
|
+
addr?: CSVMultisigAddress,
|
|
412
|
+
): void {
|
|
413
|
+
const input = psbt.data.inputs[inputIndex];
|
|
414
|
+
if (!input) {
|
|
415
|
+
throw new Error(`PSBT has no input at index ${inputIndex}`);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
let descriptor = addr;
|
|
419
|
+
if (!descriptor) {
|
|
420
|
+
const tls = input.tapLeafScript;
|
|
421
|
+
if (!tls || tls.length === 0 || !tls[0]) {
|
|
422
|
+
throw new Error(
|
|
423
|
+
`Input #${inputIndex} has no tapLeafScript — pass \`addr\` explicitly`,
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const derived = this.deriveAddressFromTapscript(tls[0].script, network);
|
|
428
|
+
if (!derived) {
|
|
429
|
+
throw new Error(`Input #${inputIndex} tapLeafScript is not a CSV multisig`);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
descriptor = derived;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const tapSigs = input.tapScriptSig ?? [];
|
|
436
|
+
const witness = this.buildFinalWitnessFromTapScriptSigs(tapSigs, descriptor);
|
|
437
|
+
|
|
438
|
+
psbt.finalizeInput(inputIndex, () => ({
|
|
439
|
+
finalScriptSig: undefined,
|
|
440
|
+
finalScriptWitness: witnessStackToScriptWitness(witness),
|
|
441
|
+
}));
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
public static isCSVMultisigUTXO(utxo: UTXO): boolean {
|
|
445
|
+
if (!utxo.witnessScript) {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const tapscript =
|
|
450
|
+
utxo.witnessScript instanceof Uint8Array
|
|
451
|
+
? utxo.witnessScript
|
|
452
|
+
: fromHex(utxo.witnessScript);
|
|
453
|
+
|
|
454
|
+
return this.parseTapscript(tapscript) !== null;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function toHexKey(u8: Uint8Array): string {
|
|
459
|
+
let s = '';
|
|
460
|
+
for (let i = 0; i < u8.length; i++) {
|
|
461
|
+
s += (u8[i] as number).toString(16).padStart(2, '0');
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return s;
|
|
465
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromHex, Psbt, type PsbtInput, type Signer, toHex } from '@btc-vision/bitcoin';
|
|
1
|
+
import { fromHex, Psbt, type PsbtInput, type Signer, toHex, toXOnly } from '@btc-vision/bitcoin';
|
|
2
2
|
import { type UniversalSigner } from '@btc-vision/ecpair';
|
|
3
3
|
import { TransactionType } from '../enums/TransactionType.js';
|
|
4
4
|
import { TransactionBuilder } from '../builders/TransactionBuilder.js';
|
|
@@ -14,6 +14,21 @@ import type {
|
|
|
14
14
|
IInteractionParameters,
|
|
15
15
|
ITransactionParameters,
|
|
16
16
|
} from '../interfaces/ITransactionParameters.js';
|
|
17
|
+
import { CSVMultisigProvider } from '../mineable/CSVMultisigProvider.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Per-input CSV multisig signing status.
|
|
21
|
+
*/
|
|
22
|
+
export interface CSVMultisigInputStatus {
|
|
23
|
+
/** PSBT input index */
|
|
24
|
+
readonly inputIndex: number;
|
|
25
|
+
/** Threshold required to spend this input */
|
|
26
|
+
readonly required: number;
|
|
27
|
+
/** Number of distinct cosigner signatures collected so far */
|
|
28
|
+
readonly collected: number;
|
|
29
|
+
/** Hex-encoded x-only pubkeys of the cosigners that have signed */
|
|
30
|
+
readonly signers: string[];
|
|
31
|
+
}
|
|
17
32
|
|
|
18
33
|
/**
|
|
19
34
|
* Export options for offline transaction signing
|
|
@@ -626,4 +641,179 @@ export class OfflineTransactionManager {
|
|
|
626
641
|
|
|
627
642
|
return TransactionSerializer.toBase64(newState);
|
|
628
643
|
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Inspect collaborative signing progress on all CSV multisig inputs.
|
|
647
|
+
* Returns an empty array when no partial PSBT has been produced yet.
|
|
648
|
+
*/
|
|
649
|
+
public static csvMultisigGetStatus(serializedState: string): CSVMultisigInputStatus[] {
|
|
650
|
+
const state = TransactionSerializer.fromBase64(serializedState);
|
|
651
|
+
if (!state.partialPsbtBase64) return [];
|
|
652
|
+
|
|
653
|
+
const network = TransactionReconstructor['nameToNetwork'](state.baseParams.networkName);
|
|
654
|
+
const psbt = Psbt.fromBase64(state.partialPsbtBase64, { network });
|
|
655
|
+
return this.computeCSVMultisigStatus(state, psbt, network);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Add the given signer's contribution to every CSV multisig input it can sign.
|
|
660
|
+
* No-op for inputs whose tapscript does not contain the signer's x-only pubkey.
|
|
661
|
+
*
|
|
662
|
+
* First call (no partial PSBT yet) builds the PSBT from the funding params
|
|
663
|
+
* using the provided signer as the builder's signer. Subsequent calls load
|
|
664
|
+
* the carried PSBT and add the signer's tapScriptSig where applicable.
|
|
665
|
+
*/
|
|
666
|
+
public static async addCSVMultisigSignature(
|
|
667
|
+
serializedState: string,
|
|
668
|
+
signer: Signer | UniversalSigner,
|
|
669
|
+
): Promise<{
|
|
670
|
+
state: string;
|
|
671
|
+
final: boolean;
|
|
672
|
+
perInput: CSVMultisigInputStatus[];
|
|
673
|
+
}> {
|
|
674
|
+
const state = TransactionSerializer.fromBase64(serializedState);
|
|
675
|
+
const network = TransactionReconstructor['nameToNetwork'](state.baseParams.networkName);
|
|
676
|
+
|
|
677
|
+
let psbt: Psbt;
|
|
678
|
+
|
|
679
|
+
if (state.partialPsbtBase64) {
|
|
680
|
+
psbt = Psbt.fromBase64(state.partialPsbtBase64, { network });
|
|
681
|
+
this.addSignerToCSVInputs(psbt, signer, network);
|
|
682
|
+
} else {
|
|
683
|
+
const builder = this.importForSigning(serializedState, { signer });
|
|
684
|
+
psbt = await builder.signPSBT();
|
|
685
|
+
// Best-effort: ensure the signer's contribution is recorded on every
|
|
686
|
+
// CSV input where they're a cosigner (the builder already attempts
|
|
687
|
+
// this, but this guards against builds that bailed early).
|
|
688
|
+
this.addSignerToCSVInputs(psbt, signer, network);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
const perInput = this.computeCSVMultisigStatus(state, psbt, network);
|
|
692
|
+
const final = perInput.length > 0 && perInput.every((s) => s.collected >= s.required);
|
|
693
|
+
|
|
694
|
+
const newState: ISerializableTransactionState = {
|
|
695
|
+
...state,
|
|
696
|
+
partialPsbtBase64: psbt.toBase64(),
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
return {
|
|
700
|
+
state: TransactionSerializer.toBase64(newState),
|
|
701
|
+
final,
|
|
702
|
+
perInput,
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Finalize every CSV multisig input on the partial PSBT and extract the
|
|
708
|
+
* raw transaction hex. Throws if any input is still below its threshold.
|
|
709
|
+
*/
|
|
710
|
+
public static csvMultisigFinalize(serializedState: string): string {
|
|
711
|
+
const state = TransactionSerializer.fromBase64(serializedState);
|
|
712
|
+
if (!state.partialPsbtBase64) {
|
|
713
|
+
throw new Error('No partial PSBT in state — call addCSVMultisigSignature first');
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const network = TransactionReconstructor['nameToNetwork'](state.baseParams.networkName);
|
|
717
|
+
const psbt = Psbt.fromBase64(state.partialPsbtBase64, { network });
|
|
718
|
+
|
|
719
|
+
for (let i = 0; i < psbt.data.inputs.length; i++) {
|
|
720
|
+
const input = psbt.data.inputs[i] as PsbtInput;
|
|
721
|
+
if (!input.tapLeafScript || input.tapLeafScript.length === 0) continue;
|
|
722
|
+
|
|
723
|
+
const leaf = input.tapLeafScript[0];
|
|
724
|
+
if (!leaf) continue;
|
|
725
|
+
|
|
726
|
+
const addr = CSVMultisigProvider.deriveAddressFromTapscript(leaf.script, network);
|
|
727
|
+
if (!addr) continue;
|
|
728
|
+
|
|
729
|
+
CSVMultisigProvider.finalizePsbtInput(psbt, i, network, addr);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
return psbt.extractTransaction(true, true).toHex();
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Sign every CSV multisig input whose tapscript contains the signer's
|
|
737
|
+
* x-only pubkey and does not yet carry a signature from that pubkey.
|
|
738
|
+
*/
|
|
739
|
+
private static addSignerToCSVInputs(
|
|
740
|
+
psbt: Psbt,
|
|
741
|
+
signer: Signer | UniversalSigner,
|
|
742
|
+
network: import('@btc-vision/bitcoin').Network,
|
|
743
|
+
): void {
|
|
744
|
+
const signerXOnly = toXOnly(signer.publicKey);
|
|
745
|
+
const signerXOnlyHex = toHex(signerXOnly);
|
|
746
|
+
|
|
747
|
+
for (let i = 0; i < psbt.data.inputs.length; i++) {
|
|
748
|
+
const input = psbt.data.inputs[i] as PsbtInput;
|
|
749
|
+
if (!input.tapLeafScript || input.tapLeafScript.length === 0) continue;
|
|
750
|
+
|
|
751
|
+
const leaf = input.tapLeafScript[0];
|
|
752
|
+
if (!leaf) continue;
|
|
753
|
+
|
|
754
|
+
const addr = CSVMultisigProvider.deriveAddressFromTapscript(leaf.script, network);
|
|
755
|
+
if (!addr) continue;
|
|
756
|
+
|
|
757
|
+
const isCosigner = addr.config.pubkeys.some(
|
|
758
|
+
(pk) => toHex(pk as Uint8Array) === signerXOnlyHex,
|
|
759
|
+
);
|
|
760
|
+
if (!isCosigner) continue;
|
|
761
|
+
|
|
762
|
+
const alreadySigned = (input.tapScriptSig ?? []).some(
|
|
763
|
+
(s) => toHex(s.pubkey) === signerXOnlyHex,
|
|
764
|
+
);
|
|
765
|
+
if (alreadySigned) continue;
|
|
766
|
+
|
|
767
|
+
psbt.signTaprootInput(i, signer);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Build per-input status for every CSV multisig input.
|
|
773
|
+
*
|
|
774
|
+
* Walks state.utxos so we can detect CSV multisig inputs even after the
|
|
775
|
+
* builder has already finalized them (which clears tapLeafScript). For
|
|
776
|
+
* partially-signed inputs the signers list reflects collected tapScriptSig
|
|
777
|
+
* entries; for finalized inputs collected is set to the threshold.
|
|
778
|
+
*/
|
|
779
|
+
private static computeCSVMultisigStatus(
|
|
780
|
+
state: ISerializableTransactionState,
|
|
781
|
+
psbt: Psbt,
|
|
782
|
+
network: import('@btc-vision/bitcoin').Network,
|
|
783
|
+
): CSVMultisigInputStatus[] {
|
|
784
|
+
const result: CSVMultisigInputStatus[] = [];
|
|
785
|
+
|
|
786
|
+
for (let i = 0; i < state.utxos.length; i++) {
|
|
787
|
+
const utxo = state.utxos[i];
|
|
788
|
+
if (!utxo?.witnessScript) continue;
|
|
789
|
+
|
|
790
|
+
const tapscript = fromHex(utxo.witnessScript);
|
|
791
|
+
const addr = CSVMultisigProvider.deriveAddressFromTapscript(tapscript, network);
|
|
792
|
+
if (!addr) continue;
|
|
793
|
+
|
|
794
|
+
const input = psbt.data.inputs[i] as PsbtInput | undefined;
|
|
795
|
+
if (!input) continue;
|
|
796
|
+
|
|
797
|
+
if (input.finalScriptWitness) {
|
|
798
|
+
// Already finalized — by construction it carried >= threshold sigs.
|
|
799
|
+
result.push({
|
|
800
|
+
inputIndex: i,
|
|
801
|
+
required: addr.config.threshold,
|
|
802
|
+
collected: addr.config.threshold,
|
|
803
|
+
signers: [],
|
|
804
|
+
});
|
|
805
|
+
continue;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
const tapSigs = input.tapScriptSig ?? [];
|
|
809
|
+
result.push({
|
|
810
|
+
inputIndex: i,
|
|
811
|
+
required: addr.config.threshold,
|
|
812
|
+
collected: tapSigs.length,
|
|
813
|
+
signers: tapSigs.map((s) => toHex(s.pubkey)),
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return result;
|
|
818
|
+
}
|
|
629
819
|
}
|
|
@@ -67,6 +67,9 @@ export class TransactionSerializer {
|
|
|
67
67
|
// Write precomputed data
|
|
68
68
|
this.writePrecomputedData(writer, state.precomputedData);
|
|
69
69
|
|
|
70
|
+
// v2: partial PSBT (empty string when absent)
|
|
71
|
+
writer.writeStringWithLength(state.partialPsbtBase64 ?? '');
|
|
72
|
+
|
|
70
73
|
// Get buffer and calculate checksum
|
|
71
74
|
const dataBuffer = writer.getBuffer();
|
|
72
75
|
const checksum = this.calculateChecksum(dataBuffer);
|
|
@@ -128,6 +131,13 @@ export class TransactionSerializer {
|
|
|
128
131
|
// Read precomputed data
|
|
129
132
|
const precomputedData = this.readPrecomputedData(reader);
|
|
130
133
|
|
|
134
|
+
// v2+: partial PSBT (collaborative signing carryover)
|
|
135
|
+
let partialPsbtBase64: string | undefined;
|
|
136
|
+
if (header.formatVersion >= 2) {
|
|
137
|
+
const stored = reader.readStringWithLength();
|
|
138
|
+
partialPsbtBase64 = stored.length > 0 ? stored : undefined;
|
|
139
|
+
}
|
|
140
|
+
|
|
131
141
|
return {
|
|
132
142
|
header,
|
|
133
143
|
baseParams,
|
|
@@ -138,6 +148,7 @@ export class TransactionSerializer {
|
|
|
138
148
|
signerMappings,
|
|
139
149
|
typeSpecificData,
|
|
140
150
|
precomputedData,
|
|
151
|
+
...(partialPsbtBase64 !== undefined ? { partialPsbtBase64 } : {}),
|
|
141
152
|
};
|
|
142
153
|
}
|
|
143
154
|
|