@aurigami/sdk 1.6.9 → 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.
package/dist/SDK.d.ts CHANGED
@@ -36,8 +36,8 @@ export declare class SdkRead extends BlockchainEntityRead {
36
36
  * - Ply in vesting contract
37
37
  */
38
38
  getPlyCirculatingSupply(): Promise<TokenAmount>;
39
- getUltilizations(userAddr: types.Address): Promise<BigNumber>;
40
- sneakAccounts(accounts: string[], tokenAddresses: string[]): Promise<types.AccountAuTokenInfo[][]>;
39
+ getUtilisation(userAddr: types.Address): Promise<BigNumber>;
40
+ sneakAccounts(accounts: string[], tokenAddresses: string[]): Promise<types.AccountAuTokensInfo[]>;
41
41
  }
42
42
  export declare class SdkReadWrite extends SdkRead {
43
43
  /**
@@ -24,6 +24,6 @@ export declare class MiscRead extends BlockchainEntityRead {
24
24
  * - Ply in vesting contract
25
25
  */
26
26
  getPlyCirculatingSupply(): Promise<TokenAmount>;
27
- getUltilizations(userAddr: types.Address): Promise<BigNumber>;
28
- sneakAccounts(accounts: string[], tokenAddresses: string[]): Promise<types.AccountAuTokenInfo[][]>;
27
+ getUtilisation(userAddr: types.Address): Promise<BigNumber>;
28
+ sneakAccounts(accounts: string[], tokenAddresses: string[]): Promise<types.AccountAuTokensInfo[]>;
29
29
  }
@@ -3941,8 +3941,8 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3941
3941
  return getPlyCirculatingSupply;
3942
3942
  }();
3943
3943
 
3944
- _proto.getUltilizations = /*#__PURE__*/function () {
3945
- var _getUltilizations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(userAddr) {
3944
+ _proto.getUtilisation = /*#__PURE__*/function () {
3945
+ var _getUtilisation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(userAddr) {
3946
3946
  var accountDetail, sumBorrow, sumCol;
3947
3947
  return runtime_1.wrap(function _callee4$(_context4) {
3948
3948
  while (1) {
@@ -3965,25 +3965,25 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3965
3965
  }, _callee4, this);
3966
3966
  }));
3967
3967
 
3968
- function getUltilizations(_x3) {
3969
- return _getUltilizations.apply(this, arguments);
3968
+ function getUtilisation(_x3) {
3969
+ return _getUtilisation.apply(this, arguments);
3970
3970
  }
3971
3971
 
3972
- return getUltilizations;
3972
+ return getUtilisation;
3973
3973
  }();
3974
3974
 
3975
3975
  _proto.sneakAccounts = /*#__PURE__*/function () {
3976
3976
  var _sneakAccounts = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(accounts, tokenAddresses) {
3977
3977
  var _this3 = this;
3978
3978
 
3979
- var _1E18, _1E9, oracle, tokens, prices, exrate, res, _iterator2, _step2, addr, infos, _i, snapshot, bal, bor, balR, borR;
3979
+ var _1E18, dust, oracle, tokens, prices, exrate, res, _iterator2, _step2, addr, infos, _i, snapshot, bal, bor, balR, borR;
3980
3980
 
3981
3981
  return runtime_1.wrap(function _callee5$(_context5) {
3982
3982
  while (1) {
3983
3983
  switch (_context5.prev = _context5.next) {
3984
3984
  case 0:
3985
3985
  _1E18 = ethers.BigNumber.from(10).pow(18);
3986
- _1E9 = ethers.BigNumber.from(10).pow(9);
3986
+ dust = new BigNumber(0.1);
3987
3987
  oracle = this.env.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
3988
3988
  tokens = tokenAddresses.map(function (addr) {
3989
3989
  return _this3.env.getContract(addr, AuTokenABI.abi);
@@ -4024,10 +4024,10 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4024
4024
  snapshot = _context5.sent;
4025
4025
  bal = snapshot[0].mul(exrate[_i]).div(_1E18).mul(prices[_i]).div(_1E18);
4026
4026
  bor = snapshot[1].mul(prices[_i]).div(_1E18);
4027
- balR = bal.div(_1E9).toNumber() / Math.pow(10, 9);
4028
- borR = bor.div(_1E9).toNumber() / Math.pow(10, 9);
4027
+ balR = new BigNumber(bal.toString()).dividedBy(_1E18.toString());
4028
+ borR = new BigNumber(bor.toString()).dividedBy(_1E18.toString());
4029
4029
 
4030
- if (!(balR < 0.1 || borR < 0.1)) {
4030
+ if (!(balR.lt(dust) || borR.lt(dust))) {
4031
4031
  _context5.next = 26;
4032
4032
  break;
4033
4033
  }
@@ -4047,7 +4047,10 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4047
4047
  break;
4048
4048
 
4049
4049
  case 30:
4050
- res.push(infos);
4050
+ res.push({
4051
+ address: addr,
4052
+ tokens: infos
4053
+ });
4051
4054
 
4052
4055
  case 31:
4053
4056
  _context5.next = 12;
@@ -4518,13 +4521,13 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4518
4521
  return getPlyCirculatingSupply;
4519
4522
  }();
4520
4523
 
4521
- _proto.getUltilizations = /*#__PURE__*/function () {
4522
- var _getUltilizations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddr) {
4524
+ _proto.getUtilisation = /*#__PURE__*/function () {
4525
+ var _getUtilisation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddr) {
4523
4526
  return runtime_1.wrap(function _callee8$(_context8) {
4524
4527
  while (1) {
4525
4528
  switch (_context8.prev = _context8.next) {
4526
4529
  case 0:
4527
- return _context8.abrupt("return", this._misc.getUltilizations(userAddr));
4530
+ return _context8.abrupt("return", this._misc.getUtilisation(userAddr));
4528
4531
 
4529
4532
  case 1:
4530
4533
  case "end":
@@ -4534,11 +4537,11 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4534
4537
  }, _callee8, this);
4535
4538
  }));
4536
4539
 
4537
- function getUltilizations(_x6) {
4538
- return _getUltilizations.apply(this, arguments);
4540
+ function getUtilisation(_x6) {
4541
+ return _getUtilisation.apply(this, arguments);
4539
4542
  }
4540
4543
 
4541
- return getUltilizations;
4544
+ return getUtilisation;
4542
4545
  }();
4543
4546
 
4544
4547
  _proto.sneakAccounts = /*#__PURE__*/function () {