@aurigami/sdk 1.8.6 → 1.9.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.
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 +171 -97
  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 +171 -98
  9. package/dist/sdk.esm.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/SDK.ts +1 -1
  12. package/src/helpers/helpers.ts +1 -1
  13. package/src/helpers/priceFetcher.ts +40 -4
  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.esm.js CHANGED
@@ -1613,7 +1613,7 @@ function devLog(message) {
1613
1613
  optionalParams[_key - 1] = arguments[_key];
1614
1614
  }
1615
1615
 
1616
- (_console = console).log.apply(_console, [message].concat(optionalParams));
1616
+ (_console = console).log.apply(_console, ['[DEV LOG]', message].concat(optionalParams));
1617
1617
  }
1618
1618
  }
1619
1619
 
@@ -1807,12 +1807,17 @@ function _fetchPriceFromCoingeckoAPI() {
1807
1807
  case 0:
1808
1808
  _context.next = 2;
1809
1809
  return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
1810
- return res.data;
1810
+ return res.data[id];
1811
+ })["catch"](function (err) {
1812
+ console.log("Unable to fetch price from Coingecko API for " + id);
1813
+ return {
1814
+ usd: 0
1815
+ };
1811
1816
  });
1812
1817
 
1813
1818
  case 2:
1814
1819
  price = _context.sent;
1815
- return _context.abrupt("return", new BigNumber(price[id].usd));
1820
+ return _context.abrupt("return", new BigNumber(price.usd));
1816
1821
 
1817
1822
  case 4:
1818
1823
  case "end":
@@ -1906,7 +1911,7 @@ function fetchLPPrice(_x5, _x6) {
1906
1911
 
1907
1912
  function _fetchLPPrice() {
1908
1913
  _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(address, provider) {
1909
- var LPInfo, LPDecimal, fetchLPPriceBy, _fetchLPPriceBy;
1914
+ var LPInfo, LPDecimal, fetchLPPriceBy, _fetchLPPriceBy, lpPrice;
1910
1915
 
1911
1916
  return runtime_1.wrap(function _callee5$(_context5) {
1912
1917
  while (1) {
@@ -1965,38 +1970,84 @@ function _fetchLPPrice() {
1965
1970
  });
1966
1971
 
1967
1972
  case 9:
1968
- return _context5.abrupt("return", _context5.sent);
1973
+ lpPrice = _context5.sent;
1974
+
1975
+ if (!lpPrice.isZero()) {
1976
+ _context5.next = 12;
1977
+ break;
1978
+ }
1979
+
1980
+ throw Error("Price is zero");
1969
1981
 
1970
1982
  case 12:
1971
- _context5.prev = 12;
1983
+ return _context5.abrupt("return", lpPrice);
1984
+
1985
+ case 15:
1986
+ _context5.prev = 15;
1972
1987
  _context5.t0 = _context5["catch"](6);
1973
1988
  devLog("fetchLPPriceBy " + LPInfo.token0 + " failed", _context5.t0);
1974
- _context5.prev = 15;
1975
- _context5.next = 18;
1989
+ _context5.prev = 18;
1990
+ _context5.next = 21;
1976
1991
  return fetchLPPriceBy({
1977
1992
  address: LPInfo.token1,
1978
1993
  reserve: LPInfo.reserve1
1979
1994
  });
1980
1995
 
1981
- case 18:
1996
+ case 21:
1982
1997
  return _context5.abrupt("return", _context5.sent);
1983
1998
 
1984
- case 21:
1985
- _context5.prev = 21;
1986
- _context5.t1 = _context5["catch"](15);
1999
+ case 24:
2000
+ _context5.prev = 24;
2001
+ _context5.t1 = _context5["catch"](18);
1987
2002
  devLog("fetchLPPriceBy " + LPInfo.token1 + " failed", _context5.t1);
1988
2003
  throw Error("Unable to fetch price for both tokens of LP " + address);
1989
2004
 
1990
- case 25:
2005
+ case 28:
1991
2006
  case "end":
1992
2007
  return _context5.stop();
1993
2008
  }
1994
2009
  }
1995
- }, _callee5, null, [[6, 12], [15, 21]]);
2010
+ }, _callee5, null, [[6, 15], [18, 24]]);
1996
2011
  }));
1997
2012
  return _fetchLPPrice.apply(this, arguments);
1998
2013
  }
1999
2014
 
2015
+ function fetchStNEARPrice() {
2016
+ return _fetchStNEARPrice.apply(this, arguments);
2017
+ }
2018
+
2019
+ function _fetchStNEARPrice() {
2020
+ _fetchStNEARPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2021
+ var ratioPromise, nearPricePromise, _yield$Promise$all, ratioRes, nearPrice, ratio;
2022
+
2023
+ return runtime_1.wrap(function _callee6$(_context6) {
2024
+ while (1) {
2025
+ switch (_context6.prev = _context6.next) {
2026
+ case 0:
2027
+ ratioPromise = axios.get('https://validators.narwallets.com/metrics_json').then(function (res) {
2028
+ return res.data;
2029
+ });
2030
+ nearPricePromise = fetchPriceFromCoingeckoAPI('near');
2031
+ _context6.next = 4;
2032
+ return Promise.all([ratioPromise, nearPricePromise]);
2033
+
2034
+ case 4:
2035
+ _yield$Promise$all = _context6.sent;
2036
+ ratioRes = _yield$Promise$all[0];
2037
+ nearPrice = _yield$Promise$all[1];
2038
+ ratio = new BigNumber(ratioRes.st_near_price);
2039
+ return _context6.abrupt("return", ratio.multipliedBy(nearPrice));
2040
+
2041
+ case 9:
2042
+ case "end":
2043
+ return _context6.stop();
2044
+ }
2045
+ }
2046
+ }, _callee6);
2047
+ }));
2048
+ return _fetchStNEARPrice.apply(this, arguments);
2049
+ }
2050
+
2000
2051
  function processPriceFromOracle(rawPrice, underlyingDecimal) {
2001
2052
  return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
2002
2053
  }
@@ -2006,26 +2057,47 @@ function fetchPriceFromOracle(_x7, _x8, _x9) {
2006
2057
  }
2007
2058
 
2008
2059
  function _fetchPriceFromOracle() {
2009
- _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(auTokenAddress, underlyingDecimal, provider) {
2010
- var oracleContract, rawPrice;
2011
- return runtime_1.wrap(function _callee6$(_context6) {
2060
+ _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(auTokenAddress, underlyingDecimal, provider) {
2061
+ var oracleContract, rawPrice, matchingAuToken;
2062
+ return runtime_1.wrap(function _callee7$(_context7) {
2012
2063
  while (1) {
2013
- switch (_context6.prev = _context6.next) {
2064
+ switch (_context7.prev = _context7.next) {
2014
2065
  case 0:
2015
2066
  oracleContract = new Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
2016
- _context6.next = 3;
2017
- return oracleContract.getUnderlyingPrice(auTokenAddress);
2067
+ _context7.next = 3;
2068
+ return oracleContract.getUnderlyingPrice(auTokenAddress)["catch"](function (e) {
2069
+ console.log("Unable to fetch price from oracle for " + auTokenAddress);
2070
+ return BigNumber$1.from(0);
2071
+ });
2018
2072
 
2019
2073
  case 3:
2020
- rawPrice = _context6.sent;
2021
- return _context6.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2074
+ rawPrice = _context7.sent;
2022
2075
 
2023
- case 5:
2076
+ if (!rawPrice.isZero()) {
2077
+ _context7.next = 8;
2078
+ break;
2079
+ }
2080
+
2081
+ matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2082
+ return isSameAddress(auToken.address, auTokenAddress);
2083
+ });
2084
+
2085
+ if (!((matchingAuToken == null ? void 0 : matchingAuToken.name) == 'auSTNEAR')) {
2086
+ _context7.next = 8;
2087
+ break;
2088
+ }
2089
+
2090
+ return _context7.abrupt("return", fetchStNEARPrice());
2091
+
2092
+ case 8:
2093
+ return _context7.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2094
+
2095
+ case 9:
2024
2096
  case "end":
2025
- return _context6.stop();
2097
+ return _context7.stop();
2026
2098
  }
2027
2099
  }
2028
- }, _callee6);
2100
+ }, _callee7);
2029
2101
  }));
2030
2102
  return _fetchPriceFromOracle.apply(this, arguments);
2031
2103
  }
@@ -2035,11 +2107,11 @@ function fetchUnderlyingTokensPrices(_x10) {
2035
2107
  }
2036
2108
 
2037
2109
  function _fetchUnderlyingTokensPrices() {
2038
- _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(provider) {
2110
+ _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(provider) {
2039
2111
  var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
2040
- return runtime_1.wrap(function _callee7$(_context7) {
2112
+ return runtime_1.wrap(function _callee8$(_context8) {
2041
2113
  while (1) {
2042
- switch (_context7.prev = _context7.next) {
2114
+ switch (_context8.prev = _context8.next) {
2043
2115
  case 0:
2044
2116
  auriLens = new Contract(networkAddresses.misc.AURILENS, abis$3.abi, provider);
2045
2117
  auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
@@ -2048,12 +2120,12 @@ function _fetchUnderlyingTokensPrices() {
2048
2120
  underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
2049
2121
  return getDecimal(auToken.underlying);
2050
2122
  });
2051
- _context7.next = 5;
2123
+ _context8.next = 5;
2052
2124
  return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
2053
2125
 
2054
2126
  case 5:
2055
- rawPrices = _context7.sent;
2056
- return _context7.abrupt("return", rawPrices.map(function (res, ind) {
2127
+ rawPrices = _context8.sent;
2128
+ return _context8.abrupt("return", rawPrices.map(function (res, ind) {
2057
2129
  return {
2058
2130
  auToken: res.auToken,
2059
2131
  underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
@@ -2062,10 +2134,10 @@ function _fetchUnderlyingTokensPrices() {
2062
2134
 
2063
2135
  case 7:
2064
2136
  case "end":
2065
- return _context7.stop();
2137
+ return _context8.stop();
2066
2138
  }
2067
2139
  }
2068
- }, _callee7);
2140
+ }, _callee8);
2069
2141
  }));
2070
2142
  return _fetchUnderlyingTokensPrices.apply(this, arguments);
2071
2143
  }
@@ -2084,20 +2156,20 @@ function _fetchPrice(_x11, _x12) {
2084
2156
  }
2085
2157
 
2086
2158
  function _fetchPrice2() {
2087
- _fetchPrice2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(address, provider) {
2159
+ _fetchPrice2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(address, provider) {
2088
2160
  var matchingAuToken;
2089
- return runtime_1.wrap(function _callee8$(_context8) {
2161
+ return runtime_1.wrap(function _callee9$(_context9) {
2090
2162
  while (1) {
2091
- switch (_context8.prev = _context8.next) {
2163
+ switch (_context9.prev = _context9.next) {
2092
2164
  case 0:
2093
2165
  assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
2094
2166
 
2095
2167
  if (!shouldFetchFromCoingecko(address)) {
2096
- _context8.next = 3;
2168
+ _context9.next = 3;
2097
2169
  break;
2098
2170
  }
2099
2171
 
2100
- return _context8.abrupt("return", fetchPriceFromCoingecko(address));
2172
+ return _context9.abrupt("return", fetchPriceFromCoingecko(address));
2101
2173
 
2102
2174
  case 3:
2103
2175
  matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
@@ -2105,21 +2177,21 @@ function _fetchPrice2() {
2105
2177
  });
2106
2178
 
2107
2179
  if (!(matchingAuToken !== undefined)) {
2108
- _context8.next = 8;
2180
+ _context9.next = 8;
2109
2181
  break;
2110
2182
  }
2111
2183
 
2112
- return _context8.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2184
+ return _context9.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2113
2185
 
2114
2186
  case 8:
2115
2187
  throw Error("Unable to fetch price for " + address);
2116
2188
 
2117
2189
  case 9:
2118
2190
  case "end":
2119
- return _context8.stop();
2191
+ return _context9.stop();
2120
2192
  }
2121
2193
  }
2122
- }, _callee8);
2194
+ }, _callee9);
2123
2195
  }));
2124
2196
  return _fetchPrice2.apply(this, arguments);
2125
2197
  }
@@ -2129,51 +2201,51 @@ function fetchPrice(_x13, _x14) {
2129
2201
  }
2130
2202
 
2131
2203
  function _fetchPrice3() {
2132
- _fetchPrice3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(address, provider) {
2133
- return runtime_1.wrap(function _callee9$(_context9) {
2204
+ _fetchPrice3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(address, provider) {
2205
+ return runtime_1.wrap(function _callee10$(_context10) {
2134
2206
  while (1) {
2135
- switch (_context9.prev = _context9.next) {
2207
+ switch (_context10.prev = _context10.next) {
2136
2208
  case 0:
2137
2209
  if (!(address.toLowerCase() in HARDCODE_PRICE_TOKENS)) {
2138
- _context9.next = 4;
2210
+ _context10.next = 4;
2139
2211
  break;
2140
2212
  }
2141
2213
 
2142
- return _context9.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
2214
+ return _context10.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
2143
2215
 
2144
2216
  case 4:
2145
2217
  if (!isSameAddress(address, networkAddresses.tokens.PLYWNEAR)) {
2146
- _context9.next = 8;
2218
+ _context10.next = 8;
2147
2219
  break;
2148
2220
  }
2149
2221
 
2150
- return _context9.abrupt("return", fetchLPPrice(address, provider));
2222
+ return _context10.abrupt("return", fetchLPPrice(address, provider));
2151
2223
 
2152
2224
  case 8:
2153
2225
  if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
2154
- _context9.next = 12;
2226
+ _context10.next = 12;
2155
2227
  break;
2156
2228
  }
2157
2229
 
2158
- return _context9.abrupt("return", fetchPLYPrice(provider));
2230
+ return _context10.abrupt("return", fetchPLYPrice(provider));
2159
2231
 
2160
2232
  case 12:
2161
2233
  if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
2162
- _context9.next = 14;
2234
+ _context10.next = 14;
2163
2235
  break;
2164
2236
  }
2165
2237
 
2166
- return _context9.abrupt("return", fetchPULPPrice(provider));
2238
+ return _context10.abrupt("return", fetchPULPPrice(provider));
2167
2239
 
2168
2240
  case 14:
2169
- return _context9.abrupt("return", _fetchPrice(address, provider));
2241
+ return _context10.abrupt("return", _fetchPrice(address, provider));
2170
2242
 
2171
2243
  case 15:
2172
2244
  case "end":
2173
- return _context9.stop();
2245
+ return _context10.stop();
2174
2246
  }
2175
2247
  }
2176
- }, _callee9);
2248
+ }, _callee10);
2177
2249
  }));
2178
2250
  return _fetchPrice3.apply(this, arguments);
2179
2251
  }
@@ -2183,19 +2255,19 @@ function fetchPLYPrice(_x15) {
2183
2255
  }
2184
2256
 
2185
2257
  function _fetchPLYPrice() {
2186
- _fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(provider) {
2187
- return runtime_1.wrap(function _callee10$(_context10) {
2258
+ _fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(provider) {
2259
+ return runtime_1.wrap(function _callee11$(_context11) {
2188
2260
  while (1) {
2189
- switch (_context10.prev = _context10.next) {
2261
+ switch (_context11.prev = _context11.next) {
2190
2262
  case 0:
2191
- return _context10.abrupt("return", fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider));
2263
+ return _context11.abrupt("return", fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider));
2192
2264
 
2193
2265
  case 1:
2194
2266
  case "end":
2195
- return _context10.stop();
2267
+ return _context11.stop();
2196
2268
  }
2197
2269
  }
2198
- }, _callee10);
2270
+ }, _callee11);
2199
2271
  }));
2200
2272
  return _fetchPLYPrice.apply(this, arguments);
2201
2273
  }
@@ -2205,19 +2277,19 @@ function fetchPULPPrice(_x16) {
2205
2277
  }
2206
2278
 
2207
2279
  function _fetchPULPPrice() {
2208
- _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(provider) {
2209
- return runtime_1.wrap(function _callee11$(_context11) {
2280
+ _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(provider) {
2281
+ return runtime_1.wrap(function _callee12$(_context12) {
2210
2282
  while (1) {
2211
- switch (_context11.prev = _context11.next) {
2283
+ switch (_context12.prev = _context12.next) {
2212
2284
  case 0:
2213
- return _context11.abrupt("return", new BigNumber(0));
2285
+ return _context12.abrupt("return", new BigNumber(0));
2214
2286
 
2215
2287
  case 1:
2216
2288
  case "end":
2217
- return _context11.stop();
2289
+ return _context12.stop();
2218
2290
  }
2219
2291
  }
2220
- }, _callee11);
2292
+ }, _callee12);
2221
2293
  }));
2222
2294
  return _fetchPULPPrice.apply(this, arguments);
2223
2295
  }
@@ -2227,42 +2299,42 @@ function fetchToken0PriceByLP(_x17, _x18) {
2227
2299
  }
2228
2300
 
2229
2301
  function _fetchToken0PriceByLP() {
2230
- _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(LP, provider) {
2302
+ _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(LP, provider) {
2231
2303
  var LPInfo, token0Decimal, token1Decimal;
2232
- return runtime_1.wrap(function _callee12$(_context12) {
2304
+ return runtime_1.wrap(function _callee13$(_context13) {
2233
2305
  while (1) {
2234
- switch (_context12.prev = _context12.next) {
2306
+ switch (_context13.prev = _context13.next) {
2235
2307
  case 0:
2236
- _context12.next = 2;
2308
+ _context13.next = 2;
2237
2309
  return fetchLPPositions(LP, provider);
2238
2310
 
2239
2311
  case 2:
2240
- LPInfo = _context12.sent;
2312
+ LPInfo = _context13.sent;
2241
2313
 
2242
2314
  if (!LPInfo.reserve1.isZero()) {
2243
- _context12.next = 5;
2315
+ _context13.next = 5;
2244
2316
  break;
2245
2317
  }
2246
2318
 
2247
- return _context12.abrupt("return", new BigNumber(0));
2319
+ return _context13.abrupt("return", new BigNumber(0));
2248
2320
 
2249
2321
  case 5:
2250
2322
  token0Decimal = getDecimal(LPInfo.token0);
2251
2323
  token1Decimal = getDecimal(LPInfo.token1); // (token0Price * reserve0) / 10^decimal0 = (token1Price * reserve1) / 10^decimal1
2252
2324
  // token0Price = (token1Price * reserve1) * 10^decimal0 / 10^decimal1 / reserve0
2253
2325
 
2254
- _context12.next = 9;
2326
+ _context13.next = 9;
2255
2327
  return fetchPrice(LPInfo.token1, provider);
2256
2328
 
2257
2329
  case 9:
2258
- return _context12.abrupt("return", _context12.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2330
+ return _context13.abrupt("return", _context13.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2259
2331
 
2260
2332
  case 10:
2261
2333
  case "end":
2262
- return _context12.stop();
2334
+ return _context13.stop();
2263
2335
  }
2264
2336
  }
2265
- }, _callee12);
2337
+ }, _callee13);
2266
2338
  }));
2267
2339
  return _fetchToken0PriceByLP.apply(this, arguments);
2268
2340
  }
@@ -2272,33 +2344,33 @@ function fetchValuation(_x19, _x20) {
2272
2344
  }
2273
2345
 
2274
2346
  function _fetchValuation() {
2275
- _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(tokenAmount, provider) {
2347
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2276
2348
  var price;
2277
- return runtime_1.wrap(function _callee13$(_context13) {
2349
+ return runtime_1.wrap(function _callee14$(_context14) {
2278
2350
  while (1) {
2279
- switch (_context13.prev = _context13.next) {
2351
+ switch (_context14.prev = _context14.next) {
2280
2352
  case 0:
2281
2353
  if (!(tokenAmount.rawAmount() == '0')) {
2282
- _context13.next = 2;
2354
+ _context14.next = 2;
2283
2355
  break;
2284
2356
  }
2285
2357
 
2286
- return _context13.abrupt("return", new BigNumber(0));
2358
+ return _context14.abrupt("return", new BigNumber(0));
2287
2359
 
2288
2360
  case 2:
2289
- _context13.next = 4;
2361
+ _context14.next = 4;
2290
2362
  return fetchPrice(tokenAmount.token.address, provider);
2291
2363
 
2292
2364
  case 4:
2293
- price = _context13.sent;
2294
- return _context13.abrupt("return", calcValuation(tokenAmount, price));
2365
+ price = _context14.sent;
2366
+ return _context14.abrupt("return", calcValuation(tokenAmount, price));
2295
2367
 
2296
2368
  case 6:
2297
2369
  case "end":
2298
- return _context13.stop();
2370
+ return _context14.stop();
2299
2371
  }
2300
2372
  }
2301
- }, _callee13);
2373
+ }, _callee14);
2302
2374
  }));
2303
2375
  return _fetchValuation.apply(this, arguments);
2304
2376
  }
@@ -2311,18 +2383,18 @@ function valuateToken(_x21, _x22) {
2311
2383
  }
2312
2384
 
2313
2385
  function _valuateToken() {
2314
- _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2386
+ _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(tokenAmount, provider) {
2315
2387
  var tokenValuation;
2316
- return runtime_1.wrap(function _callee14$(_context14) {
2388
+ return runtime_1.wrap(function _callee15$(_context15) {
2317
2389
  while (1) {
2318
- switch (_context14.prev = _context14.next) {
2390
+ switch (_context15.prev = _context15.next) {
2319
2391
  case 0:
2320
- _context14.next = 2;
2392
+ _context15.next = 2;
2321
2393
  return fetchValuation(tokenAmount, provider);
2322
2394
 
2323
2395
  case 2:
2324
- tokenValuation = _context14.sent;
2325
- return _context14.abrupt("return", {
2396
+ tokenValuation = _context15.sent;
2397
+ return _context15.abrupt("return", {
2326
2398
  tokenAmount: tokenAmount,
2327
2399
  currencyAmount: {
2328
2400
  currency: 'USD',
@@ -2332,10 +2404,10 @@ function _valuateToken() {
2332
2404
 
2333
2405
  case 4:
2334
2406
  case "end":
2335
- return _context14.stop();
2407
+ return _context15.stop();
2336
2408
  }
2337
2409
  }
2338
- }, _callee14);
2410
+ }, _callee15);
2339
2411
  }));
2340
2412
  return _valuateToken.apply(this, arguments);
2341
2413
  }
@@ -2468,6 +2540,7 @@ var helpers = {
2468
2540
  fetchPriceFromCoingecko: fetchPriceFromCoingecko,
2469
2541
  fetchLPPositions: fetchLPPositions,
2470
2542
  fetchLPPrice: fetchLPPrice,
2543
+ fetchStNEARPrice: fetchStNEARPrice,
2471
2544
  fetchPriceFromOracle: fetchPriceFromOracle,
2472
2545
  fetchUnderlyingTokensPrices: fetchUnderlyingTokensPrices,
2473
2546
  fetchPrice: fetchPrice,
@@ -5310,5 +5383,5 @@ BigNumber.config({
5310
5383
  DECIMAL_PLACES: 50
5311
5384
  });
5312
5385
 
5313
- export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, symbolRecords, validateAndParseAddress, valuateToken };
5386
+ export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, symbolRecords, validateAndParseAddress, valuateToken };
5314
5387
  //# sourceMappingURL=sdk.esm.js.map