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

make ParentchainApi generic to support Asset Hub #1650

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brenzi
Copy link
Collaborator

@brenzi brenzi commented Nov 14, 2024

This is WIP. just wanted to know how far away we are. And we're not exactly near. reachable, but with effort

challenges:

  • supertrait must use extrinsic type (and block type) which introduces yet another type argument and may prevent some super-generic treatment

@brenzi brenzi changed the title trying to use a supertrait to make ParentchainApi generic make ParentchainApi generic to support Asset Hub Nov 14, 2024
Comment on lines +70 to +82
pub trait ParentchainApiTrait:
AccountApi<AccountId = AccountId, Balance = Balance, Index = Index>
+ GetBalance<Balance = Balance>
+ GetStorage
+ SystemApi<Properties = Properties>
+ BalancesExtrinsics<Address = MultiAddress<AccountId, Index>, Balance = Balance>
+ ChainApi
+ GetAccountInformation<Index = Index>
+ SubscribeEvents
+ GetTransactionPayment<Balance = Balance>
+ SubmitAndWatch<Hash = Hash> //+ GetRuntimeVersionAt<Block<Header, UncheckedExtrinsic<A>>>
{
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this supertrait shall simplify using generic NodeApis, defined per Parentchain in app-libs

Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit unsure about this trait. Even if we have it, I would only make it a trait bound in as few places as possible, as 99% of the times we only need part of it.


pub type IntegriteeApi = Api<IntegriteeRuntimeConfig, TungsteniteRpcClient>;

impl ParentchainApiTrait for IntegriteeApi {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Super traits are usually generically implemented for T satisfying all the constraints, i.e.,

impl<T> ParentchainApiTrait for T 
where T: ....
{}

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.

2 participants