@aurigami/sdk 1.15.1 → 1.15.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.d.ts +1 -0
- package/dist/interactors/MoneyMarket.d.ts +1 -1
- package/dist/sdk.cjs.development.js +53 -21
- 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 +53 -21
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +9 -0
- package/package.json +1 -1
- package/src/SDK.ts +10 -0
- package/src/interactors/MoneyMarket.ts +4 -6
- package/src/interactors/misc.ts +6 -5
- package/src/types/index.ts +10 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -168,3 +168,12 @@ export declare type Apy = {
|
|
|
168
168
|
suppliedValue: BigNumber;
|
|
169
169
|
borrowedValue: BigNumber;
|
|
170
170
|
};
|
|
171
|
+
export declare type UserNotification = {
|
|
172
|
+
message: string;
|
|
173
|
+
userSetting: {
|
|
174
|
+
address: Address;
|
|
175
|
+
mail: string;
|
|
176
|
+
utilisation: number;
|
|
177
|
+
liquidation: boolean;
|
|
178
|
+
};
|
|
179
|
+
};
|
package/package.json
CHANGED
package/src/SDK.ts
CHANGED
|
@@ -136,6 +136,16 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
136
136
|
const response = await NotificationApi.postApi('alert-setting/set', body);
|
|
137
137
|
return response;
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
public async getUserNotificationSettings(
|
|
141
|
+
addresses: types.Address[]
|
|
142
|
+
): Promise<types.UserNotification> {
|
|
143
|
+
const body = {
|
|
144
|
+
addresses,
|
|
145
|
+
};
|
|
146
|
+
const response = await NotificationApi.postApi('alert-setting/get-user-setting', body);
|
|
147
|
+
return response;
|
|
148
|
+
}
|
|
139
149
|
}
|
|
140
150
|
|
|
141
151
|
export class SdkReadWrite extends SdkRead {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuETH, AuErc20, EthRepayHelper } from '@aurigami/contracts/typechain';
|
|
2
2
|
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
3
3
|
import BigNumber from 'bignumber.js';
|
|
4
|
+
import { CacheType, cache } from 'cache-decorator';
|
|
4
5
|
import { BigNumber as BN, Contract } from 'ethers';
|
|
5
6
|
import * as abis from '../abis';
|
|
6
7
|
import * as consts from '../consts';
|
|
@@ -18,12 +19,9 @@ import { calcValuation, fetchPrice, fetchValuation } from '../helpers/priceFetch
|
|
|
18
19
|
import {
|
|
19
20
|
Address,
|
|
20
21
|
Apy,
|
|
21
|
-
ComptrollerRewardType,
|
|
22
22
|
MoneyMarketDetails,
|
|
23
|
-
NetworkConnection
|
|
23
|
+
NetworkConnection
|
|
24
24
|
} from '../types';
|
|
25
|
-
import { getUnderlying } from '../helpers/helpers';
|
|
26
|
-
import { cache, CacheType } from 'cache-decorator';
|
|
27
25
|
|
|
28
26
|
type RewardSpeeds = {
|
|
29
27
|
plyRewardSupplySpeed: BN;
|
|
@@ -189,7 +187,7 @@ export class MoneyMarketRead extends BlockchainEntityRead {
|
|
|
189
187
|
if (helpers.isSameAddress(this.underlying.address, consts.networkAddresses.tokens.stNEAR)) {
|
|
190
188
|
depositMETAApy = helpers.calcLMRewardApr(
|
|
191
189
|
await fetchValuation(
|
|
192
|
-
TokenAmount.fromAddressAndAmount(consts.networkAddresses.tokens.META, '
|
|
190
|
+
TokenAmount.fromAddressAndAmount(consts.networkAddresses.tokens.META, '1000000', false),
|
|
193
191
|
this._networkConnection.provider
|
|
194
192
|
),
|
|
195
193
|
underlyingPrice.multipliedBy(totalDeposited.formattedAmount()),
|
package/src/interactors/misc.ts
CHANGED
|
@@ -113,12 +113,12 @@ export class MiscRead extends BlockchainEntityRead {
|
|
|
113
113
|
.div(userMarketDetails[i].underlyingPrice);
|
|
114
114
|
userMarketDetails[i].maxWithdrawableAmount =
|
|
115
115
|
userMarketDetails[i].isCollateral &&
|
|
116
|
-
|
|
116
|
+
maxWithdrawCap.lt(userMarketDetails[i].depositBalance.formattedAmount())
|
|
117
117
|
? new TokenAmount(moneyMarket.underlying, maxWithdrawCap.toFixed(24), false)
|
|
118
118
|
: new TokenAmount(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
moneyMarket.underlying,
|
|
120
|
+
userMarketDetails[i].depositBalance.rawAmount()
|
|
121
|
+
);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
return {
|
|
@@ -258,7 +258,8 @@ export class MiscRead extends BlockchainEntityRead {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
public async getUtilisation(userAddr: types.Address): Promise<BigNumber> {
|
|
261
|
-
let accountDetail =
|
|
261
|
+
let accountDetail =
|
|
262
|
+
await this.env.auriInternalLens.callStatic.getAccountLiquidityAccrueInterest(userAddr);
|
|
262
263
|
let sumBorrow = new BigNumber(accountDetail.sumBorrowPlusEffects.toString());
|
|
263
264
|
let sumCol = new BigNumber(accountDetail.sumCollateral.toString());
|
|
264
265
|
return sumBorrow.dividedBy(sumCol);
|
package/src/types/index.ts
CHANGED
|
@@ -189,3 +189,13 @@ export type Apy = {
|
|
|
189
189
|
suppliedValue: BigNumber;
|
|
190
190
|
borrowedValue: BigNumber;
|
|
191
191
|
};
|
|
192
|
+
|
|
193
|
+
export type UserNotification = {
|
|
194
|
+
message: string;
|
|
195
|
+
userSetting: {
|
|
196
|
+
address: Address;
|
|
197
|
+
mail: string;
|
|
198
|
+
utilisation: number;
|
|
199
|
+
liquidation: boolean;
|
|
200
|
+
};
|
|
201
|
+
};
|