@curvefi/llamalend-api 1.1.9 → 1.1.12

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.
@@ -3,6 +3,7 @@ name: Release & Publish
3
3
  on:
4
4
  push:
5
5
  branches:
6
+ - v1
6
7
  - main
7
8
 
8
9
  jobs:
@@ -50,4 +51,9 @@ jobs:
50
51
  cache: npm
51
52
  - run: npm ci
52
53
  - run: npm run build
53
- - run: npm publish
54
+ - name: Publish main as latest
55
+ if: github.ref_name == 'main'
56
+ run: npm publish --tag latest
57
+ - name: Publish v1 branch as legacy
58
+ if: github.ref_name == 'v1'
59
+ run: npm publish --tag legacy
@@ -322,6 +322,7 @@ export declare class LendMarketTemplate {
322
322
  A: (() => Promise<string>) & memoize.Memoized<() => Promise<string>>;
323
323
  basePrice: (() => Promise<string>) & memoize.Memoized<() => Promise<string>>;
324
324
  oraclePrice: (() => Promise<string>) & memoize.Memoized<() => Promise<string>>;
325
+ oracleAddress: (() => Promise<string>) & memoize.Memoized<() => Promise<string>>;
325
326
  oraclePriceBand(): Promise<number>;
326
327
  price(): Promise<string>;
327
328
  calcTickPrice(n: number): Promise<string>;
@@ -270,6 +270,12 @@ export class LendMarketTemplate {
270
270
  promise: true,
271
271
  maxAge: 60 * 1000, // 1m
272
272
  });
273
+ this.oracleAddress = memoize(() => __awaiter(this, void 0, void 0, function* () {
274
+ const _address = yield this.llamalend.contracts[this.addresses.amm].contract.price_oracle_contract(this.llamalend.constantOptions);
275
+ return _address;
276
+ }), {
277
+ promise: true,
278
+ });
273
279
  this._userState = memoize((...args_1) => __awaiter(this, [...args_1], void 0, function* (address = "") {
274
280
  address = _getAddress.call(this.llamalend, address);
275
281
  const contract = this.llamalend.contracts[this.addresses.controller].contract;
@@ -187,6 +187,7 @@ export declare class MintMarketTemplate {
187
187
  stablecoin: string;
188
188
  collateral: string;
189
189
  }>>;
190
+ oracleAddress: (() => Promise<string>) & memoize.Memoized<() => Promise<string>>;
190
191
  oraclePrice(): Promise<string>;
191
192
  oraclePriceBand(): Promise<number>;
192
193
  price(): Promise<string>;
@@ -106,6 +106,12 @@ export class MintMarketTemplate {
106
106
  promise: true,
107
107
  maxAge: 60 * 1000, // 1m
108
108
  });
109
+ this.oracleAddress = memoize(() => __awaiter(this, void 0, void 0, function* () {
110
+ const _address = yield this.llamalend.contracts[this.address].contract.price_oracle_contract(this.llamalend.constantOptions);
111
+ return _address;
112
+ }), {
113
+ promise: true,
114
+ });
109
115
  this.basePrice = memoize(() => __awaiter(this, void 0, void 0, function* () {
110
116
  const _price = yield this.llamalend.contracts[this.address].contract.get_base_price(this.llamalend.constantOptions);
111
117
  return formatUnits(_price);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/llamalend-api",
3
- "version": "1.1.9",
3
+ "version": "1.1.12",
4
4
  "description": "JavaScript library for Curve Lending",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",
@@ -1286,6 +1286,14 @@ export class LendMarketTemplate {
1286
1286
  maxAge: 60 * 1000, // 1m
1287
1287
  });
1288
1288
 
1289
+ public oracleAddress = memoize(async (): Promise<string> => {
1290
+ const _address = await this.llamalend.contracts[this.addresses.amm].contract.price_oracle_contract(this.llamalend.constantOptions) as string;
1291
+ return _address;
1292
+ },
1293
+ {
1294
+ promise: true,
1295
+ });
1296
+
1289
1297
  public async oraclePriceBand(): Promise<number> {
1290
1298
  const oraclePriceBN = BN(await this.oraclePrice());
1291
1299
  const basePriceBN = BN(await this.basePrice());
@@ -592,6 +592,14 @@ export class MintMarketTemplate {
592
592
  return res
593
593
  }
594
594
 
595
+ public oracleAddress = memoize(async (): Promise<string> => {
596
+ const _address = await this.llamalend.contracts[this.address].contract.price_oracle_contract(this.llamalend.constantOptions) as string;
597
+ return _address;
598
+ },
599
+ {
600
+ promise: true,
601
+ });
602
+
595
603
  public async oraclePrice(): Promise<string> {
596
604
  const _price = await this.llamalend.contracts[this.address].contract.price_oracle(this.llamalend.constantOptions) as bigint;
597
605
  return formatUnits(_price);