Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts: add commitment param to Program.addEventListener #3051

Closed
livthomas opened this issue Jun 26, 2024 · 5 comments
Closed

ts: add commitment param to Program.addEventListener #3051

livthomas opened this issue Jun 26, 2024 · 5 comments
Labels
enhancement New feature or request ts

Comments

@livthomas
Copy link
Contributor

Right now, if you call Program.addEventListener, you only get subscribed to Anchor events at the default commitment level set in the Connection instance. And if you want to receive events at multiple commitment levels, you need to create a separate connection for each.

It looks like Connection.onLogs method provides a third optional commitment parameter so it is actually possible to subscribe to the same event at multiple commitment levels using a single connection.

It would be nice if Program.addEventListener method also took an optional commitment parameter so we could use a single Solana connection across the whole app. Right now, we are basically forced to create multiple connection instances just because Anchor doesn't support this.

@acheroncrypto acheroncrypto added enhancement New feature or request ts labels Jun 26, 2024
@acheroncrypto
Copy link
Collaborator

It would be nice if Program.addEventListener method also took an optional commitment parameter so we could use a single Solana connection across the whole app.

Sounds great! Feel free to create a PR for this, or let me know if you'd like me to add it.

@livthomas
Copy link
Contributor Author

I have implemented it in #3052

@acheroncrypto
Copy link
Collaborator

Added in #3052

@livthomas
Copy link
Contributor Author

@acheroncrypto Is there any chance a new version with this fix could get released anytime soon?

@acheroncrypto
Copy link
Collaborator

We have some breaking changes, so this will be included in v0.31 which is likely going to get released next month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ts
Projects
None yet
Development

No branches or pull requests

2 participants