@ocap/resolver 1.17.23 → 1.18.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/lib/hooks.js CHANGED
@@ -188,7 +188,9 @@ const onClaimBlockReward = async (tx, ctx, indexdb) => {
188
188
 
189
189
  const receipt = tx.receipts.find((x) => x.address === signer);
190
190
  if (receipt) {
191
- const change = receipt.changes.find((x) => x.target === rollupState.tokenAddress);
191
+ const change = receipt.changes.find(
192
+ (x) => x.target === rollupState.tokenAddress && new BN(x.value).isNeg() === false
193
+ );
192
194
  doc.totalGain = new BN(doc.totalGain).add(new BN(change.value).abs()).toString(10);
193
195
  await indexdb.rollupValidator.update(signer, doc);
194
196
  debug('update rollup validator on claim reward', signer);
package/lib/index.js CHANGED
@@ -687,13 +687,13 @@ module.exports = class OCAPResolver {
687
687
 
688
688
  // Auto populate token holder accounts if not exist
689
689
  for (let i = 0; i < accounts.length; i++) {
690
- const { address, balance } = accounts[i];
690
+ const { address, balance, moniker } = accounts[i];
691
691
  try {
692
692
  const existAccount = await accountDB.get(address, ctx);
693
693
  if (!existAccount) {
694
694
  const balanceStr = fromTokenToUnit(balance, token.decimal).toString(10);
695
695
  const state = accountState.create(
696
- { address, tokens: { [this.tokenItx.address]: balanceStr }, moniker: 'token-holder' },
696
+ { address, tokens: { [this.tokenItx.address]: balanceStr }, moniker: moniker || 'token-holder' },
697
697
  context
698
698
  );
699
699
  const result = await accountDB.create(address, state, ctx);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.17.23",
6
+ "version": "1.18.0",
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.17.23",
26
- "@arcblock/did-util": "1.17.23",
27
- "@arcblock/validator": "1.17.23",
28
- "@ocap/config": "1.17.23",
29
- "@ocap/indexdb": "1.17.23",
30
- "@ocap/mcrypto": "1.17.23",
31
- "@ocap/message": "1.17.23",
32
- "@ocap/state": "1.17.23",
33
- "@ocap/tx-protocols": "1.17.23",
34
- "@ocap/util": "1.17.23",
25
+ "@arcblock/did": "1.18.0",
26
+ "@arcblock/did-util": "1.18.0",
27
+ "@arcblock/validator": "1.18.0",
28
+ "@ocap/config": "1.18.0",
29
+ "@ocap/indexdb": "1.18.0",
30
+ "@ocap/mcrypto": "1.18.0",
31
+ "@ocap/message": "1.18.0",
32
+ "@ocap/state": "1.18.0",
33
+ "@ocap/tx-protocols": "1.18.0",
34
+ "@ocap/util": "1.18.0",
35
35
  "debug": "^4.3.4",
36
36
  "lodash": "^4.17.21"
37
37
  },
38
- "gitHead": "aecdce3fc6aaee32ea60db191d61962963f5e0bf"
38
+ "gitHead": "c48f928ee4f0deddf0f5e4bcb82fd6ffd7f2bc99"
39
39
  }