@ocap/indexdb 1.18.12 → 1.18.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/util.js +5 -3
  2. package/package.json +4 -4
package/lib/util.js CHANGED
@@ -233,7 +233,9 @@ const createIndexedTransaction = async (tx, ctx, indexdb) => {
233
233
  return tx;
234
234
  };
235
235
 
236
- const createIndexedStake = (x, ctx) => {
236
+ const createIndexedStake = async (x, ctx, indexdb) => {
237
+ const tokens = uniq(Object.keys(x.tokens || {}).concat(Object.keys(x.revokedTokens || {})));
238
+ const tokenStates = await Promise.all(tokens.map((t) => indexdb.token.get(t)));
237
239
  return {
238
240
  ...pick(x, [
239
241
  'address',
@@ -247,10 +249,10 @@ const createIndexedStake = (x, ctx) => {
247
249
  'revokedAssets',
248
250
  ]),
249
251
  tokens: Object.keys(x.tokens || {}).map((address) =>
250
- formatTokenMeta({ address, balance: x.tokens[address] }, ctx.tokenStates)
252
+ formatTokenMeta({ address, balance: x.tokens[address] }, tokenStates)
251
253
  ),
252
254
  revokedTokens: Object.keys(x.revokedTokens || {}).map((address) =>
253
- formatTokenMeta({ address, balance: x.revokedTokens[address] }, ctx.tokenStates)
255
+ formatTokenMeta({ address, balance: x.revokedTokens[address] }, tokenStates)
254
256
  ),
255
257
  genesisTime: x.context.genesisTime,
256
258
  renaissanceTime: x.context.renaissanceTime,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.18.12",
6
+ "version": "1.18.14",
7
7
  "description": "Defines the basic interface for OCAP IndexDB",
8
8
  "main": "lib/main.js",
9
9
  "files": [
@@ -25,10 +25,10 @@
25
25
  "jest": "^27.5.1"
26
26
  },
27
27
  "dependencies": {
28
- "@ocap/state": "1.18.12",
29
- "@ocap/util": "1.18.12",
28
+ "@ocap/state": "1.18.14",
29
+ "@ocap/util": "1.18.14",
30
30
  "kareem": "^2.4.1",
31
31
  "lodash": "^4.17.21"
32
32
  },
33
- "gitHead": "bfdaa98613573a8a548c3927ebe91e3e22ed2889"
33
+ "gitHead": "3852a1704f0c47b17aaf64bddd78b87a568c3cb4"
34
34
  }