@clonegod/ttd-bsc-common 3.0.19 → 3.0.21

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.
@@ -16,7 +16,7 @@ export interface TradeCalldata {
16
16
  export declare abstract class AbstractDexTrade extends AbastrcatTrade {
17
17
  protected appConfig: AppConfig;
18
18
  protected callerManager: CallerManager;
19
- protected provider: ethers.providers.JsonRpcProvider;
19
+ protected provider: any;
20
20
  protected transactionSender: TransactionSender;
21
21
  protected chainConfig: EvmChainConfig;
22
22
  protected redisClient: SimpleRedisClient;
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
- var _a, _b, _c, _d, _e;
14
+ var _a, _b, _c, _d, _e, _f;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.AbstractDexTrade = void 0;
17
17
  exports.buildTradeConfig = buildTradeConfig;
@@ -24,10 +24,11 @@ const trade_direction_1 = require("../utils/trade_direction");
24
24
  const decimal_js_1 = __importDefault(require("decimal.js"));
25
25
  const ethersCompat = {
26
26
  Interface: ((_a = ethers_1.ethers.utils) === null || _a === void 0 ? void 0 : _a.Interface) || ethers_1.ethers.Interface,
27
- id: ((_b = ethers_1.ethers.utils) === null || _b === void 0 ? void 0 : _b.id) || ethers_1.ethers.id,
28
- formatUnits: ((_c = ethers_1.ethers.utils) === null || _c === void 0 ? void 0 : _c.formatUnits) || ethers_1.ethers.formatUnits,
29
- parseUnits: ((_d = ethers_1.ethers.utils) === null || _d === void 0 ? void 0 : _d.parseUnits) || ethers_1.ethers.parseUnits,
30
- keccak256: ((_e = ethers_1.ethers.utils) === null || _e === void 0 ? void 0 : _e.keccak256) || ethers_1.ethers.keccak256,
27
+ JsonRpcProvider: ((_b = ethers_1.ethers.providers) === null || _b === void 0 ? void 0 : _b.JsonRpcProvider) || ethers_1.ethers.JsonRpcProvider,
28
+ id: ((_c = ethers_1.ethers.utils) === null || _c === void 0 ? void 0 : _c.id) || ethers_1.ethers.id,
29
+ formatUnits: ((_d = ethers_1.ethers.utils) === null || _d === void 0 ? void 0 : _d.formatUnits) || ethers_1.ethers.formatUnits,
30
+ parseUnits: ((_e = ethers_1.ethers.utils) === null || _e === void 0 ? void 0 : _e.parseUnits) || ethers_1.ethers.parseUnits,
31
+ keccak256: ((_f = ethers_1.ethers.utils) === null || _f === void 0 ? void 0 : _f.keccak256) || ethers_1.ethers.keccak256,
31
32
  };
32
33
  function buildTradeConfig() {
33
34
  const vaultGroupId = process.env.TRADE_GROUP_ID || process.env.VAULT_GROUP_ID;
@@ -62,7 +63,7 @@ class AbstractDexTrade extends ttd_core_1.AbastrcatTrade {
62
63
  }
63
64
  init() {
64
65
  return __awaiter(this, void 0, void 0, function* () {
65
- this.provider = new ethers_1.ethers.providers.JsonRpcProvider(this.chainConfig.rpcEndpoint);
66
+ this.provider = new ethersCompat.JsonRpcProvider(this.chainConfig.rpcEndpoint);
66
67
  this.transactionSender = new ttd_bsc_send_tx_1.TransactionSender(this.appConfig);
67
68
  const defaultCallerId = `${this.chainNameLower.toUpperCase()}-CALLER`;
68
69
  const callerGroupIds = (process.env.CALLER_GROUP_IDS || defaultCallerId).trim().split(',').filter(Boolean);
@@ -120,6 +121,7 @@ class AbstractDexTrade extends ttd_core_1.AbastrcatTrade {
120
121
  const transfer_amount_gwei = this.getBuilderTipAmoutGwei(context);
121
122
  context.ui_tip_amount = new decimal_js_1.default(transfer_amount_gwei).div(Math.pow(10, 9)).toNumber();
122
123
  const mainTx = {
124
+ type: 0,
123
125
  to: this.tradeConfig.vaultAddress,
124
126
  data: vaultCalldata,
125
127
  gasLimit: this.chainConfig.gasOptions.gasLimit,
@@ -201,6 +203,7 @@ class AbstractDexTrade extends ttd_core_1.AbastrcatTrade {
201
203
  const real_transfer_amount_gwei = Math.min(Number(transfer_amount_gwei), this.chainConfig.gasOptions.maxTipAmountGwei).toString();
202
204
  const real_gas_price_gwei = Math.min(Number(gas_price_gwei), this.chainConfig.gasOptions.maxGasPriceGwei).toString();
203
205
  const tx_data = {
206
+ type: 0,
204
207
  from: wallet.address,
205
208
  to,
206
209
  value: ethersCompat.parseUnits(real_transfer_amount_gwei, 'gwei'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "3.0.19",
3
+ "version": "3.0.21",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",