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

how can I get encoded but not signed call? #571

Closed
dzmitry-lahoda opened this issue Jun 18, 2022 · 2 comments · Fixed by #573
Closed

how can I get encoded but not signed call? #571

dzmitry-lahoda opened this issue Jun 18, 2022 · 2 comments · Fixed by #573

Comments

@dzmitry-lahoda
Copy link

I want to send XCM with Transact. For that I need scale encoded call like that:

// 2. SCALE encode call data to bytes (pallet u8, call u8, call params).
        let call_data = {
            let mut bytes = Vec::new();
            let pallet = self.client.metadata().pallet(C::PALLET)?;
            bytes.push(pallet.index());
            bytes.push(pallet.call_index::<C>()?);
            self.call.encode_to(&mut bytes);
            Encoded(bytes)
        };

But there is no API to get it, nor call and client are public to allow to write my own trait

@dzmitry-lahoda
Copy link
Author

this for specific call

		let mut bytes = Vec::new();
		let pallet = relay.client.metadata().pallet(HrmpAcceptOpenChannel::PALLET).unwrap();
		bytes.push(pallet.index());
		bytes.push(pallet.call_index::<HrmpAcceptOpenChannel>().unwrap());
		let call = HrmpAcceptOpenChannel { sender : primitives::Id(command.para_id)};
		call.encode_to(&mut bytes);

so it could be useful part of API for XCM (may be for other dispatchable usage as in Democracy)

@niklasad1
Copy link
Member

right, should be easy to expose encode on the struct SubmittableExtrinsic

to enable that

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 a pull request may close this issue.

3 participants