Files
mint_ore/solBalance.sh
2024-04-08 08:39:01 +08:00

18 lines
596 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
#export http_proxy="http://10.3.255.132:51837"
#export https_proxy="http://10.3.255.132:51837"
rpc=https://api.mainnet-beta.solana.com
total_sol=0
files=$(find . -maxdepth 2 -type f -name "*.json")
for keyfile in $files;
do
# 获取源账户余额以lamports为单位
balance_lamports=$(solana balance $keyfile --url $rpc --output json | jq -r '.lamports')
balance_SOL=$(echo "scale=9; $balance_lamports / 1000000000" | bc)
total_sol=$(echo "$total_sol + $balance_SOL" | bc)
echo $keyfile $balance_SOL SOL
done
printf "Total SOL: %.9f SOL\n" "$total_sol"