@clonegod/ttd-sol-common 1.0.95 → 1.0.98

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.
@@ -7,5 +7,6 @@ export declare enum COMMITMENT_LEVEL {
7
7
  }
8
8
  export declare enum LOCAL_EVENT_NAME {
9
9
  EVENT_POOL_ACCOUNT_CHANGE = "EVENT_POOL_ACCOUNT_CHANGE",
10
- EVENT_WALLET_TRANSACTION = "EVENT_WALLET_TRANSACTION"
10
+ EVENT_WALLET_TRANSACTION = "EVENT_WALLET_TRANSACTION",
11
+ EVENT_WALLET_TRANSACTION_NEW_TXID = "EVENT_WALLET_TRANSACTION_NEW_TXID"
11
12
  }
@@ -14,4 +14,5 @@ var LOCAL_EVENT_NAME;
14
14
  (function (LOCAL_EVENT_NAME) {
15
15
  LOCAL_EVENT_NAME["EVENT_POOL_ACCOUNT_CHANGE"] = "EVENT_POOL_ACCOUNT_CHANGE";
16
16
  LOCAL_EVENT_NAME["EVENT_WALLET_TRANSACTION"] = "EVENT_WALLET_TRANSACTION";
17
+ LOCAL_EVENT_NAME["EVENT_WALLET_TRANSACTION_NEW_TXID"] = "EVENT_WALLET_TRANSACTION_NEW_TXID";
17
18
  })(LOCAL_EVENT_NAME || (exports.LOCAL_EVENT_NAME = LOCAL_EVENT_NAME = {}));
@@ -27,7 +27,10 @@ const subscribe_wallet_transaction_txid = (geyser_ws_url, wallet_address, signat
27
27
  }
28
28
  var ws_client = new ws_1.default(geyser_ws_url);
29
29
  function subscribe_transaction_by_txid() {
30
- (0, dist_1.log_info)(`subscribe_transaction_by_txid`, signature);
30
+ (0, dist_1.log_info)(`subscribe_transaction_by_txid`, {
31
+ wallet_address,
32
+ signature
33
+ });
31
34
  const request = {
32
35
  jsonrpc: '2.0',
33
36
  id: 420,
@@ -48,6 +51,10 @@ const subscribe_wallet_transaction_txid = (geyser_ws_url, wallet_address, signat
48
51
  };
49
52
  ws_client.send(JSON.stringify(request));
50
53
  }
54
+ setTimeout(() => {
55
+ ws_client.close();
56
+ (0, dist_1.log_debug)('subscribe_transaction_by_txid, close helius ws conn');
57
+ }, 30000);
51
58
  function startPing(ws) {
52
59
  setInterval(() => {
53
60
  if (ws.readyState === ws_1.default.OPEN) {
@@ -19,6 +19,7 @@ const axios_1 = __importDefault(require("axios"));
19
19
  const types_1 = require("./types");
20
20
  const get_signature_1 = require("../send_tx/get_signature");
21
21
  const dist_1 = require("@clonegod/ttd-common/dist");
22
+ const common_1 = require("../common");
22
23
  class RpcClient {
23
24
  constructor(connection, id) {
24
25
  this.connection = connection;
@@ -696,6 +697,9 @@ class RpcClient {
696
697
  }
697
698
  const { transaction, blockhash } = yield this.createSmartTransactionWithTip(solana_trade_runtime, instructions, signers, lookupTables, tipAmount, feePayer);
698
699
  let txid = (0, get_signature_1.getSignature)(transaction);
700
+ if (global.event_emitter) {
701
+ global.event_emitter.emit(common_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION_NEW_TXID, txid);
702
+ }
699
703
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
700
704
  const serializedTransaction = bs58_1.default.encode(transaction.serialize());
701
705
  let jitoApiUrl = `${types_1.JITO_API_URLS[region]}/api/v1/transactions?bundleOnly=true`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.95",
3
+ "version": "1.0.98",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",