@ocap/tx-protocols 1.25.4 → 1.25.5

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.
@@ -247,10 +247,6 @@ runner.use(
247
247
  });
248
248
  });
249
249
 
250
- // update sender
251
- if (senderChange) {
252
- accountUpdates[senderChange.address] = applyTokenChange(accountUpdates[senderChange.address], senderChange);
253
- }
254
250
  // Ensure the sender exists in accountUpdates, because even if there is no balance change, we need to update his nonce
255
251
  if (!accountUpdates[tx.from]) {
256
252
  accountUpdates[tx.from] = senderState || {};
@@ -275,6 +271,14 @@ runner.use(
275
271
  }
276
272
  );
277
273
 
274
+ // update sender
275
+ if (senderChange) {
276
+ accountUpdates[senderChange.address] = applyTokenChange(
277
+ accountUpdates[senderChange.address] || senderState,
278
+ senderChange
279
+ );
280
+ }
281
+
278
282
  const [newAccountStates, newTokenFactoryState, newTokenState] = await Promise.all([
279
283
  // update accounts
280
284
  Promise.all(
@@ -284,10 +288,13 @@ runner.use(
284
288
  const state = [senderState, receiverState, ownerState, ...signerStates].find((x) => x?.address === address);
285
289
 
286
290
  // Should only update nonce and pk for sender and new accounts
287
- const actualUpdates =
288
- address === tx.from || !state
289
- ? { ...updates, address, nonce: tx.nonce, pk: tx.pk }
290
- : pick(updates, ['tokens']);
291
+ const actualUpdates = state ? pick(updates, ['tokens']) : { ...updates, address };
292
+
293
+ // Should only update nonce and pk for sender
294
+ if (address === tx.from) {
295
+ actualUpdates.pk = tx.pk;
296
+ actualUpdates.nonce = tx.nonce;
297
+ }
291
298
 
292
299
  return statedb.account.updateOrCreate(state, account.updateOrCreate(state, actualUpdates, context), context);
293
300
  })
@@ -252,10 +252,6 @@ runner.use(
252
252
  });
253
253
  });
254
254
 
255
- // update sender
256
- if (senderChange) {
257
- accountUpdates[senderChange.address] = applyTokenChange(accountUpdates[senderChange.address], senderChange);
258
- }
259
255
  // Ensure the sender exists in accountUpdates, because even if there is no balance change, we need to update his nonce
260
256
  if (!accountUpdates[tx.from]) {
261
257
  accountUpdates[tx.from] = senderState || {};
@@ -280,6 +276,14 @@ runner.use(
280
276
  }
281
277
  );
282
278
 
279
+ // update sender
280
+ if (senderChange) {
281
+ accountUpdates[senderChange.address] = applyTokenChange(
282
+ accountUpdates[senderChange.address] || senderState,
283
+ senderChange
284
+ );
285
+ }
286
+
283
287
  const [newAccountStates, newTokenFactoryState, newTokenState] = await Promise.all([
284
288
  // update accounts
285
289
  Promise.all(
@@ -288,11 +292,13 @@ runner.use(
288
292
  // the sender and receiver are allowed to be created in the transaction.
289
293
  const state = [senderState, receiverState, ownerState, ...signerStates].find((x) => x?.address === address);
290
294
 
291
- // Should only update nonce and pk for sender and new accounts
292
- const actualUpdates =
293
- address === tx.from || !state
294
- ? { ...updates, address, nonce: tx.nonce, pk: tx.pk }
295
- : pick(updates, ['tokens']);
295
+ const actualUpdates = state ? pick(updates, ['tokens']) : { ...updates, address };
296
+
297
+ // Should only update nonce and pk for sender
298
+ if (address === tx.from) {
299
+ actualUpdates.pk = tx.pk;
300
+ actualUpdates.nonce = tx.nonce;
301
+ }
296
302
 
297
303
  return statedb.account.updateOrCreate(state, account.updateOrCreate(state, actualUpdates, context), context);
298
304
  })
@@ -19,7 +19,7 @@ module.exports =
19
19
  return next(new Error('INVALID_ICON', `Token Icon must be less than ${Math.floor(size / 1024)}k`));
20
20
  }
21
21
 
22
- const sanitizedIcon = sanitizeSvg(icon);
22
+ const sanitizedIcon = sanitizeSvg(icon, { preserveCase: true });
23
23
 
24
24
  set(context, iconKey, sanitizedIcon);
25
25
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.25.4",
6
+ "version": "1.25.5",
7
7
  "description": "Predefined tx pipeline sets to execute certain type of transactions",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -13,26 +13,26 @@
13
13
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@blocklet/xss": "^0.2.7",
16
+ "@blocklet/xss": "^0.2.8",
17
17
  "debug": "^4.3.6",
18
18
  "deep-diff": "^1.0.2",
19
19
  "empty-value": "^1.0.1",
20
20
  "lodash": "^4.17.21",
21
21
  "url-join": "^4.0.1",
22
- "@arcblock/did": "1.25.4",
23
- "@arcblock/did-util": "1.25.4",
24
- "@arcblock/jwt": "1.25.4",
25
- "@arcblock/validator": "1.25.4",
26
- "@arcblock/vc": "1.25.4",
27
- "@ocap/asset": "1.25.4",
28
- "@ocap/client": "1.25.4",
29
- "@ocap/mcrypto": "1.25.4",
30
- "@ocap/merkle-tree": "1.25.4",
31
- "@ocap/message": "1.25.4",
32
- "@ocap/state": "1.25.4",
33
- "@ocap/tx-pipeline": "1.25.4",
34
- "@ocap/util": "1.25.4",
35
- "@ocap/wallet": "1.25.4"
22
+ "@arcblock/did": "1.25.5",
23
+ "@arcblock/did-util": "1.25.5",
24
+ "@arcblock/jwt": "1.25.5",
25
+ "@arcblock/validator": "1.25.5",
26
+ "@ocap/asset": "1.25.5",
27
+ "@arcblock/vc": "1.25.5",
28
+ "@ocap/client": "1.25.5",
29
+ "@ocap/mcrypto": "1.25.5",
30
+ "@ocap/merkle-tree": "1.25.5",
31
+ "@ocap/message": "1.25.5",
32
+ "@ocap/state": "1.25.5",
33
+ "@ocap/tx-pipeline": "1.25.5",
34
+ "@ocap/util": "1.25.5",
35
+ "@ocap/wallet": "1.25.5"
36
36
  },
37
37
  "resolutions": {
38
38
  "bn.js": "5.2.2",
@@ -41,8 +41,8 @@
41
41
  "devDependencies": {
42
42
  "jest": "^29.7.0",
43
43
  "start-server-and-test": "^1.14.0",
44
- "@ocap/e2e-test": "1.25.4",
45
- "@ocap/statedb-memory": "1.25.4"
44
+ "@ocap/statedb-memory": "1.25.5",
45
+ "@ocap/e2e-test": "1.25.5"
46
46
  },
47
47
  "scripts": {
48
48
  "lint": "eslint tests lib",