@ocap/indexdb-elasticsearch 1.13.70 → 1.13.74

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/lib/db.js CHANGED
@@ -5,6 +5,7 @@ const { formatPagination } = require('@ocap/indexdb/lib/util');
5
5
  const { parseDateTime } = require('@ocap/indexdb/lib/util');
6
6
  const { formatTxAfterRead } = require('@ocap/indexdb/lib/util');
7
7
  const { DEFAULT_TOKEN_DECIMAL } = require('@ocap/util/lib/constant');
8
+ const { toChecksumAddress } = require('@arcblock/did/lib/type');
8
9
 
9
10
  const debug = require('debug')(require('../package.json').name);
10
11
 
@@ -439,7 +440,7 @@ class ESIndexDB extends BaseIndexDB {
439
440
  return { stakes: items.map((item) => Stake.formatAfterRead(item)), paging: nextPaging };
440
441
  }
441
442
 
442
- async listRollups({ paging, tokenAddress = '', erc20TokenAddress = '' } = {}) {
443
+ async listRollups({ paging, tokenAddress = '', erc20TokenAddress = '', foreignTokenAddress = '' } = {}) {
443
444
  const pagination = formatPagination({
444
445
  paging,
445
446
  defaultSortField: 'renaissanceTime',
@@ -450,8 +451,14 @@ class ESIndexDB extends BaseIndexDB {
450
451
  if (tokenAddress) {
451
452
  conditions.push({ term: { tokenAddress } });
452
453
  }
453
- if (erc20TokenAddress) {
454
- conditions.push({ match: { erc20TokenAddress } });
454
+ const foreignTokenAddr = foreignTokenAddress || erc20TokenAddress;
455
+ if (foreignTokenAddr) {
456
+ conditions.push({
457
+ nested: {
458
+ path: 'foreignToken',
459
+ query: { bool: { must: { term: { 'foreignToken.contractAddress': toChecksumAddress(foreignTokenAddr) } } } },
460
+ },
461
+ });
455
462
  }
456
463
 
457
464
  debug('listRollups', { paging, pagination, conditions });
@@ -72,6 +72,8 @@ module.exports = () => ({
72
72
  totalDepositAmount: { type: 'text' },
73
73
  totalWithdrawAmount: { type: 'text' },
74
74
 
75
+ migrateHistory: { type: 'keyword' },
76
+
75
77
  data: { type: 'object', enabled: false },
76
78
  },
77
79
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocap/indexdb-elasticsearch",
3
3
  "description": "OCAP indexdb adapter that uses elasticsearch as backend",
4
- "version": "1.13.70",
4
+ "version": "1.13.74",
5
5
  "author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/ArcBlock/asset-chain/issues",
@@ -38,11 +38,12 @@
38
38
  "test": "jest --forceExit --detectOpenHandles",
39
39
  "coverage": "npm run test -- --coverage"
40
40
  },
41
- "gitHead": "17d673049138356f4cce9ca3d59e2f531b479c2d",
41
+ "gitHead": "24531e4142d2dc888d6f6091d82d2f7e5abe22ae",
42
42
  "dependencies": {
43
+ "@arcblock/did": "1.13.74",
43
44
  "@elastic/elasticsearch": "7.13.0",
44
- "@ocap/indexdb": "1.13.70",
45
- "@ocap/util": "1.13.70",
45
+ "@ocap/indexdb": "1.13.74",
46
+ "@ocap/util": "1.13.74",
46
47
  "axios": "^0.21.4",
47
48
  "bn.js": "^5.2.0",
48
49
  "debug": "^4.3.2",