@bsv/sdk 1.4.12 → 1.4.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.4.12",
3
+ "version": "1.4.13",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -230,7 +230,9 @@
230
230
  "homepage": "https://github.com/bitcoin-sv/ts-sdk#readme",
231
231
  "devDependencies": {
232
232
  "@eslint/js": "^9.19.0",
233
+ "@jest/globals": "^29.7.0",
233
234
  "@types/jest": "^29.5.14",
235
+ "@types/node": "^22.13.14",
234
236
  "eslint": "^8.57.1",
235
237
  "globals": "^15.14.0",
236
238
  "jest": "^29.7.0",
@@ -12,12 +12,12 @@ describe('ECDH', function () {
12
12
  expect(sh1.toString()).toEqual(sh2.toString())
13
13
  sh1 = s1.deriveSharedSecret(
14
14
  PublicKey.fromString(
15
- Buffer.from(s2.toPublicKey().toDER()).toString('hex')
15
+ s2.toPublicKey().toDER('hex') as string
16
16
  )
17
17
  )
18
18
  sh2 = s2.deriveSharedSecret(
19
19
  PublicKey.fromString(
20
- Buffer.from(s1.toPublicKey().toDER()).toString('hex')
20
+ s1.toPublicKey().toDER('hex') as string
21
21
  )
22
22
  )
23
23
 
@@ -5,6 +5,7 @@ export { default as PublicKey } from './PublicKey.js'
5
5
  export { default as Signature } from './Signature.js'
6
6
  export { default as PrivateKey, KeyShares } from './PrivateKey.js'
7
7
  export { default as SymmetricKey } from './SymmetricKey.js'
8
+ export { default as DRBG } from './DRBG.js'
8
9
  export * as ECDSA from './ECDSA.js'
9
10
  export * as Utils from './utils.js'
10
11
  export * as Hash from './Hash.js'
@@ -403,7 +403,7 @@ export default class Transaction {
403
403
 
404
404
  /**
405
405
  * Computes fees prior to signing.
406
- * If no fee model is provided, uses a SatoshisPerKilobyte fee model that pays 10 sat/kb.
406
+ * If no fee model is provided, uses a SatoshisPerKilobyte fee model that pays 1 sat/kb.
407
407
  * If fee is a number, the transaction uses that value as fee.
408
408
  *
409
409
  * @param modelOrFee - The initialized fee model to use or fixed fee for the transaction
@@ -412,7 +412,7 @@ export default class Transaction {
412
412
  *
413
413
  */
414
414
  async fee (
415
- modelOrFee: FeeModel | number = new SatoshisPerKilobyte(10),
415
+ modelOrFee: FeeModel | number = new SatoshisPerKilobyte(1),
416
416
  changeDistribution: 'equal' | 'random' = 'equal'
417
417
  ): Promise<void> {
418
418
  this.cachedHash = undefined
@@ -348,9 +348,9 @@ describe('Transaction', () => {
348
348
  expect(spendTx.outputs[1].satoshis).not.toBeDefined()
349
349
  await spendTx.fee()
350
350
  // Transaction size is 225 bytes for one-input two-output P2PKH.
351
- // Default fee rate is 10 sat/kb = 2.25 sats (round up to 3).
352
- // 4000 sats in - 1000 sats out - 3 sats fee = expected 2997 sats change.
353
- expect(spendTx.outputs[1].satoshis).toEqual(2997)
351
+ // Default fee rate is 1 sat/kb = 0.225 sats (round up to 1).
352
+ // 4000 sats in - 1000 sats out - 3 sats fee = expected 2999 sats change.
353
+ expect(spendTx.outputs[1].satoshis).toEqual(2999)
354
354
  })
355
355
  it('Computes fees with a custom fee model', async () => {
356
356
  const privateKey = new PrivateKey(1)