@ocap/tx-protocols 1.19.10 → 1.19.11

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.
@@ -6,6 +6,9 @@ const { getRelatedAddresses } = require('@ocap/util/lib/get-related-addr');
6
6
  const { Runner, pipes } = require('@ocap/tx-pipeline');
7
7
  const { fromPublicKey, toTypeInfo } = require('@arcblock/did');
8
8
  const { account } = require('@ocap/state');
9
+ const {
10
+ types: { RoleType },
11
+ } = require('@ocap/mcrypto');
9
12
 
10
13
  // eslint-disable-next-line global-require
11
14
  const debug = require('debug')(`${require('../../../package.json').name}:migrate`);
@@ -47,6 +50,17 @@ runner.use(pipes.VerifyAccountMigration({ stateKey: 'senderState', addressKey: '
47
50
  // Ensure tx fee and gas
48
51
  runner.use(
49
52
  EnsureTxGas((context) => {
53
+ const { itx, senderState, tx } = context;
54
+ const isApplicationMigration = [senderState?.address || tx.from, itx.address].every(
55
+ (address) => toTypeInfo(address).role === RoleType.ROLE_APPLICATION
56
+ );
57
+
58
+ // Do not charge gas for migration between applications
59
+ if (isApplicationMigration) {
60
+ Object.defineProperty(context, 'txBaseGas', { value: false });
61
+ return { create: 0, update: 0, payment: 0 };
62
+ }
63
+
50
64
  return {
51
65
  create: context.senderState ? 1 : 2,
52
66
  update: context.senderState ? getRelatedAddresses(context.senderState).length : 0,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.19.10",
6
+ "version": "1.19.11",
7
7
  "description": "Predefined tx pipeline sets to execute certain type of transactions",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,18 +21,18 @@
21
21
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@arcblock/did": "1.19.10",
25
- "@arcblock/did-util": "1.19.10",
26
- "@arcblock/jwt": "1.19.10",
27
- "@arcblock/validator": "1.19.10",
28
- "@ocap/asset": "1.19.10",
29
- "@ocap/mcrypto": "1.19.10",
30
- "@ocap/merkle-tree": "1.19.10",
31
- "@ocap/message": "1.19.10",
32
- "@ocap/state": "1.19.10",
33
- "@ocap/tx-pipeline": "1.19.10",
34
- "@ocap/util": "1.19.10",
35
- "@ocap/wallet": "1.19.10",
24
+ "@arcblock/did": "1.19.11",
25
+ "@arcblock/did-util": "1.19.11",
26
+ "@arcblock/jwt": "1.19.11",
27
+ "@arcblock/validator": "1.19.11",
28
+ "@ocap/asset": "1.19.11",
29
+ "@ocap/mcrypto": "1.19.11",
30
+ "@ocap/merkle-tree": "1.19.11",
31
+ "@ocap/message": "1.19.11",
32
+ "@ocap/state": "1.19.11",
33
+ "@ocap/tx-pipeline": "1.19.11",
34
+ "@ocap/util": "1.19.11",
35
+ "@ocap/wallet": "1.19.11",
36
36
  "debug": "^4.3.6",
37
37
  "deep-diff": "^1.0.2",
38
38
  "empty-value": "^1.0.1",
@@ -47,5 +47,5 @@
47
47
  "jest": "^29.7.0",
48
48
  "start-server-and-test": "^1.14.0"
49
49
  },
50
- "gitHead": "fcf36923c21e713432ddda803fd25c699b127644"
50
+ "gitHead": "cf5dd421e071f3da183d2350ffbf337a15511375"
51
51
  }