@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/docs/wallet.md
CHANGED
|
@@ -13,68 +13,64 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
13
13
|
|
|
14
14
|
| | | |
|
|
15
15
|
| --- | --- | --- |
|
|
16
|
-
| [ArcConfig](#interface-arcconfig) | [
|
|
17
|
-
| [ArcMinerGetTxData](#interface-arcminergettxdata) | [
|
|
18
|
-
| [AuthId](#interface-authid) | [
|
|
19
|
-
| [AuthPayload](#interface-authpayload) | [
|
|
20
|
-
| [BaseBlockHeader](#interface-baseblockheader) | [
|
|
21
|
-
| [
|
|
22
|
-
| [
|
|
23
|
-
| [
|
|
24
|
-
| [
|
|
25
|
-
| [
|
|
26
|
-
| [
|
|
27
|
-
| [
|
|
28
|
-
| [
|
|
29
|
-
| [
|
|
30
|
-
| [
|
|
31
|
-
| [
|
|
32
|
-
| [
|
|
33
|
-
| [
|
|
34
|
-
| [
|
|
35
|
-
| [
|
|
36
|
-
| [
|
|
37
|
-
| [
|
|
38
|
-
| [
|
|
39
|
-
| [
|
|
40
|
-
| [
|
|
41
|
-
| [
|
|
42
|
-
| [
|
|
43
|
-
| [
|
|
44
|
-
| [
|
|
45
|
-
| [
|
|
46
|
-
| [
|
|
47
|
-
| [
|
|
48
|
-
| [
|
|
49
|
-
| [
|
|
50
|
-
| [
|
|
51
|
-
| [
|
|
52
|
-
| [
|
|
53
|
-
| [
|
|
54
|
-
| [
|
|
55
|
-
| [
|
|
56
|
-
| [
|
|
57
|
-
| [
|
|
58
|
-
| [
|
|
59
|
-
| [
|
|
60
|
-
| [
|
|
61
|
-
| [
|
|
62
|
-
| [
|
|
63
|
-
| [
|
|
64
|
-
| [
|
|
65
|
-
| [
|
|
66
|
-
| [
|
|
67
|
-
| [
|
|
68
|
-
| [
|
|
69
|
-
| [
|
|
70
|
-
| [
|
|
71
|
-
| [
|
|
72
|
-
| [
|
|
73
|
-
| [
|
|
74
|
-
| [Paged](#interface-paged) | [TableOutputTag](#interface-tableoutputtag) | [WalletTheme](#interface-wallettheme) |
|
|
75
|
-
| [PendingSignAction](#interface-pendingsignaction) | [TableOutputTagMap](#interface-tableoutputtagmap) | [XValidCreateActionOutput](#interface-xvalidcreateactionoutput) |
|
|
76
|
-
| [PendingStorageInput](#interface-pendingstorageinput) | [TableOutputX](#interface-tableoutputx) | |
|
|
77
|
-
| [PermissionRequest](#interface-permissionrequest) | [TableProvenTx](#interface-tableproventx) | |
|
|
16
|
+
| [ArcConfig](#interface-arcconfig) | [OutPoint](#interface-outpoint) | [TableProvenTxReqDynamics](#interface-tableproventxreqdynamics) |
|
|
17
|
+
| [ArcMinerGetTxData](#interface-arcminergettxdata) | [Paged](#interface-paged) | [TableSettings](#interface-tablesettings) |
|
|
18
|
+
| [AuthId](#interface-authid) | [PendingSignAction](#interface-pendingsignaction) | [TableSyncState](#interface-tablesyncstate) |
|
|
19
|
+
| [AuthPayload](#interface-authpayload) | [PendingStorageInput](#interface-pendingstorageinput) | [TableTransaction](#interface-tabletransaction) |
|
|
20
|
+
| [BaseBlockHeader](#interface-baseblockheader) | [PermissionRequest](#interface-permissionrequest) | [TableTxLabel](#interface-tabletxlabel) |
|
|
21
|
+
| [BaseBlockHeader](#interface-baseblockheader) | [PermissionToken](#interface-permissiontoken) | [TableTxLabelMap](#interface-tabletxlabelmap) |
|
|
22
|
+
| [BitailsConfig](#interface-bitailsconfig) | [PermissionsManagerConfig](#interface-permissionsmanagerconfig) | [TableUser](#interface-tableuser) |
|
|
23
|
+
| [BitailsMerkleProof](#interface-bitailsmerkleproof) | [PostBeefResult](#interface-postbeefresult) | [TaskPurgeParams](#interface-taskpurgeparams) |
|
|
24
|
+
| [BlockHeader](#interface-blockheader) | [PostBeefResultForTxidApi](#interface-postbeefresultfortxidapi) | [TrustSettings](#interface-trustsettings) |
|
|
25
|
+
| [BlockHeader](#interface-blockheader) | [PostReqsToNetworkDetails](#interface-postreqstonetworkdetails) | [TrxToken](#interface-trxtoken) |
|
|
26
|
+
| [BsvExchangeRate](#interface-bsvexchangerate) | [PostReqsToNetworkResult](#interface-postreqstonetworkresult) | [TscMerkleProofApi](#interface-tscmerkleproofapi) |
|
|
27
|
+
| [CertOpsWallet](#interface-certopswallet) | [PostTxResultForTxid](#interface-posttxresultfortxid) | [TxScriptOffsets](#interface-txscriptoffsets) |
|
|
28
|
+
| [Certifier](#interface-certifier) | [PostTxResultForTxidError](#interface-posttxresultfortxiderror) | [UMPToken](#interface-umptoken) |
|
|
29
|
+
| [CommitNewTxResults](#interface-commitnewtxresults) | [PostTxsResult](#interface-posttxsresult) | [UMPTokenInteractor](#interface-umptokeninteractor) |
|
|
30
|
+
| [CompleteAuthResponse](#interface-completeauthresponse) | [ProcessSyncChunkResult](#interface-processsyncchunkresult) | [UpdateProvenTxReqWithNewProvenTxArgs](#interface-updateproventxreqwithnewproventxargs) |
|
|
31
|
+
| [CreateActionResultX](#interface-createactionresultx) | [ProvenOrRawTx](#interface-provenorrawtx) | [UpdateProvenTxReqWithNewProvenTxResult](#interface-updateproventxreqwithnewproventxresult) |
|
|
32
|
+
| [EntitySyncMap](#interface-entitysyncmap) | [ProvenTxFromTxidResult](#interface-proventxfromtxidresult) | [ValidAbortActionArgs](#interface-validabortactionargs) |
|
|
33
|
+
| [EntityTimeStamp](#interface-entitytimestamp) | [ProvenTxReqHistory](#interface-proventxreqhistory) | [ValidAcquireCertificateArgs](#interface-validacquirecertificateargs) |
|
|
34
|
+
| [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [ProvenTxReqHistorySummaryApi](#interface-proventxreqhistorysummaryapi) | [ValidAcquireDirectCertificateArgs](#interface-validacquiredirectcertificateargs) |
|
|
35
|
+
| [ExtendedVerifiableCertificate](#interface-extendedverifiablecertificate) | [ProvenTxReqNotify](#interface-proventxreqnotify) | [ValidAcquireIssuanceCertificateArgs](#interface-validacquireissuancecertificateargs) |
|
|
36
|
+
| [FiatExchangeRates](#interface-fiatexchangerates) | [PurgeParams](#interface-purgeparams) | [ValidBasketInsertion](#interface-validbasketinsertion) |
|
|
37
|
+
| [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [PurgeResults](#interface-purgeresults) | [ValidCreateActionArgs](#interface-validcreateactionargs) |
|
|
38
|
+
| [FindCertificatesArgs](#interface-findcertificatesargs) | [RequestSyncChunkArgs](#interface-requestsyncchunkargs) | [ValidCreateActionInput](#interface-validcreateactioninput) |
|
|
39
|
+
| [FindCommissionsArgs](#interface-findcommissionsargs) | [ReviewActionResult](#interface-reviewactionresult) | [ValidCreateActionOptions](#interface-validcreateactionoptions) |
|
|
40
|
+
| [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [ScriptTemplateParamsBRC29](#interface-scripttemplateparamsbrc29) | [ValidCreateActionOutput](#interface-validcreateactionoutput) |
|
|
41
|
+
| [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [ScriptTemplateUnlock](#interface-scripttemplateunlock) | [ValidDiscoverByAttributesArgs](#interface-validdiscoverbyattributesargs) |
|
|
42
|
+
| [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [SignActionResultX](#interface-signactionresultx) | [ValidDiscoverByIdentityKeyArgs](#interface-validdiscoverbyidentitykeyargs) |
|
|
43
|
+
| [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [StartAuthResponse](#interface-startauthresponse) | [ValidInternalizeActionArgs](#interface-validinternalizeactionargs) |
|
|
44
|
+
| [FindOutputTagsArgs](#interface-findoutputtagsargs) | [StatusForTxidResult](#interface-statusfortxidresult) | [ValidInternalizeOutput](#interface-validinternalizeoutput) |
|
|
45
|
+
| [FindOutputsArgs](#interface-findoutputsargs) | [StorageCreateActionResult](#interface-storagecreateactionresult) | [ValidListActionsArgs](#interface-validlistactionsargs) |
|
|
46
|
+
| [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [StorageCreateTransactionSdkInput](#interface-storagecreatetransactionsdkinput) | [ValidListCertificatesArgs](#interface-validlistcertificatesargs) |
|
|
47
|
+
| [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [StorageCreateTransactionSdkOutput](#interface-storagecreatetransactionsdkoutput) | [ValidListOutputsArgs](#interface-validlistoutputsargs) |
|
|
48
|
+
| [FindProvenTxsArgs](#interface-findproventxsargs) | [StorageFeeModel](#interface-storagefeemodel) | [ValidProcessActionArgs](#interface-validprocessactionargs) |
|
|
49
|
+
| [FindSincePagedArgs](#interface-findsincepagedargs) | [StorageGetBeefOptions](#interface-storagegetbeefoptions) | [ValidProcessActionOptions](#interface-validprocessactionoptions) |
|
|
50
|
+
| [FindSyncStatesArgs](#interface-findsyncstatesargs) | [StorageIdentity](#interface-storageidentity) | [ValidProveCertificateArgs](#interface-validprovecertificateargs) |
|
|
51
|
+
| [FindTransactionsArgs](#interface-findtransactionsargs) | [StorageInternalizeActionResult](#interface-storageinternalizeactionresult) | [ValidRelinquishCertificateArgs](#interface-validrelinquishcertificateargs) |
|
|
52
|
+
| [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [StorageProcessActionArgs](#interface-storageprocessactionargs) | [ValidRelinquishOutputArgs](#interface-validrelinquishoutputargs) |
|
|
53
|
+
| [FindTxLabelsArgs](#interface-findtxlabelsargs) | [StorageProcessActionResults](#interface-storageprocessactionresults) | [ValidSignActionArgs](#interface-validsignactionargs) |
|
|
54
|
+
| [FindUsersArgs](#interface-findusersargs) | [StorageProvenOrReq](#interface-storageprovenorreq) | [ValidSignActionOptions](#interface-validsignactionoptions) |
|
|
55
|
+
| [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [StorageProviderOptions](#interface-storageprovideroptions) | [ValidWalletPayment](#interface-validwalletpayment) |
|
|
56
|
+
| [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [StorageReaderOptions](#interface-storagereaderoptions) | [ValidWalletSignerArgs](#interface-validwalletsignerargs) |
|
|
57
|
+
| [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [StorageReaderWriterOptions](#interface-storagereaderwriteroptions) | [ValidateGenerateChangeSdkParamsResult](#interface-validategeneratechangesdkparamsresult) |
|
|
58
|
+
| [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [StorageSyncReaderOptions](#interface-storagesyncreaderoptions) | [WalletArgs](#interface-walletargs) |
|
|
59
|
+
| [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [SyncChunk](#interface-syncchunk) | [WalletBalance](#interface-walletbalance) |
|
|
60
|
+
| [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [SyncError](#interface-syncerror) | [WalletPermissionsManagerCallbacks](#interface-walletpermissionsmanagercallbacks) |
|
|
61
|
+
| [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [SyncMap](#interface-syncmap) | [WalletServices](#interface-walletservices) |
|
|
62
|
+
| [GetMerklePathResult](#interface-getmerklepathresult) | [TableCertificate](#interface-tablecertificate) | [WalletServicesOptions](#interface-walletservicesoptions) |
|
|
63
|
+
| [GetRawTxResult](#interface-getrawtxresult) | [TableCertificateField](#interface-tablecertificatefield) | [WalletSettings](#interface-walletsettings) |
|
|
64
|
+
| [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [TableCertificateX](#interface-tablecertificatex) | [WalletSettingsManagerConfig](#interface-walletsettingsmanagerconfig) |
|
|
65
|
+
| [GetReqsAndBeefResult](#interface-getreqsandbeefresult) | [TableCommission](#interface-tablecommission) | [WalletSigner](#interface-walletsigner) |
|
|
66
|
+
| [GetScriptHashHistory](#interface-getscripthashhistory) | [TableMonitorEvent](#interface-tablemonitorevent) | [WalletStorage](#interface-walletstorage) |
|
|
67
|
+
| [GetScriptHashHistoryResult](#interface-getscripthashhistoryresult) | [TableOutput](#interface-tableoutput) | [WalletStorageProvider](#interface-walletstorageprovider) |
|
|
68
|
+
| [GetStatusForTxidsResult](#interface-getstatusfortxidsresult) | [TableOutputBasket](#interface-tableoutputbasket) | [WalletStorageReader](#interface-walletstoragereader) |
|
|
69
|
+
| [GetUtxoStatusDetails](#interface-getutxostatusdetails) | [TableOutputTag](#interface-tableoutputtag) | [WalletStorageSync](#interface-walletstoragesync) |
|
|
70
|
+
| [GetUtxoStatusResult](#interface-getutxostatusresult) | [TableOutputTagMap](#interface-tableoutputtagmap) | [WalletStorageSyncReader](#interface-walletstoragesyncreader) |
|
|
71
|
+
| [KeyPair](#interface-keypair) | [TableOutputX](#interface-tableoutputx) | [WalletStorageWriter](#interface-walletstoragewriter) |
|
|
72
|
+
| [LiveBlockHeader](#interface-liveblockheader) | [TableProvenTx](#interface-tableproventx) | [WalletTheme](#interface-wallettheme) |
|
|
73
|
+
| [MonitorOptions](#interface-monitoroptions) | [TableProvenTxReq](#interface-tableproventxreq) | [XValidCreateActionOutput](#interface-xvalidcreateactionoutput) |
|
|
78
74
|
|
|
79
75
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
80
76
|
|
|
@@ -263,6 +259,75 @@ version: number
|
|
|
263
259
|
|
|
264
260
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
265
261
|
|
|
262
|
+
---
|
|
263
|
+
##### Interface: BaseBlockHeader
|
|
264
|
+
|
|
265
|
+
These are fields of 80 byte serialized header in order whose double sha256 hash is a block's hash value
|
|
266
|
+
and the next block's previousHash value.
|
|
267
|
+
|
|
268
|
+
All block hash values and merkleRoot values are 32 byte hex string values with the byte order reversed from the serialized byte order.
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
export interface BaseBlockHeader {
|
|
272
|
+
version: number;
|
|
273
|
+
previousHash: string;
|
|
274
|
+
merkleRoot: string;
|
|
275
|
+
time: number;
|
|
276
|
+
bits: number;
|
|
277
|
+
nonce: number;
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
###### Property bits
|
|
282
|
+
|
|
283
|
+
Block header bits value. Serialized length is 4 bytes.
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
bits: number
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
###### Property merkleRoot
|
|
290
|
+
|
|
291
|
+
Root hash of the merkle tree of all transactions in this block. Serialized length is 32 bytes.
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
merkleRoot: string
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
###### Property nonce
|
|
298
|
+
|
|
299
|
+
Block header nonce value. Serialized length is 4 bytes.
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
nonce: number
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
###### Property previousHash
|
|
306
|
+
|
|
307
|
+
Hash of previous block's block header. Serialized length is 32 bytes.
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
previousHash: string
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
###### Property time
|
|
314
|
+
|
|
315
|
+
Block header time value. Serialized length is 4 bytes.
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
time: number
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
###### Property version
|
|
322
|
+
|
|
323
|
+
Block header version value. Serialized length is 4 bytes.
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
version: number
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
330
|
+
|
|
266
331
|
---
|
|
267
332
|
##### Interface: BitailsConfig
|
|
268
333
|
|
|
@@ -317,7 +382,39 @@ export interface BlockHeader extends BaseBlockHeader {
|
|
|
317
382
|
}
|
|
318
383
|
```
|
|
319
384
|
|
|
320
|
-
See also: [BaseBlockHeader](./
|
|
385
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader)
|
|
386
|
+
|
|
387
|
+
###### Property hash
|
|
388
|
+
|
|
389
|
+
The double sha256 hash of the serialized `BaseBlockHeader` fields.
|
|
390
|
+
|
|
391
|
+
```ts
|
|
392
|
+
hash: string
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
###### Property height
|
|
396
|
+
|
|
397
|
+
Height of the header, starting from zero.
|
|
398
|
+
|
|
399
|
+
```ts
|
|
400
|
+
height: number
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
##### Interface: BlockHeader
|
|
407
|
+
|
|
408
|
+
A `BaseBlockHeader` extended with its computed hash and height in its chain.
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
export interface BlockHeader extends BaseBlockHeader {
|
|
412
|
+
height: number;
|
|
413
|
+
hash: string;
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader)
|
|
321
418
|
|
|
322
419
|
###### Property hash
|
|
323
420
|
|
|
@@ -523,7 +620,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
523
620
|
##### Interface: FindCertificateFieldsArgs
|
|
524
621
|
|
|
525
622
|
```ts
|
|
526
|
-
export interface FindCertificateFieldsArgs extends
|
|
623
|
+
export interface FindCertificateFieldsArgs extends FindSincePagedArgs {
|
|
527
624
|
partial: Partial<TableCertificateField>;
|
|
528
625
|
}
|
|
529
626
|
```
|
|
@@ -552,7 +649,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
552
649
|
##### Interface: FindCommissionsArgs
|
|
553
650
|
|
|
554
651
|
```ts
|
|
555
|
-
export interface FindCommissionsArgs extends
|
|
652
|
+
export interface FindCommissionsArgs extends FindSincePagedArgs {
|
|
556
653
|
partial: Partial<TableCommission>;
|
|
557
654
|
}
|
|
558
655
|
```
|
|
@@ -578,7 +675,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
578
675
|
##### Interface: FindMonitorEventsArgs
|
|
579
676
|
|
|
580
677
|
```ts
|
|
581
|
-
export interface FindMonitorEventsArgs extends
|
|
678
|
+
export interface FindMonitorEventsArgs extends FindSincePagedArgs {
|
|
582
679
|
partial: Partial<TableMonitorEvent>;
|
|
583
680
|
}
|
|
584
681
|
```
|
|
@@ -604,7 +701,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
604
701
|
##### Interface: FindOutputTagMapsArgs
|
|
605
702
|
|
|
606
703
|
```ts
|
|
607
|
-
export interface FindOutputTagMapsArgs extends
|
|
704
|
+
export interface FindOutputTagMapsArgs extends FindSincePagedArgs {
|
|
608
705
|
partial: Partial<TableOutputTagMap>;
|
|
609
706
|
tagIds?: number[];
|
|
610
707
|
}
|
|
@@ -618,7 +715,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
618
715
|
##### Interface: FindOutputTagsArgs
|
|
619
716
|
|
|
620
717
|
```ts
|
|
621
|
-
export interface FindOutputTagsArgs extends
|
|
718
|
+
export interface FindOutputTagsArgs extends FindSincePagedArgs {
|
|
622
719
|
partial: Partial<TableOutputTag>;
|
|
623
720
|
}
|
|
624
721
|
```
|
|
@@ -634,7 +731,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
634
731
|
export interface FindOutputsArgs extends FindSincePagedArgs {
|
|
635
732
|
partial: Partial<TableOutput>;
|
|
636
733
|
noScript?: boolean;
|
|
637
|
-
txStatus?:
|
|
734
|
+
txStatus?: TransactionStatus[];
|
|
638
735
|
}
|
|
639
736
|
```
|
|
640
737
|
|
|
@@ -659,9 +756,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
659
756
|
##### Interface: FindProvenTxReqsArgs
|
|
660
757
|
|
|
661
758
|
```ts
|
|
662
|
-
export interface FindProvenTxReqsArgs extends
|
|
759
|
+
export interface FindProvenTxReqsArgs extends FindSincePagedArgs {
|
|
663
760
|
partial: Partial<TableProvenTxReq>;
|
|
664
|
-
status?:
|
|
761
|
+
status?: ProvenTxReqStatus[];
|
|
665
762
|
txids?: string[];
|
|
666
763
|
}
|
|
667
764
|
```
|
|
@@ -674,7 +771,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
674
771
|
##### Interface: FindProvenTxsArgs
|
|
675
772
|
|
|
676
773
|
```ts
|
|
677
|
-
export interface FindProvenTxsArgs extends
|
|
774
|
+
export interface FindProvenTxsArgs extends FindSincePagedArgs {
|
|
678
775
|
partial: Partial<TableProvenTx>;
|
|
679
776
|
}
|
|
680
777
|
```
|
|
@@ -689,8 +786,8 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
689
786
|
```ts
|
|
690
787
|
export interface FindSincePagedArgs {
|
|
691
788
|
since?: Date;
|
|
692
|
-
paged?:
|
|
693
|
-
trx?:
|
|
789
|
+
paged?: Paged;
|
|
790
|
+
trx?: TrxToken;
|
|
694
791
|
}
|
|
695
792
|
```
|
|
696
793
|
|
|
@@ -702,7 +799,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
702
799
|
##### Interface: FindSyncStatesArgs
|
|
703
800
|
|
|
704
801
|
```ts
|
|
705
|
-
export interface FindSyncStatesArgs extends
|
|
802
|
+
export interface FindSyncStatesArgs extends FindSincePagedArgs {
|
|
706
803
|
partial: Partial<TableSyncState>;
|
|
707
804
|
}
|
|
708
805
|
```
|
|
@@ -715,9 +812,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
715
812
|
##### Interface: FindTransactionsArgs
|
|
716
813
|
|
|
717
814
|
```ts
|
|
718
|
-
export interface FindTransactionsArgs extends
|
|
815
|
+
export interface FindTransactionsArgs extends FindSincePagedArgs {
|
|
719
816
|
partial: Partial<TableTransaction>;
|
|
720
|
-
status?:
|
|
817
|
+
status?: TransactionStatus[];
|
|
721
818
|
noRawTx?: boolean;
|
|
722
819
|
}
|
|
723
820
|
```
|
|
@@ -730,7 +827,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
730
827
|
##### Interface: FindTxLabelMapsArgs
|
|
731
828
|
|
|
732
829
|
```ts
|
|
733
|
-
export interface FindTxLabelMapsArgs extends
|
|
830
|
+
export interface FindTxLabelMapsArgs extends FindSincePagedArgs {
|
|
734
831
|
partial: Partial<TableTxLabelMap>;
|
|
735
832
|
labelIds?: number[];
|
|
736
833
|
}
|
|
@@ -744,7 +841,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
744
841
|
##### Interface: FindTxLabelsArgs
|
|
745
842
|
|
|
746
843
|
```ts
|
|
747
|
-
export interface FindTxLabelsArgs extends
|
|
844
|
+
export interface FindTxLabelsArgs extends FindSincePagedArgs {
|
|
748
845
|
partial: Partial<TableTxLabel>;
|
|
749
846
|
}
|
|
750
847
|
```
|
|
@@ -757,7 +854,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
757
854
|
##### Interface: FindUsersArgs
|
|
758
855
|
|
|
759
856
|
```ts
|
|
760
|
-
export interface FindUsersArgs extends
|
|
857
|
+
export interface FindUsersArgs extends FindSincePagedArgs {
|
|
761
858
|
partial: Partial<TableUser>;
|
|
762
859
|
}
|
|
763
860
|
```
|
|
@@ -928,19 +1025,19 @@ export interface GetMerklePathResult {
|
|
|
928
1025
|
name?: string;
|
|
929
1026
|
merklePath?: MerklePath;
|
|
930
1027
|
header?: BlockHeader;
|
|
931
|
-
error?:
|
|
932
|
-
notes?:
|
|
1028
|
+
error?: WalletError;
|
|
1029
|
+
notes?: ReqHistoryNote[];
|
|
933
1030
|
}
|
|
934
1031
|
```
|
|
935
1032
|
|
|
936
|
-
See also: [BlockHeader](./
|
|
1033
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [ReqHistoryNote](./client.md#type-reqhistorynote), [WalletError](./client.md#class-walleterror)
|
|
937
1034
|
|
|
938
1035
|
###### Property error
|
|
939
1036
|
|
|
940
1037
|
The first exception error that occurred during processing, if any.
|
|
941
1038
|
|
|
942
1039
|
```ts
|
|
943
|
-
error?:
|
|
1040
|
+
error?: WalletError
|
|
944
1041
|
```
|
|
945
1042
|
See also: [WalletError](./client.md#class-walleterror)
|
|
946
1043
|
|
|
@@ -973,7 +1070,7 @@ export interface GetRawTxResult {
|
|
|
973
1070
|
txid: string;
|
|
974
1071
|
name?: string;
|
|
975
1072
|
rawTx?: number[];
|
|
976
|
-
error?:
|
|
1073
|
+
error?: WalletError;
|
|
977
1074
|
}
|
|
978
1075
|
```
|
|
979
1076
|
|
|
@@ -984,7 +1081,7 @@ See also: [WalletError](./client.md#class-walleterror)
|
|
|
984
1081
|
The first exception error that occurred during processing, if any.
|
|
985
1082
|
|
|
986
1083
|
```ts
|
|
987
|
-
error?:
|
|
1084
|
+
error?: WalletError
|
|
988
1085
|
```
|
|
989
1086
|
See also: [WalletError](./client.md#class-walleterror)
|
|
990
1087
|
|
|
@@ -1065,7 +1162,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1065
1162
|
export interface GetScriptHashHistoryResult {
|
|
1066
1163
|
name: string;
|
|
1067
1164
|
status: "success" | "error";
|
|
1068
|
-
error?:
|
|
1165
|
+
error?: WalletError;
|
|
1069
1166
|
history: GetScriptHashHistory[];
|
|
1070
1167
|
}
|
|
1071
1168
|
```
|
|
@@ -1077,7 +1174,7 @@ See also: [GetScriptHashHistory](./client.md#interface-getscripthashhistory), [W
|
|
|
1077
1174
|
When status is 'error', provides code and description
|
|
1078
1175
|
|
|
1079
1176
|
```ts
|
|
1080
|
-
error?:
|
|
1177
|
+
error?: WalletError
|
|
1081
1178
|
```
|
|
1082
1179
|
See also: [WalletError](./client.md#class-walleterror)
|
|
1083
1180
|
|
|
@@ -1116,8 +1213,8 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1116
1213
|
export interface GetStatusForTxidsResult {
|
|
1117
1214
|
name: string;
|
|
1118
1215
|
status: "success" | "error";
|
|
1119
|
-
error?:
|
|
1120
|
-
results:
|
|
1216
|
+
error?: WalletError;
|
|
1217
|
+
results: StatusForTxidResult[];
|
|
1121
1218
|
}
|
|
1122
1219
|
```
|
|
1123
1220
|
|
|
@@ -1128,7 +1225,7 @@ See also: [StatusForTxidResult](./client.md#interface-statusfortxidresult), [Wal
|
|
|
1128
1225
|
The first exception error that occurred during processing, if any.
|
|
1129
1226
|
|
|
1130
1227
|
```ts
|
|
1131
|
-
error?:
|
|
1228
|
+
error?: WalletError
|
|
1132
1229
|
```
|
|
1133
1230
|
See also: [WalletError](./client.md#class-walleterror)
|
|
1134
1231
|
|
|
@@ -1203,7 +1300,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
1203
1300
|
export interface GetUtxoStatusResult {
|
|
1204
1301
|
name: string;
|
|
1205
1302
|
status: "success" | "error";
|
|
1206
|
-
error?:
|
|
1303
|
+
error?: WalletError;
|
|
1207
1304
|
isUtxo?: boolean;
|
|
1208
1305
|
details: GetUtxoStatusDetails[];
|
|
1209
1306
|
}
|
|
@@ -1228,7 +1325,7 @@ See also: [GetUtxoStatusDetails](./client.md#interface-getutxostatusdetails)
|
|
|
1228
1325
|
When status is 'error', provides code and description
|
|
1229
1326
|
|
|
1230
1327
|
```ts
|
|
1231
|
-
error?:
|
|
1328
|
+
error?: WalletError
|
|
1232
1329
|
```
|
|
1233
1330
|
See also: [WalletError](./client.md#class-walleterror)
|
|
1234
1331
|
|
|
@@ -1272,40 +1369,68 @@ export interface KeyPair {
|
|
|
1272
1369
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1273
1370
|
|
|
1274
1371
|
---
|
|
1275
|
-
##### Interface:
|
|
1372
|
+
##### Interface: LiveBlockHeader
|
|
1276
1373
|
|
|
1277
|
-
|
|
1374
|
+
The "live" portion of the block chain is recent history that can conceivably be subject to reorganizations.
|
|
1375
|
+
The additional fields support tracking orphan blocks, chain forks, and chain reorgs.
|
|
1278
1376
|
|
|
1279
1377
|
```ts
|
|
1280
|
-
export interface
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1378
|
+
export interface LiveBlockHeader extends BlockHeader {
|
|
1379
|
+
chainWork: string;
|
|
1380
|
+
isChainTip: boolean;
|
|
1381
|
+
isActive: boolean;
|
|
1382
|
+
headerId: number;
|
|
1383
|
+
previousHeaderId: number | null;
|
|
1284
1384
|
}
|
|
1285
1385
|
```
|
|
1286
1386
|
|
|
1287
|
-
|
|
1387
|
+
See also: [BlockHeader](./services.md#interface-blockheader)
|
|
1288
1388
|
|
|
1289
|
-
|
|
1290
|
-
|
|
1389
|
+
###### Property chainWork
|
|
1390
|
+
|
|
1391
|
+
The cummulative chainwork achieved by the addition of this block to the chain.
|
|
1392
|
+
Chainwork only matters in selecting the active chain.
|
|
1291
1393
|
|
|
1292
1394
|
```ts
|
|
1293
|
-
|
|
1294
|
-
chain?: sdk.Chain;
|
|
1295
|
-
sqliteFilename?: string;
|
|
1296
|
-
mySQLConnection?: string;
|
|
1297
|
-
knexConfig?: Knex.Config;
|
|
1298
|
-
knex?: Knex<any, any[]>;
|
|
1299
|
-
storageKnexOptions?: StorageKnexOptions;
|
|
1300
|
-
storageProvider?: StorageProvider;
|
|
1301
|
-
storageManager?: WalletStorageManager;
|
|
1302
|
-
servicesOptions?: sdk.WalletServicesOptions;
|
|
1303
|
-
services?: Services;
|
|
1304
|
-
monitor?: Monitor;
|
|
1305
|
-
}
|
|
1395
|
+
chainWork: string
|
|
1306
1396
|
```
|
|
1307
1397
|
|
|
1308
|
-
|
|
1398
|
+
###### Property headerId
|
|
1399
|
+
|
|
1400
|
+
As there may be more than one header with identical height values due to orphan tracking,
|
|
1401
|
+
headers are assigned a unique headerId while part of the "live" portion of the block chain.
|
|
1402
|
+
|
|
1403
|
+
```ts
|
|
1404
|
+
headerId: number
|
|
1405
|
+
```
|
|
1406
|
+
|
|
1407
|
+
###### Property isActive
|
|
1408
|
+
|
|
1409
|
+
True only if this header is currently on the active chain.
|
|
1410
|
+
|
|
1411
|
+
```ts
|
|
1412
|
+
isActive: boolean
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
###### Property isChainTip
|
|
1416
|
+
|
|
1417
|
+
True only if this header is currently a chain tip. e.g. There is no header that follows it by previousHash or previousHeaderId.
|
|
1418
|
+
|
|
1419
|
+
```ts
|
|
1420
|
+
isChainTip: boolean
|
|
1421
|
+
```
|
|
1422
|
+
|
|
1423
|
+
###### Property previousHeaderId
|
|
1424
|
+
|
|
1425
|
+
Every header in the "live" portion of the block chain is linked to an ancestor header through
|
|
1426
|
+
both its previousHash and previousHeaderId properties.
|
|
1427
|
+
|
|
1428
|
+
Due to forks, there may be multiple headers with identical `previousHash` and `previousHeaderId` values.
|
|
1429
|
+
Of these, only one (the header on the active chain) will have `isActive` === true.
|
|
1430
|
+
|
|
1431
|
+
```ts
|
|
1432
|
+
previousHeaderId: number | null
|
|
1433
|
+
```
|
|
1309
1434
|
|
|
1310
1435
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1311
1436
|
|
|
@@ -1916,7 +2041,7 @@ export interface PostTxResultForTxid {
|
|
|
1916
2041
|
merklePath?: MerklePath;
|
|
1917
2042
|
competingTxs?: string[];
|
|
1918
2043
|
data?: object | string | PostTxResultForTxidError;
|
|
1919
|
-
notes?:
|
|
2044
|
+
notes?: ReqHistoryNote[];
|
|
1920
2045
|
serviceError?: boolean;
|
|
1921
2046
|
}
|
|
1922
2047
|
```
|
|
@@ -1982,10 +2107,10 @@ Properties on array items of result returned from `WalletServices` function `pos
|
|
|
1982
2107
|
export interface PostTxsResult {
|
|
1983
2108
|
name: string;
|
|
1984
2109
|
status: "success" | "error";
|
|
1985
|
-
error?:
|
|
2110
|
+
error?: WalletError;
|
|
1986
2111
|
txidResults: PostTxResultForTxid[];
|
|
1987
2112
|
data?: object;
|
|
1988
|
-
notes?:
|
|
2113
|
+
notes?: ReqHistoryNote[];
|
|
1989
2114
|
}
|
|
1990
2115
|
```
|
|
1991
2116
|
|
|
@@ -2027,7 +2152,7 @@ export interface ProcessSyncChunkResult {
|
|
|
2027
2152
|
maxUpdated_at: Date | undefined;
|
|
2028
2153
|
updates: number;
|
|
2029
2154
|
inserts: number;
|
|
2030
|
-
error?:
|
|
2155
|
+
error?: WalletError;
|
|
2031
2156
|
}
|
|
2032
2157
|
```
|
|
2033
2158
|
|
|
@@ -2304,396 +2429,24 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2304
2429
|
|
|
2305
2430
|
```ts
|
|
2306
2431
|
export interface ScriptTemplateParamsBRC29 {
|
|
2307
|
-
derivationPrefix?: string;
|
|
2308
|
-
derivationSuffix?: string;
|
|
2309
|
-
keyDeriver: KeyDeriverApi;
|
|
2310
|
-
}
|
|
2311
|
-
```
|
|
2312
|
-
|
|
2313
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2314
|
-
|
|
2315
|
-
---
|
|
2316
|
-
##### Interface: ScriptTemplateUnlock
|
|
2317
|
-
|
|
2318
|
-
```ts
|
|
2319
|
-
export interface ScriptTemplateUnlock {
|
|
2320
|
-
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
|
|
2321
|
-
estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
|
|
2322
|
-
}
|
|
2323
|
-
```
|
|
2324
|
-
|
|
2325
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2326
|
-
|
|
2327
|
-
---
|
|
2328
|
-
##### Interface: SetupEnv
|
|
2329
|
-
|
|
2330
|
-
`SetupEnv` provides a starting point for managing secrets that
|
|
2331
|
-
must not appear in source code.
|
|
2332
|
-
|
|
2333
|
-
The `makeEnv` and `getEnv` functions of the `Setup` and `SetupClient` classes
|
|
2334
|
-
provide an easy way to create and import these secrets and related properties.
|
|
2335
|
-
|
|
2336
|
-
```ts
|
|
2337
|
-
export interface SetupEnv {
|
|
2338
|
-
chain: sdk.Chain;
|
|
2339
|
-
identityKey: string;
|
|
2340
|
-
identityKey2: string;
|
|
2341
|
-
filePath: string | undefined;
|
|
2342
|
-
taalApiKey: string;
|
|
2343
|
-
devKeys: Record<string, string>;
|
|
2344
|
-
mySQLConnection: string;
|
|
2345
|
-
}
|
|
2346
|
-
```
|
|
2347
|
-
|
|
2348
|
-
See also: [Chain](./client.md#type-chain)
|
|
2349
|
-
|
|
2350
|
-
###### Property chain
|
|
2351
|
-
|
|
2352
|
-
The chan being accessed: 'main' for mainnet, 'test' for 'testnet'.
|
|
2353
|
-
|
|
2354
|
-
```ts
|
|
2355
|
-
chain: sdk.Chain
|
|
2356
|
-
```
|
|
2357
|
-
See also: [Chain](./client.md#type-chain)
|
|
2358
|
-
|
|
2359
|
-
###### Property devKeys
|
|
2360
|
-
|
|
2361
|
-
A map of public keys (identity keys, hex strings) to private keys (hex strings).
|
|
2362
|
-
|
|
2363
|
-
```ts
|
|
2364
|
-
devKeys: Record<string, string>
|
|
2365
|
-
```
|
|
2366
|
-
|
|
2367
|
-
###### Property filePath
|
|
2368
|
-
|
|
2369
|
-
Filepath to sqlite file to be used for identityKey wallet.
|
|
2370
|
-
|
|
2371
|
-
```ts
|
|
2372
|
-
filePath: string | undefined
|
|
2373
|
-
```
|
|
2374
|
-
|
|
2375
|
-
###### Property identityKey
|
|
2376
|
-
|
|
2377
|
-
The user's primary identity key (public key).
|
|
2378
|
-
|
|
2379
|
-
```ts
|
|
2380
|
-
identityKey: string
|
|
2381
|
-
```
|
|
2382
|
-
|
|
2383
|
-
###### Property identityKey2
|
|
2384
|
-
|
|
2385
|
-
A secondary identity key (public key), used to test exchanges with other users.
|
|
2386
|
-
|
|
2387
|
-
```ts
|
|
2388
|
-
identityKey2: string
|
|
2389
|
-
```
|
|
2390
|
-
|
|
2391
|
-
###### Property mySQLConnection
|
|
2392
|
-
|
|
2393
|
-
A MySQL connection string including user and password properties.
|
|
2394
|
-
Must be valid to make use of MySQL `Setup` class support.
|
|
2395
|
-
|
|
2396
|
-
```ts
|
|
2397
|
-
mySQLConnection: string
|
|
2398
|
-
```
|
|
2399
|
-
|
|
2400
|
-
###### Property taalApiKey
|
|
2401
|
-
|
|
2402
|
-
A vaild TAAL API key for use by `Services`
|
|
2403
|
-
|
|
2404
|
-
```ts
|
|
2405
|
-
taalApiKey: string
|
|
2406
|
-
```
|
|
2407
|
-
|
|
2408
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2409
|
-
|
|
2410
|
-
---
|
|
2411
|
-
##### Interface: SetupWallet
|
|
2412
|
-
|
|
2413
|
-
When creating a BRC-100 compatible `Wallet`, many components come into play.
|
|
2414
|
-
|
|
2415
|
-
All of the `createWallet` functions in the `Setup` and `SetupClient` classes return
|
|
2416
|
-
an object with direct access to each component to facilitate experimentation, testing
|
|
2417
|
-
and customization.
|
|
2418
|
-
|
|
2419
|
-
```ts
|
|
2420
|
-
export interface SetupWallet {
|
|
2421
|
-
rootKey: PrivateKey;
|
|
2422
|
-
identityKey: string;
|
|
2423
|
-
keyDeriver: KeyDeriver;
|
|
2424
|
-
chain: sdk.Chain;
|
|
2425
|
-
storage: WalletStorageManager;
|
|
2426
|
-
services: Services;
|
|
2427
|
-
monitor: Monitor;
|
|
2428
|
-
wallet: Wallet;
|
|
2429
|
-
}
|
|
2430
|
-
```
|
|
2431
|
-
|
|
2432
|
-
See also: [Chain](./client.md#type-chain), [Monitor](./monitor.md#class-monitor), [Services](./services.md#class-services), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager)
|
|
2433
|
-
|
|
2434
|
-
###### Property chain
|
|
2435
|
-
|
|
2436
|
-
The chain ('main' or 'test') which the wallet accesses.
|
|
2437
|
-
|
|
2438
|
-
```ts
|
|
2439
|
-
chain: sdk.Chain
|
|
2440
|
-
```
|
|
2441
|
-
See also: [Chain](./client.md#type-chain)
|
|
2442
|
-
|
|
2443
|
-
###### Property identityKey
|
|
2444
|
-
|
|
2445
|
-
The pubilc key associated with the `rootKey` which also serves as the wallet's identity.
|
|
2446
|
-
|
|
2447
|
-
```ts
|
|
2448
|
-
identityKey: string
|
|
2449
|
-
```
|
|
2450
|
-
|
|
2451
|
-
###### Property keyDeriver
|
|
2452
|
-
|
|
2453
|
-
The `KeyDeriver` component used by the wallet for key derivation and cryptographic functions.
|
|
2454
|
-
|
|
2455
|
-
```ts
|
|
2456
|
-
keyDeriver: KeyDeriver
|
|
2457
|
-
```
|
|
2458
|
-
|
|
2459
|
-
###### Property monitor
|
|
2460
|
-
|
|
2461
|
-
The background task `Monitor` component available to the wallet to offload tasks
|
|
2462
|
-
that speed up wallet operations and maintain data integrity.
|
|
2463
|
-
|
|
2464
|
-
```ts
|
|
2465
|
-
monitor: Monitor
|
|
2466
|
-
```
|
|
2467
|
-
See also: [Monitor](./monitor.md#class-monitor)
|
|
2468
|
-
|
|
2469
|
-
###### Property rootKey
|
|
2470
|
-
|
|
2471
|
-
The rootKey of the `KeyDeriver`. The private key from which other keys are derived.
|
|
2472
|
-
|
|
2473
|
-
```ts
|
|
2474
|
-
rootKey: PrivateKey
|
|
2475
|
-
```
|
|
2476
|
-
|
|
2477
|
-
###### Property services
|
|
2478
|
-
|
|
2479
|
-
The network `Services` component which provides the wallet with access to external services hosted
|
|
2480
|
-
on the public network.
|
|
2481
|
-
|
|
2482
|
-
```ts
|
|
2483
|
-
services: Services
|
|
2484
|
-
```
|
|
2485
|
-
See also: [Services](./services.md#class-services)
|
|
2486
|
-
|
|
2487
|
-
###### Property storage
|
|
2488
|
-
|
|
2489
|
-
The `WalletStorageManager` that manages all the configured storage providers (active and backups)
|
|
2490
|
-
accessed by the wallet.
|
|
2491
|
-
|
|
2492
|
-
```ts
|
|
2493
|
-
storage: WalletStorageManager
|
|
2494
|
-
```
|
|
2495
|
-
See also: [WalletStorageManager](./storage.md#class-walletstoragemanager)
|
|
2496
|
-
|
|
2497
|
-
###### Property wallet
|
|
2498
|
-
|
|
2499
|
-
The actual BRC-100 `Wallet` to which all the other properties and components contribute.
|
|
2500
|
-
|
|
2501
|
-
Note that internally, the wallet is itself linked to all these properties and components.
|
|
2502
|
-
They are included in this interface to facilitate access after wallet construction for
|
|
2503
|
-
experimentation, testing and customization. Any changes made to the configuration of these
|
|
2504
|
-
components after construction may disrupt the normal operation of the wallet.
|
|
2505
|
-
|
|
2506
|
-
```ts
|
|
2507
|
-
wallet: Wallet
|
|
2508
|
-
```
|
|
2509
|
-
See also: [Wallet](./client.md#class-wallet)
|
|
2510
|
-
|
|
2511
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2512
|
-
|
|
2513
|
-
---
|
|
2514
|
-
##### Interface: SetupWalletArgs
|
|
2515
|
-
|
|
2516
|
-
Arguments used by `createWallet` to construct a `SetupWallet`.
|
|
2517
|
-
|
|
2518
|
-
Extension `SetupWalletClientArgs` used by `createWalletClient` to construct a `SetupWalletClient`.
|
|
2519
|
-
|
|
2520
|
-
Extension `SetupWalletKnexArgs` used by `createWalletKnex` to construct a `SetupWalletKnex`.
|
|
2521
|
-
|
|
2522
|
-
Extension `SetupWalletMySQLArgs` used by `createWalletMySQL` to construct a `SetupWalletKnex`.
|
|
2523
|
-
|
|
2524
|
-
Extension `SetupWalletSQLiteArgs` used by `createWalletSQLite` to construct a `SetupWalletKnex`.
|
|
2525
|
-
|
|
2526
|
-
```ts
|
|
2527
|
-
export interface SetupWalletArgs {
|
|
2528
|
-
env: SetupEnv;
|
|
2529
|
-
rootKeyHex?: string;
|
|
2530
|
-
privilegedKeyGetter?: () => Promise<PrivateKey>;
|
|
2531
|
-
active?: sdk.WalletStorageProvider;
|
|
2532
|
-
backups?: sdk.WalletStorageProvider[];
|
|
2533
|
-
}
|
|
2534
|
-
```
|
|
2535
|
-
|
|
2536
|
-
See also: [SetupEnv](./setup.md#interface-setupenv), [WalletStorageProvider](./client.md#interface-walletstorageprovider)
|
|
2537
|
-
|
|
2538
|
-
###### Property active
|
|
2539
|
-
|
|
2540
|
-
Optional. Active wallet storage. Can be added later.
|
|
2541
|
-
|
|
2542
|
-
```ts
|
|
2543
|
-
active?: sdk.WalletStorageProvider
|
|
2544
|
-
```
|
|
2545
|
-
See also: [WalletStorageProvider](./client.md#interface-walletstorageprovider)
|
|
2546
|
-
|
|
2547
|
-
###### Property backups
|
|
2548
|
-
|
|
2549
|
-
Optional. One or more storage providers managed as backup destinations. Can be added later.
|
|
2550
|
-
|
|
2551
|
-
```ts
|
|
2552
|
-
backups?: sdk.WalletStorageProvider[]
|
|
2553
|
-
```
|
|
2554
|
-
See also: [WalletStorageProvider](./client.md#interface-walletstorageprovider)
|
|
2555
|
-
|
|
2556
|
-
###### Property env
|
|
2557
|
-
|
|
2558
|
-
Configuration "secrets" typically obtained by `Setup.makeEnv` and `Setup.getEnv` functions.
|
|
2559
|
-
|
|
2560
|
-
```ts
|
|
2561
|
-
env: SetupEnv
|
|
2562
|
-
```
|
|
2563
|
-
See also: [SetupEnv](./setup.md#interface-setupenv)
|
|
2564
|
-
|
|
2565
|
-
###### Property privilegedKeyGetter
|
|
2566
|
-
|
|
2567
|
-
Optional. The privileged private key getter used to initialize the `PrivilegedKeyManager`.
|
|
2568
|
-
Defaults to undefined.
|
|
2569
|
-
|
|
2570
|
-
```ts
|
|
2571
|
-
privilegedKeyGetter?: () => Promise<PrivateKey>
|
|
2572
|
-
```
|
|
2573
|
-
|
|
2574
|
-
###### Property rootKeyHex
|
|
2575
|
-
|
|
2576
|
-
Optional. The non-privileged private key used to initialize the `KeyDeriver` and determine the `identityKey`.
|
|
2577
|
-
Defaults to `env.devKeys[env.identityKey]
|
|
2578
|
-
|
|
2579
|
-
```ts
|
|
2580
|
-
rootKeyHex?: string
|
|
2581
|
-
```
|
|
2582
|
-
|
|
2583
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2584
|
-
|
|
2585
|
-
---
|
|
2586
|
-
##### Interface: SetupWalletClient
|
|
2587
|
-
|
|
2588
|
-
Extension `SetupWalletClient` of `SetupWallet` is returned by `createWalletClient`
|
|
2589
|
-
|
|
2590
|
-
```ts
|
|
2591
|
-
export interface SetupWalletClient extends SetupWallet {
|
|
2592
|
-
endpointUrl: string;
|
|
2593
|
-
}
|
|
2594
|
-
```
|
|
2595
|
-
|
|
2596
|
-
See also: [SetupWallet](./setup.md#interface-setupwallet)
|
|
2597
|
-
|
|
2598
|
-
###### Property endpointUrl
|
|
2599
|
-
|
|
2600
|
-
The endpoint URL of the service hosting the `StorageServer` JSON-RPC service to
|
|
2601
|
-
which a `StorageClient` instance is connected to function as
|
|
2602
|
-
the active storage provider of the wallet.
|
|
2603
|
-
|
|
2604
|
-
```ts
|
|
2605
|
-
endpointUrl: string
|
|
2606
|
-
```
|
|
2607
|
-
|
|
2608
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2609
|
-
|
|
2610
|
-
---
|
|
2611
|
-
##### Interface: SetupWalletClientArgs
|
|
2612
|
-
|
|
2613
|
-
Extension `SetupWalletClientArgs` of `SetupWalletArgs` is used by `createWalletClient`
|
|
2614
|
-
to construct a `SetupWalletClient`.
|
|
2615
|
-
|
|
2616
|
-
```ts
|
|
2617
|
-
export interface SetupWalletClientArgs extends SetupWalletArgs {
|
|
2618
|
-
endpointUrl?: string;
|
|
2619
|
-
}
|
|
2620
|
-
```
|
|
2621
|
-
|
|
2622
|
-
See also: [SetupWalletArgs](./setup.md#interface-setupwalletargs)
|
|
2623
|
-
|
|
2624
|
-
###### Property endpointUrl
|
|
2625
|
-
|
|
2626
|
-
The endpoint URL of a service hosting the `StorageServer` JSON-RPC service to
|
|
2627
|
-
which a `StorageClient` instance should connect to function as
|
|
2628
|
-
the active storage provider of the newly created wallet.
|
|
2629
|
-
|
|
2630
|
-
```ts
|
|
2631
|
-
endpointUrl?: string
|
|
2632
|
-
```
|
|
2633
|
-
|
|
2634
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2635
|
-
|
|
2636
|
-
---
|
|
2637
|
-
##### Interface: SetupWalletKnex
|
|
2638
|
-
|
|
2639
|
-
```ts
|
|
2640
|
-
export interface SetupWalletKnex extends SetupWallet {
|
|
2641
|
-
activeStorage: StorageKnex;
|
|
2642
|
-
userId: number;
|
|
2643
|
-
rootKey: PrivateKey;
|
|
2644
|
-
identityKey: string;
|
|
2645
|
-
keyDeriver: KeyDeriver;
|
|
2646
|
-
chain: sdk.Chain;
|
|
2647
|
-
storage: WalletStorageManager;
|
|
2648
|
-
services: Services;
|
|
2649
|
-
monitor: Monitor;
|
|
2650
|
-
wallet: Wallet;
|
|
2651
|
-
}
|
|
2652
|
-
```
|
|
2653
|
-
|
|
2654
|
-
See also: [Chain](./client.md#type-chain), [Monitor](./monitor.md#class-monitor), [Services](./services.md#class-services), [SetupWallet](./setup.md#interface-setupwallet), [StorageKnex](./storage.md#class-storageknex), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager)
|
|
2655
|
-
|
|
2656
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2657
|
-
|
|
2658
|
-
---
|
|
2659
|
-
##### Interface: SetupWalletKnexArgs
|
|
2660
|
-
|
|
2661
|
-
```ts
|
|
2662
|
-
export interface SetupWalletKnexArgs extends SetupWalletArgs {
|
|
2663
|
-
knex: Knex<any, any[]>;
|
|
2664
|
-
databaseName: string;
|
|
2665
|
-
}
|
|
2666
|
-
```
|
|
2667
|
-
|
|
2668
|
-
See also: [SetupWalletArgs](./setup.md#interface-setupwalletargs)
|
|
2669
|
-
|
|
2670
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2671
|
-
|
|
2672
|
-
---
|
|
2673
|
-
##### Interface: SetupWalletMySQLArgs
|
|
2674
|
-
|
|
2675
|
-
```ts
|
|
2676
|
-
export interface SetupWalletMySQLArgs extends SetupWalletArgs {
|
|
2677
|
-
databaseName: string;
|
|
2432
|
+
derivationPrefix?: string;
|
|
2433
|
+
derivationSuffix?: string;
|
|
2434
|
+
keyDeriver: KeyDeriverApi;
|
|
2678
2435
|
}
|
|
2679
2436
|
```
|
|
2680
2437
|
|
|
2681
|
-
See also: [SetupWalletArgs](./setup.md#interface-setupwalletargs)
|
|
2682
|
-
|
|
2683
2438
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2684
2439
|
|
|
2685
2440
|
---
|
|
2686
|
-
##### Interface:
|
|
2441
|
+
##### Interface: ScriptTemplateUnlock
|
|
2687
2442
|
|
|
2688
2443
|
```ts
|
|
2689
|
-
export interface
|
|
2690
|
-
|
|
2691
|
-
|
|
2444
|
+
export interface ScriptTemplateUnlock {
|
|
2445
|
+
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
|
|
2446
|
+
estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
|
|
2692
2447
|
}
|
|
2693
2448
|
```
|
|
2694
2449
|
|
|
2695
|
-
See also: [SetupWalletArgs](./setup.md#interface-setupwalletargs)
|
|
2696
|
-
|
|
2697
2450
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2698
2451
|
|
|
2699
2452
|
---
|
|
@@ -2805,7 +2558,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
2805
2558
|
##### Interface: StorageCreateTransactionSdkOutput
|
|
2806
2559
|
|
|
2807
2560
|
```ts
|
|
2808
|
-
export interface StorageCreateTransactionSdkOutput extends
|
|
2561
|
+
export interface StorageCreateTransactionSdkOutput extends ValidCreateActionOutput {
|
|
2809
2562
|
vout: number;
|
|
2810
2563
|
providedBy: StorageProvidedBy;
|
|
2811
2564
|
purpose?: string;
|
|
@@ -2988,27 +2741,6 @@ txid: string
|
|
|
2988
2741
|
|
|
2989
2742
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
2990
2743
|
|
|
2991
|
-
---
|
|
2992
|
-
##### Interface: StorageKnexOptions
|
|
2993
|
-
|
|
2994
|
-
```ts
|
|
2995
|
-
export interface StorageKnexOptions extends StorageProviderOptions {
|
|
2996
|
-
knex: Knex;
|
|
2997
|
-
}
|
|
2998
|
-
```
|
|
2999
|
-
|
|
3000
|
-
See also: [StorageProviderOptions](./storage.md#interface-storageprovideroptions)
|
|
3001
|
-
|
|
3002
|
-
###### Property knex
|
|
3003
|
-
|
|
3004
|
-
Knex database interface initialized with valid connection configuration.
|
|
3005
|
-
|
|
3006
|
-
```ts
|
|
3007
|
-
knex: Knex
|
|
3008
|
-
```
|
|
3009
|
-
|
|
3010
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
3011
|
-
|
|
3012
2744
|
---
|
|
3013
2745
|
##### Interface: StorageProcessActionArgs
|
|
3014
2746
|
|
|
@@ -3122,7 +2854,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
3122
2854
|
|
|
3123
2855
|
```ts
|
|
3124
2856
|
export interface StorageSyncReaderOptions {
|
|
3125
|
-
chain:
|
|
2857
|
+
chain: Chain;
|
|
3126
2858
|
}
|
|
3127
2859
|
```
|
|
3128
2860
|
|
|
@@ -3775,7 +3507,7 @@ The following purge actions are available to support sustained operation:
|
|
|
3775
3507
|
+ proven_tx_reqs table delete records
|
|
3776
3508
|
|
|
3777
3509
|
```ts
|
|
3778
|
-
export interface TaskPurgeParams extends
|
|
3510
|
+
export interface TaskPurgeParams extends PurgeParams {
|
|
3779
3511
|
}
|
|
3780
3512
|
```
|
|
3781
3513
|
|
|
@@ -4016,7 +3748,7 @@ export interface UpdateProvenTxReqWithNewProvenTxArgs {
|
|
|
4016
3748
|
provenTxReqId: number;
|
|
4017
3749
|
txid: string;
|
|
4018
3750
|
attempts: number;
|
|
4019
|
-
status:
|
|
3751
|
+
status: ProvenTxReqStatus;
|
|
4020
3752
|
history: string;
|
|
4021
3753
|
height: number;
|
|
4022
3754
|
index: number;
|
|
@@ -4035,7 +3767,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
4035
3767
|
|
|
4036
3768
|
```ts
|
|
4037
3769
|
export interface UpdateProvenTxReqWithNewProvenTxResult {
|
|
4038
|
-
status:
|
|
3770
|
+
status: ProvenTxReqStatus;
|
|
4039
3771
|
history: string;
|
|
4040
3772
|
provenTxId: number;
|
|
4041
3773
|
log?: string;
|
|
@@ -4588,7 +4320,7 @@ Defines standard interfaces to access functionality implemented by external tran
|
|
|
4588
4320
|
|
|
4589
4321
|
```ts
|
|
4590
4322
|
export interface WalletServices {
|
|
4591
|
-
chain:
|
|
4323
|
+
chain: Chain;
|
|
4592
4324
|
getChainTracker(): Promise<ChainTracker>;
|
|
4593
4325
|
getHeaderForHeight(height: number): Promise<number[]>;
|
|
4594
4326
|
getHeight(): Promise<number>;
|
|
@@ -4598,22 +4330,22 @@ export interface WalletServices {
|
|
|
4598
4330
|
getMerklePath(txid: string, useNext?: boolean): Promise<GetMerklePathResult>;
|
|
4599
4331
|
postBeef(beef: Beef, txids: string[]): Promise<PostBeefResult[]>;
|
|
4600
4332
|
hashOutputScript(script: string): string;
|
|
4601
|
-
getStatusForTxids(txids: string[], useNext?: boolean): Promise<
|
|
4333
|
+
getStatusForTxids(txids: string[], useNext?: boolean): Promise<GetStatusForTxidsResult>;
|
|
4602
4334
|
getUtxoStatus(output: string, outputFormat?: GetUtxoStatusOutputFormat, outpoint?: string, useNext?: boolean): Promise<GetUtxoStatusResult>;
|
|
4603
|
-
getScriptHashHistory(hash: string, useNext?: boolean): Promise<
|
|
4604
|
-
hashToHeader(hash: string): Promise<
|
|
4335
|
+
getScriptHashHistory(hash: string, useNext?: boolean): Promise<GetScriptHashHistoryResult>;
|
|
4336
|
+
hashToHeader(hash: string): Promise<BlockHeader>;
|
|
4605
4337
|
nLockTimeIsFinal(txOrLockTime: string | number[] | BsvTransaction | number): Promise<boolean>;
|
|
4606
4338
|
}
|
|
4607
4339
|
```
|
|
4608
4340
|
|
|
4609
|
-
See also: [BlockHeader](./
|
|
4341
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [Chain](./client.md#type-chain), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [PostBeefResult](./client.md#interface-postbeefresult)
|
|
4610
4342
|
|
|
4611
4343
|
###### Property chain
|
|
4612
4344
|
|
|
4613
4345
|
The chain being serviced.
|
|
4614
4346
|
|
|
4615
4347
|
```ts
|
|
4616
|
-
chain:
|
|
4348
|
+
chain: Chain
|
|
4617
4349
|
```
|
|
4618
4350
|
See also: [Chain](./client.md#type-chain)
|
|
4619
4351
|
|
|
@@ -4734,7 +4466,7 @@ Primarily useful for determining if a recently broadcast transaction is known to
|
|
|
4734
4466
|
Also returns the current depth from chain tip if 'mined'.
|
|
4735
4467
|
|
|
4736
4468
|
```ts
|
|
4737
|
-
getStatusForTxids(txids: string[], useNext?: boolean): Promise<
|
|
4469
|
+
getStatusForTxids(txids: string[], useNext?: boolean): Promise<GetStatusForTxidsResult>
|
|
4738
4470
|
```
|
|
4739
4471
|
See also: [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult)
|
|
4740
4472
|
|
|
@@ -4784,9 +4516,9 @@ Argument Details
|
|
|
4784
4516
|
###### Method hashToHeader
|
|
4785
4517
|
|
|
4786
4518
|
```ts
|
|
4787
|
-
hashToHeader(hash: string): Promise<
|
|
4519
|
+
hashToHeader(hash: string): Promise<BlockHeader>
|
|
4788
4520
|
```
|
|
4789
|
-
See also: [BlockHeader](./
|
|
4521
|
+
See also: [BlockHeader](./services.md#interface-blockheader)
|
|
4790
4522
|
|
|
4791
4523
|
Returns
|
|
4792
4524
|
|
|
@@ -4819,7 +4551,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
4819
4551
|
|
|
4820
4552
|
```ts
|
|
4821
4553
|
export interface WalletServicesOptions {
|
|
4822
|
-
chain:
|
|
4554
|
+
chain: Chain;
|
|
4823
4555
|
taalApiKey?: string;
|
|
4824
4556
|
bitailsApiKey?: string;
|
|
4825
4557
|
whatsOnChainApiKey?: string;
|
|
@@ -4874,7 +4606,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
4874
4606
|
```ts
|
|
4875
4607
|
export interface WalletSigner {
|
|
4876
4608
|
isWalletSigner: true;
|
|
4877
|
-
chain:
|
|
4609
|
+
chain: Chain;
|
|
4878
4610
|
keyDeriver: KeyDeriverApi;
|
|
4879
4611
|
}
|
|
4880
4612
|
```
|
|
@@ -4899,24 +4631,24 @@ export interface WalletStorage {
|
|
|
4899
4631
|
makeAvailable(): Promise<TableSettings>;
|
|
4900
4632
|
migrate(storageName: string, storageIdentityKey: string): Promise<string>;
|
|
4901
4633
|
destroy(): Promise<void>;
|
|
4902
|
-
setServices(v:
|
|
4903
|
-
getServices():
|
|
4634
|
+
setServices(v: WalletServices): void;
|
|
4635
|
+
getServices(): WalletServices;
|
|
4904
4636
|
getSettings(): TableSettings;
|
|
4905
|
-
getAuth(): Promise<
|
|
4637
|
+
getAuth(): Promise<AuthId>;
|
|
4906
4638
|
findOrInsertUser(identityKey: string): Promise<{
|
|
4907
4639
|
user: TableUser;
|
|
4908
4640
|
isNew: boolean;
|
|
4909
4641
|
}>;
|
|
4910
4642
|
abortAction(args: AbortActionArgs): Promise<AbortActionResult>;
|
|
4911
|
-
createAction(args:
|
|
4912
|
-
processAction(args:
|
|
4643
|
+
createAction(args: ValidCreateActionArgs): Promise<StorageCreateActionResult>;
|
|
4644
|
+
processAction(args: StorageProcessActionArgs): Promise<StorageProcessActionResults>;
|
|
4913
4645
|
internalizeAction(args: InternalizeActionArgs): Promise<InternalizeActionResult>;
|
|
4914
|
-
findCertificates(args:
|
|
4915
|
-
findOutputBaskets(args:
|
|
4916
|
-
findOutputs(args:
|
|
4917
|
-
findProvenTxReqs(args:
|
|
4646
|
+
findCertificates(args: FindCertificatesArgs): Promise<TableCertificateX[]>;
|
|
4647
|
+
findOutputBaskets(args: FindOutputBasketsArgs): Promise<TableOutputBasket[]>;
|
|
4648
|
+
findOutputs(args: FindOutputsArgs): Promise<TableOutput[]>;
|
|
4649
|
+
findProvenTxReqs(args: FindProvenTxReqsArgs): Promise<TableProvenTxReq[]>;
|
|
4918
4650
|
listActions(args: ListActionsArgs): Promise<ListActionsResult>;
|
|
4919
|
-
listCertificates(args:
|
|
4651
|
+
listCertificates(args: ValidListCertificatesArgs): Promise<ListCertificatesResult>;
|
|
4920
4652
|
listOutputs(args: ListOutputsArgs): Promise<ListOutputsResult>;
|
|
4921
4653
|
insertCertificate(certificate: TableCertificateX): Promise<number>;
|
|
4922
4654
|
relinquishCertificate(args: RelinquishCertificateArgs): Promise<number>;
|
|
@@ -4947,7 +4679,7 @@ is the actual minimal interface implemented by storage and remoted storage provi
|
|
|
4947
4679
|
```ts
|
|
4948
4680
|
export interface WalletStorageProvider extends WalletStorageSync {
|
|
4949
4681
|
isStorageProvider(): boolean;
|
|
4950
|
-
setServices(v:
|
|
4682
|
+
setServices(v: WalletServices): void;
|
|
4951
4683
|
}
|
|
4952
4684
|
```
|
|
4953
4685
|
|
|
@@ -4971,15 +4703,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
4971
4703
|
```ts
|
|
4972
4704
|
export interface WalletStorageReader {
|
|
4973
4705
|
isAvailable(): boolean;
|
|
4974
|
-
getServices():
|
|
4706
|
+
getServices(): WalletServices;
|
|
4975
4707
|
getSettings(): TableSettings;
|
|
4976
|
-
findCertificatesAuth(auth:
|
|
4977
|
-
findOutputBasketsAuth(auth:
|
|
4978
|
-
findOutputsAuth(auth:
|
|
4979
|
-
findProvenTxReqs(args:
|
|
4980
|
-
listActions(auth:
|
|
4981
|
-
listCertificates(auth:
|
|
4982
|
-
listOutputs(auth:
|
|
4708
|
+
findCertificatesAuth(auth: AuthId, args: FindCertificatesArgs): Promise<TableCertificateX[]>;
|
|
4709
|
+
findOutputBasketsAuth(auth: AuthId, args: FindOutputBasketsArgs): Promise<TableOutputBasket[]>;
|
|
4710
|
+
findOutputsAuth(auth: AuthId, args: FindOutputsArgs): Promise<TableOutput[]>;
|
|
4711
|
+
findProvenTxReqs(args: FindProvenTxReqsArgs): Promise<TableProvenTxReq[]>;
|
|
4712
|
+
listActions(auth: AuthId, vargs: ValidListActionsArgs): Promise<ListActionsResult>;
|
|
4713
|
+
listCertificates(auth: AuthId, vargs: ValidListCertificatesArgs): Promise<ListCertificatesResult>;
|
|
4714
|
+
listOutputs(auth: AuthId, vargs: ValidListOutputsArgs): Promise<ListOutputsResult>;
|
|
4983
4715
|
}
|
|
4984
4716
|
```
|
|
4985
4717
|
|
|
@@ -4987,34 +4719,18 @@ See also: [AuthId](./client.md#interface-authid), [FindCertificatesArgs](./clien
|
|
|
4987
4719
|
|
|
4988
4720
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
4989
4721
|
|
|
4990
|
-
---
|
|
4991
|
-
##### Interface: WalletStorageServerOptions
|
|
4992
|
-
|
|
4993
|
-
```ts
|
|
4994
|
-
export interface WalletStorageServerOptions {
|
|
4995
|
-
port: number;
|
|
4996
|
-
wallet: Wallet;
|
|
4997
|
-
monetize: boolean;
|
|
4998
|
-
calculateRequestPrice?: (req: Request) => number | Promise<number>;
|
|
4999
|
-
}
|
|
5000
|
-
```
|
|
5001
|
-
|
|
5002
|
-
See also: [Wallet](./client.md#class-wallet)
|
|
5003
|
-
|
|
5004
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
5005
|
-
|
|
5006
4722
|
---
|
|
5007
4723
|
##### Interface: WalletStorageSync
|
|
5008
4724
|
|
|
5009
4725
|
```ts
|
|
5010
4726
|
export interface WalletStorageSync extends WalletStorageWriter {
|
|
5011
|
-
findOrInsertSyncStateAuth(auth:
|
|
4727
|
+
findOrInsertSyncStateAuth(auth: AuthId, storageIdentityKey: string, storageName: string): Promise<{
|
|
5012
4728
|
syncState: TableSyncState;
|
|
5013
4729
|
isNew: boolean;
|
|
5014
4730
|
}>;
|
|
5015
|
-
setActive(auth:
|
|
5016
|
-
getSyncChunk(args:
|
|
5017
|
-
processSyncChunk(args:
|
|
4731
|
+
setActive(auth: AuthId, newActiveStorageIdentityKey: string): Promise<number>;
|
|
4732
|
+
getSyncChunk(args: RequestSyncChunkArgs): Promise<SyncChunk>;
|
|
4733
|
+
processSyncChunk(args: RequestSyncChunkArgs, chunk: SyncChunk): Promise<ProcessSyncChunkResult>;
|
|
5018
4734
|
}
|
|
5019
4735
|
```
|
|
5020
4736
|
|
|
@@ -5025,7 +4741,7 @@ See also: [AuthId](./client.md#interface-authid), [ProcessSyncChunkResult](./cli
|
|
|
5025
4741
|
Updagte the `activeStorage` property of the authenticated user by their `userId`.
|
|
5026
4742
|
|
|
5027
4743
|
```ts
|
|
5028
|
-
setActive(auth:
|
|
4744
|
+
setActive(auth: AuthId, newActiveStorageIdentityKey: string): Promise<number>
|
|
5029
4745
|
```
|
|
5030
4746
|
See also: [AuthId](./client.md#interface-authid)
|
|
5031
4747
|
|
|
@@ -5059,13 +4775,13 @@ export interface WalletStorageWriter extends WalletStorageReader {
|
|
|
5059
4775
|
user: TableUser;
|
|
5060
4776
|
isNew: boolean;
|
|
5061
4777
|
}>;
|
|
5062
|
-
abortAction(auth:
|
|
5063
|
-
createAction(auth:
|
|
5064
|
-
processAction(auth:
|
|
5065
|
-
internalizeAction(auth:
|
|
5066
|
-
insertCertificateAuth(auth:
|
|
5067
|
-
relinquishCertificate(auth:
|
|
5068
|
-
relinquishOutput(auth:
|
|
4778
|
+
abortAction(auth: AuthId, args: AbortActionArgs): Promise<AbortActionResult>;
|
|
4779
|
+
createAction(auth: AuthId, args: ValidCreateActionArgs): Promise<StorageCreateActionResult>;
|
|
4780
|
+
processAction(auth: AuthId, args: StorageProcessActionArgs): Promise<StorageProcessActionResults>;
|
|
4781
|
+
internalizeAction(auth: AuthId, args: InternalizeActionArgs): Promise<InternalizeActionResult>;
|
|
4782
|
+
insertCertificateAuth(auth: AuthId, certificate: TableCertificateX): Promise<number>;
|
|
4783
|
+
relinquishCertificate(auth: AuthId, args: RelinquishCertificateArgs): Promise<number>;
|
|
4784
|
+
relinquishOutput(auth: AuthId, args: RelinquishOutputArgs): Promise<number>;
|
|
5069
4785
|
}
|
|
5070
4786
|
```
|
|
5071
4787
|
|
|
@@ -5106,31 +4822,29 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
5106
4822
|
|
|
5107
4823
|
| | | |
|
|
5108
4824
|
| --- | --- | --- |
|
|
5109
|
-
| [ARC](#class-arc) | [PrivilegedKeyManager](#class-privilegedkeymanager) | [
|
|
5110
|
-
| [AuthMethodInteractor](#class-authmethodinteractor) | [ScriptTemplateBRC29](#class-scripttemplatebrc29) | [
|
|
5111
|
-
| [Bitails](#class-bitails) | [SdkWhatsOnChain](#class-sdkwhatsonchain) | [
|
|
5112
|
-
| [CWIStyleWalletManager](#class-cwistylewalletmanager) | [ServiceCollection](#class-servicecollection) | [
|
|
5113
|
-
| [EntityBase](#class-entitybase) | [Services](#class-services) | [
|
|
5114
|
-
| [EntityCertificate](#class-entitycertificate) | [
|
|
5115
|
-
| [EntityCertificateField](#class-entitycertificatefield) | [
|
|
5116
|
-
| [EntityCommission](#class-entitycommission) | [
|
|
5117
|
-
| [EntityOutput](#class-entityoutput) | [
|
|
5118
|
-
| [EntityOutputBasket](#class-entityoutputbasket) | [
|
|
5119
|
-
| [EntityOutputTag](#class-entityoutputtag) | [
|
|
5120
|
-
| [EntityOutputTagMap](#class-entityoutputtagmap) | [
|
|
5121
|
-
| [EntityProvenTx](#class-entityproventx) | [
|
|
5122
|
-
| [EntityProvenTxReq](#class-entityproventxreq) | [
|
|
5123
|
-
| [EntitySyncState](#class-entitysyncstate) | [
|
|
5124
|
-
| [EntityTransaction](#class-entitytransaction) | [
|
|
5125
|
-
| [EntityTxLabel](#class-entitytxlabel) | [
|
|
5126
|
-
| [EntityTxLabelMap](#class-entitytxlabelmap) | [
|
|
5127
|
-
| [EntityUser](#class-entityuser) | [
|
|
5128
|
-
| [
|
|
5129
|
-
| [
|
|
5130
|
-
| [
|
|
5131
|
-
| [
|
|
5132
|
-
| [OverlayUMPTokenInteractor](#class-overlayumptokeninteractor) | [TaskUnFail](#class-taskunfail) | [localKVStore](#class-localkvstore) |
|
|
5133
|
-
| [PersonaIDInteractor](#class-personaidinteractor) | [TwilioPhoneInteractor](#class-twiliophoneinteractor) | |
|
|
4825
|
+
| [ARC](#class-arc) | [PrivilegedKeyManager](#class-privilegedkeymanager) | [WERR_BROADCAST_UNAVAILABLE](#class-werr_broadcast_unavailable) |
|
|
4826
|
+
| [AuthMethodInteractor](#class-authmethodinteractor) | [ScriptTemplateBRC29](#class-scripttemplatebrc29) | [WERR_INSUFFICIENT_FUNDS](#class-werr_insufficient_funds) |
|
|
4827
|
+
| [Bitails](#class-bitails) | [SdkWhatsOnChain](#class-sdkwhatsonchain) | [WERR_INTERNAL](#class-werr_internal) |
|
|
4828
|
+
| [CWIStyleWalletManager](#class-cwistylewalletmanager) | [ServiceCollection](#class-servicecollection) | [WERR_INVALID_OPERATION](#class-werr_invalid_operation) |
|
|
4829
|
+
| [EntityBase](#class-entitybase) | [Services](#class-services) | [WERR_INVALID_PARAMETER](#class-werr_invalid_parameter) |
|
|
4830
|
+
| [EntityCertificate](#class-entitycertificate) | [SimpleWalletManager](#class-simplewalletmanager) | [WERR_INVALID_PUBLIC_KEY](#class-werr_invalid_public_key) |
|
|
4831
|
+
| [EntityCertificateField](#class-entitycertificatefield) | [StorageClient](#class-storageclient) | [WERR_MISSING_PARAMETER](#class-werr_missing_parameter) |
|
|
4832
|
+
| [EntityCommission](#class-entitycommission) | [StorageProvider](#class-storageprovider) | [WERR_NETWORK_CHAIN](#class-werr_network_chain) |
|
|
4833
|
+
| [EntityOutput](#class-entityoutput) | [StorageReader](#class-storagereader) | [WERR_NOT_ACTIVE](#class-werr_not_active) |
|
|
4834
|
+
| [EntityOutputBasket](#class-entityoutputbasket) | [StorageReaderWriter](#class-storagereaderwriter) | [WERR_NOT_IMPLEMENTED](#class-werr_not_implemented) |
|
|
4835
|
+
| [EntityOutputTag](#class-entityoutputtag) | [StorageSyncReader](#class-storagesyncreader) | [WERR_REVIEW_ACTIONS](#class-werr_review_actions) |
|
|
4836
|
+
| [EntityOutputTagMap](#class-entityoutputtagmap) | [TaskCheckForProofs](#class-taskcheckforproofs) | [WERR_UNAUTHORIZED](#class-werr_unauthorized) |
|
|
4837
|
+
| [EntityProvenTx](#class-entityproventx) | [TaskCheckNoSends](#class-taskchecknosends) | [Wallet](#class-wallet) |
|
|
4838
|
+
| [EntityProvenTxReq](#class-entityproventxreq) | [TaskClock](#class-taskclock) | [WalletAuthenticationManager](#class-walletauthenticationmanager) |
|
|
4839
|
+
| [EntitySyncState](#class-entitysyncstate) | [TaskFailAbandoned](#class-taskfailabandoned) | [WalletError](#class-walleterror) |
|
|
4840
|
+
| [EntityTransaction](#class-entitytransaction) | [TaskNewHeader](#class-tasknewheader) | [WalletMonitorTask](#class-walletmonitortask) |
|
|
4841
|
+
| [EntityTxLabel](#class-entitytxlabel) | [TaskPurge](#class-taskpurge) | [WalletPermissionsManager](#class-walletpermissionsmanager) |
|
|
4842
|
+
| [EntityTxLabelMap](#class-entitytxlabelmap) | [TaskReviewStatus](#class-taskreviewstatus) | [WalletSettingsManager](#class-walletsettingsmanager) |
|
|
4843
|
+
| [EntityUser](#class-entityuser) | [TaskSendWaiting](#class-tasksendwaiting) | [WalletSigner](#class-walletsigner) |
|
|
4844
|
+
| [MergeEntity](#class-mergeentity) | [TaskSyncWhenIdle](#class-tasksyncwhenidle) | [WalletStorageManager](#class-walletstoragemanager) |
|
|
4845
|
+
| [Monitor](#class-monitor) | [TwilioPhoneInteractor](#class-twiliophoneinteractor) | [WhatsOnChain](#class-whatsonchain) |
|
|
4846
|
+
| [OverlayUMPTokenInteractor](#class-overlayumptokeninteractor) | [WABClient](#class-wabclient) | |
|
|
4847
|
+
| [PersonaIDInteractor](#class-personaidinteractor) | [WERR_BAD_REQUEST](#class-werr_bad_request) | |
|
|
5134
4848
|
|
|
5135
4849
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
5136
4850
|
|
|
@@ -6568,76 +6282,6 @@ See also: [EntityBase](./storage.md#class-entitybase), [EntityStorage](./storage
|
|
|
6568
6282
|
|
|
6569
6283
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
6570
6284
|
|
|
6571
|
-
---
|
|
6572
|
-
##### Class: KnexMigrations
|
|
6573
|
-
|
|
6574
|
-
```ts
|
|
6575
|
-
export class KnexMigrations implements MigrationSource<string> {
|
|
6576
|
-
migrations: Record<string, Migration> = {};
|
|
6577
|
-
constructor(public chain: sdk.Chain, public storageName: string, public storageIdentityKey: string, public maxOutputScriptLength: number)
|
|
6578
|
-
async getMigrations(): Promise<string[]>
|
|
6579
|
-
getMigrationName(migration: string)
|
|
6580
|
-
async getMigration(migration: string): Promise<Migration>
|
|
6581
|
-
async getLatestMigration(): Promise<string>
|
|
6582
|
-
static async latestMigration(): Promise<string>
|
|
6583
|
-
setupMigrations(chain: string, storageName: string, storageIdentityKey: string, maxOutputScriptLength: number): Record<string, Migration>
|
|
6584
|
-
static async dbtype(knex: Knex<any, any[]>): Promise<DBType> {
|
|
6585
|
-
try {
|
|
6586
|
-
const q = `SELECT
|
|
6587
|
-
CASE
|
|
6588
|
-
WHEN (SELECT VERSION() LIKE '%MariaDB%') = 1 THEN 'Unknown'
|
|
6589
|
-
WHEN (SELECT VERSION()) IS NOT NULL THEN 'MySQL'
|
|
6590
|
-
ELSE 'Unknown'
|
|
6591
|
-
END AS database_type;`;
|
|
6592
|
-
let r = await knex.raw(q);
|
|
6593
|
-
if (!r[0]["database_type"])
|
|
6594
|
-
r = r[0];
|
|
6595
|
-
if (r["rows"])
|
|
6596
|
-
r = r.rows;
|
|
6597
|
-
const dbtype: "SQLite" | "MySQL" | "Unknown" = r[0].database_type;
|
|
6598
|
-
if (dbtype === "Unknown")
|
|
6599
|
-
throw new sdk.WERR_NOT_IMPLEMENTED(`Attempting to create database on unsuported engine.`);
|
|
6600
|
-
return dbtype;
|
|
6601
|
-
}
|
|
6602
|
-
catch (eu: unknown) {
|
|
6603
|
-
const e = sdk.WalletError.fromUnknown(eu);
|
|
6604
|
-
if (e.code === "SQLITE_ERROR")
|
|
6605
|
-
return "SQLite";
|
|
6606
|
-
throw new sdk.WERR_NOT_IMPLEMENTED(`Attempting to create database on unsuported engine.`);
|
|
6607
|
-
}
|
|
6608
|
-
}
|
|
6609
|
-
}
|
|
6610
|
-
```
|
|
6611
|
-
|
|
6612
|
-
See also: [Chain](./client.md#type-chain), [DBType](./storage.md#type-dbtype), [WERR_NOT_IMPLEMENTED](./client.md#class-werr_not_implemented), [WalletError](./client.md#class-walleterror)
|
|
6613
|
-
|
|
6614
|
-
###### Constructor
|
|
6615
|
-
|
|
6616
|
-
```ts
|
|
6617
|
-
constructor(public chain: sdk.Chain, public storageName: string, public storageIdentityKey: string, public maxOutputScriptLength: number)
|
|
6618
|
-
```
|
|
6619
|
-
See also: [Chain](./client.md#type-chain)
|
|
6620
|
-
|
|
6621
|
-
Argument Details
|
|
6622
|
-
|
|
6623
|
-
+ **storageName**
|
|
6624
|
-
+ human readable name for this storage instance
|
|
6625
|
-
+ **maxOutputScriptLength**
|
|
6626
|
-
+ limit for scripts kept in outputs table, longer scripts will be pulled from rawTx
|
|
6627
|
-
|
|
6628
|
-
###### Method dbtype
|
|
6629
|
-
|
|
6630
|
-
```ts
|
|
6631
|
-
static async dbtype(knex: Knex<any, any[]>): Promise<DBType>
|
|
6632
|
-
```
|
|
6633
|
-
See also: [DBType](./storage.md#type-dbtype)
|
|
6634
|
-
|
|
6635
|
-
Returns
|
|
6636
|
-
|
|
6637
|
-
connected database engine variant
|
|
6638
|
-
|
|
6639
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
6640
|
-
|
|
6641
6285
|
---
|
|
6642
6286
|
##### Class: MergeEntity
|
|
6643
6287
|
|
|
@@ -6726,7 +6370,7 @@ export class Monitor {
|
|
|
6726
6370
|
}
|
|
6727
6371
|
```
|
|
6728
6372
|
|
|
6729
|
-
See also: [BlockHeader](./
|
|
6373
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [Chain](./client.md#type-chain), [MonitorOptions](./monitor.md#interface-monitoroptions), [MonitorStorage](./monitor.md#type-monitorstorage), [Services](./services.md#class-services), [TaskPurgeParams](./monitor.md#interface-taskpurgeparams), [WalletMonitorTask](./monitor.md#class-walletmonitortask)
|
|
6730
6374
|
|
|
6731
6375
|
###### Property _otherTasks
|
|
6732
6376
|
|
|
@@ -6773,7 +6417,7 @@ Kicks processing 'unconfirmed' and 'unmined' request processing.
|
|
|
6773
6417
|
```ts
|
|
6774
6418
|
processNewBlockHeader(header: BlockHeader): void
|
|
6775
6419
|
```
|
|
6776
|
-
See also: [BlockHeader](./
|
|
6420
|
+
See also: [BlockHeader](./services.md#interface-blockheader)
|
|
6777
6421
|
|
|
6778
6422
|
###### Method processReorg
|
|
6779
6423
|
|
|
@@ -6789,29 +6433,7 @@ Coinbase transactions always become invalid.
|
|
|
6789
6433
|
```ts
|
|
6790
6434
|
processReorg(depth: number, oldTip: BlockHeader, newTip: BlockHeader): void
|
|
6791
6435
|
```
|
|
6792
|
-
See also: [BlockHeader](./
|
|
6793
|
-
|
|
6794
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
6795
|
-
|
|
6796
|
-
---
|
|
6797
|
-
##### Class: MonitorDaemon
|
|
6798
|
-
|
|
6799
|
-
```ts
|
|
6800
|
-
export class MonitorDaemon {
|
|
6801
|
-
setup?: MonitorDaemonSetup;
|
|
6802
|
-
doneListening?: Promise<void>;
|
|
6803
|
-
doneTasks?: Promise<void>;
|
|
6804
|
-
stopDaemon: boolean = false;
|
|
6805
|
-
constructor(public args: MonitorDaemonSetup, public noRunTasks?: boolean)
|
|
6806
|
-
async createSetup(): Promise<void>
|
|
6807
|
-
async start(): Promise<void>
|
|
6808
|
-
async stop(): Promise<void>
|
|
6809
|
-
async destroy(): Promise<void>
|
|
6810
|
-
async runDaemon(): Promise<void>
|
|
6811
|
-
}
|
|
6812
|
-
```
|
|
6813
|
-
|
|
6814
|
-
See also: [MonitorDaemonSetup](./monitor.md#interface-monitordaemonsetup)
|
|
6436
|
+
See also: [BlockHeader](./services.md#interface-blockheader)
|
|
6815
6437
|
|
|
6816
6438
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
6817
6439
|
|
|
@@ -7124,7 +6746,7 @@ export class Services implements sdk.WalletServices {
|
|
|
7124
6746
|
}
|
|
7125
6747
|
```
|
|
7126
6748
|
|
|
7127
|
-
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./
|
|
6749
|
+
See also: [ARC](./services.md#class-arc), [Bitails](./services.md#class-bitails), [BlockHeader](./services.md#interface-blockheader), [Chain](./client.md#type-chain), [FiatExchangeRates](./client.md#interface-fiatexchangerates), [GetMerklePathResult](./client.md#interface-getmerklepathresult), [GetMerklePathService](./client.md#type-getmerklepathservice), [GetRawTxResult](./client.md#interface-getrawtxresult), [GetRawTxService](./client.md#type-getrawtxservice), [GetScriptHashHistoryResult](./client.md#interface-getscripthashhistoryresult), [GetScriptHashHistoryService](./client.md#type-getscripthashhistoryservice), [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult), [GetStatusForTxidsService](./client.md#type-getstatusfortxidsservice), [GetUtxoStatusOutputFormat](./client.md#type-getutxostatusoutputformat), [GetUtxoStatusResult](./client.md#interface-getutxostatusresult), [GetUtxoStatusService](./client.md#type-getutxostatusservice), [PostBeefResult](./client.md#interface-postbeefresult), [PostBeefService](./client.md#type-postbeefservice), [ServiceCollection](./services.md#class-servicecollection), [UpdateFiatExchangeRateService](./client.md#type-updatefiatexchangerateservice), [WalletServices](./client.md#interface-walletservices), [WalletServicesOptions](./client.md#interface-walletservicesoptions), [WhatsOnChain](./services.md#class-whatsonchain)
|
|
7128
6750
|
|
|
7129
6751
|
###### Method hashOutputScript
|
|
7130
6752
|
|
|
@@ -7143,453 +6765,6 @@ Argument Details
|
|
|
7143
6765
|
|
|
7144
6766
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
7145
6767
|
|
|
7146
|
-
---
|
|
7147
|
-
##### Class: Setup
|
|
7148
|
-
|
|
7149
|
-
The 'Setup` class provides static setup functions to construct BRC-100 compatible
|
|
7150
|
-
wallets in a variety of configurations.
|
|
7151
|
-
|
|
7152
|
-
It serves as a starting point for experimentation and customization.
|
|
7153
|
-
|
|
7154
|
-
```ts
|
|
7155
|
-
export abstract class Setup {
|
|
7156
|
-
static noEnv(chain: sdk.Chain): boolean
|
|
7157
|
-
static makeEnv(): string {
|
|
7158
|
-
const testPrivKey1 = PrivateKey.fromRandom();
|
|
7159
|
-
const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
|
|
7160
|
-
const testPrivKey2 = PrivateKey.fromRandom();
|
|
7161
|
-
const testIdentityKey2 = testPrivKey2.toPublicKey().toString();
|
|
7162
|
-
const mainPrivKey1 = PrivateKey.fromRandom();
|
|
7163
|
-
const mainIdentityKey1 = mainPrivKey1.toPublicKey().toString();
|
|
7164
|
-
const mainPrivKey2 = PrivateKey.fromRandom();
|
|
7165
|
-
const mainIdentityKey2 = mainPrivKey2.toPublicKey().toString();
|
|
7166
|
-
const log = `
|
|
7167
|
-
# .env file template for working with wallet-toolbox Setup functions.
|
|
7168
|
-
MY_TEST_IDENTITY = '${testIdentityKey1}'
|
|
7169
|
-
MY_TEST_IDENTITY2 = '${testIdentityKey2}'
|
|
7170
|
-
MY_MAIN_IDENTITY = '${mainIdentityKey1}'
|
|
7171
|
-
MY_MAIN_IDENTITY2 = '${mainIdentityKey2}'
|
|
7172
|
-
MAIN_TAAL_API_KEY='mainnet_9596de07e92300c6287e4393594ae39c'
|
|
7173
|
-
TEST_TAAL_API_KEY='testnet_0e6cf72133b43ea2d7861da2a38684e3'
|
|
7174
|
-
MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"your_password","database":"your_database", "timezone": "Z"}'
|
|
7175
|
-
DEV_KEYS = '{
|
|
7176
|
-
"${testIdentityKey1}": "${testPrivKey1.toString()}",
|
|
7177
|
-
"${testIdentityKey2}": "${testPrivKey2.toString()}",
|
|
7178
|
-
"${mainIdentityKey1}": "${mainPrivKey1.toString()}",
|
|
7179
|
-
"${mainIdentityKey2}": "${mainPrivKey2.toString()}"
|
|
7180
|
-
}'
|
|
7181
|
-
`;
|
|
7182
|
-
console.log(log);
|
|
7183
|
-
return log;
|
|
7184
|
-
}
|
|
7185
|
-
static getEnv(chain: sdk.Chain): SetupEnv {
|
|
7186
|
-
const identityKey = chain === "main" ? process.env.MY_MAIN_IDENTITY : process.env.MY_TEST_IDENTITY;
|
|
7187
|
-
const identityKey2 = chain === "main" ? process.env.MY_MAIN_IDENTITY2 : process.env.MY_TEST_IDENTITY2;
|
|
7188
|
-
const filePath = chain === "main" ? process.env.MY_MAIN_FILEPATH : process.env.MY_TEST_FILEPATH;
|
|
7189
|
-
const DEV_KEYS = process.env.DEV_KEYS || "{}";
|
|
7190
|
-
const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
|
|
7191
|
-
const taalApiKey = verifyTruthy(chain === "main" ? process.env.MAIN_TAAL_API_KEY : process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
|
|
7192
|
-
if (!identityKey || !identityKey2)
|
|
7193
|
-
throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
|
|
7194
|
-
return {
|
|
7195
|
-
chain,
|
|
7196
|
-
identityKey,
|
|
7197
|
-
identityKey2,
|
|
7198
|
-
filePath,
|
|
7199
|
-
taalApiKey,
|
|
7200
|
-
devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
|
|
7201
|
-
mySQLConnection
|
|
7202
|
-
};
|
|
7203
|
-
}
|
|
7204
|
-
static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
|
|
7205
|
-
const chain = args.env.chain;
|
|
7206
|
-
args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
|
|
7207
|
-
const rootKey = PrivateKey.fromHex(args.rootKeyHex);
|
|
7208
|
-
const identityKey = rootKey.toPublicKey().toString();
|
|
7209
|
-
const keyDeriver = new KeyDeriver(rootKey);
|
|
7210
|
-
const storage = new WalletStorageManager(identityKey, args.active, args.backups);
|
|
7211
|
-
if (storage.canMakeAvailable())
|
|
7212
|
-
await storage.makeAvailable();
|
|
7213
|
-
const serviceOptions = Services.createDefaultOptions(chain);
|
|
7214
|
-
serviceOptions.taalApiKey = args.env.taalApiKey;
|
|
7215
|
-
const services = new Services(serviceOptions);
|
|
7216
|
-
const monopts = Monitor.createDefaultWalletMonitorOptions(chain, storage, services);
|
|
7217
|
-
const monitor = new Monitor(monopts);
|
|
7218
|
-
monitor.addDefaultTasks();
|
|
7219
|
-
const privilegedKeyManager = args.privilegedKeyGetter
|
|
7220
|
-
? new sdk.PrivilegedKeyManager(args.privilegedKeyGetter)
|
|
7221
|
-
: undefined;
|
|
7222
|
-
const wallet = new Wallet({
|
|
7223
|
-
chain,
|
|
7224
|
-
keyDeriver,
|
|
7225
|
-
storage,
|
|
7226
|
-
services,
|
|
7227
|
-
monitor,
|
|
7228
|
-
privilegedKeyManager
|
|
7229
|
-
});
|
|
7230
|
-
const r: SetupWallet = {
|
|
7231
|
-
rootKey,
|
|
7232
|
-
identityKey,
|
|
7233
|
-
keyDeriver,
|
|
7234
|
-
chain,
|
|
7235
|
-
storage,
|
|
7236
|
-
services,
|
|
7237
|
-
monitor,
|
|
7238
|
-
wallet
|
|
7239
|
-
};
|
|
7240
|
-
return r;
|
|
7241
|
-
}
|
|
7242
|
-
static async createWalletClientNoEnv(args: {
|
|
7243
|
-
chain: sdk.Chain;
|
|
7244
|
-
rootKeyHex: string;
|
|
7245
|
-
storageUrl?: string;
|
|
7246
|
-
privilegedKeyGetter?: () => Promise<PrivateKey>;
|
|
7247
|
-
}): Promise<Wallet>
|
|
7248
|
-
static async createWalletClient(args: SetupWalletClientArgs): Promise<SetupWalletClient> {
|
|
7249
|
-
const wo = await Setup.createWallet(args);
|
|
7250
|
-
const endpointUrl = args.endpointUrl || `https://${args.env.chain !== "main" ? "staging-" : ""}storage.babbage.systems`;
|
|
7251
|
-
const client = new StorageClient(wo.wallet, endpointUrl);
|
|
7252
|
-
await wo.storage.addWalletStorageProvider(client);
|
|
7253
|
-
await wo.storage.makeAvailable();
|
|
7254
|
-
return {
|
|
7255
|
-
...wo,
|
|
7256
|
-
endpointUrl
|
|
7257
|
-
};
|
|
7258
|
-
}
|
|
7259
|
-
static getKeyPair(priv?: string | PrivateKey): KeyPairAddress {
|
|
7260
|
-
if (priv === undefined)
|
|
7261
|
-
priv = PrivateKey.fromRandom();
|
|
7262
|
-
else if (typeof priv === "string")
|
|
7263
|
-
priv = new PrivateKey(priv, "hex");
|
|
7264
|
-
const pub = PublicKey.fromPrivateKey(priv);
|
|
7265
|
-
const address = pub.toAddress();
|
|
7266
|
-
return { privateKey: priv, publicKey: pub, address };
|
|
7267
|
-
}
|
|
7268
|
-
static getLockP2PKH(address: string): LockingScript {
|
|
7269
|
-
const p2pkh = new P2PKH();
|
|
7270
|
-
const lock = p2pkh.lock(address);
|
|
7271
|
-
return lock;
|
|
7272
|
-
}
|
|
7273
|
-
static getUnlockP2PKH(priv: PrivateKey, satoshis: number): sdk.ScriptTemplateUnlock {
|
|
7274
|
-
const p2pkh = new P2PKH();
|
|
7275
|
-
const lock = Setup.getLockP2PKH(Setup.getKeyPair(priv).address);
|
|
7276
|
-
const unlock = p2pkh.unlock(priv, "all", false, satoshis, lock);
|
|
7277
|
-
return unlock;
|
|
7278
|
-
}
|
|
7279
|
-
static createP2PKHOutputs(outputs: {
|
|
7280
|
-
address: string;
|
|
7281
|
-
satoshis: number;
|
|
7282
|
-
outputDescription?: string;
|
|
7283
|
-
basket?: string;
|
|
7284
|
-
tags?: string[];
|
|
7285
|
-
}[]): CreateActionOutput[] {
|
|
7286
|
-
const os: CreateActionOutput[] = [];
|
|
7287
|
-
const count = outputs.length;
|
|
7288
|
-
for (let i = 0; i < count; i++) {
|
|
7289
|
-
const o = outputs[i];
|
|
7290
|
-
os.push({
|
|
7291
|
-
basket: o.basket,
|
|
7292
|
-
tags: o.tags,
|
|
7293
|
-
satoshis: o.satoshis,
|
|
7294
|
-
lockingScript: Setup.getLockP2PKH(o.address).toHex(),
|
|
7295
|
-
outputDescription: o.outputDescription || `p2pkh ${i}`
|
|
7296
|
-
});
|
|
7297
|
-
}
|
|
7298
|
-
return os;
|
|
7299
|
-
}
|
|
7300
|
-
static async createP2PKHOutputsAction(wallet: WalletInterface, outputs: {
|
|
7301
|
-
address: string;
|
|
7302
|
-
satoshis: number;
|
|
7303
|
-
outputDescription?: string;
|
|
7304
|
-
basket?: string;
|
|
7305
|
-
tags?: string[];
|
|
7306
|
-
}[], options?: CreateActionOptions): Promise<{
|
|
7307
|
-
cr: CreateActionResult;
|
|
7308
|
-
outpoints: string[] | undefined;
|
|
7309
|
-
}> {
|
|
7310
|
-
const os = Setup.createP2PKHOutputs(outputs);
|
|
7311
|
-
const createArgs: CreateActionArgs = {
|
|
7312
|
-
description: `createP2PKHOutputs`,
|
|
7313
|
-
outputs: os,
|
|
7314
|
-
options: {
|
|
7315
|
-
...options,
|
|
7316
|
-
randomizeOutputs: false
|
|
7317
|
-
}
|
|
7318
|
-
};
|
|
7319
|
-
const cr = await wallet.createAction(createArgs);
|
|
7320
|
-
let outpoints: string[] | undefined;
|
|
7321
|
-
if (cr.txid) {
|
|
7322
|
-
outpoints = os.map((o, i) => `${cr.txid}.${i}`);
|
|
7323
|
-
}
|
|
7324
|
-
return { cr, outpoints };
|
|
7325
|
-
}
|
|
7326
|
-
static async fundWalletFromP2PKHOutpoints(wallet: WalletInterface, outpoints: string[], p2pkhKey: KeyPairAddress, inputBEEF?: BEEF) {
|
|
7327
|
-
}
|
|
7328
|
-
static async createWalletKnex(args: SetupWalletKnexArgs): Promise<SetupWalletKnex> {
|
|
7329
|
-
const wo = await Setup.createWallet(args);
|
|
7330
|
-
const activeStorage = await Setup.createStorageKnex(args);
|
|
7331
|
-
await wo.storage.addWalletStorageProvider(activeStorage);
|
|
7332
|
-
const { user, isNew } = await activeStorage.findOrInsertUser(wo.identityKey);
|
|
7333
|
-
const userId = user.userId;
|
|
7334
|
-
const r: SetupWalletKnex = {
|
|
7335
|
-
...wo,
|
|
7336
|
-
activeStorage,
|
|
7337
|
-
userId
|
|
7338
|
-
};
|
|
7339
|
-
return r;
|
|
7340
|
-
}
|
|
7341
|
-
static async createStorageKnex(args: SetupWalletKnexArgs): Promise<StorageKnex>
|
|
7342
|
-
static createSQLiteKnex(filename: string): Knex {
|
|
7343
|
-
const config: Knex.Config = {
|
|
7344
|
-
client: "sqlite3",
|
|
7345
|
-
connection: { filename },
|
|
7346
|
-
useNullAsDefault: true
|
|
7347
|
-
};
|
|
7348
|
-
const knex = makeKnex(config);
|
|
7349
|
-
return knex;
|
|
7350
|
-
}
|
|
7351
|
-
static createMySQLKnex(connection: string, database?: string): Knex {
|
|
7352
|
-
const c: Knex.MySql2ConnectionConfig = JSON.parse(connection);
|
|
7353
|
-
if (database) {
|
|
7354
|
-
c.database = database;
|
|
7355
|
-
}
|
|
7356
|
-
const config: Knex.Config = {
|
|
7357
|
-
client: "mysql2",
|
|
7358
|
-
connection: c,
|
|
7359
|
-
useNullAsDefault: true,
|
|
7360
|
-
pool: { min: 0, max: 7, idleTimeoutMillis: 15000 }
|
|
7361
|
-
};
|
|
7362
|
-
const knex = makeKnex(config);
|
|
7363
|
-
return knex;
|
|
7364
|
-
}
|
|
7365
|
-
static async createWalletMySQL(args: SetupWalletMySQLArgs): Promise<SetupWalletKnex> {
|
|
7366
|
-
return await this.createWalletKnex({
|
|
7367
|
-
...args,
|
|
7368
|
-
knex: Setup.createMySQLKnex(args.env.mySQLConnection, args.databaseName)
|
|
7369
|
-
});
|
|
7370
|
-
}
|
|
7371
|
-
static async createWalletSQLite(args: SetupWalletSQLiteArgs): Promise<SetupWalletKnex> {
|
|
7372
|
-
return await this.createWalletKnex({
|
|
7373
|
-
...args,
|
|
7374
|
-
knex: Setup.createSQLiteKnex(args.filePath)
|
|
7375
|
-
});
|
|
7376
|
-
}
|
|
7377
|
-
}
|
|
7378
|
-
```
|
|
7379
|
-
|
|
7380
|
-
See also: [Chain](./client.md#type-chain), [KeyPairAddress](./setup.md#interface-keypairaddress), [Monitor](./monitor.md#class-monitor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [ScriptTemplateUnlock](./client.md#interface-scripttemplateunlock), [Services](./services.md#class-services), [SetupEnv](./setup.md#interface-setupenv), [SetupWallet](./setup.md#interface-setupwallet), [SetupWalletArgs](./setup.md#interface-setupwalletargs), [SetupWalletClient](./setup.md#interface-setupwalletclient), [SetupWalletClientArgs](./setup.md#interface-setupwalletclientargs), [SetupWalletKnex](./setup.md#interface-setupwalletknex), [SetupWalletKnexArgs](./setup.md#interface-setupwalletknexargs), [SetupWalletMySQLArgs](./setup.md#interface-setupwalletmysqlargs), [SetupWalletSQLiteArgs](./setup.md#interface-setupwalletsqliteargs), [StorageClient](./storage.md#class-storageclient), [StorageKnex](./storage.md#class-storageknex), [WERR_INVALID_OPERATION](./client.md#class-werr_invalid_operation), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager), [createAction](./storage.md#function-createaction), [verifyTruthy](./client.md#function-verifytruthy)
|
|
7381
|
-
|
|
7382
|
-
###### Method createStorageKnex
|
|
7383
|
-
|
|
7384
|
-
```ts
|
|
7385
|
-
static async createStorageKnex(args: SetupWalletKnexArgs): Promise<StorageKnex>
|
|
7386
|
-
```
|
|
7387
|
-
See also: [SetupWalletKnexArgs](./setup.md#interface-setupwalletknexargs), [StorageKnex](./storage.md#class-storageknex)
|
|
7388
|
-
|
|
7389
|
-
Returns
|
|
7390
|
-
|
|
7391
|
-
- `Knex` based storage provider for a wallet. May be used for either active storage or backup storage.
|
|
7392
|
-
|
|
7393
|
-
###### Method createWallet
|
|
7394
|
-
|
|
7395
|
-
Create a `Wallet`. Storage can optionally be provided or configured later.
|
|
7396
|
-
|
|
7397
|
-
The following components are configured: KeyDeriver, WalletStorageManager, WalletService, WalletStorage.
|
|
7398
|
-
Optionally, PrivilegedKeyManager is also configured.
|
|
7399
|
-
|
|
7400
|
-
```ts
|
|
7401
|
-
static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
|
|
7402
|
-
const chain = args.env.chain;
|
|
7403
|
-
args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
|
|
7404
|
-
const rootKey = PrivateKey.fromHex(args.rootKeyHex);
|
|
7405
|
-
const identityKey = rootKey.toPublicKey().toString();
|
|
7406
|
-
const keyDeriver = new KeyDeriver(rootKey);
|
|
7407
|
-
const storage = new WalletStorageManager(identityKey, args.active, args.backups);
|
|
7408
|
-
if (storage.canMakeAvailable())
|
|
7409
|
-
await storage.makeAvailable();
|
|
7410
|
-
const serviceOptions = Services.createDefaultOptions(chain);
|
|
7411
|
-
serviceOptions.taalApiKey = args.env.taalApiKey;
|
|
7412
|
-
const services = new Services(serviceOptions);
|
|
7413
|
-
const monopts = Monitor.createDefaultWalletMonitorOptions(chain, storage, services);
|
|
7414
|
-
const monitor = new Monitor(monopts);
|
|
7415
|
-
monitor.addDefaultTasks();
|
|
7416
|
-
const privilegedKeyManager = args.privilegedKeyGetter
|
|
7417
|
-
? new sdk.PrivilegedKeyManager(args.privilegedKeyGetter)
|
|
7418
|
-
: undefined;
|
|
7419
|
-
const wallet = new Wallet({
|
|
7420
|
-
chain,
|
|
7421
|
-
keyDeriver,
|
|
7422
|
-
storage,
|
|
7423
|
-
services,
|
|
7424
|
-
monitor,
|
|
7425
|
-
privilegedKeyManager
|
|
7426
|
-
});
|
|
7427
|
-
const r: SetupWallet = {
|
|
7428
|
-
rootKey,
|
|
7429
|
-
identityKey,
|
|
7430
|
-
keyDeriver,
|
|
7431
|
-
chain,
|
|
7432
|
-
storage,
|
|
7433
|
-
services,
|
|
7434
|
-
monitor,
|
|
7435
|
-
wallet
|
|
7436
|
-
};
|
|
7437
|
-
return r;
|
|
7438
|
-
}
|
|
7439
|
-
```
|
|
7440
|
-
See also: [Monitor](./monitor.md#class-monitor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [Services](./services.md#class-services), [SetupWallet](./setup.md#interface-setupwallet), [SetupWalletArgs](./setup.md#interface-setupwalletargs), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager)
|
|
7441
|
-
|
|
7442
|
-
###### Method createWalletClientNoEnv
|
|
7443
|
-
|
|
7444
|
-
Setup a new `Wallet` without requiring a .env file.
|
|
7445
|
-
|
|
7446
|
-
```ts
|
|
7447
|
-
static async createWalletClientNoEnv(args: {
|
|
7448
|
-
chain: sdk.Chain;
|
|
7449
|
-
rootKeyHex: string;
|
|
7450
|
-
storageUrl?: string;
|
|
7451
|
-
privilegedKeyGetter?: () => Promise<PrivateKey>;
|
|
7452
|
-
}): Promise<Wallet>
|
|
7453
|
-
```
|
|
7454
|
-
See also: [Chain](./client.md#type-chain), [Wallet](./client.md#class-wallet)
|
|
7455
|
-
|
|
7456
|
-
Argument Details
|
|
7457
|
-
|
|
7458
|
-
+ **args.chain**
|
|
7459
|
-
+ 'main' or 'test'
|
|
7460
|
-
+ **args.rootKeyHex**
|
|
7461
|
-
+ Root private key for wallet's key deriver.
|
|
7462
|
-
+ **args.storageUrl**
|
|
7463
|
-
+ Optional. `StorageClient` and `chain` compatible endpoint URL.
|
|
7464
|
-
+ **args.privilegedKeyGetter**
|
|
7465
|
-
+ Optional. Method that will return the privileged `PrivateKey`, on demand.
|
|
7466
|
-
|
|
7467
|
-
###### Method createWalletKnex
|
|
7468
|
-
|
|
7469
|
-
Adds `Knex` based storage to a `Wallet` configured by `Setup.createWalletOnly`
|
|
7470
|
-
|
|
7471
|
-
```ts
|
|
7472
|
-
static async createWalletKnex(args: SetupWalletKnexArgs): Promise<SetupWalletKnex> {
|
|
7473
|
-
const wo = await Setup.createWallet(args);
|
|
7474
|
-
const activeStorage = await Setup.createStorageKnex(args);
|
|
7475
|
-
await wo.storage.addWalletStorageProvider(activeStorage);
|
|
7476
|
-
const { user, isNew } = await activeStorage.findOrInsertUser(wo.identityKey);
|
|
7477
|
-
const userId = user.userId;
|
|
7478
|
-
const r: SetupWalletKnex = {
|
|
7479
|
-
...wo,
|
|
7480
|
-
activeStorage,
|
|
7481
|
-
userId
|
|
7482
|
-
};
|
|
7483
|
-
return r;
|
|
7484
|
-
}
|
|
7485
|
-
```
|
|
7486
|
-
See also: [Setup](./setup.md#class-setup), [SetupWalletKnex](./setup.md#interface-setupwalletknex), [SetupWalletKnexArgs](./setup.md#interface-setupwalletknexargs)
|
|
7487
|
-
|
|
7488
|
-
Argument Details
|
|
7489
|
-
|
|
7490
|
-
+ **args.knex**
|
|
7491
|
-
+ `Knex` object configured for either MySQL or SQLite database access.
|
|
7492
|
-
Schema will be created and migrated as needed.
|
|
7493
|
-
For MySQL, a schema corresponding to databaseName must exist with full access permissions.
|
|
7494
|
-
+ **args.databaseName**
|
|
7495
|
-
+ Name for this storage. For MySQL, the schema name within the MySQL instance.
|
|
7496
|
-
+ **args.chain**
|
|
7497
|
-
+ Which chain this wallet is on: 'main' or 'test'. Defaults to 'test'.
|
|
7498
|
-
|
|
7499
|
-
###### Method getEnv
|
|
7500
|
-
|
|
7501
|
-
Reads a .env file of the format created by `makeEnv`.
|
|
7502
|
-
|
|
7503
|
-
Returns values for designated `chain`.
|
|
7504
|
-
|
|
7505
|
-
Access private keys through the `devKeys` object: `devKeys[identityKey]`
|
|
7506
|
-
|
|
7507
|
-
```ts
|
|
7508
|
-
static getEnv(chain: sdk.Chain): SetupEnv {
|
|
7509
|
-
const identityKey = chain === "main" ? process.env.MY_MAIN_IDENTITY : process.env.MY_TEST_IDENTITY;
|
|
7510
|
-
const identityKey2 = chain === "main" ? process.env.MY_MAIN_IDENTITY2 : process.env.MY_TEST_IDENTITY2;
|
|
7511
|
-
const filePath = chain === "main" ? process.env.MY_MAIN_FILEPATH : process.env.MY_TEST_FILEPATH;
|
|
7512
|
-
const DEV_KEYS = process.env.DEV_KEYS || "{}";
|
|
7513
|
-
const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
|
|
7514
|
-
const taalApiKey = verifyTruthy(chain === "main" ? process.env.MAIN_TAAL_API_KEY : process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
|
|
7515
|
-
if (!identityKey || !identityKey2)
|
|
7516
|
-
throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
|
|
7517
|
-
return {
|
|
7518
|
-
chain,
|
|
7519
|
-
identityKey,
|
|
7520
|
-
identityKey2,
|
|
7521
|
-
filePath,
|
|
7522
|
-
taalApiKey,
|
|
7523
|
-
devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
|
|
7524
|
-
mySQLConnection
|
|
7525
|
-
};
|
|
7526
|
-
}
|
|
7527
|
-
```
|
|
7528
|
-
See also: [Chain](./client.md#type-chain), [SetupEnv](./setup.md#interface-setupenv), [WERR_INVALID_OPERATION](./client.md#class-werr_invalid_operation), [verifyTruthy](./client.md#function-verifytruthy)
|
|
7529
|
-
|
|
7530
|
-
Returns
|
|
7531
|
-
|
|
7532
|
-
with configuration environment secrets used by `Setup` functions.
|
|
7533
|
-
|
|
7534
|
-
Argument Details
|
|
7535
|
-
|
|
7536
|
-
+ **chain**
|
|
7537
|
-
+ Which chain to use: 'test' or 'main'
|
|
7538
|
-
|
|
7539
|
-
###### Method makeEnv
|
|
7540
|
-
|
|
7541
|
-
Creates content for .env file with some private keys, identity keys, sample API keys, and sample MySQL connection string.
|
|
7542
|
-
|
|
7543
|
-
Two new, random private keys are generated each time, with their associated public identity keys.
|
|
7544
|
-
|
|
7545
|
-
Loading secrets from a .env file is intended only for experimentation and getting started.
|
|
7546
|
-
Private keys should never be included directly in your source code.
|
|
7547
|
-
|
|
7548
|
-
```ts
|
|
7549
|
-
static makeEnv(): string {
|
|
7550
|
-
const testPrivKey1 = PrivateKey.fromRandom();
|
|
7551
|
-
const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
|
|
7552
|
-
const testPrivKey2 = PrivateKey.fromRandom();
|
|
7553
|
-
const testIdentityKey2 = testPrivKey2.toPublicKey().toString();
|
|
7554
|
-
const mainPrivKey1 = PrivateKey.fromRandom();
|
|
7555
|
-
const mainIdentityKey1 = mainPrivKey1.toPublicKey().toString();
|
|
7556
|
-
const mainPrivKey2 = PrivateKey.fromRandom();
|
|
7557
|
-
const mainIdentityKey2 = mainPrivKey2.toPublicKey().toString();
|
|
7558
|
-
const log = `
|
|
7559
|
-
# .env file template for working with wallet-toolbox Setup functions.
|
|
7560
|
-
MY_TEST_IDENTITY = '${testIdentityKey1}'
|
|
7561
|
-
MY_TEST_IDENTITY2 = '${testIdentityKey2}'
|
|
7562
|
-
MY_MAIN_IDENTITY = '${mainIdentityKey1}'
|
|
7563
|
-
MY_MAIN_IDENTITY2 = '${mainIdentityKey2}'
|
|
7564
|
-
MAIN_TAAL_API_KEY='mainnet_9596de07e92300c6287e4393594ae39c'
|
|
7565
|
-
TEST_TAAL_API_KEY='testnet_0e6cf72133b43ea2d7861da2a38684e3'
|
|
7566
|
-
MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"your_password","database":"your_database", "timezone": "Z"}'
|
|
7567
|
-
DEV_KEYS = '{
|
|
7568
|
-
"${testIdentityKey1}": "${testPrivKey1.toString()}",
|
|
7569
|
-
"${testIdentityKey2}": "${testPrivKey2.toString()}",
|
|
7570
|
-
"${mainIdentityKey1}": "${mainPrivKey1.toString()}",
|
|
7571
|
-
"${mainIdentityKey2}": "${mainPrivKey2.toString()}"
|
|
7572
|
-
}'
|
|
7573
|
-
`;
|
|
7574
|
-
console.log(log);
|
|
7575
|
-
return log;
|
|
7576
|
-
}
|
|
7577
|
-
```
|
|
7578
|
-
See also: [Setup](./setup.md#class-setup)
|
|
7579
|
-
|
|
7580
|
-
###### Method noEnv
|
|
7581
|
-
|
|
7582
|
-
```ts
|
|
7583
|
-
static noEnv(chain: sdk.Chain): boolean
|
|
7584
|
-
```
|
|
7585
|
-
See also: [Chain](./client.md#type-chain)
|
|
7586
|
-
|
|
7587
|
-
Returns
|
|
7588
|
-
|
|
7589
|
-
true if .env is not valid for chain
|
|
7590
|
-
|
|
7591
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
7592
|
-
|
|
7593
6768
|
---
|
|
7594
6769
|
##### Class: SimpleWalletManager
|
|
7595
6770
|
|
|
@@ -8412,330 +7587,29 @@ Argument Details
|
|
|
8412
7587
|
+ **args**
|
|
8413
7588
|
+ proof request and new transaction proof data
|
|
8414
7589
|
|
|
8415
|
-
###### Method validateEntities
|
|
8416
|
-
|
|
8417
|
-
Helper to force uniform behavior across database engines.
|
|
8418
|
-
Use to process all arrays of records with time stamps retreived from database.
|
|
8419
|
-
|
|
8420
|
-
```ts
|
|
8421
|
-
validateEntities<T extends sdk.EntityTimeStamp>(entities: T[], dateFields?: string[]): T[]
|
|
8422
|
-
```
|
|
8423
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
8424
|
-
|
|
8425
|
-
Returns
|
|
8426
|
-
|
|
8427
|
-
input `entities` array with contained values validated.
|
|
8428
|
-
|
|
8429
|
-
###### Method validateEntity
|
|
8430
|
-
|
|
8431
|
-
Helper to force uniform behavior across database engines.
|
|
8432
|
-
Use to process all individual records with time stamps retreived from database.
|
|
8433
|
-
|
|
8434
|
-
```ts
|
|
8435
|
-
validateEntity<T extends sdk.EntityTimeStamp>(entity: T, dateFields?: string[]): T
|
|
8436
|
-
```
|
|
8437
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
8438
|
-
|
|
8439
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
8440
|
-
|
|
8441
|
-
---
|
|
8442
|
-
##### Class: StorageKnex
|
|
8443
|
-
|
|
8444
|
-
```ts
|
|
8445
|
-
export class StorageKnex extends StorageProvider implements sdk.WalletStorageProvider {
|
|
8446
|
-
knex: Knex;
|
|
8447
|
-
constructor(options: StorageKnexOptions)
|
|
8448
|
-
async readSettings(): Promise<TableSettings>
|
|
8449
|
-
override async getProvenOrRawTx(txid: string, trx?: sdk.TrxToken): Promise<sdk.ProvenOrRawTx>
|
|
8450
|
-
dbTypeSubstring(source: string, fromOffset: number, forLength?: number)
|
|
8451
|
-
override async getRawTxOfKnownValidTransaction(txid?: string, offset?: number, length?: number, trx?: sdk.TrxToken): Promise<number[] | undefined>
|
|
8452
|
-
getProvenTxsForUserQuery(args: sdk.FindForUserSincePagedArgs): Knex.QueryBuilder
|
|
8453
|
-
override async getProvenTxsForUser(args: sdk.FindForUserSincePagedArgs): Promise<TableProvenTx[]>
|
|
8454
|
-
getProvenTxReqsForUserQuery(args: sdk.FindForUserSincePagedArgs): Knex.QueryBuilder
|
|
8455
|
-
override async getProvenTxReqsForUser(args: sdk.FindForUserSincePagedArgs): Promise<TableProvenTxReq[]>
|
|
8456
|
-
getTxLabelMapsForUserQuery(args: sdk.FindForUserSincePagedArgs): Knex.QueryBuilder
|
|
8457
|
-
override async getTxLabelMapsForUser(args: sdk.FindForUserSincePagedArgs): Promise<TableTxLabelMap[]>
|
|
8458
|
-
getOutputTagMapsForUserQuery(args: sdk.FindForUserSincePagedArgs): Knex.QueryBuilder
|
|
8459
|
-
override async getOutputTagMapsForUser(args: sdk.FindForUserSincePagedArgs): Promise<TableOutputTagMap[]>
|
|
8460
|
-
override async listActions(auth: sdk.AuthId, vargs: sdk.ValidListActionsArgs): Promise<ListActionsResult>
|
|
8461
|
-
override async listOutputs(auth: sdk.AuthId, vargs: sdk.ValidListOutputsArgs): Promise<ListOutputsResult>
|
|
8462
|
-
override async insertProvenTx(tx: TableProvenTx, trx?: sdk.TrxToken): Promise<number>
|
|
8463
|
-
override async insertProvenTxReq(tx: TableProvenTxReq, trx?: sdk.TrxToken): Promise<number>
|
|
8464
|
-
override async insertUser(user: TableUser, trx?: sdk.TrxToken): Promise<number>
|
|
8465
|
-
override async insertCertificateAuth(auth: sdk.AuthId, certificate: TableCertificateX): Promise<number>
|
|
8466
|
-
override async insertCertificate(certificate: TableCertificateX, trx?: sdk.TrxToken): Promise<number>
|
|
8467
|
-
override async insertCertificateField(certificateField: TableCertificateField, trx?: sdk.TrxToken): Promise<void>
|
|
8468
|
-
override async insertOutputBasket(basket: TableOutputBasket, trx?: sdk.TrxToken): Promise<number>
|
|
8469
|
-
override async insertTransaction(tx: TableTransaction, trx?: sdk.TrxToken): Promise<number>
|
|
8470
|
-
override async insertCommission(commission: TableCommission, trx?: sdk.TrxToken): Promise<number>
|
|
8471
|
-
override async insertOutput(output: TableOutput, trx?: sdk.TrxToken): Promise<number>
|
|
8472
|
-
override async insertOutputTag(tag: TableOutputTag, trx?: sdk.TrxToken): Promise<number>
|
|
8473
|
-
override async insertOutputTagMap(tagMap: TableOutputTagMap, trx?: sdk.TrxToken): Promise<void>
|
|
8474
|
-
override async insertTxLabel(label: TableTxLabel, trx?: sdk.TrxToken): Promise<number>
|
|
8475
|
-
override async insertTxLabelMap(labelMap: TableTxLabelMap, trx?: sdk.TrxToken): Promise<void>
|
|
8476
|
-
override async insertMonitorEvent(event: TableMonitorEvent, trx?: sdk.TrxToken): Promise<number>
|
|
8477
|
-
override async insertSyncState(syncState: TableSyncState, trx?: sdk.TrxToken): Promise<number>
|
|
8478
|
-
override async updateCertificateField(certificateId: number, fieldName: string, update: Partial<TableCertificateField>, trx?: sdk.TrxToken): Promise<number>
|
|
8479
|
-
override async updateCertificate(id: number, update: Partial<TableCertificate>, trx?: sdk.TrxToken): Promise<number>
|
|
8480
|
-
override async updateCommission(id: number, update: Partial<TableCommission>, trx?: sdk.TrxToken): Promise<number>
|
|
8481
|
-
override async updateOutputBasket(id: number, update: Partial<TableOutputBasket>, trx?: sdk.TrxToken): Promise<number>
|
|
8482
|
-
override async updateOutput(id: number, update: Partial<TableOutput>, trx?: sdk.TrxToken): Promise<number>
|
|
8483
|
-
override async updateOutputTagMap(outputId: number, tagId: number, update: Partial<TableOutputTagMap>, trx?: sdk.TrxToken): Promise<number>
|
|
8484
|
-
override async updateOutputTag(id: number, update: Partial<TableOutputTag>, trx?: sdk.TrxToken): Promise<number>
|
|
8485
|
-
override async updateProvenTxReq(id: number | number[], update: Partial<TableProvenTxReq>, trx?: sdk.TrxToken): Promise<number>
|
|
8486
|
-
override async updateProvenTx(id: number, update: Partial<TableProvenTx>, trx?: sdk.TrxToken): Promise<number>
|
|
8487
|
-
override async updateSyncState(id: number, update: Partial<TableSyncState>, trx?: sdk.TrxToken): Promise<number>
|
|
8488
|
-
override async updateTransaction(id: number | number[], update: Partial<TableTransaction>, trx?: sdk.TrxToken): Promise<number>
|
|
8489
|
-
override async updateTxLabelMap(transactionId: number, txLabelId: number, update: Partial<TableTxLabelMap>, trx?: sdk.TrxToken): Promise<number>
|
|
8490
|
-
override async updateTxLabel(id: number, update: Partial<TableTxLabel>, trx?: sdk.TrxToken): Promise<number>
|
|
8491
|
-
override async updateUser(id: number, update: Partial<TableUser>, trx?: sdk.TrxToken): Promise<number>
|
|
8492
|
-
override async updateMonitorEvent(id: number, update: Partial<TableMonitorEvent>, trx?: sdk.TrxToken): Promise<number>
|
|
8493
|
-
setupQuery<T extends object>(table: string, args: sdk.FindPartialSincePagedArgs<T>): Knex.QueryBuilder
|
|
8494
|
-
findCertificateFieldsQuery(args: sdk.FindCertificateFieldsArgs): Knex.QueryBuilder
|
|
8495
|
-
findCertificatesQuery(args: sdk.FindCertificatesArgs): Knex.QueryBuilder
|
|
8496
|
-
findCommissionsQuery(args: sdk.FindCommissionsArgs): Knex.QueryBuilder
|
|
8497
|
-
findOutputBasketsQuery(args: sdk.FindOutputBasketsArgs): Knex.QueryBuilder
|
|
8498
|
-
findOutputsQuery(args: sdk.FindOutputsArgs, count?: boolean): Knex.QueryBuilder
|
|
8499
|
-
findOutputTagMapsQuery(args: sdk.FindOutputTagMapsArgs): Knex.QueryBuilder
|
|
8500
|
-
findOutputTagsQuery(args: sdk.FindOutputTagsArgs): Knex.QueryBuilder
|
|
8501
|
-
findProvenTxReqsQuery(args: sdk.FindProvenTxReqsArgs): Knex.QueryBuilder
|
|
8502
|
-
findProvenTxsQuery(args: sdk.FindProvenTxsArgs): Knex.QueryBuilder
|
|
8503
|
-
findSyncStatesQuery(args: sdk.FindSyncStatesArgs): Knex.QueryBuilder
|
|
8504
|
-
findTransactionsQuery(args: sdk.FindTransactionsArgs, count?: boolean): Knex.QueryBuilder
|
|
8505
|
-
findTxLabelMapsQuery(args: sdk.FindTxLabelMapsArgs): Knex.QueryBuilder
|
|
8506
|
-
findTxLabelsQuery(args: sdk.FindTxLabelsArgs): Knex.QueryBuilder
|
|
8507
|
-
findUsersQuery(args: sdk.FindUsersArgs): Knex.QueryBuilder
|
|
8508
|
-
findMonitorEventsQuery(args: sdk.FindMonitorEventsArgs): Knex.QueryBuilder
|
|
8509
|
-
override async findCertificatesAuth(auth: sdk.AuthId, args: sdk.FindCertificatesArgs): Promise<TableCertificateX[]>
|
|
8510
|
-
override async findOutputBasketsAuth(auth: sdk.AuthId, args: sdk.FindOutputBasketsArgs): Promise<TableOutputBasket[]>
|
|
8511
|
-
override async findOutputsAuth(auth: sdk.AuthId, args: sdk.FindOutputsArgs): Promise<TableOutput[]>
|
|
8512
|
-
override async findCertificateFields(args: sdk.FindCertificateFieldsArgs): Promise<TableCertificateField[]>
|
|
8513
|
-
override async findCertificates(args: sdk.FindCertificatesArgs): Promise<TableCertificateX[]>
|
|
8514
|
-
override async findCommissions(args: sdk.FindCommissionsArgs): Promise<TableCommission[]>
|
|
8515
|
-
override async findOutputBaskets(args: sdk.FindOutputBasketsArgs): Promise<TableOutputBasket[]>
|
|
8516
|
-
override async findOutputs(args: sdk.FindOutputsArgs): Promise<TableOutput[]>
|
|
8517
|
-
override async findOutputTagMaps(args: sdk.FindOutputTagMapsArgs): Promise<TableOutputTagMap[]>
|
|
8518
|
-
override async findOutputTags(args: sdk.FindOutputTagsArgs): Promise<TableOutputTag[]>
|
|
8519
|
-
override async findProvenTxReqs(args: sdk.FindProvenTxReqsArgs): Promise<TableProvenTxReq[]>
|
|
8520
|
-
override async findProvenTxs(args: sdk.FindProvenTxsArgs): Promise<TableProvenTx[]>
|
|
8521
|
-
override async findSyncStates(args: sdk.FindSyncStatesArgs): Promise<TableSyncState[]>
|
|
8522
|
-
override async findTransactions(args: sdk.FindTransactionsArgs): Promise<TableTransaction[]>
|
|
8523
|
-
override async findTxLabelMaps(args: sdk.FindTxLabelMapsArgs): Promise<TableTxLabelMap[]>
|
|
8524
|
-
override async findTxLabels(args: sdk.FindTxLabelsArgs): Promise<TableTxLabel[]>
|
|
8525
|
-
override async findUsers(args: sdk.FindUsersArgs): Promise<TableUser[]>
|
|
8526
|
-
override async findMonitorEvents(args: sdk.FindMonitorEventsArgs): Promise<TableMonitorEvent[]>
|
|
8527
|
-
async getCount<T extends object>(q: Knex.QueryBuilder<T, T[]>): Promise<number>
|
|
8528
|
-
override async countCertificateFields(args: sdk.FindCertificateFieldsArgs): Promise<number>
|
|
8529
|
-
override async countCertificates(args: sdk.FindCertificatesArgs): Promise<number>
|
|
8530
|
-
override async countCommissions(args: sdk.FindCommissionsArgs): Promise<number>
|
|
8531
|
-
override async countOutputBaskets(args: sdk.FindOutputBasketsArgs): Promise<number>
|
|
8532
|
-
override async countOutputs(args: sdk.FindOutputsArgs): Promise<number>
|
|
8533
|
-
override async countOutputTagMaps(args: sdk.FindOutputTagMapsArgs): Promise<number>
|
|
8534
|
-
override async countOutputTags(args: sdk.FindOutputTagsArgs): Promise<number>
|
|
8535
|
-
override async countProvenTxReqs(args: sdk.FindProvenTxReqsArgs): Promise<number>
|
|
8536
|
-
override async countProvenTxs(args: sdk.FindProvenTxsArgs): Promise<number>
|
|
8537
|
-
override async countSyncStates(args: sdk.FindSyncStatesArgs): Promise<number>
|
|
8538
|
-
override async countTransactions(args: sdk.FindTransactionsArgs): Promise<number>
|
|
8539
|
-
override async countTxLabelMaps(args: sdk.FindTxLabelMapsArgs): Promise<number>
|
|
8540
|
-
override async countTxLabels(args: sdk.FindTxLabelsArgs): Promise<number>
|
|
8541
|
-
override async countUsers(args: sdk.FindUsersArgs): Promise<number>
|
|
8542
|
-
override async countMonitorEvents(args: sdk.FindMonitorEventsArgs): Promise<number>
|
|
8543
|
-
override async destroy(): Promise<void>
|
|
8544
|
-
override async migrate(storageName: string, storageIdentityKey: string): Promise<string>
|
|
8545
|
-
override async dropAllData(): Promise<void>
|
|
8546
|
-
override async transaction<T>(scope: (trx: sdk.TrxToken) => Promise<T>, trx?: sdk.TrxToken): Promise<T>
|
|
8547
|
-
toDb(trx?: sdk.TrxToken)
|
|
8548
|
-
async validateRawTransaction(t: TableTransaction, trx?: sdk.TrxToken): Promise<void>
|
|
8549
|
-
async validateOutputScript(o: TableOutput, trx?: sdk.TrxToken): Promise<void>
|
|
8550
|
-
_verifiedReadyForDatabaseAccess: boolean = false;
|
|
8551
|
-
async verifyReadyForDatabaseAccess(trx?: sdk.TrxToken): Promise<DBType>
|
|
8552
|
-
validatePartialForUpdate<T extends sdk.EntityTimeStamp>(update: Partial<T>, dateFields?: string[], booleanFields?: string[]): Partial<T>
|
|
8553
|
-
async validateEntityForInsert<T extends sdk.EntityTimeStamp>(entity: T, trx?: sdk.TrxToken, dateFields?: string[], booleanFields?: string[]): Promise<any>
|
|
8554
|
-
override async getLabelsForTransactionId(transactionId?: number, trx?: sdk.TrxToken): Promise<TableTxLabel[]>
|
|
8555
|
-
async extendOutput(o: TableOutput, includeBasket = false, includeTags = false, trx?: sdk.TrxToken): Promise<TableOutputX>
|
|
8556
|
-
override async getTagsForOutputId(outputId: number, trx?: sdk.TrxToken): Promise<TableOutputTag[]>
|
|
8557
|
-
override async purgeData(params: sdk.PurgeParams, trx?: sdk.TrxToken): Promise<sdk.PurgeResults>
|
|
8558
|
-
override async reviewStatus(args: {
|
|
8559
|
-
agedLimit: Date;
|
|
8560
|
-
trx?: sdk.TrxToken;
|
|
8561
|
-
}): Promise<{
|
|
8562
|
-
log: string;
|
|
8563
|
-
}>
|
|
8564
|
-
async countChangeInputs(userId: number, basketId: number, excludeSending: boolean): Promise<number>
|
|
8565
|
-
async allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined> {
|
|
8566
|
-
const status: sdk.TransactionStatus[] = ["completed", "unproven"];
|
|
8567
|
-
if (!excludeSending)
|
|
8568
|
-
status.push("sending");
|
|
8569
|
-
const statusText = status.map(s => `'${s}'`).join(",");
|
|
8570
|
-
const r: TableOutput | undefined = await this.knex.transaction(async (trx) => {
|
|
8571
|
-
const txStatusCondition = `AND (SELECT status FROM transactions WHERE outputs.transactionId = transactions.transactionId) in (${statusText})`;
|
|
8572
|
-
let outputId: number | undefined;
|
|
8573
|
-
const setOutputId = async (rawQuery: string): Promise<void> => {
|
|
8574
|
-
let oidr = await trx.raw(rawQuery);
|
|
8575
|
-
outputId = undefined;
|
|
8576
|
-
if (!oidr["outputId"] && oidr.length > 0)
|
|
8577
|
-
oidr = oidr[0];
|
|
8578
|
-
if (!oidr["outputId"] && oidr.length > 0)
|
|
8579
|
-
oidr = oidr[0];
|
|
8580
|
-
if (oidr["outputId"])
|
|
8581
|
-
outputId = Number(oidr["outputId"]);
|
|
8582
|
-
};
|
|
8583
|
-
if (exactSatoshis !== undefined) {
|
|
8584
|
-
await setOutputId(`
|
|
8585
|
-
SELECT outputId
|
|
8586
|
-
FROM outputs
|
|
8587
|
-
WHERE userId = ${userId}
|
|
8588
|
-
AND spendable = 1
|
|
8589
|
-
AND basketId = ${basketId}
|
|
8590
|
-
${txStatusCondition}
|
|
8591
|
-
AND satoshis = ${exactSatoshis}
|
|
8592
|
-
LIMIT 1;
|
|
8593
|
-
`);
|
|
8594
|
-
}
|
|
8595
|
-
if (outputId === undefined) {
|
|
8596
|
-
await setOutputId(`
|
|
8597
|
-
SELECT outputId
|
|
8598
|
-
FROM outputs
|
|
8599
|
-
WHERE userId = ${userId}
|
|
8600
|
-
AND spendable = 1
|
|
8601
|
-
AND basketId = ${basketId}
|
|
8602
|
-
${txStatusCondition}
|
|
8603
|
-
AND satoshis - ${targetSatoshis} = (
|
|
8604
|
-
SELECT MIN(satoshis - ${targetSatoshis})
|
|
8605
|
-
FROM outputs
|
|
8606
|
-
WHERE userId = ${userId}
|
|
8607
|
-
AND spendable = 1
|
|
8608
|
-
AND basketId = ${basketId}
|
|
8609
|
-
${txStatusCondition}
|
|
8610
|
-
AND satoshis - ${targetSatoshis} >= 0
|
|
8611
|
-
)
|
|
8612
|
-
LIMIT 1;
|
|
8613
|
-
`);
|
|
8614
|
-
}
|
|
8615
|
-
if (outputId === undefined) {
|
|
8616
|
-
await setOutputId(`
|
|
8617
|
-
SELECT outputId
|
|
8618
|
-
FROM outputs
|
|
8619
|
-
WHERE userId = ${userId}
|
|
8620
|
-
AND spendable = 1
|
|
8621
|
-
AND basketId = ${basketId}
|
|
8622
|
-
${txStatusCondition}
|
|
8623
|
-
AND satoshis - ${targetSatoshis} = (
|
|
8624
|
-
SELECT MAX(satoshis - ${targetSatoshis})
|
|
8625
|
-
FROM outputs
|
|
8626
|
-
WHERE userId = ${userId}
|
|
8627
|
-
AND spendable = 1
|
|
8628
|
-
AND basketId = ${basketId}
|
|
8629
|
-
${txStatusCondition}
|
|
8630
|
-
AND satoshis - ${targetSatoshis} < 0
|
|
8631
|
-
)
|
|
8632
|
-
LIMIT 1;
|
|
8633
|
-
`);
|
|
8634
|
-
}
|
|
8635
|
-
if (outputId === undefined)
|
|
8636
|
-
return undefined;
|
|
8637
|
-
await this.updateOutput(outputId, {
|
|
8638
|
-
spendable: false,
|
|
8639
|
-
spentBy: transactionId
|
|
8640
|
-
}, trx);
|
|
8641
|
-
const r = verifyTruthy(await this.findOutputById(outputId, trx));
|
|
8642
|
-
return r;
|
|
8643
|
-
});
|
|
8644
|
-
return r;
|
|
8645
|
-
}
|
|
8646
|
-
validateEntity<T extends sdk.EntityTimeStamp>(entity: T, dateFields?: string[], booleanFields?: string[]): T
|
|
8647
|
-
validateEntities<T extends sdk.EntityTimeStamp>(entities: T[], dateFields?: string[], booleanFields?: string[]): T[]
|
|
8648
|
-
}
|
|
8649
|
-
```
|
|
8650
|
-
|
|
8651
|
-
See also: [AuthId](./client.md#interface-authid), [DBType](./storage.md#type-dbtype), [EntityTimeStamp](./client.md#interface-entitytimestamp), [FindCertificateFieldsArgs](./client.md#interface-findcertificatefieldsargs), [FindCertificatesArgs](./client.md#interface-findcertificatesargs), [FindCommissionsArgs](./client.md#interface-findcommissionsargs), [FindForUserSincePagedArgs](./client.md#interface-findforusersincepagedargs), [FindMonitorEventsArgs](./client.md#interface-findmonitoreventsargs), [FindOutputBasketsArgs](./client.md#interface-findoutputbasketsargs), [FindOutputTagMapsArgs](./client.md#interface-findoutputtagmapsargs), [FindOutputTagsArgs](./client.md#interface-findoutputtagsargs), [FindOutputsArgs](./client.md#interface-findoutputsargs), [FindPartialSincePagedArgs](./client.md#interface-findpartialsincepagedargs), [FindProvenTxReqsArgs](./client.md#interface-findproventxreqsargs), [FindProvenTxsArgs](./client.md#interface-findproventxsargs), [FindSyncStatesArgs](./client.md#interface-findsyncstatesargs), [FindTransactionsArgs](./client.md#interface-findtransactionsargs), [FindTxLabelMapsArgs](./client.md#interface-findtxlabelmapsargs), [FindTxLabelsArgs](./client.md#interface-findtxlabelsargs), [FindUsersArgs](./client.md#interface-findusersargs), [ProvenOrRawTx](./client.md#interface-provenorrawtx), [PurgeParams](./client.md#interface-purgeparams), [PurgeResults](./client.md#interface-purgeresults), [StorageKnexOptions](./storage.md#interface-storageknexoptions), [StorageProvider](./storage.md#class-storageprovider), [TableCertificate](./storage.md#interface-tablecertificate), [TableCertificateField](./storage.md#interface-tablecertificatefield), [TableCertificateX](./storage.md#interface-tablecertificatex), [TableCommission](./storage.md#interface-tablecommission), [TableMonitorEvent](./storage.md#interface-tablemonitorevent), [TableOutput](./storage.md#interface-tableoutput), [TableOutputBasket](./storage.md#interface-tableoutputbasket), [TableOutputTag](./storage.md#interface-tableoutputtag), [TableOutputTagMap](./storage.md#interface-tableoutputtagmap), [TableOutputX](./storage.md#interface-tableoutputx), [TableProvenTx](./storage.md#interface-tableproventx), [TableProvenTxReq](./storage.md#interface-tableproventxreq), [TableSettings](./storage.md#interface-tablesettings), [TableSyncState](./storage.md#interface-tablesyncstate), [TableTransaction](./storage.md#interface-tabletransaction), [TableTxLabel](./storage.md#interface-tabletxlabel), [TableTxLabelMap](./storage.md#interface-tabletxlabelmap), [TableUser](./storage.md#interface-tableuser), [TransactionStatus](./client.md#type-transactionstatus), [TrxToken](./client.md#interface-trxtoken), [ValidListActionsArgs](./client.md#interface-validlistactionsargs), [ValidListOutputsArgs](./client.md#interface-validlistoutputsargs), [WalletStorageProvider](./client.md#interface-walletstorageprovider), [listActions](./storage.md#function-listactions), [listOutputs](./storage.md#function-listoutputs), [purgeData](./storage.md#function-purgedata), [reviewStatus](./storage.md#function-reviewstatus), [verifyTruthy](./client.md#function-verifytruthy)
|
|
8652
|
-
|
|
8653
|
-
###### Method allocateChangeInput
|
|
8654
|
-
|
|
8655
|
-
Finds closest matching available change output to use as input for new transaction.
|
|
8656
|
-
|
|
8657
|
-
Transactionally allocate the output such that
|
|
8658
|
-
|
|
8659
|
-
```ts
|
|
8660
|
-
async allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined>
|
|
8661
|
-
```
|
|
8662
|
-
See also: [TableOutput](./storage.md#interface-tableoutput)
|
|
8663
|
-
|
|
8664
|
-
###### Method countChangeInputs
|
|
8665
|
-
|
|
8666
|
-
Finds closest matching available change output to use as input for new transaction.
|
|
8667
|
-
|
|
8668
|
-
Transactionally allocate the output such that
|
|
8669
|
-
|
|
8670
|
-
```ts
|
|
8671
|
-
async countChangeInputs(userId: number, basketId: number, excludeSending: boolean): Promise<number>
|
|
8672
|
-
```
|
|
8673
|
-
|
|
8674
|
-
###### Method toDb
|
|
8675
|
-
|
|
8676
|
-
Convert the standard optional `TrxToken` parameter into either a direct knex database instance,
|
|
8677
|
-
or a Knex.Transaction as appropriate.
|
|
8678
|
-
|
|
8679
|
-
```ts
|
|
8680
|
-
toDb(trx?: sdk.TrxToken)
|
|
8681
|
-
```
|
|
8682
|
-
See also: [TrxToken](./client.md#interface-trxtoken)
|
|
8683
|
-
|
|
8684
|
-
###### Method validateEntities
|
|
8685
|
-
|
|
8686
|
-
Helper to force uniform behavior across database engines.
|
|
8687
|
-
Use to process all arrays of records with time stamps retreived from database.
|
|
8688
|
-
|
|
8689
|
-
```ts
|
|
8690
|
-
validateEntities<T extends sdk.EntityTimeStamp>(entities: T[], dateFields?: string[], booleanFields?: string[]): T[]
|
|
8691
|
-
```
|
|
8692
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
8693
|
-
|
|
8694
|
-
Returns
|
|
8695
|
-
|
|
8696
|
-
input `entities` array with contained values validated.
|
|
8697
|
-
|
|
8698
|
-
###### Method validateEntity
|
|
8699
|
-
|
|
8700
|
-
Helper to force uniform behavior across database engines.
|
|
8701
|
-
Use to process all individual records with time stamps retreived from database.
|
|
8702
|
-
|
|
8703
|
-
```ts
|
|
8704
|
-
validateEntity<T extends sdk.EntityTimeStamp>(entity: T, dateFields?: string[], booleanFields?: string[]): T
|
|
8705
|
-
```
|
|
8706
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
8707
|
-
|
|
8708
|
-
###### Method validateEntityForInsert
|
|
8709
|
-
|
|
8710
|
-
Helper to force uniform behavior across database engines.
|
|
8711
|
-
Use to process new entities being inserted into the database.
|
|
8712
|
-
|
|
8713
|
-
```ts
|
|
8714
|
-
async validateEntityForInsert<T extends sdk.EntityTimeStamp>(entity: T, trx?: sdk.TrxToken, dateFields?: string[], booleanFields?: string[]): Promise<any>
|
|
8715
|
-
```
|
|
8716
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp), [TrxToken](./client.md#interface-trxtoken)
|
|
8717
|
-
|
|
8718
|
-
###### Method validatePartialForUpdate
|
|
7590
|
+
###### Method validateEntities
|
|
8719
7591
|
|
|
8720
7592
|
Helper to force uniform behavior across database engines.
|
|
8721
|
-
Use to process
|
|
7593
|
+
Use to process all arrays of records with time stamps retreived from database.
|
|
8722
7594
|
|
|
8723
7595
|
```ts
|
|
8724
|
-
|
|
7596
|
+
validateEntities<T extends sdk.EntityTimeStamp>(entities: T[], dateFields?: string[]): T[]
|
|
8725
7597
|
```
|
|
8726
7598
|
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
8727
7599
|
|
|
8728
|
-
|
|
7600
|
+
Returns
|
|
7601
|
+
|
|
7602
|
+
input `entities` array with contained values validated.
|
|
8729
7603
|
|
|
8730
|
-
|
|
7604
|
+
###### Method validateEntity
|
|
8731
7605
|
|
|
8732
|
-
|
|
8733
|
-
|
|
7606
|
+
Helper to force uniform behavior across database engines.
|
|
7607
|
+
Use to process all individual records with time stamps retreived from database.
|
|
8734
7608
|
|
|
8735
7609
|
```ts
|
|
8736
|
-
|
|
7610
|
+
validateEntity<T extends sdk.EntityTimeStamp>(entity: T, dateFields?: string[]): T
|
|
8737
7611
|
```
|
|
8738
|
-
See also: [
|
|
7612
|
+
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
8739
7613
|
|
|
8740
7614
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
8741
7615
|
|
|
@@ -9058,47 +7932,6 @@ See also: [AuthId](./client.md#interface-authid), [FindOutputTagMapsArgs](./clie
|
|
|
9058
7932
|
|
|
9059
7933
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
9060
7934
|
|
|
9061
|
-
---
|
|
9062
|
-
##### Class: StorageServer
|
|
9063
|
-
|
|
9064
|
-
```ts
|
|
9065
|
-
export class StorageServer {
|
|
9066
|
-
constructor(storage: StorageProvider, options: WalletStorageServerOptions)
|
|
9067
|
-
public start(): void
|
|
9068
|
-
validateDate(date: Date | string | number): Date
|
|
9069
|
-
validateEntity<T extends sdk.EntityTimeStamp>(entity: T, dateFields?: string[]): T
|
|
9070
|
-
validateEntities<T extends sdk.EntityTimeStamp>(entities: T[], dateFields?: string[]): T[]
|
|
9071
|
-
}
|
|
9072
|
-
```
|
|
9073
|
-
|
|
9074
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp), [StorageProvider](./storage.md#class-storageprovider), [WalletStorageServerOptions](./storage.md#interface-walletstorageserveroptions)
|
|
9075
|
-
|
|
9076
|
-
###### Method validateEntities
|
|
9077
|
-
|
|
9078
|
-
Helper to force uniform behavior across database engines.
|
|
9079
|
-
Use to process all arrays of records with time stamps retreived from database.
|
|
9080
|
-
|
|
9081
|
-
```ts
|
|
9082
|
-
validateEntities<T extends sdk.EntityTimeStamp>(entities: T[], dateFields?: string[]): T[]
|
|
9083
|
-
```
|
|
9084
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
9085
|
-
|
|
9086
|
-
Returns
|
|
9087
|
-
|
|
9088
|
-
input `entities` array with contained values validated.
|
|
9089
|
-
|
|
9090
|
-
###### Method validateEntity
|
|
9091
|
-
|
|
9092
|
-
Helper to force uniform behavior across database engines.
|
|
9093
|
-
Use to process all individual records with time stamps retreived from database.
|
|
9094
|
-
|
|
9095
|
-
```ts
|
|
9096
|
-
validateEntity<T extends sdk.EntityTimeStamp>(entity: T, dateFields?: string[]): T
|
|
9097
|
-
```
|
|
9098
|
-
See also: [EntityTimeStamp](./client.md#interface-entitytimestamp)
|
|
9099
|
-
|
|
9100
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
9101
|
-
|
|
9102
7935
|
---
|
|
9103
7936
|
##### Class: StorageSyncReader
|
|
9104
7937
|
|
|
@@ -9270,9 +8103,9 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
9270
8103
|
```ts
|
|
9271
8104
|
export class TaskNewHeader extends WalletMonitorTask {
|
|
9272
8105
|
static taskName = "NewHeader";
|
|
9273
|
-
header?:
|
|
8106
|
+
header?: BlockHeader;
|
|
9274
8107
|
constructor(monitor: Monitor, public triggerMsecs = 1 * monitor.oneMinute)
|
|
9275
|
-
async getHeader(): Promise<
|
|
8108
|
+
async getHeader(): Promise<BlockHeader>
|
|
9276
8109
|
trigger(nowMsecsSinceEpoch: number): {
|
|
9277
8110
|
run: boolean;
|
|
9278
8111
|
}
|
|
@@ -9280,7 +8113,7 @@ export class TaskNewHeader extends WalletMonitorTask {
|
|
|
9280
8113
|
}
|
|
9281
8114
|
```
|
|
9282
8115
|
|
|
9283
|
-
See also: [BlockHeader](./
|
|
8116
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [Monitor](./monitor.md#class-monitor), [WalletMonitorTask](./monitor.md#class-walletmonitortask)
|
|
9284
8117
|
|
|
9285
8118
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
9286
8119
|
|
|
@@ -9406,57 +8239,6 @@ See also: [Monitor](./monitor.md#class-monitor), [WalletMonitorTask](./monitor.m
|
|
|
9406
8239
|
|
|
9407
8240
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
9408
8241
|
|
|
9409
|
-
---
|
|
9410
|
-
##### Class: TaskUnFail
|
|
9411
|
-
|
|
9412
|
-
Setting provenTxReq status to 'unfail' when 'invalid' will attempt to find a merklePath, and if successful:
|
|
9413
|
-
|
|
9414
|
-
1. set the req status to 'unmined'
|
|
9415
|
-
2. set the referenced txs to 'unproven'
|
|
9416
|
-
3. determine if any inputs match user's existing outputs and if so update spentBy and spendable of those outputs.
|
|
9417
|
-
4. set the txs outputs to spendable
|
|
9418
|
-
|
|
9419
|
-
If it fails (to find a merklePath), returns the req status to 'invalid'.
|
|
9420
|
-
|
|
9421
|
-
```ts
|
|
9422
|
-
export class TaskUnFail extends WalletMonitorTask {
|
|
9423
|
-
static taskName = "UnFail";
|
|
9424
|
-
static checkNow = false;
|
|
9425
|
-
constructor(monitor: Monitor, public triggerMsecs = monitor.oneMinute * 10)
|
|
9426
|
-
trigger(nowMsecsSinceEpoch: number): {
|
|
9427
|
-
run: boolean;
|
|
9428
|
-
}
|
|
9429
|
-
async runTask(): Promise<string>
|
|
9430
|
-
async unfail(reqs: TableProvenTxReq[], indent = 0): Promise<{
|
|
9431
|
-
log: string;
|
|
9432
|
-
}>
|
|
9433
|
-
async unfailReq(req: EntityProvenTxReq, indent: number): Promise<string>
|
|
9434
|
-
}
|
|
9435
|
-
```
|
|
9436
|
-
|
|
9437
|
-
See also: [EntityProvenTxReq](./storage.md#class-entityproventxreq), [Monitor](./monitor.md#class-monitor), [TableProvenTxReq](./storage.md#interface-tableproventxreq), [WalletMonitorTask](./monitor.md#class-walletmonitortask)
|
|
9438
|
-
|
|
9439
|
-
###### Property checkNow
|
|
9440
|
-
|
|
9441
|
-
Set to true to trigger running this task
|
|
9442
|
-
|
|
9443
|
-
```ts
|
|
9444
|
-
static checkNow = false
|
|
9445
|
-
```
|
|
9446
|
-
|
|
9447
|
-
###### Method unfailReq
|
|
9448
|
-
|
|
9449
|
-
2. set the referenced txs to 'unproven'
|
|
9450
|
-
3. determine if any inputs match user's existing outputs and if so update spentBy and spendable of those outputs.
|
|
9451
|
-
4. set the txs outputs to spendable
|
|
9452
|
-
|
|
9453
|
-
```ts
|
|
9454
|
-
async unfailReq(req: EntityProvenTxReq, indent: number): Promise<string>
|
|
9455
|
-
```
|
|
9456
|
-
See also: [EntityProvenTxReq](./storage.md#class-entityproventxreq)
|
|
9457
|
-
|
|
9458
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
9459
|
-
|
|
9460
8242
|
---
|
|
9461
8243
|
##### Class: TwilioPhoneInteractor
|
|
9462
8244
|
|
|
@@ -11146,160 +9928,48 @@ Argument Details
|
|
|
11146
9928
|
|
|
11147
9929
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11148
9930
|
|
|
11149
|
-
---
|
|
11150
|
-
##### Class: localKVStore
|
|
11151
|
-
|
|
11152
|
-
Implements a key-value storage system backed by transaction outputs managed by a wallet.
|
|
11153
|
-
Each key-value pair is represented by a PushDrop token output in a specific context (basket).
|
|
11154
|
-
Allows setting, getting, and removing key-value pairs, with optional encryption.
|
|
11155
|
-
|
|
11156
|
-
```ts
|
|
11157
|
-
export default class localKVStore {
|
|
11158
|
-
constructor(wallet?: WalletInterface, context?: string, encrypt?: boolean);
|
|
11159
|
-
get(key: string, defaultValue?: string | undefined): Promise<string | undefined>;
|
|
11160
|
-
set(key: string, value: string): Promise<OutpointString>;
|
|
11161
|
-
remove(key: string): Promise<OutpointString | void>;
|
|
11162
|
-
}
|
|
11163
|
-
```
|
|
11164
|
-
|
|
11165
|
-
###### Constructor
|
|
11166
|
-
|
|
11167
|
-
Creates an instance of the localKVStore.
|
|
11168
|
-
|
|
11169
|
-
```ts
|
|
11170
|
-
constructor(wallet?: WalletInterface, context?: string, encrypt?: boolean)
|
|
11171
|
-
```
|
|
11172
|
-
|
|
11173
|
-
Argument Details
|
|
11174
|
-
|
|
11175
|
-
+ **wallet**
|
|
11176
|
-
+ The wallet interface to use. Defaults to a new WalletClient instance.
|
|
11177
|
-
+ **context**
|
|
11178
|
-
+ The context (basket) for namespacing keys. Defaults to 'kvstore-default'.
|
|
11179
|
-
+ **encrypt**
|
|
11180
|
-
+ Whether to encrypt values. Defaults to true.
|
|
11181
|
-
|
|
11182
|
-
Throws
|
|
11183
|
-
|
|
11184
|
-
If the context is missing or empty.
|
|
11185
|
-
|
|
11186
|
-
###### Method get
|
|
11187
|
-
|
|
11188
|
-
Retrieves the value associated with a given key.
|
|
11189
|
-
|
|
11190
|
-
```ts
|
|
11191
|
-
get(key: string, defaultValue?: string | undefined): Promise<string | undefined>
|
|
11192
|
-
```
|
|
11193
|
-
|
|
11194
|
-
Returns
|
|
11195
|
-
|
|
11196
|
-
A promise that resolves to the value as a string,
|
|
11197
|
-
the defaultValue if the key is not found, or undefined if no defaultValue is provided.
|
|
11198
|
-
|
|
11199
|
-
Argument Details
|
|
11200
|
-
|
|
11201
|
-
+ **key**
|
|
11202
|
-
+ The key to retrieve the value for.
|
|
11203
|
-
+ **defaultValue**
|
|
11204
|
-
+ The value to return if the key is not found.
|
|
11205
|
-
|
|
11206
|
-
Throws
|
|
11207
|
-
|
|
11208
|
-
If multiple outputs are found for the key (ambiguous state).
|
|
11209
|
-
|
|
11210
|
-
If the found output's locking script cannot be decoded or represents an invalid token format.
|
|
11211
|
-
|
|
11212
|
-
###### Method remove
|
|
11213
|
-
|
|
11214
|
-
Removes the key-value pair associated with the given key.
|
|
11215
|
-
It finds the existing output(s) for the key and spends them without creating a new output.
|
|
11216
|
-
If multiple outputs exist, they are all spent in the same transaction.
|
|
11217
|
-
If the key does not exist, it does nothing.
|
|
11218
|
-
If signing the removal transaction fails, it relinquishes the original outputs instead of spending.
|
|
11219
|
-
|
|
11220
|
-
```ts
|
|
11221
|
-
remove(key: string): Promise<OutpointString | void>
|
|
11222
|
-
```
|
|
11223
|
-
|
|
11224
|
-
Returns
|
|
11225
|
-
|
|
11226
|
-
A promise that resolves to the txid of the removal transaction if successful.
|
|
11227
|
-
|
|
11228
|
-
Argument Details
|
|
11229
|
-
|
|
11230
|
-
+ **key**
|
|
11231
|
-
+ The key to remove.
|
|
11232
|
-
|
|
11233
|
-
###### Method set
|
|
11234
|
-
|
|
11235
|
-
Sets or updates the value associated with a given key.
|
|
11236
|
-
If the key already exists (one or more outputs found), it spends the existing output(s)
|
|
11237
|
-
and creates a new one with the updated value. If multiple outputs exist for the key,
|
|
11238
|
-
they are collapsed into a single new output.
|
|
11239
|
-
If the key does not exist, it creates a new output.
|
|
11240
|
-
Handles encryption if enabled.
|
|
11241
|
-
If signing the update/collapse transaction fails, it relinquishes the original outputs and starts over with a new chain.
|
|
11242
|
-
|
|
11243
|
-
```ts
|
|
11244
|
-
set(key: string, value: string): Promise<OutpointString>
|
|
11245
|
-
```
|
|
11246
|
-
|
|
11247
|
-
Returns
|
|
11248
|
-
|
|
11249
|
-
A promise that resolves to the outpoint string (txid.vout) of the new or updated token output.
|
|
11250
|
-
|
|
11251
|
-
Argument Details
|
|
11252
|
-
|
|
11253
|
-
+ **key**
|
|
11254
|
-
+ The key to set or update.
|
|
11255
|
-
+ **value**
|
|
11256
|
-
+ The value to associate with the key.
|
|
11257
|
-
|
|
11258
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11259
|
-
|
|
11260
9931
|
---
|
|
11261
9932
|
#### Functions
|
|
11262
9933
|
|
|
11263
9934
|
| | | |
|
|
11264
9935
|
| --- | --- | --- |
|
|
11265
|
-
| [acquireDirectCertificate](#function-acquiredirectcertificate) | [
|
|
11266
|
-
| [arcDefaultUrl](#function-arcdefaulturl) | [
|
|
11267
|
-
| [arraysEqual](#function-arraysequal) | [
|
|
9936
|
+
| [acquireDirectCertificate](#function-acquiredirectcertificate) | [isLiveBlockHeader](#function-isliveblockheader) | [validateCreateActionOutput](#function-validatecreateactionoutput) |
|
|
9937
|
+
| [arcDefaultUrl](#function-arcdefaulturl) | [listCertificates](#function-listcertificates) | [validateDiscoverByAttributesArgs](#function-validatediscoverbyattributesargs) |
|
|
9938
|
+
| [arraysEqual](#function-arraysequal) | [lockScriptWithKeyOffsetFromPubKey](#function-lockscriptwithkeyoffsetfrompubkey) | [validateDiscoverByIdentityKeyArgs](#function-validatediscoverbyidentitykeyargs) |
|
|
11268
9939
|
| [asArray](#function-asarray) | [makeAtomicBeef](#function-makeatomicbeef) | [validateGenerateChangeSdkParams](#function-validategeneratechangesdkparams) |
|
|
11269
|
-
| [
|
|
11270
|
-
| [
|
|
11271
|
-
| [
|
|
11272
|
-
| [
|
|
11273
|
-
| [
|
|
11274
|
-
| [
|
|
11275
|
-
| [
|
|
11276
|
-
| [
|
|
11277
|
-
| [
|
|
11278
|
-
| [
|
|
11279
|
-
| [
|
|
11280
|
-
| [
|
|
11281
|
-
| [
|
|
11282
|
-
| [
|
|
11283
|
-
| [
|
|
11284
|
-
| [
|
|
11285
|
-
| [
|
|
11286
|
-
| [
|
|
11287
|
-
| [
|
|
11288
|
-
| [
|
|
11289
|
-
| [
|
|
11290
|
-
| [
|
|
11291
|
-
| [
|
|
11292
|
-
| [
|
|
11293
|
-
| [
|
|
11294
|
-
| [
|
|
11295
|
-
| [
|
|
11296
|
-
| [
|
|
11297
|
-
| [
|
|
11298
|
-
| [isHexString](#function-ishexstring) | [
|
|
11299
|
-
| [isListActionsSpecOp](#function-islistactionsspecop) | [
|
|
11300
|
-
| [isListOutputsSpecOp](#function-islistoutputsspecop) | [
|
|
11301
|
-
| [
|
|
11302
|
-
| [listCertificates](#function-listcertificates) | [validateCreateActionOptions](#function-validatecreateactionoptions) | |
|
|
9940
|
+
| [asBsvSdkPrivateKey](#function-asbsvsdkprivatekey) | [makeAtomicBeef](#function-makeatomicbeef) | [validateGenerateChangeSdkResult](#function-validategeneratechangesdkresult) |
|
|
9941
|
+
| [asBsvSdkPublickKey](#function-asbsvsdkpublickkey) | [makeChangeLock](#function-makechangelock) | [validateInteger](#function-validateinteger) |
|
|
9942
|
+
| [asBsvSdkScript](#function-asbsvsdkscript) | [maxDate](#function-maxdate) | [validateInternalizeActionArgs](#function-validateinternalizeactionargs) |
|
|
9943
|
+
| [asBsvSdkTx](#function-asbsvsdktx) | [offsetPubKey](#function-offsetpubkey) | [validateInternalizeOutput](#function-validateinternalizeoutput) |
|
|
9944
|
+
| [asString](#function-asstring) | [optionalArraysEqual](#function-optionalarraysequal) | [validateListActionsArgs](#function-validatelistactionsargs) |
|
|
9945
|
+
| [attemptToPostReqsToNetwork](#function-attempttopostreqstonetwork) | [parseTxScriptOffsets](#function-parsetxscriptoffsets) | [validateListCertificatesArgs](#function-validatelistcertificatesargs) |
|
|
9946
|
+
| [buildSignableTransaction](#function-buildsignabletransaction) | [parseWalletOutpoint](#function-parsewalletoutpoint) | [validateListOutputsArgs](#function-validatelistoutputsargs) |
|
|
9947
|
+
| [completeSignedTransaction](#function-completesignedtransaction) | [processAction](#function-processaction) | [validateOptionalInteger](#function-validateoptionalinteger) |
|
|
9948
|
+
| [completeSignedTransaction](#function-completesignedtransaction) | [processAction](#function-processaction) | [validateOptionalOutpointString](#function-validateoptionaloutpointstring) |
|
|
9949
|
+
| [convertProofToMerklePath](#function-convertprooftomerklepath) | [proveCertificate](#function-provecertificate) | [validateOriginator](#function-validateoriginator) |
|
|
9950
|
+
| [createAction](#function-createaction) | [randomBytes](#function-randombytes) | [validateOutpointString](#function-validateoutpointstring) |
|
|
9951
|
+
| [createAction](#function-createaction) | [randomBytesBase64](#function-randombytesbase64) | [validatePositiveIntegerOrZero](#function-validatepositiveintegerorzero) |
|
|
9952
|
+
| [createDefaultWalletServicesOptions](#function-createdefaultwalletservicesoptions) | [randomBytesHex](#function-randombyteshex) | [validateProveCertificateArgs](#function-validateprovecertificateargs) |
|
|
9953
|
+
| [createStorageServiceChargeScript](#function-createstorageservicechargescript) | [setDisableDoubleSpendCheckForTest](#function-setdisabledoublespendcheckfortest) | [validateRelinquishCertificateArgs](#function-validaterelinquishcertificateargs) |
|
|
9954
|
+
| [createSyncMap](#function-createsyncmap) | [sha256Hash](#function-sha256hash) | [validateRelinquishOutputArgs](#function-validaterelinquishoutputargs) |
|
|
9955
|
+
| [doubleSha256BE](#function-doublesha256be) | [signAction](#function-signaction) | [validateSatoshis](#function-validatesatoshis) |
|
|
9956
|
+
| [doubleSha256HashLE](#function-doublesha256hashle) | [stampLog](#function-stamplog) | [validateScriptHash](#function-validatescripthash) |
|
|
9957
|
+
| [generateChangeSdk](#function-generatechangesdk) | [stampLogFormat](#function-stamplogformat) | [validateSecondsSinceEpoch](#function-validatesecondssinceepoch) |
|
|
9958
|
+
| [generateChangeSdkMakeStorage](#function-generatechangesdkmakestorage) | [toBinaryBaseBlockHeader](#function-tobinarybaseblockheader) | [validateSignActionArgs](#function-validatesignactionargs) |
|
|
9959
|
+
| [getBeefForTransaction](#function-getbeeffortransaction) | [toWalletNetwork](#function-towalletnetwork) | [validateSignActionOptions](#function-validatesignactionoptions) |
|
|
9960
|
+
| [getExchangeRatesIo](#function-getexchangeratesio) | [transactionInputSize](#function-transactioninputsize) | [validateStorageFeeModel](#function-validatestoragefeemodel) |
|
|
9961
|
+
| [getIdentityKey](#function-getidentitykey) | [transactionOutputSize](#function-transactionoutputsize) | [validateStringLength](#function-validatestringlength) |
|
|
9962
|
+
| [getProofs](#function-getproofs) | [transactionSize](#function-transactionsize) | [validateWalletPayment](#function-validatewalletpayment) |
|
|
9963
|
+
| [getSyncChunk](#function-getsyncchunk) | [updateChaintracksFiatExchangeRates](#function-updatechaintracksfiatexchangerates) | [varUintSize](#function-varuintsize) |
|
|
9964
|
+
| [internalizeAction](#function-internalizeaction) | [updateExchangeratesapi](#function-updateexchangeratesapi) | [verifyHexString](#function-verifyhexstring) |
|
|
9965
|
+
| [internalizeAction](#function-internalizeaction) | [validateAbortActionArgs](#function-validateabortactionargs) | [verifyId](#function-verifyid) |
|
|
9966
|
+
| [isBaseBlockHeader](#function-isbaseblockheader) | [validateAcquireCertificateArgs](#function-validateacquirecertificateargs) | [verifyInteger](#function-verifyinteger) |
|
|
9967
|
+
| [isBlockHeader](#function-isblockheader) | [validateAcquireDirectCertificateArgs](#function-validateacquiredirectcertificateargs) | [verifyNumber](#function-verifynumber) |
|
|
9968
|
+
| [isCreateActionSpecOp](#function-iscreateactionspecop) | [validateAcquireIssuanceCertificateArgs](#function-validateacquireissuancecertificateargs) | [verifyOne](#function-verifyone) |
|
|
9969
|
+
| [isHexString](#function-ishexstring) | [validateBasketInsertion](#function-validatebasketinsertion) | [verifyOneOrNone](#function-verifyoneornone) |
|
|
9970
|
+
| [isListActionsSpecOp](#function-islistactionsspecop) | [validateCreateActionArgs](#function-validatecreateactionargs) | [verifyOptionalHexString](#function-verifyoptionalhexstring) |
|
|
9971
|
+
| [isListOutputsSpecOp](#function-islistoutputsspecop) | [validateCreateActionInput](#function-validatecreateactioninput) | [verifyTruthy](#function-verifytruthy) |
|
|
9972
|
+
| [isLive](#function-islive) | [validateCreateActionOptions](#function-validatecreateactionoptions) | [wait](#function-wait) |
|
|
11303
9973
|
|
|
11304
9974
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11305
9975
|
|
|
@@ -11346,15 +10016,6 @@ export function asArray(val: string | number[]): number[]
|
|
|
11346
10016
|
|
|
11347
10017
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11348
10018
|
|
|
11349
|
-
---
|
|
11350
|
-
##### Function: asArray
|
|
11351
|
-
|
|
11352
|
-
```ts
|
|
11353
|
-
export function asArray(val: Buffer | string | number[], encoding?: BufferEncoding): number[]
|
|
11354
|
-
```
|
|
11355
|
-
|
|
11356
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11357
|
-
|
|
11358
10019
|
---
|
|
11359
10020
|
##### Function: asBsvSdkPrivateKey
|
|
11360
10021
|
|
|
@@ -11423,37 +10084,6 @@ export function asBsvSdkTx(tx: HexString | number[] | Transaction): Transaction
|
|
|
11423
10084
|
|
|
11424
10085
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11425
10086
|
|
|
11426
|
-
---
|
|
11427
|
-
##### Function: asBuffer
|
|
11428
|
-
|
|
11429
|
-
Coerce a value to Buffer if currently encoded as a string or
|
|
11430
|
-
|
|
11431
|
-
```ts
|
|
11432
|
-
export function asBuffer(val: Buffer | string | number[], encoding?: BufferEncoding): Buffer {
|
|
11433
|
-
let b: Buffer;
|
|
11434
|
-
if (Buffer.isBuffer(val))
|
|
11435
|
-
b = val;
|
|
11436
|
-
else if (typeof val === "string")
|
|
11437
|
-
b = Buffer.from(val, encoding ?? "hex");
|
|
11438
|
-
else
|
|
11439
|
-
b = Buffer.from(val);
|
|
11440
|
-
return b;
|
|
11441
|
-
}
|
|
11442
|
-
```
|
|
11443
|
-
|
|
11444
|
-
Returns
|
|
11445
|
-
|
|
11446
|
-
input val if it is a Buffer or new Buffer from string val
|
|
11447
|
-
|
|
11448
|
-
Argument Details
|
|
11449
|
-
|
|
11450
|
-
+ **val**
|
|
11451
|
-
+ Buffer or string or number[]. If string, encoding param applies. If number[], Buffer.from constructor is used.
|
|
11452
|
-
+ **encoding**
|
|
11453
|
-
+ defaults to 'hex'. Only applies to val of type string
|
|
11454
|
-
|
|
11455
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11456
|
-
|
|
11457
10087
|
---
|
|
11458
10088
|
##### Function: asString
|
|
11459
10089
|
|
|
@@ -11478,32 +10108,6 @@ Argument Details
|
|
|
11478
10108
|
|
|
11479
10109
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11480
10110
|
|
|
11481
|
-
---
|
|
11482
|
-
##### Function: asString
|
|
11483
|
-
|
|
11484
|
-
Coerce a value to an encoded string if currently a Buffer or number[]
|
|
11485
|
-
|
|
11486
|
-
```ts
|
|
11487
|
-
export function asString(val: Buffer | string | number[], encoding?: BufferEncoding): string {
|
|
11488
|
-
if (Array.isArray(val))
|
|
11489
|
-
val = Buffer.from(val);
|
|
11490
|
-
return Buffer.isBuffer(val) ? val.toString(encoding ?? "hex") : val;
|
|
11491
|
-
}
|
|
11492
|
-
```
|
|
11493
|
-
|
|
11494
|
-
Returns
|
|
11495
|
-
|
|
11496
|
-
input val if it is a string; or if number[], first converted to Buffer then as Buffer; if Buffer encoded using `encoding`
|
|
11497
|
-
|
|
11498
|
-
Argument Details
|
|
11499
|
-
|
|
11500
|
-
+ **val**
|
|
11501
|
-
+ Buffer or string or number[]. If string, encoding param applies. If number[], Buffer.from constructor is used.
|
|
11502
|
-
+ **encoding**
|
|
11503
|
-
+ defaults to 'hex'
|
|
11504
|
-
|
|
11505
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11506
|
-
|
|
11507
10111
|
---
|
|
11508
10112
|
##### Function: attemptToPostReqsToNetwork
|
|
11509
10113
|
|
|
@@ -11871,6 +10475,54 @@ See also: [AuthId](./client.md#interface-authid), [Wallet](./client.md#class-wal
|
|
|
11871
10475
|
|
|
11872
10476
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11873
10477
|
|
|
10478
|
+
---
|
|
10479
|
+
##### Function: isBaseBlockHeader
|
|
10480
|
+
|
|
10481
|
+
Type guard function.
|
|
10482
|
+
|
|
10483
|
+
```ts
|
|
10484
|
+
export function isBaseBlockHeader(header: BaseBlockHeader | BlockHeader | LiveBlockHeader): header is BaseBlockHeader {
|
|
10485
|
+
return typeof header.previousHash === "string";
|
|
10486
|
+
}
|
|
10487
|
+
```
|
|
10488
|
+
|
|
10489
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
10490
|
+
|
|
10491
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
10492
|
+
|
|
10493
|
+
---
|
|
10494
|
+
##### Function: isBlockHeader
|
|
10495
|
+
|
|
10496
|
+
Type guard function.
|
|
10497
|
+
|
|
10498
|
+
```ts
|
|
10499
|
+
export function isBlockHeader(header: BaseBlockHeader | BlockHeader | LiveBlockHeader): header is LiveBlockHeader {
|
|
10500
|
+
return "height" in header && typeof header.previousHash === "string";
|
|
10501
|
+
}
|
|
10502
|
+
```
|
|
10503
|
+
|
|
10504
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
10505
|
+
|
|
10506
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
10507
|
+
|
|
10508
|
+
---
|
|
10509
|
+
##### Function: isCreateActionSpecOp
|
|
10510
|
+
|
|
10511
|
+
```ts
|
|
10512
|
+
export function isCreateActionSpecOp(label: string): boolean
|
|
10513
|
+
```
|
|
10514
|
+
|
|
10515
|
+
Returns
|
|
10516
|
+
|
|
10517
|
+
true iff the `label` name is a reserved `createAction` special operation identifier.
|
|
10518
|
+
|
|
10519
|
+
Argument Details
|
|
10520
|
+
|
|
10521
|
+
+ **label**
|
|
10522
|
+
+ Action / Transaction label name value.
|
|
10523
|
+
|
|
10524
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
10525
|
+
|
|
11874
10526
|
---
|
|
11875
10527
|
##### Function: isHexString
|
|
11876
10528
|
|
|
@@ -11917,35 +10569,43 @@ Argument Details
|
|
|
11917
10569
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11918
10570
|
|
|
11919
10571
|
---
|
|
11920
|
-
##### Function:
|
|
10572
|
+
##### Function: isLive
|
|
10573
|
+
|
|
10574
|
+
Type guard function.
|
|
11921
10575
|
|
|
11922
10576
|
```ts
|
|
11923
|
-
export
|
|
10577
|
+
export function isLive(header: BlockHeader | LiveBlockHeader): header is LiveBlockHeader {
|
|
10578
|
+
return (header as LiveBlockHeader).headerId !== undefined;
|
|
10579
|
+
}
|
|
11924
10580
|
```
|
|
11925
10581
|
|
|
11926
|
-
See also: [
|
|
10582
|
+
See also: [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
11927
10583
|
|
|
11928
10584
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11929
10585
|
|
|
11930
10586
|
---
|
|
11931
|
-
##### Function:
|
|
10587
|
+
##### Function: isLiveBlockHeader
|
|
10588
|
+
|
|
10589
|
+
Type guard function.
|
|
11932
10590
|
|
|
11933
10591
|
```ts
|
|
11934
|
-
export
|
|
10592
|
+
export function isLiveBlockHeader(header: BaseBlockHeader | BlockHeader | LiveBlockHeader): header is LiveBlockHeader {
|
|
10593
|
+
return "chainwork" in header && typeof header.previousHash === "string";
|
|
10594
|
+
}
|
|
11935
10595
|
```
|
|
11936
10596
|
|
|
11937
|
-
See also: [
|
|
10597
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [BlockHeader](./services.md#interface-blockheader), [LiveBlockHeader](./services.md#interface-liveblockheader)
|
|
11938
10598
|
|
|
11939
10599
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11940
10600
|
|
|
11941
10601
|
---
|
|
11942
|
-
##### Function:
|
|
10602
|
+
##### Function: listCertificates
|
|
11943
10603
|
|
|
11944
10604
|
```ts
|
|
11945
|
-
export async function
|
|
10605
|
+
export async function listCertificates(storage: StorageProvider, auth: sdk.AuthId, vargs: sdk.ValidListCertificatesArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListCertificatesResult>
|
|
11946
10606
|
```
|
|
11947
10607
|
|
|
11948
|
-
See also: [AuthId](./client.md#interface-authid), [
|
|
10608
|
+
See also: [AuthId](./client.md#interface-authid), [StorageProvider](./storage.md#class-storageprovider), [ValidListCertificatesArgs](./client.md#interface-validlistcertificatesargs)
|
|
11949
10609
|
|
|
11950
10610
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
11951
10611
|
|
|
@@ -12078,17 +10738,6 @@ See also: [AuthId](./client.md#interface-authid), [ValidProveCertificateArgs](./
|
|
|
12078
10738
|
|
|
12079
10739
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
12080
10740
|
|
|
12081
|
-
---
|
|
12082
|
-
##### Function: purgeData
|
|
12083
|
-
|
|
12084
|
-
```ts
|
|
12085
|
-
export async function purgeData(storage: StorageKnex, params: sdk.PurgeParams, trx?: sdk.TrxToken): Promise<sdk.PurgeResults>
|
|
12086
|
-
```
|
|
12087
|
-
|
|
12088
|
-
See also: [PurgeParams](./client.md#interface-purgeparams), [PurgeResults](./client.md#interface-purgeresults), [StorageKnex](./storage.md#class-storageknex), [TrxToken](./client.md#interface-trxtoken)
|
|
12089
|
-
|
|
12090
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
12091
|
-
|
|
12092
10741
|
---
|
|
12093
10742
|
##### Function: randomBytes
|
|
12094
10743
|
|
|
@@ -12128,22 +10777,6 @@ count cryptographically secure random bytes as hex encoded string
|
|
|
12128
10777
|
|
|
12129
10778
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
12130
10779
|
|
|
12131
|
-
---
|
|
12132
|
-
##### Function: reviewStatus
|
|
12133
|
-
|
|
12134
|
-
```ts
|
|
12135
|
-
export async function reviewStatus(storage: StorageKnex, args: {
|
|
12136
|
-
agedLimit: Date;
|
|
12137
|
-
trx?: sdk.TrxToken;
|
|
12138
|
-
}): Promise<{
|
|
12139
|
-
log: string;
|
|
12140
|
-
}>
|
|
12141
|
-
```
|
|
12142
|
-
|
|
12143
|
-
See also: [StorageKnex](./storage.md#class-storageknex), [TrxToken](./client.md#interface-trxtoken)
|
|
12144
|
-
|
|
12145
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
12146
|
-
|
|
12147
10780
|
---
|
|
12148
10781
|
##### Function: setDisableDoubleSpendCheckForTest
|
|
12149
10782
|
|
|
@@ -12250,7 +10883,7 @@ export function toBinaryBaseBlockHeader(header: sdk.BaseBlockHeader): number[] {
|
|
|
12250
10883
|
}
|
|
12251
10884
|
```
|
|
12252
10885
|
|
|
12253
|
-
See also: [BaseBlockHeader](./
|
|
10886
|
+
See also: [BaseBlockHeader](./services.md#interface-baseblockheader), [asArray](./client.md#function-asarray)
|
|
12254
10887
|
|
|
12255
10888
|
Returns
|
|
12256
10889
|
|
|
@@ -13006,7 +11639,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
13006
11639
|
##### Type: GetRawTxService
|
|
13007
11640
|
|
|
13008
11641
|
```ts
|
|
13009
|
-
export type GetRawTxService = (txid: string, chain:
|
|
11642
|
+
export type GetRawTxService = (txid: string, chain: Chain) => Promise<GetRawTxResult>
|
|
13010
11643
|
```
|
|
13011
11644
|
|
|
13012
11645
|
See also: [Chain](./client.md#type-chain), [GetRawTxResult](./client.md#interface-getrawtxresult)
|
|
@@ -13028,7 +11661,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
13028
11661
|
##### Type: GetStatusForTxidsService
|
|
13029
11662
|
|
|
13030
11663
|
```ts
|
|
13031
|
-
export type GetStatusForTxidsService = (txids: string[]) => Promise<
|
|
11664
|
+
export type GetStatusForTxidsService = (txids: string[]) => Promise<GetStatusForTxidsResult>
|
|
13032
11665
|
```
|
|
13033
11666
|
|
|
13034
11667
|
See also: [GetStatusForTxidsResult](./client.md#interface-getstatusfortxidsresult)
|
|
@@ -13270,10 +11903,10 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
13270
11903
|
| [ProvenTxReqNonTerminalStatus](#variable-proventxreqnonterminalstatus) | [specOpInvalidChange](#variable-specopinvalidchange) |
|
|
13271
11904
|
| [ProvenTxReqTerminalStatus](#variable-proventxreqterminalstatus) | [specOpNoSendActions](#variable-specopnosendactions) |
|
|
13272
11905
|
| [TESTNET_DEFAULT_SETTINGS](#variable-testnet_default_settings) | [specOpSetWalletChangeParams](#variable-specopsetwalletchangeparams) |
|
|
13273
|
-
| [brc29ProtocolID](#variable-brc29protocolid) | [
|
|
13274
|
-
| [maxPossibleSatoshis](#variable-maxpossiblesatoshis) | [
|
|
13275
|
-
| [outputColumnsWithoutLockingScript](#variable-outputcolumnswithoutlockingscript) | [
|
|
13276
|
-
| [parseResults](#variable-parseresults) |
|
|
11906
|
+
| [brc29ProtocolID](#variable-brc29protocolid) | [specOpThrowReviewActions](#variable-specopthrowreviewactions) |
|
|
11907
|
+
| [maxPossibleSatoshis](#variable-maxpossiblesatoshis) | [specOpWalletBalance](#variable-specopwalletbalance) |
|
|
11908
|
+
| [outputColumnsWithoutLockingScript](#variable-outputcolumnswithoutlockingscript) | [transactionColumnsWithoutRawTx](#variable-transactioncolumnswithoutrawtx) |
|
|
11909
|
+
| [parseResults](#variable-parseresults) | [transformVerifiableCertificatesWithTrust](#variable-transformverifiablecertificateswithtrust) |
|
|
13277
11910
|
|
|
13278
11911
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
13279
11912
|
|
|
@@ -13288,7 +11921,7 @@ DEFAULT_SETTINGS = {
|
|
|
13288
11921
|
trustedCertifiers: [
|
|
13289
11922
|
{
|
|
13290
11923
|
name: "Metanet Trust Services",
|
|
13291
|
-
description: "
|
|
11924
|
+
description: "Registry for protocols, baskets, and certificates types",
|
|
13292
11925
|
iconUrl: "https://bsvblockchain.org/favicon.ico",
|
|
13293
11926
|
identityKey: "03daf815fe38f83da0ad83b5bedc520aa488aef5cbc93a93c67a7fe60406cbffe8",
|
|
13294
11927
|
trust: 4
|
|
@@ -13506,6 +12139,15 @@ specOpSetWalletChangeParams = "a4979d28ced8581e9c1c92f1001cc7cb3aabf8ea32e10888a
|
|
|
13506
12139
|
|
|
13507
12140
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
13508
12141
|
|
|
12142
|
+
---
|
|
12143
|
+
##### Variable: specOpThrowReviewActions
|
|
12144
|
+
|
|
12145
|
+
```ts
|
|
12146
|
+
specOpThrowReviewActions = "a496e747fc3ad5fabdd4ae8f91184e71f87539bd3d962aa2548942faaaf0047a"
|
|
12147
|
+
```
|
|
12148
|
+
|
|
12149
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
12150
|
+
|
|
13509
12151
|
---
|
|
13510
12152
|
##### Variable: specOpWalletBalance
|
|
13511
12153
|
|