@cryptorubic/web3 0.8.17-alpha.solana.16 → 0.8.17-alpha.solana.17
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/package.json
CHANGED
|
@@ -95,8 +95,8 @@ class SolanaGasService {
|
|
|
95
95
|
return { success: true, cuLimit: new bignumber_js_1.default(simulationResp.value.unitsConsumed), idx };
|
|
96
96
|
};
|
|
97
97
|
const recentFees = await this.connection.getRecentPrioritizationFees();
|
|
98
|
-
const
|
|
99
|
-
const lastBlocksSlots = await this.connection.getBlocks(
|
|
98
|
+
const lastTenTxFees = recentFees.slice(recentFees.length - 10);
|
|
99
|
+
const lastBlocksSlots = await this.connection.getBlocks(lastTenTxFees[0].slot);
|
|
100
100
|
const lastBlocksSigs = await Promise.all(lastBlocksSlots.map((slot) => this.connection.getBlockSignatures(slot, 'confirmed')));
|
|
101
101
|
const flattenSigs = lastBlocksSigs.flatMap((b) => b.signatures);
|
|
102
102
|
const lastTxs = await this.connection.getTransactions(flattenSigs, { commitment: 'confirmed', maxSupportedTransactionVersion: 0 });
|
|
@@ -106,7 +106,7 @@ class SolanaGasService {
|
|
|
106
106
|
const lastCuLimits = await Promise.all(serializedTxs.map((tx, idx) => estimateCULimitForTx(tx, idx)));
|
|
107
107
|
const successCuLimits = lastCuLimits.filter((obj) => obj.success);
|
|
108
108
|
const avgCuPrice = successCuLimits.reduce((acc, cuLimitInfo) => {
|
|
109
|
-
const cuPrice = new bignumber_js_1.default(
|
|
109
|
+
const cuPrice = new bignumber_js_1.default(lastTenTxFees[cuLimitInfo.idx].prioritizationFee)
|
|
110
110
|
.multipliedBy(1_000_000)
|
|
111
111
|
.div(cuLimitInfo.cuLimit);
|
|
112
112
|
return cuPrice.gt(acc) ? cuPrice : acc;
|