@gearbox-protocol/sdk 3.0.0-next.145 → 3.0.0-next.147

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.
@@ -11,6 +11,7 @@ const CURVE_CHAINS = {
11
11
  Arbitrum: "arbitrum",
12
12
  Mainnet: "ethereum",
13
13
  Optimism: "optimism",
14
+ Base: "base",
14
15
  };
15
16
  // const CRYPTO = "https://api.curve.fi/api/getPools/${CURVE_CHAINS[n]}/crypto";
16
17
  // const FACTORY = "https://api.curve.fi/api/getPools/${CURVE_CHAINS[n]}/factory";
@@ -44,6 +44,7 @@ const NORMAL_TO_LAMA = {
44
44
  cbETH: "0f45d730-b279-4629-8e11-ccb5cc3038b4",
45
45
  sfrxETH: "77020688-e1f9-443c-9388-e51ace15cc32",
46
46
  },
47
+ Base: {},
47
48
  };
48
49
  // const CONVEX_TO_LAMA: Record<
49
50
  // NetworkType,
@@ -3,23 +3,25 @@ export declare const stEthPoolWrapper: Record<NetworkType, string>;
3
3
  type MainnetCreditManagersV1 = "DAI_V1" | "USDC_V1" | "WETH_V1" | "WBTC_V1";
4
4
  type MainnetCreditManagersV2 = "DAI_V2" | "USDC_V2" | "WETH_V2" | "WSTETH_V2" | "WBTC_V2" | "FRAX_V2";
5
5
  type MainnetCreditManagersV2_1 = "WETH_V2_1";
6
- type MainnetCreditManagersV3 = "USDC_V3_TRADE_TIER_1" | "USDC_V3_TRADE_TIER_2" | "USDC_V3_TRADE_TIER_3" | "WBTC_V3_TRADE_TIER_1" | "WBTC_V3_TRADE_TIER_2" | "WBTC_V3_TRADE_TIER_3" | "WETH_V3_TRADE_TIER_1" | "WETH_V3_TRADE_TIER_2" | "WETH_V3_TRADE_TIER_3" | "USDC_V3_FARM" | "WETH_V3_FARM" | "WETH_V3_RESTAKING";
6
+ type MainnetCreditManagersV3 = "USDC_V3_TRADE_TIER_1" | "USDC_V3_TRADE_TIER_2" | "USDC_V3_TRADE_TIER_3" | "WBTC_V3_TRADE_TIER_1" | "WBTC_V3_TRADE_TIER_2" | "WBTC_V3_TRADE_TIER_3" | "WETH_V3_TRADE_TIER_1" | "WETH_V3_TRADE_TIER_2" | "WETH_V3_TRADE_TIER_3" | "USDC_V3_FARM" | "WETH_V3_FARM" | "WETH_V3_RESTAKING" | "USDT_V3_TIER_1" | "GHO_V3_TIER_1" | "DAI_V3_TIER_1";
7
7
  export type MainnetCreditManagers = MainnetCreditManagersV1 | MainnetCreditManagersV2 | MainnetCreditManagersV2_1 | MainnetCreditManagersV3;
8
8
  export type ArbitrumCreditManagers = "USDC_E_V3_TRADE_TIER_1" | "USDC_E_V3_TRADE_TIER_2" | "WETH_V3_TRADE_TIER_1" | "WETH_V3_TRADE_TIER_2";
9
9
  export type OptimismCreditManagers = never;
10
+ export type BaseCreditManagers = never;
10
11
  type CreditManagersListType = {
11
- [key in NetworkType]: key extends "Mainnet" ? Record<MainnetCreditManagers, string> : key extends "Arbitrum" ? Record<ArbitrumCreditManagers, string> : key extends "Optimism" ? Record<OptimismCreditManagers, string> : never;
12
+ [key in NetworkType]: key extends "Mainnet" ? Record<MainnetCreditManagers, string> : key extends "Arbitrum" ? Record<ArbitrumCreditManagers, string> : key extends "Optimism" ? Record<OptimismCreditManagers, string> : key extends "Base" ? Record<BaseCreditManagers, string> : never;
12
13
  };
13
14
  export declare const creditManagerByNetwork: CreditManagersListType;
14
15
  export type SupportedCreditManagers = MainnetCreditManagers | ArbitrumCreditManagers;
15
16
  export declare const creditManagerByAddress: Record<string, SupportedCreditManagers>;
16
17
  export type MainnetPoolsV1 = "DAI_V1" | "USDC_V1" | "WETH_V1" | "WBTC_V1" | "WSTETH_V1" | "FRAX_V1";
17
- export type MainnetPoolsV3 = "USDC_V3_TRADE" | "WETH_V3_TRADE" | "WBTC_V3_TRADE";
18
+ export type MainnetPoolsV3 = "USDC_V3_TRADE" | "WETH_V3_TRADE" | "WBTC_V3_TRADE" | "USDT_V3" | "GHO_V3" | "DAI_V3";
18
19
  export type MainnetPools = MainnetPoolsV1 | MainnetPoolsV3;
19
20
  export type ArbitrumPools = "USDC_V3" | "WETH_V3";
20
21
  export type OptimismPools = never;
22
+ export type BasePools = never;
21
23
  type PoolsListType = {
22
- [key in NetworkType]: key extends "Mainnet" ? Record<MainnetPools, string> : key extends "Arbitrum" ? Record<ArbitrumPools, string> : key extends "Optimism" ? Record<OptimismPools, string> : never;
24
+ [key in NetworkType]: key extends "Mainnet" ? Record<MainnetPools, string> : key extends "Arbitrum" ? Record<ArbitrumPools, string> : key extends "Optimism" ? Record<OptimismPools, string> : key extends "Base" ? Record<BasePools, string> : never;
23
25
  };
24
26
  export declare const poolByNetwork: PoolsListType;
25
27
  export type SupportedPools = MainnetPools | ArbitrumPools;
@@ -6,6 +6,7 @@ exports.stEthPoolWrapper = {
6
6
  Mainnet: "0x5a97e3E43dCBFe620ccF7865739075f92E93F5E4",
7
7
  Arbitrum: "0x3fe62a62C022A069952069b32C9d56718D30B7ec",
8
8
  Optimism: "",
9
+ Base: "",
9
10
  };
10
11
  exports.creditManagerByNetwork = {
11
12
  Mainnet: {
@@ -32,6 +33,9 @@ exports.creditManagerByNetwork = {
32
33
  USDC_V3_FARM: "0x1d489ccd2b96908c0a80acbbdb2f1963ffed3384".toLowerCase(),
33
34
  WETH_V3_FARM: "0x6dc0eb1980fa6b3fa89f5b29937b9baab5865b3e".toLowerCase(),
34
35
  WETH_V3_RESTAKING: "0x50ba483272484fc5eebe8676dc87d814a11faef6".toLowerCase(),
36
+ USDT_V3_TIER_1: "0x6950f4190aa1e1339519d5d4d89796ae4165cd5c".toLowerCase(),
37
+ GHO_V3_TIER_1: "0x58c8e983d9479b69b64970f79e8965ea347189c9".toLowerCase(),
38
+ DAI_V3_TIER_1: "0x4582411643f9bbe6c736ed2114eda856b1c9ed40".toLowerCase(),
35
39
  },
36
40
  Arbitrum: {
37
41
  USDC_E_V3_TRADE_TIER_1: "0x75bc0fef1c93723be3d73b2000b5ba139a0c680c".toLowerCase(),
@@ -40,6 +44,7 @@ exports.creditManagerByNetwork = {
40
44
  WETH_V3_TRADE_TIER_2: "0x3ab1d35500d2da4216f5863229a7b81e2f6ff976".toLowerCase(),
41
45
  },
42
46
  Optimism: {},
47
+ Base: {},
43
48
  };
44
49
  exports.creditManagerByAddress = sdk_gov_1.TypedObjectUtils.entries(exports.creditManagerByNetwork).reduce((acc, [, cms]) => ({
45
50
  ...acc,
@@ -58,12 +63,16 @@ exports.poolByNetwork = {
58
63
  USDC_V3_TRADE: "0xda00000035fef4082f78def6a8903bee419fbf8e".toLowerCase(),
59
64
  WBTC_V3_TRADE: "0xda00010eda646913f273e10e7a5d1f659242757d".toLowerCase(),
60
65
  WETH_V3_TRADE: "0xda0002859b2d05f66a753d8241fcde8623f26f4f".toLowerCase(),
66
+ USDT_V3: "0x1dc0f3359a254f876b37906cfc1000a35ce2d717".toLowerCase(),
67
+ GHO_V3: "0x4d56c9cba373ad39df69eb18f076b7348000ae09".toLowerCase(),
68
+ DAI_V3: "0xe7146f53dbcae9d6fa3555fe502648deb0b2f823".toLowerCase(),
61
69
  },
62
70
  Arbitrum: {
63
71
  USDC_V3: "0xa76c604145d7394dec36c49af494c144ff327861".toLowerCase(),
64
72
  WETH_V3: "0x04419d3509f13054f60d253e0c79491d9e683399".toLowerCase(),
65
73
  },
66
74
  Optimism: {},
75
+ Base: {},
67
76
  };
68
77
  const deployedContractNames = {
69
78
  // MAINNET V1 CM
@@ -84,6 +84,7 @@ export declare class ChartsCreditManagerData {
84
84
  readonly totalBorrowed: bigint;
85
85
  readonly totalBorrowedOld: bigint;
86
86
  readonly totalBorrowedChange: number;
87
+ readonly totalDebtLimit: bigint;
87
88
  readonly totalRepaid: bigint;
88
89
  readonly totalProfit: bigint;
89
90
  readonly totalProfitOld: bigint;
@@ -267,6 +267,7 @@ class ChartsCreditManagerData {
267
267
  totalBorrowed;
268
268
  totalBorrowedOld;
269
269
  totalBorrowedChange;
270
+ totalDebtLimit;
270
271
  totalRepaid;
271
272
  totalProfit;
272
273
  totalProfitOld;
@@ -316,6 +317,7 @@ class ChartsCreditManagerData {
316
317
  this.totalBorrowedOld = (0, sdk_gov_1.toBigInt)(payload.totalBorrowedBIOld || 0);
317
318
  this.totalBorrowedInUSD = payload.totalBorrowedInUSD || 0;
318
319
  this.totalBorrowedChange = Number((0, sdk_gov_1.toBigInt)(payload.totalBorrowedBI10kBasis || 0) * sdk_gov_1.PERCENTAGE_DECIMALS);
320
+ this.totalDebtLimit = (0, sdk_gov_1.toBigInt)(payload.totalDebtLimit || 0);
319
321
  this.totalLosses = (0, sdk_gov_1.toBigInt)(payload.totalLosses || 0);
320
322
  this.totalLossesOld = (0, sdk_gov_1.toBigInt)(payload.totalLossesOld || 0);
321
323
  this.totalLossesInUSD = payload.totalLossesInUSD || 0;
@@ -1,5 +1,16 @@
1
1
  import { CreditSessionFilteredPayload, CreditSessionPayload, CreditSessionsAggregatedStatsPayload, SecondaryStatus, UserCreditSessionsAggregatedStatsPayload } from "../payload/creditSession";
2
2
  import { AssetWithView } from "./assets";
3
+ export interface CreditSessionAsset extends AssetWithView {
4
+ ind: number;
5
+ isForbidden: boolean;
6
+ isEnabled: boolean;
7
+ quota: bigint;
8
+ quotaIndexLU: bigint;
9
+ isQuoted: boolean;
10
+ }
11
+ export interface CreditSessionReward extends AssetWithView {
12
+ pool: string;
13
+ }
3
14
  export type CreditSessionStatus = "active" | "closed" | "repaid" | "liquidated" | "liquidateExpired" | "liquidatePaused";
4
15
  export declare const CREDIT_SESSION_STATUS_BY_ID: Record<number, CreditSessionStatus>;
5
16
  export declare const CREDIT_SESSION_ID_BY_STATUS: Record<CreditSessionStatus, number>;
@@ -47,8 +58,8 @@ export declare class CreditSession {
47
58
  readonly spotDebt: bigint;
48
59
  readonly spotTotalValue: bigint;
49
60
  readonly spotUserFunds: bigint;
50
- readonly cvxUnclaimedRewards: Array<AssetWithView>;
51
- readonly balances: Array<AssetWithView>;
61
+ readonly cvxUnclaimedRewards: Array<CreditSessionReward>;
62
+ readonly balances: Array<CreditSessionAsset>;
52
63
  readonly forbiddenTokens: Record<string, true>;
53
64
  readonly disabledTokens: Record<string, true>;
54
65
  readonly teritaryStatus: SecondaryStatus;
@@ -110,11 +110,12 @@ class CreditSession {
110
110
  this.spotDebt = (0, sdk_gov_1.toBigInt)(payload.spotDebt || 0);
111
111
  this.spotTotalValue = (0, sdk_gov_1.toBigInt)(payload.spotTotalValue || 0);
112
112
  this.spotUserFunds = (0, sdk_gov_1.toBigInt)(payload.spotUserFunds || 0);
113
- this.cvxUnclaimedRewards = Object.entries(payload.cvxUnclaimedRewards || {}).map(([token, balance]) => {
113
+ this.cvxUnclaimedRewards = Object.entries(payload.cvxUnclaimedRewards || {}).map(([t, b]) => {
114
114
  return {
115
- token: token.toLowerCase(),
116
- balance: (0, sdk_gov_1.toBigInt)(balance.bi || 0),
117
- balanceView: balance.f.toString(),
115
+ token: t.toLowerCase(),
116
+ balance: (0, sdk_gov_1.toBigInt)(b.bi || 0),
117
+ balanceView: b.f.toString(),
118
+ pool: b.pool.toLowerCase(),
118
119
  };
119
120
  });
120
121
  Object.entries(payload.balances || {}).forEach(([t, b]) => {
@@ -122,13 +123,19 @@ class CreditSession {
122
123
  if (!b.isEnabled) {
123
124
  this.disabledTokens[token] = true;
124
125
  }
125
- if (!b.isAllowed) {
126
+ if (b.isForbidden) {
126
127
  this.forbiddenTokens[token] = true;
127
128
  }
128
129
  this.balances.push({
129
130
  token: token.toLowerCase(),
130
131
  balance: (0, sdk_gov_1.toBigInt)(b.BI || 0),
131
132
  balanceView: b.F.toString(),
133
+ ind: b.ind,
134
+ isEnabled: b.isEnabled,
135
+ isForbidden: b.isForbidden,
136
+ quota: (0, sdk_gov_1.toBigInt)(b.quota || 0),
137
+ quotaIndexLU: (0, sdk_gov_1.toBigInt)(b.quotaIndexLU || 0),
138
+ isQuoted: b.isQuoted || false,
132
139
  });
133
140
  });
134
141
  }
@@ -12,7 +12,7 @@ const CHARTS_BACKEND_ADDRESSES = {
12
12
  [sdk_gov_1.CHAINS.Arbitrum]: "https://arbitrum.gearbox.foundation",
13
13
  [sdk_gov_1.CHAINS.Local]: "https://charts-server.fly.dev",
14
14
  [exports.TESTNET_CHAINS.Mainnet]: "https://testnet.gearbox.foundation",
15
- // !& test server for Optimism
15
+ // !& test server for Optimism and Base
16
16
  [exports.TESTNET_CHAINS.Optimism]: "https://testnet.gearbox.foundation",
17
17
  [exports.TESTNET_CHAINS.Arbitrum]: "https://arbtest.gearbox.foundation",
18
18
  };
@@ -56,4 +56,5 @@ export interface ChartsCreditManagerPayload {
56
56
  totalClosedAccountsChange: number;
57
57
  totalRepaidAccounts: number;
58
58
  liquidityThresholds: Record<string, number>;
59
+ totalDebtLimit: BigNumberish;
59
60
  }
@@ -3,8 +3,11 @@ export interface CreditSessionBalancePayload {
3
3
  BI: string;
4
4
  F: number;
5
5
  ind: number;
6
- isAllowed: boolean;
6
+ isForbidden: boolean;
7
7
  isEnabled: boolean;
8
+ quota?: BigNumberish;
9
+ quotaIndexLU?: BigNumberish;
10
+ isQuoted?: boolean;
8
11
  }
9
12
  interface CreditSessionReward {
10
13
  bi: BigNumberish;
@@ -12,6 +12,7 @@ const NETWROK_DEPENDENT_ALIASES = {
12
12
  dUSDCV3: "dUSDC.eV3",
13
13
  sdUSDCV3: "sdUSDC.eV3",
14
14
  },
15
+ Base: {},
15
16
  };
16
17
  class TokenData {
17
18
  title;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.145",
3
+ "version": "3.0.0-next.147",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "test": "npx mocha -r ts-node/register -r dotenv/config 'src/**/*.spec.ts'"
31
31
  },
32
32
  "dependencies": {
33
- "@gearbox-protocol/sdk-gov": "^1.46.1",
33
+ "@gearbox-protocol/sdk-gov": "^1.49.0",
34
34
  "axios": "^1.2.6",
35
35
  "decimal.js-light": "^2.5.1",
36
36
  "deep-eql": "^4.1.0",