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

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": "6.4.0",
3
+ "version": "7.0.0-rc.2",
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": "^13.0.1"
12
+ "@stellar/stellar-base": "^14.0.0-rc.2"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@babel/core": "^7.22.9",
package/src/index.js CHANGED
@@ -139,6 +139,9 @@ function parseTxOperationsMeta({
139
139
  }
140
140
  const metaValue = meta.value()
141
141
  const opMeta = metaValue.operations()
142
+ const isV4Meta = meta.arm() === 'v4'
143
+ let txEvents = isV4Meta ? metaValue.events() : undefined
144
+ let diagnosticEvents = isV4Meta ? metaValue.diagnosticEvents() : undefined
142
145
 
143
146
  //analyze operation effects for each operation
144
147
  for (let i = 0; i < parsedTx.operations.length; i++) {
@@ -150,15 +153,21 @@ function parseTxOperationsMeta({
150
153
  meta: opMeta[i]?.changes() || [],
151
154
  result: opResults[i],
152
155
  processFailedOpEffects,
153
- processMetrics
156
+ processMetrics,
157
+ events: txEvents,
158
+ diagnosticEvents
154
159
  }
155
160
  const isSorobanInvocation = operation.type === 'invokeHostFunction'
156
161
  //only for Soroban contract invocation
157
162
  if (isSorobanInvocation) {
158
163
  const sorobanMeta = metaValue._attributes.sorobanMeta
159
164
  if (sorobanMeta) {
160
- params.events = sorobanMeta.events()
161
- params.diagnosticEvents = sorobanMeta.diagnosticEvents()
165
+ if (sorobanMeta.events) {
166
+ params.events = sorobanMeta.events()
167
+ }
168
+ if (sorobanMeta.diagnosticEvents) {
169
+ params.diagnosticEvents = sorobanMeta.diagnosticEvents()
170
+ }
162
171
  params.processSystemEvents = processSystemEvents
163
172
  }
164
173
  params.mapSac = mapSac
@@ -16,6 +16,7 @@ function parseTxMetaChanges(meta) {
16
16
  break
17
17
  case 'v2':
18
18
  case 'v3':
19
+ case 'v4':
19
20
  retrieveTopLevelChanges(transactionMeta.txChangesBefore(), txMetaChanges)
20
21
  retrieveTopLevelChanges(transactionMeta.txChangesAfter(), txMetaChanges)
21
22
  break