@clonegod/ttd-bsc-common 3.0.25 → 3.0.27

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/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from './types';
6
6
  export * from './utils';
7
7
  export * from './redis';
8
8
  export * from './ws';
9
+ export * from './send-tx';
package/dist/index.js CHANGED
@@ -22,3 +22,4 @@ __exportStar(require("./types"), exports);
22
22
  __exportStar(require("./utils"), exports);
23
23
  __exportStar(require("./redis"), exports);
24
24
  __exportStar(require("./ws"), exports);
25
+ __exportStar(require("./send-tx"), exports);
@@ -0,0 +1,5 @@
1
+ export declare enum BSC_EOA_ADDRESS {
2
+ BLOCKRAZOR = "0x1266C6bE60392A8Ff346E8d5ECCd3E69dD9c5F20",
3
+ _48CLUB = "0x4848489f0b2BEdd788c696e2D79b6b69D7484848",
4
+ BLXR = "0x74c5F8C6ffe41AD4789602BDB9a48E6Cad623520"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BSC_EOA_ADDRESS = void 0;
4
+ var BSC_EOA_ADDRESS;
5
+ (function (BSC_EOA_ADDRESS) {
6
+ BSC_EOA_ADDRESS["BLOCKRAZOR"] = "0x1266C6bE60392A8Ff346E8d5ECCd3E69dD9c5F20";
7
+ BSC_EOA_ADDRESS["_48CLUB"] = "0x4848489f0b2BEdd788c696e2D79b6b69D7484848";
8
+ BSC_EOA_ADDRESS["BLXR"] = "0x74c5F8C6ffe41AD4789602BDB9a48E6Cad623520";
9
+ })(BSC_EOA_ADDRESS || (exports.BSC_EOA_ADDRESS = BSC_EOA_ADDRESS = {}));
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './constants';
@@ -0,0 +1,18 @@
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("./types"), exports);
18
+ __exportStar(require("./constants"), exports);
@@ -0,0 +1,3 @@
1
+ export interface ITransactionSender {
2
+ sendTransaction(signedMainTx: string, eoa_tip_transaction: (eoa_address: string) => Promise<string>, order_trace_id: string, pair?: string, only_bundle?: boolean): Promise<string[]>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@ import { AbastrcatTrade, AppConfig, TradeContext } from '@clonegod/ttd-core';
2
2
  import { ethers } from "ethers";
3
3
  import { EvmChainConfig } from "../types";
4
4
  import { CallerManager } from "./caller_manager";
5
- import { TransactionSender } from "@clonegod/ttd-bsc-send-tx";
5
+ import { ITransactionSender } from "../send-tx";
6
6
  import { SimpleRedisClient } from "../redis";
7
7
  export interface TradeConfig {
8
8
  vaultAddress: string;
@@ -17,7 +17,7 @@ export declare abstract class AbstractDexTrade extends AbastrcatTrade {
17
17
  protected appConfig: AppConfig;
18
18
  protected callerManager: CallerManager;
19
19
  protected provider: any;
20
- protected transactionSender: TransactionSender;
20
+ protected transactionSender: ITransactionSender;
21
21
  protected chainConfig: EvmChainConfig;
22
22
  protected redisClient: SimpleRedisClient;
23
23
  protected tradeConfig: TradeConfig;
@@ -26,7 +26,7 @@ export declare abstract class AbstractDexTrade extends AbastrcatTrade {
26
26
  constructor(appConfig: AppConfig);
27
27
  protected abstract initConfigs(): void;
28
28
  abstract encodeTradeData(context: TradeContext): TradeCalldata;
29
- init(): Promise<void>;
29
+ init(transactionSender?: ITransactionSender): Promise<void>;
30
30
  execute(context: TradeContext): Promise<string>;
31
31
  protected getGasPriceGwei(context: TradeContext): string;
32
32
  protected getBuilderTipAmoutGwei(context: TradeContext): string;
@@ -16,7 +16,7 @@ exports.AbstractDexTrade = void 0;
16
16
  exports.buildTradeConfig = buildTradeConfig;
17
17
  const ttd_core_1 = require("@clonegod/ttd-core");
18
18
  const caller_manager_1 = require("./caller_manager");
19
- const ttd_bsc_send_tx_1 = require("@clonegod/ttd-bsc-send-tx");
19
+ const send_tx_1 = require("../send-tx");
20
20
  const redis_1 = require("../redis");
21
21
  const trade_direction_1 = require("../utils/trade_direction");
22
22
  const ethers_compat_1 = require("../utils/ethers_compat");
@@ -52,10 +52,12 @@ class AbstractDexTrade extends ttd_core_1.AbastrcatTrade {
52
52
  this.redisClient = new redis_1.SimpleRedisClient(`${this.chainNameLower}:tx`);
53
53
  this.vaultInterface = new ethers_compat_1.ethersCompat.Interface(VAULT_ABI);
54
54
  }
55
- init() {
55
+ init(transactionSender) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
57
  this.provider = new ethers_compat_1.ethersCompat.JsonRpcProvider(this.chainConfig.rpcEndpoint);
58
- this.transactionSender = new ttd_bsc_send_tx_1.TransactionSender(this.appConfig);
58
+ if (transactionSender) {
59
+ this.transactionSender = transactionSender;
60
+ }
59
61
  const defaultCallerId = `${this.chainNameLower.toUpperCase()}-CALLER`;
60
62
  const callerGroupIds = (process.env.CALLER_GROUP_IDS || defaultCallerId).trim().split(',').filter(Boolean);
61
63
  this.callerManager = new caller_manager_1.CallerManager({
@@ -122,9 +124,9 @@ class AbstractDexTrade extends ttd_core_1.AbastrcatTrade {
122
124
  value: 0,
123
125
  };
124
126
  const builderAddresses = [
125
- ttd_bsc_send_tx_1.BSC_EOA_ADDRESS.BLOCKRAZOR,
126
- ttd_bsc_send_tx_1.BSC_EOA_ADDRESS._48CLUB,
127
- ttd_bsc_send_tx_1.BSC_EOA_ADDRESS.BLXR,
127
+ send_tx_1.BSC_EOA_ADDRESS.BLOCKRAZOR,
128
+ send_tx_1.BSC_EOA_ADDRESS._48CLUB,
129
+ send_tx_1.BSC_EOA_ADDRESS.BLXR,
128
130
  ];
129
131
  const [rawMainTx, ...rawTips] = yield Promise.all([
130
132
  caller.signTransaction(mainTx),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "3.0.25",
3
+ "version": "3.0.27",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,6 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@clonegod/ttd-core": "3.0.8",
18
- "@clonegod/ttd-bsc-send-tx": "1.0.0",
19
18
  "axios": "^1.12.0",
20
19
  "dotenv": "^16.4.7",
21
20
  "ethers": "^5.8.0"