@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.
Files changed (123) hide show
  1. package/lib/apy/convexAPY.d.ts +4 -6
  2. package/lib/apy/convexAPY.js +15 -16
  3. package/lib/apy/curveAPY.d.ts +2 -2
  4. package/lib/apy/curveAPY.js +3 -4
  5. package/lib/apy/index.d.ts +1 -1
  6. package/lib/apy/index.js +2 -2
  7. package/lib/apy/lidoAPY.js +2 -2
  8. package/lib/apy/yearnAPY.d.ts +1 -1
  9. package/lib/apy/yearnAPY.js +3 -5
  10. package/lib/contracts/contractsRegister.d.ts +1 -1
  11. package/lib/contracts/contractsRegister.js +6 -7
  12. package/lib/core/creditAccount.js +20 -22
  13. package/lib/core/creditAccount.spec.js +32 -34
  14. package/lib/core/creditManager.js +16 -17
  15. package/lib/core/creditSession.js +12 -13
  16. package/lib/core/events.js +34 -35
  17. package/lib/core/pool/data.js +22 -23
  18. package/lib/core/priceOracle.js +3 -3
  19. package/lib/core/rewardClaimer.d.ts +1 -3
  20. package/lib/core/rewardConvex.d.ts +1 -4
  21. package/lib/core/rewardConvex.js +7 -10
  22. package/lib/core/rewardConvex.spec.js +15 -16
  23. package/lib/core/strategy.js +14 -16
  24. package/lib/core/strategy.spec.js +20 -22
  25. package/lib/core/trade.d.ts +1 -1
  26. package/lib/core/trade.js +12 -15
  27. package/lib/core/transactions.d.ts +1 -1
  28. package/lib/core/transactions.js +18 -20
  29. package/lib/index.d.ts +2 -20
  30. package/lib/index.js +27 -24
  31. package/lib/parsers/ERC20Parser.d.ts +1 -1
  32. package/lib/parsers/abstractParser.d.ts +1 -1
  33. package/lib/parsers/abstractParser.js +3 -4
  34. package/lib/parsers/convexBaseRewardPoolAdapterParser.d.ts +1 -1
  35. package/lib/parsers/convexBaseRewardPoolAdapterParser.js +2 -2
  36. package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +4 -4
  37. package/lib/parsers/convexBoosterAdapterParser.d.ts +1 -1
  38. package/lib/parsers/convexBoosterAdapterParser.js +3 -3
  39. package/lib/parsers/convexBoosterAdapterParser.spec.js +3 -3
  40. package/lib/parsers/convextRewardPoolParser.d.ts +1 -1
  41. package/lib/parsers/creditFacadeParser.d.ts +1 -1
  42. package/lib/parsers/creditFacadeParser.spec.js +8 -9
  43. package/lib/parsers/curveAdapterParser.d.ts +1 -2
  44. package/lib/parsers/curveAdapterParser.js +5 -5
  45. package/lib/parsers/curveAdapterParser.spec.js +13 -13
  46. package/lib/parsers/lidoAdapterParser.d.ts +1 -1
  47. package/lib/parsers/lidoAdapterParser.spec.js +2 -2
  48. package/lib/parsers/lidoSTETHParser.d.ts +1 -1
  49. package/lib/parsers/txParser.d.ts +1 -3
  50. package/lib/parsers/txParser.js +12 -15
  51. package/lib/parsers/uniV2AdapterParser.d.ts +1 -1
  52. package/lib/parsers/uniV2AdapterParser.spec.js +15 -16
  53. package/lib/parsers/uniV3AdapterParser.d.ts +1 -1
  54. package/lib/parsers/uniV3AdapterParser.spec.js +15 -16
  55. package/lib/parsers/wstETHAdapterParser.d.ts +1 -1
  56. package/lib/parsers/wstETHAdapterParser.spec.js +3 -3
  57. package/lib/parsers/yearnAdapterParser.spec.js +12 -12
  58. package/lib/parsers/yearnV2AdapterParser.d.ts +1 -1
  59. package/lib/parsers/yearnV2AdapterParser.js +2 -2
  60. package/lib/pathfinder/pathOptions.d.ts +1 -2
  61. package/lib/pathfinder/pathOptions.js +12 -16
  62. package/lib/pathfinder/pathOptions.spec.js +36 -36
  63. package/lib/pathfinder/pathfinder.d.ts +1 -2
  64. package/lib/pathfinder/pathfinder.js +9 -10
  65. package/lib/pathfinder/pathfinder.spec.js +11 -12
  66. package/lib/payload/creditAccount.d.ts +1 -1
  67. package/lib/payload/creditManager.d.ts +1 -1
  68. package/lib/payload/pool.d.ts +1 -1
  69. package/lib/tokens/tokenData.d.ts +0 -4
  70. package/lib/tokens/tokenData.js +1 -16
  71. package/lib/utils/formatter.js +3 -3
  72. package/lib/utils/math.js +5 -5
  73. package/lib/utils/price.js +4 -4
  74. package/lib/watchers/creditAccountWatcher.js +2 -2
  75. package/lib/watchers/creditAccountWatcher.spec.js +18 -18
  76. package/lib/watchers/creditManagerWatcher.spec.js +19 -19
  77. package/package.json +2 -1
  78. package/lib/contracts/adapters.d.ts +0 -24
  79. package/lib/contracts/adapters.js +0 -28
  80. package/lib/contracts/contracts.d.ts +0 -112
  81. package/lib/contracts/contracts.js +0 -654
  82. package/lib/contracts/protocols.d.ts +0 -12
  83. package/lib/contracts/protocols.js +0 -16
  84. package/lib/contracts/utilsContracts.d.ts +0 -7
  85. package/lib/contracts/utilsContracts.js +0 -28
  86. package/lib/core/chains.d.ts +0 -23
  87. package/lib/core/chains.js +0 -63
  88. package/lib/core/constants.d.ts +0 -21
  89. package/lib/core/constants.js +0 -31
  90. package/lib/tokens/aave.d.ts +0 -20
  91. package/lib/tokens/aave.js +0 -62
  92. package/lib/tokens/balancer.d.ts +0 -12
  93. package/lib/tokens/balancer.js +0 -36
  94. package/lib/tokens/compound.d.ts +0 -11
  95. package/lib/tokens/compound.js +0 -38
  96. package/lib/tokens/convex.d.ts +0 -30
  97. package/lib/tokens/convex.js +0 -262
  98. package/lib/tokens/curveLP.d.ts +0 -27
  99. package/lib/tokens/curveLP.js +0 -141
  100. package/lib/tokens/decimals.d.ts +0 -2
  101. package/lib/tokens/decimals.js +0 -115
  102. package/lib/tokens/gear.d.ts +0 -14
  103. package/lib/tokens/gear.js +0 -47
  104. package/lib/tokens/normal.d.ts +0 -9
  105. package/lib/tokens/normal.js +0 -194
  106. package/lib/tokens/quoted.d.ts +0 -3
  107. package/lib/tokens/quoted.js +0 -7
  108. package/lib/tokens/token.d.ts +0 -25
  109. package/lib/tokens/token.js +0 -305
  110. package/lib/tokens/tokenType.d.ts +0 -15
  111. package/lib/tokens/tokenType.js +0 -19
  112. package/lib/tokens/tokens.spec.d.ts +0 -1
  113. package/lib/tokens/tokens.spec.js +0 -151
  114. package/lib/tokens/yearn.d.ts +0 -26
  115. package/lib/tokens/yearn.js +0 -52
  116. package/lib/utils/mappers.d.ts +0 -8
  117. package/lib/utils/mappers.js +0 -13
  118. package/lib/utils/multicall.d.ts +0 -36
  119. package/lib/utils/multicall.js +0 -90
  120. package/lib/utils/safeEnum.d.ts +0 -1
  121. package/lib/utils/safeEnum.js +0 -10
  122. package/lib/utils/types.d.ts +0 -10
  123. package/lib/utils/types.js +0 -2
@@ -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;
@@ -1 +0,0 @@
1
- export declare function safeEnum(t: string): string;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safeEnum = void 0;
4
- function safeEnum(t) {
5
- if (!isNaN(parseInt(t.charAt(0), 10))) {
6
- return `_${t}`;
7
- }
8
- return t;
9
- }
10
- exports.safeEnum = safeEnum;
@@ -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 {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });