@bsv/wallet-toolbox 1.6.13 → 1.6.14

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.13",
3
+ "version": "1.6.14",
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",
@@ -39,9 +39,23 @@ export class ChaintracksStorageIdb extends ChaintracksStorageBase implements Cha
39
39
  this.dbName = `chaintracks-${this.chain}net`
40
40
  }
41
41
 
42
+ override async makeAvailable(): Promise<void> {
43
+ if (this.isAvailable && this.hasMigrated) return
44
+ // Not a base class policy, but we want to ensure migrations are run before getting to business.
45
+ if (!this.hasMigrated) {
46
+ await this.migrateLatest()
47
+ }
48
+ if (!this.isAvailable) {
49
+ await super.makeAvailable()
50
+ // Connect the bulk data file manager to the table provided by this storage class.
51
+ await this.bulkManager.setStorage(this, this.log)
52
+ }
53
+ }
54
+
42
55
  override async migrateLatest(): Promise<void> {
43
56
  if (this.db) return
44
57
  this.db = await this.initDB()
58
+ await super.migrateLatest()
45
59
  }
46
60
 
47
61
  override async destroy(): Promise<void> {}
@@ -16,7 +16,8 @@ describe('createIdbChaintracks tests', () => {
16
16
  const target: Chain = 'main'
17
17
  if (_tu.noEnv(target)) return
18
18
  const env = _tu.getEnv(target)
19
- const { chain, chaintracks, storage } = await createIdbChaintracks(env.chain, env.whatsonchainApiKey)
19
+ const { chain, chaintracks, storage, available } = await createIdbChaintracks(env.chain, env.whatsonchainApiKey)
20
+ await available
20
21
  const headerListener: HeaderListener = (header: BlockHeader) => {
21
22
  console.log(`headerListener: height: ${header.height} hash: ${header.hash} ${new Date().toISOString()}`)
22
23
  }