@aurigami/sdk 0.7.1 → 0.7.3
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 +41 -9
- 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 -9
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/MoneyMarket.ts +5 -1
- package/src/SDK.ts +2 -1
package/package.json
CHANGED
package/src/MoneyMarket.ts
CHANGED
|
@@ -210,7 +210,11 @@ export class MoneyMarketReadWrite extends MoneyMarketRead {
|
|
|
210
210
|
public async repay(amount: TokenAmount): Promise<TransactionResponse> {
|
|
211
211
|
var repayAmount: BN;
|
|
212
212
|
if (new BigNumber(amount.rawAmount()).lt(0)) {
|
|
213
|
-
|
|
213
|
+
if (isSameAddress(amount.token.address, ETHAddress)) {
|
|
214
|
+
repayAmount = BN.from((await this.getUserBorrowBalance(await this._networkConnection.signer!.getAddress())).rawAmount());
|
|
215
|
+
} else {
|
|
216
|
+
repayAmount = INF;
|
|
217
|
+
}
|
|
214
218
|
} else {
|
|
215
219
|
repayAmount = BN.from(amount.rawAmount());
|
|
216
220
|
}
|
package/src/SDK.ts
CHANGED
|
@@ -128,7 +128,8 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
128
128
|
for (var i = 0; i < marketCount; i ++) {
|
|
129
129
|
const auToken = networkAddresses.auTokens[i];
|
|
130
130
|
const moneyMarket: MoneyMarketRead = new MoneyMarketRead(this._networkConnection, auToken.address, auToken.underlying);
|
|
131
|
-
const
|
|
131
|
+
const borrowLimitMargin = totalBorrowLimit.minus(minimumBorrowLimitAllowed).gt(0) ? totalBorrowLimit.minus(minimumBorrowLimitAllowed) : new BigNumber(0);
|
|
132
|
+
const maxWithdrawCap: BigNumber = borrowLimitMargin.div(userMarketDetails[i].collateralRatio).div(underlyingPrices[i]);
|
|
132
133
|
userMarketDetails[i].maxWithdrawableAmount = userMarketDetails[i].isCollateral && maxWithdrawCap.lt(userMarketDetails[i].depositBalance.formattedAmount())
|
|
133
134
|
? new TokenAmount(
|
|
134
135
|
moneyMarket.underlying,
|