@juiceswapxyz/v4-sdk 0.1.4-beta.0 → 3.0.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.
@@ -1,220 +0,0 @@
1
- import { Currency, Percent, Price, CurrencyAmount, TradeType } from '@juiceswapxyz/sdk-core';
2
- import { Pool } from './pool';
3
- import { Route } from './route';
4
- /**
5
- * Trades comparator, an extension of the input output comparator that also considers other dimensions of the trade in ranking them
6
- * @template TInput The input currency, either Ether or an ERC-20
7
- * @template TOutput The output currency, either Ether or an ERC-20
8
- * @template TTradeType The trade type, either exact input or exact output
9
- * @param a The first trade to compare
10
- * @param b The second trade to compare
11
- * @returns A sorted ordering for two neighboring elements in a trade array
12
- */
13
- export declare function tradeComparator<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(a: Trade<TInput, TOutput, TTradeType>, b: Trade<TInput, TOutput, TTradeType>): number;
14
- export interface BestTradeOptions {
15
- maxNumResults?: number;
16
- maxHops?: number;
17
- }
18
- /**
19
- * Represents a trade executed against a set of routes where some percentage of the input is
20
- * split across each route.
21
- *
22
- * Each route has its own set of pools. Pools can not be re-used across routes.
23
- *
24
- * Does not account for slippage, i.e., changes in price environment that can occur between
25
- * the time the trade is submitted and when it is executed.
26
- * @template TInput The input currency, either Ether or an ERC-20
27
- * @template TOutput The output currency, either Ether or an ERC-20
28
- * @template TTradeType The trade type, either exact input or exact output
29
- */
30
- export declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
31
- /**
32
- * @deprecated Deprecated in favor of 'swaps' property. If the trade consists of multiple routes
33
- * this will return an error.
34
- *
35
- * When the trade consists of just a single route, this returns the route of the trade,
36
- * i.e. which pools the trade goes through.
37
- */
38
- get route(): Route<TInput, TOutput>;
39
- /**
40
- * The swaps of the trade, i.e. which routes and how much is swapped in each that
41
- * make up the trade.
42
- */
43
- readonly swaps: {
44
- route: Route<TInput, TOutput>;
45
- inputAmount: CurrencyAmount<TInput>;
46
- outputAmount: CurrencyAmount<TOutput>;
47
- }[];
48
- /**
49
- * The type of the trade, either exact in or exact out.
50
- */
51
- readonly tradeType: TTradeType;
52
- /**
53
- * The cached result of the input amount computation
54
- * @private
55
- */
56
- private _inputAmount;
57
- /**
58
- * The input amount for the trade assuming no slippage.
59
- */
60
- get inputAmount(): CurrencyAmount<TInput>;
61
- /**
62
- * The cached result of the output amount computation
63
- * @private
64
- */
65
- private _outputAmount;
66
- /**
67
- * The output amount for the trade assuming no slippage.
68
- */
69
- get outputAmount(): CurrencyAmount<TOutput>;
70
- /**
71
- * The cached result of the computed execution price
72
- * @private
73
- */
74
- private _executionPrice;
75
- /**
76
- * The price expressed in terms of output amount/input amount.
77
- */
78
- get executionPrice(): Price<TInput, TOutput>;
79
- /**
80
- * The cached result of the price impact computation
81
- * @private
82
- */
83
- private _priceImpact;
84
- /**
85
- * Returns the percent difference between the route's mid price and the price impact
86
- */
87
- get priceImpact(): Percent;
88
- /**
89
- * Constructs an exact in trade with the given amount in and route
90
- * @template TInput The input currency, either Ether or an ERC-20
91
- * @template TOutput The output currency, either Ether or an ERC-20
92
- * @param route The route of the exact in trade
93
- * @param amountIn The amount being passed in
94
- * @returns The exact in trade
95
- */
96
- static exactIn<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountIn: CurrencyAmount<TInput>): Promise<Trade<TInput, TOutput, TradeType.EXACT_INPUT>>;
97
- /**
98
- * Constructs an exact out trade with the given amount out and route
99
- * @template TInput The input currency, either Ether or an ERC-20
100
- * @template TOutput The output currency, either Ether or an ERC-20
101
- * @param route The route of the exact out trade
102
- * @param amountOut The amount returned by the trade
103
- * @returns The exact out trade
104
- */
105
- static exactOut<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountOut: CurrencyAmount<TOutput>): Promise<Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>>;
106
- /**
107
- * Constructs a trade by simulating swaps through the given route
108
- * @template TInput The input currency, either Ether or an ERC-20.
109
- * @template TOutput The output currency, either Ether or an ERC-20.
110
- * @template TTradeType The type of the trade, either exact in or exact out.
111
- * @param route route to swap through
112
- * @param amount the amount specified, either input or output, depending on tradeType
113
- * @param tradeType whether the trade is an exact input or exact output swap
114
- * @returns The route
115
- */
116
- static fromRoute<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(route: Route<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType): Promise<Trade<TInput, TOutput, TTradeType>>;
117
- /**
118
- * Constructs a trade from routes by simulating swaps
119
- *
120
- * @template TInput The input currency, either Ether or an ERC-20.
121
- * @template TOutput The output currency, either Ether or an ERC-20.
122
- * @template TTradeType The type of the trade, either exact in or exact out.
123
- * @param routes the routes to swap through and how much of the amount should be routed through each
124
- * @param tradeType whether the trade is an exact input or exact output swap
125
- * @returns The trade
126
- */
127
- static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(routes: {
128
- amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
129
- route: Route<TInput, TOutput>;
130
- }[], tradeType: TTradeType): Promise<Trade<TInput, TOutput, TTradeType>>;
131
- /**
132
- * Creates a trade without computing the result of swapping through the route. Useful when you have simulated the trade
133
- * elsewhere and do not have any tick data
134
- * @template TInput The input currency, either Ether or an ERC-20
135
- * @template TOutput The output currency, either Ether or an ERC-20
136
- * @template TTradeType The type of the trade, either exact in or exact out
137
- * @param constructorArguments The arguments passed to the trade constructor
138
- * @returns The unchecked trade
139
- */
140
- static createUncheckedTrade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(constructorArguments: {
141
- route: Route<TInput, TOutput>;
142
- inputAmount: CurrencyAmount<TInput>;
143
- outputAmount: CurrencyAmount<TOutput>;
144
- tradeType: TTradeType;
145
- }): Trade<TInput, TOutput, TTradeType>;
146
- /**
147
- * Creates a trade without computing the result of swapping through the routes. Useful when you have simulated the trade
148
- * elsewhere and do not have any tick data
149
- * @template TInput The input currency, either Ether or an ERC-20
150
- * @template TOutput The output currency, either Ether or an ERC-20
151
- * @template TTradeType The type of the trade, either exact in or exact out
152
- * @param constructorArguments The arguments passed to the trade constructor
153
- * @returns The unchecked trade
154
- */
155
- static createUncheckedTradeWithMultipleRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(constructorArguments: {
156
- routes: {
157
- route: Route<TInput, TOutput>;
158
- inputAmount: CurrencyAmount<TInput>;
159
- outputAmount: CurrencyAmount<TOutput>;
160
- }[];
161
- tradeType: TTradeType;
162
- }): Trade<TInput, TOutput, TTradeType>;
163
- /**
164
- * Construct a trade by passing in the pre-computed property values
165
- * @param routes The routes through which the trade occurs
166
- * @param tradeType The type of trade, exact input or exact output
167
- */
168
- private constructor();
169
- /**
170
- * Get the minimum amount that must be received from this trade for the given slippage tolerance
171
- * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
172
- * @returns The amount out
173
- */
174
- minimumAmountOut(slippageTolerance: Percent, amountOut?: CurrencyAmount<TOutput>): CurrencyAmount<TOutput>;
175
- /**
176
- * Get the maximum amount in that can be spent via this trade for the given slippage tolerance
177
- * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
178
- * @returns The amount in
179
- */
180
- maximumAmountIn(slippageTolerance: Percent, amountIn?: CurrencyAmount<TInput>): CurrencyAmount<TInput>;
181
- /**
182
- * Return the execution price after accounting for slippage tolerance
183
- * @param slippageTolerance the allowed tolerated slippage
184
- * @returns The execution price
185
- */
186
- worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
187
- /**
188
- * Given a list of pools, and a fixed amount in, returns the top `maxNumResults` trades that go from an input currency
189
- * amount to an output currency, making at most `maxHops` hops.
190
- * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting
191
- * the amount in among multiple routes.
192
- * @param pools the pools to consider in finding the best trade
193
- * @param nextAmountIn exact amount of input currency to spend
194
- * @param currencyOut the desired currency out
195
- * @param maxNumResults maximum number of results to return
196
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pool
197
- * @param currentPools used in recursion; the current list of pools
198
- * @param currencyAmountIn used in recursion; the original value of the currencyAmountIn parameter
199
- * @param bestTrades used in recursion; the current list of best trades
200
- * @returns The exact in trade
201
- */
202
- static bestTradeExactIn<TInput extends Currency, TOutput extends Currency>(pools: Pool[], currencyAmountIn: CurrencyAmount<TInput>, currencyOut: TOutput, { maxNumResults, maxHops }?: BestTradeOptions, currentPools?: Pool[], nextAmountIn?: CurrencyAmount<Currency>, bestTrades?: Trade<TInput, TOutput, TradeType.EXACT_INPUT>[]): Promise<Trade<TInput, TOutput, TradeType.EXACT_INPUT>[]>;
203
- /**
204
- * similar to the above method but instead targets a fixed output amount
205
- * given a list of pools, and a fixed amount out, returns the top `maxNumResults` trades that go from an input currency
206
- * to an output currency amount, making at most `maxHops` hops
207
- * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting
208
- * the amount in among multiple routes.
209
- * @param pools the pools to consider in finding the best trade
210
- * @param currencyIn the currency to spend
211
- * @param currencyAmountOut the desired currency amount out
212
- * @param nextAmountOut the exact amount of currency out
213
- * @param maxNumResults maximum number of results to return
214
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pool
215
- * @param currentPools used in recursion; the current list of pools
216
- * @param bestTrades used in recursion; the current list of best trades
217
- * @returns The exact out trade
218
- */
219
- static bestTradeExactOut<TInput extends Currency, TOutput extends Currency>(pools: Pool[], currencyIn: TInput, currencyAmountOut: CurrencyAmount<TOutput>, { maxNumResults, maxHops }?: BestTradeOptions, currentPools?: Pool[], nextAmountOut?: CurrencyAmount<Currency>, bestTrades?: Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>[]): Promise<Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>[]>;
220
- }
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './entities';
2
- export * from './utils';
3
- export * from './PositionManager';
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./v4-sdk.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./v4-sdk.cjs.development.js')
8
- }
@@ -1,46 +0,0 @@
1
- import JSBI from 'jsbi';
2
- export declare const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000";
3
- export declare const NEGATIVE_ONE: JSBI;
4
- export declare const ZERO: JSBI;
5
- export declare const ONE: JSBI;
6
- export declare const ONE_ETHER: JSBI;
7
- export declare const EMPTY_BYTES = "0x";
8
- export declare const Q96: JSBI;
9
- export declare const Q192: JSBI;
10
- export declare const FEE_AMOUNT_LOW = 100;
11
- export declare const FEE_AMOUNT_MEDIUM = 3000;
12
- export declare const FEE_AMOUNT_HIGHEST = 10000;
13
- export declare const TICK_SPACING_TEN = 10;
14
- export declare const TICK_SPACING_SIXTY = 60;
15
- export declare const MIN_SLIPPAGE_DECREASE = 0;
16
- export declare const OPEN_DELTA: import("ethers").BigNumber;
17
- export declare const SQRT_PRICE_1_1: JSBI;
18
- export declare const EMPTY_HOOK = "0x0000000000000000000000000000000000000000";
19
- export declare const NATIVE_NOT_SET = "NATIVE_NOT_SET";
20
- export declare const ZERO_LIQUIDITY = "ZERO_LIQUIDITY";
21
- export declare const NO_SQRT_PRICE = "NO_SQRT_PRICE";
22
- export declare const CANNOT_BURN = "CANNOT_BURN";
23
- /**
24
- * Function fragments that exist on the PositionManager contract.
25
- */
26
- export declare enum PositionFunctions {
27
- INITIALIZE_POOL = "initializePool",
28
- MODIFY_LIQUIDITIES = "modifyLiquidities",
29
- PERMIT_BATCH = "0x002a3e3a",
30
- ERC721PERMIT_PERMIT = "0x0f5730f1"
31
- }
32
- /**
33
- * The default factory enabled fee amounts, denominated in hundredths of bips.
34
- */
35
- export declare enum FeeAmount {
36
- LOWEST = 100,
37
- LOW = 500,
38
- MEDIUM = 3000,
39
- HIGH = 10000
40
- }
41
- /**
42
- * The default factory tick spacings by fee amount.
43
- */
44
- export declare const TICK_SPACINGS: {
45
- [amount in FeeAmount]: number;
46
- };
@@ -1,10 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- export declare abstract class Multicall {
3
- static INTERFACE: Interface;
4
- /**
5
- * Cannot be constructed.
6
- */
7
- private constructor();
8
- static encodeMulticall(calldataList: string | string[]): string;
9
- static decodeMulticall(encodedCalldata: string): string[];
10
- }
@@ -1,20 +0,0 @@
1
- import { BigintIsh } from '@juiceswapxyz/sdk-core';
2
- /**
3
- * Generated method parameters for executing a call.
4
- */
5
- export interface MethodParameters {
6
- /**
7
- * The hex encoded calldata to perform the given operation
8
- */
9
- calldata: string;
10
- /**
11
- * The amount of ether (wei) to send in hex.
12
- */
13
- value: string;
14
- }
15
- /**
16
- * Converts a big int to a hex string
17
- * @param bigintIsh
18
- * @returns The hex encoded calldata
19
- */
20
- export declare function toHex(bigintIsh: BigintIsh): string;
@@ -1,2 +0,0 @@
1
- import { Currency } from '@juiceswapxyz/sdk-core';
2
- export declare function toAddress(currency: Currency): string;
@@ -1,10 +0,0 @@
1
- import { Currency } from '@juiceswapxyz/sdk-core';
2
- import { Route } from '../entities/route';
3
- export declare type PathKey = {
4
- intermediateCurrency: string;
5
- fee: number;
6
- tickSpacing: number;
7
- hooks: string;
8
- hookData: string;
9
- };
10
- export declare const encodeRouteToPath: (route: Route<Currency, Currency>, exactOutput?: boolean | undefined) => PathKey[];
@@ -1,45 +0,0 @@
1
- export declare type HookPermissions = {
2
- [key in HookOptions]: boolean;
3
- };
4
- export declare enum HookOptions {
5
- AfterRemoveLiquidityReturnsDelta = "afterRemoveLiquidityReturnsDelta",
6
- AfterAddLiquidityReturnsDelta = "afterAddLiquidityReturnsDelta",
7
- AfterSwapReturnsDelta = "afterSwapReturnsDelta",
8
- BeforeSwapReturnsDelta = "beforeSwapReturnsDelta",
9
- AfterDonate = "afterDonate",
10
- BeforeDonate = "beforeDonate",
11
- AfterSwap = "afterSwap",
12
- BeforeSwap = "beforeSwap",
13
- AfterRemoveLiquidity = "afterRemoveLiquidity",
14
- BeforeRemoveLiquidity = "beforeRemoveLiquidity",
15
- AfterAddLiquidity = "afterAddLiquidity",
16
- BeforeAddLiquidity = "beforeAddLiquidity",
17
- AfterInitialize = "afterInitialize",
18
- BeforeInitialize = "beforeInitialize"
19
- }
20
- export declare const hookFlagIndex: {
21
- afterRemoveLiquidityReturnsDelta: number;
22
- afterAddLiquidityReturnsDelta: number;
23
- afterSwapReturnsDelta: number;
24
- beforeSwapReturnsDelta: number;
25
- afterDonate: number;
26
- beforeDonate: number;
27
- afterSwap: number;
28
- beforeSwap: number;
29
- afterRemoveLiquidity: number;
30
- beforeRemoveLiquidity: number;
31
- afterAddLiquidity: number;
32
- beforeAddLiquidity: number;
33
- afterInitialize: number;
34
- beforeInitialize: number;
35
- };
36
- export declare class Hook {
37
- static permissions(address: string): HookPermissions;
38
- static hasPermission(address: string, hookOption: HookOptions): boolean;
39
- static hasInitializePermissions(address: string): boolean;
40
- static hasLiquidityPermissions(address: string): boolean;
41
- static hasSwapPermissions(address: string): boolean;
42
- static hasDonatePermissions(address: string): boolean;
43
- private static _hasPermission;
44
- private static _checkAddress;
45
- }
@@ -1,11 +0,0 @@
1
- export * from './encodeRouteToPath';
2
- export * from './v4Planner';
3
- export * from './v4PositionPlanner';
4
- export * from './calldata';
5
- export * from './v4BaseActionsParser';
6
- export * from './currencyMap';
7
- export * from './encodeRouteToPath';
8
- export * from './pathCurrency';
9
- export * from './priceTickConversions';
10
- export * from './sortsBefore';
11
- export * from './hook';
@@ -1,4 +0,0 @@
1
- import { Currency, CurrencyAmount } from '@juiceswapxyz/sdk-core';
2
- import { Pool } from '../entities/pool';
3
- export declare function amountWithPathCurrency(amount: CurrencyAmount<Currency>, pool: Pool): CurrencyAmount<Currency>;
4
- export declare function getPathCurrency(currency: Currency, pool: Pool): Currency;
@@ -1,102 +0,0 @@
1
- export declare const positionManagerAbi: ({
2
- type: string;
3
- inputs: {
4
- name: string;
5
- type: string;
6
- internalType: string;
7
- }[];
8
- stateMutability: string;
9
- name?: undefined;
10
- outputs?: undefined;
11
- anonymous?: undefined;
12
- } | {
13
- type: string;
14
- stateMutability: string;
15
- inputs?: undefined;
16
- name?: undefined;
17
- outputs?: undefined;
18
- anonymous?: undefined;
19
- } | {
20
- type: string;
21
- name: string;
22
- inputs: {
23
- name: string;
24
- type: string;
25
- internalType: string;
26
- }[];
27
- outputs: ({
28
- name: string;
29
- type: string;
30
- internalType: string;
31
- components: {
32
- name: string;
33
- type: string;
34
- internalType: string;
35
- }[];
36
- } | {
37
- name: string;
38
- type: string;
39
- internalType: string;
40
- components?: undefined;
41
- })[];
42
- stateMutability: string;
43
- anonymous?: undefined;
44
- } | {
45
- type: string;
46
- name: string;
47
- inputs: ({
48
- name: string;
49
- type: string;
50
- internalType: string;
51
- components?: undefined;
52
- } | {
53
- name: string;
54
- type: string;
55
- internalType: string;
56
- components: ({
57
- name: string;
58
- type: string;
59
- internalType: string;
60
- components: {
61
- name: string;
62
- type: string;
63
- internalType: string;
64
- }[];
65
- } | {
66
- name: string;
67
- type: string;
68
- internalType: string;
69
- components?: undefined;
70
- })[];
71
- })[];
72
- outputs: {
73
- name: string;
74
- type: string;
75
- internalType: string;
76
- }[];
77
- stateMutability: string;
78
- anonymous?: undefined;
79
- } | {
80
- type: string;
81
- name: string;
82
- inputs: {
83
- name: string;
84
- type: string;
85
- indexed: boolean;
86
- internalType: string;
87
- }[];
88
- anonymous: boolean;
89
- stateMutability?: undefined;
90
- outputs?: undefined;
91
- } | {
92
- type: string;
93
- name: string;
94
- inputs: {
95
- name: string;
96
- type: string;
97
- internalType: string;
98
- }[];
99
- stateMutability?: undefined;
100
- outputs?: undefined;
101
- anonymous?: undefined;
102
- })[];
@@ -1,20 +0,0 @@
1
- import { Price, Currency } from '@juiceswapxyz/sdk-core';
2
- /**
3
- * This library is the almost the same as v3-sdk priceTickConversion except
4
- * that it accepts a Currency type instead of a Token type,
5
- * and thus uses some helper functions defined for the Currency type over the Token type.
6
- */
7
- /**
8
- * Returns a price object corresponding to the input tick and the base/quote token
9
- * Inputs must be tokens because the address order is used to interpret the price represented by the tick
10
- * @param baseToken the base token of the price
11
- * @param quoteToken the quote token of the price
12
- * @param tick the tick for which to return the price
13
- */
14
- export declare function tickToPrice(baseCurrency: Currency, quoteCurrency: Currency, tick: number): Price<Currency, Currency>;
15
- /**
16
- * Returns the first tick for which the given price is greater than or equal to the tick price
17
- * @param price for which to return the closest tick that represents a price less than or equal to the input price,
18
- * i.e. the price of the returned tick is less than or equal to the input price
19
- */
20
- export declare function priceToClosestTick(price: Price<Currency, Currency>): number;
@@ -1,2 +0,0 @@
1
- import { Currency } from '@juiceswapxyz/sdk-core';
2
- export declare function sortsBefore(currencyA: Currency, currencyB: Currency): boolean;
@@ -1,45 +0,0 @@
1
- import { PoolKey } from '../entities/pool';
2
- import { PathKey } from './encodeRouteToPath';
3
- import { Actions } from './v4Planner';
4
- export declare type Param = {
5
- readonly name: string;
6
- readonly value: any;
7
- };
8
- export declare type V4RouterAction = {
9
- readonly actionName: string;
10
- readonly actionType: Actions;
11
- readonly params: readonly Param[];
12
- };
13
- export declare type V4RouterCall = {
14
- readonly actions: readonly V4RouterAction[];
15
- };
16
- export declare type SwapExactInSingle = {
17
- readonly poolKey: PoolKey;
18
- readonly zeroForOne: boolean;
19
- readonly amountIn: string;
20
- readonly amountOutMinimum: string;
21
- readonly hookData: string;
22
- };
23
- export declare type SwapExactIn = {
24
- readonly currencyIn: string;
25
- readonly path: readonly PathKey[];
26
- readonly amountIn: string;
27
- readonly amountOutMinimum: string;
28
- };
29
- export declare type SwapExactOutSingle = {
30
- readonly poolKey: PoolKey;
31
- readonly zeroForOne: boolean;
32
- readonly amountOut: string;
33
- readonly amountInMaximum: string;
34
- readonly hookData: string;
35
- };
36
- export declare type SwapExactOut = {
37
- readonly currencyOut: string;
38
- readonly path: readonly PathKey[];
39
- readonly amountOut: string;
40
- readonly amountInMaximum: string;
41
- };
42
- export declare abstract class V4BaseActionsParser {
43
- static parseCalldata(calldata: string): V4RouterCall;
44
- private static getActions;
45
- }
@@ -1,55 +0,0 @@
1
- import { BigNumber } from 'ethers';
2
- import { Currency, Percent, TradeType } from '@juiceswapxyz/sdk-core';
3
- import { Trade } from '../entities/trade';
4
- /**
5
- * Actions
6
- * @description Constants that define what action to perform
7
- * Not all actions are supported yet.
8
- * @enum {number}
9
- */
10
- export declare enum Actions {
11
- INCREASE_LIQUIDITY = 0,
12
- DECREASE_LIQUIDITY = 1,
13
- MINT_POSITION = 2,
14
- BURN_POSITION = 3,
15
- SWAP_EXACT_IN_SINGLE = 6,
16
- SWAP_EXACT_IN = 7,
17
- SWAP_EXACT_OUT_SINGLE = 8,
18
- SWAP_EXACT_OUT = 9,
19
- SETTLE = 11,
20
- SETTLE_ALL = 12,
21
- SETTLE_PAIR = 13,
22
- TAKE = 14,
23
- TAKE_ALL = 15,
24
- TAKE_PORTION = 16,
25
- TAKE_PAIR = 17,
26
- CLOSE_CURRENCY = 18,
27
- SWEEP = 20,
28
- UNWRAP = 22
29
- }
30
- export declare enum Subparser {
31
- V4SwapExactInSingle = 0,
32
- V4SwapExactIn = 1,
33
- V4SwapExactOutSingle = 2,
34
- V4SwapExactOut = 3,
35
- PoolKey = 4
36
- }
37
- export declare type ParamType = {
38
- readonly name: string;
39
- readonly type: string;
40
- readonly subparser?: Subparser;
41
- };
42
- export declare const V4_BASE_ACTIONS_ABI_DEFINITION: {
43
- [key in Actions]: readonly ParamType[];
44
- };
45
- export declare class V4Planner {
46
- actions: string;
47
- params: string[];
48
- constructor();
49
- addAction(type: Actions, parameters: any[]): V4Planner;
50
- addTrade(trade: Trade<Currency, Currency, TradeType>, slippageTolerance?: Percent): V4Planner;
51
- addSettle(currency: Currency, payerIsUser: boolean, amount?: BigNumber): V4Planner;
52
- addTake(currency: Currency, recipient: string, amount?: BigNumber): V4Planner;
53
- addUnwrap(amount: BigNumber): V4Planner;
54
- finalize(): string;
55
- }
@@ -1,12 +0,0 @@
1
- import { V4Planner } from './v4Planner';
2
- import { Pool } from '../entities';
3
- import { BigintIsh, Currency } from '@juiceswapxyz/sdk-core';
4
- export declare class V4PositionPlanner extends V4Planner {
5
- addMint(pool: Pool, tickLower: number, tickUpper: number, liquidity: BigintIsh, amount0Max: BigintIsh, amount1Max: BigintIsh, owner: string, hookData?: string): void;
6
- addIncrease(tokenId: BigintIsh, liquidity: BigintIsh, amount0Max: BigintIsh, amount1Max: BigintIsh, hookData?: string): void;
7
- addDecrease(tokenId: BigintIsh, liquidity: BigintIsh, amount0Min: BigintIsh, amount1Min: BigintIsh, hookData?: string): void;
8
- addBurn(tokenId: BigintIsh, amount0Min: BigintIsh, amount1Min: BigintIsh, hookData?: string): void;
9
- addSettlePair(currency0: Currency, currency1: Currency): void;
10
- addTakePair(currency0: Currency, currency1: Currency, recipient: string): void;
11
- addSweep(currency: Currency, to: string): void;
12
- }