@runesx/api-client 0.5.1 → 0.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runesx/api-client",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "A Node.js client for interacting with the RunesX platform API and WebSocket",
5
5
  "main": "src/index.mjs",
6
6
  "type": "module",
package/src/index.mjs CHANGED
@@ -154,8 +154,12 @@ export function createRunesXClient(options = {}) {
154
154
  deleteYardMessage: api.deleteYardMessage,
155
155
 
156
156
  // ---- Client-side estimation utilities ----
157
- estimateSwap: (inputCoin, outputCoin, amountIn, maxHops = 6, algorithm = 'dfs') =>
158
- estimateSwap(inputCoin, outputCoin, amountIn, getPools(), getCoins(), maxHops, algorithm, getAllOrderBooks(), getUserOrders(), getClobFees(), getMarketByCoinKey()),
157
+ // skipSelfTradeCheck: pass true when estimating on behalf of a different user
158
+ // (e.g. tipbot swaps) the API key user's CLOB orders would incorrectly
159
+ // trigger self-trade prevention against bids/asks that the actual swap user
160
+ // (a Discord user with no CLOB orders) would freely fill.
161
+ estimateSwap: (inputCoin, outputCoin, amountIn, maxHops = 6, algorithm = 'dfs', { skipSelfTradeCheck = false } = {}) =>
162
+ estimateSwap(inputCoin, outputCoin, amountIn, getPools(), getCoins(), maxHops, algorithm, getAllOrderBooks(), skipSelfTradeCheck ? null : getUserOrders(), getClobFees(), getMarketByCoinKey()),
159
163
  estimateLiquidityFrontend,
160
164
  estimateDepositShares: ({ pool, amountA, amountB, slippagePercent } = {}) =>
161
165
  estimateDepositShares({ pool, amountA, amountB, slippagePercent }),
@@ -17,6 +17,8 @@ const setInitialCoins = (coins) => {
17
17
  projectName: coin.projectName,
18
18
  status: coin.status,
19
19
  runesComplianceRequirement: coin.runesComplianceRequirement || false,
20
+ swapMinimumInput: coin.swapMinimumInput,
21
+ tradeMinimumInput: coin.tradeMinimumInput,
20
22
  updatedAt: coin.updatedAt,
21
23
  CoinChains: coin.CoinChains || [],
22
24
  });
@@ -54,6 +56,8 @@ const updateCoin = (coin) => {
54
56
  projectName: coin.projectName,
55
57
  status: coin.status,
56
58
  runesComplianceRequirement: coin.runesComplianceRequirement || false,
59
+ swapMinimumInput: coin.swapMinimumInput !== undefined ? coin.swapMinimumInput : existingCoin.swapMinimumInput,
60
+ tradeMinimumInput: coin.tradeMinimumInput !== undefined ? coin.tradeMinimumInput : existingCoin.tradeMinimumInput,
57
61
  updatedAt: coin.updatedAt,
58
62
  CoinChains: coin.CoinChains || existingCoin.CoinChains,
59
63
  });
@@ -65,6 +69,8 @@ const updateCoin = (coin) => {
65
69
  projectName: coin.projectName,
66
70
  status: coin.status,
67
71
  runesComplianceRequirement: coin.runesComplianceRequirement || false,
72
+ swapMinimumInput: coin.swapMinimumInput,
73
+ tradeMinimumInput: coin.tradeMinimumInput,
68
74
  updatedAt: coin.updatedAt,
69
75
  CoinChains: coin.CoinChains || [],
70
76
  });
@@ -8,11 +8,13 @@ const exchangeConfigStore = {
8
8
  makerFeeRate: '0.001',
9
9
  maxFillBatch: 50,
10
10
  maxFillTotal: 500,
11
+ maxPriceDeviation: '5',
12
+ tickerPattern: null,
11
13
  },
12
14
  };
13
15
 
14
16
  const setExchangeConfig = (config) => {
15
- const { clobFees } = config;
17
+ const { clobFees, tickerPattern } = config;
16
18
  if (clobFees) {
17
19
  if (clobFees.takerFeeRate !== null && clobFees.takerFeeRate !== undefined) {
18
20
  exchangeConfigStore.clobFees.takerFeeRate = clobFees.takerFeeRate;
@@ -26,6 +28,15 @@ const setExchangeConfig = (config) => {
26
28
  if (clobFees.maxFillTotal !== null && clobFees.maxFillTotal !== undefined) {
27
29
  exchangeConfigStore.clobFees.maxFillTotal = clobFees.maxFillTotal;
28
30
  }
31
+ if (clobFees.maxPriceDeviation !== null && clobFees.maxPriceDeviation !== undefined) {
32
+ exchangeConfigStore.clobFees.maxPriceDeviation = clobFees.maxPriceDeviation;
33
+ }
34
+ }
35
+ // tickerPattern is at the top level of the config, not inside clobFees.
36
+ // Merge it into clobFees so swapUtils.deriveClobPairAndSide can access it
37
+ // via clobFees.tickerPattern — matching how runesx-app passes it.
38
+ if (typeof tickerPattern === 'string' && tickerPattern.length <= 100) {
39
+ exchangeConfigStore.clobFees.tickerPattern = tickerPattern;
29
40
  }
30
41
  };
31
42
 
@@ -37,6 +48,8 @@ const resetExchangeConfig = () => {
37
48
  makerFeeRate: '0.001',
38
49
  maxFillBatch: 50,
39
50
  maxFillTotal: 500,
51
+ maxPriceDeviation: '5',
52
+ tickerPattern: null,
40
53
  };
41
54
  };
42
55