@stellar-expert/tx-meta-effects-parser 6.1.0 → 6.2.0
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/package.json +2 -2
- package/src/effects-analyzer.js +11 -4
- package/src/index.js +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stellar-expert/tx-meta-effects-parser",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Low-level effects parser for Stellar transaction results and meta XDR",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"author": "team@stellar.expert",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@stellar/stellar-base": "^12.1.
|
|
12
|
+
"@stellar/stellar-base": "^12.1.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@babel/core": "^7.22.9",
|
package/src/effects-analyzer.js
CHANGED
|
@@ -206,13 +206,16 @@ class EffectsAnalyzer {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
addFeeMetric(metaValue) {
|
|
209
|
-
const
|
|
209
|
+
const {sorobanMeta} = metaValue._attributes
|
|
210
|
+
if (!sorobanMeta)
|
|
211
|
+
return
|
|
212
|
+
const sorobanExt = sorobanMeta._attributes.ext._value
|
|
210
213
|
if (sorobanExt) {
|
|
211
214
|
const attrs = sorobanExt._attributes
|
|
212
215
|
const fee = {
|
|
213
|
-
nonrefundable: parseLargeInt(attrs.totalNonRefundableResourceFeeCharged),
|
|
214
|
-
refundable: parseLargeInt(attrs.totalRefundableResourceFeeCharged),
|
|
215
|
-
rent: parseLargeInt(attrs.rentFeeCharged)
|
|
216
|
+
nonrefundable: parseInt(parseLargeInt(attrs.totalNonRefundableResourceFeeCharged)),
|
|
217
|
+
refundable: parseInt(parseLargeInt(attrs.totalRefundableResourceFeeCharged)),
|
|
218
|
+
rent: parseInt(parseLargeInt(attrs.rentFeeCharged))
|
|
216
219
|
}
|
|
217
220
|
this.addMetric(this.retrieveOpContractId(), 'fee', fee)
|
|
218
221
|
}
|
|
@@ -1102,6 +1105,10 @@ function validateAmount(amount) {
|
|
|
1102
1105
|
return amount
|
|
1103
1106
|
}
|
|
1104
1107
|
|
|
1108
|
+
/**
|
|
1109
|
+
* @param largeInt
|
|
1110
|
+
* @return {String}
|
|
1111
|
+
*/
|
|
1105
1112
|
function parseLargeInt(largeInt) {
|
|
1106
1113
|
return largeInt._value.toString()
|
|
1107
1114
|
}
|
package/src/index.js
CHANGED
|
@@ -156,10 +156,12 @@ function parseTxOperationsMeta({
|
|
|
156
156
|
//only for Soroban contract invocation
|
|
157
157
|
if (isSorobanInvocation) {
|
|
158
158
|
const sorobanMeta = metaValue._attributes.sorobanMeta
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
if (sorobanMeta) {
|
|
160
|
+
params.events = sorobanMeta.events()
|
|
161
|
+
params.diagnosticEvents = sorobanMeta.diagnosticEvents()
|
|
162
|
+
params.processSystemEvents = processSystemEvents
|
|
163
|
+
}
|
|
161
164
|
params.mapSac = mapSac
|
|
162
|
-
params.processSystemEvents = processSystemEvents
|
|
163
165
|
}
|
|
164
166
|
const analyzer = new EffectsAnalyzer(params)
|
|
165
167
|
operation.effects = analyzer.analyze()
|