@make-software/cspr-trade-mcp-sdk 0.1.0

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.
Files changed (55) hide show
  1. package/README.md +257 -0
  2. package/dist/assets/proxy_caller.wasm +0 -0
  3. package/dist/index.d.ts +362 -0
  4. package/dist/index.js +1003 -0
  5. package/package.json +32 -0
  6. package/src/api/currencies.ts +11 -0
  7. package/src/api/http.ts +57 -0
  8. package/src/api/index.ts +9 -0
  9. package/src/api/liquidity.ts +22 -0
  10. package/src/api/pairs.ts +77 -0
  11. package/src/api/quotes.ts +23 -0
  12. package/src/api/rates.ts +33 -0
  13. package/src/api/submission.ts +42 -0
  14. package/src/api/swaps.ts +24 -0
  15. package/src/api/tokens.ts +57 -0
  16. package/src/assets/index.ts +21 -0
  17. package/src/assets/proxy_caller.wasm +0 -0
  18. package/src/client.ts +587 -0
  19. package/src/config.ts +60 -0
  20. package/src/index.ts +4 -0
  21. package/src/resolver/currency-resolver.ts +19 -0
  22. package/src/resolver/index.ts +2 -0
  23. package/src/resolver/token-resolver.ts +43 -0
  24. package/src/transactions/approve.ts +14 -0
  25. package/src/transactions/index.ts +5 -0
  26. package/src/transactions/liquidity.ts +92 -0
  27. package/src/transactions/proxy-wasm.ts +33 -0
  28. package/src/transactions/swap.ts +76 -0
  29. package/src/transactions/transaction-builder.ts +44 -0
  30. package/src/types/api.ts +32 -0
  31. package/src/types/index.ts +6 -0
  32. package/src/types/liquidity.ts +72 -0
  33. package/src/types/pair.ts +29 -0
  34. package/src/types/quote.ts +41 -0
  35. package/src/types/token.ts +48 -0
  36. package/src/types/transaction.ts +72 -0
  37. package/src/utils/amounts.ts +30 -0
  38. package/tests/integration/api.integration.test.ts +64 -0
  39. package/tests/unit/api/http.test.ts +68 -0
  40. package/tests/unit/api/liquidity.test.ts +40 -0
  41. package/tests/unit/api/pairs.test.ts +53 -0
  42. package/tests/unit/api/quotes.test.ts +59 -0
  43. package/tests/unit/api/rates.test.ts +27 -0
  44. package/tests/unit/api/tokens.test.ts +100 -0
  45. package/tests/unit/assets/proxy-caller.test.ts +21 -0
  46. package/tests/unit/client.test.ts +73 -0
  47. package/tests/unit/config.test.ts +23 -0
  48. package/tests/unit/resolver/currency-resolver.test.ts +32 -0
  49. package/tests/unit/resolver/token-resolver.test.ts +51 -0
  50. package/tests/unit/transactions/approve.test.ts +13 -0
  51. package/tests/unit/transactions/liquidity.test.ts +59 -0
  52. package/tests/unit/transactions/proxy-wasm.test.ts +50 -0
  53. package/tests/unit/transactions/swap.test.ts +77 -0
  54. package/tests/unit/utils/amounts.test.ts +44 -0
  55. package/tsconfig.json +9 -0
package/README.md ADDED
@@ -0,0 +1,257 @@
1
+ # @make-software/cspr-trade-mcp-sdk
2
+
3
+ TypeScript SDK for the [CSPR.trade](https://cspr.trade) DEX on the Casper Network. Provides market data queries, swap/liquidity transaction building, and token resolution — all through the CSPR.trade API.
4
+
5
+ Non-custodial: all transaction methods return unsigned transaction JSON for external signing.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @make-software/cspr-trade-mcp-sdk
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { CsprTradeClient } from '@make-software/cspr-trade-mcp-sdk';
17
+
18
+ const client = new CsprTradeClient({ network: 'testnet' });
19
+
20
+ // Get a swap quote
21
+ const quote = await client.getQuote({
22
+ tokenIn: 'CSPR',
23
+ tokenOut: 'USDT',
24
+ amount: '1000',
25
+ type: 'exact_in',
26
+ });
27
+ console.log(`${quote.amountInFormatted} CSPR -> ${quote.amountOutFormatted} USDT`);
28
+ console.log(`Price impact: ${quote.priceImpact}%`);
29
+
30
+ // Build an unsigned swap transaction
31
+ const bundle = await client.buildSwap({
32
+ tokenIn: 'CSPR',
33
+ tokenOut: 'USDT',
34
+ amount: '1000',
35
+ type: 'exact_in',
36
+ senderPublicKey: '01abc...',
37
+ });
38
+ console.log(bundle.summary);
39
+ // => "Swap 1000 CSPR for ~42.5 USDT\nRoute: CSPR → WCSPR → USDT\n..."
40
+
41
+ // bundle.transactionJson is the unsigned transaction — sign externally, then submit:
42
+ const result = await client.submitTransaction(signedTransactionJson);
43
+ console.log(`Submitted: ${result.transactionHash}`);
44
+ ```
45
+
46
+ ## Configuration
47
+
48
+ ```typescript
49
+ const client = new CsprTradeClient({
50
+ network: 'testnet', // 'mainnet' | 'testnet'
51
+ apiUrl: 'https://custom-api.com', // optional override
52
+ routerPackageHash: 'hash-...', // optional override
53
+ wcsprPackageHash: 'hash-...', // optional override
54
+ });
55
+ ```
56
+
57
+ ## API Reference
58
+
59
+ ### Market Data
60
+
61
+ #### `getTokens(currency?)`
62
+
63
+ List all tradable tokens with optional fiat pricing.
64
+
65
+ ```typescript
66
+ const tokens = await client.getTokens('USD');
67
+ // [{ symbol: 'CSPR', name: 'Casper', decimals: 9, fiatPrice: 0.012, ... }, ...]
68
+ ```
69
+
70
+ #### `getPairs(opts?)`
71
+
72
+ List trading pairs with reserves and pricing.
73
+
74
+ ```typescript
75
+ const pairs = await client.getPairs({
76
+ page: 1,
77
+ page_size: 10,
78
+ order_by: 'reserve0',
79
+ order_direction: 'desc',
80
+ currency: 'USD',
81
+ });
82
+ ```
83
+
84
+ #### `getPairDetails(pairHash, currency?)`
85
+
86
+ Get detailed info about a specific pair.
87
+
88
+ ```typescript
89
+ const pair = await client.getPairDetails('hash-abc123...', 'USD');
90
+ ```
91
+
92
+ #### `getQuote(params)`
93
+
94
+ Get a swap quote with routing path, price impact, and recommended slippage.
95
+
96
+ ```typescript
97
+ const quote = await client.getQuote({
98
+ tokenIn: 'CSPR', // symbol, name, or contract hash
99
+ tokenOut: 'USDT',
100
+ amount: '100', // human-readable
101
+ type: 'exact_in', // or 'exact_out'
102
+ });
103
+ ```
104
+
105
+ #### `getCurrencies()`
106
+
107
+ List supported fiat currencies.
108
+
109
+ ```typescript
110
+ const currencies = await client.getCurrencies();
111
+ // [{ code: 'USD', name: 'US Dollar', symbol: '$' }, ...]
112
+ ```
113
+
114
+ ### Account Data
115
+
116
+ #### `getLiquidityPositions(publicKey, currency?)`
117
+
118
+ Get liquidity positions for an account.
119
+
120
+ ```typescript
121
+ const positions = await client.getLiquidityPositions('01abc...', 'USD');
122
+ ```
123
+
124
+ #### `getImpermanentLoss(publicKey, pairHash)`
125
+
126
+ Calculate impermanent loss for a position.
127
+
128
+ ```typescript
129
+ const il = await client.getImpermanentLoss('01abc...', 'hash-...');
130
+ ```
131
+
132
+ #### `getSwapHistory(opts?)`
133
+
134
+ Get swap transaction history, optionally filtered by account or pair.
135
+
136
+ ```typescript
137
+ const history = await client.getSwapHistory({
138
+ accountHash: 'account-hash-...',
139
+ page: 1,
140
+ pageSize: 20,
141
+ });
142
+ ```
143
+
144
+ ### Transaction Building
145
+
146
+ All transaction methods return a `TransactionBundle`:
147
+
148
+ ```typescript
149
+ interface TransactionBundle {
150
+ transactionJson: string; // Unsigned transaction JSON — sign externally
151
+ summary: string; // Human-readable description
152
+ estimatedGasCost: string; // e.g. "30 CSPR"
153
+ approvalRequired?: TransactionBundle; // Token approval if needed
154
+ warnings: string[]; // Price impact, slippage warnings
155
+ }
156
+ ```
157
+
158
+ #### `buildSwap(params)`
159
+
160
+ ```typescript
161
+ const bundle = await client.buildSwap({
162
+ tokenIn: 'CSPR',
163
+ tokenOut: 'USDT',
164
+ amount: '100',
165
+ type: 'exact_in',
166
+ slippageBps: 300, // 3% (default)
167
+ deadlineMinutes: 20, // default
168
+ senderPublicKey: '01abc...',
169
+ });
170
+ ```
171
+
172
+ #### `buildAddLiquidity(params)`
173
+
174
+ ```typescript
175
+ const bundle = await client.buildAddLiquidity({
176
+ tokenA: 'CSPR',
177
+ tokenB: 'USDT',
178
+ amountA: '1000',
179
+ amountB: '42',
180
+ senderPublicKey: '01abc...',
181
+ });
182
+ ```
183
+
184
+ #### `buildRemoveLiquidity(params)`
185
+
186
+ ```typescript
187
+ const bundle = await client.buildRemoveLiquidity({
188
+ pairContractPackageHash: 'hash-...',
189
+ percentage: 50, // remove 50% of position
190
+ senderPublicKey: '01abc...',
191
+ });
192
+ ```
193
+
194
+ #### `buildApproval(params)`
195
+
196
+ ```typescript
197
+ const bundle = await client.buildApproval({
198
+ tokenContractPackageHash: 'hash-...',
199
+ spenderPackageHash: 'hash-...',
200
+ amount: '1000000000', // raw amount
201
+ senderPublicKey: '01abc...',
202
+ });
203
+ ```
204
+
205
+ ### Transaction Submission
206
+
207
+ #### `submitTransaction(signedDeployJson)`
208
+
209
+ ```typescript
210
+ const result = await client.submitTransaction(signedDeployJson);
211
+ console.log(result.transactionHash);
212
+ ```
213
+
214
+ ### Token Resolution
215
+
216
+ #### `resolveToken(identifier)`
217
+
218
+ Resolve a token by symbol, name, or contract hash.
219
+
220
+ ```typescript
221
+ const token = await client.resolveToken('CSPR');
222
+ // { symbol: 'CSPR', decimals: 9, packageHash: '0000...0000', ... }
223
+ ```
224
+
225
+ Resolution order: exact symbol match -> exact name match -> contract hash match.
226
+
227
+ ## Utility Functions
228
+
229
+ ```typescript
230
+ import { toRawAmount, toFormattedAmount } from '@make-software/cspr-trade-mcp-sdk';
231
+
232
+ toRawAmount('100.5', 9); // '100500000000'
233
+ toFormattedAmount('100500000000', 9); // '100.5'
234
+ ```
235
+
236
+ ## Gas Costs
237
+
238
+ | Operation | Cost |
239
+ |-----------|------|
240
+ | Token approval | 5 CSPR |
241
+ | Swap | 30 CSPR |
242
+ | Add liquidity | 50 CSPR (500 for new pools) |
243
+ | Remove liquidity | 30 CSPR |
244
+
245
+ ## Safety Warnings
246
+
247
+ The SDK automatically generates warnings for:
248
+ - Price impact > 5% (warning) or > 15% (strong warning)
249
+ - Slippage tolerance > 10%
250
+
251
+ ## Development
252
+
253
+ ```bash
254
+ npm run build # Build to dist/
255
+ npm test # Run unit tests
256
+ npm run test:watch # Watch mode
257
+ ```
Binary file
@@ -0,0 +1,362 @@
1
+ /** Generic API success response */
2
+ interface ApiResponse<T> {
3
+ data: T;
4
+ message?: string;
5
+ status?: string;
6
+ }
7
+ /** Paginated API response */
8
+ interface PaginatedApiResponse<T> {
9
+ data: T[];
10
+ item_count: number;
11
+ page_count: number;
12
+ }
13
+ /** API error */
14
+ interface ApiError {
15
+ code: number;
16
+ message: string;
17
+ status?: number;
18
+ }
19
+ /** Pagination options */
20
+ interface PaginationOptions {
21
+ page?: number;
22
+ page_size?: number;
23
+ }
24
+ /** Sort options */
25
+ interface SortOptions {
26
+ order_by?: string;
27
+ order_direction?: 'asc' | 'desc';
28
+ }
29
+
30
+ /** Contract package metadata from CSPR.cloud */
31
+ interface ContractPackage {
32
+ contract_package_hash: string;
33
+ owner_public_key: string;
34
+ name: string;
35
+ description: string | null;
36
+ metadata: TokenMetadata;
37
+ icon_url: string | null;
38
+ website_url: string | null;
39
+ latest_version_contract_hash: string | null;
40
+ csprtrade_data: {
41
+ price: number;
42
+ } | null;
43
+ }
44
+ interface TokenMetadata {
45
+ balances_uref: string;
46
+ decimals: number;
47
+ name: string;
48
+ symbol: string;
49
+ total_supply_uref: string;
50
+ }
51
+ /** Token as returned by GET /tokens */
52
+ interface TokenApiResponse {
53
+ contract_package_hash: string;
54
+ contract_package: ContractPackage;
55
+ listed_at: string;
56
+ sorting_order: number;
57
+ total_value_locked?: string;
58
+ }
59
+ /** Resolved token for SDK consumption */
60
+ interface Token {
61
+ id: string;
62
+ name: string;
63
+ symbol: string;
64
+ decimals: number;
65
+ packageHash: string;
66
+ iconUrl: string | null;
67
+ fiatPrice: number | null;
68
+ }
69
+ /** Currency for fiat display */
70
+ interface Currency {
71
+ id: number;
72
+ code: string;
73
+ name: string;
74
+ symbol: string;
75
+ }
76
+
77
+ /** Pair as returned by API */
78
+ interface PairApiResponse {
79
+ contract_package_hash: string;
80
+ token0_contract_package_hash: string;
81
+ token1_contract_package_hash: string;
82
+ decimals0: number;
83
+ decimals1: number;
84
+ reserve0: string;
85
+ reserve1: string;
86
+ timestamp: string;
87
+ latest_event_id: string;
88
+ contract_package: ContractPackage;
89
+ token0_contract_package: ContractPackage;
90
+ token1_contract_package: ContractPackage;
91
+ }
92
+ /** Pair for SDK consumption */
93
+ interface Pair {
94
+ contractPackageHash: string;
95
+ token0: {
96
+ packageHash: string;
97
+ symbol: string;
98
+ name: string;
99
+ decimals: number;
100
+ iconUrl: string | null;
101
+ };
102
+ token1: {
103
+ packageHash: string;
104
+ symbol: string;
105
+ name: string;
106
+ decimals: number;
107
+ iconUrl: string | null;
108
+ };
109
+ reserve0: string;
110
+ reserve1: string;
111
+ timestamp: string;
112
+ fiatPrice0: number | null;
113
+ fiatPrice1: number | null;
114
+ }
115
+
116
+ /** Quote API response */
117
+ interface QuoteApiResponse {
118
+ amount_in: string;
119
+ amount_out: string;
120
+ execution_price: string;
121
+ mid_price: string;
122
+ path: string[];
123
+ price_impact: string;
124
+ recommended_slippage_bps: string;
125
+ type_id: 1 | 2;
126
+ }
127
+ /** Quote type enum */
128
+ type QuoteType = 'exact_in' | 'exact_out';
129
+ /** Quote parameters */
130
+ interface QuoteParams {
131
+ tokenIn: string;
132
+ tokenOut: string;
133
+ amount: string;
134
+ type: QuoteType;
135
+ }
136
+ /** Resolved quote for SDK consumption */
137
+ interface Quote {
138
+ amountIn: string;
139
+ amountOut: string;
140
+ amountInFormatted: string;
141
+ amountOutFormatted: string;
142
+ executionPrice: string;
143
+ midPrice: string;
144
+ path: string[];
145
+ pathSymbols: string[];
146
+ priceImpact: string;
147
+ recommendedSlippageBps: string;
148
+ type: QuoteType;
149
+ tokenInSymbol: string;
150
+ tokenOutSymbol: string;
151
+ tokenInDecimals: number;
152
+ tokenOutDecimals: number;
153
+ }
154
+
155
+ /** Liquidity position API response */
156
+ interface LiquidityPositionApiResponse {
157
+ account_hash: string;
158
+ pair_contract_package_hash: string;
159
+ lp_token_balance: string;
160
+ pair: PairApiResponse;
161
+ pair_lp_tokens_total_supply: string;
162
+ }
163
+ /** Liquidity position for SDK consumption */
164
+ interface LiquidityPosition {
165
+ accountHash: string;
166
+ pairContractPackageHash: string;
167
+ lpTokenBalance: string;
168
+ lpTokenTotalSupply: string;
169
+ pair: {
170
+ token0Symbol: string;
171
+ token1Symbol: string;
172
+ token0PackageHash: string;
173
+ token1PackageHash: string;
174
+ reserve0: string;
175
+ reserve1: string;
176
+ decimals0: number;
177
+ decimals1: number;
178
+ };
179
+ /** User's share of the pool as percentage */
180
+ poolShare: string;
181
+ /** Estimated token0 amount based on pool share */
182
+ estimatedToken0Amount: string;
183
+ /** Estimated token1 amount based on pool share */
184
+ estimatedToken1Amount: string;
185
+ }
186
+ /** Impermanent loss response */
187
+ interface ImpermanentLossApiResponse {
188
+ pair_contract_package_hash: string;
189
+ account_hash: string;
190
+ value: string;
191
+ timestamp: string;
192
+ }
193
+ interface ImpermanentLoss {
194
+ pairContractPackageHash: string;
195
+ value: string;
196
+ timestamp: string;
197
+ }
198
+ /** Add liquidity parameters */
199
+ interface AddLiquidityParams {
200
+ tokenA: string;
201
+ tokenB: string;
202
+ amountA: string;
203
+ amountB: string;
204
+ slippageBps?: number;
205
+ deadlineMinutes?: number;
206
+ senderPublicKey: string;
207
+ /** Raw token A balance for approval amount. Falls back to amountA in motes. */
208
+ tokenABalance?: string;
209
+ /** Raw token B balance for approval amount. Falls back to amountB in motes. */
210
+ tokenBBalance?: string;
211
+ }
212
+ /** Remove liquidity parameters */
213
+ interface RemoveLiquidityParams {
214
+ pairContractPackageHash: string;
215
+ percentage: number;
216
+ slippageBps?: number;
217
+ deadlineMinutes?: number;
218
+ senderPublicKey: string;
219
+ }
220
+
221
+ /** Swap parameters */
222
+ interface SwapParams {
223
+ tokenIn: string;
224
+ tokenOut: string;
225
+ amount: string;
226
+ type: 'exact_in' | 'exact_out';
227
+ slippageBps?: number;
228
+ deadlineMinutes?: number;
229
+ senderPublicKey: string;
230
+ /** Raw token balance for approval amount (matching CSPR.trade pattern). Falls back to swap amount. */
231
+ tokenInBalance?: string;
232
+ }
233
+ /** Token approval parameters */
234
+ interface ApprovalParams {
235
+ tokenContractPackageHash: string;
236
+ spenderPackageHash: string;
237
+ amount: string;
238
+ senderPublicKey: string;
239
+ }
240
+ /** The result of building a transaction */
241
+ interface TransactionBundle {
242
+ /** The unsigned transaction as JSON */
243
+ transactionJson: string;
244
+ /** Human-readable description of what this transaction does */
245
+ summary: string;
246
+ /** Gas cost in CSPR */
247
+ estimatedGasCost: string;
248
+ /** If token approvals are needed first, these contain those transactions (sign & submit each before the main tx) */
249
+ approvalsRequired?: TransactionBundle[];
250
+ /** Safety warnings (high price impact, high slippage, etc.) */
251
+ warnings: string[];
252
+ }
253
+ /** Result of submitting a transaction */
254
+ interface SubmitResult {
255
+ transactionHash: string;
256
+ }
257
+ /** Transaction status */
258
+ interface TransactionStatus {
259
+ hash: string;
260
+ status: 'pending' | 'success' | 'failed' | 'expired';
261
+ errorMessage?: string;
262
+ }
263
+ /** Signer interface for pluggable signing */
264
+ interface Signer {
265
+ sign(deployJson: string): Promise<string>;
266
+ }
267
+ /** Swap history entry */
268
+ interface SwapHistoryEntry {
269
+ transactionHash: string;
270
+ timestamp: string;
271
+ token0ContractPackageHash: string;
272
+ token1ContractPackageHash: string;
273
+ amount0In: string;
274
+ amount1In: string;
275
+ amount0Out: string;
276
+ amount1Out: string;
277
+ senderAccountHash: string;
278
+ }
279
+ /** Swap history query params */
280
+ interface SwapHistoryQuery {
281
+ publicKey?: string;
282
+ pairContractPackageHash?: string;
283
+ page?: number;
284
+ pageSize?: number;
285
+ }
286
+
287
+ interface PairQuery {
288
+ page?: number;
289
+ pageSize?: number;
290
+ orderBy?: 'timestamp' | 'reserve0' | 'reserve1';
291
+ orderDirection?: 'asc' | 'desc';
292
+ token0Hash?: string;
293
+ token1Hash?: string;
294
+ currencyId?: number;
295
+ }
296
+ interface PaginatedResult<T> {
297
+ data: T[];
298
+ itemCount: number;
299
+ pageCount: number;
300
+ }
301
+
302
+ interface CsprTradeClientConfig {
303
+ network: 'mainnet' | 'testnet';
304
+ apiUrl?: string;
305
+ routerPackageHash?: string;
306
+ wcsprPackageHash?: string;
307
+ signer?: Signer;
308
+ }
309
+ declare class CsprTradeClient {
310
+ private readonly http;
311
+ private readonly tokensApi;
312
+ private readonly pairsApi;
313
+ private readonly quotesApi;
314
+ private readonly liquidityApi;
315
+ private readonly ratesApi;
316
+ private readonly currenciesApi;
317
+ private readonly swapsApi;
318
+ private readonly tokenResolver;
319
+ private readonly currencyResolver;
320
+ private readonly networkConfig;
321
+ private readonly signer?;
322
+ constructor(config: CsprTradeClientConfig);
323
+ getTokens(currency?: string): Promise<Token[]>;
324
+ getPairs(opts?: PairQuery & {
325
+ currency?: string;
326
+ }): Promise<PaginatedResult<Pair>>;
327
+ getPairDetails(pairIdentifier: string, currency?: string): Promise<Pair>;
328
+ getQuote(params: QuoteParams): Promise<Quote>;
329
+ getCurrencies(): Promise<Currency[]>;
330
+ getLiquidityPositions(publicKey: string, currency?: string): Promise<LiquidityPosition[]>;
331
+ getImpermanentLoss(publicKey: string, pairHash: string): Promise<ImpermanentLoss>;
332
+ getSwapHistory(opts?: SwapHistoryQuery): Promise<PaginatedApiResponse<unknown>>;
333
+ buildSwap(params: SwapParams): Promise<TransactionBundle>;
334
+ buildApproval(params: ApprovalParams): Promise<TransactionBundle>;
335
+ buildAddLiquidity(params: AddLiquidityParams): Promise<TransactionBundle>;
336
+ buildRemoveLiquidity(params: RemoveLiquidityParams): Promise<TransactionBundle>;
337
+ /** Submit a signed transaction to the Casper node RPC */
338
+ submitTransaction(signedTransactionJson: string): Promise<SubmitResult>;
339
+ /** @deprecated Use submitTransaction instead — all transactions now submit via node RPC */
340
+ submitTransactionDirect(signedTransactionJson: string): Promise<SubmitResult>;
341
+ resolveToken(identifier: string): Promise<Token>;
342
+ }
343
+
344
+ interface NetworkConfig {
345
+ chainName: string;
346
+ apiUrl: string;
347
+ nodeRpcUrl: string;
348
+ routerPackageHash: string;
349
+ wcsprPackageHash: string;
350
+ gasPrice: number;
351
+ ttl: number;
352
+ }
353
+ declare const TESTNET_CONFIG: NetworkConfig;
354
+ declare const MAINNET_CONFIG: NetworkConfig;
355
+ declare function getNetworkConfig(network: 'mainnet' | 'testnet'): NetworkConfig;
356
+
357
+ declare function toRawAmount(humanAmount: string, decimals: number): string;
358
+ declare function toFormattedAmount(rawAmount: string, decimals: number): string;
359
+ declare function calculateMinWithSlippage(rawAmount: string, slippageBps: number): string;
360
+ declare function calculateMaxWithSlippage(rawAmount: string, slippageBps: number): string;
361
+
362
+ export { type AddLiquidityParams, type ApiError, type ApiResponse, type ApprovalParams, type ContractPackage, CsprTradeClient, type CsprTradeClientConfig, type Currency, type ImpermanentLoss, type ImpermanentLossApiResponse, type LiquidityPosition, type LiquidityPositionApiResponse, MAINNET_CONFIG, type NetworkConfig, type PaginatedApiResponse, type PaginationOptions, type Pair, type PairApiResponse, type Quote, type QuoteApiResponse, type QuoteParams, type QuoteType, type RemoveLiquidityParams, type Signer, type SortOptions, type SubmitResult, type SwapHistoryEntry, type SwapHistoryQuery, type SwapParams, TESTNET_CONFIG, type Token, type TokenApiResponse, type TokenMetadata, type TransactionBundle, type TransactionStatus, calculateMaxWithSlippage, calculateMinWithSlippage, getNetworkConfig, toFormattedAmount, toRawAmount };