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

feat(publisher): Add an example of streaming contract events. DS-64 #224

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lostman
Copy link
Contributor

@lostman lostman commented Sep 26, 2024

No description provided.

@lostman lostman changed the base branch from main to feat/eugene/sdk-examples September 26, 2024 10:04
@lostman lostman force-pushed the mw/ds-64/contract-events-example branch from ad7ef56 to 7fab01c Compare September 26, 2024 10:24
Base automatically changed from feat/eugene/sdk-examples to main September 26, 2024 17:24
@lostman lostman force-pushed the mw/ds-64/contract-events-example branch from 7fab01c to 0948910 Compare September 27, 2024 10:50
@lostman lostman changed the title feat(publisher): Add an example of streaming contract events. feat(publisher): Add an example of streaming contract events. DS-64 Sep 27, 2024
@lostman lostman marked this pull request as ready for review September 27, 2024 13:55
Copy link
Contributor

@0xterminator 0xterminator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

Comment on lines +177 to +184
let mut receipt_stream = fuel_streams::Stream::<Receipt>::new(client).await;

receipt_stream.with_filter(
ReceiptsBurnSubject::new().with_contract_id(Some(contract_id.into())),
);
receipt_stream.with_filter(
ReceiptsCallSubject::new().with_from(Some(contract_id.into())),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better from a readability standpoint:

Suggested change
let mut receipt_stream = fuel_streams::Stream::<Receipt>::new(client).await;
receipt_stream.with_filter(
ReceiptsBurnSubject::new().with_contract_id(Some(contract_id.into())),
);
receipt_stream.with_filter(
ReceiptsCallSubject::new().with_from(Some(contract_id.into())),
);
let mut receipt_stream = fuel_streams::Stream::<Receipt>::new(client).await;
let receipt_stream = receipt_stream.with_filter(
ReceiptsBurnSubject::new().with_contract_id(Some(contract_id.into())),
).with_filter(
ReceiptsCallSubject::new().with_from(Some(contract_id.into())),
).
// other with_filters come here

Copy link
Collaborator

@pedronauck pedronauck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about transactions and other resources from a specific contract id? You can use the by_id subject to add examples too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants