@ocap/tx-protocols 1.19.10 → 1.19.12
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.
- package/lib/protocols/account/migrate.js +14 -0
- package/package.json +14 -14
|
@@ -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.
|
|
6
|
+
"version": "1.19.12",
|
|
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.
|
|
25
|
-
"@arcblock/did-util": "1.19.
|
|
26
|
-
"@arcblock/jwt": "1.19.
|
|
27
|
-
"@arcblock/validator": "1.19.
|
|
28
|
-
"@ocap/asset": "1.19.
|
|
29
|
-
"@ocap/mcrypto": "1.19.
|
|
30
|
-
"@ocap/merkle-tree": "1.19.
|
|
31
|
-
"@ocap/message": "1.19.
|
|
32
|
-
"@ocap/state": "1.19.
|
|
33
|
-
"@ocap/tx-pipeline": "1.19.
|
|
34
|
-
"@ocap/util": "1.19.
|
|
35
|
-
"@ocap/wallet": "1.19.
|
|
24
|
+
"@arcblock/did": "1.19.12",
|
|
25
|
+
"@arcblock/did-util": "1.19.12",
|
|
26
|
+
"@arcblock/jwt": "1.19.12",
|
|
27
|
+
"@arcblock/validator": "1.19.12",
|
|
28
|
+
"@ocap/asset": "1.19.12",
|
|
29
|
+
"@ocap/mcrypto": "1.19.12",
|
|
30
|
+
"@ocap/merkle-tree": "1.19.12",
|
|
31
|
+
"@ocap/message": "1.19.12",
|
|
32
|
+
"@ocap/state": "1.19.12",
|
|
33
|
+
"@ocap/tx-pipeline": "1.19.12",
|
|
34
|
+
"@ocap/util": "1.19.12",
|
|
35
|
+
"@ocap/wallet": "1.19.12",
|
|
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": "
|
|
50
|
+
"gitHead": "049b58ceec62d77d189e8d83e3e5bcc8109618d5"
|
|
51
51
|
}
|