near / near-cli

General purpose command line tools for interacting with NEAR Protocol
https://docs.near.org
MIT License
193 stars 91 forks source link

add --Tgas flag #1017

Closed flmel closed 1 month ago

flmel commented 2 years ago

Is your feature request related to a problem? Please describe.

Calls from the cli sometimes can require more gas, some xcc calls can even exceed the max amount 300Tgas, every time someone wants to attach gas/Tgas they have to either remember how many zeros to add or go to nomicon check the Tgas and then copy paste or count and type...

Describe the solution you'd like

I think adding --Tgas flag would help the issue at hand

Describe alternatives you've considered

another solution might be either the cli or the rpc to state what the max amount of possible gas is in the error returned by not attaching any/not enough

Additional context

Since we already have --deposit and --depositYocto (we also have --amount but not --amountYocto) i think having --gas and --Tgas makes sense

mfornet commented 2 years ago

An alternative would be to allow suffixes to these values. For example:

We can ignore capitalization, and white spaces, trim "gas" from the end, and check remaining value is one of "t", "tera" for TeraGas, or empty for gas unit. Floating point numbers could be allowed if Tera gas is specified.

flmel commented 2 years ago

That's a good point @mfornet however this will be deviating from the --deposit --depositYocto which is essentially min max units of Near so that's why i was thinking the proposed --gas --Tgas makes sense

mfornet commented 2 years ago

fair enough. Tbh I think that --deposit and --depositYocto could be consolidated in a single argument using a similar approach. i.e parsing the suffix.

flmel commented 2 years ago

I can agree with this. Eliminating --depositYocto will couple --deposit and --amount using the same approach you suggest for --gas. Lets hear what others think.