@bsv/wallet-toolbox 1.3.26 → 1.3.28

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.
Files changed (22) hide show
  1. package/mobile/out/src/monitor/Monitor.js +4 -4
  2. package/mobile/out/src/monitor/tasks/{TaskServiceCallHistory.d.ts → TaskMonitorCallHistory.d.ts} +2 -2
  3. package/mobile/out/src/monitor/tasks/{TaskServiceCallHistory.d.ts.map → TaskMonitorCallHistory.d.ts.map} +1 -1
  4. package/{out/src/monitor/tasks/TaskServiceCallHistory.js → mobile/out/src/monitor/tasks/TaskMonitorCallHistory.js} +6 -6
  5. package/mobile/out/src/monitor/tasks/{TaskServiceCallHistory.js.map → TaskMonitorCallHistory.js.map} +1 -1
  6. package/mobile/package-lock.json +2 -2
  7. package/mobile/package.json +1 -1
  8. package/out/src/monitor/Monitor.js +4 -4
  9. package/out/src/monitor/tasks/{TaskServiceCallHistory.d.ts → TaskMonitorCallHistory.d.ts} +2 -2
  10. package/out/src/monitor/tasks/{TaskServiceCallHistory.d.ts.map → TaskMonitorCallHistory.d.ts.map} +1 -1
  11. package/{mobile/out/src/monitor/tasks/TaskServiceCallHistory.js → out/src/monitor/tasks/TaskMonitorCallHistory.js} +6 -6
  12. package/out/src/monitor/tasks/{TaskServiceCallHistory.js.map → TaskMonitorCallHistory.js.map} +1 -1
  13. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  14. package/out/src/storage/StorageKnex.js +8 -1
  15. package/out/src/storage/StorageKnex.js.map +1 -1
  16. package/out/test/Wallet/local/localWallet.man.test.js +1 -1
  17. package/out/tsconfig.all.tsbuildinfo +1 -1
  18. package/package.json +1 -1
  19. package/src/monitor/Monitor.ts +4 -4
  20. package/src/monitor/tasks/{TaskServiceCallHistory.ts → TaskMonitorCallHistory.ts} +3 -3
  21. package/src/storage/StorageKnex.ts +8 -1
  22. package/test/Wallet/local/localWallet.man.test.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/wallet-toolbox",
3
- "version": "1.3.26",
3
+ "version": "1.3.28",
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",
@@ -13,7 +13,7 @@ import { TaskFailAbandoned } from './tasks/TaskFailAbandoned'
13
13
  import { TaskCheckForProofs } from './tasks/TaskCheckForProofs'
14
14
  import { TaskClock } from './tasks/TaskClock'
15
15
  import { TaskNewHeader } from './tasks/TaskNewHeader'
16
- import { TaskServiceCallHistory } from './tasks/TaskServiceCallHistory'
16
+ import { TaskMonitorCallHistory } from './tasks/TaskMonitorCallHistory'
17
17
 
18
18
  import { TaskSendWaiting } from './tasks/TaskSendWaiting'
19
19
  import { TaskCheckNoSends } from './tasks/TaskCheckNoSends'
@@ -111,7 +111,7 @@ export class Monitor {
111
111
  addAllTasksToOther(): void {
112
112
  this._otherTasks.push(new TaskClock(this))
113
113
  this._otherTasks.push(new TaskNewHeader(this))
114
- this._otherTasks.push(new TaskServiceCallHistory(this))
114
+ this._otherTasks.push(new TaskMonitorCallHistory(this))
115
115
  this._otherTasks.push(new TaskPurge(this, this.defaultPurgeParams))
116
116
  this._otherTasks.push(new TaskReviewStatus(this))
117
117
  this._otherTasks.push(new TaskSendWaiting(this))
@@ -130,7 +130,7 @@ export class Monitor {
130
130
  addDefaultTasks(): void {
131
131
  this._tasks.push(new TaskClock(this))
132
132
  this._tasks.push(new TaskNewHeader(this))
133
- this._tasks.push(new TaskServiceCallHistory(this))
133
+ this._tasks.push(new TaskMonitorCallHistory(this))
134
134
  this._tasks.push(new TaskSendWaiting(this, 8 * this.oneSecond, 7 * this.oneSecond)) // Check every 8 seconds but must be 7 seconds old
135
135
  this._tasks.push(new TaskCheckForProofs(this, 2 * this.oneHour)) // Every two hours if no block found
136
136
  this._tasks.push(new TaskCheckNoSends(this))
@@ -147,7 +147,7 @@ export class Monitor {
147
147
  addMultiUserTasks(): void {
148
148
  this._tasks.push(new TaskClock(this))
149
149
  this._tasks.push(new TaskNewHeader(this))
150
- this._tasks.push(new TaskServiceCallHistory(this))
150
+ this._tasks.push(new TaskMonitorCallHistory(this))
151
151
  this._tasks.push(new TaskSendWaiting(this, 8 * this.oneSecond, 7 * this.oneSecond)) // Check every 8 seconds but must be 7 seconds old
152
152
  this._tasks.push(new TaskCheckForProofs(this, 2 * this.oneHour)) // Every two hours if no block found
153
153
  this._tasks.push(new TaskCheckNoSends(this))
@@ -2,14 +2,14 @@ import { TableMonitorEvent } from '../../storage/index.client'
2
2
  import { Monitor } from '../Monitor'
3
3
  import { WalletMonitorTask } from './WalletMonitorTask'
4
4
 
5
- export class TaskServiceCallHistory extends WalletMonitorTask {
6
- static taskName = 'ServiceCallHistory'
5
+ export class TaskMonitorCallHistory extends WalletMonitorTask {
6
+ static taskName = 'MonitorCallHistory'
7
7
 
8
8
  constructor(
9
9
  monitor: Monitor,
10
10
  public triggerMsecs = monitor.oneMinute * 12
11
11
  ) {
12
- super(monitor, TaskServiceCallHistory.taskName)
12
+ super(monitor, TaskMonitorCallHistory.taskName)
13
13
  }
14
14
 
15
15
  trigger(nowMsecsSinceEpoch: number): { run: boolean } {
@@ -1156,9 +1156,16 @@ export class StorageKnex extends StorageProvider implements sdk.WalletStoragePro
1156
1156
  async adminStats(adminIdentityKey: string): Promise<AdminStatsResult> {
1157
1157
  if (this.dbtype !== 'MySQL') throw new sdk.WERR_NOT_IMPLEMENTED('adminStats, only MySQL is supported')
1158
1158
 
1159
- const monitorEvent = verifyOneOrNone(await this.findMonitorEvents({ partial: { event: 'ServiceCallHistory'}, orderDescending: true, paged: { limit: 1 } }))
1159
+ const monitorEvent = verifyOneOrNone(await this.findMonitorEvents({ partial: { event: 'MonitorCallHistory'}, orderDescending: true, paged: { limit: 1 } }))
1160
1160
  const monitorStats: ServicesCallHistory | undefined = monitorEvent ? JSON.parse(monitorEvent.details!) : undefined
1161
1161
  const servicesStats = this.getServices().getServicesCallHistory(true)
1162
+ await this.insertMonitorEvent({
1163
+ event: 'ServicesCallHistory',
1164
+ details: JSON.stringify(servicesStats),
1165
+ created_at: new Date(),
1166
+ updated_at: new Date(),
1167
+ id: 0
1168
+ })
1162
1169
 
1163
1170
  const one_day_ago = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString()
1164
1171
  const one_week_ago = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString()
@@ -35,7 +35,7 @@ describe('localWallet tests', () => {
35
35
  await setup.monitor.runOnce()
36
36
  await setup.services.getRawTx('0000e416dfaf14c04899ccad2bf76a67c1d5598fece25cf4dcb7a076012b7d8d')
37
37
  await setup.services.getRawTx('0000ced61e2491be55061ce6577e0c59b909922ba92d5cc1cd754b10d721ab0e')
38
- logger(await setup.monitor.runTask('ServiceCallHistory'))
38
+ logger(await setup.monitor.runTask('MonitorCallHistory'))
39
39
  await setup.wallet.destroy()
40
40
  })
41
41