@curvefi/llamalend-api 1.0.20 → 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.
package/lib/index.js CHANGED
@@ -9,82 +9,87 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { LendMarketTemplate, getLendMarket } from "./lendMarkets/index.js";
11
11
  import { MintMarketTemplate, getMintMarket } from "./mintMarkets/index.js";
12
- import { llamalend as _llamalend } from "./llamalend.js";
12
+ import { Llamalend } from "./llamalend.js";
13
13
  import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL2, getGasInfoForL2, getGasPriceFromL1, totalSupply, getLsdApy, } from "./utils.js";
14
14
  import { convertToAssets, convertToShares, userBalances, totalSupplyAndCrvUSDLocked, maxDeposit, previewDeposit, depositIsApproved, depositAllowance, depositApproveEstimateGas, depositApprove, depositEstimateGas, deposit, maxMint, previewMint, mintIsApproved, mintAllowance, mintApproveEstimateGas, mintApprove, mintEstimateGas, mint, maxWithdraw, previewWithdraw, withdrawEstimateGas, withdraw, maxRedeem, previewRedeem, redeemEstimateGas, redeem, } from "./st-crvUSD.js";
15
- function init(providerType_1, providerSettings_1) {
16
- return __awaiter(this, arguments, void 0, function* (providerType, providerSettings, options = {}) {
17
- yield _llamalend.init(providerType, providerSettings, options);
18
- // @ts-ignore
19
- this.signerAddress = _llamalend.signerAddress;
20
- // @ts-ignore
21
- this.chainId = _llamalend.chainId;
22
- });
23
- }
24
- function setCustomFeeData(customFeeData) {
25
- _llamalend.setCustomFeeData(customFeeData);
26
- }
27
- const llamalend = {
28
- init,
29
- chainId: 0,
30
- signerAddress: '',
31
- LendMarketTemplate,
32
- getLendMarket,
33
- MintMarketTemplate,
34
- getMintMarket,
35
- totalSupply,
36
- getLsdApy,
37
- setCustomFeeData,
38
- getBalances,
39
- getAllowance,
40
- hasAllowance,
41
- ensureAllowance,
42
- getUsdRate,
43
- getGasPriceFromL1,
44
- getGasPriceFromL2,
45
- getGasInfoForL2,
46
- fetchStats: _llamalend.fetchStats,
47
- mintMarkets: {
48
- getMarketList: _llamalend.getMintMarketList,
49
- },
50
- lendMarkets: {
51
- fetchMarkets: _llamalend.fetchLendMarkets,
52
- getMarketList: _llamalend.getLendMarketList,
53
- },
54
- estimateGas: {
55
- ensureAllowance: ensureAllowanceEstimateGas,
56
- },
57
- st_crvUSD: {
58
- convertToAssets,
59
- convertToShares,
60
- userBalances,
61
- totalSupplyAndCrvUSDLocked,
62
- maxDeposit,
63
- previewDeposit,
64
- depositIsApproved,
65
- depositAllowance,
66
- depositApprove,
67
- deposit,
68
- maxMint,
69
- previewMint,
70
- mintIsApproved,
71
- mintAllowance,
72
- mintApprove,
73
- mint,
74
- maxWithdraw,
75
- previewWithdraw,
76
- withdraw,
77
- maxRedeem,
78
- previewRedeem,
79
- redeem,
15
+ export function createLlamalend() {
16
+ const llamalend = new Llamalend();
17
+ return {
18
+ // Init and config
19
+ init(providerType_1, providerSettings_1) {
20
+ return __awaiter(this, arguments, void 0, function* (providerType, providerSettings, options = {}) {
21
+ yield llamalend.init(providerType, providerSettings, options);
22
+ });
23
+ },
24
+ setCustomFeeData(customFeeData) {
25
+ llamalend.setCustomFeeData(customFeeData);
26
+ },
27
+ get chainId() { return llamalend.chainId; },
28
+ get signerAddress() { return llamalend.signerAddress; },
29
+ // Market templates
30
+ LendMarketTemplate,
31
+ MintMarketTemplate,
32
+ // Market constructors
33
+ getLendMarket: getLendMarket.bind(llamalend),
34
+ getMintMarket: getMintMarket.bind(llamalend),
35
+ // Utility functions
36
+ totalSupply: totalSupply.bind(llamalend),
37
+ getLsdApy: getLsdApy.bind(llamalend),
38
+ getBalances: getBalances.bind(llamalend),
39
+ getAllowance: getAllowance.bind(llamalend),
40
+ hasAllowance: hasAllowance.bind(llamalend),
41
+ ensureAllowance: ensureAllowance.bind(llamalend),
42
+ getUsdRate: getUsdRate.bind(llamalend),
43
+ getGasPriceFromL1: getGasPriceFromL1.bind(llamalend),
44
+ getGasPriceFromL2: getGasPriceFromL2.bind(llamalend),
45
+ getGasInfoForL2: getGasInfoForL2.bind(llamalend),
46
+ // Core methods
47
+ fetchStats: llamalend.fetchStats.bind(llamalend),
48
+ // Market lists
49
+ mintMarkets: {
50
+ getMarketList: llamalend.getMintMarketList.bind(llamalend),
51
+ },
52
+ lendMarkets: {
53
+ fetchMarkets: llamalend.fetchLendMarkets.bind(llamalend),
54
+ getMarketList: llamalend.getLendMarketList.bind(llamalend),
55
+ },
56
+ // Gas estimation
80
57
  estimateGas: {
81
- depositApprove: depositApproveEstimateGas,
82
- deposit: depositEstimateGas,
83
- mintApprove: mintApproveEstimateGas,
84
- mint: mintEstimateGas,
85
- withdraw: withdrawEstimateGas,
86
- redeem: redeemEstimateGas,
58
+ ensureAllowance: ensureAllowanceEstimateGas.bind(llamalend),
87
59
  },
88
- },
89
- };
90
- export default llamalend;
60
+ // st-crvUSD methods
61
+ st_crvUSD: {
62
+ convertToAssets: convertToAssets.bind(llamalend),
63
+ convertToShares: convertToShares.bind(llamalend),
64
+ userBalances: userBalances.bind(llamalend),
65
+ totalSupplyAndCrvUSDLocked: totalSupplyAndCrvUSDLocked.bind(llamalend),
66
+ maxDeposit: maxDeposit.bind(llamalend),
67
+ previewDeposit: previewDeposit.bind(llamalend),
68
+ depositIsApproved: depositIsApproved.bind(llamalend),
69
+ depositAllowance: depositAllowance.bind(llamalend),
70
+ depositApprove: depositApprove.bind(llamalend),
71
+ deposit: deposit.bind(llamalend),
72
+ maxMint: maxMint.bind(llamalend),
73
+ previewMint: previewMint.bind(llamalend),
74
+ mintIsApproved: mintIsApproved.bind(llamalend),
75
+ mintAllowance: mintAllowance.bind(llamalend),
76
+ mintApprove: mintApprove.bind(llamalend),
77
+ mint: mint.bind(llamalend),
78
+ maxWithdraw: maxWithdraw.bind(llamalend),
79
+ previewWithdraw: previewWithdraw.bind(llamalend),
80
+ withdraw: withdraw.bind(llamalend),
81
+ maxRedeem: maxRedeem.bind(llamalend),
82
+ previewRedeem: previewRedeem.bind(llamalend),
83
+ redeem: redeem.bind(llamalend),
84
+ estimateGas: {
85
+ depositApprove: depositApproveEstimateGas.bind(llamalend),
86
+ deposit: depositEstimateGas.bind(llamalend),
87
+ mintApprove: mintApproveEstimateGas.bind(llamalend),
88
+ mint: mintEstimateGas.bind(llamalend),
89
+ withdraw: withdrawEstimateGas.bind(llamalend),
90
+ redeem: redeemEstimateGas.bind(llamalend),
91
+ },
92
+ },
93
+ };
94
+ }
95
+ export default createLlamalend();
@@ -1,6 +1,8 @@
1
1
  import memoize from "memoizee";
2
+ import type { Llamalend } from "../llamalend.js";
2
3
  import { IDict, TGas, TAmount, IReward, IQuoteOdos, IOneWayMarket } from "../interfaces.js";
3
4
  export declare class LendMarketTemplate {
5
+ private llamalend;
4
6
  id: string;
5
7
  name: string;
6
8
  addresses: {
@@ -248,7 +250,7 @@ export declare class LendMarketTemplate {
248
250
  repay: (stateCollateral: TAmount, userCollateral: TAmount, userBorrowed: TAmount, slippage?: number) => Promise<number>;
249
251
  };
250
252
  };
251
- constructor(id: string, marketData: IOneWayMarket);
253
+ constructor(id: string, marketData: IOneWayMarket, llamalend: Llamalend);
252
254
  private _getMarketId;
253
255
  private vaultMaxDeposit;
254
256
  private vaultPreviewDeposit;