@ocap/indexdb 1.18.2 → 1.18.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/util.js +17 -0
- package/package.json +4 -4
package/lib/util.js
CHANGED
@@ -123,6 +123,20 @@ const createIndexedFactory = (factory, context) => {
|
|
123
123
|
};
|
124
124
|
};
|
125
125
|
|
126
|
+
const attachPaidTxGas = (tx) => {
|
127
|
+
// determine gasPaid
|
128
|
+
let gasChange = null;
|
129
|
+
tx.receipts.forEach((r) => {
|
130
|
+
const tmp = r.changes.find((c) => c.action === 'gas' && c.value === tx.tx.gasFee);
|
131
|
+
if (tmp) {
|
132
|
+
gasChange = tmp;
|
133
|
+
}
|
134
|
+
});
|
135
|
+
tx.tx.gasPaid = gasChange ? tx.tx.gasFee : '0';
|
136
|
+
|
137
|
+
return tx;
|
138
|
+
};
|
139
|
+
|
126
140
|
// These fields are used internally to filter transactions by some entity
|
127
141
|
const createIndexedTransaction = async (tx, ctx, indexdb) => {
|
128
142
|
tx.accounts = [tx.tx.from, tx.sender, tx.receiver];
|
@@ -134,6 +148,8 @@ const createIndexedTransaction = async (tx, ctx, indexdb) => {
|
|
134
148
|
|
135
149
|
tx.valid = tx.code === 'OK';
|
136
150
|
|
151
|
+
attachPaidTxGas(tx);
|
152
|
+
|
137
153
|
// accounts
|
138
154
|
if (ctx.senderState) {
|
139
155
|
tx.accounts.push(ctx.senderState.address);
|
@@ -529,4 +545,5 @@ module.exports = {
|
|
529
545
|
parseDateTime,
|
530
546
|
formatTokenMeta,
|
531
547
|
isDefaultTokenChanged,
|
548
|
+
attachPaidTxGas,
|
532
549
|
};
|
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.4",
|
7
7
|
"description": "Defines the basic interface for OCAP IndexDB",
|
8
8
|
"main": "lib/main.js",
|
9
9
|
"files": [
|
@@ -25,10 +25,10 @@
|
|
25
25
|
"jest": "^27.5.1"
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"@ocap/state": "1.18.
|
29
|
-
"@ocap/util": "1.18.
|
28
|
+
"@ocap/state": "1.18.4",
|
29
|
+
"@ocap/util": "1.18.4",
|
30
30
|
"kareem": "^2.4.1",
|
31
31
|
"lodash": "^4.17.21"
|
32
32
|
},
|
33
|
-
"gitHead": "
|
33
|
+
"gitHead": "08c8557c30fc3f61988a23033e9751a945599171"
|
34
34
|
}
|