aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-get-balances
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ak-get-balances')
-rwxr-xr-xbin/ak-get-balances53
1 files changed, 36 insertions, 17 deletions
diff --git a/bin/ak-get-balances b/bin/ak-get-balances
index 5fe56ea..f5f57ca 100755
--- a/bin/ak-get-balances
+++ b/bin/ak-get-balances
@@ -1,4 +1,22 @@
-#!/bin/bash
+#!/usr/bin/env bash
+###
+### arching-kaos-tools
+### Tools to interact and build an Arching Kaos Infochain
+### Copyright (C) 2021 - 2025 kaotisk
+###
+### This program is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation, either version 3 of the License, or
+### (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
##
## Calculates the balances of the sblocks found from a chain
## Saves stuff too for later reference
@@ -10,14 +28,15 @@
fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Export balances from schain and zchains"
-source $AK_LIBDIR/_ak_log
-source $AK_LIBDIR/_ak_script
-source $AK_LIBDIR/_ak_ipfs
-source $AK_LIBDIR/_ak_gpg
-source $AK_LIBDIR/_ak_zchain
-source $AK_LIBDIR/_ak_schain
-source $AK_LIBDIR/_ak_sblock
-source $AK_LIBDIR/_ak_coin
+source $AK_LIBDIR/_ak_lib_load
+_ak_lib_load _ak_log
+_ak_lib_load _ak_script
+_ak_lib_load _ak_ipfs
+_ak_lib_load _ak_gpg
+_ak_lib_load _ak_zchain
+_ak_lib_load _ak_schain
+_ak_lib_load _ak_sblock
+_ak_lib_load _ak_coin
#set -xe
AK_DB="$AK_WORKDIR/db"
@@ -55,7 +74,7 @@ fi
TEMP="$(_ak_make_temp_directory)"
cd $TEMP
-_ak_get_zblocks_from_sblock(){
+function _ak_get_zblocks_from_sblock(){
if [ "$(_ak_sblock_show $1 | jq 'has("zblocks")')" == "true" ]
then
mkdir $1 && cd $1
@@ -67,7 +86,7 @@ _ak_get_zblocks_from_sblock(){
fi
}
-_ak_verify_zblocks_found(){
+function _ak_verify_zblocks_found(){
if [ -d $1 ]
then
cd $1
@@ -101,7 +120,7 @@ _ak_verify_zblocks_found(){
fi
}
-_ak_balances_from_sblock(){
+function _ak_balances_from_sblock(){
if [ -z $1 ] || [ ! -n "$1" ]
then
_ak_log_error "No sblock provided $1"
@@ -137,7 +156,7 @@ _ak_balances_from_sblock(){
fi
}
-_ak_rewards_from_sblock(){
+function _ak_rewards_from_sblock(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
@@ -173,7 +192,7 @@ _ak_rewards_from_sblock(){
fi
}
-_ak_sblock_get_previous(){
+function _ak_sblock_get_previous(){
if [ -z $1 ] || [ ! -n "$1" ]
then
_ak_log_error "No sblock provided !!"
@@ -189,7 +208,7 @@ _ak_sblock_get_previous(){
echo -n $PREVIOUS
}
-_ak_balances_calculate(){
+function _ak_balances_calculate(){
if [ ! -z $1 ] && [ -n "$1" ]
then
_ak_log_info "Calculating balance for $1"
@@ -219,7 +238,7 @@ _ak_balances_calculate(){
fi
}
-_ak_balances_print(){
+function _ak_balances_print(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"
@@ -237,7 +256,7 @@ _ak_balances_print(){
fi
}
-_ak_schain_counting_balances(){
+function _ak_schain_counting_balances(){
if [ ! -z $1 ] && [ -n "$1" ]
then
CUR_TARGET="$1"