@defillama/sdk 5.0.154 → 5.0.160

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.
@@ -35,6 +35,9 @@ export declare class Balances {
35
35
  usdTvl: number;
36
36
  usdTokenBalances: BalancesV1;
37
37
  rawTokenBalances: BalancesV1;
38
+ labelBreakdown?: {
39
+ [key: string]: number;
40
+ };
38
41
  }>;
39
42
  resizeBy(ratio: number): this;
40
43
  static getUSDValue(balances: BalancesV1, timestamp?: number): Promise<number>;
package/build/Balances.js CHANGED
@@ -155,7 +155,14 @@ class Balances {
155
155
  }
156
156
  async getUSDJSONs() {
157
157
  const { usdTvl, usdTokenBalances } = await (0, computeTVL_1.default)(this.getBalances(), this.timestamp);
158
- return { usdTvl, usdTokenBalances, rawTokenBalances: this.getBalances() };
158
+ const response = { usdTvl, usdTokenBalances, rawTokenBalances: this.getBalances(), labelBreakdown: {} };
159
+ if (!this.hasBreakdownBalances())
160
+ return response;
161
+ for (const [label, breakdown] of Object.entries(this.getBreakdownBalances())) {
162
+ const breakdownUSD = await breakdown.getUSDValue();
163
+ response.labelBreakdown[label] = breakdownUSD;
164
+ }
165
+ return response;
159
166
  }
160
167
  resizeBy(ratio) {
161
168
  Object.keys(this._balances).forEach((token) => {
@@ -79,6 +79,9 @@ export declare class ChainApi {
79
79
  usdTvl: number;
80
80
  usdTokenBalances: BalancesV1;
81
81
  rawTokenBalances: BalancesV1;
82
+ labelBreakdown?: {
83
+ [key: string]: number;
84
+ } | undefined;
82
85
  }>;
83
86
  getLogs(params: GetLogsOptions): Promise<any[] | import("ethers").EventLog[] | import("ethers").EventLog[][]>;
84
87
  getBalancesV2(): Balances;