@curvefi/llamalend-api 1.0.12 → 1.0.14

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/README.md CHANGED
@@ -885,7 +885,7 @@ import llamalend from "@curvefi/llamalend-api";
885
885
  // {
886
886
  // address: '0x498bf2b1e120fed3ad3d42ea2165e9b73f99c1e5',
887
887
  // decimals: 18,
888
- // name: 'Curve.Fi USD Stablecoin',
888
+ // name: 'curve.finance USD Stablecoin',
889
889
  // symbol: 'crvUSD'
890
890
  // }
891
891
  console.log(await lendMarket.wallet.balances());
@@ -11,7 +11,7 @@ import { ethers } from "ethers";
11
11
  import memoize from "memoizee";
12
12
  import { llamalend } from "./llamalend.js";
13
13
  const _getPoolsFromApi = memoize((network, poolFactory) => __awaiter(void 0, void 0, void 0, function* () {
14
- const response = yield fetch(`https://api.curve.fi/api/getPools/${network}/${poolFactory}`);
14
+ const response = yield fetch(`https://api.curve.finance/api/getPools/${network}/${poolFactory}`);
15
15
  const { data } = yield response.json();
16
16
  return data !== null && data !== void 0 ? data : { poolData: [], tvl: 0, tvlAll: 0 };
17
17
  }), {
@@ -108,7 +108,7 @@ export const _getUsdPricesFromApi = () => __awaiter(void 0, void 0, void 0, func
108
108
  return priceDictByMaxTvl;
109
109
  });
110
110
  export const _getUserCollateral = memoize((network, controller, user) => __awaiter(void 0, void 0, void 0, function* () {
111
- const url = `https://prices.curve.fi/v1/lending/collateral_events/${network}/${controller}/${user}`;
111
+ const url = `https://prices.curve.finance/v1/lending/collateral_events/${network}/${controller}/${user}`;
112
112
  const response = yield fetch(url);
113
113
  const data = yield response.json();
114
114
  return {
@@ -121,7 +121,7 @@ export const _getUserCollateral = memoize((network, controller, user) => __await
121
121
  maxAge: 60 * 1000, // 1m
122
122
  });
123
123
  export const _getUserCollateralCrvUsd = memoize((network, controller, user) => __awaiter(void 0, void 0, void 0, function* () {
124
- const url = `https://prices.curve.fi/v1/crvusd/collateral_events/${network}/${controller}/${user}`;
124
+ const url = `https://prices.curve.finance/v1/crvusd/collateral_events/${network}/${controller}/${user}`;
125
125
  const response = yield fetch(url);
126
126
  const { total_deposit } = yield response.json();
127
127
  return total_deposit;
@@ -130,7 +130,7 @@ export const _getUserCollateralCrvUsd = memoize((network, controller, user) => _
130
130
  maxAge: 60 * 1000, // 1m
131
131
  });
132
132
  export const _getMarketsData = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
133
- const url = `https://api.curve.fi/api/getLendingVaults/${network}/oneway`;
133
+ const url = `https://api.curve.finance/api/getLendingVaults/${network}/oneway`;
134
134
  const response = yield fetch(url, { headers: { "accept": "application/json" } });
135
135
  if (response.status !== 200) {
136
136
  throw Error(`Fetch error: ${response.status} ${response.statusText}`);
@@ -148,7 +148,7 @@ export const _getQuoteOdos = (fromToken_1, toToken_1, _amount_1, blacklist_1, pa
148
148
  fromToken = "0x0000000000000000000000000000000000000000";
149
149
  if (ethers.getAddress(toToken) == "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE")
150
150
  toToken = "0x0000000000000000000000000000000000000000";
151
- const url = `https://prices.curve.fi/odos/quote?chain_id=${llamalend.chainId}&from_address=${ethers.getAddress(fromToken)}` +
151
+ const url = `https://prices.curve.finance/odos/quote?chain_id=${llamalend.chainId}&from_address=${ethers.getAddress(fromToken)}` +
152
152
  `&to_address=${ethers.getAddress(toToken)}&amount=${_amount.toString()}&slippage=${slippage}&pathVizImage=${pathVizImage}` +
153
153
  `&caller_address=${ethers.getAddress(llamalend.constants.ALIASES.leverage_zap)}&blacklist=${ethers.getAddress(blacklist)}`;
154
154
  const response = yield fetch(url, { headers: { "accept": "application/json" } });
@@ -162,7 +162,7 @@ export const _getExpectedOdos = (fromToken, toToken, _amount, blacklist) => __aw
162
162
  return (yield _getQuoteOdos(fromToken, toToken, _amount, blacklist, false)).outAmounts[0];
163
163
  });
164
164
  export const _assembleTxOdos = memoize((pathId) => __awaiter(void 0, void 0, void 0, function* () {
165
- const url = `https://prices.curve.fi/odos/assemble?user=${ethers.getAddress(llamalend.constants.ALIASES.leverage_zap)}&path_id=${pathId}`;
165
+ const url = `https://prices.curve.finance/odos/assemble?user=${ethers.getAddress(llamalend.constants.ALIASES.leverage_zap)}&path_id=${pathId}`;
166
166
  const response = yield fetch(url, { headers: { 'Content-Type': 'application/json' } });
167
167
  if (response.status !== 200) {
168
168
  throw Error(`Odos assemble error - ${response.status} ${response.statusText}`);
package/lib/llamalend.js CHANGED
@@ -276,7 +276,7 @@ class Llamalend {
276
276
  COIN_DATA[gauges[index]] = {
277
277
  address: gauges[index],
278
278
  decimals: 18,
279
- name: "Curve.fi " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
279
+ name: "curve.finance " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
280
280
  symbol: "cv" + COIN_DATA[borrowed_tokens[index]].symbol + "-gauge",
281
281
  };
282
282
  this.constants.DECIMALS[vaults[index]] = 18;
@@ -321,7 +321,7 @@ class Llamalend {
321
321
  COIN_DATA[gauges[index]] = {
322
322
  address: gauges[index],
323
323
  decimals: 18,
324
- name: "Curve.fi " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
324
+ name: "curve.finance " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
325
325
  symbol: "cv" + COIN_DATA[borrowed_tokens[index]].symbol + "-gauge",
326
326
  };
327
327
  this.constants.DECIMALS[vaults[index]] = 18;
@@ -580,7 +580,6 @@ class Llamalend {
580
580
  else {
581
581
  this.setContract(controllers[i], controllerABI);
582
582
  }
583
- this.setContract(controllers[i], controllerABI);
584
583
  const monetary_policy_address = (yield this.contracts[controllers[i]].contract.monetary_policy(this.constantOptions)).toLowerCase();
585
584
  this.setContract(monetary_policy_address, MonetaryPolicy2ABI);
586
585
  const _llammaId = is_eth ? "eth" : collateral_symbol.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/llamalend-api",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "JavaScript library for Curve Lending",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  const _getPoolsFromApi = memoize(
16
16
  async (network: INetworkName, poolFactory: IPoolFactory ): Promise<IExtendedPoolDataFromApi> => {
17
- const response = await fetch(`https://api.curve.fi/api/getPools/${network}/${poolFactory}`);
17
+ const response = await fetch(`https://api.curve.finance/api/getPools/${network}/${poolFactory}`);
18
18
  const { data } = await response.json() as { data?: IExtendedPoolDataFromApi, success: boolean };
19
19
  return data ?? { poolData: [], tvl: 0, tvlAll: 0 };
20
20
  },
@@ -118,7 +118,7 @@ export const _getUsdPricesFromApi = async (): Promise<IDict<number>> => {
118
118
  type UserCollateral = { total_deposit_precise: string, total_deposit_from_user: number, total_deposit_usd_value: number }
119
119
  export const _getUserCollateral = memoize(
120
120
  async (network: INetworkName, controller: string, user: string): Promise<UserCollateral> => {
121
- const url = `https://prices.curve.fi/v1/lending/collateral_events/${network}/${controller}/${user}`;
121
+ const url = `https://prices.curve.finance/v1/lending/collateral_events/${network}/${controller}/${user}`;
122
122
  const response = await fetch(url);
123
123
  const data = await response.json() as UserCollateral;
124
124
  return {
@@ -135,7 +135,7 @@ export const _getUserCollateral = memoize(
135
135
 
136
136
  export const _getUserCollateralCrvUsd = memoize(
137
137
  async (network: INetworkName, controller: string, user: string): Promise<string> => {
138
- const url = `https://prices.curve.fi/v1/crvusd/collateral_events/${network}/${controller}/${user}`;
138
+ const url = `https://prices.curve.finance/v1/crvusd/collateral_events/${network}/${controller}/${user}`;
139
139
  const response = await fetch(url);
140
140
  const { total_deposit } = await response.json() as { total_deposit: string };
141
141
  return total_deposit;
@@ -148,7 +148,7 @@ export const _getUserCollateralCrvUsd = memoize(
148
148
 
149
149
  export const _getMarketsData = memoize(
150
150
  async (network: INetworkName): Promise<IMarketData> => {
151
- const url = `https://api.curve.fi/api/getLendingVaults/${network}/oneway`;
151
+ const url = `https://api.curve.finance/api/getLendingVaults/${network}/oneway`;
152
152
  const response = await fetch(url, { headers: {"accept": "application/json"} });
153
153
  if (response.status !== 200) {
154
154
  throw Error(`Fetch error: ${response.status} ${response.statusText}`);
@@ -170,7 +170,7 @@ export const _getQuoteOdos = async (fromToken: string, toToken: string, _amount:
170
170
  if (ethers.getAddress(fromToken) == "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE") fromToken = "0x0000000000000000000000000000000000000000";
171
171
  if (ethers.getAddress(toToken) == "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE") toToken = "0x0000000000000000000000000000000000000000";
172
172
 
173
- const url = `https://prices.curve.fi/odos/quote?chain_id=${llamalend.chainId}&from_address=${ethers.getAddress(fromToken)}` +
173
+ const url = `https://prices.curve.finance/odos/quote?chain_id=${llamalend.chainId}&from_address=${ethers.getAddress(fromToken)}` +
174
174
  `&to_address=${ethers.getAddress(toToken)}&amount=${_amount.toString()}&slippage=${slippage}&pathVizImage=${pathVizImage}` +
175
175
  `&caller_address=${ethers.getAddress(llamalend.constants.ALIASES.leverage_zap)}&blacklist=${ethers.getAddress(blacklist)}`;
176
176
 
@@ -188,7 +188,7 @@ export const _getExpectedOdos = async (fromToken: string, toToken: string, _amou
188
188
 
189
189
  export const _assembleTxOdos = memoize(
190
190
  async (pathId: string): Promise<string> => {
191
- const url = `https://prices.curve.fi/odos/assemble?user=${ethers.getAddress(llamalend.constants.ALIASES.leverage_zap)}&path_id=${pathId}`;
191
+ const url = `https://prices.curve.finance/odos/assemble?user=${ethers.getAddress(llamalend.constants.ALIASES.leverage_zap)}&path_id=${pathId}`;
192
192
 
193
193
  const response = await fetch(url, { headers: {'Content-Type': 'application/json'} });
194
194
  if (response.status !== 200) {
package/src/llamalend.ts CHANGED
@@ -453,7 +453,6 @@ class Llamalend implements ILlamalend {
453
453
  this.setContract(controllers[i], controllerABI);
454
454
  }
455
455
 
456
- this.setContract(controllers[i], controllerABI);
457
456
  const monetary_policy_address = (await this.contracts[controllers[i]].contract.monetary_policy(this.constantOptions)).toLowerCase();
458
457
  this.setContract(monetary_policy_address, MonetaryPolicy2ABI);
459
458
  const _llammaId: string = is_eth ? "eth" : collateral_symbol.toLowerCase();
@@ -719,7 +718,7 @@ class Llamalend implements ILlamalend {
719
718
  COIN_DATA[gauges[index]] = {
720
719
  address: gauges[index],
721
720
  decimals: 18,
722
- name: "Curve.fi " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
721
+ name: "curve.finance " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
723
722
  symbol: "cv" + COIN_DATA[borrowed_tokens[index]].symbol + "-gauge",
724
723
  };
725
724
  this.constants.DECIMALS[vaults[index]] = 18;
@@ -767,7 +766,7 @@ class Llamalend implements ILlamalend {
767
766
  COIN_DATA[gauges[index]] = {
768
767
  address: gauges[index],
769
768
  decimals: 18,
770
- name: "Curve.fi " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
769
+ name: "curve.finance " + COIN_DATA[borrowed_tokens[index]].name + " Gauge Deposit",
771
770
  symbol: "cv" + COIN_DATA[borrowed_tokens[index]].symbol + "-gauge",
772
771
  };
773
772
  this.constants.DECIMALS[vaults[index]] = 18;