0

I asked this question on StackOverflow but I guess this would have been a better place to ask, so I'm reposting

I'm writing an automation script that creates a wallet when necessary. the problem I have is that cleos wallet list gives me an empty result:

Wallets: []

even when there is a wallet already in existence, because (apparently) I need to open it first with cleos wallet open

this means that I cannot rely on the list command to tell whether I need to create a wallet. but of course, if I try to open a wallet when none has been created, it fails

so what is the recommended way to determine whether my wallet already exists?

Addendum I

I have a similar issue with cleos get accounts. see: https://github.com/EOSIO/eos/issues/7395

2
  • Does it work properly when you type in cleos wallet list in you CLI? I mean without the automation scrypt.
    – Jinu
    Commented May 27, 2019 at 12:07
  • no. it comes up empty unless I open the wallet first, as stated. the problem isn't with the script. it's a problem with cleos -- it should show wallets when not open. after all, how are you supposed to know what wallet you might want to open if you can't get a listing?
    – ekkis
    Commented May 28, 2019 at 22:34

1 Answer 1

1

Can't you just look whether the wallet file exists? Each wallet is stored in a .wallet file in a directory specified in the configuration file config.ini. In my case the directory is ~/eosio-wallet.

1
  • that solution is a little more complicated. I now need to look at the process list to find the running node, see if it was given a parameter for where the wallet should be stored (and if not given then use ~/eosio-wallet as you suggest) and then go look. the point of having a CLI is it abstracts you from having to do this low-level, error-prone stuff. form my view cleos should give you a list of wallets regardless of whether you've "opened" anything. in fact, I should just file a bug against it
    – ekkis
    Commented Jun 2, 2019 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.