@curvefi/api 2.4.1 → 2.5.0

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.
Files changed (33) hide show
  1. package/lib/constants/abis/factory-v2/DepositZapFantom.json +164 -0
  2. package/lib/constants/abis/factory-v2/DepositZapMetaUsd2Fantom.json +197 -0
  3. package/lib/constants/abis/factory-v2/MetaUSDGeist.json +932 -0
  4. package/lib/constants/abis/fusdt/swap.json +1221 -0
  5. package/lib/constants/abis/fusdt/zap.json +215 -0
  6. package/lib/constants/abis/gauge_child.json +0 -100
  7. package/lib/constants/abis/gauge_rewards_only.json +649 -0
  8. package/lib/constants/abis/ren-fantom/swap.json +868 -0
  9. package/lib/constants/abis/tricrypto/swapNoZap.json +1250 -0
  10. package/lib/constants/aliases.d.ts +1 -0
  11. package/lib/constants/aliases.js +14 -2
  12. package/lib/constants/coins/fantom.d.ts +7 -0
  13. package/lib/constants/coins/fantom.js +36 -0
  14. package/lib/constants/pools/fantom.d.ts +4 -0
  15. package/lib/constants/pools/fantom.js +191 -0
  16. package/lib/constants/pools/index.d.ts +2 -1
  17. package/lib/constants/pools/index.js +3 -1
  18. package/lib/curve.js +31 -10
  19. package/lib/factory/common.js +19 -0
  20. package/lib/factory/constants.d.ts +11 -2
  21. package/lib/factory/constants.js +58 -3
  22. package/lib/factory/factory-api.js +4 -3
  23. package/lib/factory/factory-crypto.js +14 -10
  24. package/lib/factory/factory.js +3 -0
  25. package/lib/pools/PoolTemplate.d.ts +1 -2
  26. package/lib/pools/PoolTemplate.js +44 -166
  27. package/lib/pools/mixins/depositBonusMixins.js +52 -26
  28. package/lib/pools/mixins/withdrawBonusMixins.d.ts +7 -0
  29. package/lib/pools/mixins/withdrawBonusMixins.js +216 -0
  30. package/lib/pools/poolConstructor.js +20 -2
  31. package/lib/router.js +6 -6
  32. package/lib/utils.js +3 -0
  33. package/package.json +1 -1
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.withdrawOneCoinWrappedCryptoBonusMixin = exports.withdrawOneCoinCryptoBonusMixin = exports.withdrawOneCoinWrappedBonusMixin = exports.withdrawOneCoinBonusMixin = exports.withdrawImbalanceWrappedBonusMixin = exports.withdrawImbalanceBonusMixin = void 0;
40
+ var ethers_1 = require("ethers");
41
+ var curve_1 = require("../../curve");
42
+ var utils_1 = require("../../utils");
43
+ // @ts-ignore
44
+ exports.withdrawImbalanceBonusMixin = {
45
+ withdrawImbalanceBonus: function (amounts) {
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ var totalAmount, lpTokenAmount, balancedAmounts, balancedTotalAmount;
48
+ return __generator(this, function (_a) {
49
+ switch (_a.label) {
50
+ case 0:
51
+ totalAmount = amounts.map(utils_1.checkNumber).map(Number).reduce(function (a, b) { return a + b; });
52
+ return [4 /*yield*/, this.withdrawImbalanceExpected(amounts)];
53
+ case 1:
54
+ lpTokenAmount = _a.sent();
55
+ return [4 /*yield*/, this.withdrawExpected(lpTokenAmount)];
56
+ case 2:
57
+ balancedAmounts = _a.sent();
58
+ balancedTotalAmount = balancedAmounts.map(Number).reduce(function (a, b) { return a + b; });
59
+ return [2 /*return*/, String((totalAmount - balancedTotalAmount) / Math.max(totalAmount, balancedTotalAmount) * 100)];
60
+ }
61
+ });
62
+ });
63
+ },
64
+ };
65
+ // @ts-ignore
66
+ exports.withdrawImbalanceWrappedBonusMixin = {
67
+ withdrawImbalanceWrappedBonus: function (amounts) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var vp, basePoolAddress, _a, _b, _c, prices, totalValue, lpTokenAmount, _d, balancedAmounts, balancedTotalValue;
70
+ return __generator(this, function (_e) {
71
+ switch (_e.label) {
72
+ case 0:
73
+ vp = 1;
74
+ if (!this.isMeta) return [3 /*break*/, 2];
75
+ basePoolAddress = curve_1.curve.constants.POOLS_DATA[this.basePool].swap_address;
76
+ _a = Number;
77
+ _c = (_b = ethers_1.ethers.utils).formatUnits;
78
+ return [4 /*yield*/, curve_1.curve.contracts[basePoolAddress].contract.get_virtual_price(curve_1.curve.constantOptions)];
79
+ case 1:
80
+ vp = _a.apply(void 0, [_c.apply(_b, [_e.sent()])]);
81
+ _e.label = 2;
82
+ case 2:
83
+ prices = this.wrappedCoins.map(function (_, i, arr) { return i === arr.length - 1 ? vp : 1; });
84
+ totalValue = amounts.map(utils_1.checkNumber).map(Number).reduce(function (s, a, i) { return s + (a * prices[i]); }, 0);
85
+ _d = Number;
86
+ return [4 /*yield*/, this.withdrawImbalanceWrappedExpected(amounts)];
87
+ case 3:
88
+ lpTokenAmount = _d.apply(void 0, [_e.sent()]);
89
+ return [4 /*yield*/, this.withdrawWrappedExpected(lpTokenAmount)];
90
+ case 4:
91
+ balancedAmounts = _e.sent();
92
+ balancedTotalValue = balancedAmounts.map(Number).reduce(function (s, a, i) { return s + (a * prices[i]); }, 0);
93
+ return [2 /*return*/, String((totalValue - balancedTotalValue) / Math.max(totalValue, balancedTotalValue) * 100)];
94
+ }
95
+ });
96
+ });
97
+ },
98
+ };
99
+ // @ts-ignore
100
+ exports.withdrawOneCoinBonusMixin = {
101
+ withdrawOneCoinBonus: function (lpTokenAmount, coin) {
102
+ return __awaiter(this, void 0, void 0, function () {
103
+ var totalAmount, _a, balancedAmounts, balancedTotalAmount;
104
+ return __generator(this, function (_b) {
105
+ switch (_b.label) {
106
+ case 0:
107
+ _a = Number;
108
+ return [4 /*yield*/, this.withdrawOneCoinExpected(lpTokenAmount, coin)];
109
+ case 1:
110
+ totalAmount = _a.apply(void 0, [_b.sent()]);
111
+ return [4 /*yield*/, this.withdrawExpected(lpTokenAmount)];
112
+ case 2:
113
+ balancedAmounts = _b.sent();
114
+ balancedTotalAmount = balancedAmounts.map(Number).reduce(function (a, b) { return a + b; });
115
+ return [2 /*return*/, String((totalAmount - balancedTotalAmount) / Math.max(totalAmount, balancedTotalAmount) * 100)];
116
+ }
117
+ });
118
+ });
119
+ },
120
+ };
121
+ // @ts-ignore
122
+ exports.withdrawOneCoinWrappedBonusMixin = {
123
+ withdrawOneCoinWrappedBonus: function (lpTokenAmount, coin) {
124
+ return __awaiter(this, void 0, void 0, function () {
125
+ var vp, basePoolAddress, _a, _b, _c, prices, coinAmount, _d, totalValue, balancedAmounts, balancedTotalValue;
126
+ return __generator(this, function (_e) {
127
+ switch (_e.label) {
128
+ case 0:
129
+ vp = 1;
130
+ if (!this.isMeta) return [3 /*break*/, 2];
131
+ basePoolAddress = curve_1.curve.constants.POOLS_DATA[this.basePool].swap_address;
132
+ _a = Number;
133
+ _c = (_b = ethers_1.ethers.utils).formatUnits;
134
+ return [4 /*yield*/, curve_1.curve.contracts[basePoolAddress].contract.get_virtual_price(curve_1.curve.constantOptions)];
135
+ case 1:
136
+ vp = _a.apply(void 0, [_c.apply(_b, [_e.sent()])]);
137
+ _e.label = 2;
138
+ case 2:
139
+ prices = this.wrappedCoins.map(function (_, i, arr) { return i === arr.length - 1 ? vp : 1; });
140
+ _d = Number;
141
+ return [4 /*yield*/, this.withdrawOneCoinWrappedExpected(lpTokenAmount, coin)];
142
+ case 3:
143
+ coinAmount = _d.apply(void 0, [_e.sent()]);
144
+ totalValue = coinAmount * prices[this._getCoinIdx(coin)];
145
+ return [4 /*yield*/, this.withdrawWrappedExpected(lpTokenAmount)];
146
+ case 4:
147
+ balancedAmounts = _e.sent();
148
+ balancedTotalValue = balancedAmounts.map(Number).reduce(function (s, a, i) { return s + (a * prices[i]); }, 0);
149
+ return [2 /*return*/, String((totalValue - balancedTotalValue) / Math.max(totalValue, balancedTotalValue) * 100)];
150
+ }
151
+ });
152
+ });
153
+ },
154
+ };
155
+ // @ts-ignore
156
+ exports.withdrawOneCoinCryptoBonusMixin = {
157
+ withdrawOneCoinBonus: function (lpTokenAmount, coin) {
158
+ return __awaiter(this, void 0, void 0, function () {
159
+ var prices, coinPrice, totalAmount, _a, totalAmountUSD, balancedAmounts, balancedTotalAmountsUSD;
160
+ return __generator(this, function (_b) {
161
+ switch (_b.label) {
162
+ case 0: return [4 /*yield*/, this._underlyingPrices()];
163
+ case 1:
164
+ prices = _b.sent();
165
+ coinPrice = prices[this._getCoinIdx(coin)];
166
+ _a = Number;
167
+ return [4 /*yield*/, this.withdrawOneCoinExpected(lpTokenAmount, coin)];
168
+ case 2:
169
+ totalAmount = _a.apply(void 0, [_b.sent()]);
170
+ totalAmountUSD = totalAmount * coinPrice;
171
+ return [4 /*yield*/, this.withdrawExpected(lpTokenAmount)];
172
+ case 3:
173
+ balancedAmounts = _b.sent();
174
+ balancedTotalAmountsUSD = balancedAmounts.reduce(function (s, b, i) { return s + (Number(b) * prices[i]); }, 0);
175
+ return [2 /*return*/, String((totalAmountUSD - balancedTotalAmountsUSD) / Math.max(totalAmountUSD, balancedTotalAmountsUSD) * 100)];
176
+ }
177
+ });
178
+ });
179
+ },
180
+ };
181
+ // @ts-ignore
182
+ exports.withdrawOneCoinWrappedCryptoBonusMixin = {
183
+ withdrawOneCoinWrappedBonus: function (lpTokenAmount, coin) {
184
+ return __awaiter(this, void 0, void 0, function () {
185
+ var vp, basePoolAddress, _a, _b, _c, prices, coinPrice, totalAmount, _d, totalAmountUSD, balancedAmounts, balancedTotalAmountsUSD;
186
+ return __generator(this, function (_e) {
187
+ switch (_e.label) {
188
+ case 0:
189
+ vp = 1;
190
+ if (!this.isMeta) return [3 /*break*/, 2];
191
+ basePoolAddress = curve_1.curve.constants.POOLS_DATA[this.basePool].swap_address;
192
+ _a = Number;
193
+ _c = (_b = ethers_1.ethers.utils).formatUnits;
194
+ return [4 /*yield*/, curve_1.curve.contracts[basePoolAddress].contract.get_virtual_price(curve_1.curve.constantOptions)];
195
+ case 1:
196
+ vp = _a.apply(void 0, [_c.apply(_b, [_e.sent()])]);
197
+ _e.label = 2;
198
+ case 2: return [4 /*yield*/, this._wrappedPrices()];
199
+ case 3:
200
+ prices = (_e.sent()).map(function (p, i) { return i === prices.length - 1 ? p * vp : p; });
201
+ coinPrice = prices[this._getCoinIdx(coin)];
202
+ _d = Number;
203
+ return [4 /*yield*/, this.withdrawOneCoinWrappedExpected(lpTokenAmount, coin)];
204
+ case 4:
205
+ totalAmount = _d.apply(void 0, [_e.sent()]);
206
+ totalAmountUSD = totalAmount * coinPrice;
207
+ return [4 /*yield*/, this.withdrawWrappedExpected(lpTokenAmount)];
208
+ case 5:
209
+ balancedAmounts = _e.sent();
210
+ balancedTotalAmountsUSD = balancedAmounts.reduce(function (s, b, i) { return s + (Number(b) * prices[i]); }, 0);
211
+ return [2 /*return*/, String((totalAmountUSD - balancedTotalAmountsUSD) / Math.max(totalAmountUSD, balancedTotalAmountsUSD) * 100)];
212
+ }
213
+ });
214
+ });
215
+ },
216
+ };
@@ -16,7 +16,6 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.getPool = void 0;
19
- var curve_1 = require("../curve");
20
19
  var PoolTemplate_1 = require("./PoolTemplate");
21
20
  var poolBalancesMixin_1 = require("./mixins/poolBalancesMixin");
22
21
  var depositBalancedAmountsMixins_1 = require("./mixins/depositBalancedAmountsMixins");
@@ -26,6 +25,7 @@ var depositWrappedMixins_1 = require("./mixins/depositWrappedMixins");
26
25
  var withdrawExpectedMixins_1 = require("./mixins/withdrawExpectedMixins");
27
26
  var withdrawMixins_1 = require("./mixins/withdrawMixins");
28
27
  var withdrawWrappedMixins_1 = require("./mixins/withdrawWrappedMixins");
28
+ var withdrawBonusMixins_1 = require("./mixins/withdrawBonusMixins");
29
29
  var withdrawImbalanceMixins_1 = require("./mixins/withdrawImbalanceMixins");
30
30
  var withdrawImbalanceWrappedMixins_1 = require("./mixins/withdrawImbalanceWrappedMixins");
31
31
  var withdrawOneCoinExpectedMixins_1 = require("./mixins/withdrawOneCoinExpectedMixins");
@@ -128,6 +128,24 @@ var getPool = function (poolId) {
128
128
  else {
129
129
  Object.assign(Pool.prototype, withdrawMixins_1.withdrawPlainMixin);
130
130
  }
131
+ // withdrawImbalanceBonus and withdrawOneCoinBonus
132
+ if (!poolDummy.isCrypto) {
133
+ Object.assign(Pool.prototype, withdrawBonusMixins_1.withdrawImbalanceBonusMixin);
134
+ Object.assign(Pool.prototype, withdrawBonusMixins_1.withdrawOneCoinBonusMixin);
135
+ }
136
+ else {
137
+ Object.assign(Pool.prototype, withdrawBonusMixins_1.withdrawOneCoinCryptoBonusMixin);
138
+ }
139
+ // withdrawImbalanceWrappedBonus and withdrawOneCoinWrappedBonus
140
+ if (!poolDummy.isPlain && !poolDummy.isFake) {
141
+ if (!poolDummy.isCrypto) {
142
+ Object.assign(Pool.prototype, withdrawBonusMixins_1.withdrawImbalanceWrappedBonusMixin);
143
+ Object.assign(Pool.prototype, withdrawBonusMixins_1.withdrawOneCoinWrappedBonusMixin);
144
+ }
145
+ else {
146
+ Object.assign(Pool.prototype, withdrawBonusMixins_1.withdrawOneCoinWrappedCryptoBonusMixin);
147
+ }
148
+ }
131
149
  // withdrawWrapped and withdrawWrappedEstimateGas
132
150
  if (!poolDummy.isPlain && !poolDummy.isFake) {
133
151
  if ((poolDummy.isLending || poolDummy.isCrypto) && !poolDummy.zap) {
@@ -211,7 +229,7 @@ var getPool = function (poolId) {
211
229
  if (poolId === 'tricrypto2') {
212
230
  Object.assign(Pool.prototype, swapMixins_1.swapTricrypto2Mixin);
213
231
  }
214
- else if ([137, 43114].includes(curve_1.curve.chainId) && poolDummy.isMetaFactory) {
232
+ else if (poolDummy.isMetaFactory && (0, exports.getPool)(poolDummy.basePool).isLending) {
215
233
  Object.assign(Pool.prototype, swapMixins_1.swapMetaFactoryMixin);
216
234
  }
217
235
  else {
package/lib/router.js CHANGED
@@ -71,7 +71,7 @@ var pools_1 = require("./pools");
71
71
  var IMBALANCED_POOLS = [];
72
72
  // Inspired by Dijkstra's algorithm
73
73
  var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __awaiter(void 0, void 0, void 0, function () {
74
- var ALL_POOLS, basePoolsSet, _i, ALL_POOLS_1, pool, basePoolIds, markedCoins, curCoins, nextCoins, routes, step, _a, curCoins_1, inCoin, _b, ALL_POOLS_2, _c, poolId, poolData, wrapped_coin_addresses, underlying_coin_addresses, meta_coin_addresses, token_address, is_lending, inCoinIndexes, j, swapType, _d, _e, inCoinRoute, swapType, _f, _h, inCoinRoute, j, tvl, _j, swapType, _k, _l, inCoinRoute, poolAddress, j, tvl, _m, swapType, _o, _p, inCoinRoute, j, tvl, _q, swapType, _r, _s, inCoinRoute, tvl, _t, swapType, _u, _v, inCoinRoute;
74
+ var ALL_POOLS, basePoolsSet, _i, ALL_POOLS_1, pool, basePoolIds, markedCoins, curCoins, nextCoins, routes, step, _a, curCoins_1, inCoin, _b, ALL_POOLS_2, _c, poolId, poolData, wrapped_coin_addresses, underlying_coin_addresses, base_pool, meta_coin_addresses, token_address, is_lending, inCoinIndexes, j, swapType, _d, _e, inCoinRoute, swapType, _f, _h, inCoinRoute, j, tvl, _j, swapType, _k, _l, inCoinRoute, poolAddress, j, tvl, _m, swapType, _o, _p, inCoinRoute, j, tvl, _q, swapType, _r, _s, inCoinRoute, tvl, _t, swapType, _u, _v, inCoinRoute;
75
75
  var _w;
76
76
  var _x, _y, _z, _0, _1, _2, _3, _4;
77
77
  return __generator(this, function (_5) {
@@ -109,8 +109,8 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
109
109
  _c = ALL_POOLS_2[_b], poolId = _c[0], poolData = _c[1];
110
110
  wrapped_coin_addresses = poolData.wrapped_coin_addresses.map(function (a) { return a.toLowerCase(); });
111
111
  underlying_coin_addresses = poolData.underlying_coin_addresses.map(function (a) { return a.toLowerCase(); });
112
- meta_coin_addresses = poolData.is_meta ?
113
- curve_1.curve.constants.POOLS_DATA[poolData.base_pool].underlying_coin_addresses.map(function (a) { return a.toLowerCase(); }) : [];
112
+ base_pool = poolData.is_meta ? curve_1.curve.constants.POOLS_DATA[poolData.base_pool] : null;
113
+ meta_coin_addresses = base_pool ? base_pool.underlying_coin_addresses.map(function (a) { return a.toLowerCase(); }) : [];
114
114
  token_address = poolData.token_address.toLowerCase();
115
115
  is_lending = (_x = poolData.is_lending) !== null && _x !== void 0 ? _x : false;
116
116
  inCoinIndexes = {
@@ -214,7 +214,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
214
214
  j++;
215
215
  return [3 /*break*/, 4];
216
216
  case 7:
217
- poolAddress = (poolData.is_crypto && poolData.is_meta) || ([137, 43114].includes(curve_1.curve.chainId) && poolData.is_factory) ?
217
+ poolAddress = (poolData.is_crypto && poolData.is_meta) || (base_pool && base_pool.is_meta && poolData.is_factory) ?
218
218
  poolData.deposit_address : poolData.swap_address;
219
219
  if (!(wrapped_coin_addresses.join("|") !== underlying_coin_addresses.join("|") && inCoinIndexes.underlying_coin >= 0)) return [3 /*break*/, 11];
220
220
  j = 0;
@@ -279,7 +279,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
279
279
  // Skip imbalanced pools
280
280
  if (IMBALANCED_POOLS.includes(poolId))
281
281
  return [3 /*break*/, 14];
282
- swapType = ([137, 43114].includes(curve_1.curve.chainId) && poolData.is_factory) ? 5 : poolData.is_crypto ? 4 : 2;
282
+ swapType = (base_pool && base_pool.is_meta && poolData.is_factory) ? 5 : poolData.is_crypto ? 4 : 2;
283
283
  for (_r = 0, _s = routes[inCoin]; _r < _s.length; _r++) {
284
284
  inCoinRoute = _s[_r];
285
285
  routes[meta_coin_addresses[j]] = ((_2 = routes[meta_coin_addresses[j]]) !== null && _2 !== void 0 ? _2 : []).concat([__spreadArray(__spreadArray([], inCoinRoute, true), [
@@ -316,7 +316,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
316
316
  // Skip imbalanced pools
317
317
  if (IMBALANCED_POOLS.includes(poolId))
318
318
  return [3 /*break*/, 17];
319
- swapType = ([137, 43114].includes(curve_1.curve.chainId) && poolData.is_factory) ? 5 : poolData.is_crypto ? 4 : 2;
319
+ swapType = (base_pool && base_pool.is_meta && poolData.is_factory) ? 5 : poolData.is_crypto ? 4 : 2;
320
320
  for (_u = 0, _v = routes[inCoin]; _u < _v.length; _u++) {
321
321
  inCoinRoute = _v[_u];
322
322
  routes[wrapped_coin_addresses[0]] = ((_3 = routes[wrapped_coin_addresses[0]]) !== null && _3 !== void 0 ? _3 : []).concat([__spreadArray(__spreadArray([], inCoinRoute, true), [
package/lib/utils.js CHANGED
@@ -453,11 +453,13 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
453
453
  chainName = {
454
454
  1: 'ethereum',
455
455
  137: 'polygon-pos',
456
+ 250: 'fantom',
456
457
  43114: 'avalanche',
457
458
  }[curve_1.curve.chainId];
458
459
  nativeTokenName = {
459
460
  1: 'ethereum',
460
461
  137: 'matic-network',
462
+ 250: 'fantom',
461
463
  43114: 'avalanche-2',
462
464
  }[curve_1.curve.chainId];
463
465
  if (chainName === undefined) {
@@ -522,6 +524,7 @@ var getTVL = function (chainId) {
522
524
  network = (_a = {
523
525
  1: "ethereum",
524
526
  137: "polygon",
527
+ 250: "fantom",
525
528
  43114: "avalanche",
526
529
  }[chainId]) !== null && _a !== void 0 ? _a : "ethereum";
527
530
  promises = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",