evernode-js-client 0.6.36 → 0.6.37
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +129 -83
- package/package.json +1 -1
package/index.js
CHANGED
@@ -52488,7 +52488,7 @@ class BaseEvernodeClient {
|
|
52488
52488
|
* Get the hosts registered in Evernode.
|
52489
52489
|
* @returns The list of hosts.
|
52490
52490
|
*/
|
52491
|
-
async getAllHostsFromLedger() {
|
52491
|
+
async getAllHostsFromLedger(skipGetDomain = false) {
|
52492
52492
|
const states = await this.getHookStates();
|
52493
52493
|
let hosts = {};
|
52494
52494
|
|
@@ -52508,7 +52508,9 @@ class BaseEvernodeClient {
|
|
52508
52508
|
const curMomentStartIdx = await this.getMomentStartIndex();
|
52509
52509
|
await Promise.all((hostList).map(async host => {
|
52510
52510
|
const hostAcc = new XrplAccount(host.address, null, { xrplApi: this.xrplApi });
|
52511
|
-
|
52511
|
+
if (!skipGetDomain) {
|
52512
|
+
host.domain = await hostAcc.getDomain();
|
52513
|
+
}
|
52512
52514
|
host.active = (host.lastHeartbeatIndex > (this.config.hostHeartbeatFreq * this.config.momentSize) ?
|
52513
52515
|
(host.lastHeartbeatIndex >= (curMomentStartIdx - (this.config.hostHeartbeatFreq * this.config.momentSize))) :
|
52514
52516
|
(host.lastHeartbeatIndex > 0));
|
@@ -53315,10 +53317,11 @@ class HostClient extends BaseEvernodeClient {
|
|
53315
53317
|
let attempt = 0;
|
53316
53318
|
let feeUplift = 0;
|
53317
53319
|
const maxAttempts = (options?.maxRetryAttempts || 1);
|
53320
|
+
let submissionRef = options.submissionRef || {};
|
53318
53321
|
while (attempt <= maxAttempts) {
|
53319
53322
|
attempt++;
|
53320
53323
|
try {
|
53321
|
-
return await callback(feeUplift);
|
53324
|
+
return await callback(feeUplift, submissionRef);
|
53322
53325
|
}
|
53323
53326
|
catch (e) {
|
53324
53327
|
if (attempt == maxAttempts || e.code === "tecDUPLICATE" || e.code === "tefPAST_SEQ" || e.code === "tefALREADY")
|
@@ -53329,6 +53332,16 @@ class HostClient extends BaseEvernodeClient {
|
|
53329
53332
|
console.error(e);
|
53330
53333
|
console.error(`Submission attempt ${attempt} failed. Retrying...`);
|
53331
53334
|
await new Promise(resolve => setTimeout(resolve, TX_RETRY_INTERVAL));
|
53335
|
+
|
53336
|
+
// Check again wether the transaction is validated before retry.
|
53337
|
+
const txHash = submissionRef?.submissionResult?.result?.tx_json?.hash;
|
53338
|
+
if (txHash) {
|
53339
|
+
const txResponse = await this.xrplApi.getTransactionValidatedResults(txHash);
|
53340
|
+
if (txResponse && txResponse.code === "tesSUCCESS") {
|
53341
|
+
console.log('Transaction is validated and success, Retry skipped!')
|
53342
|
+
return txResponse;
|
53343
|
+
}
|
53344
|
+
}
|
53332
53345
|
}
|
53333
53346
|
}
|
53334
53347
|
}
|
@@ -53353,15 +53366,15 @@ class HostClient extends BaseEvernodeClient {
|
|
53353
53366
|
{ ...accountSetFields, Domain: domain } : accountSetFields;
|
53354
53367
|
|
53355
53368
|
if (Object.keys(accountSetFields).length !== 0) {
|
53356
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53357
|
-
await this.xrplAcc.setAccountFields(accountSetFields, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53358
|
-
}, options.retryOptions);
|
53369
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53370
|
+
await this.xrplAcc.setAccountFields(accountSetFields, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53371
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53359
53372
|
}
|
53360
53373
|
|
53361
53374
|
if (trustLines.length === 0) {
|
53362
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53363
|
-
await this.xrplAcc.setTrustLine(EvernodeConstants.EVR, this.config.evrIssuerAddress, "99999999999999", null, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53364
|
-
}, options.retryOptions);
|
53375
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53376
|
+
await this.xrplAcc.setTrustLine(EvernodeConstants.EVR, this.config.evrIssuerAddress, "99999999999999", null, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53377
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53365
53378
|
}
|
53366
53379
|
}
|
53367
53380
|
|
@@ -53424,9 +53437,9 @@ class HostClient extends BaseEvernodeClient {
|
|
53424
53437
|
const uri = uriBuf.toString('base64');
|
53425
53438
|
|
53426
53439
|
try {
|
53427
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53428
|
-
await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false }, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53429
|
-
}, options.retryOptions);
|
53440
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53441
|
+
await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false }, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53442
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53430
53443
|
} catch (e) {
|
53431
53444
|
// Re-minting the URIToken after burning that sold URIToken.
|
53432
53445
|
if (e.code === "tecDUPLICATE") {
|
@@ -53442,12 +53455,12 @@ class HostClient extends BaseEvernodeClient {
|
|
53442
53455
|
if (!uriToken)
|
53443
53456
|
throw "Offer lease NFT creation error.";
|
53444
53457
|
|
53445
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53458
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53446
53459
|
await this.xrplAcc.sellURIToken(uriToken.index,
|
53447
53460
|
leaseAmount.toString(),
|
53448
53461
|
EvernodeConstants.EVR,
|
53449
|
-
this.config.evrIssuerAddress, null, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53450
|
-
}, options.retryOptions);
|
53462
|
+
this.config.evrIssuerAddress, null, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53463
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53451
53464
|
}
|
53452
53465
|
|
53453
53466
|
/**
|
@@ -53509,9 +53522,9 @@ class HostClient extends BaseEvernodeClient {
|
|
53509
53522
|
const uri = uriBuf.toString('base64');
|
53510
53523
|
|
53511
53524
|
try {
|
53512
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53513
|
-
await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false }, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53514
|
-
}, options.retryOptions);
|
53525
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53526
|
+
await this.xrplAcc.mintURIToken(uri, null, { isBurnable: true, isHexUri: false }, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53527
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53515
53528
|
} catch (e) {
|
53516
53529
|
// Re-minting the URIToken after burning that sold URIToken.
|
53517
53530
|
if (e.code === "tecDUPLICATE") {
|
@@ -53530,11 +53543,11 @@ class HostClient extends BaseEvernodeClient {
|
|
53530
53543
|
* @param {number} leaseAmount Amount (EVRs) of the lease offer.
|
53531
53544
|
*/
|
53532
53545
|
async offerMintedLease(uriTokenId, leaseAmount, options = {}) {
|
53533
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53546
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53534
53547
|
await this.xrplAcc.sellURIToken(uriTokenId, leaseAmount.toString(),
|
53535
53548
|
EvernodeConstants.EVR,
|
53536
|
-
this.config.evrIssuerAddress, null, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53537
|
-
}, options.retryOptions);
|
53549
|
+
this.config.evrIssuerAddress, null, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53550
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53538
53551
|
}
|
53539
53552
|
|
53540
53553
|
/**
|
@@ -53542,9 +53555,9 @@ class HostClient extends BaseEvernodeClient {
|
|
53542
53555
|
* @param {string} uriTokenId Hex URI token id of the lease.
|
53543
53556
|
*/
|
53544
53557
|
async expireLease(uriTokenId, options = {}) {
|
53545
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53546
|
-
await this.xrplAcc.burnURIToken(uriTokenId, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53547
|
-
}, options.retryOptions);
|
53558
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53559
|
+
await this.xrplAcc.burnURIToken(uriTokenId, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53560
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53548
53561
|
}
|
53549
53562
|
|
53550
53563
|
/**
|
@@ -53564,9 +53577,9 @@ class HostClient extends BaseEvernodeClient {
|
|
53564
53577
|
const sellOffer = (await registryAcc.getURITokens()).find(o => o.index == regInfo.uriTokenId && o.Amount);
|
53565
53578
|
console.log('Pending sell offer found.')
|
53566
53579
|
if (sellOffer) {
|
53567
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53568
|
-
await this.xrplAcc.buyURIToken(sellOffer, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53569
|
-
}, options.retryOptions);
|
53580
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53581
|
+
await this.xrplAcc.buyURIToken(sellOffer, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53582
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53570
53583
|
console.log("Registration was successfully completed after acquiring the NFT.");
|
53571
53584
|
return await this.isRegistered();
|
53572
53585
|
}
|
@@ -53627,9 +53640,9 @@ class HostClient extends BaseEvernodeClient {
|
|
53627
53640
|
if (existingLeaseURITokens) {
|
53628
53641
|
console.log("Burning unsold URITokens related to the previous leases.");
|
53629
53642
|
for (const uriToken of existingLeaseURITokens) {
|
53630
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53631
|
-
await this.xrplAcc.burnURIToken(uriToken.index, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53632
|
-
}, options.retryOptions);
|
53643
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53644
|
+
await this.xrplAcc.burnURIToken(uriToken.index, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53645
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53633
53646
|
}
|
53634
53647
|
}
|
53635
53648
|
|
@@ -53669,7 +53682,7 @@ class HostClient extends BaseEvernodeClient {
|
|
53669
53682
|
Buffer.from(description.substr(0, 26), "utf-8").copy(paramBuf, HOST_DESCRIPTION_PARAM_OFFSET);
|
53670
53683
|
Buffer.from(emailAddress.substr(0, 40), "utf-8").copy(paramBuf, HOST_EMAIL_ADDRESS_PARAM_OFFSET);
|
53671
53684
|
|
53672
|
-
const tx = await this.#submitWithRetry(async (feeUplift) => {
|
53685
|
+
const tx = await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53673
53686
|
return await this.xrplAcc.makePayment(this.config.registryAddress,
|
53674
53687
|
(transferredNFTokenId) ? EvernodeConstants.NOW_IN_EVRS : this.config.hostRegFee.toString(),
|
53675
53688
|
EvernodeConstants.EVR,
|
@@ -53681,10 +53694,10 @@ class HostClient extends BaseEvernodeClient {
|
|
53681
53694
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramBuf.toString('hex').toUpperCase() }
|
53682
53695
|
],
|
53683
53696
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
53684
|
-
feeUplift: feeUplift,
|
53697
|
+
feeUplift: feeUplift, submissionRef: submissionRef,
|
53685
53698
|
...options.transactionOptions
|
53686
53699
|
});
|
53687
|
-
}, options.retryOptions);
|
53700
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53688
53701
|
|
53689
53702
|
console.log('Waiting for the sell offer', tx.id)
|
53690
53703
|
const registryAcc = new XrplAccount(this.config.registryAddress, null, { xrplApi: this.xrplApi });
|
@@ -53722,9 +53735,9 @@ class HostClient extends BaseEvernodeClient {
|
|
53722
53735
|
resolve();
|
53723
53736
|
});
|
53724
53737
|
|
53725
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53726
|
-
await this.xrplAcc.buyURIToken(sellOffer, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift });
|
53727
|
-
}, options.retryOptions);
|
53738
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53739
|
+
await this.xrplAcc.buyURIToken(sellOffer, null, { maxLedgerIndex: this.#getMaxLedgerSequence(), feeUplift: feeUplift, submissionRef: submissionRef });
|
53740
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53728
53741
|
return await this.isRegistered();
|
53729
53742
|
}
|
53730
53743
|
|
@@ -53747,7 +53760,7 @@ class HostClient extends BaseEvernodeClient {
|
|
53747
53760
|
paramBuf.writeUInt8(1, 32);
|
53748
53761
|
}
|
53749
53762
|
|
53750
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
53763
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53751
53764
|
await this.xrplAcc.makePayment(this.config.registryAddress,
|
53752
53765
|
XrplConstants.MIN_DROPS,
|
53753
53766
|
null,
|
@@ -53759,10 +53772,10 @@ class HostClient extends BaseEvernodeClient {
|
|
53759
53772
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramBuf.toString('hex').toUpperCase() }
|
53760
53773
|
],
|
53761
53774
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
53762
|
-
feeUplift: feeUplift,
|
53775
|
+
feeUplift: feeUplift, submissionRef: submissionRef,
|
53763
53776
|
...options.transactionOptions
|
53764
53777
|
});
|
53765
|
-
}, options.retryOptions);
|
53778
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53766
53779
|
|
53767
53780
|
return await this.isRegistered();
|
53768
53781
|
}
|
@@ -53812,7 +53825,7 @@ class HostClient extends BaseEvernodeClient {
|
|
53812
53825
|
paramBuf.writeUInt8(components[2], HOST_UPDATE_VERSION_PARAM_OFFSET + 2);
|
53813
53826
|
}
|
53814
53827
|
|
53815
|
-
return await this.#submitWithRetry(async (feeUplift) => {
|
53828
|
+
return await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
53816
53829
|
return await this.xrplAcc.makePayment(this.config.registryAddress,
|
53817
53830
|
XrplConstants.MIN_DROPS,
|
53818
53831
|
null,
|
@@ -53824,10 +53837,10 @@ class HostClient extends BaseEvernodeClient {
|
|
53824
53837
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramBuf.toString('hex') }
|
53825
53838
|
],
|
53826
53839
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
53827
|
-
feeUplift: feeUplift,
|
53840
|
+
feeUplift: feeUplift, submissionRef: submissionRef,
|
53828
53841
|
...options.transactionOptions
|
53829
53842
|
});
|
53830
|
-
}, options.retryOptions);
|
53843
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
53831
53844
|
|
53832
53845
|
}
|
53833
53846
|
|
@@ -53865,7 +53878,8 @@ class HostClient extends BaseEvernodeClient {
|
|
53865
53878
|
...(data ? [{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: data }] : [])
|
53866
53879
|
],
|
53867
53880
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
53868
|
-
...options.transactionOptions
|
53881
|
+
...options.transactionOptions,
|
53882
|
+
submissionRef: options.submissionRef
|
53869
53883
|
});
|
53870
53884
|
return res;
|
53871
53885
|
}
|
@@ -53932,7 +53946,8 @@ class HostClient extends BaseEvernodeClient {
|
|
53932
53946
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
|
53933
53947
|
],
|
53934
53948
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
53935
|
-
...options.transactionOptions
|
53949
|
+
...options.transactionOptions,
|
53950
|
+
submissionRef: options.submissionRef
|
53936
53951
|
});
|
53937
53952
|
}
|
53938
53953
|
|
@@ -53960,7 +53975,8 @@ class HostClient extends BaseEvernodeClient {
|
|
53960
53975
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
|
53961
53976
|
],
|
53962
53977
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
53963
|
-
...options.transactionOptions
|
53978
|
+
...options.transactionOptions,
|
53979
|
+
submissionRef: options.submissionRef
|
53964
53980
|
});
|
53965
53981
|
}
|
53966
53982
|
|
@@ -53989,7 +54005,8 @@ class HostClient extends BaseEvernodeClient {
|
|
53989
54005
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
|
53990
54006
|
],
|
53991
54007
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
53992
|
-
...options.transactionOptions
|
54008
|
+
...options.transactionOptions,
|
54009
|
+
submissionRef: options.submissionRef
|
53993
54010
|
});
|
53994
54011
|
}
|
53995
54012
|
|
@@ -54018,7 +54035,8 @@ class HostClient extends BaseEvernodeClient {
|
|
54018
54035
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
|
54019
54036
|
],
|
54020
54037
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
54021
|
-
...options.transactionOptions
|
54038
|
+
...options.transactionOptions,
|
54039
|
+
submissionRef: options.submissionRef
|
54022
54040
|
});
|
54023
54041
|
}
|
54024
54042
|
|
@@ -54044,7 +54062,8 @@ class HostClient extends BaseEvernodeClient {
|
|
54044
54062
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: txHash }
|
54045
54063
|
],
|
54046
54064
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
54047
|
-
...options.transactionOptions
|
54065
|
+
...options.transactionOptions,
|
54066
|
+
submissionRef: options.submissionRef
|
54048
54067
|
});
|
54049
54068
|
}
|
54050
54069
|
|
@@ -54066,7 +54085,8 @@ class HostClient extends BaseEvernodeClient {
|
|
54066
54085
|
{ name: HookParamKeys.PARAM_EVENT_TYPE_KEY, value: EventTypes.HOST_REBATE }
|
54067
54086
|
],
|
54068
54087
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
54069
|
-
...options.transactionOptions
|
54088
|
+
...options.transactionOptions,
|
54089
|
+
submissionRef: options.submissionRef
|
54070
54090
|
});
|
54071
54091
|
}
|
54072
54092
|
|
@@ -54092,7 +54112,7 @@ class HostClient extends BaseEvernodeClient {
|
|
54092
54112
|
|
54093
54113
|
const regUriToken = await this.getRegistrationUriToken();
|
54094
54114
|
|
54095
|
-
await this.#submitWithRetry(async (feeUplift) => {
|
54115
|
+
await this.#submitWithRetry(async (feeUplift, submissionRef) => {
|
54096
54116
|
await this.xrplAcc.sellURIToken(regUriToken.index,
|
54097
54117
|
XrplConstants.MIN_DROPS,
|
54098
54118
|
null,
|
@@ -54105,10 +54125,10 @@ class HostClient extends BaseEvernodeClient {
|
|
54105
54125
|
{ name: HookParamKeys.PARAM_EVENT_DATA1_KEY, value: paramData.toString('hex') }
|
54106
54126
|
],
|
54107
54127
|
maxLedgerIndex: this.#getMaxLedgerSequence(),
|
54108
|
-
feeUplift: feeUplift,
|
54128
|
+
feeUplift: feeUplift, submissionRef: submissionRef,
|
54109
54129
|
...options.transactionOptions
|
54110
54130
|
});
|
54111
|
-
}, options.retryOptions);
|
54131
|
+
}, { ...(options.retryOptions ? options.retryOptions : {}), submissionRef: options.submissionRef });
|
54112
54132
|
|
54113
54133
|
let token = null;
|
54114
54134
|
let attempts = 0;
|
@@ -56518,7 +56538,7 @@ class XrplAccount {
|
|
56518
56538
|
|
56519
56539
|
async setAccountFields(fields, options = {}) {
|
56520
56540
|
const preparedTxn = await this.prepareSetAccountFields(fields, options);
|
56521
|
-
return await this.signAndSubmit(preparedTxn);
|
56541
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56522
56542
|
}
|
56523
56543
|
|
56524
56544
|
async prepareSetAccountFields(fields, options = {}) {
|
@@ -56565,7 +56585,7 @@ class XrplAccount {
|
|
56565
56585
|
async setSignerList(signerList = [], options = {}) {
|
56566
56586
|
|
56567
56587
|
const preparedTxn = await this.prepareSetSignerList(signerList, options);
|
56568
|
-
return await this.signAndSubmit(preparedTxn);
|
56588
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56569
56589
|
}
|
56570
56590
|
|
56571
56591
|
/**
|
@@ -56611,7 +56631,7 @@ class XrplAccount {
|
|
56611
56631
|
|
56612
56632
|
async makePayment(toAddr, amount, currency = null, issuer = null, memos = null, options = {}) {
|
56613
56633
|
const preparedTxn = await this.prepareMakePayment(toAddr, amount, currency, issuer, memos, options);
|
56614
|
-
return await this.signAndSubmit(preparedTxn);
|
56634
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56615
56635
|
}
|
56616
56636
|
|
56617
56637
|
async prepareMakePayment(toAddr, amount, currency = null, issuer = null, memos = null, options = {}) {
|
@@ -56630,7 +56650,7 @@ class XrplAccount {
|
|
56630
56650
|
|
56631
56651
|
async setTrustLine(currency, issuer, limit, allowRippling = false, memos = null, options = {}) {
|
56632
56652
|
const preparedTxn = await this.prepareSetTrustLine(currency, issuer, limit, allowRippling, memos, options);
|
56633
|
-
return await this.signAndSubmit(preparedTxn);
|
56653
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56634
56654
|
}
|
56635
56655
|
|
56636
56656
|
async prepareSetTrustLine(currency, issuer, limit, allowRippling = false, memos = null, options = {}) {
|
@@ -56658,7 +56678,7 @@ class XrplAccount {
|
|
56658
56678
|
|
56659
56679
|
async setRegularKey(regularKey, memos = null, options = {}) {
|
56660
56680
|
const preparedTxn = await this.prepareSetRegularKey(regularKey, memos, options);
|
56661
|
-
return await this.signAndSubmit(preparedTxn);
|
56681
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56662
56682
|
}
|
56663
56683
|
|
56664
56684
|
async prepareSetRegularKey(regularKey, memos = null, options = {}) {
|
@@ -56674,7 +56694,7 @@ class XrplAccount {
|
|
56674
56694
|
|
56675
56695
|
async cashCheck(check, options = {}) {
|
56676
56696
|
const preparedTxn = await this.prepareCashCheck(check, options);
|
56677
|
-
return await this.signAndSubmit(preparedTxn);
|
56697
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56678
56698
|
}
|
56679
56699
|
|
56680
56700
|
async prepareCashCheck(check, options = {}) {
|
@@ -56701,7 +56721,7 @@ class XrplAccount {
|
|
56701
56721
|
|
56702
56722
|
async offerSell(sellAmount, sellCurrency, sellIssuer, forAmount, forCurrency, forIssuer = null, expiration = 4294967295, memos = null, options = {}) {
|
56703
56723
|
const preparedTxn = await this.prepareOfferSell(sellAmount, sellCurrency, sellIssuer, forAmount, forCurrency, forIssuer, expiration, memos, options);
|
56704
|
-
return await this.signAndSubmit(preparedTxn);
|
56724
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56705
56725
|
}
|
56706
56726
|
|
56707
56727
|
async prepareOfferSell(sellAmount, sellCurrency, sellIssuer, forAmount, forCurrency, forIssuer = null, expiration = 4294967295, memos = null, options = {}) {
|
@@ -56722,7 +56742,7 @@ class XrplAccount {
|
|
56722
56742
|
|
56723
56743
|
async offerBuy(buyAmount, buyCurrency, buyIssuer, forAmount, forCurrency, forIssuer = null, expiration = 4294967295, memos = null, options = {}) {
|
56724
56744
|
const preparedTxn = await this.prepareOfferBuy(buyAmount, buyCurrency, buyIssuer, forAmount, forCurrency, forIssuer, expiration, memos, options);
|
56725
|
-
return await this.signAndSubmit(preparedTxn);
|
56745
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56726
56746
|
}
|
56727
56747
|
|
56728
56748
|
async prepareOfferBuy(buyAmount, buyCurrency, buyIssuer, forAmount, forCurrency, forIssuer = null, expiration = 4294967295, memos = null, options = {}) {
|
@@ -56743,7 +56763,7 @@ class XrplAccount {
|
|
56743
56763
|
|
56744
56764
|
async cancelOffer(offerSequence, memos = null, options = {}) {
|
56745
56765
|
const preparedTxn = await this.prepareCancelOffer(offerSequence, memos, options);
|
56746
|
-
return await this.signAndSubmit(preparedTxn);
|
56766
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56747
56767
|
}
|
56748
56768
|
|
56749
56769
|
async prepareCancelOffer(offerSequence, memos = null, options = {}) {
|
@@ -56758,7 +56778,7 @@ class XrplAccount {
|
|
56758
56778
|
|
56759
56779
|
async mintNft(uri, taxon, transferFee, flags = {}, memos = null, options = {}) {
|
56760
56780
|
const preparedTxn = await this.prepareMintNft(uri, taxon, transferFee, flags, memos, options);
|
56761
|
-
return await this.signAndSubmit(preparedTxn);
|
56781
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56762
56782
|
}
|
56763
56783
|
|
56764
56784
|
async prepareMintNft(uri, taxon, transferFee, flags = {}, memos = null, options = {}) {
|
@@ -56776,7 +56796,7 @@ class XrplAccount {
|
|
56776
56796
|
|
56777
56797
|
async offerSellNft(nfTokenId, amount, currency, issuer = null, destination = null, expiration = 4294967295, memos = null, options = {}) {
|
56778
56798
|
const preparedTxn = await this.prepareOfferSellNft(nfTokenId, amount, currency, issuer, destination, expiration, memos, options);
|
56779
|
-
return await this.signAndSubmit(preparedTxn);
|
56799
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56780
56800
|
}
|
56781
56801
|
|
56782
56802
|
async prepareOfferSellNft(nfTokenId, amount, currency, issuer = null, destination = null, expiration = 4294967295, memos = null, options = {}) {
|
@@ -56798,7 +56818,7 @@ class XrplAccount {
|
|
56798
56818
|
|
56799
56819
|
async offerBuyNft(nfTokenId, owner, amount, currency, issuer = null, expiration = 4294967295, memos = null, options = {}) {
|
56800
56820
|
const preparedTxn = await this.prepareOfferSellNft(nfTokenId, owner, amount, currency, issuer, expiration, memos, options);
|
56801
|
-
return await this.signAndSubmit(preparedTxn);
|
56821
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56802
56822
|
}
|
56803
56823
|
|
56804
56824
|
async prepareOfferBuyNft(nfTokenId, owner, amount, currency, issuer = null, expiration = 4294967295, memos = null, options = {}) {
|
@@ -56821,7 +56841,7 @@ class XrplAccount {
|
|
56821
56841
|
|
56822
56842
|
async sellNft(offerId, memos = null, options = {}) {
|
56823
56843
|
const preparedTxn = await this.prepareSellNft(offerId, memos, options);
|
56824
|
-
return await this.signAndSubmit(preparedTxn);
|
56844
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56825
56845
|
}
|
56826
56846
|
|
56827
56847
|
async prepareSellNft(offerId, memos = null, options = {}) {
|
@@ -56837,7 +56857,7 @@ class XrplAccount {
|
|
56837
56857
|
|
56838
56858
|
async buyNft(offerId, memos = null, options = {}) {
|
56839
56859
|
const preparedTxn = await this.prepareBuyNft(offerId, memos, options);
|
56840
|
-
return await this.signAndSubmit(preparedTxn);
|
56860
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56841
56861
|
}
|
56842
56862
|
|
56843
56863
|
async prepareBuyNft(offerId, memos = null, options = {}) {
|
@@ -56853,7 +56873,7 @@ class XrplAccount {
|
|
56853
56873
|
|
56854
56874
|
async burnNft(nfTokenId, owner = null, memos = null, options = {}) {
|
56855
56875
|
const preparedTxn = await this.prepareBurnNft(nfTokenId, owner, memos, options);
|
56856
|
-
return await this.signAndSubmit(preparedTxn);
|
56876
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56857
56877
|
}
|
56858
56878
|
|
56859
56879
|
async prepareBurnNft(nfTokenId, owner = null, memos = null, options = {}) {
|
@@ -56969,7 +56989,7 @@ class XrplAccount {
|
|
56969
56989
|
|
56970
56990
|
async mintURIToken(uri, digest = null, flags = {}, options = {}) {
|
56971
56991
|
const preparedTxn = await this.prepareMintURIToken(uri, digest, flags, options);
|
56972
|
-
return await this.signAndSubmit(preparedTxn);
|
56992
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56973
56993
|
}
|
56974
56994
|
|
56975
56995
|
async prepareMintURIToken(uri, digest = null, flags = {}, options = {}) {
|
@@ -56989,7 +57009,7 @@ class XrplAccount {
|
|
56989
57009
|
|
56990
57010
|
async burnURIToken(uriTokenID, options = {}) {
|
56991
57011
|
const preparedTxn = await this.prepareBurnURIToken(uriTokenID, options);
|
56992
|
-
return await this.signAndSubmit(preparedTxn);
|
57012
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
56993
57013
|
}
|
56994
57014
|
|
56995
57015
|
async prepareBurnURIToken(uriTokenID, options = {}) {
|
@@ -57003,7 +57023,7 @@ class XrplAccount {
|
|
57003
57023
|
|
57004
57024
|
async sellURIToken(uriTokenID, amount, currency, issuer = null, toAddr = null, memos = null, options = {}) {
|
57005
57025
|
const preparedTxn = await this.prepareSellURIToken(uriTokenID, amount, currency, issuer, toAddr, memos, options);
|
57006
|
-
return await this.signAndSubmit(preparedTxn);
|
57026
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
57007
57027
|
}
|
57008
57028
|
|
57009
57029
|
async prepareSellURIToken(uriTokenID, amount, currency, issuer = null, toAddr = null, memos = null, options = {}) {
|
@@ -57029,7 +57049,7 @@ class XrplAccount {
|
|
57029
57049
|
|
57030
57050
|
async buyURIToken(uriToken, memos = null, options = {}) {
|
57031
57051
|
const preparedTxn = await this.prepareBuyURIToken(uriToken, memos, options);
|
57032
|
-
return await this.signAndSubmit(preparedTxn);
|
57052
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
57033
57053
|
}
|
57034
57054
|
|
57035
57055
|
async prepareBuyURIToken(uriToken, memos = null, options = {}) {
|
@@ -57051,7 +57071,7 @@ class XrplAccount {
|
|
57051
57071
|
|
57052
57072
|
async clearURITokenOffer(uriTokenID, options = {}) {
|
57053
57073
|
const preparedTxn = await this.prepareClearURITokenOffer(uriTokenID, options);
|
57054
|
-
return await this.signAndSubmit(preparedTxn);
|
57074
|
+
return await this.signAndSubmit(preparedTxn, options.submissionRef);
|
57055
57075
|
}
|
57056
57076
|
|
57057
57077
|
async prepareClearURITokenOffer(uriTokenID, options = {}) {
|
@@ -57133,11 +57153,12 @@ class XrplAccount {
|
|
57133
57153
|
/**
|
57134
57154
|
* Sign and submit prepared transaction.
|
57135
57155
|
* @param {object} preparedTransaction Prepared transaction.
|
57156
|
+
* @param {object} submissionRef [Optional] Reference object to take submission references.
|
57136
57157
|
* @returns result of the submitted transaction.
|
57137
57158
|
*/
|
57138
|
-
async signAndSubmit(preparedTransaction) {
|
57159
|
+
async signAndSubmit(preparedTransaction, submissionRef = {}) {
|
57139
57160
|
const signedTxn = this.sign(preparedTransaction, false);
|
57140
|
-
return await this.xrplApi.submitAndWait(preparedTransaction, signedTxn.tx_blob);
|
57161
|
+
return await this.xrplApi.submitAndWait(preparedTransaction, signedTxn.tx_blob, submissionRef);
|
57141
57162
|
}
|
57142
57163
|
|
57143
57164
|
/**
|
@@ -57458,12 +57479,12 @@ class XrplApi {
|
|
57458
57479
|
if (res.filter(r => r && !r.error).length == 0)
|
57459
57480
|
throw res.filter(r => r && r.error).map(r => r.error);
|
57460
57481
|
|
57461
|
-
await this.#waitForConnection();
|
57462
|
-
this.#releaseClient();
|
57463
|
-
|
57464
57482
|
// After connection established, check again whether maintainConnections has become false.
|
57465
57483
|
// This is in case the consumer has called disconnect() while connection is being established.
|
57466
57484
|
if (!this.#isPermanentlyDisconnected) {
|
57485
|
+
await this.#waitForConnection();
|
57486
|
+
this.#releaseClient();
|
57487
|
+
|
57467
57488
|
this.ledgerIndex = await this.#getLedgerIndex();
|
57468
57489
|
|
57469
57490
|
this.#subscribeToStream('ledger');
|
@@ -57473,6 +57494,7 @@ class XrplApi {
|
|
57473
57494
|
await this.#handleClientRequest({ command: 'subscribe', accounts: this.#addressSubscriptions.map(s => s.address) });
|
57474
57495
|
}
|
57475
57496
|
else {
|
57497
|
+
this.#releaseClient();
|
57476
57498
|
await this.disconnect();
|
57477
57499
|
}
|
57478
57500
|
}
|
@@ -57691,6 +57713,28 @@ class XrplApi {
|
|
57691
57713
|
await this.#handleClientRequest({ command: 'subscribe', streams: [streamName] });
|
57692
57714
|
}
|
57693
57715
|
|
57716
|
+
/**
|
57717
|
+
* Get the transaction results if validated.
|
57718
|
+
* @param {string} txHash Hash of the transaction to check.
|
57719
|
+
* @returns Validated results of the transaction.
|
57720
|
+
*/
|
57721
|
+
async getTransactionValidatedResults(txHash) {
|
57722
|
+
const txResponse = await this.getTxnInfo(txHash)
|
57723
|
+
.catch((e) => {
|
57724
|
+
return null;
|
57725
|
+
});
|
57726
|
+
|
57727
|
+
if (txResponse?.validated) {
|
57728
|
+
return {
|
57729
|
+
id: txResponse?.hash,
|
57730
|
+
code: txResponse?.meta?.TransactionResult,
|
57731
|
+
details: txResponse
|
57732
|
+
};
|
57733
|
+
}
|
57734
|
+
|
57735
|
+
return null;
|
57736
|
+
}
|
57737
|
+
|
57694
57738
|
/**
|
57695
57739
|
* Watching to acquire the transaction submission. (Waits until txn. is applied to the ledger.)
|
57696
57740
|
* @param {string} txHash Transaction Hash
|
@@ -57764,12 +57808,13 @@ class XrplApi {
|
|
57764
57808
|
/**
|
57765
57809
|
* Submit a multi-signature transaction and wait for validation.
|
57766
57810
|
* @param {object} tx Multi-signed transaction object.
|
57811
|
+
* @param {object} submissionRef [Optional] Reference object to take submission references.
|
57767
57812
|
* @returns response object of the validated transaction.
|
57768
57813
|
*/
|
57769
|
-
async submitMultisignedAndWait(tx) {
|
57814
|
+
async submitMultisignedAndWait(tx, submissionRef = {}) {
|
57770
57815
|
tx.SigningPubKey = "";
|
57771
|
-
|
57772
|
-
return await this.#prepareResponse(tx, submissionResult);
|
57816
|
+
submissionRef.submissionResult = await this.#handleClientRequest({ command: 'submit_multisigned', tx_json: tx });
|
57817
|
+
return await this.#prepareResponse(tx, submissionRef.submissionResult);
|
57773
57818
|
}
|
57774
57819
|
|
57775
57820
|
/**
|
@@ -57785,11 +57830,12 @@ class XrplApi {
|
|
57785
57830
|
/**
|
57786
57831
|
* Submit a single-signature transaction.
|
57787
57832
|
* @param {string} tx_blob Signed transaction object.
|
57833
|
+
* @param {object} submissionRef [Optional] Reference object to take submission references.
|
57788
57834
|
* @returns response object of the validated transaction.
|
57789
57835
|
*/
|
57790
|
-
async submitAndWait(tx, tx_blob) {
|
57791
|
-
|
57792
|
-
return await this.#prepareResponse(tx, submissionResult);
|
57836
|
+
async submitAndWait(tx, tx_blob, submissionRef = {}) {
|
57837
|
+
submissionRef.submissionResult = await this.#handleClientRequest({ command: 'submit', tx_blob: tx_blob });
|
57838
|
+
return await this.#prepareResponse(tx, submissionRef.submissionResult);
|
57793
57839
|
}
|
57794
57840
|
|
57795
57841
|
/**
|
package/package.json
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
],
|
7
7
|
"homepage": "https://github.com/HotPocketDev/evernode-js-client",
|
8
8
|
"license": "SEE LICENSE IN https://raw.githubusercontent.com/EvernodeXRPL/evernode-resources/main/license/evernode-license.pdf",
|
9
|
-
"version": "0.6.
|
9
|
+
"version": "0.6.37",
|
10
10
|
"dependencies": {
|
11
11
|
"elliptic": "6.5.4",
|
12
12
|
"libsodium-wrappers": "0.7.10",
|