@sun-protocol/sun-sdk-sunswap-v2 0.1.0-beta.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.
- package/README.md +32 -0
- package/dist/index.cjs +1194 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +356 -0
- package/dist/index.d.ts +356 -0
- package/dist/index.js +1108 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { Network, TronAddress, Token, BigintIsh, ContractCallAction, Percent, CurrencyAmount, Price, Currency, TradeType, ContractParameter } from '@sun-protocol/sun-sdk-core';
|
|
2
|
+
import JSBI from 'jsbi';
|
|
3
|
+
|
|
4
|
+
declare const V2_ROUTER_SELECTORS: {
|
|
5
|
+
readonly addLiquidity: "addLiquidity(address,address,uint256,uint256,uint256,uint256,address,uint256)";
|
|
6
|
+
readonly addLiquidityETH: "addLiquidityETH(address,uint256,uint256,uint256,address,uint256)";
|
|
7
|
+
readonly removeLiquidity: "removeLiquidity(address,address,uint256,uint256,uint256,address,uint256)";
|
|
8
|
+
readonly removeLiquidityETH: "removeLiquidityETH(address,uint256,uint256,uint256,address,uint256)";
|
|
9
|
+
readonly swapExactETHForTokens: "swapExactETHForTokens(uint256,address[],address,uint256)";
|
|
10
|
+
readonly swapETHForExactTokens: "swapETHForExactTokens(uint256,address[],address,uint256)";
|
|
11
|
+
readonly swapExactTokensForETH: "swapExactTokensForETH(uint256,uint256,address[],address,uint256)";
|
|
12
|
+
readonly swapExactTokensForTokens: "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)";
|
|
13
|
+
readonly swapTokensForExactETH: "swapTokensForExactETH(uint256,uint256,address[],address,uint256)";
|
|
14
|
+
readonly swapTokensForExactTokens: "swapTokensForExactTokens(uint256,uint256,address[],address,uint256)";
|
|
15
|
+
};
|
|
16
|
+
interface V2ActionOptions {
|
|
17
|
+
readonly network: Network;
|
|
18
|
+
readonly router?: TronAddress;
|
|
19
|
+
readonly feeLimit?: number;
|
|
20
|
+
readonly id?: string;
|
|
21
|
+
}
|
|
22
|
+
interface BuildV2AddLiquidityActionParams extends V2ActionOptions {
|
|
23
|
+
readonly tokenA: Token;
|
|
24
|
+
readonly tokenB: Token;
|
|
25
|
+
readonly amountADesired: BigintIsh;
|
|
26
|
+
readonly amountBDesired: BigintIsh;
|
|
27
|
+
readonly amountAMin: BigintIsh;
|
|
28
|
+
readonly amountBMin: BigintIsh;
|
|
29
|
+
readonly recipient: TronAddress;
|
|
30
|
+
readonly deadline: BigintIsh;
|
|
31
|
+
}
|
|
32
|
+
interface BuildV2RemoveLiquidityActionParams extends V2ActionOptions {
|
|
33
|
+
readonly tokenA: Token;
|
|
34
|
+
readonly tokenB: Token;
|
|
35
|
+
readonly liquidity: BigintIsh;
|
|
36
|
+
readonly amountAMin: BigintIsh;
|
|
37
|
+
readonly amountBMin: BigintIsh;
|
|
38
|
+
readonly recipient: TronAddress;
|
|
39
|
+
readonly deadline: BigintIsh;
|
|
40
|
+
}
|
|
41
|
+
interface BuildV2AddLiquidityEthActionParams extends V2ActionOptions {
|
|
42
|
+
readonly token: Token;
|
|
43
|
+
readonly amountTokenDesired: BigintIsh;
|
|
44
|
+
readonly amountEthDesired: BigintIsh;
|
|
45
|
+
readonly amountTokenMin: BigintIsh;
|
|
46
|
+
readonly amountEthMin: BigintIsh;
|
|
47
|
+
readonly recipient: TronAddress;
|
|
48
|
+
readonly deadline: BigintIsh;
|
|
49
|
+
}
|
|
50
|
+
interface BuildV2RemoveLiquidityEthActionParams extends V2ActionOptions {
|
|
51
|
+
readonly token: Token;
|
|
52
|
+
readonly liquidity: BigintIsh;
|
|
53
|
+
readonly amountTokenMin: BigintIsh;
|
|
54
|
+
readonly amountEthMin: BigintIsh;
|
|
55
|
+
readonly recipient: TronAddress;
|
|
56
|
+
readonly deadline: BigintIsh;
|
|
57
|
+
}
|
|
58
|
+
interface V2SwapActionOptions extends V2ActionOptions {
|
|
59
|
+
readonly path: readonly TronAddress[];
|
|
60
|
+
readonly recipient: TronAddress;
|
|
61
|
+
readonly deadline: BigintIsh;
|
|
62
|
+
}
|
|
63
|
+
interface BuildV2SwapExactEthForTokensActionParams extends V2SwapActionOptions {
|
|
64
|
+
readonly amountIn: BigintIsh;
|
|
65
|
+
readonly amountOutMin: BigintIsh;
|
|
66
|
+
}
|
|
67
|
+
interface BuildV2SwapEthForExactTokensActionParams extends V2SwapActionOptions {
|
|
68
|
+
readonly amountOut: BigintIsh;
|
|
69
|
+
readonly amountInMax: BigintIsh;
|
|
70
|
+
}
|
|
71
|
+
interface BuildV2SwapExactTokensForEthActionParams extends V2SwapActionOptions {
|
|
72
|
+
readonly amountIn: BigintIsh;
|
|
73
|
+
readonly amountOutMin: BigintIsh;
|
|
74
|
+
}
|
|
75
|
+
interface BuildV2SwapExactTokensForTokensActionParams extends V2SwapActionOptions {
|
|
76
|
+
readonly amountIn: BigintIsh;
|
|
77
|
+
readonly amountOutMin: BigintIsh;
|
|
78
|
+
}
|
|
79
|
+
interface BuildV2SwapTokensForExactEthActionParams extends V2SwapActionOptions {
|
|
80
|
+
readonly amountOut: BigintIsh;
|
|
81
|
+
readonly amountInMax: BigintIsh;
|
|
82
|
+
}
|
|
83
|
+
interface BuildV2SwapTokensForExactTokensActionParams extends V2SwapActionOptions {
|
|
84
|
+
readonly amountOut: BigintIsh;
|
|
85
|
+
readonly amountInMax: BigintIsh;
|
|
86
|
+
}
|
|
87
|
+
declare function buildV2AddLiquidityAction(params: BuildV2AddLiquidityActionParams): ContractCallAction;
|
|
88
|
+
declare function buildV2RemoveLiquidityAction(params: BuildV2RemoveLiquidityActionParams): ContractCallAction;
|
|
89
|
+
declare function buildV2AddLiquidityEthAction(params: BuildV2AddLiquidityEthActionParams): ContractCallAction;
|
|
90
|
+
declare function buildV2RemoveLiquidityEthAction(params: BuildV2RemoveLiquidityEthActionParams): ContractCallAction;
|
|
91
|
+
declare function buildV2SwapExactEthForTokensAction(params: BuildV2SwapExactEthForTokensActionParams): ContractCallAction;
|
|
92
|
+
declare function buildV2SwapEthForExactTokensAction(params: BuildV2SwapEthForExactTokensActionParams): ContractCallAction;
|
|
93
|
+
declare function buildV2SwapExactTokensForEthAction(params: BuildV2SwapExactTokensForEthActionParams): ContractCallAction;
|
|
94
|
+
declare function buildV2SwapExactTokensForTokensAction(params: BuildV2SwapExactTokensForTokensActionParams): ContractCallAction;
|
|
95
|
+
declare function buildV2SwapTokensForExactEthAction(params: BuildV2SwapTokensForExactEthActionParams): ContractCallAction;
|
|
96
|
+
declare function buildV2SwapTokensForExactTokensAction(params: BuildV2SwapTokensForExactTokensActionParams): ContractCallAction;
|
|
97
|
+
declare function buildV2LpApproveAction(params: {
|
|
98
|
+
readonly pair: TronAddress;
|
|
99
|
+
readonly spender: TronAddress;
|
|
100
|
+
readonly amount: BigintIsh;
|
|
101
|
+
readonly feeLimit?: number;
|
|
102
|
+
readonly id?: string;
|
|
103
|
+
}): ContractCallAction;
|
|
104
|
+
|
|
105
|
+
declare const FACTORY_ADDRESS = "0x689abaeeed3f0bb3585773192e23224cac25dd41";
|
|
106
|
+
declare const FACTORY_ADDRESS_MAP: {
|
|
107
|
+
[chainId: number]: string;
|
|
108
|
+
};
|
|
109
|
+
declare const INIT_CODE_HASH = "0x6d3f89421f83e4b62e628de8fc7ff2b014a79bf8fd8e8b0ea46e4a1d9409b67d";
|
|
110
|
+
declare const INIT_CODE_HASH_MAP: {
|
|
111
|
+
[chainId: number]: string;
|
|
112
|
+
};
|
|
113
|
+
declare const MINIMUM_LIQUIDITY: JSBI;
|
|
114
|
+
declare const ZERO: JSBI;
|
|
115
|
+
declare const ONE: JSBI;
|
|
116
|
+
declare const FIVE: JSBI;
|
|
117
|
+
declare const _997: JSBI;
|
|
118
|
+
declare const _1000: JSBI;
|
|
119
|
+
declare const BASIS_POINTS: JSBI;
|
|
120
|
+
declare const ZERO_PERCENT: Percent;
|
|
121
|
+
declare const ONE_HUNDRED_PERCENT: Percent;
|
|
122
|
+
|
|
123
|
+
declare class InsufficientReservesError extends Error {
|
|
124
|
+
readonly isInsufficientReservesError: true;
|
|
125
|
+
constructor();
|
|
126
|
+
}
|
|
127
|
+
declare class InsufficientInputAmountError extends Error {
|
|
128
|
+
readonly isInsufficientInputAmountError: true;
|
|
129
|
+
constructor();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare const computePairAddress: ({ factoryAddress, tokenA, tokenB, initCodeHashManualOverride, }: {
|
|
133
|
+
factoryAddress: string;
|
|
134
|
+
tokenA: Token;
|
|
135
|
+
tokenB: Token;
|
|
136
|
+
initCodeHashManualOverride?: string;
|
|
137
|
+
}) => string;
|
|
138
|
+
declare class Pair {
|
|
139
|
+
readonly liquidityToken: Token;
|
|
140
|
+
private readonly tokenAmounts;
|
|
141
|
+
static getAddress(tokenA: Token, tokenB: Token): string;
|
|
142
|
+
constructor(currencyAmountA: CurrencyAmount<Token>, tokenAmountB: CurrencyAmount<Token>);
|
|
143
|
+
involvesToken(token: Token): boolean;
|
|
144
|
+
get token0Price(): Price<Token, Token>;
|
|
145
|
+
get token1Price(): Price<Token, Token>;
|
|
146
|
+
priceOf(token: Token): Price<Token, Token>;
|
|
147
|
+
get chainId(): number;
|
|
148
|
+
get token0(): Token;
|
|
149
|
+
get token1(): Token;
|
|
150
|
+
get reserve0(): CurrencyAmount<Token>;
|
|
151
|
+
get reserve1(): CurrencyAmount<Token>;
|
|
152
|
+
reserveOf(token: Token): CurrencyAmount<Token>;
|
|
153
|
+
getOutputAmount(inputAmount: CurrencyAmount<Token>, calculateFotFees?: boolean): [CurrencyAmount<Token>, Pair];
|
|
154
|
+
getInputAmount(outputAmount: CurrencyAmount<Token>, calculateFotFees?: boolean): [CurrencyAmount<Token>, Pair];
|
|
155
|
+
getLiquidityMinted(totalSupply: CurrencyAmount<Token>, tokenAmountA: CurrencyAmount<Token>, tokenAmountB: CurrencyAmount<Token>): CurrencyAmount<Token>;
|
|
156
|
+
getLiquidityValue(token: Token, totalSupply: CurrencyAmount<Token>, liquidity: CurrencyAmount<Token>, feeOn?: boolean, kLast?: BigintIsh): CurrencyAmount<Token>;
|
|
157
|
+
private derivePercentAfterSellFees;
|
|
158
|
+
private derivePercentAfterBuyFees;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare class Route<TInput extends Currency, TOutput extends Currency> {
|
|
162
|
+
readonly pairs: Pair[];
|
|
163
|
+
readonly path: Token[];
|
|
164
|
+
readonly input: TInput;
|
|
165
|
+
readonly output: TOutput;
|
|
166
|
+
private _midPrice;
|
|
167
|
+
constructor(pairs: Pair[], input: TInput, output?: TOutput);
|
|
168
|
+
get midPrice(): Price<TInput, TOutput>;
|
|
169
|
+
get chainId(): number;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface InputOutput<TInput extends Currency, TOutput extends Currency> {
|
|
173
|
+
readonly inputAmount: CurrencyAmount<TInput>;
|
|
174
|
+
readonly outputAmount: CurrencyAmount<TOutput>;
|
|
175
|
+
}
|
|
176
|
+
declare function inputOutputComparator<TInput extends Currency, TOutput extends Currency>(a: InputOutput<TInput, TOutput>, b: InputOutput<TInput, TOutput>): number;
|
|
177
|
+
declare function tradeComparator<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(a: Trade<TInput, TOutput, TTradeType>, b: Trade<TInput, TOutput, TTradeType>): number;
|
|
178
|
+
interface BestTradeOptions {
|
|
179
|
+
maxNumResults?: number;
|
|
180
|
+
maxHops?: number;
|
|
181
|
+
}
|
|
182
|
+
declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
|
|
183
|
+
readonly route: Route<TInput, TOutput>;
|
|
184
|
+
readonly tradeType: TTradeType;
|
|
185
|
+
readonly inputAmount: CurrencyAmount<TInput>;
|
|
186
|
+
readonly outputAmount: CurrencyAmount<TOutput>;
|
|
187
|
+
readonly executionPrice: Price<TInput, TOutput>;
|
|
188
|
+
readonly priceImpact: Percent;
|
|
189
|
+
static exactIn<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountIn: CurrencyAmount<TInput>): Trade<TInput, TOutput, TradeType.EXACT_INPUT>;
|
|
190
|
+
static exactOut<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountOut: CurrencyAmount<TOutput>): Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>;
|
|
191
|
+
constructor(route: Route<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType);
|
|
192
|
+
minimumAmountOut(slippageTolerance: Percent): CurrencyAmount<TOutput>;
|
|
193
|
+
maximumAmountIn(slippageTolerance: Percent): CurrencyAmount<TInput>;
|
|
194
|
+
static bestTradeExactIn<TInput extends Currency, TOutput extends Currency>(pairs: Pair[], currencyAmountIn: CurrencyAmount<TInput>, currencyOut: TOutput, { maxNumResults, maxHops }?: BestTradeOptions, currentPairs?: Pair[], nextAmountIn?: CurrencyAmount<Currency>, bestTrades?: Trade<TInput, TOutput, TradeType.EXACT_INPUT>[]): Trade<TInput, TOutput, TradeType.EXACT_INPUT>[];
|
|
195
|
+
worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
|
|
196
|
+
static bestTradeExactOut<TInput extends Currency, TOutput extends Currency>(pairs: Pair[], currencyIn: TInput, currencyAmountOut: CurrencyAmount<TOutput>, { maxNumResults, maxHops }?: BestTradeOptions, currentPairs?: Pair[], nextAmountOut?: CurrencyAmount<Currency>, bestTrades?: Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>[]): Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>[];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface V2ContractReadSpec {
|
|
200
|
+
readonly target: TronAddress;
|
|
201
|
+
readonly functionSelector: string;
|
|
202
|
+
readonly parameters?: readonly ContractParameter[];
|
|
203
|
+
readonly outputs?: readonly {
|
|
204
|
+
readonly type: string;
|
|
205
|
+
readonly name?: string;
|
|
206
|
+
}[];
|
|
207
|
+
readonly metadata?: Record<string, unknown>;
|
|
208
|
+
}
|
|
209
|
+
declare const V2_PAIR_READ_SELECTORS: {
|
|
210
|
+
readonly getReserves: "getReserves()";
|
|
211
|
+
readonly totalSupply: "totalSupply()";
|
|
212
|
+
readonly kLast: "kLast()";
|
|
213
|
+
readonly balanceOf: "balanceOf(address)";
|
|
214
|
+
readonly allowance: "allowance(address,address)";
|
|
215
|
+
};
|
|
216
|
+
declare const V2_FACTORY_READ_SELECTORS: {
|
|
217
|
+
readonly getPair: "getPair(address,address)";
|
|
218
|
+
readonly feeTo: "feeTo()";
|
|
219
|
+
};
|
|
220
|
+
declare const V2_ROUTER_READ_SELECTORS: {
|
|
221
|
+
readonly getAmountsOut: "getAmountsOut(uint256,address[])";
|
|
222
|
+
readonly getAmountsIn: "getAmountsIn(uint256,address[])";
|
|
223
|
+
readonly isAllowedTradingPair: "isAllowedTradingPair(address,address)";
|
|
224
|
+
};
|
|
225
|
+
interface V2RouterReadOptions {
|
|
226
|
+
readonly network: Network;
|
|
227
|
+
readonly router?: TronAddress;
|
|
228
|
+
}
|
|
229
|
+
interface V2FactoryReadOptions {
|
|
230
|
+
readonly network: Network;
|
|
231
|
+
readonly factory?: TronAddress;
|
|
232
|
+
}
|
|
233
|
+
interface BuildV2FactoryPairReadParams extends V2FactoryReadOptions {
|
|
234
|
+
readonly tokenA: TronAddress;
|
|
235
|
+
readonly tokenB: TronAddress;
|
|
236
|
+
}
|
|
237
|
+
interface BuildV2RouterAmountsOutReadParams extends V2RouterReadOptions {
|
|
238
|
+
readonly amountIn: BigintIsh;
|
|
239
|
+
readonly path: readonly TronAddress[];
|
|
240
|
+
}
|
|
241
|
+
interface BuildV2RouterAmountsInReadParams extends V2RouterReadOptions {
|
|
242
|
+
readonly amountOut: BigintIsh;
|
|
243
|
+
readonly path: readonly TronAddress[];
|
|
244
|
+
}
|
|
245
|
+
interface BuildV2RouterAllowedTradingPairReadParams extends V2RouterReadOptions {
|
|
246
|
+
readonly tokenA: TronAddress;
|
|
247
|
+
readonly tokenB: TronAddress;
|
|
248
|
+
}
|
|
249
|
+
declare function buildV2PairReservesRead(pair: TronAddress): V2ContractReadSpec;
|
|
250
|
+
declare function buildV2PairTotalSupplyRead(pair: TronAddress): V2ContractReadSpec;
|
|
251
|
+
declare function buildV2PairKLastRead(pair: TronAddress): V2ContractReadSpec;
|
|
252
|
+
declare function buildV2PairBalanceRead(pair: TronAddress, owner: TronAddress): V2ContractReadSpec;
|
|
253
|
+
declare function buildV2PairAllowanceRead(pair: TronAddress, owner: TronAddress, spender: TronAddress): V2ContractReadSpec;
|
|
254
|
+
declare function buildV2FactoryPairRead(params: BuildV2FactoryPairReadParams): V2ContractReadSpec;
|
|
255
|
+
declare function buildV2FactoryFeeToRead(params: V2FactoryReadOptions): V2ContractReadSpec;
|
|
256
|
+
declare function buildV2RouterAmountsOutRead(params: BuildV2RouterAmountsOutReadParams): V2ContractReadSpec;
|
|
257
|
+
declare function buildV2RouterAmountsInRead(params: BuildV2RouterAmountsInReadParams): V2ContractReadSpec;
|
|
258
|
+
declare function buildV2RouterAllowedTradingPairRead(params: BuildV2RouterAllowedTradingPairReadParams): V2ContractReadSpec;
|
|
259
|
+
declare function normalizeV2ReserveResult(result: readonly unknown[]): {
|
|
260
|
+
reserve0: string;
|
|
261
|
+
reserve1: string;
|
|
262
|
+
};
|
|
263
|
+
declare function normalizeV2AmountsResult(result: unknown): string[];
|
|
264
|
+
|
|
265
|
+
interface TradeOptions {
|
|
266
|
+
readonly allowedSlippage: Percent;
|
|
267
|
+
readonly ttl: number;
|
|
268
|
+
readonly recipient: string;
|
|
269
|
+
readonly feeOnTransfer?: boolean;
|
|
270
|
+
}
|
|
271
|
+
interface TradeOptionsDeadline extends Omit<TradeOptions, 'ttl'> {
|
|
272
|
+
readonly deadline: number;
|
|
273
|
+
}
|
|
274
|
+
interface SwapParameters {
|
|
275
|
+
readonly methodName: string;
|
|
276
|
+
readonly args: (string | string[])[];
|
|
277
|
+
readonly value: string;
|
|
278
|
+
}
|
|
279
|
+
declare abstract class Router {
|
|
280
|
+
private constructor();
|
|
281
|
+
static swapCallParameters(trade: Trade<Currency, Currency, TradeType>, options: TradeOptions | TradeOptionsDeadline): SwapParameters;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
interface V2PairKey {
|
|
285
|
+
readonly network: Network;
|
|
286
|
+
readonly token0: Token;
|
|
287
|
+
readonly token1: Token;
|
|
288
|
+
}
|
|
289
|
+
interface V2PairState {
|
|
290
|
+
readonly pair: TronAddress;
|
|
291
|
+
readonly pairKey: V2PairKey;
|
|
292
|
+
readonly reserve0: string;
|
|
293
|
+
readonly reserve1: string;
|
|
294
|
+
readonly totalSupply?: string;
|
|
295
|
+
}
|
|
296
|
+
interface V2LiquidityAmounts {
|
|
297
|
+
readonly amountA: string;
|
|
298
|
+
readonly amountB: string;
|
|
299
|
+
}
|
|
300
|
+
interface V2AddLiquidityAmounts extends V2LiquidityAmounts {
|
|
301
|
+
readonly amountAMin: string;
|
|
302
|
+
readonly amountBMin: string;
|
|
303
|
+
}
|
|
304
|
+
interface V2RemoveLiquidityAmounts {
|
|
305
|
+
readonly liquidity: string;
|
|
306
|
+
readonly amountAMin: string;
|
|
307
|
+
readonly amountBMin: string;
|
|
308
|
+
}
|
|
309
|
+
interface V2TokenPairAmountInput {
|
|
310
|
+
readonly tokenA: Token;
|
|
311
|
+
readonly tokenB: Token;
|
|
312
|
+
readonly amountA: BigintIsh;
|
|
313
|
+
readonly amountB: BigintIsh;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare const V2_INIT_CODE_HASH: Record<Network, `0x${string}`>;
|
|
317
|
+
interface ComputeV2PairAddressParams {
|
|
318
|
+
readonly network: Network;
|
|
319
|
+
readonly tokenA: TronAddress | string;
|
|
320
|
+
readonly tokenB: TronAddress | string;
|
|
321
|
+
readonly factory?: TronAddress | string;
|
|
322
|
+
readonly initCodeHash?: string;
|
|
323
|
+
readonly wrappedNative?: TronAddress | string;
|
|
324
|
+
}
|
|
325
|
+
declare function sortV2Tokens(tokenA: Token, tokenB: Token): readonly [Token, Token];
|
|
326
|
+
declare function tronAddressToEvmHex(address: string, label?: string): string;
|
|
327
|
+
declare function evmHexToTronAddress(address: string, label?: string): TronAddress;
|
|
328
|
+
declare function tronCreate2Address(params: {
|
|
329
|
+
readonly factoryAddress: string;
|
|
330
|
+
readonly salt: string;
|
|
331
|
+
readonly initCodeHash: string;
|
|
332
|
+
}): TronAddress;
|
|
333
|
+
declare function computeV2PairAddress(params: ComputeV2PairAddressParams): TronAddress;
|
|
334
|
+
declare function createV2PairKey(input: {
|
|
335
|
+
network: V2PairKey['network'];
|
|
336
|
+
tokenA: Token;
|
|
337
|
+
tokenB: Token;
|
|
338
|
+
}): V2PairKey;
|
|
339
|
+
declare function quoteV2LiquidityAmount(amountA: BigintIsh, reserveA: BigintIsh, reserveB: BigintIsh): string;
|
|
340
|
+
declare function applyV2SlippageMin(amount: BigintIsh, slippageTolerance: Percent): string;
|
|
341
|
+
declare function getV2AddLiquidityMinimums(amounts: {
|
|
342
|
+
amountA: BigintIsh;
|
|
343
|
+
amountB: BigintIsh;
|
|
344
|
+
}, slippageTolerance: Percent): {
|
|
345
|
+
amountAMin: string;
|
|
346
|
+
amountBMin: string;
|
|
347
|
+
};
|
|
348
|
+
declare function getV2RemoveLiquidityMinimums(amounts: {
|
|
349
|
+
amountA: BigintIsh;
|
|
350
|
+
amountB: BigintIsh;
|
|
351
|
+
}, slippageTolerance: Percent): {
|
|
352
|
+
amountAMin: string;
|
|
353
|
+
amountBMin: string;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export { BASIS_POINTS, type BestTradeOptions, type BuildV2AddLiquidityActionParams, type BuildV2AddLiquidityEthActionParams, type BuildV2FactoryPairReadParams, type BuildV2RemoveLiquidityActionParams, type BuildV2RemoveLiquidityEthActionParams, type BuildV2RouterAllowedTradingPairReadParams, type BuildV2RouterAmountsInReadParams, type BuildV2RouterAmountsOutReadParams, type BuildV2SwapEthForExactTokensActionParams, type BuildV2SwapExactEthForTokensActionParams, type BuildV2SwapExactTokensForEthActionParams, type BuildV2SwapExactTokensForTokensActionParams, type BuildV2SwapTokensForExactEthActionParams, type BuildV2SwapTokensForExactTokensActionParams, type ComputeV2PairAddressParams, FACTORY_ADDRESS, FACTORY_ADDRESS_MAP, FIVE, INIT_CODE_HASH, INIT_CODE_HASH_MAP, InsufficientInputAmountError, InsufficientReservesError, MINIMUM_LIQUIDITY, ONE, ONE_HUNDRED_PERCENT, Pair, Route, Router, type SwapParameters, Trade, type TradeOptions, type TradeOptionsDeadline, type V2ActionOptions, type V2AddLiquidityAmounts, type V2ContractReadSpec, type V2FactoryReadOptions, type V2LiquidityAmounts, type V2PairKey, type V2PairState, type V2RemoveLiquidityAmounts, type V2RouterReadOptions, type V2SwapActionOptions, type V2TokenPairAmountInput, V2_FACTORY_READ_SELECTORS, V2_INIT_CODE_HASH, V2_PAIR_READ_SELECTORS, V2_ROUTER_READ_SELECTORS, V2_ROUTER_SELECTORS, ZERO, ZERO_PERCENT, _1000, _997, applyV2SlippageMin, buildV2AddLiquidityAction, buildV2AddLiquidityEthAction, buildV2FactoryFeeToRead, buildV2FactoryPairRead, buildV2LpApproveAction, buildV2PairAllowanceRead, buildV2PairBalanceRead, buildV2PairKLastRead, buildV2PairReservesRead, buildV2PairTotalSupplyRead, buildV2RemoveLiquidityAction, buildV2RemoveLiquidityEthAction, buildV2RouterAllowedTradingPairRead, buildV2RouterAmountsInRead, buildV2RouterAmountsOutRead, buildV2SwapEthForExactTokensAction, buildV2SwapExactEthForTokensAction, buildV2SwapExactTokensForEthAction, buildV2SwapExactTokensForTokensAction, buildV2SwapTokensForExactEthAction, buildV2SwapTokensForExactTokensAction, computePairAddress, computeV2PairAddress, createV2PairKey, evmHexToTronAddress, getV2AddLiquidityMinimums, getV2RemoveLiquidityMinimums, inputOutputComparator, normalizeV2AmountsResult, normalizeV2ReserveResult, quoteV2LiquidityAmount, sortV2Tokens, tradeComparator, tronAddressToEvmHex, tronCreate2Address };
|