@btc-vision/transaction 1.8.0-beta.3 → 1.8.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/_version.d.ts +1 -0
- package/browser/_version.d.ts.map +1 -0
- package/browser/abi/ABICoder.d.ts +1 -1
- package/browser/abi/ABICoder.d.ts.map +1 -0
- package/browser/branded/Branded.d.ts +4 -0
- package/browser/branded/Branded.d.ts.map +1 -0
- package/browser/btc-vision-bitcoin.js +11999 -2647
- package/browser/buffer/BinaryReader.d.ts +120 -1
- package/browser/buffer/BinaryReader.d.ts.map +1 -0
- package/browser/buffer/BinaryWriter.d.ts +51 -1
- package/browser/buffer/BinaryWriter.d.ts.map +1 -0
- package/browser/bytecode/Compressor.d.ts +12 -0
- package/browser/bytecode/Compressor.d.ts.map +1 -0
- package/browser/chain/ChainData.d.ts +2 -2
- package/browser/chain/ChainData.d.ts.map +1 -0
- package/browser/consensus/Consensus.d.ts +11 -3
- package/browser/consensus/Consensus.d.ts.map +1 -0
- package/browser/consensus/ConsensusConfig.d.ts +1 -0
- package/browser/consensus/ConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/IConsensusConfig.d.ts +1 -0
- package/browser/consensus/IConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/browser/crypto/crypto.d.ts +1 -0
- package/browser/crypto/crypto.d.ts.map +1 -0
- package/browser/deterministic/AddressMap.d.ts +6 -1
- package/browser/deterministic/AddressMap.d.ts.map +1 -0
- package/browser/deterministic/AddressSet.d.ts +3 -1
- package/browser/deterministic/AddressSet.d.ts.map +1 -0
- package/browser/deterministic/CustomMap.d.ts +3 -1
- package/browser/deterministic/CustomMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicMap.d.ts +3 -1
- package/browser/deterministic/DeterministicMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicSet.d.ts +3 -1
- package/browser/deterministic/DeterministicSet.d.ts.map +1 -0
- package/browser/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/browser/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/browser/deterministic/FastMap.d.ts +7 -1
- package/browser/deterministic/FastMap.d.ts.map +1 -0
- package/browser/ecc/backend.d.ts +13 -0
- package/browser/ecc/backend.d.ts.map +1 -0
- package/browser/epoch/ChallengeSolution.d.ts +33 -1
- package/browser/epoch/ChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/browser/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/validator/EpochValidator.d.ts +37 -7
- package/browser/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/browser/event/NetEvent.d.ts +1 -0
- package/browser/event/NetEvent.d.ts.map +1 -0
- package/browser/generators/AddressGenerator.d.ts +4 -3
- package/browser/generators/AddressGenerator.d.ts.map +1 -0
- package/browser/generators/Features.d.ts +1 -0
- package/browser/generators/Features.d.ts.map +1 -0
- package/browser/generators/Generator.d.ts +46 -10
- package/browser/generators/Generator.d.ts.map +1 -0
- package/browser/generators/MLDSAData.d.ts +1 -0
- package/browser/generators/MLDSAData.d.ts.map +1 -0
- package/browser/generators/builders/CalldataGenerator.d.ts +25 -4
- package/browser/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/CustomGenerator.d.ts +13 -3
- package/browser/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/browser/generators/builders/DeploymentGenerator.d.ts +15 -4
- package/browser/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/HashCommitmentGenerator.d.ts +164 -12
- package/browser/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts +26 -4
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/browser/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/browser/generators/builders/P2WDAGenerator.d.ts +42 -4
- package/browser/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/browser/index.d.ts +1 -0
- package/browser/index.d.ts.map +1 -0
- package/browser/index.js +3558 -3167
- package/browser/keypair/Address.d.ts +283 -13
- package/browser/keypair/Address.d.ts.map +1 -0
- package/browser/keypair/AddressVerificator.d.ts +7 -6
- package/browser/keypair/AddressVerificator.d.ts.map +1 -0
- package/browser/keypair/EcKeyPair.d.ts +183 -21
- package/browser/keypair/EcKeyPair.d.ts.map +1 -0
- package/browser/keypair/MessageSigner.d.ts +17 -16
- package/browser/keypair/MessageSigner.d.ts.map +1 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/browser/keypair/Wallet.d.ts +27 -13
- package/browser/keypair/Wallet.d.ts.map +1 -0
- package/browser/keypair/interfaces/IWallet.d.ts +19 -0
- package/browser/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/browser/metadata/ContractBaseMetadata.d.ts +10 -2
- package/browser/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/browser/mnemonic/BIPStandard.d.ts +59 -0
- package/browser/mnemonic/BIPStandard.d.ts.map +1 -0
- package/browser/mnemonic/Mnemonic.d.ts +15 -3
- package/browser/mnemonic/Mnemonic.d.ts.map +1 -0
- package/browser/mnemonic/MnemonicStrength.d.ts +6 -0
- package/browser/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/browser/network/ChainId.d.ts +1 -0
- package/browser/network/ChainId.d.ts.map +1 -0
- package/browser/noble-curves.js +844 -2746
- package/browser/noble-hashes.js +1338 -2067
- package/browser/opnet.d.ts +22 -1
- package/browser/opnet.d.ts.map +1 -0
- package/browser/p2wda/P2WDADetector.d.ts +36 -9
- package/browser/p2wda/P2WDADetector.d.ts.map +1 -0
- package/browser/polyfill/disposable.d.ts +16 -0
- package/browser/polyfill/disposable.d.ts.map +1 -0
- package/browser/signer/AddressRotation.d.ts +36 -0
- package/browser/signer/AddressRotation.d.ts.map +1 -0
- package/browser/signer/IRotationSigner.d.ts +27 -3
- package/browser/signer/IRotationSigner.d.ts.map +1 -0
- package/browser/signer/ParallelSignerAdapter.d.ts +14 -0
- package/browser/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/browser/signer/SignerUtils.d.ts +11 -4
- package/browser/signer/SignerUtils.d.ts.map +1 -0
- package/browser/signer/TweakedSigner.d.ts +28 -4
- package/browser/signer/TweakedSigner.d.ts.map +1 -0
- package/browser/transaction/ContractAddress.d.ts +2 -2
- package/browser/transaction/ContractAddress.d.ts.map +1 -0
- package/browser/transaction/TransactionFactory.d.ts +140 -2
- package/browser/transaction/TransactionFactory.d.ts.map +1 -0
- package/browser/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/browser/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/browser/transaction/browser/Web3Provider.d.ts +27 -0
- package/browser/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/XverseSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/browser/transaction/browser/types/OPWallet.d.ts +10 -0
- package/browser/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/browser/transaction/builders/CancelTransaction.d.ts +29 -4
- package/browser/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +137 -10
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/CustomScriptTransaction.d.ts +106 -6
- package/browser/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/DeploymentTransaction.d.ts +116 -5
- package/browser/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/FundingTransaction.d.ts +4 -3
- package/browser/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransaction.d.ts +12 -3
- package/browser/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +56 -5
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/browser/transaction/builders/MultiSignTransaction.d.ts +125 -16
- package/browser/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +103 -15
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/TransactionBuilder.d.ts +243 -14
- package/browser/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/browser/transaction/enums/TransactionType.d.ts +1 -0
- package/browser/transaction/enums/TransactionType.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts +2 -1
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +46 -3
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts +6 -4
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionParameters.d.ts +22 -10
- package/browser/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts +17 -5
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts +26 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/browser/transaction/interfaces/Tap.d.ts +4 -3
- package/browser/transaction/interfaces/Tap.d.ts.map +1 -0
- package/browser/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/browser/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/browser/transaction/mineable/TimelockGenerator.d.ts +12 -3
- package/browser/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/browser/transaction/offline/OfflineTransactionManager.d.ts +190 -9
- package/browser/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionReconstructor.d.ts +53 -3
- package/browser/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionSerializer.d.ts +53 -2
- package/browser/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionStateCapture.d.ts +64 -5
- package/browser/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts +71 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts +76 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/browser/transaction/shared/P2TR_MS.d.ts +11 -2
- package/browser/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/browser/transaction/shared/TweakedTransaction.d.ts +274 -33
- package/browser/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/browser/transaction/utils/WitnessUtils.d.ts +7 -1
- package/browser/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/browser/utils/BitcoinUtils.d.ts +19 -0
- package/browser/utils/BitcoinUtils.d.ts.map +1 -0
- package/browser/utils/BufferHelper.d.ts +1 -0
- package/browser/utils/BufferHelper.d.ts.map +1 -0
- package/browser/utils/StringToBuffer.d.ts +1 -0
- package/browser/utils/StringToBuffer.d.ts.map +1 -0
- package/browser/utils/lengths.d.ts +1 -0
- package/browser/utils/lengths.d.ts.map +1 -0
- package/browser/utils/types.d.ts +1 -0
- package/browser/utils/types.d.ts.map +1 -0
- package/browser/utxo/OPNetLimitedProvider.d.ts +37 -1
- package/browser/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/browser/utxo/interfaces/IUTXO.d.ts +11 -5
- package/browser/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/browser/vendors.js +14351 -10031
- package/browser/verification/TapscriptVerificator.d.ts +10 -8
- package/browser/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/_version.d.ts +1 -0
- package/build/_version.d.ts.map +1 -0
- package/build/_version.js +1 -0
- package/build/_version.js.map +1 -0
- package/build/abi/ABICoder.d.ts +1 -1
- package/build/abi/ABICoder.d.ts.map +1 -0
- package/build/abi/ABICoder.js +9 -10
- package/build/abi/ABICoder.js.map +1 -0
- package/build/branded/Branded.d.ts +4 -0
- package/build/branded/Branded.d.ts.map +1 -0
- package/build/branded/Branded.js +2 -0
- package/build/branded/Branded.js.map +1 -0
- package/build/buffer/BinaryReader.d.ts +121 -2
- package/build/buffer/BinaryReader.d.ts.map +1 -0
- package/build/buffer/BinaryReader.js +129 -5
- package/build/buffer/BinaryReader.js.map +1 -0
- package/build/buffer/BinaryWriter.d.ts +52 -2
- package/build/buffer/BinaryWriter.d.ts.map +1 -0
- package/build/buffer/BinaryWriter.js +62 -2
- package/build/buffer/BinaryWriter.js.map +1 -0
- package/build/bytecode/Compressor.d.ts +12 -0
- package/build/bytecode/Compressor.d.ts.map +1 -0
- package/build/bytecode/Compressor.js +17 -5
- package/build/bytecode/Compressor.js.map +1 -0
- package/build/chain/ChainData.d.ts +2 -2
- package/build/chain/ChainData.d.ts.map +1 -0
- package/build/chain/ChainData.js +35 -17
- package/build/chain/ChainData.js.map +1 -0
- package/build/consensus/Consensus.d.ts +11 -3
- package/build/consensus/Consensus.d.ts.map +1 -0
- package/build/consensus/Consensus.js +8 -0
- package/build/consensus/Consensus.js.map +1 -0
- package/build/consensus/ConsensusConfig.d.ts +2 -1
- package/build/consensus/ConsensusConfig.d.ts.map +1 -0
- package/build/consensus/ConsensusConfig.js +1 -0
- package/build/consensus/ConsensusConfig.js.map +1 -0
- package/build/consensus/IConsensusConfig.d.ts +1 -0
- package/build/consensus/IConsensusConfig.d.ts.map +1 -0
- package/build/consensus/IConsensusConfig.js +2 -1
- package/build/consensus/IConsensusConfig.js.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.d.ts +2 -1
- package/build/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.js +2 -0
- package/build/consensus/metadata/RoswellConsensus.js.map +1 -0
- package/build/crypto/crypto.d.ts +1 -0
- package/build/crypto/crypto.d.ts.map +1 -0
- package/build/crypto/crypto.js +1 -0
- package/build/crypto/crypto.js.map +1 -0
- package/build/deterministic/AddressMap.d.ts +6 -1
- package/build/deterministic/AddressMap.d.ts.map +1 -0
- package/build/deterministic/AddressMap.js +8 -0
- package/build/deterministic/AddressMap.js.map +1 -0
- package/build/deterministic/AddressSet.d.ts +3 -1
- package/build/deterministic/AddressSet.d.ts.map +1 -0
- package/build/deterministic/AddressSet.js +7 -0
- package/build/deterministic/AddressSet.js.map +1 -0
- package/build/deterministic/CustomMap.d.ts +3 -1
- package/build/deterministic/CustomMap.d.ts.map +1 -0
- package/build/deterministic/CustomMap.js +65 -47
- package/build/deterministic/CustomMap.js.map +1 -0
- package/build/deterministic/DeterministicMap.d.ts +4 -2
- package/build/deterministic/DeterministicMap.d.ts.map +1 -0
- package/build/deterministic/DeterministicMap.js +24 -27
- package/build/deterministic/DeterministicMap.js.map +1 -0
- package/build/deterministic/DeterministicSet.d.ts +3 -1
- package/build/deterministic/DeterministicSet.d.ts.map +1 -0
- package/build/deterministic/DeterministicSet.js +6 -0
- package/build/deterministic/DeterministicSet.js.map +1 -0
- package/build/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/build/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/build/deterministic/ExtendedAddressMap.js +18 -2
- package/build/deterministic/ExtendedAddressMap.js.map +1 -0
- package/build/deterministic/FastMap.d.ts +7 -1
- package/build/deterministic/FastMap.d.ts.map +1 -0
- package/build/deterministic/FastMap.js +7 -2
- package/build/deterministic/FastMap.js.map +1 -0
- package/build/ecc/backend.d.ts +13 -0
- package/build/ecc/backend.d.ts.map +1 -0
- package/build/ecc/backend.js +15 -0
- package/build/ecc/backend.js.map +1 -0
- package/build/epoch/ChallengeSolution.d.ts +34 -2
- package/build/epoch/ChallengeSolution.d.ts.map +1 -0
- package/build/epoch/ChallengeSolution.js +52 -0
- package/build/epoch/ChallengeSolution.js.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/build/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.js +2 -1
- package/build/epoch/interfaces/IChallengeSolution.js.map +1 -0
- package/build/epoch/validator/EpochValidator.d.ts +38 -8
- package/build/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/build/epoch/validator/EpochValidator.js +45 -19
- package/build/epoch/validator/EpochValidator.js.map +1 -0
- package/build/event/NetEvent.d.ts +1 -0
- package/build/event/NetEvent.d.ts.map +1 -0
- package/build/event/NetEvent.js +3 -0
- package/build/event/NetEvent.js.map +1 -0
- package/build/generators/AddressGenerator.d.ts +4 -3
- package/build/generators/AddressGenerator.d.ts.map +1 -0
- package/build/generators/AddressGenerator.js +9 -4
- package/build/generators/AddressGenerator.js.map +1 -0
- package/build/generators/Features.d.ts +4 -3
- package/build/generators/Features.d.ts.map +1 -0
- package/build/generators/Features.js +1 -0
- package/build/generators/Features.js.map +1 -0
- package/build/generators/Generator.d.ts +47 -11
- package/build/generators/Generator.d.ts.map +1 -0
- package/build/generators/Generator.js +48 -12
- package/build/generators/Generator.js.map +1 -0
- package/build/generators/MLDSAData.d.ts +1 -0
- package/build/generators/MLDSAData.d.ts.map +1 -0
- package/build/generators/MLDSAData.js +1 -0
- package/build/generators/MLDSAData.js.map +1 -0
- package/build/generators/builders/CalldataGenerator.d.ts +27 -6
- package/build/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/CalldataGenerator.js +33 -4
- package/build/generators/builders/CalldataGenerator.js.map +1 -0
- package/build/generators/builders/CustomGenerator.d.ts +13 -3
- package/build/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/build/generators/builders/CustomGenerator.js +11 -0
- package/build/generators/builders/CustomGenerator.js.map +1 -0
- package/build/generators/builders/DeploymentGenerator.d.ts +17 -6
- package/build/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/build/generators/builders/DeploymentGenerator.js +18 -2
- package/build/generators/builders/DeploymentGenerator.js.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.d.ts +166 -14
- package/build/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.js +193 -27
- package/build/generators/builders/HashCommitmentGenerator.js.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.d.ts +27 -5
- package/build/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.js +35 -5
- package/build/generators/builders/LegacyCalldataGenerator.js.map +1 -0
- package/build/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/build/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/build/generators/builders/MultiSignGenerator.js +20 -10
- package/build/generators/builders/MultiSignGenerator.js.map +1 -0
- package/build/generators/builders/P2WDAGenerator.d.ts +44 -6
- package/build/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/build/generators/builders/P2WDAGenerator.js +41 -2
- package/build/generators/builders/P2WDAGenerator.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -0
- package/build/keypair/Address.d.ts +284 -14
- package/build/keypair/Address.d.ts.map +1 -0
- package/build/keypair/Address.js +446 -128
- package/build/keypair/Address.js.map +1 -0
- package/build/keypair/AddressVerificator.d.ts +7 -6
- package/build/keypair/AddressVerificator.d.ts.map +1 -0
- package/build/keypair/AddressVerificator.js +4 -5
- package/build/keypair/AddressVerificator.js.map +1 -0
- package/build/keypair/EcKeyPair.d.ts +185 -23
- package/build/keypair/EcKeyPair.d.ts.map +1 -0
- package/build/keypair/EcKeyPair.js +218 -50
- package/build/keypair/EcKeyPair.js.map +1 -0
- package/build/keypair/MessageSigner.d.ts +18 -17
- package/build/keypair/MessageSigner.d.ts.map +1 -0
- package/build/keypair/MessageSigner.js +34 -25
- package/build/keypair/MessageSigner.js.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.js +66 -0
- package/build/keypair/Secp256k1PointDeriver.js.map +1 -0
- package/build/keypair/Wallet.d.ts +29 -15
- package/build/keypair/Wallet.d.ts.map +1 -0
- package/build/keypair/Wallet.js +46 -14
- package/build/keypair/Wallet.js.map +1 -0
- package/build/keypair/interfaces/IWallet.d.ts +19 -0
- package/build/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/build/keypair/interfaces/IWallet.js +1 -0
- package/build/keypair/interfaces/IWallet.js.map +1 -0
- package/build/metadata/ContractBaseMetadata.d.ts +10 -2
- package/build/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/build/metadata/ContractBaseMetadata.js +10 -1
- package/build/metadata/ContractBaseMetadata.js.map +1 -0
- package/build/mnemonic/BIPStandard.d.ts +59 -0
- package/build/mnemonic/BIPStandard.d.ts.map +1 -0
- package/build/mnemonic/BIPStandard.js +59 -0
- package/build/mnemonic/BIPStandard.js.map +1 -0
- package/build/mnemonic/Mnemonic.d.ts +16 -4
- package/build/mnemonic/Mnemonic.d.ts.map +1 -0
- package/build/mnemonic/Mnemonic.js +35 -8
- package/build/mnemonic/Mnemonic.js.map +1 -0
- package/build/mnemonic/MnemonicStrength.d.ts +6 -0
- package/build/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/build/mnemonic/MnemonicStrength.js +6 -0
- package/build/mnemonic/MnemonicStrength.js.map +1 -0
- package/build/network/ChainId.d.ts +1 -0
- package/build/network/ChainId.d.ts.map +1 -0
- package/build/network/ChainId.js +1 -0
- package/build/network/ChainId.js.map +1 -0
- package/build/opnet.d.ts +26 -3
- package/build/opnet.d.ts.map +1 -0
- package/build/opnet.js +23 -0
- package/build/opnet.js.map +1 -0
- package/build/p2wda/P2WDADetector.d.ts +38 -11
- package/build/p2wda/P2WDADetector.d.ts.map +1 -0
- package/build/p2wda/P2WDADetector.js +43 -10
- package/build/p2wda/P2WDADetector.js.map +1 -0
- package/build/polyfill/disposable.d.ts +16 -0
- package/build/polyfill/disposable.d.ts.map +1 -0
- package/build/polyfill/disposable.js +23 -0
- package/build/polyfill/disposable.js.map +1 -0
- package/build/signer/AddressRotation.d.ts +37 -1
- package/build/signer/AddressRotation.d.ts.map +1 -0
- package/build/signer/AddressRotation.js +16 -0
- package/build/signer/AddressRotation.js.map +1 -0
- package/build/signer/IRotationSigner.d.ts +27 -3
- package/build/signer/IRotationSigner.d.ts.map +1 -0
- package/build/signer/IRotationSigner.js +2 -1
- package/build/signer/IRotationSigner.js.map +1 -0
- package/build/signer/ParallelSignerAdapter.d.ts +14 -0
- package/build/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/build/signer/ParallelSignerAdapter.js +51 -0
- package/build/signer/ParallelSignerAdapter.js.map +1 -0
- package/build/signer/SignerUtils.d.ts +11 -4
- package/build/signer/SignerUtils.d.ts.map +1 -0
- package/build/signer/SignerUtils.js +16 -0
- package/build/signer/SignerUtils.js.map +1 -0
- package/build/signer/TweakedSigner.d.ts +28 -4
- package/build/signer/TweakedSigner.d.ts.map +1 -0
- package/build/signer/TweakedSigner.js +23 -6
- package/build/signer/TweakedSigner.js.map +1 -0
- package/build/transaction/ContractAddress.d.ts +2 -2
- package/build/transaction/ContractAddress.d.ts.map +1 -0
- package/build/transaction/ContractAddress.js +4 -8
- package/build/transaction/ContractAddress.js.map +1 -0
- package/build/transaction/TransactionFactory.d.ts +147 -9
- package/build/transaction/TransactionFactory.d.ts.map +1 -0
- package/build/transaction/TransactionFactory.js +145 -26
- package/build/transaction/TransactionFactory.js.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/build/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.js +7 -0
- package/build/transaction/browser/BrowserSignerBase.js.map +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/build/transaction/browser/WalletNetworks.js +1 -0
- package/build/transaction/browser/WalletNetworks.js.map +1 -0
- package/build/transaction/browser/Web3Provider.d.ts +30 -3
- package/build/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/build/transaction/browser/Web3Provider.js +1 -0
- package/build/transaction/browser/Web3Provider.js.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.d.ts +11 -9
- package/build/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.js +27 -17
- package/build/transaction/browser/extensions/UnisatSigner.js.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.d.ts +10 -8
- package/build/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.js +25 -15
- package/build/transaction/browser/extensions/XverseSigner.js.map +1 -0
- package/build/transaction/browser/types/OPWallet.d.ts +12 -2
- package/build/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/build/transaction/browser/types/OPWallet.js +4 -0
- package/build/transaction/browser/types/OPWallet.js.map +1 -0
- package/build/transaction/browser/types/Unisat.d.ts +2 -1
- package/build/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/build/transaction/browser/types/Unisat.js +2 -0
- package/build/transaction/browser/types/Unisat.js.map +1 -0
- package/build/transaction/browser/types/Xverse.d.ts +1 -0
- package/build/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/build/transaction/browser/types/Xverse.js +1 -0
- package/build/transaction/browser/types/Xverse.js.map +1 -0
- package/build/transaction/builders/CancelTransaction.d.ts +31 -6
- package/build/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CancelTransaction.js +116 -33
- package/build/transaction/builders/CancelTransaction.js.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js +88 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +140 -13
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js +197 -20
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.d.ts +108 -8
- package/build/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.js +176 -39
- package/build/transaction/builders/CustomScriptTransaction.js.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.d.ts +120 -9
- package/build/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.js +194 -51
- package/build/transaction/builders/DeploymentTransaction.js.map +1 -0
- package/build/transaction/builders/FundingTransaction.d.ts +5 -4
- package/build/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/build/transaction/builders/FundingTransaction.js +15 -8
- package/build/transaction/builders/FundingTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransaction.d.ts +14 -5
- package/build/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransaction.js +18 -5
- package/build/transaction/builders/InteractionTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts +58 -7
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.js +95 -18
- package/build/transaction/builders/InteractionTransactionP2WDA.js.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.d.ts +126 -17
- package/build/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.js +201 -76
- package/build/transaction/builders/MultiSignTransaction.js.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +106 -18
- package/build/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.js +158 -40
- package/build/transaction/builders/SharedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/TransactionBuilder.d.ts +249 -19
- package/build/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/build/transaction/builders/TransactionBuilder.js +375 -60
- package/build/transaction/builders/TransactionBuilder.js.map +1 -0
- package/build/transaction/enums/TransactionType.d.ts +1 -0
- package/build/transaction/enums/TransactionType.d.ts.map +1 -0
- package/build/transaction/enums/TransactionType.js +1 -0
- package/build/transaction/enums/TransactionType.js.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts +3 -2
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +48 -5
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts +7 -5
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.d.ts +27 -15
- package/build/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.d.ts +3 -2
- package/build/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts +21 -8
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts +29 -3
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.js +2 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.js.map +1 -0
- package/build/transaction/interfaces/Tap.d.ts +4 -3
- package/build/transaction/interfaces/Tap.d.ts.map +1 -0
- package/build/transaction/interfaces/Tap.js +1 -0
- package/build/transaction/interfaces/Tap.js.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/build/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.d.ts +13 -4
- package/build/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.js +12 -3
- package/build/transaction/mineable/TimelockGenerator.js.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.d.ts +193 -12
- package/build/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.js +192 -8
- package/build/transaction/offline/OfflineTransactionManager.js.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.d.ts +56 -6
- package/build/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.js +111 -75
- package/build/transaction/offline/TransactionReconstructor.js.map +1 -0
- package/build/transaction/offline/TransactionSerializer.d.ts +54 -3
- package/build/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/build/transaction/offline/TransactionSerializer.js +206 -95
- package/build/transaction/offline/TransactionSerializer.js.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.d.ts +66 -7
- package/build/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.js +124 -60
- package/build/transaction/offline/TransactionStateCapture.js.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.d.ts +72 -1
- package/build/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.js +10 -1
- package/build/transaction/offline/interfaces/ISerializableState.js.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts +77 -1
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js +19 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js.map +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/build/transaction/psbt/PSBTTypes.js +1 -0
- package/build/transaction/psbt/PSBTTypes.js.map +1 -0
- package/build/transaction/shared/P2TR_MS.d.ts +11 -2
- package/build/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/build/transaction/shared/P2TR_MS.js +10 -0
- package/build/transaction/shared/P2TR_MS.js.map +1 -0
- package/build/transaction/shared/TweakedTransaction.d.ts +281 -38
- package/build/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/build/transaction/shared/TweakedTransaction.js +576 -114
- package/build/transaction/shared/TweakedTransaction.js.map +1 -0
- package/build/transaction/utils/WitnessUtils.d.ts +7 -1
- package/build/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/build/transaction/utils/WitnessUtils.js +17 -3
- package/build/transaction/utils/WitnessUtils.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/utils/BitcoinUtils.d.ts +19 -0
- package/build/utils/BitcoinUtils.d.ts.map +1 -0
- package/build/utils/BitcoinUtils.js +19 -0
- package/build/utils/BitcoinUtils.js.map +1 -0
- package/build/utils/BufferHelper.d.ts +2 -1
- package/build/utils/BufferHelper.d.ts.map +1 -0
- package/build/utils/BufferHelper.js +38 -32
- package/build/utils/BufferHelper.js.map +1 -0
- package/build/utils/StringToBuffer.d.ts +1 -0
- package/build/utils/StringToBuffer.d.ts.map +1 -0
- package/build/utils/StringToBuffer.js +1 -0
- package/build/utils/StringToBuffer.js.map +1 -0
- package/build/utils/lengths.d.ts +1 -0
- package/build/utils/lengths.d.ts.map +1 -0
- package/build/utils/lengths.js +1 -0
- package/build/utils/lengths.js.map +1 -0
- package/build/utils/types.d.ts +1 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -1
- package/build/utils/types.js.map +1 -0
- package/build/utxo/OPNetLimitedProvider.d.ts +39 -3
- package/build/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/build/utxo/OPNetLimitedProvider.js +43 -5
- package/build/utxo/OPNetLimitedProvider.js.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js.map +1 -0
- package/build/utxo/interfaces/IUTXO.d.ts +13 -7
- package/build/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/build/utxo/interfaces/IUTXO.js +1 -0
- package/build/utxo/interfaces/IUTXO.js.map +1 -0
- package/build/verification/TapscriptVerificator.d.ts +12 -10
- package/build/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/verification/TapscriptVerificator.js +28 -38
- package/build/verification/TapscriptVerificator.js.map +1 -0
- package/eslint.config.js +0 -1
- package/package.json +12 -35
- package/src/abi/ABICoder.ts +0 -13
- package/src/branded/Branded.ts +5 -0
- package/src/buffer/BinaryReader.ts +7 -7
- package/src/buffer/BinaryWriter.ts +29 -24
- package/src/bytecode/Compressor.ts +1 -1
- package/src/chain/ChainData.ts +34 -27
- package/src/consensus/ConsensusConfig.ts +1 -1
- package/src/consensus/IConsensusConfig.ts +0 -17
- package/src/consensus/metadata/RoswellConsensus.ts +1 -17
- package/src/deterministic/AddressMap.ts +5 -1
- package/src/deterministic/AddressSet.ts +5 -1
- package/src/deterministic/CustomMap.ts +6 -2
- package/src/deterministic/DeterministicMap.ts +8 -4
- package/src/deterministic/DeterministicSet.ts +6 -2
- package/src/deterministic/ExtendedAddressMap.ts +9 -4
- package/src/deterministic/FastMap.ts +9 -5
- package/src/ecc/backend.ts +17 -0
- package/src/epoch/ChallengeSolution.ts +3 -3
- package/src/epoch/interfaces/IChallengeSolution.ts +13 -13
- package/src/epoch/validator/EpochValidator.ts +24 -43
- package/src/generators/AddressGenerator.ts +4 -7
- package/src/generators/Features.ts +3 -3
- package/src/generators/Generator.ts +42 -26
- package/src/generators/builders/CalldataGenerator.ts +26 -24
- package/src/generators/builders/CustomGenerator.ts +4 -4
- package/src/generators/builders/DeploymentGenerator.ts +25 -23
- package/src/generators/builders/HashCommitmentGenerator.ts +31 -31
- package/src/generators/builders/LegacyCalldataGenerator.ts +26 -24
- package/src/generators/builders/MultiSignGenerator.ts +12 -12
- package/src/generators/builders/P2WDAGenerator.ts +10 -10
- package/src/keypair/Address.ts +114 -71
- package/src/keypair/AddressVerificator.ts +14 -148
- package/src/keypair/EcKeyPair.ts +104 -116
- package/src/keypair/MessageSigner.ts +70 -150
- package/src/keypair/Wallet.ts +56 -241
- package/src/metadata/ContractBaseMetadata.ts +2 -2
- package/src/mnemonic/Mnemonic.ts +31 -222
- package/src/opnet.ts +12 -6
- package/src/p2wda/P2WDADetector.ts +23 -72
- package/src/polyfill/disposable.ts +29 -0
- package/src/signer/AddressRotation.ts +1 -1
- package/src/signer/IRotationSigner.ts +3 -3
- package/src/signer/ParallelSignerAdapter.ts +59 -0
- package/src/signer/SignerUtils.ts +4 -4
- package/src/signer/TweakedSigner.ts +26 -14
- package/src/transaction/ContractAddress.ts +3 -7
- package/src/transaction/TransactionFactory.ts +28 -50
- package/src/transaction/browser/BrowserSignerBase.ts +12 -6
- package/src/transaction/browser/Web3Provider.ts +3 -3
- package/src/transaction/browser/extensions/UnisatSigner.ts +52 -48
- package/src/transaction/browser/extensions/XverseSigner.ts +55 -38
- package/src/transaction/browser/types/OPWallet.ts +2 -2
- package/src/transaction/browser/types/Unisat.ts +1 -1
- package/src/transaction/builders/CancelTransaction.ts +59 -24
- package/src/transaction/builders/ChallengeSolutionTransaction.ts +3 -3
- package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +39 -34
- package/src/transaction/builders/CustomScriptTransaction.ts +79 -56
- package/src/transaction/builders/DeploymentTransaction.ts +82 -63
- package/src/transaction/builders/FundingTransaction.ts +11 -11
- package/src/transaction/builders/InteractionTransaction.ts +10 -10
- package/src/transaction/builders/InteractionTransactionP2WDA.ts +38 -40
- package/src/transaction/builders/MultiSignTransaction.ts +68 -61
- package/src/transaction/builders/SharedInteractionTransaction.ts +81 -57
- package/src/transaction/builders/TransactionBuilder.ts +99 -81
- package/src/transaction/interfaces/ICancelTransactionParameters.ts +2 -2
- package/src/transaction/interfaces/IConsolidatedTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ICustomTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ITransactionParameters.ts +15 -15
- package/src/transaction/interfaces/ITransactionResponses.ts +2 -2
- package/src/transaction/interfaces/ITweakedTransactionData.ts +17 -8
- package/src/transaction/interfaces/IWeb3ProviderTypes.ts +3 -3
- package/src/transaction/interfaces/Tap.ts +3 -3
- package/src/transaction/mineable/IP2WSHAddress.ts +1 -1
- package/src/transaction/mineable/TimelockGenerator.ts +19 -12
- package/src/transaction/offline/OfflineTransactionManager.ts +22 -23
- package/src/transaction/offline/TransactionReconstructor.ts +83 -91
- package/src/transaction/offline/TransactionSerializer.ts +151 -101
- package/src/transaction/offline/TransactionStateCapture.ts +83 -79
- package/src/transaction/offline/interfaces/ISerializableState.ts +1 -1
- package/src/transaction/offline/interfaces/ITypeSpecificData.ts +1 -1
- package/src/transaction/shared/P2TR_MS.ts +4 -4
- package/src/transaction/shared/TweakedTransaction.ts +326 -124
- package/src/transaction/utils/WitnessUtils.ts +18 -9
- package/src/utils/BufferHelper.ts +39 -37
- package/src/utxo/OPNetLimitedProvider.ts +9 -9
- package/src/utxo/interfaces/IUTXO.ts +7 -7
- package/src/verification/TapscriptVerificator.ts +73 -86
- package/test/address-rotation.test.ts +24 -24
- package/test/address.test.ts +12 -12
- package/test/addressmap.test.ts +30 -30
- package/test/binary-reader-writer.test.ts +8 -8
- package/test/browser/offline-transaction.test.ts +2206 -0
- package/test/browser/parallel-signing.test.ts +316 -0
- package/test/browser/setup.ts +11 -0
- package/test/browser/transaction-signing.test.ts +416 -0
- package/test/buffer-helper.test.ts +287 -0
- package/test/derivePath.test.ts +4 -3
- package/test/disposable.test.ts +279 -0
- package/test/fastmap-setall.test.ts +1 -1
- package/test/fastmap.test.ts +3 -3
- package/test/messagesigner-mldsa.test.ts +3 -3
- package/test/messagesigner-schnorr.test.ts +9 -9
- package/test/offline-transaction.test.ts +461 -288
- package/test/old/FastBigIntMap.ts +3 -3
- package/test/oldfastmap.test.ts +6 -6
- package/test/transaction-builders.test.ts +321 -0
- package/tsconfig.base.json +34 -18
- package/tsconfig.browser.json +15 -0
- package/tsconfig.json +3 -8
- package/vite.config.browser.ts +4 -5
- package/vitest.config.browser.ts +68 -0
- package/vitest.config.ts +1 -1
- package/browser/valibot.js +0 -4948
- package/tsconfig.webpack.json +0 -18
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
import { describe, expect, it
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
TransactionReconstructor,
|
|
9
|
-
OfflineTransactionManager,
|
|
10
|
-
ReconstructionOptions,
|
|
11
|
-
// Interfaces
|
|
12
|
-
ISerializableTransactionState,
|
|
13
|
-
SerializedUTXO,
|
|
14
|
-
SerializedOutput,
|
|
15
|
-
SerializedBaseParams,
|
|
16
|
-
PrecomputedData,
|
|
17
|
-
SERIALIZATION_FORMAT_VERSION,
|
|
18
|
-
// Type-specific data
|
|
19
|
-
FundingSpecificData,
|
|
1
|
+
import { beforeAll, describe, expect, it } from 'vitest';
|
|
2
|
+
import { createHash } from 'crypto';
|
|
3
|
+
import { networks, payments, toHex } from '@btc-vision/bitcoin';
|
|
4
|
+
import { type UniversalSigner } from '@btc-vision/ecpair';
|
|
5
|
+
import type {
|
|
6
|
+
CancelSpecificData,
|
|
7
|
+
CustomScriptSpecificData,
|
|
20
8
|
DeploymentSpecificData,
|
|
9
|
+
FundingSpecificData,
|
|
21
10
|
InteractionSpecificData,
|
|
11
|
+
ISerializableTransactionState,
|
|
22
12
|
MultiSigSpecificData,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
PrecomputedData,
|
|
14
|
+
ReconstructionOptions,
|
|
15
|
+
SerializedBaseParams,
|
|
16
|
+
SerializedOutput,
|
|
17
|
+
SerializedUTXO,
|
|
18
|
+
UTXO,
|
|
19
|
+
} from '../build/opnet.js';
|
|
20
|
+
import {
|
|
21
|
+
ChainId,
|
|
22
|
+
createAddressRotation,
|
|
23
|
+
createSignerMap,
|
|
24
|
+
currentConsensus,
|
|
25
|
+
EcKeyPair,
|
|
26
|
+
FundingTransaction,
|
|
27
|
+
isCancelSpecificData,
|
|
28
|
+
isCustomScriptSpecificData,
|
|
26
29
|
isDeploymentSpecificData,
|
|
30
|
+
isFundingSpecificData,
|
|
27
31
|
isInteractionSpecificData,
|
|
28
32
|
isMultiSigSpecificData,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
OfflineTransactionManager,
|
|
34
|
+
SERIALIZATION_FORMAT_VERSION,
|
|
35
|
+
TransactionReconstructor,
|
|
36
|
+
TransactionSerializer,
|
|
37
|
+
TransactionStateCapture,
|
|
32
38
|
TransactionType,
|
|
33
|
-
FundingTransaction,
|
|
34
|
-
// Utilities
|
|
35
|
-
EcKeyPair,
|
|
36
|
-
createSignerMap,
|
|
37
|
-
createAddressRotation,
|
|
38
|
-
UTXO,
|
|
39
|
-
ChainId,
|
|
40
39
|
} from '../build/opnet.js';
|
|
41
|
-
import { currentConsensus } from '../build/opnet.js';
|
|
42
40
|
|
|
43
41
|
describe('Offline Transaction Signing', () => {
|
|
44
42
|
const network = networks.regtest;
|
|
45
43
|
|
|
46
44
|
// Test keypairs
|
|
47
|
-
let signer1:
|
|
48
|
-
let signer2:
|
|
49
|
-
let signer3:
|
|
50
|
-
let defaultSigner:
|
|
45
|
+
let signer1: UniversalSigner;
|
|
46
|
+
let signer2: UniversalSigner;
|
|
47
|
+
let signer3: UniversalSigner;
|
|
48
|
+
let defaultSigner: UniversalSigner;
|
|
51
49
|
|
|
52
50
|
let address1: string;
|
|
53
51
|
let address2: string;
|
|
@@ -79,7 +77,7 @@ describe('Offline Transaction Signing', () => {
|
|
|
79
77
|
outputIndex: index,
|
|
80
78
|
value,
|
|
81
79
|
scriptPubKey: {
|
|
82
|
-
hex: p2tr.output
|
|
80
|
+
hex: toHex(p2tr.output as Uint8Array),
|
|
83
81
|
address,
|
|
84
82
|
},
|
|
85
83
|
};
|
|
@@ -113,7 +111,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
113
111
|
transactionId: '0'.repeat(64),
|
|
114
112
|
outputIndex: 0,
|
|
115
113
|
value: '100000',
|
|
116
|
-
scriptPubKeyHex:
|
|
114
|
+
scriptPubKeyHex: toHex(
|
|
115
|
+
payments.p2tr({ address: address1, network }).output as Uint8Array,
|
|
116
|
+
),
|
|
117
117
|
scriptPubKeyAddress: address1,
|
|
118
118
|
},
|
|
119
119
|
],
|
|
@@ -138,7 +138,7 @@ describe('Offline Transaction Signing', () => {
|
|
|
138
138
|
const state = createMockSerializedState(TransactionType.FUNDING);
|
|
139
139
|
|
|
140
140
|
const serialized = TransactionSerializer.serialize(state);
|
|
141
|
-
expect(serialized).toBeInstanceOf(
|
|
141
|
+
expect(serialized).toBeInstanceOf(Uint8Array);
|
|
142
142
|
expect(serialized.length).toBeGreaterThan(32); // At least checksum size
|
|
143
143
|
|
|
144
144
|
const deserialized = TransactionSerializer.deserialize(serialized);
|
|
@@ -148,8 +148,15 @@ describe('Offline Transaction Signing', () => {
|
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
it('should preserve all header fields', () => {
|
|
151
|
-
const state = createMockSerializedState(
|
|
152
|
-
|
|
151
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
152
|
+
header: {
|
|
153
|
+
formatVersion: SERIALIZATION_FORMAT_VERSION,
|
|
154
|
+
consensusVersion: currentConsensus,
|
|
155
|
+
transactionType: TransactionType.FUNDING,
|
|
156
|
+
chainId: ChainId.Bitcoin,
|
|
157
|
+
timestamp: 1234567890123,
|
|
158
|
+
},
|
|
159
|
+
});
|
|
153
160
|
|
|
154
161
|
const deserialized = TransactionSerializer.deserialize(
|
|
155
162
|
TransactionSerializer.serialize(state),
|
|
@@ -163,7 +170,6 @@ describe('Offline Transaction Signing', () => {
|
|
|
163
170
|
});
|
|
164
171
|
|
|
165
172
|
it('should preserve all base params fields', () => {
|
|
166
|
-
const state = createMockSerializedState();
|
|
167
173
|
const baseParams: SerializedBaseParams = {
|
|
168
174
|
from: address1,
|
|
169
175
|
to: address2,
|
|
@@ -176,7 +182,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
176
182
|
anchor: true,
|
|
177
183
|
debugFees: true,
|
|
178
184
|
};
|
|
179
|
-
state
|
|
185
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
186
|
+
baseParams,
|
|
187
|
+
});
|
|
180
188
|
|
|
181
189
|
const deserialized = TransactionSerializer.deserialize(
|
|
182
190
|
TransactionSerializer.serialize(state),
|
|
@@ -195,8 +203,11 @@ describe('Offline Transaction Signing', () => {
|
|
|
195
203
|
});
|
|
196
204
|
|
|
197
205
|
it('should handle optional "to" field being undefined', () => {
|
|
198
|
-
const
|
|
199
|
-
|
|
206
|
+
const base = createMockSerializedState();
|
|
207
|
+
const { to: _to, ...baseParamsWithoutTo } = base.baseParams;
|
|
208
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
209
|
+
baseParams: baseParamsWithoutTo as SerializedBaseParams,
|
|
210
|
+
});
|
|
200
211
|
|
|
201
212
|
const deserialized = TransactionSerializer.deserialize(
|
|
202
213
|
TransactionSerializer.serialize(state),
|
|
@@ -217,77 +228,87 @@ describe('Offline Transaction Signing', () => {
|
|
|
217
228
|
nonWitnessUtxo: 'feed0003',
|
|
218
229
|
};
|
|
219
230
|
|
|
220
|
-
const state = createMockSerializedState(
|
|
221
|
-
|
|
231
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
232
|
+
utxos: [utxo],
|
|
233
|
+
});
|
|
222
234
|
|
|
223
235
|
const deserialized = TransactionSerializer.deserialize(
|
|
224
236
|
TransactionSerializer.serialize(state),
|
|
225
237
|
);
|
|
226
238
|
|
|
227
239
|
expect(deserialized.utxos).toHaveLength(1);
|
|
228
|
-
|
|
229
|
-
expect(
|
|
230
|
-
expect(
|
|
231
|
-
expect(
|
|
232
|
-
expect(
|
|
233
|
-
expect(
|
|
234
|
-
expect(
|
|
235
|
-
expect(
|
|
240
|
+
const utxo0 = deserialized.utxos[0] as SerializedUTXO;
|
|
241
|
+
expect(utxo0.transactionId).toBe(utxo.transactionId);
|
|
242
|
+
expect(utxo0.outputIndex).toBe(utxo.outputIndex);
|
|
243
|
+
expect(utxo0.value).toBe(utxo.value);
|
|
244
|
+
expect(utxo0.scriptPubKeyHex).toBe(utxo.scriptPubKeyHex);
|
|
245
|
+
expect(utxo0.scriptPubKeyAddress).toBe(utxo.scriptPubKeyAddress);
|
|
246
|
+
expect(utxo0.redeemScript).toBe(utxo.redeemScript);
|
|
247
|
+
expect(utxo0.witnessScript).toBe(utxo.witnessScript);
|
|
248
|
+
expect(utxo0.nonWitnessUtxo).toBe(utxo.nonWitnessUtxo);
|
|
236
249
|
});
|
|
237
250
|
|
|
238
251
|
it('should handle multiple UTXOs', () => {
|
|
239
|
-
const state = createMockSerializedState(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
252
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
253
|
+
utxos: [
|
|
254
|
+
{
|
|
255
|
+
transactionId: '1'.repeat(64),
|
|
256
|
+
outputIndex: 0,
|
|
257
|
+
value: '10000',
|
|
258
|
+
scriptPubKeyHex: 'aa',
|
|
259
|
+
scriptPubKeyAddress: address1,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
transactionId: '2'.repeat(64),
|
|
263
|
+
outputIndex: 1,
|
|
264
|
+
value: '20000',
|
|
265
|
+
scriptPubKeyHex: 'bb',
|
|
266
|
+
scriptPubKeyAddress: address2,
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
transactionId: '3'.repeat(64),
|
|
270
|
+
outputIndex: 2,
|
|
271
|
+
value: '30000',
|
|
272
|
+
scriptPubKeyHex: 'cc',
|
|
273
|
+
scriptPubKeyAddress: address3,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
});
|
|
263
277
|
|
|
264
278
|
const deserialized = TransactionSerializer.deserialize(
|
|
265
279
|
TransactionSerializer.serialize(state),
|
|
266
280
|
);
|
|
267
281
|
|
|
268
282
|
expect(deserialized.utxos).toHaveLength(3);
|
|
269
|
-
expect(deserialized.utxos[0].transactionId).toBe(
|
|
270
|
-
|
|
271
|
-
|
|
283
|
+
expect((deserialized.utxos[0] as SerializedUTXO).transactionId).toBe(
|
|
284
|
+
'1'.repeat(64),
|
|
285
|
+
);
|
|
286
|
+
expect((deserialized.utxos[1] as SerializedUTXO).transactionId).toBe(
|
|
287
|
+
'2'.repeat(64),
|
|
288
|
+
);
|
|
289
|
+
expect((deserialized.utxos[2] as SerializedUTXO).transactionId).toBe(
|
|
290
|
+
'3'.repeat(64),
|
|
291
|
+
);
|
|
272
292
|
});
|
|
273
293
|
|
|
274
294
|
it('should preserve optional inputs', () => {
|
|
275
|
-
const state = createMockSerializedState(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
295
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
296
|
+
optionalInputs: [
|
|
297
|
+
{
|
|
298
|
+
transactionId: 'f'.repeat(64),
|
|
299
|
+
outputIndex: 99,
|
|
300
|
+
value: '12345',
|
|
301
|
+
scriptPubKeyHex: 'ff',
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
});
|
|
284
305
|
|
|
285
306
|
const deserialized = TransactionSerializer.deserialize(
|
|
286
307
|
TransactionSerializer.serialize(state),
|
|
287
308
|
);
|
|
288
309
|
|
|
289
310
|
expect(deserialized.optionalInputs).toHaveLength(1);
|
|
290
|
-
expect(deserialized.optionalInputs[0].outputIndex).toBe(99);
|
|
311
|
+
expect((deserialized.optionalInputs[0] as SerializedUTXO).outputIndex).toBe(99);
|
|
291
312
|
});
|
|
292
313
|
|
|
293
314
|
it('should preserve optional outputs', () => {
|
|
@@ -297,17 +318,19 @@ describe('Offline Transaction Signing', () => {
|
|
|
297
318
|
tapInternalKey: 'abcd1234',
|
|
298
319
|
};
|
|
299
320
|
|
|
300
|
-
const state = createMockSerializedState(
|
|
301
|
-
|
|
321
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
322
|
+
optionalOutputs: [output],
|
|
323
|
+
});
|
|
302
324
|
|
|
303
325
|
const deserialized = TransactionSerializer.deserialize(
|
|
304
326
|
TransactionSerializer.serialize(state),
|
|
305
327
|
);
|
|
306
328
|
|
|
307
329
|
expect(deserialized.optionalOutputs).toHaveLength(1);
|
|
308
|
-
|
|
309
|
-
expect(
|
|
310
|
-
expect(
|
|
330
|
+
const output0 = deserialized.optionalOutputs[0] as SerializedOutput;
|
|
331
|
+
expect(output0.value).toBe(output.value);
|
|
332
|
+
expect(output0.address).toBe(output.address);
|
|
333
|
+
expect(output0.tapInternalKey).toBe(output.tapInternalKey);
|
|
311
334
|
});
|
|
312
335
|
|
|
313
336
|
it('should preserve script-based outputs', () => {
|
|
@@ -316,25 +339,28 @@ describe('Offline Transaction Signing', () => {
|
|
|
316
339
|
script: 'deadbeefcafe',
|
|
317
340
|
};
|
|
318
341
|
|
|
319
|
-
const state = createMockSerializedState(
|
|
320
|
-
|
|
342
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
343
|
+
optionalOutputs: [output],
|
|
344
|
+
});
|
|
321
345
|
|
|
322
346
|
const deserialized = TransactionSerializer.deserialize(
|
|
323
347
|
TransactionSerializer.serialize(state),
|
|
324
348
|
);
|
|
325
349
|
|
|
326
350
|
expect(deserialized.optionalOutputs).toHaveLength(1);
|
|
327
|
-
|
|
328
|
-
expect(
|
|
351
|
+
const scriptOutput0 = deserialized.optionalOutputs[0] as SerializedOutput;
|
|
352
|
+
expect(scriptOutput0.script).toBe(output.script);
|
|
353
|
+
expect(scriptOutput0.address).toBeUndefined();
|
|
329
354
|
});
|
|
330
355
|
|
|
331
356
|
it('should preserve signer mappings for address rotation', () => {
|
|
332
|
-
const state = createMockSerializedState(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
357
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
358
|
+
addressRotationEnabled: true,
|
|
359
|
+
signerMappings: [
|
|
360
|
+
{ address: address1, inputIndices: [0, 2, 4] },
|
|
361
|
+
{ address: address2, inputIndices: [1, 3] },
|
|
362
|
+
],
|
|
363
|
+
});
|
|
338
364
|
|
|
339
365
|
const deserialized = TransactionSerializer.deserialize(
|
|
340
366
|
TransactionSerializer.serialize(state),
|
|
@@ -342,10 +368,14 @@ describe('Offline Transaction Signing', () => {
|
|
|
342
368
|
|
|
343
369
|
expect(deserialized.addressRotationEnabled).toBe(true);
|
|
344
370
|
expect(deserialized.signerMappings).toHaveLength(2);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
371
|
+
const mapping0 = deserialized
|
|
372
|
+
.signerMappings[0] as (typeof deserialized.signerMappings)[0];
|
|
373
|
+
const mapping1 = deserialized
|
|
374
|
+
.signerMappings[1] as (typeof deserialized.signerMappings)[0];
|
|
375
|
+
expect(mapping0.address).toBe(address1);
|
|
376
|
+
expect(mapping0.inputIndices).toEqual([0, 2, 4]);
|
|
377
|
+
expect(mapping1.address).toBe(address2);
|
|
378
|
+
expect(mapping1.inputIndices).toEqual([1, 3]);
|
|
349
379
|
});
|
|
350
380
|
|
|
351
381
|
it('should preserve precomputed data', () => {
|
|
@@ -357,18 +387,23 @@ describe('Offline Transaction Signing', () => {
|
|
|
357
387
|
contractAddress: address3,
|
|
358
388
|
};
|
|
359
389
|
|
|
360
|
-
const state = createMockSerializedState(
|
|
361
|
-
|
|
390
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
391
|
+
precomputedData: precomputed,
|
|
392
|
+
});
|
|
362
393
|
|
|
363
394
|
const deserialized = TransactionSerializer.deserialize(
|
|
364
395
|
TransactionSerializer.serialize(state),
|
|
365
396
|
);
|
|
366
397
|
|
|
367
|
-
expect(deserialized.precomputedData.compiledTargetScript).toBe(
|
|
398
|
+
expect(deserialized.precomputedData.compiledTargetScript).toBe(
|
|
399
|
+
precomputed.compiledTargetScript,
|
|
400
|
+
);
|
|
368
401
|
expect(deserialized.precomputedData.randomBytes).toBe(precomputed.randomBytes);
|
|
369
402
|
expect(deserialized.precomputedData.estimatedFees).toBe(precomputed.estimatedFees);
|
|
370
403
|
expect(deserialized.precomputedData.contractSeed).toBe(precomputed.contractSeed);
|
|
371
|
-
expect(deserialized.precomputedData.contractAddress).toBe(
|
|
404
|
+
expect(deserialized.precomputedData.contractAddress).toBe(
|
|
405
|
+
precomputed.contractAddress,
|
|
406
|
+
);
|
|
372
407
|
});
|
|
373
408
|
});
|
|
374
409
|
|
|
@@ -380,8 +415,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
380
415
|
splitInputsInto: 5,
|
|
381
416
|
};
|
|
382
417
|
|
|
383
|
-
const state = createMockSerializedState(TransactionType.FUNDING
|
|
384
|
-
|
|
418
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
419
|
+
typeSpecificData: typeData,
|
|
420
|
+
});
|
|
385
421
|
|
|
386
422
|
const deserialized = TransactionSerializer.deserialize(
|
|
387
423
|
TransactionSerializer.serialize(state),
|
|
@@ -404,9 +440,16 @@ describe('Offline Transaction Signing', () => {
|
|
|
404
440
|
hashedPublicKey: 'abcd'.repeat(16),
|
|
405
441
|
};
|
|
406
442
|
|
|
407
|
-
const state = createMockSerializedState(TransactionType.DEPLOYMENT
|
|
408
|
-
|
|
409
|
-
|
|
443
|
+
const state = createMockSerializedState(TransactionType.DEPLOYMENT, {
|
|
444
|
+
header: {
|
|
445
|
+
formatVersion: SERIALIZATION_FORMAT_VERSION,
|
|
446
|
+
consensusVersion: currentConsensus,
|
|
447
|
+
transactionType: TransactionType.DEPLOYMENT,
|
|
448
|
+
chainId: ChainId.Bitcoin,
|
|
449
|
+
timestamp: Date.now(),
|
|
450
|
+
},
|
|
451
|
+
typeSpecificData: typeData,
|
|
452
|
+
});
|
|
410
453
|
|
|
411
454
|
const deserialized = TransactionSerializer.deserialize(
|
|
412
455
|
TransactionSerializer.serialize(state),
|
|
@@ -428,17 +471,24 @@ describe('Offline Transaction Signing', () => {
|
|
|
428
471
|
contract: 'bcrt1qtest',
|
|
429
472
|
challenge: createMockChallenge(),
|
|
430
473
|
loadedStorage: {
|
|
431
|
-
|
|
432
|
-
|
|
474
|
+
key1: ['value1', 'value2'],
|
|
475
|
+
key2: ['value3'],
|
|
433
476
|
},
|
|
434
477
|
isCancellation: true,
|
|
435
478
|
disableAutoRefund: true,
|
|
436
479
|
revealMLDSAPublicKey: false,
|
|
437
480
|
};
|
|
438
481
|
|
|
439
|
-
const state = createMockSerializedState(TransactionType.INTERACTION
|
|
440
|
-
|
|
441
|
-
|
|
482
|
+
const state = createMockSerializedState(TransactionType.INTERACTION, {
|
|
483
|
+
header: {
|
|
484
|
+
formatVersion: SERIALIZATION_FORMAT_VERSION,
|
|
485
|
+
consensusVersion: currentConsensus,
|
|
486
|
+
transactionType: TransactionType.INTERACTION,
|
|
487
|
+
chainId: ChainId.Bitcoin,
|
|
488
|
+
timestamp: Date.now(),
|
|
489
|
+
},
|
|
490
|
+
typeSpecificData: typeData,
|
|
491
|
+
});
|
|
442
492
|
|
|
443
493
|
const deserialized = TransactionSerializer.deserialize(
|
|
444
494
|
TransactionSerializer.serialize(state),
|
|
@@ -465,9 +515,16 @@ describe('Offline Transaction Signing', () => {
|
|
|
465
515
|
existingPsbtBase64: 'cHNidP8BAH...',
|
|
466
516
|
};
|
|
467
517
|
|
|
468
|
-
const state = createMockSerializedState(TransactionType.MULTI_SIG
|
|
469
|
-
|
|
470
|
-
|
|
518
|
+
const state = createMockSerializedState(TransactionType.MULTI_SIG, {
|
|
519
|
+
header: {
|
|
520
|
+
formatVersion: SERIALIZATION_FORMAT_VERSION,
|
|
521
|
+
consensusVersion: currentConsensus,
|
|
522
|
+
transactionType: TransactionType.MULTI_SIG,
|
|
523
|
+
chainId: ChainId.Bitcoin,
|
|
524
|
+
timestamp: Date.now(),
|
|
525
|
+
},
|
|
526
|
+
typeSpecificData: typeData,
|
|
527
|
+
});
|
|
471
528
|
|
|
472
529
|
const deserialized = TransactionSerializer.deserialize(
|
|
473
530
|
TransactionSerializer.serialize(state),
|
|
@@ -496,9 +553,16 @@ describe('Offline Transaction Signing', () => {
|
|
|
496
553
|
annex: 'aabbccdd',
|
|
497
554
|
};
|
|
498
555
|
|
|
499
|
-
const state = createMockSerializedState(TransactionType.CUSTOM_CODE
|
|
500
|
-
|
|
501
|
-
|
|
556
|
+
const state = createMockSerializedState(TransactionType.CUSTOM_CODE, {
|
|
557
|
+
header: {
|
|
558
|
+
formatVersion: SERIALIZATION_FORMAT_VERSION,
|
|
559
|
+
consensusVersion: currentConsensus,
|
|
560
|
+
transactionType: TransactionType.CUSTOM_CODE,
|
|
561
|
+
chainId: ChainId.Bitcoin,
|
|
562
|
+
timestamp: Date.now(),
|
|
563
|
+
},
|
|
564
|
+
typeSpecificData: typeData,
|
|
565
|
+
});
|
|
502
566
|
|
|
503
567
|
const deserialized = TransactionSerializer.deserialize(
|
|
504
568
|
TransactionSerializer.serialize(state),
|
|
@@ -507,7 +571,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
507
571
|
expect(isCustomScriptSpecificData(deserialized.typeSpecificData)).toBe(true);
|
|
508
572
|
const data = deserialized.typeSpecificData as CustomScriptSpecificData;
|
|
509
573
|
expect(data.scriptElements).toHaveLength(3);
|
|
510
|
-
expect(data.scriptElements[0]).toEqual({
|
|
574
|
+
expect(data.scriptElements[0]).toEqual({
|
|
575
|
+
elementType: 'buffer',
|
|
576
|
+
value: 'deadbeef',
|
|
577
|
+
});
|
|
511
578
|
expect(data.scriptElements[1]).toEqual({ elementType: 'opcode', value: 118 });
|
|
512
579
|
expect(data.witnesses).toEqual(typeData.witnesses);
|
|
513
580
|
expect(data.annex).toBe(typeData.annex);
|
|
@@ -519,9 +586,16 @@ describe('Offline Transaction Signing', () => {
|
|
|
519
586
|
compiledTargetScript: 'deadbeefcafe1234',
|
|
520
587
|
};
|
|
521
588
|
|
|
522
|
-
const state = createMockSerializedState(TransactionType.CANCEL
|
|
523
|
-
|
|
524
|
-
|
|
589
|
+
const state = createMockSerializedState(TransactionType.CANCEL, {
|
|
590
|
+
header: {
|
|
591
|
+
formatVersion: SERIALIZATION_FORMAT_VERSION,
|
|
592
|
+
consensusVersion: currentConsensus,
|
|
593
|
+
transactionType: TransactionType.CANCEL,
|
|
594
|
+
chainId: ChainId.Bitcoin,
|
|
595
|
+
timestamp: Date.now(),
|
|
596
|
+
},
|
|
597
|
+
typeSpecificData: typeData,
|
|
598
|
+
});
|
|
525
599
|
|
|
526
600
|
const deserialized = TransactionSerializer.deserialize(
|
|
527
601
|
TransactionSerializer.serialize(state),
|
|
@@ -568,12 +642,13 @@ describe('Offline Transaction Signing', () => {
|
|
|
568
642
|
|
|
569
643
|
// Recalculate checksum to bypass checksum error
|
|
570
644
|
const payload = serialized.subarray(0, -32);
|
|
571
|
-
const
|
|
572
|
-
const
|
|
573
|
-
const newChecksum = crypto.createHash('sha256').update(hash1).digest();
|
|
645
|
+
const hash1 = createHash('sha256').update(payload).digest();
|
|
646
|
+
const newChecksum = createHash('sha256').update(hash1).digest();
|
|
574
647
|
newChecksum.copy(serialized, serialized.length - 32);
|
|
575
648
|
|
|
576
|
-
expect(() => TransactionSerializer.deserialize(serialized)).toThrow(
|
|
649
|
+
expect(() => TransactionSerializer.deserialize(serialized)).toThrow(
|
|
650
|
+
/Invalid magic byte/,
|
|
651
|
+
);
|
|
577
652
|
});
|
|
578
653
|
|
|
579
654
|
it('should throw on invalid checksum', () => {
|
|
@@ -581,9 +656,12 @@ describe('Offline Transaction Signing', () => {
|
|
|
581
656
|
const serialized = TransactionSerializer.serialize(state);
|
|
582
657
|
|
|
583
658
|
// Corrupt checksum
|
|
584
|
-
serialized[serialized.length - 1]
|
|
659
|
+
serialized[serialized.length - 1] =
|
|
660
|
+
(serialized[serialized.length - 1] as number) ^ 0xff;
|
|
585
661
|
|
|
586
|
-
expect(() => TransactionSerializer.deserialize(serialized)).toThrow(
|
|
662
|
+
expect(() => TransactionSerializer.deserialize(serialized)).toThrow(
|
|
663
|
+
/Invalid checksum/,
|
|
664
|
+
);
|
|
587
665
|
});
|
|
588
666
|
|
|
589
667
|
it('should throw on data too short', () => {
|
|
@@ -601,19 +679,22 @@ describe('Offline Transaction Signing', () => {
|
|
|
601
679
|
|
|
602
680
|
// Recalculate checksum
|
|
603
681
|
const payload = serialized.subarray(0, -32);
|
|
604
|
-
const
|
|
605
|
-
const
|
|
606
|
-
const newChecksum = crypto.createHash('sha256').update(hash1).digest();
|
|
682
|
+
const hash1 = createHash('sha256').update(payload).digest();
|
|
683
|
+
const newChecksum = createHash('sha256').update(hash1).digest();
|
|
607
684
|
newChecksum.copy(serialized, serialized.length - 32);
|
|
608
685
|
|
|
609
|
-
expect(() => TransactionSerializer.deserialize(serialized)).toThrow(
|
|
686
|
+
expect(() => TransactionSerializer.deserialize(serialized)).toThrow(
|
|
687
|
+
/Unsupported format version/,
|
|
688
|
+
);
|
|
610
689
|
});
|
|
611
690
|
});
|
|
612
691
|
|
|
613
692
|
describe('network serialization', () => {
|
|
614
693
|
it('should serialize mainnet correctly', () => {
|
|
615
|
-
const
|
|
616
|
-
state
|
|
694
|
+
const base = createMockSerializedState();
|
|
695
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
696
|
+
baseParams: { ...base.baseParams, networkName: 'mainnet' },
|
|
697
|
+
});
|
|
617
698
|
|
|
618
699
|
const deserialized = TransactionSerializer.deserialize(
|
|
619
700
|
TransactionSerializer.serialize(state),
|
|
@@ -623,8 +704,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
623
704
|
});
|
|
624
705
|
|
|
625
706
|
it('should serialize testnet correctly', () => {
|
|
626
|
-
const
|
|
627
|
-
state
|
|
707
|
+
const base = createMockSerializedState();
|
|
708
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
709
|
+
baseParams: { ...base.baseParams, networkName: 'testnet' },
|
|
710
|
+
});
|
|
628
711
|
|
|
629
712
|
const deserialized = TransactionSerializer.deserialize(
|
|
630
713
|
TransactionSerializer.serialize(state),
|
|
@@ -634,8 +717,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
634
717
|
});
|
|
635
718
|
|
|
636
719
|
it('should serialize regtest correctly', () => {
|
|
637
|
-
const
|
|
638
|
-
state
|
|
720
|
+
const base = createMockSerializedState();
|
|
721
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
722
|
+
baseParams: { ...base.baseParams, networkName: 'regtest' },
|
|
723
|
+
});
|
|
639
724
|
|
|
640
725
|
const deserialized = TransactionSerializer.deserialize(
|
|
641
726
|
TransactionSerializer.serialize(state),
|
|
@@ -759,10 +844,11 @@ describe('Offline Transaction Signing', () => {
|
|
|
759
844
|
|
|
760
845
|
const state = TransactionStateCapture.fromFunding(params);
|
|
761
846
|
|
|
762
|
-
|
|
763
|
-
expect(
|
|
764
|
-
expect(
|
|
765
|
-
expect(
|
|
847
|
+
const stateUtxo0 = state.utxos[0] as SerializedUTXO;
|
|
848
|
+
expect(stateUtxo0.transactionId).toBe(utxo.transactionId);
|
|
849
|
+
expect(stateUtxo0.redeemScript).toBe('cafe');
|
|
850
|
+
expect(stateUtxo0.witnessScript).toBe('babe');
|
|
851
|
+
expect(stateUtxo0.nonWitnessUtxo).toBe('feed');
|
|
766
852
|
});
|
|
767
853
|
|
|
768
854
|
it('should handle UTXOs with string scripts', () => {
|
|
@@ -792,7 +878,7 @@ describe('Offline Transaction Signing', () => {
|
|
|
792
878
|
|
|
793
879
|
const state = TransactionStateCapture.fromFunding(params);
|
|
794
880
|
|
|
795
|
-
expect(state.utxos[0].redeemScript).toBe('ddeeff');
|
|
881
|
+
expect((state.utxos[0] as SerializedUTXO).redeemScript).toBe('ddeeff');
|
|
796
882
|
});
|
|
797
883
|
});
|
|
798
884
|
});
|
|
@@ -813,8 +899,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
813
899
|
});
|
|
814
900
|
|
|
815
901
|
it('should apply fee rate override', () => {
|
|
816
|
-
const
|
|
817
|
-
state
|
|
902
|
+
const base = createMockSerializedState();
|
|
903
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
904
|
+
baseParams: { ...base.baseParams, feeRate: 10 },
|
|
905
|
+
});
|
|
818
906
|
|
|
819
907
|
const options: ReconstructionOptions = {
|
|
820
908
|
signer: defaultSigner,
|
|
@@ -852,8 +940,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
852
940
|
});
|
|
853
941
|
|
|
854
942
|
it('should throw when address rotation enabled but no signerMap provided', () => {
|
|
855
|
-
const state = createMockSerializedState(TransactionType.FUNDING
|
|
856
|
-
|
|
943
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
944
|
+
addressRotationEnabled: true,
|
|
945
|
+
});
|
|
857
946
|
|
|
858
947
|
const options: ReconstructionOptions = {
|
|
859
948
|
signer: defaultSigner,
|
|
@@ -866,9 +955,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
866
955
|
});
|
|
867
956
|
|
|
868
957
|
it('should reconstruct with address rotation when signerMap provided', () => {
|
|
869
|
-
const state = createMockSerializedState(TransactionType.FUNDING
|
|
870
|
-
|
|
871
|
-
|
|
958
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
959
|
+
addressRotationEnabled: true,
|
|
960
|
+
signerMappings: [{ address: address1, inputIndices: [0] }],
|
|
961
|
+
});
|
|
872
962
|
|
|
873
963
|
const signerMap = createSignerMap([[address1, signer1]]);
|
|
874
964
|
|
|
@@ -884,8 +974,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
884
974
|
|
|
885
975
|
describe('network conversion', () => {
|
|
886
976
|
it('should convert mainnet name to network', () => {
|
|
887
|
-
const
|
|
888
|
-
state
|
|
977
|
+
const base = createMockSerializedState();
|
|
978
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
979
|
+
baseParams: { ...base.baseParams, networkName: 'mainnet' },
|
|
980
|
+
});
|
|
889
981
|
|
|
890
982
|
const options: ReconstructionOptions = {
|
|
891
983
|
signer: defaultSigner,
|
|
@@ -896,8 +988,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
896
988
|
});
|
|
897
989
|
|
|
898
990
|
it('should convert testnet name to network', () => {
|
|
899
|
-
const
|
|
900
|
-
state
|
|
991
|
+
const base = createMockSerializedState();
|
|
992
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
993
|
+
baseParams: { ...base.baseParams, networkName: 'testnet' },
|
|
994
|
+
});
|
|
901
995
|
|
|
902
996
|
const options: ReconstructionOptions = {
|
|
903
997
|
signer: defaultSigner,
|
|
@@ -908,8 +1002,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
908
1002
|
});
|
|
909
1003
|
|
|
910
1004
|
it('should convert regtest name to network', () => {
|
|
911
|
-
const
|
|
912
|
-
state
|
|
1005
|
+
const base = createMockSerializedState();
|
|
1006
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
1007
|
+
baseParams: { ...base.baseParams, networkName: 'regtest' },
|
|
1008
|
+
});
|
|
913
1009
|
|
|
914
1010
|
const options: ReconstructionOptions = {
|
|
915
1011
|
signer: defaultSigner,
|
|
@@ -1166,7 +1262,13 @@ describe('Offline Transaction Signing', () => {
|
|
|
1166
1262
|
};
|
|
1167
1263
|
|
|
1168
1264
|
expect(isDeploymentSpecificData(deploymentData)).toBe(true);
|
|
1169
|
-
|
|
1265
|
+
|
|
1266
|
+
const nonDeploymentData: FundingSpecificData = {
|
|
1267
|
+
type: TransactionType.FUNDING,
|
|
1268
|
+
amount: '0',
|
|
1269
|
+
splitInputsInto: 1,
|
|
1270
|
+
};
|
|
1271
|
+
expect(isDeploymentSpecificData(nonDeploymentData)).toBe(false);
|
|
1170
1272
|
});
|
|
1171
1273
|
|
|
1172
1274
|
it('isInteractionSpecificData should correctly identify interaction data', () => {
|
|
@@ -1177,7 +1279,13 @@ describe('Offline Transaction Signing', () => {
|
|
|
1177
1279
|
};
|
|
1178
1280
|
|
|
1179
1281
|
expect(isInteractionSpecificData(interactionData)).toBe(true);
|
|
1180
|
-
|
|
1282
|
+
|
|
1283
|
+
const nonInteractionData: FundingSpecificData = {
|
|
1284
|
+
type: TransactionType.FUNDING,
|
|
1285
|
+
amount: '0',
|
|
1286
|
+
splitInputsInto: 1,
|
|
1287
|
+
};
|
|
1288
|
+
expect(isInteractionSpecificData(nonInteractionData)).toBe(false);
|
|
1181
1289
|
});
|
|
1182
1290
|
|
|
1183
1291
|
it('isMultiSigSpecificData should correctly identify multisig data', () => {
|
|
@@ -1192,7 +1300,13 @@ describe('Offline Transaction Signing', () => {
|
|
|
1192
1300
|
};
|
|
1193
1301
|
|
|
1194
1302
|
expect(isMultiSigSpecificData(multiSigData)).toBe(true);
|
|
1195
|
-
|
|
1303
|
+
|
|
1304
|
+
const nonMultiSigData: FundingSpecificData = {
|
|
1305
|
+
type: TransactionType.FUNDING,
|
|
1306
|
+
amount: '0',
|
|
1307
|
+
splitInputsInto: 1,
|
|
1308
|
+
};
|
|
1309
|
+
expect(isMultiSigSpecificData(nonMultiSigData)).toBe(false);
|
|
1196
1310
|
});
|
|
1197
1311
|
|
|
1198
1312
|
it('isCustomScriptSpecificData should correctly identify custom script data', () => {
|
|
@@ -1203,7 +1317,13 @@ describe('Offline Transaction Signing', () => {
|
|
|
1203
1317
|
};
|
|
1204
1318
|
|
|
1205
1319
|
expect(isCustomScriptSpecificData(customData)).toBe(true);
|
|
1206
|
-
|
|
1320
|
+
|
|
1321
|
+
const nonCustomData: FundingSpecificData = {
|
|
1322
|
+
type: TransactionType.FUNDING,
|
|
1323
|
+
amount: '0',
|
|
1324
|
+
splitInputsInto: 1,
|
|
1325
|
+
};
|
|
1326
|
+
expect(isCustomScriptSpecificData(nonCustomData)).toBe(false);
|
|
1207
1327
|
});
|
|
1208
1328
|
|
|
1209
1329
|
it('isCancelSpecificData should correctly identify cancel data', () => {
|
|
@@ -1213,14 +1333,21 @@ describe('Offline Transaction Signing', () => {
|
|
|
1213
1333
|
};
|
|
1214
1334
|
|
|
1215
1335
|
expect(isCancelSpecificData(cancelData)).toBe(true);
|
|
1216
|
-
|
|
1336
|
+
|
|
1337
|
+
const nonCancelData: FundingSpecificData = {
|
|
1338
|
+
type: TransactionType.FUNDING,
|
|
1339
|
+
amount: '0',
|
|
1340
|
+
splitInputsInto: 1,
|
|
1341
|
+
};
|
|
1342
|
+
expect(isCancelSpecificData(nonCancelData)).toBe(false);
|
|
1217
1343
|
});
|
|
1218
1344
|
});
|
|
1219
1345
|
|
|
1220
1346
|
describe('Edge Cases', () => {
|
|
1221
1347
|
it('should handle empty UTXOs array', () => {
|
|
1222
|
-
const state = createMockSerializedState(
|
|
1223
|
-
|
|
1348
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
1349
|
+
utxos: [],
|
|
1350
|
+
});
|
|
1224
1351
|
|
|
1225
1352
|
const serialized = TransactionSerializer.serialize(state);
|
|
1226
1353
|
const deserialized = TransactionSerializer.deserialize(serialized);
|
|
@@ -1229,27 +1356,29 @@ describe('Offline Transaction Signing', () => {
|
|
|
1229
1356
|
});
|
|
1230
1357
|
|
|
1231
1358
|
it('should handle very large values', () => {
|
|
1232
|
-
const state = createMockSerializedState(
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1359
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
1360
|
+
utxos: [
|
|
1361
|
+
{
|
|
1362
|
+
transactionId: '0'.repeat(64),
|
|
1363
|
+
outputIndex: 0,
|
|
1364
|
+
value: '9999999999999999', // Large value
|
|
1365
|
+
scriptPubKeyHex: 'aa',
|
|
1366
|
+
},
|
|
1367
|
+
],
|
|
1368
|
+
});
|
|
1241
1369
|
|
|
1242
1370
|
const deserialized = TransactionSerializer.deserialize(
|
|
1243
1371
|
TransactionSerializer.serialize(state),
|
|
1244
1372
|
);
|
|
1245
1373
|
|
|
1246
|
-
expect(deserialized.utxos[0].value).toBe('9999999999999999');
|
|
1374
|
+
expect((deserialized.utxos[0] as SerializedUTXO).value).toBe('9999999999999999');
|
|
1247
1375
|
});
|
|
1248
1376
|
|
|
1249
1377
|
it('should handle empty strings', () => {
|
|
1250
|
-
const
|
|
1251
|
-
state
|
|
1252
|
-
|
|
1378
|
+
const base = createMockSerializedState();
|
|
1379
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
1380
|
+
baseParams: { ...base.baseParams, from: '', to: '' },
|
|
1381
|
+
});
|
|
1253
1382
|
|
|
1254
1383
|
const deserialized = TransactionSerializer.deserialize(
|
|
1255
1384
|
TransactionSerializer.serialize(state),
|
|
@@ -1259,9 +1388,11 @@ describe('Offline Transaction Signing', () => {
|
|
|
1259
1388
|
});
|
|
1260
1389
|
|
|
1261
1390
|
it('should handle special characters in note', () => {
|
|
1262
|
-
const
|
|
1391
|
+
const base = createMockSerializedState();
|
|
1263
1392
|
const specialNote = Buffer.from('Hello\x00World\n\t\r').toString('hex');
|
|
1264
|
-
state
|
|
1393
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
1394
|
+
baseParams: { ...base.baseParams, note: specialNote },
|
|
1395
|
+
});
|
|
1265
1396
|
|
|
1266
1397
|
const deserialized = TransactionSerializer.deserialize(
|
|
1267
1398
|
TransactionSerializer.serialize(state),
|
|
@@ -1271,8 +1402,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
1271
1402
|
});
|
|
1272
1403
|
|
|
1273
1404
|
it('should handle zero fee rate', () => {
|
|
1274
|
-
const
|
|
1275
|
-
state
|
|
1405
|
+
const base = createMockSerializedState();
|
|
1406
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
1407
|
+
baseParams: { ...base.baseParams, feeRate: 0 },
|
|
1408
|
+
});
|
|
1276
1409
|
|
|
1277
1410
|
const deserialized = TransactionSerializer.deserialize(
|
|
1278
1411
|
TransactionSerializer.serialize(state),
|
|
@@ -1282,34 +1415,44 @@ describe('Offline Transaction Signing', () => {
|
|
|
1282
1415
|
});
|
|
1283
1416
|
|
|
1284
1417
|
it('should handle maximum input indices in signer mappings', () => {
|
|
1285
|
-
const state = createMockSerializedState(
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1418
|
+
const state = createMockSerializedState(TransactionType.FUNDING, {
|
|
1419
|
+
addressRotationEnabled: true,
|
|
1420
|
+
signerMappings: [
|
|
1421
|
+
{ address: address1, inputIndices: Array.from({ length: 100 }, (_, i) => i) },
|
|
1422
|
+
],
|
|
1423
|
+
});
|
|
1290
1424
|
|
|
1291
1425
|
const deserialized = TransactionSerializer.deserialize(
|
|
1292
1426
|
TransactionSerializer.serialize(state),
|
|
1293
1427
|
);
|
|
1294
1428
|
|
|
1295
|
-
expect(
|
|
1429
|
+
expect(
|
|
1430
|
+
(deserialized.signerMappings[0] as (typeof deserialized.signerMappings)[0])
|
|
1431
|
+
.inputIndices,
|
|
1432
|
+
).toHaveLength(100);
|
|
1296
1433
|
});
|
|
1297
1434
|
|
|
1298
1435
|
it('should handle loaded storage with many keys', () => {
|
|
1299
|
-
const state = createMockSerializedState(TransactionType.INTERACTION);
|
|
1300
|
-
state.header.transactionType = TransactionType.INTERACTION;
|
|
1301
|
-
|
|
1302
1436
|
const loadedStorage: { [key: string]: string[] } = {};
|
|
1303
1437
|
for (let i = 0; i < 50; i++) {
|
|
1304
1438
|
loadedStorage[`key${i}`] = [`value${i}a`, `value${i}b`];
|
|
1305
1439
|
}
|
|
1306
1440
|
|
|
1307
|
-
state
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1441
|
+
const state = createMockSerializedState(TransactionType.INTERACTION, {
|
|
1442
|
+
header: {
|
|
1443
|
+
formatVersion: SERIALIZATION_FORMAT_VERSION,
|
|
1444
|
+
consensusVersion: currentConsensus,
|
|
1445
|
+
transactionType: TransactionType.INTERACTION,
|
|
1446
|
+
chainId: ChainId.Bitcoin,
|
|
1447
|
+
timestamp: Date.now(),
|
|
1448
|
+
},
|
|
1449
|
+
typeSpecificData: {
|
|
1450
|
+
type: TransactionType.INTERACTION,
|
|
1451
|
+
calldata: 'abcd',
|
|
1452
|
+
challenge: createMockChallenge(),
|
|
1453
|
+
loadedStorage,
|
|
1454
|
+
} as InteractionSpecificData,
|
|
1455
|
+
});
|
|
1313
1456
|
|
|
1314
1457
|
const deserialized = TransactionSerializer.deserialize(
|
|
1315
1458
|
TransactionSerializer.serialize(state),
|
|
@@ -1393,7 +1536,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
1393
1536
|
|
|
1394
1537
|
// Verify header
|
|
1395
1538
|
expect(deserialized.header.formatVersion).toBe(originalState.header.formatVersion);
|
|
1396
|
-
expect(deserialized.header.consensusVersion).toBe(
|
|
1539
|
+
expect(deserialized.header.consensusVersion).toBe(
|
|
1540
|
+
originalState.header.consensusVersion,
|
|
1541
|
+
);
|
|
1397
1542
|
expect(deserialized.header.transactionType).toBe(originalState.header.transactionType);
|
|
1398
1543
|
expect(deserialized.header.chainId).toBe(originalState.header.chainId);
|
|
1399
1544
|
expect(deserialized.header.timestamp).toBe(originalState.header.timestamp);
|
|
@@ -1401,7 +1546,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
1401
1546
|
// Verify base params
|
|
1402
1547
|
expect(deserialized.baseParams.from).toBe(originalState.baseParams.from);
|
|
1403
1548
|
expect(deserialized.baseParams.to).toBe(originalState.baseParams.to);
|
|
1404
|
-
expect(deserialized.baseParams.feeRate).toBeCloseTo(
|
|
1549
|
+
expect(deserialized.baseParams.feeRate).toBeCloseTo(
|
|
1550
|
+
originalState.baseParams.feeRate,
|
|
1551
|
+
3,
|
|
1552
|
+
);
|
|
1405
1553
|
expect(deserialized.baseParams.priorityFee).toBe(originalState.baseParams.priorityFee);
|
|
1406
1554
|
expect(deserialized.baseParams.gasSatFee).toBe(originalState.baseParams.gasSatFee);
|
|
1407
1555
|
expect(deserialized.baseParams.networkName).toBe(originalState.baseParams.networkName);
|
|
@@ -1486,10 +1634,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
1486
1634
|
expect(OfflineTransactionManager.validate(exportedState)).toBe(true);
|
|
1487
1635
|
|
|
1488
1636
|
// Phase 2: Offline - Import, sign, export
|
|
1489
|
-
const signedTxHex = await OfflineTransactionManager.importSignAndExport(
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
);
|
|
1637
|
+
const signedTxHex = await OfflineTransactionManager.importSignAndExport(exportedState, {
|
|
1638
|
+
signer: defaultSigner,
|
|
1639
|
+
});
|
|
1493
1640
|
|
|
1494
1641
|
// Verify we got a valid hex transaction
|
|
1495
1642
|
expect(signedTxHex).toBeDefined();
|
|
@@ -1550,20 +1697,16 @@ describe('Offline Transaction Signing', () => {
|
|
|
1550
1697
|
expect(originalInspected.baseParams.feeRate).toBeCloseTo(5, 3);
|
|
1551
1698
|
|
|
1552
1699
|
// Bump fee to 25 sat/vB
|
|
1553
|
-
const bumpedState = OfflineTransactionManager.rebuildWithNewFees(
|
|
1554
|
-
originalState,
|
|
1555
|
-
25,
|
|
1556
|
-
);
|
|
1700
|
+
const bumpedState = OfflineTransactionManager.rebuildWithNewFees(originalState, 25);
|
|
1557
1701
|
|
|
1558
1702
|
// Verify bumped fee rate
|
|
1559
1703
|
const bumpedInspected = OfflineTransactionManager.inspect(bumpedState);
|
|
1560
1704
|
expect(bumpedInspected.baseParams.feeRate).toBeCloseTo(25, 3);
|
|
1561
1705
|
|
|
1562
1706
|
// Sign the bumped transaction
|
|
1563
|
-
const signedTxHex = await OfflineTransactionManager.importSignAndExport(
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
);
|
|
1707
|
+
const signedTxHex = await OfflineTransactionManager.importSignAndExport(bumpedState, {
|
|
1708
|
+
signer: signer2,
|
|
1709
|
+
});
|
|
1567
1710
|
|
|
1568
1711
|
expect(signedTxHex).toBeDefined();
|
|
1569
1712
|
expect(/^[0-9a-f]+$/i.test(signedTxHex)).toBe(true);
|
|
@@ -1621,10 +1764,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
1621
1764
|
expect(inspected.utxos).toHaveLength(3);
|
|
1622
1765
|
|
|
1623
1766
|
// Sign
|
|
1624
|
-
const signedTxHex = await OfflineTransactionManager.importSignAndExport(
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
);
|
|
1767
|
+
const signedTxHex = await OfflineTransactionManager.importSignAndExport(exportedState, {
|
|
1768
|
+
signer: defaultSigner,
|
|
1769
|
+
});
|
|
1628
1770
|
|
|
1629
1771
|
expect(signedTxHex).toBeDefined();
|
|
1630
1772
|
expect(/^[0-9a-f]+$/i.test(signedTxHex)).toBe(true);
|
|
@@ -1633,9 +1775,7 @@ describe('Offline Transaction Signing', () => {
|
|
|
1633
1775
|
it('should sign with address rotation using multiple signers', async () => {
|
|
1634
1776
|
// For address rotation, UTXOs must use addresses that match the signers
|
|
1635
1777
|
// Use all UTXOs from defaultAddress with defaultSigner for simplicity
|
|
1636
|
-
const signerMap = createSignerMap([
|
|
1637
|
-
[defaultAddress, defaultSigner],
|
|
1638
|
-
]);
|
|
1778
|
+
const signerMap = createSignerMap([[defaultAddress, defaultSigner]]);
|
|
1639
1779
|
|
|
1640
1780
|
const params = {
|
|
1641
1781
|
signer: defaultSigner,
|
|
@@ -1662,13 +1802,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
1662
1802
|
expect(inspected.signerMappings.length).toBeGreaterThan(0);
|
|
1663
1803
|
|
|
1664
1804
|
// Sign with address rotation
|
|
1665
|
-
const signedTxHex = await OfflineTransactionManager.importSignAndExport(
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
signerMap,
|
|
1670
|
-
},
|
|
1671
|
-
);
|
|
1805
|
+
const signedTxHex = await OfflineTransactionManager.importSignAndExport(exportedState, {
|
|
1806
|
+
signer: defaultSigner,
|
|
1807
|
+
signerMap,
|
|
1808
|
+
});
|
|
1672
1809
|
|
|
1673
1810
|
expect(signedTxHex).toBeDefined();
|
|
1674
1811
|
expect(/^[0-9a-f]+$/i.test(signedTxHex)).toBe(true);
|
|
@@ -1692,10 +1829,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
1692
1829
|
const exportedState = OfflineTransactionManager.exportFunding(params);
|
|
1693
1830
|
|
|
1694
1831
|
// Sign with signer1
|
|
1695
|
-
const signedTx1 = await OfflineTransactionManager.importSignAndExport(
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
);
|
|
1832
|
+
const signedTx1 = await OfflineTransactionManager.importSignAndExport(exportedState, {
|
|
1833
|
+
signer: signer1,
|
|
1834
|
+
});
|
|
1699
1835
|
|
|
1700
1836
|
// Sign again with signer1 (should produce same structure, potentially different due to nonce)
|
|
1701
1837
|
const signedTx1Again = await OfflineTransactionManager.importSignAndExport(
|
|
@@ -1736,10 +1872,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
1736
1872
|
expect(fundingData.splitInputsInto).toBe(3);
|
|
1737
1873
|
|
|
1738
1874
|
// Sign
|
|
1739
|
-
const signedTxHex = await OfflineTransactionManager.importSignAndExport(
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
);
|
|
1875
|
+
const signedTxHex = await OfflineTransactionManager.importSignAndExport(exportedState, {
|
|
1876
|
+
signer: defaultSigner,
|
|
1877
|
+
});
|
|
1743
1878
|
|
|
1744
1879
|
expect(signedTxHex).toBeDefined();
|
|
1745
1880
|
expect(/^[0-9a-f]+$/i.test(signedTxHex)).toBe(true);
|
|
@@ -1774,10 +1909,9 @@ describe('Offline Transaction Signing', () => {
|
|
|
1774
1909
|
expect(OfflineTransactionManager.validate(backToBase64)).toBe(true);
|
|
1775
1910
|
|
|
1776
1911
|
// Sign from the converted state
|
|
1777
|
-
const signedTxHex = await OfflineTransactionManager.importSignAndExport(
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
);
|
|
1912
|
+
const signedTxHex = await OfflineTransactionManager.importSignAndExport(backToBase64, {
|
|
1913
|
+
signer: signer1,
|
|
1914
|
+
});
|
|
1781
1915
|
|
|
1782
1916
|
expect(signedTxHex).toBeDefined();
|
|
1783
1917
|
expect(/^[0-9a-f]+$/i.test(signedTxHex)).toBe(true);
|
|
@@ -1786,17 +1920,20 @@ describe('Offline Transaction Signing', () => {
|
|
|
1786
1920
|
|
|
1787
1921
|
describe('MultiSig Offline Signing', () => {
|
|
1788
1922
|
it('should export and validate multisig state', () => {
|
|
1789
|
-
const pubkeys = [
|
|
1790
|
-
signer1.publicKey,
|
|
1791
|
-
signer2.publicKey,
|
|
1792
|
-
signer3.publicKey,
|
|
1923
|
+
const pubkeys: Buffer[] = [
|
|
1924
|
+
Buffer.from(signer1.publicKey),
|
|
1925
|
+
Buffer.from(signer2.publicKey),
|
|
1926
|
+
Buffer.from(signer3.publicKey),
|
|
1793
1927
|
];
|
|
1794
1928
|
|
|
1795
1929
|
const params = {
|
|
1930
|
+
signer: defaultSigner,
|
|
1796
1931
|
network,
|
|
1797
1932
|
mldsaSigner: null,
|
|
1798
1933
|
utxos: [createTaprootUtxo(defaultAddress, 100000n, 'a'.repeat(64), 0)],
|
|
1799
1934
|
feeRate: 10,
|
|
1935
|
+
priorityFee: 0n,
|
|
1936
|
+
gasSatFee: 0n,
|
|
1800
1937
|
pubkeys,
|
|
1801
1938
|
minimumSignatures: 2,
|
|
1802
1939
|
receiver: address1,
|
|
@@ -1814,16 +1951,19 @@ describe('Offline Transaction Signing', () => {
|
|
|
1814
1951
|
});
|
|
1815
1952
|
|
|
1816
1953
|
it('should serialize and deserialize multisig specific data', () => {
|
|
1817
|
-
const pubkeys = [
|
|
1818
|
-
signer1.publicKey,
|
|
1819
|
-
signer2.publicKey,
|
|
1954
|
+
const pubkeys: Buffer[] = [
|
|
1955
|
+
Buffer.from(signer1.publicKey),
|
|
1956
|
+
Buffer.from(signer2.publicKey),
|
|
1820
1957
|
];
|
|
1821
1958
|
|
|
1822
1959
|
const params = {
|
|
1960
|
+
signer: defaultSigner,
|
|
1823
1961
|
network,
|
|
1824
1962
|
mldsaSigner: null,
|
|
1825
1963
|
utxos: [createTaprootUtxo(defaultAddress, 80000n, 'b'.repeat(64), 0)],
|
|
1826
1964
|
feeRate: 15,
|
|
1965
|
+
priorityFee: 0n,
|
|
1966
|
+
gasSatFee: 0n,
|
|
1827
1967
|
pubkeys,
|
|
1828
1968
|
minimumSignatures: 2,
|
|
1829
1969
|
receiver: address1,
|
|
@@ -1846,16 +1986,19 @@ describe('Offline Transaction Signing', () => {
|
|
|
1846
1986
|
});
|
|
1847
1987
|
|
|
1848
1988
|
it('should report no signatures initially', () => {
|
|
1849
|
-
const pubkeys = [
|
|
1850
|
-
signer1.publicKey,
|
|
1851
|
-
signer2.publicKey,
|
|
1989
|
+
const pubkeys: Buffer[] = [
|
|
1990
|
+
Buffer.from(signer1.publicKey),
|
|
1991
|
+
Buffer.from(signer2.publicKey),
|
|
1852
1992
|
];
|
|
1853
1993
|
|
|
1854
1994
|
const params = {
|
|
1995
|
+
signer: defaultSigner,
|
|
1855
1996
|
network,
|
|
1856
1997
|
mldsaSigner: null,
|
|
1857
1998
|
utxos: [createTaprootUtxo(defaultAddress, 100000n, 'c'.repeat(64), 0)],
|
|
1858
1999
|
feeRate: 10,
|
|
2000
|
+
priorityFee: 0n,
|
|
2001
|
+
gasSatFee: 0n,
|
|
1859
2002
|
pubkeys,
|
|
1860
2003
|
minimumSignatures: 2,
|
|
1861
2004
|
receiver: address1,
|
|
@@ -1873,16 +2016,19 @@ describe('Offline Transaction Signing', () => {
|
|
|
1873
2016
|
});
|
|
1874
2017
|
|
|
1875
2018
|
it('should return null for PSBT before signing', () => {
|
|
1876
|
-
const pubkeys = [
|
|
1877
|
-
signer1.publicKey,
|
|
1878
|
-
signer2.publicKey,
|
|
2019
|
+
const pubkeys: Buffer[] = [
|
|
2020
|
+
Buffer.from(signer1.publicKey),
|
|
2021
|
+
Buffer.from(signer2.publicKey),
|
|
1879
2022
|
];
|
|
1880
2023
|
|
|
1881
2024
|
const params = {
|
|
2025
|
+
signer: defaultSigner,
|
|
1882
2026
|
network,
|
|
1883
2027
|
mldsaSigner: null,
|
|
1884
2028
|
utxos: [createTaprootUtxo(defaultAddress, 100000n, 'd'.repeat(64), 0)],
|
|
1885
2029
|
feeRate: 10,
|
|
2030
|
+
priorityFee: 0n,
|
|
2031
|
+
gasSatFee: 0n,
|
|
1886
2032
|
pubkeys,
|
|
1887
2033
|
minimumSignatures: 2,
|
|
1888
2034
|
receiver: address1,
|
|
@@ -1897,16 +2043,19 @@ describe('Offline Transaction Signing', () => {
|
|
|
1897
2043
|
});
|
|
1898
2044
|
|
|
1899
2045
|
it('should report signer has not signed before signing', () => {
|
|
1900
|
-
const pubkeys = [
|
|
1901
|
-
signer1.publicKey,
|
|
1902
|
-
signer2.publicKey,
|
|
2046
|
+
const pubkeys: Buffer[] = [
|
|
2047
|
+
Buffer.from(signer1.publicKey),
|
|
2048
|
+
Buffer.from(signer2.publicKey),
|
|
1903
2049
|
];
|
|
1904
2050
|
|
|
1905
2051
|
const params = {
|
|
2052
|
+
signer: defaultSigner,
|
|
1906
2053
|
network,
|
|
1907
2054
|
mldsaSigner: null,
|
|
1908
2055
|
utxos: [createTaprootUtxo(defaultAddress, 100000n, 'e'.repeat(64), 0)],
|
|
1909
2056
|
feeRate: 10,
|
|
2057
|
+
priorityFee: 0n,
|
|
2058
|
+
gasSatFee: 0n,
|
|
1910
2059
|
pubkeys,
|
|
1911
2060
|
minimumSignatures: 2,
|
|
1912
2061
|
receiver: address1,
|
|
@@ -1916,8 +2065,12 @@ describe('Offline Transaction Signing', () => {
|
|
|
1916
2065
|
|
|
1917
2066
|
const state = OfflineTransactionManager.exportMultiSig(params);
|
|
1918
2067
|
|
|
1919
|
-
expect(
|
|
1920
|
-
|
|
2068
|
+
expect(
|
|
2069
|
+
OfflineTransactionManager.multiSigHasSigned(state, Buffer.from(signer1.publicKey)),
|
|
2070
|
+
).toBe(false);
|
|
2071
|
+
expect(
|
|
2072
|
+
OfflineTransactionManager.multiSigHasSigned(state, Buffer.from(signer2.publicKey)),
|
|
2073
|
+
).toBe(false);
|
|
1921
2074
|
});
|
|
1922
2075
|
|
|
1923
2076
|
it('should throw error for non-multisig state in multisig methods', () => {
|
|
@@ -1936,30 +2089,40 @@ describe('Offline Transaction Signing', () => {
|
|
|
1936
2089
|
|
|
1937
2090
|
const fundingState = OfflineTransactionManager.exportFunding(fundingParams);
|
|
1938
2091
|
|
|
1939
|
-
expect(() =>
|
|
1940
|
-
.
|
|
2092
|
+
expect(() =>
|
|
2093
|
+
OfflineTransactionManager.multiSigGetSignatureStatus(fundingState),
|
|
2094
|
+
).toThrow('State is not a multisig transaction');
|
|
1941
2095
|
|
|
1942
|
-
expect(() =>
|
|
1943
|
-
.
|
|
2096
|
+
expect(() =>
|
|
2097
|
+
OfflineTransactionManager.multiSigHasSigned(
|
|
2098
|
+
fundingState,
|
|
2099
|
+
Buffer.from(signer1.publicKey),
|
|
2100
|
+
),
|
|
2101
|
+
).toThrow('State is not a multisig transaction');
|
|
1944
2102
|
|
|
1945
|
-
expect(() => OfflineTransactionManager.multiSigGetPsbt(fundingState))
|
|
1946
|
-
|
|
2103
|
+
expect(() => OfflineTransactionManager.multiSigGetPsbt(fundingState)).toThrow(
|
|
2104
|
+
'State is not a multisig transaction',
|
|
2105
|
+
);
|
|
1947
2106
|
|
|
1948
|
-
expect(() => OfflineTransactionManager.multiSigFinalize(fundingState))
|
|
1949
|
-
|
|
2107
|
+
expect(() => OfflineTransactionManager.multiSigFinalize(fundingState)).toThrow(
|
|
2108
|
+
'State is not a multisig transaction',
|
|
2109
|
+
);
|
|
1950
2110
|
});
|
|
1951
2111
|
|
|
1952
2112
|
it('should throw error when finalizing without signatures', () => {
|
|
1953
|
-
const pubkeys = [
|
|
1954
|
-
signer1.publicKey,
|
|
1955
|
-
signer2.publicKey,
|
|
2113
|
+
const pubkeys: Buffer[] = [
|
|
2114
|
+
Buffer.from(signer1.publicKey),
|
|
2115
|
+
Buffer.from(signer2.publicKey),
|
|
1956
2116
|
];
|
|
1957
2117
|
|
|
1958
2118
|
const params = {
|
|
2119
|
+
signer: defaultSigner,
|
|
1959
2120
|
network,
|
|
1960
2121
|
mldsaSigner: null,
|
|
1961
2122
|
utxos: [createTaprootUtxo(defaultAddress, 100000n, '1'.repeat(64), 0)],
|
|
1962
2123
|
feeRate: 10,
|
|
2124
|
+
priorityFee: 0n,
|
|
2125
|
+
gasSatFee: 0n,
|
|
1963
2126
|
pubkeys,
|
|
1964
2127
|
minimumSignatures: 2,
|
|
1965
2128
|
receiver: address1,
|
|
@@ -1969,21 +2132,25 @@ describe('Offline Transaction Signing', () => {
|
|
|
1969
2132
|
|
|
1970
2133
|
const state = OfflineTransactionManager.exportMultiSig(params);
|
|
1971
2134
|
|
|
1972
|
-
expect(() => OfflineTransactionManager.multiSigFinalize(state))
|
|
1973
|
-
|
|
2135
|
+
expect(() => OfflineTransactionManager.multiSigFinalize(state)).toThrow(
|
|
2136
|
+
'No PSBT found in state',
|
|
2137
|
+
);
|
|
1974
2138
|
});
|
|
1975
2139
|
|
|
1976
2140
|
it('should update PSBT in state', () => {
|
|
1977
|
-
const pubkeys = [
|
|
1978
|
-
signer1.publicKey,
|
|
1979
|
-
signer2.publicKey,
|
|
2141
|
+
const pubkeys: Buffer[] = [
|
|
2142
|
+
Buffer.from(signer1.publicKey),
|
|
2143
|
+
Buffer.from(signer2.publicKey),
|
|
1980
2144
|
];
|
|
1981
2145
|
|
|
1982
2146
|
const params = {
|
|
2147
|
+
signer: defaultSigner,
|
|
1983
2148
|
network,
|
|
1984
2149
|
mldsaSigner: null,
|
|
1985
2150
|
utxos: [createTaprootUtxo(defaultAddress, 100000n, '2'.repeat(64), 0)],
|
|
1986
2151
|
feeRate: 10,
|
|
2152
|
+
priorityFee: 0n,
|
|
2153
|
+
gasSatFee: 0n,
|
|
1987
2154
|
pubkeys,
|
|
1988
2155
|
minimumSignatures: 2,
|
|
1989
2156
|
receiver: address1,
|
|
@@ -1995,7 +2162,10 @@ describe('Offline Transaction Signing', () => {
|
|
|
1995
2162
|
|
|
1996
2163
|
// Update with a mock PSBT
|
|
1997
2164
|
const mockPsbtBase64 = 'cHNidP8BAH0CAAAAAb=='; // Minimal valid base64
|
|
1998
|
-
const updatedState = OfflineTransactionManager.multiSigUpdatePsbt(
|
|
2165
|
+
const updatedState = OfflineTransactionManager.multiSigUpdatePsbt(
|
|
2166
|
+
state,
|
|
2167
|
+
mockPsbtBase64,
|
|
2168
|
+
);
|
|
1999
2169
|
|
|
2000
2170
|
const inspected = OfflineTransactionManager.inspect(updatedState);
|
|
2001
2171
|
if (isMultiSigSpecificData(inspected.typeSpecificData)) {
|
|
@@ -2004,13 +2174,14 @@ describe('Offline Transaction Signing', () => {
|
|
|
2004
2174
|
});
|
|
2005
2175
|
|
|
2006
2176
|
it('should preserve multisig data through serialization round-trip', () => {
|
|
2007
|
-
const pubkeys = [
|
|
2008
|
-
signer1.publicKey,
|
|
2009
|
-
signer2.publicKey,
|
|
2010
|
-
signer3.publicKey,
|
|
2177
|
+
const pubkeys: Buffer[] = [
|
|
2178
|
+
Buffer.from(signer1.publicKey),
|
|
2179
|
+
Buffer.from(signer2.publicKey),
|
|
2180
|
+
Buffer.from(signer3.publicKey),
|
|
2011
2181
|
];
|
|
2012
2182
|
|
|
2013
2183
|
const params = {
|
|
2184
|
+
signer: defaultSigner,
|
|
2014
2185
|
network,
|
|
2015
2186
|
mldsaSigner: null,
|
|
2016
2187
|
utxos: [
|
|
@@ -2018,6 +2189,8 @@ describe('Offline Transaction Signing', () => {
|
|
|
2018
2189
|
createTaprootUtxo(defaultAddress, 60000n, '4'.repeat(64), 1),
|
|
2019
2190
|
],
|
|
2020
2191
|
feeRate: 20,
|
|
2192
|
+
priorityFee: 0n,
|
|
2193
|
+
gasSatFee: 0n,
|
|
2021
2194
|
pubkeys,
|
|
2022
2195
|
minimumSignatures: 2,
|
|
2023
2196
|
receiver: address1,
|