@aurigami/sdk 1.0.2 → 1.0.3-fix
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 +4 -4
- package/dist/sdk.cjs.development.js +28 -41
- 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 -44
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/SDK.ts +22 -36
package/package.json
CHANGED
package/src/SDK.ts
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
+
import AuriFairLaunchABI from "@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json";
|
|
2
|
+
import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
3
|
+
import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
|
|
4
|
+
import FaucetABI from "@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json";
|
|
5
|
+
import TokenLockABI from "@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json";
|
|
6
|
+
import { AuriFairLaunch, AuriLens, Comptroller, TokenLock } from '@aurigami/contracts/typechain';
|
|
7
|
+
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
8
|
+
import BigNumber from 'bignumber.js';
|
|
9
|
+
import { BigNumber as BN, Contract } from 'ethers';
|
|
1
10
|
import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
|
|
11
|
+
import { AurPlyPid, BORROW_LIMIT_BUFFER, DECIMAL_PRECISION, networkAddresses, ONE_DAY, REWARDCLAIMSTART } from './constants';
|
|
12
|
+
import { calcLMRewardApr, decimalFactor, getCurrentTimestamp, isSameAddress } from './helpers';
|
|
13
|
+
import { MoneyMarketRead } from './MoneyMarket';
|
|
14
|
+
import { calcValuation, fetchPrice, fetchValuation } from './priceFetcher';
|
|
15
|
+
import { AURPLYToken, PLYToken, Token } from './token';
|
|
16
|
+
import { TokenAmount } from './tokenAmount';
|
|
2
17
|
import {
|
|
3
|
-
LockingDetails,
|
|
4
|
-
PlyAuroraPoolDetails,
|
|
5
|
-
NetworkConnection,
|
|
6
|
-
UserDetails,
|
|
7
|
-
UserMarketDetails,
|
|
8
18
|
Address,
|
|
9
19
|
CurrencyAmount,
|
|
10
|
-
HypotheticalStats,
|
|
11
|
-
|
|
20
|
+
HypotheticalStats, LockingDetails, MarketAction, NetworkConnection, PlyAuroraPoolDetails, UserDetails,
|
|
21
|
+
UserMarketDetails
|
|
12
22
|
} from './types';
|
|
13
|
-
import { networkAddresses, BORROW_LIMIT_BUFFER, DECIMAL_PRECISION, REWARDCLAIMSTART, ONE_DAY, AurPlyPid } from './constants';
|
|
14
|
-
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
15
|
-
import { Contract, BigNumber as BN, ethers, providers } from 'ethers';
|
|
16
|
-
import { isSameAddress, decimalFactor, getCurrentTimestamp, calcLMRewardApr } from './helpers';
|
|
17
|
-
import { MoneyMarketRead } from './MoneyMarket';
|
|
18
|
-
import { fetchValuation, fetchPrice, calcValuation } from './priceFetcher';
|
|
19
|
-
import { AuriFairLaunch, Comptroller, TokenLock, AuriLens } from '@aurigami/contracts/typechain';
|
|
20
|
-
import { TokenAmount } from './tokenAmount';
|
|
21
|
-
import { AURPLYToken, PLYToken, Token } from './token';
|
|
22
|
-
import BigNumber from 'bignumber.js';
|
|
23
|
-
import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
24
|
-
import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
|
|
25
|
-
import TokenLockABI from "@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json";
|
|
26
|
-
import AuriFairLaunchABI from "@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json";
|
|
27
|
-
import FaucetABI from "@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json";
|
|
28
23
|
|
|
29
24
|
export class SdkRead extends BlockchainEntityRead {
|
|
30
25
|
|
|
@@ -97,18 +92,9 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
97
92
|
return p;
|
|
98
93
|
}, new BigNumber(0))
|
|
99
94
|
|
|
100
|
-
|
|
101
|
-
var accountLiquidity: [BN, BN], rewardBalancesMetadata, lockedAmount: BN;
|
|
102
|
-
promises[0] = this._comptroller.getAccountLiquidity(userAddress);
|
|
103
|
-
promises[1] = this._auriLens.callStatic.claimAndGetRewardBalancesMetadata(this._comptroller.address, this._auriFairLaunch.address, [AurPlyPid], {from: userAddress}).catch((err: any) => {
|
|
104
|
-
return {
|
|
105
|
-
plyAccrued: BN.from(0)
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
promises[2] = this._tokenLock.lockedAmounts(userAddress);
|
|
109
|
-
var values = await Promise.all(promises);
|
|
95
|
+
var accountLiquidity: [BN, BN];
|
|
110
96
|
|
|
111
|
-
accountLiquidity =
|
|
97
|
+
accountLiquidity = await this._comptroller.getAccountLiquidity(userAddress);
|
|
112
98
|
var borrowedvaluation: BigNumber = totalBorrowLimit.minus(new BigNumber(accountLiquidity[0].toString()).div(decimalFactor(18)));
|
|
113
99
|
|
|
114
100
|
if (borrowedvaluation.lt("0.00001")) { // Igore dust, dust could be the result of network delay causing collateral valuation calc to be different on vs off chain
|
|
@@ -143,13 +129,13 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
143
129
|
}
|
|
144
130
|
|
|
145
131
|
return {
|
|
146
|
-
markets:
|
|
132
|
+
markets: [],
|
|
147
133
|
borrowLimit: {
|
|
148
134
|
currency: "USD",
|
|
149
135
|
amount: bufferedBorrowLimit.toFixed(DECIMAL_PRECISION)
|
|
150
136
|
},
|
|
151
|
-
accruedPly: new TokenAmount(PLYToken,
|
|
152
|
-
lockedPly: new TokenAmount(PLYToken,
|
|
137
|
+
accruedPly: new TokenAmount(PLYToken, "0"),
|
|
138
|
+
lockedPly: new TokenAmount(PLYToken, "0"),
|
|
153
139
|
borrowableAmount: {
|
|
154
140
|
currency: "USD",
|
|
155
141
|
amount: borrowableAmount.toFixed(DECIMAL_PRECISION)
|