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

Refactor out transcode as a separate library #597

Merged
merged 12 commits into from
Jun 8, 2022

Conversation

fbielejec
Copy link
Contributor

This PR refactors the bits responsible for encoding contract creator and message calls into a separate library.

It's intention is to facilitate building various tools for interacting with contracts.
One possible use case is creating automated end-to-end tests written in Rust, declarative DSL based tools for describing pipelines for deploying / updating non-trivial smart contract suites (think Truffle / Hardhat) etc.

For that reason the Licence is Apache (although I have cargo-culted the contract-metadata library in that respect, GPL with ClasspathException would likely also be permissive enough - Although I'm Not A Lawyer).

@cla-bot-2021
Copy link

cla-bot-2021 bot commented Jun 3, 2022

User @fbielejec, please sign the CLA here.

@fbielejec fbielejec marked this pull request as draft June 3, 2022 16:19
@fbielejec fbielejec marked this pull request as ready for review June 6, 2022 12:47
@fbielejec
Copy link
Contributor Author

test-registry-publish-install check is failing but I do not have access to your cargo registry to fix that, so will need some help 👐

Copy link
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!

transcode/Cargo.toml Outdated Show resolved Hide resolved
transcode/Cargo.toml Outdated Show resolved Hide resolved
@ascjones
Copy link
Collaborator

ascjones commented Jun 8, 2022

@ascjones ascjones merged commit a565f58 into use-ink:master Jun 8, 2022
/// Decode hex string with or without 0x prefix
pub fn decode_hex(input: &str) -> Result<Vec<u8>, hex::FromHexError> {
if input.starts_with("0x") {
hex::decode(input.trim_start_matches("0x"))
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need the if here. You can call this function regardless of if the string is prefixed with an 0x or not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Happy to approve a small PR which refactors this

@ascjones ascjones mentioned this pull request Aug 15, 2022
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.

3 participants