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

Neo Shell extension model #4

Merged
merged 18 commits into from
May 2, 2023
Merged

Neo Shell extension model #4

merged 18 commits into from
May 2, 2023

Conversation

ngdentdev
Copy link
Collaborator

The first version of the neoshell extension mode.

{
public bool TryFindCommand(string[] args, out ShellExtension? command)
{
foreach (string arg in args)
Copy link
Contributor

Choose a reason for hiding this comment

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

seems odd that we are searching all the args instead of just the first one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking potential non-positional parameters is it possible that we have "neosh --json worknet ..." ?

Copy link
Contributor

@devhawk devhawk Apr 29, 2023

Choose a reason for hiding this comment

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

it feels like that might lead to argument collision. For example, If I created a "transfer" extension, how would shell differentiate between that extension and the NEP11 extension transfer command? (assuming both installed).

Requiring a unique initial position argument that identifies the extensions seems like a reasonable constraint.

return process;
}

private (string, int) ExtractCommandFromArguments(string[] args, string command)
Copy link
Contributor

Choose a reason for hiding this comment

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

make static

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nit pick, but did you do this?

src/shell/neoshell.csproj Outdated Show resolved Hide resolved
src/nft/neonft.csproj Outdated Show resolved Hide resolved
public override Version? Version => null;

public DevWallet(ProtocolSettings settings, string name, IEnumerable<DevWalletAccount>? accounts = null) : base(string.Empty, settings)
class DevWallet : Wallet
Copy link
Contributor

Choose a reason for hiding this comment

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

BCTK Lib has a ToolkitWallet class you could use instead of DevWallet. I plan to move express over to ToolkitWallet at some point in the future

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok. This probably needs to be part of another refactoring/cleanup for the shell. The model was copied from express along with other stuff like DevWalletAccount.cs etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm OK with doing this as part of a general cleanup pass. Please open an issue to track and include any other areas of the code you think need to be addressed. I have thoughts as well, but I would like to hear your thoughts on eliminating technical debt here.

src/shell/Program.cs Outdated Show resolved Hide resolved
src/shell/Program.cs Outdated Show resolved Hide resolved
src/shell/Program.cs Outdated Show resolved Hide resolved
src/shell/Program.cs Outdated Show resolved Hide resolved
src/shell/Program.cs Outdated Show resolved Hide resolved
src/nft/neonft.csproj Outdated Show resolved Hide resolved
@ngdentdev ngdentdev marked this pull request as ready for review April 24, 2023 16:58
@devhawk
Copy link
Contributor

devhawk commented Apr 29, 2023

Note, PR is failing to pack. The path to the package logo is specified in src\Directory.Build.props, but because I asked to move the NEP11 extension down a level in the folder hierarchy, that project can't locate the logo.

@devhawk
Copy link
Contributor

devhawk commented Apr 29, 2023

Great work on the code review feedback. Once you get the build fixed and the refactor/cleanup issue filed, I think we're ready to merge

@ngdentdev
Copy link
Collaborator Author

Note, PR is failing to pack. The path to the package logo is specified in src\Directory.Build.props, but because I asked to move the NEP11 extension down a level in the folder hierarchy, that project can't locate the logo.

Hmm, do we have to refer to the logo conditionally? It's


Does it mean for shell-ext/nft we will have to go two levels up?

@devhawk devhawk merged commit 92fed18 into main May 2, 2023
@devhawk devhawk deleted the extensions branch May 2, 2023 00:33
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