@gearbox-protocol/sdk 0.0.100 → 0.0.103
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/.eslintignore +4 -0
- package/.eslintrc.js +52 -0
- package/.husky/pre-push +4 -0
- package/lib/apy/convexAPY.d.ts +8 -0
- package/lib/apy/convexAPY.js +200 -0
- package/lib/apy/lidoAPY.d.ts +4 -0
- package/lib/apy/lidoAPY.js +103 -0
- package/lib/config.d.ts +1 -0
- package/lib/config.js +2 -1
- package/lib/contracts/contracts.d.ts +9 -4
- package/lib/contracts/contracts.js +52 -14
- package/lib/contracts/contractsRegister.js +16 -4
- package/lib/core/constants.d.ts +7 -1
- package/lib/core/constants.js +11 -5
- package/lib/core/creditAccount.d.ts +3 -1
- package/lib/core/creditAccount.js +33 -31
- package/lib/core/creditManager.d.ts +13 -2
- package/lib/core/creditManager.js +77 -33
- package/lib/core/creditSession.js +14 -3
- package/lib/core/errors.d.ts +10 -0
- package/lib/core/errors.js +16 -1
- package/lib/core/eventOrTx.d.ts +1 -1
- package/lib/core/events.d.ts +19 -19
- package/lib/core/events.js +32 -30
- package/lib/core/multicall.d.ts +1 -1
- package/lib/core/pool.d.ts +2 -2
- package/lib/core/pool.js +8 -12
- package/lib/core/price.d.ts +2 -0
- package/lib/core/price.js +14 -0
- package/lib/core/strategy.d.ts +36 -0
- package/lib/core/strategy.js +57 -0
- package/lib/core/tokenDistributor.js +1 -1
- package/lib/core/transactions.d.ts +18 -3
- package/lib/core/transactions.js +39 -3
- package/lib/index.d.ts +8 -3
- package/lib/index.js +9 -4
- package/lib/oracles/priceFeeds.js +1 -1
- package/lib/pathfinder/convexLP.d.ts +1 -1
- package/lib/pathfinder/convexLP.js +26 -29
- package/lib/pathfinder/curveLP.d.ts +1 -1
- package/lib/pathfinder/curveLP.js +5 -7
- package/lib/pathfinder/path.d.ts +1 -1
- package/lib/pathfinder/path.js +38 -42
- package/lib/pathfinder/trade.d.ts +1 -2
- package/lib/pathfinder/tradeTypes.d.ts +5 -5
- package/lib/pathfinder/yVault.d.ts +2 -2
- package/lib/pathfinder/yVault.js +22 -19
- package/lib/payload/creditAccount.d.ts +4 -26
- package/lib/payload/creditManager.d.ts +3 -25
- package/lib/payload/pool.d.ts +2 -17
- package/lib/payload/pool.js +0 -1
- package/lib/strategies/curve.d.ts +6 -60
- package/lib/strategies/curve.js +6 -0
- package/lib/strategies/uniswapV2.js +3 -19
- package/lib/strategies/uniswapV3.js +1 -1
- package/lib/strategies/yearn.js +15 -11
- package/lib/tokens/convex.d.ts +3 -3
- package/lib/tokens/curveLP.d.ts +2 -2
- package/lib/tokens/curveLP.js +1 -1
- package/lib/tokens/gear.d.ts +2 -2
- package/lib/tokens/gear.js +1 -1
- package/lib/tokens/normal.d.ts +1 -1
- package/lib/tokens/token.js +9 -9
- package/lib/tokens/tokenData.d.ts +3 -1
- package/lib/tokens/tokenData.js +10 -8
- package/lib/tokens/yearn.d.ts +3 -3
- package/lib/utils/errors.d.ts +6 -0
- package/lib/utils/errors.js +13 -0
- package/lib/utils/formatter.d.ts +2 -1
- package/lib/utils/formatter.js +23 -15
- package/lib/utils/loading.d.ts +2 -1
- package/lib/utils/loading.js +9 -13
- package/lib/utils/mappers.d.ts +2 -1
- package/lib/utils/mappers.js +13 -5
- package/lib/utils/multicall.js +4 -3
- package/lib/utils/network.js +2 -2
- package/lib/utils/repeater.js +12 -24
- package/lib/utils/types.d.ts +1 -0
- package/lib/utils/validate.js +1 -1
- package/package.json +26 -8
- package/src/apy/convexAPY.ts +250 -0
- package/src/apy/lidoAPY.ts +89 -0
- package/src/config.ts +2 -1
- package/src/contracts/contracts.ts +73 -19
- package/src/contracts/contractsRegister.ts +19 -4
- package/src/core/constants.ts +11 -4
- package/src/core/creditAccount.ts +69 -37
- package/src/core/creditManager.ts +256 -148
- package/src/core/creditOperation.ts +7 -7
- package/src/core/creditSession.ts +25 -5
- package/src/core/errors.ts +25 -0
- package/src/core/eventOrTx.ts +8 -5
- package/src/core/events.ts +978 -911
- package/src/core/history.ts +46 -46
- package/src/core/multicall.ts +1 -1
- package/src/core/operations.ts +6 -0
- package/src/core/pool.ts +75 -58
- package/src/core/price.ts +13 -0
- package/src/core/strategy.ts +134 -0
- package/src/core/tokenDistributor.ts +2 -2
- package/src/core/transactions.ts +427 -350
- package/src/index.ts +9 -4
- package/src/oracles/priceFeeds.ts +523 -523
- package/src/pathfinder/contracts.ts +15 -13
- package/src/pathfinder/convexLP.ts +29 -25
- package/src/pathfinder/curveLP.ts +57 -53
- package/src/pathfinder/path.ts +158 -150
- package/src/pathfinder/priority.ts +11 -11
- package/src/pathfinder/trade.ts +84 -77
- package/src/pathfinder/tradeTypes.ts +98 -94
- package/src/pathfinder/yVault.ts +79 -63
- package/src/payload/creditAccount.ts +4 -26
- package/src/payload/creditManager.ts +4 -26
- package/src/payload/pool.ts +2 -19
- package/src/payload/token.ts +3 -3
- package/src/strategies/convex.ts +217 -210
- package/src/strategies/creditFacade.ts +70 -53
- package/src/strategies/curve.ts +263 -194
- package/src/strategies/lido.ts +33 -37
- package/src/strategies/uniswapV2.ts +90 -112
- package/src/strategies/uniswapV3.ts +114 -91
- package/src/strategies/yearn.ts +58 -62
- package/src/tokens/connectors.ts +6 -6
- package/src/tokens/convex.ts +297 -296
- package/src/tokens/curveLP.ts +170 -165
- package/src/tokens/gear.ts +47 -45
- package/src/tokens/normal.ts +801 -802
- package/src/tokens/token.ts +19 -10
- package/src/tokens/tokenData.ts +19 -9
- package/src/tokens/tokenType.ts +11 -11
- package/src/tokens/yearn.ts +126 -124
- package/src/utils/errors.ts +11 -0
- package/src/utils/formatter.ts +26 -18
- package/src/utils/loading.ts +14 -6
- package/src/utils/mappers.ts +15 -6
- package/src/utils/multicall.ts +6 -9
- package/src/utils/network.ts +21 -21
- package/src/utils/repeater.ts +2 -2
- package/src/utils/types.ts +6 -2
- package/src/utils/validate.ts +1 -1
- package/lib/core/adapters.d.ts +0 -15
- package/lib/core/adapters.js +0 -19
- package/lib/core/contracts.d.ts +0 -67
- package/lib/core/contracts.js +0 -254
- package/lib/core/contractsRegister.d.ts +0 -2
- package/lib/core/contractsRegister.js +0 -58
- package/lib/core/creditCard.d.ts +0 -13
- package/lib/core/creditCard.js +0 -2
- package/lib/core/oracles.d.ts +0 -38
- package/lib/core/oracles.js +0 -12
- package/lib/core/priceFeeds.d.ts +0 -3
- package/lib/core/priceFeeds.js +0 -492
- package/lib/core/protocols.d.ts +0 -13
- package/lib/core/protocols.js +0 -39
- package/lib/core/swap.d.ts +0 -4
- package/lib/core/swap.js +0 -8
- package/lib/core/trade.d.ts +0 -35
- package/lib/core/trade.js +0 -62
- package/lib/core/tradeTypes.d.ts +0 -79
- package/lib/core/tradeTypes.js +0 -21
- package/lib/utils/events.d.ts +0 -2
- package/lib/utils/events.js +0 -13
- package/src/utils/events.ts +0 -10
package/lib/core/tradeTypes.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ConvexPoolContract, CurvePoolContract, UniswapV2Contract, YearnVaultContract } from "../contracts/contracts";
|
|
2
|
-
import { NormalToken } from "../tokens/normal";
|
|
3
|
-
import { CurveLPToken } from "../tokens/curveLP";
|
|
4
|
-
import { YearnLPToken } from "../tokens/yearn";
|
|
5
|
-
import { ConvexLPToken, ConvexStakedPhantomToken } from "../tokens/convex";
|
|
6
|
-
export declare enum TradeType {
|
|
7
|
-
UniswapV2Swap = 0,
|
|
8
|
-
UniswapV3Swap = 1,
|
|
9
|
-
CurveExchange = 2,
|
|
10
|
-
CurveExchangeUnderlying = 3,
|
|
11
|
-
CurveDepositLP = 4,
|
|
12
|
-
CurveWithdrawLP = 5,
|
|
13
|
-
YearnDeposit = 6,
|
|
14
|
-
YearnWithdraw = 7,
|
|
15
|
-
LidoStake = 8,
|
|
16
|
-
ConvexDepositLP = 9,
|
|
17
|
-
ConvexStake = 10,
|
|
18
|
-
ConvexDepositLPAndStake = 11,
|
|
19
|
-
ConvexWithdrawLP = 12,
|
|
20
|
-
ConvexWithdraw = 13,
|
|
21
|
-
ConvexWithdrawAndUnwrap = 14
|
|
22
|
-
}
|
|
23
|
-
export declare type TradeAction = {
|
|
24
|
-
type: TradeType.UniswapV2Swap;
|
|
25
|
-
contract: UniswapV2Contract;
|
|
26
|
-
tokenOut?: NormalToken;
|
|
27
|
-
} | {
|
|
28
|
-
type: TradeType.UniswapV3Swap;
|
|
29
|
-
contract: "UNISWAP_V3_ROUTER";
|
|
30
|
-
tokenOut?: NormalToken;
|
|
31
|
-
} | {
|
|
32
|
-
type: TradeType.CurveExchange;
|
|
33
|
-
contract: CurvePoolContract;
|
|
34
|
-
tokenOut: Array<NormalToken | CurveLPToken>;
|
|
35
|
-
} | {
|
|
36
|
-
type: TradeType.CurveDepositLP;
|
|
37
|
-
contract: CurvePoolContract;
|
|
38
|
-
tokenOut: CurveLPToken;
|
|
39
|
-
} | {
|
|
40
|
-
type: TradeType.CurveWithdrawLP;
|
|
41
|
-
contract: CurvePoolContract;
|
|
42
|
-
tokenOut: Array<CurveLPToken | NormalToken>;
|
|
43
|
-
} | {
|
|
44
|
-
type: TradeType.YearnDeposit;
|
|
45
|
-
contract: YearnVaultContract;
|
|
46
|
-
tokenOut: YearnLPToken;
|
|
47
|
-
} | {
|
|
48
|
-
type: TradeType.YearnWithdraw;
|
|
49
|
-
contract: YearnVaultContract;
|
|
50
|
-
tokenOut: NormalToken | CurveLPToken;
|
|
51
|
-
} | {
|
|
52
|
-
type: TradeType.LidoStake;
|
|
53
|
-
contract: "LIDO_STETH_GATEWAY";
|
|
54
|
-
tokenOut: NormalToken;
|
|
55
|
-
} | {
|
|
56
|
-
type: TradeType.ConvexDepositLP;
|
|
57
|
-
contract: "CONVEX_BOOSTER";
|
|
58
|
-
tokenOut: ConvexLPToken;
|
|
59
|
-
} | {
|
|
60
|
-
type: TradeType.ConvexStake;
|
|
61
|
-
contract: ConvexPoolContract;
|
|
62
|
-
tokenOut: ConvexStakedPhantomToken;
|
|
63
|
-
} | {
|
|
64
|
-
type: TradeType.ConvexDepositLPAndStake;
|
|
65
|
-
contract: "CONVEX_BOOSTER";
|
|
66
|
-
tokenOut: ConvexStakedPhantomToken;
|
|
67
|
-
} | {
|
|
68
|
-
type: TradeType.ConvexWithdrawLP;
|
|
69
|
-
contract: "CONVEX_BOOSTER";
|
|
70
|
-
tokenOut: CurveLPToken;
|
|
71
|
-
} | {
|
|
72
|
-
type: TradeType.ConvexWithdraw;
|
|
73
|
-
contract: ConvexPoolContract;
|
|
74
|
-
tokenOut: ConvexLPToken;
|
|
75
|
-
} | {
|
|
76
|
-
type: TradeType.ConvexWithdrawAndUnwrap;
|
|
77
|
-
contract: ConvexPoolContract;
|
|
78
|
-
tokenOut: CurveLPToken;
|
|
79
|
-
};
|
package/lib/core/tradeTypes.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TradeType = void 0;
|
|
4
|
-
var TradeType;
|
|
5
|
-
(function (TradeType) {
|
|
6
|
-
TradeType[TradeType["UniswapV2Swap"] = 0] = "UniswapV2Swap";
|
|
7
|
-
TradeType[TradeType["UniswapV3Swap"] = 1] = "UniswapV3Swap";
|
|
8
|
-
TradeType[TradeType["CurveExchange"] = 2] = "CurveExchange";
|
|
9
|
-
TradeType[TradeType["CurveExchangeUnderlying"] = 3] = "CurveExchangeUnderlying";
|
|
10
|
-
TradeType[TradeType["CurveDepositLP"] = 4] = "CurveDepositLP";
|
|
11
|
-
TradeType[TradeType["CurveWithdrawLP"] = 5] = "CurveWithdrawLP";
|
|
12
|
-
TradeType[TradeType["YearnDeposit"] = 6] = "YearnDeposit";
|
|
13
|
-
TradeType[TradeType["YearnWithdraw"] = 7] = "YearnWithdraw";
|
|
14
|
-
TradeType[TradeType["LidoStake"] = 8] = "LidoStake";
|
|
15
|
-
TradeType[TradeType["ConvexDepositLP"] = 9] = "ConvexDepositLP";
|
|
16
|
-
TradeType[TradeType["ConvexStake"] = 10] = "ConvexStake";
|
|
17
|
-
TradeType[TradeType["ConvexDepositLPAndStake"] = 11] = "ConvexDepositLPAndStake";
|
|
18
|
-
TradeType[TradeType["ConvexWithdrawLP"] = 12] = "ConvexWithdrawLP";
|
|
19
|
-
TradeType[TradeType["ConvexWithdraw"] = 13] = "ConvexWithdraw";
|
|
20
|
-
TradeType[TradeType["ConvexWithdrawAndUnwrap"] = 14] = "ConvexWithdrawAndUnwrap";
|
|
21
|
-
})(TradeType = exports.TradeType || (exports.TradeType = {}));
|
package/lib/utils/events.d.ts
DELETED
package/lib/utils/events.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typedEventsComparator = void 0;
|
|
4
|
-
var typedEventsComparator = function (a, b) {
|
|
5
|
-
return a.blockNumber === b.blockNumber
|
|
6
|
-
? a.logIndex > b.logIndex
|
|
7
|
-
? 1
|
|
8
|
-
: -1
|
|
9
|
-
: a.blockNumber > b.blockNumber
|
|
10
|
-
? 1
|
|
11
|
-
: -1;
|
|
12
|
-
};
|
|
13
|
-
exports.typedEventsComparator = typedEventsComparator;
|
package/src/utils/events.ts
DELETED