@btc-vision/transaction 1.8.0-beta.0 → 1.8.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/_version.d.ts +2 -1
- package/browser/_version.d.ts.map +1 -0
- package/browser/abi/ABICoder.d.ts +15 -36
- package/browser/abi/ABICoder.d.ts.map +1 -0
- package/browser/abi/ABIDataTypes.d.ts +35 -0
- package/browser/abi/ABIDataTypes.d.ts.map +1 -0
- package/browser/abi/AbiTypes.d.ts +50 -0
- package/browser/abi/AbiTypes.d.ts.map +1 -0
- package/browser/abi/TupleUtils.d.ts +25 -0
- package/browser/abi/TupleUtils.d.ts.map +1 -0
- package/browser/branded/Branded.d.ts +4 -0
- package/browser/branded/Branded.d.ts.map +1 -0
- package/browser/btc-vision-bitcoin.js +12388 -3684
- package/browser/buffer/BinaryReader.d.ts +120 -1
- package/browser/buffer/BinaryReader.d.ts.map +1 -0
- package/browser/buffer/BinaryWriter.d.ts +51 -1
- package/browser/buffer/BinaryWriter.d.ts.map +1 -0
- package/browser/bytecode/Compressor.d.ts +12 -0
- package/browser/bytecode/Compressor.d.ts.map +1 -0
- package/browser/chain/ChainData.d.ts +2 -2
- package/browser/chain/ChainData.d.ts.map +1 -0
- package/browser/consensus/Consensus.d.ts +11 -3
- package/browser/consensus/Consensus.d.ts.map +1 -0
- package/browser/consensus/ConsensusConfig.d.ts +1 -0
- package/browser/consensus/ConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/IConsensusConfig.d.ts +1 -0
- package/browser/consensus/IConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/browser/crypto/crypto.d.ts +1 -0
- package/browser/crypto/crypto.d.ts.map +1 -0
- package/browser/deterministic/AddressMap.d.ts +6 -1
- package/browser/deterministic/AddressMap.d.ts.map +1 -0
- package/browser/deterministic/AddressSet.d.ts +3 -1
- package/browser/deterministic/AddressSet.d.ts.map +1 -0
- package/browser/deterministic/CustomMap.d.ts +3 -1
- package/browser/deterministic/CustomMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicMap.d.ts +3 -1
- package/browser/deterministic/DeterministicMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicSet.d.ts +3 -1
- package/browser/deterministic/DeterministicSet.d.ts.map +1 -0
- package/browser/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/browser/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/browser/deterministic/FastMap.d.ts +7 -1
- package/browser/deterministic/FastMap.d.ts.map +1 -0
- package/browser/ecc/backend.d.ts +13 -0
- package/browser/ecc/backend.d.ts.map +1 -0
- package/browser/epoch/ChallengeSolution.d.ts +33 -1
- package/browser/epoch/ChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/browser/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/validator/EpochValidator.d.ts +37 -7
- package/browser/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/browser/event/NetEvent.d.ts +1 -0
- package/browser/event/NetEvent.d.ts.map +1 -0
- package/browser/generators/AddressGenerator.d.ts +4 -3
- package/browser/generators/AddressGenerator.d.ts.map +1 -0
- package/browser/generators/Features.d.ts +1 -0
- package/browser/generators/Features.d.ts.map +1 -0
- package/browser/generators/Generator.d.ts +46 -10
- package/browser/generators/Generator.d.ts.map +1 -0
- package/browser/generators/MLDSAData.d.ts +1 -0
- package/browser/generators/MLDSAData.d.ts.map +1 -0
- package/browser/generators/builders/CalldataGenerator.d.ts +25 -4
- package/browser/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/CustomGenerator.d.ts +13 -3
- package/browser/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/browser/generators/builders/DeploymentGenerator.d.ts +15 -4
- package/browser/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/HashCommitmentGenerator.d.ts +164 -12
- package/browser/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts +26 -4
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/browser/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/browser/generators/builders/P2WDAGenerator.d.ts +42 -4
- package/browser/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/browser/index.d.ts +1 -0
- package/browser/index.d.ts.map +1 -0
- package/browser/index.js +3921 -3450
- package/browser/keypair/Address.d.ts +283 -13
- package/browser/keypair/Address.d.ts.map +1 -0
- package/browser/keypair/AddressVerificator.d.ts +7 -6
- package/browser/keypair/AddressVerificator.d.ts.map +1 -0
- package/browser/keypair/EcKeyPair.d.ts +183 -20
- package/browser/keypair/EcKeyPair.d.ts.map +1 -0
- package/browser/keypair/MessageSigner.d.ts +17 -16
- package/browser/keypair/MessageSigner.d.ts.map +1 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/browser/keypair/Wallet.d.ts +27 -13
- package/browser/keypair/Wallet.d.ts.map +1 -0
- package/browser/keypair/interfaces/IWallet.d.ts +19 -0
- package/browser/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/browser/metadata/ContractBaseMetadata.d.ts +10 -2
- package/browser/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/browser/mnemonic/BIPStandard.d.ts +59 -0
- package/browser/mnemonic/BIPStandard.d.ts.map +1 -0
- package/browser/mnemonic/Mnemonic.d.ts +15 -3
- package/browser/mnemonic/Mnemonic.d.ts.map +1 -0
- package/browser/mnemonic/MnemonicStrength.d.ts +6 -0
- package/browser/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/browser/network/ChainId.d.ts +1 -0
- package/browser/network/ChainId.d.ts.map +1 -0
- package/browser/noble-curves.js +920 -2966
- package/browser/noble-hashes.js +2067 -1038
- package/browser/opnet.d.ts +25 -1
- package/browser/opnet.d.ts.map +1 -0
- package/browser/p2wda/P2WDADetector.d.ts +36 -9
- package/browser/p2wda/P2WDADetector.d.ts.map +1 -0
- package/browser/polyfill/disposable.d.ts +16 -0
- package/browser/polyfill/disposable.d.ts.map +1 -0
- package/browser/signer/AddressRotation.d.ts +36 -0
- package/browser/signer/AddressRotation.d.ts.map +1 -0
- package/browser/signer/IRotationSigner.d.ts +27 -3
- package/browser/signer/IRotationSigner.d.ts.map +1 -0
- package/browser/signer/ParallelSignerAdapter.d.ts +14 -0
- package/browser/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/browser/signer/SignerUtils.d.ts +11 -4
- package/browser/signer/SignerUtils.d.ts.map +1 -0
- package/browser/signer/TweakedSigner.d.ts +28 -4
- package/browser/signer/TweakedSigner.d.ts.map +1 -0
- package/browser/transaction/ContractAddress.d.ts +2 -2
- package/browser/transaction/ContractAddress.d.ts.map +1 -0
- package/browser/transaction/TransactionFactory.d.ts +140 -2
- package/browser/transaction/TransactionFactory.d.ts.map +1 -0
- package/browser/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/browser/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/browser/transaction/browser/Web3Provider.d.ts +27 -0
- package/browser/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/XverseSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/browser/transaction/browser/types/OPWallet.d.ts +10 -0
- package/browser/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/browser/transaction/builders/CancelTransaction.d.ts +29 -4
- package/browser/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +137 -10
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/CustomScriptTransaction.d.ts +106 -6
- package/browser/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/DeploymentTransaction.d.ts +116 -5
- package/browser/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/FundingTransaction.d.ts +5 -3
- package/browser/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransaction.d.ts +12 -3
- package/browser/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +56 -5
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/browser/transaction/builders/MultiSignTransaction.d.ts +125 -16
- package/browser/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +103 -15
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/TransactionBuilder.d.ts +238 -15
- package/browser/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/browser/transaction/enums/TransactionType.d.ts +1 -0
- package/browser/transaction/enums/TransactionType.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts +2 -1
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +46 -3
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts +6 -4
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionParameters.d.ts +33 -10
- package/browser/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts +17 -5
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts +26 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/browser/transaction/interfaces/Tap.d.ts +4 -3
- package/browser/transaction/interfaces/Tap.d.ts.map +1 -0
- package/browser/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/browser/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/browser/transaction/mineable/TimelockGenerator.d.ts +12 -3
- package/browser/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/browser/transaction/offline/OfflineTransactionManager.d.ts +190 -9
- package/browser/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionReconstructor.d.ts +53 -3
- package/browser/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionSerializer.d.ts +53 -2
- package/browser/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionStateCapture.d.ts +64 -5
- package/browser/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts +71 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts +76 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/browser/transaction/shared/P2TR_MS.d.ts +11 -2
- package/browser/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/browser/transaction/shared/TweakedTransaction.d.ts +274 -33
- package/browser/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/browser/transaction/utils/WitnessUtils.d.ts +7 -1
- package/browser/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/browser/utils/BitcoinUtils.d.ts +19 -0
- package/browser/utils/BitcoinUtils.d.ts.map +1 -0
- package/browser/utils/BufferHelper.d.ts +1 -0
- package/browser/utils/BufferHelper.d.ts.map +1 -0
- package/browser/utils/StringToBuffer.d.ts +1 -0
- package/browser/utils/StringToBuffer.d.ts.map +1 -0
- package/browser/utils/lengths.d.ts +1 -0
- package/browser/utils/lengths.d.ts.map +1 -0
- package/browser/utils/types.d.ts +1 -0
- package/browser/utils/types.d.ts.map +1 -0
- package/browser/utxo/OPNetLimitedProvider.d.ts +37 -1
- package/browser/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/browser/utxo/interfaces/IUTXO.d.ts +11 -5
- package/browser/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/browser/vendors.js +13940 -9389
- package/browser/verification/TapscriptVerificator.d.ts +10 -8
- package/browser/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/_version.d.ts +2 -1
- package/build/_version.d.ts.map +1 -0
- package/build/_version.js +2 -1
- package/build/_version.js.map +1 -0
- package/build/abi/ABICoder.d.ts +15 -36
- package/build/abi/ABICoder.d.ts.map +1 -0
- package/build/abi/ABICoder.js +120 -143
- package/build/abi/ABICoder.js.map +1 -0
- package/build/abi/ABIDataTypes.d.ts +35 -0
- package/build/abi/ABIDataTypes.d.ts.map +1 -0
- package/build/abi/ABIDataTypes.js +42 -0
- package/build/abi/ABIDataTypes.js.map +1 -0
- package/build/abi/AbiTypes.d.ts +50 -0
- package/build/abi/AbiTypes.d.ts.map +1 -0
- package/build/abi/AbiTypes.js +78 -0
- package/build/abi/AbiTypes.js.map +1 -0
- package/build/abi/TupleUtils.d.ts +25 -0
- package/build/abi/TupleUtils.d.ts.map +1 -0
- package/build/abi/TupleUtils.js +50 -0
- package/build/abi/TupleUtils.js.map +1 -0
- package/build/branded/Branded.d.ts +4 -0
- package/build/branded/Branded.d.ts.map +1 -0
- package/build/branded/Branded.js +2 -0
- package/build/branded/Branded.js.map +1 -0
- package/build/buffer/BinaryReader.d.ts +121 -2
- package/build/buffer/BinaryReader.d.ts.map +1 -0
- package/build/buffer/BinaryReader.js +129 -5
- package/build/buffer/BinaryReader.js.map +1 -0
- package/build/buffer/BinaryWriter.d.ts +52 -2
- package/build/buffer/BinaryWriter.d.ts.map +1 -0
- package/build/buffer/BinaryWriter.js +62 -2
- package/build/buffer/BinaryWriter.js.map +1 -0
- package/build/bytecode/Compressor.d.ts +12 -0
- package/build/bytecode/Compressor.d.ts.map +1 -0
- package/build/bytecode/Compressor.js +17 -5
- package/build/bytecode/Compressor.js.map +1 -0
- package/build/chain/ChainData.d.ts +2 -2
- package/build/chain/ChainData.d.ts.map +1 -0
- package/build/chain/ChainData.js +37 -16
- package/build/chain/ChainData.js.map +1 -0
- package/build/consensus/Consensus.d.ts +11 -3
- package/build/consensus/Consensus.d.ts.map +1 -0
- package/build/consensus/Consensus.js +8 -0
- package/build/consensus/Consensus.js.map +1 -0
- package/build/consensus/ConsensusConfig.d.ts +2 -1
- package/build/consensus/ConsensusConfig.d.ts.map +1 -0
- package/build/consensus/ConsensusConfig.js +1 -0
- package/build/consensus/ConsensusConfig.js.map +1 -0
- package/build/consensus/IConsensusConfig.d.ts +1 -0
- package/build/consensus/IConsensusConfig.d.ts.map +1 -0
- package/build/consensus/IConsensusConfig.js +2 -1
- package/build/consensus/IConsensusConfig.js.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.d.ts +2 -1
- package/build/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.js +2 -0
- package/build/consensus/metadata/RoswellConsensus.js.map +1 -0
- package/build/crypto/crypto.d.ts +1 -0
- package/build/crypto/crypto.d.ts.map +1 -0
- package/build/crypto/crypto.js +1 -0
- package/build/crypto/crypto.js.map +1 -0
- package/build/deterministic/AddressMap.d.ts +6 -1
- package/build/deterministic/AddressMap.d.ts.map +1 -0
- package/build/deterministic/AddressMap.js +8 -0
- package/build/deterministic/AddressMap.js.map +1 -0
- package/build/deterministic/AddressSet.d.ts +3 -1
- package/build/deterministic/AddressSet.d.ts.map +1 -0
- package/build/deterministic/AddressSet.js +7 -0
- package/build/deterministic/AddressSet.js.map +1 -0
- package/build/deterministic/CustomMap.d.ts +3 -1
- package/build/deterministic/CustomMap.d.ts.map +1 -0
- package/build/deterministic/CustomMap.js +65 -47
- package/build/deterministic/CustomMap.js.map +1 -0
- package/build/deterministic/DeterministicMap.d.ts +4 -2
- package/build/deterministic/DeterministicMap.d.ts.map +1 -0
- package/build/deterministic/DeterministicMap.js +24 -27
- package/build/deterministic/DeterministicMap.js.map +1 -0
- package/build/deterministic/DeterministicSet.d.ts +3 -1
- package/build/deterministic/DeterministicSet.d.ts.map +1 -0
- package/build/deterministic/DeterministicSet.js +6 -0
- package/build/deterministic/DeterministicSet.js.map +1 -0
- package/build/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/build/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/build/deterministic/ExtendedAddressMap.js +18 -2
- package/build/deterministic/ExtendedAddressMap.js.map +1 -0
- package/build/deterministic/FastMap.d.ts +7 -1
- package/build/deterministic/FastMap.d.ts.map +1 -0
- package/build/deterministic/FastMap.js +7 -2
- package/build/deterministic/FastMap.js.map +1 -0
- package/build/ecc/backend.d.ts +13 -0
- package/build/ecc/backend.d.ts.map +1 -0
- package/build/ecc/backend.js +15 -0
- package/build/ecc/backend.js.map +1 -0
- package/build/epoch/ChallengeSolution.d.ts +34 -2
- package/build/epoch/ChallengeSolution.d.ts.map +1 -0
- package/build/epoch/ChallengeSolution.js +52 -0
- package/build/epoch/ChallengeSolution.js.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/build/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.js +2 -1
- package/build/epoch/interfaces/IChallengeSolution.js.map +1 -0
- package/build/epoch/validator/EpochValidator.d.ts +38 -8
- package/build/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/build/epoch/validator/EpochValidator.js +45 -19
- package/build/epoch/validator/EpochValidator.js.map +1 -0
- package/build/event/NetEvent.d.ts +1 -0
- package/build/event/NetEvent.d.ts.map +1 -0
- package/build/event/NetEvent.js +3 -0
- package/build/event/NetEvent.js.map +1 -0
- package/build/generators/AddressGenerator.d.ts +4 -3
- package/build/generators/AddressGenerator.d.ts.map +1 -0
- package/build/generators/AddressGenerator.js +9 -4
- package/build/generators/AddressGenerator.js.map +1 -0
- package/build/generators/Features.d.ts +4 -3
- package/build/generators/Features.d.ts.map +1 -0
- package/build/generators/Features.js +1 -0
- package/build/generators/Features.js.map +1 -0
- package/build/generators/Generator.d.ts +47 -11
- package/build/generators/Generator.d.ts.map +1 -0
- package/build/generators/Generator.js +48 -12
- package/build/generators/Generator.js.map +1 -0
- package/build/generators/MLDSAData.d.ts +1 -0
- package/build/generators/MLDSAData.d.ts.map +1 -0
- package/build/generators/MLDSAData.js +1 -0
- package/build/generators/MLDSAData.js.map +1 -0
- package/build/generators/builders/CalldataGenerator.d.ts +27 -6
- package/build/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/CalldataGenerator.js +33 -4
- package/build/generators/builders/CalldataGenerator.js.map +1 -0
- package/build/generators/builders/CustomGenerator.d.ts +13 -3
- package/build/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/build/generators/builders/CustomGenerator.js +11 -0
- package/build/generators/builders/CustomGenerator.js.map +1 -0
- package/build/generators/builders/DeploymentGenerator.d.ts +17 -6
- package/build/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/build/generators/builders/DeploymentGenerator.js +18 -2
- package/build/generators/builders/DeploymentGenerator.js.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.d.ts +166 -14
- package/build/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.js +193 -27
- package/build/generators/builders/HashCommitmentGenerator.js.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.d.ts +27 -5
- package/build/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.js +35 -5
- package/build/generators/builders/LegacyCalldataGenerator.js.map +1 -0
- package/build/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/build/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/build/generators/builders/MultiSignGenerator.js +20 -10
- package/build/generators/builders/MultiSignGenerator.js.map +1 -0
- package/build/generators/builders/P2WDAGenerator.d.ts +44 -6
- package/build/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/build/generators/builders/P2WDAGenerator.js +41 -2
- package/build/generators/builders/P2WDAGenerator.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -0
- package/build/keypair/Address.d.ts +284 -14
- package/build/keypair/Address.d.ts.map +1 -0
- package/build/keypair/Address.js +447 -129
- package/build/keypair/Address.js.map +1 -0
- package/build/keypair/AddressVerificator.d.ts +7 -6
- package/build/keypair/AddressVerificator.d.ts.map +1 -0
- package/build/keypair/AddressVerificator.js +4 -5
- package/build/keypair/AddressVerificator.js.map +1 -0
- package/build/keypair/EcKeyPair.d.ts +185 -22
- package/build/keypair/EcKeyPair.d.ts.map +1 -0
- package/build/keypair/EcKeyPair.js +226 -49
- package/build/keypair/EcKeyPair.js.map +1 -0
- package/build/keypair/MessageSigner.d.ts +18 -17
- package/build/keypair/MessageSigner.d.ts.map +1 -0
- package/build/keypair/MessageSigner.js +34 -25
- package/build/keypair/MessageSigner.js.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.js +66 -0
- package/build/keypair/Secp256k1PointDeriver.js.map +1 -0
- package/build/keypair/Wallet.d.ts +29 -15
- package/build/keypair/Wallet.d.ts.map +1 -0
- package/build/keypair/Wallet.js +46 -14
- package/build/keypair/Wallet.js.map +1 -0
- package/build/keypair/interfaces/IWallet.d.ts +19 -0
- package/build/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/build/keypair/interfaces/IWallet.js +1 -0
- package/build/keypair/interfaces/IWallet.js.map +1 -0
- package/build/metadata/ContractBaseMetadata.d.ts +10 -2
- package/build/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/build/metadata/ContractBaseMetadata.js +10 -1
- package/build/metadata/ContractBaseMetadata.js.map +1 -0
- package/build/mnemonic/BIPStandard.d.ts +59 -0
- package/build/mnemonic/BIPStandard.d.ts.map +1 -0
- package/build/mnemonic/BIPStandard.js +59 -0
- package/build/mnemonic/BIPStandard.js.map +1 -0
- package/build/mnemonic/Mnemonic.d.ts +16 -4
- package/build/mnemonic/Mnemonic.d.ts.map +1 -0
- package/build/mnemonic/Mnemonic.js +35 -8
- package/build/mnemonic/Mnemonic.js.map +1 -0
- package/build/mnemonic/MnemonicStrength.d.ts +6 -0
- package/build/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/build/mnemonic/MnemonicStrength.js +6 -0
- package/build/mnemonic/MnemonicStrength.js.map +1 -0
- package/build/network/ChainId.d.ts +1 -0
- package/build/network/ChainId.d.ts.map +1 -0
- package/build/network/ChainId.js +1 -0
- package/build/network/ChainId.js.map +1 -0
- package/build/opnet.d.ts +29 -3
- package/build/opnet.d.ts.map +1 -0
- package/build/opnet.js +26 -0
- package/build/opnet.js.map +1 -0
- package/build/p2wda/P2WDADetector.d.ts +38 -11
- package/build/p2wda/P2WDADetector.d.ts.map +1 -0
- package/build/p2wda/P2WDADetector.js +43 -10
- package/build/p2wda/P2WDADetector.js.map +1 -0
- package/build/polyfill/disposable.d.ts +16 -0
- package/build/polyfill/disposable.d.ts.map +1 -0
- package/build/polyfill/disposable.js +23 -0
- package/build/polyfill/disposable.js.map +1 -0
- package/build/signer/AddressRotation.d.ts +37 -1
- package/build/signer/AddressRotation.d.ts.map +1 -0
- package/build/signer/AddressRotation.js +16 -0
- package/build/signer/AddressRotation.js.map +1 -0
- package/build/signer/IRotationSigner.d.ts +27 -3
- package/build/signer/IRotationSigner.d.ts.map +1 -0
- package/build/signer/IRotationSigner.js +2 -1
- package/build/signer/IRotationSigner.js.map +1 -0
- package/build/signer/ParallelSignerAdapter.d.ts +14 -0
- package/build/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/build/signer/ParallelSignerAdapter.js +51 -0
- package/build/signer/ParallelSignerAdapter.js.map +1 -0
- package/build/signer/SignerUtils.d.ts +11 -4
- package/build/signer/SignerUtils.d.ts.map +1 -0
- package/build/signer/SignerUtils.js +16 -0
- package/build/signer/SignerUtils.js.map +1 -0
- package/build/signer/TweakedSigner.d.ts +28 -4
- package/build/signer/TweakedSigner.d.ts.map +1 -0
- package/build/signer/TweakedSigner.js +23 -6
- package/build/signer/TweakedSigner.js.map +1 -0
- package/build/transaction/ContractAddress.d.ts +2 -2
- package/build/transaction/ContractAddress.d.ts.map +1 -0
- package/build/transaction/ContractAddress.js +4 -8
- package/build/transaction/ContractAddress.js.map +1 -0
- package/build/transaction/TransactionFactory.d.ts +147 -9
- package/build/transaction/TransactionFactory.d.ts.map +1 -0
- package/build/transaction/TransactionFactory.js +145 -26
- package/build/transaction/TransactionFactory.js.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/build/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.js +7 -0
- package/build/transaction/browser/BrowserSignerBase.js.map +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/build/transaction/browser/WalletNetworks.js +1 -0
- package/build/transaction/browser/WalletNetworks.js.map +1 -0
- package/build/transaction/browser/Web3Provider.d.ts +30 -3
- package/build/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/build/transaction/browser/Web3Provider.js +1 -0
- package/build/transaction/browser/Web3Provider.js.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.d.ts +11 -9
- package/build/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.js +27 -17
- package/build/transaction/browser/extensions/UnisatSigner.js.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.d.ts +10 -8
- package/build/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.js +25 -15
- package/build/transaction/browser/extensions/XverseSigner.js.map +1 -0
- package/build/transaction/browser/types/OPWallet.d.ts +12 -2
- package/build/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/build/transaction/browser/types/OPWallet.js +4 -0
- package/build/transaction/browser/types/OPWallet.js.map +1 -0
- package/build/transaction/browser/types/Unisat.d.ts +2 -1
- package/build/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/build/transaction/browser/types/Unisat.js +2 -0
- package/build/transaction/browser/types/Unisat.js.map +1 -0
- package/build/transaction/browser/types/Xverse.d.ts +1 -0
- package/build/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/build/transaction/browser/types/Xverse.js +1 -0
- package/build/transaction/browser/types/Xverse.js.map +1 -0
- package/build/transaction/builders/CancelTransaction.d.ts +31 -6
- package/build/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CancelTransaction.js +116 -33
- package/build/transaction/builders/CancelTransaction.js.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js +88 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +140 -13
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js +197 -20
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.d.ts +108 -8
- package/build/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.js +176 -39
- package/build/transaction/builders/CustomScriptTransaction.js.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.d.ts +120 -9
- package/build/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.js +194 -51
- package/build/transaction/builders/DeploymentTransaction.js.map +1 -0
- package/build/transaction/builders/FundingTransaction.d.ts +6 -4
- package/build/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/build/transaction/builders/FundingTransaction.js +50 -9
- package/build/transaction/builders/FundingTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransaction.d.ts +14 -5
- package/build/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransaction.js +18 -5
- package/build/transaction/builders/InteractionTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts +58 -7
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.js +95 -18
- package/build/transaction/builders/InteractionTransactionP2WDA.js.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.d.ts +126 -17
- package/build/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.js +201 -76
- package/build/transaction/builders/MultiSignTransaction.js.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +106 -18
- package/build/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.js +158 -40
- package/build/transaction/builders/SharedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/TransactionBuilder.d.ts +244 -20
- package/build/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/build/transaction/builders/TransactionBuilder.js +371 -152
- package/build/transaction/builders/TransactionBuilder.js.map +1 -0
- package/build/transaction/enums/TransactionType.d.ts +1 -0
- package/build/transaction/enums/TransactionType.d.ts.map +1 -0
- package/build/transaction/enums/TransactionType.js +1 -0
- package/build/transaction/enums/TransactionType.js.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts +3 -2
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +48 -5
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts +7 -5
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.d.ts +38 -15
- package/build/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.d.ts +3 -2
- package/build/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts +21 -8
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts +29 -3
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.js +2 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.js.map +1 -0
- package/build/transaction/interfaces/Tap.d.ts +4 -3
- package/build/transaction/interfaces/Tap.d.ts.map +1 -0
- package/build/transaction/interfaces/Tap.js +1 -0
- package/build/transaction/interfaces/Tap.js.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/build/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.d.ts +13 -4
- package/build/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.js +12 -3
- package/build/transaction/mineable/TimelockGenerator.js.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.d.ts +193 -12
- package/build/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.js +192 -8
- package/build/transaction/offline/OfflineTransactionManager.js.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.d.ts +56 -6
- package/build/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.js +111 -75
- package/build/transaction/offline/TransactionReconstructor.js.map +1 -0
- package/build/transaction/offline/TransactionSerializer.d.ts +54 -3
- package/build/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/build/transaction/offline/TransactionSerializer.js +206 -95
- package/build/transaction/offline/TransactionSerializer.js.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.d.ts +66 -7
- package/build/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.js +124 -60
- package/build/transaction/offline/TransactionStateCapture.js.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.d.ts +72 -1
- package/build/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.js +10 -1
- package/build/transaction/offline/interfaces/ISerializableState.js.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts +77 -1
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js +19 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js.map +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/build/transaction/psbt/PSBTTypes.js +1 -0
- package/build/transaction/psbt/PSBTTypes.js.map +1 -0
- package/build/transaction/shared/P2TR_MS.d.ts +11 -2
- package/build/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/build/transaction/shared/P2TR_MS.js +10 -0
- package/build/transaction/shared/P2TR_MS.js.map +1 -0
- package/build/transaction/shared/TweakedTransaction.d.ts +280 -38
- package/build/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/build/transaction/shared/TweakedTransaction.js +576 -114
- package/build/transaction/shared/TweakedTransaction.js.map +1 -0
- package/build/transaction/utils/WitnessUtils.d.ts +7 -1
- package/build/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/build/transaction/utils/WitnessUtils.js +17 -3
- package/build/transaction/utils/WitnessUtils.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/utils/BitcoinUtils.d.ts +19 -0
- package/build/utils/BitcoinUtils.d.ts.map +1 -0
- package/build/utils/BitcoinUtils.js +19 -0
- package/build/utils/BitcoinUtils.js.map +1 -0
- package/build/utils/BufferHelper.d.ts +2 -1
- package/build/utils/BufferHelper.d.ts.map +1 -0
- package/build/utils/BufferHelper.js +38 -32
- package/build/utils/BufferHelper.js.map +1 -0
- package/build/utils/StringToBuffer.d.ts +1 -0
- package/build/utils/StringToBuffer.d.ts.map +1 -0
- package/build/utils/StringToBuffer.js +1 -0
- package/build/utils/StringToBuffer.js.map +1 -0
- package/build/utils/lengths.d.ts +1 -0
- package/build/utils/lengths.d.ts.map +1 -0
- package/build/utils/lengths.js +1 -0
- package/build/utils/lengths.js.map +1 -0
- package/build/utils/types.d.ts +1 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -1
- package/build/utils/types.js.map +1 -0
- package/build/utxo/OPNetLimitedProvider.d.ts +39 -3
- package/build/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/build/utxo/OPNetLimitedProvider.js +43 -5
- package/build/utxo/OPNetLimitedProvider.js.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js.map +1 -0
- package/build/utxo/interfaces/IUTXO.d.ts +13 -7
- package/build/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/build/utxo/interfaces/IUTXO.js +1 -0
- package/build/utxo/interfaces/IUTXO.js.map +1 -0
- package/build/verification/TapscriptVerificator.d.ts +12 -10
- package/build/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/verification/TapscriptVerificator.js +28 -38
- package/build/verification/TapscriptVerificator.js.map +1 -0
- package/documentation/offline-transaction-signing.md +10 -8
- package/documentation/quantum-support/01-introduction.md +2 -2
- package/documentation/quantum-support/02-mnemonic-and-wallet.md +5 -3
- package/documentation/quantum-support/03-address-generation.md +6 -4
- package/documentation/quantum-support/04-message-signing.md +36 -43
- package/documentation/quantum-support/05-address-verification.md +13 -18
- package/documentation/quantum-support/README.md +1 -1
- package/documentation/transaction-building.md +9 -9
- package/eslint.config.js +0 -1
- package/package.json +16 -39
- package/src/_version.ts +1 -1
- package/src/abi/ABICoder.ts +131 -154
- package/src/abi/ABIDataTypes.ts +45 -0
- package/src/abi/AbiTypes.ts +183 -0
- package/src/abi/TupleUtils.ts +57 -0
- package/src/branded/Branded.ts +5 -0
- package/src/buffer/BinaryReader.ts +7 -7
- package/src/buffer/BinaryWriter.ts +29 -24
- package/src/bytecode/Compressor.ts +1 -1
- package/src/chain/ChainData.ts +36 -25
- package/src/consensus/ConsensusConfig.ts +1 -1
- package/src/consensus/IConsensusConfig.ts +0 -17
- package/src/consensus/metadata/RoswellConsensus.ts +1 -17
- package/src/crypto/crypto-browser.js +3 -4
- package/src/deterministic/AddressMap.ts +5 -1
- package/src/deterministic/AddressSet.ts +5 -1
- package/src/deterministic/CustomMap.ts +6 -2
- package/src/deterministic/DeterministicMap.ts +8 -4
- package/src/deterministic/DeterministicSet.ts +6 -2
- package/src/deterministic/ExtendedAddressMap.ts +9 -4
- package/src/deterministic/FastMap.ts +9 -5
- package/src/ecc/backend.ts +17 -0
- package/src/epoch/ChallengeSolution.ts +3 -3
- package/src/epoch/interfaces/IChallengeSolution.ts +13 -13
- package/src/epoch/validator/EpochValidator.ts +24 -43
- package/src/generators/AddressGenerator.ts +4 -7
- package/src/generators/Features.ts +3 -3
- package/src/generators/Generator.ts +42 -26
- package/src/generators/builders/CalldataGenerator.ts +26 -24
- package/src/generators/builders/CustomGenerator.ts +4 -4
- package/src/generators/builders/DeploymentGenerator.ts +25 -23
- package/src/generators/builders/HashCommitmentGenerator.ts +31 -31
- package/src/generators/builders/LegacyCalldataGenerator.ts +26 -24
- package/src/generators/builders/MultiSignGenerator.ts +12 -12
- package/src/generators/builders/P2WDAGenerator.ts +10 -10
- package/src/keypair/Address.ts +115 -72
- package/src/keypair/AddressVerificator.ts +14 -148
- package/src/keypair/EcKeyPair.ts +110 -111
- package/src/keypair/MessageSigner.ts +70 -150
- package/src/keypair/Wallet.ts +56 -241
- package/src/metadata/ContractBaseMetadata.ts +2 -2
- package/src/mnemonic/Mnemonic.ts +31 -222
- package/src/opnet.ts +15 -6
- package/src/p2wda/P2WDADetector.ts +23 -72
- package/src/polyfill/disposable.ts +29 -0
- package/src/signer/AddressRotation.ts +1 -1
- package/src/signer/IRotationSigner.ts +3 -3
- package/src/signer/ParallelSignerAdapter.ts +59 -0
- package/src/signer/SignerUtils.ts +4 -4
- package/src/signer/TweakedSigner.ts +26 -14
- package/src/transaction/ContractAddress.ts +3 -7
- package/src/transaction/TransactionFactory.ts +38 -53
- package/src/transaction/browser/BrowserSignerBase.ts +12 -6
- package/src/transaction/browser/Web3Provider.ts +3 -3
- package/src/transaction/browser/extensions/UnisatSigner.ts +52 -48
- package/src/transaction/browser/extensions/XverseSigner.ts +55 -38
- package/src/transaction/browser/types/OPWallet.ts +2 -2
- package/src/transaction/browser/types/Unisat.ts +1 -1
- package/src/transaction/builders/CancelTransaction.ts +59 -24
- package/src/transaction/builders/ChallengeSolutionTransaction.ts +3 -3
- package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +39 -34
- package/src/transaction/builders/CustomScriptTransaction.ts +79 -56
- package/src/transaction/builders/DeploymentTransaction.ts +82 -63
- package/src/transaction/builders/FundingTransaction.ts +53 -12
- package/src/transaction/builders/InteractionTransaction.ts +10 -10
- package/src/transaction/builders/InteractionTransactionP2WDA.ts +38 -40
- package/src/transaction/builders/MultiSignTransaction.ts +68 -61
- package/src/transaction/builders/SharedInteractionTransaction.ts +81 -57
- package/src/transaction/builders/TransactionBuilder.ts +159 -255
- package/src/transaction/interfaces/ICancelTransactionParameters.ts +2 -2
- package/src/transaction/interfaces/IConsolidatedTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ICustomTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ITransactionParameters.ts +28 -15
- package/src/transaction/interfaces/ITransactionResponses.ts +2 -2
- package/src/transaction/interfaces/ITweakedTransactionData.ts +17 -8
- package/src/transaction/interfaces/IWeb3ProviderTypes.ts +3 -3
- package/src/transaction/interfaces/Tap.ts +3 -3
- package/src/transaction/mineable/IP2WSHAddress.ts +1 -1
- package/src/transaction/mineable/TimelockGenerator.ts +19 -12
- package/src/transaction/offline/OfflineTransactionManager.ts +22 -23
- package/src/transaction/offline/TransactionReconstructor.ts +83 -91
- package/src/transaction/offline/TransactionSerializer.ts +151 -101
- package/src/transaction/offline/TransactionStateCapture.ts +83 -79
- package/src/transaction/offline/interfaces/ISerializableState.ts +1 -1
- package/src/transaction/offline/interfaces/ITypeSpecificData.ts +1 -1
- package/src/transaction/shared/P2TR_MS.ts +4 -4
- package/src/transaction/shared/TweakedTransaction.ts +318 -125
- package/src/transaction/utils/WitnessUtils.ts +18 -9
- package/src/utils/BufferHelper.ts +39 -37
- package/src/utxo/OPNetLimitedProvider.ts +9 -9
- package/src/utxo/interfaces/IUTXO.ts +7 -7
- package/src/verification/TapscriptVerificator.ts +73 -86
- package/test/add-refund-output.test.ts +535 -0
- package/test/address-rotation.test.ts +24 -24
- package/test/address.test.ts +12 -12
- package/test/addressmap.test.ts +30 -30
- package/test/binary-reader-writer.test.ts +8 -8
- package/test/browser/offline-transaction.test.ts +2206 -0
- package/test/browser/parallel-signing.test.ts +316 -0
- package/test/browser/setup.ts +11 -0
- package/test/browser/transaction-signing.test.ts +416 -0
- package/test/buffer-helper.test.ts +287 -0
- package/test/derivePath.test.ts +4 -3
- package/test/disposable.test.ts +279 -0
- package/test/fastmap-setall.test.ts +1 -1
- package/test/fastmap.test.ts +3 -3
- package/test/messagesigner-mldsa.test.ts +3 -3
- package/test/messagesigner-schnorr.test.ts +9 -9
- package/test/offline-transaction.test.ts +461 -288
- package/test/old/FastBigIntMap.ts +3 -3
- package/test/oldfastmap.test.ts +6 -6
- package/test/transaction-builders.test.ts +482 -0
- package/tsconfig.base.json +34 -18
- package/tsconfig.browser.json +15 -0
- package/tsconfig.json +3 -8
- package/vite.config.browser.ts +4 -5
- package/vitest.config.browser.ts +68 -0
- package/vitest.config.ts +1 -1
- package/browser/valibot.js +0 -4948
- package/tsconfig.webpack.json +0 -18
|
@@ -1,44 +1,49 @@
|
|
|
1
|
+
import type { Script } from '@btc-vision/bitcoin';
|
|
1
2
|
import bitcoin, {
|
|
3
|
+
equals,
|
|
4
|
+
fromHex,
|
|
2
5
|
getFinalScripts,
|
|
3
|
-
|
|
4
|
-
Network,
|
|
6
|
+
type Network,
|
|
5
7
|
opcodes,
|
|
6
8
|
Psbt,
|
|
7
|
-
PsbtInputExtended,
|
|
8
|
-
PsbtOutputExtended,
|
|
9
|
+
type PsbtInputExtended,
|
|
10
|
+
type PsbtOutputExtended,
|
|
9
11
|
script,
|
|
10
|
-
Signer,
|
|
12
|
+
type Signer,
|
|
13
|
+
toSatoshi,
|
|
11
14
|
toXOnly,
|
|
12
15
|
Transaction,
|
|
13
16
|
} from '@btc-vision/bitcoin';
|
|
14
17
|
import { witnessStackToScriptWitness } from '../utils/WitnessUtils.js';
|
|
15
|
-
import
|
|
16
|
-
import { UpdateInput } from '../interfaces/Tap.js';
|
|
18
|
+
import type { UpdateInput } from '../interfaces/Tap.js';
|
|
17
19
|
import { TransactionType } from '../enums/TransactionType.js';
|
|
18
|
-
import {
|
|
20
|
+
import type {
|
|
19
21
|
IFundingTransactionParameters,
|
|
20
22
|
ITransactionParameters,
|
|
21
23
|
} from '../interfaces/ITransactionParameters.js';
|
|
22
24
|
import { EcKeyPair } from '../../keypair/EcKeyPair.js';
|
|
23
|
-
import { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
24
|
-
import {
|
|
25
|
+
import type { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
26
|
+
import { type UniversalSigner } from '@btc-vision/ecpair';
|
|
25
27
|
import { AddressVerificator } from '../../keypair/AddressVerificator.js';
|
|
26
28
|
import { TweakedTransaction } from '../shared/TweakedTransaction.js';
|
|
27
29
|
import { UnisatSigner } from '../browser/extensions/UnisatSigner.js';
|
|
28
|
-
import { IP2WSHAddress } from '../mineable/IP2WSHAddress.js';
|
|
30
|
+
import type { IP2WSHAddress } from '../mineable/IP2WSHAddress.js';
|
|
29
31
|
import { P2WDADetector } from '../../p2wda/P2WDADetector.js';
|
|
30
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
type Feature,
|
|
34
|
+
FeaturePriority,
|
|
35
|
+
Features,
|
|
36
|
+
type MLDSALinkRequest,
|
|
37
|
+
} from '../../generators/Features.js';
|
|
31
38
|
import { BITCOIN_PROTOCOL_ID, getChainId } from '../../chain/ChainData.js';
|
|
32
39
|
import { BinaryWriter } from '../../buffer/BinaryWriter.js';
|
|
33
40
|
import { MLDSASecurityLevel } from '@btc-vision/bip32';
|
|
34
41
|
import { MessageSigner } from '../../keypair/MessageSigner.js';
|
|
35
42
|
import { getLevelFromPublicKeyLength } from '../../generators/MLDSAData.js';
|
|
36
43
|
|
|
37
|
-
initEccLib(ecc);
|
|
38
|
-
|
|
39
44
|
export const MINIMUM_AMOUNT_REWARD: bigint = 330n; //540n;
|
|
40
45
|
export const MINIMUM_AMOUNT_CA: bigint = 297n;
|
|
41
|
-
export const ANCHOR_SCRIPT =
|
|
46
|
+
export const ANCHOR_SCRIPT = fromHex('51024e73');
|
|
42
47
|
|
|
43
48
|
/**
|
|
44
49
|
* Allows to build a transaction like you would on Ethereum.
|
|
@@ -50,11 +55,11 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
50
55
|
public static readonly MINIMUM_DUST: bigint = 330n;
|
|
51
56
|
|
|
52
57
|
public abstract readonly type: T;
|
|
53
|
-
public readonly logColor: string = '#785def';
|
|
58
|
+
public override readonly logColor: string = '#785def';
|
|
54
59
|
public debugFees: boolean = false;
|
|
55
60
|
|
|
56
61
|
// Cancel script
|
|
57
|
-
public LOCK_LEAF_SCRIPT:
|
|
62
|
+
public LOCK_LEAF_SCRIPT: Script;
|
|
58
63
|
|
|
59
64
|
/**
|
|
60
65
|
* @description The overflow fees of the transaction
|
|
@@ -105,12 +110,12 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
105
110
|
/**
|
|
106
111
|
* @description The signer of the transaction
|
|
107
112
|
*/
|
|
108
|
-
protected readonly signer: Signer |
|
|
113
|
+
protected override readonly signer: Signer | UniversalSigner | UnisatSigner;
|
|
109
114
|
|
|
110
115
|
/**
|
|
111
116
|
* @description The network where the transaction will be broadcasted
|
|
112
117
|
*/
|
|
113
|
-
protected readonly network: Network;
|
|
118
|
+
protected override readonly network: Network;
|
|
114
119
|
|
|
115
120
|
/**
|
|
116
121
|
* @description The fee rate of the transaction
|
|
@@ -163,7 +168,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
163
168
|
*/
|
|
164
169
|
protected anchor: boolean;
|
|
165
170
|
|
|
166
|
-
protected note?:
|
|
171
|
+
protected note?: Uint8Array;
|
|
167
172
|
|
|
168
173
|
private optionalOutputsAdded: boolean = false;
|
|
169
174
|
|
|
@@ -188,7 +193,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
188
193
|
|
|
189
194
|
if (parameters.note) {
|
|
190
195
|
if (typeof parameters.note === 'string') {
|
|
191
|
-
this.note =
|
|
196
|
+
this.note = new TextEncoder().encode(parameters.note);
|
|
192
197
|
} else {
|
|
193
198
|
this.note = parameters.note;
|
|
194
199
|
}
|
|
@@ -219,7 +224,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
219
224
|
|
|
220
225
|
public static getFrom(
|
|
221
226
|
from: string | undefined,
|
|
222
|
-
keypair:
|
|
227
|
+
keypair: UniversalSigner | Signer,
|
|
223
228
|
network: Network,
|
|
224
229
|
): string {
|
|
225
230
|
return from || EcKeyPair.getTaprootAddress(keypair, network);
|
|
@@ -231,23 +236,34 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
231
236
|
* @protected
|
|
232
237
|
* @returns {Buffer}
|
|
233
238
|
*/
|
|
234
|
-
public static witnessStackToScriptWitness(witness:
|
|
239
|
+
public static witnessStackToScriptWitness(witness: Uint8Array[]): Uint8Array {
|
|
235
240
|
return witnessStackToScriptWitness(witness);
|
|
236
241
|
}
|
|
237
242
|
|
|
238
|
-
public
|
|
243
|
+
public override [Symbol.dispose](): void {
|
|
244
|
+
super[Symbol.dispose]();
|
|
245
|
+
|
|
246
|
+
this.updateInputs.length = 0;
|
|
247
|
+
this.outputs.length = 0;
|
|
248
|
+
this.feeOutput = null;
|
|
249
|
+
this.optionalOutputs = undefined;
|
|
250
|
+
this.utxos = [];
|
|
251
|
+
this.optionalInputs = [];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
public addOPReturn(buffer: Uint8Array): void {
|
|
239
255
|
const compileScript = script.compile([opcodes.OP_RETURN, buffer]);
|
|
240
256
|
|
|
241
257
|
this.addOutput({
|
|
242
|
-
value:
|
|
258
|
+
value: toSatoshi(0n),
|
|
243
259
|
script: compileScript,
|
|
244
260
|
});
|
|
245
261
|
}
|
|
246
262
|
|
|
247
263
|
public addAnchor(): void {
|
|
248
264
|
this.addOutput({
|
|
249
|
-
value:
|
|
250
|
-
script: ANCHOR_SCRIPT,
|
|
265
|
+
value: toSatoshi(0n),
|
|
266
|
+
script: ANCHOR_SCRIPT as Script,
|
|
251
267
|
});
|
|
252
268
|
}
|
|
253
269
|
|
|
@@ -266,10 +282,12 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
266
282
|
gasSatFee: this.gasSatFee ?? 0n,
|
|
267
283
|
from: this.from,
|
|
268
284
|
amount: this.estimatedFees,
|
|
269
|
-
optionalOutputs: this.optionalOutputs,
|
|
270
285
|
optionalInputs: this.optionalInputs,
|
|
271
286
|
mldsaSigner: null,
|
|
272
|
-
|
|
287
|
+
...(this.optionalOutputs !== undefined
|
|
288
|
+
? { optionalOutputs: this.optionalOutputs }
|
|
289
|
+
: {}),
|
|
290
|
+
} satisfies IFundingTransactionParameters;
|
|
273
291
|
}
|
|
274
292
|
|
|
275
293
|
/**
|
|
@@ -354,7 +372,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
354
372
|
this.transaction.addInputs(inputs, checkPartialSigs);
|
|
355
373
|
|
|
356
374
|
for (let i = 0; i < this.updateInputs.length; i++) {
|
|
357
|
-
this.transaction.updateInput(i, this.updateInputs[i]);
|
|
375
|
+
this.transaction.updateInput(i, this.updateInputs[i] as UpdateInput);
|
|
358
376
|
}
|
|
359
377
|
|
|
360
378
|
this.transaction.addOutputs(outputs);
|
|
@@ -393,25 +411,28 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
393
411
|
* @returns {void}
|
|
394
412
|
*/
|
|
395
413
|
public addOutput(output: PsbtOutputExtended, bypassMinCheck: boolean = false): void {
|
|
396
|
-
if (output.value ===
|
|
397
|
-
const
|
|
398
|
-
script:
|
|
414
|
+
if (output.value === toSatoshi(0n)) {
|
|
415
|
+
const scriptOutput = output as {
|
|
416
|
+
script: Uint8Array;
|
|
399
417
|
};
|
|
400
418
|
|
|
401
|
-
if (!
|
|
419
|
+
if (!scriptOutput.script || scriptOutput.script.length === 0) {
|
|
402
420
|
throw new Error('Output value is 0 and no script provided');
|
|
403
421
|
}
|
|
404
422
|
|
|
405
|
-
if (
|
|
423
|
+
if (scriptOutput.script.length < 2) {
|
|
406
424
|
throw new Error('Output script is too short');
|
|
407
425
|
}
|
|
408
426
|
|
|
409
|
-
if (
|
|
427
|
+
if (
|
|
428
|
+
scriptOutput.script[0] !== opcodes.OP_RETURN &&
|
|
429
|
+
!equals(scriptOutput.script, ANCHOR_SCRIPT)
|
|
430
|
+
) {
|
|
410
431
|
throw new Error(
|
|
411
432
|
'Output script must start with OP_RETURN or be an ANCHOR when value is 0',
|
|
412
433
|
);
|
|
413
434
|
}
|
|
414
|
-
} else if (!bypassMinCheck && output.value < TransactionBuilder.MINIMUM_DUST) {
|
|
435
|
+
} else if (!bypassMinCheck && BigInt(output.value) < TransactionBuilder.MINIMUM_DUST) {
|
|
415
436
|
throw new Error(
|
|
416
437
|
`Output value is less than the minimum dust ${output.value} < ${TransactionBuilder.MINIMUM_DUST}`,
|
|
417
438
|
);
|
|
@@ -460,26 +481,26 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
460
481
|
fakeTx.addInputs(inputs);
|
|
461
482
|
fakeTx.addOutputs(outputs);
|
|
462
483
|
|
|
463
|
-
const dummySchnorrSig =
|
|
464
|
-
const dummyEcdsaSig =
|
|
465
|
-
const dummyCompressedPubkey =
|
|
484
|
+
const dummySchnorrSig = new Uint8Array(64);
|
|
485
|
+
const dummyEcdsaSig = new Uint8Array(72);
|
|
486
|
+
const dummyCompressedPubkey = new Uint8Array(33).fill(2);
|
|
466
487
|
|
|
467
488
|
const finalizer = (inputIndex: number, input: PsbtInputExtended) => {
|
|
468
489
|
if (input.isPayToAnchor || this.anchorInputIndices.has(inputIndex)) {
|
|
469
490
|
return {
|
|
470
491
|
finalScriptSig: undefined,
|
|
471
|
-
finalScriptWitness:
|
|
492
|
+
finalScriptWitness: Uint8Array.from([0]),
|
|
472
493
|
};
|
|
473
494
|
}
|
|
474
495
|
|
|
475
496
|
if (input.witnessScript && P2WDADetector.isP2WDAWitnessScript(input.witnessScript)) {
|
|
476
497
|
// Create dummy witness stack for P2WDA
|
|
477
|
-
const dummyDataSlots:
|
|
498
|
+
const dummyDataSlots: Uint8Array[] = [];
|
|
478
499
|
for (let i = 0; i < 10; i++) {
|
|
479
|
-
dummyDataSlots.push(
|
|
500
|
+
dummyDataSlots.push(new Uint8Array(0));
|
|
480
501
|
}
|
|
481
502
|
|
|
482
|
-
const dummyEcdsaSig =
|
|
503
|
+
const dummyEcdsaSig = new Uint8Array(72);
|
|
483
504
|
return {
|
|
484
505
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
485
506
|
...dummyDataSlots,
|
|
@@ -490,11 +511,11 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
490
511
|
}
|
|
491
512
|
|
|
492
513
|
if (inputIndex === 0 && this.tapLeafScript) {
|
|
493
|
-
const dummySecret =
|
|
514
|
+
const dummySecret = new Uint8Array(32);
|
|
494
515
|
const dummyScript = this.tapLeafScript.script;
|
|
495
516
|
|
|
496
517
|
// A control block for a 2-leaf tree contains one 32-byte hash.
|
|
497
|
-
const dummyControlBlock =
|
|
518
|
+
const dummyControlBlock = new Uint8Array(1 + 32 + 32);
|
|
498
519
|
|
|
499
520
|
return {
|
|
500
521
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
@@ -560,14 +581,14 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
560
581
|
lastOp === opcodes.OP_CHECKMULTISIG
|
|
561
582
|
) {
|
|
562
583
|
const m = firstOp - opcodes.OP_1 + 1;
|
|
563
|
-
const signatures:
|
|
584
|
+
const signatures: Uint8Array[] = [];
|
|
564
585
|
for (let i = 0; i < m; i++) {
|
|
565
586
|
signatures.push(dummyEcdsaSig);
|
|
566
587
|
}
|
|
567
588
|
|
|
568
589
|
return {
|
|
569
590
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
570
|
-
|
|
591
|
+
new Uint8Array(0), // OP_0 due to multisig bug
|
|
571
592
|
...signatures,
|
|
572
593
|
input.witnessScript,
|
|
573
594
|
]),
|
|
@@ -587,7 +608,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
587
608
|
decompiled &&
|
|
588
609
|
decompiled.length === 2 &&
|
|
589
610
|
decompiled[0] === opcodes.OP_0 &&
|
|
590
|
-
|
|
611
|
+
decompiled[1] instanceof Uint8Array &&
|
|
591
612
|
decompiled[1].length === 20
|
|
592
613
|
) {
|
|
593
614
|
// P2SH-P2WPKH
|
|
@@ -609,8 +630,8 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
609
630
|
};
|
|
610
631
|
}
|
|
611
632
|
|
|
612
|
-
const
|
|
613
|
-
if (!
|
|
633
|
+
const inputScript = input.witnessUtxo?.script;
|
|
634
|
+
if (!inputScript) return { finalScriptSig: undefined, finalScriptWitness: undefined };
|
|
614
635
|
|
|
615
636
|
if (input.tapInternalKey) {
|
|
616
637
|
return {
|
|
@@ -620,7 +641,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
620
641
|
};
|
|
621
642
|
}
|
|
622
643
|
|
|
623
|
-
if (
|
|
644
|
+
if (inputScript.length === 22 && inputScript[0] === opcodes.OP_0) {
|
|
624
645
|
return {
|
|
625
646
|
finalScriptWitness: TransactionBuilder.witnessStackToScriptWitness([
|
|
626
647
|
dummyEcdsaSig,
|
|
@@ -641,7 +662,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
641
662
|
return getFinalScripts(
|
|
642
663
|
inputIndex,
|
|
643
664
|
input,
|
|
644
|
-
|
|
665
|
+
inputScript as Script,
|
|
645
666
|
true,
|
|
646
667
|
!!input.redeemScript,
|
|
647
668
|
!!input.witnessScript,
|
|
@@ -715,7 +736,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
715
736
|
|
|
716
737
|
let total = 0n;
|
|
717
738
|
for (let i = 0; i < this.optionalOutputs.length; i++) {
|
|
718
|
-
total += BigInt(this.optionalOutputs[i].value);
|
|
739
|
+
total += BigInt((this.optionalOutputs[i] as PsbtOutputExtended).value);
|
|
719
740
|
}
|
|
720
741
|
|
|
721
742
|
return total;
|
|
@@ -733,103 +754,59 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
733
754
|
this.addAnchor();
|
|
734
755
|
}
|
|
735
756
|
|
|
736
|
-
//
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
let iterations = 0;
|
|
740
|
-
const maxIterations = 5; // Prevent infinite loops
|
|
757
|
+
// Add a dummy change output to estimate fee with the change-output shape
|
|
758
|
+
this.feeOutput = this.createChangeOutput(TransactionBuilder.MINIMUM_DUST);
|
|
759
|
+
const feeWithChange = await this.estimateTransactionFees();
|
|
741
760
|
|
|
742
|
-
|
|
743
|
-
// Iterate until fee stabilizes
|
|
744
|
-
while (iterations < maxIterations && estimatedFee !== previousFee) {
|
|
745
|
-
previousFee = estimatedFee;
|
|
761
|
+
const sendBackAmount = this.totalInputAmount - amountSpent - feeWithChange;
|
|
746
762
|
|
|
747
|
-
|
|
748
|
-
|
|
763
|
+
if (this.debugFees) {
|
|
764
|
+
this.log(
|
|
765
|
+
`Fee with change: ${feeWithChange} sats, inputAmount=${this.totalInputAmount}, amountSpent=${amountSpent}, sendBackAmount=${sendBackAmount}`,
|
|
766
|
+
);
|
|
767
|
+
}
|
|
749
768
|
|
|
750
|
-
|
|
751
|
-
|
|
769
|
+
if (sendBackAmount >= TransactionBuilder.MINIMUM_DUST) {
|
|
770
|
+
// Change output is viable, set it to the real value
|
|
771
|
+
this.feeOutput = this.createChangeOutput(sendBackAmount);
|
|
772
|
+
this.overflowFees = sendBackAmount;
|
|
773
|
+
this.transactionFee = feeWithChange;
|
|
774
|
+
} else {
|
|
775
|
+
// Change output not viable, remove it and re-estimate without it
|
|
776
|
+
this.feeOutput = null;
|
|
777
|
+
this.overflowFees = 0n;
|
|
752
778
|
|
|
753
|
-
|
|
754
|
-
|
|
779
|
+
const feeWithoutChange = await this.estimateTransactionFees();
|
|
780
|
+
this.transactionFee = feeWithoutChange;
|
|
755
781
|
|
|
756
782
|
if (this.debugFees) {
|
|
757
|
-
this.
|
|
758
|
-
`
|
|
783
|
+
this.warn(
|
|
784
|
+
`Amount to send back (${sendBackAmount} sat) is less than minimum dust. Fee without change: ${feeWithoutChange} sats`,
|
|
759
785
|
);
|
|
760
786
|
}
|
|
761
787
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
this.feeOutput = {
|
|
767
|
-
value: Number(sendBackAmount),
|
|
768
|
-
address: this.from,
|
|
769
|
-
tapInternalKey: this.internalPubKeyToXOnly(),
|
|
770
|
-
};
|
|
771
|
-
} else if (AddressVerificator.isValidPublicKey(this.from, this.network)) {
|
|
772
|
-
const pubKeyScript = script.compile([
|
|
773
|
-
Buffer.from(this.from.replace('0x', ''), 'hex'),
|
|
774
|
-
opcodes.OP_CHECKSIG,
|
|
775
|
-
]);
|
|
776
|
-
|
|
777
|
-
this.feeOutput = {
|
|
778
|
-
value: Number(sendBackAmount),
|
|
779
|
-
script: pubKeyScript,
|
|
780
|
-
};
|
|
781
|
-
} else {
|
|
782
|
-
this.feeOutput = {
|
|
783
|
-
value: Number(sendBackAmount),
|
|
784
|
-
address: this.from,
|
|
785
|
-
};
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
// Set overflowFees when we have a change output
|
|
789
|
-
this.overflowFees = sendBackAmount;
|
|
790
|
-
} else {
|
|
791
|
-
// No change output if below dust
|
|
792
|
-
this.feeOutput = null;
|
|
793
|
-
this.overflowFees = 0n;
|
|
794
|
-
|
|
795
|
-
if (sendBackAmount < 0n && iterations === maxIterations) {
|
|
796
|
-
throw new Error(
|
|
797
|
-
`Insufficient funds: need ${totalSpent} sats but only have ${this.totalInputAmount} sats`,
|
|
798
|
-
);
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
if (this.debugFees) {
|
|
802
|
-
this.warn(
|
|
803
|
-
`Amount to send back (${sendBackAmount} sat) is less than minimum dust...`,
|
|
804
|
-
);
|
|
805
|
-
}
|
|
788
|
+
if (this.totalInputAmount <= amountSpent) {
|
|
789
|
+
throw new Error(
|
|
790
|
+
`Insufficient funds: need ${amountSpent + feeWithoutChange} sats but only have ${this.totalInputAmount} sats`,
|
|
791
|
+
);
|
|
806
792
|
}
|
|
807
793
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
`Insufficient funds: need at least ${-sendBackAmount} more sats to cover fees.`,
|
|
814
|
-
);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
if (iterations >= maxIterations) {
|
|
818
|
-
this.warn(`Fee calculation did not stabilize after ${maxIterations} iterations`);
|
|
794
|
+
if (expectRefund && sendBackAmount < 0n) {
|
|
795
|
+
throw new Error(
|
|
796
|
+
`Insufficient funds: need at least ${-sendBackAmount} more sats to cover fees.`,
|
|
797
|
+
);
|
|
798
|
+
}
|
|
819
799
|
}
|
|
820
800
|
|
|
821
|
-
// Store the final fee
|
|
822
|
-
this.transactionFee = estimatedFee;
|
|
823
|
-
|
|
824
801
|
if (this.debugFees) {
|
|
825
802
|
this.log(
|
|
826
|
-
`Final fee: ${
|
|
803
|
+
`Final fee: ${this.transactionFee} sats, Change output: ${this.feeOutput ? `${this.feeOutput.value} sats` : 'none'}`,
|
|
827
804
|
);
|
|
828
805
|
}
|
|
829
806
|
}
|
|
830
807
|
|
|
831
|
-
protected defineLockScript():
|
|
832
|
-
return script.compile([toXOnly(
|
|
808
|
+
protected defineLockScript(): Script {
|
|
809
|
+
return script.compile([toXOnly(this.signer.publicKey), opcodes.OP_CHECKSIG]);
|
|
833
810
|
}
|
|
834
811
|
|
|
835
812
|
/**
|
|
@@ -839,15 +816,19 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
839
816
|
* @returns {void}
|
|
840
817
|
*/
|
|
841
818
|
protected addValueToToOutput(value: number | bigint): void {
|
|
842
|
-
if (value < TransactionBuilder.MINIMUM_DUST) {
|
|
819
|
+
if (BigInt(value) < TransactionBuilder.MINIMUM_DUST) {
|
|
843
820
|
throw new Error(
|
|
844
821
|
`Value to send is less than the minimum dust ${value} < ${TransactionBuilder.MINIMUM_DUST}`,
|
|
845
822
|
);
|
|
846
823
|
}
|
|
847
824
|
|
|
848
|
-
for (
|
|
825
|
+
for (let i = 0; i < this.outputs.length; i++) {
|
|
826
|
+
const output = this.outputs[i] as PsbtOutputExtended;
|
|
849
827
|
if ('address' in output && output.address === this.to) {
|
|
850
|
-
|
|
828
|
+
this.outputs[i] = {
|
|
829
|
+
...output,
|
|
830
|
+
value: toSatoshi(BigInt(output.value) + BigInt(value)),
|
|
831
|
+
} as PsbtOutputExtended;
|
|
851
832
|
return;
|
|
852
833
|
}
|
|
853
834
|
}
|
|
@@ -855,7 +836,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
855
836
|
throw new Error('Output not found');
|
|
856
837
|
}
|
|
857
838
|
|
|
858
|
-
protected generateLegacySignature():
|
|
839
|
+
protected generateLegacySignature(): Uint8Array {
|
|
859
840
|
this.tweakSigner();
|
|
860
841
|
|
|
861
842
|
if (!this.tweakedSigner) {
|
|
@@ -888,10 +869,10 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
888
869
|
throw new Error('Could not verify generated legacy signature for MLDSA link request');
|
|
889
870
|
}
|
|
890
871
|
|
|
891
|
-
return
|
|
872
|
+
return new Uint8Array(signature.signature);
|
|
892
873
|
}
|
|
893
874
|
|
|
894
|
-
protected generateMLDSASignature():
|
|
875
|
+
protected generateMLDSASignature(): Uint8Array {
|
|
895
876
|
if (!this.mldsaSigner) {
|
|
896
877
|
throw new Error('MLDSA signer is not defined');
|
|
897
878
|
}
|
|
@@ -937,7 +918,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
937
918
|
throw new Error('Could not verify generated MLDSA signature for link request');
|
|
938
919
|
}
|
|
939
920
|
|
|
940
|
-
return
|
|
921
|
+
return new Uint8Array(signature.signature);
|
|
941
922
|
}
|
|
942
923
|
|
|
943
924
|
protected generateMLDSALinkRequest(
|
|
@@ -947,7 +928,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
947
928
|
const mldsaSigner = this.mldsaSigner;
|
|
948
929
|
const legacySignature = this.generateLegacySignature();
|
|
949
930
|
|
|
950
|
-
let mldsaSignature:
|
|
931
|
+
let mldsaSignature: Uint8Array | null = null;
|
|
951
932
|
if (parameters.revealMLDSAPublicKey) {
|
|
952
933
|
mldsaSignature = this.generateMLDSASignature();
|
|
953
934
|
}
|
|
@@ -1029,8 +1010,10 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1029
1010
|
let refundedFromOptionalOutputs: bigint = 0n;
|
|
1030
1011
|
|
|
1031
1012
|
for (let i = 0; i < this.optionalOutputs.length; i++) {
|
|
1032
|
-
this.addOutput(this.optionalOutputs[i]);
|
|
1033
|
-
refundedFromOptionalOutputs += BigInt(
|
|
1013
|
+
this.addOutput(this.optionalOutputs[i] as PsbtOutputExtended);
|
|
1014
|
+
refundedFromOptionalOutputs += BigInt(
|
|
1015
|
+
(this.optionalOutputs[i] as PsbtOutputExtended).value,
|
|
1016
|
+
);
|
|
1034
1017
|
}
|
|
1035
1018
|
|
|
1036
1019
|
this.optionalOutputsAdded = true;
|
|
@@ -1054,7 +1037,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1054
1037
|
}
|
|
1055
1038
|
|
|
1056
1039
|
for (let i = 0; i < this.utxos.length; i++) {
|
|
1057
|
-
const utxo = this.utxos[i];
|
|
1040
|
+
const utxo = this.utxos[i] as UTXO;
|
|
1058
1041
|
|
|
1059
1042
|
// Register signer BEFORE generating input (needed for tapInternalKey)
|
|
1060
1043
|
this.registerInputSigner(i, utxo);
|
|
@@ -1070,7 +1053,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1070
1053
|
i < this.optionalInputs.length + this.utxos.length;
|
|
1071
1054
|
i++
|
|
1072
1055
|
) {
|
|
1073
|
-
const utxo = this.optionalInputs[i - this.utxos.length];
|
|
1056
|
+
const utxo = this.optionalInputs[i - this.utxos.length] as UTXO;
|
|
1074
1057
|
|
|
1075
1058
|
// Register signer BEFORE generating input (needed for tapInternalKey)
|
|
1076
1059
|
this.registerInputSigner(i, utxo);
|
|
@@ -1133,7 +1116,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1133
1116
|
// ALWAYS THE FIRST INPUT.
|
|
1134
1117
|
this.addOutput(
|
|
1135
1118
|
{
|
|
1136
|
-
value:
|
|
1119
|
+
value: toSatoshi(amountToCA),
|
|
1137
1120
|
address: contractAddress,
|
|
1138
1121
|
},
|
|
1139
1122
|
true,
|
|
@@ -1146,7 +1129,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1146
1129
|
) {
|
|
1147
1130
|
this.addOutput(
|
|
1148
1131
|
{
|
|
1149
|
-
value:
|
|
1132
|
+
value: toSatoshi(amountSpent - amountToCA),
|
|
1150
1133
|
address: epochChallenge.address,
|
|
1151
1134
|
},
|
|
1152
1135
|
true,
|
|
@@ -1160,7 +1143,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1160
1143
|
|
|
1161
1144
|
this.addOutput(
|
|
1162
1145
|
{
|
|
1163
|
-
value:
|
|
1146
|
+
value: toSatoshi(amountToEpoch),
|
|
1164
1147
|
address: epochChallenge.address,
|
|
1165
1148
|
},
|
|
1166
1149
|
true,
|
|
@@ -1173,7 +1156,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1173
1156
|
* @protected
|
|
1174
1157
|
* @returns {Buffer}
|
|
1175
1158
|
*/
|
|
1176
|
-
protected getWitness():
|
|
1159
|
+
protected getWitness(): Uint8Array {
|
|
1177
1160
|
if (!this.tapData || !this.tapData.witness) {
|
|
1178
1161
|
throw new Error('Witness is required');
|
|
1179
1162
|
}
|
|
@@ -1182,7 +1165,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1182
1165
|
throw new Error('Witness is empty');
|
|
1183
1166
|
}
|
|
1184
1167
|
|
|
1185
|
-
return this.tapData.witness[this.tapData.witness.length - 1];
|
|
1168
|
+
return this.tapData.witness[this.tapData.witness.length - 1] as Uint8Array;
|
|
1186
1169
|
}
|
|
1187
1170
|
|
|
1188
1171
|
/**
|
|
@@ -1190,7 +1173,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1190
1173
|
* @protected
|
|
1191
1174
|
* @returns {Buffer}
|
|
1192
1175
|
*/
|
|
1193
|
-
protected getTapOutput():
|
|
1176
|
+
protected getTapOutput(): Uint8Array {
|
|
1194
1177
|
if (!this.tapData || !this.tapData.output) {
|
|
1195
1178
|
throw new Error('Tap data is required');
|
|
1196
1179
|
}
|
|
@@ -1216,110 +1199,6 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1216
1199
|
}
|
|
1217
1200
|
}
|
|
1218
1201
|
|
|
1219
|
-
/**
|
|
1220
|
-
* Set transaction fee output.
|
|
1221
|
-
* @param {PsbtOutputExtended} output - The output to set the fees
|
|
1222
|
-
* @protected
|
|
1223
|
-
* @returns {Promise<void>}
|
|
1224
|
-
*/
|
|
1225
|
-
protected async setFeeOutput(output: PsbtOutputExtended): Promise<void> {
|
|
1226
|
-
const initialValue = output.value;
|
|
1227
|
-
this.feeOutput = null; // Start with no fee output
|
|
1228
|
-
|
|
1229
|
-
let estimatedFee = 0n;
|
|
1230
|
-
let lastFee = -1n;
|
|
1231
|
-
|
|
1232
|
-
this.log(
|
|
1233
|
-
`setFeeOutput: Starting fee calculation for change. Initial available value: ${initialValue} sats.`,
|
|
1234
|
-
);
|
|
1235
|
-
|
|
1236
|
-
for (let i = 0; i < 3 && estimatedFee !== lastFee; i++) {
|
|
1237
|
-
lastFee = estimatedFee;
|
|
1238
|
-
estimatedFee = await this.estimateTransactionFees();
|
|
1239
|
-
const valueLeft = BigInt(initialValue) - estimatedFee;
|
|
1240
|
-
|
|
1241
|
-
if (this.debugFees) {
|
|
1242
|
-
this.log(
|
|
1243
|
-
` -> Iteration ${i + 1}: Estimated fee is ${estimatedFee} sats. Value left for change: ${valueLeft} sats.`,
|
|
1244
|
-
);
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
if (valueLeft >= TransactionBuilder.MINIMUM_DUST) {
|
|
1248
|
-
this.feeOutput = { ...output, value: Number(valueLeft) };
|
|
1249
|
-
this.overflowFees = valueLeft;
|
|
1250
|
-
} else {
|
|
1251
|
-
this.feeOutput = null;
|
|
1252
|
-
this.overflowFees = 0n;
|
|
1253
|
-
// Re-estimate fee one last time without the change output
|
|
1254
|
-
estimatedFee = await this.estimateTransactionFees();
|
|
1255
|
-
|
|
1256
|
-
if (this.debugFees) {
|
|
1257
|
-
this.log(
|
|
1258
|
-
` -> Change is less than dust. Final fee without change output: ${estimatedFee} sats.`,
|
|
1259
|
-
);
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
const finalValueLeft = BigInt(initialValue) - estimatedFee;
|
|
1265
|
-
|
|
1266
|
-
if (finalValueLeft < 0) {
|
|
1267
|
-
throw new Error(
|
|
1268
|
-
`setFeeOutput: Insufficient funds to pay the fees. Required fee: ${estimatedFee}, Available: ${initialValue}. Total input: ${this.totalInputAmount} sat`,
|
|
1269
|
-
);
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
if (finalValueLeft >= TransactionBuilder.MINIMUM_DUST) {
|
|
1273
|
-
this.feeOutput = { ...output, value: Number(finalValueLeft) };
|
|
1274
|
-
this.overflowFees = finalValueLeft;
|
|
1275
|
-
if (this.debugFees) {
|
|
1276
|
-
this.log(
|
|
1277
|
-
`setFeeOutput: Final change output set to ${finalValueLeft} sats. Final fee: ${estimatedFee} sats.`,
|
|
1278
|
-
);
|
|
1279
|
-
}
|
|
1280
|
-
} else {
|
|
1281
|
-
this.warn(
|
|
1282
|
-
`Amount to send back (${finalValueLeft} sat) is less than the minimum dust (${TransactionBuilder.MINIMUM_DUST} sat), it will be consumed in fees instead.`,
|
|
1283
|
-
);
|
|
1284
|
-
this.feeOutput = null;
|
|
1285
|
-
this.overflowFees = 0n;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
/*protected async setFeeOutput(output: PsbtOutputExtended): Promise<void> {
|
|
1289
|
-
const initialValue = output.value;
|
|
1290
|
-
|
|
1291
|
-
const fee = await this.estimateTransactionFees();
|
|
1292
|
-
output.value = initialValue - Number(fee);
|
|
1293
|
-
|
|
1294
|
-
if (output.value < TransactionBuilder.MINIMUM_DUST) {
|
|
1295
|
-
this.feeOutput = null;
|
|
1296
|
-
|
|
1297
|
-
if (output.value < 0) {
|
|
1298
|
-
throw new Error(
|
|
1299
|
-
`setFeeOutput: Insufficient funds to pay the fees. Fee: ${fee} < Value: ${initialValue}. Total input: ${this.totalInputAmount} sat`,
|
|
1300
|
-
);
|
|
1301
|
-
}
|
|
1302
|
-
} else {
|
|
1303
|
-
this.feeOutput = output;
|
|
1304
|
-
|
|
1305
|
-
const fee = await this.estimateTransactionFees();
|
|
1306
|
-
if (fee > BigInt(initialValue)) {
|
|
1307
|
-
throw new Error(
|
|
1308
|
-
`estimateTransactionFees: Insufficient funds to pay the fees. Fee: ${fee} > Value: ${initialValue}. Total input: ${this.totalInputAmount} sat`,
|
|
1309
|
-
);
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
const valueLeft = initialValue - Number(fee);
|
|
1313
|
-
if (valueLeft < TransactionBuilder.MINIMUM_DUST) {
|
|
1314
|
-
this.feeOutput = null;
|
|
1315
|
-
} else {
|
|
1316
|
-
this.feeOutput.value = valueLeft;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
this.overflowFees = BigInt(valueLeft);
|
|
1320
|
-
}
|
|
1321
|
-
}*/
|
|
1322
|
-
|
|
1323
1202
|
/**
|
|
1324
1203
|
* Builds the transaction.
|
|
1325
1204
|
* @param {Psbt} transaction - The transaction to build
|
|
@@ -1340,7 +1219,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1340
1219
|
transaction.addInputs(inputs, checkPartialSigs);
|
|
1341
1220
|
|
|
1342
1221
|
for (let i = 0; i < this.updateInputs.length; i++) {
|
|
1343
|
-
transaction.updateInput(i, this.updateInputs[i]);
|
|
1222
|
+
transaction.updateInput(i, this.updateInputs[i] as UpdateInput);
|
|
1344
1223
|
}
|
|
1345
1224
|
|
|
1346
1225
|
transaction.addOutputs(outputs);
|
|
@@ -1364,4 +1243,29 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
1364
1243
|
|
|
1365
1244
|
return false;
|
|
1366
1245
|
}
|
|
1246
|
+
|
|
1247
|
+
private createChangeOutput(amount: bigint): PsbtOutputExtended {
|
|
1248
|
+
if (AddressVerificator.isValidP2TRAddress(this.from, this.network)) {
|
|
1249
|
+
return {
|
|
1250
|
+
value: toSatoshi(amount),
|
|
1251
|
+
address: this.from,
|
|
1252
|
+
tapInternalKey: this.internalPubKeyToXOnly(),
|
|
1253
|
+
};
|
|
1254
|
+
} else if (AddressVerificator.isValidPublicKey(this.from, this.network)) {
|
|
1255
|
+
const pubKeyScript = script.compile([
|
|
1256
|
+
fromHex(this.from.replace('0x', '')),
|
|
1257
|
+
opcodes.OP_CHECKSIG,
|
|
1258
|
+
]);
|
|
1259
|
+
|
|
1260
|
+
return {
|
|
1261
|
+
value: toSatoshi(amount),
|
|
1262
|
+
script: pubKeyScript,
|
|
1263
|
+
};
|
|
1264
|
+
} else {
|
|
1265
|
+
return {
|
|
1266
|
+
value: toSatoshi(amount),
|
|
1267
|
+
address: this.from,
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1367
1271
|
}
|