@ocap/statedb-memory 1.13.49 → 1.13.53

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
@@ -2,6 +2,7 @@ const { StateDB } = require('@ocap/statedb');
2
2
  const Table = require('./table/base');
3
3
  const Account = require('./table/account');
4
4
  const Token = require('./table/token');
5
+ const Rollup = require('./table/rollup');
5
6
 
6
7
  const { name, version } = require('../package.json');
7
8
 
@@ -20,7 +21,7 @@ class MemoryStateDB extends StateDB {
20
21
  this.token = new Token('token', 'address');
21
22
  this.chain = new Table('chain', 'address');
22
23
  this.stake = new Table('stake', 'address');
23
- this.rollup = new Table('rollup', 'address');
24
+ this.rollup = new Rollup('rollup', 'address');
24
25
  this.rollupBlock = new Table('rollupBlock', 'hash');
25
26
  this.evidence = new Table('evidence', 'hash');
26
27
 
@@ -0,0 +1,13 @@
1
+ const MemoryTable = require('./base');
2
+
3
+ class RollupTable extends MemoryTable {
4
+ async existByToken(token) {
5
+ if (!token) {
6
+ return false;
7
+ }
8
+
9
+ return this.collection.count({ tokenAddress: token }) > 0;
10
+ }
11
+ }
12
+
13
+ module.exports = RollupTable;
@@ -1,12 +1,12 @@
1
1
  const MemoryTable = require('./base');
2
2
 
3
3
  class TokenTable extends MemoryTable {
4
- async symbolExists(symbolName) {
5
- if (!symbolName) {
6
- throw new Error('param symbolName is required');
4
+ async existBySymbol(symbol) {
5
+ if (!symbol) {
6
+ throw new Error('param symbol is required');
7
7
  }
8
8
 
9
- return this.collection.count({ symbol: symbolName }) > 0;
9
+ return this.collection.count({ symbol }) > 0;
10
10
  }
11
11
  }
12
12
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocap/statedb-memory",
3
3
  "description": "OCAP statedb adapter that uses memory as backend statedb, just for test purpose",
4
- "version": "1.13.49",
4
+ "version": "1.13.53",
5
5
  "author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/ArcBlock/asset-chain/issues",
@@ -37,9 +37,9 @@
37
37
  "test": "node tools/jest.js",
38
38
  "coverage": "npm run test -- --coverage"
39
39
  },
40
- "gitHead": "c0af0d1ba7ead95f2224ff29aaebb635f6969a94",
40
+ "gitHead": "c754130bc70d5183261cfb0fcb1693c7b127dfe9",
41
41
  "dependencies": {
42
- "@ocap/statedb": "1.13.49",
42
+ "@ocap/statedb": "1.13.53",
43
43
  "debug": "^4.3.2",
44
44
  "lodash": "^4.17.21",
45
45
  "lokijs": "^1.5.11"