@clonegod/ttd-sol-common 2.0.38 → 2.0.39
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/dist/common/subscribe_account_update.js +1 -1
- package/dist/config/SolanaTradeAppConfig.d.ts +8 -0
- package/dist/config/SolanaTradeAppConfig.js +26 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +17 -0
- package/dist/trade/index.d.ts +1 -1
- package/dist/trade/index.js +1 -1
- package/dist/trade/tx_builder.d.ts +1 -1
- package/package.json +1 -1
- package/src/common/subscribe_account_update.ts +1 -1
- package/src/{trade → config}/SolanaTradeAppConfig.ts +1 -1
- package/src/config/index.ts +2 -0
- package/src/trade/index.ts +1 -1
- package/src/trade/tx_builder.ts +1 -1
|
@@ -13,7 +13,7 @@ function subscribe_pool_account_update(dex_id, pool_list, callback) {
|
|
|
13
13
|
});
|
|
14
14
|
ws_client.onMessage(((eventData) => {
|
|
15
15
|
if (!eventData.data) {
|
|
16
|
-
(0, dist_1.log_warn)(`
|
|
16
|
+
(0, dist_1.log_warn)(`subscribe_pool_account_update: no data`, eventData);
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
callback(eventData);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AbstractTradeAppConfig } from "@clonegod/ttd-core/dist";
|
|
2
|
+
import { Connection, Keypair } from "@solana/web3.js";
|
|
3
|
+
export declare class SolanaTradeAppConfig extends AbstractTradeAppConfig {
|
|
4
|
+
connection: Connection;
|
|
5
|
+
keypair: Keypair;
|
|
6
|
+
constructor();
|
|
7
|
+
subscribe_wallet_raw_txn_event(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaTradeAppConfig = void 0;
|
|
4
|
+
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
5
|
+
class SolanaTradeAppConfig extends dist_1.AbstractTradeAppConfig {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.subscribe_wallet_raw_txn_event();
|
|
9
|
+
}
|
|
10
|
+
subscribe_wallet_raw_txn_event() {
|
|
11
|
+
const transactionHandler = async (messageStr) => {
|
|
12
|
+
let messageObj = messageStr;
|
|
13
|
+
if (typeof messageStr === 'string') {
|
|
14
|
+
messageObj = JSON.parse(messageStr);
|
|
15
|
+
}
|
|
16
|
+
const tx_id = messageObj.transaction.signature;
|
|
17
|
+
(0, dist_1.log_info)(`Received transaction result via WebSocket: ${tx_id}`);
|
|
18
|
+
this.emit(dist_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + tx_id, messageObj);
|
|
19
|
+
};
|
|
20
|
+
const ws_port = process.env.STREAM_WS_TRADE_PORT || 10002;
|
|
21
|
+
const ws = new dist_1.WebSocketClient(`ws://localhost:${ws_port}`);
|
|
22
|
+
ws.onMessage(transactionHandler);
|
|
23
|
+
ws.connect();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.SolanaTradeAppConfig = SolanaTradeAppConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SolanaTradeAppConfig';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SolanaTradeAppConfig"), exports);
|
package/dist/trade/index.d.ts
CHANGED
package/dist/trade/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./tx_result_check"), exports);
|
|
18
18
|
__exportStar(require("./tx_result_parse"), exports);
|
|
19
|
-
__exportStar(require("
|
|
19
|
+
__exportStar(require("../config/SolanaTradeAppConfig"), exports);
|
|
20
20
|
__exportStar(require("./tx_builder"), exports);
|
|
21
21
|
__exportStar(require("./send"), exports);
|
|
22
22
|
__exportStar(require("./jito_tip_wallets"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TradeContext } from "@clonegod/ttd-core/dist";
|
|
2
2
|
import { Connection, Keypair, Transaction, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
-
import { SolanaTradeAppConfig } from "
|
|
3
|
+
import { SolanaTradeAppConfig } from "../config/SolanaTradeAppConfig";
|
|
4
4
|
import { JitoTipWalletManager } from "./jito_tip_wallets";
|
|
5
5
|
export declare class SolTransactionBuilder {
|
|
6
6
|
appConfig: SolanaTradeAppConfig;
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export function subscribe_pool_account_update(dex_id: DEX_ID, pool_list: Standar
|
|
|
18
18
|
})
|
|
19
19
|
ws_client.onMessage(((eventData: SolanaPoolAccountUpdateEventData): void => {
|
|
20
20
|
if (!eventData.data) {
|
|
21
|
-
log_warn(`
|
|
21
|
+
log_warn(`subscribe_pool_account_update: no data`, eventData);
|
|
22
22
|
} else {
|
|
23
23
|
callback(eventData);
|
|
24
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractTradeAppConfig,
|
|
1
|
+
import { AbstractTradeAppConfig, LOCAL_EVENT_NAME, log_info, WebSocketClient } from "@clonegod/ttd-core/dist";
|
|
2
2
|
import { Connection, Keypair } from "@solana/web3.js";
|
|
3
3
|
|
|
4
4
|
export class SolanaTradeAppConfig extends AbstractTradeAppConfig {
|
package/src/trade/index.ts
CHANGED
package/src/trade/tx_builder.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CHAIN_ID, TradeContext } from "@clonegod/ttd-core/dist";
|
|
|
2
2
|
import { ComputeBudgetProgram, Connection, Keypair, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, TransactionInstruction } from "@solana/web3.js";
|
|
3
3
|
import { LAMPORTS_PER_MICRO_LAMPORTS } from "../common";
|
|
4
4
|
import { SolanaBlockMetaUpdateEvent } from "../types";
|
|
5
|
-
import { SolanaTradeAppConfig } from "
|
|
5
|
+
import { SolanaTradeAppConfig } from "../config/SolanaTradeAppConfig";
|
|
6
6
|
import { HELIUS_TIP_ACCOUNTS } from "./send/helius";
|
|
7
7
|
import { getJitoTipAccount } from "./send/jito";
|
|
8
8
|
import { JitoTipWalletManager } from "./jito_tip_wallets";
|