@clonegod/ttd-bsc-common 3.1.59 → 3.1.61

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.
@@ -14,6 +14,7 @@ export interface CheckSwapParams {
14
14
  tokenB: any;
15
15
  quote_token: string;
16
16
  };
17
+ swapperDeltaConvention?: boolean;
17
18
  }
18
19
  export interface CheckSyncParams {
19
20
  poolAddress: string;
@@ -46,8 +46,9 @@ class QuotePriceVerify {
46
46
  if (cached.verifiedReferenceBlock === cached.referenceBlock)
47
47
  return;
48
48
  cached.verifiedReferenceBlock = cached.referenceBlock;
49
- const amt0 = BigInt(amount0);
50
- const amt1 = BigInt(amount1);
49
+ const sign = params.swapperDeltaConvention ? -1n : 1n;
50
+ const amt0 = BigInt(amount0) * sign;
51
+ const amt1 = BigInt(amount1) * sign;
51
52
  if (amt0 === 0n && amt1 === 0n)
52
53
  return;
53
54
  let inputTokenAddress;
@@ -138,9 +139,8 @@ class QuotePriceVerify {
138
139
  const absDiffBps = Math.abs(diffBps);
139
140
  const status = absDiffBps < 10 ? '✅' : absDiffBps < 30 ? '⚠️' : '❌';
140
141
  const usdStr = swapUsd > 0 ? `$${swapUsd.toFixed(0)}` : '$?';
141
- const minUsd = cached.quoteAmountUsd * 0.5;
142
142
  const maxUsd = cached.quoteAmountUsd * 2;
143
- const inRange = swapUsd <= 0 || (swapUsd >= minUsd && swapUsd <= maxUsd);
143
+ const inRange = swapUsd <= 0 || swapUsd <= maxUsd;
144
144
  const rangeTag = inRange ? '' : ' [out]';
145
145
  const tradeFlow = isBuy
146
146
  ? `${inputAmountUi.toFixed(4)} ${quoteToken.symbol} -> ${outputAmountUi.toFixed(4)} ${baseToken.symbol}`
@@ -158,6 +158,8 @@ class QuotePriceVerify {
158
158
  pool_address: poolAddress,
159
159
  pool_name: poolName,
160
160
  price_id: cached.priceId,
161
+ source: cached.source,
162
+ quote_amount_usd: cached.quoteAmountUsd,
161
163
  quote_block: cached.referenceBlock,
162
164
  swap_block: swapBlockNumber,
163
165
  tx_hash: txHash || '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "3.1.59",
3
+ "version": "3.1.61",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",