Skip to content

Avoid requiring unnecessary hex-encoding and using decodeHex #18

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Sep 13, 2023

Closes #17

⚠️ NOTE: This is a breaking change, users of this repo will need to remove hex-encoding of the code and instead pass the code as-is.

@turbolent turbolent added the enhancement New feature or request label Sep 13, 2023
@turbolent turbolent requested a review from a team September 13, 2023 17:27
@bluesign
Copy link

bluesign commented Sep 26, 2023

maybe we can make this non-breaking by checking:
something like:

prepare(signer: AuthAccount) {
    signer.contracts.add(name: name, code: code.utf8.contains(32) ? code.utf8 : code.decodeHex())
}

@nozim
Copy link

nozim commented Sep 26, 2023

probably some alternative method that uses utf8 string instead of hex could help avoid breaking changes?

@nozim
Copy link

nozim commented Sep 26, 2023

maybe we can make this non-breaking by checking: something like:

prepare(signer: AuthAccount) {
    signer.contracts.add(name: name, code: code.utf8.contains(32) ? code.utf8 : code.decodeHex())
}

this seems a bit confusing to me but would be happy to see other inputs :)

@bluesign
Copy link

bluesign commented Sep 26, 2023

Basically it is checking if there is space character in code, if there is space, it means we sent a String without hex encoding (so we use .utf8 ), if there is no space, we sent hex encoded (so we use decodeHex). ( as we cannot create a contract code without spaces )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Use .utf8 instead of hex-encoding/decoding
3 participants