@aurigami/sdk 1.18.7 → 1.18.8
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/helpers/priceFetcher.d.ts +1 -1
- package/dist/sdk.cjs.development.js +41 -31
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +41 -31
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/priceFetcher.ts +15 -9
|
@@ -11,7 +11,7 @@ export declare function fetchPriceFromOneInch(address: string, provider: provide
|
|
|
11
11
|
export declare function fetchPriceFromKyberSwap(address: string, provider: providers.Provider, onAurora?: boolean): Promise<BigNumber>;
|
|
12
12
|
export declare function fetchPriceFromDefiLlamaAPI(id: string): Promise<BigNumber>;
|
|
13
13
|
export declare function fetchPriceFromCoingeckoAPI(id: string): Promise<BigNumber>;
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function fetchPriceFromDefiLlamaAndCoingecko(id: Address): Promise<BigNumber>;
|
|
15
15
|
export declare function fetchPriceFromCoingecko(id: Address): Promise<BigNumber>;
|
|
16
16
|
export declare function fetchLPPositions(LPAddress: Address, provider: providers.Provider): Promise<{
|
|
17
17
|
token0: Address;
|
|
@@ -1499,16 +1499,23 @@ function fetchPriceFromKyberSwap(_x5, _x6, _x7) {
|
|
|
1499
1499
|
}
|
|
1500
1500
|
function _fetchPriceFromKyberSwap() {
|
|
1501
1501
|
_fetchPriceFromKyberSwap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(address, provider, onAurora) {
|
|
1502
|
-
var _yield$prepareParamsA2, tokenInQuantity, usdtAddress, usdtDecimal, info, outputAmount;
|
|
1502
|
+
var ETH_PROVIDER, _yield$prepareParamsA2, tokenInQuantity, usdtAddress, usdtDecimal, info, outputAmount;
|
|
1503
1503
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1504
1504
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1505
1505
|
case 0:
|
|
1506
1506
|
if (onAurora === void 0) {
|
|
1507
1507
|
onAurora = true;
|
|
1508
1508
|
}
|
|
1509
|
-
|
|
1509
|
+
if (!(address == networkAddresses.tokens.STADER)) {
|
|
1510
|
+
_context3.next = 4;
|
|
1511
|
+
break;
|
|
1512
|
+
}
|
|
1513
|
+
ETH_PROVIDER = new ethers.ethers.providers.JsonRpcProvider('https://rpc.ankr.com/eth');
|
|
1514
|
+
return _context3.abrupt("return", fetchPriceFromKyberSwap(STADER_ETH, ETH_PROVIDER, false));
|
|
1515
|
+
case 4:
|
|
1516
|
+
_context3.next = 6;
|
|
1510
1517
|
return prepareParamsAggregator(address, provider);
|
|
1511
|
-
case
|
|
1518
|
+
case 6:
|
|
1512
1519
|
_yield$prepareParamsA2 = _context3.sent;
|
|
1513
1520
|
tokenInQuantity = _yield$prepareParamsA2.tokenInQuantity;
|
|
1514
1521
|
usdtAddress = _yield$prepareParamsA2.usdtAddress;
|
|
@@ -1516,13 +1523,13 @@ function _fetchPriceFromKyberSwap() {
|
|
|
1516
1523
|
if (!onAurora) {
|
|
1517
1524
|
usdtAddress = USDT_ETH;
|
|
1518
1525
|
}
|
|
1519
|
-
_context3.next =
|
|
1526
|
+
_context3.next = 13;
|
|
1520
1527
|
return getSwapInfo(address, usdtAddress, tokenInQuantity, onAurora);
|
|
1521
|
-
case
|
|
1528
|
+
case 13:
|
|
1522
1529
|
info = _context3.sent;
|
|
1523
1530
|
outputAmount = info.outputAmount;
|
|
1524
1531
|
return _context3.abrupt("return", new BigNumber(outputAmount).dividedBy(Math.pow(10, usdtDecimal)));
|
|
1525
|
-
case
|
|
1532
|
+
case 16:
|
|
1526
1533
|
case "end":
|
|
1527
1534
|
return _context3.stop();
|
|
1528
1535
|
}
|
|
@@ -1590,28 +1597,36 @@ function _fetchPriceFromCoingeckoAPI() {
|
|
|
1590
1597
|
}));
|
|
1591
1598
|
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
1592
1599
|
}
|
|
1593
|
-
function
|
|
1594
|
-
return
|
|
1600
|
+
function fetchPriceFromDefiLlamaAndCoingecko(_x10) {
|
|
1601
|
+
return _fetchPriceFromDefiLlamaAndCoingecko.apply(this, arguments);
|
|
1595
1602
|
}
|
|
1596
|
-
function
|
|
1597
|
-
|
|
1603
|
+
function _fetchPriceFromDefiLlamaAndCoingecko() {
|
|
1604
|
+
_fetchPriceFromDefiLlamaAndCoingecko = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
|
|
1598
1605
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1599
1606
|
while (1) switch (_context6.prev = _context6.next) {
|
|
1600
1607
|
case 0:
|
|
1601
1608
|
if (!(id.toLowerCase() == networkAddresses.tokens.AURORA || id.toLowerCase() == networkAddresses.tokens.TRI || id.toLowerCase() == networkAddresses.tokens.META)) {
|
|
1602
|
-
_context6.next =
|
|
1609
|
+
_context6.next = 4;
|
|
1603
1610
|
break;
|
|
1604
1611
|
}
|
|
1605
|
-
return _context6.abrupt("return", fetchPriceFromDefiLlamaAPI("aurora:" + id.toLowerCase()))
|
|
1606
|
-
|
|
1612
|
+
return _context6.abrupt("return", fetchPriceFromDefiLlamaAPI("aurora:" + id.toLowerCase())["catch"](function (e) {
|
|
1613
|
+
return fetchPriceFromCoingecko(id);
|
|
1614
|
+
}));
|
|
1615
|
+
case 4:
|
|
1616
|
+
if (!(id.toLowerCase() == networkAddresses.tokens.STADER)) {
|
|
1617
|
+
_context6.next = 6;
|
|
1618
|
+
break;
|
|
1619
|
+
}
|
|
1620
|
+
return _context6.abrupt("return", fetchPriceFromCoingecko(id));
|
|
1621
|
+
case 6:
|
|
1607
1622
|
throw Error("Unknown token " + id + " in fetchPriceFromDefiLlama");
|
|
1608
|
-
case
|
|
1623
|
+
case 7:
|
|
1609
1624
|
case "end":
|
|
1610
1625
|
return _context6.stop();
|
|
1611
1626
|
}
|
|
1612
1627
|
}, _callee6);
|
|
1613
1628
|
}));
|
|
1614
|
-
return
|
|
1629
|
+
return _fetchPriceFromDefiLlamaAndCoingecko.apply(this, arguments);
|
|
1615
1630
|
}
|
|
1616
1631
|
function fetchPriceFromCoingecko(_x11) {
|
|
1617
1632
|
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
@@ -1876,35 +1891,30 @@ function _fetchPrice(_x20, _x21) {
|
|
|
1876
1891
|
}
|
|
1877
1892
|
function _fetchPrice2() {
|
|
1878
1893
|
_fetchPrice2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(address, provider) {
|
|
1879
|
-
var
|
|
1894
|
+
var matchingAuToken;
|
|
1880
1895
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1881
1896
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1882
1897
|
case 0:
|
|
1883
1898
|
assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
|
|
1884
1899
|
if (!shouldFetchFromKyberSwap(address)) {
|
|
1885
|
-
_context14.next =
|
|
1886
|
-
break;
|
|
1887
|
-
}
|
|
1888
|
-
if (!(address == networkAddresses.tokens.STADER)) {
|
|
1889
|
-
_context14.next = 5;
|
|
1900
|
+
_context14.next = 3;
|
|
1890
1901
|
break;
|
|
1891
1902
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
case 6:
|
|
1903
|
+
return _context14.abrupt("return", fetchPriceFromKyberSwap(address, provider)["catch"](function (e) {
|
|
1904
|
+
return fetchPriceFromDefiLlamaAndCoingecko(address);
|
|
1905
|
+
}));
|
|
1906
|
+
case 3:
|
|
1897
1907
|
matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
|
|
1898
1908
|
return isSameAddress(auToken.underlying, address);
|
|
1899
1909
|
});
|
|
1900
1910
|
if (!(matchingAuToken !== undefined)) {
|
|
1901
|
-
_context14.next =
|
|
1911
|
+
_context14.next = 8;
|
|
1902
1912
|
break;
|
|
1903
1913
|
}
|
|
1904
1914
|
return _context14.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
|
|
1905
|
-
case
|
|
1915
|
+
case 8:
|
|
1906
1916
|
throw Error("Unable to fetch price for " + address);
|
|
1907
|
-
case
|
|
1917
|
+
case 9:
|
|
1908
1918
|
case "end":
|
|
1909
1919
|
return _context14.stop();
|
|
1910
1920
|
}
|
|
@@ -2468,7 +2478,7 @@ var helpers = {
|
|
|
2468
2478
|
fetchPriceFromKyberSwap: fetchPriceFromKyberSwap,
|
|
2469
2479
|
fetchPriceFromDefiLlamaAPI: fetchPriceFromDefiLlamaAPI,
|
|
2470
2480
|
fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
|
|
2471
|
-
|
|
2481
|
+
fetchPriceFromDefiLlamaAndCoingecko: fetchPriceFromDefiLlamaAndCoingecko,
|
|
2472
2482
|
fetchPriceFromCoingecko: fetchPriceFromCoingecko,
|
|
2473
2483
|
fetchLPPositions: fetchLPPositions,
|
|
2474
2484
|
fetchLPPrice: fetchLPPrice,
|
|
@@ -6080,8 +6090,8 @@ exports.fetchPULPPrice = fetchPULPPrice;
|
|
|
6080
6090
|
exports.fetchPrice = fetchPrice;
|
|
6081
6091
|
exports.fetchPriceFromCoingecko = fetchPriceFromCoingecko;
|
|
6082
6092
|
exports.fetchPriceFromCoingeckoAPI = fetchPriceFromCoingeckoAPI;
|
|
6083
|
-
exports.fetchPriceFromDefiLlama = fetchPriceFromDefiLlama;
|
|
6084
6093
|
exports.fetchPriceFromDefiLlamaAPI = fetchPriceFromDefiLlamaAPI;
|
|
6094
|
+
exports.fetchPriceFromDefiLlamaAndCoingecko = fetchPriceFromDefiLlamaAndCoingecko;
|
|
6085
6095
|
exports.fetchPriceFromKyberSwap = fetchPriceFromKyberSwap;
|
|
6086
6096
|
exports.fetchPriceFromOneInch = fetchPriceFromOneInch;
|
|
6087
6097
|
exports.fetchPriceFromOracle = fetchPriceFromOracle;
|