@ocap/indexdb 1.17.7 → 1.17.8

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 +11 -5
  2. package/package.json +6 -6
package/lib/util.js CHANGED
@@ -85,7 +85,7 @@ const createIndexedToken = (x) => ({
85
85
  renaissanceTime: x.context.renaissanceTime,
86
86
  });
87
87
 
88
- const createIndexedFactory = async (factory, context) => {
88
+ const createIndexedFactory = (factory, context) => {
89
89
  if (context.factoryTokens && context.factoryTokens.length > 0) {
90
90
  factory.input.tokens = factory.input.tokens.map((token) => formatTokenMeta(token, context.tokenStates));
91
91
  }
@@ -116,7 +116,7 @@ const createIndexedFactory = async (factory, context) => {
116
116
  };
117
117
 
118
118
  // These fields are used internally to filter transactions by some entity
119
- const createIndexedTransaction = (tx, ctx) => {
119
+ const createIndexedTransaction = async (tx, ctx, indexdb) => {
120
120
  tx.accounts = [tx.tx.from, tx.sender, tx.receiver];
121
121
  tx.assets = [];
122
122
  tx.tokens = [];
@@ -142,6 +142,12 @@ const createIndexedTransaction = (tx, ctx) => {
142
142
  if (ctx.delegatorState) {
143
143
  tx.accounts.push(ctx.delegatorState.address);
144
144
  }
145
+ if (ctx.delegationState && ctx.txType === 'fg:t:revoke_delegate') {
146
+ const indexed = await indexdb.delegation.get(ctx.delegationState.address);
147
+ if (indexed) {
148
+ tx.accounts.push(indexed.to);
149
+ }
150
+ }
145
151
  if (Array.isArray(ctx.delegatorStates)) {
146
152
  tx.accounts.push(...ctx.delegatorStates.map((x) => x.address));
147
153
  }
@@ -200,7 +206,7 @@ const createIndexedTransaction = (tx, ctx) => {
200
206
  return tx;
201
207
  };
202
208
 
203
- const createIndexedStake = async (x, ctx) => {
209
+ const createIndexedStake = (x, ctx) => {
204
210
  return {
205
211
  ...pick(x, [
206
212
  'address',
@@ -224,7 +230,7 @@ const createIndexedStake = async (x, ctx) => {
224
230
  };
225
231
  };
226
232
 
227
- const createIndexedRollup = async (x, ctx) => {
233
+ const createIndexedRollup = (x, ctx) => {
228
234
  const rollup = {
229
235
  ...pick(x, [
230
236
  'address',
@@ -275,7 +281,7 @@ const createIndexedRollup = async (x, ctx) => {
275
281
  return rollup;
276
282
  };
277
283
 
278
- const createIndexedRollupBlock = async (x, ctx) => {
284
+ const createIndexedRollupBlock = (x, ctx) => {
279
285
  return {
280
286
  ...pick(x, [
281
287
  'hash',
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.17.7",
6
+ "version": "1.17.8",
7
7
  "description": "Defines the basic interface for OCAP IndexDB",
8
8
  "main": "lib/main.js",
9
9
  "files": [
@@ -22,13 +22,13 @@
22
22
  ],
23
23
  "license": "MIT",
24
24
  "devDependencies": {
25
- "jest": "^27.3.1"
25
+ "jest": "^27.5.1"
26
26
  },
27
27
  "dependencies": {
28
- "@ocap/state": "1.17.7",
29
- "@ocap/util": "1.17.7",
30
- "kareem": "^2.3.2",
28
+ "@ocap/state": "1.17.8",
29
+ "@ocap/util": "1.17.8",
30
+ "kareem": "^2.4.1",
31
31
  "lodash": "^4.17.21"
32
32
  },
33
- "gitHead": "02d9fa7c14c70f0a5fc1dcc5dc5506e43cb71ba5"
33
+ "gitHead": "04da221a224c17054eedf6317645e09e76258476"
34
34
  }