I use an interactive wallet spectre-cli
of Spectre, a coin similar toKaspa in its design.When I manually want to get the balance of my wallet I need to runspectre-cli
and then connect
, open
from within spectre-cli
. All this looks like this:
spectre-cliSpectre Cli Wallet v0.3.16 (type 'help' for list of commands)$ connectConnected to Spectre node version 0.3.16 at ws://127.0.0.1:19110$ openEnter wallet password: Your wallet hint is: This is a hint.$ $ • ****************• [********]: 4.47042578 SPR 1 UTXOs spectre:******************************************************[********] • 4.47042578 SPR $
I wrote an expect script meant to do those steps for me (so that the only thing Iwould need to type is my password):
#!/usr/bin/expect -f# Set a timeout (in seconds) for how long to wait for each promptset timeout 5spawn spectre-cliexpect "$ " send "connect\r"expect "$ " send "open\r"interact
I get inconsistent output from the script. About 70% of the time I get:
./get_balance_works.exp spawn spectre-cliSpectre Cli Wallet v0.3.16 (type 'help' for list of commands)$ connectconnectopencommand not found: connectopen$
whereas the rest of the time the script works as expected:
./get_balance_works.exp spawn spectre-cliSpectre Cli Wallet v0.3.16 (type 'help' for list of commands)$ connect$ openConnected to Spectre node version 0.3.16 at ws://127.0.0.1:19110Enter wallet password: Your wallet hint is: This is a hint.$ $ • ****************• [********]: 4.47042578 SPR 1 UTXOs spectre:******************************************************[********] • 4.47042578 SPR $
Is there a way to make the script work as expected in a consistent manner?
P.S. I am on a Ubuntu LTS.