@btc-vision/transaction 1.7.22 → 1.7.23

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 (86) hide show
  1. package/.babelrc +10 -1
  2. package/browser/_version.d.ts +1 -1
  3. package/browser/bip39.js +204 -0
  4. package/browser/bitcoin-utils.js +3172 -0
  5. package/browser/btc-vision-bip32.js +805 -0
  6. package/browser/btc-vision-bitcoin.js +4179 -0
  7. package/browser/btc-vision-logger.js +273 -0
  8. package/browser/btc-vision-post-quantum.js +542 -0
  9. package/browser/chain/ChainData.d.ts +1 -1
  10. package/browser/crypto/crypto.d.ts +1 -1
  11. package/browser/generators/AddressGenerator.d.ts +1 -1
  12. package/browser/generators/Generator.d.ts +1 -1
  13. package/browser/generators/MLDSAData.d.ts +1 -1
  14. package/browser/generators/builders/CalldataGenerator.d.ts +1 -1
  15. package/browser/generators/builders/CustomGenerator.d.ts +1 -1
  16. package/browser/generators/builders/DeploymentGenerator.d.ts +1 -1
  17. package/browser/generators/builders/HashCommitmentGenerator.d.ts +1 -1
  18. package/browser/generators/builders/LegacyCalldataGenerator.d.ts +1 -1
  19. package/browser/generators/builders/P2WDAGenerator.d.ts +1 -1
  20. package/browser/index.js +10775 -2
  21. package/browser/keypair/Address.d.ts +2 -2
  22. package/browser/keypair/AddressVerificator.d.ts +2 -2
  23. package/browser/keypair/EcKeyPair.d.ts +2 -2
  24. package/browser/keypair/MessageSigner.d.ts +2 -2
  25. package/browser/keypair/Wallet.d.ts +2 -2
  26. package/browser/metadata/ContractBaseMetadata.d.ts +1 -1
  27. package/browser/mnemonic/Mnemonic.d.ts +2 -2
  28. package/browser/noble-curves.js +3316 -0
  29. package/browser/noble-hashes.js +1608 -0
  30. package/browser/opnet.d.ts +10 -2
  31. package/browser/p2wda/P2WDADetector.d.ts +2 -2
  32. package/browser/polyfills.js +4590 -0
  33. package/browser/scure-base.js +410 -0
  34. package/browser/signer/AddressRotation.d.ts +1 -1
  35. package/browser/signer/SignerUtils.d.ts +1 -1
  36. package/browser/signer/TweakedSigner.d.ts +1 -1
  37. package/browser/transaction/TransactionFactory.d.ts +1 -1
  38. package/browser/transaction/browser/BrowserSignerBase.d.ts +1 -1
  39. package/browser/transaction/browser/Web3Provider.d.ts +1 -1
  40. package/browser/transaction/browser/extensions/UnisatSigner.d.ts +1 -1
  41. package/browser/transaction/browser/extensions/XverseSigner.d.ts +1 -1
  42. package/browser/transaction/builders/CancelTransaction.d.ts +1 -1
  43. package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +4 -4
  44. package/browser/transaction/builders/CustomScriptTransaction.d.ts +1 -1
  45. package/browser/transaction/builders/DeploymentTransaction.d.ts +1 -1
  46. package/browser/transaction/builders/FundingTransaction.d.ts +1 -1
  47. package/browser/transaction/builders/InteractionTransaction.d.ts +1 -1
  48. package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +2 -2
  49. package/browser/transaction/builders/MultiSignTransaction.d.ts +1 -1
  50. package/browser/transaction/builders/SharedInteractionTransaction.d.ts +1 -1
  51. package/browser/transaction/builders/TransactionBuilder.d.ts +1 -1
  52. package/browser/transaction/interfaces/ITransactionParameters.d.ts +1 -1
  53. package/browser/transaction/interfaces/Tap.d.ts +1 -1
  54. package/browser/transaction/mineable/TimelockGenerator.d.ts +1 -1
  55. package/browser/transaction/offline/OfflineTransactionManager.d.ts +1 -1
  56. package/browser/transaction/offline/TransactionReconstructor.d.ts +2 -2
  57. package/browser/transaction/processor/PsbtTransaction.d.ts +1 -1
  58. package/browser/transaction/shared/P2TR_MS.d.ts +1 -1
  59. package/browser/transaction/shared/TweakedTransaction.d.ts +3 -3
  60. package/browser/utxo/OPNetLimitedProvider.d.ts +1 -1
  61. package/browser/valibot.js +4948 -0
  62. package/browser/vendors.js +12913 -0
  63. package/browser/verification/TapscriptVerificator.d.ts +1 -1
  64. package/build/_version.d.ts +1 -1
  65. package/build/_version.js +1 -1
  66. package/build/opnet.d.ts +9 -1
  67. package/build/opnet.js +6 -1
  68. package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +3 -3
  69. package/build/transaction/builders/ConsolidatedInteractionTransaction.js +16 -16
  70. package/package.json +61 -3
  71. package/src/_version.ts +1 -1
  72. package/src/opnet.ts +9 -1
  73. package/src/transaction/TransactionFactory.ts +1 -4
  74. package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +40 -47
  75. package/vite.config.browser.ts +92 -0
  76. package/webpack.config.js +143 -2
  77. package/browser/crypto/crypto-browser.d.ts +0 -11
  78. package/browser/index.js.LICENSE.txt +0 -29
  79. package/browser/transaction/offline/index.d.ts +0 -5
  80. package/browser/transaction/offline/interfaces/index.d.ts +0 -2
  81. package/build/transaction/offline/index.d.ts +0 -5
  82. package/build/transaction/offline/index.js +0 -5
  83. package/build/transaction/offline/interfaces/index.d.ts +0 -2
  84. package/build/transaction/offline/interfaces/index.js +0 -2
  85. package/src/transaction/offline/index.ts +0 -8
  86. package/src/transaction/offline/interfaces/index.ts +0 -2
package/webpack.config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import webpack from 'webpack';
2
+ import TerserPlugin from 'terser-webpack-plugin';
2
3
 
3
4
  export default {
4
5
  mode: 'production',
@@ -10,9 +11,12 @@ export default {
10
11
  },
11
12
  watch: false,
12
13
  output: {
13
- filename: 'index.js',
14
+ filename: '[name].js',
15
+ chunkFilename: 'chunks/[name].js',
14
16
  path: import.meta.dirname + '/browser',
15
17
  libraryTarget: 'module',
18
+ chunkFormat: 'module',
19
+ chunkLoading: 'import',
16
20
  },
17
21
  node: {
18
22
  __dirname: false,
@@ -28,9 +32,12 @@ export default {
28
32
  },
29
33
  modules: ['.', 'node_modules'],
30
34
  extensions: ['.*', '.js', '.jsx', '.tsx', '.ts', '.wasm'],
35
+ alias: {
36
+ // Dedupe noble/curves to single version
37
+ '@noble/curves': import.meta.dirname + '/node_modules/@noble/curves',
38
+ },
31
39
  fallback: {
32
40
  buffer: import.meta.resolve('buffer/'),
33
-
34
41
  assert: import.meta.resolve('assert/'),
35
42
  crypto: import.meta.resolve('./src/crypto/crypto-browser.js'),
36
43
  http: import.meta.resolve('stream-http/'),
@@ -66,6 +73,132 @@ export default {
66
73
  },
67
74
  optimization: {
68
75
  usedExports: true,
76
+ minimize: true,
77
+ minimizer: [
78
+ new TerserPlugin({
79
+ terserOptions: {
80
+ compress: {
81
+ drop_console: false,
82
+ drop_debugger: true,
83
+ passes: 3,
84
+ pure_funcs: ['console.debug'],
85
+ dead_code: true,
86
+ unused: true,
87
+ },
88
+ mangle: {
89
+ safari10: true,
90
+ },
91
+ format: {
92
+ comments: false,
93
+ },
94
+ },
95
+ extractComments: false,
96
+ }),
97
+ ],
98
+ concatenateModules: true,
99
+ sideEffects: true,
100
+ providedExports: true,
101
+ innerGraph: true,
102
+ splitChunks: {
103
+ chunks: 'all',
104
+ minSize: 1000,
105
+ maxInitialRequests: Infinity,
106
+ cacheGroups: {
107
+ // Noble cryptographic libraries (curves + hashes)
108
+ nobleCurves: {
109
+ test: /[\\/]node_modules[\\/]@noble[\\/]curves[\\/]/,
110
+ name: 'noble-curves',
111
+ priority: 50,
112
+ reuseExistingChunk: true,
113
+ },
114
+ nobleHashes: {
115
+ test: /[\\/]node_modules[\\/]@noble[\\/]hashes[\\/]/,
116
+ name: 'noble-hashes',
117
+ priority: 49,
118
+ reuseExistingChunk: true,
119
+ },
120
+ nobleSecp: {
121
+ test: /[\\/]node_modules[\\/]@noble[\\/]secp256k1[\\/]/,
122
+ name: 'noble-secp256k1',
123
+ priority: 48,
124
+ reuseExistingChunk: true,
125
+ },
126
+ // Separate @btc-vision packages
127
+ btcBitcoin: {
128
+ test: /[\\/]node_modules[\\/]@btc-vision[\\/]bitcoin[\\/]/,
129
+ name: 'btc-vision-bitcoin',
130
+ priority: 45,
131
+ reuseExistingChunk: true,
132
+ },
133
+ btcBip32: {
134
+ test: /[\\/]node_modules[\\/]@btc-vision[\\/]bip32[\\/]/,
135
+ name: 'btc-vision-bip32',
136
+ priority: 44,
137
+ reuseExistingChunk: true,
138
+ },
139
+ btcPostQuantum: {
140
+ test: /[\\/]node_modules[\\/]@btc-vision[\\/]post-quantum[\\/]/,
141
+ name: 'btc-vision-post-quantum',
142
+ priority: 43,
143
+ reuseExistingChunk: true,
144
+ },
145
+ btcLogger: {
146
+ test: /[\\/]node_modules[\\/]@btc-vision[\\/]logger[\\/]/,
147
+ name: 'btc-vision-logger',
148
+ priority: 42,
149
+ reuseExistingChunk: true,
150
+ },
151
+ // Valibot validation library
152
+ valibot: {
153
+ test: /[\\/]node_modules[\\/]valibot[\\/]/,
154
+ name: 'valibot',
155
+ priority: 40,
156
+ reuseExistingChunk: true,
157
+ },
158
+ // Pako compression
159
+ pako: {
160
+ test: /[\\/]node_modules[\\/]pako[\\/]/,
161
+ name: 'pako',
162
+ priority: 39,
163
+ reuseExistingChunk: true,
164
+ },
165
+ // BIP39 mnemonic (wordlists are stripped via IgnorePlugin)
166
+ bip39: {
167
+ test: /[\\/]node_modules[\\/]bip39[\\/]/,
168
+ name: 'bip39',
169
+ priority: 38,
170
+ reuseExistingChunk: true,
171
+ },
172
+ // Bitcoin utilities
173
+ bitcoin: {
174
+ test: /[\\/]node_modules[\\/](bip174|bech32|ecpair|@bitcoinerlab)[\\/]/,
175
+ name: 'bitcoin-utils',
176
+ priority: 35,
177
+ reuseExistingChunk: true,
178
+ },
179
+ // Scure base encoding
180
+ scure: {
181
+ test: /[\\/]node_modules[\\/]@scure[\\/]/,
182
+ name: 'scure-base',
183
+ priority: 34,
184
+ reuseExistingChunk: true,
185
+ },
186
+ // Buffer and stream polyfills
187
+ polyfills: {
188
+ test: /[\\/]node_modules[\\/](buffer|stream-browserify|browserify-zlib|process|assert|os-browserify|https-browserify|stream-http)[\\/]/,
189
+ name: 'polyfills',
190
+ priority: 25,
191
+ reuseExistingChunk: true,
192
+ },
193
+ // Remaining vendor code
194
+ vendors: {
195
+ test: /[\\/]node_modules[\\/]/,
196
+ name: 'vendors',
197
+ priority: 10,
198
+ reuseExistingChunk: true,
199
+ },
200
+ },
201
+ },
69
202
  },
70
203
  plugins: [
71
204
  new webpack.ProvidePlugin({
@@ -75,5 +208,13 @@ export default {
75
208
  zlib: 'browserify-zlib',
76
209
  bitcoin: '@btc-vision/bitcoin',
77
210
  }),
211
+ // Strip unused bip39 wordlists (keep only English) - saves ~150KB
212
+ new webpack.IgnorePlugin({
213
+ resourceRegExp: /^\.\/wordlists\/(?!english)/,
214
+ contextRegExp: /bip39/,
215
+ }),
78
216
  ],
217
+ // Externals config for dependent packages to avoid duplication
218
+ // Other packages can set these externals and import chunks from @btc-vision/transaction
219
+ externalsType: 'module',
79
220
  };
@@ -1,11 +0,0 @@
1
- export function createHash(algo: any): import("@noble/hashes/utils").Hash<import("@noble/hashes/utils").Hash<any>> | undefined;
2
- export function createHmac(_algo: any, key: any): import("@noble/hashes/hmac").HMAC<any>;
3
- export function pbkdf2Sync(password: any, salt: any, iterations: any, keylen: any, _algo: any): Uint8Array<ArrayBufferLike>;
4
- export function randomBytes(length: any): Uint8Array<any>;
5
- declare namespace _default {
6
- export { createHash };
7
- export { createHmac };
8
- export { pbkdf2Sync };
9
- export { randomBytes };
10
- }
11
- export default _default;
@@ -1,29 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*!
9
- * The buffer module from node.js, for the browser.
10
- *
11
- * @author Feross Aboukhadijeh <https://feross.org>
12
- * @license MIT
13
- */
14
-
15
- /*! For license information please see index.js.LICENSE.txt */
16
-
17
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
18
-
19
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
20
-
21
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
22
-
23
- /*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
24
-
25
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
26
-
27
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
28
-
29
- /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -1,5 +0,0 @@
1
- export * from './interfaces/index.js';
2
- export { TransactionSerializer } from './TransactionSerializer.js';
3
- export { TransactionStateCapture, CaptureParams } from './TransactionStateCapture.js';
4
- export { TransactionReconstructor, ReconstructionOptions } from './TransactionReconstructor.js';
5
- export { OfflineTransactionManager, ExportOptions } from './OfflineTransactionManager.js';
@@ -1,2 +0,0 @@
1
- export * from './ISerializableState.js';
2
- export * from './ITypeSpecificData.js';
@@ -1,5 +0,0 @@
1
- export * from './interfaces/index.js';
2
- export { TransactionSerializer } from './TransactionSerializer.js';
3
- export { TransactionStateCapture, CaptureParams } from './TransactionStateCapture.js';
4
- export { TransactionReconstructor, ReconstructionOptions } from './TransactionReconstructor.js';
5
- export { OfflineTransactionManager, ExportOptions } from './OfflineTransactionManager.js';
@@ -1,5 +0,0 @@
1
- export * from './interfaces/index.js';
2
- export { TransactionSerializer } from './TransactionSerializer.js';
3
- export { TransactionStateCapture } from './TransactionStateCapture.js';
4
- export { TransactionReconstructor } from './TransactionReconstructor.js';
5
- export { OfflineTransactionManager } from './OfflineTransactionManager.js';
@@ -1,2 +0,0 @@
1
- export * from './ISerializableState.js';
2
- export * from './ITypeSpecificData.js';
@@ -1,2 +0,0 @@
1
- export * from './ISerializableState.js';
2
- export * from './ITypeSpecificData.js';
@@ -1,8 +0,0 @@
1
- // Interfaces
2
- export * from './interfaces/index.js';
3
-
4
- // Core classes
5
- export { TransactionSerializer } from './TransactionSerializer.js';
6
- export { TransactionStateCapture, CaptureParams } from './TransactionStateCapture.js';
7
- export { TransactionReconstructor, ReconstructionOptions } from './TransactionReconstructor.js';
8
- export { OfflineTransactionManager, ExportOptions } from './OfflineTransactionManager.js';
@@ -1,2 +0,0 @@
1
- export * from './ISerializableState.js';
2
- export * from './ITypeSpecificData.js';