@aurigami/sdk 0.3.3 → 0.3.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/sdk.cjs.development.js +21 -23
- 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 +21 -23
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/SDK.ts +4 -8
- package/src/types.ts +1 -0
|
@@ -2956,11 +2956,10 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2956
2956
|
while (1) {
|
|
2957
2957
|
switch (_context.prev = _context.next) {
|
|
2958
2958
|
case 0:
|
|
2959
|
-
|
|
2960
|
-
_context.next = 3;
|
|
2959
|
+
_context.next = 2;
|
|
2961
2960
|
return getCurrentTimestamp(this._networkConnection.provider);
|
|
2962
2961
|
|
|
2963
|
-
case
|
|
2962
|
+
case 2:
|
|
2964
2963
|
currentTime = _context.sent;
|
|
2965
2964
|
currentWeek = ethers$1.BigNumber.from(currentTime - REWARDCLAIMSTART).div(7 * ONE_DAY).toNumber();
|
|
2966
2965
|
denominator = 10000;
|
|
@@ -2969,14 +2968,14 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2969
2968
|
promises.push(this._tokenLock.percentageLock(currentWeek + 1)["catch"](function (err) {
|
|
2970
2969
|
return denominator;
|
|
2971
2970
|
}));
|
|
2972
|
-
_context.next =
|
|
2971
|
+
_context.next = 10;
|
|
2973
2972
|
return Promise.all(promises).then(function (res) {
|
|
2974
2973
|
return res.map(function (v) {
|
|
2975
2974
|
return v.toString();
|
|
2976
2975
|
});
|
|
2977
2976
|
});
|
|
2978
2977
|
|
|
2979
|
-
case
|
|
2978
|
+
case 10:
|
|
2980
2979
|
values = _context.sent;
|
|
2981
2980
|
return _context.abrupt("return", {
|
|
2982
2981
|
vestingStart: REWARDCLAIMSTART,
|
|
@@ -2984,7 +2983,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2984
2983
|
nextUnlockPortion: new BigNumber(denominator).minus(values[1]).div(denominator).toNumber()
|
|
2985
2984
|
});
|
|
2986
2985
|
|
|
2987
|
-
case
|
|
2986
|
+
case 12:
|
|
2988
2987
|
case "end":
|
|
2989
2988
|
return _context.stop();
|
|
2990
2989
|
}
|
|
@@ -3003,7 +3002,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3003
3002
|
var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddress) {
|
|
3004
3003
|
var _this2 = this;
|
|
3005
3004
|
|
|
3006
|
-
var marketCount, userMarketDetails, assetsIn,
|
|
3005
|
+
var marketCount, userMarketDetails, assetsIn, promises, totalBorrowLimit, pricePromises, _loop2, _iterator, _step, underlyingPrices, depositValuationPromises, _loop, i, depositValues, accountLiquidity, rewardBalancesMetadata, lockedAmount, values, borrowedvaluation, bufferedBorrowLimit, borrowableAmount, auToken, moneyMarket;
|
|
3007
3006
|
|
|
3008
3007
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
3009
3008
|
while (1) {
|
|
@@ -3011,7 +3010,6 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3011
3010
|
case 0:
|
|
3012
3011
|
marketCount = networkAddresses.auTokens.length;
|
|
3013
3012
|
userMarketDetails = [];
|
|
3014
|
-
collateralRatio = new Array(marketCount);
|
|
3015
3013
|
promises = [];
|
|
3016
3014
|
totalBorrowLimit = new BigNumber(0);
|
|
3017
3015
|
pricePromises = [];
|
|
@@ -3029,7 +3027,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3029
3027
|
userMarketDetail.borrowBalance = res;
|
|
3030
3028
|
}));
|
|
3031
3029
|
promises.push(moneyMarket.getCollateralRatio().then(function (res) {
|
|
3032
|
-
collateralRatio
|
|
3030
|
+
userMarketDetail.collateralRatio = res.toNumber();
|
|
3033
3031
|
}));
|
|
3034
3032
|
pricePromises.push(fetchPrice(moneyMarket.underlying.address, _this2._networkConnection.provider));
|
|
3035
3033
|
};
|
|
@@ -3041,23 +3039,23 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3041
3039
|
promises.push(this._comptroller.getAssetsIn(userAddress).then(function (res) {
|
|
3042
3040
|
assetsIn = res;
|
|
3043
3041
|
}));
|
|
3044
|
-
_context2.next =
|
|
3042
|
+
_context2.next = 10;
|
|
3045
3043
|
return Promise.all(promises);
|
|
3046
3044
|
|
|
3047
|
-
case
|
|
3048
|
-
_context2.next =
|
|
3045
|
+
case 10:
|
|
3046
|
+
_context2.next = 12;
|
|
3049
3047
|
return Promise.all(pricePromises);
|
|
3050
3048
|
|
|
3051
|
-
case
|
|
3049
|
+
case 12:
|
|
3052
3050
|
underlyingPrices = _context2.sent;
|
|
3053
3051
|
depositValuationPromises = [];
|
|
3054
3052
|
|
|
3055
3053
|
_loop = function _loop() {
|
|
3056
3054
|
var auToken = networkAddresses.auTokens[i];
|
|
3057
3055
|
|
|
3058
|
-
if (assetsIn.
|
|
3059
|
-
isSameAddress(auToken.address, auAddress);
|
|
3060
|
-
})
|
|
3056
|
+
if (assetsIn.find(function (auAddress) {
|
|
3057
|
+
return isSameAddress(auToken.address, auAddress);
|
|
3058
|
+
}) !== undefined) {
|
|
3061
3059
|
userMarketDetails[i].isCollateral = true;
|
|
3062
3060
|
} else {
|
|
3063
3061
|
userMarketDetails[i].isCollateral = false;
|
|
@@ -3070,23 +3068,23 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3070
3068
|
_loop();
|
|
3071
3069
|
}
|
|
3072
3070
|
|
|
3073
|
-
_context2.next =
|
|
3071
|
+
_context2.next = 18;
|
|
3074
3072
|
return Promise.all(depositValuationPromises);
|
|
3075
3073
|
|
|
3076
|
-
case
|
|
3074
|
+
case 18:
|
|
3077
3075
|
depositValues = _context2.sent;
|
|
3078
3076
|
totalBorrowLimit = depositValues.reduce(function (p, v, index) {
|
|
3079
|
-
if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(
|
|
3077
|
+
if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(userMarketDetails[index].collateralRatio));
|
|
3080
3078
|
return p;
|
|
3081
|
-
});
|
|
3079
|
+
}, new BigNumber(0));
|
|
3082
3080
|
promises = [];
|
|
3083
3081
|
promises.push(this._comptroller.getAccountLiquidity(userAddress));
|
|
3084
3082
|
promises.push(this._auriLens.callStatic.getRewardBalancesMetadata(this._comptroller.address, this._auriFairLaunch.address, userAddress, [AurPlyPid]));
|
|
3085
3083
|
promises.push(this._tokenLock.lockedAmounts(userAddress));
|
|
3086
|
-
_context2.next =
|
|
3084
|
+
_context2.next = 26;
|
|
3087
3085
|
return Promise.all(promises);
|
|
3088
3086
|
|
|
3089
|
-
case
|
|
3087
|
+
case 26:
|
|
3090
3088
|
values = _context2.sent;
|
|
3091
3089
|
accountLiquidity = values[0];
|
|
3092
3090
|
rewardBalancesMetadata = values[1];
|
|
@@ -3120,7 +3118,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3120
3118
|
}
|
|
3121
3119
|
});
|
|
3122
3120
|
|
|
3123
|
-
case
|
|
3121
|
+
case 35:
|
|
3124
3122
|
case "end":
|
|
3125
3123
|
return _context2.stop();
|
|
3126
3124
|
}
|