@gearbox-protocol/sdk 3.0.0-next.17 → 3.0.0-next.18

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.
@@ -40,6 +40,7 @@ export interface CalcQuotaBorrowRateProps {
40
40
  borrowAmount: bigint;
41
41
  }
42
42
  export declare class CreditAccountData {
43
+ readonly isSuccessful: boolean;
43
44
  readonly addr: string;
44
45
  readonly borrower: string;
45
46
  readonly creditManager: string;
@@ -6,6 +6,7 @@ const formatter_1 = require("../utils/formatter");
6
6
  const math_1 = require("../utils/math");
7
7
  const price_1 = require("../utils/price");
8
8
  class CreditAccountData {
9
+ isSuccessful;
9
10
  addr;
10
11
  borrower;
11
12
  creditManager;
@@ -40,6 +41,7 @@ class CreditAccountData {
40
41
  quotedTokens = {};
41
42
  schedultedWithdrawals;
42
43
  constructor(payload) {
44
+ this.isSuccessful = payload.isSuccessful;
43
45
  this.addr = payload.addr.toLowerCase();
44
46
  this.borrower = payload.borrower.toLowerCase();
45
47
  this.creditManager = payload.creditManager.toLowerCase();
@@ -49,16 +51,16 @@ class CreditAccountData {
49
51
  this.expirationDate = Number((0, sdk_gov_1.toBigInt)(payload.expirationDate));
50
52
  this.version = payload.cfVersion?.toNumber();
51
53
  this.cmDescription = payload.cmDescription;
52
- this.healthFactor = Number((0, sdk_gov_1.toBigInt)(payload.healthFactor));
54
+ this.healthFactor = Number((0, sdk_gov_1.toBigInt)(payload.healthFactor || 0n));
53
55
  this.enabledTokenMask = (0, sdk_gov_1.toBigInt)(payload.enabledTokensMask);
54
56
  this.isDeleting = false;
55
57
  this.borrowedAmount = (0, sdk_gov_1.toBigInt)(payload.debt);
56
- this.accruedInterest = (0, sdk_gov_1.toBigInt)(payload.accruedInterest);
57
- this.accruedFees = (0, sdk_gov_1.toBigInt)(payload.accruedFees);
58
+ this.accruedInterest = (0, sdk_gov_1.toBigInt)(payload.accruedInterest || 0n);
59
+ this.accruedFees = (0, sdk_gov_1.toBigInt)(payload.accruedFees || 0n);
58
60
  this.borrowedAmountPlusInterestAndFees =
59
61
  this.borrowedAmount + this.accruedInterest + this.accruedFees;
60
62
  this.totalDebtUSD = (0, sdk_gov_1.toBigInt)(payload.totalDebtUSD);
61
- this.totalValue = (0, sdk_gov_1.toBigInt)(payload.totalValue);
63
+ this.totalValue = (0, sdk_gov_1.toBigInt)(payload.totalValue || 0n);
62
64
  this.totalValueUSD = (0, sdk_gov_1.toBigInt)(payload.totalValueUSD);
63
65
  this.twvUSD = (0, sdk_gov_1.toBigInt)(payload.twvUSD);
64
66
  this.baseBorrowRate = (0, formatter_1.rayToNumber)((0, sdk_gov_1.toBigInt)(payload.baseBorrowRate) *
@@ -1,6 +1,6 @@
1
1
  import { ExcludeArrayProps } from "@gearbox-protocol/sdk-gov";
2
2
  import { CreditAccountDataStructOutput, ScheduledWithdrawalStructOutput, TokenBalanceStructOutput } from "../types/IDataCompressorV3_00";
3
- import { BigintifyProps } from "../utils/types";
3
+ import { BigintifyProps, PartialKeys } from "../utils/types";
4
4
  export type CaTokenBalance = BigintifyProps<ExcludeArrayProps<TokenBalanceStructOutput>>;
5
5
  export type ScheduledWithdrawal = BigintifyProps<ExcludeArrayProps<ScheduledWithdrawalStructOutput>>;
6
- export type CreditAccountDataPayload = ExcludeArrayProps<CreditAccountDataStructOutput>;
6
+ export type CreditAccountDataPayload = PartialKeys<ExcludeArrayProps<CreditAccountDataStructOutput>, "accruedInterest" | "accruedFees" | "healthFactor" | "totalValue">;
@@ -2,3 +2,4 @@ import { BigNumber } from "ethers";
2
2
  export type BigintifyProps<T extends {}> = {
3
3
  [K in keyof T]: T[K] extends BigNumber ? bigint : T[K];
4
4
  };
5
+ export type PartialKeys<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.17",
3
+ "version": "3.0.0-next.18",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",