@ocap/tx-protocols 1.18.4 → 1.18.6
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/execute.js +1 -1
- package/lib/pipes/ensure-cost.js +3 -2
- package/lib/protocols/trade/transfer-v3.js +8 -1
- package/package.json +14 -14
package/lib/execute.js
CHANGED
|
@@ -91,7 +91,7 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
91
91
|
try {
|
|
92
92
|
await runAsLambda((txn) => {
|
|
93
93
|
// create a new context each time in case we are retrying
|
|
94
|
-
ctx = pick(context, ['txBase64', 'statedb', 'config', 'states']);
|
|
94
|
+
ctx = pick(context, ['txBase64', 'statedb', 'indexdb', 'config', 'states', 'extra']);
|
|
95
95
|
Object.defineProperty(ctx, 'txn', { value: txn });
|
|
96
96
|
return execute(ctx, protocols, true);
|
|
97
97
|
});
|
package/lib/pipes/ensure-cost.js
CHANGED
|
@@ -38,8 +38,8 @@ module.exports = function CreateEnsureTxCostPipe({ attachSenderChanges = true }
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// verify gas staking headers
|
|
41
|
-
const { tx,
|
|
42
|
-
const { token, pk } = gasStakeHeaders || {};
|
|
41
|
+
const { tx, extra = {} } = context;
|
|
42
|
+
const { token, pk } = extra.gasStakeHeaders || {};
|
|
43
43
|
const gasStake = {};
|
|
44
44
|
if (token && pk) {
|
|
45
45
|
if (JWT.verify(token, pk) === false) {
|
|
@@ -56,6 +56,7 @@ module.exports = function CreateEnsureTxCostPipe({ attachSenderChanges = true }
|
|
|
56
56
|
gasStake.state = await statedb.stake.get(gasStake.stakeId, context);
|
|
57
57
|
gasStake.valid = isGasStakeValid(gasStake.state, config);
|
|
58
58
|
context.gasStake = gasStake;
|
|
59
|
+
debug('gasStake', gasStake, context.extra);
|
|
59
60
|
|
|
60
61
|
// If we have someone to pay for this tx
|
|
61
62
|
if (senderState && !gasStake.valid) {
|
|
@@ -148,7 +148,14 @@ runner.use(
|
|
|
148
148
|
const ops = { create: 0, update: 0, payment: 0 };
|
|
149
149
|
ops.update += context.signerStates.length;
|
|
150
150
|
ops.update += context.inputAssets.length;
|
|
151
|
-
|
|
151
|
+
|
|
152
|
+
context.receivers.forEach((x) => {
|
|
153
|
+
if (context.receiverStates.find((r) => r.address === x)) {
|
|
154
|
+
ops.update += 1;
|
|
155
|
+
} else {
|
|
156
|
+
ops.create += 1;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
152
159
|
|
|
153
160
|
if (context.senderState) {
|
|
154
161
|
ops.update += 1;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.18.
|
|
6
|
+
"version": "1.18.6",
|
|
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.18.
|
|
25
|
-
"@arcblock/did-util": "1.18.
|
|
26
|
-
"@arcblock/jwt": "1.18.
|
|
27
|
-
"@arcblock/validator": "1.18.
|
|
28
|
-
"@ocap/asset": "1.18.
|
|
29
|
-
"@ocap/mcrypto": "1.18.
|
|
30
|
-
"@ocap/merkle-tree": "1.18.
|
|
31
|
-
"@ocap/message": "1.18.
|
|
32
|
-
"@ocap/state": "1.18.
|
|
33
|
-
"@ocap/tx-pipeline": "1.18.
|
|
34
|
-
"@ocap/util": "1.18.
|
|
35
|
-
"@ocap/wallet": "1.18.
|
|
24
|
+
"@arcblock/did": "1.18.6",
|
|
25
|
+
"@arcblock/did-util": "1.18.6",
|
|
26
|
+
"@arcblock/jwt": "1.18.6",
|
|
27
|
+
"@arcblock/validator": "1.18.6",
|
|
28
|
+
"@ocap/asset": "1.18.6",
|
|
29
|
+
"@ocap/mcrypto": "1.18.6",
|
|
30
|
+
"@ocap/merkle-tree": "1.18.6",
|
|
31
|
+
"@ocap/message": "1.18.6",
|
|
32
|
+
"@ocap/state": "1.18.6",
|
|
33
|
+
"@ocap/tx-pipeline": "1.18.6",
|
|
34
|
+
"@ocap/util": "1.18.6",
|
|
35
|
+
"@ocap/wallet": "1.18.6",
|
|
36
36
|
"debug": "^4.3.4",
|
|
37
37
|
"deep-diff": "^1.0.2",
|
|
38
38
|
"empty-value": "^1.0.1",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"jest": "^27.5.1",
|
|
48
48
|
"start-server-and-test": "^1.14.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "48fb40b565d9cba2b67f181d9c312ba779fd750b"
|
|
51
51
|
}
|