@aurigami/sdk 1.5.4 → 1.5.5
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/constants.d.ts +1 -1
- package/dist/priceFetcher.d.ts +1 -0
- package/dist/sdk.cjs.development.js +77 -43
- 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 +77 -44
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/constants.ts +10 -3
- package/src/deployments/aurora_mainnet.json +4 -3
- package/src/helpers.ts +2 -1
- package/src/priceFetcher.ts +13 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -956,11 +956,15 @@ var networkAddresses = {
|
|
|
956
956
|
name: 'auTRI',
|
|
957
957
|
address: /*#__PURE__*/'0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca'.toLowerCase(),
|
|
958
958
|
underlying: /*#__PURE__*/'0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase()
|
|
959
|
+
}, {
|
|
960
|
+
name: 'auPLY',
|
|
961
|
+
address: /*#__PURE__*/'0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c'.toLowerCase(),
|
|
962
|
+
underlying: /*#__PURE__*/'0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase()
|
|
959
963
|
}],
|
|
960
964
|
misc: {
|
|
961
965
|
COMPTROLLER: /*#__PURE__*/'0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb'.toLowerCase(),
|
|
962
966
|
oracle: /*#__PURE__*/'0xC6e5185438e1730959c1eF3551059A3feC744E90'.toLowerCase(),
|
|
963
|
-
AURIFAIRLAUNCH: /*#__PURE__*/'
|
|
967
|
+
AURIFAIRLAUNCH: /*#__PURE__*/'0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2'.toLowerCase(),
|
|
964
968
|
AURILENS: /*#__PURE__*/'0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70'.toLowerCase(),
|
|
965
969
|
TOKENLOCK: /*#__PURE__*/'0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
|
|
966
970
|
ETHREPAYHELPER: /*#__PURE__*/'0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6'.toLowerCase(),
|
|
@@ -981,13 +985,13 @@ var networkAddresses = {
|
|
|
981
985
|
var PRICE_WHITELISTED = /*#__PURE__*/new Set( /*#__PURE__*/[].concat( /*#__PURE__*/networkAddresses.auTokens.map(function (t) {
|
|
982
986
|
return t.underlying;
|
|
983
987
|
}), [networkAddresses.tokens.AURORA, networkAddresses.tokens.TRI, networkAddresses.tokens.META, networkAddresses.tokens.stNEAR]));
|
|
984
|
-
var REWARD_CLAIM_START =
|
|
988
|
+
var REWARD_CLAIM_START = 1651759200;
|
|
985
989
|
var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(1);
|
|
986
990
|
var ONE_DAY = 86400;
|
|
987
991
|
var ONE_WEEK = ONE_DAY * 7;
|
|
988
992
|
var ONE_YEAR = ONE_DAY * 365;
|
|
989
993
|
var PLYWNEAR_POOL_ID = 0;
|
|
990
|
-
var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
|
|
994
|
+
var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0x04Ac48711BCdc45b4d223fb021E09DA73c71095e', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
|
|
991
995
|
var ALL_STAKING_POOLS = [];
|
|
992
996
|
var INF = /*#__PURE__*/BigNumber$1.from(2).pow(256).sub(1);
|
|
993
997
|
var AIRDROP_START_TIMESTAMP = 1649858400;
|
|
@@ -1078,9 +1082,8 @@ function assert(condition, message) {
|
|
|
1078
1082
|
}
|
|
1079
1083
|
|
|
1080
1084
|
if (!condition) {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
throw new Error((_message = message) != null ? _message : 'Assertion failed');
|
|
1085
|
+
message = 'Assertion failed' + (message ? ': ' + message : '');
|
|
1086
|
+
throw new Error(message);
|
|
1084
1087
|
}
|
|
1085
1088
|
}
|
|
1086
1089
|
function formatObject(object) {
|
|
@@ -2349,7 +2352,7 @@ function _fetchLPPrice() {
|
|
|
2349
2352
|
return _fetchLPPriceBy.apply(this, arguments);
|
|
2350
2353
|
};
|
|
2351
2354
|
|
|
2352
|
-
fetchLPPriceBy = function _fetchLPPriceBy2(
|
|
2355
|
+
fetchLPPriceBy = function _fetchLPPriceBy2(_x23) {
|
|
2353
2356
|
return _fetchLPPriceBy.apply(this, arguments);
|
|
2354
2357
|
};
|
|
2355
2358
|
|
|
@@ -2522,7 +2525,7 @@ function _fetchPrice2() {
|
|
|
2522
2525
|
while (1) {
|
|
2523
2526
|
switch (_context9.prev = _context9.next) {
|
|
2524
2527
|
case 0:
|
|
2525
|
-
assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()));
|
|
2528
|
+
assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
|
|
2526
2529
|
|
|
2527
2530
|
if (!isSameAddress(address, networkAddresses.tokens.stNEAR)) {
|
|
2528
2531
|
_context9.next = 3;
|
|
@@ -2583,16 +2586,24 @@ function _fetchPrice3() {
|
|
|
2583
2586
|
|
|
2584
2587
|
case 4:
|
|
2585
2588
|
if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
|
|
2586
|
-
_context10.next =
|
|
2589
|
+
_context10.next = 8;
|
|
2587
2590
|
break;
|
|
2588
2591
|
}
|
|
2589
2592
|
|
|
2590
2593
|
return _context10.abrupt("return", fetchPLYPrice(provider));
|
|
2591
2594
|
|
|
2592
|
-
case
|
|
2595
|
+
case 8:
|
|
2596
|
+
if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
|
|
2597
|
+
_context10.next = 10;
|
|
2598
|
+
break;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
return _context10.abrupt("return", fetchPULPPrice(provider));
|
|
2602
|
+
|
|
2603
|
+
case 10:
|
|
2593
2604
|
return _context10.abrupt("return", _fetchPrice(address, provider));
|
|
2594
2605
|
|
|
2595
|
-
case
|
|
2606
|
+
case 11:
|
|
2596
2607
|
case "end":
|
|
2597
2608
|
return _context10.stop();
|
|
2598
2609
|
}
|
|
@@ -2624,81 +2635,103 @@ function _fetchPLYPrice() {
|
|
|
2624
2635
|
return _fetchPLYPrice.apply(this, arguments);
|
|
2625
2636
|
}
|
|
2626
2637
|
|
|
2627
|
-
function
|
|
2638
|
+
function fetchPULPPrice(_x16) {
|
|
2639
|
+
return _fetchPULPPrice.apply(this, arguments);
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
function _fetchPULPPrice() {
|
|
2643
|
+
_fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(provider) {
|
|
2644
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
2645
|
+
while (1) {
|
|
2646
|
+
switch (_context12.prev = _context12.next) {
|
|
2647
|
+
case 0:
|
|
2648
|
+
return _context12.abrupt("return", new BigNumber(0));
|
|
2649
|
+
|
|
2650
|
+
case 1:
|
|
2651
|
+
case "end":
|
|
2652
|
+
return _context12.stop();
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
}, _callee12);
|
|
2656
|
+
}));
|
|
2657
|
+
return _fetchPULPPrice.apply(this, arguments);
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
function fetchToken0PriceByLP(_x17, _x18) {
|
|
2628
2661
|
return _fetchToken0PriceByLP.apply(this, arguments);
|
|
2629
2662
|
}
|
|
2630
2663
|
|
|
2631
2664
|
function _fetchToken0PriceByLP() {
|
|
2632
|
-
_fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2665
|
+
_fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(LP, provider) {
|
|
2633
2666
|
var LPInfo, token0Decimal, token1Decimal;
|
|
2634
|
-
return runtime_1.wrap(function
|
|
2667
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
2635
2668
|
while (1) {
|
|
2636
|
-
switch (
|
|
2669
|
+
switch (_context13.prev = _context13.next) {
|
|
2637
2670
|
case 0:
|
|
2638
|
-
|
|
2671
|
+
_context13.next = 2;
|
|
2639
2672
|
return fetchLPPositions(LP, provider);
|
|
2640
2673
|
|
|
2641
2674
|
case 2:
|
|
2642
|
-
LPInfo =
|
|
2675
|
+
LPInfo = _context13.sent;
|
|
2643
2676
|
|
|
2644
2677
|
if (!LPInfo.reserve1.isZero()) {
|
|
2645
|
-
|
|
2678
|
+
_context13.next = 5;
|
|
2646
2679
|
break;
|
|
2647
2680
|
}
|
|
2648
2681
|
|
|
2649
|
-
return
|
|
2682
|
+
return _context13.abrupt("return", new BigNumber(0));
|
|
2650
2683
|
|
|
2651
2684
|
case 5:
|
|
2652
2685
|
token0Decimal = getDecimal(LPInfo.token0);
|
|
2653
2686
|
token1Decimal = getDecimal(LPInfo.token1);
|
|
2654
|
-
|
|
2687
|
+
_context13.next = 9;
|
|
2655
2688
|
return fetchPrice(LPInfo.token1, provider);
|
|
2656
2689
|
|
|
2657
2690
|
case 9:
|
|
2658
|
-
return
|
|
2691
|
+
return _context13.abrupt("return", _context13.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
2659
2692
|
|
|
2660
2693
|
case 10:
|
|
2661
2694
|
case "end":
|
|
2662
|
-
return
|
|
2695
|
+
return _context13.stop();
|
|
2663
2696
|
}
|
|
2664
2697
|
}
|
|
2665
|
-
},
|
|
2698
|
+
}, _callee13);
|
|
2666
2699
|
}));
|
|
2667
2700
|
return _fetchToken0PriceByLP.apply(this, arguments);
|
|
2668
2701
|
}
|
|
2669
2702
|
|
|
2670
|
-
function fetchValuation(
|
|
2703
|
+
function fetchValuation(_x19, _x20) {
|
|
2671
2704
|
return _fetchValuation.apply(this, arguments);
|
|
2672
2705
|
}
|
|
2673
2706
|
|
|
2674
2707
|
function _fetchValuation() {
|
|
2675
|
-
_fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2708
|
+
_fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
|
|
2676
2709
|
var price;
|
|
2677
|
-
return runtime_1.wrap(function
|
|
2710
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
2678
2711
|
while (1) {
|
|
2679
|
-
switch (
|
|
2712
|
+
switch (_context14.prev = _context14.next) {
|
|
2680
2713
|
case 0:
|
|
2681
2714
|
if (!(tokenAmount.rawAmount() == '0')) {
|
|
2682
|
-
|
|
2715
|
+
_context14.next = 2;
|
|
2683
2716
|
break;
|
|
2684
2717
|
}
|
|
2685
2718
|
|
|
2686
|
-
return
|
|
2719
|
+
return _context14.abrupt("return", new BigNumber(0));
|
|
2687
2720
|
|
|
2688
2721
|
case 2:
|
|
2689
|
-
|
|
2722
|
+
_context14.next = 4;
|
|
2690
2723
|
return fetchPrice(tokenAmount.token.address, provider);
|
|
2691
2724
|
|
|
2692
2725
|
case 4:
|
|
2693
|
-
price =
|
|
2694
|
-
return
|
|
2726
|
+
price = _context14.sent;
|
|
2727
|
+
return _context14.abrupt("return", calcValuation(tokenAmount, price));
|
|
2695
2728
|
|
|
2696
2729
|
case 6:
|
|
2697
2730
|
case "end":
|
|
2698
|
-
return
|
|
2731
|
+
return _context14.stop();
|
|
2699
2732
|
}
|
|
2700
2733
|
}
|
|
2701
|
-
},
|
|
2734
|
+
}, _callee14);
|
|
2702
2735
|
}));
|
|
2703
2736
|
return _fetchValuation.apply(this, arguments);
|
|
2704
2737
|
}
|
|
@@ -2706,23 +2739,23 @@ function _fetchValuation() {
|
|
|
2706
2739
|
function calcValuation(tokenAmount, price) {
|
|
2707
2740
|
return new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price);
|
|
2708
2741
|
}
|
|
2709
|
-
function valuateToken(
|
|
2742
|
+
function valuateToken(_x21, _x22) {
|
|
2710
2743
|
return _valuateToken.apply(this, arguments);
|
|
2711
2744
|
}
|
|
2712
2745
|
|
|
2713
2746
|
function _valuateToken() {
|
|
2714
|
-
_valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2747
|
+
_valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(tokenAmount, provider) {
|
|
2715
2748
|
var tokenValuation;
|
|
2716
|
-
return runtime_1.wrap(function
|
|
2749
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
2717
2750
|
while (1) {
|
|
2718
|
-
switch (
|
|
2751
|
+
switch (_context15.prev = _context15.next) {
|
|
2719
2752
|
case 0:
|
|
2720
|
-
|
|
2753
|
+
_context15.next = 2;
|
|
2721
2754
|
return fetchValuation(tokenAmount, provider);
|
|
2722
2755
|
|
|
2723
2756
|
case 2:
|
|
2724
|
-
tokenValuation =
|
|
2725
|
-
return
|
|
2757
|
+
tokenValuation = _context15.sent;
|
|
2758
|
+
return _context15.abrupt("return", {
|
|
2726
2759
|
tokenAmount: tokenAmount,
|
|
2727
2760
|
currencyAmount: {
|
|
2728
2761
|
currency: 'USD',
|
|
@@ -2732,10 +2765,10 @@ function _valuateToken() {
|
|
|
2732
2765
|
|
|
2733
2766
|
case 4:
|
|
2734
2767
|
case "end":
|
|
2735
|
-
return
|
|
2768
|
+
return _context15.stop();
|
|
2736
2769
|
}
|
|
2737
2770
|
}
|
|
2738
|
-
},
|
|
2771
|
+
}, _callee15);
|
|
2739
2772
|
}));
|
|
2740
2773
|
return _valuateToken.apply(this, arguments);
|
|
2741
2774
|
}
|
|
@@ -107626,5 +107659,5 @@ BigNumber.config({
|
|
|
107626
107659
|
DECIMAL_PLACES: 50
|
|
107627
107660
|
});
|
|
107628
107661
|
|
|
107629
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
|
|
107662
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
|
|
107630
107663
|
//# sourceMappingURL=sdk.esm.js.map
|