@aurigami/sdk 1.4.4 → 1.4.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/dist/sdk.esm.js CHANGED
@@ -2,13 +2,12 @@ import BigNumber from 'bignumber.js';
2
2
  import { BigNumber as BigNumber$1, utils, Contract, ethers } from 'ethers';
3
3
  import { Logger } from 'ethers/lib/utils';
4
4
  import { Signer } from '@ethersproject/abstract-signer';
5
- import fetch, { Headers, Request, Response } from 'node-fetch';
5
+ import axios from 'axios';
6
6
  import AuErc20ABI from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
7
7
  import AuETHABI from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
8
8
  import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
9
9
  import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
10
10
  import EthRepayHelperABI from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
11
- import axios from 'axios';
12
11
  import TokenLockABI from '@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json';
13
12
  import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
14
13
  import FaucetABI from '@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json';
@@ -1033,36 +1032,22 @@ function _getQuery() {
1033
1032
  params = {};
1034
1033
  }
1035
1034
 
1036
- if (!globalThis.fetch) {
1037
- Object.assign(globalThis, {
1038
- fetch: fetch,
1039
- Headers: Headers,
1040
- Request: Request,
1041
- Response: Response
1042
- });
1043
- }
1044
-
1045
1035
  params = _extends({}, params, {
1046
1036
  'module': module,
1047
1037
  'action': action
1048
1038
  });
1049
- _context.next = 5;
1050
- return globalThis.fetch(AURORA_API_BASE_URL + '?' + new URLSearchParams(params), {
1039
+ _context.next = 4;
1040
+ return axios.get(AURORA_API_BASE_URL + '?' + new URLSearchParams(params), {
1051
1041
  headers: {
1052
1042
  'Content-Type': 'application/json'
1053
- },
1054
- method: 'GET'
1043
+ }
1055
1044
  });
1056
1045
 
1057
- case 5:
1046
+ case 4:
1058
1047
  resp = _context.sent;
1059
- _context.next = 8;
1060
- return resp.json();
1061
-
1062
- case 8:
1063
- return _context.abrupt("return", _context.sent.result);
1048
+ return _context.abrupt("return", resp.data.result);
1064
1049
 
1065
- case 9:
1050
+ case 6:
1066
1051
  case "end":
1067
1052
  return _context.stop();
1068
1053
  }
@@ -2473,37 +2458,45 @@ function _fetchPrice() {
2473
2458
  return _context8.abrupt("return", new BigNumber(0));
2474
2459
 
2475
2460
  case 2:
2476
- if (!shouldFetchFromCoingecko(address)) {
2461
+ if (!isSameAddress(address, networkAddresses.tokens.stNEAR)) {
2477
2462
  _context8.next = 4;
2478
2463
  break;
2479
2464
  }
2480
2465
 
2481
- return _context8.abrupt("return", fetchPriceFromCoingecko(address));
2466
+ return _context8.abrupt("return", fetchStNEARPrice());
2482
2467
 
2483
2468
  case 4:
2469
+ if (!shouldFetchFromCoingecko(address)) {
2470
+ _context8.next = 6;
2471
+ break;
2472
+ }
2473
+
2474
+ return _context8.abrupt("return", fetchPriceFromCoingecko(address));
2475
+
2476
+ case 6:
2484
2477
  matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2485
2478
  return isSameAddress(auToken.underlying, address);
2486
2479
  });
2487
2480
 
2488
2481
  if (!(matchingAuToken !== undefined)) {
2489
- _context8.next = 9;
2482
+ _context8.next = 11;
2490
2483
  break;
2491
2484
  }
2492
2485
 
2493
2486
  return _context8.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2494
2487
 
2495
- case 9:
2488
+ case 11:
2496
2489
  if (!isSameAddress(address, networkAddresses.tokens.AURPLY)) {
2497
- _context8.next = 13;
2490
+ _context8.next = 15;
2498
2491
  break;
2499
2492
  }
2500
2493
 
2501
2494
  return _context8.abrupt("return", fetchLPPrice(address, provider));
2502
2495
 
2503
- case 13:
2496
+ case 15:
2504
2497
  return _context8.abrupt("return", fetchPriceFromCoingecko(address));
2505
2498
 
2506
- case 14:
2499
+ case 16:
2507
2500
  case "end":
2508
2501
  return _context8.stop();
2509
2502
  }