@bsv/sdk 1.0.8 → 1.0.10
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/cjs/package.json +1 -1
- package/dist/cjs/src/primitives/BigNumber.js +3 -3
- package/dist/cjs/src/primitives/PrivateKey.js +34 -2
- package/dist/cjs/src/primitives/PrivateKey.js.map +1 -1
- package/dist/cjs/src/primitives/index.js +3 -1
- package/dist/cjs/src/primitives/index.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/primitives/BigNumber.js +3 -3
- package/dist/esm/src/primitives/PrivateKey.js +34 -2
- package/dist/esm/src/primitives/PrivateKey.js.map +1 -1
- package/dist/esm/src/primitives/index.js +1 -0
- package/dist/esm/src/primitives/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/primitives/BigNumber.d.ts +3 -3
- package/dist/types/src/primitives/PrivateKey.d.ts +17 -1
- package/dist/types/src/primitives/PrivateKey.d.ts.map +1 -1
- package/dist/types/src/primitives/index.d.ts +1 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docs/examples/{EXAMPLE_PULSE_HEADERS.md → EXAMPLE_VERIFYING_ROOTS.md} +68 -66
- package/package.json +1 -1
- package/src/primitives/BigNumber.ts +3 -3
- package/src/primitives/PrivateKey.ts +38 -2
- package/src/primitives/__tests/bug-31.test.ts +33 -0
- package/src/primitives/index.ts +1 -0
- package/src/script/__tests/Script.test.ts +11 -12
- package/src/script/__tests/Spend.test.ts +2 -4
- package/src/script/__tests/script.invalid.vectors.ts +2270 -828
- package/src/script/__tests/script.valid.vectors.ts +3115 -1021
- package/src/script/__tests/spend.valid.vectors.ts +1368 -1366
- package/src/script/__tests/scriptFromVector.ts +0 -42
|
@@ -3,7 +3,6 @@ import PrivateKey from '../../../dist/cjs/src/primitives/PrivateKey'
|
|
|
3
3
|
import P2PKH from '../../../dist/cjs/src/script/templates/P2PKH'
|
|
4
4
|
import OP from '../../../dist/cjs/src/script/OP'
|
|
5
5
|
import { toHex } from '../../../dist/cjs/src/primitives/utils'
|
|
6
|
-
import scriptFromVector from './scriptFromVector'
|
|
7
6
|
|
|
8
7
|
import scriptInvalid from './script.invalid.vectors'
|
|
9
8
|
import scriptValid from './script.valid.vectors'
|
|
@@ -353,19 +352,19 @@ describe('Script', () => {
|
|
|
353
352
|
}
|
|
354
353
|
it(`should not fail when reading scriptValid vector ${i}`, () => {
|
|
355
354
|
expect(() => {
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
Script.fromHex(a[0]).toHex()
|
|
356
|
+
Script.fromHex(a[0]).toASM()
|
|
358
357
|
}).not.toThrow()
|
|
359
358
|
|
|
360
359
|
expect(() => {
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
Script.fromHex(a[1]).toHex()
|
|
361
|
+
Script.fromHex(a[1]).toASM()
|
|
363
362
|
}).not.toThrow()
|
|
364
363
|
|
|
365
364
|
// should be able to return the same output over and over
|
|
366
|
-
let str =
|
|
365
|
+
let str = Script.fromHex(a[0]).toASM()
|
|
367
366
|
expect(Script.fromASM(str).toASM()).toEqual(str)
|
|
368
|
-
str =
|
|
367
|
+
str = Script.fromHex(a[1]).toASM()
|
|
369
368
|
expect(Script.fromASM(str).toASM()).toEqual(str)
|
|
370
369
|
})
|
|
371
370
|
})
|
|
@@ -376,26 +375,26 @@ describe('Script', () => {
|
|
|
376
375
|
}
|
|
377
376
|
|
|
378
377
|
it(`should not fail when reading scriptInvalid vector ${i}`, () => {
|
|
379
|
-
|
|
378
|
+
// Test that no errors are thrown for the first item
|
|
380
379
|
expect(() => {
|
|
381
|
-
const scriptA =
|
|
380
|
+
const scriptA = Script.fromHex(a[0])
|
|
382
381
|
scriptA.toHex()
|
|
383
382
|
scriptA.toASM()
|
|
384
383
|
}).not.toThrow()
|
|
385
384
|
|
|
386
385
|
// Test that no errors are thrown for the second item
|
|
387
386
|
expect(() => {
|
|
388
|
-
const scriptB =
|
|
387
|
+
const scriptB = Script.fromHex(a[1])
|
|
389
388
|
scriptB.toHex()
|
|
390
389
|
scriptB.toASM()
|
|
391
390
|
}).not.toThrow()
|
|
392
391
|
|
|
393
392
|
// Test that it should be able to return the same output over and over for the first item
|
|
394
|
-
const strA =
|
|
393
|
+
const strA = Script.fromHex(a[0]).toASM()
|
|
395
394
|
expect(Script.fromASM(strA).toASM()).toEqual(strA)
|
|
396
395
|
|
|
397
396
|
// Test that it should be able to return the same output over and over for the second item
|
|
398
|
-
const strB =
|
|
397
|
+
const strB = Script.fromHex(a[1]).toASM()
|
|
399
398
|
expect(Script.fromASM(strB).toASM()).toEqual(strB)
|
|
400
399
|
})
|
|
401
400
|
})
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import BigNumber from '../../../dist/cjs/src/primitives/BigNumber'
|
|
2
1
|
import PrivateKey from '../../../dist/cjs/src/primitives/PrivateKey'
|
|
3
2
|
import { hash160, hash256 } from '../../../dist/cjs/src/primitives/Hash'
|
|
4
3
|
import Curve from '../../../dist/cjs/src/primitives/Curve'
|
|
@@ -6,7 +5,6 @@ import Spend from '../../../dist/cjs/src/script/Spend'
|
|
|
6
5
|
import P2PKH from '../../../dist/cjs/src/script/templates/P2PKH'
|
|
7
6
|
import RPuzzle from '../../../dist/cjs/src/script/templates/RPuzzle'
|
|
8
7
|
import Transaction from '../../../dist/cjs/src/transaction/Transaction'
|
|
9
|
-
import scriptFromVector from './scriptFromVector'
|
|
10
8
|
import LockingScript from '../../../dist/cjs/src/script/LockingScript'
|
|
11
9
|
import UnlockingScript from '../../../dist/cjs/src/script/UnlockingScript'
|
|
12
10
|
|
|
@@ -233,12 +231,12 @@ describe('Spend', () => {
|
|
|
233
231
|
sourceTXID: '0000000000000000000000000000000000000000000000000000000000000000',
|
|
234
232
|
sourceOutputIndex: 0,
|
|
235
233
|
sourceSatoshis: 1,
|
|
236
|
-
lockingScript:
|
|
234
|
+
lockingScript: LockingScript.fromHex(a[1]),
|
|
237
235
|
transactionVersion: 1,
|
|
238
236
|
otherInputs: [],
|
|
239
237
|
outputs: [],
|
|
240
238
|
inputIndex: 0,
|
|
241
|
-
unlockingScript:
|
|
239
|
+
unlockingScript: UnlockingScript.fromHex(a[0]),
|
|
242
240
|
inputSequence: 0xffffffff,
|
|
243
241
|
lockTime: 0
|
|
244
242
|
})
|