100x-sdk 1.0.4 → 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.js CHANGED
@@ -36108,11 +36108,46 @@
36108
36108
 
36109
36109
  var jsonBigintExports = jsonBigint.exports;
36110
36110
 
36111
+ /** Format a non-negative integer ratio without converting its operands to Number. */
36112
+
36113
+ function formatRatio$2(numerator, denominator, decimals, multiplier = 1n, rounding = 'down', trim = false) {
36114
+ numerator = BigInt(numerator);
36115
+ denominator = BigInt(denominator);
36116
+ if (numerator < 0n || denominator <= 0n || !Number.isInteger(decimals) || decimals < 0) {
36117
+ throw new RangeError('Invalid ratio');
36118
+ }
36119
+
36120
+ const factor = 10n ** BigInt(decimals);
36121
+ const scaledNumerator = numerator * multiplier * factor;
36122
+ let quotient = scaledNumerator / denominator;
36123
+ if (rounding === 'half-up') {
36124
+ if ((scaledNumerator % denominator) * 2n >= denominator) quotient++;
36125
+ } else if (rounding !== 'down') {
36126
+ throw new RangeError('Invalid rounding mode');
36127
+ }
36128
+
36129
+ if (decimals === 0) return quotient.toString();
36130
+ const integer = quotient / factor;
36131
+ const fraction = (quotient % factor).toString().padStart(decimals, '0');
36132
+ const value = `${integer}.${fraction}`;
36133
+ return trim ? value.replace(/\.?0+$/, '') : value;
36134
+ }
36135
+
36136
+ function ceilDiv$1(numerator, denominator) {
36137
+ numerator = BigInt(numerator);
36138
+ denominator = BigInt(denominator);
36139
+ if (numerator < 0n || denominator <= 0n) throw new RangeError('Invalid division');
36140
+ return (numerator + denominator - 1n) / denominator;
36141
+ }
36142
+
36143
+ var precision = { formatRatio: formatRatio$2, ceilDiv: ceilDiv$1 };
36144
+
36111
36145
  const Decimal$1 = decimalExports;
36112
36146
  const CurveAMM$6 = curve_amm;
36113
36147
  const {transformOrdersData , checkPriceRangeOverlap} = stop_loss_utils;
36114
36148
  const { PRICE_ADJUSTMENT_PERCENTAGE, MIN_STOP_LOSS_PERCENT } = utils$2;
36115
36149
  jsonBigintExports({ storeAsString: false });
36150
+ const { formatRatio: formatRatio$1, ceilDiv } = precision;
36116
36151
 
36117
36152
  /**
36118
36153
  * Simulate long position stop loss calculation
@@ -36144,10 +36179,11 @@
36144
36179
  * - For example: 3.5 means the stop loss price is 3.5% lower than the current price
36145
36180
  * - For a long position this value should be positive (stop loss price below current price)
36146
36181
  *
36147
- * @returns {number} returns.leverage - Leverage ratio
36182
+ * @returns {number} returns.leverage - Leverage ratio (existing four-decimal downward truncation)
36148
36183
  * - Formula: currentPrice / (currentPrice - executableStopLossPrice)
36149
36184
  * - For example: 28.57 means about 28.57x leverage
36150
36185
  * - The higher the leverage, the higher the risk, but also the higher the potential return
36186
+ * @returns {string} returns.leverageDisplay - Rounded display value derived from the executable stop-loss price; not a maximum leverage limit
36151
36187
  *
36152
36188
  * @returns {bigint} returns.currentPrice - Current price (u128 format)
36153
36189
  * - The current token price used in the calculation
@@ -36381,10 +36417,17 @@
36381
36417
  // Calculate stop loss percentage
36382
36418
  let stopLossPercentage = 0;
36383
36419
  let leverage = 1;
36420
+ let leverageDisplay = '1';
36384
36421
 
36385
36422
  if (currentPrice !== executableStopLossPrice) {
36386
- stopLossPercentage = Number((BigInt(10000) * (currentPrice - executableStopLossPrice)) / currentPrice) / 100;
36387
- leverage = Number((BigInt(10000) * currentPrice) / (currentPrice - executableStopLossPrice)) / 10000;
36423
+ const priceDiff = currentPrice - executableStopLossPrice;
36424
+ stopLossPercentage = priceDiff >= 0n
36425
+ ? Number(formatRatio$1(priceDiff, currentPrice, 2, 100n))
36426
+ : Number((10000n * priceDiff) / currentPrice) / 100;
36427
+ leverage = Number((10000n * currentPrice) / priceDiff) / 10000;
36428
+ leverageDisplay = priceDiff > 0n
36429
+ ? formatRatio$1(currentPrice, priceDiff, 2, 1n, 'half-up', true)
36430
+ : String(leverage);
36388
36431
  }
36389
36432
 
36390
36433
  // Calculate margin requirement
@@ -36420,6 +36463,7 @@
36420
36463
  tradeAmount: finalTradeAmount, // SOL output amount
36421
36464
  stopLossPercentage: stopLossPercentage, // Stop loss percentage relative to current price
36422
36465
  leverage: leverage, // Leverage ratio
36466
+ leverageDisplay: leverageDisplay, // Rounded display value; leverage keeps its existing meaning
36423
36467
  currentPrice: currentPrice, // Current price
36424
36468
  iterations: iteration, // Number of adjustments
36425
36469
  originalStopLossPrice: BigInt(stopLossPrice), // Original stop loss price
@@ -36464,10 +36508,11 @@
36464
36508
  * - For example: 3.5 means the stop loss price is 3.5% higher than the current price
36465
36509
  * - For a short position this value should be positive (stop loss price above current price)
36466
36510
  *
36467
- * @returns {number} returns.leverage - Leverage ratio
36511
+ * @returns {number} returns.leverage - Leverage ratio (existing four-decimal downward truncation)
36468
36512
  * - Formula: currentPrice / (executableStopLossPrice - currentPrice)
36469
36513
  * - For example: 28.57 means about 28.57x leverage
36470
36514
  * - The higher the leverage, the higher the risk, but also the higher the potential return
36515
+ * @returns {string} returns.leverageDisplay - Rounded display value derived from the executable stop-loss price; not a maximum leverage limit
36471
36516
  *
36472
36517
  * @returns {bigint} returns.currentPrice - Current price (u128 format)
36473
36518
  * - The current token price used in the calculation
@@ -36693,11 +36738,17 @@
36693
36738
 
36694
36739
  // Calculate stop loss percentage
36695
36740
  // For short position, stop loss price is higher than current price, so it's a positive percentage
36696
- const stopLossPercentage = Number((BigInt(10000) * (executableStopLossPrice - currentPrice)) / currentPrice) / 100;
36741
+ const priceDiff = executableStopLossPrice - currentPrice;
36742
+ const stopLossPercentage = priceDiff >= 0n
36743
+ ? Number(formatRatio$1(priceDiff, currentPrice, 2, 100n))
36744
+ : Number((10000n * priceDiff) / currentPrice) / 100;
36697
36745
 
36698
36746
  // Calculate leverage ratio
36699
36747
  // For short position, leverage = current price / (stop loss price - current price)
36700
- const leverage = Number((BigInt(10000) * currentPrice) / (executableStopLossPrice - currentPrice)) / 10000;
36748
+ const leverage = Number((10000n * currentPrice) / priceDiff) / 10000;
36749
+ const leverageDisplay = priceDiff > 0n
36750
+ ? formatRatio$1(currentPrice, priceDiff, 2, 1n, 'half-up', true)
36751
+ : String(leverage);
36701
36752
 
36702
36753
  // Calculate margin requirement
36703
36754
  // Consistent with the contract formula (long_short.rs lines 890-894):
@@ -36737,6 +36788,7 @@
36737
36788
  tradeAmount: finalTradeAmount, // SOL input amount (SOL needed to buy back tokens at close)
36738
36789
  stopLossPercentage: stopLossPercentage, // Stop loss percentage relative to current price
36739
36790
  leverage: leverage, // Leverage ratio
36791
+ leverageDisplay: leverageDisplay, // Rounded display value; leverage keeps its existing meaning
36740
36792
  currentPrice: currentPrice, // Current price
36741
36793
  iterations: iteration, // Number of adjustments
36742
36794
  originalStopLossPrice: BigInt(stopLossPrice), // Original stop loss price
@@ -36864,8 +36916,9 @@
36864
36916
  // Calculate dynamic binary search upper bound based on leverage
36865
36917
  const stopLossPriceBigInt = BigInt(stopLossPrice);
36866
36918
  const priceDiff = currentPrice - stopLossPriceBigInt;
36867
- const estimatedLeverage = priceDiff > 0n ? Number(currentPrice * 10000n / priceDiff) / 10000 : 10;
36868
- const safeMultiplier = BigInt(Math.ceil(estimatedLeverage * 3)); // 3x safety factor
36919
+ // Keep the original four-decimal leverage truncation used to size the search range.
36920
+ const scaledLeverage = priceDiff > 0n ? currentPrice * 10000n / priceDiff : 100000n;
36921
+ const safeMultiplier = ceilDiv(scaledLeverage * 3n, 10000n); // 3x safety factor
36869
36922
  const multiplier = safeMultiplier > 10n ? safeMultiplier : 10n; // minimum 10x
36870
36923
 
36871
36924
  // Use a binary search algorithm to find the maximum estimatedMargin that is less than buySolAmount
@@ -37050,8 +37103,9 @@
37050
37103
  // Calculate dynamic binary search upper bound based on leverage
37051
37104
  const stopLossPriceBigInt = BigInt(stopLossPrice);
37052
37105
  const priceDiff = stopLossPriceBigInt - currentPrice;
37053
- const estimatedLeverage = priceDiff > 0n ? Number(currentPrice * 10000n / priceDiff) / 10000 : 10;
37054
- const safeMultiplier = BigInt(Math.ceil(estimatedLeverage * 3)); // 3x safety factor
37106
+ // Keep the original four-decimal leverage truncation used to size the search range.
37107
+ const scaledLeverage = priceDiff > 0n ? currentPrice * 10000n / priceDiff : 100000n;
37108
+ const safeMultiplier = ceilDiv(scaledLeverage * 3n, 10000n); // 3x safety factor
37055
37109
  const multiplier = safeMultiplier > 10n ? safeMultiplier : 10n; // minimum 10x
37056
37110
 
37057
37111
  // Use a binary search algorithm to find the maximum estimatedMargin that is less than sellSolAmount
@@ -37889,6 +37943,7 @@
37889
37943
  };
37890
37944
 
37891
37945
  const { calcLiqTokenBuy, calcLiqTokenSell } = calcLiq;
37946
+ const { formatRatio } = precision;
37892
37947
 
37893
37948
  /**
37894
37949
  * Simulate token buy transaction - calculate if target token amount can be purchased
@@ -37983,8 +38038,7 @@
37983
38038
  if (freeTokenAmount >= buyTokenAmountBig) {
37984
38039
  completionPercentage = "100.0";
37985
38040
  } else {
37986
- const percentage = Math.floor((Number(freeTokenAmount) / Number(buyTokenAmountBig)) * 1000) / 10;
37987
- completionPercentage = percentage.toFixed(1);
38041
+ completionPercentage = formatRatio(freeTokenAmount, buyTokenAmountBig, 1, 100n);
37988
38042
  }
37989
38043
 
37990
38044
  // 2. Calculate slippage percentage and get final SOL amount
@@ -37995,8 +38049,7 @@
37995
38049
  if (realSolAmount > 0n) {
37996
38050
  // Normal case: calculate slippage
37997
38051
  const diff = idealSolAmount > realSolAmount ? idealSolAmount - realSolAmount : realSolAmount - idealSolAmount;
37998
- const slippage = Math.floor((Number(diff) / Number(idealSolAmount)) * 1000) / 10;
37999
- slippagePercentage = slippage.toFixed(1);
38052
+ slippagePercentage = formatRatio(diff, idealSolAmount, 1, 100n);
38000
38053
  } else {
38001
38054
  // Special case: real SOL amount is 0, need to recalculate with suggested liquidity
38002
38055
  const suggestedAmount = (freeTokenAmount * BigInt(this.sdk.SUGGEST_LIQ_RATIO)) / 1000n;
@@ -38021,8 +38074,7 @@
38021
38074
  finalRealSolAmount = recalcRealSol;
38022
38075
 
38023
38076
  const diff = recalcIdealSol > recalcRealSol ? recalcIdealSol - recalcRealSol : recalcRealSol - recalcIdealSol;
38024
- const slippage = Math.floor((Number(diff) / Number(recalcIdealSol)) * 1000) / 10;
38025
- slippagePercentage = slippage.toFixed(1);
38077
+ slippagePercentage = formatRatio(diff, recalcIdealSol, 1, 100n);
38026
38078
  }
38027
38079
 
38028
38080
  // 3. Calculate suggested liquidity
@@ -38141,8 +38193,7 @@
38141
38193
  if (freeTokenAmount >= sellTokenAmountBig) {
38142
38194
  completionPercentage = "100.0";
38143
38195
  } else {
38144
- const percentage = Math.floor((Number(freeTokenAmount) / Number(sellTokenAmountBig)) * 1000) / 10;
38145
- completionPercentage = percentage.toFixed(1);
38196
+ completionPercentage = formatRatio(freeTokenAmount, sellTokenAmountBig, 1, 100n);
38146
38197
  }
38147
38198
 
38148
38199
  // 2. Calculate slippage percentage and get final SOL amount
@@ -38153,8 +38204,7 @@
38153
38204
  if (realSolAmount > 0n) {
38154
38205
  // Normal case: calculate slippage
38155
38206
  const diff = idealSolAmount > realSolAmount ? idealSolAmount - realSolAmount : realSolAmount - idealSolAmount;
38156
- const slippage = Math.floor((Number(diff) / Number(idealSolAmount)) * 1000) / 10;
38157
- slippagePercentage = slippage.toFixed(1);
38207
+ slippagePercentage = formatRatio(diff, idealSolAmount, 1, 100n);
38158
38208
  } else {
38159
38209
  // Special case: real SOL amount is 0, need to recalculate with suggested liquidity
38160
38210
  const suggestedAmount = (freeTokenAmount * BigInt(this.sdk.SUGGEST_LIQ_RATIO)) / 1000n;
@@ -38179,8 +38229,7 @@
38179
38229
  finalRealSolAmount = recalcRealSol;
38180
38230
 
38181
38231
  const diff = recalcIdealSol > recalcRealSol ? recalcIdealSol - recalcRealSol : recalcRealSol - recalcIdealSol;
38182
- const slippage = Math.floor((Number(diff) / Number(recalcIdealSol)) * 1000) / 10;
38183
- slippagePercentage = slippage.toFixed(1);
38232
+ slippagePercentage = formatRatio(diff, recalcIdealSol, 1, 100n);
38184
38233
  }
38185
38234
 
38186
38235
  // 3. Calculate suggested liquidity
@@ -39035,9 +39084,9 @@
39035
39084
  const tokenSellResult = await this.simulateTokenSell(mint, tokenAmountBigInt, null, priceResult, ordersResult);
39036
39085
 
39037
39086
  // Estimate ideal SOL amount
39038
- const priceDecimal = CurveAMM$3.u128ToDecimal(currentPrice);
39039
- const tokenInDecimal = Number(tokenAmountBigInt) / 1e9; // Convert token lamports to tokens (9-digit precision)
39040
- const estimatedSolAmount = BigInt(Math.floor((tokenInDecimal * priceDecimal) * 1e9)); // Convert to SOL lamports
39087
+ // Token and SOL both use 9 decimals, so their unit conversions cancel out.
39088
+ const priceScale = BigInt(CurveAMM$3.PRICE_PRECISION_FACTOR_DECIMAL.toFixed(0));
39089
+ const estimatedSolAmount = tokenAmountBigInt * currentPrice / priceScale;
39041
39090
 
39042
39091
  // Transform result to match simulateSell format
39043
39092
  return {
@@ -40798,7 +40847,7 @@
40798
40847
 
40799
40848
  var orderUtils = OrderUtils$2;
40800
40849
 
40801
- var address$1 = "sGecRTjTZmnqJBmLK4ZMNCzsaMrgkFfNqEcYk1GhRde";
40850
+ var address$1 = "EVNaaiyg9z876PUmLCVQcdc5L5eJukT4pni5GtVJ8P37";
40802
40851
  var metadata$1 = {
40803
40852
  name: "fun100x",
40804
40853
  version: "0.1.0",
@@ -43815,271 +43864,281 @@
43815
43864
  },
43816
43865
  {
43817
43866
  code: 6062,
43867
+ name: "InsufficientLongPayerBalance",
43868
+ msg: "Payer wallet balance insufficient for long margin and fees"
43869
+ },
43870
+ {
43871
+ code: 6063,
43872
+ name: "InsufficientShortPayerBalance",
43873
+ msg: "Payer wallet balance insufficient for short margin and fees"
43874
+ },
43875
+ {
43876
+ code: 6064,
43818
43877
  name: "InvalidAccountOwner",
43819
43878
  msg: "Invalid account owner"
43820
43879
  },
43821
43880
  {
43822
- code: 6063,
43881
+ code: 6065,
43823
43882
  name: "SellAmountExceedsOrderAmount",
43824
43883
  msg: "Sell amount exceeds order's token holdings"
43825
43884
  },
43826
43885
  {
43827
- code: 6064,
43886
+ code: 6066,
43828
43887
  name: "OrderNotExpiredMustCloseByOwner",
43829
43888
  msg: "Non-expired order must be closed by owner"
43830
43889
  },
43831
43890
  {
43832
- code: 6065,
43891
+ code: 6067,
43833
43892
  name: "SettlementAddressMustBeOwnerAddress",
43834
43893
  msg: "Settlement address must be owner address"
43835
43894
  },
43836
43895
  {
43837
- code: 6066,
43896
+ code: 6068,
43838
43897
  name: "BuyAmountExceedsOrderAmount",
43839
43898
  msg: "Buy amount exceeds order's token holdings"
43840
43899
  },
43841
43900
  {
43842
- code: 6067,
43901
+ code: 6069,
43843
43902
  name: "InsufficientTradeAmount",
43844
43903
  msg: "Trade amount below minimum requirement"
43845
43904
  },
43846
43905
  {
43847
- code: 6068,
43906
+ code: 6070,
43848
43907
  name: "SolAmountTooLarge",
43849
43908
  msg: "SOL amount exceeds maximum limit (10000000 SOL per transaction)"
43850
43909
  },
43851
43910
  {
43852
- code: 6069,
43911
+ code: 6071,
43853
43912
  name: "RemainingTokenAmountTooSmall",
43854
43913
  msg: "Remaining token amount below minimum trade requirement"
43855
43914
  },
43856
43915
  {
43857
- code: 6070,
43916
+ code: 6072,
43858
43917
  name: "TradeCooldownNotExpired",
43859
43918
  msg: "Trade cooldown period not expired, please try again later"
43860
43919
  },
43861
43920
  {
43862
- code: 6071,
43921
+ code: 6073,
43863
43922
  name: "ExceedApprovalAmount",
43864
43923
  msg: "Sell amount exceeds approved amount, please call approval function first"
43865
43924
  },
43866
43925
  {
43867
- code: 6072,
43926
+ code: 6074,
43868
43927
  name: "CooldownNotInitialized",
43869
43928
  msg: "Sell trade requires calling approval or buy function first to initialize cooldown PDA"
43870
43929
  },
43871
43930
  {
43872
- code: 6073,
43931
+ code: 6075,
43873
43932
  name: "CannotCloseCooldownWithBalance",
43874
43933
  msg: "Cannot close cooldown PDA with non-zero token balance"
43875
43934
  },
43876
43935
  {
43877
- code: 6074,
43936
+ code: 6076,
43878
43937
  name: "PriceCalculationError",
43879
43938
  msg: "Price calculation error"
43880
43939
  },
43881
43940
  {
43882
- code: 6075,
43941
+ code: 6077,
43883
43942
  name: "InvalidPartnerFeeRecipientAccount",
43884
43943
  msg: "Invalid partner fee recipient account"
43885
43944
  },
43886
43945
  {
43887
- code: 6076,
43946
+ code: 6078,
43888
43947
  name: "InvalidBaseFeeRecipientAccount",
43889
43948
  msg: "Invalid base fee recipient account"
43890
43949
  },
43891
43950
  {
43892
- code: 6077,
43951
+ code: 6079,
43893
43952
  name: "InvalidOrderbookAddress",
43894
43953
  msg: "Orderbook address does not match curve account orderbook"
43895
43954
  },
43896
43955
  {
43897
- code: 6078,
43956
+ code: 6080,
43898
43957
  name: "InvalidFeePercentage",
43899
43958
  msg: "Fee percentage must be between 0-100"
43900
43959
  },
43901
43960
  {
43902
- code: 6079,
43961
+ code: 6081,
43903
43962
  name: "InvalidFeeRate",
43904
43963
  msg: "Fee rate exceeds maximum limit (10%)"
43905
43964
  },
43906
43965
  {
43907
- code: 6080,
43966
+ code: 6082,
43908
43967
  name: "InvalidCustomFeeRate",
43909
43968
  msg: "Custom fee rate must be between 1000 (1%) and 5000 (5%)"
43910
43969
  },
43911
43970
  {
43912
- code: 6081,
43971
+ code: 6083,
43913
43972
  name: "InvalidBorrowDuration",
43914
43973
  msg: "Borrow duration out of valid range (3-30 days)"
43915
43974
  },
43916
43975
  {
43917
- code: 6082,
43976
+ code: 6084,
43918
43977
  name: "InvalidStopLossPrice",
43919
43978
  msg: "Stop loss price does not meet minimum interval requirement"
43920
43979
  },
43921
43980
  {
43922
- code: 6083,
43981
+ code: 6085,
43923
43982
  name: "NoProfitableFunds",
43924
43983
  msg: "No profitable funds to transfer"
43925
43984
  },
43926
43985
  {
43927
- code: 6084,
43986
+ code: 6086,
43928
43987
  name: "InsufficientPoolFunds",
43929
43988
  msg: "Insufficient pool funds"
43930
43989
  },
43931
43990
  {
43932
- code: 6085,
43991
+ code: 6087,
43933
43992
  name: "InsufficientPoolBalance",
43934
43993
  msg: "Pool SOL account balance would fall below minimum required balance"
43935
43994
  },
43936
43995
  {
43937
- code: 6086,
43996
+ code: 6088,
43938
43997
  name: "OrderBookManagerOverflow",
43939
43998
  msg: "Math operation overflow"
43940
43999
  },
43941
44000
  {
43942
- code: 6087,
44001
+ code: 6089,
43943
44002
  name: "OrderBookManagerInvalidSlotIndex",
43944
44003
  msg: "Invalid slot index"
43945
44004
  },
43946
44005
  {
43947
- code: 6088,
44006
+ code: 6090,
43948
44007
  name: "OrderBookManagerInvalidAccountData",
43949
44008
  msg: "Invalid account data"
43950
44009
  },
43951
44010
  {
43952
- code: 6089,
44011
+ code: 6091,
43953
44012
  name: "OrderBookManagerExceedsMaxCapacity",
43954
44013
  msg: "New capacity exceeds maximum limit"
43955
44014
  },
43956
44015
  {
43957
- code: 6090,
44016
+ code: 6092,
43958
44017
  name: "OrderBookManagerExceedsAccountSizeLimit",
43959
44018
  msg: "Account size exceeds 10MB limit"
43960
44019
  },
43961
44020
  {
43962
- code: 6091,
44021
+ code: 6093,
43963
44022
  name: "OrderBookManagerOrderIdMismatch",
43964
44023
  msg: "Order ID mismatch"
43965
44024
  },
43966
44025
  {
43967
- code: 6092,
44026
+ code: 6094,
43968
44027
  name: "OrderBookManagerEmptyOrderBook",
43969
44028
  msg: "Order book is empty"
43970
44029
  },
43971
44030
  {
43972
- code: 6093,
44031
+ code: 6095,
43973
44032
  name: "OrderBookManagerAccountNotWritable",
43974
44033
  msg: "Account is not writable"
43975
44034
  },
43976
44035
  {
43977
- code: 6094,
44036
+ code: 6096,
43978
44037
  name: "OrderBookManagerNotRentExempt",
43979
44038
  msg: "Account not rent-exempt"
43980
44039
  },
43981
44040
  {
43982
- code: 6095,
44041
+ code: 6097,
43983
44042
  name: "OrderBookManagerInvalidRentBalance",
43984
44043
  msg: "Invalid rent balance"
43985
44044
  },
43986
44045
  {
43987
- code: 6096,
44046
+ code: 6098,
43988
44047
  name: "OrderBookManagerInsufficientFunds",
43989
44048
  msg: "Insufficient funds"
43990
44049
  },
43991
44050
  {
43992
- code: 6097,
44051
+ code: 6099,
43993
44052
  name: "OrderBookManagerInvalidAccountOwner",
43994
44053
  msg: "OrderBook account owner mismatch"
43995
44054
  },
43996
44055
  {
43997
- code: 6098,
44056
+ code: 6100,
43998
44057
  name: "OrderBookManagerDataOutOfBounds",
43999
44058
  msg: "Data access out of bounds"
44000
44059
  },
44001
44060
  {
44002
- code: 6099,
44061
+ code: 6101,
44003
44062
  name: "NoValidInsertPosition",
44004
44063
  msg: "Cannot find valid insert position, all candidates failed due to price range overlap"
44005
44064
  },
44006
44065
  {
44007
- code: 6100,
44066
+ code: 6102,
44008
44067
  name: "EmptyCloseInsertIndices",
44009
44068
  msg: "close_insert_indices array cannot be empty"
44010
44069
  },
44011
44070
  {
44012
- code: 6101,
44071
+ code: 6103,
44013
44072
  name: "TooManyCloseInsertIndices",
44014
44073
  msg: "close_insert_indices array cannot exceed 20 elements"
44015
44074
  },
44016
44075
  {
44017
- code: 6102,
44076
+ code: 6104,
44018
44077
  name: "CloseOrderNotFound",
44019
44078
  msg: "Specified close order not found"
44020
44079
  },
44021
44080
  {
44022
- code: 6103,
44081
+ code: 6105,
44023
44082
  name: "LinkedListDeleteCountMismatch",
44024
44083
  msg: "Linked list delete count mismatch: count inconsistent before/after deletion"
44025
44084
  },
44026
44085
  {
44027
- code: 6104,
44086
+ code: 6106,
44028
44087
  name: "NameTooLong",
44029
44088
  msg: "Token name too long, max 32 bytes"
44030
44089
  },
44031
44090
  {
44032
- code: 6105,
44091
+ code: 6107,
44033
44092
  name: "NameEmpty",
44034
44093
  msg: "Token name cannot be empty"
44035
44094
  },
44036
44095
  {
44037
- code: 6106,
44096
+ code: 6108,
44038
44097
  name: "SymbolTooLong",
44039
44098
  msg: "Token symbol too long, max 10 bytes"
44040
44099
  },
44041
44100
  {
44042
- code: 6107,
44101
+ code: 6109,
44043
44102
  name: "SymbolEmpty",
44044
44103
  msg: "Token symbol cannot be empty"
44045
44104
  },
44046
44105
  {
44047
- code: 6108,
44106
+ code: 6110,
44048
44107
  name: "UriTooLong",
44049
44108
  msg: "URI too long, max 200 bytes"
44050
44109
  },
44051
44110
  {
44052
- code: 6109,
44111
+ code: 6111,
44053
44112
  name: "UriEmpty",
44054
44113
  msg: "URI cannot be empty"
44055
44114
  },
44056
44115
  {
44057
- code: 6110,
44116
+ code: 6112,
44058
44117
  name: "IncompleteAdvancedPoolParams",
44059
44118
  msg: "Incomplete advanced pool parameters: custom_lp_sol, custom_lp_token, custom_borrow_ratio, custom_borrow_duration must be provided together"
44060
44119
  },
44061
44120
  {
44062
- code: 6111,
44121
+ code: 6113,
44063
44122
  name: "InvalidInitialVirtualSol",
44064
44123
  msg: "Initial virtual SOL out of valid range"
44065
44124
  },
44066
44125
  {
44067
- code: 6112,
44126
+ code: 6114,
44068
44127
  name: "InvalidInitialVirtualToken",
44069
44128
  msg: "Initial virtual Token out of valid range"
44070
44129
  },
44071
44130
  {
44072
- code: 6113,
44131
+ code: 6115,
44073
44132
  name: "InvalidBorrowPoolRatio",
44074
44133
  msg: "Borrow pool ratio out of valid range"
44075
44134
  },
44076
44135
  {
44077
- code: 6114,
44136
+ code: 6116,
44078
44137
  name: "BorrowTokenCalculationOverflow",
44079
44138
  msg: "Borrow pool token amount calculation overflow"
44080
44139
  },
44081
44140
  {
44082
- code: 6115,
44141
+ code: 6117,
44083
44142
  name: "BorrowTokenAmountZero",
44084
44143
  msg: "Borrow pool token amount cannot be zero"
44085
44144
  }
@@ -44226,8 +44285,10 @@
44226
44285
  name: "pool_type",
44227
44286
  docs: [
44228
44287
  "Pool type",
44229
- "0 = Basic version (uses default parameters, supports fee halving)",
44230
- "1 = Advanced version (custom parameters, fees never halved)"
44288
+ "0 = Basic version (uses default parameters)",
44289
+ "1 = Advanced version (custom parameters)",
44290
+ "Note: BOTH pool types participate in fee halving milestones",
44291
+ "(dynamic thresholds at 100x/1000x/10000x of the pool's own initial price)"
44231
44292
  ],
44232
44293
  type: "u8"
44233
44294
  },
@@ -44235,8 +44296,8 @@
44235
44296
  name: "borrow_pool_ratio",
44236
44297
  docs: [
44237
44298
  "Borrow pool token ratio (recorded only for information display)",
44238
- "Actual value range: 5-30 (represents 5%-30%)",
44239
- "Basic version fixed at 20"
44299
+ "Actual value range: 2-8 (represents 2%-8%, deducted from total supply)",
44300
+ "Basic version fixed at 4"
44240
44301
  ],
44241
44302
  type: "u8"
44242
44303
  }
@@ -44812,7 +44873,7 @@
44812
44873
  types: types$1
44813
44874
  };
44814
44875
 
44815
- var address = "sGecRTjTZmnqJBmLK4ZMNCzsaMrgkFfNqEcYk1GhRde";
44876
+ var address = "EVNaaiyg9z876PUmLCVQcdc5L5eJukT4pni5GtVJ8P37";
44816
44877
  var metadata = {
44817
44878
  name: "fun100x",
44818
44879
  version: "0.1.0",
@@ -47829,271 +47890,281 @@
47829
47890
  },
47830
47891
  {
47831
47892
  code: 6062,
47893
+ name: "InsufficientLongPayerBalance",
47894
+ msg: "Payer wallet balance insufficient for long margin and fees"
47895
+ },
47896
+ {
47897
+ code: 6063,
47898
+ name: "InsufficientShortPayerBalance",
47899
+ msg: "Payer wallet balance insufficient for short margin and fees"
47900
+ },
47901
+ {
47902
+ code: 6064,
47832
47903
  name: "InvalidAccountOwner",
47833
47904
  msg: "Invalid account owner"
47834
47905
  },
47835
47906
  {
47836
- code: 6063,
47907
+ code: 6065,
47837
47908
  name: "SellAmountExceedsOrderAmount",
47838
47909
  msg: "Sell amount exceeds order's token holdings"
47839
47910
  },
47840
47911
  {
47841
- code: 6064,
47912
+ code: 6066,
47842
47913
  name: "OrderNotExpiredMustCloseByOwner",
47843
47914
  msg: "Non-expired order must be closed by owner"
47844
47915
  },
47845
47916
  {
47846
- code: 6065,
47917
+ code: 6067,
47847
47918
  name: "SettlementAddressMustBeOwnerAddress",
47848
47919
  msg: "Settlement address must be owner address"
47849
47920
  },
47850
47921
  {
47851
- code: 6066,
47922
+ code: 6068,
47852
47923
  name: "BuyAmountExceedsOrderAmount",
47853
47924
  msg: "Buy amount exceeds order's token holdings"
47854
47925
  },
47855
47926
  {
47856
- code: 6067,
47927
+ code: 6069,
47857
47928
  name: "InsufficientTradeAmount",
47858
47929
  msg: "Trade amount below minimum requirement"
47859
47930
  },
47860
47931
  {
47861
- code: 6068,
47932
+ code: 6070,
47862
47933
  name: "SolAmountTooLarge",
47863
47934
  msg: "SOL amount exceeds maximum limit (10000000 SOL per transaction)"
47864
47935
  },
47865
47936
  {
47866
- code: 6069,
47937
+ code: 6071,
47867
47938
  name: "RemainingTokenAmountTooSmall",
47868
47939
  msg: "Remaining token amount below minimum trade requirement"
47869
47940
  },
47870
47941
  {
47871
- code: 6070,
47942
+ code: 6072,
47872
47943
  name: "TradeCooldownNotExpired",
47873
47944
  msg: "Trade cooldown period not expired, please try again later"
47874
47945
  },
47875
47946
  {
47876
- code: 6071,
47947
+ code: 6073,
47877
47948
  name: "ExceedApprovalAmount",
47878
47949
  msg: "Sell amount exceeds approved amount, please call approval function first"
47879
47950
  },
47880
47951
  {
47881
- code: 6072,
47952
+ code: 6074,
47882
47953
  name: "CooldownNotInitialized",
47883
47954
  msg: "Sell trade requires calling approval or buy function first to initialize cooldown PDA"
47884
47955
  },
47885
47956
  {
47886
- code: 6073,
47957
+ code: 6075,
47887
47958
  name: "CannotCloseCooldownWithBalance",
47888
47959
  msg: "Cannot close cooldown PDA with non-zero token balance"
47889
47960
  },
47890
47961
  {
47891
- code: 6074,
47962
+ code: 6076,
47892
47963
  name: "PriceCalculationError",
47893
47964
  msg: "Price calculation error"
47894
47965
  },
47895
47966
  {
47896
- code: 6075,
47967
+ code: 6077,
47897
47968
  name: "InvalidPartnerFeeRecipientAccount",
47898
47969
  msg: "Invalid partner fee recipient account"
47899
47970
  },
47900
47971
  {
47901
- code: 6076,
47972
+ code: 6078,
47902
47973
  name: "InvalidBaseFeeRecipientAccount",
47903
47974
  msg: "Invalid base fee recipient account"
47904
47975
  },
47905
47976
  {
47906
- code: 6077,
47977
+ code: 6079,
47907
47978
  name: "InvalidOrderbookAddress",
47908
47979
  msg: "Orderbook address does not match curve account orderbook"
47909
47980
  },
47910
47981
  {
47911
- code: 6078,
47982
+ code: 6080,
47912
47983
  name: "InvalidFeePercentage",
47913
47984
  msg: "Fee percentage must be between 0-100"
47914
47985
  },
47915
47986
  {
47916
- code: 6079,
47987
+ code: 6081,
47917
47988
  name: "InvalidFeeRate",
47918
47989
  msg: "Fee rate exceeds maximum limit (10%)"
47919
47990
  },
47920
47991
  {
47921
- code: 6080,
47992
+ code: 6082,
47922
47993
  name: "InvalidCustomFeeRate",
47923
47994
  msg: "Custom fee rate must be between 1000 (1%) and 5000 (5%)"
47924
47995
  },
47925
47996
  {
47926
- code: 6081,
47997
+ code: 6083,
47927
47998
  name: "InvalidBorrowDuration",
47928
47999
  msg: "Borrow duration out of valid range (3-30 days)"
47929
48000
  },
47930
48001
  {
47931
- code: 6082,
48002
+ code: 6084,
47932
48003
  name: "InvalidStopLossPrice",
47933
48004
  msg: "Stop loss price does not meet minimum interval requirement"
47934
48005
  },
47935
48006
  {
47936
- code: 6083,
48007
+ code: 6085,
47937
48008
  name: "NoProfitableFunds",
47938
48009
  msg: "No profitable funds to transfer"
47939
48010
  },
47940
48011
  {
47941
- code: 6084,
48012
+ code: 6086,
47942
48013
  name: "InsufficientPoolFunds",
47943
48014
  msg: "Insufficient pool funds"
47944
48015
  },
47945
48016
  {
47946
- code: 6085,
48017
+ code: 6087,
47947
48018
  name: "InsufficientPoolBalance",
47948
48019
  msg: "Pool SOL account balance would fall below minimum required balance"
47949
48020
  },
47950
48021
  {
47951
- code: 6086,
48022
+ code: 6088,
47952
48023
  name: "OrderBookManagerOverflow",
47953
48024
  msg: "Math operation overflow"
47954
48025
  },
47955
48026
  {
47956
- code: 6087,
48027
+ code: 6089,
47957
48028
  name: "OrderBookManagerInvalidSlotIndex",
47958
48029
  msg: "Invalid slot index"
47959
48030
  },
47960
48031
  {
47961
- code: 6088,
48032
+ code: 6090,
47962
48033
  name: "OrderBookManagerInvalidAccountData",
47963
48034
  msg: "Invalid account data"
47964
48035
  },
47965
48036
  {
47966
- code: 6089,
48037
+ code: 6091,
47967
48038
  name: "OrderBookManagerExceedsMaxCapacity",
47968
48039
  msg: "New capacity exceeds maximum limit"
47969
48040
  },
47970
48041
  {
47971
- code: 6090,
48042
+ code: 6092,
47972
48043
  name: "OrderBookManagerExceedsAccountSizeLimit",
47973
48044
  msg: "Account size exceeds 10MB limit"
47974
48045
  },
47975
48046
  {
47976
- code: 6091,
48047
+ code: 6093,
47977
48048
  name: "OrderBookManagerOrderIdMismatch",
47978
48049
  msg: "Order ID mismatch"
47979
48050
  },
47980
48051
  {
47981
- code: 6092,
48052
+ code: 6094,
47982
48053
  name: "OrderBookManagerEmptyOrderBook",
47983
48054
  msg: "Order book is empty"
47984
48055
  },
47985
48056
  {
47986
- code: 6093,
48057
+ code: 6095,
47987
48058
  name: "OrderBookManagerAccountNotWritable",
47988
48059
  msg: "Account is not writable"
47989
48060
  },
47990
48061
  {
47991
- code: 6094,
48062
+ code: 6096,
47992
48063
  name: "OrderBookManagerNotRentExempt",
47993
48064
  msg: "Account not rent-exempt"
47994
48065
  },
47995
48066
  {
47996
- code: 6095,
48067
+ code: 6097,
47997
48068
  name: "OrderBookManagerInvalidRentBalance",
47998
48069
  msg: "Invalid rent balance"
47999
48070
  },
48000
48071
  {
48001
- code: 6096,
48072
+ code: 6098,
48002
48073
  name: "OrderBookManagerInsufficientFunds",
48003
48074
  msg: "Insufficient funds"
48004
48075
  },
48005
48076
  {
48006
- code: 6097,
48077
+ code: 6099,
48007
48078
  name: "OrderBookManagerInvalidAccountOwner",
48008
48079
  msg: "OrderBook account owner mismatch"
48009
48080
  },
48010
48081
  {
48011
- code: 6098,
48082
+ code: 6100,
48012
48083
  name: "OrderBookManagerDataOutOfBounds",
48013
48084
  msg: "Data access out of bounds"
48014
48085
  },
48015
48086
  {
48016
- code: 6099,
48087
+ code: 6101,
48017
48088
  name: "NoValidInsertPosition",
48018
48089
  msg: "Cannot find valid insert position, all candidates failed due to price range overlap"
48019
48090
  },
48020
48091
  {
48021
- code: 6100,
48092
+ code: 6102,
48022
48093
  name: "EmptyCloseInsertIndices",
48023
48094
  msg: "close_insert_indices array cannot be empty"
48024
48095
  },
48025
48096
  {
48026
- code: 6101,
48097
+ code: 6103,
48027
48098
  name: "TooManyCloseInsertIndices",
48028
48099
  msg: "close_insert_indices array cannot exceed 20 elements"
48029
48100
  },
48030
48101
  {
48031
- code: 6102,
48102
+ code: 6104,
48032
48103
  name: "CloseOrderNotFound",
48033
48104
  msg: "Specified close order not found"
48034
48105
  },
48035
48106
  {
48036
- code: 6103,
48107
+ code: 6105,
48037
48108
  name: "LinkedListDeleteCountMismatch",
48038
48109
  msg: "Linked list delete count mismatch: count inconsistent before/after deletion"
48039
48110
  },
48040
48111
  {
48041
- code: 6104,
48112
+ code: 6106,
48042
48113
  name: "NameTooLong",
48043
48114
  msg: "Token name too long, max 32 bytes"
48044
48115
  },
48045
48116
  {
48046
- code: 6105,
48117
+ code: 6107,
48047
48118
  name: "NameEmpty",
48048
48119
  msg: "Token name cannot be empty"
48049
48120
  },
48050
48121
  {
48051
- code: 6106,
48122
+ code: 6108,
48052
48123
  name: "SymbolTooLong",
48053
48124
  msg: "Token symbol too long, max 10 bytes"
48054
48125
  },
48055
48126
  {
48056
- code: 6107,
48127
+ code: 6109,
48057
48128
  name: "SymbolEmpty",
48058
48129
  msg: "Token symbol cannot be empty"
48059
48130
  },
48060
48131
  {
48061
- code: 6108,
48132
+ code: 6110,
48062
48133
  name: "UriTooLong",
48063
48134
  msg: "URI too long, max 200 bytes"
48064
48135
  },
48065
48136
  {
48066
- code: 6109,
48137
+ code: 6111,
48067
48138
  name: "UriEmpty",
48068
48139
  msg: "URI cannot be empty"
48069
48140
  },
48070
48141
  {
48071
- code: 6110,
48142
+ code: 6112,
48072
48143
  name: "IncompleteAdvancedPoolParams",
48073
48144
  msg: "Incomplete advanced pool parameters: custom_lp_sol, custom_lp_token, custom_borrow_ratio, custom_borrow_duration must be provided together"
48074
48145
  },
48075
48146
  {
48076
- code: 6111,
48147
+ code: 6113,
48077
48148
  name: "InvalidInitialVirtualSol",
48078
48149
  msg: "Initial virtual SOL out of valid range"
48079
48150
  },
48080
48151
  {
48081
- code: 6112,
48152
+ code: 6114,
48082
48153
  name: "InvalidInitialVirtualToken",
48083
48154
  msg: "Initial virtual Token out of valid range"
48084
48155
  },
48085
48156
  {
48086
- code: 6113,
48157
+ code: 6115,
48087
48158
  name: "InvalidBorrowPoolRatio",
48088
48159
  msg: "Borrow pool ratio out of valid range"
48089
48160
  },
48090
48161
  {
48091
- code: 6114,
48162
+ code: 6116,
48092
48163
  name: "BorrowTokenCalculationOverflow",
48093
48164
  msg: "Borrow pool token amount calculation overflow"
48094
48165
  },
48095
48166
  {
48096
- code: 6115,
48167
+ code: 6117,
48097
48168
  name: "BorrowTokenAmountZero",
48098
48169
  msg: "Borrow pool token amount cannot be zero"
48099
48170
  }
@@ -48240,8 +48311,10 @@
48240
48311
  name: "pool_type",
48241
48312
  docs: [
48242
48313
  "Pool type",
48243
- "0 = Basic version (uses default parameters, supports fee halving)",
48244
- "1 = Advanced version (custom parameters, fees never halved)"
48314
+ "0 = Basic version (uses default parameters)",
48315
+ "1 = Advanced version (custom parameters)",
48316
+ "Note: BOTH pool types participate in fee halving milestones",
48317
+ "(dynamic thresholds at 100x/1000x/10000x of the pool's own initial price)"
48245
48318
  ],
48246
48319
  type: "u8"
48247
48320
  },
@@ -48249,8 +48322,8 @@
48249
48322
  name: "borrow_pool_ratio",
48250
48323
  docs: [
48251
48324
  "Borrow pool token ratio (recorded only for information display)",
48252
- "Actual value range: 5-30 (represents 5%-30%)",
48253
- "Basic version fixed at 20"
48325
+ "Actual value range: 2-8 (represents 2%-8%, deducted from total supply)",
48326
+ "Basic version fixed at 4"
48254
48327
  ],
48255
48328
  type: "u8"
48256
48329
  }
@@ -49040,8 +49113,8 @@
49040
49113
  network: 'mainnet',
49041
49114
  programId: 'sGecRTjTZmnqJBmLK4ZMNCzsaMrgkFfNqEcYk1GhRde',
49042
49115
  defaultDataSource: 'fast',
49043
- solanaEndpoint: 'https://solana-rpc.pinpet.fun',
49044
- fastApiUrl: 'https://api.pinpet.fun/',
49116
+ solanaEndpoint: 'https://solana-rpc.100x.fun',
49117
+ fastApiUrl: 'https://api.100x.fun/',
49045
49118
  feeRecipient: 'CmDe8JRAPJ7QpZNCb4ArVEyzyxYoCNL7WZw5qXLePULn',
49046
49119
  baseFeeRecipient: '2xhAfEfnH8wg7ZGujSijJi4Zt4ge1ZuwMypo7etntgXA',
49047
49120
  paramsAccount: 'CJSn3n4MVCg4qWQ7qb2nxzosYwfcRyBvmwhtM77ugu1V'
@@ -49052,7 +49125,7 @@
49052
49125
  programId: 'sGecRTjTZmnqJBmLK4ZMNCzsaMrgkFfNqEcYk1GhRde',
49053
49126
  defaultDataSource: 'fast',
49054
49127
  solanaEndpoint: 'https://lu-ura5lv-fast-devnet.helius-rpc.com',
49055
- fastApiUrl: 'https://devtestapi.pinpet.fun',
49128
+ fastApiUrl: 'https://devtestapi.100x.fun',
49056
49129
  feeRecipient: 'GesAj2dTn2wdNcxj4x8qsqS9aNRVPBPkE76aaqg7skxu',
49057
49130
  baseFeeRecipient: '5YHi1HsxobLiTD6NQfHJQpoPoRjMuNyXp4RroTvR6dKi',
49058
49131
  paramsAccount: 'Ckz5CmbpyKtKmwgw7NDLzFnVACxekWqrX8i6vhCyLkqY'
@@ -49064,8 +49137,6 @@
49064
49137
  defaultDataSource: 'fast', // 'fast' or 'chain'
49065
49138
  solanaEndpoint: 'http://127.0.0.1:8899',
49066
49139
  fastApiUrl: 'http://127.0.0.1:3000',
49067
- // solanaEndpoint: 'http://216.158.231.58:8899',
49068
- // fastApiUrl: 'http://216.158.231.58:3000',
49069
49140
  feeRecipient: 'GesAj2dTn2wdNcxj4x8qsqS9aNRVPBPkE76aaqg7skxu',
49070
49141
  baseFeeRecipient: '5YHi1HsxobLiTD6NQfHJQpoPoRjMuNyXp4RroTvR6dKi',
49071
49142
  paramsAccount: 'HPuvtLLcgSMPSyRmULPiFe9oAvm1o8mR4weqXZrUhzRM'