@stabbleorg/mclmm-sdk 0.1.0 → 0.1.2
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/lib/api/config.d.ts +25 -0
- package/lib/api/config.d.ts.map +1 -0
- package/lib/api/index.d.ts +2 -2
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/pools.d.ts +4 -10
- package/lib/api/pools.d.ts.map +1 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/constants.d.ts +5 -65
- package/lib/constants.d.ts.map +1 -1
- package/lib/index.js +98 -157
- package/lib/index.mjs +101 -157
- package/lib/position-manager.d.ts +1 -1
- package/lib/position-manager.d.ts.map +1 -1
- package/lib/types.d.ts +23 -19
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/index.d.ts +5 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ClmmConfig } from "../types";
|
|
2
|
+
import { ClmmApiConfig } from ".";
|
|
3
|
+
export declare class ClmmConfigApi {
|
|
4
|
+
private readonly config;
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(config: ClmmApiConfig);
|
|
7
|
+
/**
|
|
8
|
+
* Fetch all configs
|
|
9
|
+
* @returns CLMM config information or null if not found
|
|
10
|
+
*/
|
|
11
|
+
getClmmConfigs(): Promise<ClmmConfig[] | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Handle API errors and convert to Error
|
|
14
|
+
* @param error - Error from axios
|
|
15
|
+
* @returns Error with appropriate message
|
|
16
|
+
*/
|
|
17
|
+
private handleApiError;
|
|
18
|
+
/**
|
|
19
|
+
* Check if error is a 404 Not Found
|
|
20
|
+
* @param error - Error to check
|
|
21
|
+
* @returns True if 404 error
|
|
22
|
+
*/
|
|
23
|
+
private isNotFoundError;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/api/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAIlC,qBAAa,aAAa;IAGZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;gBAEV,MAAM,EAAE,aAAa;IAUlD;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC;IAYpD;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAkCtB;;;;OAIG;IACH,OAAO,CAAC,eAAe;CAMxB"}
|
package/lib/api/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { ClmmConfigApi } from "./config";
|
|
1
2
|
import { PoolsApi } from "./pools";
|
|
2
3
|
export interface ClmmApiConfig {
|
|
3
4
|
/** Base URL for the API */
|
|
4
5
|
baseUrl: string;
|
|
5
|
-
/** Optional API key for authentication */
|
|
6
|
-
apiKey?: string;
|
|
7
6
|
/** Request timeout in milliseconds */
|
|
8
7
|
timeout?: number;
|
|
9
8
|
}
|
|
10
9
|
export declare class ClmmApi {
|
|
11
10
|
private readonly config;
|
|
12
11
|
readonly pools: PoolsApi;
|
|
12
|
+
readonly clmmConfig: ClmmConfigApi;
|
|
13
13
|
constructor(config: ClmmApiConfig);
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,OAAO;IAIN,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHnC,SAAgB,KAAK,EAAE,QAAQ,CAAC;IAChC,SAAgB,UAAU,EAAE,aAAa,CAAC;gBAEb,MAAM,EAAE,aAAa;CAInD"}
|
package/lib/api/pools.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from "@solana/kit";
|
|
2
|
-
import {
|
|
2
|
+
import { PoolApiData } from "../types";
|
|
3
3
|
import { ClmmApiConfig } from ".";
|
|
4
4
|
export declare class PoolsApi {
|
|
5
5
|
private readonly config;
|
|
@@ -10,25 +10,19 @@ export declare class PoolsApi {
|
|
|
10
10
|
* @param poolAddress - Pool state address
|
|
11
11
|
* @returns Pool information or null if not found
|
|
12
12
|
*/
|
|
13
|
-
getPool(poolAddress: Address): Promise<
|
|
13
|
+
getPool(poolAddress: Address): Promise<PoolApiData | null>;
|
|
14
14
|
/**
|
|
15
15
|
* Fetch all pools
|
|
16
16
|
* @returns Array of pool information
|
|
17
17
|
*/
|
|
18
|
-
getAllPools(): Promise<
|
|
18
|
+
getAllPools(): Promise<PoolApiData[]>;
|
|
19
19
|
/**
|
|
20
20
|
* Fetch pools by token pair
|
|
21
21
|
* @param tokenA - First token mint
|
|
22
22
|
* @param tokenB - Second token mint
|
|
23
23
|
* @returns Array of pool information matching the token pair
|
|
24
24
|
*/
|
|
25
|
-
getPoolsByTokenPair(tokenA: Address, tokenB: Address): Promise<
|
|
26
|
-
/**
|
|
27
|
-
* Map API response to SDK PoolInfo type
|
|
28
|
-
* @param apiPool - API pool response
|
|
29
|
-
* @returns Transformed PoolInfo object
|
|
30
|
-
*/
|
|
31
|
-
private mapApiResponseToPoolInfo;
|
|
25
|
+
getPoolsByTokenPair(tokenA: Address, tokenB: Address): Promise<PoolApiData[]>;
|
|
32
26
|
/**
|
|
33
27
|
* Handle API errors and convert to Error
|
|
34
28
|
* @param error - Error from axios
|
package/lib/api/pools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pools.d.ts","sourceRoot":"","sources":["../../src/api/pools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pools.d.ts","sourceRoot":"","sources":["../../src/api/pools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAQlC,qBAAa,QAAQ;IAGP,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;gBAEV,MAAM,EAAE,aAAa;IAUlD;;;;OAIG;IACG,OAAO,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAahE;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAS3C;;;;;OAKG;IACG,mBAAmB,CACvB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,WAAW,EAAE,CAAC;IAgBzB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAkCtB;;;;OAIG;IACH,OAAO,CAAC,eAAe;CAMxB"}
|
package/lib/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sour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E5D"}
|
package/lib/constants.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Constants and configuration values for the Stabble CLMM SDK
|
|
3
3
|
*/
|
|
4
|
-
import type
|
|
4
|
+
import { type Address } from "@solana/kit";
|
|
5
5
|
import BN from "bn.js";
|
|
6
6
|
export declare const STABBLE_CLMM_PROGRAM_ID: Address;
|
|
7
7
|
export declare const METADATA_PROGRAM_ID: Address<"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s">;
|
|
@@ -44,70 +44,6 @@ export declare const DEFAULT_CONFIG: {
|
|
|
44
44
|
readonly RETRY_DELAY: 1000;
|
|
45
45
|
};
|
|
46
46
|
export declare const TICKS_PER_ARRAY = 60;
|
|
47
|
-
export declare const PRICE_PRECISION = 1000000;
|
|
48
|
-
export declare const LIQUIDITY_PRECISION = 1000000000000;
|
|
49
|
-
export declare const FEE_PRECISION = 1000000;
|
|
50
|
-
export declare const DEFAULT_COMPUTE_UNITS = 400000;
|
|
51
|
-
export declare const PRIORITY_FEE_MICRO_LAMPORTS = 1000;
|
|
52
|
-
export declare const WELL_KNOWN_TOKENS: {
|
|
53
|
-
readonly SOL: Address;
|
|
54
|
-
readonly USDC: Address;
|
|
55
|
-
readonly USDT: Address;
|
|
56
|
-
};
|
|
57
|
-
export declare const ERROR_MESSAGES: {
|
|
58
|
-
readonly 6000: "LOK error";
|
|
59
|
-
readonly 6001: "Not approved";
|
|
60
|
-
readonly 6002: "Invalid update config flag";
|
|
61
|
-
readonly 6003: "Account lack";
|
|
62
|
-
readonly 6004: "Must collect fees and rewards before closing position";
|
|
63
|
-
readonly 6005: "Minting amount should be greater than 0";
|
|
64
|
-
readonly 6006: "Tick out of range";
|
|
65
|
-
readonly 6007: "Lower tick must be below upper tick";
|
|
66
|
-
readonly 6008: "Tick must be >= minimum tick (-443636)";
|
|
67
|
-
readonly 6009: "Tick must be <= maximum tick (443636)";
|
|
68
|
-
readonly 6010: "Tick must be divisible by tick spacing";
|
|
69
|
-
readonly 6011: "Invalid tick array account";
|
|
70
|
-
readonly 6012: "Invalid tick array boundary";
|
|
71
|
-
readonly 6013: "Square root price limit overflow";
|
|
72
|
-
readonly 6014: "sqrt_price_x64 out of range";
|
|
73
|
-
readonly 6015: "Liquidity sub delta L must be smaller than before";
|
|
74
|
-
readonly 6016: "Liquidity add delta L must be >= before";
|
|
75
|
-
readonly 6017: "Invalid liquidity when updating position";
|
|
76
|
-
readonly 6018: "Both token amounts must not be zero while supplying liquidity";
|
|
77
|
-
readonly 6019: "Liquidity insufficient";
|
|
78
|
-
readonly 6020: "Transaction too old";
|
|
79
|
-
readonly 6021: "Price slippage check failed";
|
|
80
|
-
readonly 6022: "Too little output received";
|
|
81
|
-
readonly 6023: "Too much input paid";
|
|
82
|
-
readonly 6024: "Swap amount cannot be zero";
|
|
83
|
-
readonly 6025: "Input pool vault is invalid";
|
|
84
|
-
readonly 6026: "Swap input or output amount is too small";
|
|
85
|
-
readonly 6027: "Not enough tick array accounts";
|
|
86
|
-
readonly 6028: "Invalid first tick array account";
|
|
87
|
-
readonly 6029: "Invalid reward index";
|
|
88
|
-
readonly 6030: "Reward token limit reached";
|
|
89
|
-
readonly 6031: "Reward token already in use";
|
|
90
|
-
readonly 6032: "Reward tokens must contain one of pool vault mints";
|
|
91
|
-
readonly 6033: "Invalid reward init param";
|
|
92
|
-
readonly 6034: "Invalid collect reward desired amount";
|
|
93
|
-
readonly 6035: "Invalid collect reward input account number";
|
|
94
|
-
readonly 6036: "Invalid reward period";
|
|
95
|
-
readonly 6037: "Reward emissions modification only allowed within 72 hours of cycle end";
|
|
96
|
-
readonly 6038: "Uninitialized reward info";
|
|
97
|
-
readonly 6039: "Token2022 mint extension not supported";
|
|
98
|
-
readonly 6040: "Missing tick array bitmap extension account";
|
|
99
|
-
readonly 6041: "Insufficient liquidity for this direction";
|
|
100
|
-
readonly 6042: "Max token overflow";
|
|
101
|
-
readonly 6043: "Calculate overflow";
|
|
102
|
-
readonly 6044: "Transfer fee calculation mismatch";
|
|
103
|
-
};
|
|
104
|
-
export declare const DISCRIMINATORS: {
|
|
105
|
-
readonly POOL_STATE: Uint8Array<ArrayBuffer>;
|
|
106
|
-
readonly AMM_CONFIG: Uint8Array<ArrayBuffer>;
|
|
107
|
-
readonly POSITION_STATE: Uint8Array<ArrayBuffer>;
|
|
108
|
-
readonly TICK_ARRAY_STATE: Uint8Array<ArrayBuffer>;
|
|
109
|
-
readonly OBSERVATION_STATE: Uint8Array<ArrayBuffer>;
|
|
110
|
-
};
|
|
111
47
|
export declare const PDA_SEEDS: {
|
|
112
48
|
readonly AMM_CONFIG: "amm_config";
|
|
113
49
|
readonly POOL_STATE: "pool";
|
|
@@ -119,4 +55,8 @@ export declare const PDA_SEEDS: {
|
|
|
119
55
|
readonly OPERATION: "operation";
|
|
120
56
|
readonly BITMAP_EXTENSION: "pool_tick_array_bitmap_extension";
|
|
121
57
|
};
|
|
58
|
+
export declare const API_ENDPONTS: {
|
|
59
|
+
mainnet: string;
|
|
60
|
+
devnet: string;
|
|
61
|
+
};
|
|
122
62
|
//# sourceMappingURL=constants.d.ts.map
|
package/lib/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,MAAM,OAAO,CAAC;AAIvB,eAAO,MAAM,uBAAuB,EACgB,OAAO,CAAC;AAG5D,eAAO,MAAM,mBAAmB,EACmB,OAAO,CAAC,6CAA6C,CAAC,CAAC;AAG1G,eAAO,MAAM,iBAAiB,EACU,OAAO,CAAC,kCAAkC,CAAC,CAAC;AACpF,eAAO,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 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AMM_V3_PROGRAM_ADDRESS: () => AMM_V3_PROGRAM_ADDRESS,
|
|
34
|
+
API_ENDPONTS: () => API_ENDPONTS,
|
|
34
35
|
BIT_PRECISION: () => BIT_PRECISION,
|
|
35
36
|
Clmm: () => Clmm,
|
|
36
37
|
ClmmSdk: () => ClmmSdk,
|
|
37
|
-
DEFAULT_COMPUTE_UNITS: () => DEFAULT_COMPUTE_UNITS,
|
|
38
38
|
DEFAULT_CONFIG: () => DEFAULT_CONFIG,
|
|
39
39
|
DEFAULT_DEADLINE_SECONDS: () => DEFAULT_DEADLINE_SECONDS,
|
|
40
40
|
DEFAULT_SDK_CONFIG: () => DEFAULT_SDK_CONFIG,
|
|
41
41
|
DEFAULT_SLIPPAGE_TOLERANCE: () => DEFAULT_SLIPPAGE_TOLERANCE,
|
|
42
|
-
DISCRIMINATORS: () => DISCRIMINATORS,
|
|
43
|
-
ERROR_MESSAGES: () => ERROR_MESSAGES,
|
|
44
|
-
FEE_PRECISION: () => FEE_PRECISION,
|
|
45
42
|
FEE_RATE_DENOMINATOR: () => FEE_RATE_DENOMINATOR,
|
|
46
43
|
FEE_TIERS: () => FEE_TIERS,
|
|
47
|
-
LIQUIDITY_PRECISION: () => LIQUIDITY_PRECISION,
|
|
48
44
|
LOG_B_2_X32: () => LOG_B_2_X32,
|
|
49
45
|
LOG_B_P_ERR_MARGIN_LOWER_X64: () => LOG_B_P_ERR_MARGIN_LOWER_X64,
|
|
50
46
|
LOG_B_P_ERR_MARGIN_UPPER_X64: () => LOG_B_P_ERR_MARGIN_UPPER_X64,
|
|
@@ -62,8 +58,6 @@ __export(index_exports, {
|
|
|
62
58
|
NEGATIVE_ONE: () => NEGATIVE_ONE,
|
|
63
59
|
ONE: () => ONE,
|
|
64
60
|
PDA_SEEDS: () => PDA_SEEDS,
|
|
65
|
-
PRICE_PRECISION: () => PRICE_PRECISION,
|
|
66
|
-
PRIORITY_FEE_MICRO_LAMPORTS: () => PRIORITY_FEE_MICRO_LAMPORTS,
|
|
67
61
|
PdaUtils: () => PdaUtils,
|
|
68
62
|
PoolManager: () => PoolManager,
|
|
69
63
|
PoolUtils: () => PoolUtils,
|
|
@@ -81,7 +75,6 @@ __export(index_exports, {
|
|
|
81
75
|
TickMath: () => TickMath,
|
|
82
76
|
TickUtils: () => TickUtils,
|
|
83
77
|
U64Resolution: () => U64Resolution,
|
|
84
|
-
WELL_KNOWN_TOKENS: () => WELL_KNOWN_TOKENS,
|
|
85
78
|
ZERO: () => ZERO,
|
|
86
79
|
addresstoBytes: () => addresstoBytes,
|
|
87
80
|
approximatelyEqual: () => approximatelyEqual,
|
|
@@ -97,6 +90,7 @@ __export(index_exports, {
|
|
|
97
90
|
formatAmount: () => formatAmount,
|
|
98
91
|
generated: () => generated_exports,
|
|
99
92
|
getAmmV3ErrorMessage: () => getAmmV3ErrorMessage,
|
|
93
|
+
getApisFromEndpoint: () => getApisFromEndpoint,
|
|
100
94
|
getClosePositionInstruction: () => getClosePositionInstruction,
|
|
101
95
|
getCreateAmmConfigInstruction: () => getCreateAmmConfigInstruction,
|
|
102
96
|
getCreatePoolInstruction: () => getCreatePoolInstruction,
|
|
@@ -6392,71 +6386,6 @@ var DEFAULT_CONFIG = {
|
|
|
6392
6386
|
// 1 second
|
|
6393
6387
|
};
|
|
6394
6388
|
var TICKS_PER_ARRAY = 60;
|
|
6395
|
-
var PRICE_PRECISION = 1e6;
|
|
6396
|
-
var LIQUIDITY_PRECISION = 1e12;
|
|
6397
|
-
var FEE_PRECISION = 1e6;
|
|
6398
|
-
var DEFAULT_COMPUTE_UNITS = 4e5;
|
|
6399
|
-
var PRIORITY_FEE_MICRO_LAMPORTS = 1e3;
|
|
6400
|
-
var WELL_KNOWN_TOKENS = {
|
|
6401
|
-
SOL: "So11111111111111111111111111111111111111112",
|
|
6402
|
-
USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
6403
|
-
USDT: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
|
|
6404
|
-
// Add more as needed
|
|
6405
|
-
};
|
|
6406
|
-
var ERROR_MESSAGES = {
|
|
6407
|
-
6e3: "LOK error",
|
|
6408
|
-
6001: "Not approved",
|
|
6409
|
-
6002: "Invalid update config flag",
|
|
6410
|
-
6003: "Account lack",
|
|
6411
|
-
6004: "Must collect fees and rewards before closing position",
|
|
6412
|
-
6005: "Minting amount should be greater than 0",
|
|
6413
|
-
6006: "Tick out of range",
|
|
6414
|
-
6007: "Lower tick must be below upper tick",
|
|
6415
|
-
6008: "Tick must be >= minimum tick (-443636)",
|
|
6416
|
-
6009: "Tick must be <= maximum tick (443636)",
|
|
6417
|
-
6010: "Tick must be divisible by tick spacing",
|
|
6418
|
-
6011: "Invalid tick array account",
|
|
6419
|
-
6012: "Invalid tick array boundary",
|
|
6420
|
-
6013: "Square root price limit overflow",
|
|
6421
|
-
6014: "sqrt_price_x64 out of range",
|
|
6422
|
-
6015: "Liquidity sub delta L must be smaller than before",
|
|
6423
|
-
6016: "Liquidity add delta L must be >= before",
|
|
6424
|
-
6017: "Invalid liquidity when updating position",
|
|
6425
|
-
6018: "Both token amounts must not be zero while supplying liquidity",
|
|
6426
|
-
6019: "Liquidity insufficient",
|
|
6427
|
-
6020: "Transaction too old",
|
|
6428
|
-
6021: "Price slippage check failed",
|
|
6429
|
-
6022: "Too little output received",
|
|
6430
|
-
6023: "Too much input paid",
|
|
6431
|
-
6024: "Swap amount cannot be zero",
|
|
6432
|
-
6025: "Input pool vault is invalid",
|
|
6433
|
-
6026: "Swap input or output amount is too small",
|
|
6434
|
-
6027: "Not enough tick array accounts",
|
|
6435
|
-
6028: "Invalid first tick array account",
|
|
6436
|
-
6029: "Invalid reward index",
|
|
6437
|
-
6030: "Reward token limit reached",
|
|
6438
|
-
6031: "Reward token already in use",
|
|
6439
|
-
6032: "Reward tokens must contain one of pool vault mints",
|
|
6440
|
-
6033: "Invalid reward init param",
|
|
6441
|
-
6034: "Invalid collect reward desired amount",
|
|
6442
|
-
6035: "Invalid collect reward input account number",
|
|
6443
|
-
6036: "Invalid reward period",
|
|
6444
|
-
6037: "Reward emissions modification only allowed within 72 hours of cycle end",
|
|
6445
|
-
6038: "Uninitialized reward info",
|
|
6446
|
-
6039: "Token2022 mint extension not supported",
|
|
6447
|
-
6040: "Missing tick array bitmap extension account",
|
|
6448
|
-
6041: "Insufficient liquidity for this direction",
|
|
6449
|
-
6042: "Max token overflow",
|
|
6450
|
-
6043: "Calculate overflow",
|
|
6451
|
-
6044: "Transfer fee calculation mismatch"
|
|
6452
|
-
};
|
|
6453
|
-
var DISCRIMINATORS = {
|
|
6454
|
-
POOL_STATE: new Uint8Array([247, 237, 227, 245, 215, 195, 222, 70]),
|
|
6455
|
-
AMM_CONFIG: new Uint8Array([218, 244, 33, 104, 203, 203, 43, 111]),
|
|
6456
|
-
POSITION_STATE: new Uint8Array([70, 111, 150, 126, 230, 15, 25, 117]),
|
|
6457
|
-
TICK_ARRAY_STATE: new Uint8Array([192, 155, 85, 205, 49, 249, 129, 42]),
|
|
6458
|
-
OBSERVATION_STATE: new Uint8Array([122, 174, 197, 53, 129, 9, 165, 132])
|
|
6459
|
-
};
|
|
6460
6389
|
var PDA_SEEDS = {
|
|
6461
6390
|
AMM_CONFIG: "amm_config",
|
|
6462
6391
|
POOL_STATE: "pool",
|
|
@@ -6468,6 +6397,12 @@ var PDA_SEEDS = {
|
|
|
6468
6397
|
OPERATION: "operation",
|
|
6469
6398
|
BITMAP_EXTENSION: "pool_tick_array_bitmap_extension"
|
|
6470
6399
|
};
|
|
6400
|
+
var STABBLE_CLMM_API_DEVNET = "https://dev-mclmm-api.stabble.org";
|
|
6401
|
+
var STABBLE_CLMM_API_MAINNET = "https://mclmm-api.stabble.org";
|
|
6402
|
+
var API_ENDPONTS = {
|
|
6403
|
+
mainnet: STABBLE_CLMM_API_MAINNET,
|
|
6404
|
+
devnet: STABBLE_CLMM_API_DEVNET
|
|
6405
|
+
};
|
|
6471
6406
|
|
|
6472
6407
|
// src/utils/math.ts
|
|
6473
6408
|
var MathUtils = class {
|
|
@@ -8234,6 +8169,12 @@ function getFakeSigner(address4) {
|
|
|
8234
8169
|
}
|
|
8235
8170
|
};
|
|
8236
8171
|
}
|
|
8172
|
+
function getApisFromEndpoint(rpc) {
|
|
8173
|
+
if ("requestAirdrop" in rpc) {
|
|
8174
|
+
return API_ENDPONTS.devnet;
|
|
8175
|
+
}
|
|
8176
|
+
return API_ENDPONTS.mainnet;
|
|
8177
|
+
}
|
|
8237
8178
|
|
|
8238
8179
|
// src/clmm.ts
|
|
8239
8180
|
var Clmm = class {
|
|
@@ -8605,12 +8546,11 @@ var PositionManager = class {
|
|
|
8605
8546
|
tickLower,
|
|
8606
8547
|
tickUpper
|
|
8607
8548
|
);
|
|
8608
|
-
const instruction = await
|
|
8549
|
+
const instruction = await getOpenPositionWithToken22NftInstructionAsync({
|
|
8609
8550
|
payer: ownerInfo.feePayer,
|
|
8610
8551
|
positionNftOwner: ownerInfo.wallet,
|
|
8611
8552
|
positionNftMint: nftMintAccount,
|
|
8612
8553
|
positionNftAccount: positionNftAccountPda,
|
|
8613
|
-
metadataAccount: metadataPda,
|
|
8614
8554
|
poolState: poolAccount.address,
|
|
8615
8555
|
protocolPosition: protocolPositionPda,
|
|
8616
8556
|
tokenAccount0: ownerInfo.tokenAccountA,
|
|
@@ -8701,12 +8641,11 @@ var PositionManager = class {
|
|
|
8701
8641
|
);
|
|
8702
8642
|
const amount0Max = base === "MintA" ? baseAmount : otherAmountMax;
|
|
8703
8643
|
const amount1Max = base === "MintA" ? otherAmountMax : baseAmount;
|
|
8704
|
-
const instruction = await
|
|
8644
|
+
const instruction = await getOpenPositionWithToken22NftInstructionAsync({
|
|
8705
8645
|
payer: ownerInfo.wallet,
|
|
8706
8646
|
positionNftOwner: ownerInfo.wallet.address,
|
|
8707
8647
|
positionNftMint: nftMintAccount,
|
|
8708
8648
|
positionNftAccount: positionNftAccountPda,
|
|
8709
|
-
metadataAccount: metadataPda,
|
|
8710
8649
|
poolState: poolAccount.address,
|
|
8711
8650
|
protocolPosition: protocolPositionPda,
|
|
8712
8651
|
tokenAccount0: ownerInfo.tokenAccountA,
|
|
@@ -9082,17 +9021,83 @@ var PositionManager = class {
|
|
|
9082
9021
|
}
|
|
9083
9022
|
};
|
|
9084
9023
|
|
|
9085
|
-
// src/api/
|
|
9024
|
+
// src/api/config.ts
|
|
9086
9025
|
var import_axios = __toESM(require("axios"));
|
|
9087
|
-
var
|
|
9026
|
+
var ClmmConfigApi = class {
|
|
9088
9027
|
constructor(config) {
|
|
9089
9028
|
this.config = config;
|
|
9090
9029
|
this.client = import_axios.default.create({
|
|
9091
9030
|
baseURL: this.config.baseUrl,
|
|
9092
9031
|
timeout: this.config.timeout ?? 1e4,
|
|
9093
9032
|
headers: {
|
|
9094
|
-
"Content-Type": "application/json"
|
|
9095
|
-
|
|
9033
|
+
"Content-Type": "application/json"
|
|
9034
|
+
}
|
|
9035
|
+
});
|
|
9036
|
+
}
|
|
9037
|
+
client;
|
|
9038
|
+
/**
|
|
9039
|
+
* Fetch all configs
|
|
9040
|
+
* @returns CLMM config information or null if not found
|
|
9041
|
+
*/
|
|
9042
|
+
async getClmmConfigs() {
|
|
9043
|
+
try {
|
|
9044
|
+
const response = await this.client.get("/clmm-configs");
|
|
9045
|
+
return response.data;
|
|
9046
|
+
} catch (error) {
|
|
9047
|
+
if (this.isNotFoundError(error)) return null;
|
|
9048
|
+
throw this.handleApiError(error);
|
|
9049
|
+
}
|
|
9050
|
+
}
|
|
9051
|
+
/**
|
|
9052
|
+
* Handle API errors and convert to Error
|
|
9053
|
+
* @param error - Error from axios
|
|
9054
|
+
* @returns Error with appropriate message
|
|
9055
|
+
*/
|
|
9056
|
+
handleApiError(error) {
|
|
9057
|
+
if (import_axios.default.isAxiosError(error)) {
|
|
9058
|
+
const axiosError = error;
|
|
9059
|
+
if (axiosError.code === "ECONNABORTED") {
|
|
9060
|
+
return new Error("API request timeout");
|
|
9061
|
+
}
|
|
9062
|
+
if (axiosError.response) {
|
|
9063
|
+
const status = axiosError.response.status;
|
|
9064
|
+
const message = axiosError.response.data?.message || axiosError.message;
|
|
9065
|
+
if (status === 404) {
|
|
9066
|
+
return new Error(`CLMM config not found: ${message}`);
|
|
9067
|
+
}
|
|
9068
|
+
if (status >= 500) {
|
|
9069
|
+
return new Error(`API server error: ${message}`);
|
|
9070
|
+
}
|
|
9071
|
+
return new Error(`API request failed: ${message}`);
|
|
9072
|
+
}
|
|
9073
|
+
if (axiosError.request) {
|
|
9074
|
+
return new Error("No response from API server");
|
|
9075
|
+
}
|
|
9076
|
+
}
|
|
9077
|
+
return new Error(
|
|
9078
|
+
`Unknown API error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
9079
|
+
);
|
|
9080
|
+
}
|
|
9081
|
+
/**
|
|
9082
|
+
* Check if error is a 404 Not Found
|
|
9083
|
+
* @param error - Error to check
|
|
9084
|
+
* @returns True if 404 error
|
|
9085
|
+
*/
|
|
9086
|
+
isNotFoundError(error) {
|
|
9087
|
+
return import_axios.default.isAxiosError(error) && error.response?.status === 404;
|
|
9088
|
+
}
|
|
9089
|
+
};
|
|
9090
|
+
|
|
9091
|
+
// src/api/pools.ts
|
|
9092
|
+
var import_axios2 = __toESM(require("axios"));
|
|
9093
|
+
var PoolsApi = class {
|
|
9094
|
+
constructor(config) {
|
|
9095
|
+
this.config = config;
|
|
9096
|
+
this.client = import_axios2.default.create({
|
|
9097
|
+
baseURL: this.config.baseUrl,
|
|
9098
|
+
timeout: this.config.timeout ?? 1e4,
|
|
9099
|
+
headers: {
|
|
9100
|
+
"Content-Type": "application/json"
|
|
9096
9101
|
}
|
|
9097
9102
|
});
|
|
9098
9103
|
}
|
|
@@ -9107,7 +9112,7 @@ var PoolsApi = class {
|
|
|
9107
9112
|
const response = await this.client.get(
|
|
9108
9113
|
`/pools/${poolAddress}`
|
|
9109
9114
|
);
|
|
9110
|
-
return
|
|
9115
|
+
return response.data.pool;
|
|
9111
9116
|
} catch (error) {
|
|
9112
9117
|
if (this.isNotFoundError(error)) return null;
|
|
9113
9118
|
throw this.handleApiError(error);
|
|
@@ -9120,7 +9125,7 @@ var PoolsApi = class {
|
|
|
9120
9125
|
async getAllPools() {
|
|
9121
9126
|
try {
|
|
9122
9127
|
const response = await this.client.get("/pools");
|
|
9123
|
-
return response.data
|
|
9128
|
+
return response.data;
|
|
9124
9129
|
} catch (error) {
|
|
9125
9130
|
throw this.handleApiError(error);
|
|
9126
9131
|
}
|
|
@@ -9139,81 +9144,19 @@ var PoolsApi = class {
|
|
|
9139
9144
|
tokenB
|
|
9140
9145
|
}
|
|
9141
9146
|
});
|
|
9142
|
-
return response.data
|
|
9147
|
+
return response.data;
|
|
9143
9148
|
} catch (error) {
|
|
9144
9149
|
if (this.isNotFoundError(error)) return [];
|
|
9145
9150
|
throw this.handleApiError(error);
|
|
9146
9151
|
}
|
|
9147
9152
|
}
|
|
9148
|
-
/**
|
|
9149
|
-
* Map API response to SDK PoolInfo type
|
|
9150
|
-
* @param apiPool - API pool response
|
|
9151
|
-
* @returns Transformed PoolInfo object
|
|
9152
|
-
*/
|
|
9153
|
-
mapApiResponseToPoolInfo(apiPool) {
|
|
9154
|
-
return {
|
|
9155
|
-
discriminator: new Uint8Array(8),
|
|
9156
|
-
bump: new Uint8Array(1),
|
|
9157
|
-
ammConfig: apiPool.address,
|
|
9158
|
-
owner: apiPool.owner,
|
|
9159
|
-
tokenMint0: apiPool.tokenMint0,
|
|
9160
|
-
tokenMint1: apiPool.tokenMint1,
|
|
9161
|
-
tokenVault0: apiPool.tokenVault0,
|
|
9162
|
-
tokenVault1: apiPool.tokenVault1,
|
|
9163
|
-
observationKey: apiPool.address,
|
|
9164
|
-
mintDecimals0: 0,
|
|
9165
|
-
mintDecimals1: 0,
|
|
9166
|
-
tickSpacing: apiPool.tickSpacing,
|
|
9167
|
-
liquidity: BigInt(0),
|
|
9168
|
-
sqrtPriceX64: BigInt(apiPool.sqrtPriceX64),
|
|
9169
|
-
tickCurrent: apiPool.tick,
|
|
9170
|
-
padding3: 0,
|
|
9171
|
-
padding4: 0,
|
|
9172
|
-
feeGrowthGlobal0X64: BigInt(0),
|
|
9173
|
-
feeGrowthGlobal1X64: BigInt(0),
|
|
9174
|
-
protocolFeesToken0: BigInt(0),
|
|
9175
|
-
protocolFeesToken1: BigInt(0),
|
|
9176
|
-
swapInAmountToken0: BigInt(0),
|
|
9177
|
-
swapOutAmountToken1: BigInt(0),
|
|
9178
|
-
swapInAmountToken1: BigInt(0),
|
|
9179
|
-
swapOutAmountToken0: BigInt(0),
|
|
9180
|
-
status: 0,
|
|
9181
|
-
padding: new Uint8Array(7),
|
|
9182
|
-
rewardInfos: [],
|
|
9183
|
-
tickArrayBitmap: [],
|
|
9184
|
-
totalFeesToken0: BigInt(0),
|
|
9185
|
-
totalFeesClaimedToken0: BigInt(0),
|
|
9186
|
-
totalFeesToken1: BigInt(0),
|
|
9187
|
-
totalFeesClaimedToken1: BigInt(0),
|
|
9188
|
-
fundFeesToken0: BigInt(0),
|
|
9189
|
-
fundFeesToken1: BigInt(0),
|
|
9190
|
-
openTime: BigInt(0),
|
|
9191
|
-
recentEpoch: BigInt(0),
|
|
9192
|
-
padding1: [],
|
|
9193
|
-
padding2: [],
|
|
9194
|
-
currentPrice: 0,
|
|
9195
|
-
tokenA: {
|
|
9196
|
-
mint: apiPool.tokenMint0,
|
|
9197
|
-
symbol: "TOKEN_A",
|
|
9198
|
-
decimals: 0
|
|
9199
|
-
},
|
|
9200
|
-
tokenB: {
|
|
9201
|
-
mint: apiPool.tokenMint1,
|
|
9202
|
-
symbol: "TOKEN_B",
|
|
9203
|
-
decimals: 0
|
|
9204
|
-
},
|
|
9205
|
-
tvl: void 0,
|
|
9206
|
-
volume24h: void 0,
|
|
9207
|
-
apy: void 0
|
|
9208
|
-
};
|
|
9209
|
-
}
|
|
9210
9153
|
/**
|
|
9211
9154
|
* Handle API errors and convert to Error
|
|
9212
9155
|
* @param error - Error from axios
|
|
9213
9156
|
* @returns Error with appropriate message
|
|
9214
9157
|
*/
|
|
9215
9158
|
handleApiError(error) {
|
|
9216
|
-
if (
|
|
9159
|
+
if (import_axios2.default.isAxiosError(error)) {
|
|
9217
9160
|
const axiosError = error;
|
|
9218
9161
|
if (axiosError.code === "ECONNABORTED") {
|
|
9219
9162
|
return new Error("API request timeout");
|
|
@@ -9243,7 +9186,7 @@ var PoolsApi = class {
|
|
|
9243
9186
|
* @returns True if 404 error
|
|
9244
9187
|
*/
|
|
9245
9188
|
isNotFoundError(error) {
|
|
9246
|
-
return
|
|
9189
|
+
return import_axios2.default.isAxiosError(error) && error.response?.status === 404;
|
|
9247
9190
|
}
|
|
9248
9191
|
};
|
|
9249
9192
|
|
|
@@ -9252,8 +9195,10 @@ var ClmmApi = class {
|
|
|
9252
9195
|
constructor(config) {
|
|
9253
9196
|
this.config = config;
|
|
9254
9197
|
this.pools = new PoolsApi(this.config);
|
|
9198
|
+
this.clmmConfig = new ClmmConfigApi(this.config);
|
|
9255
9199
|
}
|
|
9256
9200
|
pools;
|
|
9201
|
+
clmmConfig;
|
|
9257
9202
|
};
|
|
9258
9203
|
|
|
9259
9204
|
// src/client.ts
|
|
@@ -9275,7 +9220,9 @@ var ClmmSdk = class _ClmmSdk {
|
|
|
9275
9220
|
constructor(config) {
|
|
9276
9221
|
this.config = config;
|
|
9277
9222
|
this.clmm = new Clmm(config);
|
|
9278
|
-
|
|
9223
|
+
const baseUrl = getApisFromEndpoint(config.rpc);
|
|
9224
|
+
const apiConfig = config.apiConfig ? config.apiConfig : { baseUrl };
|
|
9225
|
+
this.api = new ClmmApi(apiConfig);
|
|
9279
9226
|
this.pools = new PoolManager(config);
|
|
9280
9227
|
this.positions = new PositionManager(config);
|
|
9281
9228
|
}
|
|
@@ -9317,20 +9264,16 @@ var DEFAULT_SDK_CONFIG = {
|
|
|
9317
9264
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9318
9265
|
0 && (module.exports = {
|
|
9319
9266
|
AMM_V3_PROGRAM_ADDRESS,
|
|
9267
|
+
API_ENDPONTS,
|
|
9320
9268
|
BIT_PRECISION,
|
|
9321
9269
|
Clmm,
|
|
9322
9270
|
ClmmSdk,
|
|
9323
|
-
DEFAULT_COMPUTE_UNITS,
|
|
9324
9271
|
DEFAULT_CONFIG,
|
|
9325
9272
|
DEFAULT_DEADLINE_SECONDS,
|
|
9326
9273
|
DEFAULT_SDK_CONFIG,
|
|
9327
9274
|
DEFAULT_SLIPPAGE_TOLERANCE,
|
|
9328
|
-
DISCRIMINATORS,
|
|
9329
|
-
ERROR_MESSAGES,
|
|
9330
|
-
FEE_PRECISION,
|
|
9331
9275
|
FEE_RATE_DENOMINATOR,
|
|
9332
9276
|
FEE_TIERS,
|
|
9333
|
-
LIQUIDITY_PRECISION,
|
|
9334
9277
|
LOG_B_2_X32,
|
|
9335
9278
|
LOG_B_P_ERR_MARGIN_LOWER_X64,
|
|
9336
9279
|
LOG_B_P_ERR_MARGIN_UPPER_X64,
|
|
@@ -9348,8 +9291,6 @@ var DEFAULT_SDK_CONFIG = {
|
|
|
9348
9291
|
NEGATIVE_ONE,
|
|
9349
9292
|
ONE,
|
|
9350
9293
|
PDA_SEEDS,
|
|
9351
|
-
PRICE_PRECISION,
|
|
9352
|
-
PRIORITY_FEE_MICRO_LAMPORTS,
|
|
9353
9294
|
PdaUtils,
|
|
9354
9295
|
PoolManager,
|
|
9355
9296
|
PoolUtils,
|
|
@@ -9367,7 +9308,6 @@ var DEFAULT_SDK_CONFIG = {
|
|
|
9367
9308
|
TickMath,
|
|
9368
9309
|
TickUtils,
|
|
9369
9310
|
U64Resolution,
|
|
9370
|
-
WELL_KNOWN_TOKENS,
|
|
9371
9311
|
ZERO,
|
|
9372
9312
|
addresstoBytes,
|
|
9373
9313
|
approximatelyEqual,
|
|
@@ -9383,6 +9323,7 @@ var DEFAULT_SDK_CONFIG = {
|
|
|
9383
9323
|
formatAmount,
|
|
9384
9324
|
generated,
|
|
9385
9325
|
getAmmV3ErrorMessage,
|
|
9326
|
+
getApisFromEndpoint,
|
|
9386
9327
|
getClosePositionInstruction,
|
|
9387
9328
|
getCreateAmmConfigInstruction,
|
|
9388
9329
|
getCreatePoolInstruction,
|
package/lib/index.mjs
CHANGED
|
@@ -7013,71 +7013,6 @@ var DEFAULT_CONFIG = {
|
|
|
7013
7013
|
// 1 second
|
|
7014
7014
|
};
|
|
7015
7015
|
var TICKS_PER_ARRAY = 60;
|
|
7016
|
-
var PRICE_PRECISION = 1e6;
|
|
7017
|
-
var LIQUIDITY_PRECISION = 1e12;
|
|
7018
|
-
var FEE_PRECISION = 1e6;
|
|
7019
|
-
var DEFAULT_COMPUTE_UNITS = 4e5;
|
|
7020
|
-
var PRIORITY_FEE_MICRO_LAMPORTS = 1e3;
|
|
7021
|
-
var WELL_KNOWN_TOKENS = {
|
|
7022
|
-
SOL: "So11111111111111111111111111111111111111112",
|
|
7023
|
-
USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
7024
|
-
USDT: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
|
|
7025
|
-
// Add more as needed
|
|
7026
|
-
};
|
|
7027
|
-
var ERROR_MESSAGES = {
|
|
7028
|
-
6e3: "LOK error",
|
|
7029
|
-
6001: "Not approved",
|
|
7030
|
-
6002: "Invalid update config flag",
|
|
7031
|
-
6003: "Account lack",
|
|
7032
|
-
6004: "Must collect fees and rewards before closing position",
|
|
7033
|
-
6005: "Minting amount should be greater than 0",
|
|
7034
|
-
6006: "Tick out of range",
|
|
7035
|
-
6007: "Lower tick must be below upper tick",
|
|
7036
|
-
6008: "Tick must be >= minimum tick (-443636)",
|
|
7037
|
-
6009: "Tick must be <= maximum tick (443636)",
|
|
7038
|
-
6010: "Tick must be divisible by tick spacing",
|
|
7039
|
-
6011: "Invalid tick array account",
|
|
7040
|
-
6012: "Invalid tick array boundary",
|
|
7041
|
-
6013: "Square root price limit overflow",
|
|
7042
|
-
6014: "sqrt_price_x64 out of range",
|
|
7043
|
-
6015: "Liquidity sub delta L must be smaller than before",
|
|
7044
|
-
6016: "Liquidity add delta L must be >= before",
|
|
7045
|
-
6017: "Invalid liquidity when updating position",
|
|
7046
|
-
6018: "Both token amounts must not be zero while supplying liquidity",
|
|
7047
|
-
6019: "Liquidity insufficient",
|
|
7048
|
-
6020: "Transaction too old",
|
|
7049
|
-
6021: "Price slippage check failed",
|
|
7050
|
-
6022: "Too little output received",
|
|
7051
|
-
6023: "Too much input paid",
|
|
7052
|
-
6024: "Swap amount cannot be zero",
|
|
7053
|
-
6025: "Input pool vault is invalid",
|
|
7054
|
-
6026: "Swap input or output amount is too small",
|
|
7055
|
-
6027: "Not enough tick array accounts",
|
|
7056
|
-
6028: "Invalid first tick array account",
|
|
7057
|
-
6029: "Invalid reward index",
|
|
7058
|
-
6030: "Reward token limit reached",
|
|
7059
|
-
6031: "Reward token already in use",
|
|
7060
|
-
6032: "Reward tokens must contain one of pool vault mints",
|
|
7061
|
-
6033: "Invalid reward init param",
|
|
7062
|
-
6034: "Invalid collect reward desired amount",
|
|
7063
|
-
6035: "Invalid collect reward input account number",
|
|
7064
|
-
6036: "Invalid reward period",
|
|
7065
|
-
6037: "Reward emissions modification only allowed within 72 hours of cycle end",
|
|
7066
|
-
6038: "Uninitialized reward info",
|
|
7067
|
-
6039: "Token2022 mint extension not supported",
|
|
7068
|
-
6040: "Missing tick array bitmap extension account",
|
|
7069
|
-
6041: "Insufficient liquidity for this direction",
|
|
7070
|
-
6042: "Max token overflow",
|
|
7071
|
-
6043: "Calculate overflow",
|
|
7072
|
-
6044: "Transfer fee calculation mismatch"
|
|
7073
|
-
};
|
|
7074
|
-
var DISCRIMINATORS = {
|
|
7075
|
-
POOL_STATE: new Uint8Array([247, 237, 227, 245, 215, 195, 222, 70]),
|
|
7076
|
-
AMM_CONFIG: new Uint8Array([218, 244, 33, 104, 203, 203, 43, 111]),
|
|
7077
|
-
POSITION_STATE: new Uint8Array([70, 111, 150, 126, 230, 15, 25, 117]),
|
|
7078
|
-
TICK_ARRAY_STATE: new Uint8Array([192, 155, 85, 205, 49, 249, 129, 42]),
|
|
7079
|
-
OBSERVATION_STATE: new Uint8Array([122, 174, 197, 53, 129, 9, 165, 132])
|
|
7080
|
-
};
|
|
7081
7016
|
var PDA_SEEDS = {
|
|
7082
7017
|
AMM_CONFIG: "amm_config",
|
|
7083
7018
|
POOL_STATE: "pool",
|
|
@@ -7089,6 +7024,12 @@ var PDA_SEEDS = {
|
|
|
7089
7024
|
OPERATION: "operation",
|
|
7090
7025
|
BITMAP_EXTENSION: "pool_tick_array_bitmap_extension"
|
|
7091
7026
|
};
|
|
7027
|
+
var STABBLE_CLMM_API_DEVNET = "https://dev-mclmm-api.stabble.org";
|
|
7028
|
+
var STABBLE_CLMM_API_MAINNET = "https://mclmm-api.stabble.org";
|
|
7029
|
+
var API_ENDPONTS = {
|
|
7030
|
+
mainnet: STABBLE_CLMM_API_MAINNET,
|
|
7031
|
+
devnet: STABBLE_CLMM_API_DEVNET
|
|
7032
|
+
};
|
|
7092
7033
|
|
|
7093
7034
|
// src/utils/math.ts
|
|
7094
7035
|
var MathUtils = class {
|
|
@@ -8777,7 +8718,9 @@ var PoolUtils = class {
|
|
|
8777
8718
|
};
|
|
8778
8719
|
|
|
8779
8720
|
// src/utils/index.ts
|
|
8780
|
-
import {
|
|
8721
|
+
import {
|
|
8722
|
+
getAddressEncoder as getAddressEncoder30
|
|
8723
|
+
} from "@solana/kit";
|
|
8781
8724
|
function validateAddress(address4, name = "address") {
|
|
8782
8725
|
if (!address4 || address4.length === 0) {
|
|
8783
8726
|
throw new ClmmError(
|
|
@@ -8862,6 +8805,12 @@ function getFakeSigner(address4) {
|
|
|
8862
8805
|
}
|
|
8863
8806
|
};
|
|
8864
8807
|
}
|
|
8808
|
+
function getApisFromEndpoint(rpc) {
|
|
8809
|
+
if ("requestAirdrop" in rpc) {
|
|
8810
|
+
return API_ENDPONTS.devnet;
|
|
8811
|
+
}
|
|
8812
|
+
return API_ENDPONTS.mainnet;
|
|
8813
|
+
}
|
|
8865
8814
|
|
|
8866
8815
|
// src/clmm.ts
|
|
8867
8816
|
var Clmm = class {
|
|
@@ -9178,13 +9127,8 @@ var PoolManager = class {
|
|
|
9178
9127
|
};
|
|
9179
9128
|
|
|
9180
9129
|
// src/position-manager.ts
|
|
9181
|
-
import {
|
|
9182
|
-
|
|
9183
|
-
} from "@solana/kit";
|
|
9184
|
-
import {
|
|
9185
|
-
TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS2,
|
|
9186
|
-
findAssociatedTokenPda
|
|
9187
|
-
} from "@solana-program/token";
|
|
9130
|
+
import { generateKeyPairSigner } from "@solana/kit";
|
|
9131
|
+
import { findAssociatedTokenPda, TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS2 } from "@solana-program/token";
|
|
9188
9132
|
import { TOKEN_2022_PROGRAM_ADDRESS } from "@solana-program/token-2022";
|
|
9189
9133
|
import BN6 from "bn.js";
|
|
9190
9134
|
var PositionManager = class {
|
|
@@ -9240,12 +9184,11 @@ var PositionManager = class {
|
|
|
9240
9184
|
tickLower,
|
|
9241
9185
|
tickUpper
|
|
9242
9186
|
);
|
|
9243
|
-
const instruction = await
|
|
9187
|
+
const instruction = await getOpenPositionWithToken22NftInstructionAsync({
|
|
9244
9188
|
payer: ownerInfo.feePayer,
|
|
9245
9189
|
positionNftOwner: ownerInfo.wallet,
|
|
9246
9190
|
positionNftMint: nftMintAccount,
|
|
9247
9191
|
positionNftAccount: positionNftAccountPda,
|
|
9248
|
-
metadataAccount: metadataPda,
|
|
9249
9192
|
poolState: poolAccount.address,
|
|
9250
9193
|
protocolPosition: protocolPositionPda,
|
|
9251
9194
|
tokenAccount0: ownerInfo.tokenAccountA,
|
|
@@ -9336,12 +9279,11 @@ var PositionManager = class {
|
|
|
9336
9279
|
);
|
|
9337
9280
|
const amount0Max = base === "MintA" ? baseAmount : otherAmountMax;
|
|
9338
9281
|
const amount1Max = base === "MintA" ? otherAmountMax : baseAmount;
|
|
9339
|
-
const instruction = await
|
|
9282
|
+
const instruction = await getOpenPositionWithToken22NftInstructionAsync({
|
|
9340
9283
|
payer: ownerInfo.wallet,
|
|
9341
9284
|
positionNftOwner: ownerInfo.wallet.address,
|
|
9342
9285
|
positionNftMint: nftMintAccount,
|
|
9343
9286
|
positionNftAccount: positionNftAccountPda,
|
|
9344
|
-
metadataAccount: metadataPda,
|
|
9345
9287
|
poolState: poolAccount.address,
|
|
9346
9288
|
protocolPosition: protocolPositionPda,
|
|
9347
9289
|
tokenAccount0: ownerInfo.tokenAccountA,
|
|
@@ -9717,17 +9659,83 @@ var PositionManager = class {
|
|
|
9717
9659
|
}
|
|
9718
9660
|
};
|
|
9719
9661
|
|
|
9720
|
-
// src/api/
|
|
9662
|
+
// src/api/config.ts
|
|
9721
9663
|
import axios from "axios";
|
|
9722
|
-
var
|
|
9664
|
+
var ClmmConfigApi = class {
|
|
9723
9665
|
constructor(config) {
|
|
9724
9666
|
this.config = config;
|
|
9725
9667
|
this.client = axios.create({
|
|
9726
9668
|
baseURL: this.config.baseUrl,
|
|
9727
9669
|
timeout: this.config.timeout ?? 1e4,
|
|
9728
9670
|
headers: {
|
|
9729
|
-
"Content-Type": "application/json"
|
|
9730
|
-
|
|
9671
|
+
"Content-Type": "application/json"
|
|
9672
|
+
}
|
|
9673
|
+
});
|
|
9674
|
+
}
|
|
9675
|
+
client;
|
|
9676
|
+
/**
|
|
9677
|
+
* Fetch all configs
|
|
9678
|
+
* @returns CLMM config information or null if not found
|
|
9679
|
+
*/
|
|
9680
|
+
async getClmmConfigs() {
|
|
9681
|
+
try {
|
|
9682
|
+
const response = await this.client.get("/clmm-configs");
|
|
9683
|
+
return response.data;
|
|
9684
|
+
} catch (error) {
|
|
9685
|
+
if (this.isNotFoundError(error)) return null;
|
|
9686
|
+
throw this.handleApiError(error);
|
|
9687
|
+
}
|
|
9688
|
+
}
|
|
9689
|
+
/**
|
|
9690
|
+
* Handle API errors and convert to Error
|
|
9691
|
+
* @param error - Error from axios
|
|
9692
|
+
* @returns Error with appropriate message
|
|
9693
|
+
*/
|
|
9694
|
+
handleApiError(error) {
|
|
9695
|
+
if (axios.isAxiosError(error)) {
|
|
9696
|
+
const axiosError = error;
|
|
9697
|
+
if (axiosError.code === "ECONNABORTED") {
|
|
9698
|
+
return new Error("API request timeout");
|
|
9699
|
+
}
|
|
9700
|
+
if (axiosError.response) {
|
|
9701
|
+
const status = axiosError.response.status;
|
|
9702
|
+
const message = axiosError.response.data?.message || axiosError.message;
|
|
9703
|
+
if (status === 404) {
|
|
9704
|
+
return new Error(`CLMM config not found: ${message}`);
|
|
9705
|
+
}
|
|
9706
|
+
if (status >= 500) {
|
|
9707
|
+
return new Error(`API server error: ${message}`);
|
|
9708
|
+
}
|
|
9709
|
+
return new Error(`API request failed: ${message}`);
|
|
9710
|
+
}
|
|
9711
|
+
if (axiosError.request) {
|
|
9712
|
+
return new Error("No response from API server");
|
|
9713
|
+
}
|
|
9714
|
+
}
|
|
9715
|
+
return new Error(
|
|
9716
|
+
`Unknown API error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
9717
|
+
);
|
|
9718
|
+
}
|
|
9719
|
+
/**
|
|
9720
|
+
* Check if error is a 404 Not Found
|
|
9721
|
+
* @param error - Error to check
|
|
9722
|
+
* @returns True if 404 error
|
|
9723
|
+
*/
|
|
9724
|
+
isNotFoundError(error) {
|
|
9725
|
+
return axios.isAxiosError(error) && error.response?.status === 404;
|
|
9726
|
+
}
|
|
9727
|
+
};
|
|
9728
|
+
|
|
9729
|
+
// src/api/pools.ts
|
|
9730
|
+
import axios2 from "axios";
|
|
9731
|
+
var PoolsApi = class {
|
|
9732
|
+
constructor(config) {
|
|
9733
|
+
this.config = config;
|
|
9734
|
+
this.client = axios2.create({
|
|
9735
|
+
baseURL: this.config.baseUrl,
|
|
9736
|
+
timeout: this.config.timeout ?? 1e4,
|
|
9737
|
+
headers: {
|
|
9738
|
+
"Content-Type": "application/json"
|
|
9731
9739
|
}
|
|
9732
9740
|
});
|
|
9733
9741
|
}
|
|
@@ -9742,7 +9750,7 @@ var PoolsApi = class {
|
|
|
9742
9750
|
const response = await this.client.get(
|
|
9743
9751
|
`/pools/${poolAddress}`
|
|
9744
9752
|
);
|
|
9745
|
-
return
|
|
9753
|
+
return response.data.pool;
|
|
9746
9754
|
} catch (error) {
|
|
9747
9755
|
if (this.isNotFoundError(error)) return null;
|
|
9748
9756
|
throw this.handleApiError(error);
|
|
@@ -9755,7 +9763,7 @@ var PoolsApi = class {
|
|
|
9755
9763
|
async getAllPools() {
|
|
9756
9764
|
try {
|
|
9757
9765
|
const response = await this.client.get("/pools");
|
|
9758
|
-
return response.data
|
|
9766
|
+
return response.data;
|
|
9759
9767
|
} catch (error) {
|
|
9760
9768
|
throw this.handleApiError(error);
|
|
9761
9769
|
}
|
|
@@ -9774,81 +9782,19 @@ var PoolsApi = class {
|
|
|
9774
9782
|
tokenB
|
|
9775
9783
|
}
|
|
9776
9784
|
});
|
|
9777
|
-
return response.data
|
|
9785
|
+
return response.data;
|
|
9778
9786
|
} catch (error) {
|
|
9779
9787
|
if (this.isNotFoundError(error)) return [];
|
|
9780
9788
|
throw this.handleApiError(error);
|
|
9781
9789
|
}
|
|
9782
9790
|
}
|
|
9783
|
-
/**
|
|
9784
|
-
* Map API response to SDK PoolInfo type
|
|
9785
|
-
* @param apiPool - API pool response
|
|
9786
|
-
* @returns Transformed PoolInfo object
|
|
9787
|
-
*/
|
|
9788
|
-
mapApiResponseToPoolInfo(apiPool) {
|
|
9789
|
-
return {
|
|
9790
|
-
discriminator: new Uint8Array(8),
|
|
9791
|
-
bump: new Uint8Array(1),
|
|
9792
|
-
ammConfig: apiPool.address,
|
|
9793
|
-
owner: apiPool.owner,
|
|
9794
|
-
tokenMint0: apiPool.tokenMint0,
|
|
9795
|
-
tokenMint1: apiPool.tokenMint1,
|
|
9796
|
-
tokenVault0: apiPool.tokenVault0,
|
|
9797
|
-
tokenVault1: apiPool.tokenVault1,
|
|
9798
|
-
observationKey: apiPool.address,
|
|
9799
|
-
mintDecimals0: 0,
|
|
9800
|
-
mintDecimals1: 0,
|
|
9801
|
-
tickSpacing: apiPool.tickSpacing,
|
|
9802
|
-
liquidity: BigInt(0),
|
|
9803
|
-
sqrtPriceX64: BigInt(apiPool.sqrtPriceX64),
|
|
9804
|
-
tickCurrent: apiPool.tick,
|
|
9805
|
-
padding3: 0,
|
|
9806
|
-
padding4: 0,
|
|
9807
|
-
feeGrowthGlobal0X64: BigInt(0),
|
|
9808
|
-
feeGrowthGlobal1X64: BigInt(0),
|
|
9809
|
-
protocolFeesToken0: BigInt(0),
|
|
9810
|
-
protocolFeesToken1: BigInt(0),
|
|
9811
|
-
swapInAmountToken0: BigInt(0),
|
|
9812
|
-
swapOutAmountToken1: BigInt(0),
|
|
9813
|
-
swapInAmountToken1: BigInt(0),
|
|
9814
|
-
swapOutAmountToken0: BigInt(0),
|
|
9815
|
-
status: 0,
|
|
9816
|
-
padding: new Uint8Array(7),
|
|
9817
|
-
rewardInfos: [],
|
|
9818
|
-
tickArrayBitmap: [],
|
|
9819
|
-
totalFeesToken0: BigInt(0),
|
|
9820
|
-
totalFeesClaimedToken0: BigInt(0),
|
|
9821
|
-
totalFeesToken1: BigInt(0),
|
|
9822
|
-
totalFeesClaimedToken1: BigInt(0),
|
|
9823
|
-
fundFeesToken0: BigInt(0),
|
|
9824
|
-
fundFeesToken1: BigInt(0),
|
|
9825
|
-
openTime: BigInt(0),
|
|
9826
|
-
recentEpoch: BigInt(0),
|
|
9827
|
-
padding1: [],
|
|
9828
|
-
padding2: [],
|
|
9829
|
-
currentPrice: 0,
|
|
9830
|
-
tokenA: {
|
|
9831
|
-
mint: apiPool.tokenMint0,
|
|
9832
|
-
symbol: "TOKEN_A",
|
|
9833
|
-
decimals: 0
|
|
9834
|
-
},
|
|
9835
|
-
tokenB: {
|
|
9836
|
-
mint: apiPool.tokenMint1,
|
|
9837
|
-
symbol: "TOKEN_B",
|
|
9838
|
-
decimals: 0
|
|
9839
|
-
},
|
|
9840
|
-
tvl: void 0,
|
|
9841
|
-
volume24h: void 0,
|
|
9842
|
-
apy: void 0
|
|
9843
|
-
};
|
|
9844
|
-
}
|
|
9845
9791
|
/**
|
|
9846
9792
|
* Handle API errors and convert to Error
|
|
9847
9793
|
* @param error - Error from axios
|
|
9848
9794
|
* @returns Error with appropriate message
|
|
9849
9795
|
*/
|
|
9850
9796
|
handleApiError(error) {
|
|
9851
|
-
if (
|
|
9797
|
+
if (axios2.isAxiosError(error)) {
|
|
9852
9798
|
const axiosError = error;
|
|
9853
9799
|
if (axiosError.code === "ECONNABORTED") {
|
|
9854
9800
|
return new Error("API request timeout");
|
|
@@ -9878,7 +9824,7 @@ var PoolsApi = class {
|
|
|
9878
9824
|
* @returns True if 404 error
|
|
9879
9825
|
*/
|
|
9880
9826
|
isNotFoundError(error) {
|
|
9881
|
-
return
|
|
9827
|
+
return axios2.isAxiosError(error) && error.response?.status === 404;
|
|
9882
9828
|
}
|
|
9883
9829
|
};
|
|
9884
9830
|
|
|
@@ -9887,8 +9833,10 @@ var ClmmApi = class {
|
|
|
9887
9833
|
constructor(config) {
|
|
9888
9834
|
this.config = config;
|
|
9889
9835
|
this.pools = new PoolsApi(this.config);
|
|
9836
|
+
this.clmmConfig = new ClmmConfigApi(this.config);
|
|
9890
9837
|
}
|
|
9891
9838
|
pools;
|
|
9839
|
+
clmmConfig;
|
|
9892
9840
|
};
|
|
9893
9841
|
|
|
9894
9842
|
// src/client.ts
|
|
@@ -9910,7 +9858,9 @@ var ClmmSdk = class _ClmmSdk {
|
|
|
9910
9858
|
constructor(config) {
|
|
9911
9859
|
this.config = config;
|
|
9912
9860
|
this.clmm = new Clmm(config);
|
|
9913
|
-
|
|
9861
|
+
const baseUrl = getApisFromEndpoint(config.rpc);
|
|
9862
|
+
const apiConfig = config.apiConfig ? config.apiConfig : { baseUrl };
|
|
9863
|
+
this.api = new ClmmApi(apiConfig);
|
|
9914
9864
|
this.pools = new PoolManager(config);
|
|
9915
9865
|
this.positions = new PositionManager(config);
|
|
9916
9866
|
}
|
|
@@ -9951,20 +9901,16 @@ var DEFAULT_SDK_CONFIG = {
|
|
|
9951
9901
|
};
|
|
9952
9902
|
export {
|
|
9953
9903
|
AMM_V3_PROGRAM_ADDRESS,
|
|
9904
|
+
API_ENDPONTS,
|
|
9954
9905
|
BIT_PRECISION,
|
|
9955
9906
|
Clmm,
|
|
9956
9907
|
ClmmSdk,
|
|
9957
|
-
DEFAULT_COMPUTE_UNITS,
|
|
9958
9908
|
DEFAULT_CONFIG,
|
|
9959
9909
|
DEFAULT_DEADLINE_SECONDS,
|
|
9960
9910
|
DEFAULT_SDK_CONFIG,
|
|
9961
9911
|
DEFAULT_SLIPPAGE_TOLERANCE,
|
|
9962
|
-
DISCRIMINATORS,
|
|
9963
|
-
ERROR_MESSAGES,
|
|
9964
|
-
FEE_PRECISION,
|
|
9965
9912
|
FEE_RATE_DENOMINATOR,
|
|
9966
9913
|
FEE_TIERS,
|
|
9967
|
-
LIQUIDITY_PRECISION,
|
|
9968
9914
|
LOG_B_2_X32,
|
|
9969
9915
|
LOG_B_P_ERR_MARGIN_LOWER_X64,
|
|
9970
9916
|
LOG_B_P_ERR_MARGIN_UPPER_X64,
|
|
@@ -9982,8 +9928,6 @@ export {
|
|
|
9982
9928
|
NEGATIVE_ONE,
|
|
9983
9929
|
ONE,
|
|
9984
9930
|
PDA_SEEDS,
|
|
9985
|
-
PRICE_PRECISION,
|
|
9986
|
-
PRIORITY_FEE_MICRO_LAMPORTS,
|
|
9987
9931
|
PdaUtils,
|
|
9988
9932
|
PoolManager,
|
|
9989
9933
|
PoolUtils,
|
|
@@ -10001,7 +9945,6 @@ export {
|
|
|
10001
9945
|
TickMath,
|
|
10002
9946
|
TickUtils,
|
|
10003
9947
|
U64Resolution,
|
|
10004
|
-
WELL_KNOWN_TOKENS,
|
|
10005
9948
|
ZERO,
|
|
10006
9949
|
addresstoBytes,
|
|
10007
9950
|
approximatelyEqual,
|
|
@@ -10017,6 +9960,7 @@ export {
|
|
|
10017
9960
|
formatAmount,
|
|
10018
9961
|
generated_exports as generated,
|
|
10019
9962
|
getAmmV3ErrorMessage,
|
|
9963
|
+
getApisFromEndpoint,
|
|
10020
9964
|
getClosePositionInstruction,
|
|
10021
9965
|
getCreateAmmConfigInstruction,
|
|
10022
9966
|
getCreatePoolInstruction,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Account, type Address, type TransactionSigner } from "@solana/kit";
|
|
2
2
|
import { PersonalPositionState, PoolState } from "./generated";
|
|
3
|
-
import type { ClmmSdkConfig,
|
|
3
|
+
import type { ClmmSdkConfig, MakeInstructionResult, PositionInfo } from "./types";
|
|
4
4
|
export declare class PositionManager {
|
|
5
5
|
private readonly config;
|
|
6
6
|
constructor(config: ClmmSdkConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position-manager.d.ts","sourceRoot":"","sources":["../src/position-manager.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"position-manager.d.ts","sourceRoot":"","sources":["../src/position-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,KAAK,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAElG,OAAO,EAOL,qBAAqB,EACrB,SAAS,EACV,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAC,aAAa,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQjF,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAElD;;;;;OAKG;IACG,yCAAyC,CAAC,MAAM,EAAE;QACtD,WA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G,IAAI,CAAC;IAuBxC;;;;;OAKG;IACH,kBAAkB,CAChB,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,EAAE,SAAS,GACd,YAAY;IA6Ff;;;;OAIG;IACG,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CA0EtE"}
|
package/lib/types.d.ts
CHANGED
|
@@ -3,26 +3,15 @@ import type { PoolState, PersonalPositionState } from "./generated";
|
|
|
3
3
|
import BN from "bn.js";
|
|
4
4
|
import { ClmmApiConfig } from "./api";
|
|
5
5
|
export interface ClmmSdkConfig {
|
|
6
|
-
/** API client config */
|
|
7
|
-
apiConfig: ClmmApiConfig;
|
|
8
6
|
/** RPC client for Solana network operations */
|
|
9
7
|
rpc: Rpc<SolanaRpcApiMainnet | SolanaRpcApiDevnet | SolanaRpcApiTestnet>;
|
|
8
|
+
/** API client config */
|
|
9
|
+
apiConfig?: ClmmApiConfig;
|
|
10
10
|
/** Optional program address override */
|
|
11
11
|
programAddress?: Address;
|
|
12
12
|
/** Default commitment level for transactions */
|
|
13
13
|
commitment?: "processed" | "confirmed" | "finalized";
|
|
14
14
|
}
|
|
15
|
-
export interface ClmmConfig {
|
|
16
|
-
id: string;
|
|
17
|
-
index: number;
|
|
18
|
-
protocolFeeRate: number;
|
|
19
|
-
tradeFeeRate: number;
|
|
20
|
-
tickSpacing: number;
|
|
21
|
-
fundFeeRate: number;
|
|
22
|
-
description: string;
|
|
23
|
-
defaultRange: number;
|
|
24
|
-
defaultRangePoint: number[];
|
|
25
|
-
}
|
|
26
15
|
/**
|
|
27
16
|
* Return type for make instructions following Raydium's pattern
|
|
28
17
|
*/
|
|
@@ -52,6 +41,21 @@ export interface PoolInfo extends PoolState {
|
|
|
52
41
|
/** Current APY for liquidity providers */
|
|
53
42
|
apy?: number;
|
|
54
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Position Data API response
|
|
46
|
+
*/
|
|
47
|
+
export type PoolApiData = {
|
|
48
|
+
tokenVault1: string;
|
|
49
|
+
tokenVault0: string;
|
|
50
|
+
ammConfig: string;
|
|
51
|
+
sqrtPriceX64: string;
|
|
52
|
+
tickSpacing: number;
|
|
53
|
+
tokenMint0: string;
|
|
54
|
+
tokenMint1: string;
|
|
55
|
+
owner: string;
|
|
56
|
+
tick: number;
|
|
57
|
+
address: string;
|
|
58
|
+
};
|
|
55
59
|
export interface TokenInfo {
|
|
56
60
|
/** Token mint address */
|
|
57
61
|
mint: Address;
|
|
@@ -64,15 +68,15 @@ export interface TokenInfo {
|
|
|
64
68
|
/** Logo URI */
|
|
65
69
|
logoUri?: string;
|
|
66
70
|
}
|
|
67
|
-
export interface
|
|
68
|
-
id: Address;
|
|
69
|
-
index: number;
|
|
70
|
-
protocolFeeRate: number;
|
|
71
|
+
export interface ClmmConfig {
|
|
71
72
|
tradeFeeRate: number;
|
|
72
|
-
|
|
73
|
+
index: number;
|
|
73
74
|
fundFeeRate: number;
|
|
75
|
+
tickSpacing: number;
|
|
74
76
|
fundOwner: string;
|
|
75
|
-
|
|
77
|
+
owner: string;
|
|
78
|
+
address: string;
|
|
79
|
+
protocolFeeRate: number;
|
|
76
80
|
}
|
|
77
81
|
export interface PositionInfo extends PersonalPositionState {
|
|
78
82
|
/** Token mint addresses from pool */
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,GAAG,EACH,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,WAAW,aAAa;IAC5B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export * from "./math";
|
|
|
6
6
|
export * from "./pda";
|
|
7
7
|
export * from "./tick";
|
|
8
8
|
export * from "./pool";
|
|
9
|
-
import { SignatureBytes, type Address } from "@solana/kit";
|
|
9
|
+
import { Rpc, SignatureBytes, SolanaRpcApiDevnet, SolanaRpcApiMainnet, SolanaRpcApiTestnet, type Address } from "@solana/kit";
|
|
10
10
|
/**
|
|
11
11
|
* Validate that an address is not empty
|
|
12
12
|
* @param address - Address to validate
|
|
@@ -76,4 +76,8 @@ export declare function getFakeSigner(address: Address): {
|
|
|
76
76
|
signatures: import("@solana/kit").SignaturesMap;
|
|
77
77
|
}>[], _config: import("@solana/kit").BaseTransactionSignerConfig | undefined) => Promise<SignatureBytes[]>;
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* A very brutal way to differentate between mainnet and devnet RPC
|
|
81
|
+
*/
|
|
82
|
+
export declare function getApisFromEndpoint(rpc: Rpc<SolanaRpcApiMainnet | SolanaRpcApiDevnet | SolanaRpcApiTestnet>): string;
|
|
79
83
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAIvB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAIvB,OAAO,EAGL,GAAG,EACH,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAEnB,KAAK,OAAO,EACb,MAAM,aAAa,CAAC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