Skip to content

Add --binary flag for info command#1311

Merged
ascjones merged 65 commits intomasterfrom
ln-info-prinstine-code
Sep 4, 2023
Merged

Add --binary flag for info command#1311
ascjones merged 65 commits intomasterfrom
ln-info-prinstine-code

Conversation

@smiasojed
Copy link
Copy Markdown
Contributor

@smiasojed smiasojed commented Sep 4, 2023

Closes #800

The combination --binary and --output-json returns JSON:

{ 
  "wasm": "0x..."
}

I assumed that binary flag is a behaviour switch, and output-json just formatter.
The another option is to combine wasm hex code with the rest of info command default content:

{
  "trie_id": "f8ac805216a9318ab898d0777e24ac52583ca690a218556cfeb6b05744d191cf",
  "code_hash": "0x1a56980585ad4097aaea9daf1bee2332e2a9cf579d0c1a3b91a81900cb399a53",
  "storage_items": 1,
  "storage_item_deposit": 100000000000
  "wasm": "0x..."
}

I think that cleaner approach is the first one, where --binary is treated as behaviour switch

Copy link
Copy Markdown
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

Looks good, just the small nitpick about the return type and a question.

Also please update the description with "Closes #800", so we know which issue is being dealt with and it closes automatically when this is merged.

pub async fn fetch_wasm_code(
hash: CodeHash,
client: &Client,
) -> Result<Option<BoundedVec<u8>>> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should convert the BoundedVec to a Vec for the return type: better not to expose types generated by subxt in the public api of this crate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM!

@ascjones ascjones merged commit 497cb88 into master Sep 4, 2023
@ascjones ascjones deleted the ln-info-prinstine-code branch September 4, 2023 19:34
@smiasojed smiasojed mentioned this pull request Nov 30, 2023
@smiasojed smiasojed mentioned this pull request Mar 4, 2024
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.

Output pristine Wasm code for cargo contract info

3 participants