-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6776ee8
commit 4ccd831
Showing
4 changed files
with
209 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
CURRENT_FILE=${BASH_SOURCE:-bats/helpers/.} | ||
source "$(dirname "$CURRENT_FILE")/../_common.bash" | ||
source "$(dirname "$CURRENT_FILE")/../cli.bash" | ||
|
||
create_new_lnd_onchain_address() { | ||
local wallet_name=$1 | ||
local wallet_id=$(read_value $wallet_name) | ||
|
||
insert_lnd1_address() { | ||
local wallet_id=$1 | ||
local address=$2 | ||
pubkey=$(lnd_cli getinfo | jq -r '.identity_pubkey') | ||
|
||
mongo_command=$(echo "db.wallets.updateOne( | ||
{ id: \"$wallet_id\" }, | ||
{ | ||
\$push: { | ||
onchain: { | ||
address: \"$address\", | ||
pubkey: \"$pubkey\" | ||
} | ||
} | ||
} | ||
);" | tr -d '[:space:]') | ||
|
||
mongo_cli "$mongo_command" | ||
} | ||
|
||
address=$(lnd_cli newaddress p2wkh | jq -r '.address') | ||
insert_lnd1_address "$wallet_id" "$address" > /dev/null | ||
|
||
echo $address | ||
} |
Oops, something went wrong.