@bsv/wallet-toolbox 1.1.51 → 1.1.52

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.1.51",
3
+ "version": "1.1.52",
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",
@@ -242,7 +242,7 @@ export class EntityTransaction extends EntityBase<TableTransaction> {
242
242
  (ei.provenTxId &&
243
243
  eo.provenTxId !==
244
244
  (syncMap
245
- ? syncMap.transaction.idMap[verifyId(ei.provenTxId)]
245
+ ? syncMap.provenTx.idMap[verifyId(ei.provenTxId)]
246
246
  : ei.provenTxId))
247
247
  )
248
248
  return false
@@ -303,7 +303,7 @@ export class EntityTransaction extends EntityBase<TableTransaction> {
303
303
  this.isOutgoing = ei.isOutgoing
304
304
  this.status = ei.status
305
305
  this.provenTxId = ei.provenTxId
306
- ? syncMap.transaction.idMap[ei.provenTxId]
306
+ ? syncMap.provenTx.idMap[ei.provenTxId]
307
307
  : undefined
308
308
  this.satoshis = ei.satoshis
309
309
  this.txid = ei.txid
@@ -163,7 +163,8 @@ async function createSetup(chain: sdk.Chain): Promise<TestWalletNoSetup> {
163
163
  rootKeyHex: env.devKeys[env.testIdentityKey],
164
164
  filePath: env.testFilePath,
165
165
  setActiveClient: false,
166
- addLocalBackup: false
166
+ addLocalBackup: false,
167
+ useMySQLConnectionForClient: false
167
168
  })
168
169
 
169
170
  console.log(`ACTIVE STORAGE: ${setup.storage.getActiveStoreName()}`)
@@ -352,6 +352,7 @@ export abstract class TestUtilsWalletStorage {
352
352
  let filePath: string
353
353
  let addLocalBackup = false
354
354
  let setActiveClient = false
355
+ let useMySQLConnectionForClient = false
355
356
  if (typeof args === 'string') {
356
357
  chain = args
357
358
  const env = _tu.getEnv(chain)
@@ -369,6 +370,7 @@ export abstract class TestUtilsWalletStorage {
369
370
  filePath = args.filePath
370
371
  addLocalBackup = args.addLocalBackup === true
371
372
  setActiveClient = args.setActiveClient === true
373
+ useMySQLConnectionForClient = args.useMySQLConnectionForClient === true
372
374
  }
373
375
 
374
376
  const databaseName = path.parse(filePath).name
@@ -380,12 +382,28 @@ export abstract class TestUtilsWalletStorage {
380
382
  })
381
383
  setup.localStorageIdentityKey = setup.storage.getActiveStore()
382
384
 
383
- const endpointUrl =
384
- chain === 'main'
385
- ? 'https://storage.babbage.systems'
386
- : 'https://staging-storage.babbage.systems'
385
+ let client: sdk.WalletStorageProvider
386
+ if (useMySQLConnectionForClient) {
387
+ const env = _tu.getEnv(chain)
388
+ if (!env.cloudMySQLConnection)
389
+ throw new sdk.WERR_INVALID_PARAMETER(
390
+ 'env.cloundMySQLConnection',
391
+ 'valid'
392
+ )
393
+ const connection = JSON.parse(env.cloudMySQLConnection)
394
+ client = new StorageKnex({
395
+ ...StorageKnex.defaultOptions(),
396
+ knex: _tu.createMySQLFromConnection(connection),
397
+ chain: env.chain
398
+ })
399
+ } else {
400
+ const endpointUrl =
401
+ chain === 'main'
402
+ ? 'https://storage.babbage.systems'
403
+ : 'https://staging-storage.babbage.systems'
387
404
 
388
- const client = new StorageClient(setup.wallet, endpointUrl)
405
+ client = new StorageClient(setup.wallet, endpointUrl)
406
+ }
389
407
  setup.clientStorageIdentityKey = (
390
408
  await client.makeAvailable()
391
409
  ).storageIdentityKey
@@ -2515,4 +2533,5 @@ export interface CreateTestWalletArgs {
2515
2533
  filePath: string
2516
2534
  addLocalBackup?: boolean
2517
2535
  setActiveClient?: boolean
2536
+ useMySQLConnectionForClient?: boolean
2518
2537
  }