add `fund_user` sndev command (#1214)
* add `fund_user` sndev command * update help and set msats rather than add --------- Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
This commit is contained in:
parent
3d3dc52cec
commit
e9aa268996
38
sndev
38
sndev
|
@ -219,6 +219,43 @@ USAGE
|
|||
echo "$help"
|
||||
}
|
||||
|
||||
sndev__fund_user() {
|
||||
shift
|
||||
if [ -z "$1" ]; then
|
||||
echo "<nym> argument required"
|
||||
sndev__help_fund_user
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
echo "<msats> argument required"
|
||||
sndev__help_fund_user
|
||||
exit 2
|
||||
fi
|
||||
re='^[0-9]+$'
|
||||
if ! [[ $2 =~ $re ]]; then
|
||||
echo "<msats> is not a positive integer"
|
||||
sndev__help_fund_user
|
||||
exit 3
|
||||
fi
|
||||
docker__exec db psql -U sn -d stackernews -q <<EOF
|
||||
UPDATE users set msats = $2 where name = '$1';
|
||||
EOF
|
||||
}
|
||||
|
||||
sndev__help_fund_user() {
|
||||
help="
|
||||
fund a nym without using an LN invoice (local only)
|
||||
|
||||
USAGE
|
||||
$ sndev fund_user <nym> <msats>
|
||||
|
||||
<nym> - the name of the user you want to fund
|
||||
<msats> - the amount of millisatoshis to set the account to. Must be >= 0
|
||||
"
|
||||
|
||||
echo "$help"
|
||||
}
|
||||
|
||||
sndev__fund() {
|
||||
shift
|
||||
docker__stacker_lnd -t payinvoice "$@"
|
||||
|
@ -516,6 +553,7 @@ COMMANDS
|
|||
|
||||
sn:
|
||||
login login as a nym
|
||||
fund_user fund a nym without using an LN invoice
|
||||
|
||||
lnd:
|
||||
fund pay a bolt11 for funding
|
||||
|
|
Loading…
Reference in New Issue