@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.
@@ -126,4 +126,4 @@ export declare const SD_INCENTIVE_IN_SD = 83.35;
126
126
  export declare const STADER_ETH: string;
127
127
  export declare const USDT_ETH: string;
128
128
  export declare const AURIGAMI_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27";
129
- export declare const GRAPHQL_URL = "https://explorer.mainnet.aurora.dev/graphiql";
129
+ export declare const GRAPHQL_URL = "https://old.explorer.aurora.dev/api/v1/graphql";
@@ -10,4 +10,4 @@ export declare type PaginagedApiResponse<T> = {
10
10
  items: T[];
11
11
  meta: MetaApiResponse;
12
12
  };
13
- export declare function getPaginatedApi(url: string, params?: Record<string, any>, page?: number, pageSize?: number): Promise<PaginagedApiResponse<any>>;
13
+ export declare function getPaginatedApi<T = any>(url: string, params?: Record<string, any>, page?: number, pageSize?: number): Promise<PaginagedApiResponse<T>>;
@@ -212,7 +212,7 @@ var SD_INCENTIVE_IN_SD = 83.35;
212
212
  var STADER_ETH = /*#__PURE__*/'0x30D20208d987713f46DFD34EF128Bb16C404D10f'.toLowerCase();
213
213
  var USDT_ETH = /*#__PURE__*/'0xdAC17F958D2ee523a2206206994597C13D831ec7'.toLowerCase();
214
214
  var AURIGAMI_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27';
215
- var GRAPHQL_URL = 'https://explorer.mainnet.aurora.dev/graphiql';
215
+ var GRAPHQL_URL = 'https://old.explorer.aurora.dev/api/v1/graphql';
216
216
 
217
217
  var decimalRecords = {
218
218
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
@@ -937,7 +937,7 @@ function _getBlocksTimestamp() {
937
937
  case 8:
938
938
  results = _context5.sent.reduce(function (acc, cur) {
939
939
  return _extends({}, acc, cur);
940
- });
940
+ }, {});
941
941
  missingBlocks = blockNumbers.filter(function (blockNumber) {
942
942
  return !results["b" + blockNumber];
943
943
  });
@@ -5706,10 +5706,6 @@ function _postApi() {
5706
5706
  return _postApi.apply(this, arguments);
5707
5707
  }
5708
5708
 
5709
- function getLiquidationEventsQuery(address, limit) {
5710
- 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 }";
5711
- }
5712
-
5713
5709
  var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5714
5710
  _inheritsLoose(SdkRead, _BlockchainEntityRead);
5715
5711
  function SdkRead(networkConnection) {
@@ -6053,38 +6049,42 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
6053
6049
  }();
6054
6050
  _proto.getLiquidationHistory = /*#__PURE__*/function () {
6055
6051
  var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(address) {
6056
- var liquidationHistorySubgraph, liquidationEvents;
6052
+ var liquidationHistoryResp, blocks, blocksTimestamp, liquidationEvents;
6057
6053
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
6058
6054
  while (1) switch (_context16.prev = _context16.next) {
6059
6055
  case 0:
6060
6056
  _context16.next = 2;
6061
- return queryGraphQL(getLiquidationEventsQuery(address, 100), AURIGAMI_SUBGRAPH_URL);
6057
+ return getPaginatedApi('/liquidate/history', {
6058
+ user: address
6059
+ });
6062
6060
  case 2:
6063
- liquidationHistorySubgraph = _context16.sent;
6064
- liquidationEvents = liquidationHistorySubgraph.liquidationEvents.map(function (event) {
6065
- var value = {
6066
- amount: event.underlyingRepayAmountUSD.toString(),
6067
- currency: 'USD'
6068
- };
6061
+ liquidationHistoryResp = _context16.sent;
6062
+ blocks = liquidationHistoryResp.items.map(function (event) {
6063
+ return event.blockNumber;
6064
+ });
6065
+ _context16.next = 6;
6066
+ return getBlocksTimestamp(this._networkConnection.provider, blocks);
6067
+ case 6:
6068
+ blocksTimestamp = _context16.sent;
6069
+ liquidationEvents = liquidationHistoryResp.items.map(function (event, idx) {
6069
6070
  var underlyingAddress = networkAddresses.auTokens.find(function (auToken) {
6070
- return auToken.name.slice(2).toLowerCase() === event.underlyingSymbol.toLowerCase();
6071
+ return auToken.address.toLowerCase() === event.marketRepayToken.toLowerCase();
6071
6072
  }).underlying;
6072
6073
  var decimal = getDecimal(underlyingAddress);
6073
6074
  var token = new Token(underlyingAddress, decimal);
6074
- var tokenAmount = new TokenAmount(token, event.underlyingRepayAmount.toString(), false);
6075
+ var tokenAmount = new TokenAmount(token, event.repayAmount.toString(), true);
6075
6076
  return {
6076
- liquidationTime: event.blockTime,
6077
+ liquidationTime: blocksTimestamp[idx],
6077
6078
  tokenAmount: tokenAmount,
6078
- value: value,
6079
- transactionId: event.id.split('-')[0]
6079
+ transactionId: event.txnHash
6080
6080
  };
6081
6081
  });
6082
6082
  return _context16.abrupt("return", liquidationEvents);
6083
- case 5:
6083
+ case 9:
6084
6084
  case "end":
6085
6085
  return _context16.stop();
6086
6086
  }
6087
- }, _callee16);
6087
+ }, _callee16, this);
6088
6088
  }));
6089
6089
  function getLiquidationHistory(_x21) {
6090
6090
  return _getLiquidationHistory.apply(this, arguments);