@clonegod/ttd-bsc-common 1.0.45 → 1.0.46

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.
@@ -0,0 +1,8 @@
1
+ export declare class BlxrTrade {
2
+ private wsUrl;
3
+ private authToken;
4
+ private ws;
5
+ constructor();
6
+ init(): void;
7
+ sendTransaction(pair: string, mainTx: string, tipTx: string, blockNumber?: number): void;
8
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BlxrTrade = void 0;
4
+ const dist_1 = require("@clonegod/ttd-core/dist");
5
+ class BlxrTrade {
6
+ constructor() {
7
+ this.wsUrl = process.env.BLOX_SEND_TX_WS_ENDPOINT || 'ws://127.0.0.1:7002/bsc/send_tx';
8
+ this.authToken = process.env.BLOX_AUTH_KEY || '';
9
+ this.init();
10
+ }
11
+ init() {
12
+ this.ws = new dist_1.WebSocketClient(this.wsUrl);
13
+ this.ws.onOpen(() => {
14
+ console.log('Blxr ws proxy connected:', this.wsUrl);
15
+ });
16
+ this.ws.onMessage((message) => {
17
+ console.log('Blxr ws proxy received message', message);
18
+ });
19
+ this.ws.connect();
20
+ }
21
+ sendTransaction(pair, mainTx, tipTx, blockNumber = 0) {
22
+ this.ws.send(JSON.stringify({
23
+ pair,
24
+ mainTx,
25
+ tipTx,
26
+ blockNumber
27
+ }));
28
+ }
29
+ }
30
+ exports.BlxrTrade = BlxrTrade;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",