@btc-vision/transaction 1.8.0-beta.3 → 1.8.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (764) hide show
  1. package/browser/_version.d.ts +1 -0
  2. package/browser/_version.d.ts.map +1 -0
  3. package/browser/abi/ABICoder.d.ts +1 -1
  4. package/browser/abi/ABICoder.d.ts.map +1 -0
  5. package/browser/branded/Branded.d.ts +4 -0
  6. package/browser/branded/Branded.d.ts.map +1 -0
  7. package/browser/btc-vision-bitcoin.js +11999 -2647
  8. package/browser/buffer/BinaryReader.d.ts +120 -1
  9. package/browser/buffer/BinaryReader.d.ts.map +1 -0
  10. package/browser/buffer/BinaryWriter.d.ts +51 -1
  11. package/browser/buffer/BinaryWriter.d.ts.map +1 -0
  12. package/browser/bytecode/Compressor.d.ts +12 -0
  13. package/browser/bytecode/Compressor.d.ts.map +1 -0
  14. package/browser/chain/ChainData.d.ts +2 -2
  15. package/browser/chain/ChainData.d.ts.map +1 -0
  16. package/browser/consensus/Consensus.d.ts +11 -3
  17. package/browser/consensus/Consensus.d.ts.map +1 -0
  18. package/browser/consensus/ConsensusConfig.d.ts +1 -0
  19. package/browser/consensus/ConsensusConfig.d.ts.map +1 -0
  20. package/browser/consensus/IConsensusConfig.d.ts +1 -0
  21. package/browser/consensus/IConsensusConfig.d.ts.map +1 -0
  22. package/browser/consensus/metadata/RoswellConsensus.d.ts +1 -0
  23. package/browser/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
  24. package/browser/crypto/crypto.d.ts +1 -0
  25. package/browser/crypto/crypto.d.ts.map +1 -0
  26. package/browser/deterministic/AddressMap.d.ts +6 -1
  27. package/browser/deterministic/AddressMap.d.ts.map +1 -0
  28. package/browser/deterministic/AddressSet.d.ts +3 -1
  29. package/browser/deterministic/AddressSet.d.ts.map +1 -0
  30. package/browser/deterministic/CustomMap.d.ts +3 -1
  31. package/browser/deterministic/CustomMap.d.ts.map +1 -0
  32. package/browser/deterministic/DeterministicMap.d.ts +3 -1
  33. package/browser/deterministic/DeterministicMap.d.ts.map +1 -0
  34. package/browser/deterministic/DeterministicSet.d.ts +3 -1
  35. package/browser/deterministic/DeterministicSet.d.ts.map +1 -0
  36. package/browser/deterministic/ExtendedAddressMap.d.ts +7 -1
  37. package/browser/deterministic/ExtendedAddressMap.d.ts.map +1 -0
  38. package/browser/deterministic/FastMap.d.ts +7 -1
  39. package/browser/deterministic/FastMap.d.ts.map +1 -0
  40. package/browser/ecc/backend.d.ts +13 -0
  41. package/browser/ecc/backend.d.ts.map +1 -0
  42. package/browser/epoch/ChallengeSolution.d.ts +33 -1
  43. package/browser/epoch/ChallengeSolution.d.ts.map +1 -0
  44. package/browser/epoch/interfaces/IChallengeSolution.d.ts +14 -13
  45. package/browser/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
  46. package/browser/epoch/validator/EpochValidator.d.ts +37 -7
  47. package/browser/epoch/validator/EpochValidator.d.ts.map +1 -0
  48. package/browser/event/NetEvent.d.ts +1 -0
  49. package/browser/event/NetEvent.d.ts.map +1 -0
  50. package/browser/generators/AddressGenerator.d.ts +4 -3
  51. package/browser/generators/AddressGenerator.d.ts.map +1 -0
  52. package/browser/generators/Features.d.ts +1 -0
  53. package/browser/generators/Features.d.ts.map +1 -0
  54. package/browser/generators/Generator.d.ts +46 -10
  55. package/browser/generators/Generator.d.ts.map +1 -0
  56. package/browser/generators/MLDSAData.d.ts +1 -0
  57. package/browser/generators/MLDSAData.d.ts.map +1 -0
  58. package/browser/generators/builders/CalldataGenerator.d.ts +25 -4
  59. package/browser/generators/builders/CalldataGenerator.d.ts.map +1 -0
  60. package/browser/generators/builders/CustomGenerator.d.ts +13 -3
  61. package/browser/generators/builders/CustomGenerator.d.ts.map +1 -0
  62. package/browser/generators/builders/DeploymentGenerator.d.ts +15 -4
  63. package/browser/generators/builders/DeploymentGenerator.d.ts.map +1 -0
  64. package/browser/generators/builders/HashCommitmentGenerator.d.ts +164 -12
  65. package/browser/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
  66. package/browser/generators/builders/LegacyCalldataGenerator.d.ts +26 -4
  67. package/browser/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
  68. package/browser/generators/builders/MultiSignGenerator.d.ts +6 -1
  69. package/browser/generators/builders/MultiSignGenerator.d.ts.map +1 -0
  70. package/browser/generators/builders/P2WDAGenerator.d.ts +42 -4
  71. package/browser/generators/builders/P2WDAGenerator.d.ts.map +1 -0
  72. package/browser/index.d.ts +1 -0
  73. package/browser/index.d.ts.map +1 -0
  74. package/browser/index.js +3583 -3184
  75. package/browser/keypair/Address.d.ts +283 -13
  76. package/browser/keypair/Address.d.ts.map +1 -0
  77. package/browser/keypair/AddressVerificator.d.ts +7 -6
  78. package/browser/keypair/AddressVerificator.d.ts.map +1 -0
  79. package/browser/keypair/EcKeyPair.d.ts +183 -21
  80. package/browser/keypair/EcKeyPair.d.ts.map +1 -0
  81. package/browser/keypair/MessageSigner.d.ts +17 -16
  82. package/browser/keypair/MessageSigner.d.ts.map +1 -0
  83. package/browser/keypair/Secp256k1PointDeriver.d.ts +55 -0
  84. package/browser/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
  85. package/browser/keypair/Wallet.d.ts +27 -13
  86. package/browser/keypair/Wallet.d.ts.map +1 -0
  87. package/browser/keypair/interfaces/IWallet.d.ts +19 -0
  88. package/browser/keypair/interfaces/IWallet.d.ts.map +1 -0
  89. package/browser/metadata/ContractBaseMetadata.d.ts +10 -2
  90. package/browser/metadata/ContractBaseMetadata.d.ts.map +1 -0
  91. package/browser/mnemonic/BIPStandard.d.ts +59 -0
  92. package/browser/mnemonic/BIPStandard.d.ts.map +1 -0
  93. package/browser/mnemonic/Mnemonic.d.ts +15 -3
  94. package/browser/mnemonic/Mnemonic.d.ts.map +1 -0
  95. package/browser/mnemonic/MnemonicStrength.d.ts +6 -0
  96. package/browser/mnemonic/MnemonicStrength.d.ts.map +1 -0
  97. package/browser/network/ChainId.d.ts +1 -0
  98. package/browser/network/ChainId.d.ts.map +1 -0
  99. package/browser/noble-curves.js +844 -2746
  100. package/browser/noble-hashes.js +1338 -2067
  101. package/browser/opnet.d.ts +22 -1
  102. package/browser/opnet.d.ts.map +1 -0
  103. package/browser/p2wda/P2WDADetector.d.ts +36 -9
  104. package/browser/p2wda/P2WDADetector.d.ts.map +1 -0
  105. package/browser/polyfill/disposable.d.ts +16 -0
  106. package/browser/polyfill/disposable.d.ts.map +1 -0
  107. package/browser/signer/AddressRotation.d.ts +36 -0
  108. package/browser/signer/AddressRotation.d.ts.map +1 -0
  109. package/browser/signer/IRotationSigner.d.ts +27 -3
  110. package/browser/signer/IRotationSigner.d.ts.map +1 -0
  111. package/browser/signer/ParallelSignerAdapter.d.ts +14 -0
  112. package/browser/signer/ParallelSignerAdapter.d.ts.map +1 -0
  113. package/browser/signer/SignerUtils.d.ts +11 -4
  114. package/browser/signer/SignerUtils.d.ts.map +1 -0
  115. package/browser/signer/TweakedSigner.d.ts +28 -4
  116. package/browser/signer/TweakedSigner.d.ts.map +1 -0
  117. package/browser/transaction/ContractAddress.d.ts +2 -2
  118. package/browser/transaction/ContractAddress.d.ts.map +1 -0
  119. package/browser/transaction/TransactionFactory.d.ts +140 -2
  120. package/browser/transaction/TransactionFactory.d.ts.map +1 -0
  121. package/browser/transaction/browser/BrowserSignerBase.d.ts +12 -6
  122. package/browser/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
  123. package/browser/transaction/browser/WalletNetworks.d.ts +1 -0
  124. package/browser/transaction/browser/WalletNetworks.d.ts.map +1 -0
  125. package/browser/transaction/browser/Web3Provider.d.ts +27 -0
  126. package/browser/transaction/browser/Web3Provider.d.ts.map +1 -0
  127. package/browser/transaction/browser/extensions/UnisatSigner.d.ts +9 -7
  128. package/browser/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
  129. package/browser/transaction/browser/extensions/XverseSigner.d.ts +9 -7
  130. package/browser/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
  131. package/browser/transaction/browser/types/OPWallet.d.ts +10 -0
  132. package/browser/transaction/browser/types/OPWallet.d.ts.map +1 -0
  133. package/browser/transaction/browser/types/Unisat.d.ts +1 -0
  134. package/browser/transaction/browser/types/Unisat.d.ts.map +1 -0
  135. package/browser/transaction/browser/types/Xverse.d.ts +1 -0
  136. package/browser/transaction/browser/types/Xverse.d.ts.map +1 -0
  137. package/browser/transaction/builders/CancelTransaction.d.ts +29 -4
  138. package/browser/transaction/builders/CancelTransaction.d.ts.map +1 -0
  139. package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
  140. package/browser/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
  141. package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +137 -10
  142. package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
  143. package/browser/transaction/builders/CustomScriptTransaction.d.ts +106 -6
  144. package/browser/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
  145. package/browser/transaction/builders/DeploymentTransaction.d.ts +116 -5
  146. package/browser/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
  147. package/browser/transaction/builders/FundingTransaction.d.ts +4 -3
  148. package/browser/transaction/builders/FundingTransaction.d.ts.map +1 -0
  149. package/browser/transaction/builders/InteractionTransaction.d.ts +12 -3
  150. package/browser/transaction/builders/InteractionTransaction.d.ts.map +1 -0
  151. package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +56 -5
  152. package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
  153. package/browser/transaction/builders/MultiSignTransaction.d.ts +125 -16
  154. package/browser/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
  155. package/browser/transaction/builders/SharedInteractionTransaction.d.ts +103 -15
  156. package/browser/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
  157. package/browser/transaction/builders/TransactionBuilder.d.ts +243 -14
  158. package/browser/transaction/builders/TransactionBuilder.d.ts.map +1 -0
  159. package/browser/transaction/enums/TransactionType.d.ts +1 -0
  160. package/browser/transaction/enums/TransactionType.d.ts.map +1 -0
  161. package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts +2 -1
  162. package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
  163. package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +46 -3
  164. package/browser/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
  165. package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts +6 -4
  166. package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
  167. package/browser/transaction/interfaces/ITransactionParameters.d.ts +22 -10
  168. package/browser/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
  169. package/browser/transaction/interfaces/ITransactionResponses.d.ts +1 -0
  170. package/browser/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
  171. package/browser/transaction/interfaces/ITweakedTransactionData.d.ts +18 -5
  172. package/browser/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
  173. package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts +26 -0
  174. package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
  175. package/browser/transaction/interfaces/Tap.d.ts +4 -3
  176. package/browser/transaction/interfaces/Tap.d.ts.map +1 -0
  177. package/browser/transaction/mineable/IP2WSHAddress.d.ts +2 -1
  178. package/browser/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
  179. package/browser/transaction/mineable/TimelockGenerator.d.ts +12 -3
  180. package/browser/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
  181. package/browser/transaction/offline/OfflineTransactionManager.d.ts +190 -9
  182. package/browser/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
  183. package/browser/transaction/offline/TransactionReconstructor.d.ts +53 -3
  184. package/browser/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
  185. package/browser/transaction/offline/TransactionSerializer.d.ts +53 -2
  186. package/browser/transaction/offline/TransactionSerializer.d.ts.map +1 -0
  187. package/browser/transaction/offline/TransactionStateCapture.d.ts +64 -5
  188. package/browser/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
  189. package/browser/transaction/offline/interfaces/ISerializableState.d.ts +71 -0
  190. package/browser/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
  191. package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts +76 -0
  192. package/browser/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
  193. package/browser/transaction/psbt/PSBTTypes.d.ts +1 -0
  194. package/browser/transaction/psbt/PSBTTypes.d.ts.map +1 -0
  195. package/browser/transaction/shared/P2TR_MS.d.ts +11 -2
  196. package/browser/transaction/shared/P2TR_MS.d.ts.map +1 -0
  197. package/browser/transaction/shared/TweakedTransaction.d.ts +275 -33
  198. package/browser/transaction/shared/TweakedTransaction.d.ts.map +1 -0
  199. package/browser/transaction/utils/WitnessUtils.d.ts +7 -1
  200. package/browser/transaction/utils/WitnessUtils.d.ts.map +1 -0
  201. package/browser/utils/BitcoinUtils.d.ts +19 -0
  202. package/browser/utils/BitcoinUtils.d.ts.map +1 -0
  203. package/browser/utils/BufferHelper.d.ts +1 -0
  204. package/browser/utils/BufferHelper.d.ts.map +1 -0
  205. package/browser/utils/StringToBuffer.d.ts +1 -0
  206. package/browser/utils/StringToBuffer.d.ts.map +1 -0
  207. package/browser/utils/lengths.d.ts +1 -0
  208. package/browser/utils/lengths.d.ts.map +1 -0
  209. package/browser/utils/types.d.ts +1 -0
  210. package/browser/utils/types.d.ts.map +1 -0
  211. package/browser/utxo/OPNetLimitedProvider.d.ts +37 -1
  212. package/browser/utxo/OPNetLimitedProvider.d.ts.map +1 -0
  213. package/browser/utxo/interfaces/BroadcastResponse.d.ts +1 -0
  214. package/browser/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
  215. package/browser/utxo/interfaces/IUTXO.d.ts +11 -5
  216. package/browser/utxo/interfaces/IUTXO.d.ts.map +1 -0
  217. package/browser/vendors.js +14351 -10031
  218. package/browser/verification/TapscriptVerificator.d.ts +10 -8
  219. package/browser/verification/TapscriptVerificator.d.ts.map +1 -0
  220. package/build/_version.d.ts +1 -0
  221. package/build/_version.d.ts.map +1 -0
  222. package/build/_version.js +1 -0
  223. package/build/_version.js.map +1 -0
  224. package/build/abi/ABICoder.d.ts +1 -1
  225. package/build/abi/ABICoder.d.ts.map +1 -0
  226. package/build/abi/ABICoder.js +9 -10
  227. package/build/abi/ABICoder.js.map +1 -0
  228. package/build/branded/Branded.d.ts +4 -0
  229. package/build/branded/Branded.d.ts.map +1 -0
  230. package/build/branded/Branded.js +2 -0
  231. package/build/branded/Branded.js.map +1 -0
  232. package/build/buffer/BinaryReader.d.ts +121 -2
  233. package/build/buffer/BinaryReader.d.ts.map +1 -0
  234. package/build/buffer/BinaryReader.js +129 -5
  235. package/build/buffer/BinaryReader.js.map +1 -0
  236. package/build/buffer/BinaryWriter.d.ts +52 -2
  237. package/build/buffer/BinaryWriter.d.ts.map +1 -0
  238. package/build/buffer/BinaryWriter.js +62 -2
  239. package/build/buffer/BinaryWriter.js.map +1 -0
  240. package/build/bytecode/Compressor.d.ts +12 -0
  241. package/build/bytecode/Compressor.d.ts.map +1 -0
  242. package/build/bytecode/Compressor.js +17 -5
  243. package/build/bytecode/Compressor.js.map +1 -0
  244. package/build/chain/ChainData.d.ts +2 -2
  245. package/build/chain/ChainData.d.ts.map +1 -0
  246. package/build/chain/ChainData.js +35 -17
  247. package/build/chain/ChainData.js.map +1 -0
  248. package/build/consensus/Consensus.d.ts +11 -3
  249. package/build/consensus/Consensus.d.ts.map +1 -0
  250. package/build/consensus/Consensus.js +8 -0
  251. package/build/consensus/Consensus.js.map +1 -0
  252. package/build/consensus/ConsensusConfig.d.ts +2 -1
  253. package/build/consensus/ConsensusConfig.d.ts.map +1 -0
  254. package/build/consensus/ConsensusConfig.js +1 -0
  255. package/build/consensus/ConsensusConfig.js.map +1 -0
  256. package/build/consensus/IConsensusConfig.d.ts +1 -0
  257. package/build/consensus/IConsensusConfig.d.ts.map +1 -0
  258. package/build/consensus/IConsensusConfig.js +2 -1
  259. package/build/consensus/IConsensusConfig.js.map +1 -0
  260. package/build/consensus/metadata/RoswellConsensus.d.ts +2 -1
  261. package/build/consensus/metadata/RoswellConsensus.d.ts.map +1 -0
  262. package/build/consensus/metadata/RoswellConsensus.js +2 -0
  263. package/build/consensus/metadata/RoswellConsensus.js.map +1 -0
  264. package/build/crypto/crypto.d.ts +1 -0
  265. package/build/crypto/crypto.d.ts.map +1 -0
  266. package/build/crypto/crypto.js +1 -0
  267. package/build/crypto/crypto.js.map +1 -0
  268. package/build/deterministic/AddressMap.d.ts +6 -1
  269. package/build/deterministic/AddressMap.d.ts.map +1 -0
  270. package/build/deterministic/AddressMap.js +8 -0
  271. package/build/deterministic/AddressMap.js.map +1 -0
  272. package/build/deterministic/AddressSet.d.ts +3 -1
  273. package/build/deterministic/AddressSet.d.ts.map +1 -0
  274. package/build/deterministic/AddressSet.js +7 -0
  275. package/build/deterministic/AddressSet.js.map +1 -0
  276. package/build/deterministic/CustomMap.d.ts +3 -1
  277. package/build/deterministic/CustomMap.d.ts.map +1 -0
  278. package/build/deterministic/CustomMap.js +65 -47
  279. package/build/deterministic/CustomMap.js.map +1 -0
  280. package/build/deterministic/DeterministicMap.d.ts +4 -2
  281. package/build/deterministic/DeterministicMap.d.ts.map +1 -0
  282. package/build/deterministic/DeterministicMap.js +24 -27
  283. package/build/deterministic/DeterministicMap.js.map +1 -0
  284. package/build/deterministic/DeterministicSet.d.ts +3 -1
  285. package/build/deterministic/DeterministicSet.d.ts.map +1 -0
  286. package/build/deterministic/DeterministicSet.js +6 -0
  287. package/build/deterministic/DeterministicSet.js.map +1 -0
  288. package/build/deterministic/ExtendedAddressMap.d.ts +7 -1
  289. package/build/deterministic/ExtendedAddressMap.d.ts.map +1 -0
  290. package/build/deterministic/ExtendedAddressMap.js +18 -2
  291. package/build/deterministic/ExtendedAddressMap.js.map +1 -0
  292. package/build/deterministic/FastMap.d.ts +7 -1
  293. package/build/deterministic/FastMap.d.ts.map +1 -0
  294. package/build/deterministic/FastMap.js +7 -2
  295. package/build/deterministic/FastMap.js.map +1 -0
  296. package/build/ecc/backend.d.ts +13 -0
  297. package/build/ecc/backend.d.ts.map +1 -0
  298. package/build/ecc/backend.js +15 -0
  299. package/build/ecc/backend.js.map +1 -0
  300. package/build/epoch/ChallengeSolution.d.ts +34 -2
  301. package/build/epoch/ChallengeSolution.d.ts.map +1 -0
  302. package/build/epoch/ChallengeSolution.js +52 -0
  303. package/build/epoch/ChallengeSolution.js.map +1 -0
  304. package/build/epoch/interfaces/IChallengeSolution.d.ts +14 -13
  305. package/build/epoch/interfaces/IChallengeSolution.d.ts.map +1 -0
  306. package/build/epoch/interfaces/IChallengeSolution.js +2 -1
  307. package/build/epoch/interfaces/IChallengeSolution.js.map +1 -0
  308. package/build/epoch/validator/EpochValidator.d.ts +38 -8
  309. package/build/epoch/validator/EpochValidator.d.ts.map +1 -0
  310. package/build/epoch/validator/EpochValidator.js +45 -19
  311. package/build/epoch/validator/EpochValidator.js.map +1 -0
  312. package/build/event/NetEvent.d.ts +1 -0
  313. package/build/event/NetEvent.d.ts.map +1 -0
  314. package/build/event/NetEvent.js +3 -0
  315. package/build/event/NetEvent.js.map +1 -0
  316. package/build/generators/AddressGenerator.d.ts +4 -3
  317. package/build/generators/AddressGenerator.d.ts.map +1 -0
  318. package/build/generators/AddressGenerator.js +10 -3
  319. package/build/generators/AddressGenerator.js.map +1 -0
  320. package/build/generators/Features.d.ts +4 -3
  321. package/build/generators/Features.d.ts.map +1 -0
  322. package/build/generators/Features.js +1 -0
  323. package/build/generators/Features.js.map +1 -0
  324. package/build/generators/Generator.d.ts +47 -11
  325. package/build/generators/Generator.d.ts.map +1 -0
  326. package/build/generators/Generator.js +48 -12
  327. package/build/generators/Generator.js.map +1 -0
  328. package/build/generators/MLDSAData.d.ts +1 -0
  329. package/build/generators/MLDSAData.d.ts.map +1 -0
  330. package/build/generators/MLDSAData.js +1 -0
  331. package/build/generators/MLDSAData.js.map +1 -0
  332. package/build/generators/builders/CalldataGenerator.d.ts +27 -6
  333. package/build/generators/builders/CalldataGenerator.d.ts.map +1 -0
  334. package/build/generators/builders/CalldataGenerator.js +33 -4
  335. package/build/generators/builders/CalldataGenerator.js.map +1 -0
  336. package/build/generators/builders/CustomGenerator.d.ts +13 -3
  337. package/build/generators/builders/CustomGenerator.d.ts.map +1 -0
  338. package/build/generators/builders/CustomGenerator.js +11 -0
  339. package/build/generators/builders/CustomGenerator.js.map +1 -0
  340. package/build/generators/builders/DeploymentGenerator.d.ts +17 -6
  341. package/build/generators/builders/DeploymentGenerator.d.ts.map +1 -0
  342. package/build/generators/builders/DeploymentGenerator.js +18 -2
  343. package/build/generators/builders/DeploymentGenerator.js.map +1 -0
  344. package/build/generators/builders/HashCommitmentGenerator.d.ts +166 -14
  345. package/build/generators/builders/HashCommitmentGenerator.d.ts.map +1 -0
  346. package/build/generators/builders/HashCommitmentGenerator.js +193 -27
  347. package/build/generators/builders/HashCommitmentGenerator.js.map +1 -0
  348. package/build/generators/builders/LegacyCalldataGenerator.d.ts +27 -5
  349. package/build/generators/builders/LegacyCalldataGenerator.d.ts.map +1 -0
  350. package/build/generators/builders/LegacyCalldataGenerator.js +35 -5
  351. package/build/generators/builders/LegacyCalldataGenerator.js.map +1 -0
  352. package/build/generators/builders/MultiSignGenerator.d.ts +6 -1
  353. package/build/generators/builders/MultiSignGenerator.d.ts.map +1 -0
  354. package/build/generators/builders/MultiSignGenerator.js +20 -10
  355. package/build/generators/builders/MultiSignGenerator.js.map +1 -0
  356. package/build/generators/builders/P2WDAGenerator.d.ts +44 -6
  357. package/build/generators/builders/P2WDAGenerator.d.ts.map +1 -0
  358. package/build/generators/builders/P2WDAGenerator.js +41 -2
  359. package/build/generators/builders/P2WDAGenerator.js.map +1 -0
  360. package/build/index.d.ts +1 -0
  361. package/build/index.d.ts.map +1 -0
  362. package/build/index.js +1 -0
  363. package/build/index.js.map +1 -0
  364. package/build/keypair/Address.d.ts +284 -14
  365. package/build/keypair/Address.d.ts.map +1 -0
  366. package/build/keypair/Address.js +446 -128
  367. package/build/keypair/Address.js.map +1 -0
  368. package/build/keypair/AddressVerificator.d.ts +7 -6
  369. package/build/keypair/AddressVerificator.d.ts.map +1 -0
  370. package/build/keypair/AddressVerificator.js +6 -5
  371. package/build/keypair/AddressVerificator.js.map +1 -0
  372. package/build/keypair/EcKeyPair.d.ts +185 -23
  373. package/build/keypair/EcKeyPair.d.ts.map +1 -0
  374. package/build/keypair/EcKeyPair.js +219 -50
  375. package/build/keypair/EcKeyPair.js.map +1 -0
  376. package/build/keypair/MessageSigner.d.ts +18 -17
  377. package/build/keypair/MessageSigner.d.ts.map +1 -0
  378. package/build/keypair/MessageSigner.js +34 -25
  379. package/build/keypair/MessageSigner.js.map +1 -0
  380. package/build/keypair/Secp256k1PointDeriver.d.ts +55 -0
  381. package/build/keypair/Secp256k1PointDeriver.d.ts.map +1 -0
  382. package/build/keypair/Secp256k1PointDeriver.js +66 -0
  383. package/build/keypair/Secp256k1PointDeriver.js.map +1 -0
  384. package/build/keypair/Wallet.d.ts +29 -15
  385. package/build/keypair/Wallet.d.ts.map +1 -0
  386. package/build/keypair/Wallet.js +48 -14
  387. package/build/keypair/Wallet.js.map +1 -0
  388. package/build/keypair/interfaces/IWallet.d.ts +19 -0
  389. package/build/keypair/interfaces/IWallet.d.ts.map +1 -0
  390. package/build/keypair/interfaces/IWallet.js +1 -0
  391. package/build/keypair/interfaces/IWallet.js.map +1 -0
  392. package/build/metadata/ContractBaseMetadata.d.ts +10 -2
  393. package/build/metadata/ContractBaseMetadata.d.ts.map +1 -0
  394. package/build/metadata/ContractBaseMetadata.js +10 -1
  395. package/build/metadata/ContractBaseMetadata.js.map +1 -0
  396. package/build/mnemonic/BIPStandard.d.ts +59 -0
  397. package/build/mnemonic/BIPStandard.d.ts.map +1 -0
  398. package/build/mnemonic/BIPStandard.js +59 -0
  399. package/build/mnemonic/BIPStandard.js.map +1 -0
  400. package/build/mnemonic/Mnemonic.d.ts +16 -4
  401. package/build/mnemonic/Mnemonic.d.ts.map +1 -0
  402. package/build/mnemonic/Mnemonic.js +36 -8
  403. package/build/mnemonic/Mnemonic.js.map +1 -0
  404. package/build/mnemonic/MnemonicStrength.d.ts +6 -0
  405. package/build/mnemonic/MnemonicStrength.d.ts.map +1 -0
  406. package/build/mnemonic/MnemonicStrength.js +6 -0
  407. package/build/mnemonic/MnemonicStrength.js.map +1 -0
  408. package/build/network/ChainId.d.ts +1 -0
  409. package/build/network/ChainId.d.ts.map +1 -0
  410. package/build/network/ChainId.js +1 -0
  411. package/build/network/ChainId.js.map +1 -0
  412. package/build/opnet.d.ts +26 -3
  413. package/build/opnet.d.ts.map +1 -0
  414. package/build/opnet.js +23 -0
  415. package/build/opnet.js.map +1 -0
  416. package/build/p2wda/P2WDADetector.d.ts +38 -11
  417. package/build/p2wda/P2WDADetector.d.ts.map +1 -0
  418. package/build/p2wda/P2WDADetector.js +43 -10
  419. package/build/p2wda/P2WDADetector.js.map +1 -0
  420. package/build/polyfill/disposable.d.ts +16 -0
  421. package/build/polyfill/disposable.d.ts.map +1 -0
  422. package/build/polyfill/disposable.js +23 -0
  423. package/build/polyfill/disposable.js.map +1 -0
  424. package/build/signer/AddressRotation.d.ts +37 -1
  425. package/build/signer/AddressRotation.d.ts.map +1 -0
  426. package/build/signer/AddressRotation.js +16 -0
  427. package/build/signer/AddressRotation.js.map +1 -0
  428. package/build/signer/IRotationSigner.d.ts +27 -3
  429. package/build/signer/IRotationSigner.d.ts.map +1 -0
  430. package/build/signer/IRotationSigner.js +2 -1
  431. package/build/signer/IRotationSigner.js.map +1 -0
  432. package/build/signer/ParallelSignerAdapter.d.ts +14 -0
  433. package/build/signer/ParallelSignerAdapter.d.ts.map +1 -0
  434. package/build/signer/ParallelSignerAdapter.js +51 -0
  435. package/build/signer/ParallelSignerAdapter.js.map +1 -0
  436. package/build/signer/SignerUtils.d.ts +11 -4
  437. package/build/signer/SignerUtils.d.ts.map +1 -0
  438. package/build/signer/SignerUtils.js +16 -0
  439. package/build/signer/SignerUtils.js.map +1 -0
  440. package/build/signer/TweakedSigner.d.ts +28 -4
  441. package/build/signer/TweakedSigner.d.ts.map +1 -0
  442. package/build/signer/TweakedSigner.js +24 -6
  443. package/build/signer/TweakedSigner.js.map +1 -0
  444. package/build/transaction/ContractAddress.d.ts +2 -2
  445. package/build/transaction/ContractAddress.d.ts.map +1 -0
  446. package/build/transaction/ContractAddress.js +4 -8
  447. package/build/transaction/ContractAddress.js.map +1 -0
  448. package/build/transaction/TransactionFactory.d.ts +147 -9
  449. package/build/transaction/TransactionFactory.d.ts.map +1 -0
  450. package/build/transaction/TransactionFactory.js +145 -26
  451. package/build/transaction/TransactionFactory.js.map +1 -0
  452. package/build/transaction/browser/BrowserSignerBase.d.ts +12 -6
  453. package/build/transaction/browser/BrowserSignerBase.d.ts.map +1 -0
  454. package/build/transaction/browser/BrowserSignerBase.js +7 -0
  455. package/build/transaction/browser/BrowserSignerBase.js.map +1 -0
  456. package/build/transaction/browser/WalletNetworks.d.ts +1 -0
  457. package/build/transaction/browser/WalletNetworks.d.ts.map +1 -0
  458. package/build/transaction/browser/WalletNetworks.js +1 -0
  459. package/build/transaction/browser/WalletNetworks.js.map +1 -0
  460. package/build/transaction/browser/Web3Provider.d.ts +30 -3
  461. package/build/transaction/browser/Web3Provider.d.ts.map +1 -0
  462. package/build/transaction/browser/Web3Provider.js +1 -0
  463. package/build/transaction/browser/Web3Provider.js.map +1 -0
  464. package/build/transaction/browser/extensions/UnisatSigner.d.ts +11 -9
  465. package/build/transaction/browser/extensions/UnisatSigner.d.ts.map +1 -0
  466. package/build/transaction/browser/extensions/UnisatSigner.js +27 -17
  467. package/build/transaction/browser/extensions/UnisatSigner.js.map +1 -0
  468. package/build/transaction/browser/extensions/XverseSigner.d.ts +10 -8
  469. package/build/transaction/browser/extensions/XverseSigner.d.ts.map +1 -0
  470. package/build/transaction/browser/extensions/XverseSigner.js +25 -15
  471. package/build/transaction/browser/extensions/XverseSigner.js.map +1 -0
  472. package/build/transaction/browser/types/OPWallet.d.ts +12 -2
  473. package/build/transaction/browser/types/OPWallet.d.ts.map +1 -0
  474. package/build/transaction/browser/types/OPWallet.js +4 -0
  475. package/build/transaction/browser/types/OPWallet.js.map +1 -0
  476. package/build/transaction/browser/types/Unisat.d.ts +2 -1
  477. package/build/transaction/browser/types/Unisat.d.ts.map +1 -0
  478. package/build/transaction/browser/types/Unisat.js +2 -0
  479. package/build/transaction/browser/types/Unisat.js.map +1 -0
  480. package/build/transaction/browser/types/Xverse.d.ts +1 -0
  481. package/build/transaction/browser/types/Xverse.d.ts.map +1 -0
  482. package/build/transaction/browser/types/Xverse.js +1 -0
  483. package/build/transaction/browser/types/Xverse.js.map +1 -0
  484. package/build/transaction/builders/CancelTransaction.d.ts +31 -6
  485. package/build/transaction/builders/CancelTransaction.d.ts.map +1 -0
  486. package/build/transaction/builders/CancelTransaction.js +116 -33
  487. package/build/transaction/builders/CancelTransaction.js.map +1 -0
  488. package/build/transaction/builders/ChallengeSolutionTransaction.d.ts +1 -0
  489. package/build/transaction/builders/ChallengeSolutionTransaction.d.ts.map +1 -0
  490. package/build/transaction/builders/ChallengeSolutionTransaction.js +88 -0
  491. package/build/transaction/builders/ChallengeSolutionTransaction.js.map +1 -0
  492. package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +140 -13
  493. package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts.map +1 -0
  494. package/build/transaction/builders/ConsolidatedInteractionTransaction.js +197 -20
  495. package/build/transaction/builders/ConsolidatedInteractionTransaction.js.map +1 -0
  496. package/build/transaction/builders/CustomScriptTransaction.d.ts +108 -8
  497. package/build/transaction/builders/CustomScriptTransaction.d.ts.map +1 -0
  498. package/build/transaction/builders/CustomScriptTransaction.js +176 -39
  499. package/build/transaction/builders/CustomScriptTransaction.js.map +1 -0
  500. package/build/transaction/builders/DeploymentTransaction.d.ts +120 -9
  501. package/build/transaction/builders/DeploymentTransaction.d.ts.map +1 -0
  502. package/build/transaction/builders/DeploymentTransaction.js +194 -51
  503. package/build/transaction/builders/DeploymentTransaction.js.map +1 -0
  504. package/build/transaction/builders/FundingTransaction.d.ts +5 -4
  505. package/build/transaction/builders/FundingTransaction.d.ts.map +1 -0
  506. package/build/transaction/builders/FundingTransaction.js +15 -8
  507. package/build/transaction/builders/FundingTransaction.js.map +1 -0
  508. package/build/transaction/builders/InteractionTransaction.d.ts +14 -5
  509. package/build/transaction/builders/InteractionTransaction.d.ts.map +1 -0
  510. package/build/transaction/builders/InteractionTransaction.js +18 -5
  511. package/build/transaction/builders/InteractionTransaction.js.map +1 -0
  512. package/build/transaction/builders/InteractionTransactionP2WDA.d.ts +58 -7
  513. package/build/transaction/builders/InteractionTransactionP2WDA.d.ts.map +1 -0
  514. package/build/transaction/builders/InteractionTransactionP2WDA.js +95 -18
  515. package/build/transaction/builders/InteractionTransactionP2WDA.js.map +1 -0
  516. package/build/transaction/builders/MultiSignTransaction.d.ts +126 -17
  517. package/build/transaction/builders/MultiSignTransaction.d.ts.map +1 -0
  518. package/build/transaction/builders/MultiSignTransaction.js +201 -76
  519. package/build/transaction/builders/MultiSignTransaction.js.map +1 -0
  520. package/build/transaction/builders/SharedInteractionTransaction.d.ts +106 -18
  521. package/build/transaction/builders/SharedInteractionTransaction.d.ts.map +1 -0
  522. package/build/transaction/builders/SharedInteractionTransaction.js +158 -40
  523. package/build/transaction/builders/SharedInteractionTransaction.js.map +1 -0
  524. package/build/transaction/builders/TransactionBuilder.d.ts +249 -19
  525. package/build/transaction/builders/TransactionBuilder.d.ts.map +1 -0
  526. package/build/transaction/builders/TransactionBuilder.js +377 -60
  527. package/build/transaction/builders/TransactionBuilder.js.map +1 -0
  528. package/build/transaction/enums/TransactionType.d.ts +1 -0
  529. package/build/transaction/enums/TransactionType.d.ts.map +1 -0
  530. package/build/transaction/enums/TransactionType.js +1 -0
  531. package/build/transaction/enums/TransactionType.js.map +1 -0
  532. package/build/transaction/interfaces/ICancelTransactionParameters.d.ts +3 -2
  533. package/build/transaction/interfaces/ICancelTransactionParameters.d.ts.map +1 -0
  534. package/build/transaction/interfaces/ICancelTransactionParameters.js +1 -0
  535. package/build/transaction/interfaces/ICancelTransactionParameters.js.map +1 -0
  536. package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts +48 -5
  537. package/build/transaction/interfaces/IConsolidatedTransactionParameters.d.ts.map +1 -0
  538. package/build/transaction/interfaces/IConsolidatedTransactionParameters.js +1 -0
  539. package/build/transaction/interfaces/IConsolidatedTransactionParameters.js.map +1 -0
  540. package/build/transaction/interfaces/ICustomTransactionParameters.d.ts +7 -5
  541. package/build/transaction/interfaces/ICustomTransactionParameters.d.ts.map +1 -0
  542. package/build/transaction/interfaces/ICustomTransactionParameters.js +1 -0
  543. package/build/transaction/interfaces/ICustomTransactionParameters.js.map +1 -0
  544. package/build/transaction/interfaces/ITransactionParameters.d.ts +27 -15
  545. package/build/transaction/interfaces/ITransactionParameters.d.ts.map +1 -0
  546. package/build/transaction/interfaces/ITransactionParameters.js +1 -0
  547. package/build/transaction/interfaces/ITransactionParameters.js.map +1 -0
  548. package/build/transaction/interfaces/ITransactionResponses.d.ts +3 -2
  549. package/build/transaction/interfaces/ITransactionResponses.d.ts.map +1 -0
  550. package/build/transaction/interfaces/ITransactionResponses.js +1 -0
  551. package/build/transaction/interfaces/ITransactionResponses.js.map +1 -0
  552. package/build/transaction/interfaces/ITweakedTransactionData.d.ts +21 -8
  553. package/build/transaction/interfaces/ITweakedTransactionData.d.ts.map +1 -0
  554. package/build/transaction/interfaces/ITweakedTransactionData.js +1 -0
  555. package/build/transaction/interfaces/ITweakedTransactionData.js.map +1 -0
  556. package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts +29 -3
  557. package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts.map +1 -0
  558. package/build/transaction/interfaces/IWeb3ProviderTypes.js +2 -1
  559. package/build/transaction/interfaces/IWeb3ProviderTypes.js.map +1 -0
  560. package/build/transaction/interfaces/Tap.d.ts +4 -3
  561. package/build/transaction/interfaces/Tap.d.ts.map +1 -0
  562. package/build/transaction/interfaces/Tap.js +1 -0
  563. package/build/transaction/interfaces/Tap.js.map +1 -0
  564. package/build/transaction/mineable/IP2WSHAddress.d.ts +2 -1
  565. package/build/transaction/mineable/IP2WSHAddress.d.ts.map +1 -0
  566. package/build/transaction/mineable/IP2WSHAddress.js +1 -0
  567. package/build/transaction/mineable/IP2WSHAddress.js.map +1 -0
  568. package/build/transaction/mineable/TimelockGenerator.d.ts +13 -4
  569. package/build/transaction/mineable/TimelockGenerator.d.ts.map +1 -0
  570. package/build/transaction/mineable/TimelockGenerator.js +12 -3
  571. package/build/transaction/mineable/TimelockGenerator.js.map +1 -0
  572. package/build/transaction/offline/OfflineTransactionManager.d.ts +193 -12
  573. package/build/transaction/offline/OfflineTransactionManager.d.ts.map +1 -0
  574. package/build/transaction/offline/OfflineTransactionManager.js +192 -8
  575. package/build/transaction/offline/OfflineTransactionManager.js.map +1 -0
  576. package/build/transaction/offline/TransactionReconstructor.d.ts +56 -6
  577. package/build/transaction/offline/TransactionReconstructor.d.ts.map +1 -0
  578. package/build/transaction/offline/TransactionReconstructor.js +111 -75
  579. package/build/transaction/offline/TransactionReconstructor.js.map +1 -0
  580. package/build/transaction/offline/TransactionSerializer.d.ts +54 -3
  581. package/build/transaction/offline/TransactionSerializer.d.ts.map +1 -0
  582. package/build/transaction/offline/TransactionSerializer.js +206 -95
  583. package/build/transaction/offline/TransactionSerializer.js.map +1 -0
  584. package/build/transaction/offline/TransactionStateCapture.d.ts +66 -7
  585. package/build/transaction/offline/TransactionStateCapture.d.ts.map +1 -0
  586. package/build/transaction/offline/TransactionStateCapture.js +124 -60
  587. package/build/transaction/offline/TransactionStateCapture.js.map +1 -0
  588. package/build/transaction/offline/interfaces/ISerializableState.d.ts +72 -1
  589. package/build/transaction/offline/interfaces/ISerializableState.d.ts.map +1 -0
  590. package/build/transaction/offline/interfaces/ISerializableState.js +10 -1
  591. package/build/transaction/offline/interfaces/ISerializableState.js.map +1 -0
  592. package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts +77 -1
  593. package/build/transaction/offline/interfaces/ITypeSpecificData.d.ts.map +1 -0
  594. package/build/transaction/offline/interfaces/ITypeSpecificData.js +19 -0
  595. package/build/transaction/offline/interfaces/ITypeSpecificData.js.map +1 -0
  596. package/build/transaction/psbt/PSBTTypes.d.ts +1 -0
  597. package/build/transaction/psbt/PSBTTypes.d.ts.map +1 -0
  598. package/build/transaction/psbt/PSBTTypes.js +1 -0
  599. package/build/transaction/psbt/PSBTTypes.js.map +1 -0
  600. package/build/transaction/shared/P2TR_MS.d.ts +11 -2
  601. package/build/transaction/shared/P2TR_MS.d.ts.map +1 -0
  602. package/build/transaction/shared/P2TR_MS.js +10 -0
  603. package/build/transaction/shared/P2TR_MS.js.map +1 -0
  604. package/build/transaction/shared/TweakedTransaction.d.ts +281 -38
  605. package/build/transaction/shared/TweakedTransaction.d.ts.map +1 -0
  606. package/build/transaction/shared/TweakedTransaction.js +576 -114
  607. package/build/transaction/shared/TweakedTransaction.js.map +1 -0
  608. package/build/transaction/utils/WitnessUtils.d.ts +7 -1
  609. package/build/transaction/utils/WitnessUtils.d.ts.map +1 -0
  610. package/build/transaction/utils/WitnessUtils.js +17 -3
  611. package/build/transaction/utils/WitnessUtils.js.map +1 -0
  612. package/build/tsconfig.build.tsbuildinfo +1 -1
  613. package/build/utils/BitcoinUtils.d.ts +19 -0
  614. package/build/utils/BitcoinUtils.d.ts.map +1 -0
  615. package/build/utils/BitcoinUtils.js +19 -0
  616. package/build/utils/BitcoinUtils.js.map +1 -0
  617. package/build/utils/BufferHelper.d.ts +2 -1
  618. package/build/utils/BufferHelper.d.ts.map +1 -0
  619. package/build/utils/BufferHelper.js +38 -32
  620. package/build/utils/BufferHelper.js.map +1 -0
  621. package/build/utils/StringToBuffer.d.ts +1 -0
  622. package/build/utils/StringToBuffer.d.ts.map +1 -0
  623. package/build/utils/StringToBuffer.js +1 -0
  624. package/build/utils/StringToBuffer.js.map +1 -0
  625. package/build/utils/lengths.d.ts +1 -0
  626. package/build/utils/lengths.d.ts.map +1 -0
  627. package/build/utils/lengths.js +1 -0
  628. package/build/utils/lengths.js.map +1 -0
  629. package/build/utils/types.d.ts +1 -0
  630. package/build/utils/types.d.ts.map +1 -0
  631. package/build/utils/types.js +2 -1
  632. package/build/utils/types.js.map +1 -0
  633. package/build/utxo/OPNetLimitedProvider.d.ts +39 -3
  634. package/build/utxo/OPNetLimitedProvider.d.ts.map +1 -0
  635. package/build/utxo/OPNetLimitedProvider.js +41 -3
  636. package/build/utxo/OPNetLimitedProvider.js.map +1 -0
  637. package/build/utxo/interfaces/BroadcastResponse.d.ts +1 -0
  638. package/build/utxo/interfaces/BroadcastResponse.d.ts.map +1 -0
  639. package/build/utxo/interfaces/BroadcastResponse.js +1 -0
  640. package/build/utxo/interfaces/BroadcastResponse.js.map +1 -0
  641. package/build/utxo/interfaces/IUTXO.d.ts +13 -7
  642. package/build/utxo/interfaces/IUTXO.d.ts.map +1 -0
  643. package/build/utxo/interfaces/IUTXO.js +1 -0
  644. package/build/utxo/interfaces/IUTXO.js.map +1 -0
  645. package/build/verification/TapscriptVerificator.d.ts +12 -10
  646. package/build/verification/TapscriptVerificator.d.ts.map +1 -0
  647. package/build/verification/TapscriptVerificator.js +28 -38
  648. package/build/verification/TapscriptVerificator.js.map +1 -0
  649. package/eslint.config.js +0 -1
  650. package/package.json +12 -35
  651. package/src/abi/ABICoder.ts +0 -13
  652. package/src/branded/Branded.ts +5 -0
  653. package/src/buffer/BinaryReader.ts +7 -7
  654. package/src/buffer/BinaryWriter.ts +29 -24
  655. package/src/bytecode/Compressor.ts +1 -1
  656. package/src/chain/ChainData.ts +34 -27
  657. package/src/consensus/ConsensusConfig.ts +1 -1
  658. package/src/consensus/IConsensusConfig.ts +0 -17
  659. package/src/consensus/metadata/RoswellConsensus.ts +1 -17
  660. package/src/deterministic/AddressMap.ts +5 -1
  661. package/src/deterministic/AddressSet.ts +5 -1
  662. package/src/deterministic/CustomMap.ts +6 -2
  663. package/src/deterministic/DeterministicMap.ts +8 -4
  664. package/src/deterministic/DeterministicSet.ts +6 -2
  665. package/src/deterministic/ExtendedAddressMap.ts +9 -4
  666. package/src/deterministic/FastMap.ts +9 -5
  667. package/src/ecc/backend.ts +17 -0
  668. package/src/epoch/ChallengeSolution.ts +3 -3
  669. package/src/epoch/interfaces/IChallengeSolution.ts +13 -13
  670. package/src/epoch/validator/EpochValidator.ts +24 -43
  671. package/src/generators/AddressGenerator.ts +6 -6
  672. package/src/generators/Features.ts +3 -3
  673. package/src/generators/Generator.ts +42 -26
  674. package/src/generators/builders/CalldataGenerator.ts +26 -24
  675. package/src/generators/builders/CustomGenerator.ts +4 -4
  676. package/src/generators/builders/DeploymentGenerator.ts +25 -23
  677. package/src/generators/builders/HashCommitmentGenerator.ts +31 -31
  678. package/src/generators/builders/LegacyCalldataGenerator.ts +26 -24
  679. package/src/generators/builders/MultiSignGenerator.ts +12 -12
  680. package/src/generators/builders/P2WDAGenerator.ts +10 -10
  681. package/src/keypair/Address.ts +114 -71
  682. package/src/keypair/AddressVerificator.ts +16 -147
  683. package/src/keypair/EcKeyPair.ts +105 -114
  684. package/src/keypair/MessageSigner.ts +70 -150
  685. package/src/keypair/Wallet.ts +59 -240
  686. package/src/metadata/ContractBaseMetadata.ts +2 -2
  687. package/src/mnemonic/Mnemonic.ts +32 -221
  688. package/src/opnet.ts +12 -6
  689. package/src/p2wda/P2WDADetector.ts +23 -72
  690. package/src/polyfill/disposable.ts +29 -0
  691. package/src/signer/AddressRotation.ts +1 -1
  692. package/src/signer/IRotationSigner.ts +3 -3
  693. package/src/signer/ParallelSignerAdapter.ts +59 -0
  694. package/src/signer/SignerUtils.ts +4 -4
  695. package/src/signer/TweakedSigner.ts +28 -13
  696. package/src/transaction/ContractAddress.ts +3 -7
  697. package/src/transaction/TransactionFactory.ts +28 -50
  698. package/src/transaction/browser/BrowserSignerBase.ts +12 -6
  699. package/src/transaction/browser/Web3Provider.ts +3 -3
  700. package/src/transaction/browser/extensions/UnisatSigner.ts +52 -48
  701. package/src/transaction/browser/extensions/XverseSigner.ts +55 -38
  702. package/src/transaction/browser/types/OPWallet.ts +2 -2
  703. package/src/transaction/browser/types/Unisat.ts +1 -1
  704. package/src/transaction/builders/CancelTransaction.ts +59 -24
  705. package/src/transaction/builders/ChallengeSolutionTransaction.ts +3 -3
  706. package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +39 -34
  707. package/src/transaction/builders/CustomScriptTransaction.ts +79 -56
  708. package/src/transaction/builders/DeploymentTransaction.ts +82 -63
  709. package/src/transaction/builders/FundingTransaction.ts +11 -11
  710. package/src/transaction/builders/InteractionTransaction.ts +10 -10
  711. package/src/transaction/builders/InteractionTransactionP2WDA.ts +38 -40
  712. package/src/transaction/builders/MultiSignTransaction.ts +68 -61
  713. package/src/transaction/builders/SharedInteractionTransaction.ts +81 -57
  714. package/src/transaction/builders/TransactionBuilder.ts +101 -79
  715. package/src/transaction/interfaces/ICancelTransactionParameters.ts +2 -2
  716. package/src/transaction/interfaces/IConsolidatedTransactionParameters.ts +5 -5
  717. package/src/transaction/interfaces/ICustomTransactionParameters.ts +5 -5
  718. package/src/transaction/interfaces/ITransactionParameters.ts +15 -15
  719. package/src/transaction/interfaces/ITransactionResponses.ts +2 -2
  720. package/src/transaction/interfaces/ITweakedTransactionData.ts +17 -8
  721. package/src/transaction/interfaces/IWeb3ProviderTypes.ts +3 -3
  722. package/src/transaction/interfaces/Tap.ts +3 -3
  723. package/src/transaction/mineable/IP2WSHAddress.ts +1 -1
  724. package/src/transaction/mineable/TimelockGenerator.ts +19 -12
  725. package/src/transaction/offline/OfflineTransactionManager.ts +22 -23
  726. package/src/transaction/offline/TransactionReconstructor.ts +83 -91
  727. package/src/transaction/offline/TransactionSerializer.ts +151 -101
  728. package/src/transaction/offline/TransactionStateCapture.ts +83 -79
  729. package/src/transaction/offline/interfaces/ISerializableState.ts +1 -1
  730. package/src/transaction/offline/interfaces/ITypeSpecificData.ts +1 -1
  731. package/src/transaction/shared/P2TR_MS.ts +4 -4
  732. package/src/transaction/shared/TweakedTransaction.ts +326 -124
  733. package/src/transaction/utils/WitnessUtils.ts +18 -9
  734. package/src/utils/BufferHelper.ts +39 -37
  735. package/src/utxo/OPNetLimitedProvider.ts +7 -7
  736. package/src/utxo/interfaces/IUTXO.ts +7 -7
  737. package/src/verification/TapscriptVerificator.ts +73 -86
  738. package/test/address-rotation.test.ts +24 -24
  739. package/test/address.test.ts +12 -12
  740. package/test/addressmap.test.ts +30 -30
  741. package/test/binary-reader-writer.test.ts +8 -8
  742. package/test/browser/offline-transaction.test.ts +2206 -0
  743. package/test/browser/parallel-signing.test.ts +316 -0
  744. package/test/browser/setup.ts +11 -0
  745. package/test/browser/transaction-signing.test.ts +416 -0
  746. package/test/buffer-helper.test.ts +287 -0
  747. package/test/derivePath.test.ts +4 -3
  748. package/test/disposable.test.ts +279 -0
  749. package/test/fastmap-setall.test.ts +1 -1
  750. package/test/fastmap.test.ts +3 -3
  751. package/test/messagesigner-mldsa.test.ts +3 -3
  752. package/test/messagesigner-schnorr.test.ts +9 -9
  753. package/test/offline-transaction.test.ts +461 -288
  754. package/test/old/FastBigIntMap.ts +3 -3
  755. package/test/oldfastmap.test.ts +6 -6
  756. package/test/transaction-builders.test.ts +321 -0
  757. package/tsconfig.base.json +34 -18
  758. package/tsconfig.browser.json +15 -0
  759. package/tsconfig.json +3 -8
  760. package/vite.config.browser.ts +4 -5
  761. package/vitest.config.browser.ts +68 -0
  762. package/vitest.config.ts +1 -1
  763. package/browser/valibot.js +0 -4948
  764. package/tsconfig.webpack.json +0 -18
@@ -1,16 +1,5 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _Address_p2tr, _Address_p2op, _Address_network, _Address_originalPublicKey, _Address_keyPair, _Address_uncompressed, _Address_tweakedUncompressed, _Address_p2wda, _Address_mldsaPublicKey, _Address_cachedBigInt, _Address_cachedBigIntTweaked, _Address_cachedUint64Array, _Address_originalMDLSAPublicKey, _Address_mldsaLevel, _Address_pendingLegacyKey, _Address_legacyProcessed, _Address_legacyPublicKey;
13
- import { decompressPublicKey, toXOnly } from '@btc-vision/bitcoin';
1
+ import { decompressPublicKey, fromHex, toHex, toXOnly, } from '@btc-vision/bitcoin';
2
+ import {} from '@btc-vision/ecpair';
14
3
  import { ADDRESS_BYTE_LENGTH } from '../utils/lengths.js';
15
4
  import { AddressVerificator } from './AddressVerificator.js';
16
5
  import { EcKeyPair } from './EcKeyPair.js';
@@ -19,72 +8,119 @@ import { BitcoinUtils } from '../utils/BitcoinUtils.js';
19
8
  import { TimeLockGenerator } from '../transaction/mineable/TimelockGenerator.js';
20
9
  import { P2WDADetector } from '../p2wda/P2WDADetector.js';
21
10
  import { sha256 } from '@noble/hashes/sha2.js';
11
+ import { MLDSASecurityLevel } from '@btc-vision/bip32';
12
+ // ML-DSA-44 (Level 2): 1312 bytes public key
13
+ // ML-DSA-65 (Level 3): 1952 bytes public key
14
+ // ML-DSA-87 (Level 5): 2592 bytes public key
15
+ const validMLDSALengths = [1312, 1952, 2592];
16
+ /**
17
+ * Objects of type "Address" represent hashed ML-DSA (quantum) public keys (using SHA256 of quantum keys) and maintain classical public keys separately.
18
+ * This class supports a hybrid quantum-classical architecture, allowing conversion to different address formats and management of both key types.
19
+ *
20
+ * The Address internally stores the SHA256 hash of the ML-DSA public key as its primary content, while maintaining
21
+ * the classical public key in a separate field. This enables quantum-resistant addressing while preserving
22
+ * compatibility with traditional Bitcoin cryptography.
23
+ *
24
+ * @category KeyPair
25
+ */
22
26
  export class Address extends Uint8Array {
27
+ #p2tr;
28
+ #p2op;
29
+ #network;
30
+ #originalPublicKey;
31
+ #keyPair;
32
+ #uncompressed;
33
+ #tweakedUncompressed;
34
+ #p2wda;
35
+ #mldsaPublicKey;
36
+ #cachedBigInt;
37
+ #cachedBigIntTweaked;
38
+ #cachedUint64Array;
39
+ #originalMDLSAPublicKey;
40
+ #mldsaLevel;
41
+ // Lazy loading state - defers expensive EC operations until actually needed
42
+ #pendingLegacyKey;
43
+ #legacyProcessed = false;
44
+ // After processing, this is 32-byte tweaked x-only (same as original behavior)
45
+ #tweakedPublicKey;
23
46
  constructor(mldsaPublicKey, publicKeyOrTweak) {
24
47
  super(ADDRESS_BYTE_LENGTH);
25
- _Address_p2tr.set(this, void 0);
26
- _Address_p2op.set(this, void 0);
27
- _Address_network.set(this, void 0);
28
- _Address_originalPublicKey.set(this, void 0);
29
- _Address_keyPair.set(this, void 0);
30
- _Address_uncompressed.set(this, void 0);
31
- _Address_tweakedUncompressed.set(this, void 0);
32
- _Address_p2wda.set(this, void 0);
33
- _Address_mldsaPublicKey.set(this, void 0);
34
- _Address_cachedBigInt.set(this, void 0);
35
- _Address_cachedBigIntTweaked.set(this, void 0);
36
- _Address_cachedUint64Array.set(this, void 0);
37
- _Address_originalMDLSAPublicKey.set(this, void 0);
38
- _Address_mldsaLevel.set(this, void 0);
39
- _Address_pendingLegacyKey.set(this, void 0);
40
- _Address_legacyProcessed.set(this, false);
41
- _Address_legacyPublicKey.set(this, void 0);
42
48
  if (!mldsaPublicKey) {
43
49
  return;
44
50
  }
45
51
  if (publicKeyOrTweak) {
52
+ // Validate length immediately (cheap check), defer EC operations
46
53
  const validLengths = [ADDRESS_BYTE_LENGTH, 33, 65];
47
54
  if (!validLengths.includes(publicKeyOrTweak.length)) {
48
55
  throw new Error(`Invalid public key length ${publicKeyOrTweak.length}`);
49
56
  }
50
- __classPrivateFieldSet(this, _Address_pendingLegacyKey, new Uint8Array(publicKeyOrTweak.length), "f");
51
- __classPrivateFieldGet(this, _Address_pendingLegacyKey, "f").set(publicKeyOrTweak);
57
+ // Store but don't process yet - defer EC operations
58
+ this.#pendingLegacyKey = new Uint8Array(publicKeyOrTweak.length);
59
+ this.#pendingLegacyKey.set(publicKeyOrTweak);
52
60
  }
53
61
  this.setMldsaKey(mldsaPublicKey);
54
62
  }
63
+ /**
64
+ * Prevent TypedArray methods (subarray, slice, etc.) from creating Address
65
+ * instances. Without this, @noble/hashes and other libraries that call
66
+ * subarray() on an Address would invoke the Address constructor that recomputes
67
+ * everything leading to bad performance.
68
+ */
69
+ static get [Symbol.species]() {
70
+ return Uint8Array;
71
+ }
55
72
  get mldsaLevel() {
56
- return __classPrivateFieldGet(this, _Address_mldsaLevel, "f");
73
+ return this.#mldsaLevel;
57
74
  }
58
75
  set mldsaLevel(level) {
59
- __classPrivateFieldSet(this, _Address_mldsaLevel, level, "f");
76
+ this.#mldsaLevel = level;
60
77
  }
61
78
  get originalMDLSAPublicKey() {
62
- return __classPrivateFieldGet(this, _Address_originalMDLSAPublicKey, "f");
79
+ return this.#originalMDLSAPublicKey;
63
80
  }
64
81
  set originalMDLSAPublicKey(key) {
65
- __classPrivateFieldSet(this, _Address_originalMDLSAPublicKey, new Uint8Array(key), "f");
82
+ this.#originalMDLSAPublicKey = key ? new Uint8Array(key) : undefined;
66
83
  }
84
+ /**
85
+ * If available, this will return the original public key associated with the address.
86
+ * @returns {Uint8Array} The original public key used to create the address.
87
+ */
67
88
  get originalPublicKey() {
68
89
  this.ensureLegacyProcessed();
69
- return __classPrivateFieldGet(this, _Address_originalPublicKey, "f");
90
+ return this.#originalPublicKey;
70
91
  }
71
92
  get mldsaPublicKey() {
72
- return __classPrivateFieldGet(this, _Address_mldsaPublicKey, "f");
93
+ return this.#mldsaPublicKey;
73
94
  }
95
+ /**
96
+ * Get the legacy public key (32-byte tweaked x-only after processing).
97
+ * Triggers lazy processing if not yet done.
98
+ */
74
99
  get legacyPublicKey() {
75
100
  this.ensureLegacyProcessed();
76
- return __classPrivateFieldGet(this, _Address_legacyPublicKey, "f");
101
+ return this.#tweakedPublicKey;
77
102
  }
103
+ /**
104
+ * Get the key pair for the address
105
+ * @description This is only for internal use. Please use address.tweakedBytes instead.
106
+ */
78
107
  get keyPair() {
79
108
  this.ensureLegacyProcessed();
80
- if (!__classPrivateFieldGet(this, _Address_keyPair, "f")) {
109
+ if (!this.#keyPair) {
81
110
  throw new Error('Legacy public key not set for address');
82
111
  }
83
- return __classPrivateFieldGet(this, _Address_keyPair, "f");
112
+ return this.#keyPair;
84
113
  }
85
114
  static dead() {
86
- return Address.fromString('0x0000000000000000000000000000000000000000000000000000000000000000', '0x04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f');
87
- }
115
+ return Address.fromString('0x0000000000000000000000000000000000000000000000000000000000000000', // DEAD ADDRESS
116
+ '0x04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f');
117
+ }
118
+ /**
119
+ * Create an address from a hex string
120
+ * @param {string} mldsaPublicKey The ml-dsa public key in hex format
121
+ * @param {string} legacyPublicKey The classical public key in hex format
122
+ * @returns {Address} The address
123
+ */
88
124
  static fromString(mldsaPublicKey, legacyPublicKey) {
89
125
  if (!mldsaPublicKey) {
90
126
  throw new Error('Invalid public key');
@@ -103,10 +139,15 @@ export class Address extends Uint8Array {
103
139
  if (!BitcoinUtils.isValidHex(legacyPublicKey)) {
104
140
  throw new Error('You must only pass classical public keys in hexadecimal format. If you have an address such as bc1q... you must convert it to a public key first. Please refer to await provider.getPublicKeyInfo("bc1q..."). If the public key associated with the address is not found, you must force the user to enter the destination public key. It looks like: 0x020373626d317ae8788ce3280b491068610d840c23ecb64c14075bbb9f670af52c.');
105
141
  }
106
- classicBuffer = Buffer.from(legacyPublicKey, 'hex');
142
+ classicBuffer = fromHex(legacyPublicKey);
107
143
  }
108
- return new Address(Buffer.from(mldsaPublicKey, 'hex'), classicBuffer);
144
+ return new Address(fromHex(mldsaPublicKey), classicBuffer);
109
145
  }
146
+ /**
147
+ * Create an address from a public key
148
+ * @returns {Address} The address
149
+ * @param {ArrayLike<number>} bytes The public key
150
+ */
110
151
  static wrap(bytes) {
111
152
  return new Address(bytes);
112
153
  }
@@ -114,16 +155,85 @@ export class Address extends Uint8Array {
114
155
  const buffer = Uint8Array.from(publicKey);
115
156
  const x = buffer.slice(1, 33);
116
157
  const y = buffer.slice(33);
117
- const compressed = Buffer.alloc(33);
158
+ const compressed = new Uint8Array(33);
118
159
  compressed[0] = 0x02 + (y[y.length - 1] & 0x01);
119
160
  compressed.set(x, 1);
120
161
  return compressed;
121
162
  }
163
+ [Symbol.dispose]() {
164
+ // Zero the base Uint8Array (hashed ML-DSA public key)
165
+ this.fill(0);
166
+ // Clear all cached / derived state
167
+ this.#p2tr = undefined;
168
+ this.#p2op = undefined;
169
+ this.#network = undefined;
170
+ this.#originalPublicKey = undefined;
171
+ this.#keyPair = undefined;
172
+ this.#uncompressed = undefined;
173
+ this.#tweakedUncompressed = undefined;
174
+ this.#p2wda = undefined;
175
+ this.#mldsaPublicKey?.fill(0);
176
+ this.#mldsaPublicKey = undefined;
177
+ this.#cachedBigInt = undefined;
178
+ this.#cachedBigIntTweaked = undefined;
179
+ this.#cachedUint64Array = undefined;
180
+ this.#originalMDLSAPublicKey?.fill(0);
181
+ this.#originalMDLSAPublicKey = undefined;
182
+ this.#mldsaLevel = undefined;
183
+ this.#legacyProcessed = false;
184
+ this.#tweakedPublicKey = undefined;
185
+ }
186
+ /**
187
+ * Creates an Address instance from a BigInt value.
188
+ *
189
+ * Converts a 256-bit unsigned integer into a 32-byte address by splitting it
190
+ * into four 64-bit chunks and writing them in big-endian format using DataView.
191
+ * This is the inverse operation of toBigInt().
192
+ *
193
+ * @param {bigint} value - The 256-bit unsigned integer to convert (0 to 2^256-1)
194
+ * @param {bigint} [tweakedValue] - Optional tweaked public key as a 256-bit unsigned integer
195
+ * @returns {Address} A new Address instance containing the converted value
196
+ *
197
+ * @throws {RangeError} If the value is negative or exceeds 2^256-1
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * const bigIntValue = 12345678901234567890n;
202
+ * const address = Address.fromBigInt(bigIntValue);
203
+ * console.log(address.toHex()); // 0x0000000000000000000000000000000000000000000000000000abc123...
204
+ * ```
205
+ */
122
206
  static fromBigInt(value, tweakedValue) {
123
207
  const address = Address.bigintToUint8Array(value);
124
208
  const legacyAddress = tweakedValue !== undefined ? Address.bigintToUint8Array(tweakedValue) : undefined;
125
209
  return new Address(address, legacyAddress);
126
210
  }
211
+ /**
212
+ * Creates an Address instance from four 64-bit unsigned integers.
213
+ *
214
+ * Constructs a 32-byte address by combining four 64-bit big-endian unsigned integers.
215
+ * This is the inverse operation of toUint64Array() and provides an efficient way
216
+ * to create addresses from word-aligned data.
217
+ *
218
+ * @param {bigint} w0 - Most significant 64 bits (bytes 0-7)
219
+ * @param {bigint} w1 - Second 64 bits (bytes 8-15)
220
+ * @param {bigint} w2 - Third 64 bits (bytes 16-23)
221
+ * @param {bigint} w3 - Least significant 64 bits (bytes 24-31)
222
+ * @returns {Address} A new Address instance containing the combined value
223
+ *
224
+ * @throws {RangeError} If any value exceeds 64 bits (2^64-1)
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * const address = Address.fromUint64Array(
229
+ * 0x0123456789abcdefn,
230
+ * 0xfedcba9876543210n,
231
+ * 0x1111222233334444n,
232
+ * 0x5555666677778888n
233
+ * );
234
+ * console.log(address.toHex());
235
+ * ```
236
+ */
127
237
  static fromUint64Array(w0, w1, w2, w3) {
128
238
  const buffer = new Uint8Array(32);
129
239
  const view = new DataView(buffer.buffer);
@@ -142,19 +252,41 @@ export class Address extends Uint8Array {
142
252
  view.setBigUint64(24, value & 0xffffffffffffffffn, false);
143
253
  return buffer;
144
254
  }
255
+ /**
256
+ * Converts the address to four 64-bit unsigned integers.
257
+ *
258
+ * Splits the 32-byte (256-bit) address into four 64-bit big-endian unsigned integers.
259
+ * This representation is useful for efficient storage, comparison operations, or
260
+ * interfacing with systems that work with 64-bit word sizes.
261
+ *
262
+ * @returns {[bigint, bigint, bigint, bigint]} An array of four 64-bit unsigned integers
263
+ * representing the address from most significant to least significant bits
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * const address = Address.fromString('0x0123456789abcdef...');
268
+ * const [w0, w1, w2, w3] = address.toUint64Array();
269
+ * console.log(w0); // Most significant 64 bits
270
+ * console.log(w3); // Least significant 64 bits
271
+ * ```
272
+ */
145
273
  toUint64Array() {
146
- if (__classPrivateFieldGet(this, _Address_cachedUint64Array, "f") !== undefined) {
147
- return __classPrivateFieldGet(this, _Address_cachedUint64Array, "f");
274
+ if (this.#cachedUint64Array !== undefined) {
275
+ return this.#cachedUint64Array;
148
276
  }
149
277
  const view = new DataView(this.buffer, this.byteOffset, 32);
150
- __classPrivateFieldSet(this, _Address_cachedUint64Array, [
278
+ this.#cachedUint64Array = [
151
279
  view.getBigUint64(0, false),
152
280
  view.getBigUint64(8, false),
153
281
  view.getBigUint64(16, false),
154
282
  view.getBigUint64(24, false),
155
- ], "f");
156
- return __classPrivateFieldGet(this, _Address_cachedUint64Array, "f");
283
+ ];
284
+ return this.#cachedUint64Array;
157
285
  }
286
+ /**
287
+ * Check if the address is the dead address
288
+ * @returns {boolean}
289
+ */
158
290
  isDead() {
159
291
  for (let i = 0; i < ADDRESS_BYTE_LENGTH; i++) {
160
292
  if (this[i] !== 0) {
@@ -163,85 +295,135 @@ export class Address extends Uint8Array {
163
295
  }
164
296
  return true;
165
297
  }
298
+ /**
299
+ * Converts the address to a hex string
300
+ * @returns {string} The hex string
301
+ */
166
302
  toHex() {
167
- return '0x' + Buffer.from(this).toString('hex');
303
+ return '0x' + toHex(this);
168
304
  }
305
+ /**
306
+ * Converts the classical public key to a hex string
307
+ * @returns {string} The hex string
308
+ */
169
309
  tweakedToHex() {
170
310
  const key = this.legacyPublicKey;
171
311
  if (!key) {
172
312
  throw new Error('Legacy public key not set');
173
313
  }
174
- return '0x' + Buffer.from(key).toString('hex');
314
+ return '0x' + toHex(key);
175
315
  }
316
+ /**
317
+ * Converts the address content (SHA256 hash of ML-DSA public key) to a Uint8Array
318
+ * @returns {Uint8Array} The Uint8Array containing the hashed ML-DSA public key
319
+ */
176
320
  toBuffer() {
177
- return Buffer.from(this);
321
+ return new Uint8Array(this);
178
322
  }
323
+ /**
324
+ * Converts the classical public key to a Uint8Array
325
+ * @returns {Uint8Array} The Uint8Array
326
+ */
179
327
  tweakedPublicKeyToBuffer() {
180
328
  const key = this.legacyPublicKey;
181
329
  if (!key) {
182
330
  throw new Error('Legacy public key not set');
183
331
  }
184
- return Buffer.from(key);
332
+ return new Uint8Array(key);
185
333
  }
186
334
  toUncompressedHex() {
187
335
  this.ensureLegacyProcessed();
188
- if (!__classPrivateFieldGet(this, _Address_uncompressed, "f")) {
336
+ if (!this.#uncompressed) {
189
337
  throw new Error('Legacy public key not set');
190
338
  }
191
- return '0x' + __classPrivateFieldGet(this, _Address_uncompressed, "f").uncompressed.toString('hex');
339
+ return '0x' + toHex(this.#uncompressed.uncompressed);
192
340
  }
193
341
  toUncompressedBuffer() {
194
342
  this.ensureLegacyProcessed();
195
- if (!__classPrivateFieldGet(this, _Address_uncompressed, "f")) {
343
+ if (!this.#uncompressed) {
196
344
  throw new Error('Legacy public key not set');
197
345
  }
198
- return __classPrivateFieldGet(this, _Address_uncompressed, "f").uncompressed;
346
+ return this.#uncompressed.uncompressed;
199
347
  }
200
348
  toHybridPublicKeyHex() {
201
349
  this.ensureLegacyProcessed();
202
- if (!__classPrivateFieldGet(this, _Address_uncompressed, "f")) {
350
+ if (!this.#uncompressed) {
203
351
  throw new Error('Legacy public key not set');
204
352
  }
205
- return '0x' + __classPrivateFieldGet(this, _Address_uncompressed, "f").hybrid.toString('hex');
353
+ return '0x' + toHex(this.#uncompressed.hybrid);
206
354
  }
207
355
  toHybridPublicKeyBuffer() {
208
356
  this.ensureLegacyProcessed();
209
- if (!__classPrivateFieldGet(this, _Address_uncompressed, "f")) {
357
+ if (!this.#uncompressed) {
210
358
  throw new Error('Legacy public key not set');
211
359
  }
212
- return __classPrivateFieldGet(this, _Address_uncompressed, "f").hybrid;
360
+ return this.#uncompressed.hybrid;
213
361
  }
214
362
  originalPublicKeyBuffer() {
215
363
  this.ensureLegacyProcessed();
216
- if (!__classPrivateFieldGet(this, _Address_originalPublicKey, "f")) {
364
+ if (!this.#originalPublicKey) {
217
365
  throw new Error('Legacy public key not set');
218
366
  }
219
- return Buffer.from(__classPrivateFieldGet(this, _Address_originalPublicKey, "f"));
220
- }
367
+ return new Uint8Array(this.#originalPublicKey);
368
+ }
369
+ /**
370
+ * Converts the address to a BigInt representation.
371
+ *
372
+ * This method uses an optimized DataView approach to read the 32-byte address
373
+ * as four 64-bit big-endian unsigned integers, then combines them using bitwise
374
+ * operations. This is approximately 10-20x faster than string-based conversion.
375
+ *
376
+ * @returns {bigint} The address as a 256-bit unsigned integer
377
+ *
378
+ * @example
379
+ * ```typescript
380
+ * const address = Address.fromString('0x0123456789abcdef...');
381
+ * const bigIntValue = address.toBigInt();
382
+ * console.log(bigIntValue); // 123456789...n
383
+ * ```
384
+ */
221
385
  toBigInt() {
222
- if (__classPrivateFieldGet(this, _Address_cachedBigInt, "f") !== undefined) {
223
- return __classPrivateFieldGet(this, _Address_cachedBigInt, "f");
386
+ if (this.#cachedBigInt !== undefined) {
387
+ return this.#cachedBigInt;
224
388
  }
225
389
  const view = new DataView(this.buffer, this.byteOffset, 32);
226
- __classPrivateFieldSet(this, _Address_cachedBigInt, (view.getBigUint64(0, false) << 192n) |
227
- (view.getBigUint64(8, false) << 128n) |
228
- (view.getBigUint64(16, false) << 64n) |
229
- view.getBigUint64(24, false), "f");
230
- return __classPrivateFieldGet(this, _Address_cachedBigInt, "f");
231
- }
390
+ this.#cachedBigInt =
391
+ (view.getBigUint64(0, false) << 192n) |
392
+ (view.getBigUint64(8, false) << 128n) |
393
+ (view.getBigUint64(16, false) << 64n) |
394
+ view.getBigUint64(24, false);
395
+ return this.#cachedBigInt;
396
+ }
397
+ /**
398
+ * Converts the tweaked public key to a BigInt representation.
399
+ *
400
+ * This method uses an optimized DataView approach to read the 32-byte address
401
+ * as four 64-bit big-endian unsigned integers, then combines them using bitwise
402
+ * operations. This is approximately 10-20x faster than string-based conversion.
403
+ *
404
+ * @returns {bigint} The address as a 256-bit unsigned integer
405
+ *
406
+ * @example
407
+ * ```typescript
408
+ * const address = Address.fromString('0x0123456789abcdef...', '0xtweaked...');
409
+ * const bigIntValue = address.tweakedToBigInt();
410
+ * console.log(bigIntValue); // 123456789...n
411
+ * ```
412
+ */
232
413
  tweakedToBigInt() {
233
414
  if (!this.legacyPublicKey) {
234
415
  throw new Error('Legacy public key not set');
235
416
  }
236
- if (__classPrivateFieldGet(this, _Address_cachedBigIntTweaked, "f") !== undefined) {
237
- return __classPrivateFieldGet(this, _Address_cachedBigIntTweaked, "f");
417
+ if (this.#cachedBigIntTweaked !== undefined) {
418
+ return this.#cachedBigIntTweaked;
238
419
  }
239
420
  const view = new DataView(this.legacyPublicKey.buffer, this.byteOffset, 32);
240
- __classPrivateFieldSet(this, _Address_cachedBigIntTweaked, (view.getBigUint64(0, false) << 192n) |
241
- (view.getBigUint64(8, false) << 128n) |
242
- (view.getBigUint64(16, false) << 64n) |
243
- view.getBigUint64(24, false), "f");
244
- return __classPrivateFieldGet(this, _Address_cachedBigIntTweaked, "f");
421
+ this.#cachedBigIntTweaked =
422
+ (view.getBigUint64(0, false) << 192n) |
423
+ (view.getBigUint64(8, false) << 128n) |
424
+ (view.getBigUint64(16, false) << 64n) |
425
+ view.getBigUint64(24, false);
426
+ return this.#cachedBigIntTweaked;
245
427
  }
246
428
  equals(a) {
247
429
  const b = this;
@@ -255,65 +437,110 @@ export class Address extends Uint8Array {
255
437
  }
256
438
  return true;
257
439
  }
440
+ /**
441
+ * Check if the address is bigger than another address
442
+ * @returns {boolean} If bigger
443
+ */
258
444
  lessThan(a) {
259
445
  const b = this;
260
446
  for (let i = 0; i < ADDRESS_BYTE_LENGTH; i++) {
261
447
  const thisByte = b[i];
262
448
  const aByte = a[i];
263
449
  if (thisByte < aByte) {
264
- return true;
450
+ return true; // this is less than a
265
451
  }
266
452
  else if (thisByte > aByte) {
267
- return false;
453
+ return false; // this is greater than or equal to a
268
454
  }
269
455
  }
270
456
  return false;
271
457
  }
458
+ /**
459
+ * Check if the address is smaller than another address
460
+ * @returns {boolean} If smaller
461
+ */
272
462
  greaterThan(a) {
463
+ // Compare the two addresses byte-by-byte, treating them as big-endian uint256
273
464
  const b = this;
274
465
  for (let i = 0; i < ADDRESS_BYTE_LENGTH; i++) {
275
466
  const thisByte = b[i];
276
467
  const aByte = a[i];
277
468
  if (thisByte > aByte) {
278
- return true;
469
+ return true; // this is greater than a
279
470
  }
280
471
  else if (thisByte < aByte) {
281
- return false;
472
+ return false; // this is less than or equal to a
282
473
  }
283
474
  }
284
475
  return false;
285
476
  }
477
+ /**
478
+ * Set the public key
479
+ * @param {ArrayLike<number>} mldsaPublicKey ML-DSA public key
480
+ * @returns {void}
481
+ */
286
482
  set(mldsaPublicKey) {
483
+ // Legacy key processing is now deferred via ensureLegacyProcessed()
287
484
  this.setMldsaKey(mldsaPublicKey);
288
485
  }
486
+ /**
487
+ * Check if the public key is valid
488
+ * @param {Network} network The network
489
+ * @returns {boolean} If the public key is valid
490
+ */
289
491
  isValidLegacyPublicKey(network) {
290
492
  const key = this.legacyPublicKey;
291
493
  if (!key) {
292
494
  throw new Error(`Legacy key not set.`);
293
495
  }
294
- return AddressVerificator.isValidPublicKey(Buffer.from(key).toString('hex'), network);
496
+ return AddressVerificator.isValidPublicKey(toHex(key), network);
295
497
  }
498
+ /**
499
+ * Get the public key as address
500
+ */
296
501
  p2pk() {
297
502
  return this.toHex();
298
503
  }
504
+ /**
505
+ * Get the address in p2wpkh format
506
+ * @param {Network} network The network
507
+ */
299
508
  p2wpkh(network) {
300
509
  return EcKeyPair.getP2WPKHAddress(this.keyPair, network);
301
510
  }
511
+ /**
512
+ * Get the address in p2pkh format
513
+ * @param {Network} network The network
514
+ */
302
515
  p2pkh(network) {
303
516
  return EcKeyPair.getLegacyAddress(this.keyPair, network);
304
517
  }
518
+ /**
519
+ * Get the address in p2sh-p2wpkh format
520
+ * @param {Network} network The network
521
+ */
305
522
  p2shp2wpkh(network) {
306
523
  return EcKeyPair.getLegacySegwitAddress(this.keyPair, network);
307
524
  }
525
+ /**
526
+ * Convert the address to a string
527
+ */
308
528
  toString() {
309
529
  return this.toHex();
310
530
  }
531
+ /**
532
+ * Convert the address to a JSON string
533
+ */
311
534
  toJSON() {
312
535
  return this.toHex();
313
536
  }
537
+ /**
538
+ * Get the address in p2tr format
539
+ * @param {Network} network The network
540
+ */
314
541
  p2tr(network) {
315
- if (__classPrivateFieldGet(this, _Address_p2tr, "f") && __classPrivateFieldGet(this, _Address_network, "f") === network) {
316
- return __classPrivateFieldGet(this, _Address_p2tr, "f");
542
+ if (this.#p2tr && this.#network === network) {
543
+ return this.#p2tr;
317
544
  }
318
545
  const key = this.legacyPublicKey;
319
546
  if (!key) {
@@ -321,28 +548,50 @@ export class Address extends Uint8Array {
321
548
  }
322
549
  const p2trAddy = EcKeyPair.tweakedPubKeyBufferToAddress(key, network);
323
550
  if (p2trAddy) {
324
- __classPrivateFieldSet(this, _Address_network, network, "f");
325
- __classPrivateFieldSet(this, _Address_p2tr, p2trAddy, "f");
551
+ this.#network = network;
552
+ this.#p2tr = p2trAddy;
326
553
  return p2trAddy;
327
554
  }
328
555
  throw new Error('Legacy public key not set');
329
556
  }
557
+ /**
558
+ * Generate a P2WDA (Pay-to-Witness-Data-Authentication) address
559
+ *
560
+ * P2WDA addresses are a special type of P2WSH address that allows embedding
561
+ * authenticated data directly in the witness field, achieving 75% cost reduction
562
+ * through Bitcoin's witness discount.
563
+ *
564
+ * The witness script pattern is: (OP_2DROP * 5) <pubkey> OP_CHECKSIG
565
+ * This allows up to 10 witness data fields (5 * 2 = 10), where each field
566
+ * can hold up to 80 bytes of data due to relay rules.
567
+ *
568
+ * @param {Network} network - The Bitcoin network to use
569
+ * @returns {IP2WSHAddress} The P2WDA address
570
+ * @throws {Error} If the public key is not set or address generation fails
571
+ *
572
+ * @example
573
+ * ```typescript
574
+ * const address = Address.fromString('0x02...');
575
+ * const p2wdaAddress = address.p2wda(networks.bitcoin);
576
+ * console.log(p2wdaAddress); // bc1q...
577
+ * ```
578
+ */
330
579
  p2wda(network) {
331
- if (__classPrivateFieldGet(this, _Address_p2wda, "f") && __classPrivateFieldGet(this, _Address_network, "f") === network) {
332
- return __classPrivateFieldGet(this, _Address_p2wda, "f");
580
+ if (this.#p2wda && this.#network === network) {
581
+ return this.#p2wda;
333
582
  }
334
583
  this.ensureLegacyProcessed();
335
- if (!__classPrivateFieldGet(this, _Address_originalPublicKey, "f")) {
584
+ if (!this.#originalPublicKey) {
336
585
  throw new Error('Cannot create P2WDA address: public key not set');
337
586
  }
338
- const publicKeyBuffer = Buffer.from(__classPrivateFieldGet(this, _Address_originalPublicKey, "f"));
587
+ const publicKeyBuffer = new Uint8Array(this.#originalPublicKey);
339
588
  if (publicKeyBuffer.length !== 33) {
340
589
  throw new Error('P2WDA requires a compressed public key (33 bytes)');
341
590
  }
342
591
  try {
343
592
  const p2wdaInfo = P2WDADetector.generateP2WDAAddress(publicKeyBuffer, network);
344
- __classPrivateFieldSet(this, _Address_network, network, "f");
345
- __classPrivateFieldSet(this, _Address_p2wda, p2wdaInfo, "f");
593
+ this.#network = network;
594
+ this.#p2wda = p2wdaInfo;
346
595
  return {
347
596
  address: p2wdaInfo.address,
348
597
  witnessScript: p2wdaInfo.witnessScript,
@@ -352,37 +601,82 @@ export class Address extends Uint8Array {
352
601
  throw new Error(`Failed to generate P2WDA address: ${error.message}`);
353
602
  }
354
603
  }
604
+ /**
605
+ * Generate a P2WSH address with CSV (CheckSequenceVerify) time lock
606
+ * The resulting address can only be spent after the specified number of blocks
607
+ * have passed since the UTXO was created.
608
+ *
609
+ * @param {bigint | number | string} duration - The number of blocks that must pass before spending (1-65535)
610
+ * @param {Network} network - The Bitcoin network to use
611
+ * @returns {IP2WSHAddress} The timelocked address and its witness script
612
+ * @throws {Error} If the block number is out of range or public key is not available
613
+ */
355
614
  toCSV(duration, network) {
356
615
  const n = Number(duration);
616
+ // First, let's validate the block number to ensure it's within the valid range
617
+ // CSV uses sequence numbers, which have special encoding for block-based locks
357
618
  if (n < 1 || n > 65535) {
358
619
  throw new Error('CSV block number must be between 1 and 65535');
359
620
  }
621
+ // We need the original public key in compressed format for the script
622
+ // Your class stores this in #originalPublicKey when a key is set
360
623
  this.ensureLegacyProcessed();
361
- if (!__classPrivateFieldGet(this, _Address_originalPublicKey, "f")) {
624
+ if (!this.#originalPublicKey) {
362
625
  throw new Error('Cannot create CSV address: public key not set');
363
626
  }
364
- const publicKeyBuffer = Buffer.from(__classPrivateFieldGet(this, _Address_originalPublicKey, "f"));
627
+ // Convert the public key to Uint8Array format that TimeLockGenerator expects
628
+ const publicKeyBuffer = new Uint8Array(this.#originalPublicKey);
629
+ // Now we can use your TimeLockGenerator to create the timelocked address
630
+ // Converting bigint to number is safe here because we've already validated the range
365
631
  return TimeLockGenerator.generateTimeLockAddress(publicKeyBuffer, network, n);
366
632
  }
633
+ /**
634
+ * Generate a P2TR address with CSV (CheckSequenceVerify) time lock
635
+ * The resulting address can only be spent after the specified number of blocks
636
+ * have passed since the UTXO was created.
637
+ *
638
+ * @param {bigint | number | string} duration - The number of blocks that must pass before spending (1-65535)
639
+ * @param {Network} network - The Bitcoin network to use
640
+ * @returns {IP2WSHAddress} The timelocked address and its witness script
641
+ * @throws {Error} If the block number is out of range or public key is not available
642
+ */
367
643
  toCSVTweaked(duration, network) {
368
644
  const n = Number(duration);
645
+ // First, let's validate the block number to ensure it's within the valid range
646
+ // CSV uses sequence numbers, which have special encoding for block-based locks
369
647
  if (n < 1 || n > 65535) {
370
648
  throw new Error('CSV block number must be between 1 and 65535');
371
649
  }
650
+ // We need the original public key in compressed format for the script
651
+ // Your class stores this in #originalPublicKey when a key is set
372
652
  this.ensureLegacyProcessed();
373
- if (!__classPrivateFieldGet(this, _Address_originalPublicKey, "f")) {
653
+ if (!this.#originalPublicKey) {
374
654
  throw new Error('Cannot create CSV address: public key not set');
375
655
  }
656
+ // Now we can use your TimeLockGenerator to create the timelocked address
657
+ // Converting bigint to number is safe here because we've already validated the range
376
658
  return TimeLockGenerator.generateTimeLockAddressP2TR(this.tweakedPublicKeyToBuffer(), network, n);
377
659
  }
660
+ /**
661
+ * Returns the OPNet address encoded in bech32m format, derived from the SHA256 hash of the ML-DSA public key
662
+ * (which is what the Address internally stores).
663
+ *
664
+ * This method generates a P2OP (Pay-to-OPNet) address using witness version 16, suitable for
665
+ * quantum-resistant transactions on the OPNet protocol.
666
+ *
667
+ * @param network - The Bitcoin network to use (mainnet, testnet, regtest)
668
+ * @returns The P2OP address in bech32m format
669
+ */
378
670
  p2op(network) {
379
- if (__classPrivateFieldGet(this, _Address_p2op, "f") && __classPrivateFieldGet(this, _Address_network, "f") === network) {
380
- return __classPrivateFieldGet(this, _Address_p2op, "f");
671
+ if (this.#p2op && this.#network === network) {
672
+ return this.#p2op;
381
673
  }
674
+ // p2op only uses the MLDSA hash (this Uint8Array), no legacy key processing needed.
675
+ // This is the HOT PATH for parsing - stays fast without triggering EC operations.
382
676
  const p2opAddy = EcKeyPair.p2op(this, network);
383
677
  if (p2opAddy) {
384
- __classPrivateFieldSet(this, _Address_network, network, "f");
385
- __classPrivateFieldSet(this, _Address_p2op, p2opAddy, "f");
678
+ this.#network = network;
679
+ this.#p2op = p2opAddy;
386
680
  return p2opAddy;
387
681
  }
388
682
  throw new Error('ML-DSA public key not set');
@@ -390,83 +684,107 @@ export class Address extends Uint8Array {
390
684
  toTweakedHybridPublicKeyHex() {
391
685
  this.ensureLegacyProcessed();
392
686
  this.ensureTweakedUncompressed();
393
- if (!__classPrivateFieldGet(this, _Address_tweakedUncompressed, "f")) {
687
+ if (!this.#tweakedUncompressed) {
394
688
  throw new Error('Legacy public key not set');
395
689
  }
396
- return '0x' + __classPrivateFieldGet(this, _Address_tweakedUncompressed, "f").toString('hex');
690
+ return '0x' + toHex(this.#tweakedUncompressed);
397
691
  }
398
692
  toTweakedHybridPublicKeyBuffer() {
399
693
  this.ensureLegacyProcessed();
400
694
  this.ensureTweakedUncompressed();
401
- if (!__classPrivateFieldGet(this, _Address_tweakedUncompressed, "f")) {
695
+ if (!this.#tweakedUncompressed) {
402
696
  throw new Error('Legacy public key not set');
403
697
  }
404
- return __classPrivateFieldGet(this, _Address_tweakedUncompressed, "f");
698
+ return this.#tweakedUncompressed;
405
699
  }
700
+ /**
701
+ * Lazily generates the tweaked uncompressed/hybrid key from the legacy public key.
702
+ * Only called when toTweakedHybridPublicKey* methods are accessed.
703
+ */
406
704
  ensureTweakedUncompressed() {
407
- if (__classPrivateFieldGet(this, _Address_tweakedUncompressed, "f"))
705
+ if (this.#tweakedUncompressed)
408
706
  return;
409
- const key = __classPrivateFieldGet(this, _Address_legacyPublicKey, "f");
707
+ const key = this.#tweakedPublicKey;
410
708
  if (!key)
411
709
  return;
412
- if (key.length === ADDRESS_BYTE_LENGTH && !__classPrivateFieldGet(this, _Address_originalPublicKey, "f")) {
710
+ // Only attempt hybrid key generation for 32-byte keys that weren't processed through autoFormat
711
+ if (key.length === ADDRESS_BYTE_LENGTH && !this.#originalPublicKey) {
413
712
  try {
414
- const buf = Buffer.alloc(ADDRESS_BYTE_LENGTH);
415
- buf.set(key);
416
- __classPrivateFieldSet(this, _Address_tweakedUncompressed, ContractAddress.generateHybridKeyFromHash(buf), "f");
713
+ this.#tweakedUncompressed = ContractAddress.generateHybridKeyFromHash(key);
417
714
  }
418
715
  catch {
716
+ // Hybrid key generation may fail for keys that aren't valid EC points
717
+ // (e.g., zero addresses). Leave #tweakedUncompressed undefined.
419
718
  }
420
719
  }
421
720
  }
721
+ /**
722
+ * Sets the MLDSA key portion of the address.
723
+ * @param {ArrayLike<number>} mldsaPublicKey - The MLDSA public key or its hash
724
+ */
422
725
  setMldsaKey(mldsaPublicKey) {
726
+ // THIS is the SHA256(ORIGINAL_ML_DSA_PUBLIC_KEY)
423
727
  if (mldsaPublicKey.length === ADDRESS_BYTE_LENGTH) {
424
728
  const buf = new Uint8Array(ADDRESS_BYTE_LENGTH);
425
729
  buf.set(mldsaPublicKey);
426
730
  super.set(buf);
427
731
  }
428
732
  else {
429
- const validMLDSALengths = [1312, 1952, 2592];
733
+ // Validate ML-DSA public key lengths according to BIP360 and FIPS 204
430
734
  if (!validMLDSALengths.includes(mldsaPublicKey.length)) {
431
735
  throw new Error(`Invalid ML-DSA public key length: ${mldsaPublicKey.length}. ` +
432
736
  `Expected 1312 (ML-DSA-44/LEVEL2), 1952 (ML-DSA-65/LEVEL3), or 2592 (ML-DSA-87/LEVEL5) bytes.`);
433
737
  }
434
- __classPrivateFieldSet(this, _Address_mldsaPublicKey, new Uint8Array(mldsaPublicKey.length), "f");
435
- __classPrivateFieldGet(this, _Address_mldsaPublicKey, "f").set(mldsaPublicKey);
738
+ // Store the original ML-DSA public key
739
+ this.#mldsaPublicKey = new Uint8Array(mldsaPublicKey.length);
740
+ this.#mldsaPublicKey.set(mldsaPublicKey);
741
+ // Hash the ML-DSA public key to get the 32-byte address
436
742
  const hashedPublicKey = sha256(new Uint8Array(mldsaPublicKey));
437
743
  const buf = new Uint8Array(ADDRESS_BYTE_LENGTH);
438
744
  buf.set(hashedPublicKey);
439
745
  super.set(buf);
440
746
  }
441
747
  }
748
+ /**
749
+ * Lazy processing of legacy key - defers expensive EC operations until actually needed.
750
+ * Does the EXACT same logic as the original set() method did for legacy keys.
751
+ */
442
752
  ensureLegacyProcessed() {
443
- if (__classPrivateFieldGet(this, _Address_legacyProcessed, "f"))
753
+ if (this.#legacyProcessed)
444
754
  return;
445
- __classPrivateFieldSet(this, _Address_legacyProcessed, true, "f");
446
- const pending = __classPrivateFieldGet(this, _Address_pendingLegacyKey, "f");
755
+ this.#legacyProcessed = true;
756
+ const pending = this.#pendingLegacyKey;
447
757
  if (!pending)
448
758
  return;
759
+ // Length validation already done in constructor
449
760
  if (pending.length === ADDRESS_BYTE_LENGTH) {
450
- __classPrivateFieldSet(this, _Address_legacyPublicKey, pending, "f");
761
+ this.#tweakedPublicKey = pending;
451
762
  }
452
763
  else {
764
+ // 33 or 65 bytes: full autoFormat processing with EC operations
453
765
  this.autoFormat(pending);
454
766
  }
455
767
  }
768
+ /**
769
+ * Processes a 33 or 65 byte public key, performing EC operations.
770
+ * Sets #tweakedPublicKey to 32-byte tweaked x-only (same as original behavior).
771
+ */
456
772
  autoFormat(publicKey) {
457
773
  const firstByte = publicKey[0];
458
774
  if (firstByte === 0x03 || firstByte === 0x02) {
775
+ // do nothing
459
776
  }
460
777
  else if (firstByte === 0x04 || firstByte === 0x06 || firstByte === 0x07) {
778
+ // uncompressed
461
779
  publicKey = Address.uncompressedToCompressed(publicKey);
462
780
  }
463
- __classPrivateFieldSet(this, _Address_originalPublicKey, Uint8Array.from(publicKey), "f");
464
- __classPrivateFieldSet(this, _Address_keyPair, EcKeyPair.fromPublicKey(__classPrivateFieldGet(this, _Address_originalPublicKey, "f")), "f");
465
- __classPrivateFieldSet(this, _Address_uncompressed, decompressPublicKey(__classPrivateFieldGet(this, _Address_originalPublicKey, "f")), "f");
466
- const tweakedBytes = toXOnly(EcKeyPair.tweakPublicKey(Buffer.from(__classPrivateFieldGet(this, _Address_originalPublicKey, "f"))));
467
- __classPrivateFieldSet(this, _Address_tweakedUncompressed, ContractAddress.generateHybridKeyFromHash(tweakedBytes), "f");
468
- __classPrivateFieldSet(this, _Address_legacyPublicKey, new Uint8Array(ADDRESS_BYTE_LENGTH), "f");
469
- __classPrivateFieldGet(this, _Address_legacyPublicKey, "f").set(tweakedBytes);
781
+ this.#originalPublicKey = Uint8Array.from(publicKey);
782
+ this.#keyPair = EcKeyPair.fromPublicKey(this.#originalPublicKey);
783
+ this.#uncompressed = decompressPublicKey(this.#originalPublicKey);
784
+ const tweakedBytes = toXOnly(EcKeyPair.tweakPublicKey(this.#originalPublicKey));
785
+ this.#tweakedUncompressed = ContractAddress.generateHybridKeyFromHash(tweakedBytes);
786
+ this.#tweakedPublicKey = new Uint8Array(ADDRESS_BYTE_LENGTH);
787
+ this.#tweakedPublicKey.set(tweakedBytes);
470
788
  }
471
789
  }
472
- _Address_p2tr = new WeakMap(), _Address_p2op = new WeakMap(), _Address_network = new WeakMap(), _Address_originalPublicKey = new WeakMap(), _Address_keyPair = new WeakMap(), _Address_uncompressed = new WeakMap(), _Address_tweakedUncompressed = new WeakMap(), _Address_p2wda = new WeakMap(), _Address_mldsaPublicKey = new WeakMap(), _Address_cachedBigInt = new WeakMap(), _Address_cachedBigIntTweaked = new WeakMap(), _Address_cachedUint64Array = new WeakMap(), _Address_originalMDLSAPublicKey = new WeakMap(), _Address_mldsaLevel = new WeakMap(), _Address_pendingLegacyKey = new WeakMap(), _Address_legacyProcessed = new WeakMap(), _Address_legacyPublicKey = new WeakMap();
790
+ //# sourceMappingURL=Address.js.map