@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/CHANGELOG.md +9 -1
- package/docs/client.md +5 -5
- package/docs/services.md +5 -5
- package/docs/wallet.md +5 -5
- package/mobile/out/src/services/Services.js +4 -4
- package/mobile/package-lock.json +2 -2
- package/mobile/package.json +1 -1
- package/out/src/services/Services.js +4 -4
- package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
- package/out/src/storage/schema/KnexMigrations.js +12 -0
- package/out/src/storage/schema/KnexMigrations.js.map +1 -1
- package/out/test/Wallet/get/getHeaderForHeight.test.js +7 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/services/Services.ts +4 -4
- package/src/storage/schema/KnexMigrations.ts +13 -0
- package/test/Wallet/get/getHeaderForHeight.test.ts +10 -0
package/package.json
CHANGED
package/src/services/Services.ts
CHANGED
|
@@ -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.
|
|
577
|
+
writer.writeUInt32LE(header.version)
|
|
578
578
|
writer.writeReverse(asArray(header.previousHash))
|
|
579
579
|
writer.writeReverse(asArray(header.merkleRoot))
|
|
580
|
-
writer.
|
|
581
|
-
writer.
|
|
582
|
-
writer.
|
|
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')
|