citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit 8112c40220cdb3bb0f6da4d5b1a4a655defcbe36
parent 61e76dd99e0a817fdf3562cd4ce55a2b2d4cf7dc
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  3 Jul 2023 11:38:38 -0700

bin: add bolt11 script

Diffstat:
Abin/bolt11 | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/bin/bolt11 b/bin/bolt11 @@ -0,0 +1,16 @@ +res=$(lcli decode "$@") + +echo "$res" + +<<<"$res" jq -r '.created_at' | xargs -I{} datediff -f '%Hh %Mm %Ss created ago' -i '%s' now {} +<<<"$res" jq -r '.created_at + .expiry' | xargs -I{} datediff -f '%Hh %Mm %Ss until expiry' -i '%s' now {} + +amount=$(<<<"$res" jq -r .amount_msat) + +if [[ $amount == "null" ]] +then + echo "any amount" +else + bcalc "$amount msat to sats" +fi +