@bsv/wallet-toolbox 1.1.3 → 1.1.4
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/README.md +1 -0
- package/docs/client.md +324 -84
- package/docs/setup.md +358 -67
- package/docs/wallet.md +324 -84
- package/out/src/Setup.d.ts +28 -30
- package/out/src/Setup.d.ts.map +1 -1
- package/out/src/Setup.js +14 -10
- package/out/src/Setup.js.map +1 -1
- package/out/src/SetupClient.d.ts +99 -41
- package/out/src/SetupClient.d.ts.map +1 -1
- package/out/src/SetupClient.js +124 -90
- package/out/src/SetupClient.js.map +1 -1
- package/out/src/Wallet.d.ts +10 -0
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js.map +1 -1
- package/out/src/index.all.d.ts +1 -1
- package/out/src/index.all.d.ts.map +1 -1
- package/out/src/index.all.js +3 -2
- package/out/src/index.all.js.map +1 -1
- package/out/src/sdk/types.d.ts +5 -0
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js.map +1 -1
- package/out/test/examples/README.man.test.js +8 -7
- package/out/test/examples/README.man.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/Setup.ts +41 -54
- package/src/SetupClient.ts +219 -150
- package/src/Wallet.ts +10 -0
- package/src/index.all.ts +9 -1
- package/src/sdk/types.ts +7 -0
- package/test/examples/README.man.test.ts +9 -9
- package/ts2md.json +0 -8
package/docs/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
The documentation is split into various pages, each covering a set of related functionality. The pages are as follows:
|
|
4
4
|
|
|
5
5
|
- [Getting Started](#getting-started) -
|
|
6
|
+
- [Setup](./setup.md) —
|
|
6
7
|
- [Wallet](./wallet.md) —
|
|
7
8
|
- [Client](./client.md) —
|
|
8
9
|
- [Storage](./storage.md) —
|
package/docs/client.md
CHANGED
|
@@ -6,47 +6,48 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
6
6
|
|
|
7
7
|
| | | |
|
|
8
8
|
| --- | --- | --- |
|
|
9
|
-
| [ArcMinerGetTxData](#interface-arcminergettxdata) | [
|
|
10
|
-
| [ArcMinerPostBeefDataApi](#interface-arcminerpostbeefdataapi) | [
|
|
11
|
-
| [ArcMinerPostTxsData](#interface-arcminerposttxsdata) | [
|
|
12
|
-
| [ArcServiceConfig](#interface-arcserviceconfig) | [
|
|
13
|
-
| [AuthId](#interface-authid) | [
|
|
14
|
-
| [BaseBlockHeader](#interface-baseblockheader) | [
|
|
15
|
-
| [BlockHeader](#interface-blockheader) | [
|
|
16
|
-
| [BsvExchangeRate](#interface-bsvexchangerate) | [
|
|
17
|
-
| [CertOpsWallet](#interface-certopswallet) | [
|
|
18
|
-
| [CommitNewTxResults](#interface-commitnewtxresults) | [
|
|
19
|
-
| [EntityTimeStamp](#interface-entitytimestamp) | [
|
|
20
|
-
| [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [
|
|
21
|
-
| [FiatExchangeRates](#interface-fiatexchangerates) | [
|
|
22
|
-
| [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [
|
|
23
|
-
| [FindCertificatesArgs](#interface-findcertificatesargs) | [
|
|
24
|
-
| [FindCommissionsArgs](#interface-findcommissionsargs) | [
|
|
25
|
-
| [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [
|
|
26
|
-
| [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [
|
|
27
|
-
| [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [
|
|
28
|
-
| [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [
|
|
29
|
-
| [FindOutputTagsArgs](#interface-findoutputtagsargs) | [
|
|
30
|
-
| [FindOutputsArgs](#interface-findoutputsargs) | [
|
|
31
|
-
| [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [
|
|
32
|
-
| [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [
|
|
33
|
-
| [FindProvenTxsArgs](#interface-findproventxsargs) | [
|
|
34
|
-
| [FindSincePagedArgs](#interface-findsincepagedargs) | [
|
|
35
|
-
| [FindSyncStatesArgs](#interface-findsyncstatesargs) | [
|
|
36
|
-
| [FindTransactionsArgs](#interface-findtransactionsargs) | [
|
|
37
|
-
| [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [
|
|
38
|
-
| [FindTxLabelsArgs](#interface-findtxlabelsargs) | [
|
|
39
|
-
| [FindUsersArgs](#interface-findusersargs) | [
|
|
40
|
-
| [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [
|
|
41
|
-
| [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [
|
|
42
|
-
| [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [
|
|
43
|
-
| [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [
|
|
44
|
-
| [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [
|
|
45
|
-
| [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [
|
|
46
|
-
| [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [
|
|
47
|
-
| [GetMerklePathResult](#interface-getmerklepathresult) | [
|
|
48
|
-
| [GetRawTxResult](#interface-getrawtxresult) | [
|
|
49
|
-
| [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [
|
|
9
|
+
| [ArcMinerGetTxData](#interface-arcminergettxdata) | [GetUtxoStatusDetails](#interface-getutxostatusdetails) | [SyncChunk](#interface-syncchunk) |
|
|
10
|
+
| [ArcMinerPostBeefDataApi](#interface-arcminerpostbeefdataapi) | [GetUtxoStatusResult](#interface-getutxostatusresult) | [TaskPurgeParams](#interface-taskpurgeparams) |
|
|
11
|
+
| [ArcMinerPostTxsData](#interface-arcminerposttxsdata) | [KeyPair](#interface-keypair) | [TrxToken](#interface-trxtoken) |
|
|
12
|
+
| [ArcServiceConfig](#interface-arcserviceconfig) | [MonitorOptions](#interface-monitoroptions) | [TscMerkleProofApi](#interface-tscmerkleproofapi) |
|
|
13
|
+
| [AuthId](#interface-authid) | [OutPoint](#interface-outpoint) | [TxScriptOffsets](#interface-txscriptoffsets) |
|
|
14
|
+
| [BaseBlockHeader](#interface-baseblockheader) | [Paged](#interface-paged) | [UpdateProvenTxReqWithNewProvenTxArgs](#interface-updateproventxreqwithnewproventxargs) |
|
|
15
|
+
| [BlockHeader](#interface-blockheader) | [PendingSignAction](#interface-pendingsignaction) | [UpdateProvenTxReqWithNewProvenTxResult](#interface-updateproventxreqwithnewproventxresult) |
|
|
16
|
+
| [BsvExchangeRate](#interface-bsvexchangerate) | [PendingStorageInput](#interface-pendingstorageinput) | [ValidAbortActionArgs](#interface-validabortactionargs) |
|
|
17
|
+
| [CertOpsWallet](#interface-certopswallet) | [PostBeefResult](#interface-postbeefresult) | [ValidAcquireCertificateArgs](#interface-validacquirecertificateargs) |
|
|
18
|
+
| [CommitNewTxResults](#interface-commitnewtxresults) | [PostBeefResultForTxidApi](#interface-postbeefresultfortxidapi) | [ValidAcquireDirectCertificateArgs](#interface-validacquiredirectcertificateargs) |
|
|
19
|
+
| [EntityTimeStamp](#interface-entitytimestamp) | [PostReqsToNetworkDetails](#interface-postreqstonetworkdetails) | [ValidAcquireIssuanceCertificateArgs](#interface-validacquireissuancecertificateargs) |
|
|
20
|
+
| [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [PostReqsToNetworkResult](#interface-postreqstonetworkresult) | [ValidBasketInsertion](#interface-validbasketinsertion) |
|
|
21
|
+
| [FiatExchangeRates](#interface-fiatexchangerates) | [PostTxResultForTxid](#interface-posttxresultfortxid) | [ValidCreateActionArgs](#interface-validcreateactionargs) |
|
|
22
|
+
| [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [PostTxsResult](#interface-posttxsresult) | [ValidCreateActionInput](#interface-validcreateactioninput) |
|
|
23
|
+
| [FindCertificatesArgs](#interface-findcertificatesargs) | [ProcessSyncChunkResult](#interface-processsyncchunkresult) | [ValidCreateActionOptions](#interface-validcreateactionoptions) |
|
|
24
|
+
| [FindCommissionsArgs](#interface-findcommissionsargs) | [ProvenOrRawTx](#interface-provenorrawtx) | [ValidCreateActionOutput](#interface-validcreateactionoutput) |
|
|
25
|
+
| [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [PurgeParams](#interface-purgeparams) | [ValidDiscoverByAttributesArgs](#interface-validdiscoverbyattributesargs) |
|
|
26
|
+
| [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [PurgeResults](#interface-purgeresults) | [ValidDiscoverByIdentityKeyArgs](#interface-validdiscoverbyidentitykeyargs) |
|
|
27
|
+
| [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [RequestSyncChunkArgs](#interface-requestsyncchunkargs) | [ValidInternalizeActionArgs](#interface-validinternalizeactionargs) |
|
|
28
|
+
| [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [ScriptTemplateParamsSABPPP](#interface-scripttemplateparamssabppp) | [ValidInternalizeOutput](#interface-validinternalizeoutput) |
|
|
29
|
+
| [FindOutputTagsArgs](#interface-findoutputtagsargs) | [ScriptTemplateUnlock](#interface-scripttemplateunlock) | [ValidListActionsArgs](#interface-validlistactionsargs) |
|
|
30
|
+
| [FindOutputsArgs](#interface-findoutputsargs) | [SetupEnv](#interface-setupenv) | [ValidListCertificatesArgs](#interface-validlistcertificatesargs) |
|
|
31
|
+
| [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [SetupWallet](#interface-setupwallet) | [ValidListOutputsArgs](#interface-validlistoutputsargs) |
|
|
32
|
+
| [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [SetupWalletArgs](#interface-setupwalletargs) | [ValidProcessActionArgs](#interface-validprocessactionargs) |
|
|
33
|
+
| [FindProvenTxsArgs](#interface-findproventxsargs) | [SetupWalletClient](#interface-setupwalletclient) | [ValidProcessActionOptions](#interface-validprocessactionoptions) |
|
|
34
|
+
| [FindSincePagedArgs](#interface-findsincepagedargs) | [SetupWalletClientArgs](#interface-setupwalletclientargs) | [ValidProveCertificateArgs](#interface-validprovecertificateargs) |
|
|
35
|
+
| [FindSyncStatesArgs](#interface-findsyncstatesargs) | [StorageCreateActionResult](#interface-storagecreateactionresult) | [ValidRelinquishCertificateArgs](#interface-validrelinquishcertificateargs) |
|
|
36
|
+
| [FindTransactionsArgs](#interface-findtransactionsargs) | [StorageCreateTransactionSdkInput](#interface-storagecreatetransactionsdkinput) | [ValidRelinquishOutputArgs](#interface-validrelinquishoutputargs) |
|
|
37
|
+
| [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [StorageCreateTransactionSdkOutput](#interface-storagecreatetransactionsdkoutput) | [ValidSignActionArgs](#interface-validsignactionargs) |
|
|
38
|
+
| [FindTxLabelsArgs](#interface-findtxlabelsargs) | [StorageFeeModel](#interface-storagefeemodel) | [ValidSignActionOptions](#interface-validsignactionoptions) |
|
|
39
|
+
| [FindUsersArgs](#interface-findusersargs) | [StorageGetBeefOptions](#interface-storagegetbeefoptions) | [ValidWalletPayment](#interface-validwalletpayment) |
|
|
40
|
+
| [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [StorageIdentity](#interface-storageidentity) | [ValidWalletSignerArgs](#interface-validwalletsignerargs) |
|
|
41
|
+
| [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [StorageInternalizeActionResult](#interface-storageinternalizeactionresult) | [WalletArgs](#interface-walletargs) |
|
|
42
|
+
| [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [StorageProcessActionArgs](#interface-storageprocessactionargs) | [WalletServices](#interface-walletservices) |
|
|
43
|
+
| [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [StorageProcessActionResults](#interface-storageprocessactionresults) | [WalletServicesOptions](#interface-walletservicesoptions) |
|
|
44
|
+
| [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [StorageProvenOrReq](#interface-storageprovenorreq) | [WalletSigner](#interface-walletsigner) |
|
|
45
|
+
| [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [StorageProviderOptions](#interface-storageprovideroptions) | [WalletStorage](#interface-walletstorage) |
|
|
46
|
+
| [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [StorageReaderOptions](#interface-storagereaderoptions) | [WalletStorageProvider](#interface-walletstorageprovider) |
|
|
47
|
+
| [GetMerklePathResult](#interface-getmerklepathresult) | [StorageReaderWriterOptions](#interface-storagereaderwriteroptions) | [WalletStorageReader](#interface-walletstoragereader) |
|
|
48
|
+
| [GetRawTxResult](#interface-getrawtxresult) | [StorageSyncReader](#interface-storagesyncreader) | [WalletStorageSync](#interface-walletstoragesync) |
|
|
49
|
+
| [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [StorageSyncReaderOptions](#interface-storagesyncreaderoptions) | [WalletStorageWriter](#interface-walletstoragewriter) |
|
|
50
|
+
| [GetReqsAndBeefResult](#interface-getreqsandbeefresult) | [StorageSyncReaderWriter](#interface-storagesyncreaderwriter) | [XValidCreateActionOutput](#interface-xvalidcreateactionoutput) |
|
|
50
51
|
|
|
51
52
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
52
53
|
|
|
@@ -1514,10 +1515,40 @@ export interface ScriptTemplateParamsSABPPP {
|
|
|
1514
1515
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1515
1516
|
|
|
1516
1517
|
---
|
|
1517
|
-
### Interface:
|
|
1518
|
+
### Interface: ScriptTemplateUnlock
|
|
1518
1519
|
|
|
1519
1520
|
```ts
|
|
1520
|
-
export interface
|
|
1521
|
+
export interface ScriptTemplateUnlock {
|
|
1522
|
+
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
|
|
1523
|
+
estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
|
|
1524
|
+
}
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1528
|
+
|
|
1529
|
+
---
|
|
1530
|
+
### Interface: SetupEnv
|
|
1531
|
+
|
|
1532
|
+
```ts
|
|
1533
|
+
export interface SetupEnv {
|
|
1534
|
+
chain: sdk.Chain;
|
|
1535
|
+
identityKey: string;
|
|
1536
|
+
identityKey2: string;
|
|
1537
|
+
taalApiKey: string;
|
|
1538
|
+
devKeys: Record<string, string>;
|
|
1539
|
+
mySQLConnection: string;
|
|
1540
|
+
}
|
|
1541
|
+
```
|
|
1542
|
+
|
|
1543
|
+
See also: [Chain](#type-chain)
|
|
1544
|
+
|
|
1545
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1546
|
+
|
|
1547
|
+
---
|
|
1548
|
+
### Interface: SetupWallet
|
|
1549
|
+
|
|
1550
|
+
```ts
|
|
1551
|
+
export interface SetupWallet {
|
|
1521
1552
|
rootKey: PrivateKey;
|
|
1522
1553
|
identityKey: string;
|
|
1523
1554
|
keyDeriver: KeyDeriver;
|
|
@@ -1533,6 +1564,52 @@ See also: [Chain](#type-chain), [Monitor](#class-monitor), [Services](#class-ser
|
|
|
1533
1564
|
|
|
1534
1565
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1535
1566
|
|
|
1567
|
+
---
|
|
1568
|
+
### Interface: SetupWalletArgs
|
|
1569
|
+
|
|
1570
|
+
Arguments used to construct a `Wallet`
|
|
1571
|
+
|
|
1572
|
+
```ts
|
|
1573
|
+
export interface SetupWalletArgs {
|
|
1574
|
+
env: SetupEnv;
|
|
1575
|
+
chain?: sdk.Chain;
|
|
1576
|
+
rootKeyHex?: string;
|
|
1577
|
+
privKeyHex?: string;
|
|
1578
|
+
active?: sdk.WalletStorageProvider;
|
|
1579
|
+
backups?: sdk.WalletStorageProvider[];
|
|
1580
|
+
}
|
|
1581
|
+
```
|
|
1582
|
+
|
|
1583
|
+
See also: [Chain](#type-chain), [SetupEnv](#interface-setupenv), [WalletStorageProvider](#interface-walletstorageprovider)
|
|
1584
|
+
|
|
1585
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1586
|
+
|
|
1587
|
+
---
|
|
1588
|
+
### Interface: SetupWalletClient
|
|
1589
|
+
|
|
1590
|
+
```ts
|
|
1591
|
+
export interface SetupWalletClient extends SetupWallet {
|
|
1592
|
+
endpointUrl: string;
|
|
1593
|
+
}
|
|
1594
|
+
```
|
|
1595
|
+
|
|
1596
|
+
See also: [SetupWallet](#interface-setupwallet)
|
|
1597
|
+
|
|
1598
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1599
|
+
|
|
1600
|
+
---
|
|
1601
|
+
### Interface: SetupWalletClientArgs
|
|
1602
|
+
|
|
1603
|
+
```ts
|
|
1604
|
+
export interface SetupWalletClientArgs extends SetupWalletArgs {
|
|
1605
|
+
endpointUrl?: string;
|
|
1606
|
+
}
|
|
1607
|
+
```
|
|
1608
|
+
|
|
1609
|
+
See also: [SetupWalletArgs](#interface-setupwalletargs)
|
|
1610
|
+
|
|
1611
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1612
|
+
|
|
1536
1613
|
---
|
|
1537
1614
|
### Interface: StorageCreateActionResult
|
|
1538
1615
|
|
|
@@ -3102,18 +3179,19 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
3102
3179
|
|
|
3103
3180
|
| | | |
|
|
3104
3181
|
| --- | --- | --- |
|
|
3105
|
-
| [CertOps](#class-certops) | [TaskCheckForProofs](#class-taskcheckforproofs) | [
|
|
3106
|
-
| [Monitor](#class-monitor) | [TaskClock](#class-taskclock) | [
|
|
3107
|
-
| [PrivilegedKeyManager](#class-privilegedkeymanager) | [TaskFailAbandoned](#class-taskfailabandoned) | [
|
|
3108
|
-
| [ScriptTemplateSABPPP](#class-scripttemplatesabppp) | [TaskNewHeader](#class-tasknewheader) | [
|
|
3109
|
-
| [ServiceCollection](#class-servicecollection) | [TaskPurge](#class-taskpurge) | [
|
|
3110
|
-
| [Services](#class-services) | [TaskReviewStatus](#class-taskreviewstatus) | [
|
|
3111
|
-
| [
|
|
3112
|
-
| [
|
|
3113
|
-
| [
|
|
3114
|
-
| [
|
|
3115
|
-
| [
|
|
3116
|
-
| [
|
|
3182
|
+
| [CertOps](#class-certops) | [TaskCheckForProofs](#class-taskcheckforproofs) | [WERR_INVALID_PUBLIC_KEY](#class-werr_invalid_public_key) |
|
|
3183
|
+
| [Monitor](#class-monitor) | [TaskClock](#class-taskclock) | [WERR_MISSING_PARAMETER](#class-werr_missing_parameter) |
|
|
3184
|
+
| [PrivilegedKeyManager](#class-privilegedkeymanager) | [TaskFailAbandoned](#class-taskfailabandoned) | [WERR_NETWORK_CHAIN](#class-werr_network_chain) |
|
|
3185
|
+
| [ScriptTemplateSABPPP](#class-scripttemplatesabppp) | [TaskNewHeader](#class-tasknewheader) | [WERR_NOT_ACTIVE](#class-werr_not_active) |
|
|
3186
|
+
| [ServiceCollection](#class-servicecollection) | [TaskPurge](#class-taskpurge) | [WERR_NOT_IMPLEMENTED](#class-werr_not_implemented) |
|
|
3187
|
+
| [Services](#class-services) | [TaskReviewStatus](#class-taskreviewstatus) | [WERR_UNAUTHORIZED](#class-werr_unauthorized) |
|
|
3188
|
+
| [Setup](#class-setup) | [TaskSendWaiting](#class-tasksendwaiting) | [Wallet](#class-wallet) |
|
|
3189
|
+
| [SetupClient](#class-setupclient) | [TaskSyncWhenIdle](#class-tasksyncwhenidle) | [WalletError](#class-walleterror) |
|
|
3190
|
+
| [StorageClient](#class-storageclient) | [WERR_BAD_REQUEST](#class-werr_bad_request) | [WalletMonitorTask](#class-walletmonitortask) |
|
|
3191
|
+
| [StorageProvider](#class-storageprovider) | [WERR_INSUFFICIENT_FUNDS](#class-werr_insufficient_funds) | [WalletSigner](#class-walletsigner) |
|
|
3192
|
+
| [StorageReader](#class-storagereader) | [WERR_INTERNAL](#class-werr_internal) | [WalletStorageManager](#class-walletstoragemanager) |
|
|
3193
|
+
| [StorageReaderWriter](#class-storagereaderwriter) | [WERR_INVALID_OPERATION](#class-werr_invalid_operation) | |
|
|
3194
|
+
| [StorageSyncReader](#class-storagesyncreader) | [WERR_INVALID_PARAMETER](#class-werr_invalid_parameter) | |
|
|
3117
3195
|
|
|
3118
3196
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
3119
3197
|
|
|
@@ -3523,17 +3601,34 @@ See also: [PostTxsResult](#interface-posttxsresult)
|
|
|
3523
3601
|
|
|
3524
3602
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
3525
3603
|
|
|
3604
|
+
---
|
|
3605
|
+
### Class: Setup
|
|
3606
|
+
|
|
3607
|
+
Enables code that imports only from `SetupClient` to still reference everything as just `Setup`
|
|
3608
|
+
|
|
3609
|
+
```ts
|
|
3610
|
+
export class Setup extends SetupClient {
|
|
3611
|
+
}
|
|
3612
|
+
```
|
|
3613
|
+
|
|
3614
|
+
See also: [SetupClient](#class-setupclient)
|
|
3615
|
+
|
|
3616
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
3617
|
+
|
|
3526
3618
|
---
|
|
3527
3619
|
### Class: SetupClient
|
|
3528
3620
|
|
|
3529
|
-
|
|
3621
|
+
The `SetupClient` class provides static setup functions to construct BRC-100 compatible
|
|
3530
3622
|
wallets in a variety of configurations.
|
|
3531
3623
|
|
|
3532
3624
|
It serves as a starting point for experimentation and customization.
|
|
3533
3625
|
|
|
3626
|
+
`SetupClient` references only browser compatible code including storage via `StorageClient`.
|
|
3627
|
+
`Setup` extends `SetupClient` adding database storage via `Knex` and `StorageKnex`.
|
|
3628
|
+
|
|
3534
3629
|
```ts
|
|
3535
3630
|
export abstract class SetupClient {
|
|
3536
|
-
static makeEnv(
|
|
3631
|
+
static makeEnv(): string {
|
|
3537
3632
|
const testPrivKey1 = PrivateKey.fromRandom();
|
|
3538
3633
|
const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
|
|
3539
3634
|
const testPrivKey2 = PrivateKey.fromRandom();
|
|
@@ -3559,39 +3654,169 @@ export abstract class SetupClient {
|
|
|
3559
3654
|
MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"<your_password>","database":"<your_database>", "timezone": "Z"}'
|
|
3560
3655
|
`;
|
|
3561
3656
|
console.log(log);
|
|
3657
|
+
return log;
|
|
3562
3658
|
}
|
|
3563
|
-
static getEnv(chain: sdk.Chain)
|
|
3564
|
-
static async
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3659
|
+
static getEnv(chain: sdk.Chain): SetupEnv
|
|
3660
|
+
static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
|
|
3661
|
+
args.chain ||= args.env.chain;
|
|
3662
|
+
args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
|
|
3663
|
+
const rootKey = PrivateKey.fromHex(args.rootKeyHex);
|
|
3664
|
+
const identityKey = rootKey.toPublicKey().toString();
|
|
3665
|
+
const keyDeriver = new KeyDeriver(rootKey);
|
|
3666
|
+
const chain = args.chain;
|
|
3667
|
+
const storage = new WalletStorageManager(identityKey, args.active, args.backups);
|
|
3668
|
+
if (storage.stores.length > 0)
|
|
3669
|
+
await storage.makeAvailable();
|
|
3670
|
+
const serviceOptions = Services.createDefaultOptions(chain);
|
|
3671
|
+
serviceOptions.taalApiKey = args.env.taalApiKey;
|
|
3672
|
+
const services = new Services(args.chain);
|
|
3673
|
+
const monopts = Monitor.createDefaultWalletMonitorOptions(chain, storage, services);
|
|
3674
|
+
const monitor = new Monitor(monopts);
|
|
3675
|
+
monitor.addDefaultTasks();
|
|
3676
|
+
let privilegedKeyManager: sdk.PrivilegedKeyManager | undefined = undefined;
|
|
3677
|
+
if (args.privKeyHex) {
|
|
3678
|
+
const privKey = PrivateKey.fromString(args.privKeyHex);
|
|
3679
|
+
privilegedKeyManager = new sdk.PrivilegedKeyManager(async () => privKey);
|
|
3680
|
+
}
|
|
3681
|
+
const wallet = new Wallet({
|
|
3682
|
+
chain,
|
|
3683
|
+
keyDeriver,
|
|
3684
|
+
storage,
|
|
3685
|
+
services,
|
|
3686
|
+
monitor,
|
|
3687
|
+
privilegedKeyManager
|
|
3688
|
+
});
|
|
3689
|
+
const r: SetupWallet = {
|
|
3690
|
+
rootKey,
|
|
3691
|
+
identityKey,
|
|
3692
|
+
keyDeriver,
|
|
3693
|
+
chain,
|
|
3694
|
+
storage,
|
|
3695
|
+
services,
|
|
3696
|
+
monitor,
|
|
3697
|
+
wallet
|
|
3698
|
+
};
|
|
3699
|
+
return r;
|
|
3700
|
+
}
|
|
3701
|
+
static async createWalletWithStorageClient(args: SetupWalletClientArgs): Promise<SetupWalletClient>
|
|
3576
3702
|
static getKeyPair(priv?: string | PrivateKey): KeyPairAddress
|
|
3577
3703
|
static getLockP2PKH(address: string)
|
|
3578
|
-
static getUnlockP2PKH(priv: PrivateKey, satoshis: number)
|
|
3579
|
-
static
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
}):
|
|
3586
|
-
static async
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3704
|
+
static getUnlockP2PKH(priv: PrivateKey, satoshis: number): sdk.ScriptTemplateUnlock
|
|
3705
|
+
static createP2PKHOutputs(outputs: {
|
|
3706
|
+
address: string;
|
|
3707
|
+
satoshis: number;
|
|
3708
|
+
outputDescription?: string;
|
|
3709
|
+
basket?: string;
|
|
3710
|
+
tags?: string[];
|
|
3711
|
+
}[]): CreateActionOutput[]
|
|
3712
|
+
static async createP2PKHOutputsAction(wallet: WalletInterface, outputs: {
|
|
3713
|
+
address: string;
|
|
3714
|
+
satoshis: number;
|
|
3715
|
+
outputDescription?: string;
|
|
3716
|
+
basket?: string;
|
|
3717
|
+
tags?: string[];
|
|
3718
|
+
}[], options?: CreateActionOptions): Promise<{
|
|
3719
|
+
cr: CreateActionResult;
|
|
3720
|
+
outpoints: string[] | undefined;
|
|
3721
|
+
}>
|
|
3722
|
+
static async fundWalletFromP2PKHOutpoints(wallet: WalletInterface, outpoints: string[], p2pkhKey: KeyPairAddress, inputBEEF?: BEEF)
|
|
3591
3723
|
}
|
|
3592
3724
|
```
|
|
3593
3725
|
|
|
3594
|
-
See also: [Chain](#type-chain), [KeyPairAddress](#type-keypairaddress), [
|
|
3726
|
+
See also: [Chain](#type-chain), [KeyPairAddress](#type-keypairaddress), [Monitor](#class-monitor), [PrivilegedKeyManager](#class-privilegedkeymanager), [ScriptTemplateUnlock](#interface-scripttemplateunlock), [Services](#class-services), [SetupEnv](#interface-setupenv), [SetupWallet](#interface-setupwallet), [SetupWalletArgs](#interface-setupwalletargs), [SetupWalletClient](#interface-setupwalletclient), [SetupWalletClientArgs](#interface-setupwalletclientargs), [Wallet](#class-wallet), [WalletStorageManager](#class-walletstoragemanager)
|
|
3727
|
+
|
|
3728
|
+
<details>
|
|
3729
|
+
|
|
3730
|
+
<summary>Class SetupClient Details</summary>
|
|
3731
|
+
|
|
3732
|
+
#### Method createWallet
|
|
3733
|
+
|
|
3734
|
+
Create a `Wallet`. Storage can optionally be provided or configured later.
|
|
3735
|
+
|
|
3736
|
+
The following components are configured: KeyDeriver, WalletStorageManager, WalletService, WalletStorage.
|
|
3737
|
+
Optionally, PrivilegedKeyManager is also configured.
|
|
3738
|
+
|
|
3739
|
+
```ts
|
|
3740
|
+
static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
|
|
3741
|
+
args.chain ||= args.env.chain;
|
|
3742
|
+
args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
|
|
3743
|
+
const rootKey = PrivateKey.fromHex(args.rootKeyHex);
|
|
3744
|
+
const identityKey = rootKey.toPublicKey().toString();
|
|
3745
|
+
const keyDeriver = new KeyDeriver(rootKey);
|
|
3746
|
+
const chain = args.chain;
|
|
3747
|
+
const storage = new WalletStorageManager(identityKey, args.active, args.backups);
|
|
3748
|
+
if (storage.stores.length > 0)
|
|
3749
|
+
await storage.makeAvailable();
|
|
3750
|
+
const serviceOptions = Services.createDefaultOptions(chain);
|
|
3751
|
+
serviceOptions.taalApiKey = args.env.taalApiKey;
|
|
3752
|
+
const services = new Services(args.chain);
|
|
3753
|
+
const monopts = Monitor.createDefaultWalletMonitorOptions(chain, storage, services);
|
|
3754
|
+
const monitor = new Monitor(monopts);
|
|
3755
|
+
monitor.addDefaultTasks();
|
|
3756
|
+
let privilegedKeyManager: sdk.PrivilegedKeyManager | undefined = undefined;
|
|
3757
|
+
if (args.privKeyHex) {
|
|
3758
|
+
const privKey = PrivateKey.fromString(args.privKeyHex);
|
|
3759
|
+
privilegedKeyManager = new sdk.PrivilegedKeyManager(async () => privKey);
|
|
3760
|
+
}
|
|
3761
|
+
const wallet = new Wallet({
|
|
3762
|
+
chain,
|
|
3763
|
+
keyDeriver,
|
|
3764
|
+
storage,
|
|
3765
|
+
services,
|
|
3766
|
+
monitor,
|
|
3767
|
+
privilegedKeyManager
|
|
3768
|
+
});
|
|
3769
|
+
const r: SetupWallet = {
|
|
3770
|
+
rootKey,
|
|
3771
|
+
identityKey,
|
|
3772
|
+
keyDeriver,
|
|
3773
|
+
chain,
|
|
3774
|
+
storage,
|
|
3775
|
+
services,
|
|
3776
|
+
monitor,
|
|
3777
|
+
wallet
|
|
3778
|
+
};
|
|
3779
|
+
return r;
|
|
3780
|
+
}
|
|
3781
|
+
```
|
|
3782
|
+
See also: [Monitor](#class-monitor), [PrivilegedKeyManager](#class-privilegedkeymanager), [Services](#class-services), [SetupWallet](#interface-setupwallet), [SetupWalletArgs](#interface-setupwalletargs), [Wallet](#class-wallet), [WalletStorageManager](#class-walletstoragemanager)
|
|
3783
|
+
|
|
3784
|
+
#### Method getEnv
|
|
3785
|
+
|
|
3786
|
+
Reads a .env file of the format created by `makeEnv`.
|
|
3787
|
+
|
|
3788
|
+
Returns values for designated `chain`.
|
|
3789
|
+
|
|
3790
|
+
Access private keys through the `devKeys` object: `devKeys[identityKey]`
|
|
3791
|
+
|
|
3792
|
+
```ts
|
|
3793
|
+
static getEnv(chain: sdk.Chain): SetupEnv
|
|
3794
|
+
```
|
|
3795
|
+
See also: [Chain](#type-chain), [SetupEnv](#interface-setupenv)
|
|
3796
|
+
|
|
3797
|
+
Returns
|
|
3798
|
+
|
|
3799
|
+
with configuration environment secrets used by `Setup` functions.
|
|
3800
|
+
|
|
3801
|
+
Argument Details
|
|
3802
|
+
|
|
3803
|
+
+ **chain**
|
|
3804
|
+
+ Which chain to use: 'test' or 'main'
|
|
3805
|
+
|
|
3806
|
+
#### Method makeEnv
|
|
3807
|
+
|
|
3808
|
+
Creates content for .env file with some private keys, identity keys, sample API keys, and sample MySQL connection string.
|
|
3809
|
+
|
|
3810
|
+
Two new, random private keys are generated each time, with their associated public identity keys.
|
|
3811
|
+
|
|
3812
|
+
Loading secrets from a .env file is intended only for experimentation and getting started.
|
|
3813
|
+
Private keys should never be included directly in your source code.
|
|
3814
|
+
|
|
3815
|
+
```ts
|
|
3816
|
+
static makeEnv(): string
|
|
3817
|
+
```
|
|
3818
|
+
|
|
3819
|
+
</details>
|
|
3595
3820
|
|
|
3596
3821
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
3597
3822
|
|
|
@@ -4577,6 +4802,21 @@ See also: [Chain](#type-chain), [KeyPair](#interface-keypair), [Monitor](#class-
|
|
|
4577
4802
|
|
|
4578
4803
|
<summary>Class Wallet Details</summary>
|
|
4579
4804
|
|
|
4805
|
+
#### Property beef
|
|
4806
|
+
|
|
4807
|
+
The wallet creates a `BeefParty` when it is created.
|
|
4808
|
+
All the Beefs that pass through the wallet are merged into this beef.
|
|
4809
|
+
Thus what it contains at any time is the union of all transactions and proof data processed.
|
|
4810
|
+
The class `BeefParty` derives from `Beef`, adding the ability to track the source of merged data.
|
|
4811
|
+
|
|
4812
|
+
This allows it to generate beefs to send to a particular “party” (storage or the user)
|
|
4813
|
+
that includes “txid only proofs” for transactions they already know about.
|
|
4814
|
+
Over time, this allows an active wallet to drastically reduce the amount of data transmitted.
|
|
4815
|
+
|
|
4816
|
+
```ts
|
|
4817
|
+
beef: BeefParty
|
|
4818
|
+
```
|
|
4819
|
+
|
|
4580
4820
|
#### Method getKnownTxids
|
|
4581
4821
|
|
|
4582
4822
|
```ts
|