@btc-vision/bitcoin 6.5.1 → 6.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/chunks/crypto-0PweVewC.js +2033 -0
- package/browser/chunks/{payments-BE4vwHhV.js → payments-CgasufRS.js} +410 -408
- package/browser/chunks/psbt-BIwOrKer.js +4096 -0
- package/browser/chunks/{script-COWGdiOo.js → script-CROJPzz_.js} +96 -96
- package/browser/chunks/{transaction-BiXwH2v4.js → transaction-DchBu35N.js} +158 -147
- package/browser/chunks/{utils-BKmkTzNZ.js → utils-CO5kmxe9.js} +225 -223
- package/browser/crypto.d.ts +1 -1
- package/browser/hooks/HookedSigner.d.ts +1 -1
- package/browser/index.d.ts +23 -1
- package/browser/index.js +6 -6
- package/browser/payments/index.d.ts +2 -2
- package/browser/payments/lazy.d.ts +1 -1
- package/browser/psbt/bip371.d.ts +5 -1
- package/browser/psbt.d.ts +1 -1
- package/browser/typeforce.d.ts +38 -0
- package/browser/types.d.ts +22 -20
- package/build/address.js +2 -2
- package/build/bip66.js +2 -2
- package/build/block.js +2 -2
- package/build/crypto.d.ts +1 -1
- package/build/crypto.js +2 -3
- package/build/hooks/HookedSigner.d.ts +1 -1
- package/build/index.d.ts +23 -1
- package/build/payments/bip341.js +1 -1
- package/build/payments/index.d.ts +2 -2
- package/build/payments/lazy.d.ts +1 -1
- package/build/payments/p2op.js +3 -3
- package/build/payments/p2pk.js +1 -1
- package/build/payments/p2pkh.js +3 -3
- package/build/payments/p2sh.js +3 -3
- package/build/payments/p2tr.js +9 -5
- package/build/payments/p2wpkh.js +3 -3
- package/build/payments/p2wsh.js +2 -2
- package/build/psbt/bip371.d.ts +5 -1
- package/build/psbt/bip371.js +10 -7
- package/build/psbt/psbtutils.js +5 -4
- package/build/psbt.d.ts +1 -1
- package/build/psbt.js +78 -45
- package/build/script.js +2 -2
- package/build/script_signature.js +7 -7
- package/build/transaction.js +22 -10
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/types.d.ts +22 -20
- package/build/types.js +10 -9
- package/package.json +32 -57
- package/src/address.ts +2 -2
- package/src/bip66.ts +2 -2
- package/src/block.ts +8 -5
- package/src/crypto.ts +3 -4
- package/src/ecc_lib.ts +1 -1
- package/src/hooks/HookedSigner.ts +1 -1
- package/src/index.ts +34 -12
- package/src/payments/bip341.ts +1 -1
- package/src/payments/embed.ts +1 -2
- package/src/payments/index.ts +4 -4
- package/src/payments/lazy.ts +3 -3
- package/src/payments/p2op.ts +4 -3
- package/src/payments/p2pk.ts +1 -1
- package/src/payments/p2pkh.ts +3 -3
- package/src/payments/p2sh.ts +13 -5
- package/src/payments/p2tr.ts +8 -9
- package/src/payments/p2wpkh.ts +3 -3
- package/src/payments/p2wsh.ts +4 -4
- package/src/psbt/bip371.ts +22 -13
- package/src/psbt/psbtutils.ts +8 -5
- package/src/psbt.ts +127 -80
- package/src/script.ts +4 -4
- package/src/script_signature.ts +7 -7
- package/src/transaction.ts +31 -18
- package/src/typeforce.d.ts +38 -0
- package/src/types.ts +34 -29
- package/test/address.spec.ts +12 -4
- package/test/bitcoin.core.spec.ts +1 -1
- package/test/block.spec.ts +1 -1
- package/test/bufferutils.spec.ts +1 -1
- package/test/crypto.spec.ts +3 -2
- package/test/fixtures/address.json +1 -1
- package/test/integration/addresses.spec.ts +1 -1
- package/test/integration/bip32.spec.ts +2 -2
- package/test/integration/blocks.spec.ts +1 -1
- package/test/integration/cltv.spec.ts +3 -3
- package/test/integration/csv.spec.ts +3 -3
- package/test/integration/payments.spec.ts +1 -1
- package/test/integration/taproot.spec.ts +8 -7
- package/test/integration/transactions.spec.ts +2 -2
- package/test/payments.spec.ts +4 -3
- package/test/psbt.spec.ts +106 -74
- package/test/script.spec.ts +73 -7
- package/test/script_number.spec.ts +1 -1
- package/test/script_signature.spec.ts +1 -1
- package/test/transaction.spec.ts +1 -1
- package/test/tsconfig.json +1 -1
- package/test/types.spec.ts +1 -1
- package/vitest.config.ts +16 -0
- package/.babelrc +0 -13
- package/.mocharc.json +0 -13
- package/browser/chunks/crypto-C6FlKKmp.js +0 -2006
- package/browser/chunks/psbt-Dlosf9CT.js +0 -3853
- package/cjs/package.json +0 -3
- package/gulpfile.js +0 -42
- package/src/crypto/crypto-browser.js +0 -75
- package/test/ts-node-register.js +0 -7
- package/webpack.config.js +0 -79
package/cjs/package.json
DELETED
package/gulpfile.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import gulp from 'gulp';
|
|
2
|
-
import gulpcache from 'gulp-cached';
|
|
3
|
-
import gulpESLintNew from 'gulp-eslint-new';
|
|
4
|
-
|
|
5
|
-
import gulpClean from 'gulp-clean';
|
|
6
|
-
import logger from 'gulp-logger-new';
|
|
7
|
-
import ts from 'gulp-typescript';
|
|
8
|
-
|
|
9
|
-
process.on('uncaughtException', function (err) {
|
|
10
|
-
console.log('Caught exception: ', err);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const tsProject = ts.createProject('tsconfig.json');
|
|
14
|
-
|
|
15
|
-
function buildESM() {
|
|
16
|
-
return tsProject
|
|
17
|
-
.src()
|
|
18
|
-
.pipe(gulpcache('ts-esm'))
|
|
19
|
-
.pipe(
|
|
20
|
-
logger({
|
|
21
|
-
before: 'Starting...',
|
|
22
|
-
after: 'Project compiled!',
|
|
23
|
-
extname: '.js',
|
|
24
|
-
showChange: true,
|
|
25
|
-
}),
|
|
26
|
-
)
|
|
27
|
-
.pipe(gulpESLintNew())
|
|
28
|
-
.pipe(gulpESLintNew.format())
|
|
29
|
-
.pipe(tsProject())
|
|
30
|
-
.pipe(gulp.dest('build'));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function clean() {
|
|
34
|
-
return gulp.src('./build/src', { read: false }).pipe(gulpClean());
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const build = buildESM;
|
|
38
|
-
export default build;
|
|
39
|
-
|
|
40
|
-
export function watch() {
|
|
41
|
-
gulp.watch(['src/**/*.ts', 'src/**/*.js'], gulp.series(buildESM));
|
|
42
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/* Browser Crypto Shims */
|
|
2
|
-
import { hmac } from '@noble/hashes/hmac';
|
|
3
|
-
import { pbkdf2 } from '@noble/hashes/pbkdf2';
|
|
4
|
-
import { sha256 } from '@noble/hashes/sha256';
|
|
5
|
-
import { sha512 } from '@noble/hashes/sha512';
|
|
6
|
-
import assert from 'assert';
|
|
7
|
-
|
|
8
|
-
function assertArgument(check, message, name, value) {
|
|
9
|
-
assert(check, message, 'INVALID_ARGUMENT', { argument: name, value: value });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function getGlobal() {
|
|
13
|
-
if (typeof self !== 'undefined') {
|
|
14
|
-
return self;
|
|
15
|
-
}
|
|
16
|
-
if (typeof window !== 'undefined') {
|
|
17
|
-
return window;
|
|
18
|
-
}
|
|
19
|
-
if (typeof global !== 'undefined') {
|
|
20
|
-
return global;
|
|
21
|
-
}
|
|
22
|
-
throw new Error('unable to locate global object');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const anyGlobal = getGlobal();
|
|
26
|
-
const crypto = anyGlobal.crypto || anyGlobal.msCrypto;
|
|
27
|
-
|
|
28
|
-
export function createHash(algo) {
|
|
29
|
-
switch (algo) {
|
|
30
|
-
case 'sha256':
|
|
31
|
-
return sha256.create();
|
|
32
|
-
case 'sha512':
|
|
33
|
-
return sha512.create();
|
|
34
|
-
}
|
|
35
|
-
assertArgument(false, 'invalid hashing algorithm name', 'algorithm', algo);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function createHmac(_algo, key) {
|
|
39
|
-
const algo = { sha256, sha512 }[_algo];
|
|
40
|
-
assertArgument(algo != null, 'invalid hmac algorithm', 'algorithm', _algo);
|
|
41
|
-
return hmac.create(algo, key);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function pbkdf2Sync(password, salt, iterations, keylen, _algo) {
|
|
45
|
-
const algo = { sha256, sha512 }[_algo];
|
|
46
|
-
assertArgument(algo != null, 'invalid pbkdf2 algorithm', 'algorithm', _algo);
|
|
47
|
-
return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function randomBytes(length) {
|
|
51
|
-
assert(
|
|
52
|
-
crypto != null,
|
|
53
|
-
'platform does not support secure random numbers',
|
|
54
|
-
'UNSUPPORTED_OPERATION',
|
|
55
|
-
{
|
|
56
|
-
operation: 'randomBytes',
|
|
57
|
-
},
|
|
58
|
-
);
|
|
59
|
-
assertArgument(
|
|
60
|
-
Number.isInteger(length) && length > 0 && length <= 1024,
|
|
61
|
-
'invalid length',
|
|
62
|
-
'length',
|
|
63
|
-
length,
|
|
64
|
-
);
|
|
65
|
-
const result = new Uint8Array(length);
|
|
66
|
-
crypto.getRandomValues(result);
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default {
|
|
71
|
-
createHash,
|
|
72
|
-
createHmac,
|
|
73
|
-
pbkdf2Sync,
|
|
74
|
-
randomBytes,
|
|
75
|
-
};
|
package/test/ts-node-register.js
DELETED
package/webpack.config.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import webpack from 'webpack';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
mode: 'production',
|
|
6
|
-
target: 'web',
|
|
7
|
-
entry: {
|
|
8
|
-
index: {
|
|
9
|
-
import: './src/index.ts',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
watch: false,
|
|
13
|
-
output: {
|
|
14
|
-
filename: 'index.js',
|
|
15
|
-
path: path.join(import.meta.dirname, './browser'),
|
|
16
|
-
libraryTarget: 'module',
|
|
17
|
-
},
|
|
18
|
-
node: {
|
|
19
|
-
__dirname: false,
|
|
20
|
-
},
|
|
21
|
-
experiments: {
|
|
22
|
-
outputModule: true,
|
|
23
|
-
asyncWebAssembly: false,
|
|
24
|
-
syncWebAssembly: true,
|
|
25
|
-
},
|
|
26
|
-
resolve: {
|
|
27
|
-
extensionAlias: {
|
|
28
|
-
'.js': ['.js', '.ts'],
|
|
29
|
-
},
|
|
30
|
-
modules: ['.', 'node_modules'],
|
|
31
|
-
extensions: ['.*', '.js', '.jsx', '.tsx', '.ts', '.wasm'],
|
|
32
|
-
fallback: {
|
|
33
|
-
buffer: import.meta.resolve('buffer/'),
|
|
34
|
-
|
|
35
|
-
assert: import.meta.resolve('assert/'),
|
|
36
|
-
crypto: import.meta.resolve('./src/crypto/crypto-browser.js'),
|
|
37
|
-
http: import.meta.resolve('stream-http/'),
|
|
38
|
-
https: import.meta.resolve('https-browserify/'),
|
|
39
|
-
os: import.meta.resolve('os-browserify/browser/'),
|
|
40
|
-
stream: import.meta.resolve('stream-browserify'),
|
|
41
|
-
process: import.meta.resolve('process/browser'),
|
|
42
|
-
zlib: import.meta.resolve('browserify-zlib'),
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
cache: false,
|
|
46
|
-
module: {
|
|
47
|
-
rules: [
|
|
48
|
-
{
|
|
49
|
-
test: /\.(js|jsx|tsx|ts)$/,
|
|
50
|
-
exclude: /node_modules/,
|
|
51
|
-
resolve: {
|
|
52
|
-
fullySpecified: false,
|
|
53
|
-
},
|
|
54
|
-
use: [
|
|
55
|
-
{
|
|
56
|
-
loader: 'babel-loader',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
loader: 'ts-loader',
|
|
60
|
-
options: {
|
|
61
|
-
configFile: 'tsconfig.webpack.json',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
optimization: {
|
|
69
|
-
usedExports: true,
|
|
70
|
-
},
|
|
71
|
-
plugins: [
|
|
72
|
-
new webpack.ProvidePlugin({
|
|
73
|
-
Buffer: ['buffer', 'Buffer'],
|
|
74
|
-
process: 'process/browser',
|
|
75
|
-
stream: 'stream-browserify',
|
|
76
|
-
zlib: 'browserify-zlib',
|
|
77
|
-
}),
|
|
78
|
-
],
|
|
79
|
-
};
|