@gearbox-protocol/sdk 3.0.0-next.45 → 3.0.0-next.47

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,5 +1,4 @@
1
1
  import { GaugeDataPayload, GaugeQuotaParams, GaugeStakingDataPayload } from "../payload/gauge";
2
- import { BigintifyProps } from "../utils/types";
3
2
  export declare class GaugeData {
4
3
  readonly address: string;
5
4
  readonly pool: string;
@@ -11,12 +10,17 @@ export declare class GaugeData {
11
10
  readonly quotaParams: Record<string, GaugeQuotaParams>;
12
11
  constructor(payload: GaugeDataPayload);
13
12
  }
13
+ interface WithDrawableGaugeItem {
14
+ amount: bigint;
15
+ epochsLeft: number;
16
+ }
14
17
  export declare class GaugeStakingData {
15
18
  readonly availableBalance: bigint;
16
19
  readonly totalBalance: bigint;
17
20
  readonly epoch: number;
18
21
  readonly withdrawableNow: bigint;
19
22
  readonly withdrawableInEpochsTotal: bigint;
20
- readonly withdrawableInEpochs: BigintifyProps<GaugeStakingDataPayload["withdrawableAmounts"]["withdrawableInEpochs"]>;
23
+ readonly withdrawableInEpochs: Array<WithDrawableGaugeItem>;
21
24
  constructor(payload: GaugeStakingDataPayload);
22
25
  }
26
+ export {};
package/lib/core/gauge.js CHANGED
@@ -51,14 +51,13 @@ class GaugeStakingData {
51
51
  this.totalBalance = (0, sdk_gov_1.toBigInt)(payload.totalBalance);
52
52
  this.epoch = payload.epoch;
53
53
  this.withdrawableNow = (0, sdk_gov_1.toBigInt)(payload.withdrawableAmounts.withdrawableNow);
54
- const { total, list } = payload.withdrawableAmounts.withdrawableInEpochs.reduce(({ total, list }, a) => {
54
+ const { total, list } = payload.withdrawableAmounts.withdrawableInEpochs.reduce(({ total, list }, a, i) => {
55
55
  const bn = (0, sdk_gov_1.toBigInt)(a);
56
- list.push(bn);
56
+ list.push({ amount: bn, epochsLeft: i + 1 });
57
57
  return { total: total + bn, list };
58
58
  }, { total: 0n, list: [] });
59
59
  this.withdrawableInEpochsTotal = total;
60
- this.withdrawableInEpochs =
61
- list;
60
+ this.withdrawableInEpochs = list;
62
61
  }
63
62
  }
64
63
  exports.GaugeStakingData = GaugeStakingData;
@@ -22,7 +22,7 @@ export declare class PoolData {
22
22
  readonly totalDebtLimit: bigint;
23
23
  readonly creditManagerDebtParams: Record<string, CreditManagerDebtParams>;
24
24
  readonly quotas: Record<string, QuotaInfo>;
25
- readonly zappers: Record<string, PoolZapper>;
25
+ readonly zappers: Record<string, Record<string, PoolZapper>>;
26
26
  readonly totalAssets: bigint;
27
27
  readonly totalSupply: bigint;
28
28
  readonly supplyAPY7D: number | undefined;
package/lib/core/pool.js CHANGED
@@ -79,17 +79,18 @@ class PoolData {
79
79
  },
80
80
  ];
81
81
  }));
82
- this.zappers = Object.fromEntries(payload.zappers.map(z => {
82
+ this.zappers = payload.zappers.reduce((acc, z) => {
83
83
  const tokenIn = z.tokenIn.toLowerCase();
84
- return [
85
- tokenIn,
86
- {
87
- tokenIn,
88
- tokenOut: z.tokenOut.toLowerCase(),
89
- zapper: z.zapper.toLowerCase(),
84
+ const tokenOut = z.tokenOut.toLowerCase();
85
+ const old = acc[tokenIn] || {};
86
+ return {
87
+ ...acc,
88
+ [tokenIn]: {
89
+ ...old,
90
+ [tokenOut]: { tokenIn, tokenOut, zapper: z.zapper.toLowerCase() },
90
91
  },
91
- ];
92
- }));
92
+ };
93
+ }, {});
93
94
  this.totalAssets = (0, sdk_gov_1.toBigInt)(payload.totalAssets);
94
95
  this.totalSupply = (0, sdk_gov_1.toBigInt)(payload.totalSupply);
95
96
  this.depositAPY = (0, formatter_1.rayToNumber)((0, sdk_gov_1.toBigInt)(payload.supplyRate) * sdk_gov_1.PERCENTAGE_DECIMALS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.45",
3
+ "version": "3.0.0-next.47",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -41,10 +41,10 @@
41
41
  "@commitlint/cli": "^17.6.3",
42
42
  "@commitlint/config-conventional": "^17.0.3",
43
43
  "@gearbox-protocol/core-v2": "1.19.0-base.17",
44
- "@gearbox-protocol/core-v3": "^1.42.2",
44
+ "@gearbox-protocol/core-v3": "^1.43.0",
45
45
  "@gearbox-protocol/eslint-config": "^1.4.1",
46
- "@gearbox-protocol/integrations-v3": "^1.20.2",
47
- "@gearbox-protocol/oracles-v3": "^1.7.6",
46
+ "@gearbox-protocol/integrations-v3": "^1.21.0",
47
+ "@gearbox-protocol/oracles-v3": "^1.8.0",
48
48
  "@gearbox-protocol/periphery-v3": "^1.3.8",
49
49
  "@gearbox-protocol/prettier-config": "^1.4.1",
50
50
  "@gearbox-protocol/router-v3": "^1.4.0",