@aurigami/sdk 1.18.6 → 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 +42 -32
- 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 +42 -32
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/priceFetcher.ts +15 -9
- package/src/interactors/MoneyMarket.ts +1 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -1494,16 +1494,23 @@ function fetchPriceFromKyberSwap(_x5, _x6, _x7) {
|
|
|
1494
1494
|
}
|
|
1495
1495
|
function _fetchPriceFromKyberSwap() {
|
|
1496
1496
|
_fetchPriceFromKyberSwap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(address, provider, onAurora) {
|
|
1497
|
-
var _yield$prepareParamsA2, tokenInQuantity, usdtAddress, usdtDecimal, info, outputAmount;
|
|
1497
|
+
var ETH_PROVIDER, _yield$prepareParamsA2, tokenInQuantity, usdtAddress, usdtDecimal, info, outputAmount;
|
|
1498
1498
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1499
1499
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1500
1500
|
case 0:
|
|
1501
1501
|
if (onAurora === void 0) {
|
|
1502
1502
|
onAurora = true;
|
|
1503
1503
|
}
|
|
1504
|
-
|
|
1504
|
+
if (!(address == networkAddresses.tokens.STADER)) {
|
|
1505
|
+
_context3.next = 4;
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1508
|
+
ETH_PROVIDER = new ethers.providers.JsonRpcProvider('https://rpc.ankr.com/eth');
|
|
1509
|
+
return _context3.abrupt("return", fetchPriceFromKyberSwap(STADER_ETH, ETH_PROVIDER, false));
|
|
1510
|
+
case 4:
|
|
1511
|
+
_context3.next = 6;
|
|
1505
1512
|
return prepareParamsAggregator(address, provider);
|
|
1506
|
-
case
|
|
1513
|
+
case 6:
|
|
1507
1514
|
_yield$prepareParamsA2 = _context3.sent;
|
|
1508
1515
|
tokenInQuantity = _yield$prepareParamsA2.tokenInQuantity;
|
|
1509
1516
|
usdtAddress = _yield$prepareParamsA2.usdtAddress;
|
|
@@ -1511,13 +1518,13 @@ function _fetchPriceFromKyberSwap() {
|
|
|
1511
1518
|
if (!onAurora) {
|
|
1512
1519
|
usdtAddress = USDT_ETH;
|
|
1513
1520
|
}
|
|
1514
|
-
_context3.next =
|
|
1521
|
+
_context3.next = 13;
|
|
1515
1522
|
return getSwapInfo(address, usdtAddress, tokenInQuantity, onAurora);
|
|
1516
|
-
case
|
|
1523
|
+
case 13:
|
|
1517
1524
|
info = _context3.sent;
|
|
1518
1525
|
outputAmount = info.outputAmount;
|
|
1519
1526
|
return _context3.abrupt("return", new BigNumber(outputAmount).dividedBy(Math.pow(10, usdtDecimal)));
|
|
1520
|
-
case
|
|
1527
|
+
case 16:
|
|
1521
1528
|
case "end":
|
|
1522
1529
|
return _context3.stop();
|
|
1523
1530
|
}
|
|
@@ -1585,28 +1592,36 @@ function _fetchPriceFromCoingeckoAPI() {
|
|
|
1585
1592
|
}));
|
|
1586
1593
|
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
1587
1594
|
}
|
|
1588
|
-
function
|
|
1589
|
-
return
|
|
1595
|
+
function fetchPriceFromDefiLlamaAndCoingecko(_x10) {
|
|
1596
|
+
return _fetchPriceFromDefiLlamaAndCoingecko.apply(this, arguments);
|
|
1590
1597
|
}
|
|
1591
|
-
function
|
|
1592
|
-
|
|
1598
|
+
function _fetchPriceFromDefiLlamaAndCoingecko() {
|
|
1599
|
+
_fetchPriceFromDefiLlamaAndCoingecko = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
|
|
1593
1600
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1594
1601
|
while (1) switch (_context6.prev = _context6.next) {
|
|
1595
1602
|
case 0:
|
|
1596
1603
|
if (!(id.toLowerCase() == networkAddresses.tokens.AURORA || id.toLowerCase() == networkAddresses.tokens.TRI || id.toLowerCase() == networkAddresses.tokens.META)) {
|
|
1597
|
-
_context6.next =
|
|
1604
|
+
_context6.next = 4;
|
|
1598
1605
|
break;
|
|
1599
1606
|
}
|
|
1600
|
-
return _context6.abrupt("return", fetchPriceFromDefiLlamaAPI("aurora:" + id.toLowerCase()))
|
|
1601
|
-
|
|
1607
|
+
return _context6.abrupt("return", fetchPriceFromDefiLlamaAPI("aurora:" + id.toLowerCase())["catch"](function (e) {
|
|
1608
|
+
return fetchPriceFromCoingecko(id);
|
|
1609
|
+
}));
|
|
1610
|
+
case 4:
|
|
1611
|
+
if (!(id.toLowerCase() == networkAddresses.tokens.STADER)) {
|
|
1612
|
+
_context6.next = 6;
|
|
1613
|
+
break;
|
|
1614
|
+
}
|
|
1615
|
+
return _context6.abrupt("return", fetchPriceFromCoingecko(id));
|
|
1616
|
+
case 6:
|
|
1602
1617
|
throw Error("Unknown token " + id + " in fetchPriceFromDefiLlama");
|
|
1603
|
-
case
|
|
1618
|
+
case 7:
|
|
1604
1619
|
case "end":
|
|
1605
1620
|
return _context6.stop();
|
|
1606
1621
|
}
|
|
1607
1622
|
}, _callee6);
|
|
1608
1623
|
}));
|
|
1609
|
-
return
|
|
1624
|
+
return _fetchPriceFromDefiLlamaAndCoingecko.apply(this, arguments);
|
|
1610
1625
|
}
|
|
1611
1626
|
function fetchPriceFromCoingecko(_x11) {
|
|
1612
1627
|
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
@@ -1871,35 +1886,30 @@ function _fetchPrice(_x20, _x21) {
|
|
|
1871
1886
|
}
|
|
1872
1887
|
function _fetchPrice2() {
|
|
1873
1888
|
_fetchPrice2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(address, provider) {
|
|
1874
|
-
var
|
|
1889
|
+
var matchingAuToken;
|
|
1875
1890
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1876
1891
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1877
1892
|
case 0:
|
|
1878
1893
|
assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
|
|
1879
1894
|
if (!shouldFetchFromKyberSwap(address)) {
|
|
1880
|
-
_context14.next =
|
|
1881
|
-
break;
|
|
1882
|
-
}
|
|
1883
|
-
if (!(address == networkAddresses.tokens.STADER)) {
|
|
1884
|
-
_context14.next = 5;
|
|
1895
|
+
_context14.next = 3;
|
|
1885
1896
|
break;
|
|
1886
1897
|
}
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
case 6:
|
|
1898
|
+
return _context14.abrupt("return", fetchPriceFromKyberSwap(address, provider)["catch"](function (e) {
|
|
1899
|
+
return fetchPriceFromDefiLlamaAndCoingecko(address);
|
|
1900
|
+
}));
|
|
1901
|
+
case 3:
|
|
1892
1902
|
matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
|
|
1893
1903
|
return isSameAddress(auToken.underlying, address);
|
|
1894
1904
|
});
|
|
1895
1905
|
if (!(matchingAuToken !== undefined)) {
|
|
1896
|
-
_context14.next =
|
|
1906
|
+
_context14.next = 8;
|
|
1897
1907
|
break;
|
|
1898
1908
|
}
|
|
1899
1909
|
return _context14.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
|
|
1900
|
-
case
|
|
1910
|
+
case 8:
|
|
1901
1911
|
throw Error("Unable to fetch price for " + address);
|
|
1902
|
-
case
|
|
1912
|
+
case 9:
|
|
1903
1913
|
case "end":
|
|
1904
1914
|
return _context14.stop();
|
|
1905
1915
|
}
|
|
@@ -2463,7 +2473,7 @@ var helpers = {
|
|
|
2463
2473
|
fetchPriceFromKyberSwap: fetchPriceFromKyberSwap,
|
|
2464
2474
|
fetchPriceFromDefiLlamaAPI: fetchPriceFromDefiLlamaAPI,
|
|
2465
2475
|
fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
|
|
2466
|
-
|
|
2476
|
+
fetchPriceFromDefiLlamaAndCoingecko: fetchPriceFromDefiLlamaAndCoingecko,
|
|
2467
2477
|
fetchPriceFromCoingecko: fetchPriceFromCoingecko,
|
|
2468
2478
|
fetchLPPositions: fetchLPPositions,
|
|
2469
2479
|
fetchLPPrice: fetchLPPrice,
|
|
@@ -2966,7 +2976,7 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2966
2976
|
}
|
|
2967
2977
|
_context14.t0 = helpers;
|
|
2968
2978
|
_context14.next = 13;
|
|
2969
|
-
return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.STADER, '
|
|
2979
|
+
return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.STADER, '50', false), this._networkConnection.provider);
|
|
2970
2980
|
case 13:
|
|
2971
2981
|
_context14.t1 = _context14.sent;
|
|
2972
2982
|
_context14.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
|
|
@@ -5981,5 +5991,5 @@ BigNumber.config({
|
|
|
5981
5991
|
DECIMAL_PLACES: 50
|
|
5982
5992
|
});
|
|
5983
5993
|
|
|
5984
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT, 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, PlyGame, PlyGameRead, PlyGameReadWrite, PlyTokenLock, PlyTokenLockRead, PlyTokenLockReadWrite, Pulp, PulpRead, PulpReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SD_INCENTIVE_IN_SD, STADER_ETH, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, USDT_ETH, index as abis, assert, calcLMRewardApr, calcNetApy, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI,
|
|
5994
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT, 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, PlyGame, PlyGameRead, PlyGameReadWrite, PlyTokenLock, PlyTokenLockRead, PlyTokenLockReadWrite, Pulp, PulpRead, PulpReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SD_INCENTIVE_IN_SD, STADER_ETH, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, USDT_ETH, index as abis, assert, calcLMRewardApr, calcNetApy, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlamaAPI, fetchPriceFromDefiLlamaAndCoingecko, fetchPriceFromKyberSwap, fetchPriceFromOneInch, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, prepareParamsAggregator, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
5985
5995
|
//# sourceMappingURL=sdk.esm.js.map
|