@ring-protocol/router-sdk 0.1.5 → 0.1.7
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/dist/constants.d.ts +1 -0
- package/dist/entities/protocol.d.ts +1 -0
- package/dist/entities/route.d.ts +11 -3
- package/dist/entities/trade.d.ts +16 -7
- package/dist/router-sdk.cjs.development.js +209 -123
- package/dist/router-sdk.cjs.development.js.map +1 -1
- package/dist/router-sdk.cjs.production.min.js +1 -1
- package/dist/router-sdk.cjs.production.min.js.map +1 -1
- package/dist/router-sdk.esm.js +218 -134
- package/dist/router-sdk.esm.js.map +1 -1
- package/dist/utils/TPool.d.ts +2 -1
- package/package.json +2 -1
package/dist/constants.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const ADDRESS_THIS = "0x0000000000000000000000000000000000000002"
|
|
|
6
6
|
export declare const ZERO: JSBI;
|
|
7
7
|
export declare const ONE: JSBI;
|
|
8
8
|
export declare const MIXED_QUOTER_V1_V2_FEE_PATH_PLACEHOLDER: number;
|
|
9
|
+
export declare const RING_FEE_PATH_PLACEHOLDER = 4194304;
|
|
9
10
|
export declare const MIXED_QUOTER_V2_V2_FEE_PATH_PLACEHOLDER: number;
|
|
10
11
|
export declare const MIXED_QUOTER_V2_V3_FEE_PATH_PLACEHOLDER: number;
|
|
11
12
|
export declare const MIXED_QUOTER_V2_V4_FEE_PATH_PLACEHOLDER: number;
|
package/dist/entities/route.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Route as V2RouteSDK, Pair } from '@ring-protocol/v2-sdk';
|
|
2
|
+
import { Route as FewV2RouteSDK, Pair as FewPair } from '@ring-protocol/few-v2-sdk';
|
|
2
3
|
import { Route as V3RouteSDK, Pool as V3Pool } from '@ring-protocol/v3-sdk';
|
|
3
4
|
import { Route as V4RouteSDK, Pool as V4Pool } from '@ring-protocol/v4-sdk';
|
|
4
5
|
import { Protocol } from './protocol';
|
|
5
6
|
import { Currency, Price, Token } from '@ring-protocol/sdk-core';
|
|
6
7
|
import { MixedRouteSDK } from './mixedRoute/route';
|
|
7
|
-
export declare function getPathToken(currency: Currency, pool: Pair | V3Pool): Token;
|
|
8
|
-
export interface IRoute<TInput extends Currency, TOutput extends Currency, TPool extends Pair | V3Pool | V4Pool> {
|
|
8
|
+
export declare function getPathToken(currency: Currency, pool: FewPair | Pair | V3Pool): Token;
|
|
9
|
+
export interface IRoute<TInput extends Currency, TOutput extends Currency, TPool extends FewPair | Pair | V3Pool | V4Pool> {
|
|
9
10
|
protocol: Protocol;
|
|
10
11
|
pools: TPool[];
|
|
11
12
|
path: Currency[];
|
|
@@ -22,6 +23,13 @@ export declare class RouteV2<TInput extends Currency, TOutput extends Currency>
|
|
|
22
23
|
pathOutput: Currency;
|
|
23
24
|
constructor(v2Route: V2RouteSDK<TInput, TOutput>);
|
|
24
25
|
}
|
|
26
|
+
export declare class FewRouteV2<TInput extends Currency, TOutput extends Currency> extends FewV2RouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, FewPair> {
|
|
27
|
+
readonly protocol: Protocol;
|
|
28
|
+
readonly pools: FewPair[];
|
|
29
|
+
pathInput: Currency;
|
|
30
|
+
pathOutput: Currency;
|
|
31
|
+
constructor(fewV2Route: FewV2RouteSDK<TInput, TOutput>);
|
|
32
|
+
}
|
|
25
33
|
export declare class RouteV3<TInput extends Currency, TOutput extends Currency> extends V3RouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, V3Pool> {
|
|
26
34
|
readonly protocol: Protocol;
|
|
27
35
|
readonly path: Token[];
|
|
@@ -34,7 +42,7 @@ export declare class RouteV4<TInput extends Currency, TOutput extends Currency>
|
|
|
34
42
|
readonly path: Currency[];
|
|
35
43
|
constructor(v4Route: V4RouteSDK<TInput, TOutput>);
|
|
36
44
|
}
|
|
37
|
-
export declare class MixedRoute<TInput extends Currency, TOutput extends Currency> extends MixedRouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, Pair | V3Pool | V4Pool> {
|
|
45
|
+
export declare class MixedRoute<TInput extends Currency, TOutput extends Currency> extends MixedRouteSDK<TInput, TOutput> implements IRoute<TInput, TOutput, FewPair | Pair | V3Pool | V4Pool> {
|
|
38
46
|
readonly protocol: Protocol;
|
|
39
47
|
constructor(mixedRoute: MixedRouteSDK<TInput, TOutput>);
|
|
40
48
|
}
|
package/dist/entities/trade.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Currency, CurrencyAmount, Percent, Price, TradeType } from '@ring-protocol/sdk-core';
|
|
2
|
+
import { Pair as FewPair, Route as FewV2RouteSDK } from '@ring-protocol/few-v2-sdk';
|
|
2
3
|
import { Pair, Route as V2RouteSDK } from '@ring-protocol/v2-sdk';
|
|
3
4
|
import { Pool as V3Pool, Route as V3RouteSDK } from '@ring-protocol/v3-sdk';
|
|
4
5
|
import { Pool as V4Pool, Route as V4RouteSDK } from '@ring-protocol/v4-sdk';
|
|
5
6
|
import { MixedRouteSDK } from './mixedRoute/route';
|
|
6
7
|
import { IRoute } from './route';
|
|
7
8
|
export declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
|
|
8
|
-
readonly routes: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
9
|
+
readonly routes: IRoute<TInput, TOutput, FewPair | Pair | V3Pool | V4Pool>[];
|
|
9
10
|
readonly tradeType: TTradeType;
|
|
10
11
|
private _outputAmount;
|
|
11
12
|
private _inputAmount;
|
|
@@ -16,11 +17,16 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
|
|
|
16
17
|
* make up the trade. May consist of swaps in v2 or v3.
|
|
17
18
|
*/
|
|
18
19
|
readonly swaps: {
|
|
19
|
-
route: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>;
|
|
20
|
+
route: IRoute<TInput, TOutput, FewPair | Pair | V3Pool | V4Pool>;
|
|
20
21
|
inputAmount: CurrencyAmount<TInput>;
|
|
21
22
|
outputAmount: CurrencyAmount<TOutput>;
|
|
22
23
|
}[];
|
|
23
|
-
constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
|
|
24
|
+
constructor({ fewV2Routes, v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
|
|
25
|
+
fewV2Routes?: {
|
|
26
|
+
fewRouteV2: FewV2RouteSDK<TInput, TOutput>;
|
|
27
|
+
inputAmount: CurrencyAmount<TInput>;
|
|
28
|
+
outputAmount: CurrencyAmount<TOutput>;
|
|
29
|
+
}[];
|
|
24
30
|
v2Routes?: {
|
|
25
31
|
routev2: V2RouteSDK<TInput, TOutput>;
|
|
26
32
|
inputAmount: CurrencyAmount<TInput>;
|
|
@@ -65,8 +71,8 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
|
|
|
65
71
|
};
|
|
66
72
|
get numberOfInputWraps(): number;
|
|
67
73
|
get numberOfInputUnwraps(): number;
|
|
68
|
-
get nativeInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
69
|
-
get wethInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
|
|
74
|
+
get nativeInputRoutes(): IRoute<TInput, TOutput, FewPair | Pair | V3Pool | V4Pool>[];
|
|
75
|
+
get wethInputRoutes(): IRoute<TInput, TOutput, FewPair | Pair | V3Pool | V4Pool>[];
|
|
70
76
|
private _executionPrice;
|
|
71
77
|
/**
|
|
72
78
|
* The price expressed in terms of output amount/input amount.
|
|
@@ -110,7 +116,10 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
|
|
|
110
116
|
* @returns The execution price
|
|
111
117
|
*/
|
|
112
118
|
worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
|
|
113
|
-
static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(
|
|
119
|
+
static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(fewV2Routes: {
|
|
120
|
+
fewRouteV2: FewV2RouteSDK<TInput, TOutput>;
|
|
121
|
+
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
122
|
+
}[], v2Routes: {
|
|
114
123
|
routev2: V2RouteSDK<TInput, TOutput>;
|
|
115
124
|
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
116
125
|
}[], v3Routes: {
|
|
@@ -123,5 +132,5 @@ export declare class Trade<TInput extends Currency, TOutput extends Currency, TT
|
|
|
123
132
|
routev4: V4RouteSDK<TInput, TOutput>;
|
|
124
133
|
amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
|
|
125
134
|
}[]): Promise<Trade<TInput, TOutput, TTradeType>>;
|
|
126
|
-
static fromRoute<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(route: V2RouteSDK<TInput, TOutput> | V3RouteSDK<TInput, TOutput> | V4RouteSDK<TInput, TOutput> | MixedRouteSDK<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType): Promise<Trade<TInput, TOutput, TTradeType>>;
|
|
135
|
+
static fromRoute<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(route: FewV2RouteSDK<TInput, TOutput> | V2RouteSDK<TInput, TOutput> | V3RouteSDK<TInput, TOutput> | V4RouteSDK<TInput, TOutput> | MixedRouteSDK<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType): Promise<Trade<TInput, TOutput, TTradeType>>;
|
|
127
136
|
}
|