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

Expose the SCALE encoded call data of an extrinsic #573

Merged
merged 2 commits into from Jun 22, 2022

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented Jun 20, 2022

Closes #571

subxt/src/client.rs Outdated Show resolved Hide resolved
Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
@jsdw jsdw requested review from ascjones June 22, 2022 09:43
pub fn call_data(&self) -> Result<Vec<u8>, BasicError> {
let mut bytes = Vec::new();
let locked_metadata = self.client.metadata();
let metadata = locked_metadata.read();
Copy link
Member

Choose a reason for hiding this comment

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

This pattern is very common to use the read only locked metadata, I wonder whether it is worth adding a method for that.

Copy link
Collaborator Author

@jsdw jsdw Jun 22, 2022

Choose a reason for hiding this comment

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

Mmm yeah, quite possibly; it might also be worth just cloning it out of the lock immediately too since it's behind an Arc iirc; no need to actually hold the lock for any appreciable amount of time either I think!

Copy link
Member

@ascjones ascjones Jun 22, 2022

Choose a reason for hiding this comment

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

Cloning the metadata seems a bit wasteful in most cases since as you say it is usually short lived

Sorry I misunderstood what you meant

@jsdw jsdw merged commit 6d7a6c9 into master Jun 22, 2022
@jsdw jsdw deleted the jsdw-expose-call-data branch June 22, 2022 10:30
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.

how can I get encoded but not signed call?
3 participants