@stellar-expert/tx-meta-effects-parser 9.3.0 → 9.3.1
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 +1 -1
- package/src/effects-analyzer.js +35 -1
package/package.json
CHANGED
package/src/effects-analyzer.js
CHANGED
|
@@ -414,6 +414,30 @@ class EffectsAnalyzer {
|
|
|
414
414
|
}
|
|
415
415
|
case 'createContract':
|
|
416
416
|
case 'createContractV2': //handled in entry changes
|
|
417
|
+
const executable = value.executable()
|
|
418
|
+
const executableType = executable.switch().name
|
|
419
|
+
if (executableType !== 'contractExecutableWasm') {
|
|
420
|
+
const preimage = value.contractIdPreimage()
|
|
421
|
+
const preimageParams = preimage.value()
|
|
422
|
+
const effect = {
|
|
423
|
+
type: effectTypes.contractCreated,
|
|
424
|
+
contract: contractIdFromPreimage(preimage, this.network)
|
|
425
|
+
}
|
|
426
|
+
switch (preimage.switch().name) {
|
|
427
|
+
case 'contractIdPreimageFromAddress':
|
|
428
|
+
effect.kind = 'fromAddress'
|
|
429
|
+
effect.issuer = xdrParseAccountAddress(preimageParams.address().value())
|
|
430
|
+
effect.salt = preimageParams.salt().toString('base64')
|
|
431
|
+
break
|
|
432
|
+
case 'contractIdPreimageFromAsset':
|
|
433
|
+
effect.kind = 'fromAsset'
|
|
434
|
+
effect.asset = xdrParseAsset(preimageParams)
|
|
435
|
+
break
|
|
436
|
+
default:
|
|
437
|
+
throw new TxMetaEffectParserError('Unknown preimage type: ' + preimage.switch().name)
|
|
438
|
+
}
|
|
439
|
+
this.addEffect(effect)
|
|
440
|
+
}
|
|
417
441
|
break
|
|
418
442
|
default:
|
|
419
443
|
throw new TxMetaEffectParserError('Unknown host function call type: ' + func.arm())
|
|
@@ -810,7 +834,17 @@ class EffectsAnalyzer {
|
|
|
810
834
|
throw new UnexpectedTxMetaChangeError({type: 'contract', action})
|
|
811
835
|
}
|
|
812
836
|
if (effect) {
|
|
813
|
-
|
|
837
|
+
if (effect.type === effectTypes.contractCreated) {
|
|
838
|
+
const existing = this.effects.find(e => e.type === effectTypes.contractCreated && e.contract === effect.contract)
|
|
839
|
+
if (!existing) { //the effect might be already emitted from the op call
|
|
840
|
+
this.addEffect(effect, this.effects.findIndex(e => e.contract === effect.contract || e.owner === effect.contract))
|
|
841
|
+
} else {
|
|
842
|
+
existing.keyHash = effect.keyHash //assign keyHash, can't be calculated directly
|
|
843
|
+
}
|
|
844
|
+
} else {
|
|
845
|
+
|
|
846
|
+
this.addEffect(effect)
|
|
847
|
+
}
|
|
814
848
|
}
|
|
815
849
|
if (before?.storage?.length || after?.storage?.length) {
|
|
816
850
|
this.processInstanceDataChanges(before, after, action === 'restored')
|