bsv2 2.0.24 → 2.1.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/dist/bsv2.mjs +36061 -4
- package/package.json +35 -39
- package/.babelrc.test +0 -10
- package/.editorconfig +0 -4
- package/.env.defaults +0 -1
- package/.env.schema +0 -1
- package/.husky/pre-commit +0 -1
- package/.mocharc.yml +0 -4
- package/.nvmrc +0 -1
- package/.travis.yml +0 -7
- package/benchmark.js +0 -50
- package/bin/bsv.js +0 -11
- package/bin/network.js +0 -92
- package/build/index.html +0 -20
- package/dist/bsv2.bundle.js +0 -8
- package/dist/bsv2.cjs.js +0 -2
- package/dist/bsv2.cjs.js.LICENSE.txt +0 -1
- package/dist/bsv2.module.js +0 -2
- package/entry.js +0 -82
- package/index.js +0 -102
- package/karma.conf.js +0 -78
- package/lib/ach.js +0 -59
- package/lib/address.js +0 -264
- package/lib/aes.js +0 -57
- package/lib/aescbc.js +0 -38
- package/lib/base-58-check.js +0 -83
- package/lib/base-58.js +0 -59
- package/lib/bip-32.js +0 -472
- package/lib/bip-39-en-wordlist.js +0 -2054
- package/lib/bip-39-en.js +0 -10
- package/lib/bip-39-es-wordlist.js +0 -2055
- package/lib/bip-39-es.js +0 -10
- package/lib/bip-39-jp-wordlist.js +0 -2053
- package/lib/bip-39-jp.js +0 -10
- package/lib/bip-39-words.js +0 -5
- package/lib/bip-39.js +0 -285
- package/lib/block-header.js +0 -79
- package/lib/block.js +0 -132
- package/lib/bn.js +0 -467
- package/lib/br.js +0 -172
- package/lib/bsm.js +0 -127
- package/lib/bw.js +0 -188
- package/lib/cbc.js +0 -140
- package/lib/cmp.js +0 -37
- package/lib/config.js +0 -50
- package/lib/constants.js +0 -150
- package/lib/ecdsa.js +0 -495
- package/lib/ecies.js +0 -151
- package/lib/hash-cache.js +0 -41
- package/lib/hash.js +0 -191
- package/lib/interp.js +0 -2013
- package/lib/inv.js +0 -49
- package/lib/key-pair.js +0 -133
- package/lib/mainnet-address.js +0 -5
- package/lib/mainnet-bip-32.js +0 -5
- package/lib/mainnet-key-pair.js +0 -5
- package/lib/mainnet-priv-key.js +0 -5
- package/lib/merkle.js +0 -92
- package/lib/msg.js +0 -184
- package/lib/op-code.js +0 -398
- package/lib/point.js +0 -134
- package/lib/priv-key.js +0 -157
- package/lib/pub-key.js +0 -230
- package/lib/random.js +0 -28
- package/lib/script.js +0 -826
- package/lib/sig-operations.js +0 -120
- package/lib/sig.js +0 -399
- package/lib/struct.js +0 -389
- package/lib/testnet-address.js +0 -5
- package/lib/testnet-bip-32.js +0 -5
- package/lib/testnet-key-pair.js +0 -5
- package/lib/testnet-priv-key.js +0 -5
- package/lib/tx-builder.js +0 -593
- package/lib/tx-in.js +0 -172
- package/lib/tx-out-map.js +0 -57
- package/lib/tx-out.js +0 -73
- package/lib/tx-verifier.js +0 -209
- package/lib/tx.js +0 -430
- package/lib/var-int.js +0 -73
- package/lib/version.js +0 -92
- package/lib/workers-result.js +0 -65
- package/lib/workers.js +0 -77
- package/load-babel.js +0 -3
- package/mtest/test.html +0 -15
- package/mtest/test.js +0 -2
- package/mtest/test.mjs +0 -2
- package/test/ach.js +0 -172
- package/test/address.js +0 -464
- package/test/aes.js +0 -96
- package/test/aescbc.js +0 -65
- package/test/base-58-check.js +0 -128
- package/test/base-58.js +0 -113
- package/test/bip-32.js +0 -721
- package/test/bip-39.js +0 -282
- package/test/block-header.js +0 -152
- package/test/block.js +0 -243
- package/test/bn.js +0 -643
- package/test/br.js +0 -353
- package/test/bsm.js +0 -141
- package/test/bw.js +0 -292
- package/test/cbc.js +0 -335
- package/test/cmp.js +0 -56
- package/test/data/bip69.json +0 -215
- package/test/data/bitcoind/base58_keys_invalid.json +0 -152
- package/test/data/bitcoind/base58_keys_valid.json +0 -452
- package/test/data/bitcoind/blocks.json +0 -27
- package/test/data/bitcoind/script_tests.json +0 -2244
- package/test/data/bitcoind/sig_canonical.json +0 -7
- package/test/data/bitcoind/sig_noncanonical.json +0 -22
- package/test/data/bitcoind/tx_invalid.json +0 -177
- package/test/data/bitcoind/tx_valid.json +0 -224
- package/test/data/blk86756-testnet.dat +0 -0
- package/test/data/blk86756-testnet.js +0 -12
- package/test/data/blk86756-testnet.json +0 -684
- package/test/data/ecdsa.json +0 -230
- package/test/data/messages.json +0 -22
- package/test/data/sighash.json +0 -1004
- package/test/data/tx_creation.json +0 -85
- package/test/ecdsa.js +0 -748
- package/test/ecies.js +0 -238
- package/test/global.js +0 -13
- package/test/hash-cache.js +0 -52
- package/test/hash.js +0 -354
- package/test/index.js +0 -10
- package/test/interp.js +0 -512
- package/test/inv.js +0 -65
- package/test/key-pair.js +0 -243
- package/test/merkle.js +0 -179
- package/test/msg.js +0 -295
- package/test/op-code.js +0 -79
- package/test/point.js +0 -375
- package/test/priv-key.js +0 -264
- package/test/pub-key.js +0 -549
- package/test/random.js +0 -31
- package/test/script.js +0 -1340
- package/test/sig-operations.js +0 -149
- package/test/sig.js +0 -662
- package/test/struct.js +0 -552
- package/test/tx-builder.js +0 -2104
- package/test/tx-in.js +0 -198
- package/test/tx-out-map.js +0 -104
- package/test/tx-out.js +0 -162
- package/test/tx-verifier.js +0 -246
- package/test/tx.js +0 -539
- package/test/var-int.js +0 -132
- package/test/vectors/aes.json +0 -10392
- package/test/vectors/aescbc.json +0 -620
- package/test/vectors/bip39.json +0 -502
- package/test/vectors/bip69.json +0 -215
- package/test/vectors/bitcoin-abc/script_tests.json +0 -48
- package/test/vectors/bitcoin-abc/sighash.json +0 -7004
- package/test/vectors/bitcoin-sv/script_tests.json +0 -248
- package/test/vectors/bitcoind/script_invalid.json +0 -1151
- package/test/vectors/bitcoind/script_valid.json +0 -1462
- package/test/vectors/bitcoind/sighash.json +0 -3503
- package/test/vectors/bitcoind/tx_invalid.json +0 -883
- package/test/vectors/bitcoind/tx_valid.json +0 -1150
- package/test/vectors/coolest-tx-ever-sent.json +0 -8
- package/test/vectors/ecdsa.json +0 -300
- package/test/vectors/hash.json +0 -6133
- package/test/vectors/kdf.json +0 -47
- package/test/vectors/largesttx.json +0 -5
- package/test/vectors/largesttxblock.json +0 -6
- package/test/vectors/sig.json +0 -79
- package/test/vectors/sighash-single-bug.json +0 -8
- package/test/version.js +0 -81
- package/test/workers-result.js +0 -89
- package/test/workers.js +0 -91
- package/test-index.js +0 -3
- package/webpack.config.js +0 -115
package/test/base-58-check.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/* global describe,it */
|
|
2
|
-
'use strict'
|
|
3
|
-
import should from 'should'
|
|
4
|
-
import { Base58Check } from '../lib/base-58-check'
|
|
5
|
-
import { Base58 } from '../lib/base-58'
|
|
6
|
-
|
|
7
|
-
describe('Base58Check', function () {
|
|
8
|
-
const buf = Buffer.from([0, 1, 2, 3, 253, 254, 255])
|
|
9
|
-
const enc = '14HV44ipwoaqfg'
|
|
10
|
-
|
|
11
|
-
it('should make an instance with "new"', function () {
|
|
12
|
-
const b58 = new Base58Check()
|
|
13
|
-
should.exist(b58)
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('should make an instance without "new"', function () {
|
|
17
|
-
const b58 = new Base58Check()
|
|
18
|
-
should.exist(b58)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('should allow this handy syntax', function () {
|
|
22
|
-
new Base58Check(buf).toString().should.equal(enc)
|
|
23
|
-
new Base58Check()
|
|
24
|
-
.fromString(enc)
|
|
25
|
-
.toBuffer()
|
|
26
|
-
.toString('hex')
|
|
27
|
-
.should.equal(buf.toString('hex'))
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
describe('#fromObject', function () {
|
|
31
|
-
it('should set a buf', function () {
|
|
32
|
-
should.exist(new Base58Check().fromObject({ buf: buf }).buf)
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
describe('@encode', function () {
|
|
37
|
-
it('should encode the buffer accurately', function () {
|
|
38
|
-
Base58Check.encode(buf).should.equal(enc)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it('should throw an error when the input is not a buffer', function () {
|
|
42
|
-
;(function () {
|
|
43
|
-
Base58Check.encode('string')
|
|
44
|
-
}.should.throw('Input must be a buffer'))
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
describe('@decode', function () {
|
|
49
|
-
it('should decode this encoded value correctly', function () {
|
|
50
|
-
Base58Check.decode(enc)
|
|
51
|
-
.toString('hex')
|
|
52
|
-
.should.equal(buf.toString('hex'))
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('should throw an error when input is not a string', function () {
|
|
56
|
-
;(function () {
|
|
57
|
-
Base58Check.decode(5)
|
|
58
|
-
}.should.throw('Input must be a string'))
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('should throw an error when input is too short', function () {
|
|
62
|
-
;(function () {
|
|
63
|
-
Base58Check.decode(enc.slice(0, 1))
|
|
64
|
-
}.should.throw('Input string too short'))
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('should throw an error when there is a checksum mismatch', function () {
|
|
68
|
-
const buf2 = Base58.decode(enc)
|
|
69
|
-
buf2[0] = buf2[0] + 1
|
|
70
|
-
const enc2 = Base58.encode(buf2)
|
|
71
|
-
;(function () {
|
|
72
|
-
Base58Check.decode(enc2)
|
|
73
|
-
}.should.throw('Checksum mismatch'))
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
describe('#fromHex', function () {
|
|
78
|
-
it('should set buffer from hex', function () {
|
|
79
|
-
const b58 = new Base58Check().fromHex(buf.toString('hex'))
|
|
80
|
-
b58.buf.toString('hex').should.equal(buf.toString('hex'))
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
describe('#fromBuffer', function () {
|
|
85
|
-
it('should not fail', function () {
|
|
86
|
-
should.exist(new Base58Check().fromBuffer(buf))
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('should set buffer', function () {
|
|
90
|
-
const b58 = new Base58Check().fromBuffer(buf)
|
|
91
|
-
b58.buf.toString('hex').should.equal(buf.toString('hex'))
|
|
92
|
-
})
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
describe('#fromString', function () {
|
|
96
|
-
it('should convert this known string to a buffer', function () {
|
|
97
|
-
new Base58Check()
|
|
98
|
-
.fromString(enc)
|
|
99
|
-
.toBuffer()
|
|
100
|
-
.toString('hex')
|
|
101
|
-
.should.equal(buf.toString('hex'))
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
describe('#toHex', function () {
|
|
106
|
-
it('should return the buffer', function () {
|
|
107
|
-
const b58 = new Base58Check(buf)
|
|
108
|
-
b58.toHex().should.equal(buf.toString('hex'))
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
describe('#toBuffer', function () {
|
|
113
|
-
it('should return the buffer', function () {
|
|
114
|
-
const b58 = new Base58Check(buf)
|
|
115
|
-
b58
|
|
116
|
-
.toBuffer()
|
|
117
|
-
.toString('hex')
|
|
118
|
-
.should.equal(buf.toString('hex'))
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
describe('#toString', function () {
|
|
123
|
-
it('should return the buffer', function () {
|
|
124
|
-
const b58 = new Base58Check(buf)
|
|
125
|
-
b58.toString().should.equal(enc)
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
})
|
package/test/base-58.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/* global describe,it */
|
|
2
|
-
'use strict'
|
|
3
|
-
import { Base58 } from '../lib/base-58'
|
|
4
|
-
import should from 'should'
|
|
5
|
-
|
|
6
|
-
describe('Base58', function () {
|
|
7
|
-
const buf = Buffer.from([0, 1, 2, 3, 253, 254, 255])
|
|
8
|
-
const enc = '1W7N4RuG'
|
|
9
|
-
|
|
10
|
-
it('should make an instance with "new"', function () {
|
|
11
|
-
const b58 = new Base58()
|
|
12
|
-
should.exist(b58)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('should make an instance without "new"', function () {
|
|
16
|
-
const b58 = new Base58()
|
|
17
|
-
should.exist(b58)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('should allow this handy syntax', function () {
|
|
21
|
-
new Base58(buf).toString().should.equal(enc)
|
|
22
|
-
new Base58()
|
|
23
|
-
.fromString(enc)
|
|
24
|
-
.toBuffer()
|
|
25
|
-
.toString('hex')
|
|
26
|
-
.should.equal(buf.toString('hex'))
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
describe('#fromObject', function () {
|
|
30
|
-
it('should set a blank buffer', function () {
|
|
31
|
-
new Base58().fromObject({ buf: Buffer.from([]) })
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
describe('@encode', function () {
|
|
36
|
-
it('should encode the buffer accurately', function () {
|
|
37
|
-
Base58.encode(buf).should.equal(enc)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('should throw an error when the Input is not a buffer', function () {
|
|
41
|
-
;(function () {
|
|
42
|
-
Base58.encode('string')
|
|
43
|
-
}.should.throw('Input should be a buffer'))
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
describe('@decode', function () {
|
|
48
|
-
it('should decode this encoded value correctly', function () {
|
|
49
|
-
Base58.decode(enc)
|
|
50
|
-
.toString('hex')
|
|
51
|
-
.should.equal(buf.toString('hex'))
|
|
52
|
-
Buffer.isBuffer(Base58.decode(enc)).should.equal(true)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('should throw an error when Input is not a string', function () {
|
|
56
|
-
;(function () {
|
|
57
|
-
Base58.decode(5)
|
|
58
|
-
}.should.throw('Input should be a string'))
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
describe('#fromHex', function () {
|
|
63
|
-
it('should set buffer', function () {
|
|
64
|
-
const b58 = new Base58().fromHex(buf.toString('hex'))
|
|
65
|
-
b58.buf.toString('hex').should.equal(buf.toString('hex'))
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
describe('#fromBuffer', function () {
|
|
70
|
-
it('should not fail', function () {
|
|
71
|
-
should.exist(new Base58().fromBuffer(buf))
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
it('should set buffer', function () {
|
|
75
|
-
const b58 = new Base58().fromBuffer(buf)
|
|
76
|
-
b58.buf.toString('hex').should.equal(buf.toString('hex'))
|
|
77
|
-
})
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
describe('#fromString', function () {
|
|
81
|
-
it('should convert this known string to a buffer', function () {
|
|
82
|
-
new Base58()
|
|
83
|
-
.fromString(enc)
|
|
84
|
-
.toBuffer()
|
|
85
|
-
.toString('hex')
|
|
86
|
-
.should.equal(buf.toString('hex'))
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
describe('#toHex', function () {
|
|
91
|
-
it('should return the buffer in hex', function () {
|
|
92
|
-
const b58 = new Base58(buf)
|
|
93
|
-
b58.toHex().should.equal(buf.toString('hex'))
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
describe('#toBuffer', function () {
|
|
98
|
-
it('should return the buffer', function () {
|
|
99
|
-
const b58 = new Base58(buf)
|
|
100
|
-
b58
|
|
101
|
-
.toBuffer()
|
|
102
|
-
.toString('hex')
|
|
103
|
-
.should.equal(buf.toString('hex'))
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
describe('#toString', function () {
|
|
108
|
-
it('should return the buffer', function () {
|
|
109
|
-
const b58 = new Base58(buf)
|
|
110
|
-
b58.toString().should.equal(enc)
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
})
|