@haven-fi/solauto-sdk 1.0.462 → 1.0.464

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.
@@ -85,10 +85,10 @@ async function getJupPriceData(mints, extraInfo) {
85
85
  if (!result ||
86
86
  result === null ||
87
87
  (typeof result === "object" &&
88
- Object.values(result).includes([null, undefined]))) {
88
+ Boolean(Object.values(data).filter((x) => x === null).length))) {
89
89
  throw new Error("Failed to get token prices using Jupiter");
90
90
  }
91
91
  return result;
92
- }, 6);
92
+ }, 8);
93
93
  return data;
94
94
  }
@@ -246,9 +246,16 @@ async function main(filterWhitelist: boolean) {
246
246
  );
247
247
 
248
248
  const tvl = latestStates
249
+ .map((x) =>
250
+ fromBaseUnit(x.supply.amountUsed.baseAmountUsdValue, USD_DECIMALS)
251
+ )
252
+ .reduce((acc, curr) => acc + curr, 0);
253
+ const netWorth = latestStates
249
254
  .map((x) => fromBaseUnit(x.netWorth.baseAmountUsdValue, USD_DECIMALS))
250
255
  .reduce((acc, curr) => acc + curr, 0);
251
- console.log(`Total TVL: $${formatNumber(tvl, 2, 10000, 2)}`);
256
+
257
+ console.log(`TVL: $${formatNumber(tvl, 2, 10000, 2)}`);
258
+ console.log(`Total net worth: $${formatNumber(netWorth, 2, 10000, 2)}`);
252
259
  }
253
260
 
254
261
  const filterWhitelist = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.462",
3
+ "version": "1.0.464",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -168,12 +168,12 @@ export async function getJupPriceData(mints: PublicKey[], extraInfo?: boolean) {
168
168
  !result ||
169
169
  result === null ||
170
170
  (typeof result === "object" &&
171
- Object.values(result).includes([null, undefined]))
171
+ Boolean(Object.values(data).filter((x) => x === null).length))
172
172
  ) {
173
173
  throw new Error("Failed to get token prices using Jupiter");
174
174
  }
175
175
  return result;
176
- }, 6);
176
+ }, 8);
177
177
 
178
178
  return data as { [key: string]: any };
179
179
  }