@bsv/wallet-toolbox 1.1.9 → 1.1.11
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 +213 -80
- package/docs/setup.md +159 -25
- package/docs/wallet.md +213 -80
- package/out/src/SetupClient.d.ts +12 -12
- package/out/src/SetupClient.d.ts.map +1 -1
- package/out/src/SetupClient.js +9 -9
- package/out/src/SetupClient.js.map +1 -1
- package/out/test/storage/update.test.js +8 -5
- package/out/test/storage/update.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/SetupClient.ts +11 -16
- package/test/storage/update.test.ts +10 -5
package/docs/client.md
CHANGED
|
@@ -14,57 +14,57 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
14
14
|
|
|
15
15
|
| | | |
|
|
16
16
|
| --- | --- | --- |
|
|
17
|
-
| [ArcMinerGetTxData](#interface-arcminergettxdata) | [
|
|
18
|
-
| [ArcMinerPostBeefDataApi](#interface-arcminerpostbeefdataapi) | [
|
|
19
|
-
| [ArcMinerPostTxsData](#interface-arcminerposttxsdata) | [
|
|
20
|
-
| [ArcServiceConfig](#interface-arcserviceconfig) | [
|
|
21
|
-
| [AuthId](#interface-authid) | [
|
|
22
|
-
| [BaseBlockHeader](#interface-baseblockheader) | [
|
|
23
|
-
| [BlockHeader](#interface-blockheader) | [
|
|
24
|
-
| [BsvExchangeRate](#interface-bsvexchangerate) | [
|
|
25
|
-
| [CertOpsWallet](#interface-certopswallet) | [
|
|
26
|
-
| [CommitNewTxResults](#interface-commitnewtxresults) | [
|
|
27
|
-
| [EntitySyncMap](#interface-entitysyncmap) | [
|
|
28
|
-
| [EntityTimeStamp](#interface-entitytimestamp) | [
|
|
29
|
-
| [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [
|
|
30
|
-
| [FiatExchangeRates](#interface-fiatexchangerates) | [
|
|
31
|
-
| [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [
|
|
32
|
-
| [FindCertificatesArgs](#interface-findcertificatesargs) | [
|
|
33
|
-
| [FindCommissionsArgs](#interface-findcommissionsargs) | [
|
|
34
|
-
| [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [
|
|
35
|
-
| [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [
|
|
36
|
-
| [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [
|
|
37
|
-
| [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [
|
|
38
|
-
| [FindOutputTagsArgs](#interface-findoutputtagsargs) | [
|
|
39
|
-
| [FindOutputsArgs](#interface-findoutputsargs) | [
|
|
40
|
-
| [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [
|
|
41
|
-
| [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [
|
|
42
|
-
| [FindProvenTxsArgs](#interface-findproventxsargs) | [
|
|
43
|
-
| [FindSincePagedArgs](#interface-findsincepagedargs) | [
|
|
44
|
-
| [FindSyncStatesArgs](#interface-findsyncstatesargs) | [
|
|
45
|
-
| [FindTransactionsArgs](#interface-findtransactionsargs) | [
|
|
46
|
-
| [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [
|
|
47
|
-
| [FindTxLabelsArgs](#interface-findtxlabelsargs) | [
|
|
48
|
-
| [FindUsersArgs](#interface-findusersargs) | [
|
|
49
|
-
| [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [
|
|
50
|
-
| [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [
|
|
51
|
-
| [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [
|
|
52
|
-
| [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [
|
|
53
|
-
| [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [
|
|
54
|
-
| [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [
|
|
55
|
-
| [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [
|
|
56
|
-
| [GetMerklePathResult](#interface-getmerklepathresult) | [
|
|
57
|
-
| [GetRawTxResult](#interface-getrawtxresult) | [
|
|
58
|
-
| [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [
|
|
59
|
-
| [GetReqsAndBeefResult](#interface-getreqsandbeefresult) | [
|
|
60
|
-
| [GetUtxoStatusDetails](#interface-getutxostatusdetails) | [
|
|
61
|
-
| [GetUtxoStatusResult](#interface-getutxostatusresult) | [
|
|
62
|
-
| [KeyPair](#interface-keypair) | [
|
|
17
|
+
| [ArcMinerGetTxData](#interface-arcminergettxdata) | [PendingStorageInput](#interface-pendingstorageinput) | [TableOutputX](#interface-tableoutputx) |
|
|
18
|
+
| [ArcMinerPostBeefDataApi](#interface-arcminerpostbeefdataapi) | [PostBeefResult](#interface-postbeefresult) | [TableProvenTx](#interface-tableproventx) |
|
|
19
|
+
| [ArcMinerPostTxsData](#interface-arcminerposttxsdata) | [PostBeefResultForTxidApi](#interface-postbeefresultfortxidapi) | [TableProvenTxReq](#interface-tableproventxreq) |
|
|
20
|
+
| [ArcServiceConfig](#interface-arcserviceconfig) | [PostReqsToNetworkDetails](#interface-postreqstonetworkdetails) | [TableProvenTxReqDynamics](#interface-tableproventxreqdynamics) |
|
|
21
|
+
| [AuthId](#interface-authid) | [PostReqsToNetworkResult](#interface-postreqstonetworkresult) | [TableSettings](#interface-tablesettings) |
|
|
22
|
+
| [BaseBlockHeader](#interface-baseblockheader) | [PostTxResultForTxid](#interface-posttxresultfortxid) | [TableSyncState](#interface-tablesyncstate) |
|
|
23
|
+
| [BlockHeader](#interface-blockheader) | [PostTxsResult](#interface-posttxsresult) | [TableTransaction](#interface-tabletransaction) |
|
|
24
|
+
| [BsvExchangeRate](#interface-bsvexchangerate) | [ProcessSyncChunkResult](#interface-processsyncchunkresult) | [TableTxLabel](#interface-tabletxlabel) |
|
|
25
|
+
| [CertOpsWallet](#interface-certopswallet) | [ProvenOrRawTx](#interface-provenorrawtx) | [TableTxLabelMap](#interface-tabletxlabelmap) |
|
|
26
|
+
| [CommitNewTxResults](#interface-commitnewtxresults) | [ProvenTxFromTxidResult](#interface-proventxfromtxidresult) | [TableUser](#interface-tableuser) |
|
|
27
|
+
| [EntitySyncMap](#interface-entitysyncmap) | [ProvenTxReqHistory](#interface-proventxreqhistory) | [TaskPurgeParams](#interface-taskpurgeparams) |
|
|
28
|
+
| [EntityTimeStamp](#interface-entitytimestamp) | [ProvenTxReqHistorySummaryApi](#interface-proventxreqhistorysummaryapi) | [TrxToken](#interface-trxtoken) |
|
|
29
|
+
| [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [ProvenTxReqNotify](#interface-proventxreqnotify) | [TscMerkleProofApi](#interface-tscmerkleproofapi) |
|
|
30
|
+
| [FiatExchangeRates](#interface-fiatexchangerates) | [PurgeParams](#interface-purgeparams) | [TxScriptOffsets](#interface-txscriptoffsets) |
|
|
31
|
+
| [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [PurgeResults](#interface-purgeresults) | [UpdateProvenTxReqWithNewProvenTxArgs](#interface-updateproventxreqwithnewproventxargs) |
|
|
32
|
+
| [FindCertificatesArgs](#interface-findcertificatesargs) | [RequestSyncChunkArgs](#interface-requestsyncchunkargs) | [UpdateProvenTxReqWithNewProvenTxResult](#interface-updateproventxreqwithnewproventxresult) |
|
|
33
|
+
| [FindCommissionsArgs](#interface-findcommissionsargs) | [ScriptTemplateParamsSABPPP](#interface-scripttemplateparamssabppp) | [ValidAbortActionArgs](#interface-validabortactionargs) |
|
|
34
|
+
| [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [ScriptTemplateUnlock](#interface-scripttemplateunlock) | [ValidAcquireCertificateArgs](#interface-validacquirecertificateargs) |
|
|
35
|
+
| [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [SetupEnv](#interface-setupenv) | [ValidAcquireDirectCertificateArgs](#interface-validacquiredirectcertificateargs) |
|
|
36
|
+
| [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [SetupWallet](#interface-setupwallet) | [ValidAcquireIssuanceCertificateArgs](#interface-validacquireissuancecertificateargs) |
|
|
37
|
+
| [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [SetupWalletArgs](#interface-setupwalletargs) | [ValidBasketInsertion](#interface-validbasketinsertion) |
|
|
38
|
+
| [FindOutputTagsArgs](#interface-findoutputtagsargs) | [SetupWalletClient](#interface-setupwalletclient) | [ValidCreateActionArgs](#interface-validcreateactionargs) |
|
|
39
|
+
| [FindOutputsArgs](#interface-findoutputsargs) | [SetupWalletClientArgs](#interface-setupwalletclientargs) | [ValidCreateActionInput](#interface-validcreateactioninput) |
|
|
40
|
+
| [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [StorageCreateActionResult](#interface-storagecreateactionresult) | [ValidCreateActionOptions](#interface-validcreateactionoptions) |
|
|
41
|
+
| [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [StorageCreateTransactionSdkInput](#interface-storagecreatetransactionsdkinput) | [ValidCreateActionOutput](#interface-validcreateactionoutput) |
|
|
42
|
+
| [FindProvenTxsArgs](#interface-findproventxsargs) | [StorageCreateTransactionSdkOutput](#interface-storagecreatetransactionsdkoutput) | [ValidDiscoverByAttributesArgs](#interface-validdiscoverbyattributesargs) |
|
|
43
|
+
| [FindSincePagedArgs](#interface-findsincepagedargs) | [StorageFeeModel](#interface-storagefeemodel) | [ValidDiscoverByIdentityKeyArgs](#interface-validdiscoverbyidentitykeyargs) |
|
|
44
|
+
| [FindSyncStatesArgs](#interface-findsyncstatesargs) | [StorageGetBeefOptions](#interface-storagegetbeefoptions) | [ValidInternalizeActionArgs](#interface-validinternalizeactionargs) |
|
|
45
|
+
| [FindTransactionsArgs](#interface-findtransactionsargs) | [StorageIdentity](#interface-storageidentity) | [ValidInternalizeOutput](#interface-validinternalizeoutput) |
|
|
46
|
+
| [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [StorageInternalizeActionResult](#interface-storageinternalizeactionresult) | [ValidListActionsArgs](#interface-validlistactionsargs) |
|
|
47
|
+
| [FindTxLabelsArgs](#interface-findtxlabelsargs) | [StorageProcessActionArgs](#interface-storageprocessactionargs) | [ValidListCertificatesArgs](#interface-validlistcertificatesargs) |
|
|
48
|
+
| [FindUsersArgs](#interface-findusersargs) | [StorageProcessActionResults](#interface-storageprocessactionresults) | [ValidListOutputsArgs](#interface-validlistoutputsargs) |
|
|
49
|
+
| [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [StorageProvenOrReq](#interface-storageprovenorreq) | [ValidProcessActionArgs](#interface-validprocessactionargs) |
|
|
50
|
+
| [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [StorageProviderOptions](#interface-storageprovideroptions) | [ValidProcessActionOptions](#interface-validprocessactionoptions) |
|
|
51
|
+
| [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [StorageReaderOptions](#interface-storagereaderoptions) | [ValidProveCertificateArgs](#interface-validprovecertificateargs) |
|
|
52
|
+
| [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [StorageReaderWriterOptions](#interface-storagereaderwriteroptions) | [ValidRelinquishCertificateArgs](#interface-validrelinquishcertificateargs) |
|
|
53
|
+
| [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [StorageSyncReader](#interface-storagesyncreader) | [ValidRelinquishOutputArgs](#interface-validrelinquishoutputargs) |
|
|
54
|
+
| [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [StorageSyncReaderOptions](#interface-storagesyncreaderoptions) | [ValidSignActionArgs](#interface-validsignactionargs) |
|
|
55
|
+
| [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [StorageSyncReaderWriter](#interface-storagesyncreaderwriter) | [ValidSignActionOptions](#interface-validsignactionoptions) |
|
|
56
|
+
| [GetMerklePathResult](#interface-getmerklepathresult) | [SyncChunk](#interface-syncchunk) | [ValidWalletPayment](#interface-validwalletpayment) |
|
|
57
|
+
| [GetRawTxResult](#interface-getrawtxresult) | [SyncError](#interface-syncerror) | [ValidWalletSignerArgs](#interface-validwalletsignerargs) |
|
|
58
|
+
| [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [SyncMap](#interface-syncmap) | [WalletArgs](#interface-walletargs) |
|
|
59
|
+
| [GetReqsAndBeefResult](#interface-getreqsandbeefresult) | [TableCertificate](#interface-tablecertificate) | [WalletServices](#interface-walletservices) |
|
|
60
|
+
| [GetUtxoStatusDetails](#interface-getutxostatusdetails) | [TableCertificateField](#interface-tablecertificatefield) | [WalletServicesOptions](#interface-walletservicesoptions) |
|
|
61
|
+
| [GetUtxoStatusResult](#interface-getutxostatusresult) | [TableCertificateX](#interface-tablecertificatex) | [WalletSigner](#interface-walletsigner) |
|
|
62
|
+
| [KeyPair](#interface-keypair) | [TableCommission](#interface-tablecommission) | [WalletStorage](#interface-walletstorage) |
|
|
63
|
+
| [KeyPairAddress](#interface-keypairaddress) | [TableMonitorEvent](#interface-tablemonitorevent) | [WalletStorageProvider](#interface-walletstorageprovider) |
|
|
63
64
|
| [MonitorOptions](#interface-monitoroptions) | [TableOutput](#interface-tableoutput) | [WalletStorageReader](#interface-walletstoragereader) |
|
|
64
65
|
| [OutPoint](#interface-outpoint) | [TableOutputBasket](#interface-tableoutputbasket) | [WalletStorageSync](#interface-walletstoragesync) |
|
|
65
66
|
| [Paged](#interface-paged) | [TableOutputTag](#interface-tableoutputtag) | [WalletStorageWriter](#interface-walletstoragewriter) |
|
|
66
67
|
| [PendingSignAction](#interface-pendingsignaction) | [TableOutputTagMap](#interface-tableoutputtagmap) | [XValidCreateActionOutput](#interface-xvalidcreateactionoutput) |
|
|
67
|
-
| [PendingStorageInput](#interface-pendingstorageinput) | [TableOutputX](#interface-tableoutputx) | |
|
|
68
68
|
|
|
69
69
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
70
70
|
|
|
@@ -1033,6 +1033,21 @@ export interface KeyPair {
|
|
|
1033
1033
|
|
|
1034
1034
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1035
1035
|
|
|
1036
|
+
---
|
|
1037
|
+
##### Interface: KeyPairAddress
|
|
1038
|
+
|
|
1039
|
+
A private key and associated public key and address.
|
|
1040
|
+
|
|
1041
|
+
```ts
|
|
1042
|
+
export interface KeyPairAddress {
|
|
1043
|
+
privateKey: PrivateKey;
|
|
1044
|
+
publicKey: PublicKey;
|
|
1045
|
+
address: string;
|
|
1046
|
+
}
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
1050
|
+
|
|
1036
1051
|
---
|
|
1037
1052
|
##### Interface: MonitorOptions
|
|
1038
1053
|
|
|
@@ -5377,7 +5392,29 @@ export abstract class SetupClient {
|
|
|
5377
5392
|
console.log(log);
|
|
5378
5393
|
return log;
|
|
5379
5394
|
}
|
|
5380
|
-
static getEnv(chain: sdk.Chain): SetupEnv
|
|
5395
|
+
static getEnv(chain: sdk.Chain): SetupEnv {
|
|
5396
|
+
const identityKey = chain === "main"
|
|
5397
|
+
? process.env.MY_MAIN_IDENTITY
|
|
5398
|
+
: process.env.MY_TEST_IDENTITY;
|
|
5399
|
+
const identityKey2 = chain === "main"
|
|
5400
|
+
? process.env.MY_MAIN_IDENTITY2
|
|
5401
|
+
: process.env.MY_TEST_IDENTITY2;
|
|
5402
|
+
const DEV_KEYS = process.env.DEV_KEYS || "{}";
|
|
5403
|
+
const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
|
|
5404
|
+
const taalApiKey = verifyTruthy(chain === "main"
|
|
5405
|
+
? process.env.MAIN_TAAL_API_KEY
|
|
5406
|
+
: process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
|
|
5407
|
+
if (!identityKey || !identityKey2)
|
|
5408
|
+
throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
|
|
5409
|
+
return {
|
|
5410
|
+
chain,
|
|
5411
|
+
identityKey,
|
|
5412
|
+
identityKey2,
|
|
5413
|
+
taalApiKey,
|
|
5414
|
+
devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
|
|
5415
|
+
mySQLConnection
|
|
5416
|
+
};
|
|
5417
|
+
}
|
|
5381
5418
|
static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
|
|
5382
5419
|
const chain = args.env.chain;
|
|
5383
5420
|
args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
|
|
@@ -5418,17 +5455,60 @@ export abstract class SetupClient {
|
|
|
5418
5455
|
};
|
|
5419
5456
|
return r;
|
|
5420
5457
|
}
|
|
5421
|
-
static async createWalletClient(args: SetupWalletClientArgs): Promise<SetupWalletClient>
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5458
|
+
static async createWalletClient(args: SetupWalletClientArgs): Promise<SetupWalletClient> {
|
|
5459
|
+
const wo = await SetupClient.createWallet(args);
|
|
5460
|
+
if (wo.chain === "main")
|
|
5461
|
+
throw new sdk.WERR_INVALID_PARAMETER("chain", `'test' for now, 'main' is not yet supported.`);
|
|
5462
|
+
const endpointUrl = args.endpointUrl || "https://staging-dojo.babbage.systems";
|
|
5463
|
+
const client = new StorageClient(wo.wallet, endpointUrl);
|
|
5464
|
+
await wo.storage.addWalletStorageProvider(client);
|
|
5465
|
+
await wo.storage.makeAvailable();
|
|
5466
|
+
return {
|
|
5467
|
+
...wo,
|
|
5468
|
+
endpointUrl
|
|
5469
|
+
};
|
|
5470
|
+
}
|
|
5471
|
+
static getKeyPair(priv?: string | PrivateKey): KeyPairAddress {
|
|
5472
|
+
if (priv === undefined)
|
|
5473
|
+
priv = PrivateKey.fromRandom();
|
|
5474
|
+
else if (typeof priv === "string")
|
|
5475
|
+
priv = new PrivateKey(priv, "hex");
|
|
5476
|
+
const pub = PublicKey.fromPrivateKey(priv);
|
|
5477
|
+
const address = pub.toAddress();
|
|
5478
|
+
return { privateKey: priv, publicKey: pub, address };
|
|
5479
|
+
}
|
|
5480
|
+
static getLockP2PKH(address: string) {
|
|
5481
|
+
const p2pkh = new P2PKH();
|
|
5482
|
+
const lock = p2pkh.lock(address);
|
|
5483
|
+
return lock;
|
|
5484
|
+
}
|
|
5485
|
+
static getUnlockP2PKH(priv: PrivateKey, satoshis: number): sdk.ScriptTemplateUnlock {
|
|
5486
|
+
const p2pkh = new P2PKH();
|
|
5487
|
+
const lock = SetupClient.getLockP2PKH(SetupClient.getKeyPair(priv).address);
|
|
5488
|
+
const unlock = p2pkh.unlock(priv, "all", false, satoshis, lock);
|
|
5489
|
+
return unlock;
|
|
5490
|
+
}
|
|
5425
5491
|
static createP2PKHOutputs(outputs: {
|
|
5426
5492
|
address: string;
|
|
5427
5493
|
satoshis: number;
|
|
5428
5494
|
outputDescription?: string;
|
|
5429
5495
|
basket?: string;
|
|
5430
5496
|
tags?: string[];
|
|
5431
|
-
}[]): CreateActionOutput[]
|
|
5497
|
+
}[]): CreateActionOutput[] {
|
|
5498
|
+
const os: CreateActionOutput[] = [];
|
|
5499
|
+
const count = outputs.length;
|
|
5500
|
+
for (let i = 0; i < count; i++) {
|
|
5501
|
+
const o = outputs[i];
|
|
5502
|
+
os.push({
|
|
5503
|
+
basket: o.basket,
|
|
5504
|
+
tags: o.tags,
|
|
5505
|
+
satoshis: o.satoshis,
|
|
5506
|
+
lockingScript: SetupClient.getLockP2PKH(o.address).toHex(),
|
|
5507
|
+
outputDescription: o.outputDescription || `p2pkh ${i}`
|
|
5508
|
+
});
|
|
5509
|
+
}
|
|
5510
|
+
return os;
|
|
5511
|
+
}
|
|
5432
5512
|
static async createP2PKHOutputsAction(wallet: WalletInterface, outputs: {
|
|
5433
5513
|
address: string;
|
|
5434
5514
|
satoshis: number;
|
|
@@ -5438,12 +5518,29 @@ export abstract class SetupClient {
|
|
|
5438
5518
|
}[], options?: CreateActionOptions): Promise<{
|
|
5439
5519
|
cr: CreateActionResult;
|
|
5440
5520
|
outpoints: string[] | undefined;
|
|
5441
|
-
}>
|
|
5442
|
-
|
|
5521
|
+
}> {
|
|
5522
|
+
const os = SetupClient.createP2PKHOutputs(outputs);
|
|
5523
|
+
const createArgs: CreateActionArgs = {
|
|
5524
|
+
description: `createP2PKHOutputs`,
|
|
5525
|
+
outputs: os,
|
|
5526
|
+
options: {
|
|
5527
|
+
...options,
|
|
5528
|
+
randomizeOutputs: false
|
|
5529
|
+
}
|
|
5530
|
+
};
|
|
5531
|
+
const cr = await wallet.createAction(createArgs);
|
|
5532
|
+
let outpoints: string[] | undefined;
|
|
5533
|
+
if (cr.txid) {
|
|
5534
|
+
outpoints = os.map((o, i) => `${cr.txid}.${i}`);
|
|
5535
|
+
}
|
|
5536
|
+
return { cr, outpoints };
|
|
5537
|
+
}
|
|
5538
|
+
static async fundWalletFromP2PKHOutpoints(wallet: WalletInterface, outpoints: string[], p2pkhKey: KeyPairAddress, inputBEEF?: BEEF) {
|
|
5539
|
+
}
|
|
5443
5540
|
}
|
|
5444
5541
|
```
|
|
5445
5542
|
|
|
5446
|
-
See also: [Chain](./client.md#type-chain), [KeyPairAddress](./setup.md#
|
|
5543
|
+
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), [StorageClient](./storage.md#class-storageclient), [WERR_INVALID_OPERATION](./client.md#class-werr_invalid_operation), [WERR_INVALID_PARAMETER](./client.md#class-werr_invalid_parameter), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager), [createAction](./storage.md#function-createaction), [verifyTruthy](./client.md#function-verifytruthy)
|
|
5447
5544
|
|
|
5448
5545
|
###### Method createWallet
|
|
5449
5546
|
|
|
@@ -5505,9 +5602,31 @@ Returns values for designated `chain`.
|
|
|
5505
5602
|
Access private keys through the `devKeys` object: `devKeys[identityKey]`
|
|
5506
5603
|
|
|
5507
5604
|
```ts
|
|
5508
|
-
static getEnv(chain: sdk.Chain): SetupEnv
|
|
5605
|
+
static getEnv(chain: sdk.Chain): SetupEnv {
|
|
5606
|
+
const identityKey = chain === "main"
|
|
5607
|
+
? process.env.MY_MAIN_IDENTITY
|
|
5608
|
+
: process.env.MY_TEST_IDENTITY;
|
|
5609
|
+
const identityKey2 = chain === "main"
|
|
5610
|
+
? process.env.MY_MAIN_IDENTITY2
|
|
5611
|
+
: process.env.MY_TEST_IDENTITY2;
|
|
5612
|
+
const DEV_KEYS = process.env.DEV_KEYS || "{}";
|
|
5613
|
+
const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
|
|
5614
|
+
const taalApiKey = verifyTruthy(chain === "main"
|
|
5615
|
+
? process.env.MAIN_TAAL_API_KEY
|
|
5616
|
+
: process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
|
|
5617
|
+
if (!identityKey || !identityKey2)
|
|
5618
|
+
throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
|
|
5619
|
+
return {
|
|
5620
|
+
chain,
|
|
5621
|
+
identityKey,
|
|
5622
|
+
identityKey2,
|
|
5623
|
+
taalApiKey,
|
|
5624
|
+
devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
|
|
5625
|
+
mySQLConnection
|
|
5626
|
+
};
|
|
5627
|
+
}
|
|
5509
5628
|
```
|
|
5510
|
-
See also: [Chain](./client.md#type-chain), [SetupEnv](./setup.md#interface-setupenv)
|
|
5629
|
+
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)
|
|
5511
5630
|
|
|
5512
5631
|
Returns
|
|
5513
5632
|
|
|
@@ -5528,7 +5647,34 @@ Loading secrets from a .env file is intended only for experimentation and gettin
|
|
|
5528
5647
|
Private keys should never be included directly in your source code.
|
|
5529
5648
|
|
|
5530
5649
|
```ts
|
|
5531
|
-
static makeEnv(): string
|
|
5650
|
+
static makeEnv(): string {
|
|
5651
|
+
const testPrivKey1 = PrivateKey.fromRandom();
|
|
5652
|
+
const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
|
|
5653
|
+
const testPrivKey2 = PrivateKey.fromRandom();
|
|
5654
|
+
const testIdentityKey2 = testPrivKey2.toPublicKey().toString();
|
|
5655
|
+
const mainPrivKey1 = PrivateKey.fromRandom();
|
|
5656
|
+
const mainIdentityKey1 = mainPrivKey1.toPublicKey().toString();
|
|
5657
|
+
const mainPrivKey2 = PrivateKey.fromRandom();
|
|
5658
|
+
const mainIdentityKey2 = mainPrivKey2.toPublicKey().toString();
|
|
5659
|
+
const log = `
|
|
5660
|
+
# Add the following to .env file:
|
|
5661
|
+
MAIN_TAAL_API_KEY='mainnet_9596de07e92300c6287e4393594ae39c'
|
|
5662
|
+
TEST_TAAL_API_KEY='testnet_0e6cf72133b43ea2d7861da2a38684e3'
|
|
5663
|
+
MY_TEST_IDENTITY = '${testIdentityKey1}'
|
|
5664
|
+
MY_TEST_IDENTITY2 = '${testIdentityKey2}'
|
|
5665
|
+
MY_MAIN_IDENTITY = '${mainIdentityKey1}'
|
|
5666
|
+
MY_MAIN_IDENTITY2 = '${mainIdentityKey2}'
|
|
5667
|
+
DEV_KEYS = '{
|
|
5668
|
+
"${testIdentityKey1}": "${testPrivKey1.toString()}",
|
|
5669
|
+
"${testIdentityKey2}": "${testPrivKey2.toString()}"
|
|
5670
|
+
"${mainIdentityKey1}": "${mainPrivKey1.toString()}",
|
|
5671
|
+
"${mainIdentityKey2}": "${mainPrivKey2.toString()}"
|
|
5672
|
+
}'
|
|
5673
|
+
MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"<your_password>","database":"<your_database>", "timezone": "Z"}'
|
|
5674
|
+
`;
|
|
5675
|
+
console.log(log);
|
|
5676
|
+
return log;
|
|
5677
|
+
}
|
|
5532
5678
|
```
|
|
5533
5679
|
|
|
5534
5680
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
@@ -8950,15 +9096,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
8950
9096
|
|
|
8951
9097
|
| | |
|
|
8952
9098
|
| --- | --- |
|
|
8953
|
-
| [Chain](#type-chain) | [
|
|
8954
|
-
| [DBType](#type-dbtype) | [
|
|
8955
|
-
| [EntityStorage](#type-entitystorage) | [
|
|
8956
|
-
| [GetMerklePathService](#type-getmerklepathservice) | [
|
|
8957
|
-
| [GetRawTxService](#type-getrawtxservice) | [
|
|
8958
|
-
| [GetUtxoStatusOutputFormat](#type-getutxostatusoutputformat) | [
|
|
8959
|
-
| [GetUtxoStatusService](#type-getutxostatusservice) | [
|
|
8960
|
-
| [KeyPairAddress](#type-keypairaddress) | [TransactionStatus](#type-transactionstatus) |
|
|
9099
|
+
| [Chain](#type-chain) | [PostReqsToNetworkDetailsStatus](#type-postreqstonetworkdetailsstatus) |
|
|
9100
|
+
| [DBType](#type-dbtype) | [PostTxsService](#type-posttxsservice) |
|
|
9101
|
+
| [EntityStorage](#type-entitystorage) | [ProvenTxReqStatus](#type-proventxreqstatus) |
|
|
9102
|
+
| [GetMerklePathService](#type-getmerklepathservice) | [StorageProvidedBy](#type-storageprovidedby) |
|
|
9103
|
+
| [GetRawTxService](#type-getrawtxservice) | [SyncProtocolVersion](#type-syncprotocolversion) |
|
|
9104
|
+
| [GetUtxoStatusOutputFormat](#type-getutxostatusoutputformat) | [SyncStatus](#type-syncstatus) |
|
|
9105
|
+
| [GetUtxoStatusService](#type-getutxostatusservice) | [TransactionStatus](#type-transactionstatus) |
|
|
8961
9106
|
| [MonitorStorage](#type-monitorstorage) | [UpdateFiatExchangeRateService](#type-updatefiatexchangerateservice) |
|
|
9107
|
+
| [PostBeefService](#type-postbeefservice) | |
|
|
8962
9108
|
|
|
8963
9109
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
8964
9110
|
|
|
@@ -9034,19 +9180,6 @@ See also: [Chain](./client.md#type-chain), [GetUtxoStatusOutputFormat](./client.
|
|
|
9034
9180
|
|
|
9035
9181
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
9036
9182
|
|
|
9037
|
-
---
|
|
9038
|
-
##### Type: KeyPairAddress
|
|
9039
|
-
|
|
9040
|
-
```ts
|
|
9041
|
-
export type KeyPairAddress = {
|
|
9042
|
-
privateKey: PrivateKey;
|
|
9043
|
-
publicKey: PublicKey;
|
|
9044
|
-
address: string;
|
|
9045
|
-
}
|
|
9046
|
-
```
|
|
9047
|
-
|
|
9048
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
9049
|
-
|
|
9050
9183
|
---
|
|
9051
9184
|
##### Type: MonitorStorage
|
|
9052
9185
|
|
package/docs/setup.md
CHANGED
|
@@ -17,6 +17,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
17
17
|
|
|
18
18
|
| |
|
|
19
19
|
| --- |
|
|
20
|
+
| [KeyPairAddress](#interface-keypairaddress) |
|
|
20
21
|
| [SetupEnv](#interface-setupenv) |
|
|
21
22
|
| [SetupWallet](#interface-setupwallet) |
|
|
22
23
|
| [SetupWalletArgs](#interface-setupwalletargs) |
|
|
@@ -31,6 +32,21 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
31
32
|
|
|
32
33
|
---
|
|
33
34
|
|
|
35
|
+
##### Interface: KeyPairAddress
|
|
36
|
+
|
|
37
|
+
A private key and associated public key and address.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
export interface KeyPairAddress {
|
|
41
|
+
privateKey: PrivateKey;
|
|
42
|
+
publicKey: PublicKey;
|
|
43
|
+
address: string;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
48
|
+
|
|
49
|
+
---
|
|
34
50
|
##### Interface: SetupEnv
|
|
35
51
|
|
|
36
52
|
`SetupEnv` provides a starting point for managing secrets that
|
|
@@ -561,7 +577,29 @@ export abstract class SetupClient {
|
|
|
561
577
|
console.log(log);
|
|
562
578
|
return log;
|
|
563
579
|
}
|
|
564
|
-
static getEnv(chain: sdk.Chain): SetupEnv
|
|
580
|
+
static getEnv(chain: sdk.Chain): SetupEnv {
|
|
581
|
+
const identityKey = chain === "main"
|
|
582
|
+
? process.env.MY_MAIN_IDENTITY
|
|
583
|
+
: process.env.MY_TEST_IDENTITY;
|
|
584
|
+
const identityKey2 = chain === "main"
|
|
585
|
+
? process.env.MY_MAIN_IDENTITY2
|
|
586
|
+
: process.env.MY_TEST_IDENTITY2;
|
|
587
|
+
const DEV_KEYS = process.env.DEV_KEYS || "{}";
|
|
588
|
+
const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
|
|
589
|
+
const taalApiKey = verifyTruthy(chain === "main"
|
|
590
|
+
? process.env.MAIN_TAAL_API_KEY
|
|
591
|
+
: process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
|
|
592
|
+
if (!identityKey || !identityKey2)
|
|
593
|
+
throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
|
|
594
|
+
return {
|
|
595
|
+
chain,
|
|
596
|
+
identityKey,
|
|
597
|
+
identityKey2,
|
|
598
|
+
taalApiKey,
|
|
599
|
+
devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
|
|
600
|
+
mySQLConnection
|
|
601
|
+
};
|
|
602
|
+
}
|
|
565
603
|
static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
|
|
566
604
|
const chain = args.env.chain;
|
|
567
605
|
args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
|
|
@@ -602,17 +640,60 @@ export abstract class SetupClient {
|
|
|
602
640
|
};
|
|
603
641
|
return r;
|
|
604
642
|
}
|
|
605
|
-
static async createWalletClient(args: SetupWalletClientArgs): Promise<SetupWalletClient>
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
643
|
+
static async createWalletClient(args: SetupWalletClientArgs): Promise<SetupWalletClient> {
|
|
644
|
+
const wo = await SetupClient.createWallet(args);
|
|
645
|
+
if (wo.chain === "main")
|
|
646
|
+
throw new sdk.WERR_INVALID_PARAMETER("chain", `'test' for now, 'main' is not yet supported.`);
|
|
647
|
+
const endpointUrl = args.endpointUrl || "https://staging-dojo.babbage.systems";
|
|
648
|
+
const client = new StorageClient(wo.wallet, endpointUrl);
|
|
649
|
+
await wo.storage.addWalletStorageProvider(client);
|
|
650
|
+
await wo.storage.makeAvailable();
|
|
651
|
+
return {
|
|
652
|
+
...wo,
|
|
653
|
+
endpointUrl
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
static getKeyPair(priv?: string | PrivateKey): KeyPairAddress {
|
|
657
|
+
if (priv === undefined)
|
|
658
|
+
priv = PrivateKey.fromRandom();
|
|
659
|
+
else if (typeof priv === "string")
|
|
660
|
+
priv = new PrivateKey(priv, "hex");
|
|
661
|
+
const pub = PublicKey.fromPrivateKey(priv);
|
|
662
|
+
const address = pub.toAddress();
|
|
663
|
+
return { privateKey: priv, publicKey: pub, address };
|
|
664
|
+
}
|
|
665
|
+
static getLockP2PKH(address: string) {
|
|
666
|
+
const p2pkh = new P2PKH();
|
|
667
|
+
const lock = p2pkh.lock(address);
|
|
668
|
+
return lock;
|
|
669
|
+
}
|
|
670
|
+
static getUnlockP2PKH(priv: PrivateKey, satoshis: number): sdk.ScriptTemplateUnlock {
|
|
671
|
+
const p2pkh = new P2PKH();
|
|
672
|
+
const lock = SetupClient.getLockP2PKH(SetupClient.getKeyPair(priv).address);
|
|
673
|
+
const unlock = p2pkh.unlock(priv, "all", false, satoshis, lock);
|
|
674
|
+
return unlock;
|
|
675
|
+
}
|
|
609
676
|
static createP2PKHOutputs(outputs: {
|
|
610
677
|
address: string;
|
|
611
678
|
satoshis: number;
|
|
612
679
|
outputDescription?: string;
|
|
613
680
|
basket?: string;
|
|
614
681
|
tags?: string[];
|
|
615
|
-
}[]): CreateActionOutput[]
|
|
682
|
+
}[]): CreateActionOutput[] {
|
|
683
|
+
const os: CreateActionOutput[] = [];
|
|
684
|
+
const count = outputs.length;
|
|
685
|
+
for (let i = 0; i < count; i++) {
|
|
686
|
+
const o = outputs[i];
|
|
687
|
+
os.push({
|
|
688
|
+
basket: o.basket,
|
|
689
|
+
tags: o.tags,
|
|
690
|
+
satoshis: o.satoshis,
|
|
691
|
+
lockingScript: SetupClient.getLockP2PKH(o.address).toHex(),
|
|
692
|
+
outputDescription: o.outputDescription || `p2pkh ${i}`
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
return os;
|
|
696
|
+
}
|
|
616
697
|
static async createP2PKHOutputsAction(wallet: WalletInterface, outputs: {
|
|
617
698
|
address: string;
|
|
618
699
|
satoshis: number;
|
|
@@ -622,12 +703,29 @@ export abstract class SetupClient {
|
|
|
622
703
|
}[], options?: CreateActionOptions): Promise<{
|
|
623
704
|
cr: CreateActionResult;
|
|
624
705
|
outpoints: string[] | undefined;
|
|
625
|
-
}>
|
|
626
|
-
|
|
706
|
+
}> {
|
|
707
|
+
const os = SetupClient.createP2PKHOutputs(outputs);
|
|
708
|
+
const createArgs: CreateActionArgs = {
|
|
709
|
+
description: `createP2PKHOutputs`,
|
|
710
|
+
outputs: os,
|
|
711
|
+
options: {
|
|
712
|
+
...options,
|
|
713
|
+
randomizeOutputs: false
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
const cr = await wallet.createAction(createArgs);
|
|
717
|
+
let outpoints: string[] | undefined;
|
|
718
|
+
if (cr.txid) {
|
|
719
|
+
outpoints = os.map((o, i) => `${cr.txid}.${i}`);
|
|
720
|
+
}
|
|
721
|
+
return { cr, outpoints };
|
|
722
|
+
}
|
|
723
|
+
static async fundWalletFromP2PKHOutpoints(wallet: WalletInterface, outpoints: string[], p2pkhKey: KeyPairAddress, inputBEEF?: BEEF) {
|
|
724
|
+
}
|
|
627
725
|
}
|
|
628
726
|
```
|
|
629
727
|
|
|
630
|
-
See also: [Chain](./client.md#type-chain), [KeyPairAddress](./setup.md#
|
|
728
|
+
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), [StorageClient](./storage.md#class-storageclient), [WERR_INVALID_OPERATION](./client.md#class-werr_invalid_operation), [WERR_INVALID_PARAMETER](./client.md#class-werr_invalid_parameter), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager), [createAction](./storage.md#function-createaction), [verifyTruthy](./client.md#function-verifytruthy)
|
|
631
729
|
|
|
632
730
|
###### Method createWallet
|
|
633
731
|
|
|
@@ -689,9 +787,31 @@ Returns values for designated `chain`.
|
|
|
689
787
|
Access private keys through the `devKeys` object: `devKeys[identityKey]`
|
|
690
788
|
|
|
691
789
|
```ts
|
|
692
|
-
static getEnv(chain: sdk.Chain): SetupEnv
|
|
790
|
+
static getEnv(chain: sdk.Chain): SetupEnv {
|
|
791
|
+
const identityKey = chain === "main"
|
|
792
|
+
? process.env.MY_MAIN_IDENTITY
|
|
793
|
+
: process.env.MY_TEST_IDENTITY;
|
|
794
|
+
const identityKey2 = chain === "main"
|
|
795
|
+
? process.env.MY_MAIN_IDENTITY2
|
|
796
|
+
: process.env.MY_TEST_IDENTITY2;
|
|
797
|
+
const DEV_KEYS = process.env.DEV_KEYS || "{}";
|
|
798
|
+
const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
|
|
799
|
+
const taalApiKey = verifyTruthy(chain === "main"
|
|
800
|
+
? process.env.MAIN_TAAL_API_KEY
|
|
801
|
+
: process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
|
|
802
|
+
if (!identityKey || !identityKey2)
|
|
803
|
+
throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
|
|
804
|
+
return {
|
|
805
|
+
chain,
|
|
806
|
+
identityKey,
|
|
807
|
+
identityKey2,
|
|
808
|
+
taalApiKey,
|
|
809
|
+
devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
|
|
810
|
+
mySQLConnection
|
|
811
|
+
};
|
|
812
|
+
}
|
|
693
813
|
```
|
|
694
|
-
See also: [Chain](./client.md#type-chain), [SetupEnv](./setup.md#interface-setupenv)
|
|
814
|
+
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)
|
|
695
815
|
|
|
696
816
|
Returns
|
|
697
817
|
|
|
@@ -712,7 +832,34 @@ Loading secrets from a .env file is intended only for experimentation and gettin
|
|
|
712
832
|
Private keys should never be included directly in your source code.
|
|
713
833
|
|
|
714
834
|
```ts
|
|
715
|
-
static makeEnv(): string
|
|
835
|
+
static makeEnv(): string {
|
|
836
|
+
const testPrivKey1 = PrivateKey.fromRandom();
|
|
837
|
+
const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
|
|
838
|
+
const testPrivKey2 = PrivateKey.fromRandom();
|
|
839
|
+
const testIdentityKey2 = testPrivKey2.toPublicKey().toString();
|
|
840
|
+
const mainPrivKey1 = PrivateKey.fromRandom();
|
|
841
|
+
const mainIdentityKey1 = mainPrivKey1.toPublicKey().toString();
|
|
842
|
+
const mainPrivKey2 = PrivateKey.fromRandom();
|
|
843
|
+
const mainIdentityKey2 = mainPrivKey2.toPublicKey().toString();
|
|
844
|
+
const log = `
|
|
845
|
+
# Add the following to .env file:
|
|
846
|
+
MAIN_TAAL_API_KEY='mainnet_9596de07e92300c6287e4393594ae39c'
|
|
847
|
+
TEST_TAAL_API_KEY='testnet_0e6cf72133b43ea2d7861da2a38684e3'
|
|
848
|
+
MY_TEST_IDENTITY = '${testIdentityKey1}'
|
|
849
|
+
MY_TEST_IDENTITY2 = '${testIdentityKey2}'
|
|
850
|
+
MY_MAIN_IDENTITY = '${mainIdentityKey1}'
|
|
851
|
+
MY_MAIN_IDENTITY2 = '${mainIdentityKey2}'
|
|
852
|
+
DEV_KEYS = '{
|
|
853
|
+
"${testIdentityKey1}": "${testPrivKey1.toString()}",
|
|
854
|
+
"${testIdentityKey2}": "${testPrivKey2.toString()}"
|
|
855
|
+
"${mainIdentityKey1}": "${mainPrivKey1.toString()}",
|
|
856
|
+
"${mainIdentityKey2}": "${mainPrivKey2.toString()}"
|
|
857
|
+
}'
|
|
858
|
+
MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"<your_password>","database":"<your_database>", "timezone": "Z"}'
|
|
859
|
+
`;
|
|
860
|
+
console.log(log);
|
|
861
|
+
return log;
|
|
862
|
+
}
|
|
716
863
|
```
|
|
717
864
|
|
|
718
865
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
@@ -722,19 +869,6 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
722
869
|
|
|
723
870
|
#### Types
|
|
724
871
|
|
|
725
|
-
##### Type: KeyPairAddress
|
|
726
|
-
|
|
727
|
-
```ts
|
|
728
|
-
export type KeyPairAddress = {
|
|
729
|
-
privateKey: PrivateKey;
|
|
730
|
-
publicKey: PublicKey;
|
|
731
|
-
address: string;
|
|
732
|
-
}
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
|
|
736
|
-
|
|
737
|
-
---
|
|
738
872
|
#### Variables
|
|
739
873
|
|
|
740
874
|
|