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

New commands layout #75

Merged
merged 29 commits into from
Sep 30, 2022
Merged

New commands layout #75

merged 29 commits into from
Sep 30, 2022

Conversation

volovyks
Copy link
Contributor

@volovyks volovyks commented Nov 2, 2021

@volovyks volovyks self-assigned this Nov 2, 2021
@volovyks volovyks linked an issue Nov 2, 2021 that may be closed by this pull request
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
@volovyks volovyks marked this pull request as ready for review November 5, 2021 15:02
@volovyks volovyks changed the title New commands layout. Up for discussion. New commands layout Nov 5, 2021
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_GUIDE_DRAFT.en.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Outdated Show resolved Hide resolved
docs/NEW_NEAR_CLI_INTERFACE.md Show resolved Hide resolved
volovyks and others added 2 commits May 16, 2022 16:04
Co-authored-by: Benjamin Kurrek <57506486+BenKurrek@users.noreply.github.com>
@frol
Copy link
Collaborator

frol commented May 16, 2022

I believe I have addressed all the comments except the configuration (I feel it is not a blocker at the moment)

```
contract
- call-function
- as-read-only <account-id> <function-name> <function-args> network <"mainnet"|"testnet"|...> <now|at-timestamp|at-block-height|at-block-hash>

Choose a reason for hiding this comment

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

Why not just view? Even knowing that as-read-only means view I found it confusing and is less intuitive since we use view everywhere else.

near-cli contract call-function as-read-only ...

Is also a bit long. I know you're love for being explicit, but having some aliases here would be nice.

near contract view

As a short cut would be very handy.

Choose a reason for hiding this comment

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

To me just saying view might lead some people to think that they're viewing the contract code rather than it being viewing the result of a read-only function.

Choose a reason for hiding this comment

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

If you execute a view call and try to invoke a host function like creating a transaction, you will get an error that says it was banned in a view call. So my point is that we use view in our documentation and baked into the runtime, so using it, especially in this context helps people to learn it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@willemneal If you finish up the whole command, you will see that it does not make any sense to save a few characters:

near-cli contract view zavodil.poolv1.near get_owner_id '{}' network mainnet now
near-cli contract call-function as-read-only zavodil.poolv1.near get_owner_id '{}' network mainnet now

I don't expect anyone to type it out manually as we have interactive mode that guides users through it, and prints out the final command if you want to re-use it later.

contract view makes sense only to victims of near-cli-js naming. Anyone else will be confused and guess that this command will show you the contract, not calling a function. Yet, the good part of this new approach is that you will be able to implement your own extension and call it as near-cli view ... just fine, if you feel you want to have a shortcut.

@frol
Copy link
Collaborator

frol commented May 17, 2022

@volovyk-s @BenKurrek @khorolets @miraclx @willemneal I feel this version is good to go and we can merge it now, and iterate on "login" commands, configs, and other nits in separate PRs. Any objections?

@frol frol marked this pull request as ready for review May 17, 2022 17:44
@willemneal
Copy link

My only nit left and it's fine if everyone else thinks otherwise, but view is used throughout the ecosystem so not including it will confuse people. So I propose the following change.

near-cli contract call-function as-read-only --> near-cli contract call-function as-view

I'll go ahead and approve, but just wanted to give one more argument for not removing view.

@BenKurrek
Copy link

My only nit left and it's fine if everyone else thinks otherwise, but view is used throughout the ecosystem so not including it will confuse people. So I propose the following change.

near-cli contract call-function as-read-only --> near-cli contract call-function as-view

I'll go ahead and approve, but just wanted to give one more argument for not removing view.

I'm fine with this as well - I don't have a strong opinion as to which I prefer. I'm fine with both.

@frol
Copy link
Collaborator

frol commented May 18, 2022

So far I feel ok with going contract <contract-account-id> call-function as-view, but I want to take a bit of a time and also wait for the feedback from other folks.

I forgot to add commands for offline transaction construction options (in order to construct a transaction you need to specify recent block hash and access key nonce), so I will finish that up before merging this PR.

- transaction signature options here (see below)
- print-to-terminal network <"mainnet"|"testnet"|...>
- transaction signature options here (see below)
- use-manually-provided-seed-phrase "twelve words goes here" network <"mainnet"|"testnet"|...>

Choose a reason for hiding this comment

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

This is an issue I filled with near-cli. It's bad security practice to use a seed phrase as a CLI arg. So perhaps this should be interactive like a password.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is both interactive and non-interactive, and again, I don’t expect users to type the command out manually most of the time, so the parameters are there only for reproducibility and integration within scripts, which I don’t see a reason to limit to use params

@frol
Copy link
Collaborator

frol commented Jul 12, 2022

FYI, This new design is already mostly implemented in a separate repo: https://github.com/FroVolod/near-cli-rs-instance/tree/without-generics

@frol
Copy link
Collaborator

frol commented Sep 30, 2022

Just an update: #115 implements all the base CLI commands layout

@frol
Copy link
Collaborator

frol commented Sep 30, 2022

@volovyks @ChaoticTempest Thanks for all your valuable input along the way!

Check out the 0.2.0-pre.1 release!

@frol frol merged commit 30a2236 into master Sep 30, 2022
@frol frol deleted the new-guide branch September 30, 2022 15:55
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.

Create resource-first CLI design
8 participants