@aurigami/sdk 1.18.8 → 1.19.1

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
@@ -43,6 +43,8 @@ export declare class SdkRead extends BlockchainEntityRead {
43
43
  setUserNotificationSettings(address: types.Address, mail: string, utilisation: number, liquidation: boolean, captchaResponse: string): Promise<any>;
44
44
  unsetUserNotificationSettings(address: types.Address, captchaResponse: string): Promise<any>;
45
45
  getUserNotificationSettings(addresses: types.Address[]): Promise<types.UserNotification>;
46
+ getLiquidationHistory(address: string): Promise<types.LiquidationDetail[]>;
47
+ calculateBorrowPower(tokenAmount: TokenAmount): Promise<types.CurrencyAmount>;
46
48
  }
47
49
  export declare class SdkReadWrite extends SdkRead {
48
50
  /**
@@ -124,3 +124,5 @@ export declare const CACHE_TIMEOUT: number;
124
124
  export declare const SD_INCENTIVE_IN_SD = 83.35;
125
125
  export declare const STADER_ETH: string;
126
126
  export declare const USDT_ETH: string;
127
+ export declare const AURIGAMI_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27";
128
+ export declare const GRAPHQL_URL = "https://explorer.mainnet.aurora.dev/graphiql";
@@ -1 +1 @@
1
- export declare function queryGraphQL(query: string): Promise<any>;
1
+ export declare function queryGraphQL(query: string, graphqlUrl: string): Promise<any>;
@@ -0,0 +1 @@
1
+ export declare function getLiquidationEventsQuery(address: string, limit: number): string;
@@ -8,6 +8,10 @@ export declare class MiscRead extends BlockchainEntityRead {
8
8
  constructor(networkConnection: types.NetworkConnection);
9
9
  getUserDetails(userAddress: string): Promise<types.UserDetails>;
10
10
  getTokenPrice(token: Token): Promise<types.CurrencyAmount>;
11
+ calcBorrowPower(tokenAmount: TokenAmount): Promise<{
12
+ currency: string;
13
+ amount: string;
14
+ }>;
11
15
  calcHypotheticalStats({ userMarketDetail, currentBorrowLimit, currentBorrowValuation, action, tokenAmount, }: {
12
16
  userMarketDetail: types.UserMarketDetails;
13
17
  currentBorrowLimit: types.CurrencyAmount;
@@ -115,7 +115,7 @@ var networkAddresses = {
115
115
  AURIFAIRLAUNCH: /*#__PURE__*/MAINNET_ADDRESSES.fairLaunch.toLowerCase(),
116
116
  AURILENS: /*#__PURE__*/MAINNET_ADDRESSES.auriLens.toLowerCase(),
117
117
  ETHREPAYHELPER: /*#__PURE__*/MAINNET_ADDRESSES.ethRepayHelper.toLowerCase(),
118
- AURI_AIRDROP: /*#__PURE__*/MAINNET_ADDRESSES.auriAirdrop.toLowerCase(),
118
+ AURI_AIRDROP: /*#__PURE__*/MAINNET_ADDRESSES.auriAirdropMultipleRedeem.toLowerCase(),
119
119
  MULTICALL: /*#__PURE__*/MAINNET_ADDRESSES.multicall.toLowerCase(),
120
120
  TEAM_MULTISIG: /*#__PURE__*/'0x2D05FfFE70CE64c5954710D4C308dB31C8dBd8dE'.toLowerCase(),
121
121
  TEAM_MULTISIG_AURORA_PLUS: /*#__PURE__*/'0x31f501589c7a090bf68f2fe2687744bf9130e1ab'.toLowerCase(),
@@ -210,6 +210,8 @@ var CACHE_TIMEOUT = 10 * 1000; // 10 seconds
210
210
  var SD_INCENTIVE_IN_SD = 83.35;
211
211
  var STADER_ETH = /*#__PURE__*/'0x30D20208d987713f46DFD34EF128Bb16C404D10f'.toLowerCase();
212
212
  var USDT_ETH = /*#__PURE__*/'0xdAC17F958D2ee523a2206206994597C13D831ec7'.toLowerCase();
213
+ var AURIGAMI_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27';
214
+ var GRAPHQL_URL = 'https://explorer.mainnet.aurora.dev/graphiql';
213
215
 
214
216
  var decimalRecords = {
215
217
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
@@ -709,18 +711,17 @@ function _getQuery() {
709
711
  return _getQuery.apply(this, arguments);
710
712
  }
711
713
 
712
- var GRAPHQL_URL = 'https://explorer.mainnet.aurora.dev/graphiql';
713
- function queryGraphQL(_x) {
714
+ function queryGraphQL(_x, _x2) {
714
715
  return _queryGraphQL.apply(this, arguments);
715
716
  }
716
717
  function _queryGraphQL() {
717
- _queryGraphQL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query) {
718
+ _queryGraphQL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, graphqlUrl) {
718
719
  var resp;
719
720
  return _regeneratorRuntime().wrap(function _callee$(_context) {
720
721
  while (1) switch (_context.prev = _context.next) {
721
722
  case 0:
722
723
  _context.next = 2;
723
- return axios.post(GRAPHQL_URL, {
724
+ return axios.post(graphqlUrl, {
724
725
  query: query
725
726
  });
726
727
  case 2:
@@ -927,7 +928,7 @@ function _getBlocksTimestamp() {
927
928
  });
928
929
  for (i = 0; i < lines.length; i += CHUNK_SIZE) {
929
930
  query = "{ " + lines.slice(i, i + CHUNK_SIZE).join('\n') + " }";
930
- promises.push(queryGraphQL(query));
931
+ promises.push(queryGraphQL(query, GRAPHQL_URL));
931
932
  }
932
933
  // merge all the json objects
933
934
  _context5.next = 8;
@@ -5200,6 +5201,40 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5200
5201
  }
5201
5202
  return getTokenPrice;
5202
5203
  }();
5204
+ _proto.calcBorrowPower = /*#__PURE__*/function () {
5205
+ var _calcBorrowPower = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(tokenAmount) {
5206
+ var autoken, moneyMarket, collateralRatio, underlyingPrice, borrowPower;
5207
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
5208
+ while (1) switch (_context4.prev = _context4.next) {
5209
+ case 0:
5210
+ autoken = networkAddresses.auTokens.find(function (auToken) {
5211
+ return isSameAddress(auToken.underlying, tokenAmount.token.address);
5212
+ });
5213
+ moneyMarket = new MoneyMarketRead(this._networkConnection, autoken.address, autoken.underlying);
5214
+ _context4.next = 4;
5215
+ return moneyMarket.getCollateralRatio();
5216
+ case 4:
5217
+ collateralRatio = _context4.sent;
5218
+ _context4.next = 7;
5219
+ return fetchPrice(tokenAmount.token.address, this._networkConnection.provider);
5220
+ case 7:
5221
+ underlyingPrice = _context4.sent;
5222
+ borrowPower = calcValuation(tokenAmount, new BigNumber(underlyingPrice)).multipliedBy(collateralRatio).multipliedBy(BORROW_LIMIT_BUFFER);
5223
+ return _context4.abrupt("return", {
5224
+ currency: 'USD',
5225
+ amount: borrowPower.toFixed(DECIMAL_PRECISION)
5226
+ });
5227
+ case 10:
5228
+ case "end":
5229
+ return _context4.stop();
5230
+ }
5231
+ }, _callee3, this);
5232
+ }));
5233
+ function calcBorrowPower(_x3) {
5234
+ return _calcBorrowPower.apply(this, arguments);
5235
+ }
5236
+ return calcBorrowPower;
5237
+ }();
5203
5238
  _proto.calcHypotheticalStats = function calcHypotheticalStats(_ref) {
5204
5239
  var userMarketDetail = _ref.userMarketDetail,
5205
5240
  currentBorrowLimit = _ref.currentBorrowLimit,
@@ -5244,10 +5279,10 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5244
5279
  _proto.getPlyCirculatingSupply =
5245
5280
  /*#__PURE__*/
5246
5281
  function () {
5247
- var _getPlyCirculatingSupply = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
5282
+ var _getPlyCirculatingSupply = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
5248
5283
  var multicallRead, baseBalanceOfCall, listAddrs, calls, callResults, circulatingSupply;
5249
- return _regeneratorRuntime().wrap(function _callee3$(_context4) {
5250
- while (1) switch (_context4.prev = _context4.next) {
5284
+ return _regeneratorRuntime().wrap(function _callee4$(_context5) {
5285
+ while (1) switch (_context5.prev = _context5.next) {
5251
5286
  case 0:
5252
5287
  multicallRead = new MulticallRead(this._networkConnection);
5253
5288
  baseBalanceOfCall = {
@@ -5261,20 +5296,20 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5261
5296
  args: [addr]
5262
5297
  });
5263
5298
  });
5264
- _context4.next = 6;
5299
+ _context5.next = 6;
5265
5300
  return multicallRead.aggregate(calls);
5266
5301
  case 6:
5267
- callResults = _context4.sent;
5302
+ callResults = _context5.sent;
5268
5303
  circulatingSupply = ethers.BigNumber.from('1' + '0'.repeat(10) + '0'.repeat(getDecimal(this.env.ply.address)));
5269
5304
  callResults.forEach(function (result, i) {
5270
5305
  circulatingSupply = circulatingSupply.sub(result[0]);
5271
5306
  });
5272
- return _context4.abrupt("return", new TokenAmount(PLYToken, circulatingSupply.toString()));
5307
+ return _context5.abrupt("return", new TokenAmount(PLYToken, circulatingSupply.toString()));
5273
5308
  case 10:
5274
5309
  case "end":
5275
- return _context4.stop();
5310
+ return _context5.stop();
5276
5311
  }
5277
- }, _callee3, this);
5312
+ }, _callee4, this);
5278
5313
  }));
5279
5314
  function getPlyCirculatingSupply() {
5280
5315
  return _getPlyCirculatingSupply.apply(this, arguments);
@@ -5282,35 +5317,35 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5282
5317
  return getPlyCirculatingSupply;
5283
5318
  }();
5284
5319
  _proto.getUtilisation = /*#__PURE__*/function () {
5285
- var _getUtilisation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(userAddr) {
5320
+ var _getUtilisation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(userAddr) {
5286
5321
  var accountDetail, sumBorrow, sumCol;
5287
- return _regeneratorRuntime().wrap(function _callee4$(_context5) {
5288
- while (1) switch (_context5.prev = _context5.next) {
5322
+ return _regeneratorRuntime().wrap(function _callee5$(_context6) {
5323
+ while (1) switch (_context6.prev = _context6.next) {
5289
5324
  case 0:
5290
- _context5.next = 2;
5325
+ _context6.next = 2;
5291
5326
  return this.env.auriInternalLens.callStatic.getAccountLiquidityAccrueInterest(userAddr);
5292
5327
  case 2:
5293
- accountDetail = _context5.sent;
5328
+ accountDetail = _context6.sent;
5294
5329
  sumBorrow = new BigNumber(accountDetail.sumBorrowPlusEffects.toString());
5295
5330
  sumCol = new BigNumber(accountDetail.sumCollateral.toString());
5296
- return _context5.abrupt("return", sumBorrow.dividedBy(sumCol));
5331
+ return _context6.abrupt("return", sumBorrow.dividedBy(sumCol));
5297
5332
  case 6:
5298
5333
  case "end":
5299
- return _context5.stop();
5334
+ return _context6.stop();
5300
5335
  }
5301
- }, _callee4, this);
5336
+ }, _callee5, this);
5302
5337
  }));
5303
- function getUtilisation(_x3) {
5338
+ function getUtilisation(_x4) {
5304
5339
  return _getUtilisation.apply(this, arguments);
5305
5340
  }
5306
5341
  return getUtilisation;
5307
5342
  }();
5308
5343
  _proto.sneakAccounts = /*#__PURE__*/function () {
5309
- var _sneakAccounts = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(accounts, tokenAddresses, dust) {
5344
+ var _sneakAccounts = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(accounts, tokenAddresses, dust) {
5310
5345
  var _this2 = this;
5311
5346
  var _1E18, oracle, tokens, prices, exrate, res, _iterator2, _step2, addr, infos, i, snapshot, bal, bor, balR, borR;
5312
- return _regeneratorRuntime().wrap(function _callee5$(_context6) {
5313
- while (1) switch (_context6.prev = _context6.next) {
5347
+ return _regeneratorRuntime().wrap(function _callee6$(_context7) {
5348
+ while (1) switch (_context7.prev = _context7.next) {
5314
5349
  case 0:
5315
5350
  if (dust === void 0) {
5316
5351
  dust = /*#__PURE__*/new BigNumber(0.1);
@@ -5320,19 +5355,19 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5320
5355
  tokens = tokenAddresses.map(function (addr) {
5321
5356
  return _this2.env.getContract(addr, abis$5.abi);
5322
5357
  });
5323
- _context6.next = 6;
5358
+ _context7.next = 6;
5324
5359
  return oracle.getUnderlyingPrices(tokenAddresses);
5325
5360
  case 6:
5326
- prices = _context6.sent;
5327
- _context6.next = 9;
5361
+ prices = _context7.sent;
5362
+ _context7.next = 9;
5328
5363
  return this.env.auriInternalLens.callStatic.getExchangeRates(tokenAddresses);
5329
5364
  case 9:
5330
- exrate = _context6.sent;
5365
+ exrate = _context7.sent;
5331
5366
  res = [];
5332
5367
  _iterator2 = _createForOfIteratorHelperLoose(accounts);
5333
5368
  case 12:
5334
5369
  if ((_step2 = _iterator2()).done) {
5335
- _context6.next = 33;
5370
+ _context7.next = 33;
5336
5371
  break;
5337
5372
  }
5338
5373
  addr = _step2.value;
@@ -5340,22 +5375,22 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5340
5375
  i = 0;
5341
5376
  case 16:
5342
5377
  if (!(i < tokens.length)) {
5343
- _context6.next = 30;
5378
+ _context7.next = 30;
5344
5379
  break;
5345
5380
  }
5346
- _context6.next = 19;
5381
+ _context7.next = 19;
5347
5382
  return tokens[i].getAccountSnapshot(addr);
5348
5383
  case 19:
5349
- snapshot = _context6.sent;
5384
+ snapshot = _context7.sent;
5350
5385
  bal = snapshot[0].mul(exrate[i]).div(_1E18).mul(prices[i]).div(_1E18);
5351
5386
  bor = snapshot[1].mul(prices[i]).div(_1E18);
5352
5387
  balR = new BigNumber(bal.toString()).dividedBy(_1E18.toString());
5353
5388
  borR = new BigNumber(bor.toString()).dividedBy(_1E18.toString());
5354
5389
  if (!(balR.lte(dust) && borR.lte(dust))) {
5355
- _context6.next = 26;
5390
+ _context7.next = 26;
5356
5391
  break;
5357
5392
  }
5358
- return _context6.abrupt("continue", 27);
5393
+ return _context7.abrupt("continue", 27);
5359
5394
  case 26:
5360
5395
  infos.push({
5361
5396
  token: getSymbol(tokenAddresses[i]),
@@ -5364,7 +5399,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5364
5399
  });
5365
5400
  case 27:
5366
5401
  ++i;
5367
- _context6.next = 16;
5402
+ _context7.next = 16;
5368
5403
  break;
5369
5404
  case 30:
5370
5405
  res.push({
@@ -5372,40 +5407,40 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5372
5407
  tokens: infos
5373
5408
  });
5374
5409
  case 31:
5375
- _context6.next = 12;
5410
+ _context7.next = 12;
5376
5411
  break;
5377
5412
  case 33:
5378
- return _context6.abrupt("return", res);
5413
+ return _context7.abrupt("return", res);
5379
5414
  case 34:
5380
5415
  case "end":
5381
- return _context6.stop();
5416
+ return _context7.stop();
5382
5417
  }
5383
- }, _callee5, this);
5418
+ }, _callee6, this);
5384
5419
  }));
5385
- function sneakAccounts(_x4, _x5, _x6) {
5420
+ function sneakAccounts(_x5, _x6, _x7) {
5386
5421
  return _sneakAccounts.apply(this, arguments);
5387
5422
  }
5388
5423
  return sneakAccounts;
5389
5424
  }();
5390
5425
  _proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
5391
- var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userAddress) {
5426
+ var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(userAddress) {
5392
5427
  var _this3 = this;
5393
5428
  var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator3, _step3, apy;
5394
- return _regeneratorRuntime().wrap(function _callee6$(_context7) {
5395
- while (1) switch (_context7.prev = _context7.next) {
5429
+ return _regeneratorRuntime().wrap(function _callee7$(_context8) {
5430
+ while (1) switch (_context8.prev = _context8.next) {
5396
5431
  case 0:
5397
5432
  sum = new BigNumber(0);
5398
5433
  totalSuppliedValue = new BigNumber(0);
5399
5434
  totalBorrowedValue = new BigNumber(0);
5400
5435
  netApy = new BigNumber(0);
5401
- _context7.next = 6;
5436
+ _context8.next = 6;
5402
5437
  return Promise.all(networkAddresses.auTokens.map(function (auToken) {
5403
5438
  var moneyMarket = new MoneyMarketRead(_this3._networkConnection, auToken.address, auToken.underlying);
5404
5439
  var apyWithoutIncentive = moneyMarket.getApyWithoutIncentive(userAddress);
5405
5440
  return apyWithoutIncentive;
5406
5441
  }));
5407
5442
  case 6:
5408
- apys = _context7.sent;
5443
+ apys = _context8.sent;
5409
5444
  for (_iterator3 = _createForOfIteratorHelperLoose(apys); !(_step3 = _iterator3()).done;) {
5410
5445
  apy = _step3.value;
5411
5446
  sum = sum.plus(apy.sum);
@@ -5417,37 +5452,37 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5417
5452
  } else if (sum.lt(0)) {
5418
5453
  netApy = sum.div(totalBorrowedValue);
5419
5454
  }
5420
- return _context7.abrupt("return", netApy);
5455
+ return _context8.abrupt("return", netApy);
5421
5456
  case 10:
5422
5457
  case "end":
5423
- return _context7.stop();
5458
+ return _context8.stop();
5424
5459
  }
5425
- }, _callee6);
5460
+ }, _callee7);
5426
5461
  }));
5427
- function getNetApyWithoutIncentive(_x7) {
5462
+ function getNetApyWithoutIncentive(_x8) {
5428
5463
  return _getNetApyWithoutIncentive.apply(this, arguments);
5429
5464
  }
5430
5465
  return getNetApyWithoutIncentive;
5431
5466
  }();
5432
5467
  _proto.getNetApyWithIncentive = /*#__PURE__*/function () {
5433
- var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(userAddress) {
5468
+ var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(userAddress) {
5434
5469
  var _this4 = this;
5435
5470
  var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator4, _step4, apy;
5436
- return _regeneratorRuntime().wrap(function _callee7$(_context8) {
5437
- while (1) switch (_context8.prev = _context8.next) {
5471
+ return _regeneratorRuntime().wrap(function _callee8$(_context9) {
5472
+ while (1) switch (_context9.prev = _context9.next) {
5438
5473
  case 0:
5439
5474
  sum = new BigNumber(0);
5440
5475
  totalSuppliedValue = new BigNumber(0);
5441
5476
  totalBorrowedValue = new BigNumber(0);
5442
5477
  netApy = new BigNumber(0);
5443
- _context8.next = 6;
5478
+ _context9.next = 6;
5444
5479
  return Promise.all(networkAddresses.auTokens.map(function (auToken) {
5445
5480
  var moneyMarket = new MoneyMarketRead(_this4._networkConnection, auToken.address, auToken.underlying);
5446
5481
  var apyWithIncentive = moneyMarket.getApyWithIncentive(userAddress);
5447
5482
  return apyWithIncentive;
5448
5483
  }));
5449
5484
  case 6:
5450
- apys = _context8.sent;
5485
+ apys = _context9.sent;
5451
5486
  for (_iterator4 = _createForOfIteratorHelperLoose(apys); !(_step4 = _iterator4()).done;) {
5452
5487
  apy = _step4.value;
5453
5488
  sum = sum.plus(apy.sum);
@@ -5459,14 +5494,14 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5459
5494
  } else if (sum.lt(0)) {
5460
5495
  netApy = sum.div(totalBorrowedValue);
5461
5496
  }
5462
- return _context8.abrupt("return", netApy);
5497
+ return _context9.abrupt("return", netApy);
5463
5498
  case 10:
5464
5499
  case "end":
5465
- return _context8.stop();
5500
+ return _context9.stop();
5466
5501
  }
5467
- }, _callee7);
5502
+ }, _callee8);
5468
5503
  }));
5469
- function getNetApyWithIncentive(_x8) {
5504
+ function getNetApyWithIncentive(_x9) {
5470
5505
  return _getNetApyWithIncentive.apply(this, arguments);
5471
5506
  }
5472
5507
  return getNetApyWithIncentive;
@@ -5580,6 +5615,10 @@ function _postApi() {
5580
5615
  return _postApi.apply(this, arguments);
5581
5616
  }
5582
5617
 
5618
+ function getLiquidationEventsQuery(address, limit) {
5619
+ return "{\n liquidationEvents(\n first: " + limit + ",\n where: {from: \"" + address.toLowerCase() + "\"}\n ) {\n amount\n auTokenSymbol\n blockTime\n from\n id\n underlyingRepayAmountUSD\n underlyingSymbol\n underlyingRepayAmount\n }\n }";
5620
+ }
5621
+
5583
5622
  var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5584
5623
  _inheritsLoose(SdkRead, _BlockchainEntityRead);
5585
5624
  function SdkRead(networkConnection) {
@@ -5908,6 +5947,49 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5908
5947
  }
5909
5948
  return getUserNotificationSettings;
5910
5949
  }();
5950
+ _proto.getLiquidationHistory = /*#__PURE__*/function () {
5951
+ var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(address) {
5952
+ var liquidationHistorySubgraph, liquidationEvents;
5953
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
5954
+ while (1) switch (_context15.prev = _context15.next) {
5955
+ case 0:
5956
+ _context15.next = 2;
5957
+ return queryGraphQL(getLiquidationEventsQuery(address, 100), AURIGAMI_SUBGRAPH_URL);
5958
+ case 2:
5959
+ liquidationHistorySubgraph = _context15.sent;
5960
+ liquidationEvents = liquidationHistorySubgraph.liquidationEvents.map(function (event) {
5961
+ var value = {
5962
+ amount: event.underlyingRepayAmountUSD.toString(),
5963
+ currency: 'USD'
5964
+ };
5965
+ var underlyingAddress = networkAddresses.auTokens.find(function (auToken) {
5966
+ return auToken.name.slice(2).toLowerCase() === event.underlyingSymbol.toLowerCase();
5967
+ }).underlying;
5968
+ var decimal = getDecimal(underlyingAddress);
5969
+ var token = new Token(underlyingAddress, decimal);
5970
+ var tokenAmount = new TokenAmount(token, event.underlyingRepayAmount.toString(), false);
5971
+ return {
5972
+ liquidationTime: event.blockTime,
5973
+ tokenAmount: tokenAmount,
5974
+ value: value,
5975
+ transactionId: event.id.split('-')[0]
5976
+ };
5977
+ });
5978
+ return _context15.abrupt("return", liquidationEvents);
5979
+ case 5:
5980
+ case "end":
5981
+ return _context15.stop();
5982
+ }
5983
+ }, _callee15);
5984
+ }));
5985
+ function getLiquidationHistory(_x20) {
5986
+ return _getLiquidationHistory.apply(this, arguments);
5987
+ }
5988
+ return getLiquidationHistory;
5989
+ }();
5990
+ _proto.calculateBorrowPower = function calculateBorrowPower(tokenAmount) {
5991
+ return this._misc.calcBorrowPower(tokenAmount);
5992
+ };
5911
5993
  return SdkRead;
5912
5994
  }(BlockchainEntityRead);
5913
5995
  var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
@@ -5922,16 +6004,16 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
5922
6004
  _proto2.claim =
5923
6005
  /*#__PURE__*/
5924
6006
  function () {
5925
- var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
5926
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
5927
- while (1) switch (_context15.prev = _context15.next) {
6007
+ var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
6008
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
6009
+ while (1) switch (_context16.prev = _context16.next) {
5928
6010
  case 0:
5929
- return _context15.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
6011
+ return _context16.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
5930
6012
  case 1:
5931
6013
  case "end":
5932
- return _context15.stop();
6014
+ return _context16.stop();
5933
6015
  }
5934
- }, _callee15, this);
6016
+ }, _callee16, this);
5935
6017
  }));
5936
6018
  function claim() {
5937
6019
  return _claim.apply(this, arguments);
@@ -5939,35 +6021,35 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
5939
6021
  return claim;
5940
6022
  }();
5941
6023
  _proto2.stake = /*#__PURE__*/function () {
5942
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(amount) {
5943
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
5944
- while (1) switch (_context16.prev = _context16.next) {
6024
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(amount) {
6025
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
6026
+ while (1) switch (_context17.prev = _context17.next) {
5945
6027
  case 0:
5946
- return _context16.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
6028
+ return _context17.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
5947
6029
  case 1:
5948
6030
  case "end":
5949
- return _context16.stop();
6031
+ return _context17.stop();
5950
6032
  }
5951
- }, _callee16, this);
6033
+ }, _callee17, this);
5952
6034
  }));
5953
- function stake(_x20) {
6035
+ function stake(_x21) {
5954
6036
  return _stake.apply(this, arguments);
5955
6037
  }
5956
6038
  return stake;
5957
6039
  }();
5958
6040
  _proto2.unstake = /*#__PURE__*/function () {
5959
- var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(amount) {
5960
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
5961
- while (1) switch (_context17.prev = _context17.next) {
6041
+ var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(amount) {
6042
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
6043
+ while (1) switch (_context18.prev = _context18.next) {
5962
6044
  case 0:
5963
- return _context17.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
6045
+ return _context18.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
5964
6046
  case 1:
5965
6047
  case "end":
5966
- return _context17.stop();
6048
+ return _context18.stop();
5967
6049
  }
5968
- }, _callee17, this);
6050
+ }, _callee18, this);
5969
6051
  }));
5970
- function unstake(_x21) {
6052
+ function unstake(_x22) {
5971
6053
  return _unstake.apply(this, arguments);
5972
6054
  }
5973
6055
  return unstake;
@@ -6000,6 +6082,7 @@ exports.AIRDROP_END_TIMESTAMP = AIRDROP_END_TIMESTAMP;
6000
6082
  exports.AIRDROP_KEEP_THRESHOLD = AIRDROP_KEEP_THRESHOLD;
6001
6083
  exports.AIRDROP_START_TIMESTAMP = AIRDROP_START_TIMESTAMP;
6002
6084
  exports.ALL_STAKING_POOLS = ALL_STAKING_POOLS;
6085
+ exports.AURIGAMI_SUBGRAPH_URL = AURIGAMI_SUBGRAPH_URL;
6003
6086
  exports.AURORA_CHAINID = AURORA_CHAINID;
6004
6087
  exports.AURORA_PLUS_API_PREFIX = AURORA_PLUS_API_PREFIX;
6005
6088
  exports.Airdrop = Airdrop;
@@ -6016,6 +6099,7 @@ exports.DECIMAL_PRECISION = DECIMAL_PRECISION;
6016
6099
  exports.DEPOSIT_NEAR_REWARDS_PER_WEEK = DEPOSIT_NEAR_REWARDS_PER_WEEK;
6017
6100
  exports.DEPOSIT_ONLY_TOKENS = DEPOSIT_ONLY_TOKENS;
6018
6101
  exports.ETHAddress = ETHAddress;
6102
+ exports.GRAPHQL_URL = GRAPHQL_URL;
6019
6103
  exports.HARDCODE_PRICE_TOKENS = HARDCODE_PRICE_TOKENS;
6020
6104
  exports.INF = INF;
6021
6105
  exports.MiscRead = MiscRead;