@ocap/tx-protocols 1.18.13 → 1.18.15
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/pipes/ensure-cost.js +16 -4
- package/lib/pipes/ensure-gas.js +5 -3
- package/package.json +14 -14
package/lib/pipes/ensure-cost.js
CHANGED
|
@@ -77,7 +77,6 @@ module.exports = function CreateEnsureTxCostPipe({ attachSenderChanges = true }
|
|
|
77
77
|
address: senderState.address,
|
|
78
78
|
token: config.token.address,
|
|
79
79
|
delta: `-${txCost.toString(10)}`,
|
|
80
|
-
action: 'fee',
|
|
81
80
|
};
|
|
82
81
|
|
|
83
82
|
debug({ changes, senderUpdates: context.senderUpdates });
|
|
@@ -112,6 +111,14 @@ module.exports = function CreateEnsureTxCostPipe({ attachSenderChanges = true }
|
|
|
112
111
|
delta: changes.fee.value,
|
|
113
112
|
action: 'fee',
|
|
114
113
|
});
|
|
114
|
+
if (attachSenderChanges) {
|
|
115
|
+
context.updatedAccounts.push({
|
|
116
|
+
address: senderState.address,
|
|
117
|
+
token: config.token.address,
|
|
118
|
+
delta: `-${changes.fee.value}`,
|
|
119
|
+
action: 'fee',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
115
122
|
}
|
|
116
123
|
if (changes.gas) {
|
|
117
124
|
context.updatedAccounts.push({
|
|
@@ -120,9 +127,14 @@ module.exports = function CreateEnsureTxCostPipe({ attachSenderChanges = true }
|
|
|
120
127
|
delta: changes.gas.value,
|
|
121
128
|
action: 'gas',
|
|
122
129
|
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
if (attachSenderChanges) {
|
|
131
|
+
context.updatedAccounts.push({
|
|
132
|
+
address: senderState.address,
|
|
133
|
+
token: config.token.address,
|
|
134
|
+
delta: `-${changes.gas.value}`,
|
|
135
|
+
action: 'gas',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
126
138
|
}
|
|
127
139
|
};
|
|
128
140
|
} else {
|
package/lib/pipes/ensure-gas.js
CHANGED
|
@@ -16,10 +16,12 @@ module.exports = function CreateGasEnsureFn(estimateTxGas) {
|
|
|
16
16
|
|
|
17
17
|
// total gas in native token
|
|
18
18
|
const { txGas } = config.transaction;
|
|
19
|
-
|
|
19
|
+
const basePrice = new BN(txGas.price);
|
|
20
|
+
|
|
20
21
|
const estimate = estimateTxGas(context);
|
|
21
|
-
totalGas =
|
|
22
|
-
totalGas = totalGas.add(new BN(txGas.
|
|
22
|
+
let totalGas = basePrice.mul(new BN(txGas.dataStorage)).mul(new BN(context.txSize));
|
|
23
|
+
totalGas = totalGas.add(basePrice.mul(new BN(txGas.createState)).mul(new BN(estimate.create + 1))); // 1 = tx insert
|
|
24
|
+
totalGas = totalGas.add(basePrice.mul(new BN(txGas.updateState)).mul(new BN(estimate.update)));
|
|
23
25
|
|
|
24
26
|
// gas receiver address
|
|
25
27
|
const { txGas: gasVaults } = config.vaults;
|
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.15",
|
|
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.15",
|
|
25
|
+
"@arcblock/did-util": "1.18.15",
|
|
26
|
+
"@arcblock/jwt": "1.18.15",
|
|
27
|
+
"@arcblock/validator": "1.18.15",
|
|
28
|
+
"@ocap/asset": "1.18.15",
|
|
29
|
+
"@ocap/mcrypto": "1.18.15",
|
|
30
|
+
"@ocap/merkle-tree": "1.18.15",
|
|
31
|
+
"@ocap/message": "1.18.15",
|
|
32
|
+
"@ocap/state": "1.18.15",
|
|
33
|
+
"@ocap/tx-pipeline": "1.18.15",
|
|
34
|
+
"@ocap/util": "1.18.15",
|
|
35
|
+
"@ocap/wallet": "1.18.15",
|
|
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": "2a6967982b3e0ebadc01509d67dd6293a03912ff"
|
|
51
51
|
}
|