Proposal: Generic subscription options while adding contract listener#1396
Conversation
- Options can be used to pass options for automatically created subscription Signed-off-by: Niklas Emmelius <niklas.emmelius@mittelstand.ai>
Signed-off-by: Niklas Emmelius <niklas.emmelius@mittelstand.ai>
|
Thanks for opening this! This seems like an interesting idea and I or one of other maintainers will review this and provide some feedback as soon as we can, though most of them are a bit busier than usual at the moment. |
|
Ah, it looks like the linter is complaining because a file was updated by the copyright year in the header wasn't also updated. Sorry, it's a silly linter rule. |
| type ContractListenerOptions struct { | ||
| FirstEvent string `ffstruct:"ContractListenerOptions" json:"firstEvent,omitempty"` | ||
| FirstEvent string `ffstruct:"ContractListenerOptions" json:"firstEvent,omitempty"` | ||
| SubscriptionOptions *fftypes.JSONAny `ffstruct:"ContractListenerOptions" json:"subscriptionOptions,omitempty"` |
There was a problem hiding this comment.
I'm struggling with what this field should be named. For context, in the older ETHConnect codebase we used to call these "subscriptions". In the newer FFTM API (which EVMConnect is based on), we now refer to these as "listeners" to help distinguish them from FireFly Subscriptions (which are a higher level object). So this field actually ends up maping to Listener.Options
https://github.com/hyperledger/firefly-transaction-manager/blob/fe5ace887c9f541c3053fd31d937d46ce6adc3c9/pkg/apitypes/api_types.go#L212
But calling this field ContractListenerOptions.ListenerOptions seems a bit redundant 🤔
@awrichar or @peterbroadhurst Do you have any suggestions here?
There was a problem hiding this comment.
@nguyer - sorry I missed this before.
I think the consistent pattern here with other things, would be that the options are passed through to EVMConnect. If you look at invoke APIs, or the tokens - that's what we do I believe.
|
Closing and re-opening to get the build to run again |
|
@niklas-emmelius-mittelstand-ai Sorry it took so long to get feedback on this one. If you want to rename |
nguyer
left a comment
There was a problem hiding this comment.
You'll also want to run make locally to make sure the build is passing. Thanks!
Generic subscription options while adding contract listener
Generic options for the automatically generated subscription can be passed in listener options
{ "name": "PayPerUseListener", "options": { "firstEvent": "newest", "subscriptionOptions": { "additionalOption1": "option1", "additionalOption2": "option 2" } }, "topic": "default1" }Intention
A privacyGroupId could be passed to Ethconnect and calls to priv_getLogs etc. would be possible.
Every plugin would be able to listen for the subscriptionOptions necessary for its subscription configuration.
The introduced changes do not break existing functionality.