@curvefi/llamalend-api 1.0.21 → 1.0.22-beta.1

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.
@@ -1,2 +1,3 @@
1
1
  import { LendMarketTemplate } from "./LendMarketTemplate.js";
2
- export declare const getLendMarket: (lendMarketId: string) => LendMarketTemplate;
2
+ import type { Llamalend } from "../llamalend.js";
3
+ export declare const getLendMarket: (this: Llamalend, lendMarketId: string) => LendMarketTemplate;
@@ -1,6 +1,5 @@
1
1
  import { LendMarketTemplate } from "./LendMarketTemplate.js";
2
- import { llamalend } from "../llamalend.js";
3
- export const getLendMarket = (lendMarketId) => {
4
- const marketData = llamalend.constants.ONE_WAY_MARKETS[lendMarketId];
5
- return new LendMarketTemplate(lendMarketId, marketData);
2
+ export const getLendMarket = function (lendMarketId) {
3
+ const marketData = this.constants.ONE_WAY_MARKETS[lendMarketId];
4
+ return new LendMarketTemplate(lendMarketId, marketData, this);
6
5
  };
@@ -77,5 +77,4 @@ declare class Llamalend implements ILlamalend {
77
77
  parseUnits(value: string, unit?: string | Numeric): bigint;
78
78
  updateFeeData(): Promise<void>;
79
79
  }
80
- export declare const llamalend: Llamalend;
81
- export {};
80
+ export { Llamalend };
package/lib/llamalend.js CHANGED
@@ -344,12 +344,10 @@ class Llamalend {
344
344
  });
345
345
  this.address = '00000';
346
346
  this.crvUsdAddress = COINS_ETHEREUM.crvusd;
347
- // @ts-ignore
348
347
  this.provider = null;
349
348
  this.signer = null;
350
349
  this.signerAddress = "";
351
350
  this.chainId = 1;
352
- // @ts-ignore
353
351
  this.multicallProvider = null;
354
352
  this.contracts = {};
355
353
  this.feeData = {};
@@ -379,13 +377,10 @@ class Llamalend {
379
377
  return __awaiter(this, arguments, void 0, function* (providerType, providerSettings, options = {} // gasPrice in Gwei
380
378
  ) {
381
379
  var _a;
382
- // @ts-ignore
383
380
  this.provider = null;
384
- // @ts-ignore
385
381
  this.signer = null;
386
382
  this.signerAddress = "";
387
383
  this.chainId = 1;
388
- // @ts-ignore
389
384
  this.multicallProvider = null;
390
385
  this.contracts = {};
391
386
  this.feeData = {};
@@ -610,24 +605,19 @@ class Llamalend {
610
605
  const lendingInstance = this;
611
606
  lendingInstance.setContract(lendingInstance.constants.ALIASES.gas_oracle, gasOracleABI);
612
607
  lendingInstance.setContract(lendingInstance.constants.ALIASES.gas_oracle_blob, gasOracleBlobABI);
613
- // @ts-ignore
614
- if (AbstractProvider.prototype.originalEstimate) {
615
- // @ts-ignore
608
+ if ('originalEstimate' in AbstractProvider.prototype) {
616
609
  AbstractProvider.prototype.estimateGas = AbstractProvider.prototype.originalEstimate;
617
610
  }
618
611
  const originalEstimate = AbstractProvider.prototype.estimateGas;
619
612
  const oldEstimate = function (arg) {
620
613
  return __awaiter(this, void 0, void 0, function* () {
621
- // @ts-ignore
622
614
  const originalEstimateFunc = originalEstimate.bind(this);
623
- const gas = yield originalEstimateFunc(arg);
624
- return gas;
615
+ return yield originalEstimateFunc(arg);
625
616
  });
626
617
  };
627
618
  //Override
628
619
  const newEstimate = function (arg) {
629
620
  return __awaiter(this, void 0, void 0, function* () {
630
- // @ts-ignore
631
621
  const L2EstimateGas = originalEstimate.bind(this);
632
622
  const L1GasUsed = yield lendingInstance.contracts[lendingInstance.constants.ALIASES.gas_oracle_blob].contract.getL1GasUsed(arg.data);
633
623
  const L1Fee = yield lendingInstance.contracts[lendingInstance.constants.ALIASES.gas_oracle_blob].contract.getL1Fee(arg.data);
@@ -636,15 +626,11 @@ class Llamalend {
636
626
  return [L2GasUsed, L1GasUsed];
637
627
  });
638
628
  };
639
- // @ts-ignore
640
629
  AbstractProvider.prototype.estimateGas = newEstimate;
641
- // @ts-ignore
642
630
  AbstractProvider.prototype.originalEstimate = oldEstimate;
643
631
  }
644
632
  else {
645
- // @ts-ignore
646
- if (AbstractProvider.prototype.originalEstimate) {
647
- // @ts-ignore
633
+ if ('originalEstimate' in AbstractProvider.prototype) {
648
634
  AbstractProvider.prototype.estimateGas = AbstractProvider.prototype.originalEstimate;
649
635
  }
650
636
  }
@@ -691,4 +677,4 @@ class Llamalend {
691
677
  });
692
678
  }
693
679
  }
694
- export const llamalend = new Llamalend();
680
+ export { Llamalend };
@@ -1,6 +1,8 @@
1
1
  import memoize from "memoizee";
2
+ import type { Llamalend } from "../llamalend.js";
2
3
  import { IDict, TGas } from "../interfaces";
3
4
  export declare class MintMarketTemplate {
5
+ private llamalend;
4
6
  id: string;
5
7
  address: string;
6
8
  controller: string;
@@ -127,7 +129,7 @@ export declare class MintMarketTemplate {
127
129
  repay: (collateral: number | string, slippage?: number) => Promise<number>;
128
130
  };
129
131
  };
130
- constructor(id: string);
132
+ constructor(id: string, llamalend: Llamalend);
131
133
  private statsParameters;
132
134
  private statsBalances;
133
135
  private statsMaxMinBands;