This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Allow using any polkadot client instead of enum Client #1575
Merged
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ac4e6c4
WIP
cecton 5527eaa
WIP
cecton 47f184e
WIP
cecton f60375c
WIP
cecton 99bbf74
WIP
cecton 43512e8
WIP
cecton ae7082c
WIP
cecton fb78f0b
WIP
cecton 846e23f
Apply suggestions from code review
cecton 5caaaeb
WIP
cecton 0070028
WIP
cecton b66861c
WIP
cecton 96cdf51
CLEANUP
cecton 5c4f5ca
link in doc
cecton 12cbf02
doc
cecton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,12 @@ pub trait ExecuteWithClient { | |
Client: AbstractClient<Block, Backend, Api = Api> + 'static; | ||
} | ||
|
||
/// Yet Another ExecuteWithClient | ||
pub trait YaExecuteWithClient { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe With a much better documentation on what it does and why we need it? Something like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. omg I was not expecting that much 😆 🙏 |
||
/// Execute the given something with the client. | ||
fn execute_with<T: ExecuteWithClient>(&self, t: T) -> T::Output; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how to call it... ClientExecutor? ClientExecutionContext? @bkchr |
||
|
||
/// A client instance of Polkadot. | ||
/// | ||
/// See [`ExecuteWithClient`] for more information. | ||
|
@@ -129,9 +135,8 @@ pub enum Client { | |
Rococo(Arc<crate::FullClient<rococo_runtime::RuntimeApi, crate::RococoExecutor>>), | ||
} | ||
|
||
impl Client { | ||
/// Execute the given something with the client. | ||
pub fn execute_with<T: ExecuteWithClient>(&self, t: T) -> T::Output { | ||
impl YaExecuteWithClient for Client { | ||
fn execute_with<T: ExecuteWithClient>(&self, t: T) -> T::Output { | ||
match self { | ||
Self::Polkadot(client) => { | ||
T::execute_with_client::<_, _, crate::FullBackend>(t, client.clone()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was sooo happy that we got rid off it :P But yeah, this will also make some code easier in Cumulus 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I AM SO SORRY