@btc-vision/transaction 1.8.0-beta.0 → 1.8.0-beta.10
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/_version.d.ts +2 -1
- package/browser/_version.d.ts.map +1 -0
- package/browser/abi/ABICoder.d.ts +15 -36
- package/browser/abi/ABICoder.d.ts.map +1 -0
- package/browser/abi/ABIDataTypes.d.ts +35 -0
- package/browser/abi/ABIDataTypes.d.ts.map +1 -0
- package/browser/abi/AbiTypes.d.ts +50 -0
- package/browser/abi/AbiTypes.d.ts.map +1 -0
- package/browser/abi/TupleUtils.d.ts +25 -0
- package/browser/abi/TupleUtils.d.ts.map +1 -0
- package/browser/branded/Branded.d.ts +4 -0
- package/browser/branded/Branded.d.ts.map +1 -0
- package/browser/btc-vision-bitcoin.js +12388 -3684
- package/browser/buffer/BinaryReader.d.ts +120 -1
- package/browser/buffer/BinaryReader.d.ts.map +1 -0
- package/browser/buffer/BinaryWriter.d.ts +51 -1
- package/browser/buffer/BinaryWriter.d.ts.map +1 -0
- package/browser/bytecode/Compressor.d.ts +12 -0
- package/browser/bytecode/Compressor.d.ts.map +1 -0
- package/browser/chain/ChainData.d.ts +2 -2
- package/browser/chain/ChainData.d.ts.map +1 -0
- package/browser/consensus/Consensus.d.ts +11 -3
- package/browser/consensus/Consensus.d.ts.map +1 -0
- package/browser/consensus/ConsensusConfig.d.ts +1 -0
- package/browser/consensus/ConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/IConsensusConfig.d.ts +1 -0
- package/browser/consensus/IConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/browser/crypto/crypto.d.ts +1 -0
- package/browser/crypto/crypto.d.ts.map +1 -0
- package/browser/deterministic/AddressMap.d.ts +6 -1
- package/browser/deterministic/AddressMap.d.ts.map +1 -0
- package/browser/deterministic/AddressSet.d.ts +3 -1
- package/browser/deterministic/AddressSet.d.ts.map +1 -0
- package/browser/deterministic/CustomMap.d.ts +3 -1
- package/browser/deterministic/CustomMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicMap.d.ts +3 -1
- package/browser/deterministic/DeterministicMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicSet.d.ts +3 -1
- package/browser/deterministic/DeterministicSet.d.ts.map +1 -0
- package/browser/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/browser/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/browser/deterministic/FastMap.d.ts +7 -1
- package/browser/deterministic/FastMap.d.ts.map +1 -0
- package/browser/ecc/backend.d.ts +13 -0
- package/browser/ecc/backend.d.ts.map +1 -0
- package/browser/epoch/ChallengeSolution.d.ts +33 -1
- package/browser/epoch/ChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/browser/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/validator/EpochValidator.d.ts +37 -7
- package/browser/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/browser/event/NetEvent.d.ts +1 -0
- package/browser/event/NetEvent.d.ts.map +1 -0
- package/browser/generators/AddressGenerator.d.ts +4 -3
- package/browser/generators/AddressGenerator.d.ts.map +1 -0
- package/browser/generators/Features.d.ts +1 -0
- package/browser/generators/Features.d.ts.map +1 -0
- package/browser/generators/Generator.d.ts +46 -10
- package/browser/generators/Generator.d.ts.map +1 -0
- package/browser/generators/MLDSAData.d.ts +1 -0
- package/browser/generators/MLDSAData.d.ts.map +1 -0
- package/browser/generators/builders/CalldataGenerator.d.ts +25 -4
- package/browser/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/CustomGenerator.d.ts +13 -3
- package/browser/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/browser/generators/builders/DeploymentGenerator.d.ts +15 -4
- package/browser/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/HashCommitmentGenerator.d.ts +164 -12
- package/browser/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts +26 -4
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/browser/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/browser/generators/builders/P2WDAGenerator.d.ts +42 -4
- package/browser/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/browser/index.d.ts +1 -0
- package/browser/index.d.ts.map +1 -0
- package/browser/index.js +3921 -3450
- package/browser/keypair/Address.d.ts +283 -13
- package/browser/keypair/Address.d.ts.map +1 -0
- package/browser/keypair/AddressVerificator.d.ts +7 -6
- package/browser/keypair/AddressVerificator.d.ts.map +1 -0
- package/browser/keypair/EcKeyPair.d.ts +183 -20
- package/browser/keypair/EcKeyPair.d.ts.map +1 -0
- package/browser/keypair/MessageSigner.d.ts +17 -16
- package/browser/keypair/MessageSigner.d.ts.map +1 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/browser/keypair/Wallet.d.ts +27 -13
- package/browser/keypair/Wallet.d.ts.map +1 -0
- package/browser/keypair/interfaces/IWallet.d.ts +19 -0
- package/browser/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/browser/metadata/ContractBaseMetadata.d.ts +10 -2
- package/browser/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/browser/mnemonic/BIPStandard.d.ts +59 -0
- package/browser/mnemonic/BIPStandard.d.ts.map +1 -0
- package/browser/mnemonic/Mnemonic.d.ts +15 -3
- package/browser/mnemonic/Mnemonic.d.ts.map +1 -0
- package/browser/mnemonic/MnemonicStrength.d.ts +6 -0
- package/browser/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/browser/network/ChainId.d.ts +1 -0
- package/browser/network/ChainId.d.ts.map +1 -0
- package/browser/noble-curves.js +920 -2966
- package/browser/noble-hashes.js +2067 -1038
- package/browser/opnet.d.ts +25 -1
- package/browser/opnet.d.ts.map +1 -0
- package/browser/p2wda/P2WDADetector.d.ts +36 -9
- package/browser/p2wda/P2WDADetector.d.ts.map +1 -0
- package/browser/polyfill/disposable.d.ts +16 -0
- package/browser/polyfill/disposable.d.ts.map +1 -0
- package/browser/signer/AddressRotation.d.ts +36 -0
- package/browser/signer/AddressRotation.d.ts.map +1 -0
- package/browser/signer/IRotationSigner.d.ts +27 -3
- package/browser/signer/IRotationSigner.d.ts.map +1 -0
- package/browser/signer/ParallelSignerAdapter.d.ts +14 -0
- package/browser/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/browser/signer/SignerUtils.d.ts +11 -4
- package/browser/signer/SignerUtils.d.ts.map +1 -0
- package/browser/signer/TweakedSigner.d.ts +28 -4
- package/browser/signer/TweakedSigner.d.ts.map +1 -0
- package/browser/transaction/ContractAddress.d.ts +2 -2
- package/browser/transaction/ContractAddress.d.ts.map +1 -0
- package/browser/transaction/TransactionFactory.d.ts +140 -2
- package/browser/transaction/TransactionFactory.d.ts.map +1 -0
- package/browser/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/browser/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/browser/transaction/browser/Web3Provider.d.ts +27 -0
- package/browser/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/XverseSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/browser/transaction/browser/types/OPWallet.d.ts +10 -0
- package/browser/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/browser/transaction/builders/CancelTransaction.d.ts +29 -4
- package/browser/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +137 -10
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/CustomScriptTransaction.d.ts +106 -6
- package/browser/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/DeploymentTransaction.d.ts +116 -5
- package/browser/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/FundingTransaction.d.ts +5 -3
- package/browser/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransaction.d.ts +12 -3
- package/browser/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +56 -5
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/browser/transaction/builders/MultiSignTransaction.d.ts +125 -16
- package/browser/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +103 -15
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/TransactionBuilder.d.ts +238 -15
- package/browser/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/browser/transaction/enums/TransactionType.d.ts +1 -0
- package/browser/transaction/enums/TransactionType.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts +2 -1
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +46 -3
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts +6 -4
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionParameters.d.ts +33 -10
- package/browser/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts +17 -5
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts +26 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/browser/transaction/interfaces/Tap.d.ts +4 -3
- package/browser/transaction/interfaces/Tap.d.ts.map +1 -0
- package/browser/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/browser/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/browser/transaction/mineable/TimelockGenerator.d.ts +12 -3
- package/browser/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/browser/transaction/offline/OfflineTransactionManager.d.ts +190 -9
- package/browser/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionReconstructor.d.ts +53 -3
- package/browser/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionSerializer.d.ts +53 -2
- package/browser/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionStateCapture.d.ts +64 -5
- package/browser/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts +71 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts +76 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/browser/transaction/shared/P2TR_MS.d.ts +11 -2
- package/browser/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/browser/transaction/shared/TweakedTransaction.d.ts +274 -33
- package/browser/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/browser/transaction/utils/WitnessUtils.d.ts +7 -1
- package/browser/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/browser/utils/BitcoinUtils.d.ts +19 -0
- package/browser/utils/BitcoinUtils.d.ts.map +1 -0
- package/browser/utils/BufferHelper.d.ts +1 -0
- package/browser/utils/BufferHelper.d.ts.map +1 -0
- package/browser/utils/StringToBuffer.d.ts +1 -0
- package/browser/utils/StringToBuffer.d.ts.map +1 -0
- package/browser/utils/lengths.d.ts +1 -0
- package/browser/utils/lengths.d.ts.map +1 -0
- package/browser/utils/types.d.ts +1 -0
- package/browser/utils/types.d.ts.map +1 -0
- package/browser/utxo/OPNetLimitedProvider.d.ts +37 -1
- package/browser/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/browser/utxo/interfaces/IUTXO.d.ts +11 -5
- package/browser/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/browser/vendors.js +13940 -9389
- package/browser/verification/TapscriptVerificator.d.ts +10 -8
- package/browser/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/_version.d.ts +2 -1
- package/build/_version.d.ts.map +1 -0
- package/build/_version.js +2 -1
- package/build/_version.js.map +1 -0
- package/build/abi/ABICoder.d.ts +15 -36
- package/build/abi/ABICoder.d.ts.map +1 -0
- package/build/abi/ABICoder.js +120 -143
- package/build/abi/ABICoder.js.map +1 -0
- package/build/abi/ABIDataTypes.d.ts +35 -0
- package/build/abi/ABIDataTypes.d.ts.map +1 -0
- package/build/abi/ABIDataTypes.js +42 -0
- package/build/abi/ABIDataTypes.js.map +1 -0
- package/build/abi/AbiTypes.d.ts +50 -0
- package/build/abi/AbiTypes.d.ts.map +1 -0
- package/build/abi/AbiTypes.js +78 -0
- package/build/abi/AbiTypes.js.map +1 -0
- package/build/abi/TupleUtils.d.ts +25 -0
- package/build/abi/TupleUtils.d.ts.map +1 -0
- package/build/abi/TupleUtils.js +50 -0
- package/build/abi/TupleUtils.js.map +1 -0
- package/build/branded/Branded.d.ts +4 -0
- package/build/branded/Branded.d.ts.map +1 -0
- package/build/branded/Branded.js +2 -0
- package/build/branded/Branded.js.map +1 -0
- package/build/buffer/BinaryReader.d.ts +121 -2
- package/build/buffer/BinaryReader.d.ts.map +1 -0
- package/build/buffer/BinaryReader.js +129 -5
- package/build/buffer/BinaryReader.js.map +1 -0
- package/build/buffer/BinaryWriter.d.ts +52 -2
- package/build/buffer/BinaryWriter.d.ts.map +1 -0
- package/build/buffer/BinaryWriter.js +62 -2
- package/build/buffer/BinaryWriter.js.map +1 -0
- package/build/bytecode/Compressor.d.ts +12 -0
- package/build/bytecode/Compressor.d.ts.map +1 -0
- package/build/bytecode/Compressor.js +17 -5
- package/build/bytecode/Compressor.js.map +1 -0
- package/build/chain/ChainData.d.ts +2 -2
- package/build/chain/ChainData.d.ts.map +1 -0
- package/build/chain/ChainData.js +37 -16
- package/build/chain/ChainData.js.map +1 -0
- package/build/consensus/Consensus.d.ts +11 -3
- package/build/consensus/Consensus.d.ts.map +1 -0
- package/build/consensus/Consensus.js +8 -0
- package/build/consensus/Consensus.js.map +1 -0
- package/build/consensus/ConsensusConfig.d.ts +2 -1
- package/build/consensus/ConsensusConfig.d.ts.map +1 -0
- package/build/consensus/ConsensusConfig.js +1 -0
- package/build/consensus/ConsensusConfig.js.map +1 -0
- package/build/consensus/IConsensusConfig.d.ts +1 -0
- package/build/consensus/IConsensusConfig.d.ts.map +1 -0
- package/build/consensus/IConsensusConfig.js +2 -1
- package/build/consensus/IConsensusConfig.js.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.d.ts +2 -1
- package/build/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.js +2 -0
- package/build/consensus/metadata/RoswellConsensus.js.map +1 -0
- package/build/crypto/crypto.d.ts +1 -0
- package/build/crypto/crypto.d.ts.map +1 -0
- package/build/crypto/crypto.js +1 -0
- package/build/crypto/crypto.js.map +1 -0
- package/build/deterministic/AddressMap.d.ts +6 -1
- package/build/deterministic/AddressMap.d.ts.map +1 -0
- package/build/deterministic/AddressMap.js +8 -0
- package/build/deterministic/AddressMap.js.map +1 -0
- package/build/deterministic/AddressSet.d.ts +3 -1
- package/build/deterministic/AddressSet.d.ts.map +1 -0
- package/build/deterministic/AddressSet.js +7 -0
- package/build/deterministic/AddressSet.js.map +1 -0
- package/build/deterministic/CustomMap.d.ts +3 -1
- package/build/deterministic/CustomMap.d.ts.map +1 -0
- package/build/deterministic/CustomMap.js +65 -47
- package/build/deterministic/CustomMap.js.map +1 -0
- package/build/deterministic/DeterministicMap.d.ts +4 -2
- package/build/deterministic/DeterministicMap.d.ts.map +1 -0
- package/build/deterministic/DeterministicMap.js +24 -27
- package/build/deterministic/DeterministicMap.js.map +1 -0
- package/build/deterministic/DeterministicSet.d.ts +3 -1
- package/build/deterministic/DeterministicSet.d.ts.map +1 -0
- package/build/deterministic/DeterministicSet.js +6 -0
- package/build/deterministic/DeterministicSet.js.map +1 -0
- package/build/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/build/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/build/deterministic/ExtendedAddressMap.js +18 -2
- package/build/deterministic/ExtendedAddressMap.js.map +1 -0
- package/build/deterministic/FastMap.d.ts +7 -1
- package/build/deterministic/FastMap.d.ts.map +1 -0
- package/build/deterministic/FastMap.js +7 -2
- package/build/deterministic/FastMap.js.map +1 -0
- package/build/ecc/backend.d.ts +13 -0
- package/build/ecc/backend.d.ts.map +1 -0
- package/build/ecc/backend.js +15 -0
- package/build/ecc/backend.js.map +1 -0
- package/build/epoch/ChallengeSolution.d.ts +34 -2
- package/build/epoch/ChallengeSolution.d.ts.map +1 -0
- package/build/epoch/ChallengeSolution.js +52 -0
- package/build/epoch/ChallengeSolution.js.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/build/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.js +2 -1
- package/build/epoch/interfaces/IChallengeSolution.js.map +1 -0
- package/build/epoch/validator/EpochValidator.d.ts +38 -8
- package/build/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/build/epoch/validator/EpochValidator.js +45 -19
- package/build/epoch/validator/EpochValidator.js.map +1 -0
- package/build/event/NetEvent.d.ts +1 -0
- package/build/event/NetEvent.d.ts.map +1 -0
- package/build/event/NetEvent.js +3 -0
- package/build/event/NetEvent.js.map +1 -0
- package/build/generators/AddressGenerator.d.ts +4 -3
- package/build/generators/AddressGenerator.d.ts.map +1 -0
- package/build/generators/AddressGenerator.js +9 -4
- package/build/generators/AddressGenerator.js.map +1 -0
- package/build/generators/Features.d.ts +4 -3
- package/build/generators/Features.d.ts.map +1 -0
- package/build/generators/Features.js +1 -0
- package/build/generators/Features.js.map +1 -0
- package/build/generators/Generator.d.ts +47 -11
- package/build/generators/Generator.d.ts.map +1 -0
- package/build/generators/Generator.js +48 -12
- package/build/generators/Generator.js.map +1 -0
- package/build/generators/MLDSAData.d.ts +1 -0
- package/build/generators/MLDSAData.d.ts.map +1 -0
- package/build/generators/MLDSAData.js +1 -0
- package/build/generators/MLDSAData.js.map +1 -0
- package/build/generators/builders/CalldataGenerator.d.ts +27 -6
- package/build/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/CalldataGenerator.js +33 -4
- package/build/generators/builders/CalldataGenerator.js.map +1 -0
- package/build/generators/builders/CustomGenerator.d.ts +13 -3
- package/build/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/build/generators/builders/CustomGenerator.js +11 -0
- package/build/generators/builders/CustomGenerator.js.map +1 -0
- package/build/generators/builders/DeploymentGenerator.d.ts +17 -6
- package/build/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/build/generators/builders/DeploymentGenerator.js +18 -2
- package/build/generators/builders/DeploymentGenerator.js.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.d.ts +166 -14
- package/build/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.js +193 -27
- package/build/generators/builders/HashCommitmentGenerator.js.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.d.ts +27 -5
- package/build/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.js +35 -5
- package/build/generators/builders/LegacyCalldataGenerator.js.map +1 -0
- package/build/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/build/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/build/generators/builders/MultiSignGenerator.js +20 -10
- package/build/generators/builders/MultiSignGenerator.js.map +1 -0
- package/build/generators/builders/P2WDAGenerator.d.ts +44 -6
- package/build/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/build/generators/builders/P2WDAGenerator.js +41 -2
- package/build/generators/builders/P2WDAGenerator.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -0
- package/build/keypair/Address.d.ts +284 -14
- package/build/keypair/Address.d.ts.map +1 -0
- package/build/keypair/Address.js +447 -129
- package/build/keypair/Address.js.map +1 -0
- package/build/keypair/AddressVerificator.d.ts +7 -6
- package/build/keypair/AddressVerificator.d.ts.map +1 -0
- package/build/keypair/AddressVerificator.js +4 -5
- package/build/keypair/AddressVerificator.js.map +1 -0
- package/build/keypair/EcKeyPair.d.ts +185 -22
- package/build/keypair/EcKeyPair.d.ts.map +1 -0
- package/build/keypair/EcKeyPair.js +226 -49
- package/build/keypair/EcKeyPair.js.map +1 -0
- package/build/keypair/MessageSigner.d.ts +18 -17
- package/build/keypair/MessageSigner.d.ts.map +1 -0
- package/build/keypair/MessageSigner.js +34 -25
- package/build/keypair/MessageSigner.js.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.js +66 -0
- package/build/keypair/Secp256k1PointDeriver.js.map +1 -0
- package/build/keypair/Wallet.d.ts +29 -15
- package/build/keypair/Wallet.d.ts.map +1 -0
- package/build/keypair/Wallet.js +46 -14
- package/build/keypair/Wallet.js.map +1 -0
- package/build/keypair/interfaces/IWallet.d.ts +19 -0
- package/build/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/build/keypair/interfaces/IWallet.js +1 -0
- package/build/keypair/interfaces/IWallet.js.map +1 -0
- package/build/metadata/ContractBaseMetadata.d.ts +10 -2
- package/build/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/build/metadata/ContractBaseMetadata.js +10 -1
- package/build/metadata/ContractBaseMetadata.js.map +1 -0
- package/build/mnemonic/BIPStandard.d.ts +59 -0
- package/build/mnemonic/BIPStandard.d.ts.map +1 -0
- package/build/mnemonic/BIPStandard.js +59 -0
- package/build/mnemonic/BIPStandard.js.map +1 -0
- package/build/mnemonic/Mnemonic.d.ts +16 -4
- package/build/mnemonic/Mnemonic.d.ts.map +1 -0
- package/build/mnemonic/Mnemonic.js +35 -8
- package/build/mnemonic/Mnemonic.js.map +1 -0
- package/build/mnemonic/MnemonicStrength.d.ts +6 -0
- package/build/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/build/mnemonic/MnemonicStrength.js +6 -0
- package/build/mnemonic/MnemonicStrength.js.map +1 -0
- package/build/network/ChainId.d.ts +1 -0
- package/build/network/ChainId.d.ts.map +1 -0
- package/build/network/ChainId.js +1 -0
- package/build/network/ChainId.js.map +1 -0
- package/build/opnet.d.ts +29 -3
- package/build/opnet.d.ts.map +1 -0
- package/build/opnet.js +26 -0
- package/build/opnet.js.map +1 -0
- package/build/p2wda/P2WDADetector.d.ts +38 -11
- package/build/p2wda/P2WDADetector.d.ts.map +1 -0
- package/build/p2wda/P2WDADetector.js +43 -10
- package/build/p2wda/P2WDADetector.js.map +1 -0
- package/build/polyfill/disposable.d.ts +16 -0
- package/build/polyfill/disposable.d.ts.map +1 -0
- package/build/polyfill/disposable.js +23 -0
- package/build/polyfill/disposable.js.map +1 -0
- package/build/signer/AddressRotation.d.ts +37 -1
- package/build/signer/AddressRotation.d.ts.map +1 -0
- package/build/signer/AddressRotation.js +16 -0
- package/build/signer/AddressRotation.js.map +1 -0
- package/build/signer/IRotationSigner.d.ts +27 -3
- package/build/signer/IRotationSigner.d.ts.map +1 -0
- package/build/signer/IRotationSigner.js +2 -1
- package/build/signer/IRotationSigner.js.map +1 -0
- package/build/signer/ParallelSignerAdapter.d.ts +14 -0
- package/build/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/build/signer/ParallelSignerAdapter.js +51 -0
- package/build/signer/ParallelSignerAdapter.js.map +1 -0
- package/build/signer/SignerUtils.d.ts +11 -4
- package/build/signer/SignerUtils.d.ts.map +1 -0
- package/build/signer/SignerUtils.js +16 -0
- package/build/signer/SignerUtils.js.map +1 -0
- package/build/signer/TweakedSigner.d.ts +28 -4
- package/build/signer/TweakedSigner.d.ts.map +1 -0
- package/build/signer/TweakedSigner.js +23 -6
- package/build/signer/TweakedSigner.js.map +1 -0
- package/build/transaction/ContractAddress.d.ts +2 -2
- package/build/transaction/ContractAddress.d.ts.map +1 -0
- package/build/transaction/ContractAddress.js +4 -8
- package/build/transaction/ContractAddress.js.map +1 -0
- package/build/transaction/TransactionFactory.d.ts +147 -9
- package/build/transaction/TransactionFactory.d.ts.map +1 -0
- package/build/transaction/TransactionFactory.js +145 -26
- package/build/transaction/TransactionFactory.js.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/build/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.js +7 -0
- package/build/transaction/browser/BrowserSignerBase.js.map +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/build/transaction/browser/WalletNetworks.js +1 -0
- package/build/transaction/browser/WalletNetworks.js.map +1 -0
- package/build/transaction/browser/Web3Provider.d.ts +30 -3
- package/build/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/build/transaction/browser/Web3Provider.js +1 -0
- package/build/transaction/browser/Web3Provider.js.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.d.ts +11 -9
- package/build/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.js +27 -17
- package/build/transaction/browser/extensions/UnisatSigner.js.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.d.ts +10 -8
- package/build/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.js +25 -15
- package/build/transaction/browser/extensions/XverseSigner.js.map +1 -0
- package/build/transaction/browser/types/OPWallet.d.ts +12 -2
- package/build/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/build/transaction/browser/types/OPWallet.js +4 -0
- package/build/transaction/browser/types/OPWallet.js.map +1 -0
- package/build/transaction/browser/types/Unisat.d.ts +2 -1
- package/build/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/build/transaction/browser/types/Unisat.js +2 -0
- package/build/transaction/browser/types/Unisat.js.map +1 -0
- package/build/transaction/browser/types/Xverse.d.ts +1 -0
- package/build/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/build/transaction/browser/types/Xverse.js +1 -0
- package/build/transaction/browser/types/Xverse.js.map +1 -0
- package/build/transaction/builders/CancelTransaction.d.ts +31 -6
- package/build/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CancelTransaction.js +116 -33
- package/build/transaction/builders/CancelTransaction.js.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js +88 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +140 -13
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js +197 -20
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.d.ts +108 -8
- package/build/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.js +176 -39
- package/build/transaction/builders/CustomScriptTransaction.js.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.d.ts +120 -9
- package/build/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.js +194 -51
- package/build/transaction/builders/DeploymentTransaction.js.map +1 -0
- package/build/transaction/builders/FundingTransaction.d.ts +6 -4
- package/build/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/build/transaction/builders/FundingTransaction.js +50 -9
- package/build/transaction/builders/FundingTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransaction.d.ts +14 -5
- package/build/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransaction.js +18 -5
- package/build/transaction/builders/InteractionTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts +58 -7
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.js +95 -18
- package/build/transaction/builders/InteractionTransactionP2WDA.js.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.d.ts +126 -17
- package/build/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.js +201 -76
- package/build/transaction/builders/MultiSignTransaction.js.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +106 -18
- package/build/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.js +158 -40
- package/build/transaction/builders/SharedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/TransactionBuilder.d.ts +244 -20
- package/build/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/build/transaction/builders/TransactionBuilder.js +371 -152
- package/build/transaction/builders/TransactionBuilder.js.map +1 -0
- package/build/transaction/enums/TransactionType.d.ts +1 -0
- package/build/transaction/enums/TransactionType.d.ts.map +1 -0
- package/build/transaction/enums/TransactionType.js +1 -0
- package/build/transaction/enums/TransactionType.js.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts +3 -2
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +48 -5
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts +7 -5
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.d.ts +38 -15
- package/build/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.d.ts +3 -2
- package/build/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts +21 -8
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts +29 -3
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.js +2 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.js.map +1 -0
- package/build/transaction/interfaces/Tap.d.ts +4 -3
- package/build/transaction/interfaces/Tap.d.ts.map +1 -0
- package/build/transaction/interfaces/Tap.js +1 -0
- package/build/transaction/interfaces/Tap.js.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/build/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.d.ts +13 -4
- package/build/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.js +12 -3
- package/build/transaction/mineable/TimelockGenerator.js.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.d.ts +193 -12
- package/build/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.js +192 -8
- package/build/transaction/offline/OfflineTransactionManager.js.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.d.ts +56 -6
- package/build/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.js +111 -75
- package/build/transaction/offline/TransactionReconstructor.js.map +1 -0
- package/build/transaction/offline/TransactionSerializer.d.ts +54 -3
- package/build/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/build/transaction/offline/TransactionSerializer.js +206 -95
- package/build/transaction/offline/TransactionSerializer.js.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.d.ts +66 -7
- package/build/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.js +124 -60
- package/build/transaction/offline/TransactionStateCapture.js.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.d.ts +72 -1
- package/build/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.js +10 -1
- package/build/transaction/offline/interfaces/ISerializableState.js.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts +77 -1
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js +19 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js.map +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/build/transaction/psbt/PSBTTypes.js +1 -0
- package/build/transaction/psbt/PSBTTypes.js.map +1 -0
- package/build/transaction/shared/P2TR_MS.d.ts +11 -2
- package/build/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/build/transaction/shared/P2TR_MS.js +10 -0
- package/build/transaction/shared/P2TR_MS.js.map +1 -0
- package/build/transaction/shared/TweakedTransaction.d.ts +280 -38
- package/build/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/build/transaction/shared/TweakedTransaction.js +576 -114
- package/build/transaction/shared/TweakedTransaction.js.map +1 -0
- package/build/transaction/utils/WitnessUtils.d.ts +7 -1
- package/build/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/build/transaction/utils/WitnessUtils.js +17 -3
- package/build/transaction/utils/WitnessUtils.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/utils/BitcoinUtils.d.ts +19 -0
- package/build/utils/BitcoinUtils.d.ts.map +1 -0
- package/build/utils/BitcoinUtils.js +19 -0
- package/build/utils/BitcoinUtils.js.map +1 -0
- package/build/utils/BufferHelper.d.ts +2 -1
- package/build/utils/BufferHelper.d.ts.map +1 -0
- package/build/utils/BufferHelper.js +38 -32
- package/build/utils/BufferHelper.js.map +1 -0
- package/build/utils/StringToBuffer.d.ts +1 -0
- package/build/utils/StringToBuffer.d.ts.map +1 -0
- package/build/utils/StringToBuffer.js +1 -0
- package/build/utils/StringToBuffer.js.map +1 -0
- package/build/utils/lengths.d.ts +1 -0
- package/build/utils/lengths.d.ts.map +1 -0
- package/build/utils/lengths.js +1 -0
- package/build/utils/lengths.js.map +1 -0
- package/build/utils/types.d.ts +1 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -1
- package/build/utils/types.js.map +1 -0
- package/build/utxo/OPNetLimitedProvider.d.ts +39 -3
- package/build/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/build/utxo/OPNetLimitedProvider.js +43 -5
- package/build/utxo/OPNetLimitedProvider.js.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js.map +1 -0
- package/build/utxo/interfaces/IUTXO.d.ts +13 -7
- package/build/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/build/utxo/interfaces/IUTXO.js +1 -0
- package/build/utxo/interfaces/IUTXO.js.map +1 -0
- package/build/verification/TapscriptVerificator.d.ts +12 -10
- package/build/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/verification/TapscriptVerificator.js +28 -38
- package/build/verification/TapscriptVerificator.js.map +1 -0
- package/documentation/offline-transaction-signing.md +10 -8
- package/documentation/quantum-support/01-introduction.md +2 -2
- package/documentation/quantum-support/02-mnemonic-and-wallet.md +5 -3
- package/documentation/quantum-support/03-address-generation.md +6 -4
- package/documentation/quantum-support/04-message-signing.md +36 -43
- package/documentation/quantum-support/05-address-verification.md +13 -18
- package/documentation/quantum-support/README.md +1 -1
- package/documentation/transaction-building.md +9 -9
- package/eslint.config.js +0 -1
- package/package.json +16 -39
- package/src/_version.ts +1 -1
- package/src/abi/ABICoder.ts +131 -154
- package/src/abi/ABIDataTypes.ts +45 -0
- package/src/abi/AbiTypes.ts +183 -0
- package/src/abi/TupleUtils.ts +57 -0
- package/src/branded/Branded.ts +5 -0
- package/src/buffer/BinaryReader.ts +7 -7
- package/src/buffer/BinaryWriter.ts +29 -24
- package/src/bytecode/Compressor.ts +1 -1
- package/src/chain/ChainData.ts +36 -25
- package/src/consensus/ConsensusConfig.ts +1 -1
- package/src/consensus/IConsensusConfig.ts +0 -17
- package/src/consensus/metadata/RoswellConsensus.ts +1 -17
- package/src/crypto/crypto-browser.js +3 -4
- package/src/deterministic/AddressMap.ts +5 -1
- package/src/deterministic/AddressSet.ts +5 -1
- package/src/deterministic/CustomMap.ts +6 -2
- package/src/deterministic/DeterministicMap.ts +8 -4
- package/src/deterministic/DeterministicSet.ts +6 -2
- package/src/deterministic/ExtendedAddressMap.ts +9 -4
- package/src/deterministic/FastMap.ts +9 -5
- package/src/ecc/backend.ts +17 -0
- package/src/epoch/ChallengeSolution.ts +3 -3
- package/src/epoch/interfaces/IChallengeSolution.ts +13 -13
- package/src/epoch/validator/EpochValidator.ts +24 -43
- package/src/generators/AddressGenerator.ts +4 -7
- package/src/generators/Features.ts +3 -3
- package/src/generators/Generator.ts +42 -26
- package/src/generators/builders/CalldataGenerator.ts +26 -24
- package/src/generators/builders/CustomGenerator.ts +4 -4
- package/src/generators/builders/DeploymentGenerator.ts +25 -23
- package/src/generators/builders/HashCommitmentGenerator.ts +31 -31
- package/src/generators/builders/LegacyCalldataGenerator.ts +26 -24
- package/src/generators/builders/MultiSignGenerator.ts +12 -12
- package/src/generators/builders/P2WDAGenerator.ts +10 -10
- package/src/keypair/Address.ts +115 -72
- package/src/keypair/AddressVerificator.ts +14 -148
- package/src/keypair/EcKeyPair.ts +110 -111
- package/src/keypair/MessageSigner.ts +70 -150
- package/src/keypair/Wallet.ts +56 -241
- package/src/metadata/ContractBaseMetadata.ts +2 -2
- package/src/mnemonic/Mnemonic.ts +31 -222
- package/src/opnet.ts +15 -6
- package/src/p2wda/P2WDADetector.ts +23 -72
- package/src/polyfill/disposable.ts +29 -0
- package/src/signer/AddressRotation.ts +1 -1
- package/src/signer/IRotationSigner.ts +3 -3
- package/src/signer/ParallelSignerAdapter.ts +59 -0
- package/src/signer/SignerUtils.ts +4 -4
- package/src/signer/TweakedSigner.ts +26 -14
- package/src/transaction/ContractAddress.ts +3 -7
- package/src/transaction/TransactionFactory.ts +38 -53
- package/src/transaction/browser/BrowserSignerBase.ts +12 -6
- package/src/transaction/browser/Web3Provider.ts +3 -3
- package/src/transaction/browser/extensions/UnisatSigner.ts +52 -48
- package/src/transaction/browser/extensions/XverseSigner.ts +55 -38
- package/src/transaction/browser/types/OPWallet.ts +2 -2
- package/src/transaction/browser/types/Unisat.ts +1 -1
- package/src/transaction/builders/CancelTransaction.ts +59 -24
- package/src/transaction/builders/ChallengeSolutionTransaction.ts +3 -3
- package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +39 -34
- package/src/transaction/builders/CustomScriptTransaction.ts +79 -56
- package/src/transaction/builders/DeploymentTransaction.ts +82 -63
- package/src/transaction/builders/FundingTransaction.ts +53 -12
- package/src/transaction/builders/InteractionTransaction.ts +10 -10
- package/src/transaction/builders/InteractionTransactionP2WDA.ts +38 -40
- package/src/transaction/builders/MultiSignTransaction.ts +68 -61
- package/src/transaction/builders/SharedInteractionTransaction.ts +81 -57
- package/src/transaction/builders/TransactionBuilder.ts +159 -255
- package/src/transaction/interfaces/ICancelTransactionParameters.ts +2 -2
- package/src/transaction/interfaces/IConsolidatedTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ICustomTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ITransactionParameters.ts +28 -15
- package/src/transaction/interfaces/ITransactionResponses.ts +2 -2
- package/src/transaction/interfaces/ITweakedTransactionData.ts +17 -8
- package/src/transaction/interfaces/IWeb3ProviderTypes.ts +3 -3
- package/src/transaction/interfaces/Tap.ts +3 -3
- package/src/transaction/mineable/IP2WSHAddress.ts +1 -1
- package/src/transaction/mineable/TimelockGenerator.ts +19 -12
- package/src/transaction/offline/OfflineTransactionManager.ts +22 -23
- package/src/transaction/offline/TransactionReconstructor.ts +83 -91
- package/src/transaction/offline/TransactionSerializer.ts +151 -101
- package/src/transaction/offline/TransactionStateCapture.ts +83 -79
- package/src/transaction/offline/interfaces/ISerializableState.ts +1 -1
- package/src/transaction/offline/interfaces/ITypeSpecificData.ts +1 -1
- package/src/transaction/shared/P2TR_MS.ts +4 -4
- package/src/transaction/shared/TweakedTransaction.ts +318 -125
- package/src/transaction/utils/WitnessUtils.ts +18 -9
- package/src/utils/BufferHelper.ts +39 -37
- package/src/utxo/OPNetLimitedProvider.ts +9 -9
- package/src/utxo/interfaces/IUTXO.ts +7 -7
- package/src/verification/TapscriptVerificator.ts +73 -86
- package/test/add-refund-output.test.ts +535 -0
- package/test/address-rotation.test.ts +24 -24
- package/test/address.test.ts +12 -12
- package/test/addressmap.test.ts +30 -30
- package/test/binary-reader-writer.test.ts +8 -8
- package/test/browser/offline-transaction.test.ts +2206 -0
- package/test/browser/parallel-signing.test.ts +316 -0
- package/test/browser/setup.ts +11 -0
- package/test/browser/transaction-signing.test.ts +416 -0
- package/test/buffer-helper.test.ts +287 -0
- package/test/derivePath.test.ts +4 -3
- package/test/disposable.test.ts +279 -0
- package/test/fastmap-setall.test.ts +1 -1
- package/test/fastmap.test.ts +3 -3
- package/test/messagesigner-mldsa.test.ts +3 -3
- package/test/messagesigner-schnorr.test.ts +9 -9
- package/test/offline-transaction.test.ts +461 -288
- package/test/old/FastBigIntMap.ts +3 -3
- package/test/oldfastmap.test.ts +6 -6
- package/test/transaction-builders.test.ts +482 -0
- package/tsconfig.base.json +34 -18
- package/tsconfig.browser.json +15 -0
- package/tsconfig.json +3 -8
- package/vite.config.browser.ts +4 -5
- package/vitest.config.browser.ts +68 -0
- package/vitest.config.ts +1 -1
- package/browser/valibot.js +0 -4948
- package/tsconfig.webpack.json +0 -18
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Logger } from '@btc-vision/logger';
|
|
2
|
+
import type { Bytes32, FinalScriptsFunc, Script, XOnlyPublicKey } from '@btc-vision/bitcoin';
|
|
2
3
|
import {
|
|
3
4
|
address as bitAddress,
|
|
5
|
+
applySignaturesToPsbt,
|
|
4
6
|
crypto as bitCrypto,
|
|
7
|
+
fromHex,
|
|
5
8
|
getFinalScripts,
|
|
6
9
|
isP2A,
|
|
7
10
|
isP2MS,
|
|
@@ -12,34 +15,39 @@ import {
|
|
|
12
15
|
isP2WPKH,
|
|
13
16
|
isP2WSHScript,
|
|
14
17
|
isUnknownSegwitVersion,
|
|
15
|
-
Network,
|
|
18
|
+
type Network,
|
|
16
19
|
opcodes,
|
|
17
|
-
P2TRPayment,
|
|
20
|
+
type P2TRPayment,
|
|
21
|
+
type ParallelSigningResult,
|
|
18
22
|
payments,
|
|
19
23
|
PaymentType,
|
|
24
|
+
prepareSigningTasks,
|
|
20
25
|
Psbt,
|
|
21
|
-
PsbtInput,
|
|
22
|
-
PsbtInputExtended,
|
|
26
|
+
type PsbtInput,
|
|
27
|
+
type PsbtInputExtended,
|
|
23
28
|
script,
|
|
24
|
-
Signer,
|
|
29
|
+
type Signer,
|
|
30
|
+
type SigningPoolLike,
|
|
25
31
|
toXOnly,
|
|
26
32
|
Transaction,
|
|
27
33
|
varuint,
|
|
34
|
+
type WorkerPoolConfig,
|
|
35
|
+
WorkerSigningPool,
|
|
28
36
|
} from '@btc-vision/bitcoin';
|
|
29
37
|
|
|
30
|
-
import { TweakedSigner, TweakSettings } from '../../signer/TweakedSigner.js';
|
|
31
|
-
import {
|
|
32
|
-
import { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
33
|
-
import { TapLeafScript } from '../interfaces/Tap.js';
|
|
38
|
+
import { isUniversalSigner, TweakedSigner, type TweakSettings, } from '../../signer/TweakedSigner.js';
|
|
39
|
+
import { type UniversalSigner } from '@btc-vision/ecpair';
|
|
40
|
+
import type { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
41
|
+
import type { TapLeafScript } from '../interfaces/Tap.js';
|
|
34
42
|
import { UnisatSigner } from '../browser/extensions/UnisatSigner.js';
|
|
35
43
|
import { canSignNonTaprootInput, isTaprootInput, pubkeyInScript, } from '../../signer/SignerUtils.js';
|
|
36
44
|
import { witnessStackToScriptWitness } from '../utils/WitnessUtils.js';
|
|
37
|
-
import { Buffer } from 'buffer';
|
|
38
45
|
import { P2WDADetector } from '../../p2wda/P2WDADetector.js';
|
|
39
|
-
import { QuantumBIP32Interface } from '@btc-vision/bip32';
|
|
46
|
+
import type { QuantumBIP32Interface } from '@btc-vision/bip32';
|
|
40
47
|
import { MessageSigner } from '../../keypair/MessageSigner.js';
|
|
41
|
-
import { RotationSigner, SignerMap } from '../../signer/AddressRotation.js';
|
|
42
|
-
import { ITweakedTransactionData, SupportedTransactionVersion, } from '../interfaces/ITweakedTransactionData.js';
|
|
48
|
+
import { type RotationSigner, type SignerMap } from '../../signer/AddressRotation.js';
|
|
49
|
+
import type { ITweakedTransactionData, SupportedTransactionVersion, } from '../interfaces/ITweakedTransactionData.js';
|
|
50
|
+
import { toTweakedParallelKeyPair } from '../../signer/ParallelSignerAdapter.js';
|
|
43
51
|
|
|
44
52
|
/**
|
|
45
53
|
* The transaction sequence
|
|
@@ -57,19 +65,19 @@ export enum CSVModes {
|
|
|
57
65
|
/**
|
|
58
66
|
* @description PSBT Transaction processor.
|
|
59
67
|
* */
|
|
60
|
-
export abstract class TweakedTransaction extends Logger {
|
|
61
|
-
public readonly logColor: string = '#00ffe1';
|
|
68
|
+
export abstract class TweakedTransaction extends Logger implements Disposable {
|
|
69
|
+
public override readonly logColor: string = '#00ffe1';
|
|
62
70
|
public finalized: boolean = false;
|
|
63
71
|
|
|
64
72
|
/**
|
|
65
73
|
* @description Was the transaction signed?
|
|
66
74
|
*/
|
|
67
|
-
protected signer: Signer |
|
|
75
|
+
protected signer: Signer | UniversalSigner | UnisatSigner;
|
|
68
76
|
|
|
69
77
|
/**
|
|
70
78
|
* @description Tweaked signer
|
|
71
79
|
*/
|
|
72
|
-
protected tweakedSigner?:
|
|
80
|
+
protected tweakedSigner?: UniversalSigner;
|
|
73
81
|
|
|
74
82
|
/**
|
|
75
83
|
* @description The network of the transaction
|
|
@@ -124,7 +132,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
124
132
|
* Add a non-witness utxo to the transaction
|
|
125
133
|
* @protected
|
|
126
134
|
*/
|
|
127
|
-
protected nonWitnessUtxo?:
|
|
135
|
+
protected nonWitnessUtxo?: Uint8Array;
|
|
128
136
|
|
|
129
137
|
/**
|
|
130
138
|
* Is the transaction being generated inside a browser?
|
|
@@ -142,12 +150,12 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
142
150
|
protected regenerated: boolean = false;
|
|
143
151
|
protected ignoreSignatureErrors: boolean = false;
|
|
144
152
|
protected noSignatures: boolean = false;
|
|
145
|
-
protected unlockScript:
|
|
153
|
+
protected unlockScript: Uint8Array[] | undefined;
|
|
146
154
|
|
|
147
155
|
protected txVersion: SupportedTransactionVersion = 2;
|
|
148
156
|
|
|
149
157
|
protected readonly _mldsaSigner: QuantumBIP32Interface | null = null;
|
|
150
|
-
protected readonly _hashedPublicKey:
|
|
158
|
+
protected readonly _hashedPublicKey: Uint8Array | null = null;
|
|
151
159
|
|
|
152
160
|
/**
|
|
153
161
|
* Whether address rotation mode is enabled.
|
|
@@ -169,7 +177,13 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
169
177
|
/**
|
|
170
178
|
* Cache of tweaked signers per input for address rotation mode.
|
|
171
179
|
*/
|
|
172
|
-
protected readonly tweakedSignerCache: Map<number,
|
|
180
|
+
protected readonly tweakedSignerCache: Map<number, UniversalSigner | undefined> = new Map();
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Parallel signing configuration using worker threads.
|
|
184
|
+
* When set, key-path taproot inputs are signed in parallel via workers.
|
|
185
|
+
*/
|
|
186
|
+
protected parallelSigningConfig?: SigningPoolLike | WorkerPoolConfig;
|
|
173
187
|
|
|
174
188
|
protected constructor(data: ITweakedTransactionData) {
|
|
175
189
|
super();
|
|
@@ -178,8 +192,12 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
178
192
|
this.network = data.network;
|
|
179
193
|
|
|
180
194
|
this.noSignatures = data.noSignatures || false;
|
|
181
|
-
|
|
182
|
-
|
|
195
|
+
if (data.nonWitnessUtxo !== undefined) {
|
|
196
|
+
this.nonWitnessUtxo = data.nonWitnessUtxo;
|
|
197
|
+
}
|
|
198
|
+
if (data.unlockScript !== undefined) {
|
|
199
|
+
this.unlockScript = data.unlockScript;
|
|
200
|
+
}
|
|
183
201
|
|
|
184
202
|
this.isBrowser = typeof window !== 'undefined';
|
|
185
203
|
|
|
@@ -197,6 +215,10 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
197
215
|
this.addressRotationEnabled = true;
|
|
198
216
|
this.signerMap = data.addressRotation.signerMap;
|
|
199
217
|
}
|
|
218
|
+
|
|
219
|
+
if (data.parallelSigning) {
|
|
220
|
+
this.parallelSigningConfig = data.parallelSigning;
|
|
221
|
+
}
|
|
200
222
|
}
|
|
201
223
|
|
|
202
224
|
/**
|
|
@@ -215,7 +237,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
215
237
|
* Get the hashed public key
|
|
216
238
|
* @protected
|
|
217
239
|
*/
|
|
218
|
-
protected get hashedPublicKey():
|
|
240
|
+
protected get hashedPublicKey(): Uint8Array {
|
|
219
241
|
if (!this._hashedPublicKey) {
|
|
220
242
|
throw new Error('Hashed public key is not set');
|
|
221
243
|
}
|
|
@@ -223,15 +245,23 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
223
245
|
return this._hashedPublicKey;
|
|
224
246
|
}
|
|
225
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Whether parallel signing can be used for this transaction.
|
|
250
|
+
* Requires parallelSigningConfig and excludes browser, address rotation, and no-signature modes.
|
|
251
|
+
*/
|
|
252
|
+
protected get canUseParallelSigning(): boolean {
|
|
253
|
+
return !!this.parallelSigningConfig && !this.addressRotationEnabled && !this.noSignatures;
|
|
254
|
+
}
|
|
255
|
+
|
|
226
256
|
/**
|
|
227
257
|
* Read witnesses
|
|
228
258
|
* @protected
|
|
229
259
|
*/
|
|
230
|
-
public static readScriptWitnessToWitnessStack(buffer:
|
|
260
|
+
public static readScriptWitnessToWitnessStack(buffer: Uint8Array): Uint8Array[] {
|
|
231
261
|
let offset = 0;
|
|
232
262
|
|
|
233
|
-
function readSlice(n: number):
|
|
234
|
-
const slice =
|
|
263
|
+
function readSlice(n: number): Uint8Array {
|
|
264
|
+
const slice = new Uint8Array(buffer.subarray(offset, offset + n));
|
|
235
265
|
offset += n;
|
|
236
266
|
return slice;
|
|
237
267
|
}
|
|
@@ -242,12 +272,12 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
242
272
|
return varint.numberValue || 0;
|
|
243
273
|
}
|
|
244
274
|
|
|
245
|
-
function readVarSlice():
|
|
275
|
+
function readVarSlice(): Uint8Array {
|
|
246
276
|
const len = readVarInt();
|
|
247
277
|
return readSlice(len);
|
|
248
278
|
}
|
|
249
279
|
|
|
250
|
-
function readVector():
|
|
280
|
+
function readVector(): Uint8Array[] {
|
|
251
281
|
const count = readVarInt();
|
|
252
282
|
const vector = [];
|
|
253
283
|
for (let i = 0; i < count; i++) {
|
|
@@ -308,7 +338,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
308
338
|
transaction: Psbt,
|
|
309
339
|
input: PsbtInput,
|
|
310
340
|
i: number,
|
|
311
|
-
signer: Signer |
|
|
341
|
+
signer: Signer | UniversalSigner,
|
|
312
342
|
sighashTypes: number[],
|
|
313
343
|
): void {
|
|
314
344
|
if (sighashTypes && sighashTypes[0]) input.sighashType = sighashTypes[0];
|
|
@@ -335,6 +365,19 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
335
365
|
return signHash || 0;
|
|
336
366
|
}
|
|
337
367
|
|
|
368
|
+
public [Symbol.dispose](): void {
|
|
369
|
+
this.inputs.length = 0;
|
|
370
|
+
this.scriptData = null;
|
|
371
|
+
this.tapData = null;
|
|
372
|
+
this.tapLeafScript = null;
|
|
373
|
+
delete this.tweakedSigner;
|
|
374
|
+
this.csvInputIndices.clear();
|
|
375
|
+
this.anchorInputIndices.clear();
|
|
376
|
+
this.inputSignerMap.clear();
|
|
377
|
+
this.tweakedSignerCache.clear();
|
|
378
|
+
delete this.parallelSigningConfig;
|
|
379
|
+
}
|
|
380
|
+
|
|
338
381
|
/**
|
|
339
382
|
* Check if address rotation mode is enabled.
|
|
340
383
|
*/
|
|
@@ -393,7 +436,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
393
436
|
continue;
|
|
394
437
|
}
|
|
395
438
|
|
|
396
|
-
input.sequence = TransactionSequence.FINAL;
|
|
439
|
+
(input as { sequence: number }).sequence = TransactionSequence.FINAL;
|
|
397
440
|
}
|
|
398
441
|
}
|
|
399
442
|
|
|
@@ -403,7 +446,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
403
446
|
*
|
|
404
447
|
* @returns {Buffer | undefined} The tweaked hash
|
|
405
448
|
*/
|
|
406
|
-
public getTweakerHash():
|
|
449
|
+
public getTweakerHash(): Uint8Array | undefined {
|
|
407
450
|
return this.tapData?.hash;
|
|
408
451
|
}
|
|
409
452
|
|
|
@@ -494,9 +537,9 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
494
537
|
* Used for taproot inputs in address rotation mode.
|
|
495
538
|
* @param inputIndex - The index of the input
|
|
496
539
|
*/
|
|
497
|
-
protected internalPubKeyToXOnlyForInput(inputIndex: number):
|
|
540
|
+
protected internalPubKeyToXOnlyForInput(inputIndex: number): XOnlyPublicKey {
|
|
498
541
|
const signer = this.getSignerForInput(inputIndex);
|
|
499
|
-
return toXOnly(
|
|
542
|
+
return toXOnly(signer.publicKey);
|
|
500
543
|
}
|
|
501
544
|
|
|
502
545
|
/**
|
|
@@ -508,7 +551,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
508
551
|
protected getTweakedSignerForInput(
|
|
509
552
|
inputIndex: number,
|
|
510
553
|
useTweakedHash: boolean = false,
|
|
511
|
-
):
|
|
554
|
+
): UniversalSigner | undefined {
|
|
512
555
|
if (!this.addressRotationEnabled) {
|
|
513
556
|
// Fall back to original behavior
|
|
514
557
|
if (useTweakedHash) {
|
|
@@ -555,9 +598,9 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
555
598
|
/**
|
|
556
599
|
* Returns the signer key.
|
|
557
600
|
* @protected
|
|
558
|
-
* @returns {Signer |
|
|
601
|
+
* @returns {Signer | UniversalSigner}
|
|
559
602
|
*/
|
|
560
|
-
protected getSignerKey(): Signer |
|
|
603
|
+
protected getSignerKey(): Signer | UniversalSigner {
|
|
561
604
|
return this.signer;
|
|
562
605
|
}
|
|
563
606
|
|
|
@@ -575,7 +618,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
575
618
|
transaction: Psbt,
|
|
576
619
|
input: PsbtInput,
|
|
577
620
|
i: number,
|
|
578
|
-
signer: Signer |
|
|
621
|
+
signer: Signer | UniversalSigner,
|
|
579
622
|
reverse: boolean = false,
|
|
580
623
|
errored: boolean = false,
|
|
581
624
|
): Promise<void> {
|
|
@@ -656,49 +699,114 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
656
699
|
}
|
|
657
700
|
|
|
658
701
|
protected async signInputsNonWalletBased(transaction: Psbt): Promise<void> {
|
|
659
|
-
// non web based signing.
|
|
660
|
-
const txs: PsbtInput[] = transaction.data.inputs;
|
|
661
|
-
|
|
662
|
-
const batchSize: number = 20;
|
|
663
|
-
const batches = this.splitArray(txs, batchSize);
|
|
664
|
-
|
|
665
702
|
if (!this.noSignatures) {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
const input = batch[j];
|
|
674
|
-
|
|
675
|
-
try {
|
|
676
|
-
// Use per-input signer in address rotation mode
|
|
677
|
-
const inputSigner = this.getSignerForInput(index);
|
|
678
|
-
promises.push(this.signInput(transaction, input, index, inputSigner));
|
|
679
|
-
} catch (e) {
|
|
680
|
-
this.log(`Failed to sign input ${index}: ${(e as Error).stack}`);
|
|
703
|
+
if (this.canUseParallelSigning && isUniversalSigner(this.signer)) {
|
|
704
|
+
let parallelSignedIndices = new Set<number>();
|
|
705
|
+
|
|
706
|
+
try {
|
|
707
|
+
const result = await this.signKeyPathInputsParallel(transaction);
|
|
708
|
+
if (result.success) {
|
|
709
|
+
parallelSignedIndices = new Set(result.signatures.keys());
|
|
681
710
|
}
|
|
711
|
+
} catch (e) {
|
|
712
|
+
this.error(
|
|
713
|
+
`Parallel signing failed, falling back to sequential: ${(e as Error).message}`,
|
|
714
|
+
);
|
|
682
715
|
}
|
|
683
716
|
|
|
684
|
-
|
|
717
|
+
// Sign remaining inputs (script-path, non-taproot, etc.) sequentially
|
|
718
|
+
await this.signRemainingInputsSequential(transaction, parallelSignedIndices);
|
|
719
|
+
} else {
|
|
720
|
+
await this.signInputsSequential(transaction);
|
|
685
721
|
}
|
|
686
722
|
}
|
|
687
723
|
|
|
688
724
|
for (let i = 0; i < transaction.data.inputs.length; i++) {
|
|
689
|
-
transaction.finalizeInput(i, this.customFinalizerP2SH.bind(this));
|
|
725
|
+
transaction.finalizeInput(i, this.customFinalizerP2SH.bind(this) as FinalScriptsFunc);
|
|
690
726
|
}
|
|
691
727
|
|
|
692
728
|
this.finalized = true;
|
|
693
729
|
}
|
|
694
730
|
|
|
731
|
+
/**
|
|
732
|
+
* Signs all inputs sequentially in batches of 20.
|
|
733
|
+
* This is the original signing logic, used as fallback when parallel signing is unavailable.
|
|
734
|
+
*/
|
|
735
|
+
protected async signInputsSequential(transaction: Psbt): Promise<void> {
|
|
736
|
+
const txs: PsbtInput[] = transaction.data.inputs;
|
|
737
|
+
|
|
738
|
+
const batchSize: number = 20;
|
|
739
|
+
const batches = this.splitArray(txs, batchSize);
|
|
740
|
+
|
|
741
|
+
for (let i = 0; i < batches.length; i++) {
|
|
742
|
+
const batch = batches[i] as PsbtInput[];
|
|
743
|
+
const promises: Promise<void>[] = [];
|
|
744
|
+
const offset = i * batchSize;
|
|
745
|
+
|
|
746
|
+
for (let j = 0; j < batch.length; j++) {
|
|
747
|
+
const index = offset + j;
|
|
748
|
+
const input = batch[j] as PsbtInput;
|
|
749
|
+
|
|
750
|
+
try {
|
|
751
|
+
// Use per-input signer in address rotation mode
|
|
752
|
+
const inputSigner = this.getSignerForInput(index);
|
|
753
|
+
promises.push(this.signInput(transaction, input, index, inputSigner));
|
|
754
|
+
} catch (e) {
|
|
755
|
+
this.log(`Failed to sign input ${index}: ${(e as Error).stack}`);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
await Promise.all(promises);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Signs inputs that were not handled by parallel signing.
|
|
765
|
+
* After parallel key-path signing, script-path taproot inputs, non-taproot inputs,
|
|
766
|
+
* and any inputs that failed parallel signing need sequential signing.
|
|
767
|
+
*/
|
|
768
|
+
protected async signRemainingInputsSequential(
|
|
769
|
+
transaction: Psbt,
|
|
770
|
+
signedIndices: Set<number>,
|
|
771
|
+
): Promise<void> {
|
|
772
|
+
const txs: PsbtInput[] = transaction.data.inputs;
|
|
773
|
+
|
|
774
|
+
const unsignedIndices: number[] = [];
|
|
775
|
+
for (let i = 0; i < txs.length; i++) {
|
|
776
|
+
if (!signedIndices.has(i)) {
|
|
777
|
+
unsignedIndices.push(i);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
if (unsignedIndices.length === 0) return;
|
|
782
|
+
|
|
783
|
+
const batchSize = 20;
|
|
784
|
+
const batches = this.splitArray(unsignedIndices, batchSize);
|
|
785
|
+
|
|
786
|
+
for (const batch of batches) {
|
|
787
|
+
const promises: Promise<void>[] = [];
|
|
788
|
+
|
|
789
|
+
for (const index of batch) {
|
|
790
|
+
const input = txs[index] as PsbtInput;
|
|
791
|
+
try {
|
|
792
|
+
const inputSigner = this.getSignerForInput(index);
|
|
793
|
+
promises.push(this.signInput(transaction, input, index, inputSigner));
|
|
794
|
+
} catch (e) {
|
|
795
|
+
this.log(`Failed to sign input ${index}: ${(e as Error).stack}`);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
await Promise.all(promises);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
695
803
|
/**
|
|
696
804
|
* Converts the public key to x-only.
|
|
697
805
|
* @protected
|
|
698
806
|
* @returns {Buffer}
|
|
699
807
|
*/
|
|
700
|
-
protected internalPubKeyToXOnly():
|
|
701
|
-
return toXOnly(
|
|
808
|
+
protected internalPubKeyToXOnly(): XOnlyPublicKey {
|
|
809
|
+
return toXOnly(this.signer.publicKey);
|
|
702
810
|
}
|
|
703
811
|
|
|
704
812
|
/**
|
|
@@ -718,40 +826,115 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
718
826
|
if (this.tweakedSigner) return;
|
|
719
827
|
|
|
720
828
|
// tweaked p2tr signer.
|
|
721
|
-
|
|
829
|
+
const tweaked = this.getTweakedSigner(true);
|
|
830
|
+
if (tweaked !== undefined) {
|
|
831
|
+
this.tweakedSigner = tweaked;
|
|
832
|
+
}
|
|
722
833
|
}
|
|
723
834
|
|
|
724
835
|
/**
|
|
725
836
|
* Get the tweaked signer
|
|
726
837
|
* @private
|
|
727
|
-
* @returns {
|
|
838
|
+
* @returns {UniversalSigner} The tweaked signer
|
|
728
839
|
*/
|
|
729
840
|
protected getTweakedSigner(
|
|
730
841
|
useTweakedHash: boolean = false,
|
|
731
|
-
signer: Signer |
|
|
732
|
-
):
|
|
842
|
+
signer: Signer | UniversalSigner = this.signer,
|
|
843
|
+
): UniversalSigner | undefined {
|
|
733
844
|
const settings: TweakSettings = {
|
|
734
845
|
network: this.network,
|
|
735
846
|
};
|
|
736
847
|
|
|
737
848
|
if (useTweakedHash) {
|
|
738
|
-
|
|
849
|
+
const tweakHash = this.getTweakerHash() as Bytes32 | undefined;
|
|
850
|
+
if (tweakHash !== undefined) {
|
|
851
|
+
settings.tweakHash = tweakHash;
|
|
852
|
+
}
|
|
739
853
|
}
|
|
740
854
|
|
|
741
|
-
if (!(
|
|
855
|
+
if (!isUniversalSigner(signer)) {
|
|
742
856
|
return;
|
|
743
857
|
}
|
|
744
858
|
|
|
745
|
-
return TweakedSigner.tweakSigner(signer
|
|
859
|
+
return TweakedSigner.tweakSigner(signer, settings);
|
|
746
860
|
}
|
|
747
861
|
|
|
748
|
-
|
|
862
|
+
/**
|
|
863
|
+
* Signs key-path taproot inputs in parallel using worker threads.
|
|
864
|
+
* @param transaction - The PSBT to sign
|
|
865
|
+
* @param excludeIndices - Input indices to skip (e.g., script-path inputs already signed)
|
|
866
|
+
* @returns The parallel signing result
|
|
867
|
+
*/
|
|
868
|
+
protected async signKeyPathInputsParallel(
|
|
869
|
+
transaction: Psbt,
|
|
870
|
+
excludeIndices?: Set<number>,
|
|
871
|
+
): Promise<ParallelSigningResult> {
|
|
872
|
+
const signer = this.signer as UniversalSigner;
|
|
873
|
+
|
|
874
|
+
// Get the tweaked signer for key-path
|
|
875
|
+
const tweakedSigner = this.getTweakedSigner(true);
|
|
876
|
+
if (!tweakedSigner) {
|
|
877
|
+
throw new Error('Cannot create tweaked signer for parallel signing');
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// Create hybrid adapter: untweaked pubkey (for PSBT matching) + tweaked privkey
|
|
881
|
+
const adapter = toTweakedParallelKeyPair(signer, tweakedSigner);
|
|
882
|
+
|
|
883
|
+
// Prepare tasks from PSBT
|
|
884
|
+
const allTasks = prepareSigningTasks(transaction, adapter);
|
|
885
|
+
|
|
886
|
+
// Filter out excluded indices
|
|
887
|
+
const tasks = excludeIndices
|
|
888
|
+
? allTasks.filter((t) => !excludeIndices.has(t.inputIndex))
|
|
889
|
+
: allTasks;
|
|
890
|
+
|
|
891
|
+
if (tasks.length === 0) {
|
|
892
|
+
return {
|
|
893
|
+
success: true,
|
|
894
|
+
signatures: new Map(),
|
|
895
|
+
errors: new Map(),
|
|
896
|
+
durationMs: 0,
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// Get or create pool
|
|
901
|
+
let pool: SigningPoolLike;
|
|
902
|
+
let shouldShutdown = false;
|
|
903
|
+
|
|
904
|
+
if (this.parallelSigningConfig && 'signBatch' in this.parallelSigningConfig) {
|
|
905
|
+
pool = this.parallelSigningConfig;
|
|
906
|
+
} else {
|
|
907
|
+
pool = WorkerSigningPool.getInstance(this.parallelSigningConfig);
|
|
908
|
+
if (!pool.isPreservingWorkers) shouldShutdown = true;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
try {
|
|
912
|
+
await pool.initialize();
|
|
913
|
+
const result = await pool.signBatch(tasks, adapter);
|
|
914
|
+
|
|
915
|
+
if (result.success) {
|
|
916
|
+
applySignaturesToPsbt(transaction, result, adapter);
|
|
917
|
+
} else {
|
|
918
|
+
const errorEntries = [...result.errors.entries()];
|
|
919
|
+
const errorMsg = errorEntries
|
|
920
|
+
.map(([idx, err]) => `Input ${idx}: ${err}`)
|
|
921
|
+
.join(', ');
|
|
922
|
+
this.error(`Parallel signing had errors: ${errorMsg}`);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
return result;
|
|
926
|
+
} finally {
|
|
927
|
+
if (shouldShutdown) await pool.shutdown();
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
protected generateP2SHRedeemScript(customWitnessScript: Uint8Array): Uint8Array | undefined {
|
|
749
932
|
const p2wsh = payments.p2wsh({
|
|
750
|
-
redeem: { output: customWitnessScript },
|
|
933
|
+
redeem: { output: customWitnessScript as Script },
|
|
751
934
|
network: this.network,
|
|
752
935
|
});
|
|
753
936
|
|
|
754
|
-
//
|
|
937
|
+
// Wrap the P2WSH inside a P2SH (Pay-to-Script-Hash)
|
|
755
938
|
const p2sh = payments.p2sh({
|
|
756
939
|
redeem: p2wsh,
|
|
757
940
|
network: this.network,
|
|
@@ -762,12 +945,12 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
762
945
|
|
|
763
946
|
protected generateP2SHRedeemScriptLegacy(inputAddr: string):
|
|
764
947
|
| {
|
|
765
|
-
redeemScript:
|
|
766
|
-
outputScript:
|
|
948
|
+
redeemScript: Uint8Array;
|
|
949
|
+
outputScript: Uint8Array;
|
|
767
950
|
}
|
|
768
951
|
| undefined {
|
|
769
952
|
const pubKeyHash = bitCrypto.hash160(this.signer.publicKey);
|
|
770
|
-
const redeemScript:
|
|
953
|
+
const redeemScript: Script = script.compile([
|
|
771
954
|
opcodes.OP_DUP,
|
|
772
955
|
opcodes.OP_HASH160,
|
|
773
956
|
pubKeyHash,
|
|
@@ -787,7 +970,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
787
970
|
network: this.network,
|
|
788
971
|
});
|
|
789
972
|
|
|
790
|
-
//
|
|
973
|
+
// Wrap the P2WSH in a P2SH
|
|
791
974
|
const p2sh = payments.p2sh({
|
|
792
975
|
redeem: p2wsh, // The P2WSH is wrapped inside the P2SH
|
|
793
976
|
network: this.network,
|
|
@@ -809,8 +992,8 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
809
992
|
inputIndex?: number,
|
|
810
993
|
):
|
|
811
994
|
| {
|
|
812
|
-
redeemScript:
|
|
813
|
-
outputScript:
|
|
995
|
+
redeemScript: Uint8Array;
|
|
996
|
+
outputScript: Uint8Array;
|
|
814
997
|
}
|
|
815
998
|
| undefined {
|
|
816
999
|
// Use per-input signer in address rotation mode
|
|
@@ -819,9 +1002,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
819
1002
|
? this.getSignerForInput(inputIndex)
|
|
820
1003
|
: this.signer;
|
|
821
1004
|
|
|
822
|
-
const pubkey =
|
|
823
|
-
? signer.publicKey
|
|
824
|
-
: Buffer.from(signer.publicKey, 'hex');
|
|
1005
|
+
const pubkey = signer.publicKey;
|
|
825
1006
|
|
|
826
1007
|
const w = payments.p2wpkh({
|
|
827
1008
|
pubkey: pubkey,
|
|
@@ -862,26 +1043,27 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
862
1043
|
i: number,
|
|
863
1044
|
_extra: boolean = false,
|
|
864
1045
|
): PsbtInputExtended {
|
|
865
|
-
const scriptPub =
|
|
1046
|
+
const scriptPub = fromHex(utxo.scriptPubKey.hex);
|
|
866
1047
|
|
|
867
1048
|
const input: PsbtInputExtended = {
|
|
868
1049
|
hash: utxo.transactionId,
|
|
869
1050
|
index: utxo.outputIndex,
|
|
870
1051
|
sequence: this.sequence,
|
|
871
1052
|
witnessUtxo: {
|
|
872
|
-
value:
|
|
1053
|
+
value: utxo.value,
|
|
873
1054
|
script: scriptPub,
|
|
874
1055
|
},
|
|
875
|
-
};
|
|
1056
|
+
} as PsbtInputExtended;
|
|
876
1057
|
|
|
877
1058
|
// Handle P2PKH (Legacy)
|
|
878
1059
|
if (isP2PKH(scriptPub)) {
|
|
879
1060
|
// Legacy input requires nonWitnessUtxo
|
|
880
1061
|
if (utxo.nonWitnessUtxo) {
|
|
881
1062
|
//delete input.witnessUtxo;
|
|
882
|
-
input.nonWitnessUtxo =
|
|
883
|
-
|
|
884
|
-
|
|
1063
|
+
input.nonWitnessUtxo =
|
|
1064
|
+
utxo.nonWitnessUtxo instanceof Uint8Array
|
|
1065
|
+
? utxo.nonWitnessUtxo
|
|
1066
|
+
: fromHex(utxo.nonWitnessUtxo);
|
|
885
1067
|
} else {
|
|
886
1068
|
throw new Error('Missing nonWitnessUtxo for P2PKH UTXO');
|
|
887
1069
|
}
|
|
@@ -901,12 +1083,13 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
901
1083
|
// Handle P2SH (Can be legacy or wrapping segwit)
|
|
902
1084
|
else if (isP2SHScript(scriptPub)) {
|
|
903
1085
|
// Redeem script is required for P2SH
|
|
904
|
-
let redeemScriptBuf:
|
|
1086
|
+
let redeemScriptBuf: Uint8Array | undefined;
|
|
905
1087
|
|
|
906
1088
|
if (utxo.redeemScript) {
|
|
907
|
-
redeemScriptBuf =
|
|
908
|
-
|
|
909
|
-
|
|
1089
|
+
redeemScriptBuf =
|
|
1090
|
+
utxo.redeemScript instanceof Uint8Array
|
|
1091
|
+
? utxo.redeemScript
|
|
1092
|
+
: fromHex(utxo.redeemScript);
|
|
910
1093
|
} else {
|
|
911
1094
|
// Attempt to generate a redeem script if missing
|
|
912
1095
|
if (!utxo.scriptPubKey.address) {
|
|
@@ -929,7 +1112,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
929
1112
|
input.redeemScript = redeemScriptBuf;
|
|
930
1113
|
|
|
931
1114
|
// Check if redeemScript is wrapping segwit (like P2SH-P2WPKH or P2SH-P2WSH)
|
|
932
|
-
const payment = payments.p2sh({ redeem: { output: input.redeemScript } });
|
|
1115
|
+
const payment = payments.p2sh({ redeem: { output: input.redeemScript as Script } });
|
|
933
1116
|
if (!payment.redeem) {
|
|
934
1117
|
throw new Error('Failed to extract redeem script from P2SH UTXO');
|
|
935
1118
|
}
|
|
@@ -940,9 +1123,10 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
940
1123
|
}
|
|
941
1124
|
|
|
942
1125
|
if (utxo.nonWitnessUtxo) {
|
|
943
|
-
input.nonWitnessUtxo =
|
|
944
|
-
|
|
945
|
-
|
|
1126
|
+
input.nonWitnessUtxo =
|
|
1127
|
+
utxo.nonWitnessUtxo instanceof Uint8Array
|
|
1128
|
+
? utxo.nonWitnessUtxo
|
|
1129
|
+
: fromHex(utxo.nonWitnessUtxo);
|
|
946
1130
|
}
|
|
947
1131
|
|
|
948
1132
|
if (isP2WPKH(redeemOutput)) {
|
|
@@ -986,16 +1170,17 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
986
1170
|
else if (isP2A(scriptPub)) {
|
|
987
1171
|
this.anchorInputIndices.add(i);
|
|
988
1172
|
|
|
989
|
-
input.isPayToAnchor = true;
|
|
1173
|
+
(input as { isPayToAnchor: boolean }).isPayToAnchor = true;
|
|
990
1174
|
}
|
|
991
1175
|
|
|
992
1176
|
// Handle P2PK (legacy) or P2MS (bare multisig)
|
|
993
1177
|
else if (isP2PK(scriptPub) || isP2MS(scriptPub)) {
|
|
994
1178
|
// These are legacy scripts, need nonWitnessUtxo
|
|
995
1179
|
if (utxo.nonWitnessUtxo) {
|
|
996
|
-
input.nonWitnessUtxo =
|
|
997
|
-
|
|
998
|
-
|
|
1180
|
+
input.nonWitnessUtxo =
|
|
1181
|
+
utxo.nonWitnessUtxo instanceof Uint8Array
|
|
1182
|
+
? utxo.nonWitnessUtxo
|
|
1183
|
+
: fromHex(utxo.nonWitnessUtxo);
|
|
999
1184
|
} else {
|
|
1000
1185
|
throw new Error('Missing nonWitnessUtxo for P2PK or P2MS UTXO');
|
|
1001
1186
|
}
|
|
@@ -1036,9 +1221,10 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1036
1221
|
throw new Error('Missing witnessScript for P2WSH UTXO');
|
|
1037
1222
|
}
|
|
1038
1223
|
|
|
1039
|
-
input.witnessScript =
|
|
1040
|
-
|
|
1041
|
-
|
|
1224
|
+
input.witnessScript =
|
|
1225
|
+
utxo.witnessScript instanceof Uint8Array
|
|
1226
|
+
? utxo.witnessScript
|
|
1227
|
+
: fromHex(utxo.witnessScript);
|
|
1042
1228
|
|
|
1043
1229
|
// No nonWitnessUtxo needed for segwit
|
|
1044
1230
|
|
|
@@ -1052,7 +1238,10 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1052
1238
|
const csvBlocks = this.extractCSVBlocks(decompiled);
|
|
1053
1239
|
|
|
1054
1240
|
// Use the setCSVSequence method to properly set the sequence
|
|
1055
|
-
input.sequence = this.setCSVSequence(
|
|
1241
|
+
(input as { sequence: number }).sequence = this.setCSVSequence(
|
|
1242
|
+
csvBlocks,
|
|
1243
|
+
this.sequence,
|
|
1244
|
+
);
|
|
1056
1245
|
}
|
|
1057
1246
|
}
|
|
1058
1247
|
}
|
|
@@ -1080,13 +1269,14 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1080
1269
|
protected customFinalizerP2SH = (
|
|
1081
1270
|
inputIndex: number,
|
|
1082
1271
|
input: PsbtInput,
|
|
1083
|
-
scriptA:
|
|
1272
|
+
scriptA: Script,
|
|
1084
1273
|
isSegwit: boolean,
|
|
1085
1274
|
isP2SH: boolean,
|
|
1086
1275
|
isP2WSH: boolean,
|
|
1276
|
+
_canRunChecks?: boolean,
|
|
1087
1277
|
): {
|
|
1088
|
-
finalScriptSig:
|
|
1089
|
-
finalScriptWitness:
|
|
1278
|
+
finalScriptSig: Script | undefined;
|
|
1279
|
+
finalScriptWitness: Uint8Array | undefined;
|
|
1090
1280
|
} => {
|
|
1091
1281
|
const inputDecoded = this.inputs[inputIndex];
|
|
1092
1282
|
if (isP2SH && input.partialSig && inputDecoded && inputDecoded.redeemScript) {
|
|
@@ -1102,7 +1292,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1102
1292
|
if (this.anchorInputIndices.has(inputIndex)) {
|
|
1103
1293
|
return {
|
|
1104
1294
|
finalScriptSig: undefined,
|
|
1105
|
-
finalScriptWitness:
|
|
1295
|
+
finalScriptWitness: Uint8Array.from([0]),
|
|
1106
1296
|
};
|
|
1107
1297
|
}
|
|
1108
1298
|
|
|
@@ -1120,7 +1310,10 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1120
1310
|
const isCSVInput = this.csvInputIndices.has(inputIndex);
|
|
1121
1311
|
if (isCSVInput) {
|
|
1122
1312
|
// For CSV P2WSH, the witness stack should be: [signature, witnessScript]
|
|
1123
|
-
const witnessStack = [
|
|
1313
|
+
const witnessStack = [
|
|
1314
|
+
(input.partialSig[0] as { signature: Uint8Array }).signature,
|
|
1315
|
+
input.witnessScript,
|
|
1316
|
+
];
|
|
1124
1317
|
return {
|
|
1125
1318
|
finalScriptSig: undefined,
|
|
1126
1319
|
finalScriptWitness: witnessStackToScriptWitness(witnessStack),
|
|
@@ -1149,8 +1342,8 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1149
1342
|
inputIndex: number,
|
|
1150
1343
|
input: PsbtInput,
|
|
1151
1344
|
): {
|
|
1152
|
-
finalScriptWitness:
|
|
1153
|
-
finalScriptSig:
|
|
1345
|
+
finalScriptWitness: Uint8Array | undefined;
|
|
1346
|
+
finalScriptSig: Script | undefined;
|
|
1154
1347
|
} {
|
|
1155
1348
|
if (!input.partialSig || input.partialSig.length === 0) {
|
|
1156
1349
|
throw new Error(`No signature for P2WDA input #${inputIndex}`);
|
|
@@ -1161,7 +1354,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1161
1354
|
}
|
|
1162
1355
|
|
|
1163
1356
|
const witnessStack = P2WDADetector.createSimpleP2WDAWitness(
|
|
1164
|
-
input.partialSig[0].signature,
|
|
1357
|
+
(input.partialSig[0] as { signature: Uint8Array }).signature,
|
|
1165
1358
|
input.witnessScript,
|
|
1166
1359
|
);
|
|
1167
1360
|
|
|
@@ -1179,13 +1372,13 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1179
1372
|
|
|
1180
1373
|
// Then, we finalize every input.
|
|
1181
1374
|
for (let i = 0; i < transaction.data.inputs.length; i++) {
|
|
1182
|
-
transaction.finalizeInput(i, this.customFinalizerP2SH.bind(this));
|
|
1375
|
+
transaction.finalizeInput(i, this.customFinalizerP2SH.bind(this) as FinalScriptsFunc);
|
|
1183
1376
|
}
|
|
1184
1377
|
|
|
1185
1378
|
this.finalized = true;
|
|
1186
1379
|
}
|
|
1187
1380
|
|
|
1188
|
-
protected isCSVScript(decompiled: (number |
|
|
1381
|
+
protected isCSVScript(decompiled: (number | Uint8Array)[]): boolean {
|
|
1189
1382
|
return decompiled.some((op) => op === opcodes.OP_CHECKSEQUENCEVERIFY);
|
|
1190
1383
|
}
|
|
1191
1384
|
|
|
@@ -1236,12 +1429,12 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1236
1429
|
return csvValue & (1 << 22) ? CSVModes.TIMESTAMPS : CSVModes.BLOCKS;
|
|
1237
1430
|
}
|
|
1238
1431
|
|
|
1239
|
-
private extractCSVBlocks(decompiled: (number |
|
|
1432
|
+
private extractCSVBlocks(decompiled: (number | Uint8Array)[]): number {
|
|
1240
1433
|
for (let i = 0; i < decompiled.length; i++) {
|
|
1241
1434
|
if (decompiled[i] === opcodes.OP_CHECKSEQUENCEVERIFY && i > 0) {
|
|
1242
1435
|
const csvValue = decompiled[i - 1];
|
|
1243
|
-
if (
|
|
1244
|
-
return script.number.decode(csvValue);
|
|
1436
|
+
if (csvValue instanceof Uint8Array) {
|
|
1437
|
+
return script.number.decode(csvValue as Buffer);
|
|
1245
1438
|
} else if (typeof csvValue === 'number') {
|
|
1246
1439
|
// Handle OP_N directly
|
|
1247
1440
|
if (csvValue === opcodes.OP_0 || csvValue === opcodes.OP_FALSE) {
|
|
@@ -1265,15 +1458,15 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1265
1458
|
transaction: Psbt,
|
|
1266
1459
|
input: PsbtInput,
|
|
1267
1460
|
i: number,
|
|
1268
|
-
signer: Signer |
|
|
1269
|
-
publicKey:
|
|
1461
|
+
signer: Signer | UniversalSigner,
|
|
1462
|
+
publicKey: Uint8Array,
|
|
1270
1463
|
): Promise<void> {
|
|
1271
1464
|
const isScriptSpend = this.isTaprootScriptSpend(input, publicKey);
|
|
1272
1465
|
|
|
1273
1466
|
if (isScriptSpend) {
|
|
1274
1467
|
await this.signTaprootInput(signer, transaction, i);
|
|
1275
1468
|
} else {
|
|
1276
|
-
let tweakedSigner:
|
|
1469
|
+
let tweakedSigner: UniversalSigner | undefined;
|
|
1277
1470
|
if (signer !== this.signer) {
|
|
1278
1471
|
tweakedSigner = this.getTweakedSigner(true, signer);
|
|
1279
1472
|
} else {
|
|
@@ -1298,7 +1491,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1298
1491
|
}
|
|
1299
1492
|
}
|
|
1300
1493
|
|
|
1301
|
-
private isTaprootScriptSpend(input: PsbtInput, publicKey:
|
|
1494
|
+
private isTaprootScriptSpend(input: PsbtInput, publicKey: Uint8Array): boolean {
|
|
1302
1495
|
if (input.tapLeafScript && input.tapLeafScript.length > 0) {
|
|
1303
1496
|
// Check if the signer's public key is involved in any tapLeafScript
|
|
1304
1497
|
for (const tapLeafScript of input.tapLeafScript) {
|
|
@@ -1312,10 +1505,10 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1312
1505
|
}
|
|
1313
1506
|
|
|
1314
1507
|
private async signTaprootInput(
|
|
1315
|
-
signer: Signer |
|
|
1508
|
+
signer: Signer | UniversalSigner,
|
|
1316
1509
|
transaction: Psbt,
|
|
1317
1510
|
i: number,
|
|
1318
|
-
tapLeafHash?:
|
|
1511
|
+
tapLeafHash?: Uint8Array,
|
|
1319
1512
|
): Promise<void> {
|
|
1320
1513
|
if ('signTaprootInput' in signer) {
|
|
1321
1514
|
try {
|
|
@@ -1323,7 +1516,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1323
1516
|
signer.signTaprootInput as (
|
|
1324
1517
|
tx: Psbt,
|
|
1325
1518
|
i: number,
|
|
1326
|
-
tapLeafHash?:
|
|
1519
|
+
tapLeafHash?: Uint8Array,
|
|
1327
1520
|
) => Promise<void>
|
|
1328
1521
|
)(transaction, i, tapLeafHash);
|
|
1329
1522
|
} catch {
|
|
@@ -1335,7 +1528,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
1335
1528
|
}
|
|
1336
1529
|
|
|
1337
1530
|
private async signNonTaprootInput(
|
|
1338
|
-
signer: Signer |
|
|
1531
|
+
signer: Signer | UniversalSigner,
|
|
1339
1532
|
transaction: Psbt,
|
|
1340
1533
|
i: number,
|
|
1341
1534
|
): Promise<void> {
|