@curvefi/llamalend-api 2.0.6 → 2.0.7

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.
@@ -130,18 +130,19 @@ This document tracks feature support across market versions.
130
130
 
131
131
  ## Stats Module (`market.stats`)
132
132
 
133
- | Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
134
- |--------|----|----|-----------------|----------------------|-----------------------|
135
- | parameters() | ✅ | ✅ | ✅ | ✅ | ✅ |
136
- | rates() | ✅ | ✅ | ✅ | ✅ | ✅ |
137
- | futureRates() | ✅ | ✅ | ✅ | ✅ | ✅ |
138
- | balances() | ✅ | ✅ | ✅ | ✅ | ✅ |
139
- | bandsInfo() | ✅ | ✅ | ✅ | ✅ | ✅ |
140
- | bandBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
141
- | bandsBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
142
- | totalDebt() | ✅ | ✅ | ✅ | ✅ | ✅ |
143
- | ammBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
133
+ | Method | v1 | v2 | Logic Unchanged | Parameters Unchanged | Return Type Unchanged |
134
+ |-------------------|----|----|-----------------|----------------------|-----------------------|
135
+ | parameters() | ✅ | ✅ | ✅ | ✅ | ✅ |
136
+ | rates() | ✅ | ✅ | ✅ | ✅ | ✅ |
137
+ | futureRates() | ✅ | ✅ | ✅ | ✅ | ✅ |
138
+ | balances() | ✅ | ✅ | ✅ | ✅ | ✅ |
139
+ | bandsInfo() | ✅ | ✅ | ✅ | ✅ | ✅ |
140
+ | bandBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
141
+ | bandsBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
142
+ | totalDebt() | ✅ | ✅ | ✅ | ✅ | ✅ |
143
+ | ammBalances() | ✅ | ✅ | ✅ | ✅ | ✅ |
144
144
  | capAndAvailable() | ✅ | ✅ | ❌ | ✅ | ❌ |
145
+ | oracleAddress() | ✅ | ✅ | ✅ | ✅ | ✅ |
145
146
 
146
147
  ### Update for `capAndAvailable` method
147
148
 
@@ -79,6 +79,7 @@ export class LendMarketTemplate {
79
79
  ammBalances: stats.statsAmmBalances.bind(stats),
80
80
  capAndAvailable: stats.statsCapAndAvailable.bind(stats),
81
81
  adminPercentage: stats.statsAdminPercentage.bind(stats),
82
+ oracleAddress: stats.oracleAddress.bind(stats),
82
83
  };
83
84
  this.wallet = {
84
85
  balances: wallet.balances.bind(wallet),
@@ -49,4 +49,5 @@ export interface IStatsV1 {
49
49
  availableForBorrow: string;
50
50
  }>;
51
51
  adminPercentage: () => Promise<string>;
52
+ oracleAddress: () => Promise<string>;
52
53
  }
@@ -49,4 +49,5 @@ export interface IStatsV2 {
49
49
  availableForBorrow: string;
50
50
  }>;
51
51
  adminPercentage: () => Promise<string>;
52
+ oracleAddress: () => Promise<string>;
52
53
  }
@@ -85,4 +85,5 @@ export declare class StatsBaseModule {
85
85
  availableForBorrow: string;
86
86
  }>;
87
87
  statsAdminPercentage: () => Promise<string>;
88
+ oracleAddress: (() => Promise<string>) & memoize.Memoized<() => Promise<string>>;
88
89
  }
@@ -122,6 +122,11 @@ export class StatsBaseModule {
122
122
  const _adminPercentage = yield this._fetchAdminPercentage();
123
123
  return formatUnits(_adminPercentage * BigInt(100));
124
124
  });
125
+ this.oracleAddress = memoize(() => __awaiter(this, void 0, void 0, function* () {
126
+ return yield this.llamalend.contracts[this.market.addresses.amm].contract.price_oracle_contract(this.llamalend.constantOptions);
127
+ }), {
128
+ promise: true,
129
+ });
125
130
  this.market = market;
126
131
  this.llamalend = market.getLlamalend();
127
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/llamalend-api",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "JavaScript library for Curve Lending",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",
@@ -177,6 +177,7 @@ export class LendMarketTemplate<V extends 'v1' | 'v2' = 'v1' | 'v2'> {
177
177
  ammBalances: stats.statsAmmBalances.bind(stats),
178
178
  capAndAvailable: stats.statsCapAndAvailable.bind(stats),
179
179
  adminPercentage: stats.statsAdminPercentage.bind(stats),
180
+ oracleAddress: stats.oracleAddress.bind(stats),
180
181
  } as StatsForVersion<V>
181
182
 
182
183
  this.wallet = {
@@ -19,4 +19,5 @@ export interface IStatsV1 {
19
19
  ammBalances: (isGetter?: boolean, useAPI?: boolean) => Promise<{ borrowed: string, collateral: string }>,
20
20
  capAndAvailable: (isGetter?: boolean, useAPI?: boolean) => Promise<{ borrowCap: string, available: string, totalAssets: string, availableForBorrow: string }>,
21
21
  adminPercentage: () => Promise<string>,
22
+ oracleAddress: () => Promise<string>,
22
23
  }
@@ -19,4 +19,5 @@ export interface IStatsV2 {
19
19
  ammBalances: (isGetter?: boolean, useAPI?: boolean) => Promise<{ borrowed: string, collateral: string }>,
20
20
  capAndAvailable: (isGetter?: boolean, useAPI?: boolean) => Promise<{ borrowCap: string, available: string, totalAssets: string, availableForBorrow: string }>,
21
21
  adminPercentage: () => Promise<string>,
22
+ oracleAddress: () => Promise<string>,
22
23
  }
@@ -311,4 +311,10 @@ export class StatsBaseModule {
311
311
  const _adminPercentage = await this._fetchAdminPercentage();
312
312
  return formatUnits(_adminPercentage * BigInt(100));
313
313
  }
314
+
315
+ public oracleAddress = memoize(async (): Promise<string> => {
316
+ return await this.llamalend.contracts[this.market.addresses.amm].contract.price_oracle_contract(this.llamalend.constantOptions) as string;
317
+ },{
318
+ promise: true,
319
+ });
314
320
  }