@atomiqlabs/chain-solana 7.3.3 → 7.3.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.
|
@@ -430,19 +430,15 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
430
430
|
*/
|
|
431
431
|
estimateSynchronizeFee(requiredBlockheight, feeRate) {
|
|
432
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
// " blockheight delta: "+blockheightDelta+" fee: "+synchronizationFee.toString(10));
|
|
443
|
-
//
|
|
444
|
-
// return synchronizationFee;
|
|
445
|
-
return new BN(5000000);
|
|
433
|
+
const tipData = yield this.getTipData();
|
|
434
|
+
const currBlockheight = tipData.blockheight;
|
|
435
|
+
const blockheightDelta = requiredBlockheight - currBlockheight;
|
|
436
|
+
if (blockheightDelta <= 0)
|
|
437
|
+
return new BN(0);
|
|
438
|
+
const synchronizationFee = new BN(blockheightDelta).mul(yield this.getFeePerBlock(feeRate));
|
|
439
|
+
this.logger.debug("estimateSynchronizeFee(): required blockheight: " + requiredBlockheight +
|
|
440
|
+
" blockheight delta: " + blockheightDelta + " fee: " + synchronizationFee.toString(10));
|
|
441
|
+
return synchronizationFee;
|
|
446
442
|
});
|
|
447
443
|
}
|
|
448
444
|
/**
|
|
@@ -452,8 +448,9 @@ class SolanaBtcRelay extends SolanaProgramBase_1.SolanaProgramBase {
|
|
|
452
448
|
*/
|
|
453
449
|
getFeePerBlock(feeRate) {
|
|
454
450
|
return __awaiter(this, void 0, void 0, function* () {
|
|
455
|
-
feeRate = feeRate ||
|
|
456
|
-
return BASE_FEE_SOL_PER_BLOCKHEADER.add(this.Fees.getPriorityFee(200000, feeRate, false));
|
|
451
|
+
// feeRate = feeRate || await this.getMainFeeRate(null);
|
|
452
|
+
// return BASE_FEE_SOL_PER_BLOCKHEADER.add(this.Fees.getPriorityFee(200000, feeRate, false));
|
|
453
|
+
return new BN(50000);
|
|
457
454
|
});
|
|
458
455
|
}
|
|
459
456
|
/**
|
package/package.json
CHANGED
|
@@ -541,19 +541,18 @@ export class SolanaBtcRelay<B extends BtcBlock> extends SolanaProgramBase<any> i
|
|
|
541
541
|
* @param feeRate
|
|
542
542
|
*/
|
|
543
543
|
public async estimateSynchronizeFee(requiredBlockheight: number, feeRate?: string): Promise<BN> {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return new BN(5000000);
|
|
544
|
+
const tipData = await this.getTipData();
|
|
545
|
+
const currBlockheight = tipData.blockheight;
|
|
546
|
+
|
|
547
|
+
const blockheightDelta = requiredBlockheight-currBlockheight;
|
|
548
|
+
|
|
549
|
+
if(blockheightDelta<=0) return new BN(0);
|
|
550
|
+
|
|
551
|
+
const synchronizationFee = new BN(blockheightDelta).mul(await this.getFeePerBlock(feeRate));
|
|
552
|
+
this.logger.debug("estimateSynchronizeFee(): required blockheight: "+requiredBlockheight+
|
|
553
|
+
" blockheight delta: "+blockheightDelta+" fee: "+synchronizationFee.toString(10));
|
|
554
|
+
|
|
555
|
+
return synchronizationFee;
|
|
557
556
|
}
|
|
558
557
|
|
|
559
558
|
/**
|
|
@@ -562,8 +561,9 @@ export class SolanaBtcRelay<B extends BtcBlock> extends SolanaProgramBase<any> i
|
|
|
562
561
|
* @param feeRate
|
|
563
562
|
*/
|
|
564
563
|
public async getFeePerBlock(feeRate?: string): Promise<BN> {
|
|
565
|
-
feeRate = feeRate || await this.getMainFeeRate(null);
|
|
566
|
-
return BASE_FEE_SOL_PER_BLOCKHEADER.add(this.Fees.getPriorityFee(200000, feeRate, false));
|
|
564
|
+
// feeRate = feeRate || await this.getMainFeeRate(null);
|
|
565
|
+
// return BASE_FEE_SOL_PER_BLOCKHEADER.add(this.Fees.getPriorityFee(200000, feeRate, false));
|
|
566
|
+
return new BN(50000);
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
/**
|