@ocap/tx-protocols 1.13.69 → 1.13.70

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.
@@ -252,70 +252,74 @@ runner.use(
252
252
  const { tx, itx, statedb, rollupState, senderState, stakeStates, txStates, formattedItx } = context;
253
253
  const senderStates = context.senderStates || [];
254
254
 
255
- const [newSenderState, newStakeStates, newSenderStates, newRollupState, rollupBlockState] = await Promise.all([
256
- // update sender(proposer) account
257
- statedb.account.update(
258
- senderState.address,
259
- account.update(senderState, Object.assign({ nonce: tx.nonce }), context),
260
- context
261
- ),
262
-
263
- // update stake states
264
- Promise.all(
265
- stakeStates.map((x) =>
266
- context.stakeUpdates[x.address]
267
- ? statedb.stake.update(
268
- x.address,
269
- stake.update(x, applyTokenChange(x, context.stakeUpdates[x.address]), context),
270
- context
271
- )
272
- : Promise.resolve(x)
273
- )
274
- ),
275
-
276
- // update tx owner states: those may get refund
277
- Promise.all(
278
- senderStates.map((x) =>
279
- statedb.account.update(
280
- x.address,
281
- account.update(x, applyTokenChange(x, context.accountUpdates[x.address]), context),
282
- context
255
+ const [newSenderState, newStakeStates, newSenderStates, newRollupState, rollupBlockState, newTxStates] =
256
+ await Promise.all([
257
+ // update sender(proposer) account
258
+ statedb.account.update(
259
+ senderState.address,
260
+ account.update(senderState, Object.assign({ nonce: tx.nonce }), context),
261
+ context
262
+ ),
263
+
264
+ // update stake states
265
+ Promise.all(
266
+ stakeStates.map((x) =>
267
+ context.stakeUpdates[x.address]
268
+ ? statedb.stake.update(
269
+ x.address,
270
+ stake.update(x, applyTokenChange(x, context.stakeUpdates[x.address]), context),
271
+ context
272
+ )
273
+ : Promise.resolve(x)
283
274
  )
284
- )
285
- ),
286
-
287
- // Update rollup state
288
- statedb.rollup.update(
289
- rollupState.address,
290
- rollup.update(rollupState, { blockHeight: itx.height, blockHash: itx.hash }, context),
291
- context
292
- ),
293
-
294
- // Create rollup block
295
- statedb.rollupBlock.create(
296
- itx.hash,
297
- rollupBlock.create(
298
- {
299
- ...formattedItx,
300
- ...['rewardAmount', 'mintedAmount', 'burnedAmount'].reduce((acc, x) => {
301
- acc[x] = context[x].toString(10);
302
- return acc;
303
- }, {}),
304
- },
275
+ ),
276
+
277
+ // update tx owner states: those may get refund
278
+ Promise.all(
279
+ senderStates.map((x) =>
280
+ statedb.account.update(
281
+ x.address,
282
+ account.update(x, applyTokenChange(x, context.accountUpdates[x.address]), context),
283
+ context
284
+ )
285
+ )
286
+ ),
287
+
288
+ // Update rollup state
289
+ statedb.rollup.update(
290
+ rollupState.address,
291
+ rollup.update(rollupState, { blockHeight: itx.height, blockHash: itx.hash }, context),
292
+ context
293
+ ),
294
+
295
+ // Create rollup block
296
+ statedb.rollupBlock.create(
297
+ itx.hash,
298
+ rollupBlock.create(
299
+ {
300
+ ...formattedItx,
301
+ ...['rewardAmount', 'mintedAmount', 'burnedAmount'].reduce((acc, x) => {
302
+ acc[x] = context[x].toString(10);
303
+ return acc;
304
+ }, {}),
305
+ },
306
+ context
307
+ ),
305
308
  context
306
309
  ),
307
- context
308
- ),
309
310
 
310
- // Update tx states: mark as finalized
311
- Promise.all(txStates.map((x) => statedb.tx.update(x.hash, Tx.update(x, { finalized: true, tx: x.tx }), context))),
312
- ]);
311
+ // Update tx states: mark as finalized
312
+ Promise.all(
313
+ txStates.map((x) => statedb.tx.update(x.hash, Tx.update(x, { finalized: true, tx: x.tx }), context))
314
+ ),
315
+ ]);
313
316
 
314
317
  context.senderState = newSenderState;
315
318
  context.stakeStates = newStakeStates.filter((x) => context.stakeUpdates[x.address]);
316
319
  context.newSenderStates = newSenderStates;
317
320
  context.rollupState = newRollupState;
318
321
  context.rollupBlockState = rollupBlockState;
322
+ context.txStates = newTxStates;
319
323
 
320
324
  context.updatedAccounts = [...Object.values(context.stakeUpdates), ...Object.values(context.accountUpdates)];
321
325
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.13.69",
6
+ "version": "1.13.70",
7
7
  "description": "Predefined tx pipeline sets to execute certain type of transactions",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,17 +19,17 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@arcblock/did": "1.13.69",
23
- "@arcblock/did-util": "1.13.69",
24
- "@ocap/asset": "1.13.69",
25
- "@ocap/mcrypto": "1.13.69",
26
- "@ocap/merkle-tree": "1.13.69",
27
- "@ocap/message": "1.13.69",
28
- "@ocap/state": "1.13.69",
29
- "@ocap/tx-pipeline": "1.13.69",
30
- "@ocap/util": "1.13.69",
31
- "@ocap/validator": "1.13.69",
32
- "@ocap/wallet": "1.13.69",
22
+ "@arcblock/did": "1.13.70",
23
+ "@arcblock/did-util": "1.13.70",
24
+ "@ocap/asset": "1.13.70",
25
+ "@ocap/mcrypto": "1.13.70",
26
+ "@ocap/merkle-tree": "1.13.70",
27
+ "@ocap/message": "1.13.70",
28
+ "@ocap/state": "1.13.70",
29
+ "@ocap/tx-pipeline": "1.13.70",
30
+ "@ocap/util": "1.13.70",
31
+ "@ocap/validator": "1.13.70",
32
+ "@ocap/wallet": "1.13.70",
33
33
  "debug": "^4.3.2",
34
34
  "empty-value": "^1.0.1",
35
35
  "lodash": "^4.17.21",
@@ -42,5 +42,5 @@
42
42
  "devDependencies": {
43
43
  "jest": "^27.3.1"
44
44
  },
45
- "gitHead": "7520d994d592dc4fe50612a665c94d7fa4d5b143"
45
+ "gitHead": "17d673049138356f4cce9ca3d59e2f531b479c2d"
46
46
  }