@pancakeswap/sdk 5.8.2 → 5.8.3

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,204 +0,0 @@
1
- import { Percent } from '@pancakeswap/swap-sdk-core';
2
- import { ERC20Token } from './entities/token';
3
- export declare const ZERO_PERCENT: Percent;
4
- export declare const ONE_HUNDRED_PERCENT: Percent;
5
- export declare const FACTORY_ADDRESS = "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73";
6
- export declare const FACTORY_ADDRESS_MAP: {
7
- readonly 1: "0x1097053Fd2ea711dad45caCcc45EfF7548fCB362";
8
- readonly 5: "0x1097053Fd2ea711dad45caCcc45EfF7548fCB362";
9
- readonly 56: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73";
10
- readonly 97: "0x6725F303b657a9451d8BA641348b6761A6CC7a17";
11
- readonly 42161: "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E";
12
- readonly 421613: "0x333EAE459075b1d7dE8eb57997b5d4eee5F1070a";
13
- readonly 1101: "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E";
14
- readonly 1442: "0xBA40c83026213F9cbc79998752721a0312bdB74a";
15
- readonly 324: "0xd03D8D566183F0086d8D09A84E1e30b58Dd5619d";
16
- readonly 280: "0x48a33610Cd0E130af2024D55F67aE72a8C51aC27";
17
- readonly 59144: "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E";
18
- readonly 59140: "0xB6FAfd4ADbCd21cF665909767e0eD0D05709abfB";
19
- readonly 204: "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E";
20
- readonly 5611: "0x776e4bD2f72de2176A59465e316335aaf8ed4E8F";
21
- readonly 8453: "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E";
22
- readonly 84531: "0x715303D2eF7dA7FFAbF637651D71FD11d41fAf7F";
23
- readonly 534351: "0x2B3C5df29F73dbF028BA82C33e0A5A6e5800F75e";
24
- readonly 11155111: "0x1bdc540dEB9Ed1fA29964DeEcCc524A8f5e2198e";
25
- readonly 421614: "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E";
26
- readonly 84532: "0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E";
27
- };
28
- export declare const INIT_CODE_HASH = "0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5";
29
- export declare const INIT_CODE_HASH_MAP: {
30
- readonly 1: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
31
- readonly 5: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
32
- readonly 56: "0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5";
33
- readonly 97: "0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66";
34
- readonly 42161: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
35
- readonly 421613: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
36
- readonly 1101: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
37
- readonly 1442: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
38
- readonly 324: "0x0100045707a42494392b3558029b9869f865ff9df8f375dc1bf20b0555093f43";
39
- readonly 280: "0x0100045707a42494392b3558029b9869f865ff9df8f375dc1bf20b0555093f43";
40
- readonly 59144: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
41
- readonly 59140: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
42
- readonly 204: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
43
- readonly 5611: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
44
- readonly 8453: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
45
- readonly 84531: "0xa5934690703a592a07e841ca29d5e5c79b5e22ed4749057bb216dc31100be1c0";
46
- readonly 534351: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
47
- readonly 11155111: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
48
- readonly 421614: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
49
- readonly 84532: "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d";
50
- };
51
- export declare const WETH9: {
52
- 1: ERC20Token;
53
- 5: ERC20Token;
54
- 56: ERC20Token;
55
- 97: ERC20Token;
56
- 42161: ERC20Token;
57
- 421613: ERC20Token;
58
- 324: ERC20Token;
59
- 280: ERC20Token;
60
- 1101: ERC20Token;
61
- 1442: ERC20Token;
62
- 59144: ERC20Token;
63
- 59140: ERC20Token;
64
- 5611: ERC20Token;
65
- 204: ERC20Token;
66
- 8453: ERC20Token;
67
- 84531: ERC20Token;
68
- 534351: ERC20Token;
69
- 11155111: ERC20Token;
70
- 421614: ERC20Token;
71
- 84532: ERC20Token;
72
- };
73
- export declare const WBNB: {
74
- 1: ERC20Token;
75
- 56: ERC20Token;
76
- 97: ERC20Token;
77
- 5611: ERC20Token;
78
- 204: ERC20Token;
79
- };
80
- export declare const WNATIVE: {
81
- 1: ERC20Token;
82
- 5: ERC20Token;
83
- 56: ERC20Token;
84
- 97: ERC20Token;
85
- 42161: ERC20Token;
86
- 421613: ERC20Token;
87
- 1101: ERC20Token;
88
- 1442: ERC20Token;
89
- 324: ERC20Token;
90
- 280: ERC20Token;
91
- 59144: ERC20Token;
92
- 59140: ERC20Token;
93
- 5611: ERC20Token;
94
- 204: ERC20Token;
95
- 8453: ERC20Token;
96
- 84531: ERC20Token;
97
- 534351: ERC20Token;
98
- 11155111: ERC20Token;
99
- 421614: ERC20Token;
100
- 84532: ERC20Token;
101
- };
102
- export declare const NATIVE: {
103
- 1: {
104
- readonly name: "Ether";
105
- readonly symbol: "ETH";
106
- readonly decimals: 18;
107
- };
108
- 5: {
109
- name: string;
110
- symbol: string;
111
- decimals: number;
112
- };
113
- 56: {
114
- readonly name: "Binance Chain Native Token";
115
- readonly symbol: "BNB";
116
- readonly decimals: 18;
117
- };
118
- 97: {
119
- name: string;
120
- symbol: string;
121
- decimals: number;
122
- };
123
- 42161: {
124
- readonly name: "Ether";
125
- readonly symbol: "ETH";
126
- readonly decimals: 18;
127
- };
128
- 421613: {
129
- name: string;
130
- symbol: string;
131
- decimals: number;
132
- };
133
- 1101: {
134
- readonly name: "Ether";
135
- readonly symbol: "ETH";
136
- readonly decimals: 18;
137
- };
138
- 1442: {
139
- readonly name: "Ether";
140
- readonly symbol: "ETH";
141
- readonly decimals: 18;
142
- };
143
- 324: {
144
- readonly name: "Ether";
145
- readonly symbol: "ETH";
146
- readonly decimals: 18;
147
- };
148
- 280: {
149
- readonly name: "Ether";
150
- readonly symbol: "ETH";
151
- readonly decimals: 18;
152
- };
153
- 59144: {
154
- readonly name: "Ether";
155
- readonly symbol: "ETH";
156
- readonly decimals: 18;
157
- };
158
- 59140: {
159
- readonly name: "Ether";
160
- readonly symbol: "ETH";
161
- readonly decimals: 18;
162
- };
163
- 204: {
164
- readonly name: "Binance Chain Native Token";
165
- readonly symbol: "BNB";
166
- readonly decimals: 18;
167
- };
168
- 5611: {
169
- name: string;
170
- symbol: string;
171
- decimals: number;
172
- };
173
- 8453: {
174
- readonly name: "Ether";
175
- readonly symbol: "ETH";
176
- readonly decimals: 18;
177
- };
178
- 84531: {
179
- readonly name: "Ether";
180
- readonly symbol: "ETH";
181
- readonly decimals: 18;
182
- };
183
- 534351: {
184
- readonly name: "Ether";
185
- readonly symbol: "ETH";
186
- readonly decimals: 18;
187
- };
188
- 11155111: {
189
- name: string;
190
- symbol: string;
191
- decimals: number;
192
- };
193
- 421614: {
194
- name: string;
195
- symbol: string;
196
- decimals: number;
197
- };
198
- 84532: {
199
- name: string;
200
- symbol: string;
201
- decimals: number;
202
- };
203
- };
204
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,eAAO,MAAM,YAAY,SAAmB,CAAA;AAC5C,eAAO,MAAM,mBAAmB,SAAmB,CAAA;AAEnD,eAAO,MAAM,eAAe,+CAA+C,CAAA;AAI3E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;CAqBa,CAAA;AAE7C,eAAO,MAAM,cAAc,uEAAuE,CAAA;AAGlG,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;CAqBW,CAAA;AAE1C,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;CAiKjB,CAAA;AAED,eAAO,MAAM,IAAI;;;;;;CAyChB,CAAA;AAED,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;CAqBmB,CAAA;AASvC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDlB,CAAA"}
@@ -1,18 +0,0 @@
1
- import { Currency, Token, NativeCurrency } from '@pancakeswap/swap-sdk-core';
2
- /**
3
- *
4
- * Native is the main usage of a 'native' currency, i.e. for BSC mainnet and all testnets
5
- */
6
- export declare class Native extends NativeCurrency {
7
- protected constructor({ chainId, decimals, name, symbol, }: {
8
- chainId: number;
9
- decimals: number;
10
- symbol: string;
11
- name: string;
12
- });
13
- get wrapped(): Token;
14
- private static cache;
15
- static onChain(chainId: number): Native;
16
- equals(other: Currency): boolean;
17
- }
18
- //# sourceMappingURL=native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../src/entities/native.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAG5E;;;GAGG;AACH,qBAAa,MAAO,SAAQ,cAAc;IACxC,SAAS,aAAa,EACpB,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,MAAM,GACP,EAAE;QACD,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb;IAID,IAAW,OAAO,IAAI,KAAK,CAI1B;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAoC;WAE1C,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAUvC,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;CAGxC"}
@@ -1,46 +0,0 @@
1
- import { CurrencyAmount, Price, BigintIsh } from '@pancakeswap/swap-sdk-core';
2
- import { Address } from 'viem';
3
- import { ERC20Token } from './token';
4
- export declare const computePairAddress: ({ factoryAddress, tokenA, tokenB, }: {
5
- factoryAddress: Address;
6
- tokenA: ERC20Token;
7
- tokenB: ERC20Token;
8
- }) => Address;
9
- export declare class Pair {
10
- readonly liquidityToken: ERC20Token;
11
- private readonly tokenAmounts;
12
- static getAddress(tokenA: ERC20Token, tokenB: ERC20Token): Address;
13
- constructor(currencyAmountA: CurrencyAmount<ERC20Token>, tokenAmountB: CurrencyAmount<ERC20Token>);
14
- /**
15
- * Returns true if the token is either token0 or token1
16
- * @param token to check
17
- */
18
- involvesToken(token: ERC20Token): boolean;
19
- /**
20
- * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0
21
- */
22
- get token0Price(): Price<ERC20Token, ERC20Token>;
23
- /**
24
- * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1
25
- */
26
- get token1Price(): Price<ERC20Token, ERC20Token>;
27
- /**
28
- * Return the price of the given token in terms of the other token in the pair.
29
- * @param token token to return price of
30
- */
31
- priceOf(token: ERC20Token): Price<ERC20Token, ERC20Token>;
32
- /**
33
- * Returns the chain ID of the tokens in the pair.
34
- */
35
- get chainId(): number;
36
- get token0(): ERC20Token;
37
- get token1(): ERC20Token;
38
- get reserve0(): CurrencyAmount<ERC20Token>;
39
- get reserve1(): CurrencyAmount<ERC20Token>;
40
- reserveOf(token: ERC20Token): CurrencyAmount<ERC20Token>;
41
- getOutputAmount(inputAmount: CurrencyAmount<ERC20Token>): [CurrencyAmount<ERC20Token>, Pair];
42
- getInputAmount(outputAmount: CurrencyAmount<ERC20Token>): [CurrencyAmount<ERC20Token>, Pair];
43
- getLiquidityMinted(totalSupply: CurrencyAmount<ERC20Token>, tokenAmountA: CurrencyAmount<ERC20Token>, tokenAmountB: CurrencyAmount<ERC20Token>): CurrencyAmount<ERC20Token>;
44
- getLiquidityValue(token: ERC20Token, totalSupply: CurrencyAmount<ERC20Token>, liquidity: CurrencyAmount<ERC20Token>, feeOn?: boolean, kLast?: BigintIsh): CurrencyAmount<ERC20Token>;
45
- }
46
- //# sourceMappingURL=pair.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../../src/entities/pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,cAAc,EACd,KAAK,EAML,SAAS,EAEV,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,OAAO,EAYR,MAAM,MAAM,CAAA;AAIb,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AA4BpC,eAAO,MAAM,kBAAkB;oBAKb,OAAO;YACf,UAAU;YACV,UAAU;MAChB,OAoBH,CAAA;AAED,qBAAa,IAAI;IACf,SAAgB,cA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IAqBtB,iBAAiB,CACtB,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,cAAc,CAAC,UAAU,CAAC,EACvC,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,EACrC,KAAK,UAAQ,EACb,KAAK,CAAC,EAAE,SAAS,GAChB,cAAc,CAAC,UAAU,CAAC;CAiC9B"}
@@ -1,13 +0,0 @@
1
- import { Token, Currency, Price } from '@pancakeswap/swap-sdk-core';
2
- import { Pair } from './pair';
3
- export declare class Route<TInput extends Currency, TOutput extends Currency> {
4
- readonly pairs: Pair[];
5
- readonly path: Token[];
6
- readonly input: TInput;
7
- readonly output: TOutput;
8
- constructor(pairs: Pair[], input: TInput, output: TOutput);
9
- private _midPrice;
10
- get midPrice(): Price<TInput, TOutput>;
11
- get chainId(): number;
12
- }
13
- //# sourceMappingURL=route.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/entities/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,qBAAa,KAAK,CAAC,MAAM,SAAS,QAAQ,EAAE,OAAO,SAAS,QAAQ;IAClE,SAAgB,KAAK,EAAE,IAAI,EAAE,CAAA;IAE7B,SAAgB,IAAI,EAAE,KAAK,EAAE,CAAA;IAE7B,SAAgB,KAAK,EAAE,MAAM,CAAA;IAE7B,SAAgB,MAAM,EAAE,OAAO,CAAA;gBAEZ,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IA2BhE,OAAO,CAAC,SAAS,CAAsC;IAEvD,IAAW,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAa5C;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"token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
1
- import { TradeType, CurrencyAmount, Currency, Percent, Price } from '@pancakeswap/swap-sdk-core';
2
- import { Pair } from './pair';
3
- import { Route } from './route';
4
- interface InputOutput<TInput extends Currency, TOutput extends Currency> {
5
- readonly inputAmount: CurrencyAmount<TInput>;
6
- readonly outputAmount: CurrencyAmount<TOutput>;
7
- }
8
- export declare function inputOutputComparator<TInput extends Currency, TOutput extends Currency>(a: InputOutput<TInput, TOutput>, b: InputOutput<TInput, TOutput>): number;
9
- export declare function tradeComparator<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(a: Trade<TInput, TOutput, TTradeType>, b: Trade<TInput, TOutput, TTradeType>): number;
10
- export interface BestTradeOptions {
11
- maxNumResults?: number;
12
- maxHops?: number;
13
- }
14
- /**
15
- * Represents a trade executed against a list of pairs.
16
- * Does not account for slippage, i.e. trades that front run this trade and move the price.
17
- */
18
- export declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
19
- /**
20
- * The route of the trade, i.e. which pairs the trade goes through and the input/output currencies.
21
- */
22
- readonly route: Route<TInput, TOutput>;
23
- /**
24
- * The type of the trade, either exact in or exact out.
25
- */
26
- readonly tradeType: TTradeType;
27
- /**
28
- * The input amount for the trade assuming no slippage.
29
- */
30
- readonly inputAmount: CurrencyAmount<TInput>;
31
- /**
32
- * The output amount for the trade assuming no slippage.
33
- */
34
- readonly outputAmount: CurrencyAmount<TOutput>;
35
- /**
36
- * The price expressed in terms of output amount/input amount.
37
- */
38
- readonly executionPrice: Price<TInput, TOutput>;
39
- /**
40
- * The percent difference between the mid price before the trade and the trade execution price.
41
- */
42
- readonly priceImpact: Percent;
43
- /**
44
- * Constructs an exact in trade with the given amount in and route
45
- * @param route route of the exact in trade
46
- * @param amountIn the amount being passed in
47
- */
48
- static exactIn<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountIn: CurrencyAmount<TInput>): Trade<TInput, TOutput, TradeType.EXACT_INPUT>;
49
- /**
50
- * Constructs an exact out trade with the given amount out and route
51
- * @param route route of the exact out trade
52
- * @param amountOut the amount returned by the trade
53
- */
54
- static exactOut<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountOut: CurrencyAmount<TOutput>): Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>;
55
- constructor(route: Route<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType);
56
- /**
57
- * Get the minimum amount that must be received from this trade for the given slippage tolerance
58
- * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade
59
- */
60
- minimumAmountOut(slippageTolerance: Percent): CurrencyAmount<TOutput>;
61
- /**
62
- * Get the maximum amount in that can be spent via this trade for the given slippage tolerance
63
- * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade
64
- */
65
- maximumAmountIn(slippageTolerance: Percent): CurrencyAmount<TInput>;
66
- /**
67
- * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token
68
- * amount to an output token, making at most `maxHops` hops.
69
- * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting
70
- * the amount in among multiple routes.
71
- * @param pairs the pairs to consider in finding the best trade
72
- * @param nextAmountIn exact amount of input currency to spend
73
- * @param currencyOut the desired currency out
74
- * @param maxNumResults maximum number of results to return
75
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair
76
- * @param currentPairs used in recursion; the current list of pairs
77
- * @param currencyAmountIn used in recursion; the original value of the currencyAmountIn parameter
78
- * @param bestTrades used in recursion; the current list of best trades
79
- */
80
- 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>[];
81
- /**
82
- * Return the execution price after accounting for slippage tolerance
83
- * @param slippageTolerance the allowed tolerated slippage
84
- */
85
- worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
86
- /**
87
- * similar to the above method but instead targets a fixed output amount
88
- * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token
89
- * to an output token amount, making at most `maxHops` hops
90
- * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting
91
- * the amount in among multiple routes.
92
- * @param pairs the pairs to consider in finding the best trade
93
- * @param currencyIn the currency to spend
94
- * @param nextAmountOut the exact amount of currency out
95
- * @param maxNumResults maximum number of results to return
96
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair
97
- * @param currentPairs used in recursion; the current list of pairs
98
- * @param currencyAmountOut used in recursion; the original value of the currencyAmountOut parameter
99
- * @param bestTrades used in recursion; the current list of best trades
100
- */
101
- 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>[];
102
- }
103
- export {};
104
- //# sourceMappingURL=trade.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trade.d.ts","sourceRoot":"","sources":["../../src/entities/trade.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,SAAS,EAET,cAAc,EACd,QAAQ,EAER,OAAO,EACP,KAAK,EAIN,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,UAAU,WAAW,CAAC,MAAM,SAAS,QAAQ,EAAE,OAAO,SAAS,QAAQ;IACrE,QAAQ,CAAC,WAAW,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AAC,EAAE;IA6DlD;;;OAGG;IACI,mBAAmB,CAAC,iBAAiB,EAAE,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;IAS9E;;;;;;;;;;;;;;OAcG;WACW,iBAAiB,CAAC,MAAM,SAAS,QAAQ,EAAE,OAAO,SAAS,QAAQ,EAC/E,KAAK,EAAE,IAAI,EAAE,EACb,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,cAAc,CAAC,OAAO,CAAC,EAC1C,EAAE,aAAiB,EAAE,OAAW,EAAE,GAAE,gBAAqB,EAEzD,YAAY,GAAE,IAAI,EAAO,EACzB,aAAa,GAAE,cAAc,CAAC,QAAQ,CAAqB,EAC3D,UAAU,GAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,EAAO,GAChE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,EAAE;CA4DpD"}
package/dist/ether.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { Currency, NativeCurrency, Token } from '@pancakeswap/swap-sdk-core';
2
- /**
3
- * Ether is the main usage of a 'native' currency, i.e. for Ethereum mainnet and all testnets
4
- */
5
- export declare class Ether extends NativeCurrency {
6
- protected constructor(chainId: number);
7
- get wrapped(): Token;
8
- private static _etherCache;
9
- static onChain(chainId: number): Ether;
10
- equals(other: Currency): boolean;
11
- }
12
- //# sourceMappingURL=ether.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ether.d.ts","sourceRoot":"","sources":["../src/ether.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAI5E;;GAEG;AACH,qBAAa,KAAM,SAAQ,cAAc;IACvC,SAAS,aAAa,OAAO,EAAE,MAAM;IAIrC,IAAW,OAAO,IAAI,KAAK,CAM1B;IAED,OAAO,CAAC,MAAM,CAAC,WAAW,CAAmC;WAE/C,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;IAQtC,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;CAGxC"}
package/dist/fetcher.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import { ChainId } from '@pancakeswap/chains';
2
- import { Token } from '@pancakeswap/swap-sdk-core';
3
- import { Address } from 'viem';
4
- import { Pair } from './entities/pair';
5
- /**
6
- * Contains methods for constructing instances of pairs and tokens from on-chain data.
7
- */
8
- export declare abstract class Fetcher {
9
- /**
10
- * Cannot be constructed.
11
- */
12
- private constructor();
13
- /**
14
- * Fetch information for a given token on the given chain, using the given viem provider.
15
- * @param chainId chain of the token
16
- * @param address address of the token on the chain
17
- * @param provider provider used to fetch the token
18
- * @param symbol symbol of the token
19
- * @param name optional name of the token
20
- */
21
- static fetchTokenData(chainId: ChainId, address: Address, publicClient: any, symbol: string, name?: string): Promise<Token>;
22
- /**
23
- * Fetches information about a pair and constructs a pair from the given two tokens.
24
- * @param tokenA first token
25
- * @param tokenB second token
26
- * @param provider the provider to use to fetch the data
27
- */
28
- static fetchPairData(tokenA: Token, tokenB: Token, publicClient?: any): Promise<Pair>;
29
- }
30
- //# sourceMappingURL=fetcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAkB,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAElE,OAAO,EAAE,OAAO,EAAuD,MAAM,MAAM,CAAA;AAInF,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AA0BtC;;GAEG;AACH,8BAAsB,OAAO;IAC3B;;OAEG;IAEH,OAAO;IAEP;;;;;;;OAOG;WACiB,cAAc,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,YAAY,KAAiC,EAC7C,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,CAAC;IAsBjB;;;;;OAKG;WACiB,aAAa,CAC/B,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,KAAK,EACb,YAAY,GAAE,GAAsC,GACnD,OAAO,CAAC,IAAI,CAAC;CAejB"}
package/dist/router.d.ts DELETED
@@ -1,62 +0,0 @@
1
- import { Currency, Percent, TradeType } from '@pancakeswap/swap-sdk-core';
2
- import { Hex } from 'viem';
3
- import { Trade } from './entities';
4
- /**
5
- * Options for producing the arguments to send call to the router.
6
- */
7
- export interface TradeOptions {
8
- /**
9
- * How much the execution price is allowed to move unfavorably from the trade execution price.
10
- */
11
- allowedSlippage: Percent;
12
- /**
13
- * How long the swap is valid until it expires, in seconds.
14
- * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters
15
- * are generated.
16
- */
17
- ttl: number;
18
- /**
19
- * The account that should receive the output of the swap.
20
- */
21
- recipient: string;
22
- /**
23
- * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods
24
- */
25
- feeOnTransfer?: boolean;
26
- }
27
- export interface TradeOptionsDeadline extends Omit<TradeOptions, 'ttl'> {
28
- /**
29
- * When the transaction expires.
30
- * This is an atlernate to specifying the ttl, for when you do not want to use local time.
31
- */
32
- deadline: number;
33
- }
34
- /**
35
- * The parameters to use in the call to the Pancake Router to execute a trade.
36
- */
37
- export interface SwapParameters {
38
- /**
39
- * The method to call on the Pancake Router.
40
- */
41
- methodName: string;
42
- /**
43
- * The arguments to pass to the method, all hex encoded.
44
- */
45
- args: Array<Hex | Hex[] | unknown>;
46
- /**
47
- * The amount of wei to send in hex.
48
- */
49
- value: Hex;
50
- }
51
- /**
52
- * Represents the Pancake Router, and has static methods for helping execute trades.
53
- */
54
- export declare abstract class Router {
55
- /**
56
- * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
57
- * @param trade to produce call parameters for
58
- * @param options options for the call parameters
59
- */
60
- static swapCallParameters(trade: Trade<Currency, Currency, TradeType>, options: TradeOptions | TradeOptionsDeadline): SwapParameters;
61
- }
62
- //# sourceMappingURL=router.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,OAAO,EAAS,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEhG,OAAO,EAAW,GAAG,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC;IACrE;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,KAAK,EAAE,GAAG,CAAA;CACX;AAQD;;GAEG;AACH,8BAAsB,MAAM;IAC1B;;;;OAIG;WACW,kBAAkB,CAC9B,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,EAC3C,OAAO,EAAE,YAAY,GAAG,oBAAoB,GAC3C,cAAc;CAuElB"}
package/dist/trade.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Currency, Percent, TradeType } from '@pancakeswap/swap-sdk-core';
2
- import { Trade } from './entities';
3
- export declare function isTradeBetter(tradeA: Trade<Currency, Currency, TradeType> | undefined | null, tradeB: Trade<Currency, Currency, TradeType> | undefined | null, minimumDelta?: Percent): boolean | undefined;
4
- export default isTradeBetter;
5
- //# sourceMappingURL=trade.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trade.d.ts","sourceRoot":"","sources":["../src/trade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIlC,wBAAgB,aAAa,CAC3B,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,GAAG,SAAS,GAAG,IAAI,EAC/D,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,GAAG,SAAS,GAAG,IAAI,EAC/D,YAAY,GAAE,OAAsB,GACnC,OAAO,GAAG,SAAS,CAmBrB;AAED,eAAe,aAAa,CAAA"}
package/dist/utils.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Address } from 'viem';
2
- export declare function validateAndParseAddress(address: string): Address;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,MAAM,CAAA;AAM1C,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQhE"}