@gearbox-protocol/sdk 2.1.34 → 3.0.0-next.2
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/lib/apy/convexAPY.d.ts +4 -6
- package/lib/apy/convexAPY.js +15 -16
- package/lib/apy/curveAPY.d.ts +2 -2
- package/lib/apy/curveAPY.js +3 -4
- package/lib/apy/index.d.ts +1 -1
- package/lib/apy/index.js +2 -2
- package/lib/apy/lidoAPY.js +2 -2
- package/lib/apy/yearnAPY.d.ts +1 -1
- package/lib/apy/yearnAPY.js +3 -5
- package/lib/contracts/contractsRegister.d.ts +1 -1
- package/lib/contracts/contractsRegister.js +6 -7
- package/lib/core/creditAccount.js +20 -22
- package/lib/core/creditAccount.spec.js +32 -34
- package/lib/core/creditManager.js +16 -17
- package/lib/core/creditSession.js +12 -13
- package/lib/core/events.js +34 -35
- package/lib/core/pool/data.js +22 -23
- package/lib/core/priceOracle.js +3 -3
- package/lib/core/rewardClaimer.d.ts +1 -3
- package/lib/core/rewardConvex.d.ts +1 -4
- package/lib/core/rewardConvex.js +7 -10
- package/lib/core/rewardConvex.spec.js +15 -16
- package/lib/core/strategy.js +14 -16
- package/lib/core/strategy.spec.js +20 -22
- package/lib/core/trade.d.ts +1 -1
- package/lib/core/trade.js +12 -15
- package/lib/core/transactions.d.ts +1 -1
- package/lib/core/transactions.js +18 -20
- package/lib/index.d.ts +2 -20
- package/lib/index.js +27 -24
- package/lib/parsers/ERC20Parser.d.ts +1 -1
- package/lib/parsers/abstractParser.d.ts +1 -1
- package/lib/parsers/abstractParser.js +3 -4
- package/lib/parsers/convexBaseRewardPoolAdapterParser.d.ts +1 -1
- package/lib/parsers/convexBaseRewardPoolAdapterParser.js +2 -2
- package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +4 -4
- package/lib/parsers/convexBoosterAdapterParser.d.ts +1 -1
- package/lib/parsers/convexBoosterAdapterParser.js +3 -3
- package/lib/parsers/convexBoosterAdapterParser.spec.js +3 -3
- package/lib/parsers/convextRewardPoolParser.d.ts +1 -1
- package/lib/parsers/creditFacadeParser.d.ts +1 -1
- package/lib/parsers/creditFacadeParser.spec.js +8 -9
- package/lib/parsers/curveAdapterParser.d.ts +1 -2
- package/lib/parsers/curveAdapterParser.js +5 -5
- package/lib/parsers/curveAdapterParser.spec.js +13 -13
- package/lib/parsers/lidoAdapterParser.d.ts +1 -1
- package/lib/parsers/lidoAdapterParser.spec.js +2 -2
- package/lib/parsers/lidoSTETHParser.d.ts +1 -1
- package/lib/parsers/txParser.d.ts +1 -3
- package/lib/parsers/txParser.js +12 -15
- package/lib/parsers/uniV2AdapterParser.d.ts +1 -1
- package/lib/parsers/uniV2AdapterParser.spec.js +15 -16
- package/lib/parsers/uniV3AdapterParser.d.ts +1 -1
- package/lib/parsers/uniV3AdapterParser.spec.js +15 -16
- package/lib/parsers/wstETHAdapterParser.d.ts +1 -1
- package/lib/parsers/wstETHAdapterParser.spec.js +3 -3
- package/lib/parsers/yearnAdapterParser.spec.js +12 -12
- package/lib/parsers/yearnV2AdapterParser.d.ts +1 -1
- package/lib/parsers/yearnV2AdapterParser.js +2 -2
- package/lib/pathfinder/pathOptions.d.ts +1 -2
- package/lib/pathfinder/pathOptions.js +12 -16
- package/lib/pathfinder/pathOptions.spec.js +36 -36
- package/lib/pathfinder/pathfinder.d.ts +1 -2
- package/lib/pathfinder/pathfinder.js +9 -10
- package/lib/pathfinder/pathfinder.spec.js +11 -12
- package/lib/payload/creditAccount.d.ts +1 -1
- package/lib/payload/creditManager.d.ts +1 -1
- package/lib/payload/pool.d.ts +1 -1
- package/lib/tokens/tokenData.d.ts +0 -4
- package/lib/tokens/tokenData.js +1 -16
- package/lib/utils/formatter.js +3 -3
- package/lib/utils/math.js +5 -5
- package/lib/utils/price.js +4 -4
- package/lib/watchers/creditAccountWatcher.js +2 -2
- package/lib/watchers/creditAccountWatcher.spec.js +18 -18
- package/lib/watchers/creditManagerWatcher.spec.js +19 -19
- package/package.json +2 -1
- package/lib/contracts/adapters.d.ts +0 -24
- package/lib/contracts/adapters.js +0 -28
- package/lib/contracts/contracts.d.ts +0 -112
- package/lib/contracts/contracts.js +0 -654
- package/lib/contracts/protocols.d.ts +0 -12
- package/lib/contracts/protocols.js +0 -16
- package/lib/contracts/utilsContracts.d.ts +0 -7
- package/lib/contracts/utilsContracts.js +0 -28
- package/lib/core/chains.d.ts +0 -23
- package/lib/core/chains.js +0 -63
- package/lib/core/constants.d.ts +0 -21
- package/lib/core/constants.js +0 -31
- package/lib/tokens/aave.d.ts +0 -20
- package/lib/tokens/aave.js +0 -62
- package/lib/tokens/balancer.d.ts +0 -12
- package/lib/tokens/balancer.js +0 -36
- package/lib/tokens/compound.d.ts +0 -11
- package/lib/tokens/compound.js +0 -38
- package/lib/tokens/convex.d.ts +0 -30
- package/lib/tokens/convex.js +0 -262
- package/lib/tokens/curveLP.d.ts +0 -27
- package/lib/tokens/curveLP.js +0 -141
- package/lib/tokens/decimals.d.ts +0 -2
- package/lib/tokens/decimals.js +0 -115
- package/lib/tokens/gear.d.ts +0 -14
- package/lib/tokens/gear.js +0 -47
- package/lib/tokens/normal.d.ts +0 -9
- package/lib/tokens/normal.js +0 -194
- package/lib/tokens/quoted.d.ts +0 -3
- package/lib/tokens/quoted.js +0 -7
- package/lib/tokens/token.d.ts +0 -25
- package/lib/tokens/token.js +0 -305
- package/lib/tokens/tokenType.d.ts +0 -15
- package/lib/tokens/tokenType.js +0 -19
- package/lib/tokens/tokens.spec.d.ts +0 -1
- package/lib/tokens/tokens.spec.js +0 -151
- package/lib/tokens/yearn.d.ts +0 -26
- package/lib/tokens/yearn.js +0 -52
- package/lib/utils/mappers.d.ts +0 -8
- package/lib/utils/mappers.js +0 -13
- package/lib/utils/multicall.d.ts +0 -36
- package/lib/utils/multicall.js +0 -90
- package/lib/utils/safeEnum.d.ts +0 -1
- package/lib/utils/safeEnum.js +0 -10
- package/lib/utils/types.d.ts +0 -10
- package/lib/utils/types.js +0 -2
package/lib/utils/multicall.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MultiCallContract = exports.safeMulticall = exports.multicall = void 0;
|
|
4
|
-
const config_1 = require("../config");
|
|
5
|
-
const types_1 = require("../types");
|
|
6
|
-
async function multicall(calls, p, overrides) {
|
|
7
|
-
const multiCallContract = types_1.Multicall2__factory.connect(config_1.MULTICALL_ADDRESS, p);
|
|
8
|
-
const { returnData } = await multiCallContract.callStatic.aggregate(calls.map(c => ({
|
|
9
|
-
target: c.address,
|
|
10
|
-
callData: c.interface.encodeFunctionData(c.method, c.params),
|
|
11
|
-
})), overrides || {});
|
|
12
|
-
return returnData
|
|
13
|
-
.map((d, num) => calls[num].interface.decodeFunctionResult(calls[num].method, d))
|
|
14
|
-
.map(unwrapArray);
|
|
15
|
-
}
|
|
16
|
-
exports.multicall = multicall;
|
|
17
|
-
/**
|
|
18
|
-
* Like multicall from sdk, but uses tryAggregate instead of aggregate
|
|
19
|
-
* @param calls
|
|
20
|
-
* @param p
|
|
21
|
-
* @param overrides
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
async function safeMulticall(calls, p, overrides) {
|
|
25
|
-
if (!calls.length) {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
const multiCallContract = types_1.Multicall2__factory.connect("0xcA11bde05977b3631167028862bE2a173976CA11", p);
|
|
29
|
-
const resp = await multiCallContract.callStatic.tryAggregate(false, calls.map(c => ({
|
|
30
|
-
target: c.address,
|
|
31
|
-
callData: c.interface.encodeFunctionData(c.method, c.params),
|
|
32
|
-
})), overrides ?? {});
|
|
33
|
-
return resp.map((d, num) => {
|
|
34
|
-
let value;
|
|
35
|
-
let error;
|
|
36
|
-
if (d.success) {
|
|
37
|
-
try {
|
|
38
|
-
value = unwrapArray(calls[num].interface.decodeFunctionResult(calls[num].method, d.returnData));
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
if (e instanceof Error) {
|
|
42
|
-
error = e;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
error = new Error(`${e}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
error = new Error("multicall call failed");
|
|
51
|
-
}
|
|
52
|
-
return { error, value };
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
exports.safeMulticall = safeMulticall;
|
|
56
|
-
function unwrapArray(data) {
|
|
57
|
-
if (!data) {
|
|
58
|
-
return data;
|
|
59
|
-
}
|
|
60
|
-
if (Array.isArray(data)) {
|
|
61
|
-
return data.length === 1 ? data[0] : data;
|
|
62
|
-
}
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
class MultiCallContract {
|
|
66
|
-
_address;
|
|
67
|
-
_interface;
|
|
68
|
-
_multiCall;
|
|
69
|
-
constructor(address, intrerface, provider) {
|
|
70
|
-
this._address = address;
|
|
71
|
-
this._interface = intrerface;
|
|
72
|
-
this._multiCall = types_1.Multicall2__factory.connect(config_1.MULTICALL_ADDRESS, provider);
|
|
73
|
-
}
|
|
74
|
-
async call(data, overrides) {
|
|
75
|
-
const { returnData } = await this._multiCall.callStatic.aggregate(data.map(c => ({
|
|
76
|
-
target: this._address,
|
|
77
|
-
callData: this._interface.encodeFunctionData(c.method, c.params),
|
|
78
|
-
})), overrides || {});
|
|
79
|
-
return returnData
|
|
80
|
-
.map((d, num) => this._interface.decodeFunctionResult(data[num].method, d))
|
|
81
|
-
.map(r => r[0]);
|
|
82
|
-
}
|
|
83
|
-
get address() {
|
|
84
|
-
return this._address;
|
|
85
|
-
}
|
|
86
|
-
get interface() {
|
|
87
|
-
return this._interface;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.MultiCallContract = MultiCallContract;
|
package/lib/utils/safeEnum.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function safeEnum(t: string): string;
|
package/lib/utils/safeEnum.js
DELETED
package/lib/utils/types.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type PartialRecord<K extends keyof any, T> = {
|
|
2
|
-
[P in K]?: T;
|
|
3
|
-
};
|
|
4
|
-
export type AwaitedRes<T extends (...args: any) => any> = Awaited<ReturnType<T>>;
|
|
5
|
-
type ArrayMethodKeys = keyof [] & {};
|
|
6
|
-
type NonArrayKeys<T> = T extends `${number}` | number | ArrayMethodKeys ? never : T;
|
|
7
|
-
export type ExcludeArrayProps<T> = {
|
|
8
|
-
[K in keyof T as NonArrayKeys<K>]: T[K];
|
|
9
|
-
};
|
|
10
|
-
export {};
|
package/lib/utils/types.js
DELETED