-
Notifications
You must be signed in to change notification settings - Fork 226
Conversion utility methods for Neo-cli #535
Conversation
What do you think about |
I prefer to add these functions to GUI. |
@meevee98 @shargon @erikzhang I've already made a simple tool to support most of conversion method. https://github.com/neo-ngd/Neo3-Tool. If you'd like, could adjust and merge it into your code. |
I agree that it's better than having a different command for each conversion. I will modify the code in this way.
Nice. If I may, I will include the other conversions to this implementation.
I think that these commands are also useful in neo-cli. |
9ebb2d8
to
f89859b
Compare
I would love to have this commands on Neo-Cli, thank you Meevee |
8481324
to
4a596bf
Compare
I've updated this pull request with @shargon's suggestion of It's a unique command now that accepts any value and returns the possible conversions |
neo-cli/CLI/MainService.cs
Outdated
var parseFunctions = new Dictionary<string, Func<string, string>>() | ||
{ | ||
{ "Address to BigEnd ScriptHash", AddressToBigEndScripthash }, | ||
{ "Address to LittleEnd ScriptHash", AddressToLittleEndScripthash }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have only one, the official one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed to convert only to big end script hash because that's the script hash that is shown with transactions and blocks.
What do you think? Is it okay or should I change it to little end?
neo-cli/CLI/MainService.cs
Outdated
/// <summary> | ||
/// Converts an Base64 hex string to big integer value | ||
/// </summary> | ||
/// <param name="bytearray"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to use single line summary when it's not a multiline comment, but it's something personal.
Tested. Do we still need to support converting a little end script hash to address? |
It's no problem for me @shargon |
118091e
to
6d5fe19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the file it's better to be more generic like .Tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job, this will be useful in some cases.
It is good to have these utility methods on neo-cli as well.
Perhaps @shargon last comment shall be applied.
@meevee98 I am not sure if it's my computer, but it spend a lot of time in something trivial, could you check it? |
@shargon I agree with the empty strings, but I think that the conversions to a string with non-ascii characters should be kept. For example, this hex string is converted to a string with many non-ascii characters
|
Ok :) |
I think that 0.2 seconds in your computer it's a lot of time.... we need to find the issue |
@shargon I was able to reduce the time to 0.1 seconds by removing the exception throwing in the conversion methods and replacing them with return null. |
@meevee98 It's out of date, could you update it to the latest? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is good to have these features.
On NeoCompiler many people replies to us that they use the website to use such features online.
Conversion utility methods for Neo-cli (neo-project#535)
It's an update from #455.
This pull request has only the conversion utility methods because I'm still unable to connect to Neo 3 testnet to test some of
show
methods.parse <value>