@aurigami/sdk 1.8.5 → 1.9.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 (30) hide show
  1. package/dist/SDK.d.ts +1 -1
  2. package/dist/helpers/priceFetcher.d.ts +1 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/sdk.cjs.development.js +151 -87
  5. package/dist/sdk.cjs.development.js.map +1 -1
  6. package/dist/sdk.cjs.production.min.js +1 -1
  7. package/dist/sdk.cjs.production.min.js.map +1 -1
  8. package/dist/sdk.esm.js +151 -88
  9. package/dist/sdk.esm.js.map +1 -1
  10. package/package.json +2 -2
  11. package/src/SDK.ts +1 -1
  12. package/src/entities/tokenAmount.ts +4 -2
  13. package/src/helpers/priceFetcher.ts +35 -3
  14. package/src/index.ts +1 -1
  15. package/src/{contracts → interactors}/MoneyMarket.ts +1 -1
  16. /package/dist/{contracts → interactors}/Airdrop.d.ts +0 -0
  17. /package/dist/{contracts → interactors}/MoneyMarket.d.ts +0 -0
  18. /package/dist/{contracts → interactors}/Multicall.d.ts +0 -0
  19. /package/dist/{contracts → interactors}/Papermill.d.ts +0 -0
  20. /package/dist/{contracts → interactors}/Referral.d.ts +0 -0
  21. /package/dist/{contracts → interactors}/Staking.d.ts +0 -0
  22. /package/dist/{contracts → interactors}/index.d.ts +0 -0
  23. /package/dist/{contracts → interactors}/misc.d.ts +0 -0
  24. /package/src/{contracts → interactors}/Airdrop.ts +0 -0
  25. /package/src/{contracts → interactors}/Multicall.ts +0 -0
  26. /package/src/{contracts → interactors}/Papermill.ts +0 -0
  27. /package/src/{contracts → interactors}/Referral.ts +0 -0
  28. /package/src/{contracts → interactors}/Staking.ts +0 -0
  29. /package/src/{contracts → interactors}/index.ts +0 -0
  30. /package/src/{contracts → interactors}/misc.ts +0 -0
package/dist/SDK.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TransactionResponse } from '@ethersproject/abstract-provider';
2
2
  import BigNumber from 'bignumber.js';
3
- import { MiscRead, StakingRead } from './contracts';
4
3
  import { AuriEnv, BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from './entities';
4
+ import { MiscRead, StakingRead } from './interactors';
5
5
  import * as types from './types';
6
6
  export declare class SdkRead extends BlockchainEntityRead {
7
7
  protected env: AuriEnv;
@@ -12,6 +12,7 @@ export declare function fetchLPPositions(LPAddress: Address, provider: providers
12
12
  totalSupply: BN;
13
13
  }>;
14
14
  export declare function fetchLPPrice(address: Address, provider: providers.Provider): Promise<BigNumber>;
15
+ export declare function fetchStNEARPrice(): Promise<BigNumber>;
15
16
  export declare function fetchPriceFromOracle(auTokenAddress: Address, underlyingDecimal: number, provider: providers.Provider): Promise<BigNumber>;
16
17
  export declare function fetchUnderlyingTokensPrices(provider: providers.Provider): Promise<{
17
18
  auToken: string;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * as abis from './abis';
2
2
  export * from './consts';
3
- export * from './contracts';
4
3
  export * from './entities';
5
4
  export * from './helpers';
5
+ export * from './interactors';
6
6
  export * from './SDK';
7
7
  export * from './types';
@@ -1647,8 +1647,8 @@ var TokenAmount = /*#__PURE__*/function () {
1647
1647
  var _proto = TokenAmount.prototype;
1648
1648
 
1649
1649
  _proto.formattedAmount = function formattedAmount(decimal, fmt) {
1650
- if (decimal && fmt) {
1651
- return new BigNumber(this.rawAmnt).div(decimalFactor(decimal)).toFormat(decimal, fmt);
1650
+ if (decimal !== undefined && fmt !== undefined) {
1651
+ return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toFormat(decimal, fmt);
1652
1652
  }
1653
1653
 
1654
1654
  return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
@@ -1812,12 +1812,17 @@ function _fetchPriceFromCoingeckoAPI() {
1812
1812
  case 0:
1813
1813
  _context.next = 2;
1814
1814
  return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
1815
- return res.data;
1815
+ return res.data[id];
1816
+ })["catch"](function (err) {
1817
+ console.log("Unable to fetch price from Coingecko API for " + id);
1818
+ return {
1819
+ usd: 0
1820
+ };
1816
1821
  });
1817
1822
 
1818
1823
  case 2:
1819
1824
  price = _context.sent;
1820
- return _context.abrupt("return", new BigNumber(price[id].usd));
1825
+ return _context.abrupt("return", new BigNumber(price.usd));
1821
1826
 
1822
1827
  case 4:
1823
1828
  case "end":
@@ -2002,6 +2007,42 @@ function _fetchLPPrice() {
2002
2007
  return _fetchLPPrice.apply(this, arguments);
2003
2008
  }
2004
2009
 
2010
+ function fetchStNEARPrice() {
2011
+ return _fetchStNEARPrice.apply(this, arguments);
2012
+ }
2013
+
2014
+ function _fetchStNEARPrice() {
2015
+ _fetchStNEARPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2016
+ var ratioPromise, nearPricePromise, _yield$Promise$all, ratioRes, nearPrice, ratio;
2017
+
2018
+ return runtime_1.wrap(function _callee6$(_context6) {
2019
+ while (1) {
2020
+ switch (_context6.prev = _context6.next) {
2021
+ case 0:
2022
+ ratioPromise = axios.get('https://validators.narwallets.com/metrics_json').then(function (res) {
2023
+ return res.data;
2024
+ });
2025
+ nearPricePromise = fetchPriceFromCoingeckoAPI('near');
2026
+ _context6.next = 4;
2027
+ return Promise.all([ratioPromise, nearPricePromise]);
2028
+
2029
+ case 4:
2030
+ _yield$Promise$all = _context6.sent;
2031
+ ratioRes = _yield$Promise$all[0];
2032
+ nearPrice = _yield$Promise$all[1];
2033
+ ratio = new BigNumber(ratioRes.st_near_price);
2034
+ return _context6.abrupt("return", ratio.multipliedBy(nearPrice));
2035
+
2036
+ case 9:
2037
+ case "end":
2038
+ return _context6.stop();
2039
+ }
2040
+ }
2041
+ }, _callee6);
2042
+ }));
2043
+ return _fetchStNEARPrice.apply(this, arguments);
2044
+ }
2045
+
2005
2046
  function processPriceFromOracle(rawPrice, underlyingDecimal) {
2006
2047
  return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
2007
2048
  }
@@ -2011,26 +2052,47 @@ function fetchPriceFromOracle(_x7, _x8, _x9) {
2011
2052
  }
2012
2053
 
2013
2054
  function _fetchPriceFromOracle() {
2014
- _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(auTokenAddress, underlyingDecimal, provider) {
2015
- var oracleContract, rawPrice;
2016
- return runtime_1.wrap(function _callee6$(_context6) {
2055
+ _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(auTokenAddress, underlyingDecimal, provider) {
2056
+ var oracleContract, rawPrice, matchingAuToken;
2057
+ return runtime_1.wrap(function _callee7$(_context7) {
2017
2058
  while (1) {
2018
- switch (_context6.prev = _context6.next) {
2059
+ switch (_context7.prev = _context7.next) {
2019
2060
  case 0:
2020
2061
  oracleContract = new ethers.Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
2021
- _context6.next = 3;
2022
- return oracleContract.getUnderlyingPrice(auTokenAddress);
2062
+ _context7.next = 3;
2063
+ return oracleContract.getUnderlyingPrice(auTokenAddress)["catch"](function (e) {
2064
+ console.log("Unable to fetch price from oracle for " + auTokenAddress);
2065
+ return ethers.BigNumber.from(0);
2066
+ });
2023
2067
 
2024
2068
  case 3:
2025
- rawPrice = _context6.sent;
2026
- return _context6.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2069
+ rawPrice = _context7.sent;
2027
2070
 
2028
- case 5:
2071
+ if (!rawPrice.isZero()) {
2072
+ _context7.next = 8;
2073
+ break;
2074
+ }
2075
+
2076
+ matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2077
+ return isSameAddress(auToken.address, auTokenAddress);
2078
+ });
2079
+
2080
+ if (!((matchingAuToken == null ? void 0 : matchingAuToken.name) == 'auSTNEAR')) {
2081
+ _context7.next = 8;
2082
+ break;
2083
+ }
2084
+
2085
+ return _context7.abrupt("return", fetchStNEARPrice());
2086
+
2087
+ case 8:
2088
+ return _context7.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2089
+
2090
+ case 9:
2029
2091
  case "end":
2030
- return _context6.stop();
2092
+ return _context7.stop();
2031
2093
  }
2032
2094
  }
2033
- }, _callee6);
2095
+ }, _callee7);
2034
2096
  }));
2035
2097
  return _fetchPriceFromOracle.apply(this, arguments);
2036
2098
  }
@@ -2040,11 +2102,11 @@ function fetchUnderlyingTokensPrices(_x10) {
2040
2102
  }
2041
2103
 
2042
2104
  function _fetchUnderlyingTokensPrices() {
2043
- _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(provider) {
2105
+ _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(provider) {
2044
2106
  var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
2045
- return runtime_1.wrap(function _callee7$(_context7) {
2107
+ return runtime_1.wrap(function _callee8$(_context8) {
2046
2108
  while (1) {
2047
- switch (_context7.prev = _context7.next) {
2109
+ switch (_context8.prev = _context8.next) {
2048
2110
  case 0:
2049
2111
  auriLens = new ethers.Contract(networkAddresses.misc.AURILENS, abis$4.abi, provider);
2050
2112
  auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
@@ -2053,12 +2115,12 @@ function _fetchUnderlyingTokensPrices() {
2053
2115
  underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
2054
2116
  return getDecimal(auToken.underlying);
2055
2117
  });
2056
- _context7.next = 5;
2118
+ _context8.next = 5;
2057
2119
  return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
2058
2120
 
2059
2121
  case 5:
2060
- rawPrices = _context7.sent;
2061
- return _context7.abrupt("return", rawPrices.map(function (res, ind) {
2122
+ rawPrices = _context8.sent;
2123
+ return _context8.abrupt("return", rawPrices.map(function (res, ind) {
2062
2124
  return {
2063
2125
  auToken: res.auToken,
2064
2126
  underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
@@ -2067,10 +2129,10 @@ function _fetchUnderlyingTokensPrices() {
2067
2129
 
2068
2130
  case 7:
2069
2131
  case "end":
2070
- return _context7.stop();
2132
+ return _context8.stop();
2071
2133
  }
2072
2134
  }
2073
- }, _callee7);
2135
+ }, _callee8);
2074
2136
  }));
2075
2137
  return _fetchUnderlyingTokensPrices.apply(this, arguments);
2076
2138
  }
@@ -2089,20 +2151,20 @@ function _fetchPrice(_x11, _x12) {
2089
2151
  }
2090
2152
 
2091
2153
  function _fetchPrice2() {
2092
- _fetchPrice2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(address, provider) {
2154
+ _fetchPrice2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(address, provider) {
2093
2155
  var matchingAuToken;
2094
- return runtime_1.wrap(function _callee8$(_context8) {
2156
+ return runtime_1.wrap(function _callee9$(_context9) {
2095
2157
  while (1) {
2096
- switch (_context8.prev = _context8.next) {
2158
+ switch (_context9.prev = _context9.next) {
2097
2159
  case 0:
2098
2160
  assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
2099
2161
 
2100
2162
  if (!shouldFetchFromCoingecko(address)) {
2101
- _context8.next = 3;
2163
+ _context9.next = 3;
2102
2164
  break;
2103
2165
  }
2104
2166
 
2105
- return _context8.abrupt("return", fetchPriceFromCoingecko(address));
2167
+ return _context9.abrupt("return", fetchPriceFromCoingecko(address));
2106
2168
 
2107
2169
  case 3:
2108
2170
  matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
@@ -2110,21 +2172,21 @@ function _fetchPrice2() {
2110
2172
  });
2111
2173
 
2112
2174
  if (!(matchingAuToken !== undefined)) {
2113
- _context8.next = 8;
2175
+ _context9.next = 8;
2114
2176
  break;
2115
2177
  }
2116
2178
 
2117
- return _context8.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2179
+ return _context9.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2118
2180
 
2119
2181
  case 8:
2120
2182
  throw Error("Unable to fetch price for " + address);
2121
2183
 
2122
2184
  case 9:
2123
2185
  case "end":
2124
- return _context8.stop();
2186
+ return _context9.stop();
2125
2187
  }
2126
2188
  }
2127
- }, _callee8);
2189
+ }, _callee9);
2128
2190
  }));
2129
2191
  return _fetchPrice2.apply(this, arguments);
2130
2192
  }
@@ -2134,51 +2196,51 @@ function fetchPrice(_x13, _x14) {
2134
2196
  }
2135
2197
 
2136
2198
  function _fetchPrice3() {
2137
- _fetchPrice3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(address, provider) {
2138
- return runtime_1.wrap(function _callee9$(_context9) {
2199
+ _fetchPrice3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(address, provider) {
2200
+ return runtime_1.wrap(function _callee10$(_context10) {
2139
2201
  while (1) {
2140
- switch (_context9.prev = _context9.next) {
2202
+ switch (_context10.prev = _context10.next) {
2141
2203
  case 0:
2142
2204
  if (!(address.toLowerCase() in HARDCODE_PRICE_TOKENS)) {
2143
- _context9.next = 4;
2205
+ _context10.next = 4;
2144
2206
  break;
2145
2207
  }
2146
2208
 
2147
- return _context9.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
2209
+ return _context10.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
2148
2210
 
2149
2211
  case 4:
2150
2212
  if (!isSameAddress(address, networkAddresses.tokens.PLYWNEAR)) {
2151
- _context9.next = 8;
2213
+ _context10.next = 8;
2152
2214
  break;
2153
2215
  }
2154
2216
 
2155
- return _context9.abrupt("return", fetchLPPrice(address, provider));
2217
+ return _context10.abrupt("return", fetchLPPrice(address, provider));
2156
2218
 
2157
2219
  case 8:
2158
2220
  if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
2159
- _context9.next = 12;
2221
+ _context10.next = 12;
2160
2222
  break;
2161
2223
  }
2162
2224
 
2163
- return _context9.abrupt("return", fetchPLYPrice(provider));
2225
+ return _context10.abrupt("return", fetchPLYPrice(provider));
2164
2226
 
2165
2227
  case 12:
2166
2228
  if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
2167
- _context9.next = 14;
2229
+ _context10.next = 14;
2168
2230
  break;
2169
2231
  }
2170
2232
 
2171
- return _context9.abrupt("return", fetchPULPPrice(provider));
2233
+ return _context10.abrupt("return", fetchPULPPrice(provider));
2172
2234
 
2173
2235
  case 14:
2174
- return _context9.abrupt("return", _fetchPrice(address, provider));
2236
+ return _context10.abrupt("return", _fetchPrice(address, provider));
2175
2237
 
2176
2238
  case 15:
2177
2239
  case "end":
2178
- return _context9.stop();
2240
+ return _context10.stop();
2179
2241
  }
2180
2242
  }
2181
- }, _callee9);
2243
+ }, _callee10);
2182
2244
  }));
2183
2245
  return _fetchPrice3.apply(this, arguments);
2184
2246
  }
@@ -2188,19 +2250,19 @@ function fetchPLYPrice(_x15) {
2188
2250
  }
2189
2251
 
2190
2252
  function _fetchPLYPrice() {
2191
- _fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(provider) {
2192
- return runtime_1.wrap(function _callee10$(_context10) {
2253
+ _fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(provider) {
2254
+ return runtime_1.wrap(function _callee11$(_context11) {
2193
2255
  while (1) {
2194
- switch (_context10.prev = _context10.next) {
2256
+ switch (_context11.prev = _context11.next) {
2195
2257
  case 0:
2196
- return _context10.abrupt("return", fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider));
2258
+ return _context11.abrupt("return", fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider));
2197
2259
 
2198
2260
  case 1:
2199
2261
  case "end":
2200
- return _context10.stop();
2262
+ return _context11.stop();
2201
2263
  }
2202
2264
  }
2203
- }, _callee10);
2265
+ }, _callee11);
2204
2266
  }));
2205
2267
  return _fetchPLYPrice.apply(this, arguments);
2206
2268
  }
@@ -2210,19 +2272,19 @@ function fetchPULPPrice(_x16) {
2210
2272
  }
2211
2273
 
2212
2274
  function _fetchPULPPrice() {
2213
- _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(provider) {
2214
- return runtime_1.wrap(function _callee11$(_context11) {
2275
+ _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(provider) {
2276
+ return runtime_1.wrap(function _callee12$(_context12) {
2215
2277
  while (1) {
2216
- switch (_context11.prev = _context11.next) {
2278
+ switch (_context12.prev = _context12.next) {
2217
2279
  case 0:
2218
- return _context11.abrupt("return", new BigNumber(0));
2280
+ return _context12.abrupt("return", new BigNumber(0));
2219
2281
 
2220
2282
  case 1:
2221
2283
  case "end":
2222
- return _context11.stop();
2284
+ return _context12.stop();
2223
2285
  }
2224
2286
  }
2225
- }, _callee11);
2287
+ }, _callee12);
2226
2288
  }));
2227
2289
  return _fetchPULPPrice.apply(this, arguments);
2228
2290
  }
@@ -2232,42 +2294,42 @@ function fetchToken0PriceByLP(_x17, _x18) {
2232
2294
  }
2233
2295
 
2234
2296
  function _fetchToken0PriceByLP() {
2235
- _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(LP, provider) {
2297
+ _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(LP, provider) {
2236
2298
  var LPInfo, token0Decimal, token1Decimal;
2237
- return runtime_1.wrap(function _callee12$(_context12) {
2299
+ return runtime_1.wrap(function _callee13$(_context13) {
2238
2300
  while (1) {
2239
- switch (_context12.prev = _context12.next) {
2301
+ switch (_context13.prev = _context13.next) {
2240
2302
  case 0:
2241
- _context12.next = 2;
2303
+ _context13.next = 2;
2242
2304
  return fetchLPPositions(LP, provider);
2243
2305
 
2244
2306
  case 2:
2245
- LPInfo = _context12.sent;
2307
+ LPInfo = _context13.sent;
2246
2308
 
2247
2309
  if (!LPInfo.reserve1.isZero()) {
2248
- _context12.next = 5;
2310
+ _context13.next = 5;
2249
2311
  break;
2250
2312
  }
2251
2313
 
2252
- return _context12.abrupt("return", new BigNumber(0));
2314
+ return _context13.abrupt("return", new BigNumber(0));
2253
2315
 
2254
2316
  case 5:
2255
2317
  token0Decimal = getDecimal(LPInfo.token0);
2256
2318
  token1Decimal = getDecimal(LPInfo.token1); // (token0Price * reserve0) / 10^decimal0 = (token1Price * reserve1) / 10^decimal1
2257
2319
  // token0Price = (token1Price * reserve1) * 10^decimal0 / 10^decimal1 / reserve0
2258
2320
 
2259
- _context12.next = 9;
2321
+ _context13.next = 9;
2260
2322
  return fetchPrice(LPInfo.token1, provider);
2261
2323
 
2262
2324
  case 9:
2263
- return _context12.abrupt("return", _context12.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2325
+ return _context13.abrupt("return", _context13.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2264
2326
 
2265
2327
  case 10:
2266
2328
  case "end":
2267
- return _context12.stop();
2329
+ return _context13.stop();
2268
2330
  }
2269
2331
  }
2270
- }, _callee12);
2332
+ }, _callee13);
2271
2333
  }));
2272
2334
  return _fetchToken0PriceByLP.apply(this, arguments);
2273
2335
  }
@@ -2277,33 +2339,33 @@ function fetchValuation(_x19, _x20) {
2277
2339
  }
2278
2340
 
2279
2341
  function _fetchValuation() {
2280
- _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(tokenAmount, provider) {
2342
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2281
2343
  var price;
2282
- return runtime_1.wrap(function _callee13$(_context13) {
2344
+ return runtime_1.wrap(function _callee14$(_context14) {
2283
2345
  while (1) {
2284
- switch (_context13.prev = _context13.next) {
2346
+ switch (_context14.prev = _context14.next) {
2285
2347
  case 0:
2286
2348
  if (!(tokenAmount.rawAmount() == '0')) {
2287
- _context13.next = 2;
2349
+ _context14.next = 2;
2288
2350
  break;
2289
2351
  }
2290
2352
 
2291
- return _context13.abrupt("return", new BigNumber(0));
2353
+ return _context14.abrupt("return", new BigNumber(0));
2292
2354
 
2293
2355
  case 2:
2294
- _context13.next = 4;
2356
+ _context14.next = 4;
2295
2357
  return fetchPrice(tokenAmount.token.address, provider);
2296
2358
 
2297
2359
  case 4:
2298
- price = _context13.sent;
2299
- return _context13.abrupt("return", calcValuation(tokenAmount, price));
2360
+ price = _context14.sent;
2361
+ return _context14.abrupt("return", calcValuation(tokenAmount, price));
2300
2362
 
2301
2363
  case 6:
2302
2364
  case "end":
2303
- return _context13.stop();
2365
+ return _context14.stop();
2304
2366
  }
2305
2367
  }
2306
- }, _callee13);
2368
+ }, _callee14);
2307
2369
  }));
2308
2370
  return _fetchValuation.apply(this, arguments);
2309
2371
  }
@@ -2316,18 +2378,18 @@ function valuateToken(_x21, _x22) {
2316
2378
  }
2317
2379
 
2318
2380
  function _valuateToken() {
2319
- _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2381
+ _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(tokenAmount, provider) {
2320
2382
  var tokenValuation;
2321
- return runtime_1.wrap(function _callee14$(_context14) {
2383
+ return runtime_1.wrap(function _callee15$(_context15) {
2322
2384
  while (1) {
2323
- switch (_context14.prev = _context14.next) {
2385
+ switch (_context15.prev = _context15.next) {
2324
2386
  case 0:
2325
- _context14.next = 2;
2387
+ _context15.next = 2;
2326
2388
  return fetchValuation(tokenAmount, provider);
2327
2389
 
2328
2390
  case 2:
2329
- tokenValuation = _context14.sent;
2330
- return _context14.abrupt("return", {
2391
+ tokenValuation = _context15.sent;
2392
+ return _context15.abrupt("return", {
2331
2393
  tokenAmount: tokenAmount,
2332
2394
  currencyAmount: {
2333
2395
  currency: 'USD',
@@ -2337,10 +2399,10 @@ function _valuateToken() {
2337
2399
 
2338
2400
  case 4:
2339
2401
  case "end":
2340
- return _context14.stop();
2402
+ return _context15.stop();
2341
2403
  }
2342
2404
  }
2343
- }, _callee14);
2405
+ }, _callee15);
2344
2406
  }));
2345
2407
  return _valuateToken.apply(this, arguments);
2346
2408
  }
@@ -2473,6 +2535,7 @@ var helpers = {
2473
2535
  fetchPriceFromCoingecko: fetchPriceFromCoingecko,
2474
2536
  fetchLPPositions: fetchLPPositions,
2475
2537
  fetchLPPrice: fetchLPPrice,
2538
+ fetchStNEARPrice: fetchStNEARPrice,
2476
2539
  fetchPriceFromOracle: fetchPriceFromOracle,
2477
2540
  fetchUnderlyingTokensPrices: fetchUnderlyingTokensPrices,
2478
2541
  fetchPrice: fetchPrice,
@@ -5387,6 +5450,7 @@ exports.fetchPrice = fetchPrice;
5387
5450
  exports.fetchPriceFromCoingecko = fetchPriceFromCoingecko;
5388
5451
  exports.fetchPriceFromCoingeckoAPI = fetchPriceFromCoingeckoAPI;
5389
5452
  exports.fetchPriceFromOracle = fetchPriceFromOracle;
5453
+ exports.fetchStNEARPrice = fetchStNEARPrice;
5390
5454
  exports.fetchToken0PriceByLP = fetchToken0PriceByLP;
5391
5455
  exports.fetchUnderlyingTokensPrices = fetchUnderlyingTokensPrices;
5392
5456
  exports.fetchValuation = fetchValuation;