@aurigami/sdk 1.21.0 → 1.22.0

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.esm.js CHANGED
@@ -207,7 +207,7 @@ var SD_INCENTIVE_IN_SD = 83.35;
207
207
  var STADER_ETH = /*#__PURE__*/'0x30D20208d987713f46DFD34EF128Bb16C404D10f'.toLowerCase();
208
208
  var USDT_ETH = /*#__PURE__*/'0xdAC17F958D2ee523a2206206994597C13D831ec7'.toLowerCase();
209
209
  var AURIGAMI_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27';
210
- var GRAPHQL_URL = 'https://explorer.mainnet.aurora.dev/graphiql';
210
+ var GRAPHQL_URL = 'https://old.explorer.aurora.dev/api/v1/graphql';
211
211
 
212
212
  var decimalRecords = {
213
213
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
@@ -932,7 +932,7 @@ function _getBlocksTimestamp() {
932
932
  case 8:
933
933
  results = _context5.sent.reduce(function (acc, cur) {
934
934
  return _extends({}, acc, cur);
935
- });
935
+ }, {});
936
936
  missingBlocks = blockNumbers.filter(function (blockNumber) {
937
937
  return !results["b" + blockNumber];
938
938
  });
@@ -5703,10 +5703,6 @@ function _postApi() {
5703
5703
  return _postApi.apply(this, arguments);
5704
5704
  }
5705
5705
 
5706
- function getLiquidationEventsQuery(address, limit) {
5707
- 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 }";
5708
- }
5709
-
5710
5706
  var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5711
5707
  _inheritsLoose(SdkRead, _BlockchainEntityRead);
5712
5708
  function SdkRead(networkConnection) {
@@ -6050,38 +6046,42 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
6050
6046
  }();
6051
6047
  _proto.getLiquidationHistory = /*#__PURE__*/function () {
6052
6048
  var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(address) {
6053
- var liquidationHistorySubgraph, liquidationEvents;
6049
+ var liquidationHistoryResp, blocks, blocksTimestamp, liquidationEvents;
6054
6050
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
6055
6051
  while (1) switch (_context16.prev = _context16.next) {
6056
6052
  case 0:
6057
6053
  _context16.next = 2;
6058
- return queryGraphQL(getLiquidationEventsQuery(address, 100), AURIGAMI_SUBGRAPH_URL);
6054
+ return getPaginatedApi('/liquidate/history', {
6055
+ user: address
6056
+ });
6059
6057
  case 2:
6060
- liquidationHistorySubgraph = _context16.sent;
6061
- liquidationEvents = liquidationHistorySubgraph.liquidationEvents.map(function (event) {
6062
- var value = {
6063
- amount: event.underlyingRepayAmountUSD.toString(),
6064
- currency: 'USD'
6065
- };
6058
+ liquidationHistoryResp = _context16.sent;
6059
+ blocks = liquidationHistoryResp.items.map(function (event) {
6060
+ return event.blockNumber;
6061
+ });
6062
+ _context16.next = 6;
6063
+ return getBlocksTimestamp(this._networkConnection.provider, blocks);
6064
+ case 6:
6065
+ blocksTimestamp = _context16.sent;
6066
+ liquidationEvents = liquidationHistoryResp.items.map(function (event, idx) {
6066
6067
  var underlyingAddress = networkAddresses.auTokens.find(function (auToken) {
6067
- return auToken.name.slice(2).toLowerCase() === event.underlyingSymbol.toLowerCase();
6068
+ return auToken.address.toLowerCase() === event.marketRepayToken.toLowerCase();
6068
6069
  }).underlying;
6069
6070
  var decimal = getDecimal(underlyingAddress);
6070
6071
  var token = new Token(underlyingAddress, decimal);
6071
- var tokenAmount = new TokenAmount(token, event.underlyingRepayAmount.toString(), false);
6072
+ var tokenAmount = new TokenAmount(token, event.repayAmount.toString(), true);
6072
6073
  return {
6073
- liquidationTime: event.blockTime,
6074
+ liquidationTime: blocksTimestamp[idx],
6074
6075
  tokenAmount: tokenAmount,
6075
- value: value,
6076
- transactionId: event.id.split('-')[0]
6076
+ transactionId: event.txnHash
6077
6077
  };
6078
6078
  });
6079
6079
  return _context16.abrupt("return", liquidationEvents);
6080
- case 5:
6080
+ case 9:
6081
6081
  case "end":
6082
6082
  return _context16.stop();
6083
6083
  }
6084
- }, _callee16);
6084
+ }, _callee16, this);
6085
6085
  }));
6086
6086
  function getLiquidationHistory(_x21) {
6087
6087
  return _getLiquidationHistory.apply(this, arguments);