@aurigami/sdk 1.6.2 → 1.6.4
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/consts/constants.d.ts +3 -0
- package/dist/sdk.cjs.development.js +31 -11
- 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 +31 -12
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/consts/constants.ts +10 -1
- package/src/consts/decimals.ts +1 -0
- package/src/helpers/helpers.ts +4 -1
- package/src/helpers/priceFetcher.ts +4 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -65,6 +65,10 @@ var networkAddresses = {
|
|
|
65
65
|
name: 'auPLY',
|
|
66
66
|
address: /*#__PURE__*/MAINNET_ADDRESSES.auTokens.PLY.toLowerCase(),
|
|
67
67
|
underlying: /*#__PURE__*/'0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase()
|
|
68
|
+
}, {
|
|
69
|
+
name: 'auUSN',
|
|
70
|
+
address: /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USN.toLowerCase(),
|
|
71
|
+
underlying: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase()
|
|
68
72
|
}],
|
|
69
73
|
misc: {
|
|
70
74
|
COMPTROLLER: /*#__PURE__*/MAINNET_ADDRESSES.comptroller.toLowerCase(),
|
|
@@ -85,9 +89,10 @@ var networkAddresses = {
|
|
|
85
89
|
USDC: /*#__PURE__*/'0xb12bfca5a55806aaf64e99521918a4bf0fc40802'.toLowerCase(),
|
|
86
90
|
WNEAR: /*#__PURE__*/'0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d'.toLowerCase(),
|
|
87
91
|
TRI: /*#__PURE__*/'0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
|
|
88
|
-
META: /*#__PURE__*/'0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.
|
|
92
|
+
META: /*#__PURE__*/'0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLowerCase(),
|
|
89
93
|
PULP: /*#__PURE__*/MAINNET_ADDRESSES.PULP.toLowerCase(),
|
|
90
|
-
PLYWNEAR: /*#__PURE__*/MAINNET_ADDRESSES.ply_wnear_lp.toLowerCase()
|
|
94
|
+
PLYWNEAR: /*#__PURE__*/MAINNET_ADDRESSES.ply_wnear_lp.toLowerCase(),
|
|
95
|
+
USN: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase()
|
|
91
96
|
}
|
|
92
97
|
}; // All token that we can calculate the price via oracle + coingecko
|
|
93
98
|
|
|
@@ -124,6 +129,7 @@ Object.entries({
|
|
|
124
129
|
}));
|
|
125
130
|
var BORROW_NEAR_REWARDS_PER_WEEK = {// currently 0 for all markets
|
|
126
131
|
};
|
|
132
|
+
var HARDCODE_PRICE_TOKENS = /*#__PURE__*/Object.fromEntries([[/*#__PURE__*/networkAddresses.tokens.USN.toLowerCase(), '1']]);
|
|
127
133
|
|
|
128
134
|
var decimalRecords = {
|
|
129
135
|
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
|
|
@@ -147,7 +153,8 @@ var decimalRecords = {
|
|
|
147
153
|
'0xf4eb217ba2454613b15dbdea6e5f22276410e89e': 8,
|
|
148
154
|
'0xc21ff01229e982d7c8b8691163b0a3cb8f357453': 24,
|
|
149
155
|
'0x04ac48711bcdc45b4d223fb021e09da73c71095e': 18,
|
|
150
|
-
'0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18
|
|
156
|
+
'0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18,
|
|
157
|
+
'0x5183e1b1091804bc2602586919e6880ac1cf2896': 18
|
|
151
158
|
};
|
|
152
159
|
|
|
153
160
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -1126,9 +1133,13 @@ function getDecimal(address) {
|
|
|
1126
1133
|
return decimalRecords[addressLowercase];
|
|
1127
1134
|
}
|
|
1128
1135
|
function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
1136
|
+
if (rewardsValue.isZero()) {
|
|
1137
|
+
return new BigNumber(0);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1129
1140
|
if (totalStakeValue.lte(0)) {
|
|
1130
1141
|
// avoid division by zero when there is no stake
|
|
1131
|
-
return
|
|
1142
|
+
return rewardsValue;
|
|
1132
1143
|
}
|
|
1133
1144
|
|
|
1134
1145
|
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
@@ -2621,33 +2632,41 @@ function _fetchPrice3() {
|
|
|
2621
2632
|
while (1) {
|
|
2622
2633
|
switch (_context10.prev = _context10.next) {
|
|
2623
2634
|
case 0:
|
|
2624
|
-
if (!
|
|
2635
|
+
if (!(address.toLowerCase() in HARDCODE_PRICE_TOKENS)) {
|
|
2625
2636
|
_context10.next = 4;
|
|
2626
2637
|
break;
|
|
2627
2638
|
}
|
|
2628
2639
|
|
|
2629
|
-
return _context10.abrupt("return",
|
|
2640
|
+
return _context10.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
|
|
2630
2641
|
|
|
2631
2642
|
case 4:
|
|
2632
|
-
if (!isSameAddress(address, networkAddresses.tokens.
|
|
2643
|
+
if (!isSameAddress(address, networkAddresses.tokens.PLYWNEAR)) {
|
|
2633
2644
|
_context10.next = 8;
|
|
2634
2645
|
break;
|
|
2635
2646
|
}
|
|
2636
2647
|
|
|
2637
|
-
return _context10.abrupt("return",
|
|
2648
|
+
return _context10.abrupt("return", fetchLPPrice(address, provider));
|
|
2638
2649
|
|
|
2639
2650
|
case 8:
|
|
2651
|
+
if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
|
|
2652
|
+
_context10.next = 12;
|
|
2653
|
+
break;
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
return _context10.abrupt("return", fetchPLYPrice(provider));
|
|
2657
|
+
|
|
2658
|
+
case 12:
|
|
2640
2659
|
if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
|
|
2641
|
-
_context10.next =
|
|
2660
|
+
_context10.next = 14;
|
|
2642
2661
|
break;
|
|
2643
2662
|
}
|
|
2644
2663
|
|
|
2645
2664
|
return _context10.abrupt("return", fetchPULPPrice(provider));
|
|
2646
2665
|
|
|
2647
|
-
case
|
|
2666
|
+
case 14:
|
|
2648
2667
|
return _context10.abrupt("return", _fetchPrice(address, provider));
|
|
2649
2668
|
|
|
2650
|
-
case
|
|
2669
|
+
case 15:
|
|
2651
2670
|
case "end":
|
|
2652
2671
|
return _context10.stop();
|
|
2653
2672
|
}
|
|
@@ -108342,5 +108361,5 @@ BigNumber.config({
|
|
|
108342
108361
|
DECIMAL_PLACES: 50
|
|
108343
108362
|
});
|
|
108344
108363
|
|
|
108345
|
-
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, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, 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, getQuery, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
|
|
108364
|
+
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, HARDCODE_PRICE_TOKENS, 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, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, 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, getQuery, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
|
|
108346
108365
|
//# sourceMappingURL=sdk.esm.js.map
|