@aurigami/sdk 1.6.10 → 1.6.11

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.
@@ -1,3 +1,4 @@
1
+ import BigNumber from 'bignumber.js';
1
2
  import type { providers, Signer } from 'ethers';
2
3
  import { TokenAmount } from '../entities/tokenAmount';
3
4
  export declare enum ComptrollerRewardType {
@@ -93,8 +94,8 @@ export declare type HypotheticalStats = {
93
94
  };
94
95
  export declare type AccountAuTokenInfo = {
95
96
  token: string;
96
- deposit: number;
97
- borrow: number;
97
+ deposit: BigNumber;
98
+ borrow: BigNumber;
98
99
  };
99
100
  export declare type AccountAuTokensInfo = {
100
101
  address: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.6.10",
2
+ "version": "1.6.11",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -295,7 +295,7 @@ export class MiscRead extends BlockchainEntityRead {
295
295
  tokenAddresses: string[]
296
296
  ): Promise<types.AccountAuTokensInfo[]> {
297
297
  const _1E18 = BN.from(10).pow(18);
298
- const _1E9 = BN.from(10).pow(9);
298
+ const dust = new BigNumber(0.1);
299
299
  const oracle = this.env.getContract<PriceOracle>(
300
300
  consts.networkAddresses.misc.oracle,
301
301
  abis.AuriOracleABI.abi
@@ -315,10 +315,10 @@ export class MiscRead extends BlockchainEntityRead {
315
315
  const bal = snapshot[0].mul(exrate[i]).div(_1E18).mul(prices[i]).div(_1E18);
316
316
  const bor = snapshot[1].mul(prices[i]).div(_1E18);
317
317
 
318
- let balR = bal.div(_1E9).toNumber() / 10 ** 9;
319
- let borR = bor.div(_1E9).toNumber() / 10 ** 9;
318
+ let balR = new BigNumber(bal.toString()).dividedBy(_1E18.toString());
319
+ let borR = new BigNumber(bor.toString()).dividedBy(_1E18.toString());
320
320
 
321
- if (balR < 0.1 || borR < 0.1) continue;
321
+ if (balR.lt(dust) || borR.lt(dust)) continue;
322
322
 
323
323
  infos.push({
324
324
  token: getSymbol(tokenAddresses[i]),
@@ -1,3 +1,4 @@
1
+ import BigNumber from 'bignumber.js';
1
2
  import type { providers, Signer } from 'ethers';
2
3
  import { TokenAmount } from '../entities/tokenAmount';
3
4
 
@@ -107,8 +108,8 @@ export type HypotheticalStats = {
107
108
 
108
109
  export type AccountAuTokenInfo = {
109
110
  token: string;
110
- deposit: number;
111
- borrow: number;
111
+ deposit: BigNumber;
112
+ borrow: BigNumber;
112
113
  };
113
114
 
114
115
  export type AccountAuTokensInfo = {