Open coinsandsteeldev opened 6 years ago
I'm constrained by this issue a lot. And i think this is huge problem right now.
@ZimM-LostPolygon will take a look at this, should have a new release this week
It seems like we can emit anything we want in Go contract. And i think we need better approach to TransformChainEvent, i would make it injection, with some standard one by default. Right now if i want to have pure protobuf events i need to open source code of SDK and change it. So i would propose this simple change which will make life easier for future generations :)
@coinsandsteeldev Not exactly sure I understand the issue. The first argument of ctx.Emit()
or ctx.EmitTopics()
goes into JsonRpcEvent.Data
. And sure, you can put pretty much anything there. But you say that it replaces the complete RawChainEventArgs.Data
?..
@ZimM-LostPolygon No it doesn't. It fails to parse JsonRpcEvent at all.
Of course if you follow JsonRpcEvent layout it will be ok, but i don't think it is a way to go. It is fixed easily, and it is done in my own version of your SDK.
Yep, I can confirm there is an issue. Meanwhile, you probably should subclass Contract
and override TransformChainEvent
.
This is Contract.cs method which is used to pre-process event before emitting it to listeners.
When i emit event in Go either using
ctx.Emit()
orctx.EmitTopics()
i have same result:jsonRpcEventString
has serialized json from Emit for instanceWill result as
{"Test": "test", "Test2": 1488}
. So the next line fails to deserializeJsonRpcEvent jsonRpcEvent = JsonConvert.DeserializeObject<JsonRpcEvent>(jsonRpcEventString);
Resulting in converting null to byte[]
I wonder whether it is problem of Loom Node emitting event in the wrong format or something else.