@curvefi/llamalend-api 1.0.3 → 1.0.6

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
@@ -7,77 +7,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
10
  import { LendMarketTemplate, getLendMarket } from "./lendMarkets/index.js";
38
11
  import { MintMarketTemplate, getMintMarket } from "./mintMarkets/index.js";
39
12
  import { llamalend as _llamalend } from "./llamalend.js";
40
13
  import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL2, getGasInfoForL2, getGasPriceFromL1, totalSupply, getLsdApy, } from "./utils.js";
41
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";
42
- function init(providerType, providerSettings, options) {
43
- if (options === void 0) { options = {}; }
44
- return __awaiter(this, void 0, void 0, function () {
45
- return __generator(this, function (_a) {
46
- switch (_a.label) {
47
- case 0: return [4 /*yield*/, _llamalend.init(providerType, providerSettings, options)];
48
- case 1:
49
- _a.sent();
50
- // @ts-ignore
51
- this.signerAddress = _llamalend.signerAddress;
52
- // @ts-ignore
53
- this.chainId = _llamalend.chainId;
54
- return [2 /*return*/];
55
- }
56
- });
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;
57
22
  });
58
23
  }
59
24
  function setCustomFeeData(customFeeData) {
60
25
  _llamalend.setCustomFeeData(customFeeData);
61
26
  }
62
- var llamalend = {
63
- init: init,
27
+ const llamalend = {
28
+ init,
64
29
  chainId: 0,
65
30
  signerAddress: '',
66
- LendMarketTemplate: LendMarketTemplate,
67
- getLendMarket: getLendMarket,
68
- MintMarketTemplate: MintMarketTemplate,
69
- getMintMarket: getMintMarket,
70
- totalSupply: totalSupply,
71
- getLsdApy: getLsdApy,
72
- setCustomFeeData: setCustomFeeData,
73
- getBalances: getBalances,
74
- getAllowance: getAllowance,
75
- hasAllowance: hasAllowance,
76
- ensureAllowance: ensureAllowance,
77
- getUsdRate: getUsdRate,
78
- getGasPriceFromL1: getGasPriceFromL1,
79
- getGasPriceFromL2: getGasPriceFromL2,
80
- getGasInfoForL2: getGasInfoForL2,
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,
81
46
  fetchStats: _llamalend.fetchStats,
82
47
  getLlammaList: _llamalend.getMintMarketList,
83
48
  lendMarkets: {
@@ -88,28 +53,28 @@ var llamalend = {
88
53
  ensureAllowance: ensureAllowanceEstimateGas,
89
54
  },
90
55
  st_crvUSD: {
91
- convertToAssets: convertToAssets,
92
- convertToShares: convertToShares,
93
- userBalances: userBalances,
94
- totalSupplyAndCrvUSDLocked: totalSupplyAndCrvUSDLocked,
95
- maxDeposit: maxDeposit,
96
- previewDeposit: previewDeposit,
97
- depositIsApproved: depositIsApproved,
98
- depositAllowance: depositAllowance,
99
- depositApprove: depositApprove,
100
- deposit: deposit,
101
- maxMint: maxMint,
102
- previewMint: previewMint,
103
- mintIsApproved: mintIsApproved,
104
- mintAllowance: mintAllowance,
105
- mintApprove: mintApprove,
106
- mint: mint,
107
- maxWithdraw: maxWithdraw,
108
- previewWithdraw: previewWithdraw,
109
- withdraw: withdraw,
110
- maxRedeem: maxRedeem,
111
- previewRedeem: previewRedeem,
112
- redeem: redeem,
56
+ convertToAssets,
57
+ convertToShares,
58
+ userBalances,
59
+ totalSupplyAndCrvUSDLocked,
60
+ maxDeposit,
61
+ previewDeposit,
62
+ depositIsApproved,
63
+ depositAllowance,
64
+ depositApprove,
65
+ deposit,
66
+ maxMint,
67
+ previewMint,
68
+ mintIsApproved,
69
+ mintAllowance,
70
+ mintApprove,
71
+ mint,
72
+ maxWithdraw,
73
+ previewWithdraw,
74
+ withdraw,
75
+ maxRedeem,
76
+ previewRedeem,
77
+ redeem,
113
78
  estimateGas: {
114
79
  depositApprove: depositApproveEstimateGas,
115
80
  deposit: depositEstimateGas,
@@ -3,8 +3,8 @@ import { Contract as MulticallContract, Provider as MulticallProvider } from "@c
3
3
  export interface IDict<T> {
4
4
  [index: string]: T;
5
5
  }
6
- export type INetworkName = "ethereum" | "optimism" | "bsc" | "xdai" | "polygon" | "x-layer" | "fantom" | "fraxtal" | "zksync" | "moonbeam" | "kava" | "mantle" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
7
- export type IChainId = 1 | 10 | 56 | 100 | 137 | 196 | 250 | 252 | 324 | 1284 | 2222 | 5000 | 8453 | 42161 | 42220 | 43114 | 1313161554;
6
+ export type INetworkName = "ethereum" | "optimism" | "bsc" | "xdai" | "polygon" | 'sonic' | "x-layer" | "fantom" | "fraxtal" | "zksync" | "moonbeam" | "kava" | "mantle" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
7
+ export type IChainId = 1 | 10 | 56 | 100 | 137 | 146 | 196 | 250 | 252 | 324 | 1284 | 2222 | 5000 | 8453 | 42161 | 42220 | 43114 | 1313161554;
8
8
  export type IPoolFactory = "main" | "crypto" | "factory" | "factory-crvusd" | "factory-crypto" | "factory-twocrypto" | "factory-tricrypto" | "factory-stable-ng";
9
9
  export interface ICurveContract {
10
10
  contract: Contract;
@@ -125,24 +125,6 @@ export interface IReward {
125
125
  symbol: string;
126
126
  apy: number;
127
127
  }
128
- export type T1inchRouteStep = {
129
- name: string;
130
- part: number;
131
- fromTokenAddress: string;
132
- toTokenAddress: string;
133
- }[];
134
- export interface I1inchRoute {
135
- part: number;
136
- hops: T1inchRouteStep[];
137
- }
138
- export interface I1inchSwapData {
139
- tx: {
140
- data: string;
141
- };
142
- dstAmount: string;
143
- protocols: I1inchRoute[];
144
- slippage: number;
145
- }
146
128
  interface Rates {
147
129
  borrowApr: number;
148
130
  borrowApy: number;