@stellar-expert/tx-meta-effects-parser 7.0.0-rc.8 → 7.0.0-rc.9

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.8",
3
+ "version": "7.0.0-rc.9",
4
4
  "description": "Low-level effects parser for Stellar transaction results and meta XDR",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -149,12 +149,14 @@ class EventsAnalyzer {
149
149
  const receiver = xdrParseScVal(topics[2])
150
150
  let to = receiver
151
151
  let amount = processEventBodyValue(body.data())
152
- if (amount.amount !== undefined) {
152
+ if (amount?.amount !== undefined) {
153
153
  if (amount.to_muxed_id && !to.startsWith('M')) {
154
154
  to = encodeMuxedAccountToAddress(encodeMuxedAccount(to, amount.to_muxed_id))
155
155
  amount = amount.amount
156
156
  }
157
157
  }
158
+ if (typeof amount!=='string')
159
+ return null
158
160
  if (to === from) //self transfer - nothing happens
159
161
  return // TODO: need additional checks
160
162
  let classicAsset
@@ -188,12 +190,14 @@ class EventsAnalyzer {
188
190
  return //throw new Error('Non-standard event')
189
191
  let to = xdrParseScVal(topics[topics[2]?._arm === 'address' ? 2 : 1])
190
192
  let amount = processEventBodyValue(body.data())
191
- if (amount.amount !== undefined) {
193
+ if (amount?.amount !== undefined) {
192
194
  if (amount.to_muxed_id && !to.startsWith('M')) {
193
195
  to = encodeMuxedAccountToAddress(encodeMuxedAccount(to, amount.to_muxed_id))
194
196
  amount = amount.amount
195
197
  }
196
198
  }
199
+ if (typeof amount !== 'string')
200
+ return null
197
201
  const last = topics[topics.length - 1]
198
202
  if (last._arm === 'str') {
199
203
  mapSacContract(this.effectsAnalyzer, contract, xdrParseAsset(xdrParseScVal(last)))
@@ -210,8 +214,8 @@ class EventsAnalyzer {
210
214
  return //throw new Error('Non-standard event')
211
215
  const from = xdrParseScVal(topics[1])
212
216
  const amount = processEventBodyValue(body.data())
213
- if (!amount)
214
- return
217
+ if (typeof amount !== 'string')
218
+ return null
215
219
  if (topics.length > 2) {
216
220
  mapSacContract(this.effectsAnalyzer, contract, xdrParseAsset(xdrParseScVal(topics[2])))
217
221
  }
@@ -227,6 +231,8 @@ class EventsAnalyzer {
227
231
  return //throw new Error('Non-standard event')
228
232
  const from = xdrParseScVal(topics[topics[2]?._arm === 'address' ? 2 : 1])
229
233
  const amount = processEventBodyValue(body.data())
234
+ if (typeof amount !== 'string')
235
+ return null
230
236
  if (topics.length > 3) {
231
237
  mapSacContract(this.effectsAnalyzer, contract, xdrParseAsset(xdrParseScVal(topics[3])))
232
238
  }