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: add subscribe_all_blocks and rename subscribe_blocks to subscribe_new_blocks #642

Closed
wants to merge 3 commits into from

Conversation

yjhmelody
Copy link
Contributor

No description provided.

@jsdw
Copy link
Collaborator

jsdw commented Aug 30, 2022

I need to look up what the difference is between chain_subscribeNewHeads vs chain_subscribeAllHeads is?

Looks ok otherwise (though I may cause a merge conflict with an Rpc PR I'll be merging shortly!)

I would note though that the RPC interface will eventually be reworked in Substrate, and so I'm growing hesitant to keep adding RPC methods to this underlying Rpc interface that Subxt doesn't actually use itself. Thus, a better approach I reckon would be that you use the underlying Rpc client yourself to make whatever underlying calls you want.

Future versions of Subxt will expose an interfacte to the Runtime APIs directly and automatically, and have a much smaller and more static set of RPC calls to expose, which will be a bunch nicer I reckon :)

@lexnv
Copy link
Collaborator

lexnv commented Oct 4, 2022

The substrate's chain_subscribeNewHeads returns the header of the block if the block is considered the new best block. While the chain_subscribeAllHeads returns the header of new blocks, regardless if they are the best blocks or not.

We are working towards having a new unified RPC API for the substrate's node, that will simplify all the subxt/src/rpc methods 😄 While this PR looks solid, I would postpone it for a bit until we have the new API landing in substrate.

@jsdw
Copy link
Collaborator

jsdw commented Oct 4, 2022

Perhaps your BlocksClient PR can address this stuff in part anyway.

But @yjhmelody I'd like to know what you need this for?

But yeah; in general I'd rather not add RPC methods at the moment if Subxt doesn't need them because eventually we'll move over to a new RPC interface anyway and then all of these methods are liable to changing.

@jsdw
Copy link
Collaborator

jsdw commented Oct 21, 2022

This will be addressed in #691 so I'll close this now; the result will be that a new blocks API will support subscribing to finalized, all or best block (headers), from which yo ucan then get events/extrinsics etc. The udnerlying RPc method to support this was also added and names tidied.

@jsdw jsdw closed this Oct 21, 2022
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.

3 participants