@btc-vision/transaction 1.8.0-beta.3 → 1.8.0-beta.5
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 +1 -0
- package/browser/_version.d.ts.map +1 -0
- package/browser/abi/ABICoder.d.ts +1 -1
- package/browser/abi/ABICoder.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 +11999 -2647
- 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 +3558 -3167
- 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 -21
- 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 +844 -2746
- package/browser/noble-hashes.js +1338 -2067
- package/browser/opnet.d.ts +22 -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 +4 -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 +243 -14
- 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 +22 -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 +14351 -10031
- package/browser/verification/TapscriptVerificator.d.ts +10 -8
- package/browser/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/_version.d.ts +1 -0
- package/build/_version.d.ts.map +1 -0
- package/build/_version.js +1 -0
- package/build/_version.js.map +1 -0
- package/build/abi/ABICoder.d.ts +1 -1
- package/build/abi/ABICoder.d.ts.map +1 -0
- package/build/abi/ABICoder.js +9 -10
- package/build/abi/ABICoder.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 +35 -17
- 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 +446 -128
- 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 -23
- package/build/keypair/EcKeyPair.d.ts.map +1 -0
- package/build/keypair/EcKeyPair.js +218 -50
- 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 +26 -3
- package/build/opnet.d.ts.map +1 -0
- package/build/opnet.js +23 -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 +5 -4
- package/build/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/build/transaction/builders/FundingTransaction.js +15 -8
- 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 +249 -19
- package/build/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/build/transaction/builders/TransactionBuilder.js +375 -60
- 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 +27 -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 +281 -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/eslint.config.js +0 -1
- package/package.json +12 -35
- package/src/abi/ABICoder.ts +0 -13
- 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 +34 -27
- package/src/consensus/ConsensusConfig.ts +1 -1
- package/src/consensus/IConsensusConfig.ts +0 -17
- package/src/consensus/metadata/RoswellConsensus.ts +1 -17
- 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 +114 -71
- package/src/keypair/AddressVerificator.ts +14 -148
- package/src/keypair/EcKeyPair.ts +104 -116
- 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 +12 -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 +28 -50
- 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 +11 -11
- 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 +99 -81
- 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 +15 -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 +326 -124
- 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/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 +321 -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,9 +1,11 @@
|
|
|
1
|
-
import bitcoin, {
|
|
1
|
+
import bitcoin, { equals, fromHex, getFinalScripts, opcodes, Psbt, script, toSatoshi, toXOnly, Transaction, } from '@btc-vision/bitcoin';
|
|
2
2
|
import { witnessStackToScriptWitness } from '../utils/WitnessUtils.js';
|
|
3
|
-
import
|
|
3
|
+
import { TransactionType } from '../enums/TransactionType.js';
|
|
4
4
|
import { EcKeyPair } from '../../keypair/EcKeyPair.js';
|
|
5
|
+
import {} from '@btc-vision/ecpair';
|
|
5
6
|
import { AddressVerificator } from '../../keypair/AddressVerificator.js';
|
|
6
7
|
import { TweakedTransaction } from '../shared/TweakedTransaction.js';
|
|
8
|
+
import { UnisatSigner } from '../browser/extensions/UnisatSigner.js';
|
|
7
9
|
import { P2WDADetector } from '../../p2wda/P2WDADetector.js';
|
|
8
10
|
import { FeaturePriority, Features } from '../../generators/Features.js';
|
|
9
11
|
import { BITCOIN_PROTOCOL_ID, getChainId } from '../../chain/ChainData.js';
|
|
@@ -11,23 +13,112 @@ import { BinaryWriter } from '../../buffer/BinaryWriter.js';
|
|
|
11
13
|
import { MLDSASecurityLevel } from '@btc-vision/bip32';
|
|
12
14
|
import { MessageSigner } from '../../keypair/MessageSigner.js';
|
|
13
15
|
import { getLevelFromPublicKeyLength } from '../../generators/MLDSAData.js';
|
|
14
|
-
|
|
15
|
-
export const MINIMUM_AMOUNT_REWARD = 330n;
|
|
16
|
+
export const MINIMUM_AMOUNT_REWARD = 330n; //540n;
|
|
16
17
|
export const MINIMUM_AMOUNT_CA = 297n;
|
|
17
|
-
export const ANCHOR_SCRIPT =
|
|
18
|
+
export const ANCHOR_SCRIPT = fromHex('51024e73');
|
|
19
|
+
/**
|
|
20
|
+
* Allows to build a transaction like you would on Ethereum.
|
|
21
|
+
* @description The transaction builder class
|
|
22
|
+
* @abstract
|
|
23
|
+
* @class TransactionBuilder
|
|
24
|
+
*/
|
|
18
25
|
export class TransactionBuilder extends TweakedTransaction {
|
|
26
|
+
static MINIMUM_DUST = 330n;
|
|
27
|
+
logColor = '#785def';
|
|
28
|
+
debugFees = false;
|
|
29
|
+
// Cancel script
|
|
30
|
+
LOCK_LEAF_SCRIPT;
|
|
31
|
+
/**
|
|
32
|
+
* @description The overflow fees of the transaction
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
overflowFees = 0n;
|
|
36
|
+
/**
|
|
37
|
+
* @description Cost in satoshis of the transaction fee
|
|
38
|
+
*/
|
|
39
|
+
transactionFee = 0n;
|
|
40
|
+
/**
|
|
41
|
+
* @description The estimated fees of the transaction
|
|
42
|
+
*/
|
|
43
|
+
estimatedFees = 0n;
|
|
44
|
+
/**
|
|
45
|
+
* @param {ITransactionParameters} parameters - The transaction parameters
|
|
46
|
+
*/
|
|
47
|
+
optionalOutputs;
|
|
48
|
+
/**
|
|
49
|
+
* @description The transaction itself.
|
|
50
|
+
*/
|
|
51
|
+
transaction;
|
|
52
|
+
/**
|
|
53
|
+
* @description Inputs to update later on.
|
|
54
|
+
*/
|
|
55
|
+
updateInputs = [];
|
|
56
|
+
/**
|
|
57
|
+
* @description The outputs of the transaction
|
|
58
|
+
*/
|
|
59
|
+
outputs = [];
|
|
60
|
+
/**
|
|
61
|
+
* @description Output that will be used to pay the fees
|
|
62
|
+
*/
|
|
63
|
+
feeOutput = null;
|
|
64
|
+
/**
|
|
65
|
+
* @description The total amount of satoshis in the inputs
|
|
66
|
+
*/
|
|
67
|
+
totalInputAmount;
|
|
68
|
+
/**
|
|
69
|
+
* @description The signer of the transaction
|
|
70
|
+
*/
|
|
71
|
+
signer;
|
|
72
|
+
/**
|
|
73
|
+
* @description The network where the transaction will be broadcasted
|
|
74
|
+
*/
|
|
75
|
+
network;
|
|
76
|
+
/**
|
|
77
|
+
* @description The fee rate of the transaction
|
|
78
|
+
*/
|
|
79
|
+
feeRate;
|
|
80
|
+
/**
|
|
81
|
+
* @description The opnet priority fee of the transaction
|
|
82
|
+
*/
|
|
83
|
+
priorityFee;
|
|
84
|
+
gasSatFee;
|
|
85
|
+
/**
|
|
86
|
+
* @description The utxos used in the transaction
|
|
87
|
+
*/
|
|
88
|
+
utxos;
|
|
89
|
+
/**
|
|
90
|
+
* @description The inputs of the transaction
|
|
91
|
+
* @protected
|
|
92
|
+
*/
|
|
93
|
+
optionalInputs;
|
|
94
|
+
/**
|
|
95
|
+
* @description The address where the transaction is sent to
|
|
96
|
+
* @protected
|
|
97
|
+
*/
|
|
98
|
+
to;
|
|
99
|
+
/**
|
|
100
|
+
* @description The address where the transaction is sent from
|
|
101
|
+
* @protected
|
|
102
|
+
*/
|
|
103
|
+
from;
|
|
104
|
+
/**
|
|
105
|
+
* @description The maximum fee rate of the transaction
|
|
106
|
+
*/
|
|
107
|
+
_maximumFeeRate = 100000000;
|
|
108
|
+
/**
|
|
109
|
+
* @description Is the destionation P2PK
|
|
110
|
+
* @protected
|
|
111
|
+
*/
|
|
112
|
+
isPubKeyDestination;
|
|
113
|
+
/**
|
|
114
|
+
* @description If the transaction need an anchor output
|
|
115
|
+
* @protected
|
|
116
|
+
*/
|
|
117
|
+
anchor;
|
|
118
|
+
note;
|
|
119
|
+
optionalOutputsAdded = false;
|
|
19
120
|
constructor(parameters) {
|
|
20
121
|
super(parameters);
|
|
21
|
-
this.logColor = '#785def';
|
|
22
|
-
this.debugFees = false;
|
|
23
|
-
this.overflowFees = 0n;
|
|
24
|
-
this.transactionFee = 0n;
|
|
25
|
-
this.estimatedFees = 0n;
|
|
26
|
-
this.updateInputs = [];
|
|
27
|
-
this.outputs = [];
|
|
28
|
-
this.feeOutput = null;
|
|
29
|
-
this._maximumFeeRate = 100000000;
|
|
30
|
-
this.optionalOutputsAdded = false;
|
|
31
122
|
if (parameters.estimatedFees) {
|
|
32
123
|
this.estimatedFees = parameters.estimatedFees;
|
|
33
124
|
}
|
|
@@ -43,7 +134,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
43
134
|
this.LOCK_LEAF_SCRIPT = this.defineLockScript();
|
|
44
135
|
if (parameters.note) {
|
|
45
136
|
if (typeof parameters.note === 'string') {
|
|
46
|
-
this.note =
|
|
137
|
+
this.note = new TextEncoder().encode(parameters.note);
|
|
47
138
|
}
|
|
48
139
|
else {
|
|
49
140
|
this.note = parameters.note;
|
|
@@ -65,22 +156,37 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
65
156
|
version: this.txVersion,
|
|
66
157
|
});
|
|
67
158
|
}
|
|
159
|
+
[Symbol.dispose]() {
|
|
160
|
+
super[Symbol.dispose]();
|
|
161
|
+
this.updateInputs.length = 0;
|
|
162
|
+
this.outputs.length = 0;
|
|
163
|
+
this.feeOutput = null;
|
|
164
|
+
this.optionalOutputs = undefined;
|
|
165
|
+
this.utxos = [];
|
|
166
|
+
this.optionalInputs = [];
|
|
167
|
+
}
|
|
68
168
|
static getFrom(from, keypair, network) {
|
|
69
169
|
return from || EcKeyPair.getTaprootAddress(keypair, network);
|
|
70
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* @description Converts the witness stack to a script witness
|
|
173
|
+
* @param {Buffer[]} witness - The witness stack
|
|
174
|
+
* @protected
|
|
175
|
+
* @returns {Buffer}
|
|
176
|
+
*/
|
|
71
177
|
static witnessStackToScriptWitness(witness) {
|
|
72
178
|
return witnessStackToScriptWitness(witness);
|
|
73
179
|
}
|
|
74
180
|
addOPReturn(buffer) {
|
|
75
181
|
const compileScript = script.compile([opcodes.OP_RETURN, buffer]);
|
|
76
182
|
this.addOutput({
|
|
77
|
-
value:
|
|
183
|
+
value: toSatoshi(0n),
|
|
78
184
|
script: compileScript,
|
|
79
185
|
});
|
|
80
186
|
}
|
|
81
187
|
addAnchor() {
|
|
82
188
|
this.addOutput({
|
|
83
|
-
value:
|
|
189
|
+
value: toSatoshi(0n),
|
|
84
190
|
script: ANCHOR_SCRIPT,
|
|
85
191
|
});
|
|
86
192
|
}
|
|
@@ -98,17 +204,32 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
98
204
|
gasSatFee: this.gasSatFee ?? 0n,
|
|
99
205
|
from: this.from,
|
|
100
206
|
amount: this.estimatedFees,
|
|
101
|
-
optionalOutputs: this.optionalOutputs,
|
|
102
207
|
optionalInputs: this.optionalInputs,
|
|
103
208
|
mldsaSigner: null,
|
|
209
|
+
...(this.optionalOutputs !== undefined ? { optionalOutputs: this.optionalOutputs } : {}),
|
|
104
210
|
};
|
|
105
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Set the destination address of the transaction
|
|
214
|
+
* @param {string} address - The address to set
|
|
215
|
+
*/
|
|
106
216
|
setDestinationAddress(address) {
|
|
107
|
-
this.to = address;
|
|
217
|
+
this.to = address; // this.getScriptAddress()
|
|
108
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Set the maximum fee rate of the transaction in satoshis per byte
|
|
221
|
+
* @param {number} feeRate - The fee rate to set
|
|
222
|
+
* @public
|
|
223
|
+
*/
|
|
109
224
|
setMaximumFeeRate(feeRate) {
|
|
110
225
|
this._maximumFeeRate = feeRate;
|
|
111
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* @description Signs the transaction
|
|
229
|
+
* @public
|
|
230
|
+
* @returns {Promise<Transaction>} - The signed transaction in hex format
|
|
231
|
+
* @throws {Error} - If something went wrong
|
|
232
|
+
*/
|
|
112
233
|
async signTransaction() {
|
|
113
234
|
if (!this.utxos.length) {
|
|
114
235
|
throw new Error('No UTXOs specified');
|
|
@@ -131,6 +252,10 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
131
252
|
}
|
|
132
253
|
throw new Error('Could not sign transaction');
|
|
133
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* @description Generates the transaction minimal signatures
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
134
259
|
async generateTransactionMinimalSignatures(checkPartialSigs = false) {
|
|
135
260
|
if (this.to &&
|
|
136
261
|
!this.isPubKeyDestination &&
|
|
@@ -149,42 +274,81 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
149
274
|
this.transaction.addOutputs(outputs);
|
|
150
275
|
}
|
|
151
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* @description Signs the transaction
|
|
279
|
+
* @public
|
|
280
|
+
* @returns {Promise<Psbt>} - The signed transaction in hex format
|
|
281
|
+
* @throws {Error} - If something went wrong
|
|
282
|
+
*/
|
|
152
283
|
async signPSBT() {
|
|
153
284
|
if (await this.signTransaction()) {
|
|
154
285
|
return this.transaction;
|
|
155
286
|
}
|
|
156
287
|
throw new Error('Could not sign transaction');
|
|
157
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Add an input to the transaction.
|
|
291
|
+
* @param {PsbtInputExtended} input - The input to add
|
|
292
|
+
* @public
|
|
293
|
+
* @returns {void}
|
|
294
|
+
*/
|
|
158
295
|
addInput(input) {
|
|
159
296
|
this.inputs.push(input);
|
|
160
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Add an output to the transaction.
|
|
300
|
+
* @param {PsbtOutputExtended} output - The output to add
|
|
301
|
+
* @param bypassMinCheck
|
|
302
|
+
* @public
|
|
303
|
+
* @returns {void}
|
|
304
|
+
*/
|
|
161
305
|
addOutput(output, bypassMinCheck = false) {
|
|
162
|
-
if (output.value ===
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
306
|
+
if (output.value === toSatoshi(0n)) {
|
|
307
|
+
const scriptOutput = output;
|
|
308
|
+
if (!scriptOutput.script || scriptOutput.script.length === 0) {
|
|
165
309
|
throw new Error('Output value is 0 and no script provided');
|
|
166
310
|
}
|
|
167
|
-
if (
|
|
311
|
+
if (scriptOutput.script.length < 2) {
|
|
168
312
|
throw new Error('Output script is too short');
|
|
169
313
|
}
|
|
170
|
-
if (
|
|
314
|
+
if (scriptOutput.script[0] !== opcodes.OP_RETURN &&
|
|
315
|
+
!equals(scriptOutput.script, ANCHOR_SCRIPT)) {
|
|
171
316
|
throw new Error('Output script must start with OP_RETURN or be an ANCHOR when value is 0');
|
|
172
317
|
}
|
|
173
318
|
}
|
|
174
|
-
else if (!bypassMinCheck && output.value < TransactionBuilder.MINIMUM_DUST) {
|
|
319
|
+
else if (!bypassMinCheck && BigInt(output.value) < TransactionBuilder.MINIMUM_DUST) {
|
|
175
320
|
throw new Error(`Output value is less than the minimum dust ${output.value} < ${TransactionBuilder.MINIMUM_DUST}`);
|
|
176
321
|
}
|
|
177
322
|
this.outputs.push(output);
|
|
178
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* Returns the total value of all outputs added so far (excluding the fee/change output).
|
|
326
|
+
* @public
|
|
327
|
+
* @returns {bigint}
|
|
328
|
+
*/
|
|
179
329
|
getTotalOutputValue() {
|
|
180
330
|
return this.outputs.reduce((total, output) => total + BigInt(output.value), 0n);
|
|
181
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* Receiver address.
|
|
334
|
+
* @public
|
|
335
|
+
* @returns {string} - The receiver address
|
|
336
|
+
*/
|
|
182
337
|
toAddress() {
|
|
183
338
|
return this.to;
|
|
184
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* @description Returns the script address
|
|
342
|
+
* @returns {string} - The script address
|
|
343
|
+
*/
|
|
185
344
|
address() {
|
|
186
345
|
return this.tapData?.address;
|
|
187
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Estimates the transaction fees with accurate size calculation.
|
|
349
|
+
* @public
|
|
350
|
+
* @returns {Promise<bigint>}
|
|
351
|
+
*/
|
|
188
352
|
async estimateTransactionFees() {
|
|
189
353
|
await Promise.resolve();
|
|
190
354
|
const fakeTx = new Psbt({ network: this.network });
|
|
@@ -192,22 +356,23 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
192
356
|
const outputs = this.getOutputs();
|
|
193
357
|
fakeTx.addInputs(inputs);
|
|
194
358
|
fakeTx.addOutputs(outputs);
|
|
195
|
-
const dummySchnorrSig =
|
|
196
|
-
const dummyEcdsaSig =
|
|
197
|
-
const dummyCompressedPubkey =
|
|
359
|
+
const dummySchnorrSig = new Uint8Array(64);
|
|
360
|
+
const dummyEcdsaSig = new Uint8Array(72);
|
|
361
|
+
const dummyCompressedPubkey = new Uint8Array(33).fill(2);
|
|
198
362
|
const finalizer = (inputIndex, input) => {
|
|
199
363
|
if (input.isPayToAnchor || this.anchorInputIndices.has(inputIndex)) {
|
|
200
364
|
return {
|
|
201
365
|
finalScriptSig: undefined,
|
|
202
|
-
finalScriptWitness:
|
|
366
|
+
finalScriptWitness: Uint8Array.from([0]),
|
|
203
367
|
};
|
|
204
368
|
}
|
|
205
369
|
if (input.witnessScript && P2WDADetector.isP2WDAWitnessScript(input.witnessScript)) {
|
|
370
|
+
// Create dummy witness stack for P2WDA
|
|
206
371
|
const dummyDataSlots = [];
|
|
207
372
|
for (let i = 0; i < 10; i++) {
|
|
208
|
-
dummyDataSlots.push(
|
|
373
|
+
dummyDataSlots.push(new Uint8Array(0));
|
|
209
374
|
}
|
|
210
|
-
const dummyEcdsaSig =
|
|
375
|
+
const dummyEcdsaSig = new Uint8Array(72);
|
|
211
376
|
return {
|
|
212
377
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
213
378
|
...dummyDataSlots,
|
|
@@ -217,14 +382,15 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
217
382
|
};
|
|
218
383
|
}
|
|
219
384
|
if (inputIndex === 0 && this.tapLeafScript) {
|
|
220
|
-
const dummySecret =
|
|
385
|
+
const dummySecret = new Uint8Array(32);
|
|
221
386
|
const dummyScript = this.tapLeafScript.script;
|
|
222
|
-
|
|
387
|
+
// A control block for a 2-leaf tree contains one 32-byte hash.
|
|
388
|
+
const dummyControlBlock = new Uint8Array(1 + 32 + 32);
|
|
223
389
|
return {
|
|
224
390
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
225
391
|
dummySecret,
|
|
226
|
-
dummySchnorrSig,
|
|
227
|
-
dummySchnorrSig,
|
|
392
|
+
dummySchnorrSig, // It's a tapScriptSig, which is Schnorr
|
|
393
|
+
dummySchnorrSig, // Second Schnorr signature
|
|
228
394
|
dummyScript,
|
|
229
395
|
dummyControlBlock,
|
|
230
396
|
]),
|
|
@@ -250,6 +416,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
250
416
|
}
|
|
251
417
|
if (input.witnessScript) {
|
|
252
418
|
if (this.csvInputIndices.has(inputIndex)) {
|
|
419
|
+
// CSV P2WSH needs: [signature, witnessScript]
|
|
253
420
|
return {
|
|
254
421
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
255
422
|
dummyEcdsaSig,
|
|
@@ -258,6 +425,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
258
425
|
};
|
|
259
426
|
}
|
|
260
427
|
if (input.redeemScript) {
|
|
428
|
+
// P2SH-P2WSH needs redeemScript in scriptSig and witness data
|
|
261
429
|
const dummyWitness = [dummyEcdsaSig, input.witnessScript];
|
|
262
430
|
return {
|
|
263
431
|
finalScriptSig: input.redeemScript,
|
|
@@ -268,6 +436,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
268
436
|
if (decompiled && decompiled.length >= 4) {
|
|
269
437
|
const firstOp = decompiled[0];
|
|
270
438
|
const lastOp = decompiled[decompiled.length - 1];
|
|
439
|
+
// Check if it's M-of-N multisig
|
|
271
440
|
if (typeof firstOp === 'number' &&
|
|
272
441
|
firstOp >= opcodes.OP_1 &&
|
|
273
442
|
lastOp === opcodes.OP_CHECKMULTISIG) {
|
|
@@ -278,7 +447,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
278
447
|
}
|
|
279
448
|
return {
|
|
280
449
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
281
|
-
|
|
450
|
+
new Uint8Array(0), // OP_0 due to multisig bug
|
|
282
451
|
...signatures,
|
|
283
452
|
input.witnessScript,
|
|
284
453
|
]),
|
|
@@ -297,8 +466,9 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
297
466
|
if (decompiled &&
|
|
298
467
|
decompiled.length === 2 &&
|
|
299
468
|
decompiled[0] === opcodes.OP_0 &&
|
|
300
|
-
|
|
469
|
+
decompiled[1] instanceof Uint8Array &&
|
|
301
470
|
decompiled[1].length === 20) {
|
|
471
|
+
// P2SH-P2WPKH
|
|
302
472
|
return {
|
|
303
473
|
finalScriptSig: input.redeemScript,
|
|
304
474
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
@@ -309,13 +479,14 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
309
479
|
}
|
|
310
480
|
}
|
|
311
481
|
if (input.redeemScript && !input.witnessScript && !input.witnessUtxo) {
|
|
482
|
+
// Pure P2SH needs signatures + redeemScript in scriptSig
|
|
312
483
|
return {
|
|
313
484
|
finalScriptSig: bitcoin.script.compile([dummyEcdsaSig, input.redeemScript]),
|
|
314
485
|
finalScriptWitness: undefined,
|
|
315
486
|
};
|
|
316
487
|
}
|
|
317
|
-
const
|
|
318
|
-
if (!
|
|
488
|
+
const inputScript = input.witnessUtxo?.script;
|
|
489
|
+
if (!inputScript)
|
|
319
490
|
return { finalScriptSig: undefined, finalScriptWitness: undefined };
|
|
320
491
|
if (input.tapInternalKey) {
|
|
321
492
|
return {
|
|
@@ -324,7 +495,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
324
495
|
]),
|
|
325
496
|
};
|
|
326
497
|
}
|
|
327
|
-
if (
|
|
498
|
+
if (inputScript.length === 22 && inputScript[0] === opcodes.OP_0) {
|
|
328
499
|
return {
|
|
329
500
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
330
501
|
dummyEcdsaSig,
|
|
@@ -340,7 +511,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
340
511
|
]),
|
|
341
512
|
};
|
|
342
513
|
}
|
|
343
|
-
return getFinalScripts(inputIndex, input,
|
|
514
|
+
return getFinalScripts(inputIndex, input, inputScript, true, !!input.redeemScript, !!input.witnessScript);
|
|
344
515
|
};
|
|
345
516
|
try {
|
|
346
517
|
for (let i = 0; i < fakeTx.data.inputs.length; i++) {
|
|
@@ -374,9 +545,19 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
374
545
|
setPSBT(psbt) {
|
|
375
546
|
this.transaction = psbt;
|
|
376
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* Returns the inputs of the transaction.
|
|
550
|
+
* @protected
|
|
551
|
+
* @returns {PsbtInputExtended[]}
|
|
552
|
+
*/
|
|
377
553
|
getInputs() {
|
|
378
554
|
return this.inputs;
|
|
379
555
|
}
|
|
556
|
+
/**
|
|
557
|
+
* Returns the outputs of the transaction.
|
|
558
|
+
* @protected
|
|
559
|
+
* @returns {PsbtOutputExtended[]}
|
|
560
|
+
*/
|
|
380
561
|
getOutputs() {
|
|
381
562
|
const outputs = [...this.outputs];
|
|
382
563
|
if (this.feeOutput)
|
|
@@ -399,46 +580,55 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
399
580
|
if (this.anchor) {
|
|
400
581
|
this.addAnchor();
|
|
401
582
|
}
|
|
583
|
+
// Initialize variables for iteration
|
|
402
584
|
let previousFee = -1n;
|
|
403
585
|
let estimatedFee = 0n;
|
|
404
586
|
let iterations = 0;
|
|
405
|
-
const maxIterations = 5;
|
|
587
|
+
const maxIterations = 5; // Prevent infinite loops
|
|
406
588
|
let sendBackAmount = 0n;
|
|
589
|
+
// Iterate until fee stabilizes
|
|
407
590
|
while (iterations < maxIterations && estimatedFee !== previousFee) {
|
|
408
591
|
previousFee = estimatedFee;
|
|
592
|
+
// Calculate the fee with current outputs
|
|
409
593
|
estimatedFee = await this.estimateTransactionFees();
|
|
594
|
+
// Total amount that needs to be spent (outputs + fee)
|
|
410
595
|
const totalSpent = amountSpent + estimatedFee;
|
|
596
|
+
// Calculate refund
|
|
411
597
|
sendBackAmount = this.totalInputAmount - totalSpent;
|
|
412
598
|
if (this.debugFees) {
|
|
413
599
|
this.log(`Iteration ${iterations + 1}: inputAmount=${this.totalInputAmount}, totalSpent=${totalSpent}, sendBackAmount=${sendBackAmount}`);
|
|
414
600
|
}
|
|
601
|
+
// Determine if we should add a change output
|
|
415
602
|
if (sendBackAmount >= TransactionBuilder.MINIMUM_DUST) {
|
|
603
|
+
// Create the appropriate change output
|
|
416
604
|
if (AddressVerificator.isValidP2TRAddress(this.from, this.network)) {
|
|
417
605
|
this.feeOutput = {
|
|
418
|
-
value:
|
|
606
|
+
value: toSatoshi(sendBackAmount),
|
|
419
607
|
address: this.from,
|
|
420
608
|
tapInternalKey: this.internalPubKeyToXOnly(),
|
|
421
609
|
};
|
|
422
610
|
}
|
|
423
611
|
else if (AddressVerificator.isValidPublicKey(this.from, this.network)) {
|
|
424
612
|
const pubKeyScript = script.compile([
|
|
425
|
-
|
|
613
|
+
fromHex(this.from.replace('0x', '')),
|
|
426
614
|
opcodes.OP_CHECKSIG,
|
|
427
615
|
]);
|
|
428
616
|
this.feeOutput = {
|
|
429
|
-
value:
|
|
617
|
+
value: toSatoshi(sendBackAmount),
|
|
430
618
|
script: pubKeyScript,
|
|
431
619
|
};
|
|
432
620
|
}
|
|
433
621
|
else {
|
|
434
622
|
this.feeOutput = {
|
|
435
|
-
value:
|
|
623
|
+
value: toSatoshi(sendBackAmount),
|
|
436
624
|
address: this.from,
|
|
437
625
|
};
|
|
438
626
|
}
|
|
627
|
+
// Set overflowFees when we have a change output
|
|
439
628
|
this.overflowFees = sendBackAmount;
|
|
440
629
|
}
|
|
441
630
|
else {
|
|
631
|
+
// No change output if below dust
|
|
442
632
|
this.feeOutput = null;
|
|
443
633
|
this.overflowFees = 0n;
|
|
444
634
|
if (sendBackAmount < 0n && iterations === maxIterations) {
|
|
@@ -456,21 +646,32 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
456
646
|
if (iterations >= maxIterations) {
|
|
457
647
|
this.warn(`Fee calculation did not stabilize after ${maxIterations} iterations`);
|
|
458
648
|
}
|
|
649
|
+
// Store the final fee
|
|
459
650
|
this.transactionFee = estimatedFee;
|
|
460
651
|
if (this.debugFees) {
|
|
461
652
|
this.log(`Final fee: ${estimatedFee} sats, Change output: ${this.feeOutput ? `${this.feeOutput.value} sats` : 'none'}`);
|
|
462
653
|
}
|
|
463
654
|
}
|
|
464
655
|
defineLockScript() {
|
|
465
|
-
return script.compile([toXOnly(
|
|
656
|
+
return script.compile([toXOnly(this.signer.publicKey), opcodes.OP_CHECKSIG]);
|
|
466
657
|
}
|
|
658
|
+
/**
|
|
659
|
+
* @description Adds the value to the output
|
|
660
|
+
* @param {number | bigint} value - The value to add
|
|
661
|
+
* @protected
|
|
662
|
+
* @returns {void}
|
|
663
|
+
*/
|
|
467
664
|
addValueToToOutput(value) {
|
|
468
|
-
if (value < TransactionBuilder.MINIMUM_DUST) {
|
|
665
|
+
if (BigInt(value) < TransactionBuilder.MINIMUM_DUST) {
|
|
469
666
|
throw new Error(`Value to send is less than the minimum dust ${value} < ${TransactionBuilder.MINIMUM_DUST}`);
|
|
470
667
|
}
|
|
471
|
-
for (
|
|
668
|
+
for (let i = 0; i < this.outputs.length; i++) {
|
|
669
|
+
const output = this.outputs[i];
|
|
472
670
|
if ('address' in output && output.address === this.to) {
|
|
473
|
-
|
|
671
|
+
this.outputs[i] = {
|
|
672
|
+
...output,
|
|
673
|
+
value: toSatoshi(BigInt(output.value) + BigInt(value)),
|
|
674
|
+
};
|
|
474
675
|
return;
|
|
475
676
|
}
|
|
476
677
|
}
|
|
@@ -488,6 +689,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
488
689
|
}
|
|
489
690
|
const chainId = getChainId(this.network);
|
|
490
691
|
const writer = new BinaryWriter();
|
|
692
|
+
// ONLY SUPPORT MLDSA-44 FOR NOW.
|
|
491
693
|
writer.writeU8(MLDSASecurityLevel.LEVEL2);
|
|
492
694
|
writer.writeBytes(this.hashedPublicKey);
|
|
493
695
|
writer.writeBytes(tweakedKey);
|
|
@@ -500,7 +702,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
500
702
|
if (!isValid) {
|
|
501
703
|
throw new Error('Could not verify generated legacy signature for MLDSA link request');
|
|
502
704
|
}
|
|
503
|
-
return
|
|
705
|
+
return new Uint8Array(signature.signature);
|
|
504
706
|
}
|
|
505
707
|
generateMLDSASignature() {
|
|
506
708
|
if (!this.mldsaSigner) {
|
|
@@ -534,7 +736,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
534
736
|
if (!isValid) {
|
|
535
737
|
throw new Error('Could not verify generated MLDSA signature for link request');
|
|
536
738
|
}
|
|
537
|
-
return
|
|
739
|
+
return new Uint8Array(signature.signature);
|
|
538
740
|
}
|
|
539
741
|
generateMLDSALinkRequest(parameters, features) {
|
|
540
742
|
const mldsaSigner = this.mldsaSigner;
|
|
@@ -557,6 +759,11 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
557
759
|
};
|
|
558
760
|
features.push(mldsaRequest);
|
|
559
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* @description Returns the transaction opnet fee
|
|
764
|
+
* @protected
|
|
765
|
+
* @returns {bigint}
|
|
766
|
+
*/
|
|
560
767
|
getTransactionOPNetFee() {
|
|
561
768
|
const totalFee = this.priorityFee + this.gasSatFee;
|
|
562
769
|
if (totalFee > TransactionBuilder.MINIMUM_DUST) {
|
|
@@ -564,6 +771,11 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
564
771
|
}
|
|
565
772
|
return TransactionBuilder.MINIMUM_DUST;
|
|
566
773
|
}
|
|
774
|
+
/**
|
|
775
|
+
* @description Returns the total amount of satoshis in the inputs
|
|
776
|
+
* @protected
|
|
777
|
+
* @returns {bigint}
|
|
778
|
+
*/
|
|
567
779
|
calculateTotalUTXOAmount() {
|
|
568
780
|
let total = 0n;
|
|
569
781
|
for (const utxo of this.utxos) {
|
|
@@ -574,6 +786,11 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
574
786
|
}
|
|
575
787
|
return total;
|
|
576
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* @description Returns the total amount of satoshis in the outputs
|
|
791
|
+
* @protected
|
|
792
|
+
* @returns {bigint}
|
|
793
|
+
*/
|
|
577
794
|
calculateTotalVOutAmount() {
|
|
578
795
|
let total = 0n;
|
|
579
796
|
for (const utxo of this.utxos) {
|
|
@@ -584,6 +801,11 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
584
801
|
}
|
|
585
802
|
return total;
|
|
586
803
|
}
|
|
804
|
+
/**
|
|
805
|
+
* @description Adds optional outputs to transaction and returns their total value in satoshi to calculate refund transaction
|
|
806
|
+
* @protected
|
|
807
|
+
* @returns {bigint}
|
|
808
|
+
*/
|
|
587
809
|
addOptionalOutputsAndGetAmount() {
|
|
588
810
|
if (!this.optionalOutputs || this.optionalOutputsAdded)
|
|
589
811
|
return 0n;
|
|
@@ -595,13 +817,20 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
595
817
|
this.optionalOutputsAdded = true;
|
|
596
818
|
return refundedFromOptionalOutputs;
|
|
597
819
|
}
|
|
820
|
+
/**
|
|
821
|
+
* @description Adds the inputs from the utxos
|
|
822
|
+
* @protected
|
|
823
|
+
* @returns {void}
|
|
824
|
+
*/
|
|
598
825
|
addInputsFromUTXO() {
|
|
599
826
|
if (this.utxos.length) {
|
|
827
|
+
//throw new Error('No UTXOs specified');
|
|
600
828
|
if (this.totalInputAmount < TransactionBuilder.MINIMUM_DUST) {
|
|
601
829
|
throw new Error(`Total input amount is ${this.totalInputAmount} sat which is less than the minimum dust ${TransactionBuilder.MINIMUM_DUST} sat.`);
|
|
602
830
|
}
|
|
603
831
|
for (let i = 0; i < this.utxos.length; i++) {
|
|
604
832
|
const utxo = this.utxos[i];
|
|
833
|
+
// Register signer BEFORE generating input (needed for tapInternalKey)
|
|
605
834
|
this.registerInputSigner(i, utxo);
|
|
606
835
|
const input = this.generatePsbtInputExtended(utxo, i);
|
|
607
836
|
this.addInput(input);
|
|
@@ -610,19 +839,38 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
610
839
|
if (this.optionalInputs) {
|
|
611
840
|
for (let i = this.utxos.length; i < this.optionalInputs.length + this.utxos.length; i++) {
|
|
612
841
|
const utxo = this.optionalInputs[i - this.utxos.length];
|
|
842
|
+
// Register signer BEFORE generating input (needed for tapInternalKey)
|
|
613
843
|
this.registerInputSigner(i, utxo);
|
|
614
844
|
const input = this.generatePsbtInputExtended(utxo, i, true);
|
|
615
845
|
this.addInput(input);
|
|
616
846
|
}
|
|
617
847
|
}
|
|
618
848
|
}
|
|
849
|
+
/**
|
|
850
|
+
* Internal init.
|
|
851
|
+
* @protected
|
|
852
|
+
*/
|
|
619
853
|
internalInit() {
|
|
620
854
|
this.verifyUTXOValidity();
|
|
621
855
|
super.internalInit();
|
|
622
856
|
}
|
|
857
|
+
/**
|
|
858
|
+
* Add an input update
|
|
859
|
+
* @param {UpdateInput} input - The input to update
|
|
860
|
+
* @protected
|
|
861
|
+
* @returns {void}
|
|
862
|
+
*/
|
|
623
863
|
updateInput(input) {
|
|
624
864
|
this.updateInputs.push(input);
|
|
625
865
|
}
|
|
866
|
+
/**
|
|
867
|
+
* Adds the fee to the output.
|
|
868
|
+
* @param amountSpent
|
|
869
|
+
* @param contractAddress
|
|
870
|
+
* @param epochChallenge
|
|
871
|
+
* @param addContractOutput
|
|
872
|
+
* @protected
|
|
873
|
+
*/
|
|
626
874
|
addFeeToOutput(amountSpent, contractAddress, epochChallenge, addContractOutput) {
|
|
627
875
|
if (addContractOutput) {
|
|
628
876
|
let amountToCA;
|
|
@@ -632,26 +880,35 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
632
880
|
else {
|
|
633
881
|
amountToCA = amountSpent;
|
|
634
882
|
}
|
|
883
|
+
// ALWAYS THE FIRST INPUT.
|
|
635
884
|
this.addOutput({
|
|
636
|
-
value:
|
|
885
|
+
value: toSatoshi(amountToCA),
|
|
637
886
|
address: contractAddress,
|
|
638
887
|
}, true);
|
|
888
|
+
// ALWAYS SECOND.
|
|
639
889
|
if (amountToCA === MINIMUM_AMOUNT_CA &&
|
|
640
890
|
amountSpent - MINIMUM_AMOUNT_CA > MINIMUM_AMOUNT_REWARD) {
|
|
641
891
|
this.addOutput({
|
|
642
|
-
value:
|
|
892
|
+
value: toSatoshi(amountSpent - amountToCA),
|
|
643
893
|
address: epochChallenge.address,
|
|
644
894
|
}, true);
|
|
645
895
|
}
|
|
646
896
|
}
|
|
647
897
|
else {
|
|
898
|
+
// When SEND_AMOUNT_TO_CA is false, always send to epochChallenge
|
|
899
|
+
// Use the maximum of amountSpent or MINIMUM_AMOUNT_REWARD
|
|
648
900
|
const amountToEpoch = amountSpent < MINIMUM_AMOUNT_REWARD ? MINIMUM_AMOUNT_REWARD : amountSpent;
|
|
649
901
|
this.addOutput({
|
|
650
|
-
value:
|
|
902
|
+
value: toSatoshi(amountToEpoch),
|
|
651
903
|
address: epochChallenge.address,
|
|
652
904
|
}, true);
|
|
653
905
|
}
|
|
654
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* Returns the witness of the tap transaction.
|
|
909
|
+
* @protected
|
|
910
|
+
* @returns {Buffer}
|
|
911
|
+
*/
|
|
655
912
|
getWitness() {
|
|
656
913
|
if (!this.tapData || !this.tapData.witness) {
|
|
657
914
|
throw new Error('Witness is required');
|
|
@@ -661,12 +918,21 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
661
918
|
}
|
|
662
919
|
return this.tapData.witness[this.tapData.witness.length - 1];
|
|
663
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* Returns the tap output.
|
|
923
|
+
* @protected
|
|
924
|
+
* @returns {Buffer}
|
|
925
|
+
*/
|
|
664
926
|
getTapOutput() {
|
|
665
927
|
if (!this.tapData || !this.tapData.output) {
|
|
666
928
|
throw new Error('Tap data is required');
|
|
667
929
|
}
|
|
668
930
|
return this.tapData.output;
|
|
669
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* Verifies that the utxos are valid.
|
|
934
|
+
* @protected
|
|
935
|
+
*/
|
|
670
936
|
verifyUTXOValidity() {
|
|
671
937
|
for (const utxo of this.utxos) {
|
|
672
938
|
if (!utxo.scriptPubKey) {
|
|
@@ -679,9 +945,15 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
679
945
|
}
|
|
680
946
|
}
|
|
681
947
|
}
|
|
948
|
+
/**
|
|
949
|
+
* Set transaction fee output.
|
|
950
|
+
* @param {PsbtOutputExtended} output - The output to set the fees
|
|
951
|
+
* @protected
|
|
952
|
+
* @returns {Promise<void>}
|
|
953
|
+
*/
|
|
682
954
|
async setFeeOutput(output) {
|
|
683
955
|
const initialValue = output.value;
|
|
684
|
-
this.feeOutput = null;
|
|
956
|
+
this.feeOutput = null; // Start with no fee output
|
|
685
957
|
let estimatedFee = 0n;
|
|
686
958
|
let lastFee = -1n;
|
|
687
959
|
this.log(`setFeeOutput: Starting fee calculation for change. Initial available value: ${initialValue} sats.`);
|
|
@@ -693,12 +965,13 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
693
965
|
this.log(` -> Iteration ${i + 1}: Estimated fee is ${estimatedFee} sats. Value left for change: ${valueLeft} sats.`);
|
|
694
966
|
}
|
|
695
967
|
if (valueLeft >= TransactionBuilder.MINIMUM_DUST) {
|
|
696
|
-
this.feeOutput = { ...output, value:
|
|
968
|
+
this.feeOutput = { ...output, value: toSatoshi(valueLeft) };
|
|
697
969
|
this.overflowFees = valueLeft;
|
|
698
970
|
}
|
|
699
971
|
else {
|
|
700
972
|
this.feeOutput = null;
|
|
701
973
|
this.overflowFees = 0n;
|
|
974
|
+
// Re-estimate fee one last time without the change output
|
|
702
975
|
estimatedFee = await this.estimateTransactionFees();
|
|
703
976
|
if (this.debugFees) {
|
|
704
977
|
this.log(` -> Change is less than dust. Final fee without change output: ${estimatedFee} sats.`);
|
|
@@ -710,7 +983,7 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
710
983
|
throw new Error(`setFeeOutput: Insufficient funds to pay the fees. Required fee: ${estimatedFee}, Available: ${initialValue}. Total input: ${this.totalInputAmount} sat`);
|
|
711
984
|
}
|
|
712
985
|
if (finalValueLeft >= TransactionBuilder.MINIMUM_DUST) {
|
|
713
|
-
this.feeOutput = { ...output, value:
|
|
986
|
+
this.feeOutput = { ...output, value: toSatoshi(finalValueLeft) };
|
|
714
987
|
this.overflowFees = finalValueLeft;
|
|
715
988
|
if (this.debugFees) {
|
|
716
989
|
this.log(`setFeeOutput: Final change output set to ${finalValueLeft} sats. Final fee: ${estimatedFee} sats.`);
|
|
@@ -722,6 +995,48 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
722
995
|
this.overflowFees = 0n;
|
|
723
996
|
}
|
|
724
997
|
}
|
|
998
|
+
/*protected async setFeeOutput(output: PsbtOutputExtended): Promise<void> {
|
|
999
|
+
const initialValue = output.value;
|
|
1000
|
+
|
|
1001
|
+
const fee = await this.estimateTransactionFees();
|
|
1002
|
+
output.value = initialValue - Number(fee);
|
|
1003
|
+
|
|
1004
|
+
if (output.value < TransactionBuilder.MINIMUM_DUST) {
|
|
1005
|
+
this.feeOutput = null;
|
|
1006
|
+
|
|
1007
|
+
if (output.value < 0) {
|
|
1008
|
+
throw new Error(
|
|
1009
|
+
`setFeeOutput: Insufficient funds to pay the fees. Fee: ${fee} < Value: ${initialValue}. Total input: ${this.totalInputAmount} sat`,
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
} else {
|
|
1013
|
+
this.feeOutput = output;
|
|
1014
|
+
|
|
1015
|
+
const fee = await this.estimateTransactionFees();
|
|
1016
|
+
if (fee > BigInt(initialValue)) {
|
|
1017
|
+
throw new Error(
|
|
1018
|
+
`estimateTransactionFees: Insufficient funds to pay the fees. Fee: ${fee} > Value: ${initialValue}. Total input: ${this.totalInputAmount} sat`,
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
const valueLeft = initialValue - Number(fee);
|
|
1023
|
+
if (valueLeft < TransactionBuilder.MINIMUM_DUST) {
|
|
1024
|
+
this.feeOutput = null;
|
|
1025
|
+
} else {
|
|
1026
|
+
this.feeOutput.value = valueLeft;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
this.overflowFees = BigInt(valueLeft);
|
|
1030
|
+
}
|
|
1031
|
+
}*/
|
|
1032
|
+
/**
|
|
1033
|
+
* Builds the transaction.
|
|
1034
|
+
* @param {Psbt} transaction - The transaction to build
|
|
1035
|
+
* @param checkPartialSigs
|
|
1036
|
+
* @protected
|
|
1037
|
+
* @returns {Promise<boolean>}
|
|
1038
|
+
* @throws {Error} - If something went wrong while building the transaction
|
|
1039
|
+
*/
|
|
725
1040
|
async internalBuildTransaction(transaction, checkPartialSigs = false) {
|
|
726
1041
|
if (transaction.data.inputs.length === 0) {
|
|
727
1042
|
const inputs = this.getInputs();
|
|
@@ -747,4 +1062,4 @@ export class TransactionBuilder extends TweakedTransaction {
|
|
|
747
1062
|
return false;
|
|
748
1063
|
}
|
|
749
1064
|
}
|
|
750
|
-
TransactionBuilder.
|
|
1065
|
+
//# sourceMappingURL=TransactionBuilder.js.map
|