@ocap/resolver 1.18.13 → 1.18.15

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.
Files changed (2) hide show
  1. package/lib/index.js +5 -5
  2. package/package.json +12 -12
package/lib/index.js CHANGED
@@ -678,9 +678,9 @@ module.exports = class OCAPResolver {
678
678
 
679
679
  const { txGas, maxTxSize } = this.config.transaction;
680
680
  const estimate = maxGasOps[args.typeUrl];
681
- let totalGas = new BN(txGas.price * txGas.dataStorage * maxTxSize[args.typeUrl]);
682
- totalGas = totalGas.add(new BN(txGas.price * txGas.createState * (estimate.create + 1))); // 1 = tx insert
683
- totalGas = totalGas.add(new BN(txGas.price * txGas.updateState * estimate.update));
681
+ let totalGas = new BN(txGas.price).mul(new BN(txGas.dataStorage)).mul(new BN(maxTxSize[args.typeUrl]));
682
+ totalGas = totalGas.add(new BN(txGas.price).mul(new BN(txGas.createState)).mul(new BN(estimate.create + 1))); // 1 = tx insert
683
+ totalGas = totalGas.add(new BN(txGas.price).mul(new BN(txGas.updateState)).mul(new BN(estimate.update)));
684
684
  return { estimate: { max: totalGas.toString(10) } };
685
685
  }
686
686
 
@@ -811,7 +811,7 @@ module.exports = class OCAPResolver {
811
811
  this.statedb[table].on('create', async (x, _ctx) => {
812
812
  try {
813
813
  const ctx = this.enrichIndexContext(_ctx);
814
- const doc = await fn(x, ctx);
814
+ const doc = await fn(x, ctx, this.indexdb);
815
815
  await this.indexdb[table].insert(doc);
816
816
  if (typeof onCreate === 'function') {
817
817
  await onCreate(doc, ctx, this.indexdb);
@@ -824,7 +824,7 @@ module.exports = class OCAPResolver {
824
824
  this.statedb[table].on('update', async (x, _ctx) => {
825
825
  try {
826
826
  const ctx = this.enrichIndexContext(_ctx);
827
- const doc = await fn(x, ctx);
827
+ const doc = await fn(x, ctx, this.indexdb);
828
828
  await this.indexdb[table].update(doc[key], doc);
829
829
  if (typeof onUpdate === 'function') {
830
830
  await onUpdate(doc, ctx, this.indexdb);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.18.13",
6
+ "version": "1.18.15",
7
7
  "description": "GraphQL resolver built upon ocap statedb and GQL layer",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -22,18 +22,18 @@
22
22
  "jest": "^27.5.1"
23
23
  },
24
24
  "dependencies": {
25
- "@arcblock/did": "1.18.13",
26
- "@arcblock/did-util": "1.18.13",
27
- "@arcblock/validator": "1.18.13",
28
- "@ocap/config": "1.18.13",
29
- "@ocap/indexdb": "1.18.13",
30
- "@ocap/mcrypto": "1.18.13",
31
- "@ocap/message": "1.18.13",
32
- "@ocap/state": "1.18.13",
33
- "@ocap/tx-protocols": "1.18.13",
34
- "@ocap/util": "1.18.13",
25
+ "@arcblock/did": "1.18.15",
26
+ "@arcblock/did-util": "1.18.15",
27
+ "@arcblock/validator": "1.18.15",
28
+ "@ocap/config": "1.18.15",
29
+ "@ocap/indexdb": "1.18.15",
30
+ "@ocap/mcrypto": "1.18.15",
31
+ "@ocap/message": "1.18.15",
32
+ "@ocap/state": "1.18.15",
33
+ "@ocap/tx-protocols": "1.18.15",
34
+ "@ocap/util": "1.18.15",
35
35
  "debug": "^4.3.4",
36
36
  "lodash": "^4.17.21"
37
37
  },
38
- "gitHead": "026028a4fe8d3178f0484980ceb9417809dce150"
38
+ "gitHead": "2a6967982b3e0ebadc01509d67dd6293a03912ff"
39
39
  }