100x-sdk 1.0.5 → 1.0.6
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/100x-sdk.cjs.js +77 -30
- package/dist/100x-sdk.esm.js +77 -30
- package/dist/100x-sdk.js +77 -30
- package/dist/100x-sdk.js.map +1 -1
- package/dist/index.d.ts +24 -2
- package/package.json +2 -2
- package/src/modules/simulator/buy_sell_token.js +7 -12
- package/src/modules/simulator/long_shrot_stop.js +30 -10
- package/src/modules/simulator/precision.js +32 -0
- package/src/modules/simulator.js +3 -3
- package/src/types/index.d.ts +24 -2
- package/src/utils/constants.js +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -187,6 +187,26 @@ export interface SimulationResult {
|
|
|
187
187
|
suggestedSolAmount: string;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/** The leverage implied by the executable stop-loss price, not a maximum limit. */
|
|
191
|
+
export interface StopLossSimulationResult {
|
|
192
|
+
executableStopLossPrice: bigint;
|
|
193
|
+
tradeAmount: bigint;
|
|
194
|
+
stopLossPercentage: number;
|
|
195
|
+
/** Existing four-decimal, downward-truncated value. */
|
|
196
|
+
leverage: number;
|
|
197
|
+
/** Rounded to two decimals from the original price ratio, with trailing zeros removed. Display only. */
|
|
198
|
+
leverageDisplay: string;
|
|
199
|
+
currentPrice: bigint;
|
|
200
|
+
iterations: number;
|
|
201
|
+
originalStopLossPrice: bigint;
|
|
202
|
+
close_insert_indices: number[];
|
|
203
|
+
estimatedMargin: bigint;
|
|
204
|
+
rawSellSol?: bigint;
|
|
205
|
+
buyTokenAmount?: bigint;
|
|
206
|
+
sellTokenAmount?: bigint;
|
|
207
|
+
adjustmentIterations?: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
190
210
|
// ========================= Utility Related Types =========================
|
|
191
211
|
|
|
192
212
|
export interface FindPrevNextResult {
|
|
@@ -238,8 +258,10 @@ export interface ParamModule {
|
|
|
238
258
|
export interface SimulatorModule {
|
|
239
259
|
simulateTokenBuy(mint: string, buyTokenAmount: bigint | string | number, passOrder?: string | null): Promise<SimulationResult>;
|
|
240
260
|
simulateTokenSell(mint: string, sellTokenAmount: bigint | string | number, passOrder?: string | null): Promise<SimulationResult>;
|
|
241
|
-
simulateLongStopLoss(mint: string, buyTokenAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any): Promise<
|
|
242
|
-
|
|
261
|
+
simulateLongStopLoss(mint: string, buyTokenAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null): Promise<StopLossSimulationResult>;
|
|
262
|
+
simulateShortStopLoss(mint: string, sellTokenAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null): Promise<StopLossSimulationResult>;
|
|
263
|
+
simulateLongSolStopLoss(mint: string, buySolAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null, initialVirtualSol?: string | number | null, initialVirtualToken?: string | number | null, curveAccount?: any): Promise<StopLossSimulationResult>;
|
|
264
|
+
simulateShortSolStopLoss(mint: string, sellSolAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null, initialVirtualSol?: string | number | null, initialVirtualToken?: string | number | null, curveAccount?: any): Promise<StopLossSimulationResult>;
|
|
243
265
|
}
|
|
244
266
|
|
|
245
267
|
// ========================= Data Interface Types =========================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "100x-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Solana 100x.fun SDK",
|
|
5
5
|
"main": "dist/100x-sdk.cjs.js",
|
|
6
6
|
"module": "dist/100x-sdk.esm.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build": "rollup -c",
|
|
22
22
|
"build:dev": "rollup -c -w",
|
|
23
23
|
"build:types": "cp src/types/index.d.ts dist/index.d.ts",
|
|
24
|
-
"test": "mocha tests/unit/**/*.test.js",
|
|
24
|
+
"test": "mocha \"{test,tests/unit}/**/*.test.js\"",
|
|
25
25
|
"test:integration": "mocha tests/integration/**/*.test.js",
|
|
26
26
|
"lint": "eslint src"
|
|
27
27
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
const { calcLiqTokenBuy, calcLiqTokenSell } = require('./calcLiq');
|
|
4
|
+
const { formatRatio } = require('./precision');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Simulate token buy transaction - calculate if target token amount can be purchased
|
|
@@ -95,8 +96,7 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
|
|
|
95
96
|
if (freeTokenAmount >= buyTokenAmountBig) {
|
|
96
97
|
completionPercentage = "100.0";
|
|
97
98
|
} else {
|
|
98
|
-
|
|
99
|
-
completionPercentage = percentage.toFixed(1);
|
|
99
|
+
completionPercentage = formatRatio(freeTokenAmount, buyTokenAmountBig, 1, 100n);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// 2. Calculate slippage percentage and get final SOL amount
|
|
@@ -107,8 +107,7 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
|
|
|
107
107
|
if (realSolAmount > 0n) {
|
|
108
108
|
// Normal case: calculate slippage
|
|
109
109
|
const diff = idealSolAmount > realSolAmount ? idealSolAmount - realSolAmount : realSolAmount - idealSolAmount;
|
|
110
|
-
|
|
111
|
-
slippagePercentage = slippage.toFixed(1);
|
|
110
|
+
slippagePercentage = formatRatio(diff, idealSolAmount, 1, 100n);
|
|
112
111
|
} else {
|
|
113
112
|
// Special case: real SOL amount is 0, need to recalculate with suggested liquidity
|
|
114
113
|
const suggestedAmount = (freeTokenAmount * BigInt(this.sdk.SUGGEST_LIQ_RATIO)) / 1000n;
|
|
@@ -133,8 +132,7 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
|
|
|
133
132
|
finalRealSolAmount = recalcRealSol;
|
|
134
133
|
|
|
135
134
|
const diff = recalcIdealSol > recalcRealSol ? recalcIdealSol - recalcRealSol : recalcRealSol - recalcIdealSol;
|
|
136
|
-
|
|
137
|
-
slippagePercentage = slippage.toFixed(1);
|
|
135
|
+
slippagePercentage = formatRatio(diff, recalcIdealSol, 1, 100n);
|
|
138
136
|
}
|
|
139
137
|
|
|
140
138
|
// 3. Calculate suggested liquidity
|
|
@@ -253,8 +251,7 @@ async function simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPr
|
|
|
253
251
|
if (freeTokenAmount >= sellTokenAmountBig) {
|
|
254
252
|
completionPercentage = "100.0";
|
|
255
253
|
} else {
|
|
256
|
-
|
|
257
|
-
completionPercentage = percentage.toFixed(1);
|
|
254
|
+
completionPercentage = formatRatio(freeTokenAmount, sellTokenAmountBig, 1, 100n);
|
|
258
255
|
}
|
|
259
256
|
|
|
260
257
|
// 2. Calculate slippage percentage and get final SOL amount
|
|
@@ -265,8 +262,7 @@ async function simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPr
|
|
|
265
262
|
if (realSolAmount > 0n) {
|
|
266
263
|
// Normal case: calculate slippage
|
|
267
264
|
const diff = idealSolAmount > realSolAmount ? idealSolAmount - realSolAmount : realSolAmount - idealSolAmount;
|
|
268
|
-
|
|
269
|
-
slippagePercentage = slippage.toFixed(1);
|
|
265
|
+
slippagePercentage = formatRatio(diff, idealSolAmount, 1, 100n);
|
|
270
266
|
} else {
|
|
271
267
|
// Special case: real SOL amount is 0, need to recalculate with suggested liquidity
|
|
272
268
|
const suggestedAmount = (freeTokenAmount * BigInt(this.sdk.SUGGEST_LIQ_RATIO)) / 1000n;
|
|
@@ -291,8 +287,7 @@ async function simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPr
|
|
|
291
287
|
finalRealSolAmount = recalcRealSol;
|
|
292
288
|
|
|
293
289
|
const diff = recalcIdealSol > recalcRealSol ? recalcIdealSol - recalcRealSol : recalcRealSol - recalcIdealSol;
|
|
294
|
-
|
|
295
|
-
slippagePercentage = slippage.toFixed(1);
|
|
290
|
+
slippagePercentage = formatRatio(diff, recalcIdealSol, 1, 100n);
|
|
296
291
|
}
|
|
297
292
|
|
|
298
293
|
// 3. Calculate suggested liquidity
|
|
@@ -4,6 +4,7 @@ const CurveAMM = require('../../utils/curve_amm');
|
|
|
4
4
|
const {transformOrdersData , checkPriceRangeOverlap} = require('./stop_loss_utils')
|
|
5
5
|
const { PRICE_ADJUSTMENT_PERCENTAGE, MIN_STOP_LOSS_PERCENT } = require('./utils');
|
|
6
6
|
const JSONbig = require('json-bigint')({ storeAsString: false });
|
|
7
|
+
const { formatRatio, ceilDiv } = require('./precision');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Simulate long position stop loss calculation
|
|
@@ -35,10 +36,11 @@ const JSONbig = require('json-bigint')({ storeAsString: false });
|
|
|
35
36
|
* - For example: 3.5 means the stop loss price is 3.5% lower than the current price
|
|
36
37
|
* - For a long position this value should be positive (stop loss price below current price)
|
|
37
38
|
*
|
|
38
|
-
* @returns {number} returns.leverage - Leverage ratio
|
|
39
|
+
* @returns {number} returns.leverage - Leverage ratio (existing four-decimal downward truncation)
|
|
39
40
|
* - Formula: currentPrice / (currentPrice - executableStopLossPrice)
|
|
40
41
|
* - For example: 28.57 means about 28.57x leverage
|
|
41
42
|
* - The higher the leverage, the higher the risk, but also the higher the potential return
|
|
43
|
+
* @returns {string} returns.leverageDisplay - Rounded display value derived from the executable stop-loss price; not a maximum leverage limit
|
|
42
44
|
*
|
|
43
45
|
* @returns {bigint} returns.currentPrice - Current price (u128 format)
|
|
44
46
|
* - The current token price used in the calculation
|
|
@@ -272,10 +274,17 @@ async function simulateLongStopLoss(mint, buyTokenAmount, stopLossPrice, lastPri
|
|
|
272
274
|
// Calculate stop loss percentage
|
|
273
275
|
let stopLossPercentage = 0;
|
|
274
276
|
let leverage = 1;
|
|
277
|
+
let leverageDisplay = '1';
|
|
275
278
|
|
|
276
279
|
if (currentPrice !== executableStopLossPrice) {
|
|
277
|
-
|
|
278
|
-
|
|
280
|
+
const priceDiff = currentPrice - executableStopLossPrice;
|
|
281
|
+
stopLossPercentage = priceDiff >= 0n
|
|
282
|
+
? Number(formatRatio(priceDiff, currentPrice, 2, 100n))
|
|
283
|
+
: Number((10000n * priceDiff) / currentPrice) / 100;
|
|
284
|
+
leverage = Number((10000n * currentPrice) / priceDiff) / 10000;
|
|
285
|
+
leverageDisplay = priceDiff > 0n
|
|
286
|
+
? formatRatio(currentPrice, priceDiff, 2, 1n, 'half-up', true)
|
|
287
|
+
: String(leverage);
|
|
279
288
|
}
|
|
280
289
|
|
|
281
290
|
// Calculate margin requirement
|
|
@@ -311,6 +320,7 @@ async function simulateLongStopLoss(mint, buyTokenAmount, stopLossPrice, lastPri
|
|
|
311
320
|
tradeAmount: finalTradeAmount, // SOL output amount
|
|
312
321
|
stopLossPercentage: stopLossPercentage, // Stop loss percentage relative to current price
|
|
313
322
|
leverage: leverage, // Leverage ratio
|
|
323
|
+
leverageDisplay: leverageDisplay, // Rounded display value; leverage keeps its existing meaning
|
|
314
324
|
currentPrice: currentPrice, // Current price
|
|
315
325
|
iterations: iteration, // Number of adjustments
|
|
316
326
|
originalStopLossPrice: BigInt(stopLossPrice), // Original stop loss price
|
|
@@ -355,10 +365,11 @@ async function simulateLongStopLoss(mint, buyTokenAmount, stopLossPrice, lastPri
|
|
|
355
365
|
* - For example: 3.5 means the stop loss price is 3.5% higher than the current price
|
|
356
366
|
* - For a short position this value should be positive (stop loss price above current price)
|
|
357
367
|
*
|
|
358
|
-
* @returns {number} returns.leverage - Leverage ratio
|
|
368
|
+
* @returns {number} returns.leverage - Leverage ratio (existing four-decimal downward truncation)
|
|
359
369
|
* - Formula: currentPrice / (executableStopLossPrice - currentPrice)
|
|
360
370
|
* - For example: 28.57 means about 28.57x leverage
|
|
361
371
|
* - The higher the leverage, the higher the risk, but also the higher the potential return
|
|
372
|
+
* @returns {string} returns.leverageDisplay - Rounded display value derived from the executable stop-loss price; not a maximum leverage limit
|
|
362
373
|
*
|
|
363
374
|
* @returns {bigint} returns.currentPrice - Current price (u128 format)
|
|
364
375
|
* - The current token price used in the calculation
|
|
@@ -584,11 +595,17 @@ async function simulateShortStopLoss(mint, sellTokenAmount, stopLossPrice, lastP
|
|
|
584
595
|
|
|
585
596
|
// Calculate stop loss percentage
|
|
586
597
|
// For short position, stop loss price is higher than current price, so it's a positive percentage
|
|
587
|
-
const
|
|
598
|
+
const priceDiff = executableStopLossPrice - currentPrice;
|
|
599
|
+
const stopLossPercentage = priceDiff >= 0n
|
|
600
|
+
? Number(formatRatio(priceDiff, currentPrice, 2, 100n))
|
|
601
|
+
: Number((10000n * priceDiff) / currentPrice) / 100;
|
|
588
602
|
|
|
589
603
|
// Calculate leverage ratio
|
|
590
604
|
// For short position, leverage = current price / (stop loss price - current price)
|
|
591
|
-
const leverage = Number((
|
|
605
|
+
const leverage = Number((10000n * currentPrice) / priceDiff) / 10000;
|
|
606
|
+
const leverageDisplay = priceDiff > 0n
|
|
607
|
+
? formatRatio(currentPrice, priceDiff, 2, 1n, 'half-up', true)
|
|
608
|
+
: String(leverage);
|
|
592
609
|
|
|
593
610
|
// Calculate margin requirement
|
|
594
611
|
// Consistent with the contract formula (long_short.rs lines 890-894):
|
|
@@ -628,6 +645,7 @@ async function simulateShortStopLoss(mint, sellTokenAmount, stopLossPrice, lastP
|
|
|
628
645
|
tradeAmount: finalTradeAmount, // SOL input amount (SOL needed to buy back tokens at close)
|
|
629
646
|
stopLossPercentage: stopLossPercentage, // Stop loss percentage relative to current price
|
|
630
647
|
leverage: leverage, // Leverage ratio
|
|
648
|
+
leverageDisplay: leverageDisplay, // Rounded display value; leverage keeps its existing meaning
|
|
631
649
|
currentPrice: currentPrice, // Current price
|
|
632
650
|
iterations: iteration, // Number of adjustments
|
|
633
651
|
originalStopLossPrice: BigInt(stopLossPrice), // Original stop loss price
|
|
@@ -755,8 +773,9 @@ async function simulateLongSolStopLoss(mint, buySolAmount, stopLossPrice, lastPr
|
|
|
755
773
|
// Calculate dynamic binary search upper bound based on leverage
|
|
756
774
|
const stopLossPriceBigInt = BigInt(stopLossPrice);
|
|
757
775
|
const priceDiff = currentPrice - stopLossPriceBigInt;
|
|
758
|
-
|
|
759
|
-
const
|
|
776
|
+
// Keep the original four-decimal leverage truncation used to size the search range.
|
|
777
|
+
const scaledLeverage = priceDiff > 0n ? currentPrice * 10000n / priceDiff : 100000n;
|
|
778
|
+
const safeMultiplier = ceilDiv(scaledLeverage * 3n, 10000n); // 3x safety factor
|
|
760
779
|
const multiplier = safeMultiplier > 10n ? safeMultiplier : 10n; // minimum 10x
|
|
761
780
|
|
|
762
781
|
// Use a binary search algorithm to find the maximum estimatedMargin that is less than buySolAmount
|
|
@@ -941,8 +960,9 @@ async function simulateShortSolStopLoss(mint, sellSolAmount, stopLossPrice, last
|
|
|
941
960
|
// Calculate dynamic binary search upper bound based on leverage
|
|
942
961
|
const stopLossPriceBigInt = BigInt(stopLossPrice);
|
|
943
962
|
const priceDiff = stopLossPriceBigInt - currentPrice;
|
|
944
|
-
|
|
945
|
-
const
|
|
963
|
+
// Keep the original four-decimal leverage truncation used to size the search range.
|
|
964
|
+
const scaledLeverage = priceDiff > 0n ? currentPrice * 10000n / priceDiff : 100000n;
|
|
965
|
+
const safeMultiplier = ceilDiv(scaledLeverage * 3n, 10000n); // 3x safety factor
|
|
946
966
|
const multiplier = safeMultiplier > 10n ? safeMultiplier : 10n; // minimum 10x
|
|
947
967
|
|
|
948
968
|
// Use a binary search algorithm to find the maximum estimatedMargin that is less than sellSolAmount
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Format a non-negative integer ratio without converting its operands to Number. */
|
|
2
|
+
function formatRatio(numerator, denominator, decimals, multiplier = 1n, rounding = 'down', trim = false) {
|
|
3
|
+
numerator = BigInt(numerator);
|
|
4
|
+
denominator = BigInt(denominator);
|
|
5
|
+
if (numerator < 0n || denominator <= 0n || !Number.isInteger(decimals) || decimals < 0) {
|
|
6
|
+
throw new RangeError('Invalid ratio');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const factor = 10n ** BigInt(decimals);
|
|
10
|
+
const scaledNumerator = numerator * multiplier * factor;
|
|
11
|
+
let quotient = scaledNumerator / denominator;
|
|
12
|
+
if (rounding === 'half-up') {
|
|
13
|
+
if ((scaledNumerator % denominator) * 2n >= denominator) quotient++;
|
|
14
|
+
} else if (rounding !== 'down') {
|
|
15
|
+
throw new RangeError('Invalid rounding mode');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (decimals === 0) return quotient.toString();
|
|
19
|
+
const integer = quotient / factor;
|
|
20
|
+
const fraction = (quotient % factor).toString().padStart(decimals, '0');
|
|
21
|
+
const value = `${integer}.${fraction}`;
|
|
22
|
+
return trim ? value.replace(/\.?0+$/, '') : value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function ceilDiv(numerator, denominator) {
|
|
26
|
+
numerator = BigInt(numerator);
|
|
27
|
+
denominator = BigInt(denominator);
|
|
28
|
+
if (numerator < 0n || denominator <= 0n) throw new RangeError('Invalid division');
|
|
29
|
+
return (numerator + denominator - 1n) / denominator;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = { formatRatio, ceilDiv };
|
package/src/modules/simulator.js
CHANGED
|
@@ -339,9 +339,9 @@ class SimulatorModule {
|
|
|
339
339
|
const tokenSellResult = await this.simulateTokenSell(mint, tokenAmountBigInt, null, priceResult, ordersResult);
|
|
340
340
|
|
|
341
341
|
// Estimate ideal SOL amount
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
const estimatedSolAmount =
|
|
342
|
+
// Token and SOL both use 9 decimals, so their unit conversions cancel out.
|
|
343
|
+
const priceScale = BigInt(CurveAMM.PRICE_PRECISION_FACTOR_DECIMAL.toFixed(0));
|
|
344
|
+
const estimatedSolAmount = tokenAmountBigInt * currentPrice / priceScale;
|
|
345
345
|
|
|
346
346
|
// Transform result to match simulateSell format
|
|
347
347
|
return {
|
package/src/types/index.d.ts
CHANGED
|
@@ -187,6 +187,26 @@ export interface SimulationResult {
|
|
|
187
187
|
suggestedSolAmount: string;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/** The leverage implied by the executable stop-loss price, not a maximum limit. */
|
|
191
|
+
export interface StopLossSimulationResult {
|
|
192
|
+
executableStopLossPrice: bigint;
|
|
193
|
+
tradeAmount: bigint;
|
|
194
|
+
stopLossPercentage: number;
|
|
195
|
+
/** Existing four-decimal, downward-truncated value. */
|
|
196
|
+
leverage: number;
|
|
197
|
+
/** Rounded to two decimals from the original price ratio, with trailing zeros removed. Display only. */
|
|
198
|
+
leverageDisplay: string;
|
|
199
|
+
currentPrice: bigint;
|
|
200
|
+
iterations: number;
|
|
201
|
+
originalStopLossPrice: bigint;
|
|
202
|
+
close_insert_indices: number[];
|
|
203
|
+
estimatedMargin: bigint;
|
|
204
|
+
rawSellSol?: bigint;
|
|
205
|
+
buyTokenAmount?: bigint;
|
|
206
|
+
sellTokenAmount?: bigint;
|
|
207
|
+
adjustmentIterations?: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
190
210
|
// ========================= Utility Related Types =========================
|
|
191
211
|
|
|
192
212
|
export interface FindPrevNextResult {
|
|
@@ -238,8 +258,10 @@ export interface ParamModule {
|
|
|
238
258
|
export interface SimulatorModule {
|
|
239
259
|
simulateTokenBuy(mint: string, buyTokenAmount: bigint | string | number, passOrder?: string | null): Promise<SimulationResult>;
|
|
240
260
|
simulateTokenSell(mint: string, sellTokenAmount: bigint | string | number, passOrder?: string | null): Promise<SimulationResult>;
|
|
241
|
-
simulateLongStopLoss(mint: string, buyTokenAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any): Promise<
|
|
242
|
-
|
|
261
|
+
simulateLongStopLoss(mint: string, buyTokenAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null): Promise<StopLossSimulationResult>;
|
|
262
|
+
simulateShortStopLoss(mint: string, sellTokenAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null): Promise<StopLossSimulationResult>;
|
|
263
|
+
simulateLongSolStopLoss(mint: string, buySolAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null, initialVirtualSol?: string | number | null, initialVirtualToken?: string | number | null, curveAccount?: any): Promise<StopLossSimulationResult>;
|
|
264
|
+
simulateShortSolStopLoss(mint: string, sellSolAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any, borrowFee?: number | null, initialVirtualSol?: string | number | null, initialVirtualToken?: string | number | null, curveAccount?: any): Promise<StopLossSimulationResult>;
|
|
243
265
|
}
|
|
244
266
|
|
|
245
267
|
// ========================= Data Interface Types =========================
|
package/src/utils/constants.js
CHANGED
|
@@ -9,8 +9,8 @@ const DEFAULT_NETWORKS = {
|
|
|
9
9
|
network: 'mainnet',
|
|
10
10
|
programId: 'sGecRTjTZmnqJBmLK4ZMNCzsaMrgkFfNqEcYk1GhRde',
|
|
11
11
|
defaultDataSource: 'fast',
|
|
12
|
-
solanaEndpoint: 'https://solana-rpc.
|
|
13
|
-
fastApiUrl: 'https://api.
|
|
12
|
+
solanaEndpoint: 'https://solana-rpc.100x.fun',
|
|
13
|
+
fastApiUrl: 'https://api.100x.fun/',
|
|
14
14
|
feeRecipient: 'CmDe8JRAPJ7QpZNCb4ArVEyzyxYoCNL7WZw5qXLePULn',
|
|
15
15
|
baseFeeRecipient: '2xhAfEfnH8wg7ZGujSijJi4Zt4ge1ZuwMypo7etntgXA',
|
|
16
16
|
paramsAccount: 'CJSn3n4MVCg4qWQ7qb2nxzosYwfcRyBvmwhtM77ugu1V'
|
|
@@ -21,7 +21,7 @@ const DEFAULT_NETWORKS = {
|
|
|
21
21
|
programId: 'sGecRTjTZmnqJBmLK4ZMNCzsaMrgkFfNqEcYk1GhRde',
|
|
22
22
|
defaultDataSource: 'fast',
|
|
23
23
|
solanaEndpoint: 'https://lu-ura5lv-fast-devnet.helius-rpc.com',
|
|
24
|
-
fastApiUrl: 'https://devtestapi.
|
|
24
|
+
fastApiUrl: 'https://devtestapi.100x.fun',
|
|
25
25
|
feeRecipient: 'GesAj2dTn2wdNcxj4x8qsqS9aNRVPBPkE76aaqg7skxu',
|
|
26
26
|
baseFeeRecipient: '5YHi1HsxobLiTD6NQfHJQpoPoRjMuNyXp4RroTvR6dKi',
|
|
27
27
|
paramsAccount: 'Ckz5CmbpyKtKmwgw7NDLzFnVACxekWqrX8i6vhCyLkqY'
|
|
@@ -33,8 +33,6 @@ const DEFAULT_NETWORKS = {
|
|
|
33
33
|
defaultDataSource: 'fast', // 'fast' or 'chain'
|
|
34
34
|
solanaEndpoint: 'http://127.0.0.1:8899',
|
|
35
35
|
fastApiUrl: 'http://127.0.0.1:3000',
|
|
36
|
-
// solanaEndpoint: 'http://216.158.231.58:8899',
|
|
37
|
-
// fastApiUrl: 'http://216.158.231.58:3000',
|
|
38
36
|
feeRecipient: 'GesAj2dTn2wdNcxj4x8qsqS9aNRVPBPkE76aaqg7skxu',
|
|
39
37
|
baseFeeRecipient: '5YHi1HsxobLiTD6NQfHJQpoPoRjMuNyXp4RroTvR6dKi',
|
|
40
38
|
paramsAccount: 'HPuvtLLcgSMPSyRmULPiFe9oAvm1o8mR4weqXZrUhzRM'
|