100x-sdk 1.0.3 → 1.0.5

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Connection, PublicKey, Transaction, Keypair } from '@solana/web3.js';
2
2
  import { BN, Wallet, Program } from '@coral-xyz/anchor';
3
3
 
4
- // ========================= 基础类型定义 =========================
4
+ // ========================= Basic Type Definitions =========================
5
5
 
6
6
  export type DataSourceType = 'fast' | 'chain';
7
7
 
@@ -29,7 +29,7 @@ export interface Fun100xSdkOptions {
29
29
  paramsAccount?: string;
30
30
  }
31
31
 
32
- // ========================= 订单和交易相关类型 =========================
32
+ // ========================= Order and Trading Related Types =========================
33
33
 
34
34
  export interface OrderData {
35
35
  order_pda: string;
@@ -89,7 +89,7 @@ export interface MintInfo {
89
89
  [key: string]: any;
90
90
  }
91
91
 
92
- // ========================= 交易参数类型 =========================
92
+ // ========================= Trading Parameter Types =========================
93
93
 
94
94
  export interface BuyParams {
95
95
  mintAccount: string | PublicKey;
@@ -147,7 +147,7 @@ export interface TransactionOptions {
147
147
  computeUnits?: number;
148
148
  }
149
149
 
150
- // ========================= 查询参数类型 =========================
150
+ // ========================= Query Parameter Types =========================
151
151
 
152
152
  export interface OrdersQueryOptions {
153
153
  type?: 'up_orders' | 'down_orders';
@@ -167,7 +167,7 @@ export interface UserOrdersQueryOptions {
167
167
  dataSource?: DataSourceType;
168
168
  }
169
169
 
170
- // ========================= 模拟器相关类型 =========================
170
+ // ========================= Simulator Related Types =========================
171
171
 
172
172
  export interface SimulationResult {
173
173
  liqResult: {
@@ -187,7 +187,7 @@ export interface SimulationResult {
187
187
  suggestedSolAmount: string;
188
188
  }
189
189
 
190
- // ========================= 工具类相关类型 =========================
190
+ // ========================= Utility Related Types =========================
191
191
 
192
192
  export interface FindPrevNextResult {
193
193
  prevOrder: OrderData | null;
@@ -200,7 +200,7 @@ export interface ValidationResult {
200
200
  warnings: string[];
201
201
  }
202
202
 
203
- // ========================= 模块接口定义 =========================
203
+ // ========================= Module Interface Definitions =========================
204
204
 
205
205
  export interface TradingModule {
206
206
  buy(params: BuyParams, options?: TransactionOptions): Promise<TransactionResult>;
@@ -242,14 +242,14 @@ export interface SimulatorModule {
242
242
  simulateSellStopLoss(mint: string, sellTokenAmount: bigint | string | number, stopLossPrice: bigint | string | number, lastPrice?: any, ordersData?: any): Promise<any>;
243
243
  }
244
244
 
245
- // ========================= 数据接口类型 =========================
245
+ // ========================= Data Interface Types =========================
246
246
 
247
247
  export interface DataInterface {
248
248
  orders(mint: string, options?: OrdersQueryOptions): Promise<OrdersResponse>;
249
249
  price(mint: string, options?: PriceQueryOptions): Promise<PriceResponse>;
250
250
  }
251
251
 
252
- // ========================= 主 SDK 类型定义 =========================
252
+ // ========================= Main SDK Type Definition =========================
253
253
 
254
254
  export declare class Fun100xSdk {
255
255
  connection: Connection;
@@ -262,12 +262,12 @@ export declare class Fun100xSdk {
262
262
  paramsAccount: PublicKey;
263
263
  fastApiUrl: string;
264
264
 
265
- // 常量
265
+ // Constants
266
266
  readonly MAX_ORDERS_COUNT: number;
267
267
  readonly FIND_MAX_ORDERS_COUNT: number;
268
268
  readonly SUGGEST_LIQ_RATIO: number;
269
269
 
270
- // 模块
270
+ // Modules
271
271
  trading: TradingModule;
272
272
  fast: FastModule;
273
273
  chain: ChainModule;
@@ -276,7 +276,7 @@ export declare class Fun100xSdk {
276
276
  simulator: SimulatorModule;
277
277
  data: DataInterface;
278
278
 
279
- // 静态工具类引用
279
+ // Static utility class references
280
280
  static CurveAMM: typeof CurveAMM;
281
281
  static OrderUtils: typeof OrderUtils;
282
282
 
@@ -286,14 +286,14 @@ export declare class Fun100xSdk {
286
286
  options?: Fun100xSdkOptions
287
287
  );
288
288
 
289
- // OrderUtils 快捷方法
289
+ // OrderUtils shortcut methods
290
290
  buildLpPairs(orders: OrderData[], direction: string, price: any, maxCount?: number): LpPair[];
291
291
  buildOrderAccounts(orders: OrderData[], maxCount?: number): (string | null)[];
292
292
  findPrevNext(orders: OrderData[], findOrderPda: string): FindPrevNextResult;
293
293
  findOrderIndex(orders: OrderData[], targetOrderPda: string | PublicKey | null): number;
294
294
  }
295
295
 
296
- // ========================= 工具类导出 =========================
296
+ // ========================= Utility Class Exports =========================
297
297
 
298
298
  export declare class OrderUtils {
299
299
  static buildLpPairs(orders: OrderData[], direction: string, price: any, maxCount?: number): LpPair[];
@@ -336,7 +336,7 @@ export declare class CurveAMM {
336
336
  static calculateInitialK(): any;
337
337
  static getInitialPrice(): bigint | null;
338
338
 
339
- // Custom pool parameters calculation (动态流动池)
339
+ // Custom pool parameters calculation (dynamic liquidity pool)
340
340
  static calculateK(initialVirtualSol: any, initialVirtualToken: any): any;
341
341
  static getInitialPriceWithParams(initialVirtualSol: any, initialVirtualToken: any): bigint | null;
342
342
 
@@ -349,7 +349,7 @@ export declare class CurveAMM {
349
349
  static buyFromPriceWithTokenOutput(startLowPrice: bigint | string | number, tokenOutputAmount: bigint | string | number): [bigint, bigint] | null;
350
350
  static sellFromPriceWithSolOutput(startHighPrice: bigint | string | number, solOutputAmount: bigint | string | number): [bigint, bigint] | null;
351
351
 
352
- // AMM calculation methods with custom pool parameters (动态流动池)
352
+ // AMM calculation methods with custom pool parameters (dynamic liquidity pool)
353
353
  static priceToReservesWithParams(price: any, initialVirtualSol: any, initialVirtualToken: any): [any, any] | null;
354
354
  static buyFromPriceToPriceWithParams(startLowPrice: bigint | string | number, endHighPrice: bigint | string | number, initialVirtualSol: any, initialVirtualToken: any): [bigint, bigint] | null;
355
355
  static sellFromPriceToPriceWithParams(startHighPrice: bigint | string | number, endLowPrice: bigint | string | number, initialVirtualSol: any, initialVirtualToken: any): [bigint, bigint] | null;
@@ -365,7 +365,7 @@ export declare class CurveAMM {
365
365
  static calculatePoolPrice(lpTokenReserve: bigint | string | number | BN, lpSolReserve: bigint | string | number | BN): string | null;
366
366
  }
367
367
 
368
- // ========================= 常量和函数导出 =========================
368
+ // ========================= Constant and Function Exports =========================
369
369
 
370
370
  export declare const FUN100X_PROGRAM_ID: PublicKey;
371
371
 
@@ -373,7 +373,7 @@ export declare function getProgramId(network?: NetworkType): PublicKey;
373
373
 
374
374
  export declare function getDefaultOptions(networkName?: 'MAINNET' | 'DEVNET' | 'LOCALNET'): NetworkConfig;
375
375
 
376
- // ========================= 模块类导出 =========================
376
+ // ========================= Module Class Exports =========================
377
377
 
378
378
  export declare class TradingModule implements TradingModule {}
379
379
  export declare class FastModule implements FastModule {}
@@ -382,5 +382,5 @@ export declare class TokenModule implements TokenModule {}
382
382
  export declare class ParamModule implements ParamModule {}
383
383
  export declare class SimulatorModule implements SimulatorModule {}
384
384
 
385
- // 默认导出
385
+ // Default export
386
386
  export default Fun100xSdk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "100x-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Solana 100x.fun SDK",
5
5
  "main": "dist/100x-sdk.cjs.js",
6
6
  "module": "dist/100x-sdk.esm.js",
@@ -1,5 +1,5 @@
1
1
  {
2
- "address": "sGecRTjTZmnqJBmLK4ZMNCzsaMrgkFfNqEcYk1GhRde",
2
+ "address": "EVNaaiyg9z876PUmLCVQcdc5L5eJukT4pni5GtVJ8P37",
3
3
  "metadata": {
4
4
  "name": "fun100x",
5
5
  "version": "0.1.0",
@@ -3013,271 +3013,281 @@
3013
3013
  },
3014
3014
  {
3015
3015
  "code": 6062,
3016
+ "name": "InsufficientLongPayerBalance",
3017
+ "msg": "Payer wallet balance insufficient for long margin and fees"
3018
+ },
3019
+ {
3020
+ "code": 6063,
3021
+ "name": "InsufficientShortPayerBalance",
3022
+ "msg": "Payer wallet balance insufficient for short margin and fees"
3023
+ },
3024
+ {
3025
+ "code": 6064,
3016
3026
  "name": "InvalidAccountOwner",
3017
3027
  "msg": "Invalid account owner"
3018
3028
  },
3019
3029
  {
3020
- "code": 6063,
3030
+ "code": 6065,
3021
3031
  "name": "SellAmountExceedsOrderAmount",
3022
3032
  "msg": "Sell amount exceeds order's token holdings"
3023
3033
  },
3024
3034
  {
3025
- "code": 6064,
3035
+ "code": 6066,
3026
3036
  "name": "OrderNotExpiredMustCloseByOwner",
3027
3037
  "msg": "Non-expired order must be closed by owner"
3028
3038
  },
3029
3039
  {
3030
- "code": 6065,
3040
+ "code": 6067,
3031
3041
  "name": "SettlementAddressMustBeOwnerAddress",
3032
3042
  "msg": "Settlement address must be owner address"
3033
3043
  },
3034
3044
  {
3035
- "code": 6066,
3045
+ "code": 6068,
3036
3046
  "name": "BuyAmountExceedsOrderAmount",
3037
3047
  "msg": "Buy amount exceeds order's token holdings"
3038
3048
  },
3039
3049
  {
3040
- "code": 6067,
3050
+ "code": 6069,
3041
3051
  "name": "InsufficientTradeAmount",
3042
3052
  "msg": "Trade amount below minimum requirement"
3043
3053
  },
3044
3054
  {
3045
- "code": 6068,
3055
+ "code": 6070,
3046
3056
  "name": "SolAmountTooLarge",
3047
3057
  "msg": "SOL amount exceeds maximum limit (10000000 SOL per transaction)"
3048
3058
  },
3049
3059
  {
3050
- "code": 6069,
3060
+ "code": 6071,
3051
3061
  "name": "RemainingTokenAmountTooSmall",
3052
3062
  "msg": "Remaining token amount below minimum trade requirement"
3053
3063
  },
3054
3064
  {
3055
- "code": 6070,
3065
+ "code": 6072,
3056
3066
  "name": "TradeCooldownNotExpired",
3057
3067
  "msg": "Trade cooldown period not expired, please try again later"
3058
3068
  },
3059
3069
  {
3060
- "code": 6071,
3070
+ "code": 6073,
3061
3071
  "name": "ExceedApprovalAmount",
3062
3072
  "msg": "Sell amount exceeds approved amount, please call approval function first"
3063
3073
  },
3064
3074
  {
3065
- "code": 6072,
3075
+ "code": 6074,
3066
3076
  "name": "CooldownNotInitialized",
3067
3077
  "msg": "Sell trade requires calling approval or buy function first to initialize cooldown PDA"
3068
3078
  },
3069
3079
  {
3070
- "code": 6073,
3080
+ "code": 6075,
3071
3081
  "name": "CannotCloseCooldownWithBalance",
3072
3082
  "msg": "Cannot close cooldown PDA with non-zero token balance"
3073
3083
  },
3074
3084
  {
3075
- "code": 6074,
3085
+ "code": 6076,
3076
3086
  "name": "PriceCalculationError",
3077
3087
  "msg": "Price calculation error"
3078
3088
  },
3079
3089
  {
3080
- "code": 6075,
3090
+ "code": 6077,
3081
3091
  "name": "InvalidPartnerFeeRecipientAccount",
3082
3092
  "msg": "Invalid partner fee recipient account"
3083
3093
  },
3084
3094
  {
3085
- "code": 6076,
3095
+ "code": 6078,
3086
3096
  "name": "InvalidBaseFeeRecipientAccount",
3087
3097
  "msg": "Invalid base fee recipient account"
3088
3098
  },
3089
3099
  {
3090
- "code": 6077,
3100
+ "code": 6079,
3091
3101
  "name": "InvalidOrderbookAddress",
3092
3102
  "msg": "Orderbook address does not match curve account orderbook"
3093
3103
  },
3094
3104
  {
3095
- "code": 6078,
3105
+ "code": 6080,
3096
3106
  "name": "InvalidFeePercentage",
3097
3107
  "msg": "Fee percentage must be between 0-100"
3098
3108
  },
3099
3109
  {
3100
- "code": 6079,
3110
+ "code": 6081,
3101
3111
  "name": "InvalidFeeRate",
3102
3112
  "msg": "Fee rate exceeds maximum limit (10%)"
3103
3113
  },
3104
3114
  {
3105
- "code": 6080,
3115
+ "code": 6082,
3106
3116
  "name": "InvalidCustomFeeRate",
3107
3117
  "msg": "Custom fee rate must be between 1000 (1%) and 5000 (5%)"
3108
3118
  },
3109
3119
  {
3110
- "code": 6081,
3120
+ "code": 6083,
3111
3121
  "name": "InvalidBorrowDuration",
3112
3122
  "msg": "Borrow duration out of valid range (3-30 days)"
3113
3123
  },
3114
3124
  {
3115
- "code": 6082,
3125
+ "code": 6084,
3116
3126
  "name": "InvalidStopLossPrice",
3117
3127
  "msg": "Stop loss price does not meet minimum interval requirement"
3118
3128
  },
3119
3129
  {
3120
- "code": 6083,
3130
+ "code": 6085,
3121
3131
  "name": "NoProfitableFunds",
3122
3132
  "msg": "No profitable funds to transfer"
3123
3133
  },
3124
3134
  {
3125
- "code": 6084,
3135
+ "code": 6086,
3126
3136
  "name": "InsufficientPoolFunds",
3127
3137
  "msg": "Insufficient pool funds"
3128
3138
  },
3129
3139
  {
3130
- "code": 6085,
3140
+ "code": 6087,
3131
3141
  "name": "InsufficientPoolBalance",
3132
3142
  "msg": "Pool SOL account balance would fall below minimum required balance"
3133
3143
  },
3134
3144
  {
3135
- "code": 6086,
3145
+ "code": 6088,
3136
3146
  "name": "OrderBookManagerOverflow",
3137
3147
  "msg": "Math operation overflow"
3138
3148
  },
3139
3149
  {
3140
- "code": 6087,
3150
+ "code": 6089,
3141
3151
  "name": "OrderBookManagerInvalidSlotIndex",
3142
3152
  "msg": "Invalid slot index"
3143
3153
  },
3144
3154
  {
3145
- "code": 6088,
3155
+ "code": 6090,
3146
3156
  "name": "OrderBookManagerInvalidAccountData",
3147
3157
  "msg": "Invalid account data"
3148
3158
  },
3149
3159
  {
3150
- "code": 6089,
3160
+ "code": 6091,
3151
3161
  "name": "OrderBookManagerExceedsMaxCapacity",
3152
3162
  "msg": "New capacity exceeds maximum limit"
3153
3163
  },
3154
3164
  {
3155
- "code": 6090,
3165
+ "code": 6092,
3156
3166
  "name": "OrderBookManagerExceedsAccountSizeLimit",
3157
3167
  "msg": "Account size exceeds 10MB limit"
3158
3168
  },
3159
3169
  {
3160
- "code": 6091,
3170
+ "code": 6093,
3161
3171
  "name": "OrderBookManagerOrderIdMismatch",
3162
3172
  "msg": "Order ID mismatch"
3163
3173
  },
3164
3174
  {
3165
- "code": 6092,
3175
+ "code": 6094,
3166
3176
  "name": "OrderBookManagerEmptyOrderBook",
3167
3177
  "msg": "Order book is empty"
3168
3178
  },
3169
3179
  {
3170
- "code": 6093,
3180
+ "code": 6095,
3171
3181
  "name": "OrderBookManagerAccountNotWritable",
3172
3182
  "msg": "Account is not writable"
3173
3183
  },
3174
3184
  {
3175
- "code": 6094,
3185
+ "code": 6096,
3176
3186
  "name": "OrderBookManagerNotRentExempt",
3177
3187
  "msg": "Account not rent-exempt"
3178
3188
  },
3179
3189
  {
3180
- "code": 6095,
3190
+ "code": 6097,
3181
3191
  "name": "OrderBookManagerInvalidRentBalance",
3182
3192
  "msg": "Invalid rent balance"
3183
3193
  },
3184
3194
  {
3185
- "code": 6096,
3195
+ "code": 6098,
3186
3196
  "name": "OrderBookManagerInsufficientFunds",
3187
3197
  "msg": "Insufficient funds"
3188
3198
  },
3189
3199
  {
3190
- "code": 6097,
3200
+ "code": 6099,
3191
3201
  "name": "OrderBookManagerInvalidAccountOwner",
3192
3202
  "msg": "OrderBook account owner mismatch"
3193
3203
  },
3194
3204
  {
3195
- "code": 6098,
3205
+ "code": 6100,
3196
3206
  "name": "OrderBookManagerDataOutOfBounds",
3197
3207
  "msg": "Data access out of bounds"
3198
3208
  },
3199
3209
  {
3200
- "code": 6099,
3210
+ "code": 6101,
3201
3211
  "name": "NoValidInsertPosition",
3202
3212
  "msg": "Cannot find valid insert position, all candidates failed due to price range overlap"
3203
3213
  },
3204
3214
  {
3205
- "code": 6100,
3215
+ "code": 6102,
3206
3216
  "name": "EmptyCloseInsertIndices",
3207
3217
  "msg": "close_insert_indices array cannot be empty"
3208
3218
  },
3209
3219
  {
3210
- "code": 6101,
3220
+ "code": 6103,
3211
3221
  "name": "TooManyCloseInsertIndices",
3212
3222
  "msg": "close_insert_indices array cannot exceed 20 elements"
3213
3223
  },
3214
3224
  {
3215
- "code": 6102,
3225
+ "code": 6104,
3216
3226
  "name": "CloseOrderNotFound",
3217
3227
  "msg": "Specified close order not found"
3218
3228
  },
3219
3229
  {
3220
- "code": 6103,
3230
+ "code": 6105,
3221
3231
  "name": "LinkedListDeleteCountMismatch",
3222
3232
  "msg": "Linked list delete count mismatch: count inconsistent before/after deletion"
3223
3233
  },
3224
3234
  {
3225
- "code": 6104,
3235
+ "code": 6106,
3226
3236
  "name": "NameTooLong",
3227
3237
  "msg": "Token name too long, max 32 bytes"
3228
3238
  },
3229
3239
  {
3230
- "code": 6105,
3240
+ "code": 6107,
3231
3241
  "name": "NameEmpty",
3232
3242
  "msg": "Token name cannot be empty"
3233
3243
  },
3234
3244
  {
3235
- "code": 6106,
3245
+ "code": 6108,
3236
3246
  "name": "SymbolTooLong",
3237
3247
  "msg": "Token symbol too long, max 10 bytes"
3238
3248
  },
3239
3249
  {
3240
- "code": 6107,
3250
+ "code": 6109,
3241
3251
  "name": "SymbolEmpty",
3242
3252
  "msg": "Token symbol cannot be empty"
3243
3253
  },
3244
3254
  {
3245
- "code": 6108,
3255
+ "code": 6110,
3246
3256
  "name": "UriTooLong",
3247
3257
  "msg": "URI too long, max 200 bytes"
3248
3258
  },
3249
3259
  {
3250
- "code": 6109,
3260
+ "code": 6111,
3251
3261
  "name": "UriEmpty",
3252
3262
  "msg": "URI cannot be empty"
3253
3263
  },
3254
3264
  {
3255
- "code": 6110,
3265
+ "code": 6112,
3256
3266
  "name": "IncompleteAdvancedPoolParams",
3257
3267
  "msg": "Incomplete advanced pool parameters: custom_lp_sol, custom_lp_token, custom_borrow_ratio, custom_borrow_duration must be provided together"
3258
3268
  },
3259
3269
  {
3260
- "code": 6111,
3270
+ "code": 6113,
3261
3271
  "name": "InvalidInitialVirtualSol",
3262
3272
  "msg": "Initial virtual SOL out of valid range"
3263
3273
  },
3264
3274
  {
3265
- "code": 6112,
3275
+ "code": 6114,
3266
3276
  "name": "InvalidInitialVirtualToken",
3267
3277
  "msg": "Initial virtual Token out of valid range"
3268
3278
  },
3269
3279
  {
3270
- "code": 6113,
3280
+ "code": 6115,
3271
3281
  "name": "InvalidBorrowPoolRatio",
3272
3282
  "msg": "Borrow pool ratio out of valid range"
3273
3283
  },
3274
3284
  {
3275
- "code": 6114,
3285
+ "code": 6116,
3276
3286
  "name": "BorrowTokenCalculationOverflow",
3277
3287
  "msg": "Borrow pool token amount calculation overflow"
3278
3288
  },
3279
3289
  {
3280
- "code": 6115,
3290
+ "code": 6117,
3281
3291
  "name": "BorrowTokenAmountZero",
3282
3292
  "msg": "Borrow pool token amount cannot be zero"
3283
3293
  }
@@ -3424,8 +3434,10 @@
3424
3434
  "name": "pool_type",
3425
3435
  "docs": [
3426
3436
  "Pool type",
3427
- "0 = Basic version (uses default parameters, supports fee halving)",
3428
- "1 = Advanced version (custom parameters, fees never halved)"
3437
+ "0 = Basic version (uses default parameters)",
3438
+ "1 = Advanced version (custom parameters)",
3439
+ "Note: BOTH pool types participate in fee halving milestones",
3440
+ "(dynamic thresholds at 100x/1000x/10000x of the pool's own initial price)"
3429
3441
  ],
3430
3442
  "type": "u8"
3431
3443
  },
@@ -3433,8 +3445,8 @@
3433
3445
  "name": "borrow_pool_ratio",
3434
3446
  "docs": [
3435
3447
  "Borrow pool token ratio (recorded only for information display)",
3436
- "Actual value range: 5-30 (represents 5%-30%)",
3437
- "Basic version fixed at 20"
3448
+ "Actual value range: 2-8 (represents 2%-8%, deducted from total supply)",
3449
+ "Basic version fixed at 4"
3438
3450
  ],
3439
3451
  "type": "u8"
3440
3452
  }