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

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.
@@ -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.46",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",