@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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.4",
2
+ "version": "1.4.6",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -63,7 +63,7 @@
63
63
  "@nomiclabs/hardhat-etherscan": "^3.0.3",
64
64
  "@nomiclabs/hardhat-waffle": "^2.0.3",
65
65
  "@types/mocha": "^9.1.0",
66
- "axios": "^0.24.0",
66
+ "axios": "^0.26.1",
67
67
  "bignumber.js": "^9.0.2",
68
68
  "chai": "^4.3.6",
69
69
  "dotenv": "^16.0.0",
@@ -1,19 +1,15 @@
1
- import fetch, { Headers, Request, Response } from 'node-fetch';
1
+ import axios from 'axios';
2
2
 
3
3
  const AURORA_API_BASE_URL = 'https://api.aurorascan.dev/api';
4
4
 
5
5
  export async function getQuery(
6
6
  module: string, action: string, params: Record<string, any> = {},
7
7
  ): Promise<any> {
8
- if (!globalThis.fetch) {
9
- Object.assign(globalThis, { fetch, Headers, Request, Response })
10
- }
11
-
12
8
  params = {...params, 'module': module, 'action': action};
13
9
 
14
- let resp = await globalThis.fetch(AURORA_API_BASE_URL + '?' + new URLSearchParams(params), {
15
- headers: { 'Content-Type': 'application/json' },
16
- method: 'GET'
10
+ let resp = await axios.get(AURORA_API_BASE_URL + '?' + new URLSearchParams(params), {
11
+ headers: { 'Content-Type': 'application/json' }
17
12
  });
18
- return (await resp.json()).result!;
13
+
14
+ return resp.data.result!;
19
15
  }
@@ -120,7 +120,7 @@ function shouldFetchFromCoingecko(address: string) {
120
120
  export async function fetchPrice(address: Address, provider: providers.Provider): Promise<BigNumber> {
121
121
  if (hardcodePLYPrice && isSameAddress(address, networkAddresses.tokens.PLY)) return new BigNumber(0);
122
122
 
123
- // if (isSameAddress(address, networkAddresses.tokens.stNEAR)) return fetchStNEARPrice();
123
+ if (isSameAddress(address, networkAddresses.tokens.stNEAR)) return fetchStNEARPrice();
124
124
  if (shouldFetchFromCoingecko(address)) return fetchPriceFromCoingecko(address);
125
125
 
126
126
  const matchingAuToken = networkAddresses.auTokens.find((auToken) => {