@btc-vision/bitcoin 6.4.11 → 6.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PsbtInput as _PsbtInput, PsbtInputUpdate as _PsbtInputUpdate, PsbtOutput as _PsbtOutput, TapBip32Derivation as _TapBip32Derivation, TapInternalKey as _TapInternalKey, TapKeySig as _TapKeySig, TapLeaf as _TapLeaf, TapLeafScript as _TapLeafScript, TapMerkleRoot as _TapMerkleRoot, TapScriptSig as _TapScriptSig, TapTree as _TapTree } from 'bip174/src/lib/interfaces.js';
1
+ export type { PsbtInput, PsbtInputUpdate, PsbtOutput, TapBip32Derivation, TapInternalKey, TapKeySig, TapLeaf, TapLeafScript, TapMerkleRoot, TapScriptSig, TapTree, } from 'bip174/src/lib/interfaces.js';
2
2
  import * as networks from './networks.js';
3
3
  import * as address from './address.js';
4
4
  import * as payments from './payments/index.js';
@@ -15,38 +15,18 @@ export * from './crypto.js';
15
15
  export * from './psbt.js';
16
16
  export { opcodes } from './opcodes.js';
17
17
  export { Transaction } from './transaction.js';
18
- export { Network } from './networks.js';
18
+ export type { Network } from './networks.js';
19
19
  export { initEccLib } from './ecc_lib.js';
20
- export { Payment, PaymentCreator, PaymentOpts, Stack, StackElement, P2WSHPayment, P2PKPayment, BasePayment, P2SHPayment, P2TRPayment, P2WPKHPayment, P2PKHPayment, P2MSPayment, EmbedPayment, P2OPPayment, P2OPPaymentParams, StackFunction, PaymentType, } from './payments/index.js';
21
- export { Input as TxInput, Output as TxOutput } from './transaction.js';
22
- export interface PsbtInput extends _PsbtInput {
23
- }
24
- export interface PsbtOutput extends _PsbtOutput {
25
- }
26
- export interface TapInternalKey extends _TapInternalKey {
27
- }
28
- export interface TapLeaf extends _TapLeaf {
29
- }
30
- export interface TapScriptSig extends _TapScriptSig {
31
- }
32
- export interface TapKeySig extends _TapKeySig {
33
- }
34
- export interface TapTree extends _TapTree {
35
- }
36
- export interface TapMerkleRoot extends _TapMerkleRoot {
37
- }
38
- export interface TapLeafScript extends _TapLeafScript {
39
- }
40
- export interface TapBip32Derivation extends _TapBip32Derivation {
41
- }
42
- export interface PsbtInputUpdate extends _PsbtInputUpdate {
43
- }
20
+ export { PaymentType } from './payments/index.js';
21
+ export type { Payment, PaymentCreator, PaymentOpts, Stack, StackElement, P2WSHPayment, P2PKPayment, BasePayment, P2SHPayment, P2TRPayment, P2WPKHPayment, P2PKHPayment, P2MSPayment, EmbedPayment, P2OPPayment, P2OPPaymentParams, StackFunction, } from './payments/index.js';
22
+ export type { Input as TxInput, Output as TxOutput } from './transaction.js';
44
23
  export * from './psbt/bip371.js';
45
24
  export * from './address.js';
46
25
  export * from './bufferutils.js';
47
26
  export * from './payments/bip341.js';
48
27
  export * from './psbt/psbtutils.js';
49
- export { Taptree, XOnlyPointAddTweakResult, Tapleaf, TinySecp256k1Interface, TAPLEAF_VERSION_MASK, } from './types.js';
28
+ export { TAPLEAF_VERSION_MASK } from './types.js';
29
+ export type { Taptree, XOnlyPointAddTweakResult, Tapleaf, TinySecp256k1Interface, } from './types.js';
50
30
  declare const bitcoin: {
51
31
  networks: typeof networks;
52
32
  address: typeof address;
package/build/index.js CHANGED
@@ -15,13 +15,13 @@ export * from './psbt.js';
15
15
  export { opcodes } from './opcodes.js';
16
16
  export { Transaction } from './transaction.js';
17
17
  export { initEccLib } from './ecc_lib.js';
18
- export { PaymentType, } from './payments/index.js';
18
+ export { PaymentType } from './payments/index.js';
19
19
  export * from './psbt/bip371.js';
20
20
  export * from './address.js';
21
21
  export * from './bufferutils.js';
22
22
  export * from './payments/bip341.js';
23
23
  export * from './psbt/psbtutils.js';
24
- export { TAPLEAF_VERSION_MASK, } from './types.js';
24
+ export { TAPLEAF_VERSION_MASK } from './types.js';
25
25
  const bitcoin = {
26
26
  networks,
27
27
  address,
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@btc-vision/bitcoin",
3
3
  "type": "module",
4
- "version": "6.4.11",
4
+ "version": "6.5.1",
5
5
  "description": "Client-side Bitcoin JavaScript library",
6
6
  "engines": {
7
7
  "node": ">=16.0.0"
8
8
  },
9
9
  "exports": {
10
10
  ".": {
11
+ "types": "./build/index.d.ts",
11
12
  "browser": "./browser/index.js",
12
13
  "import": "./build/index.js",
13
- "require": "./build/index.js",
14
- "types": "./build/index.d.ts"
14
+ "require": "./build/index.js"
15
15
  },
16
16
  "./browser": {
17
+ "types": "./browser/index.d.ts",
17
18
  "import": "./browser/index.js",
18
- "require": "./browser/index.js",
19
- "types": "./browser/index.d.ts"
19
+ "require": "./browser/index.js"
20
20
  }
21
21
  },
22
22
  "browser": {
@@ -51,7 +51,7 @@
51
51
  "watch": "gulp watch",
52
52
  "build": "gulp build",
53
53
  "setup": "npm i && npm run build",
54
- "browserBuild": "webpack --mode production",
54
+ "browserBuild": "vite build --config vite.config.browser.ts",
55
55
  "audit": "better-npm-audit audit -l high",
56
56
  "build:tests": "npm run clean:jstests && tsc -p ./test/tsconfig.json",
57
57
  "clean": "rimraf build",
@@ -97,7 +97,7 @@
97
97
  "bs58": "^6.0.0",
98
98
  "dhttp": "^3.0.3",
99
99
  "ecpair": "^2.0.1",
100
- "eslint": "9.38.0",
100
+ "eslint": "^9.39.1",
101
101
  "gulp": "^5.0.0",
102
102
  "gulp-cached": "^1.1.1",
103
103
  "gulp-typescript": "^6.0.0-alpha.1",
@@ -120,13 +120,16 @@
120
120
  "typedoc": "^0.28.5",
121
121
  "typescript": "^5.8.3",
122
122
  "typescript-eslint": "^8.32.1",
123
+ "vite": "^7.3.0",
124
+ "vite-plugin-dts": "^4.5.4",
125
+ "vite-plugin-node-polyfills": "^0.24.0",
123
126
  "webpack": "^5.99.9",
124
127
  "webpack-cli": "^6.0.1"
125
128
  },
126
129
  "dependencies": {
127
130
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
128
131
  "@btc-vision/logger": "^1.0.7",
129
- "@eslint/js": "9.38.0",
132
+ "@eslint/js": "^9.39.1",
130
133
  "@noble/hashes": "^1.8.0",
131
134
  "@noble/secp256k1": "^2.2.3",
132
135
  "assert": "^2.1.0",
@@ -134,9 +137,9 @@
134
137
  "babel-plugin-transform-import-meta": "^2.3.2",
135
138
  "babel-preset-react": "^6.24.1",
136
139
  "babelify": "^10.0.0",
137
- "bip32": "^4.0.0",
138
140
  "bech32": "^2.0.0",
139
141
  "bip174": "^2.1.1",
142
+ "bip32": "^4.0.0",
140
143
  "browserify-zlib": "^0.2.0",
141
144
  "bs58check": "^4.0.0",
142
145
  "buffer": "^6.0.3",
package/src/index.ts CHANGED
@@ -1,15 +1,15 @@
1
- import {
2
- PsbtInput as _PsbtInput,
3
- PsbtInputUpdate as _PsbtInputUpdate,
4
- PsbtOutput as _PsbtOutput,
5
- TapBip32Derivation as _TapBip32Derivation,
6
- TapInternalKey as _TapInternalKey,
7
- TapKeySig as _TapKeySig,
8
- TapLeaf as _TapLeaf,
9
- TapLeafScript as _TapLeafScript,
10
- TapMerkleRoot as _TapMerkleRoot,
11
- TapScriptSig as _TapScriptSig,
12
- TapTree as _TapTree,
1
+ export type {
2
+ PsbtInput,
3
+ PsbtInputUpdate,
4
+ PsbtOutput,
5
+ TapBip32Derivation,
6
+ TapInternalKey,
7
+ TapKeySig,
8
+ TapLeaf,
9
+ TapLeafScript,
10
+ TapMerkleRoot,
11
+ TapScriptSig,
12
+ TapTree,
13
13
  } from 'bip174/src/lib/interfaces.js';
14
14
  import * as networks from './networks.js';
15
15
  import * as address from './address.js';
@@ -32,10 +32,11 @@ export * from './psbt.js';
32
32
  export { opcodes } from './opcodes.js';
33
33
  export { Transaction } from './transaction.js';
34
34
  /** @hidden */
35
- export { Network } from './networks.js';
35
+ export type { Network } from './networks.js';
36
36
  /** @hidden */
37
37
  export { initEccLib } from './ecc_lib.js';
38
- export {
38
+ export { PaymentType } from './payments/index.js';
39
+ export type {
39
40
  Payment,
40
41
  PaymentCreator,
41
42
  PaymentOpts,
@@ -53,31 +54,8 @@ export {
53
54
  P2OPPayment,
54
55
  P2OPPaymentParams,
55
56
  StackFunction,
56
- PaymentType,
57
57
  } from './payments/index.js';
58
- export { Input as TxInput, Output as TxOutput } from './transaction.js';
59
-
60
- export interface PsbtInput extends _PsbtInput {}
61
-
62
- export interface PsbtOutput extends _PsbtOutput {}
63
-
64
- export interface TapInternalKey extends _TapInternalKey {}
65
-
66
- export interface TapLeaf extends _TapLeaf {}
67
-
68
- export interface TapScriptSig extends _TapScriptSig {}
69
-
70
- export interface TapKeySig extends _TapKeySig {}
71
-
72
- export interface TapTree extends _TapTree {}
73
-
74
- export interface TapMerkleRoot extends _TapMerkleRoot {}
75
-
76
- export interface TapLeafScript extends _TapLeafScript {}
77
-
78
- export interface TapBip32Derivation extends _TapBip32Derivation {}
79
-
80
- export interface PsbtInputUpdate extends _PsbtInputUpdate {}
58
+ export type { Input as TxInput, Output as TxOutput } from './transaction.js';
81
59
 
82
60
  export * from './psbt/bip371.js';
83
61
  export * from './address.js';
@@ -85,12 +63,12 @@ export * from './bufferutils.js';
85
63
  export * from './payments/bip341.js';
86
64
  export * from './psbt/psbtutils.js';
87
65
 
88
- export {
66
+ export { TAPLEAF_VERSION_MASK } from './types.js';
67
+ export type {
89
68
  Taptree,
90
69
  XOnlyPointAddTweakResult,
91
70
  Tapleaf,
92
71
  TinySecp256k1Interface,
93
- TAPLEAF_VERSION_MASK,
94
72
  } from './types.js';
95
73
 
96
74
  const bitcoin = {
@@ -0,0 +1,93 @@
1
+ import { resolve } from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import { nodePolyfills } from 'vite-plugin-node-polyfills';
4
+ import dts from 'vite-plugin-dts';
5
+
6
+ export default defineConfig({
7
+ build: {
8
+ outDir: 'browser',
9
+ emptyOutDir: true,
10
+ target: 'esnext',
11
+ minify: 'esbuild',
12
+ lib: {
13
+ entry: resolve(__dirname, 'src/index.ts'),
14
+ formats: ['es'],
15
+ fileName: () => 'index.js',
16
+ },
17
+ rollupOptions: {
18
+ output: {
19
+ chunkFileNames: 'chunks/[name]-[hash].js',
20
+ manualChunks: {
21
+ 'crypto': [
22
+ 'src/crypto.ts',
23
+ 'src/crypto/crypto.ts',
24
+ ],
25
+ 'psbt': [
26
+ 'src/psbt.ts',
27
+ 'src/psbt/bip371.ts',
28
+ 'src/psbt/psbtutils.ts',
29
+ ],
30
+ 'payments': [
31
+ 'src/payments/index.ts',
32
+ 'src/payments/p2pkh.ts',
33
+ 'src/payments/p2pk.ts',
34
+ 'src/payments/p2ms.ts',
35
+ 'src/payments/p2sh.ts',
36
+ 'src/payments/p2wpkh.ts',
37
+ 'src/payments/p2wsh.ts',
38
+ 'src/payments/p2tr.ts',
39
+ 'src/payments/p2op.ts',
40
+ 'src/payments/embed.ts',
41
+ 'src/payments/bip341.ts',
42
+ 'src/payments/lazy.ts',
43
+ ],
44
+ 'transaction': [
45
+ 'src/transaction.ts',
46
+ 'src/block.ts',
47
+ ],
48
+ 'script': [
49
+ 'src/script.ts',
50
+ 'src/script_number.ts',
51
+ 'src/script_signature.ts',
52
+ 'src/opcodes.ts',
53
+ ],
54
+ 'utils': [
55
+ 'src/bufferutils.ts',
56
+ 'src/push_data.ts',
57
+ 'src/bip66.ts',
58
+ 'src/merkle.ts',
59
+ 'src/types.ts',
60
+ ],
61
+ },
62
+ },
63
+ },
64
+ },
65
+ resolve: {
66
+ alias: {
67
+ crypto: resolve(__dirname, 'src/crypto/crypto-browser.js'),
68
+ stream: 'stream-browserify',
69
+ buffer: 'buffer',
70
+ zlib: 'browserify-zlib',
71
+ },
72
+ },
73
+ define: {
74
+ 'process.env.NODE_ENV': JSON.stringify('production'),
75
+ global: 'globalThis',
76
+ },
77
+ plugins: [
78
+ nodePolyfills({
79
+ globals: {
80
+ Buffer: true,
81
+ global: true,
82
+ process: true,
83
+ },
84
+ }),
85
+ dts({
86
+ outDir: 'browser',
87
+ include: ['src/**/*.ts'],
88
+ exclude: ['src/**/*.test.ts', 'src/**/*.spec.ts', 'test/**/*'],
89
+ insertTypesEntry: true,
90
+ copyDtsFiles: true,
91
+ }),
92
+ ],
93
+ });
@@ -1,14 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
-
10
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
11
-
12
- /*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
13
-
14
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */