@stellar-expert/tx-meta-effects-parser 5.2.0 → 5.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/tx-meta-effects-parser",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Low-level effects parser for Stellar transaction results and meta XDR",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -115,7 +115,7 @@ class EventsAnalyzer {
115
115
  }
116
116
  break
117
117
  //handle standard token contract events
118
- //see https://github.com/stellar/rs-soroban-sdk/blob/71170fba76e1aa4d50224316f1157f0fb10e6d79/soroban-sdk/src/token.rs
118
+ //see https://github.com/stellar/rs-soroban-sdk/blob/main/soroban-sdk/src/token.rs
119
119
  case 'transfer': {
120
120
  if (!matchEventTopicsShape(topics, ['address', 'address', 'str?']))
121
121
  return
@@ -212,6 +212,19 @@ class EventsAnalyzer {
212
212
  }
213
213
  }
214
214
  break
215
+ case 'set_admin': {
216
+ if (!matchEventTopicsShape(topics, ['address', 'str?']))
217
+ return //throw new Error('Non-standard event')
218
+ const currentAdmin = xdrParseScVal(topics[1])
219
+ const newAdmin = processEventBodyValue(body.data())
220
+ if (!this.matchInvocationEffect(e => e.function === 'set_admin' && matchArrays([currentAdmin, newAdmin], [this.effectsAnalyzer.source, e.args])))
221
+ return
222
+ this.effectsAnalyzer.setAdmin(contractId, newAdmin)
223
+ if (topics.length > 2) {
224
+ mapSacContract(this.effectsAnalyzer, contractId, xdrParseAsset(xdrParseScVal(topics[2])))
225
+ }
226
+ }
227
+ break
215
228
  /*case 'approve': { //TODO: think about processing this effect
216
229
  if (!matchEventTopicsShape(topics, ['address', 'address', 'str?']))
217
230
  throw new Error('Non-standard event')
@@ -375,6 +375,15 @@ class EffectsAnalyzer {
375
375
  restoreFootprint() {
376
376
  }
377
377
 
378
+ setAdmin(contractId, newAdmin) {
379
+ const effect = {
380
+ type: effectTypes.contractUpdated,
381
+ contract: contractId,
382
+ admin: newAdmin
383
+ }
384
+ this.addEffect(effect)
385
+ }
386
+
378
387
  processDexOperationEffects() {
379
388
  //process trades first
380
389
  for (const claimedOffer of this.result.claimedOffers) {