gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
880 stars 364 forks source link

Proposition to add a $GNOADDR or $ADDRESS env variable #2451

Closed Molaryy closed 2 months ago

Molaryy commented 3 months ago

Each time I need to access to my address to interact with a realm or package I need to do:

gnokey list

and then copy the address.

To go faster I added in my .zshrc this line:

export GNOADDR=$(gnokey list | cut -b 27-66)

This will exactly get the address and store it in my env, so I can just do an echo $GNOADDR to get it faster.

I also added a function in bash that gets the $GNOADDR variable and then adds it to the clipboard.

copy_gno_addr() {
    echo $GNOADDR |pbcopy
    echo Copied $GNOADDR successfully!
}

I'm using MacOS so I used pbcopy but linux users can replace it with xclip.

The purpose of this is to simplify user interaction with addresses and enhance security by preventing users from accidentally not copying the entire address. And also to replace the default value in the realm help examples ADDRESS by $GNOADDR.

Please let me know what do you think about this :)

thehowl commented 3 months ago

You can use the key name instead of the full address when using gnokey. ie.

gnokey maketx call -pkgpath "gno.land/r/demo/counter" -func "Increment" -gas-fee 1000000ugnot -gas-wanted 2000000 -send "" -broadcast -chainid "dev" -remote 127.0.0.1:26657 mykeyname

I think this makes it unnecessary to have environment variables. If this is something that you didn't know, then it means that our documentation (both --help and docs.gno.land) did not explain it adequately; so please make a PR to fix that :)

Molaryy commented 3 months ago

Oh yes, I completely forgot about this. The documentation is clear about that 👍🏻 no need to fix it, I just forgot about it, thanks for reminding me!