@pancakeswap/v3-sdk 1.0.0 → 2.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.
- package/LICENSE +674 -0
- package/dist/constants.d.ts +26 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/entities/index.d.ts +8 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/pool.d.ts +82 -0
- package/dist/entities/pool.d.ts.map +1 -0
- package/dist/entities/position.d.ts +131 -0
- package/dist/entities/position.d.ts.map +1 -0
- package/dist/entities/route.d.ts +27 -0
- package/dist/entities/route.d.ts.map +1 -0
- package/dist/entities/tick.d.ts +13 -0
- package/dist/entities/tick.d.ts.map +1 -0
- package/dist/entities/tickDataProvider.d.ts +32 -0
- package/dist/entities/tickDataProvider.d.ts.map +1 -0
- package/dist/entities/tickListDataProvider.d.ts +16 -0
- package/dist/entities/tickListDataProvider.d.ts.map +1 -0
- package/dist/entities/trade.d.ts +221 -0
- package/dist/entities/trade.d.ts.map +1 -0
- package/dist/index.d.ts +12 -1223
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +214 -227
- package/dist/index.mjs +214 -229
- package/dist/internalConstants.d.ts +11 -0
- package/dist/internalConstants.d.ts.map +1 -0
- package/dist/masterchefV3.d.ts +39 -0
- package/dist/masterchefV3.d.ts.map +1 -0
- package/dist/multicall.d.ts +10 -0
- package/dist/multicall.d.ts.map +1 -0
- package/dist/nonfungiblePositionManager.d.ts +149 -0
- package/dist/nonfungiblePositionManager.d.ts.map +1 -0
- package/dist/payments.d.ts +24 -0
- package/dist/payments.d.ts.map +1 -0
- package/dist/quoter.d.ts +38 -0
- package/dist/quoter.d.ts.map +1 -0
- package/dist/selfPermit.d.ts +26 -0
- package/dist/selfPermit.d.ts.map +1 -0
- package/dist/staker.d.ts +102 -0
- package/dist/staker.d.ts.map +1 -0
- package/dist/swapRouter.d.ts +52 -0
- package/dist/swapRouter.d.ts.map +1 -0
- package/dist/utils/calldata.d.ts +21 -0
- package/dist/utils/calldata.d.ts.map +1 -0
- package/dist/utils/computePoolAddress.d.ts +19 -0
- package/dist/utils/computePoolAddress.d.ts.map +1 -0
- package/dist/utils/encodeRouteToPath.d.ts +9 -0
- package/dist/utils/encodeRouteToPath.d.ts.map +1 -0
- package/dist/utils/encodeSqrtRatioX96.d.ts +9 -0
- package/dist/utils/encodeSqrtRatioX96.d.ts.map +1 -0
- package/dist/utils/feeCalculator.d.ts +65 -0
- package/dist/utils/feeCalculator.d.ts.map +1 -0
- package/dist/utils/fullMath.d.ts +8 -0
- package/dist/utils/fullMath.d.ts.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/isSorted.d.ts +8 -0
- package/dist/utils/isSorted.d.ts.map +1 -0
- package/dist/utils/liquidityMath.d.ts +8 -0
- package/dist/utils/liquidityMath.d.ts.map +1 -0
- package/dist/utils/maxLiquidityForAmounts.d.ts +14 -0
- package/dist/utils/maxLiquidityForAmounts.d.ts.map +1 -0
- package/dist/utils/mostSignificantBit.d.ts +2 -0
- package/dist/utils/mostSignificantBit.d.ts.map +1 -0
- package/dist/utils/nearestUsableTick.d.ts +7 -0
- package/dist/utils/nearestUsableTick.d.ts.map +1 -0
- package/dist/utils/parseProtocolFees.d.ts +3 -0
- package/dist/utils/parseProtocolFees.d.ts.map +1 -0
- package/dist/utils/position.d.ts +8 -0
- package/dist/utils/position.d.ts.map +1 -0
- package/dist/utils/positionMath.d.ts +8 -0
- package/dist/utils/positionMath.d.ts.map +1 -0
- package/dist/utils/priceTickConversions.d.ts +16 -0
- package/dist/utils/priceTickConversions.d.ts.map +1 -0
- package/dist/utils/sqrtPriceMath.d.ts +13 -0
- package/dist/utils/sqrtPriceMath.d.ts.map +1 -0
- package/dist/utils/sqrtRatioX96ToPrice.d.ts +3 -0
- package/dist/utils/sqrtRatioX96ToPrice.d.ts.map +1 -0
- package/dist/utils/swapMath.d.ts +9 -0
- package/dist/utils/swapMath.d.ts.map +1 -0
- package/dist/utils/tickLibrary.d.ts +14 -0
- package/dist/utils/tickLibrary.d.ts.map +1 -0
- package/dist/utils/tickList.d.ts +25 -0
- package/dist/utils/tickList.d.ts.map +1 -0
- package/dist/utils/tickMath.d.ts +34 -0
- package/dist/utils/tickMath.d.ts.map +1 -0
- package/package.json +17 -14
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Percent } from '@pancakeswap/swap-sdk-core';
|
|
2
|
+
export declare const NEGATIVE_ONE: bigint;
|
|
3
|
+
export declare const ZERO = 0n;
|
|
4
|
+
export declare const ONE = 1n;
|
|
5
|
+
export declare const Q96: bigint;
|
|
6
|
+
export declare const Q192: bigint;
|
|
7
|
+
export declare const MAX_FEE: bigint;
|
|
8
|
+
export declare const ONE_HUNDRED_PERCENT: Percent;
|
|
9
|
+
export declare const ZERO_PERCENT: Percent;
|
|
10
|
+
export declare const Q128: bigint;
|
|
11
|
+
//# sourceMappingURL=internalConstants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalConstants.d.ts","sourceRoot":"","sources":["../src/internalConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGpD,eAAO,MAAM,YAAY,QAAa,CAAA;AACtC,eAAO,MAAM,IAAI,KAAK,CAAA;AACtB,eAAO,MAAM,GAAG,KAAK,CAAA;AAGrB,eAAO,MAAM,GAAG,QAAY,CAAA;AAC5B,eAAO,MAAM,IAAI,QAAY,CAAA;AAG7B,eAAO,MAAM,OAAO,QAAY,CAAA;AAChC,eAAO,MAAM,mBAAmB,SAAmB,CAAA;AACnD,eAAO,MAAM,YAAY,SAAmB,CAAA;AAC5C,eAAO,MAAM,IAAI,QAAa,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BigintIsh } from '@pancakeswap/sdk';
|
|
3
|
+
import { Position } from './entities';
|
|
4
|
+
import { type AddLiquidityOptions, CollectOptions, type RemoveLiquidityOptions } from './nonfungiblePositionManager';
|
|
5
|
+
import { MethodParameters } from './utils';
|
|
6
|
+
interface WidthDrawOptions {
|
|
7
|
+
tokenId: BigintIsh;
|
|
8
|
+
to: string;
|
|
9
|
+
}
|
|
10
|
+
interface HarvestOptions {
|
|
11
|
+
tokenId: BigintIsh;
|
|
12
|
+
to: string;
|
|
13
|
+
}
|
|
14
|
+
export declare abstract class MasterChefV3 {
|
|
15
|
+
static INTERFACE: Interface;
|
|
16
|
+
/**
|
|
17
|
+
* Cannot be constructed.
|
|
18
|
+
*/
|
|
19
|
+
private constructor();
|
|
20
|
+
static addCallParameters(position: Position, options: AddLiquidityOptions): MethodParameters;
|
|
21
|
+
private static encodeCollect;
|
|
22
|
+
static collectCallParameters(options: CollectOptions): MethodParameters;
|
|
23
|
+
static removeCallParameters(position: Position, options: RemoveLiquidityOptions): MethodParameters;
|
|
24
|
+
static harvestCallParameters(options: HarvestOptions): {
|
|
25
|
+
calldata: string;
|
|
26
|
+
value: string;
|
|
27
|
+
};
|
|
28
|
+
static batchHarvestCallParameters(options: HarvestOptions[]): {
|
|
29
|
+
calldata: string;
|
|
30
|
+
value: string;
|
|
31
|
+
};
|
|
32
|
+
static encodeHarvest(options: HarvestOptions): string[];
|
|
33
|
+
static withdrawCallParameters(options: WidthDrawOptions): {
|
|
34
|
+
calldata: string;
|
|
35
|
+
value: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=masterchefV3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterchefV3.d.ts","sourceRoot":"","sources":["../src/masterchefV3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAA6D,MAAM,kBAAkB,CAAA;AAGvG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAIrC,OAAO,EACL,KAAK,mBAAmB,EAExB,cAAc,EAEd,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAA;AAGrC,OAAO,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAEjD,UAAU,gBAAgB;IACxB,OAAO,EAAE,SAAS,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;CACX;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,SAAS,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;CACX;AAED,8BAAsB,YAAY;IAChC,OAAc,SAAS,EAAE,SAAS,CAAgC;IAElE;;OAEG;IAEH,OAAO;WAIO,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,GAAG,gBAAgB;IA8DnG,OAAO,CAAC,MAAM,CAAC,aAAa;WAwCd,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,gBAAgB;WAShE,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,sBAAsB,GAAG,gBAAgB;WA+F3F,qBAAqB,CAAC,OAAO,EAAE,cAAc;;;;WAS7C,0BAA0B,CAAC,OAAO,EAAE,cAAc,EAAE;;;;WASpD,aAAa,CAAC,OAAO,EAAE,cAAc;WAarC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB;;;;CAe/D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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(calldatas: string | string[]): string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=multicall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../src/multicall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAwB9C,8BAAsB,SAAS;IAC7B,OAAc,SAAS,EAAE,SAAS,CAA4B;IAE9D;;OAEG;IACH,OAAO;WAEO,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;CAOpE"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { BigintIsh, Percent, CurrencyAmount, Currency, NativeCurrency } from '@pancakeswap/sdk';
|
|
2
|
+
import { Interface } from '@ethersproject/abi';
|
|
3
|
+
import { Position } from './entities/position';
|
|
4
|
+
import { MethodParameters } from './utils/calldata';
|
|
5
|
+
import { PermitOptions } from './selfPermit';
|
|
6
|
+
import { Pool } from './entities';
|
|
7
|
+
export declare const MaxUint128: string;
|
|
8
|
+
export interface MintSpecificOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The account that should receive the minted NFT.
|
|
11
|
+
*/
|
|
12
|
+
recipient: string;
|
|
13
|
+
/**
|
|
14
|
+
* Creates pool if not initialized before mint.
|
|
15
|
+
*/
|
|
16
|
+
createPool?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IncreaseSpecificOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Indicates the ID of the position to increase liquidity for.
|
|
21
|
+
*/
|
|
22
|
+
tokenId: BigintIsh;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Options for producing the calldata to add liquidity.
|
|
26
|
+
*/
|
|
27
|
+
export interface CommonAddLiquidityOptions {
|
|
28
|
+
/**
|
|
29
|
+
* How much the pool price is allowed to move.
|
|
30
|
+
*/
|
|
31
|
+
slippageTolerance: Percent;
|
|
32
|
+
/**
|
|
33
|
+
* When the transaction expires, in epoch seconds.
|
|
34
|
+
*/
|
|
35
|
+
deadline: BigintIsh;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to spend ether. If true, one of the pool tokens must be WETH, by default false
|
|
38
|
+
*/
|
|
39
|
+
useNative?: NativeCurrency;
|
|
40
|
+
/**
|
|
41
|
+
* The optional permit parameters for spending token0
|
|
42
|
+
*/
|
|
43
|
+
token0Permit?: PermitOptions;
|
|
44
|
+
/**
|
|
45
|
+
* The optional permit parameters for spending token1
|
|
46
|
+
*/
|
|
47
|
+
token1Permit?: PermitOptions;
|
|
48
|
+
}
|
|
49
|
+
export type MintOptions = CommonAddLiquidityOptions & MintSpecificOptions;
|
|
50
|
+
export type IncreaseOptions = CommonAddLiquidityOptions & IncreaseSpecificOptions;
|
|
51
|
+
export type AddLiquidityOptions = MintOptions | IncreaseOptions;
|
|
52
|
+
export interface SafeTransferOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The account sending the NFT.
|
|
55
|
+
*/
|
|
56
|
+
sender: string;
|
|
57
|
+
/**
|
|
58
|
+
* The account that should receive the NFT.
|
|
59
|
+
*/
|
|
60
|
+
recipient: string;
|
|
61
|
+
/**
|
|
62
|
+
* The id of the token being sent.
|
|
63
|
+
*/
|
|
64
|
+
tokenId: BigintIsh;
|
|
65
|
+
/**
|
|
66
|
+
* The optional parameter that passes data to the `onERC721Received` call for the staker
|
|
67
|
+
*/
|
|
68
|
+
data?: string;
|
|
69
|
+
}
|
|
70
|
+
export declare function isMint(options: AddLiquidityOptions): options is MintOptions;
|
|
71
|
+
export interface CollectOptions {
|
|
72
|
+
/**
|
|
73
|
+
* Indicates the ID of the position to collect for.
|
|
74
|
+
*/
|
|
75
|
+
tokenId: BigintIsh;
|
|
76
|
+
/**
|
|
77
|
+
* Expected value of tokensOwed0, including as-of-yet-unaccounted-for fees/liquidity value to be burned
|
|
78
|
+
*/
|
|
79
|
+
expectedCurrencyOwed0: CurrencyAmount<Currency>;
|
|
80
|
+
/**
|
|
81
|
+
* Expected value of tokensOwed1, including as-of-yet-unaccounted-for fees/liquidity value to be burned
|
|
82
|
+
*/
|
|
83
|
+
expectedCurrencyOwed1: CurrencyAmount<Currency>;
|
|
84
|
+
/**
|
|
85
|
+
* The account that should receive the tokens.
|
|
86
|
+
*/
|
|
87
|
+
recipient: string;
|
|
88
|
+
}
|
|
89
|
+
export interface NFTPermitOptions {
|
|
90
|
+
v: 0 | 1 | 27 | 28;
|
|
91
|
+
r: string;
|
|
92
|
+
s: string;
|
|
93
|
+
deadline: BigintIsh;
|
|
94
|
+
spender: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Options for producing the calldata to exit a position.
|
|
98
|
+
*/
|
|
99
|
+
export interface RemoveLiquidityOptions {
|
|
100
|
+
/**
|
|
101
|
+
* The ID of the token to exit
|
|
102
|
+
*/
|
|
103
|
+
tokenId: BigintIsh;
|
|
104
|
+
/**
|
|
105
|
+
* The percentage of position liquidity to exit.
|
|
106
|
+
*/
|
|
107
|
+
liquidityPercentage: Percent;
|
|
108
|
+
/**
|
|
109
|
+
* How much the pool price is allowed to move.
|
|
110
|
+
*/
|
|
111
|
+
slippageTolerance: Percent;
|
|
112
|
+
/**
|
|
113
|
+
* When the transaction expires, in epoch seconds.
|
|
114
|
+
*/
|
|
115
|
+
deadline: BigintIsh;
|
|
116
|
+
/**
|
|
117
|
+
* Whether the NFT should be burned if the entire position is being exited, by default false.
|
|
118
|
+
*/
|
|
119
|
+
burnToken?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The optional permit of the token ID being exited, in case the exit transaction is being sent by an account that does not own the NFT
|
|
122
|
+
*/
|
|
123
|
+
permit?: NFTPermitOptions;
|
|
124
|
+
/**
|
|
125
|
+
* Parameters to be passed on to collect
|
|
126
|
+
*/
|
|
127
|
+
collectOptions: Omit<CollectOptions, 'tokenId'>;
|
|
128
|
+
}
|
|
129
|
+
export declare abstract class NonfungiblePositionManager {
|
|
130
|
+
static INTERFACE: Interface;
|
|
131
|
+
/**
|
|
132
|
+
* Cannot be constructed.
|
|
133
|
+
*/
|
|
134
|
+
private constructor();
|
|
135
|
+
private static encodeCreate;
|
|
136
|
+
static createCallParameters(pool: Pool): MethodParameters;
|
|
137
|
+
static addCallParameters(position: Position, options: AddLiquidityOptions): MethodParameters;
|
|
138
|
+
private static encodeCollect;
|
|
139
|
+
static collectCallParameters(options: CollectOptions): MethodParameters;
|
|
140
|
+
/**
|
|
141
|
+
* Produces the calldata for completely or partially exiting a position
|
|
142
|
+
* @param position The position to exit
|
|
143
|
+
* @param options Additional information necessary for generating the calldata
|
|
144
|
+
* @returns The call parameters
|
|
145
|
+
*/
|
|
146
|
+
static removeCallParameters(position: Position, options: RemoveLiquidityOptions): MethodParameters;
|
|
147
|
+
static safeTransferFromParameters(options: SafeTransferOptions): MethodParameters;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=nonfungiblePositionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonfungiblePositionManager.d.ts","sourceRoot":"","sources":["../src/nonfungiblePositionManager.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { Percent, Token } from '@pancakeswap/sdk';
|
|
3
|
+
export interface FeeOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The percent of the output that will be taken as a fee.
|
|
6
|
+
*/
|
|
7
|
+
fee: Percent;
|
|
8
|
+
/**
|
|
9
|
+
* The recipient of the fee.
|
|
10
|
+
*/
|
|
11
|
+
recipient: string;
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class Payments {
|
|
14
|
+
static INTERFACE: Interface;
|
|
15
|
+
/**
|
|
16
|
+
* Cannot be constructed.
|
|
17
|
+
*/
|
|
18
|
+
private constructor();
|
|
19
|
+
private static encodeFeeBips;
|
|
20
|
+
static encodeUnwrapWETH9(amountMinimum: bigint, recipient: string, feeOptions?: FeeOptions): string;
|
|
21
|
+
static encodeSweepToken(token: Token, amountMinimum: bigint, recipient: string, feeOptions?: FeeOptions): string;
|
|
22
|
+
static encodeRefundETH(): string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,KAAK,EAA2B,MAAM,kBAAkB,CAAA;AAK1E,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,GAAG,EAAE,OAAO,CAAA;IAEZ;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,8BAAsB,QAAQ;IAC5B,OAAc,SAAS,EAAE,SAAS,CAA2C;IAE7E;;OAEG;IACH,OAAO;IAEP,OAAO,CAAC,MAAM,CAAC,aAAa;WAId,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM;WAiB5F,gBAAgB,CAC5B,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,UAAU,GACtB,MAAM;WAkBK,eAAe,IAAI,MAAM;CAGxC"}
|
package/dist/quoter.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BigintIsh, Currency, CurrencyAmount, TradeType } from '@pancakeswap/sdk';
|
|
3
|
+
import { Route } from './entities';
|
|
4
|
+
import { MethodParameters } from './utils';
|
|
5
|
+
/**
|
|
6
|
+
* Optional arguments to send to the quoter.
|
|
7
|
+
*/
|
|
8
|
+
export interface QuoteOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The optional price limit for the trade.
|
|
11
|
+
*/
|
|
12
|
+
sqrtPriceLimitX96?: BigintIsh;
|
|
13
|
+
/**
|
|
14
|
+
* The optional quoter interface to use
|
|
15
|
+
*/
|
|
16
|
+
useQuoterV2?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents the Pancake V3 QuoterV1 contract with a method for returning the formatted
|
|
20
|
+
* calldata needed to call the quoter contract.
|
|
21
|
+
*/
|
|
22
|
+
export declare abstract class SwapQuoter {
|
|
23
|
+
static V1INTERFACE: Interface;
|
|
24
|
+
static V2INTERFACE: Interface;
|
|
25
|
+
/**
|
|
26
|
+
* Produces the on-chain method name of the appropriate function within QuoterV2,
|
|
27
|
+
* and the relevant hex encoded parameters.
|
|
28
|
+
* @template TInput The input token, either Ether or an ERC-20
|
|
29
|
+
* @template TOutput The output token, either Ether or an ERC-20
|
|
30
|
+
* @param route The swap route, a list of pools through which a swap can occur
|
|
31
|
+
* @param amount The amount of the quote, either an amount in, or an amount out
|
|
32
|
+
* @param tradeType The trade type, either exact input or exact output
|
|
33
|
+
* @param options The optional params including price limit and Quoter contract switch
|
|
34
|
+
* @returns The formatted calldata
|
|
35
|
+
*/
|
|
36
|
+
static quoteCallParameters<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amount: CurrencyAmount<TInput | TOutput>, tradeType: TradeType, options?: QuoteOptions): MethodParameters;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=quoter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoter.d.ts","sourceRoot":"","sources":["../src/quoter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAIjF,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAqB,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAGpE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAE7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AASD;;;GAGG;AACH,8BAAsB,UAAU;IAC9B,OAAc,WAAW,EAAE,SAAS,CAAyB;IAE7D,OAAc,WAAW,EAAE,SAAS,CAA2B;IAE/D;;;;;;;;;;OAUG;WACW,mBAAmB,CAAC,MAAM,SAAS,QAAQ,EAAE,OAAO,SAAS,QAAQ,EACjF,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,cAAc,CAAC,MAAM,GAAG,OAAO,CAAC,EACxC,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,YAAiB,GACzB,gBAAgB;CA6CpB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BigintIsh, Token } from '@pancakeswap/sdk';
|
|
2
|
+
import { Interface } from '@ethersproject/abi';
|
|
3
|
+
export interface StandardPermitArguments {
|
|
4
|
+
v: 0 | 1 | 27 | 28;
|
|
5
|
+
r: string;
|
|
6
|
+
s: string;
|
|
7
|
+
amount: BigintIsh;
|
|
8
|
+
deadline: BigintIsh;
|
|
9
|
+
}
|
|
10
|
+
export interface AllowedPermitArguments {
|
|
11
|
+
v: 0 | 1 | 27 | 28;
|
|
12
|
+
r: string;
|
|
13
|
+
s: string;
|
|
14
|
+
nonce: BigintIsh;
|
|
15
|
+
expiry: BigintIsh;
|
|
16
|
+
}
|
|
17
|
+
export type PermitOptions = StandardPermitArguments | AllowedPermitArguments;
|
|
18
|
+
export declare abstract class SelfPermit {
|
|
19
|
+
static INTERFACE: Interface;
|
|
20
|
+
/**
|
|
21
|
+
* Cannot be constructed.
|
|
22
|
+
*/
|
|
23
|
+
private constructor();
|
|
24
|
+
static encodePermit(token: Token, options: PermitOptions): string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=selfPermit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selfPermit.d.ts","sourceRoot":"","sources":["../src/selfPermit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAI9C,MAAM,WAAW,uBAAuB;IACtC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,EAAE,SAAS,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,SAAS,CAAA;IAChB,MAAM,EAAE,SAAS,CAAA;CAClB;AAED,MAAM,MAAM,aAAa,GAAG,uBAAuB,GAAG,sBAAsB,CAAA;AAM5E,8BAAsB,UAAU;IAC9B,OAAc,SAAS,EAAE,SAAS,CAA6B;IAE/D;;OAEG;IACH,OAAO;WAEO,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa;CAmBhE"}
|
package/dist/staker.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { BigintIsh, Token } from '@pancakeswap/sdk';
|
|
2
|
+
import { Interface } from '@ethersproject/abi';
|
|
3
|
+
import { MethodParameters } from './utils/calldata';
|
|
4
|
+
import { Pool } from './entities';
|
|
5
|
+
export type FullWithdrawOptions = ClaimOptions & WithdrawOptions;
|
|
6
|
+
/**
|
|
7
|
+
* Represents a unique staking program.
|
|
8
|
+
*/
|
|
9
|
+
export interface IncentiveKey {
|
|
10
|
+
/**
|
|
11
|
+
* The token rewarded for participating in the staking program.
|
|
12
|
+
*/
|
|
13
|
+
rewardToken: Token;
|
|
14
|
+
/**
|
|
15
|
+
* The pool that the staked positions must provide in.
|
|
16
|
+
*/
|
|
17
|
+
pool: Pool;
|
|
18
|
+
/**
|
|
19
|
+
* The time when the incentive program begins.
|
|
20
|
+
*/
|
|
21
|
+
startTime: BigintIsh;
|
|
22
|
+
/**
|
|
23
|
+
* The time that the incentive program ends.
|
|
24
|
+
*/
|
|
25
|
+
endTime: BigintIsh;
|
|
26
|
+
/**
|
|
27
|
+
* The address which receives any remaining reward tokens at `endTime`.
|
|
28
|
+
*/
|
|
29
|
+
refundee: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options to specify when claiming rewards.
|
|
33
|
+
*/
|
|
34
|
+
export interface ClaimOptions {
|
|
35
|
+
/**
|
|
36
|
+
* The id of the NFT
|
|
37
|
+
*/
|
|
38
|
+
tokenId: BigintIsh;
|
|
39
|
+
/**
|
|
40
|
+
* Address to send rewards to.
|
|
41
|
+
*/
|
|
42
|
+
recipient: string;
|
|
43
|
+
/**
|
|
44
|
+
* The amount of `rewardToken` to claim. 0 claims all.
|
|
45
|
+
*/
|
|
46
|
+
amount?: BigintIsh;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Options to specify when withdrawing a position.
|
|
50
|
+
*/
|
|
51
|
+
export interface WithdrawOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Set when withdrawing. The position will be sent to `owner` on withdraw.
|
|
54
|
+
*/
|
|
55
|
+
owner: string;
|
|
56
|
+
/**
|
|
57
|
+
* Set when withdrawing. `data` is passed to `safeTransferFrom` when transferring the position from contract back to owner.
|
|
58
|
+
*/
|
|
59
|
+
data?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare abstract class Staker {
|
|
62
|
+
static INTERFACE: Interface;
|
|
63
|
+
protected constructor();
|
|
64
|
+
private static INCENTIVE_KEY_ABI;
|
|
65
|
+
/**
|
|
66
|
+
* To claim rewards, must unstake and then claim.
|
|
67
|
+
* @param incentiveKey The unique identifier of a staking program.
|
|
68
|
+
* @param options Options for producing the calldata to claim. Can't claim unless you unstake.
|
|
69
|
+
* @returns The calldatas for 'unstakeToken' and 'claimReward'.
|
|
70
|
+
*/
|
|
71
|
+
private static encodeClaim;
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* Note: A `tokenId` can be staked in many programs but to claim rewards and continue the program you must unstake, claim, and then restake.
|
|
75
|
+
* @param incentiveKeys An IncentiveKey or array of IncentiveKeys that `tokenId` is staked in.
|
|
76
|
+
* Input an array of IncentiveKeys to claim rewards for each program.
|
|
77
|
+
* @param options ClaimOptions to specify tokenId, recipient, and amount wanting to collect.
|
|
78
|
+
* Note that you can only specify one amount and one recipient across the various programs if you are collecting from multiple programs at once.
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
static collectRewards(incentiveKeys: IncentiveKey | IncentiveKey[], options: ClaimOptions): MethodParameters;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param incentiveKeys A list of incentiveKeys to unstake from. Should include all incentiveKeys (unique staking programs) that `options.tokenId` is staked in.
|
|
85
|
+
* @param withdrawOptions Options for producing claim calldata and withdraw calldata. Can't withdraw without unstaking all programs for `tokenId`.
|
|
86
|
+
* @returns Calldata for unstaking, claiming, and withdrawing.
|
|
87
|
+
*/
|
|
88
|
+
static withdrawToken(incentiveKeys: IncentiveKey | IncentiveKey[], withdrawOptions: FullWithdrawOptions): MethodParameters;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param incentiveKeys A single IncentiveKey or array of IncentiveKeys to be encoded and used in the data parameter in `safeTransferFrom`
|
|
92
|
+
* @returns An IncentiveKey as a string
|
|
93
|
+
*/
|
|
94
|
+
static encodeDeposit(incentiveKeys: IncentiveKey | IncentiveKey[]): string;
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @param incentiveKey An `IncentiveKey` which represents a unique staking program.
|
|
98
|
+
* @returns An encoded IncentiveKey to be read by ethers
|
|
99
|
+
*/
|
|
100
|
+
private static _encodeIncentiveKey;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=staker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staker.d.ts","sourceRoot":"","sources":["../src/staker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAA2B,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAmB,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE/D,OAAO,EAAE,gBAAgB,EAAS,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,eAAe,CAAA;AAChE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,WAAW,EAAE,KAAK,CAAA;IAClB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;IACV;;OAEG;IACH,SAAS,EAAE,SAAS,CAAA;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAA;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,EAAE,SAAS,CAAA;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AACD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,8BAAsB,MAAM;IAC1B,OAAc,SAAS,EAAE,SAAS,CAA2B;IAE7D,SAAS;IAET,OAAO,CAAC,MAAM,CAAC,iBAAiB,CACkE;IAElG;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAgB1B;;;;;;;;OAQG;WACW,cAAc,CAAC,aAAa,EAAE,YAAY,GAAG,YAAY,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,gBAAgB;IAuBnH;;;;;OAKG;WACW,aAAa,CACzB,aAAa,EAAE,YAAY,GAAG,YAAY,EAAE,EAC5C,eAAe,EAAE,mBAAmB,GACnC,gBAAgB;IA6BnB;;;;OAIG;WACW,aAAa,CAAC,aAAa,EAAE,YAAY,GAAG,YAAY,EAAE,GAAG,MAAM;IAiBjF;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAWnC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { BigintIsh, Currency, Percent, TradeType } from '@pancakeswap/sdk';
|
|
3
|
+
import { Trade } from './entities/trade';
|
|
4
|
+
import { PermitOptions } from './selfPermit';
|
|
5
|
+
import { MethodParameters } from './utils/calldata';
|
|
6
|
+
import { FeeOptions } from './payments';
|
|
7
|
+
/**
|
|
8
|
+
* Options for producing the arguments to send calls to the router.
|
|
9
|
+
*/
|
|
10
|
+
export interface SwapOptions {
|
|
11
|
+
/**
|
|
12
|
+
* How much the execution price is allowed to move unfavorably from the trade execution price.
|
|
13
|
+
*/
|
|
14
|
+
slippageTolerance: Percent;
|
|
15
|
+
/**
|
|
16
|
+
* The account that should receive the output.
|
|
17
|
+
*/
|
|
18
|
+
recipient: string;
|
|
19
|
+
/**
|
|
20
|
+
* When the transaction expires, in epoch seconds.
|
|
21
|
+
*/
|
|
22
|
+
deadline: BigintIsh;
|
|
23
|
+
/**
|
|
24
|
+
* The optional permit parameters for spending the input.
|
|
25
|
+
*/
|
|
26
|
+
inputTokenPermit?: PermitOptions;
|
|
27
|
+
/**
|
|
28
|
+
* The optional price limit for the trade.
|
|
29
|
+
*/
|
|
30
|
+
sqrtPriceLimitX96?: BigintIsh;
|
|
31
|
+
/**
|
|
32
|
+
* Optional information for taking a fee on output.
|
|
33
|
+
*/
|
|
34
|
+
fee?: FeeOptions;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Represents the Pancake V3 SwapRouter, and has static methods for helping execute trades.
|
|
38
|
+
*/
|
|
39
|
+
export declare abstract class SwapRouter {
|
|
40
|
+
static INTERFACE: Interface;
|
|
41
|
+
/**
|
|
42
|
+
* Cannot be constructed.
|
|
43
|
+
*/
|
|
44
|
+
private constructor();
|
|
45
|
+
/**
|
|
46
|
+
* Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
|
|
47
|
+
* @param trade to produce call parameters for
|
|
48
|
+
* @param options options for the call parameters
|
|
49
|
+
*/
|
|
50
|
+
static swapCallParameters(trades: Trade<Currency, Currency, TradeType> | Trade<Currency, Currency, TradeType>[], options: SwapOptions): MethodParameters;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=swapRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swapRouter.d.ts","sourceRoot":"","sources":["../src/swapRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,OAAO,EAAE,SAAS,EAA2B,MAAM,kBAAkB,CAAA;AAInH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAExC,OAAO,EAAE,aAAa,EAAc,MAAM,cAAc,CAAA;AAExD,OAAO,EAAE,gBAAgB,EAAS,MAAM,kBAAkB,CAAA;AAE1D,OAAO,EAAE,UAAU,EAAY,MAAM,YAAY,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAA;IAE1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;IAEnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,aAAa,CAAA;IAEhC;;OAEG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAE7B;;OAEG;IACH,GAAG,CAAC,EAAE,UAAU,CAAA;CACjB;AAED;;GAEG;AACH,8BAAsB,UAAU;IAC9B,OAAc,SAAS,EAAE,SAAS,CAA6B;IAE/D;;OAEG;IACH,OAAO;IAEP;;;;OAIG;WACW,kBAAkB,CAC9B,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACrF,OAAO,EAAE,WAAW,GACnB,gBAAgB;CAiJpB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BigintIsh } from '@pancakeswap/sdk';
|
|
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;
|
|
21
|
+
//# sourceMappingURL=calldata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calldata.d.ts","sourceRoot":"","sources":["../../src/utils/calldata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,SAAS,UAOzC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Token } from '@pancakeswap/sdk';
|
|
2
|
+
import { FeeAmount } from '../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Computes a pool address
|
|
5
|
+
* @param deployerAddress The Pancake V3 deployer address
|
|
6
|
+
* @param tokenA The first token of the pair, irrespective of sort order
|
|
7
|
+
* @param tokenB The second token of the pair, irrespective of sort order
|
|
8
|
+
* @param fee The fee tier of the pool
|
|
9
|
+
* @param initCodeHashManualOverride Override the init code hash used to compute the pool address if necessary
|
|
10
|
+
* @returns The pool address
|
|
11
|
+
*/
|
|
12
|
+
export declare function computePoolAddress({ deployerAddress, tokenA, tokenB, fee, initCodeHashManualOverride, }: {
|
|
13
|
+
deployerAddress: string;
|
|
14
|
+
tokenA: Token;
|
|
15
|
+
tokenB: Token;
|
|
16
|
+
fee: FeeAmount;
|
|
17
|
+
initCodeHashManualOverride?: string;
|
|
18
|
+
}): string;
|
|
19
|
+
//# sourceMappingURL=computePoolAddress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computePoolAddress.d.ts","sourceRoot":"","sources":["../../src/utils/computePoolAddress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAA;AAE7D;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,MAAM,EACN,MAAM,EACN,GAAG,EACH,0BAA0B,GAC3B,EAAE;IACD,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,KAAK,CAAA;IACb,MAAM,EAAE,KAAK,CAAA;IACb,GAAG,EAAE,SAAS,CAAA;IACd,0BAA0B,CAAC,EAAE,MAAM,CAAA;CACpC,GAAG,MAAM,CAWT"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Currency } from '@pancakeswap/sdk';
|
|
2
|
+
import { Route } from '../entities/route';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a route to a hex encoded path
|
|
5
|
+
* @param route the v3 path to convert to an encoded path
|
|
6
|
+
* @param exactOutput whether the route should be encoded in reverse, for making exact output swaps
|
|
7
|
+
*/
|
|
8
|
+
export declare function encodeRouteToPath(route: Route<Currency, Currency>, exactOutput: boolean): string;
|
|
9
|
+
//# sourceMappingURL=encodeRouteToPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encodeRouteToPath.d.ts","sourceRoot":"","sources":["../../src/utils/encodeRouteToPath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAS,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CA2BhG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BigintIsh } from '@pancakeswap/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the sqrt ratio as a Q64.96 corresponding to a given ratio of amount1 and amount0
|
|
4
|
+
* @param amount1 The numerator amount i.e., the amount of token1
|
|
5
|
+
* @param amount0 The denominator amount i.e., the amount of token0
|
|
6
|
+
* @returns The sqrt ratio
|
|
7
|
+
*/
|
|
8
|
+
export declare function encodeSqrtRatioX96(amount1: BigintIsh, amount0: BigintIsh): bigint;
|
|
9
|
+
//# sourceMappingURL=encodeSqrtRatioX96.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encodeSqrtRatioX96.d.ts","sourceRoot":"","sources":["../../src/utils/encodeSqrtRatioX96.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,MAAM,kBAAkB,CAAA;AAElD;;;;;GAKG;AAEH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,GAAG,MAAM,CAKjF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Currency, CurrencyAmount, Percent, Fraction } from '@pancakeswap/sdk';
|
|
2
|
+
import { Tick } from '../entities';
|
|
3
|
+
export declare const FeeCalculator: {
|
|
4
|
+
getEstimatedLPFee: typeof getEstimatedLPFee;
|
|
5
|
+
getEstimatedLPFeeByAmounts: typeof getEstimatedLPFeeByAmounts;
|
|
6
|
+
getLiquidityFromTick: typeof getLiquidityFromTick;
|
|
7
|
+
getLiquidityFromSqrtRatioX96: typeof getLiquidityFromSqrtRatioX96;
|
|
8
|
+
getAverageLiquidity: typeof getAverageLiquidity;
|
|
9
|
+
getLiquidityBySingleAmount: typeof getLiquidityBySingleAmount;
|
|
10
|
+
getDependentAmount: typeof getDependentAmount;
|
|
11
|
+
getLiquidityByAmountsAndPrice: typeof getLiquidityByAmountsAndPrice;
|
|
12
|
+
getAmountsByLiquidityAndPrice: typeof getAmountsByLiquidityAndPrice;
|
|
13
|
+
getAmountsAtNewPrice: typeof getAmountsAtNewPrice;
|
|
14
|
+
};
|
|
15
|
+
interface EstimateFeeOptions {
|
|
16
|
+
amount: CurrencyAmount<Currency>;
|
|
17
|
+
currency: Currency;
|
|
18
|
+
tickLower: number;
|
|
19
|
+
tickUpper: number;
|
|
20
|
+
volume24H: number;
|
|
21
|
+
sqrtRatioX96: bigint;
|
|
22
|
+
mostActiveLiquidity: bigint;
|
|
23
|
+
fee: number;
|
|
24
|
+
insidePercentage?: Percent;
|
|
25
|
+
protocolFee?: Percent;
|
|
26
|
+
}
|
|
27
|
+
export declare function getEstimatedLPFeeWithProtocolFee({ amount, currency, ...rest }: EstimateFeeOptions): Fraction;
|
|
28
|
+
export declare function getEstimatedLPFee({ amount, currency, ...rest }: EstimateFeeOptions): Fraction;
|
|
29
|
+
interface EstimateFeeByAmountsOptions extends Omit<EstimateFeeOptions, 'amount' | 'currency'> {
|
|
30
|
+
amountA: CurrencyAmount<Currency>;
|
|
31
|
+
amountB: CurrencyAmount<Currency>;
|
|
32
|
+
}
|
|
33
|
+
export declare function getEstimatedLPFeeByAmountsWithProtocolFee(options: EstimateFeeByAmountsOptions): Fraction;
|
|
34
|
+
export declare function getEstimatedLPFeeByAmounts({ protocolFee, ...rest }: EstimateFeeByAmountsOptions): Fraction;
|
|
35
|
+
interface GetAmountOptions {
|
|
36
|
+
amount: CurrencyAmount<Currency>;
|
|
37
|
+
currency: Currency;
|
|
38
|
+
tickLower: number;
|
|
39
|
+
tickUpper: number;
|
|
40
|
+
sqrtRatioX96: bigint;
|
|
41
|
+
}
|
|
42
|
+
export declare function getDependentAmount(options: GetAmountOptions): CurrencyAmount<Currency>;
|
|
43
|
+
export declare function getLiquidityBySingleAmount({ amount, currency, ...rest }: GetAmountOptions): bigint;
|
|
44
|
+
interface GetLiquidityOptions extends Omit<GetAmountOptions, 'amount' | 'currency'> {
|
|
45
|
+
amountA: CurrencyAmount<Currency>;
|
|
46
|
+
amountB: CurrencyAmount<Currency>;
|
|
47
|
+
}
|
|
48
|
+
export declare function getLiquidityByAmountsAndPrice({ amountA, amountB, tickUpper, tickLower, sqrtRatioX96, }: GetLiquidityOptions): bigint;
|
|
49
|
+
interface GetAmountsOptions extends Omit<GetAmountOptions, 'amount' | 'currency'> {
|
|
50
|
+
currencyA: Currency;
|
|
51
|
+
currencyB: Currency;
|
|
52
|
+
liquidity: bigint;
|
|
53
|
+
}
|
|
54
|
+
export declare function getAmountsByLiquidityAndPrice(options: GetAmountsOptions): CurrencyAmount<Currency>[];
|
|
55
|
+
interface GetAmountsAtNewPriceOptions extends Omit<GetAmountOptions, 'amount' | 'currency'> {
|
|
56
|
+
amountA: CurrencyAmount<Currency>;
|
|
57
|
+
amountB: CurrencyAmount<Currency>;
|
|
58
|
+
newSqrtRatioX96: bigint;
|
|
59
|
+
}
|
|
60
|
+
export declare function getAmountsAtNewPrice({ newSqrtRatioX96, ...rest }: GetAmountsAtNewPriceOptions): CurrencyAmount<Currency>[];
|
|
61
|
+
export declare function getAverageLiquidity(ticks: Tick[], tickSpacing: number, tickLower: number, tickUpper: number): bigint;
|
|
62
|
+
export declare function getLiquidityFromSqrtRatioX96(ticks: Tick[], sqrtRatioX96: bigint): bigint;
|
|
63
|
+
export declare function getLiquidityFromTick(ticks: Tick[], tick: number): bigint;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=feeCalculator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeCalculator.d.ts","sourceRoot":"","sources":["../../src/utils/feeCalculator.ts"],"names":[],"mappings":"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"}
|