@bsv/wallet-toolbox 1.2.33 → 1.2.35
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/docs/client.md +458 -1816
- package/docs/monitor.md +7 -7
- package/docs/services.md +236 -2
- package/docs/wallet.md +458 -1816
- package/out/src/Setup.d.ts +1 -2
- package/out/src/Setup.d.ts.map +1 -1
- package/out/src/Setup.js +17 -18
- package/out/src/Setup.js.map +1 -1
- package/out/src/Wallet.d.ts +4 -1
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js +111 -51
- package/out/src/Wallet.js.map +1 -1
- package/out/src/index.client.d.ts +5 -6
- package/out/src/index.client.d.ts.map +1 -1
- package/out/src/index.client.js +5 -6
- package/out/src/index.client.js.map +1 -1
- package/out/src/monitor/Monitor.d.ts +4 -2
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js +45 -13
- package/out/src/monitor/Monitor.js.map +1 -1
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
- package/out/src/monitor/MonitorDaemon.js +3 -0
- package/out/src/monitor/MonitorDaemon.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +6 -4
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +3 -3
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts +2 -2
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts +2 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.js +2 -2
- package/out/src/monitor/tasks/TaskUnFail.js.map +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +19 -18
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/out/src/sdk/WalletSigner.interfaces.d.ts +2 -2
- package/out/src/sdk/WalletSigner.interfaces.d.ts.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +57 -53
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/sdk/types.d.ts +12 -0
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js +16 -1
- package/out/src/sdk/types.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts +3 -1
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +58 -23
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +40 -6
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/test/Wallet/local/localWallet.man.test.js +1 -1
- package/out/test/Wallet/local/localWallet.man.test.js.map +1 -1
- package/out/test/Wallet/local/localWallet2.man.test.js +59 -1
- package/out/test/Wallet/local/localWallet2.man.test.js.map +1 -1
- package/out/test/Wallet/specOps/specOps.man.test.js +37 -5
- package/out/test/Wallet/specOps/specOps.man.test.js.map +1 -1
- package/out/test/WalletClient/LocalKVStore.man.test.d.ts +2 -0
- package/out/test/WalletClient/LocalKVStore.man.test.d.ts.map +1 -0
- package/out/test/WalletClient/LocalKVStore.man.test.js +99 -0
- package/out/test/WalletClient/LocalKVStore.man.test.js.map +1 -0
- package/out/test/WalletClient/WERR.man.test.d.ts +2 -0
- package/out/test/WalletClient/WERR.man.test.d.ts.map +1 -0
- package/out/test/WalletClient/WERR.man.test.js +21 -0
- package/out/test/WalletClient/WERR.man.test.js.map +1 -0
- package/out/test/services/Services.test.js +3 -1
- package/out/test/services/Services.test.js.map +1 -1
- package/out/test/{Wallet/local → utils}/localWalletMethods.d.ts +2 -2
- package/out/test/utils/localWalletMethods.d.ts.map +1 -0
- package/out/test/{Wallet/local → utils}/localWalletMethods.js +4 -4
- package/out/test/utils/localWalletMethods.js.map +1 -0
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Setup.ts +2 -2
- package/src/Wallet.ts +41 -9
- package/src/index.client.ts +5 -6
- package/src/monitor/Monitor.ts +10 -9
- package/src/monitor/MonitorDaemon.ts +4 -0
- package/src/monitor/tasks/TaskCheckForProofs.ts +6 -2
- package/src/monitor/tasks/TaskCheckNoSends.ts +0 -1
- package/src/monitor/tasks/TaskNewHeader.ts +3 -4
- package/src/monitor/tasks/TaskPurge.ts +2 -2
- package/src/monitor/tasks/TaskReviewStatus.ts +0 -1
- package/src/monitor/tasks/TaskUnFail.ts +2 -1
- package/src/sdk/WalletServices.interfaces.ts +19 -18
- package/src/sdk/WalletSigner.interfaces.ts +3 -30
- package/src/sdk/WalletStorage.interfaces.ts +74 -66
- package/src/sdk/types.ts +16 -0
- package/src/storage/StorageKnex.ts +1 -1
- package/src/storage/WalletStorageManager.ts +6 -10
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +2 -1
- package/test/Wallet/local/localWallet.man.test.ts +1 -3
- package/test/Wallet/local/localWallet2.man.test.ts +60 -4
- package/test/Wallet/specOps/specOps.man.test.ts +41 -1
- package/test/WalletClient/LocalKVStore.man.test.ts +114 -0
- package/test/WalletClient/WERR.man.test.ts +20 -0
- package/test/services/Services.test.ts +3 -1
- package/test/{Wallet/local → utils}/localWalletMethods.ts +4 -5
- package/out/test/Wallet/local/localWalletMethods.d.ts.map +0 -1
- package/out/test/Wallet/local/localWalletMethods.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsv/wallet-toolbox",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.35",
|
|
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",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"homepage": "https://github.com/bitcoin-sv/wallet-toolbox#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@bsv/auth-express-middleware": "^1.1.2",
|
|
34
|
-
"@bsv/payment-express-middleware": "^1.0.
|
|
35
|
-
"@bsv/sdk": "^1.4.
|
|
34
|
+
"@bsv/payment-express-middleware": "^1.0.5",
|
|
35
|
+
"@bsv/sdk": "^1.4.18",
|
|
36
36
|
"express": "^4.21.2",
|
|
37
37
|
"knex": "^3.1.0",
|
|
38
38
|
"mysql2": "^3.12.0",
|
package/src/Setup.ts
CHANGED
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
sdk,
|
|
18
18
|
Services,
|
|
19
19
|
StorageClient,
|
|
20
|
+
StorageKnex,
|
|
20
21
|
verifyTruthy,
|
|
21
22
|
Wallet,
|
|
22
23
|
WalletStorageManager
|
|
23
|
-
} from './index.
|
|
24
|
+
} from './index.all'
|
|
24
25
|
import { Knex, knex as makeKnex } from 'knex'
|
|
25
|
-
import { StorageKnex } from './index.all'
|
|
26
26
|
|
|
27
27
|
import * as dotenv from 'dotenv'
|
|
28
28
|
dotenv.config()
|
package/src/Wallet.ts
CHANGED
|
@@ -67,15 +67,7 @@ import {
|
|
|
67
67
|
AtomicBEEF,
|
|
68
68
|
BEEF
|
|
69
69
|
} from '@bsv/sdk'
|
|
70
|
-
import
|
|
71
|
-
sdk,
|
|
72
|
-
toWalletNetwork,
|
|
73
|
-
Monitor,
|
|
74
|
-
WalletStorageManager,
|
|
75
|
-
WalletSigner,
|
|
76
|
-
randomBytesBase64,
|
|
77
|
-
ScriptTemplateBRC29
|
|
78
|
-
} from './index.client'
|
|
70
|
+
import * as sdk from './sdk'
|
|
79
71
|
import { acquireDirectCertificate } from './signer/methods/acquireDirectCertificate'
|
|
80
72
|
import { proveCertificate } from './signer/methods/proveCertificate'
|
|
81
73
|
import { createAction, CreateActionResultX } from './signer/methods/createAction'
|
|
@@ -89,8 +81,14 @@ import {
|
|
|
89
81
|
specOpInvalidChange,
|
|
90
82
|
specOpNoSendActions,
|
|
91
83
|
specOpSetWalletChangeParams,
|
|
84
|
+
specOpThrowReviewActions,
|
|
92
85
|
specOpWalletBalance
|
|
93
86
|
} from './sdk'
|
|
87
|
+
import { WalletStorageManager } from './storage/WalletStorageManager'
|
|
88
|
+
import { Monitor } from './monitor/Monitor'
|
|
89
|
+
import { WalletSigner } from './signer/WalletSigner'
|
|
90
|
+
import { randomBytesBase64, toWalletNetwork } from './utility/utilityHelpers'
|
|
91
|
+
import { ScriptTemplateBRC29 } from './utility/ScriptTemplateBRC29'
|
|
94
92
|
|
|
95
93
|
export interface WalletArgs {
|
|
96
94
|
chain: sdk.Chain
|
|
@@ -682,6 +680,9 @@ export class Wallet implements WalletInterface, ProtoWallet {
|
|
|
682
680
|
}
|
|
683
681
|
|
|
684
682
|
const { auth, vargs } = this.validateAuthAndArgs(args, sdk.validateCreateActionArgs)
|
|
683
|
+
|
|
684
|
+
if (vargs.labels.indexOf(specOpThrowReviewActions) >= 0) throwDummyReviewActions()
|
|
685
|
+
|
|
685
686
|
vargs.includeAllSourceTransactions = this.includeAllSourceTransactions
|
|
686
687
|
if (this.randomVals && this.randomVals.length > 1) {
|
|
687
688
|
vargs.randomVals = [...this.randomVals]
|
|
@@ -994,3 +995,34 @@ function throwIfAnyUnsuccessfulSignActions(r: SignActionResultX) {
|
|
|
994
995
|
|
|
995
996
|
throw new sdk.WERR_REVIEW_ACTIONS(ndrs, swrs, r.txid, r.tx)
|
|
996
997
|
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Throws a WERR_REVIEW_ACTIONS with a full set of properties to test data formats and propagation.
|
|
1001
|
+
*/
|
|
1002
|
+
function throwDummyReviewActions() {
|
|
1003
|
+
const b58Beef =
|
|
1004
|
+
'gno9MC7VXii1KoCkc2nsVyYJpqzN3dhBzYATETJcys62emMKfpBof4R7GozwYEaSapUtnNvqQ57aaYYjm3U2dv9eUJ1sV46boHkQgppYmAz9YH8FdZduV8aJayPViaKcyPmbDhEw6UW8TM5iFZLXNs7HBnJHUKCeTdNK4FUEL7vAugxAV9WUUZ43BZjJk2SmSeps9TCXjt1Ci9fKWp3d9QSoYvTpxwzyUFHjRKtbUgwq55ZfkBp5bV2Bpz9qSuKywKewW7Hh4S1nCUScwwzpKDozb3zic1V9p2k8rQxoPsRxjUJ8bjhNDdsN8d7KukFuc3n47fXzdWttvnxwsujLJRGnQbgJuknQqx3KLf5kJXHzwjG6TzigZk2t24qeB6d3hbYiaDr2fFkUJBL3tukTHhfNkQYRXuz3kucVDzvejHyqJaF51mXG8BjMN5aQj91ZJXCaPVqkMWCzmvyaqmXMdRiJdSAynhXbQK91xf6RwdNhz1tg5f9B6oJJMhsi9UYSVymmax8VLKD9AKzBCBDcfyD83m3jyS1VgKGZn3SkQmr6bsoWq88L3GsMnnmYUGogvdAYarTqg3pzkjCMxHzmJBMN6ofnUk8c1sRTXQue7BbyUaN5uZu3KW6CmFsEfpuqVvnqFW93TU1jrPP2S8yz8AexAnARPCKE8Yz7RfVaT6RCavwQKL3u5iookwRWEZXW1QWmM37yJWHD87SjVynyg327a1CLwcBxmE2CB48QeNVGyQki4CTQMqw2o8TMhDPJej1g68oniAjBcxBLSCs7KGvK3k7AfrHbCMULX9CTibYhCjdFjbsbBoocqJpxxcvkMo1fEEiAzZuiBVZQDYktDdTVbhKHvYkW25HcYX75NJrpNAhm7AjFeKLzEVxqAQkMfvTufpESNRZF4kQqg2Rg8h2ajcKTd5cpEPwXCrZLHm4EaZEmZVbg3QNfGhn7BJu1bHMtLqPD4y8eJxm2uGrW6saf6qKYmmu64F8A667NbD4yskPRQ1S863VzwGpxxmgLc1Ta3R46jEqsAoRDoZVUaCgBBZG3Yg1CTgi1EVBMXU7qvY4n3h8o2FLCEMWY4KadnV3iD4FbcdCmg4yxBosNAZgbPjhgGjCimjh4YsLd9zymGLmivmz2ZBg5m3xaiXT9NN81X9C1JUujd'
|
|
1005
|
+
const beef = Beef.fromBinary(Utils.fromBase58(b58Beef))
|
|
1006
|
+
const btx = beef.txs.slice(-1)[0]
|
|
1007
|
+
const txid = btx.txid
|
|
1008
|
+
debugger
|
|
1009
|
+
throw new sdk.WERR_REVIEW_ACTIONS(
|
|
1010
|
+
[
|
|
1011
|
+
{
|
|
1012
|
+
txid, // only care that it is syntactically a txid
|
|
1013
|
+
status: 'doubleSpend',
|
|
1014
|
+
competingTxs: [txid], // a txid in the beef
|
|
1015
|
+
competingBeef: beef.toBinary()
|
|
1016
|
+
}
|
|
1017
|
+
],
|
|
1018
|
+
[
|
|
1019
|
+
{
|
|
1020
|
+
txid,
|
|
1021
|
+
status: 'failed'
|
|
1022
|
+
}
|
|
1023
|
+
],
|
|
1024
|
+
txid,
|
|
1025
|
+
beef.toBinaryAtomic(txid),
|
|
1026
|
+
[`${txid}.0`]
|
|
1027
|
+
)
|
|
1028
|
+
}
|
package/src/index.client.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
export * as sdk from './sdk/index'
|
|
2
2
|
export * from './utility/index.client'
|
|
3
|
-
export * from './Wallet'
|
|
4
3
|
export * from './signer/WalletSigner'
|
|
5
|
-
export * from './storage/index.client'
|
|
6
|
-
export * from './services/Services'
|
|
7
|
-
export * from './monitor/Monitor'
|
|
8
4
|
export * from './WalletPermissionsManager'
|
|
9
5
|
export * from './CWIStyleWalletManager'
|
|
10
6
|
export * from './WalletAuthenticationManager'
|
|
11
|
-
export * from './sdk/PrivilegedKeyManager'
|
|
12
|
-
export * from './SimpleWalletManager'
|
|
13
7
|
export * from './wab-client/WABClient'
|
|
14
8
|
export * from './wab-client/auth-method-interactors/TwilioPhoneInteractor'
|
|
15
9
|
export * from './wab-client/auth-method-interactors/PersonaIDInteractor'
|
|
16
10
|
export * from './wab-client/auth-method-interactors/AuthMethodInteractor'
|
|
11
|
+
export * from './services/Services'
|
|
12
|
+
export * from './sdk/PrivilegedKeyManager'
|
|
13
|
+
export * from './SimpleWalletManager'
|
|
14
|
+
export * from './storage/index.client'
|
|
15
|
+
export * from './Wallet'
|
package/src/monitor/Monitor.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as sdk from '../sdk'
|
|
2
|
+
import { Services } from '../services'
|
|
3
|
+
import { wait } from '../utility/utilityHelpers'
|
|
2
4
|
import { BlockHeader, ChaintracksServiceClient } from '../services/chaintracker'
|
|
5
|
+
|
|
6
|
+
import { WalletMonitorTask } from './tasks/WalletMonitorTask'
|
|
7
|
+
import { WalletStorageManager } from '../storage/WalletStorageManager'
|
|
8
|
+
|
|
3
9
|
import { TaskPurge, TaskPurgeParams } from './tasks/TaskPurge'
|
|
4
10
|
import { TaskReviewStatus } from './tasks/TaskReviewStatus'
|
|
5
11
|
import { TaskSyncWhenIdle } from './tasks/TaskSyncWhenIdle'
|
|
6
12
|
import { TaskFailAbandoned } from './tasks/TaskFailAbandoned'
|
|
7
13
|
import { TaskCheckForProofs } from './tasks/TaskCheckForProofs'
|
|
8
|
-
import { TaskSendWaiting } from './tasks/TaskSendWaiting'
|
|
9
|
-
import { WalletMonitorTask } from './tasks/WalletMonitorTask'
|
|
10
14
|
import { TaskClock } from './tasks/TaskClock'
|
|
11
|
-
import { TaskNewHeader
|
|
12
|
-
|
|
15
|
+
import { TaskNewHeader } from './tasks/TaskNewHeader'
|
|
16
|
+
|
|
17
|
+
import { TaskSendWaiting } from './tasks/TaskSendWaiting'
|
|
13
18
|
import { TaskCheckNoSends } from './tasks/TaskCheckNoSends'
|
|
14
19
|
|
|
15
20
|
export type MonitorStorage = WalletStorageManager
|
|
16
|
-
//export type MonitorStorage = sdk.WalletStorage
|
|
17
|
-
//export type MonitorStorage = sdk.WalletStorage
|
|
18
21
|
|
|
19
22
|
export interface MonitorOptions {
|
|
20
23
|
chain: sdk.Chain
|
|
@@ -130,7 +133,6 @@ export class Monitor {
|
|
|
130
133
|
// No purging until invalid transactions are really invalid...
|
|
131
134
|
//this._tasks.push(new TaskPurge(this, this.defaultPurgeParams, 6 * this.oneHour))
|
|
132
135
|
this._tasks.push(new TaskReviewStatus(this))
|
|
133
|
-
this._tasks.push(new TaskUnFail(this))
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
/**
|
|
@@ -147,7 +149,6 @@ export class Monitor {
|
|
|
147
149
|
// No purging until invalid transactions are really invalid...
|
|
148
150
|
//this._tasks.push(new TaskPurge(this, this.defaultPurgeParams, 6 * this.oneHour))
|
|
149
151
|
this._tasks.push(new TaskReviewStatus(this))
|
|
150
|
-
this._tasks.push(new TaskUnFail(this))
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
addTask(task: WalletMonitorTask): void {
|
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
WalletStorageManager
|
|
10
10
|
} from '../index.all'
|
|
11
11
|
|
|
12
|
+
// This task is not "client" compatible as it imports StorageKnex
|
|
13
|
+
import { TaskUnFail } from './tasks/TaskUnFail'
|
|
14
|
+
|
|
12
15
|
import { Knex, knex as makeKnex } from 'knex'
|
|
13
16
|
|
|
14
17
|
import dotenv from 'dotenv'
|
|
@@ -115,6 +118,7 @@ export class MonitorDaemon {
|
|
|
115
118
|
|
|
116
119
|
if (a.monitor._tasks.length === 0) {
|
|
117
120
|
a.monitor.addMultiUserTasks()
|
|
121
|
+
a.monitor.addTask(new TaskUnFail(a.monitor))
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetMerklePathResult } from '../../sdk'
|
|
2
|
+
import { EntityProvenTx, EntityProvenTxReq } from '../../storage/schema/entities'
|
|
3
|
+
import { TableProvenTxReq } from '../../storage/schema/tables'
|
|
4
|
+
import { doubleSha256BE } from '../../utility/utilityHelpers'
|
|
5
|
+
import { asString } from '../../utility/utilityHelpers.noBuffer'
|
|
2
6
|
import { Monitor } from '../Monitor'
|
|
3
7
|
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
4
8
|
|
|
@@ -156,7 +160,7 @@ export async function getProofs(
|
|
|
156
160
|
|
|
157
161
|
const since = new Date()
|
|
158
162
|
|
|
159
|
-
let r:
|
|
163
|
+
let r: GetMerklePathResult
|
|
160
164
|
let ptx: EntityProvenTx | undefined
|
|
161
165
|
|
|
162
166
|
// External services will try multiple providers until one returns a proof,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockHeader } from '../../services/chaintracker/chaintracks/BlockHeaderApi'
|
|
2
2
|
import { Monitor } from '../Monitor'
|
|
3
|
-
import { TaskCheckForProofs } from './TaskCheckForProofs'
|
|
4
3
|
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
5
4
|
|
|
6
5
|
export class TaskNewHeader extends WalletMonitorTask {
|
|
7
6
|
static taskName = 'NewHeader'
|
|
8
|
-
header?:
|
|
7
|
+
header?: BlockHeader
|
|
9
8
|
|
|
10
9
|
constructor(
|
|
11
10
|
monitor: Monitor,
|
|
@@ -14,7 +13,7 @@ export class TaskNewHeader extends WalletMonitorTask {
|
|
|
14
13
|
super(monitor, TaskNewHeader.taskName)
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
async getHeader(): Promise<
|
|
16
|
+
async getHeader(): Promise<BlockHeader> {
|
|
18
17
|
return await this.monitor.chaintracks.findChainTipHeader()
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PurgeParams } from '../../sdk/WalletStorage.interfaces'
|
|
2
2
|
import { Monitor } from '../Monitor'
|
|
3
3
|
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
4
4
|
|
|
@@ -27,7 +27,7 @@ import { WalletMonitorTask } from './WalletMonitorTask'
|
|
|
27
27
|
* + Delete mapi_responses records
|
|
28
28
|
* + proven_tx_reqs table delete records
|
|
29
29
|
*/
|
|
30
|
-
export interface TaskPurgeParams extends
|
|
30
|
+
export interface TaskPurgeParams extends PurgeParams {}
|
|
31
31
|
|
|
32
32
|
export class TaskPurge extends WalletMonitorTask {
|
|
33
33
|
static taskName = 'Purge'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Transaction, Utils } from '@bsv/sdk'
|
|
2
|
-
import { EntityProvenTxReq, sdk, TableProvenTxReq } from '../../index.client'
|
|
3
2
|
import { Monitor } from '../Monitor'
|
|
4
3
|
import { WalletMonitorTask } from './WalletMonitorTask'
|
|
5
4
|
import { StorageKnex } from '../../storage/StorageKnex'
|
|
5
|
+
import { TableProvenTxReq } from '../../storage/schema/tables'
|
|
6
|
+
import { EntityProvenTxReq } from '../../storage/schema/entities'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Setting provenTxReq status to 'unfail' when 'invalid' will attempt to find a merklePath, and if successful:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ArcConfig, Beef, Transaction as BsvTransaction, ChainTracker, MerklePath } from '@bsv/sdk'
|
|
2
|
-
import { sdk } from '../index.client'
|
|
3
2
|
import { ChaintracksServiceClient } from '../services/chaintracker'
|
|
3
|
+
import { Chain, ReqHistoryNote } from './types'
|
|
4
|
+
import { WalletError } from './WalletError'
|
|
4
5
|
/**
|
|
5
6
|
* Defines standard interfaces to access functionality implemented by external transaction processing services.
|
|
6
7
|
*/
|
|
@@ -8,7 +9,7 @@ export interface WalletServices {
|
|
|
8
9
|
/**
|
|
9
10
|
* The chain being serviced.
|
|
10
11
|
*/
|
|
11
|
-
chain:
|
|
12
|
+
chain: Chain
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @returns standard `ChainTracker` service which requires `options.chaintracks` be valid.
|
|
@@ -107,7 +108,7 @@ export interface WalletServices {
|
|
|
107
108
|
* @param txids
|
|
108
109
|
* @param useNext
|
|
109
110
|
*/
|
|
110
|
-
getStatusForTxids(txids: string[], useNext?: boolean): Promise<
|
|
111
|
+
getStatusForTxids(txids: string[], useNext?: boolean): Promise<GetStatusForTxidsResult>
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
114
|
* Attempts to determine the UTXO status of a transaction output.
|
|
@@ -131,13 +132,13 @@ export interface WalletServices {
|
|
|
131
132
|
useNext?: boolean
|
|
132
133
|
): Promise<GetUtxoStatusResult>
|
|
133
134
|
|
|
134
|
-
getScriptHashHistory(hash: string, useNext?: boolean): Promise<
|
|
135
|
+
getScriptHashHistory(hash: string, useNext?: boolean): Promise<GetScriptHashHistoryResult>
|
|
135
136
|
|
|
136
137
|
/**
|
|
137
138
|
* @returns a block header
|
|
138
139
|
* @param hash block hash
|
|
139
140
|
*/
|
|
140
|
-
hashToHeader(hash: string): Promise<
|
|
141
|
+
hashToHeader(hash: string): Promise<BlockHeader>
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
144
|
* @returns whether the locktime value allows the transaction to be mined at the current chain height
|
|
@@ -162,7 +163,7 @@ export interface FiatExchangeRates {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
export interface WalletServicesOptions {
|
|
165
|
-
chain:
|
|
166
|
+
chain: Chain
|
|
166
167
|
taalApiKey?: string
|
|
167
168
|
bitailsApiKey?: string
|
|
168
169
|
whatsOnChainApiKey?: string
|
|
@@ -187,8 +188,8 @@ export interface GetStatusForTxidsResult {
|
|
|
187
188
|
/**
|
|
188
189
|
* The first exception error that occurred during processing, if any.
|
|
189
190
|
*/
|
|
190
|
-
error?:
|
|
191
|
-
results:
|
|
191
|
+
error?: WalletError
|
|
192
|
+
results: StatusForTxidResult[]
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
export interface StatusForTxidResult {
|
|
@@ -225,7 +226,7 @@ export interface GetRawTxResult {
|
|
|
225
226
|
/**
|
|
226
227
|
* The first exception error that occurred during processing, if any.
|
|
227
228
|
*/
|
|
228
|
-
error?:
|
|
229
|
+
error?: WalletError
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
/**
|
|
@@ -247,9 +248,9 @@ export interface GetMerklePathResult {
|
|
|
247
248
|
/**
|
|
248
249
|
* The first exception error that occurred during processing, if any.
|
|
249
250
|
*/
|
|
250
|
-
error?:
|
|
251
|
+
error?: WalletError
|
|
251
252
|
|
|
252
|
-
notes?:
|
|
253
|
+
notes?: ReqHistoryNote[]
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
export interface PostTxResultForTxid {
|
|
@@ -281,7 +282,7 @@ export interface PostTxResultForTxid {
|
|
|
281
282
|
|
|
282
283
|
data?: object | string | PostTxResultForTxidError
|
|
283
284
|
|
|
284
|
-
notes?:
|
|
285
|
+
notes?: ReqHistoryNote[]
|
|
285
286
|
|
|
286
287
|
/**
|
|
287
288
|
* true iff service was unable to process a potentially valid transaction
|
|
@@ -311,7 +312,7 @@ export interface PostTxsResult {
|
|
|
311
312
|
*/
|
|
312
313
|
status: 'success' | 'error'
|
|
313
314
|
|
|
314
|
-
error?:
|
|
315
|
+
error?: WalletError
|
|
315
316
|
|
|
316
317
|
txidResults: PostTxResultForTxid[]
|
|
317
318
|
|
|
@@ -320,7 +321,7 @@ export interface PostTxsResult {
|
|
|
320
321
|
*/
|
|
321
322
|
data?: object
|
|
322
323
|
|
|
323
|
-
notes?:
|
|
324
|
+
notes?: ReqHistoryNote[]
|
|
324
325
|
}
|
|
325
326
|
|
|
326
327
|
export interface GetUtxoStatusDetails {
|
|
@@ -363,7 +364,7 @@ export interface GetUtxoStatusResult {
|
|
|
363
364
|
/**
|
|
364
365
|
* When status is 'error', provides code and description
|
|
365
366
|
*/
|
|
366
|
-
error?:
|
|
367
|
+
error?: WalletError
|
|
367
368
|
/**
|
|
368
369
|
* true if the output is associated with at least one unspent transaction output
|
|
369
370
|
*/
|
|
@@ -395,7 +396,7 @@ export interface GetScriptHashHistoryResult {
|
|
|
395
396
|
/**
|
|
396
397
|
* When status is 'error', provides code and description
|
|
397
398
|
*/
|
|
398
|
-
error?:
|
|
399
|
+
error?: WalletError
|
|
399
400
|
/**
|
|
400
401
|
* Transaction txid (and height if mined) that consumes the script hash. May not be a complete history.
|
|
401
402
|
*/
|
|
@@ -455,13 +456,13 @@ export type GetUtxoStatusService = (
|
|
|
455
456
|
outpoint?: string
|
|
456
457
|
) => Promise<GetUtxoStatusResult>
|
|
457
458
|
|
|
458
|
-
export type GetStatusForTxidsService = (txids: string[]) => Promise<
|
|
459
|
+
export type GetStatusForTxidsService = (txids: string[]) => Promise<GetStatusForTxidsResult>
|
|
459
460
|
|
|
460
461
|
export type GetScriptHashHistoryService = (hash: string) => Promise<GetScriptHashHistoryResult>
|
|
461
462
|
|
|
462
463
|
export type GetMerklePathService = (txid: string, services: WalletServices) => Promise<GetMerklePathResult>
|
|
463
464
|
|
|
464
|
-
export type GetRawTxService = (txid: string, chain:
|
|
465
|
+
export type GetRawTxService = (txid: string, chain: Chain) => Promise<GetRawTxResult>
|
|
465
466
|
|
|
466
467
|
export type PostTxsService = (beef: Beef, txids: string[], services: WalletServices) => Promise<PostTxsResult>
|
|
467
468
|
|
|
@@ -1,38 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
AbortActionResult,
|
|
4
|
-
AcquireCertificateArgs,
|
|
5
|
-
AcquireCertificateResult,
|
|
6
|
-
CreateActionArgs,
|
|
7
|
-
CreateActionResult,
|
|
8
|
-
DiscoverByAttributesArgs,
|
|
9
|
-
DiscoverByIdentityKeyArgs,
|
|
10
|
-
DiscoverCertificatesResult,
|
|
11
|
-
InternalizeActionArgs,
|
|
12
|
-
InternalizeActionResult,
|
|
13
|
-
KeyDeriverApi,
|
|
14
|
-
ListActionsArgs,
|
|
15
|
-
ListActionsResult,
|
|
16
|
-
ListCertificatesArgs,
|
|
17
|
-
ListCertificatesResult,
|
|
18
|
-
ListOutputsArgs,
|
|
19
|
-
ListOutputsResult,
|
|
20
|
-
ProveCertificateArgs,
|
|
21
|
-
ProveCertificateResult,
|
|
22
|
-
RelinquishCertificateArgs,
|
|
23
|
-
RelinquishCertificateResult,
|
|
24
|
-
RelinquishOutputArgs,
|
|
25
|
-
RelinquishOutputResult,
|
|
26
|
-
SignActionArgs,
|
|
27
|
-
SignActionResult
|
|
28
|
-
} from '@bsv/sdk'
|
|
29
|
-
import { sdk } from '../index.client'
|
|
1
|
+
import { KeyDeriverApi } from '@bsv/sdk'
|
|
2
|
+
import { Chain } from './types'
|
|
30
3
|
|
|
31
4
|
/**
|
|
32
5
|
*/
|
|
33
6
|
export interface WalletSigner {
|
|
34
7
|
isWalletSigner: true
|
|
35
8
|
|
|
36
|
-
chain:
|
|
9
|
+
chain: Chain
|
|
37
10
|
keyDeriver: KeyDeriverApi
|
|
38
11
|
}
|