@stellar-expert/tx-meta-effects-parser 7.0.0-rc.11 → 7.0.0-rc.12

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.11",
3
+ "version": "7.0.0-rc.12",
4
4
  "description": "Low-level effects parser for Stellar transaction results and meta XDR",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -155,7 +155,7 @@ class EventsAnalyzer {
155
155
  amount = amount.amount
156
156
  }
157
157
  }
158
- if (typeof amount!=='string')
158
+ if (typeof amount !== 'string')
159
159
  return null
160
160
  if (to === from) //self transfer - nothing happens
161
161
  return // TODO: need additional checks
@@ -252,7 +252,26 @@ class EventsAnalyzer {
252
252
  this.effectsAnalyzer.setAdmin(contract, newAdmin)
253
253
  }
254
254
  break
255
- /*case 'set_authorized':*/ //TODO: think about processing this effects
255
+ case 'set_authorized': {
256
+ if (!matchEventTopicsShape(topics, ['address', 'str?']))
257
+ return //throw new Error('Non-standard event')
258
+ const trustor = xdrParseScVal(topics[1])
259
+ const encodedAsset = xdrParseScVal(topics[2])
260
+ if (topics.length > 2) {
261
+ mapSacContract(this.effectsAnalyzer, contract, xdrParseAsset(encodedAsset))
262
+ }
263
+ const asset = this.effectsAnalyzer.resolveAsset(encodedAsset)
264
+ const isAuthorized = processEventBodyValue(body.data())
265
+ this.effectsAnalyzer.addEffect({
266
+ type: effectTypes.trustlineAuthorizationUpdated,
267
+ trustor,
268
+ asset,
269
+ flags: isAuthorized ? 1 : 0,
270
+ prevFlags: isAuthorized ? 0 : 1
271
+ })
272
+ }
273
+ break
274
+ //TODO: think about processing these effects
256
275
  /*case 'approve': {
257
276
  if (!matchEventTopicsShape(topics, ['address', 'address', 'str?']))
258
277
  throw new Error('Non-standard event')
@@ -300,7 +319,7 @@ function matchEventTopicsShape(topics, shape) {
300
319
  */
301
320
  function processEventBodyValue(value) {
302
321
  const innerValue = value.value()
303
- if (!innerValue) //scVoid
322
+ if (innerValue === undefined) //scVoid
304
323
  return null
305
324
  return xdrParseScVal(value) //other scValue
306
325
  }
@@ -352,7 +352,8 @@ class EffectsAnalyzer {
352
352
  asset,
353
353
  amount: (after.amount[i] - before.amount[i]).toString()
354
354
  })),
355
- shares: (after.shares - before.shares).toString()
355
+ shares: (after.shares - before.shares).toString(),
356
+ accounts: after.accounts
356
357
  })
357
358
  }
358
359
 
@@ -369,7 +370,8 @@ class EffectsAnalyzer {
369
370
  asset,
370
371
  amount: (before.amount[i] - after.amount[i]).toString()
371
372
  })),
372
- shares: (before.shares - after.shares).toString()
373
+ shares: (before.shares - after.shares).toString(),
374
+ accounts: after.accounts
373
375
  })
374
376
  }
375
377
 
@@ -604,6 +606,7 @@ class EffectsAnalyzer {
604
606
  return
605
607
  trustEffect.type = effectTypes.trustlineUpdated
606
608
  trustEffect.limit = snapshot.limit
609
+ trustEffect.prevFlags = before.flags
607
610
  break
608
611
  case 'removed':
609
612
  trustEffect.type = effectTypes.trustlineRemoved
package/tmp DELETED
@@ -1,100 +0,0 @@
1
- [3702678:0x59d4d50] 7542656 ms: Scavenge 4044.3 (4124.3) -> 4040.4 (4125.5) MB, 5.20 / 0.01 ms (average mu = 0.985, current mu = 0.979) allocation failure;
2
- [3702678:0x59d4d50] 7542686 ms: Scavenge 4045.5 (4125.6) -> 4043.2 (4144.0) MB, 7.64 / 0.00 ms (average mu = 0.985, current mu = 0.979) allocation failure;
3
-
4
-
5
- <--- JS stacktrace --->
6
-
7
- FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
8
- 1: 0xc98550 node::Abort() [node /srv/node-orchestrator-pubnet/index.js]
9
- 2: 0xb700a7 [node /srv/node-orchestrator-pubnet/index.js]
10
- 3: 0xebae50 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node /srv/node-orchestrator-pubnet/index.js]
11
- 4: 0xebb137 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node /srv/node-orchestrator-pubnet/index.js]
12
- 5: 0x10cc7a5 [node /srv/node-orchestrator-pubnet/index.js]
13
- 6: 0x10e4628 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node /srv/node-orchestrator-pubnet/index.js]
14
- 7: 0x10ba741 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
15
- 8: 0x10bb8d5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
16
- 9: 0x1097f16 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
17
- 10: 0x108955c v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node /srv/node-orchestrator-pubnet/index.js]
18
- 11: 0x10896c4 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node /srv/node-orchestrator-pubnet/index.js]
19
- 12: 0x13a312d v8::internal::Handle<v8::internal::EphemeronHashTable> v8::internal::HashTable<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::New<v8::internal::Isolate>(v8::internal::Isolate*, int, v8::internal::AllocationType, v8::internal::MinimumCapacity) [node /srv/node-orchestrator-pubnet/index.js]
20
- 13: 0x13a31d7 v8::internal::HashTable<v8::internal::EphemeronHashTable, v8::internal::ObjectHashTableShape>::Shrink(v8::internal::Isolate*, v8::internal::Handle<v8::internal::EphemeronHashTable>, int) [node /srv/node-orchestrator-pubnet/index.js]
21
- 14: 0x13a4958 v8::internal::JSWeakCollection::Delete(v8::internal::Handle<v8::internal::JSWeakCollection>, v8::internal::Handle<v8::internal::Object>, int) [node /srv/node-orchestrator-pubnet/index.js]
22
- 15: 0x14e9365 v8::internal::Runtime_WeakCollectionDelete(int, unsigned long*, v8::internal::Isolate*) [node /srv/node-orchestrator-pubnet/index.js]
23
- 16: 0x7f3411e99ef6
24
-
25
- <--- Last few GCs --->
26
-
27
- [3704687:0x5d5dd50] 7523706 ms: Mark-Compact 4046.0 (4137.6) -> 4035.1 (4139.2) MB, 1027.88 / 0.01 ms (average mu = 0.961, current mu = 0.796) allocation failure; scavenge might not succeed
28
- [3704687:0x5d5dd50] 7529446 ms: Mark-Compact 4051.7 (4140.1) -> 4040.8 (4144.7) MB, 1756.51 / 0.03 ms (average mu = 0.913, current mu = 0.694) allocation failure; scavenge might not succeed
29
-
30
-
31
- <--- JS stacktrace --->
32
-
33
- FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
34
- 1: 0xc98550 node::Abort() [node /srv/node-orchestrator-pubnet/index.js]
35
- 2: 0xb700a7 [node /srv/node-orchestrator-pubnet/index.js]
36
- 3: 0xebae50 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node /srv/node-orchestrator-pubnet/index.js]
37
- 4: 0xebb137 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node /srv/node-orchestrator-pubnet/index.js]
38
- 5: 0x10cc7a5 [node /srv/node-orchestrator-pubnet/index.js]
39
- 6: 0x10e4628 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node /srv/node-orchestrator-pubnet/index.js]
40
- 7: 0x10ba741 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
41
- 8: 0x10bb8d5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
42
- 9: 0x1097f16 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
43
- 10: 0x1089a14 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
44
- 11: 0x108c296 v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [node /srv/node-orchestrator-pubnet/index.js]
45
- 12: 0x13dc5f7 v8::internal::String::SlowFlatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::ConsString>, v8::internal::AllocationType) [node /srv/node-orchestrator-pubnet/index.js]
46
- 13: 0x13d487c v8::internal::StringTable::LookupString(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>) [node /srv/node-orchestrator-pubnet/index.js]
47
- 14: 0x14fd7ab v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::StoreOrigin, v8::Maybe<v8::internal::ShouldThrow>) [node /srv/node-orchestrator-pubnet/index.js]
48
- 15: 0x14fee3b v8::internal::Runtime_SetKeyedProperty(int, unsigned long*, v8::internal::Isolate*) [node /srv/node-orchestrator-pubnet/index.js]
49
- 16: 0x7f5fb2699ef6
50
-
51
- <--- Last few GCs --->
52
-
53
- [3706823:0x5a11d50] 7608708 ms: Mark-Compact 4052.9 (4140.9) -> 4038.6 (4142.9) MB, 999.38 / 0.04 ms (average mu = 0.972, current mu = 0.933) allocation failure; scavenge might not succeed
54
- [3706823:0x5a11d50] 7614274 ms: Mark-Compact 4055.3 (4143.8) -> 4044.4 (4148.6) MB, 1558.22 / 0.02 ms (average mu = 0.936, current mu = 0.720) allocation failure; scavenge might not succeed
55
-
56
-
57
- <--- JS stacktrace --->
58
-
59
- FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
60
- 1: 0xc98550 node::Abort() [node /srv/node-orchestrator-pubnet/index.js]
61
- 2: 0xb700a7 [node /srv/node-orchestrator-pubnet/index.js]
62
- 3: 0xebae50 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node /srv/node-orchestrator-pubnet/index.js]
63
- 4: 0xebb137 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node /srv/node-orchestrator-pubnet/index.js]
64
- 5: 0x10cc7a5 [node /srv/node-orchestrator-pubnet/index.js]
65
- 6: 0x10e4628 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node /srv/node-orchestrator-pubnet/index.js]
66
- 7: 0x10ba741 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
67
- 8: 0x10bb8d5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node /srv/node-orchestrator-pubnet/index.js]
68
- 9: 0x1098e46 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node /srv/node-orchestrator-pubnet/index.js]
69
- 10: 0x14f3c76 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node /srv/node-orchestrator-pubnet/index.js]
70
- 11: 0x7f4ed9e99ef6
71
- TypeError: fetch failed
72
- at Object.fetch (node:internal/deps/undici/undici:11576:11)
73
- at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
74
- at async fetchGateway (./node-orchestrator-pubnet/server/routes/node-settings-routes.js:173:17)
75
- at async validateGateway (./node-orchestrator-pubnet/server/routes/node-settings-routes.js:157:27)
76
- at async ./node-orchestrator-pubnet/server/routes/node-settings-routes.js:142:26 {
77
- cause: Error: connect ECONNREFUSED 172.***.***.224:8080
78
- at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
79
- errno: -111,
80
- code: 'ECONNREFUSED',
81
- syscall: 'connect',
82
- address: '172.***.***.224',
83
- port: 8080
84
- }
85
- }
86
- TypeError: fetch failed
87
- at Object.fetch (node:internal/deps/undici/undici:11576:11)
88
- at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
89
- at async fetchGateway (./node-orchestrator-pubnet/server/routes/node-settings-routes.js:173:17)
90
- at async validateGateway (./node-orchestrator-pubnet/server/routes/node-settings-routes.js:157:27)
91
- at async ./node-orchestrator-pubnet/server/routes/node-settings-routes.js:142:26 {
92
- cause: Error: connect ECONNREFUSED 172.***.***.198:8080
93
- at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
94
- errno: -111,
95
- code: 'ECONNREFUSED',
96
- syscall: 'connect',
97
- address: '172.***.***.198',
98
- port: 8080
99
- }
100
- }