@stellar-expert/tx-meta-effects-parser 7.0.0-rc.2 → 7.0.0-rc.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/tx-meta-effects-parser",
3
- "version": "7.0.0-rc.2",
3
+ "version": "7.0.0-rc.3",
4
4
  "description": "Low-level effects parser for Stellar transaction results and meta XDR",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -304,7 +304,7 @@ function processEventBodyValue(value) {
304
304
  /*if (innerValue instanceof Array) //handle simple JS arrays
305
305
  return innerValue.map(xdrParseScVal)*/
306
306
  if (!innerValue) //scVoid
307
- return undefined
307
+ return null
308
308
  return xdrParseScVal(value) //other scValue
309
309
  }
310
310
 
package/src/index.js CHANGED
@@ -9,6 +9,7 @@ const {analyzeSignerChanges} = require('./aggregation/signer-changes-analyzer')
9
9
  const contractPreimageEncoder = require('./parser/contract-preimage-encoder')
10
10
  const xdrParserUtils = require('./parser/tx-xdr-parser-utils')
11
11
  const effectTypes = require('./effect-types')
12
+ const events = require('node:events')
12
13
 
13
14
  /**
14
15
  * Retrieve effects from transaction execution result metadata
@@ -141,7 +142,6 @@ function parseTxOperationsMeta({
141
142
  const opMeta = metaValue.operations()
142
143
  const isV4Meta = meta.arm() === 'v4'
143
144
  let txEvents = isV4Meta ? metaValue.events() : undefined
144
- let diagnosticEvents = isV4Meta ? metaValue.diagnosticEvents() : undefined
145
145
 
146
146
  //analyze operation effects for each operation
147
147
  for (let i = 0; i < parsedTx.operations.length; i++) {
@@ -153,14 +153,12 @@ function parseTxOperationsMeta({
153
153
  meta: opMeta[i]?.changes() || [],
154
154
  result: opResults[i],
155
155
  processFailedOpEffects,
156
- processMetrics,
157
- events: txEvents,
158
- diagnosticEvents
156
+ processMetrics
159
157
  }
160
158
  const isSorobanInvocation = operation.type === 'invokeHostFunction'
161
159
  //only for Soroban contract invocation
162
160
  if (isSorobanInvocation) {
163
- const sorobanMeta = metaValue._attributes.sorobanMeta
161
+ const {sorobanMeta} = metaValue._attributes
164
162
  if (sorobanMeta) {
165
163
  if (sorobanMeta.events) {
166
164
  params.events = sorobanMeta.events()
@@ -170,6 +168,10 @@ function parseTxOperationsMeta({
170
168
  }
171
169
  params.processSystemEvents = processSystemEvents
172
170
  }
171
+ if (isV4Meta) {
172
+ params.diagnosticEvents = metaValue.diagnosticEvents()
173
+ params.events = metaValue.operations()[0].events()
174
+ }
173
175
  params.mapSac = mapSac
174
176
  }
175
177
  const analyzer = new EffectsAnalyzer(params)