@btc-vision/transaction 1.8.0-beta.0 → 1.8.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/_version.d.ts +2 -1
- package/browser/_version.d.ts.map +1 -0
- package/browser/abi/ABICoder.d.ts +15 -36
- package/browser/abi/ABICoder.d.ts.map +1 -0
- package/browser/abi/ABIDataTypes.d.ts +35 -0
- package/browser/abi/ABIDataTypes.d.ts.map +1 -0
- package/browser/abi/AbiTypes.d.ts +50 -0
- package/browser/abi/AbiTypes.d.ts.map +1 -0
- package/browser/abi/TupleUtils.d.ts +25 -0
- package/browser/abi/TupleUtils.d.ts.map +1 -0
- package/browser/branded/Branded.d.ts +4 -0
- package/browser/branded/Branded.d.ts.map +1 -0
- package/browser/btc-vision-bitcoin.js +12388 -3684
- package/browser/buffer/BinaryReader.d.ts +120 -1
- package/browser/buffer/BinaryReader.d.ts.map +1 -0
- package/browser/buffer/BinaryWriter.d.ts +51 -1
- package/browser/buffer/BinaryWriter.d.ts.map +1 -0
- package/browser/bytecode/Compressor.d.ts +12 -0
- package/browser/bytecode/Compressor.d.ts.map +1 -0
- package/browser/chain/ChainData.d.ts +2 -2
- package/browser/chain/ChainData.d.ts.map +1 -0
- package/browser/consensus/Consensus.d.ts +11 -3
- package/browser/consensus/Consensus.d.ts.map +1 -0
- package/browser/consensus/ConsensusConfig.d.ts +1 -0
- package/browser/consensus/ConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/IConsensusConfig.d.ts +1 -0
- package/browser/consensus/IConsensusConfig.d.ts.map +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts +1 -0
- package/browser/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/browser/crypto/crypto.d.ts +1 -0
- package/browser/crypto/crypto.d.ts.map +1 -0
- package/browser/deterministic/AddressMap.d.ts +6 -1
- package/browser/deterministic/AddressMap.d.ts.map +1 -0
- package/browser/deterministic/AddressSet.d.ts +3 -1
- package/browser/deterministic/AddressSet.d.ts.map +1 -0
- package/browser/deterministic/CustomMap.d.ts +3 -1
- package/browser/deterministic/CustomMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicMap.d.ts +3 -1
- package/browser/deterministic/DeterministicMap.d.ts.map +1 -0
- package/browser/deterministic/DeterministicSet.d.ts +3 -1
- package/browser/deterministic/DeterministicSet.d.ts.map +1 -0
- package/browser/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/browser/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/browser/deterministic/FastMap.d.ts +7 -1
- package/browser/deterministic/FastMap.d.ts.map +1 -0
- package/browser/ecc/backend.d.ts +13 -0
- package/browser/ecc/backend.d.ts.map +1 -0
- package/browser/epoch/ChallengeSolution.d.ts +33 -1
- package/browser/epoch/ChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/browser/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/browser/epoch/validator/EpochValidator.d.ts +37 -7
- package/browser/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/browser/event/NetEvent.d.ts +1 -0
- package/browser/event/NetEvent.d.ts.map +1 -0
- package/browser/generators/AddressGenerator.d.ts +4 -3
- package/browser/generators/AddressGenerator.d.ts.map +1 -0
- package/browser/generators/Features.d.ts +1 -0
- package/browser/generators/Features.d.ts.map +1 -0
- package/browser/generators/Generator.d.ts +46 -10
- package/browser/generators/Generator.d.ts.map +1 -0
- package/browser/generators/MLDSAData.d.ts +1 -0
- package/browser/generators/MLDSAData.d.ts.map +1 -0
- package/browser/generators/builders/CalldataGenerator.d.ts +25 -4
- package/browser/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/CustomGenerator.d.ts +13 -3
- package/browser/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/browser/generators/builders/DeploymentGenerator.d.ts +15 -4
- package/browser/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/HashCommitmentGenerator.d.ts +164 -12
- package/browser/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts +26 -4
- package/browser/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/browser/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/browser/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/browser/generators/builders/P2WDAGenerator.d.ts +42 -4
- package/browser/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/browser/index.d.ts +1 -0
- package/browser/index.d.ts.map +1 -0
- package/browser/index.js +3921 -3450
- package/browser/keypair/Address.d.ts +283 -13
- package/browser/keypair/Address.d.ts.map +1 -0
- package/browser/keypair/AddressVerificator.d.ts +7 -6
- package/browser/keypair/AddressVerificator.d.ts.map +1 -0
- package/browser/keypair/EcKeyPair.d.ts +183 -20
- package/browser/keypair/EcKeyPair.d.ts.map +1 -0
- package/browser/keypair/MessageSigner.d.ts +17 -16
- package/browser/keypair/MessageSigner.d.ts.map +1 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/browser/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/browser/keypair/Wallet.d.ts +27 -13
- package/browser/keypair/Wallet.d.ts.map +1 -0
- package/browser/keypair/interfaces/IWallet.d.ts +19 -0
- package/browser/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/browser/metadata/ContractBaseMetadata.d.ts +10 -2
- package/browser/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/browser/mnemonic/BIPStandard.d.ts +59 -0
- package/browser/mnemonic/BIPStandard.d.ts.map +1 -0
- package/browser/mnemonic/Mnemonic.d.ts +15 -3
- package/browser/mnemonic/Mnemonic.d.ts.map +1 -0
- package/browser/mnemonic/MnemonicStrength.d.ts +6 -0
- package/browser/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/browser/network/ChainId.d.ts +1 -0
- package/browser/network/ChainId.d.ts.map +1 -0
- package/browser/noble-curves.js +920 -2966
- package/browser/noble-hashes.js +2067 -1038
- package/browser/opnet.d.ts +25 -1
- package/browser/opnet.d.ts.map +1 -0
- package/browser/p2wda/P2WDADetector.d.ts +36 -9
- package/browser/p2wda/P2WDADetector.d.ts.map +1 -0
- package/browser/polyfill/disposable.d.ts +16 -0
- package/browser/polyfill/disposable.d.ts.map +1 -0
- package/browser/signer/AddressRotation.d.ts +36 -0
- package/browser/signer/AddressRotation.d.ts.map +1 -0
- package/browser/signer/IRotationSigner.d.ts +27 -3
- package/browser/signer/IRotationSigner.d.ts.map +1 -0
- package/browser/signer/ParallelSignerAdapter.d.ts +14 -0
- package/browser/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/browser/signer/SignerUtils.d.ts +11 -4
- package/browser/signer/SignerUtils.d.ts.map +1 -0
- package/browser/signer/TweakedSigner.d.ts +28 -4
- package/browser/signer/TweakedSigner.d.ts.map +1 -0
- package/browser/transaction/ContractAddress.d.ts +2 -2
- package/browser/transaction/ContractAddress.d.ts.map +1 -0
- package/browser/transaction/TransactionFactory.d.ts +140 -2
- package/browser/transaction/TransactionFactory.d.ts.map +1 -0
- package/browser/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/browser/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts +1 -0
- package/browser/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/browser/transaction/browser/Web3Provider.d.ts +27 -0
- package/browser/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/browser/transaction/browser/extensions/XverseSigner.d.ts +9 -7
- package/browser/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/browser/transaction/browser/types/OPWallet.d.ts +10 -0
- package/browser/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts +1 -0
- package/browser/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts +1 -0
- package/browser/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/browser/transaction/builders/CancelTransaction.d.ts +29 -4
- package/browser/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +137 -10
- package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/CustomScriptTransaction.d.ts +106 -6
- package/browser/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/DeploymentTransaction.d.ts +116 -5
- package/browser/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/FundingTransaction.d.ts +5 -3
- package/browser/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransaction.d.ts +12 -3
- package/browser/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +56 -5
- package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/browser/transaction/builders/MultiSignTransaction.d.ts +125 -16
- package/browser/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +103 -15
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/browser/transaction/builders/TransactionBuilder.d.ts +238 -15
- package/browser/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/browser/transaction/enums/TransactionType.d.ts +1 -0
- package/browser/transaction/enums/TransactionType.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts +2 -1
- package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +46 -3
- package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts +6 -4
- package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionParameters.d.ts +33 -10
- package/browser/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts +1 -0
- package/browser/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts +17 -5
- package/browser/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts +26 -0
- package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/browser/transaction/interfaces/Tap.d.ts +4 -3
- package/browser/transaction/interfaces/Tap.d.ts.map +1 -0
- package/browser/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/browser/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/browser/transaction/mineable/TimelockGenerator.d.ts +12 -3
- package/browser/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/browser/transaction/offline/OfflineTransactionManager.d.ts +190 -9
- package/browser/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionReconstructor.d.ts +53 -3
- package/browser/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionSerializer.d.ts +53 -2
- package/browser/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/browser/transaction/offline/TransactionStateCapture.d.ts +64 -5
- package/browser/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts +71 -0
- package/browser/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts +76 -0
- package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/browser/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/browser/transaction/shared/P2TR_MS.d.ts +11 -2
- package/browser/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/browser/transaction/shared/TweakedTransaction.d.ts +274 -33
- package/browser/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/browser/transaction/utils/WitnessUtils.d.ts +7 -1
- package/browser/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/browser/utils/BitcoinUtils.d.ts +19 -0
- package/browser/utils/BitcoinUtils.d.ts.map +1 -0
- package/browser/utils/BufferHelper.d.ts +1 -0
- package/browser/utils/BufferHelper.d.ts.map +1 -0
- package/browser/utils/StringToBuffer.d.ts +1 -0
- package/browser/utils/StringToBuffer.d.ts.map +1 -0
- package/browser/utils/lengths.d.ts +1 -0
- package/browser/utils/lengths.d.ts.map +1 -0
- package/browser/utils/types.d.ts +1 -0
- package/browser/utils/types.d.ts.map +1 -0
- package/browser/utxo/OPNetLimitedProvider.d.ts +37 -1
- package/browser/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/browser/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/browser/utxo/interfaces/IUTXO.d.ts +11 -5
- package/browser/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/browser/vendors.js +13940 -9389
- package/browser/verification/TapscriptVerificator.d.ts +10 -8
- package/browser/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/_version.d.ts +2 -1
- package/build/_version.d.ts.map +1 -0
- package/build/_version.js +2 -1
- package/build/_version.js.map +1 -0
- package/build/abi/ABICoder.d.ts +15 -36
- package/build/abi/ABICoder.d.ts.map +1 -0
- package/build/abi/ABICoder.js +120 -143
- package/build/abi/ABICoder.js.map +1 -0
- package/build/abi/ABIDataTypes.d.ts +35 -0
- package/build/abi/ABIDataTypes.d.ts.map +1 -0
- package/build/abi/ABIDataTypes.js +42 -0
- package/build/abi/ABIDataTypes.js.map +1 -0
- package/build/abi/AbiTypes.d.ts +50 -0
- package/build/abi/AbiTypes.d.ts.map +1 -0
- package/build/abi/AbiTypes.js +78 -0
- package/build/abi/AbiTypes.js.map +1 -0
- package/build/abi/TupleUtils.d.ts +25 -0
- package/build/abi/TupleUtils.d.ts.map +1 -0
- package/build/abi/TupleUtils.js +50 -0
- package/build/abi/TupleUtils.js.map +1 -0
- package/build/branded/Branded.d.ts +4 -0
- package/build/branded/Branded.d.ts.map +1 -0
- package/build/branded/Branded.js +2 -0
- package/build/branded/Branded.js.map +1 -0
- package/build/buffer/BinaryReader.d.ts +121 -2
- package/build/buffer/BinaryReader.d.ts.map +1 -0
- package/build/buffer/BinaryReader.js +129 -5
- package/build/buffer/BinaryReader.js.map +1 -0
- package/build/buffer/BinaryWriter.d.ts +52 -2
- package/build/buffer/BinaryWriter.d.ts.map +1 -0
- package/build/buffer/BinaryWriter.js +62 -2
- package/build/buffer/BinaryWriter.js.map +1 -0
- package/build/bytecode/Compressor.d.ts +12 -0
- package/build/bytecode/Compressor.d.ts.map +1 -0
- package/build/bytecode/Compressor.js +17 -5
- package/build/bytecode/Compressor.js.map +1 -0
- package/build/chain/ChainData.d.ts +2 -2
- package/build/chain/ChainData.d.ts.map +1 -0
- package/build/chain/ChainData.js +37 -16
- package/build/chain/ChainData.js.map +1 -0
- package/build/consensus/Consensus.d.ts +11 -3
- package/build/consensus/Consensus.d.ts.map +1 -0
- package/build/consensus/Consensus.js +8 -0
- package/build/consensus/Consensus.js.map +1 -0
- package/build/consensus/ConsensusConfig.d.ts +2 -1
- package/build/consensus/ConsensusConfig.d.ts.map +1 -0
- package/build/consensus/ConsensusConfig.js +1 -0
- package/build/consensus/ConsensusConfig.js.map +1 -0
- package/build/consensus/IConsensusConfig.d.ts +1 -0
- package/build/consensus/IConsensusConfig.d.ts.map +1 -0
- package/build/consensus/IConsensusConfig.js +2 -1
- package/build/consensus/IConsensusConfig.js.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.d.ts +2 -1
- package/build/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
- package/build/consensus/metadata/RoswellConsensus.js +2 -0
- package/build/consensus/metadata/RoswellConsensus.js.map +1 -0
- package/build/crypto/crypto.d.ts +1 -0
- package/build/crypto/crypto.d.ts.map +1 -0
- package/build/crypto/crypto.js +1 -0
- package/build/crypto/crypto.js.map +1 -0
- package/build/deterministic/AddressMap.d.ts +6 -1
- package/build/deterministic/AddressMap.d.ts.map +1 -0
- package/build/deterministic/AddressMap.js +8 -0
- package/build/deterministic/AddressMap.js.map +1 -0
- package/build/deterministic/AddressSet.d.ts +3 -1
- package/build/deterministic/AddressSet.d.ts.map +1 -0
- package/build/deterministic/AddressSet.js +7 -0
- package/build/deterministic/AddressSet.js.map +1 -0
- package/build/deterministic/CustomMap.d.ts +3 -1
- package/build/deterministic/CustomMap.d.ts.map +1 -0
- package/build/deterministic/CustomMap.js +65 -47
- package/build/deterministic/CustomMap.js.map +1 -0
- package/build/deterministic/DeterministicMap.d.ts +4 -2
- package/build/deterministic/DeterministicMap.d.ts.map +1 -0
- package/build/deterministic/DeterministicMap.js +24 -27
- package/build/deterministic/DeterministicMap.js.map +1 -0
- package/build/deterministic/DeterministicSet.d.ts +3 -1
- package/build/deterministic/DeterministicSet.d.ts.map +1 -0
- package/build/deterministic/DeterministicSet.js +6 -0
- package/build/deterministic/DeterministicSet.js.map +1 -0
- package/build/deterministic/ExtendedAddressMap.d.ts +7 -1
- package/build/deterministic/ExtendedAddressMap.d.ts.map +1 -0
- package/build/deterministic/ExtendedAddressMap.js +18 -2
- package/build/deterministic/ExtendedAddressMap.js.map +1 -0
- package/build/deterministic/FastMap.d.ts +7 -1
- package/build/deterministic/FastMap.d.ts.map +1 -0
- package/build/deterministic/FastMap.js +7 -2
- package/build/deterministic/FastMap.js.map +1 -0
- package/build/ecc/backend.d.ts +13 -0
- package/build/ecc/backend.d.ts.map +1 -0
- package/build/ecc/backend.js +15 -0
- package/build/ecc/backend.js.map +1 -0
- package/build/epoch/ChallengeSolution.d.ts +34 -2
- package/build/epoch/ChallengeSolution.d.ts.map +1 -0
- package/build/epoch/ChallengeSolution.js +52 -0
- package/build/epoch/ChallengeSolution.js.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.d.ts +14 -13
- package/build/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
- package/build/epoch/interfaces/IChallengeSolution.js +2 -1
- package/build/epoch/interfaces/IChallengeSolution.js.map +1 -0
- package/build/epoch/validator/EpochValidator.d.ts +38 -8
- package/build/epoch/validator/EpochValidator.d.ts.map +1 -0
- package/build/epoch/validator/EpochValidator.js +45 -19
- package/build/epoch/validator/EpochValidator.js.map +1 -0
- package/build/event/NetEvent.d.ts +1 -0
- package/build/event/NetEvent.d.ts.map +1 -0
- package/build/event/NetEvent.js +3 -0
- package/build/event/NetEvent.js.map +1 -0
- package/build/generators/AddressGenerator.d.ts +4 -3
- package/build/generators/AddressGenerator.d.ts.map +1 -0
- package/build/generators/AddressGenerator.js +9 -4
- package/build/generators/AddressGenerator.js.map +1 -0
- package/build/generators/Features.d.ts +4 -3
- package/build/generators/Features.d.ts.map +1 -0
- package/build/generators/Features.js +1 -0
- package/build/generators/Features.js.map +1 -0
- package/build/generators/Generator.d.ts +47 -11
- package/build/generators/Generator.d.ts.map +1 -0
- package/build/generators/Generator.js +48 -12
- package/build/generators/Generator.js.map +1 -0
- package/build/generators/MLDSAData.d.ts +1 -0
- package/build/generators/MLDSAData.d.ts.map +1 -0
- package/build/generators/MLDSAData.js +1 -0
- package/build/generators/MLDSAData.js.map +1 -0
- package/build/generators/builders/CalldataGenerator.d.ts +27 -6
- package/build/generators/builders/CalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/CalldataGenerator.js +33 -4
- package/build/generators/builders/CalldataGenerator.js.map +1 -0
- package/build/generators/builders/CustomGenerator.d.ts +13 -3
- package/build/generators/builders/CustomGenerator.d.ts.map +1 -0
- package/build/generators/builders/CustomGenerator.js +11 -0
- package/build/generators/builders/CustomGenerator.js.map +1 -0
- package/build/generators/builders/DeploymentGenerator.d.ts +17 -6
- package/build/generators/builders/DeploymentGenerator.d.ts.map +1 -0
- package/build/generators/builders/DeploymentGenerator.js +18 -2
- package/build/generators/builders/DeploymentGenerator.js.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.d.ts +166 -14
- package/build/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
- package/build/generators/builders/HashCommitmentGenerator.js +193 -27
- package/build/generators/builders/HashCommitmentGenerator.js.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.d.ts +27 -5
- package/build/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
- package/build/generators/builders/LegacyCalldataGenerator.js +35 -5
- package/build/generators/builders/LegacyCalldataGenerator.js.map +1 -0
- package/build/generators/builders/MultiSignGenerator.d.ts +6 -1
- package/build/generators/builders/MultiSignGenerator.d.ts.map +1 -0
- package/build/generators/builders/MultiSignGenerator.js +20 -10
- package/build/generators/builders/MultiSignGenerator.js.map +1 -0
- package/build/generators/builders/P2WDAGenerator.d.ts +44 -6
- package/build/generators/builders/P2WDAGenerator.d.ts.map +1 -0
- package/build/generators/builders/P2WDAGenerator.js +41 -2
- package/build/generators/builders/P2WDAGenerator.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -0
- package/build/keypair/Address.d.ts +284 -14
- package/build/keypair/Address.d.ts.map +1 -0
- package/build/keypair/Address.js +447 -129
- package/build/keypair/Address.js.map +1 -0
- package/build/keypair/AddressVerificator.d.ts +7 -6
- package/build/keypair/AddressVerificator.d.ts.map +1 -0
- package/build/keypair/AddressVerificator.js +4 -5
- package/build/keypair/AddressVerificator.js.map +1 -0
- package/build/keypair/EcKeyPair.d.ts +185 -22
- package/build/keypair/EcKeyPair.d.ts.map +1 -0
- package/build/keypair/EcKeyPair.js +226 -49
- package/build/keypair/EcKeyPair.js.map +1 -0
- package/build/keypair/MessageSigner.d.ts +18 -17
- package/build/keypair/MessageSigner.d.ts.map +1 -0
- package/build/keypair/MessageSigner.js +34 -25
- package/build/keypair/MessageSigner.js.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts +55 -0
- package/build/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
- package/build/keypair/Secp256k1PointDeriver.js +66 -0
- package/build/keypair/Secp256k1PointDeriver.js.map +1 -0
- package/build/keypair/Wallet.d.ts +29 -15
- package/build/keypair/Wallet.d.ts.map +1 -0
- package/build/keypair/Wallet.js +46 -14
- package/build/keypair/Wallet.js.map +1 -0
- package/build/keypair/interfaces/IWallet.d.ts +19 -0
- package/build/keypair/interfaces/IWallet.d.ts.map +1 -0
- package/build/keypair/interfaces/IWallet.js +1 -0
- package/build/keypair/interfaces/IWallet.js.map +1 -0
- package/build/metadata/ContractBaseMetadata.d.ts +10 -2
- package/build/metadata/ContractBaseMetadata.d.ts.map +1 -0
- package/build/metadata/ContractBaseMetadata.js +10 -1
- package/build/metadata/ContractBaseMetadata.js.map +1 -0
- package/build/mnemonic/BIPStandard.d.ts +59 -0
- package/build/mnemonic/BIPStandard.d.ts.map +1 -0
- package/build/mnemonic/BIPStandard.js +59 -0
- package/build/mnemonic/BIPStandard.js.map +1 -0
- package/build/mnemonic/Mnemonic.d.ts +16 -4
- package/build/mnemonic/Mnemonic.d.ts.map +1 -0
- package/build/mnemonic/Mnemonic.js +35 -8
- package/build/mnemonic/Mnemonic.js.map +1 -0
- package/build/mnemonic/MnemonicStrength.d.ts +6 -0
- package/build/mnemonic/MnemonicStrength.d.ts.map +1 -0
- package/build/mnemonic/MnemonicStrength.js +6 -0
- package/build/mnemonic/MnemonicStrength.js.map +1 -0
- package/build/network/ChainId.d.ts +1 -0
- package/build/network/ChainId.d.ts.map +1 -0
- package/build/network/ChainId.js +1 -0
- package/build/network/ChainId.js.map +1 -0
- package/build/opnet.d.ts +29 -3
- package/build/opnet.d.ts.map +1 -0
- package/build/opnet.js +26 -0
- package/build/opnet.js.map +1 -0
- package/build/p2wda/P2WDADetector.d.ts +38 -11
- package/build/p2wda/P2WDADetector.d.ts.map +1 -0
- package/build/p2wda/P2WDADetector.js +43 -10
- package/build/p2wda/P2WDADetector.js.map +1 -0
- package/build/polyfill/disposable.d.ts +16 -0
- package/build/polyfill/disposable.d.ts.map +1 -0
- package/build/polyfill/disposable.js +23 -0
- package/build/polyfill/disposable.js.map +1 -0
- package/build/signer/AddressRotation.d.ts +37 -1
- package/build/signer/AddressRotation.d.ts.map +1 -0
- package/build/signer/AddressRotation.js +16 -0
- package/build/signer/AddressRotation.js.map +1 -0
- package/build/signer/IRotationSigner.d.ts +27 -3
- package/build/signer/IRotationSigner.d.ts.map +1 -0
- package/build/signer/IRotationSigner.js +2 -1
- package/build/signer/IRotationSigner.js.map +1 -0
- package/build/signer/ParallelSignerAdapter.d.ts +14 -0
- package/build/signer/ParallelSignerAdapter.d.ts.map +1 -0
- package/build/signer/ParallelSignerAdapter.js +51 -0
- package/build/signer/ParallelSignerAdapter.js.map +1 -0
- package/build/signer/SignerUtils.d.ts +11 -4
- package/build/signer/SignerUtils.d.ts.map +1 -0
- package/build/signer/SignerUtils.js +16 -0
- package/build/signer/SignerUtils.js.map +1 -0
- package/build/signer/TweakedSigner.d.ts +28 -4
- package/build/signer/TweakedSigner.d.ts.map +1 -0
- package/build/signer/TweakedSigner.js +23 -6
- package/build/signer/TweakedSigner.js.map +1 -0
- package/build/transaction/ContractAddress.d.ts +2 -2
- package/build/transaction/ContractAddress.d.ts.map +1 -0
- package/build/transaction/ContractAddress.js +4 -8
- package/build/transaction/ContractAddress.js.map +1 -0
- package/build/transaction/TransactionFactory.d.ts +147 -9
- package/build/transaction/TransactionFactory.d.ts.map +1 -0
- package/build/transaction/TransactionFactory.js +145 -26
- package/build/transaction/TransactionFactory.js.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.d.ts +12 -6
- package/build/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
- package/build/transaction/browser/BrowserSignerBase.js +7 -0
- package/build/transaction/browser/BrowserSignerBase.js.map +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts +1 -0
- package/build/transaction/browser/WalletNetworks.d.ts.map +1 -0
- package/build/transaction/browser/WalletNetworks.js +1 -0
- package/build/transaction/browser/WalletNetworks.js.map +1 -0
- package/build/transaction/browser/Web3Provider.d.ts +30 -3
- package/build/transaction/browser/Web3Provider.d.ts.map +1 -0
- package/build/transaction/browser/Web3Provider.js +1 -0
- package/build/transaction/browser/Web3Provider.js.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.d.ts +11 -9
- package/build/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/UnisatSigner.js +27 -17
- package/build/transaction/browser/extensions/UnisatSigner.js.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.d.ts +10 -8
- package/build/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
- package/build/transaction/browser/extensions/XverseSigner.js +25 -15
- package/build/transaction/browser/extensions/XverseSigner.js.map +1 -0
- package/build/transaction/browser/types/OPWallet.d.ts +12 -2
- package/build/transaction/browser/types/OPWallet.d.ts.map +1 -0
- package/build/transaction/browser/types/OPWallet.js +4 -0
- package/build/transaction/browser/types/OPWallet.js.map +1 -0
- package/build/transaction/browser/types/Unisat.d.ts +2 -1
- package/build/transaction/browser/types/Unisat.d.ts.map +1 -0
- package/build/transaction/browser/types/Unisat.js +2 -0
- package/build/transaction/browser/types/Unisat.js.map +1 -0
- package/build/transaction/browser/types/Xverse.d.ts +1 -0
- package/build/transaction/browser/types/Xverse.d.ts.map +1 -0
- package/build/transaction/browser/types/Xverse.js +1 -0
- package/build/transaction/browser/types/Xverse.js.map +1 -0
- package/build/transaction/builders/CancelTransaction.d.ts +31 -6
- package/build/transaction/builders/CancelTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CancelTransaction.js +116 -33
- package/build/transaction/builders/CancelTransaction.js.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js +88 -0
- package/build/transaction/builders/ChallengeSolutionTransaction.js.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +140 -13
- package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js +197 -20
- package/build/transaction/builders/ConsolidatedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.d.ts +108 -8
- package/build/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
- package/build/transaction/builders/CustomScriptTransaction.js +176 -39
- package/build/transaction/builders/CustomScriptTransaction.js.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.d.ts +120 -9
- package/build/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
- package/build/transaction/builders/DeploymentTransaction.js +194 -51
- package/build/transaction/builders/DeploymentTransaction.js.map +1 -0
- package/build/transaction/builders/FundingTransaction.d.ts +6 -4
- package/build/transaction/builders/FundingTransaction.d.ts.map +1 -0
- package/build/transaction/builders/FundingTransaction.js +50 -9
- package/build/transaction/builders/FundingTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransaction.d.ts +14 -5
- package/build/transaction/builders/InteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransaction.js +18 -5
- package/build/transaction/builders/InteractionTransaction.js.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts +58 -7
- package/build/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
- package/build/transaction/builders/InteractionTransactionP2WDA.js +95 -18
- package/build/transaction/builders/InteractionTransactionP2WDA.js.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.d.ts +126 -17
- package/build/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
- package/build/transaction/builders/MultiSignTransaction.js +201 -76
- package/build/transaction/builders/MultiSignTransaction.js.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +106 -18
- package/build/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
- package/build/transaction/builders/SharedInteractionTransaction.js +158 -40
- package/build/transaction/builders/SharedInteractionTransaction.js.map +1 -0
- package/build/transaction/builders/TransactionBuilder.d.ts +244 -20
- package/build/transaction/builders/TransactionBuilder.d.ts.map +1 -0
- package/build/transaction/builders/TransactionBuilder.js +371 -152
- package/build/transaction/builders/TransactionBuilder.js.map +1 -0
- package/build/transaction/enums/TransactionType.d.ts +1 -0
- package/build/transaction/enums/TransactionType.d.ts.map +1 -0
- package/build/transaction/enums/TransactionType.js +1 -0
- package/build/transaction/enums/TransactionType.js.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts +3 -2
- package/build/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICancelTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +48 -5
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js +1 -0
- package/build/transaction/interfaces/IConsolidatedTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts +7 -5
- package/build/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js +1 -0
- package/build/transaction/interfaces/ICustomTransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.d.ts +38 -15
- package/build/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js +1 -0
- package/build/transaction/interfaces/ITransactionParameters.js.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.d.ts +3 -2
- package/build/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js +1 -0
- package/build/transaction/interfaces/ITransactionResponses.js.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts +21 -8
- package/build/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js +1 -0
- package/build/transaction/interfaces/ITweakedTransactionData.js.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts +29 -3
- package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
- package/build/transaction/interfaces/IWeb3ProviderTypes.js +2 -1
- package/build/transaction/interfaces/IWeb3ProviderTypes.js.map +1 -0
- package/build/transaction/interfaces/Tap.d.ts +4 -3
- package/build/transaction/interfaces/Tap.d.ts.map +1 -0
- package/build/transaction/interfaces/Tap.js +1 -0
- package/build/transaction/interfaces/Tap.js.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.d.ts +2 -1
- package/build/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js +1 -0
- package/build/transaction/mineable/IP2WSHAddress.js.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.d.ts +13 -4
- package/build/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
- package/build/transaction/mineable/TimelockGenerator.js +12 -3
- package/build/transaction/mineable/TimelockGenerator.js.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.d.ts +193 -12
- package/build/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
- package/build/transaction/offline/OfflineTransactionManager.js +192 -8
- package/build/transaction/offline/OfflineTransactionManager.js.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.d.ts +56 -6
- package/build/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
- package/build/transaction/offline/TransactionReconstructor.js +111 -75
- package/build/transaction/offline/TransactionReconstructor.js.map +1 -0
- package/build/transaction/offline/TransactionSerializer.d.ts +54 -3
- package/build/transaction/offline/TransactionSerializer.d.ts.map +1 -0
- package/build/transaction/offline/TransactionSerializer.js +206 -95
- package/build/transaction/offline/TransactionSerializer.js.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.d.ts +66 -7
- package/build/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
- package/build/transaction/offline/TransactionStateCapture.js +124 -60
- package/build/transaction/offline/TransactionStateCapture.js.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.d.ts +72 -1
- package/build/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ISerializableState.js +10 -1
- package/build/transaction/offline/interfaces/ISerializableState.js.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts +77 -1
- package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js +19 -0
- package/build/transaction/offline/interfaces/ITypeSpecificData.js.map +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts +1 -0
- package/build/transaction/psbt/PSBTTypes.d.ts.map +1 -0
- package/build/transaction/psbt/PSBTTypes.js +1 -0
- package/build/transaction/psbt/PSBTTypes.js.map +1 -0
- package/build/transaction/shared/P2TR_MS.d.ts +11 -2
- package/build/transaction/shared/P2TR_MS.d.ts.map +1 -0
- package/build/transaction/shared/P2TR_MS.js +10 -0
- package/build/transaction/shared/P2TR_MS.js.map +1 -0
- package/build/transaction/shared/TweakedTransaction.d.ts +280 -38
- package/build/transaction/shared/TweakedTransaction.d.ts.map +1 -0
- package/build/transaction/shared/TweakedTransaction.js +576 -114
- package/build/transaction/shared/TweakedTransaction.js.map +1 -0
- package/build/transaction/utils/WitnessUtils.d.ts +7 -1
- package/build/transaction/utils/WitnessUtils.d.ts.map +1 -0
- package/build/transaction/utils/WitnessUtils.js +17 -3
- package/build/transaction/utils/WitnessUtils.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/utils/BitcoinUtils.d.ts +19 -0
- package/build/utils/BitcoinUtils.d.ts.map +1 -0
- package/build/utils/BitcoinUtils.js +19 -0
- package/build/utils/BitcoinUtils.js.map +1 -0
- package/build/utils/BufferHelper.d.ts +2 -1
- package/build/utils/BufferHelper.d.ts.map +1 -0
- package/build/utils/BufferHelper.js +38 -32
- package/build/utils/BufferHelper.js.map +1 -0
- package/build/utils/StringToBuffer.d.ts +1 -0
- package/build/utils/StringToBuffer.d.ts.map +1 -0
- package/build/utils/StringToBuffer.js +1 -0
- package/build/utils/StringToBuffer.js.map +1 -0
- package/build/utils/lengths.d.ts +1 -0
- package/build/utils/lengths.d.ts.map +1 -0
- package/build/utils/lengths.js +1 -0
- package/build/utils/lengths.js.map +1 -0
- package/build/utils/types.d.ts +1 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -1
- package/build/utils/types.js.map +1 -0
- package/build/utxo/OPNetLimitedProvider.d.ts +39 -3
- package/build/utxo/OPNetLimitedProvider.d.ts.map +1 -0
- package/build/utxo/OPNetLimitedProvider.js +43 -5
- package/build/utxo/OPNetLimitedProvider.js.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts +1 -0
- package/build/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js +1 -0
- package/build/utxo/interfaces/BroadcastResponse.js.map +1 -0
- package/build/utxo/interfaces/IUTXO.d.ts +13 -7
- package/build/utxo/interfaces/IUTXO.d.ts.map +1 -0
- package/build/utxo/interfaces/IUTXO.js +1 -0
- package/build/utxo/interfaces/IUTXO.js.map +1 -0
- package/build/verification/TapscriptVerificator.d.ts +12 -10
- package/build/verification/TapscriptVerificator.d.ts.map +1 -0
- package/build/verification/TapscriptVerificator.js +28 -38
- package/build/verification/TapscriptVerificator.js.map +1 -0
- package/documentation/offline-transaction-signing.md +10 -8
- package/documentation/quantum-support/01-introduction.md +2 -2
- package/documentation/quantum-support/02-mnemonic-and-wallet.md +5 -3
- package/documentation/quantum-support/03-address-generation.md +6 -4
- package/documentation/quantum-support/04-message-signing.md +36 -43
- package/documentation/quantum-support/05-address-verification.md +13 -18
- package/documentation/quantum-support/README.md +1 -1
- package/documentation/transaction-building.md +9 -9
- package/eslint.config.js +0 -1
- package/package.json +16 -39
- package/src/_version.ts +1 -1
- package/src/abi/ABICoder.ts +131 -154
- package/src/abi/ABIDataTypes.ts +45 -0
- package/src/abi/AbiTypes.ts +183 -0
- package/src/abi/TupleUtils.ts +57 -0
- package/src/branded/Branded.ts +5 -0
- package/src/buffer/BinaryReader.ts +7 -7
- package/src/buffer/BinaryWriter.ts +29 -24
- package/src/bytecode/Compressor.ts +1 -1
- package/src/chain/ChainData.ts +36 -25
- package/src/consensus/ConsensusConfig.ts +1 -1
- package/src/consensus/IConsensusConfig.ts +0 -17
- package/src/consensus/metadata/RoswellConsensus.ts +1 -17
- package/src/crypto/crypto-browser.js +3 -4
- package/src/deterministic/AddressMap.ts +5 -1
- package/src/deterministic/AddressSet.ts +5 -1
- package/src/deterministic/CustomMap.ts +6 -2
- package/src/deterministic/DeterministicMap.ts +8 -4
- package/src/deterministic/DeterministicSet.ts +6 -2
- package/src/deterministic/ExtendedAddressMap.ts +9 -4
- package/src/deterministic/FastMap.ts +9 -5
- package/src/ecc/backend.ts +17 -0
- package/src/epoch/ChallengeSolution.ts +3 -3
- package/src/epoch/interfaces/IChallengeSolution.ts +13 -13
- package/src/epoch/validator/EpochValidator.ts +24 -43
- package/src/generators/AddressGenerator.ts +4 -7
- package/src/generators/Features.ts +3 -3
- package/src/generators/Generator.ts +42 -26
- package/src/generators/builders/CalldataGenerator.ts +26 -24
- package/src/generators/builders/CustomGenerator.ts +4 -4
- package/src/generators/builders/DeploymentGenerator.ts +25 -23
- package/src/generators/builders/HashCommitmentGenerator.ts +31 -31
- package/src/generators/builders/LegacyCalldataGenerator.ts +26 -24
- package/src/generators/builders/MultiSignGenerator.ts +12 -12
- package/src/generators/builders/P2WDAGenerator.ts +10 -10
- package/src/keypair/Address.ts +115 -72
- package/src/keypair/AddressVerificator.ts +14 -148
- package/src/keypair/EcKeyPair.ts +110 -111
- package/src/keypair/MessageSigner.ts +70 -150
- package/src/keypair/Wallet.ts +56 -241
- package/src/metadata/ContractBaseMetadata.ts +2 -2
- package/src/mnemonic/Mnemonic.ts +31 -222
- package/src/opnet.ts +15 -6
- package/src/p2wda/P2WDADetector.ts +23 -72
- package/src/polyfill/disposable.ts +29 -0
- package/src/signer/AddressRotation.ts +1 -1
- package/src/signer/IRotationSigner.ts +3 -3
- package/src/signer/ParallelSignerAdapter.ts +59 -0
- package/src/signer/SignerUtils.ts +4 -4
- package/src/signer/TweakedSigner.ts +26 -14
- package/src/transaction/ContractAddress.ts +3 -7
- package/src/transaction/TransactionFactory.ts +38 -53
- package/src/transaction/browser/BrowserSignerBase.ts +12 -6
- package/src/transaction/browser/Web3Provider.ts +3 -3
- package/src/transaction/browser/extensions/UnisatSigner.ts +52 -48
- package/src/transaction/browser/extensions/XverseSigner.ts +55 -38
- package/src/transaction/browser/types/OPWallet.ts +2 -2
- package/src/transaction/browser/types/Unisat.ts +1 -1
- package/src/transaction/builders/CancelTransaction.ts +59 -24
- package/src/transaction/builders/ChallengeSolutionTransaction.ts +3 -3
- package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +39 -34
- package/src/transaction/builders/CustomScriptTransaction.ts +79 -56
- package/src/transaction/builders/DeploymentTransaction.ts +82 -63
- package/src/transaction/builders/FundingTransaction.ts +53 -12
- package/src/transaction/builders/InteractionTransaction.ts +10 -10
- package/src/transaction/builders/InteractionTransactionP2WDA.ts +38 -40
- package/src/transaction/builders/MultiSignTransaction.ts +68 -61
- package/src/transaction/builders/SharedInteractionTransaction.ts +81 -57
- package/src/transaction/builders/TransactionBuilder.ts +159 -255
- package/src/transaction/interfaces/ICancelTransactionParameters.ts +2 -2
- package/src/transaction/interfaces/IConsolidatedTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ICustomTransactionParameters.ts +5 -5
- package/src/transaction/interfaces/ITransactionParameters.ts +28 -15
- package/src/transaction/interfaces/ITransactionResponses.ts +2 -2
- package/src/transaction/interfaces/ITweakedTransactionData.ts +17 -8
- package/src/transaction/interfaces/IWeb3ProviderTypes.ts +3 -3
- package/src/transaction/interfaces/Tap.ts +3 -3
- package/src/transaction/mineable/IP2WSHAddress.ts +1 -1
- package/src/transaction/mineable/TimelockGenerator.ts +19 -12
- package/src/transaction/offline/OfflineTransactionManager.ts +22 -23
- package/src/transaction/offline/TransactionReconstructor.ts +83 -91
- package/src/transaction/offline/TransactionSerializer.ts +151 -101
- package/src/transaction/offline/TransactionStateCapture.ts +83 -79
- package/src/transaction/offline/interfaces/ISerializableState.ts +1 -1
- package/src/transaction/offline/interfaces/ITypeSpecificData.ts +1 -1
- package/src/transaction/shared/P2TR_MS.ts +4 -4
- package/src/transaction/shared/TweakedTransaction.ts +318 -125
- package/src/transaction/utils/WitnessUtils.ts +18 -9
- package/src/utils/BufferHelper.ts +39 -37
- package/src/utxo/OPNetLimitedProvider.ts +9 -9
- package/src/utxo/interfaces/IUTXO.ts +7 -7
- package/src/verification/TapscriptVerificator.ts +73 -86
- package/test/add-refund-output.test.ts +535 -0
- package/test/address-rotation.test.ts +24 -24
- package/test/address.test.ts +12 -12
- package/test/addressmap.test.ts +30 -30
- package/test/binary-reader-writer.test.ts +8 -8
- package/test/browser/offline-transaction.test.ts +2206 -0
- package/test/browser/parallel-signing.test.ts +316 -0
- package/test/browser/setup.ts +11 -0
- package/test/browser/transaction-signing.test.ts +416 -0
- package/test/buffer-helper.test.ts +287 -0
- package/test/derivePath.test.ts +4 -3
- package/test/disposable.test.ts +279 -0
- package/test/fastmap-setall.test.ts +1 -1
- package/test/fastmap.test.ts +3 -3
- package/test/messagesigner-mldsa.test.ts +3 -3
- package/test/messagesigner-schnorr.test.ts +9 -9
- package/test/offline-transaction.test.ts +461 -288
- package/test/old/FastBigIntMap.ts +3 -3
- package/test/oldfastmap.test.ts +6 -6
- package/test/transaction-builders.test.ts +482 -0
- package/tsconfig.base.json +34 -18
- package/tsconfig.browser.json +15 -0
- package/tsconfig.json +3 -8
- package/vite.config.browser.ts +4 -5
- package/vitest.config.browser.ts +68 -0
- package/vitest.config.ts +1 -1
- package/browser/valibot.js +0 -4948
- package/tsconfig.webpack.json +0 -18
|
@@ -1,44 +1,34 @@
|
|
|
1
|
-
import { IChallengeSolution, RawChallenge } from '../interfaces/IChallengeSolution.js';
|
|
2
|
-
import { crypto } from '@btc-vision/bitcoin';
|
|
1
|
+
import type { IChallengeSolution, RawChallenge } from '../interfaces/IChallengeSolution.js';
|
|
2
|
+
import { crypto, equals } from '@btc-vision/bitcoin';
|
|
3
3
|
import { Address } from '../../keypair/Address.js';
|
|
4
4
|
import { stringToBuffer } from '../../utils/StringToBuffer.js';
|
|
5
5
|
|
|
6
6
|
export class EpochValidator {
|
|
7
7
|
private static readonly BLOCKS_PER_EPOCH: bigint = 5n;
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Convert Buffer to Uint8Array
|
|
11
|
-
*/
|
|
12
|
-
public static bufferToUint8Array(buffer: Buffer): Uint8Array {
|
|
13
|
-
return new Uint8Array(buffer);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Convert Uint8Array to Buffer
|
|
18
|
-
*/
|
|
19
|
-
public static uint8ArrayToBuffer(array: Uint8Array): Buffer {
|
|
20
|
-
return Buffer.from(array);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
9
|
/**
|
|
24
10
|
* Calculate SHA-1 hash
|
|
25
11
|
*/
|
|
26
|
-
public static sha1(data: Uint8Array
|
|
27
|
-
return crypto.sha1(
|
|
12
|
+
public static sha1(data: Uint8Array): Uint8Array {
|
|
13
|
+
return crypto.sha1(data);
|
|
28
14
|
}
|
|
29
15
|
|
|
30
16
|
/**
|
|
31
17
|
* Calculate mining preimage
|
|
32
18
|
*/
|
|
33
|
-
public static calculatePreimage(
|
|
19
|
+
public static calculatePreimage(
|
|
20
|
+
checksumRoot: Uint8Array,
|
|
21
|
+
publicKey: Uint8Array,
|
|
22
|
+
salt: Uint8Array,
|
|
23
|
+
): Uint8Array {
|
|
34
24
|
// Ensure all are 32 bytes
|
|
35
25
|
if (checksumRoot.length !== 32 || publicKey.length !== 32 || salt.length !== 32) {
|
|
36
26
|
throw new Error('All inputs must be 32 bytes');
|
|
37
27
|
}
|
|
38
28
|
|
|
39
|
-
const preimage =
|
|
29
|
+
const preimage = new Uint8Array(32);
|
|
40
30
|
for (let i = 0; i < 32; i++) {
|
|
41
|
-
preimage[i] = checksumRoot[i] ^ publicKey[i] ^ salt[i];
|
|
31
|
+
preimage[i] = (checksumRoot[i] as number) ^ (publicKey[i] as number) ^ (salt[i] as number);
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
return preimage;
|
|
@@ -47,7 +37,7 @@ export class EpochValidator {
|
|
|
47
37
|
/**
|
|
48
38
|
* Count matching bits between two hashes
|
|
49
39
|
*/
|
|
50
|
-
public static countMatchingBits(hash1:
|
|
40
|
+
public static countMatchingBits(hash1: Uint8Array, hash2: Uint8Array): number {
|
|
51
41
|
let matchingBits = 0;
|
|
52
42
|
if (hash1.length !== hash2.length) {
|
|
53
43
|
throw new Error('Hashes must be of the same length');
|
|
@@ -63,7 +53,7 @@ export class EpochValidator {
|
|
|
63
53
|
} else {
|
|
64
54
|
// Check individual bits
|
|
65
55
|
for (let bit = 7; bit >= 0; bit--) {
|
|
66
|
-
if (((byte1 >> bit) & 1) === ((byte2 >> bit) & 1)) {
|
|
56
|
+
if ((((byte1 as number) >> bit) & 1) === (((byte2 as number) >> bit) & 1)) {
|
|
67
57
|
matchingBits++;
|
|
68
58
|
} else {
|
|
69
59
|
return matchingBits;
|
|
@@ -88,16 +78,12 @@ export class EpochValidator {
|
|
|
88
78
|
);
|
|
89
79
|
|
|
90
80
|
const computedSolution = this.sha1(calculatedPreimage);
|
|
91
|
-
const computedSolutionBuffer = this.uint8ArrayToBuffer(computedSolution);
|
|
92
81
|
|
|
93
|
-
if (!
|
|
82
|
+
if (!equals(computedSolution, challenge.solution)) {
|
|
94
83
|
return false;
|
|
95
84
|
}
|
|
96
85
|
|
|
97
|
-
const matchingBits = this.countMatchingBits(
|
|
98
|
-
computedSolutionBuffer,
|
|
99
|
-
verification.targetHash,
|
|
100
|
-
);
|
|
86
|
+
const matchingBits = this.countMatchingBits(computedSolution, verification.targetHash);
|
|
101
87
|
|
|
102
88
|
if (matchingBits !== challenge.difficulty) {
|
|
103
89
|
return false;
|
|
@@ -159,16 +145,12 @@ export class EpochValidator {
|
|
|
159
145
|
);
|
|
160
146
|
|
|
161
147
|
const computedSolution = this.sha1(calculatedPreimage);
|
|
162
|
-
const computedSolutionBuffer = this.uint8ArrayToBuffer(computedSolution);
|
|
163
148
|
|
|
164
|
-
if (!
|
|
149
|
+
if (!equals(computedSolution, solution)) {
|
|
165
150
|
return false;
|
|
166
151
|
}
|
|
167
152
|
|
|
168
|
-
const matchingBits = this.countMatchingBits(
|
|
169
|
-
computedSolutionBuffer,
|
|
170
|
-
verification.targetHash,
|
|
171
|
-
);
|
|
153
|
+
const matchingBits = this.countMatchingBits(computedSolution, verification.targetHash);
|
|
172
154
|
|
|
173
155
|
if (matchingBits !== difficulty) {
|
|
174
156
|
return false;
|
|
@@ -201,21 +183,20 @@ export class EpochValidator {
|
|
|
201
183
|
* @returns The SHA-1 hash of the preimage
|
|
202
184
|
*/
|
|
203
185
|
public static calculateSolution(
|
|
204
|
-
targetChecksum:
|
|
205
|
-
publicKey:
|
|
206
|
-
salt:
|
|
207
|
-
):
|
|
186
|
+
targetChecksum: Uint8Array,
|
|
187
|
+
publicKey: Uint8Array,
|
|
188
|
+
salt: Uint8Array,
|
|
189
|
+
): Uint8Array {
|
|
208
190
|
const preimage = this.calculatePreimage(targetChecksum, publicKey, salt);
|
|
209
|
-
|
|
210
|
-
return this.uint8ArrayToBuffer(hash);
|
|
191
|
+
return this.sha1(preimage);
|
|
211
192
|
}
|
|
212
193
|
|
|
213
194
|
/**
|
|
214
195
|
* Check if a solution meets the minimum difficulty requirement
|
|
215
196
|
*/
|
|
216
197
|
public static checkDifficulty(
|
|
217
|
-
solution:
|
|
218
|
-
targetHash:
|
|
198
|
+
solution: Uint8Array,
|
|
199
|
+
targetHash: Uint8Array,
|
|
219
200
|
minDifficulty: number,
|
|
220
201
|
): { valid: boolean; difficulty: number } {
|
|
221
202
|
const difficulty = this.countMatchingBits(solution, targetHash);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { bech32, bech32m } from 'bech32';
|
|
2
|
-
import {
|
|
3
|
-
import * as ecc from '@bitcoinerlab/secp256k1';
|
|
4
|
-
|
|
5
|
-
initEccLib(ecc);
|
|
2
|
+
import { type Network, ripemd160 } from '@btc-vision/bitcoin';
|
|
6
3
|
|
|
7
4
|
export class AddressGenerator {
|
|
8
5
|
// Generate a valid SegWit address from random bytes
|
|
9
|
-
public static generatePKSH(sha256Hash:
|
|
6
|
+
public static generatePKSH(sha256Hash: Uint8Array, network: Network): string {
|
|
10
7
|
if (sha256Hash.length !== 32) throw new Error('Invalid hash length');
|
|
11
8
|
|
|
12
9
|
const pkh = ripemd160(sha256Hash);
|
|
@@ -14,7 +11,7 @@ export class AddressGenerator {
|
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
// Generate a valid Taproot address from a public key
|
|
17
|
-
public static generateTaprootAddress(pubKey:
|
|
14
|
+
public static generateTaprootAddress(pubKey: Uint8Array, network: { bech32: string }): string {
|
|
18
15
|
if (pubKey.length !== 32) throw new Error('Invalid public key length');
|
|
19
16
|
|
|
20
17
|
// Convert the public key to words
|
|
@@ -28,7 +25,7 @@ export class AddressGenerator {
|
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
// Convert a hash to a SegWit address
|
|
31
|
-
private static toSegwitAddress(pkh:
|
|
28
|
+
private static toSegwitAddress(pkh: Uint8Array, network: Network): string {
|
|
32
29
|
const words = bech32.toWords(pkh);
|
|
33
30
|
words.unshift(0x00); // Add the witness version byte (0x00 for P2WPKH)
|
|
34
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LoadedStorage } from '../transaction/interfaces/ITransactionParameters.js';
|
|
2
|
-
import { ChallengeSubmission } from '../epoch/ChallengeSolution.js';
|
|
3
|
-
import { MLDSARequestData } from './MLDSAData.js';
|
|
1
|
+
import type { LoadedStorage } from '../transaction/interfaces/ITransactionParameters.js';
|
|
2
|
+
import type { ChallengeSubmission } from '../epoch/ChallengeSolution.js';
|
|
3
|
+
import type { MLDSARequestData } from './MLDSAData.js';
|
|
4
4
|
|
|
5
5
|
export enum Features {
|
|
6
6
|
ACCESS_LIST = 0b1,
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
alloc,
|
|
3
|
+
fromUtf8,
|
|
4
|
+
type Network,
|
|
5
|
+
networks,
|
|
6
|
+
type PublicKey,
|
|
7
|
+
toXOnly,
|
|
8
|
+
type XOnlyPublicKey,
|
|
9
|
+
} from '@btc-vision/bitcoin';
|
|
2
10
|
import { BinaryWriter } from '../buffer/BinaryWriter.js';
|
|
3
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
type AccessListFeature,
|
|
13
|
+
type EpochSubmissionFeature,
|
|
14
|
+
type Feature,
|
|
15
|
+
Features,
|
|
16
|
+
type MLDSALinkRequest,
|
|
17
|
+
} from './Features.js';
|
|
4
18
|
import { Address } from '../keypair/Address.js';
|
|
5
19
|
import { Compressor } from '../bytecode/Compressor.js';
|
|
6
20
|
|
|
@@ -14,25 +28,25 @@ export abstract class Generator {
|
|
|
14
28
|
/**
|
|
15
29
|
* The magic number of OPNet
|
|
16
30
|
*/
|
|
17
|
-
public static readonly MAGIC:
|
|
31
|
+
public static readonly MAGIC: Uint8Array = fromUtf8('op');
|
|
18
32
|
|
|
19
33
|
/**
|
|
20
34
|
* The public key of the sender
|
|
21
35
|
* @protected
|
|
22
36
|
*/
|
|
23
|
-
protected readonly senderPubKey:
|
|
37
|
+
protected readonly senderPubKey: Uint8Array;
|
|
24
38
|
|
|
25
39
|
/**
|
|
26
40
|
* The public key of the sender
|
|
27
41
|
* @protected
|
|
28
42
|
*/
|
|
29
|
-
protected readonly xSenderPubKey:
|
|
43
|
+
protected readonly xSenderPubKey: Uint8Array;
|
|
30
44
|
|
|
31
45
|
/**
|
|
32
46
|
* The public key of the contract salt
|
|
33
47
|
* @protected
|
|
34
48
|
*/
|
|
35
|
-
protected readonly contractSaltPubKey?:
|
|
49
|
+
protected readonly contractSaltPubKey?: Uint8Array | undefined;
|
|
36
50
|
|
|
37
51
|
/**
|
|
38
52
|
* The network to use
|
|
@@ -41,8 +55,8 @@ export abstract class Generator {
|
|
|
41
55
|
protected readonly network: Network = networks.bitcoin;
|
|
42
56
|
|
|
43
57
|
protected constructor(
|
|
44
|
-
senderPubKey:
|
|
45
|
-
contractSaltPubKey?:
|
|
58
|
+
senderPubKey: PublicKey | XOnlyPublicKey,
|
|
59
|
+
contractSaltPubKey?: Uint8Array,
|
|
46
60
|
network: Network = networks.bitcoin,
|
|
47
61
|
) {
|
|
48
62
|
this.senderPubKey = senderPubKey;
|
|
@@ -51,52 +65,54 @@ export abstract class Generator {
|
|
|
51
65
|
this.xSenderPubKey = toXOnly(senderPubKey);
|
|
52
66
|
}
|
|
53
67
|
|
|
54
|
-
public buildHeader(features: Features[]):
|
|
68
|
+
public buildHeader(features: Features[]): Uint8Array {
|
|
55
69
|
let flags: number = 0;
|
|
56
70
|
|
|
57
71
|
for (const feature of features) {
|
|
58
72
|
flags |= feature;
|
|
59
73
|
}
|
|
60
74
|
|
|
61
|
-
const bytesU24 =
|
|
62
|
-
bytesU24
|
|
75
|
+
const bytesU24 = alloc(3);
|
|
76
|
+
bytesU24[0] = (flags >> 16) & 0xff;
|
|
77
|
+
bytesU24[1] = (flags >> 8) & 0xff;
|
|
78
|
+
bytesU24[2] = flags & 0xff;
|
|
63
79
|
|
|
64
|
-
return
|
|
80
|
+
return Uint8Array.from([this.senderPubKey[0], ...bytesU24]);
|
|
65
81
|
}
|
|
66
82
|
|
|
67
|
-
public getHeader(maxPriority: bigint, features: Features[] = []):
|
|
83
|
+
public getHeader(maxPriority: bigint, features: Features[] = []): Uint8Array {
|
|
68
84
|
const writer = new BinaryWriter(12);
|
|
69
85
|
writer.writeBytes(this.buildHeader(features));
|
|
70
86
|
writer.writeU64(maxPriority);
|
|
71
87
|
|
|
72
|
-
return
|
|
88
|
+
return new Uint8Array(writer.getBuffer());
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
/**
|
|
76
92
|
* Compile the script
|
|
77
93
|
* @param args - The arguments to use when compiling the script
|
|
78
|
-
* @returns {
|
|
94
|
+
* @returns {Uint8Array} - The compiled script
|
|
79
95
|
*/
|
|
80
|
-
public abstract compile(...args: unknown[]):
|
|
96
|
+
public abstract compile(...args: unknown[]): Uint8Array;
|
|
81
97
|
|
|
82
98
|
/**
|
|
83
99
|
* Split a buffer into chunks
|
|
84
|
-
* @param {
|
|
100
|
+
* @param {Uint8Array} buffer - The buffer to split
|
|
85
101
|
* @param {number} chunkSize - The size of each chunk
|
|
86
102
|
* @protected
|
|
87
|
-
* @returns {Array<
|
|
103
|
+
* @returns {Array<Uint8Array[]>} - The chunks
|
|
88
104
|
*/
|
|
89
105
|
protected splitBufferIntoChunks(
|
|
90
|
-
buffer:
|
|
106
|
+
buffer: Uint8Array,
|
|
91
107
|
chunkSize: number = Generator.DATA_CHUNK_SIZE,
|
|
92
|
-
): Array<
|
|
93
|
-
const chunks: Array<
|
|
108
|
+
): Array<Uint8Array[]> {
|
|
109
|
+
const chunks: Array<Uint8Array[]> = [];
|
|
94
110
|
for (let i = 0; i < buffer.length; i += chunkSize) {
|
|
95
111
|
const dataLength = Math.min(chunkSize, buffer.length - i);
|
|
96
112
|
|
|
97
|
-
const buf2 =
|
|
113
|
+
const buf2 = alloc(dataLength);
|
|
98
114
|
for (let j = 0; j < dataLength; j++) {
|
|
99
|
-
buf2
|
|
115
|
+
buf2[j] = buffer[i + j] as number;
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
chunks.push([buf2]);
|
|
@@ -131,13 +147,13 @@ export abstract class Generator {
|
|
|
131
147
|
|
|
132
148
|
for (const contract in feature.data) {
|
|
133
149
|
const parsedContract = Address.fromString(contract);
|
|
134
|
-
const data = feature.data[contract];
|
|
150
|
+
const data = feature.data[contract] as string[];
|
|
135
151
|
|
|
136
152
|
writer.writeAddress(parsedContract);
|
|
137
153
|
writer.writeU32(data.length);
|
|
138
154
|
|
|
139
155
|
for (const pointer of data) {
|
|
140
|
-
const pointerBuffer =
|
|
156
|
+
const pointerBuffer = Uint8Array.from(atob(pointer), (c) => c.charCodeAt(0));
|
|
141
157
|
|
|
142
158
|
if (pointerBuffer.length !== 32) {
|
|
143
159
|
throw new Error(`Invalid pointer length: ${pointerBuffer.length}`);
|
|
@@ -147,7 +163,7 @@ export abstract class Generator {
|
|
|
147
163
|
}
|
|
148
164
|
}
|
|
149
165
|
|
|
150
|
-
finalBuffer.writeBytesWithLength(Compressor.compress(
|
|
166
|
+
finalBuffer.writeBytesWithLength(Compressor.compress(new Uint8Array(writer.getBuffer())));
|
|
151
167
|
}
|
|
152
168
|
|
|
153
169
|
private encodeChallengeSubmission(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { crypto, Network, networks, opcodes, script } from '@btc-vision/bitcoin';
|
|
2
|
-
import {
|
|
1
|
+
import { concat, crypto, type Network, networks, opcodes, type PublicKey, script } from '@btc-vision/bitcoin';
|
|
2
|
+
import { type UniversalSigner } from '@btc-vision/ecpair';
|
|
3
3
|
import { Compressor } from '../../bytecode/Compressor.js';
|
|
4
4
|
import { EcKeyPair } from '../../keypair/EcKeyPair.js';
|
|
5
|
-
import { Feature, Features } from '../Features.js';
|
|
5
|
+
import { type Feature, Features } from '../Features.js';
|
|
6
6
|
import { Generator } from '../Generator.js';
|
|
7
|
-
import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
|
|
7
|
+
import type { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
|
|
8
8
|
import { BinaryWriter } from '../../buffer/BinaryWriter.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,8 +12,8 @@ import { BinaryWriter } from '../../buffer/BinaryWriter.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export class CalldataGenerator extends Generator {
|
|
14
14
|
constructor(
|
|
15
|
-
senderPubKey:
|
|
16
|
-
contractSaltPubKey:
|
|
15
|
+
senderPubKey: PublicKey,
|
|
16
|
+
contractSaltPubKey: Uint8Array,
|
|
17
17
|
network: Network = networks.bitcoin,
|
|
18
18
|
) {
|
|
19
19
|
super(senderPubKey, contractSaltPubKey, network);
|
|
@@ -21,16 +21,16 @@ export class CalldataGenerator extends Generator {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Get the public key as a buffer
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {Uint8Array[]} witnessKeys - The public keys
|
|
25
25
|
* @param {Network} network - The network to use
|
|
26
26
|
* @private
|
|
27
|
-
* @returns {
|
|
27
|
+
* @returns {Uint8Array} - The public key as a buffer
|
|
28
28
|
*/
|
|
29
|
-
public static getPubKeyAsBuffer(witnessKeys:
|
|
30
|
-
let finalBuffer:
|
|
29
|
+
public static getPubKeyAsBuffer(witnessKeys: Uint8Array[], network: Network): Uint8Array {
|
|
30
|
+
let finalBuffer: Uint8Array = new Uint8Array(0);
|
|
31
31
|
|
|
32
32
|
for (const pubKey of witnessKeys) {
|
|
33
|
-
const key:
|
|
33
|
+
const key: UniversalSigner = EcKeyPair.fromPublicKey(pubKey, network);
|
|
34
34
|
|
|
35
35
|
if (!key.compressed) {
|
|
36
36
|
throw new Error('Public key must be compressed');
|
|
@@ -40,11 +40,11 @@ export class CalldataGenerator extends Generator {
|
|
|
40
40
|
throw new Error(`Public key must be 33 bytes, got ${pubKey.byteLength} bytes.`);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
finalBuffer =
|
|
43
|
+
finalBuffer = concat([finalBuffer, pubKey]);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// compress the public keys
|
|
47
|
-
const compressed:
|
|
47
|
+
const compressed: Uint8Array = Compressor.compress(finalBuffer);
|
|
48
48
|
if (compressed.byteLength >= finalBuffer.byteLength) {
|
|
49
49
|
// we ensure that the user pays the smallest amount of fees. [micro-optimization]
|
|
50
50
|
return finalBuffer;
|
|
@@ -56,28 +56,28 @@ export class CalldataGenerator extends Generator {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Compile an interaction bitcoin script
|
|
59
|
-
* @param {
|
|
60
|
-
* @param {
|
|
59
|
+
* @param {Uint8Array} calldata - The calldata to use
|
|
60
|
+
* @param {Uint8Array} contractSecret - The contract secret
|
|
61
61
|
* @param {IChallengeSolution} challenge
|
|
62
62
|
* @param maxPriority - Amount of satoshis to spend max on priority fee
|
|
63
63
|
* @param {Feature<Features>[]} featuresRaw - The features to use
|
|
64
|
-
* @returns {
|
|
64
|
+
* @returns {Uint8Array} - The compiled script
|
|
65
65
|
* @throws {Error} - If something goes wrong
|
|
66
66
|
*/
|
|
67
67
|
public compile(
|
|
68
|
-
calldata:
|
|
69
|
-
contractSecret:
|
|
68
|
+
calldata: Uint8Array,
|
|
69
|
+
contractSecret: Uint8Array,
|
|
70
70
|
challenge: IChallengeSolution,
|
|
71
71
|
maxPriority: bigint,
|
|
72
72
|
featuresRaw: Feature<Features>[] = [],
|
|
73
|
-
):
|
|
73
|
+
): Uint8Array {
|
|
74
74
|
if (!this.contractSaltPubKey) throw new Error('Contract salt public key not set');
|
|
75
75
|
|
|
76
|
-
const dataChunks:
|
|
76
|
+
const dataChunks: Uint8Array[][] = this.splitBufferIntoChunks(calldata);
|
|
77
77
|
if (!dataChunks.length) throw new Error('No data chunks found');
|
|
78
78
|
|
|
79
79
|
const featuresList: Features[] = [];
|
|
80
|
-
const featureData: (number |
|
|
80
|
+
const featureData: (number | Uint8Array | Uint8Array[])[] = [];
|
|
81
81
|
|
|
82
82
|
if (featuresRaw && featuresRaw.length) {
|
|
83
83
|
const features: Feature<Features>[] = featuresRaw.sort(
|
|
@@ -86,16 +86,18 @@ export class CalldataGenerator extends Generator {
|
|
|
86
86
|
|
|
87
87
|
const finalBuffer = new BinaryWriter();
|
|
88
88
|
for (let i = 0; i < features.length; i++) {
|
|
89
|
-
const feature = features[i]
|
|
89
|
+
const feature = features[i] as Feature<Features>;
|
|
90
90
|
featuresList.push(feature.opcode);
|
|
91
91
|
|
|
92
92
|
this.encodeFeature(feature, finalBuffer);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
featureData.push(
|
|
95
|
+
featureData.push(
|
|
96
|
+
...this.splitBufferIntoChunks(new Uint8Array(finalBuffer.getBuffer())),
|
|
97
|
+
);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
let compiledData: (number |
|
|
100
|
+
let compiledData: (number | Uint8Array | Uint8Array[])[] = [
|
|
99
101
|
this.getHeader(maxPriority, featuresList),
|
|
100
102
|
opcodes.OP_TOALTSTACK,
|
|
101
103
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Network, networks, script, Stack } from '@btc-vision/bitcoin';
|
|
1
|
+
import { type Network, networks, script, type Stack, type XOnlyPublicKey } from '@btc-vision/bitcoin';
|
|
2
2
|
import { Generator } from '../Generator.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Class to generate bitcoin script for interaction transactions
|
|
6
6
|
*/
|
|
7
7
|
export class CustomGenerator extends Generator {
|
|
8
|
-
constructor(senderPubKey:
|
|
8
|
+
constructor(senderPubKey: XOnlyPublicKey, network: Network = networks.bitcoin) {
|
|
9
9
|
super(senderPubKey, undefined, network);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Compile an interaction bitcoin script
|
|
14
14
|
* @param compiledData - The compiled data
|
|
15
|
-
* @returns {
|
|
15
|
+
* @returns {Uint8Array} - The compiled script
|
|
16
16
|
* @throws {Error} - If something goes wrong
|
|
17
17
|
*/
|
|
18
|
-
public compile(compiledData: (
|
|
18
|
+
public compile(compiledData: (Uint8Array | Stack)[]): Uint8Array {
|
|
19
19
|
const asm = compiledData.flat();
|
|
20
20
|
const compiled = script.compile(asm);
|
|
21
21
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { crypto, Network, networks, opcodes, script } from '@btc-vision/bitcoin';
|
|
1
|
+
import { crypto, type Network, networks, opcodes, type PublicKey, script } from '@btc-vision/bitcoin';
|
|
2
2
|
import { Generator } from '../Generator.js';
|
|
3
|
-
import { Feature, Features } from '../Features.js';
|
|
4
|
-
import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
|
|
3
|
+
import { type Feature, Features } from '../Features.js';
|
|
4
|
+
import type { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
|
|
5
5
|
import { BinaryWriter } from '../../buffer/BinaryWriter.js';
|
|
6
6
|
|
|
7
7
|
export const OPNET_DEPLOYMENT_VERSION = 0x00;
|
|
8
|
-
export const versionBuffer =
|
|
8
|
+
export const versionBuffer = Uint8Array.from([OPNET_DEPLOYMENT_VERSION]);
|
|
9
9
|
|
|
10
10
|
export class DeploymentGenerator extends Generator {
|
|
11
11
|
constructor(
|
|
12
|
-
senderPubKey:
|
|
13
|
-
contractSaltPubKey:
|
|
12
|
+
senderPubKey: PublicKey,
|
|
13
|
+
contractSaltPubKey: Uint8Array,
|
|
14
14
|
network: Network = networks.bitcoin,
|
|
15
15
|
) {
|
|
16
16
|
super(senderPubKey, contractSaltPubKey, network);
|
|
@@ -18,22 +18,22 @@ export class DeploymentGenerator extends Generator {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Compile a bitcoin script representing a contract deployment
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
21
|
+
* @param {Uint8Array} contractBytecode - The contract bytecode
|
|
22
|
+
* @param {Uint8Array} contractSalt - The contract salt
|
|
23
23
|
* @param {ChallengeSolution} challenge - The challenge for reward
|
|
24
24
|
* @param {bigint} maxPriority - The maximum priority for the contract
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {Uint8Array} [calldata] - The calldata to be passed to the contract
|
|
26
26
|
* @param {Feature<Features>[]} [features] - Optional features to include in the script
|
|
27
|
-
* @returns {
|
|
27
|
+
* @returns {Uint8Array} - The compiled script
|
|
28
28
|
*/
|
|
29
29
|
public compile(
|
|
30
|
-
contractBytecode:
|
|
31
|
-
contractSalt:
|
|
30
|
+
contractBytecode: Uint8Array,
|
|
31
|
+
contractSalt: Uint8Array,
|
|
32
32
|
challenge: IChallengeSolution,
|
|
33
33
|
maxPriority: bigint,
|
|
34
|
-
calldata?:
|
|
34
|
+
calldata?: Uint8Array,
|
|
35
35
|
features?: Feature<Features>[],
|
|
36
|
-
):
|
|
36
|
+
): Uint8Array {
|
|
37
37
|
const asm = this.getAsm(
|
|
38
38
|
contractBytecode,
|
|
39
39
|
contractSalt,
|
|
@@ -57,20 +57,20 @@ export class DeploymentGenerator extends Generator {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
private getAsm(
|
|
60
|
-
contractBytecode:
|
|
61
|
-
contractSalt:
|
|
60
|
+
contractBytecode: Uint8Array,
|
|
61
|
+
contractSalt: Uint8Array,
|
|
62
62
|
challenge: IChallengeSolution,
|
|
63
63
|
maxPriority: bigint,
|
|
64
|
-
calldata?:
|
|
64
|
+
calldata?: Uint8Array,
|
|
65
65
|
featuresRaw?: Feature<Features>[],
|
|
66
|
-
): (number |
|
|
66
|
+
): (number | Uint8Array)[] {
|
|
67
67
|
if (!this.contractSaltPubKey) throw new Error('Contract salt public key not set');
|
|
68
68
|
|
|
69
|
-
const dataChunks:
|
|
70
|
-
const calldataChunks:
|
|
69
|
+
const dataChunks: Uint8Array[][] = this.splitBufferIntoChunks(contractBytecode);
|
|
70
|
+
const calldataChunks: Uint8Array[][] = calldata ? this.splitBufferIntoChunks(calldata) : [];
|
|
71
71
|
|
|
72
72
|
const featuresList: Features[] = [];
|
|
73
|
-
const featureData: (number |
|
|
73
|
+
const featureData: (number | Uint8Array | Uint8Array[])[] = [];
|
|
74
74
|
|
|
75
75
|
if (featuresRaw && featuresRaw.length) {
|
|
76
76
|
const features: Feature<Features>[] = featuresRaw.sort(
|
|
@@ -79,13 +79,15 @@ export class DeploymentGenerator extends Generator {
|
|
|
79
79
|
|
|
80
80
|
const finalBuffer = new BinaryWriter();
|
|
81
81
|
for (let i = 0; i < features.length; i++) {
|
|
82
|
-
const feature = features[i]
|
|
82
|
+
const feature = features[i] as Feature<Features>;
|
|
83
83
|
featuresList.push(feature.opcode);
|
|
84
84
|
|
|
85
85
|
this.encodeFeature(feature, finalBuffer);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
featureData.push(
|
|
88
|
+
featureData.push(
|
|
89
|
+
...this.splitBufferIntoChunks(new Uint8Array(finalBuffer.getBuffer())),
|
|
90
|
+
);
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
const compiledData = [
|