@ocap/indexdb 1.18.96 → 1.18.97

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 -2
  2. package/package.json +4 -4
package/lib/util.js CHANGED
@@ -72,12 +72,16 @@ const createIndexedDelegation = (x, ctx) => {
72
72
  // https://discuss.elastic.co/t/updating-an-object-field/110735
73
73
  ops: [x.ops],
74
74
  };
75
- if (ctx.senderState) {
75
+ if (x.from) {
76
+ result.from = x.from;
77
+ } else if (ctx.senderState) {
76
78
  result.from = get(ctx, 'senderState.address', '');
77
79
  } else {
78
80
  result.from = get(ctx, 'tx.from', '');
79
81
  }
80
- if (ctx.receiverState) {
82
+ if (x.to) {
83
+ result.to = x.to;
84
+ } else if (ctx.receiverState) {
81
85
  result.to = get(ctx, 'receiverState.address', '');
82
86
  } else {
83
87
  result.to = get(ctx, 'itx.to', '');
@@ -140,6 +144,7 @@ const createIndexedTransaction = async (tx, ctx, indexdb) => {
140
144
  tx.factories = [];
141
145
  tx.stakes = [];
142
146
  tx.rollups = [];
147
+ tx.delegations = [];
143
148
 
144
149
  tx.valid = tx.code === 'OK';
145
150
 
@@ -162,6 +167,9 @@ const createIndexedTransaction = async (tx, ctx, indexdb) => {
162
167
  if (ctx.delegatorState) {
163
168
  tx.accounts.push(ctx.delegatorState.address);
164
169
  }
170
+ if (ctx.delegationState) {
171
+ tx.delegations.push(ctx.delegationState.address);
172
+ }
165
173
  if (ctx.delegationState && ctx.txType === 'fg:t:revoke_delegate') {
166
174
  const indexed = await indexdb.delegation.get(ctx.delegationState.address);
167
175
  if (indexed) {
@@ -408,6 +416,7 @@ const formatTxAfterRead = (tx) => {
408
416
  delete tx.accounts;
409
417
  delete tx.stakes;
410
418
  delete tx.rollups;
419
+ delete tx.delegations;
411
420
 
412
421
  return tx;
413
422
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.18.96",
6
+ "version": "1.18.97",
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.96",
29
- "@ocap/util": "1.18.96",
28
+ "@ocap/state": "1.18.97",
29
+ "@ocap/util": "1.18.97",
30
30
  "kareem": "^2.4.1",
31
31
  "lodash": "^4.17.21"
32
32
  },
33
- "gitHead": "aa29013a8114a39db09e0e787ab1e1bd94fcb453"
33
+ "gitHead": "691aabefd37f53b6fbcf771ce130f09197f0b268"
34
34
  }