@bsv/wallet-toolbox 1.6.27 → 1.6.29

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/wallet-toolbox",
3
- "version": "1.6.27",
3
+ "version": "1.6.29",
4
4
  "description": "BRC100 conforming wallet, wallet storage and wallet signer components",
5
5
  "main": "./out/src/index.js",
6
6
  "types": "./out/src/index.d.ts",
@@ -574,12 +574,12 @@ export function validateScriptHash(output: string, outputFormat?: GetUtxoStatusO
574
574
  */
575
575
  export function toBinaryBaseBlockHeader(header: BaseBlockHeader): number[] {
576
576
  const writer = new Utils.Writer()
577
- writer.writeUInt32BE(header.version)
577
+ writer.writeUInt32LE(header.version)
578
578
  writer.writeReverse(asArray(header.previousHash))
579
579
  writer.writeReverse(asArray(header.merkleRoot))
580
- writer.writeUInt32BE(header.time)
581
- writer.writeUInt32BE(header.bits)
582
- writer.writeUInt32BE(header.nonce)
580
+ writer.writeUInt32LE(header.time)
581
+ writer.writeUInt32LE(header.bits)
582
+ writer.writeUInt32LE(header.nonce)
583
583
  const r = writer.toArray()
584
584
  return r
585
585
  }
@@ -73,6 +73,19 @@ export class KnexMigrations implements MigrationSource<string> {
73
73
  }
74
74
  }
75
75
 
76
+ migrations['2025-10-18-001 add transactions txid index'] = {
77
+ async up(knex) {
78
+ await knex.schema.alterTable('transactions', table => {
79
+ table.index('txid')
80
+ })
81
+ },
82
+ async down(knex) {
83
+ await knex.schema.alterTable('transactions', table => {
84
+ table.dropIndex('txid')
85
+ })
86
+ }
87
+ }
88
+
76
89
  migrations['2025-09-06-001 add proven txs blockHash index'] = {
77
90
  async up(knex) {
78
91
  await knex.schema.alterTable('proven_txs', table => {
@@ -1,3 +1,8 @@
1
+ import { Utils } from '@bsv/sdk'
2
+ import {
3
+ blockHash,
4
+ deserializeBaseBlockHeader
5
+ } from '../../../src/services/chaintracker/chaintracks/util/blockHeaderUtilities'
1
6
  import { _tu, TestWalletNoSetup } from '../../utils/TestUtilsWalletStorage'
2
7
 
3
8
  const includeTestChaintracks = false
@@ -38,6 +43,11 @@ describe('getHeaderForHeight tests', () => {
38
43
  // Query an existing valid block height
39
44
  const height = 1 // Ensure this height exists in the test database
40
45
  const result = await wallet.getHeaderForHeight({ height })
46
+ const headerHex = result.header
47
+ const headerA = Utils.toArray(headerHex, 'hex')
48
+ const hash = blockHash(headerA)
49
+ expect(hash).toBe('00000000b873e79784647a6c82962c70d228557d24a747ea4d1b8bbe878e1206')
50
+ const header = deserializeBaseBlockHeader(headerA)
41
51
 
42
52
  expect(result).toHaveProperty('header')
43
53
  expect(typeof result.header).toBe('string')