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