@clonegod/ttd-sol-common 1.0.18 → 1.0.20

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.
@@ -14,12 +14,14 @@ const dist_1 = require("@clonegod/ttd-common/dist");
14
14
  const web3_js_1 = require("@solana/web3.js");
15
15
  const constants_1 = require("./constants");
16
16
  const helius_sdk_v1_4_0_1 = require("./helius_sdk_v1.4.0");
17
+ const context_1 = require("./context");
17
18
  class HeliusClient {
18
19
  constructor(signers) {
19
20
  this.cluster = 'mainnet-beta';
20
21
  let helius_api_key = process.env.HELIUS_API_KEY;
21
22
  let helius_mainnet_endpoint = `https://mainnet.helius-rpc.com/?api-key=${helius_api_key}`;
22
23
  let helius_staked_endpoint = `https://staked.helius-rpc.com?api-key=${helius_api_key}`;
24
+ this._context = new context_1._Context();
23
25
  this._context.set_read_connection(new web3_js_1.Connection(process.env.QUICKNODE_ENDPOINT, {
24
26
  commitment: constants_1.COMMITMENT_LEVEL.CONFIRMED
25
27
  }));
@@ -38,9 +40,16 @@ class HeliusClient {
38
40
  let { broadcast_type, speed } = trade_strategy;
39
41
  let gas_fee = this.get_gas_fee(trade_strategy);
40
42
  let cu_limit = 70000;
43
+ let cu_price = Math.floor(gas_fee / cu_limit);
41
44
  this._context.set_priority_fee(gas_fee);
42
45
  this._context.set_cu_limit(cu_limit);
43
- this._context.set_cu_price(gas_fee / cu_limit);
46
+ this._context.set_cu_price(cu_price);
47
+ (0, dist_1.log_info)(`trade_strategy & gas`, {
48
+ trade_strategy,
49
+ gas_fee,
50
+ cu_limit,
51
+ cu_price
52
+ });
44
53
  if (broadcast_type === 'rpc') {
45
54
  let use_staked_endpint = speed === 'turbo' || speed === 'ultra';
46
55
  txid = yield this.send_smart_transaction(instructions, use_staked_endpint);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",